@aria_asi/cli 0.2.26 → 0.2.30
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/CLIENT-ONBOARDING.md +282 -0
- package/bin/aria.js +1140 -14
- package/dist/aria-connector/src/auth-commands.d.ts +1 -0
- package/dist/aria-connector/src/auth-commands.d.ts.map +1 -1
- package/dist/aria-connector/src/auth-commands.js +89 -41
- package/dist/aria-connector/src/auth-commands.js.map +1 -1
- package/dist/aria-connector/src/chat.d.ts +3 -0
- package/dist/aria-connector/src/chat.d.ts.map +1 -1
- package/dist/aria-connector/src/chat.js +146 -8
- package/dist/aria-connector/src/chat.js.map +1 -1
- package/dist/aria-connector/src/codebase-scanner.d.ts +2 -2
- package/dist/aria-connector/src/codebase-scanner.d.ts.map +1 -1
- package/dist/aria-connector/src/codebase-scanner.js +1 -1
- package/dist/aria-connector/src/codebase-scanner.js.map +1 -1
- package/dist/aria-connector/src/config.d.ts +12 -0
- package/dist/aria-connector/src/config.d.ts.map +1 -1
- package/dist/aria-connector/src/config.js +2 -0
- package/dist/aria-connector/src/config.js.map +1 -1
- package/dist/aria-connector/src/connectors/claude-code.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/claude-code.js +80 -24
- package/dist/aria-connector/src/connectors/claude-code.js.map +1 -1
- package/dist/aria-connector/src/connectors/codebase-awareness.d.ts +37 -0
- package/dist/aria-connector/src/connectors/codebase-awareness.d.ts.map +1 -0
- package/dist/aria-connector/src/connectors/codebase-awareness.js +335 -0
- package/dist/aria-connector/src/connectors/codebase-awareness.js.map +1 -0
- package/dist/aria-connector/src/connectors/codex.d.ts +3 -0
- package/dist/aria-connector/src/connectors/codex.d.ts.map +1 -0
- package/dist/aria-connector/src/connectors/codex.js +248 -0
- package/dist/aria-connector/src/connectors/codex.js.map +1 -0
- package/dist/aria-connector/src/connectors/cognitive-skills.d.ts +2 -0
- package/dist/aria-connector/src/connectors/cognitive-skills.d.ts.map +1 -0
- package/dist/aria-connector/src/connectors/cognitive-skills.js +47 -0
- package/dist/aria-connector/src/connectors/cognitive-skills.js.map +1 -0
- package/dist/aria-connector/src/connectors/opencode.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/opencode.js +90 -4
- package/dist/aria-connector/src/connectors/opencode.js.map +1 -1
- package/dist/aria-connector/src/connectors/repo-git-hooks.d.ts +3 -0
- package/dist/aria-connector/src/connectors/repo-git-hooks.d.ts.map +1 -0
- package/dist/aria-connector/src/connectors/repo-git-hooks.js +87 -0
- package/dist/aria-connector/src/connectors/repo-git-hooks.js.map +1 -0
- package/dist/aria-connector/src/connectors/repo-guard.d.ts +19 -0
- package/dist/aria-connector/src/connectors/repo-guard.d.ts.map +1 -0
- package/dist/aria-connector/src/connectors/repo-guard.js +509 -0
- package/dist/aria-connector/src/connectors/repo-guard.js.map +1 -0
- package/dist/aria-connector/src/connectors/runtime.d.ts +2 -0
- package/dist/aria-connector/src/connectors/runtime.d.ts.map +1 -0
- package/dist/aria-connector/src/connectors/runtime.js +330 -0
- package/dist/aria-connector/src/connectors/runtime.js.map +1 -0
- package/dist/aria-connector/src/connectors/shell.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/shell.js +78 -13
- package/dist/aria-connector/src/connectors/shell.js.map +1 -1
- package/dist/aria-connector/src/connectors/syncd.d.ts +27 -0
- package/dist/aria-connector/src/connectors/syncd.d.ts.map +1 -0
- package/dist/aria-connector/src/connectors/syncd.js +405 -0
- package/dist/aria-connector/src/connectors/syncd.js.map +1 -0
- package/dist/aria-connector/src/decisions.d.ts +207 -0
- package/dist/aria-connector/src/decisions.d.ts.map +1 -0
- package/dist/aria-connector/src/decisions.js +291 -0
- package/dist/aria-connector/src/decisions.js.map +1 -0
- package/dist/aria-connector/src/garden-control-plane.d.ts.map +1 -1
- package/dist/aria-connector/src/garden-control-plane.js +74 -17
- package/dist/aria-connector/src/garden-control-plane.js.map +1 -1
- package/dist/aria-connector/src/github-connect.d.ts +18 -0
- package/dist/aria-connector/src/github-connect.d.ts.map +1 -0
- package/dist/aria-connector/src/github-connect.js +117 -0
- package/dist/aria-connector/src/github-connect.js.map +1 -0
- package/dist/aria-connector/src/harness-client.d.ts +15 -0
- package/dist/aria-connector/src/harness-client.d.ts.map +1 -1
- package/dist/aria-connector/src/harness-client.js +106 -3
- package/dist/aria-connector/src/harness-client.js.map +1 -1
- package/dist/aria-connector/src/hive-client.d.ts +30 -0
- package/dist/aria-connector/src/hive-client.d.ts.map +1 -1
- package/dist/aria-connector/src/hive-client.js +124 -5
- package/dist/aria-connector/src/hive-client.js.map +1 -1
- package/dist/aria-connector/src/index.d.ts +13 -2
- package/dist/aria-connector/src/index.d.ts.map +1 -1
- package/dist/aria-connector/src/index.js +10 -1
- package/dist/aria-connector/src/index.js.map +1 -1
- package/dist/aria-connector/src/lib/aristotle-noor-wire.d.ts +102 -0
- package/dist/aria-connector/src/lib/aristotle-noor-wire.d.ts.map +1 -0
- package/dist/aria-connector/src/lib/aristotle-noor-wire.js +231 -0
- package/dist/aria-connector/src/lib/aristotle-noor-wire.js.map +1 -0
- package/dist/aria-connector/src/providers/types.d.ts +5 -0
- package/dist/aria-connector/src/providers/types.d.ts.map +1 -1
- package/dist/aria-connector/src/runtime-proof.d.ts +45 -0
- package/dist/aria-connector/src/runtime-proof.d.ts.map +1 -0
- package/dist/aria-connector/src/runtime-proof.js +340 -0
- package/dist/aria-connector/src/runtime-proof.js.map +1 -0
- package/dist/aria-connector/src/self-update.d.ts +2 -1
- package/dist/aria-connector/src/self-update.d.ts.map +1 -1
- package/dist/aria-connector/src/self-update.js +84 -8
- package/dist/aria-connector/src/self-update.js.map +1 -1
- package/dist/aria-connector/src/setup-wizard.d.ts.map +1 -1
- package/dist/aria-connector/src/setup-wizard.js +34 -2
- package/dist/aria-connector/src/setup-wizard.js.map +1 -1
- package/dist/assets/hooks/aria-agent-handoff.mjs +224 -0
- package/dist/assets/hooks/aria-agent-ledger-merge.mjs +164 -0
- package/dist/assets/hooks/aria-architect-fallback.mjs +267 -0
- package/dist/assets/hooks/aria-cognition-substrate-binding.mjs +668 -0
- package/dist/assets/hooks/aria-discovery-record.mjs +101 -0
- package/dist/assets/hooks/aria-harness-via-sdk.mjs +412 -0
- package/dist/assets/hooks/aria-import-resolution-gate.mjs +330 -0
- package/dist/assets/hooks/aria-outcome-record.mjs +84 -0
- package/dist/assets/hooks/aria-pre-emit-dryrun.mjs +294 -0
- package/dist/assets/hooks/aria-pre-text-gate.mjs +112 -0
- package/dist/assets/hooks/aria-pre-tool-gate.mjs +2133 -0
- package/dist/assets/hooks/aria-preprompt-consult.mjs +438 -0
- package/dist/assets/hooks/aria-preturn-memory-gate.mjs +570 -0
- package/dist/assets/hooks/aria-repo-doctrine-gate.mjs +397 -0
- package/dist/assets/hooks/aria-stop-gate.mjs +1551 -0
- package/dist/assets/hooks/aria-trigger-autolearn.mjs +229 -0
- package/dist/assets/hooks/aria-userprompt-abandon-detect.mjs +192 -0
- package/dist/assets/hooks/doctrine_trigger_map.json +479 -0
- package/dist/assets/hooks/lib/canonical-lenses.mjs +64 -0
- package/dist/assets/hooks/lib/gate-audit.mjs +43 -0
- package/dist/assets/hooks/test-aria-preturn-memory-gate.mjs +245 -0
- package/dist/assets/hooks/test-tier-lens-labeling.mjs +399 -0
- package/dist/assets/opencode-plugins/harness-context/index.js +60 -0
- package/dist/assets/opencode-plugins/harness-context/inject-context.mjs +179 -0
- package/dist/assets/opencode-plugins/harness-context/package.json +9 -0
- package/dist/assets/opencode-plugins/harness-gate/index.js +248 -0
- package/dist/assets/opencode-plugins/harness-outcome/index.js +129 -0
- package/dist/assets/opencode-plugins/harness-role/index.js +77 -0
- package/dist/assets/opencode-plugins/harness-role/package.json +9 -0
- package/dist/assets/opencode-plugins/harness-stop/index.js +241 -0
- package/dist/runtime/discipline/CLAUDE.md +339 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-essence/SKILL.md +63 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-essence/references/domain-matrix.md +80 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-essence/references/evolution-loop.md +30 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-essence/references/readable-cognition.md +27 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-forge-guardrails/SKILL.md +35 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-forge-guardrails/references/checklist.md +31 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-repo-doctrine/SKILL.md +39 -0
- package/dist/runtime/discipline/skills/aria-cognition/forge-quality-rules/SKILL.md +43 -0
- package/dist/runtime/discipline/skills/aria-cognition/ghazali-8lens/SKILL.md +38 -0
- package/dist/runtime/discipline/skills/aria-cognition/istiqra-induction/SKILL.md +26 -0
- package/dist/runtime/discipline/skills/aria-cognition/ladunni-22/SKILL.md +35 -0
- package/dist/runtime/discipline/skills/aria-cognition/mizan/SKILL.md +72 -0
- package/dist/runtime/discipline/skills/aria-cognition/nadia/SKILL.md +38 -0
- package/dist/runtime/discipline/skills/aria-cognition/nadia-psi/SKILL.md +38 -0
- package/dist/runtime/discipline/skills/aria-cognition/predictor/SKILL.md +25 -0
- package/dist/runtime/discipline/skills/aria-cognition/qiyas-analogy/SKILL.md +26 -0
- package/dist/runtime/discipline/skills/aria-cognition/soul-domains/SKILL.md +25 -0
- package/dist/runtime/discipline/skills/aria-harness/aria-aristotle-intra-phase/SKILL.md +81 -0
- package/dist/runtime/discipline/skills/aria-harness/aria-aristotle-post-phase/SKILL.md +98 -0
- package/dist/runtime/discipline/skills/aria-harness/aria-aristotle-pre-phase/SKILL.md +99 -0
- package/dist/runtime/discipline/skills/aria-harness/aria-harness-deploy/SKILL.md +127 -0
- package/dist/runtime/discipline/skills/aria-harness/aria-harness-no-stripping/SKILL.md +117 -0
- package/dist/runtime/discipline/skills/aria-harness/aria-harness-onboarding/SKILL.md +112 -0
- package/dist/runtime/discipline/skills/aria-harness/aria-harness-output-discipline/SKILL.md +102 -0
- package/dist/runtime/discipline/skills/aria-harness/aria-harness-substrate-binding/SKILL.md +121 -0
- package/dist/runtime/doctor.mjs +23 -0
- package/dist/runtime/local-phase.mjs +650 -0
- package/dist/runtime/manifest.json +15 -0
- package/dist/runtime/mizan-scheduler.mjs +331 -0
- package/dist/runtime/package.json +6 -0
- package/dist/runtime/provider-proxy.mjs +594 -0
- package/dist/runtime/sdk/BUNDLED.json +5 -0
- package/dist/runtime/sdk/index.d.ts +477 -0
- package/dist/runtime/sdk/index.js +1469 -0
- package/dist/runtime/sdk/index.js.map +1 -0
- package/dist/runtime/sdk/package.json +8 -0
- package/dist/runtime/sdk/runWithCognition.d.ts +77 -0
- package/dist/runtime/sdk/runWithCognition.js +157 -0
- package/dist/runtime/sdk/runWithCognition.js.map +1 -0
- package/dist/runtime/service.mjs +3058 -0
- package/dist/runtime/vendor/aria-gate-runtime/index.d.ts +53 -0
- package/dist/runtime/vendor/aria-gate-runtime/index.d.ts.map +1 -0
- package/dist/runtime/vendor/aria-gate-runtime/index.js +292 -0
- package/dist/runtime/vendor/aria-gate-runtime/index.js.map +1 -0
- package/dist/runtime/vendor/aria-gate-runtime/package.json +6 -0
- package/dist/sdk/BUNDLED.json +2 -2
- package/dist/sdk/index.d.ts +283 -0
- package/dist/sdk/index.js +622 -85
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/runWithCognition.d.ts +77 -0
- package/dist/sdk/runWithCognition.js +157 -0
- package/dist/sdk/runWithCognition.js.map +1 -0
- package/hooks/aria-agent-handoff.mjs +11 -1
- package/hooks/aria-architect-fallback.mjs +109 -40
- package/hooks/aria-cognition-substrate-binding.mjs +668 -0
- package/hooks/aria-harness-via-sdk.mjs +34 -21
- package/hooks/aria-import-resolution-gate.mjs +330 -0
- package/hooks/aria-outcome-record.mjs +5 -1
- package/hooks/aria-pre-emit-dryrun.mjs +294 -0
- package/hooks/aria-pre-tool-gate.mjs +828 -41
- package/hooks/aria-preprompt-consult.mjs +113 -13
- package/hooks/aria-preturn-memory-gate.mjs +298 -6
- package/hooks/aria-repo-doctrine-gate.mjs +397 -0
- package/hooks/aria-stop-gate.mjs +739 -76
- package/hooks/aria-userprompt-abandon-detect.mjs +5 -1
- package/hooks/doctrine_trigger_map.json +209 -15
- package/hooks/lib/canonical-lenses.mjs +64 -0
- package/hooks/lib/gate-audit.mjs +43 -0
- package/opencode-plugins/harness-context/index.js +1 -1
- package/opencode-plugins/harness-context/inject-context.mjs +82 -23
- package/opencode-plugins/harness-gate/index.js +248 -0
- package/opencode-plugins/harness-outcome/index.js +129 -0
- package/opencode-plugins/harness-stop/index.js +241 -0
- package/package.json +9 -3
- package/runtime-src/doctor.mjs +23 -0
- package/runtime-src/local-phase.mjs +650 -0
- package/runtime-src/mizan-scheduler.mjs +331 -0
- package/runtime-src/provider-proxy.mjs +594 -0
- package/runtime-src/service.mjs +3058 -0
- package/scripts/bundle-sdk.mjs +317 -0
- package/scripts/install-client.sh +176 -0
- package/scripts/publish-all.sh +344 -0
- package/scripts/publish-docker.sh +27 -0
- package/scripts/validate-hook-contracts.mjs +54 -0
- package/scripts/validate-skill-prompts.mjs +95 -0
- package/skills/aria-cognition/aria-essence/SKILL.md +63 -0
- package/skills/aria-cognition/aria-essence/references/domain-matrix.md +80 -0
- package/skills/aria-cognition/aria-essence/references/evolution-loop.md +30 -0
- package/skills/aria-cognition/aria-essence/references/readable-cognition.md +27 -0
- package/skills/aria-cognition/aria-forge-guardrails/SKILL.md +35 -0
- package/skills/aria-cognition/aria-forge-guardrails/references/checklist.md +31 -0
- package/skills/aria-cognition/aria-repo-doctrine/SKILL.md +39 -0
- package/skills/aria-cognition/forge-quality-rules/SKILL.md +43 -0
- package/skills/aria-cognition/ghazali-8lens/SKILL.md +38 -0
- package/skills/aria-cognition/istiqra-induction/SKILL.md +26 -0
- package/skills/aria-cognition/ladunni-22/SKILL.md +35 -0
- package/skills/aria-cognition/mizan/SKILL.md +72 -0
- package/skills/aria-cognition/nadia/SKILL.md +38 -0
- package/skills/aria-cognition/nadia-psi/SKILL.md +38 -0
- package/skills/aria-cognition/predictor/SKILL.md +25 -0
- package/skills/aria-cognition/qiyas-analogy/SKILL.md +26 -0
- package/skills/aria-cognition/soul-domains/SKILL.md +25 -0
- package/src/auth-commands.ts +111 -45
- package/src/chat.ts +174 -13
- package/src/codebase-scanner.ts +4 -0
- package/src/config.ts +15 -0
- package/src/connectors/claude-code.ts +79 -25
- package/src/connectors/codebase-awareness.ts +408 -0
- package/src/connectors/codex.ts +274 -0
- package/src/connectors/cognitive-skills.ts +51 -0
- package/src/connectors/opencode.ts +93 -4
- package/src/connectors/repo-git-hooks.ts +86 -0
- package/src/connectors/repo-guard.ts +589 -0
- package/src/connectors/runtime.ts +374 -0
- package/src/connectors/shell.ts +83 -14
- package/src/connectors/syncd.ts +488 -0
- package/src/decisions.ts +469 -0
- package/src/garden-control-plane.ts +101 -26
- package/src/github-connect.ts +143 -0
- package/src/harness-client.ts +128 -3
- package/src/hive-client.ts +165 -5
- package/src/index.ts +41 -2
- package/src/lib/aristotle-noor-wire.ts +310 -0
- package/src/providers/types.ts +6 -0
- package/src/runtime-proof.ts +392 -0
- package/src/self-update.ts +89 -8
- package/src/setup-wizard.ts +37 -2
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import {
|
|
2
|
+
existsSync,
|
|
3
|
+
mkdirSync,
|
|
4
|
+
readdirSync,
|
|
5
|
+
statSync,
|
|
6
|
+
copyFileSync,
|
|
7
|
+
chmodSync,
|
|
8
|
+
rmSync,
|
|
9
|
+
writeFileSync,
|
|
10
|
+
} from 'fs';
|
|
11
|
+
import { execFileSync } from 'child_process';
|
|
12
|
+
import { homedir } from 'os';
|
|
13
|
+
import * as path from 'path';
|
|
14
|
+
import { fileURLToPath } from 'node:url';
|
|
15
|
+
import { loadConfig, saveConfig } from '../config.js';
|
|
16
|
+
|
|
17
|
+
function packageRuntimeDir(): string {
|
|
18
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
19
|
+
return path.resolve(here, '..', '..', '..', 'runtime');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function packageSdkDir(): string {
|
|
23
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
24
|
+
return path.resolve(here, '..', '..', '..', 'sdk');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function copyTree(srcDir: string, dstDir: string): void {
|
|
28
|
+
mkdirSync(dstDir, { recursive: true, mode: 0o755 });
|
|
29
|
+
for (const name of readdirSync(srcDir)) {
|
|
30
|
+
const src = path.join(srcDir, name);
|
|
31
|
+
const dst = path.join(dstDir, name);
|
|
32
|
+
const stat = statSync(src);
|
|
33
|
+
if (stat.isDirectory()) {
|
|
34
|
+
copyTree(src, dst);
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
copyFileSync(src, dst);
|
|
38
|
+
if (name.endsWith('.mjs') || name.endsWith('.js') || !name.includes('.')) {
|
|
39
|
+
try { chmodSync(dst, 0o755); } catch {}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function writeWrapper(binPath: string, targetScript: string): void {
|
|
45
|
+
writeFileSync(
|
|
46
|
+
binPath,
|
|
47
|
+
`#!/usr/bin/env bash\nexec node "${targetScript}" "$@"\n`,
|
|
48
|
+
{ mode: 0o755 },
|
|
49
|
+
);
|
|
50
|
+
try { chmodSync(binPath, 0o755); } catch {}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function writeRuntimeEnv(runtimeDst: string): string {
|
|
54
|
+
const envPath = path.join(runtimeDst, 'runtime.env');
|
|
55
|
+
const config = loadConfig();
|
|
56
|
+
const runtimeProfiles = config.runtimeProfiles || {};
|
|
57
|
+
const defaultProvider = config.defaultProvider || config.model?.provider || 'deepseek';
|
|
58
|
+
const chatModel = runtimeProfiles.chatModel || 'deepseek-v4-flash';
|
|
59
|
+
const deepModel = runtimeProfiles.deepModel || 'deepseek-v4-pro';
|
|
60
|
+
const xaiFallbackModel = runtimeProfiles.xaiFallbackModel || 'grok-4-2-reasoning';
|
|
61
|
+
const nimFallbackModel = runtimeProfiles.nimFallbackModel || 'qwen/qwen3.5-122b-a10b';
|
|
62
|
+
const harnessUrl =
|
|
63
|
+
process.env.ARIA_HIVE_RUNTIME_URL ||
|
|
64
|
+
process.env.ARIA_HARNESS_BASE_URL ||
|
|
65
|
+
process.env.ARIA_HARNESS_URL ||
|
|
66
|
+
'https://harness.ariasos.com';
|
|
67
|
+
const forgeServiceUrl =
|
|
68
|
+
process.env.ARIA_FORGE_SERVICE_URL ||
|
|
69
|
+
process.env.FORGE_SERVICE_URL ||
|
|
70
|
+
`${harnessUrl.replace(/\/$/, '')}/api/forge/psi`;
|
|
71
|
+
writeFileSync(
|
|
72
|
+
envPath,
|
|
73
|
+
[
|
|
74
|
+
'ARIA_RUNTIME_HOST=127.0.0.1',
|
|
75
|
+
'ARIA_RUNTIME_PORT=4319',
|
|
76
|
+
'ARIA_RUNTIME_URL=http://127.0.0.1:4319',
|
|
77
|
+
`ARIA_HIVE_RUNTIME_URL=${harnessUrl}`,
|
|
78
|
+
`ARIA_HARNESS_URL=${harnessUrl}`,
|
|
79
|
+
`ARIA_FORGE_SERVICE_URL=${forgeServiceUrl}`,
|
|
80
|
+
'ARIA_QDRANT_URL=http://127.0.0.1:6333',
|
|
81
|
+
'ARIA_QDRANT_COLLECTION=aria_garden_memory',
|
|
82
|
+
`ARIA_RUNTIME_DEFAULT_PROVIDER=${defaultProvider}`,
|
|
83
|
+
`ARIA_CHAT_MODEL=${chatModel}`,
|
|
84
|
+
`ARIA_DEEP_MODEL=${deepModel}`,
|
|
85
|
+
`ARIA_XAI_FALLBACK_MODEL=${xaiFallbackModel}`,
|
|
86
|
+
`ARIA_NIM_FALLBACK_MODEL=${nimFallbackModel}`,
|
|
87
|
+
'OPENAI_BASE_URL=http://127.0.0.1:4319/v1',
|
|
88
|
+
'ANTHROPIC_BASE_URL=http://127.0.0.1:4319/v1',
|
|
89
|
+
'',
|
|
90
|
+
].join('\n'),
|
|
91
|
+
{ mode: 0o600 },
|
|
92
|
+
);
|
|
93
|
+
return envPath;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function installSharedSdk(ariaDir: string, logs: string[]): void {
|
|
97
|
+
const sdkSrc = packageSdkDir();
|
|
98
|
+
if (!existsSync(sdkSrc)) {
|
|
99
|
+
logs.push(`⚠ shared SDK bundle missing: ${sdkSrc} (run npm run build)`);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const sdkDst = path.join(ariaDir, 'sdk');
|
|
104
|
+
mkdirSync(sdkDst, { recursive: true, mode: 0o700 });
|
|
105
|
+
|
|
106
|
+
let copied = 0;
|
|
107
|
+
for (const name of readdirSync(sdkSrc)) {
|
|
108
|
+
const src = path.join(sdkSrc, name);
|
|
109
|
+
const stat = statSync(src);
|
|
110
|
+
if (!stat.isFile()) continue;
|
|
111
|
+
copyFileSync(src, path.join(sdkDst, name));
|
|
112
|
+
copied++;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
logs.push(`Installed shared Aria SDK (${copied} files) → ${sdkDst}`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function ensureRuntimeProviderDefaults(): void {
|
|
119
|
+
const config = loadConfig();
|
|
120
|
+
saveConfig({
|
|
121
|
+
...config,
|
|
122
|
+
defaultProvider: config.defaultProvider || config.model?.provider || 'deepseek',
|
|
123
|
+
runtimeProfiles: {
|
|
124
|
+
chatModel: config.runtimeProfiles?.chatModel || 'deepseek-v4-flash',
|
|
125
|
+
deepModel: config.runtimeProfiles?.deepModel || 'deepseek-v4-pro',
|
|
126
|
+
xaiFallbackModel: config.runtimeProfiles?.xaiFallbackModel || 'grok-4-2-reasoning',
|
|
127
|
+
nimFallbackModel: config.runtimeProfiles?.nimFallbackModel || 'qwen/qwen3.5-122b-a10b',
|
|
128
|
+
xaiApiKey: config.runtimeProfiles?.xaiApiKey || '',
|
|
129
|
+
nimApiKey: config.runtimeProfiles?.nimApiKey || '',
|
|
130
|
+
xaiBaseUrl: config.runtimeProfiles?.xaiBaseUrl || 'https://api.x.ai/v1/chat/completions',
|
|
131
|
+
nimBaseUrl: config.runtimeProfiles?.nimBaseUrl || 'https://integrate.api.nvidia.com/v1/chat/completions',
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function installLocalQdrantService(ariaDir: string, logs: string[]): void {
|
|
137
|
+
const systemctlPath = '/bin/systemctl';
|
|
138
|
+
const dockerPath = '/usr/bin/docker';
|
|
139
|
+
if (process.platform !== 'linux' || !existsSync(systemctlPath) || !existsSync(dockerPath)) {
|
|
140
|
+
logs.push('Skipped local Qdrant service install: requires Linux systemd user services and Docker.');
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const qdrantDir = path.join(ariaDir, 'qdrant');
|
|
145
|
+
const qdrantStorage = path.join(qdrantDir, 'storage');
|
|
146
|
+
mkdirSync(qdrantStorage, { recursive: true, mode: 0o700 });
|
|
147
|
+
|
|
148
|
+
const serviceDir = path.join(homedir(), '.config', 'systemd', 'user');
|
|
149
|
+
const servicePath = path.join(serviceDir, 'aria-qdrant.service');
|
|
150
|
+
mkdirSync(serviceDir, { recursive: true, mode: 0o755 });
|
|
151
|
+
|
|
152
|
+
const unit = [
|
|
153
|
+
'[Unit]',
|
|
154
|
+
'Description=Aria Local Qdrant Memory',
|
|
155
|
+
'After=network.target docker.service',
|
|
156
|
+
'',
|
|
157
|
+
'[Service]',
|
|
158
|
+
'Type=simple',
|
|
159
|
+
`ExecStartPre=-${dockerPath} rm -f aria-qdrant`,
|
|
160
|
+
`${'ExecStart='}${dockerPath} run --rm --name aria-qdrant -p 127.0.0.1:6333:6333 -v ${qdrantStorage}:/qdrant/storage qdrant/qdrant:v1.17.0`,
|
|
161
|
+
`ExecStop=${dockerPath} stop -t 10 aria-qdrant`,
|
|
162
|
+
'Restart=always',
|
|
163
|
+
'RestartSec=5',
|
|
164
|
+
'',
|
|
165
|
+
'[Install]',
|
|
166
|
+
'WantedBy=default.target',
|
|
167
|
+
'',
|
|
168
|
+
].join('\n');
|
|
169
|
+
|
|
170
|
+
writeFileSync(servicePath, unit, { mode: 0o644 });
|
|
171
|
+
logs.push(`Installed systemd user unit → ${servicePath}`);
|
|
172
|
+
|
|
173
|
+
try {
|
|
174
|
+
execFileSync(systemctlPath, ['--user', 'daemon-reload'], { stdio: 'ignore' });
|
|
175
|
+
execFileSync(systemctlPath, ['--user', 'enable', '--now', 'aria-qdrant.service'], { stdio: 'ignore' });
|
|
176
|
+
logs.push('Enabled and started systemd user service: aria-qdrant.service');
|
|
177
|
+
} catch (error) {
|
|
178
|
+
logs.push(`⚠ local Qdrant service installed but not activated: ${error instanceof Error ? error.message : String(error)}`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function installDisciplinePack(runtimeDst: string, logs: string[]): void {
|
|
183
|
+
const harnessSkillsSrc = path.join(runtimeDst, 'discipline', 'skills', 'aria-harness');
|
|
184
|
+
const cognitionSkillsSrc = path.join(runtimeDst, 'discipline', 'skills', 'aria-cognition');
|
|
185
|
+
|
|
186
|
+
if (existsSync(harnessSkillsSrc)) {
|
|
187
|
+
const harnessTargets = [
|
|
188
|
+
path.join(homedir(), '.claude', 'skills', 'aria-harness'),
|
|
189
|
+
path.join(homedir(), '.codex', 'skills', 'aria-harness'),
|
|
190
|
+
];
|
|
191
|
+
|
|
192
|
+
for (const target of harnessTargets) {
|
|
193
|
+
copyTree(harnessSkillsSrc, target);
|
|
194
|
+
logs.push(`Installed Aria harness discipline pack → ${target}`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (existsSync(cognitionSkillsSrc)) {
|
|
199
|
+
const nestedTargets = [
|
|
200
|
+
path.join(homedir(), '.claude', 'skills', 'aria-cognition'),
|
|
201
|
+
path.join(homedir(), '.codex', 'skills', 'aria-cognition'),
|
|
202
|
+
];
|
|
203
|
+
for (const target of nestedTargets) {
|
|
204
|
+
copyTree(cognitionSkillsSrc, target);
|
|
205
|
+
logs.push(`Installed Aria cognition discipline pack → ${target}`);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const agentSkillsRoot = path.join(homedir(), '.agents', 'skills');
|
|
209
|
+
mkdirSync(agentSkillsRoot, { recursive: true, mode: 0o755 });
|
|
210
|
+
for (const skillName of readdirSync(cognitionSkillsSrc)) {
|
|
211
|
+
const src = path.join(cognitionSkillsSrc, skillName);
|
|
212
|
+
if (!statSync(src).isDirectory()) continue;
|
|
213
|
+
const target = path.join(agentSkillsRoot, skillName);
|
|
214
|
+
copyTree(src, target);
|
|
215
|
+
logs.push(`Installed Aria cognition skill → ${target}`);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function installSystemdUserService(ariaDir: string, logs: string[]): void {
|
|
221
|
+
const systemctlPath = '/bin/systemctl';
|
|
222
|
+
if (process.platform !== 'linux' || !existsSync(systemctlPath)) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const serviceDir = path.join(homedir(), '.config', 'systemd', 'user');
|
|
227
|
+
const servicePath = path.join(serviceDir, 'aria-mounted-runtime.service');
|
|
228
|
+
mkdirSync(serviceDir, { recursive: true, mode: 0o755 });
|
|
229
|
+
|
|
230
|
+
const unit = [
|
|
231
|
+
'[Unit]',
|
|
232
|
+
'Description=Aria Mounted Runtime',
|
|
233
|
+
'After=network.target',
|
|
234
|
+
'',
|
|
235
|
+
'[Service]',
|
|
236
|
+
'Type=simple',
|
|
237
|
+
`EnvironmentFile=-${path.join(ariaDir, 'runtime', 'runtime.env')}`,
|
|
238
|
+
`ExecStart=${path.join(ariaDir, 'bin', 'aria-runtime')}`,
|
|
239
|
+
'Restart=always',
|
|
240
|
+
'RestartSec=2',
|
|
241
|
+
'',
|
|
242
|
+
'[Install]',
|
|
243
|
+
'WantedBy=default.target',
|
|
244
|
+
'',
|
|
245
|
+
].join('\n');
|
|
246
|
+
|
|
247
|
+
writeFileSync(servicePath, unit, { mode: 0o644 });
|
|
248
|
+
logs.push(`Installed systemd user unit → ${servicePath}`);
|
|
249
|
+
|
|
250
|
+
try {
|
|
251
|
+
execFileSync(systemctlPath, ['--user', 'daemon-reload'], { stdio: 'ignore' });
|
|
252
|
+
execFileSync(systemctlPath, ['--user', 'enable', '--now', 'aria-mounted-runtime.service'], { stdio: 'ignore' });
|
|
253
|
+
logs.push('Enabled and started systemd user service: aria-mounted-runtime.service');
|
|
254
|
+
} catch (error) {
|
|
255
|
+
logs.push(`⚠ systemd user service install present but not activated: ${error instanceof Error ? error.message : String(error)}`);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function installLaunchAgent(ariaDir: string, logs: string[]): void {
|
|
260
|
+
if (process.platform !== 'darwin') return;
|
|
261
|
+
const harnessUrl =
|
|
262
|
+
process.env.ARIA_HIVE_RUNTIME_URL ||
|
|
263
|
+
process.env.ARIA_HARNESS_BASE_URL ||
|
|
264
|
+
process.env.ARIA_HARNESS_URL ||
|
|
265
|
+
'https://harness.ariasos.com';
|
|
266
|
+
|
|
267
|
+
const launchAgentDir = path.join(homedir(), 'Library', 'LaunchAgents');
|
|
268
|
+
const plistPath = path.join(launchAgentDir, 'com.aria.mounted-runtime.plist');
|
|
269
|
+
mkdirSync(launchAgentDir, { recursive: true, mode: 0o755 });
|
|
270
|
+
|
|
271
|
+
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
272
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
273
|
+
<plist version="1.0">
|
|
274
|
+
<dict>
|
|
275
|
+
<key>Label</key>
|
|
276
|
+
<string>com.aria.mounted-runtime</string>
|
|
277
|
+
<key>ProgramArguments</key>
|
|
278
|
+
<array>
|
|
279
|
+
<string>${path.join(ariaDir, 'bin', 'aria-runtime')}</string>
|
|
280
|
+
</array>
|
|
281
|
+
<key>EnvironmentVariables</key>
|
|
282
|
+
<dict>
|
|
283
|
+
<key>ARIA_RUNTIME_HOST</key>
|
|
284
|
+
<string>127.0.0.1</string>
|
|
285
|
+
<key>ARIA_RUNTIME_PORT</key>
|
|
286
|
+
<string>4319</string>
|
|
287
|
+
<key>ARIA_RUNTIME_URL</key>
|
|
288
|
+
<string>http://127.0.0.1:4319</string>
|
|
289
|
+
<key>ARIA_HIVE_RUNTIME_URL</key>
|
|
290
|
+
<string>${harnessUrl}</string>
|
|
291
|
+
<key>ARIA_HARNESS_URL</key>
|
|
292
|
+
<string>${harnessUrl}</string>
|
|
293
|
+
</dict>
|
|
294
|
+
<key>RunAtLoad</key>
|
|
295
|
+
<true/>
|
|
296
|
+
<key>KeepAlive</key>
|
|
297
|
+
<true/>
|
|
298
|
+
</dict>
|
|
299
|
+
</plist>
|
|
300
|
+
`;
|
|
301
|
+
|
|
302
|
+
writeFileSync(plistPath, plist, { mode: 0o644 });
|
|
303
|
+
logs.push(`Installed launchd agent → ${plistPath}`);
|
|
304
|
+
|
|
305
|
+
try {
|
|
306
|
+
execFileSync('/bin/launchctl', ['unload', plistPath], { stdio: 'ignore' });
|
|
307
|
+
} catch {}
|
|
308
|
+
try {
|
|
309
|
+
execFileSync('/bin/launchctl', ['load', plistPath], { stdio: 'ignore' });
|
|
310
|
+
logs.push('Loaded launchd agent: com.aria.mounted-runtime');
|
|
311
|
+
} catch (error) {
|
|
312
|
+
logs.push(`⚠ launchd agent installed but not activated: ${error instanceof Error ? error.message : String(error)}`);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export async function installSharedRuntime(): Promise<string[]> {
|
|
317
|
+
const logs: string[] = [];
|
|
318
|
+
const runtimeSrc = packageRuntimeDir();
|
|
319
|
+
if (!existsSync(runtimeSrc)) {
|
|
320
|
+
logs.push(`⚠ bundled runtime missing: ${runtimeSrc} (run npm run build)`);
|
|
321
|
+
return logs;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const ariaDir = path.join(homedir(), '.aria');
|
|
325
|
+
const runtimeDst = path.join(ariaDir, 'runtime');
|
|
326
|
+
const binDir = path.join(ariaDir, 'bin');
|
|
327
|
+
|
|
328
|
+
mkdirSync(ariaDir, { recursive: true, mode: 0o700 });
|
|
329
|
+
mkdirSync(binDir, { recursive: true, mode: 0o755 });
|
|
330
|
+
ensureRuntimeProviderDefaults();
|
|
331
|
+
installSharedSdk(ariaDir, logs);
|
|
332
|
+
|
|
333
|
+
const runtimeStateBackup = path.join(ariaDir, 'runtime-state-backup');
|
|
334
|
+
if (existsSync(runtimeStateBackup)) {
|
|
335
|
+
rmSync(runtimeStateBackup, { recursive: true, force: true });
|
|
336
|
+
}
|
|
337
|
+
const existingStateDir = path.join(runtimeDst, 'state');
|
|
338
|
+
if (existsSync(existingStateDir)) {
|
|
339
|
+
copyTree(existingStateDir, runtimeStateBackup);
|
|
340
|
+
logs.push(`Preserved runtime state → ${existingStateDir}`);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (existsSync(runtimeDst)) {
|
|
344
|
+
rmSync(runtimeDst, { recursive: true, force: true });
|
|
345
|
+
}
|
|
346
|
+
copyTree(runtimeSrc, runtimeDst);
|
|
347
|
+
if (existsSync(runtimeStateBackup)) {
|
|
348
|
+
copyTree(runtimeStateBackup, path.join(runtimeDst, 'state'));
|
|
349
|
+
rmSync(runtimeStateBackup, { recursive: true, force: true });
|
|
350
|
+
logs.push('Restored runtime state into refreshed runtime bundle');
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
const startWrapper = path.join(binDir, 'aria-runtime');
|
|
354
|
+
const doctorWrapper = path.join(binDir, 'aria-runtime-doctor');
|
|
355
|
+
writeWrapper(startWrapper, path.join(runtimeDst, 'service.mjs'));
|
|
356
|
+
writeWrapper(doctorWrapper, path.join(runtimeDst, 'doctor.mjs'));
|
|
357
|
+
const envPath = writeRuntimeEnv(runtimeDst);
|
|
358
|
+
installDisciplinePack(runtimeDst, logs);
|
|
359
|
+
installLocalQdrantService(ariaDir, logs);
|
|
360
|
+
installSystemdUserService(ariaDir, logs);
|
|
361
|
+
installLaunchAgent(ariaDir, logs);
|
|
362
|
+
|
|
363
|
+
logs.push(`Installed shared Aria runtime → ${runtimeDst}`);
|
|
364
|
+
logs.push(`Installed runtime wrapper → ${startWrapper}`);
|
|
365
|
+
logs.push(`Installed runtime doctor → ${doctorWrapper}`);
|
|
366
|
+
logs.push(`Installed runtime env → ${envPath}`);
|
|
367
|
+
logs.push('Mount any client against ARIA_RUNTIME_URL=http://127.0.0.1:4319');
|
|
368
|
+
logs.push('Local Qdrant memory is mounted at http://127.0.0.1:6333 for garden pulse persistence.');
|
|
369
|
+
logs.push('Runtime lease is encrypted at rest and revalidated against /api/license/heartbeat');
|
|
370
|
+
logs.push('Forge synthesis is relayed through the canonical Aria endpoint unless ARIA_FORGE_SERVICE_URL overrides it.');
|
|
371
|
+
logs.push('Start it with: aria-runtime');
|
|
372
|
+
logs.push('Health-check it with: aria-runtime-doctor');
|
|
373
|
+
return logs;
|
|
374
|
+
}
|
package/src/connectors/shell.ts
CHANGED
|
@@ -1,43 +1,112 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, writeFileSync, chmodSync, unlinkSync } from 'fs';
|
|
1
|
+
import { existsSync, mkdirSync, writeFileSync, chmodSync, unlinkSync, readFileSync } from 'fs';
|
|
2
2
|
import { execSync } from 'child_process';
|
|
3
3
|
import { homedir } from 'os';
|
|
4
4
|
import * as path from 'path';
|
|
5
5
|
import type { AriaConfig } from '../config.js';
|
|
6
6
|
|
|
7
|
+
const ARIA_DIR = path.join(homedir(), '.aria');
|
|
8
|
+
const WRAPPER_DIR = path.join(ARIA_DIR, 'wrappers');
|
|
9
|
+
const SHELL_DIR = path.join(ARIA_DIR, 'shell');
|
|
10
|
+
const SHELL_HOOK_PATH = path.join(SHELL_DIR, 'runtime-client-env.sh');
|
|
11
|
+
const SHELL_RC_FILES = ['.bashrc', '.bash_profile', '.profile', '.zshrc', '.zprofile'];
|
|
12
|
+
const SHELL_HOOK_LINE = '[ -f "$HOME/.aria/shell/runtime-client-env.sh" ] && . "$HOME/.aria/shell/runtime-client-env.sh"';
|
|
13
|
+
|
|
14
|
+
function resolveToolPath(toolName: string): string | null {
|
|
15
|
+
try {
|
|
16
|
+
const lines = execSync(`which -a ${toolName}`, { encoding: 'utf-8' })
|
|
17
|
+
.split('\n')
|
|
18
|
+
.map((line) => line.trim())
|
|
19
|
+
.filter(Boolean);
|
|
20
|
+
const preferred = lines.find((candidate) => !candidate.startsWith(`${WRAPPER_DIR}/`));
|
|
21
|
+
return preferred || lines[0] || null;
|
|
22
|
+
} catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function ensureWrapperShellHook(logs: string[]): void {
|
|
28
|
+
if (!existsSync(SHELL_DIR)) {
|
|
29
|
+
mkdirSync(SHELL_DIR, { recursive: true, mode: 0o700 });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const shellHook = `#!/usr/bin/env bash
|
|
33
|
+
if [ -d "$HOME/.aria/wrappers" ]; then
|
|
34
|
+
case ":$PATH:" in
|
|
35
|
+
*":$HOME/.aria/wrappers:"*) ;;
|
|
36
|
+
*) export PATH="$HOME/.aria/wrappers:$PATH" ;;
|
|
37
|
+
esac
|
|
38
|
+
fi
|
|
39
|
+
`;
|
|
40
|
+
writeFileSync(SHELL_HOOK_PATH, shellHook, { mode: 0o755 });
|
|
41
|
+
chmodSync(SHELL_HOOK_PATH, 0o755);
|
|
42
|
+
logs.push(`Installed shell hook → ${SHELL_HOOK_PATH}`);
|
|
43
|
+
|
|
44
|
+
for (const rcFile of SHELL_RC_FILES) {
|
|
45
|
+
const rcPath = path.join(homedir(), rcFile);
|
|
46
|
+
const existing = existsSync(rcPath) ? readFileSync(rcPath, 'utf8') : '';
|
|
47
|
+
if (existing.includes(SHELL_HOOK_LINE)) continue;
|
|
48
|
+
const prefix = existing && !existing.endsWith('\n') ? '\n' : '';
|
|
49
|
+
writeFileSync(rcPath, `${existing}${prefix}${SHELL_HOOK_LINE}\n`, { mode: 0o644 });
|
|
50
|
+
logs.push(`Added Aria wrapper PATH hook → ${rcPath}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function buildRuntimeInjectionBlock(): string {
|
|
55
|
+
return `
|
|
56
|
+
RUNTIME_ENV="$HOME/.aria/runtime/runtime.env"
|
|
57
|
+
if [ -f "$RUNTIME_ENV" ]; then
|
|
58
|
+
set -a
|
|
59
|
+
. "$RUNTIME_ENV"
|
|
60
|
+
set +a
|
|
61
|
+
fi
|
|
62
|
+
export ARIA_RUNTIME_URL="\${ARIA_RUNTIME_URL:-http://127.0.0.1:4319}"
|
|
63
|
+
export OPENAI_BASE_URL="\${OPENAI_BASE_URL:-$ARIA_RUNTIME_URL/v1}"
|
|
64
|
+
export ANTHROPIC_BASE_URL="\${ANTHROPIC_BASE_URL:-$ARIA_RUNTIME_URL/v1}"
|
|
65
|
+
if [ -z "\${ARIA_API_KEY:-}" ]; then
|
|
66
|
+
if [ -f "$HOME/.aria/owner-token" ]; then
|
|
67
|
+
export ARIA_API_KEY="$(tr -d '\\n' < "$HOME/.aria/owner-token")"
|
|
68
|
+
elif [ -f "$HOME/.aria/license.json" ]; then
|
|
69
|
+
export ARIA_API_KEY="$(sed -n 's/.*"harnessToken"[[:space:]]*:[[:space:]]*"\\([^"]*\\)".*/\\1/p' "$HOME/.aria/license.json" | head -n 1)"
|
|
70
|
+
if [ -z "$ARIA_API_KEY" ]; then
|
|
71
|
+
export ARIA_API_KEY="$(sed -n 's/.*"token"[[:space:]]*:[[:space:]]*"\\([^"]*\\)".*/\\1/p' "$HOME/.aria/license.json" | head -n 1)"
|
|
72
|
+
fi
|
|
73
|
+
fi
|
|
74
|
+
fi
|
|
75
|
+
`;
|
|
76
|
+
}
|
|
77
|
+
|
|
7
78
|
export async function connectShell(
|
|
8
79
|
toolName: string,
|
|
9
80
|
config: AriaConfig,
|
|
10
81
|
): Promise<string[]> {
|
|
11
82
|
const logs: string[] = [];
|
|
12
83
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
toolPath = execSync(`which ${toolName}`, { encoding: 'utf-8' }).trim();
|
|
16
|
-
} catch {
|
|
84
|
+
const toolPath = resolveToolPath(toolName);
|
|
85
|
+
if (!toolPath) {
|
|
17
86
|
logs.push(`Tool "${toolName}" not found in PATH`);
|
|
18
87
|
return logs;
|
|
19
88
|
}
|
|
20
89
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (!existsSync(wrapperDir)) {
|
|
25
|
-
mkdirSync(wrapperDir, { recursive: true });
|
|
90
|
+
if (!existsSync(WRAPPER_DIR)) {
|
|
91
|
+
mkdirSync(WRAPPER_DIR, { recursive: true });
|
|
26
92
|
}
|
|
27
93
|
|
|
28
94
|
const ariaBlock = buildShellWrapperBlock(config, toolName);
|
|
95
|
+
const runtimeBlock = buildRuntimeInjectionBlock();
|
|
96
|
+
const wrapperPath = path.join(WRAPPER_DIR, toolName);
|
|
29
97
|
const script = `#!/usr/bin/env bash
|
|
30
98
|
# ARIA HARNESS WRAPPER — generated by @aria/connector
|
|
31
99
|
# Wraps ${toolName} with Aria's cognitive harness
|
|
32
100
|
${ariaBlock}
|
|
33
|
-
|
|
101
|
+
${runtimeBlock}
|
|
102
|
+
exec "${toolPath}" "$@"
|
|
34
103
|
`;
|
|
35
104
|
|
|
36
105
|
writeFileSync(wrapperPath, script);
|
|
37
106
|
chmodSync(wrapperPath, 0o755);
|
|
107
|
+
ensureWrapperShellHook(logs);
|
|
38
108
|
logs.push(`Created wrapper: ${wrapperPath}`);
|
|
39
|
-
logs.push(
|
|
40
|
-
logs.push(` export PATH="$HOME/.aria/wrappers:$PATH"`);
|
|
109
|
+
logs.push(`${toolName} will route through the mounted Aria runtime on new shell sessions.`);
|
|
41
110
|
|
|
42
111
|
return logs;
|
|
43
112
|
}
|
|
@@ -61,7 +130,7 @@ function buildShellWrapperBlock(config: AriaConfig, toolName: string): string {
|
|
|
61
130
|
|
|
62
131
|
export async function disconnectShell(toolName: string): Promise<string[]> {
|
|
63
132
|
const logs: string[] = [];
|
|
64
|
-
const wrapperPath = path.join(
|
|
133
|
+
const wrapperPath = path.join(WRAPPER_DIR, toolName);
|
|
65
134
|
|
|
66
135
|
if (existsSync(wrapperPath)) {
|
|
67
136
|
unlinkSync(wrapperPath);
|