@lornatang/dsh-caveman 0.1.9 → 0.1.11

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.11 - 2026-11-23
4
+
5
+ - Keep native events local to DSH on Windows and enforce resource limits on crew operations.
6
+ - Update the TypeScript and DSH development dependencies.
7
+ - Publish from the shared repository using npm Trusted Publishing.
8
+
9
+ ## 0.1.10 - 2026-11-21
10
+
11
+ - Move the source and release metadata to the shared dsh-plugin repository.
12
+ - Download the session analyzer and its platform-specific binaries from the same repository as the bundle.
13
+
3
14
  ## 0.1.9 - 2026-11-19
4
15
 
5
16
  - Recheck the runtime record before reusing cached health verification, so changed runtime identities cannot accept observations.
package/README.md CHANGED
@@ -39,11 +39,11 @@ dsh plugin --profile <name> remove @lornatang/dsh-caveman
39
39
  To install a package built from the repository:
40
40
 
41
41
  ```sh
42
- git clone https://github.com/Lornatang/dsh-caveman.git
43
- cd dsh-caveman
42
+ git clone https://github.com/Lornatang/dsh-plugin.git
43
+ cd dsh-plugin/packages/workflow/dsh-caveman
44
44
  npm ci
45
45
  npm pack
46
- dsh plugin --profile <name> add ./lornatang-dsh-caveman-0.1.5.tgz
46
+ dsh plugin --profile <name> add ./lornatang-dsh-caveman-<version>.tgz
47
47
  ```
48
48
 
49
49
  The `add` command composes the bundle into the profile. Its patches insert the `caveman` row, three Cavecrew presets, and their delegation tools. Restart DSH after `add` or `remove` so the profile reloads its composition.
@@ -93,6 +93,8 @@ Use `/caveman`, `/ultracave`, `/megacave`, `/caveman ultra`, `/caveman wenyan`,
93
93
 
94
94
  The native coding policy is included in the system prompt when the output module and Core are active. When the local runtime is running, it also supplies task-specific rules, maintains state across compaction, and can suggest reusing a verified unchanged file observation. Recovery references are shown only when the recovery MCP tool is available. `CAVEMAN_CORE=off`, record mode, or the `record-only` native profile disables the active rules; restart DSH after changing these settings. The `core-lean-build` profile adds the lean-build policy.
95
95
 
96
+ On Windows, DSH disables the native event hooks until the local runtime can prove its pipe identity. Dynamic task rules, native compaction state, and file observation reuse require these hooks. On this platform, use the static coding policy and HTTP middleware.
97
+
96
98
  `/caveman-stats` reports usage recorded on committed assistant messages, with output attributed to response modes when recorded. Use `--all` for live and stored sessions, `--since 7d` or `--since 24h` for usage within that window, and `--share` for a concise report of the selected scope. Historical totals exclude fork-inherited events and identify unavailable records. Savings remain unknown without a comparison.
97
99
 
98
100
  ### Usage analysis
package/README.zh.md CHANGED
@@ -39,11 +39,11 @@ dsh plugin --profile <name> remove @lornatang/dsh-caveman
39
39
  也可以从仓库打包并安装:
40
40
 
41
41
  ```sh
42
- git clone https://github.com/Lornatang/dsh-caveman.git
43
- cd dsh-caveman
42
+ git clone https://github.com/Lornatang/dsh-plugin.git
43
+ cd dsh-plugin/packages/workflow/dsh-caveman
44
44
  npm ci
45
45
  npm pack
46
- dsh plugin --profile <name> add ./lornatang-dsh-caveman-0.1.5.tgz
46
+ dsh plugin --profile <name> add ./lornatang-dsh-caveman-<version>.tgz
47
47
  ```
48
48
 
49
49
  `add` 命令把 bundle 组合进 profile。patch 会插入 `caveman` 行、三个 Cavecrew 预设及其委派工具。`add` 或 `remove` 后重启 DSH,使 profile 重新加载配置。
@@ -93,6 +93,8 @@ bundle 自带 `caveman` 行。在 profile 的 `cordis.patch.yml` 中添加覆盖
93
93
 
94
94
  output 模块和 Core 启用时,原生编码规则会加入系统提示词。本地运行时启动后,还会提供任务规则、衔接压缩前后的状态,并在文件确定未变化时提示复用已有观察;只有恢复 MCP 工具可用时才会展示恢复引用。设置 `CAVEMAN_CORE=off`、使用 record 模式或 `record-only` 原生 profile 可关闭活动规则;更改后重启 DSH。`core-lean-build` profile 会额外加入 lean-build 规则。
95
95
 
