@muxoai/sdk 1.4.2 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/plugins/marketplace.json +1 -1
- package/.claude-plugin/marketplace.json +2 -2
- package/README.md +15 -1
- package/dist/cli.js +217 -0
- package/dist/composio-catalog.d.ts +25 -0
- package/dist/composio-catalog.js +145 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.js +1 -0
- package/dist/durable-workflow.d.ts +71 -4
- package/dist/durable-workflow.js +199 -5
- package/dist/engine.d.ts +110 -4
- package/dist/engine.js +603 -24
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/mcp-schema.d.ts +14 -0
- package/dist/mcp-schema.js +85 -7
- package/dist/mcp.js +325 -5
- package/dist/memory-graph.d.ts +26 -2
- package/dist/memory-graph.js +127 -7
- package/dist/oss-suite.d.ts +401 -0
- package/dist/oss-suite.js +2065 -0
- package/dist/policy.js +59 -0
- package/dist/providers/composio-instant.js +54 -36
- package/dist/providers/composio-sdk.d.ts +10 -1
- package/dist/providers/composio-sdk.js +144 -31
- package/dist/sdk.d.ts +43 -1
- package/dist/sdk.js +85 -2
- package/dist/server.js +231 -3
- package/dist/skills-catalog.d.ts +66 -0
- package/dist/skills-catalog.js +801 -0
- package/dist/types.d.ts +51 -1
- package/dist/ui/console-html.js +23 -8
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/plugins/muxo/.claude-plugin/plugin.json +1 -1
- package/plugins/muxo/.codex-plugin/plugin.json +2 -2
- package/plugins/muxo/.cursor-plugin/plugin.json +1 -1
- package/plugins/muxo/plugin.json +2 -2
- package/plugins/muxo/skills/muxo/SKILL.md +13 -3
package/dist/memory-graph.js
CHANGED
|
@@ -1,11 +1,102 @@
|
|
|
1
1
|
import { formatHumanFriendlyExplanation } from "./policy.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Graphiti-style Point-in-Time ("As-Of") Bi-Temporal Fact Filter.
|
|
4
|
+
* Reconstructs which facts were active at `asOf` vs. already retired by `asOf`,
|
|
5
|
+
* excluding facts created after `asOf`.
|
|
6
|
+
*/
|
|
7
|
+
export function filterFactsAsOf(facts, asOf) {
|
|
8
|
+
if (!asOf || !asOf.trim()) {
|
|
9
|
+
return {
|
|
10
|
+
scopedFacts: facts,
|
|
11
|
+
isActiveAtPointInTime: (fact) => fact.validTo === null,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
const asOfMs = Date.parse(asOf);
|
|
15
|
+
if (!Number.isFinite(asOfMs)) {
|
|
16
|
+
return {
|
|
17
|
+
scopedFacts: facts,
|
|
18
|
+
isActiveAtPointInTime: (fact) => fact.validTo === null,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const scopedFacts = facts.filter((fact) => {
|
|
22
|
+
const validFromMs = Date.parse(fact.validFrom || fact.createdAt);
|
|
23
|
+
return !Number.isFinite(validFromMs) || validFromMs <= asOfMs;
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
scopedFacts,
|
|
27
|
+
isActiveAtPointInTime: (fact) => {
|
|
28
|
+
if (!fact.validTo)
|
|
29
|
+
return true;
|
|
30
|
+
const validToMs = Date.parse(fact.validTo);
|
|
31
|
+
return Number.isFinite(validToMs) && validToMs > asOfMs;
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Graphiti-style Multi-Hop Subgraph Community Traversal (BFS).
|
|
37
|
+
* Finds all nodes and edges within `maxHops` (default 2) of a focal entity.
|
|
38
|
+
*/
|
|
39
|
+
export function traverseSubgraphBfs(nodes, edges, focalQuery, maxHops = 2) {
|
|
40
|
+
const needle = focalQuery.trim().toLowerCase();
|
|
41
|
+
const clampedHops = Math.min(4, Math.max(1, Number(maxHops) || 2));
|
|
42
|
+
const seedNode = nodes.find((n) => n.id.toLowerCase() === needle) ||
|
|
43
|
+
nodes.find((n) => n.label.toLowerCase() === needle) ||
|
|
44
|
+
nodes.find((n) => n.id.toLowerCase().includes(needle) ||
|
|
45
|
+
n.label.toLowerCase().includes(needle)) ||
|
|
46
|
+
nodes[0];
|
|
47
|
+
if (!seedNode) {
|
|
48
|
+
return {
|
|
49
|
+
focalEntity: focalQuery,
|
|
50
|
+
maxHops: clampedHops,
|
|
51
|
+
nodes: [],
|
|
52
|
+
edges: [],
|
|
53
|
+
hopDistances: {},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const hopDistances = { [seedNode.id]: 0 };
|
|
57
|
+
const queue = [
|
|
58
|
+
{ nodeId: seedNode.id, depth: 0 },
|
|
59
|
+
];
|
|
60
|
+
while (queue.length > 0) {
|
|
61
|
+
const current = queue.shift();
|
|
62
|
+
if (current.depth >= clampedHops)
|
|
63
|
+
continue;
|
|
64
|
+
for (const edge of edges) {
|
|
65
|
+
let neighborId = null;
|
|
66
|
+
if (edge.source === current.nodeId)
|
|
67
|
+
neighborId = edge.target;
|
|
68
|
+
else if (edge.target === current.nodeId)
|
|
69
|
+
neighborId = edge.source;
|
|
70
|
+
if (neighborId && hopDistances[neighborId] === undefined) {
|
|
71
|
+
hopDistances[neighborId] = current.depth + 1;
|
|
72
|
+
queue.push({ nodeId: neighborId, depth: current.depth + 1 });
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const subNodes = nodes
|
|
77
|
+
.filter((n) => hopDistances[n.id] !== undefined)
|
|
78
|
+
.map((n) => ({ ...n, hopDistance: hopDistances[n.id] }));
|
|
79
|
+
const subEdges = edges.filter((e) => hopDistances[e.source] !== undefined &&
|
|
80
|
+
hopDistances[e.target] !== undefined);
|
|
81
|
+
return {
|
|
82
|
+
focalEntity: seedNode.id,
|
|
83
|
+
maxHops: clampedHops,
|
|
84
|
+
nodes: subNodes,
|
|
85
|
+
edges: subEdges,
|
|
86
|
+
hopDistances,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Builds the Graphiti-inspired Bi-Temporal Knowledge Graph (nodes, active/historical edges,
|
|
91
|
+
* episodic provenance, point-in-time `asOf` time-travel, 2-hop BFS subgraph, and Mermaid preview)
|
|
4
92
|
* from runtime-agnostic inputs so the Node engine and the Edge Worker render identical graphs.
|
|
5
93
|
*/
|
|
6
94
|
export function buildMemoryKnowledgeGraph(input) {
|
|
7
95
|
const ws = input.workspace;
|
|
8
96
|
const query = input.query;
|
|
97
|
+
const asOf = input.asOf ?? null;
|
|
98
|
+
const maxHops = Math.min(4, Math.max(1, Number(input.maxHops || 2)));
|
|
99
|
+
const { scopedFacts, isActiveAtPointInTime } = filterFactsAsOf(input.facts, asOf);
|
|
9
100
|
const nodeMap = new Map();
|
|
10
101
|
const rootId = `workspace:${ws.slug}`;
|
|
11
102
|
nodeMap.set(rootId, {
|
|
@@ -34,7 +125,9 @@ export function buildMemoryKnowledgeGraph(input) {
|
|
|
34
125
|
? "tool"
|
|
35
126
|
: id.startsWith("guardrail:")
|
|
36
127
|
? "guardrail"
|
|
37
|
-
:
|
|
128
|
+
: id.startsWith("episode:")
|
|
129
|
+
? "episode"
|
|
130
|
+
: fallbackKind;
|
|
38
131
|
const label = id.includes(":")
|
|
39
132
|
? id.split(":").slice(1).join(":")
|
|
40
133
|
: id.length > 36
|
|
@@ -50,8 +143,11 @@ export function buildMemoryKnowledgeGraph(input) {
|
|
|
50
143
|
nodeMap.set(id, created);
|
|
51
144
|
return created;
|
|
52
145
|
};
|
|
53
|
-
|
|
54
|
-
|
|
146
|
+
let episodesCount = 0;
|
|
147
|
+
const edges = scopedFacts.map((fact) => {
|
|
148
|
+
const status = isActiveAtPointInTime(fact)
|
|
149
|
+
? "active"
|
|
150
|
+
: "historical";
|
|
55
151
|
const objKind = fact.sourceKind === "preference"
|
|
56
152
|
? "preference"
|
|
57
153
|
: fact.sourceKind === "policy_decision"
|
|
@@ -61,6 +157,15 @@ export function buildMemoryKnowledgeGraph(input) {
|
|
|
61
157
|
: "entity";
|
|
62
158
|
ensureNode(fact.subject, status, "entity", fact.subject);
|
|
63
159
|
ensureNode(fact.object, status, objKind, fact.summary);
|
|
160
|
+
const episodeId = fact.episodeId || fact.sourceReferenceId || null;
|
|
161
|
+
if (episodeId) {
|
|
162
|
+
const epNodeId = episodeId.startsWith("episode:")
|
|
163
|
+
? episodeId
|
|
164
|
+
: `episode:${episodeId}`;
|
|
165
|
+
if (!nodeMap.has(epNodeId))
|
|
166
|
+
episodesCount += 1;
|
|
167
|
+
ensureNode(epNodeId, status, "episode", `Episodic provenance (${episodeId})`);
|
|
168
|
+
}
|
|
64
169
|
return {
|
|
65
170
|
id: fact.id,
|
|
66
171
|
source: fact.subject,
|
|
@@ -72,7 +177,10 @@ export function buildMemoryKnowledgeGraph(input) {
|
|
|
72
177
|
confidence: fact.confidence,
|
|
73
178
|
status,
|
|
74
179
|
validFrom: fact.validFrom,
|
|
75
|
-
validTo: fact.validTo,
|
|
180
|
+
validTo: status === "active" && asOf ? null : fact.validTo,
|
|
181
|
+
transactionFrom: fact.transactionFrom || fact.createdAt,
|
|
182
|
+
transactionTo: fact.transactionTo ?? fact.validTo,
|
|
183
|
+
episodeId,
|
|
76
184
|
supersededById: fact.supersededById ?? null,
|
|
77
185
|
sourceKind: fact.sourceKind,
|
|
78
186
|
sourceReferenceId: fact.sourceReferenceId ?? null,
|
|
@@ -95,6 +203,9 @@ export function buildMemoryKnowledgeGraph(input) {
|
|
|
95
203
|
status: "active",
|
|
96
204
|
validFrom: conn.createdAt,
|
|
97
205
|
validTo: null,
|
|
206
|
+
transactionFrom: conn.createdAt,
|
|
207
|
+
transactionTo: null,
|
|
208
|
+
episodeId: conn.id,
|
|
98
209
|
supersededById: null,
|
|
99
210
|
sourceKind: "system",
|
|
100
211
|
sourceReferenceId: conn.id,
|
|
@@ -104,6 +215,10 @@ export function buildMemoryKnowledgeGraph(input) {
|
|
|
104
215
|
const activeEdges = edges.filter((e) => e.status === "active");
|
|
105
216
|
const historicalEdges = edges.filter((e) => e.status === "historical");
|
|
106
217
|
const nodes = Array.from(nodeMap.values());
|
|
218
|
+
const focalTarget = input.focalEntity || query || null;
|
|
219
|
+
const subgraph = focalTarget
|
|
220
|
+
? traverseSubgraphBfs(nodes, edges, focalTarget, maxHops)
|
|
221
|
+
: null;
|
|
107
222
|
const safeMermaidId = (raw, idx) => `N${idx}_${raw.replace(/[^a-zA-Z0-9]/g, "_").slice(0, 14)}`;
|
|
108
223
|
const nodeIndex = new Map();
|
|
109
224
|
nodes.slice(0, 24).forEach((n, idx) => {
|
|
@@ -128,7 +243,7 @@ export function buildMemoryKnowledgeGraph(input) {
|
|
|
128
243
|
mermaidLines.push(` ${srcId} -.->|RETIRED: ${pred}| ${tgtId}`);
|
|
129
244
|
}
|
|
130
245
|
}
|
|
131
|
-
const headline = `Bi-Temporal Knowledge Graph (${ws.name}): ${activeEdges.length} active relationship${activeEdges.length === 1 ? "" : "s"}, ${historicalEdges.length} superseded historical relationship${historicalEdges.length === 1 ? "" : "s"} across ${nodes.length} node${nodes.length === 1 ? "" : "s"}.`;
|
|
246
|
+
const headline = `Bi-Temporal Knowledge Graph (${ws.name}${asOf ? ` as of ${asOf}` : ""}): ${activeEdges.length} active relationship${activeEdges.length === 1 ? "" : "s"}, ${historicalEdges.length} superseded historical relationship${historicalEdges.length === 1 ? "" : "s"} across ${nodes.length} node${nodes.length === 1 ? "" : "s"}.`;
|
|
132
247
|
const activePreview = activeEdges
|
|
133
248
|
.slice(0, 4)
|
|
134
249
|
.map((e) => `${e.source} --[${e.predicate}]--> ${e.target}`)
|
|
@@ -142,7 +257,7 @@ export function buildMemoryKnowledgeGraph(input) {
|
|
|
142
257
|
? `Time-travel lineage: ${historicalEdges.length} older fact${historicalEdges.length === 1 ? " was" : "s were"} automatically retired when newer workspace settings or facts replaced them.`
|
|
143
258
|
: "No superseded historical facts yet.",
|
|
144
259
|
].join(" ");
|
|
145
|
-
const technical = `workspace=${ws.id} | namespace=${input.namespace} | nodes=${nodes.length} | activeEdges=${activeEdges.length} | historicalEdges=${historicalEdges.length} | memories=${input.memoriesCount} | activePreview=[${activePreview || "none"}]`;
|
|
260
|
+
const technical = `workspace=${ws.id} | namespace=${input.namespace} | asOf=${asOf || "latest"} | nodes=${nodes.length} | activeEdges=${activeEdges.length} | historicalEdges=${historicalEdges.length} | episodes=${episodesCount} | memories=${input.memoriesCount} | activePreview=[${activePreview || "none"}]`;
|
|
146
261
|
const explanation = formatHumanFriendlyExplanation({
|
|
147
262
|
headline,
|
|
148
263
|
nonTechnical,
|
|
@@ -154,11 +269,15 @@ export function buildMemoryKnowledgeGraph(input) {
|
|
|
154
269
|
workspaceSlug: ws.slug,
|
|
155
270
|
namespace: input.namespace,
|
|
156
271
|
generatedAt: new Date().toISOString(),
|
|
272
|
+
asOf,
|
|
273
|
+
focalEntity: subgraph?.focalEntity ?? null,
|
|
274
|
+
maxHops,
|
|
157
275
|
query: query ?? null,
|
|
158
276
|
nodes,
|
|
159
277
|
edges,
|
|
160
278
|
activeEdges,
|
|
161
279
|
historicalEdges,
|
|
280
|
+
subgraph,
|
|
162
281
|
stats: {
|
|
163
282
|
nodesCount: nodes.length,
|
|
164
283
|
activeEdgesCount: activeEdges.length,
|
|
@@ -166,6 +285,7 @@ export function buildMemoryKnowledgeGraph(input) {
|
|
|
166
285
|
memoriesCount: input.memoriesCount,
|
|
167
286
|
resourcesCount: input.resources.length,
|
|
168
287
|
connectionsCount: input.activeConnections.length,
|
|
288
|
+
episodesCount,
|
|
169
289
|
},
|
|
170
290
|
mermaid: mermaidLines.join("\n"),
|
|
171
291
|
explanation,
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified Open-Source & Commercial Enterprise Suite (Runtime-Agnostic: Node.js + Cloudflare Workers):
|
|
3
|
+
* 1. AWS Cedar & Open Policy Agent (OPA / Rego) Policy-as-Code Compiler & Evaluator
|
|
4
|
+
* 2. OpenTelemetry (OTel GenAI / MCP Semantic Conventions) OTLP JSON & Langfuse Trace Exporter
|
|
5
|
+
* 3. Turnkey Commercial Business Saga Playbooks (backed by Temporal-compatible DurableWorkflows)
|
|
6
|
+
* 4. FinOps & Commercial ROI Unit-Economics Analytics
|
|
7
|
+
*/
|
|
8
|
+
import { type DurableWorkflow } from "./durable-workflow.js";
|
|
9
|
+
import type { ActionPlan, ApprovalImpactPreview, BusinessReceiptSummary, ByokKeyRecord, ExecutionReceipt, ExecutionRun, GovernanceDecisionRecord, GovernancePolicy, HumanFriendlyExplanation, ProviderLane, ProvisionedResource, RiskLevel, SupplierSettlement, TemporalGraphFact, Workspace } from "./types.js";
|
|
10
|
+
export interface CompiledPolicyAsCodeBundle {
|
|
11
|
+
workspaceId: string;
|
|
12
|
+
workspaceSlug: string;
|
|
13
|
+
generatedAt: string;
|
|
14
|
+
engines: ["aws-cedar-4.x", "open-policy-agent-rego-v1"];
|
|
15
|
+
cedarSchemaVersion: "4.0";
|
|
16
|
+
cedarPolicyText: string;
|
|
17
|
+
opaRegoText: string;
|
|
18
|
+
statements: Array<{
|
|
19
|
+
id: string;
|
|
20
|
+
effect: "permit" | "forbid";
|
|
21
|
+
description: string;
|
|
22
|
+
statement: string;
|
|
23
|
+
}>;
|
|
24
|
+
cedar: {
|
|
25
|
+
schemaNamespace: "Muxo";
|
|
26
|
+
statementsCount: number;
|
|
27
|
+
policyText: string;
|
|
28
|
+
statements: Array<{
|
|
29
|
+
id: string;
|
|
30
|
+
effect: "permit" | "forbid";
|
|
31
|
+
description: string;
|
|
32
|
+
statement: string;
|
|
33
|
+
}>;
|
|
34
|
+
};
|
|
35
|
+
opa: {
|
|
36
|
+
packageName: "muxo.authz";
|
|
37
|
+
rulesCount: number;
|
|
38
|
+
regoText: string;
|
|
39
|
+
};
|
|
40
|
+
plainEnglishSummary: string[];
|
|
41
|
+
explanation: HumanFriendlyExplanation;
|
|
42
|
+
}
|
|
43
|
+
export interface PolicyAsCodeEvaluationResult {
|
|
44
|
+
workspaceId: string;
|
|
45
|
+
toolSlug: string;
|
|
46
|
+
riskLevel: RiskLevel;
|
|
47
|
+
creditCost: number;
|
|
48
|
+
allowed: boolean;
|
|
49
|
+
decision: "ALLOW" | "DENY" | "REQUIRE_APPROVAL";
|
|
50
|
+
policyDecision: "allow" | "deny" | "require_approval";
|
|
51
|
+
cedarResult: {
|
|
52
|
+
decision: "ALLOW" | "DENY";
|
|
53
|
+
determiningPolicies: string[];
|
|
54
|
+
errors: string[];
|
|
55
|
+
};
|
|
56
|
+
opaResult: {
|
|
57
|
+
allow: boolean;
|
|
58
|
+
decision: "allow" | "deny" | "review";
|
|
59
|
+
denyReasons: string[];
|
|
60
|
+
reviewReasons: string[];
|
|
61
|
+
};
|
|
62
|
+
matchedStatements: string[];
|
|
63
|
+
remediationForLlm: string;
|
|
64
|
+
compiledBundle: CompiledPolicyAsCodeBundle;
|
|
65
|
+
}
|
|
66
|
+
export declare function compileWorkspacePolicyToCedarAndRego(policy: GovernancePolicy, workspace: Pick<Workspace, "id" | "slug" | "name">): CompiledPolicyAsCodeBundle;
|
|
67
|
+
export declare function evaluateCedarAndOpaPolicy(params: {
|
|
68
|
+
policy: GovernancePolicy;
|
|
69
|
+
workspace: Pick<Workspace, "id" | "slug" | "name">;
|
|
70
|
+
toolSlug: string;
|
|
71
|
+
input?: Record<string, unknown>;
|
|
72
|
+
riskLevel?: RiskLevel;
|
|
73
|
+
creditCost?: number;
|
|
74
|
+
lane?: string;
|
|
75
|
+
}): PolicyAsCodeEvaluationResult;
|
|
76
|
+
export interface OtelSpanAttribute {
|
|
77
|
+
key: string;
|
|
78
|
+
value: {
|
|
79
|
+
stringValue?: string;
|
|
80
|
+
intValue?: number;
|
|
81
|
+
boolValue?: boolean;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export interface OtelTraceExportBundle {
|
|
85
|
+
workspaceId: string;
|
|
86
|
+
workspaceSlug: string;
|
|
87
|
+
exportedAt: string;
|
|
88
|
+
protocol: "OTLP/HTTP-JSON-v1";
|
|
89
|
+
semanticConventions: ["gen_ai.1.29.0", "mcp.2026-07-28", "muxo.governance.v5"];
|
|
90
|
+
w3cTraceParent: string;
|
|
91
|
+
w3cTraceContextSample: string;
|
|
92
|
+
spansCount: number;
|
|
93
|
+
otlpPayload: {
|
|
94
|
+
resourceSpans: OtelTraceExportBundle["resourceSpans"];
|
|
95
|
+
};
|
|
96
|
+
resourceSpans: Array<{
|
|
97
|
+
resource: {
|
|
98
|
+
attributes: OtelSpanAttribute[];
|
|
99
|
+
};
|
|
100
|
+
scopeSpans: Array<{
|
|
101
|
+
scope: {
|
|
102
|
+
name: string;
|
|
103
|
+
version: string;
|
|
104
|
+
};
|
|
105
|
+
spans: Array<{
|
|
106
|
+
traceId: string;
|
|
107
|
+
spanId: string;
|
|
108
|
+
parentSpanId?: string;
|
|
109
|
+
traceparent: string;
|
|
110
|
+
name: string;
|
|
111
|
+
kind: "SPAN_KIND_SERVER" | "SPAN_KIND_CLIENT";
|
|
112
|
+
startTimeUnixNano: string;
|
|
113
|
+
endTimeUnixNano: string;
|
|
114
|
+
status: {
|
|
115
|
+
code: "STATUS_CODE_OK" | "STATUS_CODE_ERROR";
|
|
116
|
+
message?: string;
|
|
117
|
+
};
|
|
118
|
+
attributes: OtelSpanAttribute[];
|
|
119
|
+
}>;
|
|
120
|
+
}>;
|
|
121
|
+
}>;
|
|
122
|
+
langfuseBatch: Array<{
|
|
123
|
+
id: string;
|
|
124
|
+
type: "trace-create" | "span-create";
|
|
125
|
+
timestamp: string;
|
|
126
|
+
body: Record<string, unknown>;
|
|
127
|
+
}>;
|
|
128
|
+
}
|
|
129
|
+
export declare function buildOtelTraceExport(params: {
|
|
130
|
+
workspace: Pick<Workspace, "id" | "slug" | "name" | "tier">;
|
|
131
|
+
runs: ExecutionRun[];
|
|
132
|
+
receipts: ExecutionReceipt[];
|
|
133
|
+
plans?: ActionPlan[];
|
|
134
|
+
version?: string;
|
|
135
|
+
}): OtelTraceExportBundle;
|
|
136
|
+
export interface CommercialPlaybookDefinition {
|
|
137
|
+
slug: string;
|
|
138
|
+
name: string;
|
|
139
|
+
persona: "Customer Operations & Support" | "Engineering & DevOps" | "Marketing & Growth" | "SecOps & Compliance" | "Product & Founders" | "Custom Workspace Saga";
|
|
140
|
+
summary: string;
|
|
141
|
+
commercialValue: string;
|
|
142
|
+
estimatedMinutesSaved: number;
|
|
143
|
+
creditCost: number;
|
|
144
|
+
expectedCostUsd: number;
|
|
145
|
+
defaultProvider: string;
|
|
146
|
+
defaultServiceRef: string;
|
|
147
|
+
requiredConnections: string[];
|
|
148
|
+
explicitPermissions: string[];
|
|
149
|
+
approvalRules: string[];
|
|
150
|
+
failureAndRecoveryBehavior: string;
|
|
151
|
+
usableBusinessOutcome: string;
|
|
152
|
+
naturalLanguageTriggers?: string[];
|
|
153
|
+
custom?: boolean;
|
|
154
|
+
steps: Array<{
|
|
155
|
+
name: string;
|
|
156
|
+
toolSlug: string;
|
|
157
|
+
primitive: "step.do" | "step.waitForEvent";
|
|
158
|
+
compensationAction?: string;
|
|
159
|
+
description: string;
|
|
160
|
+
}>;
|
|
161
|
+
}
|
|
162
|
+
export declare const MUXO_COMMERCIAL_PLAYBOOKS: CommercialPlaybookDefinition[];
|
|
163
|
+
export declare function getCommercialPlaybook(slugOrQuery: string, customPlaybooks?: CommercialPlaybookDefinition[]): CommercialPlaybookDefinition | null;
|
|
164
|
+
export declare function parseNaturalLanguageCustomPlaybook(prompt: string, explicitInput?: Record<string, unknown>): CommercialPlaybookDefinition;
|
|
165
|
+
export declare function buildPlaybookSagaExecution(params: {
|
|
166
|
+
id: string;
|
|
167
|
+
workspaceId: string;
|
|
168
|
+
workspaceSlug: string;
|
|
169
|
+
playbook: CommercialPlaybookDefinition;
|
|
170
|
+
input?: Record<string, unknown>;
|
|
171
|
+
}): {
|
|
172
|
+
playbook: CommercialPlaybookDefinition;
|
|
173
|
+
workflow: DurableWorkflow;
|
|
174
|
+
usableResult: {
|
|
175
|
+
playbookSlug: string;
|
|
176
|
+
playbookName: string;
|
|
177
|
+
status: "completed";
|
|
178
|
+
summary: string;
|
|
179
|
+
deliverableOutcome: string;
|
|
180
|
+
targetProvider: string;
|
|
181
|
+
targetEntity: string;
|
|
182
|
+
completedStepsCount: number;
|
|
183
|
+
registeredCompensationsCount: number;
|
|
184
|
+
estimatedCostUsd: number;
|
|
185
|
+
creditsMetered: number;
|
|
186
|
+
estimatedMinutesSaved: number;
|
|
187
|
+
recoveryGuarantee: string;
|
|
188
|
+
};
|
|
189
|
+
temporalFact: {
|
|
190
|
+
subject: string;
|
|
191
|
+
predicate: string;
|
|
192
|
+
object: string;
|
|
193
|
+
summary: string;
|
|
194
|
+
episodeId: string;
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
export interface CommercialRoiReport {
|
|
198
|
+
workspaceId: string;
|
|
199
|
+
workspaceSlug: string;
|
|
200
|
+
workspaceName: string;
|
|
201
|
+
tier: string;
|
|
202
|
+
generatedAt: string;
|
|
203
|
+
unitEconomics: {
|
|
204
|
+
creditsBalance: number;
|
|
205
|
+
totalRunsAnalyzed: number;
|
|
206
|
+
succeededRunsCount: number;
|
|
207
|
+
byokZeroCreditRunsCount: number;
|
|
208
|
+
managedFundedRunsCount: number;
|
|
209
|
+
totalCreditsConsumed: number;
|
|
210
|
+
totalMonetarySpendUsd: number;
|
|
211
|
+
byokCreditsSaved: number;
|
|
212
|
+
byokDollarsSavedUsd: number;
|
|
213
|
+
estimatedEngineeringMinutesSaved: number;
|
|
214
|
+
estimatedEngineeringHoursSaved: number;
|
|
215
|
+
estimatedLaborValueSavedUsd: number;
|
|
216
|
+
preventedPolicyViolationsCount: number;
|
|
217
|
+
activeCloudResourcesCount: number;
|
|
218
|
+
activeBiTemporalFactsCount: number;
|
|
219
|
+
configuredByokProviders: string[];
|
|
220
|
+
};
|
|
221
|
+
validationMetrics: {
|
|
222
|
+
timeToFirstSuccessfulActionSeconds: number;
|
|
223
|
+
completionRateWithoutManualRepairPct: number;
|
|
224
|
+
avgTimeSavedPerWorkflowMinutes: number;
|
|
225
|
+
avgCostPerCompletedWorkflowUsd: number;
|
|
226
|
+
repeatWorkflowExecutionsCount: number;
|
|
227
|
+
zeroChargeFailedRunsCount: number;
|
|
228
|
+
};
|
|
229
|
+
workflowBreakdown: Array<{
|
|
230
|
+
toolSlug: string;
|
|
231
|
+
lane: ProviderLane;
|
|
232
|
+
runsCount: number;
|
|
233
|
+
succeededCount: number;
|
|
234
|
+
completionRatePct: number;
|
|
235
|
+
creditsConsumed: number;
|
|
236
|
+
costUsd: number;
|
|
237
|
+
estimatedMinutesSaved: number;
|
|
238
|
+
}>;
|
|
239
|
+
laneBreakdown: Record<ProviderLane, {
|
|
240
|
+
runsCount: number;
|
|
241
|
+
creditsConsumed: number;
|
|
242
|
+
costUsd: number;
|
|
243
|
+
estimatedMinutesSaved: number;
|
|
244
|
+
}>;
|
|
245
|
+
recommendations: Array<{
|
|
246
|
+
id: string;
|
|
247
|
+
category: "byok_savings" | "cloud_consolidation" | "governance_safety" | "playbook_automation";
|
|
248
|
+
title: string;
|
|
249
|
+
impact: string;
|
|
250
|
+
actionCommand: string;
|
|
251
|
+
}>;
|
|
252
|
+
explanation: HumanFriendlyExplanation;
|
|
253
|
+
}
|
|
254
|
+
export declare function buildCommercialRoiReport(params: {
|
|
255
|
+
workspace: Workspace;
|
|
256
|
+
runs: ExecutionRun[];
|
|
257
|
+
plans?: ActionPlan[];
|
|
258
|
+
resources: ProvisionedResource[];
|
|
259
|
+
byokKeys: ByokKeyRecord[];
|
|
260
|
+
temporalFacts: TemporalGraphFact[];
|
|
261
|
+
}): CommercialRoiReport;
|
|
262
|
+
export type HarnessPresetSlug = "startup-builder" | "strict-production" | "read-only-auditor" | "finops-byok-zero-cost";
|
|
263
|
+
export interface HarnessPresetDefinition {
|
|
264
|
+
slug: HarnessPresetSlug;
|
|
265
|
+
name: string;
|
|
266
|
+
summary: string;
|
|
267
|
+
recommendedFor: string;
|
|
268
|
+
naturalLanguageTriggers: string[];
|
|
269
|
+
policyPatch: Partial<GovernancePolicy>;
|
|
270
|
+
}
|
|
271
|
+
export declare const MUXO_HARNESS_PRESETS: HarnessPresetDefinition[];
|
|
272
|
+
export declare function resolveHarnessPreset(presetOrPrompt?: string | null): HarnessPresetDefinition | null;
|
|
273
|
+
export interface HarnessConfigurationBundle {
|
|
274
|
+
ok: true;
|
|
275
|
+
workspaceId: string;
|
|
276
|
+
workspaceSlug: string;
|
|
277
|
+
targetHarness: string;
|
|
278
|
+
appliedPreset: HarnessPresetDefinition | null;
|
|
279
|
+
availablePresets: HarnessPresetDefinition[];
|
|
280
|
+
policy: GovernancePolicy;
|
|
281
|
+
harnessConfigs: {
|
|
282
|
+
claudeCode: {
|
|
283
|
+
installPluginCommand: string;
|
|
284
|
+
addMcpCommand: string;
|
|
285
|
+
mcpJson: Record<string, unknown>;
|
|
286
|
+
};
|
|
287
|
+
cursor: {
|
|
288
|
+
filePath: ".cursor/mcp.json";
|
|
289
|
+
mcpJson: Record<string, unknown>;
|
|
290
|
+
};
|
|
291
|
+
codex: {
|
|
292
|
+
filePath: "~/.codex/config.toml";
|
|
293
|
+
toml: string;
|
|
294
|
+
};
|
|
295
|
+
chatgpt: {
|
|
296
|
+
mcpServerUrl: string;
|
|
297
|
+
authMode: string;
|
|
298
|
+
instructions: string;
|
|
299
|
+
};
|
|
300
|
+
claudeDesktop: {
|
|
301
|
+
filePath: "claude_desktop_config.json";
|
|
302
|
+
mcpJson: Record<string, unknown>;
|
|
303
|
+
};
|
|
304
|
+
factoryDroid: {
|
|
305
|
+
mcpServerUrl: string;
|
|
306
|
+
skillCommand: string;
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
systemPromptDirective: string;
|
|
310
|
+
naturalLanguageCheatsheet: Array<{
|
|
311
|
+
category: string;
|
|
312
|
+
sayInPlainEnglish: string;
|
|
313
|
+
mcpEquivalent: Record<string, unknown>;
|
|
314
|
+
restEndpoint: string;
|
|
315
|
+
}>;
|
|
316
|
+
explanation: HumanFriendlyExplanation;
|
|
317
|
+
humanMessage: string;
|
|
318
|
+
}
|
|
319
|
+
export declare function buildHarnessConfigurationBundle(params: {
|
|
320
|
+
workspace: Pick<Workspace, "id" | "slug" | "name" | "tier" | "policy">;
|
|
321
|
+
baseUrl?: string;
|
|
322
|
+
targetHarness?: string;
|
|
323
|
+
appliedPreset?: HarnessPresetDefinition | null;
|
|
324
|
+
}): HarnessConfigurationBundle;
|
|
325
|
+
export type NaturalLanguageOssIntentKind = "list_playbooks" | "run_playbook" | "create_playbook" | "rollback_workflow" | "signal_workflow" | "workflow_history" | "memory_graph" | "cedar_compile" | "cedar_evaluate" | "otel_traces" | "roi_analytics" | "configure_harness";
|
|
326
|
+
export interface ParsedNaturalLanguageOssIntent {
|
|
327
|
+
matched: boolean;
|
|
328
|
+
kind: NaturalLanguageOssIntentKind | null;
|
|
329
|
+
playbookSlug?: string;
|
|
330
|
+
playbookInput?: Record<string, unknown>;
|
|
331
|
+
customPlaybook?: CommercialPlaybookDefinition;
|
|
332
|
+
workflowId?: string;
|
|
333
|
+
workflowReason?: string;
|
|
334
|
+
signalName?: string;
|
|
335
|
+
signalPayload?: Record<string, unknown>;
|
|
336
|
+
asOf?: string | null;
|
|
337
|
+
focalEntity?: string | null;
|
|
338
|
+
maxHops?: number;
|
|
339
|
+
toolSlug?: string;
|
|
340
|
+
evaluationInput?: Record<string, unknown>;
|
|
341
|
+
preset?: HarnessPresetDefinition | null;
|
|
342
|
+
targetHarness?: string;
|
|
343
|
+
extraGuardrailPrompt?: string | null;
|
|
344
|
+
limit?: number;
|
|
345
|
+
summary: string;
|
|
346
|
+
}
|
|
347
|
+
export declare function extractPlaybookInputFromNaturalLanguage(prompt: string, explicitInput?: Record<string, unknown>): Record<string, unknown>;
|
|
348
|
+
export declare function parseNaturalLanguageOssIntent(prompt: string, options?: {
|
|
349
|
+
customPlaybooks?: CommercialPlaybookDefinition[];
|
|
350
|
+
explicitInput?: Record<string, unknown>;
|
|
351
|
+
}): ParsedNaturalLanguageOssIntent;
|
|
352
|
+
export declare function buildApprovalImpactPreview(params: {
|
|
353
|
+
toolSlug: string;
|
|
354
|
+
lane: ProviderLane;
|
|
355
|
+
riskLevel: RiskLevel;
|
|
356
|
+
input: Record<string, unknown>;
|
|
357
|
+
reason?: string;
|
|
358
|
+
creditCost: number;
|
|
359
|
+
fundingMode?: "muxo_funded" | "byok";
|
|
360
|
+
supplierSettlement?: SupplierSettlement | null;
|
|
361
|
+
decisionRecord?: GovernanceDecisionRecord | null;
|
|
362
|
+
workspaceName?: string;
|
|
363
|
+
}): ApprovalImpactPreview;
|
|
364
|
+
export declare function buildBusinessReceiptSummary(params: {
|
|
365
|
+
toolSlug: string;
|
|
366
|
+
lane: ProviderLane;
|
|
367
|
+
riskLevel: RiskLevel;
|
|
368
|
+
status: "succeeded" | "failed" | "cancelled";
|
|
369
|
+
creditsMetered: number;
|
|
370
|
+
input?: Record<string, unknown>;
|
|
371
|
+
output?: unknown;
|
|
372
|
+
error?: string | null;
|
|
373
|
+
approvedBy?: string | null;
|
|
374
|
+
actorId?: string;
|
|
375
|
+
decisionRecord?: GovernanceDecisionRecord | null;
|
|
376
|
+
supplierSettlement?: SupplierSettlement | null;
|
|
377
|
+
}): BusinessReceiptSummary;
|
|
378
|
+
export interface RunReconciliationReport {
|
|
379
|
+
ok: true;
|
|
380
|
+
runId: string;
|
|
381
|
+
planId: string;
|
|
382
|
+
workspaceId: string;
|
|
383
|
+
toolSlug: string;
|
|
384
|
+
status: ExecutionRun["status"];
|
|
385
|
+
reconciliationStatus: "verified_complete" | "failed_zero_charge" | "cancelled" | "needs_reconciliation";
|
|
386
|
+
executeOnceEnforced: boolean;
|
|
387
|
+
idempotentReplaySafe: boolean;
|
|
388
|
+
zeroChargeOnFailureVerified: boolean;
|
|
389
|
+
creditsMetered: number;
|
|
390
|
+
estimatedCostUsd: number;
|
|
391
|
+
receiptVerified: boolean;
|
|
392
|
+
receiptId: string | null;
|
|
393
|
+
businessSummary: BusinessReceiptSummary;
|
|
394
|
+
recommendedNextAction: string;
|
|
395
|
+
}
|
|
396
|
+
export declare function buildRunReconciliationReport(params: {
|
|
397
|
+
run?: ExecutionRun | null;
|
|
398
|
+
plan?: ActionPlan | null;
|
|
399
|
+
receipt?: ExecutionReceipt | null;
|
|
400
|
+
signatureValid?: boolean;
|
|
401
|
+
}): RunReconciliationReport;
|