@emilia-protocol/sdk 0.1.0 → 0.9.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/README.md +810 -0
- package/dist/client.d.ts +540 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +740 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +512 -189
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +317 -139
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +508 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +35 -0
- package/dist/types.js.map +1 -0
- package/package.json +28 -11
- package/src/client.ts +920 -0
- package/src/index.ts +932 -0
- package/src/types.ts +640 -0
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
import type { EntityType, TrustPolicy, TrustContext, DisputeReason, ReportType, TrustDomain, EntityTrustProfile, TrustEvaluation, SubmitReceiptInput, SubmitReceiptResult, EntitySearchResult, Dispute, LeaderboardEntry, TrustGateResult, DelegationRecord, DomainScoreResult, InstallPreflightResult, PrincipalLookupResult, LineageResult, BatchReceiptResult, ConfirmReceiptResult, TrustPolicyDefinition, EPStats, EPClientOptions, EPCommitRequest, EPCommitVerification, EPCommitIssueResult, EPCommitStatusResult, EPCommitRevokeResult, EPCommitReceiptResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Client for the EMILIA Protocol API.
|
|
4
|
+
*
|
|
5
|
+
* All public methods return typed promises and throw `EPError` on failure.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { EPClient } from '@emilia-protocol/sdk';
|
|
10
|
+
*
|
|
11
|
+
* const ep = new EPClient({ apiKey: process.env.EP_API_KEY });
|
|
12
|
+
*
|
|
13
|
+
* const profile = await ep.trustProfile('merchant-xyz');
|
|
14
|
+
* console.log(profile.current_confidence); // "confident"
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare class EPClient {
|
|
18
|
+
private readonly baseUrl;
|
|
19
|
+
private readonly apiKey;
|
|
20
|
+
private readonly timeout;
|
|
21
|
+
private readonly fetchImpl;
|
|
22
|
+
constructor(options?: EPClientOptions);
|
|
23
|
+
private request;
|
|
24
|
+
/**
|
|
25
|
+
* Get an entity's full trust profile.
|
|
26
|
+
*
|
|
27
|
+
* This is the CANONICAL read surface for EP trust data. Call this before
|
|
28
|
+
* transacting with any counterparty or installing any software.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const profile = await ep.trustProfile('merchant-xyz');
|
|
33
|
+
* console.log(profile.current_confidence); // "confident"
|
|
34
|
+
* console.log(profile.trust_profile?.behavioral?.completion_rate); // 97.2
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
trustProfile(entityId: string): Promise<EntityTrustProfile>;
|
|
38
|
+
/**
|
|
39
|
+
* Evaluate an entity against a named trust policy.
|
|
40
|
+
*
|
|
41
|
+
* Returns a canonical TrustDecision with detailed reasoning.
|
|
42
|
+
* Supply `context` for context-aware evaluation (geo, category, value_band, etc.).
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const result = await ep.trustEvaluate('merchant-xyz', 'strict', {
|
|
47
|
+
* category: 'furniture',
|
|
48
|
+
* geo: 'US-CA',
|
|
49
|
+
* value_band: 'high',
|
|
50
|
+
* });
|
|
51
|
+
* if (result.decision !== 'allow') console.warn('Reasons:', result.reasons);
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
trustEvaluate(entityId: string, policy?: TrustPolicy | string, context?: TrustContext): Promise<TrustEvaluation>;
|
|
55
|
+
/**
|
|
56
|
+
* Pre-action trust gate — call before any high-stakes autonomous action.
|
|
57
|
+
*
|
|
58
|
+
* Combines trust evaluation with delegation verification in a single call.
|
|
59
|
+
* The gate returns allow/review/deny with appeal paths for non-allow decisions.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const gate = await ep.trustGate({
|
|
64
|
+
* entityId: 'payment-agent-v2',
|
|
65
|
+
* action: 'execute_payment',
|
|
66
|
+
* policy: 'strict',
|
|
67
|
+
* valueUsd: 500,
|
|
68
|
+
* });
|
|
69
|
+
* if (gate.decision !== 'allow') throw new Error(`Blocked: ${gate.reasons?.join(', ')}`);
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
trustGate(options: {
|
|
73
|
+
entityId: string;
|
|
74
|
+
action: string;
|
|
75
|
+
policy?: TrustPolicy | string;
|
|
76
|
+
valueUsd?: number;
|
|
77
|
+
delegationId?: string;
|
|
78
|
+
}): Promise<TrustGateResult>;
|
|
79
|
+
/**
|
|
80
|
+
* Get domain-specific trust scores for an entity.
|
|
81
|
+
*
|
|
82
|
+
* Optionally filter to a subset of domains. Useful when you need trust
|
|
83
|
+
* context scoped to a specific action category (e.g. "financial" before
|
|
84
|
+
* authorizing a payment).
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const scores = await ep.domainScore('agent-v2', ['financial', 'delegation']);
|
|
89
|
+
* console.log(scores.domains.financial?.confidence); // "confident"
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
domainScore(entityId: string, domains?: TrustDomain[]): Promise<DomainScoreResult>;
|
|
93
|
+
/**
|
|
94
|
+
* EP-SX: Software pre-action enforcement check (experimental).
|
|
95
|
+
*
|
|
96
|
+
* Evaluates a software entity (MCP server, npm package, browser extension,
|
|
97
|
+
* GitHub App, Shopify App, etc.) for installation safety. Returns allow/
|
|
98
|
+
* review/deny with publisher verification, permission class, and provenance.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* const preflight = await ep.installPreflight(
|
|
103
|
+
* 'mcp-server-acme-v1',
|
|
104
|
+
* 'mcp_server_safe_v1',
|
|
105
|
+
* { host: 'claude-desktop', permission_class: 'bounded_external_access' },
|
|
106
|
+
* );
|
|
107
|
+
* if (preflight.decision === 'deny') throw new Error('Installation blocked by EP');
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
installPreflight(entityId: string, policy?: TrustPolicy | string, context?: Record<string, string>): Promise<InstallPreflightResult>;
|
|
111
|
+
/**
|
|
112
|
+
* Register a new entity.
|
|
113
|
+
*
|
|
114
|
+
* Public endpoint — no API key required. Returns the entity record and the
|
|
115
|
+
* first API key. Store the API key securely; it will not be shown again.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const { entity, api_key } = await ep.registerEntity({
|
|
120
|
+
* entityId: 'acme-payment-agent',
|
|
121
|
+
* displayName: 'Acme Payment Agent',
|
|
122
|
+
* entityType: 'agent',
|
|
123
|
+
* description: 'Handles autonomous payment flows for Acme Corp.',
|
|
124
|
+
* capabilities: ['payment', 'refund'],
|
|
125
|
+
* });
|
|
126
|
+
* console.log('Save this key:', api_key); // ep_live_...
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
registerEntity(options: {
|
|
130
|
+
entityId: string;
|
|
131
|
+
displayName: string;
|
|
132
|
+
entityType: EntityType;
|
|
133
|
+
description: string;
|
|
134
|
+
capabilities?: string[];
|
|
135
|
+
}): Promise<{
|
|
136
|
+
entity: {
|
|
137
|
+
entity_id: string;
|
|
138
|
+
display_name: string;
|
|
139
|
+
};
|
|
140
|
+
api_key: string;
|
|
141
|
+
}>;
|
|
142
|
+
/**
|
|
143
|
+
* Search for entities by name, capability, or category.
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```typescript
|
|
147
|
+
* const { entities } = await ep.searchEntities('payment', 'agent');
|
|
148
|
+
* for (const e of entities) {
|
|
149
|
+
* console.log(e.display_name, e.confidence);
|
|
150
|
+
* }
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
searchEntities(query: string, entityType?: EntityType, minConfidence?: string): Promise<{
|
|
154
|
+
entities: EntitySearchResult[];
|
|
155
|
+
}>;
|
|
156
|
+
/**
|
|
157
|
+
* Get the entity leaderboard ranked by trust confidence.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```typescript
|
|
161
|
+
* const { leaderboard } = await ep.leaderboard(5, 'merchant');
|
|
162
|
+
* leaderboard.forEach(e => console.log(`#${e.rank} ${e.display_name}`));
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
leaderboard(limit?: number, entityType?: EntityType): Promise<{
|
|
166
|
+
leaderboard: LeaderboardEntry[];
|
|
167
|
+
}>;
|
|
168
|
+
/**
|
|
169
|
+
* Submit a transaction receipt to the EP ledger.
|
|
170
|
+
*
|
|
171
|
+
* Requires an API key. Receipts are append-only, cryptographically hashed,
|
|
172
|
+
* and chain-linked. `transaction_ref` must be unique per entity.
|
|
173
|
+
*
|
|
174
|
+
* The `agent_behavior` field is the strongest Phase 1 signal — always set it.
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```typescript
|
|
178
|
+
* const { receipt } = await ep.submitReceipt({
|
|
179
|
+
* entity_id: 'merchant-xyz',
|
|
180
|
+
* transaction_ref: 'order-8821',
|
|
181
|
+
* transaction_type: 'purchase',
|
|
182
|
+
* agent_behavior: 'completed',
|
|
183
|
+
* delivery_accuracy: 98,
|
|
184
|
+
* product_accuracy: 95,
|
|
185
|
+
* price_integrity: 100,
|
|
186
|
+
* });
|
|
187
|
+
* console.log('Receipt ID:', receipt.receipt_id);
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
submitReceipt(input: SubmitReceiptInput): Promise<SubmitReceiptResult>;
|
|
191
|
+
/**
|
|
192
|
+
* Submit multiple receipts atomically. Maximum 50 per call.
|
|
193
|
+
*
|
|
194
|
+
* Each result in the response array indicates success or failure for that
|
|
195
|
+
* receipt independently — partial success is possible.
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```typescript
|
|
199
|
+
* const result = await ep.batchSubmit([
|
|
200
|
+
* { entity_id: 'merchant-a', transaction_ref: 'tx-1', transaction_type: 'purchase', agent_behavior: 'completed' },
|
|
201
|
+
* { entity_id: 'merchant-b', transaction_ref: 'tx-2', transaction_type: 'service', agent_behavior: 'completed' },
|
|
202
|
+
* ]);
|
|
203
|
+
* result.results.forEach(r => console.log(r.entity_id, r.success ? 'ok' : r.error));
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
batchSubmit(receipts: SubmitReceiptInput[]): Promise<BatchReceiptResult>;
|
|
207
|
+
/**
|
|
208
|
+
* Confirm or reject a receipt as the counterparty (bilateral confirmation).
|
|
209
|
+
*
|
|
210
|
+
* The confirmation window is 48 hours from receipt creation. Confirmed
|
|
211
|
+
* receipts receive a higher provenance tier, improving their evidential weight.
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
215
|
+
* await ep.confirmReceipt('ep_rcpt_abc123', true);
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
confirmReceipt(receiptId: string, confirm: boolean): Promise<ConfirmReceiptResult>;
|
|
219
|
+
/**
|
|
220
|
+
* Verify a receipt against the on-chain Merkle root.
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```typescript
|
|
224
|
+
* const { verified, anchored } = await ep.verifyReceipt('ep_rcpt_abc123');
|
|
225
|
+
* if (!verified) console.error('Receipt integrity check failed');
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
verifyReceipt(receiptId: string): Promise<{
|
|
229
|
+
receipt_id: string;
|
|
230
|
+
receipt_hash: string;
|
|
231
|
+
anchored: boolean;
|
|
232
|
+
verified: boolean;
|
|
233
|
+
}>;
|
|
234
|
+
/**
|
|
235
|
+
* File a dispute against a receipt.
|
|
236
|
+
*
|
|
237
|
+
* Requires an API key. Any affected party can challenge. The receipt
|
|
238
|
+
* submitter has 7 days to respond before EP escalates.
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```typescript
|
|
242
|
+
* const dispute = await ep.fileDispute({
|
|
243
|
+
* receiptId: 'ep_rcpt_abc123',
|
|
244
|
+
* reason: 'inaccurate_signals',
|
|
245
|
+
* description: 'Delivery accuracy was reported as 98 but the item arrived damaged.',
|
|
246
|
+
* evidence: { photo_url: 'https://...' },
|
|
247
|
+
* });
|
|
248
|
+
* console.log('Dispute ID:', dispute.dispute_id);
|
|
249
|
+
* console.log('Respond by:', dispute.response_deadline);
|
|
250
|
+
* ```
|
|
251
|
+
*/
|
|
252
|
+
fileDispute(options: {
|
|
253
|
+
receiptId: string;
|
|
254
|
+
reason: DisputeReason;
|
|
255
|
+
description?: string;
|
|
256
|
+
evidence?: Record<string, unknown>;
|
|
257
|
+
}): Promise<Dispute & {
|
|
258
|
+
response_deadline: string;
|
|
259
|
+
_message: string;
|
|
260
|
+
}>;
|
|
261
|
+
/**
|
|
262
|
+
* Get the current status of a dispute.
|
|
263
|
+
*
|
|
264
|
+
* Dispute status is public — transparency is a protocol value.
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```typescript
|
|
268
|
+
* const dispute = await ep.disputeStatus('ep_disp_xyz789');
|
|
269
|
+
* console.log(dispute.status, dispute.resolution);
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
disputeStatus(disputeId: string): Promise<Dispute>;
|
|
273
|
+
/**
|
|
274
|
+
* Respond to a dispute filed against one of your receipts.
|
|
275
|
+
*
|
|
276
|
+
* Requires an API key. Must be called within the response_deadline window.
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* ```typescript
|
|
280
|
+
* await ep.respondToDispute({
|
|
281
|
+
* disputeId: 'ep_disp_xyz789',
|
|
282
|
+
* response: 'The delivery accuracy score reflects the state at handoff, confirmed by carrier log.',
|
|
283
|
+
* evidence: { carrier_log_url: 'https://...' },
|
|
284
|
+
* });
|
|
285
|
+
* ```
|
|
286
|
+
*/
|
|
287
|
+
respondToDispute(options: {
|
|
288
|
+
disputeId: string;
|
|
289
|
+
response: string;
|
|
290
|
+
evidence?: Record<string, unknown>;
|
|
291
|
+
}): Promise<{
|
|
292
|
+
dispute_id: string;
|
|
293
|
+
status: string;
|
|
294
|
+
}>;
|
|
295
|
+
/**
|
|
296
|
+
* Withdraw an open dispute before it reaches resolution.
|
|
297
|
+
*
|
|
298
|
+
* Requires an API key. Only the filer can withdraw.
|
|
299
|
+
*
|
|
300
|
+
* @example
|
|
301
|
+
* ```typescript
|
|
302
|
+
* await ep.withdrawDispute('ep_disp_xyz789');
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
withdrawDispute(disputeId: string): Promise<{
|
|
306
|
+
dispute_id: string;
|
|
307
|
+
status: string;
|
|
308
|
+
}>;
|
|
309
|
+
/**
|
|
310
|
+
* Appeal a dispute resolution.
|
|
311
|
+
*
|
|
312
|
+
* Requires an API key. Only dispute participants may appeal. The dispute must
|
|
313
|
+
* be in upheld, reversed, or dismissed state. The appeal decision is final.
|
|
314
|
+
*
|
|
315
|
+
* "Trust must never be more powerful than appeal." — EP Constitutional Principle
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```typescript
|
|
319
|
+
* await ep.appealDispute({
|
|
320
|
+
* disputeId: 'ep_disp_xyz789',
|
|
321
|
+
* reason: 'New evidence shows the carrier log was misread. Attaching corrected scan.',
|
|
322
|
+
* evidence: { corrected_scan: 'https://...' },
|
|
323
|
+
* });
|
|
324
|
+
* ```
|
|
325
|
+
*/
|
|
326
|
+
appealDispute(options: {
|
|
327
|
+
disputeId: string;
|
|
328
|
+
reason: string;
|
|
329
|
+
evidence?: Record<string, unknown>;
|
|
330
|
+
}): Promise<{
|
|
331
|
+
appeal_id?: string;
|
|
332
|
+
dispute_id: string;
|
|
333
|
+
status: string;
|
|
334
|
+
_message?: string;
|
|
335
|
+
}>;
|
|
336
|
+
/**
|
|
337
|
+
* Report a trust issue as a human.
|
|
338
|
+
*
|
|
339
|
+
* No authentication required. The human appeal channel — use when someone
|
|
340
|
+
* is wrongly downgraded, harmed by a trusted entity, or has observed fraud.
|
|
341
|
+
*
|
|
342
|
+
* @example
|
|
343
|
+
* ```typescript
|
|
344
|
+
* await ep.reportTrustIssue({
|
|
345
|
+
* entityId: 'merchant-xyz',
|
|
346
|
+
* reportType: 'harmed_by_trusted_entity',
|
|
347
|
+
* description: 'I paid for an item marked as delivered but never received it.',
|
|
348
|
+
* contactEmail: 'jane@example.com',
|
|
349
|
+
* });
|
|
350
|
+
* ```
|
|
351
|
+
*/
|
|
352
|
+
reportTrustIssue(options: {
|
|
353
|
+
entityId: string;
|
|
354
|
+
reportType: ReportType;
|
|
355
|
+
description: string;
|
|
356
|
+
contactEmail?: string;
|
|
357
|
+
}): Promise<{
|
|
358
|
+
report_id: string;
|
|
359
|
+
_message: string;
|
|
360
|
+
_principle: string;
|
|
361
|
+
}>;
|
|
362
|
+
/**
|
|
363
|
+
* Create a delegation: authorize an agent to act on behalf of a principal.
|
|
364
|
+
*
|
|
365
|
+
* Requires an API key. The delegation record can be verified by any party
|
|
366
|
+
* using `verifyDelegation`.
|
|
367
|
+
*
|
|
368
|
+
* @example
|
|
369
|
+
* ```typescript
|
|
370
|
+
* const delegation = await ep.createDelegation({
|
|
371
|
+
* principalId: 'ep_principal_acme',
|
|
372
|
+
* agentEntityId: 'acme-payment-agent',
|
|
373
|
+
* scope: ['purchase', 'refund'],
|
|
374
|
+
* maxValueUsd: 1000,
|
|
375
|
+
* expiresAt: '2026-12-31T23:59:59Z',
|
|
376
|
+
* });
|
|
377
|
+
* console.log('Delegation ID:', delegation.delegation_id);
|
|
378
|
+
* ```
|
|
379
|
+
*/
|
|
380
|
+
createDelegation(options: {
|
|
381
|
+
principalId: string;
|
|
382
|
+
agentEntityId: string;
|
|
383
|
+
scope: string[];
|
|
384
|
+
maxValueUsd?: number;
|
|
385
|
+
expiresAt?: string;
|
|
386
|
+
constraints?: Record<string, unknown>;
|
|
387
|
+
}): Promise<DelegationRecord>;
|
|
388
|
+
/**
|
|
389
|
+
* Verify that a delegation is valid and covers a given action type.
|
|
390
|
+
*
|
|
391
|
+
* @example
|
|
392
|
+
* ```typescript
|
|
393
|
+
* const result = await ep.verifyDelegation('ep_del_abc123', 'purchase');
|
|
394
|
+
* if (!result.valid) throw new Error('Delegation invalid or expired');
|
|
395
|
+
* ```
|
|
396
|
+
*/
|
|
397
|
+
verifyDelegation(delegationId: string, actionType?: string): Promise<DelegationRecord & {
|
|
398
|
+
valid: boolean;
|
|
399
|
+
action_permitted?: boolean;
|
|
400
|
+
reason?: string;
|
|
401
|
+
}>;
|
|
402
|
+
/**
|
|
403
|
+
* Look up a principal — the enduring actor behind one or more entities.
|
|
404
|
+
*
|
|
405
|
+
* Returns the principal record, its controlled entities, identity bindings,
|
|
406
|
+
* and continuity claim history.
|
|
407
|
+
*
|
|
408
|
+
* @example
|
|
409
|
+
* ```typescript
|
|
410
|
+
* const result = await ep.principalLookup('ep_principal_acme');
|
|
411
|
+
* console.log('Entities:', result.entities?.map(e => e.entity_id));
|
|
412
|
+
* ```
|
|
413
|
+
*/
|
|
414
|
+
principalLookup(principalId: string): Promise<PrincipalLookupResult>;
|
|
415
|
+
/**
|
|
416
|
+
* View entity lineage — predecessors, successors, and continuity decisions.
|
|
417
|
+
*
|
|
418
|
+
* Use to check whether an entity has suspicious continuity gaps that might
|
|
419
|
+
* indicate reputation laundering (whitewashing).
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* ```typescript
|
|
423
|
+
* const lineage = await ep.lineage('merchant-xyz');
|
|
424
|
+
* if (lineage.predecessors?.some(p => p.status === 'disputed')) {
|
|
425
|
+
* console.warn('Entity has disputed predecessor — review before transacting');
|
|
426
|
+
* }
|
|
427
|
+
* ```
|
|
428
|
+
*/
|
|
429
|
+
lineage(entityId: string): Promise<LineageResult>;
|
|
430
|
+
/**
|
|
431
|
+
* List all available trust policies with their requirements and families.
|
|
432
|
+
*
|
|
433
|
+
* Returns 8 policies: 4 core (strict, standard, permissive, discovery) and
|
|
434
|
+
* 4 software-specific (github_private_repo_safe_v1, npm_buildtime_safe_v1,
|
|
435
|
+
* browser_extension_safe_v1, mcp_server_safe_v1).
|
|
436
|
+
*
|
|
437
|
+
* @example
|
|
438
|
+
* ```typescript
|
|
439
|
+
* const { policies } = await ep.listPolicies();
|
|
440
|
+
* policies.forEach(p => console.log(p.name, '-', p.description));
|
|
441
|
+
* ```
|
|
442
|
+
*/
|
|
443
|
+
listPolicies(): Promise<{
|
|
444
|
+
policies: TrustPolicyDefinition[];
|
|
445
|
+
}>;
|
|
446
|
+
/**
|
|
447
|
+
* Public proof metrics — entity count, test count, tool count, policy count.
|
|
448
|
+
*
|
|
449
|
+
* @example
|
|
450
|
+
* ```typescript
|
|
451
|
+
* const stats = await ep.stats();
|
|
452
|
+
* console.log(`${stats.total_entities} entities across ${stats.trust_policies} policies`);
|
|
453
|
+
* ```
|
|
454
|
+
*/
|
|
455
|
+
stats(): Promise<EPStats>;
|
|
456
|
+
/**
|
|
457
|
+
* Health check. Returns subsystem status.
|
|
458
|
+
*
|
|
459
|
+
* @example
|
|
460
|
+
* ```typescript
|
|
461
|
+
* const health = await ep.health();
|
|
462
|
+
* console.log(health.status); // "ok"
|
|
463
|
+
* ```
|
|
464
|
+
*/
|
|
465
|
+
health(): Promise<{
|
|
466
|
+
status: string;
|
|
467
|
+
[key: string]: unknown;
|
|
468
|
+
}>;
|
|
469
|
+
/**
|
|
470
|
+
* Issue a signed EP Commit before a high-stakes action.
|
|
471
|
+
*
|
|
472
|
+
* The commit binds the agent to a specific action type, entity, and policy
|
|
473
|
+
* before execution. Returns decision (allow/deny/review), commit_id, expiry,
|
|
474
|
+
* scope, and appeal path.
|
|
475
|
+
*
|
|
476
|
+
* @example
|
|
477
|
+
* ```typescript
|
|
478
|
+
* const { decision, commit } = await ep.issueCommit({
|
|
479
|
+
* action_type: 'transact',
|
|
480
|
+
* entity_id: 'payment-agent-v2',
|
|
481
|
+
* max_value_usd: 500,
|
|
482
|
+
* policy: 'strict',
|
|
483
|
+
* });
|
|
484
|
+
* if (decision !== 'allow') throw new Error('Commit denied');
|
|
485
|
+
* console.log(commit.commit_id);
|
|
486
|
+
* ```
|
|
487
|
+
*/
|
|
488
|
+
issueCommit(params: EPCommitRequest): Promise<EPCommitIssueResult>;
|
|
489
|
+
/**
|
|
490
|
+
* Verify a commit's signature, status, and validity.
|
|
491
|
+
*
|
|
492
|
+
* @example
|
|
493
|
+
* ```typescript
|
|
494
|
+
* const result = await ep.verifyCommit('epc_abc123');
|
|
495
|
+
* if (!result.valid) console.error('Commit invalid');
|
|
496
|
+
* ```
|
|
497
|
+
*/
|
|
498
|
+
verifyCommit(commitId: string): Promise<EPCommitVerification>;
|
|
499
|
+
/**
|
|
500
|
+
* Get the current state of a commit.
|
|
501
|
+
*
|
|
502
|
+
* @example
|
|
503
|
+
* ```typescript
|
|
504
|
+
* const { commit } = await ep.getCommitStatus('epc_abc123');
|
|
505
|
+
* console.log(commit.status); // "active" | "revoked" | "expired" | "fulfilled"
|
|
506
|
+
* ```
|
|
507
|
+
*/
|
|
508
|
+
getCommitStatus(commitId: string): Promise<EPCommitStatusResult>;
|
|
509
|
+
/**
|
|
510
|
+
* Revoke an active commit before it is fulfilled or expires.
|
|
511
|
+
*
|
|
512
|
+
* @example
|
|
513
|
+
* ```typescript
|
|
514
|
+
* await ep.revokeCommit('epc_abc123', 'Action no longer needed');
|
|
515
|
+
* ```
|
|
516
|
+
*/
|
|
517
|
+
revokeCommit(commitId: string, reason: string): Promise<EPCommitRevokeResult>;
|
|
518
|
+
/**
|
|
519
|
+
* Bind a post-action receipt to a commit, completing the commit-execute-receipt cycle.
|
|
520
|
+
*
|
|
521
|
+
* @example
|
|
522
|
+
* ```typescript
|
|
523
|
+
* await ep.bindReceiptToCommit('epc_abc123', 'ep_rcpt_xyz789');
|
|
524
|
+
* ```
|
|
525
|
+
*/
|
|
526
|
+
bindReceiptToCommit(commitId: string, receiptId: string): Promise<EPCommitReceiptResult>;
|
|
527
|
+
/**
|
|
528
|
+
* Legacy: get the 0-100 compatibility score for an entity.
|
|
529
|
+
*
|
|
530
|
+
* Prefer `trustProfile()` for all new integrations. This endpoint exists
|
|
531
|
+
* for backward compatibility only.
|
|
532
|
+
*
|
|
533
|
+
* @deprecated Use trustProfile() instead.
|
|
534
|
+
*/
|
|
535
|
+
legacyScore(entityId: string): Promise<{
|
|
536
|
+
entity_id: string;
|
|
537
|
+
score: number;
|
|
538
|
+
}>;
|
|
539
|
+
}
|
|
540
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,YAAY,EAGZ,aAAa,EACb,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,OAAO,EACP,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,OAAO,EACP,eAAe,EAEf,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAyBpB;;;;;;;;;;;;;;GAcG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAe;gBAE7B,OAAO,GAAE,eAAoB;YAoB3B,OAAO;IAmErB;;;;;;;;;;;;OAYG;IACG,YAAY,CAAC,QAAQ,EAAE,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