@muxoai/platform 1.2.3 → 1.3.1

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 (41) hide show
  1. package/.agents/plugins/marketplace.json +1 -1
  2. package/.claude-plugin/marketplace.json +19 -4
  3. package/.codex/config.toml +9 -2
  4. package/README.md +72 -28
  5. package/dist/cli.js +1047 -43
  6. package/dist/engine.d.ts +29 -0
  7. package/dist/engine.js +221 -16
  8. package/dist/mcp.d.ts +6 -1
  9. package/dist/mcp.js +120 -26
  10. package/dist/nl.d.ts +34 -0
  11. package/dist/nl.js +601 -0
  12. package/dist/providers/composio-instant.d.ts +1 -0
  13. package/dist/providers/composio-instant.js +6 -5
  14. package/dist/providers/composio-sdk.d.ts +1 -0
  15. package/dist/providers/composio-sdk.js +6 -2
  16. package/dist/providers/stripe-billing.d.ts +13 -3
  17. package/dist/providers/stripe-billing.js +250 -36
  18. package/dist/providers/stripe-projects.js +61 -4
  19. package/dist/providers/supermemory.d.ts +2 -0
  20. package/dist/providers/supermemory.js +58 -40
  21. package/dist/sdk.d.ts +77 -1
  22. package/dist/sdk.js +46 -0
  23. package/dist/server.js +202 -29
  24. package/dist/store.d.ts +19 -2
  25. package/dist/store.js +216 -11
  26. package/dist/types.d.ts +14 -2
  27. package/dist/ui/console-html.js +329 -119
  28. package/package.json +1 -1
  29. package/plugins/muxo/.app.json +1 -1
  30. package/plugins/muxo/.claude-plugin/plugin.json +2 -2
  31. package/plugins/muxo/.codex-plugin/plugin.json +7 -5
  32. package/plugins/muxo/.mcp.json +1 -33
  33. package/plugins/muxo/assets/logo.png +0 -0
  34. package/plugins/muxo/hooks/session-start.sh +1 -1
  35. package/plugins/muxo/plugin.json +63 -6
  36. package/plugins/muxo/skills/muxo/SKILL.md +92 -14
  37. package/plugins/muxo/skills/muxo/agents/openai.yaml +12 -0
  38. package/plugins/muxo/skills/muxo/references/cli.md +4 -2
  39. package/plugins/muxo/skills/muxo/references/mcp.md +15 -9
  40. package/plugins/muxo/skills/setup/SKILL.md +8 -2
  41. package/plugins/muxo/skills/setup/agents/openai.yaml +12 -0
