@muxoai/platform 1.3.3 → 1.4.1

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 (54) hide show
  1. package/.agents/plugins/marketplace.json +2 -2
  2. package/.claude-plugin/marketplace.json +2 -2
  3. package/ARCHITECTURE.md +16 -6
  4. package/README.md +7 -5
  5. package/dist/cli.js +393 -13
  6. package/dist/composio-catalog.d.ts +58 -0
  7. package/dist/composio-catalog.js +474 -0
  8. package/dist/config.d.ts +10 -0
  9. package/dist/config.js +16 -0
  10. package/dist/durable-workflow.d.ts +45 -0
  11. package/dist/durable-workflow.js +90 -0
  12. package/dist/engine.d.ts +276 -5
  13. package/dist/engine.js +1261 -71
  14. package/dist/mcp-schema.d.ts +125 -0
  15. package/dist/mcp-schema.js +1076 -0
  16. package/dist/mcp.d.ts +2 -30
  17. package/dist/mcp.js +505 -539
  18. package/dist/memory-graph.d.ts +21 -0
  19. package/dist/memory-graph.js +173 -0
  20. package/dist/nl.js +155 -0
  21. package/dist/oauth.d.ts +32 -0
  22. package/dist/oauth.js +134 -0
  23. package/dist/policy.d.ts +75 -1
  24. package/dist/policy.js +1119 -0
  25. package/dist/providers/composio-instant.js +225 -5
  26. package/dist/providers/composio-sdk.d.ts +68 -5
  27. package/dist/providers/composio-sdk.js +683 -78
  28. package/dist/providers/microsoft-governance.d.ts +28 -1
  29. package/dist/providers/microsoft-governance.js +224 -11
  30. package/dist/providers/stripe-billing.d.ts +42 -0
  31. package/dist/providers/stripe-billing.js +230 -1
  32. package/dist/providers/stripe-projects.d.ts +451 -3
  33. package/dist/providers/stripe-projects.js +2106 -87
  34. package/dist/providers/supermemory.d.ts +74 -1
  35. package/dist/providers/supermemory.js +426 -0
  36. package/dist/provisioning-managed.d.ts +50 -0
  37. package/dist/provisioning-managed.js +155 -0
  38. package/dist/sdk.d.ts +538 -8
  39. package/dist/sdk.js +377 -10
  40. package/dist/server.js +1841 -232
  41. package/dist/store.d.ts +113 -6
  42. package/dist/store.js +675 -52
  43. package/dist/types.d.ts +212 -5
  44. package/dist/ui/console-html.d.ts +10 -1
  45. package/dist/ui/console-html.js +1188 -462
  46. package/dist/version.d.ts +1 -1
  47. package/dist/version.js +1 -1
  48. package/package.json +2 -2
  49. package/plugins/muxo/.claude-plugin/plugin.json +1 -1
  50. package/plugins/muxo/.codex-plugin/plugin.json +1 -1
  51. package/plugins/muxo/plugin.json +2 -2
  52. package/plugins/muxo/skills/muxo/SKILL.md +42 -1
  53. package/plugins/muxo/skills/muxo/references/mcp.md +3 -2
  54. package/plugins/muxo/skills/setup/SKILL.md +8 -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
  }
@@ -135,12 +153,26 @@ export class MuxoClient {
135
153
  body: params,
136
154
  });
137
155
  }
138
- async getPlan(planId) {
139
- return this.request(`/api/v1/plans/${encodeURIComponent(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
+ });
140
171
  }
141
- async approvePlan(planId) {
172
+ async approvePlan(planId, decision = "approved") {
142
173
  return this.request(`/api/v1/plans/${encodeURIComponent(planId)}/approve`, {
143
174
  method: "POST",
175
+ body: { decision },
144
176
  });
145
177
  }
146
178
  async executePlan(planId) {
@@ -166,8 +198,21 @@ export class MuxoClient {
166
198
  });
167
199
  let plan = planned.plan;
168
200
  if (plan.approvalStatus === "pending_approval" && options.approve) {
169
- const approved = await this.approvePlan(plan.id);
170
- 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
+ }
171
216
  }
172
217
  const executed = await this.executePlan(plan.id);
173
218
  return {
@@ -188,8 +233,17 @@ export class MuxoClient {
188
233
  valid: isOk,
189
234
  verified: isOk,
190
235
  receipt: res.receipt,
236
+ agenticReceiptValid: res.agenticReceiptValid,
237
+ explanation: res.explanation,
191
238
  };
192
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
+ }
193
247
  async startConnection(paramsOrProvider) {
194
248
  const body = typeof paramsOrProvider === "string"
195
249
  ? { provider: paramsOrProvider }
@@ -308,6 +362,24 @@ export class MuxoClient {
308
362
  async getGovernanceStatus() {
309
363
  return this.request("/api/v1/governance");
310
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
+ }
311
383
  async setKillSwitch(action, reason) {
312
384
  return this.request("/api/v1/governance/kill-switch", {
313
385
  method: "POST",
@@ -329,6 +401,22 @@ export class MuxoClient {
329
401
  body: policy,
330
402
  });
331
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
+ }
332
420
  async do(prompt, options = {}) {
333
421
  const isDryRun = options.dryRun === true || options.planOnly === true;
334
422
  return this.request("/api/v1/do", {
@@ -360,16 +448,50 @@ export class MuxoClient {
360
448
  method: "DELETE",
361
449
  });
362
450
  }
363
- async upgradePlan() {
364
- 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", {
365
484
  method: "POST",
366
485
  body: {},
367
486
  });
368
487
  }
369
- async createCheckoutSession(kind = "credit_topup", credits) {
488
+ async createCheckoutSession(kind = "credit_topup", optionsOrCredits) {
489
+ const opts = typeof optionsOrCredits === "number"
490
+ ? { credits: optionsOrCredits }
491
+ : optionsOrCredits || {};
370
492
  return this.request("/api/v1/billing/checkout", {
371
493
  method: "POST",
372
- body: credits === undefined ? { kind } : { kind, credits },
494
+ body: { kind, ...opts },
373
495
  });
374
496
  }
375
497
  async verifyCheckoutSession(sessionId) {
@@ -378,4 +500,249 @@ export class MuxoClient {
378
500
  body: { sessionId },
379
501
  });
380
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
+ }
381
748
  }