MiCyte

← The wiki

93 — The marketplace

BuiltRendered from 93-the-marketplace.md in the public repository. Edits belong there.

This page states what a package is, what installing one does, how the catalogue is published to micyte.com, and what an instance's Marketplace lists. What an installed package may do is decided by the port layers in 92.

Packages and extensions

Packages are declared in micyte/tools/_packages.py; they are not generated from the tool registry. micyte_packages() returns them.

KindShipsDeclaresBuilt with
Package (app)tools, and the documents they need—build_package()
Extensionno toolsthe port it fills (PortFill)_extension()

build_package() takes a package's requires and writes from its tools (requirements_for and declared_writes in micyte/tools/_registry.py); they are not restated in the package.

Installing

fnd_app/instances/_shared/runtime/package_install_runtime.py. An install does two things:

  1. Writes tool_exposure, so the instance shows the package's tools.
  2. Provisions what the tools declare they need: the sources rows they read and the blank documents they hold.

It writes no grant. What a tool may write is decided by micyte.ports.datum_write_policy, which denies when there is no grant.

A tool is offered only when the instance holds the documents its requires names, so an install that skipped step 2 would leave a tool that never appears. unmet_requirements() (micyte/ports/tool_package/contracts.py) computes the missing set; the install and the install preview both call it.

Uninstalling sets exposure to false. It deletes no documents.

Publishing the catalogue

The website does not import this repository. The catalogue is exported to files:

micyte/tools/_packages.py                                  the declaration
  ├─ fnd_app/scripts/export_micyte_package_catalog.py --write
  │    └─ micyte-packages.manifest.json in the site's assets
  │         ├─ gen_gadgets.py (site repo)    → the /gadgets page
  │         └─ stamp_release.py (site repo)  → the release number and repository URL on pages
  └─ fnd_app/scripts/export_micyte_gadget_declarations.py --write
       └─ declarations/<id>-<version>.micytepkg.json in a checkout of MiCyte/Gadgets
            ├─ build_catalogue (Gadgets repo)       → catalogue.json, packages.json
            └─ sync_gadget_catalogue (site repo)    → the copy /gadgets offers for download

The portal's GET /__mss/public/packages is computed by the same package_to_dict, so the repository, the site and the portal state the same digest for each package. A package's name, version, summary, tool list and the number of documents it provisions are typed once, in _packages.py. The site shows the number of provisioned documents, not their names.

An instance's Marketplace

Utilities › Marketplace lists five kinds (marketplace_pool.py):

KindWhat it isSourceInstalling
Web toolsA page on micyte.com that needs no accountfnd_app/instances/_shared/runtime/web_tools.pyNot installed; it is a page
AppsA workspace with its own tabs and documentsThe catalogueInto a chosen sandbox, from Install and update
InstrumentsA view of one kind of thing across every sandboxBuilt inNothing to install
ExtensionsConnects apps to an outside service; no screenThe catalogueFrom its card
ChannelsA read-only surface this instance opens to the outside (91)Built inNothing to install

Each card states what the item does, what it needs, its version, and its source. The page makes no network request when it is drawn. Three links on a card leave the instance:

  • Open on micyte.com (web tools). The one web tool is the Almanac (/tools/almanac). It opens as its own page on micyte.com, in a new tab, so its address can be bookmarked; it is never framed here.
  • Preview (apps with a demo). https://micyte.com/demo?gadget=<id> draws the app's own payload over made-up data with the portal's renderer. The apps with a demo are listed in fnd_app/instances/_shared/runtime/tool_demos.py: Quiar, Brevat, Almanac, Oveure and PIM. Enchir has no demo because its subject is a live website.
  • Declaration (apps and extensions). The package's file in the MiCyte/Gadgets repository, linked only when the repository holds the version shown on the card.

The overlay loads micyte.com in a sandboxed frame with no referrer. The framed page cannot navigate the portal, and nothing done in a demo reaches an instance.

export_tool_demos.py --write writes web_tools.json for the site's Access page from the same web_tools.py; --check refuses a site copy that differs.

The package source port

package_source is a port type with one operation, packages.pull. A pull tells the catalogue's server that this instance exists and which build it runs.

  • Unbound (the default): the instance lists its own build's packages (LocalPackageSource).
  • Bound: the pull is checked against the binding's actor and the extension's service name. A bound, ungranted source is refused.
  • The first fill is the published_catalogue extension (fnd_app/packages/peripherals/packages/published_catalogue.py, PublishedCatalogueSource). It installs no tools and supplies only the catalogue's address. fnd_app/instances/_shared/runtime/package_update_transport.py performs the fetch, authorizes it first, caps the response size and checks every entry's digest before caching it.

tool_package is not bindable; it is the contract every package satisfies.

Not built

  • The catalogue address on the binding. The address is still read from the gadget_catalogue configuration key.
  • A GitHub fill for package_source.
  • Installing a package file offline, and the update check an offline instance would run.