agentxchain 2.155.40 → 2.155.41
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/package.json +1 -1
- package/src/commands/audit.js +1 -1
- package/src/commands/benchmark.js +1 -1
- package/src/commands/export.js +2 -2
- package/src/commands/run.js +2 -2
- package/src/lib/export.js +32 -7
package/package.json
CHANGED
package/src/commands/audit.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from '../lib/report.js';
|
|
10
10
|
|
|
11
11
|
// BUG-88: apply bounding to prevent Invalid string length on large accumulated state
|
|
12
|
-
const defaultExportOpts = { maxJsonlEntries: 1000, maxBase64Bytes: 1024 * 1024, maxExportFiles: 500, maxTextDataBytes: 131072 };
|
|
12
|
+
const defaultExportOpts = { maxJsonlEntries: 1000, maxBase64Bytes: 1024 * 1024, maxExportFiles: 500, maxTextDataBytes: 131072, maxJsonDataBytes: 262144 };
|
|
13
13
|
|
|
14
14
|
function detectAuditKind(cwd) {
|
|
15
15
|
const runResult = buildRunExport(cwd, defaultExportOpts);
|
|
@@ -382,7 +382,7 @@ function assertExpectedWorkloadSignals(workload, metrics) {
|
|
|
382
382
|
async function buildAndVerifyRunExport(root) {
|
|
383
383
|
const { buildRunExport } = await import('../lib/export.js');
|
|
384
384
|
// BUG-88: apply bounding to prevent Invalid string length on large accumulated state
|
|
385
|
-
const exportResult = buildRunExport(root, { maxJsonlEntries: 1000, maxBase64Bytes: 1024 * 1024, maxExportFiles: 500, maxTextDataBytes: 131072 });
|
|
385
|
+
const exportResult = buildRunExport(root, { maxJsonlEntries: 1000, maxBase64Bytes: 1024 * 1024, maxExportFiles: 500, maxTextDataBytes: 131072, maxJsonDataBytes: 262144 });
|
|
386
386
|
if (!exportResult.ok) {
|
|
387
387
|
return {
|
|
388
388
|
ok: false,
|
package/src/commands/export.js
CHANGED
|
@@ -29,7 +29,7 @@ export async function exportCommand(options) {
|
|
|
29
29
|
const kind = detectExportKind(cwd);
|
|
30
30
|
|
|
31
31
|
// BUG-88: apply bounding to prevent Invalid string length on large accumulated state
|
|
32
|
-
const defaultExportOpts = { maxJsonlEntries: 1000, maxBase64Bytes: 1024 * 1024, maxExportFiles: 500, maxTextDataBytes: 131072 };
|
|
32
|
+
const defaultExportOpts = { maxJsonlEntries: 1000, maxBase64Bytes: 1024 * 1024, maxExportFiles: 500, maxTextDataBytes: 131072, maxJsonDataBytes: 262144 };
|
|
33
33
|
|
|
34
34
|
let result;
|
|
35
35
|
try {
|
|
@@ -68,7 +68,7 @@ export async function exportCommand(options) {
|
|
|
68
68
|
} catch (serializeErr) {
|
|
69
69
|
if (/Invalid string length/i.test(serializeErr.message)) {
|
|
70
70
|
// Retry with tighter bounds
|
|
71
|
-
const tightOpts = { maxJsonlEntries: 500, maxBase64Bytes: 65536, maxExportFiles: 200, maxTextDataBytes: 32768 };
|
|
71
|
+
const tightOpts = { maxJsonlEntries: 500, maxBase64Bytes: 65536, maxExportFiles: 200, maxTextDataBytes: 32768, maxJsonDataBytes: 65536 };
|
|
72
72
|
const tightResult = buildRunExport(cwd, tightOpts);
|
|
73
73
|
if (tightResult.ok) {
|
|
74
74
|
console.log(JSON.stringify(tightResult.export));
|
package/src/commands/run.js
CHANGED
|
@@ -674,8 +674,8 @@ export async function executeGovernedRun(context, opts = {}) {
|
|
|
674
674
|
mkdirSync(reportsDir, { recursive: true });
|
|
675
675
|
|
|
676
676
|
// BUG-88: two-attempt export with fallback to tighter bounds on string-length overflow
|
|
677
|
-
const defaultExportOpts = { maxJsonlEntries: 1000, maxBase64Bytes: 1024 * 1024, maxExportFiles: 500, maxTextDataBytes: 131072 };
|
|
678
|
-
const tightExportOpts = { maxJsonlEntries: 500, maxBase64Bytes: 65536, maxExportFiles: 200, maxTextDataBytes: 32768 };
|
|
677
|
+
const defaultExportOpts = { maxJsonlEntries: 1000, maxBase64Bytes: 1024 * 1024, maxExportFiles: 500, maxTextDataBytes: 131072, maxJsonDataBytes: 262144 };
|
|
678
|
+
const tightExportOpts = { maxJsonlEntries: 500, maxBase64Bytes: 65536, maxExportFiles: 200, maxTextDataBytes: 32768, maxJsonDataBytes: 65536 };
|
|
679
679
|
|
|
680
680
|
let exportResult = buildRunExport(root, defaultExportOpts);
|
|
681
681
|
if (exportResult.ok) {
|
package/src/lib/export.js
CHANGED
|
@@ -34,6 +34,12 @@ const RUN_EXPORT_ONLY_ROOTS = [
|
|
|
34
34
|
'.planning',
|
|
35
35
|
];
|
|
36
36
|
|
|
37
|
+
const GENERATED_GOVERNANCE_REPORT_PATTERNS = Object.freeze([
|
|
38
|
+
/^\.agentxchain\/reports\/report-[^/]+\.md$/,
|
|
39
|
+
/^\.agentxchain\/reports\/export-[^/]+\.json$/,
|
|
40
|
+
/^\.agentxchain\/reports\/chain-[^/]+\.json$/,
|
|
41
|
+
]);
|
|
42
|
+
|
|
37
43
|
export const RUN_EXPORT_INCLUDED_ROOTS = [
|
|
38
44
|
'agentxchain.json',
|
|
39
45
|
...RUN_CONTINUITY_STATE_FILES,
|
|
@@ -52,6 +58,10 @@ function pathWithinRoots(relPath, roots) {
|
|
|
52
58
|
return roots.some((root) => relPath === root || relPath.startsWith(`${root}/`));
|
|
53
59
|
}
|
|
54
60
|
|
|
61
|
+
export function isGeneratedGovernanceReportPath(relPath) {
|
|
62
|
+
return GENERATED_GOVERNANCE_REPORT_PATTERNS.some((pattern) => pattern.test(relPath));
|
|
63
|
+
}
|
|
64
|
+
|
|
55
65
|
export function isRunRestorePath(relPath) {
|
|
56
66
|
return pathWithinRoots(relPath, RUN_RESTORE_ROOTS);
|
|
57
67
|
}
|
|
@@ -165,11 +175,16 @@ function parseFile(root, relPath, opts = {}) {
|
|
|
165
175
|
|
|
166
176
|
if (relPath.endsWith('.json')) {
|
|
167
177
|
const raw = buffer.toString('utf8');
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
178
|
+
format = 'json';
|
|
179
|
+
if (opts.maxJsonDataBytes && buffer.byteLength > opts.maxJsonDataBytes) {
|
|
180
|
+
data = null;
|
|
181
|
+
truncated = true;
|
|
182
|
+
} else {
|
|
183
|
+
try {
|
|
184
|
+
data = JSON.parse(raw);
|
|
185
|
+
} catch (error) {
|
|
186
|
+
throw new Error(`${relPath}: invalid JSON: ${error.message}`);
|
|
187
|
+
}
|
|
173
188
|
}
|
|
174
189
|
} else if (relPath.endsWith('.jsonl')) {
|
|
175
190
|
const maxEntries = opts.maxJsonlEntries;
|
|
@@ -199,8 +214,14 @@ function parseFile(root, relPath, opts = {}) {
|
|
|
199
214
|
|
|
200
215
|
if (truncated) {
|
|
201
216
|
result.truncated = true;
|
|
202
|
-
|
|
203
|
-
|
|
217
|
+
if (format === 'jsonl') {
|
|
218
|
+
result.total_entries = totalEntries;
|
|
219
|
+
result.retained_entries = data.length;
|
|
220
|
+
} else if (format === 'text') {
|
|
221
|
+
result.retained_bytes = Buffer.byteLength(data, 'utf8');
|
|
222
|
+
} else if (format === 'json') {
|
|
223
|
+
result.retained_bytes = 0;
|
|
224
|
+
}
|
|
204
225
|
}
|
|
205
226
|
if (skipBase64 && !truncated) {
|
|
206
227
|
result.content_base64_skipped = true;
|
|
@@ -459,6 +480,7 @@ export function buildRunExport(startDir = process.cwd(), exportOpts = {}) {
|
|
|
459
480
|
const state = loadProjectState(root, config);
|
|
460
481
|
|
|
461
482
|
const collectedPaths = [...new Set(RUN_EXPORT_INCLUDED_ROOTS.flatMap((relPath) => collectPaths(root, relPath)))]
|
|
483
|
+
.filter((relPath) => !isGeneratedGovernanceReportPath(relPath))
|
|
462
484
|
.sort((a, b) => a.localeCompare(b, 'en'));
|
|
463
485
|
|
|
464
486
|
const parseOpts = {};
|
|
@@ -471,6 +493,9 @@ export function buildRunExport(startDir = process.cwd(), exportOpts = {}) {
|
|
|
471
493
|
if (exportOpts.maxTextDataBytes) {
|
|
472
494
|
parseOpts.maxTextDataBytes = exportOpts.maxTextDataBytes;
|
|
473
495
|
}
|
|
496
|
+
if (exportOpts.maxJsonDataBytes) {
|
|
497
|
+
parseOpts.maxJsonDataBytes = exportOpts.maxJsonDataBytes;
|
|
498
|
+
}
|
|
474
499
|
|
|
475
500
|
// BUG-88: apply maxExportFiles cap with priority ordering.
|
|
476
501
|
// Core governance files first, then dispatch/staging, then .planning/ last.
|