@istarry/dsh-assistant-profile 0.0.0-stage → 0.2.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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 iStarryDust
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,102 @@
1
- # Temporary Holding Version
1
+ # 助理档案 · dsh-assistant-profile
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 给 DeepSeek Harness 一份**全局人格**:名称、语言、人格提示词四段,装一次,之后每个新会话的系统提示最前面都从它开始。侧栏「新会话」上方会显示这份档案的助理名。
4
+
5
+ 一个档案,四个模式通用(标准 / PTC / 极简 / 创造)。不需要复制预设,也不需要改模式选择器。
6
+
7
+ ## 它做了什么
8
+
9
+ 宿主半端只做一件事:每个对话 agent 创建时(以及空白会话换模式重新绑定预设时),在这个 agent **自己的作用域**里注册一段 `deployment:persona-prefix`。作用域链上最近的同名段胜出,于是预设自带的身份句被档案替换,而工具、流程、模式语义一律不动。
10
+
11
+ 这正是官方给子代理发独立人格用的那条路径(`dsh-subagent` 的 `applyChildComposition`),所以它对四种预设都成立。
12
+
13
+ 注入文本长这样(空行分隔,缺哪段就少哪段):
14
+
15
+ ```
16
+ Your name is 大肥鱼.
17
+
18
+ Reply in 简体中文 throughout.
19
+
20
+ <你写的人格提示词…>
21
+ ```
22
+
23
+ - **极简模式**的预设把人格当作「整段系统提示只有这一句」(`complete: true`)。遮蔽段会镜像这个标记——极简模式下系统提示就**只有**你的档案,仍然没有工具说明,符合那个模式原本的设计。
24
+ - 四段全空时回落到预设原文,等于原生行为。
25
+ - **子智能体不注入**:委派出去的孩子保留它自己的人格。
26
+
27
+ ## 改人格不会重算历史
28
+
29
+ DeepSeek 的上下文缓存是前缀缓存:系统提示在最前面,直接改写开头那条会让后面全部失效。
30
+
31
+ 档案的文本是**每次组装提示词时求值**的,所以保存后下一个请求的提示词就变了,而**历史一个字节都不动**。剩下的交给宿主判定:模型路由声明了 `systemPromptUpdate: 'in-history'`(DSH 默认的 `deepseek-flash` 条目就声明了)时,变化的系统提示会被**追加在已缓存的历史之后**,历史那段前缀仍然命中,只有新增的这一小段按普通输入计费。
32
+
33
+ 会话日志里的 `request/context` 会写明当前路由的模式:
34
+
35
+ ```json
36
+ {"provider":"deepseek-official","model":"deepseek-flash","systemPromptUpdate":"in-history"}
37
+ ```
38
+
39
+ 路由不支持这个模式时(例如默认的 `deepseek-v4-pro` 条目),改人格会让下一次请求从开头失效一次——那是路由能力问题,不是插件的选择。介意的话,把改动留到新会话。
40
+
41
+ ## 界面
42
+
43
+ - 侧栏「插件」下面多一行**助理档案**(行序 5,夹在插件与自动化任务之间)。
44
+ - 点开是主区的一个页面:名称、语言、人格提示词,右下角实时字数(超过 2000 字转成提醒色)。
45
+ - 「保存」行左侧是人格预设:**默认一 / 默认二 / 默认三**(点击只把三段文本填进表单,落盘仍按「保存」)加「另存」出来的自定义(名字取自「名称」,胶囊右侧带小删除钮);装好默认用**默认三**,放不下横向滚动。
46
+ - 「新会话」按钮上方一行小字 + 首字方块显示助理名;侧栏收成 56px 图标栏时自动隐藏;改完名称保存后立刻变。
47
+ - 名称默认 `大肥鱼`、语言默认 `中文`。
48
+
49
+ ## 数据存在哪
50
+
51
+ 四个字段就是本插件在 profile 里的配置,由官方设置通道读写,落进 profile 的 `cordis.patch.yml`:
52
+
53
+ ```yaml
54
+ - id: assistant-profile
55
+ name: '@istarry/dsh-assistant-profile'
56
+ config:
57
+ name: 小星
58
+ language: 简体中文
59
+ persona: 你是一个只讲证据的助理。不确定就说不确定。
60
+ ```
61
+
62
+ 所以它跟着 profile 走:换 profile 就是另一份档案;备份 profile 就备份了人格。
63
+
64
+ ## 安装
65
+
66
+ ```bash
67
+ dsh plugin --profile <profile> add @istarry/dsh-assistant-profile
68
+ # 本地包:
69
+ dsh plugin --profile <profile> add E:/Plugin/发布版/dsh-assistant-profile/dist/istarry-dsh-assistant-profile-0.2.1.tgz
70
+ ```
71
+
72
+ 重启 DSH 后生效。卸载:
73
+
74
+ ```bash
75
+ dsh plugin --profile <profile> remove @istarry/dsh-assistant-profile
76
+ ```
77
+
78
+ `profile` 里残留的四行配置不会影响原生行为(插件不在了,没人读它),手工删掉更干净。
79
+
80
+ ## 与 dsh-agent-suite 的关系
81
+
82
+ 两者遮蔽的是同一个段(`deployment:persona-prefix`),**不要同时启用**:后加载的会赢,人格会互相覆盖。需要多个 agent 各自的人格请用 agent-suite;只要一个随身人格就用这个。
83
+
84
+ ## 构建
85
+
86
+ ```bash
87
+ cd tooling && pnpm install # 首次:tsdown + lightningcss + typescript + js-yaml
88
+ cd .. && node build.mjs # src/ → dist/(含清单与静态文件)
89
+ node build.mjs --staging # 只构建到 .build/out
90
+ node build.mjs --check # 构建 + 依赖契约校验,不写 dist/
91
+ ```
92
+
93
+ 宿主产物把 `js-yaml` 内联进去,运行时只依赖 `@deepseek-ai/schemastery`(声明在 `dependencies`,由 pnpm 装进插件自己的 node_modules)。浏览器半端只 `require` 模块表里的条目(react / ui-primitives)。
94
+
95
+ 改代码只改 `src/`,产物由构建生成。
96
+
97
+ ## 已知边界
98
+
99
+ - 只注入**顶层会话**,子代理不注入。
100
+ - 读不到预设定义时(注册表异常)降级为普通注入,不镜像 `complete`,也不报错。
101
+ - 三栏全部清空再保存 = 什么都不注入(回到原生身份句);装好时默认是默认三的内容。
102
+ - 侧栏名plate 是插在「新会话」按钮前的 DOM 节点(外壳没给这个位置留 slot),React 重渲染把它冲掉时会自动补回。
@@ -0,0 +1,8 @@
1
+ # 助理档案插件:一行。
2
+ # 宿主半端只做一件事——每个对话 agent 创建时,在它自己的作用域里遮蔽人格那一行
3
+ # (`deployment:persona-prefix`),文本来自本插件的配置;四个模式自动全覆盖,
4
+ # 不需要复制预设、不需要动模式选择器。浏览器半端提供「助理档案」入口、编辑页,
5
+ # 以及「新会话」按钮上方的助理名。
6
+ - insert:
7
+ - id: assistant-profile
8
+ name: '@istarry/dsh-assistant-profile'
package/icon.svg ADDED
@@ -0,0 +1,6 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="none">
2
+ <rect x="4" y="7" width="24" height="18" rx="4.6" stroke="currentColor" stroke-width="2"/>
3
+ <circle cx="12.6" cy="14.4" r="2.5" stroke="currentColor" stroke-width="1.8"/>
4
+ <path d="M8.7 21.1c.6-1.9 2.2-3 4-3s3.3 1.1 3.9 3" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
5
+ <path d="M20.3 13.6h4.2M20.3 17.6h3.2" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
6
+ </svg>