@muxoai/sdk 1.4.3 → 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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";
@@ -119,6 +120,7 @@ Set or inspect them via MCP \`get_run_context({ action: "set_guardrail", prompt:
119
120
  - \`muxo://governance/policy\` — Active guardrails, kill-switch status, trust score, and \`llmPolicyBrief\`
120
121
  - \`muxo://context\` — Live workspace context, active guardrails, provisioned resources, and \`llmSystemPrompt\`
121
122
  - \`muxo://memory/graph\` — Active Supermemory defaults and bi-temporal knowledge graph facts
123
+ - \`muxo://skills\` & \`muxo://skills/{skillSlug}\` — Governed domain & workflow skills catalog (140+ app, cloud provisioning, and multi-app workflow \`SKILL.md\` playbooks)
122
124
  - **MCP Prompts (\`prompts/list\` & \`prompts/get\`)**:
123
125
  - \`context\` — Inject workspace memory, active defaults, and guardrail summary
124
126
  - \`policy_guardrails\` — Inject the active \`llmSystemDirective\`, risk-lane matrix, and optional dry-run policy simulation for \`tool_slug\`
@@ -134,6 +136,16 @@ Teach preferences in plain English and Muxo auto-fills matching tool inputs on e
134
136
  - "What do you remember?"
135
137
 
136
138
  \`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.
139
+
140
+ ## Natural-Language Saga Playbooks, Temporal Rollbacks, Cedar, OTel & One-Shot Harness Config
141
+
142
+ Pass plain English to \`POST /api/v1/do\` or MCP \`get_run_context({ prompt: "..." })\`:
143
+ - **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\`)
144
+ - **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\`)
145
+ - **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\`)
146
+ - **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\`)
147
+ - **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\`)
148
+ - **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
149
  `;
138
150
  }
