@aragon-agent/cli 0.6.25 → 0.6.26

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/README.md +165 -13
  3. package/dist/agent/reducer.d.ts +22 -0
  4. package/dist/agent/reducer.js +4 -1
  5. package/dist/cli.js +214 -2
  6. package/dist/commands/branch-command.d.ts +61 -0
  7. package/dist/commands/branch-command.js +117 -0
  8. package/dist/commands/builtins.js +48 -6
  9. package/dist/commands/registry.d.ts +28 -0
  10. package/dist/commands/session-command.d.ts +54 -0
  11. package/dist/commands/session-command.js +109 -0
  12. package/dist/config/load.d.ts +15 -0
  13. package/dist/exec/index.js +10 -1
  14. package/dist/logging/logger.d.ts +1 -1
  15. package/dist/proc/terminal-plan.d.ts +155 -0
  16. package/dist/proc/terminal-plan.js +360 -0
  17. package/dist/session/branch-invocation.d.ts +83 -0
  18. package/dist/session/branch-invocation.js +109 -0
  19. package/dist/session/branch-launch.d.ts +70 -0
  20. package/dist/session/branch-launch.js +248 -0
  21. package/dist/session/checkpoint.d.ts +257 -0
  22. package/dist/session/checkpoint.js +512 -0
  23. package/dist/session/cli-commands.d.ts +2 -0
  24. package/dist/session/cli-commands.js +36 -5
  25. package/dist/session/identity.d.ts +72 -0
  26. package/dist/session/identity.js +148 -0
  27. package/dist/session/limits.d.ts +66 -0
  28. package/dist/session/limits.js +66 -0
  29. package/dist/session/persist.d.ts +30 -5
  30. package/dist/session/startup-session.d.ts +107 -0
  31. package/dist/session/startup-session.js +315 -0
  32. package/dist/session/store.d.ts +60 -1
  33. package/dist/session/store.js +95 -6
  34. package/dist/ui/App.d.ts +54 -2
  35. package/dist/ui/App.js +115 -21
  36. package/dist/ui/Header.js +8 -16
  37. package/dist/ui/StatusBar.d.ts +8 -0
  38. package/dist/ui/StatusBar.js +12 -3
  39. package/dist/ui/layout/header-hints.d.ts +68 -0
  40. package/dist/ui/layout/header-hints.js +138 -0
  41. package/dist/ui/layout/session-chip.d.ts +52 -0
  42. package/dist/ui/layout/session-chip.js +64 -0
  43. package/dist/ui/layout/status-layout.d.ts +10 -0
  44. package/dist/ui/layout/status-layout.js +8 -1
  45. package/dist/ui/overlays/HelpOverlay.js +9 -3
  46. package/dist/ui/session-bridge.d.ts +26 -0
  47. package/dist/ui/session-bridge.js +32 -0
  48. package/package.json +2 -2
@@ -113,7 +113,14 @@ function modeFieldText(mode, pendingMode, full) {
113
113
  }
114
114
  /** Every field survives each width rung; only the redraw carrier is outside this plan. */
