@muxoai/sdk 1.3.0 → 1.4.2

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 (72) hide show
  1. package/.agents/plugins/marketplace.json +2 -2
  2. package/.claude-plugin/marketplace.json +19 -4
  3. package/.codex/config.toml +9 -2
  4. package/ARCHITECTURE.md +16 -6
  5. package/README.md +69 -24
  6. package/dist/clerk.d.ts +35 -0
  7. package/dist/clerk.js +201 -0
  8. package/dist/cli.js +1589 -103
  9. package/dist/composio-catalog.d.ts +234 -0
  10. package/dist/composio-catalog.js +1894 -0
  11. package/dist/config.d.ts +16 -0
  12. package/dist/config.js +27 -1
  13. package/dist/durable-workflow.d.ts +45 -0
  14. package/dist/durable-workflow.js +90 -0
  15. package/dist/engine.d.ts +315 -6
  16. package/dist/engine.js +1778 -94
  17. package/dist/mcp-schema.d.ts +286 -0
  18. package/dist/mcp-schema.js +2559 -0
  19. package/dist/mcp.d.ts +2 -25
  20. package/dist/mcp.js +949 -507
  21. package/dist/memory-graph.d.ts +21 -0
  22. package/dist/memory-graph.js +173 -0
  23. package/dist/nl.js +214 -35
  24. package/dist/oauth.d.ts +32 -0
  25. package/dist/oauth.js +134 -0
  26. package/dist/policy.d.ts +190 -0
  27. package/dist/policy.js +1597 -0
  28. package/dist/providers/composio-instant.d.ts +4 -0
  29. package/dist/providers/composio-instant.js +890 -535
  30. package/dist/providers/composio-sdk.d.ts +126 -5
  31. package/dist/providers/composio-sdk.js +902 -79
  32. package/dist/providers/microsoft-governance.d.ts +89 -3
  33. package/dist/providers/microsoft-governance.js +673 -26
  34. package/dist/providers/stripe-billing.d.ts +42 -0
  35. package/dist/providers/stripe-billing.js +244 -5
  36. package/dist/providers/stripe-projects.d.ts +459 -4
  37. package/dist/providers/stripe-projects.js +2674 -122
  38. package/dist/providers/supermemory.d.ts +102 -6
  39. package/dist/providers/supermemory.js +609 -55
  40. package/dist/provisioning-managed.d.ts +50 -0
  41. package/dist/provisioning-managed.js +155 -0
  42. package/dist/sdk.d.ts +705 -7
  43. package/dist/sdk.js +488 -10
  44. package/dist/server.js +2646 -348
  45. package/dist/store.d.ts +138 -6
  46. package/dist/store.js +932 -58
  47. package/dist/types.d.ts +312 -4
  48. package/dist/ui/console-html.d.ts +62 -0
  49. package/dist/ui/console-html.js +3742 -2228
  50. package/dist/ui/design-tokens.d.ts +177 -0
  51. package/dist/ui/design-tokens.js +210 -0
  52. package/dist/version.d.ts +1 -0
  53. package/dist/version.js +1 -0
  54. package/package.json +5 -4
  55. package/plugins/muxo/.app.json +1 -1
  56. package/plugins/muxo/.claude-plugin/plugin.json +3 -3
  57. package/plugins/muxo/.codex-plugin/plugin.json +19 -10
  58. package/plugins/muxo/.cursor-plugin/plugin.json +30 -0
  59. package/plugins/muxo/.mcp.json +1 -33
  60. package/plugins/muxo/assets/logo.png +0 -0
  61. package/plugins/muxo/hooks/session-start.sh +16 -4
  62. package/plugins/muxo/hooks/user-prompt-submit.sh +14 -1
  63. package/plugins/muxo/mcp.json +0 -10
  64. package/plugins/muxo/plugin.json +65 -8
  65. package/plugins/muxo/skills/muxo/SKILL.md +142 -14
  66. package/plugins/muxo/skills/muxo/agents/openai.yaml +12 -0
  67. package/plugins/muxo/skills/muxo/references/cli.md +9 -3
  68. package/plugins/muxo/skills/muxo/references/mcp.md +22 -10
  69. package/plugins/muxo/skills/muxo-activity-summary/SKILL.md +81 -0
  70. package/plugins/muxo/skills/setup/SKILL.md +17 -3
  71. package/plugins/muxo/skills/setup/agents/openai.yaml +12 -0
  72. package/src/catalogues/stripe-projects-catalog.json +140 -0
package/dist/config.d.ts CHANGED
@@ -1,11 +1,23 @@
1
+ import type { ClerkEnv } from "./clerk.js";
1
2
  export declare const ROOT_DIR: string;
