@runfusion/fusion 0.21.0 → 0.22.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.
Files changed (58) hide show
  1. package/dist/bin.js +1991 -993
  2. package/dist/client/assets/AgentDetailView-BKKpbp1S.js +18 -0
  3. package/dist/client/assets/AgentDetailView-CeO_1MK7.css +1 -0
  4. package/dist/client/assets/AgentsView-BRXFmrcJ.js +527 -0
  5. package/dist/client/assets/AgentsView-Bs03ptrd.css +1 -0
  6. package/dist/client/assets/ChatView-D7L2e_qu.js +1 -0
  7. package/dist/client/assets/DevServerView-l8RCyL2k.js +1 -0
  8. package/dist/client/assets/DirectoryPicker-CS1dwqcC.js +1 -0
  9. package/dist/client/assets/DocumentsView-DmthQWDZ.js +1 -0
  10. package/dist/client/assets/{InsightsView-CqDethVs.js → InsightsView-DvXpMKmH.js} +2 -2
  11. package/dist/client/assets/{MemoryView-BLIm9Vr7.js → MemoryView-CPwlKnUI.js} +2 -2
  12. package/dist/client/assets/{NodesView-DEXvp3WT.js → NodesView-BLlfUfsy.js} +3 -3
  13. package/dist/client/assets/{PiExtensionsManager-C2YjI9o2.js → PiExtensionsManager-j8rPXqmB.js} +2 -2
  14. package/dist/client/assets/PluginManager-pW6RMz5z.js +1 -0
  15. package/dist/client/assets/ResearchView-D9DNJYDq.js +1 -0
  16. package/dist/client/assets/{RoadmapsView-DPcfX5MS.js → RoadmapsView-Djc_X35v.js} +2 -2
  17. package/dist/client/assets/SettingsModal-WGCF_pk8.js +31 -0
  18. package/dist/client/assets/{SettingsModal-BRNAPR1u.js → SettingsModal-fxvTFLtR.js} +1 -1
  19. package/dist/client/assets/SetupWizardModal-tG_MF_nA.js +1 -0
  20. package/dist/client/assets/SkillsView-Ddf0YL8z.js +1 -0
  21. package/dist/client/assets/agentSkills-DDHJnrkn.css +1 -0
  22. package/dist/client/assets/agentSkills-EwIwBlG8.js +1 -0
  23. package/dist/client/assets/folder-open-BiJpmnaT.js +6 -0
  24. package/dist/client/assets/index-D6ebxTPF.css +1 -0
  25. package/dist/client/assets/index-DYDLmOcK.js +694 -0
  26. package/dist/client/assets/{star-B314SwLA.js → star-BwRZmiuZ.js} +2 -2
  27. package/dist/client/assets/upload-D4NwZhPp.js +6 -0
  28. package/dist/client/assets/{users-Bu_ltePs.js → users-DNISDtI1.js} +2 -2
  29. package/dist/client/index.html +2 -2
  30. package/dist/client/version.json +1 -1
  31. package/dist/droid-cli/package.json +1 -1
  32. package/dist/extension.js +1154 -401
  33. package/dist/pi-claude-cli/package.json +1 -1
  34. package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
  35. package/dist/plugins/fusion-plugin-hermes-runtime/bundled.js +480 -0
  36. package/dist/plugins/fusion-plugin-hermes-runtime/manifest.json +14 -0
  37. package/dist/plugins/fusion-plugin-hermes-runtime/package.json +11 -0
  38. package/dist/plugins/fusion-plugin-openclaw-runtime/bundled.js +369 -0
  39. package/dist/plugins/fusion-plugin-openclaw-runtime/manifest.json +14 -0
  40. package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +11 -0
  41. package/dist/plugins/fusion-plugin-paperclip-runtime/bundled.js +966 -0
  42. package/dist/plugins/fusion-plugin-paperclip-runtime/manifest.json +15 -0
  43. package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +11 -0
  44. package/package.json +2 -1
  45. package/skill/fusion/references/engine-tools.md +1 -1
  46. package/dist/client/assets/AgentDetailView-CUtWvXBn.css +0 -1
  47. package/dist/client/assets/AgentDetailView-Dg7Qa1rG.js +0 -18
  48. package/dist/client/assets/ChatView-ODq-kBk6.js +0 -1
  49. package/dist/client/assets/DevServerView-6PS9Lvl7.js +0 -1
  50. package/dist/client/assets/DirectoryPicker-B3dza2Dq.js +0 -1
  51. package/dist/client/assets/DocumentsView-Bu9YYlki.js +0 -1
  52. package/dist/client/assets/PluginManager-Dnf-LhYw.js +0 -1
  53. package/dist/client/assets/ResearchView-Z0TZ7WGo.js +0 -1
  54. package/dist/client/assets/SettingsModal-B6RN9VYe.js +0 -31
  55. package/dist/client/assets/SetupWizardModal-BFc3xID2.js +0 -1
  56. package/dist/client/assets/SkillsView-CipGahOR.js +0 -1
  57. package/dist/client/assets/index-Df1bHDY4.css +0 -1
  58. package/dist/client/assets/index-NFptaeUQ.js +0 -1222
