@muxoai/sdk 1.4.2 → 1.4.4

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 (40) hide show
  1. package/.agents/plugins/marketplace.json +1 -1
  2. package/.claude-plugin/marketplace.json +2 -2
  3. package/README.md +15 -1
  4. package/dist/cli.js +217 -0
  5. package/dist/composio-catalog.d.ts +25 -0
  6. package/dist/composio-catalog.js +145 -0
  7. package/dist/config.d.ts +1 -0
  8. package/dist/config.js +1 -0
  9. package/dist/durable-workflow.d.ts +71 -4
  10. package/dist/durable-workflow.js +199 -5
  11. package/dist/engine.d.ts +110 -4
  12. package/dist/engine.js +603 -24
  13. package/dist/index.d.ts +3 -0
  14. package/dist/index.js +3 -0
  15. package/dist/mcp-schema.d.ts +14 -0
  16. package/dist/mcp-schema.js +85 -7
  17. package/dist/mcp.js +325 -5
  18. package/dist/memory-graph.d.ts +26 -2
  19. package/dist/memory-graph.js +127 -7
  20. package/dist/oss-suite.d.ts +401 -0
  21. package/dist/oss-suite.js +2065 -0
  22. package/dist/policy.js +59 -0
  23. package/dist/providers/composio-instant.js +54 -36
  24. package/dist/providers/composio-sdk.d.ts +10 -1
  25. package/dist/providers/composio-sdk.js +144 -31
  26. package/dist/sdk.d.ts +43 -1
  27. package/dist/sdk.js +85 -2
  28. package/dist/server.js +231 -3
  29. package/dist/skills-catalog.d.ts +66 -0
  30. package/dist/skills-catalog.js +801 -0
  31. package/dist/types.d.ts +51 -1
  32. package/dist/ui/console-html.js +23 -8
  33. package/dist/version.d.ts +1 -1
  34. package/dist/version.js +1 -1
  35. package/package.json +1 -1
  36. package/plugins/muxo/.claude-plugin/plugin.json +1 -1
  37. package/plugins/muxo/.codex-plugin/plugin.json +2 -2
  38. package/plugins/muxo/.cursor-plugin/plugin.json +1 -1
  39. package/plugins/muxo/plugin.json +2 -2
  40. package/plugins/muxo/skills/muxo/SKILL.md +13 -3
package/dist/server.js CHANGED
@@ -10,6 +10,7 @@ import { MuxoStore } from "./store.js";
10
10
  import { managedProviderConnectionList, managedProviderConnectionRequest, managedProviderConnectionUnlink, managedResource, managedResourceAction, } from "./provisioning-managed.js";
11
11
  import { DEFAULT_WORKSPACE_POLICY, describePolicyInPlainEnglish, sanitizePolicyPatch, } from "./policy.js";
12
12
  import { parseNaturalLanguageMemoryInstruction } from "./providers/supermemory.js";
13
+ import { getMuxoSkill, listMuxoSkills, renderMuxoSkillMarkdown, } from "./skills-catalog.js";
13
14
  import { MUXO_VERSION } from "./version.js";
14
15
  import { fetchMuxoConnectLinkMetadata, isStripeProjectsExclusiveProvider, normalizeStripeProjectsProviderSlug, parseComposioWebhookEnvelope, submitMuxoConnectLink, verifyComposioWebhookSignature, wrapMuxoConnectUrl, } from "./composio-catalog.js";
15
16
  import { isConsolePath, renderApprovalPageHtml, renderConsoleHtml, renderLandingHtml, renderOAuthCallbackPageHtml, renderOAuthConnectPageHtml, renderOAuthConsentHtml, } from "./ui/console-html.js";
@@ -134,6 +135,16 @@ Teach preferences in plain English and Muxo auto-fills matching tool inputs on e
134
135
  - "What do you remember?"
135
136
 
