@aragon-agent/cli 0.6.57 → 0.6.58
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 +71 -0
- package/README.md +159 -3
- package/dist/agent/controller.d.ts +112 -1
- package/dist/agent/controller.js +350 -7
- package/dist/agent/project-guidance-prompt.js +97 -97
- package/dist/agent/redteam-prompt.d.ts +29 -11
- package/dist/agent/redteam-prompt.js +118 -103
- package/dist/agent/redteam-wiring.d.ts +117 -2
- package/dist/agent/redteam-wiring.js +204 -1
- package/dist/agent/team-notices.d.ts +68 -0
- package/dist/agent/team-notices.js +82 -0
- package/dist/app/App.js +208 -5
- package/dist/app/use-redteam-mode.d.ts +1 -1
- package/dist/app/use-redteam-mode.js +14 -1
- package/dist/cli.js +13 -0
- package/dist/commands/catalog.js +6 -2
- package/dist/commands/redteam-command.d.ts +14 -8
- package/dist/commands/redteam-command.js +243 -12
- package/dist/commands/team-command.js +93 -2
- package/dist/config/app-paths.d.ts +19 -0
- package/dist/config/app-paths.js +23 -0
- package/dist/config/load.d.ts +8 -0
- package/dist/gene/catalog-sync.js +37 -16
- package/dist/gene/curator/budget.js +1 -1
- package/dist/gene/curator/curator.d.ts +6 -0
- package/dist/gene/curator/curator.js +8 -0
- package/dist/gene/curator/task-runner.js +4 -1
- package/dist/gene/curator/tools-verify.js +17 -5
- package/dist/gene/curator/validate/evidence-tokens.js +97 -18
- package/dist/gene/curator/validate/knowledge.d.ts +5 -0
- package/dist/gene/curator/validate/knowledge.js +57 -13
- package/dist/gene/curator/validate/types.d.ts +6 -1
- package/dist/gene/learn/learn-prompt.d.ts +10 -1
- package/dist/gene/learn/learn-prompt.js +11 -2
- package/dist/governance/engine/lifecycle.js +1 -1
- package/dist/governance/store/run-lock.d.ts +9 -2
- package/dist/governance/store/run-lock.js +91 -7
- package/dist/host/controller-factory.d.ts +13 -0
- package/dist/host/controller-factory.js +7 -0
- package/dist/host/index.d.ts +1 -0
- package/dist/host/index.js +1 -0
- package/dist/host/interaction.d.ts +19 -0
- package/dist/host/interaction.js +75 -0
- package/dist/host/team-control.d.ts +83 -0
- package/dist/host/team-control.js +55 -0
- package/dist/logging/install.d.ts +32 -1
- package/dist/logging/install.js +21 -0
- package/dist/proc/output-streams.d.ts +11 -0
- package/dist/proc/output-streams.js +11 -0
- package/dist/redteam/prompt-resolve.d.ts +61 -0
- package/dist/redteam/prompt-resolve.js +303 -0
- package/dist/redteam/prompt-store.d.ts +96 -0
- package/dist/redteam/prompt-store.js +156 -0
- package/dist/redteam/prompt-template.d.ts +22 -0
- package/dist/redteam/prompt-template.js +72 -0
- package/dist/team/bus.d.ts +18 -0
- package/dist/team/bus.js +70 -18
- package/dist/team/console-tools.d.ts +54 -0
- package/dist/team/console-tools.js +333 -0
- package/dist/team/console-view.d.ts +88 -0
- package/dist/team/console-view.js +173 -0
- package/dist/team/forced-mode.d.ts +61 -1
- package/dist/team/forced-mode.js +75 -0
- package/dist/team/normalize.d.ts +31 -0
- package/dist/team/normalize.js +49 -5
- package/dist/team/notices.d.ts +95 -0
- package/dist/team/notices.js +121 -0
- package/dist/team/pause-gate.d.ts +79 -0
- package/dist/team/pause-gate.js +127 -0
- package/dist/team/prompt.d.ts +25 -9
- package/dist/team/prompt.js +29 -29
- package/dist/team/report.js +33 -0
- package/dist/team/runtime.d.ts +270 -5
- package/dist/team/runtime.js +732 -64
- package/dist/team/settled.d.ts +5 -2
- package/dist/team/settled.js +12 -2
- package/dist/team/subagent.d.ts +7 -0
- package/dist/team/subagent.js +12 -1
- package/dist/team/task-tool.d.ts +39 -1
- package/dist/team/task-tool.js +75 -18
- package/dist/tools/bash-tool.d.ts +11 -8
- package/dist/tools/bash-tool.js +37 -9
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js +30 -0
- package/package.json +3 -3
package/dist/app/App.js
CHANGED
|
@@ -9,6 +9,7 @@ import { selectTranscriptEntries, mergePendingEntries } from '@aragon-agent/tui/
|
|
|
9
9
|
*/
|
|
10
10
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState } from 'react';
|
|
11
11
|
import process from 'node:process';
|
|
12
|
+
import { basename } from 'node:path';
|
|
12
13
|
import { Text, useApp, useInput, useStdout } from 'ink';
|
|
13
14
|
import { advanceInterruptGesture, INTERRUPT_CONFIRM_MS, cancelInterruptConfirmation, } from '@aragon-agent/tui/input/interrupt-gesture';
|
|
14
15
|
import { initialViewState, viewReducer, } from '@aragon-agent/tui/model/agent/reducer';
|
|
@@ -26,7 +27,8 @@ import { useStartupNotices, MOUSE_NOTICE_VERSION, PROMPT_KEY_NOTICE_VERSION, SCR
|
|
|
26
27
|
import { getTheme } from '@aragon-agent/tui/ui/theme';
|
|
27
28
|
import { pickGlyphs } from '@aragon-agent/tui/ui/glyphs';
|
|
28
29
|
import { Header } from '@aragon-agent/tui/ui/Header';
|
|
29
|
-
import {
|
|
30
|
+
import { applyTerminalTitle, formatTerminalTitle, resetTerminalTitle, } from '@aragon-agent/tui/ui/terminal-title';
|
|
31
|
+
import { BRAND_WORD, pickHeaderVariant, pickOpenerVariant } from '@aragon-agent/tui/ui/Logo';
|
|
30
32
|
import { SessionOpener } from '@aragon-agent/tui/ui/SessionOpener';
|
|
31
33
|
import { TranscriptList } from '@aragon-agent/tui/ui/Transcript';
|
|
32
34
|
import { Composer } from '@aragon-agent/tui/ui/Composer';
|
|
@@ -68,6 +70,8 @@ import { redTeamToastTtlMs, useRedTeamMode, } from './use-redteam-mode.js';
|
|
|
68
70
|
import { RedTeamDisclaimerOverlay } from '@aragon-agent/tui/ui/overlays/RedTeamDisclaimerOverlay';
|
|
69
71
|
import { teamStatusFromView } from '@aragon-agent/tui/model/team/team-mode';
|
|
70
72
|
import { FORCED_NUDGE_GRACE_MS } from '@aragon-agent/tui/model/team/limits';
|
|
73
|
+
import { planSettleContinuation } from '@aragon-agent/tui/model/team/settle-plan';
|
|
74
|
+
import { formatDuration } from '@aragon-agent/tui/model/agent/usage';
|
|
71
75
|
import { useTerminalSize } from '@aragon-agent/tui/ui/layout/useTerminalSize';
|
|
72
76
|
import { useHeightStore } from '@aragon-agent/tui/ui/use-height-store';
|
|
73
77
|
import { createPersonaBook } from '@aragon-agent/tui/ui/persona-names';
|
|
@@ -734,6 +738,72 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
734
738
|
followTimer.current = null;
|
|
735
739
|
}
|
|
736
740
|
}, []);
|
|
741
|
+
/**
|
|
742
|
+
* Decide what, if anything, the settle of a dispatch earns (5.3.3).
|
|
743
|
+
*
|
|
744
|
+
* A PURE DECISION IN A PURE FILE (`planSettleContinuation`, in the tui package)
|
|
745
|
+
* with an impure caller here: each host owns its timer, the truth table is
|
|
746
|
+
* shared. That split is R9's mitigation - the desktop coordinator runs the same
|
|
747
|
+
* function against its own timer.
|
|
748
|
+
*
|
|
749
|
+
* DEFINED AFTER `cancelFollowThrough`, not before it: the callback closes over
|
|
750
|
+
* it, and a `useCallback` whose deps array reads a `const` that is still in its
|
|
751
|
+
* temporal dead zone throws during the very first render - which presents as a
|
|
752
|
+
* blank tree, not as an error in the console.
|
|
753
|
+
*
|
|
754
|
+
* `followThroughArmed` is PASSED IN rather than read here: the caller is the only
|
|
755
|
+
* place that knows what the todo decision and the forced-dispatch gate did in
|
|
756
|
+
* this very turn (I-9).
|
|
757
|
+
*/
|
|
758
|
+
const armTeamSettle = useCallback((armed) => {
|
|
759
|
+
// ABSENT MEANS "NO TEAM IN THIS HOST": a controller double without the team
|
|
760
|
+
// surface simply never earns a continuation.
|
|
761
|
+
const facts = controller.teamSettleFacts?.() ?? null;
|
|
762
|
+
if (facts === null)
|
|
763
|
+
return;
|
|
764
|
+
// Same defence as the gate: a double without the team surface never reaches
|
|
765
|
+
// this line, and one that has `teamSettleFacts` but no config still gets the
|
|
766
|
+
// documented defaults rather than a crash inside an event handler.
|
|
767
|
+
const teamConfig = controller.getTeamConfig?.() ?? {
|
|
768
|
+
autoResume: 'auto',
|
|
769
|
+
settleGraceMs: 3_000,
|
|
770
|
+
detachDispatch: true,
|
|
771
|
+
};
|
|
772
|
+
const decision = planSettleContinuation({
|
|
773
|
+
mode: teamConfig.autoResume,
|
|
774
|
+
settled: facts.settled,
|
|
775
|
+
settledInsideTurn: facts.settledInsideTurn,
|
|
776
|
+
runEnd: { aborted: facts.aborted, errored: facts.errored },
|
|
777
|
+
continuedThisDispatch: facts.continuedThisDispatch,
|
|
778
|
+
userPending: controller.hasPendingUserMessages(),
|
|
779
|
+
followThroughArmed: armed.followThroughArmed,
|
|
780
|
+
graceMs: teamConfig.settleGraceMs,
|
|
781
|
+
outcome: facts.outcome,
|
|
782
|
+
});
|
|
783
|
+
if (decision.kind === 'notice') {
|
|
784
|
+
dispatch({ type: 'notice', level: decision.level, text: decision.text });
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
if (decision.kind !== 'continue')
|
|
788
|
+
return;
|
|
789
|
+
dispatch({ type: 'notice', level: decision.level, text: decision.notice });
|
|
790
|
+
cancelFollowThrough(); // I-9: at most one armed continuation, ever
|
|
791
|
+
followTimer.current = setTimeout(() => {
|
|
792
|
+
followTimer.current = null;
|
|
793
|
+
// The grace window is open to the user, so both facts are re-read at fire
|
|
794
|
+
// time: they may have started a turn, or typed the very message the notice
|
|
795
|
+
// was about.
|
|
796
|
+
if (controller.isRunning() || controller.isCompactionBusy?.())
|
|
797
|
+
return;
|
|
798
|
+
if (controller.hasPendingUserMessages())
|
|
799
|
+
return;
|
|
800
|
+
// THE ID COMES FROM THE FACTS, never from `live()`: the dispatch has
|
|
801
|
+
// already settled by the time this runs, so `live()` is null and the
|
|
802
|
+
// continuation would never be charged (see `teamSettleFacts`).
|
|
803
|
+
controller.markTeamContinued(facts.dispatchId);
|
|
804
|
+
submitRef.current(decision.message, { userInitiated: false, todoPolicy: 'continue' });
|
|
805
|
+
}, decision.graceMs);
|
|
806
|
+
}, [controller, dispatch, cancelFollowThrough]);
|
|
737
807
|
/**
|
|
738
808
|
* `submitMessage` as of the LATEST render, for the grace timer.
|
|
739
809
|
*
|
|
@@ -876,7 +946,13 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
876
946
|
const gate = decideForcedDispatch({
|
|
877
947
|
armed: forced !== null,
|
|
878
948
|
count: forced?.count ?? 0,
|
|
879
|
-
|
|
949
|
+
// A LIVE DISPATCH COUNTS AS AN ATTEMPT (REV-10 / AC-23). The gate counts
|
|
950
|
+
// only THIS turn's `task` calls, so a turn where the user asked "how is
|
|
951
|
+
// it going?" would look like "tools used, nothing dispatched" and nudge for
|
|
952
|
+
// a dispatch that `BUSY_REFUSAL` would then refuse - one wasted turn per
|
|
953
|
+
// question. `isTeamBusy()` makes the pure predicate honest without adding
|
|
954
|
+
// a field to it.
|
|
955
|
+
dispatchAttempted: dispatchAttemptedRef.current || controller.isTeamBusy?.() === true,
|
|
880
956
|
toolsUsed: toolsUsedRef.current,
|
|
881
957
|
nudgesUsed: nudgesRef.current,
|
|
882
958
|
runEnd: { ...endReasonRef.current },
|
|
@@ -960,6 +1036,20 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
960
1036
|
});
|
|
961
1037
|
}, FORCED_NUDGE_GRACE_MS);
|
|
962
1038
|
}
|
|
1039
|
+
// --- The team's settle continuation (team-detached-dispatch 5.3.3) -----
|
|
1040
|
+
//
|
|
1041
|
+
// THE THIRD ARMER OF ONE TIMER, and the placement is the whole point: the
|
|
1042
|
+
// forced-nudge branch above called `cancelFollowThrough()`, so a team
|
|
1043
|
+
// decision written beside it would be silently cleared one line later. Here
|
|
1044
|
+
// - after the nudge, before `onTurnEnd()` - nothing downstream cancels it.
|
|
1045
|
+
//
|
|
1046
|
+
// A dispatch that settled INSIDE this turn needs no new turn (its report
|
|
1047
|
+
// already arrived as a steering message), and one that settled while the
|
|
1048
|
+
// user was typing does not need one either (their turn carries it). Both
|
|
1049
|
+
// are `planSettleContinuation`'s rules, not this block's.
|
|
1050
|
+
armTeamSettle({
|
|
1051
|
+
followThroughArmed: followTimer.current !== null || decision.kind === 'continue' || gated,
|
|
1052
|
+
});
|
|
963
1053
|
// A team-mode change asked for during the turn lands here, AFTER the gate above
|
|
964
1054
|
// read its basis (I-9). The posture lands next: a pending GOVERN entry that
|
|
965
1055
|
// arrives with it is reported by the same toast channel, not silently swallowed.
|
|
@@ -1728,6 +1818,29 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
1728
1818
|
},
|
|
1729
1819
|
}), []);
|
|
1730
1820
|
useEffect(() => () => copyCoordinator.dispose(), [copyCoordinator]);
|
|
1821
|
+
// --- The terminal's own tab title (tui-bottom-bar-brand-and-task-label S2a). --
|
|
1822
|
+
//
|
|
1823
|
+
// THE BRAND MOVES UP TO THE TAB. It used to be drawn on the identity row and
|
|
1824
|
+
// nowhere else - one line under the composer, invisible to everything outside this
|
|
1825
|
+
// process - while the tab kept whatever the shell had put there, so two open
|
|
1826
|
+
// sessions were indistinguishable. OSC 0 names the tab (directory included, so the
|
|
1827
|
+
// tabs differ from each other), the row keeps the bare glyph (`brand="glyph"`
|
|
1828
|
+
// below), and the same `writeForeign` door the clipboard uses for OSC 52 tells the
|
|
1829
|
+
// frame differ these bytes move neither a cell nor the cursor. See
|
|
1830
|
+
// `ui/terminal-title.ts`.
|
|
1831
|
+
//
|
|
1832
|
+
// BOTH EFFECTS ARE INERT WITHOUT `writeForeign`: absent means no frame writer AND no
|
|
1833
|
+
// TTY (a piped `aragon`), which is exactly when there is no tab to name.
|
|
1834
|
+
const titleWrite = terminal?.writeForeign;
|
|
1835
|
+
const titleContext = basename(controller.getCwd());
|
|
1836
|
+
useEffect(() => {
|
|
1837
|
+
applyTerminalTitle(titleWrite, formatTerminalTitle({ brand: BRAND_WORD, context: titleContext }));
|
|
1838
|
+
}, [titleWrite, titleContext]);
|
|
1839
|
+
// A LAYOUT EFFECT FOR THE RESET, deliberately: its destroy runs during the unmount
|
|
1840
|
+
// commit, so the title is handed back BEFORE the process starts tearing the terminal
|
|
1841
|
+
// down. A passive effect's destroy is flushed a tick later, which can lose the race
|
|
1842
|
+
// against `process.exit()`.
|
|
1843
|
+
useLayoutEffect(() => () => resetTerminalTitle(titleWrite), [titleWrite]);
|
|
1731
1844
|
useEffect(() => {
|
|
1732
1845
|
if (!selectionBridge)
|
|
1733
1846
|
return undefined;
|
|
@@ -3023,9 +3136,57 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3023
3136
|
return;
|
|
3024
3137
|
}
|
|
3025
3138
|
if (interactionPhase.current === 'idle') {
|
|
3139
|
+
// AN ARMED CONTINUATION IS CANCELLED FIRST, EVEN WHEN A TEAM IS LIVE: that is
|
|
3140
|
+
// the pre-existing meaning of Esc here ("start nothing"), and a second rung
|
|
3141
|
+
// below it must not take that away.
|
|
3026
3142
|
if (followTimer.current) {
|
|
3027
3143
|
cancelFollowThrough();
|
|
3028
3144
|
dispatch({ type: 'pushToast', level: 'info', text: 'Auto-continue cancelled.' });
|
|
3145
|
+
return;
|
|
3146
|
+
}
|
|
3147
|
+
// --- The team rung (team-detached-dispatch 5.6, I-DD11) -----------------
|
|
3148
|
+
//
|
|
3149
|
+
// IDLE + A LIVE DISPATCH is the state this feature created. Esc used to be a
|
|
3150
|
+
// no-op here; now it asks first: one press arms and says what would be
|
|
3151
|
+
// stopped, a second within the EXISTING 1.5 s window stops it, and any other
|
|
3152
|
+
// input cancels. A stray Esc must never end an hour of work.
|
|
3153
|
+
//
|
|
3154
|
+
// OPTIONAL, like every other team read in this file: a host double has no
|
|
3155
|
+
// team surface, and Esc there must stay the no-op it has always been.
|
|
3156
|
+
const live = controller.readTeamControl?.()?.live ?? null;
|
|
3157
|
+
if (live !== null) {
|
|
3158
|
+
const next = advanceInterruptGesture(interruptGesture.current, performance.now());
|
|
3159
|
+
interruptGesture.current = next.state;
|
|
3160
|
+
if (next.action === 'hint') {
|
|
3161
|
+
if (interruptTimer.current)
|
|
3162
|
+
clearTimeout(interruptTimer.current);
|
|
3163
|
+
interruptTimer.current = setTimeout(() => {
|
|
3164
|
+
interruptTimer.current = null;
|
|
3165
|
+
if (interruptGesture.current.phase !== 'armed')
|
|
3166
|
+
return;
|
|
3167
|
+
interruptGesture.current = { phase: 'ready' };
|
|
3168
|
+
setMetricsClock(Date.now());
|
|
3169
|
+
}, INTERRUPT_CONFIRM_MS + 1);
|
|
3170
|
+
const inspection = controller.readTeamControl?.()?.inspection ?? null;
|
|
3171
|
+
const children = inspection?.children.filter((child) => child.phase !== 'done' && child.phase !== 'failed' && child.phase !== 'aborted').length ?? 0;
|
|
3172
|
+
dispatch({
|
|
3173
|
+
type: 'pushToast',
|
|
3174
|
+
level: 'warn',
|
|
3175
|
+
text: `Stop team ${live.dispatchId} (${children} child${children === 1 ? '' : 'ren'}, ` +
|
|
3176
|
+
`${formatDuration(Date.now() - live.startedAt)})? Esc again to confirm - ` +
|
|
3177
|
+
'ctrl+b to inspect.',
|
|
3178
|
+
});
|
|
3179
|
+
setMetricsClock((value) => value + 1);
|
|
3180
|
+
return;
|
|
3181
|
+
}
|
|
3182
|
+
resetInterrupt();
|
|
3183
|
+
const stopped = controller.stopTeam?.('user', 'stopped with Esc') ?? { stopped: [], live: [] };
|
|
3184
|
+
dispatch({
|
|
3185
|
+
type: 'pushToast',
|
|
3186
|
+
level: 'warn',
|
|
3187
|
+
text: `Team ${live.dispatchId} stopped (${stopped.stopped.length} subagent${stopped.stopped.length === 1 ? '' : 's'}).`,
|
|
3188
|
+
});
|
|
3189
|
+
return;
|
|
3029
3190
|
}
|
|
3030
3191
|
return;
|
|
3031
3192
|
}
|
|
@@ -3062,7 +3223,16 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3062
3223
|
dispatch({ type: 'pushToast', level: 'warn', text: next.action === 'force-stop' ? 'Force-stopped.' : 'Pending run cancelled.' });
|
|
3063
3224
|
return;
|
|
3064
3225
|
}
|
|
3226
|
+
// AC-14 row 2 / I-DD11: stopping THIS turn must not look like it ended a team
|
|
3227
|
+
// started by an earlier turn. `stopEngine()` leaves such a dispatch alive, and
|
|
3228
|
+
// this toast is the only surface that says so - otherwise a 100-minute dispatch
|
|
3229
|
+
// silently outlives the turn the user just cancelled and nobody knows.
|
|
3230
|
+
const outliving = controller.teamOutlivesTurn?.() === true
|
|
3231
|
+
? controller.readTeamControl?.()?.live?.dispatchId ?? null
|
|
3232
|
+
: null;
|
|
3065
3233
|
controller.abort();
|
|
3234
|
+
if (outliving !== null)
|
|
3235
|
+
dispatch({ type: 'pushToast', level: 'warn', text: `Turn stopped. Team ${outliving} is still running (ctrl+b to inspect).` });
|
|
3066
3236
|
if (sequence === submissionSequence.current && interactionPhase.current === 'running') {
|
|
3067
3237
|
setMetricsClock(value => value + 1);
|
|
3068
3238
|
}
|
|
@@ -3196,10 +3366,19 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3196
3366
|
itemCount: state.todos?.items.length ?? 0, viewportBudget,
|
|
3197
3367
|
teamRows: 0, popupRows: 0, composerBaseRows,
|
|
3198
3368
|
});
|
|
3369
|
+
// WHY A MESSAGE IS QUEUED, stated instead of implied (team-detached-dispatch 5.5
|
|
3370
|
+
// item 3): a queue entry now means the lead is inside some OTHER turn, not that
|
|
3371
|
+
// `task` pins it. A live team gets its id too, because "a team is running AND
|
|
3372
|
+
// your message waits" is two facts and only their conjunction looks like a fault.
|
|
3373
|
+
const teamLiveId = state.team?.active === true ? state.team.dispatchId : null;
|
|
3199
3374
|
const queueLayout = useMemo(() => buildQueueLayout({
|
|
3200
3375
|
pending: state.pendingSteering, columns: baseRail.contentCols, terminalRows: rows,
|
|
3201
3376
|
availableRows: Math.max(0, viewportBudget - composerBaseRows - 1), paused: !running,
|
|
3202
|
-
|
|
3377
|
+
...(state.pendingSteering.length > 0
|
|
3378
|
+
? { reason: controller.isCompactionBusy?.() ? 'compaction-busy' : 'lead-busy' }
|
|
3379
|
+
: {}),
|
|
3380
|
+
...(teamLiveId !== null ? { teamLive: teamLiveId } : {}),
|
|
3381
|
+
}), [state.pendingSteering, baseRail.contentCols, rows, viewportBudget, composerBaseRows, running, teamLiveId]);
|
|
3203
3382
|
// THE POOL, NOT THE VIEWPORT MINUS A QUEUE THAT IS NOT DRAWN
|
|
3204
3383
|
// (tui-full-height-live-region RV-P1-3). `QueuePanel` only mounts in the full-screen
|
|
3205
3384
|
// layout, so native mode used to reserve rows for a card nobody paints. And it MUST be
|
|
@@ -3252,7 +3431,17 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3252
3431
|
// ALWAYS CALLED, INERT WHEN `enabled` IS FALSE: hooks cannot be conditional, and
|
|
3253
3432
|
// an inert hook is what keeps `scrollMode: 'app'` byte-identical (I-S9).
|
|
3254
3433
|
const viewCols = native ? Math.max(1, cols - 1) : cols;
|
|
3255
|
-
|
|
3434
|
+
// THE IDENTITY ROW IS AS WIDE AS THE COMPOSER (S3). `viewCols` is the OVERLAY width
|
|
3435
|
+
// and, in `app` mode, one cell wider than the composer (`layout/budget.ts`), so the
|
|
3436
|
+
// row and the box under it ended one cell apart on the right (measured: 119 vs 118) -
|
|
3437
|
+
// the half of "the diamond does not line up" that is a real width difference. Native
|
|
3438
|
+
// mode already agreed; this makes the agreement a construction instead of a
|
|
3439
|
+
// coincidence.
|
|
3440
|
+
const headerCols = Math.max(1, frameBudget.composerCols);
|
|
3441
|
+
const header = (_jsx(Header, { columns: headerCols,
|
|
3442
|
+
// THE WORD MARK LIVES ON THE TAB NOW (S2b): the row draws the diamond alone,
|
|
3443
|
+
// which is also what puts it at cell 0 over the composer's left border.
|
|
3444
|
+
brand: "glyph",
|
|
3256
3445
|
// DERIVED IN EXACTLY ONE PLACE (0-3 (d)): both overlay slots render
|
|
3257
3446
|
// `overlayNode`, and both read this same three-state value from here.
|
|
3258
3447
|
panel: overlay === null ? 'none' : overlay === 'shortcuts' ? 'shortcuts' : 'other', scrolledLines: scrolledLines, taskSummary: state.taskSummary === null
|
|
@@ -3510,7 +3699,15 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3510
3699
|
// last inline phase filter, left behind when the StatusBar chip converged, and it
|
|
3511
3700
|
// feeds the `Team n/m` on the second status row.
|
|
3512
3701
|
teamActive: state.team
|
|
3513
|
-
? {
|
|
3702
|
+
? {
|
|
3703
|
+
running: rosterCounts(state.team.runs).running,
|
|
3704
|
+
total: state.team.runs.length,
|
|
3705
|
+
// The held children are the difference between "busy" and "stopped by
|
|
3706
|
+
// somebody" - the one number a user needs to unstick it.
|
|
3707
|
+
...(rosterCounts(state.team.runs).paused > 0
|
|
3708
|
+
? { paused: rosterCounts(state.team.runs).paused }
|
|
3709
|
+
: {}),
|
|
3710
|
+
}
|
|
3514
3711
|
: undefined,
|
|
3515
3712
|
todoActive: state.todos ? { done: state.todos.doneCount, total: state.todos.total } : undefined,
|
|
3516
3713
|
// ONE LINE, NO ROW ALGEBRA HERE (P1-8 / C-9): whether the acceptance count still
|
|
@@ -3532,6 +3729,9 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3532
3729
|
hasDraft: hasDraftRef.current, services: liveServices,
|
|
3533
3730
|
hintsEnabled: cfg.hints, modeToggleKey, governed: isGovernancePosture(state.posture),
|
|
3534
3731
|
...(state.governance?.pauseRequested === true ? { govPausePending: true } : {}),
|
|
3732
|
+
// The idle row names the live team (§5.10): "the agent is idle" and "a team is
|
|
3733
|
+
// running" are both true at once now, and only the pair looks like a fault.
|
|
3734
|
+
...(state.team?.active === true ? { teamLive: state.team.dispatchId } : {}),
|
|
3535
3735
|
interruptPhase: interruptGesture.current.phase,
|
|
3536
3736
|
updateAvailable: !!updateSnapshot && shouldRenderUpdateLine(updateSnapshot) } });
|
|
3537
3737
|
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,
|
|
@@ -3580,6 +3780,9 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3580
3780
|
teamActive: {
|
|
3581
3781
|
running: rosterCounts(state.team.runs).running,
|
|
3582
3782
|
total: state.team.runs.length,
|
|
3783
|
+
...(rosterCounts(state.team.runs).paused > 0
|
|
3784
|
+
? { paused: rosterCounts(state.team.runs).paused }
|
|
3785
|
+
: {}),
|
|
3583
3786
|
},
|
|
3584
3787
|
}
|
|
3585
3788
|
: {}), ...(state.todos && !(native
|
|
@@ -24,7 +24,7 @@ export interface RedTeamKeyLike {
|
|
|
24
24
|
shift: boolean;
|
|
25
25
|
}
|
|
26
26
|
export type RedTeamToastLevel = 'info' | 'warn';
|
|
27
|
-
export type RedTeamControllerPort = Partial<Pick<AgentController, 'getRedTeamView' | 'setRedTeam' | 'applyPendingRedTeam' | 'subscribeRedTeam' | 'acceptRedTeamWaiver' | 'getRedTeamBanner' | 'getRedTeamScope' | 'getConfig'>>;
|
|
27
|
+
export type RedTeamControllerPort = Partial<Pick<AgentController, 'getRedTeamView' | 'setRedTeam' | 'applyPendingRedTeam' | 'subscribeRedTeam' | 'acceptRedTeamWaiver' | 'getRedTeamBanner' | 'getRedTeamScope' | 'getRedTeamPromptView' | 'getConfig'>>;
|
|
28
28
|
export interface UseRedTeamModeArgs {
|
|
29
29
|
controller: RedTeamControllerPort;
|
|
30
30
|
/** App supplies the toast with the right ttl for the level. */
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { useCallback, useEffect, useReducer, useRef } from 'react';
|
|
18
18
|
import { redTeamToast, } from '@aragon-agent/tui/model/redteam/redteam-mode';
|
|
19
|
-
import { REDTEAM_NOTICE, REDTEAM_TOAST } from '@aragon-agent/tui/ui/redteam-copy';
|
|
19
|
+
import { REDTEAM_NOTICE, REDTEAM_PROMPT, REDTEAM_PROMPT_ISSUE_TEXT, REDTEAM_TOAST, } from '@aragon-agent/tui/ui/redteam-copy';
|
|
20
20
|
import { UNAVAILABLE_RED_TEAM_VIEW } from '../agent/redteam-wiring.js';
|
|
21
21
|
/** How long each level stays on screen. Refusals are longer: they have to be read. */
|
|
22
22
|
export function redTeamToastTtlMs(level) {
|
|
@@ -59,6 +59,19 @@ export function useRedTeamMode(args) {
|
|
|
59
59
|
if (rows && rows.length > 0)
|
|
60
60
|
argsRef.current.pushNotice?.('warn', rows.join('\n'));
|
|
61
61
|
}
|
|
62
|
+
// A BROKEN PROFILE HAS TO SAY SO WHERE THE USER IS LOOKING (PF-9 / AC-08). The wiring hands
|
|
63
|
+
// every issue to its `notify` port, and the interactive host's port is a no-op by design -
|
|
64
|
+
// but arming is the one moment a user is certainly watching, so the arm-time issues are
|
|
65
|
+
// repeated here as a transcript line. CODES ONLY: `detail` can hold a path (D-11).
|
|
66
|
+
if (outcome.ok && outcome.effect === 'applied' && outcome.armed) {
|
|
67
|
+
const prompt = live.getRedTeamPromptView?.();
|
|
68
|
+
const issues = prompt?.issues ?? [];
|
|
69
|
+
if (prompt !== undefined && issues.length > 0) {
|
|
70
|
+
const codes = [...new Set(issues.map((issue) => issue.code))].slice(0, 3);
|
|
71
|
+
const why = codes.map((code) => REDTEAM_PROMPT_ISSUE_TEXT[code] ?? code).join('; ');
|
|
72
|
+
argsRef.current.pushNotice?.('warn', `${REDTEAM_PROMPT.issuePrefix}${prompt.profile} - ${why}.`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
62
75
|
if (outcome.ok && outcome.effect === 'deferred') {
|
|
63
76
|
argsRef.current.pushNotice?.('info', REDTEAM_NOTICE.armingDeferred);
|
|
64
77
|
}
|
package/dist/cli.js
CHANGED
|
@@ -225,6 +225,11 @@ function toFlags(opts) {
|
|
|
225
225
|
// that passed no flag at all.
|
|
226
226
|
redteam: opts.redteam === true ? true : undefined,
|
|
227
227
|
noRedteam: opts.redteam === false ? true : undefined,
|
|
228
|
+
// Site three of four for `--redteam-prompt`. Absent stays `undefined`, which is what keeps
|
|
229
|
+
// every session that did not pass it byte-identical to the pre-feature build. READ
|
|
230
|
+
// COMMANDER'S SPELLING (`redteamPrompt`), never `redTeamPrompt`: the capital `T` is the
|
|
231
|
+
// difference between a working flag and a silent no-op.
|
|
232
|
+
redTeamPrompt: opts.redteamPrompt,
|
|
228
233
|
// Site three of three for `--no-gene`, declared alone like `--no-memory`: commander
|
|
229
234
|
// defaults `opts.gene` to `true` when it is absent, so only an explicit `false` is forwarded
|
|
230
235
|
// (as `noGene: true`) and silence can never read as an override.
|
|
@@ -413,6 +418,10 @@ async function runInteractive(flags, extras = {}) {
|
|
|
413
418
|
// the `preAction` hook has already refused the two impossible combinations, so this is a
|
|
414
419
|
// plain boolean by here - and it is absent for `-p` / `exec` / every subcommand (I-1).
|
|
415
420
|
...(flags.redteam === true ? { redTeamArmed: true } : {}),
|
|
421
|
+
// THE SESSION'S PROMPT PROFILE, on the SAME channel as `redTeamArmed` and deliberately
|
|
422
|
+
// NOT through `validateRedTeamLaunch` (S-12): that function's decision is discarded at its
|
|
423
|
+
// only call site, so a field added there would never be read.
|
|
424
|
+
...(flags.redTeamPrompt === undefined ? {} : { redTeamPromptPath: flags.redTeamPrompt }),
|
|
416
425
|
});
|
|
417
426
|
// THE RESTORE HAPPENS BEFORE THE FIRST FRAME. `initialEntries` seeds the
|
|
418
427
|
// reducer, so a resumed transcript is complete on frame one instead of filling
|
|
@@ -2142,6 +2151,10 @@ function buildProgram() {
|
|
|
2142
2151
|
// could accept it, and an armed session nobody can leave is worse than no armed session.
|
|
2143
2152
|
.option('--redteam', 'Start this session in red team / security mode (needs the waiver accepted)')
|
|
2144
2153
|
.option('--no-redteam', 'Disable red team mode for this launch (no chip, no key; not persisted)')
|
|
2154
|
+
// THE PROMPT PROFILE FOR ONE SESSION (redteam-prompt-profile S-12 / S-16). It outranks
|
|
2155
|
+
// `redteam.profile`, it is never persisted, and an unreadable path is a WARNING with a
|
|
2156
|
+
// fallback to the built-in block - never a refusal to start.
|
|
2157
|
+
.option('--redteam-prompt <path>', 'Prompt profile file for this session (overrides redteam.profile)')
|
|
2145
2158
|
// Negative-only for the reason `--no-memory` records: it can only ever switch the Gene Bank
|
|
2146
2159
|
// off for this launch (no service, no tools, byte-identical prompt), and `toFlags` forwards
|
|
2147
2160
|
// it only when explicitly given. The positive `--gene` / `--gene-learn` belong to the
|
package/dist/commands/catalog.js
CHANGED
|
@@ -47,11 +47,15 @@ export const BUILTIN_COMMAND_CATALOG = [
|
|
|
47
47
|
{ name: 'gene', aliases: ['genes'], description: 'Gene Bank: status, search, show, explain, pin, archive, rollback, queue, stats, export, import, import-memory' },
|
|
48
48
|
{ name: 'agents', aliases: [], description: 'Open the subagent board: every child, its facts and its timeline' },
|
|
49
49
|
{ name: 'subagent', aliases: [], description: 'Deprecated alias of /team - same arguments' },
|
|
50
|
-
{
|
|
50
|
+
{
|
|
51
|
+
name: 'team',
|
|
52
|
+
aliases: [],
|
|
53
|
+
description: 'Force team mode and start now: /team <brief>|on|off|status|wait|send|pause|resume|stop|spawn',
|
|
54
|
+
},
|
|
51
55
|
// red-team-security-mode 4.8: the fourth session posture. Listed here for the reason every
|
|
52
56
|
// command above is - the catalog is what the slash menu and the drift test read, so a
|
|
53
57
|
// command that exists only in the registry is one the user cannot discover.
|
|
54
|
-
{ name: 'redteam', aliases: [], description: 'Red team mode: /redteam [status|on|off|scope <one line
|
|
58
|
+
{ name: 'redteam', aliases: [], description: 'Red team mode: /redteam [status|on|off|scope <one line>|prompt [...]]' },
|
|
55
59
|
{ name: 'gov', aliases: [], description: 'Governed multi-agent team: /gov help' },
|
|
56
60
|
{ name: 'keys', aliases: [], description: 'List every keyboard shortcut (opens the drawer)' },
|
|
57
61
|
{ name: 'task', aliases: [], description: 'Show the header task summary (/task refresh regenerates it)' },
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `/redteam`: report, enter, leave,
|
|
3
|
-
* (red-team-security-mode 4.8 / D-18).
|
|
2
|
+
* `/redteam`: report, enter, leave, declare the engagement scope, and manage the prompt profile
|
|
3
|
+
* (red-team-security-mode 4.8 / D-18; `prompt` since redteam-prompt-profile 7.1).
|
|
4
4
|
*
|
|
5
5
|
* ASCII ONLY: `src/commands/**` is inside `glyphs.test.ts::inScope`.
|
|
6
6
|
*
|
|
7
|
-
* FOUR SUBCOMMANDS AND ONE SHARED ENTRY
|
|
8
|
-
* the same call `Ctrl+R` makes, so a turn in flight defers the
|
|
9
|
-
* and the wording is the shared toast. `status` never refuses,
|
|
10
|
-
* a security posture nobody can query is a posture the user
|
|
11
|
-
* "am I in red team mode right now" is exactly the one a
|
|
12
|
-
* destructive command in the transcript.
|
|
7
|
+
* FOUR SUBCOMMANDS AND ONE SHARED ENTRY, PLUS `prompt`. `on` / `off` go through
|
|
8
|
+
* `controller.setRedTeam()`, the same call `Ctrl+R` makes, so a turn in flight defers the
|
|
9
|
+
* arming instead of being refused and the wording is the shared toast. `status` never refuses,
|
|
10
|
+
* in any posture and any session: a security posture nobody can query is a posture the user
|
|
11
|
+
* cannot verify - and the question "am I in red team mode right now" is exactly the one a
|
|
12
|
+
* person asks while looking at a destructive command in the transcript.
|
|
13
13
|
*
|
|
14
14
|
* THE COMMAND DOES NOT OPEN THE WAIVER OVERLAY. `on` without an accepted waiver answers with
|
|
15
15
|
* the sentence that names the key instead: the overlay is App state, and a command that opened
|
|
16
16
|
* it could not settle it (accepting has to re-plan the request and push the banner).
|
|
17
|
+
*
|
|
18
|
+
* `/redteam prompt` HAS ONE RULE THAT IS NOT NEGOTIABLE (RV-P1-10 / AC-23): a word that is
|
|
19
|
+
* already a `/redteam` verb is NEVER a profile name. `/redteam prompt status` is what a user
|
|
20
|
+
* types after `/redteam status`, and turning it into `redteam.profile = "status"` would be a
|
|
21
|
+
* silent configuration write - the exact failure a "one file, one setting" feature must not
|
|
22
|
+
* have.
|
|
17
23
|
*/
|
|
18
24
|
import type { CommandContext, CommandRegistry } from './registry.js';
|
|
19
25
|
/** Where the `/redteam` handler lives, so `builtins.ts` only adds one registration. */
|