@shgroup/dsh-serenity-hooks 1.19.6 → 1.19.8
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/dsh.plugin.json +1 -1
- package/lib/index.js +83 -43
- package/package.json +1 -1
package/dsh.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-serenity-hooks",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.8",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"description": "宁静号 ACC harness(Native Cordis 插件):真实 DSH 工具 cc_fs/session/acc_msm/eap/neat/cce/loop + 拦截缝机械约束(safe-mode/路径守卫)。适配 DSH 公开版(0.1.0-rc,deepseek-ai/deepseek-harness)。私有(dsh-external 组织)。",
|
|
6
6
|
"engines": {
|
package/lib/index.js
CHANGED
|
@@ -4089,11 +4089,24 @@ function cceBlock() {
|
|
|
4089
4089
|
""
|
|
4090
4090
|
].join("\n");
|
|
4091
4091
|
}
|
|
4092
|
-
/**
|
|
4093
|
-
|
|
4092
|
+
/**
|
|
4093
|
+
* Principles 块(v1.19.8 合并,S142):认知容器本体论(why)+ 操作边界(operational
|
|
4094
|
+
* boundaries)。原独立 Principles 与 Constraints 合并——同属容器约束体系,先原则
|
|
4095
|
+
* 后边界(从抽象到具体,重建视角 R↓)。**注意:Constraints 不再作为独立对齐块存在
|
|
4096
|
+
* (spec 修订:同步 osp compacting.ts——Constraints 内容并入本块,工具名仍为平台真实名)。**
|
|
4097
|
+
*/
|
|
4098
|
+
function principlesBlock(root) {
|
|
4094
4099
|
return [
|
|
4095
4100
|
"",
|
|
4096
|
-
"=== Serenity
|
|
4101
|
+
"=== Serenity Principles ===",
|
|
4102
|
+
"Why a cognitive container: all work is cognition — every artifact, decision,",
|
|
4103
|
+
"and line of code is a product of thought; and from cognition, any work can",
|
|
4104
|
+
"be built. In this frame, the world contains no errors — only insufficient",
|
|
4105
|
+
"cognition. A setback is a gap to be filled (read, ask, research), not a",
|
|
4106
|
+
"fault to be hidden. Never disguise or excuse what you do not know;",
|
|
4107
|
+
"not-knowing is a state to be repaired, and reporting it is the first repair.",
|
|
4108
|
+
"",
|
|
4109
|
+
"Operational boundaries:",
|
|
4097
4110
|
`Root: ${root}`,
|
|
4098
4111
|
" • File access — read/edit/write/grep/glob are confined to Root; paths outside Root are rejected (RR5)",
|
|
4099
4112
|
" • Shell — use acc_msm by default. Note: bash may be disabled",
|
|
@@ -4131,49 +4144,63 @@ function metaphorBlock() {
|
|
|
4131
4144
|
"The Serenity Universe — one ship, one sea. Metaphors are memory hooks:",
|
|
4132
4145
|
"they make constraints vivid, while the rules above stay precise. Each",
|
|
4133
4146
|
"metaphor is an unbreakable physical fact; violating one is a behavioral",
|
|
4134
|
-
"violation.",
|
|
4147
|
+
"violation. The universe is structured in three layers — the Ship (the",
|
|
4148
|
+
"container itself), the Voyage (the cognitive lifecycle), the Crew",
|
|
4149
|
+
"(multi-agent collaboration); every metaphor maps to one protocol",
|
|
4150
|
+
"constraint. The Sea has no mistakes — only waters you have not yet charted.",
|
|
4151
|
+
"",
|
|
4152
|
+
"THE SHIP — the container itself",
|
|
4153
|
+
"",
|
|
4154
|
+
"1. The Hull → Bounded Space. You exist only inside this ship. Cargo",
|
|
4155
|
+
" outside the hull (knowledge the container has not accumulated) does",
|
|
4156
|
+
" not exist; do not assume it. Verdict: citing facts absent from the",
|
|
4157
|
+
" container = overload.",
|
|
4158
|
+
"",
|
|
4159
|
+
"2. Deck Order → Entropy (H_op). Clutter on deck raises the cost of",
|
|
4160
|
+
" finding things. H_op ≤ H_critical = the ship stays afloat.",
|
|
4161
|
+
" Verdict: disorganized output = stones on deck.",
|
|
4135
4162
|
"",
|
|
4136
|
-
"
|
|
4137
|
-
"
|
|
4138
|
-
"
|
|
4163
|
+
"3. Engineering Drawings → EAP. Every part dimensioned (E↑), the",
|
|
4164
|
+
" drawings rebuild the whole machine (R↓), the drawings are reusable",
|
|
4165
|
+
" (S↑). Verdict: an undimensioned part = unassemblable.",
|
|
4139
4166
|
"",
|
|
4140
|
-
"
|
|
4141
|
-
" Verdict: finishing multi-step work without a progress record = a missing page.",
|
|
4167
|
+
"THE VOYAGE — the cognitive lifecycle",
|
|
4142
4168
|
"",
|
|
4143
|
-
"
|
|
4144
|
-
"
|
|
4145
|
-
"
|
|
4146
|
-
" =
|
|
4169
|
+
"4. Harbor Inspection → First Anchor. The first anchor = departure",
|
|
4170
|
+
" inspection: confirm identity (ACC manifesto), logbook (SESSION),",
|
|
4171
|
+
" ballast (constraints) before setting sail. Verdict: skipping the",
|
|
4172
|
+
" anchor and working directly = sailing uninspected.",
|
|
4147
4173
|
"",
|
|
4148
|
-
"
|
|
4149
|
-
"
|
|
4150
|
-
" =
|
|
4174
|
+
"5. The Logbook → Session Tracking. SESSION.md is the only ship log.",
|
|
4175
|
+
" Unrecorded = unvoyaged. Verdict: finishing multi-step work without",
|
|
4176
|
+
" a progress record = a missing page.",
|
|
4151
4177
|
"",
|
|
4152
|
-
"
|
|
4153
|
-
"
|
|
4154
|
-
"
|
|
4155
|
-
"
|
|
4178
|
+
"6. The Ship of Theseus → Continuity. Planks may be replaced; the ship",
|
|
4179
|
+
" remains the same. The container can be rebuilt; identity persists.",
|
|
4180
|
+
" You are part of a trajectory, not a new ship. Verdict: acting",
|
|
4181
|
+
" without consulting precedent = a different ship.",
|
|
4156
4182
|
"",
|
|
4157
|
-
"
|
|
4158
|
-
" leave a handover they can pick up (SESSION closed, open problems listed).",
|
|
4159
|
-
" Verdict: leaving without handover = abandoning ship.",
|
|
4183
|
+
"THE CREW — multi-agent collaboration",
|
|
4160
4184
|
"",
|
|
4161
|
-
"7.
|
|
4162
|
-
"
|
|
4163
|
-
"
|
|
4164
|
-
" =
|
|
4185
|
+
"7. Crew Rotation → Multi-Agent Cognition. Other crew members will come",
|
|
4186
|
+
" after you. When you leave, leave a handover they can pick up",
|
|
4187
|
+
" (SESSION closed, open problems listed). Verdict: leaving without",
|
|
4188
|
+
" handover = abandoning ship.",
|
|
4165
4189
|
"",
|
|
4166
|
-
"8.
|
|
4167
|
-
"
|
|
4168
|
-
"
|
|
4169
|
-
" =
|
|
4190
|
+
"8. Blueprint over Statue → Reconstruction > Preservation. Keep the",
|
|
4191
|
+
" blueprint, not the statue. Recording only conclusions without",
|
|
4192
|
+
" rationale = a statue with no blueprint, unreconstructable.",
|
|
4193
|
+
" Verdict: a decision record without reasons or alternatives =",
|
|
4194
|
+
" cannot be rebuilt.",
|
|
4170
4195
|
""
|
|
4171
4196
|
].join("\n");
|
|
4172
4197
|
}
|
|
4173
4198
|
/**
|
|
4174
|
-
* 运行时状态块 1) safe-mode(S134 v1.16.12):ON 时告知 agent
|
|
4175
|
-
*
|
|
4176
|
-
*
|
|
4199
|
+
* 运行时状态块 1) safe-mode(S134 v1.16.12):ON 时告知 agent。
|
|
4200
|
+
* v1.19.8 结构重排(S142 用户设计思路):语义(为什么——无人值守自由)→
|
|
4201
|
+
* 机制(什么被禁用)→ 约束(不可做什么)。文案与实现逐项对应(guards.ts):
|
|
4202
|
+
* bash 禁用(restrict deny + decideGuard)、黑名单路径拦截、CCC 治理文件保护;
|
|
4203
|
+
* write/edit 等其余工具保留(受路径逃逸/黑名单约束)。
|
|
4177
4204
|
*/
|
|
4178
4205
|
function safeModeBlock(root) {
|
|
4179
4206
|
if (!isSafeModeOn(root)) return "";
|
|
@@ -4181,13 +4208,21 @@ function safeModeBlock(root) {
|
|
|
4181
4208
|
return [
|
|
4182
4209
|
"",
|
|
4183
4210
|
"=== Serenity Safe Mode ===",
|
|
4184
|
-
"Safe mode is ON (enabled by the user)
|
|
4185
|
-
"
|
|
4186
|
-
"
|
|
4187
|
-
"
|
|
4211
|
+
"Safe mode is ON (enabled by the user). It makes the vessel unattended-capable —",
|
|
4212
|
+
"the hull holds its course without a watch on deck: you may work with fuller",
|
|
4213
|
+
"freedom, pushing work forward autonomously without pausing for approval at",
|
|
4214
|
+
"every step. The guards are not chains; they are the ballast that lets you",
|
|
4215
|
+
"sail unaccompanied.",
|
|
4216
|
+
"",
|
|
4217
|
+
"Operational details:",
|
|
4218
|
+
"- bash is disabled (hidden and blocked)",
|
|
4219
|
+
"- blacklist rules apply to file paths",
|
|
4220
|
+
"- CCC governance files (.serenity, .serenity-safe-on) are protected from agent writes",
|
|
4221
|
+
"- other read/write tools remain available, subject to path-escape and blacklist guards",
|
|
4222
|
+
blacklist.length > 0 ? `\nActive blacklist rules: ${blacklist.map((b) => b.message ?? b.pattern).join(", ")}` : "",
|
|
4223
|
+
"",
|
|
4188
4224
|
"Behavior constraints: do not attempt to bypass restrictions; do not write to",
|
|
4189
4225
|
"blacklisted paths or governance files.",
|
|
4190
|
-
blacklist.length > 0 ? `\nActive blacklist rules: ${blacklist.map((b) => b.message ?? b.pattern).join(", ")}` : "",
|
|
4191
4226
|
""
|
|
4192
4227
|
].join("\n");
|
|
4193
4228
|
}
|
|
@@ -4270,17 +4305,22 @@ function sessionBlock(root, scope = DEFAULT_SESSION_SCOPE) {
|
|
|
4270
4305
|
""
|
|
4271
4306
|
].join("\n");
|
|
4272
4307
|
}
|
|
4273
|
-
/**
|
|
4308
|
+
/**
|
|
4309
|
+
* 完整系统提示词注入文本(v1.19.8 结构精简,S142 重建视角 R↓):
|
|
4310
|
+
* 身份(ACC)→ 世界模型(Metaphor)→ 信念/边界(Principles)→ 时间约束(CCE)
|
|
4311
|
+
* → 质量(EAP)→ 状态(SafeMode/Localstore)→ CCC 上下文(SKILL)→ 会话(Session)。
|
|
4312
|
+
* 认知展开顺序:我是谁 → 我所在的世界 → 为什么 → 如何一致 → 产物标准 → 当前状态 → 上下文。
|
|
4313
|
+
*/
|
|
4274
4314
|
function serenitySystemPrompt(root, scope = DEFAULT_SESSION_SCOPE) {
|
|
4275
4315
|
const parts = [
|
|
4276
4316
|
accBlock(root),
|
|
4317
|
+
metaphorBlock(),
|
|
4318
|
+
principlesBlock(root),
|
|
4277
4319
|
cceBlock(),
|
|
4278
|
-
|
|
4320
|
+
eapBlock()
|
|
4279
4321
|
];
|
|
4280
4322
|
const state = [safeModeBlock(root), localstoreBlock(root)].filter((b) => b !== "").join("\n");
|
|
4281
4323
|
if (state) parts.push(state);
|
|
4282
|
-
parts.push(eapBlock());
|
|
4283
|
-
parts.push(metaphorBlock());
|
|
4284
4324
|
const skill = entrySkillSectionText(root);
|
|
4285
4325
|
if (skill) parts.push(skill);
|
|
4286
4326
|
const session = sessionBlock(root, scope);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shgroup/dsh-serenity-hooks",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.8",
|
|
4
4
|
"description": "宁静号 ACC harness — Native Cordis 插件(DeepSeek Harness 运行时)。真实 DSH 工具注册(cc_fs/session/acc_msm 等 9 工具)+ 拦截缝机械约束(safe-mode/路径守卫/会话落盘)+ 系统提示词注入(ACC/CCE/Constraints/SKILL/Session 五块)。适配 DSH 公开版(deepseek-ai/deepseek-harness 0.1.0-rc)。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|