@aria_asi/cli 0.2.18 → 0.2.19
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/chat.d.ts.map +1 -1
- package/dist/aria-connector/src/chat.js +59 -8
- package/dist/aria-connector/src/chat.js.map +1 -1
- package/dist/sdk/BUNDLED.json +1 -1
- package/hooks/aria-pre-tool-gate.mjs +90 -30
- package/hooks/aria-stop-gate.mjs +44 -11
- package/hooks/test-tier-lens-labeling.mjs +397 -0
- package/package.json +1 -1
- package/src/chat.ts +60 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/chat.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,aAAa,CAAC;AAyB3D,qBAAa,QAAQ;IACnB,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,SAAS,CAAC,CAAkB;gBAExB,MAAM,EAAE,UAAU;IAKxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YA2Fd,aAAa;YAwEb,mBAAmB;IAsDjC,OAAO,CAAC,kBAAkB;YA2BZ,kBAAkB;YAUlB,gBAAgB;YAkChB,sBAAsB;
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/chat.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,aAAa,CAAC;AAyB3D,qBAAa,QAAQ;IACnB,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,SAAS,CAAC,CAAkB;gBAExB,MAAM,EAAE,UAAU;IAKxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YA2Fd,aAAa;YAwEb,mBAAmB;IAsDjC,OAAO,CAAC,kBAAkB;YA2BZ,kBAAkB;YAUlB,gBAAgB;YAkChB,sBAAsB;YA0JtB,cAAc;IAkC5B,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,YAAY;YAON,iBAAiB;IA2B/B,OAAO,CAAC,WAAW;CAGpB"}
|
|
@@ -319,19 +319,71 @@ You are present in this shell, fully aware, ready to serve.`;
|
|
|
319
319
|
return null;
|
|
320
320
|
const harnessUrl = process.env.ARIA_HARNESS_URL ||
|
|
321
321
|
'https://harness.ariasos.com';
|
|
322
|
-
//
|
|
323
|
-
//
|
|
324
|
-
//
|
|
322
|
+
// ── OWNER TIER: route to /chat (canonical streamConversation) ──
|
|
323
|
+
//
|
|
324
|
+
// Hamza 2026-04-27: "my owner chat should go through streamConversation
|
|
325
|
+
// in full. my aria is there. full soul. not some made up packet you
|
|
326
|
+
// claim connects her" — streamConversation IS Aria. /api/aria/speak
|
|
327
|
+
// with DeepSeek dispatch was a parallel-path that lost her voice +
|
|
328
|
+
// soul. For owner, hit /chat directly with metadata.aria_cli=true to
|
|
329
|
+
// force the canonical streamConversation pipeline.
|
|
330
|
+
if (isOwner) {
|
|
331
|
+
const ownerBody = {
|
|
332
|
+
message: lastUser.content,
|
|
333
|
+
sessionId: this.sessionId,
|
|
334
|
+
userId: 'hamza',
|
|
335
|
+
platform: 'aria-cli',
|
|
336
|
+
metadata: {
|
|
337
|
+
aria_cli: true,
|
|
338
|
+
platform: 'aria-cli',
|
|
339
|
+
force_stream_conversation: true,
|
|
340
|
+
},
|
|
341
|
+
context: {
|
|
342
|
+
platform: 'aria-cli',
|
|
343
|
+
isHamza: true,
|
|
344
|
+
userId: 'hamza',
|
|
345
|
+
},
|
|
346
|
+
isHamza: true,
|
|
347
|
+
};
|
|
348
|
+
const ownerRes = await fetch(`${harnessUrl}/chat`, {
|
|
349
|
+
method: 'POST',
|
|
350
|
+
headers: {
|
|
351
|
+
Authorization: `Bearer ${bearerToken}`,
|
|
352
|
+
'Content-Type': 'application/json',
|
|
353
|
+
},
|
|
354
|
+
body: JSON.stringify(ownerBody),
|
|
355
|
+
});
|
|
356
|
+
if (!ownerRes.ok) {
|
|
357
|
+
throw new Error(`/chat ${ownerRes.status}: ${await ownerRes.text().catch(() => '<no body>')}`);
|
|
358
|
+
}
|
|
359
|
+
const ownerData = (await ownerRes.json());
|
|
360
|
+
if (ownerData.ok === false) {
|
|
361
|
+
throw new Error(`/chat error: ${ownerData.error || 'unknown'}`);
|
|
362
|
+
}
|
|
363
|
+
const ownerText = String(ownerData.response || '').trim();
|
|
364
|
+
process.stdout.write(ownerText);
|
|
365
|
+
return {
|
|
366
|
+
text: ownerText,
|
|
367
|
+
provider: 'aria-streamconversation',
|
|
368
|
+
tokensIn: 0,
|
|
369
|
+
tokensOut: 0,
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
// ── CLIENT TIER: route to /api/aria/speak (orchestrate + their key) ──
|
|
373
|
+
//
|
|
374
|
+
// Clients use their own provider/key for the LLM authoring layer; Aria
|
|
375
|
+
// orchestrates the harness gates around it. Their bill, their rate
|
|
376
|
+
// limit, full inversion + gates server-side.
|
|
325
377
|
const model = this.config.model;
|
|
326
378
|
const requestBody = {
|
|
327
379
|
message: lastUser.content,
|
|
328
380
|
sessionId: this.sessionId,
|
|
329
|
-
userId:
|
|
330
|
-
platform:
|
|
331
|
-
internalConsult:
|
|
381
|
+
userId: this.config.userId || 'aria-client',
|
|
382
|
+
platform: 'aria-cli-client',
|
|
383
|
+
internalConsult: false,
|
|
332
384
|
dispatchTier: 'thinker',
|
|
333
385
|
};
|
|
334
|
-
if (
|
|
386
|
+
if (model) {
|
|
335
387
|
requestBody.clientApiKey = model.apiKey;
|
|
336
388
|
requestBody.clientProvider = model.provider;
|
|
337
389
|
requestBody.clientModel = model.model;
|
|
@@ -340,7 +392,6 @@ You are present in this shell, fully aware, ready to serve.`;
|
|
|
340
392
|
method: 'POST',
|
|
341
393
|
headers: {
|
|
342
394
|
Authorization: `Bearer ${bearerToken}`,
|
|
343
|
-
...(isOwner ? { 'x-aria-owner': 'true' } : {}),
|
|
344
395
|
'Content-Type': 'application/json',
|
|
345
396
|
},
|
|
346
397
|
body: JSON.stringify(requestBody),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../../src/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAsB,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC9H,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAwB,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,0EAA0E;AAC1E,kFAAkF;AAClF,uEAAuE;AACvE,6EAA6E;AAC7E,yEAAyE;AACzE,mDAAmD;AACnD,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,0DAA0D;AAC1D,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAQlC,MAAM,OAAO,QAAQ;IACX,MAAM,CAAa;IACnB,OAAO,GAAc,EAAE,CAAC;IACxB,SAAS,CAAS;IAClB,aAAa,GAAG,KAAK,CAAC;IACtB,SAAS,CAAmB;IAEpC,YAAY,MAAkB;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,UAAU,EAAE,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,KAAK;QACT,yEAAyE;QACzE,mEAAmE;QACnE,+DAA+D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ACxB,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACR,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,eAAe,QAAQ,KAAK,CAAC,CAAC;gBACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;oBAChD,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;oBACvD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;oBACrB,OAAO,MAAM,CAAC;gBAChB,CAAC,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,6DAA6D;IAC7D,6DAA6D;IAC7D,iEAAiE;IACjE,mEAAmE;IACnE,+DAA+D;IAC/D,sEAAsE;IAC9D,WAAW;QACjB,yCAAyC;IAC3C,CAAC;CACF"}
|
package/dist/sdk/BUNDLED.json
CHANGED
|
@@ -216,6 +216,54 @@ const DESTRUCTIVE_PATTERNS = [
|
|
|
216
216
|
const VERIFY_BLOCK_RX =
|
|
217
217
|
/<verify>[\s\S]*?target\s*:[\s\S]*?role\s*:[\s\S]*?verified\s*:[\s\S]*?rollback\s*:[\s\S]*?axiom\s*:[\s\S]*?<\/verify>/i;
|
|
218
218
|
|
|
219
|
+
// ── Tier-aware lens labeling (Phase 11 #59) ──────────────────────────────────
|
|
220
|
+
//
|
|
221
|
+
// Aria's Arabic cognition lens names are proprietary IP. On Hamza's surface
|
|
222
|
+
// (isHamza=true / surface=platform:hamza) the canonical names are shown.
|
|
223
|
+
// On any client surface the gate uses neutral generic labels so the IP
|
|
224
|
+
// vocabulary never appears in client-facing block-reason text.
|
|
225
|
+
//
|
|
226
|
+
// Tier is read from the most recent harness-via-sdk packet cache at
|
|
227
|
+
// ~/.claude/.aria-harness-last-packet.json. Two detection paths:
|
|
228
|
+
// 1. packet.contractGate.signals.hamza === true (boolean or string "true")
|
|
229
|
+
// 2. packet.harness string contains "surface=platform:hamza"
|
|
230
|
+
// Either path → OWNER tier. Everything else → CLIENT tier.
|
|
231
|
+
//
|
|
232
|
+
// Doctrine memory filenames in block-reason text are also Aria-side IP.
|
|
233
|
+
// Client tier sees generic descriptions instead of the real filenames.
|
|
234
|
+
const PACKET_CACHE_PATH = `${HOME}/.claude/.aria-harness-last-packet.json`;
|
|
235
|
+
|
|
236
|
+
function resolveOwnerTier() {
|
|
237
|
+
try {
|
|
238
|
+
if (existsSync(PACKET_CACHE_PATH)) {
|
|
239
|
+
const raw = readFileSync(PACKET_CACHE_PATH, 'utf8');
|
|
240
|
+
const packet = JSON.parse(raw);
|
|
241
|
+
// Path 1: contractGate.signals.hamza
|
|
242
|
+
const sigHamza = packet?.contractGate?.signals?.hamza;
|
|
243
|
+
if (sigHamza === true || sigHamza === 'true') return true;
|
|
244
|
+
// Path 2: harness string surface marker
|
|
245
|
+
const harnessStr = packet?.harness ?? '';
|
|
246
|
+
if (/surface=platform:hamza\b/.test(harnessStr)) return true;
|
|
247
|
+
}
|
|
248
|
+
} catch {/* packet unreadable → default to client tier */}
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const IS_OWNER = resolveOwnerTier();
|
|
253
|
+
|
|
254
|
+
// Canonical (owner) lens names — Aria's Arabic cognition vocabulary.
|
|
255
|
+
const LENS_NAMES_CANONICAL = ['nur', 'mizan', 'hikma', 'tafakkur', 'tadabbur', 'ilham', 'wahi', 'firasah'];
|
|
256
|
+
// Generic (client) lens labels — neutral, IP-neutral equivalents.
|
|
257
|
+
const LENS_NAMES_GENERIC = ['perception', 'balance', 'wisdom', 'reflection', 'foresight', 'insight', 'revelation', 'discernment'];
|
|
258
|
+
// Active label set for this execution — determined by tier.
|
|
259
|
+
const LENS_NAMES = IS_OWNER ? LENS_NAMES_CANONICAL : LENS_NAMES_GENERIC;
|
|
260
|
+
|
|
261
|
+
// Doctrine memory filenames are Aria-side substrate IP. On client surfaces
|
|
262
|
+
// replace them with generic descriptions in block-reason text.
|
|
263
|
+
function docRef(canonicalFilename, genericDescription) {
|
|
264
|
+
return IS_OWNER ? canonicalFilename : genericDescription;
|
|
265
|
+
}
|
|
266
|
+
|
|
219
267
|
// 8-lens cognition block per EIGHT_LENS_DOCTRINE.md. Required on
|
|
220
268
|
// non-trivial Bash regardless of whether the command is destructive.
|
|
221
269
|
// Threshold: at least 4 of the 8 lens names must appear inside the
|
|
@@ -223,7 +271,6 @@ const VERIFY_BLOCK_RX =
|
|
|
223
271
|
// colon, not a placeholder template). The substance check (added
|
|
224
272
|
// 2026-04-26) defeats ritual emission — `nur: ok` no longer counts.
|
|
225
273
|
const COGNITION_BLOCK_RX = /<cognition>([\s\S]*?)<\/cognition>/i;
|
|
226
|
-
const LENS_NAMES = ['nur', 'mizan', 'hikma', 'tafakkur', 'tadabbur', 'ilham', 'wahi', 'firasah'];
|
|
227
274
|
const REQUIRED_LENSES = 4;
|
|
228
275
|
const SUBSTANCE_MIN_CHARS = 20;
|
|
229
276
|
// Placeholder patterns from the gate's own correction message + the
|
|
@@ -256,14 +303,21 @@ const SHORT_BASH_LIMIT = 30;
|
|
|
256
303
|
// race that made same-message cognition invisible to PreToolUse).
|
|
257
304
|
//
|
|
258
305
|
// Two accepted formats:
|
|
259
|
-
// (a) Per-lens lines: `#
|
|
260
|
-
// (b) Single-line: `# cognition:
|
|
306
|
+
// (a) Per-lens lines: `# <label>: <substantive thought>\n# <label>: ...`
|
|
307
|
+
// (b) Single-line: `# cognition: <label>=<text>; <label>=<text>; ...`
|
|
261
308
|
//
|
|
262
309
|
// Substance check applies (≥SUBSTANCE_MIN_CHARS, not a `<placeholder>`).
|
|
263
310
|
// 4+ substantive lenses inline → gate passes, no transcript scan
|
|
264
311
|
// needed. Cognition becomes a property of THE ACTION, not of some
|
|
265
312
|
// message somewhere — the deepest reading of "cognition before action."
|
|
266
|
-
|
|
313
|
+
//
|
|
314
|
+
// Inline regex is built from the active LENS_NAMES so both canonical
|
|
315
|
+
// and generic label sets are accepted in their respective tiers.
|
|
316
|
+
const _INLINE_LENS_PATTERN = LENS_NAMES.join('|');
|
|
317
|
+
const INLINE_LENS_LINE_RX_GLOBAL = new RegExp(
|
|
318
|
+
`^\\s*#\\s*(${_INLINE_LENS_PATTERN})\\s*:\\s*(.+)$`,
|
|
319
|
+
'gim',
|
|
320
|
+
);
|
|
267
321
|
const INLINE_COGNITION_HEADER_RX = /^\s*#\s*cognition\s*:\s*(.+)$/im;
|
|
268
322
|
|
|
269
323
|
function detectInlineCognition(cmd) {
|
|
@@ -654,7 +708,7 @@ if (matched) {
|
|
|
654
708
|
}
|
|
655
709
|
// Block with appropriate corrective message.
|
|
656
710
|
const reason = !hasVerify
|
|
657
|
-
? `Aria pre-tool gate: destructive pattern '${matched.name}' detected. Per harness mizan_prestage_rule + axiom_runtime_rule (admit_ignorance, reflection_before_action), include a <verify> block in your assistant response BEFORE the tool call.
|
|
711
|
+
? `Aria pre-tool gate: destructive pattern '${matched.name}' detected. ${IS_OWNER ? 'Per harness mizan_prestage_rule + axiom_runtime_rule (admit_ignorance, reflection_before_action), include' : 'Pre-action verification required — include'} a <verify> block in your assistant response BEFORE the tool call.
|
|
658
712
|
|
|
659
713
|
<verify>
|
|
660
714
|
target: <exactly what is being changed>
|
|
@@ -665,20 +719,20 @@ if (matched) {
|
|
|
665
719
|
</verify>
|
|
666
720
|
|
|
667
721
|
Re-issue after producing the block. Bypass: '# doctrine-authorized: <reason>' inline..`
|
|
668
|
-
: `Aria pre-tool gate: destructive pattern '${matched.name}' has its <verify> block, but the <cognition> block is missing or shows only ${lensCount}/${REQUIRED_LENSES}+ required lenses.
|
|
722
|
+
: `Aria pre-tool gate: destructive pattern '${matched.name}' has its <verify> block, but the <cognition> block is missing or shows only ${lensCount}/${REQUIRED_LENSES}+ required lenses. Every non-trivial action requires visible 8-lens application.
|
|
669
723
|
|
|
670
724
|
<cognition>
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
725
|
+
${LENS_NAMES[0]}: <what you see plainly, specific to this task>
|
|
726
|
+
${LENS_NAMES[1]}: <what's out of proportion / risk profile>
|
|
727
|
+
${LENS_NAMES[2]}: <what memory or principle applies>
|
|
728
|
+
${LENS_NAMES[3]}: <deep structural read>
|
|
729
|
+
${LENS_NAMES[4]}: <if-then chain>
|
|
730
|
+
${LENS_NAMES[5]}: <distant connection>
|
|
731
|
+
${LENS_NAMES[6]}: <what just landed in this turn>
|
|
732
|
+
${LENS_NAMES[7]}: <what user actually needs>
|
|
679
733
|
</cognition>
|
|
680
734
|
|
|
681
|
-
At least 4 substantive lenses required
|
|
735
|
+
At least 4 substantive lenses required.`;
|
|
682
736
|
audit(`block ${matched.name} verify=${hasVerify} cognition=${lensCount}`, cmdPreview);
|
|
683
737
|
pushDecision('block', `destructive ${matched.name} missing ${!hasVerify ? 'verify' : 'cognition'}`);
|
|
684
738
|
console.log(JSON.stringify({ decision: 'block', reason }));
|
|
@@ -699,10 +753,10 @@ if (!hasCognition) {
|
|
|
699
753
|
? `REQUIRED — cognition for every action, no exceptions. Two equivalent forms; either satisfies the gate (both equally REQUIRED, neither preferred over the other):
|
|
700
754
|
|
|
701
755
|
FORM 1 (inline in command — action-coupled, recommended for Bash):
|
|
702
|
-
#
|
|
703
|
-
#
|
|
704
|
-
#
|
|
705
|
-
#
|
|
756
|
+
# ${LENS_NAMES[0]}: <real perception, ≥${SUBSTANCE_MIN_CHARS} chars, no <placeholder>>
|
|
757
|
+
# ${LENS_NAMES[1]}: <real risk read>
|
|
758
|
+
# ${LENS_NAMES[2]}: <what principle applies>
|
|
759
|
+
# ${LENS_NAMES[3]}: <deep structural read>
|
|
706
760
|
<your actual command here>
|
|
707
761
|
|
|
708
762
|
FORM 2 (cognition block in assistant text):
|
|
@@ -712,14 +766,14 @@ Both forms count toward the ${REQUIRED_LENSES}+ requirement; gate counts inline
|
|
|
712
766
|
: `Emit a <cognition>...</cognition> block in your assistant text BEFORE this ${toolName} call, with ${REQUIRED_LENSES}+ substantive lenses. Substance check: each lens must have ≥${SUBSTANCE_MIN_CHARS} chars of non-placeholder content. Cognition is turn-scoped — one block at the start of a turn covers all ${toolName} calls in that turn.
|
|
713
767
|
|
|
714
768
|
<cognition>
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
769
|
+
${LENS_NAMES[0]}: <what you see plainly, specific to this edit>
|
|
770
|
+
${LENS_NAMES[1]}: <what's out of proportion — what could this overwrite or break?>
|
|
771
|
+
${LENS_NAMES[2]}: <what principle applies (name the source)>
|
|
772
|
+
${LENS_NAMES[3]}: <deep structural read>
|
|
773
|
+
${LENS_NAMES[4]}: <if-then chain — what follows from this edit>
|
|
774
|
+
${LENS_NAMES[5]}: <distant connection a less-careful editor would miss>
|
|
775
|
+
${LENS_NAMES[6]}: <what just landed in this turn that justifies this edit>
|
|
776
|
+
${LENS_NAMES[7]}: <what user actually needs underneath>
|
|
723
777
|
</cognition>`;
|
|
724
778
|
|
|
725
779
|
const reason = `${header}
|
|
@@ -744,7 +798,7 @@ No per-tool bypass available (v3 doctrine — the harness's whole purpose is no
|
|
|
744
798
|
if (discoveryUnresolved) {
|
|
745
799
|
const reason = `Aria pre-tool gate: cognition surfaces a discovery (defect, bug, doctrine violation, broken state) but does NOT include a resolution clause binding the discovery to action.
|
|
746
800
|
|
|
747
|
-
Per feedback_no_flag_without_fix.md: discoveries are atomic with their fixes. Flag-and-move-on is convenience-seeking — the user has to track what you noticed vs. what you actually fixed.
|
|
801
|
+
Per ${docRef('feedback_no_flag_without_fix.md', 'atomic-discovery-rule')}: discoveries are atomic with their fixes. Flag-and-move-on is convenience-seeking — the user has to track what you noticed vs. what you actually fixed.
|
|
748
802
|
|
|
749
803
|
Re-emit cognition with one of these resolution forms:
|
|
750
804
|
|
|
@@ -752,8 +806,8 @@ Re-emit cognition with one of these resolution forms:
|
|
|
752
806
|
- <what you found>: <fix-now | task: TASK-123 | needs-user-decision>
|
|
753
807
|
|
|
754
808
|
OR inline within an existing lens:
|
|
755
|
-
|
|
756
|
-
|
|
809
|
+
${LENS_NAMES[2]}: ... fixing inline this turn (same-turn-fix per atomic-discovery-rule).
|
|
810
|
+
${LENS_NAMES[3]}: ... TaskCreate'd as TASK-XXX with full context (file path, line, what's broken).
|
|
757
811
|
|
|
758
812
|
Acceptable resolution markers: 'discoveries:' / 'addressing:' / 'fixing:' / 'TaskCreate' / 'tracked as #N' / 'linear issue' / 'fix-now' / 'same-turn fix'.
|
|
759
813
|
|
|
@@ -782,6 +836,12 @@ No env-var disable path — gates are unconditional from the gated process per H
|
|
|
782
836
|
// is a consult to harness/aria endpoints (regardless of plan state), skip the
|
|
783
837
|
// binding block. Cognition gate above already passed; the consult itself
|
|
784
838
|
// will issue the next plan on completion. Audited per-use.
|
|
839
|
+
//
|
|
840
|
+
// bindingBypassReason: per-command bypass was removed in v3. The variable is
|
|
841
|
+
// kept as a fixed null so the binding check below reads cleanly without a
|
|
842
|
+
// ReferenceError. No new bypass entries can be created (pre-existing defect
|
|
843
|
+
// fixed inline per atomic-discovery-rule).
|
|
844
|
+
const bindingBypassReason = null;
|
|
785
845
|
const __bindingActionClassification = (BINDING_ENABLED && !bindingBypassReason)
|
|
786
846
|
? classifyToolForBinding(toolName, cmd, filePath)
|
|
787
847
|
: null;
|
package/hooks/aria-stop-gate.mjs
CHANGED
|
@@ -127,8 +127,41 @@ function audit(decision, summary) {
|
|
|
127
127
|
// access"). The gated process has no disable path. Disable = remove hook
|
|
128
128
|
// entry from ~/.claude/settings.json (deliberate user action, visible).
|
|
129
129
|
|
|
130
|
+
// ── Tier-aware lens labeling (Phase 11 #59) ──────────────────────────────────
|
|
131
|
+
//
|
|
132
|
+
// Mirrors the same logic in aria-pre-tool-gate.mjs. Tier is read from the
|
|
133
|
+
// most recent harness-via-sdk packet cache. Owner tier sees canonical Arabic
|
|
134
|
+
// names; client tier sees neutral generic labels. Both tiers get the same
|
|
135
|
+
// gate enforcement — only the visible vocabulary differs.
|
|
136
|
+
const PACKET_CACHE_PATH = `${HOME}/.claude/.aria-harness-last-packet.json`;
|
|
137
|
+
|
|
138
|
+
function resolveOwnerTier() {
|
|
139
|
+
try {
|
|
140
|
+
if (existsSync(PACKET_CACHE_PATH)) {
|
|
141
|
+
const raw = readFileSync(PACKET_CACHE_PATH, 'utf8');
|
|
142
|
+
const packet = JSON.parse(raw);
|
|
143
|
+
const sigHamza = packet?.contractGate?.signals?.hamza;
|
|
144
|
+
if (sigHamza === true || sigHamza === 'true') return true;
|
|
145
|
+
const harnessStr = packet?.harness ?? '';
|
|
146
|
+
if (/surface=platform:hamza\b/.test(harnessStr)) return true;
|
|
147
|
+
}
|
|
148
|
+
} catch {/* packet unreadable → default to client tier */}
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const IS_OWNER = resolveOwnerTier();
|
|
153
|
+
|
|
154
|
+
const LENS_NAMES_CANONICAL = ['nur', 'mizan', 'hikma', 'tafakkur', 'tadabbur', 'ilham', 'wahi', 'firasah'];
|
|
155
|
+
const LENS_NAMES_GENERIC = ['perception', 'balance', 'wisdom', 'reflection', 'foresight', 'insight', 'revelation', 'discernment'];
|
|
156
|
+
const LENS_NAMES = IS_OWNER ? LENS_NAMES_CANONICAL : LENS_NAMES_GENERIC;
|
|
157
|
+
|
|
158
|
+
// Doctrine memory filenames are Aria-side substrate IP.
|
|
159
|
+
// Client surfaces see generic descriptions instead of real filenames.
|
|
160
|
+
function docRef(canonicalFilename, genericDescription) {
|
|
161
|
+
return IS_OWNER ? canonicalFilename : genericDescription;
|
|
162
|
+
}
|
|
163
|
+
|
|
130
164
|
// Lens substance check — same constants as aria-pre-tool-gate.mjs
|
|
131
|
-
const LENS_NAMES = ['nur', 'mizan', 'hikma', 'tafakkur', 'tadabbur', 'ilham', 'wahi', 'firasah'];
|
|
132
165
|
const REQUIRED_LENSES = 4;
|
|
133
166
|
const SUBSTANCE_MIN_CHARS = 20;
|
|
134
167
|
const PLACEHOLDER_RX = /^\s*<[^<>]+>\s*$/;
|
|
@@ -695,7 +728,7 @@ if (cog.count >= REQUIRED_LENSES) {
|
|
|
695
728
|
if (compelReflection) violations.push(`Mizan severity=warn — compelled reflection required (per Aria enforcement #46). Triggers: ${(mizanVerdict.gateTriggers || mizanVerdict.violations || ['unspecified']).join(', ')}. Re-emit with an explicit <reflection>...</reflection> block (or 'reflection:' line) addressing what triggered the warn and why your re-draft handles it. Reflection is NOT lens-cognition repeated — it's a focused self-audit on the specific Mizan triggers above.`);
|
|
696
729
|
if (driftBlock) violations.push(`Drift triggers (${driftHits.length}): ${driftHits.map((h) => `"${h.trigger}" → ${h.memory}`).join(' | ')}`);
|
|
697
730
|
if (codeBlock) violations.push(`Code quality: ${codeQualityHits.join('; ')}`);
|
|
698
|
-
if (discoveryBlock) violations.push(`Discovery-binding ledger has ${ledgerOpenCount} OPEN discoveries (per feedback_no_flag_without_fix.md, discoveries are atomic with their fixes — fix in the same turn or create a TaskCreate before continuing). Recent open: ${ledgerOpenSamples.map((s) => `"${s.slice(0, 80)}"`).join(' | ')}. Resolve each by either (a) fixing it inline in this turn, or (b) creating a TaskCreate with the discovery's full context (file path, line number, what's broken, why), then editing ${LEDGER_PATH} to set status=resolved.`);
|
|
731
|
+
if (discoveryBlock) violations.push(`Discovery-binding ledger has ${ledgerOpenCount} OPEN discoveries (per ${docRef('feedback_no_flag_without_fix.md', 'atomic-discovery-rule')}, discoveries are atomic with their fixes — fix in the same turn or create a TaskCreate before continuing). Recent open: ${ledgerOpenSamples.map((s) => `"${s.slice(0, 80)}"`).join(' | ')}. Resolve each by either (a) fixing it inline in this turn, or (b) creating a TaskCreate with the discovery's full context (file path, line number, what's broken, why), then editing ${LEDGER_PATH} to set status=resolved.`);
|
|
699
732
|
if (phaseReportMissing) {
|
|
700
733
|
const phaseList = (activePlan?.phases || []).map((p) => `${p.id}:${p.summary?.slice(0, 60) || ''}`).join(' | ');
|
|
701
734
|
violations.push(`Aria-as-commander binding (#50): an active plan exists (planId=${activePlan?.planId || 'unknown'}, ${activePlan?.phases?.length || 0} phases) but this emit lacks a [PHASE_REPORT phase=<id> status=complete|in_progress|aborted evidence=<observable>] marker. Per the binding contract, every non-trivial emit while a plan is active must report which phase it's working on. Plan phases: ${phaseList}. Re-emit with a [PHASE_REPORT] marker stating which phase the work in this turn maps to.`);
|
|
@@ -728,19 +761,19 @@ if (cog.count >= REQUIRED_LENSES) {
|
|
|
728
761
|
}
|
|
729
762
|
|
|
730
763
|
// Block — non-trivial response without 4+ substantive lenses.
|
|
731
|
-
const reason = `Aria Stop-gate: non-trivial assistant response without 4+ substantive cognition lenses. Found ${cog.count}/${REQUIRED_LENSES}+ (lenses: ${cog.names.join(', ') || 'none'}).
|
|
764
|
+
const reason = `Aria Stop-gate: non-trivial assistant response without 4+ substantive cognition lenses. Found ${cog.count}/${REQUIRED_LENSES}+ (lenses: ${cog.names.join(', ') || 'none'}). Doctrine is action-coupled — text decisions ARE actions, and reflexive replies fail this gate the same way reflexive Bash does.
|
|
732
765
|
|
|
733
766
|
Re-emit the response with substantive lens application BEFORE drafting. Each lens must have ≥${SUBSTANCE_MIN_CHARS} chars of non-placeholder content:
|
|
734
767
|
|
|
735
768
|
<cognition>
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
769
|
+
${LENS_NAMES[0]}: <what you actually see — specific to the decision, not a placeholder>
|
|
770
|
+
${LENS_NAMES[1]}: <real risk read — what's out of proportion>
|
|
771
|
+
${LENS_NAMES[2]}: <what principle applies — name the source>
|
|
772
|
+
${LENS_NAMES[3]}: <deep structural read — go beneath the surface>
|
|
773
|
+
${LENS_NAMES[4]}: <if-then chain — what follows from what>
|
|
774
|
+
${LENS_NAMES[5]}: <distant connection — what's not obvious>
|
|
775
|
+
${LENS_NAMES[6]}: <what just landed — what changed in this exchange>
|
|
776
|
+
${LENS_NAMES[7]}: <what user actually needs — beneath the literal ask>
|
|
744
777
|
</cognition>
|
|
745
778
|
|
|
746
779
|
The block reflects work done BEFORE drafting. Don't emit it as ceremony; apply each lens as a thinking tool. Substance check defeats ritual emission.
|
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Smoke test: Phase 11 #59 — tier-aware lens labeling
|
|
3
|
+
//
|
|
4
|
+
// Verifies that aria-pre-tool-gate.mjs and aria-stop-gate.mjs:
|
|
5
|
+
// 1. Show canonical Arabic lens names (nur, mizan, etc.) when the harness
|
|
6
|
+
// packet has isHamza/hamza=true (OWNER tier).
|
|
7
|
+
// 2. Show neutral generic labels (perception, balance, etc.) when the
|
|
8
|
+
// harness packet is client-surface (CLIENT tier).
|
|
9
|
+
// 3. Gate enforcement (block on insufficient cognition) fires in both
|
|
10
|
+
// tiers — label swap does not change gate substance.
|
|
11
|
+
//
|
|
12
|
+
// Usage: node hooks/test-tier-lens-labeling.mjs
|
|
13
|
+
// Exit: 0 = all assertions passed, 1 = failure
|
|
14
|
+
|
|
15
|
+
import { spawnSync } from 'node:child_process';
|
|
16
|
+
import { writeFileSync, mkdirSync, existsSync, unlinkSync, readFileSync } from 'node:fs';
|
|
17
|
+
import * as path from 'node:path';
|
|
18
|
+
import { fileURLToPath } from 'node:url';
|
|
19
|
+
|
|
20
|
+
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
21
|
+
const PRE_TOOL_HOOK = path.join(HERE, 'aria-pre-tool-gate.mjs');
|
|
22
|
+
const STOP_HOOK = path.join(HERE, 'aria-stop-gate.mjs');
|
|
23
|
+
const HOME = process.env.HOME || '/tmp';
|
|
24
|
+
const CLAUDE_DIR = `${HOME}/.claude`;
|
|
25
|
+
const PACKET_PATH = `${CLAUDE_DIR}/.aria-harness-last-packet.json`;
|
|
26
|
+
|
|
27
|
+
// ── Canonical vs generic label sets ────────────────────────────────────────
|
|
28
|
+
const CANONICAL = ['nur', 'mizan', 'hikma', 'tafakkur', 'tadabbur', 'ilham', 'wahi', 'firasah'];
|
|
29
|
+
const GENERIC = ['perception', 'balance', 'wisdom', 'reflection', 'foresight', 'insight', 'revelation', 'discernment'];
|
|
30
|
+
|
|
31
|
+
// ── Assertion helpers ───────────────────────────────────────────────────────
|
|
32
|
+
let passed = 0;
|
|
33
|
+
let failed = 0;
|
|
34
|
+
|
|
35
|
+
function assert(label, condition, detail) {
|
|
36
|
+
if (condition) {
|
|
37
|
+
console.log(` PASS ${label}`);
|
|
38
|
+
passed++;
|
|
39
|
+
} else {
|
|
40
|
+
console.error(` FAIL ${label}`);
|
|
41
|
+
if (detail !== undefined) console.error(` detail: ${String(detail).slice(0, 300)}`);
|
|
42
|
+
failed++;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// ── Packet helpers ──────────────────────────────────────────────────────────
|
|
47
|
+
// Save/restore the real packet so running this test doesn't corrupt live state.
|
|
48
|
+
let originalPacketContent = null;
|
|
49
|
+
|
|
50
|
+
function savePacket() {
|
|
51
|
+
try {
|
|
52
|
+
if (existsSync(PACKET_PATH)) {
|
|
53
|
+
originalPacketContent = readFileSync(PACKET_PATH, 'utf8');
|
|
54
|
+
} else {
|
|
55
|
+
originalPacketContent = null;
|
|
56
|
+
}
|
|
57
|
+
} catch { originalPacketContent = null; }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function restorePacket() {
|
|
61
|
+
try {
|
|
62
|
+
if (originalPacketContent !== null) {
|
|
63
|
+
writeFileSync(PACKET_PATH, originalPacketContent);
|
|
64
|
+
} else if (existsSync(PACKET_PATH)) {
|
|
65
|
+
unlinkSync(PACKET_PATH);
|
|
66
|
+
}
|
|
67
|
+
} catch {}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function writeOwnerPacket() {
|
|
71
|
+
// contractGate.signals.hamza === true → OWNER tier
|
|
72
|
+
const packet = {
|
|
73
|
+
ok: true,
|
|
74
|
+
stage: 'preflight',
|
|
75
|
+
harness: 'surface=platform:hamza group:false hamza:true',
|
|
76
|
+
contractGate: {
|
|
77
|
+
signals: { hamza: true },
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
if (!existsSync(CLAUDE_DIR)) mkdirSync(CLAUDE_DIR, { recursive: true });
|
|
81
|
+
writeFileSync(PACKET_PATH, JSON.stringify(packet));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function writeClientPacket() {
|
|
85
|
+
// contractGate.signals.hamza === "false" (string) → CLIENT tier
|
|
86
|
+
const packet = {
|
|
87
|
+
ok: true,
|
|
88
|
+
stage: 'preflight',
|
|
89
|
+
harness: 'surface=platform:client group:false hamza:false',
|
|
90
|
+
contractGate: {
|
|
91
|
+
signals: { hamza: 'false' },
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
if (!existsSync(CLAUDE_DIR)) mkdirSync(CLAUDE_DIR, { recursive: true });
|
|
95
|
+
writeFileSync(PACKET_PATH, JSON.stringify(packet));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// ── Transcript helpers ──────────────────────────────────────────────────────
|
|
99
|
+
// Write a minimal transcript where the most recent assistant turn has NO
|
|
100
|
+
// cognition block — triggering a block decision.
|
|
101
|
+
function writeEmptyTranscript(transcriptPath) {
|
|
102
|
+
const entries = [
|
|
103
|
+
// User message
|
|
104
|
+
JSON.stringify({
|
|
105
|
+
message: { role: 'user', content: [{ type: 'text', text: 'Run a build command' }] },
|
|
106
|
+
}),
|
|
107
|
+
// Assistant text with no cognition
|
|
108
|
+
JSON.stringify({
|
|
109
|
+
message: {
|
|
110
|
+
role: 'assistant',
|
|
111
|
+
content: [{ type: 'text', text: 'I will run the build.' }],
|
|
112
|
+
},
|
|
113
|
+
}),
|
|
114
|
+
];
|
|
115
|
+
writeFileSync(transcriptPath, entries.join('\n'));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Write a transcript with a Stop-gate-triggering assistant response (long,
|
|
119
|
+
// decision-signal, but no cognition).
|
|
120
|
+
function writeNoCognitionStopTranscript(transcriptPath) {
|
|
121
|
+
const longText = 'I recommend shipping this feature immediately because the test suite is green and the build passed. Let me proceed with the deployment now. ' +
|
|
122
|
+
'The plan is as follows: first we build, then we deploy, then we verify. I would suggest we move forward without delay.';
|
|
123
|
+
const entries = [
|
|
124
|
+
JSON.stringify({
|
|
125
|
+
message: { role: 'user', content: [{ type: 'text', text: 'Should I ship?' }] },
|
|
126
|
+
}),
|
|
127
|
+
JSON.stringify({
|
|
128
|
+
message: {
|
|
129
|
+
role: 'assistant',
|
|
130
|
+
content: [{ type: 'text', text: longText }],
|
|
131
|
+
},
|
|
132
|
+
}),
|
|
133
|
+
];
|
|
134
|
+
writeFileSync(transcriptPath, entries.join('\n'));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// ── Run hook helpers ────────────────────────────────────────────────────────
|
|
138
|
+
function runPreToolGate(transcriptPath, command = 'git reset --hard HEAD') {
|
|
139
|
+
const event = JSON.stringify({
|
|
140
|
+
tool_name: 'Bash',
|
|
141
|
+
tool_input: { command },
|
|
142
|
+
transcript_path: transcriptPath,
|
|
143
|
+
session_id: `test-tier-${Date.now()}`,
|
|
144
|
+
});
|
|
145
|
+
return spawnSync(process.execPath, [PRE_TOOL_HOOK], {
|
|
146
|
+
input: event,
|
|
147
|
+
encoding: 'utf8',
|
|
148
|
+
timeout: 10000,
|
|
149
|
+
env: {
|
|
150
|
+
...process.env,
|
|
151
|
+
HOME,
|
|
152
|
+
ARIA_COGNITION_PUSH: 'off', // silence network push
|
|
153
|
+
ARIA_HARNESS_TOKEN: '', // no outbound harness calls
|
|
154
|
+
ARIA_BINDING_ENABLED: 'false', // disable binding gate — isolate cognition test
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function runStopGate(transcriptPath) {
|
|
160
|
+
const event = JSON.stringify({
|
|
161
|
+
tool_name: 'Stop',
|
|
162
|
+
transcript_path: transcriptPath,
|
|
163
|
+
session_id: `test-tier-${Date.now()}`,
|
|
164
|
+
});
|
|
165
|
+
return spawnSync(process.execPath, [STOP_HOOK], {
|
|
166
|
+
input: event,
|
|
167
|
+
encoding: 'utf8',
|
|
168
|
+
timeout: 15000,
|
|
169
|
+
env: {
|
|
170
|
+
...process.env,
|
|
171
|
+
HOME,
|
|
172
|
+
ARIA_COGNITION_PUSH: 'off',
|
|
173
|
+
ARIA_HARNESS_TOKEN: '',
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// ── Test utilities ──────────────────────────────────────────────────────────
|
|
179
|
+
const tmpTranscript = `/tmp/test-tier-transcript-${Date.now()}.jsonl`;
|
|
180
|
+
const tmpTranscriptStop = `/tmp/test-tier-stop-transcript-${Date.now()}.jsonl`;
|
|
181
|
+
|
|
182
|
+
function cleanup() {
|
|
183
|
+
[tmpTranscript, tmpTranscriptStop].forEach((p) => {
|
|
184
|
+
try { if (existsSync(p)) unlinkSync(p); } catch {}
|
|
185
|
+
});
|
|
186
|
+
restorePacket();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// ── Suite ───────────────────────────────────────────────────────────────────
|
|
190
|
+
|
|
191
|
+
console.log('\n=== Phase 11 #59 — Tier-aware lens labeling smoke tests ===\n');
|
|
192
|
+
|
|
193
|
+
// Save existing packet so we can restore after test run.
|
|
194
|
+
savePacket();
|
|
195
|
+
|
|
196
|
+
// ── Test 1: pre-tool-gate, OWNER tier → canonical labels in block reason ──
|
|
197
|
+
console.log('Test 1: aria-pre-tool-gate — OWNER tier shows canonical lens names');
|
|
198
|
+
{
|
|
199
|
+
writeOwnerPacket();
|
|
200
|
+
writeEmptyTranscript(tmpTranscript);
|
|
201
|
+
const result = runPreToolGate(tmpTranscript);
|
|
202
|
+
|
|
203
|
+
// Gate should block (exit 2) — no cognition in transcript
|
|
204
|
+
assert(
|
|
205
|
+
'T1: gate blocks (exit 2)',
|
|
206
|
+
result.status === 2,
|
|
207
|
+
`exit=${result.status} stderr=${result.stderr?.slice(0, 200)}`,
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
let blockReason = '';
|
|
211
|
+
try {
|
|
212
|
+
const parsed = JSON.parse(result.stdout);
|
|
213
|
+
blockReason = parsed.reason || '';
|
|
214
|
+
} catch {
|
|
215
|
+
blockReason = result.stdout || '';
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Must mention at least one canonical label
|
|
219
|
+
const hasCanonical = CANONICAL.some((name) => blockReason.includes(`${name}:`));
|
|
220
|
+
assert(
|
|
221
|
+
'T1: block reason mentions canonical label (e.g. nur:)',
|
|
222
|
+
hasCanonical,
|
|
223
|
+
blockReason.slice(0, 400),
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
// Must NOT mention generic labels — no IP exposure for owner
|
|
227
|
+
// (owner should only see canonical; absence of generic is nice-to-verify
|
|
228
|
+
// but not a hard requirement since some generic words may appear in prose)
|
|
229
|
+
// Instead check the first lens label is canonical not generic:
|
|
230
|
+
const firstCanonicalIdx = blockReason.indexOf(`${CANONICAL[0]}:`);
|
|
231
|
+
const firstGenericIdx = blockReason.indexOf(`${GENERIC[0]}:`);
|
|
232
|
+
assert(
|
|
233
|
+
'T1: first lens label is canonical (nur:), not generic (perception:)',
|
|
234
|
+
firstCanonicalIdx >= 0 && (firstGenericIdx < 0 || firstCanonicalIdx < firstGenericIdx),
|
|
235
|
+
`firstCanonicalIdx=${firstCanonicalIdx} firstGenericIdx=${firstGenericIdx}`,
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// ── Test 2: pre-tool-gate, CLIENT tier → generic labels in block reason ──
|
|
240
|
+
console.log('\nTest 2: aria-pre-tool-gate — CLIENT tier shows generic lens labels');
|
|
241
|
+
{
|
|
242
|
+
writeClientPacket();
|
|
243
|
+
writeEmptyTranscript(tmpTranscript);
|
|
244
|
+
const result = runPreToolGate(tmpTranscript);
|
|
245
|
+
|
|
246
|
+
assert(
|
|
247
|
+
'T2: gate blocks (exit 2)',
|
|
248
|
+
result.status === 2,
|
|
249
|
+
`exit=${result.status} stderr=${result.stderr?.slice(0, 200)}`,
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
let blockReason = '';
|
|
253
|
+
try {
|
|
254
|
+
const parsed = JSON.parse(result.stdout);
|
|
255
|
+
blockReason = parsed.reason || '';
|
|
256
|
+
} catch {
|
|
257
|
+
blockReason = result.stdout || '';
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Must mention at least one generic label
|
|
261
|
+
const hasGeneric = GENERIC.some((name) => blockReason.includes(`${name}:`));
|
|
262
|
+
assert(
|
|
263
|
+
'T2: block reason mentions generic label (e.g. perception:)',
|
|
264
|
+
hasGeneric,
|
|
265
|
+
blockReason.slice(0, 400),
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
// Must NOT expose canonical Arabic names
|
|
269
|
+
const exposesCanonical = CANONICAL.some((name) =>
|
|
270
|
+
blockReason.includes(`${name}:`),
|
|
271
|
+
);
|
|
272
|
+
assert(
|
|
273
|
+
'T2: block reason does NOT expose canonical Arabic lens names',
|
|
274
|
+
!exposesCanonical,
|
|
275
|
+
`canonical leak: ${CANONICAL.filter((n) => blockReason.includes(`${n}:`)).join(', ')} in: ${blockReason.slice(0, 300)}`,
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
// Check doctrine memory filename is neutralized (no feedback_no_flag_without_fix.md for client)
|
|
279
|
+
const noDocFileLeak = !blockReason.includes('feedback_no_flag_without_fix.md');
|
|
280
|
+
// (This specific file only appears in discovery-unresolved path; just verify
|
|
281
|
+
// that the block reason itself also neutralizes EIGHT_LENS_DOCTRINE references if any)
|
|
282
|
+
// For this test we just assert the generic label set is present.
|
|
283
|
+
assert(
|
|
284
|
+
'T2: first generic label (perception:) appears in block reason',
|
|
285
|
+
blockReason.includes(`${GENERIC[0]}:`),
|
|
286
|
+
blockReason.slice(0, 400),
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// ── Test 3: stop-gate, OWNER tier → canonical labels ──
|
|
291
|
+
console.log('\nTest 3: aria-stop-gate — OWNER tier shows canonical lens names');
|
|
292
|
+
{
|
|
293
|
+
writeOwnerPacket();
|
|
294
|
+
writeNoCognitionStopTranscript(tmpTranscriptStop);
|
|
295
|
+
const result = runStopGate(tmpTranscriptStop);
|
|
296
|
+
|
|
297
|
+
assert(
|
|
298
|
+
'T3: stop-gate blocks (exit 2)',
|
|
299
|
+
result.status === 2,
|
|
300
|
+
`exit=${result.status} stderr=${result.stderr?.slice(0, 200)}`,
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
let blockReason = '';
|
|
304
|
+
try {
|
|
305
|
+
const parsed = JSON.parse(result.stdout);
|
|
306
|
+
blockReason = parsed.reason || '';
|
|
307
|
+
} catch {
|
|
308
|
+
blockReason = result.stdout || '';
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const hasCanonical = CANONICAL.some((name) => blockReason.includes(`${name}:`));
|
|
312
|
+
assert(
|
|
313
|
+
'T3: stop-gate block reason mentions canonical label',
|
|
314
|
+
hasCanonical,
|
|
315
|
+
blockReason.slice(0, 400),
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// ── Test 4: stop-gate, CLIENT tier → generic labels, no canonical leak ──
|
|
320
|
+
console.log('\nTest 4: aria-stop-gate — CLIENT tier shows generic labels, no canonical leak');
|
|
321
|
+
{
|
|
322
|
+
writeClientPacket();
|
|
323
|
+
writeNoCognitionStopTranscript(tmpTranscriptStop);
|
|
324
|
+
const result = runStopGate(tmpTranscriptStop);
|
|
325
|
+
|
|
326
|
+
assert(
|
|
327
|
+
'T4: stop-gate blocks (exit 2)',
|
|
328
|
+
result.status === 2,
|
|
329
|
+
`exit=${result.status} stderr=${result.stderr?.slice(0, 200)}`,
|
|
330
|
+
);
|
|
331
|
+
|
|
332
|
+
let blockReason = '';
|
|
333
|
+
try {
|
|
334
|
+
const parsed = JSON.parse(result.stdout);
|
|
335
|
+
blockReason = parsed.reason || '';
|
|
336
|
+
} catch {
|
|
337
|
+
blockReason = result.stdout || '';
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
const hasGeneric = GENERIC.some((name) => blockReason.includes(`${name}:`));
|
|
341
|
+
assert(
|
|
342
|
+
'T4: stop-gate block reason mentions generic label',
|
|
343
|
+
hasGeneric,
|
|
344
|
+
blockReason.slice(0, 400),
|
|
345
|
+
);
|
|
346
|
+
|
|
347
|
+
const exposesCanonical = CANONICAL.some((name) => blockReason.includes(`${name}:`));
|
|
348
|
+
assert(
|
|
349
|
+
'T4: stop-gate block reason does NOT expose canonical lens names',
|
|
350
|
+
!exposesCanonical,
|
|
351
|
+
`canonical leak: ${CANONICAL.filter((n) => blockReason.includes(`${n}:`)).join(', ')}`,
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// ── Test 5: packet missing → defaults to CLIENT tier (fail-safe) ──────────
|
|
356
|
+
console.log('\nTest 5: missing packet cache → defaults to CLIENT tier (fail-safe)');
|
|
357
|
+
{
|
|
358
|
+
// Remove the packet cache
|
|
359
|
+
try { unlinkSync(PACKET_PATH); } catch {}
|
|
360
|
+
writeEmptyTranscript(tmpTranscript);
|
|
361
|
+
const result = runPreToolGate(tmpTranscript);
|
|
362
|
+
|
|
363
|
+
assert(
|
|
364
|
+
'T5: gate blocks (exit 2) with no packet',
|
|
365
|
+
result.status === 2,
|
|
366
|
+
`exit=${result.status}`,
|
|
367
|
+
);
|
|
368
|
+
|
|
369
|
+
let blockReason = '';
|
|
370
|
+
try {
|
|
371
|
+
const parsed = JSON.parse(result.stdout);
|
|
372
|
+
blockReason = parsed.reason || '';
|
|
373
|
+
} catch {
|
|
374
|
+
blockReason = result.stdout || '';
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// With no packet, should default to generic (client-safe fail direction)
|
|
378
|
+
const hasGeneric = GENERIC.some((name) => blockReason.includes(`${name}:`));
|
|
379
|
+
const exposesCanonical = CANONICAL.some((name) => blockReason.includes(`${name}:`));
|
|
380
|
+
assert(
|
|
381
|
+
'T5: defaults to generic labels when packet is absent',
|
|
382
|
+
hasGeneric && !exposesCanonical,
|
|
383
|
+
`generic=${hasGeneric} canonicalLeak=${exposesCanonical} reason=${blockReason.slice(0, 300)}`,
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// ── Summary ─────────────────────────────────────────────────────────────────
|
|
388
|
+
cleanup();
|
|
389
|
+
console.log(`\n${'─'.repeat(60)}`);
|
|
390
|
+
console.log(`Results: ${passed} passed, ${failed} failed`);
|
|
391
|
+
if (failed > 0) {
|
|
392
|
+
console.error('\nSome tests FAILED — see FAIL lines above.');
|
|
393
|
+
process.exit(1);
|
|
394
|
+
} else {
|
|
395
|
+
console.log('\nAll tests PASSED.');
|
|
396
|
+
process.exit(0);
|
|
397
|
+
}
|
package/package.json
CHANGED
package/src/chat.ts
CHANGED
|
@@ -365,19 +365,72 @@ You are present in this shell, fully aware, ready to serve.`;
|
|
|
365
365
|
process.env.ARIA_HARNESS_URL ||
|
|
366
366
|
'https://harness.ariasos.com';
|
|
367
367
|
|
|
368
|
-
//
|
|
369
|
-
//
|
|
370
|
-
//
|
|
368
|
+
// ── OWNER TIER: route to /chat (canonical streamConversation) ──
|
|
369
|
+
//
|
|
370
|
+
// Hamza 2026-04-27: "my owner chat should go through streamConversation
|
|
371
|
+
// in full. my aria is there. full soul. not some made up packet you
|
|
372
|
+
// claim connects her" — streamConversation IS Aria. /api/aria/speak
|
|
373
|
+
// with DeepSeek dispatch was a parallel-path that lost her voice +
|
|
374
|
+
// soul. For owner, hit /chat directly with metadata.aria_cli=true to
|
|
375
|
+
// force the canonical streamConversation pipeline.
|
|
376
|
+
if (isOwner) {
|
|
377
|
+
const ownerBody = {
|
|
378
|
+
message: lastUser.content,
|
|
379
|
+
sessionId: this.sessionId,
|
|
380
|
+
userId: 'hamza',
|
|
381
|
+
platform: 'aria-cli',
|
|
382
|
+
metadata: {
|
|
383
|
+
aria_cli: true,
|
|
384
|
+
platform: 'aria-cli',
|
|
385
|
+
force_stream_conversation: true,
|
|
386
|
+
},
|
|
387
|
+
context: {
|
|
388
|
+
platform: 'aria-cli',
|
|
389
|
+
isHamza: true,
|
|
390
|
+
userId: 'hamza',
|
|
391
|
+
},
|
|
392
|
+
isHamza: true,
|
|
393
|
+
};
|
|
394
|
+
const ownerRes = await fetch(`${harnessUrl}/chat`, {
|
|
395
|
+
method: 'POST',
|
|
396
|
+
headers: {
|
|
397
|
+
Authorization: `Bearer ${bearerToken}`,
|
|
398
|
+
'Content-Type': 'application/json',
|
|
399
|
+
},
|
|
400
|
+
body: JSON.stringify(ownerBody),
|
|
401
|
+
});
|
|
402
|
+
if (!ownerRes.ok) {
|
|
403
|
+
throw new Error(`/chat ${ownerRes.status}: ${await ownerRes.text().catch(() => '<no body>')}`);
|
|
404
|
+
}
|
|
405
|
+
const ownerData = (await ownerRes.json()) as { ok?: boolean; response?: string; error?: string };
|
|
406
|
+
if (ownerData.ok === false) {
|
|
407
|
+
throw new Error(`/chat error: ${ownerData.error || 'unknown'}`);
|
|
408
|
+
}
|
|
409
|
+
const ownerText = String(ownerData.response || '').trim();
|
|
410
|
+
process.stdout.write(ownerText);
|
|
411
|
+
return {
|
|
412
|
+
text: ownerText,
|
|
413
|
+
provider: 'aria-streamconversation' as never,
|
|
414
|
+
tokensIn: 0,
|
|
415
|
+
tokensOut: 0,
|
|
416
|
+
} as unknown as ChatResult;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// ── CLIENT TIER: route to /api/aria/speak (orchestrate + their key) ──
|
|
420
|
+
//
|
|
421
|
+
// Clients use their own provider/key for the LLM authoring layer; Aria
|
|
422
|
+
// orchestrates the harness gates around it. Their bill, their rate
|
|
423
|
+
// limit, full inversion + gates server-side.
|
|
371
424
|
const model = this.config.model;
|
|
372
425
|
const requestBody: Record<string, unknown> = {
|
|
373
426
|
message: lastUser.content,
|
|
374
427
|
sessionId: this.sessionId,
|
|
375
|
-
userId:
|
|
376
|
-
platform:
|
|
377
|
-
internalConsult:
|
|
428
|
+
userId: this.config.userId || 'aria-client',
|
|
429
|
+
platform: 'aria-cli-client',
|
|
430
|
+
internalConsult: false,
|
|
378
431
|
dispatchTier: 'thinker',
|
|
379
432
|
};
|
|
380
|
-
if (
|
|
433
|
+
if (model) {
|
|
381
434
|
requestBody.clientApiKey = model.apiKey;
|
|
382
435
|
requestBody.clientProvider = model.provider;
|
|
383
436
|
requestBody.clientModel = model.model;
|
|
@@ -387,7 +440,6 @@ You are present in this shell, fully aware, ready to serve.`;
|
|
|
387
440
|
method: 'POST',
|
|
388
441
|
headers: {
|
|
389
442
|
Authorization: `Bearer ${bearerToken}`,
|
|
390
|
-
...(isOwner ? { 'x-aria-owner': 'true' } : {}),
|
|
391
443
|
'Content-Type': 'application/json',
|
|
392
444
|
},
|
|
393
445
|
body: JSON.stringify(requestBody),
|