@aragon-agent/cli 0.6.2 → 0.6.3

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 (118) hide show
  1. package/CHANGELOG.md +216 -0
  2. package/README.md +202 -0
  3. package/dist/agent/controller.d.ts +74 -1
  4. package/dist/agent/controller.js +200 -1
  5. package/dist/agent/headless.d.ts +8 -0
  6. package/dist/agent/headless.js +47 -0
  7. package/dist/agent/reducer.d.ts +120 -0
  8. package/dist/agent/reducer.js +201 -2
  9. package/dist/cli.js +224 -5
  10. package/dist/commands/builtins.js +73 -23
  11. package/dist/commands/registry.d.ts +27 -0
  12. package/dist/compaction/archive.d.ts +175 -0
  13. package/dist/compaction/archive.js +267 -0
  14. package/dist/compaction/child.d.ts +97 -0
  15. package/dist/compaction/child.js +113 -0
  16. package/dist/compaction/command.d.ts +41 -0
  17. package/dist/compaction/command.js +342 -0
  18. package/dist/compaction/compactor.d.ts +268 -0
  19. package/dist/compaction/compactor.js +689 -0
  20. package/dist/compaction/digest.d.ts +62 -0
  21. package/dist/compaction/digest.js +164 -0
  22. package/dist/compaction/limits.d.ts +165 -0
  23. package/dist/compaction/limits.js +172 -0
  24. package/dist/compaction/pressure.d.ts +135 -0
  25. package/dist/compaction/pressure.js +167 -0
  26. package/dist/compaction/summarize-call.d.ts +70 -0
  27. package/dist/compaction/summarize-call.js +86 -0
  28. package/dist/compaction/summary-prompt.d.ts +85 -0
  29. package/dist/compaction/summary-prompt.js +197 -0
  30. package/dist/compaction/tail-budget.d.ts +52 -0
  31. package/dist/compaction/tail-budget.js +67 -0
  32. package/dist/compaction/types.d.ts +179 -0
  33. package/dist/compaction/types.js +22 -0
  34. package/dist/compaction/wiring.d.ts +255 -0
  35. package/dist/compaction/wiring.js +556 -0
  36. package/dist/config/app-paths.d.ts +14 -0
  37. package/dist/config/app-paths.js +16 -0
  38. package/dist/config/cli-commands.d.ts +41 -0
  39. package/dist/config/cli-commands.js +77 -1
  40. package/dist/config/env.d.ts +4 -1
  41. package/dist/config/env.js +92 -2
  42. package/dist/config/load.d.ts +31 -0
  43. package/dist/config/load.js +63 -1
  44. package/dist/config/schema.d.ts +159 -0
  45. package/dist/config/schema.js +137 -0
  46. package/dist/config/store.js +17 -1
  47. package/dist/config/ui-state.d.ts +28 -1
  48. package/dist/config/ui-state.js +9 -0
  49. package/dist/exec/events.d.ts +50 -1
  50. package/dist/exec/runner.js +42 -0
  51. package/dist/input/mouse-events.d.ts +31 -5
  52. package/dist/input/mouse-events.js +86 -27
  53. package/dist/input/stdin-mouse-filter.d.ts +8 -3
  54. package/dist/logging/install.d.ts +51 -1
  55. package/dist/logging/install.js +28 -0
  56. package/dist/logging/logger.d.ts +1 -1
  57. package/dist/session/persist.js +19 -0
  58. package/dist/team/report.js +7 -1
  59. package/dist/team/runtime.d.ts +10 -0
  60. package/dist/team/runtime.js +7 -0
  61. package/dist/team/subagent.d.ts +31 -1
  62. package/dist/team/subagent.js +42 -15
  63. package/dist/team/types.d.ts +8 -0
  64. package/dist/ui/ActivityLine.d.ts +19 -1
  65. package/dist/ui/ActivityLine.js +10 -2
  66. package/dist/ui/App.d.ts +48 -1
  67. package/dist/ui/App.js +294 -13
  68. package/dist/ui/Composer.d.ts +13 -1
  69. package/dist/ui/Composer.js +2 -2
  70. package/dist/ui/PromptInput.d.ts +34 -1
  71. package/dist/ui/PromptInput.js +54 -3
  72. package/dist/ui/StatusBar.d.ts +40 -0
  73. package/dist/ui/StatusBar.js +13 -4
  74. package/dist/ui/TeamPanel.js +7 -1
  75. package/dist/ui/Transcript.d.ts +21 -1
  76. package/dist/ui/Transcript.js +32 -2
  77. package/dist/ui/clipboard.d.ts +52 -0
  78. package/dist/ui/clipboard.js +91 -0
  79. package/dist/ui/entries/CompactionCard.d.ts +75 -0
  80. package/dist/ui/entries/CompactionCard.js +158 -0
  81. package/dist/ui/frame-differ.d.ts +46 -0
  82. package/dist/ui/frame-differ.js +94 -10
  83. package/dist/ui/gauge.d.ts +16 -1
  84. package/dist/ui/gauge.js +25 -6
  85. package/dist/ui/glyphs.d.ts +11 -0
  86. package/dist/ui/glyphs.js +2 -0
  87. package/dist/ui/layout/ScrollViewport.d.ts +43 -6
  88. package/dist/ui/layout/ScrollViewport.js +128 -21
  89. package/dist/ui/layout/budget.d.ts +10 -3
  90. package/dist/ui/layout/budget.js +10 -3
  91. package/dist/ui/layout/follow-state.d.ts +137 -0
  92. package/dist/ui/layout/follow-state.js +150 -0
  93. package/dist/ui/layout/virtual-window.d.ts +11 -0
  94. package/dist/ui/layout/virtual-window.js +34 -0
  95. package/dist/ui/overlays/HelpOverlay.js +6 -1
  96. package/dist/ui/overlays/SettingsScreen.d.ts +47 -1
  97. package/dist/ui/overlays/SettingsScreen.js +60 -1
  98. package/dist/ui/palettes.d.ts +16 -0
  99. package/dist/ui/palettes.js +6 -0
  100. package/dist/ui/screen.d.ts +22 -0
  101. package/dist/ui/screen.js +70 -8
  102. package/dist/ui/selection/highlight.d.ts +39 -0
  103. package/dist/ui/selection/highlight.js +64 -0
  104. package/dist/ui/selection/screen-mirror.d.ts +24 -0
  105. package/dist/ui/selection/screen-mirror.js +35 -0
  106. package/dist/ui/selection/selection-controller.d.ts +88 -0
  107. package/dist/ui/selection/selection-controller.js +282 -0
  108. package/dist/ui/selection/selection.d.ts +90 -0
  109. package/dist/ui/selection/selection.js +223 -0
  110. package/dist/ui/stdout-frame-writer.d.ts +33 -0
  111. package/dist/ui/stdout-frame-writer.js +15 -0
  112. package/dist/ui/theme.d.ts +11 -0
  113. package/dist/ui/theme.js +2 -0
  114. package/dist/ui/transcript-text.js +23 -0
  115. package/dist/ui/use-startup-notices.d.ts +27 -1
  116. package/dist/ui/use-startup-notices.js +43 -11
  117. package/dist/ui/use-wheel-routing.js +8 -0
  118. package/package.json +4 -2
