@aria_asi/cli 0.2.25 → 0.2.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLIENT-ONBOARDING.md +282 -0
- package/bin/aria.js +1140 -14
- package/dist/aria-connector/src/auth-commands.d.ts +1 -0
- package/dist/aria-connector/src/auth-commands.d.ts.map +1 -1
- package/dist/aria-connector/src/auth-commands.js +89 -41
- package/dist/aria-connector/src/auth-commands.js.map +1 -1
- package/dist/aria-connector/src/chat.d.ts +3 -0
- package/dist/aria-connector/src/chat.d.ts.map +1 -1
- package/dist/aria-connector/src/chat.js +146 -8
- package/dist/aria-connector/src/chat.js.map +1 -1
- package/dist/aria-connector/src/codebase-scanner.d.ts +2 -2
- package/dist/aria-connector/src/codebase-scanner.d.ts.map +1 -1
- package/dist/aria-connector/src/codebase-scanner.js +1 -1
- package/dist/aria-connector/src/codebase-scanner.js.map +1 -1
- package/dist/aria-connector/src/config.d.ts +12 -0
- package/dist/aria-connector/src/config.d.ts.map +1 -1
- package/dist/aria-connector/src/config.js +2 -0
- package/dist/aria-connector/src/config.js.map +1 -1
- package/dist/aria-connector/src/connectors/claude-code.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/claude-code.js +111 -21
- package/dist/aria-connector/src/connectors/claude-code.js.map +1 -1
- package/dist/aria-connector/src/connectors/codebase-awareness.d.ts +37 -0
- package/dist/aria-connector/src/connectors/codebase-awareness.d.ts.map +1 -0
- package/dist/aria-connector/src/connectors/codebase-awareness.js +335 -0
- package/dist/aria-connector/src/connectors/codebase-awareness.js.map +1 -0
- package/dist/aria-connector/src/connectors/codex.d.ts +3 -0
- package/dist/aria-connector/src/connectors/codex.d.ts.map +1 -0
- package/dist/aria-connector/src/connectors/codex.js +248 -0
- package/dist/aria-connector/src/connectors/codex.js.map +1 -0
- package/dist/aria-connector/src/connectors/cognitive-skills.d.ts +2 -0
- package/dist/aria-connector/src/connectors/cognitive-skills.d.ts.map +1 -0
- package/dist/aria-connector/src/connectors/cognitive-skills.js +47 -0
- package/dist/aria-connector/src/connectors/cognitive-skills.js.map +1 -0
- package/dist/aria-connector/src/connectors/opencode.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/opencode.js +90 -4
- package/dist/aria-connector/src/connectors/opencode.js.map +1 -1
- package/dist/aria-connector/src/connectors/repo-git-hooks.d.ts +3 -0
- package/dist/aria-connector/src/connectors/repo-git-hooks.d.ts.map +1 -0
- package/dist/aria-connector/src/connectors/repo-git-hooks.js +87 -0
- package/dist/aria-connector/src/connectors/repo-git-hooks.js.map +1 -0
- package/dist/aria-connector/src/connectors/repo-guard.d.ts +19 -0
- package/dist/aria-connector/src/connectors/repo-guard.d.ts.map +1 -0
- package/dist/aria-connector/src/connectors/repo-guard.js +509 -0
- package/dist/aria-connector/src/connectors/repo-guard.js.map +1 -0
- package/dist/aria-connector/src/connectors/runtime.d.ts +2 -0
- package/dist/aria-connector/src/connectors/runtime.d.ts.map +1 -0
- package/dist/aria-connector/src/connectors/runtime.js +330 -0
- package/dist/aria-connector/src/connectors/runtime.js.map +1 -0
- package/dist/aria-connector/src/connectors/shell.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/shell.js +78 -13
- package/dist/aria-connector/src/connectors/shell.js.map +1 -1
- package/dist/aria-connector/src/connectors/syncd.d.ts +27 -0
- package/dist/aria-connector/src/connectors/syncd.d.ts.map +1 -0
- package/dist/aria-connector/src/connectors/syncd.js +405 -0
- package/dist/aria-connector/src/connectors/syncd.js.map +1 -0
- package/dist/aria-connector/src/decisions.d.ts +207 -0
- package/dist/aria-connector/src/decisions.d.ts.map +1 -0
- package/dist/aria-connector/src/decisions.js +291 -0
- package/dist/aria-connector/src/decisions.js.map +1 -0
- package/dist/aria-connector/src/garden-control-plane.d.ts.map +1 -1
- package/dist/aria-connector/src/garden-control-plane.js +74 -17
- package/dist/aria-connector/src/garden-control-plane.js.map +1 -1
- package/dist/aria-connector/src/github-connect.d.ts +18 -0
- package/dist/aria-connector/src/github-connect.d.ts.map +1 -0
- package/dist/aria-connector/src/github-connect.js +117 -0
- package/dist/aria-connector/src/github-connect.js.map +1 -0
- package/dist/aria-connector/src/harness-client.d.ts +15 -0
- package/dist/aria-connector/src/harness-client.d.ts.map +1 -1
- package/dist/aria-connector/src/harness-client.js +106 -3
- package/dist/aria-connector/src/harness-client.js.map +1 -1
- package/dist/aria-connector/src/hive-client.d.ts +30 -0
- package/dist/aria-connector/src/hive-client.d.ts.map +1 -1
- package/dist/aria-connector/src/hive-client.js +124 -5
- package/dist/aria-connector/src/hive-client.js.map +1 -1
- package/dist/aria-connector/src/index.d.ts +13 -2
- package/dist/aria-connector/src/index.d.ts.map +1 -1
- package/dist/aria-connector/src/index.js +10 -1
- package/dist/aria-connector/src/index.js.map +1 -1
- package/dist/aria-connector/src/lib/aristotle-noor-wire.d.ts +102 -0
- package/dist/aria-connector/src/lib/aristotle-noor-wire.d.ts.map +1 -0
- package/dist/aria-connector/src/lib/aristotle-noor-wire.js +231 -0
- package/dist/aria-connector/src/lib/aristotle-noor-wire.js.map +1 -0
- package/dist/aria-connector/src/providers/types.d.ts +5 -0
- package/dist/aria-connector/src/providers/types.d.ts.map +1 -1
- package/dist/aria-connector/src/runtime-proof.d.ts +45 -0
- package/dist/aria-connector/src/runtime-proof.d.ts.map +1 -0
- package/dist/aria-connector/src/runtime-proof.js +340 -0
- package/dist/aria-connector/src/runtime-proof.js.map +1 -0
- package/dist/aria-connector/src/setup-wizard.d.ts.map +1 -1
- package/dist/aria-connector/src/setup-wizard.js +34 -2
- package/dist/aria-connector/src/setup-wizard.js.map +1 -1
- package/dist/assets/hooks/aria-agent-handoff.mjs +224 -0
- package/dist/assets/hooks/aria-agent-ledger-merge.mjs +164 -0
- package/dist/assets/hooks/aria-architect-fallback.mjs +267 -0
- package/dist/assets/hooks/aria-cognition-substrate-binding.mjs +676 -0
- package/dist/assets/hooks/aria-discovery-record.mjs +101 -0
- package/dist/assets/hooks/aria-harness-via-sdk.mjs +412 -0
- package/dist/assets/hooks/aria-import-resolution-gate.mjs +330 -0
- package/dist/assets/hooks/aria-outcome-record.mjs +84 -0
- package/dist/assets/hooks/aria-pre-emit-dryrun.mjs +294 -0
- package/dist/assets/hooks/aria-pre-text-gate.mjs +112 -0
- package/dist/assets/hooks/aria-pre-tool-gate.mjs +2133 -0
- package/dist/assets/hooks/aria-preprompt-consult.mjs +438 -0
- package/dist/assets/hooks/aria-preturn-memory-gate.mjs +570 -0
- package/dist/assets/hooks/aria-repo-doctrine-gate.mjs +397 -0
- package/dist/assets/hooks/aria-stop-gate.mjs +1551 -0
- package/dist/assets/hooks/aria-trigger-autolearn.mjs +229 -0
- package/dist/assets/hooks/aria-userprompt-abandon-detect.mjs +192 -0
- package/dist/assets/hooks/doctrine_trigger_map.json +479 -0
- package/dist/assets/hooks/lib/canonical-lenses.mjs +64 -0
- package/dist/assets/hooks/lib/gate-audit.mjs +43 -0
- package/dist/assets/hooks/test-aria-preturn-memory-gate.mjs +245 -0
- package/dist/assets/hooks/test-tier-lens-labeling.mjs +399 -0
- package/dist/assets/opencode-plugins/harness-context/index.js +60 -0
- package/dist/assets/opencode-plugins/harness-context/inject-context.mjs +179 -0
- package/dist/assets/opencode-plugins/harness-context/package.json +9 -0
- package/dist/assets/opencode-plugins/harness-gate/index.js +248 -0
- package/dist/assets/opencode-plugins/harness-outcome/index.js +129 -0
- package/dist/assets/opencode-plugins/harness-role/index.js +77 -0
- package/dist/assets/opencode-plugins/harness-role/package.json +9 -0
- package/dist/assets/opencode-plugins/harness-stop/index.js +241 -0
- package/dist/runtime/discipline/CLAUDE.md +339 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-essence/SKILL.md +63 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-essence/references/domain-matrix.md +80 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-essence/references/evolution-loop.md +30 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-essence/references/readable-cognition.md +27 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-forge-guardrails/SKILL.md +35 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-forge-guardrails/references/checklist.md +31 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-repo-doctrine/SKILL.md +39 -0
- package/dist/runtime/discipline/skills/aria-cognition/forge-quality-rules/SKILL.md +43 -0
- package/dist/runtime/discipline/skills/aria-cognition/ghazali-8lens/SKILL.md +38 -0
- package/dist/runtime/discipline/skills/aria-cognition/istiqra-induction/SKILL.md +26 -0
- package/dist/runtime/discipline/skills/aria-cognition/ladunni-22/SKILL.md +35 -0
- package/dist/runtime/discipline/skills/aria-cognition/mizan/SKILL.md +72 -0
- package/dist/runtime/discipline/skills/aria-cognition/nadia/SKILL.md +38 -0
- package/dist/runtime/discipline/skills/aria-cognition/nadia-psi/SKILL.md +38 -0
- package/dist/runtime/discipline/skills/aria-cognition/predictor/SKILL.md +25 -0
- package/dist/runtime/discipline/skills/aria-cognition/qiyas-analogy/SKILL.md +26 -0
- package/dist/runtime/discipline/skills/aria-cognition/soul-domains/SKILL.md +25 -0
- package/dist/runtime/discipline/skills/aria-harness/aria-aristotle-intra-phase/SKILL.md +81 -0
- package/dist/runtime/discipline/skills/aria-harness/aria-aristotle-post-phase/SKILL.md +98 -0
- package/dist/runtime/discipline/skills/aria-harness/aria-aristotle-pre-phase/SKILL.md +99 -0
- package/dist/runtime/discipline/skills/aria-harness/aria-harness-deploy/SKILL.md +127 -0
- package/dist/runtime/discipline/skills/aria-harness/aria-harness-no-stripping/SKILL.md +117 -0
- package/dist/runtime/discipline/skills/aria-harness/aria-harness-onboarding/SKILL.md +112 -0
- package/dist/runtime/discipline/skills/aria-harness/aria-harness-output-discipline/SKILL.md +102 -0
- package/dist/runtime/discipline/skills/aria-harness/aria-harness-substrate-binding/SKILL.md +121 -0
- package/dist/runtime/doctor.mjs +23 -0
- package/dist/runtime/local-phase.mjs +632 -0
- package/dist/runtime/manifest.json +15 -0
- package/dist/runtime/mizan-scheduler.mjs +331 -0
- package/dist/runtime/package.json +6 -0
- package/dist/runtime/provider-proxy.mjs +594 -0
- package/dist/runtime/sdk/BUNDLED.json +5 -0
- package/dist/runtime/sdk/index.d.ts +477 -0
- package/dist/runtime/sdk/index.js +1469 -0
- package/dist/runtime/sdk/index.js.map +1 -0
- package/dist/runtime/sdk/package.json +8 -0
- package/dist/runtime/sdk/runWithCognition.d.ts +77 -0
- package/dist/runtime/sdk/runWithCognition.js +157 -0
- package/dist/runtime/sdk/runWithCognition.js.map +1 -0
- package/dist/runtime/service.mjs +2708 -0
- package/dist/runtime/vendor/aria-gate-runtime/index.d.ts +53 -0
- package/dist/runtime/vendor/aria-gate-runtime/index.d.ts.map +1 -0
- package/dist/runtime/vendor/aria-gate-runtime/index.js +277 -0
- package/dist/runtime/vendor/aria-gate-runtime/index.js.map +1 -0
- package/dist/runtime/vendor/aria-gate-runtime/package.json +6 -0
- package/dist/sdk/BUNDLED.json +2 -2
- package/dist/sdk/index.d.ts +317 -0
- package/dist/sdk/index.js +827 -85
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/runWithCognition.d.ts +77 -0
- package/dist/sdk/runWithCognition.js +157 -0
- package/dist/sdk/runWithCognition.js.map +1 -0
- package/hooks/aria-agent-handoff.mjs +11 -1
- package/hooks/aria-architect-fallback.mjs +267 -0
- package/hooks/aria-cognition-substrate-binding.mjs +676 -0
- package/hooks/aria-discovery-record.mjs +101 -0
- package/hooks/aria-harness-via-sdk.mjs +34 -21
- package/hooks/aria-import-resolution-gate.mjs +330 -0
- package/hooks/aria-outcome-record.mjs +84 -0
- package/hooks/aria-pre-emit-dryrun.mjs +294 -0
- package/hooks/aria-pre-tool-gate.mjs +985 -40
- package/hooks/aria-preprompt-consult.mjs +113 -13
- package/hooks/aria-preturn-memory-gate.mjs +298 -6
- package/hooks/aria-repo-doctrine-gate.mjs +397 -0
- package/hooks/aria-stop-gate.mjs +840 -75
- package/hooks/aria-userprompt-abandon-detect.mjs +5 -1
- package/hooks/doctrine_trigger_map.json +209 -15
- package/hooks/lib/canonical-lenses.mjs +64 -0
- package/hooks/lib/gate-audit.mjs +43 -0
- package/opencode-plugins/harness-context/index.js +1 -1
- package/opencode-plugins/harness-context/inject-context.mjs +82 -23
- package/opencode-plugins/harness-gate/index.js +248 -0
- package/opencode-plugins/harness-outcome/index.js +129 -0
- package/opencode-plugins/harness-stop/index.js +241 -0
- package/package.json +8 -2
- package/runtime-src/doctor.mjs +23 -0
- package/runtime-src/local-phase.mjs +632 -0
- package/runtime-src/mizan-scheduler.mjs +331 -0
- package/runtime-src/provider-proxy.mjs +594 -0
- package/runtime-src/service.mjs +2708 -0
- package/scripts/bundle-sdk.mjs +317 -0
- package/scripts/install-client.sh +176 -0
- package/scripts/publish-all.sh +344 -0
- package/scripts/publish-docker.sh +27 -0
- package/scripts/validate-hook-contracts.mjs +54 -0
- package/scripts/validate-skill-prompts.mjs +95 -0
- package/skills/aria-cognition/aria-essence/SKILL.md +63 -0
- package/skills/aria-cognition/aria-essence/references/domain-matrix.md +80 -0
- package/skills/aria-cognition/aria-essence/references/evolution-loop.md +30 -0
- package/skills/aria-cognition/aria-essence/references/readable-cognition.md +27 -0
- package/skills/aria-cognition/aria-forge-guardrails/SKILL.md +35 -0
- package/skills/aria-cognition/aria-forge-guardrails/references/checklist.md +31 -0
- package/skills/aria-cognition/aria-repo-doctrine/SKILL.md +39 -0
- package/skills/aria-cognition/forge-quality-rules/SKILL.md +43 -0
- package/skills/aria-cognition/ghazali-8lens/SKILL.md +38 -0
- package/skills/aria-cognition/istiqra-induction/SKILL.md +26 -0
- package/skills/aria-cognition/ladunni-22/SKILL.md +35 -0
- package/skills/aria-cognition/mizan/SKILL.md +72 -0
- package/skills/aria-cognition/nadia/SKILL.md +38 -0
- package/skills/aria-cognition/nadia-psi/SKILL.md +38 -0
- package/skills/aria-cognition/predictor/SKILL.md +25 -0
- package/skills/aria-cognition/qiyas-analogy/SKILL.md +26 -0
- package/skills/aria-cognition/soul-domains/SKILL.md +25 -0
- package/src/auth-commands.ts +111 -45
- package/src/chat.ts +174 -13
- package/src/codebase-scanner.ts +4 -0
- package/src/config.ts +15 -0
- package/src/connectors/claude-code.ts +115 -26
- package/src/connectors/codebase-awareness.ts +408 -0
- package/src/connectors/codex.ts +274 -0
- package/src/connectors/cognitive-skills.ts +51 -0
- package/src/connectors/opencode.ts +93 -4
- package/src/connectors/repo-git-hooks.ts +86 -0
- package/src/connectors/repo-guard.ts +589 -0
- package/src/connectors/runtime.ts +374 -0
- package/src/connectors/shell.ts +83 -14
- package/src/connectors/syncd.ts +488 -0
- package/src/decisions.ts +469 -0
- package/src/garden-control-plane.ts +101 -26
- package/src/github-connect.ts +143 -0
- package/src/harness-client.ts +128 -3
- package/src/hive-client.ts +165 -5
- package/src/index.ts +41 -2
- package/src/lib/aristotle-noor-wire.ts +310 -0
- package/src/providers/types.ts +6 -0
- package/src/runtime-proof.ts +392 -0
- package/src/setup-wizard.ts +37 -2
package/dist/sdk/index.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export interface Handoff {
|
|
|
18
18
|
ownerTier: OwnerTier;
|
|
19
19
|
parentLedgerPath: string;
|
|
20
20
|
ttlMs: number;
|
|
21
|
+
/** Path to the harness packet JSON written alongside the handoff for sub-agent cognition bootstrap. */
|
|
22
|
+
harnessPacketPath?: string;
|
|
21
23
|
}
|
|
22
24
|
export interface SpawnSubAgentArgs {
|
|
23
25
|
/** What the sub-agent is being asked to do — recorded in the handoff for traceability. */
|
|
@@ -61,6 +63,70 @@ export interface HarnessInjection {
|
|
|
61
63
|
files: Record<string, string>;
|
|
62
64
|
task: string;
|
|
63
65
|
loadedAt: string;
|
|
66
|
+
aegisLearnings?: {
|
|
67
|
+
avoidPatterns: string[];
|
|
68
|
+
successPatterns: string[];
|
|
69
|
+
recentPatterns: Array<{
|
|
70
|
+
name: string;
|
|
71
|
+
category: string;
|
|
72
|
+
outcome: string;
|
|
73
|
+
lesson: string;
|
|
74
|
+
}>;
|
|
75
|
+
decisionCount: number;
|
|
76
|
+
reflectionCount: number;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export interface HarnessBindingContext {
|
|
80
|
+
role: string;
|
|
81
|
+
sessionId: string;
|
|
82
|
+
stage: string;
|
|
83
|
+
intendedAction: string;
|
|
84
|
+
rationale: string;
|
|
85
|
+
correlationId?: string;
|
|
86
|
+
message?: string;
|
|
87
|
+
userId?: string;
|
|
88
|
+
userName?: string;
|
|
89
|
+
platform?: string;
|
|
90
|
+
roleProfile?: string;
|
|
91
|
+
currentIssue?: string;
|
|
92
|
+
linearIssueId?: string;
|
|
93
|
+
linearIssueUrl?: string;
|
|
94
|
+
linearState?: string;
|
|
95
|
+
workingDirectory?: string;
|
|
96
|
+
filesTouched?: string[];
|
|
97
|
+
recentProgress?: string[];
|
|
98
|
+
openRisks?: string[];
|
|
99
|
+
nextActions?: string[];
|
|
100
|
+
checkpoint?: Record<string, unknown>;
|
|
101
|
+
requireGarden?: boolean;
|
|
102
|
+
researchMode?: 'single-source' | 'multi-source';
|
|
103
|
+
includeAegisLearnings?: boolean;
|
|
104
|
+
extraBody?: Record<string, unknown>;
|
|
105
|
+
}
|
|
106
|
+
export interface BoundHarnessPromptResult {
|
|
107
|
+
prompt: string;
|
|
108
|
+
packet: HarnessPacket;
|
|
109
|
+
harnessText: string;
|
|
110
|
+
bindingBody: Record<string, unknown>;
|
|
111
|
+
}
|
|
112
|
+
export interface RecordDiscoveryArgs {
|
|
113
|
+
/** Finding text (min 4 chars). */
|
|
114
|
+
text: string;
|
|
115
|
+
kind?: 'observation' | 'defect' | 'principle' | 'risk' | 'fix-recipe' | string;
|
|
116
|
+
refs?: string[];
|
|
117
|
+
evidence?: string | null;
|
|
118
|
+
resolution_status?: 'open' | 'resolved' | 'failed' | 'partial' | 'needs-human';
|
|
119
|
+
source?: string;
|
|
120
|
+
/** Sub-agent's own session ID. If omitted, derived from handoff parentSessionId + "-sub". */
|
|
121
|
+
sessionId?: string;
|
|
122
|
+
/** Client-tier JTI. If omitted, tier is detected from ~/.aria/license.json. */
|
|
123
|
+
jti?: string;
|
|
124
|
+
}
|
|
125
|
+
export interface RecordDiscoveryResult {
|
|
126
|
+
ok: boolean;
|
|
127
|
+
ledger: string;
|
|
128
|
+
at: string;
|
|
129
|
+
error?: string;
|
|
64
130
|
}
|
|
65
131
|
export interface VerifyClaimArgs {
|
|
66
132
|
claim: string;
|
|
@@ -90,6 +156,101 @@ export interface ActionCheck {
|
|
|
90
156
|
reason?: string;
|
|
91
157
|
requiredGates: string[];
|
|
92
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Result shape for all three Aristotle phases.
|
|
161
|
+
* Mirrors `AristotleNoorWireResult` in aria-connector's aristotle-noor-wire.ts.
|
|
162
|
+
* The SDK does NOT import server-side modules (db pool, NoorCore) — all data
|
|
163
|
+
* arrives via the harness HTTP route `POST /api/harness/aristotle-noor`.
|
|
164
|
+
*/
|
|
165
|
+
export interface AristotlePhaseResult {
|
|
166
|
+
/** Names of cognitive primitives that fired during this phase. */
|
|
167
|
+
fired: string[];
|
|
168
|
+
/** Fitrah hard-gate verdict — if true, the caller MUST emit an honest refusal. */
|
|
169
|
+
fitrahVetoed: boolean;
|
|
170
|
+
/** Fitrah alignment score 0–1. */
|
|
171
|
+
fitrahAlignment: number;
|
|
172
|
+
/** 8-lens + quality-gate score 0–100 (AFTER phase only; 100 for PRE/MID). */
|
|
173
|
+
qualityScore: number;
|
|
174
|
+
/** True when 8-lens gate detected violations — caller should surface re-author signal. */
|
|
175
|
+
reAuthorSignal: boolean;
|
|
176
|
+
/** Human-readable notes from each primitive (warnings, skips, etc.). */
|
|
177
|
+
notes: string[];
|
|
178
|
+
/** Noor soul-charge scalar (null if manifold not initialized on this call). */
|
|
179
|
+
soulCharge: number | null;
|
|
180
|
+
/** Noor manifold drift status string ('aligned'|'stable'|'drifting'|null). */
|
|
181
|
+
soulManifoldStatus: string | null;
|
|
182
|
+
/** Ghazali 8-lens verdict string from Noor principle eigenspace ('aligned'|'caution'|'violation'|null). */
|
|
183
|
+
ghazaliVerdict: string | null;
|
|
184
|
+
/** Wall-clock latency measured by the harness route (ms). */
|
|
185
|
+
latencyMs: number;
|
|
186
|
+
/** True when the dispatch reached the harness; false on transport fault (result is fail-open default). */
|
|
187
|
+
dispatched: boolean;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Result shape for Noor eigenspace recognition.
|
|
191
|
+
* Maps to the `RecognitionResult` + `NoorResponse` shape in noor-core.ts.
|
|
192
|
+
*/
|
|
193
|
+
export interface NoorRecognitionResult {
|
|
194
|
+
/** Nearest recognized response text from Aria's response library. */
|
|
195
|
+
nearestText: string;
|
|
196
|
+
/** Soul distance from manifold centroid (cosine). */
|
|
197
|
+
soulDistance: number;
|
|
198
|
+
/** Confidence in the recognition (0–1). */
|
|
199
|
+
confidence: number;
|
|
200
|
+
/** Whether the input is within the ethical membrane ∂E. */
|
|
201
|
+
withinMembrane: boolean;
|
|
202
|
+
/** Current soul charge Q. */
|
|
203
|
+
soulCharge: number;
|
|
204
|
+
/** Top projection components (eigenvector label + weight pairs). */
|
|
205
|
+
projectionComponents: Array<{
|
|
206
|
+
eigenvector: string;
|
|
207
|
+
weight: number;
|
|
208
|
+
}>;
|
|
209
|
+
/** Ghazali 8-lens verdict from principle eigenspace, if available. */
|
|
210
|
+
ghazaliVerdict: string | null;
|
|
211
|
+
/** Manifold drift status. */
|
|
212
|
+
manifoldHealth: {
|
|
213
|
+
charge: number;
|
|
214
|
+
drift: string;
|
|
215
|
+
coherence: number;
|
|
216
|
+
} | null;
|
|
217
|
+
/** True when the dispatch reached the harness. */
|
|
218
|
+
dispatched: boolean;
|
|
219
|
+
/** Wall-clock latency (ms). */
|
|
220
|
+
latencyMs: number;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Forge primitive descriptor.
|
|
224
|
+
* Mirrors the `Primitive` type in noor-forge.ts.
|
|
225
|
+
*/
|
|
226
|
+
export interface NoorForgePrimitive {
|
|
227
|
+
type: 'http' | 'sql' | 'file_read' | 'file_write' | 'pub_sub';
|
|
228
|
+
params: Record<string, unknown>;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Result shape for a Noor Forge operation.
|
|
232
|
+
* Maps to `ForgeResult` in noor-forge.ts.
|
|
233
|
+
*/
|
|
234
|
+
export interface NoorForgeResult {
|
|
235
|
+
/** Whether all primitives in the chain executed successfully. */
|
|
236
|
+
success: boolean;
|
|
237
|
+
/** Name of the forged tool (slug derived from intent purpose). */
|
|
238
|
+
toolName: string;
|
|
239
|
+
/** Whether the intent passed the ethical membrane alignment check. */
|
|
240
|
+
ethicallyApproved: boolean;
|
|
241
|
+
/** Wall-clock latency for the full primitive chain (ms). */
|
|
242
|
+
totalDurationMs: number;
|
|
243
|
+
/** Per-primitive execution results. */
|
|
244
|
+
results: Array<{
|
|
245
|
+
type: string;
|
|
246
|
+
success: boolean;
|
|
247
|
+
data: unknown;
|
|
248
|
+
error?: string;
|
|
249
|
+
durationMs: number;
|
|
250
|
+
}>;
|
|
251
|
+
/** True when the dispatch reached the harness. */
|
|
252
|
+
dispatched: boolean;
|
|
253
|
+
}
|
|
93
254
|
export declare class HTTPHarnessClient {
|
|
94
255
|
private static instance;
|
|
95
256
|
private readonly baseUrl;
|
|
@@ -100,11 +261,31 @@ export declare class HTTPHarnessClient {
|
|
|
100
261
|
private packetLastFetched;
|
|
101
262
|
private readonly packetTtlMs;
|
|
102
263
|
constructor(config: HarnessClientConfig);
|
|
264
|
+
private extractHarnessText;
|
|
265
|
+
private normalizePlanDocs;
|
|
266
|
+
private collectPlanFilePaths;
|
|
267
|
+
private loadFilesByPath;
|
|
268
|
+
private buildHarnessInjection;
|
|
269
|
+
private buildHarnessBindingBody;
|
|
270
|
+
private _tryLoadDiskPacket;
|
|
103
271
|
static getInstance(config?: HarnessClientConfig): HTTPHarnessClient;
|
|
104
272
|
static resetInstance(): void;
|
|
105
273
|
private fetchHarnessPacket;
|
|
106
274
|
inject(plan: HarnessPlan): Promise<HarnessInjection>;
|
|
107
275
|
getHarnessPacket(bodyOverride?: Record<string, unknown>): Promise<HarnessPacket>;
|
|
276
|
+
getBoundHarnessAndPrompt(context: HarnessBindingContext, plan?: Partial<HarnessPlan>): Promise<BoundHarnessPromptResult>;
|
|
277
|
+
getAegisLearnings(limit?: number): Promise<{
|
|
278
|
+
avoidPatterns: string[];
|
|
279
|
+
successPatterns: string[];
|
|
280
|
+
recentPatterns: Array<{
|
|
281
|
+
name: string;
|
|
282
|
+
category: string;
|
|
283
|
+
outcome: string;
|
|
284
|
+
lesson: string;
|
|
285
|
+
}>;
|
|
286
|
+
decisionCount: number;
|
|
287
|
+
reflectionCount: number;
|
|
288
|
+
} | null>;
|
|
108
289
|
buildSystemPrompt(injection: HarnessInjection): string;
|
|
109
290
|
get8LensBlock(): string;
|
|
110
291
|
validateOutput(text: string, sessionId: string): Promise<ValidationResult>;
|
|
@@ -145,16 +326,152 @@ export declare class HTTPHarnessClient {
|
|
|
145
326
|
iterations: number;
|
|
146
327
|
}>;
|
|
147
328
|
spawnSubAgent(args: SpawnSubAgentArgs): Promise<Handoff>;
|
|
329
|
+
/**
|
|
330
|
+
* Returns the environment variables to set for a spawned sub-agent process
|
|
331
|
+
* so it inherits the parent's harness packet without an extra HTTP call.
|
|
332
|
+
* Call after spawnSubAgent() — uses the returned handoff.harnessPacketPath.
|
|
333
|
+
*
|
|
334
|
+
* Usage:
|
|
335
|
+
* const handoff = await sdk.spawnSubAgent(args);
|
|
336
|
+
* const env = sdk.subAgentEnv(handoff);
|
|
337
|
+
* // pass env to your process spawn / Agent tool env block
|
|
338
|
+
*/
|
|
339
|
+
subAgentEnv(handoff: Handoff): Record<string, string>;
|
|
148
340
|
/** Pulls sub-agent ledger entries newer than the handoff timestamp and appends
|
|
149
341
|
* them to the parent ledger, deduplicating by `text` prefix (first 100 chars). */
|
|
150
342
|
mergeSubAgentLedger(parentSessionId: string, _subAgentSessionId?: string, jti?: string): Promise<{
|
|
151
343
|
merged: number;
|
|
152
344
|
skipped: number;
|
|
153
345
|
}>;
|
|
346
|
+
recordDiscovery(args: RecordDiscoveryArgs): Promise<RecordDiscoveryResult>;
|
|
154
347
|
verifyClaim(args: VerifyClaimArgs): Promise<VerifyClaimResult>;
|
|
348
|
+
postJson<T = unknown>(url: string, body: unknown, extraHeaders?: Record<string, string>): Promise<{
|
|
349
|
+
ok: true;
|
|
350
|
+
status: number;
|
|
351
|
+
data: T;
|
|
352
|
+
} | {
|
|
353
|
+
ok: false;
|
|
354
|
+
status: number;
|
|
355
|
+
errorBody: string;
|
|
356
|
+
}>;
|
|
357
|
+
/**
|
|
358
|
+
* ARISTOTLE PRE-PHASE
|
|
359
|
+
* Fires before an LLM call or tool action. Runs: Fitrah hard-gate,
|
|
360
|
+
* wisdom pull (principles + decisions), research pull, DeepSoulBridge,
|
|
361
|
+
* and CleanCognition substrate check.
|
|
362
|
+
*
|
|
363
|
+
* Throws on transport-level failures per feedback_non_blocking_errors_unacceptable.md.
|
|
364
|
+
* If Fitrah vetoes, result.fitrahVetoed === true — caller MUST emit a refusal,
|
|
365
|
+
* not silently continue.
|
|
366
|
+
*
|
|
367
|
+
* @param message The user message or intent string being processed.
|
|
368
|
+
* @param sessionId Session ID for telemetry + hive routing.
|
|
369
|
+
* @param context Optional context overrides (userId, isHamza, tier, etc.).
|
|
370
|
+
*/
|
|
371
|
+
aristotlePre(message: string, sessionId: string, context?: {
|
|
372
|
+
userId?: string;
|
|
373
|
+
isHamza?: boolean;
|
|
374
|
+
isGroupChat?: boolean;
|
|
375
|
+
tier?: string;
|
|
376
|
+
}): Promise<AristotlePhaseResult>;
|
|
377
|
+
/**
|
|
378
|
+
* ARISTOTLE MID-PHASE
|
|
379
|
+
* Fires after context is built but before the LLM call. Runs: MetaCognitive
|
|
380
|
+
* confidence snapshot and ethical keyword check on the planned approach.
|
|
381
|
+
*
|
|
382
|
+
* @param message Original user message.
|
|
383
|
+
* @param sessionId Session ID.
|
|
384
|
+
* @param plannedApproach The drafted approach / plan string for mid-flight check.
|
|
385
|
+
* @param context Optional context overrides.
|
|
386
|
+
*/
|
|
387
|
+
aristotleMid(message: string, sessionId: string, plannedApproach: string, context?: {
|
|
388
|
+
userId?: string;
|
|
389
|
+
tier?: string;
|
|
390
|
+
}): Promise<AristotlePhaseResult>;
|
|
391
|
+
/**
|
|
392
|
+
* ARISTOTLE POST-PHASE
|
|
393
|
+
* Fires after the LLM response, before emission. Runs: 8-Lens Detector,
|
|
394
|
+
* Predictor, SelfReflection (on high-stakes turns), and quality scoring.
|
|
395
|
+
*
|
|
396
|
+
* If result.reAuthorSignal === true, the response has 8-lens violations —
|
|
397
|
+
* per doctrine the caller MUST surface the signal, never silently strip.
|
|
398
|
+
*
|
|
399
|
+
* @param message Original user message.
|
|
400
|
+
* @param response The LLM-generated response to gate.
|
|
401
|
+
* @param sessionId Session ID.
|
|
402
|
+
* @param context Optional context overrides (tier, isFirstOfSession).
|
|
403
|
+
*/
|
|
404
|
+
aristotlePost(message: string, response: string, sessionId: string, context?: {
|
|
405
|
+
userId?: string;
|
|
406
|
+
tier?: string;
|
|
407
|
+
isFirstOfSession?: boolean;
|
|
408
|
+
}): Promise<AristotlePhaseResult>;
|
|
409
|
+
/**
|
|
410
|
+
* NOOR RECOGNIZE (Kashf — eigenspace recognition, not generation)
|
|
411
|
+
* Projects the query string (via harness-side embedding) onto Aria's
|
|
412
|
+
* eigenspace manifold and returns the nearest recognized response + soul
|
|
413
|
+
* distance + ethical membrane status + Ghazali 8-lens verdict.
|
|
414
|
+
*
|
|
415
|
+
* The harness routes the query through the manifold service (gRPC) if
|
|
416
|
+
* NOOR_EIGENSPACE_SOURCE=manifold, otherwise uses local eigenspace.
|
|
417
|
+
*
|
|
418
|
+
* @param query The input string to recognize on the manifold.
|
|
419
|
+
* @param context Optional context (sessionId, userId) for telemetry.
|
|
420
|
+
*/
|
|
421
|
+
noorRecognize(query: string, context?: {
|
|
422
|
+
sessionId?: string;
|
|
423
|
+
userId?: string;
|
|
424
|
+
}): Promise<NoorRecognitionResult>;
|
|
425
|
+
/**
|
|
426
|
+
* NOOR FORGE — self-generated tool invocation via 5 primitives
|
|
427
|
+
* Composes a named primitive chain (http, sql, file_read, file_write, pub_sub)
|
|
428
|
+
* and executes it through the harness-side NoorForge engine. The harness
|
|
429
|
+
* applies the ethical membrane check (checkEthicalAlignment) before any
|
|
430
|
+
* primitive fires — rejected intents return success=false, ethicallyApproved=false.
|
|
431
|
+
*
|
|
432
|
+
* @param intent Description of what the forged tool should accomplish.
|
|
433
|
+
* @param primitives Ordered list of primitive descriptors to execute in sequence.
|
|
434
|
+
* @param context Optional context for telemetry.
|
|
435
|
+
*/
|
|
436
|
+
noorForge(intent: string, primitives: NoorForgePrimitive[], context?: {
|
|
437
|
+
sessionId?: string;
|
|
438
|
+
userId?: string;
|
|
439
|
+
}): Promise<NoorForgeResult>;
|
|
440
|
+
/**
|
|
441
|
+
* Harness consult with Aristotle 3-phase wrapping.
|
|
442
|
+
*
|
|
443
|
+
* Flow:
|
|
444
|
+
* 1. aristotlePre() — Fitrah gate, wisdom, research, soul state
|
|
445
|
+
* 2. getBoundHarnessAndPrompt() — packet + system prompt
|
|
446
|
+
* 3. aristotleMid() — MetaCognitive + ethical check (if plannedApproach provided)
|
|
447
|
+
* 4. [caller calls LLM with the returned prompt]
|
|
448
|
+
* 5. Call aristotlePost() from the caller with the LLM response
|
|
449
|
+
* (post-phase is caller-side because the SDK doesn't own the LLM call)
|
|
450
|
+
*
|
|
451
|
+
* Returns the BoundHarnessPromptResult augmented with the pre-phase result.
|
|
452
|
+
* If Fitrah vetoes, throws — the caller must handle the veto (emit refusal).
|
|
453
|
+
*
|
|
454
|
+
* @param context HarnessBindingContext (same shape as getBoundHarnessAndPrompt).
|
|
455
|
+
* @param plan Optional plan docs / files (same shape as getBoundHarnessAndPrompt).
|
|
456
|
+
* @param options Aristotle control options.
|
|
457
|
+
* @param options.aristotleEnabled Whether Aristotle fires. Default true for this method.
|
|
458
|
+
* @param options.plannedApproach Optional planned approach string — activates mid-phase.
|
|
459
|
+
* @param options.tier Tier hint for Aristotle ('owner'|'client'|etc.).
|
|
460
|
+
*/
|
|
461
|
+
getBoundHarnessAndPromptWithAristotle(context: HarnessBindingContext, plan?: Partial<HarnessPlan>, options?: {
|
|
462
|
+
aristotleEnabled?: boolean;
|
|
463
|
+
plannedApproach?: string;
|
|
464
|
+
tier?: string;
|
|
465
|
+
}): Promise<BoundHarnessPromptResult & {
|
|
466
|
+
aristotlePre: AristotlePhaseResult | null;
|
|
467
|
+
aristotleMid: AristotlePhaseResult | null;
|
|
468
|
+
}>;
|
|
155
469
|
private fetchWithRetry;
|
|
156
470
|
}
|
|
157
471
|
export declare const harness: {
|
|
158
472
|
getInstance: typeof HTTPHarnessClient.getInstance;
|
|
159
473
|
resetInstance: typeof HTTPHarnessClient.resetInstance;
|
|
160
474
|
};
|
|
475
|
+
export declare function bindingContext(role: string, sessionId: string, stage: string, intendedAction: string, rationale: string): HarnessBindingContext;
|
|
476
|
+
export declare function getBoundHarnessAndPrompt(context: HarnessBindingContext, plan?: Partial<HarnessPlan>, client?: HTTPHarnessClient): Promise<BoundHarnessPromptResult>;
|
|
477
|
+
export * from './runWithCognition.js';
|