@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
|
@@ -22,6 +22,20 @@ export interface SystemPromptParams {
|
|
|
22
22
|
* an unconditional extra guidance line would quietly break all three.
|
|
23
23
|
*/
|
|
24
24
|
skillsBlock?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The rendered `<memory>` block, or `''` / absent (agent-memory spec 6.4, I-2).
|
|
27
|
+
*
|
|
28
|
+
* POSITION IS THE SEMANTICS (D-5): after `<project_guidance>` and BEFORE the skills catalog.
|
|
29
|
+
* The system prompt is ordered "most stable first" so the provider's prefix cache survives:
|
|
30
|
+
* memory changes only when the user (or an approved tool call) edits a note or a mount, which
|
|
31
|
+
* is rarer than a plan / team mode switch, so it sits in front of them. It must NOT go between
|
|
32
|
+
* `<available_skills>` and `<skill_triage>`: the triage block's first sentence points at the
|
|
33
|
+
* catalog "above", and adjacency is part of its meaning.
|
|
34
|
+
*
|
|
35
|
+
* Spliced conditionally exactly as `skillsBlock` is, so an absent or empty value produces the
|
|
36
|
+
* pre-memory prompt BYTE FOR BYTE (`memory.enabled: false`, `-p`, and every subagent).
|
|
37
|
+
*/
|
|
38
|
+
memoryBlock?: string;
|
|
25
39
|
/**
|
|
26
40
|
* The session's current mode. Absent or `'build'` produces a BYTE-IDENTICAL
|
|
27
41
|
* prompt to the pre-plan-mode output for a fixed `tools` array (I-P1) — the
|
|
@@ -191,6 +205,19 @@ export interface SystemPromptParams {
|
|
|
191
205
|
* Only read when `agentMode` is `'plan'`; absent leaves the plan block unchanged.
|
|
192
206
|
*/
|
|
193
207
|
governAddendum?: string;
|
|
208
|
+
/**
|
|
209
|
+
* The rendered `<redteam_mode>` block, or '' (red-team-security-mode 4.6 / D-7).
|
|
210
|
+
*
|
|
211
|
+
* SPLICED IMMEDIATELY AFTER `buildProjectGuidanceBlock()` AND BEFORE `memoryBlock`, and that
|
|
212
|
+
* position is the argument: this block declares who authorized this session and where the
|
|
213
|
+
* boundary is, so it is the frame that explains the scale of every capability block after
|
|
214
|
+
* it. It also has to come after the base prompt's environment and tool list, because a
|
|
215
|
+
* scope sits on top of a real working directory and a real toolset.
|
|
216
|
+
*
|
|
217
|
+
* CONDITIONAL LIKE EVERY BLOCK ABOVE, which is what makes I-1 true: with the mode off the
|
|
218
|
+
* prompt is byte-identical to the pre-feature text for a fixed tool array.
|
|
219
|
+
*/
|
|
220
|
+
redteamBlock?: string;
|
|
194
221
|
}
|
|
195
222
|
/** Describe the active shell so the model does not emit incompatible syntax. */
|
|
196
223
|
export declare function describeShell(): {
|
|
@@ -32,6 +32,7 @@ export function buildSystemPrompt(params) {
|
|
|
32
32
|
: `The bash tool runs commands through ${shell} ("/bin/sh -c"). Standard POSIX syntax is fine.`;
|
|
33
33
|
const skillsBlock = params.skillsBlock ?? '';
|
|
34
34
|
const hasSkills = skillsBlock.length > 0;
|
|
35
|
+
const memoryBlock = params.memoryBlock ?? '';
|
|
35
36
|
const planBlock = params.agentMode === 'plan'
|
|
36
37
|
? buildPlanModeBlock({
|
|
37
38
|
interactive: params.planInteractive !== false,
|
|
@@ -52,6 +53,7 @@ export function buildSystemPrompt(params) {
|
|
|
52
53
|
const jobsBlock = params.jobsBlock ?? '';
|
|
53
54
|
const imageInputBlock = params.imageInputBlock ?? '';
|
|
54
55
|
const structuredResultBlock = params.structuredResultBlock ?? '';
|
|
56
|
+
const redteamBlock = params.redteamBlock ?? '';
|
|
55
57
|
const appended = (params.appendSystemPrompt ?? '').trim();
|
|
56
58
|
return [
|
|
57
59
|
'You are AragonAgent, an autonomous coding assistant operating inside a terminal (TUI).',
|
|
@@ -67,6 +69,14 @@ export function buildSystemPrompt(params) {
|
|
|
67
69
|
// Base-prompt upgrade; optional blocks still preserve empty/absent equivalence.
|
|
68
70
|
'',
|
|
69
71
|
buildProjectGuidanceBlock(),
|
|
72
|
+
// IMMEDIATELY AFTER THE PROJECT GUIDANCE AND BEFORE THE SKILLS CATALOG
|
|
73
|
+
// (red-team-security-mode D-7). This block says WHO authorized this session and WHERE the
|
|
74
|
+
// boundary is; a model that reads "you may do X" first and "the boundary is Y" afterwards
|
|
75
|
+
// has been given the capability before the constraint, which is not how a professional
|
|
76
|
+
// reads an engagement letter. Conditional, so `''` splices nothing (I-1).
|
|
77
|
+
...(redteamBlock ? ['', redteamBlock] : []),
|
|
78
|
+
// AFTER the project guidance and BEFORE the skills catalog (agent-memory D-5).
|
|
79
|
+
...(memoryBlock ? ['', memoryBlock] : []),
|
|
70
80
|
...(hasSkills ? ['', skillsBlock] : []),
|
|
71
81
|
// AFTER <available_skills> (it refers to it as "above") and BEFORE <plan_mode>
|
|
72
82
|
// (whose step 1 defers to it). Conditional like every other optional block.
|
package/dist/app/App.d.ts
CHANGED
|
@@ -112,6 +112,15 @@ export interface AppProps {
|
|
|
112
112
|
* affordance, and a notice on every launch trains users to ignore notices.
|
|
113
113
|
*/
|
|
114
114
|
sessionNotice?: string;
|
|
115
|
+
/**
|
|
116
|
+
* What the red team reconciliation produced when this session was resumed
|
|
117
|
+
* (red-team-security-mode 4.10 / I-12).
|
|
118
|
+
*
|
|
119
|
+
* PRESENT ONLY WHEN A RESUME ACTUALLY SAID SOMETHING: the mode came back armed (and the user
|
|
120
|
+
* has to know the posture they are in before the first message), or it did not because the
|
|
121
|
+
* waiver moved. Absent on an ordinary launch, which is what keeps its first frame identical.
|
|
122
|
+
*/
|
|
123
|
+
redTeamNotice?: string;
|
|
115
124
|
}
|
|
116
125
|
/**
|
|
117
126
|
* `App`'s and `cli.tsx`'s small two-way surface for the session, shaped exactly
|
|
@@ -153,7 +162,14 @@ export interface TerminalBridge {
|
|
|
153
162
|
setMouseCapture?: (on: boolean) => void;
|
|
154
163
|
/** Whether the mouse is captured right now — read at command time. */
|
|
155
164
|
isMouseCaptured?: () => boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Whether keyboard enhancement is on - `cli.tsx::enhancedKeysOn`, the SAME expression the
|
|
167
|
+
* `Ctrl+M` / `Shift+Enter` translation runs under. Only an explicit `false` makes the memory
|
|
168
|
+
* pages say that `Ctrl+M` is Enter in this terminal (agent-memory 9.1, RV2-2); absent means
|
|
169
|
+
* "not told", which is every test that builds no bridge.
|
|
170
|
+
*/
|
|
171
|
+
enhancedKeys?: boolean;
|
|
156
172
|
writeForeign?: (text: string) => void;
|
|
157
173
|
selection?: SelectionBridge;
|
|
158
174
|
}
|
|
159
|
-
export declare function App({ controller, version, initialOverlay, initialPrompt, confirmBridge, humanInputBridge, mouseSource, vtInputWarning, updateBridge, pasteBridge, terminal, scrollMode, scrollback, initialEntries, session, sessionBridge, sessionNotice, }: AppProps): React.ReactElement;
|
|
175
|
+
export declare function App({ controller, version, initialOverlay, initialPrompt, confirmBridge, humanInputBridge, mouseSource, vtInputWarning, updateBridge, pasteBridge, terminal, scrollMode, scrollback, initialEntries, session, sessionBridge, sessionNotice, redTeamNotice, }: AppProps): React.ReactElement;
|
package/dist/app/App.js
CHANGED
|
@@ -61,6 +61,10 @@ import { advanceBudget, decideFollowThrough, emptyBudget, } from '@aragon-agent/
|
|
|
61
61
|
// no policy. Imported beside the todo decision it shares one timer with.
|
|
62
62
|
import { buildDispatchNudge, decideForcedDispatch, FORCED_NUDGE_NOTICE } from '../team/dispatch-gate.js';
|
|
63
63
|
import { teamToastTtlMs, useTeamMode } from './use-team-mode.js';
|
|
64
|
+
// THE RED TEAM SWITCH (red-team-security-mode 4.3 / 4.8): Ctrl+R, the waiver flow, the
|
|
65
|
+
// deferred arming and the banner. Same adapter shape as `use-team-mode` above.
|
|
66
|
+
import { redTeamToastTtlMs, useRedTeamMode, } from './use-redteam-mode.js';
|
|
67
|
+
import { RedTeamDisclaimerOverlay } from '@aragon-agent/tui/ui/overlays/RedTeamDisclaimerOverlay';
|
|
64
68
|
import { teamStatusFromView } from '@aragon-agent/tui/model/team/team-mode';
|
|
65
69
|
import { FORCED_NUDGE_GRACE_MS } from '@aragon-agent/tui/model/team/limits';
|
|
66
70
|
import { useTerminalSize } from '@aragon-agent/tui/ui/layout/useTerminalSize';
|
|
@@ -71,7 +75,7 @@ import { useRenderGovernor } from '@aragon-agent/tui/ui/use-render-governor';
|
|
|
71
75
|
import { readScrollbarPerf, setPerfResetHook, setPerfSnapshotProvider, } from '../commands/perf.js';
|
|
72
76
|
import { buildFrameBudget, POPUP_CAPACITY_SHARE } from '@aragon-agent/tui/ui/layout/budget';
|
|
73
77
|
import { useWheelRouting } from '@aragon-agent/tui/ui/use-wheel-routing';
|
|
74
|
-
import { DEV_MODE_KEY_FRAME, INDEX_KEY_FRAME } from '@aragon-agent/tui/input/limits';
|
|
78
|
+
import { DEV_MODE_KEY_FRAME, INDEX_KEY_FRAME, MEMORY_KEY_FRAME, } from '@aragon-agent/tui/input/limits';
|
|
75
79
|
import { INDEX_SKILL_NAME, buildIndexConfirmSummary, hasProjectIndex, indexBuildInvocationArgs, } from '../commands/index-build.js';
|
|
76
80
|
import { installConsoleBridge } from '@aragon-agent/tui/ui/console-bridge';
|
|
77
81
|
import { publishExitSnapshot } from '@aragon-agent/tui/ui/exit-snapshot';
|
|
@@ -82,6 +86,13 @@ import { ModelPicker } from '@aragon-agent/tui/ui/overlays/ModelPicker';
|
|
|
82
86
|
import { KitPicker } from '@aragon-agent/tui/ui/overlays/KitPicker';
|
|
83
87
|
import { PromptLibraryOverlay } from '@aragon-agent/tui/ui/overlays/PromptLibraryOverlay';
|
|
84
88
|
import { PromptPicker } from '@aragon-agent/tui/ui/overlays/PromptPicker';
|
|
89
|
+
// Agent memory (agent-memory spec 9): the manager, its state machine (OWNED HERE, RV-11), the
|
|
90
|
+
// status chip and the shared types.
|
|
91
|
+
import { MemoryOverlay } from '@aragon-agent/tui/ui/overlays/MemoryOverlay';
|
|
92
|
+
import { INITIAL_MEMORY_STATE, memoryReducer } from '@aragon-agent/tui/ui/overlays/memory-state';
|
|
93
|
+
import { memoryChipFacts } from '@aragon-agent/tui/ui/layout/memory-chip';
|
|
94
|
+
import { memoryRepairCopy } from '@aragon-agent/tui/model/memory/copy';
|
|
95
|
+
import { takeMemoryRepairNotice } from '../memory/store.js';
|
|
85
96
|
import { draftToInput } from '@aragon-agent/tui/ui/overlays/prompt-library-state';
|
|
86
97
|
import { createPrompt, deletePrompt, flushPromptStats, loadPromptLibrary, movePrompt, recordPromptUse, setPromptFavorite, takePromptRepairNotice, updatePrompt, } from '../prompts/store.js';
|
|
87
98
|
import { resolvePromptRef } from '../prompts/resolve.js';
|
|
@@ -225,6 +236,16 @@ function firstUserText(entries) {
|
|
|
225
236
|
* shape of refusal as `tooSmall` - and the header keeps naming `Esc close`.
|
|
226
237
|
*/
|
|
227
238
|
const DECISION_OVERLAYS = new Set(['confirm', 'question', 'plan']);
|
|
239
|
+
/** The LAST finished assistant message's text, or `null` — the source for memory `l`. */
|
|
240
|
+
function lastAssistantText(entries) {
|
|
241
|
+
for (let index = entries.length - 1; index >= 0; index -= 1) {
|
|
242
|
+
const entry = entries[index];
|
|
243
|
+
if (entry && entry.kind === 'assistant' && !entry.streaming && entry.text.trim().length > 0) {
|
|
244
|
+
return entry.text;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
228
249
|
/** The LAST user message in a transcript, or `''` — the anchor `/task refresh` uses. */
|
|
229
250
|
function lastUserText(entries) {
|
|
230
251
|
for (let index = entries.length - 1; index >= 0; index -= 1) {
|
|
@@ -234,7 +255,7 @@ function lastUserText(entries) {
|
|
|
234
255
|
}
|
|
235
256
|
return '';
|
|
236
257
|
}
|
|
237
|
-
export function App({ controller, version, initialOverlay, initialPrompt, confirmBridge, humanInputBridge, mouseSource, vtInputWarning, updateBridge, pasteBridge, terminal, scrollMode = 'app', scrollback, initialEntries, session, sessionBridge, sessionNotice, }) {
|
|
258
|
+
export function App({ controller, version, initialOverlay, initialPrompt, confirmBridge, humanInputBridge, mouseSource, vtInputWarning, updateBridge, pasteBridge, terminal, scrollMode = 'app', scrollback, initialEntries, session, sessionBridge, sessionNotice, redTeamNotice, }) {
|
|
238
259
|
const native = scrollMode === 'native' && scrollback !== undefined;
|
|
239
260
|
/** Set when the native writer swallowed repeated tall frames; cleared by a resize. */
|
|
240
261
|
const [guardTripped, setGuardTripped] = useState(false);
|
|
@@ -258,6 +279,19 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
258
279
|
const [promptLibrary, setPromptLibrary] = useState(loadPromptLibrary);
|
|
259
280
|
const [promptIntent, setPromptIntent] = useState(null);
|
|
260
281
|
const promptIntentNonce = useRef(0);
|
|
282
|
+
// --- Agent memory (agent-memory spec 9.2) ----------------------------------------------
|
|
283
|
+
//
|
|
284
|
+
// THE MANAGER'S PAGE STACK AND EDITOR DRAFT LIVE HERE, NOT IN THE OVERLAY (RV-11). `overlay`
|
|
285
|
+
// is one field: when the agent asks for an approval the view reducer swaps the memory
|
|
286
|
+
// overlay for the decision overlay and (via `suspendedOverlay`) back again. State owned by
|
|
287
|
+
// the component would be unmounted with it, and a half-typed note would vanish.
|
|
288
|
+
const [memoryState, memoryDispatch] = useReducer(memoryReducer, INITIAL_MEMORY_STATE);
|
|
289
|
+
const [memoryIntent, setMemoryIntent] = useState(null);
|
|
290
|
+
const memoryIntentNonce = useRef(0);
|
|
291
|
+
/** The composer's draft text, kept current by `PromptInput`; read on ONE keypress. */
|
|
292
|
+
const draftTextRef = useRef('');
|
|
293
|
+
/** What the manager was opened with: the draft and the last reply, for `c` and `l`. */
|
|
294
|
+
const memoryContext = useRef({ draft: '', lastReply: null });
|
|
261
295
|
// The fill channel's payload (D-6). `null` until the first fill, so the composer's
|
|
262
296
|
// effect has nothing to do on every mount.
|
|
263
297
|
const [draftFill, setDraftFill] = useState(null);
|
|
@@ -618,6 +652,59 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
618
652
|
});
|
|
619
653
|
const teamKeysRef = useRef(teamKeys);
|
|
620
654
|
teamKeysRef.current = teamKeys;
|
|
655
|
+
// THE RED TEAM SWITCH (red-team-security-mode): Ctrl+R, the waiver flow and the deferred
|
|
656
|
+
// arming at `agent_end`. Same shape as `teamKeys` above, same reason: the controller owns the
|
|
657
|
+
// state, this hook is the adapter, and `App` only routes keys and props.
|
|
658
|
+
const redTeam = useRedTeamMode({
|
|
659
|
+
controller,
|
|
660
|
+
pushToast: (level, text) => dispatch({
|
|
661
|
+
type: 'pushToast', level, text, ttlMs: redTeamToastTtlMs(level),
|
|
662
|
+
}),
|
|
663
|
+
pushNotice: (level, text) => dispatch({ type: 'notice', level, text }),
|
|
664
|
+
openDisclaimer: () => dispatch({ type: 'setOverlay', overlay: 'redteam-disclaimer' }),
|
|
665
|
+
canAct: () => !stateRef.current.overlay,
|
|
666
|
+
});
|
|
667
|
+
const redTeamRef = useRef(redTeam);
|
|
668
|
+
redTeamRef.current = redTeam;
|
|
669
|
+
/**
|
|
670
|
+
* DECISIONS THAT ARRIVED WHILE THE WAIVER WAS OPEN (4.3 / D-21).
|
|
671
|
+
*
|
|
672
|
+
* `overlay` is a single field, so a `confirm` / `question` / `plan` request would REPLACE the
|
|
673
|
+
* waiver - and a disclaimer read halfway through is a blind signature. These are queued here
|
|
674
|
+
* and replayed once it settles. The queue is a ref because it must not re-render the
|
|
675
|
+
* transcript, and it is drained in `settleDisclaimer` below.
|
|
676
|
+
*/
|
|
677
|
+
const queuedDecisions = useRef([]);
|
|
678
|
+
const queueWhileWaiverOpen = useCallback((show) => {
|
|
679
|
+
if (stateRef.current.overlay !== 'redteam-disclaimer')
|
|
680
|
+
return false;
|
|
681
|
+
queuedDecisions.current.push(show);
|
|
682
|
+
return true;
|
|
683
|
+
}, []);
|
|
684
|
+
const drainQueuedDecisions = useCallback(() => {
|
|
685
|
+
const queued = queuedDecisions.current;
|
|
686
|
+
queuedDecisions.current = [];
|
|
687
|
+
for (const show of queued)
|
|
688
|
+
show();
|
|
689
|
+
}, []);
|
|
690
|
+
/**
|
|
691
|
+
* THE WAIVER SETTLED (4.3). `overlay` closes FIRST, then the record is written, then the
|
|
692
|
+
* queued decisions are replayed - in that order, so a `confirm` that arrived during the
|
|
693
|
+
* disclaimer can own the screen the moment it is free.
|
|
694
|
+
*
|
|
695
|
+
* Accepting re-issues the request that opened the overlay (`toggle` stays a toggle), which is
|
|
696
|
+
* the hook's job; this function only owns the ORDER of the App-side effects.
|
|
697
|
+
*/
|
|
698
|
+
const acceptRedTeamWaiver = useCallback(() => {
|
|
699
|
+
dispatch({ type: 'setOverlay', overlay: null });
|
|
700
|
+
redTeamRef.current.acceptDisclaimer();
|
|
701
|
+
drainQueuedDecisions();
|
|
702
|
+
}, [drainQueuedDecisions]);
|
|
703
|
+
const declineRedTeamWaiver = useCallback(() => {
|
|
704
|
+
dispatch({ type: 'setOverlay', overlay: null });
|
|
705
|
+
redTeamRef.current.declineDisclaimer();
|
|
706
|
+
drainQueuedDecisions();
|
|
707
|
+
}, [drainQueuedDecisions]);
|
|
621
708
|
/**
|
|
622
709
|
* Disarm an armed continuation. Idempotent; NEVER touches the budget — a
|
|
623
710
|
* cancelled continuation was never issued, so it must not be charged (AC-18).
|
|
@@ -861,6 +948,10 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
861
948
|
// read its basis (I-9). The posture lands next: a pending GOVERN entry that
|
|
862
949
|
// arrives with it is reported by the same toast channel, not silently swallowed.
|
|
863
950
|
teamKeysRef.current.onTurnEnd();
|
|
951
|
+
// The same for red team mode: an arming asked for during the turn lands NOW, and the
|
|
952
|
+
// banner is printed here so the user learns the posture before the next message
|
|
953
|
+
// (red-team-security-mode D-12 / 4.6).
|
|
954
|
+
redTeamRef.current.onTurnEnd();
|
|
864
955
|
// A deferred `plan -> build` (or any posture change that waited for a governed
|
|
865
956
|
// stage, governance-mode D-23) becomes real here and nowhere else (§3.2).
|
|
866
957
|
const applied = controller.applyPendingPosture();
|
|
@@ -1176,8 +1267,16 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
1176
1267
|
if (!confirmBridge)
|
|
1177
1268
|
return;
|
|
1178
1269
|
confirmBridge.handler = (req) => new Promise((resolve) => {
|
|
1179
|
-
|
|
1180
|
-
|
|
1270
|
+
const show = () => {
|
|
1271
|
+
setConfirmState({ summary: req.summary, resolve });
|
|
1272
|
+
dispatch({ type: 'setOverlay', overlay: 'confirm' });
|
|
1273
|
+
};
|
|
1274
|
+
// THE WAIVER IS NOT INTERRUPTED (D-21 / RV-10): a confirm arriving while the disclaimer
|
|
1275
|
+
// is open is QUEUED, not shown, and replayed once it settles. Reading half a liability
|
|
1276
|
+
// waiver and then signing it is the one failure this overlay cannot have.
|
|
1277
|
+
if (queueWhileWaiverOpen(show))
|
|
1278
|
+
return;
|
|
1279
|
+
show();
|
|
1181
1280
|
});
|
|
1182
1281
|
return () => {
|
|
1183
1282
|
// The skill ApprovalGate reads `handler !== null` LIVE on every call, so
|
|
@@ -1200,11 +1299,18 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
1200
1299
|
// Without this listener both ceilings are gone at once and the process
|
|
1201
1300
|
// wedges behind an overlay nobody is going to answer (P0-2).
|
|
1202
1301
|
signal?.addEventListener('abort', () => settleHuman(entry, null), { once: true });
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1302
|
+
const show = () => {
|
|
1303
|
+
setHumanRequest(req);
|
|
1304
|
+
dispatch({
|
|
1305
|
+
type: 'setOverlay',
|
|
1306
|
+
overlay: req.kind === 'plan' ? 'plan' : 'question',
|
|
1307
|
+
});
|
|
1308
|
+
};
|
|
1309
|
+
// QUEUED BEHIND THE WAIVER, exactly like the confirm bridge above (D-21). The request
|
|
1310
|
+
// itself is already registered, so its own abort listener still fires while it waits.
|
|
1311
|
+
if (queueWhileWaiverOpen(show))
|
|
1312
|
+
return;
|
|
1313
|
+
show();
|
|
1208
1314
|
});
|
|
1209
1315
|
bridge.cancelPending = cancelPendingHuman;
|
|
1210
1316
|
return () => {
|
|
@@ -1214,7 +1320,7 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
1214
1320
|
cancelPendingHuman();
|
|
1215
1321
|
bridge.handler = null;
|
|
1216
1322
|
};
|
|
1217
|
-
}, [humanInputBridge, settleHuman, cancelPendingHuman]);
|
|
1323
|
+
}, [humanInputBridge, settleHuman, cancelPendingHuman, queueWhileWaiverOpen]);
|
|
1218
1324
|
// --- Seed the mode mirror from its owner, once, on mount. --------------
|
|
1219
1325
|
// `--plan` / `planModeDefault` are resolved before the App exists, so the
|
|
1220
1326
|
// reducer's `'build'` seed would render one wrong frame without this.
|
|
@@ -1283,6 +1389,64 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
1283
1389
|
setPromptIntent({ nonce: promptIntentNonce.current, entry });
|
|
1284
1390
|
dispatch({ type: 'setOverlay', overlay: 'prompts' });
|
|
1285
1391
|
}, []);
|
|
1392
|
+
/**
|
|
1393
|
+
* Open the memory manager on a page (agent-memory spec 9.2). The nonce is bumped BEFORE the
|
|
1394
|
+
* overlay opens and the overlay consumes it at most once, so two `/memory add` in a row are
|
|
1395
|
+
* two intents rather than one that looks like a no-op.
|
|
1396
|
+
*/
|
|
1397
|
+
const openMemory = useCallback((entry) => {
|
|
1398
|
+
memoryIntentNonce.current += 1;
|
|
1399
|
+
memoryContext.current = {
|
|
1400
|
+
draft: draftTextRef.current,
|
|
1401
|
+
lastReply: lastAssistantText(stateRef.current.entries),
|
|
1402
|
+
};
|
|
1403
|
+
setMemoryIntent({ nonce: memoryIntentNonce.current, entry });
|
|
1404
|
+
dispatch({ type: 'setOverlay', overlay: 'memory' });
|
|
1405
|
+
}, []);
|
|
1406
|
+
const closeMemory = useCallback(() => {
|
|
1407
|
+
memoryDispatch({ type: 'reset' });
|
|
1408
|
+
dispatch({ type: 'setOverlay', overlay: null });
|
|
1409
|
+
}, []);
|
|
1410
|
+
// The overlay's whole view of the session: a port over the controller's service. Absent for a
|
|
1411
|
+
// host without memory (a test double, a headless run), in which case the overlay never opens.
|
|
1412
|
+
const memoryPort = useMemo(() => {
|
|
1413
|
+
const service = typeof controller.getMemoryService === 'function'
|
|
1414
|
+
? controller.getMemoryService() : undefined;
|
|
1415
|
+
if (!service)
|
|
1416
|
+
return null;
|
|
1417
|
+
return {
|
|
1418
|
+
getView: () => service.getView(),
|
|
1419
|
+
listRows: () => service.listRows(),
|
|
1420
|
+
getNote: (id) => service.getNote(id),
|
|
1421
|
+
save: (draft, options) => service.saveNote(draft, options),
|
|
1422
|
+
remove: (id, rev) => service.deleteNote(id, rev),
|
|
1423
|
+
toggleMount: (id) => service.toggleMount(id),
|
|
1424
|
+
resetMount: (id) => service.setOverride(id, 'reset'),
|
|
1425
|
+
setAutoload: (value) => service.setAutoload(value),
|
|
1426
|
+
subscribe: (listener) => service.subscribe(listener),
|
|
1427
|
+
};
|
|
1428
|
+
}, [controller]);
|
|
1429
|
+
// The status chip's data. The service emits only when the whole view CHANGED, so this does
|
|
1430
|
+
// not re-render the tree per keystroke.
|
|
1431
|
+
const [memoryView, setMemoryView] = useState(() => (typeof controller.getMemoryView === 'function' ? controller.getMemoryView() : null));
|
|
1432
|
+
useEffect(() => {
|
|
1433
|
+
if (typeof controller.subscribeMemory !== 'function')
|
|
1434
|
+
return undefined;
|
|
1435
|
+
return controller.subscribeMemory(() => {
|
|
1436
|
+
setMemoryView(controller.getMemoryView());
|
|
1437
|
+
// A scan that skipped files (bad name, not UTF-8, too large) is told ONCE.
|
|
1438
|
+
const repair = takeMemoryRepairNotice();
|
|
1439
|
+
if (repair !== null)
|
|
1440
|
+
notify('warn', memoryRepairCopy(repair.skipped));
|
|
1441
|
+
});
|
|
1442
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1443
|
+
}, [controller]);
|
|
1444
|
+
useEffect(() => {
|
|
1445
|
+
const repair = takeMemoryRepairNotice();
|
|
1446
|
+
if (repair !== null)
|
|
1447
|
+
notify('warn', memoryRepairCopy(repair.skipped));
|
|
1448
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1449
|
+
}, []);
|
|
1286
1450
|
/**
|
|
1287
1451
|
* Hand the composer a body to insert (D-6 / §4.6).
|
|
1288
1452
|
*
|
|
@@ -1374,6 +1538,14 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
1374
1538
|
notify('info', sessionNotice);
|
|
1375
1539
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1376
1540
|
}, []);
|
|
1541
|
+
// THE RESUMED POSTURE (red-team-security-mode 4.10 / I-12). Once, on mount, and only when a
|
|
1542
|
+
// resume had something to say: a session that comes back ARMED must tell the user what posture
|
|
1543
|
+
// they are in before their first message, and one that stayed off has to say why.
|
|
1544
|
+
useEffect(() => {
|
|
1545
|
+
if (redTeamNotice)
|
|
1546
|
+
notify('warn', redTeamNotice);
|
|
1547
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1548
|
+
}, []);
|
|
1377
1549
|
// --- Session bridge: identity write-back (D-15 / 3.12). -------------------
|
|
1378
1550
|
//
|
|
1379
1551
|
// INSTALLED AND CLEARED EXACTLY LIKE `confirmBridge.handler`: the rotation is
|
|
@@ -1813,6 +1985,17 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
1813
1985
|
openManager: (entry) => openPromptLibrary(entry),
|
|
1814
1986
|
resolve: (ref) => resolvePromptRef(loadPromptLibrary(), ref),
|
|
1815
1987
|
},
|
|
1988
|
+
// The memory manager's two capabilities (agent-memory spec 9.5). Present even when memory is
|
|
1989
|
+
// off: `/memory` has to be able to SAY that it is off.
|
|
1990
|
+
memory: {
|
|
1991
|
+
// No port means nothing would render under `overlay === 'memory'` and the keyboard would be
|
|
1992
|
+
// captured by a blank screen, so "no service" reads as "not enabled" here, like the key.
|
|
1993
|
+
isEnabled: () => controller.getConfig().memory?.enabled === true && memoryPort !== null,
|
|
1994
|
+
openManager: (entry) => {
|
|
1995
|
+
if (memoryPort)
|
|
1996
|
+
openMemory(entry);
|
|
1997
|
+
},
|
|
1998
|
+
},
|
|
1816
1999
|
setOverlay: (overlay) => dispatch({ type: 'setOverlay', overlay }),
|
|
1817
2000
|
// THE TASK LABEL PORT (`/keys`, `/task`; §6.4). Reads go through `stateRef` so a
|
|
1818
2001
|
// command always sees the LATEST label rather than the one from the render that
|
|
@@ -2479,6 +2662,25 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
2479
2662
|
requestIndexBuild();
|
|
2480
2663
|
return;
|
|
2481
2664
|
}
|
|
2665
|
+
// Ctrl+M arrives as MEMORY_KEY_FRAME, never as key.ctrl + 'm': the traditional encoding of
|
|
2666
|
+
// Ctrl+M IS Enter, so the stdin filter's translators are the only layer that can tell them
|
|
2667
|
+
// apart (agent-memory D-9 / input/limits.ts). Alt+M is the always-available twin, in BOTH
|
|
2668
|
+
// byte shapes: Ink's `meta` + 'm', and the raw `ESC m` that win32-input-mode produces.
|
|
2669
|
+
//
|
|
2670
|
+
// THE POSITION IS THE POINT (RV-10): beside Ctrl+I and BEFORE the `tooSmall` return below,
|
|
2671
|
+
// so "the key did nothing" stays distinguishable from "the key never arrived". The guards
|
|
2672
|
+
// are Ctrl+I's: an overlay owns the keyboard, a too-small frame has nowhere to go - and
|
|
2673
|
+
// `memory.enabled` is read at KEY TIME, so the switch needs no restart.
|
|
2674
|
+
if (input.includes(MEMORY_KEY_FRAME)
|
|
2675
|
+
|| (key.meta && !key.ctrl && input.toLowerCase() === 'm')
|
|
2676
|
+
|| input === '\x1bm') {
|
|
2677
|
+
if (tooSmall || stateRef.current.overlay)
|
|
2678
|
+
return;
|
|
2679
|
+
if (controller.getConfig().memory?.enabled !== true || !memoryPort)
|
|
2680
|
+
return;
|
|
2681
|
+
openMemory({ kind: 'list' });
|
|
2682
|
+
return;
|
|
2683
|
+
}
|
|
2482
2684
|
// Ctrl+L: branch this session into a NEW terminal (tui-branch-terminal-
|
|
2483
2685
|
// shortcut D-1 / D-2). Guarded exactly like Ctrl+G and Ctrl+I above it: an
|
|
2484
2686
|
// overlay owns the keyboard, and on a too-small terminal the feedback has
|
|
@@ -2517,7 +2719,9 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
2517
2719
|
// The prompt surfaces page themselves through `overlayScroll` too
|
|
2518
2720
|
// (quick-prompt-library appendix B-1). Without them a `PgDn` in the list does
|
|
2519
2721
|
// nothing and the wheel falls through to the transcript behind it.
|
|
2520
|
-
|| overlay === 'prompts' || overlay === 'prompt-pick'
|
|
2722
|
+
|| overlay === 'prompts' || overlay === 'prompt-pick'
|
|
2723
|
+
// The memory manager pages through `overlayScroll` too (agent-memory V-4).
|
|
2724
|
+
|| overlay === 'memory';
|
|
2521
2725
|
if (key.pageUp) {
|
|
2522
2726
|
if (controlled)
|
|
2523
2727
|
setOverlayScroll((n) => Math.max(0, n - overlayPage));
|
|
@@ -2566,18 +2770,23 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
2566
2770
|
// both keys so a draft's history and a popup's highlight never also move (I-6).
|
|
2567
2771
|
if (teamKeys.handleKey(input, key))
|
|
2568
2772
|
return;
|
|
2569
|
-
//
|
|
2773
|
+
// Ctrl+R IS THE RED TEAM SWITCH (red-team-security-mode D-1), and the repaint moved to
|
|
2774
|
+
// Alt+R for the reason Ctrl+T moved to Alt+T: legacy encodings deliver the same byte for
|
|
2775
|
+
// Ctrl+R and Ctrl+Shift+R, so a Shift binding would exist only behind keyboard enhancement.
|
|
2570
2776
|
//
|
|
2571
|
-
//
|
|
2572
|
-
//
|
|
2573
|
-
//
|
|
2574
|
-
//
|
|
2777
|
+
// THE REBINDING IS UNCONDITIONAL (RV-11 / I-9): it does not depend on `redteam.enabled`,
|
|
2778
|
+
// `--no-redteam` or `ARAGON_REDTEAM=0`. Whether Ctrl+R repaints must not depend on a config
|
|
2779
|
+
// key; in a session with the chain unregistered the hook simply answers `unavailable` with
|
|
2780
|
+
// one toast per press, and Alt+R below still repaints.
|
|
2575
2781
|
//
|
|
2576
|
-
//
|
|
2577
|
-
//
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2782
|
+
// The overlay guard is the pre-existing one: with an overlay open, this key belongs to
|
|
2783
|
+
// whoever owns the screen (the settings page's own Ctrl+R is "Test connection").
|
|
2784
|
+
if (redTeamRef.current.handleKey(input, key))
|
|
2785
|
+
return;
|
|
2786
|
+
// Alt+R = repaint. TWO BYTE FORMS, exactly like the Alt+T branch below: the `meta` flag Ink
|
|
2787
|
+
// sets after stripping the ESC, AND the raw `ESC r` that some stacks deliver whole. Handling
|
|
2788
|
+
// only the first would make the recovery key dead on exactly those stacks.
|
|
2789
|
+
if ((key.meta && !key.ctrl && input.toLowerCase() === 'r') || input === '\x1br') {
|
|
2581
2790
|
if (stateRef.current.overlay)
|
|
2582
2791
|
return;
|
|
2583
2792
|
setRedrawNonce((n) => n + 1);
|
|
@@ -2680,6 +2889,19 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
2680
2889
|
const overlay = stateRef.current.overlay;
|
|
2681
2890
|
if (overlay === 'settings')
|
|
2682
2891
|
return;
|
|
2892
|
+
// THE MEMORY MANAGER OWNS ITS Esc, like settings: the editor's first Esc only ARMS the
|
|
2893
|
+
// discard, and closing the overlay here as well would throw the half-typed note away on
|
|
2894
|
+
// that first press (AC-31). Only when it is actually mounted: with no port nothing renders
|
|
2895
|
+
// and nothing else could close it.
|
|
2896
|
+
if (overlay === 'memory' && memoryPort)
|
|
2897
|
+
return;
|
|
2898
|
+
// THE WAIVER'S `Esc` (4.3). App owns the key for the plan overlays and for this one, so
|
|
2899
|
+
// declining and draining the queue happen in ONE place - the overlay registers no Escape
|
|
2900
|
+
// handler of its own, and a second one would decline twice.
|
|
2901
|
+
if (overlay === 'redteam-disclaimer') {
|
|
2902
|
+
declineRedTeamWaiver();
|
|
2903
|
+
return;
|
|
2904
|
+
}
|
|
2683
2905
|
if (overlay) {
|
|
2684
2906
|
cancelConfirmation();
|
|
2685
2907
|
if (overlay === 'confirm' && confirmRef.current) {
|
|
@@ -2795,6 +3017,7 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
2795
3017
|
otherNames: (cfg.modelProfiles?.kits ?? [])
|
|
2796
3018
|
.filter((kit) => kit.id !== activeKit.id).map((kit) => kit.name),
|
|
2797
3019
|
};
|
|
3020
|
+
const memoryChip = memoryChipFacts(memoryView) ?? undefined;
|
|
2798
3021
|
const empty = state.entries.length === 0;
|
|
2799
3022
|
// RENDER SCOPE, so the chip and the composer hint agree with what the Ctrl+C
|
|
2800
3023
|
// handler will do on the very next keystroke.
|
|
@@ -3010,7 +3233,9 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3010
3233
|
} })) : overlay === 'queue' ? (_jsx(QueueOverlay, { pending: state.pendingSteering, cols: viewCols, maxRows: overlayMaxRows, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps })) : overlay === 'help' ? (_jsx(OverlayFrame, { title: "Help", hint: `Esc close ${glyphs.midDot} PgUp/PgDn scroll`, maxRows: overlayMaxRows, cols: viewCols, rows: helpRows(theme, caps, native), scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps })) : overlay === 'model' ? (_jsx(ModelPicker, { isActive: !tooSmall, registry: controller.getModelRegistry(), currentProvider: cfg.provider, currentModel: cfg.model, maxRows: overlayMaxRows, cols: viewCols, theme: theme, caps: caps, onSelect: handleModelSelect })) : overlay === 'kit' ? (_jsx(KitPicker, { isActive: !tooSmall, library: cfg.modelProfiles, config: cfg, ...(kitDiskConfig ? { diskConfig: kitDiskConfig } : {}), active: activeKit,
|
|
3011
3234
|
// ONLY THE APPLY IS BLOCKED while work is in flight (§4.7): a list a
|
|
3012
3235
|
// user cannot even OPEN reads as a broken key.
|
|
3013
|
-
busy: controller.isModelSettingsBusy(), maxRows: overlayMaxRows, cols: viewCols, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, onChoose: handleKitChoose, onClose: () => dispatch({ type: 'setOverlay', overlay: null }) })) : overlay === 'prompts' ? (_jsx(PromptLibraryOverlay, { isActive: !tooSmall, library: promptLibrary, ...(promptIntent ? { intent: promptIntent } : {}), cols: viewCols, maxRows: overlayMaxRows, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, onMutate: handlePromptMutate, onNotice: notify, onClose: () => dispatch({ type: 'setOverlay', overlay: null }) })) : overlay === 'prompt-pick' ? (_jsx(PromptPicker, { isActive: !tooSmall, library: promptLibrary, cols: viewCols, maxRows: overlayMaxRows, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, onFill: handlePromptFill, onManage: (entry) => openPromptLibrary(entry), onClose: closePromptPicker })) : overlay === '
|
|
3236
|
+
busy: controller.isModelSettingsBusy(), maxRows: overlayMaxRows, cols: viewCols, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, onChoose: handleKitChoose, onClose: () => dispatch({ type: 'setOverlay', overlay: null }) })) : overlay === 'prompts' ? (_jsx(PromptLibraryOverlay, { isActive: !tooSmall, library: promptLibrary, ...(promptIntent ? { intent: promptIntent } : {}), cols: viewCols, maxRows: overlayMaxRows, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, onMutate: handlePromptMutate, onNotice: notify, onClose: () => dispatch({ type: 'setOverlay', overlay: null }) })) : overlay === 'prompt-pick' ? (_jsx(PromptPicker, { isActive: !tooSmall, library: promptLibrary, cols: viewCols, maxRows: overlayMaxRows, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, onFill: handlePromptFill, onManage: (entry) => openPromptLibrary(entry), onClose: closePromptPicker })) : overlay === 'memory' && memoryPort ? (_jsx(MemoryOverlay, { isActive: !tooSmall, state: memoryState, dispatch: memoryDispatch, port: memoryPort, ...(memoryIntent ? { intent: memoryIntent } : {}), context: memoryContext.current, cols: viewCols, maxRows: overlayMaxRows, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, reducedMotion: cfg.reducedMotion ?? false, ...(terminal?.enhancedKeys === undefined ? {} : { enhancedKeys: terminal.enhancedKeys }),
|
|
3237
|
+
// Outcomes are toasts (they expire); the editor's own error row is what stays on screen.
|
|
3238
|
+
onNotice: (level, text) => toast(level === 'info' ? 'success' : level, text), onClose: closeMemory })) : overlay === 'settings' ? (_jsx(SettingsScreen, { isActive: !tooSmall, initial: {
|
|
3014
3239
|
provider: cfg.provider,
|
|
3015
3240
|
model: cfg.model,
|
|
3016
3241
|
baseUrl: cfg.baseUrl ?? '',
|
|
@@ -3054,7 +3279,7 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3054
3279
|
// mounted with `{...props}` and an undeclared prop arrives as
|
|
3055
3280
|
// `undefined`. A construction-time snapshot, so reading it per frame is
|
|
3056
3281
|
// honest (I-7).
|
|
3057
|
-
teamRegistered: controller.isTeamRegistered(), governanceRegistered: controller.isGovernanceRegistered(), probe: probe, onProfileSave: handleProfileSave, onReload: () => controller.createModelSettingsDraft(), onClose: () => dispatch({ type: 'setOverlay', overlay: null }),
|
|
3282
|
+
teamRegistered: controller.isTeamRegistered(), governanceRegistered: controller.isGovernanceRegistered(), memoryRegistered: typeof controller.getMemoryService === 'function' && controller.getMemoryService() !== undefined, ...(terminal?.enhancedKeys === undefined ? {} : { enhancedKeys: terminal.enhancedKeys }), probe: probe, onProfileSave: handleProfileSave, onReload: () => controller.createModelSettingsDraft(), onClose: () => dispatch({ type: 'setOverlay', overlay: null }),
|
|
3058
3283
|
// Read from `cfg` (render scope, re-read every frame), so `/retry off`
|
|
3059
3284
|
// while the screen is open shows the new value on the next paint.
|
|
3060
3285
|
retrySummary: cfg.retry.enabled && cfg.retry.maxRetries > 0 ? String(cfg.retry.maxRetries) : 'off' })) : overlay === 'agents' ? (
|
|
@@ -3063,7 +3288,11 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3063
3288
|
// already disabled the transcript underneath.
|
|
3064
3289
|
_jsx(AgentsBoardOverlay, { voice: voice, team: state.team, entries: state.entries, cols: viewCols, maxRows: overlayMaxRows, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, isActive: !tooSmall, native: native, theme: theme, caps: caps })) : overlay === 'governance' ? (
|
|
3065
3290
|
// THE BRANCH AND THE `Overlay` MEMBER SHIP TOGETHER (R-11), like `agents` above.
|
|
3066
|
-
_jsx(GovernanceBoardOverlay, { voice: voice, data: governanceBoardData(controller, state.governance), cols: viewCols, maxRows: overlayMaxRows, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, isActive: !tooSmall, theme: theme, caps: caps, onCopyPath: (path) => { void copyCoordinator.requestCopy({ text: path, lines: 1 }); }, onNotice: toast })) : overlay === '
|
|
3291
|
+
_jsx(GovernanceBoardOverlay, { voice: voice, data: governanceBoardData(controller, state.governance), cols: viewCols, maxRows: overlayMaxRows, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, isActive: !tooSmall, theme: theme, caps: caps, onCopyPath: (path) => { void copyCoordinator.requestCopy({ text: path, lines: 1 }); }, onNotice: toast })) : overlay === 'redteam-disclaimer' ? (
|
|
3292
|
+
// THE WAIVER (red-team-security-mode 4.3). Rendered from the reducer's overlay field like
|
|
3293
|
+
// every other surface, so it cannot be open at the same time as a decision dialog - the
|
|
3294
|
+
// requests that would have replaced it are queued in `queuedDecisions` instead (D-21).
|
|
3295
|
+
_jsx(RedTeamDisclaimerOverlay, { isActive: !tooSmall, cols: viewCols, maxRows: overlayMaxRows, theme: theme, caps: caps, onAccept: acceptRedTeamWaiver, onDecline: declineRedTeamWaiver })) : overlay === 'confirm' && confirmState ? (_jsx(ConfirmDialog, { isActive: !tooSmall, state: confirmState, maxRows: overlayMaxRows, cols: viewCols, theme: theme, caps: caps, onClose: closeConfirm })) : overlay === 'question' && humanRequest?.kind === 'questions' ? (_jsx(QuestionOverlay, { isActive: !tooSmall, questions: humanRequest.questions, maxRows: overlayMaxRows, cols: viewCols, theme: theme, caps: caps, onSubmit: (answers) => resolveHuman({ kind: 'answers', answers, cancelled: false }), ...interviewProps })) : overlay === 'plan' && humanRequest?.kind === 'plan' ? (_jsx(PlanReviewOverlay, { isActive: !tooSmall, plan: humanRequest.plan, maxRows: overlayMaxRows, cols: viewCols, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, onVerdict: handlePlanVerdict })) : null;
|
|
3067
3296
|
const density = cfg.density;
|
|
3068
3297
|
const transcriptWindow = cfg.transcriptWindow ?? DEFAULT_TRANSCRIPT_WINDOW;
|
|
3069
3298
|
// The fixed status bar remains visible underneath every overlay and toast.
|
|
@@ -3190,6 +3419,12 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3190
3419
|
// needs the second status row was decided once, above, by `acceptanceChip`.
|
|
3191
3420
|
...(acceptanceActive ? { acceptanceActive } : {}),
|
|
3192
3421
|
fastActive: state.fast?.live ? { inFlight: state.fast.inFlight } : undefined,
|
|
3422
|
+
// THE DETAILS-ROW LINE (4.7 c): `Red team armed; confirmations off` or
|
|
3423
|
+
// `Red team paused (...)`. Read from the same view the chip reads, so the two surfaces
|
|
3424
|
+
// cannot describe one posture differently (I-10).
|
|
3425
|
+
...(redTeam.view.available && redTeam.view.armed
|
|
3426
|
+
? { redteam: { armed: redTeam.view.armed, paused: redTeam.view.paused } }
|
|
3427
|
+
: {}),
|
|
3193
3428
|
...feedbackProjection,
|
|
3194
3429
|
};
|
|
3195
3430
|
const details = planStatusDetail({ status: statusInput, model: cfg.model, provider: cfg.provider,
|
|
@@ -3201,7 +3436,10 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3201
3436
|
...(state.governance?.pauseRequested === true ? { govPausePending: true } : {}),
|
|
3202
3437
|
interruptPhase: interruptGesture.current.phase,
|
|
3203
3438
|
updateAvailable: !!updateSnapshot && shouldRenderUpdateLine(updateSnapshot) } });
|
|
3204
|
-
const composer = (_jsx(Composer, { deleteDisambiguated: terminal?.deleteDisambiguated ?? false, onCompletionContextChange: setCompletion, cols: frameBudget.composerCols, terminalRows: rows, statusExpanded: statusExpanded, onInteraction: returnToComposer, reducedMotion: cfg.reducedMotion ?? false, onEscape: handleComposerEscape, onEscapeDismiss: cancelConfirmation, isActive: overlay === null && !tooSmall, running: state.status === 'running', history: promptHistory, commands: commandOptions, cwd: controller.getCwd(), showHint: false, submitCount: cfg.submitCount, hintsEnabled: cfg.hints, agentMode: state.agentMode, posture: state.posture,
|
|
3439
|
+
const composer = (_jsx(Composer, { deleteDisambiguated: terminal?.deleteDisambiguated ?? false, onCompletionContextChange: setCompletion, cols: frameBudget.composerCols, terminalRows: rows, statusExpanded: statusExpanded, onInteraction: returnToComposer, reducedMotion: cfg.reducedMotion ?? false, onEscape: handleComposerEscape, onEscapeDismiss: cancelConfirmation, isActive: overlay === null && !tooSmall, running: state.status === 'running', history: promptHistory, commands: commandOptions, cwd: controller.getCwd(), showHint: false, submitCount: cfg.submitCount, hintsEnabled: cfg.hints, agentMode: state.agentMode, posture: state.posture,
|
|
3440
|
+
// ARMED AND IN EFFECT, never `armed` alone: a paused session keeps its plan / govern
|
|
3441
|
+
// colour, because `paused` has one definition and this prop does not re-derive it (4.7 b).
|
|
3442
|
+
redTeamActive: redTeam.view.effective === 'armed', services: liveServices, modeToggleKey: modeToggleKey, popupMaxRows: popupMaxRows, popupMaxHeight: frameBudget.popupMaxHeight, onPopupRowsChange: onPopupRowsChange, onDraftRows: onDraftRows, onDraftPresence: onDraftPresence, draftClearNonce: draftClearNonce, draftTextRef: draftTextRef, ...(draftFill ? { draftFill } : {}), insertMode: cfg.prompts?.insertMode ?? 'insert', onNotice: notify, theme: theme, caps: caps, onSubmit: handleSubmit, onHelp: () => dispatch({ type: 'setOverlay', overlay: 'help' }) }));
|
|
3205
3443
|
const team = governanceLayout ? (_jsx(GovernancePanel, { layout: governanceLayout, theme: theme, caps: caps })) : state.team ? (_jsx(TeamPanel, { snapshot: state.team, layout: teamLayout, rows: rows, cols: contentCols, reducedMotion: viewReducedMotion, voice: teamVoice, theme: theme, caps: caps })) : null;
|
|
3206
3444
|
// --- Native panel band (release-gate-and-native-panels §6.3/§6.4) -------------
|
|
3207
3445
|
//
|
|
@@ -3227,7 +3465,9 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3227
3465
|
const rail = fullscreenRailVisible && state.todos ? (_jsx(TodoPanel, { snapshot: state.todos, width: railWidth, rows: railRows, running: running, reducedMotion: viewReducedMotion, theme: theme, caps: caps })) : null;
|
|
3228
3466
|
const viewport = (_jsxs(ScrollViewport, { active: overlay === null && !tooSmall, overlay: overlayNode, footer: _jsxs(_Fragment, { children: [team, _jsx(QueuePanel, { layout: queueLayout, theme: theme })] }), rail: rail, scrollbar: terminal?.scrollbar, resetKey: scrollResetKey, intent: scrollIntent, pinToBottomNonce: pinToBottomNonce, onScrolledLinesChange: setScrolledLines, onViewportShiftChange: onViewportShiftChange, onGeometryChange: onGeometryChange, geometryKey: `${rows}:${cols}:${viewportBudget}:${frameBudget.composerSlotRows}:${frameBudget.statusRows}:${contentCols}:${overlay}:${tooSmall}`, tailRowsRef: tailSink, hold: selectionHold, resumeMs: cfg.scrollResumeMs, showScrollIndicator: true, cols: contentCols, theme: theme, caps: caps, children: [opener, _jsx(TranscriptList, { entries: transcriptEntries, expandedToolIds: state.expandedToolIds, thinkingVisible: state.thinkingVisible, reducedMotion: viewReducedMotion, voice: voice, density: density, nowSec: nowSec, theme: theme, caps: caps, windowSize: transcriptWindow, cols: contentCols, heights: heights, mountedSink: mountedCount, tailSink: tailSink })] }));
|
|
3229
3467
|
const detailsNode = _jsx(BottomStatusRow, { plan: details, columns: viewCols, theme: theme });
|
|
3230
|
-
const statusNode = (_jsx(StatusBar, { columns: viewCols, speedKnown: speedKnown, ...feedbackProjection, interruptPhase: interruptGesture.current.phase, pendingSteering: state.pendingSteering, runPhase: state.runPhase, activeTool: state.activeTool, ...(wait ? { wait } : {}), runOutcome: state.runOutcome, reducedMotion: reducedMotion, ...(sessionId ? { sessionId } : {}), developerMode: state.developerMode, ...(kitChip ? { kit: kitChip } : {}),
|
|
3468
|
+
const statusNode = (_jsx(StatusBar, { columns: viewCols, speedKnown: speedKnown, ...feedbackProjection, interruptPhase: interruptGesture.current.phase, pendingSteering: state.pendingSteering, runPhase: state.runPhase, activeTool: state.activeTool, ...(wait ? { wait } : {}), runOutcome: state.runOutcome, reducedMotion: reducedMotion, ...(sessionId ? { sessionId } : {}), developerMode: state.developerMode, ...(kitChip ? { kit: kitChip } : {}), ...(memoryChip ? { memory: memoryChip } : {}), ...(redTeam.view.available && redTeam.view.armed
|
|
3469
|
+
? { redteam: { armed: redTeam.view.armed, paused: redTeam.view.paused } }
|
|
3470
|
+
: {}), waitingForConfirmation: !!humanRequest || !!confirmState, stopping: interruptGesture.current.phase === 'stopping', interruptHint: interruptGesture.current.phase === 'stopping'
|
|
3231
3471
|
? 'Esc force-stop' : 'Esc x2 interrupt', model: cfg.model, provider: cfg.provider, usageTotal: state.usageTotal,
|
|
3232
3472
|
// ONE OBJECT INSTEAD OF FOUR PARALLEL PROPS (§4.3). The four were a
|
|
3233
3473
|
// projection of "many sources of truth" into the props layer, and a
|