@aria-cli/cli 1.0.14
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-dev.js +15 -0
- package/bin/aria.js +366 -0
- package/bin/install-owner-lease.d.ts +8 -0
- package/bin/install-owner-lease.js +53 -0
- package/dist/.aria-build-stamp.json +4 -0
- package/dist/attached-local-control-client.d.ts +90 -0
- package/dist/bootstrap-local-control-client.d.ts +1 -0
- package/dist/capability-aware-method-proxy.d.ts +1 -0
- package/dist/cli-context.d.ts +31 -0
- package/dist/commands/arions.d.ts +14 -0
- package/dist/commands/auth.d.ts +27 -0
- package/dist/commands/daemon.d.ts +31 -0
- package/dist/commands/definitions.d.ts +19 -0
- package/dist/commands/index.d.ts +13 -0
- package/dist/commands/login-handler.d.ts +108 -0
- package/dist/commands/logout-handler.d.ts +24 -0
- package/dist/commands/memory-handlers.d.ts +15 -0
- package/dist/commands/pairing.d.ts +2 -0
- package/dist/commands/peer-message-handler.d.ts +7 -0
- package/dist/commands/runtime-cutover-reset-command.d.ts +2 -0
- package/dist/commands/runtime-cutover-reset.d.ts +26 -0
- package/dist/commands/terminal-setup.d.ts +3 -0
- package/dist/config/aria-config.d.ts +50 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/loader.d.ts +17 -0
- package/dist/config.d.ts +53 -0
- package/dist/daemon-info.d.ts +17 -0
- package/dist/ensure-daemon.d.ts +21 -0
- package/dist/event-loop-watchdog.d.ts +31 -0
- package/dist/headless/auth-orchestrator.d.ts +19 -0
- package/dist/headless/auth-service.d.ts +15 -0
- package/dist/headless/bootstrap-fast-path.d.ts +12 -0
- package/dist/headless/call-command.d.ts +8 -0
- package/dist/headless/daemon-service.d.ts +14 -0
- package/dist/headless/hook-actions.d.ts +40 -0
- package/dist/headless/hook-service.d.ts +8 -0
- package/dist/headless/kernel-services.d.ts +8 -0
- package/dist/headless/kernel.d.ts +118 -0
- package/dist/headless/operations/arion.d.ts +3 -0
- package/dist/headless/operations/auth.d.ts +4 -0
- package/dist/headless/operations/client.d.ts +2 -0
- package/dist/headless/operations/config.d.ts +3 -0
- package/dist/headless/operations/daemon.d.ts +3 -0
- package/dist/headless/operations/hook.d.ts +3 -0
- package/dist/headless/operations/index.d.ts +10 -0
- package/dist/headless/operations/memory.d.ts +3 -0
- package/dist/headless/operations/message.d.ts +2 -0
- package/dist/headless/operations/model.d.ts +3 -0
- package/dist/headless/operations/peer.d.ts +2 -0
- package/dist/headless/operations/run.d.ts +3 -0
- package/dist/headless/operations/session.d.ts +74 -0
- package/dist/headless/operations/subscription.d.ts +2 -0
- package/dist/headless/operations/system.d.ts +3 -0
- package/dist/headless/operations/utils.d.ts +5 -0
- package/dist/headless/run-orchestrator.d.ts +38 -0
- package/dist/headless/stdio-server.d.ts +4 -0
- package/dist/history/SessionHistory.d.ts +200 -0
- package/dist/history/conversation-message.d.ts +181 -0
- package/dist/history/index.d.ts +8 -0
- package/dist/history/jsonl-replay.d.ts +38 -0
- package/dist/history/repair-tool-pairing.d.ts +14 -0
- package/dist/history/turn-accumulator.d.ts +85 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +505 -0
- package/dist/ink-repl.d.ts +32 -0
- package/dist/local-control-bootstrap.d.ts +5 -0
- package/dist/local-control-client.d.ts +1 -0
- package/dist/local-control-error-reporting.d.ts +6 -0
- package/dist/local-control-http-client.d.ts +9 -0
- package/dist/network-security.d.ts +7 -0
- package/dist/networking-server.d.ts +28 -0
- package/dist/peer-identity.d.ts +3 -0
- package/dist/polling-subscription.d.ts +7 -0
- package/dist/relaunch.d.ts +55 -0
- package/dist/release-notes.d.ts +11 -0
- package/dist/repl-cleanup.d.ts +20 -0
- package/dist/selectable-client.d.ts +7 -0
- package/dist/selectable-peer.d.ts +12 -0
- package/dist/session.d.ts +103 -0
- package/dist/slash-commands.d.ts +34 -0
- package/dist/sounds.d.ts +31 -0
- package/dist/ui/App.d.ts +288 -0
- package/dist/ui/components/AnthropicMethodPicker.d.ts +9 -0
- package/dist/ui/components/ArionPrompt.d.ts +8 -0
- package/dist/ui/components/AutocompleteDropdown.d.ts +9 -0
- package/dist/ui/components/AutonomySelector.d.ts +12 -0
- package/dist/ui/components/Banner.d.ts +9 -0
- package/dist/ui/components/ConversationHistory.d.ts +59 -0
- package/dist/ui/components/CopilotDeviceLoginFlow.d.ts +15 -0
- package/dist/ui/components/CopilotSourcePicker.d.ts +13 -0
- package/dist/ui/components/Cost.d.ts +8 -0
- package/dist/ui/components/CustomSelect/option-map.d.ts +15 -0
- package/dist/ui/components/CustomSelect/select-option.d.ts +20 -0
- package/dist/ui/components/CustomSelect/select.d.ts +55 -0
- package/dist/ui/components/CustomSelect/use-select-state.d.ts +99 -0
- package/dist/ui/components/CustomSelect/use-select.d.ts +14 -0
- package/dist/ui/components/ErrorDisplay.d.ts +26 -0
- package/dist/ui/components/FallbackToolUseRejectedMessage.d.ts +2 -0
- package/dist/ui/components/FileEditToolUpdatedMessage.d.ts +9 -0
- package/dist/ui/components/HandoffMarker.d.ts +17 -0
- package/dist/ui/components/HighlightedCode.d.ts +7 -0
- package/dist/ui/components/InputArea.d.ts +17 -0
- package/dist/ui/components/Message.d.ts +16 -0
- package/dist/ui/components/OAuthLoginFlow.d.ts +25 -0
- package/dist/ui/components/OutputTruncation.d.ts +16 -0
- package/dist/ui/components/PermissionPrompt.d.ts +22 -0
- package/dist/ui/components/PipelineTimingPanel.d.ts +13 -0
- package/dist/ui/components/ProviderMethodPicker.d.ts +16 -0
- package/dist/ui/components/ProviderPicker.d.ts +15 -0
- package/dist/ui/components/RenderItemView.d.ts +18 -0
- package/dist/ui/components/Spinner.d.ts +3 -0
- package/dist/ui/components/StatusBar.d.ts +78 -0
- package/dist/ui/components/StreamingIndicator.d.ts +11 -0
- package/dist/ui/components/StructuredDiff.d.ts +20 -0
- package/dist/ui/components/TextInputOverlay.d.ts +9 -0
- package/dist/ui/components/ThinkingBlock.d.ts +53 -0
- package/dist/ui/components/ToolCost.d.ts +8 -0
- package/dist/ui/components/ToolExecution.d.ts +13 -0
- package/dist/ui/components/ToolHeader.d.ts +10 -0
- package/dist/ui/components/ToolRenderLayoutContext.d.ts +10 -0
- package/dist/ui/components/ToolResultWrapper.d.ts +6 -0
- package/dist/ui/components/ToolUseLoader.d.ts +10 -0
- package/dist/ui/components/TraceWaterfall.d.ts +56 -0
- package/dist/ui/components/index.d.ts +29 -0
- package/dist/ui/components/messages/AssistantTextMessage.d.ts +13 -0
- package/dist/ui/components/messages/UserImageMessage.d.ts +8 -0
- package/dist/ui/components/messages/UserTextMessage.d.ts +13 -0
- package/dist/ui/components/overlays/ArionSelector.d.ts +18 -0
- package/dist/ui/components/overlays/ClientSelector.d.ts +7 -0
- package/dist/ui/components/overlays/CommandPalette.d.ts +14 -0
- package/dist/ui/components/overlays/InviteShareOverlay.d.ts +7 -0
- package/dist/ui/components/overlays/JoinInviteOverlay.d.ts +6 -0
- package/dist/ui/components/overlays/MemoryBrowser.d.ts +17 -0
- package/dist/ui/components/overlays/MessageSelector.d.ts +20 -0
- package/dist/ui/components/overlays/ModelSelector.d.ts +17 -0
- package/dist/ui/components/overlays/PairRequestOverlay.d.ts +19 -0
- package/dist/ui/components/overlays/PeerSelector.d.ts +14 -0
- package/dist/ui/components/overlays/SessionSelector.d.ts +11 -0
- package/dist/ui/components/overlays/ThemeSelector.d.ts +22 -0
- package/dist/ui/components/overlays/index.d.ts +13 -0
- package/dist/ui/components/permissions/BashPermissionRequest/BashPermissionRequest.d.ts +9 -0
- package/dist/ui/components/permissions/FallbackPermissionRequest.d.ts +9 -0
- package/dist/ui/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.d.ts +9 -0
- package/dist/ui/components/permissions/FileEditPermissionRequest/FileEditToolDiff.d.ts +11 -0
- package/dist/ui/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.d.ts +9 -0
- package/dist/ui/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.d.ts +9 -0
- package/dist/ui/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.d.ts +5 -0
- package/dist/ui/components/permissions/PermissionRequest.d.ts +52 -0
- package/dist/ui/components/permissions/PermissionRequestTitle.d.ts +13 -0
- package/dist/ui/components/permissions/hooks.d.ts +10 -0
- package/dist/ui/components/permissions/toolUseOptions.d.ts +10 -0
- package/dist/ui/components/permissions/utils.d.ts +6 -0
- package/dist/ui/components/text-input/Cursor.d.ts +58 -0
- package/dist/ui/components/text-input/TextInput.d.ts +98 -0
- package/dist/ui/components/text-input/imagePaste.d.ts +2 -0
- package/dist/ui/components/text-input/index.d.ts +6 -0
- package/dist/ui/components/text-input/useDoublePress.d.ts +2 -0
- package/dist/ui/components/text-input/useTextInput.d.ts +34 -0
- package/dist/ui/components/tool-types.d.ts +28 -0
- package/dist/ui/constants/figures.d.ts +1 -0
- package/dist/ui/constants/index.d.ts +1 -0
- package/dist/ui/display-mode.d.ts +62 -0
- package/dist/ui/display-policy.d.ts +3 -0
- package/dist/ui/hooks/index.d.ts +4 -0
- package/dist/ui/hooks/useCommandAutocomplete.d.ts +28 -0
- package/dist/ui/hooks/useDoublePress.d.ts +13 -0
- package/dist/ui/hooks/useIndicatorState.d.ts +3 -0
- package/dist/ui/hooks/useInterval.d.ts +6 -0
- package/dist/ui/hooks/useKeyboardShortcuts.d.ts +17 -0
- package/dist/ui/hooks/usePeerMessages.d.ts +26 -0
- package/dist/ui/hooks/useTerminalSize.d.ts +6 -0
- package/dist/ui/hooks/useUnifiedMessages.d.ts +83 -0
- package/dist/ui/indicator-state.d.ts +46 -0
- package/dist/ui/markdown/highlight.d.ts +8 -0
- package/dist/ui/markdown/index.d.ts +16 -0
- package/dist/ui/markdown/tokenizer.d.ts +17 -0
- package/dist/ui/render-item.d.ts +70 -0
- package/dist/ui/screens/REPL.d.ts +288 -0
- package/dist/ui/status-line.d.ts +32 -0
- package/dist/ui/theme/index.d.ts +8 -0
- package/dist/ui/theme/themes/claude-dark-daltonized.d.ts +2 -0
- package/dist/ui/theme/themes/claude-dark.d.ts +2 -0
- package/dist/ui/theme/themes/claude-light-daltonized.d.ts +2 -0
- package/dist/ui/theme/themes/claude-light.d.ts +2 -0
- package/dist/ui/theme/themes/dark-accessible.d.ts +2 -0
- package/dist/ui/theme/themes/dark.d.ts +2 -0
- package/dist/ui/theme/themes/light-accessible.d.ts +2 -0
- package/dist/ui/theme/themes/light.d.ts +2 -0
- package/dist/ui/theme/types.d.ts +51 -0
- package/dist/ui/theme.d.ts +51 -0
- package/dist/ui/to-render-items.d.ts +7 -0
- package/dist/ui/tools/AgentTool/index.d.ts +8 -0
- package/dist/ui/tools/ArchitectTool/index.d.ts +10 -0
- package/dist/ui/tools/AskUserTool/index.d.ts +19 -0
- package/dist/ui/tools/BashTool/BashToolResultMessage.d.ts +13 -0
- package/dist/ui/tools/BashTool/OutputLine.d.ts +6 -0
- package/dist/ui/tools/BashTool/index.d.ts +8 -0
- package/dist/ui/tools/BrowseTool/index.d.ts +20 -0
- package/dist/ui/tools/BrowserTool/index.d.ts +25 -0
- package/dist/ui/tools/CbmTool/index.d.ts +81 -0
- package/dist/ui/tools/CheckDelegationTool/index.d.ts +23 -0
- package/dist/ui/tools/CheckMessagesTool/index.d.ts +8 -0
- package/dist/ui/tools/CreateQuipTool/index.d.ts +10 -0
- package/dist/ui/tools/CreateSkillTool/index.d.ts +13 -0
- package/dist/ui/tools/CreateToolTool/index.d.ts +10 -0
- package/dist/ui/tools/DelegateRemoteTool/index.d.ts +22 -0
- package/dist/ui/tools/DeployTool/index.d.ts +24 -0
- package/dist/ui/tools/FffTool/index.d.ts +17 -0
- package/dist/ui/tools/FileEditTool/index.d.ts +10 -0
- package/dist/ui/tools/FileReadTool/index.d.ts +10 -0
- package/dist/ui/tools/FileWriteTool/index.d.ts +10 -0
- package/dist/ui/tools/FrgTool/index.d.ts +17 -0
- package/dist/ui/tools/GetThreadTool/index.d.ts +10 -0
- package/dist/ui/tools/GlobTool/index.d.ts +11 -0
- package/dist/ui/tools/GrepTool/index.d.ts +12 -0
- package/dist/ui/tools/HatchArionTool/index.d.ts +20 -0
- package/dist/ui/tools/LearnSkillTool/index.d.ts +13 -0
- package/dist/ui/tools/LearnTool/index.d.ts +15 -0
- package/dist/ui/tools/LearnToolTool/index.d.ts +14 -0
- package/dist/ui/tools/ListClientsTool/index.d.ts +10 -0
- package/dist/ui/tools/LspTool/index.d.ts +11 -0
- package/dist/ui/tools/MCPTool/index.d.ts +11 -0
- package/dist/ui/tools/ManageNetworkTool/index.d.ts +28 -0
- package/dist/ui/tools/MemoryReadTool/index.d.ts +8 -0
- package/dist/ui/tools/MemoryWriteTool/index.d.ts +6 -0
- package/dist/ui/tools/NotebookEditTool/index.d.ts +19 -0
- package/dist/ui/tools/NotebookReadTool/index.d.ts +12 -0
- package/dist/ui/tools/OutlookReadTool/index.d.ts +10 -0
- package/dist/ui/tools/OutlookReplyTool/index.d.ts +10 -0
- package/dist/ui/tools/OutlookSendTool/index.d.ts +10 -0
- package/dist/ui/tools/PauseDelegationTool/index.d.ts +20 -0
- package/dist/ui/tools/ProbeTool/index.d.ts +26 -0
- package/dist/ui/tools/ProcessTool/index.d.ts +29 -0
- package/dist/ui/tools/QuestListTool/index.d.ts +24 -0
- package/dist/ui/tools/QuestReportTool/index.d.ts +27 -0
- package/dist/ui/tools/QuestUpdateTool/index.d.ts +24 -0
- package/dist/ui/tools/QuipCommentTool/index.d.ts +23 -0
- package/dist/ui/tools/QuipReadTool/index.d.ts +26 -0
- package/dist/ui/tools/RestArionTool/index.d.ts +19 -0
- package/dist/ui/tools/RestartTool/index.d.ts +20 -0
- package/dist/ui/tools/ResumeDelegationTool/index.d.ts +21 -0
- package/dist/ui/tools/RetireArionTool/index.d.ts +19 -0
- package/dist/ui/tools/RgTool/index.d.ts +44 -0
- package/dist/ui/tools/SearchKnowledgeTool/index.d.ts +31 -0
- package/dist/ui/tools/SearchMessagesTool/index.d.ts +10 -0
- package/dist/ui/tools/SelfDiagnoseTool/index.d.ts +11 -0
- package/dist/ui/tools/SendMessageTool/index.d.ts +8 -0
- package/dist/ui/tools/SerenaTool/index.d.ts +18 -0
- package/dist/ui/tools/SessionHistoryTool/index.d.ts +32 -0
- package/dist/ui/tools/SgTool/index.d.ts +8 -0
- package/dist/ui/tools/SlackReactTool/index.d.ts +10 -0
- package/dist/ui/tools/SlackReadTool/index.d.ts +10 -0
- package/dist/ui/tools/SlackSendTool/index.d.ts +10 -0
- package/dist/ui/tools/SpawnWorkerTool/index.d.ts +18 -0
- package/dist/ui/tools/StickerRequestTool/index.d.ts +6 -0
- package/dist/ui/tools/ThinkTool/index.d.ts +8 -0
- package/dist/ui/tools/UgTool/index.d.ts +47 -0
- package/dist/ui/tools/UseSkillTool/index.d.ts +17 -0
- package/dist/ui/tools/WakeArionTool/index.d.ts +19 -0
- package/dist/ui/tools/WebFetchTool/index.d.ts +20 -0
- package/dist/ui/tools/WebSearchTool/index.d.ts +21 -0
- package/dist/ui/tools/lsTool/index.d.ts +12 -0
- package/dist/ui/tools/registry.d.ts +15 -0
- package/dist/ui/tools/tool-renderer.d.ts +24 -0
- package/dist/ui/tools/truncation.d.ts +6 -0
- package/dist/ui/types/anthropic.d.ts +19 -0
- package/dist/ui/types/index.d.ts +3 -0
- package/dist/ui/types/message.d.ts +19 -0
- package/dist/ui/types/tool.d.ts +17 -0
- package/dist/ui/utils/array.d.ts +1 -0
- package/dist/ui/utils/cursor.d.ts +28 -0
- package/dist/ui/utils/diff.d.ts +24 -0
- package/dist/ui/utils/format.d.ts +3 -0
- package/dist/ui/utils/fuzzy.d.ts +11 -0
- package/dist/ui/utils/index.d.ts +9 -0
- package/dist/ui/utils/keys.d.ts +6 -0
- package/dist/ui/utils/patch.d.ts +8 -0
- package/dist/ui/utils/risk.d.ts +14 -0
- package/dist/ui/utils/terminal-image.d.ts +18 -0
- package/dist/ui/utils/validation.d.ts +8 -0
- package/dist/ui/verb-pairs.d.ts +20 -0
- package/dist/ui.d.ts +70 -0
- package/package.json +76 -0
package/bin/aria-dev.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ARIA CLI — Development entry point (runs from source, no build needed)
|
|
5
|
+
* Registers tsx loader then delegates to the production entry point.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { register } from "node:module";
|
|
9
|
+
import { pathToFileURL } from "node:url";
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
register("tsx/esm", pathToFileURL("./"));
|
|
13
|
+
} catch {}
|
|
14
|
+
|
|
15
|
+
await import("./aria.js");
|
package/bin/aria.js
ADDED
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ARIA CLI - Command-line interface for ARIA
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* aria - Start interactive REPL (Ink UI)
|
|
8
|
+
* aria "message" - Start REPL and auto-send first message
|
|
9
|
+
* aria -r <id> - Resume session by ID/prefix in REPL
|
|
10
|
+
* aria -c - Continue most recent session in REPL
|
|
11
|
+
* aria daemon - Autonomous wake loop
|
|
12
|
+
* aria --help - Show help
|
|
13
|
+
*
|
|
14
|
+
* Heap enforcement:
|
|
15
|
+
* If --max-old-space-size is not set, the script re-execs once
|
|
16
|
+
* with the flag. The re-exec parent does zero application work.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// ── Crash diagnostic infrastructure ─────────────────────────────────
|
|
20
|
+
// Registered before ANY other code so uncaught errors are always captured.
|
|
21
|
+
import { writeFileSync, appendFileSync, mkdirSync } from "node:fs";
|
|
22
|
+
import { join } from "node:path";
|
|
23
|
+
import { homedir } from "node:os";
|
|
24
|
+
import { createHash } from "node:crypto";
|
|
25
|
+
import { RESTART_KIND_ENV, RESUME_SESSION_ENV } from "@aria-cli/types";
|
|
26
|
+
import { withReplCleanup } from "../dist/repl-cleanup.js";
|
|
27
|
+
import { installOwnerLease } from "./install-owner-lease.js";
|
|
28
|
+
|
|
29
|
+
function writeCrashReport(type, error) {
|
|
30
|
+
try {
|
|
31
|
+
const crashDir = join(homedir(), ".aria", "crash-reports");
|
|
32
|
+
mkdirSync(crashDir, { recursive: true });
|
|
33
|
+
const sessionId = process.env[RESUME_SESSION_ENV] || "unknown";
|
|
34
|
+
const mem = process.memoryUsage();
|
|
35
|
+
const report = {
|
|
36
|
+
timestamp: new Date().toISOString(),
|
|
37
|
+
sessionId,
|
|
38
|
+
type,
|
|
39
|
+
error: {
|
|
40
|
+
message: error?.message ?? String(error),
|
|
41
|
+
stack: error?.stack ?? undefined,
|
|
42
|
+
name: error?.name ?? undefined,
|
|
43
|
+
},
|
|
44
|
+
process: {
|
|
45
|
+
pid: process.pid,
|
|
46
|
+
heapUsedMb: Math.round((mem.heapUsed / 1024 / 1024) * 100) / 100,
|
|
47
|
+
rssMb: Math.round((mem.rss / 1024 / 1024) * 100) / 100,
|
|
48
|
+
uptime: Math.round(process.uptime()),
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
writeFileSync(join(crashDir, "latest.json"), JSON.stringify(report, null, 2));
|
|
52
|
+
|
|
53
|
+
// Also append to the central error events journal (CEH integration)
|
|
54
|
+
const ariaDir = join(homedir(), ".aria");
|
|
55
|
+
const errorEventsPath = join(ariaDir, "error-events.jsonl");
|
|
56
|
+
const firstFrame = error?.stack?.split("\n")[1]?.trim() ?? "";
|
|
57
|
+
const bucketedTime = Math.floor(Date.now() / 10000);
|
|
58
|
+
const errorId = createHash("sha256")
|
|
59
|
+
.update(`${error?.message ?? ""}|${firstFrame}|${bucketedTime}`)
|
|
60
|
+
.digest("hex")
|
|
61
|
+
.slice(0, 12);
|
|
62
|
+
|
|
63
|
+
const causeChain = [];
|
|
64
|
+
let cause = error?.cause;
|
|
65
|
+
const seen = new Set();
|
|
66
|
+
while (cause instanceof Error && !seen.has(cause)) {
|
|
67
|
+
seen.add(cause);
|
|
68
|
+
causeChain.push(`${cause.name}: ${cause.message}`);
|
|
69
|
+
cause = cause.cause;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const relatedFiles = [];
|
|
73
|
+
if (error?.stack) {
|
|
74
|
+
for (const line of error.stack.split("\n")) {
|
|
75
|
+
const match = line.match(/\((?:file:\/\/)?([^:)]+):\d+:\d+\)/);
|
|
76
|
+
if (match?.[1]?.includes("packages/") && !match[1].includes("node_modules")) {
|
|
77
|
+
relatedFiles.push(match[1]);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const errorEntry = {
|
|
83
|
+
id: `crash-${errorId}`,
|
|
84
|
+
timestamp: report.timestamp,
|
|
85
|
+
severity: 0,
|
|
86
|
+
category: "crash",
|
|
87
|
+
domain: "cli",
|
|
88
|
+
name: error?.name ?? "UnknownError",
|
|
89
|
+
message: error?.message ?? String(error),
|
|
90
|
+
code: error?.code ?? undefined,
|
|
91
|
+
stackTrace: error?.stack,
|
|
92
|
+
causeChain,
|
|
93
|
+
recoverable: false,
|
|
94
|
+
state: {
|
|
95
|
+
environment: { nodeVersion: process.version, platform: process.platform },
|
|
96
|
+
processInfo: report.process,
|
|
97
|
+
},
|
|
98
|
+
relatedFiles,
|
|
99
|
+
relatedErrors: [],
|
|
100
|
+
status: "new",
|
|
101
|
+
};
|
|
102
|
+
appendFileSync(errorEventsPath, JSON.stringify(errorEntry) + "\n", "utf-8");
|
|
103
|
+
} catch {
|
|
104
|
+
// Best effort — crash report writing must never itself throw
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
process.on("uncaughtException", (error, origin) => {
|
|
109
|
+
writeCrashReport("uncaughtException", error);
|
|
110
|
+
process.stderr.write(`[aria] FATAL uncaughtException (origin: ${origin}):\n`);
|
|
111
|
+
process.stderr.write(`${error?.stack ?? error}\n`);
|
|
112
|
+
process.exit(1);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
process.on("unhandledRejection", (reason) => {
|
|
116
|
+
writeCrashReport("unhandledRejection", reason);
|
|
117
|
+
process.stderr.write(`[aria] FATAL unhandledRejection:\n`);
|
|
118
|
+
process.stderr.write(`${reason?.stack ?? reason}\n`);
|
|
119
|
+
process.exit(1);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
installOwnerLease();
|
|
123
|
+
|
|
124
|
+
// Determine mode based on arguments
|
|
125
|
+
const args = process.argv.slice(2);
|
|
126
|
+
|
|
127
|
+
if (args[0] === "-v" || args[0] === "--version") {
|
|
128
|
+
// Global flags that shouldn't be treated as REPL messages
|
|
129
|
+
import("../dist/commands/index.js")
|
|
130
|
+
.then(({ program }) => program.parseAsync(process.argv))
|
|
131
|
+
.catch((error) => {
|
|
132
|
+
process.stderr.write(`Error: ${error.message}\n`);
|
|
133
|
+
process.exitCode = 1;
|
|
134
|
+
});
|
|
135
|
+
} else {
|
|
136
|
+
// Existing routing: subcommand check + REPL
|
|
137
|
+
const subcommands = [
|
|
138
|
+
"daemon",
|
|
139
|
+
"auth",
|
|
140
|
+
"arions",
|
|
141
|
+
"headless",
|
|
142
|
+
"call",
|
|
143
|
+
"pairing",
|
|
144
|
+
"runtime-cutover-reset",
|
|
145
|
+
"--help",
|
|
146
|
+
"-h",
|
|
147
|
+
];
|
|
148
|
+
const isSubcommand =
|
|
149
|
+
args.length > 0 && (subcommands.includes(args[0]) || args[0].startsWith("--"));
|
|
150
|
+
|
|
151
|
+
// Parse -r/--resume and -c/--continue flags for REPL session resume
|
|
152
|
+
let resumeArg = null;
|
|
153
|
+
let continueSession = false;
|
|
154
|
+
const remainingArgs = [];
|
|
155
|
+
for (let i = 0; i < args.length; i++) {
|
|
156
|
+
if ((args[i] === "-r" || args[i] === "--resume") && !isSubcommand) {
|
|
157
|
+
if (i + 1 >= args.length) {
|
|
158
|
+
process.stderr.write("Error: -r/--resume requires a session ID\n");
|
|
159
|
+
process.exit(2);
|
|
160
|
+
}
|
|
161
|
+
resumeArg = args[++i];
|
|
162
|
+
} else if ((args[i] === "-c" || args[i] === "--continue") && !isSubcommand) {
|
|
163
|
+
continueSession = true;
|
|
164
|
+
} else {
|
|
165
|
+
remainingArgs.push(args[i]);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (resumeArg && continueSession) {
|
|
169
|
+
process.stderr.write("Error: -r/--resume and -c/--continue are mutually exclusive\n");
|
|
170
|
+
process.exit(2);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Auto-resume from supervisor: session ID passed via env var.
|
|
174
|
+
// The child always resumes silently; only explicit CLI args become an
|
|
175
|
+
// auto-submitted initial message.
|
|
176
|
+
if (!resumeArg && !continueSession && process.env[RESUME_SESSION_ENV]) {
|
|
177
|
+
resumeArg = process.env[RESUME_SESSION_ENV];
|
|
178
|
+
// Clear the env vars so they don't propagate to further restarts
|
|
179
|
+
delete process.env[RESUME_SESSION_ENV];
|
|
180
|
+
delete process.env[RESTART_KIND_ENV];
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Treat non-flag remaining args as initial message: `aria "hello"` → REPL with first message
|
|
184
|
+
// Both crash resume and explicit /restart resume the session silently.
|
|
185
|
+
const initialMessage =
|
|
186
|
+
!isSubcommand && remainingArgs.length > 0 ? remainingArgs.join(" ") : undefined;
|
|
187
|
+
|
|
188
|
+
if (!isSubcommand) {
|
|
189
|
+
// Ensure adequate V8 heap for large Memoria databases (history.db > 1 GB).
|
|
190
|
+
// Re-exec once if the flag is missing. The re-exec parent does zero
|
|
191
|
+
// application work — just forwards stdio and exit code.
|
|
192
|
+
if (!process.execArgv.some((a) => a.includes("max-old-space-size"))) {
|
|
193
|
+
process.on("SIGINT", () => {
|
|
194
|
+
/* child owns the terminal */
|
|
195
|
+
});
|
|
196
|
+
import("node:child_process").then(({ spawn }) => {
|
|
197
|
+
const child = spawn(
|
|
198
|
+
process.execPath,
|
|
199
|
+
[
|
|
200
|
+
"--max-old-space-size=8192",
|
|
201
|
+
...process.execArgv,
|
|
202
|
+
process.argv[1],
|
|
203
|
+
...process.argv.slice(2),
|
|
204
|
+
],
|
|
205
|
+
{ stdio: "inherit" },
|
|
206
|
+
);
|
|
207
|
+
child.on("close", (code) => process.exit(code ?? 1));
|
|
208
|
+
});
|
|
209
|
+
} else {
|
|
210
|
+
// Run the Ink REPL directly — no supervisor loop.
|
|
211
|
+
// createCliContext runs in parallel with module imports to overlap
|
|
212
|
+
// the ~1.2s auth resolution with ~0.5s of import/init work.
|
|
213
|
+
Promise.resolve()
|
|
214
|
+
.then(async () => {
|
|
215
|
+
const { createCliContext } = await import("../dist/cli-context.js");
|
|
216
|
+
const { getAriaDir } = await import("../dist/config.js");
|
|
217
|
+
const { ensureDaemon } = await import("../dist/ensure-daemon.js");
|
|
218
|
+
|
|
219
|
+
const ariaDir = getAriaDir();
|
|
220
|
+
|
|
221
|
+
// Start auth resolution immediately — runs in parallel with imports below
|
|
222
|
+
const ctxPromise = createCliContext();
|
|
223
|
+
|
|
224
|
+
// Parallel: import heavy modules while auth resolves
|
|
225
|
+
const [
|
|
226
|
+
{ attachExistingLocalControlClient },
|
|
227
|
+
{ startInkRepl },
|
|
228
|
+
{ ArionManager, ArionStorage },
|
|
229
|
+
{ Memoria },
|
|
230
|
+
{ ArionSession },
|
|
231
|
+
{ SessionHistory },
|
|
232
|
+
] = await Promise.all([
|
|
233
|
+
import("../dist/local-control-client.js"),
|
|
234
|
+
import("../dist/ink-repl.js"),
|
|
235
|
+
import("@aria-cli/aria"),
|
|
236
|
+
import("@aria-cli/memoria"),
|
|
237
|
+
import("../dist/session.js"),
|
|
238
|
+
import("../dist/history/index.js"),
|
|
239
|
+
]);
|
|
240
|
+
|
|
241
|
+
// Await the context (auth likely finished during parallel imports)
|
|
242
|
+
const ctx = await ctxPromise;
|
|
243
|
+
await ensureDaemon(ctx);
|
|
244
|
+
|
|
245
|
+
const bootstrapAttachedLocalControl = await attachExistingLocalControlClient({
|
|
246
|
+
ariaHome: ariaDir,
|
|
247
|
+
clientKind: "tui",
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
const ariaMemoriaPath =
|
|
251
|
+
process.env.ARIA_MEMORY_PATH || `${ctx.ariaDir}/arions/ARIA/memory.db`;
|
|
252
|
+
const ariaMemoria = new Memoria({ path: ariaMemoriaPath, router: ctx.router });
|
|
253
|
+
ariaMemoria.initialize().catch((err) => {
|
|
254
|
+
console.debug(
|
|
255
|
+
`[aria] Memoria background init failed (will retry on use): ${err?.message ?? err}`,
|
|
256
|
+
);
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
const aria = {
|
|
260
|
+
components: { memoria: ariaMemoria },
|
|
261
|
+
async recallUserName() {
|
|
262
|
+
try {
|
|
263
|
+
const db = ariaMemoria.storage?.getDatabase?.();
|
|
264
|
+
if (!db) return null;
|
|
265
|
+
const row = db.prepare("SELECT value FROM config WHERE key = 'user_profile'").get();
|
|
266
|
+
if (!row?.value) return null;
|
|
267
|
+
const profile = JSON.parse(row.value);
|
|
268
|
+
return profile.name ?? null;
|
|
269
|
+
} catch {
|
|
270
|
+
return null;
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
async shutdown() {
|
|
274
|
+
await ariaMemoria.close();
|
|
275
|
+
},
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
const arionStorage = new ArionStorage(ctx.ariaDir);
|
|
279
|
+
const arionManager = new ArionManager(arionStorage, ctx.memoriaFactory);
|
|
280
|
+
await arionManager.initialize();
|
|
281
|
+
arionManager.setRouter(ctx.router);
|
|
282
|
+
if (!bootstrapAttachedLocalControl) {
|
|
283
|
+
throw new Error("[aria] Attached REPL requires an existing local-control runtime");
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// Initialize session history for input persistence
|
|
287
|
+
const arionName = ctx.config.activeArion?.trim() || "ARIA";
|
|
288
|
+
const historyDbPath = SessionHistory.resolvePerArionPath(ctx.ariaDir, arionName);
|
|
289
|
+
SessionHistory.migrateJsonlLogs(ctx.ariaDir, arionName);
|
|
290
|
+
const sessionHistory = new SessionHistory(historyDbPath);
|
|
291
|
+
const inputHistory = sessionHistory.getInputHistory(100);
|
|
292
|
+
const saveInputHistory = (input) => sessionHistory.addInputHistory(input);
|
|
293
|
+
|
|
294
|
+
// Resolve -r / -c to a session ID
|
|
295
|
+
let resumeSessionId = undefined;
|
|
296
|
+
if (resumeArg) {
|
|
297
|
+
const resolved = sessionHistory.findSessionByPrefix(resumeArg);
|
|
298
|
+
if (!resolved) {
|
|
299
|
+
process.stderr.write(`Error: No session found matching "${resumeArg}"\n`);
|
|
300
|
+
process.exit(2);
|
|
301
|
+
}
|
|
302
|
+
resumeSessionId = resolved;
|
|
303
|
+
} else if (continueSession) {
|
|
304
|
+
const recent = sessionHistory.listSessions(1);
|
|
305
|
+
if (recent.length === 0) {
|
|
306
|
+
process.stderr.write("Error: No recent sessions to continue\n");
|
|
307
|
+
process.exit(2);
|
|
308
|
+
}
|
|
309
|
+
resumeSessionId = recent[0].id;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const session = new ArionSession({
|
|
313
|
+
manager: arionManager,
|
|
314
|
+
router: ctx.router,
|
|
315
|
+
memoria: aria.components.memoria,
|
|
316
|
+
onArionRest: async () => {},
|
|
317
|
+
});
|
|
318
|
+
await session.initialize(ctx.config.activeArion);
|
|
319
|
+
|
|
320
|
+
// Pre-cache username for instant display
|
|
321
|
+
let cachedUserName = null;
|
|
322
|
+
try {
|
|
323
|
+
const db = ariaMemoria.storage?.getDatabase?.();
|
|
324
|
+
if (db) {
|
|
325
|
+
const row = db.prepare("SELECT value FROM config WHERE key = 'user_profile'").get();
|
|
326
|
+
if (row?.value) {
|
|
327
|
+
cachedUserName = JSON.parse(row.value).name ?? null;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
} catch {}
|
|
331
|
+
|
|
332
|
+
await startInkRepl(
|
|
333
|
+
session,
|
|
334
|
+
arionManager,
|
|
335
|
+
ctx.router,
|
|
336
|
+
aria,
|
|
337
|
+
bootstrapAttachedLocalControl,
|
|
338
|
+
ctx,
|
|
339
|
+
inputHistory,
|
|
340
|
+
saveInputHistory,
|
|
341
|
+
sessionHistory,
|
|
342
|
+
initialMessage,
|
|
343
|
+
cachedUserName,
|
|
344
|
+
resumeSessionId,
|
|
345
|
+
ctx.availableModels,
|
|
346
|
+
ctx.refreshAvailableModels,
|
|
347
|
+
ctx.credentialHints,
|
|
348
|
+
ctx.authResolver,
|
|
349
|
+
);
|
|
350
|
+
})
|
|
351
|
+
.catch((error) => {
|
|
352
|
+
writeCrashReport("ink-repl-rejected", error);
|
|
353
|
+
console.error("Error starting Ink REPL:", error.message);
|
|
354
|
+
process.exit(1);
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
} else {
|
|
358
|
+
// Subcommand provided - parse commands
|
|
359
|
+
import("../dist/commands/index.js").then(({ program }) => {
|
|
360
|
+
program.parseAsync(process.argv).catch((error) => {
|
|
361
|
+
console.error("Error:", error.message);
|
|
362
|
+
process.exit(1);
|
|
363
|
+
});
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const DEFAULT_OWNER_LEASE_POLL_MS = 1_000;
|
|
2
|
+
|
|
3
|
+
export function installOwnerLease({
|
|
4
|
+
env = process.env,
|
|
5
|
+
processRef = process,
|
|
6
|
+
pollMs = DEFAULT_OWNER_LEASE_POLL_MS,
|
|
7
|
+
onOwnerGone,
|
|
8
|
+
} = {}) {
|
|
9
|
+
const ownerPidRaw = env.ARIA_HARNESS_OWNER_PID;
|
|
10
|
+
if (!ownerPidRaw) {
|
|
11
|
+
return () => {};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const ownerPid = Number.parseInt(ownerPidRaw, 10);
|
|
15
|
+
if (!Number.isFinite(ownerPid) || ownerPid <= 0) {
|
|
16
|
+
throw new Error(`ARIA_HARNESS_OWNER_PID must be a positive integer, got: ${ownerPidRaw}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let released = false;
|
|
20
|
+
const interval = setInterval(() => {
|
|
21
|
+
if (released) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
processRef.kill(ownerPid, 0);
|
|
27
|
+
} catch (error) {
|
|
28
|
+
const code = error && typeof error === "object" && "code" in error ? error.code : undefined;
|
|
29
|
+
if (code && code !== "ESRCH") {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
released = true;
|
|
33
|
+
clearInterval(interval);
|
|
34
|
+
if (onOwnerGone) {
|
|
35
|
+
onOwnerGone(ownerPid);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
processRef.kill(processRef.pid, "SIGTERM");
|
|
39
|
+
}
|
|
40
|
+
}, pollMs);
|
|
41
|
+
interval.unref?.();
|
|
42
|
+
|
|
43
|
+
const dispose = () => {
|
|
44
|
+
if (released) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
released = true;
|
|
48
|
+
clearInterval(interval);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
processRef.once("exit", dispose);
|
|
52
|
+
return dispose;
|
|
53
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { MemoriaFactory, RunSessionConfig, DaemonSafetyPolicy } from "@aria-cli/aria";
|
|
2
|
+
import type { AuthResolver } from "@aria-cli/auth";
|
|
3
|
+
import type { ModelRouter } from "@aria-cli/models";
|
|
4
|
+
import { type ClientId, type NodeId, type RuntimeId } from "@aria-cli/tools";
|
|
5
|
+
import type { HostClientKind } from "@aria-cli/server/runtime/host-supervisor";
|
|
6
|
+
import type { AttachedLocalControlApi, LocalControlApi } from "@aria-cli/server/runtime/local-control-api";
|
|
7
|
+
export interface AttachedLocalControlClient {
|
|
8
|
+
nodeId: NodeId;
|
|
9
|
+
runtimeId: RuntimeId;
|
|
10
|
+
port: number;
|
|
11
|
+
ownership: "started" | "reattached";
|
|
12
|
+
attachedClientId?: string;
|
|
13
|
+
attachedClientAuthToken?: string;
|
|
14
|
+
control: AttachedLocalControlApi;
|
|
15
|
+
release(options?: {
|
|
16
|
+
preserveRuntime?: boolean;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export declare function requestRuntimeSocketLease(runtimeSocket: string, payload: unknown): Promise<{
|
|
20
|
+
clientId: ClientId;
|
|
21
|
+
clientAuthToken: string;
|
|
22
|
+
release(): Promise<void>;
|
|
23
|
+
}>;
|
|
24
|
+
export declare function attachExistingLocalControlClient(options: {
|
|
25
|
+
ariaHome: string;
|
|
26
|
+
clientKind: HostClientKind;
|
|
27
|
+
pollIntervalMs?: number;
|
|
28
|
+
}): Promise<AttachedLocalControlClient | null>;
|
|
29
|
+
export declare function attachLocalControlClient(options: {
|
|
30
|
+
ariaHome: string;
|
|
31
|
+
arionName: string;
|
|
32
|
+
clientKind: HostClientKind;
|
|
33
|
+
runtimeLifecycle?: "scoped" | "persistent";
|
|
34
|
+
memoriaFactory?: MemoriaFactory;
|
|
35
|
+
router?: ModelRouter;
|
|
36
|
+
authResolver?: AuthResolver;
|
|
37
|
+
runSessionConfig?: RunSessionConfig;
|
|
38
|
+
mcpServers?: import("@aria-cli/tools").MCPServerConfig[];
|
|
39
|
+
daemonSafetyPolicy?: DaemonSafetyPolicy;
|
|
40
|
+
autonomousIntervalMs?: number;
|
|
41
|
+
signal?: AbortSignal;
|
|
42
|
+
silent?: boolean;
|
|
43
|
+
port?: number;
|
|
44
|
+
pollIntervalMs?: number;
|
|
45
|
+
}): Promise<AttachedLocalControlClient>;
|
|
46
|
+
export declare function resolveLocalControlClient(options: {
|
|
47
|
+
ariaHome: string;
|
|
48
|
+
pollIntervalMs?: number;
|
|
49
|
+
}): Promise<LocalControlApi | null>;
|
|
50
|
+
export declare function resolveLocalControlClientSync(options: {
|
|
51
|
+
ariaHome: string;
|
|
52
|
+
pollIntervalMs?: number;
|
|
53
|
+
[key: string]: unknown;
|
|
54
|
+
}): LocalControlApi | null;
|
|
55
|
+
export interface ResilientAttachedClientOptions {
|
|
56
|
+
/** Path to the daemon's Unix socket */
|
|
57
|
+
runtimeSocket: string;
|
|
58
|
+
/** Client kind for the lease request */
|
|
59
|
+
clientKind?: string;
|
|
60
|
+
/** Display name for this client (e.g. arion name) */
|
|
61
|
+
displayName?: string;
|
|
62
|
+
/** Path to write diagnostic logs (e.g. ~/.aria/logs) */
|
|
63
|
+
logDir?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface ResilientAttachedClient {
|
|
66
|
+
/** The self-healing API proxy. Survives daemon restarts transparently. */
|
|
67
|
+
api: AttachedLocalControlApi;
|
|
68
|
+
/** Current client ID (changes on reattach) */
|
|
69
|
+
getClientId(): string | undefined;
|
|
70
|
+
/** Current auth token (changes on reattach) */
|
|
71
|
+
getClientAuthToken(): string | undefined;
|
|
72
|
+
/** Release the lease and stop reconnection */
|
|
73
|
+
release(): Promise<void>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Creates a self-healing AttachedLocalControlApi that survives daemon restarts.
|
|
77
|
+
*
|
|
78
|
+
* This is the ONLY correct way to get a long-lived client to the daemon.
|
|
79
|
+
* It fuses lease acquisition, auth credential management, stale-lease
|
|
80
|
+
* reattach with exponential backoff, and diagnostic logging into a single
|
|
81
|
+
* object. Callers get an API that "just works" — they never touch leases,
|
|
82
|
+
* auth tokens, or retry logic.
|
|
83
|
+
*
|
|
84
|
+
* On any call failure (stale lease, ECONNRESET, EPIPE, etc.):
|
|
85
|
+
* 1. Acquires a fresh lease from the daemon
|
|
86
|
+
* 2. Rebuilds the inner client with new credentials
|
|
87
|
+
* 3. Retries the call (up to 4 attempts with exponential backoff)
|
|
88
|
+
* 4. Logs every step to logDir/reattach.jsonl
|
|
89
|
+
*/
|
|
90
|
+
export declare function createResilientAttachedClient(options: ResilientAttachedClientOptions): Promise<ResilientAttachedClient>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { assertAttachableRuntimeBootstrap, createLocalControlClient, type RuntimeBootstrapSource, } from "./local-control-http-client.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createCapabilityAwareMethodProxy<T extends object>(getTarget: () => T | null | undefined): T;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared CLI bootstrap context used by all CLI entry points (REPL, daemon, headless).
|
|
3
|
+
*
|
|
4
|
+
* Eliminates the duplicated config → env vars → router → pool pattern that
|
|
5
|
+
* previously appeared in every CLI command.
|
|
6
|
+
*/
|
|
7
|
+
import { ModelDiscovery, type ModelRouter } from "@aria-cli/models";
|
|
8
|
+
import type { CredentialHints, ReadonlyModelDefinition } from "@aria-cli/models";
|
|
9
|
+
import { createRuntimeAuthContext } from "@aria-cli/auth";
|
|
10
|
+
import { MemoriaPool } from "@aria-cli/aria";
|
|
11
|
+
import { loadConfig } from "./config.js";
|
|
12
|
+
import { loadAriaConfig } from "./config/index.js";
|
|
13
|
+
export interface CliContext {
|
|
14
|
+
config: ReturnType<typeof loadConfig>;
|
|
15
|
+
router: ModelRouter;
|
|
16
|
+
pool: InstanceType<typeof MemoriaPool>;
|
|
17
|
+
memoriaFactory: ReturnType<InstanceType<typeof MemoriaPool>["toFactory"]>;
|
|
18
|
+
ariaDir: string;
|
|
19
|
+
projectConfig: Awaited<ReturnType<typeof loadAriaConfig>>;
|
|
20
|
+
discovery: InstanceType<typeof ModelDiscovery>;
|
|
21
|
+
availableModels: ReadonlyModelDefinition[];
|
|
22
|
+
refreshAvailableModels: (force?: boolean) => Promise<ReadonlyModelDefinition[]>;
|
|
23
|
+
credentialHints: CredentialHints;
|
|
24
|
+
authResolver: ReturnType<typeof createRuntimeAuthContext>["authResolver"];
|
|
25
|
+
}
|
|
26
|
+
export interface CliContextOptions {
|
|
27
|
+
cwd?: string;
|
|
28
|
+
startupMode?: "interactive" | "daemon";
|
|
29
|
+
skipDiscoveryRefresh?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare function createCliContext(opts?: CliContextOptions): Promise<CliContext>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arions command - Manage Arion personas
|
|
3
|
+
*
|
|
4
|
+
* Subcommands:
|
|
5
|
+
* - list: List all Arions with status
|
|
6
|
+
* - hatch: Create a new Arion
|
|
7
|
+
* - become: Switch to an Arion
|
|
8
|
+
* - retire: Retire an Arion
|
|
9
|
+
*/
|
|
10
|
+
import { Command } from "commander";
|
|
11
|
+
/**
|
|
12
|
+
* Create the arions command group
|
|
13
|
+
*/
|
|
14
|
+
export declare function createArionsCommand(): Command;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth command - Manage auth profiles for multi-provider authentication
|
|
3
|
+
*
|
|
4
|
+
* Subcommands:
|
|
5
|
+
* - status: Show all auth profiles and their health
|
|
6
|
+
* - add: Add an API key for a provider
|
|
7
|
+
* - remove: Remove an auth profile
|
|
8
|
+
*/
|
|
9
|
+
import { Command } from "commander";
|
|
10
|
+
/**
|
|
11
|
+
* Show all auth profiles, their type, health, and expiry.
|
|
12
|
+
*/
|
|
13
|
+
export declare function authStatusCommand(): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Interactively add an API key for a provider.
|
|
16
|
+
*/
|
|
17
|
+
export declare function authAddCommand(opts: {
|
|
18
|
+
provider: string;
|
|
19
|
+
}): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Remove an auth profile by ID.
|
|
22
|
+
*/
|
|
23
|
+
export declare function authRemoveCommand(profileId: string): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Create the auth command group with status, add, and remove subcommands.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createAuthCommand(): Command;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Daemon command - monitor-style projection over the shared daemon service.
|
|
3
|
+
*
|
|
4
|
+
* The CLI wrapper only parses options, starts/stops the daemon via the
|
|
5
|
+
* canonical `daemon.*` service, prints human status lines, and stays resident
|
|
6
|
+
* until interrupted. It must not own runtime bootstrap semantics directly.
|
|
7
|
+
*/
|
|
8
|
+
import type { DaemonSafetyPolicy } from "@aria-cli/aria";
|
|
9
|
+
export interface DaemonCliOptions {
|
|
10
|
+
arion?: string;
|
|
11
|
+
port?: string;
|
|
12
|
+
intervalMs?: string;
|
|
13
|
+
allowedToolCategories?: string;
|
|
14
|
+
allowedShellCommands?: string;
|
|
15
|
+
maxWriteOpsPerMinute?: string;
|
|
16
|
+
maxGitPushesPerHour?: string;
|
|
17
|
+
}
|
|
18
|
+
interface DaemonOptions {
|
|
19
|
+
arion?: string;
|
|
20
|
+
port: number;
|
|
21
|
+
intervalMs: number;
|
|
22
|
+
allowedToolCategories?: string[];
|
|
23
|
+
allowedShellCommands?: string[];
|
|
24
|
+
maxWriteOpsPerMinute?: number;
|
|
25
|
+
maxGitPushesPerHour?: number;
|
|
26
|
+
}
|
|
27
|
+
export declare function buildSafetyPolicy(options: DaemonOptions): DaemonSafetyPolicy;
|
|
28
|
+
export declare function runDaemonFromCli(options?: DaemonCliOptions): Promise<void>;
|
|
29
|
+
export declare function stopDaemonFromCli(): Promise<void>;
|
|
30
|
+
export declare function restartDaemonFromCli(options?: DaemonCliOptions): Promise<void>;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command definitions for the CLI
|
|
3
|
+
*/
|
|
4
|
+
export interface CommandDef {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
usage?: string;
|
|
8
|
+
args?: string[];
|
|
9
|
+
requiresArgs?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const COMMANDS: CommandDef[];
|
|
12
|
+
/**
|
|
13
|
+
* Get a command by name
|
|
14
|
+
*/
|
|
15
|
+
export declare function getCommand(name: string): CommandDef | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Filter commands by prefix
|
|
18
|
+
*/
|
|
19
|
+
export declare function filterCommands(prefix: string): CommandDef[];
|