Files
deepseek-harness/website/zh-CN/api/cordis/service.md
2026-07-19 14:14:02 +08:00

3.1 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.

Source

service.name

/** The service name this instance is registered under. */
public name!: string

The service name this instance is registered under.

Source

Static members

Service.init

/** Symbol key of an instance method run after construction (class plugins). */
static readonly init: unique symbol

Symbol key of an instance method run after construction (class plugins).

Source

Service.check

/** Symbol key of the availability predicate passed to `ctx.provide()`. */
static readonly check: unique symbol

Symbol key of the availability predicate passed to ctx.provide().

Source

Service.config

/** Symbol key of the phantom intercept-config type parameter. */
static readonly config: unique symbol

Symbol key of the phantom intercept-config type parameter.

Source

Service.invoke

/** Symbol key of the call body making a service callable (e.g. `ctx.logger()`). */
static readonly invoke: unique symbol

Symbol key of the call body making a service callable (e.g. ctx.logger()).

Source

Service.extend

/** Symbol key of the helper deriving an extended service instance. */
static readonly extend: unique symbol

Symbol key of the helper deriving an extended service instance.

Source

Service.tracker

/** Symbol key of the tracker metadata used for context tracing. */
static readonly tracker: unique symbol

Symbol key of the tracker metadata used for context tracing.

Source

Service.resolveConfig

/** Symbol key of the intercept-config resolution helper below. */
static readonly resolveConfig: unique symbol

Symbol key of the intercept-config resolution helper below.

Source