@intentrax/sdk 1.3.0 → 1.7.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/index.d.ts CHANGED
@@ -120,6 +120,11 @@ export declare function verificationRequestHash(request: VerifyProofRequest): st
120
120
  export declare function idempotencyInput(request: VerifyProofRequest): Record<string, unknown>;
121
121
  export declare function createIdempotencyKey(request: VerifyProofRequest): string;
122
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;
123
128
  export declare function buildVerificationEnvelope(request: VerifyProofRequest): {
124
129
  status: "PASS";
125
130
  output: {
@@ -336,3 +341,133 @@ export declare function normalizeCanonicalOutput(content: string | readonly stri
336
341
  export declare function canonicalOutputHash(content: string | readonly string[]): string;
337
342
  export declare function buildOutputBinding(content: string | readonly string[]): OutputBinding;
338
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[];