@aria-cli/cli 1.0.50 → 1.0.51
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/bin/aria.mjs +1 -1
- package/dist/.tsbuildinfo +1 -0
- package/dist/attached-local-control-client.js +826 -0
- package/dist/bootstrap-local-control-client.js +2 -0
- package/dist/capability-aware-method-proxy.js +42 -0
- package/dist/cli-context.js +160 -0
- package/dist/commands/arions.js +174 -0
- package/dist/commands/auth.js +123 -0
- package/dist/commands/daemon.js +245 -0
- package/dist/commands/definitions.js +176 -0
- package/dist/commands/index.js +74 -0
- package/dist/commands/login-handler.js +1108 -0
- package/dist/commands/logout-handler.js +92 -0
- package/dist/commands/memory-handlers.js +89 -0
- package/dist/commands/pairing.js +60 -0
- package/dist/commands/runtime-cutover-reset-command.js +12 -0
- package/dist/commands/runtime-cutover-reset.js +265 -0
- package/dist/commands/terminal-setup.js +84 -0
- package/dist/config/aria-config.js +238 -0
- package/dist/config/index.js +3 -0
- package/dist/config/loader.js +97 -0
- package/dist/config.js +142 -0
- package/dist/daemon-info.js +10 -0
- package/dist/ensure-daemon.js +128 -0
- package/dist/entrypoints/command-mode.js +5 -0
- package/dist/entrypoints/daemon.js +50 -0
- package/dist/entrypoints/headless-stdio.js +25 -0
- package/dist/entrypoints/interactive.js +80 -0
- package/dist/event-loop-watchdog.js +73 -0
- package/dist/headless/auth-orchestrator.js +508 -0
- package/dist/headless/auth-service.js +43 -0
- package/dist/headless/bootstrap-fast-path.js +112 -0
- package/dist/headless/call-command.js +143 -0
- package/dist/headless/daemon-service.js +318 -0
- package/dist/headless/hook-actions.js +235 -0
- package/dist/headless/hook-service.js +42 -0
- package/dist/headless/kernel-services.js +216 -0
- package/dist/headless/kernel.js +785 -0
- package/dist/headless/operations/arion.js +119 -0
- package/dist/headless/operations/auth.js +45 -0
- package/dist/headless/operations/client.js +31 -0
- package/dist/headless/operations/config.js +69 -0
- package/dist/headless/operations/daemon.js +47 -0
- package/dist/headless/operations/hook.js +56 -0
- package/dist/headless/operations/index.js +11 -0
- package/dist/headless/operations/memory.js +102 -0
- package/dist/headless/operations/message.js +279 -0
- package/dist/headless/operations/model.js +100 -0
- package/dist/headless/operations/peer.js +56 -0
- package/dist/headless/operations/run.js +24 -0
- package/dist/headless/operations/session.js +90 -0
- package/dist/headless/operations/system.js +19 -0
- package/dist/headless/operations/utils.js +35 -0
- package/dist/headless/run-orchestrator.js +703 -0
- package/dist/headless/stdio-server.js +439 -0
- package/dist/history/SessionHistory.js +8 -0
- package/dist/history/SessionHistoryClient.js +186 -0
- package/dist/history/conversation-message.js +112 -0
- package/dist/history/index.js +8 -0
- package/dist/history/jsonl-replay.js +154 -0
- package/dist/history/repair-tool-pairing.js +84 -0
- package/dist/history/stall-phase-bridge.js +11 -0
- package/dist/history/turn-accumulator.js +427 -0
- package/dist/index.js +7 -0
- package/dist/ink-repl.js +4183 -0
- package/dist/local-control-bootstrap.js +26 -0
- package/dist/local-control-client.js +2 -0
- package/dist/local-control-error-reporting.js +34 -0
- package/dist/local-control-http-client.js +362 -0
- package/dist/local-control-lazy-wrapper.js +363 -0
- package/dist/local-control-manager.js +146 -0
- package/dist/main.js +38 -0
- package/dist/network-security.js +62 -0
- package/dist/networking-server.js +38 -0
- package/dist/peer-identity.js +23 -0
- package/dist/polling-subscription.js +34 -0
- package/dist/relaunch.js +588 -0
- package/dist/release-notes.js +35 -0
- package/dist/repl-cleanup.js +47 -0
- package/dist/runtime/configure-bun-sqlite.js +3 -0
- package/dist/runtime/crash-handlers.js +111 -0
- package/dist/runtime/interactive-invocation.js +39 -0
- package/dist/runtime/internal-mode.js +14 -0
- package/dist/runtime/launch-spec.js +64 -0
- package/dist/runtime/owner-lease.js +44 -0
- package/dist/runtime/public-mode.js +20 -0
- package/dist/runtime/run-internal-mode.js +18 -0
- package/dist/runtime/runtime-kind.js +32 -0
- package/dist/runtime/spawn-aria.js +38 -0
- package/dist/selectable-client.js +2 -0
- package/dist/selectable-peer.js +2 -0
- package/dist/session.js +203 -0
- package/dist/slash-commands.js +80 -0
- package/dist/sounds.js +210 -0
- package/dist/ui/App.js +526 -0
- package/dist/ui/components/AnthropicMethodPicker.js +6 -0
- package/dist/ui/components/ArionPrompt.js +15 -0
- package/dist/ui/components/AutocompleteDropdown.js +23 -0
- package/dist/ui/components/AutonomySelector.js +55 -0
- package/dist/ui/components/Banner.js +98 -0
- package/dist/ui/components/ConversationHistory.js +175 -0
- package/dist/ui/components/CopilotDeviceLoginFlow.js +88 -0
- package/dist/ui/components/CopilotSourcePicker.js +50 -0
- package/dist/ui/components/Cost.js +10 -0
- package/dist/ui/components/CustomSelect/option-map.js +30 -0
- package/dist/ui/components/CustomSelect/select-option.js +13 -0
- package/dist/ui/components/CustomSelect/select.js +42 -0
- package/dist/ui/components/CustomSelect/use-select-state.js +179 -0
- package/dist/ui/components/CustomSelect/use-select.js +15 -0
- package/dist/ui/components/ErrorDisplay.js +35 -0
- package/dist/ui/components/FallbackToolUseRejectedMessage.js +7 -0
- package/dist/ui/components/FileEditToolUpdatedMessage.js +57 -0
- package/dist/ui/components/HandoffMarker.js +18 -0
- package/dist/ui/components/HighlightedCode.js +21 -0
- package/dist/ui/components/InputArea.js +187 -0
- package/dist/ui/components/Message.js +25 -0
- package/dist/ui/components/OAuthLoginFlow.js +113 -0
- package/dist/ui/components/OutputTruncation.js +35 -0
- package/dist/ui/components/PermissionPrompt.js +79 -0
- package/dist/ui/components/PipelineTimingPanel.js +15 -0
- package/dist/ui/components/ProviderMethodPicker.js +61 -0
- package/dist/ui/components/ProviderPicker.js +63 -0
- package/dist/ui/components/RenderItemView.js +71 -0
- package/dist/ui/components/Spinner.js +46 -0
- package/dist/ui/components/StatusBar.js +95 -0
- package/dist/ui/components/StreamingIndicator.js +55 -0
- package/dist/ui/components/StructuredDiff.js +168 -0
- package/dist/ui/components/TextInputOverlay.js +43 -0
- package/dist/ui/components/ThinkingBlock.js +82 -0
- package/dist/ui/components/ToolCost.js +17 -0
- package/dist/ui/components/ToolExecution.js +61 -0
- package/dist/ui/components/ToolHeader.js +51 -0
- package/dist/ui/components/ToolRenderLayoutContext.js +14 -0
- package/dist/ui/components/ToolResultWrapper.js +6 -0
- package/dist/ui/components/ToolUseLoader.js +35 -0
- package/dist/ui/components/TraceWaterfall.js +91 -0
- package/dist/ui/components/index.js +33 -0
- package/dist/ui/components/messages/AssistantTextMessage.js +25 -0
- package/dist/ui/components/messages/UserImageMessage.js +12 -0
- package/dist/ui/components/messages/UserTextMessage.js +12 -0
- package/dist/ui/components/overlays/ArionSelector.js +68 -0
- package/dist/ui/components/overlays/ClientSelector.js +62 -0
- package/dist/ui/components/overlays/CommandPalette.js +67 -0
- package/dist/ui/components/overlays/DaemonControl.js +87 -0
- package/dist/ui/components/overlays/InviteShareOverlay.js +15 -0
- package/dist/ui/components/overlays/JoinInviteOverlay.js +32 -0
- package/dist/ui/components/overlays/MemoryBrowser.js +100 -0
- package/dist/ui/components/overlays/MessageSelector.js +123 -0
- package/dist/ui/components/overlays/ModelSelector.js +211 -0
- package/dist/ui/components/overlays/PairRequestOverlay.js +42 -0
- package/dist/ui/components/overlays/PeerSelector.js +84 -0
- package/dist/ui/components/overlays/SessionSelector.js +102 -0
- package/dist/ui/components/overlays/SoundSelector.js +86 -0
- package/dist/ui/components/overlays/ThemeSelector.js +139 -0
- package/dist/ui/components/overlays/index.js +15 -0
- package/dist/ui/components/permissions/BashPermissionRequest/BashPermissionRequest.js +53 -0
- package/dist/ui/components/permissions/FallbackPermissionRequest.js +56 -0
- package/dist/ui/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.js +76 -0
- package/dist/ui/components/permissions/FileEditPermissionRequest/FileEditToolDiff.js +18 -0
- package/dist/ui/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.js +64 -0
- package/dist/ui/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.js +26 -0
- package/dist/ui/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.js +141 -0
- package/dist/ui/components/permissions/PermissionRequest.js +70 -0
- package/dist/ui/components/permissions/PermissionRequestTitle.js +41 -0
- package/dist/ui/components/permissions/hooks.js +10 -0
- package/dist/ui/components/permissions/toolUseOptions.js +68 -0
- package/dist/ui/components/permissions/utils.js +10 -0
- package/dist/ui/components/text-input/Cursor.js +326 -0
- package/dist/ui/components/text-input/TextInput.js +231 -0
- package/dist/ui/components/text-input/imagePaste.js +28 -0
- package/dist/ui/components/text-input/index.js +6 -0
- package/dist/ui/components/text-input/useDoublePress.js +30 -0
- package/dist/ui/components/text-input/useTextInput.js +245 -0
- package/dist/ui/components/tool-types.js +9 -0
- package/dist/ui/constants/figures.js +4 -0
- package/dist/ui/constants/index.js +3 -0
- package/dist/ui/display-mode.js +93 -0
- package/dist/ui/display-policy.js +19 -0
- package/dist/ui/hooks/index.js +6 -0
- package/dist/ui/hooks/useCommandAutocomplete.js +93 -0
- package/dist/ui/hooks/useDoublePress.js +37 -0
- package/dist/ui/hooks/useIndicatorState.js +55 -0
- package/dist/ui/hooks/useInterval.js +23 -0
- package/dist/ui/hooks/useKeyboardShortcuts.js +127 -0
- package/dist/ui/hooks/useTerminalSize.js +55 -0
- package/dist/ui/hooks/useUnifiedMessages.js +117 -0
- package/dist/ui/indicator-state.js +44 -0
- package/dist/ui/markdown/highlight.js +44 -0
- package/dist/ui/markdown/index.js +1460 -0
- package/dist/ui/markdown/tokenizer.js +24 -0
- package/dist/ui/render-item.js +5 -0
- package/dist/ui/screens/REPL.js +119 -0
- package/dist/ui/screens/approval-lifecycle.js +38 -0
- package/dist/ui/status-line.js +72 -0
- package/dist/ui/theme/index.js +51 -0
- package/dist/ui/theme/themes/claude-dark-daltonized.js +51 -0
- package/dist/ui/theme/themes/claude-dark.js +50 -0
- package/dist/ui/theme/themes/claude-light-daltonized.js +51 -0
- package/dist/ui/theme/themes/claude-light.js +50 -0
- package/dist/ui/theme/themes/dark-accessible.js +18 -0
- package/dist/ui/theme/themes/dark.js +49 -0
- package/dist/ui/theme/themes/light-accessible.js +18 -0
- package/dist/ui/theme/themes/light.js +49 -0
- package/dist/ui/theme/types.js +3 -0
- package/dist/ui/theme.js +142 -0
- package/dist/ui/to-render-items.js +145 -0
- package/dist/ui/tools/AgentTool/index.js +30 -0
- package/dist/ui/tools/ArchitectTool/index.js +31 -0
- package/dist/ui/tools/AskUserTool/index.js +46 -0
- package/dist/ui/tools/BashTool/BashToolResultMessage.js +11 -0
- package/dist/ui/tools/BashTool/OutputLine.js +21 -0
- package/dist/ui/tools/BashTool/index.js +91 -0
- package/dist/ui/tools/BrowseTool/index.js +43 -0
- package/dist/ui/tools/BrowserTool/index.js +47 -0
- package/dist/ui/tools/CbmTool/index.js +188 -0
- package/dist/ui/tools/CheckDelegationTool/index.js +46 -0
- package/dist/ui/tools/CheckMessagesTool/index.js +85 -0
- package/dist/ui/tools/CreateQuipTool/index.js +30 -0
- package/dist/ui/tools/CreateSkillTool/index.js +22 -0
- package/dist/ui/tools/CreateToolTool/index.js +31 -0
- package/dist/ui/tools/DelegateRemoteTool/index.js +42 -0
- package/dist/ui/tools/DeployTool/index.js +47 -0
- package/dist/ui/tools/FffTool/index.js +103 -0
- package/dist/ui/tools/FileEditTool/index.js +67 -0
- package/dist/ui/tools/FileReadTool/index.js +68 -0
- package/dist/ui/tools/FileWriteTool/index.js +61 -0
- package/dist/ui/tools/ForkTool/index.js +47 -0
- package/dist/ui/tools/FrgTool/index.js +96 -0
- package/dist/ui/tools/GetThreadTool/index.js +39 -0
- package/dist/ui/tools/GlobTool/index.js +50 -0
- package/dist/ui/tools/GrepTool/index.js +84 -0
- package/dist/ui/tools/HatchArionTool/index.js +36 -0
- package/dist/ui/tools/LearnSkillTool/index.js +22 -0
- package/dist/ui/tools/LearnTool/index.js +43 -0
- package/dist/ui/tools/LearnToolTool/index.js +22 -0
- package/dist/ui/tools/ListClientsTool/index.js +39 -0
- package/dist/ui/tools/LspTool/index.js +261 -0
- package/dist/ui/tools/MCPTool/index.js +33 -0
- package/dist/ui/tools/ManageNetworkTool/index.js +53 -0
- package/dist/ui/tools/MemoryReadTool/index.js +64 -0
- package/dist/ui/tools/MemoryWriteTool/index.js +20 -0
- package/dist/ui/tools/NotebookEditTool/index.js +33 -0
- package/dist/ui/tools/NotebookReadTool/index.js +25 -0
- package/dist/ui/tools/OutlookReadTool/index.js +66 -0
- package/dist/ui/tools/OutlookReplyTool/index.js +49 -0
- package/dist/ui/tools/OutlookSendTool/index.js +49 -0
- package/dist/ui/tools/PauseDelegationTool/index.js +35 -0
- package/dist/ui/tools/ProbeTool/index.js +121 -0
- package/dist/ui/tools/ProcessTool/index.js +66 -0
- package/dist/ui/tools/QuestListTool/index.js +46 -0
- package/dist/ui/tools/QuestReportTool/index.js +49 -0
- package/dist/ui/tools/QuestUpdateTool/index.js +87 -0
- package/dist/ui/tools/QuipCommentTool/index.js +69 -0
- package/dist/ui/tools/QuipReadTool/index.js +71 -0
- package/dist/ui/tools/RestArionTool/index.js +32 -0
- package/dist/ui/tools/RestartTool/index.js +35 -0
- package/dist/ui/tools/ResumeDelegationTool/index.js +35 -0
- package/dist/ui/tools/RetireArionTool/index.js +32 -0
- package/dist/ui/tools/RgTool/index.js +73 -0
- package/dist/ui/tools/SearchKnowledgeTool/index.js +43 -0
- package/dist/ui/tools/SearchMessagesTool/index.js +43 -0
- package/dist/ui/tools/SelfDiagnoseTool/index.js +61 -0
- package/dist/ui/tools/SendMessageTool/index.js +45 -0
- package/dist/ui/tools/SerenaTool/index.js +124 -0
- package/dist/ui/tools/SessionHistoryTool/index.js +52 -0
- package/dist/ui/tools/SgTool/index.js +80 -0
- package/dist/ui/tools/SlackReactTool/index.js +41 -0
- package/dist/ui/tools/SlackReadTool/index.js +48 -0
- package/dist/ui/tools/SlackSendTool/index.js +45 -0
- package/dist/ui/tools/SpawnWorkerTool/index.js +33 -0
- package/dist/ui/tools/StickerRequestTool/index.js +19 -0
- package/dist/ui/tools/ThinkTool/index.js +17 -0
- package/dist/ui/tools/UgTool/index.js +108 -0
- package/dist/ui/tools/UseSkillTool/index.js +22 -0
- package/dist/ui/tools/WakeArionTool/index.js +32 -0
- package/dist/ui/tools/WebFetchTool/index.js +56 -0
- package/dist/ui/tools/WebSearchTool/index.js +44 -0
- package/dist/ui/tools/lsTool/index.js +58 -0
- package/dist/ui/tools/registry.js +197 -0
- package/dist/ui/tools/tool-renderer.js +11 -0
- package/dist/ui/tools/truncation.js +35 -0
- package/dist/ui/types/anthropic.js +4 -0
- package/dist/ui/types/index.js +2 -0
- package/dist/ui/types/message.js +3 -0
- package/dist/ui/types/tool.js +4 -0
- package/dist/ui/utils/array.js +4 -0
- package/dist/ui/utils/cursor.js +131 -0
- package/dist/ui/utils/diff.js +120 -0
- package/dist/ui/utils/format.js +42 -0
- package/dist/ui/utils/fuzzy.js +59 -0
- package/dist/ui/utils/index.js +11 -0
- package/dist/ui/utils/keys.js +8 -0
- package/dist/ui/utils/patch.js +17 -0
- package/dist/ui/utils/risk.js +114 -0
- package/dist/ui/utils/terminal-image.js +70 -0
- package/dist/ui/utils/validation.js +48 -0
- package/dist/ui/verb-pairs.js +248 -0
- package/dist/ui.js +131 -0
- package/package.json +73 -14
- package/src/entrypoints/command-mode.ts +5 -0
- package/src/entrypoints/daemon.ts +54 -0
- package/src/entrypoints/headless-stdio.ts +27 -0
- package/src/entrypoints/interactive.ts +112 -0
- package/src/main.ts +44 -0
- package/src/runtime/configure-bun-sqlite.ts +3 -0
- package/src/runtime/crash-handlers.ts +128 -0
- package/src/runtime/interactive-invocation.test.ts +42 -0
- package/src/runtime/interactive-invocation.ts +51 -0
- package/src/runtime/internal-mode.test.ts +19 -0
- package/src/runtime/internal-mode.ts +24 -0
- package/src/runtime/launch-spec.test.ts +26 -0
- package/src/runtime/launch-spec.ts +84 -0
- package/src/runtime/owner-lease.ts +52 -0
- package/src/runtime/public-mode.test.ts +18 -0
- package/src/runtime/public-mode.ts +19 -0
- package/src/runtime/run-internal-mode.ts +19 -0
- package/src/runtime/runtime-kind.test.ts +23 -0
- package/src/runtime/runtime-kind.ts +41 -0
- package/src/runtime/spawn-aria.ts +62 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
import { FallbackToolUseRejectedMessage } from "../../components/FallbackToolUseRejectedMessage.js";
|
|
4
|
+
import { getTheme } from "../../theme/index.js";
|
|
5
|
+
export const ListClientsToolRenderers = {
|
|
6
|
+
displayName() {
|
|
7
|
+
return "Clients";
|
|
8
|
+
},
|
|
9
|
+
renderInput(input, { verbose } = {}) {
|
|
10
|
+
// No input parameters for this tool
|
|
11
|
+
return "List clients";
|
|
12
|
+
},
|
|
13
|
+
renderRejection() {
|
|
14
|
+
return _jsx(FallbackToolUseRejectedMessage, {});
|
|
15
|
+
},
|
|
16
|
+
renderOutput(output, { verbose } = {}) {
|
|
17
|
+
const theme = getTheme();
|
|
18
|
+
if (output == null) {
|
|
19
|
+
return (_jsx(Box, { flexDirection: "column", children: _jsx(Text, { children: "No clients connected" }) }));
|
|
20
|
+
}
|
|
21
|
+
const obj = (output ?? {});
|
|
22
|
+
// Extract clients from output.data
|
|
23
|
+
const data = (obj.data ?? obj);
|
|
24
|
+
const clients = (Array.isArray(data.clients) ? data.clients : []);
|
|
25
|
+
if (!clients || clients.length === 0) {
|
|
26
|
+
return (_jsx(Box, { flexDirection: "column", children: _jsx(Text, { children: "No clients connected" }) }));
|
|
27
|
+
}
|
|
28
|
+
const count = clients.length;
|
|
29
|
+
// Match /clients overlay: show displayLabel + clientId + self indicator
|
|
30
|
+
const visible = clients.slice(0, 10);
|
|
31
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: [count, " client", count !== 1 ? "s" : "", " connected"] }), _jsx(Box, { flexDirection: "column", marginTop: 1, paddingLeft: 2, children: visible.map((client, idx) => {
|
|
32
|
+
const label = String(client.displayLabel ?? client.name ?? client.displayName ?? "Unknown");
|
|
33
|
+
const id = client.clientId ?? client.id;
|
|
34
|
+
const isSelf = client.self === true;
|
|
35
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { color: isSelf ? theme.colors.textMuted : undefined, children: ["\u2022 ", label, isSelf ? _jsx(Text, { dimColor: true, children: " (self)" }) : null] }), id && (_jsxs(Text, { dimColor: true, children: [" ", id] }))] }, idx));
|
|
36
|
+
}) }), clients.length > 10 && (_jsx(Box, { marginTop: 1, paddingLeft: 2, children: _jsxs(Text, { color: theme.colors.textMuted, children: ["... and ", clients.length - 10, " more"] }) }))] }));
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
import { relative } from "path";
|
|
4
|
+
import { FallbackToolUseRejectedMessage } from "../../components/FallbackToolUseRejectedMessage.js";
|
|
5
|
+
import { getTheme } from "../../theme/index.js";
|
|
6
|
+
import { safeFallbackText } from "../truncation.js";
|
|
7
|
+
/**
|
|
8
|
+
* Symbol kind icons for LSP results
|
|
9
|
+
*/
|
|
10
|
+
const SYMBOL_ICONS = {
|
|
11
|
+
File: "📄",
|
|
12
|
+
Module: "📦",
|
|
13
|
+
Namespace: "📦",
|
|
14
|
+
Package: "📦",
|
|
15
|
+
Class: "𝐶",
|
|
16
|
+
Method: "𝑚",
|
|
17
|
+
Property: "🔹",
|
|
18
|
+
Field: "🔹",
|
|
19
|
+
Constructor: "⚙",
|
|
20
|
+
Enum: "📋",
|
|
21
|
+
Interface: "𝐼",
|
|
22
|
+
Function: "𝑓",
|
|
23
|
+
Variable: "𝑣",
|
|
24
|
+
Constant: "🔒",
|
|
25
|
+
String: '"',
|
|
26
|
+
Number: "#",
|
|
27
|
+
Boolean: "✓",
|
|
28
|
+
Array: "[]",
|
|
29
|
+
Object: "{}",
|
|
30
|
+
Key: "🔑",
|
|
31
|
+
Null: "∅",
|
|
32
|
+
EnumMember: "📋",
|
|
33
|
+
Struct: "📦",
|
|
34
|
+
Event: "⚡",
|
|
35
|
+
Operator: "⊕",
|
|
36
|
+
TypeParameter: "T",
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Extracts and normalizes URI to relative path
|
|
40
|
+
*/
|
|
41
|
+
function normalizeUri(uri) {
|
|
42
|
+
if (uri.startsWith("file://")) {
|
|
43
|
+
return uri.slice(7);
|
|
44
|
+
}
|
|
45
|
+
return uri;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Formats a location as file:line:character
|
|
49
|
+
*/
|
|
50
|
+
function formatLocation(uri, line, character) {
|
|
51
|
+
const file = relative(process.cwd(), normalizeUri(uri));
|
|
52
|
+
if (line !== undefined && character !== undefined) {
|
|
53
|
+
return `${file}:${line + 1}:${character + 1}`;
|
|
54
|
+
}
|
|
55
|
+
else if (line !== undefined) {
|
|
56
|
+
return `${file}:${line + 1}`;
|
|
57
|
+
}
|
|
58
|
+
return file;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Extracts first line from markdown/plaintext content
|
|
62
|
+
*/
|
|
63
|
+
function extractFirstLine(content) {
|
|
64
|
+
let text = "";
|
|
65
|
+
if (typeof content === "string") {
|
|
66
|
+
text = content;
|
|
67
|
+
}
|
|
68
|
+
else if (content && typeof content === "object") {
|
|
69
|
+
const obj = content;
|
|
70
|
+
if (typeof obj.value === "string") {
|
|
71
|
+
text = obj.value;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const lines = text.split("\n");
|
|
75
|
+
return lines.length > 0 ? lines[0].trim() : "";
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Truncates text to max length, adding ellipsis if needed
|
|
79
|
+
*/
|
|
80
|
+
function truncate(text, maxLen = 80) {
|
|
81
|
+
return text.length > maxLen ? text.slice(0, maxLen - 1) + "…" : text;
|
|
82
|
+
}
|
|
83
|
+
export const LspToolRenderers = {
|
|
84
|
+
displayName() {
|
|
85
|
+
return "LSP";
|
|
86
|
+
},
|
|
87
|
+
renderInput(input, { verbose }) {
|
|
88
|
+
const action = String(input?.action ?? "");
|
|
89
|
+
const file = String(input?.file ?? "");
|
|
90
|
+
const line = typeof input?.line === "number" ? input.line : undefined;
|
|
91
|
+
const character = typeof input?.character === "number" ? input.character : undefined;
|
|
92
|
+
const newName = input?.new_name ? String(input.new_name) : "";
|
|
93
|
+
const fileDisplay = file ? (verbose ? file : relative(process.cwd(), file)) : "";
|
|
94
|
+
if (action === "rename" && line !== undefined && character !== undefined && newName) {
|
|
95
|
+
return `${action} ${fileDisplay}:${line + 1}:${character + 1} → ${newName}`;
|
|
96
|
+
}
|
|
97
|
+
else if (line !== undefined && character !== undefined && fileDisplay) {
|
|
98
|
+
return `${action} ${fileDisplay}:${line + 1}:${character + 1}`;
|
|
99
|
+
}
|
|
100
|
+
else if (fileDisplay) {
|
|
101
|
+
return `${action} ${fileDisplay}`;
|
|
102
|
+
}
|
|
103
|
+
return action;
|
|
104
|
+
},
|
|
105
|
+
renderOutput(output, { verbose } = {}, input) {
|
|
106
|
+
const inputObj = (input ?? {});
|
|
107
|
+
const action = String(inputObj?.action ?? "");
|
|
108
|
+
// Handle null/undefined
|
|
109
|
+
if (output == null) {
|
|
110
|
+
return (_jsx(Box, { children: _jsx(Text, { color: getTheme().colors.textMuted, children: "(No result)" }) }));
|
|
111
|
+
}
|
|
112
|
+
// ============================================
|
|
113
|
+
// definition: { uri, range: { start, end } } or array of locations
|
|
114
|
+
// ============================================
|
|
115
|
+
if (action === "definition" || action === "references") {
|
|
116
|
+
let locations = [];
|
|
117
|
+
// Single location object
|
|
118
|
+
if (output != null && typeof output === "object" && !Array.isArray(output)) {
|
|
119
|
+
const obj = output;
|
|
120
|
+
if (typeof obj.uri === "string") {
|
|
121
|
+
locations = [obj];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// Array of locations
|
|
125
|
+
else if (Array.isArray(output)) {
|
|
126
|
+
locations = output.map((loc) => loc != null && typeof loc === "object" ? loc : {});
|
|
127
|
+
}
|
|
128
|
+
if (locations.length === 0) {
|
|
129
|
+
return (_jsx(Box, { children: _jsx(Text, { color: getTheme().colors.textMuted, children: "(No result)" }) }));
|
|
130
|
+
}
|
|
131
|
+
// For definition, show first result
|
|
132
|
+
if (action === "definition") {
|
|
133
|
+
const loc = locations[0];
|
|
134
|
+
if (!loc) {
|
|
135
|
+
return (_jsx(Box, { children: _jsx(Text, { color: getTheme().colors.textMuted, children: "(No result)" }) }));
|
|
136
|
+
}
|
|
137
|
+
const uri = typeof loc.uri === "string" ? loc.uri : "";
|
|
138
|
+
const line = typeof loc.range?.start?.line === "number" ? loc.range.start.line : undefined;
|
|
139
|
+
const char = typeof loc.range?.start?.character === "number" ? loc.range.start.character : undefined;
|
|
140
|
+
return (_jsx(Box, { children: _jsxs(Text, { children: ["\u2192 ", _jsx(Text, { bold: true, children: formatLocation(uri, line, char) })] }) }));
|
|
141
|
+
}
|
|
142
|
+
// For references, show count + list
|
|
143
|
+
const numRefs = locations.length;
|
|
144
|
+
const displayLimit = verbose ? locations.length : Math.min(5, locations.length);
|
|
145
|
+
const displayedLocs = locations.slice(0, displayLimit);
|
|
146
|
+
const hasMore = numRefs > displayLimit;
|
|
147
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { children: _jsxs(Text, { children: [_jsx(Text, { bold: true, children: numRefs }), " reference", numRefs !== 1 ? "s" : ""] }) }), displayedLocs.length > 0 && (_jsx(Box, { flexDirection: "column", marginLeft: 2, children: displayedLocs.map((loc, i) => {
|
|
148
|
+
if (!loc)
|
|
149
|
+
return null;
|
|
150
|
+
const uri = typeof loc.uri === "string" ? loc.uri : "";
|
|
151
|
+
const line = typeof loc.range?.start?.line === "number" ? loc.range.start.line : undefined;
|
|
152
|
+
const char = typeof loc.range?.start?.character === "number"
|
|
153
|
+
? loc.range.start.character
|
|
154
|
+
: undefined;
|
|
155
|
+
return (_jsx(Text, { color: getTheme().colors.textMuted, children: formatLocation(uri, line, char) }, i));
|
|
156
|
+
}) })), hasMore && (_jsx(Box, { marginLeft: 2, children: _jsxs(Text, { color: getTheme().colors.textMuted, children: ["+", numRefs - displayLimit, " more"] }) }))] }));
|
|
157
|
+
}
|
|
158
|
+
// ============================================
|
|
159
|
+
// hover: { contents: string } or { contents: { kind, value } }
|
|
160
|
+
// ============================================
|
|
161
|
+
if (action === "hover") {
|
|
162
|
+
if (output != null && typeof output === "object") {
|
|
163
|
+
const obj = output;
|
|
164
|
+
const contents = obj.contents;
|
|
165
|
+
if (contents) {
|
|
166
|
+
const firstLine = extractFirstLine(contents);
|
|
167
|
+
const truncated = truncate(firstLine);
|
|
168
|
+
return (_jsx(Box, { children: _jsx(Text, { children: _jsx(Text, { bold: true, children: truncated }) }) }));
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return (_jsx(Box, { children: _jsx(Text, { color: getTheme().colors.textMuted, children: "(No hover info)" }) }));
|
|
172
|
+
}
|
|
173
|
+
// ============================================
|
|
174
|
+
// symbols: array of { name, kind, range, children? }
|
|
175
|
+
// ============================================
|
|
176
|
+
if (action === "symbols") {
|
|
177
|
+
let symbols = [];
|
|
178
|
+
if (Array.isArray(output)) {
|
|
179
|
+
symbols = output.map((sym) => sym != null && typeof sym === "object" ? sym : {});
|
|
180
|
+
}
|
|
181
|
+
if (symbols.length === 0) {
|
|
182
|
+
return (_jsx(Box, { children: _jsx(Text, { color: getTheme().colors.textMuted, children: "(No symbols)" }) }));
|
|
183
|
+
}
|
|
184
|
+
const numSymbols = symbols.length;
|
|
185
|
+
const displayLimit = verbose ? symbols.length : Math.min(5, symbols.length);
|
|
186
|
+
const displayedSyms = symbols.slice(0, displayLimit);
|
|
187
|
+
const hasMore = numSymbols > displayLimit;
|
|
188
|
+
// Helper to get kind label
|
|
189
|
+
const getKindLabel = (kind) => {
|
|
190
|
+
if (typeof kind === "string") {
|
|
191
|
+
const iconStr = SYMBOL_ICONS[kind];
|
|
192
|
+
return iconStr || "•";
|
|
193
|
+
}
|
|
194
|
+
else if (typeof kind === "number") {
|
|
195
|
+
// LSP SymbolKind enum: 1=File, 2=Module, 3=Namespace, 4=Package, 5=Class, etc.
|
|
196
|
+
const kindMap = {
|
|
197
|
+
"1": SYMBOL_ICONS.File || "•",
|
|
198
|
+
"2": SYMBOL_ICONS.Module || "•",
|
|
199
|
+
"3": SYMBOL_ICONS.Namespace || "•",
|
|
200
|
+
"4": SYMBOL_ICONS.Package || "•",
|
|
201
|
+
"5": SYMBOL_ICONS.Class || "•",
|
|
202
|
+
"6": SYMBOL_ICONS.Method || "•",
|
|
203
|
+
"7": SYMBOL_ICONS.Property || "•",
|
|
204
|
+
"8": SYMBOL_ICONS.Field || "•",
|
|
205
|
+
"9": SYMBOL_ICONS.Constructor || "•",
|
|
206
|
+
"10": SYMBOL_ICONS.Enum || "•",
|
|
207
|
+
"11": SYMBOL_ICONS.Interface || "•",
|
|
208
|
+
"12": SYMBOL_ICONS.Function || "•",
|
|
209
|
+
"13": SYMBOL_ICONS.Variable || "•",
|
|
210
|
+
"14": SYMBOL_ICONS.Constant || "•",
|
|
211
|
+
"15": SYMBOL_ICONS.String || "•",
|
|
212
|
+
"16": SYMBOL_ICONS.Number || "•",
|
|
213
|
+
"17": SYMBOL_ICONS.Boolean || "•",
|
|
214
|
+
"18": SYMBOL_ICONS.Array || "•",
|
|
215
|
+
"19": SYMBOL_ICONS.Object || "•",
|
|
216
|
+
"20": SYMBOL_ICONS.Key || "•",
|
|
217
|
+
"21": SYMBOL_ICONS.Null || "•",
|
|
218
|
+
"22": SYMBOL_ICONS.EnumMember || "•",
|
|
219
|
+
"23": SYMBOL_ICONS.Struct || "•",
|
|
220
|
+
"24": SYMBOL_ICONS.Event || "•",
|
|
221
|
+
"25": SYMBOL_ICONS.Operator || "•",
|
|
222
|
+
"26": SYMBOL_ICONS.TypeParameter || "•",
|
|
223
|
+
};
|
|
224
|
+
return kindMap[String(kind)] || "•";
|
|
225
|
+
}
|
|
226
|
+
return "•";
|
|
227
|
+
};
|
|
228
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { children: _jsxs(Text, { children: [_jsx(Text, { bold: true, children: numSymbols }), " symbol", numSymbols !== 1 ? "s" : ""] }) }), displayedSyms.length > 0 && (_jsx(Box, { flexDirection: "column", marginLeft: 2, children: displayedSyms.map((sym, i) => {
|
|
229
|
+
const icon = getKindLabel(sym.kind);
|
|
230
|
+
const name = String(sym.name ?? "");
|
|
231
|
+
return (_jsxs(Text, { children: [icon, " ", name] }, i));
|
|
232
|
+
}) })), hasMore && (_jsx(Box, { marginLeft: 2, children: _jsxs(Text, { color: getTheme().colors.textMuted, children: ["+", numSymbols - displayLimit, " more"] }) }))] }));
|
|
233
|
+
}
|
|
234
|
+
// ============================================
|
|
235
|
+
// rename: { changes: { [uri]: [{ range, newText }] } }
|
|
236
|
+
// ============================================
|
|
237
|
+
if (action === "rename") {
|
|
238
|
+
if (output != null && typeof output === "object") {
|
|
239
|
+
const obj = output;
|
|
240
|
+
const changes = obj.changes;
|
|
241
|
+
if (changes != null && typeof changes === "object") {
|
|
242
|
+
const fileCount = Object.keys(changes).length;
|
|
243
|
+
let editCount = 0;
|
|
244
|
+
for (const edits of Object.values(changes)) {
|
|
245
|
+
if (Array.isArray(edits)) {
|
|
246
|
+
editCount += edits.length;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return (_jsx(Box, { children: _jsxs(Text, { children: ["Renamed in ", _jsx(Text, { bold: true, children: fileCount }), " file", fileCount !== 1 ? "s" : "", " (", _jsx(Text, { bold: true, children: editCount }), " edit", editCount !== 1 ? "s" : "", ")"] }) }));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return (_jsx(Box, { children: _jsx(Text, { color: getTheme().colors.textMuted, children: "(Rename failed)" }) }));
|
|
253
|
+
}
|
|
254
|
+
// Default fallback
|
|
255
|
+
return (_jsx(Box, { children: _jsx(Text, { children: safeFallbackText(output) }) }));
|
|
256
|
+
},
|
|
257
|
+
renderRejection() {
|
|
258
|
+
return _jsx(FallbackToolUseRejectedMessage, {});
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
import { FallbackToolUseRejectedMessage } from "../../components/FallbackToolUseRejectedMessage.js";
|
|
4
|
+
import { getTheme } from "../../theme/index.js";
|
|
5
|
+
import { OutputLine } from "../BashTool/OutputLine.js";
|
|
6
|
+
export const MCPToolRenderers = {
|
|
7
|
+
displayName: () => "mcp",
|
|
8
|
+
renderInput(input) {
|
|
9
|
+
return Object.entries(input)
|
|
10
|
+
.map(([key, value]) => `${key}: ${JSON.stringify(value)}`)
|
|
11
|
+
.join(", ");
|
|
12
|
+
},
|
|
13
|
+
renderRejection() {
|
|
14
|
+
return _jsx(FallbackToolUseRejectedMessage, {});
|
|
15
|
+
},
|
|
16
|
+
renderOutput(output, { verbose }) {
|
|
17
|
+
if (Array.isArray(output)) {
|
|
18
|
+
return (_jsx(Box, { flexDirection: "column", children: output.map((item, i) => {
|
|
19
|
+
if (item.type === "image") {
|
|
20
|
+
return _jsx(Text, { children: "[Image]" }, i);
|
|
21
|
+
}
|
|
22
|
+
const lines = (item.text || "").split("\n").length;
|
|
23
|
+
return _jsx(OutputLine, { content: item.text || "", lines: lines, verbose: verbose }, i);
|
|
24
|
+
}) }));
|
|
25
|
+
}
|
|
26
|
+
if (!output) {
|
|
27
|
+
return _jsx(Text, { color: getTheme().colors.textMuted, children: "(No content)" });
|
|
28
|
+
}
|
|
29
|
+
const lines = output.split("\n").length;
|
|
30
|
+
return _jsx(OutputLine, { content: output, lines: lines, verbose: verbose });
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
import { FallbackToolUseRejectedMessage } from "../../components/FallbackToolUseRejectedMessage.js";
|
|
4
|
+
import { getTheme } from "../../theme/index.js";
|
|
5
|
+
import { safeFallbackText } from "../truncation.js";
|
|
6
|
+
export const ManageNetworkToolRenderers = {
|
|
7
|
+
displayName() {
|
|
8
|
+
return "Network";
|
|
9
|
+
},
|
|
10
|
+
renderInput(input, _opts = {}) {
|
|
11
|
+
if (input.action) {
|
|
12
|
+
return input.action;
|
|
13
|
+
}
|
|
14
|
+
return Object.entries(input)
|
|
15
|
+
.map(([key, value]) => `${key}: ${JSON.stringify(value)}`)
|
|
16
|
+
.join(", ");
|
|
17
|
+
},
|
|
18
|
+
renderRejection() {
|
|
19
|
+
return _jsx(FallbackToolUseRejectedMessage, {});
|
|
20
|
+
},
|
|
21
|
+
renderOutput(output, _opts = {}) {
|
|
22
|
+
const theme = getTheme();
|
|
23
|
+
if (!output) {
|
|
24
|
+
return (_jsx(Box, { justifyContent: "space-between", overflowX: "hidden", width: "100%", children: _jsx(Box, { flexDirection: "row", children: _jsx(Text, { color: theme.colors.textMuted, children: "(No content)" }) }) }));
|
|
25
|
+
}
|
|
26
|
+
if (typeof output === "string") {
|
|
27
|
+
return (_jsx(Box, { justifyContent: "space-between", overflowX: "hidden", width: "100%", children: _jsx(Box, { flexDirection: "row", children: _jsx(Text, { children: safeFallbackText(output) }) }) }));
|
|
28
|
+
}
|
|
29
|
+
if (output.error) {
|
|
30
|
+
return (_jsx(Box, { justifyContent: "space-between", overflowX: "hidden", width: "100%", children: _jsx(Box, { flexDirection: "row", children: _jsx(Text, { color: theme.colors.error, children: output.error }) }) }));
|
|
31
|
+
}
|
|
32
|
+
// Handle invite action
|
|
33
|
+
if (output.inviteToken) {
|
|
34
|
+
const tokenPreview = output.inviteToken.length > 20
|
|
35
|
+
? `${output.inviteToken.slice(0, 20)}...`
|
|
36
|
+
: output.inviteToken;
|
|
37
|
+
return (_jsx(Box, { justifyContent: "space-between", overflowX: "hidden", width: "100%", children: _jsx(Box, { flexDirection: "row", children: _jsx(Text, { color: theme.colors.success, children: tokenPreview }) }) }));
|
|
38
|
+
}
|
|
39
|
+
// Handle list_peers action
|
|
40
|
+
if (output.peers && Array.isArray(output.peers)) {
|
|
41
|
+
const peerNames = output.peers
|
|
42
|
+
.map((peer) => peer.displayName || peer.nodeId || "unknown")
|
|
43
|
+
.slice(0, 3);
|
|
44
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { flexDirection: "row", children: _jsxs(Text, { children: [output.peers.length, " peer", output.peers.length !== 1 ? "s" : ""] }) }), peerNames.length > 0 && (_jsx(Box, { flexDirection: "row", children: _jsx(Text, { color: theme.colors.textMuted, children: peerNames.join(", ") }) }))] }));
|
|
45
|
+
}
|
|
46
|
+
// Handle status or default message
|
|
47
|
+
if (output.message) {
|
|
48
|
+
return (_jsx(Box, { justifyContent: "space-between", overflowX: "hidden", width: "100%", children: _jsx(Box, { flexDirection: "row", children: _jsx(Text, { children: output.message }) }) }));
|
|
49
|
+
}
|
|
50
|
+
return (_jsx(Box, { justifyContent: "space-between", overflowX: "hidden", width: "100%", children: _jsx(Box, { flexDirection: "row", children: _jsx(Text, { color: theme.colors.success, children: "Success" }) }) }));
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
import { FallbackToolUseRejectedMessage } from "../../components/FallbackToolUseRejectedMessage.js";
|
|
4
|
+
import { useToolRenderLayout } from "../../components/ToolRenderLayoutContext.js";
|
|
5
|
+
import { getTheme } from "../../theme/index.js";
|
|
6
|
+
import { applyMarkdown } from "../../markdown/index.js";
|
|
7
|
+
import { capLines } from "../truncation.js";
|
|
8
|
+
function extractContent(output) {
|
|
9
|
+
if (output == null)
|
|
10
|
+
return "(No content)";
|
|
11
|
+
if (typeof output === "string")
|
|
12
|
+
return output || "(No content)";
|
|
13
|
+
if (typeof output === "object") {
|
|
14
|
+
const obj = output;
|
|
15
|
+
if (typeof obj.formattedContext === "string" && obj.formattedContext) {
|
|
16
|
+
return obj.formattedContext;
|
|
17
|
+
}
|
|
18
|
+
if (typeof obj.content === "string")
|
|
19
|
+
return obj.content || "(No content)";
|
|
20
|
+
if (Array.isArray(obj.memories)) {
|
|
21
|
+
const memories = obj.memories;
|
|
22
|
+
if (memories.length === 0)
|
|
23
|
+
return "(No memories found)";
|
|
24
|
+
const count = typeof obj.count === "number" ? obj.count : memories.length;
|
|
25
|
+
const lines = memories.map((m) => {
|
|
26
|
+
const content = typeof m.content === "string" ? m.content : JSON.stringify(m.content);
|
|
27
|
+
const network = typeof m.network === "string" ? ` [${m.network}]` : "";
|
|
28
|
+
return `• ${content}${network}`;
|
|
29
|
+
});
|
|
30
|
+
return `${count} memories:\n${lines.join("\n")}`;
|
|
31
|
+
}
|
|
32
|
+
return JSON.stringify(output);
|
|
33
|
+
}
|
|
34
|
+
return String(output);
|
|
35
|
+
}
|
|
36
|
+
function MemoryReadOutput({ content, isEmpty, }) {
|
|
37
|
+
const { contentWidth } = useToolRenderLayout();
|
|
38
|
+
return (_jsx(Box, { flexDirection: "column", width: "100%", children: _jsx(Text, { color: isEmpty ? getTheme().colors.textMuted : undefined, children: isEmpty ? content : applyMarkdown(content, { width: contentWidth }) }) }));
|
|
39
|
+
}
|
|
40
|
+
export const MemoryReadToolRenderers = {
|
|
41
|
+
displayName() {
|
|
42
|
+
return "Read Memory";
|
|
43
|
+
},
|
|
44
|
+
renderInput(input) {
|
|
45
|
+
return Object.entries(input)
|
|
46
|
+
.map(([key, value]) => `${key}: ${JSON.stringify(value)}`)
|
|
47
|
+
.join(", ");
|
|
48
|
+
},
|
|
49
|
+
renderRejection() {
|
|
50
|
+
return _jsx(FallbackToolUseRejectedMessage, {});
|
|
51
|
+
},
|
|
52
|
+
renderOutput(output, { verbose } = { verbose: false }) {
|
|
53
|
+
const content = extractContent(output);
|
|
54
|
+
const MAX_LINES = 3;
|
|
55
|
+
const lines = content.split("\n");
|
|
56
|
+
const truncated = !verbose && lines.length > MAX_LINES;
|
|
57
|
+
const visible = capLines(truncated
|
|
58
|
+
? [...lines.slice(0, MAX_LINES), `… +${lines.length - MAX_LINES} lines`].join("\n")
|
|
59
|
+
: content);
|
|
60
|
+
const isEmpty = content === "(No content)";
|
|
61
|
+
return _jsx(MemoryReadOutput, { content: visible, isEmpty: isEmpty });
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
import { FallbackToolUseRejectedMessage } from "../../components/FallbackToolUseRejectedMessage.js";
|
|
4
|
+
export const MemoryWriteToolRenderers = {
|
|
5
|
+
displayName() {
|
|
6
|
+
return "Write Memory";
|
|
7
|
+
},
|
|
8
|
+
renderInput(input) {
|
|
9
|
+
return Object.entries(input)
|
|
10
|
+
.map(([key, value]) => `${key}: ${JSON.stringify(value)}`)
|
|
11
|
+
.join(", ");
|
|
12
|
+
},
|
|
13
|
+
renderRejection() {
|
|
14
|
+
return _jsx(FallbackToolUseRejectedMessage, {});
|
|
15
|
+
},
|
|
16
|
+
renderOutput() {
|
|
17
|
+
return (_jsx(Box, { justifyContent: "space-between", overflowX: "hidden", width: "100%", children: _jsx(Box, { flexDirection: "row", children: _jsx(Text, { children: "Updated memory" }) }) }));
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
import { relative } from "path";
|
|
4
|
+
import { FallbackToolUseRejectedMessage } from "../../components/FallbackToolUseRejectedMessage.js";
|
|
5
|
+
import { HighlightedCode } from "../../components/HighlightedCode.js";
|
|
6
|
+
export const NotebookEditToolRenderers = {
|
|
7
|
+
displayName() {
|
|
8
|
+
return "Edit Notebook";
|
|
9
|
+
},
|
|
10
|
+
renderInput(input, { verbose }) {
|
|
11
|
+
const path = verbose ? input.notebook_path : relative(process.cwd(), input.notebook_path ?? "");
|
|
12
|
+
const source = input.new_source ? input.new_source.slice(0, 30) + "\u2026" : "";
|
|
13
|
+
return `${path} cell:${input.cell_number ?? "?"}${source ? ` "${source}"` : ""}`;
|
|
14
|
+
},
|
|
15
|
+
renderRejection() {
|
|
16
|
+
return _jsx(FallbackToolUseRejectedMessage, {});
|
|
17
|
+
},
|
|
18
|
+
renderOutput(output) {
|
|
19
|
+
if (!output || typeof output !== "object") {
|
|
20
|
+
return _jsx(Text, { children: "(No content)" });
|
|
21
|
+
}
|
|
22
|
+
const { cell_number, new_source, language, error } = output;
|
|
23
|
+
if (error) {
|
|
24
|
+
return (_jsx(Box, { flexDirection: "column", children: _jsx(Text, { color: "red", children: error }) }));
|
|
25
|
+
}
|
|
26
|
+
const MAX_LINES = 2; // 1 header + 2 code lines = 3 lines
|
|
27
|
+
const sourceLines = new_source.split("\n");
|
|
28
|
+
const truncated = sourceLines.length > MAX_LINES;
|
|
29
|
+
const displaySource = truncated ? sourceLines.slice(0, MAX_LINES).join("\n") : new_source;
|
|
30
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: ["Updated cell ", cell_number, ":"] }), _jsx(Box, { marginLeft: 2, children: _jsx(HighlightedCode, { code: displaySource, language: language }) }), truncated && _jsxs(Text, { color: "gray", children: ["... (+", sourceLines.length - MAX_LINES, " lines)"] })] }));
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from "ink";
|
|
3
|
+
import { relative } from "path";
|
|
4
|
+
import { FallbackToolUseRejectedMessage } from "../../components/FallbackToolUseRejectedMessage.js";
|
|
5
|
+
export const NotebookReadToolRenderers = {
|
|
6
|
+
displayName() {
|
|
7
|
+
return "Read Notebook";
|
|
8
|
+
},
|
|
9
|
+
renderInput(input, { verbose }) {
|
|
10
|
+
return `notebook_path: ${verbose ? input.notebook_path : relative(process.cwd(), input.notebook_path)}`;
|
|
11
|
+
},
|
|
12
|
+
renderRejection() {
|
|
13
|
+
return _jsx(FallbackToolUseRejectedMessage, {});
|
|
14
|
+
},
|
|
15
|
+
renderOutput(content) {
|
|
16
|
+
if (!content) {
|
|
17
|
+
return _jsx(Text, { children: "No cells found in notebook" });
|
|
18
|
+
}
|
|
19
|
+
if (content.length < 1 || !content[0]) {
|
|
20
|
+
return _jsx(Text, { children: "No cells found in notebook" });
|
|
21
|
+
}
|
|
22
|
+
return _jsxs(Text, { children: ["Read ", content.length, " cells"] });
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
import { FallbackToolUseRejectedMessage } from "../../components/FallbackToolUseRejectedMessage.js";
|
|
4
|
+
import { getTheme } from "../../theme/index.js";
|
|
5
|
+
import { safeFallbackText } from "../truncation.js";
|
|
6
|
+
export const OutlookReadToolRenderers = {
|
|
7
|
+
displayName() {
|
|
8
|
+
return "Outlook Read";
|
|
9
|
+
},
|
|
10
|
+
renderInput(input, { verbose } = {}) {
|
|
11
|
+
const theme = getTheme();
|
|
12
|
+
const folder = String(input?.folder ?? "");
|
|
13
|
+
const search = input?.search ?? input?.search_query;
|
|
14
|
+
const filter = input?.filter;
|
|
15
|
+
const parts = [];
|
|
16
|
+
if (folder) {
|
|
17
|
+
parts.push(`folder: ${folder}`);
|
|
18
|
+
}
|
|
19
|
+
if (search) {
|
|
20
|
+
parts.push(`search: ${String(search)}`);
|
|
21
|
+
}
|
|
22
|
+
if (filter) {
|
|
23
|
+
parts.push(`filter: ${String(filter)}`);
|
|
24
|
+
}
|
|
25
|
+
return (_jsx(Box, { flexDirection: "row", children: _jsx(Text, { children: parts.length > 0 ? parts.join(", ") : "Reading emails..." }) }));
|
|
26
|
+
},
|
|
27
|
+
renderRejection() {
|
|
28
|
+
return _jsx(FallbackToolUseRejectedMessage, {});
|
|
29
|
+
},
|
|
30
|
+
renderOutput(output, { verbose } = {}) {
|
|
31
|
+
const theme = getTheme();
|
|
32
|
+
if (output == null) {
|
|
33
|
+
return (_jsx(Box, { flexDirection: "column", children: _jsx(Text, { children: "(No emails found)" }) }));
|
|
34
|
+
}
|
|
35
|
+
const obj = output;
|
|
36
|
+
// Handle error case: { success: false, message: "..." }
|
|
37
|
+
if (obj.success === false) {
|
|
38
|
+
return (_jsx(Box, { flexDirection: "column", children: _jsx(Text, { color: theme.colors.error, children: String(obj.message ?? "Error reading emails") }) }));
|
|
39
|
+
}
|
|
40
|
+
// Handle success case
|
|
41
|
+
if (obj.success === true) {
|
|
42
|
+
const data = (obj.data ?? {});
|
|
43
|
+
// Multiple emails: data.messages is an array
|
|
44
|
+
if (Array.isArray(data?.messages)) {
|
|
45
|
+
const messages = data.messages;
|
|
46
|
+
if (messages.length === 0) {
|
|
47
|
+
return (_jsx(Box, { flexDirection: "column", children: _jsx(Text, { children: "(No emails)" }) }));
|
|
48
|
+
}
|
|
49
|
+
const count = messages.length;
|
|
50
|
+
const displayMessages = messages.slice(0, 3);
|
|
51
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: [count, " email", count !== 1 ? "s" : ""] }), displayMessages.map((msg, idx) => (_jsx(Box, { flexDirection: "row", marginTop: idx === 0 ? 0 : 0, children: _jsxs(Box, { children: [_jsx(Text, { bold: true, children: msg.subject || "(No subject)" }), msg.from && _jsxs(Text, { color: theme.colors.textMuted, children: [" from ", msg.from] })] }) }, idx))), count > 3 && _jsxs(Text, { color: theme.colors.textMuted, children: ["... and ", count - 3, " more"] })] }));
|
|
52
|
+
}
|
|
53
|
+
// Single email detail: data has id, subject, from, etc.
|
|
54
|
+
if (data?.subject) {
|
|
55
|
+
const subject = data.subject;
|
|
56
|
+
const from = data?.from;
|
|
57
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { flexDirection: "row", children: _jsx(Text, { bold: true, children: String(subject) }) }), from && (_jsx(Box, { flexDirection: "row", children: _jsxs(Text, { color: theme.colors.textMuted, children: ["from ", String(from)] }) }))] }));
|
|
58
|
+
}
|
|
59
|
+
// Generic data display
|
|
60
|
+
return (_jsx(Box, { flexDirection: "column", children: _jsx(Text, { children: safeFallbackText(obj.data) }) }));
|
|
61
|
+
}
|
|
62
|
+
// Fallback for unexpected shapes
|
|
63
|
+
return (_jsx(Box, { flexDirection: "column", children: _jsx(Text, { children: safeFallbackText(output) }) }));
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
import { FallbackToolUseRejectedMessage } from "../../components/FallbackToolUseRejectedMessage.js";
|
|
4
|
+
import { getTheme } from "../../theme/index.js";
|
|
5
|
+
import { safeFallbackText } from "../truncation.js";
|
|
6
|
+
export const OutlookReplyToolRenderers = {
|
|
7
|
+
displayName() {
|
|
8
|
+
return "Outlook Reply";
|
|
9
|
+
},
|
|
10
|
+
renderInput(input, { verbose } = {}) {
|
|
11
|
+
const theme = getTheme();
|
|
12
|
+
const messageId = String(input?.messageId ?? input?.message_id ?? "");
|
|
13
|
+
const replyAll = Boolean(input?.replyAll ?? input?.reply_all ?? false);
|
|
14
|
+
// Truncate messageId if too long
|
|
15
|
+
const displayId = messageId.length > 20 ? messageId.substring(0, 20) + "..." : messageId;
|
|
16
|
+
return (_jsx(Box, { flexDirection: "row", children: _jsxs(Text, { children: [displayId, replyAll && _jsx(Text, { color: theme.colors.textMuted, children: " [reply-all]" })] }) }));
|
|
17
|
+
},
|
|
18
|
+
renderRejection() {
|
|
19
|
+
return _jsx(FallbackToolUseRejectedMessage, {});
|
|
20
|
+
},
|
|
21
|
+
renderOutput(output, { verbose } = {}) {
|
|
22
|
+
const theme = getTheme();
|
|
23
|
+
if (output == null) {
|
|
24
|
+
return (_jsx(Box, { flexDirection: "column", children: _jsx(Text, { color: theme.colors.error, children: "Failed to send reply" }) }));
|
|
25
|
+
}
|
|
26
|
+
const obj = output;
|
|
27
|
+
// Handle error case: { success: false, message: "..." }
|
|
28
|
+
if (obj.success === false) {
|
|
29
|
+
return (_jsx(Box, { flexDirection: "column", children: _jsx(Text, { color: theme.colors.error, children: String(obj.message ?? "Failed to send reply") }) }));
|
|
30
|
+
}
|
|
31
|
+
// Handle success case: { success: true, message: "Reply sent" }
|
|
32
|
+
if (obj.success === true) {
|
|
33
|
+
const message = String(obj.message ?? "Reply sent");
|
|
34
|
+
return (_jsx(Box, { flexDirection: "column", children: _jsx(Text, { color: theme.colors.success, children: message }) }));
|
|
35
|
+
}
|
|
36
|
+
// String output (likely success message or error)
|
|
37
|
+
if (typeof output === "string") {
|
|
38
|
+
if (output.toLowerCase().includes("sent") ||
|
|
39
|
+
output.toLowerCase().includes("success") ||
|
|
40
|
+
output.toLowerCase().includes("reply")) {
|
|
41
|
+
return (_jsx(Box, { flexDirection: "column", children: _jsx(Text, { color: theme.colors.success, children: output }) }));
|
|
42
|
+
}
|
|
43
|
+
return (_jsx(Box, { flexDirection: "column", children: _jsx(Text, { color: theme.colors.error, children: output }) }));
|
|
44
|
+
}
|
|
45
|
+
// Fallback for unexpected shapes
|
|
46
|
+
return (_jsx(Box, { flexDirection: "column", children: _jsx(Text, { children: safeFallbackText(output) }) }));
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=index.js.map
|