@muxoai/sdk 0.4.0-preview.20261015.1 → 1.2.0
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/README.md +49 -17
- package/dist/sdk.d.ts +115 -0
- package/dist/sdk.js +117 -0
- package/dist/types.d.ts +273 -0
- package/dist/types.js +1 -0
- package/package.json +28 -21
- package/dist/index.d.ts +0 -1634
- package/dist/index.js +0 -2799
package/README.md
CHANGED
|
@@ -1,22 +1,54 @@
|
|
|
1
|
-
# Muxo
|
|
1
|
+
# Muxo (`@muxoai/platform`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Muxo is a unified execution, cloud infrastructure provisioning, contextual memory, and cryptographic governance platform for AI agents and applications. Customers and their agents interact exclusively with **Muxo** — never with underlying tool or cloud infrastructure providers directly.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
See [`ARCHITECTURE.md`](./ARCHITECTURE.md) for the complete internal engineering blueprint, open-source ecosystem Keep/Adopt/Drop matrix, and root-cause analysis of how `muxo3` resolves `muxo2`'s Cloudflare isolate/container failure modes.
|
|
6
|
+
|
|
7
|
+
Under the hood, Muxo unifies **four core pillars** behind one 18-operation MCP contract, REST API, CLI, and Web Console:
|
|
8
|
+
|
|
9
|
+
1. **Composio Connected Apps (`app.*`) & Instant (`instant.*`)** — Managed OAuth SaaS integrations (`app.github.*`, `app.gmail.*`, `app.slack.*`, `app.notion.*`, `app.linear.*`), zero-OAuth instant capabilities (`instant.web.search`, `instant.web.scrape`, `instant.hackernews.top_stories`, `instant.github.repo_intel`, `instant.dns.lookup`), plus **Autonomous 2-Call Agent Signup & Claim** (`POST /api/v1/agents/signup` + `POST /api/v1/agents/claim`).
|
|
10
|
+
2. **Stripe Projects Cloud Infrastructure (`resource.*`) + Stripe Billing** — Governed cloud resource provisioning across 60+ providers (`Neon`, `Supabase`, `Turso`, `Cloudflare`, `Vercel`, `Railway`, `Render`, `Prisma`, `PostHog`, etc.) with automatic `PLAN_REQUIRED` companion plan resolution, AES-256-GCM encrypted secret custody (`muxo env pull`), and live Stripe Checkout (`$29/mo Starter` & `$10 / +1,000 Credits`).
|
|
11
|
+
3. **Supermemory v5 Contextual Brain (`/ns/muxo-v5-*`)** — Isolated per-workspace long-term static facts, dynamic session context, and hybrid semantic search recalled before every tool plan (`plan_action` & `get_run_context`), with strict secret redaction before memory ingestion.
|
|
12
|
+
4. **Microsoft Agent Governance Toolkit (`@microsoft/agent-governance-sdk` v5.0.0)** — Every planned and executed operation passes through `Agent ──► McpSecurityScanner ──► PolicyEngine ──► AgentIdentity (Ed25519 DID) ──► AuditLogger (SHA-256 chain) ──► DecisionRecord`.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Quickstart
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# 1. Build TypeScript
|
|
20
|
+
npm run build
|
|
21
|
+
|
|
22
|
+
# 2. Run the 9-Suite Live E2E Verification
|
|
23
|
+
npm test
|
|
24
|
+
|
|
25
|
+
# 3. Start the Muxo Server + app.muxo.ai Console (/) + muxo.ai Canvas (/landing) + MCP (/mcp)
|
|
26
|
+
npm start
|
|
27
|
+
|
|
28
|
+
# 4. Use the Muxo CLI
|
|
29
|
+
npm run cli -- whoami
|
|
30
|
+
npm run cli -- search postgres
|
|
31
|
+
npm run cli -- exec instant.hackernews.top_stories --input '{"limit":3}'
|
|
32
|
+
npm run cli -- env pull --out .env.muxo
|
|
12
33
|
```
|
|
13
34
|
|
|
14
|
-
|
|
15
|
-
Use `client.workspaceCurrent({ operation: 'memory_profile', arguments: { input: {} } })` for bounded accepted memory in the authenticated workspace/project.
|
|
16
|
-
`resolveWorkspace()` returns routing metadata, not membership or authority. A different project refuses, and no workspace is initialized or silently substituted.
|
|
35
|
+
## Architecture & Source Layout
|
|
17
36
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
37
|
+
| File / Directory | Responsibility |
|
|
38
|
+
| --- | --- |
|
|
39
|
+
| `ARCHITECTURE.md` | Internal engineering blueprint, Keep/Adopt/Drop ecosystem matrix, and Stripe Projects analysis |
|
|
40
|
+
| `src/config.ts` | Environment & AES-256-GCM vault key derivation |
|
|
41
|
+
| `src/types.ts` | Core domain, Governance `DecisionRecord`, Supermemory `MemoryContextSummary`, & 18-tool MCP types |
|
|
42
|
+
| `src/store.ts` | SQLite (`node:sqlite`) store, AES-256-GCM secret vault, credit ledger, memories, agent claims, and HMAC-SHA256 receipt chain |
|
|
43
|
+
| `src/providers/composio-sdk.ts` | Live Composio v3 Connected Apps adapter (catalog search, OAuth sessions/links, tool execution) |
|
|
44
|
+
| `src/providers/composio-instant.ts` | Live Composio Instant zero-setup adapter |
|
|
45
|
+
| `src/providers/stripe-projects.ts` | Live Stripe Projects CLI bridge (`status`, `catalog`, `add`, `rotate`, `remove`, `env --pull`) |
|
|
46
|
+
| `src/providers/stripe-billing.ts` | Live Stripe Checkout billing (`$29/mo Starter Plan` & `$10 / +1,000 Credits Pack`) |
|
|
47
|
+
| `src/providers/microsoft-governance.ts` | Microsoft Agent Governance Toolkit v5.0.0 (`McpSecurityScanner`, `PolicyEngine`, `AgentIdentity` Ed25519 DID, `AuditLogger`) |
|
|
48
|
+
| `src/providers/supermemory.ts` | Supermemory v5 Contextual Brain (`profile`, hybrid `search`, secret-redacted `add`, `delete`) |
|
|
49
|
+
| `src/engine.ts` | Unified Governance, Memory & Execution Engine implementing all 18 canonical MCP operations |
|
|
50
|
+
| `src/mcp.ts` | JSON-RPC 2.0 MCP Server (Streamable HTTP `/mcp` + stdio `muxo mcp`) |
|
|
51
|
+
| `src/server.ts` | HTTP Gateway (`/api/v1/*`, `/mcp`, `/skill.md`, `/llms.txt`, `/landing`, `/claim/:slug`, `/health`, and `/`) |
|
|
52
|
+
| `src/ui/console-html.ts` | `app.muxo.ai` Operator Console UI + `/landing` (`muxo.ai` Provider Canvas) |
|
|
53
|
+
| `web/` | Standalone `muxo.ai` Astro marketing & interactive provider catalog site |
|
|
54
|
+
| `vendor/microsoft-governance/` | Vendored `@microsoft/agent-governance-sdk` v5.0.0 |
|
package/dist/sdk.d.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { ActionPlan, ConnectionRecord, ExecutionReceipt, ExecutionRun, MuxoTool, ProviderLane, ProvisionedResource, RiskLevel, SupplierSettlementSummary, Workspace, WorkspaceMemoryRecord } from "./types.js";
|
|
2
|
+
export interface MuxoClientOptions {
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
apiKey?: string | (() => string | Promise<string>);
|
|
5
|
+
fetch?: typeof fetch;
|
|
6
|
+
timeoutMs?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare class MuxoClient {
|
|
9
|
+
readonly baseUrl: string;
|
|
10
|
+
private readonly apiKeyResolver?;
|
|
11
|
+
private readonly fetchImpl;
|
|
12
|
+
private readonly timeoutMs;
|
|
13
|
+
constructor(options?: MuxoClientOptions);
|
|
14
|
+
private request;
|
|
15
|
+
signupAgent(params: {
|
|
16
|
+
agentName?: string;
|
|
17
|
+
harness?: string;
|
|
18
|
+
}): Promise<{
|
|
19
|
+
ok: true;
|
|
20
|
+
agentId: string;
|
|
21
|
+
workspace: Pick<Workspace, "id" | "name" | "slug" | "tier" | "creditsBalance">;
|
|
22
|
+
apiKey: string;
|
|
23
|
+
mcpEndpoint: string;
|
|
24
|
+
skillUrl: string;
|
|
25
|
+
claimEndpoint: string;
|
|
26
|
+
governanceDid: string;
|
|
27
|
+
supermemoryNamespace: string;
|
|
28
|
+
}>;
|
|
29
|
+
searchTools(params?: {
|
|
30
|
+
query?: string;
|
|
31
|
+
lane?: ProviderLane | "all";
|
|
32
|
+
riskLevel?: RiskLevel;
|
|
33
|
+
limit?: number;
|
|
34
|
+
}): Promise<{
|
|
35
|
+
ok: true;
|
|
36
|
+
count: number;
|
|
37
|
+
tools: MuxoTool[];
|
|
38
|
+
}>;
|
|
39
|
+
inspectTool(slug: string): Promise<MuxoTool>;
|
|
40
|
+
planAction(params: {
|
|
41
|
+
toolSlug: string;
|
|
42
|
+
input: Record<string, unknown>;
|
|
43
|
+
reason?: string;
|
|
44
|
+
}): Promise<{
|
|
45
|
+
ok: true;
|
|
46
|
+
plan: ActionPlan;
|
|
47
|
+
nextStep: string;
|
|
48
|
+
authHandoff?: {
|
|
49
|
+
required: boolean;
|
|
50
|
+
providerSlug: string;
|
|
51
|
+
providerName: string;
|
|
52
|
+
status: string;
|
|
53
|
+
redirectUrl: string | null;
|
|
54
|
+
waitTool: string;
|
|
55
|
+
instructions: string;
|
|
56
|
+
};
|
|
57
|
+
}>;
|
|
58
|
+
approvePlan(planId: string): Promise<{
|
|
59
|
+
ok: true;
|
|
60
|
+
plan: ActionPlan;
|
|
61
|
+
}>;
|
|
62
|
+
executePlan(planId: string): Promise<{
|
|
63
|
+
ok: true;
|
|
64
|
+
run: ExecutionRun;
|
|
65
|
+
receipt: ExecutionReceipt;
|
|
66
|
+
}>;
|
|
67
|
+
startConnection(params: {
|
|
68
|
+
provider: string;
|
|
69
|
+
lane?: ProviderLane;
|
|
70
|
+
callbackUrl?: string;
|
|
71
|
+
}): Promise<{
|
|
72
|
+
ok: true;
|
|
73
|
+
connection: ConnectionRecord;
|
|
74
|
+
}>;
|
|
75
|
+
waitForConnection(params: {
|
|
76
|
+
provider: string;
|
|
77
|
+
timeoutSeconds?: number;
|
|
78
|
+
}): Promise<{
|
|
79
|
+
ok: true;
|
|
80
|
+
connection: ConnectionRecord;
|
|
81
|
+
ready: boolean;
|
|
82
|
+
polledAttempts: number;
|
|
83
|
+
elapsedMs: number;
|
|
84
|
+
message: string;
|
|
85
|
+
}>;
|
|
86
|
+
listResources(): Promise<{
|
|
87
|
+
ok: true;
|
|
88
|
+
resources: ProvisionedResource[];
|
|
89
|
+
}>;
|
|
90
|
+
pullEnv(): Promise<{
|
|
91
|
+
ok: true;
|
|
92
|
+
workspaceId: string;
|
|
93
|
+
variables: Record<string, string>;
|
|
94
|
+
dotenv: string;
|
|
95
|
+
}>;
|
|
96
|
+
topupCredits(params: {
|
|
97
|
+
credits: number;
|
|
98
|
+
description?: string;
|
|
99
|
+
}): Promise<{
|
|
100
|
+
ok: true;
|
|
101
|
+
creditsAdded: number;
|
|
102
|
+
usdPaid: number;
|
|
103
|
+
workspace: Workspace;
|
|
104
|
+
settlementSummary: SupplierSettlementSummary;
|
|
105
|
+
}>;
|
|
106
|
+
getSettlements(): Promise<{
|
|
107
|
+
ok: true;
|
|
108
|
+
settlementSummary: SupplierSettlementSummary;
|
|
109
|
+
}>;
|
|
110
|
+
recallMemory(query?: string): Promise<{
|
|
111
|
+
ok: true;
|
|
112
|
+
namespace: string;
|
|
113
|
+
records: WorkspaceMemoryRecord[];
|
|
114
|
+
}>;
|
|
115
|
+
}
|
package/dist/sdk.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
export class MuxoClient {
|
|
2
|
+
baseUrl;
|
|
3
|
+
apiKeyResolver;
|
|
4
|
+
fetchImpl;
|
|
5
|
+
timeoutMs;
|
|
6
|
+
constructor(options = {}) {
|
|
7
|
+
this.baseUrl = (options.baseUrl ||
|
|
8
|
+
process.env.MUXO_BASE_URL ||
|
|
9
|
+
"https://app.muxo.ai").replace(/\/+$/, "");
|
|
10
|
+
if (typeof options.apiKey === "function") {
|
|
11
|
+
this.apiKeyResolver = options.apiKey;
|
|
12
|
+
}
|
|
13
|
+
else if (typeof options.apiKey === "string") {
|
|
14
|
+
const key = options.apiKey;
|
|
15
|
+
this.apiKeyResolver = () => key;
|
|
16
|
+
}
|
|
17
|
+
else if (process.env.MUXO_API_KEY) {
|
|
18
|
+
const key = process.env.MUXO_API_KEY;
|
|
19
|
+
this.apiKeyResolver = () => key;
|
|
20
|
+
}
|
|
21
|
+
this.fetchImpl = options.fetch || fetch;
|
|
22
|
+
this.timeoutMs = options.timeoutMs ?? 30000;
|
|
23
|
+
}
|
|
24
|
+
async request(path, init = {}) {
|
|
25
|
+
const headers = {
|
|
26
|
+
Accept: "application/json",
|
|
27
|
+
};
|
|
28
|
+
if (this.apiKeyResolver) {
|
|
29
|
+
const token = await this.apiKeyResolver();
|
|
30
|
+
if (token)
|
|
31
|
+
headers.Authorization = `Bearer ${token}`;
|
|
32
|
+
}
|
|
33
|
+
if (init.body !== undefined) {
|
|
34
|
+
headers["Content-Type"] = "application/json";
|
|
35
|
+
}
|
|
36
|
+
const res = await this.fetchImpl(`${this.baseUrl}${path}`, {
|
|
37
|
+
method: init.method || "GET",
|
|
38
|
+
headers,
|
|
39
|
+
body: init.body !== undefined ? JSON.stringify(init.body) : undefined,
|
|
40
|
+
signal: AbortSignal.timeout(this.timeoutMs),
|
|
41
|
+
});
|
|
42
|
+
const payload = (await res.json());
|
|
43
|
+
if (!res.ok || payload.ok === false) {
|
|
44
|
+
throw new Error(String(payload.error || `Muxo request failed with HTTP ${res.status}`));
|
|
45
|
+
}
|
|
46
|
+
return payload;
|
|
47
|
+
}
|
|
48
|
+
async signupAgent(params) {
|
|
49
|
+
return this.request("/api/v1/agents/signup", {
|
|
50
|
+
method: "POST",
|
|
51
|
+
body: params,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
async searchTools(params) {
|
|
55
|
+
const qs = new URLSearchParams();
|
|
56
|
+
if (params?.query)
|
|
57
|
+
qs.set("query", params.query);
|
|
58
|
+
if (params?.lane)
|
|
59
|
+
qs.set("lane", params.lane);
|
|
60
|
+
if (params?.riskLevel)
|
|
61
|
+
qs.set("risk_level", params.riskLevel);
|
|
62
|
+
if (params?.limit)
|
|
63
|
+
qs.set("limit", String(params.limit));
|
|
64
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
65
|
+
return this.request(`/api/v1/tools${suffix}`);
|
|
66
|
+
}
|
|
67
|
+
async inspectTool(slug) {
|
|
68
|
+
return this.request(`/api/v1/tools/${encodeURIComponent(slug)}`);
|
|
69
|
+
}
|
|
70
|
+
async planAction(params) {
|
|
71
|
+
return this.request("/api/v1/plans", {
|
|
72
|
+
method: "POST",
|
|
73
|
+
body: params,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
async approvePlan(planId) {
|
|
77
|
+
return this.request(`/api/v1/plans/${encodeURIComponent(planId)}/approve`, {
|
|
78
|
+
method: "POST",
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
async executePlan(planId) {
|
|
82
|
+
return this.request(`/api/v1/plans/${encodeURIComponent(planId)}/execute`, {
|
|
83
|
+
method: "POST",
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
async startConnection(params) {
|
|
87
|
+
return this.request("/api/v1/connections", {
|
|
88
|
+
method: "POST",
|
|
89
|
+
body: params,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
async waitForConnection(params) {
|
|
93
|
+
return this.request("/api/v1/connections/wait", {
|
|
94
|
+
method: "POST",
|
|
95
|
+
body: params,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
async listResources() {
|
|
99
|
+
return this.request("/api/v1/resources");
|
|
100
|
+
}
|
|
101
|
+
async pullEnv() {
|
|
102
|
+
return this.request("/api/v1/resources/env");
|
|
103
|
+
}
|
|
104
|
+
async topupCredits(params) {
|
|
105
|
+
return this.request("/api/v1/billing/topup", {
|
|
106
|
+
method: "POST",
|
|
107
|
+
body: params,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
async getSettlements() {
|
|
111
|
+
return this.request("/api/v1/billing/settlements");
|
|
112
|
+
}
|
|
113
|
+
async recallMemory(query) {
|
|
114
|
+
const suffix = query ? `?query=${encodeURIComponent(query)}` : "";
|
|
115
|
+
return this.request(`/api/v1/memory${suffix}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
export type RiskLevel = "read" | "write" | "admin" | "financial" | "provisioning" | "destructive";
|
|
2
|
+
export type ProviderLane = "composio_sdk" | "composio_instant" | "stripe_projects";
|
|
3
|
+
export type SubscriptionTier = "free" | "starter";
|
|
4
|
+
export interface GovernancePolicy {
|
|
5
|
+
mode: "monitor" | "enforce";
|
|
6
|
+
requireApprovalFor: RiskLevel[];
|
|
7
|
+
allowInstantWallet: boolean;
|
|
8
|
+
allowProvisioning: boolean;
|
|
9
|
+
maxCreditsPerRun: number;
|
|
10
|
+
blockedToolSlugs?: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface User {
|
|
13
|
+
id: string;
|
|
14
|
+
email: string;
|
|
15
|
+
name: string;
|
|
16
|
+
workspaceId: string;
|
|
17
|
+
role: "owner" | "admin" | "member";
|
|
18
|
+
createdAt: string;
|
|
19
|
+
}
|
|
20
|
+
export interface Workspace {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
slug: string;
|
|
24
|
+
ownerUserId: string;
|
|
25
|
+
tier: SubscriptionTier;
|
|
26
|
+
monthlyActionsLimit: number;
|
|
27
|
+
monthlyActionsUsed: number;
|
|
28
|
+
creditsBalance: number;
|
|
29
|
+
stripeCustomerId: string | null;
|
|
30
|
+
stripeSubscriptionId: string | null;
|
|
31
|
+
projectsEnvName: string;
|
|
32
|
+
policy: GovernancePolicy;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
updatedAt: string;
|
|
35
|
+
}
|
|
36
|
+
export interface ApiKeyRecord {
|
|
37
|
+
id: string;
|
|
38
|
+
workspaceId: string;
|
|
39
|
+
name: string;
|
|
40
|
+
keyPrefix: string;
|
|
41
|
+
environment: "live" | "test";
|
|
42
|
+
scopes: string[];
|
|
43
|
+
lastUsedAt: string | null;
|
|
44
|
+
revokedAt: string | null;
|
|
45
|
+
createdAt: string;
|
|
46
|
+
}
|
|
47
|
+
export interface MuxoTool {
|
|
48
|
+
slug: string;
|
|
49
|
+
upstreamSlug: string;
|
|
50
|
+
name: string;
|
|
51
|
+
description: string;
|
|
52
|
+
lane: ProviderLane;
|
|
53
|
+
providerSlug: string;
|
|
54
|
+
providerName: string;
|
|
55
|
+
categories: string[];
|
|
56
|
+
riskLevel: RiskLevel;
|
|
57
|
+
requiresAuth: boolean;
|
|
58
|
+
creditCost: number;
|
|
59
|
+
billingMode: "customer_oauth" | "provider_wallet" | "resource_provisioning";
|
|
60
|
+
inputSchema: Record<string, unknown>;
|
|
61
|
+
llmContextUrl?: string;
|
|
62
|
+
providerUrl?: string;
|
|
63
|
+
metadata?: Record<string, unknown>;
|
|
64
|
+
}
|
|
65
|
+
export interface ConnectionRecord {
|
|
66
|
+
id: string;
|
|
67
|
+
workspaceId: string;
|
|
68
|
+
lane: ProviderLane;
|
|
69
|
+
providerSlug: string;
|
|
70
|
+
providerName: string;
|
|
71
|
+
status: "active" | "pending" | "expired" | "disconnected";
|
|
72
|
+
externalAccountId: string | null;
|
|
73
|
+
redirectUrl: string | null;
|
|
74
|
+
metadata: Record<string, unknown>;
|
|
75
|
+
updatedAt: string;
|
|
76
|
+
createdAt: string;
|
|
77
|
+
}
|
|
78
|
+
export interface ProvisionedResource {
|
|
79
|
+
id: string;
|
|
80
|
+
workspaceId: string;
|
|
81
|
+
resourceName: string;
|
|
82
|
+
providerSlug: string;
|
|
83
|
+
providerName: string;
|
|
84
|
+
serviceSlug: string;
|
|
85
|
+
planSlug: string | null;
|
|
86
|
+
status: "active" | "provisioning" | "failed" | "removed";
|
|
87
|
+
envVarKeys: string[];
|
|
88
|
+
externalResourceId: string | null;
|
|
89
|
+
metadata: Record<string, unknown>;
|
|
90
|
+
createdAt: string;
|
|
91
|
+
updatedAt: string;
|
|
92
|
+
}
|
|
93
|
+
export interface GovernanceDecisionRecord {
|
|
94
|
+
id: string;
|
|
95
|
+
sdk: "@microsoft/agent-governance-sdk";
|
|
96
|
+
sdkVersion: string;
|
|
97
|
+
policyId: string;
|
|
98
|
+
mode: "monitor" | "enforce";
|
|
99
|
+
agentDid: string;
|
|
100
|
+
agentPublicKey: string;
|
|
101
|
+
actorId: string;
|
|
102
|
+
workspaceId: string;
|
|
103
|
+
action: string;
|
|
104
|
+
riskLevel: RiskLevel;
|
|
105
|
+
decision: "allow" | "deny" | "require_approval";
|
|
106
|
+
verdict: "allow" | "deny" | "escalate";
|
|
107
|
+
reason: string;
|
|
108
|
+
matchedRule: string | null;
|
|
109
|
+
securityScan: {
|
|
110
|
+
safe: boolean;
|
|
111
|
+
riskLevel: string;
|
|
112
|
+
findingsCount: number;
|
|
113
|
+
findings: Array<{
|
|
114
|
+
category: string;
|
|
115
|
+
severity: string;
|
|
116
|
+
description: string;
|
|
117
|
+
}>;
|
|
118
|
+
};
|
|
119
|
+
auditEntry: {
|
|
120
|
+
timestamp: string;
|
|
121
|
+
agentId: string;
|
|
122
|
+
action: string;
|
|
123
|
+
decision: "allow" | "deny";
|
|
124
|
+
hash: string;
|
|
125
|
+
previousHash: string;
|
|
126
|
+
chainVerified: boolean;
|
|
127
|
+
};
|
|
128
|
+
ed25519Signature: string;
|
|
129
|
+
signature: string;
|
|
130
|
+
bindingHash: string;
|
|
131
|
+
decidedAt: string;
|
|
132
|
+
}
|
|
133
|
+
export type MemoryRecordKind = "fact" | "preference" | "resource_note" | "operator_note" | "execution_outcome" | "resource_topology" | "policy_decision";
|
|
134
|
+
export interface MemoryContextSummary {
|
|
135
|
+
enabled: boolean;
|
|
136
|
+
namespace: string;
|
|
137
|
+
staticFacts: string[];
|
|
138
|
+
dynamicContext: string[];
|
|
139
|
+
recalledMemories: Array<{
|
|
140
|
+
documentId: string;
|
|
141
|
+
title: string;
|
|
142
|
+
snippet: string;
|
|
143
|
+
similarity: number;
|
|
144
|
+
createdAt?: string;
|
|
145
|
+
}>;
|
|
146
|
+
formattedPromptContext: string;
|
|
147
|
+
profile: {
|
|
148
|
+
static: string[];
|
|
149
|
+
dynamic: string[];
|
|
150
|
+
preferences: string[];
|
|
151
|
+
};
|
|
152
|
+
relevantMemories: Array<{
|
|
153
|
+
documentId: string;
|
|
154
|
+
title: string;
|
|
155
|
+
snippet: string;
|
|
156
|
+
similarity: number;
|
|
157
|
+
createdAt?: string;
|
|
158
|
+
}>;
|
|
159
|
+
}
|
|
160
|
+
export interface WorkspaceMemoryRecord {
|
|
161
|
+
id: string;
|
|
162
|
+
workspaceId: string;
|
|
163
|
+
namespace: string;
|
|
164
|
+
documentId: string;
|
|
165
|
+
title: string;
|
|
166
|
+
content: string;
|
|
167
|
+
kind: MemoryRecordKind;
|
|
168
|
+
metadata: Record<string, unknown>;
|
|
169
|
+
createdAt: string;
|
|
170
|
+
}
|
|
171
|
+
export interface SupplierSettlement {
|
|
172
|
+
fundingMode: "muxo_funded";
|
|
173
|
+
supplier: ProviderLane;
|
|
174
|
+
supplierName: string;
|
|
175
|
+
upstreamProvider: string;
|
|
176
|
+
userChargeCredits: number;
|
|
177
|
+
userRetailChargeCents: number;
|
|
178
|
+
supplierWholesalePayableCents: number;
|
|
179
|
+
muxoNetMarginCents: number;
|
|
180
|
+
settlementStatus: "settled_by_muxo_master_wallet" | "planned_muxo_master_wallet";
|
|
181
|
+
masterAccountRef: string;
|
|
182
|
+
}
|
|
183
|
+
export interface SupplierSettlementSummary {
|
|
184
|
+
workspaceId: string;
|
|
185
|
+
fundingModel: "user_pays_muxo_muxo_pays_suppliers";
|
|
186
|
+
creditPriceCents: number;
|
|
187
|
+
totalCreditsPurchasedOrGranted: number;
|
|
188
|
+
totalCreditsConsumed: number;
|
|
189
|
+
currentCreditsBalance: number;
|
|
190
|
+
totalUserRetailSpendCents: number;
|
|
191
|
+
totalSupplierWholesalePaidCents: number;
|
|
192
|
+
totalMuxoNetMarginCents: number;
|
|
193
|
+
bySupplier: Record<ProviderLane, {
|
|
194
|
+
runsCount: number;
|
|
195
|
+
creditsConsumed: number;
|
|
196
|
+
userRetailSpendCents: number;
|
|
197
|
+
supplierWholesalePaidCents: number;
|
|
198
|
+
muxoNetMarginCents: number;
|
|
199
|
+
}>;
|
|
200
|
+
}
|
|
201
|
+
export interface ActionPlan {
|
|
202
|
+
id: string;
|
|
203
|
+
workspaceId: string;
|
|
204
|
+
actorId: string;
|
|
205
|
+
toolSlug: string;
|
|
206
|
+
upstreamSlug: string;
|
|
207
|
+
lane: ProviderLane;
|
|
208
|
+
riskLevel: RiskLevel;
|
|
209
|
+
input: Record<string, unknown>;
|
|
210
|
+
reason: string;
|
|
211
|
+
creditCost: number;
|
|
212
|
+
approvalStatus: "auto_approved" | "pending_approval" | "approved" | "rejected" | "executed";
|
|
213
|
+
approvedBy: string | null;
|
|
214
|
+
approvedAt: string | null;
|
|
215
|
+
runId: string | null;
|
|
216
|
+
decisionRecord?: GovernanceDecisionRecord | null;
|
|
217
|
+
memoryContext?: MemoryContextSummary | null;
|
|
218
|
+
supplierSettlement?: SupplierSettlement | null;
|
|
219
|
+
createdAt: string;
|
|
220
|
+
expiresAt: string;
|
|
221
|
+
}
|
|
222
|
+
export interface ExecutionRun {
|
|
223
|
+
id: string;
|
|
224
|
+
planId: string;
|
|
225
|
+
workspaceId: string;
|
|
226
|
+
actorId: string;
|
|
227
|
+
toolSlug: string;
|
|
228
|
+
lane: ProviderLane;
|
|
229
|
+
riskLevel: RiskLevel;
|
|
230
|
+
status: "queued" | "running" | "succeeded" | "failed" | "cancelled";
|
|
231
|
+
input: Record<string, unknown>;
|
|
232
|
+
output: Record<string, unknown> | null;
|
|
233
|
+
error: string | null;
|
|
234
|
+
actionsMetered: number;
|
|
235
|
+
creditsMetered: number;
|
|
236
|
+
durationMs: number | null;
|
|
237
|
+
receiptId: string | null;
|
|
238
|
+
startedAt: string;
|
|
239
|
+
completedAt: string | null;
|
|
240
|
+
}
|
|
241
|
+
export interface ExecutionReceipt {
|
|
242
|
+
id: string;
|
|
243
|
+
runId: string;
|
|
244
|
+
planId: string;
|
|
245
|
+
workspaceId: string;
|
|
246
|
+
actorId: string;
|
|
247
|
+
toolSlug: string;
|
|
248
|
+
lane: ProviderLane;
|
|
249
|
+
riskLevel: RiskLevel;
|
|
250
|
+
status: "succeeded" | "failed" | "cancelled";
|
|
251
|
+
actionsMetered: number;
|
|
252
|
+
creditsMetered: number;
|
|
253
|
+
inputHash: string;
|
|
254
|
+
outputHash: string;
|
|
255
|
+
prevReceiptHash: string;
|
|
256
|
+
receiptHash: string;
|
|
257
|
+
signature: string;
|
|
258
|
+
decisionRecord?: GovernanceDecisionRecord | null;
|
|
259
|
+
supplierSettlement?: SupplierSettlement | null;
|
|
260
|
+
issuedAt: string;
|
|
261
|
+
}
|
|
262
|
+
export interface LedgerEntry {
|
|
263
|
+
id: string;
|
|
264
|
+
workspaceId: string;
|
|
265
|
+
kind: "plan_grant" | "credit_topup" | "run_deduction" | "subscription_upgrade" | "manual_adjustment";
|
|
266
|
+
actionsDelta: number;
|
|
267
|
+
creditsDelta: number;
|
|
268
|
+
balanceAfter: number;
|
|
269
|
+
referenceId: string | null;
|
|
270
|
+
description: string;
|
|
271
|
+
supplierSettlement?: SupplierSettlement | null;
|
|
272
|
+
createdAt: string;
|
|
273
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,33 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muxoai/sdk",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Typed
|
|
5
|
-
"type": "module",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Muxo TypeScript/JavaScript SDK — Typed client for governed agent actions, OAuth handoffs, infrastructure provisioning, and receipts",
|
|
6
5
|
"license": "MIT",
|
|
6
|
+
"homepage": "https://muxo.ai",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/muxoai/muxo.git"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"muxo",
|
|
13
|
+
"sdk",
|
|
14
|
+
"agents",
|
|
15
|
+
"mcp",
|
|
16
|
+
"composio",
|
|
17
|
+
"stripe",
|
|
18
|
+
"governance",
|
|
19
|
+
"supermemory"
|
|
20
|
+
],
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"type": "module",
|
|
25
|
+
"main": "./dist/sdk.js",
|
|
26
|
+
"types": "./dist/sdk.d.ts",
|
|
7
27
|
"exports": {
|
|
8
28
|
".": {
|
|
9
|
-
"types": "./dist/
|
|
10
|
-
"
|
|
29
|
+
"types": "./dist/sdk.d.ts",
|
|
30
|
+
"default": "./dist/sdk.js"
|
|
11
31
|
}
|
|
12
32
|
},
|
|
13
|
-
"types": "./dist/index.d.ts",
|
|
14
33
|
"files": [
|
|
15
|
-
"dist"
|
|
34
|
+
"dist",
|
|
35
|
+
"README.md"
|
|
16
36
|
],
|
|
17
37
|
"engines": {
|
|
18
|
-
"node": ">=
|
|
19
|
-
},
|
|
20
|
-
"homepage": "https://docs.muxo.ai",
|
|
21
|
-
"keywords": [
|
|
22
|
-
"muxo",
|
|
23
|
-
"sdk",
|
|
24
|
-
"agents"
|
|
25
|
-
],
|
|
26
|
-
"dependencies": {
|
|
27
|
-
"zod": "4.6.5"
|
|
28
|
-
},
|
|
29
|
-
"publishConfig": {
|
|
30
|
-
"access": "public",
|
|
31
|
-
"tag": "preview"
|
|
38
|
+
"node": ">=18.0.0"
|
|
32
39
|
}
|
|
33
40
|
}
|