scripts/gen-website-api.ts renders website/zh-CN/api/{cordis,harness}/* and the
api-sidebar.json fragment the VitePress config imports, so pages and navigation
can never drift from the code: signatures, @param/@returns prose, dispatch
modes, and GitHub source links are extracted, never transcribed, and the
generator hard-errors on any rendered member missing docs. verify-website-api
(doc-sync + run-gates) is the freshness gate.
Replaces the hand-written zh api pages (7 pages covering 7 of 15 services,
with phantom APIs: Context.current/Context.events, agent/post-step, tool/call,
compact/*, llm/pre-request none of which exist) with generated English
references: 5 cordis pages, 15 per-service pages, and a 35-event catalog
grouped by scope. The hand-written hub api/index.md stays and now indexes the
full surface; zh for these pages arrives with the unified translation flow.
2.5 KiB
Service
Base class for context services: subclass it and load the subclass as a plugin to register ctx.<name>.
Base class for services that expose a named API on ctx.
Subclasses call super(ctx, name) from their constructor. The service is registered immediately and is automatically removed with the owning fiber.
service.name
public name!: string
The service name this instance is registered under.
Static members
Service.init
static readonly init: unique symbol
Symbol key of an instance method run after construction (class plugins).
Service.check
static readonly check: unique symbol
Symbol key of the availability predicate passed to ctx.provide().
Service.config
static readonly config: unique symbol
Symbol key of the phantom intercept-config type parameter.
Service.invoke
static readonly invoke: unique symbol
Symbol key of the call body making a service callable (e.g. ctx.logger()).
Service.extend
static readonly extend: unique symbol
Symbol key of the helper deriving an extended service instance.
Service.tracker
static readonly tracker: unique symbol
Symbol key of the tracker metadata used for context tracing.
Service.resolveConfig
static readonly resolveConfig: unique symbol
Symbol key of the intercept-config resolution helper below.