@@ -111,6 +111,29 @@ function renderEntry(entry, glyphs) {
111
111
  const detail = entry.detail ? `: ${entry.detail}` : '';
112
112
  return [`${head} ${entry.status}${detail}`];
113
113
  }
114
+ case 'compaction': {
115
+ // A compaction is real spend AND a real, permanent loss of history, and an
116
+ // exported transcript that omitted it would be unaccountable for both —
117
+ // the argument the `team`, `retry` and `fast` cases above each make in
118
+ // their own words. It matters most here: this is the one entry kind whose
119
+ // presence explains why the messages the reader is looking for are gone.
120
+ const glyph = entry.applied ? glyphs.compaction : glyphs.toolError;
121
+ const duration = entry.durationMs === undefined ? '' : ` (${entry.durationMs}ms)`;
122
+ if (!entry.applied) {
123
+ const why = entry.reason ? `: ${entry.reason}` : '';
124
+ return [`${TOOL_INDENT}${glyph} context not compacted #${entry.index}${why}`];
125
+ }
126
+ const head = `${TOOL_INDENT}${glyph} context compacted #${entry.index} ` +
127
+ `${entry.messagesBefore} ${glyphs.arrowRight} ${entry.messagesAfter} messages, ` +
128
+ `${entry.tokensBefore} ${glyphs.arrowRight} ${entry.tokensAfter} tokens ` +
129
+ `[${entry.mode}] ${entry.model}${duration}`;
130
+ if (!entry.summary)
131
+ return [head];
132
+ return [
133
+ head,
134
+ ...entry.summary.split('\n').map((l) => `${TOOL_INDENT}${CONTINUATION_INDENT}${l}`),
135
+ ];
136
+ }
114
137
  case 'notice': {
115
138
  const glyph = entry.level === 'error'
116
139
  ? glyphs.error
@@ -12,6 +12,18 @@
12
12
  * not otherwise see — rather than belonging to the view.
13
13
  */
14
14
  import type { ViewAction } from '../agent/reducer.js';
15
+ /**
16
+ * The revision of the mouse notice a user must have seen for it to stay quiet
17
+ * (`state.json::mouseNoticeVersion`, `0` when absent).
18
+ *
19
+ * BUMP IT WHENEVER THE ADVICE CHANGES, never for a rewording that leaves the
20
+ * recommended actions alone — the same rule `VT_INPUT_NOTICE_VERSION` below
21
+ * carries, and for the same reason.
22
+ *
23
+ * `1` = the first text that names DRAG-SELECT and `/mouse`. `0` = the 0.6.2 text
24
+ * that taught the Shift bypass, recorded back when this was a boolean.
25
+ */
26
+ export declare const MOUSE_NOTICE_VERSION = 1;
15
27
  /**
16
28
  * The revision of the text below that a user must have seen for this notice to
17
29
  * stay quiet (`state.json::vtInputNoticeVersion`, `0` when absent).
@@ -100,7 +112,21 @@ export interface MouseNoticeOptions {
100
112
  * re-deriving either one here would put them back out of step.
101
113
  */
102
114
  enabled: boolean;
103
- /** Record that it was shown (`state.json`). Called once, after dispatch. */
115
+ /**
116
+ * Whether DRAG-SELECT is running too, i.e. the resolved `mouseSelect`.
117
+ *
118
+ * A SECOND FLAG RATHER THAN AN INFERENCE, for the reason the field above
119
+ * records about its own two halves: "the mouse is captured" and "dragging
120
+ * selects text" are not the same claim, and a session that turned drag-select
121
+ * off must not be handed advice about a mode that is not running.
122
+ */
123
+ selectEnabled: boolean;
124
+ /**
125
+ * Record that `MOUSE_NOTICE_VERSION` was shown (`state.json`). Called once,
126
+ * after dispatch — and it must write that constant, not `true`: the gate
127
+ * compares against it, so a caller storing anything else either replays the
128
+ * notice forever or silences a future revision of the text.
129
+ */
104
130
  onSeen: () => void;
105
131
  }
