@caveman-ai/cli 1.3.4 → 2.0.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 +202 -21
- package/NOTICE +66 -0
- package/README.md +20 -0
- package/dist/agent-skills.generated.js +28 -4
- package/dist/agents.generated.js +26 -26
- package/dist/binaries.generated.js +1 -1
- package/dist/caveman-delegate-mcp.mjs +0 -0
- package/dist/caveman-pi-extension.mjs +79 -14
- package/dist/index.js +1644 -285
- package/dist/learn-autopilot.js +447 -0
- package/dist/learn-trends.js +132 -0
- package/dist/learn-tui.js +31 -31
- package/dist/native-hook-fast.js +17 -4
- package/dist/native-pack.generated.js +1 -1
- package/dist/provider-routing.js +9 -2
- package/package.json +12 -12
- package/dist/cloud-client.mjs +0 -22
- package/dist/cloud-mcp.mjs +0 -75
- package/dist/surface.json +0 -299
package/dist/agents.generated.js
CHANGED
|
@@ -64,10 +64,10 @@ export const PROFILES = [
|
|
|
64
64
|
"attribution": {
|
|
65
65
|
"header": "x-cave-agent"
|
|
66
66
|
},
|
|
67
|
-
"tested_agent_version": "2.1.
|
|
67
|
+
"tested_agent_version": "2.1.285",
|
|
68
68
|
"injection_completeness": "builder-assisted",
|
|
69
|
-
"last_verified_at": "2026-09-
|
|
70
|
-
"verified_by": "local pinned-binary probe (claude 2.1.
|
|
69
|
+
"last_verified_at": "2026-09-30",
|
|
70
|
+
"verified_by": "local pinned-binary probe (claude 2.1.285, agents/probe-installed.mjs)",
|
|
71
71
|
"fallback": "generic-env",
|
|
72
72
|
"maintainer": null
|
|
73
73
|
},
|
|
@@ -101,10 +101,10 @@ export const PROFILES = [
|
|
|
101
101
|
"attribution": {
|
|
102
102
|
"header": "x-cave-agent"
|
|
103
103
|
},
|
|
104
|
-
"tested_agent_version": "0.
|
|
104
|
+
"tested_agent_version": "0.158.0",
|
|
105
105
|
"injection_completeness": "code-only",
|
|
106
|
-
"last_verified_at": "2026-09-
|
|
107
|
-
"verified_by": "local pinned-binary probe (codex 0.
|
|
106
|
+
"last_verified_at": "2026-09-29",
|
|
107
|
+
"verified_by": "local pinned-binary probe (codex 0.158.0, agents/probe-installed.mjs)",
|
|
108
108
|
"fallback": "generic-env",
|
|
109
109
|
"maintainer": null
|
|
110
110
|
},
|
|
@@ -133,10 +133,10 @@ export const PROFILES = [
|
|
|
133
133
|
"attribution": {
|
|
134
134
|
"header": "x-cave-agent"
|
|
135
135
|
},
|
|
136
|
-
"tested_agent_version": "0.
|
|
136
|
+
"tested_agent_version": "0.61.0",
|
|
137
137
|
"injection_completeness": "declarative",
|
|
138
|
-
"last_verified_at": "2026-09-
|
|
139
|
-
"verified_by": "local pinned-binary probe (gemini 0.
|
|
138
|
+
"last_verified_at": "2026-09-24",
|
|
139
|
+
"verified_by": "local pinned-binary probe (gemini 0.61.0, agents/probe-installed.mjs)",
|
|
140
140
|
"fallback": "generic-env",
|
|
141
141
|
"maintainer": null
|
|
142
142
|
},
|
|
@@ -184,7 +184,7 @@ export const PROFILES = [
|
|
|
184
184
|
"kilocode"
|
|
185
185
|
],
|
|
186
186
|
"args": [],
|
|
187
|
-
"install": "npm install -g @kilocode/cli@7.
|
|
187
|
+
"install": "npm install -g @kilocode/cli@7.8.1",
|
|
188
188
|
"wire_protocol": "openai-chat",
|
|
189
189
|
"injection": {
|
|
190
190
|
"method": "config-env-content",
|
|
@@ -270,10 +270,10 @@ export const PROFILES = [
|
|
|
270
270
|
"attribution": {
|
|
271
271
|
"header": "X-Cave-Agent"
|
|
272
272
|
},
|
|
273
|
-
"tested_agent_version": "7.
|
|
273
|
+
"tested_agent_version": "7.8.1",
|
|
274
274
|
"injection_completeness": "declarative",
|
|
275
|
-
"last_verified_at": "2026-09-
|
|
276
|
-
"verified_by": "local pinned-binary probe (kilo 7.
|
|
275
|
+
"last_verified_at": "2026-09-26",
|
|
276
|
+
"verified_by": "local pinned-binary probe (kilo 7.8.1, agents/probe-installed.mjs)",
|
|
277
277
|
"fallback": "generic-env",
|
|
278
278
|
"maintainer": null
|
|
279
279
|
},
|
|
@@ -331,10 +331,10 @@ export const PROFILES = [
|
|
|
331
331
|
"attribution": {
|
|
332
332
|
"header": "x-cave-agent"
|
|
333
333
|
},
|
|
334
|
-
"tested_agent_version": "2026.
|
|
334
|
+
"tested_agent_version": "2026.9.5",
|
|
335
335
|
"injection_completeness": "builder-assisted",
|
|
336
|
-
"last_verified_at": "2026-09-
|
|
337
|
-
"verified_by": "local pinned-binary probe (openclaw 2026.
|
|
336
|
+
"last_verified_at": "2026-09-21",
|
|
337
|
+
"verified_by": "local pinned-binary probe (openclaw 2026.9.5 on Node 24.16.0, agents/probe-installed.mjs)",
|
|
338
338
|
"fallback": "generic-env",
|
|
339
339
|
"maintainer": null
|
|
340
340
|
},
|
|
@@ -417,10 +417,10 @@ export const PROFILES = [
|
|
|
417
417
|
"attribution": {
|
|
418
418
|
"header": "X-Cave-Agent"
|
|
419
419
|
},
|
|
420
|
-
"tested_agent_version": "1.18.
|
|
420
|
+
"tested_agent_version": "1.18.33",
|
|
421
421
|
"injection_completeness": "declarative",
|
|
422
|
-
"last_verified_at": "2026-09-
|
|
423
|
-
"verified_by": "local pinned-binary probe (opencode 1.18.
|
|
422
|
+
"last_verified_at": "2026-09-28",
|
|
423
|
+
"verified_by": "local pinned-binary probe (opencode 1.18.33, agents/probe-installed.mjs)",
|
|
424
424
|
"fallback": "generic-env",
|
|
425
425
|
"maintainer": null
|
|
426
426
|
},
|
|
@@ -445,10 +445,10 @@ export const PROFILES = [
|
|
|
445
445
|
"command_hook": {
|
|
446
446
|
"method": "pi-extension"
|
|
447
447
|
},
|
|
448
|
-
"tested_agent_version": "0.
|
|
448
|
+
"tested_agent_version": "1.0.0",
|
|
449
449
|
"injection_completeness": "builder-assisted",
|
|
450
|
-
"last_verified_at": "2026-
|
|
451
|
-
"verified_by": "local pinned-binary probe (pi 0.
|
|
450
|
+
"last_verified_at": "2026-10-02",
|
|
451
|
+
"verified_by": "local pinned-binary probe (pi 1.0.0, agents/probe-installed.mjs); packages/pi-extension suite against pi-coding-agent 1.0.0",
|
|
452
452
|
"fallback": "none",
|
|
453
453
|
"maintainer": null
|
|
454
454
|
},
|
|
@@ -464,7 +464,7 @@ export const PROFILES = [
|
|
|
464
464
|
"args": [
|
|
465
465
|
"--extensions=none"
|
|
466
466
|
],
|
|
467
|
-
"install": "npm i -g @qwen-code/qwen-code@0.
|
|
467
|
+
"install": "npm i -g @qwen-code/qwen-code@0.24.6",
|
|
468
468
|
"wire_protocol": "openai-chat",
|
|
469
469
|
"injection": {
|
|
470
470
|
"method": "config-file",
|
|
@@ -710,10 +710,10 @@ export const PROFILES = [
|
|
|
710
710
|
"attribution": {
|
|
711
711
|
"header": "X-Cave-Agent"
|
|
712
712
|
},
|
|
713
|
-
"tested_agent_version": "0.
|
|
713
|
+
"tested_agent_version": "0.24.6",
|
|
714
714
|
"injection_completeness": "declarative",
|
|
715
|
-
"last_verified_at": "2026-
|
|
716
|
-
"verified_by": "local pinned-binary route probe (@qwen-code/qwen-code 0.
|
|
715
|
+
"last_verified_at": "2026-09-26",
|
|
716
|
+
"verified_by": "local pinned-binary route probe (@qwen-code/qwen-code 0.24.6)",
|
|
717
717
|
"fallback": "generic-env",
|
|
718
718
|
"maintainer": null
|
|
719
719
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// Generated by scripts/gen-binaries.mjs. Do not edit.
|
|
2
|
-
export const BINARY_RELEASE = "bin-
|
|
2
|
+
export const BINARY_RELEASE = "bin-v2.0.2";
|
|
3
3
|
export const BINARY_RELEASE_BASE_DEFAULT = "https://github.com/JuliusBrussee/caveman/releases/download";
|
|
4
4
|
export const BINARY_SIGNING_PUBKEY = "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEKR5zq0dz0mTUtkiX0b6jqtyG3uQV\n89PGD2n9UBV1ikbhu0f1c+vHtcN9mk6wKzyBLdEPudI/Jnvci+8OAen/vw==\n-----END PUBLIC KEY-----\n";
|
|
File without changes
|
|
@@ -20,6 +20,11 @@ function publishedUpstreamsOf(raw) {
|
|
|
20
20
|
}
|
|
21
21
|
return out;
|
|
22
22
|
}
|
|
23
|
+
function trimTrailingSlashes(s) {
|
|
24
|
+
let end = s.length;
|
|
25
|
+
while (end > 0 && s.charCodeAt(end - 1) === 47) end--;
|
|
26
|
+
return s.slice(0, end);
|
|
27
|
+
}
|
|
23
28
|
function append(base, path) {
|
|
24
29
|
return base.origin + base.pathname.replace(/\/+$/, "") + path;
|
|
25
30
|
}
|
|
@@ -45,14 +50,14 @@ function verifiedProviderRoute(gateway, api, provider, originalBaseUrl, publishe
|
|
|
45
50
|
if (!upstream2 || family === "gemini") return void 0;
|
|
46
51
|
const suffix = family === "openai" ? "/v1" : "";
|
|
47
52
|
if (compatTarget(upstream2, suffix + operation) !== expected) return void 0;
|
|
48
|
-
return gateway
|
|
53
|
+
return trimTrailingSlashes(gateway) + `/compat/${provider}${suffix}`;
|
|
49
54
|
}
|
|
50
55
|
const upstream = endpoint(published?.provider_upstreams?.[family]);
|
|
51
56
|
if (!upstream) return void 0;
|
|
52
57
|
const versions = family === "gemini" ? ["/v1beta", "/v1"] : [family === "openai" ? "/v1" : ""];
|
|
53
58
|
for (const version of versions) {
|
|
54
59
|
if (append(upstream, version + operation) === expected) {
|
|
55
|
-
return gateway
|
|
60
|
+
return trimTrailingSlashes(gateway) + `/${family}${version}`;
|
|
56
61
|
}
|
|
57
62
|
}
|
|
58
63
|
return void 0;
|
|
@@ -200,6 +205,14 @@ function outputReplacementOf(response) {
|
|
|
200
205
|
const replacement = response?.hookSpecificOutput?.updatedToolOutput ?? response?.output_replacement;
|
|
201
206
|
return replacement ? replacement : void 0;
|
|
202
207
|
}
|
|
208
|
+
function normalizeRecoveryHandle(value) {
|
|
209
|
+
if (!fits(value, MAX_RECOVERY_REF_BYTES)) return void 0;
|
|
210
|
+
let handle = value.trim();
|
|
211
|
+
if (handle.startsWith("<<") && handle.endsWith(">>")) handle = handle.slice(2, -2).trim();
|
|
212
|
+
if (handle.startsWith("ccr://")) handle = handle.slice(6).trim().replace(/^\/+|\/+$/g, "");
|
|
213
|
+
else if (handle.startsWith("ccr:")) handle = handle.slice(4).trim();
|
|
214
|
+
return /^ccr_[A-Za-z0-9_-]+$/.test(handle) ? handle : void 0;
|
|
215
|
+
}
|
|
203
216
|
var ROUTES_BY_API = {
|
|
204
217
|
"anthropic-messages": "/w/pi",
|
|
205
218
|
"openai-completions": "/w/pi/openai/v1",
|
|
@@ -408,6 +421,15 @@ function compatForRoutedModel(model) {
|
|
|
408
421
|
const explicit2 = model.compat;
|
|
409
422
|
return { ...explicit2, sessionAffinityFormat: explicit2?.sessionAffinityFormat ?? (openRouter ? "openrouter" : "openai") };
|
|
410
423
|
}
|
|
424
|
+
if (model.api === "anthropic-messages") {
|
|
425
|
+
if (!openRouter) return model.compat;
|
|
426
|
+
const explicit2 = model.compat;
|
|
427
|
+
return {
|
|
428
|
+
...explicit2,
|
|
429
|
+
sendSessionAffinityHeaders: explicit2?.sendSessionAffinityHeaders ?? true,
|
|
430
|
+
sessionAffinityFormat: explicit2?.sessionAffinityFormat ?? "openrouter"
|
|
431
|
+
};
|
|
432
|
+
}
|
|
411
433
|
if (model.api !== "openai-completions") return model.compat;
|
|
412
434
|
const explicit = model.compat;
|
|
413
435
|
const zai = provider === "zai" || provider === "zai-coding-cn" || url.includes("api.z.ai") || url.includes("open.bigmodel.cn");
|
|
@@ -430,7 +452,7 @@ function compatForRoutedModel(model) {
|
|
|
430
452
|
maxTokensField: explicit?.maxTokensField ?? (maxTokens ? "max_tokens" : "max_completion_tokens"),
|
|
431
453
|
requiresReasoningContentOnAssistantMessages: explicit?.requiresReasoningContentOnAssistantMessages ?? deepseek,
|
|
432
454
|
thinkingFormat: explicit?.thinkingFormat ?? (deepseek ? "deepseek" : zai ? "zai" : together ? "together" : antLing ? "ant-ling" : openRouter ? "openrouter" : "openai"),
|
|
433
|
-
|
|
455
|
+
sendSessionAffinityHeaders: explicit?.sendSessionAffinityHeaders ?? openRouter,
|
|
434
456
|
sessionAffinityFormat: explicit?.sessionAffinityFormat ?? (openRouter ? "openrouter" : "openai"),
|
|
435
457
|
supportsLongCacheRetention: explicit?.supportsLongCacheRetention ?? !(together || cloudflareWorkers || cloudflareGateway || nvidia || antLing)
|
|
436
458
|
};
|
|
@@ -593,12 +615,14 @@ var ProviderRouter = class {
|
|
|
593
615
|
|
|
594
616
|
// ../pi-extension/src/recovery.ts
|
|
595
617
|
import { execFile as execFile2, spawn } from "node:child_process";
|
|
618
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
596
619
|
import { existsSync as existsSync2 } from "node:fs";
|
|
597
620
|
import { homedir as homedir2 } from "node:os";
|
|
598
621
|
import { delimiter, join as join3 } from "node:path";
|
|
599
622
|
var PROBE_TIMEOUT_MS = 2e3;
|
|
600
623
|
var CALL_TIMEOUT_MS = 3e4;
|
|
601
624
|
var INIT_TIMEOUT_MS = 2e3;
|
|
625
|
+
var VERIFY_TIMEOUT_MS = 2e3;
|
|
602
626
|
function resolveMcpBinary(env = process.env) {
|
|
603
627
|
const explicit = env.CAVEMAN_MCP_BIN?.trim();
|
|
604
628
|
if (explicit) return explicit;
|
|
@@ -614,6 +638,7 @@ var RecoveryClient = class {
|
|
|
614
638
|
child;
|
|
615
639
|
initialized = false;
|
|
616
640
|
probed;
|
|
641
|
+
verificationSupported = false;
|
|
617
642
|
ensuring;
|
|
618
643
|
nextId = 1;
|
|
619
644
|
pending = /* @__PURE__ */ new Map();
|
|
@@ -657,6 +682,28 @@ var RecoveryClient = class {
|
|
|
657
682
|
return { text: JSON.stringify({ error: "cave_recovery_transport", message: error.message }), isError: true };
|
|
658
683
|
}
|
|
659
684
|
}
|
|
685
|
+
// A silent pre-publication proof must not count as delivery to the model.
|
|
686
|
+
// Old companions ignore unknown arguments, so capability proof is mandatory
|
|
687
|
+
// before sending verify_only through the same long-lived recovery child.
|
|
688
|
+
async verify(handle, originalText) {
|
|
689
|
+
const normalized = normalizeRecoveryHandle(handle);
|
|
690
|
+
const bytes = Buffer.byteLength(originalText, "utf8");
|
|
691
|
+
if (!normalized || bytes > MAX_TOOL_OUTPUT_BYTES) return false;
|
|
692
|
+
try {
|
|
693
|
+
if (!await this.ensure() || !this.verificationSupported) return false;
|
|
694
|
+
const result = await this.call("tools/call", {
|
|
695
|
+
name: "caveman_retrieve",
|
|
696
|
+
arguments: { recovery_handle: normalized, verify_only: true }
|
|
697
|
+
}, void 0, VERIFY_TIMEOUT_MS);
|
|
698
|
+
if (result.isError || !Array.isArray(result.content) || result.content.length !== 1) return false;
|
|
699
|
+
const block = result.content[0];
|
|
700
|
+
if (block?.type !== "text" || typeof block.text !== "string" || Buffer.byteLength(block.text, "utf8") > MAX_MESSAGE_BYTES) return false;
|
|
701
|
+
const proof = JSON.parse(block.text);
|
|
702
|
+
return proof?.recovery_handle === normalized && proof.byte_length === bytes && proof.sha256 === createHash2("sha256").update(originalText, "utf8").digest("hex");
|
|
703
|
+
} catch {
|
|
704
|
+
return false;
|
|
705
|
+
}
|
|
706
|
+
}
|
|
660
707
|
dispose() {
|
|
661
708
|
this.disposed = true;
|
|
662
709
|
const child = this.child;
|
|
@@ -694,6 +741,7 @@ var RecoveryClient = class {
|
|
|
694
741
|
if (error) return resolve2(false);
|
|
695
742
|
try {
|
|
696
743
|
const parsed = JSON.parse(stdout);
|
|
744
|
+
this.verificationSupported = Array.isArray(parsed?.capabilities) && parsed.capabilities.includes("recovery_verification");
|
|
697
745
|
resolve2(Array.isArray(parsed?.capabilities) && parsed.capabilities.includes("mcp_recovery"));
|
|
698
746
|
} catch {
|
|
699
747
|
resolve2(false);
|
|
@@ -722,7 +770,7 @@ var RecoveryClient = class {
|
|
|
722
770
|
await this.call("initialize", {
|
|
723
771
|
protocolVersion: "2024-11-05",
|
|
724
772
|
capabilities: {},
|
|
725
|
-
clientInfo: { name: "caveman-pi-extension", version: "0.
|
|
773
|
+
clientInfo: { name: "caveman-pi-extension", version: "0.2.0" }
|
|
726
774
|
}, void 0, INIT_TIMEOUT_MS);
|
|
727
775
|
this.notify("notifications/initialized");
|
|
728
776
|
if (this.disposed) {
|
|
@@ -840,18 +888,35 @@ var RecoveryClient = class {
|
|
|
840
888
|
};
|
|
841
889
|
|
|
842
890
|
// ../pi-extension/src/tool-output.ts
|
|
843
|
-
async function shrinkToolResult(bridge, sessionId, event) {
|
|
891
|
+
async function shrinkToolResult(bridge, sessionId, event, recovery) {
|
|
844
892
|
const text = event.content.map((block) => block.type === "text" && typeof block.text === "string" ? block.text : "").join("");
|
|
845
893
|
if (!text) return void 0;
|
|
846
894
|
if (Buffer.byteLength(text, "utf8") > MAX_TOOL_OUTPUT_BYTES) return void 0;
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
895
|
+
let replacement;
|
|
896
|
+
try {
|
|
897
|
+
const response = await bridge.call(event.isError ? "PostToolUseFailure" : "PostToolUse", {
|
|
898
|
+
session_id: sessionId,
|
|
899
|
+
tool_name: event.toolName,
|
|
900
|
+
tool_input: event.input,
|
|
901
|
+
tool_output: text
|
|
902
|
+
});
|
|
903
|
+
const proposed = outputReplacementOf(response);
|
|
904
|
+
if (!proposed || Buffer.byteLength(proposed, "utf8") > MAX_OUTPUT_REPLACEMENT_BYTES) return void 0;
|
|
905
|
+
let handle = normalizeRecoveryHandle(response?.recovery_ref);
|
|
906
|
+
if (response?.recovery_ref !== void 0 && !handle) return void 0;
|
|
907
|
+
let advertised = false;
|
|
908
|
+
for (const match of proposed.matchAll(/(?:<<)?ccr(?::|_)[^\s"'`]*/g)) {
|
|
909
|
+
if (match.index > 0 && /[A-Za-z0-9_<:/]/.test(proposed[match.index - 1])) return void 0;
|
|
910
|
+
const candidate = normalizeRecoveryHandle(match[0]);
|
|
911
|
+
if (!candidate || handle && candidate !== handle) return void 0;
|
|
912
|
+
handle = candidate;
|
|
913
|
+
advertised = true;
|
|
914
|
+
}
|
|
915
|
+
if (!advertised || !handle || !await recovery.verify(handle, text)) return void 0;
|
|
916
|
+
replacement = proposed;
|
|
917
|
+
} catch {
|
|
918
|
+
return void 0;
|
|
919
|
+
}
|
|
855
920
|
return { content: [{ type: "text", text: replacement }, ...event.content.filter((block) => block.type !== "text")] };
|
|
856
921
|
}
|
|
857
922
|
|
|
@@ -1048,7 +1113,7 @@ function index_default(pi) {
|
|
|
1048
1113
|
pendingBytes += bytes;
|
|
1049
1114
|
}
|
|
1050
1115
|
}));
|
|
1051
|
-
pi.on("tool_result", GUARD_tool_result((event) => event.toolName === RECOVERY_TOOL ? void 0 : shrinkToolResult(bridge, sessionId, event)));
|
|
1116
|
+
pi.on("tool_result", GUARD_tool_result((event) => event.toolName === RECOVERY_TOOL ? void 0 : shrinkToolResult(bridge, sessionId, event, recovery)));
|
|
1052
1117
|
pi.on("session_before_compact", GUARD_session_before_compact(() => {
|
|
1053
1118
|
void bridge.call("PreCompact", { session_id: sessionId });
|
|
1054
1119
|
}));
|