@aria_asi/cli 0.2.31 → 0.2.33
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/dist/aria-connector/src/connectors/claude-code.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/claude-code.js +30 -3
- package/dist/aria-connector/src/connectors/claude-code.js.map +1 -1
- package/dist/aria-connector/src/connectors/codebase-awareness.d.ts +8 -1
- package/dist/aria-connector/src/connectors/codebase-awareness.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/codebase-awareness.js +126 -71
- package/dist/aria-connector/src/connectors/codebase-awareness.js.map +1 -1
- package/dist/aria-connector/src/connectors/codex.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/codex.js +76 -9
- package/dist/aria-connector/src/connectors/codex.js.map +1 -1
- package/dist/aria-connector/src/connectors/must-read.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/must-read.js +4 -0
- package/dist/aria-connector/src/connectors/must-read.js.map +1 -1
- package/dist/aria-connector/src/connectors/opencode.js +25 -9
- package/dist/aria-connector/src/connectors/opencode.js.map +1 -1
- package/dist/aria-connector/src/setup-wizard.d.ts.map +1 -1
- package/dist/aria-connector/src/setup-wizard.js +91 -24
- package/dist/aria-connector/src/setup-wizard.js.map +1 -1
- package/dist/assets/hooks/aria-agent-handoff.mjs +23 -0
- package/dist/assets/hooks/aria-cognition-substrate-binding.mjs +69 -3
- package/dist/assets/hooks/aria-harness-via-sdk.mjs +10 -5
- package/dist/assets/hooks/aria-pre-emit-dryrun.mjs +35 -0
- package/dist/assets/hooks/aria-pre-tool-gate.mjs +217 -17
- package/dist/assets/hooks/aria-preprompt-consult.mjs +28 -2
- package/dist/assets/hooks/aria-preturn-memory-gate.mjs +30 -2
- package/dist/assets/hooks/aria-repo-doctrine-gate.mjs +31 -1
- package/dist/assets/hooks/aria-stop-gate.mjs +154 -37
- package/dist/assets/hooks/doctrine_trigger_map.json +55 -0
- package/dist/assets/hooks/lib/domain-output-quality.mjs +103 -0
- package/dist/assets/hooks/lib/skill-autoload-gate.mjs +1 -0
- package/dist/assets/opencode-plugins/harness-gate/index.js +84 -7
- package/dist/assets/opencode-plugins/harness-gate/lib/skill-autoload-gate.js +1 -0
- package/dist/assets/opencode-plugins/harness-outcome/index.js +39 -0
- package/dist/assets/opencode-plugins/harness-stop/index.js +101 -7
- package/dist/assets/opencode-plugins/harness-stop/lib/domain-output-quality.js +103 -0
- package/dist/assets/opencode-plugins/harness-stop/lib/skill-autoload-gate.js +1 -0
- package/dist/runtime/codex-bridge.mjs +71 -8
- package/dist/runtime/discipline/CLAUDE.md +16 -0
- package/dist/runtime/discipline/doctrine_trigger_map.json +55 -0
- package/dist/runtime/doctrine_trigger_map.json +55 -0
- package/dist/runtime/harness-daemon.mjs +80 -5
- package/dist/runtime/manifest.json +1 -1
- package/dist/runtime/sdk/BUNDLED.json +1 -1
- package/dist/runtime/sdk/index.d.ts +14 -0
- package/dist/runtime/sdk/index.js +23 -1
- package/dist/runtime/sdk/index.js.map +1 -1
- package/dist/runtime/service.mjs +385 -11
- package/dist/sdk/BUNDLED.json +1 -1
- package/dist/sdk/index.d.ts +14 -0
- package/dist/sdk/index.js +23 -1
- package/dist/sdk/index.js.map +1 -1
- package/hooks/aria-agent-handoff.mjs +23 -0
- package/hooks/aria-cognition-substrate-binding.mjs +69 -3
- package/hooks/aria-harness-via-sdk.mjs +10 -5
- package/hooks/aria-pre-emit-dryrun.mjs +35 -0
- package/hooks/aria-pre-tool-gate.mjs +217 -17
- package/hooks/aria-preprompt-consult.mjs +28 -2
- package/hooks/aria-preturn-memory-gate.mjs +30 -2
- package/hooks/aria-repo-doctrine-gate.mjs +31 -1
- package/hooks/aria-stop-gate.mjs +154 -37
- package/hooks/doctrine_trigger_map.json +55 -0
- package/hooks/lib/domain-output-quality.mjs +103 -0
- package/hooks/lib/skill-autoload-gate.mjs +1 -0
- package/opencode-plugins/harness-gate/index.js +84 -7
- package/opencode-plugins/harness-gate/lib/skill-autoload-gate.js +1 -0
- package/opencode-plugins/harness-outcome/index.js +39 -0
- package/opencode-plugins/harness-stop/index.js +101 -7
- package/opencode-plugins/harness-stop/lib/domain-output-quality.js +103 -0
- package/opencode-plugins/harness-stop/lib/skill-autoload-gate.js +1 -0
- package/package.json +1 -1
- package/runtime-src/codex-bridge.mjs +71 -8
- package/runtime-src/harness-daemon.mjs +80 -5
- package/runtime-src/service.mjs +385 -11
- package/src/connectors/claude-code.ts +31 -3
- package/src/connectors/codebase-awareness.ts +141 -77
- package/src/connectors/codex.ts +76 -9
- package/src/connectors/must-read.ts +4 -0
- package/src/connectors/opencode.ts +25 -9
- package/src/setup-wizard.ts +105 -25
package/src/setup-wizard.ts
CHANGED
|
@@ -33,6 +33,22 @@ const HARNESS_URL =
|
|
|
33
33
|
const HARNESS_TOKEN = process.env.ARIA_HARNESS_TOKEN || '';
|
|
34
34
|
const ARIA_DIR = join(homedir(), '.aria');
|
|
35
35
|
const LICENSE_PATH = join(ARIA_DIR, 'license.json');
|
|
36
|
+
const ONBOARDING_FALLBACK_URLS = [
|
|
37
|
+
process.env.ARIA_ONBOARDING_URL || '',
|
|
38
|
+
HARNESS_URL,
|
|
39
|
+
process.env.ARIA_SOUL_URL || '',
|
|
40
|
+
process.env.ARIAS_SOUL_URL || '',
|
|
41
|
+
process.env.ARIA_SOUL_BASE_URL || '',
|
|
42
|
+
'https://api.ariasos.com',
|
|
43
|
+
'https://arias-soul-6zp3gtk2ca-uc.a.run.app',
|
|
44
|
+
'https://harness.ariasos.com',
|
|
45
|
+
]
|
|
46
|
+
.flatMap((entry) => String(entry || '').split(','))
|
|
47
|
+
.map((entry) => entry.trim().replace(/\/+$/, ''))
|
|
48
|
+
.filter(Boolean)
|
|
49
|
+
.filter((entry, index, list) => list.indexOf(entry) === index);
|
|
50
|
+
|
|
51
|
+
let activeOnboardingBaseUrl = ONBOARDING_FALLBACK_URLS[0] || HARNESS_URL.replace(/\/+$/, '');
|
|
36
52
|
|
|
37
53
|
type ConfigWrite =
|
|
38
54
|
| { kind: 'persona_update'; updates: Record<string, unknown> }
|
|
@@ -57,7 +73,7 @@ interface DepthOption {
|
|
|
57
73
|
interface ConverseResponse {
|
|
58
74
|
ok: boolean;
|
|
59
75
|
sessionId: string;
|
|
60
|
-
topic: 'identity' | 'codebase' | 'persona' | 'done';
|
|
76
|
+
topic: 'identity' | 'codebase' | 'persona' | 'workforce' | 'harness_setup' | 'done';
|
|
61
77
|
ariaPrompt: string;
|
|
62
78
|
depthOptions: DepthOption[];
|
|
63
79
|
freeTextAllowed: boolean;
|
|
@@ -69,17 +85,32 @@ interface ConverseResponse {
|
|
|
69
85
|
|
|
70
86
|
export async function runSetupWizard(): Promise<void> {
|
|
71
87
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
88
|
+
let readlineClosed = false;
|
|
89
|
+
rl.on('close', () => { readlineClosed = true; });
|
|
72
90
|
const ask = (q: string): Promise<string> =>
|
|
73
|
-
new Promise((resolve) =>
|
|
91
|
+
new Promise((resolve) => {
|
|
92
|
+
if (readlineClosed) {
|
|
93
|
+
resolve('__ARIA_ONBOARDING_EOF__');
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
rl.question(q, (a) => resolve(a));
|
|
97
|
+
});
|
|
74
98
|
|
|
75
99
|
const sessionId = `onboard_${Date.now()}_${randomBytes(4).toString('hex')}`;
|
|
76
100
|
let userMessage: string | undefined;
|
|
77
101
|
let action: 'start' | 'answer' = 'start';
|
|
102
|
+
let turnCount = 0;
|
|
78
103
|
|
|
79
104
|
console.log('\n💬 Aria: starting onboarding…\n');
|
|
80
105
|
|
|
81
106
|
try {
|
|
82
107
|
while (true) {
|
|
108
|
+
turnCount += 1;
|
|
109
|
+
if (turnCount > 40) {
|
|
110
|
+
console.error('\n❌ Onboarding stopped after too many turns. Please run `aria` again to resume.');
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
83
114
|
const resp = await callConverse({ sessionId, action, userMessage });
|
|
84
115
|
if (!resp.ok) {
|
|
85
116
|
console.error(`\n❌ Onboarding error: ${resp.error || 'unknown'}`);
|
|
@@ -100,6 +131,10 @@ export async function runSetupWizard(): Promise<void> {
|
|
|
100
131
|
}
|
|
101
132
|
|
|
102
133
|
userMessage = (await ask('> ')).trim();
|
|
134
|
+
if (userMessage === '__ARIA_ONBOARDING_EOF__') {
|
|
135
|
+
console.error('\n❌ Onboarding input ended before setup completed. Run `aria` again to resume.');
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
103
138
|
action = 'answer';
|
|
104
139
|
if (!userMessage) userMessage = resp.depthOptions[0]?.signal ?? 'next';
|
|
105
140
|
}
|
|
@@ -117,18 +152,8 @@ async function callConverse(body: {
|
|
|
117
152
|
action: 'start' | 'answer';
|
|
118
153
|
userMessage?: string;
|
|
119
154
|
}): Promise<ConverseResponse> {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
method: 'POST',
|
|
123
|
-
headers: {
|
|
124
|
-
'Content-Type': 'application/json',
|
|
125
|
-
...(HARNESS_TOKEN ? { Authorization: `Bearer ${HARNESS_TOKEN}` } : {}),
|
|
126
|
-
},
|
|
127
|
-
body: JSON.stringify(body),
|
|
128
|
-
});
|
|
129
|
-
return (await res.json()) as ConverseResponse;
|
|
130
|
-
} catch (err) {
|
|
131
|
-
return {
|
|
155
|
+
return requestOnboardingJson<ConverseResponse>('/api/onboarding/converse', body, {
|
|
156
|
+
fallback: {
|
|
132
157
|
ok: false,
|
|
133
158
|
sessionId: body.sessionId,
|
|
134
159
|
topic: 'identity',
|
|
@@ -137,9 +162,69 @@ async function callConverse(body: {
|
|
|
137
162
|
freeTextAllowed: false,
|
|
138
163
|
isComplete: false,
|
|
139
164
|
progressPct: 0,
|
|
140
|
-
|
|
141
|
-
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
async function requestOnboardingJson<T extends { ok?: boolean; error?: string }>(
|
|
170
|
+
pathname: string,
|
|
171
|
+
body: Record<string, unknown>,
|
|
172
|
+
options: { fallback: T },
|
|
173
|
+
): Promise<T> {
|
|
174
|
+
const failures: string[] = [];
|
|
175
|
+
const baseUrls = [
|
|
176
|
+
activeOnboardingBaseUrl,
|
|
177
|
+
...ONBOARDING_FALLBACK_URLS,
|
|
178
|
+
].filter((entry, index, list) => entry && list.indexOf(entry) === index);
|
|
179
|
+
|
|
180
|
+
for (const baseUrl of baseUrls) {
|
|
181
|
+
try {
|
|
182
|
+
const res = await fetch(`${baseUrl}${pathname}`, {
|
|
183
|
+
method: 'POST',
|
|
184
|
+
headers: {
|
|
185
|
+
'Content-Type': 'application/json',
|
|
186
|
+
Accept: 'application/json',
|
|
187
|
+
...(HARNESS_TOKEN ? { Authorization: `Bearer ${HARNESS_TOKEN}` } : {}),
|
|
188
|
+
},
|
|
189
|
+
body: JSON.stringify(body),
|
|
190
|
+
});
|
|
191
|
+
const text = await res.text();
|
|
192
|
+
const contentType = res.headers.get('content-type') || '';
|
|
193
|
+
const looksJson = /^\s*[\[{]/.test(text);
|
|
194
|
+
|
|
195
|
+
if (!contentType.includes('application/json') && !looksJson) {
|
|
196
|
+
failures.push(`${baseUrl}${pathname} returned HTTP ${res.status} ${contentType || 'without content-type'}`);
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
let data: T;
|
|
201
|
+
try {
|
|
202
|
+
data = JSON.parse(text || '{}') as T;
|
|
203
|
+
} catch (err) {
|
|
204
|
+
failures.push(`${baseUrl}${pathname} returned invalid JSON: ${err instanceof Error ? err.message : String(err)}`);
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (!res.ok) {
|
|
209
|
+
failures.push(`${baseUrl}${pathname} returned HTTP ${res.status}: ${data.error || 'no error message'}`);
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
activeOnboardingBaseUrl = baseUrl;
|
|
214
|
+
return data;
|
|
215
|
+
} catch (err) {
|
|
216
|
+
failures.push(`${baseUrl}${pathname} transport failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
217
|
+
}
|
|
142
218
|
}
|
|
219
|
+
|
|
220
|
+
return {
|
|
221
|
+
...options.fallback,
|
|
222
|
+
ok: false,
|
|
223
|
+
error:
|
|
224
|
+
'Onboarding API is unavailable or not returning JSON. ' +
|
|
225
|
+
failures.slice(0, 4).join(' | ') +
|
|
226
|
+
(failures.length > 4 ? ` | ${failures.length - 4} more endpoint(s) failed` : ''),
|
|
227
|
+
};
|
|
143
228
|
}
|
|
144
229
|
|
|
145
230
|
async function maybeOfferGitHubConnect(ask: (q: string) => Promise<string>): Promise<void> {
|
|
@@ -207,19 +292,14 @@ async function applyConfigWrites(writes: ConfigWrite[]): Promise<void> {
|
|
|
207
292
|
const provider = claims.provider || '';
|
|
208
293
|
const apiKey = claims.apiKey || '';
|
|
209
294
|
try {
|
|
210
|
-
const
|
|
211
|
-
method: 'POST',
|
|
212
|
-
headers: { 'Content-Type': 'application/json' },
|
|
213
|
-
body: JSON.stringify({ email, provider, llm_key: apiKey }),
|
|
214
|
-
});
|
|
215
|
-
const data = await resp.json() as {
|
|
295
|
+
const data = await requestOnboardingJson<{
|
|
216
296
|
ok?: boolean;
|
|
217
297
|
license?: { token: string; jti: string; tier: string; expires_at: string };
|
|
218
298
|
claims?: Record<string, unknown>;
|
|
219
299
|
error?: string;
|
|
220
|
-
};
|
|
221
|
-
if (!
|
|
222
|
-
console.warn(` ⚠ I couldn't issue your license: ${data.error ||
|
|
300
|
+
}>('/api/onboarding/self-issue', { email, provider, llm_key: apiKey }, { fallback: { ok: false } });
|
|
301
|
+
if (!data.ok || !data.license) {
|
|
302
|
+
console.warn(` ⚠ I couldn't issue your license: ${data.error || 'license endpoint did not return a license'}`);
|
|
223
303
|
continue;
|
|
224
304
|
}
|
|
225
305
|
if (!existsSync(ARIA_DIR)) mkdirSync(ARIA_DIR, { recursive: true, mode: 0o700 });
|