@cchistory/lite 0.5.0 → 0.7.0
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/INSTALL.md +1 -1
- package/apps/lite-cli/dist/agent-contract.d.ts +5 -2
- package/apps/lite-cli/dist/agent-contract.d.ts.map +1 -1
- package/apps/lite-cli/dist/agent-contract.js +20 -9
- package/apps/lite-cli/dist/agent-contract.js.map +1 -1
- package/apps/lite-cli/dist/agent-journeys.test.d.ts +2 -0
- package/apps/lite-cli/dist/agent-journeys.test.d.ts.map +1 -0
- package/apps/lite-cli/dist/agent-journeys.test.js +403 -0
- package/apps/lite-cli/dist/agent-journeys.test.js.map +1 -0
- package/apps/lite-cli/dist/bin.js +3 -3
- package/apps/lite-cli/dist/bin.js.map +1 -1
- package/apps/lite-cli/dist/index.d.ts.map +1 -1
- package/apps/lite-cli/dist/index.js +55 -13
- package/apps/lite-cli/dist/index.js.map +1 -1
- package/apps/lite-cli/dist/index.test.js +34 -69
- package/apps/lite-cli/dist/index.test.js.map +1 -1
- package/apps/lite-cli/dist/query.d.ts +15 -2
- package/apps/lite-cli/dist/query.d.ts.map +1 -1
- package/apps/lite-cli/dist/query.js +79 -4
- package/apps/lite-cli/dist/query.js.map +1 -1
- package/apps/lite-cli/dist/shell.d.ts +2 -1
- package/apps/lite-cli/dist/shell.d.ts.map +1 -1
- package/apps/lite-cli/dist/shell.js +20 -16
- package/apps/lite-cli/dist/shell.js.map +1 -1
- package/apps/lite-cli/dist/version.d.ts +1 -1
- package/apps/lite-cli/dist/version.js +1 -1
- package/apps/lite-tui/dist/bin.js +3 -3
- package/apps/lite-tui/dist/bin.js.map +1 -1
- package/apps/lite-tui/dist/index.d.ts.map +1 -1
- package/apps/lite-tui/dist/index.js +4 -0
- package/apps/lite-tui/dist/index.js.map +1 -1
- package/apps/lite-tui/dist/index.test.js +5 -5
- package/apps/lite-tui/dist/index.test.js.map +1 -1
- package/apps/lite-tui/dist/model.d.ts.map +1 -1
- package/apps/lite-tui/dist/model.js +2 -1
- package/apps/lite-tui/dist/model.js.map +1 -1
- package/apps/lite-tui/dist/render.d.ts +1 -1
- package/apps/lite-tui/dist/version.d.ts +1 -1
- package/apps/lite-tui/dist/version.js +1 -1
- package/bin/cchistory-lite-tui.mjs +3 -3
- package/bin/cchistory-lite.mjs +3 -3
- package/docs/guide/agent-evidence.md +154 -0
- package/docs/guide/for-agents.md +45 -25
- package/docs/guide/lite.md +16 -4
- package/docs/guide/query.md +11 -2
- package/node_modules/@cchistory/canonical/dist/conversation-evidence.d.ts +85 -0
- package/node_modules/@cchistory/canonical/dist/conversation-evidence.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/conversation-evidence.js +191 -0
- package/node_modules/@cchistory/canonical/dist/conversation-evidence.js.map +1 -0
- package/node_modules/@cchistory/canonical/dist/conversation-evidence.test.d.ts +2 -0
- package/node_modules/@cchistory/canonical/dist/conversation-evidence.test.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/conversation-evidence.test.js +105 -0
- package/node_modules/@cchistory/canonical/dist/conversation-evidence.test.js.map +1 -0
- package/node_modules/@cchistory/canonical/dist/index.d.ts +2 -0
- package/node_modules/@cchistory/canonical/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/index.js +2 -0
- package/node_modules/@cchistory/canonical/dist/index.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/projection-audit.d.ts +4 -3
- package/node_modules/@cchistory/canonical/dist/projection-audit.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/projection-audit.js +14 -0
- package/node_modules/@cchistory/canonical/dist/projection-audit.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/read-status.d.ts +11 -0
- package/node_modules/@cchistory/canonical/dist/read-status.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/read-status.js +14 -0
- package/node_modules/@cchistory/canonical/dist/read-status.js.map +1 -0
- package/node_modules/@cchistory/canonical/dist/session-family.js +1 -1
- package/node_modules/@cchistory/canonical/dist/session-family.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/session-interpreter.d.ts +7 -3
- package/node_modules/@cchistory/canonical/dist/session-interpreter.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/session-interpreter.js +15 -13
- package/node_modules/@cchistory/canonical/dist/session-interpreter.js.map +1 -1
- package/node_modules/@cchistory/canonical/package.json +1 -1
- package/node_modules/@cchistory/domain/dist/conversation-evidence.d.ts +24 -0
- package/node_modules/@cchistory/domain/dist/conversation-evidence.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/conversation-evidence.js +2 -0
- package/node_modules/@cchistory/domain/dist/conversation-evidence.js.map +1 -0
- package/node_modules/@cchistory/domain/dist/index.d.ts +5 -0
- package/node_modules/@cchistory/domain/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/domain/dist/index.js.map +1 -1
- package/node_modules/@cchistory/domain/package.json +1 -1
- package/node_modules/@cchistory/live-runtime/dist/bootstrap.d.ts +1 -0
- package/node_modules/@cchistory/live-runtime/dist/bootstrap.d.ts.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/bootstrap.js +1 -0
- package/node_modules/@cchistory/live-runtime/dist/bootstrap.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/bounded-cache.d.ts +15 -0
- package/node_modules/@cchistory/live-runtime/dist/bounded-cache.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/bounded-cache.js +44 -0
- package/node_modules/@cchistory/live-runtime/dist/bounded-cache.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/bounded-cache.test.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/bounded-cache.test.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/bounded-cache.test.js +45 -0
- package/node_modules/@cchistory/live-runtime/dist/bounded-cache.test.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/diagnostics.d.ts +7 -0
- package/node_modules/@cchistory/live-runtime/dist/diagnostics.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/diagnostics.js +2 -0
- package/node_modules/@cchistory/live-runtime/dist/diagnostics.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/history-reader.d.ts +24 -0
- package/node_modules/@cchistory/live-runtime/dist/history-reader.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/history-reader.js +155 -0
- package/node_modules/@cchistory/live-runtime/dist/history-reader.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/index.d.ts +92 -6
- package/node_modules/@cchistory/live-runtime/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/index.js +249 -70
- package/node_modules/@cchistory/live-runtime/dist/index.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/index.test.js +6 -1
- package/node_modules/@cchistory/live-runtime/dist/index.test.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.d.ts +12 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.js +44 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.test.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.test.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.test.js +20 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.test.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/live-read-recovery.test.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/live-read-recovery.test.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/live-read-recovery.test.js +92 -0
- package/node_modules/@cchistory/live-runtime/dist/live-read-recovery.test.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.d.ts +1 -0
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.d.ts.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.js +7 -13
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.test.js +50 -55
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.test.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/selective-query.d.ts +2 -1
- package/node_modules/@cchistory/live-runtime/dist/selective-query.d.ts.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/selective-query.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/selective-query.test.js +8 -3
- package/node_modules/@cchistory/live-runtime/dist/selective-query.test.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/system-memory.test.js +3 -3
- package/node_modules/@cchistory/live-runtime/dist/system-memory.test.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/package.json +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/conversation-seeds.d.ts +3 -0
- package/node_modules/@cchistory/source-adapters/dist/core/conversation-seeds.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/conversation-seeds.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.d.ts +12 -0
- package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.js +32 -0
- package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.test.d.ts +2 -0
- package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.test.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.test.js +21 -0
- package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.test.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.js +3 -2
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.d.ts +3 -1
- package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.js +56 -38
- package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.test.js +76 -1
- package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/parser.d.ts +16 -5
- package/node_modules/@cchistory/source-adapters/dist/core/parser.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/parser.js +136 -76
- package/node_modules/@cchistory/source-adapters/dist/core/parser.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/probe.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/probe.js +75 -54
- package/node_modules/@cchistory/source-adapters/dist/core/probe.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.d.ts +4 -1
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.js +5 -3
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.test.js +61 -2
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/source-identity.d.ts +6 -2
- package/node_modules/@cchistory/source-adapters/dist/core/source-identity.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/source-identity.js +5 -5
- package/node_modules/@cchistory/source-adapters/dist/core/source-identity.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/types.d.ts +4 -1
- package/node_modules/@cchistory/source-adapters/dist/core/types.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/index.test.d.ts +1 -0
- package/node_modules/@cchistory/source-adapters/dist/index.test.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/index.test.js +1 -0
- package/node_modules/@cchistory/source-adapters/dist/index.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/amp.test.js +49 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/amp.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.d.ts +2 -0
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.js +48 -29
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/package.json +1 -1
- package/package.json +5 -5
- package/schemas/cchistory-lite-agent-v1.schema.json +8 -5
- package/schemas/cchistory-lite-canonical-v1.schema.json +82 -0
- package/schemas/cchistory-lite-diagnostic-v1.schema.json +27 -0
- package/schemas/cchistory-lite-query-result-v2.schema.json +232 -4
- package/schemas/cchistory-lite-query-result-v3.schema.json +45 -1
- package/schemas/cchistory-lite-query-v2.schema.json +150 -8
- package/schemas/cchistory-lite-v2.schema.json +82 -0
- package/skills/using-cchistory-lite/SKILL.md +86 -127
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
-
import { access,
|
|
2
|
+
import { access, mkdir, mkdtemp, readFile, rm, symlink, writeFile } from "node:fs/promises";
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { PassThrough } from "node:stream";
|
|
@@ -935,6 +935,7 @@ test("Lite CLI help documents latest, limits, and directory scope", async () =>
|
|
|
935
935
|
assert.match(help, /cchistory-lite help \[command\]/);
|
|
936
936
|
// store/db appear only in the closing line that documents their absence.
|
|
937
937
|
const knownFlags = new Set([
|
|
938
|
+
"diagnostics",
|
|
938
939
|
"source-root",
|
|
939
940
|
"source",
|
|
940
941
|
"limit-files",
|
|
@@ -956,6 +957,8 @@ test("Lite CLI help documents latest, limits, and directory scope", async () =>
|
|
|
956
957
|
"db",
|
|
957
958
|
]);
|
|
958
959
|
const documentedFlags = new Set([...help.matchAll(/--([a-z][a-z-]*)/gu)].map((match) => match[1]));
|
|
960
|
+
assert.match(help, /NODE_OPTIONS='--max-old-space-size=8192'/);
|
|
961
|
+
documentedFlags.delete("max-old-space-size"); // Node option, not a Lite argument.
|
|
959
962
|
for (const flag of documentedFlags) {
|
|
960
963
|
assert.ok(knownFlags.has(flag), `help documents unknown option --${flag}`);
|
|
961
964
|
}
|
|
@@ -1239,7 +1242,7 @@ test("Lite shell JSON-lines searches sessions against one snapshot and refreshes
|
|
|
1239
1242
|
assert.equal(search?.shown, search?.results.length);
|
|
1240
1243
|
assert.ok((search?.total ?? 0) >= (search?.shown ?? 0));
|
|
1241
1244
|
});
|
|
1242
|
-
test("Lite shell JSON-lines replies
|
|
1245
|
+
test("Lite shell JSON-lines replies before stdin closes and targets the resolved session", async () => {
|
|
1243
1246
|
const snapshot = await getCodexSnapshot();
|
|
1244
1247
|
const turn = snapshot.listResolvedTurns().find((entry) => snapshot.getTurnContext(entry.id)?.assistant_replies.length);
|
|
1245
1248
|
assert.ok(turn);
|
|
@@ -1252,7 +1255,7 @@ test("Lite shell JSON-lines replies from a line before stdin closes and loads ma
|
|
|
1252
1255
|
stdinIsTTY: false,
|
|
1253
1256
|
scan: async (options) => {
|
|
1254
1257
|
scans.push(options);
|
|
1255
|
-
return options.contextMode === "
|
|
1258
|
+
return options.contextMode === "full" ? snapshot : light;
|
|
1256
1259
|
},
|
|
1257
1260
|
});
|
|
1258
1261
|
const running = runLiteCli(["shell", "--no-dir"], captured.io);
|
|
@@ -1269,8 +1272,7 @@ test("Lite shell JSON-lines replies from a line before stdin closes and loads ma
|
|
|
1269
1272
|
stdin.end();
|
|
1270
1273
|
assert.equal(await running, 0);
|
|
1271
1274
|
assert.ok(scans.some((options) => options.contextMode === "none"));
|
|
1272
|
-
assert.ok(scans.some((options) => options.contextMode === "
|
|
1273
|
-
&& options.contextTargets?.some((target) => target.kind === "turn" && target.ref === turn.id)));
|
|
1275
|
+
assert.ok(scans.some((options) => options.contextMode === "full" && options.sessionRefs?.includes(turn.session_id)));
|
|
1274
1276
|
const payloads = captured.stdout.join("").trim().split("\n").map((line) => JSON.parse(line));
|
|
1275
1277
|
const replies = payloads.find((payload) => payload.operations?.[0]?.result?.turns);
|
|
1276
1278
|
assert.ok((replies?.operations?.[0]?.result?.turns?.[0]?.assistant_replies?.length ?? 0) > 0);
|
|
@@ -1341,67 +1343,19 @@ test("Lite shell JSON-lines keeps the snapshot when refresh fails and uses struc
|
|
|
1341
1343
|
const startupError = JSON.parse(startup.stdout.join(""));
|
|
1342
1344
|
assert.equal(startupError.error.code, "scan_failed");
|
|
1343
1345
|
});
|
|
1344
|
-
test("Lite CLI
|
|
1345
|
-
const
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
},
|
|
1358
|
-
}),
|
|
1359
|
-
});
|
|
1360
|
-
const sourceArgs = ["--source-root", `codex=${fixtureRoot}`, "--source", "codex", "--safe"];
|
|
1361
|
-
const refused = guardedIo();
|
|
1362
|
-
assert.equal(await runLiteCli(["sources", "--complete", ...sourceArgs], refused.io), 1);
|
|
1363
|
-
assert.equal(refused.stdout.join(""), "");
|
|
1364
|
-
const message = refused.stderr.join("");
|
|
1365
|
-
assert.match(message, /Refusing to scan/);
|
|
1366
|
-
assert.match(message, /Selected source roots/);
|
|
1367
|
-
assert.match(message, /codex/);
|
|
1368
|
-
assert.match(message, /this scan has no --dir filter/);
|
|
1369
|
-
assert.match(message, /keep the requested scope/);
|
|
1370
|
-
assert.match(message, /File count and sample size are not memory bounds/);
|
|
1371
|
-
assert.match(message, /sample/);
|
|
1372
|
-
assert.match(message, /sources --json/);
|
|
1373
|
-
assert.match(message, /shell/);
|
|
1374
|
-
assert.match(message, /No complete result/);
|
|
1375
|
-
assert.doesNotMatch(message, /CCHISTORY_SCAN_GUARD=0/);
|
|
1376
|
-
assert.doesNotMatch(message, /--dir is already on/);
|
|
1377
|
-
assert.doesNotMatch(message, /does not shrink source bytes/);
|
|
1378
|
-
const scopedLatest = guardedIo();
|
|
1379
|
-
assert.equal(await runLiteCli(["latest", "--dir", "/workspace/codex-delegated", ...sourceArgs], scopedLatest.io), 0, scopedLatest.stderr.join(""));
|
|
1380
|
-
const defaultDir = guardedIo();
|
|
1381
|
-
assert.equal(await runLiteCli(["latest", ...sourceArgs], defaultDir.io), 0, defaultDir.stderr.join(""));
|
|
1382
|
-
const refusedJson = guardedIo();
|
|
1383
|
-
assert.equal(await runLiteCli(["sources", "--complete", "--json", ...sourceArgs], refusedJson.io), 1);
|
|
1384
|
-
assert.equal(refusedJson.stdout.join(""), "");
|
|
1385
|
-
const errorPayload = JSON.parse(refusedJson.stderr.join(""));
|
|
1386
|
-
assert.equal(errorPayload.schema, "cchistory-lite-error/v1");
|
|
1387
|
-
assert.equal(errorPayload.error.code, "scan_guard_refused");
|
|
1388
|
-
assert.match(errorPayload.error.message, /Refusing to scan/);
|
|
1389
|
-
// Sample/exact probes bypass only the lock; an excessive estimate still refuses.
|
|
1390
|
-
const sampled = guardedIo();
|
|
1391
|
-
assert.equal(await runLiteCli(["sample", "1", ...sourceArgs, "--no-dir"], sampled.io), 1, sampled.stderr.join(""));
|
|
1392
|
-
const shown = guardedIo();
|
|
1393
|
-
assert.equal(await runLiteCli(["show", "session", "sess:codex:019ce4fd-8290-7501-afc4-0e9486733614", ...sourceArgs], shown.io), 1, shown.stderr.join(""));
|
|
1394
|
-
process.env.CCHISTORY_SCAN_GUARD = "0";
|
|
1395
|
-
try {
|
|
1396
|
-
const allowed = guardedIo();
|
|
1397
|
-
assert.equal(await runLiteCli(["sources", "--complete", ...sourceArgs], allowed.io), 0, allowed.stderr.join(""));
|
|
1398
|
-
}
|
|
1399
|
-
finally {
|
|
1400
|
-
delete process.env.CCHISTORY_SCAN_GUARD;
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
|
-
finally {
|
|
1404
|
-
await rm(tempHome, { recursive: true, force: true });
|
|
1346
|
+
test("Lite CLI warns on large aggregate estimates while returning readable history", async () => {
|
|
1347
|
+
const ioForScan = () => captureIo(repoRoot, undefined, {
|
|
1348
|
+
scan: options => scanLiteHistory({ ...options, scanGuardDeps: {
|
|
1349
|
+
walkRootBytes: async () => 256 * 1024 ** 3, readAvailableBytes: () => 1024 ** 3,
|
|
1350
|
+
} }),
|
|
1351
|
+
});
|
|
1352
|
+
const sourceArgs = ["--source-root", `codex=${codexRoot}`, "--source", "codex", "--safe"];
|
|
1353
|
+
for (const args of [["sources", "--complete"], ["sources", "--complete", "--json"], ["sample", "1", "--no-dir"]]) {
|
|
1354
|
+
const captured = ioForScan();
|
|
1355
|
+
assert.equal(await runLiteCli([...args, ...sourceArgs], captured.io), 0, captured.stderr.join(""));
|
|
1356
|
+
assert.ok(captured.stdout.join("").length > 0);
|
|
1357
|
+
assert.match(captured.stderr.join(""), /Scan guard warning:.*proceeding/);
|
|
1358
|
+
assert.doesNotMatch(captured.stderr.join(""), /Refusing to scan/);
|
|
1405
1359
|
}
|
|
1406
1360
|
});
|
|
1407
1361
|
test("Lite CLI maps scan guard refusals and aborts to exit 1 with distinct structured codes", async () => {
|
|
@@ -1533,11 +1487,12 @@ test("Lite CLI agent prints the machine-readable contract without scanning", asy
|
|
|
1533
1487
|
assert.equal(guard.watchdog_floor.initial_available_fraction, SCAN_WATCHDOG_AVAILABLE_RESERVE_FRACTION);
|
|
1534
1488
|
assert.deepEqual(guard.kill_switch, { env: "CCHISTORY_SCAN_GUARD", value: "0" });
|
|
1535
1489
|
assert.deepEqual([...guard.error_codes].sort(), ["read_budget_exceeded", "scan_guard_aborted", "scan_guard_refused"]);
|
|
1536
|
-
assert.equal(contract.cost_model.heap_ceiling.policy, "
|
|
1537
|
-
assert.equal(contract.cost_model.heap_ceiling.automatic_reexec,
|
|
1490
|
+
assert.equal(contract.cost_model.heap_ceiling.policy, "adaptive_default_or_explicit");
|
|
1491
|
+
assert.equal(contract.cost_model.heap_ceiling.automatic_reexec, true);
|
|
1538
1492
|
assert.equal(contract.trust_model.content_trust, "untrusted_history");
|
|
1539
1493
|
const schemaIds = contract.output_schemas.map((entry) => entry.id);
|
|
1540
1494
|
for (const id of [
|
|
1495
|
+
"cchistory-lite-diagnostic/v1",
|
|
1541
1496
|
"cchistory-lite/v2",
|
|
1542
1497
|
"cchistory-lite-canonical/v1",
|
|
1543
1498
|
"cchistory-lite-query/v2",
|
|
@@ -1566,6 +1521,16 @@ test("Lite CLI agent contract satisfies its shipped JSON schema structurally", a
|
|
|
1566
1521
|
}
|
|
1567
1522
|
assert.equal(contract.schema, schema.properties.schema.const);
|
|
1568
1523
|
assert.equal(contract.kind, schema.properties.kind.const);
|
|
1524
|
+
const heap = contract.cost_model.heap_ceiling;
|
|
1525
|
+
const heapSchema = schema.properties.cost_model.properties.heap_ceiling.properties;
|
|
1526
|
+
assert.equal(heap.policy, heapSchema.policy.const);
|
|
1527
|
+
assert.equal(heap.automatic_reexec, heapSchema.automatic_reexec.const);
|
|
1528
|
+
const guard = contract.cost_model.scan_guard;
|
|
1529
|
+
const guardSchema = schema.properties.cost_model.properties.scan_guard.properties;
|
|
1530
|
+
assert.deepEqual(Object.keys(guard).sort(), Object.keys(guardSchema).sort());
|
|
1531
|
+
assert.equal(guard.estimate_policy, guardSchema.estimate_policy.const);
|
|
1532
|
+
assert.equal(guard.read_budget_policy, guardSchema.read_budget_policy.const);
|
|
1533
|
+
assert.deepEqual(Object.keys(guard.watchdog_floor).sort(), Object.keys(guardSchema.watchdog_floor.properties).sort());
|
|
1569
1534
|
const commands = contract.commands;
|
|
1570
1535
|
assert.deepEqual(Object.keys(commands).sort(), [...schema.properties.commands.required].sort());
|
|
1571
1536
|
for (const [name, command] of Object.entries(commands)) {
|
|
@@ -1602,7 +1567,7 @@ test("Lite CLI agent contract flags match the parser in both directions", async
|
|
|
1602
1567
|
const parserFlags = [
|
|
1603
1568
|
"--source-root", "--source", "--limit-files", "--limit", "--offset", "--project", "--by",
|
|
1604
1569
|
"--format", "--out", "--dir", "--request", "--safe", "--json", "--all", "--no-dir",
|
|
1605
|
-
"--help", "--version", "--sql", "--sql-file", "--params", "--complete", "--idle-timeout",
|
|
1570
|
+
"--help", "--version", "--sql", "--sql-file", "--params", "--complete", "--idle-timeout", "--diagnostics",
|
|
1606
1571
|
];
|
|
1607
1572
|
assert.deepEqual([...universe].sort(), [...parserFlags].sort());
|
|
1608
1573
|
const tails = {
|