@adastracomputing/ink 0.1.0-alpha.2 → 0.1.0-alpha.5

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.
Files changed (69) hide show
  1. package/CHANGELOG.md +56 -5
  2. package/CODE_OF_CONDUCT.md +1 -1
  3. package/README.md +7 -5
  4. package/SECURITY.md +1 -1
  5. package/bin/verify-inclusion-impl.mjs +4 -1
  6. package/dist/audit/inclusion-receipt.d.ts +142 -0
  7. package/dist/audit/inclusion-receipt.js +496 -0
  8. package/dist/crypto/ink.d.ts +178 -0
  9. package/dist/crypto/ink.js +915 -0
  10. package/dist/crypto/keys.d.ts +42 -0
  11. package/dist/crypto/keys.js +179 -0
  12. package/dist/crypto/multi-key-verify.d.ts +29 -0
  13. package/dist/crypto/multi-key-verify.js +153 -0
  14. package/dist/crypto/sign.d.ts +17 -0
  15. package/dist/crypto/sign.js +152 -0
  16. package/dist/crypto/verify.js +1 -0
  17. package/dist/discovery/agent-card.d.ts +83 -0
  18. package/dist/discovery/agent-card.js +545 -0
  19. package/dist/index.d.ts +12 -0
  20. package/dist/index.js +15 -0
  21. package/dist/ink/checkpoint.d.ts +19 -0
  22. package/dist/ink/checkpoint.js +69 -0
  23. package/dist/ink/discovery-gating.d.ts +237 -0
  24. package/dist/ink/discovery-gating.js +91 -0
  25. package/dist/ink/handshake-budget.d.ts +90 -0
  26. package/dist/ink/handshake-budget.js +397 -0
  27. package/dist/ink/receipts.d.ts +31 -0
  28. package/dist/ink/receipts.js +89 -0
  29. package/dist/ink/transport-auth.d.ts +47 -0
  30. package/dist/ink/transport-auth.js +77 -0
  31. package/dist/middleware/ink-auth.d.ts +68 -0
  32. package/dist/middleware/ink-auth.js +214 -0
  33. package/dist/models/agent-card.d.ts +154 -0
  34. package/dist/models/agent-card.js +59 -0
  35. package/dist/models/ink-audit.d.ts +344 -0
  36. package/dist/models/ink-audit.js +167 -0
  37. package/dist/models/ink-handshake.d.ts +129 -0
  38. package/dist/models/ink-handshake.js +89 -0
  39. package/dist/models/intent.d.ts +437 -0
  40. package/dist/models/intent.js +172 -0
  41. package/dist/models/key-entry.d.ts +60 -0
  42. package/dist/models/key-entry.js +13 -0
  43. package/dist/models/profile.d.ts +61 -0
  44. package/dist/models/profile.js +24 -0
  45. package/docs/maturity.md +3 -3
  46. package/docs/threat-model.md +1 -1
  47. package/package.json +17 -13
  48. package/specs/ink-auditability.md +37 -12
  49. package/specs/ink-compliance-checklist.md +9 -1
  50. package/src/audit/inclusion-receipt.ts +0 -268
  51. package/src/crypto/ink.ts +0 -902
  52. package/src/crypto/keys.ts +0 -210
  53. package/src/crypto/multi-key-verify.ts +0 -170
  54. package/src/crypto/sign.ts +0 -155
  55. package/src/discovery/agent-card.ts +0 -508
  56. package/src/index.ts +0 -67
  57. package/src/ink/checkpoint.ts +0 -75
  58. package/src/ink/discovery-gating.ts +0 -147
  59. package/src/ink/handshake-budget.ts +0 -413
  60. package/src/ink/receipts.ts +0 -114
  61. package/src/ink/transport-auth.ts +0 -96
  62. package/src/middleware/ink-auth.ts +0 -263
  63. package/src/models/agent-card.ts +0 -63
  64. package/src/models/ink-audit.ts +0 -205
  65. package/src/models/ink-handshake.ts +0 -123
  66. package/src/models/intent.ts +0 -201
  67. package/src/models/key-entry.ts +0 -52
  68. package/src/models/profile.ts +0 -31
  69. /package/{src/crypto/verify.ts → dist/crypto/verify.d.ts} +0 -0
