@deepseek-ai/dsh-persona 0.0.1-rc.1

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/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, DeepSeek
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,6 @@
1
+ # Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
2
+ # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
+ # after editing either side, bring the other along and re-record with:
4
+ # pnpm run verify-translation-pairing --write packages/preset/persona/README.md
5
+ README.md: 742141e65fa8d50b89e6b74e6d21aa8c5bfe98cd
6
+ README.zh.md: add106adb5b81e45d8c6929a9a0f98b5c0072a01
package/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # dsh-persona
2
+
3
+ English | [中文](README.zh.md)
4
+
5
+ The agent persona as a composable row. It can either shadow the deployment persona or own the complete system prompt.
6
+
7
+ [`dsh-system-prompt`](../../core/system-prompt/README.md) owns the deployment persona as its own config and registers that section unconditionally, so a process has exactly one. An [agent preset](../agent-presets/README.md) cannot mount the prompt registry itself — without a row of its own, a preset could change an agent's tools but never its identity. This package is that row.
8
+
9
+ ## Scope-only
10
+
11
+ Mounting this row outside an agent scope collides with the registry's own `deployment:persona` registration and fails loud. That is not a limitation to work around: the deployment persona already has an owner, and the whole point of this row is to shadow it for one agent. Mount it inside a preset composition, where the preset mount supplies the agent scope.
12
+
13
+ ## Config
14
+
15
+ | Field | Default | Meaning |
16
+ |---|---|---|
17
+ | `text` | required | Persona prose rendered as the `deployment:persona` section |
18
+ | `complete` | `false` | Restore this persona after assembly as the only system-prompt section |
19
+
20
+ `text` is a template, like any prompt section: complete `{{…}}` groups resolve strictly against registered prompt variables when the prompt renders, not when it assembles. Empty text still occupies the slot, so it shadows the deployment persona away entirely and then disappears at render. With `complete: true`, assembly still resolves contexts, tools, variables, and cooperative listeners, then the prompt registry restores this exact persona as the sole section; no identity, tool guidance, or listener can append prompt text.
21
+
22
+ ## Model Experience
23
+
24
+ ### The persona section
25
+
26
+ #### What the model sees
27
+
28
+ The `deployment:persona` section at order 0, immediately after the harness identity opener, carrying exactly this row's configured `text` with prompt variables resolved. For an agent whose preset mounts this row, it replaces whatever persona the deployment configured. In complete mode, the model sees only this rendered section as its system prompt.
29
+
30
+ #### Token effect
31
+
32
+ Fixed for a given preset: the persona's own 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.
33
+
34
+ #### KV Cache effect
35
+
36
+ Prefix-stable for the life of an agent — the row mounts once, before the agent is published and therefore before its first request, and its text never changes while the agent runs. Two agents on different presets establish different prefixes from this section onward; neither can invalidate the other's reuse.
37
+
38
+ ## Known Limitations and Deferred Work
39
+
40
+ - **No global mount** — the prompt registry owns the unscoped persona slot, so this row is usable only from a scoped composition. A deployment-wide persona change belongs in the `system-prompt` row's own config.
package/README.zh.md ADDED
@@ -0,0 +1,40 @@
1
+ # dsh-persona
2
+
3
+ [English](README.md) | 中文
4
+
5
+ 把 agent(智能体)人设做成一个可组装的行:它既可以遮蔽部署级人设,也可以拥有完整系统提示词。
6
+
7
+ [`dsh-system-prompt`](../../core/system-prompt/README.md) 以自身配置持有部署级人设,并且无条件注册该段落,因此一个进程只有一份。[agent preset](../agent-presets/README.md) 无法自行挂载提示词注册表——若没有属于自己的行,preset 能改变 agent 的工具,却永远改不了它的身份。本包就是那一行。
8
+
9
+ ## 仅限 scope 内使用
10
+
11
+ 在 agent scope 之外挂载本行,会与注册表自身的 `deployment:persona` 注册相撞并明确报错。这不是需要绕开的限制:部署级人设已经有归属,而本行存在的意义正是为某一个 agent 遮蔽它。请把它挂在 preset 组装内部,由 preset 的挂载过程提供 agent scope。
12
+
13
+ ## 配置
14
+
15
+ | 字段 | 默认值 | 含义 |
16
+ |---|---|---|
17
+ | `text` | 必填 | 作为 `deployment:persona` 段落渲染的人设文本 |
18
+ | `complete` | `false` | 组装后将此人设恢复为唯一的系统提示词段落 |
19
+
20
+ `text` 与任何提示词段落一样是模板:完整的 `{{…}}` 组在提示词**渲染**时(而非组装时)严格解析为已注册的提示词变量。空文本同样占据该槽位,因此会把部署级人设整个遮蔽掉,然后在渲染时消失。启用 `complete: true` 时,组装仍会解析上下文、工具、变量和协作式监听器,之后提示词注册表将这份确切人设恢复为唯一段落;身份、工具引导或监听器都无法追加提示词文本。
21
+
22
+ ## Model Experience
23
+
24
+ ### 人设段落
25
+
26
+ #### What the model sees
27
+
28
+ 位于 order 0 的 `deployment:persona` 段落,紧随 harness 身份开场白之后,携带本行配置的 `text`,其中的提示词变量已解析。对于其 preset 挂载了本行的 agent,它会替换部署所配置的任何人设。在完整模式下,模型只会看到这个渲染后的段落作为系统提示词。
29
+
30
+ #### Token effect
31
+
32
+ 对给定 preset 而言是固定的:该 agent 的每次请求都携带人设自身的 token,其他 agent 一个都不带。空文本不贡献任何 token。完整模式会移除该 agent 的其他所有系统提示词 token。
33
+
34
+ #### KV Cache effect
35
+
36
+ 在一个 agent 的整个生命周期内保持前缀稳定——本行只挂载一次,发生在 agent 发布之前、因而也在它的首个请求之前,且在 agent 运行期间文本不再改变。两个使用不同 preset 的 agent 从该段落起建立各自不同的前缀,谁都无法让对方失去缓存复用。
37
+
38
+ ## Known Limitations and Deferred Work
39
+
40
+ - **不支持全局挂载** —— 提示词注册表拥有未加 scope 的人设槽位,因此本行只能从带 scope 的组装中使用。要改变部署级人设,应在 `system-prompt` 行自身的配置中修改。
package/lib/index.js ADDED
@@ -0,0 +1,42 @@
1
+ import z from "@deepseek-ai/schemastery";
2
+ import { PERSONA_ORDER, PERSONA_SECTION } from "@deepseek-ai/dsh-system-prompt";
3
+ //#region lib/types/index.js
4
+ /**
5
+ * A per-agent persona as a composable row.
6
+ *
7
+ * `dsh-system-prompt` owns the global persona as its own config, and registers
8
+ * that section unconditionally — so this row is **scope-only**. Mounted inside
9
+ * an agent preset it shadows the deployment persona for that one session,
10
+ * exactly like the per-child persona `dsh-subagent` installs; mounted globally
11
+ * it collides with the registry's own registration and fails loud.
12
+ *
13
+ * That constraint is the reason the row exists. An agent preset cannot mount
14
+ * the prompt registry itself, so without a row of its own a preset could
15
+ * change an agent's tools but never its identity.
16
+ * @module @deepseek-ai/dsh-persona
17
+ */
18
+ /** Cordis plugin name. */
19
+ const name = "persona";
20
+ /** The prompt registry this row contributes to. */
21
+ const inject = ["systemPrompt"];
22
+ /** Runtime schema for the persona row. */
23
+ const Config = z.object({
24
+ text: z.string().required(),
25
+ complete: z.boolean().default(false)
26
+ });
27
+ /**
28
+ * Register the persona section for the mounting context's scope.
29
+ * @param ctx - an agent scope context; an unscoped context collides with the
30
+ * prompt registry's own persona registration and rejects.
31
+ * @param config - the persona text and complete-prompt policy.
32
+ */
33
+ function apply(ctx, config) {
34
+ ctx.effect(() => ctx.systemPrompt.section({
35
+ name: PERSONA_SECTION,
36
+ order: PERSONA_ORDER,
37
+ text: config.text,
38
+ ...config.complete ? { complete: true } : {}
39
+ }), "persona.section()");
40
+ }
41
+ //#endregion
42
+ export { Config, PERSONA_ORDER, PERSONA_SECTION, apply, inject, name };
@@ -0,0 +1,24 @@
1
+ //#region lib/types/invariant.js
2
+ /**
3
+ * Package-owned invariant companion for `@deepseek-ai/dsh-persona`.
4
+ * @module @deepseek-ai/dsh-persona/invariant
5
+ */
6
+ const PACKAGE_NAME = "@deepseek-ai/dsh-persona";
7
+ /** Cordis companion plugin name. */
8
+ const name = "persona-invariant";
9
+ /** Service required before the companion can reserve package ownership. */
10
+ const inject = ["invariants"];
11
+ /**
12
+ * No runtime invariant: this row owns no event stream or mutable runtime data — it registers one
13
+ * prompt section and the prompt registry owns identity, complete-prompt enforcement, shadowing,
14
+ * and disposal.
15
+ */
16
+ const install = () => {};
17
+ /**
18
+ * Register this package's invariant companion.
19
+ * @param ctx - Cordis context carrying the invariant service.
20
+ * @returns the installed registration's disposer after setup succeeds.
21
+ */
22
+ const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
23
+ //#endregion
24
+ export { apply, inject, name };
@@ -0,0 +1,43 @@
1
+ /**
2
+ * A per-agent persona as a composable row.
3
+ *
4
+ * `dsh-system-prompt` owns the global persona as its own config, and registers
5
+ * that section unconditionally — so this row is **scope-only**. Mounted inside
6
+ * an agent preset it shadows the deployment persona for that one session,
7
+ * exactly like the per-child persona `dsh-subagent` installs; mounted globally
8
+ * it collides with the registry's own registration and fails loud.
9
+ *
10
+ * That constraint is the reason the row exists. An agent preset cannot mount
11
+ * the prompt registry itself, so without a row of its own a preset could
12
+ * change an agent's tools but never its identity.
13
+ * @module @deepseek-ai/dsh-persona
14
+ */
15
+ import type { Context } from '@deepseek-ai/cordis';
16
+ import z from '@deepseek-ai/schemastery';
17
+ import { PERSONA_ORDER, PERSONA_SECTION } from '@deepseek-ai/dsh-system-prompt';
18
+ export { PERSONA_ORDER, PERSONA_SECTION };
19
+ /** Cordis plugin name. */
20
+ export declare const name = "persona";
21
+ /** The prompt registry this row contributes to. */
22
+ export declare const inject: string[];
23
+ /** Plugin config: the persona text this composition contributes. */
24
+ export interface Config {
25
+ /**
26
+ * Persona prose rendered as the `deployment:persona` section. A template:
27
+ * complete `{{…}}` groups interpolate strictly against registered prompt
28
+ * variables. Empty text drops the section at render, matching the registry.
29
+ */
30
+ text: string;
31
+ /** Make this persona the complete system prompt, suppressing every other section. */
32
+ complete?: boolean;
33
+ }
34
+ /** Runtime schema for the persona row. */
35
+ export declare const Config: z<Config>;
36
+ /**
37
+ * Register the persona section for the mounting context's scope.
38
+ * @param ctx - an agent scope context; an unscoped context collides with the
39
+ * prompt registry's own persona registration and rejects.
40
+ * @param config - the persona text and complete-prompt policy.
41
+ */
42
+ export declare function apply(ctx: Context, config: Config): void;
43
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Package-owned invariant companion for `@deepseek-ai/dsh-persona`.
3
+ * @module @deepseek-ai/dsh-persona/invariant
4
+ */
5
+ import type { Context } from '@deepseek-ai/cordis';
6
+ /** Cordis companion plugin name. */
7
+ export declare const name = "persona-invariant";
8
+ /** Service required before the companion can reserve package ownership. */
9
+ export declare const inject: string[];
10
+ /**
11
+ * Register this package's invariant companion.
12
+ * @param ctx - Cordis context carrying the invariant service.
13
+ * @returns the installed registration's disposer after setup succeeds.
14
+ */
15
+ export declare const apply: (ctx: Context) => Promise<() => void>;
16
+ //# sourceMappingURL=invariant.d.ts.map
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@deepseek-ai/dsh-persona",
3
+ "description": "Composition-authored deployment persona section for the DeepSeek Harness",
4
+ "version": "0.0.1-rc.1",
5
+ "publishConfig": {
6
+ "access": "restricted"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
11
+ "directory": "packages/preset/persona"
12
+ },
13
+ "type": "module",
14
+ "main": "lib/index.js",
15
+ "types": "lib/types/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./lib/types/index.d.ts",
19
+ "default": "./lib/index.js"
20
+ },
21
+ "./invariant": {
22
+ "types": "./lib/types/invariant.d.ts",
23
+ "default": "./lib/invariant.js"
24
+ },
25
+ "./src/*": "./src/*",
26
+ "./package.json": "./package.json"
27
+ },
28
+ "files": [
29
+ "lib/index.js",
30
+ "lib/invariant.js",
31
+ "lib/types/**/*.d.ts"
32
+ ],
33
+ "license": "BSD-3-Clause",
34
+ "peerDependencies": {
35
+ "@deepseek-ai/dsh-invariants": "^0.0.1-rc.1",
36
+ "@deepseek-ai/cordis": "^4.0.1-rc.1",
37
+ "@deepseek-ai/dsh-system-prompt": "^0.0.1-rc.1"
38
+ },
39
+ "dependencies": {
40
+ "@deepseek-ai/schemastery": "^3.18.1-rc.1"
41
+ },
42
+ "devDependencies": {
43
+ "@deepseek-ai/dsh-invariants": "^0.0.1-rc.1",
44
+ "@deepseek-ai/dsh-scope": "^0.0.1-rc.1",
45
+ "@deepseek-ai/cordis": "^4.0.1-rc.1",
46
+ "@deepseek-ai/dsh-system-prompt": "^0.0.1-rc.1"
47
+ }
48
+ }