@aragon-agent/cli 0.6.77 → 0.6.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +89 -21
- package/dist/agent/controller.d.ts +36 -0
- package/dist/agent/controller.js +108 -0
- package/dist/agent/system-prompt.d.ts +10 -0
- package/dist/agent/system-prompt.js +6 -0
- package/dist/app/App.js +108 -27
- package/dist/app/index-console.d.ts +59 -0
- package/dist/app/index-console.js +99 -0
- package/dist/cli.js +80 -4
- package/dist/commands/builtins.js +4 -2
- package/dist/commands/catalog.js +7 -1
- package/dist/commands/index-build.js +10 -1
- package/dist/commands/index-command.d.ts +43 -0
- package/dist/commands/index-command.js +244 -0
- package/dist/commands/index-copy.d.ts +50 -0
- package/dist/commands/index-copy.js +82 -0
- package/dist/commands/kit-command.d.ts +10 -0
- package/dist/commands/kit-command.js +8 -2
- package/dist/commands/kits-command.d.ts +35 -0
- package/dist/commands/kits-command.js +137 -0
- package/dist/commands/registry.d.ts +10 -0
- package/dist/compaction/memory-agent.js +61 -0
- package/dist/config/env.d.ts +30 -0
- package/dist/config/env.js +47 -0
- package/dist/config/launch-notice.d.ts +61 -0
- package/dist/config/launch-notice.js +138 -0
- package/dist/config/load.d.ts +20 -0
- package/dist/config/load.js +72 -2
- package/dist/diagnostics/info.d.ts +28 -0
- package/dist/diagnostics/info.js +41 -0
- package/dist/exec/cli-commands.d.ts +24 -0
- package/dist/exec/cli-commands.js +48 -1
- package/dist/exec/index.js +9 -0
- package/dist/exec/options.d.ts +12 -0
- package/dist/host/index-build.d.ts +38 -7
- package/dist/host/index-build.js +74 -20
- package/dist/indexer/commit.d.ts +77 -0
- package/dist/indexer/commit.js +145 -0
- package/dist/indexer/discover.d.ts +50 -0
- package/dist/indexer/discover.js +147 -0
- package/dist/indexer/engine.d.ts +51 -0
- package/dist/indexer/engine.js +477 -0
- package/dist/indexer/errors.d.ts +62 -0
- package/dist/indexer/errors.js +86 -0
- package/dist/indexer/finalize.d.ts +30 -0
- package/dist/indexer/finalize.js +19 -0
- package/dist/indexer/fingerprint.d.ts +41 -0
- package/dist/indexer/fingerprint.js +49 -0
- package/dist/indexer/ignore.d.ts +59 -0
- package/dist/indexer/ignore.js +140 -0
- package/dist/indexer/index.d.ts +21 -0
- package/dist/indexer/index.js +21 -0
- package/dist/indexer/l0.d.ts +55 -0
- package/dist/indexer/l0.js +168 -0
- package/dist/indexer/limits.d.ts +75 -0
- package/dist/indexer/limits.js +106 -0
- package/dist/indexer/link.d.ts +68 -0
- package/dist/indexer/link.js +220 -0
- package/dist/indexer/lock.d.ts +115 -0
- package/dist/indexer/lock.js +270 -0
- package/dist/indexer/parse.d.ts +68 -0
- package/dist/indexer/parse.js +163 -0
- package/dist/indexer/paths.d.ts +99 -0
- package/dist/indexer/paths.js +198 -0
- package/dist/indexer/plan.d.ts +48 -0
- package/dist/indexer/plan.js +80 -0
- package/dist/indexer/rank.d.ts +42 -0
- package/dist/indexer/rank.js +125 -0
- package/dist/indexer/read/cache.d.ts +28 -0
- package/dist/indexer/read/cache.js +54 -0
- package/dist/indexer/read/query.d.ts +48 -0
- package/dist/indexer/read/query.js +361 -0
- package/dist/indexer/scanner/extract.d.ts +36 -0
- package/dist/indexer/scanner/extract.js +134 -0
- package/dist/indexer/scanner/mask.d.ts +44 -0
- package/dist/indexer/scanner/mask.js +198 -0
- package/dist/indexer/scanner/py-extract.d.ts +29 -0
- package/dist/indexer/scanner/py-extract.js +164 -0
- package/dist/indexer/scanner/refs.d.ts +31 -0
- package/dist/indexer/scanner/refs.js +116 -0
- package/dist/indexer/scanner/ts-extract.d.ts +39 -0
- package/dist/indexer/scanner/ts-extract.js +277 -0
- package/dist/indexer/store.d.ts +88 -0
- package/dist/indexer/store.js +309 -0
- package/dist/indexer/tools.d.ts +120 -0
- package/dist/indexer/tools.js +132 -0
- package/dist/indexer/types.d.ts +225 -0
- package/dist/indexer/types.js +44 -0
- package/dist/indexer/wiring.d.ts +45 -0
- package/dist/indexer/wiring.js +42 -0
- package/dist/tools/index.d.ts +16 -2
- package/dist/tools/index.js +23 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -771,7 +771,7 @@ below works there too, in either position — `aragon --model m exec "…"` and
|
|
|
771
771
|
| `--confirm` | Confirm each mutating tool call |
|
|
772
772
|
| `--tool-timeout <ms>` | Per-tool executor ceiling (default 180000) |
|
|
773
773
|
| `--idle-timeout <ms>` | Watchdog idle timeout (auto-raised to ≥ tool-timeout + 30s) |
|
|
774
|
-
| `--theme <name>` | `auto\|warm\|
|
|
774
|
+
| `--theme <name>` | `auto\|cool\|graphite\|oat\|warm\|light` (`dark` is a compatibility alias for `cool`) |
|
|
775
775
|
| `--compact` / `--no-compact` | Transcript density: no blank rows between turns, or the default |
|
|
776
776
|
| `--hints` / `--no-hints` | Show or hide the composer hint row |
|
|
777
777
|
| `--show-thinking` / `--no-show-thinking` | Draw the model's reasoning blocks in the transcript. Off by default — see [What you see while it runs](#what-you-see-while-it-runs) |
|
|
@@ -788,6 +788,11 @@ below works there too, in either position — `aragon --model m exec "…"` and
|
|
|
788
788
|
| `--retry` / `--no-retry` | Retry a failed provider call with backoff (the default), or fail on the first error |
|
|
789
789
|
| `--retry-max <n>` | Retries after the first attempt for this run, clamped to `[0, 20]`. `0` turns retry off |
|
|
790
790
|
| `--fast` / `--no-fast` | Enable or disable the fast model tier. Off by default; see **Fast model tier** |
|
|
791
|
+
| `--kit <name\|#id\|id>` / `--no-kit` | Run this session on that kit (dev pack), binding main, fast and subagent at once; or ignore the saved default kit. Never written to `config.json` |
|
|
792
|
+
| `--profile <name\|#id\|id>` | Main slot: use one saved connection |
|
|
793
|
+
| `--fast-profile <name\|#id\|id>` | Fast slot: use one saved connection |
|
|
794
|
+
| `--subagent-model <main\|fast\|profile>` | How the subagent slot picks a model |
|
|
795
|
+
| `--subagent-profile <name\|#id\|id>` | The connection `profile` mode binds to |
|
|
791
796
|
| `--fast-model <id>` | The fast model id. Implies nothing about `--fast` on its own |
|
|
792
797
|
| `--fast-provider <id>` | Provider for the fast model. Absent inherits the main provider |
|
|
793
798
|
| `--fast-review <n\|off>` | Turns between automatic fast reviews, or `off` |
|
|
@@ -800,8 +805,29 @@ below works there too, in either position — `aragon --model m exec "…"` and
|
|
|
800
805
|
| `--render-governor` / `--no-render-governor` | Adapt the frame interval under load, or pin it at 33 ms |
|
|
801
806
|
| `--max-render-interval <ms>` | Governor ceiling, clamped to `[33, 1000]`. `33` flattens the ladder |
|
|
802
807
|
| `--no-color` | Disable ANSI color |
|
|
803
|
-
| `--quiet` |
|
|
808
|
+
| `--quiet` | Suppress non-essential stderr notices (tool lines, launch notice) |
|
|
804
809
|
|
|
810
|
+
#### Which model wins: the launch-selection ladder
|
|
811
|
+
|
|
812
|
+
`--kit` is a *package* (main, fast and subagent together), while `--model` and
|
|
813
|
+
`--profile` are single slots. They are therefore layered per slot, not per command line:
|
|
814
|
+
|
|
815
|
+
| Slot | High -> low |
|
|
816
|
+
| --- | --- |
|
|
817
|
+
| the package itself | `--no-kit` > `--kit` > `ARAGON_KIT` > `defaultKitId` in `config.json` > none |
|
|
818
|
+
| main | `--model` / `--provider` / `--base-url` > `--profile` > `ARAGON_MODEL` / `ARAGON_PROVIDER` / `ARAGON_PROFILE` > the kit's main > the file binding > default |
|
|
819
|
+
| fast | `--fast-model` / `--fast-provider` > `--fast-profile` > `ARAGON_FAST_*` > the kit's fast > `file.fast` > default |
|
|
820
|
+
| subagent | `--subagent-model` + `--subagent-profile` > `ARAGON_SUBAGENT_*` > the kit's subagent > `file.team` > default |
|
|
821
|
+
|
|
822
|
+
So `aragon --kit cheap --model claude-opus-4-6` means "use cheap, but the main model is
|
|
823
|
+
mine": the kit still supplies fast and subagent, and `/kit` reports the result as
|
|
824
|
+
`holds fast+subagent` rather than pretending all three slots moved. A flag decides the
|
|
825
|
+
package over an environment variable, and a single-slot flag outranks the package.
|
|
826
|
+
|
|
827
|
+
Two more rules, because they are what keeps this safe: a **misspelt environment value
|
|
828
|
+
only warns** and falls through to the next layer (a typo must never stop a launch),
|
|
829
|
+
while a **misspelt flag is a usage error** - one line on stderr, exit `2`, empty stdout.
|
|
830
|
+
And **nothing here is written to `config.json`**: `--kit` is this run only.
|
|
805
831
|
Exit codes: `0` success · `1` agent/runtime error · `2` config/usage error ·
|
|
806
832
|
`3` stopped by a caller-set budget (`aragon exec` only) · `128 + signo` when a
|
|
807
833
|
signal ends the run (`130` SIGINT, `143` SIGTERM, `129` SIGHUP).
|
|
@@ -970,7 +996,8 @@ ignores them rather than rejecting the library):
|
|
|
970
996
|
| `/prompts [manage\|list\|show <n\|title>\|add [title :: body]\|edit <n\|title>\|rm <n\|title> [--yes]\|move <n\|title> <to>\|favorite <n\|title>\|sort name\|recent\|favorite]` | Quick prompt library: `/prompts` opens the picker (Enter fills the draft, `Ctrl+Enter` fills and sends), `add`/`edit` open the editor. `<n\|title>` accepts a 1-based index, an exact title, or a unique title prefix; a repeated title is refused **with its candidates** rather than guessed |
|
|
971
997
|
| `/memory [list [words]\|show <ref>\|save [--global] <text>\|add [text]\|rm <ref>\|restore [ref]\|mount\|unmount\|reset <ref>\|auto on\|off\|reset\|agent ask\|auto\|reset\|undo [n\|batch]\|activity [n]\|path\|help]` (alias `/mem`) | Memory: `/memory` opens the manager. `<ref>` is a number from `list`, an id, an exact title or a unique id prefix; an ambiguous one is refused **with its candidates**. `list` never prints a note body. `rm` moves to a 30-day trash and `restore` undoes it. `undo [n\|batch]` takes back a whole batch the agent wrote, and `activity [n]` lists what changed recently (the same list as the manager's `t` page) |
|
|
972
998
|
| `/kit [list\|use <name\|current>]` | Agent kits: what is in effect and where it came from, the whole library with each preset's three connections, or apply one for **this session**. `/kit use current` releases it. Never writes the config file |
|
|
973
|
-
| `/
|
|
999
|
+
| `/index [status\|rebuild\|clean\|open [ast]\|on\|off\|confirm on\|off]` | Project index: `/index` opens the console (the same panel `Ctrl+I` opens), `status` prints the generation, counts, resolution rate and staleness, `rebuild` asks once and rebuilds, `clean` deletes every generated generation (the prose files are kept) after a second `yes`, `open [ast]` hands the prose index or the artifact directory to your default program, `on`/`off` is the master switch, `confirm on\|off` is the ask-before-writing gate |
|
|
1000
|
+
| `/theme <auto\|cool\|graphite\|oat\|warm\|light>` | Switch the color theme live (persisted) |
|
|
974
1001
|
| `/expand [n]` | Expand / collapse the n-th-from-last (default last) tool card |
|
|
975
1002
|
| `/copy` | Copy the last answer to the clipboard |
|
|
976
1003
|
| `/perf` | What the renderer is doing: frame interval, mounted entries, dropped entries, cache occupancy. `/perf reset` clears the caches and the governor |
|
|
@@ -999,7 +1026,7 @@ completes, `Up` / `Down` moves the selection, `Esc` closes it.
|
|
|
999
1026
|
| `Ctrl+M` / `Alt+M` | **Memory manager**: save, edit, search and mount the notes AragonAgent remembers across sessions. `Ctrl+M` is the same byte as `Enter` on a terminal without keyboard enhancement (Windows Terminal, kitty, iTerm2 and WezTerm have it), where it still submits the draft exactly as before - use `Alt+M` or `/memory` there. `t` in the manager opens the activity page (what changed recently, one line each) and `u` on a row undoes that batch after a `y` - the same `/memory activity` / `/memory undo`. See [Memory](#memory) |
|
|
1000
1027
|
| `Ctrl+X` / `Alt+X` | **Account panel**: who you are signed in as, the credential's expiry, and the three things you can do about it - `Enter` signs in or renews, `x` signs out (twice: the first press only arms it), `r` re-reads the file after a sign-in done in another terminal. `Alt+X` works where the terminal swallows `Ctrl+X`; `/account` always works. While you are signed in, the header shows the same identity as `● ada` immediately left of `^G more` (green = usable, amber = three days or fewer left, hollow red `○` = expired), and signed out it shows nothing at all. See [Signed-in identity and the account panel](#signed-in-identity-and-the-account-panel). `Ctrl+Y` is deliberately NOT this key: on a terminal `Ctrl+Y` arrives as a plain `y`, and three surfaces in this app read a plain `y` |
|
|
1001
1028
|
| `Ctrl+B` | **Agents board**: the details of a running dispatch. Left column lists every child (not just the five the roster fits), the right-hand sections show the selected child's state, turns, tools, tokens, files, mail, supervisor actions, retries, compaction, its current activity, its final answer or error, and the last 24 events. `Up` / `Down` change the child, `PgUp` / `PgDn` and the wheel page, `Esc` closes. The board survives the end of the dispatch - it freezes the last live snapshot and marks it `dispatch ended` - and opens after the fact from the session's own team card, where everything except the live-only sections (current activity, mail count, timeline) is still readable. Pressing `Ctrl+B` again, or `/agents`, opens and closes it |
|
|
1002
|
-
| `Ctrl+I` | **Build the project index
|
|
1029
|
+
| `Ctrl+I` / `Alt+I` | **Build the project index**: a deterministic AST index (no model, seconds), then optionally the bundled `project-indexer` skill. Asks for confirmation, then writes `<root>/.claude-index/ast/` (generations + a `current` pointer) and the prose index. `Alt+I` is the twin for terminals without keyboard enhancement, where `Ctrl+I` is still the Tab byte; `/index` always works. See [Project index](#project-index---ctrl-i) |
|
|
1003
1030
|
| `Ctrl+K` | **Agent kits**: pick a model preset — main / subagent / fast profile in one choice — for **this session only**. Nothing is written to the config file. `Current setup` (the first row) releases the preset and returns to the file's bindings. See [Agent kits](#agent-kits) |
|
|
1004
1031
|
| `Esc` | Close an overlay or popup; otherwise ask for interruption confirmation. While idle, cancel pending auto-continuation |
|
|
1005
1032
|
| `Esc` ×2 | Interrupt the run when pressed within 1.5 seconds. Other keys or closing a menu cancel the first press |
|
|
@@ -1425,13 +1452,16 @@ Agent 运行中发送的消息会进入队列。输入框附近的独立 Queue
|
|
|
1425
1452
|
|
|
1426
1453
|
## Themes
|
|
1427
1454
|
|
|
1428
|
-
|
|
1455
|
+
Six palettes plus `auto`:
|
|
1429
1456
|
|
|
1430
1457
|
| Name | Look |
|
|
1431
1458
|
| --- | --- |
|
|
1432
|
-
| `
|
|
1433
|
-
| `
|
|
1459
|
+
| `cool` | **The default** (`auto` resolves here). Slate background, blue primary. |
|
|
1460
|
+
| `graphite` | Near-black greys and one brand green: colour only for the primary action and the focus ring. |
|
|
1461
|
+
| `oat` | Warm paper with terracotta ink. The second light-surface palette. |
|
|
1462
|
+
| `warm` | Terracotta + amber over warm neutrals. The default through 0.4.x. |
|
|
1434
1463
|
| `light` | For light terminal backgrounds. |
|
|
1464
|
+
| `auto` | Never guesses `light` — it resolves to `cool`. |
|
|
1435
1465
|
|
|
1436
1466
|
`auto` never guesses `light`: terminals cannot report their background reliably,
|
|
1437
1467
|
and guessing wrong makes the app unreadable rather than merely wrong-looking.
|
|
@@ -3366,17 +3396,55 @@ exported symbols) and synchronizes the full contents of `CLAUDE.md` and
|
|
|
3366
3396
|
`AGENTS.md`. Both contain project navigation, optional Google-style **Clean Code
|
|
3367
3397
|
Guidelines**, and required **Workspace Artifact Hygiene** rules.
|
|
3368
3398
|
|
|
3369
|
-
`Ctrl+I` is its dedicated
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3399
|
+
`Ctrl+I` (or `Alt+I`, or `/index`) is its dedicated entry point, and it runs
|
|
3400
|
+
**two independent stages**:
|
|
3401
|
+
|
|
3402
|
+
**Stage A - the deterministic AST index.** No model, no key, no network: a
|
|
3403
|
+
six-stage pipeline (DISCOVER, PLAN, PARSE, COMMIT, LINK, FINALIZE) over a
|
|
3404
|
+
character-level scanner writes `<root>/.claude-index/ast/generations/<n>/`
|
|
3405
|
+
(symbols, references, imports and a file graph as JSONL) plus a `current`
|
|
3406
|
+
pointer. The pointer is the LAST write and it moves by rename, so a failed,
|
|
3407
|
+
cancelled or killed build leaves the previous index complete - there is no
|
|
3408
|
+
half-built state to recover from. Rebuilds are incremental: only files whose
|
|
3409
|
+
content hash changed are re-parsed. This stage needs no credentials, so it works
|
|
3410
|
+
in CI, offline, and when the model quota is exhausted.
|
|
3411
|
+
|
|
3412
|
+
**Stage B - the prose index.** The bundled `project-indexer` skill, unchanged:
|
|
3413
|
+
`.claude-index/index.md`, `.claude-index/config.md`, and the managed sections of
|
|
3414
|
+
`CLAUDE.md` / `AGENTS.md`. It needs a model, and the console offers to skip it.
|
|
3415
|
+
|
|
3416
|
+
An index is only useful to the model if it can read it, so stage A also feeds
|
|
3417
|
+
two things: a compact, deterministic `<!-- aragon-index:start -->` block in the
|
|
3418
|
+
system prompt (stable per generation, so the provider's prefix cache survives),
|
|
3419
|
+
and a read-only `code_query` tool (`map` / `outline` / `find` / `symbol` /
|
|
3420
|
+
`refs` / `impact`). Prefer it over `grep` when you need structure rather than
|
|
3421
|
+
text.
|
|
3422
|
+
|
|
3423
|
+
`.claude-index/index.md` and `config.md` are documentation and belong in version
|
|
3424
|
+
control. `.claude-index/ast/` is a machine artifact that `Ctrl+I` reproduces in
|
|
3425
|
+
seconds, so the generated `.gitignore` advice - and this package's own - is to
|
|
3426
|
+
ignore it:
|
|
3427
|
+
|
|
3428
|
+
```gitignore
|
|
3429
|
+
.claude-index/ast/
|
|
3430
|
+
```
|
|
3431
|
+
|
|
3432
|
+
The flow is deliberately boring:
|
|
3433
|
+
|
|
3434
|
+
1. A **confirm** opens (what will be written is spelled out - the dialog names
|
|
3435
|
+
`.claude-index/ast/generations/<n>/`, the `current` pointer, `.claude-index/index.md`,
|
|
3436
|
+
`.claude-index/config.md`, `CLAUDE.md` and `AGENTS.md` before anything happens,
|
|
3437
|
+
and promises that a failed or cancelled build leaves the previous index untouched).
|
|
3438
|
+
2. Approving starts **stage A** in place, with a live panel (six stages, counts,
|
|
3439
|
+
the current file, an ETA, and `Esc` to cancel). If stage A succeeds and the
|
|
3440
|
+
prose stage was chosen, **stage B** then dispatches `/skill:project-indexer`
|
|
3441
|
+
through the ordinary command path, so that run is a normal agent turn: every
|
|
3442
|
+
`glob` / `read_file` / `write_file` streams into the transcript as a tool
|
|
3443
|
+
card, and the follow-up configuration questions (exclusions, priority
|
|
3444
|
+
directories, clean-code preset) arrive through the same `ask_user` overlay
|
|
3445
|
+
any other turn uses. `Esc` during stage A cancels and says the index was not
|
|
3446
|
+
changed; `Esc` while another process owns the build only closes the panel and
|
|
3447
|
+
names that process.
|
|
3380
3448
|
3. The header names the key: `^I Index` collapsed, `^I build index` once
|
|
3381
3449
|
`Ctrl+G` expands the detail row.
|
|
3382
3450
|
|
|
@@ -4425,9 +4493,9 @@ quiet output is required.
|
|
|
4425
4493
|
|
|
4426
4494
|
### Theming & color
|
|
4427
4495
|
|
|
4428
|
-
`--theme` / `config.theme` / `/theme` pick a palette: `
|
|
4429
|
-
`auto` (which resolves to `
|
|
4430
|
-
background). `dark` remains
|
|
4496
|
+
`--theme` / `config.theme` / `/theme` pick a palette: `cool` (default), `graphite`,
|
|
4497
|
+
`oat`, `warm`, `light`, or `auto` (which resolves to `cool` — terminals can't
|
|
4498
|
+
reliably report their background). `dark` remains an alias for `cool`.
|
|
4431
4499
|
Interactive sessions always use Unicode borders, icons and scrollbars, with
|
|
4432
4500
|
truecolor and gradients by default. Missing terminal/locale markers, `TERM=dumb`,
|
|
4433
4501
|
and low `FORCE_COLOR` levels do not simplify the TUI. `--no-color`, `NO_COLOR`
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ModelSettingsSnapshot } from './model-profile-settings.js';
|
|
2
|
+
import { type IndexConfig } from '@aragon-agent/tui/model/index-build/config';
|
|
2
3
|
import { type ActiveKit } from '@aragon-agent/tui/model/config/kit-resolution';
|
|
3
4
|
import type { KitApplyResult } from '@aragon-agent/tui/model/config/model-kits';
|
|
4
5
|
import type { ModelSettingsDraft, ModelSettingsPatch, ModelSettingsSaveResult } from '../config/model-profile-store.js';
|
|
@@ -353,6 +354,15 @@ export declare class AgentController {
|
|
|
353
354
|
* `aragon exec --result-schema`.
|
|
354
355
|
*/
|
|
355
356
|
private readonly structuredResultBlock;
|
|
357
|
+
/**
|
|
358
|
+
* The L0 index block for the CURRENT generation, or `''` (tui-ctrl-i-ast-index 5.11a).
|
|
359
|
+
*
|
|
360
|
+
* A FIELD, NOT A LOCAL, for the reason `appendSystemPrompt` is one: `composeSystemPrompt()`
|
|
361
|
+
* runs on every rebuild, and re-rendering the block from disk each time would read the whole
|
|
362
|
+
* generation per turn. Memoized BY GENERATION - the same bytes for the same generation is
|
|
363
|
+
* exactly the determinism I-4 requires, so the memo and the invariant agree by construction.
|
|
364
|
+
*/
|
|
365
|
+
private indexBlockCache;
|
|
356
366
|
private effectiveMode;
|
|
357
367
|
private pendingMode;
|
|
358
368
|
/**
|
|
@@ -611,6 +621,19 @@ export declare class AgentController {
|
|
|
611
621
|
* of building the Orchestrator text a second time.
|
|
612
622
|
*/
|
|
613
623
|
private teamBlocksDropped;
|
|
624
|
+
/**
|
|
625
|
+
* The L0 index block for the current generation, or `''` (tui-ctrl-i-ast-index 5.11a).
|
|
626
|
+
*
|
|
627
|
+
* `''` ON EVERY PATH THAT MUST NOT CHANGE THE PROMPT: index disabled, `promptBlock` off, no
|
|
628
|
+
* artifact on disk, or a schema the engine refuses to read. That emptiness is what keeps an
|
|
629
|
+
* unbuilt workspace's system prompt byte-identical to the pre-feature build (AC-14), and it is
|
|
630
|
+
* why every failure here is answered with `''` instead of a throw - a broken index must never
|
|
631
|
+
* prevent the agent from starting.
|
|
632
|
+
*
|
|
633
|
+
* MEMOIZED BY GENERATION: the same generation must render the same bytes (I-4), so a second
|
|
634
|
+
* rebuild in the same session reuses the cached block instead of re-reading the tables.
|
|
635
|
+
*/
|
|
636
|
+
private indexPromptBlock;
|
|
614
637
|
private rebuildSystemPrompt;
|
|
615
638
|
private currentImageKey;
|
|
616
639
|
/**
|
|
@@ -1366,6 +1389,19 @@ export declare class AgentController {
|
|
|
1366
1389
|
* `panelVisible` sentence, which is part of the block.
|
|
1367
1390
|
*/
|
|
1368
1391
|
setTodoConfig(patch: Partial<TodoConfig>): TodoConfig;
|
|
1392
|
+
/** The index section as this session currently holds it (clamped). */
|
|
1393
|
+
getIndexConfig(): IndexConfig;
|
|
1394
|
+
/**
|
|
1395
|
+
* Adopt a new index config for this session and re-render the prompt.
|
|
1396
|
+
*
|
|
1397
|
+
* BOTH HALVES ARE REQUIRED, exactly as `setTodoConfig` records: `persistConfig` writes the
|
|
1398
|
+
* file and this writes the runtime, and `/index off` must do both or it reports success and
|
|
1399
|
+
* changes nothing until the next launch. The cache is cleared first because a change to
|
|
1400
|
+
* `promptTokens` or `promptBlock` must re-render even when the generation did not move.
|
|
1401
|
+
*/
|
|
1402
|
+
applyIndexConfig(patch?: Partial<IndexConfig>): void;
|
|
1403
|
+
/** Called after a successful build so the same session immediately uses the new index. */
|
|
1404
|
+
refreshIndexPrompt(): void;
|
|
1369
1405
|
getTodoSnapshot(): TodoSnapshot | null;
|
|
1370
1406
|
/**
|
|
1371
1407
|
* Whether the acceptance table is live for this session: the config key AND the
|
package/dist/agent/controller.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { createModelSettingsDraft, previewModelSettings, saveModelSettings, reloadModelSettings, } from './model-profile-settings.js';
|
|
2
2
|
import { applySessionKit as applySessionKitPort, clearSessionKit as clearSessionKitPort } from './kit-apply.js';
|
|
3
|
+
import { clampIndexConfig } from '@aragon-agent/tui/model/index-build/config';
|
|
4
|
+
import { buildIndexBlock, renderL0 } from '../indexer/l0.js';
|
|
5
|
+
import { indexPathsFor } from '../indexer/paths.js';
|
|
6
|
+
import { loadCached } from '../indexer/read/cache.js';
|
|
7
|
+
import { readCurrentMeta } from '../indexer/store.js';
|
|
8
|
+
import { createCodeQueryTool } from '../indexer/tools.js';
|
|
3
9
|
import { resolveActiveKit } from '@aragon-agent/tui/model/config/kit-resolution';
|
|
4
10
|
import { randomUUID } from 'node:crypto';
|
|
5
11
|
import { join } from 'node:path';
|
|
@@ -183,6 +189,15 @@ export class AgentController {
|
|
|
183
189
|
* `aragon exec --result-schema`.
|
|
184
190
|
*/
|
|
185
191
|
structuredResultBlock;
|
|
192
|
+
/**
|
|
193
|
+
* The L0 index block for the CURRENT generation, or `''` (tui-ctrl-i-ast-index 5.11a).
|
|
194
|
+
*
|
|
195
|
+
* A FIELD, NOT A LOCAL, for the reason `appendSystemPrompt` is one: `composeSystemPrompt()`
|
|
196
|
+
* runs on every rebuild, and re-rendering the block from disk each time would read the whole
|
|
197
|
+
* generation per turn. Memoized BY GENERATION - the same bytes for the same generation is
|
|
198
|
+
* exactly the determinism I-4 requires, so the memo and the invariant agree by construction.
|
|
199
|
+
*/
|
|
200
|
+
indexBlockCache;
|
|
186
201
|
// -----------------------------------------------------------------------
|
|
187
202
|
// Plan mode (§3.1) — THE CONTROLLER OWNS THE MODE.
|
|
188
203
|
//
|
|
@@ -1188,6 +1203,30 @@ export class AgentController {
|
|
|
1188
1203
|
// every optional dep in this bag follows). With no schema the options bag has no
|
|
1189
1204
|
// such key, so `createBuiltinTools` adds nothing and the tool array is the one it
|
|
1190
1205
|
// builds today - which is what makes I-S2 provable by object identity.
|
|
1206
|
+
// THE ONE PIECE OF THE INDEX FEATURE THAT REACHES THE MODEL (tui-ctrl-i-ast-index 7.3).
|
|
1207
|
+
//
|
|
1208
|
+
// THROUGH THE FACTORY for the reason `geneTools` records: `tools.test.ts::C7` asserts
|
|
1209
|
+
// `HOST_TOOL_NAMES` equals what `createBuiltinTools` PRODUCES, so appending after the
|
|
1210
|
+
// factory returned would turn that test red with a message about two lists of names.
|
|
1211
|
+
//
|
|
1212
|
+
// SPREAD CONDITIONALLY, so `/index off` yields an options bag with no such key and a
|
|
1213
|
+
// tool array that is the pre-feature one (AC-14 rests on the same rule). `isEnabled`
|
|
1214
|
+
// reads LIVE, because `/index off` flips the flag but cannot unregister a tool.
|
|
1215
|
+
//
|
|
1216
|
+
// IT IS NOT ON `PLAN_MODE_BLOCKED_TOOLS` AND NOT ON `CALLER_GATED_TOOLS`: it reads the
|
|
1217
|
+
// generated artifact and writes nothing, which is the floor membership test and the
|
|
1218
|
+
// reason plan mode, strict permissions and a read-only governance seat need no exemption.
|
|
1219
|
+
...(this.getIndexConfig().enabled
|
|
1220
|
+
? {
|
|
1221
|
+
indexTools: [
|
|
1222
|
+
createCodeQueryTool({
|
|
1223
|
+
getCwd: () => this.cwd,
|
|
1224
|
+
isEnabled: () => this.getIndexConfig().enabled,
|
|
1225
|
+
log: (event, fields) => getLogger().debug('cli', event, fields),
|
|
1226
|
+
}),
|
|
1227
|
+
],
|
|
1228
|
+
}
|
|
1229
|
+
: {}),
|
|
1191
1230
|
...(deps.resultTool ? { resultTool: deps.resultTool } : {}),
|
|
1192
1231
|
// THE HOOK PAIR, SPREAD FOR THE SAME REASON AND AT THE SAME SITE (D-12): a dep that
|
|
1193
1232
|
// is declared but not forwarded is dropped in silence, and the only symptom is that
|
|
@@ -1696,6 +1735,10 @@ export class AgentController {
|
|
|
1696
1735
|
// pre-builds the INCOMING model's prompt, and budgets sized for the outgoing window
|
|
1697
1736
|
// would overrun a smaller one. `''` when memory is off, which splices nothing.
|
|
1698
1737
|
memoryBlock: this.memory?.renderBlock(config) ?? '',
|
|
1738
|
+
// The L0 index summary (tui-ctrl-i-ast-index I-4). `''` when the index is unbuilt,
|
|
1739
|
+
// disabled, or `promptBlock` is off, which splices nothing and keeps the prompt
|
|
1740
|
+
// byte-identical to the pre-feature output (AC-14).
|
|
1741
|
+
indexBlock: this.indexPromptBlock(config),
|
|
1699
1742
|
// Gene Bank (9.2). The rules block is a source constant; the context block is the last
|
|
1700
1743
|
// zone `planForTurn` computed and is spliced BEFORE `Operating guidance`, never after the
|
|
1701
1744
|
// caller's appended instructions (RV-2). Both '' when off: nothing is spliced.
|
|
@@ -1814,6 +1857,43 @@ export class AgentController {
|
|
|
1814
1857
|
teamBlocksDropped(config = this.config, governBlock = this.governance.orchestratorBlock(this.getPosture(), config)) {
|
|
1815
1858
|
return governBlock !== '' && this.effectiveMode === 'build';
|
|
1816
1859
|
}
|
|
1860
|
+
/**
|
|
1861
|
+
* The L0 index block for the current generation, or `''` (tui-ctrl-i-ast-index 5.11a).
|
|
1862
|
+
*
|
|
1863
|
+
* `''` ON EVERY PATH THAT MUST NOT CHANGE THE PROMPT: index disabled, `promptBlock` off, no
|
|
1864
|
+
* artifact on disk, or a schema the engine refuses to read. That emptiness is what keeps an
|
|
1865
|
+
* unbuilt workspace's system prompt byte-identical to the pre-feature build (AC-14), and it is
|
|
1866
|
+
* why every failure here is answered with `''` instead of a throw - a broken index must never
|
|
1867
|
+
* prevent the agent from starting.
|
|
1868
|
+
*
|
|
1869
|
+
* MEMOIZED BY GENERATION: the same generation must render the same bytes (I-4), so a second
|
|
1870
|
+
* rebuild in the same session reuses the cached block instead of re-reading the tables.
|
|
1871
|
+
*/
|
|
1872
|
+
indexPromptBlock(config = this.config) {
|
|
1873
|
+
const settings = clampIndexConfig(config.index);
|
|
1874
|
+
if (!settings.enabled || !settings.promptBlock)
|
|
1875
|
+
return '';
|
|
1876
|
+
try {
|
|
1877
|
+
const paths = indexPathsFor(this.cwd);
|
|
1878
|
+
const meta = readCurrentMeta(paths);
|
|
1879
|
+
if (!meta)
|
|
1880
|
+
return '';
|
|
1881
|
+
if (this.indexBlockCache && this.indexBlockCache.generation === meta.generation) {
|
|
1882
|
+
return this.indexBlockCache.block;
|
|
1883
|
+
}
|
|
1884
|
+
const loaded = loadCached(paths);
|
|
1885
|
+
if (!loaded)
|
|
1886
|
+
return '';
|
|
1887
|
+
const block = buildIndexBlock(renderL0({ loaded, budgetTokens: settings.promptTokens }));
|
|
1888
|
+
this.indexBlockCache = { generation: meta.generation, block };
|
|
1889
|
+
return block;
|
|
1890
|
+
}
|
|
1891
|
+
catch {
|
|
1892
|
+
// A corrupt or unreadable artifact degrades to "no block": the agent still runs, and
|
|
1893
|
+
// `/index status` is where the user learns the index needs a rebuild.
|
|
1894
|
+
return '';
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1817
1897
|
rebuildSystemPrompt() {
|
|
1818
1898
|
// FIRST: bring the stored team-mode state in line with the configuration that is now
|
|
1819
1899
|
// live. This is the one place the two writers of `config.team` (`setTeamConfig` and the
|
|
@@ -3583,6 +3663,34 @@ export class AgentController {
|
|
|
3583
3663
|
this.rebuildSystemPrompt();
|
|
3584
3664
|
return todo;
|
|
3585
3665
|
}
|
|
3666
|
+
/** The index section as this session currently holds it (clamped). */
|
|
3667
|
+
getIndexConfig() {
|
|
3668
|
+
return clampIndexConfig(this.config.index);
|
|
3669
|
+
}
|
|
3670
|
+
/**
|
|
3671
|
+
* Adopt a new index config for this session and re-render the prompt.
|
|
3672
|
+
*
|
|
3673
|
+
* BOTH HALVES ARE REQUIRED, exactly as `setTodoConfig` records: `persistConfig` writes the
|
|
3674
|
+
* file and this writes the runtime, and `/index off` must do both or it reports success and
|
|
3675
|
+
* changes nothing until the next launch. The cache is cleared first because a change to
|
|
3676
|
+
* `promptTokens` or `promptBlock` must re-render even when the generation did not move.
|
|
3677
|
+
*/
|
|
3678
|
+
applyIndexConfig(patch) {
|
|
3679
|
+
// BOTH HALVES, exactly as `setTodoConfig` does: the caller persists the file and this
|
|
3680
|
+
// writes the RUNTIME. Persist alone would make `/index off` report success while
|
|
3681
|
+
// `getIndexConfig()` kept answering `enabled: true` for the rest of the session.
|
|
3682
|
+
if (patch !== undefined) {
|
|
3683
|
+
this.advanceSettingsRevision();
|
|
3684
|
+
this.config = { ...this.config, index: clampIndexConfig({ ...this.config.index, ...patch }) };
|
|
3685
|
+
}
|
|
3686
|
+
this.indexBlockCache = undefined;
|
|
3687
|
+
this.rebuildSystemPrompt();
|
|
3688
|
+
}
|
|
3689
|
+
/** Called after a successful build so the same session immediately uses the new index. */
|
|
3690
|
+
refreshIndexPrompt() {
|
|
3691
|
+
this.indexBlockCache = undefined;
|
|
3692
|
+
this.rebuildSystemPrompt();
|
|
3693
|
+
}
|
|
3586
3694
|
getTodoSnapshot() {
|
|
3587
3695
|
return this.todos?.snapshot() ?? null;
|
|
3588
3696
|
}
|
|
@@ -36,6 +36,16 @@ export interface SystemPromptParams {
|
|
|
36
36
|
* pre-memory prompt BYTE FOR BYTE (`memory.enabled: false`, `-p`, and every subagent).
|
|
37
37
|
*/
|
|
38
38
|
memoryBlock?: string;
|
|
39
|
+
/**
|
|
40
|
+
* The rendered L0 index block (`<!-- aragon-index:start -->` ... ), or `''`
|
|
41
|
+
* (tui-ctrl-i-ast-index I-4).
|
|
42
|
+
*
|
|
43
|
+
* DETERMINISTIC BY CONTRACT: its bytes depend only on `(generation, settings,
|
|
44
|
+
* normalized root, the gitHead frozen in meta.json)` - never on relative time or
|
|
45
|
+
* live HEAD - so the provider's prefix cache survives across turns. Spliced only
|
|
46
|
+
* when non-empty, which keeps an unbuilt index byte-identical to today's prompt.
|
|
47
|
+
*/
|
|
48
|
+
indexBlock?: string;
|
|
39
49
|
/**
|
|
40
50
|
* The stable `<gene_library>` rules block, or `''` / absent (gene-bank spec 9.2, I-2, I-20).
|
|
41
51
|
*
|
|
@@ -33,6 +33,7 @@ export function buildSystemPrompt(params) {
|
|
|
33
33
|
const skillsBlock = params.skillsBlock ?? '';
|
|
34
34
|
const hasSkills = skillsBlock.length > 0;
|
|
35
35
|
const memoryBlock = params.memoryBlock ?? '';
|
|
36
|
+
const indexBlock = params.indexBlock ?? '';
|
|
36
37
|
const geneRulesBlock = params.geneRulesBlock ?? '';
|
|
37
38
|
const geneContextBlock = params.geneContextBlock ?? '';
|
|
38
39
|
const planBlock = params.agentMode === 'plan'
|
|
@@ -79,6 +80,11 @@ export function buildSystemPrompt(params) {
|
|
|
79
80
|
...(redteamBlock ? ['', redteamBlock] : []),
|
|
80
81
|
// AFTER the project guidance and BEFORE the skills catalog (agent-memory D-5).
|
|
81
82
|
...(memoryBlock ? ['', memoryBlock] : []),
|
|
83
|
+
// IMMEDIATELY AFTER THE PROJECT GUIDANCE AND BEFORE THE SKILLS CATALOG (tui-ctrl-i-ast-index
|
|
84
|
+
// I-4): the L0 index block is stable prefix text for a given generation, so it sits with the
|
|
85
|
+
// other task-independent blocks. `''` splices nothing, which keeps an unbuilt index's prompt
|
|
86
|
+
// BYTE-IDENTICAL to the pre-feature output (AC-14).
|
|
87
|
+
...(indexBlock ? ['', indexBlock] : []),
|
|
82
88
|
// IMMEDIATELY AFTER the memory block, before the skills catalog (gene-bank 9.2): the second
|
|
83
89
|
// piece of stable, task-independent text. A source constant, so it can carry the authority
|
|
84
90
|
// claim the dynamic zone below relies on.
|
package/dist/app/App.js
CHANGED
|
@@ -92,7 +92,11 @@ import { readScrollbarPerf, setPerfResetHook, setPerfSnapshotProvider, } from '.
|
|
|
92
92
|
import { buildFrameBudget, POPUP_CAPACITY_SHARE } from '@aragon-agent/tui/ui/layout/budget';
|
|
93
93
|
import { useWheelRouting } from '@aragon-agent/tui/ui/use-wheel-routing';
|
|
94
94
|
import { DEV_MODE_KEY_FRAME, INDEX_KEY_FRAME, MEMORY_KEY_FRAME, } from '@aragon-agent/tui/input/limits';
|
|
95
|
-
import { INDEX_SKILL_NAME,
|
|
95
|
+
import { INDEX_SKILL_NAME, hasProjectIndex, indexBuildInvocationArgs, } from '../commands/index-build.js';
|
|
96
|
+
import { IndexPanel } from '@aragon-agent/tui/ui/overlays/IndexPanel';
|
|
97
|
+
import { reduceIndexPanel, idleState as initialIndexPanelState } from '@aragon-agent/tui/ui/overlays/index-panel-state';
|
|
98
|
+
import { openIndexConsole, startIndexBuild } from './index-console.js';
|
|
99
|
+
import { CONFIRM_DISABLED_BANNER, proseAfterFailureArgs } from '../commands/index-copy.js';
|
|
96
100
|
import { installConsoleBridge } from '@aragon-agent/tui/ui/console-bridge';
|
|
97
101
|
import { publishExitSnapshot } from '@aragon-agent/tui/ui/exit-snapshot';
|
|
98
102
|
import { publishSessionView } from './session-bridge.js';
|
|
@@ -3068,6 +3072,14 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3068
3072
|
setConfirmState(null);
|
|
3069
3073
|
dispatch({ type: 'setOverlay', overlay: null });
|
|
3070
3074
|
};
|
|
3075
|
+
// The index console: reducer state plus the abort handle for a build this process owns
|
|
3076
|
+
// (spec 5.9 - `Esc` aborts only what we started). All logic lives in `./index-console.ts`.
|
|
3077
|
+
const [indexPanel, indexSend] = useReducer(reduceIndexPanel, initialIndexPanelState());
|
|
3078
|
+
const indexPanelRef = useRef(indexPanel);
|
|
3079
|
+
indexPanelRef.current = indexPanel;
|
|
3080
|
+
const indexAbortRef = useRef(null);
|
|
3081
|
+
/** True once the "confirmation is off" banner has been shown this session (spec 5.9). */
|
|
3082
|
+
const confirmBannerShown = useRef(false);
|
|
3071
3083
|
// --- Ctrl+I: run the bundled project-indexer skill. -------------------
|
|
3072
3084
|
//
|
|
3073
3085
|
// SAME PATH AS A TYPED COMMAND, ON PURPOSE. After the Yes/No gate (the
|
|
@@ -3079,34 +3091,83 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3079
3091
|
// arrive as steering mid-run, which is not what "build the index" means.
|
|
3080
3092
|
const requestIndexBuild = () => {
|
|
3081
3093
|
if (controller.isRunning() || interactionPhase.current !== 'idle') {
|
|
3082
|
-
// A notice entry, not a toast: the running status row's feedback slot is
|
|
3083
|
-
// owned by the activity phrase, and a busy warning nobody can read is
|
|
3084
|
-
// the same as no warning.
|
|
3085
3094
|
notify('warn', 'The agent is busy. Let it finish before building the index (Ctrl+I).');
|
|
3086
3095
|
return;
|
|
3087
3096
|
}
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3097
|
+
const indexCfg = controller.getIndexConfig();
|
|
3098
|
+
if (!indexCfg.enabled) {
|
|
3099
|
+
notify('warn', 'The project index is off. Run /index on to enable it.');
|
|
3100
|
+
return;
|
|
3101
|
+
}
|
|
3102
|
+
// Status is read BEFORE the panel opens, so the first paint is complete (HCI rule 7).
|
|
3103
|
+
void openIndexConsole({
|
|
3104
|
+
cwd: controller.getCwd(),
|
|
3105
|
+
config: indexCfg,
|
|
3106
|
+
send: indexSend,
|
|
3107
|
+
notify,
|
|
3108
|
+
log: (event, fields) => getLogger().debug('cli', event, fields),
|
|
3109
|
+
proseUnavailable: !hasKey || !cfg.skills.enabled,
|
|
3110
|
+
}, indexCfg.confirmOnBuild).then(() => {
|
|
3111
|
+
// `confirmOnBuild: false` makes the reducer open STRAIGHT INTO `running`, so this
|
|
3112
|
+
// caller must start the build or the panel sits in a running state with no progress
|
|
3113
|
+
// and an `Esc` that aborts nothing - a panel the user cannot leave.
|
|
3114
|
+
if (indexCfg.confirmOnBuild)
|
|
3092
3115
|
return;
|
|
3116
|
+
// Silently removing a safety net is a product defect (spec 5.9 / condition 4), so the
|
|
3117
|
+
// FIRST unattended build says what happened and how to put it back.
|
|
3118
|
+
if (!confirmBannerShown.current) {
|
|
3119
|
+
confirmBannerShown.current = true;
|
|
3120
|
+
notify('warn', CONFIRM_DISABLED_BANNER);
|
|
3093
3121
|
}
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3122
|
+
confirmIndexBuild('ast-and-prose');
|
|
3123
|
+
});
|
|
3124
|
+
dispatch({ type: 'setOverlay', overlay: 'index' });
|
|
3125
|
+
};
|
|
3126
|
+
/** `Enter` in the confirm phase: start the build and stream progress into the panel. */
|
|
3127
|
+
const confirmIndexBuild = (actionOverride) => {
|
|
3128
|
+
// A KEYBOARD PRESS IS NOT A PHASE. `Enter` on a settled panel (done / cancelled /
|
|
3129
|
+
// failed) must not reach `build()`: the reducer ignores the `confirm` event, so the
|
|
3130
|
+
// panel would keep showing the old card while a real build ran with no cancel handle.
|
|
3131
|
+
if (actionOverride === undefined && indexPanelRef.current.phase !== 'confirm')
|
|
3097
3132
|
return;
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
const
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3133
|
+
const action = actionOverride ?? indexPanelRef.current.action;
|
|
3134
|
+
indexSend({ type: 'confirm' });
|
|
3135
|
+
const abort = new AbortController();
|
|
3136
|
+
indexAbortRef.current = abort;
|
|
3137
|
+
void startIndexBuild({
|
|
3138
|
+
cwd: controller.getCwd(),
|
|
3139
|
+
config: controller.getIndexConfig(),
|
|
3140
|
+
send: indexSend,
|
|
3141
|
+
notify,
|
|
3142
|
+
log: (event, fields) => getLogger().debug('cli', event, fields),
|
|
3143
|
+
proseUnavailable: !hasKey || !cfg.skills.enabled,
|
|
3144
|
+
}, {
|
|
3145
|
+
astOnly: action === 'ast-only',
|
|
3146
|
+
runId: `key-${Date.now().toString(36)}`,
|
|
3147
|
+
signal: abort.signal,
|
|
3148
|
+
reason: 'key',
|
|
3149
|
+
}).then((result) => {
|
|
3150
|
+
indexAbortRef.current = null;
|
|
3151
|
+
// The same session uses the new index immediately (spec 5.11a).
|
|
3152
|
+
if (result.ok)
|
|
3153
|
+
controller.refreshIndexPrompt();
|
|
3154
|
+
// PHASE B, AND ONLY AFTER PHASE A SUCCEEDED (spec 5.10 / G7). The prose index
|
|
3155
|
+
// describes the structure the AST index just built, so it runs second; running it
|
|
3156
|
+
// over a FAILED AST build would let it state structural counts that do not exist.
|
|
3157
|
+
// It reuses the existing skill path unchanged, which is what keeps the invocation
|
|
3158
|
+
// card showing `ctrl+i` instead of the machine-written sentence (RV-3).
|
|
3159
|
+
if (action === 'ast-and-prose') {
|
|
3160
|
+
const record = controller.getSkillService().get(INDEX_SKILL_NAME);
|
|
3161
|
+
if (cfg.skills.enabled && hasKey && record && !record.disabled && !record.invalid) {
|
|
3162
|
+
const existing = hasProjectIndex(controller.getCwd());
|
|
3163
|
+
// A FAILED PHASE A STILL LETS B RUN, AND B IS TOLD (spec 5.10): a prose index that
|
|
3164
|
+
// quotes structural counts it never saw is worse than one that admits it has none.
|
|
3165
|
+
const args = indexBuildInvocationArgs(existing);
|
|
3166
|
+
const suffix = result.ok ? '' : `\n\n${proseAfterFailureArgs(result.code)}`;
|
|
3167
|
+
void executeSlashInput(`/skill:${INDEX_SKILL_NAME} ${args}${suffix}`);
|
|
3168
|
+
}
|
|
3108
3169
|
}
|
|
3109
|
-
})
|
|
3170
|
+
});
|
|
3110
3171
|
};
|
|
3111
3172
|
/** Answer every outstanding request with the same response and close up. */
|
|
3112
3173
|
const resolveHuman = (response) => {
|
|
@@ -3422,10 +3483,18 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3422
3483
|
}
|
|
3423
3484
|
// Ctrl+I arrives as INDEX_KEY_FRAME, never as key.ctrl + 'i': legacy
|
|
3424
3485
|
// terminals encode it as the Tab byte and the stdin filter's translators
|
|
3425
|
-
//
|
|
3426
|
-
//
|
|
3427
|
-
|
|
3428
|
-
|
|
3486
|
+
// Ctrl+I arrives as INDEX_KEY_FRAME, never as key.ctrl + 'i': legacy terminals encode
|
|
3487
|
+
// it as the Tab byte and the stdin filter's translators are the only layer that can tell
|
|
3488
|
+
// them apart (see input/limits.ts). Alt+I is the ALWAYS-AVAILABLE twin, in BOTH byte
|
|
3489
|
+
// shapes - `key.meta` + 'i' from a modern terminal, and the raw ESC + letter that
|
|
3490
|
+
// win32-input-mode produces. Alt+M above uses the same discipline; accepting one shape
|
|
3491
|
+
// only would leave this fallback dead on exactly the terminals it exists for (P0-1).
|
|
3492
|
+
if (input.includes(INDEX_KEY_FRAME)
|
|
3493
|
+
|| (key.meta && !key.ctrl && input.toLowerCase() === 'i')
|
|
3494
|
+
|| input === '\x1bi') {
|
|
3495
|
+
if (tooSmall)
|
|
3496
|
+
return;
|
|
3497
|
+
if (stateRef.current.overlay && stateRef.current.overlay !== 'index')
|
|
3429
3498
|
return;
|
|
3430
3499
|
requestIndexBuild();
|
|
3431
3500
|
return;
|
|
@@ -3535,6 +3604,9 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3535
3604
|
// nothing and the wheel falls through to the transcript behind it.
|
|
3536
3605
|
|| overlay === 'prompts' || overlay === 'prompt-pick'
|
|
3537
3606
|
// The memory manager pages through `overlayScroll` too (agent-memory V-4).
|
|
3607
|
+
// The index console pages its result card through `overlayScroll` too, so PgDn in it
|
|
3608
|
+
// never falls through to the transcript behind it.
|
|
3609
|
+
|| overlay === 'index'
|
|
3538
3610
|
|| overlay === 'memory'
|
|
3539
3611
|
// And so does the gene manager (gene-bank 12.2).
|
|
3540
3612
|
|| overlay === 'gene'
|
|
@@ -3735,6 +3807,12 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3735
3807
|
// sign-out confirmation impossible to cancel. `AccountPanel` decides; `App` steps aside.
|
|
3736
3808
|
if (overlay === 'account')
|
|
3737
3809
|
return;
|
|
3810
|
+
// THE INDEX CONSOLE OWNS ITS Esc (tui-ctrl-i-ast-index 5.9 / P1-5). It has two
|
|
3811
|
+
// meanings there - abort while THIS process owns the build, close otherwise - and a
|
|
3812
|
+
// branch here that also closed the overlay would abort and close in one keystroke,
|
|
3813
|
+
// so the user would never read "Index was not changed". `IndexPanel` decides.
|
|
3814
|
+
if (overlay === 'index')
|
|
3815
|
+
return;
|
|
3738
3816
|
// THE WAIVER'S `Esc` (4.3). App owns the key for the plan overlays and for this one, so
|
|
3739
3817
|
// declining and draining the queue happen in ONE place - the overlay registers no Escape
|
|
3740
3818
|
// handler of its own, and a second one would decline twice.
|
|
@@ -4192,7 +4270,10 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
4192
4270
|
} })) : 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,
|
|
4193
4271
|
// ONLY THE APPLY IS BLOCKED while work is in flight (§4.7): a list a
|
|
4194
4272
|
// user cannot even OPEN reads as a broken key.
|
|
4195
|
-
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 === '
|
|
4273
|
+
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 === 'index' ? (_jsx(IndexPanel, { isActive: !tooSmall, state: indexPanel, maxRows: overlayMaxRows, cols: viewCols, theme: theme, caps: caps, onClose: () => {
|
|
4274
|
+
indexSend({ type: 'close' });
|
|
4275
|
+
dispatch({ type: 'setOverlay', overlay: null });
|
|
4276
|
+
}, onConfirm: confirmIndexBuild, onToggleAction: () => indexSend({ type: 'toggle-action' }), onCancel: () => indexAbortRef.current?.abort() })) : 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 }),
|
|
4196
4277
|
// Outcomes are toasts (they expire); the editor's own error row is what stays on screen.
|
|
4197
4278
|
onNotice: (level, text) => toast(level === 'info' ? 'success' : level, text), onClose: closeMemory })) : overlay === 'gene' && genePort && geneView ? (_jsx(GeneOverlay, { isActive: !tooSmall, state: geneState, dispatch: geneDispatch, port: genePort, view: geneView, ...(geneIntent ? { intent: geneIntent } : {}), cols: viewCols, maxRows: overlayMaxRows, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, reducedMotion: cfg.reducedMotion ?? false, configuredKey: cfg.gene?.key ?? 'ctrl+q', explainAvailable: explainAvailableFor(cfg.gene?.explainLanguage ?? 'auto', process.env.LC_ALL ?? process.env.LANG ?? '', controller.getFastStatus().tier.ok), onNotice: (level, text) => toast(level === 'info' ? 'success' : level, text), onClose: closeGene })) : overlay === 'settings' ? (_jsx(SettingsScreen, { isActive: !tooSmall, initial: {
|
|
4198
4279
|
provider: cfg.provider,
|