@runfusion/fusion 0.9.2 → 0.9.3
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 +582 -431
- package/dist/client/assets/{AgentDetailView-CcvwSbwq.js → AgentDetailView-D9UWpTYr.js} +3 -3
- package/dist/client/assets/{AgentsView-m8dBmo63.js → AgentsView-DeCfRupM.js} +3 -3
- package/dist/client/assets/{ChatView-BKlUxTL8.js → ChatView-ChlqnJfu.js} +1 -1
- package/dist/client/assets/{DevServerView-BygenPXh.js → DevServerView-B7EjWlgc.js} +1 -1
- package/dist/client/assets/{DirectoryPicker-BosMLSTv.js → DirectoryPicker-crtmkC00.js} +1 -1
- package/dist/client/assets/{DocumentsView-BfEPLY3E.js → DocumentsView-BLxVoopL.js} +1 -1
- package/dist/client/assets/{InsightsView-B8FDRckf.js → InsightsView-CcdTychV.js} +1 -1
- package/dist/client/assets/{MemoryView-RT80_hUg.js → MemoryView-rSwx9Md8.js} +1 -1
- package/dist/client/assets/{NodesView-UaaYrNBq.js → NodesView-Bwz0cHKV.js} +1 -1
- package/dist/client/assets/{PiExtensionsManager-Cjtt84Cv.js → PiExtensionsManager-Uo3E8Ae7.js} +1 -1
- package/dist/client/assets/{PluginManager-BuhG8uF_.js → PluginManager-HtW8xVY8.js} +1 -1
- package/dist/client/assets/{ResearchView-DLDnrYVm.js → ResearchView-BV-iy9g8.js} +1 -1
- package/dist/client/assets/{RoadmapsView-DP7o1HsL.js → RoadmapsView-C2j64cbz.js} +1 -1
- package/dist/client/assets/{SettingsModal-BWkxqiIg.js → SettingsModal-CVd9kNk7.js} +1 -1
- package/dist/client/assets/{SettingsModal-BAZQbTpw.js → SettingsModal-ClnT1Lcv.js} +3 -3
- package/dist/client/assets/{SetupWizardModal-BZFsWHpZ.js → SetupWizardModal-Dy-vQpTm.js} +1 -1
- package/dist/client/assets/{SkillsView-87geY7V_.js → SkillsView-BQwTyjxc.js} +1 -1
- package/dist/client/assets/{TodoView-DaYieTys.js → TodoView-Dce4DrzU.js} +1 -1
- package/dist/client/assets/{folder-open-Di63O7Be.js → folder-open-DWUflP4Q.js} +1 -1
- package/dist/client/assets/{index-BFOt3vs-.js → index-Bs3RZu5I.js} +29 -29
- package/dist/client/assets/{index-BKZuWpfH.css → index-C3-q81dV.css} +1 -1
- package/dist/client/assets/{list-checks-DQ8ece3U.js → list-checks-CusZ_RMn.js} +1 -1
- package/dist/client/assets/{star-CHOSzU9a.js → star-C-NXZn1F.js} +1 -1
- package/dist/client/assets/{upload-D7w2Kq_t.js → upload-CXJ5L6L4.js} +1 -1
- package/dist/client/assets/{users-YG5FjHxk.js → users-YaA3x5mt.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/client/version.json +1 -1
- package/dist/extension.js +228 -68
- package/dist/pi-claude-cli/package.json +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -892,6 +892,12 @@ function hasAgentIdentity(agent) {
|
|
|
892
892
|
if (!agent) return false;
|
|
893
893
|
return !!(agent.soul?.trim() || agent.instructionsText?.trim() || agent.instructionsPath?.trim() || agent.memory?.trim());
|
|
894
894
|
}
|
|
895
|
+
function getDefaultHeartbeatProcedurePath(agentId) {
|
|
896
|
+
if (!agentId || typeof agentId !== "string") {
|
|
897
|
+
throw new Error("getDefaultHeartbeatProcedurePath requires a non-empty agentId");
|
|
898
|
+
}
|
|
899
|
+
return `.fusion/agents/${agentId}/HEARTBEAT.md`;
|
|
900
|
+
}
|
|
895
901
|
function agentToConfigSnapshot(agent) {
|
|
896
902
|
return {
|
|
897
903
|
name: agent.name,
|
|
@@ -4372,8 +4378,9 @@ CREATE INDEX IF NOT EXISTS idxTodoItemsSortOrder ON todo_items(listId, sortOrder
|
|
|
4372
4378
|
});
|
|
4373
4379
|
|
|
4374
4380
|
// ../core/src/agent-store.ts
|
|
4375
|
-
import { mkdir, readFile, writeFile, readdir, unlink, rename } from "node:fs/promises";
|
|
4376
|
-
import {
|
|
4381
|
+
import { mkdir, readFile, writeFile, readdir, unlink, rename, access } from "node:fs/promises";
|
|
4382
|
+
import { constants as fsConstants } from "node:fs";
|
|
4383
|
+
import { basename, dirname, join as join3, resolve as resolve2 } from "node:path";
|
|
4377
4384
|
import { randomUUID, randomBytes, createHash } from "node:crypto";
|
|
4378
4385
|
import { EventEmitter } from "node:events";
|
|
4379
4386
|
function resolveCreationRuntimeConfig(incoming, metadata) {
|
|
@@ -4429,9 +4436,75 @@ var init_agent_store = __esm({
|
|
|
4429
4436
|
* Should be called before other operations.
|
|
4430
4437
|
*/
|
|
4431
4438
|
async init() {
|
|
4432
|
-
|
|
4439
|
+
void this.db;
|
|
4433
4440
|
await mkdir(this.agentsDir, { recursive: true });
|
|
4434
4441
|
await this.importLegacyFileDataOnce();
|
|
4442
|
+
await this.migrateHeartbeatProcedurePathOnce();
|
|
4443
|
+
}
|
|
4444
|
+
/**
|
|
4445
|
+
* One-shot migration that re-points every non-ephemeral agent off the
|
|
4446
|
+
* legacy shared `.fusion/HEARTBEAT.md` path onto their own per-agent
|
|
4447
|
+
* `.fusion/agents/<id>/HEARTBEAT.md` file. The legacy file's contents
|
|
4448
|
+
* are copied to the new location when present so operator edits are
|
|
4449
|
+
* preserved across the upgrade. The legacy file itself is left in place
|
|
4450
|
+
* — the migration is non-destructive in case the operator wants a
|
|
4451
|
+
* reference copy.
|
|
4452
|
+
*
|
|
4453
|
+
* Idempotent: tracks completion in the `__meta` table and short-circuits
|
|
4454
|
+
* on subsequent calls. Failures during file copy are logged via the
|
|
4455
|
+
* legacy console (no log dependency in core) and do not block startup —
|
|
4456
|
+
* the agent's `heartbeatProcedurePath` is still flipped, and the engine's
|
|
4457
|
+
* heartbeat resolver will fall back to the built-in template until the
|
|
4458
|
+
* file is seeded on next dashboard interaction.
|
|
4459
|
+
*/
|
|
4460
|
+
async migrateHeartbeatProcedurePathOnce() {
|
|
4461
|
+
const migrationKey = "heartbeatProcedurePathPerAgent";
|
|
4462
|
+
const migrationVersion = "1";
|
|
4463
|
+
const row = this.db.prepare("SELECT value FROM __meta WHERE key = ?").get(migrationKey);
|
|
4464
|
+
if (row?.value === migrationVersion) {
|
|
4465
|
+
return;
|
|
4466
|
+
}
|
|
4467
|
+
let legacyContent = null;
|
|
4468
|
+
try {
|
|
4469
|
+
legacyContent = await readFile(join3(this.rootDir, "HEARTBEAT.md"), "utf-8");
|
|
4470
|
+
} catch {
|
|
4471
|
+
legacyContent = null;
|
|
4472
|
+
}
|
|
4473
|
+
const agents = await this.listAgents({ includeEphemeral: false });
|
|
4474
|
+
let migratedCount = 0;
|
|
4475
|
+
for (const agent of agents) {
|
|
4476
|
+
if (agent.heartbeatProcedurePath !== DEFAULT_HEARTBEAT_PROCEDURE_PATH) {
|
|
4477
|
+
continue;
|
|
4478
|
+
}
|
|
4479
|
+
const newRelPath = getDefaultHeartbeatProcedurePath(agent.id);
|
|
4480
|
+
const newAbsPath = join3(this.rootDir, "..", newRelPath);
|
|
4481
|
+
if (legacyContent !== null) {
|
|
4482
|
+
try {
|
|
4483
|
+
await mkdir(dirname(newAbsPath), { recursive: true });
|
|
4484
|
+
try {
|
|
4485
|
+
await access(newAbsPath, fsConstants.F_OK);
|
|
4486
|
+
} catch {
|
|
4487
|
+
await writeFile(newAbsPath, legacyContent, "utf-8");
|
|
4488
|
+
}
|
|
4489
|
+
} catch {
|
|
4490
|
+
}
|
|
4491
|
+
}
|
|
4492
|
+
const updated = {
|
|
4493
|
+
...agent,
|
|
4494
|
+
heartbeatProcedurePath: newRelPath,
|
|
4495
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4496
|
+
};
|
|
4497
|
+
await this.writeAgent(updated);
|
|
4498
|
+
migratedCount += 1;
|
|
4499
|
+
}
|
|
4500
|
+
this.db.prepare(`
|
|
4501
|
+
INSERT INTO __meta (key, value)
|
|
4502
|
+
VALUES (?, ?)
|
|
4503
|
+
ON CONFLICT(key) DO UPDATE SET value = excluded.value
|
|
4504
|
+
`).run(migrationKey, migrationVersion);
|
|
4505
|
+
if (migratedCount > 0) {
|
|
4506
|
+
this.db.bumpLastModified();
|
|
4507
|
+
}
|
|
4435
4508
|
}
|
|
4436
4509
|
/**
|
|
4437
4510
|
* One-way migration helper for projects that still have legacy agent JSON
|
|
@@ -4564,7 +4637,7 @@ var init_agent_store = __esm({
|
|
|
4564
4637
|
const metadata = input.metadata ?? {};
|
|
4565
4638
|
const runtimeConfig = resolveCreationRuntimeConfig(input.runtimeConfig, metadata);
|
|
4566
4639
|
const ephemeral = isEphemeralAgent({ metadata, name: input.name, role: input.role, reportsTo: input.reportsTo });
|
|
4567
|
-
const resolvedHeartbeatProcedurePath = input.heartbeatProcedurePath ?? (ephemeral ? void 0 :
|
|
4640
|
+
const resolvedHeartbeatProcedurePath = input.heartbeatProcedurePath ?? (ephemeral ? void 0 : getDefaultHeartbeatProcedurePath(agentId));
|
|
4568
4641
|
const agent = {
|
|
4569
4642
|
id: agentId,
|
|
4570
4643
|
name: input.name.trim(),
|
|
@@ -6498,7 +6571,7 @@ var init_task_priority = __esm({
|
|
|
6498
6571
|
|
|
6499
6572
|
// ../core/src/global-settings.ts
|
|
6500
6573
|
import { homedir } from "node:os";
|
|
6501
|
-
import { dirname, join as join5 } from "node:path";
|
|
6574
|
+
import { dirname as dirname2, join as join5 } from "node:path";
|
|
6502
6575
|
import { mkdir as mkdir3, readFile as readFile3, writeFile as writeFile3, rename as rename2, chmod } from "node:fs/promises";
|
|
6503
6576
|
import { existsSync as existsSync3, mkdirSync as mkdirSync2, renameSync } from "node:fs";
|
|
6504
6577
|
function getHomeDir() {
|
|
@@ -6528,7 +6601,7 @@ function resolveGlobalDir(dir2) {
|
|
|
6528
6601
|
const legacyDir = legacyGlobalDir();
|
|
6529
6602
|
if (existsSync3(legacyDir)) {
|
|
6530
6603
|
try {
|
|
6531
|
-
mkdirSync2(
|
|
6604
|
+
mkdirSync2(dirname2(preferredDir), { recursive: true });
|
|
6532
6605
|
renameSync(legacyDir, preferredDir);
|
|
6533
6606
|
return preferredDir;
|
|
6534
6607
|
} catch {
|
|
@@ -6538,7 +6611,7 @@ function resolveGlobalDir(dir2) {
|
|
|
6538
6611
|
const legacyDirOriginal = legacyGlobalDirOriginal();
|
|
6539
6612
|
if (existsSync3(legacyDirOriginal)) {
|
|
6540
6613
|
try {
|
|
6541
|
-
mkdirSync2(
|
|
6614
|
+
mkdirSync2(dirname2(preferredDir), { recursive: true });
|
|
6542
6615
|
renameSync(legacyDirOriginal, preferredDir);
|
|
6543
6616
|
return preferredDir;
|
|
6544
6617
|
} catch {
|
|
@@ -6683,9 +6756,9 @@ var init_global_settings = __esm({
|
|
|
6683
6756
|
* Serialize operations via promise chain to prevent lost-update races.
|
|
6684
6757
|
*/
|
|
6685
6758
|
withLock(fn) {
|
|
6686
|
-
let
|
|
6759
|
+
let resolve38;
|
|
6687
6760
|
const next = new Promise((r) => {
|
|
6688
|
-
|
|
6761
|
+
resolve38 = r;
|
|
6689
6762
|
});
|
|
6690
6763
|
const prev = this.lock;
|
|
6691
6764
|
this.lock = next;
|
|
@@ -6693,7 +6766,7 @@ var init_global_settings = __esm({
|
|
|
6693
6766
|
try {
|
|
6694
6767
|
return await fn();
|
|
6695
6768
|
} finally {
|
|
6696
|
-
|
|
6769
|
+
resolve38();
|
|
6697
6770
|
}
|
|
6698
6771
|
});
|
|
6699
6772
|
}
|
|
@@ -12320,11 +12393,11 @@ var init_todo_store = __esm({
|
|
|
12320
12393
|
|
|
12321
12394
|
// ../core/src/app-version.ts
|
|
12322
12395
|
import { readFileSync } from "node:fs";
|
|
12323
|
-
import { join as join9, dirname as
|
|
12396
|
+
import { join as join9, dirname as dirname3 } from "node:path";
|
|
12324
12397
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
12325
12398
|
function getAppVersion() {
|
|
12326
12399
|
if (cachedVersion !== null) return cachedVersion;
|
|
12327
|
-
const __dirname2 =
|
|
12400
|
+
const __dirname2 = dirname3(fileURLToPath2(import.meta.url));
|
|
12328
12401
|
let currentDir = __dirname2;
|
|
12329
12402
|
for (let i = 0; i < 10; i++) {
|
|
12330
12403
|
try {
|
|
@@ -12336,7 +12409,7 @@ function getAppVersion() {
|
|
|
12336
12409
|
}
|
|
12337
12410
|
} catch {
|
|
12338
12411
|
}
|
|
12339
|
-
const parentDir =
|
|
12412
|
+
const parentDir = dirname3(currentDir);
|
|
12340
12413
|
if (parentDir === currentDir) break;
|
|
12341
12414
|
currentDir = parentDir;
|
|
12342
12415
|
}
|
|
@@ -16343,7 +16416,7 @@ __export(check_disk_space_exports, {
|
|
|
16343
16416
|
getFirstExistingParentPath: () => getFirstExistingParentPath
|
|
16344
16417
|
});
|
|
16345
16418
|
import { execFile } from "node:child_process";
|
|
16346
|
-
import { access } from "node:fs/promises";
|
|
16419
|
+
import { access as access2 } from "node:fs/promises";
|
|
16347
16420
|
import { release } from "node:os";
|
|
16348
16421
|
import { normalize, sep as sep2 } from "node:path";
|
|
16349
16422
|
import { platform } from "node:process";
|
|
@@ -16380,7 +16453,7 @@ async function hasPowerShell3(dependencies) {
|
|
|
16380
16453
|
function checkDiskSpace(directoryPath, dependencies = {
|
|
16381
16454
|
platform,
|
|
16382
16455
|
release: release(),
|
|
16383
|
-
fsAccess:
|
|
16456
|
+
fsAccess: access2,
|
|
16384
16457
|
pathNormalize: normalize,
|
|
16385
16458
|
pathSep: sep2,
|
|
16386
16459
|
cpExecFile: promisify(execFile)
|
|
@@ -18526,7 +18599,7 @@ __export(migration_exports, {
|
|
|
18526
18599
|
});
|
|
18527
18600
|
import { existsSync as existsSync9 } from "node:fs";
|
|
18528
18601
|
import { homedir as homedir2, tmpdir } from "node:os";
|
|
18529
|
-
import { isAbsolute as isAbsolute3, join as join12, resolve as resolve5, basename as basename3, dirname as
|
|
18602
|
+
import { isAbsolute as isAbsolute3, join as join12, resolve as resolve5, basename as basename3, dirname as dirname4 } from "node:path";
|
|
18530
18603
|
function getHomeDir2() {
|
|
18531
18604
|
return process.env.HOME || process.env.USERPROFILE || homedir2();
|
|
18532
18605
|
}
|
|
@@ -18626,7 +18699,7 @@ var init_migration = __esm({
|
|
|
18626
18699
|
const visited = /* @__PURE__ */ new Set();
|
|
18627
18700
|
let current = resolve5(startDir);
|
|
18628
18701
|
const home = getHomeDir2();
|
|
18629
|
-
const root =
|
|
18702
|
+
const root = dirname4(current) === current ? current : "/";
|
|
18630
18703
|
const systemTmp = resolve5(tmpdir());
|
|
18631
18704
|
while (current !== home && current !== root && current !== systemTmp) {
|
|
18632
18705
|
if (visited.has(current)) break;
|
|
@@ -18640,7 +18713,7 @@ var init_migration = __esm({
|
|
|
18640
18713
|
});
|
|
18641
18714
|
break;
|
|
18642
18715
|
}
|
|
18643
|
-
const parent2 =
|
|
18716
|
+
const parent2 = dirname4(current);
|
|
18644
18717
|
if (parent2 === current) break;
|
|
18645
18718
|
current = parent2;
|
|
18646
18719
|
}
|
|
@@ -28130,8 +28203,8 @@ var require_CronFileParser = __commonJS({
|
|
|
28130
28203
|
* @throws If file cannot be read
|
|
28131
28204
|
*/
|
|
28132
28205
|
static parseFileSync(filePath) {
|
|
28133
|
-
const { readFileSync:
|
|
28134
|
-
const data =
|
|
28206
|
+
const { readFileSync: readFileSync23 } = __require("fs");
|
|
28207
|
+
const data = readFileSync23(filePath, "utf8");
|
|
28135
28208
|
return _CronFileParser.#parseContent(data);
|
|
28136
28209
|
}
|
|
28137
28210
|
/**
|
|
@@ -28348,9 +28421,9 @@ var init_automation_store = __esm({
|
|
|
28348
28421
|
*/
|
|
28349
28422
|
withScheduleLock(id, fn) {
|
|
28350
28423
|
const prev = this.scheduleLocks.get(id) ?? Promise.resolve();
|
|
28351
|
-
let
|
|
28424
|
+
let resolve38;
|
|
28352
28425
|
const next = new Promise((r) => {
|
|
28353
|
-
|
|
28426
|
+
resolve38 = r;
|
|
28354
28427
|
});
|
|
28355
28428
|
this.scheduleLocks.set(id, next);
|
|
28356
28429
|
return prev.then(async () => {
|
|
@@ -28360,7 +28433,7 @@ var init_automation_store = __esm({
|
|
|
28360
28433
|
if (this.scheduleLocks.get(id) === next) {
|
|
28361
28434
|
this.scheduleLocks.delete(id);
|
|
28362
28435
|
}
|
|
28363
|
-
|
|
28436
|
+
resolve38();
|
|
28364
28437
|
}
|
|
28365
28438
|
});
|
|
28366
28439
|
}
|
|
@@ -28941,9 +29014,9 @@ __export(memory_backend_exports, {
|
|
|
28941
29014
|
writeMemory: () => writeMemory,
|
|
28942
29015
|
writeProjectMemoryFile: () => writeProjectMemoryFile
|
|
28943
29016
|
});
|
|
28944
|
-
import { readFile as readFile6, writeFile as writeFile5, mkdir as mkdir6, access as
|
|
29017
|
+
import { readFile as readFile6, writeFile as writeFile5, mkdir as mkdir6, access as access3, constants, readdir as readdir4, stat as stat2 } from "node:fs/promises";
|
|
28945
29018
|
import { existsSync as existsSync11 } from "node:fs";
|
|
28946
|
-
import { basename as basename4, dirname as
|
|
29019
|
+
import { basename as basename4, dirname as dirname5, isAbsolute as isAbsolute4, join as join15, normalize as normalize2, relative, resolve as resolve6, sep as sep3 } from "node:path";
|
|
28947
29020
|
import { createHash as createHash3 } from "node:crypto";
|
|
28948
29021
|
function shouldSkipBackgroundQmdRefresh() {
|
|
28949
29022
|
return (process.env.VITEST === "true" || process.env.NODE_ENV === "test") && process.env.FUSION_ENABLE_QMD_REFRESH_IN_TESTS !== "1";
|
|
@@ -29103,7 +29176,7 @@ async function readProjectMemoryFileContent(rootDir, path5) {
|
|
|
29103
29176
|
}
|
|
29104
29177
|
async function writeProjectMemoryFile(rootDir, path5, content) {
|
|
29105
29178
|
const { absPath } = resolveMemoryFilePath(rootDir, path5);
|
|
29106
|
-
await mkdir6(
|
|
29179
|
+
await mkdir6(dirname5(absPath), { recursive: true });
|
|
29107
29180
|
const tmpPath = `${absPath}.tmp`;
|
|
29108
29181
|
await writeFile5(tmpPath, content, "utf-8");
|
|
29109
29182
|
const { rename: rename6 } = await import("node:fs/promises");
|
|
@@ -29222,7 +29295,7 @@ async function readAgentMemoryFile(rootDir, agentId, path5) {
|
|
|
29222
29295
|
}
|
|
29223
29296
|
async function writeAgentMemoryFile(rootDir, agentId, path5, content) {
|
|
29224
29297
|
const { absPath } = await resolveAgentMemoryFilePath(rootDir, agentId, path5);
|
|
29225
|
-
await mkdir6(
|
|
29298
|
+
await mkdir6(dirname5(absPath), { recursive: true });
|
|
29226
29299
|
const tmpPath = `${absPath}.tmp`;
|
|
29227
29300
|
await writeFile5(tmpPath, content, "utf-8");
|
|
29228
29301
|
const { rename: rename6 } = await import("node:fs/promises");
|
|
@@ -29368,7 +29441,7 @@ function normalizeQmdSearchResultPath(rootDir, rawPath) {
|
|
|
29368
29441
|
}
|
|
29369
29442
|
const lowerCandidate = candidate.toLowerCase();
|
|
29370
29443
|
const normalizedBaseName = basename4(candidate).toLowerCase();
|
|
29371
|
-
const normalizedDirName =
|
|
29444
|
+
const normalizedDirName = dirname5(lowerCandidate).replace(/\\/g, "/");
|
|
29372
29445
|
if (normalizedBaseName === "memory.md" && (normalizedDirName === ".fusion" || normalizedDirName.endsWith("/.fusion"))) {
|
|
29373
29446
|
return `${MEMORY_WORKSPACE_PATH}/${MEMORY_LONG_TERM_FILENAME}`;
|
|
29374
29447
|
}
|
|
@@ -29692,7 +29765,7 @@ var init_memory_backend = __esm({
|
|
|
29692
29765
|
}
|
|
29693
29766
|
async exists(rootDir) {
|
|
29694
29767
|
try {
|
|
29695
|
-
await
|
|
29768
|
+
await access3(this.getLongTermPath(rootDir), constants.R_OK);
|
|
29696
29769
|
return true;
|
|
29697
29770
|
} catch {
|
|
29698
29771
|
return false;
|
|
@@ -30149,7 +30222,7 @@ var init_project_memory = __esm({
|
|
|
30149
30222
|
// ../core/src/run-command.ts
|
|
30150
30223
|
import { spawn } from "node:child_process";
|
|
30151
30224
|
function runCommandAsync(command, options = {}) {
|
|
30152
|
-
return new Promise((
|
|
30225
|
+
return new Promise((resolve38) => {
|
|
30153
30226
|
const maxBuffer = options.maxBuffer ?? DEFAULT_MAX_BUFFER;
|
|
30154
30227
|
let stdout = "";
|
|
30155
30228
|
let stderr = "";
|
|
@@ -30208,7 +30281,7 @@ function runCommandAsync(command, options = {}) {
|
|
|
30208
30281
|
clearTimeout(forceKillTimer);
|
|
30209
30282
|
forceKillTimer = null;
|
|
30210
30283
|
}
|
|
30211
|
-
|
|
30284
|
+
resolve38({
|
|
30212
30285
|
stdout,
|
|
30213
30286
|
stderr,
|
|
30214
30287
|
exitCode: null,
|
|
@@ -30226,7 +30299,7 @@ function runCommandAsync(command, options = {}) {
|
|
|
30226
30299
|
}
|
|
30227
30300
|
signalProcessGroup("SIGTERM");
|
|
30228
30301
|
scheduleForceKill(NORMAL_CLEANUP_FORCE_KILL_DELAY_MS);
|
|
30229
|
-
|
|
30302
|
+
resolve38({
|
|
30230
30303
|
stdout,
|
|
30231
30304
|
stderr,
|
|
30232
30305
|
exitCode: code,
|
|
@@ -31441,9 +31514,9 @@ ${outcome}`;
|
|
|
31441
31514
|
* lost-update races on the nextId counter.
|
|
31442
31515
|
*/
|
|
31443
31516
|
withConfigLock(fn) {
|
|
31444
|
-
let
|
|
31517
|
+
let resolve38;
|
|
31445
31518
|
const next = new Promise((r) => {
|
|
31446
|
-
|
|
31519
|
+
resolve38 = r;
|
|
31447
31520
|
});
|
|
31448
31521
|
const prev = this.configLock;
|
|
31449
31522
|
this.configLock = next;
|
|
@@ -31451,7 +31524,7 @@ ${outcome}`;
|
|
|
31451
31524
|
try {
|
|
31452
31525
|
return await fn();
|
|
31453
31526
|
} finally {
|
|
31454
|
-
|
|
31527
|
+
resolve38();
|
|
31455
31528
|
}
|
|
31456
31529
|
});
|
|
31457
31530
|
}
|
|
@@ -31461,9 +31534,9 @@ ${outcome}`;
|
|
|
31461
31534
|
*/
|
|
31462
31535
|
withTaskLock(id, fn) {
|
|
31463
31536
|
const prev = this.taskLocks.get(id) ?? Promise.resolve();
|
|
31464
|
-
let
|
|
31537
|
+
let resolve38;
|
|
31465
31538
|
const next = new Promise((r) => {
|
|
31466
|
-
|
|
31539
|
+
resolve38 = r;
|
|
31467
31540
|
});
|
|
31468
31541
|
this.taskLocks.set(id, next);
|
|
31469
31542
|
return prev.then(async () => {
|
|
@@ -31473,7 +31546,7 @@ ${outcome}`;
|
|
|
31473
31546
|
if (this.taskLocks.get(id) === next) {
|
|
31474
31547
|
this.taskLocks.delete(id);
|
|
31475
31548
|
}
|
|
31476
|
-
|
|
31549
|
+
resolve38();
|
|
31477
31550
|
}
|
|
31478
31551
|
});
|
|
31479
31552
|
}
|
|
@@ -32739,6 +32812,16 @@ ${newTask.description}
|
|
|
32739
32812
|
} else if (updates.sessionFile !== void 0) {
|
|
32740
32813
|
task.sessionFile = updates.sessionFile;
|
|
32741
32814
|
}
|
|
32815
|
+
if (updates.executionStartedAt === null) {
|
|
32816
|
+
task.executionStartedAt = void 0;
|
|
32817
|
+
} else if (updates.executionStartedAt !== void 0) {
|
|
32818
|
+
task.executionStartedAt = updates.executionStartedAt;
|
|
32819
|
+
}
|
|
32820
|
+
if (updates.executionCompletedAt === null) {
|
|
32821
|
+
task.executionCompletedAt = void 0;
|
|
32822
|
+
} else if (updates.executionCompletedAt !== void 0) {
|
|
32823
|
+
task.executionCompletedAt = updates.executionCompletedAt;
|
|
32824
|
+
}
|
|
32742
32825
|
if (updates.workflowStepResults === null) {
|
|
32743
32826
|
task.workflowStepResults = void 0;
|
|
32744
32827
|
} else if (updates.workflowStepResults !== void 0) {
|
|
@@ -33715,7 +33798,7 @@ ${task.description}
|
|
|
33715
33798
|
}
|
|
33716
33799
|
}
|
|
33717
33800
|
}
|
|
33718
|
-
await new Promise((
|
|
33801
|
+
await new Promise((resolve38) => setImmediate(resolve38));
|
|
33719
33802
|
const selectClause = this.getTaskSelectClause(true);
|
|
33720
33803
|
const changedRows = this.lastPollTime ? this.db.prepare(`SELECT ${selectClause} FROM tasks WHERE updatedAt > ? OR columnMovedAt > ?`).all(this.lastPollTime, this.lastPollTime) : this.db.prepare(`SELECT ${selectClause} FROM tasks`).all();
|
|
33721
33804
|
this.lastPollTime = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -33735,7 +33818,7 @@ ${task.description}
|
|
|
33735
33818
|
this.emit("task:updated", task);
|
|
33736
33819
|
}
|
|
33737
33820
|
if (i > 0 && i % 50 === 0) {
|
|
33738
|
-
await new Promise((
|
|
33821
|
+
await new Promise((resolve38) => setImmediate(resolve38));
|
|
33739
33822
|
}
|
|
33740
33823
|
}
|
|
33741
33824
|
const elapsed = Date.now() - startTime;
|
|
@@ -35591,7 +35674,7 @@ function runGh(args, cwd) {
|
|
|
35591
35674
|
}
|
|
35592
35675
|
function runGhAsync(args, cwdOrOptions) {
|
|
35593
35676
|
const { cwd, signal: externalSignal, timeoutMs = DEFAULT_GH_TIMEOUT_MS } = normalizeRunGhOptions(cwdOrOptions);
|
|
35594
|
-
return new Promise((
|
|
35677
|
+
return new Promise((resolve38, reject2) => {
|
|
35595
35678
|
if (externalSignal?.aborted) {
|
|
35596
35679
|
reject2(makeGhError(`gh command aborted: ${describeAbortReason(externalSignal.reason)}`, "ABORT_ERR"));
|
|
35597
35680
|
return;
|
|
@@ -35642,7 +35725,7 @@ function runGhAsync(args, cwdOrOptions) {
|
|
|
35642
35725
|
ghError.stderr = stderr ?? "";
|
|
35643
35726
|
reject2(ghError);
|
|
35644
35727
|
} else {
|
|
35645
|
-
|
|
35728
|
+
resolve38(stdout ?? "");
|
|
35646
35729
|
}
|
|
35647
35730
|
}
|
|
35648
35731
|
);
|
|
@@ -35930,9 +36013,9 @@ var init_routine_store = __esm({
|
|
|
35930
36013
|
*/
|
|
35931
36014
|
withRoutineLock(id, fn) {
|
|
35932
36015
|
const prev = this.routineLocks.get(id) ?? Promise.resolve();
|
|
35933
|
-
let
|
|
36016
|
+
let resolve38;
|
|
35934
36017
|
const next = new Promise((r) => {
|
|
35935
|
-
|
|
36018
|
+
resolve38 = r;
|
|
35936
36019
|
});
|
|
35937
36020
|
this.routineLocks.set(id, next);
|
|
35938
36021
|
return prev.then(async () => {
|
|
@@ -35942,7 +36025,7 @@ var init_routine_store = __esm({
|
|
|
35942
36025
|
if (this.routineLocks.get(id) === next) {
|
|
35943
36026
|
this.routineLocks.delete(id);
|
|
35944
36027
|
}
|
|
35945
|
-
|
|
36028
|
+
resolve38();
|
|
35946
36029
|
}
|
|
35947
36030
|
});
|
|
35948
36031
|
}
|
|
@@ -36275,7 +36358,7 @@ var init_dispatcher = __esm({
|
|
|
36275
36358
|
});
|
|
36276
36359
|
|
|
36277
36360
|
// ../core/src/plugin-loader.ts
|
|
36278
|
-
import { basename as basename6, dirname as
|
|
36361
|
+
import { basename as basename6, dirname as dirname6, extname, isAbsolute as isAbsolute6, resolve as resolve8 } from "node:path";
|
|
36279
36362
|
import { copyFile, rm } from "node:fs/promises";
|
|
36280
36363
|
import { pathToFileURL } from "node:url";
|
|
36281
36364
|
import { EventEmitter as EventEmitter15 } from "node:events";
|
|
@@ -36432,7 +36515,7 @@ var init_plugin_loader = __esm({
|
|
|
36432
36515
|
moduleImportVersion += 1;
|
|
36433
36516
|
const ext = extname(path5);
|
|
36434
36517
|
const baseName = basename6(path5, ext);
|
|
36435
|
-
const reloadedPath = resolve8(
|
|
36518
|
+
const reloadedPath = resolve8(dirname6(path5), `.${baseName}.reload-${moduleImportVersion}${ext}`);
|
|
36436
36519
|
await copyFile(path5, reloadedPath);
|
|
36437
36520
|
try {
|
|
36438
36521
|
mod = await import(pathToFileURL(reloadedPath).href);
|
|
@@ -36541,13 +36624,13 @@ var init_plugin_loader = __esm({
|
|
|
36541
36624
|
* Execute a promise with a timeout.
|
|
36542
36625
|
*/
|
|
36543
36626
|
withTimeout(promise, ms, timeoutMessage) {
|
|
36544
|
-
return new Promise((
|
|
36627
|
+
return new Promise((resolve38, reject2) => {
|
|
36545
36628
|
const timer = setTimeout(() => {
|
|
36546
36629
|
reject2(new Error(timeoutMessage));
|
|
36547
36630
|
}, ms);
|
|
36548
36631
|
promise.then((result) => {
|
|
36549
36632
|
clearTimeout(timer);
|
|
36550
|
-
|
|
36633
|
+
resolve38(result);
|
|
36551
36634
|
}).catch((err) => {
|
|
36552
36635
|
clearTimeout(timer);
|
|
36553
36636
|
reject2(err);
|
|
@@ -38057,7 +38140,7 @@ var init_mission_types = __esm({
|
|
|
38057
38140
|
// ../core/src/memory-insights.ts
|
|
38058
38141
|
import { readFile as readFile10, writeFile as writeFile8, mkdir as mkdir9 } from "node:fs/promises";
|
|
38059
38142
|
import { existsSync as existsSync16 } from "node:fs";
|
|
38060
|
-
import { dirname as
|
|
38143
|
+
import { dirname as dirname7, join as join19 } from "node:path";
|
|
38061
38144
|
async function readWorkingMemory(rootDir) {
|
|
38062
38145
|
const filePath = join19(rootDir, MEMORY_WORKING_PATH);
|
|
38063
38146
|
if (!existsSync16(filePath)) {
|
|
@@ -38082,7 +38165,7 @@ async function writeInsightsMemory(rootDir, content) {
|
|
|
38082
38165
|
}
|
|
38083
38166
|
async function writeWorkingMemory(rootDir, content) {
|
|
38084
38167
|
const filePath = join19(rootDir, MEMORY_WORKING_PATH);
|
|
38085
|
-
const dir2 =
|
|
38168
|
+
const dir2 = dirname7(filePath);
|
|
38086
38169
|
if (!existsSync16(dir2)) {
|
|
38087
38170
|
await mkdir9(dir2, { recursive: true });
|
|
38088
38171
|
}
|
|
@@ -40072,7 +40155,7 @@ var require_get_stream = __commonJS({
|
|
|
40072
40155
|
};
|
|
40073
40156
|
const { maxBuffer } = options;
|
|
40074
40157
|
let stream;
|
|
40075
|
-
await new Promise((
|
|
40158
|
+
await new Promise((resolve38, reject2) => {
|
|
40076
40159
|
const rejectPromise = (error) => {
|
|
40077
40160
|
if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
|
|
40078
40161
|
error.bufferedData = stream.getBufferedValue();
|
|
@@ -40084,7 +40167,7 @@ var require_get_stream = __commonJS({
|
|
|
40084
40167
|
rejectPromise(error);
|
|
40085
40168
|
return;
|
|
40086
40169
|
}
|
|
40087
|
-
|
|
40170
|
+
resolve38();
|
|
40088
40171
|
});
|
|
40089
40172
|
stream.on("data", () => {
|
|
40090
40173
|
if (stream.getBufferedLength() > maxBuffer) {
|
|
@@ -41378,7 +41461,7 @@ var require_extract_zip = __commonJS({
|
|
|
41378
41461
|
debug("opening", this.zipPath, "with opts", this.opts);
|
|
41379
41462
|
this.zipfile = await openZip(this.zipPath, { lazyEntries: true });
|
|
41380
41463
|
this.canceled = false;
|
|
41381
|
-
return new Promise((
|
|
41464
|
+
return new Promise((resolve38, reject2) => {
|
|
41382
41465
|
this.zipfile.on("error", (err) => {
|
|
41383
41466
|
this.canceled = true;
|
|
41384
41467
|
reject2(err);
|
|
@@ -41387,7 +41470,7 @@ var require_extract_zip = __commonJS({
|
|
|
41387
41470
|
this.zipfile.on("close", () => {
|
|
41388
41471
|
if (!this.canceled) {
|
|
41389
41472
|
debug("zip extraction complete");
|
|
41390
|
-
|
|
41473
|
+
resolve38();
|
|
41391
41474
|
}
|
|
41392
41475
|
});
|
|
41393
41476
|
this.zipfile.on("entry", async (entry) => {
|
|
@@ -50101,6 +50184,7 @@ __export(src_exports, {
|
|
|
50101
50184
|
getCurrentRepo: () => getCurrentRepo,
|
|
50102
50185
|
getDefaultDailyMemoryScaffold: () => getDefaultDailyMemoryScaffold,
|
|
50103
50186
|
getDefaultDreamsScaffold: () => getDefaultDreamsScaffold,
|
|
50187
|
+
getDefaultHeartbeatProcedurePath: () => getDefaultHeartbeatProcedurePath,
|
|
50104
50188
|
getDefaultInsightsTemplate: () => getDefaultInsightsTemplate,
|
|
50105
50189
|
getDefaultLongTermMemoryScaffold: () => getDefaultLongTermMemoryScaffold,
|
|
50106
50190
|
getDefaultMemoryScaffold: () => getDefaultMemoryScaffold,
|
|
@@ -52179,12 +52263,12 @@ var init_concurrency = __esm({
|
|
|
52179
52263
|
this._active++;
|
|
52180
52264
|
return Promise.resolve();
|
|
52181
52265
|
}
|
|
52182
|
-
return new Promise((
|
|
52266
|
+
return new Promise((resolve38) => {
|
|
52183
52267
|
this._waiters.push({
|
|
52184
52268
|
priority,
|
|
52185
52269
|
resolve: () => {
|
|
52186
52270
|
this._active++;
|
|
52187
|
-
|
|
52271
|
+
resolve38();
|
|
52188
52272
|
}
|
|
52189
52273
|
});
|
|
52190
52274
|
});
|
|
@@ -52646,7 +52730,7 @@ import { existsSync as existsSync21, readFileSync as readFileSync8 } from "node:
|
|
|
52646
52730
|
import { exec } from "node:child_process";
|
|
52647
52731
|
import { promisify as promisify2 } from "node:util";
|
|
52648
52732
|
import { createRequire as createRequire2 } from "node:module";
|
|
52649
|
-
import { basename as basename7, dirname as
|
|
52733
|
+
import { basename as basename7, dirname as dirname8, join as join26, relative as relative3, isAbsolute as isAbsolute7, resolve as resolve11 } from "node:path";
|
|
52650
52734
|
import {
|
|
52651
52735
|
createAgentSession,
|
|
52652
52736
|
createBashTool,
|
|
@@ -53041,7 +53125,7 @@ function siblingAgentDir(agentDir, siblingRoot) {
|
|
|
53041
53125
|
if (basename7(agentDir) !== "agent") {
|
|
53042
53126
|
return void 0;
|
|
53043
53127
|
}
|
|
53044
|
-
return join26(
|
|
53128
|
+
return join26(dirname8(dirname8(agentDir)), siblingRoot, "agent");
|
|
53045
53129
|
}
|
|
53046
53130
|
function createReadOnlyPiSettingsView(cwd, agentDir) {
|
|
53047
53131
|
const projectRoot = resolvePiExtensionProjectRoot(cwd);
|
|
@@ -53081,7 +53165,7 @@ function resolveVendoredClaudeCliEntry() {
|
|
|
53081
53165
|
if (!Array.isArray(extensions) || extensions.length === 0) return null;
|
|
53082
53166
|
const entry = extensions[0];
|
|
53083
53167
|
if (typeof entry !== "string" || entry.length === 0) return null;
|
|
53084
|
-
const path5 = resolve11(
|
|
53168
|
+
const path5 = resolve11(dirname8(pkgJsonPath), entry);
|
|
53085
53169
|
return existsSync21(path5) ? path5 : null;
|
|
53086
53170
|
} catch {
|
|
53087
53171
|
return null;
|
|
@@ -53936,9 +54020,9 @@ var init_usage_limit_detector = __esm({
|
|
|
53936
54020
|
});
|
|
53937
54021
|
|
|
53938
54022
|
// ../engine/src/agent-instructions.ts
|
|
53939
|
-
import { readFile as readFile12, writeFile as writeFile11, mkdir as mkdir12, access as
|
|
53940
|
-
import { constants as
|
|
53941
|
-
import { isAbsolute as isAbsolute8, resolve as resolve12, relative as relative4, normalize as normalize3, sep as sep5, dirname as
|
|
54023
|
+
import { readFile as readFile12, writeFile as writeFile11, mkdir as mkdir12, access as access4 } from "node:fs/promises";
|
|
54024
|
+
import { constants as fsConstants2 } from "node:fs";
|
|
54025
|
+
import { isAbsolute as isAbsolute8, resolve as resolve12, relative as relative4, normalize as normalize3, sep as sep5, dirname as dirname9 } from "node:path";
|
|
53942
54026
|
function trimAndClamp(value, maxLength, label, agentId) {
|
|
53943
54027
|
const trimmed = value.trim();
|
|
53944
54028
|
if (!trimmed) {
|
|
@@ -54022,12 +54106,12 @@ async function ensureDefaultHeartbeatProcedureFile(rootDir, procedurePathRel, de
|
|
|
54022
54106
|
return null;
|
|
54023
54107
|
}
|
|
54024
54108
|
try {
|
|
54025
|
-
await
|
|
54109
|
+
await access4(filePath, fsConstants2.F_OK);
|
|
54026
54110
|
return filePath;
|
|
54027
54111
|
} catch {
|
|
54028
54112
|
}
|
|
54029
54113
|
try {
|
|
54030
|
-
await mkdir12(
|
|
54114
|
+
await mkdir12(dirname9(filePath), { recursive: true });
|
|
54031
54115
|
await writeFile11(filePath, defaultContent, "utf-8");
|
|
54032
54116
|
log4.log(`Seeded default heartbeat procedure file at ${filePath}`);
|
|
54033
54117
|
return filePath;
|
|
@@ -54806,20 +54890,20 @@ async function withRateLimitRetry(fn, options = {}) {
|
|
|
54806
54890
|
throw lastError ?? new Error("withRateLimitRetry: unexpected state");
|
|
54807
54891
|
}
|
|
54808
54892
|
function sleep(ms, signal) {
|
|
54809
|
-
return new Promise((
|
|
54893
|
+
return new Promise((resolve38, reject2) => {
|
|
54810
54894
|
if (signal?.aborted) {
|
|
54811
54895
|
reject2(signal.reason ?? new Error("Aborted"));
|
|
54812
54896
|
return;
|
|
54813
54897
|
}
|
|
54814
|
-
const timer = setTimeout(
|
|
54898
|
+
const timer = setTimeout(resolve38, ms);
|
|
54815
54899
|
if (signal) {
|
|
54816
54900
|
const onAbort = () => {
|
|
54817
54901
|
clearTimeout(timer);
|
|
54818
54902
|
reject2(signal.reason ?? new Error("Aborted"));
|
|
54819
54903
|
};
|
|
54820
54904
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
54821
|
-
const origResolve =
|
|
54822
|
-
|
|
54905
|
+
const origResolve = resolve38;
|
|
54906
|
+
resolve38 = () => {
|
|
54823
54907
|
signal.removeEventListener("abort", onAbort);
|
|
54824
54908
|
origResolve();
|
|
54825
54909
|
};
|
|
@@ -56812,7 +56896,7 @@ import { existsSync as existsSync22 } from "node:fs";
|
|
|
56812
56896
|
import { join as join28 } from "node:path";
|
|
56813
56897
|
import { Type as Type3 } from "typebox";
|
|
56814
56898
|
async function execWithProcessGroup(command, options) {
|
|
56815
|
-
return new Promise((
|
|
56899
|
+
return new Promise((resolve38, reject2) => {
|
|
56816
56900
|
if (options.signal?.aborted) {
|
|
56817
56901
|
reject2(Object.assign(
|
|
56818
56902
|
new Error(`Command aborted before start: ${command}`),
|
|
@@ -56905,7 +56989,7 @@ async function execWithProcessGroup(command, options) {
|
|
|
56905
56989
|
return;
|
|
56906
56990
|
}
|
|
56907
56991
|
if (code === 0) {
|
|
56908
|
-
|
|
56992
|
+
resolve38({ stdout, stderr, bufferOverflow: stdoutOverflow || stderrOverflow });
|
|
56909
56993
|
return;
|
|
56910
56994
|
}
|
|
56911
56995
|
reject2(Object.assign(
|
|
@@ -61295,7 +61379,7 @@ function resolveExecutorModelPair(taskModelProvider, taskModelId, settings) {
|
|
|
61295
61379
|
return { provider: void 0, modelId: void 0 };
|
|
61296
61380
|
}
|
|
61297
61381
|
function sleep2(ms) {
|
|
61298
|
-
return new Promise((
|
|
61382
|
+
return new Promise((resolve38) => setTimeout(resolve38, ms));
|
|
61299
61383
|
}
|
|
61300
61384
|
var execAsync4, stepExecLog, MAX_STEP_RETRIES, RETRY_DELAYS_MS, NOOP_TASK_STORE, StepSessionExecutor;
|
|
61301
61385
|
var init_step_session_executor = __esm({
|
|
@@ -62906,8 +62990,12 @@ Lint, tests, and typecheck are also hard quality gates:
|
|
|
62906
62990
|
throw new Error("task missing during workflow rerun bounce");
|
|
62907
62991
|
}
|
|
62908
62992
|
if (latestTask.column === "in-progress") {
|
|
62993
|
+
const originalExecutionStartedAt = latestTask.executionStartedAt;
|
|
62909
62994
|
await this.store.moveTask(taskId, "todo");
|
|
62910
|
-
await this.store.updateTask(taskId, {
|
|
62995
|
+
await this.store.updateTask(taskId, {
|
|
62996
|
+
worktree: worktreePath,
|
|
62997
|
+
executionStartedAt: originalExecutionStartedAt ?? null
|
|
62998
|
+
});
|
|
62911
62999
|
await this.store.moveTask(taskId, "in-progress");
|
|
62912
63000
|
return "bounced";
|
|
62913
63001
|
}
|
|
@@ -65516,7 +65604,7 @@ Review the work done in this worktree and evaluate it against the criteria in yo
|
|
|
65516
65604
|
);
|
|
65517
65605
|
}
|
|
65518
65606
|
const delay2 = this.WORKTREE_RETRY_DELAYS[attempt] || 1e3;
|
|
65519
|
-
await new Promise((
|
|
65607
|
+
await new Promise((resolve38) => setTimeout(resolve38, delay2));
|
|
65520
65608
|
}
|
|
65521
65609
|
}
|
|
65522
65610
|
throw new Error("Unexpected exit from worktree creation retry loop");
|
|
@@ -69254,7 +69342,7 @@ function isTickableState(state) {
|
|
|
69254
69342
|
function isHeartbeatManaged(agent) {
|
|
69255
69343
|
return !isEphemeralAgent(agent);
|
|
69256
69344
|
}
|
|
69257
|
-
var HEARTBEAT_SYSTEM_PROMPT, HEARTBEAT_NO_TASK_SYSTEM_PROMPT, HEARTBEAT_PROCEDURE, heartbeatDoneParams, HeartbeatMonitor, HeartbeatTriggerScheduler;
|
|
69345
|
+
var HEARTBEAT_SYSTEM_PROMPT, HEARTBEAT_NO_TASK_SYSTEM_PROMPT, HEARTBEAT_PROCEDURE, heartbeatDoneParams, HeartbeatMonitor, OVERDUE_FIRE_JITTER_MS, HeartbeatTriggerScheduler;
|
|
69258
69346
|
var init_agent_heartbeat = __esm({
|
|
69259
69347
|
"../engine/src/agent-heartbeat.ts"() {
|
|
69260
69348
|
"use strict";
|
|
@@ -70677,6 +70765,7 @@ ${taskDetail.prompt}` : "No PROMPT.md available.",
|
|
|
70677
70765
|
this.onTerminated?.(tracked.agentId);
|
|
70678
70766
|
}
|
|
70679
70767
|
};
|
|
70768
|
+
OVERDUE_FIRE_JITTER_MS = 5e3;
|
|
70680
70769
|
HeartbeatTriggerScheduler = class _HeartbeatTriggerScheduler {
|
|
70681
70770
|
store;
|
|
70682
70771
|
callback;
|
|
@@ -70714,7 +70803,11 @@ ${taskDetail.prompt}` : "No PROMPT.md available.",
|
|
|
70714
70803
|
this.unwatchAssignments();
|
|
70715
70804
|
this.unwatchAgentLifecycle();
|
|
70716
70805
|
for (const [agentId, timer] of this.timers) {
|
|
70717
|
-
|
|
70806
|
+
if (timer.kind === "timeout") {
|
|
70807
|
+
clearTimeout(timer.handle);
|
|
70808
|
+
} else {
|
|
70809
|
+
clearInterval(timer.handle);
|
|
70810
|
+
}
|
|
70718
70811
|
heartbeatLog.log(`Cleared timer for ${agentId}`);
|
|
70719
70812
|
}
|
|
70720
70813
|
this.timers.clear();
|
|
@@ -70730,10 +70823,19 @@ ${taskDetail.prompt}` : "No PROMPT.md available.",
|
|
|
70730
70823
|
static DEFAULT_HEARTBEAT_INTERVAL_MS = 36e5;
|
|
70731
70824
|
/**
|
|
70732
70825
|
* Register an agent for timer-based heartbeat triggers.
|
|
70826
|
+
*
|
|
70827
|
+
* The first fire is phase-aligned to `options.lastHeartbeatAt + intervalMs`
|
|
70828
|
+
* when supplied. This means a process restart resumes each agent's
|
|
70829
|
+
* existing schedule rather than waiting up to a full interval before the
|
|
70830
|
+
* first tick — the previous behavior caused agents on long intervals
|
|
70831
|
+
* (e.g. 1h) to appear "overdue" in the UI for nearly a full interval after
|
|
70832
|
+
* every dashboard restart even though nothing was actually wrong with them.
|
|
70833
|
+
*
|
|
70733
70834
|
* @param agentId - The agent ID
|
|
70734
70835
|
* @param config - Per-agent heartbeat config
|
|
70836
|
+
* @param options - Optional registration context (e.g., lastHeartbeatAt)
|
|
70735
70837
|
*/
|
|
70736
|
-
registerAgent(agentId, config) {
|
|
70838
|
+
registerAgent(agentId, config, options) {
|
|
70737
70839
|
if (config.enabled === false) {
|
|
70738
70840
|
this.unregisterAgent(agentId);
|
|
70739
70841
|
return;
|
|
@@ -70747,12 +70849,13 @@ ${taskDetail.prompt}` : "No PROMPT.md available.",
|
|
|
70747
70849
|
const intervalMs = Math.max(1e3, Math.round(rawIntervalMs));
|
|
70748
70850
|
const registrationEpoch = (this.registrationEpochs.get(agentId) ?? 0) + 1;
|
|
70749
70851
|
this.registrationEpochs.set(agentId, registrationEpoch);
|
|
70750
|
-
|
|
70852
|
+
const lastHeartbeatAt = options?.lastHeartbeatAt ?? null;
|
|
70853
|
+
this.applyTimerRegistration(agentId, intervalMs, 1, usingDefaultInterval, lastHeartbeatAt);
|
|
70751
70854
|
if (this.taskStore && typeof this.taskStore.getSettings === "function") {
|
|
70752
|
-
void this.applyProjectMultiplierRegistration(agentId, intervalMs, usingDefaultInterval, registrationEpoch);
|
|
70855
|
+
void this.applyProjectMultiplierRegistration(agentId, intervalMs, usingDefaultInterval, registrationEpoch, lastHeartbeatAt);
|
|
70753
70856
|
}
|
|
70754
70857
|
}
|
|
70755
|
-
async applyProjectMultiplierRegistration(agentId, baseIntervalMs, usingDefaultInterval, expectedEpoch) {
|
|
70858
|
+
async applyProjectMultiplierRegistration(agentId, baseIntervalMs, usingDefaultInterval, expectedEpoch, lastHeartbeatAt) {
|
|
70756
70859
|
let multiplier = 1;
|
|
70757
70860
|
try {
|
|
70758
70861
|
const settings = await getHeartbeatMemorySettings(this.taskStore);
|
|
@@ -70766,23 +70869,68 @@ ${taskDetail.prompt}` : "No PROMPT.md available.",
|
|
|
70766
70869
|
if (this.registrationEpochs.get(agentId) !== expectedEpoch) {
|
|
70767
70870
|
return;
|
|
70768
70871
|
}
|
|
70769
|
-
this.applyTimerRegistration(agentId, baseIntervalMs, multiplier, usingDefaultInterval);
|
|
70872
|
+
this.applyTimerRegistration(agentId, baseIntervalMs, multiplier, usingDefaultInterval, lastHeartbeatAt);
|
|
70770
70873
|
}
|
|
70771
|
-
|
|
70874
|
+
/**
|
|
70875
|
+
* Compute the delay until the agent's next scheduled fire, given when it
|
|
70876
|
+
* last heartbeat. When `lastHeartbeatAt` is missing or unparseable, falls
|
|
70877
|
+
* back to a full-interval delay (matching the original behavior for
|
|
70878
|
+
* agents that have never ticked). When the next fire is already overdue,
|
|
70879
|
+
* returns a small randomized jitter to spread thundering herds at boot.
|
|
70880
|
+
*/
|
|
70881
|
+
static computeInitialDelayMs(intervalMs, lastHeartbeatAt, now = Date.now()) {
|
|
70882
|
+
if (!lastHeartbeatAt) {
|
|
70883
|
+
return intervalMs;
|
|
70884
|
+
}
|
|
70885
|
+
const lastMs = Date.parse(lastHeartbeatAt);
|
|
70886
|
+
if (!Number.isFinite(lastMs)) {
|
|
70887
|
+
return intervalMs;
|
|
70888
|
+
}
|
|
70889
|
+
const remaining = lastMs + intervalMs - now;
|
|
70890
|
+
if (remaining <= 0) {
|
|
70891
|
+
return Math.floor(Math.random() * OVERDUE_FIRE_JITTER_MS);
|
|
70892
|
+
}
|
|
70893
|
+
return Math.min(remaining, intervalMs);
|
|
70894
|
+
}
|
|
70895
|
+
applyTimerRegistration(agentId, baseIntervalMs, multiplier, usingDefaultInterval, lastHeartbeatAt) {
|
|
70772
70896
|
const effectiveIntervalMs = Math.max(1e3, Math.round(baseIntervalMs * multiplier));
|
|
70897
|
+
const initialDelayMs = _HeartbeatTriggerScheduler.computeInitialDelayMs(
|
|
70898
|
+
effectiveIntervalMs,
|
|
70899
|
+
lastHeartbeatAt
|
|
70900
|
+
);
|
|
70773
70901
|
this.clearAgentTimer(agentId);
|
|
70774
|
-
const
|
|
70775
|
-
|
|
70776
|
-
|
|
70777
|
-
|
|
70902
|
+
const armSteadyInterval = () => {
|
|
70903
|
+
const intervalHandle = setInterval(() => {
|
|
70904
|
+
void this.onTimerTick(agentId, effectiveIntervalMs);
|
|
70905
|
+
}, effectiveIntervalMs);
|
|
70906
|
+
this.timers.set(agentId, {
|
|
70907
|
+
intervalMs: effectiveIntervalMs,
|
|
70908
|
+
kind: "interval",
|
|
70909
|
+
handle: intervalHandle
|
|
70910
|
+
});
|
|
70911
|
+
};
|
|
70912
|
+
if (initialDelayMs >= effectiveIntervalMs) {
|
|
70913
|
+
armSteadyInterval();
|
|
70914
|
+
} else {
|
|
70915
|
+
const timeoutHandle = setTimeout(() => {
|
|
70916
|
+
void this.onTimerTick(agentId, effectiveIntervalMs);
|
|
70917
|
+
armSteadyInterval();
|
|
70918
|
+
}, initialDelayMs);
|
|
70919
|
+
this.timers.set(agentId, {
|
|
70920
|
+
intervalMs: effectiveIntervalMs,
|
|
70921
|
+
kind: "timeout",
|
|
70922
|
+
handle: timeoutHandle
|
|
70923
|
+
});
|
|
70924
|
+
}
|
|
70925
|
+
const phaseSuffix = lastHeartbeatAt ? `, first fire in ${initialDelayMs}ms (phase-aligned to lastHeartbeatAt)` : "";
|
|
70778
70926
|
if (multiplier !== 1) {
|
|
70779
70927
|
heartbeatLog.log(
|
|
70780
|
-
`Registered timer for ${agentId} (every ${baseIntervalMs}ms, multiplier ${multiplier} \u2192 ${effectiveIntervalMs}ms effective)`
|
|
70928
|
+
`Registered timer for ${agentId} (every ${baseIntervalMs}ms, multiplier ${multiplier} \u2192 ${effectiveIntervalMs}ms effective${phaseSuffix})`
|
|
70781
70929
|
);
|
|
70782
70930
|
return;
|
|
70783
70931
|
}
|
|
70784
70932
|
heartbeatLog.log(
|
|
70785
|
-
usingDefaultInterval ? `Registered timer for ${agentId} (every ${effectiveIntervalMs}ms, default interval)` : `Registered timer for ${agentId} (every ${effectiveIntervalMs}ms)`
|
|
70933
|
+
usingDefaultInterval ? `Registered timer for ${agentId} (every ${effectiveIntervalMs}ms, default interval${phaseSuffix})` : `Registered timer for ${agentId} (every ${effectiveIntervalMs}ms${phaseSuffix})`
|
|
70786
70934
|
);
|
|
70787
70935
|
}
|
|
70788
70936
|
clearAgentTimer(agentId) {
|
|
@@ -70790,7 +70938,11 @@ ${taskDetail.prompt}` : "No PROMPT.md available.",
|
|
|
70790
70938
|
if (!timer) {
|
|
70791
70939
|
return;
|
|
70792
70940
|
}
|
|
70793
|
-
|
|
70941
|
+
if (timer.kind === "timeout") {
|
|
70942
|
+
clearTimeout(timer.handle);
|
|
70943
|
+
} else {
|
|
70944
|
+
clearInterval(timer.handle);
|
|
70945
|
+
}
|
|
70794
70946
|
this.timers.delete(agentId);
|
|
70795
70947
|
}
|
|
70796
70948
|
static resolveHeartbeatMultiplier(rawMultiplier) {
|
|
@@ -70918,7 +71070,9 @@ ${taskDetail.prompt}` : "No PROMPT.md available.",
|
|
|
70918
71070
|
if (this.timers.has(agent.id)) {
|
|
70919
71071
|
return;
|
|
70920
71072
|
}
|
|
70921
|
-
this.registerAgent(agent.id, this.getAgentTimerConfig(agent)
|
|
71073
|
+
this.registerAgent(agent.id, this.getAgentTimerConfig(agent), {
|
|
71074
|
+
lastHeartbeatAt: agent.lastHeartbeatAt
|
|
71075
|
+
});
|
|
70922
71076
|
heartbeatLog.log(`Timer armed for ${agent.id} (${reason})`);
|
|
70923
71077
|
}
|
|
70924
71078
|
async syncTimerForAgentFromStore(agentId, reason) {
|
|
@@ -70931,7 +71085,9 @@ ${taskDetail.prompt}` : "No PROMPT.md available.",
|
|
|
70931
71085
|
this.unregisterAgent(agentId);
|
|
70932
71086
|
return;
|
|
70933
71087
|
}
|
|
70934
|
-
this.registerAgent(agent.id, this.getAgentTimerConfig(agent)
|
|
71088
|
+
this.registerAgent(agent.id, this.getAgentTimerConfig(agent), {
|
|
71089
|
+
lastHeartbeatAt: agent.lastHeartbeatAt
|
|
71090
|
+
});
|
|
70935
71091
|
heartbeatLog.log(`Timer refreshed for ${agent.id} (${reason})`);
|
|
70936
71092
|
}
|
|
70937
71093
|
didHeartbeatScheduleChange(revision) {
|
|
@@ -75343,13 +75499,13 @@ var init_plugin_runner = __esm({
|
|
|
75343
75499
|
* Returns the result on success, throws on timeout.
|
|
75344
75500
|
*/
|
|
75345
75501
|
withTimeout(promise, ms, timeoutMessage) {
|
|
75346
|
-
return new Promise((
|
|
75502
|
+
return new Promise((resolve38, reject2) => {
|
|
75347
75503
|
const timer = setTimeout(() => {
|
|
75348
75504
|
reject2(new Error(timeoutMessage));
|
|
75349
75505
|
}, ms);
|
|
75350
75506
|
promise.then((result) => {
|
|
75351
75507
|
clearTimeout(timer);
|
|
75352
|
-
|
|
75508
|
+
resolve38(result);
|
|
75353
75509
|
}).catch((err) => {
|
|
75354
75510
|
clearTimeout(timer);
|
|
75355
75511
|
reject2(err);
|
|
@@ -75771,11 +75927,15 @@ var init_in_process_runtime = __esm({
|
|
|
75771
75927
|
for (const agent of agents) {
|
|
75772
75928
|
if (!isTimerManagedAgent(agent)) continue;
|
|
75773
75929
|
const rc = agent.runtimeConfig;
|
|
75774
|
-
this.triggerScheduler.registerAgent(
|
|
75775
|
-
|
|
75776
|
-
|
|
75777
|
-
|
|
75778
|
-
|
|
75930
|
+
this.triggerScheduler.registerAgent(
|
|
75931
|
+
agent.id,
|
|
75932
|
+
{
|
|
75933
|
+
enabled: rc?.enabled,
|
|
75934
|
+
heartbeatIntervalMs: rc?.heartbeatIntervalMs,
|
|
75935
|
+
maxConcurrentRuns: rc?.maxConcurrentRuns
|
|
75936
|
+
},
|
|
75937
|
+
{ lastHeartbeatAt: agent.lastHeartbeatAt }
|
|
75938
|
+
);
|
|
75779
75939
|
registeredCount++;
|
|
75780
75940
|
}
|
|
75781
75941
|
if (agents.length > 0) {
|
|
@@ -75981,7 +76141,7 @@ var init_in_process_runtime = __esm({
|
|
|
75981
76141
|
runtimeLog.log(
|
|
75982
76142
|
`Waiting for ${metrics.inFlightTasks} in-flight tasks to complete...`
|
|
75983
76143
|
);
|
|
75984
|
-
await new Promise((
|
|
76144
|
+
await new Promise((resolve38) => setTimeout(resolve38, 1e3));
|
|
75985
76145
|
}
|
|
75986
76146
|
const finalMetrics = this.getMetrics();
|
|
75987
76147
|
if (finalMetrics.inFlightTasks > 0) {
|
|
@@ -76378,13 +76538,13 @@ var init_ipc_host = __esm({
|
|
|
76378
76538
|
}
|
|
76379
76539
|
const id = generateCorrelationId();
|
|
76380
76540
|
const message = { type, id, payload };
|
|
76381
|
-
return new Promise((
|
|
76541
|
+
return new Promise((resolve38, reject2) => {
|
|
76382
76542
|
const timeout2 = setTimeout(() => {
|
|
76383
76543
|
this.pendingCommands.delete(id);
|
|
76384
76544
|
reject2(new Error(`Command ${type} timed out after ${timeoutMs ?? this.commandTimeoutMs}ms`));
|
|
76385
76545
|
}, timeoutMs ?? this.commandTimeoutMs);
|
|
76386
76546
|
this.pendingCommands.set(id, {
|
|
76387
|
-
resolve:
|
|
76547
|
+
resolve: resolve38,
|
|
76388
76548
|
reject: reject2,
|
|
76389
76549
|
timeout: timeout2,
|
|
76390
76550
|
type
|
|
@@ -76462,7 +76622,7 @@ var init_ipc_host = __esm({
|
|
|
76462
76622
|
import { EventEmitter as EventEmitter21 } from "node:events";
|
|
76463
76623
|
import { fork } from "node:child_process";
|
|
76464
76624
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
76465
|
-
import { dirname as
|
|
76625
|
+
import { dirname as dirname10, join as join36 } from "node:path";
|
|
76466
76626
|
var HealthMonitor, ChildProcessRuntime;
|
|
76467
76627
|
var init_child_process_runtime = __esm({
|
|
76468
76628
|
"../engine/src/runtimes/child-process-runtime.ts"() {
|
|
@@ -76622,7 +76782,7 @@ var init_child_process_runtime = __esm({
|
|
|
76622
76782
|
*/
|
|
76623
76783
|
getWorkerPath() {
|
|
76624
76784
|
const isCompiled = !import.meta.url.endsWith(".ts");
|
|
76625
|
-
const currentDir =
|
|
76785
|
+
const currentDir = dirname10(fileURLToPath3(import.meta.url));
|
|
76626
76786
|
const workerFile = isCompiled ? "child-process-worker.js" : "child-process-worker.ts";
|
|
76627
76787
|
return join36(currentDir, workerFile);
|
|
76628
76788
|
}
|
|
@@ -77193,8 +77353,8 @@ var init_remote_node_client = __esm({
|
|
|
77193
77353
|
return error instanceof TypeError;
|
|
77194
77354
|
}
|
|
77195
77355
|
async sleep(ms) {
|
|
77196
|
-
await new Promise((
|
|
77197
|
-
setTimeout(
|
|
77356
|
+
await new Promise((resolve38) => {
|
|
77357
|
+
setTimeout(resolve38, ms);
|
|
77198
77358
|
});
|
|
77199
77359
|
}
|
|
77200
77360
|
};
|
|
@@ -77458,14 +77618,14 @@ var init_remote_node_runtime = __esm({
|
|
|
77458
77618
|
return error instanceof Error ? error : new Error(String(error));
|
|
77459
77619
|
}
|
|
77460
77620
|
async sleep(ms, signal) {
|
|
77461
|
-
await new Promise((
|
|
77621
|
+
await new Promise((resolve38) => {
|
|
77462
77622
|
const timeout2 = setTimeout(() => {
|
|
77463
77623
|
cleanup();
|
|
77464
|
-
|
|
77624
|
+
resolve38();
|
|
77465
77625
|
}, ms);
|
|
77466
77626
|
const onAbort = () => {
|
|
77467
77627
|
cleanup();
|
|
77468
|
-
|
|
77628
|
+
resolve38();
|
|
77469
77629
|
};
|
|
77470
77630
|
const cleanup = () => {
|
|
77471
77631
|
clearTimeout(timeout2);
|
|
@@ -77919,7 +78079,7 @@ var init_gridlock_detector = __esm({
|
|
|
77919
78079
|
});
|
|
77920
78080
|
|
|
77921
78081
|
// ../engine/src/remote-access/provider-adapters.ts
|
|
77922
|
-
import { accessSync, constants as
|
|
78082
|
+
import { accessSync, constants as fsConstants3 } from "node:fs";
|
|
77923
78083
|
function isAbsoluteOrPathLike(input) {
|
|
77924
78084
|
return input.startsWith("/") || input.startsWith("./") || input.startsWith("../");
|
|
77925
78085
|
}
|
|
@@ -78066,7 +78226,7 @@ var init_provider_adapters = __esm({
|
|
|
78066
78226
|
if ("credentialsPath" in config && config.credentialsPath !== void 0) {
|
|
78067
78227
|
assertNonEmpty(config.credentialsPath, "credentialsPath");
|
|
78068
78228
|
if (isAbsoluteOrPathLike(config.credentialsPath)) {
|
|
78069
|
-
accessSync(config.credentialsPath,
|
|
78229
|
+
accessSync(config.credentialsPath, fsConstants3.R_OK);
|
|
78070
78230
|
}
|
|
78071
78231
|
}
|
|
78072
78232
|
},
|
|
@@ -78360,10 +78520,10 @@ var init_tunnel_process_manager = __esm({
|
|
|
78360
78520
|
lastError: null
|
|
78361
78521
|
});
|
|
78362
78522
|
this.emitLog("info", "manager", `Stopping ${currentHandle.provider} tunnel (pid=${currentHandle.child.pid ?? "n/a"})`);
|
|
78363
|
-
this.activeStopPromise = new Promise((
|
|
78523
|
+
this.activeStopPromise = new Promise((resolve38) => {
|
|
78364
78524
|
const onClose = () => {
|
|
78365
78525
|
currentHandle.child.removeListener("close", onClose);
|
|
78366
|
-
|
|
78526
|
+
resolve38();
|
|
78367
78527
|
};
|
|
78368
78528
|
currentHandle.child.once("close", onClose);
|
|
78369
78529
|
killManagedProcess(currentHandle.child, "SIGTERM");
|
|
@@ -78930,12 +79090,12 @@ ${detail}`
|
|
|
78930
79090
|
*/
|
|
78931
79091
|
async onMerge(taskId) {
|
|
78932
79092
|
if (this.mergeActive.has(taskId)) {
|
|
78933
|
-
return new Promise((
|
|
78934
|
-
this.manualMergeResolvers.set(taskId, { resolve:
|
|
79093
|
+
return new Promise((resolve38, reject2) => {
|
|
79094
|
+
this.manualMergeResolvers.set(taskId, { resolve: resolve38, reject: reject2 });
|
|
78935
79095
|
});
|
|
78936
79096
|
}
|
|
78937
|
-
return new Promise((
|
|
78938
|
-
this.manualMergeResolvers.set(taskId, { resolve:
|
|
79097
|
+
return new Promise((resolve38, reject2) => {
|
|
79098
|
+
this.manualMergeResolvers.set(taskId, { resolve: resolve38, reject: reject2 });
|
|
78939
79099
|
this.internalEnqueueMerge(taskId);
|
|
78940
79100
|
});
|
|
78941
79101
|
}
|
|
@@ -84765,11 +84925,11 @@ var init_api_error = __esm({
|
|
|
84765
84925
|
|
|
84766
84926
|
// ../dashboard/src/plugin-routes.ts
|
|
84767
84927
|
import { Router } from "express";
|
|
84768
|
-
import { access as
|
|
84769
|
-
import { join as join37, isAbsolute as isAbsolute13, dirname as
|
|
84928
|
+
import { access as access5, stat as stat6, readFile as readFile17 } from "node:fs/promises";
|
|
84929
|
+
import { join as join37, isAbsolute as isAbsolute13, dirname as dirname11, basename as basename9 } from "node:path";
|
|
84770
84930
|
async function resolvePluginManifest(sourcePath) {
|
|
84771
84931
|
try {
|
|
84772
|
-
await
|
|
84932
|
+
await access5(sourcePath);
|
|
84773
84933
|
} catch {
|
|
84774
84934
|
throw notFound(`Path does not exist: ${sourcePath}`);
|
|
84775
84935
|
}
|
|
@@ -84784,7 +84944,7 @@ async function resolvePluginManifest(sourcePath) {
|
|
|
84784
84944
|
}
|
|
84785
84945
|
const directManifestPath = join37(sourcePath, "manifest.json");
|
|
84786
84946
|
try {
|
|
84787
|
-
await
|
|
84947
|
+
await access5(directManifestPath);
|
|
84788
84948
|
const manifest = await readAndValidateManifest(directManifestPath);
|
|
84789
84949
|
return { manifestDir: sourcePath, manifest };
|
|
84790
84950
|
} catch (err) {
|
|
@@ -84792,10 +84952,10 @@ async function resolvePluginManifest(sourcePath) {
|
|
|
84792
84952
|
}
|
|
84793
84953
|
const dirName = basename9(sourcePath).toLowerCase();
|
|
84794
84954
|
if (DIST_DIR_NAMES.has(dirName)) {
|
|
84795
|
-
const parentDir =
|
|
84955
|
+
const parentDir = dirname11(sourcePath);
|
|
84796
84956
|
const parentManifestPath = join37(parentDir, "manifest.json");
|
|
84797
84957
|
try {
|
|
84798
|
-
await
|
|
84958
|
+
await access5(parentManifestPath);
|
|
84799
84959
|
const manifest = await readAndValidateManifest(parentManifestPath);
|
|
84800
84960
|
return { manifestDir: parentDir, manifest };
|
|
84801
84961
|
} catch (err) {
|
|
@@ -84803,7 +84963,7 @@ async function resolvePluginManifest(sourcePath) {
|
|
|
84803
84963
|
}
|
|
84804
84964
|
}
|
|
84805
84965
|
throw notFound(
|
|
84806
|
-
`Plugin manifest not found. Looked for manifest.json in: ${sourcePath}` + (DIST_DIR_NAMES.has(dirName) ? ` and ${
|
|
84966
|
+
`Plugin manifest not found. Looked for manifest.json in: ${sourcePath}` + (DIST_DIR_NAMES.has(dirName) ? ` and ${dirname11(sourcePath)}` : "")
|
|
84807
84967
|
);
|
|
84808
84968
|
}
|
|
84809
84969
|
async function readAndValidateManifest(manifestPath) {
|
|
@@ -84909,7 +85069,7 @@ function hermesProfileHome(profileName) {
|
|
|
84909
85069
|
async function listHermesProfiles(opts) {
|
|
84910
85070
|
const binary = resolveBinaryForSpawn(opts?.binaryPath ?? "hermes");
|
|
84911
85071
|
const timeoutMs = opts?.timeoutMs ?? 5e3;
|
|
84912
|
-
return new Promise((
|
|
85072
|
+
return new Promise((resolve38, reject2) => {
|
|
84913
85073
|
let settled = false;
|
|
84914
85074
|
const child = spawn4(binary, ["profile", "list"], {
|
|
84915
85075
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -84952,7 +85112,7 @@ async function listHermesProfiles(opts) {
|
|
|
84952
85112
|
${combined}`));
|
|
84953
85113
|
return;
|
|
84954
85114
|
}
|
|
84955
|
-
|
|
85115
|
+
resolve38(parseProfileListOutput(stdout));
|
|
84956
85116
|
});
|
|
84957
85117
|
});
|
|
84958
85118
|
}
|
|
@@ -85029,7 +85189,7 @@ function buildHermesArgs(prompt, settings, resumeSessionId) {
|
|
|
85029
85189
|
async function invokeHermesCli(prompt, settings, resumeSessionId, signal) {
|
|
85030
85190
|
const args = buildHermesArgs(prompt, settings, resumeSessionId);
|
|
85031
85191
|
const binary = resolveBinaryForSpawn(settings.binaryPath);
|
|
85032
|
-
return new Promise((
|
|
85192
|
+
return new Promise((resolve38, reject2) => {
|
|
85033
85193
|
let settled = false;
|
|
85034
85194
|
const spawnEnv = { ...process.env, PYTHONUNBUFFERED: "1" };
|
|
85035
85195
|
if (settings.profile) {
|
|
@@ -85097,7 +85257,7 @@ ${combined}`));
|
|
|
85097
85257
|
return;
|
|
85098
85258
|
}
|
|
85099
85259
|
try {
|
|
85100
|
-
|
|
85260
|
+
resolve38(parseHermesOutput(stdout, stderr));
|
|
85101
85261
|
} catch (parseErr) {
|
|
85102
85262
|
reject2(parseErr);
|
|
85103
85263
|
}
|
|
@@ -85415,7 +85575,7 @@ async function promptCli(session, message, config, callbacks, signal) {
|
|
|
85415
85575
|
const args = buildOpenClawArgs(config, session.sessionId, message);
|
|
85416
85576
|
const cb = { ...session.callbacks, ...callbacks };
|
|
85417
85577
|
cb.onToolStart?.("openclaw.agent", { sessionId: session.sessionId });
|
|
85418
|
-
return new Promise((
|
|
85578
|
+
return new Promise((resolve38, reject2) => {
|
|
85419
85579
|
let settled = false;
|
|
85420
85580
|
const child = spawn6(config.binaryPath, args, {
|
|
85421
85581
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -85508,7 +85668,7 @@ async function promptCli(session, message, config, callbacks, signal) {
|
|
|
85508
85668
|
...metaError ? { error: metaError } : {},
|
|
85509
85669
|
...errorText.length > 0 ? { toolErrors: errorText } : {}
|
|
85510
85670
|
});
|
|
85511
|
-
|
|
85671
|
+
resolve38();
|
|
85512
85672
|
});
|
|
85513
85673
|
});
|
|
85514
85674
|
}
|
|
@@ -93783,10 +93943,10 @@ var require_browser3 = __commonJS({
|
|
|
93783
93943
|
text = canvas;
|
|
93784
93944
|
canvas = void 0;
|
|
93785
93945
|
}
|
|
93786
|
-
return new Promise(function(
|
|
93946
|
+
return new Promise(function(resolve38, reject2) {
|
|
93787
93947
|
try {
|
|
93788
93948
|
const data = QRCode2.create(text, opts);
|
|
93789
|
-
|
|
93949
|
+
resolve38(renderFunc(data, canvas, opts));
|
|
93790
93950
|
} catch (e) {
|
|
93791
93951
|
reject2(e);
|
|
93792
93952
|
}
|
|
@@ -93868,11 +94028,11 @@ var require_server = __commonJS({
|
|
|
93868
94028
|
}
|
|
93869
94029
|
function render(renderFunc, text, params) {
|
|
93870
94030
|
if (!params.cb) {
|
|
93871
|
-
return new Promise(function(
|
|
94031
|
+
return new Promise(function(resolve38, reject2) {
|
|
93872
94032
|
try {
|
|
93873
94033
|
const data = QRCode2.create(text, params.opts);
|
|
93874
94034
|
return renderFunc(data, params.opts, function(err, data2) {
|
|
93875
|
-
return err ? reject2(err) :
|
|
94035
|
+
return err ? reject2(err) : resolve38(data2);
|
|
93876
94036
|
});
|
|
93877
94037
|
} catch (e) {
|
|
93878
94038
|
reject2(e);
|
|
@@ -95401,7 +95561,7 @@ import * as os3 from "os";
|
|
|
95401
95561
|
import * as path2 from "path";
|
|
95402
95562
|
import * as fs from "node:fs";
|
|
95403
95563
|
import { createRequire as createRequire3 } from "node:module";
|
|
95404
|
-
import { join as join40, dirname as
|
|
95564
|
+
import { join as join40, dirname as dirname12 } from "node:path";
|
|
95405
95565
|
function getNativePrebuildName() {
|
|
95406
95566
|
const platform3 = process.platform === "darwin" ? "darwin" : process.platform === "linux" ? "linux" : process.platform === "win32" ? "win32" : "unknown";
|
|
95407
95567
|
const arch = process.arch === "arm64" ? "arm64" : process.arch === "x64" ? "x64" : "unknown";
|
|
@@ -95410,7 +95570,7 @@ function getNativePrebuildName() {
|
|
|
95410
95570
|
function findInstalledNodePtyNativeDir() {
|
|
95411
95571
|
try {
|
|
95412
95572
|
const packageJsonPath = require2.resolve("node-pty/package.json");
|
|
95413
|
-
const pkgRoot =
|
|
95573
|
+
const pkgRoot = dirname12(packageJsonPath);
|
|
95414
95574
|
const releaseDir = join40(pkgRoot, "build", "Release");
|
|
95415
95575
|
if (fs.existsSync(join40(releaseDir, "pty.node"))) {
|
|
95416
95576
|
return releaseDir;
|
|
@@ -95466,7 +95626,7 @@ function findStagedNativeDir() {
|
|
|
95466
95626
|
return envPath;
|
|
95467
95627
|
}
|
|
95468
95628
|
}
|
|
95469
|
-
const execDir =
|
|
95629
|
+
const execDir = dirname12(process.execPath);
|
|
95470
95630
|
const nextToBinary = join40(execDir, "runtime", prebuildName);
|
|
95471
95631
|
if (fs.existsSync(join40(nextToBinary, "pty.node"))) {
|
|
95472
95632
|
return nextToBinary;
|
|
@@ -96466,7 +96626,7 @@ var init_register_messaging_scripts = __esm({
|
|
|
96466
96626
|
|
|
96467
96627
|
// ../dashboard/src/github.ts
|
|
96468
96628
|
function delay(ms) {
|
|
96469
|
-
return new Promise((
|
|
96629
|
+
return new Promise((resolve38) => setTimeout(resolve38, ms));
|
|
96470
96630
|
}
|
|
96471
96631
|
function normalizeCheckState(state) {
|
|
96472
96632
|
switch ((state ?? "").toLowerCase()) {
|
|
@@ -101146,14 +101306,14 @@ var init_terminal = __esm({
|
|
|
101146
101306
|
});
|
|
101147
101307
|
|
|
101148
101308
|
// ../dashboard/src/file-service.ts
|
|
101149
|
-
import { join as join41, resolve as resolve20, relative as relative10, dirname as
|
|
101150
|
-
import { readdir as readdir8, readFile as fsReadFile, writeFile as fsWriteFile, stat as stat7, copyFile as fsCopyFile, rename as fsRename, rm as fsRm, mkdir as mkdir14, access as
|
|
101309
|
+
import { join as join41, resolve as resolve20, relative as relative10, dirname as dirname13, basename as basename12 } from "node:path";
|
|
101310
|
+
import { readdir as readdir8, readFile as fsReadFile, writeFile as fsWriteFile, stat as stat7, copyFile as fsCopyFile, rename as fsRename, rm as fsRm, mkdir as mkdir14, access as access6 } from "node:fs/promises";
|
|
101151
101311
|
async function getTaskBasePath(store, taskId) {
|
|
101152
101312
|
try {
|
|
101153
101313
|
const task = await store.getTask(taskId);
|
|
101154
101314
|
if (task.worktree) {
|
|
101155
101315
|
try {
|
|
101156
|
-
await
|
|
101316
|
+
await access6(task.worktree);
|
|
101157
101317
|
return resolve20(task.worktree);
|
|
101158
101318
|
} catch {
|
|
101159
101319
|
}
|
|
@@ -101305,7 +101465,7 @@ async function writeFileForBasePath(basePath, filePath, content) {
|
|
|
101305
101465
|
throw err;
|
|
101306
101466
|
}
|
|
101307
101467
|
}
|
|
101308
|
-
const parentDir =
|
|
101468
|
+
const parentDir = dirname13(resolvedPath);
|
|
101309
101469
|
try {
|
|
101310
101470
|
const parentStats = await stat7(parentDir);
|
|
101311
101471
|
if (!parentStats.isDirectory()) {
|
|
@@ -101398,7 +101558,7 @@ async function copyWorkspaceFile(store, workspace, sourcePath, destinationPath)
|
|
|
101398
101558
|
if (err instanceof FileServiceError) throw err;
|
|
101399
101559
|
}
|
|
101400
101560
|
}
|
|
101401
|
-
const destParent =
|
|
101561
|
+
const destParent = dirname13(resolvedDest);
|
|
101402
101562
|
try {
|
|
101403
101563
|
const parentStats = await stat7(destParent);
|
|
101404
101564
|
if (!parentStats.isDirectory()) {
|
|
@@ -101453,7 +101613,7 @@ async function moveWorkspaceFile(store, workspace, sourcePath, destinationPath)
|
|
|
101453
101613
|
if (err instanceof FileServiceError) throw err;
|
|
101454
101614
|
}
|
|
101455
101615
|
}
|
|
101456
|
-
const destParent =
|
|
101616
|
+
const destParent = dirname13(resolvedDest);
|
|
101457
101617
|
try {
|
|
101458
101618
|
const parentStats = await stat7(destParent);
|
|
101459
101619
|
if (!parentStats.isDirectory()) {
|
|
@@ -101542,7 +101702,7 @@ async function renameWorkspaceFile(store, workspace, filePath, newName) {
|
|
|
101542
101702
|
}
|
|
101543
101703
|
throw err;
|
|
101544
101704
|
}
|
|
101545
|
-
const destPath = join41(
|
|
101705
|
+
const destPath = join41(dirname13(resolvedPath), newName);
|
|
101546
101706
|
const destRelative = relative10(resolve20(workspaceBase), destPath);
|
|
101547
101707
|
if (destRelative.startsWith("..") || destRelative.startsWith("../") || destRelative === "..") {
|
|
101548
101708
|
throw new FileServiceError("Destination would be outside workspace", "EINVAL");
|
|
@@ -102740,9 +102900,9 @@ var require_readdir_glob = __commonJS({
|
|
|
102740
102900
|
var fs2 = __require("fs");
|
|
102741
102901
|
var { EventEmitter: EventEmitter36 } = __require("events");
|
|
102742
102902
|
var { Minimatch } = require_minimatch();
|
|
102743
|
-
var { resolve:
|
|
102903
|
+
var { resolve: resolve38 } = __require("path");
|
|
102744
102904
|
function readdir12(dir2, strict) {
|
|
102745
|
-
return new Promise((
|
|
102905
|
+
return new Promise((resolve39, reject2) => {
|
|
102746
102906
|
fs2.readdir(dir2, { withFileTypes: true }, (err, files) => {
|
|
102747
102907
|
if (err) {
|
|
102748
102908
|
switch (err.code) {
|
|
@@ -102750,7 +102910,7 @@ var require_readdir_glob = __commonJS({
|
|
|
102750
102910
|
if (strict) {
|
|
102751
102911
|
reject2(err);
|
|
102752
102912
|
} else {
|
|
102753
|
-
|
|
102913
|
+
resolve39([]);
|
|
102754
102914
|
}
|
|
102755
102915
|
break;
|
|
102756
102916
|
case "ENOTSUP":
|
|
@@ -102760,7 +102920,7 @@ var require_readdir_glob = __commonJS({
|
|
|
102760
102920
|
case "ENAMETOOLONG":
|
|
102761
102921
|
// Filename too long
|
|
102762
102922
|
case "UNKNOWN":
|
|
102763
|
-
|
|
102923
|
+
resolve39([]);
|
|
102764
102924
|
break;
|
|
102765
102925
|
case "ELOOP":
|
|
102766
102926
|
// Too many levels of symbolic links
|
|
@@ -102769,30 +102929,30 @@ var require_readdir_glob = __commonJS({
|
|
|
102769
102929
|
break;
|
|
102770
102930
|
}
|
|
102771
102931
|
} else {
|
|
102772
|
-
|
|
102932
|
+
resolve39(files);
|
|
102773
102933
|
}
|
|
102774
102934
|
});
|
|
102775
102935
|
});
|
|
102776
102936
|
}
|
|
102777
102937
|
function stat12(file, followSymlinks) {
|
|
102778
|
-
return new Promise((
|
|
102938
|
+
return new Promise((resolve39, reject2) => {
|
|
102779
102939
|
const statFunc = followSymlinks ? fs2.stat : fs2.lstat;
|
|
102780
102940
|
statFunc(file, (err, stats) => {
|
|
102781
102941
|
if (err) {
|
|
102782
102942
|
switch (err.code) {
|
|
102783
102943
|
case "ENOENT":
|
|
102784
102944
|
if (followSymlinks) {
|
|
102785
|
-
|
|
102945
|
+
resolve39(stat12(file, false));
|
|
102786
102946
|
} else {
|
|
102787
|
-
|
|
102947
|
+
resolve39(null);
|
|
102788
102948
|
}
|
|
102789
102949
|
break;
|
|
102790
102950
|
default:
|
|
102791
|
-
|
|
102951
|
+
resolve39(null);
|
|
102792
102952
|
break;
|
|
102793
102953
|
}
|
|
102794
102954
|
} else {
|
|
102795
|
-
|
|
102955
|
+
resolve39(stats);
|
|
102796
102956
|
}
|
|
102797
102957
|
});
|
|
102798
102958
|
});
|
|
@@ -102882,7 +103042,7 @@ var require_readdir_glob = __commonJS({
|
|
|
102882
103042
|
(skip) => new Minimatch(skip, { dot: true })
|
|
102883
103043
|
);
|
|
102884
103044
|
}
|
|
102885
|
-
this.iterator = explore(
|
|
103045
|
+
this.iterator = explore(resolve38(cwd || "."), this.options.follow, this.options.stat, this._shouldSkipDirectory.bind(this));
|
|
102886
103046
|
this.paused = false;
|
|
102887
103047
|
this.inactive = false;
|
|
102888
103048
|
this.aborted = false;
|
|
@@ -103136,10 +103296,10 @@ function awaitify(asyncFn, arity) {
|
|
|
103136
103296
|
if (typeof args[arity - 1] === "function") {
|
|
103137
103297
|
return asyncFn.apply(this, args);
|
|
103138
103298
|
}
|
|
103139
|
-
return new Promise((
|
|
103299
|
+
return new Promise((resolve38, reject2) => {
|
|
103140
103300
|
args[arity - 1] = (err, ...cbArgs) => {
|
|
103141
103301
|
if (err) return reject2(err);
|
|
103142
|
-
|
|
103302
|
+
resolve38(cbArgs.length > 1 ? cbArgs : cbArgs[0]);
|
|
103143
103303
|
};
|
|
103144
103304
|
asyncFn.apply(this, args);
|
|
103145
103305
|
});
|
|
@@ -103321,13 +103481,13 @@ function mapSeries(coll, iteratee, callback) {
|
|
|
103321
103481
|
return _asyncMap(eachOfSeries$1, coll, iteratee, callback);
|
|
103322
103482
|
}
|
|
103323
103483
|
function promiseCallback() {
|
|
103324
|
-
let
|
|
103484
|
+
let resolve38, reject2;
|
|
103325
103485
|
function callback(err, ...args) {
|
|
103326
103486
|
if (err) return reject2(err);
|
|
103327
|
-
|
|
103487
|
+
resolve38(args.length > 1 ? args : args[0]);
|
|
103328
103488
|
}
|
|
103329
103489
|
callback[PROMISE_SYMBOL] = new Promise((res, rej) => {
|
|
103330
|
-
|
|
103490
|
+
resolve38 = res, reject2 = rej;
|
|
103331
103491
|
});
|
|
103332
103492
|
return callback;
|
|
103333
103493
|
}
|
|
@@ -103600,8 +103760,8 @@ function queue$1(worker, concurrency, payload) {
|
|
|
103600
103760
|
});
|
|
103601
103761
|
}
|
|
103602
103762
|
if (rejectOnError || !callback) {
|
|
103603
|
-
return new Promise((
|
|
103604
|
-
res =
|
|
103763
|
+
return new Promise((resolve38, reject2) => {
|
|
103764
|
+
res = resolve38;
|
|
103605
103765
|
rej = reject2;
|
|
103606
103766
|
});
|
|
103607
103767
|
}
|
|
@@ -103640,10 +103800,10 @@ function queue$1(worker, concurrency, payload) {
|
|
|
103640
103800
|
}
|
|
103641
103801
|
const eventMethod = (name) => (handler) => {
|
|
103642
103802
|
if (!handler) {
|
|
103643
|
-
return new Promise((
|
|
103803
|
+
return new Promise((resolve38, reject2) => {
|
|
103644
103804
|
once3(name, (err, data) => {
|
|
103645
103805
|
if (err) return reject2(err);
|
|
103646
|
-
|
|
103806
|
+
resolve38(data);
|
|
103647
103807
|
});
|
|
103648
103808
|
});
|
|
103649
103809
|
}
|
|
@@ -109649,25 +109809,25 @@ var require_util2 = __commonJS({
|
|
|
109649
109809
|
};
|
|
109650
109810
|
},
|
|
109651
109811
|
createDeferredPromise: function() {
|
|
109652
|
-
let
|
|
109812
|
+
let resolve38;
|
|
109653
109813
|
let reject2;
|
|
109654
109814
|
const promise = new Promise((res, rej) => {
|
|
109655
|
-
|
|
109815
|
+
resolve38 = res;
|
|
109656
109816
|
reject2 = rej;
|
|
109657
109817
|
});
|
|
109658
109818
|
return {
|
|
109659
109819
|
promise,
|
|
109660
|
-
resolve:
|
|
109820
|
+
resolve: resolve38,
|
|
109661
109821
|
reject: reject2
|
|
109662
109822
|
};
|
|
109663
109823
|
},
|
|
109664
109824
|
promisify(fn) {
|
|
109665
|
-
return new Promise((
|
|
109825
|
+
return new Promise((resolve38, reject2) => {
|
|
109666
109826
|
fn((err, ...args) => {
|
|
109667
109827
|
if (err) {
|
|
109668
109828
|
return reject2(err);
|
|
109669
109829
|
}
|
|
109670
|
-
return
|
|
109830
|
+
return resolve38(...args);
|
|
109671
109831
|
});
|
|
109672
109832
|
});
|
|
109673
109833
|
},
|
|
@@ -110459,7 +110619,7 @@ var require_end_of_stream2 = __commonJS({
|
|
|
110459
110619
|
validateBoolean3(opts.cleanup, "cleanup");
|
|
110460
110620
|
autoCleanup = opts.cleanup;
|
|
110461
110621
|
}
|
|
110462
|
-
return new Promise2((
|
|
110622
|
+
return new Promise2((resolve38, reject2) => {
|
|
110463
110623
|
const cleanup = eos(stream, opts, (err) => {
|
|
110464
110624
|
if (autoCleanup) {
|
|
110465
110625
|
cleanup();
|
|
@@ -110467,7 +110627,7 @@ var require_end_of_stream2 = __commonJS({
|
|
|
110467
110627
|
if (err) {
|
|
110468
110628
|
reject2(err);
|
|
110469
110629
|
} else {
|
|
110470
|
-
|
|
110630
|
+
resolve38();
|
|
110471
110631
|
}
|
|
110472
110632
|
});
|
|
110473
110633
|
});
|
|
@@ -111634,7 +111794,7 @@ var require_readable2 = __commonJS({
|
|
|
111634
111794
|
error = this.readableEnded ? null : new AbortError();
|
|
111635
111795
|
this.destroy(error);
|
|
111636
111796
|
}
|
|
111637
|
-
return new Promise2((
|
|
111797
|
+
return new Promise2((resolve38, reject2) => eos(this, (err) => err && err !== error ? reject2(err) : resolve38(null)));
|
|
111638
111798
|
};
|
|
111639
111799
|
Readable2.prototype.push = function(chunk, encoding) {
|
|
111640
111800
|
return readableAddChunk(this, chunk, encoding, false);
|
|
@@ -112178,12 +112338,12 @@ var require_readable2 = __commonJS({
|
|
|
112178
112338
|
}
|
|
112179
112339
|
async function* createAsyncIterator(stream, options) {
|
|
112180
112340
|
let callback = nop;
|
|
112181
|
-
function next(
|
|
112341
|
+
function next(resolve38) {
|
|
112182
112342
|
if (this === stream) {
|
|
112183
112343
|
callback();
|
|
112184
112344
|
callback = nop;
|
|
112185
112345
|
} else {
|
|
112186
|
-
callback =
|
|
112346
|
+
callback = resolve38;
|
|
112187
112347
|
}
|
|
112188
112348
|
}
|
|
112189
112349
|
stream.on("readable", next);
|
|
@@ -113236,7 +113396,7 @@ var require_duplexify = __commonJS({
|
|
|
113236
113396
|
);
|
|
113237
113397
|
};
|
|
113238
113398
|
function fromAsyncGen(fn) {
|
|
113239
|
-
let { promise, resolve:
|
|
113399
|
+
let { promise, resolve: resolve38 } = createDeferredPromise();
|
|
113240
113400
|
const ac = new AbortController2();
|
|
113241
113401
|
const signal = ac.signal;
|
|
113242
113402
|
const value = fn(
|
|
@@ -113251,7 +113411,7 @@ var require_duplexify = __commonJS({
|
|
|
113251
113411
|
throw new AbortError(void 0, {
|
|
113252
113412
|
cause: signal.reason
|
|
113253
113413
|
});
|
|
113254
|
-
({ promise, resolve:
|
|
113414
|
+
({ promise, resolve: resolve38 } = createDeferredPromise());
|
|
113255
113415
|
yield chunk;
|
|
113256
113416
|
}
|
|
113257
113417
|
})(),
|
|
@@ -113262,8 +113422,8 @@ var require_duplexify = __commonJS({
|
|
|
113262
113422
|
return {
|
|
113263
113423
|
value,
|
|
113264
113424
|
write(chunk, encoding, cb) {
|
|
113265
|
-
const _resolve =
|
|
113266
|
-
|
|
113425
|
+
const _resolve = resolve38;
|
|
113426
|
+
resolve38 = null;
|
|
113267
113427
|
_resolve({
|
|
113268
113428
|
chunk,
|
|
113269
113429
|
done: false,
|
|
@@ -113271,8 +113431,8 @@ var require_duplexify = __commonJS({
|
|
|
113271
113431
|
});
|
|
113272
113432
|
},
|
|
113273
113433
|
final(cb) {
|
|
113274
|
-
const _resolve =
|
|
113275
|
-
|
|
113434
|
+
const _resolve = resolve38;
|
|
113435
|
+
resolve38 = null;
|
|
113276
113436
|
_resolve({
|
|
113277
113437
|
done: true,
|
|
113278
113438
|
cb
|
|
@@ -113724,7 +113884,7 @@ var require_pipeline = __commonJS({
|
|
|
113724
113884
|
callback();
|
|
113725
113885
|
}
|
|
113726
113886
|
};
|
|
113727
|
-
const wait = () => new Promise2((
|
|
113887
|
+
const wait = () => new Promise2((resolve38, reject2) => {
|
|
113728
113888
|
if (error) {
|
|
113729
113889
|
reject2(error);
|
|
113730
113890
|
} else {
|
|
@@ -113732,7 +113892,7 @@ var require_pipeline = __commonJS({
|
|
|
113732
113892
|
if (error) {
|
|
113733
113893
|
reject2(error);
|
|
113734
113894
|
} else {
|
|
113735
|
-
|
|
113895
|
+
resolve38();
|
|
113736
113896
|
}
|
|
113737
113897
|
};
|
|
113738
113898
|
}
|
|
@@ -114376,8 +114536,8 @@ var require_operators = __commonJS({
|
|
|
114376
114536
|
next = null;
|
|
114377
114537
|
}
|
|
114378
114538
|
if (!done && (queue2.length >= highWaterMark2 || cnt >= concurrency)) {
|
|
114379
|
-
await new Promise2((
|
|
114380
|
-
resume =
|
|
114539
|
+
await new Promise2((resolve38) => {
|
|
114540
|
+
resume = resolve38;
|
|
114381
114541
|
});
|
|
114382
114542
|
}
|
|
114383
114543
|
}
|
|
@@ -114411,8 +114571,8 @@ var require_operators = __commonJS({
|
|
|
114411
114571
|
queue2.shift();
|
|
114412
114572
|
maybeResume();
|
|
114413
114573
|
}
|
|
114414
|
-
await new Promise2((
|
|
114415
|
-
next =
|
|
114574
|
+
await new Promise2((resolve38) => {
|
|
114575
|
+
next = resolve38;
|
|
114416
114576
|
});
|
|
114417
114577
|
}
|
|
114418
114578
|
} finally {
|
|
@@ -114670,7 +114830,7 @@ var require_promises = __commonJS({
|
|
|
114670
114830
|
var { finished } = require_end_of_stream2();
|
|
114671
114831
|
require_stream2();
|
|
114672
114832
|
function pipeline(...streams) {
|
|
114673
|
-
return new Promise2((
|
|
114833
|
+
return new Promise2((resolve38, reject2) => {
|
|
114674
114834
|
let signal;
|
|
114675
114835
|
let end;
|
|
114676
114836
|
const lastArg = streams[streams.length - 1];
|
|
@@ -114685,7 +114845,7 @@ var require_promises = __commonJS({
|
|
|
114685
114845
|
if (err) {
|
|
114686
114846
|
reject2(err);
|
|
114687
114847
|
} else {
|
|
114688
|
-
|
|
114848
|
+
resolve38(value);
|
|
114689
114849
|
}
|
|
114690
114850
|
},
|
|
114691
114851
|
{
|
|
@@ -119458,10 +119618,10 @@ var require_commonjs3 = __commonJS({
|
|
|
119458
119618
|
* Return a void Promise that resolves once the stream ends.
|
|
119459
119619
|
*/
|
|
119460
119620
|
async promise() {
|
|
119461
|
-
return new Promise((
|
|
119621
|
+
return new Promise((resolve38, reject2) => {
|
|
119462
119622
|
this.on(DESTROYED, () => reject2(new Error("stream destroyed")));
|
|
119463
119623
|
this.on("error", (er) => reject2(er));
|
|
119464
|
-
this.on("end", () =>
|
|
119624
|
+
this.on("end", () => resolve38());
|
|
119465
119625
|
});
|
|
119466
119626
|
}
|
|
119467
119627
|
/**
|
|
@@ -119485,7 +119645,7 @@ var require_commonjs3 = __commonJS({
|
|
|
119485
119645
|
return Promise.resolve({ done: false, value: res });
|
|
119486
119646
|
if (this[EOF])
|
|
119487
119647
|
return stop();
|
|
119488
|
-
let
|
|
119648
|
+
let resolve38;
|
|
119489
119649
|
let reject2;
|
|
119490
119650
|
const onerr = (er) => {
|
|
119491
119651
|
this.off("data", ondata);
|
|
@@ -119499,19 +119659,19 @@ var require_commonjs3 = __commonJS({
|
|
|
119499
119659
|
this.off("end", onend);
|
|
119500
119660
|
this.off(DESTROYED, ondestroy);
|
|
119501
119661
|
this.pause();
|
|
119502
|
-
|
|
119662
|
+
resolve38({ value, done: !!this[EOF] });
|
|
119503
119663
|
};
|
|
119504
119664
|
const onend = () => {
|
|
119505
119665
|
this.off("error", onerr);
|
|
119506
119666
|
this.off("data", ondata);
|
|
119507
119667
|
this.off(DESTROYED, ondestroy);
|
|
119508
119668
|
stop();
|
|
119509
|
-
|
|
119669
|
+
resolve38({ done: true, value: void 0 });
|
|
119510
119670
|
};
|
|
119511
119671
|
const ondestroy = () => onerr(new Error("stream destroyed"));
|
|
119512
119672
|
return new Promise((res2, rej) => {
|
|
119513
119673
|
reject2 = rej;
|
|
119514
|
-
|
|
119674
|
+
resolve38 = res2;
|
|
119515
119675
|
this.once(DESTROYED, ondestroy);
|
|
119516
119676
|
this.once("error", onerr);
|
|
119517
119677
|
this.once("end", onend);
|
|
@@ -120527,9 +120687,9 @@ var require_commonjs4 = __commonJS({
|
|
|
120527
120687
|
if (this.#asyncReaddirInFlight) {
|
|
120528
120688
|
await this.#asyncReaddirInFlight;
|
|
120529
120689
|
} else {
|
|
120530
|
-
let
|
|
120690
|
+
let resolve38 = () => {
|
|
120531
120691
|
};
|
|
120532
|
-
this.#asyncReaddirInFlight = new Promise((res) =>
|
|
120692
|
+
this.#asyncReaddirInFlight = new Promise((res) => resolve38 = res);
|
|
120533
120693
|
try {
|
|
120534
120694
|
for (const e of await this.#fs.promises.readdir(fullpath, {
|
|
120535
120695
|
withFileTypes: true
|
|
@@ -120542,7 +120702,7 @@ var require_commonjs4 = __commonJS({
|
|
|
120542
120702
|
children.provisional = 0;
|
|
120543
120703
|
}
|
|
120544
120704
|
this.#asyncReaddirInFlight = void 0;
|
|
120545
|
-
|
|
120705
|
+
resolve38();
|
|
120546
120706
|
}
|
|
120547
120707
|
return children.slice(0, children.provisional);
|
|
120548
120708
|
}
|
|
@@ -123315,11 +123475,11 @@ var require_core = __commonJS({
|
|
|
123315
123475
|
this._finalize();
|
|
123316
123476
|
}
|
|
123317
123477
|
var self2 = this;
|
|
123318
|
-
return new Promise(function(
|
|
123478
|
+
return new Promise(function(resolve38, reject2) {
|
|
123319
123479
|
var errored;
|
|
123320
123480
|
self2._module.on("end", function() {
|
|
123321
123481
|
if (!errored) {
|
|
123322
|
-
|
|
123482
|
+
resolve38();
|
|
123323
123483
|
}
|
|
123324
123484
|
});
|
|
123325
123485
|
self2._module.on("error", function(err) {
|
|
@@ -125759,8 +125919,8 @@ var require_streamx = __commonJS({
|
|
|
125759
125919
|
return this;
|
|
125760
125920
|
},
|
|
125761
125921
|
next() {
|
|
125762
|
-
return new Promise(function(
|
|
125763
|
-
promiseResolve =
|
|
125922
|
+
return new Promise(function(resolve38, reject2) {
|
|
125923
|
+
promiseResolve = resolve38;
|
|
125764
125924
|
promiseReject = reject2;
|
|
125765
125925
|
const data = stream.read();
|
|
125766
125926
|
if (data !== null) ondata(data);
|
|
@@ -125790,11 +125950,11 @@ var require_streamx = __commonJS({
|
|
|
125790
125950
|
}
|
|
125791
125951
|
function destroy(err) {
|
|
125792
125952
|
stream.destroy(err);
|
|
125793
|
-
return new Promise((
|
|
125794
|
-
if (stream._duplexState & DESTROYED) return
|
|
125953
|
+
return new Promise((resolve38, reject2) => {
|
|
125954
|
+
if (stream._duplexState & DESTROYED) return resolve38({ value: void 0, done: true });
|
|
125795
125955
|
stream.once("close", function() {
|
|
125796
125956
|
if (err) reject2(err);
|
|
125797
|
-
else
|
|
125957
|
+
else resolve38({ value: void 0, done: true });
|
|
125798
125958
|
});
|
|
125799
125959
|
});
|
|
125800
125960
|
}
|
|
@@ -125838,8 +125998,8 @@ var require_streamx = __commonJS({
|
|
|
125838
125998
|
const writes = pending + (ws._duplexState & WRITE_WRITING ? 1 : 0);
|
|
125839
125999
|
if (writes === 0) return Promise.resolve(true);
|
|
125840
126000
|
if (state.drains === null) state.drains = [];
|
|
125841
|
-
return new Promise((
|
|
125842
|
-
state.drains.push({ writes, resolve:
|
|
126001
|
+
return new Promise((resolve38) => {
|
|
126002
|
+
state.drains.push({ writes, resolve: resolve38 });
|
|
125843
126003
|
});
|
|
125844
126004
|
}
|
|
125845
126005
|
write(data) {
|
|
@@ -125944,10 +126104,10 @@ var require_streamx = __commonJS({
|
|
|
125944
126104
|
cb(null);
|
|
125945
126105
|
}
|
|
125946
126106
|
function pipelinePromise(...streams) {
|
|
125947
|
-
return new Promise((
|
|
126107
|
+
return new Promise((resolve38, reject2) => {
|
|
125948
126108
|
return pipeline(...streams, (err) => {
|
|
125949
126109
|
if (err) return reject2(err);
|
|
125950
|
-
|
|
126110
|
+
resolve38();
|
|
125951
126111
|
});
|
|
125952
126112
|
});
|
|
125953
126113
|
}
|
|
@@ -126604,16 +126764,16 @@ var require_extract = __commonJS({
|
|
|
126604
126764
|
entryCallback = null;
|
|
126605
126765
|
cb(err);
|
|
126606
126766
|
}
|
|
126607
|
-
function onnext(
|
|
126767
|
+
function onnext(resolve38, reject2) {
|
|
126608
126768
|
if (error) {
|
|
126609
126769
|
return reject2(error);
|
|
126610
126770
|
}
|
|
126611
126771
|
if (entryStream) {
|
|
126612
|
-
|
|
126772
|
+
resolve38({ value: entryStream, done: false });
|
|
126613
126773
|
entryStream = null;
|
|
126614
126774
|
return;
|
|
126615
126775
|
}
|
|
126616
|
-
promiseResolve =
|
|
126776
|
+
promiseResolve = resolve38;
|
|
126617
126777
|
promiseReject = reject2;
|
|
126618
126778
|
consumeCallback(null);
|
|
126619
126779
|
if (extract._finished && promiseResolve) {
|
|
@@ -126641,11 +126801,11 @@ var require_extract = __commonJS({
|
|
|
126641
126801
|
function destroy(err) {
|
|
126642
126802
|
extract.destroy(err);
|
|
126643
126803
|
consumeCallback(err);
|
|
126644
|
-
return new Promise((
|
|
126645
|
-
if (extract.destroyed) return
|
|
126804
|
+
return new Promise((resolve38, reject2) => {
|
|
126805
|
+
if (extract.destroyed) return resolve38({ value: void 0, done: true });
|
|
126646
126806
|
extract.once("close", function() {
|
|
126647
126807
|
if (err) reject2(err);
|
|
126648
|
-
else
|
|
126808
|
+
else resolve38({ value: void 0, done: true });
|
|
126649
126809
|
});
|
|
126650
126810
|
});
|
|
126651
126811
|
}
|
|
@@ -127415,7 +127575,7 @@ var require_archiver = __commonJS({
|
|
|
127415
127575
|
});
|
|
127416
127576
|
|
|
127417
127577
|
// ../dashboard/src/routes/register-file-workspace-routes.ts
|
|
127418
|
-
import { access as
|
|
127578
|
+
import { access as access7 } from "node:fs/promises";
|
|
127419
127579
|
import { createReadStream as createReadStream3 } from "node:fs";
|
|
127420
127580
|
function extractFileParams(req) {
|
|
127421
127581
|
const filePath = Array.isArray(req.params.filepath) ? req.params.filepath[0] : req.params.filepath ?? "";
|
|
@@ -127490,7 +127650,7 @@ function registerFileWorkspaceRoutes(ctx) {
|
|
|
127490
127650
|
return null;
|
|
127491
127651
|
}
|
|
127492
127652
|
try {
|
|
127493
|
-
await
|
|
127653
|
+
await access7(task.worktree);
|
|
127494
127654
|
return {
|
|
127495
127655
|
id: task.id,
|
|
127496
127656
|
title: task.title,
|
|
@@ -127760,7 +127920,7 @@ var init_register_file_workspace_routes = __esm({
|
|
|
127760
127920
|
});
|
|
127761
127921
|
|
|
127762
127922
|
// ../dashboard/src/routes/register-session-diff-routes.ts
|
|
127763
|
-
import { access as
|
|
127923
|
+
import { access as access8 } from "node:fs/promises";
|
|
127764
127924
|
async function worktreeStillBelongsToTask(worktree, expectedBranch) {
|
|
127765
127925
|
if (!expectedBranch) return true;
|
|
127766
127926
|
try {
|
|
@@ -127787,7 +127947,7 @@ function registerSessionDiffRoutes(router, deps) {
|
|
|
127787
127947
|
}
|
|
127788
127948
|
let worktreeExists = false;
|
|
127789
127949
|
try {
|
|
127790
|
-
await
|
|
127950
|
+
await access8(task.worktree);
|
|
127791
127951
|
worktreeExists = true;
|
|
127792
127952
|
} catch {
|
|
127793
127953
|
worktreeExists = false;
|
|
@@ -127912,7 +128072,7 @@ function registerSessionDiffRoutes(router, deps) {
|
|
|
127912
128072
|
}
|
|
127913
128073
|
let worktreeExists = false;
|
|
127914
128074
|
try {
|
|
127915
|
-
await
|
|
128075
|
+
await access8(resolvedWorktree);
|
|
127916
128076
|
worktreeExists = true;
|
|
127917
128077
|
} catch {
|
|
127918
128078
|
worktreeExists = false;
|
|
@@ -128042,7 +128202,7 @@ function registerSessionDiffRoutes(router, deps) {
|
|
|
128042
128202
|
}
|
|
128043
128203
|
let worktreeExists = false;
|
|
128044
128204
|
try {
|
|
128045
|
-
await
|
|
128205
|
+
await access8(task.worktree);
|
|
128046
128206
|
worktreeExists = true;
|
|
128047
128207
|
} catch {
|
|
128048
128208
|
worktreeExists = false;
|
|
@@ -128401,8 +128561,8 @@ var init_exec_file = __esm({
|
|
|
128401
128561
|
|
|
128402
128562
|
// ../dashboard/src/routes/register-project-routes.ts
|
|
128403
128563
|
import * as fsPromises from "node:fs/promises";
|
|
128404
|
-
import { dirname as
|
|
128405
|
-
var
|
|
128564
|
+
import { dirname as dirname14, isAbsolute as isAbsolute16, join as join42 } from "node:path";
|
|
128565
|
+
var access9, stat8, mkdir15, readdir9, rm3, registerProjectRoutes;
|
|
128406
128566
|
var init_register_project_routes = __esm({
|
|
128407
128567
|
"../dashboard/src/routes/register-project-routes.ts"() {
|
|
128408
128568
|
"use strict";
|
|
@@ -128411,7 +128571,7 @@ var init_register_project_routes = __esm({
|
|
|
128411
128571
|
init_exec_file();
|
|
128412
128572
|
init_project_store_resolver();
|
|
128413
128573
|
({
|
|
128414
|
-
access:
|
|
128574
|
+
access: access9,
|
|
128415
128575
|
stat: stat8,
|
|
128416
128576
|
mkdir: mkdir15,
|
|
128417
128577
|
readdir: readdir9,
|
|
@@ -128569,14 +128729,14 @@ var init_register_project_routes = __esm({
|
|
|
128569
128729
|
let destinationCreatedForClone = false;
|
|
128570
128730
|
if (!isCloneMode) {
|
|
128571
128731
|
try {
|
|
128572
|
-
await
|
|
128732
|
+
await access9(normalizedPath);
|
|
128573
128733
|
} catch {
|
|
128574
128734
|
throw badRequest("Project path does not exist");
|
|
128575
128735
|
}
|
|
128576
128736
|
} else {
|
|
128577
|
-
const destinationParent =
|
|
128737
|
+
const destinationParent = dirname14(normalizedPath);
|
|
128578
128738
|
try {
|
|
128579
|
-
await
|
|
128739
|
+
await access9(destinationParent);
|
|
128580
128740
|
} catch {
|
|
128581
128741
|
throw badRequest("Clone destination parent directory does not exist");
|
|
128582
128742
|
}
|
|
@@ -128626,7 +128786,7 @@ var init_register_project_routes = __esm({
|
|
|
128626
128786
|
let hasFusionDir = false;
|
|
128627
128787
|
const fusionDirPath = join42(normalizedPath, ".fusion");
|
|
128628
128788
|
try {
|
|
128629
|
-
await
|
|
128789
|
+
await access9(fusionDirPath);
|
|
128630
128790
|
hasFusionDir = true;
|
|
128631
128791
|
} catch {
|
|
128632
128792
|
hasFusionDir = false;
|
|
@@ -128669,7 +128829,7 @@ var init_register_project_routes = __esm({
|
|
|
128669
128829
|
const { basePath } = req.body;
|
|
128670
128830
|
const searchPath = basePath || process.env.HOME || process.env.USERPROFILE || ".";
|
|
128671
128831
|
try {
|
|
128672
|
-
await
|
|
128832
|
+
await access9(searchPath);
|
|
128673
128833
|
} catch {
|
|
128674
128834
|
throw badRequest("Base path does not exist");
|
|
128675
128835
|
}
|
|
@@ -130111,10 +130271,11 @@ function registerAgentCoreListCreateRoutes(ctx, deps) {
|
|
|
130111
130271
|
bundleConfig: bundleConfig ?? void 0,
|
|
130112
130272
|
heartbeatProcedurePath: heartbeatProcedurePath ?? void 0
|
|
130113
130273
|
});
|
|
130114
|
-
|
|
130274
|
+
const expectedDefaultPath = getDefaultHeartbeatProcedurePath(agent.id);
|
|
130275
|
+
if (agent.heartbeatProcedurePath === expectedDefaultPath) {
|
|
130115
130276
|
try {
|
|
130116
130277
|
const { ensureDefaultHeartbeatProcedureFile: ensureDefaultHeartbeatProcedureFile2, HEARTBEAT_PROCEDURE: HEARTBEAT_PROCEDURE2 } = await Promise.resolve().then(() => (init_src2(), src_exports2));
|
|
130117
|
-
await ensureDefaultHeartbeatProcedureFile2(scopedStore.getRootDir(),
|
|
130278
|
+
await ensureDefaultHeartbeatProcedureFile2(scopedStore.getRootDir(), expectedDefaultPath, HEARTBEAT_PROCEDURE2);
|
|
130118
130279
|
} catch {
|
|
130119
130280
|
}
|
|
130120
130281
|
}
|
|
@@ -130369,18 +130530,19 @@ function registerAgentCoreRoutes(ctx, deps) {
|
|
|
130369
130530
|
if (!existing) {
|
|
130370
130531
|
throw notFound(`agent ${req.params.id} not found`);
|
|
130371
130532
|
}
|
|
130533
|
+
const targetPath = getDefaultHeartbeatProcedurePath(req.params.id);
|
|
130372
130534
|
const { ensureDefaultHeartbeatProcedureFile: ensureDefaultHeartbeatProcedureFile2, HEARTBEAT_PROCEDURE: HEARTBEAT_PROCEDURE2 } = await Promise.resolve().then(() => (init_src2(), src_exports2));
|
|
130373
130535
|
const filePath = await ensureDefaultHeartbeatProcedureFile2(
|
|
130374
130536
|
scopedStore.getRootDir(),
|
|
130375
|
-
|
|
130537
|
+
targetPath,
|
|
130376
130538
|
HEARTBEAT_PROCEDURE2
|
|
130377
130539
|
);
|
|
130378
130540
|
const updated = await agentStore.updateAgent(req.params.id, {
|
|
130379
|
-
heartbeatProcedurePath:
|
|
130541
|
+
heartbeatProcedurePath: targetPath
|
|
130380
130542
|
});
|
|
130381
130543
|
res.json({
|
|
130382
130544
|
agent: updated,
|
|
130383
|
-
heartbeatProcedurePath:
|
|
130545
|
+
heartbeatProcedurePath: targetPath,
|
|
130384
130546
|
procedureFileSeeded: filePath !== null
|
|
130385
130547
|
});
|
|
130386
130548
|
} catch (err) {
|
|
@@ -132302,7 +132464,7 @@ ${body}`;
|
|
|
132302
132464
|
const skillDir = join43(skillsBaseDir, skillSlug);
|
|
132303
132465
|
const skillPath = join43(skillDir, "SKILL.md");
|
|
132304
132466
|
try {
|
|
132305
|
-
await
|
|
132467
|
+
await access10(skillPath);
|
|
132306
132468
|
result.skipped.push(name);
|
|
132307
132469
|
continue;
|
|
132308
132470
|
} catch {
|
|
@@ -132723,14 +132885,14 @@ function registerAgentGenerationRoutes(ctx) {
|
|
|
132723
132885
|
}
|
|
132724
132886
|
});
|
|
132725
132887
|
}
|
|
132726
|
-
var mkdtemp,
|
|
132888
|
+
var mkdtemp, access10, stat9, mkdir16, rm4, fsWriteFile2;
|
|
132727
132889
|
var init_register_agent_import_export_generation_routes = __esm({
|
|
132728
132890
|
"../dashboard/src/routes/register-agent-import-export-generation-routes.ts"() {
|
|
132729
132891
|
"use strict";
|
|
132730
132892
|
init_api_error();
|
|
132731
132893
|
init_ai_session_diagnostics();
|
|
132732
132894
|
init_agent_generation();
|
|
132733
|
-
({ mkdtemp, access:
|
|
132895
|
+
({ mkdtemp, access: access10, stat: stat9, mkdir: mkdir16, rm: rm4, writeFile: fsWriteFile2 } = fsPromises2);
|
|
132734
132896
|
}
|
|
132735
132897
|
});
|
|
132736
132898
|
|
|
@@ -133187,9 +133349,9 @@ function registerProxyRoutes(router, deps) {
|
|
|
133187
133349
|
if (req.rawBody && req.rawBody.length > 0) {
|
|
133188
133350
|
body = req.rawBody;
|
|
133189
133351
|
} else {
|
|
133190
|
-
await new Promise((
|
|
133352
|
+
await new Promise((resolve38, reject2) => {
|
|
133191
133353
|
req.on("data", (chunk) => chunks.push(chunk));
|
|
133192
|
-
req.on("end",
|
|
133354
|
+
req.on("end", resolve38);
|
|
133193
133355
|
req.on("error", reject2);
|
|
133194
133356
|
});
|
|
133195
133357
|
if (chunks.length > 0) {
|
|
@@ -133601,13 +133763,13 @@ function getHomeDir5() {
|
|
|
133601
133763
|
return process.env.HOME || process.env.USERPROFILE || os4.homedir();
|
|
133602
133764
|
}
|
|
133603
133765
|
function execFileAsync4(file, args, options) {
|
|
133604
|
-
return new Promise((
|
|
133766
|
+
return new Promise((resolve38, reject2) => {
|
|
133605
133767
|
child_process.execFile(file, args, options, (error, stdout, stderr) => {
|
|
133606
133768
|
if (error) {
|
|
133607
133769
|
reject2(error);
|
|
133608
133770
|
return;
|
|
133609
133771
|
}
|
|
133610
|
-
|
|
133772
|
+
resolve38({ stdout: String(stdout), stderr: String(stderr) });
|
|
133611
133773
|
});
|
|
133612
133774
|
});
|
|
133613
133775
|
}
|
|
@@ -133666,7 +133828,7 @@ function formatDuration(ms) {
|
|
|
133666
133828
|
return remHours > 0 ? `${days}d ${remHours}h` : `${days}d`;
|
|
133667
133829
|
}
|
|
133668
133830
|
function httpsRequest(url, options) {
|
|
133669
|
-
return new Promise((
|
|
133831
|
+
return new Promise((resolve38, reject2) => {
|
|
133670
133832
|
const parsed = new URL(url);
|
|
133671
133833
|
const req = https.request(
|
|
133672
133834
|
{
|
|
@@ -133686,7 +133848,7 @@ function httpsRequest(url, options) {
|
|
|
133686
133848
|
if (typeof v === "string") hdrs[k.toLowerCase()] = v;
|
|
133687
133849
|
else if (Array.isArray(v)) hdrs[k.toLowerCase()] = v.join(", ");
|
|
133688
133850
|
}
|
|
133689
|
-
|
|
133851
|
+
resolve38({
|
|
133690
133852
|
status: res.statusCode || 0,
|
|
133691
133853
|
headers: hdrs,
|
|
133692
133854
|
body: Buffer.concat(chunks).toString("utf-8")
|
|
@@ -133933,7 +134095,7 @@ async function fetchClaudeUsageViaCli() {
|
|
|
133933
134095
|
env: { ...process.env, TERM: "xterm-256color" }
|
|
133934
134096
|
};
|
|
133935
134097
|
if (isWindows) ptyOptions.useConpty = false;
|
|
133936
|
-
const output = await new Promise((
|
|
134098
|
+
const output = await new Promise((resolve38, reject2) => {
|
|
133937
134099
|
let buf = "";
|
|
133938
134100
|
let settled = false;
|
|
133939
134101
|
let sentCommand = false;
|
|
@@ -133949,7 +134111,7 @@ async function fetchClaudeUsageViaCli() {
|
|
|
133949
134111
|
}
|
|
133950
134112
|
const clean = _stripClaudeAnsi(buf);
|
|
133951
134113
|
if (clean.includes("Current session") || clean.includes("% left") || clean.includes("% used")) {
|
|
133952
|
-
|
|
134114
|
+
resolve38(buf);
|
|
133953
134115
|
} else {
|
|
133954
134116
|
reject2(new Error("Claude CLI timed out after 60s \u2014 got output but no usage data. Try running `claude /usage` manually."));
|
|
133955
134117
|
}
|
|
@@ -134000,7 +134162,7 @@ async function fetchClaudeUsageViaCli() {
|
|
|
134000
134162
|
ptyProcess.kill();
|
|
134001
134163
|
} catch {
|
|
134002
134164
|
}
|
|
134003
|
-
|
|
134165
|
+
resolve38(buf);
|
|
134004
134166
|
}
|
|
134005
134167
|
}, 2e3);
|
|
134006
134168
|
}
|
|
@@ -134011,7 +134173,7 @@ async function fetchClaudeUsageViaCli() {
|
|
|
134011
134173
|
if (settled) return;
|
|
134012
134174
|
settled = true;
|
|
134013
134175
|
clearTimeout(timeout2);
|
|
134014
|
-
|
|
134176
|
+
resolve38(buf);
|
|
134015
134177
|
});
|
|
134016
134178
|
});
|
|
134017
134179
|
const cleanOutput = _stripClaudeAnsi(output);
|
|
@@ -134679,9 +134841,9 @@ async function fetchGitHubCopilotUsage() {
|
|
|
134679
134841
|
return usage;
|
|
134680
134842
|
}
|
|
134681
134843
|
function withTimeout(providerPromise, providerName, timeoutMs = PROVIDER_FETCH_TIMEOUT_MS) {
|
|
134682
|
-
return new Promise((
|
|
134844
|
+
return new Promise((resolve38) => {
|
|
134683
134845
|
const timer = setTimeout(() => {
|
|
134684
|
-
|
|
134846
|
+
resolve38({
|
|
134685
134847
|
name: providerName,
|
|
134686
134848
|
icon: "\u23F1\uFE0F",
|
|
134687
134849
|
status: "error",
|
|
@@ -134691,10 +134853,10 @@ function withTimeout(providerPromise, providerName, timeoutMs = PROVIDER_FETCH_T
|
|
|
134691
134853
|
}, timeoutMs);
|
|
134692
134854
|
providerPromise.then((result) => {
|
|
134693
134855
|
clearTimeout(timer);
|
|
134694
|
-
|
|
134856
|
+
resolve38(result);
|
|
134695
134857
|
}).catch((err) => {
|
|
134696
134858
|
clearTimeout(timer);
|
|
134697
|
-
|
|
134859
|
+
resolve38({
|
|
134698
134860
|
name: providerName,
|
|
134699
134861
|
icon: "\u23F1\uFE0F",
|
|
134700
134862
|
status: "error",
|
|
@@ -134749,7 +134911,7 @@ var init_usage = __esm({
|
|
|
134749
134911
|
ANTHROPIC_OAUTH_CLIENT_ID = "9d1c250a-e61b-44d9-88ed-5944d1962f5e";
|
|
134750
134912
|
ANTHROPIC_OAUTH_BETA = "oauth-2025-04-20";
|
|
134751
134913
|
CLAUDE_USAGE_USER_AGENT = "claude-code-fusion-dashboard";
|
|
134752
|
-
_sleep = (ms) => new Promise((
|
|
134914
|
+
_sleep = (ms) => new Promise((resolve38) => setTimeout(resolve38, ms));
|
|
134753
134915
|
sleepFn = _sleep;
|
|
134754
134916
|
PROVIDER_FETCH_TIMEOUT_MS = 1e4;
|
|
134755
134917
|
CLAUDE_FETCH_TIMEOUT_MS = 75e3;
|
|
@@ -135125,8 +135287,8 @@ var init_register_auth_routes = __esm({
|
|
|
135125
135287
|
loginInProgress.set(provider, abortController);
|
|
135126
135288
|
let authResolve;
|
|
135127
135289
|
let authReject;
|
|
135128
|
-
const authUrlPromise = new Promise((
|
|
135129
|
-
authResolve =
|
|
135290
|
+
const authUrlPromise = new Promise((resolve38, reject2) => {
|
|
135291
|
+
authResolve = resolve38;
|
|
135130
135292
|
authReject = reject2;
|
|
135131
135293
|
});
|
|
135132
135294
|
const loginPromise = storage.login(provider, {
|
|
@@ -135594,7 +135756,7 @@ async function mintAgentApiKeyViaCli(opts) {
|
|
|
135594
135756
|
args.push("--data-dir", opts.dataDir);
|
|
135595
135757
|
}
|
|
135596
135758
|
const timeoutMs = opts.cliTimeoutMs ?? 3e4;
|
|
135597
|
-
return new Promise((
|
|
135759
|
+
return new Promise((resolve38, reject2) => {
|
|
135598
135760
|
let child;
|
|
135599
135761
|
try {
|
|
135600
135762
|
child = spawn15(bin, args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
@@ -135668,7 +135830,7 @@ async function mintAgentApiKeyViaCli(opts) {
|
|
|
135668
135830
|
const apiBase = (typeof r.apiBase === "string" ? r.apiBase : void 0) ?? (typeof r.api_base === "string" ? r.api_base : void 0);
|
|
135669
135831
|
const agentId = (typeof r.agentId === "string" ? r.agentId : void 0) ?? (typeof r.id === "string" ? r.id : void 0);
|
|
135670
135832
|
const companyId = typeof r.companyId === "string" ? r.companyId : void 0;
|
|
135671
|
-
|
|
135833
|
+
resolve38({ apiKey, apiBase, agentId, companyId, raw: parsed });
|
|
135672
135834
|
});
|
|
135673
135835
|
});
|
|
135674
135836
|
}
|
|
@@ -135688,7 +135850,7 @@ async function spawnPaperclipCliJson(args, opts) {
|
|
|
135688
135850
|
}
|
|
135689
135851
|
const timeoutMs = opts.cliTimeoutMs ?? 15e3;
|
|
135690
135852
|
const label = ["paperclipai", ...args].join(" ");
|
|
135691
|
-
return new Promise((
|
|
135853
|
+
return new Promise((resolve38, reject2) => {
|
|
135692
135854
|
let child;
|
|
135693
135855
|
try {
|
|
135694
135856
|
child = spawn15(bin, fullArgs, { stdio: ["ignore", "pipe", "pipe"] });
|
|
@@ -135734,7 +135896,7 @@ async function spawnPaperclipCliJson(args, opts) {
|
|
|
135734
135896
|
return;
|
|
135735
135897
|
}
|
|
135736
135898
|
try {
|
|
135737
|
-
|
|
135899
|
+
resolve38(JSON.parse(cleaned));
|
|
135738
135900
|
} catch {
|
|
135739
135901
|
reject2(new Error(`${label} returned non-JSON output: ${cleaned.slice(0, 200)}`));
|
|
135740
135902
|
}
|
|
@@ -135863,7 +136025,7 @@ var init_paperclip_client = __esm({
|
|
|
135863
136025
|
// ../../plugins/fusion-plugin-paperclip-runtime/dist/runtime-adapter.js
|
|
135864
136026
|
import { randomUUID as randomUUID19 } from "node:crypto";
|
|
135865
136027
|
function sleep3(ms) {
|
|
135866
|
-
return new Promise((
|
|
136028
|
+
return new Promise((resolve38) => setTimeout(resolve38, ms));
|
|
135867
136029
|
}
|
|
135868
136030
|
function asString2(value) {
|
|
135869
136031
|
return typeof value === "string" ? value : void 0;
|
|
@@ -136614,7 +136776,7 @@ var init_update_check = __esm({
|
|
|
136614
136776
|
|
|
136615
136777
|
// ../dashboard/src/cli-package-version.ts
|
|
136616
136778
|
import { existsSync as existsSync30, readFileSync as readFileSync10 } from "node:fs";
|
|
136617
|
-
import { dirname as
|
|
136779
|
+
import { dirname as dirname15, resolve as resolve22 } from "node:path";
|
|
136618
136780
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
136619
136781
|
function readCliPackageVersion(pkgPath) {
|
|
136620
136782
|
if (!existsSync30(pkgPath)) {
|
|
@@ -136635,15 +136797,21 @@ function readCliPackageVersion(pkgPath) {
|
|
|
136635
136797
|
function resolveCliPackageVersionInfo(startDir) {
|
|
136636
136798
|
let currentDir = startDir;
|
|
136637
136799
|
for (let i = 0; i < 8; i += 1) {
|
|
136638
|
-
const
|
|
136639
|
-
|
|
136640
|
-
|
|
136641
|
-
|
|
136642
|
-
|
|
136643
|
-
|
|
136644
|
-
|
|
136645
|
-
|
|
136646
|
-
|
|
136800
|
+
const versionInfo = readCliPackageVersion(resolve22(currentDir, "package.json"));
|
|
136801
|
+
if (versionInfo) {
|
|
136802
|
+
return versionInfo;
|
|
136803
|
+
}
|
|
136804
|
+
const parentDir = resolve22(currentDir, "..");
|
|
136805
|
+
if (parentDir === currentDir) {
|
|
136806
|
+
break;
|
|
136807
|
+
}
|
|
136808
|
+
currentDir = parentDir;
|
|
136809
|
+
}
|
|
136810
|
+
currentDir = startDir;
|
|
136811
|
+
for (let i = 0; i < 8; i += 1) {
|
|
136812
|
+
const versionInfo = readCliPackageVersion(resolve22(currentDir, "..", "cli", "package.json"));
|
|
136813
|
+
if (versionInfo) {
|
|
136814
|
+
return versionInfo;
|
|
136647
136815
|
}
|
|
136648
136816
|
const parentDir = resolve22(currentDir, "..");
|
|
136649
136817
|
if (parentDir === currentDir) {
|
|
@@ -136654,7 +136822,7 @@ function resolveCliPackageVersionInfo(startDir) {
|
|
|
136654
136822
|
return null;
|
|
136655
136823
|
}
|
|
136656
136824
|
function getCliPackageVersion(importMetaUrl = import.meta.url) {
|
|
136657
|
-
const startDir =
|
|
136825
|
+
const startDir = dirname15(fileURLToPath4(importMetaUrl));
|
|
136658
136826
|
return resolveCliPackageVersionInfo(startDir)?.version ?? process.env.npm_package_version ?? "0.0.0";
|
|
136659
136827
|
}
|
|
136660
136828
|
var CLI_PACKAGE_NAME;
|
|
@@ -140843,7 +141011,7 @@ var init_todo_routes = __esm({
|
|
|
140843
141011
|
|
|
140844
141012
|
// ../dashboard/src/dev-server-detect.ts
|
|
140845
141013
|
import { glob, readFile as readFile20 } from "node:fs/promises";
|
|
140846
|
-
import { dirname as
|
|
141014
|
+
import { dirname as dirname16, join as join46, relative as relative11, resolve as resolve23 } from "node:path";
|
|
140847
141015
|
async function readPackageJson(filePath) {
|
|
140848
141016
|
try {
|
|
140849
141017
|
const raw = await readFile20(filePath, "utf-8");
|
|
@@ -140913,7 +141081,7 @@ function extractScripts(pkg) {
|
|
|
140913
141081
|
return output;
|
|
140914
141082
|
}
|
|
140915
141083
|
function toSource(projectRoot, packageJsonPath) {
|
|
140916
|
-
const packageDir =
|
|
141084
|
+
const packageDir = dirname16(packageJsonPath);
|
|
140917
141085
|
const rel = relative11(projectRoot, packageDir).replace(/\\/g, "/");
|
|
140918
141086
|
return rel.length > 0 ? rel : "root";
|
|
140919
141087
|
}
|
|
@@ -140987,7 +141155,7 @@ var init_dev_server_detect = __esm({
|
|
|
140987
141155
|
|
|
140988
141156
|
// ../dashboard/src/dev-server-store.ts
|
|
140989
141157
|
import { mkdir as mkdir18, readFile as readFile21, writeFile as writeFile16 } from "node:fs/promises";
|
|
140990
|
-
import { dirname as
|
|
141158
|
+
import { dirname as dirname17, join as join47, resolve as resolve24 } from "node:path";
|
|
140991
141159
|
function devServerFilePath(projectDir) {
|
|
140992
141160
|
return join47(resolve24(projectDir), ".fusion", "dev-server.json");
|
|
140993
141161
|
}
|
|
@@ -141073,7 +141241,7 @@ var init_dev_server_store = __esm({
|
|
|
141073
141241
|
}
|
|
141074
141242
|
}
|
|
141075
141243
|
async save() {
|
|
141076
|
-
const dir2 =
|
|
141244
|
+
const dir2 = dirname17(this.filePath);
|
|
141077
141245
|
const payload = {
|
|
141078
141246
|
state: this.state,
|
|
141079
141247
|
config: this.config
|
|
@@ -141302,7 +141470,7 @@ function detectPortFromLogLine(line) {
|
|
|
141302
141470
|
return detectViteLine(cleanLine) ?? detectNextLine(cleanLine) ?? detectStorybookLine(cleanLine) ?? detectAngularLine(cleanLine) ?? detectGenericUrl(cleanLine) ?? detectGenericPortLine(cleanLine);
|
|
141303
141471
|
}
|
|
141304
141472
|
function probePort(host, port, timeoutMs) {
|
|
141305
|
-
return new Promise((
|
|
141473
|
+
return new Promise((resolve38) => {
|
|
141306
141474
|
let settled = false;
|
|
141307
141475
|
const socket = createConnection({ host, port });
|
|
141308
141476
|
const settle = (isOpen) => {
|
|
@@ -141316,7 +141484,7 @@ function probePort(host, port, timeoutMs) {
|
|
|
141316
141484
|
} else {
|
|
141317
141485
|
socket.destroy();
|
|
141318
141486
|
}
|
|
141319
|
-
|
|
141487
|
+
resolve38(isOpen);
|
|
141320
141488
|
};
|
|
141321
141489
|
socket.setTimeout(timeoutMs);
|
|
141322
141490
|
socket.once("connect", () => settle(true));
|
|
@@ -141443,8 +141611,8 @@ var init_dev_server_process = __esm({
|
|
|
141443
141611
|
stdio: ["pipe", "pipe", "pipe"]
|
|
141444
141612
|
});
|
|
141445
141613
|
this.childProcess = child;
|
|
141446
|
-
this.closePromise = new Promise((
|
|
141447
|
-
this.resolveClosePromise =
|
|
141614
|
+
this.closePromise = new Promise((resolve38) => {
|
|
141615
|
+
this.resolveClosePromise = resolve38;
|
|
141448
141616
|
});
|
|
141449
141617
|
const runningState = await this.store.updateState({
|
|
141450
141618
|
pid: child.pid,
|
|
@@ -144632,15 +144800,15 @@ Description: ${step.description}`
|
|
|
144632
144800
|
return;
|
|
144633
144801
|
}
|
|
144634
144802
|
}
|
|
144635
|
-
const { resolve:
|
|
144803
|
+
const { resolve: resolve38, dirname: dirname29, join: join67 } = await import("node:path");
|
|
144636
144804
|
const { readdir: readdir12, stat: stat12 } = await import("node:fs/promises");
|
|
144637
144805
|
const rawPath = req.query.path || process.env.HOME || process.env.USERPROFILE || "/";
|
|
144638
144806
|
const showHidden = req.query.showHidden === "true";
|
|
144639
|
-
const resolvedPath =
|
|
144807
|
+
const resolvedPath = resolve38(rawPath);
|
|
144640
144808
|
if (rawPath.includes("..")) {
|
|
144641
144809
|
throw badRequest("Path must not contain '..' traversal");
|
|
144642
144810
|
}
|
|
144643
|
-
if (resolvedPath !==
|
|
144811
|
+
if (resolvedPath !== resolve38(resolvedPath)) {
|
|
144644
144812
|
throw badRequest("Path must be absolute");
|
|
144645
144813
|
}
|
|
144646
144814
|
let pathStat;
|
|
@@ -150198,7 +150366,7 @@ var init_auth_middleware = __esm({
|
|
|
150198
150366
|
// ../dashboard/src/server.ts
|
|
150199
150367
|
import express from "express";
|
|
150200
150368
|
import { randomUUID as randomUUID20 } from "node:crypto";
|
|
150201
|
-
import { join as join49, dirname as
|
|
150369
|
+
import { join as join49, dirname as dirname18 } from "node:path";
|
|
150202
150370
|
import { existsSync as existsSync32, readFileSync as readFileSync12 } from "node:fs";
|
|
150203
150371
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
150204
150372
|
import { createSecureServer as createHttp2SecureServer } from "node:http2";
|
|
@@ -150380,7 +150548,7 @@ function createServer(store, options) {
|
|
|
150380
150548
|
}
|
|
150381
150549
|
getTerminalService(store.getRootDir());
|
|
150382
150550
|
const isHeadless = options?.headless === true;
|
|
150383
|
-
const execDir =
|
|
150551
|
+
const execDir = dirname18(process.execPath);
|
|
150384
150552
|
const clientDir = process.env.FUSION_CLIENT_DIR ? process.env.FUSION_CLIENT_DIR : existsSync32(join49(execDir, "client", "index.html")) ? join49(execDir, "client") : existsSync32(join49(__dirname, "..", "dist", "client")) ? join49(__dirname, "..", "dist", "client") : join49(__dirname, "..", "client");
|
|
150385
150553
|
if (!isHeadless) {
|
|
150386
150554
|
app.get("/version.json", (_req, res) => {
|
|
@@ -151245,7 +151413,7 @@ var init_server = __esm({
|
|
|
151245
151413
|
init_auth_middleware();
|
|
151246
151414
|
init_remote_auth();
|
|
151247
151415
|
init_cli_package_version();
|
|
151248
|
-
__dirname =
|
|
151416
|
+
__dirname = dirname18(fileURLToPath5(import.meta.url));
|
|
151249
151417
|
DEFAULT_AI_SESSION_TTL_MS = SESSION_CLEANUP_DEFAULT_MAX_AGE_MS;
|
|
151250
151418
|
MIN_AI_SESSION_TTL_MS = 10 * 60 * 1e3;
|
|
151251
151419
|
MAX_AI_SESSION_TTL_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
@@ -151259,11 +151427,11 @@ var init_server = __esm({
|
|
|
151259
151427
|
});
|
|
151260
151428
|
|
|
151261
151429
|
// ../dashboard/src/skills-adapter.ts
|
|
151262
|
-
import { access as
|
|
151263
|
-
import { join as join50, relative as relative12, dirname as
|
|
151430
|
+
import { access as access11, readFile as readFile22, writeFile as writeFile17, mkdir as mkdir19, readdir as readdir10, stat as stat10 } from "node:fs/promises";
|
|
151431
|
+
import { join as join50, relative as relative12, dirname as dirname19 } from "node:path";
|
|
151264
151432
|
async function pathExists(path5) {
|
|
151265
151433
|
try {
|
|
151266
|
-
await
|
|
151434
|
+
await access11(path5);
|
|
151267
151435
|
return true;
|
|
151268
151436
|
} catch {
|
|
151269
151437
|
return false;
|
|
@@ -151356,7 +151524,7 @@ function createSkillsAdapter(options) {
|
|
|
151356
151524
|
throw new Error(`Skill not found: ${skillId}`);
|
|
151357
151525
|
}
|
|
151358
151526
|
const settingsPath = options.getSettingsPath(rootDir);
|
|
151359
|
-
const settingsDir =
|
|
151527
|
+
const settingsDir = dirname19(settingsPath);
|
|
151360
151528
|
if (!await pathExists(settingsDir)) {
|
|
151361
151529
|
await mkdir19(settingsDir, { recursive: true });
|
|
151362
151530
|
}
|
|
@@ -151512,9 +151680,9 @@ function createSkillsAdapter(options) {
|
|
|
151512
151680
|
let skillDir = skill.path;
|
|
151513
151681
|
try {
|
|
151514
151682
|
const skillPathStat = await stat10(skill.path);
|
|
151515
|
-
skillDir = skillPathStat.isFile() ?
|
|
151683
|
+
skillDir = skillPathStat.isFile() ? dirname19(skill.path) : skill.path;
|
|
151516
151684
|
} catch {
|
|
151517
|
-
skillDir =
|
|
151685
|
+
skillDir = dirname19(skill.path);
|
|
151518
151686
|
}
|
|
151519
151687
|
const skillMdPath = join50(skillDir, "SKILL.md");
|
|
151520
151688
|
let skillMd = "";
|
|
@@ -151921,7 +152089,7 @@ var init_task_lifecycle = __esm({
|
|
|
151921
152089
|
// src/commands/port-prompt.ts
|
|
151922
152090
|
import { createInterface } from "node:readline";
|
|
151923
152091
|
function promptForPort(defaultPort = 4040, input = process.stdin) {
|
|
151924
|
-
return new Promise((
|
|
152092
|
+
return new Promise((resolve38, reject2) => {
|
|
151925
152093
|
const rl = createInterface({
|
|
151926
152094
|
input,
|
|
151927
152095
|
output: process.stdout
|
|
@@ -151938,7 +152106,7 @@ function promptForPort(defaultPort = 4040, input = process.stdin) {
|
|
|
151938
152106
|
if (trimmed === "") {
|
|
151939
152107
|
process.removeListener("SIGINT", sigintHandler);
|
|
151940
152108
|
rl.close();
|
|
151941
|
-
|
|
152109
|
+
resolve38(defaultPort);
|
|
151942
152110
|
return;
|
|
151943
152111
|
}
|
|
151944
152112
|
const port = parseInt(trimmed, 10);
|
|
@@ -151954,7 +152122,7 @@ function promptForPort(defaultPort = 4040, input = process.stdin) {
|
|
|
151954
152122
|
}
|
|
151955
152123
|
process.removeListener("SIGINT", sigintHandler);
|
|
151956
152124
|
rl.close();
|
|
151957
|
-
|
|
152125
|
+
resolve38(port);
|
|
151958
152126
|
});
|
|
151959
152127
|
};
|
|
151960
152128
|
ask();
|
|
@@ -151968,12 +152136,12 @@ var init_port_prompt = __esm({
|
|
|
151968
152136
|
|
|
151969
152137
|
// src/commands/provider-settings.ts
|
|
151970
152138
|
import { existsSync as existsSync33, readFileSync as readFileSync13, writeFileSync as writeFileSync2, mkdirSync as mkdirSync6 } from "node:fs";
|
|
151971
|
-
import { join as join51, dirname as
|
|
152139
|
+
import { join as join51, dirname as dirname20, basename as basename15 } from "node:path";
|
|
151972
152140
|
function siblingAgentDir2(agentDir, siblingRoot) {
|
|
151973
152141
|
if (basename15(agentDir) !== "agent") {
|
|
151974
152142
|
return void 0;
|
|
151975
152143
|
}
|
|
151976
|
-
return join51(
|
|
152144
|
+
return join51(dirname20(dirname20(agentDir)), siblingRoot, "agent");
|
|
151977
152145
|
}
|
|
151978
152146
|
function readJsonObject4(path5) {
|
|
151979
152147
|
if (!existsSync33(path5)) {
|
|
@@ -152245,7 +152413,7 @@ var init_auth_paths2 = __esm({
|
|
|
152245
152413
|
});
|
|
152246
152414
|
|
|
152247
152415
|
// src/project-context.ts
|
|
152248
|
-
import { resolve as resolve26, dirname as
|
|
152416
|
+
import { resolve as resolve26, dirname as dirname21, basename as basename16 } from "node:path";
|
|
152249
152417
|
async function resolveProject(projectNameFlag, cwd = process.cwd(), globalDir) {
|
|
152250
152418
|
const central = new CentralCore(globalDir);
|
|
152251
152419
|
await central.init();
|
|
@@ -152350,7 +152518,7 @@ async function detectProjectFromCwd(cwd, central) {
|
|
|
152350
152518
|
path: currentDir
|
|
152351
152519
|
};
|
|
152352
152520
|
}
|
|
152353
|
-
const parentDir =
|
|
152521
|
+
const parentDir = dirname21(currentDir);
|
|
152354
152522
|
if (parentDir === currentDir) {
|
|
152355
152523
|
break;
|
|
152356
152524
|
}
|
|
@@ -152402,7 +152570,7 @@ import {
|
|
|
152402
152570
|
symlinkSync,
|
|
152403
152571
|
unlinkSync
|
|
152404
152572
|
} from "node:fs";
|
|
152405
|
-
import { dirname as
|
|
152573
|
+
import { dirname as dirname22, join as join53, resolve as resolve27 } from "node:path";
|
|
152406
152574
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
152407
152575
|
function isPiClaudeCliConfigured(globalSettings) {
|
|
152408
152576
|
if (!globalSettings || typeof globalSettings !== "object") {
|
|
@@ -152422,7 +152590,7 @@ function isPiClaudeCliConfigured(globalSettings) {
|
|
|
152422
152590
|
}
|
|
152423
152591
|
function resolveFusionSkillSource() {
|
|
152424
152592
|
const here = fileURLToPath6(import.meta.url);
|
|
152425
|
-
const candidate = resolve27(
|
|
152593
|
+
const candidate = resolve27(dirname22(here), "..", "..", "skill", FUSION_SKILL_NAME);
|
|
152426
152594
|
return existsSync36(candidate) ? candidate : null;
|
|
152427
152595
|
}
|
|
152428
152596
|
function installFusionSkillIntoProject(projectPath, options = {}) {
|
|
@@ -152439,13 +152607,13 @@ function installFusionSkillIntoProject(projectPath, options = {}) {
|
|
|
152439
152607
|
};
|
|
152440
152608
|
}
|
|
152441
152609
|
try {
|
|
152442
|
-
mkdirSync7(
|
|
152610
|
+
mkdirSync7(dirname22(target), { recursive: true });
|
|
152443
152611
|
let replaced = false;
|
|
152444
152612
|
if (existsSync36(target) || isBrokenSymlink(target)) {
|
|
152445
152613
|
const stat12 = lstatSync2(target);
|
|
152446
152614
|
if (stat12.isSymbolicLink()) {
|
|
152447
152615
|
const current = safeReadlink(target);
|
|
152448
|
-
if (current && resolve27(
|
|
152616
|
+
if (current && resolve27(dirname22(target), current) === resolve27(source)) {
|
|
152449
152617
|
return { outcome: "already-installed", target, source };
|
|
152450
152618
|
}
|
|
152451
152619
|
unlinkSync(target);
|
|
@@ -152610,11 +152778,11 @@ var init_claude_skills_runner = __esm({
|
|
|
152610
152778
|
// src/commands/claude-cli-extension.ts
|
|
152611
152779
|
import { existsSync as existsSync37, readFileSync as readFileSync16 } from "node:fs";
|
|
152612
152780
|
import { createRequire as createRequire4 } from "node:module";
|
|
152613
|
-
import { dirname as
|
|
152781
|
+
import { dirname as dirname23, resolve as resolve28 } from "node:path";
|
|
152614
152782
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
152615
152783
|
function resolveClaudeCliExtensionFromModuleUrl(moduleUrl) {
|
|
152616
152784
|
let pkgJsonPath;
|
|
152617
|
-
const here =
|
|
152785
|
+
const here = dirname23(fileURLToPath7(moduleUrl));
|
|
152618
152786
|
for (const rel of ["pi-claude-cli", "../pi-claude-cli", "../../pi-claude-cli"]) {
|
|
152619
152787
|
const candidate = resolve28(here, rel, "package.json");
|
|
152620
152788
|
if (existsSync37(candidate)) {
|
|
@@ -152652,7 +152820,7 @@ function resolveClaudeCliExtensionFromModuleUrl(moduleUrl) {
|
|
|
152652
152820
|
reason: "@fusion/pi-claude-cli pi.extensions[0] is not a valid path string"
|
|
152653
152821
|
};
|
|
152654
152822
|
}
|
|
152655
|
-
const entryPath = resolve28(
|
|
152823
|
+
const entryPath = resolve28(dirname23(pkgJsonPath), rawEntry);
|
|
152656
152824
|
if (!existsSync37(entryPath)) {
|
|
152657
152825
|
return {
|
|
152658
152826
|
status: "missing-entry",
|
|
@@ -152741,10 +152909,10 @@ var init_update_cache = __esm({
|
|
|
152741
152909
|
|
|
152742
152910
|
// src/commands/self-extension.ts
|
|
152743
152911
|
import { existsSync as existsSync38, readFileSync as readFileSync18 } from "node:fs";
|
|
152744
|
-
import { dirname as
|
|
152912
|
+
import { dirname as dirname24, resolve as resolve29 } from "node:path";
|
|
152745
152913
|
import { fileURLToPath as fileURLToPath8 } from "node:url";
|
|
152746
152914
|
function resolveSelfExtension() {
|
|
152747
|
-
const here =
|
|
152915
|
+
const here = dirname24(fileURLToPath8(import.meta.url));
|
|
152748
152916
|
let pkgDir;
|
|
152749
152917
|
let cur = here;
|
|
152750
152918
|
for (let i = 0; i < 5; i++) {
|
|
@@ -152909,32 +153077,11 @@ var init_state = __esm({
|
|
|
152909
153077
|
});
|
|
152910
153078
|
|
|
152911
153079
|
// src/commands/dashboard-tui/logo.ts
|
|
152912
|
-
import { existsSync as existsSync39, readFileSync as readFileSync19 } from "node:fs";
|
|
152913
|
-
import { dirname as dirname24, resolve as resolve30 } from "node:path";
|
|
152914
|
-
import { fileURLToPath as fileURLToPath9 } from "node:url";
|
|
152915
|
-
function readFusionVersion() {
|
|
152916
|
-
try {
|
|
152917
|
-
let cur = dirname24(fileURLToPath9(import.meta.url));
|
|
152918
|
-
for (let i = 0; i < 6; i++) {
|
|
152919
|
-
const pkgPath = resolve30(cur, "package.json");
|
|
152920
|
-
if (existsSync39(pkgPath)) {
|
|
152921
|
-
const parsed = JSON.parse(readFileSync19(pkgPath, "utf-8"));
|
|
152922
|
-
if (parsed.name === "@runfusion/fusion" && typeof parsed.version === "string") {
|
|
152923
|
-
return parsed.version;
|
|
152924
|
-
}
|
|
152925
|
-
}
|
|
152926
|
-
const parent2 = resolve30(cur, "..");
|
|
152927
|
-
if (parent2 === cur) break;
|
|
152928
|
-
cur = parent2;
|
|
152929
|
-
}
|
|
152930
|
-
} catch {
|
|
152931
|
-
}
|
|
152932
|
-
return "unknown";
|
|
152933
|
-
}
|
|
152934
153080
|
var FUSION_LOGO_LINES, FUSION_LOGO_LARGE_LINES, FUSION_TAGLINE, FUSION_URL, FUSION_VERSION2;
|
|
152935
153081
|
var init_logo = __esm({
|
|
152936
153082
|
"src/commands/dashboard-tui/logo.ts"() {
|
|
152937
153083
|
"use strict";
|
|
153084
|
+
init_src4();
|
|
152938
153085
|
FUSION_LOGO_LINES = [
|
|
152939
153086
|
"\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2557",
|
|
152940
153087
|
"\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551",
|
|
@@ -152959,7 +153106,7 @@ var init_logo = __esm({
|
|
|
152959
153106
|
];
|
|
152960
153107
|
FUSION_TAGLINE = "multi node agent orchestrator";
|
|
152961
153108
|
FUSION_URL = "runfusion.ai";
|
|
152962
|
-
FUSION_VERSION2 =
|
|
153109
|
+
FUSION_VERSION2 = getCliPackageVersion(import.meta.url);
|
|
152963
153110
|
}
|
|
152964
153111
|
});
|
|
152965
153112
|
|
|
@@ -153028,14 +153175,14 @@ async function copyToClipboard(text) {
|
|
|
153028
153175
|
{ cmd: "xsel", args: ["--clipboard", "--input"] }
|
|
153029
153176
|
];
|
|
153030
153177
|
for (const { cmd, args } of candidates) {
|
|
153031
|
-
const ok = await new Promise((
|
|
153178
|
+
const ok = await new Promise((resolve38) => {
|
|
153032
153179
|
try {
|
|
153033
153180
|
const child = spawn11(cmd, args, { stdio: ["pipe", "ignore", "ignore"] });
|
|
153034
|
-
child.once("error", () =>
|
|
153035
|
-
child.once("close", (code) =>
|
|
153181
|
+
child.once("error", () => resolve38(false));
|
|
153182
|
+
child.once("close", (code) => resolve38(code === 0));
|
|
153036
153183
|
child.stdin.end(text);
|
|
153037
153184
|
} catch {
|
|
153038
|
-
|
|
153185
|
+
resolve38(false);
|
|
153039
153186
|
}
|
|
153040
153187
|
});
|
|
153041
153188
|
if (ok) return true;
|
|
@@ -157096,8 +157243,8 @@ async function resolveCachedStartupUpdateStatus(importMetaUrl) {
|
|
|
157096
157243
|
try {
|
|
157097
157244
|
const updateCheckEnabled = await Promise.race([
|
|
157098
157245
|
isUpdateCheckEnabled(),
|
|
157099
|
-
new Promise((
|
|
157100
|
-
setTimeout(() =>
|
|
157246
|
+
new Promise((resolve38) => {
|
|
157247
|
+
setTimeout(() => resolve38(false), 3e3);
|
|
157101
157248
|
})
|
|
157102
157249
|
]);
|
|
157103
157250
|
if (!updateCheckEnabled) {
|
|
@@ -158149,10 +158296,14 @@ async function runDashboard(port, opts = {}) {
|
|
|
158149
158296
|
if (isEphemeralAgent(agent)) continue;
|
|
158150
158297
|
if (agent.state !== "active" && agent.state !== "running") continue;
|
|
158151
158298
|
const rc = agent.runtimeConfig;
|
|
158152
|
-
triggerScheduler.registerAgent(
|
|
158153
|
-
|
|
158154
|
-
|
|
158155
|
-
|
|
158299
|
+
triggerScheduler.registerAgent(
|
|
158300
|
+
agent.id,
|
|
158301
|
+
{
|
|
158302
|
+
heartbeatIntervalMs: rc?.heartbeatIntervalMs,
|
|
158303
|
+
maxConcurrentRuns: rc?.maxConcurrentRuns
|
|
158304
|
+
},
|
|
158305
|
+
{ lastHeartbeatAt: agent.lastHeartbeatAt }
|
|
158306
|
+
);
|
|
158156
158307
|
}
|
|
158157
158308
|
if (agents.length > 0) {
|
|
158158
158309
|
logSink.log(`Registered ${triggerScheduler.getRegisteredAgents().length} agents for heartbeat triggers`, "engine");
|
|
@@ -159766,8 +159917,8 @@ async function runServe(port, opts = {}) {
|
|
|
159766
159917
|
https: loadTlsCredentialsFromEnv()
|
|
159767
159918
|
});
|
|
159768
159919
|
const server = app.listen(selectedPort, selectedHost);
|
|
159769
|
-
await new Promise((
|
|
159770
|
-
server.once("listening",
|
|
159920
|
+
await new Promise((resolve38, reject2) => {
|
|
159921
|
+
server.once("listening", resolve38);
|
|
159771
159922
|
server.once("error", reject2);
|
|
159772
159923
|
});
|
|
159773
159924
|
const actualPort = server.address().port;
|
|
@@ -160286,8 +160437,8 @@ async function runDaemon(opts = {}) {
|
|
|
160286
160437
|
https: loadTlsCredentialsFromEnv()
|
|
160287
160438
|
});
|
|
160288
160439
|
const server = app.listen(selectedPort, selectedHost);
|
|
160289
|
-
await new Promise((
|
|
160290
|
-
server.once("listening",
|
|
160440
|
+
await new Promise((resolve38, reject2) => {
|
|
160441
|
+
server.once("listening", resolve38);
|
|
160291
160442
|
server.once("error", reject2);
|
|
160292
160443
|
});
|
|
160293
160444
|
const actualPort = server.address().port;
|
|
@@ -160401,7 +160552,7 @@ import { once as once2 } from "node:events";
|
|
|
160401
160552
|
import { join as join58 } from "node:path";
|
|
160402
160553
|
import { createRequire as createRequire5 } from "node:module";
|
|
160403
160554
|
function runCommand(command, args, cwd) {
|
|
160404
|
-
return new Promise((
|
|
160555
|
+
return new Promise((resolve38, reject2) => {
|
|
160405
160556
|
const child = spawn13(command, args, {
|
|
160406
160557
|
cwd,
|
|
160407
160558
|
stdio: "inherit",
|
|
@@ -160410,7 +160561,7 @@ function runCommand(command, args, cwd) {
|
|
|
160410
160561
|
child.on("error", (error) => reject2(error));
|
|
160411
160562
|
child.on("exit", (code) => {
|
|
160412
160563
|
if (code === 0) {
|
|
160413
|
-
|
|
160564
|
+
resolve38();
|
|
160414
160565
|
return;
|
|
160415
160566
|
}
|
|
160416
160567
|
reject2(new Error(`${command} ${args.join(" ")} exited with code ${code ?? "unknown"}`));
|
|
@@ -160453,8 +160604,8 @@ async function startDashboardRuntime(rootDir, paused) {
|
|
|
160453
160604
|
};
|
|
160454
160605
|
}
|
|
160455
160606
|
async function closeDashboardRuntime(runtime) {
|
|
160456
|
-
await new Promise((
|
|
160457
|
-
runtime.server.close(() =>
|
|
160607
|
+
await new Promise((resolve38) => {
|
|
160608
|
+
runtime.server.close(() => resolve38());
|
|
160458
160609
|
});
|
|
160459
160610
|
runtime.store.close();
|
|
160460
160611
|
}
|
|
@@ -160562,7 +160713,7 @@ __export(task_exports, {
|
|
|
160562
160713
|
runTaskUpdate: () => runTaskUpdate
|
|
160563
160714
|
});
|
|
160564
160715
|
import { createInterface as createInterface3 } from "node:readline/promises";
|
|
160565
|
-
import { watchFile, unwatchFile, statSync as statSync6, existsSync as
|
|
160716
|
+
import { watchFile, unwatchFile, statSync as statSync6, existsSync as existsSync39, readFileSync as readFileSync19 } from "node:fs";
|
|
160566
160717
|
import { basename as basename17, join as join59 } from "node:path";
|
|
160567
160718
|
function getGitHubIssueUrl(sourceMetadata) {
|
|
160568
160719
|
if (!sourceMetadata || typeof sourceMetadata !== "object") return void 0;
|
|
@@ -160727,9 +160878,9 @@ async function runTaskCreate(descriptionArg, attachFiles, depends, projectName,
|
|
|
160727
160878
|
console.log(` Path: .fusion/tasks/${task.id}/`);
|
|
160728
160879
|
if (attachFiles && attachFiles.length > 0) {
|
|
160729
160880
|
const { readFile: readFile24 } = await import("node:fs/promises");
|
|
160730
|
-
const { basename: basename22, extname: extname2, resolve:
|
|
160881
|
+
const { basename: basename22, extname: extname2, resolve: resolve38 } = await import("node:path");
|
|
160731
160882
|
for (const filePath of attachFiles) {
|
|
160732
|
-
const resolvedPath =
|
|
160883
|
+
const resolvedPath = resolve38(filePath);
|
|
160733
160884
|
const filename = basename22(resolvedPath);
|
|
160734
160885
|
const ext = extname2(filename).toLowerCase();
|
|
160735
160886
|
const mimeType = MIME_TYPES[ext];
|
|
@@ -160864,7 +161015,7 @@ async function runTaskLogs(id, options = {}, projectName) {
|
|
|
160864
161015
|
if (options.follow) {
|
|
160865
161016
|
const projectPath = projectContext?.projectPath ?? process.cwd();
|
|
160866
161017
|
const logPath = join59(projectPath, ".fusion", "tasks", id, "agent.log");
|
|
160867
|
-
if (!
|
|
161018
|
+
if (!existsSync39(logPath)) {
|
|
160868
161019
|
console.log(`
|
|
160869
161020
|
Waiting for log file to be created...`);
|
|
160870
161021
|
}
|
|
@@ -160893,7 +161044,7 @@ async function runTaskLogs(id, options = {}, projectName) {
|
|
|
160893
161044
|
lastPosition = 0;
|
|
160894
161045
|
}
|
|
160895
161046
|
if (stats.size > lastPosition) {
|
|
160896
|
-
const content =
|
|
161047
|
+
const content = readFileSync19(logPath, "utf-8");
|
|
160897
161048
|
const lines = content.slice(lastPosition).split("\n");
|
|
160898
161049
|
for (const line of lines) {
|
|
160899
161050
|
if (!line.trim()) continue;
|
|
@@ -161027,8 +161178,8 @@ async function runTaskMerge(id, projectName) {
|
|
|
161027
161178
|
async function runTaskAttach(id, filePath, projectName) {
|
|
161028
161179
|
const { readFile: readFile24 } = await import("node:fs/promises");
|
|
161029
161180
|
const { basename: basename22, extname: extname2 } = await import("node:path");
|
|
161030
|
-
const { resolve:
|
|
161031
|
-
const resolvedPath =
|
|
161181
|
+
const { resolve: resolve38 } = await import("node:path");
|
|
161182
|
+
const resolvedPath = resolve38(filePath);
|
|
161032
161183
|
const filename = basename22(resolvedPath);
|
|
161033
161184
|
const ext = extname2(filename).toLowerCase();
|
|
161034
161185
|
const mimeType = MIME_TYPES[ext];
|
|
@@ -161567,12 +161718,12 @@ async function promptText(question) {
|
|
|
161567
161718
|
console.log(" (Enter your response. Type DONE on its own line when finished):\n");
|
|
161568
161719
|
const rl = createInterface3({ input: process.stdin, output: process.stdout });
|
|
161569
161720
|
const lines = [];
|
|
161570
|
-
return new Promise((
|
|
161721
|
+
return new Promise((resolve38) => {
|
|
161571
161722
|
const askLine = () => {
|
|
161572
161723
|
rl.question(" ").then((line) => {
|
|
161573
161724
|
if (line.trim() === "DONE") {
|
|
161574
161725
|
rl.close();
|
|
161575
|
-
|
|
161726
|
+
resolve38(lines.join("\n"));
|
|
161576
161727
|
} else {
|
|
161577
161728
|
lines.push(line);
|
|
161578
161729
|
askLine();
|
|
@@ -162141,7 +162292,7 @@ __export(settings_export_exports, {
|
|
|
162141
162292
|
runSettingsExport: () => runSettingsExport
|
|
162142
162293
|
});
|
|
162143
162294
|
import { writeFile as writeFile18 } from "node:fs/promises";
|
|
162144
|
-
import { resolve as
|
|
162295
|
+
import { resolve as resolve30, join as join60 } from "node:path";
|
|
162145
162296
|
async function runSettingsExport(options = {}) {
|
|
162146
162297
|
const scope = options.scope ?? "both";
|
|
162147
162298
|
const project = options.projectName ? await resolveProject(options.projectName) : void 0;
|
|
@@ -162152,7 +162303,7 @@ async function runSettingsExport(options = {}) {
|
|
|
162152
162303
|
const exportData = await exportSettings(store, { scope });
|
|
162153
162304
|
let targetPath;
|
|
162154
162305
|
if (outputPath) {
|
|
162155
|
-
targetPath =
|
|
162306
|
+
targetPath = resolve30(outputPath);
|
|
162156
162307
|
} else {
|
|
162157
162308
|
const filename = generateExportFilename();
|
|
162158
162309
|
targetPath = join60(process.cwd(), filename);
|
|
@@ -162201,8 +162352,8 @@ var settings_import_exports = {};
|
|
|
162201
162352
|
__export(settings_import_exports, {
|
|
162202
162353
|
runSettingsImport: () => runSettingsImport
|
|
162203
162354
|
});
|
|
162204
|
-
import { existsSync as
|
|
162205
|
-
import { resolve as
|
|
162355
|
+
import { existsSync as existsSync40 } from "node:fs";
|
|
162356
|
+
import { resolve as resolve31 } from "node:path";
|
|
162206
162357
|
async function runSettingsImport(filePath, options = {}) {
|
|
162207
162358
|
const scope = options.scope ?? "both";
|
|
162208
162359
|
const project = options.projectName ? await resolveProject(options.projectName) : void 0;
|
|
@@ -162211,8 +162362,8 @@ async function runSettingsImport(filePath, options = {}) {
|
|
|
162211
162362
|
const merge = options.merge ?? true;
|
|
162212
162363
|
const skipConfirm = options.yes ?? false;
|
|
162213
162364
|
try {
|
|
162214
|
-
const resolvedPath =
|
|
162215
|
-
if (!
|
|
162365
|
+
const resolvedPath = resolve31(filePath);
|
|
162366
|
+
if (!existsSync40(resolvedPath)) {
|
|
162216
162367
|
console.error(`Error: File not found: ${filePath}`);
|
|
162217
162368
|
process.exit(1);
|
|
162218
162369
|
}
|
|
@@ -162685,8 +162836,8 @@ var init_backup2 = __esm({
|
|
|
162685
162836
|
});
|
|
162686
162837
|
|
|
162687
162838
|
// src/project-resolver.ts
|
|
162688
|
-
import { existsSync as
|
|
162689
|
-
import { basename as basename18, dirname as dirname25, resolve as
|
|
162839
|
+
import { existsSync as existsSync41, statSync as statSync7 } from "node:fs";
|
|
162840
|
+
import { basename as basename18, dirname as dirname25, resolve as resolve32, normalize as normalize5 } from "node:path";
|
|
162690
162841
|
import { createInterface as createInterface5 } from "node:readline/promises";
|
|
162691
162842
|
async function getCentralCore() {
|
|
162692
162843
|
if (!centralCoreInstance) {
|
|
@@ -162703,9 +162854,9 @@ async function getProjectManager() {
|
|
|
162703
162854
|
return projectManagerInstance;
|
|
162704
162855
|
}
|
|
162705
162856
|
function findKbDir(startPath) {
|
|
162706
|
-
let current =
|
|
162857
|
+
let current = resolve32(startPath);
|
|
162707
162858
|
for (let i = 0; i < 100; i++) {
|
|
162708
|
-
const dbPath =
|
|
162859
|
+
const dbPath = resolve32(current, ".fusion", "fusion.db");
|
|
162709
162860
|
if (isValidSqliteDatabaseFile(dbPath)) {
|
|
162710
162861
|
return current;
|
|
162711
162862
|
}
|
|
@@ -162761,7 +162912,7 @@ async function resolveProject2(options = {}) {
|
|
|
162761
162912
|
{ searchedName: options.project, availableProjects: projects.map((p) => p.name) }
|
|
162762
162913
|
);
|
|
162763
162914
|
}
|
|
162764
|
-
if (!
|
|
162915
|
+
if (!existsSync41(match.path)) {
|
|
162765
162916
|
throw new ProjectResolutionError(
|
|
162766
162917
|
`Project "${match.name}" is registered but the directory no longer exists: ${match.path}
|
|
162767
162918
|
|
|
@@ -162772,14 +162923,14 @@ Run \`fn project remove ` + match.name + "` to clean up the registry entry.",
|
|
|
162772
162923
|
}
|
|
162773
162924
|
return createResolvedProject(match);
|
|
162774
162925
|
}
|
|
162775
|
-
const cwd = options.cwd ?
|
|
162926
|
+
const cwd = options.cwd ? resolve32(options.cwd) : process.cwd();
|
|
162776
162927
|
const fusionDir = findKbDir(cwd);
|
|
162777
162928
|
if (fusionDir) {
|
|
162778
162929
|
const allProjects2 = await central.listProjects();
|
|
162779
162930
|
const normalizedKbDir = normalize5(fusionDir);
|
|
162780
162931
|
const match = allProjects2.find((p) => normalize5(p.path) === normalizedKbDir);
|
|
162781
162932
|
if (match) {
|
|
162782
|
-
if (!
|
|
162933
|
+
if (!existsSync41(match.path)) {
|
|
162783
162934
|
throw new ProjectResolutionError(
|
|
162784
162935
|
`Project "${match.name}" is registered but the directory no longer exists: ${match.path}
|
|
162785
162936
|
|
|
@@ -162844,7 +162995,7 @@ Run \`fn project add ` + fusionDir + "` to register it, or use --project <name>.
|
|
|
162844
162995
|
}
|
|
162845
162996
|
if (allProjects.length === 1) {
|
|
162846
162997
|
const project = allProjects[0];
|
|
162847
|
-
if (!
|
|
162998
|
+
if (!existsSync41(project.path)) {
|
|
162848
162999
|
throw new ProjectResolutionError(
|
|
162849
163000
|
`The only registered project "${project.name}" has a missing directory: ${project.path}
|
|
162850
163001
|
|
|
@@ -163284,8 +163435,8 @@ __export(project_exports, {
|
|
|
163284
163435
|
runProjectSetDefault: () => runProjectSetDefault,
|
|
163285
163436
|
runProjectShow: () => runProjectShow
|
|
163286
163437
|
});
|
|
163287
|
-
import { resolve as
|
|
163288
|
-
import { existsSync as
|
|
163438
|
+
import { resolve as resolve33, isAbsolute as isAbsolute18, relative as relative13, basename as basename19 } from "node:path";
|
|
163439
|
+
import { existsSync as existsSync42, statSync as statSync8 } from "node:fs";
|
|
163289
163440
|
import { createInterface as createInterface7 } from "node:readline/promises";
|
|
163290
163441
|
function formatDisplayPath(projectPath) {
|
|
163291
163442
|
const rel = relative13(process.cwd(), projectPath);
|
|
@@ -163413,8 +163564,8 @@ async function runProjectAdd(name, path5, options = {}) {
|
|
|
163413
163564
|
const pathInput = await rl.question(` Project path [${defaultPath}]: `);
|
|
163414
163565
|
projectPath = pathInput.trim() || defaultPath;
|
|
163415
163566
|
}
|
|
163416
|
-
const absolutePath2 = isAbsolute18(projectPath) ? projectPath :
|
|
163417
|
-
if (!
|
|
163567
|
+
const absolutePath2 = isAbsolute18(projectPath) ? projectPath : resolve33(process.cwd(), projectPath);
|
|
163568
|
+
if (!existsSync42(absolutePath2)) {
|
|
163418
163569
|
console.error(`
|
|
163419
163570
|
\u2717 Path does not exist: ${projectPath}`);
|
|
163420
163571
|
rl.close();
|
|
@@ -163426,8 +163577,8 @@ async function runProjectAdd(name, path5, options = {}) {
|
|
|
163426
163577
|
rl.close();
|
|
163427
163578
|
process.exit(1);
|
|
163428
163579
|
}
|
|
163429
|
-
const kbDbPath2 =
|
|
163430
|
-
if (!
|
|
163580
|
+
const kbDbPath2 = resolve33(absolutePath2, ".fusion", "fusion.db");
|
|
163581
|
+
if (!existsSync42(kbDbPath2) && !options.force) {
|
|
163431
163582
|
console.log(`
|
|
163432
163583
|
No fn project found at ${formatDisplayPath(absolutePath2)}`);
|
|
163433
163584
|
const init = await rl.question(" Initialize fn here first? [Y/n] ");
|
|
@@ -163458,8 +163609,8 @@ async function runProjectAdd(name, path5, options = {}) {
|
|
|
163458
163609
|
console.error(" Name must be 1-64 characters and contain only: a-z, A-Z, 0-9, _, -\n");
|
|
163459
163610
|
process.exit(1);
|
|
163460
163611
|
}
|
|
163461
|
-
const absolutePath = isAbsolute18(projectPath) ? projectPath :
|
|
163462
|
-
if (!
|
|
163612
|
+
const absolutePath = isAbsolute18(projectPath) ? projectPath : resolve33(process.cwd(), projectPath);
|
|
163613
|
+
if (!existsSync42(absolutePath)) {
|
|
163463
163614
|
console.error(`
|
|
163464
163615
|
\u2717 Path does not exist: ${projectPath}
|
|
163465
163616
|
`);
|
|
@@ -163471,8 +163622,8 @@ async function runProjectAdd(name, path5, options = {}) {
|
|
|
163471
163622
|
`);
|
|
163472
163623
|
process.exit(1);
|
|
163473
163624
|
}
|
|
163474
|
-
const kbDbPath =
|
|
163475
|
-
if (!
|
|
163625
|
+
const kbDbPath = resolve33(absolutePath, ".fusion", "fusion.db");
|
|
163626
|
+
if (!existsSync42(kbDbPath) && !options.force) {
|
|
163476
163627
|
console.error(`
|
|
163477
163628
|
\u2717 No fn project found at ${formatDisplayPath(absolutePath)}`);
|
|
163478
163629
|
console.error(" Run `fn init` first to initialize the project.\n");
|
|
@@ -163728,10 +163879,10 @@ var init_project = __esm({
|
|
|
163728
163879
|
});
|
|
163729
163880
|
|
|
163730
163881
|
// src/commands/skill-installation.ts
|
|
163731
|
-
import { cpSync as cpSync2, existsSync as
|
|
163882
|
+
import { cpSync as cpSync2, existsSync as existsSync43, mkdirSync as mkdirSync8 } from "node:fs";
|
|
163732
163883
|
import { homedir as homedir9 } from "node:os";
|
|
163733
|
-
import { dirname as dirname26, join as join61, resolve as
|
|
163734
|
-
import { fileURLToPath as
|
|
163884
|
+
import { dirname as dirname26, join as join61, resolve as resolve34 } from "node:path";
|
|
163885
|
+
import { fileURLToPath as fileURLToPath9 } from "node:url";
|
|
163735
163886
|
function getSupportedSkillInstallTargets(homeDir = process.env.HOME || process.env.USERPROFILE || homedir9()) {
|
|
163736
163887
|
return [
|
|
163737
163888
|
{ client: "claude", targetDir: join61(homeDir, ".claude", "skills", FUSION_SKILL_NAME2) },
|
|
@@ -163740,9 +163891,9 @@ function getSupportedSkillInstallTargets(homeDir = process.env.HOME || process.e
|
|
|
163740
163891
|
];
|
|
163741
163892
|
}
|
|
163742
163893
|
function resolveBundledFusionSkillSource() {
|
|
163743
|
-
const here =
|
|
163744
|
-
const source =
|
|
163745
|
-
return
|
|
163894
|
+
const here = fileURLToPath9(import.meta.url);
|
|
163895
|
+
const source = resolve34(dirname26(here), "..", "..", "skill", FUSION_SKILL_NAME2);
|
|
163896
|
+
return existsSync43(source) ? source : null;
|
|
163746
163897
|
}
|
|
163747
163898
|
function installBundledFusionSkill(options = {}) {
|
|
163748
163899
|
const sourceDir = options.sourceDir ?? resolveBundledFusionSkillSource();
|
|
@@ -163760,7 +163911,7 @@ function installBundledFusionSkill(options = {}) {
|
|
|
163760
163911
|
}
|
|
163761
163912
|
const results = targets.map((target) => {
|
|
163762
163913
|
try {
|
|
163763
|
-
if (
|
|
163914
|
+
if (existsSync43(target.targetDir)) {
|
|
163764
163915
|
return {
|
|
163765
163916
|
client: target.client,
|
|
163766
163917
|
targetDir: target.targetDir,
|
|
@@ -163799,17 +163950,17 @@ var init_exports = {};
|
|
|
163799
163950
|
__export(init_exports, {
|
|
163800
163951
|
runInit: () => runInit
|
|
163801
163952
|
});
|
|
163802
|
-
import { existsSync as
|
|
163803
|
-
import { join as join62, resolve as
|
|
163953
|
+
import { existsSync as existsSync44, mkdirSync as mkdirSync9, writeFileSync as writeFileSync3, readFileSync as readFileSync20 } from "node:fs";
|
|
163954
|
+
import { join as join62, resolve as resolve35, basename as basename20 } from "node:path";
|
|
163804
163955
|
import { exec as exec11 } from "node:child_process";
|
|
163805
163956
|
import { promisify as promisify17 } from "node:util";
|
|
163806
163957
|
async function runInit(options = {}) {
|
|
163807
|
-
const cwd = options.path ?
|
|
163958
|
+
const cwd = options.path ? resolve35(options.path) : process.cwd();
|
|
163808
163959
|
const fusionDir = join62(cwd, ".fusion");
|
|
163809
163960
|
const dbPath = join62(fusionDir, "fusion.db");
|
|
163810
|
-
const hasDbPath =
|
|
163961
|
+
const hasDbPath = existsSync44(dbPath);
|
|
163811
163962
|
const hasValidDb = hasDbPath && isValidSqliteDatabaseFile(dbPath);
|
|
163812
|
-
if (
|
|
163963
|
+
if (existsSync44(fusionDir) && hasDbPath && hasValidDb) {
|
|
163813
163964
|
const central2 = new CentralCore();
|
|
163814
163965
|
await central2.init();
|
|
163815
163966
|
const existing = await central2.getProjectByPath(cwd);
|
|
@@ -163831,7 +163982,7 @@ async function runInit(options = {}) {
|
|
|
163831
163982
|
await central2.close();
|
|
163832
163983
|
return;
|
|
163833
163984
|
}
|
|
163834
|
-
if (
|
|
163985
|
+
if (existsSync44(fusionDir) && hasDbPath && !hasValidDb) {
|
|
163835
163986
|
throw new Error(
|
|
163836
163987
|
`Existing database at ${dbPath} is not a valid SQLite database. Restore it from .fusion/backups or move it aside before re-running fn init.`
|
|
163837
163988
|
);
|
|
@@ -163839,7 +163990,7 @@ async function runInit(options = {}) {
|
|
|
163839
163990
|
const projectName = options.name ?? await detectProjectName(cwd);
|
|
163840
163991
|
console.log(`Initializing fn project: "${projectName}"`);
|
|
163841
163992
|
console.log(` Path: ${cwd}`);
|
|
163842
|
-
if (!
|
|
163993
|
+
if (!existsSync44(fusionDir)) {
|
|
163843
163994
|
mkdirSync9(fusionDir, { recursive: true });
|
|
163844
163995
|
console.log(` \u2713 Created .fusion/ directory`);
|
|
163845
163996
|
}
|
|
@@ -163852,7 +164003,7 @@ async function runInit(options = {}) {
|
|
|
163852
164003
|
}
|
|
163853
164004
|
await addLocalStorageToGitignore(cwd);
|
|
163854
164005
|
await warnIfQmdMissing();
|
|
163855
|
-
if (!
|
|
164006
|
+
if (!existsSync44(dbPath)) {
|
|
163856
164007
|
writeFileSync3(dbPath, "");
|
|
163857
164008
|
console.log(` \u2713 Created fusion.db`);
|
|
163858
164009
|
}
|
|
@@ -163902,7 +164053,7 @@ async function runInit(options = {}) {
|
|
|
163902
164053
|
}
|
|
163903
164054
|
}
|
|
163904
164055
|
async function detectProjectName(dir2) {
|
|
163905
|
-
if (!
|
|
164056
|
+
if (!existsSync44(join62(dir2, ".git"))) {
|
|
163906
164057
|
return basename20(dir2) || "my-project";
|
|
163907
164058
|
}
|
|
163908
164059
|
try {
|
|
@@ -163924,9 +164075,9 @@ async function detectProjectName(dir2) {
|
|
|
163924
164075
|
async function addLocalStorageToGitignore(cwd) {
|
|
163925
164076
|
const gitignorePath = join62(cwd, ".gitignore");
|
|
163926
164077
|
let content = "";
|
|
163927
|
-
if (
|
|
164078
|
+
if (existsSync44(gitignorePath)) {
|
|
163928
164079
|
try {
|
|
163929
|
-
content =
|
|
164080
|
+
content = readFileSync20(gitignorePath, "utf-8");
|
|
163930
164081
|
} catch {
|
|
163931
164082
|
}
|
|
163932
164083
|
}
|
|
@@ -163966,7 +164117,7 @@ async function initializeGitRepo(cwd) {
|
|
|
163966
164117
|
await ensureGitConfig(cwd, "user.name", "Fusion");
|
|
163967
164118
|
await ensureGitConfig(cwd, "user.email", "noreply@runfusion.ai");
|
|
163968
164119
|
const gitkeepPath = join62(cwd, ".gitkeep");
|
|
163969
|
-
if (!
|
|
164120
|
+
if (!existsSync44(gitkeepPath)) {
|
|
163970
164121
|
writeFileSync3(gitkeepPath, "\n");
|
|
163971
164122
|
}
|
|
163972
164123
|
await execAsync11("git add .gitkeep", { cwd, timeout: 1e4 });
|
|
@@ -164104,8 +164255,8 @@ var agent_import_exports = {};
|
|
|
164104
164255
|
__export(agent_import_exports, {
|
|
164105
164256
|
runAgentImport: () => runAgentImport
|
|
164106
164257
|
});
|
|
164107
|
-
import { existsSync as
|
|
164108
|
-
import { resolve as
|
|
164258
|
+
import { existsSync as existsSync45, mkdirSync as mkdirSync10, readFileSync as readFileSync21, statSync as statSync9, writeFileSync as writeFileSync4 } from "node:fs";
|
|
164259
|
+
import { resolve as resolve36 } from "node:path";
|
|
164109
164260
|
function slugifyPathSegment(input) {
|
|
164110
164261
|
if (!input || typeof input !== "string") {
|
|
164111
164262
|
return "unnamed";
|
|
@@ -164154,16 +164305,16 @@ async function importSkillsToProject(projectPath, skills, companySlug, dryRun) {
|
|
|
164154
164305
|
errors: []
|
|
164155
164306
|
};
|
|
164156
164307
|
const companyDir = slugifyPathSegment(companySlug ?? "unknown-company");
|
|
164157
|
-
const baseSkillsDir =
|
|
164308
|
+
const baseSkillsDir = resolve36(projectPath, "skills", "imported", companyDir);
|
|
164158
164309
|
for (const skill of skills) {
|
|
164159
164310
|
if (!skill.name || typeof skill.name !== "string" || skill.name.trim().length === 0) {
|
|
164160
164311
|
result.errors.push({ name: "(unnamed)", error: "Skill is missing required 'name' field" });
|
|
164161
164312
|
continue;
|
|
164162
164313
|
}
|
|
164163
164314
|
const skillSlug = slugifyPathSegment(skill.name);
|
|
164164
|
-
const skillDir =
|
|
164165
|
-
const skillPath =
|
|
164166
|
-
if (
|
|
164315
|
+
const skillDir = resolve36(baseSkillsDir, skillSlug);
|
|
164316
|
+
const skillPath = resolve36(skillDir, "SKILL.md");
|
|
164317
|
+
if (existsSync45(skillPath)) {
|
|
164167
164318
|
result.skipped.push(skill.name);
|
|
164168
164319
|
continue;
|
|
164169
164320
|
}
|
|
@@ -164235,8 +164386,8 @@ function isArchivePath(path5) {
|
|
|
164235
164386
|
async function runAgentImport(source, options) {
|
|
164236
164387
|
const dryRun = options?.dryRun ?? false;
|
|
164237
164388
|
const skipExisting = options?.skipExisting ?? false;
|
|
164238
|
-
const sourcePath =
|
|
164239
|
-
if (!
|
|
164389
|
+
const sourcePath = resolve36(source);
|
|
164390
|
+
if (!existsSync45(sourcePath)) {
|
|
164240
164391
|
console.error(`Path not found: ${sourcePath}`);
|
|
164241
164392
|
process.exit(1);
|
|
164242
164393
|
}
|
|
@@ -164282,7 +164433,7 @@ async function runAgentImport(source, options) {
|
|
|
164282
164433
|
isPackageImport = true;
|
|
164283
164434
|
({ items: importItems, result } = prepareAgentCompaniesImport(pkg, conversionOptions));
|
|
164284
164435
|
} else if (sourcePath.endsWith(".md")) {
|
|
164285
|
-
const content =
|
|
164436
|
+
const content = readFileSync21(sourcePath, "utf-8");
|
|
164286
164437
|
const { manifest } = parseSingleAgentManifest(content);
|
|
164287
164438
|
const pkg = {
|
|
164288
164439
|
company: void 0,
|
|
@@ -164374,7 +164525,7 @@ var agent_export_exports = {};
|
|
|
164374
164525
|
__export(agent_export_exports, {
|
|
164375
164526
|
runAgentExport: () => runAgentExport
|
|
164376
164527
|
});
|
|
164377
|
-
import { resolve as
|
|
164528
|
+
import { resolve as resolve37 } from "node:path";
|
|
164378
164529
|
async function getProjectPath4(projectName) {
|
|
164379
164530
|
if (projectName) {
|
|
164380
164531
|
const context = await resolveProject(projectName);
|
|
@@ -164412,7 +164563,7 @@ async function runAgentExport(outputDir, options) {
|
|
|
164412
164563
|
console.error("No agents found to export");
|
|
164413
164564
|
process.exit(1);
|
|
164414
164565
|
}
|
|
164415
|
-
const result = await exportAgentsToDirectory(agents,
|
|
164566
|
+
const result = await exportAgentsToDirectory(agents, resolve37(outputDir), {
|
|
164416
164567
|
companyName: options?.companyName,
|
|
164417
164568
|
companySlug: options?.companySlug
|
|
164418
164569
|
});
|
|
@@ -164631,7 +164782,7 @@ __export(plugin_exports, {
|
|
|
164631
164782
|
runPluginList: () => runPluginList,
|
|
164632
164783
|
runPluginUninstall: () => runPluginUninstall
|
|
164633
164784
|
});
|
|
164634
|
-
import { existsSync as
|
|
164785
|
+
import { existsSync as existsSync46 } from "node:fs";
|
|
164635
164786
|
import { join as join63 } from "node:path";
|
|
164636
164787
|
import { readFile as readFile23 } from "node:fs/promises";
|
|
164637
164788
|
import * as readline from "node:readline";
|
|
@@ -164671,7 +164822,7 @@ async function createPluginLoader(pluginStore, projectName) {
|
|
|
164671
164822
|
}
|
|
164672
164823
|
async function loadManifestFromPath(pluginPath) {
|
|
164673
164824
|
const manifestPath = join63(pluginPath, "manifest.json");
|
|
164674
|
-
if (!
|
|
164825
|
+
if (!existsSync46(manifestPath)) {
|
|
164675
164826
|
throw new Error(`Plugin manifest not found at: ${manifestPath}`);
|
|
164676
164827
|
}
|
|
164677
164828
|
const content = await readFile23(manifestPath, "utf-8");
|
|
@@ -164729,7 +164880,7 @@ async function runPluginInstall(source, options) {
|
|
|
164729
164880
|
console.error("Please provide a local path to the plugin directory.");
|
|
164730
164881
|
process.exit(1);
|
|
164731
164882
|
}
|
|
164732
|
-
if (!
|
|
164883
|
+
if (!existsSync46(source)) {
|
|
164733
164884
|
console.error(`Plugin path does not exist: ${source}`);
|
|
164734
164885
|
process.exit(1);
|
|
164735
164886
|
}
|
|
@@ -164774,14 +164925,14 @@ async function runPluginUninstall(id, options) {
|
|
|
164774
164925
|
console.log(` Uninstall "${plugin4.name}"?`);
|
|
164775
164926
|
console.log(` This will stop and remove the plugin.`);
|
|
164776
164927
|
console.log();
|
|
164777
|
-
const response = await new Promise((
|
|
164928
|
+
const response = await new Promise((resolve38) => {
|
|
164778
164929
|
const rl = readline.createInterface({
|
|
164779
164930
|
input: process.stdin,
|
|
164780
164931
|
output: process.stdout
|
|
164781
164932
|
});
|
|
164782
164933
|
rl.question(" Continue? [y/N] ", (answer) => {
|
|
164783
164934
|
rl.close();
|
|
164784
|
-
|
|
164935
|
+
resolve38(answer.toLowerCase());
|
|
164785
164936
|
});
|
|
164786
164937
|
});
|
|
164787
164938
|
if (response !== "y" && response !== "yes") {
|
|
@@ -164861,7 +165012,7 @@ var plugin_scaffold_exports = {};
|
|
|
164861
165012
|
__export(plugin_scaffold_exports, {
|
|
164862
165013
|
runPluginCreate: () => runPluginCreate
|
|
164863
165014
|
});
|
|
164864
|
-
import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync5, existsSync as
|
|
165015
|
+
import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync5, existsSync as existsSync47 } from "node:fs";
|
|
164865
165016
|
import { join as join64 } from "node:path";
|
|
164866
165017
|
function toTitleCase(str) {
|
|
164867
165018
|
return str.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
@@ -164996,7 +165147,7 @@ async function runPluginCreate(name, options) {
|
|
|
164996
165147
|
}
|
|
164997
165148
|
const targetDir = options?.output ?? name;
|
|
164998
165149
|
const targetPath = join64(process.cwd(), targetDir);
|
|
164999
|
-
if (
|
|
165150
|
+
if (existsSync47(targetPath)) {
|
|
165000
165151
|
console.error(`Error: Directory '${targetDir}' already exists.`);
|
|
165001
165152
|
console.error("Please choose a different name or remove the existing directory.");
|
|
165002
165153
|
process.exit(1);
|
|
@@ -165129,9 +165280,9 @@ async function runSkillsInstall(args, options) {
|
|
|
165129
165280
|
stdio: "inherit",
|
|
165130
165281
|
shell: true
|
|
165131
165282
|
});
|
|
165132
|
-
const exitCode = await new Promise((
|
|
165283
|
+
const exitCode = await new Promise((resolve38, reject2) => {
|
|
165133
165284
|
child.on("exit", (code) => {
|
|
165134
|
-
|
|
165285
|
+
resolve38(code ?? 1);
|
|
165135
165286
|
});
|
|
165136
165287
|
child.on("error", (err) => {
|
|
165137
165288
|
reject2(err);
|
|
@@ -165163,7 +165314,7 @@ __export(native_patch_exports, {
|
|
|
165163
165314
|
setupNativeResolution: () => setupNativeResolution
|
|
165164
165315
|
});
|
|
165165
165316
|
import { join as join65, basename as basename21, dirname as dirname27 } from "node:path";
|
|
165166
|
-
import { existsSync as
|
|
165317
|
+
import { existsSync as existsSync48, copyFileSync, mkdirSync as mkdirSync12, symlinkSync as symlinkSync2, rmSync as rmSync5, lstatSync as lstatSync3, readlinkSync as readlinkSync2 } from "node:fs";
|
|
165167
165318
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
165168
165319
|
function findStagedNativeDir2() {
|
|
165169
165320
|
const platform3 = process.platform === "darwin" ? "darwin" : process.platform === "linux" ? "linux" : process.platform === "win32" ? "win32" : "unknown";
|
|
@@ -165171,12 +165322,12 @@ function findStagedNativeDir2() {
|
|
|
165171
165322
|
const prebuildName = `${platform3}-${arch}`;
|
|
165172
165323
|
const execDir = dirname27(process.execPath);
|
|
165173
165324
|
const nextToBinary = join65(execDir, "runtime", prebuildName);
|
|
165174
|
-
if (
|
|
165325
|
+
if (existsSync48(join65(nextToBinary, "pty.node"))) {
|
|
165175
165326
|
return nextToBinary;
|
|
165176
165327
|
}
|
|
165177
165328
|
if (process.env.FUSION_RUNTIME_DIR) {
|
|
165178
165329
|
const envPath = join65(process.env.FUSION_RUNTIME_DIR, prebuildName);
|
|
165179
|
-
if (
|
|
165330
|
+
if (existsSync48(join65(envPath, "pty.node"))) {
|
|
165180
165331
|
return envPath;
|
|
165181
165332
|
}
|
|
165182
165333
|
}
|
|
@@ -165186,11 +165337,11 @@ function cleanupStaleBunfsLinks() {
|
|
|
165186
165337
|
if (process.platform === "win32") return;
|
|
165187
165338
|
const bunfsRoot = "/$bunfs/root";
|
|
165188
165339
|
try {
|
|
165189
|
-
if (
|
|
165340
|
+
if (existsSync48(bunfsRoot)) {
|
|
165190
165341
|
const stats = lstatSync3(bunfsRoot);
|
|
165191
165342
|
if (stats.isSymbolicLink()) {
|
|
165192
165343
|
const target = readlinkSync2(bunfsRoot);
|
|
165193
|
-
if (target.includes("fn-bunfs-") && !
|
|
165344
|
+
if (target.includes("fn-bunfs-") && !existsSync48(target)) {
|
|
165194
165345
|
rmSync5(bunfsRoot);
|
|
165195
165346
|
console.log("[fn-native-patch] Cleaned up stale /$bunfs/root symlink");
|
|
165196
165347
|
}
|
|
@@ -165218,14 +165369,14 @@ function setupNativeResolution() {
|
|
|
165218
165369
|
mkdirSync12(platformDir, { recursive: true });
|
|
165219
165370
|
const ptyNodeDest = join65(platformDir, "pty.node");
|
|
165220
165371
|
copyFileSync(join65(nativeDir, "pty.node"), ptyNodeDest);
|
|
165221
|
-
if (
|
|
165372
|
+
if (existsSync48(join65(nativeDir, "spawn-helper"))) {
|
|
165222
165373
|
copyFileSync(join65(nativeDir, "spawn-helper"), join65(platformDir, "spawn-helper"));
|
|
165223
165374
|
}
|
|
165224
165375
|
process.env.FUSION_FAKE_BUNFS_ROOT = tmpRoot;
|
|
165225
165376
|
if (process.platform !== "win32") {
|
|
165226
165377
|
const bunfsRoot = "/$bunfs/root";
|
|
165227
165378
|
try {
|
|
165228
|
-
if (
|
|
165379
|
+
if (existsSync48(bunfsRoot)) {
|
|
165229
165380
|
const stats = lstatSync3(bunfsRoot);
|
|
165230
165381
|
if (stats.isSymbolicLink()) {
|
|
165231
165382
|
rmSync5(bunfsRoot);
|
|
@@ -165248,7 +165399,7 @@ function setupNativeResolution() {
|
|
|
165248
165399
|
function cleanupNativeResolution() {
|
|
165249
165400
|
if (bunfsSymlinkPath && process.platform !== "win32") {
|
|
165250
165401
|
try {
|
|
165251
|
-
if (
|
|
165402
|
+
if (existsSync48(bunfsSymlinkPath)) {
|
|
165252
165403
|
const stats = lstatSync3(bunfsSymlinkPath);
|
|
165253
165404
|
if (stats.isSymbolicLink()) {
|
|
165254
165405
|
rmSync5(bunfsSymlinkPath);
|
|
@@ -165294,7 +165445,7 @@ var init_native_patch = __esm({
|
|
|
165294
165445
|
});
|
|
165295
165446
|
|
|
165296
165447
|
// src/bin.ts
|
|
165297
|
-
import { existsSync as
|
|
165448
|
+
import { existsSync as existsSync49, mkdtempSync as mkdtempSync2, readFileSync as readFileSync22, symlinkSync as symlinkSync3, writeFileSync as writeFileSync6 } from "node:fs";
|
|
165298
165449
|
import { createRequire as createRequire6 } from "node:module";
|
|
165299
165450
|
import { join as join66, dirname as dirname28 } from "node:path";
|
|
165300
165451
|
import { tmpdir as tmpdir5 } from "node:os";
|
|
@@ -165314,10 +165465,10 @@ function configurePiPackage() {
|
|
|
165314
165465
|
const require4 = createRequire6(import.meta.url);
|
|
165315
165466
|
const piPackagePath = require4.resolve("@mariozechner/pi-coding-agent/package.json");
|
|
165316
165467
|
const piPackageDir = dirname28(piPackagePath);
|
|
165317
|
-
packageJson = JSON.parse(
|
|
165468
|
+
packageJson = JSON.parse(readFileSync22(piPackagePath, "utf-8"));
|
|
165318
165469
|
for (const entry of ["dist", "docs", "examples", "README.md", "CHANGELOG.md"]) {
|
|
165319
165470
|
const source = join66(piPackageDir, entry);
|
|
165320
|
-
if (
|
|
165471
|
+
if (existsSync49(source)) {
|
|
165321
165472
|
symlinkSync3(source, join66(tmp, entry));
|
|
165322
165473
|
}
|
|
165323
165474
|
}
|
|
@@ -165336,8 +165487,8 @@ setInterval(() => {
|
|
|
165336
165487
|
performance3.clearMarks();
|
|
165337
165488
|
}, 3e4).unref();
|
|
165338
165489
|
function loadEnvFile(path5) {
|
|
165339
|
-
if (!
|
|
165340
|
-
const contents =
|
|
165490
|
+
if (!existsSync49(path5)) return;
|
|
165491
|
+
const contents = readFileSync22(path5, "utf-8");
|
|
165341
165492
|
for (const rawLine of contents.split(/\r?\n/)) {
|
|
165342
165493
|
const line = rawLine.trim();
|
|
165343
165494
|
if (!line || line.startsWith("#")) continue;
|