@muxoai/sdk 1.3.0 → 1.4.2

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 (72) hide show
  1. package/.agents/plugins/marketplace.json +2 -2
  2. package/.claude-plugin/marketplace.json +19 -4
  3. package/.codex/config.toml +9 -2
  4. package/ARCHITECTURE.md +16 -6
  5. package/README.md +69 -24
  6. package/dist/clerk.d.ts +35 -0
  7. package/dist/clerk.js +201 -0
  8. package/dist/cli.js +1589 -103
  9. package/dist/composio-catalog.d.ts +234 -0
  10. package/dist/composio-catalog.js +1894 -0
  11. package/dist/config.d.ts +16 -0
  12. package/dist/config.js +27 -1
  13. package/dist/durable-workflow.d.ts +45 -0
  14. package/dist/durable-workflow.js +90 -0
  15. package/dist/engine.d.ts +315 -6
  16. package/dist/engine.js +1778 -94
  17. package/dist/mcp-schema.d.ts +286 -0
  18. package/dist/mcp-schema.js +2559 -0
  19. package/dist/mcp.d.ts +2 -25
  20. package/dist/mcp.js +949 -507
  21. package/dist/memory-graph.d.ts +21 -0
  22. package/dist/memory-graph.js +173 -0
  23. package/dist/nl.js +214 -35
  24. package/dist/oauth.d.ts +32 -0
  25. package/dist/oauth.js +134 -0
  26. package/dist/policy.d.ts +190 -0
  27. package/dist/policy.js +1597 -0
  28. package/dist/providers/composio-instant.d.ts +4 -0
  29. package/dist/providers/composio-instant.js +890 -535
  30. package/dist/providers/composio-sdk.d.ts +126 -5
  31. package/dist/providers/composio-sdk.js +902 -79
  32. package/dist/providers/microsoft-governance.d.ts +89 -3
  33. package/dist/providers/microsoft-governance.js +673 -26
  34. package/dist/providers/stripe-billing.d.ts +42 -0
  35. package/dist/providers/stripe-billing.js +244 -5
  36. package/dist/providers/stripe-projects.d.ts +459 -4
  37. package/dist/providers/stripe-projects.js +2674 -122
  38. package/dist/providers/supermemory.d.ts +102 -6
  39. package/dist/providers/supermemory.js +609 -55
  40. package/dist/provisioning-managed.d.ts +50 -0
  41. package/dist/provisioning-managed.js +155 -0
  42. package/dist/sdk.d.ts +705 -7
  43. package/dist/sdk.js +488 -10
  44. package/dist/server.js +2646 -348
  45. package/dist/store.d.ts +138 -6
  46. package/dist/store.js +932 -58
  47. package/dist/types.d.ts +312 -4
  48. package/dist/ui/console-html.d.ts +62 -0
  49. package/dist/ui/console-html.js +3742 -2228
  50. package/dist/ui/design-tokens.d.ts +177 -0
  51. package/dist/ui/design-tokens.js +210 -0
  52. package/dist/version.d.ts +1 -0
  53. package/dist/version.js +1 -0
  54. package/package.json +5 -4
  55. package/plugins/muxo/.app.json +1 -1
  56. package/plugins/muxo/.claude-plugin/plugin.json +3 -3
  57. package/plugins/muxo/.codex-plugin/plugin.json +19 -10
  58. package/plugins/muxo/.cursor-plugin/plugin.json +30 -0
  59. package/plugins/muxo/.mcp.json +1 -33
  60. package/plugins/muxo/assets/logo.png +0 -0
  61. package/plugins/muxo/hooks/session-start.sh +16 -4
  62. package/plugins/muxo/hooks/user-prompt-submit.sh +14 -1
  63. package/plugins/muxo/mcp.json +0 -10
  64. package/plugins/muxo/plugin.json +65 -8
  65. package/plugins/muxo/skills/muxo/SKILL.md +142 -14
  66. package/plugins/muxo/skills/muxo/agents/openai.yaml +12 -0
  67. package/plugins/muxo/skills/muxo/references/cli.md +9 -3
  68. package/plugins/muxo/skills/muxo/references/mcp.md +22 -10
  69. package/plugins/muxo/skills/muxo-activity-summary/SKILL.md +81 -0
  70. package/plugins/muxo/skills/setup/SKILL.md +17 -3
  71. package/plugins/muxo/skills/setup/agents/openai.yaml +12 -0
  72. package/src/catalogues/stripe-projects-catalog.json +140 -0
