@vorim/sdk 3.12.0 → 3.16.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/dist/index.cjs +14 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/anthropic.d.cts +1 -1
- package/dist/integrations/anthropic.d.ts +1 -1
- package/dist/integrations/ap2.d.cts +1 -1
- package/dist/integrations/ap2.d.ts +1 -1
- package/dist/integrations/aws-iam.cjs +225 -0
- package/dist/integrations/aws-iam.cjs.map +1 -0
- package/dist/integrations/aws-iam.d.cts +156 -0
- package/dist/integrations/aws-iam.d.ts +156 -0
- package/dist/integrations/aws-iam.js +199 -0
- package/dist/integrations/aws-iam.js.map +1 -0
- package/dist/integrations/bank-rails.d.cts +1 -1
- package/dist/integrations/bank-rails.d.ts +1 -1
- package/dist/integrations/circle.d.cts +1 -1
- package/dist/integrations/circle.d.ts +1 -1
- package/dist/integrations/cloudflare.d.cts +1 -1
- package/dist/integrations/cloudflare.d.ts +1 -1
- package/dist/integrations/coinbase-cdp.cjs +230 -0
- package/dist/integrations/coinbase-cdp.cjs.map +1 -0
- package/dist/integrations/coinbase-cdp.d.cts +169 -0
- package/dist/integrations/coinbase-cdp.d.ts +169 -0
- package/dist/integrations/coinbase-cdp.js +204 -0
- package/dist/integrations/coinbase-cdp.js.map +1 -0
- package/dist/integrations/crewai.d.cts +1 -1
- package/dist/integrations/crewai.d.ts +1 -1
- package/dist/integrations/entra.cjs +225 -0
- package/dist/integrations/entra.cjs.map +1 -0
- package/dist/integrations/entra.d.cts +155 -0
- package/dist/integrations/entra.d.ts +155 -0
- package/dist/integrations/entra.js +199 -0
- package/dist/integrations/entra.js.map +1 -0
- package/dist/integrations/fhir.cjs +304 -0
- package/dist/integrations/fhir.cjs.map +1 -0
- package/dist/integrations/fhir.d.cts +185 -0
- package/dist/integrations/fhir.d.ts +185 -0
- package/dist/integrations/fhir.js +278 -0
- package/dist/integrations/fhir.js.map +1 -0
- package/dist/integrations/guidewire.cjs +363 -0
- package/dist/integrations/guidewire.cjs.map +1 -0
- package/dist/integrations/guidewire.d.cts +258 -0
- package/dist/integrations/guidewire.d.ts +258 -0
- package/dist/integrations/guidewire.js +337 -0
- package/dist/integrations/guidewire.js.map +1 -0
- package/dist/integrations/hermes.d.cts +1 -1
- package/dist/integrations/hermes.d.ts +1 -1
- package/dist/integrations/langchain.d.cts +1 -1
- package/dist/integrations/langchain.d.ts +1 -1
- package/dist/integrations/langgraph.d.cts +1 -1
- package/dist/integrations/langgraph.d.ts +1 -1
- package/dist/integrations/legal.cjs +339 -0
- package/dist/integrations/legal.cjs.map +1 -0
- package/dist/integrations/legal.d.cts +225 -0
- package/dist/integrations/legal.d.ts +225 -0
- package/dist/integrations/legal.js +313 -0
- package/dist/integrations/legal.js.map +1 -0
- package/dist/integrations/life-sciences.cjs +335 -0
- package/dist/integrations/life-sciences.cjs.map +1 -0
- package/dist/integrations/life-sciences.d.cts +214 -0
- package/dist/integrations/life-sciences.d.ts +214 -0
- package/dist/integrations/life-sciences.js +309 -0
- package/dist/integrations/life-sciences.js.map +1 -0
- package/dist/integrations/lithic.cjs +290 -0
- package/dist/integrations/lithic.cjs.map +1 -0
- package/dist/integrations/lithic.d.cts +130 -0
- package/dist/integrations/lithic.d.ts +130 -0
- package/dist/integrations/lithic.js +264 -0
- package/dist/integrations/lithic.js.map +1 -0
- package/dist/integrations/llamaindex.d.cts +1 -1
- package/dist/integrations/llamaindex.d.ts +1 -1
- package/dist/integrations/marqeta.cjs +285 -0
- package/dist/integrations/marqeta.cjs.map +1 -0
- package/dist/integrations/marqeta.d.cts +121 -0
- package/dist/integrations/marqeta.d.ts +121 -0
- package/dist/integrations/marqeta.js +259 -0
- package/dist/integrations/marqeta.js.map +1 -0
- package/dist/integrations/modern-treasury.d.cts +1 -1
- package/dist/integrations/modern-treasury.d.ts +1 -1
- package/dist/integrations/nekuda.d.cts +1 -1
- package/dist/integrations/nekuda.d.ts +1 -1
- package/dist/integrations/okta.cjs +229 -0
- package/dist/integrations/okta.cjs.map +1 -0
- package/dist/integrations/okta.d.cts +172 -0
- package/dist/integrations/okta.d.ts +172 -0
- package/dist/integrations/okta.js +203 -0
- package/dist/integrations/okta.js.map +1 -0
- package/dist/integrations/openai.d.cts +1 -1
- package/dist/integrations/openai.d.ts +1 -1
- package/dist/integrations/paypal-agent.d.cts +1 -1
- package/dist/integrations/paypal-agent.d.ts +1 -1
- package/dist/integrations/plaid.d.cts +1 -1
- package/dist/integrations/plaid.d.ts +1 -1
- package/dist/integrations/ramp.cjs +206 -0
- package/dist/integrations/ramp.cjs.map +1 -0
- package/dist/integrations/ramp.d.cts +139 -0
- package/dist/integrations/ramp.d.ts +139 -0
- package/dist/integrations/ramp.js +180 -0
- package/dist/integrations/ramp.js.map +1 -0
- package/dist/integrations/shopify.d.cts +1 -1
- package/dist/integrations/shopify.d.ts +1 -1
- package/dist/integrations/siem.d.cts +1 -1
- package/dist/integrations/siem.d.ts +1 -1
- package/dist/integrations/skyfire.d.cts +1 -1
- package/dist/integrations/skyfire.d.ts +1 -1
- package/dist/integrations/stripe-acp.d.cts +1 -1
- package/dist/integrations/stripe-acp.d.ts +1 -1
- package/dist/integrations/stripe-issuing.cjs +316 -0
- package/dist/integrations/stripe-issuing.cjs.map +1 -0
- package/dist/integrations/stripe-issuing.d.cts +154 -0
- package/dist/integrations/stripe-issuing.d.ts +154 -0
- package/dist/integrations/stripe-issuing.js +290 -0
- package/dist/integrations/stripe-issuing.js.map +1 -0
- package/dist/integrations/truanon.d.cts +1 -1
- package/dist/integrations/truanon.d.ts +1 -1
- package/dist/integrations/ucp.d.cts +1 -1
- package/dist/integrations/ucp.d.ts +1 -1
- package/dist/integrations/vercel-ai.d.cts +1 -1
- package/dist/integrations/vercel-ai.d.ts +1 -1
- package/dist/integrations/x402.d.cts +1 -1
- package/dist/integrations/x402.d.ts +1 -1
- package/dist/{types-zzK9YOoa.d.cts → types-Lp1iHEDz.d.cts} +21 -1
- package/dist/{types-zzK9YOoa.d.ts → types-Lp1iHEDz.d.ts} +21 -1
- package/package.json +121 -1
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { VorimSDK } from '../index.cjs';
|
|
2
|
+
import { P as PermissionScope } from '../types-Lp1iHEDz.cjs';
|
|
3
|
+
|
|
4
|
+
/** The Guidewire Cloud API mutations this guard classifies. Any other label is
|
|
5
|
+
* accepted too; it defaults to the 'write' risk tier (a mutation is at least a
|
|
6
|
+
* write). The money-moving operations require agent:transact and are subject to
|
|
7
|
+
* the dollar ceiling. */
|
|
8
|
+
type GuidewireOperation = 'checkSet' | 'reserveSet' | 'recoveryReserveSet' | 'policyBindIssue' | 'endorsement' | 'premiumRefund' | 'claimCreate' | 'claimAssign' | 'read';
|
|
9
|
+
/** Which ceiling a money-moving operation is checked against. Claim payments,
|
|
10
|
+
* refunds and recoveries draw on the payment ceiling; reserves on the reserve
|
|
11
|
+
* ceiling; policy bind/issue and endorsements on the premium ceiling. */
|
|
12
|
+
type CeilingKind = 'payment' | 'reserve' | 'premium' | null;
|
|
13
|
+
interface GuidewireGuardConfig {
|
|
14
|
+
/** The acting agent's Vorim id (agid_...). */
|
|
15
|
+
agentId: string;
|
|
16
|
+
/** The Guidewire instance this agent operates on, e.g. 'acme.guidewire.net'.
|
|
17
|
+
* Recorded on every receipt so an action is attributable to one tenant. */
|
|
18
|
+
instance: string;
|
|
19
|
+
/** The human/adjuster/underwriter the agent acts for. Recorded on every
|
|
20
|
+
* receipt so a core-system action is attributable to a person. Also the
|
|
21
|
+
* default escalation target when a money amount exceeds the ceiling. */
|
|
22
|
+
humanId?: string;
|
|
23
|
+
/** Minimum trust score the acting agent must hold before any mutation runs.
|
|
24
|
+
* Default 0 (off). */
|
|
25
|
+
minTrustScore?: number;
|
|
26
|
+
/** Attenuation: cap a single claim payment (check-set), premium refund, or
|
|
27
|
+
* recovery, in the currency's minor unit (cents). Omit for no ceiling. */
|
|
28
|
+
maxPaymentAmount?: number;
|
|
29
|
+
/** Attenuation: cap a single reserve-set amount, in minor units. Omit for no
|
|
30
|
+
* ceiling. */
|
|
31
|
+
maxReserveAmount?: number;
|
|
32
|
+
/** Attenuation: cap the premium (or premium delta) an agent may bind/endorse,
|
|
33
|
+
* in minor units. Omit for no ceiling. */
|
|
34
|
+
maxPremiumAmount?: number;
|
|
35
|
+
/** When a money amount exceeds its ceiling, escalate to a named human
|
|
36
|
+
* approver and wait for the decision instead of denying outright. Requires
|
|
37
|
+
* the runtime decision plane (beforeAction). Default false: over-ceiling is a
|
|
38
|
+
* hard deny. This is the segregation-of-duties gate. */
|
|
39
|
+
escalateOverCeiling?: boolean;
|
|
40
|
+
/** Max time to wait for an escalation decision, ms. Default 60000. */
|
|
41
|
+
escalationTimeoutMs?: number;
|
|
42
|
+
/** Fail closed (deny on any Vorim error) or fail open. Default 'closed'. */
|
|
43
|
+
onError?: 'closed' | 'open';
|
|
44
|
+
}
|
|
45
|
+
interface GuidewireAction {
|
|
46
|
+
/** The Cloud API operation being run, e.g. 'checkSet'. Drives the scope
|
|
47
|
+
* requirement and which ceiling applies. Unknown labels default to write. */
|
|
48
|
+
operation: GuidewireOperation | string;
|
|
49
|
+
/** The claim / job / policy id the action targets, e.g. 'cc:42'. */
|
|
50
|
+
resourceId?: string;
|
|
51
|
+
/** For money-moving operations: the amount, in the minor unit (cents).
|
|
52
|
+
* Checked against the relevant ceiling. */
|
|
53
|
+
amount?: number;
|
|
54
|
+
/** Currency code for `amount`, e.g. 'USD'. Recorded on the receipt. */
|
|
55
|
+
currency?: string;
|
|
56
|
+
/** Optional hash of the request body so the receipt covers the exact input
|
|
57
|
+
* without the guard storing it. */
|
|
58
|
+
inputHash?: string;
|
|
59
|
+
}
|
|
60
|
+
/** How an over-ceiling amount was resolved. */
|
|
61
|
+
type CeilingOutcome = 'within' | 'escalated-approved' | 'escalated-denied' | 'over-ceiling';
|
|
62
|
+
/** An offline-verifiable receipt for one Guidewire core-system operation. */
|
|
63
|
+
interface GuidewireReceipt {
|
|
64
|
+
authorized: boolean;
|
|
65
|
+
agentId: string;
|
|
66
|
+
humanId?: string;
|
|
67
|
+
instance: string;
|
|
68
|
+
operation: string;
|
|
69
|
+
resourceId?: string;
|
|
70
|
+
amount?: number;
|
|
71
|
+
currency?: string;
|
|
72
|
+
/** Which ceiling applied ('payment' | 'reserve' | 'premium'), if any. */
|
|
73
|
+
ceiling?: Exclude<CeilingKind, null>;
|
|
74
|
+
/** How the amount check resolved. */
|
|
75
|
+
ceilingOutcome?: CeilingOutcome;
|
|
76
|
+
/** The named approver, when the action escalated. */
|
|
77
|
+
approverId?: string;
|
|
78
|
+
result: 'success' | 'denied' | 'error';
|
|
79
|
+
scope: PermissionScope;
|
|
80
|
+
/** Reason a check failed, when authorized is false. */
|
|
81
|
+
reason?: string;
|
|
82
|
+
/** The runtime decision id, when the action went through beforeAction. */
|
|
83
|
+
decisionId?: string;
|
|
84
|
+
/** True once the audit event was signed and ingested. */
|
|
85
|
+
recorded: boolean;
|
|
86
|
+
}
|
|
87
|
+
declare class VorimGuidewire {
|
|
88
|
+
private sdk;
|
|
89
|
+
private agentId;
|
|
90
|
+
private instance;
|
|
91
|
+
private humanId?;
|
|
92
|
+
private minTrustScore;
|
|
93
|
+
private maxPaymentAmount?;
|
|
94
|
+
private maxReserveAmount?;
|
|
95
|
+
private maxPremiumAmount?;
|
|
96
|
+
private escalateOverCeiling;
|
|
97
|
+
private escalationTimeoutMs;
|
|
98
|
+
private onError;
|
|
99
|
+
constructor(sdk: VorimSDK, config: GuidewireGuardConfig);
|
|
100
|
+
/** The Vorim scope a given operation requires. Unknown mutations fall back to
|
|
101
|
+
* agent:write. */
|
|
102
|
+
private scopeFor;
|
|
103
|
+
/** The ceiling that applies to an operation, and this agent's configured
|
|
104
|
+
* limit for it. Returns { kind: null } when the operation moves no money or
|
|
105
|
+
* no ceiling is set. */
|
|
106
|
+
private ceilingFor;
|
|
107
|
+
/**
|
|
108
|
+
* Decide whether the acting agent may run this operation, before it runs.
|
|
109
|
+
* Order: trust floor, then the dollar ceiling (deny or escalate over it),
|
|
110
|
+
* then permission scope. Returns the authorization plus how the ceiling
|
|
111
|
+
* resolved and the runtime decision id when one was created.
|
|
112
|
+
*/
|
|
113
|
+
authorize(action: GuidewireAction): Promise<{
|
|
114
|
+
authorized: boolean;
|
|
115
|
+
reason?: string;
|
|
116
|
+
ceilingOutcome: CeilingOutcome;
|
|
117
|
+
approverId?: string;
|
|
118
|
+
decisionId?: string;
|
|
119
|
+
}>;
|
|
120
|
+
/**
|
|
121
|
+
* Route an over-ceiling money action through the runtime decision plane so a
|
|
122
|
+
* named human approver can allow or deny it, and wait for that decision. The
|
|
123
|
+
* elevated scope (agent:elevate) marks this as a segregation-of-duties gate:
|
|
124
|
+
* the agent that initiates the payment cannot also approve it above its limit.
|
|
125
|
+
*/
|
|
126
|
+
private escalate;
|
|
127
|
+
/**
|
|
128
|
+
* Emit a source-signed audit event for a core-system operation and return
|
|
129
|
+
* whether it was recorded. Called after the mutation runs (or after a denial).
|
|
130
|
+
* The event names the agent, the instance, the human the agent acts for, the
|
|
131
|
+
* amount vs. its ceiling, and any approver — so the record is attributable and
|
|
132
|
+
* independently verifiable offline, and carries the amount/authority/approval
|
|
133
|
+
* an insurance examiner looks for.
|
|
134
|
+
*/
|
|
135
|
+
record(action: GuidewireAction, result: 'success' | 'denied' | 'error', extra?: {
|
|
136
|
+
reason?: string;
|
|
137
|
+
ceilingOutcome?: CeilingOutcome;
|
|
138
|
+
approverId?: string;
|
|
139
|
+
decisionId?: string;
|
|
140
|
+
}): Promise<boolean>;
|
|
141
|
+
/**
|
|
142
|
+
* The full flow for one core-system operation: authorize (trust, ceiling with
|
|
143
|
+
* escalation, scope), run the Cloud API call if allowed, sign a receipt either
|
|
144
|
+
* way. If not authorized, `run` is never called. Rethrows an error from `run`
|
|
145
|
+
* after recording it, with the receipt attached as `vorimReceipt`, so your
|
|
146
|
+
* handler still sees Guidewire failures.
|
|
147
|
+
*/
|
|
148
|
+
guard<T>(action: GuidewireAction, run: () => Promise<T>): Promise<{
|
|
149
|
+
receipt: GuidewireReceipt;
|
|
150
|
+
value?: T;
|
|
151
|
+
}>;
|
|
152
|
+
/** Guard a claim payment (`POST /claims/{claimId}/check-sets`). Requires
|
|
153
|
+
* agent:transact and stays within `maxPaymentAmount`; above it, escalates to
|
|
154
|
+
* a named adjuster when `escalateOverCeiling` is on. `amount` is minor units
|
|
155
|
+
* (the check-set total). */
|
|
156
|
+
guardedCheckSet<T>(meta: {
|
|
157
|
+
claimId?: string;
|
|
158
|
+
amount?: number;
|
|
159
|
+
currency?: string;
|
|
160
|
+
inputHash?: string;
|
|
161
|
+
}, run: () => Promise<T>): Promise<{
|
|
162
|
+
receipt: GuidewireReceipt;
|
|
163
|
+
value?: T | undefined;
|
|
164
|
+
}>;
|
|
165
|
+
/** Guard a reserve change (`POST /claims/{claimId}/reserve-sets`). Requires
|
|
166
|
+
* agent:transact and stays within `maxReserveAmount`. */
|
|
167
|
+
guardedReserveSet<T>(meta: {
|
|
168
|
+
claimId?: string;
|
|
169
|
+
amount?: number;
|
|
170
|
+
currency?: string;
|
|
171
|
+
inputHash?: string;
|
|
172
|
+
}, run: () => Promise<T>): Promise<{
|
|
173
|
+
receipt: GuidewireReceipt;
|
|
174
|
+
value?: T | undefined;
|
|
175
|
+
}>;
|
|
176
|
+
/** Guard a recovery reserve (`POST /claims/{claimId}/recovery-reserve-sets`).
|
|
177
|
+
* Requires agent:transact; checked against the payment ceiling. */
|
|
178
|
+
guardedRecoveryReserveSet<T>(meta: {
|
|
179
|
+
claimId?: string;
|
|
180
|
+
amount?: number;
|
|
181
|
+
currency?: string;
|
|
182
|
+
inputHash?: string;
|
|
183
|
+
}, run: () => Promise<T>): Promise<{
|
|
184
|
+
receipt: GuidewireReceipt;
|
|
185
|
+
value?: T | undefined;
|
|
186
|
+
}>;
|
|
187
|
+
/** Guard a policy bind + issue (`POST /job/v1/jobs/{jobId}/bind-and-issue`).
|
|
188
|
+
* Requires agent:transact; checked against the premium ceiling. Pass the
|
|
189
|
+
* premium as `amount` (minor units) to attenuate on it. */
|
|
190
|
+
guardedPolicyBind<T>(meta: {
|
|
191
|
+
jobId?: string;
|
|
192
|
+
amount?: number;
|
|
193
|
+
currency?: string;
|
|
194
|
+
inputHash?: string;
|
|
195
|
+
}, run: () => Promise<T>): Promise<{
|
|
196
|
+
receipt: GuidewireReceipt;
|
|
197
|
+
value?: T | undefined;
|
|
198
|
+
}>;
|
|
199
|
+
/** Guard an endorsement / mid-term policy change job. Requires agent:write by
|
|
200
|
+
* default; pass the premium delta as `amount` to attenuate on the premium
|
|
201
|
+
* ceiling. */
|
|
202
|
+
guardedEndorsement<T>(meta: {
|
|
203
|
+
jobId?: string;
|
|
204
|
+
amount?: number;
|
|
205
|
+
currency?: string;
|
|
206
|
+
inputHash?: string;
|
|
207
|
+
}, run: () => Promise<T>): Promise<{
|
|
208
|
+
receipt: GuidewireReceipt;
|
|
209
|
+
value?: T | undefined;
|
|
210
|
+
}>;
|
|
211
|
+
/** Guard a premium refund / billing credit. Requires agent:transact; checked
|
|
212
|
+
* against the payment ceiling, like the Shopify refund cap. */
|
|
213
|
+
guardedPremiumRefund<T>(meta: {
|
|
214
|
+
resourceId?: string;
|
|
215
|
+
amount?: number;
|
|
216
|
+
currency?: string;
|
|
217
|
+
inputHash?: string;
|
|
218
|
+
}, run: () => Promise<T>): Promise<{
|
|
219
|
+
receipt: GuidewireReceipt;
|
|
220
|
+
value?: T | undefined;
|
|
221
|
+
}>;
|
|
222
|
+
/** Guard a claim assignment (`POST /claims/{claimId}/assign`). Requires
|
|
223
|
+
* agent:write; no money moves. */
|
|
224
|
+
guardedClaimAssign<T>(meta: {
|
|
225
|
+
claimId?: string;
|
|
226
|
+
inputHash?: string;
|
|
227
|
+
}, run: () => Promise<T>): Promise<{
|
|
228
|
+
receipt: GuidewireReceipt;
|
|
229
|
+
value?: T | undefined;
|
|
230
|
+
}>;
|
|
231
|
+
private receipt;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Create a VorimGuidewire guard around a Vorim SDK instance.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```typescript
|
|
238
|
+
* import createVorim from '@vorim/sdk';
|
|
239
|
+
* import { createVorimGuidewire } from '@vorim/sdk/integrations/guidewire';
|
|
240
|
+
*
|
|
241
|
+
* const vorim = createVorim({ apiKey: 'agid_sk_...' });
|
|
242
|
+
* const gw = createVorimGuidewire(vorim, {
|
|
243
|
+
* agentId: 'agid_abc123',
|
|
244
|
+
* instance: 'acme.guidewire.net',
|
|
245
|
+
* humanId: 'adjuster_42',
|
|
246
|
+
* maxPaymentAmount: 500000, // pay claims up to $5,000.00
|
|
247
|
+
* escalateOverCeiling: true, // above that -> named adjuster approval
|
|
248
|
+
* });
|
|
249
|
+
*
|
|
250
|
+
* const { receipt, value } = await gw.guardedCheckSet(
|
|
251
|
+
* { claimId: 'cc:42', amount: 499900, currency: 'USD' },
|
|
252
|
+
* () => cloudApi.post('/claims/cc:42/check-sets', checkSet),
|
|
253
|
+
* );
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
declare function createVorimGuidewire(sdk: VorimSDK, config: GuidewireGuardConfig): VorimGuidewire;
|
|
257
|
+
|
|
258
|
+
export { type CeilingOutcome, type GuidewireAction, type GuidewireGuardConfig, type GuidewireOperation, type GuidewireReceipt, VorimGuidewire, createVorimGuidewire };
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { VorimSDK } from '../index.js';
|
|
2
|
+
import { P as PermissionScope } from '../types-Lp1iHEDz.js';
|
|
3
|
+
|
|
4
|
+
/** The Guidewire Cloud API mutations this guard classifies. Any other label is
|
|
5
|
+
* accepted too; it defaults to the 'write' risk tier (a mutation is at least a
|
|
6
|
+
* write). The money-moving operations require agent:transact and are subject to
|
|
7
|
+
* the dollar ceiling. */
|
|
8
|
+
type GuidewireOperation = 'checkSet' | 'reserveSet' | 'recoveryReserveSet' | 'policyBindIssue' | 'endorsement' | 'premiumRefund' | 'claimCreate' | 'claimAssign' | 'read';
|
|
9
|
+
/** Which ceiling a money-moving operation is checked against. Claim payments,
|
|
10
|
+
* refunds and recoveries draw on the payment ceiling; reserves on the reserve
|
|
11
|
+
* ceiling; policy bind/issue and endorsements on the premium ceiling. */
|
|
12
|
+
type CeilingKind = 'payment' | 'reserve' | 'premium' | null;
|
|
13
|
+
interface GuidewireGuardConfig {
|
|
14
|
+
/** The acting agent's Vorim id (agid_...). */
|
|
15
|
+
agentId: string;
|
|
16
|
+
/** The Guidewire instance this agent operates on, e.g. 'acme.guidewire.net'.
|
|
17
|
+
* Recorded on every receipt so an action is attributable to one tenant. */
|
|
18
|
+
instance: string;
|
|
19
|
+
/** The human/adjuster/underwriter the agent acts for. Recorded on every
|
|
20
|
+
* receipt so a core-system action is attributable to a person. Also the
|
|
21
|
+
* default escalation target when a money amount exceeds the ceiling. */
|
|
22
|
+
humanId?: string;
|
|
23
|
+
/** Minimum trust score the acting agent must hold before any mutation runs.
|
|
24
|
+
* Default 0 (off). */
|
|
25
|
+
minTrustScore?: number;
|
|
26
|
+
/** Attenuation: cap a single claim payment (check-set), premium refund, or
|
|
27
|
+
* recovery, in the currency's minor unit (cents). Omit for no ceiling. */
|
|
28
|
+
maxPaymentAmount?: number;
|
|
29
|
+
/** Attenuation: cap a single reserve-set amount, in minor units. Omit for no
|
|
30
|
+
* ceiling. */
|
|
31
|
+
maxReserveAmount?: number;
|
|
32
|
+
/** Attenuation: cap the premium (or premium delta) an agent may bind/endorse,
|
|
33
|
+
* in minor units. Omit for no ceiling. */
|
|
34
|
+
maxPremiumAmount?: number;
|
|
35
|
+
/** When a money amount exceeds its ceiling, escalate to a named human
|
|
36
|
+
* approver and wait for the decision instead of denying outright. Requires
|
|
37
|
+
* the runtime decision plane (beforeAction). Default false: over-ceiling is a
|
|
38
|
+
* hard deny. This is the segregation-of-duties gate. */
|
|
39
|
+
escalateOverCeiling?: boolean;
|
|
40
|
+
/** Max time to wait for an escalation decision, ms. Default 60000. */
|
|
41
|
+
escalationTimeoutMs?: number;
|
|
42
|
+
/** Fail closed (deny on any Vorim error) or fail open. Default 'closed'. */
|
|
43
|
+
onError?: 'closed' | 'open';
|
|
44
|
+
}
|
|
45
|
+
interface GuidewireAction {
|
|
46
|
+
/** The Cloud API operation being run, e.g. 'checkSet'. Drives the scope
|
|
47
|
+
* requirement and which ceiling applies. Unknown labels default to write. */
|
|
48
|
+
operation: GuidewireOperation | string;
|
|
49
|
+
/** The claim / job / policy id the action targets, e.g. 'cc:42'. */
|
|
50
|
+
resourceId?: string;
|
|
51
|
+
/** For money-moving operations: the amount, in the minor unit (cents).
|
|
52
|
+
* Checked against the relevant ceiling. */
|
|
53
|
+
amount?: number;
|
|
54
|
+
/** Currency code for `amount`, e.g. 'USD'. Recorded on the receipt. */
|
|
55
|
+
currency?: string;
|
|
56
|
+
/** Optional hash of the request body so the receipt covers the exact input
|
|
57
|
+
* without the guard storing it. */
|
|
58
|
+
inputHash?: string;
|
|
59
|
+
}
|
|
60
|
+
/** How an over-ceiling amount was resolved. */
|
|
61
|
+
type CeilingOutcome = 'within' | 'escalated-approved' | 'escalated-denied' | 'over-ceiling';
|
|
62
|
+
/** An offline-verifiable receipt for one Guidewire core-system operation. */
|
|
63
|
+
interface GuidewireReceipt {
|
|
64
|
+
authorized: boolean;
|
|
65
|
+
agentId: string;
|
|
66
|
+
humanId?: string;
|
|
67
|
+
instance: string;
|
|
68
|
+
operation: string;
|
|
69
|
+
resourceId?: string;
|
|
70
|
+
amount?: number;
|
|
71
|
+
currency?: string;
|
|
72
|
+
/** Which ceiling applied ('payment' | 'reserve' | 'premium'), if any. */
|
|
73
|
+
ceiling?: Exclude<CeilingKind, null>;
|
|
74
|
+
/** How the amount check resolved. */
|
|
75
|
+
ceilingOutcome?: CeilingOutcome;
|
|
76
|
+
/** The named approver, when the action escalated. */
|
|
77
|
+
approverId?: string;
|
|
78
|
+
result: 'success' | 'denied' | 'error';
|
|
79
|
+
scope: PermissionScope;
|
|
80
|
+
/** Reason a check failed, when authorized is false. */
|
|
81
|
+
reason?: string;
|
|
82
|
+
/** The runtime decision id, when the action went through beforeAction. */
|
|
83
|
+
decisionId?: string;
|
|
84
|
+
/** True once the audit event was signed and ingested. */
|
|
85
|
+
recorded: boolean;
|
|
86
|
+
}
|
|
87
|
+
declare class VorimGuidewire {
|
|
88
|
+
private sdk;
|
|
89
|
+
private agentId;
|
|
90
|
+
private instance;
|
|
91
|
+
private humanId?;
|
|
92
|
+
private minTrustScore;
|
|
93
|
+
private maxPaymentAmount?;
|
|
94
|
+
private maxReserveAmount?;
|
|
95
|
+
private maxPremiumAmount?;
|
|
96
|
+
private escalateOverCeiling;
|
|
97
|
+
private escalationTimeoutMs;
|
|
98
|
+
private onError;
|
|
99
|
+
constructor(sdk: VorimSDK, config: GuidewireGuardConfig);
|
|
100
|
+
/** The Vorim scope a given operation requires. Unknown mutations fall back to
|
|
101
|
+
* agent:write. */
|
|
102
|
+
private scopeFor;
|
|
103
|
+
/** The ceiling that applies to an operation, and this agent's configured
|
|
104
|
+
* limit for it. Returns { kind: null } when the operation moves no money or
|
|
105
|
+
* no ceiling is set. */
|
|
106
|
+
private ceilingFor;
|
|
107
|
+
/**
|
|
108
|
+
* Decide whether the acting agent may run this operation, before it runs.
|
|
109
|
+
* Order: trust floor, then the dollar ceiling (deny or escalate over it),
|
|
110
|
+
* then permission scope. Returns the authorization plus how the ceiling
|
|
111
|
+
* resolved and the runtime decision id when one was created.
|
|
112
|
+
*/
|
|
113
|
+
authorize(action: GuidewireAction): Promise<{
|
|
114
|
+
authorized: boolean;
|
|
115
|
+
reason?: string;
|
|
116
|
+
ceilingOutcome: CeilingOutcome;
|
|
117
|
+
approverId?: string;
|
|
118
|
+
decisionId?: string;
|
|
119
|
+
}>;
|
|
120
|
+
/**
|
|
121
|
+
* Route an over-ceiling money action through the runtime decision plane so a
|
|
122
|
+
* named human approver can allow or deny it, and wait for that decision. The
|
|
123
|
+
* elevated scope (agent:elevate) marks this as a segregation-of-duties gate:
|
|
124
|
+
* the agent that initiates the payment cannot also approve it above its limit.
|
|
125
|
+
*/
|
|
126
|
+
private escalate;
|
|
127
|
+
/**
|
|
128
|
+
* Emit a source-signed audit event for a core-system operation and return
|
|
129
|
+
* whether it was recorded. Called after the mutation runs (or after a denial).
|
|
130
|
+
* The event names the agent, the instance, the human the agent acts for, the
|
|
131
|
+
* amount vs. its ceiling, and any approver — so the record is attributable and
|
|
132
|
+
* independently verifiable offline, and carries the amount/authority/approval
|
|
133
|
+
* an insurance examiner looks for.
|
|
134
|
+
*/
|
|
135
|
+
record(action: GuidewireAction, result: 'success' | 'denied' | 'error', extra?: {
|
|
136
|
+
reason?: string;
|
|
137
|
+
ceilingOutcome?: CeilingOutcome;
|
|
138
|
+
approverId?: string;
|
|
139
|
+
decisionId?: string;
|
|
140
|
+
}): Promise<boolean>;
|
|
141
|
+
/**
|
|
142
|
+
* The full flow for one core-system operation: authorize (trust, ceiling with
|
|
143
|
+
* escalation, scope), run the Cloud API call if allowed, sign a receipt either
|
|
144
|
+
* way. If not authorized, `run` is never called. Rethrows an error from `run`
|
|
145
|
+
* after recording it, with the receipt attached as `vorimReceipt`, so your
|
|
146
|
+
* handler still sees Guidewire failures.
|
|
147
|
+
*/
|
|
148
|
+
guard<T>(action: GuidewireAction, run: () => Promise<T>): Promise<{
|
|
149
|
+
receipt: GuidewireReceipt;
|
|
150
|
+
value?: T;
|
|
151
|
+
}>;
|
|
152
|
+
/** Guard a claim payment (`POST /claims/{claimId}/check-sets`). Requires
|
|
153
|
+
* agent:transact and stays within `maxPaymentAmount`; above it, escalates to
|
|
154
|
+
* a named adjuster when `escalateOverCeiling` is on. `amount` is minor units
|
|
155
|
+
* (the check-set total). */
|
|
156
|
+
guardedCheckSet<T>(meta: {
|
|
157
|
+
claimId?: string;
|
|
158
|
+
amount?: number;
|
|
159
|
+
currency?: string;
|
|
160
|
+
inputHash?: string;
|
|
161
|
+
}, run: () => Promise<T>): Promise<{
|
|
162
|
+
receipt: GuidewireReceipt;
|
|
163
|
+
value?: T | undefined;
|
|
164
|
+
}>;
|
|
165
|
+
/** Guard a reserve change (`POST /claims/{claimId}/reserve-sets`). Requires
|
|
166
|
+
* agent:transact and stays within `maxReserveAmount`. */
|
|
167
|
+
guardedReserveSet<T>(meta: {
|
|
168
|
+
claimId?: string;
|
|
169
|
+
amount?: number;
|
|
170
|
+
currency?: string;
|
|
171
|
+
inputHash?: string;
|
|
172
|
+
}, run: () => Promise<T>): Promise<{
|
|
173
|
+
receipt: GuidewireReceipt;
|
|
174
|
+
value?: T | undefined;
|
|
175
|
+
}>;
|
|
176
|
+
/** Guard a recovery reserve (`POST /claims/{claimId}/recovery-reserve-sets`).
|
|
177
|
+
* Requires agent:transact; checked against the payment ceiling. */
|
|
178
|
+
guardedRecoveryReserveSet<T>(meta: {
|
|
179
|
+
claimId?: string;
|
|
180
|
+
amount?: number;
|
|
181
|
+
currency?: string;
|
|
182
|
+
inputHash?: string;
|
|
183
|
+
}, run: () => Promise<T>): Promise<{
|
|
184
|
+
receipt: GuidewireReceipt;
|
|
185
|
+
value?: T | undefined;
|
|
186
|
+
}>;
|
|
187
|
+
/** Guard a policy bind + issue (`POST /job/v1/jobs/{jobId}/bind-and-issue`).
|
|
188
|
+
* Requires agent:transact; checked against the premium ceiling. Pass the
|
|
189
|
+
* premium as `amount` (minor units) to attenuate on it. */
|
|
190
|
+
guardedPolicyBind<T>(meta: {
|
|
191
|
+
jobId?: string;
|
|
192
|
+
amount?: number;
|
|
193
|
+
currency?: string;
|
|
194
|
+
inputHash?: string;
|
|
195
|
+
}, run: () => Promise<T>): Promise<{
|
|
196
|
+
receipt: GuidewireReceipt;
|
|
197
|
+
value?: T | undefined;
|
|
198
|
+
}>;
|
|
199
|
+
/** Guard an endorsement / mid-term policy change job. Requires agent:write by
|
|
200
|
+
* default; pass the premium delta as `amount` to attenuate on the premium
|
|
201
|
+
* ceiling. */
|
|
202
|
+
guardedEndorsement<T>(meta: {
|
|
203
|
+
jobId?: string;
|
|
204
|
+
amount?: number;
|
|
205
|
+
currency?: string;
|
|
206
|
+
inputHash?: string;
|
|
207
|
+
}, run: () => Promise<T>): Promise<{
|
|
208
|
+
receipt: GuidewireReceipt;
|
|
209
|
+
value?: T | undefined;
|
|
210
|
+
}>;
|
|
211
|
+
/** Guard a premium refund / billing credit. Requires agent:transact; checked
|
|
212
|
+
* against the payment ceiling, like the Shopify refund cap. */
|
|
213
|
+
guardedPremiumRefund<T>(meta: {
|
|
214
|
+
resourceId?: string;
|
|
215
|
+
amount?: number;
|
|
216
|
+
currency?: string;
|
|
217
|
+
inputHash?: string;
|
|
218
|
+
}, run: () => Promise<T>): Promise<{
|
|
219
|
+
receipt: GuidewireReceipt;
|
|
220
|
+
value?: T | undefined;
|
|
221
|
+
}>;
|
|
222
|
+
/** Guard a claim assignment (`POST /claims/{claimId}/assign`). Requires
|
|
223
|
+
* agent:write; no money moves. */
|
|
224
|
+
guardedClaimAssign<T>(meta: {
|
|
225
|
+
claimId?: string;
|
|
226
|
+
inputHash?: string;
|
|
227
|
+
}, run: () => Promise<T>): Promise<{
|
|
228
|
+
receipt: GuidewireReceipt;
|
|
229
|
+
value?: T | undefined;
|
|
230
|
+
}>;
|
|
231
|
+
private receipt;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Create a VorimGuidewire guard around a Vorim SDK instance.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```typescript
|
|
238
|
+
* import createVorim from '@vorim/sdk';
|
|
239
|
+
* import { createVorimGuidewire } from '@vorim/sdk/integrations/guidewire';
|
|
240
|
+
*
|
|
241
|
+
* const vorim = createVorim({ apiKey: 'agid_sk_...' });
|
|
242
|
+
* const gw = createVorimGuidewire(vorim, {
|
|
243
|
+
* agentId: 'agid_abc123',
|
|
244
|
+
* instance: 'acme.guidewire.net',
|
|
245
|
+
* humanId: 'adjuster_42',
|
|
246
|
+
* maxPaymentAmount: 500000, // pay claims up to $5,000.00
|
|
247
|
+
* escalateOverCeiling: true, // above that -> named adjuster approval
|
|
248
|
+
* });
|
|
249
|
+
*
|
|
250
|
+
* const { receipt, value } = await gw.guardedCheckSet(
|
|
251
|
+
* { claimId: 'cc:42', amount: 499900, currency: 'USD' },
|
|
252
|
+
* () => cloudApi.post('/claims/cc:42/check-sets', checkSet),
|
|
253
|
+
* );
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
declare function createVorimGuidewire(sdk: VorimSDK, config: GuidewireGuardConfig): VorimGuidewire;
|
|
257
|
+
|
|
258
|
+
export { type CeilingOutcome, type GuidewireAction, type GuidewireGuardConfig, type GuidewireOperation, type GuidewireReceipt, VorimGuidewire, createVorimGuidewire };
|