token-goat 2.9.15 → 2.9.16
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/dist/{token-goat-chunk-ASYEPR3S.mjs → token-goat-chunk-2IEIBVVD.mjs} +7 -3
- package/dist/{token-goat-chunk-LCZBPOIN.mjs → token-goat-chunk-2PCFAQAS.mjs} +66 -51
- package/dist/{token-goat-chunk-PM76YS22.mjs → token-goat-chunk-3H6FQT62.mjs} +1 -1
- package/dist/{token-goat-chunk-C5JIO6HK.mjs → token-goat-chunk-4DC6DDIB.mjs} +5 -5
- package/dist/{token-goat-chunk-YQ7WI2CO.mjs → token-goat-chunk-5USHO7B6.mjs} +393 -3957
- package/dist/{token-goat-chunk-2X2EBBC6.mjs → token-goat-chunk-63QWJ6UM.mjs} +2 -2
- package/dist/{token-goat-chunk-NDRP4KJQ.mjs → token-goat-chunk-BFNTLGVA.mjs} +226 -50
- package/dist/token-goat-chunk-BGHSSJUA.mjs +102 -0
- package/dist/{token-goat-chunk-IVUQLQWN.mjs → token-goat-chunk-DMQ32ZSR.mjs} +5 -3
- package/dist/{token-goat-chunk-SFAS46RE.mjs → token-goat-chunk-EJCY6KHO.mjs} +2 -2
- package/dist/{token-goat-chunk-Z6UXPYJA.mjs → token-goat-chunk-F2ARFHLJ.mjs} +1 -1
- package/dist/{token-goat-chunk-YKG35VHC.mjs → token-goat-chunk-GIMGT34T.mjs} +1 -1
- package/dist/{token-goat-chunk-SZWYESBS.mjs → token-goat-chunk-GMXBQS6O.mjs} +155 -54
- package/dist/{token-goat-chunk-S4XRY446.mjs → token-goat-chunk-H3DXI6VD.mjs} +4 -3
- package/dist/{token-goat-chunk-6DLVZDB6.mjs → token-goat-chunk-LJL6FGDS.mjs} +13 -12
- package/dist/{token-goat-chunk-NEI4NC54.mjs → token-goat-chunk-LKSXAMJB.mjs} +7 -2
- package/dist/{token-goat-chunk-A4JYKD5H.mjs → token-goat-chunk-M2R4UQ3B.mjs} +2 -2
- package/dist/{token-goat-chunk-MZDIJJ3R.mjs → token-goat-chunk-MA5BZ2KI.mjs} +40 -3
- package/dist/{token-goat-chunk-GIIHUSZX.mjs → token-goat-chunk-MIL62GMN.mjs} +41 -11
- package/dist/{token-goat-chunk-NU7TLMQK.mjs → token-goat-chunk-NAMH252H.mjs} +10 -7
- package/dist/{token-goat-chunk-DQ4J5AFF.mjs → token-goat-chunk-NOBZV7PM.mjs} +69 -18
- package/dist/{token-goat-chunk-5V7DAC7V.mjs → token-goat-chunk-NQZCSVN2.mjs} +10 -3
- package/dist/{token-goat-chunk-7ZYK25AO.mjs → token-goat-chunk-OCI25AXY.mjs} +4 -4
- package/dist/{token-goat-chunk-NDPO7GAH.mjs → token-goat-chunk-QMZMHQRR.mjs} +21 -20
- package/dist/{token-goat-chunk-K7F2BFIK.mjs → token-goat-chunk-R3X5TCPB.mjs} +1 -1
- package/dist/token-goat-chunk-RRNZMM3A.mjs +3364 -0
- package/dist/{token-goat-chunk-ATIFTMRC.mjs → token-goat-chunk-ULA4WCED.mjs} +7 -7
- package/dist/{token-goat-chunk-OUGNPMDA.mjs → token-goat-chunk-UMXD2M7O.mjs} +30 -14
- package/dist/{token-goat-chunk-YZX7EFG4.mjs → token-goat-chunk-UXHDBVUR.mjs} +1 -1
- package/dist/{token-goat-chunk-LT7JRU6K.mjs → token-goat-chunk-VVIYEFBI.mjs} +4 -4
- package/dist/{token-goat-chunk-BL5LNGBG.mjs → token-goat-chunk-XOHTFRDH.mjs} +2966 -3869
- package/dist/{token-goat-chunk-XEPXYDPI.mjs → token-goat-chunk-YPS64ACE.mjs} +11 -2
- package/dist/{token-goat-chunk-GMQQA7E4.mjs → token-goat-chunk-Z5VPAXTC.mjs} +2442 -722
- package/dist/{token-goat-chunk-3NSDDTGL.mjs → token-goat-chunk-ZEHFYJ7Z.mjs} +5 -5
- package/dist/token-goat-hook.mjs +13 -12
- package/dist/token-goat.core.mjs +21 -20
- package/package.json +1 -1
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
isSupportedOcrLang,
|
|
6
6
|
loadConfig,
|
|
7
7
|
resolveOcrLangs
|
|
8
|
-
} from "./token-goat-chunk-
|
|
8
|
+
} from "./token-goat-chunk-H3DXI6VD.mjs";
|
|
9
9
|
import {
|
|
10
10
|
ensureDirSync,
|
|
11
11
|
tokenGoatHome
|
|
12
|
-
} from "./token-goat-chunk-
|
|
12
|
+
} from "./token-goat-chunk-3H6FQT62.mjs";
|
|
13
13
|
import {
|
|
14
14
|
fenceUntrustedOcrText
|
|
15
15
|
} from "./token-goat-chunk-ERTXEKB6.mjs";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
reconstructLayout,
|
|
28
28
|
resolveDestPage,
|
|
29
29
|
withPdfDocument
|
|
30
|
-
} from "./token-goat-chunk-
|
|
30
|
+
} from "./token-goat-chunk-LKSXAMJB.mjs";
|
|
31
31
|
import "./token-goat-chunk-AH6QILZM.mjs";
|
|
32
32
|
import "./token-goat-chunk-Y4AFKTHK.mjs";
|
|
33
33
|
import "./token-goat-chunk-GMOUBOX4.mjs";
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
canRunWrappedShell,
|
|
5
5
|
clipToDeliveryCap,
|
|
6
6
|
deliveredOutputBytes
|
|
7
|
-
} from "./token-goat-chunk-
|
|
7
|
+
} from "./token-goat-chunk-UXHDBVUR.mjs";
|
|
8
8
|
import {
|
|
9
9
|
DEFAULT_RECONCILE_BUDGET_MS,
|
|
10
10
|
HOOK_EVENTS,
|
|
@@ -17,11 +17,13 @@ import {
|
|
|
17
17
|
readStdinJson,
|
|
18
18
|
reconcileProject,
|
|
19
19
|
storeWebOutput
|
|
20
|
-
} from "./token-goat-chunk-
|
|
20
|
+
} from "./token-goat-chunk-UMXD2M7O.mjs";
|
|
21
21
|
import {
|
|
22
|
+
BODY_FIRST_TOOL_RESPONSE_KEYS,
|
|
22
23
|
GENERIC_SERVED_OUTPUT_KEY,
|
|
23
24
|
OUTLINE_MAX_REPLACEMENT_RATIO,
|
|
24
25
|
OUTLINE_MIN_HEADINGS,
|
|
26
|
+
OUTPUT_FIRST_TOOL_RESPONSE_KEYS,
|
|
25
27
|
WEB_FETCH_KEY_SEP,
|
|
26
28
|
accumulateResidentLines,
|
|
27
29
|
appendDirtyPath,
|
|
@@ -33,9 +35,16 @@ import {
|
|
|
33
35
|
clearCurlDownload,
|
|
34
36
|
compactPathFor,
|
|
35
37
|
computeAdaptiveBudget,
|
|
38
|
+
contextOutput,
|
|
39
|
+
denyOutput,
|
|
40
|
+
emitRewrite,
|
|
41
|
+
emitRewriteIfChanged,
|
|
36
42
|
enqueueDirtyPathSafe,
|
|
37
43
|
ensureWorkerAlive,
|
|
44
|
+
estimateTokens,
|
|
38
45
|
extractCompactFromMarker,
|
|
46
|
+
extractToolResponseField,
|
|
47
|
+
extractToolResultText,
|
|
39
48
|
fenceUntrusted,
|
|
40
49
|
fenceUntrustedSpans,
|
|
41
50
|
fenceWithMatches,
|
|
@@ -47,7 +56,9 @@ import {
|
|
|
47
56
|
getBashOutputId,
|
|
48
57
|
getContextPressure,
|
|
49
58
|
getCurlDownloadPath,
|
|
59
|
+
getCwd,
|
|
50
60
|
getFileLineRanges,
|
|
61
|
+
getFilePath,
|
|
51
62
|
getFileServedOutputs,
|
|
52
63
|
getGlobMatchCount,
|
|
53
64
|
getGrepMatchCount,
|
|
@@ -56,31 +67,41 @@ import {
|
|
|
56
67
|
getSessionBashReruns,
|
|
57
68
|
getSessionFiles,
|
|
58
69
|
getSessionWebFetches,
|
|
70
|
+
getToolInput,
|
|
71
|
+
getToolName,
|
|
72
|
+
getTranscriptPath,
|
|
59
73
|
hasSeenImage,
|
|
60
74
|
hasSessionOutput,
|
|
61
75
|
imageQualifiesForShrink,
|
|
62
76
|
incrementSkillHit,
|
|
63
77
|
indexServedBody,
|
|
64
78
|
installedSkillPath,
|
|
79
|
+
isMcpErrorResponse,
|
|
65
80
|
isStructuralRewriteAccepted,
|
|
81
|
+
isTextualContentBlock,
|
|
66
82
|
lastTabContextMatches,
|
|
67
83
|
lineMayCarryResidentSignal,
|
|
68
84
|
listSiblingSessionStates,
|
|
69
85
|
loadSessionCache,
|
|
70
86
|
loadSessionState,
|
|
87
|
+
makeDedupHintHandlers,
|
|
71
88
|
markCompactStale,
|
|
72
89
|
markCompacted,
|
|
73
90
|
markFileTruncated,
|
|
74
91
|
markHintShown,
|
|
75
92
|
matchesAllowPattern,
|
|
76
93
|
matchesDenyPattern,
|
|
94
|
+
mcpContentBlocks,
|
|
77
95
|
meetsSavingsFloor,
|
|
78
96
|
metadataEndpointRefusal,
|
|
97
|
+
normalizePayload,
|
|
98
|
+
passOutput,
|
|
79
99
|
planMarkdownOutline,
|
|
80
100
|
planServedElisions,
|
|
81
101
|
planSourceSkeleton,
|
|
82
102
|
preToolPathDeclined,
|
|
83
103
|
probeImageMeta,
|
|
104
|
+
readCopilotHooksOwners,
|
|
84
105
|
readTranscriptTail,
|
|
85
106
|
recordBashOutput,
|
|
86
107
|
recordBashRerun,
|
|
@@ -98,13 +119,17 @@ import {
|
|
|
98
119
|
recordSeenImage,
|
|
99
120
|
recordSymbolRead,
|
|
100
121
|
recordWebFetch,
|
|
122
|
+
registerHook,
|
|
101
123
|
removeOutstandingAgentSpawn,
|
|
102
124
|
repeatedSkillBodyHint,
|
|
125
|
+
runHook,
|
|
103
126
|
saveSessionState,
|
|
104
127
|
scanAndRecord,
|
|
128
|
+
serializeOutput,
|
|
105
129
|
servedRunNotice,
|
|
106
130
|
sessionOutputBodyBytes,
|
|
107
131
|
sessionSidecarPath,
|
|
132
|
+
sessionStateKey,
|
|
108
133
|
setLastTabContext,
|
|
109
134
|
setTranscriptPath,
|
|
110
135
|
shrinkImage,
|
|
@@ -117,76 +142,51 @@ import {
|
|
|
117
142
|
vscodePathAllowed,
|
|
118
143
|
wasCliReadThisSession,
|
|
119
144
|
wasFileReadThisSession,
|
|
120
|
-
wasHintShown
|
|
121
|
-
|
|
145
|
+
wasHintShown,
|
|
146
|
+
withPreservedBlocks
|
|
147
|
+
} from "./token-goat-chunk-XOHTFRDH.mjs";
|
|
122
148
|
import {
|
|
123
149
|
BASH_OUTPUT_SUBDIR,
|
|
124
|
-
BODY_FIRST_TOOL_RESPONSE_KEYS,
|
|
125
|
-
OUTPUT_FIRST_TOOL_RESPONSE_KEYS,
|
|
126
150
|
commandHash,
|
|
127
151
|
compressOutput,
|
|
128
|
-
contextOutput,
|
|
129
152
|
dedupeConsecutive,
|
|
130
|
-
denyOutput,
|
|
131
153
|
detectFromCommand,
|
|
132
|
-
emitRewrite,
|
|
133
|
-
emitRewriteIfChanged,
|
|
134
|
-
estimateTokens,
|
|
135
|
-
extractToolResponseField,
|
|
136
|
-
extractToolResultText,
|
|
137
154
|
filterByName,
|
|
138
155
|
getBashOutput,
|
|
139
|
-
getCwd,
|
|
140
|
-
getFilePath,
|
|
141
156
|
getMonitoringRecallHint,
|
|
142
|
-
getToolInput,
|
|
143
|
-
getToolName,
|
|
144
|
-
getTranscriptPath,
|
|
145
157
|
hasBareBackgroundOrNewline,
|
|
146
158
|
hasUnquotedOperator,
|
|
147
159
|
indexRecallEntry,
|
|
148
160
|
isBashEntryStale,
|
|
149
161
|
isBuildCommand,
|
|
150
|
-
isMcpErrorResponse,
|
|
151
162
|
isRewriteWorthwhile,
|
|
152
163
|
isScopedGitStatusOrDiffStatCommand,
|
|
153
164
|
isTestRunnerCommand,
|
|
154
|
-
isTextualContentBlock,
|
|
155
|
-
makeDedupHintHandlers,
|
|
156
|
-
mcpContentBlocks,
|
|
157
|
-
normalizePayload,
|
|
158
|
-
passOutput,
|
|
159
|
-
readCopilotHooksOwners,
|
|
160
|
-
registerHook,
|
|
161
165
|
resolveMinNetSavingsBytes,
|
|
162
|
-
runHook,
|
|
163
|
-
serializeOutput,
|
|
164
|
-
sessionStateKey,
|
|
165
166
|
shlexSplit,
|
|
166
167
|
splitOwnTrailingNotices,
|
|
167
168
|
storeBashOutput,
|
|
168
|
-
summarizeOutputDelta
|
|
169
|
-
|
|
170
|
-
} from "./token-goat-chunk-YQ7WI2CO.mjs";
|
|
171
|
-
import {
|
|
172
|
-
extractMarkdownHeadings,
|
|
173
|
-
formatHeadingTreeParts
|
|
174
|
-
} from "./token-goat-chunk-NDRP4KJQ.mjs";
|
|
175
|
-
import {
|
|
176
|
-
countSymbols
|
|
177
|
-
} from "./token-goat-chunk-2X2EBBC6.mjs";
|
|
169
|
+
summarizeOutputDelta
|
|
170
|
+
} from "./token-goat-chunk-5USHO7B6.mjs";
|
|
178
171
|
import {
|
|
179
172
|
recordStat,
|
|
180
173
|
redactSecrets,
|
|
181
174
|
savedTokensFromBytes,
|
|
182
175
|
storeBlob,
|
|
183
176
|
stripAnsiEscapes
|
|
184
|
-
} from "./token-goat-chunk-
|
|
177
|
+
} from "./token-goat-chunk-DMQ32ZSR.mjs";
|
|
178
|
+
import {
|
|
179
|
+
extractMarkdownHeadings,
|
|
180
|
+
formatHeadingTreeParts
|
|
181
|
+
} from "./token-goat-chunk-BFNTLGVA.mjs";
|
|
182
|
+
import {
|
|
183
|
+
countSymbols
|
|
184
|
+
} from "./token-goat-chunk-63QWJ6UM.mjs";
|
|
185
185
|
import {
|
|
186
186
|
detectLanguage,
|
|
187
187
|
getDb,
|
|
188
188
|
languageHasFlag
|
|
189
|
-
} from "./token-goat-chunk-
|
|
189
|
+
} from "./token-goat-chunk-R3X5TCPB.mjs";
|
|
190
190
|
import {
|
|
191
191
|
detectHarness,
|
|
192
192
|
envBool,
|
|
@@ -196,7 +196,7 @@ import {
|
|
|
196
196
|
isUnderSystemTemp,
|
|
197
197
|
loadConfig,
|
|
198
198
|
shortFingerprint
|
|
199
|
-
} from "./token-goat-chunk-
|
|
199
|
+
} from "./token-goat-chunk-H3DXI6VD.mjs";
|
|
200
200
|
import {
|
|
201
201
|
ENV_KEYS,
|
|
202
202
|
IDENTICAL_READ_MIN_BODY_BYTES,
|
|
@@ -215,7 +215,7 @@ import {
|
|
|
215
215
|
isInsideRoot,
|
|
216
216
|
runGit,
|
|
217
217
|
toKB
|
|
218
|
-
} from "./token-goat-chunk-
|
|
218
|
+
} from "./token-goat-chunk-3H6FQT62.mjs";
|
|
219
219
|
import {
|
|
220
220
|
UNTRUSTED_TOOL_TAG,
|
|
221
221
|
displaySafePath,
|
|
@@ -945,7 +945,7 @@ init_define_import_meta_env();
|
|
|
945
945
|
var TRACKED_SKILL = "token-goat";
|
|
946
946
|
var MAX_COMMANDS_SHOWN = 8;
|
|
947
947
|
async function currentCommandNames() {
|
|
948
|
-
const { buildProgram } = await import("./token-goat-chunk-
|
|
948
|
+
const { buildProgram } = await import("./token-goat-chunk-QMZMHQRR.mjs");
|
|
949
949
|
return flattenCommandNames(buildCommandManifest(buildProgram()));
|
|
950
950
|
}
|
|
951
951
|
async function recordSkillVersionSnapshot(sessionId, skillName) {
|
|
@@ -7835,12 +7835,77 @@ function extractRgSymbolSearch(cmd) {
|
|
|
7835
7835
|
}
|
|
7836
7836
|
function extractCatJsonPipe(cmd) {
|
|
7837
7837
|
const m = /^cat\s+(?:"([^"]+)"|'([^']+)'|(\S+))\s*\|\s*jq\b/.exec(cmd);
|
|
7838
|
-
if (
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7838
|
+
if (m) {
|
|
7839
|
+
const filePath = m[1] ?? m[2] ?? m[3];
|
|
7840
|
+
if (filePath && !isTempPath(filePath) && /\.(?:json|yaml|yml|toml)$/i.test(filePath)) {
|
|
7841
|
+
return { filePath, isDirectJq: false };
|
|
7842
|
+
}
|
|
7843
|
+
}
|
|
7844
|
+
const jqDirect = /^jq(?:\s+(?:-[a-zA-Z]+|--[a-zA-Z0-9-]+(?:=\S+)?))*\s+(?:"[^"]*"|'[^']*'|(?:\.[a-zA-Z0-9_.*[\]]+))\s+(?:"([^"]+)"|'([^']+)'|(\S+))\s*$/.exec(cmd);
|
|
7845
|
+
if (jqDirect) {
|
|
7846
|
+
const filePath = jqDirect[1] ?? jqDirect[2] ?? jqDirect[3];
|
|
7847
|
+
if (filePath && !isTempPath(filePath) && /\.(?:json|yaml|yml|toml)$/i.test(filePath)) {
|
|
7848
|
+
return { filePath, isDirectJq: true };
|
|
7849
|
+
}
|
|
7850
|
+
}
|
|
7851
|
+
return null;
|
|
7852
|
+
}
|
|
7853
|
+
function extractPowerShellJsonPipeline(cmd) {
|
|
7854
|
+
let inner = cmd.trim();
|
|
7855
|
+
const w = POWERSHELL_WRAP_RE.exec(inner);
|
|
7856
|
+
if (w) {
|
|
7857
|
+
inner = (w[1] ?? w[2] ?? "").trim();
|
|
7858
|
+
}
|
|
7859
|
+
if (!/\bConvertFrom-Json\b/i.test(inner)) return null;
|
|
7860
|
+
const parseTarget = (segment) => {
|
|
7861
|
+
const readAll = /\[(?:System\.)?IO\.File\]::ReadAllText\(\s*['"]?([^'")\s]+)['"]?\s*\)/i.exec(segment);
|
|
7862
|
+
if (readAll) {
|
|
7863
|
+
const p = readAll[1];
|
|
7864
|
+
return p && /\.(?:json|txt|log|temp)$/i.test(p) ? p : null;
|
|
7865
|
+
}
|
|
7866
|
+
const tokens = segment.trim().split(/\s+/);
|
|
7867
|
+
const cmdlets = /* @__PURE__ */ new Set(["get-content", "gc", "cat", "type"]);
|
|
7868
|
+
const idx = tokens.findIndex((t) => cmdlets.has(t.toLowerCase()));
|
|
7869
|
+
if (idx === -1) return null;
|
|
7870
|
+
let argIdx = idx + 1;
|
|
7871
|
+
while (argIdx < tokens.length) {
|
|
7872
|
+
const tok = tokens[argIdx];
|
|
7873
|
+
if (!tok) break;
|
|
7874
|
+
if (tok.startsWith("-")) {
|
|
7875
|
+
const flag = tok.toLowerCase();
|
|
7876
|
+
if (flag === "-path" && argIdx + 1 < tokens.length) {
|
|
7877
|
+
const next = tokens[argIdx + 1];
|
|
7878
|
+
if (next && !next.startsWith("-")) {
|
|
7879
|
+
const clean2 = next.replace(/^['"]|['"]$/g, "");
|
|
7880
|
+
return /\.(?:json|txt|log|temp)$/i.test(clean2) ? clean2 : null;
|
|
7881
|
+
}
|
|
7882
|
+
}
|
|
7883
|
+
if ((flag === "-encoding" || flag === "-totalcount") && argIdx + 1 < tokens.length) {
|
|
7884
|
+
argIdx += 2;
|
|
7885
|
+
continue;
|
|
7886
|
+
}
|
|
7887
|
+
argIdx++;
|
|
7888
|
+
continue;
|
|
7889
|
+
}
|
|
7890
|
+
const clean = tok.replace(/^['"(]|['")]$/g, "");
|
|
7891
|
+
return /\.(?:json|txt|log|temp)$/i.test(clean) ? clean : null;
|
|
7892
|
+
}
|
|
7893
|
+
return null;
|
|
7894
|
+
};
|
|
7895
|
+
const pipeIdx = inner.search(/\|\s*ConvertFrom-Json\b/i);
|
|
7896
|
+
if (pipeIdx !== -1) {
|
|
7897
|
+
const upstream = inner.slice(0, pipeIdx).trim();
|
|
7898
|
+
return { filePath: parseTarget(upstream) };
|
|
7899
|
+
}
|
|
7900
|
+
const parenMatch = /ConvertFrom-Json\s*\(([^)]+)\)/i.exec(inner);
|
|
7901
|
+
if (parenMatch) {
|
|
7902
|
+
const inside = parenMatch[1] ?? "";
|
|
7903
|
+
return { filePath: parseTarget(inside) };
|
|
7904
|
+
}
|
|
7905
|
+
if (/ConvertFrom-Json\s*\(/i.test(inner)) {
|
|
7906
|
+
return { filePath: null };
|
|
7907
|
+
}
|
|
7908
|
+
return null;
|
|
7844
7909
|
}
|
|
7845
7910
|
function extractWslCatFile(cmd) {
|
|
7846
7911
|
const wslMatch = /^wsl(?:\s+-d\s+\S+)?\s+bash\s+-c\s+"cat(?:\s+(?:-[a-zA-Z]+|--[a-zA-Z-]+))*\s+\/mnt\/([a-z])\/([^"]*)"/.exec(cmd);
|
|
@@ -9532,11 +9597,25 @@ function preBashHandlerInner(event) {
|
|
|
9532
9597
|
}
|
|
9533
9598
|
const catJsonPipe = extractCatJsonPipe(cmd);
|
|
9534
9599
|
if (catJsonPipe !== null) {
|
|
9535
|
-
const { filePath } = catJsonPipe;
|
|
9600
|
+
const { filePath, isDirectJq } = catJsonPipe;
|
|
9536
9601
|
const hintPath = displaySafePath(cdStripped ? resolveCdHintPath(rawCmd, filePath, hintCwd) : filePath);
|
|
9537
9602
|
recordStat("session_hint", 0, 0);
|
|
9603
|
+
const label = isDirectJq ? "`jq`" : "`cat | jq`";
|
|
9604
|
+
return contextOutput(
|
|
9605
|
+
label + ' loads the whole file. Use `token-goat json-query "' + hintPath + '" "<key>"` or `token-goat config-get "' + hintPath + '" KEY_NAME` to slice one value.'
|
|
9606
|
+
);
|
|
9607
|
+
}
|
|
9608
|
+
const psJsonPipe = extractPowerShellJsonPipeline(cmd);
|
|
9609
|
+
if (psJsonPipe !== null) {
|
|
9610
|
+
recordStat("session_hint", 0, 0);
|
|
9611
|
+
if (psJsonPipe.filePath) {
|
|
9612
|
+
const hintPath = displaySafePath(cdStripped ? resolveCdHintPath(rawCmd, psJsonPipe.filePath, hintCwd) : psJsonPipe.filePath);
|
|
9613
|
+
return contextOutput(
|
|
9614
|
+
'PowerShell `ConvertFrom-Json` pipeline detected. Use `token-goat json-query "' + hintPath + '" "<selector>"` to extract fields directly without shell conversion scripts.'
|
|
9615
|
+
);
|
|
9616
|
+
}
|
|
9538
9617
|
return contextOutput(
|
|
9539
|
-
'
|
|
9618
|
+
'PowerShell `ConvertFrom-Json` pipeline detected. Use `token-goat json-query <file> "<selector>"` or `token-goat web-output` to extract fields directly.'
|
|
9540
9619
|
);
|
|
9541
9620
|
}
|
|
9542
9621
|
const catResult = extractCatFile(cmd);
|
|
@@ -9907,6 +9986,23 @@ function recordBashFileReadsForSessionCache(cmd, cwd) {
|
|
|
9907
9986
|
return;
|
|
9908
9987
|
}
|
|
9909
9988
|
}
|
|
9989
|
+
async function maybeEmitLargeUncompressedHint(cmd, output, exitCode, cwd, isUnwrapped, event, ansiResult) {
|
|
9990
|
+
const outputBytes = Buffer.byteLength(output, "utf-8");
|
|
9991
|
+
if (outputBytes < 4096 || process.env["TOKEN_GOAT_BASH_COMPRESS"] === "0" || exitCode !== null && exitCode !== 0 || event.raw["_tg_harness"] !== "vscode" && (isCompressibleSingleCommand(cmd) || !isUnwrapped)) {
|
|
9992
|
+
return null;
|
|
9993
|
+
}
|
|
9994
|
+
const key = `bash-uncompressed-4k:${event.sessionId ?? ""}:${shortFingerprint(cmd)}`;
|
|
9995
|
+
if (wasHintShown(key)) return null;
|
|
9996
|
+
markHintShown(key);
|
|
9997
|
+
recordStat("session_hint", 0, 0);
|
|
9998
|
+
const id = await storeBashOutput(cmd, output, exitCode ?? 0, cwd);
|
|
9999
|
+
const kb = Math.round(outputBytes / 1024);
|
|
10000
|
+
const msg = `[tg] Output was ${kb}KB uncompressed. For large tool outputs, run with 'token-goat compress -c "${displaySafeText(cmd)}"' or inspect via 'token-goat bash-output ${id}'.`;
|
|
10001
|
+
if (ansiResult !== null && ansiResult.hookType === "rewriteOutput") {
|
|
10002
|
+
return emitRewrite(msg + "\n" + fenceUntrusted(ansiResult.updatedOutput, UNTRUSTED_TOOL_TAG), "large uncompressed output hint", void 0, "counted-elsewhere");
|
|
10003
|
+
}
|
|
10004
|
+
return contextOutput(msg);
|
|
10005
|
+
}
|
|
9910
10006
|
async function postBashHandler(event) {
|
|
9911
10007
|
try {
|
|
9912
10008
|
const rawCmdRaw = extractCommand(event);
|
|
@@ -10012,7 +10108,10 @@ async function postBashHandler(event) {
|
|
|
10012
10108
|
const genericElision = await maybeElideServedGenericOutput(cmd, output, exitCode, cwd, cacheMinBytes);
|
|
10013
10109
|
if (genericElision !== null) return genericElision;
|
|
10014
10110
|
}
|
|
10015
|
-
|
|
10111
|
+
const ansiStripped = maybeStripAnsiOnly(output);
|
|
10112
|
+
const largeHint2 = await maybeEmitLargeUncompressedHint(cmd, output, exitCode, cwd, isUnwrapped, event, ansiStripped);
|
|
10113
|
+
if (largeHint2 !== null) return largeHint2;
|
|
10114
|
+
return ansiStripped ?? passOutput();
|
|
10016
10115
|
}
|
|
10017
10116
|
if (Buffer.byteLength(output, "utf-8") < cacheMinBytes) return passOutput();
|
|
10018
10117
|
const cacheKey = isCurlGetCommand(cmd) ? extractCurlUrl(cmd) ?? cmd : stripOutputPipeline(cmd);
|
|
@@ -10032,6 +10131,8 @@ async function postBashHandler(event) {
|
|
|
10032
10131
|
const curlHtmlFold = maybeFoldCurlHtml(cmd, output, id);
|
|
10033
10132
|
if (curlHtmlFold !== null) return curlHtmlFold;
|
|
10034
10133
|
const ansiOnly = maybeStripAnsiOnly(output);
|
|
10134
|
+
const largeHint = await maybeEmitLargeUncompressedHint(cmd, output, exitCode, cwd, isUnwrapped, event, ansiOnly);
|
|
10135
|
+
if (largeHint !== null) return largeHint;
|
|
10035
10136
|
if (ansiOnly !== null) return ansiOnly;
|
|
10036
10137
|
} catch {
|
|
10037
10138
|
}
|
|
@@ -11171,7 +11272,7 @@ function buildSubagentBriefing() {
|
|
|
11171
11272
|
}
|
|
11172
11273
|
const tail = [];
|
|
11173
11274
|
tail.push("");
|
|
11174
|
-
tail.push('Before your first read of any file, check for a token-goat command that returns just what you need and run it instead of a full-file read or wide grep: `token-goat symbol <name>`, `token-goat read "file::symbol"`, `token-goat section "file::<heading>"`. Skipping that check is a violation, not an oversight; the only exemptions are a file under ~200 lines you need whole, a never-indexed file, or an image.');
|
|
11275
|
+
tail.push('Before your first read of any file, check for a token-goat command that returns just what you need and run it instead of a full-file read or wide grep: `token-goat symbol <name>`, `token-goat read "file::symbol"`, `token-goat section "file::<heading>"`, `token-goat json-query file \'a.b.c\'`. Skipping that check is a violation, not an oversight; the only exemptions are a file under ~200 lines you need whole, a never-indexed file, or an image.');
|
|
11175
11276
|
tail.push("");
|
|
11176
11277
|
tail.push('Report contract: cite evidence as `file::symbol` or a token-goat recall id (`token-goat mcp-output <id> --full`) rather than pasting bodies; paste a fenced block only when the exact bytes are load-bearing; state every unverified claim explicitly (e.g. "not verified: ...") rather than omitting it.');
|
|
11177
11278
|
const withCacheIds = head.join("\n") + cacheIdsBlock + "\n" + tail.join("\n");
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
foldPath,
|
|
14
14
|
projectConfigPath,
|
|
15
15
|
runGit
|
|
16
|
-
} from "./token-goat-chunk-
|
|
16
|
+
} from "./token-goat-chunk-3H6FQT62.mjs";
|
|
17
17
|
import {
|
|
18
18
|
normalizeDarwinSystemAlias
|
|
19
19
|
} from "./token-goat-chunk-ERTXEKB6.mjs";
|
|
@@ -1421,7 +1421,8 @@ var CONFIG_DEFAULTS = {
|
|
|
1421
1421
|
image_shrink: {
|
|
1422
1422
|
enabled: true,
|
|
1423
1423
|
jpeg_quality: 75,
|
|
1424
|
-
|
|
1424
|
+
// 16,000,000 used to reject a routine 24MP DSLR/phone photo outright -- the exact input this feature exists to shrink -- while the engine's own decode ceiling (MAX_DECODED_BYTES in image_engine.ts, 256MB at 4 bytes/pixel for a single frame) sits at 67,108,864px. 64,000,000 covers cameras well past 24MP (including 48MP phone sensors) with ~4.9% margin below that hard ceiling, which assertDecodableSize enforces independently of this value on every decode regardless of what this header check allows through. Measured on this engine (2026-09-17): a 24MP PNG decodes+shrinks in ~370ms, 60,000,516px in ~920ms, and 67,108,864px (the ceiling itself) in ~760ms -- all comfortably fast, so the new value is chosen for coverage headroom under the ceiling, not for decode-time cost. Decode time is not the cost that binds, though: memory is. This value is read off a header before anything is decoded, so what it really sets is how large a buffer a file's own declared dimensions may talk this hook into allocating -- at 4 bytes per pixel, raising it from 16,000,000 raised that peak from ~64MB to ~256MB, which is why it now sits flush against MAX_DECODED_BYTES rather than comfortably below it. And on the JPEG path there is no assertDecodableSize call at all: decodeJpeg hands the buffer to jpeg-js, so a JPEG decode is bounded by whatever maxResolutionInMP/maxMemoryUsageInMB that call passes -- a bound this codebase states only because decodeJpeg passes both explicitly rather than inheriting jpeg-js's own 100MP default, which is looser than the 67.1MP MAX_DECODED_BYTES allows.
|
|
1425
|
+
max_image_pixels: 64e6,
|
|
1425
1426
|
screenshot_redirect: true,
|
|
1426
1427
|
ocr_enabled: true,
|
|
1427
1428
|
// Confidence is Tesseract's own 0-100 mean-word-confidence score. 65 is a deliberately
|
|
@@ -1566,7 +1567,7 @@ var CONFIG_DEFAULTS = {
|
|
|
1566
1567
|
offline: false
|
|
1567
1568
|
},
|
|
1568
1569
|
mcp: {
|
|
1569
|
-
confine_reads_to_project_root:
|
|
1570
|
+
confine_reads_to_project_root: false,
|
|
1570
1571
|
allowed_roots: []
|
|
1571
1572
|
},
|
|
1572
1573
|
hint_stats: {
|
|
@@ -4,26 +4,27 @@ import {
|
|
|
4
4
|
buildEvent,
|
|
5
5
|
relay,
|
|
6
6
|
relayInProcess
|
|
7
|
-
} from "./token-goat-chunk-
|
|
8
|
-
import "./token-goat-chunk-
|
|
7
|
+
} from "./token-goat-chunk-GMXBQS6O.mjs";
|
|
8
|
+
import "./token-goat-chunk-UXHDBVUR.mjs";
|
|
9
9
|
import {
|
|
10
10
|
MAX_STDIN_BYTES,
|
|
11
11
|
readStdinJson
|
|
12
|
-
} from "./token-goat-chunk-
|
|
13
|
-
import "./token-goat-chunk-
|
|
14
|
-
import "./token-goat-chunk-
|
|
12
|
+
} from "./token-goat-chunk-UMXD2M7O.mjs";
|
|
13
|
+
import "./token-goat-chunk-XOHTFRDH.mjs";
|
|
14
|
+
import "./token-goat-chunk-5USHO7B6.mjs";
|
|
15
|
+
import "./token-goat-chunk-DMQ32ZSR.mjs";
|
|
15
16
|
import "./token-goat-chunk-3BTK54F3.mjs";
|
|
16
|
-
import "./token-goat-chunk-
|
|
17
|
-
import "./token-goat-chunk-
|
|
18
|
-
import "./token-goat-chunk-
|
|
19
|
-
import "./token-goat-chunk-
|
|
20
|
-
import "./token-goat-chunk-K7F2BFIK.mjs";
|
|
21
|
-
import "./token-goat-chunk-S4XRY446.mjs";
|
|
17
|
+
import "./token-goat-chunk-BFNTLGVA.mjs";
|
|
18
|
+
import "./token-goat-chunk-63QWJ6UM.mjs";
|
|
19
|
+
import "./token-goat-chunk-R3X5TCPB.mjs";
|
|
20
|
+
import "./token-goat-chunk-H3DXI6VD.mjs";
|
|
22
21
|
import "./token-goat-chunk-EEIDFMEM.mjs";
|
|
23
22
|
import "./token-goat-chunk-OSUFN2FV.mjs";
|
|
24
|
-
import "./token-goat-chunk-
|
|
23
|
+
import "./token-goat-chunk-3H6FQT62.mjs";
|
|
25
24
|
import "./token-goat-chunk-ERTXEKB6.mjs";
|
|
25
|
+
import "./token-goat-chunk-Y4AFKTHK.mjs";
|
|
26
26
|
import "./token-goat-chunk-GMOUBOX4.mjs";
|
|
27
|
+
import "./token-goat-chunk-RRNZMM3A.mjs";
|
|
27
28
|
import "./token-goat-chunk-A37V4PBF.mjs";
|
|
28
29
|
export {
|
|
29
30
|
MAX_STDIN_BYTES,
|
|
@@ -280,7 +280,7 @@ async function extractPdfText(data, pagesSpec, layout = false) {
|
|
|
280
280
|
for (let i = start; i <= end; i++) {
|
|
281
281
|
const page = await getPageWithinDeadline(doc, i, deadline);
|
|
282
282
|
const textItems = await readPageTextItems(page, MAX_PDF_TEXT_BYTES - spent, deadline);
|
|
283
|
-
const pageText = layout ? reconstructLayout(textItems, deadline) : textItems
|
|
283
|
+
const pageText = layout ? reconstructLayout(textItems, deadline) : joinTextItems(textItems, "\n");
|
|
284
284
|
spent += pageText.length;
|
|
285
285
|
pages.push(pageText.trim());
|
|
286
286
|
}
|
|
@@ -306,7 +306,7 @@ async function locatePdfPages(data, pattern, opts) {
|
|
|
306
306
|
for (; i <= end && matches.length < maxMatches; i++) {
|
|
307
307
|
const page = await getPageWithinDeadline(doc, i, deadline);
|
|
308
308
|
const textItems = await readPageTextItems(page, MAX_PDF_TEXT_BYTES, deadline);
|
|
309
|
-
const pageText = textItems
|
|
309
|
+
const pageText = joinTextItems(textItems, " ");
|
|
310
310
|
const m = re.exec(pageText);
|
|
311
311
|
if (m === null) continue;
|
|
312
312
|
matches.push({ page: i, snippet: locateSnippet(pageText, m.index, m[0].length, context) });
|
|
@@ -315,6 +315,11 @@ async function locatePdfPages(data, pattern, opts) {
|
|
|
315
315
|
return { matches, truncated };
|
|
316
316
|
});
|
|
317
317
|
}
|
|
318
|
+
function joinTextItems(items, eol) {
|
|
319
|
+
let out = "";
|
|
320
|
+
for (const item of items) out += item.str + (item.hasEOL ? eol : "");
|
|
321
|
+
return out;
|
|
322
|
+
}
|
|
318
323
|
function locateSnippet(text, index, matchLen, context) {
|
|
319
324
|
const kept = Math.min(matchLen, context);
|
|
320
325
|
const pad = Math.max(0, context - kept);
|
|
@@ -2,11 +2,11 @@ import { createRequire as __cjsRequire } from 'node:module';
|
|
|
2
2
|
const require = __cjsRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
loadConfig
|
|
5
|
-
} from "./token-goat-chunk-
|
|
5
|
+
} from "./token-goat-chunk-H3DXI6VD.mjs";
|
|
6
6
|
import "./token-goat-chunk-EEIDFMEM.mjs";
|
|
7
7
|
import {
|
|
8
8
|
VERSION
|
|
9
|
-
} from "./token-goat-chunk-
|
|
9
|
+
} from "./token-goat-chunk-3H6FQT62.mjs";
|
|
10
10
|
import {
|
|
11
11
|
displaySafeJson
|
|
12
12
|
} from "./token-goat-chunk-ERTXEKB6.mjs";
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
createLazyModuleLoader
|
|
12
12
|
} from "./token-goat-chunk-AH6QILZM.mjs";
|
|
13
|
+
import {
|
|
14
|
+
pushAll
|
|
15
|
+
} from "./token-goat-chunk-3H6FQT62.mjs";
|
|
13
16
|
import {
|
|
14
17
|
DocumentRefusedError,
|
|
15
18
|
MAX_DOCUMENT_WORK_MILLIS
|
|
16
19
|
} from "./token-goat-chunk-Y4AFKTHK.mjs";
|
|
17
|
-
import {
|
|
18
|
-
pushAll
|
|
19
|
-
} from "./token-goat-chunk-PM76YS22.mjs";
|
|
20
20
|
import {
|
|
21
21
|
init_define_import_meta_env
|
|
22
22
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
@@ -332,6 +332,26 @@ function pushTextValue(runs, val) {
|
|
|
332
332
|
runs.push(String(val["#text"]));
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
+
var MATH_PARA_RE = /<m:oMathPara(?:\s[^>]*)?>([\s\S]*?)<\/m:oMathPara>/g;
|
|
336
|
+
var MATH_RE = /<m:oMath(?:\s[^>]*)?>([\s\S]*?)<\/m:oMath>/g;
|
|
337
|
+
var MATH_TEXT_RE = /<m:t(?:\s[^>]*)?>([^<]*)<\/m:t>/g;
|
|
338
|
+
function mathRunText(fragment) {
|
|
339
|
+
let out = "";
|
|
340
|
+
for (const m of fragment.matchAll(MATH_TEXT_RE)) out += m[1];
|
|
341
|
+
return out;
|
|
342
|
+
}
|
|
343
|
+
function inlineMathRuns(xml, openRun, closeRun) {
|
|
344
|
+
const asRun = (text) => text.length > 0 ? `${openRun}${text}${closeRun}` : "";
|
|
345
|
+
const withParas = xml.replace(MATH_PARA_RE, (_whole, inner) => {
|
|
346
|
+
const lines = [];
|
|
347
|
+
for (const m of inner.matchAll(MATH_RE)) {
|
|
348
|
+
const text = mathRunText(m[1]);
|
|
349
|
+
if (text.length > 0) lines.push(text);
|
|
350
|
+
}
|
|
351
|
+
return asRun(lines.length > 0 ? lines.join(" ") : mathRunText(inner));
|
|
352
|
+
});
|
|
353
|
+
return withParas.replace(MATH_RE, (_whole, inner) => asRun(mathRunText(inner)));
|
|
354
|
+
}
|
|
335
355
|
function collectTextRuns(node, tag, skipInside = []) {
|
|
336
356
|
const runs = [];
|
|
337
357
|
function walk(n) {
|
|
@@ -354,6 +374,21 @@ function collectTextRuns(node, tag, skipInside = []) {
|
|
|
354
374
|
walk(node);
|
|
355
375
|
return runs;
|
|
356
376
|
}
|
|
377
|
+
function dropAlternateContentFallbacks(node) {
|
|
378
|
+
if (Array.isArray(node)) {
|
|
379
|
+
node.forEach(dropAlternateContentFallbacks);
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
if (node === null || typeof node !== "object") return;
|
|
383
|
+
for (const [key, val] of Object.entries(node)) {
|
|
384
|
+
if (key === "mc:AlternateContent") {
|
|
385
|
+
for (const alt of Array.isArray(val) ? val : [val]) {
|
|
386
|
+
if (alt !== null && typeof alt === "object" && "mc:Choice" in alt && "mc:Fallback" in alt) delete alt["mc:Fallback"];
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
if (val !== null && typeof val === "object") dropAlternateContentFallbacks(val);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
357
392
|
function collectElements(node, tag, opts = {}) {
|
|
358
393
|
const skip = opts.skipInside;
|
|
359
394
|
const out = [];
|
|
@@ -413,7 +448,9 @@ export {
|
|
|
413
448
|
ooxmlPartBudget,
|
|
414
449
|
decodeZipEntry,
|
|
415
450
|
parseOoxmlPart,
|
|
451
|
+
inlineMathRuns,
|
|
416
452
|
collectTextRuns,
|
|
453
|
+
dropAlternateContentFallbacks,
|
|
417
454
|
collectElements,
|
|
418
455
|
collectParagraphTexts,
|
|
419
456
|
sortNumberedParts
|