package/dist/sdk.js CHANGED
@@ -1,3 +1,21 @@
1
+ /** Error thrown for any non-OK Muxo API response. Carries the machine-readable code and payload. */
2
+ export class MuxoApiError extends Error {
3
+ status;
4
+ code;
5
+ url;
6
+ checkoutUrl;
7
+ data;
8
+ constructor(status, payload) {
9
+ super(String(payload.error || `Muxo request failed with HTTP ${status}`));
10
+ this.name = "MuxoApiError";
11
+ this.status = status;
12
+ this.code = typeof payload.code === "string" ? payload.code : undefined;
13
+ this.url = typeof payload.url === "string" ? payload.url : undefined;
14
+ this.checkoutUrl =
15
+ typeof payload.checkoutUrl === "string" ? payload.checkoutUrl : undefined;
16
+ this.data = payload;
17
+ }
18
+ }
1
19
  export class MuxoClient {
2
20
  baseUrl;
3
21
  apiKeyResolver;
@@ -41,7 +59,7 @@ export class MuxoClient {
41
59
  });
42
60
  const payload = (await res.json());
43
61
  if (!res.ok || payload.ok === false) {
44
- throw new Error(String(payload.error || `Muxo request failed with HTTP ${res.status}`));
62
+ throw new MuxoApiError(res.status, payload);
45
63
  }
46
64
  return payload;
47
65
  }
@@ -52,6 +70,26 @@ export class MuxoClient {
52
70
  harness: params.harness || "muxo-sdk",
53
71
  });
54
72
  }
