@muxoai/platform 1.4.0 → 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 +1 -1
  5. package/dist/cli.js +317 -10
  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 +440 -3
  39. package/dist/sdk.js +305 -3
  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 +192 -3
  44. package/dist/ui/console-html.d.ts +10 -1
  45. package/dist/ui/console-html.js +1082 -452
  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
@@ -6,8 +6,8 @@
6
6
  "plugins": [
7
7
  {
8
8
  "name": "muxo",
9
- "version": "1.3.1",
10
- "description": "Governed execution across 1,000+ Connected Apps, Instant Tools (search, scrape, crawl, SEO audit), Cloud Infrastructure provisioning, Supermemory v5 recall, and Microsoft Agent Governance Ed25519 receipts.",
9
+ "version": "1.4.1",
10
+ "description": "Governed execution across 1,000+ Connected Apps, Instant Tools (search, scrape, crawl, SEO audit), Cloud Infrastructure provisioning, Workspace Memory recall, and cryptographic execution receipts.",
11
11
  "source": {
12
12
  "source": "local",
13
13
  "path": "./plugins/muxo"
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "metadata": {
10
10
  "description": "Official Muxo plugin marketplace for governed execution across Connected Apps, Instant Tools, Cloud Infrastructure, and Workspace Memory.",
11
- "version": "1.3.1"
11
+ "version": "1.4.1"
12
12
  },
13
13
  "plugins": [
14
14
  {
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "strict": false,
21
21
  "description": "Governed execution across 1,000+ Connected Apps, Instant Tools (search, scrape, crawl, SEO audit), Cloud Infrastructure provisioning, Workspace Memory recall, and verifiable audit records.",
22
- "version": "1.3.1",
22
+ "version": "1.4.1",
23
23
  "category": "Productivity",
24
24
  "skills": [
25
25
  "./plugins/muxo/skills/muxo",
package/ARCHITECTURE.md CHANGED
@@ -42,7 +42,7 @@ Across `muxoai` (gen 1) and `muxo2` (gen 2, 203,443 LOC), the biggest mistake wa
42
42
  | :--- | :--- | :--- | :--- |
43
43
  | **Composio SDK & Tool Router** (`backend.composio.dev/api/v3`) | **ADOPT (Core Lane)** | Provides 500+ managed OAuth integrations (`app.*`), user-scoped Connect Links, and schema discovery without Muxo maintaining custom OAuth apps for every SaaS provider. | Replaces custom per-provider OAuth brokers and bespoke SaaS connectors. |
44
44
  | **Composio Instant & `agents.composio.dev` Pattern** | **ADOPT (Core Lane + Onboarding)** | 1) Zero-setup `instant.*` tools work immediately on workspace creation.<br>2) We adopt the **`agents.composio.dev` 2-call autonomous signup pattern** (`POST /api/v1/agents/signup` + `POST /api/v1/agents/claim`) so an agent can self-provision a Muxo workspace in one HTTP call and later hand ownership over to its human via a claim slug. | Replaces complex multi-step human-only bootstrap ceremonies for CLI/agent onboarding. |
45
- | **Stripe Projects CLI** (`stripe projects` v0.50.0) | **ADOPT (Core Lane — Node Runtime)** | Provisions real databases, caches, and cloud services (`neon/postgres`, `upstash/redis`, `turso`, `supabase`, `supermemory/memory`, etc.) and pulls credentials (`stripe projects env --pull`) into Muxo's AES-256-GCM vault. | Replaces `muxo2`'s broken 4-worker Cloudflare Container + mTLS bridge (`projects-gateway` + `projects-executor`). See Section 3 below. |
45
+ | **Stripe v2 Provisioning REST API & CLI** (`https://api.stripe.com/v2/provisioning/*`, `Stripe-Version: 2026-09-30.preview` + `stripe projects` v0.50.0) | **ADOPT (Core Lane — HTTP v2 + Node Runtime)** | Provisions real databases, caches, and cloud services (`neon/postgres`, `upstash/redis`, `turso`, `supabase`, `supermemory/memory`, etc.) directly over HTTP via `POST /v2/provisioning/resources` and reveals secrets via `POST /v2/provisioning/resources/:id/reveal_access_configuration` (with automatic CLI/managed fallback) into Muxo's AES-256-GCM vault. Works natively in both Node.js and Cloudflare Workers V8 isolates! | Replaces `muxo2`'s broken 4-worker Cloudflare Container + mTLS bridge (`projects-gateway` + `projects-executor`). See Section 3 below. |
46
46
  | **Microsoft Agent Governance Toolkit** (`@microsoft/agent-governance-sdk` v5.0.0) | **ADOPT (Core Governance)** | A 40 KB, zero-dependency, MIT-licensed SDK providing `McpSecurityScanner` (prompt-injection & exfiltration detection), `PolicyEngine` (YAML/JSON rules + risk gates), `AgentIdentity` (Ed25519 DIDs), and `AuditLogger` (SHA-256 tamper-evident hash chain). | Replaces **~18,000 LOC** of custom authority seals, custom policy DSLs, and hand-rolled audit chains in `muxo2`. |
47
47
  | **Supermemory v5** (`supermemory` `^5.0.1`) | **ADOPT (Fail-Open Contextual Brain)** | Gives every Muxo workspace an isolated `/ns/muxo-v5-{hash}` brain with automatic `static` + `dynamic` profiles (`client.profile`), sub-50ms hybrid search (`client.search`), and governed post-run memory (`client.add`). Also natively deployable via Stripe Projects (`supermemory/memory`)! | Replaces **~25,000 LOC** of `muxoai/packages/brain` + Python `context-engine` (Graphiti + Neo4j + Vectorize + D1). |
48
48
  | **Mastra (`@mastra/mcp`), Pi (`pi`), Vercel AI SDK (`ai`), Google ADK** | **CLIENT ECOSYSTEM (Do Not Bundle Inside Server)** | These are **agent harnesses** that *consume* Muxo over `/mcp` and `/skill.md`. Bundling an agent framework inside the Muxo server violates "Existing-Agent First" and bloats the runtime. Instead, `app.muxo.ai` and `muxo mcp-config` generate instant copy-paste connectors for Mastra, Pi, Vercel AI SDK, Claude Code, Cursor, and Factory Droid. | Drops `muxoai/packages/harness` (`@cloudflare/think` + custom chat UI) from the core execution server. |
@@ -58,11 +58,21 @@ In `muxo2` (`projects-production-completion-plan.md`), the runtime was built on
58
58
  1. `muxo2` tried to wrap the Stripe CLI inside a separate **Cloudflare Container (`apps/projects-executor`)** behind a second **Cloudflare Worker (`apps/projects-gateway`)** with custom CA fingerprint pinning, UID=0 root directory checks, and 55-second container cold-start budgets.
59
59
  2. Inside the container, the `stripe-projects-cli` plugin was invoked directly without `PROJECTS_STANDALONE=1` or exceeded container memory/startup deadlines, resulting in `SIGKILL` and 9 consumed diagnostic attempts.
60
60
 
61
- ### Why It Works 100% Live in `muxo3`
62
- In `muxo3` (`src/providers/stripe-projects.ts`):
63
- 1. **Native Node.js 22 Runtime:** `muxo3` runs as a standard Node.js 22 process (locally or in a standard persistent Linux container on Railway/Fly.io/Render) and invokes `/Users/test/.local/bin/stripe projects ... --json` directly via `node:child_process`.
64
- 2. **Automatic Companion Plan Resolution:** When a deployable service (like `neon/postgres`) returns `PLAN_REQUIRED`, `StripeProjectsAdapter.provisionResource()` automatically inspects the provider catalog, provisions the free/default plan (`neon/free`), and completes `neon/postgres` provisioning in one seamless transaction.
65
- 3. **Encrypted Vault Custody:** Immediately after provisioning, `StripeProjectsAdapter` runs `stripe projects env --pull`, captures the real credentials (e.g., `NEON_POSTGRES_CONNECTION_STRING`), encrypts them with **AES-256-GCM** using a per-workspace HKDF-derived key in `MuxoStore` (`src/store.ts`), and exposes them only via explicit owner-authenticated `muxo env pull` or `GET /api/v1/resources/env`.
61
+ ### Why It Works 100% Live in `muxo3` (Native Stripe v2 Provisioning HTTP API + CLI)
62
+ In `muxo3` (`src/providers/stripe-projects.ts` and `worker/index.ts`), we integrate Stripe's gated **v2 Provisioning REST API** (`https://api.stripe.com/v2/provisioning/*` with header `Stripe-Version: 2026-09-30.preview`) alongside the local CLI:
63
+ 1. **Direct Stripe v2 Provisioning HTTP REST Client (Zero Container Required, V8 Isolate Ready):** Both `StripeProjectsAdapter` (Node.js) and `worker/index.ts` (Cloudflare Workers) call Stripe's `/v2/provisioning/*` REST endpoints directly over HTTPS using `Authorization: Bearer <sk_live_...|rk_live_...>` and `Stripe-Version: 2026-09-30.preview`:
64
+ - **Eligibilities:** `GET /v2/provisioning/eligibility` (`v2.provisioning.eligibility`)
65
+ - **Catalog Providers:** `GET /v2/provisioning/catalog/providers` (`v2.provisioning.provider`)
66
+ - **Catalog Service Details:** `GET /v2/provisioning/catalog/services` (`v2.provisioning.provider_service_detail`)
67
+ - **Payment Profiles & Spend Limits:** `GET /v2/provisioning/payment_profile` & `POST /v2/provisioning/payment_profile/update_limit` (`v2.provisioning.payment_profile`)
68
+ - **Payment Method Requests:** `POST /v2/provisioning/payment_method_requests` (`v2.provisioning.payment_method_request`)
69
+ - **Projects:** `POST /v2/provisioning/projects` (`v2.provisioning.project`)
70
+ - **Provider Connections:** `GET /v2/provisioning/provider_connections` & `POST /v2/provisioning/provider_connections/:id/unlink` (`v2.provisioning.provider_connection`)
71
+ - **Provider Connection Requests:** `POST /v2/provisioning/provider_connection_requests`, `GET /v2/provisioning/provider_connection_requests/:id`, & `POST /v2/provisioning/provider_connection_requests/:id/submit_information` (`v2.provisioning.provider_connection_request`)
72
+ - **Resources:** `POST /v2/provisioning/resources`, `POST /v2/provisioning/resources/link`, `GET /v2/provisioning/resources/:id`, `POST /v2/provisioning/resources/:id`, `POST /v2/provisioning/resources/:id/remove`, `POST /v2/provisioning/resources/:id/unlink`, `POST /v2/provisioning/resources/:id/rotate_credentials`, & `POST /v2/provisioning/resources/:id/submit_information` (`v2.provisioning.resource`)
73
+ - **Access Configurations (Secret Reveal):** `POST /v2/provisioning/resources/:id/reveal_access_configuration` (`v2.provisioning.resource.access_configuration` returning `{ configuration: Record<string, string>, expires_at }`)
74
+ 2. **Automatic Multi-Tier Fallback:** If the Stripe key does not yet have the `2026-09-30.preview` gate enabled, `StripeProjectsAdapter` transparently falls back to the local `stripe projects` CLI (when a `.projects` directory is present) or Muxo Cloud Managed Infrastructure.
75
+ 3. **Encrypted Vault Custody:** Immediately after `POST /v2/provisioning/resources` and `POST /v2/provisioning/resources/:id/reveal_access_configuration` (or `stripe projects env --pull`), `StripeProjectsAdapter` encrypts the returned credentials with **AES-256-GCM** using a per-workspace HKDF-derived key in `MuxoStore` (`src/store.ts`), exposing them only via owner-authenticated `muxo env pull`, `GET /api/v1/resources/env`, or `POST /api/v1/provisioning/resources/:id/reveal_access_configuration`.
66
76
 
67
77
  ---
68
78
 
package/README.md CHANGED
@@ -116,7 +116,7 @@ Muxo ships a portable OpenAI Plugin (`plugins/muxo/plugin.json` & `plugins/muxo/
116
116
  | `src/store.ts` | SQLite (`node:sqlite`) store, AES-256-GCM secret vault, credit/settlement ledger, memories, agent claims, and HMAC-SHA256 receipt chain |
117
117
  | `src/providers/composio-sdk.ts` | Live Composio v3 Connected Apps adapter (catalog search, OAuth sessions/links, tool execution) |
118
118
  | `src/providers/composio-instant.ts` | Live Composio Instant adapter (`search`, `scrape`, `crawl`, `seo.audit`, `hackernews`, `github.repo_intel`, `dns.lookup`, `workbench`) |
119
- | `src/providers/stripe-projects.ts` | Live Stripe Projects CLI bridge (`status`, `catalog`, `add`, `rotate`, `remove`, `env --pull`) |
119
+ | `src/providers/stripe-projects.ts` | Live Stripe v2 Provisioning REST API (`2026-09-30.preview`) & Stripe Projects CLI bridge (`eligibility`, `catalog`, `payment_profile`, `provider_connections`, `resources`, `reveal_access_configuration`, `rotate`, `remove`, `env --pull`) |
120
120
  | `src/providers/stripe-billing.ts` | Live Stripe Checkout billing (Starter `$29/mo`, Pro `$99/mo`, yearly billing & credit packs with volume discounts) |
121
121
  | `src/providers/microsoft-governance.ts` | Microsoft Agent Governance Toolkit v5.0.0 (`McpSecurityScanner`, `PolicyEngine`, `AgentIdentity` Ed25519 DID, `AuditLogger`) |
122
122
  | `src/providers/supermemory.ts` | Supermemory v5 Contextual Brain (`profile`, hybrid `search`, secret-redacted `add`, `delete`) |
package/dist/cli.js CHANGED
@@ -6,7 +6,7 @@ import readline from "node:readline";
6
6
  import { getConfig } from "./config.js";
7
7
  import { MuxoEngine } from "./engine.js";
8
8
  import { handleJsonRpcMcpRequest } from "./mcp.js";
9
- import { sanitizePolicyPatch } from "./policy.js";
9
+ import { DEFAULT_WORKSPACE_POLICY, describePolicyInPlainEnglish, sanitizePolicyPatch, } from "./policy.js";
10
10
  import { RING_LABELS } from "./providers/microsoft-governance.js";
11
11
  import { BYOK_PROVIDER_CATALOG, MuxoStore } from "./store.js";
12
12
  import { MUXO_VERSION } from "./version.js";
@@ -337,17 +337,27 @@ async function runCli() {
337
337
  ? flags["api-key"].trim()
338
338
  : typeof flags.key === "string"
339
339
  ? flags.key.trim()
340
- : "";
340
+ : positional[1]?.startsWith("mk_")
341
+ ? positional[1].trim()
342
+ : "";
341
343
  let activeConfig = savedCliConfig;
342
344
  if (explicitKey) {
343
345
  const agentName = typeof flags.name === "string" ? flags.name : "Muxo Agent";
344
346
  if (remoteUrl) {
345
347
  apiKeyFlag = explicitKey;
346
- const orgRes = (await remoteFetch("/api/v1/organization").catch(() => ({})));
348
+ const joinRes = (await remoteFetch("/api/v1/workspaces/join", {
349
+ method: "POST",
350
+ body: { apiKey: explicitKey },
351
+ apiKey: explicitKey,
352
+ }).catch(() => null));
353
+ const orgRes = joinRes?.workspace
354
+ ? { organization: joinRes.workspace }
355
+ : (await remoteFetch("/api/v1/organization").catch(() => ({})));
347
356
  const org = orgRes?.organization || orgRes?.workspace || {};
348
357
  activeConfig = {
349
358
  authenticated: true,
350
359
  apiKey: explicitKey,
360
+ apiUrl: remoteUrl,
351
361
  workspaceId: org.id || "ws_remote",
352
362
  workspaceName: org.name || agentName,
353
363
  agentId: "usr_remote",
@@ -995,7 +1005,7 @@ async function runCli() {
995
1005
  provider,
996
1006
  timeoutSeconds,
997
1007
  });
998
- console.log(JSON.stringify({ ok: true, ...waited }, null, 2));
1008
+ console.log(JSON.stringify(waited, null, 2));
999
1009
  return;
1000
1010
  }
1001
1011
  if (cmd === "plan") {
@@ -1229,17 +1239,17 @@ async function runCli() {
1229
1239
  console.log(JSON.stringify(res, null, 2));
1230
1240
  }
1231
1241
  else {
1232
- const runsRes = await remoteFetch("/api/v1/runs");
1233
- console.log(JSON.stringify(runsRes.runs || runsRes, null, 2));
1242
+ const res = await remoteFetch("/api/v1/receipts?limit=20");
1243
+ console.log(JSON.stringify(res, null, 2));
1234
1244
  }
1235
1245
  return;
1236
1246
  }
1237
- const { store, engine, ctx } = getLocalContext();
1247
+ const { engine, ctx } = getLocalContext();
1238
1248
  if (receiptId) {
1239
1249
  console.log(JSON.stringify(engine.getReceipt(ctx, receiptId), null, 2));
1240
1250
  }
1241
1251
  else {
1242
- console.log(JSON.stringify(store.listReceipts(ctx.workspace.id, 20), null, 2));
1252
+ console.log(JSON.stringify({ ok: true, ...engine.listReceipts(ctx, 20) }, null, 2));
1243
1253
  }
1244
1254
  return;
1245
1255
  }
@@ -1833,6 +1843,125 @@ async function runCli() {
1833
1843
  }, null, 2));
1834
1844
  return;
1835
1845
  }
1846
+ if (cmd === "context") {
1847
+ const query = positional.slice(1).join(" ") ||
1848
+ (typeof flags.query === "string" ? flags.query : "") ||
1849
+ undefined;
1850
+ if (remoteUrl) {
1851
+ const suffix = query ? `?query=${encodeURIComponent(query)}` : "";
1852
+ const res = await remoteFetch(`/api/v1/context${suffix}`);
1853
+ console.log(JSON.stringify(res, null, 2));
1854
+ return;
1855
+ }
1856
+ const { engine, ctx } = getLocalContext();
1857
+ const runContext = await engine.getRunContext(ctx, query);
1858
+ console.log(JSON.stringify({ ok: true, ...runContext }, null, 2));
1859
+ return;
1860
+ }
1861
+ if (cmd === "guardrails" || cmd === "guardrail") {
1862
+ const sub = positional[1];
1863
+ if (sub === "set" || sub === "add") {
1864
+ const prompt = positional.slice(2).join(" ").trim() ||
1865
+ String(flags.prompt || flags.rule || "").trim();
1866
+ const rawRulesJson = typeof flags["rules-json"] === "string"
1867
+ ? flags["rules-json"]
1868
+ : typeof flags.rules === "string"
1869
+ ? flags.rules
1870
+ : undefined;
1871
+ const parsedParamRules = rawRulesJson
1872
+ ? JSON.parse(rawRulesJson)
1873
+ : undefined;
1874
+ if (!prompt && (!parsedParamRules || parsedParamRules.length === 0)) {
1875
+ throw new Error('Usage: muxo guardrails set "<plain-English rule>" [--rules-json \'[...]\'] (e.g. muxo guardrails set "auto approve under $50 and require approval over $50")');
1876
+ }
1877
+ if (remoteUrl) {
1878
+ const res = await remoteFetch("/api/v1/guardrails", {
1879
+ method: "POST",
1880
+ body: {
1881
+ prompt,
1882
+ ...(parsedParamRules ? { parameterRules: parsedParamRules } : {}),
1883
+ },
1884
+ });
1885
+ console.log(JSON.stringify(res, null, 2));
1886
+ return;
1887
+ }
1888
+ const { engine, ctx } = getLocalContext();
1889
+ const applied = await engine.applyNaturalLanguageGuardrail(ctx, prompt, {
1890
+ parameterRules: parsedParamRules,
1891
+ source: parsedParamRules ? "mcp_harness" : "deterministic",
1892
+ });
1893
+ console.log(JSON.stringify({
1894
+ ...applied,
1895
+ humanMessage: `Guardrail active: ${applied.guardrail.summary}`,
1896
+ }, null, 2));
1897
+ return;
1898
+ }
1899
+ if (sub === "reset") {
1900
+ if (remoteUrl) {
1901
+ const res = await remoteFetch("/api/v1/guardrails", {
1902
+ method: "POST",
1903
+ body: { reset: true },
1904
+ });
1905
+ console.log(JSON.stringify(res, null, 2));
1906
+ return;
1907
+ }
1908
+ const { store, ctx } = getLocalContext();
1909
+ const updated = store.updateWorkspacePolicy(ctx.workspace.id, DEFAULT_WORKSPACE_POLICY);
1910
+ console.log(JSON.stringify({
1911
+ ok: true,
1912
+ workspace: updated,
1913
+ plainEnglish: describePolicyInPlainEnglish(updated.policy),
1914
+ humanMessage: "Reset workspace guardrails to Safe Default.",
1915
+ }, null, 2));
1916
+ return;
1917
+ }
1918
+ if (remoteUrl) {
1919
+ const res = await remoteFetch("/api/v1/guardrails");
1920
+ console.log(JSON.stringify(res, null, 2));
1921
+ return;
1922
+ }
1923
+ const { engine, ctx } = getLocalContext();
1924
+ const summary = engine.getGuardrailsSummary(ctx);
1925
+ console.log(JSON.stringify({ ok: true, ...summary }, null, 2));
1926
+ return;
1927
+ }
1928
+ if (cmd === "policy") {
1929
+ const nlText = positional.slice(1).join(" ").trim() ||
1930
+ String(flags.rule || flags.prompt || "").trim();
1931
+ if (nlText) {
1932
+ if (remoteUrl) {
1933
+ const res = await remoteFetch("/api/v1/guardrails", {
1934
+ method: "POST",
1935
+ body: { prompt: nlText },
1936
+ });
1937
+ console.log(JSON.stringify(res, null, 2));
1938
+ return;
1939
+ }
1940
+ const { engine, ctx } = getLocalContext();
1941
+ const applied = await engine.applyNaturalLanguageGuardrail(ctx, nlText);
1942
+ console.log(JSON.stringify({
1943
+ ...applied,
1944
+ humanMessage: `Guardrail active: ${applied.guardrail.summary}`,
1945
+ }, null, 2));
1946
+ return;
1947
+ }
1948
+ if (remoteUrl) {
1949
+ const res = await remoteFetch("/api/v1/policy");
1950
+ console.log(JSON.stringify(res, null, 2));
1951
+ return;
1952
+ }
1953
+ const { engine, ctx } = getLocalContext();
1954
+ const summary = engine.getGuardrailsSummary(ctx);
1955
+ console.log(JSON.stringify({
1956
+ ok: true,
1957
+ policy: summary.policy,
1958
+ plainEnglish: summary.plainEnglish,
1959
+ explanation: summary.plainEnglish.explanation,
1960
+ activeDefaults: summary.activeDefaults,
1961
+ activeGuardrails: summary.activeGuardrails,
1962
+ }, null, 2));
1963
+ return;
1964
+ }
1836
1965
  if (cmd === "governance") {
1837
1966
  const sub = positional[1];
1838
1967
  const ringLabel = (policy) => policy?.executionRing !== undefined
@@ -1957,6 +2086,178 @@ async function runCli() {
1957
2086
  }, null, 2));
1958
2087
  return;
1959
2088
  }
2089
+ if (cmd === "workspaces" || cmd === "workspace") {
2090
+ const sub = positional[1] || "list";
2091
+ if (sub === "list" || sub === "ls") {
2092
+ if (remoteUrl) {
2093
+ const res = await remoteFetch("/api/v1/workspaces");
2094
+ console.log(JSON.stringify(res, null, 2));
2095
+ return;
2096
+ }
2097
+ const { store, ctx } = getLocalContext();
2098
+ const workspaces = store.listUserWorkspaces(ctx.user.id, ctx.workspace.id);
2099
+ console.log(JSON.stringify({ ok: true, currentWorkspaceId: ctx.workspace.id, workspaces }, null, 2));
2100
+ return;
2101
+ }
2102
+ if (sub === "create" || sub === "new") {
2103
+ const name = positional.slice(2).join(" ").trim() ||
2104
+ (typeof flags.name === "string" ? flags.name.trim() : "");
2105
+ if (!name) {
2106
+ throw new Error("Usage: muxo workspaces create <name> [--team <teamName>]");
2107
+ }
2108
+ const teamName = typeof flags.team === "string" ? flags.team.trim() : undefined;
2109
+ if (remoteUrl) {
2110
+ const res = await remoteFetch("/api/v1/workspaces", {
2111
+ method: "POST",
2112
+ body: { name, teamName },
2113
+ });
2114
+ console.log(JSON.stringify(res, null, 2));
2115
+ return;
2116
+ }
2117
+ const { store, ctx } = getLocalContext();
2118
+ const created = store.createWorkspaceForUser({
2119
+ userId: ctx.user.id,
2120
+ name,
2121
+ teamName,
2122
+ });
2123
+ console.log(JSON.stringify({
2124
+ ok: true,
2125
+ workspace: created.workspace,
2126
+ apiKey: created.apiKey,
2127
+ workspaces: store.listUserWorkspaces(ctx.user.id, created.workspace.id),
2128
+ }, null, 2));
2129
+ return;
2130
+ }
2131
+ if (sub === "switch" || sub === "use") {
2132
+ const workspaceId = positional[2]?.trim() ||
2133
+ (typeof flags.id === "string" ? flags.id.trim() : "");
2134
+ if (!workspaceId) {
2135
+ throw new Error("Usage: muxo workspaces switch <workspace_id>");
2136
+ }
2137
+ if (remoteUrl) {
2138
+ const res = await remoteFetch("/api/v1/workspaces/switch", {
2139
+ method: "POST",
2140
+ body: { workspaceId },
2141
+ });
2142
+ console.log(JSON.stringify(res, null, 2));
2143
+ return;
2144
+ }
2145
+ const { store, ctx } = getLocalContext();
2146
+ const switched = store.switchUserWorkspace(ctx.user.id, workspaceId);
2147
+ if (!switched) {
2148
+ throw new Error(`Workspace '${workspaceId}' not found or not accessible.`);
2149
+ }
2150
+ console.log(JSON.stringify({
2151
+ ok: true,
2152
+ workspace: switched.workspace,
2153
+ workspaces: store.listUserWorkspaces(ctx.user.id, switched.workspace.id),
2154
+ }, null, 2));
2155
+ return;
2156
+ }
2157
+ if (sub === "join") {
2158
+ const keyToJoin = positional[2]?.trim() ||
2159
+ (typeof flags["api-key"] === "string"
2160
+ ? flags["api-key"].trim()
2161
+ : typeof flags.key === "string"
2162
+ ? flags.key.trim()
2163
+ : "");
2164
+ if (!keyToJoin) {
2165
+ throw new Error("Usage: muxo workspaces join <mk_live_...>");
2166
+ }
2167
+ if (remoteUrl) {
2168
+ const res = await remoteFetch("/api/v1/workspaces/join", {
2169
+ method: "POST",
2170
+ body: { apiKey: keyToJoin },
2171
+ });
2172
+ const ws = res.workspace || {};
2173
+ writeCliAuthConfig({
2174
+ authenticated: true,
2175
+ apiKey: keyToJoin,
2176
+ apiUrl: remoteUrl,
2177
+ workspaceId: String(ws.id || "ws_remote"),
2178
+ workspaceName: String(ws.name || "Muxo Workspace"),
2179
+ agentId: "usr_remote",
2180
+ governanceDid: `did:muxo:${ws.id || "ws_remote"}`,
2181
+ supermemoryNamespace: `muxo_${ws.id || "ws_remote"}`,
2182
+ updatedAt: new Date().toISOString(),
2183
+ });
2184
+ console.log(JSON.stringify(res, null, 2));
2185
+ return;
2186
+ }
2187
+ const { store, ctx, engine } = getLocalContext();
2188
+ const joined = store.joinWorkspaceWithApiKey({
2189
+ apiKey: keyToJoin,
2190
+ userId: ctx.user.id,
2191
+ });
2192
+ if (!joined) {
2193
+ throw new Error("Invalid or revoked Muxo API key.");
2194
+ }
2195
+ writeCliAuthConfig({
2196
+ authenticated: true,
2197
+ apiKey: keyToJoin,
2198
+ workspaceId: joined.workspace.id,
2199
+ workspaceName: joined.workspace.name,
2200
+ agentId: ctx.user.id,
2201
+ governanceDid: engine.governance.getStatus(joined.workspace).agentDid,
2202
+ supermemoryNamespace: engine.supermemory.getWorkspaceNamespace(joined.workspace.id),
2203
+ updatedAt: new Date().toISOString(),
2204
+ });
2205
+ console.log(JSON.stringify({
2206
+ ok: true,
2207
+ mode: "api_key_join",
2208
+ workspace: joined.workspace,
2209
+ keyRecord: joined.keyRecord,
2210
+ membership: joined.membership,
2211
+ }, null, 2));
2212
+ return;
2213
+ }
2214
+ }
2215
+ if (cmd === "team" || cmd === "teams") {
2216
+ const sub = positional[1] || "onboard";
2217
+ const teamName = (sub === "onboard" || sub === "invite" || sub === "add"
2218
+ ? positional.slice(2).join(" ")
2219
+ : positional.slice(1).join(" ")).trim() ||
2220
+ (typeof flags.name === "string" ? flags.name.trim() : "") ||
2221
+ (typeof flags.team === "string" ? flags.team.trim() : "");
2222
+ if (!teamName) {
2223
+ throw new Error('Usage: muxo team onboard "<team_name>" [--mode shared|dedicated] [--role operator|admin|member]');
2224
+ }
2225
+ const rawMode = typeof flags.mode === "string" ? flags.mode.trim() : "";
2226
+ const mode = rawMode === "dedicated" || rawMode === "dedicated_workspace"
2227
+ ? "dedicated_workspace"
2228
+ : "shared_workspace";
2229
+ const role = typeof flags.role === "string" &&
2230
+ ["owner", "admin", "operator", "member"].includes(flags.role)
2231
+ ? flags.role
2232
+ : "operator";
2233
+ const environment = flags.test ? "test" : "live";
2234
+ if (remoteUrl) {
2235
+ const res = await remoteFetch("/api/v1/workspaces/onboard-team", {
2236
+ method: "POST",
2237
+ body: { teamName, mode, role, environment },
2238
+ });
2239
+ console.log(JSON.stringify(res, null, 2));
2240
+ return;
2241
+ }
2242
+ const { store, ctx } = getLocalContext();
2243
+ const kit = store.onboardTeam({
2244
+ userId: ctx.user.id,
2245
+ userEmail: ctx.user.email,
2246
+ currentWorkspaceId: ctx.workspace.id,
2247
+ teamName,
2248
+ role,
2249
+ mode,
2250
+ environment,
2251
+ baseUrl: config.baseUrl,
2252
+ });
2253
+ console.log(JSON.stringify({
2254
+ ok: true,
2255
+ kit,
2256
+ workspace: kit.workspace,
2257
+ apiKey: kit.apiKey,
2258
+ }, null, 2));
2259
+ return;
2260
+ }
1960
2261
  if (cmd === "serve") {
1961
2262
  const { createMuxoServer } = await import("./server.js");
1962
2263
  const port = flags.port ? Number(flags.port) : config.port;
@@ -2021,12 +2322,17 @@ async function runCli() {
2021
2322
  Muxo CLI — Unified Agent Execution, Cloud Infrastructure, Memory & Safety Platform
2022
2323
 
2023
2324
  Natural Language & Interactive TUI:
2024
- muxo setup 1-command auto-signup + MCP setup (.mcp.json + ~/.muxo/config.json)
2325
+ muxo setup [--api-key <key>] 1-command auto-signup (or join via team API key) + MCP setup
2025
2326
  muxo do "<instruction>" Execute any goal in plain English (LLM/semantic router -> plan -> execute)
2026
2327
  muxo ask "<instruction>" [--plan-only] Alias for 'muxo do' (pass --plan-only to inspect plan before running)
2027
2328
  muxo tui Launch interactive Terminal UI dashboard (BYOK, Billing, OAuth, Infra)
2028
2329
  muxo byok [list|set|delete] [<provider>] Manage BYOK API keys in AES-256-GCM Vault (0 credit cost when active)
2029
2330
 
2331
+ Workspaces & Team Onboarding:
2332
+ muxo workspaces [list|create|switch|join] List, create, switch, or join workspaces via API key
2333
+ muxo team onboard "<team>" [--mode shared|dedicated] [--role operator|admin|member]
2334
+ Mint a scoped team API key & onboarding kit for another team
2335
+
2030
2336
  Core Commands:
2031
2337
  muxo login [--api-key <key> | --signup] Sign in or create an autonomous workspace (~/.muxo/config.json)
2032
2338
  muxo logout Remove saved CLI authentication config
@@ -2042,6 +2348,7 @@ Core Commands:
2042
2348
  muxo approve <plan_id> Approve a pending high-risk plan
2043
2349
  muxo run <plan_id> Execute an approved plan and issue a verifiable audit record
2044
2350
  muxo exec <tool_slug> --input '{...}' Plan and execute in one step (pass --approve for high-risk)
2351
+ muxo provision <provider> [--name <name>] Provision cloud infrastructure (e.g., turso, neon, supabase, upstash)
2045
2352
  muxo resources List provisioned Muxo Cloud Infrastructure resources
2046
2353
  muxo env pull [--out .env.muxo] Decrypt and write provisioned credentials to local .env
2047
2354
  muxo receipts [<receipt_id>] List or verify execution audit records
@@ -2057,7 +2364,7 @@ Core Commands:
2057
2364
  [--block-destructive-sql true|false] [--max-credits <n>]
2058
2365
  muxo harness Check API, MCP, auth, governance and catalog; print MCP config
2059
2366
  muxo serve [--port 4310] Start unified HTTP Console, Landing, OAuth Callback & MCP server
2060
- muxo mcp Run stdio MCP server (20 canonical tools)
2367
+ muxo mcp Run stdio MCP server (19 canonical tools)
2061
2368
  `);
2062
2369
  }
2063
2370
  runCli()
@@ -0,0 +1,58 @@
1
+ /** SDK-free Composio enterprise toolkit and trigger catalogue shared by the Node server and the edge worker. */
2
+ export interface ComposioToolkitMetadata {
3
+ slug: string;
4
+ name: string;
5
+ description: string;
6
+ categories: string[];
7
+ authSchemes: Array<"OAUTH2" | "API_KEY" | "BEARER_TOKEN" | "NO_AUTH">;
8
+ pinnedVersion: string;
9
+ readOnlyScopes: string[];
10
+ fullAccessScopes: string[];
11
+ sampleActions: Array<{
12
+ upstreamSlug: string;
13
+ muxoSlug: string;
14
+ name: string;
15
+ riskLevel: "read" | "write" | "destructive" | "financial";
16
+ }>;
17
+ }
18
+ export interface ComposioTriggerSubscription {
19
+ id: string;
20
+ workspaceId: string;
21
+ triggerSlug: string;
22
+ providerSlug: string;
23
+ connectedAccountId: string;
24
+ webhookUrl: string;
25
+ config: Record<string, unknown>;
26
+ status: "active" | "paused" | "disabled";
27
+ createdAt: string;
28
+ }
29
+ export interface ComposioTriggerEventRecord {
30
+ id: string;
31
+ workspaceId: string;
32
+ triggerSlug: string;
33
+ providerSlug: string;
34
+ receivedAt: string;
35
+ promptInjectionScan: {
36
+ safe: boolean;
37
+ riskScore: number;
38
+ findings: string[];
39
+ };
40
+ disposition: "dispatched" | "quarantined";
41
+ payloadPreview: Record<string, unknown>;
42
+ }
43
+ export declare const ENTERPRISE_TOOLKITS_CATALOG: ComposioToolkitMetadata[];
44
+ export declare function getSampleActionSchema(muxoSlug: string, upstreamSlug?: string): Record<string, unknown>;
45
+ export interface ComposioTriggerType {
46
+ slug: string;
47
+ providerSlug: string;
48
+ name: string;
49
+ description: string;
50
+ }
51
+ export declare const COMPOSIO_TRIGGER_CATALOGUE: ComposioTriggerType[];
52
+ export declare function listComposioTriggerTypes(providerSlug?: string): ComposioTriggerType[];
53
+ export declare function filterComposioToolkits(params?: {
54
+ category?: string;
55
+ search?: string;
56
+ }): ComposioToolkitMetadata[];
57
+ /** Least-privilege scopes for a custom auth config: explicit scopes win, then the toolkit's read-only or full set. */
58
+ export declare function composioAuthConfigScopes(toolkitSlug: string, scopeMode: "read_only" | "full_access", customScopes?: string[]): string[];