@te-river/opencode-team-mode 1.5.0 → 1.5.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/README.md +62 -53
- package/README.zh-CN.md +58 -53
- package/dist/envprotect.d.ts +123 -0
- package/dist/envprotect.d.ts.map +1 -0
- package/dist/envprotect.js +467 -0
- package/dist/envprotect.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -1
- package/dist/index.js.map +1 -1
- package/dist/tm/config.d.ts +71 -0
- package/dist/tm/config.d.ts.map +1 -0
- package/dist/tm/config.js +97 -0
- package/dist/tm/config.js.map +1 -0
- package/dist/tm/guard.d.ts +56 -0
- package/dist/tm/guard.d.ts.map +1 -0
- package/dist/tm/guard.js +249 -0
- package/dist/tm/guard.js.map +1 -0
- package/dist/tm/index.d.ts +39 -0
- package/dist/tm/index.d.ts.map +1 -0
- package/dist/tm/index.js +63 -0
- package/dist/tm/index.js.map +1 -0
- package/dist/tm/preview.d.ts +46 -0
- package/dist/tm/preview.d.ts.map +1 -0
- package/dist/tm/preview.js +354 -0
- package/dist/tm/preview.js.map +1 -0
- package/dist/tm/refs.d.ts +37 -0
- package/dist/tm/refs.d.ts.map +1 -0
- package/dist/tm/refs.js +58 -0
- package/dist/tm/refs.js.map +1 -0
- package/dist/tm/store.d.ts +95 -0
- package/dist/tm/store.d.ts.map +1 -0
- package/dist/tm/store.js +222 -0
- package/dist/tm/store.js.map +1 -0
- package/dist/tm/tools.d.ts +68 -0
- package/dist/tm/tools.d.ts.map +1 -0
- package/dist/tm/tools.js +706 -0
- package/dist/tm/tools.js.map +1 -0
- package/dist/types.d.ts +51 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JIT layer-2 tools — content-aware previews (the soul of the offload handle)
|
|
3
|
+
* plus the L1 "structure" summaries for tm_fetch mode:"structure".
|
|
4
|
+
*
|
|
5
|
+
* Five branches, chosen by content_type (path hint) with sniffing fallback:
|
|
6
|
+
* json -> first 3 keys: path + type + magnitude
|
|
7
|
+
* csv -> header + 2 sample rows + total rows x cols
|
|
8
|
+
* log -> first 3 lines + pattern stats (ERROR x N, ...) + path:line refs
|
|
9
|
+
* code -> function/class signature list (with line numbers)
|
|
10
|
+
* binary -> type + size + "不可预览"
|
|
11
|
+
*
|
|
12
|
+
* RED LINE: previews are hard-capped at TM_PREVIEW_MAX_TOKENS (default 80
|
|
13
|
+
* estimated tokens). A bloated preview is an R4 regression — the cap is
|
|
14
|
+
* enforced by composition (body budget = cap - meta) so clue + hint lines
|
|
15
|
+
* always survive truncation.
|
|
16
|
+
*/
|
|
17
|
+
import * as path from "node:path";
|
|
18
|
+
import { estimateTokens, shorten } from "./config.js";
|
|
19
|
+
const CODE_EXTENSIONS = new Set([
|
|
20
|
+
".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".py", ".go", ".rs", ".java",
|
|
21
|
+
".c", ".h", ".cpp", ".hpp", ".cs", ".rb", ".php", ".swift", ".kt", ".kts",
|
|
22
|
+
".scala", ".sh", ".bash", ".ps1", ".psm1", ".sql", ".css", ".scss", ".less",
|
|
23
|
+
".html", ".htm", ".vue", ".svelte", ".lua", ".pl", ".r", ".dart",
|
|
24
|
+
]);
|
|
25
|
+
const BINARY_EXTENSIONS = new Set([
|
|
26
|
+
".png", ".jpg", ".jpeg", ".gif", ".webp", ".ico", ".bmp", ".pdf", ".zip",
|
|
27
|
+
".gz", ".tgz", ".tar", ".bz2", ".7z", ".rar", ".exe", ".dll", ".so",
|
|
28
|
+
".dylib", ".bin", ".dat", ".woff", ".woff2", ".ttf", ".otf", ".eot",
|
|
29
|
+
".mp3", ".wav", ".flac", ".mp4", ".mov", ".avi", ".mkv", ".sqlite", ".db",
|
|
30
|
+
".class", ".jar", ".wasm", ".node", ".pyc",
|
|
31
|
+
]);
|
|
32
|
+
/** Content type derived from the file extension (deterministic hint). */
|
|
33
|
+
export function contentTypeForPath(p) {
|
|
34
|
+
const ext = path.extname(String(p ?? "")).toLowerCase();
|
|
35
|
+
if (ext === ".json" || ext === ".jsonc")
|
|
36
|
+
return "json";
|
|
37
|
+
if (ext === ".csv" || ext === ".tsv")
|
|
38
|
+
return "csv";
|
|
39
|
+
if (ext === ".log")
|
|
40
|
+
return "log";
|
|
41
|
+
if (BINARY_EXTENSIONS.has(ext))
|
|
42
|
+
return "binary";
|
|
43
|
+
if (CODE_EXTENSIONS.has(ext))
|
|
44
|
+
return "code";
|
|
45
|
+
return "text";
|
|
46
|
+
}
|
|
47
|
+
function looksBinary(sample) {
|
|
48
|
+
if (sample.includes("\0"))
|
|
49
|
+
return true;
|
|
50
|
+
let bad = 0;
|
|
51
|
+
for (const ch of sample) {
|
|
52
|
+
const c = ch.codePointAt(0) ?? 0;
|
|
53
|
+
if (c < 9 || (c > 13 && c < 32))
|
|
54
|
+
bad++;
|
|
55
|
+
}
|
|
56
|
+
return sample.length > 0 && bad / sample.length > 0.05;
|
|
57
|
+
}
|
|
58
|
+
/** Consistent column delimiter across the first few non-empty lines, if any. */
|
|
59
|
+
function detectDelimiter(lines) {
|
|
60
|
+
const head = lines.slice(0, Math.min(4, lines.length));
|
|
61
|
+
for (const d of [",", "\t", ";", "|"]) {
|
|
62
|
+
const counts = head.map((l) => l.split(d).length);
|
|
63
|
+
if (Math.min(...counts) >= 2 && counts.every((c) => c === counts[0]))
|
|
64
|
+
return d;
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Sniff content type when no path hint exists (or the hint was plain "text").
|
|
70
|
+
* Order: binary -> json -> csv -> code -> text. Logs and plain text share
|
|
71
|
+
* the same preview branch, so no separate sniff rule is needed for them.
|
|
72
|
+
*/
|
|
73
|
+
export function sniffContentType(content) {
|
|
74
|
+
const sample = content.slice(0, 4096);
|
|
75
|
+
if (looksBinary(sample))
|
|
76
|
+
return "binary";
|
|
77
|
+
const trimmed = content.trimStart();
|
|
78
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("["))
|
|
79
|
+
return "json";
|
|
80
|
+
const lines = content.split(/\r?\n/).filter((l) => l.trim()).slice(0, 5);
|
|
81
|
+
if (lines.length >= 2 && detectDelimiter(lines))
|
|
82
|
+
return "csv";
|
|
83
|
+
if (/(?:^|\n)\s*(?:export\s+)?(?:async\s+)?(?:function|class|interface|def)\b/.test(sample) ||
|
|
84
|
+
/(?:^|\n)\s*(?:import|from|package|using|namespace)\b/.test(sample)) {
|
|
85
|
+
return "code";
|
|
86
|
+
}
|
|
87
|
+
return "text";
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Resolve the effective branch: a path-derived hint wins (deterministic);
|
|
91
|
+
* plain-text hints and missing hints fall through to sniffing (which may
|
|
92
|
+
* still upgrade the content to json / csv / code / binary).
|
|
93
|
+
*/
|
|
94
|
+
export function detectContentType(content, hint) {
|
|
95
|
+
if (hint && hint !== "text")
|
|
96
|
+
return hint;
|
|
97
|
+
return sniffContentType(content);
|
|
98
|
+
}
|
|
99
|
+
/** Hard cap by estimated tokens (chars/4): never exceed maxTokens. */
|
|
100
|
+
export function capTokens(text, maxTokens) {
|
|
101
|
+
const marker = " …(截断)";
|
|
102
|
+
const maxChars = Math.max(8, maxTokens * 4);
|
|
103
|
+
if (text.length <= maxChars)
|
|
104
|
+
return text;
|
|
105
|
+
const usable = maxChars - marker.length; // marker lives INSIDE the budget
|
|
106
|
+
const cut = text.slice(0, usable);
|
|
107
|
+
const trimmed = cut.replace(/\s+\S*$/, ""); // back off to the last word boundary
|
|
108
|
+
const body = trimmed.length >= usable * 0.6 ? trimmed : cut;
|
|
109
|
+
return body + marker;
|
|
110
|
+
}
|
|
111
|
+
// ---------- five preview branches ----------
|
|
112
|
+
function describeJsonValue(v) {
|
|
113
|
+
if (v === null)
|
|
114
|
+
return "null";
|
|
115
|
+
switch (typeof v) {
|
|
116
|
+
case "string":
|
|
117
|
+
return `string(len=${v.length})`;
|
|
118
|
+
case "number":
|
|
119
|
+
case "boolean":
|
|
120
|
+
return `${typeof v}=${v}`;
|
|
121
|
+
case "object":
|
|
122
|
+
return Array.isArray(v)
|
|
123
|
+
? `array[len=${v.length}]`
|
|
124
|
+
: `object[keys=${Object.keys(v).length}]`;
|
|
125
|
+
default:
|
|
126
|
+
return typeof v;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function jsonPreview(content) {
|
|
130
|
+
const text = content.trim();
|
|
131
|
+
if (!text.startsWith("{") && !text.startsWith("["))
|
|
132
|
+
return null;
|
|
133
|
+
let obj;
|
|
134
|
+
try {
|
|
135
|
+
obj = JSON.parse(text);
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
if (Array.isArray(obj)) {
|
|
141
|
+
return `array[len=${obj.length}],元素样本: ${obj.slice(0, 3).map(describeJsonValue).join(", ")}`;
|
|
142
|
+
}
|
|
143
|
+
if (obj && typeof obj === "object") {
|
|
144
|
+
const entries = Object.entries(obj);
|
|
145
|
+
const head = entries.slice(0, 3).map(([k, v]) => `${k}: ${describeJsonValue(v)}`);
|
|
146
|
+
const more = entries.length > 3 ? `(其余 ${entries.length - 3} 键省略)` : "";
|
|
147
|
+
return head.join("; ") + more;
|
|
148
|
+
}
|
|
149
|
+
return `scalar: ${describeJsonValue(obj)}`;
|
|
150
|
+
}
|
|
151
|
+
function csvPreview(content) {
|
|
152
|
+
const lines = content.split(/\r?\n/).filter((l) => l.trim());
|
|
153
|
+
if (lines.length < 2)
|
|
154
|
+
return null;
|
|
155
|
+
const delim = detectDelimiter(lines);
|
|
156
|
+
if (!delim)
|
|
157
|
+
return null;
|
|
158
|
+
const cols = lines[0].split(delim).length;
|
|
159
|
+
const shown = [lines[0], ...lines.slice(1, 3)].map((l) => shorten(l, 110));
|
|
160
|
+
const label = delim === "\t" ? "TAB" : delim;
|
|
161
|
+
shown.push(`共 ${lines.length} 行 × ${cols} 列(分隔符 "${label}")`);
|
|
162
|
+
return shown.join("\n");
|
|
163
|
+
}
|
|
164
|
+
const PATH_LINE_REF = /(?:[A-Za-z0-9_.\-]+[\\/])*[A-Za-z0-9_.\-]+\.[A-Za-z0-9]{1,8}:\d{1,6}/g;
|
|
165
|
+
function collectPathLineRefs(content, max) {
|
|
166
|
+
const seen = new Set();
|
|
167
|
+
for (const m of content.matchAll(PATH_LINE_REF)) {
|
|
168
|
+
seen.add(m[0]);
|
|
169
|
+
if (seen.size >= max)
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
return [...seen];
|
|
173
|
+
}
|
|
174
|
+
/** log + plain text share one branch: head lines + pattern stats + refs. */
|
|
175
|
+
function textPreview(content) {
|
|
176
|
+
const lines = content.split(/\r?\n/);
|
|
177
|
+
const head = lines.filter((l) => l.trim()).slice(0, 3).map((l) => shorten(l, 90));
|
|
178
|
+
const count = (re) => (content.match(re) ?? []).length;
|
|
179
|
+
const fatal = count(/\bFATAL\b/g);
|
|
180
|
+
const error = count(/\bERROR\b/g);
|
|
181
|
+
const warn = count(/\bWARN(?:ING)?\b/g);
|
|
182
|
+
const info = count(/\bINFO\b/g);
|
|
183
|
+
const stats = [
|
|
184
|
+
fatal ? `FATAL×${fatal}` : "",
|
|
185
|
+
error ? `ERROR×${error}` : "",
|
|
186
|
+
warn ? `WARN×${warn}` : "",
|
|
187
|
+
info ? `INFO×${info}` : "",
|
|
188
|
+
].filter(Boolean).join(" ");
|
|
189
|
+
const refs = collectPathLineRefs(content, 3);
|
|
190
|
+
const parts = [head.length ? head.join("\n") : "(空内容)", `共 ${lines.length} 行`];
|
|
191
|
+
if (stats)
|
|
192
|
+
parts.push(stats);
|
|
193
|
+
if (refs.length)
|
|
194
|
+
parts.push(`位置: ${refs.join(", ")}`);
|
|
195
|
+
return parts.join("\n");
|
|
196
|
+
}
|
|
197
|
+
const SIGNATURE_PATTERNS = [
|
|
198
|
+
["function", /(?:export\s+)?(?:default\s+)?(?:async\s+)?function\s*\*?\s*([A-Za-z0-9_$]+)/g],
|
|
199
|
+
["class", /(?:export\s+)?(?:abstract\s+)?class\s+([A-Za-z0-9_$]+)/g],
|
|
200
|
+
["interface", /(?:export\s+)?interface\s+([A-Za-z0-9_$]+)/g],
|
|
201
|
+
["type", /(?:export\s+)?type\s+([A-Za-z0-9_$]+)\s*[=<]/g],
|
|
202
|
+
["def", /^[ \t]*(?:async\s+)?def\s+([A-Za-z0-9_]+)/gm],
|
|
203
|
+
["fn", /^[ \t]*(?:pub(?:\([^)]*\))?\s+)?fn\s+([A-Za-z0-9_]+)/gm],
|
|
204
|
+
["const-fn", /(?:export\s+)?(?:const|let|var)\s+([A-Za-z0-9_$]+)\s*=\s*(?:async\s*)?\(/g],
|
|
205
|
+
];
|
|
206
|
+
function lineOfIndex(content, index) {
|
|
207
|
+
let line = 1;
|
|
208
|
+
for (let i = 0; i < index && i < content.length; i++) {
|
|
209
|
+
if (content.charCodeAt(i) === 10)
|
|
210
|
+
line++;
|
|
211
|
+
}
|
|
212
|
+
return line;
|
|
213
|
+
}
|
|
214
|
+
function codePreview(content, maxSignatures = 10) {
|
|
215
|
+
const found = [];
|
|
216
|
+
for (const [kind, re] of SIGNATURE_PATTERNS) {
|
|
217
|
+
for (const m of content.matchAll(re)) {
|
|
218
|
+
found.push(`L${lineOfIndex(content, m.index ?? 0)}: ${kind} ${m[1]}`);
|
|
219
|
+
if (found.length >= maxSignatures)
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
if (found.length >= maxSignatures)
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
if (found.length === 0)
|
|
226
|
+
return null;
|
|
227
|
+
const more = found.length >= maxSignatures ? "(更多签名省略)" : "";
|
|
228
|
+
return found.join("\n") + more;
|
|
229
|
+
}
|
|
230
|
+
function binaryPreview(content) {
|
|
231
|
+
return `二进制内容(binary),大小 ${content.length} bytes,不可预览`;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Compose body + clue + one-line hint, then enforce the token cap WITHOUT
|
|
235
|
+
* cutting the meta lines (body gets the residual budget; if the cap is too
|
|
236
|
+
* tight for meaningful body content the meta shrinks first, body last).
|
|
237
|
+
*/
|
|
238
|
+
function composeCapped(body, clue, maxTokens) {
|
|
239
|
+
const HINT = "提示: 先聚合再决定是否取原文(tm_fetch 分段取回)";
|
|
240
|
+
let meta = clue ? `线索: ${clue}\n${HINT}` : HINT;
|
|
241
|
+
let budget = maxTokens - estimateTokens(meta) - 1;
|
|
242
|
+
if (budget < 20) {
|
|
243
|
+
meta = HINT;
|
|
244
|
+
budget = maxTokens - estimateTokens(meta) - 1;
|
|
245
|
+
}
|
|
246
|
+
if (budget < 20) {
|
|
247
|
+
meta = "";
|
|
248
|
+
budget = maxTokens;
|
|
249
|
+
}
|
|
250
|
+
const cappedBody = capTokens(body, budget);
|
|
251
|
+
return meta ? `${cappedBody}\n${meta}` : cappedBody;
|
|
252
|
+
}
|
|
253
|
+
/** Build the governed preview for offloaded content. Never throws. */
|
|
254
|
+
export function buildPreview(content, contentType, opts = {}) {
|
|
255
|
+
const maxTokens = Math.max(10, Math.trunc(opts.maxTokens ?? 80));
|
|
256
|
+
let body;
|
|
257
|
+
try {
|
|
258
|
+
switch (contentType) {
|
|
259
|
+
case "binary":
|
|
260
|
+
body = binaryPreview(content);
|
|
261
|
+
break;
|
|
262
|
+
case "json":
|
|
263
|
+
body = jsonPreview(content) ?? textPreview(content);
|
|
264
|
+
break;
|
|
265
|
+
case "csv":
|
|
266
|
+
body = csvPreview(content) ?? textPreview(content);
|
|
267
|
+
break;
|
|
268
|
+
case "code":
|
|
269
|
+
body = codePreview(content) ?? textPreview(content);
|
|
270
|
+
break;
|
|
271
|
+
default:
|
|
272
|
+
body = textPreview(content);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
catch {
|
|
276
|
+
body = textPreview(content);
|
|
277
|
+
}
|
|
278
|
+
return composeCapped(body, opts.clue, maxTokens);
|
|
279
|
+
}
|
|
280
|
+
// ---------- L1 structure summaries (tm_fetch mode:"structure") ----------
|
|
281
|
+
function structureJson(content) {
|
|
282
|
+
let obj;
|
|
283
|
+
try {
|
|
284
|
+
obj = JSON.parse(content.trim());
|
|
285
|
+
}
|
|
286
|
+
catch {
|
|
287
|
+
return null;
|
|
288
|
+
}
|
|
289
|
+
if (Array.isArray(obj))
|
|
290
|
+
return `array[len=${obj.length}]`;
|
|
291
|
+
if (obj && typeof obj === "object") {
|
|
292
|
+
const entries = Object.entries(obj).slice(0, 15);
|
|
293
|
+
return entries.map(([k, v]) => `${k}: ${describeJsonValue(v)}`).join("\n");
|
|
294
|
+
}
|
|
295
|
+
return `scalar: ${describeJsonValue(obj)}`;
|
|
296
|
+
}
|
|
297
|
+
function structureCsv(content) {
|
|
298
|
+
const lines = content.split(/\r?\n/).filter((l) => l.trim());
|
|
299
|
+
if (lines.length < 2)
|
|
300
|
+
return null;
|
|
301
|
+
const delim = detectDelimiter(lines);
|
|
302
|
+
if (!delim)
|
|
303
|
+
return null;
|
|
304
|
+
const cols = lines[0].split(delim).length;
|
|
305
|
+
return `表头: ${shorten(lines[0], 100)}\n共 ${lines.length} 行 × ${cols} 列`;
|
|
306
|
+
}
|
|
307
|
+
function structureText(content) {
|
|
308
|
+
const lines = content.split(/\r?\n/);
|
|
309
|
+
const errLines = [];
|
|
310
|
+
const warnLines = [];
|
|
311
|
+
const headings = [];
|
|
312
|
+
for (let i = 0; i < lines.length; i++) {
|
|
313
|
+
if (errLines.length < 8 && /\bERROR\b/.test(lines[i]))
|
|
314
|
+
errLines.push(i + 1);
|
|
315
|
+
else if (warnLines.length < 8 && /\bWARN(?:ING)?\b/.test(lines[i]))
|
|
316
|
+
warnLines.push(i + 1);
|
|
317
|
+
if (headings.length < 6 && /^#{1,3}\s+\S/.test(lines[i])) {
|
|
318
|
+
headings.push(`L${i + 1}: ${shorten(lines[i].trim(), 60)}`);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
const parts = [`共 ${lines.length} 行`];
|
|
322
|
+
if (errLines.length)
|
|
323
|
+
parts.push(`ERROR 行: ${errLines.join(",")}`);
|
|
324
|
+
if (warnLines.length)
|
|
325
|
+
parts.push(`WARN 行: ${warnLines.join(",")}`);
|
|
326
|
+
if (headings.length)
|
|
327
|
+
parts.push(headings.join("\n"));
|
|
328
|
+
return parts.join("\n");
|
|
329
|
+
}
|
|
330
|
+
/** ~100-token-level L1 map of an offloaded payload (TOC / key tree / error lines). */
|
|
331
|
+
export function buildStructureSummary(content, contentType) {
|
|
332
|
+
let summary;
|
|
333
|
+
try {
|
|
334
|
+
switch (contentType) {
|
|
335
|
+
case "json":
|
|
336
|
+
summary = structureJson(content) ?? structureText(content);
|
|
337
|
+
break;
|
|
338
|
+
case "csv":
|
|
339
|
+
summary = structureCsv(content) ?? structureText(content);
|
|
340
|
+
break;
|
|
341
|
+
case "code":
|
|
342
|
+
summary = (codePreview(content, 12) ?? structureText(content)) +
|
|
343
|
+
`\n共 ${content.split(/\r?\n/).length} 行`;
|
|
344
|
+
break;
|
|
345
|
+
default:
|
|
346
|
+
summary = structureText(content);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
catch {
|
|
350
|
+
summary = structureText(content);
|
|
351
|
+
}
|
|
352
|
+
return capTokens(summary, 100);
|
|
353
|
+
}
|
|
354
|
+
//# sourceMappingURL=preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../src/tm/preview.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAIrD,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KA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,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAClE,IAAI,QAAQ,CAAC,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACpD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,qBAAqB,CAAC,OAAe,EAAE,WAAmB;IACxE,IAAI,OAAe,CAAA;IACnB,IAAI,CAAC;QACH,QAAQ,WAAW,EAAE,CAAC;YACpB,KAAK,MAAM;gBACT,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,CAAA;gBAC1D,MAAK;YACP,KAAK,KAAK;gBACR,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,CAAA;gBACzD,MAAK;YACP,KAAK,MAAM;gBACT,OAAO,GAAG,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;oBAC5D,OAAO,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,IAAI,CAAA;gBAC1C,MAAK;YACP;gBACE,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,CAAA;QACpC,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,CAAA;IAClC,CAAC;IACD,OAAO,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;AAChC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JIT layer-2 tools — run identity + offload handle crypto.
|
|
3
|
+
*
|
|
4
|
+
* A handle is {ref, access_token, expire_at}:
|
|
5
|
+
* - ref = tm://runs/{run_id}/steps/{step_id}/result
|
|
6
|
+
* - access_token = HMAC-SHA256(process-start random key, run_id)
|
|
7
|
+
* (may also ride the ref as a `#<hex>` fragment — tm_fetch accepts both)
|
|
8
|
+
* - expire_at = creation time + TM_BLACKBOARD_TTL (default 7 days)
|
|
9
|
+
*
|
|
10
|
+
* The key lives only in process memory; a model can carry a handle around
|
|
11
|
+
* but cannot forge one for another run, and a handle from an earlier
|
|
12
|
+
* process is dead the moment that process ends (new key, new run id).
|
|
13
|
+
*/
|
|
14
|
+
import * as crypto from "node:crypto";
|
|
15
|
+
/** Compact run id: `r-<yyyyMMdd-HHmmss>-<6 hex>` (generated once per server()). */
|
|
16
|
+
export declare function newRunId(now?: Date): string;
|
|
17
|
+
/** HMAC-SHA256(key, runId) as hex — the handle access token. */
|
|
18
|
+
export declare function hmacToken(key: crypto.BinaryLike, runId: string): string;
|
|
19
|
+
/** Constant-time token check (length-compare guard before timingSafeEqual). */
|
|
20
|
+
export declare function verifyToken(key: crypto.BinaryLike, runId: string, token: unknown): boolean;
|
|
21
|
+
/** Strict ref grammar; the token fragment is optional. */
|
|
22
|
+
export declare const REF_PATTERN: RegExp;
|
|
23
|
+
export declare function buildRef(runId: string, stepId: string): string;
|
|
24
|
+
export interface ParsedRef {
|
|
25
|
+
runId: string;
|
|
26
|
+
stepId: string;
|
|
27
|
+
token?: string;
|
|
28
|
+
}
|
|
29
|
+
/** Parse a ref; null when malformed (wrong scheme, extra segments, junk). */
|
|
30
|
+
export declare function parseRef(ref: unknown): ParsedRef | null;
|
|
31
|
+
/**
|
|
32
|
+
* True when `expireAt` (ms epoch) is strictly in the past at `now`.
|
|
33
|
+
* Non-numeric expire_at fails CLOSED (treated as expired) — entries are
|
|
34
|
+
* plugin-written, so a malformed one must not extend a handle's life.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isExpired(expireAt: unknown, now?: number): boolean;
|
|
37
|
+
//# sourceMappingURL=refs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../../src/tm/refs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC,mFAAmF;AACnF,wBAAgB,QAAQ,CAAC,GAAG,GAAE,IAAiB,GAAG,MAAM,CAMvD;AAED,gEAAgE;AAChE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED,+EAA+E;AAC/E,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAI1F;AAED,0DAA0D;AAC1D,eAAO,MAAM,WAAW,QACsD,CAAA;AAE9E,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,6EAA6E;AAC7E,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAMvD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,GAAE,MAAmB,GAAG,OAAO,CAI9E"}
|
package/dist/tm/refs.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JIT layer-2 tools — run identity + offload handle crypto.
|
|
3
|
+
*
|
|
4
|
+
* A handle is {ref, access_token, expire_at}:
|
|
5
|
+
* - ref = tm://runs/{run_id}/steps/{step_id}/result
|
|
6
|
+
* - access_token = HMAC-SHA256(process-start random key, run_id)
|
|
7
|
+
* (may also ride the ref as a `#<hex>` fragment — tm_fetch accepts both)
|
|
8
|
+
* - expire_at = creation time + TM_BLACKBOARD_TTL (default 7 days)
|
|
9
|
+
*
|
|
10
|
+
* The key lives only in process memory; a model can carry a handle around
|
|
11
|
+
* but cannot forge one for another run, and a handle from an earlier
|
|
12
|
+
* process is dead the moment that process ends (new key, new run id).
|
|
13
|
+
*/
|
|
14
|
+
import * as crypto from "node:crypto";
|
|
15
|
+
/** Compact run id: `r-<yyyyMMdd-HHmmss>-<6 hex>` (generated once per server()). */
|
|
16
|
+
export function newRunId(now = new Date()) {
|
|
17
|
+
const p = (n) => String(n).padStart(2, "0");
|
|
18
|
+
const ts = `${now.getFullYear()}${p(now.getMonth() + 1)}${p(now.getDate())}` +
|
|
19
|
+
`-${p(now.getHours())}${p(now.getMinutes())}${p(now.getSeconds())}`;
|
|
20
|
+
return `r-${ts}-${crypto.randomBytes(3).toString("hex")}`;
|
|
21
|
+
}
|
|
22
|
+
/** HMAC-SHA256(key, runId) as hex — the handle access token. */
|
|
23
|
+
export function hmacToken(key, runId) {
|
|
24
|
+
return crypto.createHmac("sha256", key).update(runId).digest("hex");
|
|
25
|
+
}
|
|
26
|
+
/** Constant-time token check (length-compare guard before timingSafeEqual). */
|
|
27
|
+
export function verifyToken(key, runId, token) {
|
|
28
|
+
const expected = Buffer.from(hmacToken(key, runId), "utf8");
|
|
29
|
+
const given = Buffer.from(String(token ?? ""), "utf8");
|
|
30
|
+
return given.length === expected.length && crypto.timingSafeEqual(expected, given);
|
|
31
|
+
}
|
|
32
|
+
/** Strict ref grammar; the token fragment is optional. */
|
|
33
|
+
export const REF_PATTERN = /^tm:\/\/runs\/([^/\s]+)\/steps\/([^/\s]+)\/result(?:#([0-9a-fA-F]{16,}))?$/;
|
|
34
|
+
export function buildRef(runId, stepId) {
|
|
35
|
+
return `tm://runs/${runId}/steps/${stepId}/result`;
|
|
36
|
+
}
|
|
37
|
+
/** Parse a ref; null when malformed (wrong scheme, extra segments, junk). */
|
|
38
|
+
export function parseRef(ref) {
|
|
39
|
+
const m = REF_PATTERN.exec(String(ref ?? "").trim());
|
|
40
|
+
if (!m)
|
|
41
|
+
return null;
|
|
42
|
+
const parsed = { runId: m[1], stepId: m[2] };
|
|
43
|
+
if (m[3])
|
|
44
|
+
parsed.token = m[3];
|
|
45
|
+
return parsed;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* True when `expireAt` (ms epoch) is strictly in the past at `now`.
|
|
49
|
+
* Non-numeric expire_at fails CLOSED (treated as expired) — entries are
|
|
50
|
+
* plugin-written, so a malformed one must not extend a handle's life.
|
|
51
|
+
*/
|
|
52
|
+
export function isExpired(expireAt, now = Date.now()) {
|
|
53
|
+
const t = Number(expireAt);
|
|
54
|
+
if (!Number.isFinite(t))
|
|
55
|
+
return true;
|
|
56
|
+
return now > t;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=refs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refs.js","sourceRoot":"","sources":["../../src/tm/refs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC,mFAAmF;AACnF,MAAM,UAAU,QAAQ,CAAC,MAAY,IAAI,IAAI,EAAE;IAC7C,MAAM,CAAC,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;IACnD,MAAM,EAAE,GACN,GAAG,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,EAAE;QACjE,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,EAAE,CAAA;IACrE,OAAO,KAAK,EAAE,IAAI,MAAM,CAAC,WAAW,CAAC,CAAC,CAA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C;QAAE,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC7B,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,QAAiB,EAAE,MAAc,IAAI,CAAC,GAAG,EAAE;IACnE,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;IAC1B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAA;IACpC,OAAO,GAAG,GAAG,CAAC,CAAA;AAChB,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JIT layer-2 tools — run-payload store + trajectory.
|
|
3
|
+
*
|
|
4
|
+
* Blackboard layout (under TM_BLACKBOARD_DIR, default `<project>/.blackboard/`):
|
|
5
|
+
* runs/{run_id}/steps/{step_id}/{seq:03d}-{tool}.md full offloaded result
|
|
6
|
+
* runs/{run_id}/index.jsonl one append per result
|
|
7
|
+
* entry = { ts, run_id, step_id, seq, tool, ref, file, tokens,
|
|
8
|
+
* content_type, expire_at, preview }
|
|
9
|
+
*
|
|
10
|
+
* Trajectory layout (under TM_TRAJECTORY_DIR, default `<project>/.trajectory/`):
|
|
11
|
+
* runs/{run_id}/steps.jsonl append-only, one line per event — NO code
|
|
12
|
+
* path may rewrite, truncate or delete lines;
|
|
13
|
+
* the TTL sweep of whole expired run dirs is
|
|
14
|
+
* the sanctioned reclamation path.
|
|
15
|
+
* runs/{run_id}/usage.jsonl RESERVED for T2.2 (constant below, unused).
|
|
16
|
+
*
|
|
17
|
+
* Reclamation philosophy mirrors blackboard.ts: a startup sweep removes run
|
|
18
|
+
* dirs idle past the TTL — idleness measured across the whole run-dir tree
|
|
19
|
+
* (file appends must count as activity; only this sweep is destructive).
|
|
20
|
+
*/
|
|
21
|
+
/** Reserved for T2.2 usage accounting — path constant only in this phase. */
|
|
22
|
+
export declare const USAGE_JSONL_RELPATH = "usage.jsonl";
|
|
23
|
+
export interface OffloadMeta {
|
|
24
|
+
tool: string;
|
|
25
|
+
content: string;
|
|
26
|
+
tokens: number;
|
|
27
|
+
contentType: string;
|
|
28
|
+
preview: string;
|
|
29
|
+
expireAt: number;
|
|
30
|
+
}
|
|
31
|
+
export interface StoredRef {
|
|
32
|
+
stepId: string;
|
|
33
|
+
seq: number;
|
|
34
|
+
file: string;
|
|
35
|
+
ref: string;
|
|
36
|
+
expireAt: number;
|
|
37
|
+
}
|
|
38
|
+
export interface IndexEntry {
|
|
39
|
+
ts: string;
|
|
40
|
+
run_id: string;
|
|
41
|
+
step_id: string;
|
|
42
|
+
seq: number;
|
|
43
|
+
tool: string;
|
|
44
|
+
ref: string;
|
|
45
|
+
file: string;
|
|
46
|
+
tokens: number;
|
|
47
|
+
content_type: string;
|
|
48
|
+
expire_at: number;
|
|
49
|
+
preview: string;
|
|
50
|
+
}
|
|
51
|
+
export interface RunStoreOptions {
|
|
52
|
+
projectRoot: string;
|
|
53
|
+
blackboardDir: string;
|
|
54
|
+
trajectoryDir: string;
|
|
55
|
+
runId: string;
|
|
56
|
+
ttlDays: number;
|
|
57
|
+
}
|
|
58
|
+
export declare class RunStore {
|
|
59
|
+
readonly blackboardRoot: string;
|
|
60
|
+
readonly trajectoryRoot: string;
|
|
61
|
+
private readonly _runId;
|
|
62
|
+
private readonly _ttlMs;
|
|
63
|
+
constructor(opts: RunStoreOptions);
|
|
64
|
+
get runId(): string;
|
|
65
|
+
private runDir;
|
|
66
|
+
stepsRoot(): string;
|
|
67
|
+
trajectoryFile(): string;
|
|
68
|
+
/**
|
|
69
|
+
* Write one offloaded result: step file (single write, never rewritten) +
|
|
70
|
+
* index.jsonl append. Throws on store failures — the caller degrades
|
|
71
|
+
* (governance failures must not fail the task).
|
|
72
|
+
*/
|
|
73
|
+
writeResult(stepId: string, meta: OffloadMeta): StoredRef;
|
|
74
|
+
/**
|
|
75
|
+
* Append one trajectory event. Append-only by contract; best-effort
|
|
76
|
+
* (trajectory failures are swallowed — the blackboard failure path is the
|
|
77
|
+
* one that degrades upstream).
|
|
78
|
+
*/
|
|
79
|
+
appendTrajectory(event: Record<string, unknown>): void;
|
|
80
|
+
/** Latest index entry for a ref (last append wins), or null. */
|
|
81
|
+
findIndexEntry(ref: string): IndexEntry | null;
|
|
82
|
+
/** Read the offloaded payload file of a step; null when gone/unreadable.
|
|
83
|
+
* With multiple seq files in one step (defensive re-entry), the LATEST
|
|
84
|
+
* seq wins — consistent with findIndexEntry's last-append-wins. */
|
|
85
|
+
readStepFile(stepId: string): {
|
|
86
|
+
content: string;
|
|
87
|
+
} | null;
|
|
88
|
+
/**
|
|
89
|
+
* Startup-only reclamation: remove run dirs (both stores) whose last tree
|
|
90
|
+
* activity is older than the TTL. This is the ONLY destructive path in
|
|
91
|
+
* this module. Returns the number of run dirs removed. Never throws.
|
|
92
|
+
*/
|
|
93
|
+
sweepExpired(now?: number): number;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/tm/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,gBAAgB,CAAA;AAKhD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,UAA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