@runfusion/fusion 0.0.3 → 0.0.5
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/dist/bin.js +54 -8
- package/dist/client/assets/index-9GdD09x7.css +1 -0
- package/dist/client/assets/{index-6vxMhlrC.js → index-wtVkS5Qz.js} +205 -205
- package/dist/client/index.html +2 -2
- package/dist/extension.js +30 -5
- package/package.json +1 -1
- package/dist/client/assets/index-DVmHYNJ8.css +0 -1
package/dist/bin.js
CHANGED
|
@@ -3510,13 +3510,25 @@ import { mkdir, readFile, writeFile, readdir, unlink, rename } from "node:fs/pro
|
|
|
3510
3510
|
import { basename, join as join2, resolve } from "node:path";
|
|
3511
3511
|
import { randomUUID, randomBytes, createHash } from "node:crypto";
|
|
3512
3512
|
import { EventEmitter } from "node:events";
|
|
3513
|
-
|
|
3513
|
+
function resolveCreationRuntimeConfig(incoming, metadata) {
|
|
3514
|
+
const isEphemeral = isEphemeralAgent({ metadata });
|
|
3515
|
+
if (isEphemeral) {
|
|
3516
|
+
return incoming;
|
|
3517
|
+
}
|
|
3518
|
+
const rc = { ...incoming ?? {} };
|
|
3519
|
+
if (typeof rc.heartbeatIntervalMs !== "number" || !Number.isFinite(rc.heartbeatIntervalMs)) {
|
|
3520
|
+
rc.heartbeatIntervalMs = DEFAULT_AGENT_HEARTBEAT_INTERVAL_MS;
|
|
3521
|
+
}
|
|
3522
|
+
return rc;
|
|
3523
|
+
}
|
|
3524
|
+
var DEFAULT_AGENT_HEARTBEAT_INTERVAL_MS, AgentStore;
|
|
3514
3525
|
var init_agent_store = __esm({
|
|
3515
3526
|
"../core/src/agent-store.ts"() {
|
|
3516
3527
|
"use strict";
|
|
3517
3528
|
init_types();
|
|
3518
3529
|
init_agent_permissions();
|
|
3519
3530
|
init_db();
|
|
3531
|
+
DEFAULT_AGENT_HEARTBEAT_INTERVAL_MS = 36e5;
|
|
3520
3532
|
AgentStore = class extends EventEmitter {
|
|
3521
3533
|
rootDir;
|
|
3522
3534
|
agentsDir;
|
|
@@ -3655,6 +3667,16 @@ var init_agent_store = __esm({
|
|
|
3655
3667
|
}
|
|
3656
3668
|
/**
|
|
3657
3669
|
* Create a new agent with "idle" state.
|
|
3670
|
+
*
|
|
3671
|
+
* For non-ephemeral agents, ensures `runtimeConfig.heartbeatIntervalMs` is
|
|
3672
|
+
* persisted at creation time — previously it was only ever written when the
|
|
3673
|
+
* user interacted with the dashboard dropdown, so agents created and never
|
|
3674
|
+
* touched would end up with no interval on disk. That made the dashboard's
|
|
3675
|
+
* freshness check behave inconsistently between agents that had been
|
|
3676
|
+
* configured and agents that hadn't, even though the scheduler applied the
|
|
3677
|
+
* same default (1h) to both at runtime. Writing the default explicitly
|
|
3678
|
+
* removes that divergence and keeps the persisted config truthful.
|
|
3679
|
+
*
|
|
3658
3680
|
* @param input - Creation parameters
|
|
3659
3681
|
* @returns The created agent
|
|
3660
3682
|
* @throws Error if input is invalid
|
|
@@ -3668,6 +3690,8 @@ var init_agent_store = __esm({
|
|
|
3668
3690
|
}
|
|
3669
3691
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3670
3692
|
const agentId = `agent-${randomUUID().slice(0, 8)}`;
|
|
3693
|
+
const metadata = input.metadata ?? {};
|
|
3694
|
+
const runtimeConfig = resolveCreationRuntimeConfig(input.runtimeConfig, metadata);
|
|
3671
3695
|
const agent = {
|
|
3672
3696
|
id: agentId,
|
|
3673
3697
|
name: input.name.trim(),
|
|
@@ -3675,11 +3699,11 @@ var init_agent_store = __esm({
|
|
|
3675
3699
|
state: "idle",
|
|
3676
3700
|
createdAt: now,
|
|
3677
3701
|
updatedAt: now,
|
|
3678
|
-
metadata
|
|
3702
|
+
metadata,
|
|
3679
3703
|
...input.title && { title: input.title },
|
|
3680
3704
|
...input.icon && { icon: input.icon },
|
|
3681
3705
|
...input.reportsTo && { reportsTo: input.reportsTo },
|
|
3682
|
-
...
|
|
3706
|
+
...runtimeConfig && { runtimeConfig },
|
|
3683
3707
|
...input.permissions && { permissions: input.permissions },
|
|
3684
3708
|
...input.instructionsPath && { instructionsPath: input.instructionsPath },
|
|
3685
3709
|
...input.instructionsText && { instructionsText: input.instructionsText },
|
|
@@ -34457,7 +34481,7 @@ async function syncBackupAutomation(automationStore, settings) {
|
|
|
34457
34481
|
if (!AutomationStore2.isValidCron(schedule)) {
|
|
34458
34482
|
throw new Error(`Invalid backup schedule: ${schedule}`);
|
|
34459
34483
|
}
|
|
34460
|
-
const command = "
|
|
34484
|
+
const command = "npx runfusion.ai backup --create";
|
|
34461
34485
|
if (existingSchedule) {
|
|
34462
34486
|
return await automationStore.updateSchedule(existingSchedule.id, {
|
|
34463
34487
|
scheduleType: "custom",
|
|
@@ -34490,7 +34514,7 @@ async function syncBackupRoutine(routineStore, settings) {
|
|
|
34490
34514
|
if (!RoutineStore2.isValidCron(schedule)) {
|
|
34491
34515
|
throw new Error(`Invalid backup schedule: ${schedule}`);
|
|
34492
34516
|
}
|
|
34493
|
-
const command = "
|
|
34517
|
+
const command = "npx runfusion.ai backup --create";
|
|
34494
34518
|
const input = {
|
|
34495
34519
|
name: BACKUP_SCHEDULE_NAME,
|
|
34496
34520
|
description: "Automatic database backup based on project settings",
|
|
@@ -47049,6 +47073,7 @@ __export(src_exports, {
|
|
|
47049
47073
|
CheckoutConflictError: () => CheckoutConflictError,
|
|
47050
47074
|
DAEMON_TOKEN_HEX_LENGTH: () => DAEMON_TOKEN_HEX_LENGTH,
|
|
47051
47075
|
DAEMON_TOKEN_PREFIX: () => DAEMON_TOKEN_PREFIX,
|
|
47076
|
+
DEFAULT_AGENT_HEARTBEAT_INTERVAL_MS: () => DEFAULT_AGENT_HEARTBEAT_INTERVAL_MS,
|
|
47052
47077
|
DEFAULT_AUTO_SUMMARIZE_SCHEDULE: () => DEFAULT_AUTO_SUMMARIZE_SCHEDULE,
|
|
47053
47078
|
DEFAULT_EXECUTION_MODE: () => DEFAULT_EXECUTION_MODE,
|
|
47054
47079
|
DEFAULT_GLOBAL_SETTINGS: () => DEFAULT_GLOBAL_SETTINGS,
|
|
@@ -50947,6 +50972,21 @@ var init_terminal_service = __esm({
|
|
|
50947
50972
|
}
|
|
50948
50973
|
return { shell: "/bin/sh", args: [] };
|
|
50949
50974
|
}
|
|
50975
|
+
/**
|
|
50976
|
+
* Build concise diagnostics for PTY launch failures without logging the full environment.
|
|
50977
|
+
*/
|
|
50978
|
+
getSpawnDiagnostics(requestedShell, detectedShell, detectedArgs, cwd) {
|
|
50979
|
+
return {
|
|
50980
|
+
platform: os2.platform(),
|
|
50981
|
+
projectRoot: this.projectRoot,
|
|
50982
|
+
cwd,
|
|
50983
|
+
requestedShell: requestedShell ?? null,
|
|
50984
|
+
detectedShell,
|
|
50985
|
+
detectedArgs,
|
|
50986
|
+
envShell: process.env.SHELL ?? null,
|
|
50987
|
+
allowedShells: this.getAllowedShells().filter((shellPath) => existsSync17(shellPath))
|
|
50988
|
+
};
|
|
50989
|
+
}
|
|
50950
50990
|
/**
|
|
50951
50991
|
* Validate and resolve a working directory path
|
|
50952
50992
|
*/
|
|
@@ -51073,6 +51113,7 @@ var init_terminal_service = __esm({
|
|
|
51073
51113
|
};
|
|
51074
51114
|
}
|
|
51075
51115
|
const cwd = await this.resolveWorkingDirectory(options.cwd);
|
|
51116
|
+
const spawnDiagnostics = this.getSpawnDiagnostics(options.shell, detectedShell, shellArgs, cwd);
|
|
51076
51117
|
const cleanEnv = {};
|
|
51077
51118
|
for (const [key, value] of Object.entries(process.env)) {
|
|
51078
51119
|
if (value !== void 0 && !STRIP_ENV_VARS.includes(key)) {
|
|
@@ -51088,7 +51129,11 @@ var init_terminal_service = __esm({
|
|
|
51088
51129
|
LC_ALL: process.env.LC_ALL || process.env.LANG || "en_US.UTF-8",
|
|
51089
51130
|
...options.env
|
|
51090
51131
|
};
|
|
51091
|
-
console.info(`Creating session ${id}
|
|
51132
|
+
console.info(`[createSession] Creating session ${id}`, {
|
|
51133
|
+
...spawnDiagnostics,
|
|
51134
|
+
selectedShell: shell,
|
|
51135
|
+
selectedArgs: shell === detectedShell ? shellArgs : []
|
|
51136
|
+
});
|
|
51092
51137
|
let pty;
|
|
51093
51138
|
try {
|
|
51094
51139
|
pty = await loadPtyModule();
|
|
@@ -51141,12 +51186,13 @@ var init_terminal_service = __esm({
|
|
|
51141
51186
|
lastSpawnError = spawnError;
|
|
51142
51187
|
console.error(
|
|
51143
51188
|
`[createSession] PTY spawn failed (${attempt.reason}) for ${attempt.shell} ${attempt.args.join(" ")}:`,
|
|
51144
|
-
spawnError
|
|
51189
|
+
spawnError,
|
|
51190
|
+
spawnDiagnostics
|
|
51145
51191
|
);
|
|
51146
51192
|
}
|
|
51147
51193
|
}
|
|
51148
51194
|
if (!ptyProcess) {
|
|
51149
|
-
console.error(`[createSession] All PTY spawn attempts failed`, lastSpawnError);
|
|
51195
|
+
console.error(`[createSession] All PTY spawn attempts failed`, lastSpawnError, spawnDiagnostics);
|
|
51150
51196
|
return {
|
|
51151
51197
|
success: false,
|
|
51152
51198
|
code: "pty_spawn_failed",
|