@muxoai/platform 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/index.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  export { getConfig, ROOT_DIR, type MuxoConfig } from "./config.js";
2
+ export * from "./durable-workflow.js";
2
3
  export { MuxoEngine, type ExecutionContext } from "./engine.js";
3
4
  export { handleJsonRpcMcpRequest, MUXO_MCP_TOOLS, type McpToolDefinition } from "./mcp.js";
5
+ export * from "./memory-graph.js";
6
+ export * from "./oss-suite.js";
4
7
  export { MuxoClient, type MuxoClientOptions } from "./sdk.js";
5
8
  export { createMuxoServer } from "./server.js";
6
9
  export { MuxoStore } from "./store.js";
package/dist/index.js CHANGED
@@ -1,6 +1,9 @@
1
1
  export { getConfig, ROOT_DIR } from "./config.js";
2
+ export * from "./durable-workflow.js";
2
3
  export { MuxoEngine } from "./engine.js";
3
4
  export { handleJsonRpcMcpRequest, MUXO_MCP_TOOLS } from "./mcp.js";
5
+ export * from "./memory-graph.js";
6
+ export * from "./oss-suite.js";
4
7
  export { MuxoClient } from "./sdk.js";
5
8
  export { createMuxoServer } from "./server.js";
6
9
  export { MuxoStore } from "./store.js";
@@ -202,6 +202,20 @@ export interface ApprovalGatePlan {
202
202
  toolSlug: string;
203
203
  riskLevel: string;
204
204
  approvalStatus: string;
205
+ creditCost?: number;
206
+ estimatedCostUsd?: number;
207
+ changePreview?: {
208
+ whatChanges: string;
209
+ whoIsAffected: string;
210
+ targetEntity: string;
211
+ estimatedCostUsd: number;
212
+ creditCost: number;
213
+ fundingMode: "muxo_funded" | "byok";
214
+ costDisplay: string;
215
+ triggeredRule: string;
216
+ reversibility: string;
217
+ recoveryBehavior: string;
218
+ };
205
219
  }
206
220
  export declare function buildApprovalUrl(baseUrl: string, planId: string): string;
207
221
  export declare function buildApprovalHumanHandoff(baseUrl: string, plan: ApprovalGatePlan): HumanHandoff;
@@ -266,9 +266,16 @@ export const MUXO_MCP_RESOURCE_TEMPLATES = [
266
266
  uriTemplate: "skill://muxo/{skillName}/SKILL.md",
267
267
  name: "Muxo Agent Skill Markdown (SEP-2640)",
268
268
  title: "Muxo Agent Skill Markdown (SEP-2640)",
269
- description: "Read the SKILL.md entry point for a published Muxo Agent Skill ('muxo' or 'setup').",
269
+ description: "Read the SKILL.md entry point for a published Muxo Agent Skill ('muxo', 'setup', or domain automation/provisioning skills such as 'github-automation', 'supabase-provisioning').",
270
270
  mimeType: "text/markdown",
271
271
  },
272
+ {
273
+ uriTemplate: "muxo://skills/{skillSlug}",
274
+ name: "Muxo Governed Domain & Workflow Skill (SKILL.md + Metadata)",
275
+ title: "Muxo Governed Domain & Workflow Skill (SKILL.md + Metadata)",
276
+ description: "Read a transpiled Muxo Governed Skill (e.g. muxo://skills/github-automation, muxo://skills/supabase-provisioning, muxo://skills/changelog-generator) with tool sequences, pitfalls, and zero-OAuth Stripe Projects overrides.",
277
+ mimeType: "application/json",
278
+ },
272
279
  ];