@@ -8,19 +8,39 @@ import Supermemory from "supermemory";
8
8
  export class SupermemoryAdapter {
9
9
  config;
10
10
  client;
11
+ unavailableUntil = 0;
11
12
  constructor(config) {
12
13
  this.config = config;
13
14
  if (config.supermemoryApiKey) {
14
15
  this.client = new Supermemory({
15
16
  apiKey: config.supermemoryApiKey,
16
17
  baseUrl: config.supermemoryBaseUrl,
17
- maxRetries: 1,
18
+ maxRetries: 0,
18
19
  });
19
20
  }
20
21
  else {
21
22
  this.client = null;
22
23
  }
23
24
  }
25
+ withTimeout(p, ms = 1000) {
26
+ if (Date.now() < this.unavailableUntil) {
27
+ p.catch(() => { });
28
+ return Promise.resolve(null);
29
+ }
30
+ return Promise.race([
31
+ p,
32
+ new Promise((resolve) => {
33
+ const t = setTimeout(() => {
34
+ this.unavailableUntil = Date.now() + 30_000;
35
+ resolve(null);
36
+ }, ms);
37
+ t.unref?.();
38
+ }),
39
+ ]).catch(() => {
40
+ this.unavailableUntil = Date.now() + 30_000;
41
+ return null;
42
+ });
43
+ }
24
44
  isEnabled() {
25
45
  return Boolean(this.client);
26
46
  }
@@ -74,10 +94,22 @@ export class SupermemoryAdapter {
74
94
  let dynamicFacts = [];
75
95
  let preferences = [];
76
96
  const relevantMemories = [];
77
- try {
78
- const profileRes = await this.client.profile(namespace, {
97
+ const [profileOutcome, searchOutcome] = await Promise.allSettled([
98
+ this.withTimeout(this.client.profile(namespace, {
79
99
  ...(params.query ? { q: params.query } : {}),
80
- });
100
+ }), 1000),
101
+ params.query && params.query.trim().length > 0
102
+ ? this.withTimeout(this.client.search(namespace, {
103
+ query: params.query.trim(),
104
+ limit,
105
+ searchMode: "hybrid",
106
+ include: { documents: true, forgotten: false, related: false },
107
+ rewriteQuery: false,
108
+ }), 1000)
109
+ : Promise.resolve(null),
110
+ ]);
111
+ if (profileOutcome.status === "fulfilled" && profileOutcome.value) {
112
+ const profileRes = profileOutcome.value;
81
113
  staticFacts = Array.isArray(profileRes?.profile?.static)
82
114
  ? profileRes.profile.static.map(String)
83
115
  : [];
@@ -88,36 +120,22 @@ export class SupermemoryAdapter {
88
120
  ? profileRes.profile.buckets.preferences.map(String)
89
121
  : [];
90
122
  }
91
- catch {
92
- // Fail-open: never block tool planning if profile endpoint times out
93
- }
94
- if (params.query && params.query.trim().length > 0) {
95
- try {
96
- const searchRes = await this.client.search(namespace, {
97
- query: params.query.trim(),
98
- limit,
99
- searchMode: "hybrid",
100
- include: { documents: true, forgotten: false, related: false },
101
- rewriteQuery: false,
123
+ if (searchOutcome.status === "fulfilled" && searchOutcome.value) {
124
+ const searchRes = searchOutcome.value;
125
+ for (const item of (searchRes?.results || []).slice(0, limit)) {
126
+ const doc = item.included?.document;
127
+ const title = String(doc?.metadata?.title ||
128
+ doc?.title ||
129
+ item.memory ||
130
+ item.chunk ||
131
+ "Workspace Memory").slice(0, 120);
132
+ const snippet = String(item.memory || item.chunk || doc?.metadata?.summary || "").slice(0, 300);
133
+ relevantMemories.push({
134
+ documentId: String(doc?.id || item.id || ""),
135
+ title,
136
+ snippet,
137
+ similarity: Number(item.similarity || 0),
102
138
  });
103
- for (const item of (searchRes?.results || []).slice(0, limit)) {
104
- const doc = item.included?.document;
105
- const title = String(doc?.metadata?.title ||
106
- doc?.title ||
107
- item.memory ||
108
- item.chunk ||
109
- "Workspace Memory").slice(0, 120);
110
- const snippet = String(item.memory || item.chunk || doc?.metadata?.summary || "").slice(0, 300);
111
- relevantMemories.push({
112
- documentId: String(doc?.id || item.id || ""),
113
- title,
114
- snippet,
115
- similarity: Number(item.similarity || 0),
116
- });
117
- }
118
- }
119
- catch {
120
- // Fail-open
121
139
  }
122
140
  }
123
141
  const promptLines = [
@@ -162,7 +180,7 @@ export class SupermemoryAdapter {
162
180
  sanitizedContent,
163
181
  };
164
182
  }
165
- const res = await this.client.add(namespace, {
183
+ const res = await this.withTimeout(this.client.add(namespace, {
166
184
  id: docId,
167
185
  content: `${params.title}\n\n${sanitizedContent}`,
168
186
  taskType: "memory",
@@ -172,11 +190,11 @@ export class SupermemoryAdapter {
172
190
  muxoKind: params.kind,
173
191
  ...(params.metadata || {}),
174
192
  },
175
- });
193
+ }), 1500);
176
194
  return {
177
- documentId: String(res.id || docId),
195
+ documentId: String(res?.id || docId),
178
196
  namespace,
179
- status: String(res.status || "queued"),
197
+ status: String(res?.status || "queued"),
180
198
  sanitizedContent,
181
199
  };
182
200
  }
@@ -194,7 +212,7 @@ export class SupermemoryAdapter {
194
212
  status: params.status,
195
213
  },
196
214
  });
197
- return added.documentId;
215
+ return added ? added.documentId : null;
198
216
  }
199
217
  catch {
200
218
  return null;
@@ -209,9 +227,9 @@ export class SupermemoryAdapter {
209
227
  return { deleted: true, namespace };
210
228
  }
211
229
  try {
212
- const res = await this.client.documents.delete(namespace, {
230
+ const res = await this.withTimeout(this.client.documents.delete(namespace, {
213
231
  ids: [documentId],
214
- });
232
+ }), 1200);
215
233
  return {
216
234
  deleted: (res?.count || 0) >= 1,
217
235
  namespace,
package/dist/sdk.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ActionPlan, ConnectionRecord, ExecutionReceipt, ExecutionRun, MuxoTool, ProviderLane, ProvisionedResource, RiskLevel, SupplierSettlementSummary, Workspace, WorkspaceMemoryRecord } from "./types.js";
1
+ import type { ActionPlan, ByokKeyRecord, ConnectionRecord, ExecutionReceipt, ExecutionRun, MuxoTool, ProviderLane, ProvisionedResource, RiskLevel, SupplierSettlementSummary, Workspace, WorkspaceMemoryRecord } from "./types.js";
2
2
  export interface MuxoClientOptions {
3
3
  baseUrl?: string;
4
4
  apiKey?: string | (() => string | Promise<string>);
@@ -174,4 +174,80 @@ export declare class MuxoClient {
174
174
  namespace: string;
175
175
  records: WorkspaceMemoryRecord[];
176
176
  }>;
177
+ do(prompt: string, options?: {
178
+ input?: Record<string, unknown>;
179
+ autoApprove?: boolean;
180
+ dryRun?: boolean;
181
+ }): Promise<{
182
+ ok: boolean;
183
+ executed: boolean;
184
+ status: string;
185
+ intent: {
186
+ toolSlug: string | null;
187
+ input: Record<string, unknown>;
188
+ extractedInput: Record<string, unknown>;
189
+ reason: string;
190
+ confidence: number;
191
+ };
192
+ resolution: Record<string, unknown>;
193
+ plan?: ActionPlan;
194
+ run?: ExecutionRun;
195
+ receipt?: ExecutionReceipt;
196
+ humanMessage: string;
197
+ }>;
198
+ ask(prompt: string, options?: {
199
+ input?: Record<string, unknown>;
200
+ autoApprove?: boolean;
201
+ dryRun?: boolean;
202
+ }): Promise<{
203
+ ok: boolean;
204
+ executed: boolean;
205
+ status: string;
206
+ intent: {
207
+ toolSlug: string | null;
208
+ input: Record<string, unknown>;
209
+ extractedInput: Record<string, unknown>;
210
+ reason: string;
211
+ confidence: number;
212
+ };
213
+ resolution: Record<string, unknown>;
214
+ plan?: ActionPlan;
215
+ run?: ExecutionRun;
216
+ receipt?: ExecutionReceipt;
217
+ humanMessage: string;
218
+ }>;
219
+ listByokKeys(): Promise<{
220
+ ok: true;
221
+ workspaceId: string;
222
+ keys: ByokKeyRecord[];
223
+ }>;
224
+ setByokKey(provider: string, secretKey: string): Promise<{
225
+ ok: true;
226
+ key: ByokKeyRecord;
227
+ keys: ByokKeyRecord[];
228
+ }>;
229
+ deleteByokKey(provider: string): Promise<{
230
+ ok: true;
231
+ deleted: boolean;
232
+ provider: string;
233
+ keys: ByokKeyRecord[];
234
+ }>;
235
+ upgradePlan(): Promise<{
236
+ ok: true;
237
+ tier: string;
238
+ workspace: Workspace;
239
+ settlementSummary: SupplierSettlementSummary;
240
+ }>;
241
+ createCheckoutSession(kind?: "starter_subscription" | "credit_topup"): Promise<{
242
+ ok: true;
243
+ sessionId: string;
244
+ url: string;
245
+ mode?: string;
246
+ }>;
247
+ verifyCheckoutSession(sessionId: string): Promise<{
248
+ ok: true;
249
+ fulfilled: boolean;
250
+ workspace: Workspace | null;
251
+ kind: string;
252
+ }>;
177
253
  }
package/dist/sdk.js CHANGED
@@ -221,4 +221,50 @@ export class MuxoClient {
221
221
  const suffix = query ? `?query=${encodeURIComponent(query)}` : "";
222
222
  return this.request(`/api/v1/memory${suffix}`);
223
223
  }
224
+ async do(prompt, options = {}) {
225
+ return this.request("/api/v1/do", {
226
+ method: "POST",
227
+ body: {
228
+ prompt,
229
+ input: options.input,
230
+ autoApprove: options.autoApprove !== false,
231
+ dryRun: options.dryRun === true,
232
+ },
233
+ });
234
+ }
235
+ async ask(prompt, options) {
236
+ return this.do(prompt, options);
237
+ }
238
+ async listByokKeys() {
239
+ return this.request("/api/v1/byok");
240
+ }
241
+ async setByokKey(provider, secretKey) {
242
+ return this.request("/api/v1/byok", {
243
+ method: "POST",
244
+ body: { provider, secretKey },
245
+ });
246
+ }
247
+ async deleteByokKey(provider) {
248
+ return this.request(`/api/v1/byok/${encodeURIComponent(provider)}`, {
249
+ method: "DELETE",
250
+ });
251
+ }
252
+ async upgradePlan() {
253
+ return this.request("/api/v1/billing/upgrade", {
254
+ method: "POST",
255
+ body: {},
256
+ });
257
+ }
258
+ async createCheckoutSession(kind = "credit_topup") {
259
+ return this.request("/api/v1/billing/checkout", {
260
+ method: "POST",
261
+ body: { kind },
262
+ });
263
+ }
264
+ async verifyCheckoutSession(sessionId) {
265
+ return this.request("/api/v1/billing/verify-session", {
266
+ method: "POST",
267
+ body: { sessionId },
268
+ });
269
+ }
224
270
  }