@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/CHANGELOG.md
CHANGED
|
@@ -7,7 +7,69 @@ were written.
|
|
|
7
7
|
|
|
8
8
|
## Unreleased
|
|
9
9
|
|
|
10
|
+
### Breaking
|
|
11
|
+
|
|
12
|
+
- **`task` no longer returns the final report in an interactive session.** It returns "started" — the
|
|
13
|
+
dispatch id, the labels it created and a one-line cheat sheet of the control tools — and the dispatch
|
|
14
|
+
then belongs to the runtime, not to a tool call. The report arrives once, at the end, as a transcript
|
|
15
|
+
notice plus **at most one** summary turn in which the lead restates it in its own words
|
|
16
|
+
(`team.autoResume`, default `auto`; `team.settleGraceMs`, default 3000 ms, is the window in which your
|
|
17
|
+
next message cancels that turn). `aragon -p`, `aragon exec` and governance mode keep the blocking
|
|
18
|
+
behaviour and the byte-identical report, so scripts, hosts and `schemaVersion` are untouched.
|
|
19
|
+
**Migration:** read the notice, call `team_collect` when you need the report synchronously, or set
|
|
20
|
+
`team.detachDispatch: false` (`aragon config set team.detachDispatch false`) to restore the old
|
|
21
|
+
behaviour; that key only affects the **next** dispatch, never a running one.
|
|
22
|
+
- **`Esc` no longer kills a team that an earlier turn started — and stopping a team from idle now takes
|
|
23
|
+
a confirming second press.** The ladder is about whose turn it is, not about whether anything runs:
|
|
24
|
+
running with a dispatch started by *this* turn stops both (unchanged); running with a dispatch from an
|
|
25
|
+
earlier turn stops the turn only, the team survives and a toast says so; idle with a live dispatch asks
|
|
26
|
+
once (`Stop team d1 (2 children, 1h49m)? Esc again to confirm`) and needs a second `Esc` within 1.5 s,
|
|
27
|
+
with any other input cancelling. **Migration:** use `team_stop` (or `/team stop all`) to end a team
|
|
28
|
+
that outlived its turn, because a later `Esc` no longer does it. Both changes are deliberate: one `Esc`
|
|
29
|
+
used to mean "clear my mind", and it must not be able to throw away two hours of work.
|
|
30
|
+
|
|
10
31
|
### Added
|
|
32
|
+
|
|
33
|
+
- **Prompt profiles: the red team block's wording now lives in an editable Markdown file.** The
|
|
34
|
+
`<redteam_mode>` block was two halves in one place; now it is two halves in two homes. The **fact**
|
|
35
|
+
half - the authorization line, `What this mode changes`, the closing boundary sentence - stays in
|
|
36
|
+
code and cannot be replaced, because a file must never be able to make the mode stop stating what
|
|
37
|
+
this session actually loosened. The **policy** half (`role`, `execution`, `rules of engagement`,
|
|
38
|
+
`method`, `routing`, `deliverable`, `house rules`) comes from `~/.aragon-agent/redteam/profiles/
|
|
39
|
+
<slug>.md`: a minimal `---` header (`schema` / `name` / `title` / `extends` / `mode` / `updated`)
|
|
40
|
+
plus `## section` paragraphs, matched leniently (`## Rules of engagement` == `## rules_of_engagement`).
|
|
41
|
+
Six new actions on `/redteam prompt` (`status`, `builtin`, `<slug>`, `<path>`, `reload`,
|
|
42
|
+
`validate [<path>]`, `init [<slug>]`), one new flag (`--redteam-prompt <path>`, session-only), one
|
|
43
|
+
new config key (`redteam.profile`, default `builtin` = read no file), and `redteam.profile` takes
|
|
44
|
+
three forms - `builtin`, a slug, or a path used verbatim. Nothing about the mode is required to use
|
|
45
|
+
it: with the default, the block is byte-identical to a build that has no profiles at all, and every
|
|
46
|
+
profile is optional and hot: a missing, oversized, headerless or self-inheriting file warns and
|
|
47
|
+
falls back WITHOUT refusing to arm. Section bodies cannot break the fence - a literal
|
|
48
|
+
`</redteam_mode>` in your prose is neutralized - and the built-in defaults are guarded by a test
|
|
49
|
+
that refuses the injection template this feature was adapted from (`no scope check`,
|
|
50
|
+
`never refuse`, the "Scoped Rules" list). See the README's "Prompt profiles".
|
|
51
|
+
|
|
52
|
+
- **Detached dispatch: the lead stays free while a team runs, and drives it with a console.** A dispatch
|
|
53
|
+
is now owned by `TeamRuntime` (`start()` returns a `DispatchHandle`; `dispatch()` keeps the await
|
|
54
|
+
behaviour for governance, `-p` and `exec`), so a message you send mid-dispatch is an ordinary turn the
|
|
55
|
+
lead answers instead of a queued line waiting for the team to finish. Seven new lead-side tools -
|
|
56
|
+
`team_status` (roster, partial results, wall-clock ceiling), `team_message` (one child or `all`, with an
|
|
57
|
+
optional steer at its next safe point), `team_pause` / `team_resume` (cooperative, at a tool boundary,
|
|
58
|
+
and never mistaken for a stall by the supervisor), `team_stop` (one child or the whole dispatch, sharing
|
|
59
|
+
the supervisor's single abort path), `team_spawn` (add children under the same caps) and `team_collect`
|
|
60
|
+
(bounded wait that returns early the moment you type) - are registered for the lead only; subagents keep
|
|
61
|
+
`team_send` / `team_wait`. The same controls exist as commands - `/team wait`, `/team send`,
|
|
62
|
+
`/team pause`, `/team resume`, `/team stop`, `/team spawn` - which cost no model turn, and which only
|
|
63
|
+
treat a verb as control when the next token is `all`, a live label, a number or absent, so
|
|
64
|
+
`/team stop the leak hunt` and `/team "stop all"` stay briefs. They no longer refuse while a turn or
|
|
65
|
+
a dispatch is already running.
|
|
66
|
+
Three new config keys: `team.detachDispatch` (default `true`), `team.autoResume` (`auto` | `notify` | `off`,
|
|
67
|
+
default `auto`) and `team.settleGraceMs` (500-30000, default 3000). The report is generated once
|
|
68
|
+
(`session.reportText`), so the notice, `team_collect` and `/team wait` return the same string; notices are
|
|
69
|
+
delivered exactly once even when the fast reviewer clears the queues. With `team.detachDispatch: false`
|
|
70
|
+
the blocking behaviour returns and the free-lead paragraph leaves `<team_mode>`; the tool array and
|
|
71
|
+
`task`'s description are identical in both modes.
|
|
72
|
+
|
|
11
73
|
- **Gene Bank - `Ctrl+Q`, `/gene`, `aragon gene`, `--no-gene` / `--gene` / `--gene-learn`.** A library of
|
|
12
74
|
what the agent has learned: *knowledge* genes (project facts, environment limits, fixes, preferences),
|
|
13
75
|
*tool* genes (parameterised commands with an input schema) and *skill* genes (a method with a trigger,
|
|
@@ -74,6 +136,15 @@ were written.
|
|
|
74
136
|
`askEveryArm` are the four new config keys.
|
|
75
137
|
|
|
76
138
|
### Changed
|
|
139
|
+
|
|
140
|
+
- **The red team `<redteam_mode>` block is v2, and `/redteam status` has a fifth line.** The block
|
|
141
|
+
carries two new sections (`Execution`, `House rules`) and one new `Method` bullet (reversibility,
|
|
142
|
+
backups, reproducible diffs); section headings are now emitted by code instead of living inside the
|
|
143
|
+
bodies, so `builtin` output for a fixed scope is a frozen snapshot. A subagent still gets the trimmed
|
|
144
|
+
variant: the first two authorization items, and the last two method items removed. The status report
|
|
145
|
+
gained `Prompt: <profile> (<source>, <n> slot(s) overridden, <bytes> bytes).` so "which text is the
|
|
146
|
+
model reading" is answerable without opening a file. The disclaimer clause set is UNCHANGED and its
|
|
147
|
+
version stays `1`: this release changed how the mode talks, not a single permission fact.
|
|
77
148
|
- **`Ctrl+R` is the red team switch now, and the frame repaint moved to `Alt+R`.** Same reason
|
|
78
149
|
`Ctrl+T` moved to `Alt+T`: legacy encodings deliver one byte for `Ctrl+R` and `Ctrl+Shift+R`, so a
|
|
79
150
|
Shift binding would exist only on the terminals least likely to need a recovery key. **The rebinding
|
package/README.md
CHANGED
|
@@ -958,7 +958,7 @@ ignores them rather than rejecting the library):
|
|
|
958
958
|
| `/session [copy\|pin]` | Report this session's id, file and branch parent; `copy` puts `aragon --resume <id>` on the clipboard; `pin` makes `sessions prune` skip the file forever |
|
|
959
959
|
| `/plan [on\|off\|status]` | Toggle plan mode (and leave governance) - the keyboard-free equivalent of `Shift+Tab` |
|
|
960
960
|
| `/gov [status\|on\|plan\|off\|board\|runs\|report [id]\|resume [id]\|pause [cancel]\|abort\|budget <n\|off>\|help]` | **Governance mode**: a governed engineering team (dev / review / test / inspector) with a GT scoring economy. `on` = GOVERN, `plan` = PLAN+GOVERN (interview first), `board` opens the full-screen overview, `runs` lists past runs with phase / health / tokens / cost, `report` re-reads a run's report, `pause` stops at the end of the running stage (nothing is killed), `abort` stops the running stage at once (the run is resumable). See [Governance mode](#governance-mode) |
|
|
961
|
-
| `/redteam [status\|on\|off\|scope <one line
|
|
961
|
+
| `/redteam [status\|on\|off\|scope <one line>\|prompt [...]]` | **Red team / security mode.** `/redteam status` prints five lines (effective state, scope, what the confirmation gate is doing, what this mode does NOT lift, and which prompt profile is supplying the wording) in any session, including `--no-redteam`. `on` needs the liability waiver accepted first (`Ctrl+R` opens it); a turn in flight defers the arming to its end, while `off` takes effect immediately and is never refused. `scope` declares the engagement boundary in one line (refused above 200 characters or across lines); no argument clears it. `prompt` manages the editable prompt profile: `status`, `builtin`, `<slug>`, `<path>`, `reload`, `validate [<path>]`, `init [<slug>]`. See [Red team and security mode](#red-team-and-security-mode) and [Prompt profiles](#prompt-profiles) |
|
|
962
962
|
| `/team [on [n]\|off\|status]` / `/team [-n <n>] [--parts a,b,c] [--read-only] <brief>` | **Force team mode and start now.** `/team <brief>` arms forced team mode and submits that work as a normal turn: the lead analyses and plans it, then calls `task` — the directive, the `<forced_team_mode>` prompt block and a mechanical end-of-turn gate all say so. `/team on [n]` arms (optionally with a count) without submitting, `/team off` leaves - both take effect when the turn ends if one is running - and `/team` reports. The configuration it used to carry (team switch, width, concurrency, supervisor, subagent model) lives in `Settings > Team` |
|
|
963
963
|
| `/todo [on\|off\|panel on\|off\|follow <mode>\|acceptance on\|off\|reset\|clear\|continue]` | Todo planning: status, the on/off switch, the rail, follow-through, acceptance criteria, and picking an unfinished plan back up |
|
|
964
964
|
| `/retry [show\|on\|off\|max <n>]` | API retry: the effective ladder, the on/off switch, the retry count. Takes effect **in the running session**, children included |
|
|
@@ -2605,8 +2605,134 @@ children's tokens are folded into the `[usage]` footer.
|
|
|
2605
2605
|
`debug`. A `team_send` subject is recorded, never its body; a subagent's brief
|
|
2606
2606
|
and summary only at `trace`.
|
|
2607
2607
|
|
|
2608
|
-
|
|
2609
|
-
|
|
2608
|
+
### The lead stays free during a dispatch
|
|
2609
|
+
|
|
2610
|
+
`task` no longer blocks the interactive session. It returns a **dispatch handle**
|
|
2611
|
+
immediately — the id, the labels it created, and a one-line cheat sheet of the
|
|
2612
|
+
control tools — and the dispatch lives in the runtime instead of inside a tool
|
|
2613
|
+
call. That is the whole point: the lead is *idle* while the team works, so a
|
|
2614
|
+
message you send mid-dispatch is an ordinary new turn it answers instead of
|
|
2615
|
+
sitting in `Queue: 如何了` until the team finishes 109 minutes later. The tool's
|
|
2616
|
+
answer says so in words, because the model can only read words: *not finished
|
|
2617
|
+
yet*, *the report arrives when the team finishes*, *answer the user's questions
|
|
2618
|
+
now, do not wait*.
|
|
2619
|
+
|
|
2620
|
+
The guarantees did not move: one dispatch per session at a time (a second `task`
|
|
2621
|
+
is refused with a plain-text `BUSY_REFUSAL` that names the live dispatch and the
|
|
2622
|
+
tools to use instead), one report per dispatch, the same byte budget on that
|
|
2623
|
+
report, the same `team.maxSubagents` ceiling, and the same wall clock
|
|
2624
|
+
(`team.dispatchTimeoutMs`; `team.overseer` still means "supervise, do not
|
|
2625
|
+
abort").
|
|
2626
|
+
|
|
2627
|
+
`team.detachDispatch` (default `true`, also settable with `aragon config set team.detachDispatch false`) is the escape
|
|
2628
|
+
hatch: `false` restores the blocking behaviour, and with it the system prompt and
|
|
2629
|
+
the tool array are byte-identical to the pre-feature session. **Flipping it
|
|
2630
|
+
mid-session is deliberately next-dispatch-only**: the runtime keeps the mode a
|
|
2631
|
+
dispatch started with, so the key can never turn a live team into an awaited tool
|
|
2632
|
+
call or the other way round. `-p`, `aragon exec` and governance mode always
|
|
2633
|
+
dispatch in await mode — the machine contract does not change for this feature.
|
|
2634
|
+
|
|
2635
|
+
### When the report comes back: one notice, at most one summary turn
|
|
2636
|
+
|
|
2637
|
+
| Key | Values | What it does |
|
|
2638
|
+
|---|---|---|
|
|
2639
|
+
| `team.autoResume` | `auto` (default) / `notify` / `off` | `auto` gives the lead one bounded turn to summarise the finished dispatch; `notify` only announces it in the transcript; `off` says nothing at all |
|
|
2640
|
+
| `team.settleGraceMs` | 500-30000 ms, default 3000 | How long that summary turn waits before it runs, so your next keystroke can cancel it |
|
|
2641
|
+
|
|
2642
|
+
The rules are narrow on purpose:
|
|
2643
|
+
|
|
2644
|
+
- **At most one summary turn per dispatch.** A second one is never armed.
|
|
2645
|
+
- **Any user input cancels it.** The grace window exists for exactly that: a
|
|
2646
|
+
message you send inside it becomes the turn, and the notice rides along with
|
|
2647
|
+
it instead of costing a second turn.
|
|
2648
|
+
- **It never repeats the report.** The summary turn points at the report; the
|
|
2649
|
+
report itself is the notice, and `team_collect` returns the same string, byte
|
|
2650
|
+
for byte, so the readers cannot drift apart.
|
|
2651
|
+
- **It degrades to a plain notice** when the dispatch was aborted or errored,
|
|
2652
|
+
when it settled inside the turn that started it, when you already have an
|
|
2653
|
+
unread message, when a TODO follow-through or a forced-dispatch nudge already
|
|
2654
|
+
owns the follow timer, or when `autoResume` is `notify`.
|
|
2655
|
+
- **Notices are delivered exactly once** — idempotent per
|
|
2656
|
+
`dispatch:label:status`, and re-sent from a ledger if the fast reviewer's queue
|
|
2657
|
+
clear swallowed one.
|
|
2658
|
+
|
|
2659
|
+
### The lead's console: seven control tools
|
|
2660
|
+
|
|
2661
|
+
While a dispatch is live the lead has seven tools that answer in milliseconds.
|
|
2662
|
+
They are registered for the **lead only**: subagents keep `team_send` /
|
|
2663
|
+
`team_wait`, because one name on both sides would make "whose list is this tool
|
|
2664
|
+
in?" a three-file question.
|
|
2665
|
+
|
|
2666
|
+
| Tool | What it does |
|
|
2667
|
+
|---|---|
|
|
2668
|
+
| `team_status` | Shows the roster and partial results: phase, elapsed, turns / tools, last tool, intervention count, and the wall-clock ceiling (`none`, or what is left of it) |
|
|
2669
|
+
| `team_message` | Sends one child (or `all`) a message that lands in its next tool result, and by default also steers it at its next safe point |
|
|
2670
|
+
| `team_pause` | Holds one child at its next tool boundary; the pause is cooperative, so a tool already running finishes (`deferred`) |
|
|
2671
|
+
| `team_resume` | Lets a paused child continue from the phase it paused in, optionally with one steered line saying why |
|
|
2672
|
+
| `team_stop` | Ends one child or the whole dispatch — the only way to kill a team that an earlier turn started |
|
|
2673
|
+
| `team_spawn` | Adds children to a live dispatch; the total still obeys `team.maxSubagents` and the hard maximum, and a child without a free slot queues |
|
|
2674
|
+
| `team_collect` | Waits for results on a budget (5-120 s, default 30) and returns early the moment you send a message |
|
|
2675
|
+
|
|
2676
|
+
Two rules they all share: **a refusal is plain text, never an error** (an error
|
|
2677
|
+
reads as a malfunction and invites a retry), and **nothing the lead can do blocks
|
|
2678
|
+
on the team** except `team_collect`, which itself gives way to a waiting message
|
|
2679
|
+
from you. A paused child is not a suspected stall: the supervisor neither nudges
|
|
2680
|
+
nor abandons it while it is paused, and the pause is credited back to the child's
|
|
2681
|
+
own timeout without ever extending the dispatch ceiling.
|
|
2682
|
+
|
|
2683
|
+
### Controlling a live dispatch from the composer
|
|
2684
|
+
|
|
2685
|
+
The same controls are commands, so they cost no model turn:
|
|
2686
|
+
|
|
2687
|
+
```
|
|
2688
|
+
/team status # the roster, now with interventions and mail
|
|
2689
|
+
/team wait [seconds] # bounded wait; ends when the dispatch settles
|
|
2690
|
+
/team send <label|all> <text> # one message to one child
|
|
2691
|
+
/team pause <label> [reason...] # stop it at its next tool boundary
|
|
2692
|
+
/team resume <label> [message...] # let it continue, optionally with a nudge
|
|
2693
|
+
/team stop <label|all> [reason...] # end it, or the whole dispatch
|
|
2694
|
+
/team spawn <n> <brief> # add n children from one brief
|
|
2695
|
+
```
|
|
2696
|
+
|
|
2697
|
+
Every one of those words is also a legal brief (`/team stop the leak hunt` used
|
|
2698
|
+
to dispatch a team about stopping leaks), so a verb only counts as control when
|
|
2699
|
+
the next token proves the intent:
|
|
2700
|
+
|
|
2701
|
+
| You type | It is | Why |
|
|
2702
|
+
|---|---|---|
|
|
2703
|
+
| `/team stop all`, `/team pause bundle-a` | Control | The second token is `all`, or a label that is live right now |
|
|
2704
|
+
| `/team stop the leak hunt` | A brief | `the` is neither `all` nor a live label, so the whole line stays a brief |
|
|
2705
|
+
| `/team wait`, `/team wait 60` | Control | No argument, or a plain number |
|
|
2706
|
+
| `/team wait for the build` | A brief | `for` is not a number |
|
|
2707
|
+
| `/team spawn 3 ...` | Control | A positive integer |
|
|
2708
|
+
| `/team spawn the builders` | A brief | `the` is not a number |
|
|
2709
|
+
| `/team "stop all"` | A brief | Quoting still escapes: this dispatches a team about `stop all` |
|
|
2710
|
+
|
|
2711
|
+
A verb with no live dispatch answers in one line — `No team dispatch is running. Use task to
|
|
2712
|
+
start one.` — instead of failing, and the control verbs, unlike
|
|
2713
|
+
`/team on|off` and a plain brief — do not refuse while a turn or a dispatch is
|
|
2714
|
+
already running, because that is the situation they exist for. `/subagent` gets
|
|
2715
|
+
the same verbs, since it is the same command.
|
|
2716
|
+
|
|
2717
|
+
### `Esc`: who stops what
|
|
2718
|
+
|
|
2719
|
+
`Esc` used to be simple because a team could only exist inside the turn that
|
|
2720
|
+
started it. It can outlive that turn now, so the ladder is about **whose turn it
|
|
2721
|
+
is**, not about whether anything is running:
|
|
2722
|
+
|
|
2723
|
+
| The lead | A dispatch | Started by this turn? | `Esc` does |
|
|
2724
|
+
|---|---|---|---|
|
|
2725
|
+
| Running | Live | Yes | What it always did: the turn stops and the team stops with it |
|
|
2726
|
+
| Running | Live | No | Only the turn stops; the team keeps running, and one toast says `Turn stopped. Team d1 is still running (Ctrl+B to inspect).` |
|
|
2727
|
+
| Running | None | — | The turn stops |
|
|
2728
|
+
| Idle | Live | — | **First `Esc`** asks: `Stop team d1 (2 children, 1h49m)? Esc again to confirm — Ctrl+B to inspect.` **Second `Esc` within 1.5 s** stops the team; any other input cancels the confirmation |
|
|
2729
|
+
| Idle | None | — | Nothing to interrupt (a pending follow-through is still cancelled, as before) |
|
|
2730
|
+
|
|
2731
|
+
The two-line summary of that table: stopping an unrelated turn no longer kills a
|
|
2732
|
+
team that an earlier turn started (`team_stop` is the way to kill *someone
|
|
2733
|
+
else's* team), and stopping a team from idle deliberately takes two presses — one
|
|
2734
|
+
`Esc` that used to mean "clear my mind" can no longer throw away two hours of
|
|
2735
|
+
work.
|
|
2610
2736
|
|
|
2611
2737
|
## Fast model tier
|
|
2612
2738
|
|
|
@@ -3614,6 +3740,7 @@ env / `.env` → CLI flags**.
|
|
|
3614
3740
|
| `redteam.bypassConfirm` | `true` | While armed, skip the `--confirm` gate. With the default `confirmTools: false` there is no gate to skip, so this key changes nothing - the mode is honest about that in its waiver, its banner and `/redteam status`. |
|
|
3615
3741
|
| `redteam.banner` | `true` | Push the three-row banner into the transcript when the mode arms. The status chip and the composer border are unaffected. |
|
|
3616
3742
|
| `redteam.askEveryArm` | `false` | Re-show the waiver on every arm, ignoring the remembered version. For a cautious operator; the default remembers the accepted version. |
|
|
3743
|
+
| `redteam.profile` | `builtin` | Which prompt profile supplies the **policy half** of the `<redteam_mode>` block (execution style, rules, method, routing, deliverable, house rules). `builtin` reads no file at all; a slug reads `<home>/redteam/profiles/<slug>.md`; a value containing a separator, a drive letter or a `.md` suffix is a path to your own file and is used **verbatim** (case preserved). The fact half - authorization, what the mode changes, the closing boundary - is code and cannot be replaced. `--redteam-prompt <path>` overrides this key for one session. See [Prompt profiles](#prompt-profiles). |
|
|
3617
3744
|
| `team.enabled` | `true` | Master switch for team subagents. `false` means the `task` tool is never registered. Written by the `Team mode` row in `Settings > Team` and nowhere else — `/team` never saves configuration. In a session already started with `--no-team` the row reads `on (next launch)`, rather than advertising a tool that is not there. |
|
|
3618
3745
|
| `team.maxSubagents` | `8` | Subagents per dispatch, clamped to `[1, 10]`. 8 is the default; 10 is the hard ceiling and is enforced twice — on the config value and again on what the model asks for — so hand-editing this file cannot raise it. A persisted `5`/`3` pair from an older install is migrated to `8`/`8` once (`fanoutMigrated` records that it happened, so moving back to 5/3 sticks). |
|
|
3619
3746
|
| `team.maxConcurrent` | `8` | Subagents in flight at once, clamped to `[1, 10]` and capped at `maxSubagents`. A separate knob because provider rate limits are a different constraint from context economics: lower this one if you collect 429s. |
|
|
@@ -3762,6 +3889,35 @@ it reaches the prompt (control characters dropped, folded to one line, `<` / `>`
|
|
|
3762
3889
|
characters max, refused rather than truncated) and the prompt is explicit that **it is a promise,
|
|
3763
3890
|
not a control**: nothing in this tool enforces it.
|
|
3764
3891
|
|
|
3892
|
+
**Prompt profiles.** The block has two halves. The **fact half** - the authorization line, `What this mode changes` and the closing boundary sentence - is owned by the code and cannot be replaced: a profile that tries is warned and ignored, because a file must never be able to make the mode stop stating what this session actually loosened. The **policy half** is yours: `role`, `execution`, `rules of engagement`, `method`, `routing`, `deliverable` and `house rules` come from a Markdown profile, one file per profile, at `~/.aragon-agent/redteam/profiles/<slug>.md`.
|
|
3893
|
+
|
|
3894
|
+
```markdown
|
|
3895
|
+
---
|
|
3896
|
+
schema: 1
|
|
3897
|
+
name: finance-engagement
|
|
3898
|
+
title: Finance sector web assessment
|
|
3899
|
+
extends: builtin
|
|
3900
|
+
mode: merge
|
|
3901
|
+
---
|
|
3902
|
+
|
|
3903
|
+
## Method
|
|
3904
|
+
|
|
3905
|
+
- Read the infrastructure manifests before the application code: they name the boundary.
|
|
3906
|
+
```
|
|
3907
|
+
|
|
3908
|
+
One profile, one file, seven possible sections. A section you do not write keeps the built-in text (`mode: merge`), so a profile that changes one paragraph is one paragraph; `mode: replace` drops everything you did not write. `extends: <slug>` starts from another profile instead of the built-in text (three levels deep, cycles refused). Headings are matched leniently: `## Rules of engagement` and `## rules_of_engagement` are the same section.
|
|
3909
|
+
|
|
3910
|
+
```
|
|
3911
|
+
/redteam prompt init finance-engagement # write a scaffold, never over an existing file
|
|
3912
|
+
/redteam prompt validate finance-engagement # parse and report; applies nothing
|
|
3913
|
+
/redteam prompt finance-engagement # persist redteam.profile and switch this session
|
|
3914
|
+
/redteam prompt ./engagements/acme.md # this session only; does not touch config
|
|
3915
|
+
/redteam prompt reload # purge the read cache, report whether the block changed
|
|
3916
|
+
/redteam prompt builtin # back to the code default, in this session and in the config
|
|
3917
|
+
```
|
|
3918
|
+
|
|
3919
|
+
`aragon --redteam-prompt ./acme.md --redteam` does the same for one launch. A profile that is missing, too large (32 KiB), headerless, cyclic or over-long **never stops the mode from arming**: it falls back to the built-in text and says why, once, in the transcript, with the rest of your file still applied. Reloading is automatic - the read is keyed on the file's `mtime` and size, so the next turn uses the edit, and `reload` is only for when you want to know whether the block actually changed. A profile body may be written in any language; only the built-in defaults are English. Bodies cannot break the `<redteam_mode>` fence: a literal `</redteam_mode>` inside your prose is neutralized before the prompt is assembled.
|
|
3920
|
+
|
|
3765
3921
|
**Subagents inherit it.** A dispatched child gets its own trimmed `<redteam_mode>` block and the
|
|
3766
3922
|
same bypass predicate, passed down explicitly (its confirmation closure is its own, so nothing
|
|
3767
3923
|
inherits automatically). Leaving is one keystroke: `Ctrl+R` again, or `/redteam off`.
|
|
@@ -26,10 +26,14 @@ import type { ToolHookRunner } from '../exec/hooks/tool-wrapper.js';
|
|
|
26
26
|
import type { ToolPermission } from '../exec/permission.js';
|
|
27
27
|
import { type ToolOutputListener } from '@aragon-agent/tui/model/tools/tool-output-store';
|
|
28
28
|
import type { FilePatch } from '@aragon-agent/tui/model/tools/patch';
|
|
29
|
+
import { TeamRuntime } from '../team/runtime.js';
|
|
30
|
+
import type { ReportOptions } from '../team/report.js';
|
|
31
|
+
import type { DispatchHandle, DispatchInspection } from '../team/runtime.js';
|
|
32
|
+
import type { TeamControlRequest } from '../team/console-view.js';
|
|
29
33
|
import type { SubagentModelResolution } from '@aragon-agent/tui/model/team/model';
|
|
30
34
|
import { type ForcedTeamState } from '../team/forced-mode.js';
|
|
31
35
|
import type { RedTeamOutcome, RedTeamRequest } from '@aragon-agent/tui/model/redteam/redteam-mode';
|
|
32
|
-
import type { RedTeamView } from '@aragon-agent/tui/model/redteam/types';
|
|
36
|
+
import type { RedTeamPromptView, RedTeamView } from '@aragon-agent/tui/model/redteam/types';
|
|
33
37
|
import { MemoryService } from '../memory/service.js';
|
|
34
38
|
import type { MemorySessionView } from '@aragon-agent/tui/model/memory/types';
|
|
35
39
|
import type { MemoryConfig } from '@aragon-agent/tui/model/config/schema';
|
|
@@ -182,6 +186,17 @@ export interface ControllerDeps {
|
|
|
182
186
|
* prompts and tools byte-identical (I-1).
|
|
183
187
|
*/
|
|
184
188
|
redTeamArmed?: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* `--redteam-prompt <path>`: this session's prompt profile, overriding the config
|
|
191
|
+
* (redteam-prompt-profile S-12 / AC-22).
|
|
192
|
+
*
|
|
193
|
+
* IT IS NOT ROUTED THROUGH `validateRedTeamLaunch`. That function's `decision` is discarded
|
|
194
|
+
* at its only call site, so a field added there would be a dead switch; the flag travels the
|
|
195
|
+
* same way `--redteam` does - a `toFlags` line, a `makeController` argument, and this field.
|
|
196
|
+
* A path that cannot be read is a warning plus a fallback to `builtin`, never a refusal to
|
|
197
|
+
* start: a broken convenience file must not be able to disable a security posture.
|
|
198
|
+
*/
|
|
199
|
+
redTeamPromptPath?: string;
|
|
185
200
|
/**
|
|
186
201
|
* `submit_result`, registered with the lead's toolset when the caller supplied
|
|
187
202
|
* `--result-schema` (headless-request-scope-and-typed-result section 2.3.9).
|
|
@@ -477,6 +492,25 @@ export declare class AgentController {
|
|
|
477
492
|
private jobMirror;
|
|
478
493
|
/** The relay: terminal events in, ledger across `steering_accepted`, safe-point push. */
|
|
479
494
|
private jobRelay;
|
|
495
|
+
/**
|
|
496
|
+
* The team notice queue and its relay (team-detached-dispatch section 5.3).
|
|
497
|
+
*
|
|
498
|
+
* BUILT ALWAYS, even when team mode was off at construction: the relay is inert
|
|
499
|
+
* without events, and a conditionally-constructed one would make `flushForTurn`,
|
|
500
|
+
* `tryPush` and `requeueUndelivered` three more places that need a guard.
|
|
501
|
+
*/
|
|
502
|
+
private readonly teamNotices;
|
|
503
|
+
private teamRelay;
|
|
504
|
+
/**
|
|
505
|
+
* The monotonic turn counter behind `I-DD11`.
|
|
506
|
+
*
|
|
507
|
+
* ONE PER `prompt()` / `continue()`, read by the runtime when a dispatch starts
|
|
508
|
+
* (`DispatchSession.turnId`) and compared by `stopEngine()`. A dispatch that
|
|
509
|
+
* outlives its turn is then distinguishable from one started by the turn the
|
|
510
|
+
* user is stopping - which is the whole difference between "Esc stops what I am
|
|
511
|
+
* doing" and "Esc silently killed a two-hour team".
|
|
512
|
+
*/
|
|
513
|
+
private turnId;
|
|
480
514
|
/** `cfg.jobs.enabled` AND `cfg.bash.background`, fixed at construction. */
|
|
481
515
|
private jobsRegistered;
|
|
482
516
|
/**
|
|
@@ -995,6 +1029,25 @@ export declare class AgentController {
|
|
|
995
1029
|
} | undefined): string | null;
|
|
996
1030
|
/** The posture changed (`Shift+Tab`, `/gov`): `paused` may have, so repaint. */
|
|
997
1031
|
noteRedTeamPosture(): void;
|
|
1032
|
+
/** What `/redteam prompt` reports. `builtin` when the session has no resolver. */
|
|
1033
|
+
getRedTeamPromptView(): RedTeamPromptView;
|
|
1034
|
+
/** Switch this session's profile; the command persists `redteam.profile` separately. */
|
|
1035
|
+
setRedTeamPromptProfile(profile: string): {
|
|
1036
|
+
ok: boolean;
|
|
1037
|
+
resolved: string;
|
|
1038
|
+
};
|
|
1039
|
+
/** The session-level override; `null` clears it, which is what `builtin` needs (AC-22). */
|
|
1040
|
+
setRedTeamPromptPath(path: string | null): void;
|
|
1041
|
+
/** Purge the read cache and report whether the block changed. */
|
|
1042
|
+
reloadRedTeamPrompt(): {
|
|
1043
|
+
changed: boolean;
|
|
1044
|
+
};
|
|
1045
|
+
/** Write the starter profile through the store; the ONLY write in the feature. */
|
|
1046
|
+
writeRedTeamPromptScaffold(slug?: string): {
|
|
1047
|
+
ok: boolean;
|
|
1048
|
+
path?: string;
|
|
1049
|
+
reason?: string;
|
|
1050
|
+
};
|
|
998
1051
|
/**
|
|
999
1052
|
* One log record per mode event, and NONE of them carries a command, a target or a secret:
|
|
1000
1053
|
* `scope_set` records a length, `confirm_bypass` records a tool name (D-9 / R-12).
|
|
@@ -1060,6 +1113,64 @@ export declare class AgentController {
|
|
|
1060
1113
|
* model` row all rewrite the inputs mid-session.
|
|
1061
1114
|
*/
|
|
1062
1115
|
subagentModelResolution(): SubagentModelResolution;
|
|
1116
|
+
/**
|
|
1117
|
+
* The report's price and model closures, in ONE object.
|
|
1118
|
+
*
|
|
1119
|
+
* THE SINGLE AUTHOR OF A REPORT'S NUMBERS (spec REV-05). Both `createTaskTool`
|
|
1120
|
+
* (await mode) and `TeamRuntime` (detach mode, at settlement) call this, so a
|
|
1121
|
+
* dispatch is priced by the same table whichever path produced it - and the
|
|
1122
|
+
* `pricing unknown` rule (C-11 / RV-4) holds in both.
|
|
1123
|
+
*/
|
|
1124
|
+
teamReportOptions(): ReportOptions;
|
|
1125
|
+
/** The live dispatch view, or `null`. */
|
|
1126
|
+
readTeamControl(): {
|
|
1127
|
+
inspection: DispatchInspection | null;
|
|
1128
|
+
live: DispatchHandle | null;
|
|
1129
|
+
};
|
|
1130
|
+
/** Pause / resume / stop / spawn / message, from the user or the lead. */
|
|
1131
|
+
sendTeamControl(request: TeamControlRequest, by?: 'lead' | 'user'): {
|
|
1132
|
+
ok: boolean;
|
|
1133
|
+
detail: string;
|
|
1134
|
+
};
|
|
1135
|
+
/**
|
|
1136
|
+
* Stop the whole team (the `/team stop all` and Esc-ladder entry point).
|
|
1137
|
+
*
|
|
1138
|
+
* THE ONE PATH A NON-OWNER HAS. `stopEngine()` no longer calls `abortAll()`
|
|
1139
|
+
* unconditionally, so this is how a user ends a dispatch that an EARLIER turn
|
|
1140
|
+
* started.
|
|
1141
|
+
*/
|
|
1142
|
+
stopTeam(by: 'lead' | 'user', reason?: string): {
|
|
1143
|
+
stopped: string[];
|
|
1144
|
+
live: string[];
|
|
1145
|
+
};
|
|
1146
|
+
/** The turn id a dispatch started now would record (`I-DD11`). */
|
|
1147
|
+
currentTurnId(): number;
|
|
1148
|
+
/** Whether a dispatch is live AND was started by an earlier turn. */
|
|
1149
|
+
teamOutlivesTurn(): boolean;
|
|
1150
|
+
/**
|
|
1151
|
+
* The settle facts for the live-or-last dispatch, for the follow-up decision.
|
|
1152
|
+
*
|
|
1153
|
+
* THE ID TRAVELS WITH THE FACTS. The host spends the continuation with
|
|
1154
|
+
* `markTeamContinued()`, and the facts are by definition read AFTER settlement,
|
|
1155
|
+
* when `TeamRuntime.live()` already answers `null` - so an id re-derived from
|
|
1156
|
+
* `live()` was always null, `session.continued` was never set, and every later
|
|
1157
|
+
* `agent_end` earned the same follow-up turn: an unbounded model loop that
|
|
1158
|
+
* never lets the user type.
|
|
1159
|
+
*/
|
|
1160
|
+
teamSettleFacts(): (NonNullable<ReturnType<TeamRuntime['settleFacts']>> & {
|
|
1161
|
+
dispatchId: string;
|
|
1162
|
+
}) | null;
|
|
1163
|
+
/** Spend the one follow-up turn of the current dispatch (at most one). */
|
|
1164
|
+
markTeamContinued(dispatchId: string): void;
|
|
1165
|
+
/**
|
|
1166
|
+
* Turn one runtime event into a notice (section 5.3.1).
|
|
1167
|
+
*
|
|
1168
|
+
* DERIVED HERE, ONCE, rather than by each UI: the panel, the card and the notice
|
|
1169
|
+
* queue must agree about what happened, and the only way to guarantee that is for
|
|
1170
|
+
* all three to read the same event. The queue adds nothing but the "exactly once"
|
|
1171
|
+
* bookkeeping.
|
|
1172
|
+
*/
|
|
1173
|
+
private onTeamEvent;
|
|
1063
1174
|
/** Refused mid-dispatch by `/team`; half a dispatch under two ceilings is not
|
|
1064
1175
|
* a result anything can afterwards explain (the reasoning `/reload` uses). */
|
|
1065
1176
|
isTeamBusy(): boolean;
|