273
280
  /**
274
281
  * Evaluates MCP `completion/complete` requests for prompt arguments and resource templates.
@@ -280,8 +287,27 @@ export function completeMcpArgument(params, toolSlugs = []) {
280
287
  const argName = String(argObj.name || "").trim();
281
288
  const prefix = String(argObj.value || "").trim().toLowerCase();
282
289
  let candidates = [];
283
- if (argName === "skillName" || argName === "name") {
284
- candidates = ["muxo", "setup"];
290
+ if (argName === "skillName" || argName === "name" || argName === "skillSlug") {
291
+ candidates = [
292
+ "muxo",
293
+ "setup",
294
+ "github-automation",
295
+ "gmail-automation",
296
+ "slack-automation",
297
+ "notion-automation",
298
+ "linear-automation",
299
+ "hubspot-automation",
300
+ "salesforce-automation",
301
+ "shopify-automation",
302
+ "metaads-automation",
303
+ "stripe-automation",
304
+ "supabase-provisioning",
305
+ "vercel-provisioning",
306
+ "turso-provisioning",
307
+ "changelog-generator",
308
+ "lead-research-assistant",
309
+ "security-audit",
310
+ ];
285
311
  }
286
312
  else if (argName === "focus") {
287
313
  candidates = ["full", "pending_approvals", "billing", "receipts", "memory"];
@@ -631,8 +657,17 @@ export function buildApprovalHumanHandoff(baseUrl, plan) {
631
657
  const approvalUrl = buildApprovalUrl(baseUrl, plan.id);
632
658
  const ctaLabel = "Review & approve";
633
659
  const headline = `Muxo needs your approval to run ${plan.toolSlug}`;
634
- const instructions = `Open ${approvalUrl} to review and approve this ${plan.riskLevel}-risk action with one click (or run \`muxo approve ${plan.id}\`). Nothing runs until you approve.`;
635
- const markdownForUser = `### Muxo Approval Required\n**[${ctaLabel} in Muxo](${approvalUrl})**\n\nPlan \`${plan.id}\` (\`${plan.toolSlug}\` · **${plan.riskLevel} risk**) is held by your Muxo workspace guardrails. Open the link above to review and approve it in one click (or run \`muxo approve ${plan.id}\`). Nothing executes until you approve.`;
660
+ const preview = plan.changePreview;
661
+ const costSnippet = preview?.costDisplay
662
+ ? ` · Est. cost: ${preview.costDisplay}`
663
+ : typeof plan.creditCost === "number"
664
+ ? ` · Est. cost: $${((plan.creditCost || 0) * 0.01).toFixed(2)} USD (${plan.creditCost} cr)`
665
+ : "";
666
+ const instructions = `Open ${approvalUrl} to review and approve this ${plan.riskLevel}-risk action with one click (or run \`muxo approve ${plan.id}\`).${costSnippet} Nothing runs until you approve.`;
667
+ const previewMarkdown = preview
668
+ ? `\n\n- **What changes:** ${preview.whatChanges}\n- **Affected target:** ${preview.whoIsAffected}\n- **Estimated cost:** ${preview.costDisplay}\n- **Triggered guardrail:** ${preview.triggeredRule}`
669
+ : "";
670
+ const markdownForUser = `### Muxo Approval Required\n**[${ctaLabel} in Muxo](${approvalUrl})**\n\nPlan \`${plan.id}\` (\`${plan.toolSlug}\` · **${plan.riskLevel} risk**) is held by your Muxo workspace guardrails.${previewMarkdown}\n\nOpen the link above to review and approve it in one click (or run \`muxo approve ${plan.id}\`). Nothing executes until you approve.`;
636
671
  return {
637
672
  kind: "approval",
638
673
  brand: "Muxo",
@@ -1057,6 +1092,17 @@ export const MUXO_MCP_TOOLS = [
1057
1092
  "set_guardrail",
1058
1093
  "reset_guardrails",
1059
1094
  "check_policy",
1095
+ "cedar_policy",
1096
+ "otel_traces",
1097
+ "roi_analytics",
1098
+ "playbooks",
1099
+ "create_playbook",
1100
+ "run_playbook",
1101
+ "rollback_workflow",
1102
+ "signal_workflow",
1103
+ "workflow_history",
1104
+ "configure_harness",
1105
+ "harness_presets",
1060
1106
  "kill_switch",
1061
1107
  "governance_status",
1062
1108
  "scan_context",
@@ -1064,11 +1110,11 @@ export const MUXO_MCP_TOOLS = [
1064
1110
  "switch_workspace",
1065
1111
  "onboard_team",
1066
1112
  ],
1067
- description: "Control-plane operation: 'inspect' (default), 'remember' (save fact/preference), 'recall' (list memories), 'forget' (delete matching memories), 'memory_graph' (bi-temporal entity/relationship lineage), 'set_guardrail' (apply plain-English or structured parameter_rules guardrail), 'reset_guardrails' (restore default safe guardrails), 'check_policy' (dry-run evaluate tool_slug + input against policy and parameter guardrails before planning), 'kill_switch' (pause/resume agent execution), 'governance_status' (Microsoft 9-module status + LLM policy brief), 'scan_context' (OWASP ASI-06 check), 'list_workspaces', 'switch_workspace', or 'onboard_team'",
1113
+ description: "Control-plane operation (or omit action and pass any plain-English prompt): 'inspect' (default), 'remember' (save fact/preference), 'recall' (list memories), 'forget' (delete matching memories), 'memory_graph' (Graphiti bi-temporal entity/relationship lineage with optional as_of time-travel & focal_entity 2-hop BFS), 'set_guardrail' (apply plain-English or structured parameter_rules guardrail), 'reset_guardrails' (restore default safe guardrails), 'check_policy' (dry-run evaluate tool_slug + input against policy and parameter guardrails before planning), 'cedar_policy' (compile/evaluate AWS Cedar & OPA Rego policy-as-code), 'otel_traces' (export W3C OpenTelemetry GenAI/MCP spans & Langfuse batch), 'roi_analytics' (FinOps & BYOK unit-economics ROI report), 'playbooks' / 'create_playbook' / 'run_playbook' (list, author custom, or execute multi-step Temporal Saga playbooks), 'rollback_workflow' / 'signal_workflow' / 'workflow_history' (Temporal workflow lifecycle; accepts workflow_id='latest'), 'configure_harness' / 'harness_presets' (apply turnkey harness presets like startup-builder, strict-production, read-only-auditor, finops-byok-zero-cost and generate ready-to-paste harness config blocks), 'kill_switch' (pause/resume agent execution), 'governance_status' (Microsoft 9-module status + LLM policy brief), 'scan_context' (OWASP ASI-06 check), 'list_workspaces', 'switch_workspace', or 'onboard_team'",
1068
1114
  },
1069
1115
  prompt: {
1070
1116
  type: "string",
1071
- description: "Natural-language instruction when action is 'remember', 'set_guardrail', 'kill_switch', or 'scan_context' (e.g. 'Only allow sending emails to @muxo.ai' or 'Require approval for Stripe refunds over $50, auto-approve under $50')",
1117
+ description: "Plain-English instruction for any control-plane or OSS operation (e.g. 'Run the fullstack cloud bootstrap playbook for acme', 'Rollback the latest workflow because staging failed', 'Show my knowledge graph as of yesterday within 2 hops of workspace', 'Configure harness preset strict-production', or 'Only allow sending emails to @muxo.ai')",
1072
1118
  },
1073
1119
  tool_slug: {
1074
1120
  type: "string",
@@ -1161,6 +1207,38 @@ export const MUXO_MCP_TOOLS = [
1161
1207
  type: "boolean",
1162
1208
  description: "If true, attach the Bi-Temporal Knowledge Graph (nodes, activeEdges, historicalEdges, mermaid) to the context response",
1163
1209
  },
1210
+ as_of: {
1211
+ type: "string",
1212
+ description: "Optional ISO-8601 timestamp for Graphiti point-in-time ('as-of') bi-temporal knowledge graph reconstruction",
1213
+ },
1214
+ focal_entity: {
1215
+ type: "string",
1216
+ description: "Optional entity ID or label for k-hop BFS neighborhood subgraph extraction",
1217
+ },
1218
+ max_hops: {
1219
+ type: "number",
1220
+ description: "Maximum BFS traversal hops around focal_entity (1 to 4, default 2)",
1221
+ },
1222
+ slug: {
1223
+ type: "string",
1224
+ description: "Optional playbook slug or natural-language name when action='run_playbook' (e.g. 'fullstack-cloud-bootstrap', 'competitor-seo-growth-brief', 'incident-containment-audit', 'customer-release-readiness')",
1225
+ },
1226
+ workflow_id: {
1227
+ type: "string",
1228
+ description: "Workflow ID or 'latest' when action is 'rollback_workflow', 'signal_workflow', or 'workflow_history'",
1229
+ },
1230
+ signal_name: {
1231
+ type: "string",
1232
+ description: "Temporal signal name when action='signal_workflow' (default: 'human.approval.granted')",
1233
+ },
1234
+ preset: {
1235
+ type: "string",
1236
+ description: "Turnkey harness preset slug when action='configure_harness' ('startup-builder', 'strict-production', 'read-only-auditor', 'finops-byok-zero-cost')",
1237
+ },
1238
+ harness: {
1239
+ type: "string",
1240
+ description: "Target agent harness when action='configure_harness' ('claude-code', 'cursor', 'codex', 'chatgpt', 'claude-desktop', 'factory-droid', or 'all')",
1241
+ },
1164
1242
  plan_id: {
1165
1243
  type: "string",
1166
1244
  description: "Optional plan ID to inspect context for",
package/dist/mcp.js CHANGED
@@ -3,6 +3,7 @@ import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import { ROOT_DIR } from "./config.js";
5
5
  import { APPROVED_PLAN_STATUSES, DEFAULT_LEGACY_MCP_PROTOCOL_VERSION, DEFAULT_TOOL_SECURITY_SCHEMES, LATEST_MCP_PROTOCOL_VERSION, MCP_ERR_HEADER_MISMATCH, MCP_ERR_MISSING_REQUIRED_CLIENT_CAPABILITY, MCP_ERR_UNSUPPORTED_PROTOCOL_VERSION, MUXO_MCP_RESOURCE_TEMPLATES, MUXO_MCP_SERVER_INSTRUCTIONS, MUXO_MCP_TOOLS, MUXO_UI_MCP_APP_URI, MUXO_UI_RESOURCES, MUXO_UI_WIDGET_URI, OPENAI_COMPANY_KNOWLEDGE_TOOLS, PUBLIC_MCP_TOOL_NAMES, PUBLIC_TOOL_SECURITY_SCHEMES, SUPPORTED_MCP_PROTOCOL_VERSIONS, UI_RENDERED_MCP_TOOL_NAMES, attachMcpHarnessGuidance, MuxoToolError, buildApprovalUrl, buildMcpDiscoverResult, buildMcpErrorResultMeta, buildMcpToolDescriptor, buildMcpToolResultMeta, buildOnboardTeamGuide, clampWaitSeconds, completeMcpArgument, decodeMcpHeaderValue, errorPayloadFrom, extractOpenAiClientMeta, findMcpSkill, isSupportedMcpProtocolVersion, renderMuxoUiWidgetHtml, securitySchemesForTool, validateMcpHttpHeadersAndMeta, } from "./mcp-schema.js";
6
+ import { buildMuxoMcpSkillBundles, getMuxoSkill, listMuxoSkills, renderMuxoSkillMarkdown, } from "./skills-catalog.js";
6
7
  import { MUXO_VERSION } from "./version.js";
7
8
  export { DEFAULT_LEGACY_MCP_PROTOCOL_VERSION, DEFAULT_TOOL_SECURITY_SCHEMES, LATEST_MCP_PROTOCOL_VERSION, MCP_ERR_HEADER_MISMATCH, MCP_ERR_MISSING_REQUIRED_CLIENT_CAPABILITY, MCP_ERR_UNSUPPORTED_PROTOCOL_VERSION, MUXO_MCP_RESOURCE_TEMPLATES, MUXO_MCP_SERVER_INSTRUCTIONS, MUXO_MCP_TOOLS, MUXO_UI_MCP_APP_URI, MUXO_UI_RESOURCES, MUXO_UI_WIDGET_URI, OPENAI_COMPANY_KNOWLEDGE_TOOLS, PUBLIC_MCP_TOOL_NAMES, PUBLIC_TOOL_SECURITY_SCHEMES, SUPPORTED_MCP_PROTOCOL_VERSIONS, UI_RENDERED_MCP_TOOL_NAMES, attachMcpHarnessGuidance, buildMcpDiscoverResult, buildMcpErrorResultMeta, buildMcpToolDescriptor, buildMcpToolResultMeta, completeMcpArgument, decodeMcpHeaderValue, extractOpenAiClientMeta, isSupportedMcpProtocolVersion, renderMuxoUiWidgetHtml, securitySchemesForTool, validateMcpHttpHeadersAndMeta, };
8
9
  function sha256Digest(content) {
@@ -123,6 +124,24 @@ Call \`get_profile\` and \`get_organization\` to verify your workspace connectio
123
124
  const setupName = setupFm.name || "setup";
124
125
  const setupDesc = setupFm.description ||
125
126
  "Guided onboarding skill for setting up the Muxo plugin in OpenAI ChatGPT and Codex.";
127
+ const catalogBundles = buildMuxoMcpSkillBundles().map((bundle) => {
128
+ const fileEntries = bundle.files.map((f) => ({
129
+ path: f.path,
130
+ uri: f.uri,
131
+ size: Buffer.byteLength(f.content, "utf8"),
132
+ digest: sha256Digest(f.content),
133
+ mimeType: f.mimeType,
134
+ content: f.content,
135
+ }));
136
+ return {
137
+ name: bundle.name,
138
+ description: bundle.description,
139
+ uri: bundle.uri,
140
+ version: fileEntries[0].digest,
141
+ frontmatter: bundle.frontmatter,
142
+ files: fileEntries,
143
+ };
144
+ });
126
145
  return [
127
146
  {
128
147
  name: muxoName,
@@ -146,6 +165,7 @@ Call \`get_profile\` and \`get_organization\` to verify your workspace connectio
146
165
  },
147
166
  files: setupFiles,
148
167
  },
168
+ ...catalogBundles,
149
169
  ];
150
170
  }
151
171
  export async function dispatchMcpToolCall(engine, ctx, toolName, args = {}) {
@@ -223,8 +243,102 @@ export async function dispatchMcpToolCall(engine, ctx, toolName, args = {}) {
223
243
  : Array.isArray(args.parameterRules)
224
244
  ? args.parameterRules
225
245
  : undefined;
246
+ const asOf = args.as_of || args.asOf ? String(args.as_of || args.asOf) : null;
247
+ const focalEntity = args.focal_entity || args.focalEntity
248
+ ? String(args.focal_entity || args.focalEntity)
249
+ : null;
250
+ const rawMaxHops = args.max_hops ?? args.maxHops;
251
+ const maxHops = rawMaxHops !== undefined && rawMaxHops !== null
252
+ ? Number(rawMaxHops)
253
+ : undefined;
226
254
  if (action === "memory_graph") {
227
- return engine.getMemoryGraph(ctx, query);
255
+ return engine.getMemoryGraph(ctx, {
256
+ query,
257
+ asOf,
258
+ focalEntity,
259
+ maxHops,
260
+ });
261
+ }
262
+ if (action === "cedar_policy" || action === "policy_as_code") {
263
+ if (args.tool_slug || args.slug) {
264
+ return engine.evaluatePolicyAsCode(ctx, {
265
+ toolSlug: String(args.tool_slug || args.slug),
266
+ input: (args.input || args.arguments) || {},
267
+ });
268
+ }
269
+ return engine.getPolicyAsCodeBundle(ctx);
270
+ }
271
+ if (action === "otel_traces" || action === "telemetry") {
272
+ return engine.exportOtelTraces(ctx, Number(args.limit || 25));
273
+ }
274
+ if (action === "roi_analytics" || action === "roi") {
275
+ return engine.getCommercialRoiReport(ctx);
276
+ }
277
+ if (action === "playbooks") {
278
+ return {
279
+ ok: true,
280
+ playbooks: engine.listCommercialPlaybooks(ctx),
281
+ };
282
+ }
283
+ if (action === "create_playbook") {
284
+ return engine.createCustomPlaybook(ctx, {
285
+ prompt: prompt || query || String(args.slug || ""),
286
+ input: (args.input || args.arguments) || {},
287
+ });
288
+ }
289
+ if (action === "run_playbook") {
290
+ const slug = String(args.slug ||
291
+ args.playbook ||
292
+ query ||
293
+ prompt ||
294
+ "fullstack-cloud-bootstrap").trim();
295
+ return engine.runCommercialPlaybook(ctx, {
296
+ slug,
297
+ input: (args.input || args.arguments) || {},
298
+ });
299
+ }
300
+ if (action === "rollback_workflow") {
301
+ const wfId = String(args.workflow_id || args.workflowId || args.slug || query || "latest").trim();
302
+ const rolledBack = engine.rollbackDurableWorkflow(ctx, wfId, {
303
+ reason: prompt || query || undefined,
304
+ });
305
+ return {
306
+ ok: true,
307
+ action: "rollback_workflow",
308
+ workflow: rolledBack,
309
+ };
310
+ }
311
+ if (action === "signal_workflow") {
312
+ const wfId = String(args.workflow_id || args.workflowId || args.slug || "latest").trim();
313
+ const signalName = String(args.signal_name ||
314
+ args.signalName ||
315
+ query ||
316
+ "human.approval.granted").trim();
317
+ const signaled = engine.signalDurableWorkflow(ctx, wfId, {
318
+ signalName,
319
+ payload: (args.input || args.arguments) || {},
320
+ });
321
+ return {
322
+ ok: true,
323
+ action: "signal_workflow",
324
+ workflow: signaled,
325
+ };
326
+ }
327
+ if (action === "workflow_history") {
328
+ const wfId = String(args.workflow_id || args.workflowId || args.slug || query || "latest").trim();
329
+ return {
330
+ ok: true,
331
+ action: "workflow_history",
332
+ workflow: engine.getDurableWorkflow(ctx, wfId),
333
+ history: engine.getDurableWorkflowHistory(ctx, wfId),
334
+ };
335
+ }
336
+ if (action === "configure_harness" || action === "harness_presets") {
337
+ return engine.configureHarness(ctx, {
338
+ preset: args.preset ? String(args.preset) : query || null,
339
+ harness: args.harness ? String(args.harness) : null,
340
+ prompt: prompt || null,
341
+ });
228
342
  }
229
343
  if (action === "governance_status") {
230
344
  return engine.getGovernanceOverview(ctx);
@@ -338,12 +452,21 @@ export async function dispatchMcpToolCall(engine, ctx, toolName, args = {}) {
338
452
  explanation: overview.explanation,
339
453
  };
340
454
  }
341
- if (prompt && !action) {
342
- return engine.doNaturalLanguage(ctx, { prompt });
455
+ if (prompt && (!action || action === "inspect")) {
456
+ return engine.doNaturalLanguage(ctx, {
457
+ prompt,
458
+ input: (args.input || args.arguments) ||
459
+ undefined,
460
+ });
343
461
  }
344
462
  const runCtx = await engine.getRunContext(ctx, query);
345
463
  if (args.include_graph === true) {
346
- const memoryGraph = await engine.getMemoryGraph(ctx, query);
464
+ const memoryGraph = await engine.getMemoryGraph(ctx, {
465
+ query,
466
+ asOf,
467
+ focalEntity,
468
+ maxHops,
469
+ });
347
470
  return { ...runCtx, memoryGraph };
348
471
  }
349
472
  return runCtx;
@@ -425,7 +548,16 @@ export async function dispatchMcpToolCall(engine, ctx, toolName, args = {}) {
425
548
  return engine.forgetWorkspaceMemoryMatching(ctx, query);
426
549
  }
427
550
  case "memory_graph":
428
- return engine.getMemoryGraph(ctx, args.query ? String(args.query) : undefined);
551
+ return engine.getMemoryGraph(ctx, {
552
+ query: args.query ? String(args.query) : undefined,
553
+ asOf: args.as_of || args.asOf ? String(args.as_of || args.asOf) : null,
554
+ focalEntity: args.focal_entity || args.focalEntity
555
+ ? String(args.focal_entity || args.focalEntity)
556
+ : null,
557
+ maxHops: args.max_hops !== undefined || args.maxHops !== undefined
558
+ ? Number(args.max_hops ?? args.maxHops)
559
+ : undefined,
560
+ });
429
561
  case "set_guardrail":
430
562
  case "configure_guardrails": {
431
563
  const rawParamRules = Array.isArray(args.parameter_rules)
@@ -674,6 +806,35 @@ export async function handleJsonRpcMcpRequest(engine, ctx, rpc) {
674
806
  description: "Load the structured LLM Policy & Governance Brief (riskLaneMatrix, conditional parameterRules with compliance guidance, budget caps, kill switch status, and control-plane commands).",
675
807
  arguments: [],
676
808
  },
809
+ {
810
+ name: "harness_setup",
811
+ title: "Turnkey Agent Harness Configuration & Natural-Language Cheatsheet",
812
+ description: "Generate ready-to-paste MCP configuration snippets, system prompt directives, turnkey governance presets (startup-builder, strict-production, read-only-auditor, finops-byok-zero-cost), and natural-language cheatsheets for Claude Code, Cursor, Codex, ChatGPT, Claude Desktop, and Factory Droid.",
813
+ arguments: [
814
+ {
815
+ name: "preset",
816
+ description: "Optional preset slug ('startup-builder', 'strict-production', 'read-only-auditor', 'finops-byok-zero-cost')",
817
+ required: false,
818
+ },
819
+ {
820
+ name: "harness",
821
+ description: "Optional target harness ('claude-code', 'cursor', 'codex', 'chatgpt', 'claude-desktop', 'factory-droid')",
822
+ required: false,
823
+ },
824
+ ],
825
+ },
826
+ {
827
+ name: "commercial_playbook",
828
+ title: "Multi-Step Temporal Saga Playbook Runner & Author",
829
+ description: "List, create, or execute multi-step Temporal-compatible Saga playbooks with automatic LIFO rollback compensations.",
830
+ arguments: [
831
+ {
832
+ name: "playbook",
833
+ description: "Playbook slug or plain-English description (e.g. 'fullstack-cloud-bootstrap', 'competitor-seo-growth-brief', 'incident-containment-audit', 'customer-release-readiness')",
834
+ required: false,
835
+ },
836
+ ],
837
+ },
677
838
  ],
678
839
  },
679
840
  };
@@ -782,6 +943,59 @@ export async function handleJsonRpcMcpRequest(engine, ctx, rpc) {
782
943
  },
783
944
  };
784
945
  }
946
+ if (promptName === "harness_setup") {
947
+ const bundle = await engine.configureHarness(ctx, {
948
+ preset: promptArgs.preset ? String(promptArgs.preset) : null,
949
+ harness: promptArgs.harness ? String(promptArgs.harness) : null,
950
+ });
951
+ return {
952
+ jsonrpc: "2.0",
953
+ id,
954
+ result: {
955
+ resultType: "complete",
956
+ description: "Turnkey Agent Harness Configuration, Presets, and Natural-Language Cheatsheet",
957
+ messages: [
958
+ {
959
+ role: "user",
960
+ content: {
961
+ type: "text",
962
+ text: [
963
+ bundle.systemPromptDirective,
964
+ `### Harness Configuration Bundle (JSON)\n\`\`\`json\n${JSON.stringify(bundle, null, 2)}\n\`\`\``,
965
+ ].join("\n\n"),
966
+ },
967
+ },
968
+ ],
969
+ },
970
+ };
971
+ }
972
+ if (promptName === "commercial_playbook") {
973
+ const playbooks = engine.listCommercialPlaybooks(ctx);
974
+ const requested = promptArgs.playbook ? String(promptArgs.playbook) : "";
975
+ return {
976
+ jsonrpc: "2.0",
977
+ id,
978
+ result: {
979
+ resultType: "complete",
980
+ description: "Multi-Step Temporal Saga Playbook Runner & Author",
981
+ messages: [
982
+ {
983
+ role: "user",
984
+ content: {
985
+ type: "text",
986
+ text: [
987
+ `# Muxo Multi-Step Temporal Saga Playbooks`,
988
+ requested
989
+ ? `Requested Playbook: **${requested}** — call \`get_run_context({ prompt: "Run the ${requested} playbook" })\` or \`get_run_context({ action: "run_playbook", slug: "${requested}" })\`.`
990
+ : `Call \`get_run_context({ prompt: "Run the fullstack cloud bootstrap playbook" })\` or create a custom playbook in plain English with \`get_run_context({ prompt: "Create playbook daily-seo-slack that runs instant.seo.audit and app.slack.send_message" })\`.`,
991
+ `### Available Playbooks (${playbooks.length})\n\`\`\`json\n${JSON.stringify(playbooks, null, 2)}\n\`\`\``,
992
+ ].join("\n\n"),
993
+ },
994
+ },
995
+ ],
996
+ },
997
+ };
998
+ }
785
999
  return {
786
1000
  jsonrpc: "2.0",
787
1001
  id,
@@ -968,6 +1182,24 @@ export async function handleJsonRpcMcpRequest(engine, ctx, rpc) {
968
1182
  description: "Tamper-evident SHA-256 + portable Ed25519 AgenticReceipt chain verification report.",
969
1183
  mimeType: "application/json",
970
1184
  },
1185
+ {
1186
+ uri: "muxo://harness/config",
1187
+ name: "Turnkey Agent Harness Configuration & Presets",
1188
+ description: "Ready-to-paste MCP config snippets, system prompt directives, turnkey governance presets, and natural-language cheatsheet for Claude Code, Cursor, Codex, ChatGPT, Claude Desktop, and Factory Droid.",
1189
+ mimeType: "application/json",
1190
+ },
1191
+ {
1192
+ uri: "muxo://playbooks",
1193
+ name: "Multi-Step Temporal Saga Playbooks",
1194
+ description: "Turnkey and custom workspace Temporal-compatible Saga playbooks with LIFO rollback compensation actions.",
1195
+ mimeType: "application/json",
1196
+ },
1197
+ {
1198
+ uri: "muxo://skills",
1199
+ name: "Muxo Governed Domain & Workflow Skills Catalog",
1200
+ description: "Catalog of transpiled domain automation, zero-OAuth cloud infrastructure (Stripe Projects), and multi-app workflow skills with pitfalls and tool sequences.",
1201
+ mimeType: "application/json",
1202
+ },
971
1203
  ];
972
1204
  return {
973
1205
  jsonrpc: "2.0",
@@ -1159,6 +1391,94 @@ export async function handleJsonRpcMcpRequest(engine, ctx, rpc) {
1159
1391
  },
1160
1392
  };
1161
1393
  }
1394
+ if (uri === "muxo://harness/config") {
1395
+ const bundle = await engine.configureHarness(ctx);
1396
+ return {
1397
+ jsonrpc: "2.0",
1398
+ id,
1399
+ result: {
1400
+ resultType: "complete",
1401
+ ttlMs: 60_000,
1402
+ cacheScope: "private",
1403
+ contents: [
1404
+ {
1405
+ uri,
1406
+ mimeType: "application/json",
1407
+ text: JSON.stringify(bundle, null, 2),
1408
+ },
1409
+ ],
1410
+ },
1411
+ };
1412
+ }
1413
+ if (uri === "muxo://playbooks") {
1414
+ const playbooks = engine.listCommercialPlaybooks(ctx);
1415
+ return {
1416
+ jsonrpc: "2.0",
1417
+ id,
1418
+ result: {
1419
+ resultType: "complete",
1420
+ ttlMs: 60_000,
1421
+ cacheScope: "private",
1422
+ contents: [
1423
+ {
1424
+ uri,
1425
+ mimeType: "application/json",
1426
+ text: JSON.stringify({ ok: true, playbooks }, null, 2),
1427
+ },
1428
+ ],
1429
+ },
1430
+ };
1431
+ }
1432
+ if (uri === "muxo://skills") {
1433
+ const skills = listMuxoSkills();
1434
+ return {
1435
+ jsonrpc: "2.0",
1436
+ id,
1437
+ result: {
1438
+ resultType: "complete",
1439
+ ttlMs: 60_000,
1440
+ cacheScope: "private",
1441
+ contents: [
1442
+ {
1443
+ uri,
1444
+ mimeType: "application/json",
1445
+ text: JSON.stringify({ ok: true, count: skills.length, skills }, null, 2),
1446
+ },
1447
+ ],
1448
+ },
1449
+ };
1450
+ }
1451
+ if (uri.startsWith("muxo://skills/")) {
1452
+ const skillSlug = decodeURIComponent(uri.slice("muxo://skills/".length)).trim();
1453
+ const skillDef = getMuxoSkill(skillSlug);
1454
+ const markdown = renderMuxoSkillMarkdown(skillSlug);
1455
+ if (!skillDef || !markdown) {
1456
+ return {
1457
+ jsonrpc: "2.0",
1458
+ id,
1459
+ error: {
1460
+ code: -32602,
1461
+ message: `Resource not found: ${uri}`,
1462
+ },
1463
+ };
1464
+ }
1465
+ return {
1466
+ jsonrpc: "2.0",
1467
+ id,
1468
+ result: {
1469
+ resultType: "complete",
1470
+ ttlMs: 300_000,
1471
+ cacheScope: "public",
1472
+ contents: [
1473
+ {
1474
+ uri,
1475
+ mimeType: "application/json",
1476
+ text: JSON.stringify({ ok: true, skill: skillDef, markdown }, null, 2),
1477
+ },
1478
+ ],
1479
+ },
1480
+ };
1481
+ }
1162
1482
  if (uri.startsWith("muxo://tools/")) {
1163
1483
  const slug = decodeURIComponent(uri.slice("muxo://tools/".length)).trim();
1164
1484
  try {
@@ -1,4 +1,4 @@
1
- import type { ConnectionRecord, GovernancePolicy, MemoryKnowledgeGraph, ProvisionedResource, TemporalGraphFact } from "./types.js";
1
+ import type { ConnectionRecord, GovernancePolicy, MemoryGraphEdge, MemoryGraphNode, MemoryKnowledgeGraph, ProvisionedResource, TemporalGraphFact } from "./types.js";
2
2
  export interface MemoryGraphInput {
3
3
  workspace: {
4
4
  id: string;
@@ -9,13 +9,37 @@ export interface MemoryGraphInput {
9
9
  };
10
10
  namespace: string;
11
11
  query?: string;
12
+ asOf?: string | null;
13
+ focalEntity?: string | null;
14
+ maxHops?: number;
12
15
  facts: TemporalGraphFact[];
13
16
  resources: Array<Pick<ProvisionedResource, "resourceName" | "status" | "providerName" | "serviceSlug">>;
14
17
  activeConnections: Array<Pick<ConnectionRecord, "id" | "providerSlug" | "providerName" | "createdAt">>;
15
18
  memoriesCount: number;
16
19
  }
17
20
  /**
18
- * Builds the bi-temporal knowledge graph (nodes, active/historical edges, Mermaid preview)
21
+ * Graphiti-style Point-in-Time ("As-Of") Bi-Temporal Fact Filter.
22
+ * Reconstructs which facts were active at `asOf` vs. already retired by `asOf`,
23
+ * excluding facts created after `asOf`.
24
+ */
25
+ export declare function filterFactsAsOf(facts: TemporalGraphFact[], asOf?: string | null): {
26
+ scopedFacts: TemporalGraphFact[];
27
+ isActiveAtPointInTime: (fact: TemporalGraphFact) => boolean;
28
+ };
29
+ /**
30
+ * Graphiti-style Multi-Hop Subgraph Community Traversal (BFS).
31
+ * Finds all nodes and edges within `maxHops` (default 2) of a focal entity.
32
+ */
33
+ export declare function traverseSubgraphBfs(nodes: MemoryGraphNode[], edges: MemoryGraphEdge[], focalQuery: string, maxHops?: number): {
34
+ focalEntity: string;
35
+ maxHops: number;
36
+ nodes: MemoryGraphNode[];
37
+ edges: MemoryGraphEdge[];
38
+ hopDistances: Record<string, number>;
39
+ };
40
+ /**
41
+ * Builds the Graphiti-inspired Bi-Temporal Knowledge Graph (nodes, active/historical edges,
42
+ * episodic provenance, point-in-time `asOf` time-travel, 2-hop BFS subgraph, and Mermaid preview)
19
43
  * from runtime-agnostic inputs so the Node engine and the Edge Worker render identical graphs.
20
44
  */
21
45
  export declare function buildMemoryKnowledgeGraph(input: MemoryGraphInput): MemoryKnowledgeGraph;