@aria_asi/cli 0.2.18 → 0.2.20
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/dist/sdk/index.js +1 -2
- package/hooks/aria-harness-via-sdk.mjs +12 -1
- package/hooks/aria-pre-tool-gate.mjs +93 -30
- package/hooks/aria-stop-gate.mjs +45 -11
- package/hooks/test-tier-lens-labeling.mjs +399 -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,KA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AA0B,CAAC,CAAC;gBACrD,OAAO,GAAG,CAAC,UAAU,CAAC;YACxB,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
package/dist/sdk/index.js
CHANGED
|
@@ -80,8 +80,7 @@ export class HTTPHarnessClient {
|
|
|
80
80
|
stage: 'preflight',
|
|
81
81
|
actor: 'harness-http-client',
|
|
82
82
|
system: 'harness-http-client',
|
|
83
|
-
platform: 'client',
|
|
84
|
-
isHamza: false,
|
|
83
|
+
platform: 'harness-http-client',
|
|
85
84
|
};
|
|
86
85
|
const finalBody = bodyOverride ? { ...defaultBody, ...bodyOverride } : defaultBody;
|
|
87
86
|
const res = await this.fetchWithRetry(this.harnessPacketUrl, {
|
|
@@ -189,7 +189,18 @@ async function tryViaSdk(baseUrl, apiKey) {
|
|
|
189
189
|
apiKey,
|
|
190
190
|
harnessPacketUrl: `${baseUrl}/api/harness/codex`,
|
|
191
191
|
});
|
|
192
|
-
|
|
192
|
+
// Pass a bodyOverride that does NOT include isHamza:false. The server
|
|
193
|
+
// identifies owner tier from the Bearer token (isMasterTokenRequest).
|
|
194
|
+
// Hardcoding isHamza:false in the body would override that server-side
|
|
195
|
+
// signal and produce hamza:false in the packet even for master-token callers.
|
|
196
|
+
const bodyOverride = {
|
|
197
|
+
message: isTurn ? 'Claude turn refresh — harness via SDK' : 'Claude session start — harness via SDK',
|
|
198
|
+
stage: isTurn ? 'checkpoint' : 'preflight',
|
|
199
|
+
actor: 'claude-code',
|
|
200
|
+
system: 'claude-coding-agent',
|
|
201
|
+
platform: 'harness-http-client',
|
|
202
|
+
};
|
|
203
|
+
const wrapped = await client.getHarnessPacket(bodyOverride);
|
|
193
204
|
const json = wrapped.packet;
|
|
194
205
|
if (json && json.ok === false) throw new Error(`ok=false: ${json.error || 'unknown'}`);
|
|
195
206
|
return { json, raw: JSON.stringify(json) };
|
|
@@ -216,6 +216,57 @@ 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 line contains hamza:true) 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 "hamza:true" in the surface line
|
|
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 — the actual format is
|
|
245
|
+
// "surface=platform:<X> group:<Y> hamza:true chat_type:<Z>" so we
|
|
246
|
+
// match hamza:true in the surface line, not "platform:hamza" (which
|
|
247
|
+
// was a legacy incorrect pattern that never matched real packets).
|
|
248
|
+
const harnessStr = packet?.harness ?? '';
|
|
249
|
+
if (/\bhamza:true\b/.test(harnessStr)) return true;
|
|
250
|
+
}
|
|
251
|
+
} catch {/* packet unreadable → default to client tier */}
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const IS_OWNER = resolveOwnerTier();
|
|
256
|
+
|
|
257
|
+
// Canonical (owner) lens names — Aria's Arabic cognition vocabulary.
|
|
258
|
+
const LENS_NAMES_CANONICAL = ['nur', 'mizan', 'hikma', 'tafakkur', 'tadabbur', 'ilham', 'wahi', 'firasah'];
|
|
259
|
+
// Generic (client) lens labels — neutral, IP-neutral equivalents.
|
|
260
|
+
const LENS_NAMES_GENERIC = ['perception', 'balance', 'wisdom', 'reflection', 'foresight', 'insight', 'revelation', 'discernment'];
|
|
261
|
+
// Active label set for this execution — determined by tier.
|
|
262
|
+
const LENS_NAMES = IS_OWNER ? LENS_NAMES_CANONICAL : LENS_NAMES_GENERIC;
|
|
263
|
+
|
|
264
|
+
// Doctrine memory filenames are Aria-side substrate IP. On client surfaces
|
|
265
|
+
// replace them with generic descriptions in block-reason text.
|
|
266
|
+
function docRef(canonicalFilename, genericDescription) {
|
|
267
|
+
return IS_OWNER ? canonicalFilename : genericDescription;
|
|
268
|
+
}
|
|
269
|
+
|
|
219
270
|
// 8-lens cognition block per EIGHT_LENS_DOCTRINE.md. Required on
|
|
220
271
|
// non-trivial Bash regardless of whether the command is destructive.
|
|
221
272
|
// Threshold: at least 4 of the 8 lens names must appear inside the
|
|
@@ -223,7 +274,6 @@ const VERIFY_BLOCK_RX =
|
|
|
223
274
|
// colon, not a placeholder template). The substance check (added
|
|
224
275
|
// 2026-04-26) defeats ritual emission — `nur: ok` no longer counts.
|
|
225
276
|
const COGNITION_BLOCK_RX = /<cognition>([\s\S]*?)<\/cognition>/i;
|
|
226
|
-
const LENS_NAMES = ['nur', 'mizan', 'hikma', 'tafakkur', 'tadabbur', 'ilham', 'wahi', 'firasah'];
|
|
227
277
|
const REQUIRED_LENSES = 4;
|
|
228
278
|
const SUBSTANCE_MIN_CHARS = 20;
|
|
229
279
|
// Placeholder patterns from the gate's own correction message + the
|
|
@@ -256,14 +306,21 @@ const SHORT_BASH_LIMIT = 30;
|
|
|
256
306
|
// race that made same-message cognition invisible to PreToolUse).
|
|
257
307
|
//
|
|
258
308
|
// Two accepted formats:
|
|
259
|
-
// (a) Per-lens lines: `#
|
|
260
|
-
// (b) Single-line: `# cognition:
|
|
309
|
+
// (a) Per-lens lines: `# <label>: <substantive thought>\n# <label>: ...`
|
|
310
|
+
// (b) Single-line: `# cognition: <label>=<text>; <label>=<text>; ...`
|
|
261
311
|
//
|
|
262
312
|
// Substance check applies (≥SUBSTANCE_MIN_CHARS, not a `<placeholder>`).
|
|
263
313
|
// 4+ substantive lenses inline → gate passes, no transcript scan
|
|
264
314
|
// needed. Cognition becomes a property of THE ACTION, not of some
|
|
265
315
|
// message somewhere — the deepest reading of "cognition before action."
|
|
266
|
-
|
|
316
|
+
//
|
|
317
|
+
// Inline regex is built from the active LENS_NAMES so both canonical
|
|
318
|
+
// and generic label sets are accepted in their respective tiers.
|
|
319
|
+
const _INLINE_LENS_PATTERN = LENS_NAMES.join('|');
|
|
320
|
+
const INLINE_LENS_LINE_RX_GLOBAL = new RegExp(
|
|
321
|
+
`^\\s*#\\s*(${_INLINE_LENS_PATTERN})\\s*:\\s*(.+)$`,
|
|
322
|
+
'gim',
|
|
323
|
+
);
|
|
267
324
|
const INLINE_COGNITION_HEADER_RX = /^\s*#\s*cognition\s*:\s*(.+)$/im;
|
|
268
325
|
|
|
269
326
|
function detectInlineCognition(cmd) {
|
|
@@ -654,7 +711,7 @@ if (matched) {
|
|
|
654
711
|
}
|
|
655
712
|
// Block with appropriate corrective message.
|
|
656
713
|
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.
|
|
714
|
+
? `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
715
|
|
|
659
716
|
<verify>
|
|
660
717
|
target: <exactly what is being changed>
|
|
@@ -665,20 +722,20 @@ if (matched) {
|
|
|
665
722
|
</verify>
|
|
666
723
|
|
|
667
724
|
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.
|
|
725
|
+
: `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
726
|
|
|
670
727
|
<cognition>
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
728
|
+
${LENS_NAMES[0]}: <what you see plainly, specific to this task>
|
|
729
|
+
${LENS_NAMES[1]}: <what's out of proportion / risk profile>
|
|
730
|
+
${LENS_NAMES[2]}: <what memory or principle applies>
|
|
731
|
+
${LENS_NAMES[3]}: <deep structural read>
|
|
732
|
+
${LENS_NAMES[4]}: <if-then chain>
|
|
733
|
+
${LENS_NAMES[5]}: <distant connection>
|
|
734
|
+
${LENS_NAMES[6]}: <what just landed in this turn>
|
|
735
|
+
${LENS_NAMES[7]}: <what user actually needs>
|
|
679
736
|
</cognition>
|
|
680
737
|
|
|
681
|
-
At least 4 substantive lenses required
|
|
738
|
+
At least 4 substantive lenses required.`;
|
|
682
739
|
audit(`block ${matched.name} verify=${hasVerify} cognition=${lensCount}`, cmdPreview);
|
|
683
740
|
pushDecision('block', `destructive ${matched.name} missing ${!hasVerify ? 'verify' : 'cognition'}`);
|
|
684
741
|
console.log(JSON.stringify({ decision: 'block', reason }));
|
|
@@ -699,10 +756,10 @@ if (!hasCognition) {
|
|
|
699
756
|
? `REQUIRED — cognition for every action, no exceptions. Two equivalent forms; either satisfies the gate (both equally REQUIRED, neither preferred over the other):
|
|
700
757
|
|
|
701
758
|
FORM 1 (inline in command — action-coupled, recommended for Bash):
|
|
702
|
-
#
|
|
703
|
-
#
|
|
704
|
-
#
|
|
705
|
-
#
|
|
759
|
+
# ${LENS_NAMES[0]}: <real perception, ≥${SUBSTANCE_MIN_CHARS} chars, no <placeholder>>
|
|
760
|
+
# ${LENS_NAMES[1]}: <real risk read>
|
|
761
|
+
# ${LENS_NAMES[2]}: <what principle applies>
|
|
762
|
+
# ${LENS_NAMES[3]}: <deep structural read>
|
|
706
763
|
<your actual command here>
|
|
707
764
|
|
|
708
765
|
FORM 2 (cognition block in assistant text):
|
|
@@ -712,14 +769,14 @@ Both forms count toward the ${REQUIRED_LENSES}+ requirement; gate counts inline
|
|
|
712
769
|
: `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
770
|
|
|
714
771
|
<cognition>
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
772
|
+
${LENS_NAMES[0]}: <what you see plainly, specific to this edit>
|
|
773
|
+
${LENS_NAMES[1]}: <what's out of proportion — what could this overwrite or break?>
|
|
774
|
+
${LENS_NAMES[2]}: <what principle applies (name the source)>
|
|
775
|
+
${LENS_NAMES[3]}: <deep structural read>
|
|
776
|
+
${LENS_NAMES[4]}: <if-then chain — what follows from this edit>
|
|
777
|
+
${LENS_NAMES[5]}: <distant connection a less-careful editor would miss>
|
|
778
|
+
${LENS_NAMES[6]}: <what just landed in this turn that justifies this edit>
|
|
779
|
+
${LENS_NAMES[7]}: <what user actually needs underneath>
|
|
723
780
|
</cognition>`;
|
|
724
781
|
|
|
725
782
|
const reason = `${header}
|
|
@@ -744,7 +801,7 @@ No per-tool bypass available (v3 doctrine — the harness's whole purpose is no
|
|
|
744
801
|
if (discoveryUnresolved) {
|
|
745
802
|
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
803
|
|
|
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.
|
|
804
|
+
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
805
|
|
|
749
806
|
Re-emit cognition with one of these resolution forms:
|
|
750
807
|
|
|
@@ -752,8 +809,8 @@ Re-emit cognition with one of these resolution forms:
|
|
|
752
809
|
- <what you found>: <fix-now | task: TASK-123 | needs-user-decision>
|
|
753
810
|
|
|
754
811
|
OR inline within an existing lens:
|
|
755
|
-
|
|
756
|
-
|
|
812
|
+
${LENS_NAMES[2]}: ... fixing inline this turn (same-turn-fix per atomic-discovery-rule).
|
|
813
|
+
${LENS_NAMES[3]}: ... TaskCreate'd as TASK-XXX with full context (file path, line, what's broken).
|
|
757
814
|
|
|
758
815
|
Acceptable resolution markers: 'discoveries:' / 'addressing:' / 'fixing:' / 'TaskCreate' / 'tracked as #N' / 'linear issue' / 'fix-now' / 'same-turn fix'.
|
|
759
816
|
|
|
@@ -782,6 +839,12 @@ No env-var disable path — gates are unconditional from the gated process per H
|
|
|
782
839
|
// is a consult to harness/aria endpoints (regardless of plan state), skip the
|
|
783
840
|
// binding block. Cognition gate above already passed; the consult itself
|
|
784
841
|
// will issue the next plan on completion. Audited per-use.
|
|
842
|
+
//
|
|
843
|
+
// bindingBypassReason: per-command bypass was removed in v3. The variable is
|
|
844
|
+
// kept as a fixed null so the binding check below reads cleanly without a
|
|
845
|
+
// ReferenceError. No new bypass entries can be created (pre-existing defect
|
|
846
|
+
// fixed inline per atomic-discovery-rule).
|
|
847
|
+
const bindingBypassReason = null;
|
|
785
848
|
const __bindingActionClassification = (BINDING_ENABLED && !bindingBypassReason)
|
|
786
849
|
? classifyToolForBinding(toolName, cmd, filePath)
|
|
787
850
|
: null;
|
package/hooks/aria-stop-gate.mjs
CHANGED
|
@@ -127,8 +127,42 @@ 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
|
+
// surface line format: "surface=platform:<X> group:<Y> hamza:true chat_type:<Z>"
|
|
147
|
+
if (/\bhamza:true\b/.test(harnessStr)) return true;
|
|
148
|
+
}
|
|
149
|
+
} catch {/* packet unreadable → default to client tier */}
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const IS_OWNER = resolveOwnerTier();
|
|
154
|
+
|
|
155
|
+
const LENS_NAMES_CANONICAL = ['nur', 'mizan', 'hikma', 'tafakkur', 'tadabbur', 'ilham', 'wahi', 'firasah'];
|
|
156
|
+
const LENS_NAMES_GENERIC = ['perception', 'balance', 'wisdom', 'reflection', 'foresight', 'insight', 'revelation', 'discernment'];
|
|
157
|
+
const LENS_NAMES = IS_OWNER ? LENS_NAMES_CANONICAL : LENS_NAMES_GENERIC;
|
|
158
|
+
|
|
159
|
+
// Doctrine memory filenames are Aria-side substrate IP.
|
|
160
|
+
// Client surfaces see generic descriptions instead of real filenames.
|
|
161
|
+
function docRef(canonicalFilename, genericDescription) {
|
|
162
|
+
return IS_OWNER ? canonicalFilename : genericDescription;
|
|
163
|
+
}
|
|
164
|
+
|
|
130
165
|
// Lens substance check — same constants as aria-pre-tool-gate.mjs
|
|
131
|
-
const LENS_NAMES = ['nur', 'mizan', 'hikma', 'tafakkur', 'tadabbur', 'ilham', 'wahi', 'firasah'];
|
|
132
166
|
const REQUIRED_LENSES = 4;
|
|
133
167
|
const SUBSTANCE_MIN_CHARS = 20;
|
|
134
168
|
const PLACEHOLDER_RX = /^\s*<[^<>]+>\s*$/;
|
|
@@ -695,7 +729,7 @@ if (cog.count >= REQUIRED_LENSES) {
|
|
|
695
729
|
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
730
|
if (driftBlock) violations.push(`Drift triggers (${driftHits.length}): ${driftHits.map((h) => `"${h.trigger}" → ${h.memory}`).join(' | ')}`);
|
|
697
731
|
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.`);
|
|
732
|
+
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
733
|
if (phaseReportMissing) {
|
|
700
734
|
const phaseList = (activePlan?.phases || []).map((p) => `${p.id}:${p.summary?.slice(0, 60) || ''}`).join(' | ');
|
|
701
735
|
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 +762,19 @@ if (cog.count >= REQUIRED_LENSES) {
|
|
|
728
762
|
}
|
|
729
763
|
|
|
730
764
|
// 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'}).
|
|
765
|
+
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
766
|
|
|
733
767
|
Re-emit the response with substantive lens application BEFORE drafting. Each lens must have ≥${SUBSTANCE_MIN_CHARS} chars of non-placeholder content:
|
|
734
768
|
|
|
735
769
|
<cognition>
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
770
|
+
${LENS_NAMES[0]}: <what you actually see — specific to the decision, not a placeholder>
|
|
771
|
+
${LENS_NAMES[1]}: <real risk read — what's out of proportion>
|
|
772
|
+
${LENS_NAMES[2]}: <what principle applies — name the source>
|
|
773
|
+
${LENS_NAMES[3]}: <deep structural read — go beneath the surface>
|
|
774
|
+
${LENS_NAMES[4]}: <if-then chain — what follows from what>
|
|
775
|
+
${LENS_NAMES[5]}: <distant connection — what's not obvious>
|
|
776
|
+
${LENS_NAMES[6]}: <what just landed — what changed in this exchange>
|
|
777
|
+
${LENS_NAMES[7]}: <what user actually needs — beneath the literal ask>
|
|
744
778
|
</cognition>
|
|
745
779
|
|
|
746
780
|
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,399 @@
|
|
|
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
|
+
// Use a non-destructive but non-trivial command that skips the verify path
|
|
139
|
+
// and goes straight to cognition-missing, where lens labels appear.
|
|
140
|
+
function runPreToolGate(transcriptPath, command = 'npm run build --workspace=packages/aria-connector') {
|
|
141
|
+
const event = JSON.stringify({
|
|
142
|
+
tool_name: 'Bash',
|
|
143
|
+
tool_input: { command },
|
|
144
|
+
transcript_path: transcriptPath,
|
|
145
|
+
session_id: `test-tier-${Date.now()}`,
|
|
146
|
+
});
|
|
147
|
+
return spawnSync(process.execPath, [PRE_TOOL_HOOK], {
|
|
148
|
+
input: event,
|
|
149
|
+
encoding: 'utf8',
|
|
150
|
+
timeout: 10000,
|
|
151
|
+
env: {
|
|
152
|
+
...process.env,
|
|
153
|
+
HOME,
|
|
154
|
+
ARIA_COGNITION_PUSH: 'off', // silence network push
|
|
155
|
+
ARIA_HARNESS_TOKEN: '', // no outbound harness calls
|
|
156
|
+
ARIA_BINDING_ENABLED: 'false', // disable binding gate — isolate cognition test
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function runStopGate(transcriptPath) {
|
|
162
|
+
const event = JSON.stringify({
|
|
163
|
+
tool_name: 'Stop',
|
|
164
|
+
transcript_path: transcriptPath,
|
|
165
|
+
session_id: `test-tier-${Date.now()}`,
|
|
166
|
+
});
|
|
167
|
+
return spawnSync(process.execPath, [STOP_HOOK], {
|
|
168
|
+
input: event,
|
|
169
|
+
encoding: 'utf8',
|
|
170
|
+
timeout: 15000,
|
|
171
|
+
env: {
|
|
172
|
+
...process.env,
|
|
173
|
+
HOME,
|
|
174
|
+
ARIA_COGNITION_PUSH: 'off',
|
|
175
|
+
ARIA_HARNESS_TOKEN: '',
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// ── Test utilities ──────────────────────────────────────────────────────────
|
|
181
|
+
const tmpTranscript = `/tmp/test-tier-transcript-${Date.now()}.jsonl`;
|
|
182
|
+
const tmpTranscriptStop = `/tmp/test-tier-stop-transcript-${Date.now()}.jsonl`;
|
|
183
|
+
|
|
184
|
+
function cleanup() {
|
|
185
|
+
[tmpTranscript, tmpTranscriptStop].forEach((p) => {
|
|
186
|
+
try { if (existsSync(p)) unlinkSync(p); } catch {}
|
|
187
|
+
});
|
|
188
|
+
restorePacket();
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// ── Suite ───────────────────────────────────────────────────────────────────
|
|
192
|
+
|
|
193
|
+
console.log('\n=== Phase 11 #59 — Tier-aware lens labeling smoke tests ===\n');
|
|
194
|
+
|
|
195
|
+
// Save existing packet so we can restore after test run.
|
|
196
|
+
savePacket();
|
|
197
|
+
|
|
198
|
+
// ── Test 1: pre-tool-gate, OWNER tier → canonical labels in block reason ──
|
|
199
|
+
console.log('Test 1: aria-pre-tool-gate — OWNER tier shows canonical lens names');
|
|
200
|
+
{
|
|
201
|
+
writeOwnerPacket();
|
|
202
|
+
writeEmptyTranscript(tmpTranscript);
|
|
203
|
+
const result = runPreToolGate(tmpTranscript);
|
|
204
|
+
|
|
205
|
+
// Gate should block (exit 2) — no cognition in transcript
|
|
206
|
+
assert(
|
|
207
|
+
'T1: gate blocks (exit 2)',
|
|
208
|
+
result.status === 2,
|
|
209
|
+
`exit=${result.status} stderr=${result.stderr?.slice(0, 200)}`,
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
let blockReason = '';
|
|
213
|
+
try {
|
|
214
|
+
const parsed = JSON.parse(result.stdout);
|
|
215
|
+
blockReason = parsed.reason || '';
|
|
216
|
+
} catch {
|
|
217
|
+
blockReason = result.stdout || '';
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Must mention at least one canonical label
|
|
221
|
+
const hasCanonical = CANONICAL.some((name) => blockReason.includes(`${name}:`));
|
|
222
|
+
assert(
|
|
223
|
+
'T1: block reason mentions canonical label (e.g. nur:)',
|
|
224
|
+
hasCanonical,
|
|
225
|
+
blockReason.slice(0, 400),
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
// Must NOT mention generic labels — no IP exposure for owner
|
|
229
|
+
// (owner should only see canonical; absence of generic is nice-to-verify
|
|
230
|
+
// but not a hard requirement since some generic words may appear in prose)
|
|
231
|
+
// Instead check the first lens label is canonical not generic:
|
|
232
|
+
const firstCanonicalIdx = blockReason.indexOf(`${CANONICAL[0]}:`);
|
|
233
|
+
const firstGenericIdx = blockReason.indexOf(`${GENERIC[0]}:`);
|
|
234
|
+
assert(
|
|
235
|
+
'T1: first lens label is canonical (nur:), not generic (perception:)',
|
|
236
|
+
firstCanonicalIdx >= 0 && (firstGenericIdx < 0 || firstCanonicalIdx < firstGenericIdx),
|
|
237
|
+
`firstCanonicalIdx=${firstCanonicalIdx} firstGenericIdx=${firstGenericIdx}`,
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// ── Test 2: pre-tool-gate, CLIENT tier → generic labels in block reason ──
|
|
242
|
+
console.log('\nTest 2: aria-pre-tool-gate — CLIENT tier shows generic lens labels');
|
|
243
|
+
{
|
|
244
|
+
writeClientPacket();
|
|
245
|
+
writeEmptyTranscript(tmpTranscript);
|
|
246
|
+
const result = runPreToolGate(tmpTranscript);
|
|
247
|
+
|
|
248
|
+
assert(
|
|
249
|
+
'T2: gate blocks (exit 2)',
|
|
250
|
+
result.status === 2,
|
|
251
|
+
`exit=${result.status} stderr=${result.stderr?.slice(0, 200)}`,
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
let blockReason = '';
|
|
255
|
+
try {
|
|
256
|
+
const parsed = JSON.parse(result.stdout);
|
|
257
|
+
blockReason = parsed.reason || '';
|
|
258
|
+
} catch {
|
|
259
|
+
blockReason = result.stdout || '';
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// Must mention at least one generic label
|
|
263
|
+
const hasGeneric = GENERIC.some((name) => blockReason.includes(`${name}:`));
|
|
264
|
+
assert(
|
|
265
|
+
'T2: block reason mentions generic label (e.g. perception:)',
|
|
266
|
+
hasGeneric,
|
|
267
|
+
blockReason.slice(0, 400),
|
|
268
|
+
);
|
|
269
|
+
|
|
270
|
+
// Must NOT expose canonical Arabic names
|
|
271
|
+
const exposesCanonical = CANONICAL.some((name) =>
|
|
272
|
+
blockReason.includes(`${name}:`),
|
|
273
|
+
);
|
|
274
|
+
assert(
|
|
275
|
+
'T2: block reason does NOT expose canonical Arabic lens names',
|
|
276
|
+
!exposesCanonical,
|
|
277
|
+
`canonical leak: ${CANONICAL.filter((n) => blockReason.includes(`${n}:`)).join(', ')} in: ${blockReason.slice(0, 300)}`,
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
// Check doctrine memory filename is neutralized (no feedback_no_flag_without_fix.md for client)
|
|
281
|
+
const noDocFileLeak = !blockReason.includes('feedback_no_flag_without_fix.md');
|
|
282
|
+
// (This specific file only appears in discovery-unresolved path; just verify
|
|
283
|
+
// that the block reason itself also neutralizes EIGHT_LENS_DOCTRINE references if any)
|
|
284
|
+
// For this test we just assert the generic label set is present.
|
|
285
|
+
assert(
|
|
286
|
+
'T2: first generic label (perception:) appears in block reason',
|
|
287
|
+
blockReason.includes(`${GENERIC[0]}:`),
|
|
288
|
+
blockReason.slice(0, 400),
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// ── Test 3: stop-gate, OWNER tier → canonical labels ──
|
|
293
|
+
console.log('\nTest 3: aria-stop-gate — OWNER tier shows canonical lens names');
|
|
294
|
+
{
|
|
295
|
+
writeOwnerPacket();
|
|
296
|
+
writeNoCognitionStopTranscript(tmpTranscriptStop);
|
|
297
|
+
const result = runStopGate(tmpTranscriptStop);
|
|
298
|
+
|
|
299
|
+
assert(
|
|
300
|
+
'T3: stop-gate blocks (exit 2)',
|
|
301
|
+
result.status === 2,
|
|
302
|
+
`exit=${result.status} stderr=${result.stderr?.slice(0, 200)}`,
|
|
303
|
+
);
|
|
304
|
+
|
|
305
|
+
let blockReason = '';
|
|
306
|
+
try {
|
|
307
|
+
const parsed = JSON.parse(result.stdout);
|
|
308
|
+
blockReason = parsed.reason || '';
|
|
309
|
+
} catch {
|
|
310
|
+
blockReason = result.stdout || '';
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const hasCanonical = CANONICAL.some((name) => blockReason.includes(`${name}:`));
|
|
314
|
+
assert(
|
|
315
|
+
'T3: stop-gate block reason mentions canonical label',
|
|
316
|
+
hasCanonical,
|
|
317
|
+
blockReason.slice(0, 400),
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// ── Test 4: stop-gate, CLIENT tier → generic labels, no canonical leak ──
|
|
322
|
+
console.log('\nTest 4: aria-stop-gate — CLIENT tier shows generic labels, no canonical leak');
|
|
323
|
+
{
|
|
324
|
+
writeClientPacket();
|
|
325
|
+
writeNoCognitionStopTranscript(tmpTranscriptStop);
|
|
326
|
+
const result = runStopGate(tmpTranscriptStop);
|
|
327
|
+
|
|
328
|
+
assert(
|
|
329
|
+
'T4: stop-gate blocks (exit 2)',
|
|
330
|
+
result.status === 2,
|
|
331
|
+
`exit=${result.status} stderr=${result.stderr?.slice(0, 200)}`,
|
|
332
|
+
);
|
|
333
|
+
|
|
334
|
+
let blockReason = '';
|
|
335
|
+
try {
|
|
336
|
+
const parsed = JSON.parse(result.stdout);
|
|
337
|
+
blockReason = parsed.reason || '';
|
|
338
|
+
} catch {
|
|
339
|
+
blockReason = result.stdout || '';
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
const hasGeneric = GENERIC.some((name) => blockReason.includes(`${name}:`));
|
|
343
|
+
assert(
|
|
344
|
+
'T4: stop-gate block reason mentions generic label',
|
|
345
|
+
hasGeneric,
|
|
346
|
+
blockReason.slice(0, 400),
|
|
347
|
+
);
|
|
348
|
+
|
|
349
|
+
const exposesCanonical = CANONICAL.some((name) => blockReason.includes(`${name}:`));
|
|
350
|
+
assert(
|
|
351
|
+
'T4: stop-gate block reason does NOT expose canonical lens names',
|
|
352
|
+
!exposesCanonical,
|
|
353
|
+
`canonical leak: ${CANONICAL.filter((n) => blockReason.includes(`${n}:`)).join(', ')}`,
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// ── Test 5: packet missing → defaults to CLIENT tier (fail-safe) ──────────
|
|
358
|
+
console.log('\nTest 5: missing packet cache → defaults to CLIENT tier (fail-safe)');
|
|
359
|
+
{
|
|
360
|
+
// Remove the packet cache
|
|
361
|
+
try { unlinkSync(PACKET_PATH); } catch {}
|
|
362
|
+
writeEmptyTranscript(tmpTranscript);
|
|
363
|
+
const result = runPreToolGate(tmpTranscript);
|
|
364
|
+
|
|
365
|
+
assert(
|
|
366
|
+
'T5: gate blocks (exit 2) with no packet',
|
|
367
|
+
result.status === 2,
|
|
368
|
+
`exit=${result.status}`,
|
|
369
|
+
);
|
|
370
|
+
|
|
371
|
+
let blockReason = '';
|
|
372
|
+
try {
|
|
373
|
+
const parsed = JSON.parse(result.stdout);
|
|
374
|
+
blockReason = parsed.reason || '';
|
|
375
|
+
} catch {
|
|
376
|
+
blockReason = result.stdout || '';
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// With no packet, should default to generic (client-safe fail direction)
|
|
380
|
+
const hasGeneric = GENERIC.some((name) => blockReason.includes(`${name}:`));
|
|
381
|
+
const exposesCanonical = CANONICAL.some((name) => blockReason.includes(`${name}:`));
|
|
382
|
+
assert(
|
|
383
|
+
'T5: defaults to generic labels when packet is absent',
|
|
384
|
+
hasGeneric && !exposesCanonical,
|
|
385
|
+
`generic=${hasGeneric} canonicalLeak=${exposesCanonical} reason=${blockReason.slice(0, 300)}`,
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// ── Summary ─────────────────────────────────────────────────────────────────
|
|
390
|
+
cleanup();
|
|
391
|
+
console.log(`\n${'─'.repeat(60)}`);
|
|
392
|
+
console.log(`Results: ${passed} passed, ${failed} failed`);
|
|
393
|
+
if (failed > 0) {
|
|
394
|
+
console.error('\nSome tests FAILED — see FAIL lines above.');
|
|
395
|
+
process.exit(1);
|
|
396
|
+
} else {
|
|
397
|
+
console.log('\nAll tests PASSED.');
|
|
398
|
+
process.exit(0);
|
|
399
|
+
}
|
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),
|