@vorim/sdk 3.12.0 → 3.15.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 +1 -1
- package/dist/index.js +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/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/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/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/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/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/package.json +91 -1
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
// src/integrations/guidewire.ts
|
|
2
|
+
var OPERATION_SCOPE = {
|
|
3
|
+
read: "agent:read",
|
|
4
|
+
claimCreate: "agent:write",
|
|
5
|
+
claimAssign: "agent:write",
|
|
6
|
+
endorsement: "agent:write",
|
|
7
|
+
checkSet: "agent:transact",
|
|
8
|
+
reserveSet: "agent:transact",
|
|
9
|
+
recoveryReserveSet: "agent:transact",
|
|
10
|
+
policyBindIssue: "agent:transact",
|
|
11
|
+
premiumRefund: "agent:transact"
|
|
12
|
+
};
|
|
13
|
+
var OPERATION_CEILING = {
|
|
14
|
+
checkSet: "payment",
|
|
15
|
+
premiumRefund: "payment",
|
|
16
|
+
recoveryReserveSet: "payment",
|
|
17
|
+
reserveSet: "reserve",
|
|
18
|
+
policyBindIssue: "premium",
|
|
19
|
+
endorsement: "premium"
|
|
20
|
+
};
|
|
21
|
+
var VorimGuidewire = class {
|
|
22
|
+
sdk;
|
|
23
|
+
agentId;
|
|
24
|
+
instance;
|
|
25
|
+
humanId;
|
|
26
|
+
minTrustScore;
|
|
27
|
+
maxPaymentAmount;
|
|
28
|
+
maxReserveAmount;
|
|
29
|
+
maxPremiumAmount;
|
|
30
|
+
escalateOverCeiling;
|
|
31
|
+
escalationTimeoutMs;
|
|
32
|
+
onError;
|
|
33
|
+
constructor(sdk, config) {
|
|
34
|
+
if (!config?.agentId) throw new Error("[vorim] Guidewire integration requires an agentId.");
|
|
35
|
+
if (!config?.instance) throw new Error("[vorim] Guidewire integration requires an instance.");
|
|
36
|
+
this.sdk = sdk;
|
|
37
|
+
this.agentId = config.agentId;
|
|
38
|
+
this.instance = config.instance;
|
|
39
|
+
this.humanId = config.humanId;
|
|
40
|
+
this.minTrustScore = config.minTrustScore ?? 0;
|
|
41
|
+
this.maxPaymentAmount = config.maxPaymentAmount;
|
|
42
|
+
this.maxReserveAmount = config.maxReserveAmount;
|
|
43
|
+
this.maxPremiumAmount = config.maxPremiumAmount;
|
|
44
|
+
this.escalateOverCeiling = config.escalateOverCeiling ?? false;
|
|
45
|
+
this.escalationTimeoutMs = config.escalationTimeoutMs ?? 6e4;
|
|
46
|
+
this.onError = config.onError ?? "closed";
|
|
47
|
+
}
|
|
48
|
+
/** The Vorim scope a given operation requires. Unknown mutations fall back to
|
|
49
|
+
* agent:write. */
|
|
50
|
+
scopeFor(operation) {
|
|
51
|
+
return OPERATION_SCOPE[operation] ?? "agent:write";
|
|
52
|
+
}
|
|
53
|
+
/** The ceiling that applies to an operation, and this agent's configured
|
|
54
|
+
* limit for it. Returns { kind: null } when the operation moves no money or
|
|
55
|
+
* no ceiling is set. */
|
|
56
|
+
ceilingFor(operation) {
|
|
57
|
+
const kind = OPERATION_CEILING[operation] ?? null;
|
|
58
|
+
if (kind === "payment") return { kind, limit: this.maxPaymentAmount };
|
|
59
|
+
if (kind === "reserve") return { kind, limit: this.maxReserveAmount };
|
|
60
|
+
if (kind === "premium") return { kind, limit: this.maxPremiumAmount };
|
|
61
|
+
return { kind: null };
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Decide whether the acting agent may run this operation, before it runs.
|
|
65
|
+
* Order: trust floor, then the dollar ceiling (deny or escalate over it),
|
|
66
|
+
* then permission scope. Returns the authorization plus how the ceiling
|
|
67
|
+
* resolved and the runtime decision id when one was created.
|
|
68
|
+
*/
|
|
69
|
+
async authorize(action) {
|
|
70
|
+
const scope = this.scopeFor(action.operation);
|
|
71
|
+
const { kind, limit } = this.ceilingFor(action.operation);
|
|
72
|
+
const overCeiling = kind != null && limit != null && typeof action.amount === "number" && action.amount > limit;
|
|
73
|
+
try {
|
|
74
|
+
if (this.minTrustScore > 0) {
|
|
75
|
+
const trust = await this.sdk.verify(this.agentId);
|
|
76
|
+
if ((trust?.trust_score ?? 0) < this.minTrustScore) {
|
|
77
|
+
return {
|
|
78
|
+
authorized: false,
|
|
79
|
+
reason: `trust score below ${this.minTrustScore}`,
|
|
80
|
+
ceilingOutcome: overCeiling ? "over-ceiling" : "within"
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (overCeiling) {
|
|
85
|
+
if (!this.escalateOverCeiling) {
|
|
86
|
+
return {
|
|
87
|
+
authorized: false,
|
|
88
|
+
reason: `${kind} ${action.amount} exceeds this agent's ceiling of ${limit}`,
|
|
89
|
+
ceilingOutcome: "over-ceiling"
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const esc = await this.escalate(action, scope, kind, limit);
|
|
93
|
+
return {
|
|
94
|
+
authorized: esc.approved,
|
|
95
|
+
reason: esc.approved ? void 0 : esc.reason ?? "escalation denied",
|
|
96
|
+
ceilingOutcome: esc.approved ? "escalated-approved" : "escalated-denied",
|
|
97
|
+
approverId: this.humanId,
|
|
98
|
+
decisionId: esc.decisionId
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
const perm = await this.sdk.check(this.agentId, scope);
|
|
102
|
+
return perm.allowed ? { authorized: true, ceilingOutcome: "within" } : {
|
|
103
|
+
authorized: false,
|
|
104
|
+
reason: perm.reason ?? `missing scope ${scope}`,
|
|
105
|
+
ceilingOutcome: "within"
|
|
106
|
+
};
|
|
107
|
+
} catch (e) {
|
|
108
|
+
return this.onError === "open" ? {
|
|
109
|
+
authorized: true,
|
|
110
|
+
reason: "vorim unreachable, failed open",
|
|
111
|
+
ceilingOutcome: overCeiling ? "over-ceiling" : "within"
|
|
112
|
+
} : {
|
|
113
|
+
authorized: false,
|
|
114
|
+
reason: `vorim unreachable: ${e?.message ?? "error"}`,
|
|
115
|
+
ceilingOutcome: overCeiling ? "over-ceiling" : "within"
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Route an over-ceiling money action through the runtime decision plane so a
|
|
121
|
+
* named human approver can allow or deny it, and wait for that decision. The
|
|
122
|
+
* elevated scope (agent:elevate) marks this as a segregation-of-duties gate:
|
|
123
|
+
* the agent that initiates the payment cannot also approve it above its limit.
|
|
124
|
+
*/
|
|
125
|
+
async escalate(action, scope, kind, limit) {
|
|
126
|
+
const decision = await this.sdk.beforeAction(
|
|
127
|
+
{
|
|
128
|
+
agentId: this.agentId,
|
|
129
|
+
actionType: "api_request",
|
|
130
|
+
actionTarget: `guidewire:${action.operation}`,
|
|
131
|
+
requiredScope: scope,
|
|
132
|
+
payload: {
|
|
133
|
+
amount: action.amount,
|
|
134
|
+
currency: action.currency,
|
|
135
|
+
ceiling: kind,
|
|
136
|
+
limit,
|
|
137
|
+
resource_id: action.resourceId
|
|
138
|
+
},
|
|
139
|
+
context: {
|
|
140
|
+
integration: "guidewire-cloud",
|
|
141
|
+
instance: this.instance,
|
|
142
|
+
requires_named_approver: true,
|
|
143
|
+
approver_hint: this.humanId
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
{ throwOnDeny: false }
|
|
147
|
+
);
|
|
148
|
+
if (decision.decision === "escalate") {
|
|
149
|
+
const resolved = await this.sdk.waitForDecisionResolution(decision.decisionId, {
|
|
150
|
+
timeoutMs: this.escalationTimeoutMs
|
|
151
|
+
});
|
|
152
|
+
const approved = resolved.decision === "allow" || resolved.escalationResolution === "approved";
|
|
153
|
+
return {
|
|
154
|
+
approved,
|
|
155
|
+
reason: approved ? void 0 : "named approver denied",
|
|
156
|
+
decisionId: decision.decisionId
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
if (decision.decision === "allow") return { approved: true, decisionId: decision.decisionId };
|
|
160
|
+
if (decision.decision === "fallback")
|
|
161
|
+
return { approved: this.onError === "open", reason: "runtime unreachable", decisionId: decision.decisionId };
|
|
162
|
+
return { approved: false, reason: decision.reason ?? "denied", decisionId: decision.decisionId };
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Emit a source-signed audit event for a core-system operation and return
|
|
166
|
+
* whether it was recorded. Called after the mutation runs (or after a denial).
|
|
167
|
+
* The event names the agent, the instance, the human the agent acts for, the
|
|
168
|
+
* amount vs. its ceiling, and any approver — so the record is attributable and
|
|
169
|
+
* independently verifiable offline, and carries the amount/authority/approval
|
|
170
|
+
* an insurance examiner looks for.
|
|
171
|
+
*/
|
|
172
|
+
async record(action, result, extra = {}) {
|
|
173
|
+
const scope = this.scopeFor(action.operation);
|
|
174
|
+
const { kind } = this.ceilingFor(action.operation);
|
|
175
|
+
try {
|
|
176
|
+
await this.sdk.emit(
|
|
177
|
+
{
|
|
178
|
+
agent_id: this.agentId,
|
|
179
|
+
event_type: "api_request",
|
|
180
|
+
action: `guidewire:${action.operation}${action.resourceId ? " " + action.resourceId : ""}`,
|
|
181
|
+
resource: action.resourceId || this.instance,
|
|
182
|
+
permission: scope,
|
|
183
|
+
result,
|
|
184
|
+
input_hash: action.inputHash,
|
|
185
|
+
metadata: {
|
|
186
|
+
integration: "guidewire-cloud",
|
|
187
|
+
instance: this.instance,
|
|
188
|
+
acts_for_human: this.humanId,
|
|
189
|
+
operation: action.operation,
|
|
190
|
+
...action.amount != null ? { amount: action.amount } : {},
|
|
191
|
+
...action.currency ? { currency: action.currency } : {},
|
|
192
|
+
...kind ? { ceiling_kind: kind } : {},
|
|
193
|
+
...extra.ceilingOutcome ? { ceiling_outcome: extra.ceilingOutcome } : {},
|
|
194
|
+
...extra.approverId ? { approver_id: extra.approverId } : {},
|
|
195
|
+
...extra.decisionId ? { decision_id: extra.decisionId } : {},
|
|
196
|
+
...extra.reason ? { reason: extra.reason } : {}
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
{ sign: true }
|
|
200
|
+
// source-signed: the agent's key signs the record
|
|
201
|
+
);
|
|
202
|
+
return true;
|
|
203
|
+
} catch {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* The full flow for one core-system operation: authorize (trust, ceiling with
|
|
209
|
+
* escalation, scope), run the Cloud API call if allowed, sign a receipt either
|
|
210
|
+
* way. If not authorized, `run` is never called. Rethrows an error from `run`
|
|
211
|
+
* after recording it, with the receipt attached as `vorimReceipt`, so your
|
|
212
|
+
* handler still sees Guidewire failures.
|
|
213
|
+
*/
|
|
214
|
+
async guard(action, run) {
|
|
215
|
+
const auth = await this.authorize(action);
|
|
216
|
+
if (!auth.authorized) {
|
|
217
|
+
const recorded = await this.record(action, "denied", {
|
|
218
|
+
reason: auth.reason,
|
|
219
|
+
ceilingOutcome: auth.ceilingOutcome,
|
|
220
|
+
approverId: auth.approverId,
|
|
221
|
+
decisionId: auth.decisionId
|
|
222
|
+
});
|
|
223
|
+
return {
|
|
224
|
+
receipt: this.receipt(action, false, "denied", auth, recorded)
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
try {
|
|
228
|
+
const value = await run();
|
|
229
|
+
const recorded = await this.record(action, "success", {
|
|
230
|
+
ceilingOutcome: auth.ceilingOutcome,
|
|
231
|
+
approverId: auth.approverId,
|
|
232
|
+
decisionId: auth.decisionId
|
|
233
|
+
});
|
|
234
|
+
return { receipt: this.receipt(action, true, "success", auth, recorded), value };
|
|
235
|
+
} catch (e) {
|
|
236
|
+
const recorded = await this.record(action, "error", {
|
|
237
|
+
reason: e?.message,
|
|
238
|
+
ceilingOutcome: auth.ceilingOutcome,
|
|
239
|
+
approverId: auth.approverId,
|
|
240
|
+
decisionId: auth.decisionId
|
|
241
|
+
});
|
|
242
|
+
throw Object.assign(e ?? new Error("guidewire operation failed"), {
|
|
243
|
+
vorimReceipt: this.receipt(action, true, "error", { ...auth, reason: e?.message }, recorded)
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
// --- Named helpers for the high-risk Cloud API mutations -------------------
|
|
248
|
+
// Each wraps guard() with the right operation label so the scope, ceiling, and
|
|
249
|
+
// receipt are correct without the caller remembering the mapping. You pass the
|
|
250
|
+
// Cloud API call as `run`; this layer never talks to Guidewire itself.
|
|
251
|
+
/** Guard a claim payment (`POST /claims/{claimId}/check-sets`). Requires
|
|
252
|
+
* agent:transact and stays within `maxPaymentAmount`; above it, escalates to
|
|
253
|
+
* a named adjuster when `escalateOverCeiling` is on. `amount` is minor units
|
|
254
|
+
* (the check-set total). */
|
|
255
|
+
guardedCheckSet(meta, run) {
|
|
256
|
+
return this.guard(
|
|
257
|
+
{ operation: "checkSet", resourceId: meta.claimId, amount: meta.amount, currency: meta.currency, inputHash: meta.inputHash },
|
|
258
|
+
run
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
/** Guard a reserve change (`POST /claims/{claimId}/reserve-sets`). Requires
|
|
262
|
+
* agent:transact and stays within `maxReserveAmount`. */
|
|
263
|
+
guardedReserveSet(meta, run) {
|
|
264
|
+
return this.guard(
|
|
265
|
+
{ operation: "reserveSet", resourceId: meta.claimId, amount: meta.amount, currency: meta.currency, inputHash: meta.inputHash },
|
|
266
|
+
run
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
/** Guard a recovery reserve (`POST /claims/{claimId}/recovery-reserve-sets`).
|
|
270
|
+
* Requires agent:transact; checked against the payment ceiling. */
|
|
271
|
+
guardedRecoveryReserveSet(meta, run) {
|
|
272
|
+
return this.guard(
|
|
273
|
+
{ operation: "recoveryReserveSet", resourceId: meta.claimId, amount: meta.amount, currency: meta.currency, inputHash: meta.inputHash },
|
|
274
|
+
run
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
/** Guard a policy bind + issue (`POST /job/v1/jobs/{jobId}/bind-and-issue`).
|
|
278
|
+
* Requires agent:transact; checked against the premium ceiling. Pass the
|
|
279
|
+
* premium as `amount` (minor units) to attenuate on it. */
|
|
280
|
+
guardedPolicyBind(meta, run) {
|
|
281
|
+
return this.guard(
|
|
282
|
+
{ operation: "policyBindIssue", resourceId: meta.jobId, amount: meta.amount, currency: meta.currency, inputHash: meta.inputHash },
|
|
283
|
+
run
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
/** Guard an endorsement / mid-term policy change job. Requires agent:write by
|
|
287
|
+
* default; pass the premium delta as `amount` to attenuate on the premium
|
|
288
|
+
* ceiling. */
|
|
289
|
+
guardedEndorsement(meta, run) {
|
|
290
|
+
return this.guard(
|
|
291
|
+
{ operation: "endorsement", resourceId: meta.jobId, amount: meta.amount, currency: meta.currency, inputHash: meta.inputHash },
|
|
292
|
+
run
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
/** Guard a premium refund / billing credit. Requires agent:transact; checked
|
|
296
|
+
* against the payment ceiling, like the Shopify refund cap. */
|
|
297
|
+
guardedPremiumRefund(meta, run) {
|
|
298
|
+
return this.guard(
|
|
299
|
+
{ operation: "premiumRefund", resourceId: meta.resourceId, amount: meta.amount, currency: meta.currency, inputHash: meta.inputHash },
|
|
300
|
+
run
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
/** Guard a claim assignment (`POST /claims/{claimId}/assign`). Requires
|
|
304
|
+
* agent:write; no money moves. */
|
|
305
|
+
guardedClaimAssign(meta, run) {
|
|
306
|
+
return this.guard({ operation: "claimAssign", resourceId: meta.claimId, inputHash: meta.inputHash }, run);
|
|
307
|
+
}
|
|
308
|
+
receipt(action, authorized, result, auth, recorded) {
|
|
309
|
+
const { kind } = this.ceilingFor(action.operation);
|
|
310
|
+
return {
|
|
311
|
+
authorized,
|
|
312
|
+
agentId: this.agentId,
|
|
313
|
+
humanId: this.humanId,
|
|
314
|
+
instance: this.instance,
|
|
315
|
+
operation: action.operation,
|
|
316
|
+
resourceId: action.resourceId,
|
|
317
|
+
amount: action.amount,
|
|
318
|
+
currency: action.currency,
|
|
319
|
+
ceiling: kind ?? void 0,
|
|
320
|
+
ceilingOutcome: auth.ceilingOutcome,
|
|
321
|
+
approverId: auth.approverId,
|
|
322
|
+
result,
|
|
323
|
+
scope: this.scopeFor(action.operation),
|
|
324
|
+
reason: auth.reason,
|
|
325
|
+
decisionId: auth.decisionId,
|
|
326
|
+
recorded
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
function createVorimGuidewire(sdk, config) {
|
|
331
|
+
return new VorimGuidewire(sdk, config);
|
|
332
|
+
}
|
|
333
|
+
export {
|
|
334
|
+
VorimGuidewire,
|
|
335
|
+
createVorimGuidewire
|
|
336
|
+
};
|
|
337
|
+
//# sourceMappingURL=guidewire.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/integrations/guidewire.ts"],"sourcesContent":["// ============================================================================\n// Vorim AI — Guidewire (P&C insurance core) Integration\n//\n// This guards an AI agent that acts on a Guidewire InsuranceSuite core system\n// (ClaimCenter / PolicyCenter / BillingCenter) through the Cloud API — paying\n// claims, setting reserves, binding policies, endorsing, issuing premium\n// refunds. Before each mutation runs it checks the acting agent holds the right\n// permission and that any money amount is within a delegated ceiling; above the\n// ceiling it escalates to a named human adjuster (segregation of duties) and\n// waits for that decision. Either way it signs a tamper-evident record of what\n// the agent did, under which authority, and who approved it.\n//\n// WHY THIS LAYER\n// Guidewire's own Cloud API authenticates a service with one OAuth token and\n// coarse API roles: every agent on that token looks identical, there is no way\n// to cap a sub-agent's claim-payment authority below the human's, and nothing\n// proves agent X (not agent Y) issued a given check-set. Guidewire's Qusar\n// release (Aug 2026) ships an Agentic Framework that helps insurers BUILD these\n// agents — this layer is the accountability and attenuation overlay ON those\n// agents. It composes with Guidewire, it does not replace the Cloud API.\n//\n// THE DOLLAR CEILING IS THE WEDGE\n// ClaimCenter's financial model is built on check-sets and reserve-sets that\n// carry explicit amounts and pass through a native \"Ability to pay\" / approval\n// gate. That maps 1:1 onto a delegated spend ceiling: an agent may pay claims\n// and set reserves up to a signed limit; anything above auto-escalates to a\n// named human adjuster. This is the shipped Shopify refund-ceiling attenuation,\n// re-pointed at a higher-stakes system of record.\n//\n// SCOPE MAPPING (uses Vorim's real scopes)\n// read core data -> agent:read\n// mutate a policy/claim (non-money) -> agent:write (assign, endorse draft)\n// move money (pay claim, refund, -> agent:transact + amount ceiling\n// set reserve, bind+issue)\n//\n// COMPLIANCE FRAMING (be precise — see the research memo)\n// The signed record is EVIDENCE for the documented, attributable, auditable\n// AI-decision obligations under the NAIC Model Bulletin on Use of AI Systems by\n// Insurers, the Unfair Claims Settlement Practices Act, and adverse-action\n// rules. No cited regime MANDATES a cryptographic signature; signing hardens\n// those records against tampering and makes them independently verifiable. Say\n// \"tamper-evident proof of documented, attributable AI claim decisions\", never\n// \"required by NAIC\".\n//\n// This layer never holds a Guidewire token and never calls Guidewire itself.\n// You pass it the Cloud API call to run; it authorizes, escalates if needed,\n// runs it, and signs the receipt.\n//\n// Usage:\n// import createVorim from '@vorim/sdk';\n// import { createVorimGuidewire } from '@vorim/sdk/integrations/guidewire';\n//\n// const vorim = createVorim({ apiKey: 'agid_sk_...' });\n// const gw = createVorimGuidewire(vorim, {\n// agentId: 'agid_abc123',\n// instance: 'acme.guidewire.net', // recorded on every receipt\n// humanId: 'adjuster_42', // the person the agent acts for\n// maxPaymentAmount: 500000, // pay claims up to $5,000.00 (cents)\n// maxReserveAmount: 2500000, // set reserves up to $25,000.00 (cents)\n// escalateOverCeiling: true, // above ceiling -> named-approver wait\n// });\n//\n// const { receipt, value } = await gw.guardedCheckSet(\n// { claimId: 'cc:42', amount: 499900, currency: 'USD' },\n// () => cloudApi.post(`/claims/cc:42/check-sets`, checkSet),\n// );\n// if (!receipt.authorized) console.warn(receipt.reason);\n// ============================================================================\n\nimport type { VorimSDK } from '../index.js';\nimport type { PermissionScope } from '../types.js';\n\n/** The Guidewire Cloud API mutations this guard classifies. Any other label is\n * accepted too; it defaults to the 'write' risk tier (a mutation is at least a\n * write). The money-moving operations require agent:transact and are subject to\n * the dollar ceiling. */\nexport type GuidewireOperation =\n | 'checkSet' // POST /claims/{claimId}/check-sets — PAY a claim\n | 'reserveSet' // POST /claims/{claimId}/reserve-sets — SET reserves\n | 'recoveryReserveSet' // POST /claims/{claimId}/recovery-reserve-sets\n | 'policyBindIssue' // POST /job/v1/jobs/{jobId}/bind-and-issue\n | 'endorsement' // policy-change job — endorse / mid-term change\n | 'premiumRefund' // BillingCenter refund / credit\n | 'claimCreate' // FNOL — create draft claim\n | 'claimAssign' // POST /claims/{claimId}/assign\n | 'read';\n\n/** Map each operation to the least Vorim scope required to run it. Reads need\n * read; non-money mutations need write; anything that moves money (paying a\n * claim, setting a reserve, binding a policy, refunding premium) needs transact\n * and is bounded by the dollar ceiling. */\nconst OPERATION_SCOPE: Record<string, PermissionScope> = {\n read: 'agent:read',\n claimCreate: 'agent:write',\n claimAssign: 'agent:write',\n endorsement: 'agent:write',\n checkSet: 'agent:transact',\n reserveSet: 'agent:transact',\n recoveryReserveSet: 'agent:transact',\n policyBindIssue: 'agent:transact',\n premiumRefund: 'agent:transact',\n};\n\n/** Which ceiling a money-moving operation is checked against. Claim payments,\n * refunds and recoveries draw on the payment ceiling; reserves on the reserve\n * ceiling; policy bind/issue and endorsements on the premium ceiling. */\ntype CeilingKind = 'payment' | 'reserve' | 'premium' | null;\nconst OPERATION_CEILING: Record<string, CeilingKind> = {\n checkSet: 'payment',\n premiumRefund: 'payment',\n recoveryReserveSet: 'payment',\n reserveSet: 'reserve',\n policyBindIssue: 'premium',\n endorsement: 'premium',\n};\n\nexport interface GuidewireGuardConfig {\n /** The acting agent's Vorim id (agid_...). */\n agentId: string;\n /** The Guidewire instance this agent operates on, e.g. 'acme.guidewire.net'.\n * Recorded on every receipt so an action is attributable to one tenant. */\n instance: string;\n /** The human/adjuster/underwriter the agent acts for. Recorded on every\n * receipt so a core-system action is attributable to a person. Also the\n * default escalation target when a money amount exceeds the ceiling. */\n humanId?: string;\n /** Minimum trust score the acting agent must hold before any mutation runs.\n * Default 0 (off). */\n minTrustScore?: number;\n /** Attenuation: cap a single claim payment (check-set), premium refund, or\n * recovery, in the currency's minor unit (cents). Omit for no ceiling. */\n maxPaymentAmount?: number;\n /** Attenuation: cap a single reserve-set amount, in minor units. Omit for no\n * ceiling. */\n maxReserveAmount?: number;\n /** Attenuation: cap the premium (or premium delta) an agent may bind/endorse,\n * in minor units. Omit for no ceiling. */\n maxPremiumAmount?: number;\n /** When a money amount exceeds its ceiling, escalate to a named human\n * approver and wait for the decision instead of denying outright. Requires\n * the runtime decision plane (beforeAction). Default false: over-ceiling is a\n * hard deny. This is the segregation-of-duties gate. */\n escalateOverCeiling?: boolean;\n /** Max time to wait for an escalation decision, ms. Default 60000. */\n escalationTimeoutMs?: number;\n /** Fail closed (deny on any Vorim error) or fail open. Default 'closed'. */\n onError?: 'closed' | 'open';\n}\n\nexport interface GuidewireAction {\n /** The Cloud API operation being run, e.g. 'checkSet'. Drives the scope\n * requirement and which ceiling applies. Unknown labels default to write. */\n operation: GuidewireOperation | string;\n /** The claim / job / policy id the action targets, e.g. 'cc:42'. */\n resourceId?: string;\n /** For money-moving operations: the amount, in the minor unit (cents).\n * Checked against the relevant ceiling. */\n amount?: number;\n /** Currency code for `amount`, e.g. 'USD'. Recorded on the receipt. */\n currency?: string;\n /** Optional hash of the request body so the receipt covers the exact input\n * without the guard storing it. */\n inputHash?: string;\n}\n\n/** How an over-ceiling amount was resolved. */\nexport type CeilingOutcome = 'within' | 'escalated-approved' | 'escalated-denied' | 'over-ceiling';\n\n/** An offline-verifiable receipt for one Guidewire core-system operation. */\nexport interface GuidewireReceipt {\n authorized: boolean;\n agentId: string;\n humanId?: string;\n instance: string;\n operation: string;\n resourceId?: string;\n amount?: number;\n currency?: string;\n /** Which ceiling applied ('payment' | 'reserve' | 'premium'), if any. */\n ceiling?: Exclude<CeilingKind, null>;\n /** How the amount check resolved. */\n ceilingOutcome?: CeilingOutcome;\n /** The named approver, when the action escalated. */\n approverId?: string;\n result: 'success' | 'denied' | 'error';\n scope: PermissionScope;\n /** Reason a check failed, when authorized is false. */\n reason?: string;\n /** The runtime decision id, when the action went through beforeAction. */\n decisionId?: string;\n /** True once the audit event was signed and ingested. */\n recorded: boolean;\n}\n\nexport class VorimGuidewire {\n private sdk: VorimSDK;\n private agentId: string;\n private instance: string;\n private humanId?: string;\n private minTrustScore: number;\n private maxPaymentAmount?: number;\n private maxReserveAmount?: number;\n private maxPremiumAmount?: number;\n private escalateOverCeiling: boolean;\n private escalationTimeoutMs: number;\n private onError: 'closed' | 'open';\n\n constructor(sdk: VorimSDK, config: GuidewireGuardConfig) {\n if (!config?.agentId) throw new Error('[vorim] Guidewire integration requires an agentId.');\n if (!config?.instance) throw new Error('[vorim] Guidewire integration requires an instance.');\n this.sdk = sdk;\n this.agentId = config.agentId;\n this.instance = config.instance;\n this.humanId = config.humanId;\n this.minTrustScore = config.minTrustScore ?? 0;\n this.maxPaymentAmount = config.maxPaymentAmount;\n this.maxReserveAmount = config.maxReserveAmount;\n this.maxPremiumAmount = config.maxPremiumAmount;\n this.escalateOverCeiling = config.escalateOverCeiling ?? false;\n this.escalationTimeoutMs = config.escalationTimeoutMs ?? 60_000;\n this.onError = config.onError ?? 'closed';\n }\n\n /** The Vorim scope a given operation requires. Unknown mutations fall back to\n * agent:write. */\n private scopeFor(operation: string): PermissionScope {\n return OPERATION_SCOPE[operation] ?? 'agent:write';\n }\n\n /** The ceiling that applies to an operation, and this agent's configured\n * limit for it. Returns { kind: null } when the operation moves no money or\n * no ceiling is set. */\n private ceilingFor(operation: string): { kind: CeilingKind; limit?: number } {\n const kind = OPERATION_CEILING[operation] ?? null;\n if (kind === 'payment') return { kind, limit: this.maxPaymentAmount };\n if (kind === 'reserve') return { kind, limit: this.maxReserveAmount };\n if (kind === 'premium') return { kind, limit: this.maxPremiumAmount };\n return { kind: null };\n }\n\n /**\n * Decide whether the acting agent may run this operation, before it runs.\n * Order: trust floor, then the dollar ceiling (deny or escalate over it),\n * then permission scope. Returns the authorization plus how the ceiling\n * resolved and the runtime decision id when one was created.\n */\n async authorize(\n action: GuidewireAction,\n ): Promise<{\n authorized: boolean;\n reason?: string;\n ceilingOutcome: CeilingOutcome;\n approverId?: string;\n decisionId?: string;\n }> {\n const scope = this.scopeFor(action.operation);\n const { kind, limit } = this.ceilingFor(action.operation);\n const overCeiling =\n kind != null && limit != null && typeof action.amount === 'number' && action.amount > limit;\n\n try {\n // Trust floor (optional): refuse low-trust agents up front.\n if (this.minTrustScore > 0) {\n const trust = await this.sdk.verify(this.agentId);\n if ((trust?.trust_score ?? 0) < this.minTrustScore) {\n return {\n authorized: false,\n reason: `trust score below ${this.minTrustScore}`,\n ceilingOutcome: overCeiling ? 'over-ceiling' : 'within',\n };\n }\n }\n\n // Dollar ceiling: the attenuation wedge. An amount above this agent's\n // delegated limit either hard-denies, or (when escalateOverCeiling is on)\n // routes to a named human approver and waits — segregation of duties.\n if (overCeiling) {\n if (!this.escalateOverCeiling) {\n return {\n authorized: false,\n reason: `${kind} ${action.amount} exceeds this agent's ceiling of ${limit}`,\n ceilingOutcome: 'over-ceiling',\n };\n }\n const esc = await this.escalate(action, scope, kind!, limit!);\n return {\n authorized: esc.approved,\n reason: esc.approved ? undefined : (esc.reason ?? 'escalation denied'),\n ceilingOutcome: esc.approved ? 'escalated-approved' : 'escalated-denied',\n approverId: this.humanId,\n decisionId: esc.decisionId,\n };\n }\n\n // Within ceiling (or no ceiling): a plain permission check on the scope.\n const perm = await this.sdk.check(this.agentId, scope);\n return perm.allowed\n ? { authorized: true, ceilingOutcome: 'within' }\n : {\n authorized: false,\n reason: perm.reason ?? `missing scope ${scope}`,\n ceilingOutcome: 'within',\n };\n } catch (e: any) {\n // Fail closed by default: a check we could not complete is a deny.\n return this.onError === 'open'\n ? {\n authorized: true,\n reason: 'vorim unreachable, failed open',\n ceilingOutcome: overCeiling ? 'over-ceiling' : 'within',\n }\n : {\n authorized: false,\n reason: `vorim unreachable: ${e?.message ?? 'error'}`,\n ceilingOutcome: overCeiling ? 'over-ceiling' : 'within',\n };\n }\n }\n\n /**\n * Route an over-ceiling money action through the runtime decision plane so a\n * named human approver can allow or deny it, and wait for that decision. The\n * elevated scope (agent:elevate) marks this as a segregation-of-duties gate:\n * the agent that initiates the payment cannot also approve it above its limit.\n */\n private async escalate(\n action: GuidewireAction,\n scope: PermissionScope,\n kind: Exclude<CeilingKind, null>,\n limit: number,\n ): Promise<{ approved: boolean; reason?: string; decisionId?: string }> {\n const decision = await this.sdk.beforeAction(\n {\n agentId: this.agentId,\n actionType: 'api_request',\n actionTarget: `guidewire:${action.operation}`,\n requiredScope: scope,\n payload: {\n amount: action.amount,\n currency: action.currency,\n ceiling: kind,\n limit,\n resource_id: action.resourceId,\n },\n context: {\n integration: 'guidewire-cloud',\n instance: this.instance,\n requires_named_approver: true,\n approver_hint: this.humanId,\n },\n },\n { throwOnDeny: false },\n );\n\n // Resolve the escalate verdict: wait for the named approver's decision.\n if (decision.decision === 'escalate') {\n const resolved = await this.sdk.waitForDecisionResolution(decision.decisionId, {\n timeoutMs: this.escalationTimeoutMs,\n });\n const approved = resolved.decision === 'allow' || resolved.escalationResolution === 'approved';\n return {\n approved,\n reason: approved ? undefined : 'named approver denied',\n decisionId: decision.decisionId,\n };\n }\n // A non-escalate verdict resolves immediately. 'allow' / 'fallback' pass;\n // 'deny' fails. Fallback (control plane unreachable) obeys onError.\n if (decision.decision === 'allow') return { approved: true, decisionId: decision.decisionId };\n if (decision.decision === 'fallback')\n return { approved: this.onError === 'open', reason: 'runtime unreachable', decisionId: decision.decisionId };\n return { approved: false, reason: decision.reason ?? 'denied', decisionId: decision.decisionId };\n }\n\n /**\n * Emit a source-signed audit event for a core-system operation and return\n * whether it was recorded. Called after the mutation runs (or after a denial).\n * The event names the agent, the instance, the human the agent acts for, the\n * amount vs. its ceiling, and any approver — so the record is attributable and\n * independently verifiable offline, and carries the amount/authority/approval\n * an insurance examiner looks for.\n */\n async record(\n action: GuidewireAction,\n result: 'success' | 'denied' | 'error',\n extra: { reason?: string; ceilingOutcome?: CeilingOutcome; approverId?: string; decisionId?: string } = {},\n ): Promise<boolean> {\n const scope = this.scopeFor(action.operation);\n const { kind } = this.ceilingFor(action.operation);\n try {\n await this.sdk.emit(\n {\n agent_id: this.agentId,\n event_type: 'api_request',\n action: `guidewire:${action.operation}${action.resourceId ? ' ' + action.resourceId : ''}`,\n resource: action.resourceId || this.instance,\n permission: scope,\n result,\n input_hash: action.inputHash,\n metadata: {\n integration: 'guidewire-cloud',\n instance: this.instance,\n acts_for_human: this.humanId,\n operation: action.operation,\n ...(action.amount != null ? { amount: action.amount } : {}),\n ...(action.currency ? { currency: action.currency } : {}),\n ...(kind ? { ceiling_kind: kind } : {}),\n ...(extra.ceilingOutcome ? { ceiling_outcome: extra.ceilingOutcome } : {}),\n ...(extra.approverId ? { approver_id: extra.approverId } : {}),\n ...(extra.decisionId ? { decision_id: extra.decisionId } : {}),\n ...(extra.reason ? { reason: extra.reason } : {}),\n },\n },\n { sign: true }, // source-signed: the agent's key signs the record\n );\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * The full flow for one core-system operation: authorize (trust, ceiling with\n * escalation, scope), run the Cloud API call if allowed, sign a receipt either\n * way. If not authorized, `run` is never called. Rethrows an error from `run`\n * after recording it, with the receipt attached as `vorimReceipt`, so your\n * handler still sees Guidewire failures.\n */\n async guard<T>(\n action: GuidewireAction,\n run: () => Promise<T>,\n ): Promise<{ receipt: GuidewireReceipt; value?: T }> {\n const auth = await this.authorize(action);\n if (!auth.authorized) {\n const recorded = await this.record(action, 'denied', {\n reason: auth.reason,\n ceilingOutcome: auth.ceilingOutcome,\n approverId: auth.approverId,\n decisionId: auth.decisionId,\n });\n return {\n receipt: this.receipt(action, false, 'denied', auth, recorded),\n };\n }\n try {\n const value = await run();\n const recorded = await this.record(action, 'success', {\n ceilingOutcome: auth.ceilingOutcome,\n approverId: auth.approverId,\n decisionId: auth.decisionId,\n });\n return { receipt: this.receipt(action, true, 'success', auth, recorded), value };\n } catch (e: any) {\n const recorded = await this.record(action, 'error', {\n reason: e?.message,\n ceilingOutcome: auth.ceilingOutcome,\n approverId: auth.approverId,\n decisionId: auth.decisionId,\n });\n throw Object.assign(e ?? new Error('guidewire operation failed'), {\n vorimReceipt: this.receipt(action, true, 'error', { ...auth, reason: e?.message }, recorded),\n });\n }\n }\n\n // --- Named helpers for the high-risk Cloud API mutations -------------------\n // Each wraps guard() with the right operation label so the scope, ceiling, and\n // receipt are correct without the caller remembering the mapping. You pass the\n // Cloud API call as `run`; this layer never talks to Guidewire itself.\n\n /** Guard a claim payment (`POST /claims/{claimId}/check-sets`). Requires\n * agent:transact and stays within `maxPaymentAmount`; above it, escalates to\n * a named adjuster when `escalateOverCeiling` is on. `amount` is minor units\n * (the check-set total). */\n guardedCheckSet<T>(\n meta: { claimId?: string; amount?: number; currency?: string; inputHash?: string },\n run: () => Promise<T>,\n ) {\n return this.guard(\n { operation: 'checkSet', resourceId: meta.claimId, amount: meta.amount, currency: meta.currency, inputHash: meta.inputHash },\n run,\n );\n }\n\n /** Guard a reserve change (`POST /claims/{claimId}/reserve-sets`). Requires\n * agent:transact and stays within `maxReserveAmount`. */\n guardedReserveSet<T>(\n meta: { claimId?: string; amount?: number; currency?: string; inputHash?: string },\n run: () => Promise<T>,\n ) {\n return this.guard(\n { operation: 'reserveSet', resourceId: meta.claimId, amount: meta.amount, currency: meta.currency, inputHash: meta.inputHash },\n run,\n );\n }\n\n /** Guard a recovery reserve (`POST /claims/{claimId}/recovery-reserve-sets`).\n * Requires agent:transact; checked against the payment ceiling. */\n guardedRecoveryReserveSet<T>(\n meta: { claimId?: string; amount?: number; currency?: string; inputHash?: string },\n run: () => Promise<T>,\n ) {\n return this.guard(\n { operation: 'recoveryReserveSet', resourceId: meta.claimId, amount: meta.amount, currency: meta.currency, inputHash: meta.inputHash },\n run,\n );\n }\n\n /** Guard a policy bind + issue (`POST /job/v1/jobs/{jobId}/bind-and-issue`).\n * Requires agent:transact; checked against the premium ceiling. Pass the\n * premium as `amount` (minor units) to attenuate on it. */\n guardedPolicyBind<T>(\n meta: { jobId?: string; amount?: number; currency?: string; inputHash?: string },\n run: () => Promise<T>,\n ) {\n return this.guard(\n { operation: 'policyBindIssue', resourceId: meta.jobId, amount: meta.amount, currency: meta.currency, inputHash: meta.inputHash },\n run,\n );\n }\n\n /** Guard an endorsement / mid-term policy change job. Requires agent:write by\n * default; pass the premium delta as `amount` to attenuate on the premium\n * ceiling. */\n guardedEndorsement<T>(\n meta: { jobId?: string; amount?: number; currency?: string; inputHash?: string },\n run: () => Promise<T>,\n ) {\n return this.guard(\n { operation: 'endorsement', resourceId: meta.jobId, amount: meta.amount, currency: meta.currency, inputHash: meta.inputHash },\n run,\n );\n }\n\n /** Guard a premium refund / billing credit. Requires agent:transact; checked\n * against the payment ceiling, like the Shopify refund cap. */\n guardedPremiumRefund<T>(\n meta: { resourceId?: string; amount?: number; currency?: string; inputHash?: string },\n run: () => Promise<T>,\n ) {\n return this.guard(\n { operation: 'premiumRefund', resourceId: meta.resourceId, amount: meta.amount, currency: meta.currency, inputHash: meta.inputHash },\n run,\n );\n }\n\n /** Guard a claim assignment (`POST /claims/{claimId}/assign`). Requires\n * agent:write; no money moves. */\n guardedClaimAssign<T>(meta: { claimId?: string; inputHash?: string }, run: () => Promise<T>) {\n return this.guard({ operation: 'claimAssign', resourceId: meta.claimId, inputHash: meta.inputHash }, run);\n }\n\n private receipt(\n action: GuidewireAction,\n authorized: boolean,\n result: 'success' | 'denied' | 'error',\n auth: { reason?: string; ceilingOutcome?: CeilingOutcome; approverId?: string; decisionId?: string },\n recorded: boolean,\n ): GuidewireReceipt {\n const { kind } = this.ceilingFor(action.operation);\n return {\n authorized,\n agentId: this.agentId,\n humanId: this.humanId,\n instance: this.instance,\n operation: action.operation,\n resourceId: action.resourceId,\n amount: action.amount,\n currency: action.currency,\n ceiling: kind ?? undefined,\n ceilingOutcome: auth.ceilingOutcome,\n approverId: auth.approverId,\n result,\n scope: this.scopeFor(action.operation),\n reason: auth.reason,\n decisionId: auth.decisionId,\n recorded,\n };\n }\n}\n\n/**\n * Create a VorimGuidewire guard around a Vorim SDK instance.\n *\n * @example\n * ```typescript\n * import createVorim from '@vorim/sdk';\n * import { createVorimGuidewire } from '@vorim/sdk/integrations/guidewire';\n *\n * const vorim = createVorim({ apiKey: 'agid_sk_...' });\n * const gw = createVorimGuidewire(vorim, {\n * agentId: 'agid_abc123',\n * instance: 'acme.guidewire.net',\n * humanId: 'adjuster_42',\n * maxPaymentAmount: 500000, // pay claims up to $5,000.00\n * escalateOverCeiling: true, // above that -> named adjuster approval\n * });\n *\n * const { receipt, value } = await gw.guardedCheckSet(\n * { claimId: 'cc:42', amount: 499900, currency: 'USD' },\n * () => cloudApi.post('/claims/cc:42/check-sets', checkSet),\n * );\n * ```\n */\nexport function createVorimGuidewire(sdk: VorimSDK, config: GuidewireGuardConfig): VorimGuidewire {\n return new VorimGuidewire(sdk, config);\n}\n"],"mappings":";AA2FA,IAAM,kBAAmD;AAAA,EACvD,MAAM;AAAA,EACN,aAAa;AAAA,EACb,aAAa;AAAA,EACb,aAAa;AAAA,EACb,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,oBAAoB;AAAA,EACpB,iBAAiB;AAAA,EACjB,eAAe;AACjB;AAMA,IAAM,oBAAiD;AAAA,EACrD,UAAU;AAAA,EACV,eAAe;AAAA,EACf,oBAAoB;AAAA,EACpB,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,aAAa;AACf;AAgFO,IAAM,iBAAN,MAAqB;AAAA,EAClB;AAAA,EACA;A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