96
+ Windows 上,DSH 会暂停原生事件钩子,直到本地运行时能够证明其管道身份。动态任务规则、原生压缩状态和文件观察复用依赖这些钩子。Windows 上可通过 HTTP middleware 使用压缩,也可使用静态编码规则。
97
+
96
98
  `/caveman-stats` 报告已提交 assistant 消息中记录的用量,并在有记录时按回答模式归属输出。使用 `--all` 查看当前及存储的会话,使用 `--since 7d` 或 `--since 24h` 查看对应时间内的用量,使用 `--share` 生成所选范围的简短报告。历史总数排除分叉继承的事件,并标明不可读取的记录。没有对照数据时,节省量为未知。
97
99
 
98
100
  ### 用量分析
package/lib/cavecrew.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { readFile } from 'node:fs/promises';
2
- import { normalize } from 'node:path';
3
2
  import z from '@deepseek-ai/schemastery';
4
3
  import { registerCavecrewGit } from './cavecrew-git.js';
5
4
  export const name = 'cavecrew';
@@ -7,6 +6,57 @@ export const inject = ['tools', 'systemPrompt', 'llm'];
7
6
  export const Config = z.object({
8
7
  role: z.union([z.const('investigator'), z.const('builder'), z.const('reviewer')]).required(),
9
8
  });
9
+ function limitBuilderEdits(ctx) {
10
+ const byAgent = new WeakMap();
11
+ const active = new WeakMap();
12
+ ctx.on('tools/execute', async (exec, next) => {
13
+ if (exec.name !== 'edit' || !exec.agent)
14
+ return next();
15
+ const targets = byAgent.get(exec.agent) ?? new Map();
16
+ byAgent.set(exec.agent, targets);
17
+ const attempt = { targets };
18
+ active.set(exec, attempt);
19
+ try {
20
+ return await next();
21
+ }
22
+ finally {
23
+ active.delete(exec);
24
+ const reservation = attempt.reservation;
25
+ if (reservation) {
26
+ reservation.state.pending -= 1;
27
+ if (!reservation.state.committed && reservation.state.pending === 0)
28
+ targets.delete(reservation.key);
29
+ }
30
+ }
31
+ });
32
+ // The filesystem tool supplies the resolved target that it will actually edit.
33
+ ctx.on('fs/edit-intent', async (target, actor, next) => {
34
+ const attempt = actor ? active.get(actor) : undefined;
35
+ if (!attempt)
36
+ return next();
37
+ const key = target.targetKey;
38
+ if (attempt.reservation) {
39
+ if (attempt.reservation.key !== key)
40
+ throw new Error('Cavecrew edit cannot change its resolved target.');
41
+ return next();
42
+ }
43
+ let state = attempt.targets.get(key);
44
+ if (!state) {
45
+ if (attempt.targets.size >= 2)
46
+ throw new Error('Cavecrew builder is limited to two file paths.');
47
+ state = { pending: 0, committed: false };
48
+ attempt.targets.set(key, state);
49
+ }
50
+ state.pending += 1;
51
+ attempt.reservation = { key, state };
52
+ return next();
53
+ }, { prepend: true });
54
+ ctx.on('fs/observed', (target, observation, actor) => {
55
+ const reservation = actor ? active.get(actor)?.reservation : undefined;
56
+ if (reservation?.key === target.targetKey && observation.kind === 'present')
57
+ reservation.state.committed = true;
58
+ }, { prepend: true });
59
+ }
10
60
  /** Install one original Cavecrew persona and keep its agent's tools bounded. */
11
61
  export async function apply(ctx, config) {
12
62
  const original = await readFile(new URL(`../vendor/caveman/agents/cavecrew-${config.role}.md`, import.meta.url), 'utf8');
@@ -32,11 +82,6 @@ export async function apply(ctx, config) {
32
82
  });
33
83
  }
34
84
  const permitted = new Set(allowed);
35
- const edited = new WeakMap();
36
- const editKey = (value) => {
37
- const normalized = normalize(value);
38
- return process.platform === 'win32' ? normalized.toLowerCase() : normalized;
39
- };
40
85
  ctx.tools.guard(exec => {
41
86
  if (!permitted.has(exec.name))
42
87
  return `Cavecrew ${config.role} does not permit ${exec.name}.`;
@@ -46,28 +91,10 @@ export async function apply(ctx, config) {
46
91
  !('file_path' in exec.arguments) || typeof exec.arguments.file_path !== 'string' || !exec.arguments.file_path.trim()) {
47
92
  return 'Cavecrew builder requires an existing file path.';
48
93
  }
49
- const path = editKey(exec.arguments.file_path);
50
- const paths = edited.get(exec.agent) ?? new Set();
51
- if (!paths.has(path)) {
52
- if (paths.size >= 2)
53
- return 'Cavecrew builder is limited to two file paths.';
54
- paths.add(path);
55
- edited.set(exec.agent, paths);
56
- }
57
94
  return undefined;
58
95
  });