@@ -0,0 +1,369 @@
1
+ // ../plugin-sdk/dist/index.js
2
+ function definePlugin(plugin2) {
3
+ return plugin2;
4
+ }
5
+
6
+ // ../../plugins/fusion-plugin-openclaw-runtime/dist/pi-module.js
7
+ import { spawn } from "node:child_process";
8
+ import { randomUUID } from "node:crypto";
9
+ var DEFAULT_BINARY = "openclaw";
10
+ var DEFAULT_AGENT_ID = "main";
11
+ var DEFAULT_THINKING = "off";
12
+ var DEFAULT_TIMEOUT_SEC = 0;
13
+ var DEFAULT_CLI_TIMEOUT_MS = 3e5;
14
+ var ANSI_RE = /\x1b\[[0-9;]*[A-Za-z]/g;
15
+ function asString(v) {
16
+ return typeof v === "string" && v.trim() !== "" ? v.trim() : void 0;
17
+ }
18
+ function asNumber(v) {
19
+ if (typeof v === "number" && Number.isFinite(v))
20
+ return v;
21
+ const s = asString(v);
22
+ if (s === void 0)
23
+ return void 0;
24
+ const n = Number(s);
25
+ return Number.isFinite(n) ? n : void 0;
26
+ }
27
+ function asBool(v) {
28
+ if (typeof v === "boolean")
29
+ return v;
30
+ const s = asString(v);
31
+ if (s === void 0)
32
+ return void 0;
33
+ return s === "1" || s.toLowerCase() === "true";
34
+ }
35
+ function stripAnsi(text) {
36
+ return text.replace(ANSI_RE, "");
37
+ }
38
+ function resolveCliConfig(settings) {
39
+ return {
40
+ binaryPath: asString(settings?.binaryPath) ?? asString(process.env.OPENCLAW_BIN) ?? DEFAULT_BINARY,
41
+ agentId: asString(settings?.agentId) ?? asString(process.env.OPENCLAW_AGENT_ID) ?? DEFAULT_AGENT_ID,
42
+ model: asString(settings?.model) ?? asString(process.env.OPENCLAW_MODEL),
43
+ thinking: asString(settings?.thinking) ?? asString(process.env.OPENCLAW_THINKING) ?? DEFAULT_THINKING,
44
+ cliTimeoutSec: asNumber(settings?.cliTimeoutSec) ?? asNumber(process.env.OPENCLAW_TIMEOUT_SEC) ?? DEFAULT_TIMEOUT_SEC,
45
+ cliTimeoutMs: asNumber(settings?.cliTimeoutMs) ?? asNumber(process.env.OPENCLAW_CLI_TIMEOUT_MS) ?? DEFAULT_CLI_TIMEOUT_MS,
46
+ useGateway: asBool(settings?.useGateway) ?? asBool(process.env.OPENCLAW_USE_GATEWAY) ?? false
47
+ };
48
+ }
49
+ function buildOpenClawArgs(config, sessionId, message) {
50
+ const args = ["--no-color", "agent"];
51
+ if (!config.useGateway)
52
+ args.push("--local");
53
+ args.push("--json");
54
+ args.push("--session-id", sessionId);
55
+ args.push("--message", message);
56
+ args.push("--agent", config.agentId);
57
+ if (config.model) {
58
+ args.push("--model", config.model);
59
+ }
60
+ args.push("--thinking", config.thinking);
61
+ args.push("--timeout", String(config.cliTimeoutSec));
62
+ return args;
63
+ }
64
+ function extractStderrError(stderr, stdout) {
65
+ const tryExtract = (raw) => {
66
+ if (!raw)
67
+ return void 0;
68
+ const lines = stripAnsi(raw).split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
69
+ return lines.length > 0 ? lines[lines.length - 1] : void 0;
70
+ };
71
+ return tryExtract(stderr) ?? tryExtract(stdout ?? "") ?? "openclaw exited with non-zero status (no stderr)";
72
+ }
73
+ function createCliSession(opts) {
74
+ return {
75
+ sessionId: randomUUID(),
76
+ agentId: opts.agentId ?? DEFAULT_AGENT_ID,
77
+ systemPrompt: opts.systemPrompt,
78
+ messages: [{ role: "developer", content: opts.systemPrompt }],
79
+ lastModelDescription: `openclaw/${opts.agentId ?? DEFAULT_AGENT_ID}`,
80
+ lastUsage: void 0,
81
+ callbacks: opts.callbacks
82
+ };
83
+ }
84
+ async function promptCli(session, message, config, callbacks, signal) {
85
+ const args = buildOpenClawArgs(config, session.sessionId, message);
86
+ const cb = { ...session.callbacks, ...callbacks };
87
+ cb.onToolStart?.("openclaw.agent", { sessionId: session.sessionId });
88
+ return new Promise((resolve, reject) => {
89
+ let settled = false;
90
+ const child = spawn(config.binaryPath, args, {
91
+ stdio: ["ignore", "pipe", "pipe"]
92
+ });
93
+ const hardKill = setTimeout(() => {
94
+ if (settled)
95
+ return;
96
+ settled = true;
97
+ try {
98
+ child.kill("SIGKILL");
99
+ } catch {
100
+ }
101
+ reject(new Error(`openclaw: process timed out after ${config.cliTimeoutMs}ms`));
102
+ }, config.cliTimeoutMs);
103
+ const onAbort = () => {
104
+ if (settled)
105
+ return;
106
+ try {
107
+ child.kill("SIGTERM");
108
+ } catch {
109
+ }
110
+ };
111
+ if (signal) {
112
+ if (signal.aborted) {
113
+ onAbort();
114
+ } else {
115
+ signal.addEventListener("abort", onAbort, { once: true });
116
+ }
117
+ }
118
+ let stdout = "";
119
+ let stderr = "";
120
+ child.stdout?.on("data", (chunk) => {
121
+ stdout += chunk.toString("utf-8");
122
+ });
123
+ child.stderr?.on("data", (chunk) => {
124
+ stderr += chunk.toString("utf-8");
125
+ });
126
+ child.on("error", (err) => {
127
+ if (settled)
128
+ return;
129
+ settled = true;
130
+ clearTimeout(hardKill);
131
+ signal?.removeEventListener("abort", onAbort);
132
+ const isNotFound = err.code === "ENOENT";
133
+ reject(new Error(isNotFound ? `openclaw: binary not found at "${config.binaryPath}". Install OpenClaw (npm i -g openclaw) or set binaryPath/OPENCLAW_BIN.` : `openclaw: spawn error \u2014 ${err.message}`));
134
+ });
135
+ child.on("close", (code) => {
136
+ if (settled)
137
+ return;
138
+ settled = true;
139
+ clearTimeout(hardKill);
140
+ signal?.removeEventListener("abort", onAbort);
141
+ if (code !== 0) {
142
+ const err = stderr.trim() || stdout.trim() ? extractStderrError(stderr, stdout) : `openclaw: exited with code ${String(code)}`;
143
+ reject(new Error(err));
144
+ return;
145
+ }
146
+ let parsed;
147
+ try {
148
+ parsed = JSON.parse(stdout);
149
+ } catch {
150
+ reject(new Error(`openclaw: failed to parse JSON output (stdout=${stdout.slice(0, 200)})`));
151
+ return;
152
+ }
153
+ const payloads = parsed.payloads ?? [];
154
+ const visibleText = payloads.filter((p) => !p.isError && !p.isReasoning).map((p) => p.text ?? "").filter((t) => t.length > 0).join("");
155
+ const reasoningText = payloads.filter((p) => p.isReasoning).map((p) => p.text ?? "").filter((t) => t.length > 0).join("\n");
156
+ const errorText = payloads.filter((p) => p.isError).map((p) => p.text ?? "").filter((t) => t.length > 0);
157
+ const finalText = visibleText || parsed.meta?.finalAssistantVisibleText || "";
158
+ if (finalText)
159
+ cb.onText?.(finalText);
160
+ if (reasoningText)
161
+ cb.onThinking?.(reasoningText);
162
+ session.messages.push({ role: "user", content: message });
163
+ if (finalText) {
164
+ session.messages.push({ role: "assistant", content: finalText });
165
+ }
166
+ const agentMeta = parsed.meta?.agentMeta;
167
+ if (agentMeta?.usage)
168
+ session.lastUsage = agentMeta.usage;
169
+ if (agentMeta?.provider && agentMeta.model) {
170
+ session.lastModelDescription = `openclaw/${session.agentId}/${agentMeta.provider}/${agentMeta.model}`;
171
+ }
172
+ const metaError = parsed.meta?.error;
173
+ const isError = !!metaError;
174
+ cb.onToolEnd?.("openclaw.agent", isError, {
175
+ usage: agentMeta?.usage,
176
+ provider: agentMeta?.provider,
177
+ model: agentMeta?.model,
178
+ ...metaError ? { error: metaError } : {},
179
+ ...errorText.length > 0 ? { toolErrors: errorText } : {}
180
+ });
181
+ resolve();
182
+ });
183
+ });
184
+ }
185
+ function describeCliModel(session) {
186
+ return session.lastModelDescription || `openclaw/${session.agentId}`;
187
+ }
188
+
189
+ // ../../plugins/fusion-plugin-openclaw-runtime/dist/runtime-adapter.js
190
+ var OpenClawRuntimeAdapter = class {
191
+ id = "openclaw";
192
+ name = "OpenClaw Runtime";
193
+ config;
194
+ constructor(settings) {
195
+ this.config = resolveCliConfig(settings);
196
+ }
197
+ async createSession(options) {
198
+ const session = createCliSession({
199
+ systemPrompt: options.systemPrompt,
200
+ agentId: this.config.agentId,
201
+ callbacks: {
202
+ onText: options.onText,
203
+ onThinking: options.onThinking,
204
+ onToolStart: options.onToolStart,
205
+ onToolEnd: options.onToolEnd
206
+ }
207
+ });
208
+ return { session, sessionFile: void 0 };
209
+ }
210
+ async promptWithFallback(session, prompt, options) {
211
+ const overrideCallbacks = options ?? void 0;
212
+ await promptCli(session, prompt, this.config, overrideCallbacks);
213
+ }
214
+ describeModel(session) {
215
+ return describeCliModel(session);
216
+ }
217
+ async dispose(_session) {
218
+ }
219
+ };
220
+
221
+ // ../../plugins/fusion-plugin-openclaw-runtime/dist/probe.js
222
+ import { spawn as spawn2 } from "node:child_process";
223
+ var DEFAULT_PROBE_TIMEOUT_MS = 2e3;
224
+ async function probeOpenClawBinary(opts = {}) {
225
+ const startedAt = Date.now();
226
+ const binary = opts.binaryPath ?? "openclaw";
227
+ const timeoutMs = opts.timeoutMs ?? DEFAULT_PROBE_TIMEOUT_MS;
228
+ const resolvedPath = await tryResolveBinaryPath(binary);
229
+ return new Promise((resolvePromise) => {
230
+ const finish = (partial) => {
231
+ resolvePromise({ ...partial, probeDurationMs: Date.now() - startedAt });
232
+ };
233
+ let settled = false;
234
+ const child = spawn2(resolvedPath ?? binary, ["--version"], {
235
+ stdio: ["ignore", "pipe", "pipe"]
236
+ });
237
+ const timer = setTimeout(() => {
238
+ if (settled)
239
+ return;
240
+ settled = true;
241
+ try {
242
+ child.kill("SIGKILL");
243
+ } catch {
244
+ }
245
+ finish({
246
+ available: false,
247
+ binaryPath: resolvedPath,
248
+ reason: `Probe timed out after ${timeoutMs}ms`
249
+ });
250
+ }, timeoutMs);
251
+ let stdout = "";
252
+ let stderr = "";
253
+ child.stdout?.on("data", (chunk) => {
254
+ stdout += chunk.toString("utf-8");
255
+ });
256
+ child.stderr?.on("data", (chunk) => {
257
+ stderr += chunk.toString("utf-8");
258
+ });
259
+ child.on("error", (err) => {
260
+ if (settled)
261
+ return;
262
+ settled = true;
263
+ clearTimeout(timer);
264
+ const isNotFound = err.code === "ENOENT";
265
+ finish({
266
+ available: false,
267
+ binaryPath: resolvedPath,
268
+ reason: isNotFound ? `\`${binary}\` not found on PATH \u2014 install via: npm install -g openclaw` : err.message
269
+ });
270
+ });
271
+ child.on("close", (code) => {
272
+ if (settled)
273
+ return;
274
+ settled = true;
275
+ clearTimeout(timer);
276
+ if (code === 0) {
277
+ finish({
278
+ available: true,
279
+ binaryPath: resolvedPath,
280
+ version: stdout.trim() || void 0
281
+ });
282
+ } else {
283
+ finish({
284
+ available: false,
285
+ binaryPath: resolvedPath,
286
+ reason: stderr.trim() || `openclaw --version exited with code ${String(code)}`
287
+ });
288
+ }
289
+ });
290
+ });
291
+ }
292
+ async function tryResolveBinaryPath(binary) {
293
+ return new Promise((resolvePromise) => {
294
+ const which = process.platform === "win32" ? "where" : "which";
295
+ const child = spawn2(which, [binary], { stdio: ["ignore", "pipe", "ignore"] });
296
+ let out = "";
297
+ child.stdout?.on("data", (chunk) => {
298
+ out += chunk.toString("utf-8");
299
+ });
300
+ child.on("error", () => resolvePromise(void 0));
301
+ child.on("close", (code) => {
302
+ if (code === 0) {
303
+ const first = out.trim().split(/\r?\n/)[0];
304
+ resolvePromise(first?.length ? first : void 0);
305
+ } else {
306
+ resolvePromise(void 0);
307
+ }
308
+ });
309
+ });
310
+ }
311
+
312
+ // ../../plugins/fusion-plugin-openclaw-runtime/dist/index.js
313
+ var OPENCLAW_RUNTIME_ID = "openclaw";
314
+ var OPENCLAW_RUNTIME_VERSION = "0.2.0";
315
+ var openclawRuntimeMetadata = {
316
+ runtimeId: OPENCLAW_RUNTIME_ID,
317
+ name: "OpenClaw Runtime",
318
+ description: "Drives the local `openclaw` CLI (openclaw/openclaw)",
319
+ version: OPENCLAW_RUNTIME_VERSION
320
+ };
321
+ var openclawRuntimeFactory = async (ctx) => {
322
+ return new OpenClawRuntimeAdapter(ctx?.settings);
323
+ };
324
+ var plugin = definePlugin({
325
+ manifest: {
326
+ id: "fusion-plugin-openclaw-runtime",
327
+ name: "OpenClaw Runtime Plugin",
328
+ version: OPENCLAW_RUNTIME_VERSION,
329
+ description: "Drives the local `openclaw` CLI for Fusion agents \u2014 embedded `--local` mode by default; gateway optional.",
330
+ author: "Fusion Team",
331
+ homepage: "https://docs.openclaw.ai/",
332
+ runtime: openclawRuntimeMetadata
333
+ },
334
+ state: "installed",
335
+ hooks: {
336
+ onLoad: async (ctx) => {
337
+ const config = resolveCliConfig(ctx.settings);
338
+ const probe = await probeOpenClawBinary({ binaryPath: config.binaryPath });
339
+ ctx.logger.info(probe.available ? `OpenClaw Runtime Plugin loaded \u2014 binary=${config.binaryPath}${probe.version ? ` (${probe.version})` : ""}` : `OpenClaw Runtime Plugin loaded but binary not detected: ${probe.reason ?? "unknown"}`);
340
+ ctx.emitEvent("openclaw-runtime:loaded", {
341
+ runtimeId: OPENCLAW_RUNTIME_ID,
342
+ version: OPENCLAW_RUNTIME_VERSION,
343
+ binaryAvailable: probe.available,
344
+ binaryPath: probe.binaryPath ?? config.binaryPath
345
+ });
346
+ },
347
+ onUnload: () => {
348
+ }
349
+ },
350
+ runtime: {
351
+ metadata: openclawRuntimeMetadata,
352
+ factory: openclawRuntimeFactory
353
+ }
354
+ });
355
+ var index_default = plugin;
356
+ export {
357
+ OPENCLAW_RUNTIME_ID,
358
+ OpenClawRuntimeAdapter,
359
+ buildOpenClawArgs,
360
+ createCliSession,
361
+ index_default as default,
362
+ describeCliModel,
363
+ extractStderrError,
364
+ openclawRuntimeFactory,
365
+ openclawRuntimeMetadata,
366
+ probeOpenClawBinary,
367
+ promptCli,
368
+ resolveCliConfig
369
+ };
@@ -0,0 +1,14 @@
1
+ {
2
+ "id": "fusion-plugin-openclaw-runtime",
3
+ "name": "OpenClaw Runtime Plugin",
4
+ "version": "0.1.0",
5
+ "description": "Provides OpenClaw runtime for Fusion AI agents",
6
+ "author": "Fusion Team",
7
+ "homepage": "https://github.com/gsxdsm/fusion",
8
+ "runtime": {
9
+ "runtimeId": "openclaw",
10
+ "name": "OpenClaw Runtime",
11
+ "description": "OpenClaw-backed AI session using the local OpenClaw gateway",
12
+ "version": "0.1.0"
13
+ }
14
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "@fusion-plugin-examples/openclaw-runtime",
3
+ "version": "0.2.30",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "import": "./bundled.js"
8
+ }
9
+ },
10
+ "private": true
11
+ }