@intentrax/sdk 1.2.0 → 1.6.0
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/README.md +136 -0
- package/cli/intentrax.mjs +312 -6
- package/index.d.ts +156 -2
- package/index.js +987 -9
- package/index.ts +987 -9
- package/package.json +1 -1
- package/trust/policies/94b421ad2a0eb71e0fc558697ae099967d7ff3d0780ca7c089f0ba53e76894b2.json +57 -0
package/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare const AGENT_GATEWAY_ADMISSION_REQUEST_HASH_DOMAIN: "INTENTRAX_AGE
|
|
|
6
6
|
export declare const AGENT_ADMISSION_SCHEMA_VERSION: "intentrax.runtime.agent_admission_request/1.0";
|
|
7
7
|
export declare const AGENT_ADMISSION_ENDPOINT: "/v1/agent/admissions";
|
|
8
8
|
export declare const INTENT_EXECUTE_REQUEST_SCHEMA_VERSION: "intentrax.runtime.intent_execute.request/1.0";
|
|
9
|
+
export declare const INTENT_EXECUTE_REQUEST_SCHEMA_VERSION_V11: "intentrax.runtime.intent_execute.request/1.1";
|
|
9
10
|
export declare const INTENT_EXECUTE_ENDPOINT: "/v1/intents/execute";
|
|
10
11
|
export declare const INTENT_EXECUTE_MAX_REQUEST_BYTES: 4096;
|
|
11
12
|
export declare const RECEIPT_VERIFICATION_REQUEST_SCHEMA_VERSION: "intentrax.runtime.proof_verification.request/1.0";
|
|
@@ -45,14 +46,28 @@ export type AgentGatewayAdmissionRequest = {
|
|
|
45
46
|
idempotency_key_hash: string;
|
|
46
47
|
};
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
schema_version: "intentrax.runtime.intent_execute.request/1.0";
|
|
49
|
+
type IntentExecuteRequestFields = {
|
|
50
50
|
intent_id: string;
|
|
51
51
|
tenant_id: string;
|
|
52
52
|
action: string;
|
|
53
53
|
idempotency_key: string;
|
|
54
54
|
proof_chain_fixture_ref: string;
|
|
55
55
|
};
|
|
56
|
+
export type IntentExecuteRequestV10 = IntentExecuteRequestFields & {
|
|
57
|
+
schema_version: "intentrax.runtime.intent_execute.request/1.0";
|
|
58
|
+
};
|
|
59
|
+
// /1.1: the /1.0 fields plus an optional producer-declared output_binding that
|
|
60
|
+
// the engine seals into the signed proof. content_hash may be the bare 64
|
|
61
|
+
// lowercase hex buildOutputBinding emits or the same with a "sha256:" prefix.
|
|
62
|
+
export type IntentExecuteRequestV11 = IntentExecuteRequestFields & {
|
|
63
|
+
schema_version: "intentrax.runtime.intent_execute.request/1.1";
|
|
64
|
+
output_binding?: {
|
|
65
|
+
content_hash: string;
|
|
66
|
+
hash_algorithm: "SHA-256";
|
|
67
|
+
normalization: "intentrax-content/1.0";
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export type IntentExecuteRequest = IntentExecuteRequestV10 | IntentExecuteRequestV11;
|
|
56
71
|
|
|
57
72
|
export type ReceiptVerificationRequest = {
|
|
58
73
|
schema_version: "intentrax.runtime.proof_verification.request/1.0";
|
|
@@ -105,6 +120,11 @@ export declare function verificationRequestHash(request: VerifyProofRequest): st
|
|
|
105
120
|
export declare function idempotencyInput(request: VerifyProofRequest): Record<string, unknown>;
|
|
106
121
|
export declare function createIdempotencyKey(request: VerifyProofRequest): string;
|
|
107
122
|
export declare function admissionIdempotencyKeyHash(request: VerifyProofRequest): string;
|
|
123
|
+
/** SHA-256 hex of a raw execute idempotency key: the admission `idempotency_key_hash` that correlates with that execution. */
|
|
124
|
+
export declare function executeIdempotencyKeyHash(idempotencyKey: string): string;
|
|
125
|
+
export declare const AGENT_HOOK_IDEMPOTENCY_KEY_DOMAIN: "INTENTRAX_AGENT_HOOK_IDEMPOTENCY_V1";
|
|
126
|
+
/** The raw execute idempotency key a generated agent hook derives from its admission `request_payload_hash`. */
|
|
127
|
+
export declare function agentHookExecuteIdempotencyKey(requestPayloadHash: string): string;
|
|
108
128
|
export declare function buildVerificationEnvelope(request: VerifyProofRequest): {
|
|
109
129
|
status: "PASS";
|
|
110
130
|
output: {
|
|
@@ -208,6 +228,10 @@ export declare function buildVerifierHandoffEnvelope(request: VerifierHandoffReq
|
|
|
208
228
|
error: SDKError;
|
|
209
229
|
};
|
|
210
230
|
export declare function validateIntentExecuteRequest(request: unknown): string[];
|
|
231
|
+
export declare function bindIntentExecuteOutput(
|
|
232
|
+
request: IntentExecuteRequestFields & { schema_version?: string },
|
|
233
|
+
renderedOutput: string | readonly string[],
|
|
234
|
+
): IntentExecuteRequestV11 & { output_binding: OutputBinding };
|
|
211
235
|
export declare function buildIntentExecuteEnvelope(request: IntentExecuteRequest): {
|
|
212
236
|
status: "PASS";
|
|
213
237
|
output: {
|
|
@@ -317,3 +341,133 @@ export declare function normalizeCanonicalOutput(content: string | readonly stri
|
|
|
317
341
|
export declare function canonicalOutputHash(content: string | readonly string[]): string;
|
|
318
342
|
export declare function buildOutputBinding(content: string | readonly string[]): OutputBinding;
|
|
319
343
|
export declare function verificationPointerMetaTag(pointer: { readonly proof_id: string; readonly verify_url: string }): string | null;
|
|
344
|
+
|
|
345
|
+
// Evidence-quality model: per-dimension assessments, assurance profiles and a
|
|
346
|
+
// verdict derived by a fixed rule (same model as the Go offline verifier).
|
|
347
|
+
export type AssuranceDimension =
|
|
348
|
+
| "RECORD_INTEGRITY"
|
|
349
|
+
| "SIGNER_AUTHENTICITY"
|
|
350
|
+
| "AUTHORIZATION"
|
|
351
|
+
| "EXECUTION_REPORTED"
|
|
352
|
+
| "EXECUTION_ATTESTED"
|
|
353
|
+
| "EFFECT_OBSERVED"
|
|
354
|
+
| "EFFECT_CONFIRMED"
|
|
355
|
+
| "CAUSAL_CHAIN";
|
|
356
|
+
export type AssessmentResult =
|
|
357
|
+
| "VERIFIED"
|
|
358
|
+
| "REPORTED"
|
|
359
|
+
| "ATTESTED"
|
|
360
|
+
| "OBSERVED"
|
|
361
|
+
| "CONFIRMED"
|
|
362
|
+
| "CONTRADICTED"
|
|
363
|
+
| "PENDING"
|
|
364
|
+
| "INSUFFICIENT_EVIDENCE"
|
|
365
|
+
| "NOT_ASSESSED"
|
|
366
|
+
| "NOT_APPLICABLE"
|
|
367
|
+
| "FAILED";
|
|
368
|
+
export type AssessmentProvenance =
|
|
369
|
+
| "SELF_REPORTED"
|
|
370
|
+
| "INTENTRAX_DECISION"
|
|
371
|
+
| "ENFORCEMENT_ATTESTED"
|
|
372
|
+
| "AUTHORITATIVE_SOURCE"
|
|
373
|
+
| "THIRD_PARTY_ATTESTED"
|
|
374
|
+
| "VERIFIER_COMPUTED";
|
|
375
|
+
export type AssuranceProfile =
|
|
376
|
+
| "LEGACY_DECISION_RECORD"
|
|
377
|
+
| "DECISION_RECORD"
|
|
378
|
+
| "AUTHORIZED_AND_ATTESTED"
|
|
379
|
+
| "EFFECT_CONFIRMED"
|
|
380
|
+
| "CAUSAL_CHAIN";
|
|
381
|
+
export type AssuranceVerdict =
|
|
382
|
+
| "VERIFICATION_FAILED"
|
|
383
|
+
| "INTEGRITY_ONLY"
|
|
384
|
+
| "CONFLICTING_EVIDENCE"
|
|
385
|
+
| "PENDING_FINALITY"
|
|
386
|
+
| "INSUFFICIENT_EVIDENCE"
|
|
387
|
+
| "VERIFIED_FOR_SCOPE";
|
|
388
|
+
export type AssuranceLimitationCode =
|
|
389
|
+
| "EXECUTION_NOT_ATTESTED"
|
|
390
|
+
| "EFFECT_NOT_VERIFIED"
|
|
391
|
+
| "POLICY_BINDING_SYNTHETIC"
|
|
392
|
+
| "COMPLETENESS_NOT_ESTABLISHED"
|
|
393
|
+
| "SIGNER_AUTHENTICITY_REQUIRES_PINNED_ANCHORS"
|
|
394
|
+
| "POLICY_EVALUATION_NOT_RECHECKABLE"
|
|
395
|
+
| "POLICY_DECISION_NOT_ENFORCED"
|
|
396
|
+
| "POLICY_CONSTRAINT_NOT_EVALUATED"
|
|
397
|
+
| "POLICY_EVENT_SELF_REPORTED";
|
|
398
|
+
export interface DimensionAssessment {
|
|
399
|
+
readonly dimension: AssuranceDimension;
|
|
400
|
+
readonly result: AssessmentResult;
|
|
401
|
+
readonly provenance: AssessmentProvenance | null;
|
|
402
|
+
readonly reasons: readonly string[];
|
|
403
|
+
readonly limitations: readonly AssuranceLimitationCode[];
|
|
404
|
+
}
|
|
405
|
+
export interface VerificationAssessment {
|
|
406
|
+
readonly schema_version: "intentrax.verification.assessment/0.1";
|
|
407
|
+
readonly assurance_profile: AssuranceProfile;
|
|
408
|
+
readonly required_dimensions: readonly AssuranceDimension[];
|
|
409
|
+
readonly verdict: AssuranceVerdict;
|
|
410
|
+
readonly assessments: readonly DimensionAssessment[];
|
|
411
|
+
readonly limitations: readonly { readonly code: AssuranceLimitationCode; readonly text: string }[];
|
|
412
|
+
}
|
|
413
|
+
export declare const VERIFICATION_ASSESSMENT_SCHEMA_VERSION: "intentrax.verification.assessment/0.1";
|
|
414
|
+
export declare const ASSURANCE_DIMENSIONS: readonly AssuranceDimension[];
|
|
415
|
+
export declare const ASSESSMENT_RESULTS: readonly AssessmentResult[];
|
|
416
|
+
export declare const ASSESSMENT_PROVENANCE: Readonly<Record<AssessmentProvenance, AssessmentProvenance>>;
|
|
417
|
+
export declare const ASSURANCE_PROFILES: Readonly<Record<AssuranceProfile, readonly AssuranceDimension[]>>;
|
|
418
|
+
export declare const ASSURANCE_VERDICTS: Readonly<Record<AssuranceVerdict, AssuranceVerdict>>;
|
|
419
|
+
export declare const ASSURANCE_VERDICT_PRECEDENCE: Readonly<Record<AssuranceVerdict, number>>;
|
|
420
|
+
export declare const ASSURANCE_LIMITATION_TEXT: Readonly<Record<AssuranceLimitationCode, string>>;
|
|
421
|
+
export declare const LEGACY_DECISION_RECORD_LIMITATIONS: readonly AssuranceLimitationCode[];
|
|
422
|
+
export declare function deriveAssuranceVerdict(assessments: Readonly<Partial<Record<AssuranceDimension, AssessmentResult>>>, profile: AssuranceProfile): AssuranceVerdict;
|
|
423
|
+
export declare function signerAuthenticityAssessment(signerTrust: string, keySetSupplied: boolean): { result: AssessmentResult; reasons: string[] };
|
|
424
|
+
/** The policy binding sealed in a proof's signed AEP, as verify-proof reports it. */
|
|
425
|
+
export interface SealedPolicyBindingSummary {
|
|
426
|
+
readonly decision: string;
|
|
427
|
+
readonly constraints?: readonly { readonly constraint_id: string; readonly status: string }[];
|
|
428
|
+
}
|
|
429
|
+
export declare function authorizationAssessment(policyBinding: SealedPolicyBindingSummary | null | undefined, policyReevaluation?: PolicyReevaluationOutcome | null): { result: AssessmentResult; provenance: "INTENTRAX_DECISION" | "VERIFIER_COMPUTED"; reasons: string[]; limitations: AssuranceLimitationCode[] };
|
|
430
|
+
export declare function buildLegacyVerificationAssessment(input: { readonly signerTrust: string; readonly keySetSupplied: boolean; readonly policyBinding?: SealedPolicyBindingSummary | null; readonly policyReevaluation?: PolicyReevaluationOutcome | null }): VerificationAssessment;
|
|
431
|
+
|
|
432
|
+
/** Outcome of re-running a sealed policy evaluation (verify-proof `policy_reevaluation`). */
|
|
433
|
+
export interface PolicyReevaluationOutcome {
|
|
434
|
+
readonly status: "MATCH" | "NOT_RECHECKED";
|
|
435
|
+
readonly reason?: "EVENT_NOT_RECONSTRUCTIBLE" | "POLICY_SOURCE_UNAVAILABLE";
|
|
436
|
+
readonly policy_source?: "PUBLISHED_REGISTRY" | "SUPPLIED_DOCUMENT";
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/** Every value a policy binding seals, recomputed by the TS port of the policy engine. */
|
|
440
|
+
export interface PolicyReevaluationResult {
|
|
441
|
+
readonly policy_id: string;
|
|
442
|
+
readonly policy_version: string;
|
|
443
|
+
readonly source_policy_hash: string;
|
|
444
|
+
readonly compiled_policy_hash: string;
|
|
445
|
+
readonly execution_event_hash: string;
|
|
446
|
+
readonly evaluation_hash: string;
|
|
447
|
+
readonly decision: "COMPLIANT" | "NON_COMPLIANT" | "ERROR";
|
|
448
|
+
readonly rule_id: string;
|
|
449
|
+
readonly error_code: string;
|
|
450
|
+
readonly constraints: readonly { readonly constraint_id: string; readonly type: string }[];
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
export interface CompiledPolicyDocument {
|
|
454
|
+
readonly policy_id: string;
|
|
455
|
+
readonly policy_version: string;
|
|
456
|
+
readonly source_policy_hash: string;
|
|
457
|
+
readonly compiled_policy_hash: string;
|
|
458
|
+
readonly bytecode: unknown;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
export declare const POLICY_HASH_DOMAIN: "INTENTRAX_POLICY_V1";
|
|
462
|
+
export declare const POLICY_BYTECODE_HASH_DOMAIN: "INTENTRAX_BYTECODE_V1";
|
|
463
|
+
export declare const POLICY_VM_TRACE_HASH_DOMAIN: "INTENTRAX_TRACE_V1";
|
|
464
|
+
export declare const POLICY_VM_EVENT_HASH_DOMAIN: "INTENTRAX_POLICY_VM_EVENT_V1";
|
|
465
|
+
export declare const POLICY_VM_EVALUATION_HASH_DOMAIN: "INTENTRAX_POLICY_VM_EVALUATION_V1";
|
|
466
|
+
/** C2.1 -> C2.3: compile a policy document (JSON text). Throws a PolicyReevaluationError on an invalid document. */
|
|
467
|
+
export declare function compilePolicyDocument(policyJSON: string, allowedEventFields: readonly string[]): CompiledPolicyDocument;
|
|
468
|
+
/** C2.4: evaluate a compiled policy over an execution event. */
|
|
469
|
+
export declare function evaluateCompiledPolicy(compiled: CompiledPolicyDocument, event: Record<string, unknown>): PolicyReevaluationResult;
|
|
470
|
+
export declare function reevaluatePolicy(input: { readonly policyJSON: string; readonly allowedEventFields: readonly string[]; readonly event: Record<string, unknown> }): PolicyReevaluationResult;
|
|
471
|
+
export declare function policyExecutionEventHash(event: Record<string, unknown>): string;
|
|
472
|
+
/** Sorted policy_binding.<member> paths the recomputed evaluation disagrees with; empty means it matches. */
|
|
473
|
+
export declare function policyReevaluationMismatches(binding: Pick<PolicyReevaluationResult, "policy_id" | "policy_version" | "source_policy_hash" | "compiled_policy_hash" | "execution_event_hash" | "evaluation_hash" | "decision" | "rule_id" | "constraints">, recomputed: PolicyReevaluationResult): string[];
|