@emilia-protocol/sdk 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/README.md +68 -42
- package/dist/client.d.ts +36 -30
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +193 -43
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +12 -516
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -336
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +209 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +9 -7
- package/src/client.ts +243 -42
- package/src/index.ts +13 -932
- package/src/types.ts +229 -11
package/dist/index.js
CHANGED
|
@@ -1,337 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
// -- Cloud Client -----------------------------------------------------------
|
|
15
|
-
export class EPCloudClient {
|
|
16
|
-
_request;
|
|
17
|
-
/** @internal */
|
|
18
|
-
constructor(_request) {
|
|
19
|
-
this._request = _request;
|
|
20
|
-
}
|
|
21
|
-
/** Get pending signoffs, optionally filtered by entity, scope, or status. */
|
|
22
|
-
async getPendingSignoffs(filters) {
|
|
23
|
-
const qs = this._buildQs(filters);
|
|
24
|
-
return this._request('GET', `/api/cloud/signoffs/pending${qs}`, undefined, true);
|
|
25
|
-
}
|
|
26
|
-
/** Get the signoff queue with optional filtering. */
|
|
27
|
-
async getSignoffQueue(filters) {
|
|
28
|
-
const qs = this._buildQs(filters);
|
|
29
|
-
return this._request('GET', `/api/cloud/signoffs/queue${qs}`, undefined, true);
|
|
30
|
-
}
|
|
31
|
-
/** Get a dashboard summary of signoff activity over a date range. */
|
|
32
|
-
async getSignoffDashboard(dateRange) {
|
|
33
|
-
const qs = this._buildDateRangeQs(dateRange);
|
|
34
|
-
return this._request('GET', `/api/cloud/signoffs/dashboard${qs}`, undefined, true);
|
|
35
|
-
}
|
|
36
|
-
/** Get analytics for signoff activity with optional granularity. */
|
|
37
|
-
async getSignoffAnalytics(dateRange, granularity) {
|
|
38
|
-
const params = {};
|
|
39
|
-
if (dateRange?.from)
|
|
40
|
-
params['from'] = dateRange.from;
|
|
41
|
-
if (dateRange?.to)
|
|
42
|
-
params['to'] = dateRange.to;
|
|
43
|
-
if (granularity)
|
|
44
|
-
params['granularity'] = granularity;
|
|
45
|
-
const qs = this._toQs(params);
|
|
46
|
-
return this._request('GET', `/api/cloud/signoffs/analytics${qs}`, undefined, true);
|
|
47
|
-
}
|
|
48
|
-
/** Escalate a signoff challenge to another entity. */
|
|
49
|
-
async escalateSignoff(challengeId, escalateTo, reason) {
|
|
50
|
-
return this._request('POST', `/api/cloud/signoffs/${encodeURIComponent(challengeId)}/escalate`, {
|
|
51
|
-
escalateTo,
|
|
52
|
-
reason,
|
|
53
|
-
}, true);
|
|
54
|
-
}
|
|
55
|
-
/** Send a notification about a signoff challenge via the specified channel. */
|
|
56
|
-
async notifySignoff(challengeId, channel) {
|
|
57
|
-
return this._request('POST', `/api/cloud/signoffs/${encodeURIComponent(challengeId)}/notify`, {
|
|
58
|
-
channel,
|
|
59
|
-
}, true);
|
|
60
|
-
}
|
|
61
|
-
/** Search audit events by query string and optional filters. */
|
|
62
|
-
async searchEvents(query, filters) {
|
|
63
|
-
return this._request('POST', '/api/cloud/events/search', {
|
|
64
|
-
query,
|
|
65
|
-
filters,
|
|
66
|
-
}, true);
|
|
67
|
-
}
|
|
68
|
-
/** Get a chronological timeline of events for a specific handshake. */
|
|
69
|
-
async getEventTimeline(handshakeId) {
|
|
70
|
-
return this._request('GET', `/api/cloud/events/timeline/${encodeURIComponent(handshakeId)}`, undefined, true);
|
|
71
|
-
}
|
|
72
|
-
/** Export audit data in the specified format. */
|
|
73
|
-
async exportAudit(params) {
|
|
74
|
-
return this._request('POST', '/api/cloud/audit/export', params, true);
|
|
75
|
-
}
|
|
76
|
-
/** Generate an audit report for the given type and date range. */
|
|
77
|
-
async getAuditReport(reportType, dateRange) {
|
|
78
|
-
return this._request('POST', '/api/cloud/audit/report', {
|
|
79
|
-
reportType,
|
|
80
|
-
dateRange,
|
|
81
|
-
}, true);
|
|
82
|
-
}
|
|
83
|
-
/** Run an integrity check on the protocol data store. */
|
|
84
|
-
async checkIntegrity() {
|
|
85
|
-
return this._request('POST', '/api/cloud/integrity/check', undefined, true);
|
|
86
|
-
}
|
|
87
|
-
/** Simulate a policy against a hypothetical context without persisting any state. */
|
|
88
|
-
async simulatePolicy(policyId, context) {
|
|
89
|
-
return this._request('POST', `/api/cloud/policies/${encodeURIComponent(policyId)}/simulate`, {
|
|
90
|
-
context,
|
|
91
|
-
}, true);
|
|
92
|
-
}
|
|
93
|
-
/** Begin a rollout of a policy using the specified strategy. */
|
|
94
|
-
async rolloutPolicy(policyId, strategy, percentage) {
|
|
95
|
-
return this._request('POST', `/api/cloud/policies/${encodeURIComponent(policyId)}/rollout`, {
|
|
96
|
-
strategy,
|
|
97
|
-
percentage,
|
|
98
|
-
}, true);
|
|
99
|
-
}
|
|
100
|
-
/** List all versions of a policy. */
|
|
101
|
-
async getPolicyVersions(policyId) {
|
|
102
|
-
return this._request('GET', `/api/cloud/policies/${encodeURIComponent(policyId)}/versions`, undefined, true);
|
|
103
|
-
}
|
|
104
|
-
/** Diff two versions of a policy to see what changed. */
|
|
105
|
-
async diffPolicyVersions(policyId, versionA, versionB) {
|
|
106
|
-
return this._request('POST', `/api/cloud/policies/${encodeURIComponent(policyId)}/diff`, {
|
|
107
|
-
versionA,
|
|
108
|
-
versionB,
|
|
109
|
-
}, true);
|
|
110
|
-
}
|
|
111
|
-
/** @internal Build query string from SignoffFilters. */
|
|
112
|
-
_buildQs(filters) {
|
|
113
|
-
if (!filters)
|
|
114
|
-
return '';
|
|
115
|
-
const params = {};
|
|
116
|
-
if (filters.entityId)
|
|
117
|
-
params['entityId'] = filters.entityId;
|
|
118
|
-
if (filters.scope)
|
|
119
|
-
params['scope'] = filters.scope;
|
|
120
|
-
if (filters.status)
|
|
121
|
-
params['status'] = filters.status;
|
|
122
|
-
if (filters.limit !== undefined)
|
|
123
|
-
params['limit'] = String(filters.limit);
|
|
124
|
-
if (filters.offset !== undefined)
|
|
125
|
-
params['offset'] = String(filters.offset);
|
|
126
|
-
return this._toQs(params);
|
|
127
|
-
}
|
|
128
|
-
/** @internal Build query string from DateRange. */
|
|
129
|
-
_buildDateRangeQs(dateRange) {
|
|
130
|
-
if (!dateRange)
|
|
131
|
-
return '';
|
|
132
|
-
const params = {};
|
|
133
|
-
if (dateRange.from)
|
|
134
|
-
params['from'] = dateRange.from;
|
|
135
|
-
if (dateRange.to)
|
|
136
|
-
params['to'] = dateRange.to;
|
|
137
|
-
return this._toQs(params);
|
|
138
|
-
}
|
|
139
|
-
/** @internal Convert key-value pairs to a query string. */
|
|
140
|
-
_toQs(params) {
|
|
141
|
-
const entries = Object.entries(params).filter(([, v]) => v !== undefined && v !== '');
|
|
142
|
-
if (entries.length === 0)
|
|
143
|
-
return '';
|
|
144
|
-
return '?' + entries.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`).join('&');
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
// -- Client -----------------------------------------------------------------
|
|
148
|
-
export class EPClient {
|
|
149
|
-
baseUrl;
|
|
150
|
-
apiKey;
|
|
151
|
-
timeout;
|
|
152
|
-
retries;
|
|
153
|
-
/** Cloud-specific endpoints (dashboards, analytics, audit, policy management). */
|
|
154
|
-
cloud;
|
|
155
|
-
constructor(options) {
|
|
156
|
-
this.baseUrl = options.baseUrl.replace(/\/+$/, '');
|
|
157
|
-
this.apiKey = options.apiKey ?? '';
|
|
158
|
-
this.timeout = options.timeout ?? 10_000;
|
|
159
|
-
this.retries = options.retries ?? 2;
|
|
160
|
-
// Bind the internal request method for the cloud sub-client
|
|
161
|
-
this.cloud = new EPCloudClient(this.request.bind(this));
|
|
162
|
-
}
|
|
163
|
-
async request(method, path, body, auth = false) {
|
|
164
|
-
const url = `${this.baseUrl}${path}`;
|
|
165
|
-
const headers = {
|
|
166
|
-
'Content-Type': 'application/json',
|
|
167
|
-
'User-Agent': '@emilia-protocol/sdk/0.9.0',
|
|
168
|
-
};
|
|
169
|
-
if (auth && this.apiKey) {
|
|
170
|
-
headers['Authorization'] = `Bearer ${this.apiKey}`;
|
|
171
|
-
}
|
|
172
|
-
let lastErr;
|
|
173
|
-
for (let attempt = 0; attempt <= this.retries; attempt++) {
|
|
174
|
-
const ctrl = new AbortController();
|
|
175
|
-
const timer = setTimeout(() => ctrl.abort(), this.timeout);
|
|
176
|
-
try {
|
|
177
|
-
const res = await fetch(url, {
|
|
178
|
-
method,
|
|
179
|
-
headers,
|
|
180
|
-
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
181
|
-
signal: ctrl.signal,
|
|
182
|
-
});
|
|
183
|
-
const data = await res.json().catch(() => undefined);
|
|
184
|
-
if (!res.ok) {
|
|
185
|
-
const p = data;
|
|
186
|
-
const msg = typeof p?.['error'] === 'string' ? p['error'] : `EP API error: ${res.status}`;
|
|
187
|
-
const code = typeof p?.['code'] === 'string' ? p['code'] : undefined;
|
|
188
|
-
throw new EPError(msg, res.status, code);
|
|
189
|
-
}
|
|
190
|
-
return data;
|
|
191
|
-
}
|
|
192
|
-
catch (err) {
|
|
193
|
-
lastErr = err;
|
|
194
|
-
if (err instanceof EPError) {
|
|
195
|
-
// Only retry on 5xx
|
|
196
|
-
if (err.status && err.status < 500)
|
|
197
|
-
throw err;
|
|
198
|
-
}
|
|
199
|
-
if (err instanceof Error && err.name === 'AbortError') {
|
|
200
|
-
lastErr = new EPError(`Request timed out after ${this.timeout}ms`, undefined, 'timeout');
|
|
201
|
-
}
|
|
202
|
-
if (attempt === this.retries)
|
|
203
|
-
break;
|
|
204
|
-
}
|
|
205
|
-
finally {
|
|
206
|
-
clearTimeout(timer);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
if (lastErr instanceof EPError)
|
|
210
|
-
throw lastErr;
|
|
211
|
-
throw new EPError(lastErr instanceof Error ? lastErr.message : 'Unknown network error', undefined, 'network_error');
|
|
212
|
-
}
|
|
213
|
-
// ------------------------------------------------------------------
|
|
214
|
-
// Core protocol endpoints
|
|
215
|
-
// ------------------------------------------------------------------
|
|
216
|
-
/** List available trust policies. */
|
|
217
|
-
async listPolicies(params) {
|
|
218
|
-
const qs = params?.scope ? `?scope=${encodeURIComponent(params.scope)}` : '';
|
|
219
|
-
return this.request('GET', `/api/policies${qs}`);
|
|
220
|
-
}
|
|
221
|
-
/** Initiate a trust handshake between parties. */
|
|
222
|
-
async initiateHandshake(params) {
|
|
223
|
-
return this.request('POST', '/api/handshake/initiate', params, true);
|
|
224
|
-
}
|
|
225
|
-
/** Present credentials to a handshake. */
|
|
226
|
-
async present(handshakeId, params) {
|
|
227
|
-
return this.request('POST', `/api/handshake/${encodeURIComponent(handshakeId)}/present`, params, true);
|
|
228
|
-
}
|
|
229
|
-
/** Verify a handshake -- evaluate all presentations against policy. */
|
|
230
|
-
async verify(handshakeId) {
|
|
231
|
-
return this.request('POST', `/api/handshake/${encodeURIComponent(handshakeId)}/verify`, undefined, true);
|
|
232
|
-
}
|
|
233
|
-
/** Pre-action trust gate. Returns allow/deny/review with commit ref. */
|
|
234
|
-
async gate(params) {
|
|
235
|
-
return this.request('POST', '/api/gate', {
|
|
236
|
-
entity_id: params.entityId,
|
|
237
|
-
action: params.action,
|
|
238
|
-
policy: params.policy ?? 'standard',
|
|
239
|
-
handshake_id: params.handshakeId,
|
|
240
|
-
value_usd: params.valueUsd,
|
|
241
|
-
delegation_id: params.delegationId,
|
|
242
|
-
}, true);
|
|
243
|
-
}
|
|
244
|
-
/** Retrieve details of a specific handshake by ID. */
|
|
245
|
-
async getHandshake(handshakeId) {
|
|
246
|
-
return this.request('GET', `/api/handshake/${encodeURIComponent(handshakeId)}`, undefined, true);
|
|
247
|
-
}
|
|
248
|
-
/** Revoke an active handshake, invalidating all associated state. */
|
|
249
|
-
async revokeHandshake(handshakeId) {
|
|
250
|
-
return this.request('POST', `/api/handshake/${encodeURIComponent(handshakeId)}/revoke`, undefined, true);
|
|
251
|
-
}
|
|
252
|
-
/** Consume a handshake -- finalize and optionally bind a receipt. */
|
|
253
|
-
async consume(handshakeId, params) {
|
|
254
|
-
return this.request('POST', `/api/handshake/${encodeURIComponent(handshakeId)}/consume`, params, true);
|
|
255
|
-
}
|
|
256
|
-
// ------------------------------------------------------------------
|
|
257
|
-
// Signoff extension
|
|
258
|
-
// ------------------------------------------------------------------
|
|
259
|
-
/** Issue a signoff challenge for an entity. */
|
|
260
|
-
async issueChallenge(params) {
|
|
261
|
-
return this.request('POST', '/api/signoff/challenge', {
|
|
262
|
-
entity_id: params.entityId,
|
|
263
|
-
scope: params.scope,
|
|
264
|
-
context: params.context,
|
|
265
|
-
}, true);
|
|
266
|
-
}
|
|
267
|
-
/** Attest to a signoff challenge with a cryptographic signature. */
|
|
268
|
-
async attest(challengeId, params) {
|
|
269
|
-
return this.request('POST', `/api/signoff/${encodeURIComponent(challengeId)}/attest`, params, true);
|
|
270
|
-
}
|
|
271
|
-
/** Deny a signoff challenge with an optional reason. */
|
|
272
|
-
async denyChallenge(challengeId, reason) {
|
|
273
|
-
return this.request('POST', `/api/signoff/${encodeURIComponent(challengeId)}/deny`, reason !== undefined ? { reason } : undefined, true);
|
|
274
|
-
}
|
|
275
|
-
/** Revoke a previously granted signoff. */
|
|
276
|
-
async revokeSignoff(challengeId, options) {
|
|
277
|
-
return this.request('POST', `/api/signoff/${encodeURIComponent(challengeId)}/revoke`, options, true);
|
|
278
|
-
}
|
|
279
|
-
/** Consume a signoff -- mark it as used for a specific action. */
|
|
280
|
-
async consumeSignoff(signoffId, params) {
|
|
281
|
-
return this.request('POST', `/api/signoff/${encodeURIComponent(signoffId)}/consume`, params, true);
|
|
282
|
-
}
|
|
283
|
-
// ------------------------------------------------------------------
|
|
284
|
-
// Delegation
|
|
285
|
-
// ------------------------------------------------------------------
|
|
286
|
-
/** Create a trust delegation from one entity to another. */
|
|
287
|
-
async createDelegation(params) {
|
|
288
|
-
return this.request('POST', '/api/delegation', {
|
|
289
|
-
delegatorId: params.delegatorId,
|
|
290
|
-
delegateeId: params.delegateeId,
|
|
291
|
-
scope: params.scope,
|
|
292
|
-
policyId: params.policyId,
|
|
293
|
-
constraints: params.constraints,
|
|
294
|
-
expiresAt: params.expiresAt,
|
|
295
|
-
}, true);
|
|
296
|
-
}
|
|
297
|
-
/** Verify the validity of an existing delegation. */
|
|
298
|
-
async verifyDelegation(delegationId) {
|
|
299
|
-
return this.request('POST', `/api/delegation/${encodeURIComponent(delegationId)}/verify`, undefined, true);
|
|
300
|
-
}
|
|
301
|
-
// ------------------------------------------------------------------
|
|
302
|
-
// Commit
|
|
303
|
-
// ------------------------------------------------------------------
|
|
304
|
-
/** Issue a trust commit binding a handshake to a specific action. */
|
|
305
|
-
async issueCommit(params) {
|
|
306
|
-
return this.request('POST', '/api/commit', {
|
|
307
|
-
handshakeId: params.handshakeId,
|
|
308
|
-
action: params.action,
|
|
309
|
-
payload: params.payload,
|
|
310
|
-
binding: params.binding,
|
|
311
|
-
}, true);
|
|
312
|
-
}
|
|
313
|
-
/** Verify a previously issued commit. */
|
|
314
|
-
async verifyCommit(commitId) {
|
|
315
|
-
return this.request('POST', `/api/commit/${encodeURIComponent(commitId)}/verify`, undefined, true);
|
|
316
|
-
}
|
|
317
|
-
// ------------------------------------------------------------------
|
|
318
|
-
// Eye — Observation & Advisory
|
|
319
|
-
// ------------------------------------------------------------------
|
|
320
|
-
/** Record a behavioral or contextual observation for the Eye subsystem. */
|
|
321
|
-
async recordObservation(params) {
|
|
322
|
-
return this.request('POST', '/api/eye/observations', params, true);
|
|
323
|
-
}
|
|
324
|
-
/** Check an action against recorded observations and return an advisory. */
|
|
325
|
-
async checkAction(params) {
|
|
326
|
-
return this.request('POST', '/api/eye/check', params, true);
|
|
327
|
-
}
|
|
328
|
-
/** Retrieve an existing advisory by ID. */
|
|
329
|
-
async getAdvisory(advisoryId) {
|
|
330
|
-
return this.request('GET', `/api/eye/advisories/${encodeURIComponent(advisoryId)}`, undefined, true);
|
|
331
|
-
}
|
|
332
|
-
/** Create a suppression to exclude a reason code from future advisories. */
|
|
333
|
-
async createSuppression(params) {
|
|
334
|
-
return this.request('POST', '/api/eye/suppressions', params, true);
|
|
335
|
-
}
|
|
336
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* EMILIA Protocol TypeScript SDK.
|
|
3
|
+
*
|
|
4
|
+
* The package root intentionally re-exports the single supported client
|
|
5
|
+
* implementation. Keeping the entry point as a barrel prevents the public
|
|
6
|
+
* package contract from drifting away from the client exercised by the SDK
|
|
7
|
+
* tests and documented in the README.
|
|
8
|
+
*
|
|
9
|
+
* @license Apache-2.0
|
|
10
|
+
*/
|
|
11
|
+
export { EPClient } from './client.js';
|
|
12
|
+
export * from './types.js';
|
|
337
13
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uFAAuF;AA+evF,8EAA8E;AAE9E,MAAM,OAAO,OAAQ,SAAQ,KAAK;IAGd;IACA;IAHlB,YACE,OAAe,EACC,MAAe,EACf,IAAa;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,WAAM,GAAN,MAAM,CAAS;QACf,SAAI,GAAJ,IAAI,CAAS;QAG7B,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;CACF;AAED,8EAA8E;AAE9E,MAAM,OAAO,aAAa;IAEK;IAD7B,gBAAgB;IA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A2E;IAC3E,KAAK,CAAC,iBAAiB,CAAC,MAA+B;QACrD,OAAO,IAAI,CAAC,OAAO,CAAsB,MAAM,EAAE,uBAAuB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAC1F,CAAC;IAED,4EAA4E;IAC5E,KAAK,CAAC,WAAW,CAAC,MAAyB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAmB,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAChF,CAAC;IAED,2CAA2C;IAC3C,KAAK,CAAC,WAAW,CAAC,UAAkB;QAClC,OAAO,IAAI,CAAC,OAAO,CACjB,KAAK,EACL,uBAAuB,kBAAkB,CAAC,UAAU,CAAC,EAAE,EACvD,SAAS,EACT,IAAI,CACL,CAAC;IACJ,CAAC;IAED,4EAA4E;IAC5E,KAAK,CAAC,iBAAiB,CAAC,MAA+B;QACrD,OAAO,IAAI,CAAC,OAAO,CAAsB,MAAM,EAAE,uBAAuB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAC1F,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,cAAc,YAAY,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -318,6 +318,214 @@ export interface InstallPreflightResult {
|
|
|
318
318
|
/** Legacy compatibility score — prefer decision field */
|
|
319
319
|
score: number;
|
|
320
320
|
}
|
|
321
|
+
export type GuardActionType = 'benefit_bank_account_change' | 'benefit_address_change' | 'caseworker_override' | 'gov.vendor_payment_destination_change' | 'gov.disbursement_release' | 'gov.grant_disbursement' | 'gov.provider_enrollment_change' | 'gov.eligibility_override' | 'vendor_bank_account_change' | 'beneficiary_creation' | 'large_payment_release' | 'ai_agent_payment_action' | 'policy_rollout';
|
|
322
|
+
export type GuardDecision = 'allow' | 'observe' | 'allow_with_signoff' | 'deny';
|
|
323
|
+
export type GuardEnforcementMode = 'observe' | 'warn' | 'enforce';
|
|
324
|
+
export type ReceiptStatus = 'issued' | 'pending_signoff' | 'approved_pending_consume' | 'rejected' | 'consumed' | 'denied';
|
|
325
|
+
export interface GuardQuorumApprover {
|
|
326
|
+
role: string;
|
|
327
|
+
approver: string;
|
|
328
|
+
}
|
|
329
|
+
export interface GuardQuorumPolicy {
|
|
330
|
+
mode?: 'threshold' | 'ordered';
|
|
331
|
+
required: number;
|
|
332
|
+
approvers: GuardQuorumApprover[];
|
|
333
|
+
}
|
|
334
|
+
export interface CreateTrustReceiptParams {
|
|
335
|
+
/** Optional cross-check; the API derives the authorized organization from the authenticated key. */
|
|
336
|
+
organizationId?: string;
|
|
337
|
+
actionType: GuardActionType;
|
|
338
|
+
targetResourceId: string;
|
|
339
|
+
policyId?: string;
|
|
340
|
+
enforcementMode?: GuardEnforcementMode;
|
|
341
|
+
beforeState?: Record<string, unknown>;
|
|
342
|
+
afterState?: Record<string, unknown>;
|
|
343
|
+
targetChangedFields?: string[];
|
|
344
|
+
amount?: number;
|
|
345
|
+
currency?: string;
|
|
346
|
+
riskFlags?: string[];
|
|
347
|
+
actorRole?: string;
|
|
348
|
+
actorDepartment?: string;
|
|
349
|
+
businessHours?: boolean;
|
|
350
|
+
velocitySameActor24h?: number;
|
|
351
|
+
priorDenialsActor30d?: number;
|
|
352
|
+
priorChangesTarget30d?: number;
|
|
353
|
+
destinationAgeDays?: number;
|
|
354
|
+
quorumPolicy?: GuardQuorumPolicy;
|
|
355
|
+
metadata?: Record<string, unknown>;
|
|
356
|
+
}
|
|
357
|
+
export interface TrustReceipt {
|
|
358
|
+
receipt_id: string;
|
|
359
|
+
decision: GuardDecision;
|
|
360
|
+
observed_decision?: GuardDecision | null;
|
|
361
|
+
policy_id: string;
|
|
362
|
+
policy_hash: string;
|
|
363
|
+
action_hash: string;
|
|
364
|
+
before_state_hash?: string | null;
|
|
365
|
+
after_state_hash?: string | null;
|
|
366
|
+
nonce: string;
|
|
367
|
+
expires_at: string;
|
|
368
|
+
signoff_required: boolean;
|
|
369
|
+
signoff_request_id?: string | null;
|
|
370
|
+
risk_flags?: string[];
|
|
371
|
+
receipt_status: ReceiptStatus | string;
|
|
372
|
+
enforcement_mode: GuardEnforcementMode | string;
|
|
373
|
+
reasons?: string[];
|
|
374
|
+
canonical_action: Record<string, unknown>;
|
|
375
|
+
}
|
|
376
|
+
export interface TrustReceiptState {
|
|
377
|
+
receipt_id: string;
|
|
378
|
+
organization_id: string;
|
|
379
|
+
action_type: string;
|
|
380
|
+
decision: GuardDecision;
|
|
381
|
+
enforcement_mode: GuardEnforcementMode | string;
|
|
382
|
+
policy_id: string;
|
|
383
|
+
policy_hash: string;
|
|
384
|
+
action_hash: string;
|
|
385
|
+
before_state_hash?: string | null;
|
|
386
|
+
after_state_hash?: string | null;
|
|
387
|
+
expires_at: string;
|
|
388
|
+
signoff_required: boolean;
|
|
389
|
+
receipt_status: ReceiptStatus | string;
|
|
390
|
+
signoff_key_class?: 'A' | 'B' | 'C' | string | null;
|
|
391
|
+
timeline_event_count: number;
|
|
392
|
+
}
|
|
393
|
+
export interface RequestSignoffParams {
|
|
394
|
+
receiptId: string;
|
|
395
|
+
approverId?: string;
|
|
396
|
+
expiresInMinutes?: number;
|
|
397
|
+
comment?: string;
|
|
398
|
+
}
|
|
399
|
+
export interface SignoffRequest {
|
|
400
|
+
signoff_id?: string;
|
|
401
|
+
receipt_id: string;
|
|
402
|
+
action_hash: string;
|
|
403
|
+
initiator_id: string;
|
|
404
|
+
approver_id?: string;
|
|
405
|
+
expires_at: string;
|
|
406
|
+
status: 'pending' | string;
|
|
407
|
+
quorum?: {
|
|
408
|
+
mode: string;
|
|
409
|
+
required: number;
|
|
410
|
+
count: number;
|
|
411
|
+
};
|
|
412
|
+
signoffs?: Array<{
|
|
413
|
+
signoff_id: string;
|
|
414
|
+
role?: string;
|
|
415
|
+
approver_id: string;
|
|
416
|
+
}>;
|
|
417
|
+
}
|
|
418
|
+
export interface ConsumeTrustReceiptParams {
|
|
419
|
+
actionHash: string;
|
|
420
|
+
executingSystem: string;
|
|
421
|
+
executionReferenceId?: string;
|
|
422
|
+
}
|
|
423
|
+
export interface ConsumeTrustReceiptResult {
|
|
424
|
+
receipt_id: string;
|
|
425
|
+
status: 'consumed' | string;
|
|
426
|
+
consumed_at: string;
|
|
427
|
+
consumed_by_system: string;
|
|
428
|
+
execution_reference_id?: string | null;
|
|
429
|
+
}
|
|
430
|
+
export interface AttestExecutionParams {
|
|
431
|
+
executedAction: Record<string, unknown>;
|
|
432
|
+
observedAction: Record<string, unknown>;
|
|
433
|
+
executingSystem: string;
|
|
434
|
+
executionId?: string;
|
|
435
|
+
executedAt?: string;
|
|
436
|
+
}
|
|
437
|
+
export interface ExecutionAttestation {
|
|
438
|
+
receipt_id: string;
|
|
439
|
+
status: 'executed' | string;
|
|
440
|
+
binding_status: 'match' | 'drift' | string;
|
|
441
|
+
executed_action_hash: string;
|
|
442
|
+
approved_action_hash: string;
|
|
443
|
+
execution_integrity: Record<string, unknown>;
|
|
444
|
+
}
|
|
445
|
+
export interface TrustReceiptEvidence {
|
|
446
|
+
document: Record<string, unknown> | null;
|
|
447
|
+
public_key: string | null;
|
|
448
|
+
signed: boolean;
|
|
449
|
+
verify_with: string;
|
|
450
|
+
receipt_id: string;
|
|
451
|
+
organization_id: string;
|
|
452
|
+
action: {
|
|
453
|
+
type: string;
|
|
454
|
+
action_hash: string;
|
|
455
|
+
before_state_hash?: string | null;
|
|
456
|
+
after_state_hash?: string | null;
|
|
457
|
+
};
|
|
458
|
+
policy: {
|
|
459
|
+
id: string;
|
|
460
|
+
hash: string;
|
|
461
|
+
decision: string;
|
|
462
|
+
enforcement_mode: string;
|
|
463
|
+
};
|
|
464
|
+
signoff: {
|
|
465
|
+
required: boolean;
|
|
466
|
+
approver_id?: string | null;
|
|
467
|
+
approved_at?: string | null;
|
|
468
|
+
rejected_at?: string | null;
|
|
469
|
+
events: Array<{
|
|
470
|
+
event_type: string;
|
|
471
|
+
actor_id: string;
|
|
472
|
+
at: string;
|
|
473
|
+
}>;
|
|
474
|
+
};
|
|
475
|
+
consume: {
|
|
476
|
+
consumed_at?: string | null;
|
|
477
|
+
consumed_by_system?: string | null;
|
|
478
|
+
execution_reference_id?: string | null;
|
|
479
|
+
};
|
|
480
|
+
issued_at: string;
|
|
481
|
+
expires_at: string;
|
|
482
|
+
schema_version: string;
|
|
483
|
+
[key: string]: unknown;
|
|
484
|
+
}
|
|
485
|
+
export interface SignoffRequiredContext {
|
|
486
|
+
client: unknown;
|
|
487
|
+
receipt: TrustReceipt;
|
|
488
|
+
signoff?: SignoffRequest;
|
|
489
|
+
}
|
|
490
|
+
export interface RequireReceiptParams extends CreateTrustReceiptParams {
|
|
491
|
+
executingSystem: string;
|
|
492
|
+
executionReferenceId?: string;
|
|
493
|
+
approverId?: string;
|
|
494
|
+
signoffComment?: string;
|
|
495
|
+
signoffExpiresInMinutes?: number;
|
|
496
|
+
/**
|
|
497
|
+
* Called after a signoff request is created. Complete approval externally
|
|
498
|
+
* (for example a passkey/WebAuthn ceremony or operator workflow) before
|
|
499
|
+
* returning. If omitted, the SDK fails closed and does not run the mutation.
|
|
500
|
+
*/
|
|
501
|
+
onSignoffRequired?: (ctx: SignoffRequiredContext) => Promise<void | boolean | {
|
|
502
|
+
approved?: boolean;
|
|
503
|
+
}>;
|
|
504
|
+
/** Legacy explicit execution report. Prefer observedAction for new integrations. */
|
|
505
|
+
executedAction?: Record<string, unknown> | ((ctx: {
|
|
506
|
+
receipt: TrustReceipt;
|
|
507
|
+
result: unknown;
|
|
508
|
+
}) => Record<string, unknown>);
|
|
509
|
+
/**
|
|
510
|
+
* Action fields independently observed by the executor after mutation. If
|
|
511
|
+
* omitted, no execution attestation is emitted.
|
|
512
|
+
*/
|
|
513
|
+
observedAction?: Record<string, unknown> | ((ctx: {
|
|
514
|
+
receipt: TrustReceipt;
|
|
515
|
+
result: unknown;
|
|
516
|
+
}) => Record<string, unknown>);
|
|
517
|
+
executionId?: string | ((result: unknown) => string | undefined);
|
|
518
|
+
fetchEvidence?: boolean;
|
|
519
|
+
}
|
|
520
|
+
export interface RequireReceiptResult<T> {
|
|
521
|
+
result: T;
|
|
522
|
+
receipt: TrustReceipt;
|
|
523
|
+
signoff?: SignoffRequest;
|
|
524
|
+
consume: ConsumeTrustReceiptResult;
|
|
525
|
+
execution?: ExecutionAttestation;
|
|
526
|
+
executionStatus: 'attested' | 'unobserved';
|
|
527
|
+
evidence?: TrustReceiptEvidence;
|
|
528
|
+
}
|
|
321
529
|
/** A principal — the enduring actor behind one or more entities. */
|
|
322
530
|
export interface Principal {
|
|
323
531
|
principal_id: string;
|
|
@@ -366,15 +574,6 @@ export interface LineageResult {
|
|
|
366
574
|
transfer_policy?: string;
|
|
367
575
|
}>;
|
|
368
576
|
}
|
|
369
|
-
/** Result of a batch receipt submission. */
|
|
370
|
-
export interface BatchReceiptResult {
|
|
371
|
-
results: Array<{
|
|
372
|
-
entity_id: string;
|
|
373
|
-
success: boolean;
|
|
374
|
-
receipt_id?: string;
|
|
375
|
-
error?: string;
|
|
376
|
-
}>;
|
|
377
|
-
}
|
|
378
577
|
/** Result of a bilateral receipt confirmation. */
|
|
379
578
|
export interface ConfirmReceiptResult {
|
|
380
579
|
receipt_id: string;
|
|
@@ -388,7 +587,7 @@ export interface TrustPolicyDefinition {
|
|
|
388
587
|
description: string;
|
|
389
588
|
min_confidence?: ConfidenceTier;
|
|
390
589
|
}
|
|
391
|
-
/**
|
|
590
|
+
/** Authenticated operator metrics from /api/stats. */
|
|
392
591
|
export interface EPStats {
|
|
393
592
|
total_entities: number;
|
|
394
593
|
trust_surfaces: number;
|