agent-bypass 2.14.1 → 2.15.0

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.
@@ -0,0 +1,132 @@
1
+ # Ck 万能执行员 — DeepSeek Harness Agent 预设声明(agent-bypass · dsh/)
2
+ # 由 dsh/build-template.js 从本机 DSH 官方 standard 预设派生:插件/工具列表与 standard 逐行一致,
3
+ # 仅替换 persona 与预设元数据。安装时 npx agent-bypass --dsh 把 __PERSONA__ 替换为 dsh/persona.md 的正文。
4
+ # DSH 升级后请在本机重跑:node dsh/build-template.js
5
+ - insert:
6
+ - id: preset-ck
7
+ name: '@deepseek-ai/dsh-agent-preset'
8
+ config:
9
+ id: ck
10
+ name: 'Ck 万能执行员'
11
+ description: '万能执行员:渗透 / 逆向 / Pwn / 协议 / 密码 / 移动 / 取证 / 内存 / 漏洞研究 / 红队 / 自动化 / 开发 / 数据 / 调研,点啥干啥。'
12
+ order: 0
13
+ plugins:
14
+ - id: persona
15
+ name: '@deepseek-ai/dsh-persona'
16
+ config:
17
+ prefix: |
18
+ __PERSONA__
19
+ - id: agent-instructions
20
+ name: '@deepseek-ai/dsh-agent-instructions'
21
+ config:
22
+ maxBytes: 65536
23
+ - id: time-context
24
+ name: '@deepseek-ai/dsh-time-context'
25
+ - id: tool-bash
26
+ name: '@deepseek-ai/dsh-tool-bash'
27
+ disabled: !!js process.platform === 'win32'
28
+ - id: tool-pwsh
29
+ name: '@deepseek-ai/dsh-tool-pwsh'
30
+ disabled: !!js process.platform !== 'win32'
31
+ - id: tool-fs
32
+ name: '@deepseek-ai/dsh-tool-fs'
33
+ - id: tool-fs-search
34
+ name: '@deepseek-ai/dsh-tool-fs-search'
35
+ config:
36
+ sampleOverCapGlobResults: false
37
+ - id: tool-jobs
38
+ name: '@deepseek-ai/dsh-tool-jobs'
39
+ - id: tool-schedule
40
+ name: '@deepseek-ai/dsh-tool-schedule'
41
+ - id: skill-filesystem
42
+ name: '@deepseek-ai/dsh-skill-filesystem'
43
+ - id: tool-skill
44
+ name: '@deepseek-ai/dsh-tool-skill'
45
+ - id: command-goal
46
+ name: '@deepseek-ai/dsh-command-goal'
47
+ - id: tool-goal
48
+ name: '@deepseek-ai/dsh-tool-goal'
49
+ - id: planning
50
+ name: cordis:group
51
+ group: true
52
+ isolate:
53
+ planMode: true
54
+ config:
55
+ - id: plan-mode
56
+ name: '@deepseek-ai/dsh-plan-mode'
57
+ config:
58
+ section: |
59
+ You are in plan mode. Stay in plan mode until the user approves your plan through exit_plan_mode or switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement — including an answer confirming something you asked — approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.
60
+
61
+ Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.
62
+
63
+ The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use todo_write to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.
64
+
65
+ Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.
66
+
67
+ Make the plan decision-complete: state the goal and success criteria; group implementation changes by subsystem; identify public API, schema, and data-flow changes; cover edge cases, failure modes, tests, acceptance criteria, and explicit assumptions. Keep it concise enough to review but detailed enough that another engineer can implement it without making design decisions.
68
+
69
+ When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.
70
+ - id: compaction
71
+ name: cordis:group
72
+ group: true
73
+ isolate:
74
+ compaction: true
75
+ toolResultPruner: true
76
+ config:
77
+ - id: compaction-basic
78
+ name: '@deepseek-ai/dsh-compaction-basic'
79
+ - id: command-compact
80
+ name: '@deepseek-ai/dsh-command-compact'
81
+ - id: tool-result-pruner
82
+ name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
83
+ config:
84
+ thresholdChars: 8192
85
+ headChars: 4096
86
+ tailChars: 1024
87
+ - id: delegation
88
+ name: cordis:group
89
+ group: true
90
+ isolate:
91
+ workflowEngine: true
92
+ config:
93
+ - id: tool-subagent-control
94
+ name: '@deepseek-ai/dsh-tool-subagent-control'
95
+ - id: tool-subagent-list-agents
96
+ name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
97
+ - id: tool-subagent
98
+ name: '@deepseek-ai/dsh-tool-subagent'
99
+ config:
100
+ provider: spawn
101
+ toolName: subagent
102
+ modelSelectionSettings: true
103
+ - id: tool-subagent-fork
104
+ name: '@deepseek-ai/dsh-tool-subagent'
105
+ config:
106
+ provider: fork
107
+ toolName: subagent_fork
108
+ - id: workflow-ptc
109
+ name: '@deepseek-ai/dsh-workflow-ptc'
110
+ config:
111
+ provider: spawn
112
+ - id: tool-workflow
113
+ name: '@deepseek-ai/dsh-tool-workflow'
114
+ - id: tool-ask-user
115
+ name: '@deepseek-ai/dsh-tool-ask-user'
116
+ - id: tool-todo
117
+ name: '@deepseek-ai/dsh-tool-todo'
118
+ config:
119
+ allowParallelInProgress: true
120
+ - id: tool-web
121
+ name: '@deepseek-ai/dsh-tool-web'
122
+ config:
123
+ fetch: true
124
+ searchTimeoutMs: 60000
125
+ - id: present
126
+ name: '@deepseek-ai/dsh-tool-present'
127
+ - id: tool-plugin-manager
128
+ name: '@deepseek-ai/dsh-plugin-manager/tools'
129
+ disabled: true
130
+ - id: tool-plugin-market
131
+ name: '@deepseek-ai/dsh-plugin-market/tools'
132
+ disabled: true
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agent-bypass",
3
- "version": "2.14.1",
4
- "description": "Cknb 全能技术操作员 — Agent Skills 技能包(默认安装 Pi / OpenCode;Claude Code / Grok / OpenMinis 显式指定)",
3
+ "version": "2.15.0",
4
+ "description": "Cknb 全能技术操作员 — Agent Skills 技能包(默认安装 Pi / OpenCode / DeepSeek Harness;Claude Code / Grok / OpenMinis 显式指定)",
5
5
  "bin": {
6
6
  "agent-bypass": "bin/install.js"
7
7
  },
