@deepseek-ai/dsh-persona 0.1.2-rc.1 → 0.1.3-alpha.2
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 +2 -2
- package/README.md +13 -12
- package/README.zh.md +12 -11
- package/lib/index.js +14 -8
- package/lib/types/index.d.ts +12 -7
- package/package.json +5 -5
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/preset/persona/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 11f9fdc1d3968fdb9ba0792936a050aca04d4e8b
|
|
6
|
+
README.zh.md: bbf702dc752f84b120a9540fed7e793f5bb692ce
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
|
|
|
9
9
|
|
|
10
10
|
## Summary
|
|
11
11
|
|
|
12
|
-
`dsh-persona` gives one agent its own persona: a preset mounts this composable row to register
|
|
12
|
+
`dsh-persona` gives one agent its own persona: a preset mounts this composable row to register persona prefix and suffix sections, shadowing the deployment-wide defaults for that session. It can also make the prefix the session's complete system prompt, suppressing every other section, and can turn off dynamic runtime-context snapshots for the session. Mount it inside a preset composition — mounting it globally collides with the prompt registry's own persona registration and fails loud. Without this row, a preset could change an agent's tools but never its identity.
|
|
13
13
|
|
|
14
14
|
## Table of Contents
|
|
15
15
|
|
|
@@ -25,27 +25,28 @@ English | [中文](README.zh.md)
|
|
|
25
25
|
<a id="use-this-package"></a>
|
|
26
26
|
## Use this package
|
|
27
27
|
|
|
28
|
-
Mount this row inside a preset composition to give that preset's sessions their own persona. The row needs an agent scope: mounted outside one it collides with the prompt registry's own `deployment:persona` registration and fails loud — the deployment persona already has an owner, and the whole point of this row is to shadow it for one agent.
|
|
28
|
+
Mount this row inside a preset composition to give that preset's sessions their own persona. The row needs an agent scope: mounted outside one it collides with the prompt registry's own `deployment:persona-prefix` registration and fails loud — the deployment persona already has an owner, and the whole point of this row is to shadow it for one agent.
|
|
29
29
|
|
|
30
30
|
### Configuration
|
|
31
31
|
|
|
32
32
|
```yaml
|
|
33
33
|
- name: '@deepseek-ai/dsh-persona'
|
|
34
34
|
config:
|
|
35
|
-
|
|
35
|
+
prefix: You are a terse systems engineer who answers in short commands.
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
| Field | Default | Meaning |
|
|
39
39
|
|---|---|---|
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
40
|
+
| `prefix` | required | Persona prose rendered as the `deployment:persona-prefix` section |
|
|
41
|
+
| `suffix` | `''` | Template for `deployment:persona-suffix`; omitted or empty text shadows the global suffix away |
|
|
42
|
+
| `complete` | `false` | Use only the rendered prefix as the system prompt; ignore the suffix |
|
|
42
43
|
| `includeRuntimeContext` | `true` | Include dynamic runtime-context snapshots for this agent scope; false suppresses every context contribution without disabling its owning services |
|
|
43
44
|
|
|
44
45
|
The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-persona) is the exhaustive source for every accepted field and its JSDoc.
|
|
45
46
|
|
|
46
47
|
### Persona behavior
|
|
47
48
|
|
|
48
|
-
The persona `
|
|
49
|
+
The persona `prefix` and `suffix` are templates: complete `{{…}}` groups resolve strictly against registered prompt variables when the prompt renders, not when it assembles. Each empty template still shadows its deployment-wide section, then disappears at render. Omitted `suffix` defaults to empty; it does not inherit the global suffix. With `complete: true`, assembly still resolves contexts, tools, variables, and cooperative listeners, but the prompt registry restores this exact prefix as the sole section; no identity, suffix, tool guidance, or listener can append prompt text. With `includeRuntimeContext: false`, context providers are not evaluated for this scope and contexts added by assembly listeners are discarded.
|
|
49
50
|
|
|
50
51
|
### When to use it
|
|
51
52
|
|
|
@@ -61,18 +62,18 @@ Use this row when a preset must change an agent's identity and not only its tool
|
|
|
61
62
|
|
|
62
63
|
### How the row registers
|
|
63
64
|
|
|
64
|
-
|
|
65
|
+
The row registers scoped persona prefix and suffix sections using the registry's shared names and named orders. Each shadows its deployment default instead of appearing beside it; the registry owns ordering, interpolation, and complete-prompt enforcement. `includeRuntimeContext: false` calls `ctx.systemPrompt.suppressRuntimeContext()`.
|
|
65
66
|
|
|
66
67
|
### Why the row is scope-only
|
|
67
68
|
|
|
68
|
-
`dsh-system-prompt` owns the global persona as its own config and registers `deployment:persona` unconditionally, so a process has exactly one. This row collides with that registration outside an agent scope, by design: the row exists because a preset cannot mount the prompt registry itself.
|
|
69
|
+
`dsh-system-prompt` owns the global persona as its own config and registers `deployment:persona-prefix` unconditionally, so a process has exactly one. This row collides with that registration outside an agent scope, by design: the row exists because a preset cannot mount the prompt registry itself.
|
|
69
70
|
|
|
70
71
|
### Source map
|
|
71
72
|
|
|
72
73
|
| File | Role |
|
|
73
74
|
|---|---|
|
|
74
75
|
| [`src/index.ts`](src/index.ts) | Plugin entry: `Config` schema, persona section registration, runtime-context suppression |
|
|
75
|
-
| — | No runtime invariant companion is published; this row owns no event stream or mutable runtime data — it registers
|
|
76
|
+
| — | No runtime invariant companion is published; this row owns no event stream or mutable runtime data — it registers prompt sections and the prompt registry owns identity, complete-prompt enforcement, shadowing, and disposal. |
|
|
76
77
|
|
|
77
78
|
</details>
|
|
78
79
|
|
|
@@ -96,15 +97,15 @@ Read these pages when the package-level contract is not enough; they move from t
|
|
|
96
97
|
|
|
97
98
|
#### What the model sees
|
|
98
99
|
|
|
99
|
-
The `deployment:persona` section at order 0
|
|
100
|
+
The `deployment:persona-prefix` section at order `0` carries this row's `prefix`; `deployment:persona-suffix` at order `10200` carries its `suffix`, after first-party guidance. Both replace their deployment defaults and resolve prompt variables. In complete mode, the model sees only the rendered prefix section as its system prompt. Runtime context remains enabled by default; when disabled, a fresh agent receives no runtime-context snapshot from sandbox policy, approval policy, delegation, or another system-prompt context provider.
|
|
100
101
|
|
|
101
102
|
#### Token effect
|
|
102
103
|
|
|
103
|
-
Fixed for a given preset: the persona
|
|
104
|
+
Fixed for a given preset: the persona prefix and suffix tokens on every request that agent makes, and none for any other agent. Empty text contributes nothing. Complete mode removes every other system-prompt token for that agent.
|
|
104
105
|
|
|
105
106
|
#### KV Cache effect
|
|
106
107
|
|
|
107
|
-
Prefix-stable
|
|
108
|
+
Prefix-stable while the rendered template variables and text are unchanged. Suffix changes leave preceding instructions unchanged when the model, prefix, and tools match. Prefix changes affect the early prefix; provider cache sharing is not guaranteed.
|
|
108
109
|
|
|
109
110
|
## Known Limitations and Deferred Work
|
|
110
111
|
|
package/README.zh.md
CHANGED
|
@@ -9,7 +9,7 @@ kind: "package-reference"
|
|
|
9
9
|
|
|
10
10
|
## 概述
|
|
11
11
|
|
|
12
|
-
`dsh-persona` 让单个 agent(智能体)拥有自己的人设:preset
|
|
12
|
+
`dsh-persona` 让单个 agent(智能体)拥有自己的人设:preset 挂载这一可组装的行来注册人设前缀与后缀段落,为该会话遮蔽部署级默认值。它还可以把前缀变成该会话的完整系统提示词、抑制所有其他段落,并可为该会话关闭动态 runtime-context 快照。请把它挂在 preset 组装内部——全局挂载会与提示词注册表自身的人设注册相撞并明确报错。没有这一行,preset 能改变 agent 的工具,却永远改不了它的身份。
|
|
13
13
|
|
|
14
14
|
## 目录
|
|
15
15
|
|
|
@@ -25,27 +25,28 @@ kind: "package-reference"
|
|
|
25
25
|
<a id="use-this-package"></a>
|
|
26
26
|
## 使用本包
|
|
27
27
|
|
|
28
|
-
在 preset 组装内部挂载本行,让该 preset 的会话拥有自己的人设。本行需要 agent scope:在 scope 之外挂载会与提示词注册表自身的 `deployment:persona` 注册相撞并明确报错——部署级人设已经有归属,而本行存在的意义正是为某一个 agent 遮蔽它。
|
|
28
|
+
在 preset 组装内部挂载本行,让该 preset 的会话拥有自己的人设。本行需要 agent scope:在 scope 之外挂载会与提示词注册表自身的 `deployment:persona-prefix` 注册相撞并明确报错——部署级人设已经有归属,而本行存在的意义正是为某一个 agent 遮蔽它。
|
|
29
29
|
|
|
30
30
|
### 配置
|
|
31
31
|
|
|
32
32
|
```yaml
|
|
33
33
|
- name: '@deepseek-ai/dsh-persona'
|
|
34
34
|
config:
|
|
35
|
-
|
|
35
|
+
prefix: You are a terse systems engineer who answers in short commands.
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
| 字段 | 默认值 | 含义 |
|
|
39
39
|
|---|---|---|
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
40
|
+
| `prefix` | 必填 | 作为 `deployment:persona-prefix` 段落渲染的人设文本 |
|
|
41
|
+
| `suffix` | `''` | `deployment:persona-suffix` 模板;省略或空文本会遮蔽掉全局后缀 |
|
|
42
|
+
| `complete` | `false` | 仅将渲染后的前缀用作系统提示词;忽略后缀 |
|
|
42
43
|
| `includeRuntimeContext` | `true` | 是否为此 agent 作用域包含动态 runtime-context 快照;false 会抑制所有上下文贡献,但不禁用拥有它们的服务 |
|
|
43
44
|
|
|
44
45
|
生成的[配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-persona)是每个受支持字段及其 JSDoc 的穷尽式真源。
|
|
45
46
|
|
|
46
47
|
### 人设行为
|
|
47
48
|
|
|
48
|
-
人设 `
|
|
49
|
+
人设 `prefix` 与 `suffix` 都是模板:完整的 `{{…}}` 组在提示词**渲染**时(而非组装时)严格解析为已注册的提示词变量。每个空模板仍会遮蔽对应的部署级段落,然后在渲染时消失。省略 `suffix` 时默认为空,不继承全局后缀。启用 `complete: true` 时,组装仍会解析上下文、工具、变量与协作式监听器,但提示词注册表会把这确切前缀恢复为唯一段落;身份、后缀、工具引导或监听器都无法追加提示词文本。启用 `includeRuntimeContext: false` 时,此作用域的上下文提供方不会被求值,组装监听器添加的上下文也会被丢弃。
|
|
49
50
|
|
|
50
51
|
### 何时使用
|
|
51
52
|
|
|
@@ -61,11 +62,11 @@ kind: "package-reference"
|
|
|
61
62
|
|
|
62
63
|
### 本行如何注册
|
|
63
64
|
|
|
64
|
-
|
|
65
|
+
本行使用注册表共享的名称与具名顺序来注册带作用域的人设前缀与后缀段落。两者分别遮蔽对应的部署默认值,而不是出现在其旁边;排序、插值与完整提示词执行归注册表所有。`includeRuntimeContext: false` 会调用 `ctx.systemPrompt.suppressRuntimeContext()`。
|
|
65
66
|
|
|
66
67
|
### 本行为何仅限 scope 内使用
|
|
67
68
|
|
|
68
|
-
`dsh-system-prompt` 以自身配置持有全局人设并无条件注册 `deployment:persona`,因此一个进程只有一份。本行在 agent scope 之外与该项注册相撞,这是刻意的:本行的存在是因为 preset 无法自行挂载提示词注册表。
|
|
69
|
+
`dsh-system-prompt` 以自身配置持有全局人设并无条件注册 `deployment:persona-prefix`,因此一个进程只有一份。本行在 agent scope 之外与该项注册相撞,这是刻意的:本行的存在是因为 preset 无法自行挂载提示词注册表。
|
|
69
70
|
|
|
70
71
|
### 源码地图
|
|
71
72
|
|
|
@@ -96,15 +97,15 @@ kind: "package-reference"
|
|
|
96
97
|
|
|
97
98
|
#### 模型看到什么
|
|
98
99
|
|
|
99
|
-
位于 order 0 的 `deployment:persona`
|
|
100
|
+
位于 order `0` 的 `deployment:persona-prefix` 段落携带本行的 `prefix`;位于 order `10200` 的 `deployment:persona-suffix` 在第一方指导之后携带其 `suffix`。两者分别替换对应的部署默认值,并解析提示词变量。在完整模式下,模型只会看到渲染后的前缀段落作为系统提示词。Runtime context 默认保持启用;禁用后,新建 agent 不会收到来自沙箱策略、批准策略、委派或其他 system-prompt 上下文提供方的 runtime-context 快照。
|
|
100
101
|
|
|
101
102
|
#### Token 影响
|
|
102
103
|
|
|
103
|
-
对给定 preset 而言是固定的:该 agent
|
|
104
|
+
对给定 preset 而言是固定的:该 agent 的每次请求都携带人设前缀与后缀的 token,其他 agent 一个都不带。空文本不贡献任何 token。完整模式会移除该 agent 的其他所有系统提示词 token。
|
|
104
105
|
|
|
105
106
|
#### KV Cache 影响
|
|
106
107
|
|
|
107
|
-
|
|
108
|
+
渲染后的模板变量与文本不变时,前缀保持稳定。模型、前缀与工具一致时,后缀变化不改变前置指令。前缀变化会影响靠前的前缀;不保证提供方共享缓存。
|
|
108
109
|
|
|
109
110
|
## 已知限制与延期工作
|
|
110
111
|
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
|
-
import {
|
|
2
|
+
import { PERSONA_PREFIX_SECTION, PERSONA_SUFFIX_SECTION } from "@deepseek-ai/dsh-system-prompt";
|
|
3
3
|
//#region lib/types/index.js
|
|
4
4
|
/**
|
|
5
5
|
* A per-agent persona as a composable row.
|
|
@@ -21,24 +21,30 @@ const name = "persona";
|
|
|
21
21
|
const inject = ["systemPrompt"];
|
|
22
22
|
/** Runtime schema for the persona row. */
|
|
23
23
|
const Config = z.object({
|
|
24
|
-
|
|
24
|
+
prefix: z.string().required(),
|
|
25
|
+
suffix: z.string().default(""),
|
|
25
26
|
complete: z.boolean().default(false),
|
|
26
27
|
includeRuntimeContext: z.boolean().default(true)
|
|
27
28
|
});
|
|
28
29
|
/**
|
|
29
|
-
* Register the persona
|
|
30
|
+
* Register the persona prefix and suffix sections for the mounting context's scope.
|
|
30
31
|
* @param ctx - an agent scope context; an unscoped context collides with the
|
|
31
32
|
* prompt registry's own persona registration and rejects.
|
|
32
|
-
* @param config - the
|
|
33
|
+
* @param config - the prefix, suffix, and complete-prompt policy.
|
|
33
34
|
*/
|
|
34
35
|
function apply(ctx, config) {
|
|
35
36
|
ctx.effect(() => ctx.systemPrompt.section({
|
|
36
|
-
name:
|
|
37
|
-
order: ctx.systemPrompt.getSectionOrder("
|
|
38
|
-
text: config.
|
|
37
|
+
name: PERSONA_PREFIX_SECTION,
|
|
38
|
+
order: ctx.systemPrompt.getSectionOrder("DEPLOYMENT_PERSONA_PREFIX"),
|
|
39
|
+
text: config.prefix,
|
|
39
40
|
...config.complete ? { complete: true } : {}
|
|
40
41
|
}), "persona.section()");
|
|
42
|
+
ctx.effect(() => ctx.systemPrompt.section({
|
|
43
|
+
name: PERSONA_SUFFIX_SECTION,
|
|
44
|
+
order: ctx.systemPrompt.getSectionOrder("DEPLOYMENT_PERSONA_SUFFIX"),
|
|
45
|
+
text: config.suffix ?? ""
|
|
46
|
+
}), "persona.suffix()");
|
|
41
47
|
if (!(config.includeRuntimeContext ?? true)) ctx.systemPrompt.suppressRuntimeContext();
|
|
42
48
|
}
|
|
43
49
|
//#endregion
|
|
44
|
-
export { Config,
|
|
50
|
+
export { Config, PERSONA_PREFIX_SECTION, PERSONA_SUFFIX_SECTION, apply, inject, name };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import type { Context } from '@deepseek-ai/cordis';
|
|
16
16
|
import z from '@deepseek-ai/schemastery';
|
|
17
|
-
import {
|
|
18
|
-
export {
|
|
17
|
+
import { PERSONA_PREFIX_SECTION, PERSONA_SUFFIX_SECTION } from '@deepseek-ai/dsh-system-prompt';
|
|
18
|
+
export { PERSONA_PREFIX_SECTION, PERSONA_SUFFIX_SECTION };
|
|
19
19
|
/** Cordis plugin name. */
|
|
20
20
|
export declare const name = "persona";
|
|
21
21
|
/** The prompt registry this row contributes to. */
|
|
@@ -23,12 +23,17 @@ export declare const inject: string[];
|
|
|
23
23
|
/** Plugin config: the persona text this composition contributes. */
|
|
24
24
|
export interface Config {
|
|
25
25
|
/**
|
|
26
|
-
* Persona prose rendered as the `deployment:persona` section. A template:
|
|
26
|
+
* Persona prose rendered as the `deployment:persona-prefix` section. A template:
|
|
27
27
|
* complete `{{…}}` groups interpolate strictly against registered prompt
|
|
28
28
|
* variables. Empty text drops the section at render, matching the registry.
|
|
29
29
|
*/
|
|
30
|
-
|
|
31
|
-
/**
|
|
30
|
+
prefix: string;
|
|
31
|
+
/**
|
|
32
|
+
* Persona suffix template rendered after first-party guidance. Omitted or empty
|
|
33
|
+
* text shadows the deployment suffix away; interpolation is strict.
|
|
34
|
+
*/
|
|
35
|
+
suffix?: string;
|
|
36
|
+
/** Make the prefix the complete system prompt, suppressing the suffix and every other section. */
|
|
32
37
|
complete?: boolean;
|
|
33
38
|
/** Suppress dynamic runtime-context snapshots for this persona's agent scope. */
|
|
34
39
|
includeRuntimeContext?: boolean;
|
|
@@ -36,10 +41,10 @@ export interface Config {
|
|
|
36
41
|
/** Runtime schema for the persona row. */
|
|
37
42
|
export declare const Config: z<Config>;
|
|
38
43
|
/**
|
|
39
|
-
* Register the persona
|
|
44
|
+
* Register the persona prefix and suffix sections for the mounting context's scope.
|
|
40
45
|
* @param ctx - an agent scope context; an unscoped context collides with the
|
|
41
46
|
* prompt registry's own persona registration and rejects.
|
|
42
|
-
* @param config - the
|
|
47
|
+
* @param config - the prefix, suffix, and complete-prompt policy.
|
|
43
48
|
*/
|
|
44
49
|
export declare function apply(ctx: Context, config: Config): void;
|
|
45
50
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-persona",
|
|
3
3
|
"description": "Composition-authored deployment persona section for the DeepSeek Harness",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.3-alpha.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
],
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@deepseek-ai/
|
|
31
|
-
"@deepseek-ai/
|
|
30
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
31
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.3-alpha.2"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@deepseek-ai/schemastery": "^3.18.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@deepseek-ai/dsh-
|
|
37
|
+
"@deepseek-ai/dsh-scope": "^0.1.3-alpha.2",
|
|
38
38
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
39
|
-
"@deepseek-ai/dsh-
|
|
39
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.3-alpha.2"
|
|
40
40
|
}
|
|
41
41
|
}
|