@primeinc/swarm 0.57.8-beta.0 → 0.57.10-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12735,6 +12735,8 @@ __export(exports_dist, {
12735
12735
  pgliteExists: () => pgliteExists,
12736
12736
  parseMemoryJSONL: () => parseMemoryJSONL,
12737
12737
  parseJSONL: () => parseJSONL,
12738
+ normalizeProjectKey: () => normalizeProjectKey,
12739
+ normalizePath: () => normalize3,
12738
12740
  needsMigration: () => needsMigration,
12739
12741
  migrateToGlobal: () => migrateToGlobal,
12740
12742
  migrateProjectToGlobal: () => migrateProjectToGlobal,
@@ -12887,15 +12889,15 @@ __export(exports_dist, {
12887
12889
  });
12888
12890
  import { createRequire as createRequire2 } from "node:module";
12889
12891
  import { existsSync, readFileSync, statSync } from "node:fs";
12890
- import { join as join8, resolve } from "node:path";
12892
+ import { join as join9, resolve } from "node:path";
12891
12893
  import { createClient } from "@libsql/client";
12892
12894
  import { existsSync as existsSync2 } from "node:fs";
12893
- import { join as join9 } from "node:path";
12895
+ import { join as join10 } from "node:path";
12894
12896
  import { createClient as createClient2 } from "@libsql/client";
12895
12897
  import { createClient as createClient3 } from "@libsql/client";
12896
12898
  import { existsSync as existsSync3, renameSync } from "node:fs";
12897
12899
  import { homedir } from "node:os";
12898
- import { join as join10 } from "node:path";
12900
+ import { join as join11 } from "node:path";
12899
12901
  import { createClient as createClient4 } from "@libsql/client";
12900
12902
  import { createHash } from "node:crypto";
12901
12903
  import { basename } from "node:path";
@@ -12904,23 +12906,28 @@ import { webcrypto as crypto2 } from "node:crypto";
12904
12906
  import { EventEmitter } from "node:events";
12905
12907
  import { existsSync as existsSync4, mkdirSync } from "node:fs";
12906
12908
  import { homedir as homedir2 } from "node:os";
12907
- import { join as join12 } from "node:path";
12909
+ import { join as join13 } from "node:path";
12908
12910
  import { randomBytes } from "node:crypto";
12911
+ import { createRequire as createRequire22 } from "module";
12912
+ import { dirname, join } from "path";
12913
+ import { fileURLToPath } from "url";
12914
+ import path3 from "node:path";
12915
+ import path2 from "node:path";
12909
12916
  import { readFileSync as readFileSync2, existsSync as existsSync5 } from "node:fs";
12910
- import { join as join13 } from "node:path";
12917
+ import { join as join14 } from "node:path";
12911
12918
  import { createHash as createHash2 } from "node:crypto";
12912
12919
  import { existsSync as existsSync6 } from "node:fs";
12913
12920
  import { readFile, writeFile } from "node:fs/promises";
12914
12921
  import { existsSync as existsSync7 } from "node:fs";
12915
12922
  import { homedir as homedir3 } from "node:os";
12916
- import { join as join14 } from "node:path";
12917
- import { existsSync as existsSync8, readFileSync as readFileSync3, writeFileSync } from "node:fs";
12918
12923
  import { join as join15 } from "node:path";
12924
+ import { existsSync as existsSync8, readFileSync as readFileSync3, writeFileSync } from "node:fs";
12925
+ import { join as join16 } from "node:path";
12919
12926
  import { createClient as createClient5 } from "@libsql/client";
12920
12927
  import { createClient as createClient6 } from "@libsql/client";
12921
12928
  import { createClient as createClient7 } from "@libsql/client";
12922
12929
  import { existsSync as existsSync9, readdirSync, renameSync as renameSync2 } from "node:fs";
12923
- import { join as join16 } from "node:path";
12930
+ import { join as join17 } from "node:path";
12924
12931
  import { readFileSync as readFileSync4 } from "node:fs";
12925
12932
  import { EventEmitter as EventEmitter3 } from "node:events";
12926
12933
  import { EventEmitter as EventEmitter2 } from "node:events";
@@ -12935,7 +12942,7 @@ import { realpath as fsrealpath, lstat as lstat2, open, stat as stat2 } from "no
12935
12942
  import { type as osType } from "node:os";
12936
12943
  import * as sp from "node:path";
12937
12944
  import { promises as fs } from "node:fs";
12938
- import * as path2 from "node:path";
12945
+ import * as path4 from "node:path";
12939
12946
  function pipe2(a, ab, bc, cd, de, ef, fg, gh, hi) {
12940
12947
  switch (arguments.length) {
12941
12948
  case 1:
@@ -23705,7 +23712,7 @@ function SortedSet(value9, ordA) {
23705
23712
  });
23706
23713
  }
23707
23714
  function isWorktree(path) {
23708
- const gitPath = join8(path, ".git");
23715
+ const gitPath = join9(path, ".git");
23709
23716
  if (!existsSync(gitPath)) {
23710
23717
  return false;
23711
23718
  }
@@ -23720,7 +23727,7 @@ function getMainRepoPath(path) {
23720
23727
  if (!isWorktree(path)) {
23721
23728
  return path;
23722
23729
  }
23723
- const gitFilePath = join8(path, ".git");
23730
+ const gitFilePath = join9(path, ".git");
23724
23731
  const gitFileContent = readFileSync(gitFilePath, "utf-8");
23725
23732
  const match43 = gitFileContent.match(/^gitdir:\s*(.+)$/m);
23726
23733
  if (!match43 || !match43[1]) {
@@ -24082,7 +24089,7 @@ function wrapPGlite(pglite) {
24082
24089
  };
24083
24090
  }
24084
24091
  function pgliteExists(path) {
24085
- const pgVersionPath = join9(path, "PG_VERSION");
24092
+ const pgVersionPath = join10(path, "PG_VERSION");
24086
24093
  return existsSync2(pgVersionPath);
24087
24094
  }
24088
24095
  async function migratePGliteToLibSQL(options2) {
@@ -24889,22 +24896,42 @@ async function validateLibSQLStreamsSchema(db) {
24889
24896
  return false;
24890
24897
  }
24891
24898
  }
24899
+ function renameSyncWithRetry(oldPath, newPath, maxRetries = 5, initialDelayMs = 50) {
24900
+ let lastError;
24901
+ for (let attempt3 = 0;attempt3 < maxRetries; attempt3++) {
24902
+ try {
24903
+ renameSync(oldPath, newPath);
24904
+ return;
24905
+ } catch (err) {
24906
+ lastError = err;
24907
+ const isEBUSY = err instanceof Error && (err.message.includes("EBUSY") || err.code === "EBUSY");
24908
+ if (!isEBUSY || attempt3 === maxRetries - 1) {
24909
+ throw err;
24910
+ }
24911
+ const delay4 = initialDelayMs * Math.pow(2, attempt3);
24912
+ const sharedBuffer = new SharedArrayBuffer(4);
24913
+ const int322 = new Int32Array(sharedBuffer);
24914
+ Atomics.wait(int322, 0, 0, delay4);
24915
+ }
24916
+ }
24917
+ throw lastError;
24918
+ }
24892
24919
  function needsMigration(projectPath) {
24893
- const libsqlPath = join10(projectPath, ".opencode", "streams.db");
24894
- const pglitePath = join10(projectPath, ".opencode", "streams");
24920
+ const libsqlPath = join11(projectPath, ".opencode", "streams.db");
24921
+ const pglitePath = join11(projectPath, ".opencode", "streams");
24895
24922
  return existsSync3(libsqlPath) || existsSync3(pglitePath);
24896
24923
  }
24897
24924
  function getGlobalDbPath() {
24898
- return join10(homedir(), ".config", "swarm-tools", "swarm.db");
24925
+ return join11(homedir(), ".config", "swarm-tools", "swarm.db");
24899
24926
  }
24900
24927
  function detectSourceType(projectPath) {
24901
- const libsqlPath = join10(projectPath, ".opencode", "streams.db");
24902
- const pglitePath = join10(projectPath, ".opencode", "streams");
24928
+ const libsqlPath = join11(projectPath, ".opencode", "streams.db");
24929
+ const pglitePath = join11(projectPath, ".opencode", "streams");
24903
24930
  if (existsSync3(libsqlPath)) {
24904
24931
  return "libsql";
24905
24932
  }
24906
24933
  if (existsSync3(pglitePath)) {
24907
- const pgVersionPath = join10(pglitePath, "PG_VERSION");
24934
+ const pgVersionPath = join11(pglitePath, "PG_VERSION");
24908
24935
  if (existsSync3(pgVersionPath)) {
24909
24936
  return "pglite";
24910
24937
  }
@@ -24925,10 +24952,10 @@ async function migrateProjectToGlobal(projectPath, globalDbPath = getGlobalDbPat
24925
24952
  let stats;
24926
24953
  let sourcePath;
24927
24954
  if (sourceType === "libsql") {
24928
- sourcePath = join10(projectPath, ".opencode", "streams.db");
24955
+ sourcePath = join11(projectPath, ".opencode", "streams.db");
24929
24956
  stats = await migrateLibSQLToGlobal(sourcePath, globalDb);
24930
24957
  } else {
24931
- sourcePath = join10(projectPath, ".opencode", "streams");
24958
+ sourcePath = join11(projectPath, ".opencode", "streams");
24932
24959
  stats = await migratePGLiteToGlobal(sourcePath, globalDb);
24933
24960
  }
24934
24961
  globalDb.close();
@@ -25128,7 +25155,7 @@ async function migrateLocalDbToGlobal(localDbPath, globalDbPath) {
25128
25155
  }
25129
25156
  localDb.close();
25130
25157
  globalDb.close();
25131
- renameSync(localDbPath, migratedPath);
25158
+ renameSyncWithRetry(localDbPath, migratedPath);
25132
25159
  return stats;
25133
25160
  }
25134
25161
  function backupOldDb(path) {
@@ -25137,7 +25164,7 @@ function backupOldDb(path) {
25137
25164
  }
25138
25165
  const timestamp = new Date().toISOString().replace(/:/g, "-");
25139
25166
  const backupPath = `${path}.backup-${timestamp}`;
25140
- renameSync(path, backupPath);
25167
+ renameSyncWithRetry(path, backupPath);
25141
25168
  return backupPath;
25142
25169
  }
25143
25170
  async function migrateTable(sourceDb, globalDb, tableName, targetColumns, errors22) {
@@ -28632,9 +28659,30 @@ async function initSwarmAgent(options2) {
28632
28659
  taskDescription,
28633
28660
  dbOverride
28634
28661
  } = options2;
28662
+ let uniqueName = agentName;
28663
+ try {
28664
+ const { getOrCreateAdapter: getOrCreateAdapter3 } = await Promise.resolve().then(() => (init_store_drizzle(), exports_store_drizzle));
28665
+ const { toDrizzleDb: toDrizzleDb2 } = await Promise.resolve().then(() => (init_libsql_convenience(), exports_libsql_convenience));
28666
+ const { agentsTable: agentsTable2 } = await Promise.resolve().then(() => (init_streams(), exports_streams));
28667
+ const { and: and4, eq: eq2 } = await Promise.resolve().then(() => (init_drizzle_orm(), exports_drizzle_orm));
28668
+ const adapter5 = await getOrCreateAdapter3(projectPath, dbOverride);
28669
+ const db2 = toDrizzleDb2(adapter5);
28670
+ let attempts = 0;
28671
+ while (attempts < 10) {
28672
+ const exists8 = await db2.select({ id: agentsTable2.id }).from(agentsTable2).where(and4(eq2(agentsTable2.project_key, projectPath), eq2(agentsTable2.name, uniqueName)));
28673
+ if (exists8.length === 0)
28674
+ break;
28675
+ uniqueName = generateSwarmAgentName();
28676
+ attempts++;
28677
+ }
28678
+ if (attempts >= 10) {
28679
+ const short = Math.random().toString(36).slice(2, 6);
28680
+ uniqueName = `${uniqueName}${short.charAt(0).toUpperCase()}${short.slice(1, 2)}`;
28681
+ }
28682
+ } catch (e) {}
28635
28683
  const event = createEvent("agent_registered", {
28636
28684
  project_key: projectPath,
28637
- agent_name: agentName,
28685
+ agent_name: uniqueName,
28638
28686
  program,
28639
28687
  model,
28640
28688
  task_description: taskDescription
@@ -28642,7 +28690,7 @@ async function initSwarmAgent(options2) {
28642
28690
  await appendEvent(event, projectPath, dbOverride);
28643
28691
  return {
28644
28692
  projectKey: projectPath,
28645
- agentName
28693
+ agentName: uniqueName
28646
28694
  };
28647
28695
  }
28648
28696
  async function sendSwarmMessage(options2) {
@@ -29489,11 +29537,11 @@ async function withTiming(operation, fn2) {
29489
29537
  }
29490
29538
  }
29491
29539
  function getDatabasePath2(projectPath) {
29492
- const globalDir = join12(homedir2(), ".config", "swarm-tools");
29540
+ const globalDir = join13(homedir2(), ".config", "swarm-tools");
29493
29541
  if (!existsSync4(globalDir)) {
29494
29542
  mkdirSync(globalDir, { recursive: true });
29495
29543
  }
29496
- const globalDbPath = join12(globalDir, "swarm.db");
29544
+ const globalDbPath = join13(globalDir, "swarm.db");
29497
29545
  if (projectPath) {
29498
29546
  const oldPaths = getOldProjectDbPaths(projectPath);
29499
29547
  if (existsSync4(oldPaths.libsql)) {
@@ -29506,10 +29554,10 @@ function getDatabasePath2(projectPath) {
29506
29554
  }
29507
29555
  function getOldProjectDbPaths(projectPath) {
29508
29556
  const mainRepoPath = getMainRepoPath(projectPath);
29509
- const localDir = join12(mainRepoPath, ".opencode");
29557
+ const localDir = join13(mainRepoPath, ".opencode");
29510
29558
  return {
29511
- libsql: join12(localDir, "streams.db"),
29512
- pglite: join12(localDir, "streams")
29559
+ libsql: join13(localDir, "streams.db"),
29560
+ pglite: join13(localDir, "streams")
29513
29561
  };
29514
29562
  }
29515
29563
  function clearAdapterCache() {
@@ -30907,10 +30955,10 @@ function mergeDefs2(...defs) {
30907
30955
  function cloneDef2(schema) {
30908
30956
  return mergeDefs2(schema._zod.def);
30909
30957
  }
30910
- function getElementAtPath2(obj, path22) {
30911
- if (!path22)
30958
+ function getElementAtPath2(obj, path42) {
30959
+ if (!path42)
30912
30960
  return obj;
30913
- return path22.reduce((acc, key) => acc?.[key], obj);
30961
+ return path42.reduce((acc, key) => acc?.[key], obj);
30914
30962
  }
30915
30963
  function promiseAllObject2(promisesObj) {
30916
30964
  const keys15 = Object.keys(promisesObj);
@@ -31221,11 +31269,11 @@ function aborted2(x, startIndex = 0) {
31221
31269
  }
31222
31270
  return false;
31223
31271
  }
31224
- function prefixIssues2(path22, issues) {
31272
+ function prefixIssues2(path42, issues) {
31225
31273
  return issues.map((iss) => {
31226
31274
  var _a15;
31227
31275
  (_a15 = iss).path ?? (_a15.path = []);
31228
- iss.path.unshift(path22);
31276
+ iss.path.unshift(path42);
31229
31277
  return iss;
31230
31278
  });
31231
31279
  }
@@ -31388,7 +31436,7 @@ function formatError2(error46, mapper = (issue22) => issue22.message) {
31388
31436
  }
31389
31437
  function treeifyError2(error46, mapper = (issue22) => issue22.message) {
31390
31438
  const result = { errors: [] };
31391
- const processError = (error52, path22 = []) => {
31439
+ const processError = (error52, path42 = []) => {
31392
31440
  var _a15, _b15;
31393
31441
  for (const issue22 of error52.issues) {
31394
31442
  if (issue22.code === "invalid_union" && issue22.errors.length) {
@@ -31398,7 +31446,7 @@ function treeifyError2(error46, mapper = (issue22) => issue22.message) {
31398
31446
  } else if (issue22.code === "invalid_element") {
31399
31447
  processError({ issues: issue22.issues }, issue22.path);
31400
31448
  } else {
31401
- const fullpath = [...path22, ...issue22.path];
31449
+ const fullpath = [...path42, ...issue22.path];
31402
31450
  if (fullpath.length === 0) {
31403
31451
  result.errors.push(mapper(issue22));
31404
31452
  continue;
@@ -31430,8 +31478,8 @@ function treeifyError2(error46, mapper = (issue22) => issue22.message) {
31430
31478
  }
31431
31479
  function toDotPath2(_path) {
31432
31480
  const segs = [];
31433
- const path22 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
31434
- for (const seg of path22) {
31481
+ const path42 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
31482
+ for (const seg of path42) {
31435
31483
  if (typeof seg === "number")
31436
31484
  segs.push(`[${seg}]`);
31437
31485
  else if (typeof seg === "symbol")
@@ -34042,13 +34090,13 @@ function resolveRef(ref, ctx) {
34042
34090
  if (!ref.startsWith("#")) {
34043
34091
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
34044
34092
  }
34045
- const path22 = ref.slice(1).split("/").filter(Boolean);
34046
- if (path22.length === 0) {
34093
+ const path42 = ref.slice(1).split("/").filter(Boolean);
34094
+ if (path42.length === 0) {
34047
34095
  return ctx.rootSchema;
34048
34096
  }
34049
34097
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
34050
- if (path22[0] === defsKey) {
34051
- const key = path22[1];
34098
+ if (path42[0] === defsKey) {
34099
+ const key = path42[1];
34052
34100
  if (!key || !ctx.defs[key]) {
34053
34101
  throw new Error(`Reference not found: ${ref}`);
34054
34102
  }
@@ -34511,11 +34559,11 @@ class ParseStatus2 {
34511
34559
  }
34512
34560
 
34513
34561
  class ParseInputLazyPath2 {
34514
- constructor(parent, value10, path22, key) {
34562
+ constructor(parent, value10, path42, key) {
34515
34563
  this._cachedPath = [];
34516
34564
  this.parent = parent;
34517
34565
  this.data = value10;
34518
- this._path = path22;
34566
+ this._path = path42;
34519
34567
  this._key = key;
34520
34568
  }
34521
34569
  get path() {
@@ -39528,6 +39576,201 @@ function createMemoryAdapter(db2, config3) {
39528
39576
  }
39529
39577
  };
39530
39578
  }
39579
+ function detectEnvironment() {
39580
+ if (cachedEnvironment !== null) {
39581
+ return cachedEnvironment;
39582
+ }
39583
+ const platform = process.platform;
39584
+ if (platform === "win32") {
39585
+ cachedEnvironment = "windows";
39586
+ return cachedEnvironment;
39587
+ }
39588
+ if (platform === "darwin") {
39589
+ cachedEnvironment = "darwin";
39590
+ return cachedEnvironment;
39591
+ }
39592
+ if (platform === "linux") {
39593
+ if (process.env.WSL_DISTRO_NAME || process.env.WSLENV) {
39594
+ cachedEnvironment = "wsl";
39595
+ return cachedEnvironment;
39596
+ }
39597
+ const msystem = process.env.MSYSTEM;
39598
+ if (msystem && (msystem.includes("MINGW") || msystem.includes("MSYS"))) {
39599
+ cachedEnvironment = "git-bash";
39600
+ return cachedEnvironment;
39601
+ }
39602
+ if (process.env.CYGWIN) {
39603
+ cachedEnvironment = "cygwin";
39604
+ return cachedEnvironment;
39605
+ }
39606
+ cachedEnvironment = "linux";
39607
+ return cachedEnvironment;
39608
+ }
39609
+ cachedEnvironment = "linux";
39610
+ return cachedEnvironment;
39611
+ }
39612
+ function isAbsolute2(inputPath) {
39613
+ return path2.win32.isAbsolute(inputPath) || path2.posix.isAbsolute(inputPath);
39614
+ }
39615
+ function isUNC(inputPath) {
39616
+ const normalized = inputPath.replace(/\\/g, "/");
39617
+ if (normalized.length < 3) {
39618
+ return false;
39619
+ }
39620
+ if (!normalized.startsWith("//")) {
39621
+ return false;
39622
+ }
39623
+ if (normalized[2] === "/") {
39624
+ return false;
39625
+ }
39626
+ const afterPrefix = normalized.substring(2);
39627
+ const hasValidServerPart = /^[^\s\/]+/.test(afterPrefix);
39628
+ return hasValidServerPart;
39629
+ }
39630
+ function isWSLMount(inputPath) {
39631
+ const wslMountPattern = /^\/mnt\/[a-z](\/|$)/i;
39632
+ return wslMountPattern.test(inputPath);
39633
+ }
39634
+ function isGitBashMount(inputPath) {
39635
+ const gitBashPattern = /^\/[a-z]\//i;
39636
+ return gitBashPattern.test(inputPath);
39637
+ }
39638
+ function hasDriveLetter(inputPath) {
39639
+ const driveLetterPattern = /^[A-Za-z]:/;
39640
+ return driveLetterPattern.test(inputPath);
39641
+ }
39642
+ function parseWSLUNC(inputPath) {
39643
+ const normalized = inputPath.replace(/\\/g, "/");
39644
+ const wslUNCPattern = /^\/\/(wsl\.localhost|wsl\$)\/([^/]+)(\/.*)?$/i;
39645
+ const match44 = normalized.match(wslUNCPattern);
39646
+ if (!match44) {
39647
+ return null;
39648
+ }
39649
+ const distro = match44[2];
39650
+ const restPath = match44[3] || "/";
39651
+ return { distro, path: restPath };
39652
+ }
39653
+ function isDriveRelative(inputPath) {
39654
+ if (inputPath.length < 3) {
39655
+ return false;
39656
+ }
39657
+ const hasLetter = /^[A-Za-z]$/.test(inputPath[0]);
39658
+ const hasColon = inputPath[1] === ":";
39659
+ const notSlash = inputPath[2] !== "/" && inputPath[2] !== "\\";
39660
+ return hasLetter && hasColon && notSlash;
39661
+ }
39662
+ function normalize3(inputPath, options2) {
39663
+ if (inputPath === null || inputPath === undefined) {
39664
+ throw new TypeError("Path cannot be null or undefined");
39665
+ }
39666
+ if (typeof inputPath !== "string") {
39667
+ throw new TypeError(`Path must be a string, received ${typeof inputPath}`);
39668
+ }
39669
+ if (inputPath.length === 0) {
39670
+ throw new TypeError("Path cannot be empty");
39671
+ }
39672
+ if (inputPath.includes("\x00")) {
39673
+ throw new TypeError("Path cannot contain null bytes");
39674
+ }
39675
+ const env = options2?.env ?? detectEnvironment();
39676
+ const wslUNCInfo = parseWSLUNC(inputPath);
39677
+ if (wslUNCInfo) {
39678
+ const currentDistro = process.env.WSL_DISTRO_NAME;
39679
+ if (env === "wsl" && currentDistro && wslUNCInfo.distro.toLowerCase() === currentDistro.toLowerCase()) {
39680
+ return path3.posix.normalize(wslUNCInfo.path);
39681
+ }
39682
+ }
39683
+ let intermediate = inputPath.replace(/\\/g, "/");
39684
+ const originalIsUNC = isUNC(intermediate);
39685
+ if (isWSLMount(intermediate)) {
39686
+ const driveLetter = intermediate.charAt(5).toLowerCase();
39687
+ intermediate = `${driveLetter}:${intermediate.substring(6)}`;
39688
+ if (intermediate.length === 2) {
39689
+ intermediate = `${driveLetter}:/`;
39690
+ }
39691
+ } else if (isGitBashMount(intermediate)) {
39692
+ const driveLetter = intermediate.charAt(1).toLowerCase();
39693
+ intermediate = `${driveLetter}:${intermediate.substring(2)}`;
39694
+ }
39695
+ const hasWindowsDrive = hasDriveLetter(intermediate);
39696
+ const isAbsolutePath = isAbsolute2(intermediate);
39697
+ const driveRelative = isDriveRelative(intermediate);
39698
+ if (!isAbsolutePath && !hasWindowsDrive) {
39699
+ const basePath = options2?.basePath ?? process.cwd();
39700
+ const normalizedBase = basePath.replace(/\\/g, "/");
39701
+ if (hasDriveLetter(normalizedBase)) {
39702
+ const drive = normalizedBase.substring(0, 2);
39703
+ const baseRest = normalizedBase.substring(2) || "/";
39704
+ const resolved = path3.posix.resolve(baseRest, intermediate);
39705
+ intermediate = drive + resolved;
39706
+ } else {
39707
+ intermediate = path3.posix.resolve(normalizedBase, intermediate);
39708
+ }
39709
+ } else if (driveRelative) {
39710
+ const pathDrive = intermediate.substring(0, 2).toLowerCase();
39711
+ const pathRest = intermediate.substring(2);
39712
+ const basePath = options2?.basePath ?? process.cwd();
39713
+ const normalizedBase = basePath.replace(/\\/g, "/");
39714
+ if (hasDriveLetter(normalizedBase)) {
39715
+ const baseDrive = normalizedBase.substring(0, 2).toLowerCase();
39716
+ if (baseDrive === pathDrive) {
39717
+ const baseRest = normalizedBase.substring(2) || "/";
39718
+ const resolved = path3.posix.resolve(baseRest, pathRest);
39719
+ intermediate = pathDrive + resolved;
39720
+ } else {
39721
+ intermediate = pathDrive + "/" + pathRest;
39722
+ }
39723
+ } else {
39724
+ intermediate = pathDrive + "/" + pathRest;
39725
+ }
39726
+ }
39727
+ if (originalIsUNC || isUNC(intermediate)) {
39728
+ const withoutPrefix = intermediate.substring(2);
39729
+ const normalizedRest = path3.posix.normalize(withoutPrefix);
39730
+ intermediate = "//" + normalizedRest;
39731
+ } else if (hasWindowsDrive || hasDriveLetter(intermediate)) {
39732
+ const drive = intermediate.substring(0, 2);
39733
+ let rest = intermediate.substring(2);
39734
+ if (!rest.startsWith("/")) {
39735
+ rest = "/" + rest;
39736
+ }
39737
+ const normalizedRest = path3.posix.normalize(rest);
39738
+ intermediate = drive + normalizedRest;
39739
+ } else {
39740
+ intermediate = path3.posix.normalize(intermediate);
39741
+ }
39742
+ const finalHasDrive = hasDriveLetter(intermediate);
39743
+ const finalIsUNC = isUNC(intermediate);
39744
+ if (finalHasDrive || finalIsUNC) {
39745
+ intermediate = intermediate.toLowerCase();
39746
+ const segments = intermediate.split("/");
39747
+ const normalizedSegments = segments.map((segment, index2) => {
39748
+ if (index2 === 0 || segment === "") {
39749
+ return segment;
39750
+ }
39751
+ return segment.replace(/[\s.]+$/, "");
39752
+ });
39753
+ intermediate = normalizedSegments.join("/");
39754
+ }
39755
+ if (intermediate.length > 1 && intermediate.endsWith("/")) {
39756
+ const isWindowsRoot = finalHasDrive && intermediate.length === 3;
39757
+ const isPosixRoot = intermediate === "/";
39758
+ const isUNCRoot = finalIsUNC && intermediate.split("/").filter(Boolean).length <= 2;
39759
+ if (!isWindowsRoot && !isPosixRoot && !isUNCRoot) {
39760
+ intermediate = intermediate.slice(0, -1);
39761
+ }
39762
+ }
39763
+ if (finalHasDrive && intermediate.length === 2) {
39764
+ intermediate = intermediate + "/";
39765
+ }
39766
+ return intermediate;
39767
+ }
39768
+ function normalizeProjectKey(projectPath) {
39769
+ if (projectPath === undefined || projectPath === null || projectPath === "" || projectPath === "global" || projectPath === "__global__") {
39770
+ return "global";
39771
+ }
39772
+ return normalize3(projectPath);
39773
+ }
39531
39774
  function createDurableStreamAdapter(swarmMail, projectKey) {
39532
39775
  return {
39533
39776
  async read(offset, limit) {
@@ -41067,15 +41310,15 @@ function generateBeadId(projectKey) {
41067
41310
  }
41068
41311
  function getProjectPrefix(projectKey) {
41069
41312
  try {
41070
- const packageJsonPath = join13(projectKey, "package.json");
41313
+ const packageJsonPath = join14(projectKey, "package.json");
41071
41314
  if (!existsSync5(packageJsonPath)) {
41072
41315
  return "cell";
41073
41316
  }
41074
- const packageJson = JSON.parse(readFileSync2(packageJsonPath, "utf-8"));
41075
- if (!packageJson.name || typeof packageJson.name !== "string") {
41317
+ const packageJson2 = JSON.parse(readFileSync2(packageJsonPath, "utf-8"));
41318
+ if (!packageJson2.name || typeof packageJson2.name !== "string") {
41076
41319
  return "cell";
41077
41320
  }
41078
- return slugifyProjectName(packageJson.name);
41321
+ return slugifyProjectName(packageJson2.name);
41079
41322
  } catch (error410) {
41080
41323
  return "cell";
41081
41324
  }
@@ -41282,7 +41525,7 @@ async function importSingleCell(adapter5, projectKey, cellExport, options2, resu
41282
41525
  closedAt
41283
41526
  ]);
41284
41527
  if (cellExport.status === "tombstone") {
41285
- await db2.query("UPDATE beads SET deleted_at = $1 WHERE id = $2", [Date.now(), cellExport.id]);
41528
+ await db2.query("UPDATE cells SET status = $1, updated_at = $2 WHERE id = $3", ["closed", Date.now(), cellExport.id]);
41286
41529
  }
41287
41530
  result.created++;
41288
41531
  } else {
@@ -41297,7 +41540,7 @@ async function importSingleCell(adapter5, projectKey, cellExport, options2, resu
41297
41540
  await adapter5.closeCell(projectKey, cellExport.id, "imported");
41298
41541
  } else if (cellExport.status === "in_progress") {
41299
41542
  const db2 = await adapter5.getDatabase();
41300
- await db2.query("UPDATE beads SET status = $1, updated_at = $2 WHERE id = $3", ["in_progress", Date.now(), cellExport.id]);
41543
+ await db2.query("UPDATE cells SET status = $1, updated_at = $2 WHERE id = $3", ["in_progress", Date.now(), cellExport.id]);
41301
41544
  }
41302
41545
  }
41303
41546
  result.updated++;
@@ -42018,14 +42261,14 @@ function buildOrderByClause(policy) {
42018
42261
  }
42019
42262
  }
42020
42263
  function getDefaultLegacyPath() {
42021
- return join14(homedir3(), ".semantic-memory", "memory");
42264
+ return join15(homedir3(), ".semantic-memory", "memory");
42022
42265
  }
42023
- function legacyDatabaseExists(path22) {
42024
- const dbPath = path22 || getDefaultLegacyPath();
42266
+ function legacyDatabaseExists(path42) {
42267
+ const dbPath = path42 || getDefaultLegacyPath();
42025
42268
  if (!existsSync7(dbPath)) {
42026
42269
  return false;
42027
42270
  }
42028
- const pgVersionPath = join14(dbPath, "PG_VERSION");
42271
+ const pgVersionPath = join15(dbPath, "PG_VERSION");
42029
42272
  return existsSync7(pgVersionPath);
42030
42273
  }
42031
42274
  async function migrateLegacyMemories(options2) {
@@ -42321,7 +42564,7 @@ async function importSingleMemory(db2, memoryExport, skipExisting, result) {
42321
42564
  result.created++;
42322
42565
  }
42323
42566
  async function syncMemories(db2, hivePath) {
42324
- const memoriesPath = join15(hivePath, "memories.jsonl");
42567
+ const memoriesPath = join16(hivePath, "memories.jsonl");
42325
42568
  let importResult = { created: 0, skipped: 0, errors: [] };
42326
42569
  if (existsSync8(memoriesPath)) {
42327
42570
  const fileContent = readFileSync3(memoriesPath, "utf-8");
@@ -42398,9 +42641,9 @@ async function createInMemoryDb() {
42398
42641
  await initializeSchema(client);
42399
42642
  return db2;
42400
42643
  }
42401
- async function getDb(path22) {
42644
+ async function getDb(path42) {
42402
42645
  if (!dbInstance) {
42403
- const url4 = path22 || ":memory:";
42646
+ const url4 = path42 || ":memory:";
42404
42647
  clientInstance = createClient6({ url: url4 });
42405
42648
  dbInstance = drizzle(clientInstance, { schema: exports_schema });
42406
42649
  await initializeSchema(clientInstance);
@@ -42416,41 +42659,41 @@ async function closeDb() {
42416
42659
  }
42417
42660
  async function detectStrayDatabases(projectPath) {
42418
42661
  const strays = [];
42419
- const rootOpencodePath = join16(projectPath, ".opencode");
42662
+ const rootOpencodePath = join17(projectPath, ".opencode");
42420
42663
  if (existsSync9(rootOpencodePath)) {
42421
42664
  const files = readdirSync(rootOpencodePath);
42422
42665
  for (const file22 of files) {
42423
42666
  if (file22.endsWith(".db") && !file22.includes(".migrated") && !file22.includes(".backup-")) {
42424
42667
  strays.push({
42425
- path: join16(rootOpencodePath, file22),
42668
+ path: join17(rootOpencodePath, file22),
42426
42669
  location: "project-root"
42427
42670
  });
42428
42671
  }
42429
42672
  }
42430
42673
  }
42431
- const hivePath = join16(projectPath, ".hive");
42674
+ const hivePath = join17(projectPath, ".hive");
42432
42675
  if (existsSync9(hivePath)) {
42433
42676
  const files = readdirSync(hivePath);
42434
42677
  for (const file22 of files) {
42435
42678
  if (file22.endsWith(".db") && !file22.includes(".migrated") && !file22.includes(".backup-")) {
42436
42679
  strays.push({
42437
- path: join16(hivePath, file22),
42680
+ path: join17(hivePath, file22),
42438
42681
  location: "legacy-hive"
42439
42682
  });
42440
42683
  }
42441
42684
  }
42442
42685
  }
42443
- const packagesPath = join16(projectPath, "packages");
42686
+ const packagesPath = join17(projectPath, "packages");
42444
42687
  if (existsSync9(packagesPath)) {
42445
42688
  const packages = readdirSync(packagesPath);
42446
42689
  for (const pkg of packages) {
42447
- const pkgOpencodePath = join16(packagesPath, pkg, ".opencode");
42690
+ const pkgOpencodePath = join17(packagesPath, pkg, ".opencode");
42448
42691
  if (existsSync9(pkgOpencodePath)) {
42449
42692
  const files = readdirSync(pkgOpencodePath);
42450
42693
  for (const file22 of files) {
42451
42694
  if (file22.endsWith(".db") && !file22.includes(".migrated") && !file22.includes(".backup-")) {
42452
42695
  strays.push({
42453
- path: join16(pkgOpencodePath, file22),
42696
+ path: join17(pkgOpencodePath, file22),
42454
42697
  location: "nested-package"
42455
42698
  });
42456
42699
  }
@@ -42732,8 +42975,8 @@ async function consolidateDatabases(projectPath, globalDbPath, options2 = {}) {
42732
42975
  return report;
42733
42976
  }
42734
42977
  function viewSessionLine(opts) {
42735
- const { path: path22, line = 1, context: context15 = 3 } = opts;
42736
- const content = readFileSync4(path22, "utf-8");
42978
+ const { path: path42, line = 1, context: context15 = 3 } = opts;
42979
+ const content = readFileSync4(path42, "utf-8");
42737
42980
  const lines = content.split(`
42738
42981
  `).filter((line2) => line2.trim() !== "");
42739
42982
  if (line < 1 || line > lines.length) {
@@ -42742,7 +42985,7 @@ function viewSessionLine(opts) {
42742
42985
  const startLine = Math.max(1, line - context15);
42743
42986
  const endLine = Math.min(lines.length, line + context15);
42744
42987
  const output = [];
42745
- output.push(`File: ${path22}`);
42988
+ output.push(`File: ${path42}`);
42746
42989
  output.push(`Line: ${line}${context15 > 0 ? ` (context: ${context15})` : ""}`);
42747
42990
  output.push("----------------------------------------");
42748
42991
  for (let i = startLine;i <= endLine; i++) {
@@ -42771,16 +43014,16 @@ function readdirp(root, options2 = {}) {
42771
43014
  options2.root = root;
42772
43015
  return new ReaddirpStream(options2);
42773
43016
  }
42774
- function createFsWatchInstance(path22, options2, listener, errHandler, emitRaw) {
43017
+ function createFsWatchInstance(path42, options2, listener, errHandler, emitRaw) {
42775
43018
  const handleEvent = (rawEvent, evPath) => {
42776
- listener(path22);
42777
- emitRaw(rawEvent, evPath, { watchedPath: path22 });
42778
- if (evPath && path22 !== evPath) {
42779
- fsWatchBroadcast(sp.resolve(path22, evPath), KEY_LISTENERS, sp.join(path22, evPath));
43019
+ listener(path42);
43020
+ emitRaw(rawEvent, evPath, { watchedPath: path42 });
43021
+ if (evPath && path42 !== evPath) {
43022
+ fsWatchBroadcast(sp.resolve(path42, evPath), KEY_LISTENERS, sp.join(path42, evPath));
42780
43023
  }
42781
43024
  };
42782
43025
  try {
42783
- return fs_watch(path22, {
43026
+ return fs_watch(path42, {
42784
43027
  persistent: options2.persistent
42785
43028
  }, handleEvent);
42786
43029
  } catch (error51) {
@@ -42796,13 +43039,13 @@ class NodeFsHandler {
42796
43039
  this.fsw = fsW;
42797
43040
  this._boundHandleError = (error51) => fsW._handleError(error51);
42798
43041
  }
42799
- _watchWithNodeFs(path22, listener) {
43042
+ _watchWithNodeFs(path42, listener) {
42800
43043
  const opts = this.fsw.options;
42801
- const directory = sp.dirname(path22);
42802
- const basename32 = sp.basename(path22);
43044
+ const directory = sp.dirname(path42);
43045
+ const basename32 = sp.basename(path42);
42803
43046
  const parent = this.fsw._getWatchedDir(directory);
42804
43047
  parent.add(basename32);
42805
- const absolutePath = sp.resolve(path22);
43048
+ const absolutePath = sp.resolve(path42);
42806
43049
  const options2 = {
42807
43050
  persistent: opts.persistent
42808
43051
  };
@@ -42812,12 +43055,12 @@ class NodeFsHandler {
42812
43055
  if (opts.usePolling) {
42813
43056
  const enableBin = opts.interval !== opts.binaryInterval;
42814
43057
  options2.interval = enableBin && isBinaryPath(basename32) ? opts.binaryInterval : opts.interval;
42815
- closer = setFsWatchFileListener(path22, absolutePath, options2, {
43058
+ closer = setFsWatchFileListener(path42, absolutePath, options2, {
42816
43059
  listener,
42817
43060
  rawEmitter: this.fsw._emitRaw
42818
43061
  });
42819
43062
  } else {
42820
- closer = setFsWatchListener(path22, absolutePath, options2, {
43063
+ closer = setFsWatchListener(path42, absolutePath, options2, {
42821
43064
  listener,
42822
43065
  errHandler: this._boundHandleError,
42823
43066
  rawEmitter: this.fsw._emitRaw
@@ -42829,13 +43072,13 @@ class NodeFsHandler {
42829
43072
  if (this.fsw.closed) {
42830
43073
  return;
42831
43074
  }
42832
- const dirname22 = sp.dirname(file22);
43075
+ const dirname32 = sp.dirname(file22);
42833
43076
  const basename32 = sp.basename(file22);
42834
- const parent = this.fsw._getWatchedDir(dirname22);
43077
+ const parent = this.fsw._getWatchedDir(dirname32);
42835
43078
  let prevStats = stats;
42836
43079
  if (parent.has(basename32))
42837
43080
  return;
42838
- const listener = async (path22, newStats) => {
43081
+ const listener = async (path42, newStats) => {
42839
43082
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file22, 5))
42840
43083
  return;
42841
43084
  if (!newStats || newStats.mtimeMs === 0) {
@@ -42849,16 +43092,16 @@ class NodeFsHandler {
42849
43092
  this.fsw._emit(EV.CHANGE, file22, newStats2);
42850
43093
  }
42851
43094
  if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
42852
- this.fsw._closeFile(path22);
43095
+ this.fsw._closeFile(path42);
42853
43096
  prevStats = newStats2;
42854
43097
  const closer2 = this._watchWithNodeFs(file22, listener);
42855
43098
  if (closer2)
42856
- this.fsw._addPathCloser(path22, closer2);
43099
+ this.fsw._addPathCloser(path42, closer2);
42857
43100
  } else {
42858
43101
  prevStats = newStats2;
42859
43102
  }
42860
43103
  } catch (error51) {
42861
- this.fsw._remove(dirname22, basename32);
43104
+ this.fsw._remove(dirname32, basename32);
42862
43105
  }
42863
43106
  } else if (parent.has(basename32)) {
42864
43107
  const at5 = newStats.atimeMs;
@@ -42877,7 +43120,7 @@ class NodeFsHandler {
42877
43120
  }
42878
43121
  return closer;
42879
43122
  }
42880
- async _handleSymlink(entry, directory, path22, item) {
43123
+ async _handleSymlink(entry, directory, path42, item) {
42881
43124
  if (this.fsw.closed) {
42882
43125
  return;
42883
43126
  }
@@ -42887,7 +43130,7 @@ class NodeFsHandler {
42887
43130
  this.fsw._incrReadyCount();
42888
43131
  let linkPath;
42889
43132
  try {
42890
- linkPath = await fsrealpath(path22);
43133
+ linkPath = await fsrealpath(path42);
42891
43134
  } catch (e) {
42892
43135
  this.fsw._emitReady();
42893
43136
  return true;
@@ -42897,12 +43140,12 @@ class NodeFsHandler {
42897
43140
  if (dir3.has(item)) {
42898
43141
  if (this.fsw._symlinkPaths.get(full) !== linkPath) {
42899
43142
  this.fsw._symlinkPaths.set(full, linkPath);
42900
- this.fsw._emit(EV.CHANGE, path22, entry.stats);
43143
+ this.fsw._emit(EV.CHANGE, path42, entry.stats);
42901
43144
  }
42902
43145
  } else {
42903
43146
  dir3.add(item);
42904
43147
  this.fsw._symlinkPaths.set(full, linkPath);
42905
- this.fsw._emit(EV.ADD, path22, entry.stats);
43148
+ this.fsw._emit(EV.ADD, path42, entry.stats);
42906
43149
  }
42907
43150
  this.fsw._emitReady();
42908
43151
  return true;
@@ -42932,9 +43175,9 @@ class NodeFsHandler {
42932
43175
  return;
42933
43176
  }
42934
43177
  const item = entry.path;
42935
- let path22 = sp.join(directory, item);
43178
+ let path42 = sp.join(directory, item);
42936
43179
  current2.add(item);
42937
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path22, item)) {
43180
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path42, item)) {
42938
43181
  return;
42939
43182
  }
42940
43183
  if (this.fsw.closed) {
@@ -42943,8 +43186,8 @@ class NodeFsHandler {
42943
43186
  }
42944
43187
  if (item === target || !target && !previous2.has(item)) {
42945
43188
  this.fsw._incrReadyCount();
42946
- path22 = sp.join(dir3, sp.relative(dir3, path22));
42947
- this._addToNodeFs(path22, initialAdd, wh, depth + 1);
43189
+ path42 = sp.join(dir3, sp.relative(dir3, path42));
43190
+ this._addToNodeFs(path42, initialAdd, wh, depth + 1);
42948
43191
  }
42949
43192
  }).on(EV.ERROR, this._boundHandleError);
42950
43193
  return new Promise((resolve4, reject3) => {
@@ -42993,13 +43236,13 @@ class NodeFsHandler {
42993
43236
  }
42994
43237
  return closer;
42995
43238
  }
42996
- async _addToNodeFs(path22, initialAdd, priorWh, depth, target) {
43239
+ async _addToNodeFs(path42, initialAdd, priorWh, depth, target) {
42997
43240
  const ready = this.fsw._emitReady;
42998
- if (this.fsw._isIgnored(path22) || this.fsw.closed) {
43241
+ if (this.fsw._isIgnored(path42) || this.fsw.closed) {
42999
43242
  ready();
43000
43243
  return false;
43001
43244
  }
43002
- const wh = this.fsw._getWatchHelpers(path22);
43245
+ const wh = this.fsw._getWatchHelpers(path42);
43003
43246
  if (priorWh) {
43004
43247
  wh.filterPath = (entry) => priorWh.filterPath(entry);
43005
43248
  wh.filterDir = (entry) => priorWh.filterDir(entry);
@@ -43015,8 +43258,8 @@ class NodeFsHandler {
43015
43258
  const follow = this.fsw.options.followSymlinks;
43016
43259
  let closer;
43017
43260
  if (stats.isDirectory()) {
43018
- const absPath = sp.resolve(path22);
43019
- const targetPath = follow ? await fsrealpath(path22) : path22;
43261
+ const absPath = sp.resolve(path42);
43262
+ const targetPath = follow ? await fsrealpath(path42) : path42;
43020
43263
  if (this.fsw.closed)
43021
43264
  return;
43022
43265
  closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
@@ -43026,29 +43269,29 @@ class NodeFsHandler {
43026
43269
  this.fsw._symlinkPaths.set(absPath, targetPath);
43027
43270
  }
43028
43271
  } else if (stats.isSymbolicLink()) {
43029
- const targetPath = follow ? await fsrealpath(path22) : path22;
43272
+ const targetPath = follow ? await fsrealpath(path42) : path42;
43030
43273
  if (this.fsw.closed)
43031
43274
  return;
43032
43275
  const parent = sp.dirname(wh.watchPath);
43033
43276
  this.fsw._getWatchedDir(parent).add(wh.watchPath);
43034
43277
  this.fsw._emit(EV.ADD, wh.watchPath, stats);
43035
- closer = await this._handleDir(parent, stats, initialAdd, depth, path22, wh, targetPath);
43278
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path42, wh, targetPath);
43036
43279
  if (this.fsw.closed)
43037
43280
  return;
43038
43281
  if (targetPath !== undefined) {
43039
- this.fsw._symlinkPaths.set(sp.resolve(path22), targetPath);
43282
+ this.fsw._symlinkPaths.set(sp.resolve(path42), targetPath);
43040
43283
  }
43041
43284
  } else {
43042
43285
  closer = this._handleFile(wh.watchPath, stats, initialAdd);
43043
43286
  }
43044
43287
  ready();
43045
43288
  if (closer)
43046
- this.fsw._addPathCloser(path22, closer);
43289
+ this.fsw._addPathCloser(path42, closer);
43047
43290
  return false;
43048
43291
  } catch (error51) {
43049
43292
  if (this.fsw._handleError(error51)) {
43050
43293
  ready();
43051
- return path22;
43294
+ return path42;
43052
43295
  }
43053
43296
  }
43054
43297
  }
@@ -43079,24 +43322,24 @@ function createPattern(matcher) {
43079
43322
  }
43080
43323
  return () => false;
43081
43324
  }
43082
- function normalizePath(path22) {
43083
- if (typeof path22 !== "string")
43325
+ function normalizePath(path42) {
43326
+ if (typeof path42 !== "string")
43084
43327
  throw new Error("string expected");
43085
- path22 = sp2.normalize(path22);
43086
- path22 = path22.replace(/\\/g, "/");
43328
+ path42 = sp2.normalize(path42);
43329
+ path42 = path42.replace(/\\/g, "/");
43087
43330
  let prepend8 = false;
43088
- if (path22.startsWith("//"))
43331
+ if (path42.startsWith("//"))
43089
43332
  prepend8 = true;
43090
- path22 = path22.replace(DOUBLE_SLASH_RE, "/");
43333
+ path42 = path42.replace(DOUBLE_SLASH_RE, "/");
43091
43334
  if (prepend8)
43092
- path22 = "/" + path22;
43093
- return path22;
43335
+ path42 = "/" + path42;
43336
+ return path42;
43094
43337
  }
43095
43338
  function matchPatterns(patterns, testString, stats) {
43096
- const path22 = normalizePath(testString);
43339
+ const path42 = normalizePath(testString);
43097
43340
  for (let index2 = 0;index2 < patterns.length; index2++) {
43098
43341
  const pattern2 = patterns[index2];
43099
- if (pattern2(path22, stats)) {
43342
+ if (pattern2(path42, stats)) {
43100
43343
  return true;
43101
43344
  }
43102
43345
  }
@@ -43177,10 +43420,10 @@ class WatchHelper {
43177
43420
  dirParts;
43178
43421
  followSymlinks;
43179
43422
  statMethod;
43180
- constructor(path22, follow, fsw) {
43423
+ constructor(path42, follow, fsw) {
43181
43424
  this.fsw = fsw;
43182
- const watchPath = path22;
43183
- this.path = path22 = path22.replace(REPLACER_RE, "");
43425
+ const watchPath = path42;
43426
+ this.path = path42 = path42.replace(REPLACER_RE, "");
43184
43427
  this.watchPath = watchPath;
43185
43428
  this.fullWatchPath = sp2.resolve(watchPath);
43186
43429
  this.dirParts = [];
@@ -43466,7 +43709,7 @@ class SessionIndexer {
43466
43709
  const files = [];
43467
43710
  const entries8 = await fs.readdir(dir3, { withFileTypes: true });
43468
43711
  for (const entry of entries8) {
43469
- const fullPath = path2.join(dir3, entry.name);
43712
+ const fullPath = path4.join(dir3, entry.name);
43470
43713
  if (entry.isDirectory() && recursive) {
43471
43714
  const subFiles = await this.findJsonlFiles(fullPath, recursive);
43472
43715
  files.push(...subFiles);
@@ -44290,7 +44533,7 @@ var __create2, __getProtoOf2, __defProp2, __getOwnPropNames2, __getOwnPropDesc,
44290
44533
  next = b2;
44291
44534
  }
44292
44535
  return out;
44293
- }, getOrder3, getEquivalence5, forEach2, dedupeWith, dedupe = (self) => dedupeWith(self, equivalence()), dedupeAdjacentWith2, dedupeAdjacent2, join4, mapAccum, cartesianWith2, cartesian2, Do3, bind4, bindTo4, let_4, init_Array, PreconditionFailure, init_PreconditionFailure, init_Pre, Nil, init_StreamHelpers, safeSymbolIterator, Stream, init_Stream, cloneMethod, init_symbols, safeObjectDefineProperty, init_Value, safeObjectAssign, ChainArbitrary, MapArbitrary, FilterArbitrary, NoShrinkArbitrary, NoBiasArbitrary, init_Arbitrary, untouchedApply, ApplySymbol, init_apply, SArray, SBigInt, SBigInt64Array, SBigUint64Array, SBoolean, SDate, SError, SFloat32Array, SFloat64Array, SInt8Array, SInt16Array, SInt32Array, SNumber, SString, SSet, SUint8Array, SUint8ClampedArray, SUint16Array, SUint32Array, SencodeURIComponent, SMap, SSymbol, untouchedForEach, untouchedIndexOf, untouchedJoin, untouchedMap, untouchedFilter, untouchedPush, untouchedPop, untouchedSplice, untouchedSlice, untouchedSort, untouchedEvery, untouchedGetTime, untouchedToISOString, untouchedAdd, untouchedHas, untouchedSet, untouchedGet, untouchedMapSet, untouchedMapGet, untouchedSplit, untouchedStartsWith, untouchedEndsWith, untouchedSubstring, untouchedToLowerCase, untouchedToUpperCase, untouchedPadStart, untouchedCharCodeAt, untouchedNormalize, untouchedReplace, untouchedNumberToString, untouchedHasOwnProperty, untouchedToString, init_globals, LazyIterableIterator, init_LazyIterableIterator, safeArrayIsArray, safeObjectDefineProperty2, TupleArbitrary, init_TupleArbitrary, init_tuple, safeMathLog, init_IRawProperty, globalParameters, init_GlobalParameters, UndefinedContextPlaceholder, init_NoUndefinedAsContext, init_AsyncProperty_generic, AlwaysShrinkableArbitrary, init_AlwaysShrinkableArbitrary, init_AsyncProperty, init_Property_generic, init_Property, MULTIPLIER = 214013, INCREMENT = 2531011, MASK = 4294967295, MASK_2, computeNextSeed = function(seed) {
44536
+ }, getOrder3, getEquivalence5, forEach2, dedupeWith, dedupe = (self) => dedupeWith(self, equivalence()), dedupeAdjacentWith2, dedupeAdjacent2, join22, mapAccum, cartesianWith2, cartesian2, Do3, bind4, bindTo4, let_4, init_Array, PreconditionFailure, init_PreconditionFailure, init_Pre, Nil, init_StreamHelpers, safeSymbolIterator, Stream, init_Stream, cloneMethod, init_symbols, safeObjectDefineProperty, init_Value, safeObjectAssign, ChainArbitrary, MapArbitrary, FilterArbitrary, NoShrinkArbitrary, NoBiasArbitrary, init_Arbitrary, untouchedApply, ApplySymbol, init_apply, SArray, SBigInt, SBigInt64Array, SBigUint64Array, SBoolean, SDate, SError, SFloat32Array, SFloat64Array, SInt8Array, SInt16Array, SInt32Array, SNumber, SString, SSet, SUint8Array, SUint8ClampedArray, SUint16Array, SUint32Array, SencodeURIComponent, SMap, SSymbol, untouchedForEach, untouchedIndexOf, untouchedJoin, untouchedMap, untouchedFilter, untouchedPush, untouchedPop, untouchedSplice, untouchedSlice, untouchedSort, untouchedEvery, untouchedGetTime, untouchedToISOString, untouchedAdd, untouchedHas, untouchedSet, untouchedGet, untouchedMapSet, untouchedMapGet, untouchedSplit, untouchedStartsWith, untouchedEndsWith, untouchedSubstring, untouchedToLowerCase, untouchedToUpperCase, untouchedPadStart, untouchedCharCodeAt, untouchedNormalize, untouchedReplace, untouchedNumberToString, untouchedHasOwnProperty, untouchedToString, init_globals, LazyIterableIterator, init_LazyIterableIterator, safeArrayIsArray, safeObjectDefineProperty2, TupleArbitrary, init_TupleArbitrary, init_tuple, safeMathLog, init_IRawProperty, globalParameters, init_GlobalParameters, UndefinedContextPlaceholder, init_NoUndefinedAsContext, init_AsyncProperty_generic, AlwaysShrinkableArbitrary, init_AlwaysShrinkableArbitrary, init_AsyncProperty, init_Property_generic, init_Property, MULTIPLIER = 214013, INCREMENT = 2531011, MASK = 4294967295, MASK_2, computeNextSeed = function(seed) {
44294
44537
  return seed * MULTIPLIER + INCREMENT & MASK;
44295
44538
  }, computeValueFromNextSeed = function(nextseed) {
44296
44539
  return (nextseed & MASK_2) >> 16;
@@ -45809,7 +46052,7 @@ schema (${ast._tag}): ${ast}`;
45809
46052
  }), unsafeFromNonEmptyArray = (self) => unsafeFromArray(self), unsafeGet4, append3, prepend3, take3, drop3, dropRight2, dropWhile2, prependAll3, appendAll3, filterMap5, filter5, filterMapWhile3, compact = (self) => filterMap5(self, identity), flatMap5, forEach3, flatten5, chunksOf3, intersection4, isEmpty2 = (self) => self.length === 0, isNonEmpty2 = (self) => self.length > 0, head3, unsafeHead2 = (self) => unsafeGet4(self, 0), headNonEmpty2, last2 = (self) => get5(self, self.length - 1), unsafeLast = (self) => unsafeGet4(self, self.length - 1), lastNonEmpty2, map7, mapAccum2, partition3, partitionMap4, separate3 = (self) => pipe2(separate2(toReadonlyArray(self)), ([l, r]) => [unsafeFromArray(l), unsafeFromArray(r)]), size3 = (self) => self.length, sort2, sortWith2, splitAt2, splitNonEmptyAt2, split2, splitWhere2, tail2 = (self) => self.length > 0 ? some3(drop3(self, 1)) : none2(), tailNonEmpty2 = (self) => drop3(self, 1), takeRight2, takeWhile3, union3, dedupe2 = (self) => unsafeFromArray(dedupe(toReadonlyArray(self))), dedupeAdjacent3 = (self) => unsafeFromArray(dedupeAdjacent2(self)), unzip2 = (self) => {
45810
46053
  const [left3, right3] = unzip(self);
45811
46054
  return [unsafeFromArray(left3), unsafeFromArray(right3)];
45812
- }, zipWith5, zip3, remove3, removeOption2, modifyOption3, modify3, replace3, replaceOption3, makeBy3, range3 = (start, end) => start <= end ? makeBy3(end - start + 1, (i) => start + i) : of3(start), contains4, containsWith4, findFirst4, findFirstIndex2, findLast3, findLastIndex2, every5, some8, join22, reduce4, reduceRight2, differenceWith2 = (isEquivalent) => {
46055
+ }, zipWith5, zip3, remove3, removeOption2, modifyOption3, modify3, replace3, replaceOption3, makeBy3, range3 = (start, end) => start <= end ? makeBy3(end - start + 1, (i) => start + i) : of3(start), contains4, containsWith4, findFirst4, findFirstIndex2, findLast3, findLastIndex2, every5, some8, join32, reduce4, reduceRight2, differenceWith2 = (isEquivalent) => {
45813
46056
  return dual(2, (self, that) => unsafeFromArray(differenceWith(isEquivalent)(that, self)));
45814
46057
  }, difference3, init_Chunk, exports_Duration, TypeId8, bigint03, bigint24, bigint60, bigint1e3, bigint1e6, bigint1e9, DURATION_REGEX, decode3 = (input) => {
45815
46058
  if (isDuration(input)) {
@@ -47633,7 +47876,7 @@ ${prefix}}`;
47633
47876
  Object.defineProperty(error210, "toString", {
47634
47877
  enumerable: false,
47635
47878
  value() {
47636
- const path22 = pipe2(this.path, join4(options2.pathDelim));
47879
+ const path22 = pipe2(this.path, join22(options2.pathDelim));
47637
47880
  return `(Invalid data at ${path22}: "${this.message}")`;
47638
47881
  }
47639
47882
  });
@@ -47648,7 +47891,7 @@ ${prefix}}`;
47648
47891
  Object.defineProperty(error210, "toString", {
47649
47892
  enumerable: false,
47650
47893
  value() {
47651
- const path22 = pipe2(this.path, join4(options2.pathDelim));
47894
+ const path22 = pipe2(this.path, join22(options2.pathDelim));
47652
47895
  return `(Missing data at ${path22}: "${this.message}")`;
47653
47896
  }
47654
47897
  });
@@ -47664,7 +47907,7 @@ ${prefix}}`;
47664
47907
  Object.defineProperty(error210, "toString", {
47665
47908
  enumerable: false,
47666
47909
  value() {
47667
- const path22 = pipe2(this.path, join4(options2.pathDelim));
47910
+ const path22 = pipe2(this.path, join22(options2.pathDelim));
47668
47911
  return `(Source unavailable at ${path22}: "${this.message}")`;
47669
47912
  }
47670
47913
  });
@@ -47679,7 +47922,7 @@ ${prefix}}`;
47679
47922
  Object.defineProperty(error210, "toString", {
47680
47923
  enumerable: false,
47681
47924
  value() {
47682
- const path22 = pipe2(this.path, join4(options2.pathDelim));
47925
+ const path22 = pipe2(this.path, join22(options2.pathDelim));
47683
47926
  return `(Unsupported operation at ${path22}: "${this.message}")`;
47684
47927
  }
47685
47928
  });
@@ -47736,7 +47979,7 @@ ${prefix}}`;
47736
47979
  pathDelim: "_",
47737
47980
  seqDelim: ","
47738
47981
  }, options2);
47739
- const makePathString = (path) => pipe2(path, join4(pathDelim));
47982
+ const makePathString = (path) => pipe2(path, join22(pathDelim));
47740
47983
  const unmakePathString = (pathString) => pathString.split(pathDelim);
47741
47984
  const getEnv = () => typeof process !== "undefined" && ("env" in process) && typeof process.env === "object" ? process.env : {};
47742
47985
  const load = (path, primitive, split3 = true) => {
@@ -47774,7 +48017,7 @@ ${prefix}}`;
47774
48017
  seqDelim: ",",
47775
48018
  pathDelim: "."
47776
48019
  }, config2);
47777
- const makePathString = (path) => pipe2(path, join4(pathDelim));
48020
+ const makePathString = (path) => pipe2(path, join22(pathDelim));
47778
48021
  const unmakePathString = (pathString) => pathString.split(pathDelim);
47779
48022
  const mapWithIndexSplit = splitIndexInKeys(map16, (str2) => unmakePathString(str2), makePathString);
47780
48023
  const load = (path, primitive, split3 = true) => {
@@ -47892,7 +48135,7 @@ ${prefix}}`;
47892
48135
  return fail2(right3.left);
47893
48136
  }
47894
48137
  if (isRight2(left3) && isRight2(right3)) {
47895
- const path = pipe2(prefix, join4("."));
48138
+ const path = pipe2(prefix, join22("."));
47896
48139
  const fail5 = fromFlatLoopFail(prefix, path);
47897
48140
  const [lefts, rights] = extend22(fail5, fail5, pipe2(left3.right, map6(right2)), pipe2(right3.right, map6(right2)));
47898
48141
  return pipe2(lefts, zip2(rights), forEachSequential(([left4, right4]) => pipe2(zip5(left4, right4), map14(([left5, right5]) => op.zip(left5, right5)))));
@@ -48953,7 +49196,7 @@ ${prefix}}`;
48953
49196
  const _fiber = {
48954
49197
  ...CommitPrototype,
48955
49198
  commit() {
48956
- return join32(this);
49199
+ return join42(this);
48957
49200
  },
48958
49201
  ...fiberProto,
48959
49202
  id: () => none4,
@@ -48967,7 +49210,7 @@ ${prefix}}`;
48967
49210
  }, dump = (self) => map14(self.status, (status) => ({
48968
49211
  id: self.id(),
48969
49212
  status
48970
- })), dumpAll = (fibers) => forEachSequential(fibers, dump), fail6 = (error210) => done5(fail4(error210)), failCause5 = (cause2) => done5(failCause3(cause2)), fromEffect = (effect) => map14(exit(effect), done5), id = (self) => self.id(), inheritAll = (self) => self.inheritAll, interrupted = (fiberId2) => done5(interrupt4(fiberId2)), interruptAll = (fibers) => flatMap12(fiberId, (fiberId2) => pipe2(fibers, interruptAllAs(fiberId2))), interruptAllAs, interruptAsFork, join32 = (self) => zipLeft2(flatten8(self.await), self.inheritAll), map18, mapEffect2, mapFiber, match13, _never2, never3, orElse5, orElseEither3, poll3 = (self) => self.poll, parseMs = (milliseconds) => {
49213
+ })), dumpAll = (fibers) => forEachSequential(fibers, dump), fail6 = (error210) => done5(fail4(error210)), failCause5 = (cause2) => done5(failCause3(cause2)), fromEffect = (effect) => map14(exit(effect), done5), id = (self) => self.id(), inheritAll = (self) => self.inheritAll, interrupted = (fiberId2) => done5(interrupt4(fiberId2)), interruptAll = (fibers) => flatMap12(fiberId, (fiberId2) => pipe2(fibers, interruptAllAs(fiberId2))), interruptAllAs, interruptAsFork, join42 = (self) => zipLeft2(flatten8(self.await), self.inheritAll), map18, mapEffect2, mapFiber, match13, _never2, never3, orElse5, orElseEither3, poll3 = (self) => self.poll, parseMs = (milliseconds) => {
48971
49214
  const roundTowardsZero = milliseconds > 0 ? Math.floor : Math.ceil;
48972
49215
  return {
48973
49216
  days: roundTowardsZero(milliseconds / 86400000),
@@ -50438,7 +50681,7 @@ ${prefix}}`;
50438
50681
  next2();
50439
50682
  }
50440
50683
  }));
50441
- return asVoid2(onExit(flatten8(restore(join32(processingFiber))), exitMatch({
50684
+ return asVoid2(onExit(flatten8(restore(join42(processingFiber))), exitMatch({
50442
50685
  onFailure: (cause2) => {
50443
50686
  onInterruptSignal();
50444
50687
  const target2 = residual.length + 1;
@@ -50609,7 +50852,7 @@ ${prefix}}`;
50609
50852
  const _fiberAll = {
50610
50853
  ...CommitPrototype2,
50611
50854
  commit() {
50612
- return join32(this);
50855
+ return join42(this);
50613
50856
  },
50614
50857
  [FiberTypeId]: fiberVariance2,
50615
50858
  id: () => fromIterable2(fibers).reduce((id2, fiber) => combine5(id2, fiber.id()), none4),
@@ -50639,7 +50882,7 @@ ${prefix}}`;
50639
50882
  interruptAsFork: (fiberId2) => forEachSequentialDiscard(fibers, (fiber) => fiber.interruptAsFork(fiberId2))
50640
50883
  };
50641
50884
  return _fiberAll;
50642
- }, fiberInterruptFork = (self) => asVoid2(forkDaemon2(interruptFiber(self))), fiberJoinAll = (fibers) => join32(fiberAll(fibers)), fiberScoped = (self) => acquireRelease2(succeed(self), interruptFiber), raceWith, disconnect = (self) => uninterruptibleMask((restore) => fiberIdWith((fiberId2) => flatMap12(forkDaemon2(restore(self)), (fiber) => pipe2(restore(join32(fiber)), onInterrupt(() => pipe2(fiber, interruptAsFork(fiberId2))))))), race2, raceFibersWith, completeRace = (winner, loser, cont, ab, cb) => {
50885
+ }, fiberInterruptFork = (self) => asVoid2(forkDaemon2(interruptFiber(self))), fiberJoinAll = (fibers) => join42(fiberAll(fibers)), fiberScoped = (self) => acquireRelease2(succeed(self), interruptFiber), raceWith, disconnect = (self) => uninterruptibleMask((restore) => fiberIdWith((fiberId2) => flatMap12(forkDaemon2(restore(self)), (fiber) => pipe2(restore(join42(fiber)), onInterrupt(() => pipe2(fiber, interruptAsFork(fiberId2))))))), race2, raceFibersWith, completeRace = (winner, loser, cont, ab, cb) => {
50643
50886
  if (compareAndSet(true, false)(ab)) {
50644
50887
  cb(cont(winner, loser));
50645
50888
  }
@@ -50857,7 +51100,7 @@ ${prefix}}`;
50857
51100
  return end3 - time3 <= 0 ? some3(computeCachedValue(self, timeToLive, time3)) : none2();
50858
51101
  }
50859
51102
  }
50860
- })), flatMap12((option4) => isNone2(option4) ? dieMessage("BUG: Effect.cachedInvalidate - please report an issue at https://github.com/Effect-TS/effect/issues") : restore(deferredAwait(option4.value[1]))))), invalidateCache = (cache) => set6(cache, none2()), ensuringChild, ensuringChildren, forkAll, forkIn2, forkScoped2 = (self) => scopeWith((scope3) => forkIn2(self, scope3)), fromFiber = (fiber) => join32(fiber), fromFiberEffect = (fiber) => suspend(() => flatMap12(fiber, join32)), memoKeySymbol, Key, cachedFunction = (f, eq) => {
51103
+ })), flatMap12((option4) => isNone2(option4) ? dieMessage("BUG: Effect.cachedInvalidate - please report an issue at https://github.com/Effect-TS/effect/issues") : restore(deferredAwait(option4.value[1]))))), invalidateCache = (cache) => set6(cache, none2()), ensuringChild, ensuringChildren, forkAll, forkIn2, forkScoped2 = (self) => scopeWith((scope3) => forkIn2(self, scope3)), fromFiber = (fiber) => join42(fiber), fromFiberEffect = (fiber) => suspend(() => flatMap12(fiber, join42)), memoKeySymbol, Key, cachedFunction = (f, eq) => {
50861
51104
  return pipe2(sync(() => empty23()), flatMap12(makeSynchronized), map14((ref) => (a) => pipe2(ref.modifyEffect((map23) => {
50862
51105
  const result = pipe2(map23, get9(new Key(a, eq)));
50863
51106
  if (isNone2(result)) {
@@ -50869,7 +51112,7 @@ ${prefix}}`;
50869
51112
  const ref = unsafeMake7(value2);
50870
51113
  const sem = unsafeMakeSemaphore(1);
50871
51114
  return new SynchronizedImpl(ref, sem.withPermits(1));
50872
- }, updateSomeAndGetEffectSynchronized, zipFiber, zipLeftFiber, zipRightFiber, zipWithFiber, bindAll, init_circular, TypeId19, init_circular2, OP_EXTEND_SCOPE = "ExtendScope", OP_FOLD = "Fold", OP_FRESH = "Fresh", OP_FROM_EFFECT = "FromEffect", OP_SCOPED = "Scoped", OP_SUSPEND = "Suspend", OP_PROVIDE = "Provide", OP_PROVIDE_MERGE = "ProvideMerge", OP_MERGE_ALL = "MergeAll", OP_ZIP_WITH2 = "ZipWith", exports_Fiber, FiberTypeId2, RuntimeFiberTypeId2, Order8, isFiber2, isRuntimeFiber2, id2, _await3, awaitAll, children2, all10, done8, dump2, dumpAll2, fail9, failCause7, fromEffect3, getCurrentFiber2, inheritAll2, interrupt7, interrupted2, interruptAs, interruptAsFork2, interruptAll2, interruptAllAs2, interruptFork, join42, joinAll, map23, mapEffect3, mapFiber2, match15, never4, orElse6, orElseEither5, poll4, pretty4, roots2, unsafeRoots2, scoped2, status2, succeed9, void_7, zip11, zipLeft5, zipRight5, zipWith9, init_Fiber, makeDual = (f) => function() {
51115
+ }, updateSomeAndGetEffectSynchronized, zipFiber, zipLeftFiber, zipRightFiber, zipWithFiber, bindAll, init_circular, TypeId19, init_circular2, OP_EXTEND_SCOPE = "ExtendScope", OP_FOLD = "Fold", OP_FRESH = "Fresh", OP_FROM_EFFECT = "FromEffect", OP_SCOPED = "Scoped", OP_SUSPEND = "Suspend", OP_PROVIDE = "Provide", OP_PROVIDE_MERGE = "ProvideMerge", OP_MERGE_ALL = "MergeAll", OP_ZIP_WITH2 = "ZipWith", exports_Fiber, FiberTypeId2, RuntimeFiberTypeId2, Order8, isFiber2, isRuntimeFiber2, id2, _await3, awaitAll, children2, all10, done8, dump2, dumpAll2, fail9, failCause7, fromEffect3, getCurrentFiber2, inheritAll2, interrupt7, interrupted2, interruptAs, interruptAsFork2, interruptAll2, interruptAllAs2, interruptFork, join5, joinAll, map23, mapEffect3, mapFiber2, match15, never4, orElse6, orElseEither5, poll4, pretty4, roots2, unsafeRoots2, scoped2, status2, succeed9, void_7, zip11, zipLeft5, zipRight5, zipWith9, init_Fiber, makeDual = (f) => function() {
50873
51116
  if (arguments.length === 1) {
50874
51117
  const runtime3 = arguments[0];
50875
51118
  return (effect, ...args2) => f(runtime3, effect, ...args2);
@@ -54895,7 +55138,7 @@ ${prefix}}`;
54895
55138
  } else {
54896
55139
  reject2(squash(exit4.cause));
54897
55140
  }
54898
- }))), join5 = (self) => _await(self.deferred), awaitEmpty = (self) => suspend4(() => {
55141
+ }))), join6 = (self) => _await(self.deferred), awaitEmpty = (self) => suspend4(() => {
54899
55142
  if (self.state._tag === "Closed" || self.state.fiber === undefined) {
54900
55143
  return _void3;
54901
55144
  }
@@ -54964,7 +55207,7 @@ ${prefix}}`;
54964
55207
  } else {
54965
55208
  reject2(squash(exit4.cause));
54966
55209
  }
54967
- }))), size25 = (self) => sync8(() => self.state._tag === "Closed" ? 0 : size10(self.state.backing)), join6 = (self) => _await(self.deferred), awaitEmpty2 = (self) => whileLoop3({
55210
+ }))), size25 = (self) => sync8(() => self.state._tag === "Closed" ? 0 : size10(self.state.backing)), join7 = (self) => _await(self.deferred), awaitEmpty2 = (self) => whileLoop3({
54968
55211
  while: () => self.state._tag === "Open" && size10(self.state.backing) > 0,
54969
55212
  body: () => _await3(unsafeHead(self)[1]),
54970
55213
  step: constVoid
@@ -55021,7 +55264,7 @@ ${prefix}}`;
55021
55264
  } else {
55022
55265
  reject2(squash(exit4.cause));
55023
55266
  }
55024
- }))), size26 = (self) => sync8(() => self.state._tag === "Closed" ? 0 : self.state.backing.size), join7 = (self) => _await(self.deferred), awaitEmpty3 = (self) => whileLoop3({
55267
+ }))), size26 = (self) => sync8(() => self.state._tag === "Closed" ? 0 : self.state.backing.size), join8 = (self) => _await(self.deferred), awaitEmpty3 = (self) => whileLoop3({
55025
55268
  while: () => self.state._tag === "Open" && self.state.backing.size > 0,
55026
55269
  body: () => _await3(unsafeHead(self)),
55027
55270
  step: constVoid
@@ -66814,8 +67057,8 @@ ${prefix}}`;
66814
67057
  }
66815
67058
  return { message };
66816
67059
  }, en_default3, init_en3, overrideErrorMap2, init_errors6, makeIssue2 = (params) => {
66817
- const { data, path: path22, errorMaps, issueData } = params;
66818
- const fullPath = [...path22, ...issueData.path || []];
67060
+ const { data, path: path42, errorMaps, issueData } = params;
67061
+ const fullPath = [...path42, ...issueData.path || []];
66819
67062
  const fullIssue = {
66820
67063
  ...issueData,
66821
67064
  path: fullPath
@@ -68151,7 +68394,7 @@ ${prefix}}`;
68151
68394
  }
68152
68395
  return this._output;
68153
68396
  }
68154
- }, JsonToSseTransformStream, uiMessageChunkSchema, originalGenerateId2, uiMessagesSchema, originalGenerateId3, originalGenerateId4, name142 = "AI_NoSuchProviderError", marker142, symbol142, _a142, init_dist6, exports_memory_operations, MemoryOperationSchema, init_memory_operations, exports_auto_tagger, AutoTagResultSchema, init_auto_tagger, exports_memory_linking, DEFAULT_CONFIG, init_memory_linking, exports_entity_extraction, EntitySchema, RelationshipSchema, ExtractionSchema, init_entity_extraction, init_adapter2, import_debug, log, CORS_HEADERS, HEARTBEAT_INTERVAL = 30000, checkpointFrequency, humanFeedback, recoverySuccess, scopeViolations, taskDuration, ANALYTICS_QUERIES, DEFAULT_TOMBSTONE_TTL_MS = 2592000000, MIN_TOMBSTONE_TTL_MS = 604800000, CLOCK_SKEW_GRACE_MS = 3600000, STATUS_TOMBSTONE = "tombstone", dbInstance, clientInstance, TABLE_COLUMNS, EntryTypes, defaultOptions2, RECURSIVE_ERROR_CODE = "READDIRP_RECURSIVE_ERROR", NORMAL_FLOW_ERRORS, ALL_TYPES, DIR_TYPES, FILE_TYPES, isNormalFlowError = (error51) => NORMAL_FLOW_ERRORS.has(error51.code), wantBigintFsStats, emptyFn = (_entryInfo) => true, normalizeFilter = (filter28) => {
68397
+ }, JsonToSseTransformStream, uiMessageChunkSchema, originalGenerateId2, uiMessagesSchema, originalGenerateId3, originalGenerateId4, name142 = "AI_NoSuchProviderError", marker142, symbol142, _a142, init_dist6, exports_memory_operations, MemoryOperationSchema, init_memory_operations, exports_auto_tagger, AutoTagResultSchema, init_auto_tagger, exports_memory_linking, DEFAULT_CONFIG, init_memory_linking, exports_entity_extraction, EntitySchema, RelationshipSchema, ExtractionSchema, init_entity_extraction, init_adapter2, __dirname2, require2, packageJson, SWARM_MAIL_VERSION, import_debug, log, cachedEnvironment = null, CORS_HEADERS, HEARTBEAT_INTERVAL = 30000, checkpointFrequency, humanFeedback, recoverySuccess, scopeViolations, taskDuration, ANALYTICS_QUERIES, DEFAULT_TOMBSTONE_TTL_MS = 2592000000, MIN_TOMBSTONE_TTL_MS = 604800000, CLOCK_SKEW_GRACE_MS = 3600000, STATUS_TOMBSTONE = "tombstone", dbInstance, clientInstance, TABLE_COLUMNS, EntryTypes, defaultOptions2, RECURSIVE_ERROR_CODE = "READDIRP_RECURSIVE_ERROR", NORMAL_FLOW_ERRORS, ALL_TYPES, DIR_TYPES, FILE_TYPES, isNormalFlowError = (error51) => NORMAL_FLOW_ERRORS.has(error51.code), wantBigintFsStats, emptyFn = (_entryInfo) => true, normalizeFilter = (filter28) => {
68155
68398
  if (filter28 === undefined)
68156
68399
  return emptyFn;
68157
68400
  if (typeof filter28 === "function")
@@ -68198,12 +68441,12 @@ ${prefix}}`;
68198
68441
  foreach(cont[listenerType], (listener) => {
68199
68442
  listener(val1, val2, val3);
68200
68443
  });
68201
- }, setFsWatchListener = (path22, fullPath, options2, handlers) => {
68444
+ }, setFsWatchListener = (path42, fullPath, options2, handlers) => {
68202
68445
  const { listener, errHandler, rawEmitter } = handlers;
68203
68446
  let cont = FsWatchInstances.get(fullPath);
68204
68447
  let watcher;
68205
68448
  if (!options2.persistent) {
68206
- watcher = createFsWatchInstance(path22, options2, listener, errHandler, rawEmitter);
68449
+ watcher = createFsWatchInstance(path42, options2, listener, errHandler, rawEmitter);
68207
68450
  if (!watcher)
68208
68451
  return;
68209
68452
  return watcher.close.bind(watcher);
@@ -68213,7 +68456,7 @@ ${prefix}}`;
68213
68456
  addAndConvert(cont, KEY_ERR, errHandler);
68214
68457
  addAndConvert(cont, KEY_RAW, rawEmitter);
68215
68458
  } else {
68216
- watcher = createFsWatchInstance(path22, options2, fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), errHandler, fsWatchBroadcast.bind(null, fullPath, KEY_RAW));
68459
+ watcher = createFsWatchInstance(path42, options2, fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), errHandler, fsWatchBroadcast.bind(null, fullPath, KEY_RAW));
68217
68460
  if (!watcher)
68218
68461
  return;
68219
68462
  watcher.on(EV.ERROR, async (error51) => {
@@ -68222,7 +68465,7 @@ ${prefix}}`;
68222
68465
  cont.watcherUnusable = true;
68223
68466
  if (isWindows && error51.code === "EPERM") {
68224
68467
  try {
68225
- const fd = await open(path22, "r");
68468
+ const fd = await open(path42, "r");
68226
68469
  await fd.close();
68227
68470
  broadcastErr(error51);
68228
68471
  } catch (err) {}
@@ -68250,7 +68493,7 @@ ${prefix}}`;
68250
68493
  Object.freeze(cont);
68251
68494
  }
68252
68495
  };
68253
- }, FsWatchFileInstances, setFsWatchFileListener = (path22, fullPath, options2, handlers) => {
68496
+ }, FsWatchFileInstances, setFsWatchFileListener = (path42, fullPath, options2, handlers) => {
68254
68497
  const { listener, rawEmitter } = handlers;
68255
68498
  let cont = FsWatchFileInstances.get(fullPath);
68256
68499
  const copts = cont && cont.options;
@@ -68272,7 +68515,7 @@ ${prefix}}`;
68272
68515
  });
68273
68516
  const currmtime = curr.mtimeMs;
68274
68517
  if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
68275
- foreach(cont.listeners, (listener2) => listener2(path22, curr));
68518
+ foreach(cont.listeners, (listener2) => listener2(path42, curr));
68276
68519
  }
68277
68520
  })
68278
68521
  };
@@ -68305,18 +68548,18 @@ ${prefix}}`;
68305
68548
  str2 = SLASH + str2;
68306
68549
  }
68307
68550
  return str2;
68308
- }, normalizePathToUnix = (path22) => toUnix(sp2.normalize(toUnix(path22))), normalizeIgnored = (cwd = "") => (path22) => {
68309
- if (typeof path22 === "string") {
68310
- return normalizePathToUnix(sp2.isAbsolute(path22) ? path22 : sp2.join(cwd, path22));
68551
+ }, normalizePathToUnix = (path42) => toUnix(sp2.normalize(toUnix(path42))), normalizeIgnored = (cwd = "") => (path42) => {
68552
+ if (typeof path42 === "string") {
68553
+ return normalizePathToUnix(sp2.isAbsolute(path42) ? path42 : sp2.join(cwd, path42));
68311
68554
  } else {
68312
- return path22;
68555
+ return path42;
68313
68556
  }
68314
- }, getAbsolutePath = (path22, cwd) => {
68315
- if (sp2.isAbsolute(path22)) {
68316
- return path22;
68557
+ }, getAbsolutePath = (path42, cwd) => {
68558
+ if (sp2.isAbsolute(path42)) {
68559
+ return path42;
68317
68560
  }
68318
- return sp2.join(cwd, path22);
68319
- }, EMPTY_SET, STAT_METHOD_F = "stat", STAT_METHOD_L = "lstat", FSWatcher, chokidar_default, FileWatcher, NormalizedMessageSchema, OpenCodeSwarmEventSchema, SWARM_MAIL_VERSION = "1.10.1";
68561
+ return sp2.join(cwd, path42);
68562
+ }, EMPTY_SET, STAT_METHOD_F = "stat", STAT_METHOD_L = "lstat", FSWatcher, chokidar_default, FileWatcher, NormalizedMessageSchema, OpenCodeSwarmEventSchema;
68320
68563
  var init_dist2 = __esm(() => {
68321
68564
  __create2 = Object.create;
68322
68565
  __getProtoOf2 = Object.getPrototypeOf;
@@ -70833,7 +71076,7 @@ var init_dist2 = __esm(() => {
70833
71076
  length: () => length,
70834
71077
  lastNonEmpty: () => lastNonEmpty,
70835
71078
  last: () => last,
70836
- join: () => join4,
71079
+ join: () => join22,
70837
71080
  isNonEmptyReadonlyArray: () => isNonEmptyReadonlyArray,
70838
71081
  isNonEmptyArray: () => isNonEmptyArray2,
70839
71082
  isEmptyReadonlyArray: () => isEmptyReadonlyArray,
@@ -71389,7 +71632,7 @@ var init_dist2 = __esm(() => {
71389
71632
  return out;
71390
71633
  });
71391
71634
  dedupeAdjacent2 = /* @__PURE__ */ dedupeAdjacentWith2(/* @__PURE__ */ equivalence());
71392
- join4 = /* @__PURE__ */ dual(2, (self, sep) => fromIterable2(self).join(sep));
71635
+ join22 = /* @__PURE__ */ dual(2, (self, sep) => fromIterable2(self).join(sep));
71393
71636
  mapAccum = /* @__PURE__ */ dual(3, (self, s, f) => {
71394
71637
  let i = 0;
71395
71638
  let s1 = s;
@@ -77773,7 +78016,7 @@ var init_dist2 = __esm(() => {
77773
78016
  make: () => make9,
77774
78017
  lastNonEmpty: () => lastNonEmpty2,
77775
78018
  last: () => last2,
77776
- join: () => join22,
78019
+ join: () => join32,
77777
78020
  isNonEmpty: () => isNonEmpty2,
77778
78021
  isEmpty: () => isEmpty2,
77779
78022
  isChunk: () => isChunk,
@@ -78166,7 +78409,7 @@ var init_dist2 = __esm(() => {
78166
78409
  findLastIndex2 = findLastIndex;
78167
78410
  every5 = /* @__PURE__ */ dual(2, (self, refinement) => fromIterable2(self).every(refinement));
78168
78411
  some8 = /* @__PURE__ */ dual(2, (self, predicate) => fromIterable2(self).some(predicate));
78169
- join22 = join4;
78412
+ join32 = join22;
78170
78413
  reduce4 = reduce3;
78171
78414
  reduceRight2 = reduceRight;
78172
78415
  difference3 = /* @__PURE__ */ dual(2, (self, that) => unsafeFromArray(difference2(that, self)));
@@ -84214,7 +84457,7 @@ ${stack.split(`
84214
84457
  const _fiber = {
84215
84458
  ...CommitPrototype,
84216
84459
  commit() {
84217
- return join32(this);
84460
+ return join42(this);
84218
84461
  },
84219
84462
  ...fiberProto,
84220
84463
  id: () => self.id(),
@@ -84249,7 +84492,7 @@ ${stack.split(`
84249
84492
  _never2 = {
84250
84493
  ...CommitPrototype,
84251
84494
  commit() {
84252
- return join32(this);
84495
+ return join42(this);
84253
84496
  },
84254
84497
  ...fiberProto,
84255
84498
  id: () => none4,
@@ -84263,7 +84506,7 @@ ${stack.split(`
84263
84506
  orElse5 = /* @__PURE__ */ dual(2, (self, that) => ({
84264
84507
  ...CommitPrototype,
84265
84508
  commit() {
84266
- return join32(this);
84509
+ return join42(this);
84267
84510
  },
84268
84511
  ...fiberProto,
84269
84512
  id: () => getOrElse6(self.id(), that.id()),
@@ -86098,7 +86341,7 @@ ${stack.split(`
86098
86341
  this.refreshRefCache();
86099
86342
  }
86100
86343
  commit() {
86101
- return join32(this);
86344
+ return join42(this);
86102
86345
  }
86103
86346
  id() {
86104
86347
  return this._fiberId;
@@ -87030,11 +87273,11 @@ ${stack.split(`
87030
87273
  }));
87031
87274
  race2 = /* @__PURE__ */ dual(2, (self, that) => fiberIdWith((parentFiberId) => raceWith(self, that, {
87032
87275
  onSelfDone: (exit3, right3) => exitMatchEffect(exit3, {
87033
- onFailure: (cause2) => pipe2(join32(right3), mapErrorCause2((cause22) => parallel(cause2, cause22))),
87276
+ onFailure: (cause2) => pipe2(join42(right3), mapErrorCause2((cause22) => parallel(cause2, cause22))),
87034
87277
  onSuccess: (value2) => pipe2(right3, interruptAsFiber(parentFiberId), as3(value2))
87035
87278
  }),
87036
87279
  onOtherDone: (exit3, left3) => exitMatchEffect(exit3, {
87037
- onFailure: (cause2) => pipe2(join32(left3), mapErrorCause2((cause22) => parallel(cause22, cause2))),
87280
+ onFailure: (cause2) => pipe2(join42(left3), mapErrorCause2((cause22) => parallel(cause22, cause2))),
87038
87281
  onSuccess: (value2) => pipe2(left3, interruptAsFiber(parentFiberId), as3(value2))
87039
87282
  })
87040
87283
  })));
@@ -87982,7 +88225,7 @@ ${stack.split(`
87982
88225
  zipWithFiber = /* @__PURE__ */ dual(3, (self, that, f) => ({
87983
88226
  ...CommitPrototype2,
87984
88227
  commit() {
87985
- return join32(this);
88228
+ return join42(this);
87986
88229
  },
87987
88230
  [FiberTypeId]: fiberVariance2,
87988
88231
  id: () => pipe2(self.id(), getOrElse6(that.id())),
@@ -88027,7 +88270,7 @@ ${stack.split(`
88027
88270
  mapEffect: () => mapEffect3,
88028
88271
  map: () => map23,
88029
88272
  joinAll: () => joinAll,
88030
- join: () => join42,
88273
+ join: () => join5,
88031
88274
  isRuntimeFiber: () => isRuntimeFiber2,
88032
88275
  isFiber: () => isFiber2,
88033
88276
  interrupted: () => interrupted2,
@@ -88084,7 +88327,7 @@ ${stack.split(`
88084
88327
  interruptAll2 = interruptAll;
88085
88328
  interruptAllAs2 = interruptAllAs;
88086
88329
  interruptFork = fiberInterruptFork;
88087
- join42 = join32;
88330
+ join5 = join42;
88088
88331
  joinAll = fiberJoinAll;
88089
88332
  map23 = map18;
88090
88333
  mapEffect3 = mapEffect2;
@@ -91788,8 +92031,8 @@ ${stack.split(`
91788
92031
  function go2(state) {
91789
92032
  switch (state._tag) {
91790
92033
  case OP_BOTH_RUNNING: {
91791
- const leftJoin = interruptible4(join42(state.left));
91792
- const rightJoin = interruptible4(join42(state.right));
92034
+ const leftJoin = interruptible4(join5(state.left));
92035
+ const rightJoin = interruptible4(join5(state.right));
91793
92036
  return unwrap2(raceWith2(leftJoin, rightJoin, {
91794
92037
  onSelfDone: (leftExit, rf) => zipRight7(interrupt7(rf), handleSide(leftExit, state.right, pullL)(options2.onSelfDone, BothRunning, (f) => LeftDone(f))),
91795
92038
  onOtherDone: (rightExit, lf) => zipRight7(interrupt7(lf), handleSide(rightExit, state.left, pullR)(options2.onOtherDone, (left3, right3) => BothRunning(right3, left3), (f) => RightDone(f)))
@@ -93786,14 +94029,14 @@ ${stack.split(`
93786
94029
  }
93787
94030
  }
93788
94031
  })), unwrap2);
93789
- return unwrap2(raceWith2(join42(sinkFiber), join42(scheduleFiber), {
94032
+ return unwrap2(raceWith2(join5(sinkFiber), join5(scheduleFiber), {
93790
94033
  onSelfDone: (sinkExit, _) => pipe2(interrupt7(scheduleFiber), zipRight7(pipe2(suspend4(() => sinkExit), map26(([leftovers, b]) => handleSide(leftovers, b, none2()))))),
93791
94034
  onOtherDone: (scheduleExit, _) => matchCauseEffect3(suspend4(() => scheduleExit), {
93792
94035
  onFailure: (cause3) => match(failureOrCause2(cause3), {
93793
- onLeft: () => pipe2(handoff, offer6(end3(ScheduleEnd)), forkDaemon3, zipRight7(pipe2(join42(sinkFiber), map26(([leftovers, b]) => handleSide(leftovers, b, none2()))))),
93794
- onRight: (cause4) => pipe2(handoff, offer6(halt(cause4)), forkDaemon3, zipRight7(pipe2(join42(sinkFiber), map26(([leftovers, b]) => handleSide(leftovers, b, none2())))))
94036
+ onLeft: () => pipe2(handoff, offer6(end3(ScheduleEnd)), forkDaemon3, zipRight7(pipe2(join5(sinkFiber), map26(([leftovers, b]) => handleSide(leftovers, b, none2()))))),
94037
+ onRight: (cause4) => pipe2(handoff, offer6(halt(cause4)), forkDaemon3, zipRight7(pipe2(join5(sinkFiber), map26(([leftovers, b]) => handleSide(leftovers, b, none2())))))
93795
94038
  }),
93796
- onSuccess: (c) => pipe2(handoff, offer6(end3(ScheduleEnd)), forkDaemon3, zipRight7(pipe2(join42(sinkFiber), map26(([leftovers, b]) => handleSide(leftovers, b, some3(c))))))
94039
+ onSuccess: (c) => pipe2(handoff, offer6(end3(ScheduleEnd)), forkDaemon3, zipRight7(pipe2(join5(sinkFiber), map26(([leftovers, b]) => handleSide(leftovers, b, some3(c))))))
93797
94040
  })
93798
94041
  }));
93799
94042
  };
@@ -93993,7 +94236,7 @@ ${stack.split(`
93993
94236
  })));
93994
94237
  }
93995
94238
  case OP_PREVIOUS: {
93996
- return unwrap2(take10(handoff).pipe(forkIn3(scope6), flatMap18((handoffFiber) => raceWith2(join42(state.fiber), join42(handoffFiber), {
94239
+ return unwrap2(take10(handoff).pipe(forkIn3(scope6), flatMap18((handoffFiber) => raceWith2(join5(state.fiber), join5(handoffFiber), {
93997
94240
  onSelfDone: (leftExit, current2) => match7(leftExit, {
93998
94241
  onFailure: (cause3) => interrupt7(current2).pipe(as8(failCause12(cause3))),
93999
94242
  onSuccess: (chunk4) => interrupt7(current2).pipe(zipRight7(succeed13(write(chunk4).pipe(flatMap20(() => consumer(current(handoffFiber)))))))
@@ -94009,7 +94252,7 @@ ${stack.split(`
94009
94252
  return interrupt7(previous2).pipe(as8(failCause12(signal.cause)));
94010
94253
  }
94011
94254
  case OP_END: {
94012
- return join42(previous2).pipe(map26((chunk4) => write(chunk4).pipe(zipRight8(void_8))));
94255
+ return join5(previous2).pipe(map26((chunk4) => write(chunk4).pipe(zipRight8(void_8))));
94013
94256
  }
94014
94257
  }
94015
94258
  }
@@ -94017,7 +94260,7 @@ ${stack.split(`
94017
94260
  }))));
94018
94261
  }
94019
94262
  case OP_CURRENT: {
94020
- return unwrap2(join42(state.fiber).pipe(map26((signal) => {
94263
+ return unwrap2(join5(state.fiber).pipe(map26((signal) => {
94021
94264
  switch (signal._tag) {
94022
94265
  case OP_EMIT4: {
94023
94266
  return unwrap2(enqueue(signal.elements));
@@ -95464,8 +95707,8 @@ ${stack.split(`
95464
95707
  zipLatestWith = /* @__PURE__ */ dual(3, (left3, right3, f) => {
95465
95708
  const pullNonEmpty = (pull) => pipe2(pull, flatMap18((chunk4) => isEmpty2(chunk4) ? pullNonEmpty(pull) : succeed13(chunk4)));
95466
95709
  return pipe2(toPull2(left3), map26(pullNonEmpty), zip12(pipe2(toPull2(right3), map26(pullNonEmpty))), flatMap18(([left4, right4]) => pipe2(fromEffectOption(raceWith2(left4, right4, {
95467
- onSelfDone: (leftDone, rightFiber) => pipe2(suspend4(() => leftDone), zipWith12(join42(rightFiber), (l, r) => [l, r, true])),
95468
- onOtherDone: (rightDone, leftFiber) => pipe2(suspend4(() => rightDone), zipWith12(join42(leftFiber), (l, r) => [r, l, false]))
95710
+ onSelfDone: (leftDone, rightFiber) => pipe2(suspend4(() => leftDone), zipWith12(join5(rightFiber), (l, r) => [l, r, true])),
95711
+ onOtherDone: (rightDone, leftFiber) => pipe2(suspend4(() => rightDone), zipWith12(join5(leftFiber), (l, r) => [r, l, false]))
95469
95712
  })), flatMap23(([l, r, leftFirst]) => pipe2(fromEffect9(make37([unsafeLast(l), unsafeLast(r)])), flatMap23((latest) => pipe2(fromChunk(leftFirst ? pipe2(r, map7((a2) => f(unsafeLast(l), a2))) : pipe2(l, map7((a) => f(a, unsafeLast(r))))), concat3(pipe2(repeatEffectOption(left4), mergeEither(repeatEffectOption(right4)), mapEffectSequential(match({
95470
95713
  onLeft: (leftChunk) => modify8(latest, ([_, rightLatest]) => [pipe2(leftChunk, map7((a) => f(a, rightLatest))), [unsafeLast(leftChunk), rightLatest]]),
95471
95714
  onRight: (rightChunk) => modify8(latest, ([leftLatest, _]) => [pipe2(rightChunk, map7((a2) => f(leftLatest, a2))), [leftLatest, unsafeLast(rightChunk)]])
@@ -96504,7 +96747,7 @@ ${stack.split(`
96504
96747
  makeRuntimePromise: () => makeRuntimePromise,
96505
96748
  makeRuntime: () => makeRuntime,
96506
96749
  make: () => make79,
96507
- join: () => join5,
96750
+ join: () => join6,
96508
96751
  isFiberHandle: () => isFiberHandle,
96509
96752
  get: () => get18,
96510
96753
  clear: () => clear4,
@@ -96606,7 +96849,7 @@ ${stack.split(`
96606
96849
  makeRuntimePromise: () => makeRuntimePromise2,
96607
96850
  makeRuntime: () => makeRuntime2,
96608
96851
  make: () => make80,
96609
- join: () => join6,
96852
+ join: () => join7,
96610
96853
  isFiberMap: () => isFiberMap,
96611
96854
  has: () => has10,
96612
96855
  get: () => get19,
@@ -96731,7 +96974,7 @@ ${stack.split(`
96731
96974
  makeRuntimePromise: () => makeRuntimePromise3,
96732
96975
  makeRuntime: () => makeRuntime3,
96733
96976
  make: () => make81,
96734
- join: () => join7,
96977
+ join: () => join8,
96735
96978
  isFiberSet: () => isFiberSet,
96736
96979
  clear: () => clear6,
96737
96980
  awaitEmpty: () => awaitEmpty3,
@@ -110121,7 +110364,7 @@ ${stack.split(`
110121
110364
  return new SQL([new StringChunk(str2)]);
110122
110365
  }
110123
110366
  sql2.raw = raw;
110124
- function join11(chunks3, separator) {
110367
+ function join12(chunks3, separator) {
110125
110368
  const result = [];
110126
110369
  for (const [i, chunk7] of chunks3.entries()) {
110127
110370
  if (i > 0 && separator !== undefined) {
@@ -110131,7 +110374,7 @@ ${stack.split(`
110131
110374
  }
110132
110375
  return new SQL(result);
110133
110376
  }
110134
- sql2.join = join11;
110377
+ sql2.join = join12;
110135
110378
  function identifier2(value10) {
110136
110379
  return new Name(value10);
110137
110380
  }
@@ -111844,7 +112087,7 @@ ${stack.split(`
111844
112087
  return (table3, on) => {
111845
112088
  const baseTableName = this.tableName;
111846
112089
  const tableName = getTableLikeName(table3);
111847
- if (typeof tableName === "string" && this.config.joins?.some((join11) => join11.alias === tableName)) {
112090
+ if (typeof tableName === "string" && this.config.joins?.some((join12) => join12.alias === tableName)) {
111848
112091
  throw new Error(`Alias "${tableName}" is already used in this query`);
111849
112092
  }
111850
112093
  if (!this.isPartialSelect) {
@@ -112237,7 +112480,7 @@ ${stack.split(`
112237
112480
  createJoin(joinType) {
112238
112481
  return (table3, on) => {
112239
112482
  const tableName = getTableLikeName(table3);
112240
- if (typeof tableName === "string" && this.config.joins.some((join11) => join11.alias === tableName)) {
112483
+ if (typeof tableName === "string" && this.config.joins.some((join12) => join12.alias === tableName)) {
112241
112484
  throw new Error(`Alias "${tableName}" is already used in this query`);
112242
112485
  }
112243
112486
  if (typeof on === "function") {
@@ -114944,7 +115187,7 @@ ${stack.split(`
114944
115187
  return new SQL2([new StringChunk2(str2)]);
114945
115188
  }
114946
115189
  sql22.raw = raw;
114947
- function join11(chunks3, separator) {
115190
+ function join12(chunks3, separator) {
114948
115191
  const result = [];
114949
115192
  for (const [i, chunk7] of chunks3.entries()) {
114950
115193
  if (i > 0 && separator !== undefined) {
@@ -114954,7 +115197,7 @@ ${stack.split(`
114954
115197
  }
114955
115198
  return new SQL2(result);
114956
115199
  }
114957
- sql22.join = join11;
115200
+ sql22.join = join12;
114958
115201
  function identifier2(value10) {
114959
115202
  return new Name2(value10);
114960
115203
  }
@@ -119627,7 +119870,7 @@ ${stack.split(`
119627
119870
  return (table5, on) => {
119628
119871
  const baseTableName = this.tableName;
119629
119872
  const tableName = (0, import_utils13.getTableLikeName)(table5);
119630
- if (typeof tableName === "string" && this.config.joins?.some((join11) => join11.alias === tableName)) {
119873
+ if (typeof tableName === "string" && this.config.joins?.some((join12) => join12.alias === tableName)) {
119631
119874
  throw new Error(`Alias "${tableName}" is already used in this query`);
119632
119875
  }
119633
119876
  if (!this.isPartialSelect) {
@@ -120272,7 +120515,7 @@ ${stack.split(`
120272
120515
  createJoin(joinType) {
120273
120516
  return (table5, on) => {
120274
120517
  const tableName = (0, import_utils13.getTableLikeName)(table5);
120275
- if (typeof tableName === "string" && this.config.joins.some((join11) => join11.alias === tableName)) {
120518
+ if (typeof tableName === "string" && this.config.joins.some((join12) => join12.alias === tableName)) {
120276
120519
  throw new Error(`Alias "${tableName}" is already used in this query`);
120277
120520
  }
120278
120521
  if (typeof on === "function") {
@@ -120322,10 +120565,10 @@ ${stack.split(`
120322
120565
  const fromFields = this.getTableLikeFields(this.config.from);
120323
120566
  fields[tableName] = fromFields;
120324
120567
  }
120325
- for (const join11 of this.config.joins) {
120326
- const tableName2 = (0, import_utils13.getTableLikeName)(join11.table);
120327
- if (typeof tableName2 === "string" && !(0, import_entity47.is)(join11.table, import_sql18.SQL)) {
120328
- const fromFields = this.getTableLikeFields(join11.table);
120568
+ for (const join12 of this.config.joins) {
120569
+ const tableName2 = (0, import_utils13.getTableLikeName)(join12.table);
120570
+ if (typeof tableName2 === "string" && !(0, import_entity47.is)(join12.table, import_sql18.SQL)) {
120571
+ const fromFields = this.getTableLikeFields(join12.table);
120329
120572
  fields[tableName2] = fromFields;
120330
120573
  }
120331
120574
  }
@@ -131076,19 +131319,19 @@ Error message: ${getErrorMessage3(cause3)}`,
131076
131319
  getUserDataDir: () => getUserDataDir
131077
131320
  });
131078
131321
  module.exports = __toCommonJS2(token_io_exports);
131079
- var import_path = __toESM22(__require2("path"));
131322
+ var import_path2 = __toESM22(__require2("path"));
131080
131323
  var import_fs = __toESM22(__require2("fs"));
131081
131324
  var import_os = __toESM22(__require2("os"));
131082
131325
  var import_token_error = require_token_error();
131083
131326
  function findRootDir() {
131084
131327
  try {
131085
131328
  let dir3 = process.cwd();
131086
- while (dir3 !== import_path.default.dirname(dir3)) {
131087
- const pkgPath = import_path.default.join(dir3, ".vercel");
131329
+ while (dir3 !== import_path2.default.dirname(dir3)) {
131330
+ const pkgPath = import_path2.default.join(dir3, ".vercel");
131088
131331
  if (import_fs.default.existsSync(pkgPath)) {
131089
131332
  return dir3;
131090
131333
  }
131091
- dir3 = import_path.default.dirname(dir3);
131334
+ dir3 = import_path2.default.dirname(dir3);
131092
131335
  }
131093
131336
  } catch (e) {
131094
131337
  throw new import_token_error.VercelOidcTokenError("Token refresh only supported in node server environments");
@@ -131101,9 +131344,9 @@ Error message: ${getErrorMessage3(cause3)}`,
131101
131344
  }
131102
131345
  switch (import_os.default.platform()) {
131103
131346
  case "darwin":
131104
- return import_path.default.join(import_os.default.homedir(), "Library/Application Support");
131347
+ return import_path2.default.join(import_os.default.homedir(), "Library/Application Support");
131105
131348
  case "linux":
131106
- return import_path.default.join(import_os.default.homedir(), ".local/share");
131349
+ return import_path2.default.join(import_os.default.homedir(), ".local/share");
131107
131350
  case "win32":
131108
131351
  if (process.env.LOCALAPPDATA) {
131109
131352
  return process.env.LOCALAPPDATA;
@@ -131148,7 +131391,7 @@ Error message: ${getErrorMessage3(cause3)}`,
131148
131391
  saveToken: () => saveToken
131149
131392
  });
131150
131393
  module.exports = __toCommonJS2(token_util_exports);
131151
- var path22 = __toESM22(__require2("path"));
131394
+ var path42 = __toESM22(__require2("path"));
131152
131395
  var fs2 = __toESM22(__require2("fs"));
131153
131396
  var import_token_error = require_token_error();
131154
131397
  var import_token_io = require_token_io();
@@ -131158,14 +131401,14 @@ Error message: ${getErrorMessage3(cause3)}`,
131158
131401
  if (!dataDir) {
131159
131402
  return null;
131160
131403
  }
131161
- return path22.join(dataDir, vercelFolder);
131404
+ return path42.join(dataDir, vercelFolder);
131162
131405
  }
131163
131406
  function getVercelCliToken() {
131164
131407
  const dataDir = getVercelDataDir();
131165
131408
  if (!dataDir) {
131166
131409
  return null;
131167
131410
  }
131168
- const tokenPath = path22.join(dataDir, "auth.json");
131411
+ const tokenPath = path42.join(dataDir, "auth.json");
131169
131412
  if (!fs2.existsSync(tokenPath)) {
131170
131413
  return null;
131171
131414
  }
@@ -131208,7 +131451,7 @@ Error message: ${getErrorMessage3(cause3)}`,
131208
131451
  throw new import_token_error.VercelOidcTokenError("Unable to find root directory");
131209
131452
  }
131210
131453
  try {
131211
- const prjPath = path22.join(dir3, ".vercel", "project.json");
131454
+ const prjPath = path42.join(dir3, ".vercel", "project.json");
131212
131455
  if (!fs2.existsSync(prjPath)) {
131213
131456
  throw new import_token_error.VercelOidcTokenError("project.json not found");
131214
131457
  }
@@ -131227,9 +131470,9 @@ Error message: ${getErrorMessage3(cause3)}`,
131227
131470
  if (!dir3) {
131228
131471
  throw new import_token_error.VercelOidcTokenError("Unable to find user data directory");
131229
131472
  }
131230
- const tokenPath = path22.join(dir3, "com.vercel.token", `${projectId}.json`);
131473
+ const tokenPath = path42.join(dir3, "com.vercel.token", `${projectId}.json`);
131231
131474
  const tokenJson = JSON.stringify(token);
131232
- fs2.mkdirSync(path22.dirname(tokenPath), { mode: 504, recursive: true });
131475
+ fs2.mkdirSync(path42.dirname(tokenPath), { mode: 504, recursive: true });
131233
131476
  fs2.writeFileSync(tokenPath, tokenJson);
131234
131477
  fs2.chmodSync(tokenPath, 432);
131235
131478
  return;
@@ -131243,7 +131486,7 @@ Error message: ${getErrorMessage3(cause3)}`,
131243
131486
  if (!dir3) {
131244
131487
  return null;
131245
131488
  }
131246
- const tokenPath = path22.join(dir3, "com.vercel.token", `${projectId}.json`);
131489
+ const tokenPath = path42.join(dir3, "com.vercel.token", `${projectId}.json`);
131247
131490
  if (!fs2.existsSync(tokenPath)) {
131248
131491
  return null;
131249
131492
  }
@@ -134036,6 +134279,10 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
134036
134279
  init_ollama();
134037
134280
  init_pagination();
134038
134281
  });
134282
+ __dirname2 = dirname(fileURLToPath(import.meta.url));
134283
+ require2 = createRequire22(import.meta.url);
134284
+ packageJson = require2(join(__dirname2, "..", "package.json"));
134285
+ SWARM_MAIL_VERSION = packageJson.version;
134039
134286
  import_debug = __toESM2(require_src(), 1);
134040
134287
  log = {
134041
134288
  events: import_debug.default("swarm:events"),
@@ -134497,7 +134744,7 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
134497
134744
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
134498
134745
  const statMethod = opts.lstat ? lstat : stat;
134499
134746
  if (wantBigintFsStats) {
134500
- this._stat = (path22) => statMethod(path22, { bigint: true });
134747
+ this._stat = (path42) => statMethod(path42, { bigint: true });
134501
134748
  } else {
134502
134749
  this._stat = statMethod;
134503
134750
  }
@@ -134522,8 +134769,8 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
134522
134769
  const par2 = this.parent;
134523
134770
  const fil = par2 && par2.files;
134524
134771
  if (fil && fil.length > 0) {
134525
- const { path: path22, depth } = par2;
134526
- const slice2 = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path22));
134772
+ const { path: path42, depth } = par2;
134773
+ const slice2 = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path42));
134527
134774
  const awaited = await Promise.all(slice2);
134528
134775
  for (const entry of awaited) {
134529
134776
  if (!entry)
@@ -134563,20 +134810,20 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
134563
134810
  this.reading = false;
134564
134811
  }
134565
134812
  }
134566
- async _exploreDir(path22, depth) {
134813
+ async _exploreDir(path42, depth) {
134567
134814
  let files;
134568
134815
  try {
134569
- files = await readdir(path22, this._rdOptions);
134816
+ files = await readdir(path42, this._rdOptions);
134570
134817
  } catch (error51) {
134571
134818
  this._onError(error51);
134572
134819
  }
134573
- return { files, depth, path: path22 };
134820
+ return { files, depth, path: path42 };
134574
134821
  }
134575
- async _formatEntry(dirent, path22) {
134822
+ async _formatEntry(dirent, path42) {
134576
134823
  let entry;
134577
134824
  const basename22 = this._isDirent ? dirent.name : dirent;
134578
134825
  try {
134579
- const fullPath = presolve(pjoin(path22, basename22));
134826
+ const fullPath = presolve(pjoin(path42, basename22));
134580
134827
  entry = { path: prelative(this._root, fullPath), fullPath, basename: basename22 };
134581
134828
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
134582
134829
  } catch (err) {
@@ -135025,20 +135272,20 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
135025
135272
  this._closePromise = undefined;
135026
135273
  let paths = unifyPaths(paths_);
135027
135274
  if (cwd) {
135028
- paths = paths.map((path22) => {
135029
- const absPath = getAbsolutePath(path22, cwd);
135275
+ paths = paths.map((path42) => {
135276
+ const absPath = getAbsolutePath(path42, cwd);
135030
135277
  return absPath;
135031
135278
  });
135032
135279
  }
135033
- paths.forEach((path22) => {
135034
- this._removeIgnoredPath(path22);
135280
+ paths.forEach((path42) => {
135281
+ this._removeIgnoredPath(path42);
135035
135282
  });
135036
135283
  this._userIgnored = undefined;
135037
135284
  if (!this._readyCount)
135038
135285
  this._readyCount = 0;
135039
135286
  this._readyCount += paths.length;
135040
- Promise.all(paths.map(async (path22) => {
135041
- const res = await this._nodeFsHandler._addToNodeFs(path22, !_internal, undefined, 0, _origAdd);
135287
+ Promise.all(paths.map(async (path42) => {
135288
+ const res = await this._nodeFsHandler._addToNodeFs(path42, !_internal, undefined, 0, _origAdd);
135042
135289
  if (res)
135043
135290
  this._emitReady();
135044
135291
  return res;
@@ -135057,17 +135304,17 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
135057
135304
  return this;
135058
135305
  const paths = unifyPaths(paths_);
135059
135306
  const { cwd } = this.options;
135060
- paths.forEach((path22) => {
135061
- if (!sp2.isAbsolute(path22) && !this._closers.has(path22)) {
135307
+ paths.forEach((path42) => {
135308
+ if (!sp2.isAbsolute(path42) && !this._closers.has(path42)) {
135062
135309
  if (cwd)
135063
- path22 = sp2.join(cwd, path22);
135064
- path22 = sp2.resolve(path22);
135310
+ path42 = sp2.join(cwd, path42);
135311
+ path42 = sp2.resolve(path42);
135065
135312
  }
135066
- this._closePath(path22);
135067
- this._addIgnoredPath(path22);
135068
- if (this._watched.has(path22)) {
135313
+ this._closePath(path42);
135314
+ this._addIgnoredPath(path42);
135315
+ if (this._watched.has(path42)) {
135069
135316
  this._addIgnoredPath({
135070
- path: path22,
135317
+ path: path42,
135071
135318
  recursive: true
135072
135319
  });
135073
135320
  }
@@ -135116,38 +135363,38 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
135116
135363
  if (event !== EVENTS.ERROR)
135117
135364
  this.emit(EVENTS.ALL, event, ...args2);
135118
135365
  }
135119
- async _emit(event, path22, stats) {
135366
+ async _emit(event, path42, stats) {
135120
135367
  if (this.closed)
135121
135368
  return;
135122
135369
  const opts = this.options;
135123
135370
  if (isWindows)
135124
- path22 = sp2.normalize(path22);
135371
+ path42 = sp2.normalize(path42);
135125
135372
  if (opts.cwd)
135126
- path22 = sp2.relative(opts.cwd, path22);
135127
- const args2 = [path22];
135373
+ path42 = sp2.relative(opts.cwd, path42);
135374
+ const args2 = [path42];
135128
135375
  if (stats != null)
135129
135376
  args2.push(stats);
135130
135377
  const awf = opts.awaitWriteFinish;
135131
135378
  let pw;
135132
- if (awf && (pw = this._pendingWrites.get(path22))) {
135379
+ if (awf && (pw = this._pendingWrites.get(path42))) {
135133
135380
  pw.lastChange = new Date;
135134
135381
  return this;
135135
135382
  }
135136
135383
  if (opts.atomic) {
135137
135384
  if (event === EVENTS.UNLINK) {
135138
- this._pendingUnlinks.set(path22, [event, ...args2]);
135385
+ this._pendingUnlinks.set(path42, [event, ...args2]);
135139
135386
  setTimeout(() => {
135140
- this._pendingUnlinks.forEach((entry, path3) => {
135387
+ this._pendingUnlinks.forEach((entry, path5) => {
135141
135388
  this.emit(...entry);
135142
135389
  this.emit(EVENTS.ALL, ...entry);
135143
- this._pendingUnlinks.delete(path3);
135390
+ this._pendingUnlinks.delete(path5);
135144
135391
  });
135145
135392
  }, typeof opts.atomic === "number" ? opts.atomic : 100);
135146
135393
  return this;
135147
135394
  }
135148
- if (event === EVENTS.ADD && this._pendingUnlinks.has(path22)) {
135395
+ if (event === EVENTS.ADD && this._pendingUnlinks.has(path42)) {
135149
135396
  event = EVENTS.CHANGE;
135150
- this._pendingUnlinks.delete(path22);
135397
+ this._pendingUnlinks.delete(path42);
135151
135398
  }
135152
135399
  }
135153
135400
  if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
@@ -135165,16 +135412,16 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
135165
135412
  this.emitWithAll(event, args2);
135166
135413
  }
135167
135414
  };
135168
- this._awaitWriteFinish(path22, awf.stabilityThreshold, event, awfEmit);
135415
+ this._awaitWriteFinish(path42, awf.stabilityThreshold, event, awfEmit);
135169
135416
  return this;
135170
135417
  }
135171
135418
  if (event === EVENTS.CHANGE) {
135172
- const isThrottled = !this._throttle(EVENTS.CHANGE, path22, 50);
135419
+ const isThrottled = !this._throttle(EVENTS.CHANGE, path42, 50);
135173
135420
  if (isThrottled)
135174
135421
  return this;
135175
135422
  }
135176
135423
  if (opts.alwaysStat && stats === undefined && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
135177
- const fullPath = opts.cwd ? sp2.join(opts.cwd, path22) : path22;
135424
+ const fullPath = opts.cwd ? sp2.join(opts.cwd, path42) : path42;
135178
135425
  let stats2;
135179
135426
  try {
135180
135427
  stats2 = await stat3(fullPath);
@@ -135193,23 +135440,23 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
135193
135440
  }
135194
135441
  return error51 || this.closed;
135195
135442
  }
135196
- _throttle(actionType, path22, timeout6) {
135443
+ _throttle(actionType, path42, timeout6) {
135197
135444
  if (!this._throttled.has(actionType)) {
135198
135445
  this._throttled.set(actionType, new Map);
135199
135446
  }
135200
135447
  const action = this._throttled.get(actionType);
135201
135448
  if (!action)
135202
135449
  throw new Error("invalid throttle");
135203
- const actionPath = action.get(path22);
135450
+ const actionPath = action.get(path42);
135204
135451
  if (actionPath) {
135205
135452
  actionPath.count++;
135206
135453
  return false;
135207
135454
  }
135208
135455
  let timeoutObject;
135209
135456
  const clear8 = () => {
135210
- const item = action.get(path22);
135457
+ const item = action.get(path42);
135211
135458
  const count10 = item ? item.count : 0;
135212
- action.delete(path22);
135459
+ action.delete(path42);
135213
135460
  clearTimeout(timeoutObject);
135214
135461
  if (item)
135215
135462
  clearTimeout(item.timeoutObject);
@@ -135217,50 +135464,50 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
135217
135464
  };
135218
135465
  timeoutObject = setTimeout(clear8, timeout6);
135219
135466
  const thr = { timeoutObject, clear: clear8, count: 0 };
135220
- action.set(path22, thr);
135467
+ action.set(path42, thr);
135221
135468
  return thr;
135222
135469
  }
135223
135470
  _incrReadyCount() {
135224
135471
  return this._readyCount++;
135225
135472
  }
135226
- _awaitWriteFinish(path22, threshold, event, awfEmit) {
135473
+ _awaitWriteFinish(path42, threshold, event, awfEmit) {
135227
135474
  const awf = this.options.awaitWriteFinish;
135228
135475
  if (typeof awf !== "object")
135229
135476
  return;
135230
135477
  const pollInterval = awf.pollInterval;
135231
135478
  let timeoutHandler;
135232
- let fullPath = path22;
135233
- if (this.options.cwd && !sp2.isAbsolute(path22)) {
135234
- fullPath = sp2.join(this.options.cwd, path22);
135479
+ let fullPath = path42;
135480
+ if (this.options.cwd && !sp2.isAbsolute(path42)) {
135481
+ fullPath = sp2.join(this.options.cwd, path42);
135235
135482
  }
135236
135483
  const now3 = new Date;
135237
135484
  const writes = this._pendingWrites;
135238
135485
  function awaitWriteFinishFn(prevStat) {
135239
135486
  statcb(fullPath, (err, curStat) => {
135240
- if (err || !writes.has(path22)) {
135487
+ if (err || !writes.has(path42)) {
135241
135488
  if (err && err.code !== "ENOENT")
135242
135489
  awfEmit(err);
135243
135490
  return;
135244
135491
  }
135245
135492
  const now4 = Number(new Date);
135246
135493
  if (prevStat && curStat.size !== prevStat.size) {
135247
- writes.get(path22).lastChange = now4;
135494
+ writes.get(path42).lastChange = now4;
135248
135495
  }
135249
- const pw = writes.get(path22);
135496
+ const pw = writes.get(path42);
135250
135497
  const df = now4 - pw.lastChange;
135251
135498
  if (df >= threshold) {
135252
- writes.delete(path22);
135499
+ writes.delete(path42);
135253
135500
  awfEmit(undefined, curStat);
135254
135501
  } else {
135255
135502
  timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
135256
135503
  }
135257
135504
  });
135258
135505
  }
135259
- if (!writes.has(path22)) {
135260
- writes.set(path22, {
135506
+ if (!writes.has(path42)) {
135507
+ writes.set(path42, {
135261
135508
  lastChange: now3,
135262
135509
  cancelWait: () => {
135263
- writes.delete(path22);
135510
+ writes.delete(path42);
135264
135511
  clearTimeout(timeoutHandler);
135265
135512
  return event;
135266
135513
  }
@@ -135268,8 +135515,8 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
135268
135515
  timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval);
135269
135516
  }
135270
135517
  }
135271
- _isIgnored(path22, stats) {
135272
- if (this.options.atomic && DOT_RE.test(path22))
135518
+ _isIgnored(path42, stats) {
135519
+ if (this.options.atomic && DOT_RE.test(path42))
135273
135520
  return true;
135274
135521
  if (!this._userIgnored) {
135275
135522
  const { cwd } = this.options;
@@ -135279,13 +135526,13 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
135279
135526
  const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored2];
135280
135527
  this._userIgnored = anymatch(list, undefined);
135281
135528
  }
135282
- return this._userIgnored(path22, stats);
135529
+ return this._userIgnored(path42, stats);
135283
135530
  }
135284
- _isntIgnored(path22, stat4) {
135285
- return !this._isIgnored(path22, stat4);
135531
+ _isntIgnored(path42, stat4) {
135532
+ return !this._isIgnored(path42, stat4);
135286
135533
  }
135287
- _getWatchHelpers(path22) {
135288
- return new WatchHelper(path22, this.options.followSymlinks, this);
135534
+ _getWatchHelpers(path42) {
135535
+ return new WatchHelper(path42, this.options.followSymlinks, this);
135289
135536
  }
135290
135537
  _getWatchedDir(directory) {
135291
135538
  const dir3 = sp2.resolve(directory);
@@ -135299,57 +135546,57 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
135299
135546
  return Boolean(Number(stats.mode) & 256);
135300
135547
  }
135301
135548
  _remove(directory, item, isDirectory) {
135302
- const path22 = sp2.join(directory, item);
135303
- const fullPath = sp2.resolve(path22);
135304
- isDirectory = isDirectory != null ? isDirectory : this._watched.has(path22) || this._watched.has(fullPath);
135305
- if (!this._throttle("remove", path22, 100))
135549
+ const path42 = sp2.join(directory, item);
135550
+ const fullPath = sp2.resolve(path42);
135551
+ isDirectory = isDirectory != null ? isDirectory : this._watched.has(path42) || this._watched.has(fullPath);
135552
+ if (!this._throttle("remove", path42, 100))
135306
135553
  return;
135307
135554
  if (!isDirectory && this._watched.size === 1) {
135308
135555
  this.add(directory, item, true);
135309
135556
  }
135310
- const wp = this._getWatchedDir(path22);
135557
+ const wp = this._getWatchedDir(path42);
135311
135558
  const nestedDirectoryChildren = wp.getChildren();
135312
- nestedDirectoryChildren.forEach((nested7) => this._remove(path22, nested7));
135559
+ nestedDirectoryChildren.forEach((nested7) => this._remove(path42, nested7));
135313
135560
  const parent = this._getWatchedDir(directory);
135314
135561
  const wasTracked = parent.has(item);
135315
135562
  parent.remove(item);
135316
135563
  if (this._symlinkPaths.has(fullPath)) {
135317
135564
  this._symlinkPaths.delete(fullPath);
135318
135565
  }
135319
- let relPath = path22;
135566
+ let relPath = path42;
135320
135567
  if (this.options.cwd)
135321
- relPath = sp2.relative(this.options.cwd, path22);
135568
+ relPath = sp2.relative(this.options.cwd, path42);
135322
135569
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
135323
135570
  const event = this._pendingWrites.get(relPath).cancelWait();
135324
135571
  if (event === EVENTS.ADD)
135325
135572
  return;
135326
135573
  }
135327
- this._watched.delete(path22);
135574
+ this._watched.delete(path42);
135328
135575
  this._watched.delete(fullPath);
135329
135576
  const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
135330
- if (wasTracked && !this._isIgnored(path22))
135331
- this._emit(eventName, path22);
135332
- this._closePath(path22);
135577
+ if (wasTracked && !this._isIgnored(path42))
135578
+ this._emit(eventName, path42);
135579
+ this._closePath(path42);
135333
135580
  }
135334
- _closePath(path22) {
135335
- this._closeFile(path22);
135336
- const dir3 = sp2.dirname(path22);
135337
- this._getWatchedDir(dir3).remove(sp2.basename(path22));
135581
+ _closePath(path42) {
135582
+ this._closeFile(path42);
135583
+ const dir3 = sp2.dirname(path42);
135584
+ this._getWatchedDir(dir3).remove(sp2.basename(path42));
135338
135585
  }
135339
- _closeFile(path22) {
135340
- const closers = this._closers.get(path22);
135586
+ _closeFile(path42) {
135587
+ const closers = this._closers.get(path42);
135341
135588
  if (!closers)
135342
135589
  return;
135343
135590
  closers.forEach((closer) => closer());
135344
- this._closers.delete(path22);
135591
+ this._closers.delete(path42);
135345
135592
  }
135346
- _addPathCloser(path22, closer) {
135593
+ _addPathCloser(path42, closer) {
135347
135594
  if (!closer)
135348
135595
  return;
135349
- let list = this._closers.get(path22);
135596
+ let list = this._closers.get(path42);
135350
135597
  if (!list) {
135351
135598
  list = [];
135352
- this._closers.set(path22, list);
135599
+ this._closers.set(path42, list);
135353
135600
  }
135354
135601
  list.push(closer);
135355
135602
  }
@@ -135397,9 +135644,9 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
135397
135644
  pollInterval: 50
135398
135645
  }
135399
135646
  });
135400
- this.watcher.on("add", (path22) => this.handleFileEvent(path22, "added"));
135401
- this.watcher.on("change", (path22) => this.handleFileEvent(path22, "changed"));
135402
- this.watcher.on("unlink", (path22) => this.handleFileEvent(path22, "unlinked"));
135647
+ this.watcher.on("add", (path42) => this.handleFileEvent(path42, "added"));
135648
+ this.watcher.on("change", (path42) => this.handleFileEvent(path42, "changed"));
135649
+ this.watcher.on("unlink", (path42) => this.handleFileEvent(path42, "unlinked"));
135403
135650
  this.watcher.on("error", (error51) => {
135404
135651
  this.emit("error", error51);
135405
135652
  });
@@ -135421,20 +135668,20 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
135421
135668
  await this.watcher.close();
135422
135669
  this.watcher = null;
135423
135670
  }
135424
- handleFileEvent(path22, event) {
135425
- if (!path22.endsWith(".jsonl")) {
135671
+ handleFileEvent(path42, event) {
135672
+ if (!path42.endsWith(".jsonl")) {
135426
135673
  return;
135427
135674
  }
135428
- const existingTimer = this.debounceTimers.get(path22);
135675
+ const existingTimer = this.debounceTimers.get(path42);
135429
135676
  if (existingTimer) {
135430
135677
  clearTimeout(existingTimer);
135431
135678
  }
135432
135679
  const timer4 = setTimeout(() => {
135433
- this.debounceTimers.delete(path22);
135434
- const fileEvent = { path: path22, event };
135680
+ this.debounceTimers.delete(path42);
135681
+ const fileEvent = { path: path42, event };
135435
135682
  this.emit(`file-${event}`, fileEvent);
135436
135683
  }, this.debounce);
135437
- this.debounceTimers.set(path22, timer4);
135684
+ this.debounceTimers.set(path42, timer4);
135438
135685
  }
135439
135686
  };
135440
135687
  init_esm();
@@ -135547,7 +135794,7 @@ __export(exports_util3, {
135547
135794
  promiseAllObject: () => promiseAllObject3,
135548
135795
  primitiveTypes: () => primitiveTypes3,
135549
135796
  prefixIssues: () => prefixIssues3,
135550
- pick: () => pick7,
135797
+ pick: () => pick9,
135551
135798
  partial: () => partial4,
135552
135799
  optionalKeys: () => optionalKeys3,
135553
135800
  omit: () => omit7,
@@ -135698,10 +135945,10 @@ function mergeDefs3(...defs) {
135698
135945
  function cloneDef3(schema) {
135699
135946
  return mergeDefs3(schema._zod.def);
135700
135947
  }
135701
- function getElementAtPath3(obj, path3) {
135702
- if (!path3)
135948
+ function getElementAtPath3(obj, path6) {
135949
+ if (!path6)
135703
135950
  return obj;
135704
- return path3.reduce((acc, key) => acc?.[key], obj);
135951
+ return path6.reduce((acc, key) => acc?.[key], obj);
135705
135952
  }
135706
135953
  function promiseAllObject3(promisesObj) {
135707
135954
  const keys15 = Object.keys(promisesObj);
@@ -135828,7 +136075,7 @@ function optionalKeys3(shape) {
135828
136075
  return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
135829
136076
  });
135830
136077
  }
135831
- function pick7(schema, mask) {
136078
+ function pick9(schema, mask) {
135832
136079
  const currDef = schema._zod.def;
135833
136080
  const def = mergeDefs3(schema._zod.def, {
135834
136081
  get shape() {
@@ -135990,11 +136237,11 @@ function aborted3(x, startIndex = 0) {
135990
136237
  }
135991
136238
  return false;
135992
136239
  }
135993
- function prefixIssues3(path3, issues) {
136240
+ function prefixIssues3(path6, issues) {
135994
136241
  return issues.map((iss) => {
135995
136242
  var _a16;
135996
136243
  (_a16 = iss).path ?? (_a16.path = []);
135997
- iss.path.unshift(path3);
136244
+ iss.path.unshift(path6);
135998
136245
  return iss;
135999
136246
  });
136000
136247
  }
@@ -136217,7 +136464,7 @@ function treeifyError3(error51, _mapper) {
136217
136464
  return issue4.message;
136218
136465
  };
136219
136466
  const result = { errors: [] };
136220
- const processError = (error53, path3 = []) => {
136467
+ const processError = (error53, path6 = []) => {
136221
136468
  var _a16, _b16;
136222
136469
  for (const issue4 of error53.issues) {
136223
136470
  if (issue4.code === "invalid_union" && issue4.errors.length) {
@@ -136227,7 +136474,7 @@ function treeifyError3(error51, _mapper) {
136227
136474
  } else if (issue4.code === "invalid_element") {
136228
136475
  processError({ issues: issue4.issues }, issue4.path);
136229
136476
  } else {
136230
- const fullpath = [...path3, ...issue4.path];
136477
+ const fullpath = [...path6, ...issue4.path];
136231
136478
  if (fullpath.length === 0) {
136232
136479
  result.errors.push(mapper(issue4));
136233
136480
  continue;
@@ -136259,8 +136506,8 @@ function treeifyError3(error51, _mapper) {
136259
136506
  }
136260
136507
  function toDotPath3(_path) {
136261
136508
  const segs = [];
136262
- const path3 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
136263
- for (const seg of path3) {
136509
+ const path6 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
136510
+ for (const seg of path6) {
136264
136511
  if (typeof seg === "number")
136265
136512
  segs.push(`[${seg}]`);
136266
136513
  else if (typeof seg === "symbol")
@@ -148145,13 +148392,13 @@ __export(exports_eval_capture, {
148145
148392
  });
148146
148393
  import * as fs2 from "node:fs";
148147
148394
  import * as os from "node:os";
148148
- import * as path3 from "node:path";
148395
+ import * as path8 from "node:path";
148149
148396
  function getEvalDataPath(projectPath) {
148150
- return path3.join(projectPath, DEFAULT_EVAL_DATA_PATH);
148397
+ return path8.join(projectPath, DEFAULT_EVAL_DATA_PATH);
148151
148398
  }
148152
148399
  function ensureEvalDataDir(projectPath) {
148153
148400
  const evalPath = getEvalDataPath(projectPath);
148154
- const dir3 = path3.dirname(evalPath);
148401
+ const dir3 = path8.dirname(evalPath);
148155
148402
  if (!fs2.existsSync(dir3)) {
148156
148403
  fs2.mkdirSync(dir3, { recursive: true });
148157
148404
  }
@@ -148325,10 +148572,10 @@ function getEvalDataStats(projectPath) {
148325
148572
  };
148326
148573
  }
148327
148574
  function getSessionDir() {
148328
- return process.env.SWARM_SESSIONS_DIR || path3.join(os.homedir(), ".config", "swarm-tools", "sessions");
148575
+ return process.env.SWARM_SESSIONS_DIR || path8.join(os.homedir(), ".config", "swarm-tools", "sessions");
148329
148576
  }
148330
148577
  function getSessionPath(sessionId) {
148331
- return path3.join(getSessionDir(), `${sessionId}.jsonl`);
148578
+ return path8.join(getSessionDir(), `${sessionId}.jsonl`);
148332
148579
  }
148333
148580
  function ensureSessionDir() {
148334
148581
  const sessionDir = getSessionDir();
@@ -153091,7 +153338,7 @@ WD9f
153091
153338
 
153092
153339
  // ../../node_modules/ioredis/built/utils/index.js
153093
153340
  var require_utils9 = __commonJS((exports) => {
153094
- var __dirname = "/home/runner/work/swarm-tools/swarm-tools/node_modules/ioredis/built/utils";
153341
+ var __dirname = "/home/runner/work/swarm/swarm/node_modules/ioredis/built/utils";
153095
153342
  Object.defineProperty(exports, "__esModule", { value: true });
153096
153343
  exports.noop = exports.defaults = exports.Debug = exports.getPackageMeta = exports.zipMap = exports.CONNECTION_CLOSED_ERROR_MSG = exports.shuffle = exports.sample = exports.resolveTLSProfile = exports.parseURL = exports.optimizeErrorStack = exports.toArg = exports.convertMapToArray = exports.convertObjectToArray = exports.timeout = exports.packObject = exports.isInt = exports.wrapMultiResult = exports.convertBufferToString = undefined;
153097
153344
  var fs_1 = __require("fs");
@@ -153321,7 +153568,7 @@ var require_utils9 = __commonJS((exports) => {
153321
153568
 
153322
153569
  // ../../node_modules/ioredis/built/Command.js
153323
153570
  var require_Command = __commonJS((exports) => {
153324
- var __dirname = "/home/runner/work/swarm-tools/swarm-tools/node_modules/ioredis/built";
153571
+ var __dirname = "/home/runner/work/swarm/swarm/node_modules/ioredis/built";
153325
153572
  Object.defineProperty(exports, "__esModule", { value: true });
153326
153573
  var commands_1 = require_built();
153327
153574
  var calculateSlot = require_lib();
@@ -162360,15 +162607,15 @@ __export(exports_skills, {
162360
162607
  });
162361
162608
  import { readdir as readdir3, readFile as readFile2, stat as stat4, mkdir, writeFile as writeFile2, rm } from "fs/promises";
162362
162609
  import {
162363
- join as join23,
162610
+ join as join25,
162364
162611
  basename as basename4,
162365
- dirname as dirname5,
162612
+ dirname as dirname6,
162366
162613
  resolve as resolve4,
162367
162614
  relative as relative3,
162368
- isAbsolute as isAbsolute2,
162615
+ isAbsolute as isAbsolute4,
162369
162616
  sep as sep2
162370
162617
  } from "path";
162371
- import { fileURLToPath } from "url";
162618
+ import { fileURLToPath as fileURLToPath2 } from "url";
162372
162619
  function resolveGuidanceModel(model) {
162373
162620
  if (!model)
162374
162621
  return "unknown";
@@ -162473,19 +162720,19 @@ function validateSkillMetadata(raw, filePath) {
162473
162720
  }
162474
162721
  function getGlobalSkillsDir() {
162475
162722
  const home = process.env.HOME || process.env.USERPROFILE || "~";
162476
- return join23(home, ".config", "opencode", "skill");
162723
+ return join25(home, ".config", "opencode", "skill");
162477
162724
  }
162478
162725
  function getClaudeGlobalSkillsDir() {
162479
162726
  const home = process.env.HOME || process.env.USERPROFILE || "~";
162480
- return join23(home, ".claude", "skills");
162727
+ return join25(home, ".claude", "skills");
162481
162728
  }
162482
162729
  function getPackageSkillsDir() {
162483
162730
  try {
162484
- const currentFilePath = fileURLToPath(import.meta.url);
162485
- return join23(dirname5(currentFilePath), "..", "global-skills");
162731
+ const currentFilePath = fileURLToPath2(import.meta.url);
162732
+ return join25(dirname6(currentFilePath), "..", "global-skills");
162486
162733
  } catch {
162487
162734
  const currentDir = decodeURIComponent(new URL(".", import.meta.url).pathname);
162488
- return join23(currentDir, "..", "global-skills");
162735
+ return join25(currentDir, "..", "global-skills");
162489
162736
  }
162490
162737
  }
162491
162738
  async function findSkillFiles(baseDir) {
@@ -162494,7 +162741,7 @@ async function findSkillFiles(baseDir) {
162494
162741
  const entries8 = await readdir3(baseDir, { withFileTypes: true });
162495
162742
  for (const entry of entries8) {
162496
162743
  if (entry.isDirectory()) {
162497
- const skillPath = join23(baseDir, entry.name, "SKILL.md");
162744
+ const skillPath = join25(baseDir, entry.name, "SKILL.md");
162498
162745
  try {
162499
162746
  const s = await stat4(skillPath);
162500
162747
  if (s.isFile()) {
@@ -162508,7 +162755,7 @@ async function findSkillFiles(baseDir) {
162508
162755
  }
162509
162756
  async function findSkillScripts(skillDir) {
162510
162757
  const scripts = [];
162511
- const scriptsDir = join23(skillDir, "scripts");
162758
+ const scriptsDir = join25(skillDir, "scripts");
162512
162759
  try {
162513
162760
  const entries8 = await readdir3(scriptsDir, { withFileTypes: true });
162514
162761
  for (const entry of entries8) {
@@ -162523,7 +162770,7 @@ async function loadSkill(skillPath) {
162523
162770
  const content = await readFile2(skillPath, "utf-8");
162524
162771
  const { metadata: rawMetadata, body } = parseFrontmatter(content);
162525
162772
  const metadata = validateSkillMetadata(rawMetadata, skillPath);
162526
- const directory = dirname5(skillPath);
162773
+ const directory = dirname6(skillPath);
162527
162774
  const scripts = await findSkillScripts(directory);
162528
162775
  return {
162529
162776
  metadata,
@@ -162556,7 +162803,7 @@ async function discoverSkills(projectDir) {
162556
162803
  }
162557
162804
  }
162558
162805
  for (const relPath of PROJECT_SKILL_DIRECTORIES) {
162559
- await loadSkillsFromDir(join23(dir3, relPath));
162806
+ await loadSkillsFromDir(join25(dir3, relPath));
162560
162807
  }
162561
162808
  await loadSkillsFromDir(getGlobalSkillsDir());
162562
162809
  await loadSkillsFromDir(getClaudeGlobalSkillsDir());
@@ -162957,7 +163204,7 @@ Scripts run in the skill's directory with the project directory as an argument.`
162957
163204
  if (!skill.scripts.includes(args2.script)) {
162958
163205
  return `Script '${args2.script}' not found in skill '${args2.skill}'. Available: ${skill.scripts.join(", ") || "none"}`;
162959
163206
  }
162960
- const scriptPath = join23(skill.directory, "scripts", args2.script);
163207
+ const scriptPath = join25(skill.directory, "scripts", args2.script);
162961
163208
  const scriptArgs = args2.args || [];
162962
163209
  try {
162963
163210
  const TIMEOUT_MS = 60000;
@@ -163013,7 +163260,7 @@ Use this to access supplementary skill resources.`,
163013
163260
  if (!skill) {
163014
163261
  return `Skill '${args2.skill}' not found.`;
163015
163262
  }
163016
- if (isAbsolute2(args2.file)) {
163263
+ if (isAbsolute4(args2.file)) {
163017
163264
  return "Invalid file path. Use a relative path.";
163018
163265
  }
163019
163266
  if (args2.file.includes("..")) {
@@ -163066,14 +163313,14 @@ Good skills have:
163066
163313
  const csoWarnings = validateCSOCompliance(args2.name, args2.description);
163067
163314
  let skillDir;
163068
163315
  if (args2.directory === "global") {
163069
- skillDir = join23(getGlobalSkillsDir(), args2.name);
163316
+ skillDir = join25(getGlobalSkillsDir(), args2.name);
163070
163317
  } else if (args2.directory === "global-claude") {
163071
- skillDir = join23(getClaudeGlobalSkillsDir(), args2.name);
163318
+ skillDir = join25(getClaudeGlobalSkillsDir(), args2.name);
163072
163319
  } else {
163073
163320
  const baseDir = args2.directory || DEFAULT_SKILLS_DIR;
163074
- skillDir = join23(skillsProjectDirectory, baseDir, args2.name);
163321
+ skillDir = join25(skillsProjectDirectory, baseDir, args2.name);
163075
163322
  }
163076
- const skillPath = join23(skillDir, "SKILL.md");
163323
+ const skillPath = join25(skillDir, "SKILL.md");
163077
163324
  try {
163078
163325
  await mkdir(skillDir, { recursive: true });
163079
163326
  const content = generateSkillContent(args2.name, args2.description, args2.body, { tags: args2.tags, tools: args2.tools });
@@ -163227,11 +163474,11 @@ executed with skills_execute. Use for:
163227
163474
  if (!skill) {
163228
163475
  return `Skill '${args2.skill}' not found.`;
163229
163476
  }
163230
- if (isAbsolute2(args2.script_name) || args2.script_name.includes("..") || args2.script_name.includes("/") || args2.script_name.includes("\\") || basename4(args2.script_name) !== args2.script_name) {
163477
+ if (isAbsolute4(args2.script_name) || args2.script_name.includes("..") || args2.script_name.includes("/") || args2.script_name.includes("\\") || basename4(args2.script_name) !== args2.script_name) {
163231
163478
  return "Invalid script name. Use simple filenames without paths.";
163232
163479
  }
163233
- const scriptsDir = join23(skill.directory, "scripts");
163234
- const scriptPath = join23(scriptsDir, args2.script_name);
163480
+ const scriptsDir = join25(skill.directory, "scripts");
163481
+ const scriptPath = join25(scriptsDir, args2.script_name);
163235
163482
  try {
163236
163483
  await mkdir(scriptsDir, { recursive: true });
163237
163484
  await writeFile2(scriptPath, args2.content, {
@@ -163280,20 +163527,20 @@ Perfect for learning to create effective skills.`,
163280
163527
  }
163281
163528
  let skillDir;
163282
163529
  if (args2.directory === "global") {
163283
- skillDir = join23(getGlobalSkillsDir(), args2.name);
163530
+ skillDir = join25(getGlobalSkillsDir(), args2.name);
163284
163531
  } else {
163285
163532
  const baseDir = args2.directory || DEFAULT_SKILLS_DIR;
163286
- skillDir = join23(skillsProjectDirectory, baseDir, args2.name);
163533
+ skillDir = join25(skillsProjectDirectory, baseDir, args2.name);
163287
163534
  }
163288
163535
  const createdFiles = [];
163289
163536
  try {
163290
163537
  await mkdir(skillDir, { recursive: true });
163291
- const skillPath = join23(skillDir, "SKILL.md");
163538
+ const skillPath = join25(skillDir, "SKILL.md");
163292
163539
  const skillContent = generateSkillTemplate(args2.name, args2.description);
163293
163540
  await writeFile2(skillPath, skillContent, "utf-8");
163294
163541
  createdFiles.push("SKILL.md");
163295
163542
  if (args2.include_example_script !== false) {
163296
- const scriptsDir = join23(skillDir, "scripts");
163543
+ const scriptsDir = join25(skillDir, "scripts");
163297
163544
  await mkdir(scriptsDir, { recursive: true });
163298
163545
  const exampleScript = `#!/usr/bin/env bash
163299
163546
  # Example helper script for ${args2.name}
@@ -163307,15 +163554,15 @@ echo "Project directory: $1"
163307
163554
 
163308
163555
  # TODO: Add actual script logic
163309
163556
  `;
163310
- const scriptPath = join23(scriptsDir, "example.sh");
163557
+ const scriptPath = join25(scriptsDir, "example.sh");
163311
163558
  await writeFile2(scriptPath, exampleScript, { mode: 493 });
163312
163559
  createdFiles.push("scripts/example.sh");
163313
163560
  }
163314
163561
  if (args2.include_reference !== false) {
163315
- const refsDir = join23(skillDir, "references");
163562
+ const refsDir = join25(skillDir, "references");
163316
163563
  await mkdir(refsDir, { recursive: true });
163317
163564
  const refContent = generateReferenceTemplate(args2.name);
163318
- const refPath = join23(refsDir, "guide.md");
163565
+ const refPath = join25(refsDir, "guide.md");
163319
163566
  await writeFile2(refPath, refContent, "utf-8");
163320
163567
  createdFiles.push("references/guide.md");
163321
163568
  }
@@ -165289,7 +165536,7 @@ var allocate3 = (n) => new Array(n), makeBy4, fromIterable34 = (collection) => A
165289
165536
  next6 = b2;
165290
165537
  }
165291
165538
  return out;
165292
- }, getEquivalence11, dedupeWith2, dedupe3 = (self) => dedupeWith2(self, equivalence3()), join26;
165539
+ }, getEquivalence11, dedupeWith2, dedupe3 = (self) => dedupeWith2(self, equivalence3()), join27;
165293
165540
  var init_Array2 = __esm(() => {
165294
165541
  init_Either2();
165295
165542
  init_Equal2();
@@ -165440,7 +165687,7 @@ var init_Array2 = __esm(() => {
165440
165687
  }
165441
165688
  return [];
165442
165689
  });
165443
- join26 = /* @__PURE__ */ dual2(2, (self, sep5) => fromIterable34(self).join(sep5));
165690
+ join27 = /* @__PURE__ */ dual2(2, (self, sep5) => fromIterable34(self).join(sep5));
165444
165691
  });
165445
165692
 
165446
165693
  // ../../node_modules/fast-check/lib/esm/fast-check-default.js
@@ -165478,17 +165725,17 @@ var getKeysForIndexSignature2 = (input, parameter) => {
165478
165725
  done17 = true;
165479
165726
  return a;
165480
165727
  };
165481
- }, isNonEmpty11 = (x) => Array.isArray(x), isSingle2 = (x) => !Array.isArray(x), formatPathKey2 = (key) => `[${formatPropertyKey3(key)}]`, formatPath2 = (path4) => isNonEmpty11(path4) ? path4.map(formatPathKey2).join("") : formatPathKey2(path4);
165728
+ }, isNonEmpty11 = (x) => Array.isArray(x), isSingle2 = (x) => !Array.isArray(x), formatPathKey2 = (key) => `[${formatPropertyKey3(key)}]`, formatPath2 = (path6) => isNonEmpty11(path6) ? path6.map(formatPathKey2).join("") : formatPathKey2(path6);
165482
165729
  var init_util7 = __esm(() => {
165483
165730
  init_Inspectable2();
165484
165731
  });
165485
165732
 
165486
165733
  // ../../node_modules/effect/dist/esm/internal/schema/errors.js
165487
- var getErrorMessage5 = (reason, details, path4, ast) => {
165734
+ var getErrorMessage5 = (reason, details, path6, ast) => {
165488
165735
  let out = reason;
165489
- if (path4 && isNonEmptyReadonlyArray2(path4)) {
165736
+ if (path6 && isNonEmptyReadonlyArray2(path6)) {
165490
165737
  out += `
165491
- at path: ${formatPath2(path4)}`;
165738
+ at path: ${formatPath2(path6)}`;
165492
165739
  }
165493
165740
  if (details !== undefined) {
165494
165741
  out += `
@@ -166501,7 +166748,7 @@ var TypeId48, BigDecimalProto2, isBigDecimal2 = (u) => hasProperty2(u, TypeId48)
166501
166748
  const o = make157(value10, scale2);
166502
166749
  o.normalized = o;
166503
166750
  return o;
166504
- }, bigint06, bigint102, zero3, normalize3 = (self) => {
166751
+ }, bigint06, bigint102, zero3, normalize6 = (self) => {
166505
166752
  if (self.normalized === undefined) {
166506
166753
  if (self.value === bigint06) {
166507
166754
  self.normalized = zero3;
@@ -166525,7 +166772,7 @@ var TypeId48, BigDecimalProto2, isBigDecimal2 = (u) => hasProperty2(u, TypeId48)
166525
166772
  }
166526
166773
  return self.normalized;
166527
166774
  }, scale2, abs3 = (n) => n.value < bigint06 ? make157(-n.value, n.scale) : n, Equivalence11, equals8, format10 = (n) => {
166528
- const normalized = normalize3(n);
166775
+ const normalized = normalize6(n);
166529
166776
  if (Math.abs(normalized.scale) >= 16) {
166530
166777
  return toExponential2(normalized);
166531
166778
  }
@@ -166553,7 +166800,7 @@ var TypeId48, BigDecimalProto2, isBigDecimal2 = (u) => hasProperty2(u, TypeId48)
166553
166800
  if (isZero3(n)) {
166554
166801
  return "0e+0";
166555
166802
  }
166556
- const normalized = normalize3(n);
166803
+ const normalized = normalize6(n);
166557
166804
  const digits = `${abs3(normalized).value}`;
166558
166805
  const head14 = digits.slice(0, 1);
166559
166806
  const tail5 = digits.slice(1);
@@ -166576,7 +166823,7 @@ var init_BigDecimal2 = __esm(() => {
166576
166823
  BigDecimalProto2 = {
166577
166824
  [TypeId48]: TypeId48,
166578
166825
  [symbol19]() {
166579
- const normalized = normalize3(this);
166826
+ const normalized = normalize6(this);
166580
166827
  return pipe4(hash7(normalized.value), combine20(number15(normalized.scale)), cached7(this));
166581
166828
  },
166582
166829
  [symbol21](that) {
@@ -171112,64 +171359,64 @@ var ConfigErrorSymbolKey2 = "effect/ConfigError", ConfigErrorTypeId3, proto18, A
171112
171359
  }
171113
171360
  });
171114
171361
  return error64;
171115
- }, InvalidData3 = (path4, message, options2 = {
171362
+ }, InvalidData3 = (path6, message, options2 = {
171116
171363
  pathDelim: "."
171117
171364
  }) => {
171118
171365
  const error64 = Object.create(proto18);
171119
171366
  error64._op = OP_INVALID_DATA2;
171120
- error64.path = path4;
171367
+ error64.path = path6;
171121
171368
  error64.message = message;
171122
171369
  Object.defineProperty(error64, "toString", {
171123
171370
  enumerable: false,
171124
171371
  value() {
171125
- const path6 = pipe4(this.path, join26(options2.pathDelim));
171126
- return `(Invalid data at ${path6}: "${this.message}")`;
171372
+ const path10 = pipe4(this.path, join27(options2.pathDelim));
171373
+ return `(Invalid data at ${path10}: "${this.message}")`;
171127
171374
  }
171128
171375
  });
171129
171376
  return error64;
171130
- }, MissingData3 = (path4, message, options2 = {
171377
+ }, MissingData3 = (path6, message, options2 = {
171131
171378
  pathDelim: "."
171132
171379
  }) => {
171133
171380
  const error64 = Object.create(proto18);
171134
171381
  error64._op = OP_MISSING_DATA2;
171135
- error64.path = path4;
171382
+ error64.path = path6;
171136
171383
  error64.message = message;
171137
171384
  Object.defineProperty(error64, "toString", {
171138
171385
  enumerable: false,
171139
171386
  value() {
171140
- const path6 = pipe4(this.path, join26(options2.pathDelim));
171141
- return `(Missing data at ${path6}: "${this.message}")`;
171387
+ const path10 = pipe4(this.path, join27(options2.pathDelim));
171388
+ return `(Missing data at ${path10}: "${this.message}")`;
171142
171389
  }
171143
171390
  });
171144
171391
  return error64;
171145
- }, SourceUnavailable3 = (path4, message, cause3, options2 = {
171392
+ }, SourceUnavailable3 = (path6, message, cause3, options2 = {
171146
171393
  pathDelim: "."
171147
171394
  }) => {
171148
171395
  const error64 = Object.create(proto18);
171149
171396
  error64._op = OP_SOURCE_UNAVAILABLE2;
171150
- error64.path = path4;
171397
+ error64.path = path6;
171151
171398
  error64.message = message;
171152
171399
  error64.cause = cause3;
171153
171400
  Object.defineProperty(error64, "toString", {
171154
171401
  enumerable: false,
171155
171402
  value() {
171156
- const path6 = pipe4(this.path, join26(options2.pathDelim));
171157
- return `(Source unavailable at ${path6}: "${this.message}")`;
171403
+ const path10 = pipe4(this.path, join27(options2.pathDelim));
171404
+ return `(Source unavailable at ${path10}: "${this.message}")`;
171158
171405
  }
171159
171406
  });
171160
171407
  return error64;
171161
- }, Unsupported3 = (path4, message, options2 = {
171408
+ }, Unsupported3 = (path6, message, options2 = {
171162
171409
  pathDelim: "."
171163
171410
  }) => {
171164
171411
  const error64 = Object.create(proto18);
171165
171412
  error64._op = OP_UNSUPPORTED2;
171166
- error64.path = path4;
171413
+ error64.path = path6;
171167
171414
  error64.message = message;
171168
171415
  Object.defineProperty(error64, "toString", {
171169
171416
  enumerable: false,
171170
171417
  value() {
171171
- const path6 = pipe4(this.path, join26(options2.pathDelim));
171172
- return `(Unsupported operation at ${path6}: "${this.message}")`;
171418
+ const path10 = pipe4(this.path, join27(options2.pathDelim));
171419
+ return `(Unsupported operation at ${path10}: "${this.message}")`;
171173
171420
  }
171174
171421
  });
171175
171422
  return error64;
@@ -171218,9 +171465,9 @@ var init_pathPatch2 = __esm(() => {
171218
171465
  empty81 = {
171219
171466
  _tag: "Empty"
171220
171467
  };
171221
- patch19 = /* @__PURE__ */ dual2(2, (path4, patch15) => {
171468
+ patch19 = /* @__PURE__ */ dual2(2, (path6, patch15) => {
171222
171469
  let input = of12(patch15);
171223
- let output = path4;
171470
+ let output = path6;
171224
171471
  while (isCons2(input)) {
171225
171472
  const patch20 = input.head;
171226
171473
  switch (patch20._tag) {
@@ -171271,7 +171518,7 @@ var concat5 = (l, r) => [...l, ...r], ConfigProviderSymbolKey2 = "effect/ConfigP
171271
171518
  }), makeFlat3 = (options2) => ({
171272
171519
  [FlatConfigProviderTypeId3]: FlatConfigProviderTypeId3,
171273
171520
  patch: options2.patch,
171274
- load: (path4, config4, split7 = true) => options2.load(path4, config4, split7),
171521
+ load: (path6, config4, split7 = true) => options2.load(path6, config4, split7),
171275
171522
  enumerateChildren: options2.enumerateChildren
171276
171523
  }), fromFlat3 = (flat) => make175({
171277
171524
  load: (config4) => flatMap36(fromFlatLoop2(flat, empty63(), config4, false), (chunk7) => match47(head13(chunk7), {
@@ -171287,29 +171534,29 @@ var concat5 = (l, r) => [...l, ...r], ConfigProviderSymbolKey2 = "effect/ConfigP
171287
171534
  pathDelim: "_",
171288
171535
  seqDelim: ","
171289
171536
  }, options2);
171290
- const makePathString = (path4) => pipe4(path4, join26(pathDelim));
171537
+ const makePathString = (path6) => pipe4(path6, join27(pathDelim));
171291
171538
  const unmakePathString = (pathString) => pathString.split(pathDelim);
171292
171539
  const getEnv = () => typeof process !== "undefined" && ("env" in process) && typeof process.env === "object" ? process.env : {};
171293
- const load = (path4, primitive3, split7 = true) => {
171294
- const pathString = makePathString(path4);
171540
+ const load = (path6, primitive3, split7 = true) => {
171541
+ const pathString = makePathString(path6);
171295
171542
  const current2 = getEnv();
171296
171543
  const valueOpt = pathString in current2 ? some25(current2[pathString]) : none17();
171297
- return pipe4(valueOpt, mapError16(() => MissingData3(path4, `Expected ${pathString} to exist in the process context`)), flatMap36((value10) => parsePrimitive2(value10, path4, primitive3, seqDelim, split7)));
171544
+ return pipe4(valueOpt, mapError16(() => MissingData3(path6, `Expected ${pathString} to exist in the process context`)), flatMap36((value10) => parsePrimitive2(value10, path6, primitive3, seqDelim, split7)));
171298
171545
  };
171299
- const enumerateChildren = (path4) => sync23(() => {
171546
+ const enumerateChildren = (path6) => sync23(() => {
171300
171547
  const current2 = getEnv();
171301
171548
  const keys16 = Object.keys(current2);
171302
171549
  const keyPaths = keys16.map((value10) => unmakePathString(value10.toUpperCase()));
171303
171550
  const filteredKeyPaths = keyPaths.filter((keyPath) => {
171304
- for (let i = 0;i < path4.length; i++) {
171305
- const pathComponent = pipe4(path4, unsafeGet14(i));
171551
+ for (let i = 0;i < path6.length; i++) {
171552
+ const pathComponent = pipe4(path6, unsafeGet14(i));
171306
171553
  const currentElement = keyPath[i];
171307
171554
  if (currentElement === undefined || pathComponent !== currentElement) {
171308
171555
  return false;
171309
171556
  }
171310
171557
  }
171311
171558
  return true;
171312
- }).flatMap((keyPath) => keyPath.slice(path4.length, path4.length + 1));
171559
+ }).flatMap((keyPath) => keyPath.slice(path6.length, path6.length + 1));
171313
171560
  return fromIterable39(filteredKeyPaths);
171314
171561
  });
171315
171562
  return fromFlat3(makeFlat3({
@@ -171323,17 +171570,17 @@ var concat5 = (l, r) => [...l, ...r], ConfigProviderSymbolKey2 = "effect/ConfigP
171323
171570
  const leftExtension = concat5(left4, leftPad);
171324
171571
  const rightExtension = concat5(right4, rightPad);
171325
171572
  return [leftExtension, rightExtension];
171326
- }, appendConfigPath2 = (path4, config4) => {
171573
+ }, appendConfigPath2 = (path6, config4) => {
171327
171574
  let op = config4;
171328
171575
  if (op._tag === "Nested") {
171329
- const out = path4.slice();
171576
+ const out = path6.slice();
171330
171577
  while (op._tag === "Nested") {
171331
171578
  out.push(op.name);
171332
171579
  op = op.config;
171333
171580
  }
171334
171581
  return out;
171335
171582
  }
171336
- return path4;
171583
+ return path6;
171337
171584
  }, fromFlatLoop2 = (flat, prefix, config4, split7) => {
171338
171585
  const op = config4;
171339
171586
  switch (op._tag) {
@@ -171408,8 +171655,8 @@ var concat5 = (l, r) => [...l, ...r], ConfigProviderSymbolKey2 = "effect/ConfigP
171408
171655
  return fail32(right4.left);
171409
171656
  }
171410
171657
  if (isRight7(left4) && isRight7(right4)) {
171411
- const path4 = pipe4(prefix, join26("."));
171412
- const fail31 = fromFlatLoopFail2(prefix, path4);
171658
+ const path6 = pipe4(prefix, join27("."));
171659
+ const fail31 = fromFlatLoopFail2(prefix, path6);
171413
171660
  const [lefts, rights] = extend8(fail31, fail31, pipe4(left4.right, map55(right5)), pipe4(right4.right, map55(right5)));
171414
171661
  return pipe4(lefts, zip27(rights), forEachSequential2(([left6, right6]) => pipe4(zip29(left6, right6), map61(([left7, right7]) => op.zip(left7, right7)))));
171415
171662
  }
@@ -171417,17 +171664,17 @@ var concat5 = (l, r) => [...l, ...r], ConfigProviderSymbolKey2 = "effect/ConfigP
171417
171664
  })))));
171418
171665
  }
171419
171666
  }
171420
- }, fromFlatLoopFail2 = (prefix, path4) => (index2) => left5(MissingData3(prefix, `The element at index ${index2} in a sequence at path "${path4}" was missing`)), splitPathString2 = (text2, delim) => {
171667
+ }, fromFlatLoopFail2 = (prefix, path6) => (index2) => left5(MissingData3(prefix, `The element at index ${index2} in a sequence at path "${path6}" was missing`)), splitPathString2 = (text2, delim) => {
171421
171668
  const split7 = text2.split(new RegExp(`\\s*${escape5(delim)}\\s*`));
171422
171669
  return split7;
171423
- }, parsePrimitive2 = (text2, path4, primitive3, delimiter, split7) => {
171670
+ }, parsePrimitive2 = (text2, path6, primitive3, delimiter, split7) => {
171424
171671
  if (!split7) {
171425
171672
  return pipe4(primitive3.parse(text2), mapBoth13({
171426
- onFailure: prefixed3(path4),
171673
+ onFailure: prefixed3(path6),
171427
171674
  onSuccess: of9
171428
171675
  }));
171429
171676
  }
171430
- return pipe4(splitPathString2(text2, delimiter), forEachSequential2((char2) => primitive3.parse(char2.trim())), mapError16(prefixed3(path4)));
171677
+ return pipe4(splitPathString2(text2, delimiter), forEachSequential2((char2) => primitive3.parse(char2.trim())), mapError16(prefixed3(path6)));
171431
171678
  }, transpose2 = (array11) => {
171432
171679
  return Object.keys(array11[0]).map((column) => array11.map((row) => row[column]));
171433
171680
  }, indicesFrom2 = (quotedIndices) => pipe4(forEachSequential2(quotedIndices, parseQuotedIndex2), mapBoth13({
@@ -173597,7 +173844,7 @@ var init_fiberScope2 = __esm(() => {
173597
173844
  });
173598
173845
 
173599
173846
  // ../../node_modules/effect/dist/esm/internal/fiber.js
173600
- var FiberSymbolKey2 = "effect/Fiber", FiberTypeId3, fiberVariance5, fiberProto2, RuntimeFiberSymbolKey2 = "effect/Fiber", RuntimeFiberTypeId3, isRuntimeFiber3 = (self) => (RuntimeFiberTypeId3 in self), _await8 = (self) => self.await, inheritAll3 = (self) => self.inheritAll, interruptAllAs3, interruptAsFork3, join27 = (self) => zipLeft18(flatten26(self.await), self.inheritAll), _never4, currentFiberURI2 = "effect/FiberCurrent";
173847
+ var FiberSymbolKey2 = "effect/Fiber", FiberTypeId3, fiberVariance5, fiberProto2, RuntimeFiberSymbolKey2 = "effect/Fiber", RuntimeFiberTypeId3, isRuntimeFiber3 = (self) => (RuntimeFiberTypeId3 in self), _await8 = (self) => self.await, inheritAll3 = (self) => self.inheritAll, interruptAllAs3, interruptAsFork3, join28 = (self) => zipLeft18(flatten26(self.await), self.inheritAll), _never4, currentFiberURI2 = "effect/FiberCurrent";
173601
173848
  var init_fiber2 = __esm(() => {
173602
173849
  init_FiberId2();
173603
173850
  init_Function2();
@@ -173636,7 +173883,7 @@ var init_fiber2 = __esm(() => {
173636
173883
  _never4 = {
173637
173884
  ...CommitPrototype3,
173638
173885
  commit() {
173639
- return join27(this);
173886
+ return join28(this);
173640
173887
  },
173641
173888
  ...fiberProto2,
173642
173889
  id: () => none19,
@@ -175311,7 +175558,7 @@ var fiberStarted3, fiberActive3, fiberSuccesses3, fiberFailures3, fiberLifetimes
175311
175558
  next6();
175312
175559
  }
175313
175560
  }));
175314
- return asVoid12(onExit4(flatten26(restore(join27(processingFiber))), exitMatch2({
175561
+ return asVoid12(onExit4(flatten26(restore(join28(processingFiber))), exitMatch2({
175315
175562
  onFailure: (cause4) => {
175316
175563
  onInterruptSignal();
175317
175564
  const target2 = residual.length + 1;
@@ -175482,7 +175729,7 @@ var fiberStarted3, fiberActive3, fiberSuccesses3, fiberFailures3, fiberLifetimes
175482
175729
  const _fiberAll = {
175483
175730
  ...CommitPrototype5,
175484
175731
  commit() {
175485
- return join27(this);
175732
+ return join28(this);
175486
175733
  },
175487
175734
  [FiberTypeId3]: fiberVariance5,
175488
175735
  id: () => fromIterable34(fibers2).reduce((id3, fiber) => combine23(id3, fiber.id()), none19),
@@ -175512,7 +175759,7 @@ var fiberStarted3, fiberActive3, fiberSuccesses3, fiberFailures3, fiberLifetimes
175512
175759
  interruptAsFork: (fiberId6) => forEachSequentialDiscard2(fibers2, (fiber) => fiber.interruptAsFork(fiberId6))
175513
175760
  };
175514
175761
  return _fiberAll;
175515
- }, raceWith5, disconnect3 = (self) => uninterruptibleMask4((restore) => fiberIdWith3((fiberId6) => flatMap36(forkDaemon4(restore(self)), (fiber) => pipe4(restore(join27(fiber)), onInterrupt4(() => pipe4(fiber, interruptAsFork3(fiberId6))))))), race10, raceFibersWith2, completeRace2 = (winner, loser, cont, ab, cb) => {
175762
+ }, raceWith5, disconnect3 = (self) => uninterruptibleMask4((restore) => fiberIdWith3((fiberId6) => flatMap36(forkDaemon4(restore(self)), (fiber) => pipe4(restore(join28(fiber)), onInterrupt4(() => pipe4(fiber, interruptAsFork3(fiberId6))))))), race10, raceFibersWith2, completeRace2 = (winner, loser, cont, ab, cb) => {
175516
175763
  if (compareAndSet2(true, false)(ab)) {
175517
175764
  cb(cont(winner, loser));
175518
175765
  }
@@ -175748,7 +175995,7 @@ var init_fiberRuntime2 = __esm(() => {
175748
175995
  this.refreshRefCache();
175749
175996
  }
175750
175997
  commit() {
175751
- return join27(this);
175998
+ return join28(this);
175752
175999
  }
175753
176000
  id() {
175754
176001
  return this._fiberId;
@@ -176662,11 +176909,11 @@ var init_fiberRuntime2 = __esm(() => {
176662
176909
  }));
176663
176910
  race10 = /* @__PURE__ */ dual2(2, (self, that) => fiberIdWith3((parentFiberId) => raceWith5(self, that, {
176664
176911
  onSelfDone: (exit5, right4) => exitMatchEffect2(exit5, {
176665
- onFailure: (cause4) => pipe4(join27(right4), mapErrorCause9((cause22) => parallel6(cause4, cause22))),
176912
+ onFailure: (cause4) => pipe4(join28(right4), mapErrorCause9((cause22) => parallel6(cause4, cause22))),
176666
176913
  onSuccess: (value10) => pipe4(right4, interruptAsFiber2(parentFiberId), as18(value10))
176667
176914
  }),
176668
176915
  onOtherDone: (exit5, left4) => exitMatchEffect2(exit5, {
176669
- onFailure: (cause4) => pipe4(join27(left4), mapErrorCause9((cause22) => parallel6(cause22, cause4))),
176916
+ onFailure: (cause4) => pipe4(join28(left4), mapErrorCause9((cause22) => parallel6(cause22, cause4))),
176670
176917
  onSuccess: (value10) => pipe4(left4, interruptAsFiber2(parentFiberId), as18(value10))
176671
176918
  })
176672
176919
  })));
@@ -177346,7 +177593,7 @@ var unsafeMakeSemaphore4 = (permits) => new Semaphore2(permits), makeSemaphore3
177346
177593
  return end8 - time6 <= 0 ? some25(computeCachedValue2(self, timeToLive, time6)) : none17();
177347
177594
  }
177348
177595
  }
177349
- })), flatMap36((option12) => isNone7(option12) ? dieMessage11("BUG: Effect.cachedInvalidate - please report an issue at https://github.com/Effect-TS/effect/issues") : restore(deferredAwait2(option12.value[1]))))), invalidateCache2 = (cache) => set33(cache, none17()), ensuringChild3, ensuringChildren3, forkAll3, forkIn4, forkScoped4 = (self) => scopeWith3((scope7) => forkIn4(self, scope7)), fromFiber3 = (fiber) => join27(fiber), fromFiberEffect3 = (fiber) => suspend18(() => flatMap36(fiber, join27)), memoKeySymbol2, Key2, cachedFunction3 = (f, eq2) => {
177596
+ })), flatMap36((option12) => isNone7(option12) ? dieMessage11("BUG: Effect.cachedInvalidate - please report an issue at https://github.com/Effect-TS/effect/issues") : restore(deferredAwait2(option12.value[1]))))), invalidateCache2 = (cache) => set33(cache, none17()), ensuringChild3, ensuringChildren3, forkAll3, forkIn4, forkScoped4 = (self) => scopeWith3((scope7) => forkIn4(self, scope7)), fromFiber3 = (fiber) => join28(fiber), fromFiberEffect3 = (fiber) => suspend18(() => flatMap36(fiber, join28)), memoKeySymbol2, Key2, cachedFunction3 = (f, eq2) => {
177350
177597
  return pipe4(sync23(() => empty79()), flatMap36(makeSynchronized2), map61((ref) => (a) => pipe4(ref.modifyEffect((map51) => {
177351
177598
  const result = pipe4(map51, get57(new Key2(a, eq2)));
177352
177599
  if (isNone7(result)) {
@@ -179804,8 +180051,8 @@ class Pointer2 {
179804
180051
  actual;
179805
180052
  issue;
179806
180053
  _tag = "Pointer";
179807
- constructor(path4, actual, issue4) {
179808
- this.path = path4;
180054
+ constructor(path6, actual, issue4) {
180055
+ this.path = path6;
179809
180056
  this.actual = actual;
179810
180057
  this.issue = issue4;
179811
180058
  }
@@ -181700,14 +181947,14 @@ var init_memory2 = __esm(() => {
181700
181947
 
181701
181948
  // src/memory-tools.ts
181702
181949
  async function getMemoryAdapter(projectPath) {
181703
- const path4 = projectPath || process.cwd();
181704
- if (cachedAdapter && cachedProjectPath === path4) {
181950
+ const path6 = projectPath || process.cwd();
181951
+ if (cachedAdapter && cachedProjectPath === path6) {
181705
181952
  return cachedAdapter;
181706
181953
  }
181707
- const swarmMail = await getSwarmMailLibSQL(path4);
181954
+ const swarmMail = await getSwarmMailLibSQL(path6);
181708
181955
  const dbAdapter = await swarmMail.getDatabase();
181709
181956
  cachedAdapter = await createMemoryAdapter2(dbAdapter);
181710
- cachedProjectPath = path4;
181957
+ cachedProjectPath = path6;
181711
181958
  return cachedAdapter;
181712
181959
  }
181713
181960
  function resetMemoryCache() {
@@ -182527,17 +182774,17 @@ var require_visit = __commonJS((exports) => {
182527
182774
  visit.BREAK = BREAK;
182528
182775
  visit.SKIP = SKIP;
182529
182776
  visit.REMOVE = REMOVE;
182530
- function visit_(key, node, visitor, path4) {
182531
- const ctrl = callVisitor(key, node, visitor, path4);
182777
+ function visit_(key, node, visitor, path6) {
182778
+ const ctrl = callVisitor(key, node, visitor, path6);
182532
182779
  if (identity8.isNode(ctrl) || identity8.isPair(ctrl)) {
182533
- replaceNode(key, path4, ctrl);
182534
- return visit_(key, ctrl, visitor, path4);
182780
+ replaceNode(key, path6, ctrl);
182781
+ return visit_(key, ctrl, visitor, path6);
182535
182782
  }
182536
182783
  if (typeof ctrl !== "symbol") {
182537
182784
  if (identity8.isCollection(node)) {
182538
- path4 = Object.freeze(path4.concat(node));
182785
+ path6 = Object.freeze(path6.concat(node));
182539
182786
  for (let i = 0;i < node.items.length; ++i) {
182540
- const ci = visit_(i, node.items[i], visitor, path4);
182787
+ const ci = visit_(i, node.items[i], visitor, path6);
182541
182788
  if (typeof ci === "number")
182542
182789
  i = ci - 1;
182543
182790
  else if (ci === BREAK)
@@ -182548,13 +182795,13 @@ var require_visit = __commonJS((exports) => {
182548
182795
  }
182549
182796
  }
182550
182797
  } else if (identity8.isPair(node)) {
182551
- path4 = Object.freeze(path4.concat(node));
182552
- const ck = visit_("key", node.key, visitor, path4);
182798
+ path6 = Object.freeze(path6.concat(node));
182799
+ const ck = visit_("key", node.key, visitor, path6);
182553
182800
  if (ck === BREAK)
182554
182801
  return BREAK;
182555
182802
  else if (ck === REMOVE)
182556
182803
  node.key = null;
182557
- const cv = visit_("value", node.value, visitor, path4);
182804
+ const cv = visit_("value", node.value, visitor, path6);
182558
182805
  if (cv === BREAK)
182559
182806
  return BREAK;
182560
182807
  else if (cv === REMOVE)
@@ -182575,17 +182822,17 @@ var require_visit = __commonJS((exports) => {
182575
182822
  visitAsync.BREAK = BREAK;
182576
182823
  visitAsync.SKIP = SKIP;
182577
182824
  visitAsync.REMOVE = REMOVE;
182578
- async function visitAsync_(key, node, visitor, path4) {
182579
- const ctrl = await callVisitor(key, node, visitor, path4);
182825
+ async function visitAsync_(key, node, visitor, path6) {
182826
+ const ctrl = await callVisitor(key, node, visitor, path6);
182580
182827
  if (identity8.isNode(ctrl) || identity8.isPair(ctrl)) {
182581
- replaceNode(key, path4, ctrl);
182582
- return visitAsync_(key, ctrl, visitor, path4);
182828
+ replaceNode(key, path6, ctrl);
182829
+ return visitAsync_(key, ctrl, visitor, path6);
182583
182830
  }
182584
182831
  if (typeof ctrl !== "symbol") {
182585
182832
  if (identity8.isCollection(node)) {
182586
- path4 = Object.freeze(path4.concat(node));
182833
+ path6 = Object.freeze(path6.concat(node));
182587
182834
  for (let i = 0;i < node.items.length; ++i) {
182588
- const ci = await visitAsync_(i, node.items[i], visitor, path4);
182835
+ const ci = await visitAsync_(i, node.items[i], visitor, path6);
182589
182836
  if (typeof ci === "number")
182590
182837
  i = ci - 1;
182591
182838
  else if (ci === BREAK)
@@ -182596,13 +182843,13 @@ var require_visit = __commonJS((exports) => {
182596
182843
  }
182597
182844
  }
182598
182845
  } else if (identity8.isPair(node)) {
182599
- path4 = Object.freeze(path4.concat(node));
182600
- const ck = await visitAsync_("key", node.key, visitor, path4);
182846
+ path6 = Object.freeze(path6.concat(node));
182847
+ const ck = await visitAsync_("key", node.key, visitor, path6);
182601
182848
  if (ck === BREAK)
182602
182849
  return BREAK;
182603
182850
  else if (ck === REMOVE)
182604
182851
  node.key = null;
182605
- const cv = await visitAsync_("value", node.value, visitor, path4);
182852
+ const cv = await visitAsync_("value", node.value, visitor, path6);
182606
182853
  if (cv === BREAK)
182607
182854
  return BREAK;
182608
182855
  else if (cv === REMOVE)
@@ -182629,23 +182876,23 @@ var require_visit = __commonJS((exports) => {
182629
182876
  }
182630
182877
  return visitor;
182631
182878
  }
182632
- function callVisitor(key, node, visitor, path4) {
182879
+ function callVisitor(key, node, visitor, path6) {
182633
182880
  if (typeof visitor === "function")
182634
- return visitor(key, node, path4);
182881
+ return visitor(key, node, path6);
182635
182882
  if (identity8.isMap(node))
182636
- return visitor.Map?.(key, node, path4);
182883
+ return visitor.Map?.(key, node, path6);
182637
182884
  if (identity8.isSeq(node))
182638
- return visitor.Seq?.(key, node, path4);
182885
+ return visitor.Seq?.(key, node, path6);
182639
182886
  if (identity8.isPair(node))
182640
- return visitor.Pair?.(key, node, path4);
182887
+ return visitor.Pair?.(key, node, path6);
182641
182888
  if (identity8.isScalar(node))
182642
- return visitor.Scalar?.(key, node, path4);
182889
+ return visitor.Scalar?.(key, node, path6);
182643
182890
  if (identity8.isAlias(node))
182644
- return visitor.Alias?.(key, node, path4);
182891
+ return visitor.Alias?.(key, node, path6);
182645
182892
  return;
182646
182893
  }
182647
- function replaceNode(key, path4, node) {
182648
- const parent = path4[path4.length - 1];
182894
+ function replaceNode(key, path6, node) {
182895
+ const parent = path6[path6.length - 1];
182649
182896
  if (identity8.isCollection(parent)) {
182650
182897
  parent.items[key] = node;
182651
182898
  } else if (identity8.isPair(parent)) {
@@ -183202,10 +183449,10 @@ var require_Collection = __commonJS((exports) => {
183202
183449
  var createNode = require_createNode();
183203
183450
  var identity8 = require_identity();
183204
183451
  var Node = require_Node();
183205
- function collectionFromPath(schema, path4, value10) {
183452
+ function collectionFromPath(schema, path6, value10) {
183206
183453
  let v = value10;
183207
- for (let i = path4.length - 1;i >= 0; --i) {
183208
- const k = path4[i];
183454
+ for (let i = path6.length - 1;i >= 0; --i) {
183455
+ const k = path6[i];
183209
183456
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
183210
183457
  const a = [];
183211
183458
  a[k] = v;
@@ -183224,7 +183471,7 @@ var require_Collection = __commonJS((exports) => {
183224
183471
  sourceObjects: new Map
183225
183472
  });
183226
183473
  }
183227
- var isEmptyPath = (path4) => path4 == null || typeof path4 === "object" && !!path4[Symbol.iterator]().next().done;
183474
+ var isEmptyPath = (path6) => path6 == null || typeof path6 === "object" && !!path6[Symbol.iterator]().next().done;
183228
183475
 
183229
183476
  class Collection extends Node.NodeBase {
183230
183477
  constructor(type3, schema) {
@@ -183245,11 +183492,11 @@ var require_Collection = __commonJS((exports) => {
183245
183492
  copy5.range = this.range.slice();
183246
183493
  return copy5;
183247
183494
  }
183248
- addIn(path4, value10) {
183249
- if (isEmptyPath(path4))
183495
+ addIn(path6, value10) {
183496
+ if (isEmptyPath(path6))
183250
183497
  this.add(value10);
183251
183498
  else {
183252
- const [key, ...rest] = path4;
183499
+ const [key, ...rest] = path6;
183253
183500
  const node = this.get(key, true);
183254
183501
  if (identity8.isCollection(node))
183255
183502
  node.addIn(rest, value10);
@@ -183259,8 +183506,8 @@ var require_Collection = __commonJS((exports) => {
183259
183506
  throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
183260
183507
  }
183261
183508
  }
183262
- deleteIn(path4) {
183263
- const [key, ...rest] = path4;
183509
+ deleteIn(path6) {
183510
+ const [key, ...rest] = path6;
183264
183511
  if (rest.length === 0)
183265
183512
  return this.delete(key);
183266
183513
  const node = this.get(key, true);
@@ -183269,8 +183516,8 @@ var require_Collection = __commonJS((exports) => {
183269
183516
  else
183270
183517
  throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
183271
183518
  }
183272
- getIn(path4, keepScalar) {
183273
- const [key, ...rest] = path4;
183519
+ getIn(path6, keepScalar) {
183520
+ const [key, ...rest] = path6;
183274
183521
  const node = this.get(key, true);
183275
183522
  if (rest.length === 0)
183276
183523
  return !keepScalar && identity8.isScalar(node) ? node.value : node;
@@ -183285,15 +183532,15 @@ var require_Collection = __commonJS((exports) => {
183285
183532
  return n == null || allowScalar && identity8.isScalar(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
183286
183533
  });
183287
183534
  }
183288
- hasIn(path4) {
183289
- const [key, ...rest] = path4;
183535
+ hasIn(path6) {
183536
+ const [key, ...rest] = path6;
183290
183537
  if (rest.length === 0)
183291
183538
  return this.has(key);
183292
183539
  const node = this.get(key, true);
183293
183540
  return identity8.isCollection(node) ? node.hasIn(rest) : false;
183294
183541
  }
183295
- setIn(path4, value10) {
183296
- const [key, ...rest] = path4;
183542
+ setIn(path6, value10) {
183543
+ const [key, ...rest] = path6;
183297
183544
  if (rest.length === 0) {
183298
183545
  this.set(key, value10);
183299
183546
  } else {
@@ -185675,9 +185922,9 @@ var require_Document = __commonJS((exports) => {
185675
185922
  if (assertCollection(this.contents))
185676
185923
  this.contents.add(value10);
185677
185924
  }
185678
- addIn(path4, value10) {
185925
+ addIn(path6, value10) {
185679
185926
  if (assertCollection(this.contents))
185680
- this.contents.addIn(path4, value10);
185927
+ this.contents.addIn(path6, value10);
185681
185928
  }
185682
185929
  createAlias(node, name15) {
185683
185930
  if (!node.anchor) {
@@ -185726,30 +185973,30 @@ var require_Document = __commonJS((exports) => {
185726
185973
  delete(key) {
185727
185974
  return assertCollection(this.contents) ? this.contents.delete(key) : false;
185728
185975
  }
185729
- deleteIn(path4) {
185730
- if (Collection.isEmptyPath(path4)) {
185976
+ deleteIn(path6) {
185977
+ if (Collection.isEmptyPath(path6)) {
185731
185978
  if (this.contents == null)
185732
185979
  return false;
185733
185980
  this.contents = null;
185734
185981
  return true;
185735
185982
  }
185736
- return assertCollection(this.contents) ? this.contents.deleteIn(path4) : false;
185983
+ return assertCollection(this.contents) ? this.contents.deleteIn(path6) : false;
185737
185984
  }
185738
185985
  get(key, keepScalar) {
185739
185986
  return identity8.isCollection(this.contents) ? this.contents.get(key, keepScalar) : undefined;
185740
185987
  }
185741
- getIn(path4, keepScalar) {
185742
- if (Collection.isEmptyPath(path4))
185988
+ getIn(path6, keepScalar) {
185989
+ if (Collection.isEmptyPath(path6))
185743
185990
  return !keepScalar && identity8.isScalar(this.contents) ? this.contents.value : this.contents;
185744
- return identity8.isCollection(this.contents) ? this.contents.getIn(path4, keepScalar) : undefined;
185991
+ return identity8.isCollection(this.contents) ? this.contents.getIn(path6, keepScalar) : undefined;
185745
185992
  }
185746
185993
  has(key) {
185747
185994
  return identity8.isCollection(this.contents) ? this.contents.has(key) : false;
185748
185995
  }
185749
- hasIn(path4) {
185750
- if (Collection.isEmptyPath(path4))
185996
+ hasIn(path6) {
185997
+ if (Collection.isEmptyPath(path6))
185751
185998
  return this.contents !== undefined;
185752
- return identity8.isCollection(this.contents) ? this.contents.hasIn(path4) : false;
185999
+ return identity8.isCollection(this.contents) ? this.contents.hasIn(path6) : false;
185753
186000
  }
185754
186001
  set(key, value10) {
185755
186002
  if (this.contents == null) {
@@ -185758,13 +186005,13 @@ var require_Document = __commonJS((exports) => {
185758
186005
  this.contents.set(key, value10);
185759
186006
  }
185760
186007
  }
185761
- setIn(path4, value10) {
185762
- if (Collection.isEmptyPath(path4)) {
186008
+ setIn(path6, value10) {
186009
+ if (Collection.isEmptyPath(path6)) {
185763
186010
  this.contents = value10;
185764
186011
  } else if (this.contents == null) {
185765
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path4), value10);
186012
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path6), value10);
185766
186013
  } else if (assertCollection(this.contents)) {
185767
- this.contents.setIn(path4, value10);
186014
+ this.contents.setIn(path6, value10);
185768
186015
  }
185769
186016
  }
185770
186017
  setSchema(version4, options2 = {}) {
@@ -187653,9 +187900,9 @@ var require_cst_visit = __commonJS((exports) => {
187653
187900
  visit.BREAK = BREAK;
187654
187901
  visit.SKIP = SKIP;
187655
187902
  visit.REMOVE = REMOVE;
187656
- visit.itemAtPath = (cst, path4) => {
187903
+ visit.itemAtPath = (cst, path6) => {
187657
187904
  let item = cst;
187658
- for (const [field, index2] of path4) {
187905
+ for (const [field, index2] of path6) {
187659
187906
  const tok = item?.[field];
187660
187907
  if (tok && "items" in tok) {
187661
187908
  item = tok.items[index2];
@@ -187664,23 +187911,23 @@ var require_cst_visit = __commonJS((exports) => {
187664
187911
  }
187665
187912
  return item;
187666
187913
  };
187667
- visit.parentCollection = (cst, path4) => {
187668
- const parent = visit.itemAtPath(cst, path4.slice(0, -1));
187669
- const field = path4[path4.length - 1][0];
187914
+ visit.parentCollection = (cst, path6) => {
187915
+ const parent = visit.itemAtPath(cst, path6.slice(0, -1));
187916
+ const field = path6[path6.length - 1][0];
187670
187917
  const coll = parent?.[field];
187671
187918
  if (coll && "items" in coll)
187672
187919
  return coll;
187673
187920
  throw new Error("Parent collection not found");
187674
187921
  };
187675
- function _visit(path4, item, visitor) {
187676
- let ctrl = visitor(item, path4);
187922
+ function _visit(path6, item, visitor) {
187923
+ let ctrl = visitor(item, path6);
187677
187924
  if (typeof ctrl === "symbol")
187678
187925
  return ctrl;
187679
187926
  for (const field of ["key", "value"]) {
187680
187927
  const token = item[field];
187681
187928
  if (token && "items" in token) {
187682
187929
  for (let i = 0;i < token.items.length; ++i) {
187683
- const ci = _visit(Object.freeze(path4.concat([[field, i]])), token.items[i], visitor);
187930
+ const ci = _visit(Object.freeze(path6.concat([[field, i]])), token.items[i], visitor);
187684
187931
  if (typeof ci === "number")
187685
187932
  i = ci - 1;
187686
187933
  else if (ci === BREAK)
@@ -187691,10 +187938,10 @@ var require_cst_visit = __commonJS((exports) => {
187691
187938
  }
187692
187939
  }
187693
187940
  if (typeof ctrl === "function" && field === "key")
187694
- ctrl = ctrl(item, path4);
187941
+ ctrl = ctrl(item, path6);
187695
187942
  }
187696
187943
  }
187697
- return typeof ctrl === "function" ? ctrl(item, path4) : ctrl;
187944
+ return typeof ctrl === "function" ? ctrl(item, path6) : ctrl;
187698
187945
  }
187699
187946
  exports.visit = visit;
187700
187947
  });
@@ -189611,8 +189858,8 @@ var require_req = __commonJS((exports, module) => {
189611
189858
  if (req.originalUrl) {
189612
189859
  _req.url = req.originalUrl;
189613
189860
  } else {
189614
- const path4 = req.path;
189615
- _req.url = typeof path4 === "string" ? path4 : req.url ? req.url.path || req.url : undefined;
189861
+ const path6 = req.path;
189862
+ _req.url = typeof path6 === "string" ? path6 : req.url ? req.url.path || req.url : undefined;
189616
189863
  }
189617
189864
  if (req.query) {
189618
189865
  _req.query = req.query;
@@ -189768,14 +190015,14 @@ var require_redact = __commonJS((exports, module) => {
189768
190015
  }
189769
190016
  return obj;
189770
190017
  }
189771
- function parsePath(path4) {
190018
+ function parsePath(path6) {
189772
190019
  const parts3 = [];
189773
190020
  let current2 = "";
189774
190021
  let inBrackets = false;
189775
190022
  let inQuotes = false;
189776
190023
  let quoteChar = "";
189777
- for (let i = 0;i < path4.length; i++) {
189778
- const char2 = path4[i];
190024
+ for (let i = 0;i < path6.length; i++) {
190025
+ const char2 = path6[i];
189779
190026
  if (!inBrackets && char2 === ".") {
189780
190027
  if (current2) {
189781
190028
  parts3.push(current2);
@@ -189906,10 +190153,10 @@ var require_redact = __commonJS((exports, module) => {
189906
190153
  return current2;
189907
190154
  }
189908
190155
  function redactPaths(obj, paths, censor, remove23 = false) {
189909
- for (const path4 of paths) {
189910
- const parts3 = parsePath(path4);
190156
+ for (const path6 of paths) {
190157
+ const parts3 = parsePath(path6);
189911
190158
  if (parts3.includes("*")) {
189912
- redactWildcardPath(obj, parts3, censor, path4, remove23);
190159
+ redactWildcardPath(obj, parts3, censor, path6, remove23);
189913
190160
  } else {
189914
190161
  if (remove23) {
189915
190162
  removeKey(obj, parts3);
@@ -189996,8 +190243,8 @@ var require_redact = __commonJS((exports, module) => {
189996
190243
  }
189997
190244
  } else {
189998
190245
  if (afterWildcard.includes("*")) {
189999
- const wrappedCensor = typeof censor === "function" ? (value10, path4) => {
190000
- const fullPath = [...pathArray.slice(0, pathLength), ...path4];
190246
+ const wrappedCensor = typeof censor === "function" ? (value10, path6) => {
190247
+ const fullPath = [...pathArray.slice(0, pathLength), ...path6];
190001
190248
  return censor(value10, fullPath);
190002
190249
  } : censor;
190003
190250
  redactWildcardPath(current2, afterWildcard, wrappedCensor, originalPath, remove23);
@@ -190034,8 +190281,8 @@ var require_redact = __commonJS((exports, module) => {
190034
190281
  return null;
190035
190282
  }
190036
190283
  const pathStructure = new Map;
190037
- for (const path4 of pathsToClone) {
190038
- const parts3 = parsePath(path4);
190284
+ for (const path6 of pathsToClone) {
190285
+ const parts3 = parsePath(path6);
190039
190286
  let current2 = pathStructure;
190040
190287
  for (let i = 0;i < parts3.length; i++) {
190041
190288
  const part = parts3[i];
@@ -190087,24 +190334,24 @@ var require_redact = __commonJS((exports, module) => {
190087
190334
  }
190088
190335
  return cloneSelectively(obj, pathStructure);
190089
190336
  }
190090
- function validatePath(path4) {
190091
- if (typeof path4 !== "string") {
190337
+ function validatePath(path6) {
190338
+ if (typeof path6 !== "string") {
190092
190339
  throw new Error("Paths must be (non-empty) strings");
190093
190340
  }
190094
- if (path4 === "") {
190341
+ if (path6 === "") {
190095
190342
  throw new Error("Invalid redaction path ()");
190096
190343
  }
190097
- if (path4.includes("..")) {
190098
- throw new Error(`Invalid redaction path (${path4})`);
190344
+ if (path6.includes("..")) {
190345
+ throw new Error(`Invalid redaction path (${path6})`);
190099
190346
  }
190100
- if (path4.includes(",")) {
190101
- throw new Error(`Invalid redaction path (${path4})`);
190347
+ if (path6.includes(",")) {
190348
+ throw new Error(`Invalid redaction path (${path6})`);
190102
190349
  }
190103
190350
  let bracketCount = 0;
190104
190351
  let inQuotes = false;
190105
190352
  let quoteChar = "";
190106
- for (let i = 0;i < path4.length; i++) {
190107
- const char2 = path4[i];
190353
+ for (let i = 0;i < path6.length; i++) {
190354
+ const char2 = path6[i];
190108
190355
  if ((char2 === '"' || char2 === "'") && bracketCount > 0) {
190109
190356
  if (!inQuotes) {
190110
190357
  inQuotes = true;
@@ -190118,20 +190365,20 @@ var require_redact = __commonJS((exports, module) => {
190118
190365
  } else if (char2 === "]" && !inQuotes) {
190119
190366
  bracketCount--;
190120
190367
  if (bracketCount < 0) {
190121
- throw new Error(`Invalid redaction path (${path4})`);
190368
+ throw new Error(`Invalid redaction path (${path6})`);
190122
190369
  }
190123
190370
  }
190124
190371
  }
190125
190372
  if (bracketCount !== 0) {
190126
- throw new Error(`Invalid redaction path (${path4})`);
190373
+ throw new Error(`Invalid redaction path (${path6})`);
190127
190374
  }
190128
190375
  }
190129
190376
  function validatePaths(paths) {
190130
190377
  if (!Array.isArray(paths)) {
190131
190378
  throw new TypeError("paths must be an array");
190132
190379
  }
190133
- for (const path4 of paths) {
190134
- validatePath(path4);
190380
+ for (const path6 of paths) {
190381
+ validatePath(path6);
190135
190382
  }
190136
190383
  }
190137
190384
  function slowRedact(options2 = {}) {
@@ -190293,8 +190540,8 @@ var require_redaction = __commonJS((exports, module) => {
190293
190540
  if (shape[k] === null) {
190294
190541
  o[k] = (value10) => topCensor(value10, [k]);
190295
190542
  } else {
190296
- const wrappedCensor = typeof censor === "function" ? (value10, path4) => {
190297
- return censor(value10, [k, ...path4]);
190543
+ const wrappedCensor = typeof censor === "function" ? (value10, path6) => {
190544
+ return censor(value10, [k, ...path6]);
190298
190545
  } : censor;
190299
190546
  o[k] = Redact({
190300
190547
  paths: shape[k],
@@ -190505,7 +190752,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
190505
190752
  var fs3 = __require("fs");
190506
190753
  var EventEmitter4 = __require("events");
190507
190754
  var inherits = __require("util").inherits;
190508
- var path4 = __require("path");
190755
+ var path6 = __require("path");
190509
190756
  var sleep8 = require_atomic_sleep();
190510
190757
  var assert6 = __require("assert");
190511
190758
  var BUSY_WRITE_TIMEOUT = 100;
@@ -190560,7 +190807,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
190560
190807
  if (sonic.sync) {
190561
190808
  try {
190562
190809
  if (sonic.mkdir)
190563
- fs3.mkdirSync(path4.dirname(file4), { recursive: true });
190810
+ fs3.mkdirSync(path6.dirname(file4), { recursive: true });
190564
190811
  const fd = fs3.openSync(file4, flags, mode);
190565
190812
  fileOpened(null, fd);
190566
190813
  } catch (err) {
@@ -190568,7 +190815,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
190568
190815
  throw err;
190569
190816
  }
190570
190817
  } else if (sonic.mkdir) {
190571
- fs3.mkdir(path4.dirname(file4), { recursive: true }, (err) => {
190818
+ fs3.mkdir(path6.dirname(file4), { recursive: true }, (err) => {
190572
190819
  if (err)
190573
190820
  return fileOpened(err);
190574
190821
  fs3.open(file4, flags, mode, fileOpened);
@@ -191294,11 +191541,11 @@ var require_indexes2 = __commonJS((exports, module) => {
191294
191541
 
191295
191542
  // ../../node_modules/thread-stream/index.js
191296
191543
  var require_thread_stream = __commonJS((exports, module) => {
191297
- var __dirname = "/home/runner/work/swarm-tools/swarm-tools/node_modules/thread-stream";
191544
+ var __dirname = "/home/runner/work/swarm/swarm/node_modules/thread-stream";
191298
191545
  var { version: version4 } = require_package();
191299
191546
  var { EventEmitter: EventEmitter4 } = __require("events");
191300
191547
  var { Worker } = __require("worker_threads");
191301
- var { join: join18 } = __require("path");
191548
+ var { join: join19 } = __require("path");
191302
191549
  var { pathToFileURL } = __require("url");
191303
191550
  var { wait } = require_wait();
191304
191551
  var {
@@ -191334,7 +191581,7 @@ var require_thread_stream = __commonJS((exports, module) => {
191334
191581
  function createWorker(stream2, opts) {
191335
191582
  const { filename, workerData } = opts;
191336
191583
  const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
191337
- const toExecute = bundlerOverrides["thread-stream-worker"] || join18(__dirname, "lib", "worker.js");
191584
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join19(__dirname, "lib", "worker.js");
191338
191585
  const worker = new Worker(toExecute, {
191339
191586
  ...opts.workerOpts,
191340
191587
  trackUnmanagedFds: false,
@@ -191715,10 +191962,10 @@ var require_thread_stream = __commonJS((exports, module) => {
191715
191962
 
191716
191963
  // ../../node_modules/pino/lib/transport.js
191717
191964
  var require_transport = __commonJS((exports, module) => {
191718
- var __dirname = "/home/runner/work/swarm-tools/swarm-tools/node_modules/pino/lib";
191965
+ var __dirname = "/home/runner/work/swarm/swarm/node_modules/pino/lib";
191719
191966
  var { createRequire: createRequire3 } = __require("module");
191720
191967
  var getCallers = require_caller();
191721
- var { join: join18, isAbsolute: isAbsolute3, sep: sep5 } = __require("node:path");
191968
+ var { join: join19, isAbsolute: isAbsolute5, sep: sep5 } = __require("node:path");
191722
191969
  var sleep8 = require_atomic_sleep();
191723
191970
  var onExit5 = require_on_exit_leak_free();
191724
191971
  var ThreadStream = require_thread_stream();
@@ -191781,7 +192028,7 @@ var require_transport = __commonJS((exports, module) => {
191781
192028
  throw new Error("only one of target or targets can be specified");
191782
192029
  }
191783
192030
  if (targets) {
191784
- target = bundlerOverrides["pino-worker"] || join18(__dirname, "worker.js");
192031
+ target = bundlerOverrides["pino-worker"] || join19(__dirname, "worker.js");
191785
192032
  options2.targets = targets.filter((dest) => dest.target).map((dest) => {
191786
192033
  return {
191787
192034
  ...dest,
@@ -191798,7 +192045,7 @@ var require_transport = __commonJS((exports, module) => {
191798
192045
  });
191799
192046
  });
191800
192047
  } else if (pipeline) {
191801
- target = bundlerOverrides["pino-worker"] || join18(__dirname, "worker.js");
192048
+ target = bundlerOverrides["pino-worker"] || join19(__dirname, "worker.js");
191802
192049
  options2.pipelines = [pipeline.map((dest) => {
191803
192050
  return {
191804
192051
  ...dest,
@@ -191816,11 +192063,11 @@ var require_transport = __commonJS((exports, module) => {
191816
192063
  return buildStream(fixTarget(target), options2, worker, sync24);
191817
192064
  function fixTarget(origin) {
191818
192065
  origin = bundlerOverrides[origin] || origin;
191819
- if (isAbsolute3(origin) || origin.indexOf("file://") === 0) {
192066
+ if (isAbsolute5(origin) || origin.indexOf("file://") === 0) {
191820
192067
  return origin;
191821
192068
  }
191822
192069
  if (origin === "pino/file") {
191823
- return join18(__dirname, "..", "file.js");
192070
+ return join19(__dirname, "..", "file.js");
191824
192071
  }
191825
192072
  let fixTarget2;
191826
192073
  for (const filePath of callers) {
@@ -192758,7 +193005,7 @@ var require_safe_stable_stringify = __commonJS((exports, module) => {
192758
193005
  return circularValue;
192759
193006
  }
192760
193007
  let res = "";
192761
- let join18 = ",";
193008
+ let join19 = ",";
192762
193009
  const originalIndentation = indentation;
192763
193010
  if (Array.isArray(value10)) {
192764
193011
  if (value10.length === 0) {
@@ -192772,7 +193019,7 @@ var require_safe_stable_stringify = __commonJS((exports, module) => {
192772
193019
  indentation += spacer;
192773
193020
  res += `
192774
193021
  ${indentation}`;
192775
- join18 = `,
193022
+ join19 = `,
192776
193023
  ${indentation}`;
192777
193024
  }
192778
193025
  const maximumValuesToStringify = Math.min(value10.length, maximumBreadth);
@@ -192780,13 +193027,13 @@ ${indentation}`;
192780
193027
  for (;i < maximumValuesToStringify - 1; i++) {
192781
193028
  const tmp2 = stringifyFnReplacer(String(i), value10, stack, replacer, spacer, indentation);
192782
193029
  res += tmp2 !== undefined ? tmp2 : "null";
192783
- res += join18;
193030
+ res += join19;
192784
193031
  }
192785
193032
  const tmp = stringifyFnReplacer(String(i), value10, stack, replacer, spacer, indentation);
192786
193033
  res += tmp !== undefined ? tmp : "null";
192787
193034
  if (value10.length - 1 > maximumBreadth) {
192788
193035
  const removedKeys = value10.length - maximumBreadth - 1;
192789
- res += `${join18}"... ${getItemCount(removedKeys)} not stringified"`;
193036
+ res += `${join19}"... ${getItemCount(removedKeys)} not stringified"`;
192790
193037
  }
192791
193038
  if (spacer !== "") {
192792
193039
  res += `
@@ -192807,7 +193054,7 @@ ${originalIndentation}`;
192807
193054
  let separator = "";
192808
193055
  if (spacer !== "") {
192809
193056
  indentation += spacer;
192810
- join18 = `,
193057
+ join19 = `,
192811
193058
  ${indentation}`;
192812
193059
  whitespace = " ";
192813
193060
  }
@@ -192821,13 +193068,13 @@ ${indentation}`;
192821
193068
  const tmp = stringifyFnReplacer(key2, value10, stack, replacer, spacer, indentation);
192822
193069
  if (tmp !== undefined) {
192823
193070
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
192824
- separator = join18;
193071
+ separator = join19;
192825
193072
  }
192826
193073
  }
192827
193074
  if (keyLength > maximumBreadth) {
192828
193075
  const removedKeys = keyLength - maximumBreadth;
192829
193076
  res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
192830
- separator = join18;
193077
+ separator = join19;
192831
193078
  }
192832
193079
  if (spacer !== "" && separator.length > 1) {
192833
193080
  res = `
@@ -192867,7 +193114,7 @@ ${originalIndentation}`;
192867
193114
  }
192868
193115
  const originalIndentation = indentation;
192869
193116
  let res = "";
192870
- let join18 = ",";
193117
+ let join19 = ",";
192871
193118
  if (Array.isArray(value10)) {
192872
193119
  if (value10.length === 0) {
192873
193120
  return "[]";
@@ -192880,7 +193127,7 @@ ${originalIndentation}`;
192880
193127
  indentation += spacer;
192881
193128
  res += `
192882
193129
  ${indentation}`;
192883
- join18 = `,
193130
+ join19 = `,
192884
193131
  ${indentation}`;
192885
193132
  }
192886
193133
  const maximumValuesToStringify = Math.min(value10.length, maximumBreadth);
@@ -192888,13 +193135,13 @@ ${indentation}`;
192888
193135
  for (;i < maximumValuesToStringify - 1; i++) {
192889
193136
  const tmp2 = stringifyArrayReplacer(String(i), value10[i], stack, replacer, spacer, indentation);
192890
193137
  res += tmp2 !== undefined ? tmp2 : "null";
192891
- res += join18;
193138
+ res += join19;
192892
193139
  }
192893
193140
  const tmp = stringifyArrayReplacer(String(i), value10[i], stack, replacer, spacer, indentation);
192894
193141
  res += tmp !== undefined ? tmp : "null";
192895
193142
  if (value10.length - 1 > maximumBreadth) {
192896
193143
  const removedKeys = value10.length - maximumBreadth - 1;
192897
- res += `${join18}"... ${getItemCount(removedKeys)} not stringified"`;
193144
+ res += `${join19}"... ${getItemCount(removedKeys)} not stringified"`;
192898
193145
  }
192899
193146
  if (spacer !== "") {
192900
193147
  res += `
@@ -192907,7 +193154,7 @@ ${originalIndentation}`;
192907
193154
  let whitespace = "";
192908
193155
  if (spacer !== "") {
192909
193156
  indentation += spacer;
192910
- join18 = `,
193157
+ join19 = `,
192911
193158
  ${indentation}`;
192912
193159
  whitespace = " ";
192913
193160
  }
@@ -192916,7 +193163,7 @@ ${indentation}`;
192916
193163
  const tmp = stringifyArrayReplacer(key2, value10[key2], stack, replacer, spacer, indentation);
192917
193164
  if (tmp !== undefined) {
192918
193165
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
192919
- separator = join18;
193166
+ separator = join19;
192920
193167
  }
192921
193168
  }
192922
193169
  if (spacer !== "" && separator.length > 1) {
@@ -193002,16 +193249,16 @@ ${originalIndentation}`;
193002
193249
  return '"[Object]"';
193003
193250
  }
193004
193251
  indentation += spacer;
193005
- const join18 = `,
193252
+ const join19 = `,
193006
193253
  ${indentation}`;
193007
193254
  let res = "";
193008
193255
  let separator = "";
193009
193256
  let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
193010
193257
  if (isTypedArrayWithEntries(value10)) {
193011
- res += stringifyTypedArray(value10, join18, maximumBreadth);
193258
+ res += stringifyTypedArray(value10, join19, maximumBreadth);
193012
193259
  keys16 = keys16.slice(value10.length);
193013
193260
  maximumPropertiesToStringify -= value10.length;
193014
- separator = join18;
193261
+ separator = join19;
193015
193262
  }
193016
193263
  if (deterministic) {
193017
193264
  keys16 = sort4(keys16, comparator);
@@ -193022,13 +193269,13 @@ ${indentation}`;
193022
193269
  const tmp = stringifyIndent(key2, value10[key2], stack, spacer, indentation);
193023
193270
  if (tmp !== undefined) {
193024
193271
  res += `${separator}${strEscape(key2)}: ${tmp}`;
193025
- separator = join18;
193272
+ separator = join19;
193026
193273
  }
193027
193274
  }
193028
193275
  if (keyLength > maximumBreadth) {
193029
193276
  const removedKeys = keyLength - maximumBreadth;
193030
193277
  res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
193031
- separator = join18;
193278
+ separator = join19;
193032
193279
  }
193033
193280
  if (separator !== "") {
193034
193281
  res = `
@@ -193421,11 +193668,11 @@ var require_pino = __commonJS((exports, module) => {
193421
193668
  depthLimit: 5,
193422
193669
  edgeLimit: 100
193423
193670
  };
193424
- var normalize4 = createArgsNormalizer(defaultOptions3);
193671
+ var normalize5 = createArgsNormalizer(defaultOptions3);
193425
193672
  var serializers = Object.assign(Object.create(null), stdSerializers);
193426
193673
  function pino(...args3) {
193427
193674
  const instance = {};
193428
- const { opts, stream: stream2 } = normalize4(instance, caller(), ...args3);
193675
+ const { opts, stream: stream2 } = normalize5(instance, caller(), ...args3);
193429
193676
  if (opts.level && typeof opts.level === "string" && DEFAULT_LEVELS[opts.level.toLowerCase()] !== undefined)
193430
193677
  opts.level = opts.level.toLowerCase();
193431
193678
  const {
@@ -193550,37 +193797,406 @@ var require_pino = __commonJS((exports, module) => {
193550
193797
  init_dist();
193551
193798
  init_dist2();
193552
193799
 
193553
- // src/utils/normalize-path.ts
193554
- function normalizePath2(inputPath) {
193555
- if (!inputPath) {
193556
- return "";
193800
+ // ../cross-path/dist/normalize.js
193801
+ import path7 from "node:path";
193802
+
193803
+ // ../cross-path/dist/detect.js
193804
+ var cachedEnvironment2 = null;
193805
+ function detectEnvironment2() {
193806
+ if (cachedEnvironment2 !== null) {
193807
+ return cachedEnvironment2;
193557
193808
  }
193558
- let normalized = convertBackslashes(inputPath);
193559
- normalized = sanitizeDriveLetter(normalized);
193560
- normalized = removeDoubleSlashes(normalized);
193561
- return normalized;
193809
+ const platform = process.platform;
193810
+ if (platform === "win32") {
193811
+ cachedEnvironment2 = "windows";
193812
+ return cachedEnvironment2;
193813
+ }
193814
+ if (platform === "darwin") {
193815
+ cachedEnvironment2 = "darwin";
193816
+ return cachedEnvironment2;
193817
+ }
193818
+ if (platform === "linux") {
193819
+ if (process.env.WSL_DISTRO_NAME || process.env.WSLENV) {
193820
+ cachedEnvironment2 = "wsl";
193821
+ return cachedEnvironment2;
193822
+ }
193823
+ const msystem = process.env.MSYSTEM;
193824
+ if (msystem && (msystem.includes("MINGW") || msystem.includes("MSYS"))) {
193825
+ cachedEnvironment2 = "git-bash";
193826
+ return cachedEnvironment2;
193827
+ }
193828
+ if (process.env.CYGWIN) {
193829
+ cachedEnvironment2 = "cygwin";
193830
+ return cachedEnvironment2;
193831
+ }
193832
+ cachedEnvironment2 = "linux";
193833
+ return cachedEnvironment2;
193834
+ }
193835
+ cachedEnvironment2 = "linux";
193836
+ return cachedEnvironment2;
193837
+ }
193838
+
193839
+ // ../cross-path/dist/validate.js
193840
+ import path5 from "node:path";
193841
+ function isAbsolute3(inputPath) {
193842
+ return path5.win32.isAbsolute(inputPath) || path5.posix.isAbsolute(inputPath);
193843
+ }
193844
+ function isUNC2(inputPath) {
193845
+ const normalized = inputPath.replace(/\\/g, "/");
193846
+ if (normalized.length < 3) {
193847
+ return false;
193848
+ }
193849
+ if (!normalized.startsWith("//")) {
193850
+ return false;
193851
+ }
193852
+ if (normalized[2] === "/") {
193853
+ return false;
193854
+ }
193855
+ const afterPrefix = normalized.substring(2);
193856
+ const hasValidServerPart = /^[^\s\/]+/.test(afterPrefix);
193857
+ return hasValidServerPart;
193858
+ }
193859
+ function isWSLMount2(inputPath) {
193860
+ const wslMountPattern = /^\/mnt\/[a-z](\/|$)/i;
193861
+ return wslMountPattern.test(inputPath);
193562
193862
  }
193563
- function convertBackslashes(path3) {
193564
- return path3.replace(/\\/g, "/");
193863
+ function isGitBashMount2(inputPath) {
193864
+ const gitBashPattern = /^\/[a-z]\//i;
193865
+ return gitBashPattern.test(inputPath);
193565
193866
  }
193566
- function sanitizeDriveLetter(path3) {
193567
- return path3.replace(/^([A-Za-z]:)(?=[^/]|$)/, "$1/");
193867
+ function hasDriveLetter2(inputPath) {
193868
+ const driveLetterPattern = /^[A-Za-z]:/;
193869
+ return driveLetterPattern.test(inputPath);
193870
+ }
193871
+ function parseWSLUNC2(inputPath) {
193872
+ const normalized = inputPath.replace(/\\/g, "/");
193873
+ const wslUNCPattern = /^\/\/(wsl\.localhost|wsl\$)\/([^/]+)(\/.*)?$/i;
193874
+ const match44 = normalized.match(wslUNCPattern);
193875
+ if (!match44) {
193876
+ return null;
193877
+ }
193878
+ const distro = match44[2];
193879
+ const restPath = match44[3] || "/";
193880
+ return { distro, path: restPath };
193568
193881
  }
193569
- function removeDoubleSlashes(path3) {
193570
- const isUncPath = path3.startsWith("//") && path3[2] !== "/";
193571
- if (isUncPath) {
193572
- return "//" + path3.slice(2).replace(/\/+/g, "/");
193882
+ function isDriveRelative2(inputPath) {
193883
+ if (inputPath.length < 3) {
193884
+ return false;
193885
+ }
193886
+ const hasLetter = /^[A-Za-z]$/.test(inputPath[0]);
193887
+ const hasColon = inputPath[1] === ":";
193888
+ const notSlash = inputPath[2] !== "/" && inputPath[2] !== "\\";
193889
+ return hasLetter && hasColon && notSlash;
193890
+ }
193891
+
193892
+ // ../cross-path/dist/normalize.js
193893
+ function normalize4(inputPath, options2) {
193894
+ if (inputPath === null || inputPath === undefined) {
193895
+ throw new TypeError("Path cannot be null or undefined");
193896
+ }
193897
+ if (typeof inputPath !== "string") {
193898
+ throw new TypeError(`Path must be a string, received ${typeof inputPath}`);
193899
+ }
193900
+ if (inputPath.length === 0) {
193901
+ throw new TypeError("Path cannot be empty");
193902
+ }
193903
+ if (inputPath.includes("\x00")) {
193904
+ throw new TypeError("Path cannot contain null bytes");
193905
+ }
193906
+ const env = options2?.env ?? detectEnvironment2();
193907
+ const wslUNCInfo = parseWSLUNC2(inputPath);
193908
+ if (wslUNCInfo) {
193909
+ const currentDistro = process.env.WSL_DISTRO_NAME;
193910
+ if (env === "wsl" && currentDistro && wslUNCInfo.distro.toLowerCase() === currentDistro.toLowerCase()) {
193911
+ return path7.posix.normalize(wslUNCInfo.path);
193912
+ }
193913
+ }
193914
+ let intermediate = inputPath.replace(/\\/g, "/");
193915
+ const originalIsUNC = isUNC2(intermediate);
193916
+ if (isWSLMount2(intermediate)) {
193917
+ const driveLetter = intermediate.charAt(5).toLowerCase();
193918
+ intermediate = `${driveLetter}:${intermediate.substring(6)}`;
193919
+ if (intermediate.length === 2) {
193920
+ intermediate = `${driveLetter}:/`;
193921
+ }
193922
+ } else if (isGitBashMount2(intermediate)) {
193923
+ const driveLetter = intermediate.charAt(1).toLowerCase();
193924
+ intermediate = `${driveLetter}:${intermediate.substring(2)}`;
193925
+ }
193926
+ const hasWindowsDrive = hasDriveLetter2(intermediate);
193927
+ const isAbsolutePath = isAbsolute3(intermediate);
193928
+ const driveRelative = isDriveRelative2(intermediate);
193929
+ if (!isAbsolutePath && !hasWindowsDrive) {
193930
+ const basePath = options2?.basePath ?? process.cwd();
193931
+ const normalizedBase = basePath.replace(/\\/g, "/");
193932
+ if (hasDriveLetter2(normalizedBase)) {
193933
+ const drive = normalizedBase.substring(0, 2);
193934
+ const baseRest = normalizedBase.substring(2) || "/";
193935
+ const resolved = path7.posix.resolve(baseRest, intermediate);
193936
+ intermediate = drive + resolved;
193937
+ } else {
193938
+ intermediate = path7.posix.resolve(normalizedBase, intermediate);
193939
+ }
193940
+ } else if (driveRelative) {
193941
+ const pathDrive = intermediate.substring(0, 2).toLowerCase();
193942
+ const pathRest = intermediate.substring(2);
193943
+ const basePath = options2?.basePath ?? process.cwd();
193944
+ const normalizedBase = basePath.replace(/\\/g, "/");
193945
+ if (hasDriveLetter2(normalizedBase)) {
193946
+ const baseDrive = normalizedBase.substring(0, 2).toLowerCase();
193947
+ if (baseDrive === pathDrive) {
193948
+ const baseRest = normalizedBase.substring(2) || "/";
193949
+ const resolved = path7.posix.resolve(baseRest, pathRest);
193950
+ intermediate = pathDrive + resolved;
193951
+ } else {
193952
+ intermediate = pathDrive + "/" + pathRest;
193953
+ }
193954
+ } else {
193955
+ intermediate = pathDrive + "/" + pathRest;
193956
+ }
193957
+ }
193958
+ if (originalIsUNC || isUNC2(intermediate)) {
193959
+ const withoutPrefix = intermediate.substring(2);
193960
+ const normalizedRest = path7.posix.normalize(withoutPrefix);
193961
+ intermediate = "//" + normalizedRest;
193962
+ } else if (hasWindowsDrive || hasDriveLetter2(intermediate)) {
193963
+ const drive = intermediate.substring(0, 2);
193964
+ let rest = intermediate.substring(2);
193965
+ if (!rest.startsWith("/")) {
193966
+ rest = "/" + rest;
193967
+ }
193968
+ const normalizedRest = path7.posix.normalize(rest);
193969
+ intermediate = drive + normalizedRest;
193573
193970
  } else {
193574
- return path3.replace(/\/+/g, "/");
193971
+ intermediate = path7.posix.normalize(intermediate);
193972
+ }
193973
+ const finalHasDrive = hasDriveLetter2(intermediate);
193974
+ const finalIsUNC = isUNC2(intermediate);
193975
+ if (finalHasDrive || finalIsUNC) {
193976
+ intermediate = intermediate.toLowerCase();
193977
+ const segments = intermediate.split("/");
193978
+ const normalizedSegments = segments.map((segment, index2) => {
193979
+ if (index2 === 0 || segment === "") {
193980
+ return segment;
193981
+ }
193982
+ return segment.replace(/[\s.]+$/, "");
193983
+ });
193984
+ intermediate = normalizedSegments.join("/");
193985
+ }
193986
+ if (intermediate.length > 1 && intermediate.endsWith("/")) {
193987
+ const isWindowsRoot = finalHasDrive && intermediate.length === 3;
193988
+ const isPosixRoot = intermediate === "/";
193989
+ const isUNCRoot = finalIsUNC && intermediate.split("/").filter(Boolean).length <= 2;
193990
+ if (!isWindowsRoot && !isPosixRoot && !isUNCRoot) {
193991
+ intermediate = intermediate.slice(0, -1);
193992
+ }
193993
+ }
193994
+ if (finalHasDrive && intermediate.length === 2) {
193995
+ intermediate = intermediate + "/";
193996
+ }
193997
+ return intermediate;
193998
+ }
193999
+ function normalizePaths(paths, options2) {
194000
+ return paths.map((p) => normalize4(p, options2));
194001
+ }
194002
+ // src/utils/arg-normalizer.ts
194003
+ function toPlainObject(value10) {
194004
+ if (typeof value10 === "string") {
194005
+ try {
194006
+ const parsed = JSON.parse(value10);
194007
+ if (parsed && typeof parsed === "object")
194008
+ return parsed;
194009
+ } catch {
194010
+ return { title: value10 };
194011
+ }
193575
194012
  }
194013
+ if (value10 && typeof value10 === "object")
194014
+ return value10;
194015
+ return {};
193576
194016
  }
193577
- function normalizePaths(paths) {
193578
- return paths.map(normalizePath2);
194017
+ function coerceBoolean(v) {
194018
+ if (typeof v === "boolean")
194019
+ return v;
194020
+ if (typeof v === "string") {
194021
+ const s = v.trim().toLowerCase();
194022
+ if (["true", "t", "1", "yes", "y"].includes(s))
194023
+ return true;
194024
+ if (["false", "f", "0", "no", "n"].includes(s))
194025
+ return false;
194026
+ }
194027
+ if (typeof v === "number")
194028
+ return v !== 0;
194029
+ return;
194030
+ }
194031
+ function coerceNumber(v) {
194032
+ if (typeof v === "number" && Number.isFinite(v))
194033
+ return v;
194034
+ if (typeof v === "string") {
194035
+ const n = Number(v);
194036
+ if (!Number.isNaN(n))
194037
+ return n;
194038
+ }
194039
+ return;
194040
+ }
194041
+ function normalizeStatus(v) {
194042
+ if (typeof v !== "string")
194043
+ return;
194044
+ const s = v.trim().toLowerCase().replace(/\s+/g, "_").replace(/-+/g, "_");
194045
+ const allowed = new Set(["open", "in_progress", "blocked", "closed"]);
194046
+ if (allowed.has(s))
194047
+ return s;
194048
+ return;
194049
+ }
194050
+ function normalizeType(v) {
194051
+ if (typeof v !== "string")
194052
+ return;
194053
+ const s = v.trim().toLowerCase();
194054
+ const allowed = new Set(["bug", "feature", "task", "epic", "chore"]);
194055
+ if (allowed.has(s))
194056
+ return s;
194057
+ return;
194058
+ }
194059
+ function pick7(obj, keys15) {
194060
+ const out = {};
194061
+ for (const k of keys15)
194062
+ if (k in obj)
194063
+ out[k] = obj[k];
194064
+ return out;
194065
+ }
194066
+ function aliasCommonKeys(obj) {
194067
+ const out = { ...obj };
194068
+ const move = (from, to) => {
194069
+ if (out[from] !== undefined && out[to] === undefined) {
194070
+ out[to] = out[from];
194071
+ delete out[from];
194072
+ }
194073
+ };
194074
+ move("cell_id", "id");
194075
+ move("bead_id", "id");
194076
+ move("beadId", "id");
194077
+ move("parentId", "parent_id");
194078
+ move("issue_type", "type");
194079
+ move("issueType", "type");
194080
+ move("kind", "type");
194081
+ move("epicTitle", "epic_title");
194082
+ move("epicDescription", "epic_description");
194083
+ move("subTasks", "subtasks");
194084
+ move("tasks", "subtasks");
194085
+ move("items", "subtasks");
194086
+ move("idSuffix", "id_suffix");
194087
+ return out;
194088
+ }
194089
+ function normalizeCreateArgs(raw) {
194090
+ const obj = aliasCommonKeys(toPlainObject(raw));
194091
+ if (typeof raw === "string" && !obj.title)
194092
+ obj.title = String(raw);
194093
+ if (obj.priority !== undefined)
194094
+ obj.priority = coerceNumber(obj.priority);
194095
+ if (obj.type !== undefined)
194096
+ obj.type = normalizeType(obj.type) ?? obj.type;
194097
+ if (obj.parent_id !== undefined)
194098
+ obj.parent_id = String(obj.parent_id);
194099
+ return pick7(obj, ["title", "type", "priority", "description", "parent_id"]);
194100
+ }
194101
+ function normalizeUpdateArgs(raw) {
194102
+ const obj = aliasCommonKeys(toPlainObject(raw));
194103
+ if (obj.status !== undefined)
194104
+ obj.status = normalizeStatus(obj.status) ?? obj.status;
194105
+ if (obj.priority !== undefined)
194106
+ obj.priority = coerceNumber(obj.priority);
194107
+ if (obj.description !== undefined && obj.description != null)
194108
+ obj.description = String(obj.description);
194109
+ if (obj.id !== undefined)
194110
+ obj.id = String(obj.id);
194111
+ return pick7(obj, ["id", "status", "description", "priority"]);
194112
+ }
194113
+ function normalizeCloseArgs(raw) {
194114
+ const obj = aliasCommonKeys(toPlainObject(raw));
194115
+ if (obj.id !== undefined)
194116
+ obj.id = String(obj.id);
194117
+ if (obj.reason !== undefined)
194118
+ obj.reason = String(obj.reason);
194119
+ return pick7(obj, ["id", "reason"]);
194120
+ }
194121
+ function normalizeQueryArgs(raw) {
194122
+ const obj = aliasCommonKeys(toPlainObject(raw));
194123
+ if (obj.status !== undefined)
194124
+ obj.status = normalizeStatus(obj.status) ?? obj.status;
194125
+ if (obj.type !== undefined)
194126
+ obj.type = normalizeType(obj.type) ?? obj.type;
194127
+ if (obj.ready !== undefined)
194128
+ obj.ready = coerceBoolean(obj.ready);
194129
+ if (obj.parent_id !== undefined)
194130
+ obj.parent_id = String(obj.parent_id);
194131
+ if (obj.limit !== undefined)
194132
+ obj.limit = coerceNumber(obj.limit);
194133
+ return pick7(obj, ["status", "type", "ready", "parent_id", "limit"]);
194134
+ }
194135
+ function normalizeCellsArgs(raw) {
194136
+ const obj = aliasCommonKeys(toPlainObject(raw));
194137
+ if (obj.id !== undefined)
194138
+ obj.id = String(obj.id);
194139
+ if (obj.status !== undefined)
194140
+ obj.status = normalizeStatus(obj.status) ?? obj.status;
194141
+ if (obj.type !== undefined)
194142
+ obj.type = normalizeType(obj.type) ?? obj.type;
194143
+ if (obj.parent_id !== undefined)
194144
+ obj.parent_id = String(obj.parent_id);
194145
+ if (obj.ready !== undefined)
194146
+ obj.ready = coerceBoolean(obj.ready);
194147
+ if (obj.limit !== undefined)
194148
+ obj.limit = coerceNumber(obj.limit);
194149
+ return pick7(obj, ["id", "status", "type", "parent_id", "ready", "limit"]);
194150
+ }
194151
+ function normalizeEpicCreateArgs(raw) {
194152
+ const obj0 = aliasCommonKeys(toPlainObject(raw));
194153
+ const obj = { ...obj0 };
194154
+ if (obj.subtasks !== undefined && !Array.isArray(obj.subtasks)) {
194155
+ if (typeof obj.subtasks === "string")
194156
+ obj.subtasks = obj.subtasks.split(/[,\n]/).map((s) => ({ title: s.trim() })).filter((x) => x.title);
194157
+ else if (obj.subtasks && typeof obj.subtasks === "object")
194158
+ obj.subtasks = [obj.subtasks];
194159
+ }
194160
+ if (Array.isArray(obj.subtasks)) {
194161
+ obj.subtasks = obj.subtasks.map((st) => {
194162
+ if (typeof st === "string")
194163
+ return { title: st };
194164
+ const s = aliasCommonKeys(toPlainObject(st));
194165
+ if (s.priority !== undefined)
194166
+ s.priority = coerceNumber(s.priority);
194167
+ if (s.files && !Array.isArray(s.files))
194168
+ s.files = [String(s.files)];
194169
+ if (Array.isArray(s.files))
194170
+ s.files = s.files.map((p) => String(p));
194171
+ return pick7(s, ["title", "priority", "files", "id_suffix"]);
194172
+ });
194173
+ }
194174
+ if (obj.epic_title === undefined && typeof raw === "string")
194175
+ obj.epic_title = String(raw);
194176
+ if (obj.epic_description !== undefined)
194177
+ obj.epic_description = String(obj.epic_description);
194178
+ return pick7(obj, ["epic_title", "epic_description", "epic_id", "subtasks", "strategy", "task", "project_key", "recovery_context"]);
194179
+ }
194180
+ function formatZodError(toolName, err, example) {
194181
+ const issues = err.issues.map((i) => `- ${i.path.join(".") || "<root>"}: ${i.message}`).join(`
194182
+ `);
194183
+ const guidance = `How to fix:
194184
+ 1) Check field names (snake_case expected).
194185
+ 2) Coercions allowed: booleans as 'true/false', numbers as strings, status 'in-progress' -> 'in_progress'.
194186
+ 3) Remove unknown fields or typos.`;
194187
+ const sample2 = example ? `
194188
+
194189
+ Example:
194190
+ ${example}` : "";
194191
+ return `${toolName}: Invalid arguments.
194192
+ ${issues}
194193
+
194194
+ ${guidance}${sample2}`;
193579
194195
  }
193580
194196
 
193581
194197
  // src/hive.ts
193582
194198
  import { existsSync as existsSync12, readFileSync as readFileSync7 } from "node:fs";
193583
- import { join as join17 } from "node:path";
194199
+ import { join as join18 } from "node:path";
193584
194200
 
193585
194201
  // src/schemas/cell.ts
193586
194202
  init_zod3();
@@ -194263,6 +194879,25 @@ async function runGitCommand(args2) {
194263
194879
  const exitCode = await proc.exited;
194264
194880
  return { exitCode, stdout, stderr };
194265
194881
  }
194882
+ async function withRetry2(operation, retries2 = 3, delayMs = 100) {
194883
+ let lastError;
194884
+ for (let attempt3 = 0;attempt3 <= retries2; attempt3++) {
194885
+ try {
194886
+ return await operation();
194887
+ } catch (err) {
194888
+ lastError = err;
194889
+ const message = err instanceof Error ? err.message : String(err);
194890
+ if (attempt3 < retries2 && (message.includes("SQLITE_BUSY") || message.includes("SQLITE_BUSY_RECOVERY") || message.includes("database is locked"))) {
194891
+ await new Promise((r) => setTimeout(r, delayMs * (attempt3 + 1)));
194892
+ continue;
194893
+ }
194894
+ break;
194895
+ }
194896
+ }
194897
+ if (lastError instanceof Error)
194898
+ throw lastError;
194899
+ throw new Error(String(lastError));
194900
+ }
194266
194901
 
194267
194902
  class HiveError extends Error {
194268
194903
  command;
@@ -194288,8 +194923,8 @@ class HiveValidationError extends Error {
194288
194923
  }
194289
194924
  var BeadValidationError = HiveValidationError;
194290
194925
  function checkBeadsMigrationNeeded(projectPath) {
194291
- const beadsDir = normalizePath2(join17(projectPath, ".beads"));
194292
- const hiveDir = normalizePath2(join17(projectPath, ".hive"));
194926
+ const beadsDir = normalize4(join18(projectPath, ".beads"));
194927
+ const hiveDir = normalize4(join18(projectPath, ".hive"));
194293
194928
  if (existsSync12(hiveDir)) {
194294
194929
  return { needed: false };
194295
194930
  }
@@ -194299,8 +194934,8 @@ function checkBeadsMigrationNeeded(projectPath) {
194299
194934
  return { needed: false };
194300
194935
  }
194301
194936
  async function migrateBeadsToHive(projectPath) {
194302
- const beadsDir = normalizePath2(join17(projectPath, ".beads"));
194303
- const hiveDir = normalizePath2(join17(projectPath, ".hive"));
194937
+ const beadsDir = normalize4(join18(projectPath, ".beads"));
194938
+ const hiveDir = normalize4(join18(projectPath, ".hive"));
194304
194939
  if (existsSync12(hiveDir)) {
194305
194940
  return {
194306
194941
  migrated: false,
@@ -194318,7 +194953,7 @@ async function migrateBeadsToHive(projectPath) {
194318
194953
  return { migrated: true };
194319
194954
  }
194320
194955
  function ensureHiveDirectory(projectPath) {
194321
- const hiveDir = normalizePath2(join17(projectPath, ".hive"));
194956
+ const hiveDir = normalize4(join18(projectPath, ".hive"));
194322
194957
  if (!existsSync12(hiveDir)) {
194323
194958
  const { mkdirSync: mkdirSync3 } = __require("node:fs");
194324
194959
  mkdirSync3(hiveDir, { recursive: true });
@@ -194326,9 +194961,9 @@ function ensureHiveDirectory(projectPath) {
194326
194961
  }
194327
194962
  async function mergeHistoricBeads(projectPath) {
194328
194963
  const { readFileSync: readFileSync6, writeFileSync: writeFileSync3, existsSync: existsSync11 } = await import("node:fs");
194329
- const hiveDir = normalizePath2(join17(projectPath, ".hive"));
194330
- const basePath = normalizePath2(join17(hiveDir, "beads.base.jsonl"));
194331
- const issuesPath = normalizePath2(join17(hiveDir, "issues.jsonl"));
194964
+ const hiveDir = normalize4(join18(projectPath, ".hive"));
194965
+ const basePath = normalize4(join18(hiveDir, "beads.base.jsonl"));
194966
+ const issuesPath = normalize4(join18(hiveDir, "issues.jsonl"));
194332
194967
  if (!existsSync11(basePath)) {
194333
194968
  return { merged: 0, skipped: 0 };
194334
194969
  }
@@ -194360,8 +194995,8 @@ async function mergeHistoricBeads(projectPath) {
194360
194995
  writeFileSync3(issuesPath, mergedContent, "utf-8");
194361
194996
  return { merged, skipped };
194362
194997
  }
194363
- async function importJsonlToPGLite(projectPath) {
194364
- const jsonlPath = join17(projectPath, ".hive", "issues.jsonl");
194998
+ async function importJsonlToLibSQL(projectPath) {
194999
+ const jsonlPath = join18(projectPath, ".hive", "issues.jsonl");
194365
195000
  if (!existsSync12(jsonlPath)) {
194366
195001
  return { imported: 0, updated: 0, errors: 0 };
194367
195002
  }
@@ -194428,6 +195063,7 @@ async function importJsonlToPGLite(projectPath) {
194428
195063
  }
194429
195064
  return { imported, updated, errors: errors6 };
194430
195065
  }
195066
+ var importJsonlToPGLite = importJsonlToLibSQL;
194431
195067
  var adapterCache2 = new Map;
194432
195068
  var exitHookRegistered = false;
194433
195069
  var exitHookRunning = false;
@@ -194483,8 +195119,8 @@ function clearHiveAdapterCache() {
194483
195119
  adapterCache2.clear();
194484
195120
  }
194485
195121
  async function autoMigrateFromJSONL(adapter5, projectKey) {
194486
- const jsonlPath = join17(projectKey, ".hive", "issues.jsonl");
194487
- const oldPath = join17(projectKey, ".hive", "issues.jsonl.old");
195122
+ const jsonlPath = join18(projectKey, ".hive", "issues.jsonl");
195123
+ const oldPath = join18(projectKey, ".hive", "issues.jsonl.old");
194488
195124
  if (!existsSync12(jsonlPath)) {
194489
195125
  return;
194490
195126
  }
@@ -194533,7 +195169,19 @@ var hive_create = tool({
194533
195169
  parent_id: tool.schema.string().optional().describe("Parent cell ID for epic children")
194534
195170
  },
194535
195171
  async execute(args2, ctx) {
194536
- const validated = CellCreateArgsSchema.parse(args2);
195172
+ const normalized = normalizeCreateArgs(args2);
195173
+ const parsed = CellCreateArgsSchema.safeParse(normalized);
195174
+ if (!parsed.success) {
195175
+ const message = formatZodError("hive_create", parsed.error, `{
195176
+ "title": "Fix login bug",
195177
+ "type": "bug",
195178
+ "priority": 2,
195179
+ "description": "Null check on session token",
195180
+ "parent_id": "project-abc12"
195181
+ }`);
195182
+ throw new HiveValidationError(message, parsed.error);
195183
+ }
195184
+ const validated = parsed.data;
194537
195185
  const projectKey = getHiveWorkingDirectory();
194538
195186
  const adapter5 = await getHiveAdapter(projectKey);
194539
195187
  try {
@@ -194589,7 +195237,20 @@ var hive_create_epic = tool({
194589
195237
  }).optional().describe("Recovery context from checkpoint compaction")
194590
195238
  },
194591
195239
  async execute(args2, ctx) {
194592
- const validated = EpicCreateArgsSchema.parse(args2);
195240
+ const normalized = normalizeEpicCreateArgs(args2);
195241
+ const parsed = EpicCreateArgsSchema.safeParse(normalized);
195242
+ if (!parsed.success) {
195243
+ const message = formatZodError("hive_create_epic", parsed.error, `{
195244
+ "epic_title": "Ship new Auth",
195245
+ "epic_description": "Auth overhaul with passwordless",
195246
+ "subtasks": [
195247
+ { "title": "DB migration", "priority": 1 },
195248
+ { "title": "Add magic links", "priority": 2 }
195249
+ ]
195250
+ }`);
195251
+ throw new HiveValidationError(message, parsed.error);
195252
+ }
195253
+ const validated = parsed.data;
194593
195254
  const projectKey = getHiveWorkingDirectory();
194594
195255
  const adapter5 = await getHiveAdapter(projectKey);
194595
195256
  const created = [];
@@ -194612,12 +195273,21 @@ var hive_create_epic = tool({
194612
195273
  await adapter5.markDirty(projectKey, subtaskCell.id);
194613
195274
  created.push(subtaskCell);
194614
195275
  }
195276
+ try {
195277
+ const children3 = await adapter5.queryCells(projectKey, { parent_id: epic.id });
195278
+ if (children3.length !== validated.subtasks.length) {
195279
+ throw new Error(`Post-create validation failed: expected ${validated.subtasks.length} subtasks, found ${children3.length}`);
195280
+ }
195281
+ } catch (e) {
195282
+ const msg = e instanceof Error ? e.message : String(e);
195283
+ throw new Error(`Epic integrity check failed: ${msg}`);
195284
+ }
194615
195285
  const result = {
194616
195286
  success: true,
194617
195287
  epic: formatCellForOutput(epic),
194618
195288
  subtasks: created.slice(1).map((c) => formatCellForOutput(c))
194619
195289
  };
194620
- const effectiveProjectKey = args2.project_key || projectKey;
195290
+ const effectiveProjectKey = normalized.project_key || projectKey;
194621
195291
  try {
194622
195292
  const epicCreatedEvent = createEvent("epic_created", {
194623
195293
  project_key: effectiveProjectKey,
@@ -194635,16 +195305,16 @@ var hive_create_epic = tool({
194635
195305
  const event = createEvent("decomposition_generated", {
194636
195306
  project_key: effectiveProjectKey,
194637
195307
  epic_id: epic.id,
194638
- task: args2.task || validated.epic_title,
195308
+ task: normalized.task || validated.epic_title,
194639
195309
  context: validated.epic_description,
194640
- strategy: args2.strategy || "feature-based",
195310
+ strategy: normalized.strategy || "feature-based",
194641
195311
  epic_title: validated.epic_title,
194642
195312
  subtasks: validated.subtasks.map((st) => ({
194643
195313
  title: st.title,
194644
195314
  files: st.files || [],
194645
195315
  priority: st.priority
194646
195316
  })),
194647
- recovery_context: args2.recovery_context
195317
+ recovery_context: normalized.recovery_context
194648
195318
  });
194649
195319
  await appendEvent(event, effectiveProjectKey);
194650
195320
  } catch (error64) {
@@ -194656,7 +195326,7 @@ var hive_create_epic = tool({
194656
195326
  project_key: effectiveProjectKey,
194657
195327
  epic_id: epic.id,
194658
195328
  epic_title: validated.epic_title,
194659
- strategy: args2.strategy || "feature-based",
195329
+ strategy: normalized.strategy || "feature-based",
194660
195330
  subtask_count: validated.subtasks.length,
194661
195331
  total_files: totalFiles,
194662
195332
  coordinator_agent: "coordinator"
@@ -194681,10 +195351,10 @@ var hive_create_epic = tool({
194681
195351
  decision_type: "decomposition_complete",
194682
195352
  payload: {
194683
195353
  subtask_count: validated.subtasks.length,
194684
- strategy_used: args2.strategy || "feature-based",
195354
+ strategy_used: normalized.strategy || "feature-based",
194685
195355
  files_per_subtask: filesPerSubtask,
194686
195356
  epic_title: validated.epic_title,
194687
- task: args2.task
195357
+ task: normalized.task
194688
195358
  }
194689
195359
  });
194690
195360
  } catch (error64) {
@@ -194740,7 +195410,18 @@ var hive_query = tool({
194740
195410
  limit: tool.schema.number().optional().describe("Max results to return (default: 20)")
194741
195411
  },
194742
195412
  async execute(args2, ctx) {
194743
- const validated = CellQueryArgsSchema.parse(args2);
195413
+ const normalized = normalizeQueryArgs(args2);
195414
+ const parsed = CellQueryArgsSchema.safeParse(normalized);
195415
+ if (!parsed.success) {
195416
+ const message = formatZodError("hive_query", parsed.error, `{
195417
+ "status": "in_progress",
195418
+ "type": "task",
195419
+ "parent_id": "project-abc12",
195420
+ "limit": 10
195421
+ }`);
195422
+ throw new HiveValidationError(message, parsed.error);
195423
+ }
195424
+ const validated = parsed.data;
194744
195425
  const projectKey = getHiveWorkingDirectory();
194745
195426
  const adapter5 = await getHiveAdapter(projectKey);
194746
195427
  try {
@@ -194773,20 +195454,32 @@ var hive_update = tool({
194773
195454
  priority: tool.schema.number().min(0).max(3).optional().describe("New priority")
194774
195455
  },
194775
195456
  async execute(args2, ctx) {
194776
- const validated = CellUpdateArgsSchema.parse(args2);
195457
+ const normalized = normalizeUpdateArgs(args2);
195458
+ const parsed = CellUpdateArgsSchema.safeParse(normalized);
195459
+ if (!parsed.success) {
195460
+ const message = formatZodError("hive_update", parsed.error, `{
195461
+ "id": "project-abc12",
195462
+ "status": "in_progress",
195463
+ "priority": 1,
195464
+ "description": "Ready for review"
195465
+ }`);
195466
+ throw new HiveValidationError(message, parsed.error);
195467
+ }
195468
+ const validated = parsed.data;
194777
195469
  const projectKey = getHiveWorkingDirectory();
194778
195470
  const adapter5 = await getHiveAdapter(projectKey);
194779
195471
  try {
194780
195472
  const cellId = await resolvePartialId(adapter5, projectKey, validated.id) || validated.id;
194781
195473
  let cell;
194782
- if (validated.status) {
194783
- cell = await adapter5.changeCellStatus(projectKey, cellId, validated.status);
195474
+ if (validated.status !== undefined) {
195475
+ const newStatus = validated.status;
195476
+ cell = await withRetry2(() => adapter5.changeCellStatus(projectKey, cellId, newStatus));
194784
195477
  }
194785
195478
  if (validated.description !== undefined || validated.priority !== undefined) {
194786
- cell = await adapter5.updateCell(projectKey, cellId, {
195479
+ cell = await withRetry2(() => adapter5.updateCell(projectKey, cellId, {
194787
195480
  description: validated.description,
194788
195481
  priority: validated.priority
194789
- });
195482
+ }));
194790
195483
  } else if (!validated.status) {
194791
195484
  const existingCell = await adapter5.getCell(projectKey, cellId);
194792
195485
  if (!existingCell) {
@@ -194833,14 +195526,23 @@ var hive_close = tool({
194833
195526
  reason: tool.schema.string().describe("Completion reason")
194834
195527
  },
194835
195528
  async execute(args2, ctx) {
194836
- const validated = CellCloseArgsSchema.parse(args2);
195529
+ const normalized = normalizeCloseArgs(args2);
195530
+ const parsed = CellCloseArgsSchema.safeParse(normalized);
195531
+ if (!parsed.success) {
195532
+ const message = formatZodError("hive_close", parsed.error, `{
195533
+ "id": "project-abc12",
195534
+ "reason": "Merged in main"
195535
+ }`);
195536
+ throw new HiveValidationError(message, parsed.error);
195537
+ }
195538
+ const validated = parsed.data;
194837
195539
  const projectKey = getHiveWorkingDirectory();
194838
195540
  const adapter5 = await getHiveAdapter(projectKey);
194839
195541
  try {
194840
195542
  const cellId = await resolvePartialId(adapter5, projectKey, validated.id) || validated.id;
194841
195543
  const cellBeforeClose = await adapter5.getCell(projectKey, cellId);
194842
195544
  const isEpic = cellBeforeClose?.type === "epic";
194843
- const cell = await adapter5.closeCell(projectKey, cellId, validated.reason);
195545
+ const cell = await withRetry2(() => adapter5.closeCell(projectKey, cellId, validated.reason));
194844
195546
  await adapter5.markDirty(projectKey, cellId);
194845
195547
  if (isEpic && cellBeforeClose) {
194846
195548
  try {
@@ -194961,7 +195663,7 @@ var hive_start = tool({
194961
195663
  const adapter5 = await getHiveAdapter(projectKey);
194962
195664
  try {
194963
195665
  const cellId = await resolvePartialId(adapter5, projectKey, args2.id) || args2.id;
194964
- const cell = await adapter5.changeCellStatus(projectKey, cellId, "in_progress");
195666
+ const cell = await withRetry2(() => adapter5.changeCellStatus(projectKey, cellId, "in_progress"));
194965
195667
  await adapter5.markDirty(projectKey, cellId);
194966
195668
  try {
194967
195669
  const event = createEvent("cell_status_changed", {
@@ -195036,16 +195738,17 @@ PREFER THIS OVER hive_query when you need to:
195036
195738
  async execute(args2, ctx) {
195037
195739
  const projectKey = getHiveWorkingDirectory();
195038
195740
  const adapter5 = await getHiveAdapter(projectKey);
195741
+ const normalized = normalizeCellsArgs(args2);
195039
195742
  try {
195040
- if (args2.id) {
195041
- const matchingCells = await findCellsByPartialId(adapter5, projectKey, args2.id);
195743
+ if (normalized.id) {
195744
+ const matchingCells = await findCellsByPartialId(adapter5, projectKey, normalized.id);
195042
195745
  if (matchingCells.length === 0) {
195043
- throw new HiveError(`No cell found matching ID '${args2.id}'`, "hive_cells");
195746
+ throw new HiveError(`No cell found matching ID '${normalized.id}'`, "hive_cells");
195044
195747
  }
195045
195748
  const formatted2 = matchingCells.map((c) => formatCellForOutput(c));
195046
195749
  return JSON.stringify(formatted2, null, 2);
195047
195750
  }
195048
- if (args2.ready) {
195751
+ if (normalized.ready) {
195049
195752
  const ready = await adapter5.getNextReadyCell(projectKey);
195050
195753
  if (!ready) {
195051
195754
  return JSON.stringify([], null, 2);
@@ -195054,10 +195757,10 @@ PREFER THIS OVER hive_query when you need to:
195054
195757
  return JSON.stringify([formatted2], null, 2);
195055
195758
  }
195056
195759
  const cells2 = await adapter5.queryCells(projectKey, {
195057
- status: args2.status,
195058
- type: args2.type,
195059
- parent_id: args2.parent_id,
195060
- limit: args2.limit || 20
195760
+ status: normalized.status,
195761
+ type: normalized.type,
195762
+ parent_id: normalized.parent_id,
195763
+ limit: normalized.limit || 20
195061
195764
  });
195062
195765
  const formatted = cells2.map((c) => formatCellForOutput(c));
195063
195766
  return JSON.stringify(formatted, null, 2);
@@ -195067,7 +195770,7 @@ PREFER THIS OVER hive_query when you need to:
195067
195770
  }
195068
195771
  const message = error64 instanceof Error ? error64.message : String(error64);
195069
195772
  if (message.includes("Bead not found") || message.includes("Cell not found")) {
195070
- throw new HiveError(`No cell found matching ID '${args2.id || "unknown"}'`, "hive_cells");
195773
+ throw new HiveError(`No cell found matching ID '${normalized.id || "unknown"}'`, "hive_cells");
195071
195774
  }
195072
195775
  throw new HiveError(`Failed to query cells: ${message}`, "hive_cells");
195073
195776
  }
@@ -195105,7 +195808,7 @@ var hive_sync = tool({
195105
195808
  const flushResult = await withTimeout2(flushManager.flush(), TIMEOUT_MS, "flush hive");
195106
195809
  const swarmMail = await getSwarmMailLibSQL(projectKey);
195107
195810
  const db = await swarmMail.getDatabase();
195108
- const hivePath = join17(projectKey, ".hive");
195811
+ const hivePath = join18(projectKey, ".hive");
195109
195812
  let memoriesSynced = 0;
195110
195813
  try {
195111
195814
  const memoryResult = await syncMemories(db, hivePath);
@@ -195136,6 +195839,14 @@ var hive_sync = tool({
195136
195839
  const remoteCheckResult2 = await runGitCommand(["remote"]);
195137
195840
  const hasRemote2 = remoteCheckResult2.stdout.trim() !== "";
195138
195841
  if (hasRemote2) {
195842
+ await withTimeout2(runGitCommand(["fetch", "--all", "--prune"]), TIMEOUT_MS, "git fetch");
195843
+ const upstreamResult = await runGitCommand([
195844
+ "rev-parse",
195845
+ "--abbrev-ref",
195846
+ "--symbolic-full-name",
195847
+ "@{u}"
195848
+ ]);
195849
+ const hasUpstream = upstreamResult.exitCode === 0;
195139
195850
  const statusResult = await runGitCommand(["status", "--porcelain"]);
195140
195851
  const hasUnstagedChanges = statusResult.stdout.trim() !== "";
195141
195852
  let didStash = false;
@@ -195146,9 +195857,13 @@ var hive_sync = tool({
195146
195857
  }
195147
195858
  }
195148
195859
  try {
195149
- const pullResult = await withTimeout2(runGitCommand(["pull", "--rebase"]), TIMEOUT_MS, "git pull --rebase");
195150
- if (pullResult.exitCode !== 0) {
195151
- throw new HiveError(`Failed to pull: ${pullResult.stderr}`, "git pull --rebase", pullResult.exitCode);
195860
+ if (hasUpstream) {
195861
+ const pullResult = await withTimeout2(runGitCommand(["pull", "--rebase"]), TIMEOUT_MS, "git pull --rebase");
195862
+ if (pullResult.exitCode !== 0) {
195863
+ throw new HiveError(`Failed to pull: ${pullResult.stderr}`, "git pull --rebase", pullResult.exitCode);
195864
+ }
195865
+ } else {
195866
+ console.warn("[hive_sync] No upstream configured for current branch. Skipping pull.");
195152
195867
  }
195153
195868
  } finally {
195154
195869
  if (didStash) {
@@ -195677,14 +196392,14 @@ function formatToolAvailability(availability) {
195677
196392
  // src/rate-limiter.ts
195678
196393
  var import_ioredis = __toESM(require_built3(), 1);
195679
196394
  import { mkdirSync as mkdirSync3, existsSync as existsSync13 } from "node:fs";
195680
- import { dirname as dirname4, join as join19 } from "node:path";
196395
+ import { dirname as dirname5, join as join20 } from "node:path";
195681
196396
  import { homedir as homedir6 } from "node:os";
195682
196397
  var sqliteAvailable = false;
195683
196398
  var createDatabase = null;
195684
196399
  try {
195685
196400
  if (typeof globalThis.Bun !== "undefined") {
195686
196401
  const bunSqlite = await import("bun:sqlite");
195687
- createDatabase = (path4) => new bunSqlite.Database(path4);
196402
+ createDatabase = (path6) => new bunSqlite.Database(path6);
195688
196403
  sqliteAvailable = true;
195689
196404
  }
195690
196405
  } catch {
@@ -195792,7 +196507,7 @@ class SqliteRateLimiter {
195792
196507
  if (!sqliteAvailable || !createDatabase) {
195793
196508
  throw new Error("SQLite is not available in this runtime (requires Bun)");
195794
196509
  }
195795
- const dir3 = dirname4(dbPath);
196510
+ const dir3 = dirname5(dbPath);
195796
196511
  if (!existsSync13(dir3)) {
195797
196512
  mkdirSync3(dir3, { recursive: true });
195798
196513
  }
@@ -195938,7 +196653,7 @@ async function createRateLimiter(options2) {
195938
196653
  const {
195939
196654
  backend,
195940
196655
  redisUrl = process.env.OPENCODE_RATE_LIMIT_REDIS_URL || "redis://localhost:6379",
195941
- sqlitePath = process.env.OPENCODE_RATE_LIMIT_SQLITE_PATH || join19(homedir6(), ".config", "opencode", "rate-limits.db")
196656
+ sqlitePath = process.env.OPENCODE_RATE_LIMIT_SQLITE_PATH || join20(homedir6(), ".config", "opencode", "rate-limits.db")
195942
196657
  } = options2 || {};
195943
196658
  if (backend === "memory") {
195944
196659
  return new InMemoryRateLimiter;
@@ -196004,7 +196719,7 @@ import {
196004
196719
  writeFileSync as writeFileSync3,
196005
196720
  unlinkSync
196006
196721
  } from "fs";
196007
- import { join as join20 } from "path";
196722
+ import { join as join21 } from "path";
196008
196723
  import { tmpdir } from "os";
196009
196724
  var AGENT_MAIL_URL = "http://127.0.0.1:8765";
196010
196725
  var MAX_INBOX_LIMIT3 = 5;
@@ -196028,16 +196743,16 @@ var RECOVERY_CONFIG = {
196028
196743
  restartCooldownMs: 1e4,
196029
196744
  enabled: process.env.OPENCODE_AGENT_MAIL_AUTO_RESTART !== "false"
196030
196745
  };
196031
- var SESSION_STATE_DIR = process.env.SWARM_STATE_DIR || join20(tmpdir(), "swarm-sessions");
196746
+ var SESSION_STATE_DIR = process.env.SWARM_STATE_DIR || join21(tmpdir(), "swarm-sessions");
196032
196747
  function getSessionStatePath(sessionID) {
196033
196748
  const safeID = sessionID.replace(/[^a-zA-Z0-9_-]/g, "_");
196034
- return join20(SESSION_STATE_DIR, `${safeID}.json`);
196749
+ return join21(SESSION_STATE_DIR, `${safeID}.json`);
196035
196750
  }
196036
196751
  function loadSessionState(sessionID) {
196037
- const path4 = getSessionStatePath(sessionID);
196752
+ const path6 = getSessionStatePath(sessionID);
196038
196753
  try {
196039
- if (existsSync14(path4)) {
196040
- const data = readFileSync8(path4, "utf-8");
196754
+ if (existsSync14(path6)) {
196755
+ const data = readFileSync8(path6, "utf-8");
196041
196756
  return JSON.parse(data);
196042
196757
  }
196043
196758
  } catch (error64) {
@@ -196050,8 +196765,8 @@ function saveSessionState(sessionID, state) {
196050
196765
  if (!existsSync14(SESSION_STATE_DIR)) {
196051
196766
  mkdirSync4(SESSION_STATE_DIR, { recursive: true });
196052
196767
  }
196053
- const path4 = getSessionStatePath(sessionID);
196054
- writeFileSync3(path4, JSON.stringify(state, null, 2));
196768
+ const path6 = getSessionStatePath(sessionID);
196769
+ writeFileSync3(path6, JSON.stringify(state, null, 2));
196055
196770
  return true;
196056
196771
  } catch (error64) {
196057
196772
  console.error(`[agent-mail] CRITICAL: Could not save session state: ${error64}`);
@@ -196192,11 +196907,11 @@ async function restartServer() {
196192
196907
  `${process.env.HOME}/mcp_agent_mail`
196193
196908
  ];
196194
196909
  let serverDir = null;
196195
- for (const path4 of possiblePaths) {
196910
+ for (const path6 of possiblePaths) {
196196
196911
  try {
196197
- const stat4 = await Bun.file(`${path4}/pyproject.toml`).exists();
196912
+ const stat4 = await Bun.file(`${path6}/pyproject.toml`).exists();
196198
196913
  if (stat4) {
196199
- serverDir = path4;
196914
+ serverDir = path6;
196200
196915
  break;
196201
196916
  }
196202
196917
  } catch {
@@ -197083,7 +197798,7 @@ import {
197083
197798
  writeFileSync as writeFileSync4,
197084
197799
  unlinkSync as unlinkSync2
197085
197800
  } from "node:fs";
197086
- import { join as join21 } from "node:path";
197801
+ import { join as join23 } from "node:path";
197087
197802
  import { tmpdir as tmpdir2 } from "node:os";
197088
197803
  var MAX_INBOX_LIMIT5 = 5;
197089
197804
  var swarmMailProjectDirectory = null;
@@ -197093,16 +197808,16 @@ function setSwarmMailProjectDirectory(directory) {
197093
197808
  function getSwarmMailProjectDirectory() {
197094
197809
  return swarmMailProjectDirectory ?? undefined;
197095
197810
  }
197096
- var SESSION_STATE_DIR2 = process.env.SWARM_STATE_DIR || join21(tmpdir2(), "swarm-sessions");
197811
+ var SESSION_STATE_DIR2 = process.env.SWARM_STATE_DIR || join23(tmpdir2(), "swarm-sessions");
197097
197812
  function getSessionStatePath2(sessionID) {
197098
197813
  const safeID = sessionID.replace(/[^a-zA-Z0-9_-]/g, "_");
197099
- return join21(SESSION_STATE_DIR2, `${safeID}.json`);
197814
+ return join23(SESSION_STATE_DIR2, `${safeID}.json`);
197100
197815
  }
197101
197816
  function loadSessionState2(sessionID) {
197102
- const path4 = getSessionStatePath2(sessionID);
197817
+ const path6 = getSessionStatePath2(sessionID);
197103
197818
  try {
197104
- if (existsSync15(path4)) {
197105
- const data = readFileSync9(path4, "utf-8");
197819
+ if (existsSync15(path6)) {
197820
+ const data = readFileSync9(path6, "utf-8");
197106
197821
  return JSON.parse(data);
197107
197822
  }
197108
197823
  } catch (error64) {
@@ -197115,8 +197830,8 @@ function saveSessionState2(sessionID, state) {
197115
197830
  if (!existsSync15(SESSION_STATE_DIR2)) {
197116
197831
  mkdirSync5(SESSION_STATE_DIR2, { recursive: true });
197117
197832
  }
197118
- const path4 = getSessionStatePath2(sessionID);
197119
- writeFileSync4(path4, JSON.stringify(state, null, 2));
197833
+ const path6 = getSessionStatePath2(sessionID);
197834
+ writeFileSync4(path6, JSON.stringify(state, null, 2));
197120
197835
  return true;
197121
197836
  } catch (error64) {
197122
197837
  console.warn(`[swarm-mail] Could not save session state: ${error64}`);
@@ -197124,10 +197839,10 @@ function saveSessionState2(sessionID, state) {
197124
197839
  }
197125
197840
  }
197126
197841
  function clearSessionState(sessionID) {
197127
- const path4 = getSessionStatePath2(sessionID);
197842
+ const path6 = getSessionStatePath2(sessionID);
197128
197843
  try {
197129
- if (existsSync15(path4)) {
197130
- unlinkSync2(path4);
197844
+ if (existsSync15(path6)) {
197845
+ unlinkSync2(path6);
197131
197846
  }
197132
197847
  } catch {}
197133
197848
  }
@@ -197158,12 +197873,27 @@ var swarmmail_init = tool({
197158
197873
  const sessionID = ctx.sessionID || "default";
197159
197874
  const existingState = loadSessionState2(sessionID);
197160
197875
  if (existingState) {
197161
- return JSON.stringify({
197162
- agent_name: existingState.agentName,
197163
- project_key: existingState.projectKey,
197164
- message: `Session already initialized as ${existingState.agentName}`,
197165
- already_initialized: true
197166
- }, null, 2);
197876
+ const requestedAgent = args2.agent_name;
197877
+ const projectMismatch = existingState.projectKey !== projectPath;
197878
+ const agentMismatch = Boolean(requestedAgent && requestedAgent !== existingState.agentName);
197879
+ if (args2.force_reinit) {
197880
+ clearSessionState(sessionID);
197881
+ } else {
197882
+ return JSON.stringify({
197883
+ agent_name: existingState.agentName,
197884
+ project_key: existingState.projectKey,
197885
+ message: `Session already initialized as ${existingState.agentName}`,
197886
+ already_initialized: true,
197887
+ session_id: sessionID,
197888
+ project_mismatch: projectMismatch || undefined,
197889
+ agent_mismatch: agentMismatch || undefined,
197890
+ note: projectMismatch || agentMismatch ? "To switch project/agent, call swarmmail_init again with force_reinit: true (or end the session)." : undefined,
197891
+ requested: requestedAgent || args2.project_path ? {
197892
+ agent_name: requestedAgent,
197893
+ project_key: args2.project_path
197894
+ } : undefined
197895
+ }, null, 2);
197896
+ }
197167
197897
  }
197168
197898
  try {
197169
197899
  const result = await initSwarmAgent({
@@ -197377,7 +198107,7 @@ var swarmmail_release = tool({
197377
198107
  } else if (args2.reservation_ids) {
197378
198108
  state.reservations = state.reservations.filter((id3) => !args2.reservation_ids.includes(id3));
197379
198109
  } else if (normalizedPaths) {
197380
- const releasedIds = currentReservations.filter((r) => normalizedPaths.includes(r.path_pattern)).map((r) => r.id);
198110
+ const releasedIds = currentReservations.filter((r) => normalizedPaths.some((p) => p === r.path_pattern)).map((r) => r.id);
197381
198111
  state.reservations = state.reservations.filter((id3) => !releasedIds.includes(id3));
197382
198112
  }
197383
198113
  saveSessionState2(sessionID, state);
@@ -197550,8 +198280,8 @@ class JsonExtractionError extends Error {
197550
198280
  }
197551
198281
  function formatZodErrors(error64) {
197552
198282
  return error64.issues.map((issue4) => {
197553
- const path4 = issue4.path.length > 0 ? `${issue4.path.join(".")}: ` : "";
197554
- return `${path4}${issue4.message}`;
198283
+ const path6 = issue4.path.length > 0 ? `${issue4.path.join(".")}: ` : "";
198284
+ return `${path6}${issue4.message}`;
197555
198285
  });
197556
198286
  }
197557
198287
  var SCHEMA_REGISTRY = {
@@ -199711,11 +200441,11 @@ var qmarksTestNoExtDot2 = ([$0]) => {
199711
200441
  return (f) => f.length === len && f !== "." && f !== "..";
199712
200442
  };
199713
200443
  var defaultPlatform2 = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
199714
- var path5 = {
200444
+ var path9 = {
199715
200445
  win32: { sep: "\\" },
199716
200446
  posix: { sep: "/" }
199717
200447
  };
199718
- var sep3 = defaultPlatform2 === "win32" ? path5.win32.sep : path5.posix.sep;
200448
+ var sep3 = defaultPlatform2 === "win32" ? path9.win32.sep : path9.posix.sep;
199719
200449
  minimatch2.sep = sep3;
199720
200450
  var GLOBSTAR2 = Symbol("globstar **");
199721
200451
  minimatch2.GLOBSTAR = GLOBSTAR2;
@@ -199861,9 +200591,9 @@ class Minimatch2 {
199861
200591
  this.debug(this.pattern, this.globParts);
199862
200592
  let set28 = this.globParts.map((s, _, __) => {
199863
200593
  if (this.isWindows && this.windowsNoMagicRoot) {
199864
- const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic2.test(s[2])) && !globMagic2.test(s[3]);
200594
+ const isUNC3 = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic2.test(s[2])) && !globMagic2.test(s[3]);
199865
200595
  const isDrive = /^[a-z]:/i.test(s[0]);
199866
- if (isUNC) {
200596
+ if (isUNC3) {
199867
200597
  return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
199868
200598
  } else if (isDrive) {
199869
200599
  return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
@@ -200352,15 +201082,15 @@ init_skills();
200352
201082
  // src/swarm-worktree.ts
200353
201083
  init_dist();
200354
201084
  init_zod3();
200355
- import { join as join25 } from "node:path";
201085
+ import { join as join26 } from "node:path";
200356
201086
  import { existsSync as existsSync16 } from "node:fs";
200357
201087
  var WORKTREE_DIR = ".swarm/worktrees";
200358
201088
  function getWorktreePath(projectPath, taskId) {
200359
201089
  const safeTaskId = taskId.replace(/[^a-zA-Z0-9.-]/g, "_");
200360
- return normalizePath2(join25(projectPath, WORKTREE_DIR, safeTaskId));
201090
+ return normalize4(join26(projectPath, WORKTREE_DIR, safeTaskId));
200361
201091
  }
200362
201092
  function parseTaskIdFromPath(worktreePath) {
200363
- const normalized = normalizePath2(worktreePath);
201093
+ const normalized = normalize4(worktreePath);
200364
201094
  const parts2 = normalized.split("/");
200365
201095
  const worktreesIdx = parts2.indexOf("worktrees");
200366
201096
  if (worktreesIdx >= 0 && worktreesIdx < parts2.length - 1) {
@@ -200368,18 +201098,18 @@ function parseTaskIdFromPath(worktreePath) {
200368
201098
  }
200369
201099
  return null;
200370
201100
  }
200371
- async function isGitRepo(path4) {
200372
- const result = await Bun.$`git -C ${path4} rev-parse --git-dir`.quiet().nothrow();
201101
+ async function isGitRepo(path6) {
201102
+ const result = await Bun.$`git -C ${path6} rev-parse --git-dir`.quiet().nothrow();
200373
201103
  return result.exitCode === 0;
200374
201104
  }
200375
- async function hasUncommittedChanges(path4) {
200376
- const result = await Bun.$`git -C ${path4} status --porcelain`.quiet().nothrow();
201105
+ async function hasUncommittedChanges(path6) {
201106
+ const result = await Bun.$`git -C ${path6} status --porcelain`.quiet().nothrow();
200377
201107
  if (result.exitCode !== 0)
200378
201108
  return true;
200379
201109
  return result.stdout.toString().trim().length > 0;
200380
201110
  }
200381
- async function getCurrentCommit(path4) {
200382
- const result = await Bun.$`git -C ${path4} rev-parse HEAD`.quiet().nothrow();
201111
+ async function getCurrentCommit(path6) {
201112
+ const result = await Bun.$`git -C ${path6} rev-parse HEAD`.quiet().nothrow();
200383
201113
  if (result.exitCode !== 0)
200384
201114
  return null;
200385
201115
  return result.stdout.toString().trim();
@@ -200392,7 +201122,7 @@ async function getWorktreeCommits(worktreePath, startCommit) {
200392
201122
  `).filter((c) => c.length > 0);
200393
201123
  }
200394
201124
  async function ensureWorktreeDir(projectPath) {
200395
- const worktreeDir = normalizePath2(join25(projectPath, WORKTREE_DIR));
201125
+ const worktreeDir = normalize4(join26(projectPath, WORKTREE_DIR));
200396
201126
  await Bun.$`mkdir -p ${worktreeDir}`.quiet().nothrow();
200397
201127
  }
200398
201128
  var swarm_worktree_create = tool({
@@ -200529,7 +201259,7 @@ var swarm_worktree_cleanup = tool({
200529
201259
  return JSON.stringify(result3, null, 2);
200530
201260
  }
200531
201261
  const output = listResult.stdout.toString();
200532
- const worktreeDir = join25(args2.project_path, WORKTREE_DIR);
201262
+ const worktreeDir = join26(args2.project_path, WORKTREE_DIR);
200533
201263
  const worktrees = output.split(`
200534
201264
 
200535
201265
  `).filter((block) => block.includes(worktreeDir)).map((block) => {
@@ -200594,7 +201324,7 @@ var swarm_worktree_list = tool({
200594
201324
  }, null, 2);
200595
201325
  }
200596
201326
  const output = listResult.stdout.toString();
200597
- const worktreeDir = join25(args2.project_path, WORKTREE_DIR);
201327
+ const worktreeDir = join26(args2.project_path, WORKTREE_DIR);
200598
201328
  const worktrees = [];
200599
201329
  const blocks = output.split(`
200600
201330
 
@@ -200604,12 +201334,12 @@ var swarm_worktree_list = tool({
200604
201334
  const commitMatch = block.match(/^HEAD ([a-f0-9]+)$/m);
200605
201335
  const branchMatch = block.match(/^branch (.+)$/m);
200606
201336
  if (pathMatch && pathMatch[1].includes(worktreeDir)) {
200607
- const path4 = pathMatch[1];
200608
- const taskId = parseTaskIdFromPath(path4);
201337
+ const path6 = pathMatch[1];
201338
+ const taskId = parseTaskIdFromPath(path6);
200609
201339
  if (taskId) {
200610
201340
  worktrees.push({
200611
201341
  task_id: taskId,
200612
- path: path4,
201342
+ path: path6,
200613
201343
  commit: commitMatch ? commitMatch[1] : "unknown",
200614
201344
  branch: branchMatch ? branchMatch[1] : undefined
200615
201345
  });
@@ -202775,7 +203505,7 @@ ${args2.files_context.map((f) => `- \`${f}\``).join(`
202775
203505
  *Learned from swarm execution on ${new Date().toISOString().split("T")[0]}*`;
202776
203506
  const { getSkill: getSkill2, invalidateSkillsCache: invalidateSkillsCache2 } = await Promise.resolve().then(() => (init_skills(), exports_skills));
202777
203507
  const { mkdir: mkdir2, writeFile: writeFile3 } = await import("node:fs/promises");
202778
- const { join: join18 } = await import("node:path");
203508
+ const { join: join19 } = await import("node:path");
202779
203509
  const existing = await getSkill2(args2.skill_name);
202780
203510
  if (existing) {
202781
203511
  return JSON.stringify({
@@ -202786,8 +203516,8 @@ ${args2.files_context.map((f) => `- \`${f}\``).join(`
202786
203516
  suggestion: "Use skills_update to add to existing skill, or choose a different name"
202787
203517
  }, null, 2);
202788
203518
  }
202789
- const skillDir = join18(process.cwd(), ".opencode", "skills", args2.skill_name);
202790
- const skillPath = join18(skillDir, "SKILL.md");
203519
+ const skillDir = join19(process.cwd(), ".opencode", "skills", args2.skill_name);
203520
+ const skillPath = join19(skillDir, "SKILL.md");
202791
203521
  const frontmatter = [
202792
203522
  "---",
202793
203523
  `name: ${args2.skill_name}`,
@@ -204150,7 +204880,7 @@ var promptTools = {
204150
204880
  init_dist();
204151
204881
  import { existsSync as existsSync17 } from "node:fs";
204152
204882
  import { readFile as readFile3 } from "node:fs/promises";
204153
- import { join as join28 } from "node:path";
204883
+ import { join as join29 } from "node:path";
204154
204884
 
204155
204885
  // ../../node_modules/yaml/dist/index.js
204156
204886
  var composer = require_composer();
@@ -204214,11 +204944,6 @@ var TOOL_DEFINITIONS = [
204214
204944
  name: "fetch",
204215
204945
  type: "mcp",
204216
204946
  capabilities: ["http-fetch", "markdown-conversion"]
204217
- },
204218
- {
204219
- name: "pdf-brain",
204220
- type: "mcp",
204221
- capabilities: ["knowledge-base-search", "internal-docs"]
204222
204947
  }
204223
204948
  ];
204224
204949
  function stripSemverConstraint(versionStr) {
@@ -204302,11 +205027,11 @@ async function parseYarnLockfile(lockfilePath, packages) {
204302
205027
  async function parsePackageJson(packageJsonPath, packages) {
204303
205028
  try {
204304
205029
  const content = await readFile3(packageJsonPath, "utf-8");
204305
- const packageJson = JSON.parse(content);
205030
+ const packageJson2 = JSON.parse(content);
204306
205031
  const versions3 = [];
204307
205032
  const allDeps = {
204308
- ...packageJson.dependencies,
204309
- ...packageJson.devDependencies
205033
+ ...packageJson2.dependencies,
205034
+ ...packageJson2.devDependencies
204310
205035
  };
204311
205036
  for (const pkg of packages) {
204312
205037
  const constraint = allDeps[pkg];
@@ -204328,22 +205053,22 @@ async function parsePackageJson(packageJsonPath, packages) {
204328
205053
  }
204329
205054
  }
204330
205055
  async function getInstalledVersions(projectPath, packages, checkUpgrades = false) {
204331
- const npmLock = join28(projectPath, "package-lock.json");
205056
+ const npmLock = join29(projectPath, "package-lock.json");
204332
205057
  let versions3 = [];
204333
205058
  if (existsSync17(npmLock)) {
204334
205059
  versions3 = await parseNpmLockfile(npmLock, packages);
204335
205060
  } else {
204336
- const pnpmLock = join28(projectPath, "pnpm-lock.yaml");
205061
+ const pnpmLock = join29(projectPath, "pnpm-lock.yaml");
204337
205062
  if (existsSync17(pnpmLock)) {
204338
205063
  versions3 = await parsePnpmLockfile(pnpmLock, packages);
204339
205064
  } else {
204340
- const yarnLock = join28(projectPath, "yarn.lock");
205065
+ const yarnLock = join29(projectPath, "yarn.lock");
204341
205066
  if (existsSync17(yarnLock)) {
204342
205067
  versions3 = await parseYarnLockfile(yarnLock, packages);
204343
205068
  } else {
204344
- const packageJson = join28(projectPath, "package.json");
204345
- if (existsSync17(packageJson)) {
204346
- versions3 = await parsePackageJson(packageJson, packages);
205069
+ const packageJson2 = join29(projectPath, "package.json");
205070
+ if (existsSync17(packageJson2)) {
205071
+ versions3 = await parsePackageJson(packageJson2, packages);
204347
205072
  }
204348
205073
  }
204349
205074
  }
@@ -205651,28 +206376,28 @@ init_dist2();
205651
206376
  init_memory2();
205652
206377
  init_memory2();
205653
206378
  import * as os2 from "node:os";
205654
- import * as path6 from "node:path";
205655
- import { join as join30 } from "node:path";
206379
+ import * as path10 from "node:path";
206380
+ import { join as join31 } from "node:path";
205656
206381
  var cachedAdapter2 = null;
205657
206382
  var cachedIndexer = null;
205658
206383
  var cachedProjectPath2 = null;
205659
206384
  async function getMemoryAdapter2(projectPath) {
205660
- const path4 = projectPath || process.cwd();
205661
- if (cachedAdapter2 && cachedProjectPath2 === path4) {
206385
+ const path6 = projectPath || process.cwd();
206386
+ if (cachedAdapter2 && cachedProjectPath2 === path6) {
205662
206387
  return cachedAdapter2;
205663
206388
  }
205664
- const swarmMail = await getSwarmMailLibSQL(path4);
206389
+ const swarmMail = await getSwarmMailLibSQL(path6);
205665
206390
  const dbAdapter = await swarmMail.getDatabase();
205666
206391
  cachedAdapter2 = await createMemoryAdapter2(dbAdapter);
205667
- cachedProjectPath2 = path4;
206392
+ cachedProjectPath2 = path6;
205668
206393
  return cachedAdapter2;
205669
206394
  }
205670
206395
  async function getSessionIndexer(projectPath) {
205671
- const path4 = projectPath || process.cwd();
205672
- if (cachedIndexer && cachedProjectPath2 === path4) {
206396
+ const path6 = projectPath || process.cwd();
206397
+ if (cachedIndexer && cachedProjectPath2 === path6) {
205673
206398
  return cachedIndexer;
205674
206399
  }
205675
- const swarmMail = await getSwarmMailLibSQL(path4);
206400
+ const swarmMail = await getSwarmMailLibSQL(path6);
205676
206401
  const dbAdapter = await swarmMail.getDatabase();
205677
206402
  const db = toSwarmDb(dbAdapter);
205678
206403
  const ollamaLayer = makeOllamaLive({
@@ -205680,7 +206405,7 @@ async function getSessionIndexer(projectPath) {
205680
206405
  ollamaModel: process.env.OLLAMA_MODEL || "mxbai-embed-large"
205681
206406
  });
205682
206407
  cachedIndexer = new SessionIndexer(db, ollamaLayer);
205683
- cachedProjectPath2 = path4;
206408
+ cachedProjectPath2 = path6;
205684
206409
  return cachedIndexer;
205685
206410
  }
205686
206411
  var getHivemindAdapter = getMemoryAdapter2;
@@ -205696,11 +206421,11 @@ async function emitEvent(eventType, data) {
205696
206421
  } catch {}
205697
206422
  }
205698
206423
  var AGENT_DIRECTORIES = [
205699
- path6.join(os2.homedir(), ".config", "swarm-tools", "sessions"),
205700
- path6.join(os2.homedir(), ".opencode"),
205701
- path6.join(os2.homedir(), "Cursor", "User", "History"),
205702
- path6.join(os2.homedir(), ".local", "share", "Claude"),
205703
- path6.join(os2.homedir(), ".aider")
206424
+ path10.join(os2.homedir(), ".config", "swarm-tools", "sessions"),
206425
+ path10.join(os2.homedir(), ".opencode"),
206426
+ path10.join(os2.homedir(), "Cursor", "User", "History"),
206427
+ path10.join(os2.homedir(), ".local", "share", "Claude"),
206428
+ path10.join(os2.homedir(), ".aider")
205704
206429
  ];
205705
206430
  var hivemind_store = tool({
205706
206431
  description: "Store a memory (learning, decision, pattern) with semantic embedding. Memories are searchable by semantic similarity and organized into collections. Use collection='default' for manual learnings.",
@@ -205859,7 +206584,7 @@ var hivemind_sync = tool({
205859
206584
  const projectPath = cachedProjectPath2 || process.cwd();
205860
206585
  const swarmMail = await getSwarmMailLibSQL(projectPath);
205861
206586
  const dbAdapter = await swarmMail.getDatabase();
205862
- const hiveDir = join30(projectPath, ".hive");
206587
+ const hiveDir = join31(projectPath, ".hive");
205863
206588
  const result = await syncMemories(dbAdapter, hiveDir);
205864
206589
  await emitEvent("memories_synced", {
205865
206590
  imported: result.imported.created,
@@ -206753,9 +207478,9 @@ function getMetricsSummary(metrics) {
206753
207478
  // src/logger.ts
206754
207479
  var import_pino = __toESM(require_pino(), 1);
206755
207480
  import { mkdirSync as mkdirSync6, existsSync as existsSync18 } from "node:fs";
206756
- import { join as join31 } from "node:path";
207481
+ import { join as join33 } from "node:path";
206757
207482
  import { homedir as homedir8 } from "node:os";
206758
- var DEFAULT_LOG_DIR = join31(homedir8(), ".config", "swarm-tools", "logs");
207483
+ var DEFAULT_LOG_DIR = join33(homedir8(), ".config", "swarm-tools", "logs");
206759
207484
  function ensureLogDir(logDir) {
206760
207485
  if (!existsSync18(logDir)) {
206761
207486
  mkdirSync6(logDir, { recursive: true });
@@ -206774,7 +207499,7 @@ function getLogger(logDir = DEFAULT_LOG_DIR) {
206774
207499
  let logger;
206775
207500
  if (process.env.SWARM_LOG_FILE === "1") {
206776
207501
  ensureLogDir(logDir);
206777
- const logPath = join31(logDir, "swarm.log");
207502
+ const logPath = join33(logDir, "swarm.log");
206778
207503
  logger = import_pino.default(baseConfig, import_pino.default.destination({ dest: logPath, sync: false }));
206779
207504
  } else {
206780
207505
  logger = import_pino.default(baseConfig);
@@ -206794,7 +207519,7 @@ function createChildLogger(module, logDir = DEFAULT_LOG_DIR) {
206794
207519
  let childLogger;
206795
207520
  if (process.env.SWARM_LOG_FILE === "1") {
206796
207521
  ensureLogDir(logDir);
206797
- const logPath = join31(logDir, `${module}.log`);
207522
+ const logPath = join33(logDir, `${module}.log`);
206798
207523
  childLogger = import_pino.default(baseConfig, import_pino.default.destination({ dest: logPath, sync: false }));
206799
207524
  } else {
206800
207525
  childLogger = import_pino.default(baseConfig);
@@ -207672,17 +208397,17 @@ init_memory_tools();
207672
208397
 
207673
208398
  // src/eval-history.ts
207674
208399
  import * as fs3 from "node:fs";
207675
- import * as path7 from "node:path";
208400
+ import * as path11 from "node:path";
207676
208401
  var DEFAULT_EVAL_HISTORY_PATH = ".opencode/eval-history.jsonl";
207677
208402
  var VARIANCE_THRESHOLD = 0.1;
207678
208403
  var BOOTSTRAP_THRESHOLD = 10;
207679
208404
  var STABILIZATION_THRESHOLD = 50;
207680
208405
  function getEvalHistoryPath(projectPath) {
207681
- return path7.join(projectPath, DEFAULT_EVAL_HISTORY_PATH);
208406
+ return path11.join(projectPath, DEFAULT_EVAL_HISTORY_PATH);
207682
208407
  }
207683
208408
  function ensureEvalHistoryDir(projectPath) {
207684
208409
  const historyPath = getEvalHistoryPath(projectPath);
207685
- const dir3 = path7.dirname(historyPath);
208410
+ const dir3 = path11.dirname(historyPath);
207686
208411
  if (!fs3.existsSync(dir3)) {
207687
208412
  fs3.mkdirSync(dir3, { recursive: true });
207688
208413
  }
@@ -208064,13 +208789,13 @@ init_dist();
208064
208789
  init_esm4();
208065
208790
  init_dist2();
208066
208791
  import * as os3 from "node:os";
208067
- import * as path8 from "node:path";
208792
+ import * as path12 from "node:path";
208068
208793
  var AGENT_DIRECTORIES2 = [
208069
- path8.join(os3.homedir(), ".config", "swarm-tools", "sessions"),
208070
- path8.join(os3.homedir(), ".opencode"),
208071
- path8.join(os3.homedir(), "Cursor", "User", "History"),
208072
- path8.join(os3.homedir(), ".local", "share", "Claude"),
208073
- path8.join(os3.homedir(), ".aider")
208794
+ path12.join(os3.homedir(), ".config", "swarm-tools", "sessions"),
208795
+ path12.join(os3.homedir(), ".opencode"),
208796
+ path12.join(os3.homedir(), "Cursor", "User", "History"),
208797
+ path12.join(os3.homedir(), ".local", "share", "Claude"),
208798
+ path12.join(os3.homedir(), ".aider")
208074
208799
  ];
208075
208800
  async function getSessionIndexer2() {
208076
208801
  const db = await getDb();
@@ -208627,6 +209352,7 @@ export {
208627
209352
  isAgentEvent,
208628
209353
  invalidateSkillsCache,
208629
209354
  importJsonlToPGLite,
209355
+ importJsonlToLibSQL,
208630
209356
  ifToolAvailable,
208631
209357
  hive_update,
208632
209358
  hive_sync,