@emilia-protocol/sdk 0.10.0 → 0.11.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/src/types.ts CHANGED
@@ -433,10 +433,16 @@ export type GuardActionType =
433
433
  | 'benefit_bank_account_change'
434
434
  | 'benefit_address_change'
435
435
  | 'caseworker_override'
436
+ | 'gov.vendor_payment_destination_change'
437
+ | 'gov.disbursement_release'
438
+ | 'gov.grant_disbursement'
439
+ | 'gov.provider_enrollment_change'
440
+ | 'gov.eligibility_override'
436
441
  | 'vendor_bank_account_change'
437
442
  | 'beneficiary_creation'
438
443
  | 'large_payment_release'
439
- | 'ai_agent_payment_action';
444
+ | 'ai_agent_payment_action'
445
+ | 'policy_rollout';
440
446
 
441
447
  export type GuardDecision = 'allow' | 'observe' | 'allow_with_signoff' | 'deny';
442
448
  export type GuardEnforcementMode = 'observe' | 'warn' | 'enforce';
@@ -454,7 +460,7 @@ export interface GuardQuorumApprover {
454
460
  }
455
461
 
456
462
  export interface GuardQuorumPolicy {
457
- mode?: 'threshold' | 'all';
463
+ mode?: 'threshold' | 'ordered';
458
464
  required: number;
459
465
  approvers: GuardQuorumApprover[];
460
466
  }
@@ -462,7 +468,7 @@ export interface GuardQuorumPolicy {
462
468
  export interface CreateTrustReceiptParams {
463
469
  /** Optional cross-check; the API derives the authorized organization from the authenticated key. */
464
470
  organizationId?: string;
465
- actionType: GuardActionType | string;
471
+ actionType: GuardActionType;
466
472
  targetResourceId: string;
467
473
  policyId?: string;
468
474
  enforcementMode?: GuardEnforcementMode;
@@ -556,6 +562,7 @@ export interface ConsumeTrustReceiptResult {
556
562
 
557
563
  export interface AttestExecutionParams {
558
564
  executedAction: Record<string, unknown>;
565
+ observedAction: Record<string, unknown>;
559
566
  executingSystem: string;
560
567
  executionId?: string;
561
568
  executedAt?: string;
@@ -625,12 +632,13 @@ export interface RequireReceiptParams extends CreateTrustReceiptParams {
625
632
  * returning. If omitted, the SDK fails closed and does not run the mutation.
626
633
  */
627
634
  onSignoffRequired?: (ctx: SignoffRequiredContext) => Promise<void | boolean | { approved?: boolean }>;
635
+ /** Legacy explicit execution report. Prefer observedAction for new integrations. */
636
+ executedAction?: Record<string, unknown> | ((ctx: { receipt: TrustReceipt; result: unknown }) => Record<string, unknown>);
628
637
  /**
629
- * Canonical action that actually executed. Defaults to the receipt's
630
- * canonical_action, which should match when the wrapped mutation followed the
631
- * approved plan.
638
+ * Action fields independently observed by the executor after mutation. If
639
+ * omitted, no execution attestation is emitted.
632
640
  */
633
- executedAction?: Record<string, unknown> | ((ctx: { receipt: TrustReceipt; result: unknown }) => Record<string, unknown>);
641
+ observedAction?: Record<string, unknown> | ((ctx: { receipt: TrustReceipt; result: unknown }) => Record<string, unknown>);
634
642
  executionId?: string | ((result: unknown) => string | undefined);
635
643
  fetchEvidence?: boolean;
636
644
  }
@@ -640,7 +648,8 @@ export interface RequireReceiptResult<T> {
640
648
  receipt: TrustReceipt;
641
649
  signoff?: SignoffRequest;
642
650
  consume: ConsumeTrustReceiptResult;
643
- execution: ExecutionAttestation;
651
+ execution?: ExecutionAttestation;
652
+ executionStatus: 'attested' | 'unobserved';
644
653
  evidence?: TrustReceiptEvidence;
645
654
  }
646
655
 
@@ -691,16 +700,6 @@ export interface LineageResult {
691
700
  }>;
692
701
  }
693
702
 
694
- /** Result of a batch receipt submission. */
695
- export interface BatchReceiptResult {
696
- results: Array<{
697
- entity_id: string;
698
- success: boolean;
699
- receipt_id?: string;
700
- error?: string;
701
- }>;
702
- }
703
-
704
703
  /** Result of a bilateral receipt confirmation. */
705
704
  export interface ConfirmReceiptResult {
706
705
  receipt_id: string;
@@ -716,7 +715,7 @@ export interface TrustPolicyDefinition {
716
715
  min_confidence?: ConfidenceTier;
717
716
  }
718
717
 
719
- /** Public proof metrics from /api/stats. */
718
+ /** Authenticated operator metrics from /api/stats. */
720
719
  export interface EPStats {
721
720
  total_entities: number;
722
721
  trust_surfaces: number;