Files
deepseek-harness/website/zh-CN/api/harness/system-prompt.md
lintianle fcd9d8c391 website: fix nine review findings (generator coverage, loader facts, mode semantics)
Generator (all four structural gaps):
- harness service pages now render public properties/accessors, not just
  methods (ctx.codeRuntime.language/isolation were missing);
- the class page merges the same-named interface half, so ctx.root/baseUrl/
  events/logger/reflect/registry appear on Context (vendor root JSDoc gains
  prose alongside @experimental);
- Pick<…> heritage on a Context merge resolves to the picked class members,
  giving ctx.effect a documented signature on the Fiber page;
- {@link} tags normalize to code spans; merge sections get their own h2 so
  reflect members no longer nest under 'Static members'.

verify-website-yaml: reject the unloadable 'group:' pseudo-name (tree.import
only special-cases 'cordis:'; no builtin is registered here) and recurse into
@cordisjs/plugin-group nested entry lists instead.

Prose corrected against loader/cordis source: service.md isolation example
uses the real group plugin + group: true + the required isolate map;
config.md documents concurrent entry startup (Promise.all; order via inject)
and the real hmr defaults (root ['.'], base/ignored/debounce); events.md
fixes emit (synchronous, not parallel), bail (null/false also delegate), and
serial (stops at the first bail value).
2026-07-16 21:15:44 +08:00

4.4 KiB

ctx.systemPrompt

SystemPrompt — provided by @deepseek-ai/dsh-system-prompt.

Registry service (ctx.systemPrompt): plugins contribute ordered text sections, tool-schema providers, and named prompt variables; the agent loop calls assemble(context) once per step. Registers the harness-owned harness:identity and deployment:persona sections itself (see Config.persona).

Source

ctx.systemPrompt.section(section)

section(section: PromptSection): () => void

Contribute a text section to the system prompt. Order is determined by section.order (ascending). Throws if a section with the same name is already registered (a duplicate would silently double prompt text — e.g. a double-loaded tool plugin). The section is removed when the calling fiber is disposed. Emits system-prompt/change on register/unregister.

  • section — the section to contribute (name, order, text or provider).

Returns the disposer that removes the section.

Source

ctx.systemPrompt.tools(provider)

tools(provider: () => ToolSchema[]): () => void

Contribute a tool-schema provider that is evaluated at each assembly call (so it can reflect the live registry state). The provider is removed when the calling fiber is disposed. A provider must not return a schema named TOOL_ORDER_REST; that name is reserved for Config.toolOrder's rest entry and rejects the assembly. Emits system-prompt/change.

  • provider — evaluated at every assemble for fresh schemas.

Returns the disposer that removes the provider.

Source

ctx.systemPrompt.variable(name, provider)

variable(name: string, provider: (context: AssembleContext) => string | undefined): () => void

Contribute a named prompt variable, referenced from section text as {{name}}. The provider is evaluated at each assembly with that assembly's AssembleContext; returning undefined means "no value for this assembly" (a section referencing it then fails to render — a deployment must not claim facts it does not have). Throws on a name that does not match [a-z][a-z0-9_]* (it could never be referenced) or is already registered. Removed when the calling fiber is disposed; emits system-prompt/change on register/unregister.

  • name — the reference name (matches [a-z][a-z0-9_]*).
  • provider — evaluated at every assemble for the value.

Returns the disposer that removes the variable.

Source

ctx.systemPrompt.assemble(context?)

async assemble(context: AssembleContext = {}): Promise<PromptAssembly>

Assemble the current prompt for one caller: section texts are resolved against context and sorted by order, tools collected from all providers and put in the canonical model-facing order (Config.toolOrder, or lexicographic name order when unconfigured — provider registration order is a plugin-load artifact and never reaches the assembly; a configured order naming a tool no provider contributed rejects the assembly), and every registered variable resolved against context into assembly.variables. Tool schemas are deep-cloned because adapters and request waterfalls may mutate schema objects. Runs through the system-prompt/assemble waterfall, giving listeners the opportunity to mutate or replace the assembly before it reaches the model — like the sections' order sort, tool canonicalization happens on the initial assembly, and a listener owns the determinism of whatever it emits. Await the result before reading the assembly values — waterfall listeners may be async. Interpolation happens later, in renderPrompt.

  • context — what this assembly is for (defaults to an empty context; see AssembleContext).

Returns the assembly after the waterfall has run.

Source