136
137
  \`plan_action\` recalls workspace memory before governance checks and reports \`memoryContext.autoFilledInput\` plus \`activeDefaults\` so callers can see exactly which parameters were filled from memory.
138
+
139
+ ## Natural-Language Saga Playbooks, Temporal Rollbacks, Cedar, OTel & One-Shot Harness Config
140
+
141
+ Pass plain English to \`POST /api/v1/do\` or MCP \`get_run_context({ prompt: "..." })\`:
142
+ - **Playbooks**: "Run the fullstack cloud bootstrap playbook", "Create playbook daily-seo-slack that runs instant.seo.audit and app.slack.send_message" (\`GET/POST /api/v1/playbooks\`, \`POST /api/v1/playbooks/:slug/run\`)
143
+ - **Temporal Workflows ("latest" supported)**: "Rollback the latest workflow because staging healthcheck failed", "Show Temporal history for latest workflow" (\`POST /api/v1/workflows/latest/rollback\`, \`GET /api/v1/workflows/latest/history\`)
144
+ - **Time-Travel & BFS Memory Graph**: "Show my knowledge graph as of 2026-10-20T00:00:00Z within 2 hops of workspace" (\`GET /api/v1/memory/graph?as_of=...&focal_entity=...&max_hops=2\`)
145
+ - **AWS Cedar 4.0 & OPA Rego v1**: "Compile our guardrails to AWS Cedar", "Evaluate Cedar policy for resource.turso.database with DROP TABLE users" (\`GET /api/v1/governance/cedar\`, \`POST /api/v1/governance/cedar/evaluate\`)
146
+ - **OTel GenAI & FinOps ROI**: "Export OpenTelemetry traces", "What is our ROI and engineering hours saved?" (\`GET /api/v1/telemetry/otlp\`, \`GET /api/v1/analytics/roi\`)
147
+ - **One-Shot Harness Configurator**: "Configure harness preset strict-production" (\`GET/POST /api/v1/harness/configure\`, presets: \`startup-builder\`, \`strict-production\`, \`read-only-auditor\`, \`finops-byok-zero-cost\`).
137
148
  `;
138
149
  }
