@qilin-agent/system-prompt 3.1.3 → 3.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +40 -37
- package/README.md +9 -3
- package/README.zh.md +9 -3
- package/lib/index.js +50 -9
- package/lib/types/index.d.ts +24 -5
- package/package.json +6 -6
package/README.i18n.yaml
CHANGED
|
@@ -5,84 +5,87 @@
|
|
|
5
5
|
/:
|
|
6
6
|
en: 51d99b2500db958f
|
|
7
7
|
zh: 91f2b113ba7989fd
|
|
8
|
-
/qilin-system-prompt:
|
|
9
|
-
en:
|
|
10
|
-
zh:
|
|
11
|
-
/qilin-system-prompt/summary:
|
|
8
|
+
/qilin-agent-system-prompt:
|
|
9
|
+
en: e055adfb8078d76e
|
|
10
|
+
zh: 0ef22d7fa3664d17
|
|
11
|
+
/qilin-agent-system-prompt/summary:
|
|
12
12
|
en: ca3bf8175b50bb4f
|
|
13
13
|
zh: 528223498f6ae517
|
|
14
|
-
/qilin-system-prompt/table-of-contents:
|
|
14
|
+
/qilin-agent-system-prompt/table-of-contents:
|
|
15
15
|
en: d152484eb41ac6b4
|
|
16
16
|
zh: 09388d293f9be9cb
|
|
17
|
-
/qilin-system-prompt/use-this-package:
|
|
17
|
+
/qilin-agent-system-prompt/use-this-package:
|
|
18
18
|
en: b6ad9defa94ac243
|
|
19
19
|
zh: 89f4dd6352cd341e
|
|
20
|
-
/qilin-system-prompt/use-this-package/configure-the-prompt:
|
|
21
|
-
en:
|
|
22
|
-
zh:
|
|
23
|
-
/qilin-system-prompt/use-this-package/contribute-a-prompt-section:
|
|
20
|
+
/qilin-agent-system-prompt/use-this-package/configure-the-prompt:
|
|
21
|
+
en: 186edc62fe4c05aa
|
|
22
|
+
zh: 34605297e98231ff
|
|
23
|
+
/qilin-agent-system-prompt/use-this-package/contribute-a-prompt-section:
|
|
24
24
|
en: 15d70e3b8eddd636
|
|
25
25
|
zh: a3a67cab60eee86f
|
|
26
|
-
/qilin-system-prompt/use-this-package/contribute-a-prompt-variable:
|
|
27
|
-
en:
|
|
28
|
-
zh:
|
|
29
|
-
/qilin-system-prompt/use-this-package/contribute-tool-schemas:
|
|
26
|
+
/qilin-agent-system-prompt/use-this-package/contribute-a-prompt-variable:
|
|
27
|
+
en: b446eaed75655d68
|
|
28
|
+
zh: f3de147588f41e35
|
|
29
|
+
/qilin-agent-system-prompt/use-this-package/contribute-tool-schemas:
|
|
30
30
|
en: 009ef267dac2f270
|
|
31
31
|
zh: e79c24bff5cd836f
|
|
32
|
-
/qilin-system-prompt/use-this-package/
|
|
33
|
-
en:
|
|
34
|
-
zh:
|
|
35
|
-
/qilin-system-prompt/
|
|
32
|
+
/qilin-agent-system-prompt/use-this-package/contribute-dynamic-context:
|
|
33
|
+
en: 4365bc4a5d228bb2
|
|
34
|
+
zh: 1e23544beca040e0
|
|
35
|
+
/qilin-agent-system-prompt/use-this-package/suppress-runtime-context:
|
|
36
|
+
en: 9104a137c8fef881
|
|
37
|
+
zh: 44edd0a101210473
|
|
38
|
+
/qilin-agent-system-prompt/understand-the-implementation:
|
|
36
39
|
en: ce7e776e9d516bdb
|
|
37
40
|
zh: 59d2751743db7795
|
|
38
|
-
/qilin-system-prompt/understand-the-implementation/design-concept:
|
|
41
|
+
/qilin-agent-system-prompt/understand-the-implementation/design-concept:
|
|
39
42
|
en: c91963b89a866fed
|
|
40
43
|
zh: ef9ef4940145778f
|
|
41
|
-
/qilin-system-prompt/understand-the-implementation/source-map:
|
|
44
|
+
/qilin-agent-system-prompt/understand-the-implementation/source-map:
|
|
42
45
|
en: d9575bcb07a1145b
|
|
43
46
|
zh: 0f1a388780d055b1
|
|
44
|
-
/qilin-system-prompt/understand-the-implementation/assembly-and-rendering:
|
|
47
|
+
/qilin-agent-system-prompt/understand-the-implementation/assembly-and-rendering:
|
|
45
48
|
en: 54977e6c431f851e
|
|
46
49
|
zh: ef60007054b97ff0
|
|
47
|
-
/qilin-system-prompt/understand-the-implementation/scoping:
|
|
50
|
+
/qilin-agent-system-prompt/understand-the-implementation/scoping:
|
|
48
51
|
en: 1100ab1dfe961631
|
|
49
52
|
zh: c510275c893951b4
|
|
50
|
-
/qilin-system-prompt/further-exploration:
|
|
53
|
+
/qilin-agent-system-prompt/further-exploration:
|
|
51
54
|
en: e0313b2ec3ae59a7
|
|
52
55
|
zh: 4ff805fed23f3d03
|
|
53
|
-
/qilin-system-prompt/model-experience:
|
|
56
|
+
/qilin-agent-system-prompt/model-experience:
|
|
54
57
|
en: 215e7ba838619b7b
|
|
55
58
|
zh: a311da3843709f90
|
|
56
|
-
/qilin-system-prompt/model-experience/system-prompt:
|
|
59
|
+
/qilin-agent-system-prompt/model-experience/system-prompt:
|
|
57
60
|
en: cf78b9dd5596495f
|
|
58
61
|
zh: bd44560f8c2435e8
|
|
59
|
-
/qilin-system-prompt/model-experience/system-prompt/what-the-model-sees:
|
|
62
|
+
/qilin-agent-system-prompt/model-experience/system-prompt/what-the-model-sees:
|
|
60
63
|
en: 9927fdee4f8aa8ec
|
|
61
64
|
zh: 3687314c357fa7f4
|
|
62
|
-
/qilin-system-prompt/model-experience/system-prompt/what-the-model-sees/harness-identity:
|
|
65
|
+
/qilin-agent-system-prompt/model-experience/system-prompt/what-the-model-sees/harness-identity:
|
|
63
66
|
en: 40effd71cb503319
|
|
64
67
|
zh: 9969356237a4f398
|
|
65
|
-
/qilin-system-prompt/model-experience/system-prompt/token-effect:
|
|
68
|
+
/qilin-agent-system-prompt/model-experience/system-prompt/token-effect:
|
|
66
69
|
en: 29722e212137deaa
|
|
67
70
|
zh: 92cd0f1a16b10315
|
|
68
|
-
/qilin-system-prompt/model-experience/system-prompt/kv-cache-effect:
|
|
71
|
+
/qilin-agent-system-prompt/model-experience/system-prompt/kv-cache-effect:
|
|
69
72
|
en: 06c93d3134e63dc0
|
|
70
73
|
zh: 344170f0277738e0
|
|
71
|
-
/qilin-system-prompt/model-experience/tool-schemas:
|
|
74
|
+
/qilin-agent-system-prompt/model-experience/tool-schemas:
|
|
72
75
|
en: 3039bc5e7a796b21
|
|
73
76
|
zh: 6b7a9eaf69c9ea53
|
|
74
|
-
/qilin-system-prompt/model-experience/tool-schemas/what-the-model-sees:
|
|
75
|
-
en:
|
|
76
|
-
zh:
|
|
77
|
-
/qilin-system-prompt/model-experience/tool-schemas/token-effect:
|
|
77
|
+
/qilin-agent-system-prompt/model-experience/tool-schemas/what-the-model-sees:
|
|
78
|
+
en: 4b79169eaa1f50af
|
|
79
|
+
zh: 9acc5a130e05e66c
|
|
80
|
+
/qilin-agent-system-prompt/model-experience/tool-schemas/token-effect:
|
|
78
81
|
en: f3a7d374c55e1720
|
|
79
82
|
zh: 0ee48af678cb875f
|
|
80
|
-
/qilin-system-prompt/model-experience/tool-schemas/kv-cache-effect:
|
|
83
|
+
/qilin-agent-system-prompt/model-experience/tool-schemas/kv-cache-effect:
|
|
81
84
|
en: ebd329e360f0d143
|
|
82
85
|
zh: 9d67fe503a6a095a
|
|
83
|
-
/qilin-system-prompt/known-limitations-and-deferred-work:
|
|
86
|
+
/qilin-agent-system-prompt/known-limitations-and-deferred-work:
|
|
84
87
|
en: 23bb9f59ceb1620c
|
|
85
88
|
zh: be34f1770fa2e027
|
|
86
|
-
/qilin-system-prompt/known-limitations-and-deferred-work/dev-note:
|
|
89
|
+
/qilin-agent-system-prompt/known-limitations-and-deferred-work/dev-note:
|
|
87
90
|
en: e67f633dc6fe7773
|
|
88
91
|
zh: 3bb0c20c93f16f98
|
package/README.md
CHANGED
|
@@ -67,19 +67,25 @@ Set `interpolate: false` on a section to preserve its text literally, including
|
|
|
67
67
|
|
|
68
68
|
### Contribute a prompt variable
|
|
69
69
|
|
|
70
|
-
Variables are referenced from section text as `{{name}}` and resolved at each assembly; scoped variables shadow a same-named global for that agent. The loop supplies `
|
|
70
|
+
Variables are referenced from section or context text as `{{name}}` and resolved at each assembly; scoped variables shadow a same-named global for that agent. The loop supplies `provider` and `model`; plugins can register the facts they own. The working-directory service supplies directory text as literal user context.
|
|
71
71
|
|
|
72
72
|
```text
|
|
73
|
-
ctx.systemPrompt.variable('
|
|
73
|
+
ctx.systemPrompt.variable('response_language', () => 'English')
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
+
Custom persona templates must not depend on a built-in `{{cwd}}` variable: the loop does not register it, so unresolved references fail prompt assembly before any model request. Remove the `Your working directory is {{cwd}}.` clause from home, profile, or invocation `personaSuffix` settings and preset `suffix` fields, preserving unrelated text. Omit or clear an otherwise empty suffix. The [working-directory service](../../session/working-directory/README.md) supplies the required current-directory context.
|
|
77
|
+
|
|
76
78
|
### Contribute tool schemas
|
|
77
79
|
|
|
78
80
|
Tool-schema providers are evaluated per assembly and contribute the model-visible `ToolSchema` set; `ToolRuntime` registers itself automatically, so most tools need no manual wiring here. A provider returns the post-restriction visible set plus the pre-restriction name universe used by `toolOrder`.
|
|
79
81
|
|
|
82
|
+
### Contribute dynamic context
|
|
83
|
+
|
|
84
|
+
`context()` registers a runtime fact as a `PromptContext`. `interpolate: false` keeps its text literal, and `required: true` keeps it when optional runtime context is disabled or suppressed. The assembly resolves registered contributions in ascending `order`; `refreshContext()` re-resolves them at request admission, so a fact that moved after assembly (a directory change, a permission change) reaches the same request without reassembling sections, tools, or variables.
|
|
85
|
+
|
|
80
86
|
### Suppress runtime context
|
|
81
87
|
|
|
82
|
-
`suppressRuntimeContext()` removes every dynamic runtime-context contribution for the calling scope without disabling the services that own the underlying facts;
|
|
88
|
+
`suppressRuntimeContext()` removes every optional dynamic runtime-context contribution for the calling scope without disabling the services that own the underlying facts; `required: true` contributions remain. Multiple suppressors compose and the effect restores context when none remains.
|
|
83
89
|
|
|
84
90
|
-----
|
|
85
91
|
|
package/README.zh.md
CHANGED
|
@@ -67,19 +67,25 @@ ctx.systemPrompt.section({
|
|
|
67
67
|
|
|
68
68
|
### 贡献提示词变量
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
变量从段或上下文文本中以 `{{name}}` 引用,每次组装时解析;带作用域的变量会为该 agent 遮蔽同名全局变量。循环提供 `provider` 和 `model`;插件可注册自己拥有的事实。工作目录服务通过不执行插值的用户上下文提供目录文本。
|
|
71
71
|
|
|
72
72
|
```text
|
|
73
|
-
ctx.systemPrompt.variable('
|
|
73
|
+
ctx.systemPrompt.variable('response_language', () => 'English')
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
+
自定义 persona 模板不得依赖内置 `{{cwd}}` 变量:循环不注册它,因此无法解析的引用会在任何模型请求之前使提示词组装失败。请从 home、profile 或单次调用的 `personaSuffix` 设置以及 preset 的 `suffix` 字段中移除 `Your working directory is {{cwd}}.` 语句,保留无关文本。后缀没有其他内容时,可省略或清空该字段。[工作目录服务](../../session/working-directory/README.zh.md) 提供必需的当前目录上下文。
|
|
77
|
+
|
|
76
78
|
### 贡献工具 schema
|
|
77
79
|
|
|
78
80
|
工具 schema 提供方在每次组装时求值,并贡献模型可见的 `ToolSchema` 集合;`ToolRuntime` 会自动注册自身,因此大多数工具在此无需手动接线。提供方返回限制后的可见集合,外加 `toolOrder` 使用的限制前名称全集。
|
|
79
81
|
|
|
82
|
+
### 贡献动态上下文
|
|
83
|
+
|
|
84
|
+
`context()` 把一条运行时事实注册为 `PromptContext`。`interpolate: false` 保留其字面文本,`required: true` 使其在可选运行时上下文被关闭或抑制时仍然保留。assembly 按 `order` 升序解析已注册贡献;`refreshContext()` 在请求准入时重新解析它们,因此装配之后才变化的事实(目录变更、权限变更)能在同一次请求内到达模型,而无需重新装配 section、tool 或 variable。
|
|
85
|
+
|
|
80
86
|
### 抑制运行时上下文
|
|
81
87
|
|
|
82
|
-
`suppressRuntimeContext()`
|
|
88
|
+
`suppressRuntimeContext()` 移除调用作用域的**可选**动态运行时上下文贡献,但不禁用拥有底层事实的服务;`required: true` 的贡献会保留。多个抑制器独立组合,当不再存在抑制器时该 effect 会恢复上下文。
|
|
83
89
|
|
|
84
90
|
-----
|
|
85
91
|
|
package/lib/index.js
CHANGED
|
@@ -43,6 +43,7 @@ const SECTION_ORDERS = {
|
|
|
43
43
|
DEPLOYMENT_PERSONA_SUFFIX: 10200
|
|
44
44
|
};
|
|
45
45
|
const CONTEXT_ORDERS = {
|
|
46
|
+
WORKING_DIRECTORY: 100,
|
|
46
47
|
SANDBOX_POLICY: 110,
|
|
47
48
|
APPROVAL_POLICY: 115,
|
|
48
49
|
SUBAGENT_DELEGATION: 120
|
|
@@ -115,7 +116,7 @@ function renderPrompt(assembly) {
|
|
|
115
116
|
return assembly.sections.map((section) => section.interpolate === false ? section.text : interpolate(section, assembly.variables, "section")).filter((text) => text.length > 0).join("\n\n");
|
|
116
117
|
}
|
|
117
118
|
/**
|
|
118
|
-
* Render the complete dynamic context snapshot.
|
|
119
|
+
* Render the complete dynamic context snapshot, preserving literal contributions.
|
|
119
120
|
* @param assembly - the assembly whose contexts and variables to render.
|
|
120
121
|
* @returns the current full snapshot, or `''` when no context is active.
|
|
121
122
|
*/
|
|
@@ -140,14 +141,15 @@ function joinContextSections(sections) {
|
|
|
140
141
|
*
|
|
141
142
|
* {@link renderContextSnapshot} joins these for the model; a consumer that
|
|
142
143
|
* presents the snapshot uses them to attribute each part to the subsystem that
|
|
143
|
-
* contributed it, without re-splitting the joined prose.
|
|
144
|
+
* contributed it, without re-splitting the joined prose. Contributions with
|
|
145
|
+
* `interpolate: false` preserve literal text instead of resolving prompt variables.
|
|
144
146
|
* @param assembly - the assembly whose contexts and variables to render.
|
|
145
147
|
* @returns one entry per contributing context that rendered to non-empty text.
|
|
146
148
|
*/
|
|
147
149
|
function renderContextSections(assembly) {
|
|
148
150
|
return assembly.contexts.map((context) => ({
|
|
149
151
|
name: context.name,
|
|
150
|
-
text: interpolate(context, assembly.variables, "context")
|
|
152
|
+
text: context.interpolate === false ? context.text : interpolate(context, assembly.variables, "context")
|
|
151
153
|
})).filter((section) => section.text.length > 0);
|
|
152
154
|
}
|
|
153
155
|
/** Interpolate one section or context and attribute diagnostics to its owning input. */
|
|
@@ -176,6 +178,14 @@ function interpolate(input, variables, kind) {
|
|
|
176
178
|
}
|
|
177
179
|
return result + text.slice(last);
|
|
178
180
|
}
|
|
181
|
+
/** Resolve one registered runtime fact without assembling sections or tools. */
|
|
182
|
+
function resolveContext(entry, context) {
|
|
183
|
+
return {
|
|
184
|
+
name: entry.name,
|
|
185
|
+
text: typeof entry.text === "function" ? entry.text(context) : entry.text,
|
|
186
|
+
...entry.interpolate !== void 0 ? { interpolate: entry.interpolate } : {}
|
|
187
|
+
};
|
|
188
|
+
}
|
|
179
189
|
/** All prompt registrations owned by one global or scoped layer. */
|
|
180
190
|
var PromptLayer = class {
|
|
181
191
|
sections;
|
|
@@ -269,7 +279,7 @@ var SystemPrompt = class extends Service {
|
|
|
269
279
|
return this.layers.effect(this.ctx, (layer) => layer.contexts.insert(context.name, context), { label: "systemPrompt.context()" });
|
|
270
280
|
}
|
|
271
281
|
/**
|
|
272
|
-
* Suppress
|
|
282
|
+
* Suppress optional dynamic runtime-context contributions in the calling
|
|
273
283
|
* context's scope without changing the services that own or enforce those
|
|
274
284
|
* facts. Multiple suppressors remain independently disposable.
|
|
275
285
|
* @returns the exact Cordis effect disposer.
|
|
@@ -300,6 +310,39 @@ var SystemPrompt = class extends Service {
|
|
|
300
310
|
return this.layers.effect(this.ctx, (layer) => layer.variables.insert(name, provider), { label: "systemPrompt.variable()" });
|
|
301
311
|
}
|
|
302
312
|
/**
|
|
313
|
+
* Refresh accepted registered runtime facts for request admission. Contexts
|
|
314
|
+
* added only by the assembly waterfall retain their accepted values. Current
|
|
315
|
+
* suppression removes optional contexts, and missing required registrations
|
|
316
|
+
* are restored in registry order. Sections, tools, and interpolation variables
|
|
317
|
+
* retain the accepted assembly; their providers and waterfall do not rerun.
|
|
318
|
+
* @param assembly - accepted assembly for this scope and step.
|
|
319
|
+
* @param context - the same scope and current plugin-defined assembly fields.
|
|
320
|
+
* @returns the accepted assembly with current runtime-context provider text.
|
|
321
|
+
*/
|
|
322
|
+
refreshContext(assembly, context = {}) {
|
|
323
|
+
const providers = this.layers.merge(context.scope, (layer) => layer.contexts);
|
|
324
|
+
const suppressed = !this.layers.global.runtimeContextSuppressors.isEmpty() || this.layers.chainLayers(context.scope).some((layer) => !layer.runtimeContextSuppressors.isEmpty());
|
|
325
|
+
const required = new Map([...providers].filter(([, entry]) => entry.required === true));
|
|
326
|
+
const contexts = [];
|
|
327
|
+
for (const accepted of assembly.contexts) {
|
|
328
|
+
const provider = providers.get(accepted.name);
|
|
329
|
+
required.delete(accepted.name);
|
|
330
|
+
if (suppressed && provider?.required !== true) continue;
|
|
331
|
+
contexts.push(provider === void 0 ? accepted : resolveContext(provider, context));
|
|
332
|
+
}
|
|
333
|
+
for (const provider of required.values()) {
|
|
334
|
+
const index = contexts.findIndex((entry) => {
|
|
335
|
+
const next = providers.get(entry.name);
|
|
336
|
+
return next !== void 0 && next.order > provider.order;
|
|
337
|
+
});
|
|
338
|
+
contexts.splice(index < 0 ? contexts.length : index, 0, resolveContext(provider, context));
|
|
339
|
+
}
|
|
340
|
+
return {
|
|
341
|
+
...assembly,
|
|
342
|
+
contexts
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
303
346
|
* Assemble global and scoped providers, detach tool parameters, apply
|
|
304
347
|
* canonical ordering, then run the assembly waterfall. Scoped sections and
|
|
305
348
|
* variables shadow globals. The returned waterfall value is authoritative
|
|
@@ -346,19 +389,17 @@ var SystemPrompt = class extends Service {
|
|
|
346
389
|
if (section.complete === true) completeSection = { ...assembled };
|
|
347
390
|
return assembled;
|
|
348
391
|
}),
|
|
349
|
-
contexts:
|
|
350
|
-
name: entry.name,
|
|
351
|
-
text: typeof entry.text === "function" ? entry.text(context) : entry.text
|
|
352
|
-
})),
|
|
392
|
+
contexts: [...contextByName.values()].filter((entry) => !runtimeContextSuppressed || entry.required === true).sort((a, b) => a.order - b.order).map((entry) => resolveContext(entry, context)),
|
|
353
393
|
tools: orderTools(collected, this.toolOrder, knownNames),
|
|
354
394
|
variables
|
|
355
395
|
};
|
|
356
396
|
const transformed = await this.ctx.waterfall(scopeTarget(this, scope), "system-prompt/assemble", assembly, context, () => Promise.resolve(assembly));
|
|
357
397
|
if (completeSection === void 0 && !runtimeContextSuppressed) return transformed;
|
|
398
|
+
const requiredContexts = new Set([...contextByName.values()].filter((entry) => entry.required === true).map((entry) => entry.name));
|
|
358
399
|
return {
|
|
359
400
|
...transformed,
|
|
360
401
|
sections: completeSection === void 0 ? transformed.sections : [completeSection],
|
|
361
|
-
contexts: runtimeContextSuppressed ?
|
|
402
|
+
contexts: runtimeContextSuppressed ? transformed.contexts.filter((entry) => requiredContexts.has(entry.name)) : transformed.contexts
|
|
362
403
|
};
|
|
363
404
|
}
|
|
364
405
|
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -74,8 +74,12 @@ export interface PromptContext {
|
|
|
74
74
|
readonly name: string;
|
|
75
75
|
/** Contexts are joined in ascending order. */
|
|
76
76
|
readonly order: number;
|
|
77
|
-
/** Static text or a provider evaluated
|
|
77
|
+
/** Static text or a provider evaluated at assembly and admission refresh. Empty text contributes nothing. */
|
|
78
78
|
readonly text: string | ((context: AssembleContext) => string);
|
|
79
|
+
/** Whether to interpolate prompt variables. Defaults to true; false preserves literal text. */
|
|
80
|
+
readonly interpolate?: boolean;
|
|
81
|
+
/** Keep this operational context when optional runtime context is disabled. */
|
|
82
|
+
readonly required?: boolean;
|
|
79
83
|
}
|
|
80
84
|
/** One section of an assembly: {@link PromptSection} with its text resolved. */
|
|
81
85
|
export interface AssembledSection {
|
|
@@ -92,6 +96,8 @@ export interface AssembledContext {
|
|
|
92
96
|
name: string;
|
|
93
97
|
/** The resolved text before variable interpolation. */
|
|
94
98
|
text: string;
|
|
99
|
+
/** Whether to interpolate prompt variables. Defaults to true; false preserves literal text. */
|
|
100
|
+
interpolate?: boolean;
|
|
95
101
|
}
|
|
96
102
|
/** Tool schemas visible in one assembly and their pre-restriction name set. */
|
|
97
103
|
export interface ToolProviderResult {
|
|
@@ -148,6 +154,7 @@ declare const SECTION_ORDERS: {
|
|
|
148
154
|
/** Name of a centrally allocated prompt-section position. */
|
|
149
155
|
export type PromptSectionOrderName = keyof typeof SECTION_ORDERS;
|
|
150
156
|
declare const CONTEXT_ORDERS: {
|
|
157
|
+
readonly WORKING_DIRECTORY: 100;
|
|
151
158
|
readonly SANDBOX_POLICY: 110;
|
|
152
159
|
readonly APPROVAL_POLICY: 115;
|
|
153
160
|
readonly SUBAGENT_DELEGATION: 120;
|
|
@@ -169,7 +176,7 @@ export declare const TOOL_ORDER_REST = "<unlisted-tools>";
|
|
|
169
176
|
export interface Config {
|
|
170
177
|
/** Include the fixed QiLin identity before the deployment persona (default true). */
|
|
171
178
|
includeHarnessIdentity?: boolean;
|
|
172
|
-
/** Include
|
|
179
|
+
/** Include optional runtime-context snapshots in model history (default true); required context remains. */
|
|
173
180
|
includeRuntimeContext?: boolean;
|
|
174
181
|
/**
|
|
175
182
|
* Deployment-wide persona prefix template before first-party guidance. A scoped section named
|
|
@@ -199,7 +206,7 @@ export interface Config {
|
|
|
199
206
|
*/
|
|
200
207
|
export declare function renderPrompt(assembly: PromptAssembly): string;
|
|
201
208
|
/**
|
|
202
|
-
* Render the complete dynamic context snapshot.
|
|
209
|
+
* Render the complete dynamic context snapshot, preserving literal contributions.
|
|
203
210
|
* @param assembly - the assembly whose contexts and variables to render.
|
|
204
211
|
* @returns the current full snapshot, or `''` when no context is active.
|
|
205
212
|
*/
|
|
@@ -218,7 +225,8 @@ export declare function joinContextSections(sections: readonly ContextSnapshotSe
|
|
|
218
225
|
*
|
|
219
226
|
* {@link renderContextSnapshot} joins these for the model; a consumer that
|
|
220
227
|
* presents the snapshot uses them to attribute each part to the subsystem that
|
|
221
|
-
* contributed it, without re-splitting the joined prose.
|
|
228
|
+
* contributed it, without re-splitting the joined prose. Contributions with
|
|
229
|
+
* `interpolate: false` preserve literal text instead of resolving prompt variables.
|
|
222
230
|
* @param assembly - the assembly whose contexts and variables to render.
|
|
223
231
|
* @returns one entry per contributing context that rendered to non-empty text.
|
|
224
232
|
*/
|
|
@@ -258,7 +266,7 @@ export declare class SystemPrompt extends Service {
|
|
|
258
266
|
*/
|
|
259
267
|
context(context: PromptContext): () => void;
|
|
260
268
|
/**
|
|
261
|
-
* Suppress
|
|
269
|
+
* Suppress optional dynamic runtime-context contributions in the calling
|
|
262
270
|
* context's scope without changing the services that own or enforce those
|
|
263
271
|
* facts. Multiple suppressors remain independently disposable.
|
|
264
272
|
* @returns the exact Cordis effect disposer.
|
|
@@ -281,6 +289,17 @@ export declare class SystemPrompt extends Service {
|
|
|
281
289
|
* @returns the exact Cordis effect disposer.
|
|
282
290
|
*/
|
|
283
291
|
variable(name: string, provider: (context: AssembleContext) => string | undefined): () => void;
|
|
292
|
+
/**
|
|
293
|
+
* Refresh accepted registered runtime facts for request admission. Contexts
|
|
294
|
+
* added only by the assembly waterfall retain their accepted values. Current
|
|
295
|
+
* suppression removes optional contexts, and missing required registrations
|
|
296
|
+
* are restored in registry order. Sections, tools, and interpolation variables
|
|
297
|
+
* retain the accepted assembly; their providers and waterfall do not rerun.
|
|
298
|
+
* @param assembly - accepted assembly for this scope and step.
|
|
299
|
+
* @param context - the same scope and current plugin-defined assembly fields.
|
|
300
|
+
* @returns the accepted assembly with current runtime-context provider text.
|
|
301
|
+
*/
|
|
302
|
+
refreshContext(assembly: PromptAssembly, context?: AssembleContext): PromptAssembly;
|
|
284
303
|
/**
|
|
285
304
|
* Assemble global and scoped providers, detach tool parameters, apply
|
|
286
305
|
* canonical ordering, then run the assembly waterfall. Scoped sections and
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qilin-agent/system-prompt",
|
|
3
3
|
"description": "System prompt assembly registry for the QiLin",
|
|
4
|
-
"version": "3.1.
|
|
4
|
+
"version": "3.1.4",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -30,16 +30,16 @@
|
|
|
30
30
|
],
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@qilin-agent/scope": "3.1.
|
|
34
|
-
"@qilin-agent/
|
|
35
|
-
"@qilin-agent/
|
|
33
|
+
"@qilin-agent/scope": "3.1.4",
|
|
34
|
+
"@qilin-agent/kylin": "~4.0.3",
|
|
35
|
+
"@qilin-agent/llm": "3.1.4"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@qilin-agent/schemastery": "~3.18.3"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@qilin-agent/llm": "3.1.
|
|
42
|
-
"@qilin-agent/scope": "3.1.
|
|
41
|
+
"@qilin-agent/llm": "3.1.4",
|
|
42
|
+
"@qilin-agent/scope": "3.1.4",
|
|
43
43
|
"@qilin-agent/kylin": "~4.0.3"
|
|
44
44
|
}
|
|
45
45
|
}
|