@projectpac/sdk
v0.6.0
Published
Contracts plugins of PAC compile against.
Readme
@projectpac/sdk
What plugins compile against. Contracts only: the common types, the branded
ids and their schemas, the manifest, the seam contracts, and the Context and
Events declaration merges. No plugin behavior lives here, which is what
lets a plugin depend on this package and nothing else in the repo.
One file per core plugin, each carrying that plugin's own seam. A contract is
here because a core plugin drives it -- core/network calls transports,
core/intelligence invokes executors, core/discovery queries adapters. A
service flows call directly, with no core plugin in the middle, is not the
kernel's to declare: it lives with the packages that implement it, and flows
import it from there.
| file | contract |
| ----------------- | ------------------------------------------------------------------------- |
| common.ts | branded ids and the one path-safety rule, Json, Timestamp, Disposer |
| errors.ts | PACError and the codes callers match on |
| identity.ts | Identity |
| network.ts | Network, Envelope, PeerRef, Transport |
| discovery.ts | Discovery, Advertisement, DiscoveryAdapter |
| intelligence.ts | Intelligence, RunSpec, Executor, Executors, TurnSettledEvent |
| worker.ts | the worker routes' schemas, WORKER_DIR, EXECUTORS_FILE |
| trace.ts | Trace |
| api.ts | ControlApi |
| manifest.ts | PluginManifest, PluginKind |
| host.ts | Host, InstallRequest, PackageSource, PluginBinding |
| context.ts | the ctx.* service keys and the core/* events |
Deliberate departures from the original spec, the first two in the direction of its own conventions:
- The seam contracts are interfaces rather than abstract classes, so the sdk
emits no runtime code beyond
PACErrorand the schemas. trace.appendtakes a record without anactor: attribution comes from the accessing context, so a caller cannot supply it.triggerstays an input -- only the caller knows whether it acted for a principal, a peer, or itself.Networkgainsroute()andlocalAddresses().routeis how a plugin declares that this node runs it, which the spec requires ("an envelope naming a plugin this node does not run is rejected") without saying who writes it; the adapter derives the declaring plugin, so one can only declare itself, and disabling it withdraws the declaration. A discovery adapter registers this node as aPeerRef, whose addresses belong to the transports and are therefore known only to the adapter; without this there is no way to build one.
