@codions/portta 0.0.0-develop.162.sha-7b40859 → 0.0.0-develop.169.sha-64ee68c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/host.js CHANGED
@@ -33142,7 +33142,7 @@ var require_compile = __commonJS({
33142
33142
  const schOrFunc = root.refs[ref];
33143
33143
  if (schOrFunc)
33144
33144
  return schOrFunc;
33145
- let _sch = resolve21.call(this, root, ref);
33145
+ let _sch = resolve22.call(this, root, ref);
33146
33146
  if (_sch === void 0) {
33147
33147
  const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
33148
33148
  const { schemaId } = this.opts;
@@ -33169,7 +33169,7 @@ var require_compile = __commonJS({
33169
33169
  function sameSchemaEnv(s1, s2) {
33170
33170
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
33171
33171
  }
33172
- function resolve21(root, ref) {
33172
+ function resolve22(root, ref) {
33173
33173
  let sch;
33174
33174
  while (typeof (sch = this.refs[ref]) == "string")
33175
33175
  ref = sch;
@@ -33994,7 +33994,7 @@ var require_fast_uri = __commonJS({
33994
33994
  }
33995
33995
  return uri;
33996
33996
  }
33997
- function resolve21(baseURI, relativeURI, options) {
33997
+ function resolve22(baseURI, relativeURI, options) {
33998
33998
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
33999
33999
  const {
34000
34000
  parsed: baseParsed,
@@ -34027,49 +34027,49 @@ var require_fast_uri = __commonJS({
34027
34027
  schemelessOptions.skipEscape = true;
34028
34028
  return serialize2(resolved2, schemelessOptions);
34029
34029
  }
34030
- function resolveComponent(base, relative5, options, skipNormalization) {
34030
+ function resolveComponent(base, relative6, options, skipNormalization) {
34031
34031
  const target = {};
34032
34032
  if (!skipNormalization) {
34033
34033
  base = parse4(serialize2(base, options), options);
34034
- relative5 = parse4(serialize2(relative5, options), options);
34034
+ relative6 = parse4(serialize2(relative6, options), options);
34035
34035
  }
34036
34036
  options = options || {};
34037
- if (!options.tolerant && relative5.scheme) {
34038
- target.scheme = relative5.scheme;
34039
- target.userinfo = relative5.userinfo;
34040
- target.host = relative5.host;
34041
- target.port = relative5.port;
34042
- target.path = removeDotSegments(relative5.path || "");
34043
- target.query = relative5.query;
34037
+ if (!options.tolerant && relative6.scheme) {
34038
+ target.scheme = relative6.scheme;
34039
+ target.userinfo = relative6.userinfo;
34040
+ target.host = relative6.host;
34041
+ target.port = relative6.port;
34042
+ target.path = removeDotSegments(relative6.path || "");
34043
+ target.query = relative6.query;
34044
34044
  } else {
34045
- if (relative5.userinfo !== void 0 || relative5.host !== void 0 || relative5.port !== void 0) {
34046
- target.userinfo = relative5.userinfo;
34047
- target.host = relative5.host;
34048
- target.port = relative5.port;
34049
- target.path = removeDotSegments(relative5.path || "");
34050
- target.query = relative5.query;
34045
+ if (relative6.userinfo !== void 0 || relative6.host !== void 0 || relative6.port !== void 0) {
34046
+ target.userinfo = relative6.userinfo;
34047
+ target.host = relative6.host;
34048
+ target.port = relative6.port;
34049
+ target.path = removeDotSegments(relative6.path || "");
34050
+ target.query = relative6.query;
34051
34051
  } else {
34052
- if (!relative5.path) {
34052
+ if (!relative6.path) {
34053
34053
  target.path = base.path;
34054
- if (relative5.query !== void 0) {
34055
- target.query = relative5.query;
34054
+ if (relative6.query !== void 0) {
34055
+ target.query = relative6.query;
34056
34056
  } else {
34057
34057
  target.query = base.query;
34058
34058
  }
34059
34059
  } else {
34060
- if (relative5.path[0] === "/") {
34061
- target.path = removeDotSegments(relative5.path);
34060
+ if (relative6.path[0] === "/") {
34061
+ target.path = removeDotSegments(relative6.path);
34062
34062
  } else {
34063
34063
  if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
34064
- target.path = "/" + relative5.path;
34064
+ target.path = "/" + relative6.path;
34065
34065
  } else if (!base.path) {
34066
- target.path = relative5.path;
34066
+ target.path = relative6.path;
34067
34067
  } else {
34068
- target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative5.path;
34068
+ target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative6.path;
34069
34069
  }
34070
34070
  target.path = removeDotSegments(target.path);
34071
34071
  }
34072
- target.query = relative5.query;
34072
+ target.query = relative6.query;
34073
34073
  }
34074
34074
  target.userinfo = base.userinfo;
34075
34075
  target.host = base.host;
@@ -34077,7 +34077,7 @@ var require_fast_uri = __commonJS({
34077
34077
  }
34078
34078
  target.scheme = base.scheme;
34079
34079
  }
34080
- target.fragment = relative5.fragment;
34080
+ target.fragment = relative6.fragment;
34081
34081
  return target;
34082
34082
  }
34083
34083
  function equal(uriA, uriB, options) {
@@ -34356,7 +34356,7 @@ var require_fast_uri = __commonJS({
34356
34356
  var fastUri = {
34357
34357
  SCHEMES,
34358
34358
  normalize: normalize2,
34359
- resolve: resolve21,
34359
+ resolve: resolve22,
34360
34360
  resolveComponent,
34361
34361
  equal,
34362
34362
  serialize: serialize2,
@@ -41506,10 +41506,9 @@ function expandTemplate(template, env2) {
41506
41506
 
41507
41507
  // ../host/src/modules/taskflow/adapters/devcontainer-environment.ts
41508
41508
  import { createHash as createHash3 } from "node:crypto";
41509
- import { readFileSync as readFileSync3 } from "node:fs";
41510
- import { access, readdir, readFile } from "node:fs/promises";
41509
+ import { access as access2, readdir, readFile as readFile2 } from "node:fs/promises";
41511
41510
  import { createRequire } from "node:module";
41512
- import { dirname as dirname4, isAbsolute as isAbsolute2, join as join4, posix, relative, resolve as resolve2, sep } from "node:path";
41511
+ import { dirname as dirname4, join as join5, relative as relative2, resolve as resolve3 } from "node:path";
41513
41512
 
41514
41513
  // ../../node_modules/zod/v4/classic/external.js
41515
41514
  var external_exports = {};
@@ -44775,16 +44774,16 @@ function hostToolInvocation(tool, options) {
44775
44774
  return /[\s'"\\]/.test(resolved2) ? `'${resolved2.replaceAll("'", "'\\''")}'` : resolved2;
44776
44775
  }
44777
44776
  function resolveWorkerBins(env2 = process.env) {
44778
- const resolve21 = (name, override) => {
44777
+ const resolve22 = (name, override) => {
44779
44778
  const explicit = override?.trim();
44780
44779
  if (explicit) return resolveHostTool(explicit, { env: env2 }) ?? explicit;
44781
44780
  return resolveHostTool(name, { env: env2 }) ?? void 0;
44782
44781
  };
44783
44782
  return {
44784
- codexBin: resolve21("codex", env2.CODEX_BIN),
44785
- opencodeBin: resolve21("opencode", env2.OPENCODE_BIN),
44786
- pathToClaudeCodeExecutable: resolve21("claude"),
44787
- piBin: resolve21("pi", env2.PI_BIN)
44783
+ codexBin: resolve22("codex", env2.CODEX_BIN),
44784
+ opencodeBin: resolve22("opencode", env2.OPENCODE_BIN),
44785
+ pathToClaudeCodeExecutable: resolve22("claude"),
44786
+ piBin: resolve22("pi", env2.PI_BIN)
44788
44787
  };
44789
44788
  }
44790
44789
 
@@ -44822,10 +44821,10 @@ function webStream(stream) {
44822
44821
  };
44823
44822
  }
44824
44823
  function writeToStdin(stream, input2) {
44825
- return new Promise((resolve21, reject2) => {
44824
+ return new Promise((resolve22, reject2) => {
44826
44825
  stream.write(input2, (error61) => {
44827
44826
  if (error61) reject2(error61);
44828
- else resolve21();
44827
+ else resolve22();
44829
44828
  });
44830
44829
  });
44831
44830
  }
@@ -44847,8 +44846,8 @@ var NodeProcessRunner = class {
44847
44846
  let settled = false;
44848
44847
  let resolveExit = () => {
44849
44848
  };
44850
- const exited = new Promise((resolve21) => {
44851
- resolveExit = resolve21;
44849
+ const exited = new Promise((resolve22) => {
44850
+ resolveExit = resolve22;
44852
44851
  });
44853
44852
  const finish = (code, signal, closeOutputs = false) => {
44854
44853
  if (settled) return;
@@ -44926,6 +44925,177 @@ async function runCaptured(runner, spec) {
44926
44925
  return { stdout, stderr, exit };
44927
44926
  }
44928
44927
 
44928
+ // ../host/src/modules/taskflow/adapters/worktree-git-mount.ts
44929
+ import { access, readFile, realpath, rename, unlink, writeFile as writeFile2 } from "node:fs/promises";
44930
+ import { basename as basename2, isAbsolute as isAbsolute2, join as join4, posix, relative, resolve as resolve2, sep } from "node:path";
44931
+ var PREFLIGHT = "Dev Container preflight";
44932
+ var BACK_LINK = "gitdir";
44933
+ function repairCommand(workspacePath) {
44934
+ return `git -C ${workspacePath} worktree repair --relative-paths`;
44935
+ }
44936
+ function toPosix(value) {
44937
+ return sep === "/" ? value : value.replaceAll(sep, "/");
44938
+ }
44939
+ async function exists(path) {
44940
+ try {
44941
+ await access(path);
44942
+ return true;
44943
+ } catch {
44944
+ return false;
44945
+ }
44946
+ }
44947
+ async function readRaw(path) {
44948
+ try {
44949
+ return await readFile(path, "utf8");
44950
+ } catch {
44951
+ return null;
44952
+ }
44953
+ }
44954
+ async function writeAtomic(path, content) {
44955
+ const temporary = `${path}.${process.pid}.${Date.now()}.tmp`;
44956
+ try {
44957
+ await writeFile2(temporary, content, "utf8");
44958
+ await rename(temporary, path);
44959
+ } catch (error61) {
44960
+ await unlink(temporary).catch(() => {
44961
+ });
44962
+ throw error61;
44963
+ }
44964
+ }
44965
+ async function gitDirs(runner, cwd) {
44966
+ const result = await runCaptured(runner, {
44967
+ command: "git",
44968
+ args: ["rev-parse", "--path-format=absolute", "--git-dir", "--git-common-dir"],
44969
+ cwd
44970
+ });
44971
+ if (result.exit.code !== 0) return null;
44972
+ const [gitDir, commonDir] = result.stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
44973
+ return gitDir && commonDir ? { gitDir, commonDir } : null;
44974
+ }
44975
+ function linkTarget(content) {
44976
+ const value = content.trim();
44977
+ if (!value.startsWith("gitdir:")) return null;
44978
+ const target = value.slice("gitdir:".length).trim();
44979
+ return target.length > 0 ? target : null;
44980
+ }
44981
+ async function worktreeLink(workspacePath) {
44982
+ const content = await readRaw(join4(workspacePath, ".git"));
44983
+ return content === null ? null : linkTarget(content);
44984
+ }
44985
+ async function porttaOwned(runner, workspacePath, gitDir) {
44986
+ if (await exists(gitRuntimePaths(gitDir).meta)) return true;
44987
+ const result = await runCaptured(runner, {
44988
+ command: "git",
44989
+ args: ["config", "--get", RUNTIME_IDENTITY.gitBaseConfigKey],
44990
+ cwd: workspacePath
44991
+ });
44992
+ return result.exit.code === 0 && result.stdout.trim().length > 0;
44993
+ }
44994
+ async function planRelativeRelink(workspacePath, dirs) {
44995
+ const forwardPath = join4(workspacePath, ".git");
44996
+ const backPath = join4(dirs.gitDir, BACK_LINK);
44997
+ if (join4(dirs.commonDir, "worktrees", basename2(dirs.gitDir)) !== dirs.gitDir)
44998
+ return {
44999
+ ok: false,
45000
+ reason: `its Git dir ${dirs.gitDir} is not <common dir>/worktrees/<id> under ${dirs.commonDir}`
45001
+ };
45002
+ const forward = await readRaw(forwardPath);
45003
+ if (forward === null) return { ok: false, reason: `${forwardPath} could not be read` };
45004
+ const target = linkTarget(forward);
45005
+ if (target === null) return { ok: false, reason: `${forwardPath} does not record a gitdir link` };
45006
+ if (resolve2(workspacePath, target) !== dirs.gitDir)
45007
+ return { ok: false, reason: `${forwardPath} points at ${resolve2(workspacePath, target)}, not at ${dirs.gitDir}` };
45008
+ const back = await readRaw(backPath);
45009
+ if (back === null) return { ok: false, reason: `${backPath} could not be read` };
45010
+ if (resolve2(dirs.gitDir, back.trim()) !== forwardPath)
45011
+ return { ok: false, reason: `${backPath} points at ${resolve2(dirs.gitDir, back.trim())}, not at ${forwardPath}` };
45012
+ return {
45013
+ ok: true,
45014
+ writes: [
45015
+ { path: forwardPath, previous: forward, next: `gitdir: ${toPosix(relative(workspacePath, dirs.gitDir))}
45016
+ ` },
45017
+ { path: backPath, previous: back, next: `${toPosix(relative(dirs.gitDir, forwardPath))}
45018
+ ` }
45019
+ ]
45020
+ };
45021
+ }
45022
+ async function relinkRelative(runner, workspacePath, dirs) {
45023
+ const plan = await planRelativeRelink(workspacePath, dirs);
45024
+ if (!plan.ok) return plan.reason;
45025
+ const written = [];
45026
+ const restore = async () => {
45027
+ for (const write2 of written) await writeAtomic(write2.path, write2.previous).catch(() => {
45028
+ });
45029
+ };
45030
+ for (const write2 of plan.writes) {
45031
+ try {
45032
+ await writeAtomic(write2.path, write2.next);
45033
+ written.push(write2);
45034
+ } catch (error61) {
45035
+ await restore();
45036
+ return `${write2.path} could not be rewritten: ${error61 instanceof Error ? error61.message : String(error61)}`;
45037
+ }
45038
+ }
45039
+ const after = await gitDirs(runner, workspacePath);
45040
+ if (!after || after.gitDir !== dirs.gitDir || after.commonDir !== dirs.commonDir) {
45041
+ await restore();
45042
+ return "the rewritten links did not resolve back to the same repository, so they were reverted";
45043
+ }
45044
+ return null;
45045
+ }
45046
+ async function worktreeGitMountArgs(input2) {
45047
+ const { runner } = input2;
45048
+ const workspacePath = await realpath(input2.workspacePath).catch(() => input2.workspacePath);
45049
+ const dirs = await gitDirs(runner, workspacePath);
45050
+ if (!dirs || dirs.gitDir === dirs.commonDir) return [];
45051
+ const where = input2.configRef ? `${workspacePath} (${input2.configRef})` : workspacePath;
45052
+ if (input2.workspaceMount) {
45053
+ throw new Error(
45054
+ `${PREFLIGHT}: ${where} is a linked Git worktree and the configuration sets a custom workspaceMount. The Dev Containers CLI then ignores --mount-git-worktree-common-dir (devcontainers/cli#1243), so the Git common dir cannot be mounted and Git would not work inside the container. Remove workspaceMount from the Dev Container configuration, or open this configuration from the main checkout.`
45055
+ );
45056
+ }
45057
+ let link = await worktreeLink(workspacePath);
45058
+ const backLink = await readRaw(join4(dirs.gitDir, BACK_LINK));
45059
+ if (link !== null && isAbsolute2(link) || backLink !== null && isAbsolute2(backLink.trim())) {
45060
+ if (!await porttaOwned(runner, workspacePath, dirs.gitDir)) {
45061
+ throw new Error(
45062
+ `${PREFLIGHT}: the Git worktree at ${where} is linked with an absolute gitdir, which does not exist inside a container. Portta did not create this worktree and will not rewrite its links. Migrate it explicitly with: ${repairCommand(workspacePath)}`
45063
+ );
45064
+ }
45065
+ const failure = await relinkRelative(runner, workspacePath, dirs);
45066
+ if (failure !== null) {
45067
+ throw new Error(
45068
+ `${PREFLIGHT}: the Git worktree at ${where} is linked with an absolute gitdir and could not be migrated to relative links: ${failure}. Run: ${repairCommand(workspacePath)}`
45069
+ );
45070
+ }
45071
+ link = await worktreeLink(workspacePath);
45072
+ }
45073
+ if (link === null || isAbsolute2(link)) {
45074
+ throw new Error(
45075
+ `${PREFLIGHT}: the Git worktree at ${where} has no relative gitdir link, so the Git common dir cannot be mounted into the container. Run: ${repairCommand(workspacePath)}`
45076
+ );
45077
+ }
45078
+ const containerWorkspacePath = input2.containerWorkspacePath;
45079
+ if (!containerWorkspacePath) {
45080
+ throw new Error(
45081
+ `${PREFLIGHT}: the container workspace folder for ${where} is unknown, so the Git common dir of this linked worktree cannot be mounted into the container.`
45082
+ );
45083
+ }
45084
+ const up = toPosix(relative(dirs.gitDir, dirs.commonDir));
45085
+ if (up.length === 0 || up.split("/").some((segment) => segment !== "..")) {
45086
+ throw new Error(
45087
+ `${PREFLIGHT}: the Git common dir ${dirs.commonDir} does not contain the worktree Git dir ${dirs.gitDir}, so it cannot be mapped into the container for ${where}.`
45088
+ );
45089
+ }
45090
+ const containerGitDir = posix.resolve(containerWorkspacePath, toPosix(link));
45091
+ const containerCommonDir = posix.resolve(containerGitDir, up);
45092
+ return [
45093
+ "--mount-git-worktree-common-dir",
45094
+ "--mount",
45095
+ `type=bind,source=${dirs.commonDir},target=${containerCommonDir}`
45096
+ ];
45097
+ }
45098
+
44929
45099
  // ../host/src/modules/taskflow/adapters/devcontainer-environment.ts
44930
45100
  var cliOutputSchema = external_exports.object({
44931
45101
  containerId: external_exports.string(),
@@ -44947,47 +45117,26 @@ function hash2(value) {
44947
45117
  function quoteShell(value) {
44948
45118
  return `'${value.replaceAll("'", "'\\''")}'`;
44949
45119
  }
44950
- function relativeWorktreeGitDir(workspacePath) {
45120
+ async function exists2(path) {
44951
45121
  try {
44952
- const value = readFileSync3(join4(workspacePath, ".git"), "utf8").trim();
44953
- const gitDir = value.startsWith("gitdir: ") ? value.slice("gitdir: ".length).trim() : "";
44954
- return gitDir.length > 0 && !isAbsolute2(gitDir) ? gitDir : null;
44955
- } catch {
44956
- return null;
44957
- }
44958
- }
44959
- function commonGitDir(path, separator) {
44960
- const marker = `${separator}worktrees${separator}`;
44961
- const index = path.lastIndexOf(marker);
44962
- return index > 0 ? path.slice(0, index) : null;
44963
- }
44964
- function worktreeGitMount(workspacePath, containerWorkspacePath) {
44965
- const gitDir = relativeWorktreeGitDir(workspacePath);
44966
- if (!gitDir || !containerWorkspacePath) return null;
44967
- const source = commonGitDir(resolve2(workspacePath, gitDir), sep);
44968
- const target = commonGitDir(posix.resolve(containerWorkspacePath, gitDir.replaceAll(sep, "/")), "/");
44969
- return source && target ? `type=bind,source=${source},target=${target}` : null;
44970
- }
44971
- async function exists(path) {
44972
- try {
44973
- await access(path);
45122
+ await access2(path);
44974
45123
  return true;
44975
45124
  } catch {
44976
45125
  return false;
44977
45126
  }
44978
45127
  }
44979
45128
  async function findDevcontainerConfigs(workspacePath) {
44980
- const rootConfig = join4(workspacePath, ".devcontainer.json");
44981
- const directory = join4(workspacePath, ".devcontainer");
45129
+ const rootConfig = join5(workspacePath, ".devcontainer.json");
45130
+ const directory = join5(workspacePath, ".devcontainer");
44982
45131
  const configs = [];
44983
- if (await exists(rootConfig)) configs.push(rootConfig);
44984
- if (await exists(join4(directory, "devcontainer.json"))) configs.push(join4(directory, "devcontainer.json"));
44985
- if (await exists(directory)) {
45132
+ if (await exists2(rootConfig)) configs.push(rootConfig);
45133
+ if (await exists2(join5(directory, "devcontainer.json"))) configs.push(join5(directory, "devcontainer.json"));
45134
+ if (await exists2(directory)) {
44986
45135
  const entries = await readdir(directory, { withFileTypes: true });
44987
45136
  for (const entry of entries) {
44988
45137
  if (!entry.isDirectory()) continue;
44989
- const candidate = join4(directory, entry.name, "devcontainer.json");
44990
- if (await exists(candidate)) configs.push(candidate);
45138
+ const candidate = join5(directory, entry.name, "devcontainer.json");
45139
+ if (await exists2(candidate)) configs.push(candidate);
44991
45140
  }
44992
45141
  }
44993
45142
  return [...new Set(configs)].sort();
@@ -45082,7 +45231,7 @@ async function resolveComposeConfiguration(runner, config2, merged) {
45082
45231
  if (files.length === 0) return { hashMaterial: "", risks: [] };
45083
45232
  const args = [
45084
45233
  "compose",
45085
- ...files.flatMap((file2) => ["-f", resolve2(dirname4(config2), file2)]),
45234
+ ...files.flatMap((file2) => ["-f", resolve3(dirname4(config2), file2)]),
45086
45235
  "config",
45087
45236
  "--format",
45088
45237
  "json"
@@ -45106,6 +45255,7 @@ var DevContainerProvider = class {
45106
45255
  cli;
45107
45256
  cliPrefix;
45108
45257
  workspaceFolders = /* @__PURE__ */ new Map();
45258
+ workspaceMounts = /* @__PURE__ */ new Map();
45109
45259
  runner;
45110
45260
  constructor(runner = new NodeProcessRunner(), cli) {
45111
45261
  this.runner = runner;
@@ -45116,7 +45266,7 @@ var DevContainerProvider = class {
45116
45266
  }
45117
45267
  const packagePath = createRequire(import.meta.url).resolve("@devcontainers/cli/package.json");
45118
45268
  this.cli = process.execPath;
45119
- this.cliPrefix = [join4(dirname4(packagePath), "devcontainer.js")];
45269
+ this.cliPrefix = [join5(dirname4(packagePath), "devcontainer.js")];
45120
45270
  }
45121
45271
  args(args) {
45122
45272
  return [...this.cliPrefix, ...args];
@@ -45138,7 +45288,7 @@ var DevContainerProvider = class {
45138
45288
  return {
45139
45289
  provider: this.id,
45140
45290
  available: version2.supported,
45141
- configRefs: configs.map((config2) => relative(context.workspacePath, config2)),
45291
+ configRefs: configs.map((config2) => relative2(context.workspacePath, config2)),
45142
45292
  ...version2.version ? { version: version2.version } : {},
45143
45293
  diagnostics: version2.diagnostic ? [version2.diagnostic] : []
45144
45294
  };
@@ -45146,7 +45296,7 @@ var DevContainerProvider = class {
45146
45296
  async configFor(context) {
45147
45297
  const configs = await findDevcontainerConfigs(context.workspacePath);
45148
45298
  if (context.configRef) {
45149
- const selected2 = resolve2(context.workspacePath, context.configRef);
45299
+ const selected2 = resolve3(context.workspacePath, context.configRef);
45150
45300
  if (!configs.includes(selected2)) throw new Error(`Dev Container config was not found: ${context.configRef}`);
45151
45301
  return selected2;
45152
45302
  }
@@ -45176,16 +45326,19 @@ var DevContainerProvider = class {
45176
45326
  });
45177
45327
  if (result.exit.code !== 0) throw new Error(`devcontainer read-configuration failed: ${result.stderr.trim()}`);
45178
45328
  const raw2 = readOutputSchema.parse(JSON.parse(result.stdout));
45179
- const rawConfig = await readFile(config2, "utf8");
45329
+ const rawConfig = await readFile2(config2, "utf8");
45180
45330
  const merged = record2(raw2.mergedConfiguration ?? raw2.configuration);
45181
45331
  if (typeof merged.workspaceFolder === "string") this.workspaceFolders.set(config2, merged.workspaceFolder);
45332
+ if (typeof merged.workspaceMount === "string" && merged.workspaceMount.trim().length > 0)
45333
+ this.workspaceMounts.set(config2, merged.workspaceMount);
45334
+ else this.workspaceMounts.delete(config2);
45182
45335
  const compose2 = await resolveComposeConfiguration(this.runner, config2, merged);
45183
- const lockfile = join4(dirname4(config2), "devcontainer-lock.json");
45184
- const lockfileExists = await exists(lockfile);
45185
- const lockfileContents = lockfileExists ? await readFile(lockfile, "utf8") : "";
45336
+ const lockfile = join5(dirname4(config2), "devcontainer-lock.json");
45337
+ const lockfileExists = await exists2(lockfile);
45338
+ const lockfileContents = lockfileExists ? await readFile2(lockfile, "utf8") : "";
45186
45339
  return {
45187
45340
  provider: this.id,
45188
- configRef: relative(context.workspacePath, config2),
45341
+ configRef: relative2(context.workspacePath, config2),
45189
45342
  configHash: hash2(`${rawConfig}\0${result.stdout}\0${compose2.hashMaterial}\0${lockfileContents}`),
45190
45343
  workspace: { hostPath: context.workspacePath },
45191
45344
  capabilities: {
@@ -45203,10 +45356,16 @@ var DevContainerProvider = class {
45203
45356
  }
45204
45357
  async up(environment, scope, removeExisting) {
45205
45358
  if (!environment.configRef) throw new Error("Dev Container environment requires configRef");
45206
- const config2 = resolve2(environment.workspace.hostPath, environment.configRef);
45359
+ const config2 = resolve3(environment.workspace.hostPath, environment.configRef);
45207
45360
  const id = environmentIdFor(scope, "devcontainer", environment.configRef);
45208
45361
  const composeName = `tf_${id.slice(4)}`;
45209
- const gitMount = worktreeGitMount(environment.workspace.hostPath, this.workspaceFolders.get(config2));
45362
+ const gitArgs = await worktreeGitMountArgs({
45363
+ runner: this.runner,
45364
+ workspacePath: environment.workspace.hostPath,
45365
+ containerWorkspacePath: this.workspaceFolders.get(config2),
45366
+ workspaceMount: this.workspaceMounts.get(config2),
45367
+ configRef: environment.configRef
45368
+ });
45210
45369
  const result = await runCaptured(this.runner, {
45211
45370
  command: this.cli,
45212
45371
  args: this.args([
@@ -45219,8 +45378,7 @@ var DevContainerProvider = class {
45219
45378
  `taskflow.environment.id=${id}`,
45220
45379
  "--include-configuration",
45221
45380
  "--include-merged-configuration",
45222
- ...relativeWorktreeGitDir(environment.workspace.hostPath) ? ["--mount-git-worktree-common-dir"] : [],
45223
- ...gitMount ? ["--mount", gitMount] : [],
45381
+ ...gitArgs,
45224
45382
  ...removeExisting ? ["--remove-existing-container"] : []
45225
45383
  ]),
45226
45384
  cwd: dirname4(config2),
@@ -45414,14 +45572,14 @@ exec ${argv.join(" ")} "$cwd" ${quoteShell(executable)} "$@"
45414
45572
  const configuredFiles = configuration.dockerComposeFile;
45415
45573
  const files = Array.isArray(configuredFiles) ? configuredFiles.filter((value) => typeof value === "string") : typeof configuredFiles === "string" ? [configuredFiles] : [];
45416
45574
  if (project && typeof configRef === "string" && files.length > 0) {
45417
- const configDirectory = dirname4(resolve2(handle.workspace.hostPath, configRef));
45575
+ const configDirectory = dirname4(resolve3(handle.workspace.hostPath, configRef));
45418
45576
  return {
45419
45577
  command: "docker",
45420
45578
  args: [
45421
45579
  "compose",
45422
45580
  "--project-name",
45423
45581
  project,
45424
- ...files.flatMap((file2) => ["-f", resolve2(configDirectory, file2)]),
45582
+ ...files.flatMap((file2) => ["-f", resolve3(configDirectory, file2)]),
45425
45583
  "logs",
45426
45584
  "--follow",
45427
45585
  "--tail",
@@ -45440,10 +45598,10 @@ exec ${argv.join(" ")} "$cwd" ${quoteShell(executable)} "$@"
45440
45598
 
45441
45599
  // ../host/src/modules/taskflow/adapters/dockerfile-environment.ts
45442
45600
  import { createHash as createHash4 } from "node:crypto";
45443
- import { existsSync, readFileSync as readFileSync4 } from "node:fs";
45444
- import { resolve as resolve3 } from "node:path";
45601
+ import { existsSync, readFileSync as readFileSync3 } from "node:fs";
45602
+ import { resolve as resolve4 } from "node:path";
45445
45603
  function dockerfileFor(context) {
45446
- const dockerfile = resolve3(context.workspacePath, context.configRef ?? "Dockerfile");
45604
+ const dockerfile = resolve4(context.workspacePath, context.configRef ?? "Dockerfile");
45447
45605
  if (!existsSync(dockerfile)) throw new Error(`Dockerfile does not exist: ${context.configRef ?? "Dockerfile"}`);
45448
45606
  return dockerfile;
45449
45607
  }
@@ -45470,7 +45628,7 @@ var DockerfileEnvironmentProvider = class {
45470
45628
  command: "docker",
45471
45629
  args: ["version", "--format", "{{.Client.Version}}"]
45472
45630
  });
45473
- const dockerfile = resolve3(context.workspacePath, "Dockerfile");
45631
+ const dockerfile = resolve4(context.workspacePath, "Dockerfile");
45474
45632
  return {
45475
45633
  provider: this.id,
45476
45634
  available: version2.exit.code === 0 && existsSync(dockerfile),
@@ -45481,7 +45639,7 @@ var DockerfileEnvironmentProvider = class {
45481
45639
  }
45482
45640
  async resolve(context) {
45483
45641
  const dockerfile = dockerfileFor(context);
45484
- const source = readFileSync4(dockerfile, "utf8");
45642
+ const source = readFileSync3(dockerfile, "utf8");
45485
45643
  return {
45486
45644
  provider: this.id,
45487
45645
  configRef: dockerfile,
@@ -45765,8 +45923,8 @@ function sanitizeProjectPrefix(raw2) {
45765
45923
  return raw2.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, "-");
45766
45924
  }
45767
45925
  function deriveProjectPrefix(projectDir, takenPrefixes) {
45768
- const basename11 = projectDir.replace(/\/+$/, "").split("/").pop() ?? APP_SLUG;
45769
- const base = sanitizeProjectPrefix(basename11) || APP_SLUG;
45926
+ const basename12 = projectDir.replace(/\/+$/, "").split("/").pop() ?? APP_SLUG;
45927
+ const base = sanitizeProjectPrefix(basename12) || APP_SLUG;
45770
45928
  const taken = /* @__PURE__ */ new Set([...takenPrefixes, ...RESERVED_PROJECT_PREFIXES]);
45771
45929
  if (!taken.has(base)) return base;
45772
45930
  for (let n = 2; n < 1e3; n++) {
@@ -47845,7 +48003,7 @@ exec ${JSON.stringify(executable)} "$@"
47845
48003
  };
47846
48004
 
47847
48005
  // ../host/src/modules/taskflow/adapters/projects-registry.ts
47848
- import { mkdirSync as mkdirSync3, readFileSync as readFileSync5, renameSync, writeFileSync as writeFileSync2 } from "node:fs";
48006
+ import { mkdirSync as mkdirSync3, readFileSync as readFileSync4, renameSync, writeFileSync as writeFileSync2 } from "node:fs";
47849
48007
  import { dirname as dirname6 } from "node:path";
47850
48008
  function defaultRegistryFile() {
47851
48009
  return globalPaths().projectsRegistry;
@@ -47854,7 +48012,7 @@ function createProjectsRegistry(file2 = defaultRegistryFile()) {
47854
48012
  function read() {
47855
48013
  let raw2;
47856
48014
  try {
47857
- raw2 = readFileSync5(file2, "utf8");
48015
+ raw2 = readFileSync4(file2, "utf8");
47858
48016
  } catch {
47859
48017
  return [];
47860
48018
  }
@@ -48275,15 +48433,15 @@ import { spawnSync as spawnSync3 } from "node:child_process";
48275
48433
 
48276
48434
  // ../host/src/modules/taskflow/adapters/session-gateway.ts
48277
48435
  import { createHash as createHash5 } from "node:crypto";
48278
- import { basename as basename2, resolve as resolve4 } from "node:path";
48436
+ import { basename as basename3, resolve as resolve5 } from "node:path";
48279
48437
  function sanitizeNameSegment(value, maxLength = 24) {
48280
48438
  const sanitized = value.toLowerCase().replace(/[^a-z0-9_.-]+/g, "-").replace(/-{2,}/g, "-").replace(/^[.-]+|[.-]+$/g, "");
48281
48439
  const trimmed = sanitized.slice(0, maxLength);
48282
48440
  return trimmed || "x";
48283
48441
  }
48284
48442
  function buildProjectSessionName(projectRoot2) {
48285
- const resolved2 = resolve4(projectRoot2);
48286
- const base = sanitizeNameSegment(basename2(resolved2), 18);
48443
+ const resolved2 = resolve5(projectRoot2);
48444
+ const base = sanitizeNameSegment(basename3(resolved2), 18);
48287
48445
  const hash4 = createHash5("sha1").update(resolved2).digest("hex").slice(0, 8);
48288
48446
  return `${RUNTIME_IDENTITY.tmuxPrefix}-${base}-${hash4}`;
48289
48447
  }
@@ -48550,19 +48708,19 @@ var TmuxGateway = class {
48550
48708
 
48551
48709
  // ../host/src/modules/taskflow/assets.ts
48552
48710
  import { existsSync as existsSync2 } from "node:fs";
48553
- import { join as join5, resolve as resolve5 } from "node:path";
48711
+ import { join as join6, resolve as resolve6 } from "node:path";
48554
48712
  function taskflowAssets(env2 = process.env, directory = import.meta.dirname) {
48555
- const bundled = join5(directory, "assets");
48556
- if (existsSync2(join5(bundled, "workflows"))) {
48713
+ const bundled = join6(directory, "assets");
48714
+ if (existsSync2(join6(bundled, "workflows"))) {
48557
48715
  return {
48558
- workflowBuiltinsDir: env2[ENV_NAMES.workflowBuiltinsDir] || join5(bundled, "workflows"),
48559
- workflowSkill: join5(bundled, "skills", "portta-workflows", "SKILL.md")
48716
+ workflowBuiltinsDir: env2[ENV_NAMES.workflowBuiltinsDir] || join6(bundled, "workflows"),
48717
+ workflowSkill: join6(bundled, "skills", "portta-workflows", "SKILL.md")
48560
48718
  };
48561
48719
  }
48562
- const repository = resolve5(directory, "../../../../..");
48720
+ const repository = resolve6(directory, "../../../../..");
48563
48721
  return {
48564
- workflowBuiltinsDir: env2[ENV_NAMES.workflowBuiltinsDir] || join5(repository, "packages", "host", "workflows"),
48565
- workflowSkill: join5(repository, "skills", "portta-workflows", "SKILL.md")
48722
+ workflowBuiltinsDir: env2[ENV_NAMES.workflowBuiltinsDir] || join6(repository, "packages", "host", "workflows"),
48723
+ workflowSkill: join6(repository, "skills", "portta-workflows", "SKILL.md")
48566
48724
  };
48567
48725
  }
48568
48726
 
@@ -48770,19 +48928,19 @@ import { homedir as homedir2 } from "node:os";
48770
48928
  // ../host/src/modules/taskflow/adapters/git.ts
48771
48929
  import { spawnSync as spawnSync4 } from "node:child_process";
48772
48930
  import { readdirSync, realpathSync, rmSync, statSync as statSync3 } from "node:fs";
48773
- import { basename as basename3, dirname as dirname7, join as join6, resolve as resolve6 } from "node:path";
48931
+ import { basename as basename4, dirname as dirname7, join as join7, resolve as resolve7 } from "node:path";
48774
48932
  function canonicalizeFsPath(input2) {
48775
- const resolved2 = resolve6(input2);
48933
+ const resolved2 = resolve7(input2);
48776
48934
  try {
48777
48935
  return realpathSync(resolved2);
48778
48936
  } catch {
48779
48937
  const missing = [];
48780
48938
  let current = resolved2;
48781
48939
  while (current !== dirname7(current)) {
48782
- missing.unshift(basename3(current));
48940
+ missing.unshift(basename4(current));
48783
48941
  current = dirname7(current);
48784
48942
  try {
48785
- return join6(realpathSync(current), ...missing);
48943
+ return join7(realpathSync(current), ...missing);
48786
48944
  } catch {
48787
48945
  }
48788
48946
  }
@@ -48866,7 +49024,7 @@ function currentCheckoutRef(cwd) {
48866
49024
  }
48867
49025
  function resolveRepoRoot(dir) {
48868
49026
  const direct = tryRunGit(["rev-parse", "--show-toplevel"], dir);
48869
- if (direct.ok) return resolve6(dir, direct.stdout);
49027
+ if (direct.ok) return resolve7(dir, direct.stdout);
48870
49028
  let entries;
48871
49029
  try {
48872
49030
  entries = readdirSync(dir);
@@ -48874,24 +49032,24 @@ function resolveRepoRoot(dir) {
48874
49032
  return null;
48875
49033
  }
48876
49034
  for (const entry of entries) {
48877
- const child = join6(dir, entry);
49035
+ const child = join7(dir, entry);
48878
49036
  try {
48879
49037
  if (!statSync3(child).isDirectory()) continue;
48880
49038
  } catch {
48881
49039
  continue;
48882
49040
  }
48883
49041
  const childResult = tryRunGit(["rev-parse", "--show-toplevel"], child);
48884
- if (childResult.ok) return resolve6(child, childResult.stdout);
49042
+ if (childResult.ok) return resolve7(child, childResult.stdout);
48885
49043
  }
48886
49044
  return null;
48887
49045
  }
48888
49046
  function resolveWorktreeRoot(cwd) {
48889
49047
  const output2 = runGit(["rev-parse", "--show-toplevel"], cwd);
48890
- return resolve6(cwd, output2);
49048
+ return resolve7(cwd, output2);
48891
49049
  }
48892
49050
  function resolveWorktreeGitDir(cwd) {
48893
49051
  const output2 = runGit(["rev-parse", "--git-dir"], cwd);
48894
- return resolve6(cwd, output2);
49052
+ return resolve7(cwd, output2);
48895
49053
  }
48896
49054
  function parseGitWorktreePorcelain(output2) {
48897
49055
  const entries = [];
@@ -49453,7 +49611,7 @@ function resolveSocketPath(env2) {
49453
49611
  return session ? `${home2}/.config/herdr/sessions/${session}/herdr.sock` : `${home2}/.config/herdr/herdr.sock`;
49454
49612
  }
49455
49613
  async function request(socketPath, method, params) {
49456
- return await new Promise((resolve21, reject2) => {
49614
+ return await new Promise((resolve22, reject2) => {
49457
49615
  let buffer = "";
49458
49616
  let settled = false;
49459
49617
  const settle = (fn) => {
@@ -49477,7 +49635,7 @@ async function request(socketPath, method, params) {
49477
49635
  const line = buffer.slice(0, newline);
49478
49636
  clearTimeout(timer);
49479
49637
  try {
49480
- settle(() => resolve21(parseHerdrResponse(JSON.parse(line))));
49638
+ settle(() => resolve22(parseHerdrResponse(JSON.parse(line))));
49481
49639
  } catch {
49482
49640
  settle(() => reject2(new HerdrRequestError(method, "invalid_response", line.slice(0, 200))));
49483
49641
  }
@@ -49777,8 +49935,8 @@ var HerdrGateway = class {
49777
49935
  };
49778
49936
 
49779
49937
  // ../host/src/modules/taskflow/adapters/hooks.ts
49780
- import { access as access2 } from "node:fs/promises";
49781
- import { join as join7 } from "node:path";
49938
+ import { access as access3 } from "node:fs/promises";
49939
+ import { join as join8 } from "node:path";
49782
49940
  function buildErrorMessage(name, exitCode, stdout, stderr) {
49783
49941
  const output2 = stderr.trim() || stdout.trim();
49784
49942
  if (output2) {
@@ -49823,7 +49981,7 @@ var NodeLifecycleHookRunner = class {
49823
49981
  }
49824
49982
  async hasEnvrc(cwd) {
49825
49983
  try {
49826
- await access2(join7(cwd, ".envrc"));
49984
+ await access3(join8(cwd, ".envrc"));
49827
49985
  return true;
49828
49986
  } catch {
49829
49987
  return false;
@@ -49858,7 +50016,7 @@ var NodePortProbe = class {
49858
50016
  this.hostnames = hostnames;
49859
50017
  }
49860
50018
  isListening(port) {
49861
- return new Promise((resolve21) => {
50019
+ return new Promise((resolve22) => {
49862
50020
  let settled = false;
49863
50021
  let pending = this.hostnames.length;
49864
50022
  const settle = (result) => {
@@ -49866,20 +50024,20 @@ var NodePortProbe = class {
49866
50024
  if (result) {
49867
50025
  settled = true;
49868
50026
  clearTimeout(timer);
49869
- resolve21(true);
50027
+ resolve22(true);
49870
50028
  return;
49871
50029
  }
49872
50030
  pending--;
49873
50031
  if (pending === 0) {
49874
50032
  settled = true;
49875
50033
  clearTimeout(timer);
49876
- resolve21(false);
50034
+ resolve22(false);
49877
50035
  }
49878
50036
  };
49879
50037
  const timer = setTimeout(() => {
49880
50038
  if (!settled) {
49881
50039
  settled = true;
49882
- resolve21(false);
50040
+ resolve22(false);
49883
50041
  }
49884
50042
  }, this.timeoutMs);
49885
50043
  for (const hostname3 of this.hostnames) {
@@ -49901,7 +50059,7 @@ var NodePortProbe = class {
49901
50059
 
49902
50060
  // ../host/src/modules/taskflow/adapters/session-discovery.ts
49903
50061
  import { open as open2, readdir as readdir3, stat as stat3 } from "node:fs/promises";
49904
- import { basename as basename5, join as join9 } from "node:path";
50062
+ import { basename as basename6, join as join10 } from "node:path";
49905
50063
  import { setTimeout as sleep3 } from "node:timers/promises";
49906
50064
 
49907
50065
  // ../host/src/modules/taskflow/lib/type-guards.ts
@@ -49913,8 +50071,8 @@ function isStringArray2(raw2) {
49913
50071
  }
49914
50072
 
49915
50073
  // ../host/src/modules/taskflow/adapters/claude-cli.ts
49916
- import { readdir as readdir2, readFile as readFile2, stat as stat2 } from "node:fs/promises";
49917
- import { basename as basename4, join as join8 } from "node:path";
50074
+ import { readdir as readdir2, readFile as readFile3, stat as stat2 } from "node:fs/promises";
50075
+ import { basename as basename5, join as join9 } from "node:path";
49918
50076
  function isRecord4(raw2) {
49919
50077
  return typeof raw2 === "object" && raw2 !== null && !Array.isArray(raw2);
49920
50078
  }
@@ -50098,19 +50256,19 @@ function readClaudeProjectsRoot() {
50098
50256
  if (!home2) {
50099
50257
  throw new Error("HOME is required to resolve Claude sessions");
50100
50258
  }
50101
- return join8(home2, ".claude", "projects");
50259
+ return join9(home2, ".claude", "projects");
50102
50260
  }
50103
50261
  async function listJsonlFiles(dir) {
50104
50262
  try {
50105
50263
  const entries = await readdir2(dir, { withFileTypes: true });
50106
- return entries.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl")).map((entry) => join8(dir, entry.name));
50264
+ return entries.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl")).map((entry) => join9(dir, entry.name));
50107
50265
  } catch {
50108
50266
  return [];
50109
50267
  }
50110
50268
  }
50111
50269
  async function findClaudeSessionPath(sessionId, cwd) {
50112
50270
  const projectsRoot = readClaudeProjectsRoot();
50113
- const primaryPath = join8(projectsRoot, encodeClaudeProjectDir(cwd), `${sessionId}.jsonl`);
50271
+ const primaryPath = join9(projectsRoot, encodeClaudeProjectDir(cwd), `${sessionId}.jsonl`);
50114
50272
  try {
50115
50273
  await stat2(primaryPath);
50116
50274
  return primaryPath;
@@ -50119,7 +50277,7 @@ async function findClaudeSessionPath(sessionId, cwd) {
50119
50277
  const projectDirs = await readdir2(projectsRoot, { withFileTypes: true }).catch(() => []);
50120
50278
  for (const entry of projectDirs) {
50121
50279
  if (!entry.isDirectory()) continue;
50122
- const candidate = join8(projectsRoot, entry.name, `${sessionId}.jsonl`);
50280
+ const candidate = join9(projectsRoot, entry.name, `${sessionId}.jsonl`);
50123
50281
  try {
50124
50282
  await stat2(candidate);
50125
50283
  return candidate;
@@ -50243,7 +50401,7 @@ var ClaudeCliClient = class {
50243
50401
  }
50244
50402
  async listSessions(cwd) {
50245
50403
  const projectsRoot = readClaudeProjectsRoot();
50246
- const primaryDir = join8(projectsRoot, encodeClaudeProjectDir(cwd));
50404
+ const primaryDir = join9(projectsRoot, encodeClaudeProjectDir(cwd));
50247
50405
  const primaryFiles = await listJsonlFiles(primaryDir);
50248
50406
  if (primaryFiles.length > 0) {
50249
50407
  return await this.summarizeSessionFiles(primaryFiles, cwd);
@@ -50252,7 +50410,7 @@ var ClaudeCliClient = class {
50252
50410
  const matchedFiles = [];
50253
50411
  for (const entry of projectDirs) {
50254
50412
  if (!entry.isDirectory()) continue;
50255
- const files = await listJsonlFiles(join8(projectsRoot, entry.name));
50413
+ const files = await listJsonlFiles(join9(projectsRoot, entry.name));
50256
50414
  for (const filePath of files) {
50257
50415
  const session = await this.readSessionFile(filePath);
50258
50416
  if (session?.cwd === cwd) {
@@ -50300,8 +50458,8 @@ var ClaudeCliClient = class {
50300
50458
  let sessionIdResolve = null;
50301
50459
  let sessionIdReject = null;
50302
50460
  let interrupted = false;
50303
- const sessionId = new Promise((resolve21, reject2) => {
50304
- sessionIdResolve = resolve21;
50461
+ const sessionId = new Promise((resolve22, reject2) => {
50462
+ sessionIdResolve = resolve22;
50305
50463
  sessionIdReject = reject2;
50306
50464
  });
50307
50465
  const resolveSessionId = (value) => {
@@ -50372,7 +50530,7 @@ var ClaudeCliClient = class {
50372
50530
  const info = await stat2(filePath).catch(() => null);
50373
50531
  if (!info) return null;
50374
50532
  return {
50375
- sessionId: basename4(filePath, ".jsonl"),
50533
+ sessionId: basename5(filePath, ".jsonl"),
50376
50534
  cwd,
50377
50535
  path: filePath,
50378
50536
  lastSeenAt: info.mtime.toISOString()
@@ -50383,10 +50541,10 @@ var ClaudeCliClient = class {
50383
50541
  }
50384
50542
  async readSessionFile(filePath) {
50385
50543
  try {
50386
- const text = await readFile2(filePath, "utf8");
50544
+ const text = await readFile3(filePath, "utf8");
50387
50545
  return buildClaudeSessionFromText({
50388
50546
  path: filePath,
50389
- sessionId: basename4(filePath, ".jsonl"),
50547
+ sessionId: basename5(filePath, ".jsonl"),
50390
50548
  text
50391
50549
  });
50392
50550
  } catch {
@@ -50449,12 +50607,12 @@ function newestFirst(sessions2) {
50449
50607
  return sessions2.sort((left, right) => right.mtimeMs - left.mtimeMs).map((entry) => entry.sessionId);
50450
50608
  }
50451
50609
  async function listClaudeSessionIds(cwd) {
50452
- const dir = join9(home(), ".claude", "projects", encodeClaudeProjectDir(cwd));
50610
+ const dir = join10(home(), ".claude", "projects", encodeClaudeProjectDir(cwd));
50453
50611
  const names = await readdir3(dir).catch(() => []);
50454
50612
  const stamped = await Promise.all(
50455
50613
  names.filter((name) => name.endsWith(".jsonl")).map(async (name) => {
50456
- const info = await stat3(join9(dir, name)).catch(() => null);
50457
- return info ? { sessionId: basename5(name, ".jsonl"), mtimeMs: info.mtimeMs } : null;
50614
+ const info = await stat3(join10(dir, name)).catch(() => null);
50615
+ return info ? { sessionId: basename6(name, ".jsonl"), mtimeMs: info.mtimeMs } : null;
50458
50616
  })
50459
50617
  );
50460
50618
  return newestFirst(stamped.filter((entry) => entry !== null));
@@ -50489,15 +50647,15 @@ async function readCodexSessionCwdId(path) {
50489
50647
  }
50490
50648
  }
50491
50649
  async function listCodexSessionIds(cwd) {
50492
- const root = join9(home(), ".codex", "sessions");
50650
+ const root = join10(home(), ".codex", "sessions");
50493
50651
  const relPaths = await readdir3(root, { recursive: true }).catch(() => []);
50494
50652
  const rollouts = relPaths.filter((rel) => {
50495
- const name = basename5(rel);
50653
+ const name = basename6(rel);
50496
50654
  return name.startsWith("rollout-") && name.endsWith(".jsonl");
50497
50655
  });
50498
50656
  const stamped = await Promise.all(
50499
50657
  rollouts.map(async (rel) => {
50500
- const path = join9(root, rel);
50658
+ const path = join10(root, rel);
50501
50659
  const meta3 = await readCodexSessionCwdId(path);
50502
50660
  if (!meta3 || meta3.cwd !== cwd) return null;
50503
50661
  const info = await stat3(path).catch(() => null);
@@ -50507,11 +50665,11 @@ async function listCodexSessionIds(cwd) {
50507
50665
  return newestFirst(stamped.filter((entry) => entry !== null));
50508
50666
  }
50509
50667
  async function findCodexSessionPath(sessionId, cwd) {
50510
- const root = join9(home(), ".codex", "sessions");
50668
+ const root = join10(home(), ".codex", "sessions");
50511
50669
  const relPaths = await readdir3(root, { recursive: true }).catch(() => []);
50512
50670
  for (const rel of relPaths) {
50513
- if (!basename5(rel).endsWith(`${sessionId}.jsonl`)) continue;
50514
- const path = join9(root, rel);
50671
+ if (!basename6(rel).endsWith(`${sessionId}.jsonl`)) continue;
50672
+ const path = join10(root, rel);
50515
50673
  const meta3 = await readCodexSessionCwdId(path);
50516
50674
  if (meta3?.id === sessionId && meta3.cwd === cwd) return path;
50517
50675
  }
@@ -50592,8 +50750,8 @@ async function captureNewSessionId(discovery, agent, cwd, before, options = {})
50592
50750
  }
50593
50751
 
50594
50752
  // ../host/src/modules/taskflow/adapters/fs.ts
50595
- import { mkdir as mkdir2, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
50596
- import { join as join10 } from "node:path";
50753
+ import { mkdir as mkdir2, readFile as readFile4, writeFile as writeFile3 } from "node:fs/promises";
50754
+ import { join as join11 } from "node:path";
50597
50755
  var SAFE_ENV_VALUE_RE = /^[A-Za-z0-9_./:@%+=,-]+$/;
50598
50756
  var DOTENV_LINE_RE = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)/;
50599
50757
  function stringifyAllocatedPorts(ports) {
@@ -50624,7 +50782,7 @@ function parseDotenv(content) {
50624
50782
  }
50625
50783
  async function loadDotenvLocal(worktreePath) {
50626
50784
  try {
50627
- const content = await readFile3(join10(worktreePath, ".env.local"), "utf8");
50785
+ const content = await readFile4(join11(worktreePath, ".env.local"), "utf8");
50628
50786
  return parseDotenv(content);
50629
50787
  } catch {
50630
50788
  return {};
@@ -50655,7 +50813,7 @@ async function ensureWorktreeStorageDirs(gitDir) {
50655
50813
  async function readWorktreeMeta(gitDir) {
50656
50814
  const { metaPath } = getWorktreeStoragePaths(gitDir);
50657
50815
  try {
50658
- const raw2 = JSON.parse(await readFile3(metaPath, "utf8"));
50816
+ const raw2 = JSON.parse(await readFile4(metaPath, "utf8"));
50659
50817
  return normalizeWorktreeMeta(raw2);
50660
50818
  } catch {
50661
50819
  return null;
@@ -50663,7 +50821,7 @@ async function readWorktreeMeta(gitDir) {
50663
50821
  }
50664
50822
  async function writeWorktreeMeta(gitDir, meta3) {
50665
50823
  const { metaPath } = await ensureWorktreeStorageDirs(gitDir);
50666
- await writeFile2(metaPath, `${JSON.stringify(meta3, null, 2)}
50824
+ await writeFile3(metaPath, `${JSON.stringify(meta3, null, 2)}
50667
50825
  `);
50668
50826
  }
50669
50827
  function isArchivedWorktreeEntry(raw2) {
@@ -50681,7 +50839,7 @@ function isWorktreeArchiveState(raw2) {
50681
50839
  async function readWorktreeArchiveState(gitDir) {
50682
50840
  const archivePath = getProjectArchiveStatePath(gitDir);
50683
50841
  try {
50684
- const raw2 = JSON.parse(await readFile3(archivePath, "utf8"));
50842
+ const raw2 = JSON.parse(await readFile4(archivePath, "utf8"));
50685
50843
  return isWorktreeArchiveState(raw2) ? {
50686
50844
  schemaVersion: raw2.schemaVersion,
50687
50845
  entries: raw2.entries.map((entry) => ({ ...entry }))
@@ -50693,13 +50851,13 @@ async function readWorktreeArchiveState(gitDir) {
50693
50851
  async function writeWorktreeArchiveState(gitDir, state) {
50694
50852
  const archivePath = getProjectArchiveStatePath(gitDir);
50695
50853
  await ensureWorktreeStorageDirs(gitDir);
50696
- await writeFile2(archivePath, `${JSON.stringify(state, null, 2)}
50854
+ await writeFile3(archivePath, `${JSON.stringify(state, null, 2)}
50697
50855
  `);
50698
50856
  }
50699
50857
  async function writeOpenSessionsState(gitDir, state) {
50700
50858
  const statePath = getProjectOpenSessionsStatePath(gitDir);
50701
50859
  await ensureWorktreeStorageDirs(gitDir);
50702
- await writeFile2(statePath, `${JSON.stringify(state, null, 2)}
50860
+ await writeFile3(statePath, `${JSON.stringify(state, null, 2)}
50703
50861
  `);
50704
50862
  }
50705
50863
  function buildRuntimeEnvMap(meta3, extraEnv = {}, dotenvValues = {}) {
@@ -50730,11 +50888,11 @@ function renderEnvFile(env2) {
50730
50888
  }
50731
50889
  async function writeRuntimeEnv(gitDir, env2) {
50732
50890
  const { runtimeEnvPath } = await ensureWorktreeStorageDirs(gitDir);
50733
- await writeFile2(runtimeEnvPath, renderEnvFile(env2));
50891
+ await writeFile3(runtimeEnvPath, renderEnvFile(env2));
50734
50892
  }
50735
50893
  async function writeControlEnv(gitDir, env2) {
50736
50894
  const { controlEnvPath } = await ensureWorktreeStorageDirs(gitDir);
50737
- await writeFile2(controlEnvPath, renderEnvFile(env2));
50895
+ await writeFile3(controlEnvPath, renderEnvFile(env2));
50738
50896
  }
50739
50897
  function isRecord5(raw2) {
50740
50898
  return typeof raw2 === "object" && raw2 !== null && !Array.isArray(raw2);
@@ -50819,7 +50977,7 @@ function isPrEntry(raw2) {
50819
50977
  async function readWorktreePrs(gitDir) {
50820
50978
  const { prsPath } = getWorktreeStoragePaths(gitDir);
50821
50979
  try {
50822
- const raw2 = JSON.parse(await readFile3(prsPath, "utf8"));
50980
+ const raw2 = JSON.parse(await readFile4(prsPath, "utf8"));
50823
50981
  if (!Array.isArray(raw2) || !raw2.every((entry) => isPrEntry(entry))) return [];
50824
50982
  return raw2.map((entry) => ({ ...entry, isDraft: entry.isDraft ?? false }));
50825
50983
  } catch {
@@ -50828,12 +50986,12 @@ async function readWorktreePrs(gitDir) {
50828
50986
  }
50829
50987
  async function writeWorktreePrs(gitDir, prs) {
50830
50988
  const { prsPath } = await ensureWorktreeStorageDirs(gitDir);
50831
- await writeFile2(prsPath, `${JSON.stringify(prs, null, 2)}
50989
+ await writeFile3(prsPath, `${JSON.stringify(prs, null, 2)}
50832
50990
  `);
50833
50991
  }
50834
50992
 
50835
50993
  // ../host/src/modules/taskflow/services/archive-service.ts
50836
- import { resolve as resolve7 } from "node:path";
50994
+ import { resolve as resolve8 } from "node:path";
50837
50995
  function createArchiveState(entries) {
50838
50996
  return {
50839
50997
  schemaVersion: WORKTREE_ARCHIVE_STATE_VERSION,
@@ -50841,7 +50999,7 @@ function createArchiveState(entries) {
50841
50999
  };
50842
51000
  }
50843
51001
  function normalizeArchivePath(path) {
50844
- return resolve7(path);
51002
+ return resolve8(path);
50845
51003
  }
50846
51004
  function buildArchivedWorktreePathSet(state) {
50847
51005
  return new Set(state.entries.map((entry) => normalizeArchivePath(entry.path)));
@@ -50915,8 +51073,8 @@ var ArchiveStateService = class {
50915
51073
  const previous = this.mutationQueue;
50916
51074
  let release = () => {
50917
51075
  };
50918
- this.mutationQueue = new Promise((resolve21) => {
50919
- release = resolve21;
51076
+ this.mutationQueue = new Promise((resolve22) => {
51077
+ release = resolve22;
50920
51078
  });
50921
51079
  await previous.catch(() => {
50922
51080
  });
@@ -51094,8 +51252,8 @@ var AutoNameService = class {
51094
51252
 
51095
51253
  // ../host/src/modules/taskflow/services/lifecycle-service.ts
51096
51254
  import { randomUUID as randomUUID3 } from "node:crypto";
51097
- import { mkdir as mkdir4, readFile as readFile5, writeFile as writeFile4 } from "node:fs/promises";
51098
- import { dirname as dirname10, relative as relative2, resolve as resolve10 } from "node:path";
51255
+ import { mkdir as mkdir4, readFile as readFile6, writeFile as writeFile5 } from "node:fs/promises";
51256
+ import { dirname as dirname10, relative as relative3, resolve as resolve11 } from "node:path";
51099
51257
 
51100
51258
  // ../host/src/modules/taskflow/adapters/agent-capabilities.ts
51101
51259
  var CAPABILITY_TIMEOUT_MS = 15e3;
@@ -51140,8 +51298,8 @@ ${stderr}`;
51140
51298
  };
51141
51299
 
51142
51300
  // ../host/src/modules/taskflow/adapters/agent-runtime.ts
51143
- import { chmod, mkdir as mkdir3, readFile as readFile4, writeFile as writeFile3 } from "node:fs/promises";
51144
- import { dirname as dirname8, join as join11, resolve as resolve8 } from "node:path";
51301
+ import { chmod, mkdir as mkdir3, readFile as readFile5, writeFile as writeFile4 } from "node:fs/promises";
51302
+ import { dirname as dirname8, join as join12, resolve as resolve9 } from "node:path";
51145
51303
  var GENERATED_AGENT_FILES_EXCLUDES = [".claude/settings.local.json", ".codex/hooks.json"];
51146
51304
  function shellQuote(value) {
51147
51305
  return `'${value.replaceAll("'", "'\\''")}'`;
@@ -51151,7 +51309,7 @@ function isRecord6(value) {
51151
51309
  }
51152
51310
  async function readJsonRecord(path) {
51153
51311
  try {
51154
- const parsed = JSON.parse(await readFile4(path, "utf8"));
51312
+ const parsed = JSON.parse(await readFile5(path, "utf8"));
51155
51313
  return isRecord6(parsed) ? parsed : {};
51156
51314
  } catch {
51157
51315
  return {};
@@ -51567,7 +51725,7 @@ async function mergeClaudeSettings(settingsPath, hookSettings) {
51567
51725
  const existingHooks = existing.hooks;
51568
51726
  const mergedHooks = existingHooks && typeof existingHooks === "object" && !Array.isArray(existingHooks) ? { ...existingHooks, ...hookSettings } : hookSettings;
51569
51727
  const merged = { ...existing, hooks: mergedHooks };
51570
- await writeFile3(settingsPath, `${JSON.stringify(merged, null, 2)}
51728
+ await writeFile4(settingsPath, `${JSON.stringify(merged, null, 2)}
51571
51729
  `);
51572
51730
  }
51573
51731
  function commandStartsWithAgentCtl(command, agentCtlPath) {
@@ -51590,24 +51748,24 @@ async function mergeCodexHooksFile(hooksPath, hookSettings, agentCtlPath) {
51590
51748
  const preservedGroups = Array.isArray(eventGroups) ? eventGroups.filter((group) => !isTaskflowHookGroup(group, agentCtlPath)) : [];
51591
51749
  mergedHooks[eventName] = [...preservedGroups, ...groups];
51592
51750
  }
51593
- await writeFile3(hooksPath, `${JSON.stringify({ ...existing, hooks: mergedHooks }, null, 2)}
51751
+ await writeFile4(hooksPath, `${JSON.stringify({ ...existing, hooks: mergedHooks }, null, 2)}
51594
51752
  `);
51595
51753
  }
51596
51754
  async function resolveGitCommonDir(gitDir) {
51597
51755
  try {
51598
- const commonDir = (await readFile4(join11(gitDir, "commondir"), "utf8")).trim();
51756
+ const commonDir = (await readFile5(join12(gitDir, "commondir"), "utf8")).trim();
51599
51757
  if (!commonDir) return gitDir;
51600
- return commonDir.startsWith("/") ? commonDir : resolve8(gitDir, commonDir);
51758
+ return commonDir.startsWith("/") ? commonDir : resolve9(gitDir, commonDir);
51601
51759
  } catch {
51602
51760
  return gitDir;
51603
51761
  }
51604
51762
  }
51605
51763
  async function ensureGeneratedAgentFilesIgnored(gitDir) {
51606
51764
  const commonDir = await resolveGitCommonDir(gitDir);
51607
- const excludePath = join11(commonDir, "info", "exclude");
51765
+ const excludePath = join12(commonDir, "info", "exclude");
51608
51766
  let existing = "";
51609
51767
  try {
51610
- existing = await readFile4(excludePath, "utf8");
51768
+ existing = await readFile5(excludePath, "utf8");
51611
51769
  } catch {
51612
51770
  existing = "";
51613
51771
  }
@@ -51616,19 +51774,19 @@ async function ensureGeneratedAgentFilesIgnored(gitDir) {
51616
51774
  if (missing.length === 0) return;
51617
51775
  await mkdir3(dirname8(excludePath), { recursive: true });
51618
51776
  const separator = existing.length > 0 && !existing.endsWith("\n") ? "\n" : "";
51619
- await writeFile3(excludePath, `${existing}${separator}${missing.join("\n")}
51777
+ await writeFile4(excludePath, `${existing}${separator}${missing.join("\n")}
51620
51778
  `);
51621
51779
  }
51622
51780
  async function ensureAgentRuntimeArtifacts(input2) {
51623
51781
  const storagePaths = getWorktreeStoragePaths(input2.gitDir);
51624
51782
  const artifacts = {
51625
- agentCtlPath: join11(storagePaths.taskflowDir, RUNTIME_IDENTITY.agentControlBinary),
51626
- claudeSettingsPath: join11(input2.worktreePath, ".claude", "settings.local.json"),
51627
- codexHooksPath: join11(input2.worktreePath, ".codex", "hooks.json")
51783
+ agentCtlPath: join12(storagePaths.taskflowDir, RUNTIME_IDENTITY.agentControlBinary),
51784
+ claudeSettingsPath: join12(input2.worktreePath, ".claude", "settings.local.json"),
51785
+ codexHooksPath: join12(input2.worktreePath, ".codex", "hooks.json")
51628
51786
  };
51629
51787
  await mkdir3(dirname8(artifacts.claudeSettingsPath), { recursive: true });
51630
51788
  await mkdir3(dirname8(artifacts.codexHooksPath), { recursive: true });
51631
- await writeFile3(artifacts.agentCtlPath, buildAgentCtlScript());
51789
+ await writeFile4(artifacts.agentCtlPath, buildAgentCtlScript());
51632
51790
  await chmod(artifacts.agentCtlPath, 493);
51633
51791
  const hookSettings = buildClaudeHookSettings(artifacts);
51634
51792
  const hooks = hookSettings.hooks;
@@ -51753,7 +51911,7 @@ function listAgentDetails(config2) {
51753
51911
  }
51754
51912
 
51755
51913
  // ../host/src/modules/taskflow/services/agent-service.ts
51756
- import { dirname as dirname9, join as join12 } from "node:path";
51914
+ import { dirname as dirname9, join as join13 } from "node:path";
51757
51915
  var DOCKER_PATH_FALLBACK = "/root/.local/bin:/usr/local/bin:/root/.bun/bin:/root/.cargo/bin";
51758
51916
  var CUSTOM_AGENT_TEMPLATE_VARS = {
51759
51917
  PROMPT: ENV_NAMES.agentPrompt,
@@ -51774,7 +51932,7 @@ function buildDockerRuntimeBootstrap(runtimeEnvPath) {
51774
51932
  }
51775
51933
  function buildCodexNotifyFlag(runtimeEnvPath) {
51776
51934
  if (!runtimeEnvPath) return "";
51777
- const agentCtlPath = join12(dirname9(runtimeEnvPath), RUNTIME_IDENTITY.agentControlBinary);
51935
+ const agentCtlPath = join13(dirname9(runtimeEnvPath), RUNTIME_IDENTITY.agentControlBinary);
51778
51936
  return ` -c ${quoteShell3(`notify=${JSON.stringify([agentCtlPath, "codex-notify"])}`)}`;
51779
51937
  }
51780
51938
  function buildBuiltInAgentInvocation(input2) {
@@ -51900,7 +52058,7 @@ function buildDockerAgentPaneCommand(input2) {
51900
52058
  }
51901
52059
 
51902
52060
  // ../host/src/modules/taskflow/services/session-service.ts
51903
- import { resolve as resolve9 } from "node:path";
52061
+ import { resolve as resolve10 } from "node:path";
51904
52062
  function quoteShell4(value) {
51905
52063
  return `'${value.replaceAll("'", "'\\''")}'`;
51906
52064
  }
@@ -51914,7 +52072,7 @@ function buildCommandPaneStartupCommand(template, ctx) {
51914
52072
  if (!template.workingDir) {
51915
52073
  return template.command;
51916
52074
  }
51917
- const workingDir = resolve9(resolvePaneCwd(template, ctx), template.workingDir);
52075
+ const workingDir = resolve10(resolvePaneCwd(template, ctx), template.workingDir);
51918
52076
  return `cd -- ${quoteShell4(workingDir)} && ${template.command}`;
51919
52077
  }
51920
52078
  function resolvePaneStartupCommand(template, ctx) {
@@ -52215,7 +52373,7 @@ function trimTrailingSlashes(value) {
52215
52373
  return value.replace(/\/+$/, "");
52216
52374
  }
52217
52375
  function isPathWithin(parent, child) {
52218
- const path = relative2(parent, child);
52376
+ const path = relative3(parent, child);
52219
52377
  return path !== "" && !path.startsWith("..") && !path.includes(`..${process.platform === "win32" ? "\\" : "/"}`);
52220
52378
  }
52221
52379
  function normalizeWorktreeLabel(label) {
@@ -52910,7 +53068,7 @@ var LifecycleService = class {
52910
53068
  return allocateServicePorts(metas, this.deps.config.services);
52911
53069
  }
52912
53070
  resolveWorktreePath(branch) {
52913
- return resolve10(this.deps.projectRoot, this.deps.config.workspace.worktreeRoot, branch);
53071
+ return resolve11(this.deps.projectRoot, this.deps.config.workspace.worktreeRoot, branch);
52914
53072
  }
52915
53073
  /**
52916
53074
  * A worktree root below the repository is intentionally kept out of the
@@ -52919,36 +53077,36 @@ var LifecycleService = class {
52919
53077
  * tracked project files or leaking the choice to other contributors.
52920
53078
  */
52921
53079
  async excludeInternalWorktreeRoot(worktreePath) {
52922
- const projectRoot2 = resolve10(this.deps.projectRoot);
52923
- const worktreeRoot = resolve10(projectRoot2, this.deps.config.workspace.worktreeRoot);
53080
+ const projectRoot2 = resolve11(this.deps.projectRoot);
53081
+ const worktreeRoot = resolve11(projectRoot2, this.deps.config.workspace.worktreeRoot);
52924
53082
  if (!isPathWithin(projectRoot2, worktreeRoot) || !isPathWithin(worktreeRoot, worktreePath)) return;
52925
- const relativeRoot = relative2(projectRoot2, worktreeRoot).split("\\").join("/");
53083
+ const relativeRoot = relative3(projectRoot2, worktreeRoot).split("\\").join("/");
52926
53084
  const rule = `/${relativeRoot}/`;
52927
53085
  const gitDir = this.deps.git.resolveWorktreeGitDir(projectRoot2);
52928
- const excludePath = resolve10(gitDir, "info", "exclude");
53086
+ const excludePath = resolve11(gitDir, "info", "exclude");
52929
53087
  await mkdir4(dirname10(excludePath), { recursive: true });
52930
53088
  let existing = "";
52931
53089
  try {
52932
- existing = await readFile5(excludePath, "utf8");
53090
+ existing = await readFile6(excludePath, "utf8");
52933
53091
  } catch {
52934
53092
  }
52935
53093
  if (existing.split(/\r?\n/).some((line) => line.trim() === rule)) return;
52936
- await writeFile4(excludePath, `${existing}${existing && !existing.endsWith("\n") ? "\n" : ""}${rule}
53094
+ await writeFile5(excludePath, `${existing}${existing && !existing.endsWith("\n") ? "\n" : ""}${rule}
52937
53095
  `);
52938
53096
  }
52939
53097
  listLocalBranches() {
52940
- return this.deps.git.listLocalBranches(resolve10(this.deps.projectRoot));
53098
+ return this.deps.git.listLocalBranches(resolve11(this.deps.projectRoot));
52941
53099
  }
52942
53100
  listRemoteBranches() {
52943
- return this.deps.git.listRemoteBranches(resolve10(this.deps.projectRoot));
53101
+ return this.deps.git.listRemoteBranches(resolve11(this.deps.projectRoot));
52944
53102
  }
52945
53103
  listCheckedOutBranches() {
52946
53104
  return new Set(
52947
- this.deps.git.listWorktrees(resolve10(this.deps.projectRoot)).filter((entry) => !entry.bare && entry.branch !== null).map((entry) => entry.branch)
53105
+ this.deps.git.listWorktrees(resolve11(this.deps.projectRoot)).filter((entry) => !entry.bare && entry.branch !== null).map((entry) => entry.branch)
52948
53106
  );
52949
53107
  }
52950
53108
  listProjectWorktrees() {
52951
- const projectRoot2 = resolve10(this.deps.projectRoot);
53109
+ const projectRoot2 = resolve11(this.deps.projectRoot);
52952
53110
  return this.deps.git.listLiveWorktrees(projectRoot2).filter((entry) => !entry.bare && !sameFsPath(entry.path, projectRoot2));
52953
53111
  }
52954
53112
  async readManagedMetas() {
@@ -53752,7 +53910,7 @@ var ProjectRuntime = class {
53752
53910
  };
53753
53911
 
53754
53912
  // ../host/src/modules/taskflow/services/reconciliation-service.ts
53755
- import { basename as basename6, resolve as resolve11 } from "node:path";
53913
+ import { basename as basename7, resolve as resolve12 } from "node:path";
53756
53914
 
53757
53915
  // ../host/src/modules/taskflow/lib/async.ts
53758
53916
  async function mapWithConcurrency(items, limit, fn) {
@@ -53798,7 +53956,7 @@ function startSerializedInterval(run, intervalMs, deps = {}) {
53798
53956
 
53799
53957
  // ../host/src/modules/taskflow/services/reconciliation-service.ts
53800
53958
  function makeUnmanagedWorktreeId(path) {
53801
- return `unmanaged:${resolve11(path)}`;
53959
+ return `unmanaged:${resolve12(path)}`;
53802
53960
  }
53803
53961
  function isValidPort2(port) {
53804
53962
  return port !== null && Number.isInteger(port) && port >= 1 && port <= 65535;
@@ -53833,7 +53991,7 @@ function findWindow(windows, sessionName, branch) {
53833
53991
  return windows.find((window) => window.sessionName === sessionName && window.windowName === windowName) ?? null;
53834
53992
  }
53835
53993
  function resolveBranch(entry, metaBranch) {
53836
- const fallback = basename6(entry.path);
53994
+ const fallback = basename7(entry.path);
53837
53995
  return entry.branch ?? metaBranch ?? (fallback.length > 0 ? fallback : "unknown");
53838
53996
  }
53839
53997
  var ReconciliationService = class {
@@ -53856,7 +54014,7 @@ var ReconciliationService = class {
53856
54014
  if (!options.force && this.now() - this.lastReconciledAt < this.freshnessMs) {
53857
54015
  return;
53858
54016
  }
53859
- const normalizedRepoRoot = resolve11(repoRoot);
54017
+ const normalizedRepoRoot = resolve12(repoRoot);
53860
54018
  const reconcilePromise = this.runReconcile(normalizedRepoRoot).then(() => {
53861
54019
  this.lastReconciledAt = this.now();
53862
54020
  });
@@ -56909,7 +57067,7 @@ function environmentRoutes(deps) {
56909
57067
  }
56910
57068
 
56911
57069
  // ../host/src/modules/taskflow/server/routes/github.ts
56912
- import { resolve as resolve12 } from "node:path";
57070
+ import { resolve as resolve13 } from "node:path";
56913
57071
 
56914
57072
  // ../host/src/modules/taskflow/services/auto-pull-service.ts
56915
57073
  function pullMainBranch(deps) {
@@ -57370,7 +57528,7 @@ function githubRoutes(deps) {
57370
57528
  const linkedRepo = config2.integrations.github.linkedRepos.find((lr) => lr.alias === repo);
57371
57529
  if (!linkedRepo) return errorResponse(`Unknown linked repo: ${repo}`, 404);
57372
57530
  if (!linkedRepo.dir) return errorResponse(`Linked repo "${repo}" has no dir configured`, 400);
57373
- const resolvedDir = resolve12(projectDir, linkedRepo.dir);
57531
+ const resolvedDir = resolve13(projectDir, linkedRepo.dir);
57374
57532
  const repoRoot = git2.resolveRepoRoot(resolvedDir);
57375
57533
  if (!repoRoot) return errorResponse(`Linked repo "${repo}" dir is not a git repository: ${resolvedDir}`, 400);
57376
57534
  projectRoot2 = repoRoot;
@@ -57416,7 +57574,7 @@ function hasHeader(headers, name) {
57416
57574
  return getHeader(headers, name) !== void 0;
57417
57575
  }
57418
57576
  function putViaNodeHttps(url2, headers, body) {
57419
- return new Promise((resolve21, reject2) => {
57577
+ return new Promise((resolve22, reject2) => {
57420
57578
  const parsed = new URL(url2);
57421
57579
  const req = httpsRequest(
57422
57580
  {
@@ -57433,7 +57591,7 @@ function putViaNodeHttps(url2, headers, body) {
57433
57591
  const chunks = [];
57434
57592
  res.on("data", (chunk) => chunks.push(chunk));
57435
57593
  res.on("end", () => {
57436
- resolve21({
57594
+ resolve22({
57437
57595
  status: res.statusCode ?? 0,
57438
57596
  body: Buffer.concat(chunks).toString("utf8")
57439
57597
  });
@@ -58173,7 +58331,7 @@ function projectsRoutes(deps) {
58173
58331
 
58174
58332
  // ../host/src/modules/taskflow/server/routes/runs.ts
58175
58333
  import { randomUUID as randomUUID4 } from "node:crypto";
58176
- import { resolve as resolve13 } from "node:path";
58334
+ import { resolve as resolve14 } from "node:path";
58177
58335
  import { setTimeout as delay } from "node:timers/promises";
58178
58336
  var CONFLICT_REASONS = [
58179
58337
  "branch_conflict",
@@ -58310,7 +58468,7 @@ async function apiCreateProjectRun(project, body) {
58310
58468
  permissionMode: body.permissionMode ?? "interactive",
58311
58469
  mcpServers: body.mcpServers ?? [],
58312
58470
  projectRoot: projectDir,
58313
- workspaceRoot: resolve13(projectDir, config2.workspace.worktreeRoot),
58471
+ workspaceRoot: resolve14(projectDir, config2.workspace.worktreeRoot),
58314
58472
  baseBranch: config2.workspace.mainBranch,
58315
58473
  baseCommit: git2.currentBranch(projectDir),
58316
58474
  agent: config2.workspace.defaultAgent,
@@ -58346,7 +58504,7 @@ async function apiCreateProjectRun(project, body) {
58346
58504
  snapshot: snapshot.snapshot,
58347
58505
  dataRoot: project.runs.dataRoot,
58348
58506
  projectRoot: projectDir,
58349
- workspaceRoot: resolve13(projectDir, config2.workspace.worktreeRoot),
58507
+ workspaceRoot: resolve14(projectDir, config2.workspace.worktreeRoot),
58350
58508
  baseBranch: config2.workspace.mainBranch,
58351
58509
  baseCommit: git2.currentBranch(projectDir),
58352
58510
  profile,
@@ -58470,9 +58628,9 @@ function runRoutes(deps) {
58470
58628
 
58471
58629
  // ../host/src/modules/taskflow/server/routes/worktrees.ts
58472
58630
  import { mkdirSync as mkdirSync4 } from "node:fs";
58473
- import { writeFile as writeFile5 } from "node:fs/promises";
58631
+ import { writeFile as writeFile6 } from "node:fs/promises";
58474
58632
  import { tmpdir } from "node:os";
58475
- import { join as join13, resolve as resolve14 } from "node:path";
58633
+ import { join as join14, resolve as resolve15 } from "node:path";
58476
58634
 
58477
58635
  // ../host/src/modules/taskflow/services/conversation-export-service.ts
58478
58636
  var TaskflowConversationAttachmentMessageSchema = AgentsUiConversationMessageSchema.extend({
@@ -59177,7 +59335,7 @@ async function apiUploadFiles(project, name, req) {
59177
59335
  }
59178
59336
  const entries = formData.getAll("files");
59179
59337
  if (entries.length === 0) return errorResponse("No files provided", 400);
59180
- const uploadDir = join13(tmpdir(), RUNTIME_IDENTITY.tempUploadDir, sanitizeFilename(name));
59338
+ const uploadDir = join14(tmpdir(), RUNTIME_IDENTITY.tempUploadDir, sanitizeFilename(name));
59181
59339
  mkdirSync4(uploadDir, { recursive: true });
59182
59340
  const results = [];
59183
59341
  for (const entry of entries) {
@@ -59189,11 +59347,11 @@ async function apiUploadFiles(project, name, req) {
59189
59347
  return errorResponse(`File too large: ${entry.name} (max 10MB)`, 400);
59190
59348
  }
59191
59349
  const safeName = `${Date.now()}_${sanitizeFilename(entry.name)}`;
59192
- const destPath = join13(uploadDir, safeName);
59193
- if (!resolve14(destPath).startsWith(`${uploadDir}/`)) {
59350
+ const destPath = join14(uploadDir, safeName);
59351
+ if (!resolve15(destPath).startsWith(`${uploadDir}/`)) {
59194
59352
  return errorResponse("Invalid filename", 400);
59195
59353
  }
59196
- await writeFile5(destPath, new Uint8Array(await entry.arrayBuffer()));
59354
+ await writeFile6(destPath, new Uint8Array(await entry.arrayBuffer()));
59197
59355
  results.push({ path: destPath });
59198
59356
  }
59199
59357
  log.info(`[upload] branch=${name} files=${results.length}`);
@@ -59367,7 +59525,7 @@ function createHostProjects(deps) {
59367
59525
  import { spawn as spawn6 } from "node:child_process";
59368
59526
  import { randomUUID as randomUUID6 } from "node:crypto";
59369
59527
  import { existsSync as existsSync6 } from "node:fs";
59370
- import { dirname as dirname15, join as join28, resolve as resolve20 } from "node:path";
59528
+ import { dirname as dirname15, join as join29, resolve as resolve21 } from "node:path";
59371
59529
  import { fileURLToPath } from "node:url";
59372
59530
 
59373
59531
  // ../host/src/modules/taskflow/adapters/codex-app-server.ts
@@ -59814,8 +59972,8 @@ var CodexAppServerClient = class {
59814
59972
  }
59815
59973
  const id = this.nextId;
59816
59974
  this.nextId += 1;
59817
- const result = await new Promise((resolve21, reject2) => {
59818
- this.pending.set(id, { resolve: resolve21, reject: reject2 });
59975
+ const result = await new Promise((resolve22, reject2) => {
59976
+ this.pending.set(id, { resolve: resolve22, reject: reject2 });
59819
59977
  try {
59820
59978
  this.send({
59821
59979
  id,
@@ -60478,7 +60636,7 @@ function createRunStore(path = defaultRunStorePath()) {
60478
60636
  },
60479
60637
  reserveWorkspace(input2) {
60480
60638
  const strategy = input2.strategy ?? "isolated_worktree";
60481
- const access3 = input2.access ?? "exclusive_write";
60639
+ const access4 = input2.access ?? "exclusive_write";
60482
60640
  const current = selectRun.get(input2.runId);
60483
60641
  if (!current) return { ok: false, reason: "not_found" };
60484
60642
  const run = toRunRecord(current);
@@ -60493,7 +60651,7 @@ function createRunStore(path = defaultRunStorePath()) {
60493
60651
  reserveWorkspace.run({
60494
60652
  ...input2,
60495
60653
  strategy,
60496
- access: access3,
60654
+ access: access4,
60497
60655
  canonicalWorkspacePath: strategy === "isolated_worktree" ? input2.canonicalWorkspacePath : null,
60498
60656
  branch: strategy === "isolated_worktree" ? input2.branch : null,
60499
60657
  checkoutCanonicalPath: strategy === "isolated_worktree" ? null : input2.canonicalWorkspacePath,
@@ -60794,16 +60952,16 @@ var DEFAULTS = {
60794
60952
  };
60795
60953
 
60796
60954
  // ../host/src/modules/taskflow/workflows/runtime/journal.ts
60797
- import { appendFileSync, existsSync as existsSync3, mkdirSync as mkdirSync6, readdirSync as readdirSync2, readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "node:fs";
60798
- import { dirname as dirname12, join as join14 } from "node:path";
60955
+ import { appendFileSync, existsSync as existsSync3, mkdirSync as mkdirSync6, readdirSync as readdirSync2, readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "node:fs";
60956
+ import { dirname as dirname12, join as join15 } from "node:path";
60799
60957
  function dataRoot(roots = {}) {
60800
60958
  return roots.dataRoot ?? globalPaths().root;
60801
60959
  }
60802
60960
  function runDir(runId, roots = {}) {
60803
- return join14(dataRoot(roots), "runs", runId);
60961
+ return join15(dataRoot(roots), "runs", runId);
60804
60962
  }
60805
60963
  function journalPath(runId, roots = {}) {
60806
- return join14(runDir(runId, roots), "journal.jsonl");
60964
+ return join15(runDir(runId, roots), "journal.jsonl");
60807
60965
  }
60808
60966
  function ensureRunDir(runId, roots = {}) {
60809
60967
  const dir = runDir(runId, roots);
@@ -60811,9 +60969,9 @@ function ensureRunDir(runId, roots = {}) {
60811
60969
  return dir;
60812
60970
  }
60813
60971
  function listRunIds(roots = {}) {
60814
- const dir = join14(dataRoot(roots), "runs");
60972
+ const dir = join15(dataRoot(roots), "runs");
60815
60973
  if (!existsSync3(dir)) return [];
60816
- return readdirSync2(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && existsSync3(join14(dir, e.name, "journal.jsonl"))).map((e) => e.name).sort().reverse();
60974
+ return readdirSync2(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && existsSync3(join15(dir, e.name, "journal.jsonl"))).map((e) => e.name).sort().reverse();
60817
60975
  }
60818
60976
  var JournalNotFoundError = class extends Error {
60819
60977
  runId;
@@ -60850,7 +61008,7 @@ var Journal = class {
60850
61008
  const path = journalPath(runId, roots);
60851
61009
  const out = { results: /* @__PURE__ */ new Map(), indexByKey: /* @__PURE__ */ new Map() };
60852
61010
  if (!existsSync3(path)) return out;
60853
- const text = readFileSync6(path, "utf8");
61011
+ const text = readFileSync5(path, "utf8");
60854
61012
  for (const line of text.split("\n")) {
60855
61013
  const trimmed = line.trim();
60856
61014
  if (!trimmed) continue;
@@ -60893,7 +61051,7 @@ function canonicalArgs(value) {
60893
61051
  }
60894
61052
  function writeResult(runId, value, roots = {}) {
60895
61053
  const dir = ensureRunDir(runId, roots);
60896
- writeFileSync3(join14(dir, "result.json"), JSON.stringify(value, null, 2), "utf8");
61054
+ writeFileSync3(join15(dir, "result.json"), JSON.stringify(value, null, 2), "utf8");
60897
61055
  }
60898
61056
 
60899
61057
  // ../host/src/modules/taskflow/workflows/runtime/keys.ts
@@ -61226,7 +61384,7 @@ async function runInSandbox(opts) {
61226
61384
  }
61227
61385
  function raceLifecycle(work, signal, execTimeoutMs) {
61228
61386
  if (!signal && !execTimeoutMs) return work;
61229
- return new Promise((resolve21, reject2) => {
61387
+ return new Promise((resolve22, reject2) => {
61230
61388
  let settled = false;
61231
61389
  let timer;
61232
61390
  const cleanup = () => {
@@ -61257,7 +61415,7 @@ function raceLifecycle(work, signal, execTimeoutMs) {
61257
61415
  timer.unref?.();
61258
61416
  }
61259
61417
  work.then(
61260
- (v) => finish(() => resolve21(v)),
61418
+ (v) => finish(() => resolve22(v)),
61261
61419
  (e) => finish(() => reject2(e))
61262
61420
  );
61263
61421
  });
@@ -61265,13 +61423,13 @@ function raceLifecycle(work, signal, execTimeoutMs) {
61265
61423
 
61266
61424
  // ../host/src/modules/taskflow/workflows/runtime/run.ts
61267
61425
  import { createHash as createHash8, randomBytes as randomBytes2 } from "node:crypto";
61268
- import { readFileSync as readFileSync7, writeFileSync as writeFileSync4 } from "node:fs";
61269
- import { join as join21, resolve as resolve16 } from "node:path";
61426
+ import { readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "node:fs";
61427
+ import { join as join22, resolve as resolve17 } from "node:path";
61270
61428
 
61271
61429
  // ../host/src/modules/taskflow/workflows/worker/claude.ts
61272
61430
  import { readlinkSync, realpathSync as realpathSync2 } from "node:fs";
61273
61431
  import { homedir as homedir3 } from "node:os";
61274
- import { basename as basename7, dirname as dirname13, isAbsolute as isAbsolute3, join as join15, relative as relative3, resolve as resolve15 } from "node:path";
61432
+ import { basename as basename8, dirname as dirname13, isAbsolute as isAbsolute3, join as join16, relative as relative4, resolve as resolve16 } from "node:path";
61275
61433
 
61276
61434
  // ../host/src/modules/taskflow/workflows/worker/index.ts
61277
61435
  var AgentError = class extends Error {
@@ -61663,10 +61821,10 @@ function checkTool(sandbox, cwd, toolName2, input2) {
61663
61821
  return void 0;
61664
61822
  }
61665
61823
  function withinCwd(cwd, candidate) {
61666
- const base = realpathUpward(resolve15(cwd));
61667
- const target = realpathUpward(isAbsolute3(candidate) ? resolve15(candidate) : resolve15(resolve15(cwd), candidate));
61824
+ const base = realpathUpward(resolve16(cwd));
61825
+ const target = realpathUpward(isAbsolute3(candidate) ? resolve16(candidate) : resolve16(resolve16(cwd), candidate));
61668
61826
  if (target === base) return true;
61669
- const rel = relative3(base, target);
61827
+ const rel = relative4(base, target);
61670
61828
  return rel !== "" && !rel.startsWith("..") && !isAbsolute3(rel);
61671
61829
  }
61672
61830
  function realpathUpward(p) {
@@ -61675,18 +61833,18 @@ function realpathUpward(p) {
61675
61833
  for (let hops = 0; hops < 40; hops++) {
61676
61834
  try {
61677
61835
  const real = realpathSync2(existing);
61678
- return suffix ? join15(real, suffix) : real;
61836
+ return suffix ? join16(real, suffix) : real;
61679
61837
  } catch {
61680
61838
  }
61681
61839
  try {
61682
61840
  const link = readlinkSync(existing);
61683
- existing = isAbsolute3(link) ? resolve15(link) : resolve15(dirname13(existing), link);
61841
+ existing = isAbsolute3(link) ? resolve16(link) : resolve16(dirname13(existing), link);
61684
61842
  continue;
61685
61843
  } catch {
61686
61844
  }
61687
61845
  const parent = dirname13(existing);
61688
61846
  if (parent === existing) return p;
61689
- suffix = suffix ? join15(basename7(existing), suffix) : basename7(existing);
61847
+ suffix = suffix ? join16(basename8(existing), suffix) : basename8(existing);
61690
61848
  existing = parent;
61691
61849
  }
61692
61850
  return p;
@@ -61796,7 +61954,7 @@ function unquote(s) {
61796
61954
  }
61797
61955
  function expandHome(p) {
61798
61956
  if (p === "~") return homedir3();
61799
- if (p.startsWith("~/")) return join15(homedir3(), p.slice(2));
61957
+ if (p.startsWith("~/")) return join16(homedir3(), p.slice(2));
61800
61958
  return p;
61801
61959
  }
61802
61960
  function usageFromResult(last) {
@@ -61817,8 +61975,8 @@ function numOr(v) {
61817
61975
  }
61818
61976
 
61819
61977
  // ../host/src/modules/taskflow/workflows/worker/codex.ts
61820
- import { copyFile, writeFile as writeFile6 } from "node:fs/promises";
61821
- import { basename as basename8, join as join16 } from "node:path";
61978
+ import { copyFile, writeFile as writeFile7 } from "node:fs/promises";
61979
+ import { basename as basename9, join as join17 } from "node:path";
61822
61980
 
61823
61981
  // ../host/src/modules/taskflow/workflows/worker/codex-protocol.ts
61824
61982
  function isObject2(value) {
@@ -62071,13 +62229,13 @@ var JsonRpcStdioClient = class {
62071
62229
  * error member, and rejects with a timeout if no response arrives in time.
62072
62230
  */
62073
62231
  request(method, params) {
62074
- return new Promise((resolve21, reject2) => {
62232
+ return new Promise((resolve22, reject2) => {
62075
62233
  if (this.dead || !this.child) {
62076
62234
  reject2(new StdioTransportError("not_writable", "child is not running"));
62077
62235
  return;
62078
62236
  }
62079
62237
  const id = this.allocId();
62080
- const entry = { resolve: resolve21, reject: reject2 };
62238
+ const entry = { resolve: resolve22, reject: reject2 };
62081
62239
  this.pending.set(id, entry);
62082
62240
  if (this.requestTimeoutMs > 0) {
62083
62241
  entry.timer = setTimeout(() => {
@@ -62290,12 +62448,12 @@ var CodexWorker = class {
62290
62448
  runTurn(ctx, sandbox, cwd, turnParams, forwardProgress, seedUsage) {
62291
62449
  const { threadId } = turnParams;
62292
62450
  let onAbort;
62293
- const p = new Promise((resolve21, reject2) => {
62451
+ const p = new Promise((resolve22, reject2) => {
62294
62452
  const state = {
62295
62453
  threadId,
62296
62454
  deltaText: "",
62297
62455
  usage: seedUsage ?? emptyUsage(),
62298
- resolve: resolve21,
62456
+ resolve: resolve22,
62299
62457
  reject: reject2,
62300
62458
  settled: false,
62301
62459
  ctx,
@@ -62566,14 +62724,14 @@ var CodexWorker = class {
62566
62724
  handleImageGeneration(state, item) {
62567
62725
  if (state.sandbox === "read-only") return;
62568
62726
  const rawId = typeof item.id === "string" && item.id.length > 0 ? item.id : "image";
62569
- const id = basename8(rawId) || "image";
62727
+ const id = basename9(rawId) || "image";
62570
62728
  const savedPath = typeof item.savedPath === "string" ? item.savedPath : void 0;
62571
62729
  const b64 = typeof item.result === "string" ? item.result : void 0;
62572
- const dest = join16(state.cwd, `${id}.png`);
62730
+ const dest = join17(state.cwd, `${id}.png`);
62573
62731
  const write2 = (async () => {
62574
62732
  try {
62575
62733
  if (savedPath) await copyFile(savedPath, dest);
62576
- else if (b64) await writeFile6(dest, Buffer.from(b64, "base64"));
62734
+ else if (b64) await writeFile7(dest, Buffer.from(b64, "base64"));
62577
62735
  else return;
62578
62736
  if (state.forwardProgress)
62579
62737
  state.ctx.onProgress({ kind: "tool-result", id, name: "image_generation", output: `saved image \u2192 ${dest}` });
@@ -62879,7 +63037,7 @@ var DEFAULT_STALL_TIMEOUT_MS = 30 * 6e4;
62879
63037
  var DEFAULT_KILL_GRACE_MS = 5e3;
62880
63038
  var DEFAULT_STDERR_LIMIT2 = 16 * 1024;
62881
63039
  function runJsonlSubprocess(o) {
62882
- return new Promise((resolve21, reject2) => {
63040
+ return new Promise((resolve22, reject2) => {
62883
63041
  if (o.signal.aborted) {
62884
63042
  reject2(new AgentInterrupted());
62885
63043
  return;
@@ -62991,7 +63149,7 @@ function runJsonlSubprocess(o) {
62991
63149
  stdoutBuf = "";
62992
63150
  deliver(rest);
62993
63151
  }
62994
- settle(() => resolve21({ code, signal: signal ?? null, stderrTail: stderrBuf.trim() }));
63152
+ settle(() => resolve22({ code, signal: signal ?? null, stderrTail: stderrBuf.trim() }));
62995
63153
  });
62996
63154
  o.signal.addEventListener("abort", onAbort, { once: true });
62997
63155
  touch();
@@ -63337,7 +63495,7 @@ function numOf(v) {
63337
63495
  // ../host/src/modules/taskflow/workflows/worker/pi.ts
63338
63496
  import { mkdtempSync, rmSync as rmSync2 } from "node:fs";
63339
63497
  import { tmpdir as tmpdir2 } from "node:os";
63340
- import { join as join17 } from "node:path";
63498
+ import { join as join18 } from "node:path";
63341
63499
  var PROVIDER3 = "pi";
63342
63500
  var PI_MIN_VERSION = "0.79.1";
63343
63501
  var EFFORT_TO_THINKING = {
@@ -63452,7 +63610,7 @@ var PiWorker = class {
63452
63610
  return this.versionCheck;
63453
63611
  }
63454
63612
  async checkVersion() {
63455
- const scratch = mkdtempSync(join17(tmpdir2(), `${APP_SLUG}-pi-version-`));
63613
+ const scratch = mkdtempSync(join18(tmpdir2(), `${APP_SLUG}-pi-version-`));
63456
63614
  let out;
63457
63615
  try {
63458
63616
  out = await captureStdout({
@@ -63685,7 +63843,7 @@ var DefaultWorkerFactory = class {
63685
63843
  };
63686
63844
 
63687
63845
  // ../host/src/modules/taskflow/workflows/runtime/event-sink.ts
63688
- import { join as join18 } from "node:path";
63846
+ import { join as join19 } from "node:path";
63689
63847
 
63690
63848
  // ../host/src/modules/taskflow/workflows/runtime/jsonl-writer.ts
63691
63849
  import { createWriteStream, mkdirSync as mkdirSync7 } from "node:fs";
@@ -63721,12 +63879,12 @@ var JsonlWriter = class {
63721
63879
  }
63722
63880
  }
63723
63881
  close() {
63724
- return new Promise((resolve21) => {
63882
+ return new Promise((resolve22) => {
63725
63883
  if (this.dead) {
63726
- resolve21();
63884
+ resolve22();
63727
63885
  return;
63728
63886
  }
63729
- this.stream.end(() => resolve21());
63887
+ this.stream.end(() => resolve22());
63730
63888
  });
63731
63889
  }
63732
63890
  };
@@ -63741,7 +63899,7 @@ var FileEventSink = class {
63741
63899
  listeners;
63742
63900
  clock;
63743
63901
  constructor(runId, opts = {}) {
63744
- this.writer = new JsonlWriter(join18(runDir(runId, opts.roots), "events.jsonl"), { flags: "a" });
63902
+ this.writer = new JsonlWriter(join19(runDir(runId, opts.roots), "events.jsonl"), { flags: "a" });
63745
63903
  this.listeners = opts.listeners ?? [];
63746
63904
  this.clock = opts.clock ?? (() => globalThis.Date.now());
63747
63905
  }
@@ -63805,7 +63963,7 @@ var Semaphore = class {
63805
63963
  this.active++;
63806
63964
  return this.makeRelease();
63807
63965
  }
63808
- await new Promise((resolve21) => this.queue.push(resolve21));
63966
+ await new Promise((resolve22) => this.queue.push(resolve22));
63809
63967
  return this.makeRelease();
63810
63968
  }
63811
63969
  makeRelease() {
@@ -63832,15 +63990,15 @@ var Semaphore = class {
63832
63990
  };
63833
63991
 
63834
63992
  // ../host/src/modules/taskflow/workflows/runtime/transcript.ts
63835
- import { join as join19 } from "node:path";
63993
+ import { join as join20 } from "node:path";
63836
63994
  function agentsDir(runId, roots = {}) {
63837
- return join19(runDir(runId, roots), "agents");
63995
+ return join20(runDir(runId, roots), "agents");
63838
63996
  }
63839
63997
  function agentTranscriptPath(runId, index, roots = {}) {
63840
- return join19(agentsDir(runId, roots), `${index}.jsonl`);
63998
+ return join20(agentsDir(runId, roots), `${index}.jsonl`);
63841
63999
  }
63842
64000
  function agentTranscriptPathByName(runId, name, roots = {}) {
63843
- return join19(agentsDir(runId, roots), `${sanitizeName(name)}.jsonl`);
64001
+ return join20(agentsDir(runId, roots), `${sanitizeName(name)}.jsonl`);
63844
64002
  }
63845
64003
  var TEXT_FLUSH_MS = 120;
63846
64004
  var TEXT_FLUSH_BYTES = 2048;
@@ -63922,7 +64080,7 @@ function sanitizeName(name) {
63922
64080
  // ../host/src/modules/taskflow/workflows/runtime/worktree.ts
63923
64081
  import { execFile } from "node:child_process";
63924
64082
  import { existsSync as existsSync4, rmSync as rmSync3 } from "node:fs";
63925
- import { join as join20 } from "node:path";
64083
+ import { join as join21 } from "node:path";
63926
64084
  import { promisify } from "node:util";
63927
64085
  var exec = promisify(execFile);
63928
64086
  var BASE_CONFIG_KEY = RUNTIME_IDENTITY.gitBaseConfigKey;
@@ -63940,10 +64098,10 @@ async function findGitRoot(cwd) {
63940
64098
  async function createWorktree(args) {
63941
64099
  const name = `${args.runId}-${args.index}`;
63942
64100
  const branch = args.branch ?? `aw/${name}`;
63943
- const path = join20(projectPaths(args.gitRoot).worktrees, name);
64101
+ const path = join21(projectPaths(args.gitRoot).worktrees, name);
63944
64102
  const base = await git(args.gitRoot, ["rev-parse", "HEAD"]);
63945
64103
  await pruneStaleWorktree(args.gitRoot, path);
63946
- await git(args.gitRoot, ["worktree", "add", "--detach", path, base]);
64104
+ await git(args.gitRoot, ["worktree", "add", "--relative-paths", "--detach", path, base]);
63947
64105
  await git(path, ["checkout", "-B", branch]);
63948
64106
  try {
63949
64107
  await git(path, ["config", BASE_CONFIG_KEY, base]);
@@ -64663,8 +64821,8 @@ function fmtDur(ms) {
64663
64821
  // ../host/src/modules/taskflow/workflows/runtime/run.ts
64664
64822
  var HEARTBEAT_MS = 5e3;
64665
64823
  async function runWorkflow(opts) {
64666
- const filePath = resolve16(opts.file);
64667
- const source = readFileSync7(filePath, "utf8");
64824
+ const filePath = resolve17(opts.file);
64825
+ const source = readFileSync6(filePath, "utf8");
64668
64826
  const fileHash = sha2562(source);
64669
64827
  const findings = determinismLint(source);
64670
64828
  if (findings.length > 0) {
@@ -64721,7 +64879,7 @@ async function runWorkflow(opts) {
64721
64879
  if (opts.signal?.aborted) ac.abort();
64722
64880
  else opts.signal?.addEventListener("abort", onSig, { once: true });
64723
64881
  events.emit({ type: "run", status: "started", runId, workflowFile: filePath });
64724
- const heartbeatFile = join21(runDir(runId, opts.roots), ".heartbeat");
64882
+ const heartbeatFile = join22(runDir(runId, opts.roots), ".heartbeat");
64725
64883
  const beat = () => {
64726
64884
  try {
64727
64885
  writeFileSync4(heartbeatFile, String(Date.now()));
@@ -64800,7 +64958,7 @@ function resolveDefaults(meta3, opts) {
64800
64958
  effort: o.effort,
64801
64959
  sandbox,
64802
64960
  approval: DEFAULTS.approval,
64803
- cwd: resolve16(configuredCwd ?? process.cwd()),
64961
+ cwd: resolve17(configuredCwd ?? process.cwd()),
64804
64962
  concurrency,
64805
64963
  maxAgents: DEFAULTS.maxAgents,
64806
64964
  maxFanout: DEFAULTS.maxFanout,
@@ -65067,7 +65225,7 @@ var AgentSupervisorClient = class {
65067
65225
  throw new Error("Taskflow runtime supervisor did not become available");
65068
65226
  }
65069
65227
  send(request2) {
65070
- return new Promise((resolve21, reject2) => {
65228
+ return new Promise((resolve22, reject2) => {
65071
65229
  const socket = createConnection2(this.deps.socketPath);
65072
65230
  let data = "";
65073
65231
  socket.setEncoding("utf8");
@@ -65088,7 +65246,7 @@ var AgentSupervisorClient = class {
65088
65246
  }
65089
65247
  try {
65090
65248
  const response = responseResult(JSON.parse(line));
65091
- resolve21(response.result);
65249
+ resolve22(response.result);
65092
65250
  } catch (error61) {
65093
65251
  reject2(error61);
65094
65252
  }
@@ -65711,8 +65869,8 @@ var EnvironmentDiagnosticsService = class {
65711
65869
  return check2("github", "GitHub", "error", true, "GitHub CLI is not authenticated", "Run gh auth login");
65712
65870
  }
65713
65871
  for (const linked of this.deps.config.integrations.github.linkedRepos) {
65714
- const access3 = await this.runCommand(gh, ["repo", "view", linked.repo, "--json", "nameWithOwner"]);
65715
- if (!access3.ok) {
65872
+ const access4 = await this.runCommand(gh, ["repo", "view", linked.repo, "--json", "nameWithOwner"]);
65873
+ if (!access4.ok) {
65716
65874
  return check2(
65717
65875
  "github",
65718
65876
  "GitHub",
@@ -65809,7 +65967,7 @@ var EnvironmentDiagnosticsService = class {
65809
65967
  // ../host/src/modules/taskflow/services/environment-worker-factory.ts
65810
65968
  import { chmodSync as chmodSync2, mkdtempSync as mkdtempSync2, rmSync as rmSync4, writeFileSync as writeFileSync5 } from "node:fs";
65811
65969
  import { tmpdir as tmpdir3 } from "node:os";
65812
- import { join as join22, posix as posix2, relative as relative4 } from "node:path";
65970
+ import { join as join23, posix as posix2, relative as relative5 } from "node:path";
65813
65971
  var executableByProvider = {
65814
65972
  codex: "codex",
65815
65973
  "claude-code": "claude",
@@ -65836,7 +65994,7 @@ var MappedWorkspaceWorker = class {
65836
65994
  }
65837
65995
  };
65838
65996
  function mapAgentSpecToEnvironment(spec, hostWorkspace, containerWorkspace) {
65839
- const suffix = relative4(hostWorkspace, spec.cwd);
65997
+ const suffix = relative5(hostWorkspace, spec.cwd);
65840
65998
  if (suffix.startsWith("..")) {
65841
65999
  throw new Error(`Execution workspace is outside the environment mount: ${spec.cwd}`);
65842
66000
  }
@@ -65857,10 +66015,10 @@ var EnvironmentWorkerFactory = class {
65857
66015
  this.handle = handle;
65858
66016
  const containerWorkspace = handle.workspace.containerPath;
65859
66017
  if (!containerWorkspace) throw new Error(`Environment has no container workspace: ${handle.id}`);
65860
- this.directory = mkdtempSync2(join22(tmpdir3(), "taskflow-environment-workers-"));
66018
+ this.directory = mkdtempSync2(join23(tmpdir3(), "taskflow-environment-workers-"));
65861
66019
  const paths = Object.fromEntries(
65862
66020
  Object.entries(executableByProvider).map(([provider, executable]) => {
65863
- const path = join22(this.directory, provider);
66021
+ const path = join23(this.directory, provider);
65864
66022
  writeFileSync5(path, transport.executableShim(handle, executable), { encoding: "utf8", mode: 448 });
65865
66023
  chmodSync2(path, 448);
65866
66024
  return [provider, path];
@@ -65892,8 +66050,8 @@ var RoutingEnvironmentWorker = class {
65892
66050
  id;
65893
66051
  resolve;
65894
66052
  factoryFor;
65895
- constructor(id, resolve21, factoryFor) {
65896
- this.resolve = resolve21;
66053
+ constructor(id, resolve22, factoryFor) {
66054
+ this.resolve = resolve22;
65897
66055
  this.factoryFor = factoryFor;
65898
66056
  this.id = id;
65899
66057
  }
@@ -65910,8 +66068,8 @@ var RoutingEnvironmentWorkerFactory = class {
65910
66068
  workers = /* @__PURE__ */ new Map();
65911
66069
  resolve;
65912
66070
  onShutdown;
65913
- constructor(resolve21, onShutdown) {
65914
- this.resolve = resolve21;
66071
+ constructor(resolve22, onShutdown) {
66072
+ this.resolve = resolve22;
65915
66073
  this.onShutdown = onShutdown;
65916
66074
  }
65917
66075
  get(id) {
@@ -65937,11 +66095,11 @@ var RoutingEnvironmentWorkerFactory = class {
65937
66095
  };
65938
66096
 
65939
66097
  // ../host/src/modules/taskflow/services/execution-transcript-service.ts
65940
- import { readFile as readFile7 } from "node:fs/promises";
65941
- import { basename as basename9, dirname as dirname14, isAbsolute as isAbsolute4, normalize } from "node:path";
66098
+ import { readFile as readFile8 } from "node:fs/promises";
66099
+ import { basename as basename10, dirname as dirname14, isAbsolute as isAbsolute4, normalize } from "node:path";
65942
66100
 
65943
66101
  // ../host/src/modules/taskflow/services/codex-session-log-service.ts
65944
- import { readFile as readFile6 } from "node:fs/promises";
66102
+ import { readFile as readFile7 } from "node:fs/promises";
65945
66103
  var TOOL_OUTPUT_TRUNCATE_LIMIT = 12e3;
65946
66104
  function readString3(raw2) {
65947
66105
  return typeof raw2 === "string" && raw2.length > 0 ? raw2 : null;
@@ -66202,7 +66360,7 @@ function parseCodexSessionMessages(text) {
66202
66360
  async function readCodexSessionMessages(thread) {
66203
66361
  if (!thread.path) return [];
66204
66362
  try {
66205
- return parseCodexSessionMessages(await readFile6(thread.path, "utf8"));
66363
+ return parseCodexSessionMessages(await readFile7(thread.path, "utf8"));
66206
66364
  } catch {
66207
66365
  return [];
66208
66366
  }
@@ -66218,7 +66376,7 @@ function transcriptPath(value, engineRunId) {
66218
66376
  const path = normalize(candidate);
66219
66377
  const agents = dirname14(path);
66220
66378
  const run = dirname14(agents);
66221
- if (basename9(agents) !== "agents" || basename9(run) !== engineRunId || basename9(dirname14(run)) !== "runs" || !basename9(path).endsWith(".jsonl"))
66379
+ if (basename10(agents) !== "agents" || basename10(run) !== engineRunId || basename10(dirname14(run)) !== "runs" || !basename10(path).endsWith(".jsonl"))
66222
66380
  return null;
66223
66381
  return path;
66224
66382
  }
@@ -66272,7 +66430,7 @@ var ExecutionTranscriptService = class {
66272
66430
  if (path === null) return { ok: false, reason: "unavailable" };
66273
66431
  let bytes;
66274
66432
  try {
66275
- bytes = await readFile7(path);
66433
+ bytes = await readFile8(path);
66276
66434
  } catch (error61) {
66277
66435
  if (error61.code !== "ENOENT") return { ok: false, reason: "unavailable" };
66278
66436
  return { ok: true, response: { executionId, entries: [], nextCursor: 0 } };
@@ -66306,7 +66464,7 @@ var ExecutionTranscriptService = class {
66306
66464
  if (!path) return { ok: false, reason: "unavailable" };
66307
66465
  let text;
66308
66466
  try {
66309
- text = await readFile7(path, "utf8");
66467
+ text = await readFile8(path, "utf8");
66310
66468
  } catch {
66311
66469
  return { ok: false, reason: "unavailable" };
66312
66470
  }
@@ -66892,12 +67050,12 @@ var RunPresentationService = class {
66892
67050
  };
66893
67051
 
66894
67052
  // ../host/src/modules/taskflow/services/run-service.ts
66895
- import { readFile as readFile8 } from "node:fs/promises";
66896
- import { join as join24 } from "node:path";
67053
+ import { readFile as readFile9 } from "node:fs/promises";
67054
+ import { join as join25 } from "node:path";
66897
67055
 
66898
67056
  // ../host/src/modules/taskflow/services/workspace-facade.ts
66899
- import { join as join23 } from "node:path";
66900
- function workspaceBindingFor(runId, projectRoot2, workspaceRoot, baseBranch, baseCommit, workspace, access3) {
67057
+ import { join as join24 } from "node:path";
67058
+ function workspaceBindingFor(runId, projectRoot2, workspaceRoot, baseBranch, baseCommit, workspace, access4) {
66901
67059
  const segment = runId.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "run";
66902
67060
  if (workspace.strategy !== "isolated_worktree") {
66903
67061
  const branch = workspace.strategy === "current_branch" ? "" : workspace.branch?.trim() || `${APP_SLUG}/run-${segment}`;
@@ -66909,11 +67067,11 @@ function workspaceBindingFor(runId, projectRoot2, workspaceRoot, baseBranch, bas
66909
67067
  baseBranch: workspace.strategy === "new_branch" ? workspace.baseBranch?.trim() || baseBranch : baseBranch,
66910
67068
  baseCommit,
66911
67069
  strategy: workspace.strategy,
66912
- access: access3
67070
+ access: access4
66913
67071
  };
66914
67072
  }
66915
67073
  const name = `${APP_SLUG}-run-${segment}`;
66916
- const path = join23(workspaceRoot, name);
67074
+ const path = join24(workspaceRoot, name);
66917
67075
  return {
66918
67076
  workspaceId: `workspace_${runId}`,
66919
67077
  path,
@@ -66922,7 +67080,7 @@ function workspaceBindingFor(runId, projectRoot2, workspaceRoot, baseBranch, bas
66922
67080
  baseBranch: workspace.baseBranch?.trim() || baseBranch,
66923
67081
  baseCommit,
66924
67082
  strategy: workspace.strategy,
66925
- access: access3
67083
+ access: access4
66926
67084
  };
66927
67085
  }
66928
67086
  function slugSegment(value, fallback) {
@@ -66931,7 +67089,7 @@ function slugSegment(value, fallback) {
66931
67089
  function forkBindingFor(run, workspaceRoot, slug2) {
66932
67090
  const runSegment = slugSegment(run.id, "run");
66933
67091
  const forkSegment = slugSegment(slug2, "fork");
66934
- const path = join23(workspaceRoot, `${APP_SLUG}-run-${runSegment}-fork-${forkSegment}`);
67092
+ const path = join24(workspaceRoot, `${APP_SLUG}-run-${runSegment}-fork-${forkSegment}`);
66935
67093
  return {
66936
67094
  workspaceId: `workspace_lease_${run.id}_${forkSegment}`,
66937
67095
  path,
@@ -66983,7 +67141,7 @@ var WorkspaceFacade = class {
66983
67141
  if (run === null) return { ok: false, reason: "not_found" };
66984
67142
  if (run.workspacePolicy === "none") return { ok: true, run, workspace: null, replayed: true };
66985
67143
  const workspace = input2.workspace ?? { strategy: "isolated_worktree" };
66986
- const access3 = input2.access ?? "exclusive_write";
67144
+ const access4 = input2.access ?? "exclusive_write";
66987
67145
  const currentBranch = this.deps.git.currentBranch(input2.projectRoot);
66988
67146
  if (workspace.strategy === "current_branch" && currentBranch.length === 0)
66989
67147
  return { ok: false, reason: "detached_head" };
@@ -66999,7 +67157,7 @@ var WorkspaceFacade = class {
66999
67157
  effectiveBase,
67000
67158
  baseCommit,
67001
67159
  workspace,
67002
- access3
67160
+ access4
67003
67161
  );
67004
67162
  if (workspace.strategy === "current_branch") binding.branch = currentBranch;
67005
67163
  if (workspace.strategy !== "isolated_worktree") {
@@ -67007,7 +67165,7 @@ var WorkspaceFacade = class {
67007
67165
  runId: input2.runId,
67008
67166
  projectId: run.projectId,
67009
67167
  canonicalPath: binding.canonicalPath,
67010
- access: access3,
67168
+ access: access4,
67011
67169
  createdAt: this.now().toISOString()
67012
67170
  });
67013
67171
  if (!claim2.ok) return { ok: false, reason: "checkout_busy" };
@@ -67874,7 +68032,7 @@ var RunService = class {
67874
68032
  root,
67875
68033
  terminal.cursor,
67876
68034
  terminal.type === "completed" ? "completed" : active.cancelling ? "cancelled" : "failed",
67877
- terminal.type === "completed" ? { resultPath: join24(root.dataRoot, "runs", engineRunId, "result.json") } : null
68035
+ terminal.type === "completed" ? { resultPath: join25(root.dataRoot, "runs", engineRunId, "result.json") } : null
67878
68036
  );
67879
68037
  const completedAt = this.now().toISOString();
67880
68038
  if (terminal.type === "completed") {
@@ -67986,7 +68144,7 @@ var RunService = class {
67986
68144
  async completedResult(engineRunId, dataRoot2) {
67987
68145
  try {
67988
68146
  const result = JsonValueSchema.safeParse(
67989
- JSON.parse(await readFile8(join24(dataRoot2, "runs", engineRunId, "result.json"), "utf8"))
68147
+ JSON.parse(await readFile9(join25(dataRoot2, "runs", engineRunId, "result.json"), "utf8"))
67990
68148
  );
67991
68149
  return result.success ? result.data : null;
67992
68150
  } catch {
@@ -68033,12 +68191,12 @@ var RunService = class {
68033
68191
  };
68034
68192
 
68035
68193
  // ../host/src/modules/taskflow/services/session-restore-service.ts
68036
- import { basename as basename10, resolve as resolve17 } from "node:path";
68194
+ import { basename as basename11, resolve as resolve18 } from "node:path";
68037
68195
  function entryBranch(entry) {
68038
- return entry.branch ?? basename10(entry.path);
68196
+ return entry.branch ?? basename11(entry.path);
68039
68197
  }
68040
68198
  function computeOpenBranches(input2) {
68041
- const resolvedProjectDir = resolve17(input2.projectDir);
68199
+ const resolvedProjectDir = resolve18(input2.projectDir);
68042
68200
  const openWindowNames = new Set(
68043
68201
  input2.windows.filter((window) => window.sessionName === input2.sessionName).map((window) => window.windowName)
68044
68202
  );
@@ -68053,7 +68211,7 @@ function buildOpenSessionsState(branches, savedAt) {
68053
68211
  }
68054
68212
  var DEFAULT_SESSION_SNAPSHOT_INTERVAL_MS = 3e4;
68055
68213
  async function saveOpenSessionsSnapshot(deps) {
68056
- const projectRoot2 = resolve17(deps.projectRoot);
68214
+ const projectRoot2 = resolve18(deps.projectRoot);
68057
68215
  const sessionName = buildProjectSessionName(projectRoot2);
68058
68216
  let windows = [];
68059
68217
  try {
@@ -68360,8 +68518,8 @@ var TaskflowDirectSessionService = class {
68360
68518
 
68361
68519
  // ../host/src/modules/taskflow/services/workflow-catalog-service.ts
68362
68520
  import { createHash as createHash9 } from "node:crypto";
68363
- import { readdir as readdir4, readFile as readFile9, stat as stat4 } from "node:fs/promises";
68364
- import { join as join25, resolve as resolve18 } from "node:path";
68521
+ import { readdir as readdir4, readFile as readFile10, stat as stat4 } from "node:fs/promises";
68522
+ import { join as join26, resolve as resolve19 } from "node:path";
68365
68523
  var MAX_WORKFLOW_BYTES = 524288;
68366
68524
  function hash3(value) {
68367
68525
  return `sha256:${createHash9("sha256").update(value).digest("hex")}`;
@@ -68405,9 +68563,9 @@ function duplicateDiagnostic(name, origin) {
68405
68563
  }
68406
68564
  function rootsFor(config2) {
68407
68565
  return [
68408
- { origin: "project", directory: projectPaths(resolve18(config2.projectRoot)).workflows, priority: 0 },
68409
- { origin: "global", directory: join25(resolve18(config2.taskflowHome), PATH_NAMES.workflows), priority: 1 },
68410
- { origin: "builtin", directory: resolve18(config2.builtinRoot), priority: 2 }
68566
+ { origin: "project", directory: projectPaths(resolve19(config2.projectRoot)).workflows, priority: 0 },
68567
+ { origin: "global", directory: join26(resolve19(config2.taskflowHome), PATH_NAMES.workflows), priority: 1 },
68568
+ { origin: "builtin", directory: resolve19(config2.builtinRoot), priority: 2 }
68411
68569
  ];
68412
68570
  }
68413
68571
  var WorkflowCatalogService = class {
@@ -68512,7 +68670,7 @@ var WorkflowCatalogService = class {
68512
68670
  return { candidates, diagnostics, invalidEntries };
68513
68671
  }
68514
68672
  for (const name of names) {
68515
- const path = join25(root.directory, name);
68673
+ const path = join26(root.directory, name);
68516
68674
  try {
68517
68675
  if ((await stat4(path)).size > MAX_WORKFLOW_BYTES) {
68518
68676
  const diagnostic = {
@@ -68525,14 +68683,14 @@ var WorkflowCatalogService = class {
68525
68683
  invalidEntries.push({ status: "invalid", origin: root.origin, path, diagnostic });
68526
68684
  continue;
68527
68685
  }
68528
- const source = await readFile9(path, "utf8");
68686
+ const source = await readFile10(path, "utf8");
68529
68687
  const parsed = parseWorkflow(source);
68530
68688
  const definition = {
68531
- id: `${root.origin}:${hash3(resolve18(path))}`,
68689
+ id: `${root.origin}:${hash3(resolve19(path))}`,
68532
68690
  name: parsed.meta.name,
68533
68691
  description: parsed.meta.description,
68534
68692
  origin: root.origin,
68535
- path: resolve18(path),
68693
+ path: resolve19(path),
68536
68694
  contentHash: hash3(source),
68537
68695
  source,
68538
68696
  metadata: metadataFor(parsed.meta, this.keyVersion),
@@ -68555,7 +68713,7 @@ var WorkflowCatalogService = class {
68555
68713
  };
68556
68714
 
68557
68715
  // ../host/src/modules/taskflow/services/workflow-event-bridge.ts
68558
- import { join as join26 } from "node:path";
68716
+ import { join as join27 } from "node:path";
68559
68717
  function record4(value) {
68560
68718
  if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
68561
68719
  const output2 = {};
@@ -68645,7 +68803,7 @@ function executionFor(run, existing, details, context) {
68645
68803
  key: details.key,
68646
68804
  index: details.index,
68647
68805
  phaseIndex: details.phaseIndex,
68648
- transcriptPath: context ? join26(context.dataRoot, "runs", context.engineRunId, "agents", `${details.index}.jsonl`) : null
68806
+ transcriptPath: context ? join27(context.dataRoot, "runs", context.engineRunId, "agents", `${details.index}.jsonl`) : null
68649
68807
  },
68650
68808
  workspaceId: run.workspaceId,
68651
68809
  input: existing?.input ?? null,
@@ -68705,8 +68863,8 @@ var WorkflowEventBridge = class {
68705
68863
  };
68706
68864
 
68707
68865
  // ../host/src/modules/taskflow/services/workflow-runner.ts
68708
- import { mkdir as mkdir5, writeFile as writeFile7 } from "node:fs/promises";
68709
- import { join as join27 } from "node:path";
68866
+ import { mkdir as mkdir5, writeFile as writeFile8 } from "node:fs/promises";
68867
+ import { join as join28 } from "node:path";
68710
68868
  function envelope(spec, message) {
68711
68869
  return {
68712
68870
  ...message,
@@ -68740,10 +68898,10 @@ var NodeWorkflowRunner = class {
68740
68898
  const pid = process.pid;
68741
68899
  let heartbeat;
68742
68900
  const done = (async () => {
68743
- const runDirectory = join27(spec.spec.dataRoot, "runs", spec.engineRunId);
68901
+ const runDirectory = join28(spec.spec.dataRoot, "runs", spec.engineRunId);
68744
68902
  await mkdir5(runDirectory, { recursive: true });
68745
- const snapshotPath = join27(runDirectory, "workflow.js");
68746
- await writeFile7(snapshotPath, spec.spec.source, "utf8");
68903
+ const snapshotPath = join28(runDirectory, "workflow.js");
68904
+ await writeFile8(snapshotPath, spec.spec.source, "utf8");
68747
68905
  emit(envelope(spec, { type: "started", pid }));
68748
68906
  heartbeat = setInterval(() => {
68749
68907
  emit(envelope(spec, { type: "heartbeat", cursor }));
@@ -69415,16 +69573,16 @@ var WorktreeConversationService = class {
69415
69573
 
69416
69574
  // ../host/src/modules/taskflow/adapters/docker-compose-environment.ts
69417
69575
  import { createHash as createHash10 } from "node:crypto";
69418
- import { existsSync as existsSync5, readFileSync as readFileSync8 } from "node:fs";
69419
- import { resolve as resolve19 } from "node:path";
69576
+ import { existsSync as existsSync5, readFileSync as readFileSync7 } from "node:fs";
69577
+ import { resolve as resolve20 } from "node:path";
69420
69578
  var COMPOSE_FILENAMES = ["compose.yaml", "compose.yml", "docker-compose.yaml", "docker-compose.yml"];
69421
69579
  function composeFile(workspacePath, configured) {
69422
69580
  if (configured) {
69423
- const candidate = resolve19(workspacePath, configured);
69581
+ const candidate = resolve20(workspacePath, configured);
69424
69582
  if (existsSync5(candidate)) return candidate;
69425
69583
  throw new Error(`Docker Compose file does not exist: ${configured}`);
69426
69584
  }
69427
- const found = COMPOSE_FILENAMES.map((file2) => resolve19(workspacePath, file2)).find(existsSync5);
69585
+ const found = COMPOSE_FILENAMES.map((file2) => resolve20(workspacePath, file2)).find(existsSync5);
69428
69586
  if (!found) throw new Error("No Docker Compose file was found");
69429
69587
  return found;
69430
69588
  }
@@ -69445,7 +69603,7 @@ var DockerComposeEnvironmentProvider = class {
69445
69603
  }
69446
69604
  async probe(context) {
69447
69605
  const version2 = await runCaptured(this.runner, { command: "docker", args: ["compose", "version", "--short"] });
69448
- const configs = COMPOSE_FILENAMES.map((file2) => resolve19(context.workspacePath, file2)).filter(existsSync5);
69606
+ const configs = COMPOSE_FILENAMES.map((file2) => resolve20(context.workspacePath, file2)).filter(existsSync5);
69449
69607
  return {
69450
69608
  provider: this.id,
69451
69609
  available: version2.exit.code === 0 && configs.length > 0,
@@ -69456,7 +69614,7 @@ var DockerComposeEnvironmentProvider = class {
69456
69614
  }
69457
69615
  async resolve(context) {
69458
69616
  const file2 = composeFile(context.workspacePath, context.configRef);
69459
- const source = readFileSync8(file2, "utf8");
69617
+ const source = readFileSync7(file2, "utf8");
69460
69618
  return {
69461
69619
  provider: this.id,
69462
69620
  configRef: file2,
@@ -70068,11 +70226,11 @@ var LocalDatagramForwardProvider = class {
70068
70226
  void this.pipeResponse(command.stdout, socket, remote);
70069
70227
  void command.exited.finally(() => commands.delete(command));
70070
70228
  });
70071
- await new Promise((resolve21, reject2) => {
70229
+ await new Promise((resolve22, reject2) => {
70072
70230
  socket.once("error", reject2);
70073
70231
  socket.bind(0, "127.0.0.1", () => {
70074
70232
  socket.off("error", reject2);
70075
- resolve21();
70233
+ resolve22();
70076
70234
  });
70077
70235
  });
70078
70236
  const address = socket.address();
@@ -70096,8 +70254,8 @@ var LocalDatagramForwardProvider = class {
70096
70254
  if (!active) return;
70097
70255
  this.active.delete(endpointId);
70098
70256
  await Promise.all(Array.from(active.commands, (command) => command.kill()));
70099
- await new Promise((resolve21) => {
70100
- active.socket.close(() => resolve21());
70257
+ await new Promise((resolve22) => {
70258
+ active.socket.close(() => resolve22());
70101
70259
  });
70102
70260
  }
70103
70261
  async close() {
@@ -70174,11 +70332,11 @@ var LocalForwardProvider = class {
70174
70332
  }
70175
70333
  });
70176
70334
  });
70177
- await new Promise((resolve21, reject2) => {
70335
+ await new Promise((resolve22, reject2) => {
70178
70336
  server.once("error", reject2);
70179
70337
  server.listen(0, "127.0.0.1", () => {
70180
70338
  server.off("error", reject2);
70181
- resolve21();
70339
+ resolve22();
70182
70340
  });
70183
70341
  });
70184
70342
  const address = server.address();
@@ -70204,8 +70362,8 @@ var LocalForwardProvider = class {
70204
70362
  if (!active) return;
70205
70363
  this.active.delete(endpointId);
70206
70364
  for (const socket of active.sockets) socket.destroy();
70207
- await new Promise((resolve21) => {
70208
- active.server.close(() => resolve21());
70365
+ await new Promise((resolve22) => {
70366
+ active.server.close(() => resolve22());
70209
70367
  });
70210
70368
  }
70211
70369
  async close() {
@@ -70822,13 +70980,13 @@ function createProjectApp(runtime, instancePrefix, host) {
70822
70980
  const workflowEvents = new WorkflowEventBridge({ store: runStore, publisher: runEventPublisher });
70823
70981
  const workspaces = new WorkspaceFacade({ store: runStore, git: git2 });
70824
70982
  const workflowDataRoot = globalPaths().root;
70825
- const supervisorSocket = join28(workflowDataRoot, "runtime", "supervisor.sock");
70983
+ const supervisorSocket = join29(workflowDataRoot, "runtime", "supervisor.sock");
70826
70984
  const supervisor = new AgentSupervisorClient({
70827
70985
  socketPath: supervisorSocket,
70828
70986
  startDaemon: () => {
70829
70987
  const directory = dirname15(fileURLToPath(import.meta.url));
70830
- const builtEntry = join28(directory, "supervisor.js");
70831
- const sourceEntry = join28(directory, "supervisor.ts");
70988
+ const builtEntry = join29(directory, "supervisor.js");
70989
+ const sourceEntry = join29(directory, "supervisor.ts");
70832
70990
  const child = existsSync6(builtEntry) ? spawn6(process.execPath, [builtEntry], { detached: true, stdio: "ignore" }) : spawn6(process.execPath, ["--import", "tsx", sourceEntry], { detached: true, stdio: "ignore" });
70833
70991
  child.unref();
70834
70992
  }
@@ -71114,7 +71272,7 @@ function createProjectApp(runtime, instancePrefix, host) {
71114
71272
  startupEnvs: config2.startupEnvs,
71115
71273
  linkedRepos: config2.integrations.github.linkedRepos.map((lr) => ({
71116
71274
  alias: lr.alias,
71117
- ...lr.dir ? { dir: resolve20(PROJECT_DIR, lr.dir) } : {}
71275
+ ...lr.dir ? { dir: resolve21(PROJECT_DIR, lr.dir) } : {}
71118
71276
  })),
71119
71277
  linearAutoCreateWorktrees: linearAutoCreateEnabled,
71120
71278
  autoRemoveOnMerge: autoRemoveOnMergeEnabled,
@@ -71200,13 +71358,13 @@ function createProjectApp(runtime, instancePrefix, host) {
71200
71358
  }
71201
71359
  }
71202
71360
  async function getWorktreeGitDirs() {
71203
- const gitDirs = /* @__PURE__ */ new Map();
71204
- const projectRoot2 = resolve20(PROJECT_DIR);
71361
+ const gitDirs2 = /* @__PURE__ */ new Map();
71362
+ const projectRoot2 = resolve21(PROJECT_DIR);
71205
71363
  for (const entry of git2.listLiveWorktrees(projectRoot2)) {
71206
71364
  if (entry.bare || sameFsPath(entry.path, projectRoot2) || !entry.branch) continue;
71207
- gitDirs.set(entry.branch, git2.resolveWorktreeGitDir(entry.path));
71365
+ gitDirs2.set(entry.branch, git2.resolveWorktreeGitDir(entry.path));
71208
71366
  }
71209
- return gitDirs;
71367
+ return gitDirs2;
71210
71368
  }
71211
71369
  async function readProjectSnapshot() {
71212
71370
  const linearApiKey = process.env.LINEAR_API_KEY;
@@ -72270,7 +72428,7 @@ function createDaemonTaskflowHost(context) {
72270
72428
  port: hostListen(env2).port,
72271
72429
  workflowBuiltinsDir: taskflowAssets(env2).workflowBuiltinsDir,
72272
72430
  version: env2.PORTTA_VERSION || "0.0.0-local",
72273
- buildDate: true ? "2026-09-17T23:23:40Z" : (/* @__PURE__ */ new Date()).toISOString(),
72431
+ buildDate: true ? "2026-09-18T00:48:59Z" : (/* @__PURE__ */ new Date()).toISOString(),
72274
72432
  environmentStore: createEnvironmentStore(paths.database),
72275
72433
  hostEnvironmentProvider: new HostEnvironmentProvider(),
72276
72434
  devContainerProvider: new DevContainerProvider(),
@@ -72749,7 +72907,7 @@ var readBodyDirect = (request2) => {
72749
72907
  request2[bodyBufferKey] = buffered;
72750
72908
  return Promise.resolve(buffered);
72751
72909
  }
72752
- const promise2 = new Promise((resolve21, reject2) => {
72910
+ const promise2 = new Promise((resolve22, reject2) => {
72753
72911
  const chunks = [];
72754
72912
  let settled = false;
72755
72913
  const finish = (callback) => {
@@ -72767,7 +72925,7 @@ var readBodyDirect = (request2) => {
72767
72925
  else if (recovered === void 0) reject2(error61 ?? normalizeAbortError(request2, incoming));
72768
72926
  else {
72769
72927
  request2[bodyBufferKey] = recovered;
72770
- resolve21(recovered);
72928
+ resolve22(recovered);
72771
72929
  }
72772
72930
  });
72773
72931
  return true;
@@ -72779,7 +72937,7 @@ var readBodyDirect = (request2) => {
72779
72937
  finish(() => {
72780
72938
  const buffer = chunks.length === 1 ? chunks[0] : Buffer.concat(chunks);
72781
72939
  request2[bodyBufferKey] = buffer;
72782
- resolve21(buffer);
72940
+ resolve22(buffer);
72783
72941
  });
72784
72942
  };
72785
72943
  const onError = (error61) => {
@@ -73304,7 +73462,7 @@ var responseViaResponseObject = async (res, outgoing, options = {}) => {
73304
73462
  });
73305
73463
  if (!chunk) {
73306
73464
  if (i === 1) {
73307
- await new Promise((resolve21) => setTimeout(resolve21));
73465
+ await new Promise((resolve22) => setTimeout(resolve22));
73308
73466
  maxReadCount = 3;
73309
73467
  continue;
73310
73468
  }
@@ -73601,8 +73759,8 @@ var SESSION_ABANDON_AFTER_SECONDS = 6 * 60 * 60;
73601
73759
  var INSTRUCTION_MAX_BYTES = 64 * 1024;
73602
73760
 
73603
73761
  // ../core/src/database-config.ts
73604
- import { join as join29 } from "node:path";
73605
- var DATABASE_RELATIVE_PATH = join29("state", "panel", "portta.db");
73762
+ import { join as join30 } from "node:path";
73763
+ var DATABASE_RELATIVE_PATH = join30("state", "panel", "portta.db");
73606
73764
 
73607
73765
  // ../../node_modules/ws/wrapper.mjs
73608
73766
  var import_stream = __toESM(require_stream(), 1);
@@ -73658,7 +73816,7 @@ function ghPath() {
73658
73816
  }
73659
73817
  function runGh2(args, options = {}) {
73660
73818
  const binary = ghPath();
73661
- return new Promise((resolve21, reject2) => {
73819
+ return new Promise((resolve22, reject2) => {
73662
73820
  const child = execFile2(
73663
73821
  binary,
73664
73822
  args,
@@ -73671,7 +73829,7 @@ function runGh2(args, options = {}) {
73671
73829
  env: { ...process.env, GH_PAGER: "cat", NO_COLOR: "1", GH_PROMPT_DISABLED: "1" }
73672
73830
  },
73673
73831
  (error61, stdout, stderr) => {
73674
- if (!error61) return resolve21(stdout);
73832
+ if (!error61) return resolve22(stdout);
73675
73833
  if (error61.killed) {
73676
73834
  return reject2(new ForgeError("timeout", `gh ${args[0]} ${args[1] ?? ""} took longer than ${TIMEOUT_MS / 1e3}s`));
73677
73835
  }
@@ -74134,11 +74292,11 @@ async function startHost(options) {
74134
74292
  const sockets = new import_websocket_server.default({ noServer: true });
74135
74293
  const server = createServer2(getRequestListener(app.fetch));
74136
74294
  server.on("upgrade", createHostUpgrade(options, sockets));
74137
- await new Promise((resolve21, reject2) => {
74295
+ await new Promise((resolve22, reject2) => {
74138
74296
  server.once("error", reject2);
74139
74297
  server.listen(options.port, options.host, () => {
74140
74298
  server.off("error", reject2);
74141
- resolve21();
74299
+ resolve22();
74142
74300
  });
74143
74301
  });
74144
74302
  const address = server.address();
@@ -74149,8 +74307,8 @@ async function startHost(options) {
74149
74307
  close: async () => {
74150
74308
  for (const socket of sockets.clients) socket.close(1001, "the host daemon is shutting down");
74151
74309
  sockets.close();
74152
- await new Promise((resolve21) => {
74153
- server.close(() => resolve21());
74310
+ await new Promise((resolve22) => {
74311
+ server.close(() => resolve22());
74154
74312
  server.closeAllConnections();
74155
74313
  });
74156
74314
  for (const module of options.modules) await module.close?.();