2
3
  export interface MuxoConfig {
3
4
  port: number;
4
5
  baseUrl: string;
5
6
  dbPath: string;
6
7
  composioApiKey: string;
8
+ composioInstantApiKey: string;
7
9
  composioBaseUrl: string;
10
+ composioWebhookSecret: string;
11
+ composioWebhookSubscriptionId: string;
12
+ composioProjectId: string;
13
+ composioOrgId: string;
14
+ composioUserId: string;
8
15
  stripeSecretKey: string;
16
+ stripePublishableKey: string;
17
+ stripeApiBaseUrl: string;
18
+ stripeProvisioningApiVersion: string;
19
+ stripeProjectId: string;
20
+ stripeConnectedAccountId?: string;
9
21
  stripeStarterPriceId: string;
10
22
  stripeCreditsPriceId: string;
11
23
  stripeWebhookSecret: string;
@@ -16,5 +28,9 @@ export interface MuxoConfig {
16
28
  publicWebUrl: string;
17
29
  docsUrl: string;
18
30
  vaultMasterKey: Buffer;
31
+ /** Clerk sign-in settings; sign-in stays password-based unless CLERK_PUBLISHABLE_KEY is set. */
32
+ clerkEnv?: ClerkEnv & {
33
+ MUXO_OWNER_EMAILS?: string;
34
+ };
19
35
  }
20
36
  export declare function getConfig(): MuxoConfig;
package/dist/config.js CHANGED
@@ -65,11 +65,30 @@ export function getConfig() {
65
65
  dbPath: process.env.MUXO_DB_PATH || path.join(dataDir, "muxo.db"),
66
66
  composioApiKey: process.env.MUXO_EXTERNAL_MODE === "1"
67
67
  ? ""
68
- : process.env.COMPOSIO_API_KEY || "",
68
+ : process.env.COMPOSIO_API_KEY || process.env.COMPOSIO_INSTANT_API_KEY || "",
69
+ composioInstantApiKey: process.env.MUXO_EXTERNAL_MODE === "1"
70
+ ? ""
71
+ : process.env.COMPOSIO_INSTANT_API_KEY || process.env.COMPOSIO_API_KEY || "",
69
72
  composioBaseUrl: process.env.COMPOSIO_BASE_URL || "https://backend.composio.dev/api/v3",
73
+ composioWebhookSecret: process.env.MUXO_EXTERNAL_MODE === "1"
74
+ ? ""
75
+ : process.env.COMPOSIO_WEBHOOK_SECRET || "",
76
+ composioWebhookSubscriptionId: process.env.COMPOSIO_WEBHOOK_SUBSCRIPTION_ID || "",
77
+ composioProjectId: process.env.COMPOSIO_PROJECT_ID || "",
78
+ composioOrgId: process.env.COMPOSIO_ORG_ID || "",
79
+ composioUserId: process.env.COMPOSIO_USER_ID || "",
70
80
  stripeSecretKey: process.env.MUXO_EXTERNAL_MODE === "1"
71
81
  ? ""
72
82
  : process.env.STRIPE_SECRET_KEY || "",
83
+ stripePublishableKey: process.env.MUXO_EXTERNAL_MODE === "1"
84
+ ? ""
85
+ : process.env.STRIPE_PUBLISHABLE_KEY || "",
86
+ stripeApiBaseUrl: process.env.STRIPE_API_BASE_URL || "https://api.stripe.com",
87
+ stripeProvisioningApiVersion: process.env.STRIPE_PROVISIONING_API_VERSION || "2026-09-30.preview",
88
+ stripeProjectId: process.env.STRIPE_PROJECT_ID || "",
89
+ stripeConnectedAccountId: process.env.STRIPE_CONNECTED_ACCOUNT_ID ||
90
+ process.env.STRIPE_CONTEXT ||
91
+ "",
73
92
  stripeStarterPriceId: process.env.STRIPE_STARTER_PRICE_ID || "",
74
93
  stripeCreditsPriceId: process.env.STRIPE_CREDITS_PRICE_ID || "",
75
94
  stripeWebhookSecret: process.env.STRIPE_WEBHOOK_SECRET || "",
@@ -85,5 +104,12 @@ export function getConfig() {
85
104
  publicWebUrl: process.env.MUXO_PUBLIC_WEB_URL || "https://muxo.ai",
86
105
  docsUrl: process.env.MUXO_DOCS_URL || "https://docs.muxo.ai",
87
106
  vaultMasterKey: deriveVaultMasterKey(),
107
+ clerkEnv: {
108
+ CLERK_PUBLISHABLE_KEY: process.env.CLERK_PUBLISHABLE_KEY,
109
+ CLERK_SECRET_KEY: process.env.CLERK_SECRET_KEY,
110
+ CLERK_JWT_KEY: process.env.CLERK_JWT_KEY,
111
+ CLERK_AUTHORIZED_PARTIES: process.env.CLERK_AUTHORIZED_PARTIES,
112
+ MUXO_OWNER_EMAILS: process.env.MUXO_OWNER_EMAILS,
113
+ },
88
114
  };
89
115
  }
@@ -0,0 +1,45 @@
1
+ /** Cloud provisioning pipeline modelled on Cloudflare Workflows primitives, shared by the Node engine and the edge worker. */
2
+ import { MuxoToolError } from "./mcp-schema.js";
3
+ export type DurableWorkflowStepStatus = "completed" | "waiting" | "pending";
4
+ export interface DurableWorkflowStep {
5
+ name: string;
6
+ primitive: "step.do" | "step.waitForEvent" | "step.sleep";
7
+ status: DurableWorkflowStepStatus;
8
+ output?: Record<string, unknown>;
9
+ completedAt?: string;
10
+ }
11
+ export interface DurableWorkflow {
12
+ id: string;
13
+ workspaceId: string;
14
+ workflowType: "cloud_provisioning_pipeline" | "approval_handoff_pipeline";
15
+ status: "running" | "waiting_for_event" | "completed" | "failed";
16
+ provider: string;
17
+ serviceRef: string;
18
+ resourceId: string | null;
19
+ steps: DurableWorkflowStep[];
20
+ createdAt: string;
21
+ updatedAt: string;
22
+ }
23
+ export declare const WORKFLOW_RESOURCE_COMPLETED_EVENT = "v2.provisioning.resource.completed";
24
+ export declare function workflowNotFoundError(workflowId: string): MuxoToolError;
25
+ export declare function normalizeWorkflowTarget(params: {
26
+ provider?: string;
27
+ serviceRef?: string;
28
+ }): {
29
+ provider: string;
30
+ serviceRef: string;
31
+ };
32
+ export declare function createCloudProvisioningWorkflow(params: {
33
+ id: string;
34
+ workspaceId: string;
35
+ resourceId: string;
36
+ provider: string;
37
+ serviceRef: string;
38
+ region?: string;
39
+ apiVersion?: string;
40
+ }): DurableWorkflow;
41
+ /** Completes every outstanding step once the resource-completed event (or a manual advance) arrives. */
42
+ export declare function completeCloudProvisioningWorkflow(wf: DurableWorkflow, params: {
43
+ secretKeys: string[];
44
+ triggerEvent?: unknown;
45
+ }): DurableWorkflow;
@@ -0,0 +1,90 @@
1
+ /** Cloud provisioning pipeline modelled on Cloudflare Workflows primitives, shared by the Node engine and the edge worker. */
2
+ import { MuxoToolError } from "./mcp-schema.js";
3
+ export const WORKFLOW_RESOURCE_COMPLETED_EVENT = "v2.provisioning.resource.completed";
4
+ export function workflowNotFoundError(workflowId) {
5
+ return new MuxoToolError(`Durable workflow not found: ${workflowId}`, {
6
+ code: "workflow_not_found",
7
+ statusCode: 404,
8
+ payload: { workflowId },
9
+ });
10
+ }
11
+ export function normalizeWorkflowTarget(params) {
12
+ return {
13
+ provider: (params.provider || "neon").toLowerCase().trim(),
14
+ serviceRef: (params.serviceRef || "postgres").toLowerCase().trim(),
15
+ };
16
+ }
17
+ export function createCloudProvisioningWorkflow(params) {
18
+ const now = new Date().toISOString();
19
+ return {
20
+ id: params.id,
21
+ workspaceId: params.workspaceId,
22
+ workflowType: "cloud_provisioning_pipeline",
23
+ status: "waiting_for_event",
24
+ provider: params.provider,
25
+ serviceRef: params.serviceRef,
26
+ resourceId: params.resourceId,
27
+ steps: [
28
+ {
29
+ name: "check_stripe_v2_eligibility",
30
+ primitive: "step.do",
31
+ status: "completed",
32
+ output: { status: "eligible", apiVersion: params.apiVersion || "2026-09-30.preview" },
33
+ completedAt: now,
34
+ },
35
+ {
36
+ name: "ensure_payment_profile_and_provider_connection",
37
+ primitive: "step.do",
38
+ status: "completed",
39
+ output: { provider: params.provider, paymentProfileStatus: "active" },
40
+ completedAt: now,
41
+ },
42
+ {
43
+ name: "create_v2_provisioning_resource",
44
+ primitive: "step.do",
45
+ status: "completed",
46
+ output: {
47
+ resourceId: params.resourceId,
48
+ provider: params.provider,
49
+ service_ref: params.serviceRef,
50
+ region: params.region || "aws-us-east-1",
51
+ },
52
+ completedAt: now,
53
+ },
54
+ {
55
+ name: "wait_for_v2_provisioning_resource_completed",
56
+ primitive: "step.waitForEvent",
57
+ status: "waiting",
58
+ output: { expectedEvent: WORKFLOW_RESOURCE_COMPLETED_EVENT, resourceId: params.resourceId },
59
+ },
60
+ {
61
+ name: "reveal_access_configuration_and_seal_vault",
62
+ primitive: "step.do",
63
+ status: "pending",
64
+ },
65
+ ],
66
+ createdAt: now,
67
+ updatedAt: now,
68
+ };
69
+ }
70
+ /** Completes every outstanding step once the resource-completed event (or a manual advance) arrives. */
71
+ export function completeCloudProvisioningWorkflow(wf, params) {
72
+ const now = new Date().toISOString();
73
+ for (const step of wf.steps) {
74
+ if (step.status === "completed")
75
+ continue;
76
+ step.status = "completed";
77
+ step.completedAt = now;
78
+ if (step.name === "reveal_access_configuration_and_seal_vault") {
79
+ step.output = {
80
+ vaultEncrypted: true,
81
+ cipher: "AES-256-GCM",
82
+ secretKeys: params.secretKeys,
83
+ triggerEvent: params.triggerEvent || WORKFLOW_RESOURCE_COMPLETED_EVENT,
84
+ };
85
+ }
86
+ }
87
+ wf.status = "completed";
88
+ wf.updatedAt = now;
89
+ return wf;
90
+ }
package/dist/engine.d.ts CHANGED
@@ -1,13 +1,37 @@
1
1
  import type { MuxoConfig } from "./config.js";
2
+ import { type DurableWorkflow } from "./durable-workflow.js";
2
3
  import { type NaturalLanguageResolution } from "./nl.js";
4
+ import { describePolicyInPlainEnglish, type GuardrailCompileOptions, type LlmPolicyAndGovernanceBrief, type ParsedNaturalLanguageGuardrail, type PolicySimulationResult } from "./policy.js";
3
5
  import { ComposioInstantAdapter } from "./providers/composio-instant.js";
4
6
  import { ComposioSdkAdapter } from "./providers/composio-sdk.js";
5
7
  import { MicrosoftGovernanceAdapter } from "./providers/microsoft-governance.js";
6
8
  import { StripeBillingAdapter } from "./providers/stripe-billing.js";
7
9
  import { StripeProjectsAdapter } from "./providers/stripe-projects.js";
8
- import { SupermemoryAdapter } from "./providers/supermemory.js";
10
+ import { SupermemoryAdapter, type ActiveMemoryDefaults } from "./providers/supermemory.js";
9
11
  import type { MuxoStore } from "./store.js";
10
- import type { ActionPlan, ConnectionRecord, ExecutionReceipt, ExecutionRun, GovernanceDecisionRecord, MemoryContextSummary, MuxoTool, ProviderLane, RiskLevel, User, Workspace, WorkspaceMemoryRecord } from "./types.js";
12
+ import type { ActionPlan, ConnectionRecord, ExecutionReceipt, ExecutionRun, GovernanceDecisionRecord, HumanFriendlyExplanation, HumanHandoff, LanguageMode, LlmGuidance, MemoryContextSummary, MemoryKnowledgeGraph, MuxoTool, PortableAgenticReceipt, ProviderLane, RiskLevel, User, Workspace, WorkspaceMemoryRecord } from "./types.js";
13
+ export type RunContextPayload = {
14
+ workspaceId: string;
15
+ workspaceSlug: string;
16
+ projectsEnvironment: string;
17
+ policy: Workspace["policy"];
18
+ plainEnglishPolicy: ReturnType<typeof describePolicyInPlainEnglish>;
19
+ languageMode: LanguageMode;
20
+ customInstructions: string[];
21
+ activeDefaults: ActiveMemoryDefaults;
22
+ activeGuardrails: string[];
23
+ creditsBalance: number;
24
+ monthlyActionsRemaining: number;
25
+ provisionedResources: ReturnType<MuxoStore["listResources"]>;
26
+ environmentVariablesRedacted: Record<string, string>;
27
+ supermemoryBrain: MemoryContextSummary;
28
+ temporalFacts: NonNullable<MemoryContextSummary["temporalFacts"]>;
29
+ governance: ReturnType<MicrosoftGovernanceAdapter["getStatus"]>;
30
+ trustScore: ReturnType<MicrosoftGovernanceAdapter["getWorkspaceTrustScore"]>;
31
+ llmSystemPrompt: string;
32
+ explanation: HumanFriendlyExplanation;
33
+ envPullHint: string;
34
+ };
11
35
  export interface ExecutionContext {
12
36
  user: User;
13
37
  workspace: Workspace;
@@ -23,6 +47,7 @@ export declare class MuxoEngine {
23
47
  readonly stripeBilling: StripeBillingAdapter;
24
48
  readonly governance: MicrosoftGovernanceAdapter;
25
49
  readonly supermemory: SupermemoryAdapter;
50
+ private readonly durableWorkflows;
26
51
  constructor(config: MuxoConfig, store: MuxoStore);
27
52
  getProfile(ctx: ExecutionContext): Record<string, unknown>;
28
53
  getOrganization(ctx: ExecutionContext): Record<string, unknown>;
@@ -41,6 +66,7 @@ export declare class MuxoEngine {
41
66
  provider?: string;
42
67
  syncLive?: boolean;
43
68
  }): Promise<Record<string, unknown>>;
69
+ getHostedSiteHtml(slug: string, filePath?: string): string | null;
44
70
  startConnection(ctx: ExecutionContext, params: {
45
71
  provider: string;
46
72
  lane?: ProviderLane;
@@ -54,11 +80,16 @@ export declare class MuxoEngine {
54
80
  timeoutSeconds?: number;
55
81
  pollIntervalMs?: number;
56
82
  }): Promise<{
83
+ ok: true;
57
84
  connected: boolean;
85
+ ready: boolean;
86
+ timedOut: boolean;
58
87
  provider: string;
59
88
  status: ConnectionRecord["status"];
60
89
  connection: ConnectionRecord;
61
90
  redirectUrl: string | null;
91
+ polledAttempts: number;
92
+ elapsedMs: number;
62
93
  message: string;
63
94
  }>;
64
95
  handleOAuthCallback(params: {
@@ -78,6 +109,7 @@ export declare class MuxoEngine {
78
109
  toolSlug: string;
79
110
  input?: Record<string, unknown>;
80
111
  reason?: string;
112
+ fundingMode?: "muxo_funded" | "byok";
81
113
  }): Promise<{
82
114
  plan: ActionPlan;
83
115
  tool: MuxoTool;
@@ -91,42 +123,211 @@ export declare class MuxoEngine {
91
123
  externalAccountId: string | null;
92
124
  instructions: string;
93
125
  };
126
+ humanHandoff?: HumanHandoff;
127
+ llmGuidance: LlmGuidance;
94
128
  nextStep: string;
95
129
  }>;
96
130
  getPlan(ctx: ExecutionContext, planId: string): ActionPlan;
131
+ waitForPlanApproval(ctx: ExecutionContext, params: {
132
+ planId: string;
133
+ timeoutSeconds?: number;
134
+ pollIntervalMs?: number;
135
+ }): Promise<{
136
+ ok: true;
137
+ approved: boolean;
138
+ rejected: boolean;
139
+ timedOut: boolean;
140
+ waitedForApproval: true;
141
+ approvalStatus: ActionPlan["approvalStatus"];
142
+ approvalUrl: string;
143
+ waitedMs: number;
144
+ plan: ActionPlan;
145
+ }>;
97
146
  approvePlan(ctx: ExecutionContext, planId: string, decision?: "approved" | "rejected"): ActionPlan;
98
- getRunContext(ctx: ExecutionContext, query?: string): Promise<Record<string, unknown>>;
147
+ private buildApprovalHandoff;
148
+ private buildOAuthHandoff;
149
+ private buildPlanLlmGuidance;
150
+ private enrichMemoryContext;
151
+ getRunContext(ctx: ExecutionContext, query?: string): Promise<{
152
+ explanation: HumanFriendlyExplanation;
153
+ plainEnglishPolicy: ReturnType<typeof describePolicyInPlainEnglish>;
154
+ activeDefaults: ActiveMemoryDefaults;
155
+ activeGuardrails: string[];
156
+ [key: string]: unknown;
157
+ }>;
99
158
  getMemoryOverview(ctx: ExecutionContext, query?: string): Promise<{
100
159
  enabled: boolean;
101
160
  namespace: string;
161
+ fundingSource: string;
102
162
  context: MemoryContextSummary;
163
+ activeDefaults: ActiveMemoryDefaults;
164
+ activeGuardrails: string[];
165
+ explanation: HumanFriendlyExplanation;
103
166
  recentMemories: WorkspaceMemoryRecord[];
104
167
  memories: WorkspaceMemoryRecord[];
168
+ temporalFacts: ReturnType<MuxoStore["listTemporalFacts"]>;
169
+ historicalFacts: ReturnType<MuxoStore["listTemporalFacts"]>;
105
170
  }>;
106
171
  addWorkspaceMemory(ctx: ExecutionContext, params: {
107
172
  title: string;
108
173
  content: string;
109
174
  kind?: WorkspaceMemoryRecord["kind"];
110
175
  metadata?: Record<string, unknown>;
176
+ subject?: string;
177
+ predicate?: string;
178
+ object?: string;
111
179
  }): Promise<WorkspaceMemoryRecord>;
112
180
  deleteWorkspaceMemory(ctx: ExecutionContext, idOrDocId: string): Promise<{
113
181
  deleted: boolean;
114
182
  record: WorkspaceMemoryRecord | null;
115
183
  }>;
184
+ forgetWorkspaceMemoryMatching(ctx: ExecutionContext, query: string): Promise<{
185
+ query: string;
186
+ deletedLocalCount: number;
187
+ invalidatedFactsCount: number;
188
+ deletedRemoteIds: string[];
189
+ deletedMemories: WorkspaceMemoryRecord[];
190
+ invalidatedFacts: ReturnType<MuxoStore["listTemporalFacts"]>;
191
+ }>;
192
+ /**
193
+ * Synthesizes a Bi-Temporal Knowledge Graph (entities, active relationships, superseded historical relationships,
194
+ * Mermaid diagram, and human + technical explanations) directly from SQLite temporal_facts, memories, resources, and connections.
195
+ */
196
+ getMemoryGraph(ctx: ExecutionContext, query?: string): Promise<MemoryKnowledgeGraph>;
197
+ activateWorkspaceKillSwitch(ctx: ExecutionContext, params: {
198
+ reason: string;
199
+ action?: "terminate" | "quarantine" | "suspend";
200
+ }): Promise<Record<string, unknown>>;
201
+ resumeWorkspaceKillSwitch(ctx: ExecutionContext): Record<string, unknown>;
116
202
  executePlanForRisk(ctx: ExecutionContext, planId: string, expectedRisk: RiskLevel): Promise<{
117
203
  run: ExecutionRun;
118
204
  receipt: ExecutionReceipt;
119
205
  }>;
120
206
  getRun(ctx: ExecutionContext, runId: string): ExecutionRun;
121
- cancelRun(ctx: ExecutionContext, runId: string): {
207
+ cancelRun(ctx: ExecutionContext, runId: string, reason?: string): {
208
+ ok: true;
209
+ cancelled: true;
210
+ alreadyCancelled: boolean;
211
+ previousStatus: ExecutionRun["status"];
122
212
  run: ExecutionRun;
123
- receipt: ExecutionReceipt | null;
213
+ receipt: ExecutionReceipt;
214
+ signatureValid: boolean;
215
+ message: string;
124
216
  };
217
+ explainReceipt(receipt: ExecutionReceipt, verification: {
218
+ signatureValid: boolean;
219
+ governanceSignatureValid: boolean;
220
+ agenticReceiptValid?: boolean;
221
+ }, policy?: Partial<Workspace["policy"]> | null, languageMode?: LanguageMode): HumanFriendlyExplanation;
125
222
  getReceipt(ctx: ExecutionContext, receiptOrRunId: string): {
126
223
  receipt: ExecutionReceipt;
224
+ agenticReceipt: PortableAgenticReceipt;
127
225
  signatureValid: boolean;
128
226
  governanceSignatureValid: boolean;
227
+ agenticReceiptValid: boolean;
228
+ explanation: HumanFriendlyExplanation;
229
+ };
230
+ listReceipts(ctx: ExecutionContext, limit?: number): {
231
+ receipts: Array<ExecutionReceipt & {
232
+ agenticReceipt: PortableAgenticReceipt;
233
+ signatureValid: boolean;
234
+ governanceSignatureValid: boolean;
235
+ agenticReceiptValid: boolean;
236
+ explanation: HumanFriendlyExplanation;
237
+ }>;
238
+ total: number;
239
+ explanation: HumanFriendlyExplanation;
240
+ };
241
+ /**
242
+ * Verifies the entire cryptographic receipt chain (`prevReceiptHash` -> `receiptHash`,
243
+ * HMAC vault signatures, Ed25519 Governance DecisionRecords, and portable Ed25519 AgenticReceipts).
244
+ */
245
+ verifyReceiptChain(ctx: ExecutionContext, limit?: number): {
246
+ ok: true;
247
+ valid: boolean;
248
+ workspaceId: string;
249
+ agentDid: string;
250
+ publicKeyHex: string;
251
+ chainValid: boolean;
252
+ hashLinksValid: boolean;
253
+ allHmacValid: boolean;
254
+ allEd25519AgenticValid: boolean;
255
+ allGovernanceValid: boolean;
256
+ totalReceipts: number;
257
+ totalChecked: number;
258
+ validCount: number;
259
+ brokenLinks: Array<{
260
+ receiptId: string;
261
+ runId: string;
262
+ reason: string;
263
+ }>;
264
+ genesisHash: string;
265
+ headReceiptHash: string;
266
+ links: Array<{
267
+ index: number;
268
+ receiptId: string;
269
+ runId: string;
270
+ toolSlug: string;
271
+ prevReceiptHash: string;
272
+ receiptHash: string;
273
+ hashLinkValid: boolean;
274
+ hmacValid: boolean;
275
+ ed25519AgenticValid: boolean;
276
+ governanceValid: boolean;
277
+ issuedAt: string;
278
+ }>;
279
+ explanation: HumanFriendlyExplanation;
129
280
  };
281
+ getGovernanceOverview(ctx: ExecutionContext): {
282
+ workspaceId: string;
283
+ killSwitch: {
284
+ active: boolean;
285
+ reason: string | null;
286
+ };
287
+ governance: ReturnType<MicrosoftGovernanceAdapter["getStatus"]>;
288
+ trustScore: ReturnType<MicrosoftGovernanceAdapter["getWorkspaceTrustScore"]>;
289
+ policy: Workspace["policy"];
290
+ plainEnglish: ReturnType<typeof describePolicyInPlainEnglish>;
291
+ llmPolicyBrief: LlmPolicyAndGovernanceBrief;
292
+ explanation: HumanFriendlyExplanation;
293
+ };
294
+ resetWorkspaceGuardrails(ctx: ExecutionContext): {
295
+ ok: true;
296
+ action: "reset_guardrails";
297
+ workspace: Workspace;
298
+ policy: Workspace["policy"];
299
+ plainEnglish: ReturnType<typeof describePolicyInPlainEnglish>;
300
+ llmPolicyBrief: LlmPolicyAndGovernanceBrief;
301
+ explanation: HumanFriendlyExplanation;
302
+ };
303
+ checkToolPolicy(ctx: ExecutionContext, params: {
304
+ toolSlug: string;
305
+ input?: Record<string, unknown>;
306
+ }): Promise<PolicySimulationResult>;
307
+ setKillSwitch(ctx: ExecutionContext, active: boolean, reason?: string): Workspace;
308
+ scanForContextPoisoning(workspaceId: string, text: string): {
309
+ poisoned: boolean;
310
+ severity: string;
311
+ matchedPatterns: string[];
312
+ findingsCount: number;
313
+ integrityValid: boolean;
314
+ };
315
+ getGuardrailsSummary(ctx: ExecutionContext): {
316
+ workspaceId: string;
317
+ policy: Workspace["policy"];
318
+ plainEnglish: ReturnType<typeof describePolicyInPlainEnglish>;
319
+ llmPolicyBrief: LlmPolicyAndGovernanceBrief;
320
+ activeDefaults: ActiveMemoryDefaults;
321
+ activeGuardrails: string[];
322
+ };
323
+ applyNaturalLanguageGuardrail(ctx: ExecutionContext, prompt: string, options?: GuardrailCompileOptions): Promise<{
324
+ ok: boolean;
325
+ workspace: Workspace;
326
+ guardrail: ParsedNaturalLanguageGuardrail;
327
+ plainEnglish: ReturnType<typeof describePolicyInPlainEnglish>;
328
+ llmPolicyBrief: LlmPolicyAndGovernanceBrief;
329
+ memoryRecord?: WorkspaceMemoryRecord;
330
+ }>;
130
331
  doNaturalLanguage(ctx: ExecutionContext, params: {
131
332
  prompt: string;
132
333
  input?: Record<string, unknown>;
@@ -137,13 +338,38 @@ export declare class MuxoEngine {
137
338
  }): Promise<{
138
339
  ok: boolean;
139
340
  executed: boolean;
140
- status: "executed" | "planned_dry_run" | "awaiting_approval" | "awaiting_oauth_connection" | "missing_inputs" | "unresolved";
341
+ status: "executed" | "planned_dry_run" | "awaiting_approval" | "awaiting_oauth_connection" | "missing_inputs" | "guardrail_applied" | "memory_saved" | "memory_forgotten" | "memory_recalled" | "memory_graph" | "governance_updated" | "governance_scanned" | "governance_status" | "context_inspected" | "receipt_explained" | "receipt_chain_verified" | "unresolved";
141
342
  intent: NaturalLanguageResolution;
142
343
  resolution: NaturalLanguageResolution;
143
344
  plan?: ActionPlan;
144
345
  run?: ExecutionRun;
145
346
  receipt?: ExecutionReceipt;
347
+ receiptVerification?: {
348
+ receipt: ExecutionReceipt;
349
+ agenticReceipt?: PortableAgenticReceipt;
350
+ signatureValid: boolean;
351
+ governanceSignatureValid: boolean;
352
+ agenticReceiptValid?: boolean;
353
+ explanation: HumanFriendlyExplanation;
354
+ };
355
+ receiptsList?: ReturnType<MuxoEngine["listReceipts"]>;
356
+ receiptChain?: ReturnType<MuxoEngine["verifyReceiptChain"]>;
357
+ guardrail?: ParsedNaturalLanguageGuardrail;
358
+ plainEnglishGuardrails?: ReturnType<typeof describePolicyInPlainEnglish>;
359
+ memoryRecord?: WorkspaceMemoryRecord;
360
+ memoryOverview?: Awaited<ReturnType<MuxoEngine["getMemoryOverview"]>>;
361
+ memoryGraph?: MemoryKnowledgeGraph;
362
+ deletedMemoryId?: string;
363
+ governanceStatus?: ReturnType<MuxoEngine["getGovernanceOverview"]>;
364
+ poisoningScan?: ReturnType<MuxoEngine["scanForContextPoisoning"]>;
365
+ runContext?: Awaited<ReturnType<MuxoEngine["getRunContext"]>>;
366
+ explanation?: HumanFriendlyExplanation;
367
+ activeDefaults?: ActiveMemoryDefaults;
368
+ activeMemoryDefaults?: ActiveMemoryDefaults;
369
+ memoryAutoFilled?: Record<string, unknown>;
146
370
  authHandoff?: Record<string, unknown>;
371
+ humanHandoff?: HumanHandoff;
372
+ llmGuidance?: LlmGuidance;
147
373
  byokPrompt?: {
148
374
  needed: boolean;
149
375
  provider: string;
@@ -153,4 +379,87 @@ export declare class MuxoEngine {
153
379
  };
154
380
  humanMessage: string;
155
381
  }>;
382
+ /**
383
+ * Parallel Governed Multi-Tool Batch Execution (`COMPOSIO_MULTI_EXECUTE_TOOL` pattern).
384
+ * Evaluates governance & policy across every item, then executes all approved plans concurrently.
385
+ */
386
+ executeBatchPlans(ctx: ExecutionContext, params: {
387
+ items: Array<{
388
+ toolSlug: string;
389
+ input: Record<string, unknown>;
390
+ reason: string;
391
+ }>;
392
+ autoApprove?: boolean;
393
+ }): Promise<{
394
+ batchId: string;
395
+ totalRequested: number;
396
+ succeededCount: number;
397
+ blockedOrPendingCount: number;
398
+ results: Array<{
399
+ toolSlug: string;
400
+ status: "succeeded" | "failed" | "awaiting_approval" | "awaiting_oauth";
401
+ planId?: string;
402
+ runId?: string;
403
+ receiptId?: string;
404
+ output?: Record<string, unknown>;
405
+ error?: string;
406
+ }>;
407
+ }>;
408
+ /**
409
+ * Cloudflare Workflows (`step.do`, `step.waitForEvent`, `step.sleep`) Durable Orchestrator
410
+ * for multi-stage async Stripe v2 Cloud Provisioning & Vault Secret Injection.
411
+ */
412
+ startDurableWorkflow(ctx: ExecutionContext, params: {
413
+ provider?: string;
414
+ serviceRef?: string;
415
+ name?: string;
416
+ region?: string;
417
+ }): Promise<DurableWorkflow>;
418
+ advanceDurableWorkflow(ctx: ExecutionContext, workflowId: string, eventPayload?: Record<string, unknown>): Promise<DurableWorkflow>;
419
+ listDurableWorkflows(workspaceId: string): DurableWorkflow[];
420
+ /**
421
+ * Hybrid Semantic Vector + Bi-Temporal Recall (`@cf/baai/bge-base-en-v1.5` + Vectorize model).
422
+ */
423
+ searchMemoryHybrid(workspaceId: string, query: string, limit?: number): {
424
+ rankedMemories: Array<WorkspaceMemoryRecord & {
425
+ hybridScore: number;
426
+ vectorSimilarity: number;
427
+ lexicalOverlap: number;
428
+ }>;
429
+ vectorDimensions: number;
430
+ embeddingModel: string;
431
+ topScore: number;
432
+ };
433
+ /**
434
+ * Tamper-Evident R2 / WORM Audit Archive Bundle signed by the workspace's Ed25519 AgentIdentity.
435
+ */
436
+ exportTamperEvidentArchive(workspaceId: string): {
437
+ archiveId: string;
438
+ workspaceId: string;
439
+ storageTarget: string;
440
+ retentionMode: string;
441
+ exportedAt: string;
442
+ chainIntegrity: {
443
+ verified: boolean;
444
+ algorithm: string;
445
+ agentDid: string;
446
+ publicKeyFingerprint: string;
447
+ headMerkleHash: string;
448
+ bundleDigest: string;
449
+ };
450
+ counts: {
451
+ receipts: number;
452
+ governanceDecisions: number;
453
+ auditLogs: number;
454
+ temporalFacts: number;
455
+ };
456
+ merkleChain: {
457
+ sequence: number;
458
+ receiptId: string;
459
+ toolSlug: string;
460
+ prevHash: string;
461
+ entryHash: string;
462
+ createdAt: string;
463
+ }[];
464
+ };
156
465
  }