@aragon-agent/tui 0.0.0-stage → 0.0.1
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 +27 -0
- package/LICENSE +21 -0
- package/README.md +81 -2
- package/dist/index.d.ts +11 -0
- package/dist/index.js +11 -0
- package/dist/input/control-sequences.d.ts +71 -0
- package/dist/input/control-sequences.js +222 -0
- package/dist/input/csiu-keys.d.ts +66 -0
- package/dist/input/csiu-keys.js +181 -0
- package/dist/input/cursor-report.d.ts +61 -0
- package/dist/input/cursor-report.js +97 -0
- package/dist/input/enter-sequences.d.ts +64 -0
- package/dist/input/enter-sequences.js +153 -0
- package/dist/input/interrupt-gesture.d.ts +18 -0
- package/dist/input/interrupt-gesture.js +19 -0
- package/dist/input/keyboard-enhancement.d.ts +42 -0
- package/dist/input/keyboard-enhancement.js +65 -0
- package/dist/input/keymap.d.ts +20 -0
- package/dist/input/keymap.js +99 -0
- package/dist/input/limits.d.ts +118 -0
- package/dist/input/limits.js +109 -0
- package/dist/input/mouse-events.d.ts +87 -0
- package/dist/input/mouse-events.js +212 -0
- package/dist/input/paste-parse.d.ts +83 -0
- package/dist/input/paste-parse.js +107 -0
- package/dist/input/pointer-router.d.ts +11 -0
- package/dist/input/pointer-router.js +14 -0
- package/dist/input/stdin-filter.d.ts +112 -0
- package/dist/input/stdin-filter.js +657 -0
- package/dist/input/win32-input-mode.d.ts +61 -0
- package/dist/input/win32-input-mode.js +269 -0
- package/dist/model/agent/agent-mode.d.ts +108 -0
- package/dist/model/agent/agent-mode.js +121 -0
- package/dist/model/agent/entry-limits.d.ts +65 -0
- package/dist/model/agent/entry-limits.js +133 -0
- package/dist/model/agent/governance-view.d.ts +40 -0
- package/dist/model/agent/governance-view.js +40 -0
- package/dist/model/agent/invocation-card.d.ts +77 -0
- package/dist/model/agent/invocation-card.js +169 -0
- package/dist/model/agent/model-probe-limits.d.ts +39 -0
- package/dist/model/agent/model-probe-limits.js +25 -0
- package/dist/model/agent/model-probe.d.ts +104 -0
- package/dist/model/agent/model-probe.js +391 -0
- package/dist/model/agent/queued-messages.d.ts +23 -0
- package/dist/model/agent/queued-messages.js +49 -0
- package/dist/model/agent/reducer.d.ts +857 -0
- package/dist/model/agent/reducer.js +1646 -0
- package/dist/model/agent/retry-view.d.ts +68 -0
- package/dist/model/agent/retry-view.js +95 -0
- package/dist/model/agent/usage.d.ts +47 -0
- package/dist/model/agent/usage.js +84 -0
- package/dist/model/compaction/limits.d.ts +61 -0
- package/dist/model/compaction/limits.js +64 -0
- package/dist/model/compaction/meter.d.ts +276 -0
- package/dist/model/compaction/meter.js +512 -0
- package/dist/model/compaction/pressure.d.ts +163 -0
- package/dist/model/compaction/pressure.js +199 -0
- package/dist/model/compaction/reason-text.d.ts +36 -0
- package/dist/model/compaction/reason-text.js +78 -0
- package/dist/model/compaction/types.d.ts +360 -0
- package/dist/model/compaction/types.js +22 -0
- package/dist/model/config/governance-config.d.ts +125 -0
- package/dist/model/config/governance-config.js +164 -0
- package/dist/model/config/kit-resolution.d.ts +93 -0
- package/dist/model/config/kit-resolution.js +226 -0
- package/dist/model/config/model-kits.d.ts +225 -0
- package/dist/model/config/model-kits.js +302 -0
- package/dist/model/config/model-profile-resolution.d.ts +28 -0
- package/dist/model/config/model-profile-resolution.js +88 -0
- package/dist/model/config/model-profiles.d.ts +103 -0
- package/dist/model/config/model-profiles.js +188 -0
- package/dist/model/config/model-settings-types.d.ts +71 -0
- package/dist/model/config/model-settings-types.js +18 -0
- package/dist/model/config/schema.d.ts +1645 -0
- package/dist/model/config/schema.js +1383 -0
- package/dist/model/fast/limits.d.ts +152 -0
- package/dist/model/fast/limits.js +152 -0
- package/dist/model/fast/resolve.d.ts +44 -0
- package/dist/model/fast/resolve.js +107 -0
- package/dist/model/fast/task-summary-types.d.ts +66 -0
- package/dist/model/fast/task-summary-types.js +17 -0
- package/dist/model/fast/types.d.ts +141 -0
- package/dist/model/fast/types.js +14 -0
- package/dist/model/governance/governed-dispatch.d.ts +19 -0
- package/dist/model/governance/governed-dispatch.js +17 -0
- package/dist/model/governance/limits.d.ts +107 -0
- package/dist/model/governance/limits.js +131 -0
- package/dist/model/governance/posture.d.ts +35 -0
- package/dist/model/governance/posture.js +59 -0
- package/dist/model/governance/rules/events-table.d.ts +46 -0
- package/dist/model/governance/rules/events-table.js +94 -0
- package/dist/model/governance/types.d.ts +661 -0
- package/dist/model/governance/types.js +27 -0
- package/dist/model/logging/levels.d.ts +40 -0
- package/dist/model/logging/levels.js +59 -0
- package/dist/model/logging/log-port.d.ts +38 -0
- package/dist/model/logging/log-port.js +41 -0
- package/dist/model/logging/secret-registry.d.ts +32 -0
- package/dist/model/logging/secret-registry.js +73 -0
- package/dist/model/proc/limits.d.ts +214 -0
- package/dist/model/proc/limits.js +221 -0
- package/dist/model/proc/progress.d.ts +47 -0
- package/dist/model/proc/progress.js +163 -0
- package/dist/model/proc/types.d.ts +269 -0
- package/dist/model/proc/types.js +15 -0
- package/dist/model/proc/wait-view.d.ts +65 -0
- package/dist/model/proc/wait-view.js +66 -0
- package/dist/model/prompts/copy.d.ts +89 -0
- package/dist/model/prompts/copy.js +131 -0
- package/dist/model/prompts/fill.d.ts +51 -0
- package/dist/model/prompts/fill.js +46 -0
- package/dist/model/prompts/limits.d.ts +53 -0
- package/dist/model/prompts/limits.js +53 -0
- package/dist/model/prompts/search.d.ts +58 -0
- package/dist/model/prompts/search.js +146 -0
- package/dist/model/prompts/types.d.ts +204 -0
- package/dist/model/prompts/types.js +13 -0
- package/dist/model/prompts/validate.d.ts +22 -0
- package/dist/model/prompts/validate.js +69 -0
- package/dist/model/team/activity.d.ts +67 -0
- package/dist/model/team/activity.js +130 -0
- package/dist/model/team/limits.d.ts +308 -0
- package/dist/model/team/limits.js +330 -0
- package/dist/model/team/model.d.ts +104 -0
- package/dist/model/team/model.js +150 -0
- package/dist/model/team/panel-rows.d.ts +48 -0
- package/dist/model/team/panel-rows.js +75 -0
- package/dist/model/team/timeline.d.ts +74 -0
- package/dist/model/team/timeline.js +101 -0
- package/dist/model/team/types.d.ts +354 -0
- package/dist/model/team/types.js +13 -0
- package/dist/model/todo/acceptance.d.ts +120 -0
- package/dist/model/todo/acceptance.js +399 -0
- package/dist/model/todo/follow-through.d.ts +138 -0
- package/dist/model/todo/follow-through.js +248 -0
- package/dist/model/todo/limits.d.ts +152 -0
- package/dist/model/todo/limits.js +152 -0
- package/dist/model/todo/panel-rows.d.ts +45 -0
- package/dist/model/todo/panel-rows.js +70 -0
- package/dist/model/todo/plan-sections.d.ts +60 -0
- package/dist/model/todo/plan-sections.js +108 -0
- package/dist/model/todo/row-window.d.ts +51 -0
- package/dist/model/todo/row-window.js +107 -0
- package/dist/model/todo/types.d.ts +124 -0
- package/dist/model/todo/types.js +12 -0
- package/dist/model/tools/human-input.d.ts +212 -0
- package/dist/model/tools/human-input.js +265 -0
- package/dist/model/tools/patch.d.ts +115 -0
- package/dist/model/tools/patch.js +453 -0
- package/dist/model/tools/terminal-output.d.ts +115 -0
- package/dist/model/tools/terminal-output.js +201 -0
- package/dist/model/tools/tool-output-store.d.ts +68 -0
- package/dist/model/tools/tool-output-store.js +102 -0
- package/dist/model/update/limits.d.ts +111 -0
- package/dist/model/update/limits.js +111 -0
- package/dist/model/update/semver.d.ts +89 -0
- package/dist/model/update/semver.js +295 -0
- package/dist/model/update/types.d.ts +169 -0
- package/dist/model/update/types.js +68 -0
- package/dist/testing/governance-fixtures.d.ts +13 -0
- package/dist/testing/governance-fixtures.js +98 -0
- package/dist/testing/mini-vt.d.ts +28 -0
- package/dist/testing/mini-vt.js +158 -0
- package/dist/testing/render-at-width.d.ts +16 -0
- package/dist/testing/render-at-width.js +57 -0
- package/dist/testing/terminal-harness.d.ts +15 -0
- package/dist/testing/terminal-harness.js +40 -0
- package/dist/testing/vt-screen.d.ts +28 -0
- package/dist/testing/vt-screen.js +139 -0
- package/dist/ui/ActivityLine.d.ts +26 -0
- package/dist/ui/ActivityLine.js +51 -0
- package/dist/ui/AutocompletePopup.d.ts +23 -0
- package/dist/ui/AutocompletePopup.js +17 -0
- package/dist/ui/BottomStatusRow.d.ts +10 -0
- package/dist/ui/BottomStatusRow.js +9 -0
- package/dist/ui/Composer.d.ts +115 -0
- package/dist/ui/Composer.js +64 -0
- package/dist/ui/GovernancePanel.d.ts +50 -0
- package/dist/ui/GovernancePanel.js +77 -0
- package/dist/ui/GovernanceRun.d.ts +18 -0
- package/dist/ui/GovernanceRun.js +11 -0
- package/dist/ui/Header.d.ts +48 -0
- package/dist/ui/Header.js +27 -0
- package/dist/ui/Logo.d.ts +32 -0
- package/dist/ui/Logo.js +65 -0
- package/dist/ui/Markdown.d.ts +29 -0
- package/dist/ui/Markdown.js +116 -0
- package/dist/ui/PromptCaret.d.ts +11 -0
- package/dist/ui/PromptCaret.js +31 -0
- package/dist/ui/PromptInput.d.ts +192 -0
- package/dist/ui/PromptInput.js +689 -0
- package/dist/ui/QueuePanel.d.ts +8 -0
- package/dist/ui/QueuePanel.js +9 -0
- package/dist/ui/QueueStatusRow.d.ts +24 -0
- package/dist/ui/QueueStatusRow.js +51 -0
- package/dist/ui/ScrollbackShell.d.ts +132 -0
- package/dist/ui/ScrollbackShell.js +26 -0
- package/dist/ui/SessionOpener.d.ts +30 -0
- package/dist/ui/SessionOpener.js +12 -0
- package/dist/ui/StatusBar.d.ts +130 -0
- package/dist/ui/StatusBar.js +61 -0
- package/dist/ui/TeamPanel.d.ts +76 -0
- package/dist/ui/TeamPanel.js +103 -0
- package/dist/ui/ToastStack.d.ts +8 -0
- package/dist/ui/ToastStack.js +31 -0
- package/dist/ui/TodoPanel.d.ts +52 -0
- package/dist/ui/TodoPanel.js +214 -0
- package/dist/ui/Transcript.d.ts +105 -0
- package/dist/ui/Transcript.js +258 -0
- package/dist/ui/UpdateLine.d.ts +44 -0
- package/dist/ui/UpdateLine.js +129 -0
- package/dist/ui/activity-phrases.d.ts +33 -0
- package/dist/ui/activity-phrases.js +50 -0
- package/dist/ui/capabilities.d.ts +27 -0
- package/dist/ui/capabilities.js +65 -0
- package/dist/ui/clipboard-task.d.ts +29 -0
- package/dist/ui/clipboard-task.js +66 -0
- package/dist/ui/clipboard.d.ts +31 -0
- package/dist/ui/clipboard.js +157 -0
- package/dist/ui/color-runtime.d.ts +5 -0
- package/dist/ui/color-runtime.js +29 -0
- package/dist/ui/composer-input.d.ts +38 -0
- package/dist/ui/composer-input.js +79 -0
- package/dist/ui/composer-limits.d.ts +30 -0
- package/dist/ui/composer-limits.js +45 -0
- package/dist/ui/composer-rows.d.ts +73 -0
- package/dist/ui/composer-rows.js +129 -0
- package/dist/ui/console-bridge.d.ts +19 -0
- package/dist/ui/console-bridge.js +52 -0
- package/dist/ui/density.d.ts +26 -0
- package/dist/ui/density.js +34 -0
- package/dist/ui/display-tab.d.ts +51 -0
- package/dist/ui/display-tab.js +82 -0
- package/dist/ui/editor-navigation.d.ts +55 -0
- package/dist/ui/editor-navigation.js +96 -0
- package/dist/ui/editor-reducer.d.ts +108 -0
- package/dist/ui/editor-reducer.js +187 -0
- package/dist/ui/enter-frames.d.ts +47 -0
- package/dist/ui/enter-frames.js +117 -0
- package/dist/ui/entries/AssistantEntry.d.ts +37 -0
- package/dist/ui/entries/AssistantEntry.js +43 -0
- package/dist/ui/entries/CompactionCard.d.ts +88 -0
- package/dist/ui/entries/CompactionCard.js +222 -0
- package/dist/ui/entries/DiffView.d.ts +61 -0
- package/dist/ui/entries/DiffView.js +103 -0
- package/dist/ui/entries/EntryFrame.d.ts +23 -0
- package/dist/ui/entries/EntryFrame.js +6 -0
- package/dist/ui/entries/FastCard.d.ts +53 -0
- package/dist/ui/entries/FastCard.js +105 -0
- package/dist/ui/entries/GovernanceCard.d.ts +30 -0
- package/dist/ui/entries/GovernanceCard.js +32 -0
- package/dist/ui/entries/InvocationCard.d.ts +20 -0
- package/dist/ui/entries/InvocationCard.js +32 -0
- package/dist/ui/entries/QueuedEntry.d.ts +27 -0
- package/dist/ui/entries/QueuedEntry.js +33 -0
- package/dist/ui/entries/RetryCard.d.ts +56 -0
- package/dist/ui/entries/RetryCard.js +60 -0
- package/dist/ui/entries/ServiceCard.d.ts +82 -0
- package/dist/ui/entries/ServiceCard.js +151 -0
- package/dist/ui/entries/TeamCard.d.ts +55 -0
- package/dist/ui/entries/TeamCard.js +94 -0
- package/dist/ui/entries/TodoCard.d.ts +54 -0
- package/dist/ui/entries/TodoCard.js +98 -0
- package/dist/ui/entries/ToolCard.d.ts +81 -0
- package/dist/ui/entries/ToolCard.js +169 -0
- package/dist/ui/entries/ToolPreview.d.ts +59 -0
- package/dist/ui/entries/ToolPreview.js +208 -0
- package/dist/ui/entries/UserEntry.d.ts +36 -0
- package/dist/ui/entries/UserEntry.js +57 -0
- package/dist/ui/entries/WaitCard.d.ts +37 -0
- package/dist/ui/entries/WaitCard.js +92 -0
- package/dist/ui/exit-snapshot.d.ts +43 -0
- package/dist/ui/exit-snapshot.js +26 -0
- package/dist/ui/frame-differ.d.ts +166 -0
- package/dist/ui/frame-differ.js +354 -0
- package/dist/ui/frame-observer.d.ts +17 -0
- package/dist/ui/frame-observer.js +94 -0
- package/dist/ui/frame-parser.d.ts +7 -0
- package/dist/ui/frame-parser.js +18 -0
- package/dist/ui/gauge.d.ts +39 -0
- package/dist/ui/gauge.js +55 -0
- package/dist/ui/glyphs.d.ts +178 -0
- package/dist/ui/glyphs.js +165 -0
- package/dist/ui/governance-copy.d.ts +69 -0
- package/dist/ui/governance-copy.js +104 -0
- package/dist/ui/governance-status.d.ts +145 -0
- package/dist/ui/governance-status.js +326 -0
- package/dist/ui/gradient.d.ts +11 -0
- package/dist/ui/gradient.js +50 -0
- package/dist/ui/ink-runtime.d.ts +4 -0
- package/dist/ui/ink-runtime.js +51 -0
- package/dist/ui/interaction-copy.d.ts +84 -0
- package/dist/ui/interaction-copy.js +41 -0
- package/dist/ui/interaction-hints.d.ts +44 -0
- package/dist/ui/interaction-hints.js +97 -0
- package/dist/ui/layout/AppShell.d.ts +17 -0
- package/dist/ui/layout/AppShell.js +6 -0
- package/dist/ui/layout/Gutter.d.ts +67 -0
- package/dist/ui/layout/Gutter.js +42 -0
- package/dist/ui/layout/MeasuredEntry.d.ts +21 -0
- package/dist/ui/layout/MeasuredEntry.js +30 -0
- package/dist/ui/layout/OverlayFrame.d.ts +73 -0
- package/dist/ui/layout/OverlayFrame.js +110 -0
- package/dist/ui/layout/ScrollIndicator.d.ts +32 -0
- package/dist/ui/layout/ScrollIndicator.js +22 -0
- package/dist/ui/layout/ScrollViewport.d.ts +40 -0
- package/dist/ui/layout/ScrollViewport.js +222 -0
- package/dist/ui/layout/agents-board.d.ts +102 -0
- package/dist/ui/layout/agents-board.js +389 -0
- package/dist/ui/layout/autocomplete.d.ts +18 -0
- package/dist/ui/layout/autocomplete.js +26 -0
- package/dist/ui/layout/budget.d.ts +43 -0
- package/dist/ui/layout/budget.js +52 -0
- package/dist/ui/layout/cells.d.ts +61 -0
- package/dist/ui/layout/cells.js +156 -0
- package/dist/ui/layout/document-layout.d.ts +13 -0
- package/dist/ui/layout/document-layout.js +10 -0
- package/dist/ui/layout/follow-state.d.ts +138 -0
- package/dist/ui/layout/follow-state.js +148 -0
- package/dist/ui/layout/frame.d.ts +36 -0
- package/dist/ui/layout/frame.js +39 -0
- package/dist/ui/layout/governance-board.d.ts +121 -0
- package/dist/ui/layout/governance-board.js +382 -0
- package/dist/ui/layout/governance-card.d.ts +53 -0
- package/dist/ui/layout/governance-card.js +134 -0
- package/dist/ui/layout/governance-chip.d.ts +38 -0
- package/dist/ui/layout/governance-chip.js +64 -0
- package/dist/ui/layout/governance-panel.d.ts +85 -0
- package/dist/ui/layout/governance-panel.js +358 -0
- package/dist/ui/layout/governance-roster.d.ts +65 -0
- package/dist/ui/layout/governance-roster.js +275 -0
- package/dist/ui/layout/header-hints.d.ts +90 -0
- package/dist/ui/layout/header-hints.js +110 -0
- package/dist/ui/layout/header-left.d.ts +115 -0
- package/dist/ui/layout/header-left.js +206 -0
- package/dist/ui/layout/invocation-card.d.ts +41 -0
- package/dist/ui/layout/invocation-card.js +91 -0
- package/dist/ui/layout/kit-chip.d.ts +50 -0
- package/dist/ui/layout/kit-chip.js +81 -0
- package/dist/ui/layout/overlay-window.d.ts +43 -0
- package/dist/ui/layout/overlay-window.js +51 -0
- package/dist/ui/layout/queue-layout.d.ts +19 -0
- package/dist/ui/layout/queue-layout.js +26 -0
- package/dist/ui/layout/rail.d.ts +7 -0
- package/dist/ui/layout/rail.js +16 -0
- package/dist/ui/layout/scroll-indicator.d.ts +27 -0
- package/dist/ui/layout/scroll-indicator.js +36 -0
- package/dist/ui/layout/scroll.d.ts +37 -0
- package/dist/ui/layout/scroll.js +99 -0
- package/dist/ui/layout/scrollbar-geometry.d.ts +17 -0
- package/dist/ui/layout/scrollbar-geometry.js +13 -0
- package/dist/ui/layout/session-chip.d.ts +52 -0
- package/dist/ui/layout/session-chip.js +64 -0
- package/dist/ui/layout/shortcut-panel-layout.d.ts +191 -0
- package/dist/ui/layout/shortcut-panel-layout.js +321 -0
- package/dist/ui/layout/status-detail-layout.d.ts +9 -0
- package/dist/ui/layout/status-detail-layout.js +79 -0
- package/dist/ui/layout/status-layout.d.ts +140 -0
- package/dist/ui/layout/status-layout.js +262 -0
- package/dist/ui/layout/task-summary-cell.d.ts +61 -0
- package/dist/ui/layout/task-summary-cell.js +65 -0
- package/dist/ui/layout/team-panel.d.ts +18 -0
- package/dist/ui/layout/team-panel.js +25 -0
- package/dist/ui/layout/team-row.d.ts +139 -0
- package/dist/ui/layout/team-row.js +246 -0
- package/dist/ui/layout/todo-layout.d.ts +62 -0
- package/dist/ui/layout/todo-layout.js +102 -0
- package/dist/ui/layout/useTerminalSize.d.ts +13 -0
- package/dist/ui/layout/useTerminalSize.js +50 -0
- package/dist/ui/layout/viewport-geometry.d.ts +29 -0
- package/dist/ui/layout/viewport-geometry.js +28 -0
- package/dist/ui/layout/virtual-window.d.ts +112 -0
- package/dist/ui/layout/virtual-window.js +494 -0
- package/dist/ui/layout/wait-bar.d.ts +34 -0
- package/dist/ui/layout/wait-bar.js +48 -0
- package/dist/ui/layout/wrap-rows.d.ts +26 -0
- package/dist/ui/layout/wrap-rows.js +88 -0
- package/dist/ui/live-clamp.d.ts +14 -0
- package/dist/ui/live-clamp.js +46 -0
- package/dist/ui/markdown-blocks.d.ts +107 -0
- package/dist/ui/markdown-blocks.js +240 -0
- package/dist/ui/overlays/AgentsBoardOverlay.d.ts +57 -0
- package/dist/ui/overlays/AgentsBoardOverlay.js +183 -0
- package/dist/ui/overlays/ConfirmDialog.d.ts +31 -0
- package/dist/ui/overlays/ConfirmDialog.js +44 -0
- package/dist/ui/overlays/GovernanceBoardOverlay.d.ts +41 -0
- package/dist/ui/overlays/GovernanceBoardOverlay.js +76 -0
- package/dist/ui/overlays/GovernanceSettingsPage.d.ts +48 -0
- package/dist/ui/overlays/GovernanceSettingsPage.js +93 -0
- package/dist/ui/overlays/HelpOverlay.d.ts +29 -0
- package/dist/ui/overlays/HelpOverlay.js +232 -0
- package/dist/ui/overlays/KitEditor.d.ts +23 -0
- package/dist/ui/overlays/KitEditor.js +101 -0
- package/dist/ui/overlays/KitManager.d.ts +23 -0
- package/dist/ui/overlays/KitManager.js +104 -0
- package/dist/ui/overlays/KitPicker.d.ts +49 -0
- package/dist/ui/overlays/KitPicker.js +58 -0
- package/dist/ui/overlays/ModelDiscoveryList.d.ts +23 -0
- package/dist/ui/overlays/ModelDiscoveryList.js +161 -0
- package/dist/ui/overlays/ModelPicker.d.ts +26 -0
- package/dist/ui/overlays/ModelPicker.js +63 -0
- package/dist/ui/overlays/ModelProfileEditor.d.ts +29 -0
- package/dist/ui/overlays/ModelProfileEditor.js +168 -0
- package/dist/ui/overlays/ModelProfilePicker.d.ts +48 -0
- package/dist/ui/overlays/ModelProfilePicker.js +231 -0
- package/dist/ui/overlays/PlanReviewOverlay.d.ts +51 -0
- package/dist/ui/overlays/PlanReviewOverlay.js +132 -0
- package/dist/ui/overlays/PromptEditorPage.d.ts +48 -0
- package/dist/ui/overlays/PromptEditorPage.js +227 -0
- package/dist/ui/overlays/PromptLibraryOverlay.d.ts +37 -0
- package/dist/ui/overlays/PromptLibraryOverlay.js +191 -0
- package/dist/ui/overlays/PromptPicker.d.ts +36 -0
- package/dist/ui/overlays/PromptPicker.js +129 -0
- package/dist/ui/overlays/PromptTextArea.d.ts +86 -0
- package/dist/ui/overlays/PromptTextArea.js +141 -0
- package/dist/ui/overlays/QuestionOverlay.d.ts +39 -0
- package/dist/ui/overlays/QuestionOverlay.js +258 -0
- package/dist/ui/overlays/QueueOverlay.d.ts +22 -0
- package/dist/ui/overlays/QueueOverlay.js +79 -0
- package/dist/ui/overlays/SettingsScreen.d.ts +228 -0
- package/dist/ui/overlays/SettingsScreen.js +1037 -0
- package/dist/ui/overlays/ShortcutPanel.d.ts +39 -0
- package/dist/ui/overlays/ShortcutPanel.js +106 -0
- package/dist/ui/overlays/TeamFanoutPage.d.ts +51 -0
- package/dist/ui/overlays/TeamFanoutPage.js +90 -0
- package/dist/ui/overlays/governance-settings.d.ts +79 -0
- package/dist/ui/overlays/governance-settings.js +140 -0
- package/dist/ui/overlays/kit-picker-state.d.ts +87 -0
- package/dist/ui/overlays/kit-picker-state.js +136 -0
- package/dist/ui/overlays/kit-settings-state.d.ts +129 -0
- package/dist/ui/overlays/kit-settings-state.js +268 -0
- package/dist/ui/overlays/model-probe-view.d.ts +128 -0
- package/dist/ui/overlays/model-probe-view.js +225 -0
- package/dist/ui/overlays/model-profile-state.d.ts +177 -0
- package/dist/ui/overlays/model-profile-state.js +301 -0
- package/dist/ui/overlays/prompt-library-state.d.ts +162 -0
- package/dist/ui/overlays/prompt-library-state.js +335 -0
- package/dist/ui/overlays/prompt-picker-state.d.ts +71 -0
- package/dist/ui/overlays/prompt-picker-state.js +98 -0
- package/dist/ui/overlays/team-fanout-state.d.ts +106 -0
- package/dist/ui/overlays/team-fanout-state.js +155 -0
- package/dist/ui/overlays/use-model-probe.d.ts +30 -0
- package/dist/ui/overlays/use-model-probe.js +109 -0
- package/dist/ui/palettes.d.ts +112 -0
- package/dist/ui/palettes.js +130 -0
- package/dist/ui/paste-frames.d.ts +91 -0
- package/dist/ui/paste-frames.js +117 -0
- package/dist/ui/paste-tokens.d.ts +90 -0
- package/dist/ui/paste-tokens.js +147 -0
- package/dist/ui/render-cache.d.ts +81 -0
- package/dist/ui/render-cache.js +196 -0
- package/dist/ui/render-governor.d.ts +54 -0
- package/dist/ui/render-governor.js +78 -0
- package/dist/ui/run-metrics.d.ts +23 -0
- package/dist/ui/run-metrics.js +27 -0
- package/dist/ui/run-status-row.d.ts +63 -0
- package/dist/ui/run-status-row.js +54 -0
- package/dist/ui/screen.d.ts +107 -0
- package/dist/ui/screen.js +234 -0
- package/dist/ui/scrollback/LiveTail.d.ts +115 -0
- package/dist/ui/scrollback/LiveTail.js +48 -0
- package/dist/ui/scrollback/band.d.ts +114 -0
- package/dist/ui/scrollback/band.js +143 -0
- package/dist/ui/scrollback/budget.d.ts +90 -0
- package/dist/ui/scrollback/budget.js +100 -0
- package/dist/ui/scrollback/canvas.d.ts +100 -0
- package/dist/ui/scrollback/canvas.js +114 -0
- package/dist/ui/scrollback/cursor-probe.d.ts +71 -0
- package/dist/ui/scrollback/cursor-probe.js +133 -0
- package/dist/ui/scrollback/drain.d.ts +32 -0
- package/dist/ui/scrollback/drain.js +64 -0
- package/dist/ui/scrollback/exit-summary.d.ts +23 -0
- package/dist/ui/scrollback/exit-summary.js +25 -0
- package/dist/ui/scrollback/limits.d.ts +98 -0
- package/dist/ui/scrollback/limits.js +98 -0
- package/dist/ui/scrollback/live-preview.d.ts +34 -0
- package/dist/ui/scrollback/live-preview.js +130 -0
- package/dist/ui/scrollback/overflow-print.d.ts +108 -0
- package/dist/ui/scrollback/overflow-print.js +120 -0
- package/dist/ui/scrollback/renderer.d.ts +48 -0
- package/dist/ui/scrollback/renderer.js +186 -0
- package/dist/ui/scrollback/scrollback-writer.d.ts +174 -0
- package/dist/ui/scrollback/scrollback-writer.js +648 -0
- package/dist/ui/scrollback/settled-boundary.d.ts +42 -0
- package/dist/ui/scrollback/settled-boundary.js +109 -0
- package/dist/ui/scrollback/tail-anchor.d.ts +71 -0
- package/dist/ui/scrollback/tail-anchor.js +79 -0
- package/dist/ui/scrollback/tail-window.d.ts +73 -0
- package/dist/ui/scrollback/tail-window.js +89 -0
- package/dist/ui/scrollback/use-scrollback-view.d.ts +139 -0
- package/dist/ui/scrollback/use-scrollback-view.js +601 -0
- package/dist/ui/scrollback/writer-shapes.d.ts +127 -0
- package/dist/ui/scrollback/writer-shapes.js +159 -0
- package/dist/ui/scrollbar-controller.d.ts +30 -0
- package/dist/ui/scrollbar-controller.js +124 -0
- package/dist/ui/selection/highlight.d.ts +39 -0
- package/dist/ui/selection/highlight.js +64 -0
- package/dist/ui/selection/screen-mirror.d.ts +24 -0
- package/dist/ui/selection/screen-mirror.js +35 -0
- package/dist/ui/selection/selection-controller.d.ts +104 -0
- package/dist/ui/selection/selection-controller.js +372 -0
- package/dist/ui/selection/selection.d.ts +90 -0
- package/dist/ui/selection/selection.js +223 -0
- package/dist/ui/shortcuts.d.ts +81 -0
- package/dist/ui/shortcuts.js +221 -0
- package/dist/ui/status-feedback.d.ts +35 -0
- package/dist/ui/status-feedback.js +38 -0
- package/dist/ui/stdout-frame-writer.d.ts +74 -0
- package/dist/ui/stdout-frame-writer.js +155 -0
- package/dist/ui/team-status.d.ts +166 -0
- package/dist/ui/team-status.js +252 -0
- package/dist/ui/terminal-plan.d.ts +52 -0
- package/dist/ui/terminal-plan.js +49 -0
- package/dist/ui/theme.d.ts +96 -0
- package/dist/ui/theme.js +130 -0
- package/dist/ui/transcript-text.d.ts +41 -0
- package/dist/ui/transcript-text.js +282 -0
- package/dist/ui/use-height-store.d.ts +31 -0
- package/dist/ui/use-height-store.js +76 -0
- package/dist/ui/use-render-governor.d.ts +39 -0
- package/dist/ui/use-render-governor.js +57 -0
- package/dist/ui/use-wheel-routing.d.ts +57 -0
- package/dist/ui/use-wheel-routing.js +152 -0
- package/dist/ui/win-vt-force.d.ts +136 -0
- package/dist/ui/win-vt-force.js +237 -0
- package/dist/ui/win-vt-input.d.ts +57 -0
- package/dist/ui/win-vt-input.js +62 -0
- package/package.json +86 -4
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounded view state (tui-render-performance L1 / R5).
|
|
3
|
+
*
|
|
4
|
+
* `ViewState.entries` used to grow without any ceiling: `argsRaw`, assistant
|
|
5
|
+
* `text` and `thinking` all concatenated forever, and the entry array was never
|
|
6
|
+
* trimmed. That makes the per-frame cost of the renderer proportional to the
|
|
7
|
+
* total number of characters the session has ever produced, because Ink's
|
|
8
|
+
* `renderNodeToOutput` walks and measures every mounted text node whether or not
|
|
9
|
+
* `overflow: hidden` clips it.
|
|
10
|
+
*
|
|
11
|
+
* Two bounds live here, both pure and React-free:
|
|
12
|
+
* - `appendBounded` caps one field by eliding its MIDDLE, and
|
|
13
|
+
* - `trimEntries` ring-trims the entry array itself.
|
|
14
|
+
*
|
|
15
|
+
* ASCII ONLY. This module is produced outside `src/ui/**`, where no terminal
|
|
16
|
+
* capabilities are available, so the elision marker has to be safe on a legacy
|
|
17
|
+
* `cmd.exe` -- the same rule `PREVIEW_TRUNCATION_MARK` in `reducer.ts` records.
|
|
18
|
+
*/
|
|
19
|
+
import { DEFAULT_TRANSCRIPT_RETAIN } from '../config/schema.js';
|
|
20
|
+
/**
|
|
21
|
+
* The per-field ceilings.
|
|
22
|
+
*
|
|
23
|
+
* `text` is the generous one on purpose: a 256 KiB answer is already far past
|
|
24
|
+
* anything a terminal can usefully show, and the middle is what gets elided, so
|
|
25
|
+
* both the opening and the live cursor survive. `argsRaw` is the tight one --
|
|
26
|
+
* it is a streamed JSON fragment rendered as a 60-character card summary, so
|
|
27
|
+
* anything past a few KiB is invisible by construction.
|
|
28
|
+
*/
|
|
29
|
+
export const ENTRY_LIMITS = {
|
|
30
|
+
text: 262_144,
|
|
31
|
+
thinking: 65_536,
|
|
32
|
+
argsRaw: 16_384,
|
|
33
|
+
};
|
|
34
|
+
/** Marker inserted at the elision point. ASCII -- produced outside `src/ui/**`. */
|
|
35
|
+
export const ELISION_MARK_PREFIX = '\n[... ';
|
|
36
|
+
export const ELISION_MARK_SUFFIX = ' characters elided ...]\n';
|
|
37
|
+
/** Matches a marker this module wrote, so re-elision collapses rather than nests. */
|
|
38
|
+
const ELISION_RE = /\n\[\.\.\. (\d+) characters elided \.\.\.\]\n/;
|
|
39
|
+
/** Fixed cost of the marker, before the digits of the count. */
|
|
40
|
+
const MARKER_FIXED = ELISION_MARK_PREFIX.length + ELISION_MARK_SUFFIX.length;
|
|
41
|
+
/**
|
|
42
|
+
* Fraction of the cap reserved for the HEAD. The tail gets the rest because that
|
|
43
|
+
* is where the cursor is; the head exists so the answer still starts where the
|
|
44
|
+
* model started it.
|
|
45
|
+
*/
|
|
46
|
+
const HEAD_FRACTION = 4;
|
|
47
|
+
/** Undo one elision, so a second one merges into it rather than nesting. */
|
|
48
|
+
function splitElided(prev) {
|
|
49
|
+
const m = ELISION_RE.exec(prev);
|
|
50
|
+
if (!m)
|
|
51
|
+
return { head: '', elided: 0, tail: prev };
|
|
52
|
+
const index = m.index;
|
|
53
|
+
return {
|
|
54
|
+
head: prev.slice(0, index),
|
|
55
|
+
elided: Number.parseInt(m[1], 10) || 0,
|
|
56
|
+
tail: prev.slice(index + m[0].length),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Append `delta` to `prev`, keeping the result at or below `cap` by eliding the
|
|
61
|
+
* MIDDLE. Head and tail are both preserved: the head is the answer's opening,
|
|
62
|
+
* the tail is where the cursor is. Idempotent -- re-eliding an already elided
|
|
63
|
+
* string collapses the two markers into one.
|
|
64
|
+
*
|
|
65
|
+
* The returned string is NEVER longer than `cap` (AC-7). The marker's own digit
|
|
66
|
+
* count is bounded before the tail budget is computed, so the arithmetic cannot
|
|
67
|
+
* overshoot by a digit the way a naive `cap - marker.length` would.
|
|
68
|
+
*/
|
|
69
|
+
export function appendBounded(prev, delta, cap) {
|
|
70
|
+
if (!Number.isFinite(cap) || cap <= 0)
|
|
71
|
+
return '';
|
|
72
|
+
const split = splitElided(prev);
|
|
73
|
+
let head = split.head;
|
|
74
|
+
let tail = split.tail + delta;
|
|
75
|
+
let elided = split.elided;
|
|
76
|
+
// Fast path: nothing has ever been elided and it still fits. This is the path
|
|
77
|
+
// every ordinary answer takes, so it must allocate nothing beyond the concat.
|
|
78
|
+
if (elided === 0 && tail.length <= cap)
|
|
79
|
+
return tail;
|
|
80
|
+
const headBudget = Math.max(0, Math.min(Math.floor(cap / HEAD_FRACTION), cap - MARKER_FIXED - 1));
|
|
81
|
+
if (elided === 0) {
|
|
82
|
+
// First elision: the head has to be carved out of the accumulated text.
|
|
83
|
+
head = tail.slice(0, headBudget);
|
|
84
|
+
tail = tail.slice(headBudget);
|
|
85
|
+
}
|
|
86
|
+
else if (head.length > headBudget) {
|
|
87
|
+
// A later `cap` reduction can leave the stored head oversized; charge the
|
|
88
|
+
// difference to the elision count rather than silently keeping it.
|
|
89
|
+
elided += head.length - headBudget;
|
|
90
|
+
head = head.slice(0, headBudget);
|
|
91
|
+
}
|
|
92
|
+
if (head.length + MARKER_FIXED >= cap) {
|
|
93
|
+
// Degenerate cap (only reachable from a hand-written test): keep the tail.
|
|
94
|
+
return tail.slice(Math.max(0, tail.length - cap));
|
|
95
|
+
}
|
|
96
|
+
// `elided + tail.length` is an UPPER BOUND on the final count, so its digit
|
|
97
|
+
// count is an upper bound on the marker's width. Budgeting against the bound
|
|
98
|
+
// is what makes the `<= cap` guarantee hold without a second pass.
|
|
99
|
+
const digitBound = String(elided + tail.length).length;
|
|
100
|
+
const markerBound = MARKER_FIXED + digitBound;
|
|
101
|
+
const tailKeep = Math.max(0, Math.min(tail.length, cap - head.length - markerBound));
|
|
102
|
+
const total = elided + (tail.length - tailKeep);
|
|
103
|
+
return `${head}${ELISION_MARK_PREFIX}${total}${ELISION_MARK_SUFFIX}${tail.slice(tail.length - tailKeep)}`;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Ring-trim to `retain` entries; returns the SAME array reference when no-op.
|
|
107
|
+
*
|
|
108
|
+
* The identity return is load-bearing: the reducer spreads this result into a
|
|
109
|
+
* new `ViewState` on every append, and a fresh array on every action would
|
|
110
|
+
* defeat the `React.memo` boundaries L2 installs on the transcript.
|
|
111
|
+
*/
|
|
112
|
+
export function trimEntries(entries, retain) {
|
|
113
|
+
const keep = Math.max(1, Math.floor(retain));
|
|
114
|
+
if (entries.length <= keep)
|
|
115
|
+
return { entries, dropped: 0 };
|
|
116
|
+
return { entries: entries.slice(entries.length - keep), dropped: entries.length - keep };
|
|
117
|
+
}
|
|
118
|
+
// ---------------------------------------------------------------------------
|
|
119
|
+
// The resolved retain ceiling
|
|
120
|
+
// ---------------------------------------------------------------------------
|
|
121
|
+
/**
|
|
122
|
+
* `viewReducer` is pure and takes no config, so the resolved `transcriptRetain`
|
|
123
|
+
* reaches it through a module-level singleton -- the shape `prompt-history.ts`
|
|
124
|
+
* already uses for `setHistoryEnabled`. `load.ts` is the ONLY writer.
|
|
125
|
+
*/
|
|
126
|
+
let resolvedRetain = DEFAULT_TRANSCRIPT_RETAIN;
|
|
127
|
+
export function setEntryRetain(value) {
|
|
128
|
+
if (Number.isFinite(value) && value > 0)
|
|
129
|
+
resolvedRetain = Math.floor(value);
|
|
130
|
+
}
|
|
131
|
+
export function entryRetain() {
|
|
132
|
+
return resolvedRetain;
|
|
133
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The governance slice of the view model: the small pure folds `reducer.ts` delegates to
|
|
3
|
+
* (governance-mode section 14.4).
|
|
4
|
+
*
|
|
5
|
+
* Pure: no React, no I/O. ASCII ONLY (`agent/` is glyph-scanned).
|
|
6
|
+
*
|
|
7
|
+
* WHY A FILE OF ITS OWN. `reducer.ts` is already past the file-size ceiling and the repo
|
|
8
|
+
* rule is "wiring-style growth only": each governance `case` in the reducer is a line or
|
|
9
|
+
* two that calls a function here, so the logic is unit-testable without a `ViewState`.
|
|
10
|
+
*/
|
|
11
|
+
import type { AgentMode } from './agent-mode.js';
|
|
12
|
+
import type { GovernanceSnapshot } from '../governance/types.js';
|
|
13
|
+
import { type Posture } from '../governance/posture.js';
|
|
14
|
+
/** The posture half of a `setAgentMode` action. */
|
|
15
|
+
export interface AdoptedPostureInput {
|
|
16
|
+
mode: AgentMode;
|
|
17
|
+
pending: AgentMode | null;
|
|
18
|
+
/** Written from the controller's adopted state; absent for callers that predate postures. */
|
|
19
|
+
posture?: Posture;
|
|
20
|
+
pendingPosture?: Posture | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The pair of posture fields one `setAgentMode` dispatch writes.
|
|
24
|
+
*
|
|
25
|
+
* "NEVER DISPATCH THE REQUESTED VALUE, ONLY THE ADOPTED ONE" (spec 4.3): the controller
|
|
26
|
+
* reports all four values together and the reducer mirrors them, so the badge and the gate
|
|
27
|
+
* cannot disagree. A dispatch that carries only the gate mode (every pre-governance call
|
|
28
|
+
* site) keeps the governance dimension the view already has and swaps the mode half, which
|
|
29
|
+
* is exactly what such a caller meant.
|
|
30
|
+
*/
|
|
31
|
+
export declare function adoptPosture(current: Posture, action: AdoptedPostureInput): {
|
|
32
|
+
posture: Posture;
|
|
33
|
+
pendingPosture: Posture | null;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Fold a pushed snapshot into the view: a snapshot OLDER than the one held, for the same
|
|
37
|
+
* run, is dropped (the wiring throttles, and a late flush must not roll the panel back).
|
|
38
|
+
* Returns the held object unchanged when nothing should change.
|
|
39
|
+
*/
|
|
40
|
+
export declare function foldGovernanceSnapshot(held: GovernanceSnapshot | null, incoming: GovernanceSnapshot): GovernanceSnapshot;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The governance slice of the view model: the small pure folds `reducer.ts` delegates to
|
|
3
|
+
* (governance-mode section 14.4).
|
|
4
|
+
*
|
|
5
|
+
* Pure: no React, no I/O. ASCII ONLY (`agent/` is glyph-scanned).
|
|
6
|
+
*
|
|
7
|
+
* WHY A FILE OF ITS OWN. `reducer.ts` is already past the file-size ceiling and the repo
|
|
8
|
+
* rule is "wiring-style growth only": each governance `case` in the reducer is a line or
|
|
9
|
+
* two that calls a function here, so the logic is unit-testable without a `ViewState`.
|
|
10
|
+
*/
|
|
11
|
+
import { composePosture, isGovernancePosture } from '../governance/posture.js';
|
|
12
|
+
/**
|
|
13
|
+
* The pair of posture fields one `setAgentMode` dispatch writes.
|
|
14
|
+
*
|
|
15
|
+
* "NEVER DISPATCH THE REQUESTED VALUE, ONLY THE ADOPTED ONE" (spec 4.3): the controller
|
|
16
|
+
* reports all four values together and the reducer mirrors them, so the badge and the gate
|
|
17
|
+
* cannot disagree. A dispatch that carries only the gate mode (every pre-governance call
|
|
18
|
+
* site) keeps the governance dimension the view already has and swaps the mode half, which
|
|
19
|
+
* is exactly what such a caller meant.
|
|
20
|
+
*/
|
|
21
|
+
export function adoptPosture(current, action) {
|
|
22
|
+
const governed = isGovernancePosture(current);
|
|
23
|
+
const posture = action.posture ?? composePosture(action.mode, governed);
|
|
24
|
+
const pendingPosture = action.pendingPosture !== undefined
|
|
25
|
+
? action.pendingPosture
|
|
26
|
+
: action.pending === null
|
|
27
|
+
? null
|
|
28
|
+
: composePosture(action.pending, governed);
|
|
29
|
+
return { posture, pendingPosture };
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Fold a pushed snapshot into the view: a snapshot OLDER than the one held, for the same
|
|
33
|
+
* run, is dropped (the wiring throttles, and a late flush must not roll the panel back).
|
|
34
|
+
* Returns the held object unchanged when nothing should change.
|
|
35
|
+
*/
|
|
36
|
+
export function foldGovernanceSnapshot(held, incoming) {
|
|
37
|
+
if (held !== null && held.runId === incoming.runId && incoming.rev < held.rev)
|
|
38
|
+
return held;
|
|
39
|
+
return incoming;
|
|
40
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Invocation cards (tui-invocation-cards): what a transcript shows INSTEAD of the
|
|
3
|
+
* system prompt a command submitted on the user's behalf.
|
|
4
|
+
*
|
|
5
|
+
* Pure and total: no IO, no React, no Ink, nothing but `import type`. ASCII ONLY -
|
|
6
|
+
* `src/agent/**` new files sit inside the `glyphs.test.ts` scan scope.
|
|
7
|
+
*
|
|
8
|
+
* ONE CONSTRUCTOR (I-3). `buildInvocationCard` is the only function that turns raw
|
|
9
|
+
* command-layer material into a card, `App.submitMessage` is its only caller, and
|
|
10
|
+
* `sanitizeInvocationCard` (the session-load path) shares its normaliser so a card
|
|
11
|
+
* written today and a card read back tomorrow cannot drift apart.
|
|
12
|
+
*
|
|
13
|
+
* ORDER IS REDACT -> NORMALISE -> LIMIT, and it is the load-bearing part (I-6). Cut
|
|
14
|
+
* first and a secret that straddles the cut leaves a prefix shorter than the
|
|
15
|
+
* redaction patterns' minimum length: the half-key sails through into the
|
|
16
|
+
* transcript, the session file and the exit replay.
|
|
17
|
+
*/
|
|
18
|
+
export type InvocationVariant = 'skill' | 'team' | 'todo' | 'govern';
|
|
19
|
+
/** Everything one card needs; persisted, queued and rendered in this one shape. */
|
|
20
|
+
export interface InvocationCard {
|
|
21
|
+
readonly variant: InvocationVariant;
|
|
22
|
+
/** Skill name / 'continue' / 'resume'; '' for team. */
|
|
23
|
+
readonly name: string;
|
|
24
|
+
/** What the user typed (or its equivalent), redacted and capped; also `Entry.text`. */
|
|
25
|
+
readonly commandLine: string;
|
|
26
|
+
/** The user's own words (args / brief), redacted and trimmed; may be ''. */
|
|
27
|
+
readonly input: string;
|
|
28
|
+
/** Characters cut from `input`; 0 when nothing was cut. */
|
|
29
|
+
readonly inputHidden: number;
|
|
30
|
+
/** Fact fragments, each at most `factMaxChars`, at most `factsMax` of them. */
|
|
31
|
+
readonly facts: readonly string[];
|
|
32
|
+
/** One disclosure sentence. */
|
|
33
|
+
readonly note?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The renderer, the height estimate and the loader all read THESE numbers (I-4).
|
|
37
|
+
* A card's height is a function of its data and these limits, so it is bounded:
|
|
38
|
+
* header + `inputMaxLines` + hidden tail + note.
|
|
39
|
+
*/
|
|
40
|
+
export declare const INVOCATION_LIMITS: {
|
|
41
|
+
readonly commandLineMaxChars: 2000;
|
|
42
|
+
readonly inputMaxChars: 480;
|
|
43
|
+
readonly inputMaxLines: 8;
|
|
44
|
+
readonly nameMaxChars: 64;
|
|
45
|
+
readonly factsMax: 5;
|
|
46
|
+
readonly factMaxChars: 28;
|
|
47
|
+
readonly noteMaxChars: 140;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Raw material from the command layer: NOT redacted, NOT trimmed. Commands must not
|
|
51
|
+
* cut or scrub it themselves - both happen exactly once, in `buildInvocationCard`.
|
|
52
|
+
*/
|
|
53
|
+
export interface InvocationCardInput {
|
|
54
|
+
variant: InvocationVariant;
|
|
55
|
+
name?: string;
|
|
56
|
+
commandLine: string;
|
|
57
|
+
input?: string;
|
|
58
|
+
facts?: readonly string[];
|
|
59
|
+
note?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Total, never throws. `redact` is injected (the same closure `Command:` echo uses) so
|
|
63
|
+
* this module depends on nothing; the default is the identity for tests and the loader.
|
|
64
|
+
*/
|
|
65
|
+
export declare function buildInvocationCard(input: InvocationCardInput, redact?: (text: string) => string): InvocationCard;
|
|
66
|
+
/**
|
|
67
|
+
* Session-load path: `null` for anything that is not a plausible card, so the caller
|
|
68
|
+
* drops the field and the entry degrades to a plain user message (I-7). Re-derives
|
|
69
|
+
* `inputHidden` from nothing - it trusts the stored count only when it is a sane integer.
|
|
70
|
+
*/
|
|
71
|
+
export declare function sanitizeInvocationCard(value: unknown): InvocationCard | null;
|
|
72
|
+
/**
|
|
73
|
+
* Emergency kill switch (`ARAGON_NO_INVOCATION_CARDS=1`): every command and the App fall
|
|
74
|
+
* back to the pre-card behaviour. Read at call time, not import time, so a test (or a
|
|
75
|
+
* wrapper script) that sets the variable after load is honoured.
|
|
76
|
+
*/
|
|
77
|
+
export declare function invocationCardsEnabled(env?: NodeJS.ProcessEnv): boolean;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Invocation cards (tui-invocation-cards): what a transcript shows INSTEAD of the
|
|
3
|
+
* system prompt a command submitted on the user's behalf.
|
|
4
|
+
*
|
|
5
|
+
* Pure and total: no IO, no React, no Ink, nothing but `import type`. ASCII ONLY -
|
|
6
|
+
* `src/agent/**` new files sit inside the `glyphs.test.ts` scan scope.
|
|
7
|
+
*
|
|
8
|
+
* ONE CONSTRUCTOR (I-3). `buildInvocationCard` is the only function that turns raw
|
|
9
|
+
* command-layer material into a card, `App.submitMessage` is its only caller, and
|
|
10
|
+
* `sanitizeInvocationCard` (the session-load path) shares its normaliser so a card
|
|
11
|
+
* written today and a card read back tomorrow cannot drift apart.
|
|
12
|
+
*
|
|
13
|
+
* ORDER IS REDACT -> NORMALISE -> LIMIT, and it is the load-bearing part (I-6). Cut
|
|
14
|
+
* first and a secret that straddles the cut leaves a prefix shorter than the
|
|
15
|
+
* redaction patterns' minimum length: the half-key sails through into the
|
|
16
|
+
* transcript, the session file and the exit replay.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* The renderer, the height estimate and the loader all read THESE numbers (I-4).
|
|
20
|
+
* A card's height is a function of its data and these limits, so it is bounded:
|
|
21
|
+
* header + `inputMaxLines` + hidden tail + note.
|
|
22
|
+
*/
|
|
23
|
+
export const INVOCATION_LIMITS = {
|
|
24
|
+
commandLineMaxChars: 2000,
|
|
25
|
+
inputMaxChars: 480,
|
|
26
|
+
inputMaxLines: 8,
|
|
27
|
+
nameMaxChars: 64,
|
|
28
|
+
factsMax: 5,
|
|
29
|
+
factMaxChars: 28,
|
|
30
|
+
noteMaxChars: 140,
|
|
31
|
+
};
|
|
32
|
+
const VARIANTS = ['skill', 'team', 'todo', 'govern'];
|
|
33
|
+
// C0 except TAB (\x09) and LF (\x0a), then DEL and C1 (which includes the 8-bit CSI
|
|
34
|
+
// \x9b). Matches the range `QueueOverlay` strips, so the card is no more permissive.
|
|
35
|
+
// eslint-disable-next-line no-control-regex
|
|
36
|
+
const CONTROL_CHARS = /[\x00-\x08\x0b-\x1f\x7f-\x9f]/g;
|
|
37
|
+
const CAP_MARK = '...';
|
|
38
|
+
/** Cut at a code-point boundary: a surrogate pair is never split. */
|
|
39
|
+
function sliceCodePoints(text, count) {
|
|
40
|
+
if (count <= 0)
|
|
41
|
+
return '';
|
|
42
|
+
if (text.length <= count)
|
|
43
|
+
return text;
|
|
44
|
+
let end = count;
|
|
45
|
+
const last = text.charCodeAt(end - 1);
|
|
46
|
+
// A high surrogate at the cut would orphan its low half.
|
|
47
|
+
if (last >= 0xd800 && last <= 0xdbff)
|
|
48
|
+
end -= 1;
|
|
49
|
+
return text.slice(0, end);
|
|
50
|
+
}
|
|
51
|
+
function countCodePoints(text) {
|
|
52
|
+
let count = 0;
|
|
53
|
+
for (const _ of text)
|
|
54
|
+
count += 1;
|
|
55
|
+
return count;
|
|
56
|
+
}
|
|
57
|
+
/** CRLF and bare CR to LF (a bare CR returns Ink's cursor to column 0), then strip controls. */
|
|
58
|
+
function normalizeText(text) {
|
|
59
|
+
return text.replace(/\r\n?/g, '\n').replace(CONTROL_CHARS, '');
|
|
60
|
+
}
|
|
61
|
+
function capCommandLine(text) {
|
|
62
|
+
const max = INVOCATION_LIMITS.commandLineMaxChars;
|
|
63
|
+
if (text.length <= max)
|
|
64
|
+
return text;
|
|
65
|
+
return sliceCodePoints(text, max - CAP_MARK.length) + CAP_MARK;
|
|
66
|
+
}
|
|
67
|
+
function capInput(text) {
|
|
68
|
+
const trimmed = text.trim();
|
|
69
|
+
if (trimmed === '')
|
|
70
|
+
return { input: '', hidden: 0 };
|
|
71
|
+
const lines = trimmed.split('\n');
|
|
72
|
+
let kept = lines.length > INVOCATION_LIMITS.inputMaxLines
|
|
73
|
+
? lines.slice(0, INVOCATION_LIMITS.inputMaxLines).join('\n') : trimmed;
|
|
74
|
+
kept = sliceCodePoints(kept, INVOCATION_LIMITS.inputMaxChars).trimEnd();
|
|
75
|
+
return { input: kept, hidden: countCodePoints(trimmed) - countCodePoints(kept) };
|
|
76
|
+
}
|
|
77
|
+
function capSingleLine(text, max) {
|
|
78
|
+
const flat = text.replace(/\s+/g, ' ').trim();
|
|
79
|
+
if (countCodePoints(flat) <= max)
|
|
80
|
+
return flat;
|
|
81
|
+
return sliceCodePoints(flat, max - CAP_MARK.length) + CAP_MARK;
|
|
82
|
+
}
|
|
83
|
+
function capFacts(facts) {
|
|
84
|
+
return facts
|
|
85
|
+
.map((fact) => capSingleLine(fact, INVOCATION_LIMITS.factMaxChars))
|
|
86
|
+
.filter((fact) => fact !== '')
|
|
87
|
+
.slice(0, INVOCATION_LIMITS.factsMax);
|
|
88
|
+
}
|
|
89
|
+
function capNote(note) {
|
|
90
|
+
if (note === undefined)
|
|
91
|
+
return undefined;
|
|
92
|
+
const capped = capSingleLine(note, INVOCATION_LIMITS.noteMaxChars);
|
|
93
|
+
return capped === '' ? undefined : capped;
|
|
94
|
+
}
|
|
95
|
+
/** Shared by the write path and the load path so the two cannot diverge. */
|
|
96
|
+
function assemble(parts) {
|
|
97
|
+
const { input, hidden } = capInput(normalizeText(parts.input));
|
|
98
|
+
const note = capNote(normalizeText(parts.note ?? ''));
|
|
99
|
+
return {
|
|
100
|
+
variant: parts.variant,
|
|
101
|
+
name: capSingleLine(normalizeText(parts.name), INVOCATION_LIMITS.nameMaxChars),
|
|
102
|
+
commandLine: capCommandLine(normalizeText(parts.commandLine).trim()),
|
|
103
|
+
input,
|
|
104
|
+
inputHidden: hidden,
|
|
105
|
+
facts: capFacts(parts.facts.map(normalizeText)),
|
|
106
|
+
...(note !== undefined ? { note } : {}),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Total, never throws. `redact` is injected (the same closure `Command:` echo uses) so
|
|
111
|
+
* this module depends on nothing; the default is the identity for tests and the loader.
|
|
112
|
+
*/
|
|
113
|
+
export function buildInvocationCard(input, redact = (text) => text) {
|
|
114
|
+
const scrub = (text) => {
|
|
115
|
+
if (text === undefined)
|
|
116
|
+
return '';
|
|
117
|
+
try {
|
|
118
|
+
return redact(text);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
return '';
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
return assemble({
|
|
125
|
+
variant: input.variant,
|
|
126
|
+
name: scrub(input.name),
|
|
127
|
+
commandLine: scrub(input.commandLine),
|
|
128
|
+
input: scrub(input.input),
|
|
129
|
+
facts: (input.facts ?? []).map((fact) => scrub(fact)),
|
|
130
|
+
note: input.note === undefined ? undefined : scrub(input.note),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function asString(value) {
|
|
134
|
+
return typeof value === 'string' ? value : null;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Session-load path: `null` for anything that is not a plausible card, so the caller
|
|
138
|
+
* drops the field and the entry degrades to a plain user message (I-7). Re-derives
|
|
139
|
+
* `inputHidden` from nothing - it trusts the stored count only when it is a sane integer.
|
|
140
|
+
*/
|
|
141
|
+
export function sanitizeInvocationCard(value) {
|
|
142
|
+
if (typeof value !== 'object' || value === null)
|
|
143
|
+
return null;
|
|
144
|
+
const raw = value;
|
|
145
|
+
const variant = VARIANTS.find((candidate) => candidate === raw.variant);
|
|
146
|
+
const commandLine = asString(raw.commandLine);
|
|
147
|
+
if (variant === undefined || commandLine === null)
|
|
148
|
+
return null;
|
|
149
|
+
const name = asString(raw.name) ?? '';
|
|
150
|
+
const input = asString(raw.input) ?? '';
|
|
151
|
+
const facts = Array.isArray(raw.facts)
|
|
152
|
+
? raw.facts.filter((fact) => typeof fact === 'string') : [];
|
|
153
|
+
const note = asString(raw.note) ?? undefined;
|
|
154
|
+
const card = assemble({ variant, name, commandLine, input, facts, note });
|
|
155
|
+
// A stored card that was already capped must keep its recorded `inputHidden`; the
|
|
156
|
+
// re-cap above can only ever add to it.
|
|
157
|
+
const stored = raw.inputHidden;
|
|
158
|
+
const storedHidden = typeof stored === 'number' && Number.isInteger(stored) && stored > 0
|
|
159
|
+
? Math.min(stored, 10_000_000) : 0;
|
|
160
|
+
return { ...card, inputHidden: Math.max(card.inputHidden, storedHidden) };
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Emergency kill switch (`ARAGON_NO_INVOCATION_CARDS=1`): every command and the App fall
|
|
164
|
+
* back to the pre-card behaviour. Read at call time, not import time, so a test (or a
|
|
165
|
+
* wrapper script) that sets the variable after load is honoured.
|
|
166
|
+
*/
|
|
167
|
+
export function invocationCardsEnabled(env = process.env) {
|
|
168
|
+
return env.ARAGON_NO_INVOCATION_CARDS !== '1';
|
|
169
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structural bounds for the profile connection probe (model-profile-connection-test §7).
|
|
3
|
+
*
|
|
4
|
+
* STRUCTURAL, NOT POLICY: nothing here is clamped, persisted or user-tunable. These
|
|
5
|
+
* are the physical limits of one probe - how long a single round trip may take, how
|
|
6
|
+
* many lines and characters a result may occupy, how many models a list page can
|
|
7
|
+
* carry before it must truncate. The user-tunable keys live in `config/schema.ts`.
|
|
8
|
+
*
|
|
9
|
+
* THE OUTPUT-TOKEN CAP IS DELIBERATELY ABSENT. It must come from core's
|
|
10
|
+
* `MIN_MAX_OUTPUT_TOKENS`, or this file becomes a second authority for "how many
|
|
11
|
+
* tokens may this model produce" - which is exactly what `output-limits.ts` exists
|
|
12
|
+
* to prevent.
|
|
13
|
+
*
|
|
14
|
+
* ASCII ONLY: this module lives in `agent/`, which `glyphs.test.ts::inScope` scans.
|
|
15
|
+
*/
|
|
16
|
+
export interface ProbeLimits {
|
|
17
|
+
/** Ceiling on ONE real round trip (`complete`). */
|
|
18
|
+
testTimeoutMs: number;
|
|
19
|
+
/**
|
|
20
|
+
* Sub-budget for the best-effort model list that runs CONCURRENTLY with the
|
|
21
|
+
* completion. It never decides the verdict (§4.3 / RV-P1-1): a slow `/models`
|
|
22
|
+
* that ate the adapter's own 15 s discovery timeout would turn a healthy
|
|
23
|
+
* connection into a false `timeout`.
|
|
24
|
+
*/
|
|
25
|
+
listModelsBudgetMs: number;
|
|
26
|
+
/** Ceiling on a discovery (`listModels`) issued from the list page. */
|
|
27
|
+
discoveryTimeoutMs: number;
|
|
28
|
+
/** Characters of the model's reply kept for the `Reply:` line. */
|
|
29
|
+
replyChars: number;
|
|
30
|
+
/** Characters of a locally composed failure sentence. */
|
|
31
|
+
detailChars: number;
|
|
32
|
+
/** Rows a list page may carry before `truncated` becomes true. */
|
|
33
|
+
maxListedModels: number;
|
|
34
|
+
/** Above this many rows the list page grows a search line (picker parity). */
|
|
35
|
+
searchThreshold: number;
|
|
36
|
+
/** Characters of a model's display name kept in one list row. */
|
|
37
|
+
maxNameChars: number;
|
|
38
|
+
}
|
|
39
|
+
export declare const PROBE_LIMITS: ProbeLimits;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structural bounds for the profile connection probe (model-profile-connection-test §7).
|
|
3
|
+
*
|
|
4
|
+
* STRUCTURAL, NOT POLICY: nothing here is clamped, persisted or user-tunable. These
|
|
5
|
+
* are the physical limits of one probe - how long a single round trip may take, how
|
|
6
|
+
* many lines and characters a result may occupy, how many models a list page can
|
|
7
|
+
* carry before it must truncate. The user-tunable keys live in `config/schema.ts`.
|
|
8
|
+
*
|
|
9
|
+
* THE OUTPUT-TOKEN CAP IS DELIBERATELY ABSENT. It must come from core's
|
|
10
|
+
* `MIN_MAX_OUTPUT_TOKENS`, or this file becomes a second authority for "how many
|
|
11
|
+
* tokens may this model produce" - which is exactly what `output-limits.ts` exists
|
|
12
|
+
* to prevent.
|
|
13
|
+
*
|
|
14
|
+
* ASCII ONLY: this module lives in `agent/`, which `glyphs.test.ts::inScope` scans.
|
|
15
|
+
*/
|
|
16
|
+
export const PROBE_LIMITS = {
|
|
17
|
+
testTimeoutMs: 20_000,
|
|
18
|
+
listModelsBudgetMs: 5_000,
|
|
19
|
+
discoveryTimeoutMs: 20_000,
|
|
20
|
+
replyChars: 60,
|
|
21
|
+
detailChars: 160,
|
|
22
|
+
maxListedModels: 400,
|
|
23
|
+
searchThreshold: 8,
|
|
24
|
+
maxNameChars: 48,
|
|
25
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The connection probe behind `Test connection` and `Discover models`
|
|
3
|
+
* (model-profile-connection-test §4.2-§4.8).
|
|
4
|
+
*
|
|
5
|
+
* WHY THIS IS NOT `ModelRegistry.discoverModels()`: that path folds every exception
|
|
6
|
+
* into `[]` and stores the result in a five-minute process-wide cache. Using it here
|
|
7
|
+
* would (a) collapse "wrong key", "wrong URL" and "this account owns no models" into
|
|
8
|
+
* one sentence, and (b) let a probe of an UNSAVED draft endpoint poison `/model`,
|
|
9
|
+
* `/context` and the main session's window resolution for five minutes. So the probe
|
|
10
|
+
* talks to the adapter directly and classifies by `LLMError.errorType`.
|
|
11
|
+
*
|
|
12
|
+
* WHY `complete()` AND NOT ONLY `listModels()`: a model can be listed and still be
|
|
13
|
+
* unable to generate (gateway aliases, permission layers). One real round trip is the
|
|
14
|
+
* only honest answer to "does this work right now", and it is also the only evidence
|
|
15
|
+
* that can produce `model_not_found`.
|
|
16
|
+
*
|
|
17
|
+
* ASCII ONLY: `agent/` is inside `glyphs.test.ts::inScope`.
|
|
18
|
+
*/
|
|
19
|
+
import { type ProviderRegistry } from '@aragon-agent/core';
|
|
20
|
+
/** Every way a probe can fail, once and for all (§7). */
|
|
21
|
+
export type ProbeFailureKind = 'missing_key' | 'unsupported_provider' | 'invalid_base_url' | 'auth' | 'model_not_found' | 'invalid_request' | 'rate_limit' | 'provider_unavailable' | 'network' | 'timeout' | 'cancelled' | 'unknown';
|
|
22
|
+
export interface ProbeTarget {
|
|
23
|
+
provider: string;
|
|
24
|
+
/** `''` means "no model typed yet" - the probe then only lists models. */
|
|
25
|
+
model: string;
|
|
26
|
+
baseUrl: string | null;
|
|
27
|
+
/** The RESOLVED plaintext key from `resolveDraftKey()`, never `editor.apiKey`. */
|
|
28
|
+
apiKey: string | null;
|
|
29
|
+
}
|
|
30
|
+
export interface ProbeRequest extends ProbeTarget {
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
}
|
|
33
|
+
export interface ProbeOutcome {
|
|
34
|
+
ok: boolean;
|
|
35
|
+
/** Fingerprint of the target this outcome describes (§4.6). */
|
|
36
|
+
targetId: string;
|
|
37
|
+
latencyMs: number;
|
|
38
|
+
kind?: ProbeFailureKind;
|
|
39
|
+
/** Locally composed, already redacted sentence. Never provider response text. */
|
|
40
|
+
detail?: string;
|
|
41
|
+
reply?: string;
|
|
42
|
+
usage?: {
|
|
43
|
+
inputTokens: number;
|
|
44
|
+
outputTokens: number;
|
|
45
|
+
};
|
|
46
|
+
availableModels?: number;
|
|
47
|
+
modelListed?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface ModelCandidate {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
contextWindow?: number;
|
|
53
|
+
supportsTools: boolean;
|
|
54
|
+
}
|
|
55
|
+
export interface DiscoveryOutcome {
|
|
56
|
+
ok: boolean;
|
|
57
|
+
connectionId: string;
|
|
58
|
+
kind?: ProbeFailureKind;
|
|
59
|
+
detail?: string;
|
|
60
|
+
models: ModelCandidate[];
|
|
61
|
+
truncated: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* How many models the endpoint returned BEFORE truncation. The truncation line
|
|
64
|
+
* needs the real number ("Showing first 400 of 960"), and re-deriving it from a
|
|
65
|
+
* clamped array is impossible.
|
|
66
|
+
*/
|
|
67
|
+
total?: number;
|
|
68
|
+
}
|
|
69
|
+
export interface ModelProbe {
|
|
70
|
+
test(request: ProbeRequest): Promise<ProbeOutcome>;
|
|
71
|
+
discover(request: ProbeRequest): Promise<DiscoveryOutcome>;
|
|
72
|
+
targetFingerprint(target: ProbeTarget): string;
|
|
73
|
+
connectionFingerprint(target: ProbeTarget): string;
|
|
74
|
+
}
|
|
75
|
+
export interface ProbeDeps {
|
|
76
|
+
registry: Pick<ProviderRegistry, 'get'>;
|
|
77
|
+
/** Injected clock; tests pin `latencyMs` through it. */
|
|
78
|
+
now?: () => number;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Which key this draft would actually use (§4.2.1).
|
|
82
|
+
*
|
|
83
|
+
* The editor's `apiKey` field is ALWAYS the empty string: it is the replacement
|
|
84
|
+
* input, not the live credential. `finishProfileEditor` resolves `keep` to the
|
|
85
|
+
* saved entry key and `shared` to `null`, and the runtime then falls back to the
|
|
86
|
+
* shared per-provider key. Without this table the most common path - editing an
|
|
87
|
+
* existing profile, whose credential mode defaults to `keep` - would report
|
|
88
|
+
* `(no key)` for a profile that has one.
|
|
89
|
+
*/
|
|
90
|
+
export declare function resolveDraftKey(input: {
|
|
91
|
+
credentialMode: 'keep' | 'replace' | 'shared';
|
|
92
|
+
draftKey: string;
|
|
93
|
+
existingKey: string | null;
|
|
94
|
+
sharedKey?: string;
|
|
95
|
+
}): string | null;
|
|
96
|
+
/**
|
|
97
|
+
* The host a failure sentence names - same four clauses as
|
|
98
|
+
* `profileEndpointSummary()` in `ui/overlays/ModelProfilePicker.tsx`, which this
|
|
99
|
+
* layer may not import (agent -> ui would invert the layering). `model-probe.test.ts`
|
|
100
|
+
* asserts the two agree, so the duplication cannot drift silently.
|
|
101
|
+
*/
|
|
102
|
+
export declare function endpointHost(baseUrl: string | null): string;
|
|
103
|
+
/** Create the probe port. One instance per App; `SettingsScreen` only passes it down. */
|
|
104
|
+
export declare function createModelProbe(deps: ProbeDeps): ModelProbe;
|