@compose-market/sdk 0.8.2 → 0.8.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 (128) hide show
  1. package/.speakeasy/a2a.arazzo.yaml +1 -1
  2. package/.speakeasy/memory.arazzo.yaml +1 -1
  3. package/.speakeasy/tests.arazzo.yaml +1 -1
  4. package/dist/errors.d.ts +2 -0
  5. package/dist/errors.d.ts.map +1 -0
  6. package/dist/errors.js +2 -0
  7. package/dist/errors.js.map +1 -0
  8. package/dist/events.d.ts +202 -0
  9. package/dist/events.d.ts.map +1 -0
  10. package/dist/events.js +70 -0
  11. package/dist/events.js.map +1 -0
  12. package/dist/index.d.ts +279 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +552 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/resources/accounts.d.ts +32 -0
  17. package/dist/resources/accounts.d.ts.map +1 -0
  18. package/dist/resources/accounts.js +128 -0
  19. package/dist/resources/accounts.js.map +1 -0
  20. package/dist/resources/agent.d.ts +46 -0
  21. package/dist/resources/agent.d.ts.map +1 -0
  22. package/dist/resources/agent.js +465 -0
  23. package/dist/resources/agent.js.map +1 -0
  24. package/dist/resources/channels.d.ts +24 -0
  25. package/dist/resources/channels.d.ts.map +1 -0
  26. package/dist/resources/channels.js +74 -0
  27. package/dist/resources/channels.js.map +1 -0
  28. package/dist/resources/directory.d.ts +43 -0
  29. package/dist/resources/directory.d.ts.map +1 -0
  30. package/dist/resources/directory.js +97 -0
  31. package/dist/resources/directory.js.map +1 -0
  32. package/dist/resources/dispenser.d.ts +25 -0
  33. package/dist/resources/dispenser.d.ts.map +1 -0
  34. package/dist/resources/dispenser.js +56 -0
  35. package/dist/resources/dispenser.js.map +1 -0
  36. package/dist/resources/feedback.d.ts +35 -0
  37. package/dist/resources/feedback.d.ts.map +1 -0
  38. package/dist/resources/feedback.js +127 -0
  39. package/dist/resources/feedback.js.map +1 -0
  40. package/dist/resources/inference.d.ts +206 -0
  41. package/dist/resources/inference.d.ts.map +1 -0
  42. package/dist/resources/inference.js +1049 -0
  43. package/dist/resources/inference.js.map +1 -0
  44. package/dist/resources/instrumentation.d.ts +29 -0
  45. package/dist/resources/instrumentation.d.ts.map +1 -0
  46. package/dist/resources/instrumentation.js +43 -0
  47. package/dist/resources/instrumentation.js.map +1 -0
  48. package/dist/resources/keys.d.ts +56 -0
  49. package/dist/resources/keys.d.ts.map +1 -0
  50. package/dist/resources/keys.js +186 -0
  51. package/dist/resources/keys.js.map +1 -0
  52. package/dist/resources/local.d.ts +56 -0
  53. package/dist/resources/local.d.ts.map +1 -0
  54. package/dist/resources/local.js +163 -0
  55. package/dist/resources/local.js.map +1 -0
  56. package/dist/resources/memory.d.ts +249 -0
  57. package/dist/resources/memory.d.ts.map +1 -0
  58. package/dist/resources/memory.js +217 -0
  59. package/dist/resources/memory.js.map +1 -0
  60. package/dist/resources/models.d.ts +45 -0
  61. package/dist/resources/models.d.ts.map +1 -0
  62. package/dist/resources/models.js +101 -0
  63. package/dist/resources/models.js.map +1 -0
  64. package/dist/resources/permissions.d.ts +23 -0
  65. package/dist/resources/permissions.d.ts.map +1 -0
  66. package/dist/resources/permissions.js +69 -0
  67. package/dist/resources/permissions.js.map +1 -0
  68. package/dist/resources/receipts.d.ts +23 -0
  69. package/dist/resources/receipts.d.ts.map +1 -0
  70. package/dist/resources/receipts.js +48 -0
  71. package/dist/resources/receipts.js.map +1 -0
  72. package/dist/resources/session-events.d.ts +51 -0
  73. package/dist/resources/session-events.d.ts.map +1 -0
  74. package/dist/resources/session-events.js +404 -0
  75. package/dist/resources/session-events.js.map +1 -0
  76. package/dist/resources/settlement.d.ts +21 -0
  77. package/dist/resources/settlement.d.ts.map +1 -0
  78. package/dist/resources/settlement.js +30 -0
  79. package/dist/resources/settlement.js.map +1 -0
  80. package/dist/resources/system.d.ts +9 -0
  81. package/dist/resources/system.d.ts.map +1 -0
  82. package/dist/resources/system.js +19 -0
  83. package/dist/resources/system.js.map +1 -0
  84. package/dist/resources/webhooks.d.ts +27 -0
  85. package/dist/resources/webhooks.d.ts.map +1 -0
  86. package/dist/resources/webhooks.js +78 -0
  87. package/dist/resources/webhooks.js.map +1 -0
  88. package/dist/resources/workflow.d.ts +43 -0
  89. package/dist/resources/workflow.d.ts.map +1 -0
  90. package/dist/resources/workflow.js +284 -0
  91. package/dist/resources/workflow.js.map +1 -0
  92. package/dist/resources/x402.d.ts +113 -0
  93. package/dist/resources/x402.d.ts.map +1 -0
  94. package/dist/resources/x402.js +231 -0
  95. package/dist/resources/x402.js.map +1 -0
  96. package/dist/tools/index.d.ts +55 -0
  97. package/dist/tools/index.d.ts.map +1 -0
  98. package/dist/tools/index.js +51 -0
  99. package/dist/tools/index.js.map +1 -0
  100. package/dist/types/index.d.ts +1859 -0
  101. package/dist/types/index.d.ts.map +1 -0
  102. package/dist/types/index.js +14 -0
  103. package/dist/types/index.js.map +1 -0
  104. package/dist/version.d.ts +9 -0
  105. package/dist/version.d.ts.map +1 -0
  106. package/dist/version.js +9 -0
  107. package/dist/version.js.map +1 -0
  108. package/generated/inference/esm/lib/config.d.ts +3 -3
  109. package/generated/inference/esm/lib/config.js +3 -3
  110. package/generated/inference/package.json +1 -1
  111. package/generated/inference/src/lib/config.ts +3 -3
  112. package/generated/manowar/esm/lib/config.d.ts +3 -3
  113. package/generated/manowar/esm/lib/config.js +3 -3
  114. package/generated/manowar/package.json +1 -1
  115. package/generated/manowar/src/lib/config.ts +3 -3
  116. package/generated/memory/esm/lib/config.d.ts +3 -3
  117. package/generated/memory/esm/lib/config.js +3 -3
  118. package/generated/memory/package.json +1 -1
  119. package/generated/memory/src/lib/config.ts +3 -3
  120. package/generated/x402/esm/lib/config.d.ts +3 -3
  121. package/generated/x402/esm/lib/config.js +3 -3
  122. package/generated/x402/package.json +1 -1
  123. package/generated/x402/src/lib/config.ts +3 -3
  124. package/package.json +6 -6
  125. package/specs/inference.openapi.yaml +1 -1
  126. package/specs/manowar.openapi.yaml +1 -1
  127. package/specs/memory.openapi.yaml +1 -1
  128. package/specs/x402.openapi.yaml +1 -1
