core-data-structures 18 篇(core.md 因超长仍在产出、随后补)、 postmortem 3 篇与 RFC 前门 README 配对;流水线 + 二遍校验产出。 生成文件 docs/rfc/INDEX.md(gen-rfc-index 产物)列入排除。中文侧 页内锚点统一指向英文侧锚名,满足配对门禁的链接目标一致规则。
41 lines
1.5 KiB
Markdown
41 lines
1.5 KiB
Markdown
# System Prompt Assembly
|
|
|
|
English | [中文](system-prompt.zh.md)
|
|
|
|
The [system-prompt package](../../packages/core/system-prompt) owns the data exchanged between prompt contributors and one assembly call. The package [README](../../packages/core/system-prompt/README.md) documents registration, ordering, scoping, and rendering behavior; this page pins the literal cross-package shapes that plugins implement or pass.
|
|
|
|
Source: [`packages/core/system-prompt/src/index.ts`](../../packages/core/system-prompt/src/index.ts).
|
|
|
|
## Assembly context
|
|
|
|
`AssembleContext` identifies the scope layer one assembly resolves. It is merge-extensible: `dsh-agent` adds the optional live `agent` field, and `assembleContextFor(agent)` sets that field and `scope` together.
|
|
|
|
```ts type-equiv
|
|
interface AssembleContext {
|
|
scope?: ScopeKey
|
|
}
|
|
```
|
|
|
|
## Tool-provider result
|
|
|
|
`ToolProviderResult.schemas` is the model-visible set for the current assembly. `knownNames` is the provider's pre-restriction name universe used to distinguish a configured-name typo from a known tool that is deliberately hidden in this scope.
|
|
|
|
```ts type-equiv
|
|
interface ToolProviderResult {
|
|
readonly schemas: readonly ToolSchema[]
|
|
readonly knownNames?: readonly string[]
|
|
}
|
|
```
|
|
|
|
## Prompt sections
|
|
|
|
`PromptSection` is a readonly same-process registration contract. Its text may be static or resolved from the current assembly context.
|
|
|
|
```ts type-equiv
|
|
interface PromptSection {
|
|
readonly name: string
|
|
readonly order: number
|
|
readonly text: string | ((context: AssembleContext) => string)
|
|
}
|
|
```
|