@aragon-agent/cli 0.6.62 → 0.6.63
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 +99 -7
- package/dist/agent/headless.js +18 -0
- package/dist/commands/builtins.js +2 -1
- package/dist/commands/catalog.js +1 -1
- package/dist/compaction/archive.d.ts +27 -1
- package/dist/compaction/archive.js +8 -0
- package/dist/compaction/budget.d.ts +73 -0
- package/dist/compaction/budget.js +89 -0
- package/dist/compaction/child.js +6 -1
- package/dist/compaction/command.js +147 -1
- package/dist/compaction/compactor.d.ts +132 -15
- package/dist/compaction/compactor.js +288 -95
- package/dist/compaction/context-command.js +21 -0
- package/dist/compaction/memory-agent-prompt.d.ts +32 -0
- package/dist/compaction/memory-agent-prompt.js +76 -0
- package/dist/compaction/memory-agent-tools.d.ts +88 -0
- package/dist/compaction/memory-agent-tools.js +338 -0
- package/dist/compaction/memory-agent.d.ts +114 -0
- package/dist/compaction/memory-agent.js +220 -0
- package/dist/compaction/prune.d.ts +129 -0
- package/dist/compaction/prune.js +386 -0
- package/dist/compaction/retry-plan.d.ts +103 -0
- package/dist/compaction/retry-plan.js +136 -0
- package/dist/compaction/summarize-ladder.d.ts +149 -0
- package/dist/compaction/summarize-ladder.js +273 -0
- package/dist/compaction/wiring.d.ts +19 -0
- package/dist/compaction/wiring.js +65 -1
- package/dist/config/cli-commands.d.ts +1 -1
- package/dist/config/cli-commands.js +16 -0
- package/dist/config/env.d.ts +3 -1
- package/dist/config/env.js +44 -2
- package/dist/exec/events.d.ts +30 -0
- package/dist/exec/runner.js +6 -0
- package/dist/logging/install.d.ts +27 -0
- package/dist/session/validate-session.js +11 -0
- package/package.json +3 -3
package/dist/config/env.js
CHANGED
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
* ARAGON_UPDATE,
|
|
19
19
|
* ARAGON_COMPACTION, ARAGON_COMPACTION_THRESHOLD,
|
|
20
20
|
* ARAGON_COMPACTION_KEEP_TURNS, ARAGON_COMPACTION_SUBAGENTS,
|
|
21
|
-
* ARAGON_COMPACTION_ARCHIVE,
|
|
21
|
+
* ARAGON_COMPACTION_ARCHIVE, ARAGON_COMPACTION_AGENTIC,
|
|
22
|
+
* ARAGON_COMPACTION_PRUNE, ARAGON_COMPACTION_BUDGET_TOKENS,
|
|
23
|
+
* ARAGON_COMPACTION_BUDGET_USD,
|
|
22
24
|
* ARAGON_JOBS_ENABLED, ARAGON_JOBS_WAIT_SECONDS, ARAGON_JOBS_STALL_SECONDS,
|
|
23
25
|
* ARAGON_JOBS_PERSIST_LOG, ARAGON_JOBS_NOTICE_STEER,
|
|
24
26
|
* ARAGON_PROMPTS (the quick-prompt library's `enabled` switch, and only that),
|
|
@@ -434,12 +436,23 @@ export function readEnvConfig() {
|
|
|
434
436
|
// disk in an environment that may not permit it.
|
|
435
437
|
const compactionSubagents = process.env.ARAGON_COMPACTION_SUBAGENTS?.trim().toLowerCase();
|
|
436
438
|
const compactionArchive = process.env.ARAGON_COMPACTION_ARCHIVE?.trim().toLowerCase();
|
|
439
|
+
// THE FOUR v3 KEYS (context-compaction-v3 W6). Same contract as the five above:
|
|
440
|
+
// a bad value is left ABSENT rather than resolved to a default, so the config
|
|
441
|
+
// layer underneath - and `clampCompactionConfig` - still owns the fallback.
|
|
442
|
+
const compactionAgentic = process.env.ARAGON_COMPACTION_AGENTIC?.trim().toLowerCase();
|
|
443
|
+
const compactionPrune = process.env.ARAGON_COMPACTION_PRUNE?.trim().toLowerCase();
|
|
444
|
+
const compactionBudgetTokens = process.env.ARAGON_COMPACTION_BUDGET_TOKENS?.trim();
|
|
445
|
+
const compactionBudgetUsd = process.env.ARAGON_COMPACTION_BUDGET_USD?.trim();
|
|
437
446
|
const positive = (v) => v === '1' || v === 'true' || v === 'on' || v === 'yes';
|
|
438
447
|
if ((compaction !== undefined && compaction.length > 0) ||
|
|
439
448
|
(compactionThreshold !== undefined && compactionThreshold.length > 0) ||
|
|
440
449
|
(compactionKeepTurns !== undefined && compactionKeepTurns.length > 0) ||
|
|
441
450
|
(compactionSubagents !== undefined && compactionSubagents.length > 0) ||
|
|
442
|
-
(compactionArchive !== undefined && compactionArchive.length > 0)
|
|
451
|
+
(compactionArchive !== undefined && compactionArchive.length > 0) ||
|
|
452
|
+
(compactionAgentic !== undefined && compactionAgentic.length > 0) ||
|
|
453
|
+
(compactionPrune !== undefined && compactionPrune.length > 0) ||
|
|
454
|
+
(compactionBudgetTokens !== undefined && compactionBudgetTokens.length > 0) ||
|
|
455
|
+
(compactionBudgetUsd !== undefined && compactionBudgetUsd.length > 0)) {
|
|
443
456
|
const section = {};
|
|
444
457
|
if (compaction !== undefined && compaction.length > 0) {
|
|
445
458
|
section.enabled = positive(compaction);
|
|
@@ -450,6 +463,22 @@ export function readEnvConfig() {
|
|
|
450
463
|
if (compactionArchive !== undefined && compactionArchive.length > 0) {
|
|
451
464
|
section.archive = positive(compactionArchive);
|
|
452
465
|
}
|
|
466
|
+
if (compactionAgentic !== undefined && compactionAgentic.length > 0) {
|
|
467
|
+
section.agentic = positive(compactionAgentic);
|
|
468
|
+
}
|
|
469
|
+
if (compactionPrune !== undefined && compactionPrune.length > 0) {
|
|
470
|
+
section.prune = positive(compactionPrune);
|
|
471
|
+
}
|
|
472
|
+
if (compactionBudgetTokens !== undefined && compactionBudgetTokens.length > 0) {
|
|
473
|
+
const n = parseBudgetNumber(compactionBudgetTokens);
|
|
474
|
+
if (n !== null)
|
|
475
|
+
section.budgetTokens = Math.round(n);
|
|
476
|
+
}
|
|
477
|
+
if (compactionBudgetUsd !== undefined && compactionBudgetUsd.length > 0) {
|
|
478
|
+
const n = parseBudgetNumber(compactionBudgetUsd);
|
|
479
|
+
if (n !== null)
|
|
480
|
+
section.budgetUsd = n;
|
|
481
|
+
}
|
|
453
482
|
if (compactionThreshold !== undefined && compactionThreshold.length > 0) {
|
|
454
483
|
// Left ABSENT on a bad value rather than clamped to a default, so a typo
|
|
455
484
|
// falls through to the config layer instead of masking it for the session.
|
|
@@ -548,6 +577,19 @@ function envBool(value) {
|
|
|
548
577
|
const v = value.trim().toLowerCase();
|
|
549
578
|
return !(v === '0' || v === 'false' || v === 'off' || v === 'no');
|
|
550
579
|
}
|
|
580
|
+
/**
|
|
581
|
+
* A budget number from the environment, or `null` when it is not one.
|
|
582
|
+
*
|
|
583
|
+
* `off`/`unlimited`/`0` all mean "no ceiling" (D-8), and a typo returns `null`
|
|
584
|
+
* so the key stays ABSENT - the rule `ARAGON_COMPACTION_THRESHOLD` states three
|
|
585
|
+
* lines above. Never throws, never clamps: the clamp is `clampCompactionConfig`.
|
|
586
|
+
*/
|
|
587
|
+
function parseBudgetNumber(raw) {
|
|
588
|
+
if (/^(off|none|unlimited)$/i.test(raw))
|
|
589
|
+
return 0;
|
|
590
|
+
const n = Number(raw.replace(/[$,]/g, ''));
|
|
591
|
+
return Number.isFinite(n) && n >= 0 ? n : null;
|
|
592
|
+
}
|
|
551
593
|
/**
|
|
552
594
|
* Assemble the `log` section from the environment, or `undefined` when the user
|
|
553
595
|
* said nothing about it. Same shape as the `partial.skills` assembly above: a
|
package/dist/exec/events.d.ts
CHANGED
|
@@ -411,6 +411,36 @@ export interface ExecCompactionEvent {
|
|
|
411
411
|
messages: number;
|
|
412
412
|
charsRemoved: number;
|
|
413
413
|
};
|
|
414
|
+
/**
|
|
415
|
+
* The three v3 sections (context-compaction-v3 §6.2), all optional.
|
|
416
|
+
*
|
|
417
|
+
* `EXEC_SCHEMA_VERSION` DOES NOT MOVE: adding a field never does, and the README
|
|
418
|
+
* already promises that a consumer ignores what it does not know. A wrapper that
|
|
419
|
+
* wants to enforce a spend ceiling needs `budget` here, and one that wants to
|
|
420
|
+
* explain a slow compaction needs `agent`.
|
|
421
|
+
*/
|
|
422
|
+
prune?: {
|
|
423
|
+
actions: number;
|
|
424
|
+
removedChars: number;
|
|
425
|
+
removedTokens: number;
|
|
426
|
+
inspected: number;
|
|
427
|
+
kinds: Record<string, number>;
|
|
428
|
+
};
|
|
429
|
+
budget?: {
|
|
430
|
+
limitTokens: number;
|
|
431
|
+
spentTokens: number;
|
|
432
|
+
limitUsd: number;
|
|
433
|
+
spentUsd: number;
|
|
434
|
+
priceUnknown: boolean;
|
|
435
|
+
stop?: 'budget_tokens' | 'budget_usd';
|
|
436
|
+
};
|
|
437
|
+
agent?: {
|
|
438
|
+
turns: number;
|
|
439
|
+
toolCalls: number;
|
|
440
|
+
submissions: number;
|
|
441
|
+
fallback?: 'single-shot';
|
|
442
|
+
};
|
|
443
|
+
stoppedBy?: 'budget_tokens' | 'budget_usd' | 'turn_limit' | 'timeout' | 'cancel';
|
|
414
444
|
durationMs?: number;
|
|
415
445
|
}
|
|
416
446
|
export interface ExecRetryEvent {
|
package/dist/exec/runner.js
CHANGED
|
@@ -306,6 +306,12 @@ export class ExecRunner {
|
|
|
306
306
|
tokensBefore: r.tokensBefore,
|
|
307
307
|
tokensAfter: r.tokensAfter,
|
|
308
308
|
...(r.tailRelief ? { tailRelief: r.tailRelief } : {}),
|
|
309
|
+
// THE v3 SECTIONS (context-compaction-v3 §6.2). Passed straight through:
|
|
310
|
+
// this runner is a projection of the record, never a second truth.
|
|
311
|
+
...(r.prune ? { prune: r.prune } : {}),
|
|
312
|
+
...(r.budget ? { budget: r.budget } : {}),
|
|
313
|
+
...(r.agent ? { agent: r.agent } : {}),
|
|
314
|
+
...(r.stoppedBy ? { stoppedBy: r.stoppedBy } : {}),
|
|
309
315
|
...(r.decision ? { decision: r.decision } : {}),
|
|
310
316
|
...(r.memoryVersion ? { memoryVersion: r.memoryVersion } : {}),
|
|
311
317
|
durationMs: r.durationMs,
|
|
@@ -248,6 +248,33 @@ export type AgentLogEvent = {
|
|
|
248
248
|
messages: number;
|
|
249
249
|
charsRemoved: number;
|
|
250
250
|
};
|
|
251
|
+
/**
|
|
252
|
+
* The v3 fields, mirrored from the CLI-local record (context-compaction-v3
|
|
253
|
+
* §4.7). THIS UNION MUST STAY A SUPERSET OF CORE'S (IF-3): a field present
|
|
254
|
+
* on the CLI record and missing here is invisible in the log, and the log is
|
|
255
|
+
* the only durable trace of a run nobody watched.
|
|
256
|
+
*/
|
|
257
|
+
prune?: {
|
|
258
|
+
actions: number;
|
|
259
|
+
removedChars: number;
|
|
260
|
+
removedTokens: number;
|
|
261
|
+
inspected: number;
|
|
262
|
+
kinds: Record<string, number>;
|
|
263
|
+
};
|
|
264
|
+
budget?: {
|
|
265
|
+
limitTokens: number;
|
|
266
|
+
spentTokens: number;
|
|
267
|
+
limitUsd: number;
|
|
268
|
+
spentUsd: number;
|
|
269
|
+
priceUnknown: boolean;
|
|
270
|
+
stop?: 'budget_tokens' | 'budget_usd';
|
|
271
|
+
};
|
|
272
|
+
agent?: {
|
|
273
|
+
turns: number;
|
|
274
|
+
toolCalls: number;
|
|
275
|
+
submissions: number;
|
|
276
|
+
fallback?: 'single-shot';
|
|
277
|
+
};
|
|
251
278
|
durationMs?: number;
|
|
252
279
|
};
|
|
253
280
|
/**
|
|
@@ -220,6 +220,17 @@ const ENTRY_FIELDS = {
|
|
|
220
220
|
tokensBefore: number, tokensAfter: number, summary: optional(string), model: string,
|
|
221
221
|
durationMs: optional(number), startedAt: optional(number), live: boolean,
|
|
222
222
|
tailRelief: optional(shape({ messages: number, charsRemoved: number })),
|
|
223
|
+
// THE v3 OPTIONAL FIELDS (context-compaction-v3 §4.7). THIS VALIDATOR IS
|
|
224
|
+
// STRICT - an unknown field fails the whole load - so every field a record can
|
|
225
|
+
// carry has to be named here or a saved session would refuse to resume.
|
|
226
|
+
prune: optional(shape({ actions: nonnegative, removedChars: nonnegative,
|
|
227
|
+
removedTokens: nonnegative, inspected: nonnegative, kinds: object })),
|
|
228
|
+
budget: optional(shape({ limitTokens: nonnegative, spentTokens: nonnegative,
|
|
229
|
+
limitUsd: nonnegative, spentUsd: nonnegative, priceUnknown: boolean,
|
|
230
|
+
stop: optional(enumeration('budget_tokens', 'budget_usd')) })),
|
|
231
|
+
agent: optional(shape({ turns: nonnegative, toolCalls: nonnegative,
|
|
232
|
+
submissions: nonnegative, fallback: optional(enumeration('single-shot')) })),
|
|
233
|
+
stoppedBy: optional(enumeration('budget_tokens', 'budget_usd', 'turn_limit', 'timeout', 'cancel')),
|
|
223
234
|
},
|
|
224
235
|
service: {
|
|
225
236
|
serviceId: string, command: string,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aragon-agent/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.63",
|
|
4
4
|
"description": "AragonAgent CLI — a Claude-Code / Codex-style interactive terminal UI (TUI) on top of the @aragon-agent/core engine. Installable and runnable via npm / npx.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "AragonAgent contributors",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"prepublishOnly": "npm run build"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@aragon-agent/core": "^0.2.
|
|
62
|
-
"@aragon-agent/tui": "0.0.
|
|
61
|
+
"@aragon-agent/core": "^0.2.75",
|
|
62
|
+
"@aragon-agent/tui": "0.0.16",
|
|
63
63
|
"commander": "^12.1.0",
|
|
64
64
|
"dotenv": "^16.6.1",
|
|
65
65
|
"env-paths": "^3.0.0",
|