@@ -0,0 +1,1859 @@
1
+ /**
2
+ * Canonical Compose Market API types.
3
+ *
4
+ * These types are the public wire contract between the Compose backend
5
+ * (`api.compose.market`) and the SDK. They mirror the OpenAPI sources under
6
+ * `packages/sdk/specs`; if a mismatch is ever observed, the server contract is
7
+ * authoritative and this file is the one that needs updating.
8
+ *
9
+ * Base wire types (payment, receipt, session, errors) are re-exported from
10
+ * `@compose-market/core`. SDK-specific types (model catalog, inference,
11
+ * agent/workflow streams, memory loop, feedback) are declared below.
12
+ */
13
+ export type { ErrorCode, ErrorEnvelope, PaymentRequirements, PaymentRequiredResource, PaymentRequired, PaymentPayload, X402PaymentSignature, X402PaymentRequest, X402PaymentSigner, PaymentMode, ReceiptLineItem, ReceiptFees, ReceiptBill, Receipt, SessionBudgetSnapshot, SessionInvalidReason, SessionActiveEvent, SessionExpiredEvent, SessionLeaseEvent, SessionEvent, Alert, } from "@compose-market/core";
14
+ import type { Receipt, SessionBudgetSnapshot, SessionInvalidReason } from "@compose-market/core";
15
+ import type { AgentStreamControls } from "@compose-market/core/msm";
16
+ export type { AgentStreamControls } from "@compose-market/core/msm";
17
+ export interface SettleResponse {
18
+ success: boolean;
19
+ errorReason?: string;
20
+ errorMessage?: string;
21
+ payer?: string;
22
+ transaction?: string;
23
+ network?: string;
24
+ amount?: string;
25
+ }
26
+ export interface VerifyResponse {
27
+ isValid: boolean;
28
+ invalidReason?: string;
29
+ invalidMessage?: string;
30
+ payer?: string;
31
+ }
32
+ export interface FacilitatorSupportedResponse {
33
+ kinds: Array<{
34
+ x402Version: number;
35
+ scheme: string;
36
+ network: string;
37
+ extra?: Record<string, unknown>;
38
+ }>;
39
+ extensions: string[];
40
+ signers?: Record<string, string[]>;
41
+ }
42
+ export interface FacilitatorChain {
43
+ chainId: number;
44
+ name: string;
45
+ network: `eip155:${number}`;
46
+ shortName?: string;
47
+ isTestnet: boolean;
48
+ explorer?: string;
49
+ usdcAddress: `0x${string}`;
50
+ schemes: readonly ("exact" | "upto")[];
51
+ asset: "USDC";
52
+ decimals: 6;
53
+ }
54
+ export interface FacilitatorChainsResponse {
55
+ chains: FacilitatorChain[];
56
+ defaultChainId: number;
57
+ }
58
+ export type PaymentIntentStatus = "authorized" | "settling" | "settled" | "aborted" | "failed";
59
+ export interface MeterLineItem {
60
+ key: string;
61
+ unit: string;
62
+ quantity: number;
63
+ unitPriceUsd: number;
64
+ }
65
+ export interface MeteredInput {
66
+ subject: string;
67
+ lineItems: MeterLineItem[];
68
+ }
69
+ export interface MeteredQuotedLineItem extends MeterLineItem {
70
+ amountWei: string;
71
+ }
72
+ export interface MeteredQuote {
73
+ subject: string;
74
+ lineItems: MeteredQuotedLineItem[];
75
+ providerAmountWei: string;
76
+ platformFeeWei: string;
77
+ finalAmountWei: string;
78
+ }
79
+ export interface ModelMeterQuote extends MeteredQuote {
80
+ modelId: string;
81
+ provider: ModelProvider;
82
+ known: boolean;
83
+ meter: MeteredInput;
84
+ }
85
+ export interface PaymentPrepareInput {
86
+ service: string;
87
+ action: string;
88
+ resource: string;
89
+ method: string;
90
+ maxAmountWei?: string;
91
+ meter?: MeteredInput;
92
+ runId?: string;
93
+ idempotencyKey?: string;
94
+ }
95
+ export interface PaymentPrepareResponse {
96
+ paymentIntentId: string;
97
+ maxAmountWei: string;
98
+ status: PaymentIntentStatus;
99
+ [key: string]: unknown;
100
+ }
101
+ export interface PaymentSettleInput {
102
+ paymentIntentId: string;
103
+ finalAmountWei?: string;
104
+ meter?: MeteredInput;
105
+ }
106
+ export interface PaymentSettleResponse {
107
+ paymentIntentId: string;
108
+ maxAmountWei: string;
109
+ finalAmountWei: string;
110
+ status: PaymentIntentStatus;
111
+ meterSubject?: string;
112
+ lineItems?: MeteredQuotedLineItem[];
113
+ providerAmountWei?: string;
114
+ platformFeeWei?: string;
115
+ txHash?: string;
116
+ [key: string]: unknown;
117
+ }
118
+ export interface PaymentAbortInput {
119
+ paymentIntentId: string;
120
+ reason?: string;
121
+ }
122
+ export interface PaymentAbortResponse {
123
+ success?: boolean;
124
+ paymentIntentId: string;
125
+ status?: PaymentIntentStatus;
126
+ reason?: string;
127
+ [key: string]: unknown;
128
+ }
129
+ export interface ModelMeterInput {
130
+ modelId: string;
131
+ modality: CanonicalModality | string;
132
+ usage?: Record<string, unknown>;
133
+ media?: Record<string, unknown>;
134
+ }
135
+ export type FeedbackTargetType = "endpoint" | "x402" | "model" | "agent" | "workflow";
136
+ export type FeedbackCategory = "general" | "bug" | "latency" | "quality" | "pricing" | "settlement" | "model_capability" | "safety" | "docs" | "integration";
137
+ export type FeedbackVerificationKind = "anonymous" | "wallet_header" | "compose_key";
138
+ export interface FeedbackTarget {
139
+ type: FeedbackTargetType;
140
+ id: string;
141
+ }
142
+ export interface FeedbackContext {
143
+ requestId?: string;
144
+ paymentIntentId?: string;
145
+ runId?: string;
146
+ chainId?: number;
147
+ modelId?: string;
148
+ provider?: string;
149
+ agentWallet?: string;
150
+ workflowWallet?: string;
151
+ endpoint?: {
152
+ method?: string;
153
+ path?: string;
154
+ url?: string;
155
+ };
156
+ receipt?: {
157
+ network?: string;
158
+ txHash?: string;
159
+ finalAmountWei?: string;
160
+ };
161
+ sdk?: {
162
+ name?: string;
163
+ version?: string;
164
+ };
165
+ }
166
+ export interface FeedbackSubmitInput {
167
+ target: FeedbackTarget;
168
+ category?: FeedbackCategory;
169
+ rating?: number;
170
+ message?: string;
171
+ labels?: string[];
172
+ context?: FeedbackContext;
173
+ metadata?: Record<string, unknown>;
174
+ }
175
+ export interface FeedbackSubmitResponse {
176
+ feedbackId: string;
177
+ target: FeedbackTarget;
178
+ verification: FeedbackVerificationKind;
179
+ createdAt: number;
180
+ }
181
+ export interface FeedbackRecord {
182
+ id: string;
183
+ target: FeedbackTarget;
184
+ category: FeedbackCategory;
185
+ rating?: number;
186
+ message?: string;
187
+ labels: string[];
188
+ context: FeedbackContext;
189
+ metadata: Record<string, unknown>;
190
+ verification: FeedbackVerificationKind;
191
+ createdAt: number;
192
+ }
193
+ export interface FeedbackListResponse {
194
+ object: "list";
195
+ data: FeedbackRecord[];
196
+ }
197
+ export interface FeedbackSummary {
198
+ target: FeedbackTarget;
199
+ count: number;
200
+ ratingCount: number;
201
+ ratingAverage: number | null;
202
+ ratings: Record<"1" | "2" | "3" | "4" | "5", number>;
203
+ categories: Record<FeedbackCategory, number>;
204
+ verification: Record<FeedbackVerificationKind, number>;
205
+ recent: FeedbackRecord[];
206
+ }
207
+ export type KeyPurpose = "session" | "api";
208
+ export interface KeyCreateResponse {
209
+ keyId: string;
210
+ token: string;
211
+ purpose: KeyPurpose;
212
+ budgetLimit: string;
213
+ budgetUsed: string;
214
+ budgetRemaining: string;
215
+ createdAt: number;
216
+ expiresAt: number;
217
+ chainId: number;
218
+ name?: string;
219
+ }
220
+ export interface KeyRecord {
221
+ keyId: string;
222
+ purpose: KeyPurpose;
223
+ budgetLimit: string;
224
+ budgetUsed: string;
225
+ budgetReserved?: string;
226
+ budgetRemaining: string;
227
+ createdAt: number;
228
+ expiresAt: number;
229
+ revokedAt?: number;
230
+ lastUsedAt?: number;
231
+ name?: string;
232
+ chainId?: number;
233
+ }
234
+ export interface ActiveSessionMetadata {
235
+ hasSession: boolean;
236
+ reason?: string;
237
+ keyId?: string;
238
+ token?: string;
239
+ budgetLimit?: string;
240
+ budgetUsed?: string;
241
+ budgetLocked?: string;
242
+ budgetRemaining?: string;
243
+ expiresAt?: number;
244
+ chainId?: number;
245
+ name?: string;
246
+ status?: {
247
+ isActive: boolean;
248
+ isExpired: boolean;
249
+ expiresInSeconds: number;
250
+ budgetPercentRemaining: number;
251
+ warnings: {
252
+ budgetDepleted: boolean;
253
+ budgetLow: boolean;
254
+ expiringSoon: boolean;
255
+ expired: boolean;
256
+ };
257
+ };
258
+ }
259
+ export interface ReceiptCumulative {
260
+ totalAmountWei: string;
261
+ providerAmountWei?: string;
262
+ platformFeeWei?: string;
263
+ receiptCount: number;
264
+ }
265
+ export interface ReceiptListResponse {
266
+ userAddress: string;
267
+ chainId: number;
268
+ cumulative: ReceiptCumulative;
269
+ receipts: Receipt[];
270
+ }
271
+ export type ModelProvider = "gemini" | "openai" | "fireworks" | "asicloud" | "alibaba" | "hugging face" | "azure" | "aiml" | "vertex" | "cloudflare" | "deepgram" | "elevenlabs" | "cartesia" | "roboflow";
272
+ export type CanonicalModality = "text" | "image" | "audio" | "video" | "embedding" | "realtime";
273
+ export interface PricingUnit {
274
+ unitKey: string;
275
+ unit?: string;
276
+ header?: string;
277
+ entries: Record<string, number>;
278
+ valueKeys: string[];
279
+ default?: boolean;
280
+ }
281
+ export interface ModelOperationCapability {
282
+ modality: CanonicalModality;
283
+ operation: string;
284
+ sourceTypes: string[];
285
+ input: string[];
286
+ output: string[];
287
+ pricingUnits: PricingUnit[];
288
+ streamable: boolean;
289
+ }
290
+ export interface OperationCatalogEntry {
291
+ operation: string;
292
+ modelCount: number;
293
+ sourceTypes: string[];
294
+ pricingUnits: PricingUnit[];
295
+ }
296
+ export interface ModalityCatalogEntry {
297
+ modality: CanonicalModality;
298
+ operations: OperationCatalogEntry[];
299
+ modelCount: number;
300
+ pricingUnits: PricingUnit[];
301
+ }
302
+ export interface ModalityListResponse {
303
+ object: "list";
304
+ data: ModalityCatalogEntry[];
305
+ }
306
+ export interface OperationListResponse {
307
+ object: "list";
308
+ data: OperationCatalogEntry[];
309
+ }
310
+ /**
311
+ * Canonical Compose model card. This is exactly what `/v1/models`,
312
+ * `/v1/models/all`, `/v1/models/search`, and `/v1/models/:id` return — one
313
+ * entry per row, no wrapper, no translation layer.
314
+ */
315
+ export interface Model {
316
+ modelId: string;
317
+ upstreamModelId?: string;
318
+ name: string | null;
319
+ provider: ModelProvider;
320
+ type: string | string[] | null;
321
+ description: string | null;
322
+ input: unknown;
323
+ output: unknown;
324
+ contextWindow: unknown;
325
+ pricing: unknown;
326
+ maxOutputTokens?: number;
327
+ capabilities?: unknown;
328
+ modelType?: unknown;
329
+ sourceMetadata?: unknown;
330
+ params?: unknown;
331
+ operations?: ModelOperationCapability[];
332
+ ownedBy?: string;
333
+ createdAt?: string | number;
334
+ available?: boolean;
335
+ availableFrom?: ModelProvider[];
336
+ hfInferenceProvider?: string;
337
+ hfProviderId?: string;
338
+ }
339
+ export interface ModelListResponse {
340
+ object: "list";
341
+ data: Model[];
342
+ }
343
+ export interface ModelSearchInput {
344
+ q?: string;
345
+ modality?: CanonicalModality;
346
+ operation?: string;
347
+ provider?: ModelProvider;
348
+ priceMaxPerMTok?: number;
349
+ contextWindowMin?: number;
350
+ streaming?: boolean;
351
+ cursor?: string | null;
352
+ limit?: number;
353
+ }
354
+ export interface ModelSearchResponse {
355
+ object: "list";
356
+ data: Model[];
357
+ total: number;
358
+ next_cursor: string | null;
359
+ }
360
+ export type OperationModel = Model & {
361
+ operations: ModelOperationCapability[];
362
+ };
363
+ export interface OperationModelsInput {
364
+ q?: string;
365
+ provider?: ModelProvider;
366
+ streaming?: boolean;
367
+ cursor?: string | null;
368
+ limit?: number;
369
+ }
370
+ export interface OperationModelsResponse {
371
+ object: "list";
372
+ data: OperationModel[];
373
+ total: number;
374
+ next_cursor: string | null;
375
+ }
376
+ export interface ModelParamDefinition {
377
+ type: "string" | "integer" | "number" | "boolean" | "array" | "object";
378
+ required: boolean;
379
+ default?: string | number | boolean;
380
+ options?: Array<string | number>;
381
+ minimum?: number;
382
+ maximum?: number;
383
+ description?: string;
384
+ }
385
+ export interface ModelParamsResponse {
386
+ modelId: string;
387
+ type: CanonicalModality | null;
388
+ provider: string | null;
389
+ params: Record<string, ModelParamDefinition>;
390
+ defaults: Record<string, unknown>;
391
+ }
392
+ export interface PricingModel {
393
+ modelId: string;
394
+ provider: ModelProvider | string;
395
+ pricing: unknown;
396
+ }
397
+ export interface PricingResponse {
398
+ models: PricingModel[];
399
+ version: string;
400
+ }
401
+ export interface HealthResponse {
402
+ status: "ok" | string;
403
+ timestamp?: string;
404
+ [key: string]: unknown;
405
+ }
406
+ export interface RuntimeFramework {
407
+ id?: string;
408
+ name?: string;
409
+ description?: string;
410
+ version?: string;
411
+ [key: string]: unknown;
412
+ }
413
+ export interface FrameworksResponse {
414
+ frameworks: RuntimeFramework[];
415
+ }
416
+ export type ChatRole = "system" | "developer" | "user" | "assistant" | "tool";
417
+ export type AttachmentKind = "image" | "audio" | "video" | "pdf" | "file" | "text" | "json" | "url";
418
+ export interface Attachment {
419
+ type?: AttachmentKind | (string & {
420
+ readonly __brand?: "AttachmentKind";
421
+ });
422
+ url?: string;
423
+ uri?: string;
424
+ data?: string;
425
+ base64?: string;
426
+ mimeType?: string;
427
+ mime_type?: string;
428
+ contentType?: string;
429
+ content_type?: string;
430
+ name?: string;
431
+ filename?: string;
432
+ text?: string;
433
+ content?: string;
434
+ detail?: "auto" | "low" | "high";
435
+ metadata?: Record<string, unknown>;
436
+ [key: string]: unknown;
437
+ }
438
+ export type AttachmentInput = Attachment | string;
439
+ export interface MessageTextPart {
440
+ type: "text";
441
+ text: string;
442
+ }
443
+ export interface MessageImagePart {
444
+ type: "image_url";
445
+ image_url: {
446
+ url: string;
447
+ detail?: "auto" | "low" | "high";
448
+ } | string;
449
+ }
450
+ export interface MessageAudioPart {
451
+ type: "input_audio";
452
+ input_audio: {
453
+ url: string;
454
+ } | string;
455
+ }
456
+ export interface MessageVideoPart {
457
+ type: "video_url";
458
+ video_url: {
459
+ url: string;
460
+ } | string;
461
+ }
462
+ export type MessageContentPart = MessageTextPart | MessageImagePart | MessageAudioPart | MessageVideoPart;
463
+ export interface Message {
464
+ role: ChatRole;
465
+ content: string | MessageContentPart[] | null;
466
+ name?: string;
467
+ tool_call_id?: string;
468
+ tool_calls?: Array<{
469
+ id: string;
470
+ type: "function";
471
+ function: {
472
+ name: string;
473
+ arguments: string;
474
+ };
475
+ }>;
476
+ }
477
+ export interface ToolDefinition {
478
+ type: "function";
479
+ function: {
480
+ name: string;
481
+ description?: string;
482
+ parameters?: Record<string, unknown>;
483
+ strict?: boolean;
484
+ };
485
+ }
486
+ export type ChatToolChoice = "none" | "auto" | "required" | {
487
+ type: "function";
488
+ function: {
489
+ name: string;
490
+ };
491
+ };
492
+ export interface ResponseFormat {
493
+ type: "text" | "json_object" | "json_schema";
494
+ json_schema?: {
495
+ name?: string;
496
+ schema?: Record<string, unknown>;
497
+ strict?: boolean;
498
+ [key: string]: unknown;
499
+ };
500
+ [key: string]: unknown;
501
+ }
502
+ export interface StreamOptions {
503
+ include_usage?: boolean;
504
+ include_obfuscation?: boolean;
505
+ [key: string]: unknown;
506
+ }
507
+ export interface ReasoningOptions {
508
+ effort?: string;
509
+ summary?: string;
510
+ [key: string]: unknown;
511
+ }
512
+ export interface OpenAIPassthroughParams {
513
+ frequency_penalty?: number;
514
+ include?: string[];
515
+ logit_bias?: Record<string, number>;
516
+ metadata?: Record<string, unknown>;
517
+ parallel_tool_calls?: boolean;
518
+ presence_penalty?: number;
519
+ prompt_cache_key?: string;
520
+ promptCacheKey?: string;
521
+ prompt_cache_retention?: string;
522
+ promptCacheRetention?: string;
523
+ reasoning?: ReasoningOptions;
524
+ reasoning_effort?: string;
525
+ reasoningEffort?: string;
526
+ response_format?: ResponseFormat;
527
+ seed?: number;
528
+ service_tier?: string;
529
+ store?: boolean;
530
+ stream_options?: StreamOptions;
531
+ text?: Record<string, unknown>;
532
+ textVerbosity?: string;
533
+ top_p?: number;
534
+ user?: string;
535
+ verbosity?: string;
536
+ custom_params?: Record<string, unknown>;
537
+ }
538
+ export interface ChatCompletionsCreateParams extends OpenAIPassthroughParams {
539
+ model: string;
540
+ messages: Message[];
541
+ attachments?: AttachmentInput[];
542
+ attachment?: AttachmentInput;
543
+ stream?: boolean;
544
+ temperature?: number;
545
+ n?: number;
546
+ stop?: string | string[];
547
+ max_tokens?: number;
548
+ max_completion_tokens?: number;
549
+ tools?: ToolDefinition[];
550
+ tool_choice?: ChatToolChoice;
551
+ [key: string]: unknown;
552
+ }
553
+ export interface ChatUsage {
554
+ prompt_tokens: number;
555
+ completion_tokens: number;
556
+ total_tokens: number;
557
+ reasoning_tokens?: number;
558
+ cached_input_tokens?: number;
559
+ }
560
+ export interface ChatCompletion {
561
+ id: string;
562
+ object: "chat.completion";
563
+ created: number;
564
+ model: string;
565
+ choices: Array<{
566
+ index: number;
567
+ message: {
568
+ role: "assistant";
569
+ content: string | null;
570
+ reasoning_content?: string;
571
+ tool_calls?: Array<{
572
+ id: string;
573
+ type: "function";
574
+ function: {
575
+ name: string;
576
+ arguments: string;
577
+ };
578
+ }>;
579
+ };
580
+ finish_reason: string;
581
+ }>;
582
+ usage: ChatUsage;
583
+ receipt?: Record<string, unknown>;
584
+ }
585
+ export interface ChatCompletionChunk {
586
+ id: string;
587
+ object: "chat.completion.chunk";
588
+ created: number;
589
+ model: string;
590
+ choices: Array<{
591
+ index: number;
592
+ delta: {
593
+ role?: "assistant";
594
+ content?: string;
595
+ reasoning_content?: string;
596
+ tool_calls?: Array<{
597
+ index: number;
598
+ id?: string;
599
+ type?: "function";
600
+ function?: {
601
+ name?: string;
602
+ arguments?: string;
603
+ };
604
+ }>;
605
+ };
606
+ finish_reason: string | null;
607
+ }>;
608
+ usage?: ChatUsage;
609
+ }
610
+ export interface ResponsesCreateParams extends OpenAIPassthroughParams {
611
+ model: string;
612
+ input: unknown;
613
+ attachments?: AttachmentInput[];
614
+ attachment?: AttachmentInput;
615
+ modalities?: Array<"text" | "image" | "audio" | "video" | "embedding">;
616
+ stream?: boolean;
617
+ instructions?: string;
618
+ previous_response_id?: string;
619
+ max_output_tokens?: number;
620
+ temperature?: number;
621
+ tools?: ToolDefinition[];
622
+ tool_choice?: ChatToolChoice;
623
+ n?: number;
624
+ size?: string;
625
+ quality?: string;
626
+ image_url?: string;
627
+ voice?: string;
628
+ language?: string;
629
+ speed?: number;
630
+ duration?: number;
631
+ aspect_ratio?: string;
632
+ resolution?: string;
633
+ [key: string]: unknown;
634
+ }
635
+ export interface ResponseObject {
636
+ id: string;
637
+ object: "response";
638
+ created_at: number;
639
+ status: "completed" | "in_progress" | "failed" | "cancelled";
640
+ model: string;
641
+ output: Array<Record<string, unknown>>;
642
+ usage?: {
643
+ input_tokens: number;
644
+ output_tokens: number;
645
+ total_tokens: number;
646
+ };
647
+ error?: {
648
+ message: string;
649
+ type?: string;
650
+ code?: string;
651
+ };
652
+ previous_response_id?: string;
653
+ job_id?: string;
654
+ receipt?: Record<string, unknown>;
655
+ }
656
+ export interface ResponseOutputItem {
657
+ type: string;
658
+ role?: "assistant";
659
+ text?: string;
660
+ image_url?: string;
661
+ audio_url?: string;
662
+ video_url?: string;
663
+ embedding?: number[];
664
+ job_id?: string;
665
+ status?: string;
666
+ progress?: number;
667
+ mime_type?: string;
668
+ [key: string]: unknown;
669
+ }
670
+ export interface EmbeddingsCreateParams {
671
+ model: string;
672
+ input: string | string[];
673
+ attachments?: AttachmentInput[];
674
+ attachment?: AttachmentInput;
675
+ dimensions?: number;
676
+ encoding_format?: "float" | "base64" | string;
677
+ user?: string;
678
+ [key: string]: unknown;
679
+ }
680
+ export interface EmbeddingsResponse {
681
+ object: "list";
682
+ data: Array<{
683
+ object: "embedding";
684
+ embedding: number[];
685
+ index: number;
686
+ }>;
687
+ model: string;
688
+ usage: {
689
+ prompt_tokens: number;
690
+ total_tokens: number;
691
+ };
692
+ receipt?: Record<string, unknown>;
693
+ }
694
+ export interface ImagesGenerateParams {
695
+ model: string;
696
+ prompt: string;
697
+ attachments?: AttachmentInput[];
698
+ attachment?: AttachmentInput;
699
+ n?: number;
700
+ size?: string;
701
+ quality?: string;
702
+ response_format?: "url" | "b64_json" | string;
703
+ style?: "vivid" | "natural" | string;
704
+ user?: string;
705
+ [key: string]: unknown;
706
+ }
707
+ export interface ImagesEditParams extends ImagesGenerateParams {
708
+ image?: string;
709
+ mask?: string;
710
+ }
711
+ export interface ImagesResponse {
712
+ created: number;
713
+ data: Array<{
714
+ url?: string;
715
+ b64_json?: string;
716
+ revised_prompt?: string;
717
+ }>;
718
+ receipt?: Record<string, unknown>;
719
+ }
720
+ export interface AudioSpeechCreateParams {
721
+ model: string;
722
+ input: string;
723
+ attachments?: AttachmentInput[];
724
+ attachment?: AttachmentInput;
725
+ voice?: string;
726
+ response_format?: string;
727
+ speed?: number;
728
+ user?: string;
729
+ [key: string]: unknown;
730
+ }
731
+ export interface AudioTranscriptionCreateParams {
732
+ model: string;
733
+ file: string | Blob | File | Uint8Array;
734
+ attachments?: AttachmentInput[];
735
+ attachment?: AttachmentInput;
736
+ filename?: string;
737
+ language?: string;
738
+ response_format?: string;
739
+ prompt?: string;
740
+ temperature?: number;
741
+ timestamp_granularities?: Array<"word" | "segment" | string>;
742
+ [key: string]: unknown;
743
+ }
744
+ export interface AudioTranscriptionResponse {
745
+ text: string;
746
+ task?: string;
747
+ language?: string;
748
+ duration?: number;
749
+ words?: Array<{
750
+ word: string;
751
+ start: number;
752
+ end: number;
753
+ }>;
754
+ segments?: Array<Record<string, unknown>>;
755
+ receipt?: Record<string, unknown>;
756
+ }
757
+ export interface VideoGenerateParams {
758
+ model: string;
759
+ prompt?: string;
760
+ attachments?: AttachmentInput[];
761
+ attachment?: AttachmentInput;
762
+ duration?: number;
763
+ aspect_ratio?: string;
764
+ resolution?: string;
765
+ size?: string;
766
+ fps?: number;
767
+ image?: string;
768
+ image_url?: string;
769
+ user?: string;
770
+ [key: string]: unknown;
771
+ }
772
+ export interface VideoGenerateResponse {
773
+ id?: string;
774
+ object?: "video.generation";
775
+ status?: string;
776
+ created?: number;
777
+ model?: string;
778
+ job_id?: string;
779
+ data?: Array<{
780
+ url?: string;
781
+ b64_json?: string;
782
+ base64?: string;
783
+ duration?: number;
784
+ [key: string]: unknown;
785
+ }>;
786
+ receipt?: Record<string, unknown>;
787
+ [key: string]: unknown;
788
+ }
789
+ export interface VideoJobStatus {
790
+ id: string;
791
+ object: "video.generation";
792
+ status: "queued" | "processing" | "completed" | "failed";
793
+ url?: string;
794
+ error?: string;
795
+ progress?: number;
796
+ }
797
+ export type VideoStatusStreamEvent = {
798
+ type: "compose.video.status";
799
+ jobId: string;
800
+ status: "queued" | "processing" | "completed" | "failed";
801
+ progress?: number;
802
+ url?: string;
803
+ error?: string;
804
+ } | {
805
+ type: "compose.error";
806
+ code: string;
807
+ message: string;
808
+ details?: Record<string, unknown>;
809
+ } | {
810
+ type: "done";
811
+ };
812
+ /**
813
+ * Events emitted by the Compose agent runtime on /agent/:wallet/stream.
814
+ * Mirrors the runtime's native SSE vocabulary — no translation, no renaming.
815
+ */
816
+ export type AgentDisplayKind = "tool" | "model" | "connector" | "agent" | "search" | "harness" | "swarm" | "conclave" | "route";
817
+ export interface AgentEventDisplay {
818
+ kind: AgentDisplayKind;
819
+ id?: string;
820
+ name?: string;
821
+ target?: string;
822
+ summary?: string;
823
+ details?: Record<string, unknown>;
824
+ }
825
+ export type PlanDecision = "approved" | "rejected" | "changes_requested";
826
+ export type AgentArtifactKind = "image" | "audio" | "video" | "embedding" | "realtime" | "file" | "artifact";
827
+ export interface AgentStreamCreateParams extends AgentStreamControls {
828
+ agentWallet: string;
829
+ message: string;
830
+ threadId: string;
831
+ userAddress: string;
832
+ agentCard?: unknown;
833
+ cloudPermissions?: unknown;
834
+ runId?: string;
835
+ attachment?: AttachmentInput;
836
+ attachments?: AttachmentInput[];
837
+ }
838
+ export interface AgentStreamFinalResult {
839
+ text: string;
840
+ toolCalls: Array<{
841
+ toolName: string;
842
+ displayName?: string;
843
+ summary?: string;
844
+ failed: boolean;
845
+ error?: string;
846
+ targetKind?: AgentDisplayKind;
847
+ target?: string;
848
+ display?: AgentEventDisplay;
849
+ }>;
850
+ requestId: string | null;
851
+ receipt: Receipt | null;
852
+ budget: SessionBudgetSnapshot | null;
853
+ sessionInvalidReason: SessionInvalidReason | null;
854
+ }
855
+ export interface AgentDecisionInput {
856
+ agentWallet: string;
857
+ runId: string;
858
+ proposalId: string;
859
+ version: number;
860
+ approvalId?: string;
861
+ decision: PlanDecision;
862
+ approver?: string;
863
+ reason?: string;
864
+ feedback?: string;
865
+ }
866
+ export interface AgentDecisionResult {
867
+ ok?: boolean;
868
+ proposalId?: string;
869
+ version?: number;
870
+ state?: string;
871
+ decision?: PlanDecision;
872
+ [key: string]: unknown;
873
+ }
874
+ export interface WorkflowStreamCreateParams {
875
+ workflowWallet: string;
876
+ message: string;
877
+ threadId: string;
878
+ userAddress: string;
879
+ runId?: string;
880
+ continuous?: boolean;
881
+ lastEventIndex?: number;
882
+ attachment?: AttachmentInput;
883
+ attachments?: AttachmentInput[];
884
+ }
885
+ export interface WorkflowStreamFinalResult {
886
+ text: string;
887
+ structuredOutput: unknown;
888
+ toolCalls: Array<{
889
+ toolName: string;
890
+ summary?: string;
891
+ failed: boolean;
892
+ error?: string;
893
+ }>;
894
+ requestId: string | null;
895
+ receipt: Receipt | null;
896
+ budget: SessionBudgetSnapshot | null;
897
+ sessionInvalidReason: SessionInvalidReason | null;
898
+ }
899
+ export interface LocalLinkCreateInput {
900
+ userAddress?: string;
901
+ chainId?: number;
902
+ agentWallet?: string;
903
+ agentCardCid?: string;
904
+ deviceId?: string;
905
+ }
906
+ export interface LocalLinkCreateResponse {
907
+ success: boolean;
908
+ token: string;
909
+ mode: "local-first" | "web-first";
910
+ expiresAt: number;
911
+ deepLinkUrl: string;
912
+ hasSession: boolean;
913
+ }
914
+ export interface LocalLinkRedeemInput {
915
+ token: string;
916
+ deviceId: string;
917
+ connectedUserAddress?: string;
918
+ }
919
+ export interface LocalRedeemedContext {
920
+ agentWallet: string;
921
+ userAddress: string;
922
+ chainId: number;
923
+ key: {
924
+ keyId: string;
925
+ token: string;
926
+ expiresAt: number;
927
+ };
928
+ session: {
929
+ sessionId: string;
930
+ budget: string;
931
+ duration: number;
932
+ expiresAt: number;
933
+ };
934
+ market: {
935
+ entry: "local" | string;
936
+ agentWallet: string;
937
+ agentCardCid: string | null;
938
+ };
939
+ deviceId: string;
940
+ hasSession: boolean;
941
+ linkMode: "local-first" | "web-first";
942
+ }
943
+ export interface LocalLinkRedeemResponse {
944
+ success: boolean;
945
+ context: LocalRedeemedContext;
946
+ }
947
+ export interface LocalDeploymentRegisterInput {
948
+ agentWallet: string;
949
+ userAddress?: string;
950
+ keyId: string;
951
+ agentCardCid: string;
952
+ localVersion: string;
953
+ deployedAt: number;
954
+ chainId?: number;
955
+ }
956
+ export interface LocalDeploymentRecord {
957
+ version: number;
958
+ deploymentId: string;
959
+ agentWallet: string;
960
+ userAddress: string;
961
+ keyId: string;
962
+ agentCardCid: string;
963
+ localVersion: string;
964
+ deployedAt: number;
965
+ chainId: number;
966
+ registeredAt: number;
967
+ updatedAt: number;
968
+ }
969
+ export interface LocalDeploymentRegisterResponse {
970
+ success: boolean;
971
+ idempotent: boolean;
972
+ deployment: LocalDeploymentRecord;
973
+ }
974
+ export interface LocalPeerSummary {
975
+ peerId: string;
976
+ lastSeenAt: number;
977
+ stale: boolean;
978
+ caps: string[];
979
+ listenMultiaddrs: string[];
980
+ deviceId?: string | null;
981
+ agentWallet?: string | null;
982
+ }
983
+ export interface LocalNetworkUpsertInput {
984
+ userAddress?: string;
985
+ chainId?: number;
986
+ agentWallet?: string;
987
+ deviceId?: string;
988
+ peers: LocalPeerSummary[];
989
+ }
990
+ export interface LocalNetworkUpsertResponse {
991
+ success: boolean;
992
+ upserted: number;
993
+ chainId: number;
994
+ }
995
+ export interface LocalNetworkPeersInput {
996
+ userAddress?: string;
997
+ chainId?: number;
998
+ agentWallet?: string;
999
+ }
1000
+ export interface LocalNetworkPeersResponse {
1001
+ success: boolean;
1002
+ chainId: number;
1003
+ userAddress: string;
1004
+ peers: LocalPeerSummary[];
1005
+ }
1006
+ export interface LocalSynapseSessionInput {
1007
+ agentWallet: string;
1008
+ deviceId: string;
1009
+ sessionKeyAddress: string;
1010
+ sessionKeyExpiresAt: number;
1011
+ depositAmount?: string | number;
1012
+ }
1013
+ export interface LocalStorageSessionResponse {
1014
+ success: boolean;
1015
+ agentWallet: string;
1016
+ deviceId: string;
1017
+ payerAddress: string;
1018
+ sessionKeyAddress: string;
1019
+ sessionKeyExpiresAt: number;
1020
+ availableFunds: string;
1021
+ depositAmount: string;
1022
+ depositExecuted: boolean;
1023
+ network: string;
1024
+ source: string;
1025
+ }
1026
+ export type LocalSynapseSessionResponse = LocalStorageSessionResponse;
1027
+ export interface LocalFilecoinPinSessionInput {
1028
+ agentWallet: string;
1029
+ deviceId: string;
1030
+ sessionKeyAddress: string;
1031
+ sessionKeyExpiresAt: number;
1032
+ fileSizeBytes: number;
1033
+ copies?: number;
1034
+ }
1035
+ export interface LocalFilecoinPinSessionResponse extends LocalStorageSessionResponse {
1036
+ fileSizeBytes: number;
1037
+ providerIds: string[];
1038
+ }
1039
+ export interface DispenserStatus {
1040
+ chainId: number;
1041
+ chainName: string;
1042
+ totalClaims: number;
1043
+ maxClaims: number;
1044
+ remainingClaims: number;
1045
+ dispenserBalance: string;
1046
+ dispenserBalanceFormatted: string;
1047
+ isPaused: boolean;
1048
+ dispenserAddress: string;
1049
+ usdcAddress: string;
1050
+ isConfigured: boolean;
1051
+ }
1052
+ export interface DispenserClaimInput {
1053
+ address?: string;
1054
+ chainId?: number;
1055
+ }
1056
+ export interface DispenserClaimResponse {
1057
+ success: boolean;
1058
+ txHash?: string;
1059
+ alreadyClaimed?: boolean;
1060
+ globalClaimStatus?: {
1061
+ claimedOnChain?: number;
1062
+ claimedOnChainName?: string;
1063
+ claimedAt?: number;
1064
+ };
1065
+ error?: string;
1066
+ }
1067
+ export interface DispenserStatusResponse {
1068
+ dispensers: DispenserStatus[];
1069
+ claimAmount: number;
1070
+ claimAmountFormatted: string;
1071
+ maxClaims: number;
1072
+ }
1073
+ export interface DispenserStatusByChainResponse {
1074
+ available: boolean;
1075
+ reason?: string;
1076
+ status?: DispenserStatus;
1077
+ }
1078
+ export interface DispenserCheckResponse {
1079
+ address: string;
1080
+ hasClaimed: boolean;
1081
+ claimedOnChain?: number;
1082
+ claimedOnChainName?: string;
1083
+ claimedAt?: number;
1084
+ }
1085
+ export interface SettlementStatusInput {
1086
+ userAddress?: string;
1087
+ chainId?: number;
1088
+ }
1089
+ export interface SettlementBudgetInfo {
1090
+ budgetLimit?: string | number;
1091
+ budgetUsed?: string | number;
1092
+ budgetLocked?: string | number;
1093
+ budgetRemaining?: string | number;
1094
+ expiresAt?: number;
1095
+ chainId?: number;
1096
+ [key: string]: unknown;
1097
+ }
1098
+ export interface SettlementStatusResponse {
1099
+ hasActiveBudget: boolean;
1100
+ message?: string;
1101
+ budget?: SettlementBudgetInfo;
1102
+ }
1103
+ export type PermissionConsentType = "filesystem" | "camera" | "microphone" | "geolocation" | "clipboard" | "notifications" | string;
1104
+ export interface PermissionGrant {
1105
+ userAddress: string;
1106
+ agentWallet: string;
1107
+ consentType: PermissionConsentType;
1108
+ granted: boolean;
1109
+ grantedAt: number;
1110
+ expiresAt?: number;
1111
+ }
1112
+ export interface PermissionListInput {
1113
+ userAddress?: string;
1114
+ agentWallet: string;
1115
+ }
1116
+ export interface PermissionListResponse {
1117
+ permissions: PermissionGrant[];
1118
+ }
1119
+ export interface PermissionGrantInput {
1120
+ userAddress?: string;
1121
+ agentWallet: string;
1122
+ consentType: PermissionConsentType;
1123
+ expiresAt?: number;
1124
+ }
1125
+ export interface PermissionRevokeInput {
1126
+ userAddress?: string;
1127
+ agentWallet: string;
1128
+ consentType: PermissionConsentType;
1129
+ }
1130
+ export interface PermissionWriteResponse {
1131
+ success: boolean;
1132
+ permission?: PermissionGrant;
1133
+ }
1134
+ export interface AccountConnectInput {
1135
+ userAddress?: string;
1136
+ agentWallet: string;
1137
+ toolkit: string;
1138
+ }
1139
+ export interface AccountConnectResponse {
1140
+ redirectUrl: string;
1141
+ userAddress: string;
1142
+ agentWallet: string;
1143
+ toolkit: string;
1144
+ connectedAccountId: string;
1145
+ authMode?: string;
1146
+ }
1147
+ export interface AccountListInput {
1148
+ userAddress?: string;
1149
+ agentWallet: string;
1150
+ toolkit?: string;
1151
+ }
1152
+ export interface AccountConnection {
1153
+ slug: string;
1154
+ name: string;
1155
+ connected: boolean;
1156
+ connectedAccountId: string;
1157
+ accountId: string;
1158
+ status?: string;
1159
+ source: "composio" | string;
1160
+ }
1161
+ export interface AccountListResponse {
1162
+ connections: AccountConnection[];
1163
+ }
1164
+ export interface AccountStatusInput {
1165
+ userAddress?: string;
1166
+ agentWallet: string;
1167
+ toolkit: string;
1168
+ connectedAccountId: string;
1169
+ }
1170
+ export type AccountStatusResponse = AccountConnection;
1171
+ export interface AccountDisconnectInput {
1172
+ userAddress?: string;
1173
+ agentWallet: string;
1174
+ toolkit: string;
1175
+ connectedAccountId: string;
1176
+ }
1177
+ export interface AccountDisconnectResponse {
1178
+ success: boolean;
1179
+ }
1180
+ export interface AccountExecuteInput {
1181
+ userAddress?: string;
1182
+ agentWallet: string;
1183
+ toolkit: string;
1184
+ connectedAccountId: string;
1185
+ action: string;
1186
+ params?: Record<string, unknown>;
1187
+ text?: string;
1188
+ }
1189
+ export interface AccountExecuteResponse {
1190
+ success: boolean;
1191
+ result?: unknown;
1192
+ error?: string;
1193
+ }
1194
+ export interface AccountToolkitsInput {
1195
+ search?: string;
1196
+ limit?: number;
1197
+ }
1198
+ export interface AccountToolkit {
1199
+ slug: string;
1200
+ name: string;
1201
+ logo: string;
1202
+ description: string;
1203
+ categories: string[];
1204
+ authSchemes: string[];
1205
+ composioManagedSchemes: string[];
1206
+ }
1207
+ export interface AccountToolkitsResponse {
1208
+ toolkits: AccountToolkit[];
1209
+ }
1210
+ export interface AccountToolkitActionsInput {
1211
+ limit?: number;
1212
+ }
1213
+ export interface AccountToolkitAction {
1214
+ slug: string;
1215
+ name: string;
1216
+ description: string;
1217
+ toolkitSlug: string;
1218
+ toolkitName: string;
1219
+ noAuth: boolean;
1220
+ scopes: string[];
1221
+ inputParameters: Record<string, unknown>;
1222
+ }
1223
+ export interface AccountToolkitActionsResponse {
1224
+ toolkit: string;
1225
+ actions: AccountToolkitAction[];
1226
+ }
1227
+ export type ChannelName = "telegram" | "slack" | "discord" | "whatsapp";
1228
+ export interface ChannelRoute {
1229
+ id: string;
1230
+ channel: ChannelName;
1231
+ userAddress: string;
1232
+ agentWallet: string;
1233
+ accountId: string;
1234
+ threadId: string;
1235
+ label?: string;
1236
+ metadata?: Record<string, unknown>;
1237
+ createdAt: number;
1238
+ updatedAt: number;
1239
+ }
1240
+ export interface ChannelListResponse {
1241
+ channels: ChannelName[];
1242
+ }
1243
+ export interface ChannelGetResponse {
1244
+ channel: ChannelName;
1245
+ link: string;
1246
+ status: string;
1247
+ disconnect: string;
1248
+ webhook: string | null;
1249
+ socket: string | null;
1250
+ }
1251
+ export interface ChannelLinkInput {
1252
+ userAddress?: string;
1253
+ agentWallet: string;
1254
+ agentName?: string;
1255
+ mode?: "user" | "guild";
1256
+ privacy?: "public" | "private";
1257
+ }
1258
+ export interface ChannelLinkResponse {
1259
+ code: string;
1260
+ channel: ChannelName;
1261
+ userAddress: string;
1262
+ agentWallet: string;
1263
+ agentName?: string;
1264
+ mode?: "user" | "guild";
1265
+ privacy?: "public" | "private";
1266
+ createdAt: number;
1267
+ expiresAt: number;
1268
+ url: string | null;
1269
+ action?: {
1270
+ type: "redirect" | "websocket" | "oauth";
1271
+ label: string;
1272
+ url: string | null;
1273
+ socket?: string;
1274
+ command?: string;
1275
+ };
1276
+ }
1277
+ export interface ChannelStatusInput {
1278
+ userAddress?: string;
1279
+ agentWallet: string;
1280
+ accountId?: string;
1281
+ threadId?: string;
1282
+ }
1283
+ export interface ChannelStatusResponse {
1284
+ channel: ChannelName;
1285
+ connected: boolean;
1286
+ routes: ChannelRoute[];
1287
+ }
1288
+ export interface ChannelDisconnectInput {
1289
+ userAddress?: string;
1290
+ agentWallet: string;
1291
+ accountId?: string;
1292
+ threadId?: string;
1293
+ }
1294
+ export interface ChannelDisconnectResponse {
1295
+ channel: ChannelName;
1296
+ disconnected: number;
1297
+ }
1298
+ export interface DirectoryAgent {
1299
+ schemaVersion: string;
1300
+ name: string;
1301
+ description: string;
1302
+ skills: string[];
1303
+ x402Support: boolean;
1304
+ image?: string;
1305
+ avatar?: string;
1306
+ avatarUrl?: string;
1307
+ dnaHash: string;
1308
+ walletAddress: string;
1309
+ walletTimestamp?: number;
1310
+ chain: number;
1311
+ model: string;
1312
+ framework?: "manowar" | string;
1313
+ licensePrice: string;
1314
+ creatorFee?: number;
1315
+ licenses: number;
1316
+ licensesAvailable?: number;
1317
+ cloneable: boolean;
1318
+ isClone?: boolean;
1319
+ parentAgentId?: number;
1320
+ agentId?: number;
1321
+ knowledge?: string[];
1322
+ endpoint?: string;
1323
+ protocols: Array<{
1324
+ name: string;
1325
+ version: string;
1326
+ }>;
1327
+ connectors?: Array<{
1328
+ registryId: string;
1329
+ name: string;
1330
+ origin: string;
1331
+ }>;
1332
+ createdAt: string;
1333
+ creator?: string;
1334
+ cid?: string;
1335
+ score?: number;
1336
+ }
1337
+ export interface DirectoryWorkflow {
1338
+ schemaVersion: string;
1339
+ title: string;
1340
+ description: string;
1341
+ image?: string;
1342
+ dnaHash: string;
1343
+ walletAddress: string;
1344
+ walletTimestamp: number;
1345
+ agents: DirectoryAgent[];
1346
+ edges?: Array<{
1347
+ source: number;
1348
+ target: number;
1349
+ label?: string;
1350
+ }>;
1351
+ coordinator?: {
1352
+ hasCoordinator: boolean;
1353
+ model: string;
1354
+ };
1355
+ pricing: {
1356
+ totalAgentPrice: string;
1357
+ };
1358
+ lease?: {
1359
+ enabled: boolean;
1360
+ durationDays: number;
1361
+ creatorPercent: number;
1362
+ };
1363
+ rfa?: {
1364
+ title: string;
1365
+ description: string;
1366
+ skills: string[];
1367
+ offerAmount: string;
1368
+ };
1369
+ creator: string;
1370
+ createdAt: string;
1371
+ cid?: string;
1372
+ }
1373
+ export interface DirectoryAgentListResponse {
1374
+ agents: DirectoryAgent[];
1375
+ total: number;
1376
+ count?: number;
1377
+ nextCursor?: string | null;
1378
+ hasMore?: boolean;
1379
+ }
1380
+ export interface DirectoryWorkflowListResponse {
1381
+ workflows: DirectoryWorkflow[];
1382
+ total: number;
1383
+ }
1384
+ export interface AgentverseQuery {
1385
+ search?: string;
1386
+ q?: string;
1387
+ category?: string;
1388
+ tags?: string[];
1389
+ limit?: number;
1390
+ offset?: number;
1391
+ sort?: "relevancy" | "created-at" | "last-modified" | "interactions";
1392
+ direction?: "asc" | "desc";
1393
+ }
1394
+ export type AgentverseResponse = Record<string, unknown>;
1395
+ export type AgentMemoryLayer = "working" | "scene" | "graph" | "patterns" | "archives" | "vectors";
1396
+ export type AgentMemoryLoopStep = "pre_turn" | "post_turn" | "remember";
1397
+ export interface AgentMemoryScopeInput {
1398
+ agentWallet: string;
1399
+ userAddress?: string;
1400
+ threadId?: string;
1401
+ mode?: "global" | "local";
1402
+ haiId?: string;
1403
+ filters?: Record<string, unknown>;
1404
+ metadata?: Record<string, unknown>;
1405
+ }
1406
+ export interface AgentMemoryContextParams extends AgentMemoryScopeInput {
1407
+ query: string;
1408
+ layers?: AgentMemoryLayer[];
1409
+ limit?: number;
1410
+ maxItems?: number;
1411
+ maxItemChars?: number;
1412
+ budget?: {
1413
+ maxCharacters?: number;
1414
+ max_chars?: number;
1415
+ maxContextCharacters?: number;
1416
+ max_context_chars?: number;
1417
+ mode?: "compact" | "balanced" | "recall";
1418
+ };
1419
+ includeRaw?: boolean;
1420
+ }
1421
+ export interface AgentMemoryTurnMessage {
1422
+ role: "user" | "assistant" | "system" | "tool";
1423
+ content: string;
1424
+ timestamp?: number;
1425
+ toolCalls?: Array<{
1426
+ name: string;
1427
+ args: Record<string, unknown>;
1428
+ }>;
1429
+ }
1430
+ export interface AgentMemoryRecordTurnParams extends AgentMemoryScopeInput {
1431
+ contextId?: string;
1432
+ turnId?: string;
1433
+ sessionId?: string;
1434
+ messages?: AgentMemoryTurnMessage[];
1435
+ toolEvents?: Array<{
1436
+ name: string;
1437
+ toolName?: string;
1438
+ tool?: string;
1439
+ args?: Record<string, unknown>;
1440
+ input?: Record<string, unknown>;
1441
+ result?: string;
1442
+ output?: string;
1443
+ status?: string;
1444
+ timestamp?: number;
1445
+ }>;
1446
+ userMessage?: string;
1447
+ assistantMessage?: string;
1448
+ modelUsed?: string;
1449
+ model?: string;
1450
+ totalTokens?: number;
1451
+ tokenCount?: number;
1452
+ contextWindow?: number;
1453
+ summary?: string;
1454
+ }
1455
+ export interface AgentMemoryRememberParams extends AgentMemoryScopeInput {
1456
+ content: string;
1457
+ type?: string;
1458
+ scope?: string;
1459
+ retention?: string;
1460
+ conflictPolicy?: string;
1461
+ confidence?: number;
1462
+ enableGraph?: boolean;
1463
+ }
1464
+ export type AgentMemoryLoopParams = ({
1465
+ step: "pre_turn";
1466
+ } & AgentMemoryContextParams) | ({
1467
+ step: "post_turn";
1468
+ } & AgentMemoryRecordTurnParams) | ({
1469
+ step: "remember";
1470
+ } & AgentMemoryRememberParams);
1471
+ export interface AgentMemoryCompactItem {
1472
+ layer: string;
1473
+ text: string;
1474
+ id?: string;
1475
+ score?: number;
1476
+ source?: string;
1477
+ createdAt?: number;
1478
+ }
1479
+ export interface AgentMemoryLoopEnvelope<TStep extends AgentMemoryLoopStep> {
1480
+ v: "compose.agent_memory_loop.v1";
1481
+ step: TStep;
1482
+ next: AgentMemoryLoopStep[];
1483
+ }
1484
+ export interface AgentMemoryContextResponse {
1485
+ loop: AgentMemoryLoopEnvelope<"pre_turn">;
1486
+ contextId: string;
1487
+ prompt: string | null;
1488
+ items: AgentMemoryCompactItem[];
1489
+ totals: Record<string, number>;
1490
+ contextUsage: {
1491
+ characters: number;
1492
+ rawCharacters: number;
1493
+ budgetCharacters?: number;
1494
+ savedCharactersVsRaw: number;
1495
+ items: number;
1496
+ };
1497
+ omitted: Record<string, number>;
1498
+ raw?: Record<string, unknown[]>;
1499
+ }
1500
+ export interface AgentMemoryRecordTurnResponse {
1501
+ loop: AgentMemoryLoopEnvelope<"post_turn">;
1502
+ success: true;
1503
+ sessionId: string;
1504
+ threadId: string;
1505
+ turnId: string;
1506
+ vectorId?: string;
1507
+ stored: {
1508
+ /** Full transcript persisted to the `scene` layer (Mongo session_transcripts). */
1509
+ transcript: boolean;
1510
+ /** Working-memory rolling buffer updated for the active session. */
1511
+ working: boolean;
1512
+ /** Per-turn dense vector indexed for hybrid recall (Atlas $vectorSearch). */
1513
+ vector: boolean;
1514
+ /**
1515
+ * Durable facts extracted by the first-party graph layer
1516
+ * (gemini-3.1-flash-lite-preview → Voyage embeddings → `source: "fact"`
1517
+ * vectors). True if at least one fact was indexed or an existing
1518
+ * fact's accessCount was bumped.
1519
+ */
1520
+ graph: boolean;
1521
+ };
1522
+ }
1523
+ export interface AgentMemoryRememberResponse {
1524
+ loop: AgentMemoryLoopEnvelope<"remember">;
1525
+ success: boolean;
1526
+ graphSaved: boolean;
1527
+ vectorSaved: boolean;
1528
+ vectorId?: string;
1529
+ memory?: {
1530
+ id?: string;
1531
+ text: string;
1532
+ type: string;
1533
+ retention?: string;
1534
+ confidence?: number;
1535
+ status: "active";
1536
+ };
1537
+ }
1538
+ export type AgentMemoryLoopResponse = AgentMemoryContextResponse | AgentMemoryRecordTurnResponse | AgentMemoryRememberResponse;
1539
+ export interface LayeredSearchParams extends AgentMemoryScopeInput {
1540
+ query: string;
1541
+ layers?: AgentMemoryLayer[];
1542
+ limit?: number;
1543
+ }
1544
+ export interface LayeredSearchResult {
1545
+ query: string;
1546
+ layers: Record<string, unknown[]>;
1547
+ totals: Record<string, number>;
1548
+ }
1549
+ export type MemorySource = "session" | "knowledge" | "pattern" | "archive" | "fact";
1550
+ export interface SearchResult {
1551
+ id: string;
1552
+ vectorId?: string;
1553
+ content: string;
1554
+ score?: number;
1555
+ source: MemorySource;
1556
+ agentWallet: string;
1557
+ userAddress?: string;
1558
+ threadId?: string;
1559
+ mode?: "global" | "local";
1560
+ haiId?: string;
1561
+ decayScore?: number;
1562
+ accessCount?: number;
1563
+ createdAt?: number;
1564
+ }
1565
+ export interface MemoryVector {
1566
+ vectorId: string;
1567
+ id?: string;
1568
+ content: string;
1569
+ embedding?: number[];
1570
+ score?: number;
1571
+ source: MemorySource;
1572
+ agentWallet: string;
1573
+ userAddress?: string;
1574
+ threadId?: string;
1575
+ mode?: "global" | "local";
1576
+ haiId?: string;
1577
+ scopeKind?: "global" | "local";
1578
+ scopeId?: string;
1579
+ decayScore: number;
1580
+ accessCount: number;
1581
+ createdAt: number;
1582
+ lastAccessedAt: number;
1583
+ updatedAt?: number;
1584
+ metadata?: Record<string, unknown>;
1585
+ }
1586
+ export interface MemoryItemQuery {
1587
+ agentWallet?: string;
1588
+ userAddress?: string;
1589
+ }
1590
+ export interface MemoryItemUpdateParams extends MemoryItemQuery {
1591
+ threadId?: string;
1592
+ content?: string;
1593
+ metadata?: Record<string, unknown>;
1594
+ retention?: string;
1595
+ confidence?: number;
1596
+ status?: "active" | "superseded" | "archived";
1597
+ filters?: Record<string, unknown>;
1598
+ }
1599
+ export interface MemoryItemDeleteParams extends MemoryItemQuery {
1600
+ hardDelete?: boolean;
1601
+ }
1602
+ export interface MemoryJobCreateParams {
1603
+ type: "consolidate" | "patterns_extract" | "archive_create" | "decay_update" | "cleanup";
1604
+ execution?: "inline" | "temporal";
1605
+ agentWallet?: string;
1606
+ agentWallets?: string[];
1607
+ timeRange?: {
1608
+ start: number;
1609
+ end: number;
1610
+ };
1611
+ dateRange?: {
1612
+ start: number;
1613
+ end: number;
1614
+ };
1615
+ confidenceThreshold?: number;
1616
+ batchSize?: number;
1617
+ halfLifeDays?: number;
1618
+ olderThanDays?: number;
1619
+ compress?: boolean;
1620
+ syncToIpfs?: boolean;
1621
+ }
1622
+ export interface MemoryJobRecord {
1623
+ jobId: string;
1624
+ type: MemoryJobCreateParams["type"];
1625
+ execution: "inline" | "temporal";
1626
+ status: "running" | "completed" | "failed";
1627
+ agentWallet?: string;
1628
+ temporalWorkflowId?: string;
1629
+ temporalRunId?: string;
1630
+ data?: unknown;
1631
+ error?: string;
1632
+ createdAt: number;
1633
+ completedAt?: number;
1634
+ }
1635
+ export interface MemoryEvalRunParams extends AgentMemoryScopeInput {
1636
+ layers?: AgentMemoryLayer[];
1637
+ testCases: Array<{
1638
+ query: string;
1639
+ expected?: string;
1640
+ expectedMemoryId?: string;
1641
+ }>;
1642
+ }
1643
+ export interface MemoryEvalRunResponse {
1644
+ evalRunId: string;
1645
+ status: "completed";
1646
+ scores: {
1647
+ recallAtK: number;
1648
+ precisionAtK: number;
1649
+ avgContextCharacters: number;
1650
+ cases: number;
1651
+ };
1652
+ avgSearchLatencyMs: number;
1653
+ results: Array<{
1654
+ query: string;
1655
+ hit: boolean;
1656
+ returned: number;
1657
+ contextCharacters: number;
1658
+ }>;
1659
+ }
1660
+ export interface MemoryLoopStepManifest {
1661
+ operationId: string;
1662
+ method: "GET" | "POST" | "PATCH" | "DELETE";
1663
+ path: string;
1664
+ purpose?: string;
1665
+ }
1666
+ export interface MemoryLoopManifest {
1667
+ id: string;
1668
+ version: "compose.agent_memory_loop.v1";
1669
+ description: string;
1670
+ loop?: "hot" | "durable" | "maintenance";
1671
+ tokenPolicy?: "returns compact prompt only" | "returns metadata only";
1672
+ steps: MemoryLoopStepManifest[];
1673
+ }
1674
+ export interface ProceduralPattern {
1675
+ patternId: string;
1676
+ agentWallet: string;
1677
+ mode?: "global" | "local";
1678
+ haiId?: string;
1679
+ patternType?: "routine" | "decision" | "response" | "tool_sequence";
1680
+ trigger?: {
1681
+ type: string;
1682
+ value: string;
1683
+ conditions?: Record<string, unknown>;
1684
+ };
1685
+ steps?: Array<{
1686
+ action: string;
1687
+ params?: Record<string, unknown>;
1688
+ expectedOutcome?: string;
1689
+ order: number;
1690
+ }>;
1691
+ summary: string;
1692
+ successRate?: number;
1693
+ executionCount?: number;
1694
+ lastExecuted?: number;
1695
+ metadata?: Record<string, unknown>;
1696
+ createdAt?: number;
1697
+ updatedAt?: number;
1698
+ }
1699
+ export interface LearnedSkill {
1700
+ skillId: string;
1701
+ name: string;
1702
+ description: string;
1703
+ category: string;
1704
+ trigger?: Record<string, unknown>;
1705
+ spawnConfig?: Record<string, unknown>;
1706
+ successRate?: number;
1707
+ usageCount?: number;
1708
+ creator?: string;
1709
+ agents?: string[];
1710
+ tags?: string[];
1711
+ createdAt?: number;
1712
+ updatedAt?: number;
1713
+ }
1714
+ export interface MemoryPatternValidation {
1715
+ valid: boolean;
1716
+ confidence: number;
1717
+ occurrences: number;
1718
+ successRate: number;
1719
+ toolSequence: string[];
1720
+ }
1721
+ export interface MemoryScheduleStatus {
1722
+ scheduleId: string;
1723
+ paused: boolean;
1724
+ lastRunAt?: number;
1725
+ nextRunAt?: number;
1726
+ note?: string;
1727
+ }
1728
+ export interface SessionMemory {
1729
+ sessionId: string;
1730
+ agentWallet: string;
1731
+ userAddress?: string;
1732
+ threadId?: string;
1733
+ mode?: "global" | "local";
1734
+ haiId?: string;
1735
+ workingMemory: {
1736
+ context: string[];
1737
+ entities: Record<string, unknown>;
1738
+ state: Record<string, unknown>;
1739
+ };
1740
+ metadata?: Record<string, unknown>;
1741
+ compressed: boolean;
1742
+ createdAt: number;
1743
+ expiresAt: number;
1744
+ lastAccessedAt: number;
1745
+ }
1746
+ export interface RealtimeSessionConfig {
1747
+ readonly modalities: ReadonlyArray<"text" | "audio">;
1748
+ readonly instructions?: string;
1749
+ readonly voice?: string;
1750
+ readonly inputAudioFormat?: string;
1751
+ readonly outputAudioFormat?: string;
1752
+ readonly turnDetection?: {
1753
+ readonly type: "server_vad" | "none";
1754
+ readonly threshold?: number;
1755
+ readonly silenceDurationMs?: number;
1756
+ };
1757
+ readonly tools?: ToolDefinition[];
1758
+ readonly toolChoice?: "auto" | "none" | "required" | {
1759
+ readonly type: "tool";
1760
+ readonly toolName: string;
1761
+ } | any;
1762
+ readonly temperature?: number;
1763
+ readonly maxOutputTokens?: number | "inf";
1764
+ }
1765
+ export interface RealtimeResponseConfig {
1766
+ readonly modalities?: ReadonlyArray<"text" | "audio">;
1767
+ readonly instructions?: string;
1768
+ readonly voice?: string;
1769
+ readonly outputAudioFormat?: string;
1770
+ readonly tools?: ToolDefinition[];
1771
+ readonly toolChoice?: RealtimeSessionConfig["toolChoice"];
1772
+ readonly temperature?: number;
1773
+ readonly maxOutputTokens?: number | "inf";
1774
+ }
1775
+ export type RealtimeClientEvent = {
1776
+ readonly type: "session.update";
1777
+ readonly session: Partial<RealtimeSessionConfig>;
1778
+ } | {
1779
+ readonly type: "input_audio_buffer.append";
1780
+ readonly audio: Uint8Array | string;
1781
+ } | {
1782
+ readonly type: "input_audio_buffer.commit";
1783
+ } | {
1784
+ readonly type: "input_audio_buffer.clear";
1785
+ } | {
1786
+ readonly type: "conversation.item.create";
1787
+ readonly item: any;
1788
+ } | {
1789
+ readonly type: "conversation.item.delete";
1790
+ readonly itemId: string;
1791
+ } | {
1792
+ readonly type: "response.create";
1793
+ readonly response?: Partial<RealtimeResponseConfig>;
1794
+ } | {
1795
+ readonly type: "response.cancel";
1796
+ };
1797
+ export type RealtimeServerEvent = {
1798
+ readonly type: "session.created";
1799
+ readonly sessionId: string;
1800
+ readonly modelId: string;
1801
+ } | {
1802
+ readonly type: "session.updated";
1803
+ readonly session: RealtimeSessionConfig;
1804
+ } | {
1805
+ readonly type: "input_audio_buffer.speech_started";
1806
+ } | {
1807
+ readonly type: "input_audio_buffer.speech_stopped";
1808
+ } | {
1809
+ readonly type: "input_audio_buffer.committed";
1810
+ readonly itemId: string;
1811
+ } | {
1812
+ readonly type: "conversation.item.created";
1813
+ readonly itemId: string;
1814
+ } | {
1815
+ readonly type: "response.created";
1816
+ readonly responseId: string;
1817
+ } | {
1818
+ readonly type: "response.audio.delta";
1819
+ readonly responseId: string;
1820
+ readonly audio: Uint8Array | string;
1821
+ } | {
1822
+ readonly type: "response.audio.done";
1823
+ readonly responseId: string;
1824
+ } | {
1825
+ readonly type: "response.text.delta";
1826
+ readonly responseId: string;
1827
+ readonly text: string;
1828
+ } | {
1829
+ readonly type: "response.text.done";
1830
+ readonly responseId: string;
1831
+ readonly text: string;
1832
+ } | {
1833
+ readonly type: "response.tool_call";
1834
+ readonly responseId: string;
1835
+ readonly id: string;
1836
+ readonly name: string;
1837
+ readonly arguments: string;
1838
+ } | {
1839
+ readonly type: "response.done";
1840
+ readonly responseId: string;
1841
+ readonly usage: any;
1842
+ } | {
1843
+ readonly type: "error";
1844
+ readonly error: any;
1845
+ };
1846
+ export interface RealtimeRequest {
1847
+ model: string;
1848
+ input?: unknown;
1849
+ instructions?: string;
1850
+ customParams?: Record<string, unknown>;
1851
+ }
1852
+ export interface RealtimeSession {
1853
+ readonly id: string;
1854
+ readonly modelId: string;
1855
+ send(event: RealtimeClientEvent): void;
1856
+ readonly events: AsyncIterableIterator<RealtimeServerEvent>;
1857
+ close(): Promise<void>;
1858
+ }
1859
+ //# sourceMappingURL=index.d.ts.map