@aria_asi/cli 0.2.29 → 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/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/assets/hooks/aria-cognition-substrate-binding.mjs +2 -10
- package/dist/assets/hooks/lib/canonical-lenses.mjs +2 -2
- package/dist/assets/opencode-plugins/harness-gate/index.js +1 -1
- package/dist/assets/opencode-plugins/harness-stop/index.js +1 -1
- package/dist/runtime/local-phase.mjs +18 -0
- package/dist/runtime/manifest.json +1 -1
- package/dist/runtime/sdk/BUNDLED.json +1 -1
- package/dist/runtime/service.mjs +374 -24
- package/dist/runtime/vendor/aria-gate-runtime/index.d.ts +1 -1
- package/dist/runtime/vendor/aria-gate-runtime/index.d.ts.map +1 -1
- package/dist/runtime/vendor/aria-gate-runtime/index.js +16 -1
- package/dist/runtime/vendor/aria-gate-runtime/index.js.map +1 -1
- package/dist/sdk/BUNDLED.json +1 -1
- package/hooks/aria-cognition-substrate-binding.mjs +2 -10
- package/hooks/lib/canonical-lenses.mjs +2 -2
- package/opencode-plugins/harness-gate/index.js +1 -1
- package/opencode-plugins/harness-stop/index.js +1 -1
- package/package.json +2 -2
- package/runtime-src/local-phase.mjs +18 -0
- package/runtime-src/service.mjs +374 -24
- package/src/self-update.ts +89 -8
|
@@ -15,7 +15,8 @@ export declare function checkForUpdate(opts?: {
|
|
|
15
15
|
force?: boolean;
|
|
16
16
|
}): Promise<UpdateCheckResult>;
|
|
17
17
|
/**
|
|
18
|
-
* Convenience: check +
|
|
18
|
+
* Convenience: check + auto-install if available. Falls back to notice-only
|
|
19
|
+
* when auto-upgrade is disabled or can't be launched. Non-blocking, silent
|
|
19
20
|
* on errors. Called from bin/aria.js on startup.
|
|
20
21
|
*/
|
|
21
22
|
export declare function maybePrintUpdateNotice(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"self-update.d.ts","sourceRoot":"","sources":["../../../src/self-update.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"self-update.d.ts","sourceRoot":"","sources":["../../../src/self-update.ts"],"names":[],"mappings":"AAgDA,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAqHD;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAqD/F;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CAY5D"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
// self-update — checks the npm registry for newer @aria_asi/cli versions
|
|
2
|
-
// and
|
|
3
|
-
// their tooling); just informs.
|
|
2
|
+
// and auto-installs them in the background by default.
|
|
4
3
|
//
|
|
5
4
|
// Direction: Hamza 2026-04-26 — "does the package auto update when we
|
|
6
5
|
// enhance it on our enhance? so we can continually improve all night using
|
|
7
6
|
// arias background work we should imrpove to do that once we finish".
|
|
8
7
|
// This is the primitive that closes the overnight-improvement loop:
|
|
9
8
|
// Aria publishes 0.2.5 / 0.3.0 / etc.; clients see the notice on their
|
|
10
|
-
// next `aria <cmd>` invocation;
|
|
9
|
+
// next `aria <cmd>` invocation; Aria upgrades itself in the background.
|
|
11
10
|
//
|
|
12
11
|
// Doctrine bindings:
|
|
13
12
|
// - feedback_no_demos.md — real overnight evolution, real registry check
|
|
@@ -22,19 +21,28 @@
|
|
|
22
21
|
// - Reads ~/.aria/last-update-check timestamp; if checked <24h ago, skip
|
|
23
22
|
// - GET registry.npmjs.org/@aria_asi/cli for latest dist-tag
|
|
24
23
|
// - semver-compare; if newer, return {updateAvailable: true, latest, current, message}
|
|
24
|
+
// - Launches npm install -g @aria_asi/cli@latest in the background
|
|
25
|
+
// unless ARIA_SELF_UPDATE_MODE=notify|off
|
|
26
|
+
// - Tracks per-version attempts so it doesn't thrash on every invocation
|
|
25
27
|
// - Write timestamp on every check (success or skip-due-to-rate-limit)
|
|
26
28
|
// - Failures are silent (network down, registry blip — never block CLI startup)
|
|
27
29
|
//
|
|
28
30
|
// Privacy: the request to npmjs only sends User-Agent (npm registry public).
|
|
29
31
|
// No client identity, no telemetry beyond what the public registry already logs.
|
|
30
|
-
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';
|
|
32
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync, openSync } from 'node:fs';
|
|
33
|
+
import { spawn } from 'node:child_process';
|
|
31
34
|
import { homedir } from 'node:os';
|
|
32
35
|
import { join, dirname } from 'node:path';
|
|
33
36
|
import { fileURLToPath } from 'node:url';
|
|
34
37
|
const ARIA_DIR = join(homedir(), '.aria');
|
|
35
38
|
const LAST_CHECK_PATH = join(ARIA_DIR, 'last-update-check');
|
|
39
|
+
const AUTO_UPDATE_STATE_PATH = join(ARIA_DIR, 'self-update-state.json');
|
|
40
|
+
const AUTO_UPDATE_LOG_PATH = join(ARIA_DIR, 'self-update.log');
|
|
36
41
|
const CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000; // 24h
|
|
42
|
+
const AUTO_UPDATE_RETRY_MS = 6 * 60 * 60 * 1000; // 6h
|
|
37
43
|
const REGISTRY_URL = 'https://registry.npmjs.org/@aria_asi%2Fcli';
|
|
44
|
+
const PACKAGE_NAME = '@aria_asi/cli';
|
|
45
|
+
const AUTO_UPDATE_MODE = (process.env.ARIA_SELF_UPDATE_MODE || 'auto').toLowerCase();
|
|
38
46
|
/**
|
|
39
47
|
* Find the package's own version by walking up from this file's runtime
|
|
40
48
|
* path until we hit the package.json with name @aria_asi/cli.
|
|
@@ -87,6 +95,68 @@ function compareSemver(a, b) {
|
|
|
87
95
|
return 1;
|
|
88
96
|
return pa.pre.localeCompare(pb.pre);
|
|
89
97
|
}
|
|
98
|
+
function loadAutoUpdateState() {
|
|
99
|
+
try {
|
|
100
|
+
if (!existsSync(AUTO_UPDATE_STATE_PATH))
|
|
101
|
+
return {};
|
|
102
|
+
return JSON.parse(readFileSync(AUTO_UPDATE_STATE_PATH, 'utf-8'));
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return {};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function saveAutoUpdateState(state) {
|
|
109
|
+
try {
|
|
110
|
+
if (!existsSync(ARIA_DIR))
|
|
111
|
+
mkdirSync(ARIA_DIR, { recursive: true, mode: 0o700 });
|
|
112
|
+
writeFileSync(AUTO_UPDATE_STATE_PATH, JSON.stringify(state, null, 2) + '\n', { mode: 0o600 });
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
// best effort only
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function canRetryVersion(latest) {
|
|
119
|
+
const state = loadAutoUpdateState();
|
|
120
|
+
if (state.lastAttemptVersion !== latest)
|
|
121
|
+
return true;
|
|
122
|
+
if (!state.lastAttemptAt)
|
|
123
|
+
return true;
|
|
124
|
+
return Date.now() - state.lastAttemptAt >= AUTO_UPDATE_RETRY_MS;
|
|
125
|
+
}
|
|
126
|
+
function launchAutoInstall(latest) {
|
|
127
|
+
if (AUTO_UPDATE_MODE === 'off') {
|
|
128
|
+
return { started: false, reason: 'self-update disabled' };
|
|
129
|
+
}
|
|
130
|
+
if (AUTO_UPDATE_MODE === 'notify') {
|
|
131
|
+
return { started: false, reason: 'notify-only mode' };
|
|
132
|
+
}
|
|
133
|
+
if (!canRetryVersion(latest)) {
|
|
134
|
+
return { started: false, reason: 'recent attempt already made' };
|
|
135
|
+
}
|
|
136
|
+
try {
|
|
137
|
+
if (!existsSync(ARIA_DIR))
|
|
138
|
+
mkdirSync(ARIA_DIR, { recursive: true, mode: 0o700 });
|
|
139
|
+
const logFd = openSync(AUTO_UPDATE_LOG_PATH, 'a', 0o600);
|
|
140
|
+
const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
141
|
+
const child = spawn(npmCmd, ['install', '-g', `${PACKAGE_NAME}@${latest}`], {
|
|
142
|
+
detached: true,
|
|
143
|
+
stdio: ['ignore', logFd, logFd],
|
|
144
|
+
env: process.env,
|
|
145
|
+
});
|
|
146
|
+
child.unref();
|
|
147
|
+
saveAutoUpdateState({
|
|
148
|
+
lastAttemptVersion: latest,
|
|
149
|
+
lastAttemptAt: Date.now(),
|
|
150
|
+
});
|
|
151
|
+
return { started: true };
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
return {
|
|
155
|
+
started: false,
|
|
156
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}
|
|
90
160
|
/**
|
|
91
161
|
* Check the registry for the latest @aria_asi/cli version. Rate-limited
|
|
92
162
|
* to once per CHECK_INTERVAL_MS (24h) via a timestamp file in ~/.aria.
|
|
@@ -142,19 +212,25 @@ export async function checkForUpdate(opts = {}) {
|
|
|
142
212
|
current,
|
|
143
213
|
latest,
|
|
144
214
|
updateAvailable: true,
|
|
145
|
-
message: `I have an update: v${latest} (you're on v${current})
|
|
215
|
+
message: `I have an update: v${latest} (you're on v${current}).`,
|
|
146
216
|
};
|
|
147
217
|
}
|
|
148
218
|
/**
|
|
149
|
-
* Convenience: check +
|
|
219
|
+
* Convenience: check + auto-install if available. Falls back to notice-only
|
|
220
|
+
* when auto-upgrade is disabled or can't be launched. Non-blocking, silent
|
|
150
221
|
* on errors. Called from bin/aria.js on startup.
|
|
151
222
|
*/
|
|
152
223
|
export async function maybePrintUpdateNotice() {
|
|
153
224
|
try {
|
|
154
225
|
const result = await checkForUpdate();
|
|
155
226
|
if (result.ok && result.updateAvailable && result.message) {
|
|
156
|
-
|
|
157
|
-
|
|
227
|
+
const autoInstall = result.latest ? launchAutoInstall(result.latest) : { started: false, reason: 'missing latest version' };
|
|
228
|
+
if (autoInstall.started) {
|
|
229
|
+
process.stderr.write(` ${result.message} Updating in the background now.\n`);
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
process.stderr.write(` ${result.message} Run 'npm install -g ${PACKAGE_NAME}@latest' if you want it immediately.\n`);
|
|
233
|
+
}
|
|
158
234
|
}
|
|
159
235
|
}
|
|
160
236
|
catch { /* never block startup */ }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"self-update.js","sourceRoot":"","sources":["../../../src/self-update.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,
|
|
1
|
+
{"version":3,"file":"self-update.js","sourceRoot":"","sources":["../../../src/self-update.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,uDAAuD;AACvD,EAAE;AACF,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,oEAAoE;AACpE,uEAAuE;AACvE,wEAAwE;AACxE,EAAE;AACF,qBAAqB;AACrB,2EAA2E;AAC3E,4EAA4E;AAC5E,yDAAyD;AACzD,2EAA2E;AAC3E,wEAAwE;AACxE,EAAE;AACF,YAAY;AACZ,8EAA8E;AAC9E,qCAAqC;AACrC,2EAA2E;AAC3E,+DAA+D;AAC/D,yFAAyF;AACzF,qEAAqE;AACrE,8CAA8C;AAC9C,2EAA2E;AAC3E,yEAAyE;AACzE,kFAAkF;AAClF,EAAE;AACF,6EAA6E;AAC7E,iFAAiF;AAEjF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACvF,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,OAAO,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O,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;IAC/D,CAAC;IAED,OAAO;QACL,EAAE,EAAE,IAAI;QACR,OAAO;QACP,MAAM;QACN,eAAe,EAAE,IAAI;QACrB,OAAO,EAAE,sBAAsB,MAAM,gBAAgB,OAAO,IAAI;KACjE,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB;IAC1C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,cAAc,EAAE,CAAC;QACtC,IAAI,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,eAAe,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YAC1D,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,wBAAwB,EAAE,CAAC;YAC5H,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;gBACxB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,OAAO,oCAAoC,CAAC,CAAC;YAChF,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,OAAO,wBAAwB,YAAY,wCAAwC,CAAC,CAAC;YACxH,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC,CAAA,yBAAyB,CAAA,CAAC;AACrC,CAAC"}
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
import { readFileSync, appendFileSync, existsSync, mkdirSync } from 'node:fs';
|
|
38
38
|
import { dirname } from 'node:path';
|
|
39
39
|
import { homedir } from 'node:os';
|
|
40
|
+
import { ALL_LENS_NAMES } from './lib/canonical-lenses.mjs';
|
|
40
41
|
|
|
41
42
|
const HOME = homedir();
|
|
42
43
|
const AUDIT = `${HOME}/.claude/aria-cognition-substrate-binding-audit.jsonl`;
|
|
@@ -51,16 +52,7 @@ function audit(event, data) {
|
|
|
51
52
|
} catch {}
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
const LENS_NAMES =
|
|
55
|
-
'nur',
|
|
56
|
-
'mizan',
|
|
57
|
-
'hikma',
|
|
58
|
-
'tafakkur',
|
|
59
|
-
'tadabbur',
|
|
60
|
-
'ilham',
|
|
61
|
-
'wahi',
|
|
62
|
-
'firasah',
|
|
63
|
-
];
|
|
55
|
+
const LENS_NAMES = ALL_LENS_NAMES;
|
|
64
56
|
|
|
65
57
|
// Hamza directive 2026-04-28: "where the fuck are my axioms? first
|
|
66
58
|
// principles? nadia language???" — the prior char-count substance check
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const LENS_NAMES_OLDER = ['nur', 'mizan', 'hikma', 'tafakkur', 'tadabbur', 'ilham', 'wahi', 'firasah'];
|
|
2
2
|
export const LENS_NAMES_NEWER = ['zahir', 'batin', 'sabab', 'hikmah', 'aqibah', 'ilham', 'meta', 'fitrah'];
|
|
3
|
-
export const LENS_NAMES_GENERIC = ['
|
|
3
|
+
export const LENS_NAMES_GENERIC = ['truth', 'harm', 'trust', 'power', 'reflection', 'context', 'impact', 'beauty'];
|
|
4
4
|
|
|
5
5
|
export const PRIMARY_OWNER_LENS_NAMES = LENS_NAMES_OLDER;
|
|
6
6
|
export const PRIMARY_CLIENT_LENS_NAMES = LENS_NAMES_GENERIC;
|
|
@@ -19,7 +19,7 @@ export function canonicalLensCorrectionText() {
|
|
|
19
19
|
return [
|
|
20
20
|
`Owner canonical lenses: ${LENS_NAMES_OLDER.join(', ')}.`,
|
|
21
21
|
`Owner mapped counterparts that must remain represented in phase reasoning and receipts: ${LENS_NAMES_NEWER.join(', ')}.`,
|
|
22
|
-
`
|
|
22
|
+
`Readable client-safe alternatives: ${LENS_NAMES_GENERIC.join(', ')}.`,
|
|
23
23
|
].join(' ');
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -41,7 +41,7 @@ const DEPLOY_PATTERNS = [
|
|
|
41
41
|
{ rx: /\bdocker\s+build\b.*--push\b/, name: 'docker-build-push' },
|
|
42
42
|
];
|
|
43
43
|
|
|
44
|
-
const INLINE_LENS_RX = /^\s*#\s*(?:nur|mizan|hikma|tafakkur|tadabbur|ilham|wahi|firasah|
|
|
44
|
+
const INLINE_LENS_RX = /^\s*#\s*(?:nur|mizan|hikma|tafakkur|tadabbur|ilham|wahi|firasah|truth|harm|trust|power|reflection|context|impact|beauty)\s*:\s*.{20,}/im;
|
|
45
45
|
const VERIFY_BLOCK_RX = /<verify>[\s\S]*?target\s*:[\s\S]*?verified\s*:[\s\S]*?axiom\s*:[\s\S]*?<\/verify>/i;
|
|
46
46
|
const TRIVIAL_BASH_RX = /^\s*(?:ls|cat|head|tail|grep|find|echo|wc|stat|which|pwd|date|file|du|df|ss|ps)\s/;
|
|
47
47
|
const SHORT_BASH_LIMIT = 30;
|
|
@@ -18,7 +18,7 @@ const RUNTIME_URL = (process.env.ARIA_RUNTIME_URL || 'http://127.0.0.1:4319').re
|
|
|
18
18
|
|
|
19
19
|
const LENS_NAMES = [
|
|
20
20
|
'nur', 'mizan', 'hikma', 'tafakkur', 'tadabbur', 'ilham', 'wahi', 'firasah',
|
|
21
|
-
'
|
|
21
|
+
'truth', 'harm', 'trust', 'power', 'reflection', 'context', 'impact', 'beauty',
|
|
22
22
|
];
|
|
23
23
|
|
|
24
24
|
const COGNITION_BLOCK_RX = /<cognition>([\s\S]*?)<\/cognition>/i;
|
|
@@ -618,6 +618,24 @@ export function buildRuntimeCognitionDirective(packet, bundle = {}) {
|
|
|
618
618
|
'- Predictor tests whether the answer will survive the next real operational step.',
|
|
619
619
|
'- Mizan keeps the answer proportionate, exact, and high-quality.',
|
|
620
620
|
'',
|
|
621
|
+
'Visible cognition contract for the user-facing response:',
|
|
622
|
+
'- For any non-trivial reply, include a readable <cognition> block using everyday labels, not internal lens codenames.',
|
|
623
|
+
'- If you request any non-trivial tool call, place the <cognition> block BEFORE the tool request.',
|
|
624
|
+
'- If the action is deploy, destructive, or state-mutating, include both <verify> and <expected> blocks before the tool request.',
|
|
625
|
+
'- The runtime will canonicalize the readable block into backend JSON automatically, so do not hide it behind private shorthand.',
|
|
626
|
+
'',
|
|
627
|
+
'<cognition>',
|
|
628
|
+
' truth: <what is actually true here, grounded in visible evidence and substrate anchors>',
|
|
629
|
+
' harm: <what could break, mislead, or damage trust if the next step is wrong>',
|
|
630
|
+
' trust: <what principle, promise, or user trust boundary governs this turn>',
|
|
631
|
+
' power: <what capability is being used and what restraint it requires>',
|
|
632
|
+
' reflection: <what deeper structural read changes the action, not just the wording>',
|
|
633
|
+
' context: <what surrounding repo/runtime/user context materially changes the correct move>',
|
|
634
|
+
' impact: <what second-order consequence or next-step outcome follows from this move>',
|
|
635
|
+
' beauty: <what cleaner, more elegant, more durable path preserves the contract>',
|
|
636
|
+
` first_principle: ${firstPrincipleText}`,
|
|
637
|
+
'</cognition>',
|
|
638
|
+
'',
|
|
621
639
|
dominantModules.length ? 'Current module insights:' : 'Current module insights: none yet',
|
|
622
640
|
...dominantModules.map((line) => `- ${line}`),
|
|
623
641
|
'',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundledAt": "2026-04-29T23:
|
|
2
|
+
"bundledAt": "2026-04-29T23:30:47.363Z",
|
|
3
3
|
"sdkFiles": 6,
|
|
4
4
|
"runtimeTemplate": "/home/hamzaibrahim1/rei-ai-brain/packages/aria-connector/runtime-src",
|
|
5
5
|
"gateRuntimeSource": "/home/hamzaibrahim1/rei-ai-brain/packages/aria-gate-runtime/dist",
|