139
151
  async function readBody(req) {
@@ -708,7 +720,10 @@ export function createMuxoServer(customConfig) {
708
720
  },
709
721
  "/api/v1/byok/{provider}": { delete: { summary: "Delete a BYOK provider key from the vault" } },
710
722
  "/api/v1/tools": { get: { summary: "Search unified catalogue across instant.*, app.*, and resource.*" } },
711
- "/api/v1/tools/{slug}": { get: { summary: "Inspect tool schema, risk level, credit cost, and LLM context URL" } },
723
+ "/api/v1/tools/{slug}": { get: { summary: "Inspect tool schema, risk level, credit cost, domainSkill pitfalls, and LLM context URL" } },
724
+ "/api/v1/skills": { get: { summary: "List governed domain, cloud provisioning, and multi-app workflow skills" } },
725
+ "/api/v1/skills/{slug}": { get: { summary: "Inspect governed domain or workflow skill definition and SKILL.md markdown" } },
726
+ "/skills/{slug}/SKILL.md": { get: { summary: "Download governed SKILL.md markdown bundle for any app, cloud provider, or workflow" } },
712
727
  "/api/v1/connections": {
713
728
  get: { summary: "List connected OAuth accounts and cloud providers" },
714
729
  post: { summary: "Start managed OAuth connection handoff" },
@@ -825,9 +840,25 @@ Users purchase Muxo Credits (\`POST /api/v1/billing/topup\` or \`muxo billing to
825
840
  res.end(renderSkillMarkdown(config.baseUrl));
826
841
  return;
827
842
  }
843
+ const publicSkillMatch = pathname.match(/^\/skills\/([^/]+?)(?:\/SKILL\.md|\.md)$/i);
844
+ if (publicSkillMatch && req.method === "GET") {
845
+ const slug = decodeURIComponent(publicSkillMatch[1]);
846
+ const md = renderMuxoSkillMarkdown(slug, config.baseUrl);
847
+ if (!md) {
848
+ sendJson(res, 404, {
849
+ ok: false,
850
+ code: "SKILL_NOT_FOUND",
851
+ error: `Skill not found: ${slug}`,
852
+ });
853
+ return;
854
+ }
855
+ res.writeHead(200, { "Content-Type": "text/markdown; charset=utf-8" });
856
+ res.end(md);
857
+ return;
858
+ }
828
859
  if (pathname === "/llms.txt" && req.method === "GET") {
829
860
  res.writeHead(200, { "Content-Type": "text/plain; charset=utf-8" });
830
- 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`);
861
+ 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- Domain & Workflow Skills Catalog: ${config.baseUrl}/api/v1/skills (or ${config.baseUrl}/skills/<slug>/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" | "skills" | "get_skill" | "reconcile_run"\`\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\`, \`muxo://skills\`, \`muxo://skills/{skillSlug}\`\n- MCP Prompts: \`context\`, \`policy_guardrails\`, \`governed_execution\`, \`security_audit\`\n`);
831
862
  return;
832
863
  }
833
864
  // Serve Installable Muxo Plugin Manifests & Metadata (Portable OpenAI Agent Plugins + Codex + Claude + Cursor)
@@ -3014,6 +3045,13 @@ Users purchase Muxo Credits (\`POST /api/v1/billing/topup\` or \`muxo billing to
3014
3045
  sendJson(res, 200, cancelled);
3015
3046
  return;
3016
3047
  }
3048
+ const runReconcileMatch = pathname.match(/^\/api\/v1\/runs\/([^/]+)\/reconcile$/);
3049
+ if (runReconcileMatch && (req.method === "GET" || req.method === "POST")) {
3050
+ const runOrPlanId = decodeURIComponent(runReconcileMatch[1]);
3051
+ const report = engine.reconcileRun(ctx, runOrPlanId);
3052
+ sendJson(res, 200, report);
3053
+ return;
3054
+ }
3017
3055
  const runGetMatch = pathname.match(/^\/api\/v1\/runs\/([^/]+)$/);
3018
3056
  if (runGetMatch && req.method === "GET") {
3019
3057
  const runId = decodeURIComponent(runGetMatch[1]);
@@ -3052,8 +3090,11 @@ Users purchase Muxo Credits (\`POST /api/v1/billing/topup\` or \`muxo billing to
3052
3090
  }
3053
3091
  if (pathname === "/api/v1/byok" && req.method === "POST") {
3054
3092
  const body = JSON.parse((await readBody(req)) || "{}");
3055
- const provider = String(body.provider || "").trim();
3056
- const secretKey = String(body.secretKey || body.apiKey || body.key || "").trim();
3093
+ const provider = String(body.providerSlug || body.provider_slug || body.provider || "").trim();
3094
+ const secretKey = String(body.secretKey || body.secret_key || body.apiKey || body.api_key || body.key || "").trim();
3095
+ const mcpGatewayUrl = body.mcpGatewayUrl || body.mcp_gateway_url
3096
+ ? String(body.mcpGatewayUrl || body.mcp_gateway_url).trim()
3097
+ : null;
3057
3098
  if (!provider || !secretKey) {
3058
3099
  sendJson(res, 400, {
3059
3100
  ok: false,
@@ -3061,7 +3102,9 @@ Users purchase Muxo Credits (\`POST /api/v1/billing/topup\` or \`muxo billing to
3061
3102
  });
3062
3103
  return;
3063
3104
  }
3064
- const record = store.setByokKey(ctx.workspace.id, provider, secretKey);
3105
+ const record = store.setByokKey(ctx.workspace.id, provider, secretKey, {
3106
+ mcpGatewayUrl,
3107
+ });
3065
3108
  sendJson(res, 201, {
3066
3109
  ok: true,
3067
3110
  key: record,
@@ -3636,8 +3679,44 @@ Users purchase Muxo Credits (\`POST /api/v1/billing/topup\` or \`muxo billing to
3636
3679
  sendJson(res, 200, { ok: true, ...otel });
3637
3680
  return;
3638
3681
  }
3682
+ if (pathname === "/api/v1/skills" && req.method === "GET") {
3683
+ const category = url.searchParams.get("category") || undefined;
3684
+ const provider = url.searchParams.get("provider") || undefined;
3685
+ const query = url.searchParams.get("q") ||
3686
+ url.searchParams.get("query") ||
3687
+ undefined;
3688
+ const skills = listMuxoSkills({ category, provider, query }, config.baseUrl);
3689
+ sendJson(res, 200, {
3690
+ ok: true,
3691
+ count: skills.length,
3692
+ skills,
3693
+ });
3694
+ return;
3695
+ }
3696
+ const apiSkillMatch = pathname.match(/^\/api\/v1\/skills\/([^/]+)$/);
3697
+ if (apiSkillMatch && req.method === "GET") {
3698
+ const slug = decodeURIComponent(apiSkillMatch[1]).replace(/\.md$/i, "");
3699
+ const skill = getMuxoSkill(slug, config.baseUrl);
3700
+ const markdown = renderMuxoSkillMarkdown(slug, config.baseUrl);
3701
+ if (!skill || !markdown) {
3702
+ sendJson(res, 404, {
3703
+ ok: false,
3704
+ code: "SKILL_NOT_FOUND",
3705
+ error: `Skill not found: ${slug}`,
3706
+ });
3707
+ return;
3708
+ }
3709
+ sendJson(res, 200, {
3710
+ ok: true,
3711
+ skill,
3712
+ markdown,
3713
+ skillUrl: `${config.baseUrl}/skills/${skill.slug}/SKILL.md`,
3714
+ mcpResourceUri: `muxo://skills/${skill.slug}`,
3715
+ });
3716
+ return;
3717
+ }
3639
3718
  if (pathname === "/api/v1/playbooks" && req.method === "GET") {
3640
- const playbooks = engine.listCommercialPlaybooks();
3719
+ const playbooks = engine.listCommercialPlaybooks(ctx);
3641
3720
  sendJson(res, 200, {
3642
3721
  ok: true,
3643
3722
  count: playbooks.length,
@@ -3645,13 +3724,22 @@ Users purchase Muxo Credits (\`POST /api/v1/billing/topup\` or \`muxo billing to
3645
3724
  });
3646
3725
  return;
3647
3726
  }
3727
+ if (pathname === "/api/v1/playbooks" && req.method === "POST") {
3728
+ const body = JSON.parse((await readBody(req)) || "{}");
3729
+ const created = engine.createCustomPlaybook(ctx, {
3730
+ prompt: body.prompt || body.instruction || body.description || "",
3731
+ input: body,
3732
+ });
3733
+ sendJson(res, 201, created);
3734
+ return;
3735
+ }
3648
3736
  const playbookRunMatch = pathname.match(/^\/api\/v1\/playbooks\/([^/]+)\/run$/);
3649
3737
  if ((playbookRunMatch || pathname === "/api/v1/playbooks/run") &&
3650
3738
  req.method === "POST") {
3651
3739
  const body = JSON.parse((await readBody(req)) || "{}");
3652
3740
  const slug = playbookRunMatch
3653
3741
  ? decodeURIComponent(playbookRunMatch[1])
3654
- : String(body.slug || body.playbook || "");
3742
+ : String(body.slug || body.playbook || body.prompt || "");
3655
3743
  const result = engine.runCommercialPlaybook(ctx, {
3656
3744
  slug,
3657
3745
  input: body.input && typeof body.input === "object"
@@ -3661,6 +3749,30 @@ Users purchase Muxo Credits (\`POST /api/v1/billing/topup\` or \`muxo billing to
3661
3749
  sendJson(res, 201, result);
3662
3750
  return;
3663
3751
  }
3752
+ if ((pathname === "/api/v1/harness/configure" ||
3753
+ pathname === "/api/v1/harness/presets") &&
3754
+ (req.method === "GET" || req.method === "POST")) {
3755
+ const body = req.method === "POST"
3756
+ ? JSON.parse((await readBody(req)) || "{}")
3757
+ : {};
3758
+ const preset = body.preset ||
3759
+ url.searchParams.get("preset") ||
3760
+ null;
3761
+ const harness = body.harness ||
3762
+ url.searchParams.get("harness") ||
3763
+ null;
3764
+ const prompt = body.prompt ||
3765
+ body.instruction ||
3766
+ url.searchParams.get("prompt") ||
3767
+ null;
3768
+ const configured = await engine.configureHarness(ctx, {
3769
+ preset: preset ? String(preset) : null,
3770
+ harness: harness ? String(harness) : null,
3771
+ prompt: prompt ? String(prompt) : null,
3772
+ });
3773
+ sendJson(res, 200, configured);
3774
+ return;
3775
+ }
3664
3776
  if ((pathname === "/api/v1/analytics/roi" ||
3665
3777
  pathname === "/api/v1/billing/roi") &&
3666
3778
  req.method === "GET") {
@@ -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[];