115
115
  export function planPrimaryStatusFields(input) {
116
- const budget = Math.max(0, (Number.isFinite(input.columns) ? Math.floor(input.columns) : 80) - 1);
116
+ const columns = Number.isFinite(input.columns) ? Math.floor(input.columns) : 80;
117
+ // GUARDED LIKE `columns` ABOVE, and for the same reason: `Math.max(0, NaN)`
118
+ // is `NaN`, which would make every `cells > budget` comparison false and
119
+ // silently pin this row at its widest rung - the opposite of reserving space.
120
+ const reserved = typeof input.reserveRight === 'number' && Number.isFinite(input.reserveRight)
121
+ ? Math.max(0, Math.floor(input.reserveRight))
122
+ : 0;
123
+ const budget = Math.max(0, columns - 1 - reserved);
117
124
  const labels = phaseLabels(input);
118
125
  const glyphText = cleanStatusText(input.spinner ?? '-');
119
126
  const glyph = stringWidth(glyphText) === 1 ? glyphText : '-';
@@ -21,7 +21,11 @@ function keyRows(times) {
21
21
  // with a draft x2 clears the input and x3 exits; an empty input
22
22
  // keeps the previous x2 exit.
23
23
  ['Ctrl+C', `Draft: ${times}2 clear input, ${times}3 exit. Empty: ${times}2 exit`],
24
- ['Ctrl+L', 'Redraw the frame'],
24
+ // Ctrl+L IS THE BRANCH KEY NOW (tui-branch-terminal-shortcut D-1) and the
25
+ // redraw moved to Ctrl+R. Both rows are listed, because the migration is the
26
+ // one thing an existing user will press by muscle memory and be surprised by.
27
+ ['Ctrl+L', 'Open a new terminal on this session (the branch gets its own id)'],
28
+ ['Ctrl+R', 'Redraw the frame'],
25
29
  ['Ctrl+T', 'Show/hide thinking (off by default)'],
26
30
  ['Ctrl+I', 'Build the project index (bundled skill; asks first; needs keyboard enhancement)'],
27
31
  ['Ctrl+G', 'Expand/collapse status details; disabled while an overlay is open'],
@@ -77,8 +81,10 @@ const COMMANDS = [
77
81
  ['/clear screen', 'Clear the visible transcript only; keeps the conversation'],
78
82
  ['/reset', 'Alias of /clear'],
79
83
  ['/cwd [dir]', 'Show or change the tool working directory'],
80
- ['/save [file]', 'Save the session to JSON'],
81
- ['/resume [file]', 'Load a saved session'],
84
+ ['/save [file]', 'Export the session to JSON (a file you keep)'],
85
+ ['/resume [file]', 'Load a saved session; this session moves to a new id'],
86
+ ['/session [copy|pin]', 'Show this session id and file; copy the resume command; pin it'],
87
+ ['/branch', 'Same as Ctrl+L: branch into a new terminal'],
82
88
  ['/copy', 'Copy last answer; native completion confirmed, OSC 52 request unconfirmed'],
83
89
  ['/queue', 'Read every pending message in full; no replay or queue mutation'],
84
90
  ['/mouse [on|off]', 'Release the mouse to your terminal, or take it back'],
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The single slot the view state crosses the React boundary through
3
+ * (tui-session-id-resume §3.6 / D-2).
4
+ *
5
+ * SHAPED AFTER `exit-snapshot.ts`, on purpose and for the same reason: two of the
6
+ * three writers of a checkpoint are process-level (`process.on('exit')` and the
7
+ * signal hook), and by the time they run the component tree may already be
8
+ * unmounted or mid-unmount. A module variable stays readable for the whole
9
+ * process lifetime; a React channel does not.
10
+ *
11
+ * NAMED `session-bridge` AND NOT `live-session` (R-15): `__tests__/live-session
12
+ * .test.ts` already exists and tests something else entirely - the rule that a
13
+ * running tool's output tail never reaches the disk. Two file names one grep away
14
+ * from each other, meaning different things, is how a future reader loses an
15
+ * afternoon.
16
+ *
17
+ * WRITES OVERWRITE AND ALLOCATE ALMOST NOTHING: `entries` travels by reference,
18
+ * so publishing costs one object literal per view-state change.
19
+ */
20
+ import type { LiveSessionView } from '../session/checkpoint.js';
21
+ /** Called by `App` after every view-state change. Synchronous, side-effect free. */
22
+ export declare function publishSessionView(next: LiveSessionView): void;
23
+ /** Read by the checkpoint writer. `undefined` means "no identity in this process". */
24
+ export declare function readSessionView(): LiveSessionView | undefined;
25
+ /** Test-only reset, so specs do not leak a session into one another. */
26
+ export declare function clearSessionView(): void;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The single slot the view state crosses the React boundary through
3
+ * (tui-session-id-resume §3.6 / D-2).
4
+ *
5
+ * SHAPED AFTER `exit-snapshot.ts`, on purpose and for the same reason: two of the
6
+ * three writers of a checkpoint are process-level (`process.on('exit')` and the
7
+ * signal hook), and by the time they run the component tree may already be
8
+ * unmounted or mid-unmount. A module variable stays readable for the whole
9
+ * process lifetime; a React channel does not.
10
+ *
11
+ * NAMED `session-bridge` AND NOT `live-session` (R-15): `__tests__/live-session
12
+ * .test.ts` already exists and tests something else entirely - the rule that a
13
+ * running tool's output tail never reaches the disk. Two file names one grep away
14
+ * from each other, meaning different things, is how a future reader loses an
15
+ * afternoon.
16
+ *
17
+ * WRITES OVERWRITE AND ALLOCATE ALMOST NOTHING: `entries` travels by reference,
18
+ * so publishing costs one object literal per view-state change.
19
+ */
20
+ let slot;
21
+ /** Called by `App` after every view-state change. Synchronous, side-effect free. */
22
+ export function publishSessionView(next) {
23
+ slot = next;
24
+ }
25
+ /** Read by the checkpoint writer. `undefined` means "no identity in this process". */
26
+ export function readSessionView() {
27
+ return slot;
28
+ }
29
+ /** Test-only reset, so specs do not leak a session into one another. */
30
+ export function clearSessionView() {
31
+ slot = undefined;
32
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aragon-agent/cli",
3
- "version": "0.6.25",
3
+ "version": "0.6.26",
4
4
  "description": "AragonAgent CLI — a Claude-Code / Codex-style interactive terminal UI (TUI) on top of the @aragon-agent/core engine. Installable and runnable via npm / npx.",
5
5
  "license": "MIT",
6
6
  "author": "AragonAgent contributors",
@@ -56,7 +56,7 @@
56
56
  "prepublishOnly": "npm run build"
57
57
  },
58
58
  "dependencies": {
59
- "@aragon-agent/core": "^0.2.37",
59
+ "@aragon-agent/core": "^0.2.38",
60
60
  "chalk": "^5.6.2",
61
61
  "cli-highlight": "^2.0.0",
62
62
  "commander": "^12.1.0",