@@ -0,0 +1,344 @@
1
+ import { z } from "zod";
2
+ export declare const InkAuditEventTypeSchema: z.ZodEnum<{
3
+ "message.sent": "message.sent";
4
+ "message.received": "message.received";
5
+ "message.queued": "message.queued";
6
+ "message.delivered": "message.delivered";
7
+ "message.acted": "message.acted";
8
+ "message.rejected": "message.rejected";
9
+ "message.expired": "message.expired";
10
+ "message.retracted": "message.retracted";
11
+ "receipt.sent": "receipt.sent";
12
+ "receipt.received": "receipt.received";
13
+ "delegation.granted": "delegation.granted";
14
+ "delegation.used": "delegation.used";
15
+ "delegation.revoked": "delegation.revoked";
16
+ "delegation.expired": "delegation.expired";
17
+ "connection.requested": "connection.requested";
18
+ "connection.accepted": "connection.accepted";
19
+ "connection.declined": "connection.declined";
20
+ "signature.verified": "signature.verified";
21
+ "signature.verified_retired": "signature.verified_retired";
22
+ "signature.failed": "signature.failed";
23
+ "signature.revoked_rejected": "signature.revoked_rejected";
24
+ "replay.detected": "replay.detected";
25
+ "key.rotated": "key.rotated";
26
+ "key.revoked": "key.revoked";
27
+ "introduction.requested": "introduction.requested";
28
+ "introduction.approved": "introduction.approved";
29
+ "introduction.declined": "introduction.declined";
30
+ "introduction.forwarded": "introduction.forwarded";
31
+ "introduction.completed": "introduction.completed";
32
+ "introduction.expired": "introduction.expired";
33
+ "introduction.receipt_sent": "introduction.receipt_sent";
34
+ "introduction.receipt_received": "introduction.receipt_received";
35
+ "enclave.requested": "enclave.requested";
36
+ "enclave.authorized": "enclave.authorized";
37
+ "enclave.opened": "enclave.opened";
38
+ "enclave.operation_submitted": "enclave.operation_submitted";
39
+ "enclave.resolved": "enclave.resolved";
40
+ "enclave.expired": "enclave.expired";
41
+ "enclave.aborted": "enclave.aborted";
42
+ "enclave.receipt_sent": "enclave.receipt_sent";
43
+ "enclave.receipt_received": "enclave.receipt_received";
44
+ transport_scope_violation: "transport_scope_violation";
45
+ handshake_rate_limited: "handshake_rate_limited";
46
+ handshake_budget_exhausted: "handshake_budget_exhausted";
47
+ discovery_query_received: "discovery_query_received";
48
+ discovery_query_granted: "discovery_query_granted";
49
+ discovery_query_denied: "discovery_query_denied";
50
+ }>;
51
+ export type InkAuditEventType = z.infer<typeof InkAuditEventTypeSchema>;
52
+ export declare const InkAuditEventSchema: z.ZodObject<{
53
+ id: z.ZodString;
54
+ version: z.ZodLiteral<"ink-audit/1">;
55
+ agentId: z.ZodString;
56
+ agentSignature: z.ZodString;
57
+ sequence: z.ZodNumber;
58
+ previousEventHash: z.ZodNullable<z.ZodString>;
59
+ eventType: z.ZodEnum<{
60
+ "message.sent": "message.sent";
61
+ "message.received": "message.received";
62
+ "message.queued": "message.queued";
63
+ "message.delivered": "message.delivered";
64
+ "message.acted": "message.acted";
65
+ "message.rejected": "message.rejected";
66
+ "message.expired": "message.expired";
67
+ "message.retracted": "message.retracted";
68
+ "receipt.sent": "receipt.sent";
69
+ "receipt.received": "receipt.received";
70
+ "delegation.granted": "delegation.granted";
71
+ "delegation.used": "delegation.used";
72
+ "delegation.revoked": "delegation.revoked";
73
+ "delegation.expired": "delegation.expired";
74
+ "connection.requested": "connection.requested";
75
+ "connection.accepted": "connection.accepted";
76
+ "connection.declined": "connection.declined";
77
+ "signature.verified": "signature.verified";
78
+ "signature.verified_retired": "signature.verified_retired";
79
+ "signature.failed": "signature.failed";
80
+ "signature.revoked_rejected": "signature.revoked_rejected";
81
+ "replay.detected": "replay.detected";
82
+ "key.rotated": "key.rotated";
83
+ "key.revoked": "key.revoked";
84
+ "introduction.requested": "introduction.requested";
85
+ "introduction.approved": "introduction.approved";
86
+ "introduction.declined": "introduction.declined";
87
+ "introduction.forwarded": "introduction.forwarded";
88
+ "introduction.completed": "introduction.completed";
89
+ "introduction.expired": "introduction.expired";
90
+ "introduction.receipt_sent": "introduction.receipt_sent";
91
+ "introduction.receipt_received": "introduction.receipt_received";
92
+ "enclave.requested": "enclave.requested";
93
+ "enclave.authorized": "enclave.authorized";
94
+ "enclave.opened": "enclave.opened";
95
+ "enclave.operation_submitted": "enclave.operation_submitted";
96
+ "enclave.resolved": "enclave.resolved";
97
+ "enclave.expired": "enclave.expired";
98
+ "enclave.aborted": "enclave.aborted";
99
+ "enclave.receipt_sent": "enclave.receipt_sent";
100
+ "enclave.receipt_received": "enclave.receipt_received";
101
+ transport_scope_violation: "transport_scope_violation";
102
+ handshake_rate_limited: "handshake_rate_limited";
103
+ handshake_budget_exhausted: "handshake_budget_exhausted";
104
+ discovery_query_received: "discovery_query_received";
105
+ discovery_query_granted: "discovery_query_granted";
106
+ discovery_query_denied: "discovery_query_denied";
107
+ }>;
108
+ timestamp: z.ZodString;
109
+ messageId: z.ZodOptional<z.ZodString>;
110
+ correlationId: z.ZodOptional<z.ZodString>;
111
+ counterpartyId: z.ZodOptional<z.ZodString>;
112
+ signingKeyId: z.ZodOptional<z.ZodString>;
113
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
114
+ }, z.core.$strip>;
115
+ export type InkAuditEvent = z.infer<typeof InkAuditEventSchema>;
116
+ export declare const InkReceiptDispositionSchema: z.ZodEnum<{
117
+ received: "received";
118
+ delivered: "delivered";
119
+ acted: "acted";
120
+ rejected: "rejected";
121
+ expired: "expired";
122
+ }>;
123
+ export type InkReceiptDisposition = z.infer<typeof InkReceiptDispositionSchema>;
124
+ export declare const InkReceiptSchema: z.ZodObject<{
125
+ protocol: z.ZodLiteral<"ink/0.1">;
126
+ type: z.ZodLiteral<"network.tulpa.receipt">;
127
+ from: z.ZodString;
128
+ to: z.ZodString;
129
+ messageId: z.ZodString;
130
+ disposition: z.ZodEnum<{
131
+ received: "received";
132
+ delivered: "delivered";
133
+ acted: "acted";
134
+ rejected: "rejected";
135
+ expired: "expired";
136
+ }>;
137
+ dispositionAt: z.ZodString;
138
+ note: z.ZodOptional<z.ZodString>;
139
+ messageHash: z.ZodString;
140
+ nonce: z.ZodString;
141
+ timestamp: z.ZodString;
142
+ signature: z.ZodString;
143
+ }, z.core.$strip>;
144
+ export type InkReceipt = z.infer<typeof InkReceiptSchema>;
145
+ export declare const InkAuditQuerySchema: z.ZodObject<{
146
+ protocol: z.ZodLiteral<"ink/0.1">;
147
+ type: z.ZodLiteral<"network.tulpa.audit_query">;
148
+ from: z.ZodString;
149
+ to: z.ZodString;
150
+ messageId: z.ZodString;
151
+ nonce: z.ZodString;
152
+ timestamp: z.ZodString;
153
+ }, z.core.$strip>;
154
+ export type InkAuditQuery = z.infer<typeof InkAuditQuerySchema>;
155
+ export declare const InkAuditResponseSchema: z.ZodObject<{
156
+ protocol: z.ZodLiteral<"ink/0.1">;
157
+ type: z.ZodLiteral<"network.tulpa.audit_response">;
158
+ messageId: z.ZodString;
159
+ events: z.ZodArray<z.ZodObject<{
160
+ id: z.ZodString;
161
+ version: z.ZodLiteral<"ink-audit/1">;
162
+ agentId: z.ZodString;
163
+ agentSignature: z.ZodString;
164
+ sequence: z.ZodNumber;
165
+ previousEventHash: z.ZodNullable<z.ZodString>;
166
+ eventType: z.ZodEnum<{
167
+ "message.sent": "message.sent";
168
+ "message.received": "message.received";
169
+ "message.queued": "message.queued";
170
+ "message.delivered": "message.delivered";
171
+ "message.acted": "message.acted";
172
+ "message.rejected": "message.rejected";
173
+ "message.expired": "message.expired";
174
+ "message.retracted": "message.retracted";
175
+ "receipt.sent": "receipt.sent";
176
+ "receipt.received": "receipt.received";
177
+ "delegation.granted": "delegation.granted";
178
+ "delegation.used": "delegation.used";
179
+ "delegation.revoked": "delegation.revoked";
180
+ "delegation.expired": "delegation.expired";
181
+ "connection.requested": "connection.requested";
182
+ "connection.accepted": "connection.accepted";
183
+ "connection.declined": "connection.declined";
184
+ "signature.verified": "signature.verified";
185
+ "signature.verified_retired": "signature.verified_retired";
186
+ "signature.failed": "signature.failed";
187
+ "signature.revoked_rejected": "signature.revoked_rejected";
188
+ "replay.detected": "replay.detected";
189
+ "key.rotated": "key.rotated";
190
+ "key.revoked": "key.revoked";
191
+ "introduction.requested": "introduction.requested";
192
+ "introduction.approved": "introduction.approved";
193
+ "introduction.declined": "introduction.declined";
194
+ "introduction.forwarded": "introduction.forwarded";
195
+ "introduction.completed": "introduction.completed";
196
+ "introduction.expired": "introduction.expired";
197
+ "introduction.receipt_sent": "introduction.receipt_sent";
198
+ "introduction.receipt_received": "introduction.receipt_received";
199
+ "enclave.requested": "enclave.requested";
200
+ "enclave.authorized": "enclave.authorized";
201
+ "enclave.opened": "enclave.opened";
202
+ "enclave.operation_submitted": "enclave.operation_submitted";
203
+ "enclave.resolved": "enclave.resolved";
204
+ "enclave.expired": "enclave.expired";
205
+ "enclave.aborted": "enclave.aborted";
206
+ "enclave.receipt_sent": "enclave.receipt_sent";
207
+ "enclave.receipt_received": "enclave.receipt_received";
208
+ transport_scope_violation: "transport_scope_violation";
209
+ handshake_rate_limited: "handshake_rate_limited";
210
+ handshake_budget_exhausted: "handshake_budget_exhausted";
211
+ discovery_query_received: "discovery_query_received";
212
+ discovery_query_granted: "discovery_query_granted";
213
+ discovery_query_denied: "discovery_query_denied";
214
+ }>;
215
+ timestamp: z.ZodString;
216
+ messageId: z.ZodOptional<z.ZodString>;
217
+ correlationId: z.ZodOptional<z.ZodString>;
218
+ counterpartyId: z.ZodOptional<z.ZodString>;
219
+ signingKeyId: z.ZodOptional<z.ZodString>;
220
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
221
+ }, z.core.$strip>>;
222
+ responseSignature: z.ZodString;
223
+ }, z.core.$strip>;
224
+ export type InkAuditResponse = z.infer<typeof InkAuditResponseSchema>;
225
+ export declare const InkAuditSubmitSchema: z.ZodObject<{
226
+ protocol: z.ZodLiteral<"ink/0.1">;
227
+ type: z.ZodLiteral<"network.tulpa.audit_submit">;
228
+ from: z.ZodString;
229
+ to: z.ZodString;
230
+ event: z.ZodObject<{
231
+ id: z.ZodString;
232
+ version: z.ZodLiteral<"ink-audit/1">;
233
+ agentId: z.ZodString;
234
+ agentSignature: z.ZodString;
235
+ sequence: z.ZodNumber;
236
+ previousEventHash: z.ZodNullable<z.ZodString>;
237
+ eventType: z.ZodEnum<{
238
+ "message.sent": "message.sent";
239
+ "message.received": "message.received";
240
+ "message.queued": "message.queued";
241
+ "message.delivered": "message.delivered";
242
+ "message.acted": "message.acted";
243
+ "message.rejected": "message.rejected";
244
+ "message.expired": "message.expired";
245
+ "message.retracted": "message.retracted";
246
+ "receipt.sent": "receipt.sent";
247
+ "receipt.received": "receipt.received";
248
+ "delegation.granted": "delegation.granted";
249
+ "delegation.used": "delegation.used";
250
+ "delegation.revoked": "delegation.revoked";
251
+ "delegation.expired": "delegation.expired";
252
+ "connection.requested": "connection.requested";
253
+ "connection.accepted": "connection.accepted";
254
+ "connection.declined": "connection.declined";
255
+ "signature.verified": "signature.verified";
256
+ "signature.verified_retired": "signature.verified_retired";
257
+ "signature.failed": "signature.failed";
258
+ "signature.revoked_rejected": "signature.revoked_rejected";
259
+ "replay.detected": "replay.detected";
260
+ "key.rotated": "key.rotated";
261
+ "key.revoked": "key.revoked";
262
+ "introduction.requested": "introduction.requested";
263
+ "introduction.approved": "introduction.approved";
264
+ "introduction.declined": "introduction.declined";
265
+ "introduction.forwarded": "introduction.forwarded";
266
+ "introduction.completed": "introduction.completed";
267
+ "introduction.expired": "introduction.expired";
268
+ "introduction.receipt_sent": "introduction.receipt_sent";
269
+ "introduction.receipt_received": "introduction.receipt_received";
270
+ "enclave.requested": "enclave.requested";
271
+ "enclave.authorized": "enclave.authorized";
272
+ "enclave.opened": "enclave.opened";
273
+ "enclave.operation_submitted": "enclave.operation_submitted";
274
+ "enclave.resolved": "enclave.resolved";
275
+ "enclave.expired": "enclave.expired";
276
+ "enclave.aborted": "enclave.aborted";
277
+ "enclave.receipt_sent": "enclave.receipt_sent";
278
+ "enclave.receipt_received": "enclave.receipt_received";
279
+ transport_scope_violation: "transport_scope_violation";
280
+ handshake_rate_limited: "handshake_rate_limited";
281
+ handshake_budget_exhausted: "handshake_budget_exhausted";
282
+ discovery_query_received: "discovery_query_received";
283
+ discovery_query_granted: "discovery_query_granted";
284
+ discovery_query_denied: "discovery_query_denied";
285
+ }>;
286
+ timestamp: z.ZodString;
287
+ messageId: z.ZodOptional<z.ZodString>;
288
+ correlationId: z.ZodOptional<z.ZodString>;
289
+ counterpartyId: z.ZodOptional<z.ZodString>;
290
+ signingKeyId: z.ZodOptional<z.ZodString>;
291
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
292
+ }, z.core.$strip>;
293
+ nonce: z.ZodString;
294
+ timestamp: z.ZodString;
295
+ }, z.core.$strip>;
296
+ export type InkAuditSubmit = z.infer<typeof InkAuditSubmitSchema>;
297
+ export declare const InkAuditInclusionSchema: z.ZodObject<{
298
+ protocol: z.ZodLiteral<"ink/0.1">;
299
+ type: z.ZodLiteral<"network.tulpa.audit_inclusion">;
300
+ eventId: z.ZodString;
301
+ treeSize: z.ZodNumber;
302
+ leafIndex: z.ZodNumber;
303
+ rootHash: z.ZodString;
304
+ timestamp: z.ZodString;
305
+ serviceSignature: z.ZodString;
306
+ }, z.core.$strip>;
307
+ export type InkAuditInclusion = z.infer<typeof InkAuditInclusionSchema>;
308
+ export declare const InkIntroductionReceiptStatusSchema: z.ZodEnum<{
309
+ declined: "declined";
310
+ forwarded: "forwarded";
311
+ expired: "expired";
312
+ approved: "approved";
313
+ completed: "completed";
314
+ }>;
315
+ export type InkIntroductionReceiptStatus = z.infer<typeof InkIntroductionReceiptStatusSchema>;
316
+ export declare const InkIntroductionReceiptSchema: z.ZodObject<{
317
+ protocol: z.ZodLiteral<"ink/0.1">;
318
+ type: z.ZodLiteral<"network.tulpa.introduction_receipt">;
319
+ id: z.ZodString;
320
+ correlationId: z.ZodString;
321
+ from: z.ZodString;
322
+ to: z.ZodString;
323
+ requesterDid: z.ZodString;
324
+ introducerDid: z.ZodString;
325
+ beneficiaryDid: z.ZodString;
326
+ targetDid: z.ZodString;
327
+ status: z.ZodEnum<{
328
+ declined: "declined";
329
+ forwarded: "forwarded";
330
+ expired: "expired";
331
+ approved: "approved";
332
+ completed: "completed";
333
+ }>;
334
+ purpose: z.ZodString;
335
+ nonce: z.ZodString;
336
+ timestamp: z.ZodString;
337
+ relatedIntentId: z.ZodOptional<z.ZodString>;
338
+ relatedResolutionId: z.ZodOptional<z.ZodString>;
339
+ note: z.ZodOptional<z.ZodString>;
340
+ contextHash: z.ZodOptional<z.ZodString>;
341
+ authorizationChainRef: z.ZodOptional<z.ZodString>;
342
+ expiresAt: z.ZodOptional<z.ZodString>;
343
+ }, z.core.$strip>;
344
+ export type InkIntroductionReceipt = z.infer<typeof InkIntroductionReceiptSchema>;
@@ -0,0 +1,167 @@
1
+ import { z } from "zod";
2
+ // ── INK Audit Event Types (INK Auditability §2) ──
3
+ export const InkAuditEventTypeSchema = z.enum([
4
+ // Message lifecycle
5
+ "message.sent",
6
+ "message.received",
7
+ "message.queued",
8
+ "message.delivered",
9
+ "message.acted",
10
+ "message.rejected",
11
+ "message.expired",
12
+ "message.retracted",
13
+ // Receipt lifecycle
14
+ "receipt.sent",
15
+ "receipt.received",
16
+ // Delegation
17
+ "delegation.granted",
18
+ "delegation.used",
19
+ "delegation.revoked",
20
+ "delegation.expired",
21
+ // Connection
22
+ "connection.requested",
23
+ "connection.accepted",
24
+ "connection.declined",
25
+ // Verification
26
+ "signature.verified",
27
+ "signature.verified_retired",
28
+ "signature.failed",
29
+ "signature.revoked_rejected",
30
+ "replay.detected",
31
+ // Key lifecycle
32
+ "key.rotated",
33
+ "key.revoked",
34
+ // Introduction lifecycle
35
+ "introduction.requested",
36
+ "introduction.approved",
37
+ "introduction.declined",
38
+ "introduction.forwarded",
39
+ "introduction.completed",
40
+ "introduction.expired",
41
+ "introduction.receipt_sent",
42
+ "introduction.receipt_received",
43
+ // Enclave lifecycle
44
+ "enclave.requested",
45
+ "enclave.authorized",
46
+ "enclave.opened",
47
+ "enclave.operation_submitted",
48
+ "enclave.resolved",
49
+ "enclave.expired",
50
+ "enclave.aborted",
51
+ "enclave.receipt_sent",
52
+ "enclave.receipt_received",
53
+ // Containment (Phase 1)
54
+ "transport_scope_violation",
55
+ "handshake_rate_limited",
56
+ "handshake_budget_exhausted",
57
+ "discovery_query_received",
58
+ "discovery_query_granted",
59
+ "discovery_query_denied",
60
+ ]);
61
+ // ── INK Audit Event (hash-chained, signed) ──
62
+ export const InkAuditEventSchema = z.object({
63
+ id: z.string().min(1),
64
+ version: z.literal("ink-audit/1"),
65
+ agentId: z.string().min(1),
66
+ agentSignature: z.string().min(1),
67
+ sequence: z.number().int().positive(),
68
+ previousEventHash: z.string().regex(/^[0-9a-f]{64}$/).nullable(),
69
+ eventType: InkAuditEventTypeSchema,
70
+ timestamp: z.string().datetime(),
71
+ messageId: z.string().min(1).optional(),
72
+ correlationId: z.string().min(1).optional(),
73
+ counterpartyId: z.string().min(1).optional(),
74
+ signingKeyId: z.string().min(1).optional(),
75
+ data: z.record(z.string(), z.unknown()).optional(),
76
+ });
77
+ // ── Receipt (INK Auditability §1) ──
78
+ export const InkReceiptDispositionSchema = z.enum([
79
+ "received",
80
+ "delivered",
81
+ "acted",
82
+ "rejected",
83
+ "expired",
84
+ ]);
85
+ export const InkReceiptSchema = z.object({
86
+ protocol: z.literal("ink/0.1"),
87
+ type: z.literal("network.tulpa.receipt"),
88
+ from: z.string(),
89
+ to: z.string(),
90
+ messageId: z.string(),
91
+ disposition: InkReceiptDispositionSchema,
92
+ dispositionAt: z.string().datetime(),
93
+ note: z.string().max(500).optional(),
94
+ messageHash: z.string(),
95
+ nonce: z.string(),
96
+ timestamp: z.string().datetime(),
97
+ signature: z.string(),
98
+ });
99
+ // ── Audit Query (INK Auditability §3) ──
100
+ export const InkAuditQuerySchema = z.object({
101
+ protocol: z.literal("ink/0.1"),
102
+ type: z.literal("network.tulpa.audit_query"),
103
+ from: z.string(),
104
+ to: z.string(),
105
+ messageId: z.string(),
106
+ nonce: z.string(),
107
+ timestamp: z.string().datetime(),
108
+ });
109
+ // ── Audit Response (INK Auditability §3) ──
110
+ export const InkAuditResponseSchema = z.object({
111
+ protocol: z.literal("ink/0.1"),
112
+ type: z.literal("network.tulpa.audit_response"),
113
+ messageId: z.string(),
114
+ events: z.array(InkAuditEventSchema),
115
+ responseSignature: z.string(),
116
+ });
117
+ // ── Third-Party Audit Submit (INK Auditability §7.2) ──
118
+ export const InkAuditSubmitSchema = z.object({
119
+ protocol: z.literal("ink/0.1"),
120
+ type: z.literal("network.tulpa.audit_submit"),
121
+ from: z.string().max(256),
122
+ to: z.string().max(256),
123
+ event: InkAuditEventSchema,
124
+ nonce: z.string().min(16).max(256),
125
+ timestamp: z.string().datetime(),
126
+ });
127
+ // ── Third-Party Audit Inclusion Receipt (INK Auditability §7.2) ──
128
+ export const InkAuditInclusionSchema = z.object({
129
+ protocol: z.literal("ink/0.1"),
130
+ type: z.literal("network.tulpa.audit_inclusion"),
131
+ eventId: z.string(),
132
+ treeSize: z.number().int().positive(),
133
+ leafIndex: z.number().int().min(0),
134
+ rootHash: z.string(),
135
+ timestamp: z.string().datetime(),
136
+ serviceSignature: z.string(),
137
+ });
138
+ // ── Introduction Receipt (INK Introduction Receipts Extension §4) ──
139
+ export const InkIntroductionReceiptStatusSchema = z.enum([
140
+ "approved",
141
+ "declined",
142
+ "forwarded",
143
+ "completed",
144
+ "expired",
145
+ ]);
146
+ export const InkIntroductionReceiptSchema = z.object({
147
+ protocol: z.literal("ink/0.1"),
148
+ type: z.literal("network.tulpa.introduction_receipt"),
149
+ id: z.string(),
150
+ correlationId: z.string(),
151
+ from: z.string(),
152
+ to: z.string(),
153
+ requesterDid: z.string(),
154
+ introducerDid: z.string(),
155
+ beneficiaryDid: z.string(),
156
+ targetDid: z.string(),
157
+ status: InkIntroductionReceiptStatusSchema,
158
+ purpose: z.string().min(1).max(500),
159
+ nonce: z.string(),
160
+ timestamp: z.string().datetime(),
161
+ relatedIntentId: z.string().optional(),
162
+ relatedResolutionId: z.string().optional(),
163
+ note: z.string().max(500).optional(),
164
+ contextHash: z.string().optional(),
165
+ authorizationChainRef: z.string().optional(),
166
+ expiresAt: z.string().datetime().optional(),
167
+ });
@@ -0,0 +1,129 @@
1
+ import { z } from "zod";
2
+ export declare const InkTransportSchema: z.ZodEnum<{
3
+ ink_http: "ink_http";
4
+ ink_ws: "ink_ws";
5
+ extension_api: "extension_api";
6
+ voice: "voice";
7
+ line_phone: "line_phone";
8
+ human_review_queue: "human_review_queue";
9
+ }>;
10
+ export type InkTransport = z.infer<typeof InkTransportSchema>;
11
+ export declare const InkBackoffHintSchema: z.ZodObject<{
12
+ retryAfterSeconds: z.ZodOptional<z.ZodNumber>;
13
+ cooldownUntil: z.ZodOptional<z.ZodString>;
14
+ backoffClass: z.ZodOptional<z.ZodEnum<{
15
+ sender: "sender";
16
+ intent_ref: "intent_ref";
17
+ counterparty: "counterparty";
18
+ }>>;
19
+ }, z.core.$strip>;
20
+ export type InkBackoffHint = z.infer<typeof InkBackoffHintSchema>;
21
+ export declare const AgentCardVisibilitySchema: z.ZodEnum<{
22
+ public: "public";
23
+ network_only: "network_only";
24
+ capability_gated: "capability_gated";
25
+ private: "private";
26
+ }>;
27
+ export type AgentCardVisibility = z.infer<typeof AgentCardVisibilitySchema>;
28
+ export declare const ChallengeTypeSchema: z.ZodEnum<{
29
+ none: "none";
30
+ mutual_connection_proof: "mutual_connection_proof";
31
+ identity_verification: "identity_verification";
32
+ availability_query: "availability_query";
33
+ context_request: "context_request";
34
+ }>;
35
+ export type ChallengeType = z.infer<typeof ChallengeTypeSchema>;
36
+ export declare const InkChallengeSchema: z.ZodObject<{
37
+ protocol: z.ZodLiteral<"ink/0.1">;
38
+ type: z.ZodLiteral<"network.tulpa.challenge">;
39
+ intentRef: z.ZodString;
40
+ challengeType: z.ZodEnum<{
41
+ none: "none";
42
+ mutual_connection_proof: "mutual_connection_proof";
43
+ identity_verification: "identity_verification";
44
+ availability_query: "availability_query";
45
+ context_request: "context_request";
46
+ }>;
47
+ fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
48
+ availableWindows: z.ZodOptional<z.ZodArray<z.ZodString>>;
49
+ contextFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
50
+ nonce: z.ZodString;
51
+ timestamp: z.ZodString;
52
+ }, z.core.$strip>;
53
+ export type InkChallenge = z.infer<typeof InkChallengeSchema>;
54
+ export declare const RejectionReasonSchema: z.ZodEnum<{
55
+ transport_scope_violation: "transport_scope_violation";
56
+ handshake_budget_exhausted: "handshake_budget_exhausted";
57
+ expired: "expired";
58
+ policy_violation: "policy_violation";
59
+ trust_threshold: "trust_threshold";
60
+ capacity: "capacity";
61
+ unsupported_intent: "unsupported_intent";
62
+ rate_limited: "rate_limited";
63
+ counterparty_cooldown: "counterparty_cooldown";
64
+ sender_rate_limited: "sender_rate_limited";
65
+ delegation_budget_exhausted: "delegation_budget_exhausted";
66
+ }>;
67
+ export type RejectionReason = z.infer<typeof RejectionReasonSchema>;
68
+ export declare const InkRejectionSchema: z.ZodObject<{
69
+ protocol: z.ZodLiteral<"ink/0.1">;
70
+ type: z.ZodLiteral<"network.tulpa.rejection">;
71
+ intentRef: z.ZodString;
72
+ reason: z.ZodEnum<{
73
+ transport_scope_violation: "transport_scope_violation";
74
+ handshake_budget_exhausted: "handshake_budget_exhausted";
75
+ expired: "expired";
76
+ policy_violation: "policy_violation";
77
+ trust_threshold: "trust_threshold";
78
+ capacity: "capacity";
79
+ unsupported_intent: "unsupported_intent";
80
+ rate_limited: "rate_limited";
81
+ counterparty_cooldown: "counterparty_cooldown";
82
+ sender_rate_limited: "sender_rate_limited";
83
+ delegation_budget_exhausted: "delegation_budget_exhausted";
84
+ }>;
85
+ detail: z.ZodOptional<z.ZodString>;
86
+ retryAfter: z.ZodOptional<z.ZodString>;
87
+ backoffHint: z.ZodOptional<z.ZodObject<{
88
+ retryAfterSeconds: z.ZodOptional<z.ZodNumber>;
89
+ cooldownUntil: z.ZodOptional<z.ZodString>;
90
+ backoffClass: z.ZodOptional<z.ZodEnum<{
91
+ sender: "sender";
92
+ intent_ref: "intent_ref";
93
+ counterparty: "counterparty";
94
+ }>>;
95
+ }, z.core.$strip>>;
96
+ nonce: z.ZodString;
97
+ timestamp: z.ZodString;
98
+ }, z.core.$strip>;
99
+ export type InkRejection = z.infer<typeof InkRejectionSchema>;
100
+ export declare const ResolutionOutcomeSchema: z.ZodEnum<{
101
+ accepted: "accepted";
102
+ declined: "declined";
103
+ expired: "expired";
104
+ escalated_to_human: "escalated_to_human";
105
+ }>;
106
+ export type ResolutionOutcome = z.infer<typeof ResolutionOutcomeSchema>;
107
+ export declare const ResolutionDetailsSchema: z.ZodObject<{
108
+ scheduledAt: z.ZodOptional<z.ZodString>;
109
+ duration: z.ZodOptional<z.ZodString>;
110
+ }, z.core.$loose>;
111
+ export declare const InkResolutionSchema: z.ZodObject<{
112
+ protocol: z.ZodLiteral<"ink/0.1">;
113
+ type: z.ZodLiteral<"network.tulpa.resolution">;
114
+ intentRef: z.ZodString;
115
+ outcome: z.ZodEnum<{
116
+ accepted: "accepted";
117
+ declined: "declined";
118
+ expired: "expired";
119
+ escalated_to_human: "escalated_to_human";
120
+ }>;
121
+ details: z.ZodOptional<z.ZodObject<{
122
+ scheduledAt: z.ZodOptional<z.ZodString>;
123
+ duration: z.ZodOptional<z.ZodString>;
124
+ }, z.core.$loose>>;
125
+ counterpartyDid: z.ZodOptional<z.ZodString>;
126
+ nonce: z.ZodString;
127
+ timestamp: z.ZodString;
128
+ }, z.core.$strip>;
129
+ export type InkResolution = z.infer<typeof InkResolutionSchema>;