73
+ static async register(params, baseUrl = "https://app.muxo.ai") {
74
+ const client = new MuxoClient({ baseUrl });
75
+ return client.register(params);
76
+ }
77
+ static async login(params, baseUrl = "https://app.muxo.ai") {
78
+ const client = new MuxoClient({ baseUrl });
79
+ return client.login(params);
80
+ }
81
+ async register(params) {
82
+ return this.request("/api/v1/auth/register", {
83
+ method: "POST",
84
+ body: params,
85
+ });
86
+ }
87
+ async login(params) {
88
+ return this.request("/api/v1/auth/login", {
89
+ method: "POST",
90
+ body: params,
91
+ });
92
+ }
55
93
  async signupAgent(params) {
56
94
  return this.request("/api/v1/agents/signup", {
57
95
  method: "POST",
@@ -80,6 +118,10 @@ export class MuxoClient {
80
118
  if (rpcRes.error) {
81
119
  throw new Error(rpcRes.error.message || "MCP call failed");
82
120
  }
121
+ if (rpcRes.result?.isError) {
122
+ const errObj = rpcRes.result.structuredContent;
123
+ throw new Error(String(errObj?.error || rpcRes.result.content?.[0]?.text || "MCP tool execution failed"));
124
+ }
83
125
  if (rpcRes.result?.structuredContent) {
84
126
  return rpcRes.result.structuredContent;
85
127
  }
@@ -111,9 +153,26 @@ export class MuxoClient {
111
153
  body: params,
112
154
  });
113
155
  }
114
- async approvePlan(planId) {
156
+ async getPlan(planId, options) {
157
+ const qs = new URLSearchParams();
158
+ if (options?.waitForApproval)
159
+ qs.set("wait_for_approval", "true");
160
+ if (options?.timeoutSeconds !== undefined) {
161
+ qs.set("timeout_seconds", String(options.timeoutSeconds));
162
+ }
163
+ const suffix = qs.toString() ? `?${qs.toString()}` : "";
164
+ return this.request(`/api/v1/plans/${encodeURIComponent(planId)}${suffix}`);
165
+ }
166
+ async waitForPlanApproval(planId, timeoutSeconds = 25) {
167
+ return this.request(`/api/v1/plans/${encodeURIComponent(planId)}/wait`, {
168
+ method: "POST",
169
+ body: { timeoutSeconds },
170
+ });
171
+ }
172
+ async approvePlan(planId, decision = "approved") {
115
173
  return this.request(`/api/v1/plans/${encodeURIComponent(planId)}/approve`, {
116
174
  method: "POST",
175
+ body: { decision },
117
176
  });
118
177
  }
119
178
  async executePlan(planId) {
@@ -121,16 +180,39 @@ export class MuxoClient {
121
180
  method: "POST",
122
181
  });
123
182
  }
183
+ async getRun(runId) {
184
+ return this.request(`/api/v1/runs/${encodeURIComponent(runId)}`);
185
+ }
186
+ async cancelRun(runId, reason) {
187
+ return this.request(`/api/v1/runs/${encodeURIComponent(runId)}/cancel`, {
188
+ method: "POST",
189
+ body: reason ? { reason } : {},
190
+ });
191
+ }
124
192
  async exec(toolSlug, input = {}, options = {}) {
125
193
  const planned = await this.planAction({
126
194
  toolSlug,
127
195
  input,
128
196
  reason: options.reason,
197
+ fundingMode: options.fundingMode,
129
198
  });
130
199
  let plan = planned.plan;
131
200
  if (plan.approvalStatus === "pending_approval" && options.approve) {
132
- const approved = await this.approvePlan(plan.id);
133
- plan = approved.plan;
201
+ try {
202
+ const approved = await this.approvePlan(plan.id);
203
+ plan = approved.plan;
204
+ }
205
+ catch (err) {
206
+ if (err instanceof MuxoApiError && err.code === "human_required") {
207
+ throw new MuxoApiError(err.status, {
208
+ ...err.data,
209
+ planId: plan.id,
210
+ approvalUrl: err.url,
211
+ error: `Plan ${plan.id} needs approval from a signed-in person at ${err.url || "the Muxo console"}; API keys cannot approve plans.`,
212
+ });
213
+ }
214
+ throw err;
215
+ }
134
216
  }
135
217
  const executed = await this.executePlan(plan.id);
136
218
  return {
@@ -151,8 +233,17 @@ export class MuxoClient {
151
233
  valid: isOk,
152
234
  verified: isOk,
153
235
  receipt: res.receipt,
236
+ agenticReceiptValid: res.agenticReceiptValid,
237
+ explanation: res.explanation,
154
238
  };
155
239
  }
240
+ async verifyReceiptChain(limit = 100) {
241
+ return this.request(`/api/v1/receipts/verify-chain?limit=${encodeURIComponent(String(limit))}`);
242
+ }
243
+ async getMemoryGraph(query) {
244
+ const suffix = query ? `?query=${encodeURIComponent(query)}` : "";
245
+ return this.request(`/api/v1/memory/graph${suffix}`);
246
+ }
156
247
  async startConnection(paramsOrProvider) {
157
248
  const body = typeof paramsOrProvider === "string"
158
249
  ? { provider: paramsOrProvider }
@@ -199,7 +290,13 @@ export class MuxoClient {
199
290
  };
200
291
  }
201
292
  async getBillingStatus() {
202
- return this.getSettlements();
293
+ const res = await this.request("/api/v1/billing/status");
294
+ if (res.settlementSummary &&
295
+ res.settlementSummary.totalCustomerChargedCredits === undefined) {
296
+ res.settlementSummary.totalCustomerChargedCredits =
297
+ res.settlementSummary.totalCreditsConsumed;
298
+ }
299
+ return res;
203
300
  }
204
301
  async settlements() {
205
302
  const res = await this.getSettlements();
@@ -221,14 +318,116 @@ export class MuxoClient {
221
318
  const suffix = query ? `?query=${encodeURIComponent(query)}` : "";
222
319
  return this.request(`/api/v1/memory${suffix}`);
223
320
  }
321
+ async addMemory(paramsOrContent) {
322
+ const body = typeof paramsOrContent === "string"
323
+ ? { title: paramsOrContent.slice(0, 60), content: paramsOrContent }
324
+ : paramsOrContent;
325
+ return this.request("/api/v1/memory", {
326
+ method: "POST",
327
+ body,
328
+ });
329
+ }
330
+ async deleteMemory(id) {
331
+ return this.request(`/api/v1/memory/${encodeURIComponent(id)}`, {
332
+ method: "DELETE",
333
+ });
334
+ }
335
+ async getMemoryFacts(options = {}) {
336
+ const opts = typeof options === "boolean" ? { includeHistorical: options } : options;
337
+ const params = new URLSearchParams();
338
+ params.set("historical", opts.includeHistorical === false ? "false" : "true");
339
+ if (opts.query)
340
+ params.set("query", opts.query);
341
+ if (opts.subject)
342
+ params.set("subject", opts.subject);
343
+ if (opts.predicate)
344
+ params.set("predicate", opts.predicate);
345
+ if (opts.limit)
346
+ params.set("limit", String(opts.limit));
347
+ return this.request(`/api/v1/memory/facts?${params.toString()}`);
348
+ }
349
+ async listTemporalFacts(options) {
350
+ return this.getMemoryFacts(options);
351
+ }
352
+ async forgetMemory(queryOrParams) {
353
+ const query = (typeof queryOrParams === "string" ? queryOrParams : queryOrParams.query)?.trim();
354
+ if (!query) {
355
+ throw new Error("forgetMemory requires a non-empty query");
356
+ }
357
+ return this.request("/api/v1/memory/forget", {
358
+ method: "POST",
359
+ body: { query },
360
+ });
361
+ }
362
+ async getGovernanceStatus() {
363
+ return this.request("/api/v1/governance");
364
+ }
365
+ async getGuardrails() {
366
+ return this.request("/api/v1/guardrails");
367
+ }
368
+ async setGuardrail(promptOrParams) {
369
+ const prompt = typeof promptOrParams === "string"
370
+ ? promptOrParams
371
+ : promptOrParams.prompt;
372
+ return this.request("/api/v1/guardrails", {
373
+ method: "POST",
374
+ body: { prompt },
375
+ });
376
+ }
377
+ async resetGuardrails() {
378
+ return this.request("/api/v1/guardrails", {
379
+ method: "POST",
380
+ body: { reset: true },
381
+ });
382
+ }
383
+ async setKillSwitch(action, reason) {
384
+ return this.request("/api/v1/governance/kill-switch", {
385
+ method: "POST",
386
+ body: reason ? { action, reason } : { action },
387
+ });
388
+ }
389
+ async scanContext(contentOrParams) {
390
+ const body = typeof contentOrParams === "string"
391
+ ? { content: contentOrParams }
392
+ : contentOrParams;
393
+ return this.request("/api/v1/governance/scan-context", {
394
+ method: "POST",
395
+ body,
396
+ });
397
+ }
398
+ async updatePolicy(policy) {
399
+ return this.request("/api/v1/policy", {
400
+ method: "POST",
401
+ body: policy,
402
+ });
403
+ }
404
+ async getPolicy() {
405
+ return this.request("/api/v1/policy");
406
+ }
407
+ async getContext(query) {
408
+ const suffix = query ? `?query=${encodeURIComponent(query)}` : "";
409
+ return this.request(`/api/v1/context${suffix}`);
410
+ }
411
+ async listReceipts(limit = 25) {
412
+ return this.request(`/api/v1/receipts?limit=${encodeURIComponent(String(limit))}`);
413
+ }
414
+ async remember(instruction) {
415
+ return this.request("/api/v1/memory", {
416
+ method: "POST",
417
+ body: { prompt: instruction },
418
+ });
419
+ }
224
420
  async do(prompt, options = {}) {
421
+ const isDryRun = options.dryRun === true || options.planOnly === true;
225
422
  return this.request("/api/v1/do", {
226
423
  method: "POST",
227
424
  body: {
228
425
  prompt,
229
426
  input: options.input,
230
427
  autoApprove: options.autoApprove !== false,
231
- dryRun: options.dryRun === true,
428
+ dryRun: isDryRun,
429
+ planOnly: isDryRun,
430
+ fundingMode: options.fundingMode,
232
431
  },
233
432
  });
234
433
  }
@@ -249,16 +448,50 @@ export class MuxoClient {
249
448
  method: "DELETE",
250
449
  });
251
450
  }
252
- async upgradePlan() {
253
- return this.request("/api/v1/billing/upgrade", {
451
+ /** Lists plans, prices, and credit packs. No auth required. */
452
+ async getPlans() {
453
+ return this.request("/api/v1/billing/plans");
454
+ }
455
+ /**
456
+ * Moves the workspace to a plan. A first subscription returns a Stripe checkout URL
457
+ * (`payment_required`); changing an existing subscription returns a billing-portal URL.
458
+ * Plan changes are confirmed by a signed-in person; API keys get `human_required`.
459
+ */
460
+ async upgradePlan(options = {}) {
461
+ try {
462
+ return await this.request("/api/v1/billing/upgrade", {
463
+ method: "POST",
464
+ body: {
465
+ tier: options.tier || "starter",
466
+ interval: options.interval || "month",
467
+ },
468
+ });
469
+ }
470
+ catch (err) {
471
+ if (err instanceof MuxoApiError &&
472
+ (err.code === "payment_required" || err.code === "human_required")) {
473
+ return err.data;
474
+ }
475
+ throw err;
476
+ }
477
+ }
478
+ /**
479
+ * Opens the Stripe billing portal to manage payment details, switch plans, or cancel.
480
+ * Signed-in people only; API keys get a `human_required` MuxoApiError.
481
+ */
482
+ async openBillingPortal() {
483
+ return this.request("/api/v1/billing/portal", {
254
484
  method: "POST",
255
485
  body: {},
256
486
  });
257
487
  }
258
- async createCheckoutSession(kind = "credit_topup") {
488
+ async createCheckoutSession(kind = "credit_topup", optionsOrCredits) {
489
+ const opts = typeof optionsOrCredits === "number"
490
+ ? { credits: optionsOrCredits }
491
+ : optionsOrCredits || {};
259
492
  return this.request("/api/v1/billing/checkout", {
260
493
  method: "POST",
261
- body: { kind },
494
+ body: { kind, ...opts },
262
495
  });
263
496
  }
264
497
  async verifyCheckoutSession(sessionId) {
@@ -267,4 +500,249 @@ export class MuxoClient {
267
500
  body: { sessionId },
268
501
  });
269
502
  }
503
+ // Stripe v2 Provisioning API (`Stripe-Version: 2026-09-30.preview`) SDK Methods
504
+ async createProvisioningConnectedAccount(params) {
505
+ return this.request("/api/v1/provisioning/connected_accounts", {
506
+ method: "POST",
507
+ body: params || {},
508
+ });
509
+ }
510
+ async getProvisioningConnectedAccount(accountId) {
511
+ if (accountId) {
512
+ return this.request(`/api/v1/provisioning/connected_accounts/${encodeURIComponent(accountId)}`);
513
+ }
514
+ return this.request("/api/v1/provisioning/connected_accounts");
515
+ }
516
+ async createProvisioningConnectedAccountLink(params) {
517
+ return this.request("/api/v1/provisioning/connected_account_links", {
518
+ method: "POST",
519
+ body: params || {},
520
+ });
521
+ }
522
+ async createProvisioningConnectedAccountSession(params) {
523
+ return this.request("/api/v1/provisioning/connected_account_sessions", {
524
+ method: "POST",
525
+ body: params || {},
526
+ });
527
+ }
528
+ async checkProvisioningEligibility() {
529
+ return this.request("/api/v1/provisioning/eligibility");
530
+ }
531
+ async listProvisioningProviders(params) {
532
+ const qs = new URLSearchParams();
533
+ if (params?.catalog)
534
+ qs.set("catalog", params.catalog);
535
+ if (params?.limit)
536
+ qs.set("limit", String(params.limit));
537
+ if (params?.page)
538
+ qs.set("page", params.page);
539
+ const suffix = qs.toString() ? `?${qs.toString()}` : "";
540
+ return this.request(`/api/v1/provisioning/catalog/providers${suffix}`);
541
+ }
542
+ async listProvisioningServices(params) {
543
+ const qs = new URLSearchParams();
544
+ if (params?.catalog)
545
+ qs.set("catalog", params.catalog);
546
+ if (params?.provider_name)
547
+ qs.set("provider_name", params.provider_name);
548
+ if (params?.provider_id)
549
+ qs.set("provider_id", params.provider_id);
550
+ if (params?.limit)
551
+ qs.set("limit", String(params.limit));
552
+ if (params?.page)
553
+ qs.set("page", params.page);
554
+ const suffix = qs.toString() ? `?${qs.toString()}` : "";
555
+ return this.request(`/api/v1/provisioning/catalog/services${suffix}`);
556
+ }
557
+ async getProvisioningPaymentProfile(params) {
558
+ const qs = new URLSearchParams();
559
+ if (params?.provider)
560
+ qs.set("provider", params.provider);
561
+ if (params?.livemode !== undefined)
562
+ qs.set("livemode", String(params.livemode));
563
+ const suffix = qs.toString() ? `?${qs.toString()}` : "";
564
+ return this.request(`/api/v1/provisioning/payment_profile${suffix}`);
565
+ }
566
+ async createProvisioningPaymentMethodRequest(params) {
567
+ return this.request("/api/v1/provisioning/payment_method_requests", {
568
+ method: "POST",
569
+ body: params || {},
570
+ });
571
+ }
572
+ async listProvisioningProviderConnections(params) {
573
+ const qs = new URLSearchParams();
574
+ if (params?.provider)
575
+ qs.set("provider", params.provider);
576
+ if (params?.limit)
577
+ qs.set("limit", String(params.limit));
578
+ if (params?.page)
579
+ qs.set("page", params.page);
580
+ const suffix = qs.toString() ? `?${qs.toString()}` : "";
581
+ return this.request(`/api/v1/provisioning/provider_connections${suffix}`);
582
+ }
583
+ async createProvisioningProviderConnectionRequest(params) {
584
+ return this.request("/api/v1/provisioning/provider_connection_requests", {
585
+ method: "POST",
586
+ body: params,
587
+ });
588
+ }
589
+ async listProvisioningProjects(params) {
590
+ const qs = new URLSearchParams();
591
+ if (params?.limit)
592
+ qs.set("limit", String(params.limit));
593
+ if (params?.page)
594
+ qs.set("page", params.page);
595
+ const suffix = qs.toString() ? `?${qs.toString()}` : "";
596
+ return this.request(`/api/v1/provisioning/projects${suffix}`);
597
+ }
598
+ async createProvisioningProject(params) {
599
+ return this.request("/api/v1/provisioning/projects", {
600
+ method: "POST",
601
+ body: params,
602
+ });
603
+ }
604
+ async listProvisioningResources(params) {
605
+ const qs = new URLSearchParams();
606
+ if (params?.project)
607
+ qs.set("project", params.project);
608
+ if (params?.provider)
609
+ qs.set("provider", params.provider);
610
+ if (params?.limit)
611
+ qs.set("limit", String(params.limit));
612
+ if (params?.page)
613
+ qs.set("page", params.page);
614
+ const suffix = qs.toString() ? `?${qs.toString()}` : "";
615
+ return this.request(`/api/v1/provisioning/resources${suffix}`);
616
+ }
617
+ async createProvisioningResource(params) {
618
+ return this.request("/api/v1/provisioning/resources", {
619
+ method: "POST",
620
+ body: params,
621
+ });
622
+ }
623
+ async revealResourceAccessConfiguration(resourceId) {
624
+ return this.request(`/api/v1/provisioning/resources/${encodeURIComponent(resourceId)}/reveal_access_configuration`, {
625
+ method: "POST",
626
+ body: {},
627
+ });
628
+ }
629
+ async getResourceSecrets(resourceId) {
630
+ return this.request(`/api/v1/resources/${encodeURIComponent(resourceId)}/secrets`);
631
+ }
632
+ // ---------------------------------------------------------------------------
633
+ // Multi-Workspace & Team API Key Onboarding
634
+ // ---------------------------------------------------------------------------
635
+ async listWorkspaces() {
636
+ return this.request("/api/v1/workspaces");
637
+ }
638
+ async createWorkspace(params) {
639
+ return this.request("/api/v1/workspaces", {
640
+ method: "POST",
641
+ body: params,
642
+ });
643
+ }
644
+ async switchWorkspace(workspaceId) {
645
+ return this.request("/api/v1/workspaces/switch", {
646
+ method: "POST",
647
+ body: { workspaceId },
648
+ });
649
+ }
650
+ async joinWorkspaceWithApiKey(apiKey) {
651
+ return this.request("/api/v1/workspaces/join", {
652
+ method: "POST",
653
+ body: { apiKey },
654
+ });
655
+ }
656
+ async onboardTeam(params) {
657
+ return this.request("/api/v1/workspaces/onboard-team", {
658
+ method: "POST",
659
+ body: params,
660
+ });
661
+ }
662
+ // ---------------------------------------------------------------------------
663
+ // Stripe v2 Billing Meter Streams, Event Destinations, Composio Toolkits/Triggers, & Cloudflare Workflows
664
+ // ---------------------------------------------------------------------------
665
+ async updateProvisioningSpendLimit(params) {
666
+ return this.request("/api/v1/provisioning/payment_profile/update_limit", {
667
+ method: "POST",
668
+ body: {
669
+ usage_limits: {
670
+ max_amount: String(params.max_amount),
671
+ currency: params.currency || "usd",
672
+ recurring_interval: params.recurring_interval || "month",
673
+ },
674
+ provider: params.provider,
675
+ },
676
+ });
677
+ }
678
+ async createProvisioningEventDestination(params) {
679
+ return this.request("/api/v1/provisioning/event_destinations", {
680
+ method: "POST",
681
+ body: params,
682
+ });
683
+ }
684
+ async recordBillingMeterEvent(params) {
685
+ return this.request("/api/v1/billing/meter_events", {
686
+ method: "POST",
687
+ body: params,
688
+ });
689
+ }
690
+ async listBillingMeterEvents(limit = 50) {
691
+ return this.request(`/api/v1/billing/meter_events?limit=${limit}`);
692
+ }
693
+ async listToolkits(params) {
694
+ const qs = new URLSearchParams();
695
+ if (params?.category)
696
+ qs.set("category", params.category);
697
+ if (params?.search)
698
+ qs.set("search", params.search);
699
+ const suffix = qs.toString() ? `?${qs.toString()}` : "";
700
+ return this.request(`/api/v1/toolkits${suffix}`);
701
+ }
702
+ async createCustomAuthConfig(params) {
703
+ return this.request("/api/v1/connections/auth-configs", {
704
+ method: "POST",
705
+ body: params,
706
+ });
707
+ }
708
+ async listTriggers(provider) {
709
+ const suffix = provider ? `?provider=${encodeURIComponent(provider)}` : "";
710
+ return this.request(`/api/v1/triggers${suffix}`);
711
+ }
712
+ async enableTrigger(params) {
713
+ return this.request("/api/v1/triggers", {
714
+ method: "POST",
715
+ body: params,
716
+ });
717
+ }
718
+ async ingestTriggerWebhook(params) {
719
+ return this.request("/api/v1/triggers/webhook", {
720
+ method: "POST",
721
+ body: params,
722
+ });
723
+ }
724
+ async executeBatchPlans(params) {
725
+ return this.request("/api/v1/plans/batch", {
726
+ method: "POST",
727
+ body: params,
728
+ });
729
+ }
730
+ async searchMemoryHybrid(query, limit = 10) {
731
+ return this.request(`/api/v1/memory/hybrid?query=${encodeURIComponent(query)}&limit=${limit}`);
732
+ }
733
+ async startDurableWorkflow(params) {
734
+ return this.request("/api/v1/workflows", {
735
+ method: "POST",
736
+ body: params,
737
+ });
738
+ }
739
+ async advanceDurableWorkflow(workflowId, eventPayload) {
740
+ return this.request(`/api/v1/workflows/${encodeURIComponent(workflowId)}/advance`, {
741
+ method: "POST",
742
+ body: eventPayload || {},
743
+ });
744
+ }
745
+ async exportGovernanceArchive() {
746
+ return this.request("/api/v1/governance/archive");
747
+ }
270
748
  }