139
150
  async function readBody(req) {
@@ -825,6 +836,22 @@ Users purchase Muxo Credits (\`POST /api/v1/billing/topup\` or \`muxo billing to
825
836
  res.end(renderSkillMarkdown(config.baseUrl));
826
837
  return;
827
838
  }
839
+ const publicSkillMatch = pathname.match(/^\/skills\/([^/]+?)(?:\/SKILL\.md|\.md)$/i);
840
+ if (publicSkillMatch && req.method === "GET") {
841
+ const slug = decodeURIComponent(publicSkillMatch[1]);
842
+ const md = renderMuxoSkillMarkdown(slug, config.baseUrl);
843
+ if (!md) {
844
+ sendJson(res, 404, {
845
+ ok: false,
846
+ code: "SKILL_NOT_FOUND",
847
+ error: `Skill not found: ${slug}`,
848
+ });
849
+ return;
850
+ }
851
+ res.writeHead(200, { "Content-Type": "text/markdown; charset=utf-8" });
852
+ res.end(md);
853
+ return;
854
+ }
828
855
  if (pathname === "/llms.txt" && req.method === "GET") {
829
856
  res.writeHead(200, { "Content-Type": "text/plain; charset=utf-8" });
830
857
  res.end(`# Muxo\n> Unified agent execution across Connected Apps, Instant Tools, Cloud Infrastructure, Workspace Memory, and Safety Guardrails.\n\n- Skill Document: ${config.baseUrl}/skill.md\n- Auth Guide: ${config.baseUrl}/auth.md\n- OpenAPI 3.1 Spec: ${config.baseUrl}/api/openapi.json\n- MCP Endpoint: ${config.baseUrl}/mcp\n- OAuth Callback Handoff: ${config.baseUrl}/oauth/callback\n- Plugin Marketplace (Codex/OpenAI): ${config.baseUrl}/.agents/plugins/marketplace.json\n- Plugin Marketplace (Claude/Droid): ${config.baseUrl}/.claude-plugin/marketplace.json\n- Console (app.muxo.ai): ${config.baseUrl}/\n- Landing & Provider Canvas (muxo.ai): ${config.baseUrl}/landing\n- Documentation (docs.muxo.ai): ${config.docsUrl}\n\n## Agent-Native Policy, Context & Governance Interface\n- MCP Control Plane (\`get_run_context\`): \`action: "recall" | "remember" | "forget" | "set_guardrail" | "reset_guardrails" | "check_policy" | "governance_status" | "kill_switch" | "scan_context"\`\n- Strict /v1 Organization Brief: \`get_organization({ company_context: { required: false } })\` returns accepted workspace policy facts + learned defaults in \`company_context.packet\`\n- Dry-Run Policy Simulator: \`POST ${config.baseUrl}/api/v1/guardrails/check\` (\`{ "tool_slug": "...", "input": { ... } }\`) or MCP \`get_run_context({ action: "check_policy", tool_slug, input })\`\n- Guardrails & Policy Brief: \`GET/POST ${config.baseUrl}/api/v1/guardrails\`, \`POST ${config.baseUrl}/api/v1/guardrails/reset\`, \`GET ${config.baseUrl}/api/v1/governance\` (includes \`llmPolicyBrief\`)\n- MCP Resources: \`muxo://policy/brief\`, \`muxo://governance/policy\`, \`muxo://context\`, \`muxo://memory/graph\`\n- MCP Prompts: \`context\`, \`policy_guardrails\`, \`governed_execution\`, \`security_audit\`\n`);
@@ -1948,11 +1975,35 @@ Users purchase Muxo Credits (\`POST /api/v1/billing/topup\` or \`muxo billing to
1948
1975
  });
1949
1976
  return;
1950
1977
  }
1951
- if (pathname === "/api/v1/memory/graph" && req.method === "GET") {
1978
+ if (pathname === "/api/v1/memory/graph" &&
1979
+ (req.method === "GET" || req.method === "POST")) {
1980
+ const body = req.method === "POST"
1981
+ ? JSON.parse((await readBody(req)) || "{}")
1982
+ : {};
1952
1983
  const query = url.searchParams.get("query") ||
1953
1984
  url.searchParams.get("q") ||
1954
- undefined;
1955
- const graph = await engine.getMemoryGraph(ctx, query);
1985
+ (body.query ? String(body.query) : undefined);
1986
+ const asOf = url.searchParams.get("as_of") ||
1987
+ url.searchParams.get("asOf") ||
1988
+ (body.as_of || body.asOf ? String(body.as_of || body.asOf) : null);
1989
+ const focalEntity = url.searchParams.get("focal_entity") ||
1990
+ url.searchParams.get("focalEntity") ||
1991
+ (body.focal_entity || body.focalEntity
1992
+ ? String(body.focal_entity || body.focalEntity)
1993
+ : null);
1994
+ const rawMaxHops = url.searchParams.get("max_hops") ??
1995
+ url.searchParams.get("maxHops") ??
1996
+ body.max_hops ??
1997
+ body.maxHops;
1998
+ const maxHops = rawMaxHops !== undefined && rawMaxHops !== null && rawMaxHops !== ""
1999
+ ? Number(rawMaxHops)
2000
+ : undefined;
2001
+ const graph = await engine.getMemoryGraph(ctx, {
2002
+ query,
2003
+ asOf,
2004
+ focalEntity,
2005
+ maxHops,
2006
+ });
1956
2007
  sendJson(res, 200, { ok: true, ...graph });
1957
2008
  return;
1958
2009
  }
@@ -2990,6 +3041,13 @@ Users purchase Muxo Credits (\`POST /api/v1/billing/topup\` or \`muxo billing to
2990
3041
  sendJson(res, 200, cancelled);
2991
3042
  return;
2992
3043
  }
3044
+ const runReconcileMatch = pathname.match(/^\/api\/v1\/runs\/([^/]+)\/reconcile$/);
3045
+ if (runReconcileMatch && (req.method === "GET" || req.method === "POST")) {
3046
+ const runOrPlanId = decodeURIComponent(runReconcileMatch[1]);
3047
+ const report = engine.reconcileRun(ctx, runOrPlanId);
3048
+ sendJson(res, 200, report);
3049
+ return;
3050
+ }
2993
3051
  const runGetMatch = pathname.match(/^\/api\/v1\/runs\/([^/]+)$/);
2994
3052
  if (runGetMatch && req.method === "GET") {
2995
3053
  const runId = decodeURIComponent(runGetMatch[1]);
@@ -3543,6 +3601,176 @@ Users purchase Muxo Credits (\`POST /api/v1/billing/topup\` or \`muxo billing to
3543
3601
  sendJson(res, 200, { ok: true, workflow });
3544
3602
  return;
3545
3603
  }
3604
+ const wfHistoryMatch = pathname.match(/^\/api\/v1\/workflows\/([^/]+)\/history$/);
3605
+ if (wfHistoryMatch && req.method === "GET") {
3606
+ const wfId = decodeURIComponent(wfHistoryMatch[1]);
3607
+ const history = engine.getDurableWorkflowHistory(ctx, wfId);
3608
+ sendJson(res, 200, { ok: true, ...history });
3609
+ return;
3610
+ }
3611
+ const wfSignalMatch = pathname.match(/^\/api\/v1\/workflows\/([^/]+)\/signal$/);
3612
+ if (wfSignalMatch && req.method === "POST") {
3613
+ const wfId = decodeURIComponent(wfSignalMatch[1]);
3614
+ const body = JSON.parse((await readBody(req)) || "{}");
3615
+ const signalName = String(body.signalName || body.signal_name || body.name || "workflow.signal");
3616
+ const workflow = engine.signalDurableWorkflow(ctx, wfId, {
3617
+ signalName,
3618
+ payload: body.payload && typeof body.payload === "object"
3619
+ ? body.payload
3620
+ : body,
3621
+ });
3622
+ sendJson(res, 200, { ok: true, workflow });
3623
+ return;
3624
+ }
3625
+ const wfRollbackMatch = pathname.match(/^\/api\/v1\/workflows\/([^/]+)\/rollback$/);
3626
+ if (wfRollbackMatch && req.method === "POST") {
3627
+ const wfId = decodeURIComponent(wfRollbackMatch[1]);
3628
+ const body = JSON.parse((await readBody(req)) || "{}");
3629
+ const workflow = engine.rollbackDurableWorkflow(ctx, wfId, {
3630
+ reason: body.reason ? String(body.reason) : undefined,
3631
+ failedStep: body.failedStep || body.failed_step
3632
+ ? String(body.failedStep || body.failed_step)
3633
+ : undefined,
3634
+ });
3635
+ sendJson(res, 200, { ok: true, workflow });
3636
+ return;
3637
+ }
3638
+ if ((pathname === "/api/v1/governance/cedar" ||
3639
+ pathname === "/api/v1/policy/cedar") &&
3640
+ req.method === "GET") {
3641
+ const bundle = engine.getPolicyAsCodeBundle(ctx);
3642
+ sendJson(res, 200, { ok: true, ...bundle });
3643
+ return;
3644
+ }
3645
+ if ((pathname === "/api/v1/governance/cedar/evaluate" ||
3646
+ pathname === "/api/v1/policy/cedar/evaluate") &&
3647
+ req.method === "POST") {
3648
+ const body = JSON.parse((await readBody(req)) || "{}");
3649
+ const evaluated = await engine.evaluatePolicyAsCode(ctx, {
3650
+ toolSlug: String(body.toolSlug || body.tool_slug || body.action || "instant.web.search"),
3651
+ input: body.input && typeof body.input === "object"
3652
+ ? body.input
3653
+ : {},
3654
+ riskLevel: (body.riskLevel || body.risk_level),
3655
+ creditCost: typeof body.creditCost === "number"
3656
+ ? body.creditCost
3657
+ : typeof body.credit_cost === "number"
3658
+ ? body.credit_cost
3659
+ : undefined,
3660
+ lane: body.lane ? String(body.lane) : undefined,
3661
+ });
3662
+ sendJson(res, 200, { ok: true, ...evaluated });
3663
+ return;
3664
+ }
3665
+ if ((pathname === "/api/v1/telemetry/otlp" ||
3666
+ pathname === "/api/v1/governance/telemetry") &&
3667
+ req.method === "GET") {
3668
+ const limit = Number(url.searchParams.get("limit") || 25);
3669
+ const otel = engine.exportOtelTraces(ctx, limit);
3670
+ sendJson(res, 200, { ok: true, ...otel });
3671
+ return;
3672
+ }
3673
+ if (pathname === "/api/v1/skills" && req.method === "GET") {
3674
+ const category = url.searchParams.get("category") || undefined;
3675
+ const provider = url.searchParams.get("provider") || undefined;
3676
+ const query = url.searchParams.get("q") ||
3677
+ url.searchParams.get("query") ||
3678
+ undefined;
3679
+ const skills = listMuxoSkills({ category, provider, query }, config.baseUrl);
3680
+ sendJson(res, 200, {
3681
+ ok: true,
3682
+ count: skills.length,
3683
+ skills,
3684
+ });
3685
+ return;
3686
+ }
3687
+ const apiSkillMatch = pathname.match(/^\/api\/v1\/skills\/([^/]+)$/);
3688
+ if (apiSkillMatch && req.method === "GET") {
3689
+ const slug = decodeURIComponent(apiSkillMatch[1]).replace(/\.md$/i, "");
3690
+ const skill = getMuxoSkill(slug, config.baseUrl);
3691
+ const markdown = renderMuxoSkillMarkdown(slug, config.baseUrl);
3692
+ if (!skill || !markdown) {
3693
+ sendJson(res, 404, {
3694
+ ok: false,
3695
+ code: "SKILL_NOT_FOUND",
3696
+ error: `Skill not found: ${slug}`,
3697
+ });
3698
+ return;
3699
+ }
3700
+ sendJson(res, 200, {
3701
+ ok: true,
3702
+ skill,
3703
+ markdown,
3704
+ skillUrl: `${config.baseUrl}/skills/${skill.slug}/SKILL.md`,
3705
+ mcpResourceUri: `muxo://skills/${skill.slug}`,
3706
+ });
3707
+ return;
3708
+ }
3709
+ if (pathname === "/api/v1/playbooks" && req.method === "GET") {
3710
+ const playbooks = engine.listCommercialPlaybooks(ctx);
3711
+ sendJson(res, 200, {
3712
+ ok: true,
3713
+ count: playbooks.length,
3714
+ playbooks,
3715
+ });
3716
+ return;
3717
+ }
3718
+ if (pathname === "/api/v1/playbooks" && req.method === "POST") {
3719
+ const body = JSON.parse((await readBody(req)) || "{}");
3720
+ const created = engine.createCustomPlaybook(ctx, {
3721
+ prompt: body.prompt || body.instruction || body.description || "",
3722
+ input: body,
3723
+ });
3724
+ sendJson(res, 201, created);
3725
+ return;
3726
+ }
3727
+ const playbookRunMatch = pathname.match(/^\/api\/v1\/playbooks\/([^/]+)\/run$/);
3728
+ if ((playbookRunMatch || pathname === "/api/v1/playbooks/run") &&
3729
+ req.method === "POST") {
3730
+ const body = JSON.parse((await readBody(req)) || "{}");
3731
+ const slug = playbookRunMatch
3732
+ ? decodeURIComponent(playbookRunMatch[1])
3733
+ : String(body.slug || body.playbook || body.prompt || "");
3734
+ const result = engine.runCommercialPlaybook(ctx, {
3735
+ slug,
3736
+ input: body.input && typeof body.input === "object"
3737
+ ? body.input
3738
+ : body,
3739
+ });
3740
+ sendJson(res, 201, result);
3741
+ return;
3742
+ }
3743
+ if ((pathname === "/api/v1/harness/configure" ||
3744
+ pathname === "/api/v1/harness/presets") &&
3745
+ (req.method === "GET" || req.method === "POST")) {
3746
+ const body = req.method === "POST"
3747
+ ? JSON.parse((await readBody(req)) || "{}")
3748
+ : {};
3749
+ const preset = body.preset ||
3750
+ url.searchParams.get("preset") ||
3751
+ null;
3752
+ const harness = body.harness ||
3753
+ url.searchParams.get("harness") ||
3754
+ null;
3755
+ const prompt = body.prompt ||
3756
+ body.instruction ||
3757
+ url.searchParams.get("prompt") ||
3758
+ null;
3759
+ const configured = await engine.configureHarness(ctx, {
3760
+ preset: preset ? String(preset) : null,
3761
+ harness: harness ? String(harness) : null,
3762
+ prompt: prompt ? String(prompt) : null,
3763
+ });
3764
+ sendJson(res, 200, configured);
3765
+ return;
3766
+ }
3767
+ if ((pathname === "/api/v1/analytics/roi" ||
3768
+ pathname === "/api/v1/billing/roi") &&
3769
+ req.method === "GET") {
3770
+ const roi = engine.getCommercialRoiReport(ctx);
3771
+ sendJson(res, 200, { ok: true, ...roi });
3772
+ return;
3773
+ }
3546
3774
  if (pathname === "/api/v1/governance/archive" && req.method === "GET") {
3547
3775
  const archive = engine.exportTamperEvidentArchive(ctx.workspace.id);
3548
3776
  sendJson(res, 200, { ok: true, ...archive });
@@ -0,0 +1,66 @@
1
+ export type MuxoSkillCategory = "governance" | "app_automation" | "cloud_infrastructure" | "workflow";
2
+ export interface MuxoSkillDefinition {
3
+ slug: string;
4
+ name: string;
5
+ title: string;
6
+ description: string;
7
+ category: MuxoSkillCategory;
8
+ lane: "composio_sdk" | "stripe_projects" | "composio_instant" | "hybrid";
9
+ providerSlug: string;
10
+ providerName: string;
11
+ requiresMcp: string[];
12
+ mcpServerUrl: string;
13
+ recommendedTools: string[];
14
+ workflowSteps: string[];
15
+ pitfalls: string[];
16
+ stripeProjectsOverride?: {
17
+ enforced: boolean;
18
+ canonicalToolSlug: string;
19
+ reason: string;
20
+ };
21
+ sourceRepo: string;
22
+ }
23
+ export interface MuxoMcpSkillBundle {
24
+ name: string;
25
+ description: string;
26
+ version: string;
27
+ uri: string;
28
+ frontmatter: {
29
+ name: string;
30
+ description: string;
31
+ };
32
+ content: string;
33
+ files: Array<{
34
+ path: string;
35
+ uri: string;
36
+ mimeType: string;
37
+ content: string;
38
+ }>;
39
+ }
40
+ export declare function transpileAwesomeClaudeSkillToMuxo(rawMarkdown: string, baseUrl?: string): string;
41
+ export declare function listMuxoSkills(filter?: {
42
+ category?: string;
43
+ provider?: string;
44
+ query?: string;
45
+ }, baseUrl?: string): MuxoSkillDefinition[];
46
+ export declare function getMuxoSkill(slug: string, baseUrl?: string): MuxoSkillDefinition | null;
47
+ export declare function renderMuxoSkillMarkdown(slug: string, baseUrl?: string): string | null;
48
+ export interface MuxoDomainSkillHint {
49
+ slug: string;
50
+ title: string;
51
+ category: MuxoSkillCategory;
52
+ lane: string;
53
+ mcpResourceUri: string;
54
+ skillUrl: string;
55
+ recommendedTools: string[];
56
+ pitfalls: string[];
57
+ stripeProjectsOverride?: {
58
+ enforced: boolean;
59
+ canonicalToolSlug: string;
60
+ reason: string;
61
+ };
62
+ }
63
+ export declare function getProviderSkillHint(toolOrProviderSlug: string, baseUrl?: string): MuxoDomainSkillHint | null;
64
+ export declare function buildMuxoMcpSkillBundles(baseUrl?: string, options?: {
65
+ includeAll?: boolean;
66
+ }): MuxoMcpSkillBundle[];