106
132
  export interface VtInputNoticeOptions {
@@ -14,18 +14,42 @@
14
14
  import { useEffect, useRef } from 'react';
15
15
  import { MODE_TOGGLE_KEYS } from '../agent/agent-mode.js';
16
16
  import { readConfigFile } from '../config/store.js';
17
- import { getMouseNoticeSeen, getVtInputNoticeVersion } from '../config/ui-state.js';
17
+ import { getMouseNoticeVersion, getVtInputNoticeVersion } from '../config/ui-state.js';
18
18
  import { getLogger } from '../logging/logger.js';
19
19
  /**
20
- * The §6.1 notice (mouse-wheel-region-routing). Shown at most once, ever.
20
+ * The revision of the mouse notice a user must have seen for it to stay quiet
21
+ * (`state.json::mouseNoticeVersion`, `0` when absent).
21
22
  *
22
- * R-3 is the only part of wheel region routing that reaches users who never
23
- * scroll, and it REMOVES a gesture — drag to select — that is used more often
24
- * than the one being added. A README is consulted only after the belief
25
- * "aragon broke copy/paste" has already formed.
23
+ * BUMP IT WHENEVER THE ADVICE CHANGES, never for a rewording that leaves the
24
+ * recommended actions alone — the same rule `VT_INPUT_NOTICE_VERSION` below
25
+ * carries, and for the same reason.
26
+ *
27
+ * `1` = the first text that names DRAG-SELECT and `/mouse`. `0` = the 0.6.2 text
28
+ * that taught the Shift bypass, recorded back when this was a boolean.
26
29
  */
27
- const MOUSE_SELECTION_NOTICE = 'Mouse wheel scrolls the transcript. Hold Shift to select text, ' +
28
- 'or turn it off with `aragon config set mouse false`.';
30
+ export const MOUSE_NOTICE_VERSION = 1;
31
+ /**
32
+ * The one-shot mouse notice (tui-selection-and-scroll-follow §5.2 row 29).
33
+ *
34
+ * IT NO LONGER TEACHES THE SHIFT WORKAROUND. That text was a workaround told
35
+ * once, in a line that scrolls away, naming a key that is not portable — Shift
36
+ * on xterm / VTE / Windows Terminal, Fn on macOS Terminal, a preference
37
+ * elsewhere — and it collided with our own Shift+wheel binding. The user report
38
+ * this feature exists for is the evidence that it was not enough (D-1).
39
+ *
40
+ * TWO TEXTS, because a `mouseSelect: false` session must not be told about a
41
+ * gesture that is not running — the same rule the vt-input notice follows below,
42
+ * and the reason `MouseNoticeOptions` carries the flag rather than this module
43
+ * re-deriving it.
44
+ */
45
+ function mouseNoticeText(selectEnabled) {
46
+ if (!selectEnabled) {
47
+ return ('Mouse wheel scrolls the transcript. Drag-select is off (mouseSelect); ' +
48
+ '/mouse off hands the mouse back to your terminal for this session.');
49
+ }
50
+ return ('Mouse wheel scrolls the transcript, and dragging selects text - releasing ' +
51
+ 'copies it. /mouse off hands the mouse back to your terminal for this session.');
52
+ }
29
53
  /**
30
54
  * The §5.1 notice (tui-render-performance). Shown once per run, and only when
31
55
  * the user's own `transcriptRetain` was below `transcriptWindow`.
@@ -142,16 +166,24 @@ export function useStartupNotices(dispatch, mouseNotice, retainNotice, vtInputNo
142
166
  const noticeRef = useRef(mouseNotice);
143
167
  noticeRef.current = mouseNotice;
144
168
  const mouseEnabled = mouseNotice?.enabled ?? false;
169
+ const mouseSelectEnabled = mouseNotice?.selectEnabled ?? false;
145
170
  const mouseNoticeShown = useRef(false);
146
171
  useEffect(() => {
147
172
  if (!mouseEnabled || mouseNoticeShown.current)
148
173
  return;
149
- if (getMouseNoticeSeen())
174
+ // A VERSION, NOT THE OLD BOOLEAN (P1-8 / AC-16). The audience for the
175
+ // corrected text is exactly the set of users who already have
176
+ // `mouseNoticeSeen: true` on disk from the text it replaces, so reading that
177
+ // flag would make this change inert for everyone it is for.
178
+ //
179
+ // `>=`, not `!==`: a state file written by a NEWER build (a downgrade, or a
180
+ // shared home directory) has already told this user everything below.
181
+ if (getMouseNoticeVersion() >= MOUSE_NOTICE_VERSION)
150
182
  return;
151
183
  mouseNoticeShown.current = true;
152
- dispatch({ type: 'notice', level: 'info', text: MOUSE_SELECTION_NOTICE });
184
+ dispatch({ type: 'notice', level: 'info', text: mouseNoticeText(mouseSelectEnabled) });
153
185
  noticeRef.current?.onSeen();
154
- }, [mouseEnabled, dispatch]);
186
+ }, [mouseEnabled, mouseSelectEnabled, dispatch]);
155
187
  // The R-1 notice. `warn`, not `info`: unlike the one above it reports a
156
188
  // capability the user was promised and does not have, plus a key that is
157
189
  // actively editing their draft.
@@ -84,6 +84,14 @@ export function useWheelRouting(options) {
84
84
  }
85
85
  }, [flush]);
86
86
  const route = useCallback((event) => {
87
+ // The channel now carries press / drag / release as well
88
+ // (tui-selection-and-scroll-follow §4.4.2). ONE LINE, AT THE TOP, and the
89
+ // rest of this module is untouched: widening the single channel rather
90
+ // than adding a second is what keeps arrival order intact between a wheel
91
+ // notch and a button, and each subscriber ignoring what it does not own is
92
+ // the price of that.
93
+ if (event.kind !== 'wheel')
94
+ return;
87
95
  const current = optionsRef.current;
88
96
  const overlay = current.getOverlay();
89
97
  // THE OVERLAY BRANCH IS EVALUATED FIRST AND RETURNS FOR EVERY OVERLAY IT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aragon-agent/cli",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
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.14",
59
+ "@aragon-agent/core": "^0.2.15",
60
60
  "chalk": "^5.6.2",
61
61
  "cli-highlight": "^2.0.0",
62
62
  "commander": "^12.1.0",
@@ -67,6 +67,8 @@
67
67
  "ink-select-input": "^6.0.0",
68
68
  "ink-spinner": "^5.0.0",
69
69
  "react": "^18.3.1",
70
+ "string-width": "^7.2.0",
71
+ "strip-ansi": "^7.1.0",
70
72
  "tinyglobby": "^0.2.17"
71
73
  },
72
74
  "devDependencies": {