59
- if (config.role === 'builder') {
60
- // The guard runs before the edit body, so refund the budget when the edit fails.
61
- ctx.on('tools/execute', async (exec, next) => {
62
- const result = await next();
63
- if (exec.name !== 'edit' || !exec.agent || !result.isError ||
64
- typeof exec.arguments !== 'object' || exec.arguments === null ||
65
- !('file_path' in exec.arguments) || typeof exec.arguments.file_path !== 'string')
66
- return result;
67
- edited.get(exec.agent)?.delete(editKey(exec.arguments.file_path));
68
- return result;
69
- });
70
- }
96
+ if (config.role === 'builder')
97
+ limitBuilderEdits(ctx);
71
98
  ctx.on('agent/created', async ({ agent }) => {
72
99
  const available = allowed.filter(tool => ctx.tools.get(tool, agent) !== undefined);
73
100
  agent.ctx.tools.restrict({ allow: available });
package/lib/native.js CHANGED
@@ -3,7 +3,7 @@ import { constants } from 'node:fs';
3
3
  import { lstat, open, realpath, stat } from 'node:fs/promises';
4
4
  import { connect } from 'node:net';
5
5
  import { homedir } from 'node:os';
6
- import { join, resolve, win32 } from 'node:path';
6
+ import { join, resolve } from 'node:path';
7
7
  import { setTimeout as delay } from 'node:timers/promises';
8
8
  import { isDeepStrictEqual } from 'node:util';
9
9
  import { createUserMessage } from '@deepseek-ai/dsh-llm';
@@ -49,14 +49,11 @@ export function nativePrompt(prompt) {
49
49
  const bytes = Buffer.from(prompt, 'utf8');
50
50
  return { prompt: { bytes: bytes.length, sha256: `sha256:${createHash('sha256').update(bytes).digest('hex')}` }, task_profile: { type, terms: [...seen], continuation } };
51
51
  }
52
- /** Name the same per-install socket as the local runtime. */
52
+ /** Return the supported local socket endpoint, if available on this platform. */
53
53
  export function nativeSocketPath(home, platform = process.platform) {
54
- if (platform !== 'win32')
55
- return join(home, 'run', 'native.sock');
56
- let folded = '';
57
- for (const char of win32.resolve(home))
58
- folded += String.fromCodePoint(char.toLowerCase().codePointAt(0));
59
- return `\\\\.\\pipe\\caveman-native-${createHash('sha256').update(folded).digest('hex').slice(0, 16)}`;
54
+ // The current Windows runtime has no pipe peer proof, and its HTTP health
55
+ // check only verifies the HTTP listener. Keep native events local to DSH.
56
+ return platform === 'win32' ? undefined : join(home, 'run', 'native.sock');
60
57
  }
61
58
  function validResponse(value) {
62
59
  if (!value || typeof value !== 'object' || Array.isArray(value))
@@ -78,8 +75,6 @@ function validResponse(value) {
78
75
  }
79
76
  /** Refuse a replaced socket path before sending prompt terms or tool data over it. */
80
77
  async function socketTrust(path) {
81
- if (process.platform === 'win32')
82
- return 'trusted';
83
78
  try {
84
79
  const info = await lstat(path);
85
80
  if (!info.isSocket())
@@ -98,7 +93,7 @@ export async function nativeCall(home, request, signal) {
98
93
  if (signal?.aborted)
99
94
  return undefined;
100
95
  const socketPath = nativeSocketPath(home);
101
- if (await socketTrust(socketPath) === 'untrusted')
96
+ if (!socketPath || await socketTrust(socketPath) === 'untrusted')
102
97
  return undefined;
103
98
  const payload = Buffer.from(JSON.stringify(request) + '\n');
104
99
  if (payload.length > 2 * 1024 * 1024)
@@ -223,11 +218,13 @@ async function runtimeInstance(endpoint, home, signal) {
223
218
  }
224
219
  /** Add dynamic native task context when the verified local runtime is running. */
225
220
  export function registerNative(ctx, endpoint, policy) {
221
+ const home = process.env.CAVEMAN_HOME ?? join(homedir(), '.caveman');
222
+ if (!nativeSocketPath(home))
223
+ return;
226
224
  const sessions = new WeakMap();
227
225
  const owners = new WeakMap();
228
226
  const selections = new WeakMap();
229
227
  const pending = new Set();
230
- const home = process.env.CAVEMAN_HOME ?? join(homedir(), '.caveman');
231
228
  ctx.on('system-prompt/assemble', async (_assembly, context, next) => {
232
229
  const result = await next();
233
230
  if (context.agent && context.toolSet)
@@ -31,8 +31,8 @@ export declare function nativePrompt(prompt: string): {
31
31
  continuation: boolean;
32
32
  };
33
33
  };
34
- /** Name the same per-install socket as the local runtime. */
35
- export declare function nativeSocketPath(home: string, platform?: NodeJS.Platform): string;
34
+ /** Return the supported local socket endpoint, if available on this platform. */
35
+ export declare function nativeSocketPath(home: string, platform?: NodeJS.Platform): string | undefined;
36
36
  export declare function nativeCall(home: string, request: object, signal?: AbortSignal): Promise<NativeResponse | undefined>;
37
37
  /** Add dynamic native task context when the verified local runtime is running. */
38
38
  export declare function registerNative(ctx: Context, endpoint: string, policy: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lornatang/dsh-caveman",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Caveman integration for DeepSeek Harness.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -92,39 +92,40 @@
92
92
  "devDependencies": {
93
93
  "@deepseek-ai/cordis": "~4.1.0",
94
94
  "@deepseek-ai/cordis-plugin-group": "1.1.0",
95
- "@deepseek-ai/dsh-agent": "0.2.2-rc.3",
96
- "@deepseek-ai/dsh-agent-loop": "^0.2.2-rc.3",
97
- "@deepseek-ai/dsh-agent-preset": "0.2.2-rc.3",
98
- "@deepseek-ai/dsh-agent-preset-registry": "0.2.2-rc.3",
99
- "@deepseek-ai/dsh-fs-local": "0.2.2-rc.3",
100
- "@deepseek-ai/dsh-llm": "0.2.2-rc.3",
101
- "@deepseek-ai/dsh-llm-pi-ai": "0.2.2-rc.3",
102
- "@deepseek-ai/dsh-mcp-manager": "0.2.2-rc.3",
103
- "@deepseek-ai/dsh-ptc-runtime": "0.2.2-rc.3",
104
- "@deepseek-ai/dsh-sandbox-policy": "0.2.2-rc.3",
105
- "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.2-rc.3",
106
- "@deepseek-ai/dsh-skill": "0.2.2-rc.3",
107
- "@deepseek-ai/dsh-subagent": "0.2.2-rc.3",
108
- "@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.2-rc.3",
109
- "@deepseek-ai/dsh-subprocess-local": "0.2.2-rc.3",
110
- "@deepseek-ai/dsh-system-prompt": "0.2.2-rc.3",
111
- "@deepseek-ai/dsh-tool-executor-native": "^0.2.2-rc.3",
112
- "@deepseek-ai/dsh-tool-executor-ptc": "0.2.2-rc.3",
113
- "@deepseek-ai/dsh-tool-fs": "0.2.2-rc.3",
114
- "@deepseek-ai/dsh-tool-fs-search": "0.2.2-rc.3",
115
- "@deepseek-ai/dsh-tool-subagent": "0.2.2-rc.3",
116
- "@deepseek-ai/dsh-tools": "^0.2.2-rc.3",
117
- "@deepseek-ai/dsh-working-directory": "0.2.2-rc.3",
95
+ "@deepseek-ai/dsh-agent": "*",
96
+ "@deepseek-ai/dsh-agent-loop": "*",
97
+ "@deepseek-ai/dsh-agent-preset": "*",
98
+ "@deepseek-ai/dsh-agent-preset-registry": "*",
99
+ "@deepseek-ai/dsh-fs-local": "*",
100
+ "@deepseek-ai/dsh-llm": "*",
101
+ "@deepseek-ai/dsh-llm-pi-ai": "*",
102
+ "@deepseek-ai/dsh-mcp-manager": "*",
103
+ "@deepseek-ai/dsh-ptc-runtime": "*",
104
+ "@deepseek-ai/dsh-sandbox-policy": "*",
105
+ "@deepseek-ai/dsh-session-persistence-jsonl": "*",
106
+ "@deepseek-ai/dsh-skill": "*",
107
+ "@deepseek-ai/dsh-subagent": "*",
108
+ "@deepseek-ai/dsh-subagent-spawn-in-process": "*",
109
+ "@deepseek-ai/dsh-subprocess-local": "*",
110
+ "@deepseek-ai/dsh-system-prompt": "*",
111
+ "@deepseek-ai/dsh-tool-executor-native": "*",
112
+ "@deepseek-ai/dsh-tool-executor-ptc": "*",
113
+ "@deepseek-ai/dsh-tool-fs": "*",
114
+ "@deepseek-ai/dsh-tool-fs-search": "*",
115
+ "@deepseek-ai/dsh-tool-subagent": "*",
116
+ "@deepseek-ai/dsh-tools": "*",
117
+ "@deepseek-ai/dsh-working-directory": "*",
118
118
  "@types/node": "^26.6.6",
119
119
  "typescript": "^7.0.2"
120
120
  },
121
121
  "repository": {
122
122
  "type": "git",
123
- "url": "git+https://github.com/Lornatang/dsh-caveman.git"
123
+ "url": "git+https://github.com/Lornatang/dsh-plugin.git",
124
+ "directory": "packages/workflow/dsh-caveman"
124
125
  },
125
- "homepage": "https://github.com/Lornatang/dsh-caveman#readme",
126
+ "homepage": "https://github.com/Lornatang/dsh-plugin/tree/main/packages/workflow/dsh-caveman#readme",
126
127
  "bugs": {
127
- "url": "https://github.com/Lornatang/dsh-caveman/issues"
128
+ "url": "https://github.com/Lornatang/dsh-plugin/issues"
128
129
  },
129
130
  "publishConfig": {
130
131
  "access": "public",
@@ -41,7 +41,7 @@ export async function resolveLearnBinary(options = {}) {
41
41
  let handle
42
42
  let dispatcher
43
43
  try {
44
- const url = `https://github.com/Lornatang/dsh-caveman/releases/download/v${version}/${expectedName}`
44
+ const url = `https://github.com/Lornatang/dsh-plugin/releases/download/dsh-caveman-v${version}/${expectedName}`
45
45
  let fetcher = options.fetcher ?? fetch
46
46
  if (!options.fetcher && (env.https_proxy || env.HTTPS_PROXY || env.http_proxy || env.HTTP_PROXY)) {
47
47
  const { EnvHttpProxyAgent, fetch: proxyFetch } = await import('undici')
@@ -1,29 +1,29 @@
1
1
  {
2
- "version": "0.1.9",
2
+ "version": "0.1.11",
3
3
  "binaries": {
4
4
  "linux-x64": {
5
5
  "name": "dsh-caveman-learn_linux_amd64",
6
- "sha256": "0bbc8d74cb5c1f7494fc6fed5582a1e0f0259200df490b4b866ce43ba555d889"
6
+ "sha256": "44ba840775952ee1e8f568a25f43fac236926b0d1ea2aebfdf5d0ce8e8c497af"
7
7
  },
8
8
  "linux-arm64": {
9
9
  "name": "dsh-caveman-learn_linux_arm64",
10
- "sha256": "b3ddb175c675023c6c091f26a1f992c545e03df0ccf46632a577e48db8ec1fa9"
10
+ "sha256": "74efd959b4a684abfd70a56b65b5d515e42d961d49d8cd6420e829ad8aea2f3d"
11
11
  },
12
12
  "darwin-x64": {
13
13
  "name": "dsh-caveman-learn_darwin_amd64",
14
- "sha256": "8145380c71fe57e8829a856c808c887b271e6d004078ca989c23d997c61ffbab"
14
+ "sha256": "12b351a47a3b0eaec6ce874315bb27feb7a01db2215c81c0f8fcd3358f6cbd8f"
15
15
  },
16
16
  "darwin-arm64": {
17
17
  "name": "dsh-caveman-learn_darwin_arm64",
18
- "sha256": "03be0ecc7f9d4d0669edf1c79a5d3f20921e8d89d210fdadc99f0e2c16b1e7b4"
18
+ "sha256": "b3e4566e3d04170cd777c9793a71995edfe91cabccf6a87897109cebaa39a105"
19
19
  },
20
20
  "win32-x64": {
21
21
  "name": "dsh-caveman-learn_win32_amd64",
22
- "sha256": "ce0b6834457c8f188c883b6c46892930b0fad63d85cf9f7033ddd53cc1fd5b4a"
22
+ "sha256": "bf305bfaff6e4ad2f1a6e399d2191e0a179f7096de05283d027d99f2a9b3f2af"
23
23
  },
24
24
  "win32-arm64": {
25
25
  "name": "dsh-caveman-learn_win32_arm64",
26
- "sha256": "bceddc401c9711c6c67194dbf27e7a227100eb315397018affce9cd8ea0a2f5b"
26
+ "sha256": "a03b3c3cc71264a8d5777cd807a69e7ea28a02e0d502b228578b30c9161c1593"
27
27
  }
28
28
  }
29
29
  }