token-goat 2.9.29 → 2.9.30
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/README.md +34 -40
- package/SECURITY.md +28 -10
- package/THIRD_PARTY_NOTICES.md +40 -3
- package/dist/native/linux-arm64/tg-hook +0 -0
- package/dist/native/linux-x64/tg-hook +0 -0
- package/dist/ort-wasm-simd-threaded.mjs +59 -0
- package/dist/token-goat-chunk-3CHUNJ2O.mjs +53 -0
- package/dist/token-goat-chunk-3Z5S4KGM.mjs +918 -0
- package/dist/token-goat-chunk-4FVIAHSI.mjs +211 -0
- package/dist/{token-goat-chunk-PGTH2U4C.mjs → token-goat-chunk-4JJS54TR.mjs} +4 -3
- package/dist/token-goat-chunk-4LCCNRTG.mjs +313 -0
- package/dist/{token-goat-chunk-L7H3U27L.mjs → token-goat-chunk-54K3EUV3.mjs} +1 -1
- package/dist/token-goat-chunk-56EIMS3E.mjs +159 -0
- package/dist/token-goat-chunk-5BCIJXMO.mjs +609 -0
- package/dist/token-goat-chunk-5KDMCMF2.mjs +362 -0
- package/dist/token-goat-chunk-5RG5SBL6.mjs +221 -0
- package/dist/{token-goat-chunk-RRNZMM3A.mjs → token-goat-chunk-5Y6ZYL6U.mjs} +21 -2
- package/dist/{token-goat-chunk-GLXRTTLE.mjs → token-goat-chunk-64FBPDTK.mjs} +12 -8
- package/dist/{token-goat-chunk-G23DWHV4.mjs → token-goat-chunk-664RTTUV.mjs} +28 -15
- package/dist/token-goat-chunk-67TQJ76B.mjs +57 -0
- package/dist/token-goat-chunk-6QMAS7AB.mjs +42 -0
- package/dist/token-goat-chunk-7BXSNBY5.mjs +253 -0
- package/dist/{token-goat-chunk-IVWI2OCK.mjs → token-goat-chunk-7F2UBPD3.mjs} +40 -11
- package/dist/{token-goat-chunk-TGOXNAHW.mjs → token-goat-chunk-7IN2MKDS.mjs} +682 -501
- package/dist/token-goat-chunk-7NADEDKJ.mjs +124 -0
- package/dist/{token-goat-chunk-KOPIR3KZ.mjs → token-goat-chunk-A3CK6N5Z.mjs} +618 -72
- package/dist/{token-goat-chunk-O6I2XU4P.mjs → token-goat-chunk-AFLYLHDH.mjs} +44 -31
- package/dist/{token-goat-chunk-TCQANXYC.mjs → token-goat-chunk-AM5V6GSX.mjs} +18 -2
- package/dist/{token-goat-chunk-E4ZOJIZK.mjs → token-goat-chunk-APGZXSPS.mjs} +39 -146
- package/dist/{token-goat-chunk-D4ETHJD6.mjs → token-goat-chunk-ARDNEC2U.mjs} +9 -7
- package/dist/token-goat-chunk-ATCPY7EQ.mjs +134 -0
- package/dist/token-goat-chunk-B2RZZCSS.mjs +354 -0
- package/dist/{token-goat-chunk-BGYOZ6DO.mjs → token-goat-chunk-B45VMIIH.mjs} +6 -7
- package/dist/token-goat-chunk-BPGCUMR7.mjs +30 -0
- package/dist/{token-goat-chunk-TDUT2CL6.mjs → token-goat-chunk-C63JQV5K.mjs} +45 -6
- package/dist/{token-goat-chunk-ZER6EAXZ.mjs → token-goat-chunk-COBQGL5S.mjs} +2661 -2440
- package/dist/token-goat-chunk-COTXZHTS.mjs +39 -0
- package/dist/{token-goat-chunk-RQGGMPCR.mjs → token-goat-chunk-CYCEYAEO.mjs} +76 -16
- package/dist/token-goat-chunk-CZ3LUXYZ.mjs +4115 -0
- package/dist/{token-goat-chunk-ASLWOQ3I.mjs → token-goat-chunk-DZX2YDPT.mjs} +2 -1
- package/dist/token-goat-chunk-E3OQX2XT.mjs +824 -0
- package/dist/token-goat-chunk-EFHMMIGP.mjs +68 -0
- package/dist/token-goat-chunk-ETBHVDB6.mjs +328 -0
- package/dist/token-goat-chunk-EVMZJ27Z.mjs +147 -0
- package/dist/token-goat-chunk-EXKGNHEG.mjs +2096 -0
- package/dist/{token-goat-chunk-RTMVLHWX.mjs → token-goat-chunk-FBNQNSJK.mjs} +2555 -5127
- package/dist/{token-goat-chunk-NMTKNYGF.mjs → token-goat-chunk-FNFBKLRD.mjs} +74 -9
- package/dist/{token-goat-chunk-RLP6J7WR.mjs → token-goat-chunk-FZ3NEW5O.mjs} +33 -19
- package/dist/token-goat-chunk-G5PJ7AGM.mjs +36 -0
- package/dist/{token-goat-chunk-DNRPXHYH.mjs → token-goat-chunk-GFBSN7BD.mjs} +29 -401
- package/dist/{token-goat-chunk-XYWPOSCN.mjs → token-goat-chunk-GOLEOXZP.mjs} +763 -211
- package/dist/token-goat-chunk-H2K3QP6H.mjs +24 -0
- package/dist/token-goat-chunk-H2PHHGM5.mjs +188 -0
- package/dist/token-goat-chunk-HAVAOB3S.mjs +87 -0
- package/dist/token-goat-chunk-HG45AF2B.mjs +2228 -0
- package/dist/{token-goat-chunk-HUYUHODZ.mjs → token-goat-chunk-HOJLCGDP.mjs} +12965 -11748
- package/dist/{token-goat-chunk-435UQTKD.mjs → token-goat-chunk-HYBFA5X3.mjs} +118 -19
- package/dist/token-goat-chunk-IVALLT3S.mjs +48 -0
- package/dist/{token-goat-chunk-UXSXQQIY.mjs → token-goat-chunk-IVKIZWAB.mjs} +3 -3
- package/dist/{token-goat-chunk-52NSDWYY.mjs → token-goat-chunk-JB6QN6VF.mjs} +6 -4
- package/dist/{token-goat-chunk-HNFZZHFW.mjs → token-goat-chunk-JDHE26RP.mjs} +10 -3
- package/dist/{token-goat-chunk-FTP4U4QA.mjs → token-goat-chunk-JDU3EXSU.mjs} +12 -11
- package/dist/token-goat-chunk-JDWCRD6M.mjs +253 -0
- package/dist/{token-goat-chunk-6AK46ZT7.mjs → token-goat-chunk-JN4XMLSD.mjs} +5 -1
- package/dist/token-goat-chunk-JTQQGXZH.mjs +733 -0
- package/dist/token-goat-chunk-KKUFXAPD.mjs +25 -0
- package/dist/token-goat-chunk-KQNZDCBD.mjs +47 -0
- package/dist/{token-goat-chunk-2WOUYWLM.mjs → token-goat-chunk-KWPNJBDH.mjs} +27 -3
- package/dist/{token-goat-chunk-DPNLUJWB.mjs → token-goat-chunk-LOBGHXPB.mjs} +30 -8
- package/dist/token-goat-chunk-MKPF4CL5.mjs +37 -0
- package/dist/token-goat-chunk-MNWKPRAL.mjs +13 -0
- package/dist/{token-goat-chunk-DNSPXQXQ.mjs → token-goat-chunk-N2NMER56.mjs} +25 -15
- package/dist/token-goat-chunk-NYKZLXMK.mjs +218 -0
- package/dist/token-goat-chunk-OJBNYTJP.mjs +3087 -0
- package/dist/token-goat-chunk-P4QMM4WK.mjs +295 -0
- package/dist/token-goat-chunk-PD5VKH46.mjs +184 -0
- package/dist/token-goat-chunk-PEPTHRFF.mjs +129 -0
- package/dist/{token-goat-chunk-NMBWLRHW.mjs → token-goat-chunk-PU7V3FD6.mjs} +8721 -11104
- package/dist/token-goat-chunk-PY533T7F.mjs +46 -0
- package/dist/token-goat-chunk-Q5VTGRH7.mjs +761 -0
- package/dist/{token-goat-chunk-67BNIKKO.mjs → token-goat-chunk-QCLDAQTS.mjs} +31 -20
- package/dist/{token-goat-chunk-SE6E4BKJ.mjs → token-goat-chunk-QSBRTGM2.mjs} +9 -2
- package/dist/{token-goat-chunk-VZQEWRVH.mjs → token-goat-chunk-RC35RBUL.mjs} +4 -4
- package/dist/{token-goat-chunk-VMFWNHGR.mjs → token-goat-chunk-RHXKCZX3.mjs} +873 -504
- package/dist/{token-goat-chunk-PYSUADX4.mjs → token-goat-chunk-RZRTDST7.mjs} +17 -7
- package/dist/{token-goat-chunk-ONXH6NZ5.mjs → token-goat-chunk-SJHWVNDQ.mjs} +15 -21
- package/dist/token-goat-chunk-SMVRN2HU.mjs +188 -0
- package/dist/{token-goat-chunk-QO3LXVVR.mjs → token-goat-chunk-SQSSNQPE.mjs} +2295 -1718
- package/dist/{token-goat-chunk-2AWQ2R5X.mjs → token-goat-chunk-T4FK7VOV.mjs} +2 -2
- package/dist/token-goat-chunk-U4N3BN2W.mjs +92 -0
- package/dist/token-goat-chunk-UA5V6P3P.mjs +122 -0
- package/dist/{token-goat-chunk-UA5BKWWQ.mjs → token-goat-chunk-UQ5UK2T7.mjs} +15 -4
- package/dist/token-goat-chunk-USILZ3T3.mjs +53 -0
- package/dist/{token-goat-chunk-MELOKFDJ.mjs → token-goat-chunk-VES7EL7O.mjs} +7 -1
- package/dist/{token-goat-chunk-7CPMDFGB.mjs → token-goat-chunk-VL3YIFHZ.mjs} +389 -14
- package/dist/{token-goat-chunk-E5TK5DNO.mjs → token-goat-chunk-VPBBTSJR.mjs} +356 -129
- package/dist/{token-goat-chunk-YOOVFPTP.mjs → token-goat-chunk-W3QCJS6G.mjs} +10 -2
- package/dist/{token-goat-chunk-LZNBQTDK.mjs → token-goat-chunk-WY3L4DVT.mjs} +11 -7
- package/dist/token-goat-chunk-XKI4SEMX.mjs +66 -0
- package/dist/token-goat-chunk-XU4P6Z24.mjs +133 -0
- package/dist/{token-goat-chunk-H5J3C56Q.mjs → token-goat-chunk-Y776AENC.mjs} +112 -26
- package/dist/token-goat-chunk-YARZFCZS.mjs +359 -0
- package/dist/{token-goat-chunk-S4VSXURL.mjs → token-goat-chunk-Z44YO3QZ.mjs} +4 -0
- package/dist/token-goat-chunk-Z57YODA2.mjs +35 -0
- package/dist/{token-goat-chunk-PQ53BSCF.mjs → token-goat-chunk-ZCDTCVIS.mjs} +48 -29
- package/dist/token-goat-chunk-ZEJVMUQH.mjs +48 -0
- package/dist/{token-goat-chunk-BGHSSJUA.mjs → token-goat-chunk-ZFOBKUWH.mjs} +1 -1
- package/dist/token-goat-chunk-ZMBL6UVV.mjs +110 -0
- package/dist/{token-goat-chunk-PKRWMHVP.mjs → token-goat-chunk-ZQSJMO2R.mjs} +338 -170
- package/dist/token-goat-hook-client.cjs +87 -23
- package/dist/token-goat-hook-client.mjs +3 -3
- package/dist/token-goat-hook.mjs +46 -30
- package/dist/token-goat.core.mjs +6 -6
- package/docs/C4_RUNTIME_ARCHITECTURE.md +1 -1
- package/docs/cli.md +80 -46
- package/docs/install.md +47 -14
- package/docs/security.md +7 -7
- package/package.json +17 -7
- package/scripts/verify-native-dist.mjs +386 -0
- package/dist/token-goat-chunk-2NNUA2LR.mjs +0 -143
- package/dist/token-goat-chunk-44BM7DDQ.mjs +0 -294
- package/dist/token-goat-chunk-C5YPNZKQ.mjs +0 -318
- package/dist/token-goat-chunk-CIQ2FTY3.mjs +0 -1990
- package/dist/token-goat-chunk-EUSDXRXU.mjs +0 -1429
- package/dist/token-goat-chunk-G7IWXCFF.mjs +0 -456
- package/dist/token-goat-chunk-JTKCQMQA.mjs +0 -418
- package/dist/token-goat-chunk-ORNFMIER.mjs +0 -295
- package/dist/token-goat-chunk-VQ6F6T7X.mjs +0 -36
- package/dist/token-goat-chunk-YAGLESS3.mjs +0 -23
- package/dist/token-goat-chunk-YKSRAWUU.mjs +0 -33
- package/dist/token-goat-chunk-Z6KBMOBI.mjs +0 -53
|
@@ -6,16 +6,20 @@ import {
|
|
|
6
6
|
pptxOutline,
|
|
7
7
|
pptxSlideText,
|
|
8
8
|
pptxTextGrep
|
|
9
|
-
} from "./token-goat-chunk-
|
|
10
|
-
import "./token-goat-chunk-
|
|
9
|
+
} from "./token-goat-chunk-JDHE26RP.mjs";
|
|
10
|
+
import "./token-goat-chunk-4FVIAHSI.mjs";
|
|
11
|
+
import "./token-goat-chunk-7IN2MKDS.mjs";
|
|
12
|
+
import "./token-goat-chunk-U4N3BN2W.mjs";
|
|
13
|
+
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
14
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
15
|
+
import "./token-goat-chunk-IVKIZWAB.mjs";
|
|
11
16
|
import "./token-goat-chunk-XTQAOTSO.mjs";
|
|
12
17
|
import "./token-goat-chunk-AH6QILZM.mjs";
|
|
13
|
-
import "./token-goat-chunk-XYWPOSCN.mjs";
|
|
14
|
-
import "./token-goat-chunk-TCQANXYC.mjs";
|
|
15
|
-
import "./token-goat-chunk-NMTKNYGF.mjs";
|
|
16
|
-
import "./token-goat-chunk-MELOKFDJ.mjs";
|
|
17
18
|
import "./token-goat-chunk-Y4AFKTHK.mjs";
|
|
18
|
-
import "./token-goat-chunk-
|
|
19
|
+
import "./token-goat-chunk-GOLEOXZP.mjs";
|
|
20
|
+
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
21
|
+
import "./token-goat-chunk-FNFBKLRD.mjs";
|
|
22
|
+
import "./token-goat-chunk-VES7EL7O.mjs";
|
|
19
23
|
import "./token-goat-chunk-A37V4PBF.mjs";
|
|
20
24
|
export {
|
|
21
25
|
pptxAllSlidesText,
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
init_define_import_meta_env
|
|
5
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
6
|
+
|
|
7
|
+
// src/jsonc_text.ts
|
|
8
|
+
init_define_import_meta_env();
|
|
9
|
+
import { createRequire } from "node:module";
|
|
10
|
+
var jsoncParser;
|
|
11
|
+
function jsonc() {
|
|
12
|
+
jsoncParser ??= createRequire(import.meta.url)("jsonc-parser");
|
|
13
|
+
return jsoncParser;
|
|
14
|
+
}
|
|
15
|
+
var CLOSE_BRACE = 2;
|
|
16
|
+
var CLOSE_BRACKET = 4;
|
|
17
|
+
var COMMA = 5;
|
|
18
|
+
var LINE_COMMENT = 12;
|
|
19
|
+
var BLOCK_COMMENT = 13;
|
|
20
|
+
var LINE_BREAK = 14;
|
|
21
|
+
var WHITESPACE = 15;
|
|
22
|
+
var EOF = 17;
|
|
23
|
+
function jsoncToJson(text) {
|
|
24
|
+
const scanner = jsonc().createScanner(text, false);
|
|
25
|
+
const out = [];
|
|
26
|
+
let heldComma = false;
|
|
27
|
+
let heldTrivia = [];
|
|
28
|
+
for (let kind = scanner.scan(); kind !== EOF; kind = scanner.scan()) {
|
|
29
|
+
if (kind === LINE_COMMENT || kind === BLOCK_COMMENT) continue;
|
|
30
|
+
const raw = text.slice(scanner.getTokenOffset(), scanner.getTokenOffset() + scanner.getTokenLength());
|
|
31
|
+
if (heldComma) {
|
|
32
|
+
if (kind === LINE_BREAK || kind === WHITESPACE) {
|
|
33
|
+
heldTrivia.push(raw);
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (kind !== CLOSE_BRACE && kind !== CLOSE_BRACKET) out.push(",");
|
|
37
|
+
out.push(...heldTrivia);
|
|
38
|
+
heldComma = false;
|
|
39
|
+
heldTrivia = [];
|
|
40
|
+
}
|
|
41
|
+
if (kind === COMMA) heldComma = true;
|
|
42
|
+
else out.push(raw);
|
|
43
|
+
}
|
|
44
|
+
if (heldComma) out.push(",", ...heldTrivia);
|
|
45
|
+
return out.join("");
|
|
46
|
+
}
|
|
47
|
+
function stripBom(text) {
|
|
48
|
+
return text.charCodeAt(0) === 65279 ? text.slice(1) : text;
|
|
49
|
+
}
|
|
50
|
+
function parseJsonOrJsonc(raw, opts = {}) {
|
|
51
|
+
const text = stripBom(raw);
|
|
52
|
+
try {
|
|
53
|
+
return JSON.parse(text);
|
|
54
|
+
} catch (strictError) {
|
|
55
|
+
const errors = [];
|
|
56
|
+
jsonc().parse(text, errors, { allowTrailingComma: opts.allowTrailingComma !== false, disallowComments: false, allowEmptyContent: false });
|
|
57
|
+
if (errors.length > 0) throw strictError;
|
|
58
|
+
return JSON.parse(jsoncToJson(text));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export {
|
|
63
|
+
jsonc,
|
|
64
|
+
stripBom,
|
|
65
|
+
parseJsonOrJsonc
|
|
66
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
BRIDGE_CAPABILITY_MATRIX
|
|
5
|
+
} from "./token-goat-chunk-ETBHVDB6.mjs";
|
|
6
|
+
import {
|
|
7
|
+
PROBE_EVENT_TAGS,
|
|
8
|
+
PROBE_NONCE_ENV,
|
|
9
|
+
probeDir
|
|
10
|
+
} from "./token-goat-chunk-ZEJVMUQH.mjs";
|
|
11
|
+
import "./token-goat-chunk-KKUFXAPD.mjs";
|
|
12
|
+
import {
|
|
13
|
+
HOOK_PROBE_ENV
|
|
14
|
+
} from "./token-goat-chunk-3Z5S4KGM.mjs";
|
|
15
|
+
import "./token-goat-chunk-VL3YIFHZ.mjs";
|
|
16
|
+
import "./token-goat-chunk-XB5KKOCG.mjs";
|
|
17
|
+
import "./token-goat-chunk-U4N3BN2W.mjs";
|
|
18
|
+
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
19
|
+
import "./token-goat-chunk-GOLEOXZP.mjs";
|
|
20
|
+
import {
|
|
21
|
+
resolveOnPath,
|
|
22
|
+
spawnResolvedSync
|
|
23
|
+
} from "./token-goat-chunk-AM5V6GSX.mjs";
|
|
24
|
+
import {
|
|
25
|
+
displaySafeText
|
|
26
|
+
} from "./token-goat-chunk-FNFBKLRD.mjs";
|
|
27
|
+
import "./token-goat-chunk-VES7EL7O.mjs";
|
|
28
|
+
import {
|
|
29
|
+
init_define_import_meta_env
|
|
30
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
31
|
+
|
|
32
|
+
// src/doctor_probe.ts
|
|
33
|
+
init_define_import_meta_env();
|
|
34
|
+
import { randomBytes } from "node:crypto";
|
|
35
|
+
import { readdirSync, rmSync } from "node:fs";
|
|
36
|
+
import path from "node:path";
|
|
37
|
+
var PROBE_PROMPT = "Reply with every line of your context that begins with token-goat probe marker, copied exactly, one per line. If there are none, reply NONE.";
|
|
38
|
+
var PROBE_COMMANDS = {
|
|
39
|
+
claudecode: { bin: "claude", args: ["-p", PROBE_PROMPT] },
|
|
40
|
+
codex: { bin: "codex", args: ["exec", PROBE_PROMPT] },
|
|
41
|
+
copilot_cli: { bin: "copilot", args: ["-p", PROBE_PROMPT] }
|
|
42
|
+
};
|
|
43
|
+
function isProbeHarness(name) {
|
|
44
|
+
return Object.prototype.hasOwnProperty.call(PROBE_COMMANDS, name);
|
|
45
|
+
}
|
|
46
|
+
var MISLEADING_ENV = ["TOKEN_GOAT_HARNESS_OVERRIDE", "CLAUDE_CODE_SESSION_ID", "CLAUDE_CODE_VERSION", "CLAUDE_CODE_ENTRYPOINT", "CLAUDECODE", "CODEX_SESSION_ID", "CODEX_SESSION"];
|
|
47
|
+
var PROBE_TIMEOUT_MS = 24e4;
|
|
48
|
+
function classifyProbeEvent(opts) {
|
|
49
|
+
if (!opts.wired) return "not_wired";
|
|
50
|
+
if (opts.stdout.includes(`${opts.nonce}-${opts.tag}`)) return "reached";
|
|
51
|
+
return opts.receipts.has(opts.tag) ? "fired_not_delivered" : "not_fired";
|
|
52
|
+
}
|
|
53
|
+
function probeEnv(nonce, env = process.env) {
|
|
54
|
+
const child = { ...env };
|
|
55
|
+
for (const key of MISLEADING_ENV) delete child[key];
|
|
56
|
+
if (child["TERM_PROGRAM"] === "claude-code") delete child["TERM_PROGRAM"];
|
|
57
|
+
child[PROBE_NONCE_ENV] = nonce;
|
|
58
|
+
child[HOOK_PROBE_ENV] = "1";
|
|
59
|
+
return child;
|
|
60
|
+
}
|
|
61
|
+
function receiptTags(nonce) {
|
|
62
|
+
const tags = /* @__PURE__ */ new Set();
|
|
63
|
+
try {
|
|
64
|
+
for (const name of readdirSync(probeDir())) {
|
|
65
|
+
if (name.startsWith(`${nonce}.`)) tags.add(name.slice(nonce.length + 1));
|
|
66
|
+
}
|
|
67
|
+
} catch {
|
|
68
|
+
}
|
|
69
|
+
return tags;
|
|
70
|
+
}
|
|
71
|
+
function removeReceipts(nonce) {
|
|
72
|
+
for (const tag of receiptTags(nonce)) rmSync(path.join(probeDir(), `${nonce}.${tag}`), { force: true });
|
|
73
|
+
}
|
|
74
|
+
function tail(text) {
|
|
75
|
+
return text.trim().split(/\r?\n/).slice(-5).join("\n");
|
|
76
|
+
}
|
|
77
|
+
function runProbe(harness, opts = {}) {
|
|
78
|
+
const spec = PROBE_COMMANDS[harness];
|
|
79
|
+
if (spec === void 0) throw new Error(`no headless probe for ${harness}; supported: ${Object.keys(PROBE_COMMANDS).join(", ")}`);
|
|
80
|
+
const command = `${spec.bin} ${spec.args[0] ?? ""} "<probe prompt>"`;
|
|
81
|
+
const implemented = BRIDGE_CAPABILITY_MATRIX.find((r) => r.harness === harness)?.implemented ?? /* @__PURE__ */ new Set();
|
|
82
|
+
const probed = Object.keys(PROBE_EVENT_TAGS);
|
|
83
|
+
const resolved = (opts.resolve ?? resolveOnPath)(spec.bin);
|
|
84
|
+
if (resolved === null) {
|
|
85
|
+
return { harness, command, status: "not_installed", exitCode: null, events: probed.map((event) => ({ event, result: implemented.has(event) ? "not_fired" : "not_wired" })) };
|
|
86
|
+
}
|
|
87
|
+
const nonce = randomBytes(10).toString("hex");
|
|
88
|
+
try {
|
|
89
|
+
const run = spawnResolvedSync(resolved, spec.args, { cwd: opts.cwd ?? process.cwd(), env: probeEnv(nonce), encoding: "utf8", timeout: opts.timeoutMs ?? PROBE_TIMEOUT_MS, windowsHide: true, stdio: ["ignore", "pipe", "pipe"] });
|
|
90
|
+
const stdout = run.stdout ?? "";
|
|
91
|
+
const receipts = receiptTags(nonce);
|
|
92
|
+
const events = probed.map((event) => ({ event, result: classifyProbeEvent({ wired: implemented.has(event), nonce, tag: PROBE_EVENT_TAGS[event] ?? "", stdout, receipts }) }));
|
|
93
|
+
const timedOut = run.error?.code === "ETIMEDOUT";
|
|
94
|
+
const status = timedOut ? "timeout" : run.status === 0 ? "ok" : "failed";
|
|
95
|
+
const report = { harness, command, status, exitCode: run.status, events };
|
|
96
|
+
return status === "ok" ? report : { ...report, detail: tail(run.stderr ?? run.error?.message ?? "") };
|
|
97
|
+
} finally {
|
|
98
|
+
removeReceipts(nonce);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
var RESULT_TEXT = {
|
|
102
|
+
reached: "reached the model",
|
|
103
|
+
fired_not_delivered: "hook ran, but the model never saw its output",
|
|
104
|
+
not_fired: "hook did not run",
|
|
105
|
+
not_wired: "not wired for this harness"
|
|
106
|
+
};
|
|
107
|
+
function probePassed(report) {
|
|
108
|
+
return report.status === "ok" && report.events.every((e) => e.result === "reached" || e.result === "not_wired");
|
|
109
|
+
}
|
|
110
|
+
function formatProbeReport(report) {
|
|
111
|
+
const lines = [`Probe: ${report.command} (one real prompt on your account)`];
|
|
112
|
+
if (report.status === "not_installed") lines.push(` [FAIL] ${PROBE_COMMANDS[report.harness]?.bin ?? report.harness} is not on PATH`);
|
|
113
|
+
else if (report.status === "timeout") lines.push(" [FAIL] the harness did not finish in time");
|
|
114
|
+
else if (report.status === "failed") lines.push(` [FAIL] the harness exited with code ${report.exitCode ?? "unknown"}`);
|
|
115
|
+
if (report.status !== "not_installed") {
|
|
116
|
+
for (const e of report.events) {
|
|
117
|
+
const mark = e.result === "reached" ? "[OK] " : e.result === "not_wired" ? "[--] " : "[FAIL]";
|
|
118
|
+
lines.push(` ${mark} ${e.event.padEnd(19)} ${RESULT_TEXT[e.result]}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (report.detail !== void 0 && report.detail !== "") lines.push(...displaySafeText(report.detail).split("\n").map((l) => ` ${l}`));
|
|
122
|
+
return lines.join("\n");
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
PROBE_COMMANDS,
|
|
126
|
+
PROBE_PROMPT,
|
|
127
|
+
classifyProbeEvent,
|
|
128
|
+
formatProbeReport,
|
|
129
|
+
isProbeHarness,
|
|
130
|
+
probeEnv,
|
|
131
|
+
probePassed,
|
|
132
|
+
runProbe
|
|
133
|
+
};
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
2
|
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
readTranscriptTail
|
|
5
|
+
} from "./token-goat-chunk-SJHWVNDQ.mjs";
|
|
6
|
+
import {
|
|
7
|
+
claudeConfigDir
|
|
8
|
+
} from "./token-goat-chunk-BPGCUMR7.mjs";
|
|
3
9
|
import {
|
|
4
10
|
GENERIC_SERVED_OUTPUT_KEY,
|
|
11
|
+
MAX_BASH_START_CWDS,
|
|
5
12
|
MAX_GENERIC_SERVED_OUTPUTS,
|
|
6
13
|
MAX_OUTSTANDING_AGENT_SPAWNS,
|
|
7
14
|
MAX_RANGES_PER_FILE,
|
|
8
15
|
MAX_SEEN_IMAGE_HASHES,
|
|
9
16
|
MAX_SERVED_OUTPUTS_PER_FILE,
|
|
17
|
+
bashStartCwdsAtLoad,
|
|
18
|
+
consumedBashStartCwdKeys,
|
|
10
19
|
consumedCurlDownloadKeys,
|
|
11
20
|
consumedFileLineRangeKeys,
|
|
12
21
|
consumedFileServedOutputKeys,
|
|
@@ -17,30 +26,32 @@ import {
|
|
|
17
26
|
filesFullReadCountAtLoad,
|
|
18
27
|
filesReadCountAtLoad,
|
|
19
28
|
importSessionState,
|
|
29
|
+
markCompacted,
|
|
20
30
|
migrateCurlDownloadKey,
|
|
21
31
|
migrateWebFetchKey,
|
|
22
32
|
outstandingAgentSpawnKey,
|
|
23
33
|
outstandingAgentSpawnsAtLoad,
|
|
24
34
|
pendingLargeFileHintsAtLoad
|
|
25
|
-
} from "./token-goat-chunk-
|
|
26
|
-
import {
|
|
27
|
-
claudeConfigDir,
|
|
28
|
-
readTranscriptTail
|
|
29
|
-
} from "./token-goat-chunk-ONXH6NZ5.mjs";
|
|
35
|
+
} from "./token-goat-chunk-C63JQV5K.mjs";
|
|
30
36
|
import {
|
|
31
37
|
DEFAULT_MAX_AGE_MS,
|
|
32
38
|
DEFAULT_MAX_COUNT
|
|
33
|
-
} from "./token-goat-chunk-
|
|
39
|
+
} from "./token-goat-chunk-ARDNEC2U.mjs";
|
|
34
40
|
import {
|
|
35
|
-
recordStat
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
recordStat
|
|
42
|
+
} from "./token-goat-chunk-3Z5S4KGM.mjs";
|
|
43
|
+
import {
|
|
44
|
+
redactSecrets,
|
|
45
|
+
redactSerializedJson
|
|
46
|
+
} from "./token-goat-chunk-4FVIAHSI.mjs";
|
|
38
47
|
import {
|
|
39
|
-
detectHarness,
|
|
40
48
|
isAutoTriggerMultiplierExplicit,
|
|
41
49
|
loadConfig,
|
|
42
50
|
shortFingerprint
|
|
43
|
-
} from "./token-goat-chunk-
|
|
51
|
+
} from "./token-goat-chunk-7IN2MKDS.mjs";
|
|
52
|
+
import {
|
|
53
|
+
detectHarness
|
|
54
|
+
} from "./token-goat-chunk-U4N3BN2W.mjs";
|
|
44
55
|
import {
|
|
45
56
|
registerReset
|
|
46
57
|
} from "./token-goat-chunk-YZAAZU2S.mjs";
|
|
@@ -54,17 +65,17 @@ import {
|
|
|
54
65
|
stripLower,
|
|
55
66
|
withFileLock,
|
|
56
67
|
withRetryOnLock
|
|
57
|
-
} from "./token-goat-chunk-
|
|
68
|
+
} from "./token-goat-chunk-GOLEOXZP.mjs";
|
|
58
69
|
import {
|
|
59
70
|
foldPath
|
|
60
|
-
} from "./token-goat-chunk-
|
|
71
|
+
} from "./token-goat-chunk-AM5V6GSX.mjs";
|
|
61
72
|
import {
|
|
62
73
|
normalizePath
|
|
63
|
-
} from "./token-goat-chunk-
|
|
74
|
+
} from "./token-goat-chunk-FNFBKLRD.mjs";
|
|
64
75
|
import {
|
|
65
76
|
dataDir,
|
|
66
77
|
tokenGoatHome
|
|
67
|
-
} from "./token-goat-chunk-
|
|
78
|
+
} from "./token-goat-chunk-VES7EL7O.mjs";
|
|
68
79
|
import {
|
|
69
80
|
init_define_import_meta_env
|
|
70
81
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
@@ -239,6 +250,7 @@ function coerce(raw) {
|
|
|
239
250
|
cliReads,
|
|
240
251
|
bashReruns,
|
|
241
252
|
pendingLargeFileHints,
|
|
253
|
+
bashStartCwds: asStringPairs(o["bashStartCwds"]),
|
|
242
254
|
grepQueries,
|
|
243
255
|
globQueries,
|
|
244
256
|
outstandingAgentSpawns,
|
|
@@ -330,6 +342,17 @@ function mergeCurlDownloads(disk, mem) {
|
|
|
330
342
|
}
|
|
331
343
|
return Array.from(merged.entries());
|
|
332
344
|
}
|
|
345
|
+
function mergeBashStartCwds(disk, mem) {
|
|
346
|
+
const merged = new Map(disk);
|
|
347
|
+
for (const key of consumedBashStartCwdKeys()) merged.delete(key);
|
|
348
|
+
const atLoad = bashStartCwdsAtLoad();
|
|
349
|
+
for (const [toolUseId, cwd] of mem) {
|
|
350
|
+
if (atLoad.get(toolUseId) === cwd) continue;
|
|
351
|
+
merged.set(toolUseId, cwd);
|
|
352
|
+
}
|
|
353
|
+
const entries = Array.from(merged.entries());
|
|
354
|
+
return entries.length > MAX_BASH_START_CWDS ? entries.slice(entries.length - MAX_BASH_START_CWDS) : entries;
|
|
355
|
+
}
|
|
333
356
|
function mergeOutstandingAgentSpawns(disk, mem) {
|
|
334
357
|
const merged = new Map(disk.map(([prompt, ts]) => [outstandingAgentSpawnKey(prompt, ts), [prompt, ts]]));
|
|
335
358
|
for (const key of consumedOutstandingAgentSpawnKeys()) merged.delete(key);
|
|
@@ -358,6 +381,8 @@ function mergeSessionState(disk, mem) {
|
|
|
358
381
|
const memRanges = (mem.compactedAt ?? 0) === compactedAt ? mem.fileLineRanges ?? [] : [];
|
|
359
382
|
const rawDiskServed = (disk.compactedAt ?? 0) === compactedAt ? disk.fileServedOutputs ?? [] : [];
|
|
360
383
|
const memServed = (mem.compactedAt ?? 0) === compactedAt ? mem.fileServedOutputs ?? [] : [];
|
|
384
|
+
const rawDiskCliReads = (disk.compactedAt ?? 0) === compactedAt ? disk.cliReads ?? [] : [];
|
|
385
|
+
const memCliReads = (mem.compactedAt ?? 0) === compactedAt ? mem.cliReads ?? [] : [];
|
|
361
386
|
const clearedRangeFiles = new Set(consumedFileLineRangeKeys());
|
|
362
387
|
const clearedServedFiles = new Set(consumedFileServedOutputKeys());
|
|
363
388
|
const diskRanges = rawDiskRanges.filter(([path4]) => !clearedRangeFiles.has(path4));
|
|
@@ -372,9 +397,11 @@ function mergeSessionState(disk, mem) {
|
|
|
372
397
|
fileLineRanges: mergeLineRanges(diskRanges, memRanges),
|
|
373
398
|
fileServedOutputs: mergeServedOutputs(diskServed, memServed),
|
|
374
399
|
...compactedAt > 0 ? { compactedAt } : {},
|
|
375
|
-
|
|
400
|
+
// Same epoch filter as the line ranges above: a CLI read recorded before the winning compaction is not in the model's context any more, so merging it back would resurrect the "you already ran this" note the compaction just cleared.
|
|
401
|
+
cliReads: Array.from(/* @__PURE__ */ new Set([...rawDiskCliReads, ...memCliReads])),
|
|
376
402
|
bashReruns: Array.from(/* @__PURE__ */ new Set([...disk.bashReruns ?? [], ...mem.bashReruns ?? []])),
|
|
377
403
|
pendingLargeFileHints: mergePendingLargeFileHints(disk.pendingLargeFileHints ?? [], mem.pendingLargeFileHints ?? []),
|
|
404
|
+
bashStartCwds: mergeBashStartCwds(disk.bashStartCwds ?? [], mem.bashStartCwds ?? []),
|
|
378
405
|
grepQueries: mergePairs(disk.grepQueries ?? [], mem.grepQueries ?? []),
|
|
379
406
|
globQueries: mergePairs(disk.globQueries ?? [], mem.globQueries ?? []),
|
|
380
407
|
outstandingAgentSpawns: mergeOutstandingAgentSpawns(disk.outstandingAgentSpawns ?? [], mem.outstandingAgentSpawns ?? []),
|
|
@@ -445,6 +472,19 @@ var EMPTY_SESSION = { files: [], hintsShown: [], webFetches: [], bashOutputs: []
|
|
|
445
472
|
function loadSessionState(sessionId) {
|
|
446
473
|
const p = sessionPath(sessionId);
|
|
447
474
|
importSessionState((p ? readDiskState(p) : null) ?? EMPTY_SESSION);
|
|
475
|
+
applySessionCompaction(sessionId);
|
|
476
|
+
}
|
|
477
|
+
var COMPACTED_AT_SUFFIX = ".compacted-at";
|
|
478
|
+
function applySessionCompaction(stateKey) {
|
|
479
|
+
const at = stateKey.indexOf(":agent:");
|
|
480
|
+
if (at < 0) return;
|
|
481
|
+
const p = sessionSidecarPath(stateKey.slice(0, at), COMPACTED_AT_SUFFIX);
|
|
482
|
+
if (!p) return;
|
|
483
|
+
try {
|
|
484
|
+
const epoch = Number(fs.readFileSync(p, "utf8").trim());
|
|
485
|
+
if (Number.isFinite(epoch) && epoch > 0) markCompacted(epoch);
|
|
486
|
+
} catch {
|
|
487
|
+
}
|
|
448
488
|
}
|
|
449
489
|
function saveSessionState(sessionId) {
|
|
450
490
|
const p = sessionPath(sessionId);
|
|
@@ -459,7 +499,7 @@ function saveSessionState(sessionId) {
|
|
|
459
499
|
if (merged.created_ts === void 0) merged.created_ts = Date.now() / 1e3;
|
|
460
500
|
let json;
|
|
461
501
|
try {
|
|
462
|
-
json =
|
|
502
|
+
json = redactSerializedJson(JSON.stringify(merged)).text;
|
|
463
503
|
} catch {
|
|
464
504
|
return true;
|
|
465
505
|
}
|
|
@@ -529,6 +569,36 @@ function sessionSkillPrefix(sessionId, skillName) {
|
|
|
529
569
|
function outputIdFor(sessionId, skillName, contentSha) {
|
|
530
570
|
return `${sessionSkillPrefix(sessionId, skillName)}${contentSha}`;
|
|
531
571
|
}
|
|
572
|
+
var LOAD_RECORD_EXT = ".load";
|
|
573
|
+
function readLoadRecordsSync(dir) {
|
|
574
|
+
const records = [];
|
|
575
|
+
let files;
|
|
576
|
+
try {
|
|
577
|
+
files = readdirSync2(dir);
|
|
578
|
+
} catch {
|
|
579
|
+
return records;
|
|
580
|
+
}
|
|
581
|
+
for (const file of files) {
|
|
582
|
+
if (!file.endsWith(LOAD_RECORD_EXT)) continue;
|
|
583
|
+
try {
|
|
584
|
+
const parsed = JSON.parse(readFileSync2(resolve(dir, file), "utf-8"));
|
|
585
|
+
if (typeof parsed.skillName !== "string" || typeof parsed.bodyOutputId !== "string") continue;
|
|
586
|
+
records.push({ ...parsed, loadId: file.slice(0, -LOAD_RECORD_EXT.length) });
|
|
587
|
+
} catch {
|
|
588
|
+
continue;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
return records;
|
|
592
|
+
}
|
|
593
|
+
async function sessionLoads(safeSession, name) {
|
|
594
|
+
const metas = await listOutputs();
|
|
595
|
+
const own = metas.filter((m) => m.skillName === name && m.outputId.startsWith(`${safeSession}-`));
|
|
596
|
+
const storedIds = new Set(metas.map((m) => m.outputId));
|
|
597
|
+
const recorded = readLoadRecordsSync(skillOutputsDir()).filter(
|
|
598
|
+
(r) => r.skillName === name && r.loadId.startsWith(`${safeSession}-`) && storedIds.has(r.bodyOutputId)
|
|
599
|
+
);
|
|
600
|
+
return [...own, ...recorded].map((e) => ({ bodyBytes: e.bodyBytes, ts: e.ts }));
|
|
601
|
+
}
|
|
532
602
|
function* contentLineEntries(lines) {
|
|
533
603
|
let inCodeBlock = false;
|
|
534
604
|
for (let i = 0; i < lines.length; i++) {
|
|
@@ -664,9 +734,7 @@ async function hasSessionOutput(sessionId, skillName) {
|
|
|
664
734
|
if (!sessionId) return false;
|
|
665
735
|
const name = safeSkillName(skillName);
|
|
666
736
|
if (!name) return false;
|
|
667
|
-
|
|
668
|
-
const metas = await listOutputs();
|
|
669
|
-
return metas.some((m) => m.skillName === name && m.outputId.startsWith(`${safeSession}-`));
|
|
737
|
+
return (await sessionLoads(safeSessionFragment(sessionId), name)).length > 0;
|
|
670
738
|
} catch {
|
|
671
739
|
return false;
|
|
672
740
|
}
|
|
@@ -676,9 +744,7 @@ async function sessionOutputBodyBytes(sessionId, skillName) {
|
|
|
676
744
|
if (!sessionId) return null;
|
|
677
745
|
const name = safeSkillName(skillName);
|
|
678
746
|
if (!name) return null;
|
|
679
|
-
const
|
|
680
|
-
const metas = await listOutputs();
|
|
681
|
-
const matches = metas.filter((m) => m.skillName === name && m.outputId.startsWith(`${safeSession}-`));
|
|
747
|
+
const matches = await sessionLoads(safeSessionFragment(sessionId), name);
|
|
682
748
|
if (matches.length === 0) return null;
|
|
683
749
|
matches.sort((a, b) => b.ts - a.ts);
|
|
684
750
|
return matches[0].bodyBytes;
|
|
@@ -717,13 +783,23 @@ async function storeOutput(sessionId, skillName, body, opts) {
|
|
|
717
783
|
const name = safeSkillName(skillName);
|
|
718
784
|
if (!name) return null;
|
|
719
785
|
const sha = contentHash(body);
|
|
786
|
+
const outId = outputIdFor(sessionId, skillName, sha);
|
|
787
|
+
const dir = skillOutputsDir();
|
|
788
|
+
const ts = Date.now();
|
|
720
789
|
const existing = await findCrossSessionEntry(skillName, sha);
|
|
721
790
|
if (existing) {
|
|
791
|
+
if (existing.outputId !== outId && sessionId) {
|
|
792
|
+
const record = {
|
|
793
|
+
skillName: name,
|
|
794
|
+
contentSha: sha,
|
|
795
|
+
bodyOutputId: existing.outputId,
|
|
796
|
+
bodyBytes: Buffer.byteLength(body, "utf-8"),
|
|
797
|
+
ts
|
|
798
|
+
};
|
|
799
|
+
await atomicWriteText(resolve(dir, `${outId}${LOAD_RECORD_EXT}`), JSON.stringify(record, null, 2));
|
|
800
|
+
}
|
|
722
801
|
return existing;
|
|
723
802
|
}
|
|
724
|
-
const outId = outputIdFor(sessionId, skillName, sha);
|
|
725
|
-
const dir = skillOutputsDir();
|
|
726
|
-
const ts = Date.now();
|
|
727
803
|
const bodyBytes = Buffer.byteLength(body, "utf-8");
|
|
728
804
|
const truncated = bodyBytes > 256 * 1024;
|
|
729
805
|
const redactedBody = redactSecrets(body);
|
|
@@ -1073,6 +1149,13 @@ function pruneSkillOutputs(maxCount = DEFAULT_MAX_COUNT, maxAgeMs = DEFAULT_MAX_
|
|
|
1073
1149
|
removeEntry(entry.outputId);
|
|
1074
1150
|
}
|
|
1075
1151
|
}
|
|
1152
|
+
for (const record of readLoadRecordsSync(dir)) {
|
|
1153
|
+
if (record.ts >= cutoff && existsSync2(resolve(dir, `${record.bodyOutputId}.meta`))) continue;
|
|
1154
|
+
try {
|
|
1155
|
+
unlinkSync(resolve(dir, `${record.loadId}${LOAD_RECORD_EXT}`));
|
|
1156
|
+
} catch {
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1076
1159
|
} catch {
|
|
1077
1160
|
return removed;
|
|
1078
1161
|
}
|
|
@@ -1477,8 +1560,10 @@ export {
|
|
|
1477
1560
|
sessionsDir,
|
|
1478
1561
|
AGENT_SALT_MARKER,
|
|
1479
1562
|
sessionSidecarPath,
|
|
1563
|
+
readSessionStateFile,
|
|
1480
1564
|
listSiblingSessionStates,
|
|
1481
1565
|
loadSessionState,
|
|
1566
|
+
COMPACTED_AT_SUFFIX,
|
|
1482
1567
|
saveSessionState,
|
|
1483
1568
|
CONTEXT_AUTOCOMPACT_TOKENS,
|
|
1484
1569
|
getContextPressure,
|
|
@@ -1492,6 +1577,7 @@ export {
|
|
|
1492
1577
|
SKILLS_OUTPUT_SUBDIR,
|
|
1493
1578
|
skillOutputsDir,
|
|
1494
1579
|
contentHash,
|
|
1580
|
+
safeSkillName,
|
|
1495
1581
|
extractCompactFromMarker,
|
|
1496
1582
|
extractNamedSection,
|
|
1497
1583
|
extractChecklistSection,
|