@aria-cli/cli 1.0.57 → 1.0.58
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 +2 -2
- package/package.json +17 -76
- 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 -367
- package/dist/commands/definitions.js +0 -176
- package/dist/commands/index.js +0 -80
- 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 -62
- 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 -617
- 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 -72
- 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,211 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect, useMemo } from "react";
|
|
3
|
-
import { Box, Text, useInput } from "ink";
|
|
4
|
-
import { isEscapeInput } from "../../utils/keys.js";
|
|
5
|
-
import { getModelColor, getProviderStyle } from "../../theme.js";
|
|
6
|
-
const PROVIDER_LABELS = {
|
|
7
|
-
anthropic: "Anthropic",
|
|
8
|
-
"openai-codex": "OpenAI Codex",
|
|
9
|
-
google: "Google",
|
|
10
|
-
bedrock: "AWS Bedrock",
|
|
11
|
-
"bedrock-converse": "AWS Bedrock (Converse)",
|
|
12
|
-
"github-copilot": "GitHub Copilot",
|
|
13
|
-
openai: "OpenAI",
|
|
14
|
-
local: "Local",
|
|
15
|
-
};
|
|
16
|
-
/** Display order for provider groups in the model selector. */
|
|
17
|
-
const PROVIDER_ORDER = [
|
|
18
|
-
"anthropic",
|
|
19
|
-
"openai-codex",
|
|
20
|
-
"google",
|
|
21
|
-
"bedrock",
|
|
22
|
-
"bedrock-converse",
|
|
23
|
-
"github-copilot",
|
|
24
|
-
"openai",
|
|
25
|
-
"local",
|
|
26
|
-
];
|
|
27
|
-
function getProviderLabel(provider) {
|
|
28
|
-
return PROVIDER_LABELS[provider] || provider;
|
|
29
|
-
}
|
|
30
|
-
function getProviderSortKey(provider) {
|
|
31
|
-
const idx = PROVIDER_ORDER.indexOf(provider);
|
|
32
|
-
return idx >= 0 ? idx : PROVIDER_ORDER.length;
|
|
33
|
-
}
|
|
34
|
-
function buildProviderGroups(models, items, selectableIndices) {
|
|
35
|
-
const groups = new Map();
|
|
36
|
-
for (const model of models) {
|
|
37
|
-
const key = model.provider || "other";
|
|
38
|
-
const group = groups.get(key) ?? [];
|
|
39
|
-
group.push(model);
|
|
40
|
-
groups.set(key, group);
|
|
41
|
-
}
|
|
42
|
-
// Sort groups by PROVIDER_ORDER, models by tier (powerful first)
|
|
43
|
-
const TIER_PRIORITY = {
|
|
44
|
-
powerful: 0,
|
|
45
|
-
balanced: 1,
|
|
46
|
-
fast: 2,
|
|
47
|
-
ensemble: 3,
|
|
48
|
-
};
|
|
49
|
-
const sortedEntries = [...groups.entries()].sort(([a], [b]) => getProviderSortKey(a) - getProviderSortKey(b));
|
|
50
|
-
for (const [provider, groupModels] of sortedEntries) {
|
|
51
|
-
items.push({ type: "header", label: getProviderLabel(provider), provider });
|
|
52
|
-
const tierFromDesc = (desc) => {
|
|
53
|
-
if (!desc)
|
|
54
|
-
return "balanced";
|
|
55
|
-
const d = desc.toLowerCase();
|
|
56
|
-
if (d.includes("deep"))
|
|
57
|
-
return "powerful";
|
|
58
|
-
if (d.includes("quick"))
|
|
59
|
-
return "fast";
|
|
60
|
-
return "balanced";
|
|
61
|
-
};
|
|
62
|
-
// Model family order: Claude first, then OpenAI/GPT, then Gemini, then others
|
|
63
|
-
// Within Claude: opus > sonnet > haiku (via bedrock-opus > bedrock-sonnet > bedrock-haiku)
|
|
64
|
-
const MODEL_FAMILY_ORDER = [
|
|
65
|
-
/^claude-opus-|^opus-|^bedrock-opus-/,
|
|
66
|
-
/^claude-sonnet-|^sonnet-|^bedrock-sonnet-/,
|
|
67
|
-
/^claude-haiku-|^haiku-|^bedrock-haiku-/,
|
|
68
|
-
/^claude-/,
|
|
69
|
-
/^gpt-/,
|
|
70
|
-
/^o[0-9]/,
|
|
71
|
-
/^gemini-/,
|
|
72
|
-
];
|
|
73
|
-
const familyRank = (name) => {
|
|
74
|
-
const lower = name.toLowerCase();
|
|
75
|
-
for (let i = 0; i < MODEL_FAMILY_ORDER.length; i++) {
|
|
76
|
-
if (MODEL_FAMILY_ORDER[i].test(lower))
|
|
77
|
-
return i;
|
|
78
|
-
}
|
|
79
|
-
return MODEL_FAMILY_ORDER.length;
|
|
80
|
-
};
|
|
81
|
-
const sorted = [...groupModels].sort((a, b) => {
|
|
82
|
-
// Primary: family group (Claude > GPT > Gemini)
|
|
83
|
-
const fa = familyRank(a.name);
|
|
84
|
-
const fb = familyRank(b.name);
|
|
85
|
-
if (fa !== fb)
|
|
86
|
-
return fa - fb;
|
|
87
|
-
// Secondary: higher version first (4.6 > 4.5, 5.3 > 5.2)
|
|
88
|
-
// Then tier within same version
|
|
89
|
-
return b.name.localeCompare(a.name);
|
|
90
|
-
});
|
|
91
|
-
for (const model of sorted) {
|
|
92
|
-
selectableIndices.push(items.length);
|
|
93
|
-
items.push({ type: "model", model });
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
const EFFORT_LEVELS = ["low", "medium", "high", "max"];
|
|
98
|
-
const EFFORT_BARS = {
|
|
99
|
-
low: "▌",
|
|
100
|
-
medium: "▌▌",
|
|
101
|
-
high: "▌▌▌",
|
|
102
|
-
max: "▌▌▌▌",
|
|
103
|
-
};
|
|
104
|
-
const EFFORT_LABELS = {
|
|
105
|
-
low: "Low",
|
|
106
|
-
medium: "Medium",
|
|
107
|
-
high: "High",
|
|
108
|
-
max: "Max",
|
|
109
|
-
};
|
|
110
|
-
const EFFORT_COLORS = {
|
|
111
|
-
low: "blue",
|
|
112
|
-
medium: "cyan",
|
|
113
|
-
high: "yellow",
|
|
114
|
-
max: "magenta",
|
|
115
|
-
};
|
|
116
|
-
export function ModelSelector({ models, initialFilter = "", effortLevel, onSelect, onCancel, }) {
|
|
117
|
-
const [filter, setFilter] = useState(initialFilter);
|
|
118
|
-
const [effort, setEffort] = useState(effortLevel ?? "high");
|
|
119
|
-
const allFiltered = models.filter((m) => m.name.toLowerCase().includes(filter.toLowerCase()));
|
|
120
|
-
const visibleModels = allFiltered;
|
|
121
|
-
const { items, selectableIndices } = useMemo(() => {
|
|
122
|
-
const hasProviders = visibleModels.some((m) => m.provider);
|
|
123
|
-
if (!hasProviders) {
|
|
124
|
-
return {
|
|
125
|
-
items: visibleModels.map((m) => ({ type: "model", model: m })),
|
|
126
|
-
selectableIndices: visibleModels.map((_, i) => i),
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
const items = [];
|
|
130
|
-
const selectableIndices = [];
|
|
131
|
-
buildProviderGroups(visibleModels, items, selectableIndices);
|
|
132
|
-
return { items, selectableIndices };
|
|
133
|
-
}, [visibleModels]);
|
|
134
|
-
const currentSelectableIdx = selectableIndices.findIndex((itemIdx) => {
|
|
135
|
-
const item = items[itemIdx];
|
|
136
|
-
return item?.type === "model" && item.model.isCurrent;
|
|
137
|
-
});
|
|
138
|
-
const [selectedIndex, setSelectedIndex] = useState(currentSelectableIdx >= 0 ? currentSelectableIdx : 0);
|
|
139
|
-
useEffect(() => {
|
|
140
|
-
setSelectedIndex((i) => Math.min(i, Math.max(0, selectableIndices.length - 1)));
|
|
141
|
-
}, [selectableIndices.length]);
|
|
142
|
-
const safeIndex = selectableIndices.length > 0 ? Math.min(selectedIndex, selectableIndices.length - 1) : 0;
|
|
143
|
-
const isRawModeSupported = process.stdin.isTTY ?? false;
|
|
144
|
-
useInput((input, key) => {
|
|
145
|
-
if (isEscapeInput(input, key)) {
|
|
146
|
-
onCancel();
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
if (key.return && selectableIndices.length > 0) {
|
|
150
|
-
const itemIdx = selectableIndices[safeIndex];
|
|
151
|
-
const item = items[itemIdx];
|
|
152
|
-
if (item.type === "model") {
|
|
153
|
-
onSelect(item.model, effort);
|
|
154
|
-
}
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
if (key.leftArrow) {
|
|
158
|
-
setEffort((prev) => {
|
|
159
|
-
const idx = EFFORT_LEVELS.indexOf(prev);
|
|
160
|
-
return EFFORT_LEVELS[Math.max(0, idx - 1)];
|
|
161
|
-
});
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
if (key.rightArrow) {
|
|
165
|
-
setEffort((prev) => {
|
|
166
|
-
const idx = EFFORT_LEVELS.indexOf(prev);
|
|
167
|
-
return EFFORT_LEVELS[Math.min(EFFORT_LEVELS.length - 1, idx + 1)];
|
|
168
|
-
});
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
if (key.upArrow) {
|
|
172
|
-
setSelectedIndex((i) => Math.max(0, i - 1));
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
if (key.downArrow) {
|
|
176
|
-
setSelectedIndex((i) => Math.min(selectableIndices.length - 1, i + 1));
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
if (key.backspace || key.delete) {
|
|
180
|
-
setFilter((f) => f.slice(0, -1));
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
if (input && !key.ctrl && !key.meta) {
|
|
184
|
-
setFilter((f) => f + input);
|
|
185
|
-
}
|
|
186
|
-
}, { isActive: isRawModeSupported });
|
|
187
|
-
const positionIndicator = selectableIndices.length > 0 ? ` [${safeIndex + 1}/${selectableIndices.length}]` : "";
|
|
188
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "gray", paddingX: 1, children: [_jsxs(Box, { marginBottom: 1, children: [_jsx(Text, { bold: true, children: "Model" }), _jsx(Text, { dimColor: true, children: positionIndicator }), _jsx(Text, { children: " " }), filter ? _jsx(Text, { color: "cyan", children: filter }) : _jsx(Text, { dimColor: true, children: "Type to search..." })] }), visibleModels.length === 0 && _jsx(Text, { dimColor: true, children: "No matching models" }), (() => {
|
|
189
|
-
// Compute max model name width for aligned descriptions
|
|
190
|
-
const maxNameLen = items.reduce((max, item) => {
|
|
191
|
-
if (item.type !== "model")
|
|
192
|
-
return max;
|
|
193
|
-
return Math.max(max, item.model.name.length);
|
|
194
|
-
}, 0);
|
|
195
|
-
return items.map((item, i) => {
|
|
196
|
-
if (item.type === "header") {
|
|
197
|
-
const style = getProviderStyle(item.provider);
|
|
198
|
-
return (_jsxs(Box, { marginTop: i > 0 ? 1 : 0, children: [_jsxs(Text, { color: style.color, children: [style.icon, " "] }), _jsx(Text, { bold: true, color: style.color, children: item.label })] }, `header-${item.label}-${i}`));
|
|
199
|
-
}
|
|
200
|
-
if (item.type === "hint") {
|
|
201
|
-
return (_jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, italic: true, children: item.label }) }, "hint"));
|
|
202
|
-
}
|
|
203
|
-
const isSelected = selectableIndices[safeIndex] === i;
|
|
204
|
-
const showDescription = item.model.description;
|
|
205
|
-
const padded = item.model.name.padEnd(maxNameLen);
|
|
206
|
-
const modelColor = getModelColor(item.model.name);
|
|
207
|
-
return (_jsxs(Box, { children: [_jsxs(Text, { inverse: isSelected, color: isSelected ? undefined : modelColor, dimColor: isSelected ? false : !modelColor, children: [item.model.isCurrent ? "●" : "○", " ", padded] }), showDescription && _jsxs(Text, { dimColor: true, children: [" ", item.model.description] })] }, item.model.value ?? `${item.model.provider}-${item.model.name}`));
|
|
208
|
-
});
|
|
209
|
-
})(), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsxs(Box, { children: [_jsxs(Text, { color: EFFORT_COLORS[effort], children: [EFFORT_BARS[effort], " "] }), _jsxs(Text, { color: EFFORT_COLORS[effort], bold: true, children: [EFFORT_LABELS[effort], " effort"] }), effort === "high" && _jsx(Text, { dimColor: true, children: " (default)" }), _jsx(Text, { dimColor: true, children: " \u2190 \u2192 to adjust" })] }), _jsx(Box, { marginTop: 0, children: _jsx(Text, { dimColor: true, children: "\u2191\u2193 navigate \u2190 \u2192 effort \u23CE select esc cancel" }) })] })] }));
|
|
210
|
-
}
|
|
211
|
-
//# sourceMappingURL=ModelSelector.js.map
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* Pair request overlay — shown when another ARIA instance requests connection.
|
|
4
|
-
*
|
|
5
|
-
* Displays the requester's name and signing key fingerprint for visual
|
|
6
|
-
* verification, with Accept/Reject buttons.
|
|
7
|
-
*/
|
|
8
|
-
import { useState, useRef } from "react";
|
|
9
|
-
import { Box, Text, useInput } from "ink";
|
|
10
|
-
import { getTheme } from "../../theme/index.js";
|
|
11
|
-
import { isEscapeInput } from "../../utils/keys.js";
|
|
12
|
-
export function PairRequestOverlay({ request, onAccept, onReject }) {
|
|
13
|
-
const [selected, setSelected] = useState("accept");
|
|
14
|
-
const submittedRef = useRef(false);
|
|
15
|
-
const theme = getTheme();
|
|
16
|
-
const isRawModeSupported = process.stdin.isTTY ?? false;
|
|
17
|
-
const formatFp = (fp) => `${fp.slice(0, 4)} ${fp.slice(4, 8)} ${fp.slice(8, 12)} ${fp.slice(12, 16)}`;
|
|
18
|
-
useInput((input, key) => {
|
|
19
|
-
if (submittedRef.current)
|
|
20
|
-
return;
|
|
21
|
-
if (key.return) {
|
|
22
|
-
submittedRef.current = true;
|
|
23
|
-
if (selected === "accept") {
|
|
24
|
-
onAccept();
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
onReject();
|
|
28
|
-
}
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
if (isEscapeInput(input, key)) {
|
|
32
|
-
submittedRef.current = true;
|
|
33
|
-
onReject();
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
if (key.leftArrow || key.rightArrow || key.tab) {
|
|
37
|
-
setSelected((s) => (s === "accept" ? "reject" : "accept"));
|
|
38
|
-
}
|
|
39
|
-
}, { isActive: isRawModeSupported });
|
|
40
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.colors.warning, paddingX: 2, paddingY: 1, children: [_jsxs(Text, { bold: true, color: theme.colors.warning, children: [" ", "Connection Request", " "] }), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { children: [_jsx(Text, { bold: true, children: request.displayNameSnapshot ?? request.nodeId }), " wants to connect"] }) }), _jsx(Box, { children: _jsxs(Text, { dimColor: true, children: ["Fingerprint: ", formatFp(request.principalFingerprint)] }) }), _jsxs(Box, { marginTop: 1, gap: 2, children: [_jsxs(Text, { inverse: selected === "accept", color: selected === "accept" ? theme.colors.success : undefined, children: [" ", "Accept", " "] }), _jsxs(Text, { inverse: selected === "reject", color: selected === "reject" ? theme.colors.error : undefined, children: [" ", "Reject", " "] })] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "\u2190\u2192 select \u23CE confirm esc reject" }) })] }));
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=PairRequestOverlay.js.map
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* AirDrop-style peer selection overlay.
|
|
4
|
-
*
|
|
5
|
-
* Shows nearby ARIA instances discovered via mDNS/Bonjour.
|
|
6
|
-
* User navigates with arrow keys, presses Enter to initiate pairing.
|
|
7
|
-
*/
|
|
8
|
-
import { useState, useEffect, useMemo } from "react";
|
|
9
|
-
import { Box, Text, useInput } from "ink";
|
|
10
|
-
import { getTheme } from "../../theme/index.js";
|
|
11
|
-
import { isEscapeInput } from "../../utils/keys.js";
|
|
12
|
-
function peerMatchesFilter(peer, filter) {
|
|
13
|
-
const normalizedFilter = filter.trim().toLowerCase();
|
|
14
|
-
if (!normalizedFilter) {
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
const searchFields = [
|
|
18
|
-
peer.displayNameSnapshot,
|
|
19
|
-
peer.nodeId,
|
|
20
|
-
peer.host,
|
|
21
|
-
peer.port?.toString(),
|
|
22
|
-
peer.principalFingerprint,
|
|
23
|
-
peer.transport,
|
|
24
|
-
peer.status,
|
|
25
|
-
]
|
|
26
|
-
.filter((value) => typeof value === "string" && value.length > 0)
|
|
27
|
-
.map((value) => value.toLowerCase());
|
|
28
|
-
return searchFields.some((field) => field.includes(normalizedFilter));
|
|
29
|
-
}
|
|
30
|
-
function clampSelectedIndex(index, length) {
|
|
31
|
-
if (length <= 0) {
|
|
32
|
-
return 0;
|
|
33
|
-
}
|
|
34
|
-
return Math.min(index, length - 1);
|
|
35
|
-
}
|
|
36
|
-
export function PeerSelector({ peers, sameHomeClientsAvailable = false, onSelect, onCancel, }) {
|
|
37
|
-
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
38
|
-
const [filter, setFilter] = useState("");
|
|
39
|
-
const theme = getTheme();
|
|
40
|
-
const filteredPeers = useMemo(() => peers.filter((peer) => peerMatchesFilter(peer, filter)), [peers, filter]);
|
|
41
|
-
// Clamp index when peer list changes
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
setSelectedIndex((i) => clampSelectedIndex(i, filteredPeers.length));
|
|
44
|
-
}, [filteredPeers.length]);
|
|
45
|
-
const safeIndex = clampSelectedIndex(selectedIndex, filteredPeers.length);
|
|
46
|
-
const isRawModeSupported = process.stdin.isTTY ?? false;
|
|
47
|
-
useInput((input, key) => {
|
|
48
|
-
if (isEscapeInput(input, key)) {
|
|
49
|
-
onCancel();
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
if (key.return) {
|
|
53
|
-
if (filteredPeers.length > 0) {
|
|
54
|
-
onSelect(filteredPeers[safeIndex]);
|
|
55
|
-
}
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (key.upArrow) {
|
|
59
|
-
setSelectedIndex((i) => Math.max(0, i - 1));
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
if (key.downArrow) {
|
|
63
|
-
setSelectedIndex((i) => clampSelectedIndex(i + 1, filteredPeers.length));
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (key.backspace || key.delete) {
|
|
67
|
-
setFilter((current) => current.slice(0, -1));
|
|
68
|
-
setSelectedIndex(0);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (input && !key.ctrl && !key.meta) {
|
|
72
|
-
setFilter((current) => current + input);
|
|
73
|
-
setSelectedIndex(0);
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
}, { isActive: isRawModeSupported });
|
|
77
|
-
const formatFp = (fp) => `${fp.slice(0, 4)} ${fp.slice(4, 8)} ${fp.slice(8, 12)} ${fp.slice(12, 16)}`;
|
|
78
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.colors.secondary, paddingX: 1, children: [_jsxs(Text, { bold: true, color: theme.colors.primary, children: [" ", "Nearby Peers", " "] }), filter ? _jsxs(Text, { dimColor: true, children: [" (filter: \"", filter, "\")"] }) : null, filteredPeers.length === 0 && (_jsx(Text, { dimColor: true, children: filter
|
|
79
|
-
? "No peers match your filter."
|
|
80
|
-
: sameHomeClientsAvailable
|
|
81
|
-
? "No peer nodes. Use /clients for same-home terminals."
|
|
82
|
-
: "Scanning... no peers found yet" })), filteredPeers.map((peer, i) => (_jsxs(Box, { children: [_jsxs(Text, { inverse: i === safeIndex, color: i === safeIndex ? theme.colors.primary : undefined, children: [i === safeIndex ? " ▸ " : " ", peer.displayNameSnapshot] }), peer.status === "connected" ? (_jsx(Text, { color: "green", children: " \u2713 connected" })) : (_jsxs(Text, { dimColor: true, children: [" ", peer.host, ":", peer.port] })), peer.principalFingerprint ? (_jsxs(Text, { color: theme.colors.secondary, children: [" ", formatFp(peer.principalFingerprint)] })) : null] }, `${peer.displayNameSnapshot}-${peer.nodeId}-${i}`))), _jsx(Box, { marginTop: filteredPeers.length > 0 ? 1 : 0, children: _jsx(Text, { dimColor: true, children: "type to search \u2191\u2193 navigate \u23CE connect esc cancel" }) })] }));
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=PeerSelector.js.map
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// packages/cli/src/ui/components/overlays/SessionSelector.tsx
|
|
3
|
-
import { useState, useEffect } from "react";
|
|
4
|
-
import { Box, Text, useInput } from "ink";
|
|
5
|
-
import { isEscapeInput } from "../../utils/keys.js";
|
|
6
|
-
import { useTerminalSize } from "../../hooks/useTerminalSize.js";
|
|
7
|
-
function formatRelativeTime(date) {
|
|
8
|
-
const now = Date.now();
|
|
9
|
-
const diff = now - date.getTime();
|
|
10
|
-
const minutes = Math.floor(diff / 60000);
|
|
11
|
-
const hours = Math.floor(diff / 3600000);
|
|
12
|
-
const days = Math.floor(diff / 86400000);
|
|
13
|
-
if (minutes < 1)
|
|
14
|
-
return "just now";
|
|
15
|
-
if (minutes < 60)
|
|
16
|
-
return `${minutes}m ago`;
|
|
17
|
-
if (hours < 24)
|
|
18
|
-
return `${hours}h ago`;
|
|
19
|
-
if (days < 7)
|
|
20
|
-
return `${days}d ago`;
|
|
21
|
-
return date.toLocaleDateString();
|
|
22
|
-
}
|
|
23
|
-
export function SessionSelector({ sessions, onSelect, onCancel, onSearch, onPageChange, }) {
|
|
24
|
-
const { columns } = useTerminalSize();
|
|
25
|
-
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
26
|
-
const [searchQuery, setSearchQuery] = useState("");
|
|
27
|
-
const [page, setPage] = useState(0);
|
|
28
|
-
const pageSize = 8;
|
|
29
|
-
const totalPages = Math.max(1, Math.ceil(sessions.length / pageSize));
|
|
30
|
-
const pageItems = sessions.slice(page * pageSize, (page + 1) * pageSize);
|
|
31
|
-
// Clamp selection when sessions change
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
setSelectedIndex((i) => Math.min(i, Math.max(0, pageItems.length - 1)));
|
|
34
|
-
}, [pageItems.length]);
|
|
35
|
-
// Clamp page when session list size changes
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
setPage((p) => Math.min(p, Math.max(0, totalPages - 1)));
|
|
38
|
-
}, [totalPages]);
|
|
39
|
-
// Safe index that's always in bounds (sync guard against async useEffect lag)
|
|
40
|
-
const safeIndex = pageItems.length > 0 ? Math.min(selectedIndex, pageItems.length - 1) : 0;
|
|
41
|
-
// Only use input handling when stdin supports raw mode
|
|
42
|
-
const isRawModeSupported = process.stdin.isTTY ?? false;
|
|
43
|
-
useInput((input, key) => {
|
|
44
|
-
if (isEscapeInput(input, key)) {
|
|
45
|
-
onCancel();
|
|
46
|
-
}
|
|
47
|
-
else if (key.return && pageItems.length > 0) {
|
|
48
|
-
onSelect(pageItems[safeIndex].id);
|
|
49
|
-
}
|
|
50
|
-
else if (key.upArrow) {
|
|
51
|
-
setSelectedIndex((i) => Math.max(0, i - 1));
|
|
52
|
-
}
|
|
53
|
-
else if (key.downArrow) {
|
|
54
|
-
setSelectedIndex((i) => Math.min(pageItems.length - 1, i + 1));
|
|
55
|
-
}
|
|
56
|
-
else if (key.leftArrow && page > 0) {
|
|
57
|
-
setPage((p) => p - 1);
|
|
58
|
-
setSelectedIndex(0);
|
|
59
|
-
}
|
|
60
|
-
else if (key.leftArrow && page === 0) {
|
|
61
|
-
onPageChange?.("prev");
|
|
62
|
-
setSelectedIndex(0);
|
|
63
|
-
}
|
|
64
|
-
else if (key.rightArrow && page < totalPages - 1) {
|
|
65
|
-
setPage((p) => p + 1);
|
|
66
|
-
setSelectedIndex(0);
|
|
67
|
-
}
|
|
68
|
-
else if (key.rightArrow && page === totalPages - 1) {
|
|
69
|
-
onPageChange?.("next");
|
|
70
|
-
setSelectedIndex(0);
|
|
71
|
-
}
|
|
72
|
-
else if (key.backspace || key.delete) {
|
|
73
|
-
const next = searchQuery.slice(0, -1);
|
|
74
|
-
setSearchQuery(next);
|
|
75
|
-
setPage(0);
|
|
76
|
-
setSelectedIndex(0);
|
|
77
|
-
onSearch(next);
|
|
78
|
-
}
|
|
79
|
-
else if (input && !key.ctrl && !key.meta) {
|
|
80
|
-
const next = searchQuery + input;
|
|
81
|
-
setSearchQuery(next);
|
|
82
|
-
setPage(0);
|
|
83
|
-
setSelectedIndex(0);
|
|
84
|
-
onSearch(next);
|
|
85
|
-
}
|
|
86
|
-
}, { isActive: isRawModeSupported });
|
|
87
|
-
function truncate(str, len) {
|
|
88
|
-
if (str.length <= len)
|
|
89
|
-
return str;
|
|
90
|
-
return str.slice(0, len - 3) + "...";
|
|
91
|
-
}
|
|
92
|
-
// Use available terminal width so session titles don't feel artificially clipped.
|
|
93
|
-
const titleMaxLen = Math.max(30, Math.min(120, columns - 28));
|
|
94
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [_jsxs(Box, { marginBottom: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: "Sessions" }), searchQuery && _jsxs(Text, { dimColor: true, children: [" (filter: \"", searchQuery, "\")"] }), _jsxs(Text, { dimColor: true, children: [" - ", sessions.length, " sessions"] })] }), sessions.length === 0 ? (_jsx(Text, { dimColor: true, children: searchQuery ? "No sessions match your filter." : "No sessions yet." })) : (pageItems.map((session, index) => {
|
|
95
|
-
const isSelected = index === safeIndex;
|
|
96
|
-
const timeStr = formatRelativeTime(session.updatedAt);
|
|
97
|
-
const title = session.title ?? session.preview ?? "Untitled session";
|
|
98
|
-
const globalIndex = page * pageSize + index;
|
|
99
|
-
return (_jsxs(Box, { flexDirection: "column", marginBottom: index < pageItems.length - 1 ? 1 : 0, children: [_jsxs(Box, { flexDirection: "row", children: [_jsxs(Text, { inverse: isSelected, children: [isSelected ? ">" : " ", " ", globalIndex + 1, ". ", truncate(title, titleMaxLen)] }), _jsxs(Text, { dimColor: true, children: [" [", timeStr, "]"] })] }), _jsxs(Text, { dimColor: true, children: [" ", session.arion, " | ", session.model, " | ", session.messageCount, " messages"] })] }, session.id));
|
|
100
|
-
})), sessions.length > 0 && totalPages > 1 && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { dimColor: true, children: ["Page ", page + 1, "/", totalPages] }) })), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "type to search arrows navigate enter resume esc cancel" }) })] }));
|
|
101
|
-
}
|
|
102
|
-
//# sourceMappingURL=SessionSelector.js.map
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useCallback } from "react";
|
|
3
|
-
import { Box, Text, useInput } from "ink";
|
|
4
|
-
import { isEscapeInput } from "../../utils/keys.js";
|
|
5
|
-
import { getTheme } from "../../theme/index.js";
|
|
6
|
-
import * as sounds from "../../../sounds.js";
|
|
7
|
-
import { loadConfig, saveConfig } from "../../../config.js";
|
|
8
|
-
const SOUND_OPTIONS = [
|
|
9
|
-
{
|
|
10
|
-
id: "toggle",
|
|
11
|
-
label: "Toggle sounds",
|
|
12
|
-
description: "Turn sound notifications on or off",
|
|
13
|
-
icon: "🔊",
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
id: "preview",
|
|
17
|
-
label: "Preview sound",
|
|
18
|
-
description: "Play a sample notification sound",
|
|
19
|
-
icon: "▶",
|
|
20
|
-
},
|
|
21
|
-
];
|
|
22
|
-
export function SoundSelector({ onClose }) {
|
|
23
|
-
const theme = getTheme();
|
|
24
|
-
const c = theme.colors;
|
|
25
|
-
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
26
|
-
const [enabled, setEnabled] = useState(sounds.isEnabled());
|
|
27
|
-
const [previewState, setPreviewState] = useState("idle");
|
|
28
|
-
const handleToggle = useCallback(() => {
|
|
29
|
-
const next = !enabled;
|
|
30
|
-
sounds.setEnabled(next);
|
|
31
|
-
const cfg = loadConfig();
|
|
32
|
-
cfg.soundEnabled = next;
|
|
33
|
-
saveConfig(cfg);
|
|
34
|
-
setEnabled(next);
|
|
35
|
-
if (next) {
|
|
36
|
-
// Play a sound to confirm
|
|
37
|
-
sounds.onSessionStart();
|
|
38
|
-
}
|
|
39
|
-
}, [enabled]);
|
|
40
|
-
const handlePreview = useCallback(() => {
|
|
41
|
-
const previous = enabled;
|
|
42
|
-
if (!previous) {
|
|
43
|
-
sounds.setEnabled(true);
|
|
44
|
-
}
|
|
45
|
-
const played = sounds.previewSound();
|
|
46
|
-
if (!previous) {
|
|
47
|
-
sounds.setEnabled(false);
|
|
48
|
-
}
|
|
49
|
-
setPreviewState(played ? "playing" : "unavailable");
|
|
50
|
-
setTimeout(() => setPreviewState("idle"), 1500);
|
|
51
|
-
}, [enabled]);
|
|
52
|
-
const isRawModeSupported = process.stdin.isTTY ?? false;
|
|
53
|
-
useInput((input, key) => {
|
|
54
|
-
if (isEscapeInput(input, key)) {
|
|
55
|
-
onClose();
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (key.upArrow) {
|
|
59
|
-
setSelectedIndex((i) => Math.max(0, i - 1));
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
if (key.downArrow) {
|
|
63
|
-
setSelectedIndex((i) => Math.min(SOUND_OPTIONS.length - 1, i + 1));
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (key.return) {
|
|
67
|
-
const option = SOUND_OPTIONS[selectedIndex];
|
|
68
|
-
if (option?.id === "toggle") {
|
|
69
|
-
handleToggle();
|
|
70
|
-
}
|
|
71
|
-
else if (option?.id === "preview") {
|
|
72
|
-
handlePreview();
|
|
73
|
-
}
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
}, { isActive: isRawModeSupported });
|
|
77
|
-
const available = sounds.isSoundAvailable();
|
|
78
|
-
const hasAssets = sounds.hasSoundAssets();
|
|
79
|
-
const engineLabel = sounds.getPlaybackEngineLabel();
|
|
80
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: c.primary, paddingX: 1, children: [_jsxs(Box, { marginBottom: 1, children: [_jsx(Text, { bold: true, color: c.primary, children: "🔔 Sound" }), _jsxs(Text, { color: c.textMuted, children: [" ", theme.symbols.arrow, " notification preferences"] })] }), _jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Box, { children: [_jsx(Text, { color: c.textMuted, children: "Status " }), hasAssets ? (_jsx(Text, { bold: true, color: enabled ? c.success : c.textMuted, children: enabled ? "● ON" : "○ OFF" })) : (_jsx(Text, { color: c.warning, children: "\u26A0 Sound files not found" }))] }), _jsxs(Box, { children: [_jsx(Text, { color: c.textMuted, children: "Engine " }), _jsx(Text, { color: available ? c.text : c.warning, children: engineLabel })] }), _jsxs(Box, { children: [_jsx(Text, { color: c.textMuted, children: "Assets " }), _jsx(Text, { color: hasAssets ? c.text : c.warning, children: hasAssets ? "Warcraft II pack found" : "missing" })] })] }), _jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: c.border, children: "─".repeat(40) }) }), _jsx(Box, { flexDirection: "column", children: SOUND_OPTIONS.map((option, i) => {
|
|
81
|
-
const isHighlighted = i === selectedIndex;
|
|
82
|
-
const isToggle = option.id === "toggle";
|
|
83
|
-
return (_jsxs(Box, { paddingX: 1, children: [_jsxs(Text, { inverse: isHighlighted, color: isHighlighted ? c.primary : c.text, children: [option.icon, " ", isToggle ? (enabled ? "Turn off" : "Turn on") : option.label] }), isToggle && isHighlighted && (_jsxs(Text, { color: c.textMuted, children: [" ", enabled ? "→ disable notifications" : "→ enable notifications"] })), option.id === "preview" && previewState === "playing" && (_jsx(Text, { color: c.success, children: " \u266A playing..." })), option.id === "preview" && previewState === "unavailable" && (_jsx(Text, { color: c.warning, children: " \u26A0 preview unavailable" }))] }, option.id));
|
|
84
|
-
}) }), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: c.textMuted, children: ["↑↓", " navigate ", "⏎", " select ", "esc", " close"] }) })] }));
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=SoundSelector.js.map
|