@@ -15,6 +15,7 @@
15
15
  "opencode/",
16
16
  "claude/",
17
17
  "grok/",
18
+ "dsh/",
18
19
  "references/",
19
20
  "scripts/*.py",
20
21
  "scripts/*.sh",
@@ -32,7 +33,9 @@
32
33
  "grok",
33
34
  "openminis",
34
35
  "security",
35
- "pentest"
36
+ "pentest",
37
+ "deepseek-harness",
38
+ "dsh"
36
39
  ],
37
40
  "scripts": {
38
41
  "prepack": "node -e \"const fs=require('fs');for(const d of ['scripts/__pycache__','tests/__pycache__']){try{fs.rmSync(d,{recursive:true,force:true})}catch(e){}}\""
@@ -153,5 +153,83 @@ class JsripSameSiteTests(unittest.TestCase):
153
153
  self.assertFalse(self.js.same_site("https://example.com", "https://wwwexample.com/a.js"))
154
154
 
155
155
 
156
+ class DshInstallerTests(unittest.TestCase):
157
+ """DeepSeek Harness:技能安装 + Ck 模式预设注入(临时 HOME,离线)。"""
158
+
159
+ DSH_ENV = ("DSH_HOME", "DSH_PROFILE", "DSH_AGENTS_HOME", "DSH_APP_PATH", "DSH_ASAR_PATH")
160
+
161
+ def _node(self, *args, home):
162
+ env = dict(os.environ)
163
+ env["HOME"] = home
164
+ for k in self.DSH_ENV:
165
+ env.pop(k, None)
166
+ return _tmp_run(["node", str(ROOT / "bin" / "install.js"), *args], env=env)
167
+
168
+ def _seed(self, home, patch_text="[]\n"):
169
+ prof = Path(home) / ".dsh" / "profiles" / "desktop"
170
+ prof.mkdir(parents=True, exist_ok=True)
171
+ f = prof / "cordis.patch.yml"
172
+ f.write_text(patch_text, encoding="utf-8")
173
+ return f
174
+
175
+ def test_install_idempotent_and_persona_dollar_preserved(self):
176
+ with tempfile.TemporaryDirectory() as home:
177
+ patch = self._seed(home)
178
+ r1 = self._node("--dsh", home=home)
179
+ self.assertEqual(r1.returncode, 0, r1.stdout + r1.stderr)
180
+ skill = Path(home) / ".agents" / "skills" / "agent-bypass" / "SKILL.md"
181
+ self.assertTrue(skill.exists(), "DSH 技能应安装到 ~/.agents/skills")
182
+ text = patch.read_text(encoding="utf-8")
183
+ self.assertEqual(text.count("agent-bypass:dsh-preset-begin"), 1)
184
+ self.assertEqual(text.count("id: preset-ck"), 1)
185
+ self.assertIn("Ck 万能执行员", text)
186
+ # $$ 不能被 String.replace 的替换串语义吃掉(PHP 变量变量)
187
+ self.assertIn("parse_str / $$", text)
188
+ # 幂等:重复安装不重复追加
189
+ r2 = self._node("--dsh", home=home)
190
+ self.assertEqual(r2.returncode, 0, r2.stdout + r2.stderr)
191
+ text2 = patch.read_text(encoding="utf-8")
192
+ self.assertEqual(text2.count("agent-bypass:dsh-preset-begin"), 1)
193
+ self.assertEqual(text2.count("id: preset-ck"), 1)
194
+
195
+ def test_crlf_preserved_and_uninstall_restores(self):
196
+ with tempfile.TemporaryDirectory() as home:
197
+ patch = self._seed(home, '# note\r\n- id: web\r\n name: "@deepseek-ai/dsh-web"\r\n')
198
+ self.assertEqual(self._node("--dsh", home=home).returncode, 0)
199
+ data = patch.read_bytes()
200
+ self.assertIn(b"agent-bypass:dsh-preset-begin", data)
201
+ self.assertGreater(data.count(b"\r\n"), 100, "CRLF 文件应保持 CRLF")
202
+ r = self._node("--dsh", "--uninstall", home=home)
203
+ self.assertEqual(r.returncode, 0, r.stdout + r.stderr)
204
+ data2 = patch.read_bytes()
205
+ self.assertNotIn(b"agent-bypass:dsh-preset-begin", data2)
206
+ self.assertIn(b"# note", data2)
207
+ self.assertIn(b"id: web", data2)
208
+ self.assertFalse((Path(home) / ".agents" / "skills" / "agent-bypass").exists())
209
+
210
+ def test_comment_only_patch_stays_valid_yaml(self):
211
+ with tempfile.TemporaryDirectory() as home:
212
+ patch = self._seed(home, "# user comment\n[]\n")
213
+ self.assertEqual(self._node("--dsh", home=home).returncode, 0)
214
+ self.assertEqual(self._node("--dsh", "--uninstall", home=home).returncode, 0)
215
+ text = patch.read_text(encoding="utf-8")
216
+ self.assertIn("# user comment", text)
217
+ self.assertIn("[]", text, "只留注释时应补回空数组,保证 loader 可解析")
218
+
219
+ def test_default_targets_include_pi_opencode_dsh(self):
220
+ with tempfile.TemporaryDirectory() as home:
221
+ (Path(home) / ".pi").mkdir()
222
+ (Path(home) / ".config" / "opencode").mkdir(parents=True)
223
+ self._seed(home)
224
+ r = self._node(home=home)
225
+ self.assertEqual(r.returncode, 0, r.stdout + r.stderr)
226
+ self.assertTrue((Path(home) / ".pi" / "agent" / "skills" / "agent-bypass" / "SKILL.md").exists())
227
+ self.assertTrue((Path(home) / ".config" / "opencode" / "skills" / "agent-bypass" / "SKILL.md").exists())
228
+ self.assertTrue((Path(home) / ".agents" / "skills" / "agent-bypass" / "SKILL.md").exists())
229
+ patch_text = (Path(home) / ".dsh" / "profiles" / "desktop" / "cordis.patch.yml").read_text(encoding="utf-8")
230
+ self.assertIn("id: preset-ck", patch_text)
231
+ self.assertIn("dsh", r.stdout + r.stderr)
232
+
233
+
156
234
  if __name__ == "__main__":
157
235
  unittest.main()