@voyantjs/action-ledger 0.52.2

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,0BAA0B,oJAWrC,CAAA;AAEF,eAAO,MAAM,sBAAsB,wLAYjC,CAAA;AAEF,eAAO,MAAM,oBAAoB,6EAK/B,CAAA;AAEF,eAAO,MAAM,6BAA6B,0FAMxC,CAAA;AAEF,eAAO,MAAM,2BAA2B,uGAMtC,CAAA;AAEF,eAAO,MAAM,+BAA+B,6FAK1C,CAAA;AAEF,eAAO,MAAM,8BAA8B,+GAOzC,CAAA;AAEF,eAAO,MAAM,4BAA4B,0FAKvC,CAAA;AAEF,eAAO,MAAM,6BAA6B,iIAQxC,CAAA;AAEF,eAAO,MAAM,+BAA+B,qEAI1C,CAAA;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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eAAe,CAAC,YAAY,CAAA;AACnE,MAAM,MAAM,mBAAmB,GAAG,OAAO,oBAAoB,CAAC,YAAY,CAAA;AAC1E,MAAM,MAAM,sBAAsB,GAAG,OAAO,oBAAoB,CAAC,YAAY,CAAA"}
package/dist/schema.js ADDED
@@ -0,0 +1,237 @@
1
+ import { typeId } from "@voyantjs/db";
2
+ import { sql } from "drizzle-orm";
3
+ import { boolean, index, integer, jsonb, pgEnum, pgTable, text, timestamp, uniqueIndex, } from "drizzle-orm/pg-core";
4
+ export const actionLedgerActionKindEnum = pgEnum("action_ledger_action_kind", [
5
+ "read",
6
+ "create",
7
+ "update",
8
+ "delete",
9
+ "execute",
10
+ "approve",
11
+ "reject",
12
+ "reverse",
13
+ "compensate",
14
+ "duplicate",
15
+ ]);
16
+ export const actionLedgerStatusEnum = pgEnum("action_ledger_status", [
17
+ "requested",
18
+ "awaiting_approval",
19
+ "approved",
20
+ "denied",
21
+ "succeeded",
22
+ "failed",
23
+ "reversed",
24
+ "compensated",
25
+ "expired",
26
+ "cancelled",
27
+ "superseded",
28
+ ]);
29
+ export const actionLedgerRiskEnum = pgEnum("action_ledger_risk", [
30
+ "low",
31
+ "medium",
32
+ "high",
33
+ "critical",
34
+ ]);
35
+ export const actionLedgerPrincipalTypeEnum = pgEnum("action_ledger_principal_type", [
36
+ "user",
37
+ "api_key",
38
+ "agent",
39
+ "workflow",
40
+ "system",
41
+ ]);
42
+ export const actionLedgerRelayStatusEnum = pgEnum("action_ledger_relay_status", [
43
+ "pending",
44
+ "processing",
45
+ "succeeded",
46
+ "failed",
47
+ "dead_letter",
48
+ ]);
49
+ export const actionLedgerRedactionStatusEnum = pgEnum("action_ledger_redaction_status", [
50
+ "none",
51
+ "redacted",
52
+ "tombstoned",
53
+ "crypto_shredded",
54
+ ]);
55
+ export const actionLedgerApprovalStatusEnum = pgEnum("action_ledger_approval_status", [
56
+ "pending",
57
+ "approved",
58
+ "denied",
59
+ "expired",
60
+ "cancelled",
61
+ "superseded",
62
+ ]);
63
+ export const actionLedgerReversalKindEnum = pgEnum("action_ledger_reversal_kind", [
64
+ "none",
65
+ "revert",
66
+ "compensate",
67
+ "domain_command",
68
+ ]);
69
+ export const actionLedgerReversalStateEnum = pgEnum("action_ledger_reversal_state", [
70
+ "not_reversible",
71
+ "available",
72
+ "requested",
73
+ "running",
74
+ "completed",
75
+ "failed",
76
+ "expired",
77
+ ]);
78
+ export const actionLedgerReversalOutcomeEnum = pgEnum("action_ledger_reversal_outcome", [
79
+ "full",
80
+ "partial",
81
+ "failed",
82
+ ]);
83
+ export const actionLedgerEntries = pgTable("action_ledger_entries", {
84
+ id: typeId("action_ledger_entries"),
85
+ occurredAt: timestamp("occurred_at", { withTimezone: true }).notNull().defaultNow(),
86
+ actionName: text("action_name").notNull(),
87
+ actionVersion: text("action_version").notNull(),
88
+ actionKind: actionLedgerActionKindEnum("action_kind").notNull(),
89
+ status: actionLedgerStatusEnum("status").notNull(),
90
+ evaluatedRisk: actionLedgerRiskEnum("evaluated_risk").notNull(),
91
+ actorType: text("actor_type"),
92
+ principalType: actionLedgerPrincipalTypeEnum("principal_type").notNull(),
93
+ principalId: text("principal_id").notNull(),
94
+ principalSubtype: text("principal_subtype"),
95
+ sessionId: text("session_id"),
96
+ apiTokenId: text("api_token_id"),
97
+ internalRequest: boolean("internal_request").notNull().default(false),
98
+ delegatedByPrincipalType: actionLedgerPrincipalTypeEnum("delegated_by_principal_type"),
99
+ delegatedByPrincipalId: text("delegated_by_principal_id"),
100
+ delegationId: text("delegation_id"),
101
+ callerType: text("caller_type"),
102
+ organizationId: text("organization_id"),
103
+ routeOrToolName: text("route_or_tool_name"),
104
+ workflowRunId: text("workflow_run_id"),
105
+ workflowStepId: text("workflow_step_id"),
106
+ correlationId: text("correlation_id"),
107
+ causationActionId: text("causation_action_id"),
108
+ idempotencyScope: text("idempotency_scope"),
109
+ idempotencyKey: text("idempotency_key"),
110
+ idempotencyFingerprint: text("idempotency_fingerprint"),
111
+ targetType: text("target_type").notNull(),
112
+ targetId: text("target_id").notNull(),
113
+ capabilityId: text("capability_id"),
114
+ capabilityVersion: text("capability_version"),
115
+ authorizationSource: text("authorization_source"),
116
+ approvalId: text("approval_id"),
117
+ amendsActionId: text("amends_action_id"),
118
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
119
+ }, (table) => [
120
+ index("idx_action_ledger_entries_principal").on(table.principalType, table.principalId, table.occurredAt),
121
+ index("idx_action_ledger_entries_api_token").on(table.apiTokenId, table.occurredAt),
122
+ index("idx_action_ledger_entries_session").on(table.sessionId, table.occurredAt),
123
+ index("idx_action_ledger_entries_target").on(table.targetType, table.targetId, table.occurredAt),
124
+ index("idx_action_ledger_entries_workflow").on(table.workflowRunId, table.workflowStepId, table.occurredAt),
125
+ index("idx_action_ledger_entries_correlation").on(table.correlationId, table.occurredAt),
126
+ index("idx_action_ledger_entries_causation").on(table.causationActionId),
127
+ index("idx_action_ledger_entries_control_state").on(table.evaluatedRisk, table.status, table.occurredAt),
128
+ index("idx_action_ledger_entries_capability").on(table.capabilityId, table.capabilityVersion, table.occurredAt),
129
+ uniqueIndex("idx_action_ledger_entries_idempotency")
130
+ .on(table.idempotencyScope, table.actionName, table.targetType, table.targetId, table.idempotencyKey)
131
+ .where(sql `
132
+ ${table.idempotencyKey} IS NOT NULL
133
+ `),
134
+ ]);
135
+ export const actionLedgerRelayOutbox = pgTable("action_ledger_outbox", {
136
+ id: typeId("action_ledger_outbox"),
137
+ actionId: text("action_id")
138
+ .notNull()
139
+ .references(() => actionLedgerEntries.id, { onDelete: "cascade" }),
140
+ organizationId: text("organization_id"),
141
+ relayStatus: actionLedgerRelayStatusEnum("relay_status").notNull().default("pending"),
142
+ payloadRef: text("payload_ref"),
143
+ attemptCount: integer("attempt_count").notNull().default(0),
144
+ nextRetryAt: timestamp("next_retry_at", { withTimezone: true }),
145
+ lastError: text("last_error"),
146
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
147
+ processedAt: timestamp("processed_at", { withTimezone: true }),
148
+ }, (table) => [
149
+ index("idx_action_ledger_outbox_action").on(table.actionId),
150
+ index("idx_action_ledger_outbox_status_retry").on(table.relayStatus, table.nextRetryAt),
151
+ ]);
152
+ export const actionDelegations = pgTable("action_delegations", {
153
+ id: typeId("action_delegations"),
154
+ rootPrincipalType: actionLedgerPrincipalTypeEnum("root_principal_type").notNull(),
155
+ rootPrincipalId: text("root_principal_id").notNull(),
156
+ parentPrincipalType: actionLedgerPrincipalTypeEnum("parent_principal_type").notNull(),
157
+ parentPrincipalId: text("parent_principal_id").notNull(),
158
+ childPrincipalType: actionLedgerPrincipalTypeEnum("child_principal_type").notNull(),
159
+ childPrincipalId: text("child_principal_id").notNull(),
160
+ grantSource: text("grant_source").notNull(),
161
+ capabilityScopeRef: text("capability_scope_ref"),
162
+ budgetScopeRef: text("budget_scope_ref"),
163
+ expiresAt: timestamp("expires_at", { withTimezone: true }),
164
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
165
+ }, (table) => [
166
+ index("idx_action_delegations_root").on(table.rootPrincipalType, table.rootPrincipalId),
167
+ index("idx_action_delegations_child").on(table.childPrincipalType, table.childPrincipalId),
168
+ index("idx_action_delegations_parent").on(table.parentPrincipalType, table.parentPrincipalId),
169
+ ]);
170
+ export const actionMutationDetails = pgTable("action_mutation_details", {
171
+ actionId: text("action_id")
172
+ .primaryKey()
173
+ .references(() => actionLedgerEntries.id, { onDelete: "cascade" }),
174
+ commandInputRef: text("command_input_ref"),
175
+ commandResultRef: text("command_result_ref"),
176
+ summary: text("summary"),
177
+ reversalKind: actionLedgerReversalKindEnum("reversal_kind").notNull().default("none"),
178
+ reversalCommandId: text("reversal_command_id"),
179
+ reversalCommandVersion: text("reversal_command_version"),
180
+ reversalArgsRef: text("reversal_args_ref"),
181
+ reversalStateProjection: actionLedgerReversalStateEnum("reversal_state_projection"),
182
+ reversalOutcomeProjection: actionLedgerReversalOutcomeEnum("reversal_outcome_projection"),
183
+ reversesActionId: text("reverses_action_id"),
184
+ reversedByActionIdProjection: text("reversed_by_action_id_projection"),
185
+ }, (table) => [
186
+ index("idx_action_mutation_details_reverses").on(table.reversesActionId),
187
+ index("idx_action_mutation_details_reversal_state").on(table.reversalStateProjection),
188
+ ]);
189
+ export const actionSensitiveReadDetails = pgTable("action_sensitive_read_details", {
190
+ actionId: text("action_id")
191
+ .primaryKey()
192
+ .references(() => actionLedgerEntries.id, { onDelete: "cascade" }),
193
+ reasonCode: text("reason_code"),
194
+ disclosedFieldSet: jsonb("disclosed_field_set").$type(),
195
+ disclosureSummary: text("disclosure_summary"),
196
+ decisionPolicy: text("decision_policy"),
197
+ });
198
+ export const actionApprovals = pgTable("action_approvals", {
199
+ id: typeId("action_approvals"),
200
+ requestedActionId: text("requested_action_id")
201
+ .notNull()
202
+ .references(() => actionLedgerEntries.id, { onDelete: "cascade" }),
203
+ status: actionLedgerApprovalStatusEnum("status").notNull().default("pending"),
204
+ requestedByPrincipalId: text("requested_by_principal_id").notNull(),
205
+ assignedToPrincipalId: text("assigned_to_principal_id"),
206
+ decidedByPrincipalId: text("decided_by_principal_id"),
207
+ delegatedFromPrincipalId: text("delegated_from_principal_id"),
208
+ policyName: text("policy_name").notNull(),
209
+ policyVersion: text("policy_version").notNull(),
210
+ targetSnapshotRef: text("target_snapshot_ref"),
211
+ riskSnapshot: actionLedgerRiskEnum("risk_snapshot").notNull(),
212
+ reasonCode: text("reason_code"),
213
+ expiresAt: timestamp("expires_at", { withTimezone: true }),
214
+ decidedAt: timestamp("decided_at", { withTimezone: true }),
215
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
216
+ }, (table) => [
217
+ index("idx_action_approvals_requested_action").on(table.requestedActionId),
218
+ index("idx_action_approvals_status_expires").on(table.status, table.expiresAt),
219
+ index("idx_action_approvals_assignee").on(table.assignedToPrincipalId, table.createdAt),
220
+ ]);
221
+ export const actionLedgerPayloads = pgTable("action_ledger_payloads", {
222
+ id: typeId("action_ledger_payloads"),
223
+ actionId: text("action_id")
224
+ .notNull()
225
+ .references(() => actionLedgerEntries.id, { onDelete: "cascade" }),
226
+ payloadKind: text("payload_kind").notNull(),
227
+ schemaTag: text("schema_tag").notNull(),
228
+ redactionStatus: actionLedgerRedactionStatusEnum("redaction_status").notNull().default("none"),
229
+ retentionPolicy: text("retention_policy").notNull(),
230
+ storageRef: text("storage_ref").notNull(),
231
+ hash: text("hash"),
232
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
233
+ expiresAt: timestamp("expires_at", { withTimezone: true }),
234
+ }, (table) => [
235
+ index("idx_action_ledger_payloads_action").on(table.actionId),
236
+ index("idx_action_ledger_payloads_expiry").on(table.expiresAt),
237
+ ]);
@@ -0,0 +1,317 @@
1
+ import { type AnyDrizzleDb } from "@voyantjs/db";
2
+ import { type SQL } from "drizzle-orm";
3
+ import { type ActionApproval, type ActionDelegation, type ActionLedgerEntry, type ActionLedgerPayload, type ActionLedgerRelayOutbox, type ActionMutationDetail, type ActionSensitiveReadDetail, type NewActionLedgerEntry, type NewActionLedgerPayload, type NewActionMutationDetail, type NewActionSensitiveReadDetail } from "./schema.js";
4
+ export declare class ActionLedgerIdempotencyConflictError extends Error {
5
+ readonly existingActionId: string;
6
+ constructor(existingActionId: string);
7
+ }
8
+ export declare class ActionApprovalDecisionConflictError extends Error {
9
+ readonly approvalId: string;
10
+ readonly currentStatus: ActionApproval["status"];
11
+ constructor(approvalId: string, currentStatus: ActionApproval["status"]);
12
+ }
13
+ export declare class ActionApprovalDecisionStatusError extends Error {
14
+ readonly status: string;
15
+ constructor(status: string);
16
+ }
17
+ export declare class ActionLedgerReversalTargetError extends Error {
18
+ readonly actionId: string;
19
+ readonly reason: "missing_mutation_detail" | "not_reversible";
20
+ constructor(actionId: string, reason: "missing_mutation_detail" | "not_reversible");
21
+ }
22
+ export interface AppendActionLedgerEntryInput extends Omit<NewActionLedgerEntry, "id" | "createdAt" | "occurredAt"> {
23
+ occurredAt?: Date;
24
+ mutationDetail?: Omit<NewActionMutationDetail, "actionId">;
25
+ sensitiveReadDetail?: Omit<NewActionSensitiveReadDetail, "actionId">;
26
+ payloads?: Omit<NewActionLedgerPayload, "id" | "actionId">[];
27
+ enqueueRelay?: boolean | {
28
+ payloadRef?: string | null;
29
+ };
30
+ }
31
+ export interface AppendActionLedgerEntryResult {
32
+ entry: ActionLedgerEntry;
33
+ replayed: boolean;
34
+ }
35
+ export interface RequestActionApprovalInput {
36
+ requestedAction: Omit<AppendActionLedgerEntryInput, "approvalId" | "status">;
37
+ approval: {
38
+ requestedByPrincipalId?: string | null;
39
+ assignedToPrincipalId?: string | null;
40
+ delegatedFromPrincipalId?: string | null;
41
+ policyName: string;
42
+ policyVersion: string;
43
+ targetSnapshotRef?: string | null;
44
+ riskSnapshot?: ActionApproval["riskSnapshot"] | null;
45
+ reasonCode?: string | null;
46
+ expiresAt?: Date | string | null;
47
+ };
48
+ }
49
+ export interface RequestActionApprovalResult {
50
+ requestedAction: ActionLedgerEntry;
51
+ approval: ActionApproval;
52
+ replayed: boolean;
53
+ }
54
+ type ApprovalDecisionStatus = Exclude<ActionApproval["status"], "pending">;
55
+ export interface DecideActionApprovalInput {
56
+ id: string;
57
+ status: ApprovalDecisionStatus;
58
+ decidedByPrincipalId: string;
59
+ decidedAt?: Date | string | null;
60
+ decisionAction: Omit<AppendActionLedgerEntryInput, "actionKind" | "approvalId" | "causationActionId" | "evaluatedRisk" | "status" | "targetId" | "targetType"> & Partial<Pick<AppendActionLedgerEntryInput, "actionKind" | "evaluatedRisk" | "status" | "targetId" | "targetType">>;
61
+ }
62
+ export interface DecideActionApprovalResult {
63
+ approval: ActionApproval;
64
+ decisionAction: ActionLedgerEntry;
65
+ }
66
+ type ActionLedgerReversalState = NonNullable<ActionMutationDetail["reversalStateProjection"]>;
67
+ type ActionLedgerReversalOutcome = NonNullable<ActionMutationDetail["reversalOutcomeProjection"]>;
68
+ export interface RecordActionLedgerReversalInput {
69
+ originalActionId: string;
70
+ reversalAction: Omit<AppendActionLedgerEntryInput, "causationActionId" | "mutationDetail"> & {
71
+ mutationDetail?: Omit<NewActionMutationDetail, "actionId" | "reversesActionId">;
72
+ };
73
+ projection?: {
74
+ reversalState?: ActionLedgerReversalState | null;
75
+ reversalOutcome?: ActionLedgerReversalOutcome | null;
76
+ };
77
+ }
78
+ export interface RecordActionLedgerReversalResult {
79
+ originalAction: ActionLedgerEntry;
80
+ originalMutationDetail: ActionMutationDetail;
81
+ reversalAction: ActionLedgerEntry;
82
+ replayed: boolean;
83
+ }
84
+ export interface ActionLedgerListCursor {
85
+ occurredAt: string;
86
+ id: string;
87
+ }
88
+ export interface ActionLedgerRelayOutboxListCursor {
89
+ createdAt: string;
90
+ id: string;
91
+ }
92
+ export interface ActionApprovalListCursor {
93
+ createdAt: string;
94
+ id: string;
95
+ }
96
+ export interface ActionDelegationListCursor {
97
+ createdAt: string;
98
+ id: string;
99
+ }
100
+ export interface ListActionLedgerEntriesInput {
101
+ actionName?: string | null;
102
+ actionKind?: ActionLedgerEntry["actionKind"];
103
+ actorType?: string | null;
104
+ principalType?: ActionLedgerEntry["principalType"];
105
+ principalId?: string | null;
106
+ apiTokenId?: string | null;
107
+ sessionId?: string | null;
108
+ callerType?: string | null;
109
+ organizationId?: string | null;
110
+ targetType?: string | null;
111
+ targetId?: string | null;
112
+ targetIds?: string[] | null;
113
+ routeOrToolName?: string | null;
114
+ workflowRunId?: string | null;
115
+ workflowStepId?: string | null;
116
+ correlationId?: string | null;
117
+ causationActionId?: string | null;
118
+ capabilityId?: string | null;
119
+ capabilityVersion?: string | null;
120
+ authorizationSource?: string | null;
121
+ approvalId?: string | null;
122
+ amendsActionId?: string | null;
123
+ idempotencyScope?: string | null;
124
+ idempotencyKey?: string | null;
125
+ evaluatedRisk?: ActionLedgerEntry["evaluatedRisk"] | ActionLedgerEntry["evaluatedRisk"][];
126
+ status?: ActionLedgerEntry["status"] | ActionLedgerEntry["status"][];
127
+ reversalKind?: ActionMutationDetail["reversalKind"] | ActionMutationDetail["reversalKind"][];
128
+ reversalState?: NonNullable<ActionMutationDetail["reversalStateProjection"]> | NonNullable<ActionMutationDetail["reversalStateProjection"]>[];
129
+ reversalOutcome?: NonNullable<ActionMutationDetail["reversalOutcomeProjection"]> | NonNullable<ActionMutationDetail["reversalOutcomeProjection"]>[];
130
+ reversesActionId?: string | null;
131
+ reversedByActionId?: string | null;
132
+ sensitiveReasonCode?: string | null;
133
+ decisionPolicy?: string | null;
134
+ occurredAtFrom?: Date | string | null;
135
+ occurredAtTo?: Date | string | null;
136
+ cursor?: ActionLedgerListCursor | null;
137
+ limit?: number;
138
+ }
139
+ export interface ListActionLedgerEntriesResult {
140
+ entries: ActionLedgerEntry[];
141
+ nextCursor: ActionLedgerListCursor | null;
142
+ }
143
+ export interface ListActionLedgerRelayOutboxInput {
144
+ actionId?: string | null;
145
+ organizationId?: string | null;
146
+ relayStatus?: ActionLedgerRelayOutbox["relayStatus"] | ActionLedgerRelayOutbox["relayStatus"][];
147
+ dueBefore?: Date | string | null;
148
+ createdAtFrom?: Date | string | null;
149
+ createdAtTo?: Date | string | null;
150
+ processedAtFrom?: Date | string | null;
151
+ processedAtTo?: Date | string | null;
152
+ cursor?: ActionLedgerRelayOutboxListCursor | null;
153
+ limit?: number;
154
+ }
155
+ export interface ListActionLedgerRelayOutboxResult {
156
+ rows: ActionLedgerRelayOutbox[];
157
+ nextCursor: ActionLedgerRelayOutboxListCursor | null;
158
+ }
159
+ export interface ListActionApprovalsInput {
160
+ requestedActionId?: string | null;
161
+ status?: ActionApproval["status"] | ActionApproval["status"][];
162
+ requestedByPrincipalId?: string | null;
163
+ assignedToPrincipalId?: string | null;
164
+ decidedByPrincipalId?: string | null;
165
+ delegatedFromPrincipalId?: string | null;
166
+ policyName?: string | null;
167
+ policyVersion?: string | null;
168
+ riskSnapshot?: ActionApproval["riskSnapshot"] | ActionApproval["riskSnapshot"][];
169
+ reasonCode?: string | null;
170
+ expiresAtFrom?: Date | string | null;
171
+ expiresAtTo?: Date | string | null;
172
+ decidedAtFrom?: Date | string | null;
173
+ decidedAtTo?: Date | string | null;
174
+ createdAtFrom?: Date | string | null;
175
+ createdAtTo?: Date | string | null;
176
+ cursor?: ActionApprovalListCursor | null;
177
+ limit?: number;
178
+ }
179
+ export interface ListActionApprovalsResult {
180
+ approvals: ActionApproval[];
181
+ nextCursor: ActionApprovalListCursor | null;
182
+ }
183
+ export interface ListActionDelegationsInput {
184
+ rootPrincipalType?: ActionDelegation["rootPrincipalType"];
185
+ rootPrincipalId?: string | null;
186
+ parentPrincipalType?: ActionDelegation["parentPrincipalType"];
187
+ parentPrincipalId?: string | null;
188
+ childPrincipalType?: ActionDelegation["childPrincipalType"];
189
+ childPrincipalId?: string | null;
190
+ grantSource?: string | null;
191
+ capabilityScopeRef?: string | null;
192
+ budgetScopeRef?: string | null;
193
+ expiresAtFrom?: Date | string | null;
194
+ expiresAtTo?: Date | string | null;
195
+ createdAtFrom?: Date | string | null;
196
+ createdAtTo?: Date | string | null;
197
+ cursor?: ActionDelegationListCursor | null;
198
+ limit?: number;
199
+ }
200
+ export interface ListActionDelegationsResult {
201
+ delegations: ActionDelegation[];
202
+ nextCursor: ActionDelegationListCursor | null;
203
+ }
204
+ export interface ClaimActionLedgerRelayOutboxInput {
205
+ organizationId?: string | null;
206
+ dueAt?: Date | string | null;
207
+ limit?: number;
208
+ }
209
+ export interface ClaimActionLedgerRelayOutboxResult {
210
+ rows: ActionLedgerRelayOutbox[];
211
+ }
212
+ export interface MarkActionLedgerRelayOutboxSucceededInput {
213
+ id: string;
214
+ processedAt?: Date | string | null;
215
+ }
216
+ export interface MarkActionLedgerRelayOutboxFailedInput {
217
+ id: string;
218
+ lastError: string;
219
+ nextRetryAt?: Date | string | null;
220
+ deadLetter?: boolean;
221
+ processedAt?: Date | string | null;
222
+ }
223
+ export interface GetActionLedgerEntryResult {
224
+ entry: ActionLedgerEntry;
225
+ mutationDetail: ActionMutationDetail | null;
226
+ sensitiveReadDetail: ActionSensitiveReadDetail | null;
227
+ payloads: ActionLedgerPayload[];
228
+ relayOutbox: ActionLedgerRelayOutbox[];
229
+ }
230
+ export interface GetActionApprovalResult {
231
+ approval: ActionApproval;
232
+ requestedAction: GetActionLedgerEntryResult | null;
233
+ }
234
+ export type ValidateApprovedActionFailureReason = "not_found" | "not_approved" | "expired" | "mismatched_action" | "already_executed" | "missing_fingerprint" | "fingerprint_mismatch" | "principal_mismatch";
235
+ export interface ValidateApprovedActionInput {
236
+ approvalId: string;
237
+ actionName: string;
238
+ actionVersion: string;
239
+ requestedActionKind?: ActionLedgerEntry["actionKind"] | null;
240
+ requestedActionStatus?: ActionLedgerEntry["status"] | ActionLedgerEntry["status"][] | null;
241
+ targetType: string;
242
+ targetId: string;
243
+ routeOrToolName?: string | null;
244
+ principalType?: ActionLedgerEntry["principalType"] | null;
245
+ principalId?: string | null;
246
+ idempotencyFingerprint: string;
247
+ executionActionKind?: ActionLedgerEntry["actionKind"];
248
+ executionStatus?: ActionLedgerEntry["status"];
249
+ now?: Date | string | null;
250
+ }
251
+ export type ValidateApprovedActionResult = {
252
+ ok: true;
253
+ approval: ActionApproval;
254
+ requestedAction: ActionLedgerEntry;
255
+ idempotencyFingerprint: string;
256
+ } | {
257
+ ok: false;
258
+ reason: ValidateApprovedActionFailureReason;
259
+ approval?: ActionApproval;
260
+ requestedAction?: ActionLedgerEntry;
261
+ status?: ActionApproval["status"];
262
+ existingActionId?: string;
263
+ };
264
+ export interface GetActionDelegationResult {
265
+ delegation: ActionDelegation;
266
+ }
267
+ export declare const actionLedgerService: {
268
+ appendEntry(db: AnyDrizzleDb, input: AppendActionLedgerEntryInput): Promise<AppendActionLedgerEntryResult>;
269
+ requestApproval(db: AnyDrizzleDb, input: RequestActionApprovalInput): Promise<RequestActionApprovalResult>;
270
+ decideApproval(db: AnyDrizzleDb, input: DecideActionApprovalInput): Promise<DecideActionApprovalResult | null>;
271
+ recordReversal(db: AnyDrizzleDb, input: RecordActionLedgerReversalInput): Promise<RecordActionLedgerReversalResult | null>;
272
+ listEntries(db: AnyDrizzleDb, input?: ListActionLedgerEntriesInput): Promise<ListActionLedgerEntriesResult>;
273
+ listRelayOutbox(db: AnyDrizzleDb, input?: ListActionLedgerRelayOutboxInput): Promise<ListActionLedgerRelayOutboxResult>;
274
+ listApprovals(db: AnyDrizzleDb, input?: ListActionApprovalsInput): Promise<ListActionApprovalsResult>;
275
+ listDelegations(db: AnyDrizzleDb, input?: ListActionDelegationsInput): Promise<ListActionDelegationsResult>;
276
+ getApproval(db: AnyDrizzleDb, id: string): Promise<GetActionApprovalResult | null>;
277
+ validateApprovedAction(db: AnyDrizzleDb, input: ValidateApprovedActionInput): Promise<ValidateApprovedActionResult>;
278
+ getDelegation(db: AnyDrizzleDb, id: string): Promise<GetActionDelegationResult | null>;
279
+ claimRelayOutbox(db: AnyDrizzleDb, input?: ClaimActionLedgerRelayOutboxInput): Promise<ClaimActionLedgerRelayOutboxResult>;
280
+ markRelayOutboxSucceeded(db: AnyDrizzleDb, input: MarkActionLedgerRelayOutboxSucceededInput): Promise<ActionLedgerRelayOutbox | null>;
281
+ markRelayOutboxFailed(db: AnyDrizzleDb, input: MarkActionLedgerRelayOutboxFailedInput): Promise<ActionLedgerRelayOutbox | null>;
282
+ getEntry(db: AnyDrizzleDb, id: string): Promise<GetActionLedgerEntryResult | null>;
283
+ };
284
+ declare function normalizeListLimit(limit: number | undefined): number;
285
+ declare function toActionLedgerListCursor(entry: Pick<ActionLedgerEntry, "occurredAt" | "id">): {
286
+ occurredAt: string;
287
+ id: string;
288
+ };
289
+ declare function toActionLedgerRelayOutboxListCursor(row: Pick<ActionLedgerRelayOutbox, "createdAt" | "id">): {
290
+ createdAt: string;
291
+ id: string;
292
+ };
293
+ declare function toActionApprovalListCursor(row: Pick<ActionApproval, "createdAt" | "id">): {
294
+ createdAt: string;
295
+ id: string;
296
+ };
297
+ declare function toActionDelegationListCursor(row: Pick<ActionDelegation, "createdAt" | "id">): {
298
+ createdAt: string;
299
+ id: string;
300
+ };
301
+ declare function buildActionDelegationsPredicate(input: ListActionDelegationsInput): SQL | undefined;
302
+ declare function buildActionApprovalsPredicate(input: ListActionApprovalsInput): SQL | undefined;
303
+ declare function buildActionLedgerRelayOutboxPredicate(input: ListActionLedgerRelayOutboxInput): SQL | undefined;
304
+ declare function buildActionLedgerEntriesPredicate(input: ListActionLedgerEntriesInput): SQL | undefined;
305
+ export declare const __test__: {
306
+ buildActionApprovalsPredicate: typeof buildActionApprovalsPredicate;
307
+ buildActionDelegationsPredicate: typeof buildActionDelegationsPredicate;
308
+ buildActionLedgerEntriesPredicate: typeof buildActionLedgerEntriesPredicate;
309
+ buildActionLedgerRelayOutboxPredicate: typeof buildActionLedgerRelayOutboxPredicate;
310
+ normalizeListLimit: typeof normalizeListLimit;
311
+ toActionApprovalListCursor: typeof toActionApprovalListCursor;
312
+ toActionDelegationListCursor: typeof toActionDelegationListCursor;
313
+ toActionLedgerListCursor: typeof toActionLedgerListCursor;
314
+ toActionLedgerRelayOutboxListCursor: typeof toActionLedgerRelayOutboxListCursor;
315
+ };
316
+ export {};
317
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,cAAc,CAAA;AACvD,OAAO,EAA4C,KAAK,GAAG,EAAO,MAAM,aAAa,CAAA;AAErF,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAS9B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EAClC,MAAM,aAAa,CAAA;AAKpB,qBAAa,oCAAqC,SAAQ,KAAK;IAC7D,QAAQ,CAAC,gBAA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