@getpochi/cli 0.5.84 → 0.5.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +245 -136
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -127436,7 +127436,7 @@ var require_snapshot_utils = __commonJS((exports, module) => {
127436
127436
 
127437
127437
  // ../../node_modules/@effect/platform-node/node_modules/undici/lib/mock/snapshot-recorder.js
127438
127438
  var require_snapshot_recorder = __commonJS((exports, module) => {
127439
- var { writeFile: writeFile2, readFile: readFile7, mkdir: mkdir2 } = __require("node:fs/promises");
127439
+ var { writeFile: writeFile2, readFile: readFile8, mkdir: mkdir2 } = __require("node:fs/promises");
127440
127440
  var { dirname: dirname2, resolve: resolve5 } = __require("node:path");
127441
127441
  var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
127442
127442
  var { InvalidArgumentError: InvalidArgumentError5, UndiciError } = require_errors2();
@@ -127606,7 +127606,7 @@ var require_snapshot_recorder = __commonJS((exports, module) => {
127606
127606
  throw new InvalidArgumentError5("Snapshot path is required");
127607
127607
  }
127608
127608
  try {
127609
- const data = await readFile7(resolve5(path14), "utf8");
127609
+ const data = await readFile8(resolve5(path14), "utf8");
127610
127610
  const parsed = JSON.parse(data);
127611
127611
  if (Array.isArray(parsed)) {
127612
127612
  this.#snapshots.clear();
@@ -139587,7 +139587,7 @@ var handleBadArgument = (method) => (cause3) => new BadArgument({
139587
139587
  }, makeTempFile, makeTempFileScoped, readDirectory = (path14, options4) => tryPromise2({
139588
139588
  try: () => NFS2.promises.readdir(path14, options4),
139589
139589
  catch: (err) => handleErrnoException("FileSystem", "readDirectory")(err, [path14])
139590
- }), readFile8 = (path14) => async((resume2, signal2) => {
139590
+ }), readFile9 = (path14) => async((resume2, signal2) => {
139591
139591
  try {
139592
139592
  NFS2.readFile(path14, {
139593
139593
  signal: signal2
@@ -139601,22 +139601,22 @@ var handleBadArgument = (method) => (cause3) => new BadArgument({
139601
139601
  } catch (err) {
139602
139602
  resume2(fail10(handleBadArgument("readFile")(err)));
139603
139603
  }
139604
- }), readLink, realPath, rename4, makeFileInfo = (stat2) => ({
139605
- type: stat2.isFile() ? "File" : stat2.isDirectory() ? "Directory" : stat2.isSymbolicLink() ? "SymbolicLink" : stat2.isBlockDevice() ? "BlockDevice" : stat2.isCharacterDevice() ? "CharacterDevice" : stat2.isFIFO() ? "FIFO" : stat2.isSocket() ? "Socket" : "Unknown",
139606
- mtime: fromNullable2(stat2.mtime),
139607
- atime: fromNullable2(stat2.atime),
139608
- birthtime: fromNullable2(stat2.birthtime),
139609
- dev: stat2.dev,
139610
- rdev: fromNullable2(stat2.rdev),
139611
- ino: fromNullable2(stat2.ino),
139612
- mode: stat2.mode,
139613
- nlink: fromNullable2(stat2.nlink),
139614
- uid: fromNullable2(stat2.uid),
139615
- gid: fromNullable2(stat2.gid),
139616
- size: Size2(stat2.size),
139617
- blksize: map3(fromNullable2(stat2.blksize), Size2),
139618
- blocks: fromNullable2(stat2.blocks)
139619
- }), stat2, symlink2, truncate3, utimes2, watchNode = (path14, options4) => asyncScoped2((emit2) => acquireRelease2(sync6(() => {
139604
+ }), readLink, realPath, rename4, makeFileInfo = (stat3) => ({
139605
+ type: stat3.isFile() ? "File" : stat3.isDirectory() ? "Directory" : stat3.isSymbolicLink() ? "SymbolicLink" : stat3.isBlockDevice() ? "BlockDevice" : stat3.isCharacterDevice() ? "CharacterDevice" : stat3.isFIFO() ? "FIFO" : stat3.isSocket() ? "Socket" : "Unknown",
139606
+ mtime: fromNullable2(stat3.mtime),
139607
+ atime: fromNullable2(stat3.atime),
139608
+ birthtime: fromNullable2(stat3.birthtime),
139609
+ dev: stat3.dev,
139610
+ rdev: fromNullable2(stat3.rdev),
139611
+ ino: fromNullable2(stat3.ino),
139612
+ mode: stat3.mode,
139613
+ nlink: fromNullable2(stat3.nlink),
139614
+ uid: fromNullable2(stat3.uid),
139615
+ gid: fromNullable2(stat3.gid),
139616
+ size: Size2(stat3.size),
139617
+ blksize: map3(fromNullable2(stat3.blksize), Size2),
139618
+ blocks: fromNullable2(stat3.blocks)
139619
+ }), stat3, symlink2, truncate3, utimes2, watchNode = (path14, options4) => asyncScoped2((emit2) => acquireRelease2(sync6(() => {
139620
139620
  const watcher = NFS2.watch(path14, {
139621
139621
  recursive: options4?.recursive
139622
139622
  }, (event, path15) => {
@@ -139624,7 +139624,7 @@ var handleBadArgument = (method) => (cause3) => new BadArgument({
139624
139624
  return;
139625
139625
  switch (event) {
139626
139626
  case "rename": {
139627
- emit2.fromEffect(matchEffect3(stat2(path15), {
139627
+ emit2.fromEffect(matchEffect3(stat3(path15), {
139628
139628
  onSuccess: (_2) => succeed11(WatchEventCreate({
139629
139629
  path: path15
139630
139630
  })),
@@ -139655,7 +139655,7 @@ var handleBadArgument = (method) => (cause3) => new BadArgument({
139655
139655
  emit2.end();
139656
139656
  });
139657
139657
  return watcher;
139658
- }), (watcher) => sync6(() => watcher.close()))), watch3 = (backend, path14, options4) => stat2(path14).pipe(map22((stat3) => backend.pipe(flatMap2((_2) => _2.register(path14, stat3, options4)), getOrElse2(() => watchNode(path14, options4)))), unwrap8), writeFile3 = (path14, data, options4) => async((resume2, signal2) => {
139658
+ }), (watcher) => sync6(() => watcher.close()))), watch3 = (backend, path14, options4) => stat3(path14).pipe(map22((stat4) => backend.pipe(flatMap2((_2) => _2.register(path14, stat4, options4)), getOrElse2(() => watchNode(path14, options4)))), unwrap8), writeFile3 = (path14, data, options4) => async((resume2, signal2) => {
139659
139659
  try {
139660
139660
  NFS2.writeFile(path14, data, {
139661
139661
  signal: signal2,
@@ -139865,7 +139865,7 @@ var init_fileSystem2 = __esm(() => {
139865
139865
  const nodeRename = /* @__PURE__ */ effectify2(NFS2.rename, /* @__PURE__ */ handleErrnoException("FileSystem", "rename"), /* @__PURE__ */ handleBadArgument("rename"));
139866
139866
  return (oldPath, newPath) => nodeRename(oldPath, newPath);
139867
139867
  })();
139868
- stat2 = /* @__PURE__ */ (() => {
139868
+ stat3 = /* @__PURE__ */ (() => {
139869
139869
  const nodeStat = /* @__PURE__ */ effectify2(NFS2.stat, /* @__PURE__ */ handleErrnoException("FileSystem", "stat"), /* @__PURE__ */ handleBadArgument("stat"));
139870
139870
  return (path14) => map22(nodeStat(path14), makeFileInfo);
139871
139871
  })();
@@ -139895,12 +139895,12 @@ var init_fileSystem2 = __esm(() => {
139895
139895
  makeTempFileScoped,
139896
139896
  open: open3,
139897
139897
  readDirectory,
139898
- readFile: readFile8,
139898
+ readFile: readFile9,
139899
139899
  readLink,
139900
139900
  realPath,
139901
139901
  remove: remove21,
139902
139902
  rename: rename4,
139903
- stat: stat2,
139903
+ stat: stat3,
139904
139904
  symlink: symlink2,
139905
139905
  truncate: truncate3,
139906
139906
  utimes: utimes2,
@@ -227428,12 +227428,12 @@ var __require3, SLASHES_REGEX, WINDOWS_ROOT_DIR_REGEX, pushDirectory = (director
227428
227428
  fs9.realpath(path18, (error45, resolvedPath) => {
227429
227429
  if (error45)
227430
227430
  return queue.dequeue(suppressErrors ? null : error45, state2);
227431
- fs9.stat(resolvedPath, (error$1, stat4) => {
227431
+ fs9.stat(resolvedPath, (error$1, stat5) => {
227432
227432
  if (error$1)
227433
227433
  return queue.dequeue(suppressErrors ? null : error$1, state2);
227434
- if (stat4.isDirectory() && isRecursive(path18, resolvedPath, state2))
227434
+ if (stat5.isDirectory() && isRecursive(path18, resolvedPath, state2))
227435
227435
  return queue.dequeue(null, state2);
227436
- callback$1(stat4, resolvedPath);
227436
+ callback$1(stat5, resolvedPath);
227437
227437
  queue.dequeue(null, state2);
227438
227438
  });
227439
227439
  });
@@ -227442,10 +227442,10 @@ var __require3, SLASHES_REGEX, WINDOWS_ROOT_DIR_REGEX, pushDirectory = (director
227442
227442
  queue.enqueue();
227443
227443
  try {
227444
227444
  const resolvedPath = fs9.realpathSync(path18);
227445
- const stat4 = fs9.statSync(resolvedPath);
227446
- if (stat4.isDirectory() && isRecursive(path18, resolvedPath, state2))
227445
+ const stat5 = fs9.statSync(resolvedPath);
227446
+ if (stat5.isDirectory() && isRecursive(path18, resolvedPath, state2))
227447
227447
  return;
227448
- callback$1(stat4, resolvedPath);
227448
+ callback$1(stat5, resolvedPath);
227449
227449
  } catch (e9) {
227450
227450
  if (!suppressErrors)
227451
227451
  throw e9;
@@ -227595,8 +227595,8 @@ var __require3, SLASHES_REGEX, WINDOWS_ROOT_DIR_REGEX, pushDirectory = (director
227595
227595
  this.walkDirectory(this.state, path18, path18, depth - 1, this.walk);
227596
227596
  } else if (this.resolveSymlink && entry.isSymbolicLink()) {
227597
227597
  let path18 = joinPathWithBasePath(entry.name, directoryPath);
227598
- this.resolveSymlink(path18, this.state, (stat4, resolvedPath) => {
227599
- if (stat4.isDirectory()) {
227598
+ this.resolveSymlink(path18, this.state, (stat5, resolvedPath) => {
227599
+ if (stat5.isDirectory()) {
227600
227600
  resolvedPath = normalizePath(resolvedPath, this.state.options);
227601
227601
  if (exclude3 && exclude3(entry.name, useRealPaths ? resolvedPath : path18 + pathSeparator))
227602
227602
  return;
@@ -237863,7 +237863,7 @@ Defaulting to 2020, but this will stop working in the future.`)), options6.ecmaV
237863
237863
  return ".";
237864
237864
  const isUNCPath = (path19 = normalizeWindowsPath2(path19)).match(_UNC_REGEX), isPathAbsolute = isAbsolute5(path19), trailingSeparator = path19[path19.length - 1] === "/";
237865
237865
  return (path19 = normalizeString2(path19, !isPathAbsolute)).length === 0 ? isPathAbsolute ? "/" : trailingSeparator ? "./" : "." : (trailingSeparator && (path19 += "/"), _DRIVE_LETTER_RE2.test(path19) && (path19 += "/"), isUNCPath ? isPathAbsolute ? `//${path19}` : `//./${path19}` : isPathAbsolute && !isAbsolute5(path19) ? `/${path19}` : path19);
237866
- }, join18 = function(...arguments_) {
237866
+ }, join19 = function(...arguments_) {
237867
237867
  if (arguments_.length === 0)
237868
237868
  return ".";
237869
237869
  let joined;
@@ -238346,8 +238346,8 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
238346
238346
  }
238347
238347
  let lastPath, packageJsonUrl = new external_node_url_namespaceObject.URL("./node_modules/" + packageName + "/package.json", base), packageJsonPath = (0, external_node_url_namespaceObject.fileURLToPath)(packageJsonUrl);
238348
238348
  do {
238349
- const stat4 = tryStatSync(packageJsonPath.slice(0, -13));
238350
- if (!stat4 || !stat4.isDirectory()) {
238349
+ const stat5 = tryStatSync(packageJsonPath.slice(0, -13));
238350
+ if (!stat5 || !stat5.isDirectory()) {
238351
238351
  lastPath = packageJsonPath, packageJsonUrl = new external_node_url_namespaceObject.URL((isScoped ? "../../../../node_modules/" : "../../../node_modules/") + packageName + "/package.json", packageJsonUrl), packageJsonPath = (0, external_node_url_namespaceObject.fileURLToPath)(packageJsonUrl);
238352
238352
  continue;
238353
238353
  }
@@ -238618,12 +238618,12 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
238618
238618
  continue;
238619
238619
  const _alias = utils_hasTrailingSlash(alias) ? alias.slice(0, -1) : alias;
238620
238620
  if (utils_hasTrailingSlash(_path[_alias.length]))
238621
- return join18(to2, _path.slice(alias.length));
238621
+ return join19(to2, _path.slice(alias.length));
238622
238622
  }
238623
238623
  return _path;
238624
238624
  }(id5, ctx.alias));
238625
238625
  let parentURL = options6?.parentURL || ctx.url;
238626
- isDir(parentURL) && (parentURL = join18(parentURL, "_index.js"));
238626
+ isDir(parentURL) && (parentURL = join19(parentURL, "_index.js"));
238627
238627
  const conditionSets = ((options6?.async) ? [options6?.conditions, ["node", "import"], ["node", "require"]] : [options6?.conditions, ["node", "require"], ["node", "import"]]).filter(Boolean);
238628
238628
  for (const conditions of conditionSets) {
238629
238629
  try {
@@ -238719,7 +238719,7 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
238719
238719
  return path19.match(FILENAME_RE)?.[2];
238720
238720
  }(topts.filename)}` + (ctx.opts.sourceMaps ? "+map" : "") + (topts.interopDefault ? ".i" : "") + `.${md5(topts.filename)}` + (topts.async ? ".mjs" : ".cjs");
238721
238721
  topts.jsx && topts.filename.endsWith("x") && (cacheName += "x");
238722
- const cacheDir = ctx.opts.fsCache, cacheFilePath = join18(cacheDir, cacheName);
238722
+ const cacheDir = ctx.opts.fsCache, cacheFilePath = join19(cacheDir, cacheName);
238723
238723
  if ((0, external_node_fs_namespaceObject.existsSync)(cacheFilePath)) {
238724
238724
  const cacheSource = (0, external_node_fs_namespaceObject.readFileSync)(cacheFilePath, "utf8");
238725
238725
  if (cacheSource.endsWith(sourceHash))
@@ -238733,13 +238733,13 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
238733
238733
  if (ctx.opts.fsCache === true && (ctx.opts.fsCache = function(ctx2) {
238734
238734
  const nmDir = ctx2.filename && resolve9(ctx2.filename, "../node_modules");
238735
238735
  if (nmDir && (0, external_node_fs_namespaceObject.existsSync)(nmDir))
238736
- return join18(nmDir, ".cache/jiti");
238736
+ return join19(nmDir, ".cache/jiti");
238737
238737
  let _tmpDir = (0, external_node_os_namespaceObject.tmpdir)();
238738
238738
  if (process.env.TMPDIR && _tmpDir === process.cwd() && !process.env.JITI_RESPECT_TMPDIR_ENV) {
238739
238739
  const _env = process.env.TMPDIR;
238740
238740
  delete process.env.TMPDIR, _tmpDir = (0, external_node_os_namespaceObject.tmpdir)(), process.env.TMPDIR = _env;
238741
238741
  }
238742
- return join18(_tmpDir, "jiti");
238742
+ return join19(_tmpDir, "jiti");
238743
238743
  }(ctx)), ctx.opts.fsCache)
238744
238744
  try {
238745
238745
  if ((0, external_node_fs_namespaceObject.mkdirSync)(ctx.opts.fsCache, { recursive: true }), !function(filename) {
@@ -238764,9 +238764,9 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
238764
238764
  function eval_evalModule(ctx, source, evalOptions = {}) {
238765
238765
  const id5 = evalOptions.id || (evalOptions.filename ? basename4(evalOptions.filename) : `_jitiEval.${evalOptions.ext || (evalOptions.async ? "mjs" : "js")}`), filename = evalOptions.filename || jitiResolve(ctx, id5, { async: evalOptions.async }), ext2 = evalOptions.ext || extname3(filename), cache2 = evalOptions.cache || ctx.parentCache || {}, isTypescript = /\.[cm]?tsx?$/.test(ext2), isESM = ext2 === ".mjs" || ext2 === ".js" && function(path19) {
238766
238766
  for (;path19 && path19 !== "." && path19 !== "/"; ) {
238767
- path19 = join18(path19, "..");
238767
+ path19 = join19(path19, "..");
238768
238768
  try {
238769
- const pkg = (0, external_node_fs_namespaceObject.readFileSync)(join18(path19, "package.json"), "utf8");
238769
+ const pkg = (0, external_node_fs_namespaceObject.readFileSync)(join19(path19, "package.json"), "utf8");
238770
238770
  try {
238771
238771
  return JSON.parse(pkg);
238772
238772
  } catch {}
@@ -238829,7 +238829,7 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
238829
238829
  const deprecatOverrides = {};
238830
238830
  return userOptions2.cache !== undefined && (deprecatOverrides.fsCache = userOptions2.cache), userOptions2.requireCache !== undefined && (deprecatOverrides.moduleCache = userOptions2.requireCache), { ...jitiDefaults, ...deprecatOverrides, ...userOptions2 };
238831
238831
  }(userOptions), alias = opts.alias && Object.keys(opts.alias).length > 0 ? normalizeAliases(opts.alias || {}) : undefined, nativeModules = ["typescript", "jiti", ...opts.nativeModules || []], isNativeRe = new RegExp(`node_modules/(${nativeModules.map((m5) => escapeStringRegexp2(m5)).join("|")})/`), transformModules = [...opts.transformModules || []], isTransformRe = new RegExp(`node_modules/(${transformModules.map((m5) => escapeStringRegexp2(m5)).join("|")})/`);
238832
- filename || (filename = process.cwd()), !isNested && isDir(filename) && (filename = join18(filename, "_index.js"));
238832
+ filename || (filename = process.cwd()), !isNested && isDir(filename) && (filename = join19(filename, "_index.js"));
238833
238833
  const url3 = pathToFileURL3(filename), additionalExts = [...opts.extensions].filter((ext2) => ext2 !== ".js"), nativeRequire = parentContext.createRequire(isWindows2 ? filename.replace(/\//g, "\\") : filename), ctx = { filename, url: url3, opts, alias, nativeModules, transformModules, isNativeRe, isTransformRe, additionalExts, nativeRequire, onError: parentContext.onError, parentModule: parentContext.parentModule, parentCache: parentContext.parentCache, nativeImport: parentContext.nativeImport, createRequire: parentContext.createRequire };
238834
238834
  isNested || debug3(ctx, "[init]", ...[["version:", package_namespaceObject.rE], ["module-cache:", opts.moduleCache], ["fs-cache:", opts.fsCache], ["interop-defaults:", opts.interopDefault]].flat()), isNested || prepareCacheDir(ctx);
238835
238835
  const jiti = Object.assign(function(id5) {
@@ -244396,8 +244396,8 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
244396
244396
  }
244397
244397
  let lastPath, packageJsonUrl = new (_url2()).URL("./node_modules/" + packageName + "/package.json", base), packageJsonPath = (0, _url2().fileURLToPath)(packageJsonUrl);
244398
244398
  do {
244399
- const stat4 = tryStatSync(packageJsonPath.slice(0, -13));
244400
- if (!stat4 || !stat4.isDirectory()) {
244399
+ const stat5 = tryStatSync(packageJsonPath.slice(0, -13));
244400
+ if (!stat5 || !stat5.isDirectory()) {
244401
244401
  lastPath = packageJsonPath, packageJsonUrl = new (_url2()).URL((isScoped ? "../../../../node_modules/" : "../../../node_modules/") + packageName + "/package.json", packageJsonUrl), packageJsonPath = (0, _url2().fileURLToPath)(packageJsonUrl);
244402
244402
  continue;
244403
244403
  }
@@ -277865,7 +277865,7 @@ function requireReaddirp() {
277865
277865
  const { promisify: promisify3 } = require$$2;
277866
277866
  const picomatch2 = /* @__PURE__ */ requirePicomatch$2();
277867
277867
  const readdir3 = promisify3(fs9.readdir);
277868
- const stat4 = promisify3(fs9.stat);
277868
+ const stat5 = promisify3(fs9.stat);
277869
277869
  const lstat = promisify3(fs9.lstat);
277870
277870
  const realpath3 = promisify3(fs9.realpath);
277871
277871
  const BANG = "!";
@@ -277931,7 +277931,7 @@ function requireReaddirp() {
277931
277931
  const { root: root2, type: type3 } = opts;
277932
277932
  this._fileFilter = normalizeFilter(opts.fileFilter);
277933
277933
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
277934
- const statMethod = opts.lstat ? lstat : stat4;
277934
+ const statMethod = opts.lstat ? lstat : stat5;
277935
277935
  if (wantBigintFsStats) {
277936
277936
  this._stat = (path20) => statMethod(path20, { bigint: true });
277937
277937
  } else {
@@ -280961,11 +280961,11 @@ function requireNodefsHandler() {
280961
280961
  } = /* @__PURE__ */ requireConstants();
280962
280962
  const THROTTLE_MODE_WATCH = "watch";
280963
280963
  const open5 = promisify3(fs9.open);
280964
- const stat4 = promisify3(fs9.stat);
280964
+ const stat5 = promisify3(fs9.stat);
280965
280965
  const lstat = promisify3(fs9.lstat);
280966
280966
  const close5 = promisify3(fs9.close);
280967
280967
  const fsrealpath = promisify3(fs9.realpath);
280968
- const statMethods = { lstat, stat: stat4 };
280968
+ const statMethods = { lstat, stat: stat5 };
280969
280969
  const foreach = (val, fn3) => {
280970
280970
  if (val instanceof Set) {
280971
280971
  val.forEach(fn3);
@@ -281157,7 +281157,7 @@ function requireNodefsHandler() {
281157
281157
  return;
281158
281158
  if (!newStats || newStats.mtimeMs === 0) {
281159
281159
  try {
281160
- const newStats2 = await stat4(file8);
281160
+ const newStats2 = await stat5(file8);
281161
281161
  if (this.fsw.closed)
281162
281162
  return;
281163
281163
  const at3 = newStats2.atimeMs;
@@ -281419,10 +281419,10 @@ function requireFseventsHandler() {
281419
281419
  IDENTITY_FN
281420
281420
  } = /* @__PURE__ */ requireConstants();
281421
281421
  const Depth = (value10) => isNaN(value10) ? {} : { depth: value10 };
281422
- const stat4 = promisify3(fs9.stat);
281422
+ const stat5 = promisify3(fs9.stat);
281423
281423
  const lstat = promisify3(fs9.lstat);
281424
281424
  const realpath3 = promisify3(fs9.realpath);
281425
- const statMethods = { stat: stat4, lstat };
281425
+ const statMethods = { stat: stat5, lstat };
281426
281426
  const FSEventsWatchers = new Map;
281427
281427
  const consolidateThreshhold = 10;
281428
281428
  const wrongEventFlags = new Set([
@@ -281539,7 +281539,7 @@ function requireFseventsHandler() {
281539
281539
  }
281540
281540
  async checkExists(path20, fullPath, realPath2, parent, watchedDir, item, info2, opts) {
281541
281541
  try {
281542
- const stats = await stat4(path20);
281542
+ const stats = await stat5(path20);
281543
281543
  if (this.fsw.closed)
281544
281544
  return;
281545
281545
  if (sameTypes(info2, stats)) {
@@ -281598,7 +281598,7 @@ function requireFseventsHandler() {
281598
281598
  if (typeof opts.ignored === FUNCTION_TYPE) {
281599
281599
  let stats;
281600
281600
  try {
281601
- stats = await stat4(path20);
281601
+ stats = await stat5(path20);
281602
281602
  } catch (error45) {}
281603
281603
  if (this.fsw.closed)
281604
281604
  return;
@@ -281792,7 +281792,7 @@ function requireChokidar() {
281792
281792
  isMacos,
281793
281793
  isIBMi
281794
281794
  } = /* @__PURE__ */ requireConstants();
281795
- const stat4 = promisify3(fs9.stat);
281795
+ const stat5 = promisify3(fs9.stat);
281796
281796
  const readdir3 = promisify3(fs9.readdir);
281797
281797
  const arrify = (value10 = []) => Array.isArray(value10) ? value10 : [value10];
281798
281798
  const flatten22 = (list7, result2 = []) => {
@@ -282221,7 +282221,7 @@ function requireChokidar() {
282221
282221
  const fullPath = opts.cwd ? sysPath.join(opts.cwd, path20) : path20;
282222
282222
  let stats;
282223
282223
  try {
282224
- stats = await stat4(fullPath);
282224
+ stats = await stat5(fullPath);
282225
282225
  } catch (err) {}
282226
282226
  if (!stats || this.closed)
282227
282227
  return;
@@ -282321,8 +282321,8 @@ function requireChokidar() {
282321
282321
  }
282322
282322
  return this._userIgnored([path20, stats]);
282323
282323
  }
282324
- _isntIgnored(path20, stat5) {
282325
- return !this._isIgnored(path20, stat5);
282324
+ _isntIgnored(path20, stat6) {
282325
+ return !this._isIgnored(path20, stat6);
282326
282326
  }
282327
282327
  _getWatchHelpers(path20, depth) {
282328
282328
  const watchPath = depth || this.options.disableGlobbing || !isGlob2(path20) ? path20 : globParent2(path20);
@@ -311782,7 +311782,7 @@ var require_util8 = __commonJS((exports) => {
311782
311782
  return path20;
311783
311783
  });
311784
311784
  exports.normalize = normalize4;
311785
- function join18(aRoot, aPath) {
311785
+ function join19(aRoot, aPath) {
311786
311786
  if (aRoot === "") {
311787
311787
  aRoot = ".";
311788
311788
  }
@@ -311814,7 +311814,7 @@ var require_util8 = __commonJS((exports) => {
311814
311814
  }
311815
311815
  return joined;
311816
311816
  }
311817
- exports.join = join18;
311817
+ exports.join = join19;
311818
311818
  exports.isAbsolute = function(aPath) {
311819
311819
  return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
311820
311820
  };
@@ -312028,7 +312028,7 @@ var require_util8 = __commonJS((exports) => {
312028
312028
  parsed.path = parsed.path.substring(0, index3 + 1);
312029
312029
  }
312030
312030
  }
312031
- sourceURL = join18(urlGenerate(parsed), sourceURL);
312031
+ sourceURL = join19(urlGenerate(parsed), sourceURL);
312032
312032
  }
312033
312033
  return normalize4(sourceURL);
312034
312034
  }
@@ -313402,7 +313402,7 @@ var require_source_map = __commonJS((exports) => {
313402
313402
  // ../../node_modules/postcss/lib/previous-map.js
313403
313403
  var require_previous_map = __commonJS((exports, module) => {
313404
313404
  var { existsSync: existsSync4, readFileSync: readFileSync3 } = __require("fs");
313405
- var { dirname: dirname8, join: join18 } = __require("path");
313405
+ var { dirname: dirname8, join: join19 } = __require("path");
313406
313406
  var { SourceMapConsumer, SourceMapGenerator } = require_source_map();
313407
313407
  function fromBase642(str) {
313408
313408
  if (Buffer) {
@@ -313504,7 +313504,7 @@ var require_previous_map = __commonJS((exports, module) => {
313504
313504
  } else if (this.annotation) {
313505
313505
  let map52 = this.annotation;
313506
313506
  if (file8)
313507
- map52 = join18(dirname8(file8), map52);
313507
+ map52 = join19(dirname8(file8), map52);
313508
313508
  return this.loadFile(map52);
313509
313509
  }
313510
313510
  }
@@ -315692,7 +315692,7 @@ var false_default = false;
315692
315692
  import { builtinModules as builtinModules2, createRequire as createRequire5 } from "node:module";
315693
315693
  import * as fs$1 from "node:fs";
315694
315694
  import fs10, { existsSync as existsSync5, promises as promises4, readFileSync as readFileSync3 } from "node:fs";
315695
- import path20, { basename as basename5, dirname as dirname8, extname as extname4, isAbsolute as isAbsolute6, join as join18, normalize as normalize4, posix as posix5, relative as relative6, resolve as resolve10, sep as sep3 } from "node:path";
315695
+ import path20, { basename as basename5, dirname as dirname8, extname as extname4, isAbsolute as isAbsolute6, join as join19, normalize as normalize4, posix as posix5, relative as relative6, resolve as resolve10, sep as sep3 } from "node:path";
315696
315696
  import fsp, { constants as constants6 } from "node:fs/promises";
315697
315697
  import { URL as URL$1, fileURLToPath as fileURLToPath6, pathToFileURL as pathToFileURL3 } from "node:url";
315698
315698
  import { format as format10, inspect as inspect3, promisify as promisify3, stripVTControlCharacters as stripVTControlCharacters2 } from "node:util";
@@ -324426,7 +324426,7 @@ async function startBrowserProcess(browser2, browserArgs, url$3, logger16) {
324426
324426
  const ps2 = await execAsync2("ps cax");
324427
324427
  const openedBrowser = preferredOSXBrowser && ps2.includes(preferredOSXBrowser) ? preferredOSXBrowser : supportedChromiumBrowsers.find((b11) => ps2.includes(b11));
324428
324428
  if (openedBrowser) {
324429
- await execAsync2(`osascript openChrome.js "${url$3}" "${openedBrowser}"`, { cwd: join18(VITE_PACKAGE_DIR, "bin") });
324429
+ await execAsync2(`osascript openChrome.js "${url$3}" "${openedBrowser}"`, { cwd: join19(VITE_PACKAGE_DIR, "bin") });
324430
324430
  return true;
324431
324431
  }
324432
324432
  } catch {}
@@ -325124,7 +325124,7 @@ function viaLocal(dir2, isEtag, uri2, extns, shouldServe) {
325124
325124
  let i$1 = 0, arr = toAssume(uri2, extns);
325125
325125
  let abs2, stats, name17, headers;
325126
325126
  for (;i$1 < arr.length; i$1++) {
325127
- abs2 = normalize4(join18(dir2, name17 = arr[i$1]));
325127
+ abs2 = normalize4(join19(dir2, name17 = arr[i$1]));
325128
325128
  if (abs2.startsWith(dir2) && fs$1.existsSync(abs2)) {
325129
325129
  stats = fs$1.statSync(abs2);
325130
325130
  if (stats.isDirectory())
@@ -326951,7 +326951,7 @@ function notFoundMiddleware() {
326951
326951
  };
326952
326952
  }
326953
326953
  function hasWorkspacePackageJSON(root3) {
326954
- const path$13 = join18(root3, "package.json");
326954
+ const path$13 = join19(root3, "package.json");
326955
326955
  if (!isFileReadable(path$13))
326956
326956
  return false;
326957
326957
  try {
@@ -326961,10 +326961,10 @@ function hasWorkspacePackageJSON(root3) {
326961
326961
  }
326962
326962
  }
326963
326963
  function hasRootFile(root3) {
326964
- return ROOT_FILES.some((file8) => fs10.existsSync(join18(root3, file8)));
326964
+ return ROOT_FILES.some((file8) => fs10.existsSync(join19(root3, file8)));
326965
326965
  }
326966
326966
  function hasPackageJSON(root3) {
326967
- const path$13 = join18(root3, "package.json");
326967
+ const path$13 = join19(root3, "package.json");
326968
326968
  return fs10.existsSync(path$13);
326969
326969
  }
326970
326970
  function searchForPackageRoot(current2, root3 = current2) {
@@ -331421,7 +331421,7 @@ function ssrManifestPlugin() {
331421
331421
  chunk$1.imports.forEach(addDeps);
331422
331422
  }
331423
331423
  };
331424
- const normalizedFile = normalizePath5(join18(dirname8(chunk4.fileName), url$3.slice(1, -1)));
331424
+ const normalizedFile = normalizePath5(join19(dirname8(chunk4.fileName), url$3.slice(1, -1)));
331425
331425
  addDeps(normalizedFile);
331426
331426
  ssrManifest[basename5(name17)] = deps;
331427
331427
  }
@@ -336126,7 +336126,7 @@ ${e$1.message}`);
336126
336126
  await this._buildStartPromise;
336127
336127
  this._buildStartPromise = undefined;
336128
336128
  }
336129
- async resolveId(rawId, importer = join18(this.environment.config.root, "index.html"), options$1) {
336129
+ async resolveId(rawId, importer = join19(this.environment.config.root, "index.html"), options$1) {
336130
336130
  if (!this._started) {
336131
336131
  this.buildStart();
336132
336132
  await this._buildStartPromise;
@@ -343949,7 +343949,7 @@ Error: ${e$1.message}`);
343949
343949
  const NodeFsHandler = require_nodefs_handler();
343950
343950
  const FsEventsHandler = require_fsevents_handler();
343951
343951
  const { EV_ALL, EV_READY, EV_ADD, EV_CHANGE, EV_UNLINK, EV_ADD_DIR, EV_UNLINK_DIR, EV_RAW, EV_ERROR, STR_CLOSE, STR_END, BACK_SLASH_RE, DOUBLE_SLASH_RE, SLASH_OR_BACK_SLASH_RE, DOT_RE, REPLACER_RE, SLASH, SLASH_SLASH, BRACE_START, BANG, ONE_DOT, TWO_DOTS, GLOBSTAR: GLOBSTAR2, SLASH_GLOBSTAR, ANYMATCH_OPTS, STRING_TYPE, FUNCTION_TYPE, EMPTY_STR, EMPTY_FN, isWindows: isWindows$2, isMacos, isIBMi } = require_constants$1();
343952
- const stat4 = promisify$1(fs$6.stat);
343952
+ const stat5 = promisify$1(fs$6.stat);
343953
343953
  const readdir3 = promisify$1(fs$6.readdir);
343954
343954
  const arrify = (value$1 = []) => Array.isArray(value$1) ? value$1 : [value$1];
343955
343955
  const flatten22 = (list8, result2 = []) => {
@@ -344361,7 +344361,7 @@ Error: ${e$1.message}`);
344361
344361
  const fullPath = opts.cwd ? sysPath.join(opts.cwd, path$13) : path$13;
344362
344362
  let stats;
344363
344363
  try {
344364
- stats = await stat4(fullPath);
344364
+ stats = await stat5(fullPath);
344365
344365
  } catch (err$2) {}
344366
344366
  if (!stats || this.closed)
344367
344367
  return;
@@ -353445,15 +353445,15 @@ var require_windows2 = __commonJS((exports, module) => {
353445
353445
  }
353446
353446
  return false;
353447
353447
  }
353448
- function checkStat(stat4, path26, options6) {
353449
- if (!stat4.isSymbolicLink() && !stat4.isFile()) {
353448
+ function checkStat(stat5, path26, options6) {
353449
+ if (!stat5.isSymbolicLink() && !stat5.isFile()) {
353450
353450
  return false;
353451
353451
  }
353452
353452
  return checkPathExt(path26, options6);
353453
353453
  }
353454
353454
  function isexe(path26, options6, cb2) {
353455
- fs11.stat(path26, function(er3, stat4) {
353456
- cb2(er3, er3 ? false : checkStat(stat4, path26, options6));
353455
+ fs11.stat(path26, function(er3, stat5) {
353456
+ cb2(er3, er3 ? false : checkStat(stat5, path26, options6));
353457
353457
  });
353458
353458
  }
353459
353459
  function sync22(path26, options6) {
@@ -353467,20 +353467,20 @@ var require_mode2 = __commonJS((exports, module) => {
353467
353467
  isexe.sync = sync22;
353468
353468
  var fs11 = __require("fs");
353469
353469
  function isexe(path26, options6, cb2) {
353470
- fs11.stat(path26, function(er3, stat4) {
353471
- cb2(er3, er3 ? false : checkStat(stat4, options6));
353470
+ fs11.stat(path26, function(er3, stat5) {
353471
+ cb2(er3, er3 ? false : checkStat(stat5, options6));
353472
353472
  });
353473
353473
  }
353474
353474
  function sync22(path26, options6) {
353475
353475
  return checkStat(fs11.statSync(path26), options6);
353476
353476
  }
353477
- function checkStat(stat4, options6) {
353478
- return stat4.isFile() && checkMode(stat4, options6);
353477
+ function checkStat(stat5, options6) {
353478
+ return stat5.isFile() && checkMode(stat5, options6);
353479
353479
  }
353480
- function checkMode(stat4, options6) {
353481
- var mod2 = stat4.mode;
353482
- var uid = stat4.uid;
353483
- var gid = stat4.gid;
353480
+ function checkMode(stat5, options6) {
353481
+ var mod2 = stat5.mode;
353482
+ var uid = stat5.uid;
353483
+ var gid = stat5.gid;
353484
353484
  var myUid = options6.uid !== undefined ? options6.uid : process.getuid && process.getuid();
353485
353485
  var myGid = options6.gid !== undefined ? options6.gid : process.getgid && process.getgid();
353486
353486
  var u10 = parseInt("100", 8);
@@ -386888,7 +386888,10 @@ var Environment = exports_external2.object({
386888
386888
  mainBranch: exports_external2.string().describe("The main branch of the git repository."),
386889
386889
  currentBranch: exports_external2.string().describe("The current branch of the git repository."),
386890
386890
  status: exports_external2.string().describe("The status of the git repository."),
386891
- recentCommits: exports_external2.array(exports_external2.string()).describe("A list of recent git commits.")
386891
+ recentCommits: exports_external2.array(exports_external2.string()).describe("A list of recent git commits."),
386892
+ worktree: exports_external2.object({
386893
+ gitdir: exports_external2.string().describe("The gitdir path stored in worktree .git file.")
386894
+ }).optional()
386892
386895
  }).optional().describe("Git information for the current workspace."),
386893
386896
  terminals: exports_external2.array(exports_external2.object({
386894
386897
  name: exports_external2.string().describe("The name of the terminal."),
@@ -402450,6 +402453,7 @@ __export(exports_livestore, {
402450
402453
  });
402451
402454
 
402452
402455
  // ../../node_modules/@livestore/livestore/dist/mod.js
402456
+ init_dist2();
402453
402457
  init_mod8();
402454
402458
  init_effect();
402455
402459
 
@@ -404221,6 +404225,9 @@ var TaskError = exports_Schema2.Union(exports_Schema2.Struct({
404221
404225
  }));
404222
404226
  var Git = exports_Schema2.Struct({
404223
404227
  origin: exports_Schema2.optional(exports_Schema2.String),
404228
+ worktree: exports_Schema2.optional(exports_Schema2.Struct({
404229
+ gitdir: exports_Schema2.String
404230
+ })),
404224
404231
  branch: exports_Schema2.String
404225
404232
  });
404226
404233
  var tables = {
@@ -404290,20 +404297,50 @@ var tables = {
404290
404297
  }
404291
404298
  })
404292
404299
  };
404300
+ var taskInitFields = {
404301
+ id: exports_Schema2.String,
404302
+ parentId: exports_Schema2.optional(exports_Schema2.String),
404303
+ cwd: exports_Schema2.optional(exports_Schema2.String),
404304
+ createdAt: exports_Schema2.Date
404305
+ };
404306
+ var taskFullFields = {
404307
+ ...taskInitFields,
404308
+ git: exports_Schema2.optional(Git),
404309
+ shareId: exports_Schema2.optional(exports_Schema2.String),
404310
+ isPublicShared: exports_Schema2.Boolean,
404311
+ title: exports_Schema2.optional(exports_Schema2.String),
404312
+ status: TaskStatus,
404313
+ todos: Todos,
404314
+ totalTokens: exports_Schema2.optional(exports_Schema2.Number),
404315
+ error: exports_Schema2.optional(TaskError),
404316
+ updatedAt: exports_Schema2.Date
404317
+ };
404293
404318
  var events = {
404294
404319
  taskInited: exports_events.synced({
404295
404320
  name: "v1.TaskInited",
404296
404321
  schema: exports_Schema2.Struct({
404297
- id: exports_Schema2.String,
404298
- parentId: exports_Schema2.optional(exports_Schema2.String),
404299
- cwd: exports_Schema2.optional(exports_Schema2.String),
404300
- createdAt: exports_Schema2.Date,
404322
+ ...taskInitFields,
404301
404323
  initMessage: exports_Schema2.optional(exports_Schema2.Struct({
404302
404324
  id: exports_Schema2.String,
404303
404325
  parts: exports_Schema2.Array(DBUIPart)
404304
404326
  }))
404305
404327
  })
404306
404328
  }),
404329
+ taskFailed: exports_events.synced({
404330
+ name: "v1.TaskFailed",
404331
+ schema: exports_Schema2.Struct({
404332
+ id: exports_Schema2.String,
404333
+ error: TaskError,
404334
+ updatedAt: exports_Schema2.Date
404335
+ })
404336
+ }),
404337
+ taskSynced: exports_events.synced({
404338
+ name: "v1.TaskSynced",
404339
+ schema: exports_Schema2.Struct({
404340
+ ...taskFullFields,
404341
+ messages: exports_Schema2.Array(DBMessage)
404342
+ })
404343
+ }),
404307
404344
  chatStreamStarted: exports_events.synced({
404308
404345
  name: "v1.ChatStreamStarted",
404309
404346
  schema: exports_Schema2.Struct({
@@ -404390,6 +404427,22 @@ var materializers2 = exports_mod4.SQLite.materializers(events, {
404390
404427
  })
404391
404428
  ] : []
404392
404429
  ],
404430
+ "v1.TaskFailed": ({ id: id4, error: error42, updatedAt }) => [
404431
+ tables.tasks.update({
404432
+ status: "failed",
404433
+ error: error42,
404434
+ updatedAt
404435
+ }).where({ id: id4 })
404436
+ ],
404437
+ "v1.TaskSynced": ({ messages, ...task }) => [
404438
+ tables.tasks.insert(task).onConflict("id", "replace"),
404439
+ tables.messages.delete().where("taskId", "=", task.id),
404440
+ ...messages.map((message) => tables.messages.insert({
404441
+ id: message.id,
404442
+ taskId: task.id,
404443
+ data: message
404444
+ }).onConflict("id", "replace"))
404445
+ ],
404393
404446
  "v1.ChatStreamStarted": ({ id: id4, data, todos, git, title, updatedAt }) => [
404394
404447
  tables.tasks.update({
404395
404448
  status: "pending-model",
@@ -404464,7 +404517,10 @@ var makeMessagesQuery = (taskId) => queryDb(() => tables.messages.where("taskId"
404464
404517
  var tasks$ = queryDb(() => tables.tasks.where("parentId", "=", null).orderBy("createdAt", "desc"), {
404465
404518
  label: "tasks"
404466
404519
  });
404467
- var makeTasksQuery = (cwd) => queryDb(() => tables.tasks.where("parentId", "=", null).where("cwd", "=", cwd).orderBy("updatedAt", "desc"), {
404520
+ var makeTasksQuery = (cwd) => queryDb({
404521
+ query: sql`select * from tasks where parentId is null and (cwd = '${cwd}' or git->>'$.worktree.gitdir' like '${cwd}/.git/worktrees%') order by updatedAt desc`,
404522
+ schema: exports_Schema2.Array(tables.tasks.rowSchema)
404523
+ }, {
404468
404524
  label: "tasks.cwd",
404469
404525
  deps: [cwd]
404470
404526
  });
@@ -404618,7 +404674,7 @@ var {
404618
404674
  // package.json
404619
404675
  var package_default = {
404620
404676
  name: "@getpochi/cli",
404621
- version: "0.5.84",
404677
+ version: "0.5.85",
404622
404678
  type: "module",
404623
404679
  bin: {
404624
404680
  pochi: "src/cli.ts"
@@ -406485,6 +406541,8 @@ function getSystemInfo2(cwd) {
406485
406541
  }
406486
406542
  // ../common/src/tool-utils/git-status.ts
406487
406543
  import { exec as exec3 } from "node:child_process";
406544
+ import { readFile as readFile4, stat } from "node:fs/promises";
406545
+ import { join as join12 } from "node:path";
406488
406546
  import { promisify as promisify2 } from "node:util";
406489
406547
 
406490
406548
  // ../common/src/git-utils.ts
@@ -406639,7 +406697,9 @@ class GitStatusReader {
406639
406697
  status3,
406640
406698
  recentCommits,
406641
406699
  userName,
406642
- userEmail
406700
+ userEmail,
406701
+ worktreeGitdir,
406702
+ worktreeDir
406643
406703
  ] = await Promise.all([
406644
406704
  this.execGit("remote get-url origin").catch(() => {
406645
406705
  return;
@@ -406654,7 +406714,9 @@ class GitStatusReader {
406654
406714
  }),
406655
406715
  this.execGit("config user.email").catch(() => {
406656
406716
  return;
406657
- })
406717
+ }),
406718
+ parseWorktreeGitdir(this.cwd),
406719
+ this.execGit("rev-parse --path-format=absolute --show-toplevel").catch(() => "")
406658
406720
  ]);
406659
406721
  const origin = this.sanitizeOriginUrl(rawOrigin);
406660
406722
  return {
@@ -406664,7 +406726,8 @@ class GitStatusReader {
406664
406726
  status: status3,
406665
406727
  recentCommits,
406666
406728
  userName,
406667
- userEmail
406729
+ userEmail,
406730
+ worktree: this.cwd === worktreeDir && worktreeGitdir ? { gitdir: worktreeGitdir } : undefined
406668
406731
  };
406669
406732
  }
406670
406733
  async readGitStatus() {
@@ -406683,8 +406746,22 @@ class GitStatusReader {
406683
406746
  }
406684
406747
  }
406685
406748
  }
406749
+ async function parseWorktreeGitdir(cwd) {
406750
+ try {
406751
+ const gitFilePath = join12(cwd, ".git");
406752
+ const fileStat = await stat(gitFilePath);
406753
+ if (!fileStat.isFile()) {
406754
+ return;
406755
+ }
406756
+ const content = await readFile4(gitFilePath, "utf8");
406757
+ const match30 = content.trim().match(/^gitdir:\s*(.+)$/);
406758
+ return match30 ? match30[1] : undefined;
406759
+ } catch (error42) {
406760
+ return;
406761
+ }
406762
+ }
406686
406763
  // ../common/src/tool-utils/custom-rules.ts
406687
- import { readFile as readFile4 } from "node:fs/promises";
406764
+ import { readFile as readFile5 } from "node:fs/promises";
406688
406765
  import { homedir as homedir2 } from "node:os";
406689
406766
  import path8 from "node:path";
406690
406767
  var WorkspaceRulesFilePaths = ["README.pochi.md", "AGENTS.md"];
@@ -406721,7 +406798,7 @@ async function collectCustomRules(cwd, customRuleFiles = [], includeDefaultRules
406721
406798
  }));
406722
406799
  for (const rule of allRules) {
406723
406800
  try {
406724
- const content = await readFile4(rule.filePath, "utf-8");
406801
+ const content = await readFile5(rule.filePath, "utf-8");
406725
406802
  if (content.trim().length > 0) {
406726
406803
  rules += `# Rules from ${rule.label}
406727
406804
  ${content}
@@ -414906,7 +414983,7 @@ var handle = {
414906
414983
  };
414907
414984
 
414908
414985
  // ../../node_modules/mdast-util-to-markdown/lib/join.js
414909
- var join12 = [joinDefaults];
414986
+ var join13 = [joinDefaults];
414910
414987
  function joinDefaults(left3, right3, parent, state2) {
414911
414988
  if (right3.type === "code" && formatCodeAsIndented(right3, state2) && (left3.type === "list" || left3.type === right3.type && formatCodeAsIndented(left3, state2))) {
414912
414989
  return false;
@@ -415289,7 +415366,7 @@ function toMarkdown(tree, options4) {
415289
415366
  handle: undefined,
415290
415367
  indentLines,
415291
415368
  indexStack: [],
415292
- join: [...join12],
415369
+ join: [...join13],
415293
415370
  options: {},
415294
415371
  safe: safeBound,
415295
415372
  stack: [],
@@ -416581,7 +416658,8 @@ function mapStoreBlob(store, o6) {
416581
416658
  const blob3 = store.query(exports_livestore.queries.makeBlobQuery(url3.pathname));
416582
416659
  if (!blob3)
416583
416660
  throw new Error(`Store blob not found at "${url3.pathname}"`);
416584
- return Buffer.from(blob3.data).toString("base64");
416661
+ const base643 = Buffer.from(blob3.data).toString("base64");
416662
+ return `data:${blob3.mimeType};base64,${base643}`;
416585
416663
  }
416586
416664
  if (o5(o6)) {
416587
416665
  return o6.map((el) => mapStoreBlob(store, el));
@@ -419773,8 +419851,8 @@ async function Module2(moduleArg = {}) {
419773
419851
  throw new Error(`Invalid encoding type "${opts.encoding}"`);
419774
419852
  }
419775
419853
  var stream10 = FS.open(path12, opts.flags);
419776
- var stat = FS.stat(path12);
419777
- var length5 = stat.size;
419854
+ var stat2 = FS.stat(path12);
419855
+ var length5 = stat2.size;
419778
419856
  var buf = new Uint8Array(length5);
419779
419857
  FS.read(stream10, buf, 0, length5, 0);
419780
419858
  if (opts.encoding === "utf8") {
@@ -420179,26 +420257,26 @@ async function Module2(moduleArg = {}) {
420179
420257
  return dir2;
420180
420258
  }
420181
420259
  return dir2 + "/" + path12;
420182
- }, writeStat(buf, stat) {
420183
- HEAP32[buf >> 2] = stat.dev;
420184
- HEAP32[buf + 4 >> 2] = stat.mode;
420185
- HEAPU32[buf + 8 >> 2] = stat.nlink;
420186
- HEAP32[buf + 12 >> 2] = stat.uid;
420187
- HEAP32[buf + 16 >> 2] = stat.gid;
420188
- HEAP32[buf + 20 >> 2] = stat.rdev;
420189
- tempI64 = [stat.size >>> 0, (tempDouble = stat.size, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? +Math.floor(tempDouble / 4294967296) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0)], HEAP32[buf + 24 >> 2] = tempI64[0], HEAP32[buf + 28 >> 2] = tempI64[1];
420260
+ }, writeStat(buf, stat2) {
420261
+ HEAP32[buf >> 2] = stat2.dev;
420262
+ HEAP32[buf + 4 >> 2] = stat2.mode;
420263
+ HEAPU32[buf + 8 >> 2] = stat2.nlink;
420264
+ HEAP32[buf + 12 >> 2] = stat2.uid;
420265
+ HEAP32[buf + 16 >> 2] = stat2.gid;
420266
+ HEAP32[buf + 20 >> 2] = stat2.rdev;
420267
+ tempI64 = [stat2.size >>> 0, (tempDouble = stat2.size, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? +Math.floor(tempDouble / 4294967296) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0)], HEAP32[buf + 24 >> 2] = tempI64[0], HEAP32[buf + 28 >> 2] = tempI64[1];
420190
420268
  HEAP32[buf + 32 >> 2] = 4096;
420191
- HEAP32[buf + 36 >> 2] = stat.blocks;
420192
- var atime = stat.atime.getTime();
420193
- var mtime = stat.mtime.getTime();
420194
- var ctime = stat.ctime.getTime();
420269
+ HEAP32[buf + 36 >> 2] = stat2.blocks;
420270
+ var atime = stat2.atime.getTime();
420271
+ var mtime = stat2.mtime.getTime();
420272
+ var ctime = stat2.ctime.getTime();
420195
420273
  tempI64 = [Math.floor(atime / 1000) >>> 0, (tempDouble = Math.floor(atime / 1000), +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? +Math.floor(tempDouble / 4294967296) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0)], HEAP32[buf + 40 >> 2] = tempI64[0], HEAP32[buf + 44 >> 2] = tempI64[1];
420196
420274
  HEAPU32[buf + 48 >> 2] = atime % 1000 * 1000 * 1000;
420197
420275
  tempI64 = [Math.floor(mtime / 1000) >>> 0, (tempDouble = Math.floor(mtime / 1000), +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? +Math.floor(tempDouble / 4294967296) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0)], HEAP32[buf + 56 >> 2] = tempI64[0], HEAP32[buf + 60 >> 2] = tempI64[1];
420198
420276
  HEAPU32[buf + 64 >> 2] = mtime % 1000 * 1000 * 1000;
420199
420277
  tempI64 = [Math.floor(ctime / 1000) >>> 0, (tempDouble = Math.floor(ctime / 1000), +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? +Math.floor(tempDouble / 4294967296) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0)], HEAP32[buf + 72 >> 2] = tempI64[0], HEAP32[buf + 76 >> 2] = tempI64[1];
420200
420278
  HEAPU32[buf + 80 >> 2] = ctime % 1000 * 1000 * 1000;
420201
- tempI64 = [stat.ino >>> 0, (tempDouble = stat.ino, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? +Math.floor(tempDouble / 4294967296) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0)], HEAP32[buf + 88 >> 2] = tempI64[0], HEAP32[buf + 92 >> 2] = tempI64[1];
420279
+ tempI64 = [stat2.ino >>> 0, (tempDouble = stat2.ino, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? +Math.floor(tempDouble / 4294967296) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0)], HEAP32[buf + 88 >> 2] = tempI64[0], HEAP32[buf + 92 >> 2] = tempI64[1];
420202
420280
  return 0;
420203
420281
  }, writeStatFs(buf, stats) {
420204
420282
  HEAP32[buf + 4 >> 2] = stats.bsize;
@@ -431360,16 +431438,16 @@ function collectText(node3, info2) {
431360
431438
  start6 = end6 + 1;
431361
431439
  }
431362
431440
  let index3 = -1;
431363
- let join19;
431441
+ let join20;
431364
431442
  while (++index3 < lines3.length) {
431365
431443
  if (lines3[index3].charCodeAt(lines3[index3].length - 1) === 8203 || index3 < lines3.length - 1 && lines3[index3 + 1].charCodeAt(0) === 8203) {
431366
431444
  result2.push(lines3[index3]);
431367
- join19 = undefined;
431445
+ join20 = undefined;
431368
431446
  } else if (lines3[index3]) {
431369
- if (typeof join19 === "number")
431370
- result2.push(join19);
431447
+ if (typeof join20 === "number")
431448
+ result2.push(join20);
431371
431449
  result2.push(lines3[index3]);
431372
- join19 = 0;
431450
+ join20 = 0;
431373
431451
  } else if (index3 === 0 || index3 === lines3.length - 1) {
431374
431452
  result2.push(0);
431375
431453
  }
@@ -444371,6 +444449,15 @@ function toTaskError(error46) {
444371
444449
  }
444372
444450
  return internalError(error46.message);
444373
444451
  }
444452
+ var toTaskGitInfo = (gitStatus) => {
444453
+ if (!gitStatus)
444454
+ return;
444455
+ return {
444456
+ origin: gitStatus.origin,
444457
+ branch: gitStatus.currentBranch,
444458
+ worktree: gitStatus.worktree
444459
+ };
444460
+ };
444374
444461
 
444375
444462
  // ../livekit/src/chat/llm/generate-task-title.ts
444376
444463
  var logger18 = getLogger("generateTaskTitle");
@@ -446000,6 +446087,13 @@ class LiveChatKit {
446000
446087
  updatedAt: new Date
446001
446088
  }));
446002
446089
  };
446090
+ markAsFailed = (error46) => {
446091
+ this.store.commit(events.taskFailed({
446092
+ id: this.taskId,
446093
+ error: toTaskError(error46),
446094
+ updatedAt: new Date
446095
+ }));
446096
+ };
446003
446097
  onStart = async ({
446004
446098
  messages: messages2,
446005
446099
  environment: environment2,
@@ -446026,15 +446120,11 @@ class LiveChatKit {
446026
446120
  messages: messages2,
446027
446121
  getModel
446028
446122
  });
446029
- const { gitStatus } = environment2?.workspace || {};
446030
446123
  store.commit(events.chatStreamStarted({
446031
446124
  id: this.taskId,
446032
446125
  data: lastMessage,
446033
446126
  todos: environment2?.todos || [],
446034
- git: gitStatus ? {
446035
- origin: gitStatus.origin,
446036
- branch: gitStatus.currentBranch
446037
- } : undefined,
446127
+ git: toTaskGitInfo(environment2?.workspace.gitStatus),
446038
446128
  updatedAt: new Date
446039
446129
  }));
446040
446130
  }
@@ -446111,6 +446201,24 @@ function stepToString(stepInfo) {
446111
446201
  return `Round ${stepInfo.step}`;
446112
446202
  }
446113
446203
 
446204
+ class MaxRoundReachedError extends Error {
446205
+ maxRounds;
446206
+ constructor(maxRounds) {
446207
+ super(`Task aborted: maximum number of rounds reached (${maxRounds}).`);
446208
+ this.maxRounds = maxRounds;
446209
+ this.name = "AbortError";
446210
+ }
446211
+ }
446212
+
446213
+ class MaxRetryReachedError extends Error {
446214
+ maxRetries;
446215
+ constructor(maxRetries) {
446216
+ super(`Task aborted: maximum number of retries reached (${maxRetries}).`);
446217
+ this.maxRetries = maxRetries;
446218
+ this.name = "AbortError";
446219
+ }
446220
+ }
446221
+
446114
446222
  class StepCount {
446115
446223
  maxSteps;
446116
446224
  maxRetries;
@@ -446129,7 +446237,7 @@ class StepCount {
446129
446237
  }
446130
446238
  throwIfReachedMaxSteps() {
446131
446239
  if (this.step >= this.maxSteps) {
446132
- throw new Error(`Reached max rounds (${this.maxSteps}).`);
446240
+ throw new MaxRoundReachedError(this.maxSteps);
446133
446241
  }
446134
446242
  }
446135
446243
  nextStep() {
@@ -446139,7 +446247,7 @@ class StepCount {
446139
446247
  }
446140
446248
  throwIfReachedMaxRetries() {
446141
446249
  if (this.retry >= this.maxRetries) {
446142
- throw new Error(`Reached max retries (${this.maxRetries}).`);
446250
+ throw new MaxRetryReachedError(this.maxRetries);
446143
446251
  }
446144
446252
  }
446145
446253
  nextRetry() {
@@ -446614,7 +446722,7 @@ var newTask = (options6) => async ({ _meta, agentType }) => {
446614
446722
 
446615
446723
  // src/tools/read-file.ts
446616
446724
  import * as fs15 from "node:fs/promises";
446617
- var readFile14 = () => async ({ path: path28, startLine, endLine }, { cwd: cwd2 }) => {
446725
+ var readFile15 = () => async ({ path: path28, startLine, endLine }, { cwd: cwd2 }) => {
446618
446726
  const resolvedPath = resolvePath(path28, cwd2);
446619
446727
  const fileBuffer = await fs15.readFile(resolvedPath);
446620
446728
  validateTextFile(fileBuffer);
@@ -446662,7 +446770,7 @@ var writeToFile2 = () => async ({ path: path28, content: content3 }, { cwd: cwd2
446662
446770
 
446663
446771
  // src/tools/index.ts
446664
446772
  var ToolMap = {
446665
- readFile: readFile14,
446773
+ readFile: readFile15,
446666
446774
  applyDiff: applyDiff2,
446667
446775
  editNotebook: editNotebook2,
446668
446776
  globFiles: globFiles3,
@@ -446809,6 +446917,7 @@ class TaskRunner {
446809
446917
  } catch (e10) {
446810
446918
  const error46 = toError2(e10);
446811
446919
  logger26.trace("Failed:", error46);
446920
+ this.chatKit.markAsFailed(error46);
446812
446921
  }
446813
446922
  }
446814
446923
  async step() {
@@ -446937,7 +447046,7 @@ import {
446937
447046
  statSync as statSync3
446938
447047
  } from "node:fs";
446939
447048
  import { homedir as homedir6, tmpdir as tmpdir3 } from "node:os";
446940
- import { extname as extname5, join as join21 } from "node:path";
447049
+ import { extname as extname5, join as join22 } from "node:path";
446941
447050
 
446942
447051
  // src/upgrade/platform-utils.ts
446943
447052
  function getPlatformName() {
@@ -447000,8 +447109,8 @@ function extractVersionFromTag(tag9) {
447000
447109
 
447001
447110
  // src/upgrade/binary-installer.ts
447002
447111
  function getPochiDir() {
447003
- const pochiDir = join21(homedir6(), ".pochi");
447004
- const binDir = join21(pochiDir, "bin");
447112
+ const pochiDir = join22(homedir6(), ".pochi");
447113
+ const binDir = join22(pochiDir, "bin");
447005
447114
  if (!existsSync7(pochiDir)) {
447006
447115
  mkdirSync(pochiDir, { recursive: true });
447007
447116
  }
@@ -447015,7 +447124,7 @@ function findExecutableInDirectory(dir2) {
447015
447124
  const files = [];
447016
447125
  const entries4 = readdirSync2(currentDir, { withFileTypes: true });
447017
447126
  for (const entry of entries4) {
447018
- const fullPath = join21(currentDir, entry.name);
447127
+ const fullPath = join22(currentDir, entry.name);
447019
447128
  if (entry.isDirectory()) {
447020
447129
  files.push(...searchRecursively(fullPath));
447021
447130
  } else if (entry.isFile()) {
@@ -447079,11 +447188,11 @@ async function downloadAndInstall(program5, release3) {
447079
447188
  const version5 = extractVersionFromTag(release3.tag_name);
447080
447189
  const binDir = getPochiDir();
447081
447190
  const latestBinaryName = getLatestBinaryFileName();
447082
- const latestBinaryPath = join21(binDir, latestBinaryName);
447191
+ const latestBinaryPath = join22(binDir, latestBinaryName);
447083
447192
  console.log(`⚙️ Installing to: ${latestBinaryPath}`);
447084
- const tempDir = join21(tmpdir3(), `pochi-upgrade-${Date.now()}`);
447193
+ const tempDir = join22(tmpdir3(), `pochi-upgrade-${Date.now()}`);
447085
447194
  mkdirSync(tempDir, { recursive: true });
447086
- const archivePath = join21(tempDir, asset.name);
447195
+ const archivePath = join22(tempDir, asset.name);
447087
447196
  console.log("\uD83D\uDD04 Downloading with progress...");
447088
447197
  try {
447089
447198
  execSync3(`curl -L --progress-bar "${asset.browser_download_url}" -o "${archivePath}"`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpochi/cli",
3
- "version": "0.5.84",
3
+ "version": "0.5.85",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "pochi": "dist/cli.js"