@aragon-agent/cli 0.6.53 → 0.6.55
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/CHANGELOG.md +64 -0
- package/README.md +135 -6
- package/dist/agent/controller.d.ts +98 -0
- package/dist/agent/controller.js +341 -1
- package/dist/agent/redteam-prompt.d.ts +47 -0
- package/dist/agent/redteam-prompt.js +161 -0
- package/dist/agent/redteam-wiring.d.ts +159 -0
- package/dist/agent/redteam-wiring.js +349 -0
- package/dist/agent/system-prompt.d.ts +27 -0
- package/dist/agent/system-prompt.js +10 -0
- package/dist/app/App.d.ts +17 -1
- package/dist/app/App.js +266 -26
- package/dist/app/use-redteam-mode.d.ts +56 -0
- package/dist/app/use-redteam-mode.js +121 -0
- package/dist/cli.js +78 -4
- package/dist/commands/builtins.js +49 -1
- package/dist/commands/catalog.js +5 -0
- package/dist/commands/index-build.js +2 -1
- package/dist/commands/redteam-command.d.ts +22 -0
- package/dist/commands/redteam-command.js +141 -0
- package/dist/commands/registry.d.ts +7 -0
- package/dist/compaction/compactor.d.ts +26 -0
- package/dist/compaction/compactor.js +81 -8
- package/dist/compaction/summarize-call.d.ts +22 -0
- package/dist/compaction/summarize-call.js +29 -0
- package/dist/compaction/wiring.js +22 -3
- package/dist/config/app-paths.d.ts +13 -0
- package/dist/config/app-paths.js +15 -0
- package/dist/config/cli-commands.d.ts +15 -0
- package/dist/config/cli-commands.js +32 -1
- package/dist/config/env.d.ts +3 -1
- package/dist/config/env.js +23 -1
- package/dist/config/load.d.ts +18 -0
- package/dist/config/load.js +19 -1
- package/dist/config/redteam-launch.d.ts +77 -0
- package/dist/config/redteam-launch.js +58 -0
- package/dist/config/store.js +20 -1
- package/dist/config/ui-state.d.ts +44 -0
- package/dist/config/ui-state.js +38 -0
- package/dist/exec/bridge/server.js +9 -2
- package/dist/exec/options.js +16 -2
- package/dist/governance/prompts/orchestrator-block.js +2 -2
- package/dist/host/controller-factory.d.ts +33 -0
- package/dist/host/controller-factory.js +14 -0
- package/dist/host/follow-up-seed.d.ts +109 -0
- package/dist/host/follow-up-seed.js +196 -0
- package/dist/host/follow-up.d.ts +73 -0
- package/dist/host/follow-up.js +123 -0
- package/dist/host/index.d.ts +3 -0
- package/dist/host/index.js +3 -0
- package/dist/host/memory.d.ts +21 -0
- package/dist/host/memory.js +17 -0
- package/dist/host/sessions.d.ts +32 -2
- package/dist/host/sessions.js +40 -2
- package/dist/logging/install.d.ts +1 -0
- package/dist/logging/install.js +4 -0
- package/dist/logging/logger.d.ts +1 -1
- package/dist/memory/block.d.ts +24 -0
- package/dist/memory/block.js +54 -0
- package/dist/memory/command.d.ts +31 -0
- package/dist/memory/command.js +350 -0
- package/dist/memory/format.d.ts +51 -0
- package/dist/memory/format.js +308 -0
- package/dist/memory/paths.d.ts +68 -0
- package/dist/memory/paths.js +172 -0
- package/dist/memory/plan.d.ts +37 -0
- package/dist/memory/plan.js +184 -0
- package/dist/memory/resolve.d.ts +45 -0
- package/dist/memory/resolve.js +54 -0
- package/dist/memory/secrets.d.ts +30 -0
- package/dist/memory/secrets.js +73 -0
- package/dist/memory/service.d.ts +175 -0
- package/dist/memory/service.js +576 -0
- package/dist/memory/store.d.ts +133 -0
- package/dist/memory/store.js +694 -0
- package/dist/memory/tools.d.ts +36 -0
- package/dist/memory/tools.js +527 -0
- package/dist/memory/transfer.d.ts +53 -0
- package/dist/memory/transfer.js +93 -0
- package/dist/session/checkpoint.d.ts +33 -0
- package/dist/session/checkpoint.js +52 -0
- package/dist/session/limits.d.ts +16 -0
- package/dist/session/limits.js +16 -0
- package/dist/session/persist.d.ts +68 -0
- package/dist/session/persist.js +11 -0
- package/dist/session/startup-session.d.ts +17 -2
- package/dist/session/startup-session.js +15 -2
- package/dist/session/store.d.ts +14 -0
- package/dist/session/store.js +18 -0
- package/dist/session/validate-session.js +129 -0
- package/dist/team/runtime.d.ts +11 -0
- package/dist/team/runtime.js +6 -0
- package/dist/team/subagent.d.ts +21 -0
- package/dist/team/subagent.js +7 -0
- package/dist/tools/index.d.ts +45 -2
- package/dist/tools/index.js +53 -3
- package/package.json +3 -3
- package/skills/project-indexer/SKILL.md +275 -147
- package/skills/project-indexer/templates/artifact-hygiene-template.md +14 -0
- package/skills/project-indexer/templates/config-template.md +12 -0
- package/skills/project-indexer/templates/index-template.md +4 -0
|
@@ -100,6 +100,7 @@ export declare class Compactor implements ContextManager {
|
|
|
100
100
|
private pricingUnknown;
|
|
101
101
|
private costUsd;
|
|
102
102
|
private consecutiveNoProgress;
|
|
103
|
+
private consecutiveTransportFailures;
|
|
103
104
|
private selfDisabled;
|
|
104
105
|
private selfDisabledReason;
|
|
105
106
|
private pendingManual;
|
|
@@ -130,6 +131,15 @@ export declare class Compactor implements ContextManager {
|
|
|
130
131
|
private checkMinimumCandidate;
|
|
131
132
|
private digestFor;
|
|
132
133
|
private summarize;
|
|
134
|
+
/**
|
|
135
|
+
* Whether the second attempt moves to the main model.
|
|
136
|
+
*
|
|
137
|
+
* After an unusable answer it always does (a stronger model may do better). After a
|
|
138
|
+
* transport failure it only does when the main model is reached through a DIFFERENT
|
|
139
|
+
* endpoint: against the same one the switch is a no-op that also rebuilds the digest,
|
|
140
|
+
* and the retry should simply be the same request again.
|
|
141
|
+
*/
|
|
142
|
+
private shouldEscalate;
|
|
133
143
|
private callOnce;
|
|
134
144
|
private checkCandidate;
|
|
135
145
|
private isCurrent;
|
|
@@ -166,7 +176,23 @@ export declare class Compactor implements ContextManager {
|
|
|
166
176
|
tokensBefore?: number;
|
|
167
177
|
tokensAfter: number;
|
|
168
178
|
}): boolean;
|
|
179
|
+
/**
|
|
180
|
+
* Route one non-applied verdict to the counter that owns it.
|
|
181
|
+
*
|
|
182
|
+
* TWO COUNTERS, NOT ONE (compaction-network-error-fetch-failed RC-3 / B'-2). A failure
|
|
183
|
+
* to reach the summarizer says nothing about the history, so it must not be the first
|
|
184
|
+
* strike of the 2-strike `stuckLimit` - but it cannot be free either: `maxPerRun`
|
|
185
|
+
* resets on every run, so without its own ceiling a persistently unreachable endpoint
|
|
186
|
+
* would raise a red card on every run and never pause. The transport check comes
|
|
187
|
+
* BEFORE the `abort|cancel|stale` filter because a cause string can contain "abort"
|
|
188
|
+
* (`UND_ERR_ABORTED`) and the reverse order would let it bypass both counters.
|
|
189
|
+
* Cancellations leave both counters alone; any other failure got an answer from the
|
|
190
|
+
* summarizer, which proves the path works, so the transport streak ends.
|
|
191
|
+
*/
|
|
192
|
+
private noteFailure;
|
|
193
|
+
private noteTransportFailure;
|
|
169
194
|
private noteNoProgress;
|
|
195
|
+
private selfDisable;
|
|
170
196
|
measure(_probe: Pick<CompactionProbe, 'lastUsage'> & {
|
|
171
197
|
messages?: readonly Message[];
|
|
172
198
|
systemPrompt?: string;
|
|
@@ -5,7 +5,7 @@ import { resolveFastTier } from '@aragon-agent/tui/model/fast/resolve';
|
|
|
5
5
|
import { COMPACTION_LIMITS } from '@aragon-agent/tui/model/compaction/limits';
|
|
6
6
|
import { buildDigest } from './digest.js';
|
|
7
7
|
import { buildCompactedBlock, countProtectedPrefix } from './summary-prompt.js';
|
|
8
|
-
import { accumulateUsage, errorText, runSummarizeCall, buildSummarizeRequest } from './summarize-call.js';
|
|
8
|
+
import { accumulateUsage, describeTransportFailure, errorText, runSummarizeCall, buildSummarizeRequest, TRANSPORT_FAILURE_CODE, } from './summarize-call.js';
|
|
9
9
|
import { shouldCompactAt } from '@aragon-agent/tui/model/compaction/pressure';
|
|
10
10
|
import { ContextMeter } from '@aragon-agent/tui/model/compaction/meter';
|
|
11
11
|
import { CompactionOperation } from './operation.js';
|
|
@@ -13,7 +13,7 @@ import { prepareMemoryInput } from './memory-input.js';
|
|
|
13
13
|
import { mergeMemory, parseMemoryDelta } from './memory.js';
|
|
14
14
|
import { validateMemoryDelta } from './memory-validation.js';
|
|
15
15
|
import { renderMemoryMarkdown } from './memory-render.js';
|
|
16
|
-
import { compactionReasonLine } from '@aragon-agent/tui/model/compaction/reason-text';
|
|
16
|
+
import { compactionReasonCode, compactionReasonLine, } from '@aragon-agent/tui/model/compaction/reason-text';
|
|
17
17
|
import { createCompactionIdentity, verifyCompactionIdentity, } from './memory-identity.js';
|
|
18
18
|
export class Compactor {
|
|
19
19
|
deps;
|
|
@@ -28,6 +28,7 @@ export class Compactor {
|
|
|
28
28
|
pricingUnknown = false;
|
|
29
29
|
costUsd = 0;
|
|
30
30
|
consecutiveNoProgress = 0;
|
|
31
|
+
consecutiveTransportFailures = 0;
|
|
31
32
|
selfDisabled = false;
|
|
32
33
|
selfDisabledReason;
|
|
33
34
|
pendingManual = null;
|
|
@@ -253,21 +254,34 @@ export class Compactor {
|
|
|
253
254
|
async summarize(state, input, selected, instructions) {
|
|
254
255
|
let choice = selected.choice;
|
|
255
256
|
let digest = selected.digest;
|
|
257
|
+
// WHAT THE NEXT ATTEMPT IS TOLD WENT WRONG: only a rejection of the model's own
|
|
258
|
+
// output. A request that never got an answer (`transportFailure`) is a different
|
|
259
|
+
// fact and is tracked apart - framing it as "Previous delta rejected" told a model
|
|
260
|
+
// that had never seen the earlier request to correct an error it did not make
|
|
261
|
+
// (compaction-network-error-fetch-failed RC-4).
|
|
256
262
|
let previousError;
|
|
263
|
+
let transportFailure = null;
|
|
257
264
|
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
258
265
|
if (state.operation.signal.aborted)
|
|
259
266
|
throw new Error('aborted');
|
|
260
|
-
if (attempt > 0) {
|
|
267
|
+
if (attempt > 0 && this.shouldEscalate(choice, transportFailure)) {
|
|
261
268
|
choice = this.mainChoice();
|
|
262
269
|
digest = this.digestFor(input, choice, instructions);
|
|
263
270
|
}
|
|
264
|
-
const
|
|
271
|
+
const answer = await this.callOnce(state, choice, {
|
|
265
272
|
digest: digest.text, hasPriorSummary: !!input.prior,
|
|
266
273
|
...(instructions ? { instructions } : {}),
|
|
267
274
|
...(previousError ? { validationError: previousError } : {}),
|
|
268
|
-
}).
|
|
275
|
+
}).then((reply) => ({ text: reply, transport: null }), (error) => {
|
|
276
|
+
const transport = describeTransportFailure(error, state.operation.signal);
|
|
277
|
+
if (transport === null)
|
|
278
|
+
previousError = errorText(error);
|
|
279
|
+
return { text: null, transport };
|
|
280
|
+
});
|
|
281
|
+
transportFailure = answer.transport;
|
|
269
282
|
if (state.operation.signal.aborted)
|
|
270
283
|
throw new Error(previousError ?? 'aborted');
|
|
284
|
+
const text = answer.text;
|
|
271
285
|
if (text === null)
|
|
272
286
|
continue;
|
|
273
287
|
try {
|
|
@@ -282,8 +296,28 @@ export class Compactor {
|
|
|
282
296
|
throw error;
|
|
283
297
|
}
|
|
284
298
|
}
|
|
299
|
+
// THE LAST ATTEMPT'S KIND DECIDES THE REASON: a failure to reach the summarizer must
|
|
300
|
+
// settle as `summarizer_unreachable` even when an earlier attempt got an unusable
|
|
301
|
+
// answer, otherwise it would be counted as "no progress" and push toward a pause.
|
|
302
|
+
if (transportFailure !== null)
|
|
303
|
+
throw new Error(transportFailure);
|
|
285
304
|
throw new Error(previousError ?? 'invalid_memory_delta');
|
|
286
305
|
}
|
|
306
|
+
/**
|
|
307
|
+
* Whether the second attempt moves to the main model.
|
|
308
|
+
*
|
|
309
|
+
* After an unusable answer it always does (a stronger model may do better). After a
|
|
310
|
+
* transport failure it only does when the main model is reached through a DIFFERENT
|
|
311
|
+
* endpoint: against the same one the switch is a no-op that also rebuilds the digest,
|
|
312
|
+
* and the retry should simply be the same request again.
|
|
313
|
+
*/
|
|
314
|
+
shouldEscalate(current, transportFailure) {
|
|
315
|
+
if (transportFailure === null)
|
|
316
|
+
return true;
|
|
317
|
+
const main = this.mainChoice();
|
|
318
|
+
return current.ref.providerId !== main.ref.providerId ||
|
|
319
|
+
(current.ref.baseUrl ?? '') !== (main.ref.baseUrl ?? '');
|
|
320
|
+
}
|
|
287
321
|
async callOnce(state, choice, input) {
|
|
288
322
|
const apiKey = this.deps.getApiKey(choice.ref.providerId, choice.role);
|
|
289
323
|
if (!apiKey)
|
|
@@ -427,6 +461,8 @@ export class Compactor {
|
|
|
427
461
|
this.generation = state.generation ?? this.generation;
|
|
428
462
|
this.appliedCompactions += 1;
|
|
429
463
|
this.recordApplied(verdict.tokensBefore ?? state.pressure.occupied, verdict.tokensAfter);
|
|
464
|
+
// A summary came back, so the path to the summarizer works.
|
|
465
|
+
this.consecutiveTransportFailures = 0;
|
|
430
466
|
this.meter().onHistorySpliced();
|
|
431
467
|
const projected = (verdict.tokensAfter + (state.pressure.estimateOffset ?? 0)) /
|
|
432
468
|
state.pressure.contextWindow;
|
|
@@ -437,9 +473,7 @@ export class Compactor {
|
|
|
437
473
|
this.noteNoProgress(state.trigger, 'insufficient_reclaim');
|
|
438
474
|
}
|
|
439
475
|
else {
|
|
440
|
-
|
|
441
|
-
if (!/abort|cancel|stale/.test(reason))
|
|
442
|
-
this.noteNoProgress(state.trigger, reason);
|
|
476
|
+
this.noteFailure(state.trigger, verdict.reason ?? state.reason ?? 'invalid_history');
|
|
443
477
|
}
|
|
444
478
|
this.log.info('compaction_settled', {
|
|
445
479
|
operationId: state.operation.id, trigger: state.trigger, applied: verdict.applied,
|
|
@@ -450,12 +484,50 @@ export class Compactor {
|
|
|
450
484
|
});
|
|
451
485
|
return true;
|
|
452
486
|
}
|
|
487
|
+
/**
|
|
488
|
+
* Route one non-applied verdict to the counter that owns it.
|
|
489
|
+
*
|
|
490
|
+
* TWO COUNTERS, NOT ONE (compaction-network-error-fetch-failed RC-3 / B'-2). A failure
|
|
491
|
+
* to reach the summarizer says nothing about the history, so it must not be the first
|
|
492
|
+
* strike of the 2-strike `stuckLimit` - but it cannot be free either: `maxPerRun`
|
|
493
|
+
* resets on every run, so without its own ceiling a persistently unreachable endpoint
|
|
494
|
+
* would raise a red card on every run and never pause. The transport check comes
|
|
495
|
+
* BEFORE the `abort|cancel|stale` filter because a cause string can contain "abort"
|
|
496
|
+
* (`UND_ERR_ABORTED`) and the reverse order would let it bypass both counters.
|
|
497
|
+
* Cancellations leave both counters alone; any other failure got an answer from the
|
|
498
|
+
* summarizer, which proves the path works, so the transport streak ends.
|
|
499
|
+
*/
|
|
500
|
+
noteFailure(trigger, reason) {
|
|
501
|
+
if (compactionReasonCode(reason) === TRANSPORT_FAILURE_CODE) {
|
|
502
|
+
this.noteTransportFailure(trigger, reason);
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
if (/abort|cancel|stale/.test(reason))
|
|
506
|
+
return;
|
|
507
|
+
if (trigger !== 'manual')
|
|
508
|
+
this.consecutiveTransportFailures = 0;
|
|
509
|
+
this.noteNoProgress(trigger, reason);
|
|
510
|
+
}
|
|
511
|
+
noteTransportFailure(trigger, reason) {
|
|
512
|
+
if (trigger === 'manual')
|
|
513
|
+
return;
|
|
514
|
+
// `compactionsThisRun` is deliberately NOT refunded: it is what bounds how long one
|
|
515
|
+
// run can be held by failing attempts.
|
|
516
|
+
this.consecutiveTransportFailures += 1;
|
|
517
|
+
if (this.consecutiveTransportFailures < COMPACTION_LIMITS.transportStuckLimit ||
|
|
518
|
+
this.selfDisabled)
|
|
519
|
+
return;
|
|
520
|
+
this.selfDisable(trigger, reason);
|
|
521
|
+
}
|
|
453
522
|
noteNoProgress(trigger, reason) {
|
|
454
523
|
if (trigger === 'manual')
|
|
455
524
|
return;
|
|
456
525
|
this.consecutiveNoProgress += 1;
|
|
457
526
|
if (this.consecutiveNoProgress < COMPACTION_LIMITS.stuckLimit || this.selfDisabled)
|
|
458
527
|
return;
|
|
528
|
+
this.selfDisable(trigger, reason);
|
|
529
|
+
}
|
|
530
|
+
selfDisable(trigger, reason) {
|
|
459
531
|
this.selfDisabled = true;
|
|
460
532
|
this.selfDisabledReason = reason;
|
|
461
533
|
// THE LOG LINE IS BACK ON PURPOSE (C / analysis 3.3.1 (c)). Commit 4b61a2f8a
|
|
@@ -483,6 +555,7 @@ export class Compactor {
|
|
|
483
555
|
this.selfDisabled = false;
|
|
484
556
|
this.selfDisabledReason = undefined;
|
|
485
557
|
this.consecutiveNoProgress = 0;
|
|
558
|
+
this.consecutiveTransportFailures = 0;
|
|
486
559
|
}
|
|
487
560
|
isSelfDisabled() { return this.selfDisabled; }
|
|
488
561
|
resolveSummarizer() {
|
|
@@ -3,6 +3,28 @@ import type { AssistantMessage, LLMRequest, ModelRef, TokenUsage } from '@aragon
|
|
|
3
3
|
/** The assistant text of a completion, or `''` for an answer with no text block. */
|
|
4
4
|
export declare function assistantText(message: AssistantMessage | undefined): string;
|
|
5
5
|
export declare function errorText(err: unknown): string;
|
|
6
|
+
/** The stable reason code of a summarization whose request never got an answer. */
|
|
7
|
+
export declare const TRANSPORT_FAILURE_CODE = "summarizer_unreachable";
|
|
8
|
+
/**
|
|
9
|
+
* `summarizer_unreachable: <message>` when `err` is a transport failure, else `null`.
|
|
10
|
+
*
|
|
11
|
+
* THE QUESTION IS "DID THE REQUEST GET A MODEL ANSWER AT ALL" - it decides whether the
|
|
12
|
+
* failure says anything about the history or the summarizer's output (it does not), so
|
|
13
|
+
* it must not feed `validationError`, escalate to another model, or count as "no
|
|
14
|
+
* progress" (compaction-network-error-fetch-failed RC-3 / RC-4).
|
|
15
|
+
*
|
|
16
|
+
* THE ORDER IS THE SEMANTICS:
|
|
17
|
+
* 1. An aborted signal is never a transport failure. `wrapFetchError` marks a user
|
|
18
|
+
* Esc `retryable`, so blaming the network for it would be wrong twice over
|
|
19
|
+
* (`core/llm/retry.ts` applies the same ordering).
|
|
20
|
+
* 2. Only `errorType === 'network_error'` qualifies, read structurally rather than
|
|
21
|
+
* with `instanceof` (the same error can come from a second copy of core). A 429 or
|
|
22
|
+
* 5xx reached the provider and says something about quota or load, so those keep
|
|
23
|
+
* counting as no-progress; a local `timeout` aborts the whole operation anyway.
|
|
24
|
+
*
|
|
25
|
+
* The message already carries the cause (`wrapFetchError`), so it is not re-derived here.
|
|
26
|
+
*/
|
|
27
|
+
export declare function describeTransportFailure(err: unknown, signal: AbortSignal): string | null;
|
|
6
28
|
/**
|
|
7
29
|
* The call's spend.
|
|
8
30
|
*
|
|
@@ -14,6 +14,35 @@ export function assistantText(message) {
|
|
|
14
14
|
export function errorText(err) {
|
|
15
15
|
return err instanceof Error ? err.message : String(err);
|
|
16
16
|
}
|
|
17
|
+
/** The stable reason code of a summarization whose request never got an answer. */
|
|
18
|
+
export const TRANSPORT_FAILURE_CODE = 'summarizer_unreachable';
|
|
19
|
+
/**
|
|
20
|
+
* `summarizer_unreachable: <message>` when `err` is a transport failure, else `null`.
|
|
21
|
+
*
|
|
22
|
+
* THE QUESTION IS "DID THE REQUEST GET A MODEL ANSWER AT ALL" - it decides whether the
|
|
23
|
+
* failure says anything about the history or the summarizer's output (it does not), so
|
|
24
|
+
* it must not feed `validationError`, escalate to another model, or count as "no
|
|
25
|
+
* progress" (compaction-network-error-fetch-failed RC-3 / RC-4).
|
|
26
|
+
*
|
|
27
|
+
* THE ORDER IS THE SEMANTICS:
|
|
28
|
+
* 1. An aborted signal is never a transport failure. `wrapFetchError` marks a user
|
|
29
|
+
* Esc `retryable`, so blaming the network for it would be wrong twice over
|
|
30
|
+
* (`core/llm/retry.ts` applies the same ordering).
|
|
31
|
+
* 2. Only `errorType === 'network_error'` qualifies, read structurally rather than
|
|
32
|
+
* with `instanceof` (the same error can come from a second copy of core). A 429 or
|
|
33
|
+
* 5xx reached the provider and says something about quota or load, so those keep
|
|
34
|
+
* counting as no-progress; a local `timeout` aborts the whole operation anyway.
|
|
35
|
+
*
|
|
36
|
+
* The message already carries the cause (`wrapFetchError`), so it is not re-derived here.
|
|
37
|
+
*/
|
|
38
|
+
export function describeTransportFailure(err, signal) {
|
|
39
|
+
if (signal.aborted)
|
|
40
|
+
return null;
|
|
41
|
+
const errorType = err?.errorType;
|
|
42
|
+
if (errorType !== 'network_error')
|
|
43
|
+
return null;
|
|
44
|
+
return `${TRANSPORT_FAILURE_CODE}: ${errorText(err)}`;
|
|
45
|
+
}
|
|
17
46
|
/**
|
|
18
47
|
* The call's spend.
|
|
19
48
|
*
|
|
@@ -6,14 +6,33 @@ import { createChildContextManager } from './child.js';
|
|
|
6
6
|
import { Compactor } from './compactor.js';
|
|
7
7
|
import { ContextMeter } from '@aragon-agent/tui/model/compaction/meter';
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* (D-10).
|
|
9
|
+
* At most three retries inside 18 s - bounded, and not the user's ten (D-10).
|
|
11
10
|
*
|
|
12
11
|
* Inheriting the user's `/retry` policy would let a background repair compete
|
|
13
12
|
* with the user's own work for a rate-limited provider's quota, and it would put
|
|
14
13
|
* up to ten backoffs inside a window the idle watchdog is PAUSED across.
|
|
14
|
+
*
|
|
15
|
+
* WHY MORE THAN THE ONE RETRY THIS USED TO BE (compaction-network-error-fetch-failed
|
|
16
|
+
* C-lite). A dropped connection never reaches the provider, so retrying it spends no
|
|
17
|
+
* quota, and on the reporting machine outages come in bursts (median 11 s) that four
|
|
18
|
+
* tries in two summarize attempts could not ride out. The budget is the wall clock,
|
|
19
|
+
* not the count: `maxElapsedMs` makes `decide()` stop with `budget_exhausted` once the
|
|
20
|
+
* next wait would not fit, which also bounds the quota concern - a 429 whose
|
|
21
|
+
* `Retry-After` exceeds the remaining budget is raised at once instead of waited out.
|
|
22
|
+
*
|
|
23
|
+
* THE NUMBERS ARE COUPLED TO TWO CEILINGS THIS FILE DOES NOT OWN, and
|
|
24
|
+
* `compaction-wiring.test.ts` pins them. One call must finish inside
|
|
25
|
+
* `COMPACTION_LIMITS.callTimeoutMs` (45 s) even when every failed try takes the slow
|
|
26
|
+
* ~12 s observed, i.e. `2 x 12 s + maxElapsedMs < 45 s`; a call that crosses it is cut
|
|
27
|
+
* as `timeout`, which ends the WHOLE operation. And two such calls (90 s) must fit in
|
|
28
|
+
* core's engine-level `COMPACTION_HARD_TIMEOUT_MS` (120 s), which reports
|
|
29
|
+
* `manager_timeout` - a code with no wording that counts as "no progress". Raising
|
|
30
|
+
* `maxRetries` alone is therefore worse than not raising it. Do not touch the timeouts
|
|
31
|
+
* in `limits.ts` to make room; the 120 s ceiling is not configurable from here.
|
|
15
32
|
*/
|
|
16
|
-
const COMPACTION_RETRY_POLICY = {
|
|
33
|
+
const COMPACTION_RETRY_POLICY = {
|
|
34
|
+
...DEFAULT_RETRY_POLICY, maxRetries: 3, maxElapsedMs: 18_000,
|
|
35
|
+
};
|
|
17
36
|
/** The status of a session that never had compaction (the wiring is `null`). */
|
|
18
37
|
export function offCompactionSnapshot() {
|
|
19
38
|
return {
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* ├── logs/ JSONL logs (0700 on POSIX)
|
|
22
22
|
* ├── sessions/ /save · /resume
|
|
23
23
|
* ├── skills/ `aragon skills install` target
|
|
24
|
+
* ├── memory/ agent memory: one Markdown file per note (0700 / 0600 on POSIX)
|
|
24
25
|
* └── skill-usage.json
|
|
25
26
|
*
|
|
26
27
|
* The two files added by config-state-separation are DIRECT CHILDREN of the
|
|
@@ -161,6 +162,18 @@ export declare function getCompactionArchiveDir(): string;
|
|
|
161
162
|
* The caller creates it (0700 on POSIX); this function only names it.
|
|
162
163
|
*/
|
|
163
164
|
export declare function getGovernanceDir(): string;
|
|
165
|
+
/**
|
|
166
|
+
* `<home>/memory` - agent memory (agent-memory spec 5.1).
|
|
167
|
+
*
|
|
168
|
+
* ITS OWN ROOT, for the reason `getCompactionArchiveDir` and `getGovernanceDir` record:
|
|
169
|
+
* `logs/`, `sessions/` and `skills/` are scan roots, and every extra directory inside one
|
|
170
|
+
* is another thing each walk has to recognise and skip. Derived from the same
|
|
171
|
+
* `resolution.root`, so the `ARAGON_HOME` / VITEST isolation contract at the top of this
|
|
172
|
+
* file covers it too: a test that clears `getMemoryDir()` recursively would be deleting a
|
|
173
|
+
* real user's notes, so tests delete single files or directories they built themselves.
|
|
174
|
+
* The caller creates it (0700 on POSIX); this function only names it.
|
|
175
|
+
*/
|
|
176
|
+
export declare function getMemoryDir(): string;
|
|
164
177
|
/** `<home>` — parent of `skills/`, and where sidecar state such as usage lives. */
|
|
165
178
|
export declare function getUserDataDir(): string;
|
|
166
179
|
export declare function getUserSkillsDir(): string;
|
package/dist/config/app-paths.js
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* ├── logs/ JSONL logs (0700 on POSIX)
|
|
22
22
|
* ├── sessions/ /save · /resume
|
|
23
23
|
* ├── skills/ `aragon skills install` target
|
|
24
|
+
* ├── memory/ agent memory: one Markdown file per note (0700 / 0600 on POSIX)
|
|
24
25
|
* └── skill-usage.json
|
|
25
26
|
*
|
|
26
27
|
* The two files added by config-state-separation are DIRECT CHILDREN of the
|
|
@@ -254,6 +255,20 @@ export function getCompactionArchiveDir() {
|
|
|
254
255
|
export function getGovernanceDir() {
|
|
255
256
|
return join(resolution.root, 'governance');
|
|
256
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
* `<home>/memory` - agent memory (agent-memory spec 5.1).
|
|
260
|
+
*
|
|
261
|
+
* ITS OWN ROOT, for the reason `getCompactionArchiveDir` and `getGovernanceDir` record:
|
|
262
|
+
* `logs/`, `sessions/` and `skills/` are scan roots, and every extra directory inside one
|
|
263
|
+
* is another thing each walk has to recognise and skip. Derived from the same
|
|
264
|
+
* `resolution.root`, so the `ARAGON_HOME` / VITEST isolation contract at the top of this
|
|
265
|
+
* file covers it too: a test that clears `getMemoryDir()` recursively would be deleting a
|
|
266
|
+
* real user's notes, so tests delete single files or directories they built themselves.
|
|
267
|
+
* The caller creates it (0700 on POSIX); this function only names it.
|
|
268
|
+
*/
|
|
269
|
+
export function getMemoryDir() {
|
|
270
|
+
return join(resolution.root, 'memory');
|
|
271
|
+
}
|
|
257
272
|
/** `<home>` — parent of `skills/`, and where sidecar state such as usage lives. */
|
|
258
273
|
export function getUserDataDir() {
|
|
259
274
|
return resolution.root;
|
|
@@ -101,6 +101,11 @@ export declare const COMPACTION_CONFIG_SET_KEYS: readonly ["compaction.enabled",
|
|
|
101
101
|
* Every key is writable and ONE level deep, so `runConfigGet`'s single-dot split resolves it.
|
|
102
102
|
*/
|
|
103
103
|
export declare const GOVERNANCE_CONFIG_SET_KEYS: readonly ["governance.enabled", "governance.shiftTab", "governance.panel", "governance.profile", "governance.maxWorkPackages", "governance.maxPhases", "governance.maxRework", "governance.maxFixCycles", "governance.minAskRounds", "governance.budgetTokens", "governance.confirmCharter"];
|
|
104
|
+
/**
|
|
105
|
+
* Config keys under `memory.` that `aragon config set` accepts (agent-memory spec 5.6).
|
|
106
|
+
* Every key is writable and ONE level deep, so `runConfigGet`'s single-dot split resolves it.
|
|
107
|
+
*/
|
|
108
|
+
export declare const MEMORY_CONFIG_SET_KEYS: readonly ["memory.enabled", "memory.autoload", "memory.agentWrites", "memory.indexMaxChars", "memory.bodyBudgetChars", "memory.perBodyMaxChars"];
|
|
104
109
|
/**
|
|
105
110
|
* Translate a `log.*` dotted key into a patch, or `null` for anything else.
|
|
106
111
|
*
|
|
@@ -149,6 +154,16 @@ export declare function applyTaskSummaryConfigSet(key: string, value: string): P
|
|
|
149
154
|
* `governance` (the ninth time that trap is recorded in `store.ts`).
|
|
150
155
|
*/
|
|
151
156
|
export declare function applyGovernanceConfigSet(key: string, value: string): Partial<PersistedConfig> | null;
|
|
157
|
+
/**
|
|
158
|
+
* Translate a `memory.*` dotted key into a patch, or `null` for anything else.
|
|
159
|
+
*
|
|
160
|
+
* EVERY KEY ROUTES THROUGH `clampMemoryConfig`, so `config set memory.agentWrites banana`
|
|
161
|
+
* stores `ask` (the safe direction) and the caller echoes the STORED value. A numeric
|
|
162
|
+
* argument that does not parse becomes `NaN`, which the clamp repairs to the default.
|
|
163
|
+
* The patch is a PARTIAL section, safe only because `updatePersistedConfig` deep-merges
|
|
164
|
+
* `memory` (the tenth time that trap is recorded in `store.ts`).
|
|
165
|
+
*/
|
|
166
|
+
export declare function applyMemoryConfigSet(key: string, value: string): Partial<PersistedConfig> | null;
|
|
152
167
|
/**
|
|
153
168
|
* Translate a `team.*` dotted key into a patch, or `null` for anything else.
|
|
154
169
|
*
|
|
@@ -14,7 +14,7 @@ import { getConfigBackupPath, getConfigPath, getHomeRoot, getLogsDir, getPromptH
|
|
|
14
14
|
import { getHomeMigrationBreadcrumbPath } from './migrate-home.js';
|
|
15
15
|
import { loadPersistedConfig, updatePersistedConfig } from './store.js';
|
|
16
16
|
import { normalizeModelProfiles, validateModelProfiles } from '@aragon-agent/tui/model/config/model-profiles';
|
|
17
|
-
import { clampFastConfig, clampRetryConfig, clampCompactionConfig, clampTeamConfig, parseThresholdInput, clampUpdateConfig, coercePositiveInt, maskSecret, DEFAULT_FAST_CONFIG, DEFAULT_RETRY_CONFIG, DEFAULT_TEAM_CONFIG, DEFAULT_COMPACTION_CONFIG, DEFAULT_UPDATE_CONFIG, DEFAULT_JOBS_CONFIG, clampJobsConfig, clampGovernanceConfig, DEFAULT_GOVERNANCE_CONFIG, } from '@aragon-agent/tui/model/config/schema';
|
|
17
|
+
import { clampFastConfig, clampRetryConfig, clampCompactionConfig, clampTeamConfig, parseThresholdInput, clampUpdateConfig, coercePositiveInt, maskSecret, DEFAULT_FAST_CONFIG, DEFAULT_RETRY_CONFIG, DEFAULT_TEAM_CONFIG, DEFAULT_COMPACTION_CONFIG, DEFAULT_UPDATE_CONFIG, DEFAULT_JOBS_CONFIG, clampJobsConfig, clampGovernanceConfig, clampMemoryConfig, DEFAULT_GOVERNANCE_CONFIG, DEFAULT_MEMORY_CONFIG, } from '@aragon-agent/tui/model/config/schema';
|
|
18
18
|
import { clampLogLevel } from '@aragon-agent/tui/model/logging/levels';
|
|
19
19
|
/** Config keys under `log.` that `aragon config set` accepts. */
|
|
20
20
|
export const LOG_CONFIG_SET_KEYS = [
|
|
@@ -184,6 +184,18 @@ export const GOVERNANCE_CONFIG_SET_KEYS = [
|
|
|
184
184
|
'governance.budgetTokens',
|
|
185
185
|
'governance.confirmCharter',
|
|
186
186
|
];
|
|
187
|
+
/**
|
|
188
|
+
* Config keys under `memory.` that `aragon config set` accepts (agent-memory spec 5.6).
|
|
189
|
+
* Every key is writable and ONE level deep, so `runConfigGet`'s single-dot split resolves it.
|
|
190
|
+
*/
|
|
191
|
+
export const MEMORY_CONFIG_SET_KEYS = [
|
|
192
|
+
'memory.enabled',
|
|
193
|
+
'memory.autoload',
|
|
194
|
+
'memory.agentWrites',
|
|
195
|
+
'memory.indexMaxChars',
|
|
196
|
+
'memory.bodyBudgetChars',
|
|
197
|
+
'memory.perBodyMaxChars',
|
|
198
|
+
];
|
|
187
199
|
function isTrue(value) {
|
|
188
200
|
return value === 'true' || value === '1';
|
|
189
201
|
}
|
|
@@ -292,6 +304,25 @@ export function applyGovernanceConfigSet(key, value) {
|
|
|
292
304
|
const clamped = clampGovernanceConfig({ ...DEFAULT_GOVERNANCE_CONFIG, [field]: typed });
|
|
293
305
|
return { governance: { [field]: clamped[field] } };
|
|
294
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* Translate a `memory.*` dotted key into a patch, or `null` for anything else.
|
|
309
|
+
*
|
|
310
|
+
* EVERY KEY ROUTES THROUGH `clampMemoryConfig`, so `config set memory.agentWrites banana`
|
|
311
|
+
* stores `ask` (the safe direction) and the caller echoes the STORED value. A numeric
|
|
312
|
+
* argument that does not parse becomes `NaN`, which the clamp repairs to the default.
|
|
313
|
+
* The patch is a PARTIAL section, safe only because `updatePersistedConfig` deep-merges
|
|
314
|
+
* `memory` (the tenth time that trap is recorded in `store.ts`).
|
|
315
|
+
*/
|
|
316
|
+
export function applyMemoryConfigSet(key, value) {
|
|
317
|
+
if (!MEMORY_CONFIG_SET_KEYS.includes(key))
|
|
318
|
+
return null;
|
|
319
|
+
const field = key.slice('memory.'.length);
|
|
320
|
+
const trimmed = value.trim();
|
|
321
|
+
const kind = typeof DEFAULT_MEMORY_CONFIG[field];
|
|
322
|
+
const typed = kind === 'boolean' ? isTrue(trimmed) : kind === 'number' ? (trimmed === '' ? Number.NaN : Number(trimmed)) : trimmed;
|
|
323
|
+
const clamped = clampMemoryConfig({ ...DEFAULT_MEMORY_CONFIG, [field]: typed });
|
|
324
|
+
return { memory: { [field]: clamped[field] } };
|
|
325
|
+
}
|
|
295
326
|
function parseGovernanceArgument(field, value) {
|
|
296
327
|
const kind = typeof DEFAULT_GOVERNANCE_CONFIG[field];
|
|
297
328
|
const trimmed = value.trim();
|
package/dist/config/env.d.ts
CHANGED
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
* ARAGON_JOBS_ENABLED, ARAGON_JOBS_WAIT_SECONDS, ARAGON_JOBS_STALL_SECONDS,
|
|
23
23
|
* ARAGON_JOBS_PERSIST_LOG, ARAGON_JOBS_NOTICE_STEER,
|
|
24
24
|
* ARAGON_PROMPTS (the quick-prompt library's `enabled` switch, and only that),
|
|
25
|
-
*
|
|
25
|
+
* ARAGON_MEMORY (agent memory's kill switch: `0` turns it off, nothing turns it on),
|
|
26
|
+
* ARAGON_GOVERNANCE (a KILL switch: `0` disables governance mode, nothing enables it),
|
|
27
|
+
* ARAGON_REDTEAM (a KILL switch: `0` disables red team mode, nothing enables it).
|
|
26
28
|
*
|
|
27
29
|
* READ ELSEWHERE, ON PURPOSE: `ARAGON_UPDATE_REGISTRY` and `npm_config_registry`
|
|
28
30
|
* are resolved by `update/registry.ts::resolveRegistryUrl`, NOT here, because
|
package/dist/config/env.js
CHANGED
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
* ARAGON_JOBS_ENABLED, ARAGON_JOBS_WAIT_SECONDS, ARAGON_JOBS_STALL_SECONDS,
|
|
23
23
|
* ARAGON_JOBS_PERSIST_LOG, ARAGON_JOBS_NOTICE_STEER,
|
|
24
24
|
* ARAGON_PROMPTS (the quick-prompt library's `enabled` switch, and only that),
|
|
25
|
-
*
|
|
25
|
+
* ARAGON_MEMORY (agent memory's kill switch: `0` turns it off, nothing turns it on),
|
|
26
|
+
* ARAGON_GOVERNANCE (a KILL switch: `0` disables governance mode, nothing enables it),
|
|
27
|
+
* ARAGON_REDTEAM (a KILL switch: `0` disables red team mode, nothing enables it).
|
|
26
28
|
*
|
|
27
29
|
* READ ELSEWHERE, ON PURPOSE: `ARAGON_UPDATE_REGISTRY` and `npm_config_registry`
|
|
28
30
|
* are resolved by `update/registry.ts::resolveRegistryUrl`, NOT here, because
|
|
@@ -337,6 +339,26 @@ export function readEnvConfig() {
|
|
|
337
339
|
if (isGovernanceEnvDisabled(process.env)) {
|
|
338
340
|
partial.governance = { enabled: false };
|
|
339
341
|
}
|
|
342
|
+
// ARAGON_MEMORY=0 is the agent-memory KILL switch (agent-memory spec 5.6): it can only
|
|
343
|
+
// switch `enabled` OFF, and it outranks the config file. Like `ARAGON_GOVERNANCE` it is
|
|
344
|
+
// not a toggle - `ARAGON_MEMORY=1` writes nothing, so an environment variable can never
|
|
345
|
+
// re-enable what the user's config or `--no-memory` turned off, and it can never reach
|
|
346
|
+
// `agentWrites`: an env var that silently let the model write to persistent memory
|
|
347
|
+
// would not be a kill switch.
|
|
348
|
+
const memory = process.env.ARAGON_MEMORY?.trim().toLowerCase();
|
|
349
|
+
if (memory === '0' || memory === 'false' || memory === 'off' || memory === 'no') {
|
|
350
|
+
partial.memory = { enabled: false };
|
|
351
|
+
}
|
|
352
|
+
// ARAGON_REDTEAM=0 is red team mode's KILL switch (red-team-security-mode 4.8 / D-15): it
|
|
353
|
+
// can only switch `enabled` OFF, and it outranks the config file. Like ARAGON_MEMORY it is
|
|
354
|
+
// not a toggle - `ARAGON_REDTEAM=1` writes nothing - and that asymmetry is the point: an
|
|
355
|
+
// environment must never be able to put a user into a liability posture the user's own
|
|
356
|
+
// config or `--no-redteam` turned off, because the waiver lives in the user's session, not
|
|
357
|
+
// in the shell that launched it.
|
|
358
|
+
const redteam = process.env.ARAGON_REDTEAM?.trim().toLowerCase();
|
|
359
|
+
if (redteam === '0' || redteam === 'false' || redteam === 'off' || redteam === 'no') {
|
|
360
|
+
partial.redteam = { enabled: false };
|
|
361
|
+
}
|
|
340
362
|
// ARAGON_TASK_SUMMARY is the header label's kill switch
|
|
341
363
|
// (tui-shortcut-drawer-and-task-summary §4.8 / P2-7), and it maps `enabled` and
|
|
342
364
|
// NOTHING ELSE - the same wording and the same reason as the block above. A
|
package/dist/config/load.d.ts
CHANGED
|
@@ -255,6 +255,24 @@ export interface CliFlags {
|
|
|
255
255
|
* never written to the store.
|
|
256
256
|
*/
|
|
257
257
|
governance?: boolean;
|
|
258
|
+
/**
|
|
259
|
+
* `--no-memory`, carried as `false` ONLY, for the reason `governance` above records: a
|
|
260
|
+
* lone negative flag makes commander default its option to `true`, so `cli.tsx` forwards
|
|
261
|
+
* `undefined` for silence. Launch-only: never written to the store.
|
|
262
|
+
*/
|
|
263
|
+
memory?: boolean;
|
|
264
|
+
/**
|
|
265
|
+
* `--redteam` / `--no-redteam` (red-team-security-mode 4.8), carried as a PAIR for the
|
|
266
|
+
* reason `--compaction` above records: `redteam.enabled` is persisted and defaults to
|
|
267
|
+
* `true`, so a lone `--no-redteam` would make commander default the option to `true`, and
|
|
268
|
+
* the flag would then overwrite a stored `false` on every run that passed no flag at all.
|
|
269
|
+
* `cli.tsx` forwards `undefined` for silence.
|
|
270
|
+
*
|
|
271
|
+
* BOTH ARE LAUNCH-ONLY: neither is written to the store. `--redteam` additionally means
|
|
272
|
+
* "start armed", which is session state and is resolved by `redteam-launch.ts`.
|
|
273
|
+
*/
|
|
274
|
+
redteam?: boolean;
|
|
275
|
+
noRedteam?: boolean;
|
|
258
276
|
/**
|
|
259
277
|
* `--resume <id|path>` - continue a saved session under a NEW id
|
|
260
278
|
* (tui-session-id-resume 4).
|
package/dist/config/load.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* legitimately long single tool run can never be watchdog-killed.
|
|
7
7
|
*/
|
|
8
8
|
import process from 'node:process';
|
|
9
|
-
import { DEFAULT_CONFIG, DEFAULT_SCROLL_MODE, IDLE_TIMEOUT_MARGIN_MS, clampDensity, clampHumanTimeout, clampCompactionConfig, clampLogConfig, clampFastConfig, clampRetryConfig, clampSkillsConfig, clampTeamConfig, clampTodoConfig, clampBashConfig, clampJobsConfig, clampPromptsConfig, clampTaskSummaryConfig, clampUpdateConfig, clampTheme, clampThinkingLevel, clampContextWindow, clampMaxTokens, clampMaxRenderInterval, clampScrollMode, clampScrollResumeMs, clampTranscriptRetain, clampTranscriptWindow, coercePositiveInt, isAutoToken, isSkillsToolPolicyMode, legacyTeamCeilingPatch, legacyTeamFanoutPatch, LEGACY_TEAM_FANOUT_DEFAULTS, parseThresholdInput, } from '@aragon-agent/tui/model/config/schema';
|
|
9
|
+
import { DEFAULT_CONFIG, DEFAULT_SCROLL_MODE, IDLE_TIMEOUT_MARGIN_MS, clampDensity, clampHumanTimeout, clampCompactionConfig, clampLogConfig, clampFastConfig, clampRetryConfig, clampSkillsConfig, clampTeamConfig, clampTodoConfig, clampBashConfig, clampJobsConfig, clampPromptsConfig, clampMemoryConfig, clampRedTeamConfig, clampTaskSummaryConfig, clampUpdateConfig, clampTheme, clampThinkingLevel, clampContextWindow, clampMaxTokens, clampMaxRenderInterval, clampScrollMode, clampScrollResumeMs, clampTranscriptRetain, clampTranscriptWindow, coercePositiveInt, isAutoToken, isSkillsToolPolicyMode, legacyTeamCeilingPatch, legacyTeamFanoutPatch, LEGACY_TEAM_FANOUT_DEFAULTS, parseThresholdInput, } from '@aragon-agent/tui/model/config/schema';
|
|
10
10
|
import { loadDotenv, readEnvConfig, readEnvDisabledSkills } from './env.js';
|
|
11
11
|
import { readConfigFile, updatePersistedConfig } from './store.js';
|
|
12
12
|
import { projectModelProfiles, resolveModelProfileState, resolveModelRoleKey, } from '@aragon-agent/tui/model/config/model-profile-resolution';
|
|
@@ -797,6 +797,24 @@ export function loadConfig(flags = {}, options = {}) {
|
|
|
797
797
|
taskSummary: clampTaskSummaryConfig({ ...DEFAULT_CONFIG.taskSummary,
|
|
798
798
|
...(env.partial.taskSummary ?? {}), ...(file.taskSummary ?? {}) }),
|
|
799
799
|
governance,
|
|
800
|
+
// Agent memory: file < env kill switch < `--no-memory`, clamped like every section. The
|
|
801
|
+
// kill switches can only switch `enabled` OFF; they are applied AFTER the file so they
|
|
802
|
+
// outrank it, and `clampMemoryConfig` keeps `agentWrites` on the safe side of a typo.
|
|
803
|
+
memory: clampMemoryConfig({
|
|
804
|
+
...DEFAULT_CONFIG.memory,
|
|
805
|
+
...(file.memory ?? {}),
|
|
806
|
+
...(env.partial.memory ?? {}),
|
|
807
|
+
...(flags.memory === false ? { enabled: false } : {}),
|
|
808
|
+
}),
|
|
809
|
+
// Red team / security mode: file < env kill switch < `--no-redteam`, clamped like every
|
|
810
|
+
// section. The kill switches can only switch `enabled` OFF and are applied AFTER the file
|
|
811
|
+
// so they outrank it - an environment must never be able to switch the mode ON (D-15).
|
|
812
|
+
redteam: clampRedTeamConfig({
|
|
813
|
+
...DEFAULT_CONFIG.redteam,
|
|
814
|
+
...(file.redteam ?? {}),
|
|
815
|
+
...(env.partial.redteam ?? {}),
|
|
816
|
+
...(flags.noRedteam === true ? { enabled: false } : {}),
|
|
817
|
+
}),
|
|
800
818
|
initialPosture,
|
|
801
819
|
cwd,
|
|
802
820
|
color,
|