@muxoai/platform 1.4.1 → 1.4.3
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/.agents/plugins/marketplace.json +1 -1
- package/.claude-plugin/marketplace.json +2 -2
- package/README.md +1 -1
- package/dist/cli.js +94 -3
- package/dist/composio-catalog.d.ts +177 -1
- package/dist/composio-catalog.js +1427 -7
- package/dist/config.d.ts +6 -0
- package/dist/config.js +11 -1
- package/dist/durable-workflow.d.ts +71 -4
- package/dist/durable-workflow.js +199 -5
- package/dist/engine.d.ts +82 -3
- package/dist/engine.js +406 -41
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/mcp-schema.d.ts +162 -1
- package/dist/mcp-schema.js +1544 -40
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +474 -26
- package/dist/memory-graph.d.ts +26 -2
- package/dist/memory-graph.js +127 -7
- package/dist/oss-suite.d.ts +217 -0
- package/dist/oss-suite.js +836 -0
- package/dist/policy.d.ts +108 -1
- package/dist/policy.js +406 -1
- package/dist/providers/composio-instant.js +38 -3
- package/dist/providers/composio-sdk.d.ts +59 -2
- package/dist/providers/composio-sdk.js +273 -59
- package/dist/providers/stripe-projects.d.ts +4 -0
- package/dist/providers/stripe-projects.js +548 -126
- package/dist/sdk.d.ts +24 -1
- package/dist/sdk.js +53 -2
- package/dist/server.js +659 -64
- package/dist/store.js +2 -0
- package/dist/types.d.ts +34 -1
- package/dist/ui/console-html.d.ts +31 -1
- package/dist/ui/console-html.js +922 -368
- package/dist/ui/design-tokens.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -2
- package/plugins/muxo/.claude-plugin/plugin.json +2 -2
- package/plugins/muxo/.codex-plugin/plugin.json +15 -8
- package/plugins/muxo/.cursor-plugin/plugin.json +30 -0
- package/plugins/muxo/hooks/session-start.sh +15 -3
- package/plugins/muxo/hooks/user-prompt-submit.sh +14 -1
- package/plugins/muxo/mcp.json +0 -10
- package/plugins/muxo/plugin.json +4 -4
- package/plugins/muxo/skills/muxo/SKILL.md +25 -16
- package/plugins/muxo/skills/muxo/references/cli.md +5 -1
- package/plugins/muxo/skills/muxo/references/mcp.md +11 -6
- package/plugins/muxo/skills/muxo-activity-summary/SKILL.md +81 -0
- package/plugins/muxo/skills/setup/SKILL.md +1 -1
- package/src/catalogues/stripe-projects-catalog.json +140 -0
package/dist/config.d.ts
CHANGED
|
@@ -5,7 +5,13 @@ export interface MuxoConfig {
|
|
|
5
5
|
baseUrl: string;
|
|
6
6
|
dbPath: string;
|
|
7
7
|
composioApiKey: string;
|
|
8
|
+
composioInstantApiKey: string;
|
|
8
9
|
composioBaseUrl: string;
|
|
10
|
+
composioWebhookSecret: string;
|
|
11
|
+
composioWebhookSubscriptionId: string;
|
|
12
|
+
composioProjectId: string;
|
|
13
|
+
composioOrgId: string;
|
|
14
|
+
composioUserId: string;
|
|
9
15
|
stripeSecretKey: string;
|
|
10
16
|
stripePublishableKey: string;
|
|
11
17
|
stripeApiBaseUrl: string;
|
package/dist/config.js
CHANGED
|
@@ -65,8 +65,18 @@ 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 || "",
|
|
@@ -1,22 +1,54 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Temporal-compatible Durable Workflows, Saga Compensations, Signals, and Cloudflare Workflows primitives,
|
|
3
|
+
* shared by the Node engine (src/engine.ts) and the Cloudflare Edge Worker (worker/index.ts).
|
|
4
|
+
*/
|
|
2
5
|
import { MuxoToolError } from "./mcp-schema.js";
|
|
3
|
-
export type DurableWorkflowStepStatus = "completed" | "waiting" | "pending";
|
|
6
|
+
export type DurableWorkflowStepStatus = "completed" | "waiting" | "pending" | "failed" | "compensated";
|
|
4
7
|
export interface DurableWorkflowStep {
|
|
5
8
|
name: string;
|
|
6
9
|
primitive: "step.do" | "step.waitForEvent" | "step.sleep";
|
|
7
10
|
status: DurableWorkflowStepStatus;
|
|
8
11
|
output?: Record<string, unknown>;
|
|
9
12
|
completedAt?: string;
|
|
13
|
+
compensationAction?: string;
|
|
14
|
+
compensatedAt?: string;
|
|
15
|
+
}
|
|
16
|
+
export type TemporalEventType = "EVENT_TYPE_WORKFLOW_EXECUTION_STARTED" | "EVENT_TYPE_ACTIVITY_TASK_SCHEDULED" | "EVENT_TYPE_ACTIVITY_TASK_COMPLETED" | "EVENT_TYPE_ACTIVITY_TASK_FAILED" | "EVENT_TYPE_WORKFLOW_EXECUTION_SIGNALED" | "EVENT_TYPE_TIMER_STARTED" | "EVENT_TYPE_TIMER_FIRED" | "EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED" | "EVENT_TYPE_WORKFLOW_EXECUTION_CANCELED" | "EVENT_TYPE_WORKFLOW_EXECUTION_FAILED";
|
|
17
|
+
export interface TemporalHistoryEvent {
|
|
18
|
+
eventId: number;
|
|
19
|
+
eventTime: string;
|
|
20
|
+
eventType: TemporalEventType;
|
|
21
|
+
taskQueue: string;
|
|
22
|
+
attributes: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
export interface SagaCompensationRecord {
|
|
25
|
+
stepName: string;
|
|
26
|
+
compensationAction: string;
|
|
27
|
+
status: "registered" | "executed" | "skipped";
|
|
28
|
+
description: string;
|
|
29
|
+
output?: Record<string, unknown>;
|
|
30
|
+
executedAt?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface DurableWorkflowSignalRecord {
|
|
33
|
+
signalName: string;
|
|
34
|
+
payload: Record<string, unknown>;
|
|
35
|
+
receivedAt: string;
|
|
10
36
|
}
|
|
11
37
|
export interface DurableWorkflow {
|
|
12
38
|
id: string;
|
|
39
|
+
runId?: string;
|
|
13
40
|
workspaceId: string;
|
|
14
|
-
workflowType: "cloud_provisioning_pipeline" | "approval_handoff_pipeline";
|
|
15
|
-
|
|
41
|
+
workflowType: "cloud_provisioning_pipeline" | "approval_handoff_pipeline" | "commercial_playbook_saga";
|
|
42
|
+
playbookSlug?: string | null;
|
|
43
|
+
status: "running" | "waiting_for_event" | "completed" | "failed" | "rolled_back";
|
|
16
44
|
provider: string;
|
|
17
45
|
serviceRef: string;
|
|
18
46
|
resourceId: string | null;
|
|
19
47
|
steps: DurableWorkflowStep[];
|
|
48
|
+
compensations?: SagaCompensationRecord[];
|
|
49
|
+
signals?: DurableWorkflowSignalRecord[];
|
|
50
|
+
temporalEventHistory?: TemporalHistoryEvent[];
|
|
51
|
+
rollbackReason?: string | null;
|
|
20
52
|
createdAt: string;
|
|
21
53
|
updatedAt: string;
|
|
22
54
|
}
|
|
@@ -43,3 +75,38 @@ export declare function completeCloudProvisioningWorkflow(wf: DurableWorkflow, p
|
|
|
43
75
|
secretKeys: string[];
|
|
44
76
|
triggerEvent?: unknown;
|
|
45
77
|
}): DurableWorkflow;
|
|
78
|
+
/**
|
|
79
|
+
* Executes LIFO Saga Compensations on a DurableWorkflow, rolling back completed steps in reverse order
|
|
80
|
+
* and recording Temporal compensation activity events.
|
|
81
|
+
*/
|
|
82
|
+
export declare function rollbackDurableWorkflow(wf: DurableWorkflow, params?: {
|
|
83
|
+
reason?: string;
|
|
84
|
+
failedStepName?: string;
|
|
85
|
+
failedStep?: string;
|
|
86
|
+
}): DurableWorkflow;
|
|
87
|
+
/**
|
|
88
|
+
* Sends a named Temporal signal to a DurableWorkflow (`human.approval.granted`, `oauth.connection.active`,
|
|
89
|
+
* `saga.abort`, or `v2.provisioning.resource.completed`).
|
|
90
|
+
*/
|
|
91
|
+
export declare function signalDurableWorkflow(wf: DurableWorkflow, params: {
|
|
92
|
+
signalName: string;
|
|
93
|
+
payload?: Record<string, unknown>;
|
|
94
|
+
secretKeys?: string[];
|
|
95
|
+
}): DurableWorkflow;
|
|
96
|
+
/**
|
|
97
|
+
* Exports a DurableWorkflow in Temporal Web UI / `temporal workflow show` compatible EventHistory JSON format.
|
|
98
|
+
*/
|
|
99
|
+
export declare function exportTemporalEventHistory(wf: DurableWorkflow): {
|
|
100
|
+
namespace: string;
|
|
101
|
+
workflowExecution: {
|
|
102
|
+
workflowId: string;
|
|
103
|
+
runId: string;
|
|
104
|
+
};
|
|
105
|
+
workflowType: {
|
|
106
|
+
name: string;
|
|
107
|
+
};
|
|
108
|
+
status: DurableWorkflow["status"];
|
|
109
|
+
eventsCount: number;
|
|
110
|
+
compensationsCount: number;
|
|
111
|
+
events: TemporalHistoryEvent[];
|
|
112
|
+
};
|
package/dist/durable-workflow.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Temporal-compatible Durable Workflows, Saga Compensations, Signals, and Cloudflare Workflows primitives,
|
|
3
|
+
* shared by the Node engine (src/engine.ts) and the Cloudflare Edge Worker (worker/index.ts).
|
|
4
|
+
*/
|
|
2
5
|
import { MuxoToolError } from "./mcp-schema.js";
|
|
3
6
|
export const WORKFLOW_RESOURCE_COMPLETED_EVENT = "v2.provisioning.resource.completed";
|
|
4
7
|
export function workflowNotFoundError(workflowId) {
|
|
@@ -14,12 +17,70 @@ export function normalizeWorkflowTarget(params) {
|
|
|
14
17
|
serviceRef: (params.serviceRef || "postgres").toLowerCase().trim(),
|
|
15
18
|
};
|
|
16
19
|
}
|
|
20
|
+
function appendTemporalEvent(history, eventType, attributes, now = new Date().toISOString()) {
|
|
21
|
+
history.push({
|
|
22
|
+
eventId: history.length + 1,
|
|
23
|
+
eventTime: now,
|
|
24
|
+
eventType,
|
|
25
|
+
taskQueue: "muxo-durable-execution-queue",
|
|
26
|
+
attributes,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
17
29
|
export function createCloudProvisioningWorkflow(params) {
|
|
18
30
|
const now = new Date().toISOString();
|
|
31
|
+
const region = params.region || "aws-us-east-1";
|
|
32
|
+
const apiVersion = params.apiVersion || "2026-09-30.preview";
|
|
33
|
+
const history = [];
|
|
34
|
+
appendTemporalEvent(history, "EVENT_TYPE_WORKFLOW_EXECUTION_STARTED", {
|
|
35
|
+
workflowType: "cloud_provisioning_pipeline",
|
|
36
|
+
workflowId: params.id,
|
|
37
|
+
workspaceId: params.workspaceId,
|
|
38
|
+
provider: params.provider,
|
|
39
|
+
serviceRef: params.serviceRef,
|
|
40
|
+
region,
|
|
41
|
+
}, now);
|
|
42
|
+
appendTemporalEvent(history, "EVENT_TYPE_ACTIVITY_TASK_COMPLETED", {
|
|
43
|
+
activityName: "check_stripe_v2_eligibility",
|
|
44
|
+
result: { status: "eligible", apiVersion },
|
|
45
|
+
}, now);
|
|
46
|
+
appendTemporalEvent(history, "EVENT_TYPE_ACTIVITY_TASK_COMPLETED", {
|
|
47
|
+
activityName: "ensure_payment_profile_and_provider_connection",
|
|
48
|
+
result: { provider: params.provider, paymentProfileStatus: "active" },
|
|
49
|
+
}, now);
|
|
50
|
+
appendTemporalEvent(history, "EVENT_TYPE_ACTIVITY_TASK_COMPLETED", {
|
|
51
|
+
activityName: "create_v2_provisioning_resource",
|
|
52
|
+
result: {
|
|
53
|
+
resourceId: params.resourceId,
|
|
54
|
+
provider: params.provider,
|
|
55
|
+
service_ref: params.serviceRef,
|
|
56
|
+
region,
|
|
57
|
+
},
|
|
58
|
+
compensationAction: `resource.${params.provider}.remove`,
|
|
59
|
+
}, now);
|
|
60
|
+
appendTemporalEvent(history, "EVENT_TYPE_TIMER_STARTED", {
|
|
61
|
+
waitingForSignal: WORKFLOW_RESOURCE_COMPLETED_EVENT,
|
|
62
|
+
resourceId: params.resourceId,
|
|
63
|
+
}, now);
|
|
64
|
+
const compensations = [
|
|
65
|
+
{
|
|
66
|
+
stepName: "ensure_payment_profile_and_provider_connection",
|
|
67
|
+
compensationAction: `provisioning.provider_connection.unlink`,
|
|
68
|
+
status: "registered",
|
|
69
|
+
description: `Unlink provider connection for ${params.provider} if downstream provisioning aborts`,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
stepName: "create_v2_provisioning_resource",
|
|
73
|
+
compensationAction: `resource.${params.provider}.remove`,
|
|
74
|
+
status: "registered",
|
|
75
|
+
description: `Deprovision ${params.provider}/${params.serviceRef} (${params.resourceId}) and release reservation`,
|
|
76
|
+
},
|
|
77
|
+
];
|
|
19
78
|
return {
|
|
20
79
|
id: params.id,
|
|
80
|
+
runId: `run_${params.id}`,
|
|
21
81
|
workspaceId: params.workspaceId,
|
|
22
82
|
workflowType: "cloud_provisioning_pipeline",
|
|
83
|
+
playbookSlug: null,
|
|
23
84
|
status: "waiting_for_event",
|
|
24
85
|
provider: params.provider,
|
|
25
86
|
serviceRef: params.serviceRef,
|
|
@@ -29,7 +90,7 @@ export function createCloudProvisioningWorkflow(params) {
|
|
|
29
90
|
name: "check_stripe_v2_eligibility",
|
|
30
91
|
primitive: "step.do",
|
|
31
92
|
status: "completed",
|
|
32
|
-
output: { status: "eligible", apiVersion
|
|
93
|
+
output: { status: "eligible", apiVersion },
|
|
33
94
|
completedAt: now,
|
|
34
95
|
},
|
|
35
96
|
{
|
|
@@ -38,6 +99,7 @@ export function createCloudProvisioningWorkflow(params) {
|
|
|
38
99
|
status: "completed",
|
|
39
100
|
output: { provider: params.provider, paymentProfileStatus: "active" },
|
|
40
101
|
completedAt: now,
|
|
102
|
+
compensationAction: "provisioning.provider_connection.unlink",
|
|
41
103
|
},
|
|
42
104
|
{
|
|
43
105
|
name: "create_v2_provisioning_resource",
|
|
@@ -47,22 +109,31 @@ export function createCloudProvisioningWorkflow(params) {
|
|
|
47
109
|
resourceId: params.resourceId,
|
|
48
110
|
provider: params.provider,
|
|
49
111
|
service_ref: params.serviceRef,
|
|
50
|
-
region
|
|
112
|
+
region,
|
|
51
113
|
},
|
|
52
114
|
completedAt: now,
|
|
115
|
+
compensationAction: `resource.${params.provider}.remove`,
|
|
53
116
|
},
|
|
54
117
|
{
|
|
55
118
|
name: "wait_for_v2_provisioning_resource_completed",
|
|
56
119
|
primitive: "step.waitForEvent",
|
|
57
120
|
status: "waiting",
|
|
58
|
-
output: {
|
|
121
|
+
output: {
|
|
122
|
+
expectedEvent: WORKFLOW_RESOURCE_COMPLETED_EVENT,
|
|
123
|
+
resourceId: params.resourceId,
|
|
124
|
+
},
|
|
59
125
|
},
|
|
60
126
|
{
|
|
61
127
|
name: "reveal_access_configuration_and_seal_vault",
|
|
62
128
|
primitive: "step.do",
|
|
63
129
|
status: "pending",
|
|
130
|
+
compensationAction: "vault.revoke_secrets",
|
|
64
131
|
},
|
|
65
132
|
],
|
|
133
|
+
compensations,
|
|
134
|
+
signals: [],
|
|
135
|
+
temporalEventHistory: history,
|
|
136
|
+
rollbackReason: null,
|
|
66
137
|
createdAt: now,
|
|
67
138
|
updatedAt: now,
|
|
68
139
|
};
|
|
@@ -70,6 +141,12 @@ export function createCloudProvisioningWorkflow(params) {
|
|
|
70
141
|
/** Completes every outstanding step once the resource-completed event (or a manual advance) arrives. */
|
|
71
142
|
export function completeCloudProvisioningWorkflow(wf, params) {
|
|
72
143
|
const now = new Date().toISOString();
|
|
144
|
+
const history = wf.temporalEventHistory || [];
|
|
145
|
+
const trigger = String(params.triggerEvent || WORKFLOW_RESOURCE_COMPLETED_EVENT);
|
|
146
|
+
appendTemporalEvent(history, "EVENT_TYPE_WORKFLOW_EXECUTION_SIGNALED", {
|
|
147
|
+
signalName: trigger,
|
|
148
|
+
resourceId: wf.resourceId,
|
|
149
|
+
}, now);
|
|
73
150
|
for (const step of wf.steps) {
|
|
74
151
|
if (step.status === "completed")
|
|
75
152
|
continue;
|
|
@@ -80,11 +157,128 @@ export function completeCloudProvisioningWorkflow(wf, params) {
|
|
|
80
157
|
vaultEncrypted: true,
|
|
81
158
|
cipher: "AES-256-GCM",
|
|
82
159
|
secretKeys: params.secretKeys,
|
|
83
|
-
triggerEvent:
|
|
160
|
+
triggerEvent: trigger,
|
|
84
161
|
};
|
|
85
162
|
}
|
|
163
|
+
appendTemporalEvent(history, "EVENT_TYPE_ACTIVITY_TASK_COMPLETED", {
|
|
164
|
+
activityName: step.name,
|
|
165
|
+
result: step.output || { status: "completed" },
|
|
166
|
+
}, now);
|
|
86
167
|
}
|
|
168
|
+
appendTemporalEvent(history, "EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED", {
|
|
169
|
+
workflowId: wf.id,
|
|
170
|
+
status: "completed",
|
|
171
|
+
secretKeysSealed: params.secretKeys,
|
|
172
|
+
}, now);
|
|
173
|
+
wf.temporalEventHistory = history;
|
|
87
174
|
wf.status = "completed";
|
|
88
175
|
wf.updatedAt = now;
|
|
89
176
|
return wf;
|
|
90
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Executes LIFO Saga Compensations on a DurableWorkflow, rolling back completed steps in reverse order
|
|
180
|
+
* and recording Temporal compensation activity events.
|
|
181
|
+
*/
|
|
182
|
+
export function rollbackDurableWorkflow(wf, params) {
|
|
183
|
+
const now = new Date().toISOString();
|
|
184
|
+
const failedStepName = params?.failedStepName || params?.failedStep;
|
|
185
|
+
const reason = params?.reason ||
|
|
186
|
+
"Saga rollback requested by operator or downstream step failure";
|
|
187
|
+
const history = wf.temporalEventHistory || [];
|
|
188
|
+
const compensations = wf.compensations || [];
|
|
189
|
+
if (failedStepName) {
|
|
190
|
+
appendTemporalEvent(history, "EVENT_TYPE_ACTIVITY_TASK_FAILED", {
|
|
191
|
+
activityName: failedStepName,
|
|
192
|
+
reason,
|
|
193
|
+
}, now);
|
|
194
|
+
}
|
|
195
|
+
// Execute registered compensations in reverse (LIFO) order
|
|
196
|
+
for (let i = compensations.length - 1; i >= 0; i--) {
|
|
197
|
+
const comp = compensations[i];
|
|
198
|
+
if (comp.status === "executed")
|
|
199
|
+
continue;
|
|
200
|
+
comp.status = "executed";
|
|
201
|
+
comp.executedAt = now;
|
|
202
|
+
comp.output = {
|
|
203
|
+
rolledBack: true,
|
|
204
|
+
action: comp.compensationAction,
|
|
205
|
+
resourceId: wf.resourceId,
|
|
206
|
+
reason,
|
|
207
|
+
};
|
|
208
|
+
appendTemporalEvent(history, "EVENT_TYPE_ACTIVITY_TASK_COMPLETED", {
|
|
209
|
+
activityName: `compensate:${comp.stepName}`,
|
|
210
|
+
compensationAction: comp.compensationAction,
|
|
211
|
+
result: comp.output,
|
|
212
|
+
}, now);
|
|
213
|
+
}
|
|
214
|
+
for (const step of wf.steps) {
|
|
215
|
+
if (step.status === "completed" && step.compensationAction) {
|
|
216
|
+
step.status = "compensated";
|
|
217
|
+
step.compensatedAt = now;
|
|
218
|
+
}
|
|
219
|
+
else if (step.status === "waiting" || step.status === "pending") {
|
|
220
|
+
step.status = "failed";
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
appendTemporalEvent(history, "EVENT_TYPE_WORKFLOW_EXECUTION_CANCELED", {
|
|
224
|
+
workflowId: wf.id,
|
|
225
|
+
status: "rolled_back",
|
|
226
|
+
reason,
|
|
227
|
+
compensatedStepsCount: compensations.filter((c) => c.status === "executed")
|
|
228
|
+
.length,
|
|
229
|
+
}, now);
|
|
230
|
+
wf.compensations = compensations;
|
|
231
|
+
wf.temporalEventHistory = history;
|
|
232
|
+
wf.rollbackReason = reason;
|
|
233
|
+
wf.status = "rolled_back";
|
|
234
|
+
wf.updatedAt = now;
|
|
235
|
+
return wf;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Sends a named Temporal signal to a DurableWorkflow (`human.approval.granted`, `oauth.connection.active`,
|
|
239
|
+
* `saga.abort`, or `v2.provisioning.resource.completed`).
|
|
240
|
+
*/
|
|
241
|
+
export function signalDurableWorkflow(wf, params) {
|
|
242
|
+
const now = new Date().toISOString();
|
|
243
|
+
const signalName = String(params.signalName || WORKFLOW_RESOURCE_COMPLETED_EVENT).trim();
|
|
244
|
+
const payload = params.payload || {};
|
|
245
|
+
wf.signals = wf.signals || [];
|
|
246
|
+
wf.signals.push({
|
|
247
|
+
signalName,
|
|
248
|
+
payload,
|
|
249
|
+
receivedAt: now,
|
|
250
|
+
});
|
|
251
|
+
if (signalName === "saga.abort" ||
|
|
252
|
+
signalName === "human.approval.rejected" ||
|
|
253
|
+
payload.action === "rollback") {
|
|
254
|
+
return rollbackDurableWorkflow(wf, {
|
|
255
|
+
reason: String(payload.reason || `Rolled back via signal ${signalName}`),
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
return completeCloudProvisioningWorkflow(wf, {
|
|
259
|
+
secretKeys: params.secretKeys || ["DATABASE_URL"],
|
|
260
|
+
triggerEvent: signalName,
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Exports a DurableWorkflow in Temporal Web UI / `temporal workflow show` compatible EventHistory JSON format.
|
|
265
|
+
*/
|
|
266
|
+
export function exportTemporalEventHistory(wf) {
|
|
267
|
+
const events = wf.temporalEventHistory || [];
|
|
268
|
+
return {
|
|
269
|
+
namespace: `muxo.${wf.workspaceId}`,
|
|
270
|
+
workflowExecution: {
|
|
271
|
+
workflowId: wf.id,
|
|
272
|
+
runId: wf.runId || `run_${wf.id}`,
|
|
273
|
+
},
|
|
274
|
+
workflowType: {
|
|
275
|
+
name: wf.playbookSlug
|
|
276
|
+
? `MuxoPlaybookSaga::${wf.playbookSlug}`
|
|
277
|
+
: `MuxoWorkflow::${wf.workflowType}`,
|
|
278
|
+
},
|
|
279
|
+
status: wf.status,
|
|
280
|
+
eventsCount: events.length,
|
|
281
|
+
compensationsCount: (wf.compensations || []).length,
|
|
282
|
+
events,
|
|
283
|
+
};
|
|
284
|
+
}
|
package/dist/engine.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { MuxoConfig } from "./config.js";
|
|
2
2
|
import { type DurableWorkflow } from "./durable-workflow.js";
|
|
3
|
+
import { type CommercialPlaybookDefinition, type CommercialRoiReport, type CompiledPolicyAsCodeBundle, type OtelTraceExportBundle, type PolicyAsCodeEvaluationResult } from "./oss-suite.js";
|
|
3
4
|
import { type NaturalLanguageResolution } from "./nl.js";
|
|
4
|
-
import { describePolicyInPlainEnglish, type GuardrailCompileOptions, type ParsedNaturalLanguageGuardrail } from "./policy.js";
|
|
5
|
+
import { describePolicyInPlainEnglish, type GuardrailCompileOptions, type LlmPolicyAndGovernanceBrief, type ParsedNaturalLanguageGuardrail, type PolicySimulationResult } from "./policy.js";
|
|
5
6
|
import { ComposioInstantAdapter } from "./providers/composio-instant.js";
|
|
6
7
|
import { ComposioSdkAdapter } from "./providers/composio-sdk.js";
|
|
7
8
|
import { MicrosoftGovernanceAdapter } from "./providers/microsoft-governance.js";
|
|
@@ -66,6 +67,7 @@ export declare class MuxoEngine {
|
|
|
66
67
|
provider?: string;
|
|
67
68
|
syncLive?: boolean;
|
|
68
69
|
}): Promise<Record<string, unknown>>;
|
|
70
|
+
getHostedSiteHtml(slug: string, filePath?: string): string | null;
|
|
69
71
|
startConnection(ctx: ExecutionContext, params: {
|
|
70
72
|
provider: string;
|
|
71
73
|
lane?: ProviderLane;
|
|
@@ -190,9 +192,15 @@ export declare class MuxoEngine {
|
|
|
190
192
|
}>;
|
|
191
193
|
/**
|
|
192
194
|
* Synthesizes a Bi-Temporal Knowledge Graph (entities, active relationships, superseded historical relationships,
|
|
193
|
-
* Mermaid diagram, and human + technical explanations)
|
|
195
|
+
* Mermaid diagram, point-in-time `asOf` time-travel, 2-hop BFS subgraph, and human + technical explanations)
|
|
196
|
+
* directly from SQLite temporal_facts, memories, resources, and connections.
|
|
194
197
|
*/
|
|
195
|
-
getMemoryGraph(ctx: ExecutionContext,
|
|
198
|
+
getMemoryGraph(ctx: ExecutionContext, queryOrOptions?: string | {
|
|
199
|
+
query?: string;
|
|
200
|
+
asOf?: string | null;
|
|
201
|
+
focalEntity?: string | null;
|
|
202
|
+
maxHops?: number;
|
|
203
|
+
}): Promise<MemoryKnowledgeGraph>;
|
|
196
204
|
activateWorkspaceKillSwitch(ctx: ExecutionContext, params: {
|
|
197
205
|
reason: string;
|
|
198
206
|
action?: "terminate" | "quarantine" | "suspend";
|
|
@@ -287,8 +295,22 @@ export declare class MuxoEngine {
|
|
|
287
295
|
trustScore: ReturnType<MicrosoftGovernanceAdapter["getWorkspaceTrustScore"]>;
|
|
288
296
|
policy: Workspace["policy"];
|
|
289
297
|
plainEnglish: ReturnType<typeof describePolicyInPlainEnglish>;
|
|
298
|
+
llmPolicyBrief: LlmPolicyAndGovernanceBrief;
|
|
299
|
+
explanation: HumanFriendlyExplanation;
|
|
300
|
+
};
|
|
301
|
+
resetWorkspaceGuardrails(ctx: ExecutionContext): {
|
|
302
|
+
ok: true;
|
|
303
|
+
action: "reset_guardrails";
|
|
304
|
+
workspace: Workspace;
|
|
305
|
+
policy: Workspace["policy"];
|
|
306
|
+
plainEnglish: ReturnType<typeof describePolicyInPlainEnglish>;
|
|
307
|
+
llmPolicyBrief: LlmPolicyAndGovernanceBrief;
|
|
290
308
|
explanation: HumanFriendlyExplanation;
|
|
291
309
|
};
|
|
310
|
+
checkToolPolicy(ctx: ExecutionContext, params: {
|
|
311
|
+
toolSlug: string;
|
|
312
|
+
input?: Record<string, unknown>;
|
|
313
|
+
}): Promise<PolicySimulationResult>;
|
|
292
314
|
setKillSwitch(ctx: ExecutionContext, active: boolean, reason?: string): Workspace;
|
|
293
315
|
scanForContextPoisoning(workspaceId: string, text: string): {
|
|
294
316
|
poisoned: boolean;
|
|
@@ -301,6 +323,7 @@ export declare class MuxoEngine {
|
|
|
301
323
|
workspaceId: string;
|
|
302
324
|
policy: Workspace["policy"];
|
|
303
325
|
plainEnglish: ReturnType<typeof describePolicyInPlainEnglish>;
|
|
326
|
+
llmPolicyBrief: LlmPolicyAndGovernanceBrief;
|
|
304
327
|
activeDefaults: ActiveMemoryDefaults;
|
|
305
328
|
activeGuardrails: string[];
|
|
306
329
|
};
|
|
@@ -309,6 +332,7 @@ export declare class MuxoEngine {
|
|
|
309
332
|
workspace: Workspace;
|
|
310
333
|
guardrail: ParsedNaturalLanguageGuardrail;
|
|
311
334
|
plainEnglish: ReturnType<typeof describePolicyInPlainEnglish>;
|
|
335
|
+
llmPolicyBrief: LlmPolicyAndGovernanceBrief;
|
|
312
336
|
memoryRecord?: WorkspaceMemoryRecord;
|
|
313
337
|
}>;
|
|
314
338
|
doNaturalLanguage(ctx: ExecutionContext, params: {
|
|
@@ -400,6 +424,61 @@ export declare class MuxoEngine {
|
|
|
400
424
|
}): Promise<DurableWorkflow>;
|
|
401
425
|
advanceDurableWorkflow(ctx: ExecutionContext, workflowId: string, eventPayload?: Record<string, unknown>): Promise<DurableWorkflow>;
|
|
402
426
|
listDurableWorkflows(workspaceId: string): DurableWorkflow[];
|
|
427
|
+
getDurableWorkflow(ctx: ExecutionContext, workflowId: string): DurableWorkflow;
|
|
428
|
+
getDurableWorkflowHistory(ctx: ExecutionContext, workflowId: string): {
|
|
429
|
+
namespace: string;
|
|
430
|
+
workflowExecution: {
|
|
431
|
+
workflowId: string;
|
|
432
|
+
runId: string;
|
|
433
|
+
};
|
|
434
|
+
workflowType: {
|
|
435
|
+
name: string;
|
|
436
|
+
};
|
|
437
|
+
status: DurableWorkflow["status"];
|
|
438
|
+
eventsCount: number;
|
|
439
|
+
compensationsCount: number;
|
|
440
|
+
events: import("./durable-workflow.js").TemporalHistoryEvent[];
|
|
441
|
+
};
|
|
442
|
+
signalDurableWorkflow(ctx: ExecutionContext, workflowId: string, params: {
|
|
443
|
+
signalName: string;
|
|
444
|
+
payload?: Record<string, unknown>;
|
|
445
|
+
}): DurableWorkflow;
|
|
446
|
+
rollbackDurableWorkflow(ctx: ExecutionContext, workflowId: string, params?: {
|
|
447
|
+
reason?: string;
|
|
448
|
+
failedStep?: string;
|
|
449
|
+
}): DurableWorkflow;
|
|
450
|
+
/**
|
|
451
|
+
* AWS Cedar & Open Policy Agent (OPA / Rego) Policy-as-Code Compiler & Evaluator.
|
|
452
|
+
*/
|
|
453
|
+
getPolicyAsCodeBundle(ctx: ExecutionContext): CompiledPolicyAsCodeBundle;
|
|
454
|
+
evaluatePolicyAsCode(ctx: ExecutionContext, params: {
|
|
455
|
+
toolSlug: string;
|
|
456
|
+
input?: Record<string, unknown>;
|
|
457
|
+
riskLevel?: RiskLevel;
|
|
458
|
+
creditCost?: number;
|
|
459
|
+
lane?: string;
|
|
460
|
+
}): Promise<PolicyAsCodeEvaluationResult>;
|
|
461
|
+
/**
|
|
462
|
+
* OpenTelemetry (OTel GenAI / MCP Semantic Conventions) & Langfuse Trace Exporter.
|
|
463
|
+
*/
|
|
464
|
+
exportOtelTraces(ctx: ExecutionContext, limit?: number): OtelTraceExportBundle;
|
|
465
|
+
/**
|
|
466
|
+
* Turnkey Commercial Business Saga Playbooks.
|
|
467
|
+
*/
|
|
468
|
+
listCommercialPlaybooks(): CommercialPlaybookDefinition[];
|
|
469
|
+
runCommercialPlaybook(ctx: ExecutionContext, params: {
|
|
470
|
+
slug: string;
|
|
471
|
+
input?: Record<string, unknown>;
|
|
472
|
+
}): {
|
|
473
|
+
ok: true;
|
|
474
|
+
playbook: CommercialPlaybookDefinition;
|
|
475
|
+
workflow: DurableWorkflow;
|
|
476
|
+
temporalFact: import("./types.js").TemporalGraphFact;
|
|
477
|
+
};
|
|
478
|
+
/**
|
|
479
|
+
* FinOps & Commercial ROI Unit-Economics Analytics.
|
|
480
|
+
*/
|
|
481
|
+
getCommercialRoiReport(ctx: ExecutionContext): CommercialRoiReport;
|
|
403
482
|
/**
|
|
404
483
|
* Hybrid Semantic Vector + Bi-Temporal Recall (`@cf/baai/bge-base-en-v1.5` + Vectorize model).
|
|
405
484
|
*/
|