@aria-cli/cli 1.0.51 → 1.0.54
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 +569 -569
- package/package.json +14 -73
- package/dist/.tsbuildinfo +0 -1
- package/dist/attached-local-control-client.js +0 -826
- package/dist/bootstrap-local-control-client.js +0 -2
- package/dist/capability-aware-method-proxy.js +0 -42
- package/dist/cli-context.js +0 -160
- package/dist/commands/arions.js +0 -174
- package/dist/commands/auth.js +0 -123
- package/dist/commands/daemon.js +0 -245
- package/dist/commands/definitions.js +0 -176
- package/dist/commands/index.js +0 -74
- package/dist/commands/login-handler.js +0 -1108
- package/dist/commands/logout-handler.js +0 -92
- package/dist/commands/memory-handlers.js +0 -89
- package/dist/commands/pairing.js +0 -60
- package/dist/commands/runtime-cutover-reset-command.js +0 -12
- package/dist/commands/runtime-cutover-reset.js +0 -265
- package/dist/commands/terminal-setup.js +0 -84
- package/dist/config/aria-config.js +0 -238
- package/dist/config/index.js +0 -3
- package/dist/config/loader.js +0 -97
- package/dist/config.js +0 -142
- package/dist/daemon-info.js +0 -10
- package/dist/ensure-daemon.js +0 -128
- package/dist/entrypoints/command-mode.js +0 -5
- package/dist/entrypoints/daemon.js +0 -50
- package/dist/entrypoints/headless-stdio.js +0 -25
- package/dist/entrypoints/interactive.js +0 -80
- package/dist/event-loop-watchdog.js +0 -73
- package/dist/headless/auth-orchestrator.js +0 -508
- package/dist/headless/auth-service.js +0 -43
- package/dist/headless/bootstrap-fast-path.js +0 -112
- package/dist/headless/call-command.js +0 -143
- package/dist/headless/daemon-service.js +0 -318
- package/dist/headless/hook-actions.js +0 -235
- package/dist/headless/hook-service.js +0 -42
- package/dist/headless/kernel-services.js +0 -216
- package/dist/headless/kernel.js +0 -785
- package/dist/headless/operations/arion.js +0 -119
- package/dist/headless/operations/auth.js +0 -45
- package/dist/headless/operations/client.js +0 -31
- package/dist/headless/operations/config.js +0 -69
- package/dist/headless/operations/daemon.js +0 -47
- package/dist/headless/operations/hook.js +0 -56
- package/dist/headless/operations/index.js +0 -11
- package/dist/headless/operations/memory.js +0 -102
- package/dist/headless/operations/message.js +0 -279
- package/dist/headless/operations/model.js +0 -100
- package/dist/headless/operations/peer.js +0 -56
- package/dist/headless/operations/run.js +0 -24
- package/dist/headless/operations/session.js +0 -90
- package/dist/headless/operations/system.js +0 -19
- package/dist/headless/operations/utils.js +0 -35
- package/dist/headless/run-orchestrator.js +0 -703
- package/dist/headless/stdio-server.js +0 -439
- package/dist/history/SessionHistory.js +0 -8
- package/dist/history/SessionHistoryClient.js +0 -186
- package/dist/history/conversation-message.js +0 -112
- package/dist/history/index.js +0 -8
- package/dist/history/jsonl-replay.js +0 -154
- package/dist/history/repair-tool-pairing.js +0 -84
- package/dist/history/stall-phase-bridge.js +0 -11
- package/dist/history/turn-accumulator.js +0 -427
- package/dist/index.js +0 -7
- package/dist/ink-repl.js +0 -4183
- package/dist/local-control-bootstrap.js +0 -26
- package/dist/local-control-client.js +0 -2
- package/dist/local-control-error-reporting.js +0 -34
- package/dist/local-control-http-client.js +0 -362
- package/dist/local-control-lazy-wrapper.js +0 -363
- package/dist/local-control-manager.js +0 -146
- package/dist/main.js +0 -38
- package/dist/network-security.js +0 -62
- package/dist/networking-server.js +0 -38
- package/dist/peer-identity.js +0 -23
- package/dist/polling-subscription.js +0 -34
- package/dist/relaunch.js +0 -588
- package/dist/release-notes.js +0 -35
- package/dist/repl-cleanup.js +0 -47
- package/dist/runtime/configure-bun-sqlite.js +0 -3
- package/dist/runtime/crash-handlers.js +0 -111
- package/dist/runtime/interactive-invocation.js +0 -39
- package/dist/runtime/internal-mode.js +0 -14
- package/dist/runtime/launch-spec.js +0 -64
- package/dist/runtime/owner-lease.js +0 -44
- package/dist/runtime/public-mode.js +0 -20
- package/dist/runtime/run-internal-mode.js +0 -18
- package/dist/runtime/runtime-kind.js +0 -32
- package/dist/runtime/spawn-aria.js +0 -38
- package/dist/selectable-client.js +0 -2
- package/dist/selectable-peer.js +0 -2
- package/dist/session.js +0 -203
- package/dist/slash-commands.js +0 -80
- package/dist/sounds.js +0 -210
- package/dist/ui/App.js +0 -526
- package/dist/ui/components/AnthropicMethodPicker.js +0 -6
- package/dist/ui/components/ArionPrompt.js +0 -15
- package/dist/ui/components/AutocompleteDropdown.js +0 -23
- package/dist/ui/components/AutonomySelector.js +0 -55
- package/dist/ui/components/Banner.js +0 -98
- package/dist/ui/components/ConversationHistory.js +0 -175
- package/dist/ui/components/CopilotDeviceLoginFlow.js +0 -88
- package/dist/ui/components/CopilotSourcePicker.js +0 -50
- package/dist/ui/components/Cost.js +0 -10
- package/dist/ui/components/CustomSelect/option-map.js +0 -30
- package/dist/ui/components/CustomSelect/select-option.js +0 -13
- package/dist/ui/components/CustomSelect/select.js +0 -42
- package/dist/ui/components/CustomSelect/use-select-state.js +0 -179
- package/dist/ui/components/CustomSelect/use-select.js +0 -15
- package/dist/ui/components/ErrorDisplay.js +0 -35
- package/dist/ui/components/FallbackToolUseRejectedMessage.js +0 -7
- package/dist/ui/components/FileEditToolUpdatedMessage.js +0 -57
- package/dist/ui/components/HandoffMarker.js +0 -18
- package/dist/ui/components/HighlightedCode.js +0 -21
- package/dist/ui/components/InputArea.js +0 -187
- package/dist/ui/components/Message.js +0 -25
- package/dist/ui/components/OAuthLoginFlow.js +0 -113
- package/dist/ui/components/OutputTruncation.js +0 -35
- package/dist/ui/components/PermissionPrompt.js +0 -79
- package/dist/ui/components/PipelineTimingPanel.js +0 -15
- package/dist/ui/components/ProviderMethodPicker.js +0 -61
- package/dist/ui/components/ProviderPicker.js +0 -63
- package/dist/ui/components/RenderItemView.js +0 -71
- package/dist/ui/components/Spinner.js +0 -46
- package/dist/ui/components/StatusBar.js +0 -95
- package/dist/ui/components/StreamingIndicator.js +0 -55
- package/dist/ui/components/StructuredDiff.js +0 -168
- package/dist/ui/components/TextInputOverlay.js +0 -43
- package/dist/ui/components/ThinkingBlock.js +0 -82
- package/dist/ui/components/ToolCost.js +0 -17
- package/dist/ui/components/ToolExecution.js +0 -61
- package/dist/ui/components/ToolHeader.js +0 -51
- package/dist/ui/components/ToolRenderLayoutContext.js +0 -14
- package/dist/ui/components/ToolResultWrapper.js +0 -6
- package/dist/ui/components/ToolUseLoader.js +0 -35
- package/dist/ui/components/TraceWaterfall.js +0 -91
- package/dist/ui/components/index.js +0 -33
- package/dist/ui/components/messages/AssistantTextMessage.js +0 -25
- package/dist/ui/components/messages/UserImageMessage.js +0 -12
- package/dist/ui/components/messages/UserTextMessage.js +0 -12
- package/dist/ui/components/overlays/ArionSelector.js +0 -68
- package/dist/ui/components/overlays/ClientSelector.js +0 -62
- package/dist/ui/components/overlays/CommandPalette.js +0 -67
- package/dist/ui/components/overlays/DaemonControl.js +0 -87
- package/dist/ui/components/overlays/InviteShareOverlay.js +0 -15
- package/dist/ui/components/overlays/JoinInviteOverlay.js +0 -32
- package/dist/ui/components/overlays/MemoryBrowser.js +0 -100
- package/dist/ui/components/overlays/MessageSelector.js +0 -123
- package/dist/ui/components/overlays/ModelSelector.js +0 -211
- package/dist/ui/components/overlays/PairRequestOverlay.js +0 -42
- package/dist/ui/components/overlays/PeerSelector.js +0 -84
- package/dist/ui/components/overlays/SessionSelector.js +0 -102
- package/dist/ui/components/overlays/SoundSelector.js +0 -86
- package/dist/ui/components/overlays/ThemeSelector.js +0 -139
- package/dist/ui/components/overlays/index.js +0 -15
- package/dist/ui/components/permissions/BashPermissionRequest/BashPermissionRequest.js +0 -53
- package/dist/ui/components/permissions/FallbackPermissionRequest.js +0 -56
- package/dist/ui/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.js +0 -76
- package/dist/ui/components/permissions/FileEditPermissionRequest/FileEditToolDiff.js +0 -18
- package/dist/ui/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.js +0 -64
- package/dist/ui/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.js +0 -26
- package/dist/ui/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.js +0 -141
- package/dist/ui/components/permissions/PermissionRequest.js +0 -70
- package/dist/ui/components/permissions/PermissionRequestTitle.js +0 -41
- package/dist/ui/components/permissions/hooks.js +0 -10
- package/dist/ui/components/permissions/toolUseOptions.js +0 -68
- package/dist/ui/components/permissions/utils.js +0 -10
- package/dist/ui/components/text-input/Cursor.js +0 -326
- package/dist/ui/components/text-input/TextInput.js +0 -231
- package/dist/ui/components/text-input/imagePaste.js +0 -28
- package/dist/ui/components/text-input/index.js +0 -6
- package/dist/ui/components/text-input/useDoublePress.js +0 -30
- package/dist/ui/components/text-input/useTextInput.js +0 -245
- package/dist/ui/components/tool-types.js +0 -9
- package/dist/ui/constants/figures.js +0 -4
- package/dist/ui/constants/index.js +0 -3
- package/dist/ui/display-mode.js +0 -93
- package/dist/ui/display-policy.js +0 -19
- package/dist/ui/hooks/index.js +0 -6
- package/dist/ui/hooks/useCommandAutocomplete.js +0 -93
- package/dist/ui/hooks/useDoublePress.js +0 -37
- package/dist/ui/hooks/useIndicatorState.js +0 -55
- package/dist/ui/hooks/useInterval.js +0 -23
- package/dist/ui/hooks/useKeyboardShortcuts.js +0 -127
- package/dist/ui/hooks/useTerminalSize.js +0 -55
- package/dist/ui/hooks/useUnifiedMessages.js +0 -117
- package/dist/ui/indicator-state.js +0 -44
- package/dist/ui/markdown/highlight.js +0 -44
- package/dist/ui/markdown/index.js +0 -1460
- package/dist/ui/markdown/tokenizer.js +0 -24
- package/dist/ui/render-item.js +0 -5
- package/dist/ui/screens/REPL.js +0 -119
- package/dist/ui/screens/approval-lifecycle.js +0 -38
- package/dist/ui/status-line.js +0 -72
- package/dist/ui/theme/index.js +0 -51
- package/dist/ui/theme/themes/claude-dark-daltonized.js +0 -51
- package/dist/ui/theme/themes/claude-dark.js +0 -50
- package/dist/ui/theme/themes/claude-light-daltonized.js +0 -51
- package/dist/ui/theme/themes/claude-light.js +0 -50
- package/dist/ui/theme/themes/dark-accessible.js +0 -18
- package/dist/ui/theme/themes/dark.js +0 -49
- package/dist/ui/theme/themes/light-accessible.js +0 -18
- package/dist/ui/theme/themes/light.js +0 -49
- package/dist/ui/theme/types.js +0 -3
- package/dist/ui/theme.js +0 -142
- package/dist/ui/to-render-items.js +0 -145
- package/dist/ui/tools/AgentTool/index.js +0 -30
- package/dist/ui/tools/ArchitectTool/index.js +0 -31
- package/dist/ui/tools/AskUserTool/index.js +0 -46
- package/dist/ui/tools/BashTool/BashToolResultMessage.js +0 -11
- package/dist/ui/tools/BashTool/OutputLine.js +0 -21
- package/dist/ui/tools/BashTool/index.js +0 -91
- package/dist/ui/tools/BrowseTool/index.js +0 -43
- package/dist/ui/tools/BrowserTool/index.js +0 -47
- package/dist/ui/tools/CbmTool/index.js +0 -188
- package/dist/ui/tools/CheckDelegationTool/index.js +0 -46
- package/dist/ui/tools/CheckMessagesTool/index.js +0 -85
- package/dist/ui/tools/CreateQuipTool/index.js +0 -30
- package/dist/ui/tools/CreateSkillTool/index.js +0 -22
- package/dist/ui/tools/CreateToolTool/index.js +0 -31
- package/dist/ui/tools/DelegateRemoteTool/index.js +0 -42
- package/dist/ui/tools/DeployTool/index.js +0 -47
- package/dist/ui/tools/FffTool/index.js +0 -103
- package/dist/ui/tools/FileEditTool/index.js +0 -67
- package/dist/ui/tools/FileReadTool/index.js +0 -68
- package/dist/ui/tools/FileWriteTool/index.js +0 -61
- package/dist/ui/tools/ForkTool/index.js +0 -47
- package/dist/ui/tools/FrgTool/index.js +0 -96
- package/dist/ui/tools/GetThreadTool/index.js +0 -39
- package/dist/ui/tools/GlobTool/index.js +0 -50
- package/dist/ui/tools/GrepTool/index.js +0 -84
- package/dist/ui/tools/HatchArionTool/index.js +0 -36
- package/dist/ui/tools/LearnSkillTool/index.js +0 -22
- package/dist/ui/tools/LearnTool/index.js +0 -43
- package/dist/ui/tools/LearnToolTool/index.js +0 -22
- package/dist/ui/tools/ListClientsTool/index.js +0 -39
- package/dist/ui/tools/LspTool/index.js +0 -261
- package/dist/ui/tools/MCPTool/index.js +0 -33
- package/dist/ui/tools/ManageNetworkTool/index.js +0 -53
- package/dist/ui/tools/MemoryReadTool/index.js +0 -64
- package/dist/ui/tools/MemoryWriteTool/index.js +0 -20
- package/dist/ui/tools/NotebookEditTool/index.js +0 -33
- package/dist/ui/tools/NotebookReadTool/index.js +0 -25
- package/dist/ui/tools/OutlookReadTool/index.js +0 -66
- package/dist/ui/tools/OutlookReplyTool/index.js +0 -49
- package/dist/ui/tools/OutlookSendTool/index.js +0 -49
- package/dist/ui/tools/PauseDelegationTool/index.js +0 -35
- package/dist/ui/tools/ProbeTool/index.js +0 -121
- package/dist/ui/tools/ProcessTool/index.js +0 -66
- package/dist/ui/tools/QuestListTool/index.js +0 -46
- package/dist/ui/tools/QuestReportTool/index.js +0 -49
- package/dist/ui/tools/QuestUpdateTool/index.js +0 -87
- package/dist/ui/tools/QuipCommentTool/index.js +0 -69
- package/dist/ui/tools/QuipReadTool/index.js +0 -71
- package/dist/ui/tools/RestArionTool/index.js +0 -32
- package/dist/ui/tools/RestartTool/index.js +0 -35
- package/dist/ui/tools/ResumeDelegationTool/index.js +0 -35
- package/dist/ui/tools/RetireArionTool/index.js +0 -32
- package/dist/ui/tools/RgTool/index.js +0 -73
- package/dist/ui/tools/SearchKnowledgeTool/index.js +0 -43
- package/dist/ui/tools/SearchMessagesTool/index.js +0 -43
- package/dist/ui/tools/SelfDiagnoseTool/index.js +0 -61
- package/dist/ui/tools/SendMessageTool/index.js +0 -45
- package/dist/ui/tools/SerenaTool/index.js +0 -124
- package/dist/ui/tools/SessionHistoryTool/index.js +0 -52
- package/dist/ui/tools/SgTool/index.js +0 -80
- package/dist/ui/tools/SlackReactTool/index.js +0 -41
- package/dist/ui/tools/SlackReadTool/index.js +0 -48
- package/dist/ui/tools/SlackSendTool/index.js +0 -45
- package/dist/ui/tools/SpawnWorkerTool/index.js +0 -33
- package/dist/ui/tools/StickerRequestTool/index.js +0 -19
- package/dist/ui/tools/ThinkTool/index.js +0 -17
- package/dist/ui/tools/UgTool/index.js +0 -108
- package/dist/ui/tools/UseSkillTool/index.js +0 -22
- package/dist/ui/tools/WakeArionTool/index.js +0 -32
- package/dist/ui/tools/WebFetchTool/index.js +0 -56
- package/dist/ui/tools/WebSearchTool/index.js +0 -44
- package/dist/ui/tools/lsTool/index.js +0 -58
- package/dist/ui/tools/registry.js +0 -197
- package/dist/ui/tools/tool-renderer.js +0 -11
- package/dist/ui/tools/truncation.js +0 -35
- package/dist/ui/types/anthropic.js +0 -4
- package/dist/ui/types/index.js +0 -2
- package/dist/ui/types/message.js +0 -3
- package/dist/ui/types/tool.js +0 -4
- package/dist/ui/utils/array.js +0 -4
- package/dist/ui/utils/cursor.js +0 -131
- package/dist/ui/utils/diff.js +0 -120
- package/dist/ui/utils/format.js +0 -42
- package/dist/ui/utils/fuzzy.js +0 -59
- package/dist/ui/utils/index.js +0 -11
- package/dist/ui/utils/keys.js +0 -8
- package/dist/ui/utils/patch.js +0 -17
- package/dist/ui/utils/risk.js +0 -114
- package/dist/ui/utils/terminal-image.js +0 -70
- package/dist/ui/utils/validation.js +0 -48
- package/dist/ui/verb-pairs.js +0 -248
- package/dist/ui.js +0 -131
- package/src/entrypoints/command-mode.ts +0 -5
- package/src/entrypoints/daemon.ts +0 -54
- package/src/entrypoints/headless-stdio.ts +0 -27
- package/src/entrypoints/interactive.ts +0 -112
- package/src/main.ts +0 -44
- package/src/runtime/configure-bun-sqlite.ts +0 -3
- package/src/runtime/crash-handlers.ts +0 -128
- package/src/runtime/interactive-invocation.test.ts +0 -42
- package/src/runtime/interactive-invocation.ts +0 -51
- package/src/runtime/internal-mode.test.ts +0 -19
- package/src/runtime/internal-mode.ts +0 -24
- package/src/runtime/launch-spec.test.ts +0 -26
- package/src/runtime/launch-spec.ts +0 -84
- package/src/runtime/owner-lease.ts +0 -52
- package/src/runtime/public-mode.test.ts +0 -18
- package/src/runtime/public-mode.ts +0 -19
- package/src/runtime/run-internal-mode.ts +0 -19
- package/src/runtime/runtime-kind.test.ts +0 -23
- package/src/runtime/runtime-kind.ts +0 -41
- package/src/runtime/spawn-aria.ts +0 -62
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React, { useState, useMemo } from "react";
|
|
3
|
-
import { Box, Text, useInput } from "ink";
|
|
4
|
-
import { isEscapeInput } from "../../utils/keys.js";
|
|
5
|
-
import { getTheme, getAvailableThemes, getThemeDefinition, setTheme } from "../../theme/index.js";
|
|
6
|
-
const CATEGORY_LABELS = {
|
|
7
|
-
standard: "Standard",
|
|
8
|
-
claude: "Claude",
|
|
9
|
-
accessible: "Accessible",
|
|
10
|
-
};
|
|
11
|
-
const CATEGORY_ORDER = ["standard", "claude", "accessible"];
|
|
12
|
-
/** Classify a theme into a UI category. Exported for testing. */
|
|
13
|
-
export function categorize(name) {
|
|
14
|
-
// Daltonized/accessible variants are accessibility themes regardless of prefix
|
|
15
|
-
if (name.includes("daltonized") || name.includes("accessible"))
|
|
16
|
-
return "accessible";
|
|
17
|
-
if (name.startsWith("claude-"))
|
|
18
|
-
return "claude";
|
|
19
|
-
return "standard";
|
|
20
|
-
}
|
|
21
|
-
/** Derive light/dark from the theme's actual text color brightness, not the name. */
|
|
22
|
-
function isLightTheme(def) {
|
|
23
|
-
const hex = def.colors.text.replace("#", "");
|
|
24
|
-
const r = parseInt(hex.slice(0, 2), 16);
|
|
25
|
-
const g = parseInt(hex.slice(2, 4), 16);
|
|
26
|
-
const b = parseInt(hex.slice(4, 6), 16);
|
|
27
|
-
return (r * 299 + g * 587 + b * 114) / 1000 < 128;
|
|
28
|
-
}
|
|
29
|
-
function buildThemeOptions(currentName) {
|
|
30
|
-
return getAvailableThemes().map((name) => {
|
|
31
|
-
const def = getThemeDefinition(name);
|
|
32
|
-
return {
|
|
33
|
-
name,
|
|
34
|
-
displayName: def.displayName,
|
|
35
|
-
isCurrent: name === currentName,
|
|
36
|
-
isLight: isLightTheme(def),
|
|
37
|
-
category: categorize(name),
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Code sample rendered with actual theme colors (not cli-highlight, which
|
|
43
|
-
* uses its own hardcoded palette and looks identical across themes).
|
|
44
|
-
* Each token is colored with the theme's semantic colors so users can
|
|
45
|
-
* see real differences between themes.
|
|
46
|
-
*/
|
|
47
|
-
function CodePreview({ theme }) {
|
|
48
|
-
const c = theme.colors;
|
|
49
|
-
// Map semantic roles to theme colors:
|
|
50
|
-
// primary = keywords, info = strings, success = types, textMuted = comments, text = identifiers
|
|
51
|
-
const kw = c.primary; // keywords: async, function, const, if, throw, return
|
|
52
|
-
const str = c.info; // strings and template literals
|
|
53
|
-
const typ = c.success; // types: string, Promise, User
|
|
54
|
-
const cmt = c.textMuted; // comments
|
|
55
|
-
const id = c.text; // identifiers, operators, punctuation
|
|
56
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: cmt, children: "// fetch a user by ID" }), _jsxs(Box, { children: [_jsx(Text, { color: kw, children: "async function " }), _jsx(Text, { color: id, children: "fetchUser" }), _jsx(Text, { color: id, children: "(" }), _jsx(Text, { color: id, children: "id" }), _jsx(Text, { color: id, children: ": " }), _jsx(Text, { color: typ, children: "string" }), _jsx(Text, { color: id, children: ") {" })] }), _jsxs(Box, { children: [_jsx(Text, { color: id, children: " " }), _jsx(Text, { color: kw, children: "const " }), _jsx(Text, { color: id, children: "res = " }), _jsx(Text, { color: kw, children: "await " }), _jsx(Text, { color: id, children: "fetch(" }), _jsx(Text, { color: str, children: "`/api/users/${" }), _jsx(Text, { color: id, children: "id" }), _jsx(Text, { color: str, children: "}`" }), _jsx(Text, { color: id, children: ")" })] }), _jsxs(Box, { children: [_jsx(Text, { color: id, children: " " }), _jsx(Text, { color: kw, children: "if " }), _jsx(Text, { color: id, children: "(!res.ok) " }), _jsx(Text, { color: kw, children: "throw new " }), _jsx(Text, { color: typ, children: "Error" }), _jsx(Text, { color: id, children: "(" }), _jsx(Text, { color: str, children: "`HTTP ${" }), _jsx(Text, { color: id, children: "res.status" }), _jsx(Text, { color: str, children: "}`" }), _jsx(Text, { color: id, children: ")" })] }), _jsxs(Box, { children: [_jsx(Text, { color: id, children: " " }), _jsx(Text, { color: kw, children: "return " }), _jsx(Text, { color: id, children: "res.json() " }), _jsx(Text, { color: kw, children: "as " }), _jsx(Text, { color: typ, children: "Promise" }), _jsx(Text, { color: id, children: "<" }), _jsx(Text, { color: typ, children: "User" }), _jsx(Text, { color: id, children: ">" })] }), _jsx(Text, { color: id, children: "}" })] }));
|
|
57
|
-
}
|
|
58
|
-
/** Live preview showing theme-colored code + UI elements. */
|
|
59
|
-
function ThemePreview({ theme }) {
|
|
60
|
-
const c = theme.colors;
|
|
61
|
-
const s = theme.symbols;
|
|
62
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: c.secondary, paddingX: 1, children: [_jsxs(Text, { bold: true, color: c.primary, children: [s.prompt, " ", theme.displayName] }), _jsx(Box, { marginTop: 1, flexDirection: "column", children: _jsx(CodePreview, { theme: theme }) }), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsxs(Text, { color: c.success, children: [s.success, " Tests passed (3/3)"] }), _jsxs(Text, { color: c.error, children: [s.error, " Error: connection refused"] }), _jsxs(Text, { color: c.warning, children: [s.warning, " Deprecated API call"] }), _jsx(Box, { children: _jsx(Text, { color: c.diffAdded, children: "+ const data = await fetch(url);" }) }), _jsx(Box, { children: _jsx(Text, { color: c.diffRemoved, children: "- const data = http.get(url);" }) }), _jsxs(Text, { color: c.textMuted, children: [s.info, " 1.2k tokens ", s.bullet, " $0.01 ", s.bullet, " 0.8s"] })] })] }));
|
|
63
|
-
}
|
|
64
|
-
export function ThemeSelector({ onSelect, onCancel }) {
|
|
65
|
-
const originalThemeName = useMemo(() => getTheme().name, []);
|
|
66
|
-
const allOptions = useMemo(() => buildThemeOptions(originalThemeName), [originalThemeName]);
|
|
67
|
-
const { items, selectableIndices } = useMemo(() => {
|
|
68
|
-
const items = [];
|
|
69
|
-
const selectableIndices = [];
|
|
70
|
-
const groups = new Map();
|
|
71
|
-
for (const opt of allOptions) {
|
|
72
|
-
const group = groups.get(opt.category) ?? [];
|
|
73
|
-
group.push(opt);
|
|
74
|
-
groups.set(opt.category, group);
|
|
75
|
-
}
|
|
76
|
-
for (const cat of CATEGORY_ORDER) {
|
|
77
|
-
const groupOptions = groups.get(cat);
|
|
78
|
-
if (!groupOptions?.length)
|
|
79
|
-
continue;
|
|
80
|
-
items.push({ type: "header", label: CATEGORY_LABELS[cat] ?? cat });
|
|
81
|
-
for (const opt of groupOptions) {
|
|
82
|
-
selectableIndices.push(items.length);
|
|
83
|
-
items.push({ type: "theme", option: opt });
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return { items, selectableIndices };
|
|
87
|
-
}, [allOptions]);
|
|
88
|
-
const currentIdx = selectableIndices.findIndex((itemIdx) => {
|
|
89
|
-
const item = items[itemIdx];
|
|
90
|
-
return item?.type === "theme" && item.option.isCurrent;
|
|
91
|
-
});
|
|
92
|
-
const [selectedIndex, setSelectedIndex] = useState(currentIdx >= 0 ? currentIdx : 0);
|
|
93
|
-
const safeIndex = selectableIndices.length > 0 ? Math.min(selectedIndex, selectableIndices.length - 1) : 0;
|
|
94
|
-
// Live preview: apply theme SYNCHRONOUSLY during render so getTheme()
|
|
95
|
-
// returns the previewed theme in this same render pass.
|
|
96
|
-
const previewedItem = items[selectableIndices[safeIndex]];
|
|
97
|
-
const previewedThemeName = previewedItem?.type === "theme" ? previewedItem.option.name : null;
|
|
98
|
-
if (previewedThemeName) {
|
|
99
|
-
setTheme(previewedThemeName);
|
|
100
|
-
}
|
|
101
|
-
const handleCancel = React.useCallback(() => {
|
|
102
|
-
setTheme(originalThemeName);
|
|
103
|
-
onCancel();
|
|
104
|
-
}, [originalThemeName, onCancel]);
|
|
105
|
-
const isRawModeSupported = process.stdin.isTTY ?? false;
|
|
106
|
-
useInput((input, key) => {
|
|
107
|
-
if (isEscapeInput(input, key)) {
|
|
108
|
-
handleCancel();
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
if (key.return && selectableIndices.length > 0) {
|
|
112
|
-
const itemIdx = selectableIndices[safeIndex];
|
|
113
|
-
const item = items[itemIdx];
|
|
114
|
-
if (item.type === "theme") {
|
|
115
|
-
onSelect({ name: item.option.name, displayName: item.option.displayName });
|
|
116
|
-
}
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
if (key.upArrow) {
|
|
120
|
-
setSelectedIndex((i) => Math.max(0, i - 1));
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (key.downArrow) {
|
|
124
|
-
setSelectedIndex((i) => Math.min(selectableIndices.length - 1, i + 1));
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
}, { isActive: isRawModeSupported });
|
|
128
|
-
// Read the live-previewed theme — all colors below reflect the highlighted theme
|
|
129
|
-
const theme = getTheme();
|
|
130
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.colors.primary, paddingX: 1, children: [_jsxs(Box, { marginBottom: 1, children: [_jsx(Text, { bold: true, color: theme.colors.primary, children: "Theme" }), _jsxs(Text, { color: theme.colors.textMuted, children: [" ", theme.symbols.arrow, " select a color theme"] })] }), _jsxs(Box, { children: [_jsx(Box, { flexDirection: "column", width: 38, children: items.map((item, i) => {
|
|
131
|
-
if (item.type === "header") {
|
|
132
|
-
return (_jsx(Box, { marginTop: i > 0 ? 1 : 0, children: _jsx(Text, { bold: true, color: theme.colors.textMuted, children: item.label }) }, `header-${item.label}`));
|
|
133
|
-
}
|
|
134
|
-
const isHighlighted = selectableIndices[safeIndex] === i;
|
|
135
|
-
const { option } = item;
|
|
136
|
-
return (_jsx(Box, { children: _jsxs(Text, { inverse: isHighlighted, color: isHighlighted ? theme.colors.primary : theme.colors.text, children: [option.isCurrent ? "\u25cf" : "\u25cb", " ", option.displayName] }) }, option.name));
|
|
137
|
-
}) }), _jsx(Box, { flexDirection: "column", flexGrow: 1, marginLeft: 2, children: _jsx(ThemePreview, { theme: theme }) })] }), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: theme.colors.textMuted, children: ["\u2191\u2193", " navigate ", "\u23ce", " select esc cancel"] }) })] }));
|
|
138
|
-
}
|
|
139
|
-
//# sourceMappingURL=ThemeSelector.js.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export { CommandPalette } from "./CommandPalette.js";
|
|
2
|
-
export { ArionSelector, } from "./ArionSelector.js";
|
|
3
|
-
export { ModelSelector } from "./ModelSelector.js";
|
|
4
|
-
export { MemoryBrowser, } from "./MemoryBrowser.js";
|
|
5
|
-
export { SessionSelector } from "./SessionSelector.js";
|
|
6
|
-
export { MessageSelector } from "./MessageSelector.js";
|
|
7
|
-
export { ThemeSelector, categorize as categorizeTheme, } from "./ThemeSelector.js";
|
|
8
|
-
export { PeerSelector } from "./PeerSelector.js";
|
|
9
|
-
export { ClientSelector } from "./ClientSelector.js";
|
|
10
|
-
export { InviteShareOverlay } from "./InviteShareOverlay.js";
|
|
11
|
-
export { JoinInviteOverlay } from "./JoinInviteOverlay.js";
|
|
12
|
-
export { PairRequestOverlay, } from "./PairRequestOverlay.js";
|
|
13
|
-
export { SoundSelector } from "./SoundSelector.js";
|
|
14
|
-
export { DaemonControl, } from "./DaemonControl.js";
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// Changes:
|
|
3
|
-
// - BashTool.inputSchema.parse → direct cast (tool.inputSchema.parse)
|
|
4
|
-
// - BashTool.renderToolUseMessage → tool.renderToolUseMessage
|
|
5
|
-
// - savePermission → onAllow("permanent") directly
|
|
6
|
-
// - logUnaryPermissionEvent → no-op (analytics removed)
|
|
7
|
-
// - Select from CustomSelect
|
|
8
|
-
// - getTheme → ARIA's theme
|
|
9
|
-
import { Box, Text } from "ink";
|
|
10
|
-
import { useMemo } from "react";
|
|
11
|
-
import { usePermissionRequestLogging } from "../hooks.js";
|
|
12
|
-
import { getTheme } from "../../../theme/index.js";
|
|
13
|
-
import { toolUseConfirmGetPrefix } from "../PermissionRequest.js";
|
|
14
|
-
import { PermissionRequestTitle } from "../PermissionRequestTitle.js";
|
|
15
|
-
import { Select } from "../../CustomSelect/select.js";
|
|
16
|
-
import { toolUseOptions } from "../toolUseOptions.js";
|
|
17
|
-
export function BashPermissionRequest({ toolUseConfirm, onDone }) {
|
|
18
|
-
const theme = getTheme();
|
|
19
|
-
// Parse the command from input using the tool's own schema
|
|
20
|
-
const { command } = toolUseConfirm.tool.inputSchema.parse(toolUseConfirm.input);
|
|
21
|
-
const unaryEvent = useMemo(() => ({ completion_type: "tool_use_single", language_name: "none" }), []);
|
|
22
|
-
usePermissionRequestLogging(toolUseConfirm, unaryEvent);
|
|
23
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.colors.primary, marginTop: 1, paddingLeft: 1, paddingRight: 1, paddingBottom: 1, children: [_jsx(PermissionRequestTitle, { title: "Bash command", riskScore: toolUseConfirm.riskScore }), _jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [_jsx(Text, { children: toolUseConfirm.tool.renderToolUseMessage({ command }, { verbose: false }) }), _jsx(Text, { color: theme.colors.textMuted, children: toolUseConfirm.description })] }), _jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "Do you want to proceed?" }), _jsx(Select, { options: toolUseOptions({ toolUseConfirm, command }), onChange: (newValue) => {
|
|
24
|
-
switch (newValue) {
|
|
25
|
-
case "yes":
|
|
26
|
-
toolUseConfirm.onAllow("temporary");
|
|
27
|
-
onDone();
|
|
28
|
-
break;
|
|
29
|
-
case "yes-dont-ask-again-prefix": {
|
|
30
|
-
const prefix = toolUseConfirmGetPrefix(toolUseConfirm);
|
|
31
|
-
if (prefix !== null) {
|
|
32
|
-
toolUseConfirm.onAllow("permanent");
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
// Prefix unexpectedly null — fall back to temporary allow
|
|
36
|
-
// so the modal doesn't get stuck.
|
|
37
|
-
toolUseConfirm.onAllow("temporary");
|
|
38
|
-
}
|
|
39
|
-
onDone();
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
case "yes-dont-ask-again-full":
|
|
43
|
-
toolUseConfirm.onAllow("permanent");
|
|
44
|
-
onDone();
|
|
45
|
-
break;
|
|
46
|
-
case "no":
|
|
47
|
-
toolUseConfirm.onReject();
|
|
48
|
-
onDone();
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
} })] })] }));
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=BashPermissionRequest.js.map
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// Changes:
|
|
3
|
-
// - Removed logUnaryEvent, env, savePermission, usePermissionRequestLogging calls (analytics/persistence)
|
|
4
|
-
// - getTheme → ARIA's theme
|
|
5
|
-
// - Select from @inkjs/ui → CustomSelect
|
|
6
|
-
// - getCwd → process.cwd()
|
|
7
|
-
import { Box, Text } from "ink";
|
|
8
|
-
import { useMemo } from "react";
|
|
9
|
-
import { getTheme } from "../../theme/index.js";
|
|
10
|
-
import { PermissionRequestTitle, textColorForRiskScore } from "./PermissionRequestTitle.js";
|
|
11
|
-
import { usePermissionRequestLogging } from "./hooks.js";
|
|
12
|
-
import chalk from "chalk";
|
|
13
|
-
import { Select } from "../CustomSelect/select.js";
|
|
14
|
-
export function FallbackPermissionRequest({ toolUseConfirm, onDone, verbose, }) {
|
|
15
|
-
const theme = getTheme();
|
|
16
|
-
// TODO: Avoid these special cases
|
|
17
|
-
const originalUserFacingName = toolUseConfirm.tool.userFacingName(toolUseConfirm.input);
|
|
18
|
-
const userFacingName = originalUserFacingName.endsWith(" (MCP)")
|
|
19
|
-
? originalUserFacingName.slice(0, -6)
|
|
20
|
-
: originalUserFacingName;
|
|
21
|
-
const unaryEvent = useMemo(() => ({
|
|
22
|
-
completion_type: "tool_use_single",
|
|
23
|
-
language_name: "none",
|
|
24
|
-
}), []);
|
|
25
|
-
usePermissionRequestLogging(toolUseConfirm, unaryEvent);
|
|
26
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: textColorForRiskScore(toolUseConfirm.riskScore), marginTop: 1, paddingLeft: 1, paddingRight: 1, paddingBottom: 1, children: [_jsx(PermissionRequestTitle, { title: "Tool use", riskScore: toolUseConfirm.riskScore }), _jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [_jsxs(Text, { children: [userFacingName, "(", toolUseConfirm.tool.renderToolUseMessage(toolUseConfirm.input, { verbose }), ")", originalUserFacingName.endsWith(" (MCP)") ? (_jsx(Text, { color: theme.colors.textMuted, children: " (MCP)" })) : ("")] }), _jsx(Text, { color: theme.colors.textMuted, children: toolUseConfirm.description })] }), _jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "Do you want to proceed?" }), _jsx(Select, { options: [
|
|
27
|
-
{
|
|
28
|
-
label: "Yes",
|
|
29
|
-
value: "yes",
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
label: `Yes, and don't ask again for ${chalk.bold(userFacingName)} commands in ${chalk.bold(process.cwd())}`,
|
|
33
|
-
value: "yes-dont-ask-again",
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
label: `No, and provide instructions (${chalk.bold.hex(getTheme().colors.warning)("esc")})`,
|
|
37
|
-
value: "no",
|
|
38
|
-
},
|
|
39
|
-
], onChange: (newValue) => {
|
|
40
|
-
switch (newValue) {
|
|
41
|
-
case "yes":
|
|
42
|
-
toolUseConfirm.onAllow("temporary");
|
|
43
|
-
onDone();
|
|
44
|
-
break;
|
|
45
|
-
case "yes-dont-ask-again":
|
|
46
|
-
toolUseConfirm.onAllow("permanent");
|
|
47
|
-
onDone();
|
|
48
|
-
break;
|
|
49
|
-
case "no":
|
|
50
|
-
toolUseConfirm.onReject();
|
|
51
|
-
onDone();
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
} })] })] }));
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=FallbackPermissionRequest.js.map
|
package/dist/ui/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// Changes:
|
|
3
|
-
// - Select from @inkjs/ui → CustomSelect
|
|
4
|
-
// - usePermissionRequestLogging → no-op stub
|
|
5
|
-
// - savePermission → onAllow("permanent") directly
|
|
6
|
-
// - logUnaryEvent, env → removed (analytics)
|
|
7
|
-
// - pathInOriginalCwd → inline check
|
|
8
|
-
// - useTerminalSize → from ARIA hooks
|
|
9
|
-
// - getTheme → ARIA's theme
|
|
10
|
-
import { Box, Text } from "ink";
|
|
11
|
-
import { useMemo } from "react";
|
|
12
|
-
import { basename, extname, isAbsolute, resolve } from "path";
|
|
13
|
-
import { getTheme } from "../../../theme/index.js";
|
|
14
|
-
import { PermissionRequestTitle, textColorForRiskScore } from "../PermissionRequestTitle.js";
|
|
15
|
-
import { usePermissionRequestLogging } from "../hooks.js";
|
|
16
|
-
import { FileEditToolDiff } from "./FileEditToolDiff.js";
|
|
17
|
-
import { useTerminalSize } from "../../../hooks/useTerminalSize.js";
|
|
18
|
-
import chalk from "chalk";
|
|
19
|
-
import { Select } from "../../CustomSelect/select.js";
|
|
20
|
-
function pathInOriginalCwd(path) {
|
|
21
|
-
const absolutePath = isAbsolute(path) ? resolve(path) : resolve(process.cwd(), path);
|
|
22
|
-
return absolutePath.startsWith(resolve(process.cwd()));
|
|
23
|
-
}
|
|
24
|
-
function getOptions(path) {
|
|
25
|
-
// Only show don't ask again option for edits in original working directory
|
|
26
|
-
const showDontAskAgainOptions = pathInOriginalCwd(path)
|
|
27
|
-
? [
|
|
28
|
-
{
|
|
29
|
-
label: "Yes, and don't ask again this session",
|
|
30
|
-
value: "yes-dont-ask-again",
|
|
31
|
-
},
|
|
32
|
-
]
|
|
33
|
-
: [];
|
|
34
|
-
return [
|
|
35
|
-
{
|
|
36
|
-
label: "Yes",
|
|
37
|
-
value: "yes",
|
|
38
|
-
},
|
|
39
|
-
...showDontAskAgainOptions,
|
|
40
|
-
{
|
|
41
|
-
label: `No, and provide instructions (${chalk.bold.hex(getTheme().colors.warning)("esc")})`,
|
|
42
|
-
value: "no",
|
|
43
|
-
},
|
|
44
|
-
];
|
|
45
|
-
}
|
|
46
|
-
export function FileEditPermissionRequest({ toolUseConfirm, onDone, verbose, }) {
|
|
47
|
-
const { columns } = useTerminalSize();
|
|
48
|
-
const { file_path, new_string, old_string } = toolUseConfirm.input;
|
|
49
|
-
const unaryEvent = useMemo(() => ({
|
|
50
|
-
completion_type: "str_replace_single",
|
|
51
|
-
language_name: extractLanguageName(file_path),
|
|
52
|
-
}), [file_path]);
|
|
53
|
-
usePermissionRequestLogging(toolUseConfirm, unaryEvent);
|
|
54
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: textColorForRiskScore(toolUseConfirm.riskScore), marginTop: 1, paddingLeft: 1, paddingRight: 1, paddingBottom: 1, children: [_jsx(PermissionRequestTitle, { title: "Edit file", riskScore: toolUseConfirm.riskScore }), _jsx(FileEditToolDiff, { file_path: file_path, new_string: new_string, old_string: old_string, verbose: verbose, width: columns - 12 }), _jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: ["Do you want to make this edit to ", _jsx(Text, { bold: true, children: basename(file_path) }), "?"] }), _jsx(Select, { options: getOptions(file_path), onChange: (newValue) => {
|
|
55
|
-
switch (newValue) {
|
|
56
|
-
case "yes":
|
|
57
|
-
toolUseConfirm.onAllow("temporary");
|
|
58
|
-
onDone();
|
|
59
|
-
break;
|
|
60
|
-
case "yes-dont-ask-again":
|
|
61
|
-
toolUseConfirm.onAllow("permanent");
|
|
62
|
-
onDone();
|
|
63
|
-
break;
|
|
64
|
-
case "no":
|
|
65
|
-
toolUseConfirm.onReject();
|
|
66
|
-
onDone();
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
} })] })] }));
|
|
70
|
-
}
|
|
71
|
-
// Simplified: highlight.js lookup was only used for analytics logging (now a no-op)
|
|
72
|
-
function extractLanguageName(file_path) {
|
|
73
|
-
const ext = extname(file_path);
|
|
74
|
-
return ext ? ext.slice(1) : "unknown";
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=FileEditPermissionRequest.js.map
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { existsSync, readFileSync } from "fs";
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
import { StructuredDiff } from "../../StructuredDiff.js";
|
|
5
|
-
import { Box, Text } from "ink";
|
|
6
|
-
import { getTheme } from "../../../theme/index.js";
|
|
7
|
-
import { relative } from "path";
|
|
8
|
-
import { generateDiff } from "../../../utils/diff.js";
|
|
9
|
-
export function FileEditToolDiff({ file_path, new_string, old_string, verbose, useBorder = true, width, }) {
|
|
10
|
-
const file = useMemo(() => (existsSync(file_path) ? readFileSync(file_path, "utf8") : ""), [file_path]);
|
|
11
|
-
// Generate a FileDiff for ARIA's StructuredDiff component
|
|
12
|
-
const fileDiff = useMemo(() => {
|
|
13
|
-
const newContents = file.replace(old_string, new_string);
|
|
14
|
-
return generateDiff(file_path, file, newContents);
|
|
15
|
-
}, [file_path, file, old_string, new_string]);
|
|
16
|
-
return (_jsx(Box, { flexDirection: "column", children: _jsxs(Box, { borderColor: getTheme().colors.secondary, borderStyle: useBorder ? "round" : undefined, flexDirection: "column", paddingX: 1, children: [_jsx(Box, { paddingBottom: 1, children: _jsx(Text, { bold: true, children: verbose ? file_path : relative(process.cwd(), file_path) }) }), _jsx(StructuredDiff, { diff: fileDiff, dim: false, width: width, showHeader: false })] }) }));
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=FileEditToolDiff.js.map
|
package/dist/ui/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// Changes:
|
|
3
|
-
// - Select from @inkjs/ui → CustomSelect
|
|
4
|
-
// - usePermissionRequestLogging → no-op stub
|
|
5
|
-
// - savePermission → onAllow("permanent") directly
|
|
6
|
-
// - logUnaryEvent, env → removed (analytics)
|
|
7
|
-
// - useTerminalSize → from ARIA hooks
|
|
8
|
-
// - getTheme → ARIA's theme
|
|
9
|
-
import { Box, Text } from "ink";
|
|
10
|
-
import { useMemo } from "react";
|
|
11
|
-
import { basename, extname } from "path";
|
|
12
|
-
import { getTheme } from "../../../theme/index.js";
|
|
13
|
-
import { PermissionRequestTitle, textColorForRiskScore } from "../PermissionRequestTitle.js";
|
|
14
|
-
import { existsSync } from "fs";
|
|
15
|
-
import chalk from "chalk";
|
|
16
|
-
import { usePermissionRequestLogging } from "../hooks.js";
|
|
17
|
-
import { FileWriteToolDiff } from "./FileWriteToolDiff.js";
|
|
18
|
-
import { useTerminalSize } from "../../../hooks/useTerminalSize.js";
|
|
19
|
-
import { Select } from "../../CustomSelect/select.js";
|
|
20
|
-
export function FileWritePermissionRequest({ toolUseConfirm, onDone, verbose, }) {
|
|
21
|
-
const { file_path, content } = toolUseConfirm.input;
|
|
22
|
-
const fileExists = useMemo(() => existsSync(file_path), [file_path]);
|
|
23
|
-
const unaryEvent = useMemo(() => ({
|
|
24
|
-
completion_type: "write_file_single",
|
|
25
|
-
language_name: extractLanguageName(file_path),
|
|
26
|
-
}), [file_path]);
|
|
27
|
-
const { columns } = useTerminalSize();
|
|
28
|
-
usePermissionRequestLogging(toolUseConfirm, unaryEvent);
|
|
29
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: textColorForRiskScore(toolUseConfirm.riskScore), marginTop: 1, paddingLeft: 1, paddingRight: 1, paddingBottom: 1, children: [_jsx(PermissionRequestTitle, { title: `${fileExists ? "Edit" : "Create"} file`, riskScore: toolUseConfirm.riskScore }), _jsx(Box, { flexDirection: "column", children: _jsx(FileWriteToolDiff, { file_path: file_path, content: content, verbose: verbose, width: columns - 12 }) }), _jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: ["Do you want to ", fileExists ? "make this edit to" : "create", " ", _jsx(Text, { bold: true, children: basename(file_path) }), "?"] }), _jsx(Select, { options: [
|
|
30
|
-
{
|
|
31
|
-
label: "Yes",
|
|
32
|
-
value: "yes",
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
label: "Yes, and don't ask again this session",
|
|
36
|
-
value: "yes-dont-ask-again",
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
label: `No, and provide instructions (${chalk.bold.hex(getTheme().colors.warning)("esc")})`,
|
|
40
|
-
value: "no",
|
|
41
|
-
},
|
|
42
|
-
], onChange: (newValue) => {
|
|
43
|
-
switch (newValue) {
|
|
44
|
-
case "yes":
|
|
45
|
-
toolUseConfirm.onAllow("temporary");
|
|
46
|
-
onDone();
|
|
47
|
-
break;
|
|
48
|
-
case "yes-dont-ask-again":
|
|
49
|
-
toolUseConfirm.onAllow("permanent");
|
|
50
|
-
onDone();
|
|
51
|
-
break;
|
|
52
|
-
case "no":
|
|
53
|
-
toolUseConfirm.onReject();
|
|
54
|
-
onDone();
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
} })] })] }));
|
|
58
|
-
}
|
|
59
|
-
// Simplified: highlight.js lookup was only used for analytics logging (now a no-op)
|
|
60
|
-
function extractLanguageName(file_path) {
|
|
61
|
-
const ext = extname(file_path);
|
|
62
|
-
return ext ? ext.slice(1) : "unknown";
|
|
63
|
-
}
|
|
64
|
-
//# sourceMappingURL=FileWritePermissionRequest.js.map
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { existsSync, readFileSync } from "fs";
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
import { StructuredDiff } from "../../StructuredDiff.js";
|
|
5
|
-
import { Box, Text } from "ink";
|
|
6
|
-
import { getTheme } from "../../../theme/index.js";
|
|
7
|
-
import { extname, relative } from "path";
|
|
8
|
-
import { HighlightedCode } from "../../HighlightedCode.js";
|
|
9
|
-
import { generateDiff } from "../../../utils/diff.js";
|
|
10
|
-
export function FileWriteToolDiff({ file_path, content, verbose, width }) {
|
|
11
|
-
const fileExists = useMemo(() => existsSync(file_path), [file_path]);
|
|
12
|
-
const oldContent = useMemo(() => {
|
|
13
|
-
if (!fileExists) {
|
|
14
|
-
return "";
|
|
15
|
-
}
|
|
16
|
-
return readFileSync(file_path, "utf8");
|
|
17
|
-
}, [file_path, fileExists]);
|
|
18
|
-
const fileDiff = useMemo(() => {
|
|
19
|
-
if (!fileExists) {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
return generateDiff(file_path, oldContent, content);
|
|
23
|
-
}, [fileExists, file_path, oldContent, content]);
|
|
24
|
-
return (_jsxs(Box, { borderColor: getTheme().colors.secondary, borderStyle: "round", flexDirection: "column", paddingX: 1, children: [_jsx(Box, { paddingBottom: 1, children: _jsx(Text, { bold: true, children: verbose ? file_path : relative(process.cwd(), file_path) }) }), fileDiff ? (_jsx(StructuredDiff, { diff: fileDiff, dim: false, width: width, showHeader: false })) : (_jsx(HighlightedCode, { code: content || "(No content)", language: extname(file_path).slice(1) }))] }));
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=FileWriteToolDiff.js.map
|
package/dist/ui/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// Changes:
|
|
3
|
-
// - Tool references → name-based dispatch via ToolUseConfirm.tool.name
|
|
4
|
-
// - pathInOriginalCwd, toAbsolutePath, grantWritePermissionForOriginalDir → inline stubs
|
|
5
|
-
// - getCwd → process.cwd()
|
|
6
|
-
// - logUnaryEvent, env → removed (analytics)
|
|
7
|
-
// - usePermissionRequestLogging → no-op stub from hooks.ts
|
|
8
|
-
// - Select from @inkjs/ui → CustomSelect
|
|
9
|
-
// - getTheme → ARIA's theme
|
|
10
|
-
import { Box, Text } from "ink";
|
|
11
|
-
import { useMemo } from "react";
|
|
12
|
-
import { getTheme } from "../../../theme/index.js";
|
|
13
|
-
import { PermissionRequestTitle, textColorForRiskScore } from "../PermissionRequestTitle.js";
|
|
14
|
-
import chalk from "chalk";
|
|
15
|
-
import { usePermissionRequestLogging } from "../hooks.js";
|
|
16
|
-
import { FallbackPermissionRequest } from "../FallbackPermissionRequest.js";
|
|
17
|
-
import { Select } from "../../CustomSelect/select.js";
|
|
18
|
-
import { isAbsolute, resolve } from "path";
|
|
19
|
-
// -- Inline stubs for filesystem permissions --
|
|
20
|
-
function toAbsolutePath(path) {
|
|
21
|
-
return isAbsolute(path) ? resolve(path) : resolve(process.cwd(), path);
|
|
22
|
-
}
|
|
23
|
-
function pathInOriginalCwd(path) {
|
|
24
|
-
const absolutePath = toAbsolutePath(path);
|
|
25
|
-
return absolutePath.startsWith(toAbsolutePath(process.cwd()));
|
|
26
|
-
}
|
|
27
|
-
// In-memory write permission grant (session-scoped)
|
|
28
|
-
let writePermissionGranted = false;
|
|
29
|
-
function grantWritePermissionForOriginalDir() {
|
|
30
|
-
writePermissionGranted = true;
|
|
31
|
-
}
|
|
32
|
-
// Export for testing
|
|
33
|
-
export { writePermissionGranted };
|
|
34
|
-
// -- Tool name sets for path arg detection --
|
|
35
|
-
const FILE_PATH_TOOLS = new Set([
|
|
36
|
-
"Edit",
|
|
37
|
-
"file_edit",
|
|
38
|
-
"str_replace_editor",
|
|
39
|
-
"Write",
|
|
40
|
-
"file_write",
|
|
41
|
-
"create_file",
|
|
42
|
-
"Read",
|
|
43
|
-
"file_read",
|
|
44
|
-
"read_file",
|
|
45
|
-
]);
|
|
46
|
-
const PATH_TOOLS = new Set(["Glob", "glob", "Grep", "grep", "LS", "ls"]);
|
|
47
|
-
const NOTEBOOK_PATH_TOOLS = new Set([
|
|
48
|
-
"NotebookEdit",
|
|
49
|
-
"notebook_edit",
|
|
50
|
-
"NotebookRead",
|
|
51
|
-
"notebook_read",
|
|
52
|
-
]);
|
|
53
|
-
const MULTI_FILE_TOOLS = new Set(["Glob", "glob", "Grep", "grep", "LS", "ls"]);
|
|
54
|
-
function pathArgNameForToolUse(toolUseConfirm) {
|
|
55
|
-
const name = toolUseConfirm.tool.name;
|
|
56
|
-
if (FILE_PATH_TOOLS.has(name))
|
|
57
|
-
return "file_path";
|
|
58
|
-
if (PATH_TOOLS.has(name))
|
|
59
|
-
return "path";
|
|
60
|
-
if (NOTEBOOK_PATH_TOOLS.has(name))
|
|
61
|
-
return "notebook_path";
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
function isMultiFile(toolUseConfirm) {
|
|
65
|
-
return MULTI_FILE_TOOLS.has(toolUseConfirm.tool.name);
|
|
66
|
-
}
|
|
67
|
-
function pathFromToolUse(toolUseConfirm) {
|
|
68
|
-
const pathArgName = pathArgNameForToolUse(toolUseConfirm);
|
|
69
|
-
const input = toolUseConfirm.input;
|
|
70
|
-
if (pathArgName && pathArgName in input) {
|
|
71
|
-
if (typeof input[pathArgName] === "string") {
|
|
72
|
-
return toAbsolutePath(input[pathArgName]);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
return toAbsolutePath(process.cwd());
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
export function FilesystemPermissionRequest({ toolUseConfirm, onDone, verbose, }) {
|
|
81
|
-
const path = pathFromToolUse(toolUseConfirm);
|
|
82
|
-
if (!path) {
|
|
83
|
-
// Fall back to generic permission request if no path is found
|
|
84
|
-
return (_jsx(FallbackPermissionRequest, { toolUseConfirm: toolUseConfirm, onDone: onDone, verbose: verbose }));
|
|
85
|
-
}
|
|
86
|
-
return (_jsx(FilesystemPermissionRequestImpl, { toolUseConfirm: toolUseConfirm, path: path, onDone: onDone, verbose: verbose }));
|
|
87
|
-
}
|
|
88
|
-
function getDontAskAgainOptions(toolUseConfirm, path) {
|
|
89
|
-
if (toolUseConfirm.tool.isReadOnly()) {
|
|
90
|
-
// "Always allow" is not an option for read-only tools,
|
|
91
|
-
// because they always have write permission in the project directory.
|
|
92
|
-
return [];
|
|
93
|
-
}
|
|
94
|
-
// Only show don't ask again option for edits in original working directory
|
|
95
|
-
return pathInOriginalCwd(path)
|
|
96
|
-
? [
|
|
97
|
-
{
|
|
98
|
-
label: "Yes, and don't ask again for file edits this session",
|
|
99
|
-
value: "yes-dont-ask-again",
|
|
100
|
-
},
|
|
101
|
-
]
|
|
102
|
-
: [];
|
|
103
|
-
}
|
|
104
|
-
function FilesystemPermissionRequestImpl({ toolUseConfirm, path, onDone, verbose, }) {
|
|
105
|
-
const userFacingName = toolUseConfirm.tool.userFacingName(toolUseConfirm.input);
|
|
106
|
-
const userFacingReadOrWrite = toolUseConfirm.tool.isReadOnly() ? "Read" : "Edit";
|
|
107
|
-
const title = `${userFacingReadOrWrite} ${isMultiFile(toolUseConfirm) ? "files" : "file"}`;
|
|
108
|
-
const unaryEvent = useMemo(() => ({
|
|
109
|
-
completion_type: "tool_use_single",
|
|
110
|
-
language_name: "none",
|
|
111
|
-
}), []);
|
|
112
|
-
usePermissionRequestLogging(toolUseConfirm, unaryEvent);
|
|
113
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: textColorForRiskScore(toolUseConfirm.riskScore), marginTop: 1, paddingLeft: 1, paddingRight: 1, paddingBottom: 1, children: [_jsx(PermissionRequestTitle, { title: title, riskScore: toolUseConfirm.riskScore }), _jsx(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: _jsxs(Text, { children: [userFacingName, "(", toolUseConfirm.tool.renderToolUseMessage(toolUseConfirm.input, { verbose }), ")"] }) }), _jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "Do you want to proceed?" }), _jsx(Select, { options: [
|
|
114
|
-
{
|
|
115
|
-
label: "Yes",
|
|
116
|
-
value: "yes",
|
|
117
|
-
},
|
|
118
|
-
...getDontAskAgainOptions(toolUseConfirm, path),
|
|
119
|
-
{
|
|
120
|
-
label: `No, and provide instructions (${chalk.bold.hex(getTheme().colors.warning)("esc")})`,
|
|
121
|
-
value: "no",
|
|
122
|
-
},
|
|
123
|
-
], onChange: (newValue) => {
|
|
124
|
-
switch (newValue) {
|
|
125
|
-
case "yes":
|
|
126
|
-
toolUseConfirm.onAllow("temporary");
|
|
127
|
-
onDone();
|
|
128
|
-
break;
|
|
129
|
-
case "yes-dont-ask-again":
|
|
130
|
-
grantWritePermissionForOriginalDir();
|
|
131
|
-
toolUseConfirm.onAllow("permanent");
|
|
132
|
-
onDone();
|
|
133
|
-
break;
|
|
134
|
-
case "no":
|
|
135
|
-
toolUseConfirm.onReject();
|
|
136
|
-
onDone();
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
} })] })] }));
|
|
140
|
-
}
|
|
141
|
-
//# sourceMappingURL=FilesystemPermissionRequest.js.map
|