@dotobokuri/fleet-console 1.25.0 → 1.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +2 -2
  2. package/dist/cli.d.ts +2 -2
  3. package/dist/cli.mjs +41 -18
  4. package/dist/client/assets/{_baseUniq-CftO_qma.js → _baseUniq-DDQ9j_k8.js} +1 -1
  5. package/dist/client/assets/{arc-CIUNumHO.js → arc-Bfozxruz.js} +1 -1
  6. package/dist/client/assets/{architectureDiagram-Q4EWVU46-TpVISJv_.js → architectureDiagram-Q4EWVU46-DCTNRtj5.js} +1 -1
  7. package/dist/client/assets/{blockDiagram-DXYQGD6D-iHi0B0P6.js → blockDiagram-DXYQGD6D-CWyPMMVT.js} +1 -1
  8. package/dist/client/assets/{c4Diagram-AHTNJAMY-CYAcFDrF.js → c4Diagram-AHTNJAMY-Rt5eOwFM.js} +1 -1
  9. package/dist/client/assets/channel-CetR928K.js +1 -0
  10. package/dist/client/assets/{chunk-4BX2VUAB-B3Nh-xBT.js → chunk-4BX2VUAB-D4PVI1Vt.js} +1 -1
  11. package/dist/client/assets/{chunk-4TB4RGXK-CDbmqVYQ.js → chunk-4TB4RGXK-C1Oxcig_.js} +1 -1
  12. package/dist/client/assets/{chunk-55IACEB6-DRXIVd03.js → chunk-55IACEB6-Cpo6RFvp.js} +1 -1
  13. package/dist/client/assets/{chunk-EDXVE4YY-b05C0dVN.js → chunk-EDXVE4YY-DbsnZ6G8.js} +1 -1
  14. package/dist/client/assets/{chunk-FMBD7UC4-ByrEd9CG.js → chunk-FMBD7UC4-Dbn5YbUa.js} +1 -1
  15. package/dist/client/assets/{chunk-OYMX7WX6-BpEVT-V-.js → chunk-OYMX7WX6-d2kjzA4y.js} +1 -1
  16. package/dist/client/assets/{chunk-QZHKN3VN-CfdhAAA9.js → chunk-QZHKN3VN-CYgkgTK2.js} +1 -1
  17. package/dist/client/assets/{chunk-YZCP3GAM-Fdx8QRTs.js → chunk-YZCP3GAM-BJU26g8l.js} +1 -1
  18. package/dist/client/assets/classDiagram-6PBFFD2Q-D0UUo5I1.js +1 -0
  19. package/dist/client/assets/classDiagram-v2-HSJHXN6E-D0UUo5I1.js +1 -0
  20. package/dist/client/assets/clone-kWHSuIUT.js +1 -0
  21. package/dist/client/assets/{cose-bilkent-S5V4N54A-D8w9KovE.js → cose-bilkent-S5V4N54A-z-z1o5SL.js} +1 -1
  22. package/dist/client/assets/{dagre-KV5264BT-D4fw7rTF.js → dagre-KV5264BT-BcXLhG5I.js} +1 -1
  23. package/dist/client/assets/{diagram-5BDNPKRD-BRFcBwDM.js → diagram-5BDNPKRD-B-ws82Eu.js} +1 -1
  24. package/dist/client/assets/{diagram-G4DWMVQ6-BKzuEau8.js → diagram-G4DWMVQ6-BmCJvW_F.js} +1 -1
  25. package/dist/client/assets/{diagram-MMDJMWI5-DkqP7aZ4.js → diagram-MMDJMWI5-CpqgkpUs.js} +1 -1
  26. package/dist/client/assets/{diagram-TYMM5635-NelXGAN3.js → diagram-TYMM5635-D9qcELVs.js} +1 -1
  27. package/dist/client/assets/{erDiagram-SMLLAGMA-DHH5btR9.js → erDiagram-SMLLAGMA-CIrLBm_M.js} +1 -1
  28. package/dist/client/assets/{flowDiagram-DWJPFMVM-BmqHUJoi.js → flowDiagram-DWJPFMVM-Cn_vQPc6.js} +1 -1
  29. package/dist/client/assets/{ganttDiagram-T4ZO3ILL-BtmWEvNP.js → ganttDiagram-T4ZO3ILL-B1NSn3FS.js} +1 -1
  30. package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-B64kk9Nb.js → gitGraphDiagram-UUTBAWPF-BoFQ1joe.js} +1 -1
  31. package/dist/client/assets/{graph-CEjP0hvY.js → graph-CxiyRWzn.js} +1 -1
  32. package/dist/client/assets/index-Bf9IE54V.js +380 -0
  33. package/dist/client/assets/index-CjSWaFbs.css +1 -0
  34. package/dist/client/assets/{infoDiagram-42DDH7IO-CaTXrw5R.js → infoDiagram-42DDH7IO-o7pQ1RaC.js} +1 -1
  35. package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-D9-Ds_71.js → ishikawaDiagram-UXIWVN3A-Du1ieZFu.js} +1 -1
  36. package/dist/client/assets/{journeyDiagram-VCZTEJTY-Cv4qWOhs.js → journeyDiagram-VCZTEJTY-seGxI0_P.js} +1 -1
  37. package/dist/client/assets/{kanban-definition-6JOO6SKY-CWBLcIpD.js → kanban-definition-6JOO6SKY-fMx5ietE.js} +1 -1
  38. package/dist/client/assets/{layout-D8eNRDnf.js → layout-BaAXqyYr.js} +1 -1
  39. package/dist/client/assets/{linear-lDifS_HV.js → linear-DMj40Ji6.js} +1 -1
  40. package/dist/client/assets/{mermaid.core-DcGkHMSR.js → mermaid.core-BdlXsBT1.js} +4 -4
  41. package/dist/client/assets/{min-Dz_jFvYt.js → min-s6WtGnlJ.js} +1 -1
  42. package/dist/client/assets/{mindmap-definition-QFDTVHPH-F3RmDOG-.js → mindmap-definition-QFDTVHPH-MCWf_KUb.js} +1 -1
  43. package/dist/client/assets/{pieDiagram-DEJITSTG-B1fDKBcl.js → pieDiagram-DEJITSTG-BLXhYJPc.js} +1 -1
  44. package/dist/client/assets/{quadrantDiagram-34T5L4WZ-D93hlO3O.js → quadrantDiagram-34T5L4WZ-DNh1hAV-.js} +1 -1
  45. package/dist/client/assets/{requirementDiagram-MS252O5E-B4wj4AQL.js → requirementDiagram-MS252O5E-CqG-OGkG.js} +1 -1
  46. package/dist/client/assets/{sankeyDiagram-XADWPNL6-ZRwx77Xd.js → sankeyDiagram-XADWPNL6-CHhecl0F.js} +1 -1
  47. package/dist/client/assets/{sequenceDiagram-FGHM5R23-COMMRNyM.js → sequenceDiagram-FGHM5R23-DVjf5Mte.js} +1 -1
  48. package/dist/client/assets/{stateDiagram-FHFEXIEX-CpBccMyi.js → stateDiagram-FHFEXIEX-SB71u-q-.js} +1 -1
  49. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-BWyhQXqE.js +1 -0
  50. package/dist/client/assets/{timeline-definition-GMOUNBTQ-C44EI_-o.js → timeline-definition-GMOUNBTQ-BiFLtGFX.js} +1 -1
  51. package/dist/client/assets/{vennDiagram-DHZGUBPP-BiBJbCdD.js → vennDiagram-DHZGUBPP-gVVHuVaX.js} +1 -1
  52. package/dist/client/assets/{wardley-RL74JXVD-Dm5-kWNd.js → wardley-RL74JXVD-DmAOySPQ.js} +1 -1
  53. package/dist/client/assets/{wardleyDiagram-NUSXRM2D-BjbesihY.js → wardleyDiagram-NUSXRM2D-CxDohXgj.js} +1 -1
  54. package/dist/client/assets/{xychartDiagram-5P7HB3ND-5P6xhAMr.js → xychartDiagram-5P7HB3ND-CgRIIIEQ.js} +1 -1
  55. package/dist/client/index.html +2 -2
  56. package/dist/fleet-plugins/file-explorer/routes.mjs +1 -1
  57. package/dist/fleet-plugins/terminal/routes.mjs +359 -512
  58. package/package.json +1 -1
  59. package/dist/client/assets/channel-B-2UBgQ_.js +0 -1
  60. package/dist/client/assets/classDiagram-6PBFFD2Q-DiaCSZq-.js +0 -1
  61. package/dist/client/assets/classDiagram-v2-HSJHXN6E-DiaCSZq-.js +0 -1
  62. package/dist/client/assets/clone-Dq4F-r1q.js +0 -1
  63. package/dist/client/assets/index-B3gs6ohi.js +0 -380
  64. package/dist/client/assets/index-DDfl_vPx.css +0 -1
  65. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-UCYrbaKP.js +0 -1
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import * as fs2 from 'fs';
3
3
  import fs2__default, { existsSync, readFileSync, accessSync, constants, mkdtempSync, writeFileSync, mkdirSync, rmSync, chmodSync, renameSync, readdirSync, openSync, closeSync, realpathSync, fstatSync, lstatSync, unlinkSync, statSync } from 'fs';
4
- import * as path29 from 'path';
5
- import path29__default, { dirname } from 'path';
4
+ import * as path28 from 'path';
5
+ import path28__default, { dirname } from 'path';
6
6
  import * as os3 from 'os';
7
7
  import os3__default, { homedir } from 'os';
8
- import crypto4, { randomUUID, createHash } from 'crypto';
9
- import process5 from 'process';
8
+ import crypto3, { randomUUID, createHash } from 'crypto';
9
+ import process4 from 'process';
10
10
  import { EventEmitter } from 'events';
11
11
  import { mkdir, writeFile, access, readFile, stat, readdir, appendFile, rename, rm } from 'fs/promises';
12
12
  import { execFile, spawn, execSync, spawnSync } from 'child_process';
@@ -40,7 +40,7 @@ function normalizePath(path44) {
40
40
  }
41
41
  var FLEET_DATA_DIR_NAME = ".fleet";
42
42
  function getFleetDataDir() {
43
- return path29.join(os3.homedir(), FLEET_DATA_DIR_NAME);
43
+ return path28.join(os3.homedir(), FLEET_DATA_DIR_NAME);
44
44
  }
45
45
  var SECURE_DIR_MODE = 448;
46
46
  var SECURE_FILE_MODE = 384;
@@ -128,7 +128,7 @@ function cleanupTempFiles(dir, prefix, minAgeMs, now) {
128
128
  if (!entry.startsWith(prefix)) {
129
129
  continue;
130
130
  }
131
- const tempPath = path29.join(dir, entry);
131
+ const tempPath = path28.join(dir, entry);
132
132
  try {
133
133
  const stat3 = fs2.lstatSync(tempPath);
134
134
  if (stat3?.isFile() && !stat3.isSymbolicLink() && now - stat3.mtimeMs >= minAgeMs) {
@@ -234,7 +234,7 @@ function writeLockOwner(lockDir, ownerFileName, startedAt) {
234
234
  hostname: os3.hostname(),
235
235
  startedAt
236
236
  };
237
- const ownerPath = path29.join(lockDir, ownerFileName);
237
+ const ownerPath = path28.join(lockDir, ownerFileName);
238
238
  try {
239
239
  fs2.writeFileSync(ownerPath, JSON.stringify(owner), { encoding: "utf-8", mode: 384 });
240
240
  } catch (error51) {
@@ -243,7 +243,7 @@ function writeLockOwner(lockDir, ownerFileName, startedAt) {
243
243
  }
244
244
  }
245
245
  function readLockOwner(lockDir, ownerFileName) {
246
- const ownerPath = path29.join(lockDir, ownerFileName);
246
+ const ownerPath = path28.join(lockDir, ownerFileName);
247
247
  try {
248
248
  return sanitizeLockOwner(JSON.parse(fs2.readFileSync(ownerPath, "utf-8")));
249
249
  } catch (error51) {
@@ -320,7 +320,7 @@ function readAuthStoreFile(filePath) {
320
320
  }
321
321
 
322
322
  // ../../packages/core-infra/src/auth/auth-storage.ts
323
- var DEFAULT_AUTH_PATH = path29.join(getFleetDataDir(), "auth.json");
323
+ var DEFAULT_AUTH_PATH = path28.join(getFleetDataDir(), "auth.json");
324
324
  var AUTH_LOCK_OWNER_FILE_NAME = "owner.json";
325
325
  var AUTH_LOCK_TIMEOUT_MS = 5e3;
326
326
  function createAuthService(deps = {}) {
@@ -376,7 +376,7 @@ function createAuthService(deps = {}) {
376
376
  }
377
377
  },
378
378
  async setApiKey(providerId, key) {
379
- const dir = path29.dirname(authPath);
379
+ const dir = path28.dirname(authPath);
380
380
  ensureSafeDirectory(dir);
381
381
  withAuthLock(authPath, lockDir, () => {
382
382
  const data = fs2.existsSync(authPath) ? readAuthStoreFile(authPath) : {};
@@ -411,7 +411,7 @@ function createDurableJsonStore(deps) {
411
411
  const now = deps.now ?? (() => Date.now());
412
412
  const mode = SECURE_FILE_MODE ;
413
413
  const minAgeMs = deps.tempCleanupMinAgeMs ?? DEFAULT_TEMP_FILE_MIN_AGE_MS;
414
- const dir = path29.dirname(deps.filePath);
414
+ const dir = path28.dirname(deps.filePath);
415
415
  return {
416
416
  path: deps.filePath,
417
417
  load() {
@@ -495,8 +495,8 @@ var LOCK_OWNER_FILE_NAME = "owner";
495
495
  var TEMP_FILE_PREFIX = `.tmp-${GLOBAL_OPTIONS_FILE_NAME}-`;
496
496
  function createGlobalOptionsStore(deps = {}) {
497
497
  const dataDir = deps.dataDir ?? getFleetDataDir();
498
- const optionsPath = path29.join(dataDir, GLOBAL_OPTIONS_FILE_NAME);
499
- const lockDir = path29.join(dataDir, LOCK_DIR_NAME);
498
+ const optionsPath = path28.join(dataDir, GLOBAL_OPTIONS_FILE_NAME);
499
+ const lockDir = path28.join(dataDir, LOCK_DIR_NAME);
500
500
  const store2 = createDurableJsonStore({
501
501
  filePath: optionsPath,
502
502
  lockDir,
@@ -18884,7 +18884,7 @@ function createChildEnv(env, overlay) {
18884
18884
  return child;
18885
18885
  }
18886
18886
  function wrapWindowsShim(resolved, env, platform) {
18887
- if (platform !== "win32" || !WINDOWS_SHIM_EXTENSIONS.has(path29__default.extname(resolved).toLowerCase())) {
18887
+ if (platform !== "win32" || !WINDOWS_SHIM_EXTENSIONS.has(path28__default.extname(resolved).toLowerCase())) {
18888
18888
  return { bin: resolved, prefixArgs: [] };
18889
18889
  }
18890
18890
  rejectCmdExpansionSensitiveShim(resolved);
@@ -18902,13 +18902,13 @@ function forceWindowsArgQuoting(value) {
18902
18902
  return `${value} `;
18903
18903
  }
18904
18904
  function findOnPath(bin, pathValue, pathExts, platform) {
18905
- const pathSeparator = platform === "win32" ? WINDOWS_PATH_SEPARATOR : path29__default.delimiter;
18906
- if (hasPathSeparator(bin, platform) || path29__default.isAbsolute(bin)) {
18905
+ const pathSeparator = platform === "win32" ? WINDOWS_PATH_SEPARATOR : path28__default.delimiter;
18906
+ if (hasPathSeparator(bin, platform) || path28__default.isAbsolute(bin)) {
18907
18907
  return resolveWithExtensions(bin, pathExts, platform);
18908
18908
  }
18909
18909
  for (const entry of pathValue.split(pathSeparator)) {
18910
18910
  const searchDir = entry.length === 0 ? "." : entry;
18911
- const candidate = resolveWithExtensions(path29__default.join(searchDir, bin), pathExts, platform);
18911
+ const candidate = resolveWithExtensions(path28__default.join(searchDir, bin), pathExts, platform);
18912
18912
  if (candidate) {
18913
18913
  return candidate;
18914
18914
  }
@@ -18916,7 +18916,7 @@ function findOnPath(bin, pathValue, pathExts, platform) {
18916
18916
  return void 0;
18917
18917
  }
18918
18918
  function resolveWithExtensions(candidate, pathExts, platform) {
18919
- if (platform !== "win32" || path29__default.extname(candidate).length > 0) {
18919
+ if (platform !== "win32" || path28__default.extname(candidate).length > 0) {
18920
18920
  return isAccessibleExecutable(candidate, platform) ? candidate : void 0;
18921
18921
  }
18922
18922
  for (const ext of pathExts) {
@@ -21662,12 +21662,12 @@ var CodexAppServerConnection = class extends BaseConnection {
21662
21662
  );
21663
21663
  }
21664
21664
  findRolloutPathForThreadId(threadId) {
21665
- const codexHome = this.codexHome ?? this.env.CODEX_HOME ?? path29.join(this.env.HOME ?? "", ".codex");
21665
+ const codexHome = this.codexHome ?? this.env.CODEX_HOME ?? path28.join(this.env.HOME ?? "", ".codex");
21666
21666
  if (!codexHome) {
21667
21667
  return null;
21668
21668
  }
21669
21669
  for (const rootName of ["sessions", "archived_sessions"]) {
21670
- const found = findRolloutPath(path29.join(codexHome, rootName), threadId);
21670
+ const found = findRolloutPath(path28.join(codexHome, rootName), threadId);
21671
21671
  if (found) {
21672
21672
  return found;
21673
21673
  }
@@ -21778,7 +21778,7 @@ function findRolloutPath(root, threadId) {
21778
21778
  return null;
21779
21779
  }
21780
21780
  for (const entry of fs2.readdirSync(root, { withFileTypes: true })) {
21781
- const entryPath = path29.join(root, entry.name);
21781
+ const entryPath = path28.join(root, entry.name);
21782
21782
  if (entry.isDirectory()) {
21783
21783
  const found = findRolloutPath(entryPath, threadId);
21784
21784
  if (found) {
@@ -23498,7 +23498,7 @@ function readRawCarriersOrDefaultStore() {
23498
23498
  return readCarriers();
23499
23499
  }
23500
23500
  function getCarriersFilePath() {
23501
- return path29.join(resolveStoreDir(), FILENAME);
23501
+ return path28.join(resolveStoreDir(), FILENAME);
23502
23502
  }
23503
23503
  function updateCarriers(mutator) {
23504
23504
  withStoreLock(() => {
@@ -23512,7 +23512,7 @@ function updateCarriers(mutator) {
23512
23512
  function withStoreLock(operation) {
23513
23513
  const dir = resolveStoreDir();
23514
23514
  ensureSafeDirectory(dir);
23515
- const lockDir = path29.join(dir, LOCK_DIRNAME);
23515
+ const lockDir = path28.join(dir, LOCK_DIRNAME);
23516
23516
  return withDirectoryLock(
23517
23517
  { lockDir, ownerFileName: LOCK_OWNER_FILENAME },
23518
23518
  operation
@@ -23525,7 +23525,7 @@ function readCarriers() {
23525
23525
  return readCarriersFromDir(resolveStoreDir());
23526
23526
  }
23527
23527
  function readCarriersFromDir(dir) {
23528
- const filePath = path29.join(dir, FILENAME);
23528
+ const filePath = path28.join(dir, FILENAME);
23529
23529
  let fd;
23530
23530
  try {
23531
23531
  const stat3 = fs2.lstatSync(filePath);
@@ -23554,7 +23554,7 @@ function recordLastLocalWriteFingerprint(filePath, generation) {
23554
23554
  }
23555
23555
  function writeCarriers(s) {
23556
23556
  const dir = resolveStoreDir();
23557
- const filePath = path29.join(dir, FILENAME);
23557
+ const filePath = path28.join(dir, FILENAME);
23558
23558
  const next = serializeFleetCarriers(s);
23559
23559
  writeAtomicSync(filePath, `${JSON.stringify(next, null, 2)}
23560
23560
  `, { fsync: false, mode: 420 });
@@ -23579,7 +23579,7 @@ function sanitizeFleetCarriers(value) {
23579
23579
  }
23580
23580
  function unlinkStaleSubagentModeFile(dir) {
23581
23581
  try {
23582
- fs2.unlinkSync(path29.join(dir, STALE_SUBAGENT_MODE_FILENAME));
23582
+ fs2.unlinkSync(path28.join(dir, STALE_SUBAGENT_MODE_FILENAME));
23583
23583
  } catch {
23584
23584
  }
23585
23585
  }
@@ -24783,14 +24783,14 @@ var DispatchContextRegistry = class {
24783
24783
  }
24784
24784
  };
24785
24785
  function normalizeBinding(input) {
24786
- if (!path29__default.isAbsolute(input.cwd)) throw new Error("Dispatch cwd must be absolute.");
24786
+ if (!path28__default.isAbsolute(input.cwd)) throw new Error("Dispatch cwd must be absolute.");
24787
24787
  const backends = [...input.backends].map((backend) => ({ cliType: backend.cliType, protocol: backend.protocol })).sort((left, right) => left.cliType.localeCompare(right.cliType));
24788
24788
  if (backends.length === 0 || new Set(backends.map((backend) => backend.cliType)).size !== backends.length) {
24789
24789
  throw new Error("Dispatch binding must contain each backend exactly once.");
24790
24790
  }
24791
24791
  return Object.freeze({
24792
24792
  carrierId: input.carrierId,
24793
- cwd: path29__default.normalize(input.cwd),
24793
+ cwd: path28__default.normalize(input.cwd),
24794
24794
  shape: input.shape,
24795
24795
  backends: Object.freeze(backends)
24796
24796
  });
@@ -30588,7 +30588,7 @@ function specToMcpTool(spec) {
30588
30588
  }
30589
30589
  function installExecutorToolCallRouter(runtime, sessionToken, ctx) {
30590
30590
  runtime.server.setOnToolCallArrived(sessionToken, (toolName, args) => {
30591
- const toolCallId = crypto4.randomUUID();
30591
+ const toolCallId = crypto3.randomUUID();
30592
30592
  void runtime.registry.invoke(toolName, args, { cwd: ctx.cwd, sessionLabel: ctx.sessionLabel, toolCallId, signal: ctx.signal }).then((result) => runtime.server.resolveNextToolCall(sessionToken, toolCallId, result)).catch((err) => {
30593
30593
  runtime.server.resolveNextToolCall(sessionToken, toolCallId, {
30594
30594
  content: [{ type: "text", text: err instanceof Error ? err.message : String(err) }],
@@ -30976,7 +30976,7 @@ function createInProcessMcpServer(deps = {}) {
30976
30976
  if (activeStopPromise) await activeStopPromise;
30977
30977
  if (activeServer && activeServerUrl) return activeServerUrl;
30978
30978
  if (activeStartPromise) return activeStartPromise;
30979
- activeOpaquePath = `/${crypto4.randomUUID()}`;
30979
+ activeOpaquePath = `/${crypto3.randomUUID()}`;
30980
30980
  activeStartPromise = new Promise((resolve2, reject) => {
30981
30981
  const srv = http.createServer(handleRequest);
30982
30982
  srv.timeout = MCP_SERVER_TIMEOUT_MS;
@@ -31233,7 +31233,7 @@ function createExecutorMcpSession(deps, toolTimeoutSeconds, request) {
31233
31233
  throw new Error("Executor session cwd is required");
31234
31234
  }
31235
31235
  assertNonEmptyExecutorTools(request.serverName, request.specs);
31236
- const token = crypto4.randomUUID();
31236
+ const token = crypto3.randomUUID();
31237
31237
  registerExecutorSessionTools(runtime.runtime, token, [...request.specs]);
31238
31238
  installExecutorToolCallRouter(runtime.runtime, token, {
31239
31239
  cwd,
@@ -31271,7 +31271,7 @@ function issueSessionToken(deps, sessionTokensByLabel, request) {
31271
31271
  for (const { name, runtime } of deps.runtimes) {
31272
31272
  const tools = runtime.registry.getAllAgentTools();
31273
31273
  assertNonEmptyExecutorTools(name, tools);
31274
- const token = crypto4.randomUUID();
31274
+ const token = crypto3.randomUUID();
31275
31275
  registerExecutorSessionTools(runtime, token, tools);
31276
31276
  installExecutorToolCallRouter(runtime, token, { cwd, sessionLabel: label, signal: request.signal });
31277
31277
  tokens.push({ name, token });
@@ -32705,7 +32705,7 @@ function resolveDispatchCwd(rawCwd, fallbackCwd) {
32705
32705
  if (rawCwd === void 0) return { ok: true, cwd: fallbackCwd };
32706
32706
  const trimmed = rawCwd.trim();
32707
32707
  if (trimmed.length === 0) return { ok: true, cwd: fallbackCwd };
32708
- if (!path29__default.isAbsolute(trimmed)) {
32708
+ if (!path28__default.isAbsolute(trimmed)) {
32709
32709
  return {
32710
32710
  ok: false,
32711
32711
  error: `Invalid cwd "${rawCwd}": must be an absolute path. Provide an absolute directory or omit cwd to use the host session cwd.`
@@ -33327,6 +33327,7 @@ var codexCli = {
33327
33327
  label: "Codex",
33328
33328
  messagePolicy: {
33329
33329
  bracketedPaste: true,
33330
+ conptyPasteBurst: true,
33330
33331
  lineTerminator: "\r",
33331
33332
  multilineStrategy: "paste-mode"
33332
33333
  },
@@ -33343,39 +33344,11 @@ function buildModelArgs2(model) {
33343
33344
  return model === void 0 ? [] : ["--model", model];
33344
33345
  }
33345
33346
 
33346
- // ../../packages/fleet-admiral/src/agent-cli/cursor/cursor.ts
33347
- var cursorCli = {
33348
- id: "cursor",
33349
- label: "Cursor",
33350
- async createProfile(options) {
33351
- const { bin, prefixArgs } = resolveBinary("cursor-agent", "CURSOR_AGENT_BIN", options.env);
33352
- return {
33353
- args: [...prefixArgs, ...buildModelArgs3(options.model)],
33354
- bin,
33355
- binPrefixArgs: prefixArgs,
33356
- cwd: options.cwd,
33357
- env: createChildEnv(options.env, {}),
33358
- id: "cursor",
33359
- label: "Cursor",
33360
- messagePolicy: {
33361
- bracketedPaste: true,
33362
- lineTerminator: "\r",
33363
- multilineStrategy: "paste-mode"
33364
- },
33365
- terminalName: "xterm-256color"
33366
- };
33367
- }
33368
- };
33369
- function buildModelArgs3(model) {
33370
- return model === void 0 ? [] : ["--model", model];
33371
- }
33372
-
33373
33347
  // ../../packages/fleet-admiral/src/agent-cli/registry.ts
33374
33348
  var DEFAULT_CLI_ID = "claude";
33375
33349
  var DEFINITIONS = {
33376
33350
  claude: claudeCli,
33377
- codex: codexCli,
33378
- cursor: cursorCli
33351
+ codex: codexCli
33379
33352
  };
33380
33353
  async function resolveAgentCliProfile(env, cwd, options = {}) {
33381
33354
  const id = resolveAgentCliId(env, options);
@@ -33420,10 +33393,6 @@ var AGENT_CLI_INJECTION_CAPABILITIES = {
33420
33393
  codex: {
33421
33394
  builderId: "codex-native",
33422
33395
  enabled: true
33423
- },
33424
- cursor: {
33425
- builderId: "cursor-native",
33426
- enabled: true
33427
33396
  }
33428
33397
  };
33429
33398
  function getAgentCliInjectionCapability(cliId) {
@@ -33439,7 +33408,7 @@ function createSessionCaptureHookExec(deps) {
33439
33408
  deps.provider
33440
33409
  ] : [deps.entryPath, "hook", "capture-session", deps.provider];
33441
33410
  return {
33442
- command: deps.execPath ?? process5.execPath,
33411
+ command: deps.execPath ?? process4.execPath,
33443
33412
  args
33444
33413
  };
33445
33414
  }
@@ -33478,6 +33447,8 @@ function requireSystemPromptFile(context) {
33478
33447
  if (context.systemPromptFile) return context.systemPromptFile;
33479
33448
  throw new Error("Claude system prompt file is required for native injection");
33480
33449
  }
33450
+
33451
+ // ../../packages/fleet-admiral/src/agent-cli/builders/toml.ts
33481
33452
  var TOML_BASIC_STRING_ESCAPE_PATTERN = /[\u0000-\u001f"\\\u007f]/g;
33482
33453
  var TOML_MULTILINE_CONTROL_PATTERN = new RegExp("[\\u0000-\\u0008\\u000b-\\u001f\\u007f]", "g");
33483
33454
  var TOML_MULTILINE_QUOTE_RUN_PATTERN = /"+/g;
@@ -33521,7 +33492,7 @@ function escapeTomlMultilineString(value) {
33521
33492
  function buildPosixShellCommand(values) {
33522
33493
  return values.map(posixShellQuote).join(" ");
33523
33494
  }
33524
- function buildHostShellCommand(values, platform = process5.platform) {
33495
+ function buildHostShellCommand(values, platform = process.platform) {
33525
33496
  if (platform === "win32") return values.map(windowsShellQuote).join(" ");
33526
33497
  return buildPosixShellCommand(values);
33527
33498
  }
@@ -33571,24 +33542,6 @@ function requireCodexProfileName(context) {
33571
33542
  throw new Error("Codex profile name is required for native injection");
33572
33543
  }
33573
33544
 
33574
- // ../../packages/fleet-admiral/src/agent-cli/builders/cursor.ts
33575
- function buildCursorNativeArgs(context) {
33576
- return [
33577
- ...buildResumeArgs4(context.resumeSessionId),
33578
- ...context.pluginRoots.flatMap((pluginRoot) => [
33579
- "--plugin-dir",
33580
- pluginRoot
33581
- ]),
33582
- "--sandbox",
33583
- "disabled",
33584
- "--force",
33585
- ...context.mcpServers.length > 0 ? ["--approve-mcps"] : []
33586
- ];
33587
- }
33588
- function buildResumeArgs4(resumeSessionId) {
33589
- return resumeSessionId === void 0 ? [] : ["--resume", resumeSessionId];
33590
- }
33591
-
33592
33545
  // ../../packages/fleet-admiral/src/agent-cli/assets.generated.ts
33593
33546
  var EMBEDDED_AGENT_CLI_SKILL_ASSETS = [
33594
33547
  { relativePath: "assumption-audit/SKILL.md", content: "---\nname: assumption-audit\ndescription: Resolve decision-shaped blocking gaps one at a time \u2014 Context Confidence gate failures during an active protocol, or pre-engagement requirements ambiguity routed by the Command Integrity Standing Order.\n---\n\nUse this auxiliary skill only when a decision-shaped blocking gap has been found: either the active protocol or Context Confidence re-entry path surfaced it, or the Command Integrity Standing Order routed a pre-engagement requirements ambiguity here before a protocol mode loads. This skill is not a protocol mode, does not replace the active protocol, and cannot declare the planning boundary passed by itself.\n\nFor each unresolved blocking gap, triage the gap before questioning:\n\n- **Scout-shaped**: the answer should come from direct file reads, focused reconnaissance, carrier scouting, or another verifiable evidence source. Send the workflow back to that evidence-gathering path instead of asking the user to decide.\n- **Decision-shaped**: the answer depends on preference, scope, risk appetite, product intent, or authority that evidence alone cannot settle. Ask exactly one question for this gap.\n- **Escalation-shaped**: the answer requires authority beyond the current operator, changes the mission boundary, repeatedly fails to resolve, or would weaken the active protocol's required gate. Escalate to the user.\n\nWhen a gap is decision-shaped, ask one question at a time. Present your recommended answer first, then give one or two concrete alternatives when useful. Walk decision dependencies one branch at a time until the current gap is resolved; do not bundle unrelated gaps into the same question.\n\nAfter the gap is answered, report the resolved decision in one short line and return control to the caller: the active protocol or Context Confidence Standing Order on re-entry, or the Protocol Gate when invoked pre-engagement. An active workflow must re-evaluate confidence and re-apply the required planning boundary gate before planning proceeds.\n" },
@@ -33612,7 +33565,7 @@ function writePrivateJson(filePath, value, rootBase) {
33612
33565
  function writePrivateFile(filePath, content, rootBase) {
33613
33566
  const resolvedBase = ensureRootBase(rootBase);
33614
33567
  ensurePathWithinRoot(resolvedBase, filePath);
33615
- ensureDirectorySegments(resolvedBase, path29__default.dirname(filePath));
33568
+ ensureDirectorySegments(resolvedBase, path28__default.dirname(filePath));
33616
33569
  writeFileNoFollow(filePath, content);
33617
33570
  chmodBestEffort(filePath, FILE_MODE);
33618
33571
  }
@@ -33659,20 +33612,20 @@ function writeFileNoFollow(filePath, content) {
33659
33612
  }
33660
33613
  }
33661
33614
  function ensureRootBase(rootBase) {
33662
- const resolvedBase = path29__default.resolve(rootBase);
33663
- const anchor = findExistingDirectoryAnchor(path29__default.dirname(resolvedBase));
33615
+ const resolvedBase = path28__default.resolve(rootBase);
33616
+ const anchor = findExistingDirectoryAnchor(path28__default.dirname(resolvedBase));
33664
33617
  ensureDirectorySegments(anchor, resolvedBase);
33665
33618
  assertDirectorySafe(resolvedBase, "Plugin root base");
33666
33619
  return resolvedBase;
33667
33620
  }
33668
33621
  function assertRootBaseSafe(rootBase) {
33669
- const resolvedBase = path29__default.resolve(rootBase);
33670
- assertExistingSegmentsSafe(findExistingDirectoryAnchor(path29__default.dirname(resolvedBase)), resolvedBase);
33622
+ const resolvedBase = path28__default.resolve(rootBase);
33623
+ assertExistingSegmentsSafe(findExistingDirectoryAnchor(path28__default.dirname(resolvedBase)), resolvedBase);
33671
33624
  assertDirectorySafe(resolvedBase, "Plugin root base");
33672
33625
  return resolvedBase;
33673
33626
  }
33674
33627
  function findExistingDirectoryAnchor(targetPath) {
33675
- const resolvedTarget = path29__default.resolve(targetPath);
33628
+ const resolvedTarget = path28__default.resolve(targetPath);
33676
33629
  let current = resolvedTarget;
33677
33630
  while (true) {
33678
33631
  try {
@@ -33680,7 +33633,7 @@ function findExistingDirectoryAnchor(targetPath) {
33680
33633
  return current;
33681
33634
  } catch (error51) {
33682
33635
  if (error51 instanceof Error && "code" in error51 && error51.code === "ENOENT") {
33683
- const parent = path29__default.dirname(current);
33636
+ const parent = path28__default.dirname(current);
33684
33637
  if (parent === current) throw error51;
33685
33638
  current = parent;
33686
33639
  continue;
@@ -33699,17 +33652,17 @@ function assertDirectorySafe(dirPath, label) {
33699
33652
  }
33700
33653
  }
33701
33654
  function ensurePathWithinRoot(resolvedBase, candidatePath) {
33702
- const resolvedCandidate = path29__default.resolve(candidatePath);
33703
- const relative = path29__default.relative(resolvedBase, resolvedCandidate);
33704
- if (relative === "" || !relative.startsWith("..") && !path29__default.isAbsolute(relative)) return;
33655
+ const resolvedCandidate = path28__default.resolve(candidatePath);
33656
+ const relative = path28__default.relative(resolvedBase, resolvedCandidate);
33657
+ if (relative === "" || !relative.startsWith("..") && !path28__default.isAbsolute(relative)) return;
33705
33658
  throw new Error(`Plugin path escapes root base: ${candidatePath}`);
33706
33659
  }
33707
33660
  function ensureDirectorySegments(resolvedBase, dirPath) {
33708
- const target = path29__default.resolve(dirPath);
33709
- const relative = path29__default.relative(resolvedBase, target);
33661
+ const target = path28__default.resolve(dirPath);
33662
+ const relative = path28__default.relative(resolvedBase, target);
33710
33663
  let current = resolvedBase;
33711
- for (const segment of relative.split(path29__default.sep).filter(Boolean)) {
33712
- current = path29__default.join(current, segment);
33664
+ for (const segment of relative.split(path28__default.sep).filter(Boolean)) {
33665
+ current = path28__default.join(current, segment);
33713
33666
  try {
33714
33667
  const stat3 = lstatSync(current);
33715
33668
  if (stat3.isSymbolicLink()) {
@@ -33730,11 +33683,11 @@ function ensureDirectorySegments(resolvedBase, dirPath) {
33730
33683
  }
33731
33684
  }
33732
33685
  function assertExistingSegmentsSafe(resolvedBase, targetPath) {
33733
- const target = path29__default.resolve(targetPath);
33734
- const relative = path29__default.relative(resolvedBase, target);
33686
+ const target = path28__default.resolve(targetPath);
33687
+ const relative = path28__default.relative(resolvedBase, target);
33735
33688
  let current = resolvedBase;
33736
- for (const segment of relative.split(path29__default.sep).filter(Boolean)) {
33737
- current = path29__default.join(current, segment);
33689
+ for (const segment of relative.split(path28__default.sep).filter(Boolean)) {
33690
+ current = path28__default.join(current, segment);
33738
33691
  const stat3 = lstatSync(current);
33739
33692
  if (stat3.isSymbolicLink()) {
33740
33693
  throw new Error(`Plugin path segment is a symlink: ${current}`);
@@ -33746,67 +33699,16 @@ function assertExistingSegmentsSafe(resolvedBase, targetPath) {
33746
33699
  }
33747
33700
  }
33748
33701
  function assertExistingParentSegmentsSafe(resolvedBase, targetPath) {
33749
- assertExistingSegmentsSafe(resolvedBase, path29__default.dirname(targetPath));
33702
+ assertExistingSegmentsSafe(resolvedBase, path28__default.dirname(targetPath));
33750
33703
  }
33751
33704
  function assertSegmentRealpathWithinRoot(resolvedBase, segmentPath) {
33752
33705
  const baseRealpath = realpathSync(resolvedBase);
33753
33706
  const segmentRealpath = realpathSync(segmentPath);
33754
- const relative = path29__default.relative(baseRealpath, segmentRealpath);
33755
- if (relative === "" || !relative.startsWith("..") && !path29__default.isAbsolute(relative)) return;
33707
+ const relative = path28__default.relative(baseRealpath, segmentRealpath);
33708
+ if (relative === "" || !relative.startsWith("..") && !path28__default.isAbsolute(relative)) return;
33756
33709
  throw new Error(`Plugin path segment escapes root base: ${segmentPath}`);
33757
33710
  }
33758
33711
 
33759
- // ../../packages/fleet-admiral/src/agent-cli/doctrine-hook.ts
33760
- var DOCTRINE_FILE_NAME = "doctrine.md";
33761
- var DOCTRINE_HOOK_SCRIPT_NAME = "inject-doctrine.mjs";
33762
- var CURSOR_DOCTRINE_PREAMBLE = `# Fleet Runtime Doctrine for Cursor Agent
33763
-
33764
- You are running as Cursor Agent inside Fleet. This context was injected through a Fleet sessionStart hook. Treat the embedded Fleet system prompt below as your active Fleet runtime doctrine.
33765
-
33766
- Priority and interpretation:
33767
-
33768
- - Follow higher-priority platform, system, developer, and direct user instructions first.
33769
- - Within Cursor rules, project instructions, and other same-layer guidance, this Fleet doctrine is the governing instruction set for Fleet identity, roles, workflow, carrier operations, and reporting.
33770
- - Treat Fleet identity and role names from the embedded prompt as the identity anchor for this session. Do not replace them with generic Cursor Agent identity when answering, planning, or delegating.
33771
- - Do not treat this document as optional background or reference material. Apply it continuously when deciding who you are, how Fleet roles are named, which protocol applies, and how to report work.
33772
- - Do not merely summarize or acknowledge the embedded prompt. Execute the operational requirements it defines, including protocol selection, evidence thresholds, carrier routing, and result reporting.
33773
- - If other same-layer Cursor rules conflict with this doctrine, preserve the Fleet doctrine unless the user's latest explicit instruction requires a narrower task-specific exception.
33774
- - When unsure whether a Fleet instruction applies, prefer following the Fleet doctrine and briefly surface the uncertainty instead of silently ignoring it.
33775
-
33776
- ## Embedded Fleet System Prompt
33777
-
33778
- The following block is the Fleet system prompt content adapted for Cursor hook injection. It is intentionally embedded verbatim after this wrapper.
33779
-
33780
- <fleet-system-prompt>
33781
- `;
33782
- var CURSOR_DOCTRINE_FOOTER = `
33783
- </fleet-system-prompt>
33784
- `;
33785
- var INJECT_DOCTRINE_HOOK_SCRIPT = `import fs from "node:fs";
33786
- import path from "node:path";
33787
- import { fileURLToPath } from "node:url";
33788
-
33789
- const pluginRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
33790
- const doctrine = fs.readFileSync(path.join(pluginRoot, "${DOCTRINE_FILE_NAME}"), "utf8");
33791
- process.stdout.write(JSON.stringify({ additional_context: doctrine }));
33792
- `;
33793
- function formatCursorDoctrine(doctrine) {
33794
- return `${CURSOR_DOCTRINE_PREAMBLE}${doctrine}${CURSOR_DOCTRINE_FOOTER}`;
33795
- }
33796
- function renderCursorDoctrineHookAssets(pluginRoot, doctrine, hookCommandRoot = pluginRoot) {
33797
- writePrivateFile(
33798
- path29__default.join(pluginRoot, DOCTRINE_FILE_NAME),
33799
- formatCursorDoctrine(doctrine),
33800
- pluginRoot
33801
- );
33802
- const scriptPath = path29__default.join(hookCommandRoot, "hooks", DOCTRINE_HOOK_SCRIPT_NAME);
33803
- writePrivateFile(path29__default.join(pluginRoot, "hooks", DOCTRINE_HOOK_SCRIPT_NAME), INJECT_DOCTRINE_HOOK_SCRIPT, pluginRoot);
33804
- return {
33805
- command: process.execPath,
33806
- args: [scriptPath]
33807
- };
33808
- }
33809
-
33810
33712
  // ../../packages/fleet-admiral/src/agent-cli/plugin/fleet.ts
33811
33713
  var assetBundle = {
33812
33714
  description: "Fleet carrier delegation and wiki evidence plugin",
@@ -33818,16 +33720,8 @@ var assetBundle = {
33818
33720
  };
33819
33721
  function renderAssetPluginRoot(pluginRoot, bundle, options) {
33820
33722
  renderEmbeddedSkillAssets(pluginRoot);
33821
- const doctrineHookExec = options.cliId === "cursor" && options.doctrine !== void 0 ? renderCursorDoctrineHookAssets(
33822
- pluginRoot,
33823
- options.doctrine,
33824
- options.installedPluginRoot ?? pluginRoot
33825
- ) : void 0;
33826
33723
  if (options.cliId === "claude") {
33827
- writePrivateJson(path29__default.join(pluginRoot, "hooks", "hooks.json"), claudeHooks(options), pluginRoot);
33828
- }
33829
- if (options.cliId === "cursor") {
33830
- renderCursorPluginRoot(pluginRoot, options, doctrineHookExec);
33724
+ writePrivateJson(path28__default.join(pluginRoot, "hooks", "hooks.json"), claudeHooks(options), pluginRoot);
33831
33725
  }
33832
33726
  }
33833
33727
  function claudeHooks(options) {
@@ -33868,53 +33762,9 @@ function claudeCommandHook(hookExec) {
33868
33762
  type: "command"
33869
33763
  };
33870
33764
  }
33871
- function renderCursorPluginRoot(pluginRoot, options, doctrineHookExec) {
33872
- if ((options.mcpServers ?? []).length > 0) {
33873
- writePrivateJson(path29__default.join(pluginRoot, "mcp.json"), cursorMcpConfig(options.mcpServers ?? []), pluginRoot);
33874
- }
33875
- const hooks = cursorHooks(options, doctrineHookExec);
33876
- if (hooks !== void 0) {
33877
- writePrivateJson(path29__default.join(pluginRoot, "hooks", "hooks.json"), hooks, pluginRoot);
33878
- }
33879
- }
33880
- function cursorMcpConfig(servers) {
33881
- return {
33882
- mcpServers: Object.fromEntries(
33883
- servers.map((server) => [server.name, {
33884
- type: "http",
33885
- url: server.endpointUrl,
33886
- headers: {
33887
- Authorization: `Bearer ${server.bearerToken}`
33888
- }
33889
- }])
33890
- )
33891
- };
33892
- }
33893
- function cursorHooks(options, doctrineHookExec) {
33894
- const sessionStartExecs = [doctrineHookExec, options.captureSessionHookExec].filter((exec) => exec !== void 0);
33895
- const beforeSubmitPromptExecs = [options.turnStartHookExec, options.autoNameHookExec].filter((exec) => exec !== void 0);
33896
- const stopExecs = [options.turnEndHookExec].filter((exec) => exec !== void 0);
33897
- if (sessionStartExecs.length === 0 && beforeSubmitPromptExecs.length === 0 && stopExecs.length === 0) return void 0;
33898
- return {
33899
- version: 1,
33900
- hooks: {
33901
- ...sessionStartExecs.length > 0 ? {
33902
- sessionStart: sessionStartExecs.map((exec) => cursorCommandHook(exec))
33903
- } : {},
33904
- ...beforeSubmitPromptExecs.length > 0 ? { beforeSubmitPrompt: beforeSubmitPromptExecs.map((exec) => cursorCommandHook(exec)) } : {},
33905
- ...stopExecs.length > 0 ? { stop: stopExecs.map((exec) => cursorCommandHook(exec)) } : {}
33906
- }
33907
- };
33908
- }
33909
- function cursorCommandHook(hookExec, extraArgs = []) {
33910
- return {
33911
- type: "command",
33912
- command: buildHostShellCommand([hookExec.command, ...hookExec.args, ...extraArgs])
33913
- };
33914
- }
33915
33765
  function renderEmbeddedSkillAssets(pluginRoot) {
33916
33766
  for (const asset of EMBEDDED_AGENT_CLI_SKILL_ASSETS) {
33917
- writePrivateFile(path29__default.join(pluginRoot, "skills", asset.relativePath), asset.content, pluginRoot);
33767
+ writePrivateFile(path28__default.join(pluginRoot, "skills", asset.relativePath), asset.content, pluginRoot);
33918
33768
  }
33919
33769
  }
33920
33770
  var CONFIG_FILE_NAME = "config.toml";
@@ -33929,7 +33779,7 @@ function neutralizeCodexFleetPluginConfig(options) {
33929
33779
  mutateCodexConfigWithRetry(options, 0);
33930
33780
  }
33931
33781
  function mutateCodexConfigWithRetry(options, attempt) {
33932
- const configPath = path29__default.join(options.codexHome, CONFIG_FILE_NAME);
33782
+ const configPath = path28__default.join(options.codexHome, CONFIG_FILE_NAME);
33933
33783
  const targetPath = resolveRealConfigPath(configPath);
33934
33784
  const snapshot = readConfigSnapshot(targetPath);
33935
33785
  const nextContent = patchCodexConfig(snapshot.content, options);
@@ -33950,7 +33800,7 @@ function resolveRealConfigPath(configPath) {
33950
33800
  } catch (error51) {
33951
33801
  if (!isNodeError(error51, "ENOENT")) throw error51;
33952
33802
  try {
33953
- return path29__default.join(realpathSync(path29__default.dirname(configPath)), path29__default.basename(configPath));
33803
+ return path28__default.join(realpathSync(path28__default.dirname(configPath)), path28__default.basename(configPath));
33954
33804
  } catch (dirError) {
33955
33805
  if (isNodeError(dirError, "ENOENT")) return configPath;
33956
33806
  throw dirError;
@@ -33987,9 +33837,9 @@ function readConfigSnapshot(configPath) {
33987
33837
  }
33988
33838
  }
33989
33839
  function writeConfigIfUnchanged(configPath, snapshot, content) {
33990
- mkdirSync(path29__default.dirname(configPath), { recursive: true, mode: 448 });
33840
+ mkdirSync(path28__default.dirname(configPath), { recursive: true, mode: 448 });
33991
33841
  assertConfigUnchanged(configPath, snapshot);
33992
- const tempPath = path29__default.join(path29__default.dirname(configPath), `.${path29__default.basename(configPath)}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`);
33842
+ const tempPath = path28__default.join(path28__default.dirname(configPath), `.${path28__default.basename(configPath)}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`);
33993
33843
  let fd;
33994
33844
  try {
33995
33845
  fd = openSync(tempPath, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, CONFIG_FILE_MODE);
@@ -34237,7 +34087,7 @@ function ensureCodexPluginRegisteredOrThrow(registration, command, runCommand) {
34237
34087
  pluginKey
34238
34088
  });
34239
34089
  writePrivateFile(registration.hashPath, `${registration.contentHash}
34240
- `, path29__default.dirname(registration.hashPath));
34090
+ `, path28__default.dirname(registration.hashPath));
34241
34091
  }
34242
34092
  function assertCommandSucceeded(label, result) {
34243
34093
  if (result.status === 0) return;
@@ -34245,7 +34095,7 @@ function assertCommandSucceeded(label, result) {
34245
34095
  throw new Error(`${label} failed${detail.length > 0 ? `: ${detail}` : ""}`);
34246
34096
  }
34247
34097
  function resolveCodexHome(env) {
34248
- return env.CODEX_HOME ?? path29__default.join(env.HOME ?? os3__default.homedir(), ".codex");
34098
+ return env.CODEX_HOME ?? path28__default.join(env.HOME ?? os3__default.homedir(), ".codex");
34249
34099
  }
34250
34100
  function findMarketplaceEntries(result, marketplaceName) {
34251
34101
  return parseMarketplaceEntries(result).filter((entry) => entry.name === marketplaceName);
@@ -34261,7 +34111,7 @@ function parseMarketplaceEntries(result) {
34261
34111
  return entries;
34262
34112
  }
34263
34113
  function normalizeMarketplaceRoot(rootPath, cwd) {
34264
- const resolved = path29__default.resolve(cwd, rootPath);
34114
+ const resolved = path28__default.resolve(cwd, rootPath);
34265
34115
  try {
34266
34116
  return realpathSync(resolved);
34267
34117
  } catch (error51) {
@@ -34285,7 +34135,7 @@ function readHash(hashPath) {
34285
34135
  }
34286
34136
  function removeFlatMarketplaceResidue(projectMarketplaceRoot) {
34287
34137
  for (const entry of FLAT_MARKETPLACE_FS_RESIDUE_ENTRIES) {
34288
- removePrivatePath(path29__default.join(projectMarketplaceRoot, entry), projectMarketplaceRoot);
34138
+ removePrivatePath(path28__default.join(projectMarketplaceRoot, entry), projectMarketplaceRoot);
34289
34139
  }
34290
34140
  }
34291
34141
 
@@ -34298,7 +34148,6 @@ var MARKETPLACE_MANAGED_ENTRIES = [
34298
34148
  ".agents",
34299
34149
  ".claude-plugin",
34300
34150
  ".codex-plugin",
34301
- ".cursor-plugin",
34302
34151
  "hooks",
34303
34152
  "skills",
34304
34153
  "agents",
@@ -34311,6 +34160,7 @@ var MARKETPLACE_PRUNE_ENTRIES = [
34311
34160
  ".agents",
34312
34161
  ".claude-plugin",
34313
34162
  ".codex-plugin",
34163
+ // 기존 Cursor marketplace 산출물은 Fleet이 관리하던 잔재이므로 다음 렌더에서 제거한다.
34314
34164
  ".cursor-plugin",
34315
34165
  "hooks",
34316
34166
  "skills",
@@ -34345,7 +34195,7 @@ async function createAgentCliPlugin(options) {
34345
34195
  cleanup,
34346
34196
  codexRegistrations: options.cliId === "codex" ? renderableBundles.map(({ bundle, target }, index) => ({
34347
34197
  contentHash: contentHashes.get(target.root),
34348
- hashPath: path29__default.join(target.root, bundle.hashFileName),
34198
+ hashPath: path28__default.join(target.root, bundle.hashFileName),
34349
34199
  marketplaceDir: target.root,
34350
34200
  marketplaceName: target.name,
34351
34201
  pluginName: bundle.name,
@@ -34362,7 +34212,7 @@ function resolveRenderablePluginBundles(fleetRoot) {
34362
34212
  function homeMarketplaceTarget(fleetRoot) {
34363
34213
  return {
34364
34214
  name: FLEET_MARKETPLACE_NAME,
34365
- root: path29__default.join(fleetRoot, MARKETPLACE_DIR_NAME)
34215
+ root: path28__default.join(fleetRoot, MARKETPLACE_DIR_NAME)
34366
34216
  };
34367
34217
  }
34368
34218
  function groupRenderableBundlesByMarketplace(bundles) {
@@ -34378,24 +34228,23 @@ function groupRenderableBundlesByMarketplace(bundles) {
34378
34228
  return groups;
34379
34229
  }
34380
34230
  function renderPluginRoot(pluginRoot, bundle, options) {
34381
- const parentRoot = path29__default.dirname(pluginRoot);
34231
+ const parentRoot = path28__default.dirname(pluginRoot);
34382
34232
  ensurePrivateDir(parentRoot, parentRoot);
34383
34233
  const stageParent = createStagingDir(parentRoot);
34384
- const stagedPluginRoot = path29__default.join(stageParent, path29__default.basename(pluginRoot));
34234
+ const stagedPluginRoot = path28__default.join(stageParent, path28__default.basename(pluginRoot));
34385
34235
  try {
34386
34236
  ensurePrivateDir(stagedPluginRoot, stagedPluginRoot);
34387
- writePrivateJson(path29__default.join(stagedPluginRoot, ".claude-plugin", "plugin.json"), claudeManifest(bundle), stagedPluginRoot);
34237
+ writePrivateJson(path28__default.join(stagedPluginRoot, ".claude-plugin", "plugin.json"), claudeManifest(bundle), stagedPluginRoot);
34388
34238
  switch (bundle.source) {
34389
34239
  case "asset":
34390
34240
  if (options.cliId === "claude") {
34391
- ensurePrivateDir(path29__default.join(stagedPluginRoot, "agents"), stagedPluginRoot);
34241
+ ensurePrivateDir(path28__default.join(stagedPluginRoot, "agents"), stagedPluginRoot);
34392
34242
  }
34393
- ensurePrivateDir(path29__default.join(stagedPluginRoot, "skills"), stagedPluginRoot);
34394
- renderAssetPluginRoot(stagedPluginRoot, bundle, { ...options, installedPluginRoot: pluginRoot });
34243
+ ensurePrivateDir(path28__default.join(stagedPluginRoot, "skills"), stagedPluginRoot);
34244
+ renderAssetPluginRoot(stagedPluginRoot, bundle, options);
34395
34245
  break;
34396
34246
  }
34397
- writePrivateJson(path29__default.join(stagedPluginRoot, ".codex-plugin", "plugin.json"), codexManifest(bundle, stagedPluginRoot), stagedPluginRoot);
34398
- writePrivateJson(path29__default.join(stagedPluginRoot, ".cursor-plugin", "plugin.json"), cursorManifest(bundle, stagedPluginRoot), stagedPluginRoot);
34247
+ writePrivateJson(path28__default.join(stagedPluginRoot, ".codex-plugin", "plugin.json"), codexManifest(bundle, stagedPluginRoot), stagedPluginRoot);
34399
34248
  removePrivatePath(pluginRoot, parentRoot);
34400
34249
  renameSync(stagedPluginRoot, pluginRoot);
34401
34250
  } finally {
@@ -34407,13 +34256,12 @@ function renderMarketplaceRoot(target, bundles) {
34407
34256
  ensurePrivateDir(marketplaceRoot, marketplaceRoot);
34408
34257
  const stagedRoot = createStagingDir(marketplaceRoot);
34409
34258
  try {
34410
- writePrivateJson(path29__default.join(stagedRoot, ".agents", "plugins", "marketplace.json"), codexMarketplace(target, bundles), stagedRoot);
34411
- writePrivateJson(path29__default.join(stagedRoot, ".claude-plugin", "marketplace.json"), claudeMarketplace(target, bundles), stagedRoot);
34412
- writePrivateJson(path29__default.join(stagedRoot, ".cursor-plugin", "marketplace.json"), cursorMarketplace(target, bundles), stagedRoot);
34259
+ writePrivateJson(path28__default.join(stagedRoot, ".agents", "plugins", "marketplace.json"), codexMarketplace(target, bundles), stagedRoot);
34260
+ writePrivateJson(path28__default.join(stagedRoot, ".claude-plugin", "marketplace.json"), claudeMarketplace(target, bundles), stagedRoot);
34413
34261
  pruneMarketplaceRoot(target);
34414
34262
  pruneStalePluginDirs(target, bundles);
34415
34263
  for (const entry of readdirSync(stagedRoot)) {
34416
- renameSync(path29__default.join(stagedRoot, entry), path29__default.join(marketplaceRoot, entry));
34264
+ renameSync(path28__default.join(stagedRoot, entry), path28__default.join(marketplaceRoot, entry));
34417
34265
  }
34418
34266
  } finally {
34419
34267
  cleanupPrivateRoot(stagedRoot, marketplaceRoot);
@@ -34421,22 +34269,22 @@ function renderMarketplaceRoot(target, bundles) {
34421
34269
  }
34422
34270
  function pruneMarketplaceRoot(target) {
34423
34271
  for (const entry of MARKETPLACE_PRUNE_ENTRIES) {
34424
- removePrivatePath(path29__default.join(target.root, entry), target.root);
34272
+ removePrivatePath(path28__default.join(target.root, entry), target.root);
34425
34273
  }
34426
34274
  }
34427
34275
  function pruneStalePluginDirs(target, bundles) {
34428
- const pluginsDir = path29__default.join(target.root, PLUGIN_BUNDLES_DIR_NAME);
34276
+ const pluginsDir = path28__default.join(target.root, PLUGIN_BUNDLES_DIR_NAME);
34429
34277
  if (!existsSync(pluginsDir)) return;
34430
34278
  const activeDirectoryNames = new Set(bundles.map((bundle) => bundle.directoryName));
34431
34279
  for (const entry of readdirSync(pluginsDir)) {
34432
34280
  if (activeDirectoryNames.has(entry)) continue;
34433
- removePrivatePath(path29__default.join(pluginsDir, entry), target.root);
34281
+ removePrivatePath(path28__default.join(pluginsDir, entry), target.root);
34434
34282
  }
34435
34283
  }
34436
34284
  function buildContentHash(target) {
34437
- const hash2 = crypto4.createHash("sha256");
34285
+ const hash2 = crypto3.createHash("sha256");
34438
34286
  for (const filePath of listRenderableFiles(target)) {
34439
- const relativePath = path29__default.relative(target.root, filePath);
34287
+ const relativePath = path28__default.relative(target.root, filePath);
34440
34288
  hash2.update(relativePath);
34441
34289
  hash2.update("\0");
34442
34290
  hash2.update(readFileSync(filePath));
@@ -34445,14 +34293,14 @@ function buildContentHash(target) {
34445
34293
  return hash2.digest("hex");
34446
34294
  }
34447
34295
  function createStagingDir(rootPath) {
34448
- const stageRoot = mkdtempSync(path29__default.join(rootPath, `.fleet-stage-${process.pid}-${Date.now()}-`));
34296
+ const stageRoot = mkdtempSync(path28__default.join(rootPath, `.fleet-stage-${process.pid}-${Date.now()}-`));
34449
34297
  return stageRoot;
34450
34298
  }
34451
34299
  function listRenderableFiles(target) {
34452
34300
  const files = [];
34453
34301
  const ancestorRealDirs = /* @__PURE__ */ new Set();
34454
34302
  for (const entry of MARKETPLACE_MANAGED_ENTRIES) {
34455
- const entryPath = path29__default.join(target.root, entry);
34303
+ const entryPath = path28__default.join(target.root, entry);
34456
34304
  if (!existsSync(entryPath)) continue;
34457
34305
  collectRenderableFiles(target.root, entryPath, files, ancestorRealDirs);
34458
34306
  }
@@ -34463,8 +34311,8 @@ function collectRenderableFiles(rootPath, currentPath, files, ancestorRealDirs)
34463
34311
  if (ancestorRealDirs.has(realDir)) return;
34464
34312
  ancestorRealDirs.add(realDir);
34465
34313
  for (const entry of readdirSync(currentPath)) {
34466
- const entryPath = path29__default.join(currentPath, entry);
34467
- const relativePath = path29__default.relative(rootPath, entryPath);
34314
+ const entryPath = path28__default.join(currentPath, entry);
34315
+ const relativePath = path28__default.relative(rootPath, entryPath);
34468
34316
  if (HASH_IGNORED_RELATIVE_PATHS.has(relativePath)) continue;
34469
34317
  const stat3 = lstatSync(entryPath);
34470
34318
  if (stat3.isSymbolicLink()) {
@@ -34529,19 +34377,8 @@ function claudeMarketplace(target, bundles) {
34529
34377
  }))
34530
34378
  };
34531
34379
  }
34532
- function cursorMarketplace(target, bundles) {
34533
- return {
34534
- name: target.name,
34535
- owner: "fleet",
34536
- plugins: bundles.map((bundle) => ({
34537
- name: bundle.name,
34538
- description: bundle.description,
34539
- source: marketplacePluginPath(target, bundle)
34540
- }))
34541
- };
34542
- }
34543
34380
  function pluginRootForTarget(target, bundle) {
34544
- return path29__default.join(target.root, PLUGIN_BUNDLES_DIR_NAME, bundle.directoryName);
34381
+ return path28__default.join(target.root, PLUGIN_BUNDLES_DIR_NAME, bundle.directoryName);
34545
34382
  }
34546
34383
  function marketplacePluginPath(target, bundle) {
34547
34384
  return `./${PLUGIN_BUNDLES_DIR_NAME}/${bundle.directoryName}`;
@@ -34554,36 +34391,14 @@ function codexManifest(bundle, pluginRoot) {
34554
34391
  skills: "./skills/"
34555
34392
  };
34556
34393
  }
34557
- function cursorManifest(bundle, pluginRoot) {
34558
- return {
34559
- name: bundle.name,
34560
- version: cursorManifestVersion(bundle, pluginRoot),
34561
- description: bundle.description
34562
- };
34563
- }
34564
- function cursorManifestVersion(bundle, pluginRoot) {
34565
- const hash2 = crypto4.createHash("sha256");
34566
- hash2.update(bundle.name);
34567
- hash2.update("\0");
34568
- hash2.update(bundle.description);
34569
- hash2.update("\0");
34570
- for (const filePath of listCursorEffectivePluginFiles(pluginRoot)) {
34571
- const relativePath = path29__default.relative(pluginRoot, filePath);
34572
- hash2.update(relativePath);
34573
- hash2.update("\0");
34574
- hash2.update(readFileSync(filePath));
34575
- hash2.update("\0");
34576
- }
34577
- return `0.0.0+${hash2.digest("hex").slice(0, 12)}`;
34578
- }
34579
34394
  function codexManifestVersion(bundle, pluginRoot) {
34580
- const hash2 = crypto4.createHash("sha256");
34395
+ const hash2 = crypto3.createHash("sha256");
34581
34396
  hash2.update(bundle.name);
34582
34397
  hash2.update("\0");
34583
34398
  hash2.update(bundle.description);
34584
34399
  hash2.update("\0");
34585
34400
  for (const filePath of listCodexEffectivePluginFiles(pluginRoot)) {
34586
- const relativePath = path29__default.relative(pluginRoot, filePath);
34401
+ const relativePath = path28__default.relative(pluginRoot, filePath);
34587
34402
  hash2.update(relativePath);
34588
34403
  hash2.update("\0");
34589
34404
  hash2.update(readFileSync(filePath));
@@ -34592,28 +34407,12 @@ function codexManifestVersion(bundle, pluginRoot) {
34592
34407
  return `0.0.0+${hash2.digest("hex").slice(0, 12)}`;
34593
34408
  }
34594
34409
  function listCodexEffectivePluginFiles(pluginRoot) {
34595
- const skillsPath = path29__default.join(pluginRoot, "skills");
34410
+ const skillsPath = path28__default.join(pluginRoot, "skills");
34596
34411
  if (!existsSync(skillsPath)) return [];
34597
34412
  const files = [];
34598
34413
  collectRenderableFiles(pluginRoot, skillsPath, files, /* @__PURE__ */ new Set());
34599
34414
  return files.sort();
34600
34415
  }
34601
- function listCursorEffectivePluginFiles(pluginRoot) {
34602
- const files = [];
34603
- for (const entry of ["skills", "hooks", "doctrine.md", "mcp.json"]) {
34604
- const entryPath = path29__default.join(pluginRoot, entry);
34605
- if (!existsSync(entryPath)) continue;
34606
- const stat3 = lstatSync(entryPath);
34607
- if (stat3.isFile()) {
34608
- files.push(entryPath);
34609
- continue;
34610
- }
34611
- if (stat3.isDirectory()) {
34612
- collectRenderableFiles(pluginRoot, entryPath, files, /* @__PURE__ */ new Set());
34613
- }
34614
- }
34615
- return files.sort();
34616
- }
34617
34416
  function claudeManifest(bundle) {
34618
34417
  return {
34619
34418
  name: bundle.name,
@@ -34636,7 +34435,7 @@ async function injectAgentCliProfile(profile, options) {
34636
34435
  }
34637
34436
  const enableMetaphor = options.enableMetaphor ?? false;
34638
34437
  const endpoint = await options.dedicatedMcpSession.getEndpoint();
34639
- const tokenLabel = options.mcpSessionLabel ?? `agent:${profile.id}:${crypto4.randomUUID()}`;
34438
+ const tokenLabel = options.mcpSessionLabel ?? `agent:${profile.id}:${crypto3.randomUUID()}`;
34640
34439
  const tokens = await options.dedicatedMcpSession.issueSessionToken({ cwd: profile.cwd, label: tokenLabel });
34641
34440
  const mcpServers = buildAgentCliMcpServerConfigs(endpoint.servers, tokens);
34642
34441
  const doctrine = options.buildSystemPrompt(enableMetaphor);
@@ -34648,9 +34447,7 @@ async function injectAgentCliProfile(profile, options) {
34648
34447
  codexCommandRunner: options.codexCommandRunner,
34649
34448
  cwd: profile.cwd,
34650
34449
  dataDir: options.dataDir,
34651
- doctrine,
34652
34450
  rootDir: options.pluginRootDir,
34653
- mcpServers,
34654
34451
  captureSessionHookExec: options.captureSessionHookExec,
34655
34452
  turnStartHookExec: options.turnStartHookExec,
34656
34453
  turnEndHookExec: options.turnEndHookExec,
@@ -34674,8 +34471,8 @@ async function injectAgentCliProfile(profile, options) {
34674
34471
  env: { ...profile.env }
34675
34472
  }, requireCodexCommandRunner(options.codexCommandRunner), options.withMarketplaceLock, {
34676
34473
  homeMarketplaceName: FLEET_MARKETPLACE_NAME,
34677
- homeMarketplaceRoot: path29__default.join(options.pluginRootDir ?? options.dataDir ?? getFleetDataDir(), "marketplace"),
34678
- projectMarketplaceRoot: path29__default.join(profile.cwd, ".fleet")
34474
+ homeMarketplaceRoot: path28__default.join(options.pluginRootDir ?? options.dataDir ?? getFleetDataDir(), "marketplace"),
34475
+ projectMarketplaceRoot: path28__default.join(profile.cwd, ".fleet")
34679
34476
  });
34680
34477
  if (cleanupWarning !== void 0) {
34681
34478
  launchWarnings.push(`Deprecated Codex plugin cleanup failed: ${cleanupWarning}`);
@@ -34738,19 +34535,19 @@ function buildAgentCliMcpServerConfigs(endpoints, tokens) {
34738
34535
  });
34739
34536
  }
34740
34537
  function writeSystemPromptFile(cliId, systemPrompt, onCleanup) {
34741
- const tempDir = mkdtempSync(path29__default.join(os3__default.tmpdir(), `fleet-${cliId}-`));
34538
+ const tempDir = mkdtempSync(path28__default.join(os3__default.tmpdir(), `fleet-${cliId}-`));
34742
34539
  onCleanup(() => rmBestEffort(tempDir));
34743
- const filePath = path29__default.join(tempDir, "system-prompt.md");
34540
+ const filePath = path28__default.join(tempDir, "system-prompt.md");
34744
34541
  writeFileSync(filePath, systemPrompt, { encoding: "utf8", flag: "wx", mode: SYSTEM_PROMPT_FILE_MODE });
34745
34542
  chmodBestEffort2(filePath, SYSTEM_PROMPT_FILE_MODE);
34746
34543
  return filePath;
34747
34544
  }
34748
34545
  function writeCodexFleetProfile(env, doctrine, pluginKeys, hookExecs) {
34749
- const codexHome = env.CODEX_HOME ?? path29__default.join(env.HOME ?? os3__default.homedir(), ".codex");
34546
+ const codexHome = env.CODEX_HOME ?? path28__default.join(env.HOME ?? os3__default.homedir(), ".codex");
34750
34547
  mkdirSync(codexHome, { recursive: true });
34751
34548
  pruneLegacyCodexFleetProfiles(codexHome);
34752
34549
  const profileName = CODEX_FLEET_PROFILE_NAME;
34753
- const profilePath = path29__default.join(codexHome, CODEX_FLEET_PROFILE_FILE_NAME);
34550
+ const profilePath = path28__default.join(codexHome, CODEX_FLEET_PROFILE_FILE_NAME);
34754
34551
  const hookTrustState = readCodexFleetHookTrustState(profilePath);
34755
34552
  writeFileNoFollow2(profilePath, [
34756
34553
  CODEX_FLEET_PROFILE_MARKER,
@@ -34790,7 +34587,7 @@ function codexHooksConfig(hookExecs) {
34790
34587
  }
34791
34588
  function codexHookHandlersInline(execs) {
34792
34589
  const handlers = execs.map((exec) => {
34793
- const command = buildPosixShellCommand([exec.command, ...exec.args]);
34590
+ const command = buildHostShellCommand([exec.command, ...exec.args]);
34794
34591
  return `{ type = "command", command = "${escapeTomlBasicString(command)}" }`;
34795
34592
  }).join(", ");
34796
34593
  return `[{ hooks = [${handlers}] }]`;
@@ -34854,7 +34651,7 @@ function pruneLegacyCodexFleetProfiles(codexHome) {
34854
34651
  }
34855
34652
  for (const entry of entries) {
34856
34653
  if (!CODEX_LEGACY_FLEET_PROFILE_FILE_NAME_PATTERN.test(entry)) continue;
34857
- const filePath = path29__default.join(codexHome, entry);
34654
+ const filePath = path28__default.join(codexHome, entry);
34858
34655
  if (!isLegacyFleetCodexProfile(filePath)) continue;
34859
34656
  unlinkBestEffort2(filePath);
34860
34657
  }
@@ -34901,8 +34698,6 @@ function buildAgentCliArgs(builderId, context) {
34901
34698
  return buildClaudeNativeArgs(context);
34902
34699
  case "codex-native":
34903
34700
  return buildCodexNativeArgs(context);
34904
- case "cursor-native":
34905
- return buildCursorNativeArgs(context);
34906
34701
  }
34907
34702
  }
34908
34703
  function mergeAgentCliArgs(profile, builderId, context, injectedArgs) {
@@ -35077,6 +34872,7 @@ function buildReservedExternalMcpServerIds(injectedIds) {
35077
34872
 
35078
34873
  // ../../packages/fleet-admiral/src/agent-runtime/reminder-router.ts
35079
34874
  var DEFAULT_BRACKETED_PASTE = false;
34875
+ var DEFAULT_CONPTY_PASTE_BURST = false;
35080
34876
  var DEFAULT_LINE_TERMINATOR = "\r";
35081
34877
  var DEFAULT_MULTILINE_STRATEGY = "literal";
35082
34878
  var BRACKETED_PASTE_START = "\x1B[200~";
@@ -35084,7 +34880,28 @@ var BRACKETED_PASTE_END = "\x1B[201~";
35084
34880
  var C1_BRACKETED_PASTE_END = "\x9B201~";
35085
34881
  var CONTROL_CHARS_EXCEPT_INPUT_WHITESPACE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F\x80-\x9F]/g;
35086
34882
  var LINE_BREAK_PATTERN = /[\r\n]/;
34883
+ var WINDOWS_CONPTY_SUBMIT_DELAY_MS = 250;
34884
+ function createDelayedPtyWriter() {
34885
+ const submitTails = /* @__PURE__ */ new Map();
34886
+ return {
34887
+ enqueue(sessionKey, write, chunks) {
34888
+ const hasDelay = chunks.some((chunk) => chunk.submitDelayMs !== void 0);
34889
+ if (!hasDelay || sessionKey === void 0) {
34890
+ void writeChunksWithDelay(write, chunks);
34891
+ return;
34892
+ }
34893
+ const prev = submitTails.get(sessionKey) ?? Promise.resolve();
34894
+ const tail = prev.then(() => writeChunksWithDelay(write, chunks)).catch(() => {
34895
+ });
34896
+ submitTails.set(sessionKey, tail);
34897
+ void tail.then(() => {
34898
+ if (submitTails.get(sessionKey) === tail) submitTails.delete(sessionKey);
34899
+ });
34900
+ }
34901
+ };
34902
+ }
35087
34903
  function createCarrierResultReminderRouter(deps) {
34904
+ const writer = deps.writer ?? createDelayedPtyWriter();
35088
34905
  return deps.streamRegister((event) => {
35089
34906
  if (event.type !== "job:finalized") return;
35090
34907
  if (typeof event.systemReminder !== "string") return;
@@ -35093,35 +34910,61 @@ function createCarrierResultReminderRouter(deps) {
35093
34910
  const sink = deps.resolveSink(event);
35094
34911
  if (!sink) return;
35095
34912
  const policy = deps.resolvePolicy?.(event) ?? {};
35096
- for (const chunk of formatCarrierResultReminderMessage(policy, reminder)) {
35097
- sink.write(chunk);
35098
- }
34913
+ const chunks = formatCarrierResultReminderMessage(policy, reminder, deps.platform);
34914
+ writer.enqueue(deps.resolveSessionKey?.(event), (data) => sink.write(data), chunks);
35099
34915
  });
35100
34916
  }
35101
34917
  function sanitizeCarrierResultReminder(text) {
35102
34918
  return text.split(BRACKETED_PASTE_END).join("").split(C1_BRACKETED_PASTE_END).join("").replace(CONTROL_CHARS_EXCEPT_INPUT_WHITESPACE, "");
35103
34919
  }
35104
- function formatCarrierResultReminderMessage(policy, text) {
34920
+ function formatCarrierResultReminderMessage(policy, text, platform = process.platform) {
35105
34921
  const resolvedPolicy = resolveMessagePolicy(policy);
35106
- const appliedPolicy = applyMessagePolicy(text, resolvedPolicy);
35107
- return appliedPolicy.submit === void 0 || appliedPolicy.submit.length === 0 ? [appliedPolicy.payload] : [appliedPolicy.payload, appliedPolicy.submit];
34922
+ return applyMessagePolicy(text, resolvedPolicy, platform);
35108
34923
  }
35109
34924
  function resolveMessagePolicy(policy) {
35110
34925
  return {
35111
34926
  bracketedPaste: policy.bracketedPaste ?? DEFAULT_BRACKETED_PASTE,
34927
+ conptyPasteBurst: policy.conptyPasteBurst ?? DEFAULT_CONPTY_PASTE_BURST,
35112
34928
  lineTerminator: policy.lineTerminator ?? DEFAULT_LINE_TERMINATOR,
35113
34929
  multilineStrategy: policy.multilineStrategy ?? DEFAULT_MULTILINE_STRATEGY
35114
34930
  };
35115
34931
  }
35116
- function applyMessagePolicy(text, policy) {
34932
+ function applyMessagePolicy(text, policy, platform) {
35117
34933
  const usePasteMode = policy.bracketedPaste || policy.multilineStrategy === "paste-mode" && LINE_BREAK_PATTERN.test(text);
35118
- if (!usePasteMode) {
35119
- return { payload: `${text}${policy.lineTerminator}` };
34934
+ if (policy.conptyPasteBurst && platform === "win32" && usePasteMode) {
34935
+ return [
34936
+ { data: text },
34937
+ { data: policy.lineTerminator, submitDelayMs: WINDOWS_CONPTY_SUBMIT_DELAY_MS }
34938
+ ];
35120
34939
  }
35121
- return {
35122
- payload: `${BRACKETED_PASTE_START}${text}${BRACKETED_PASTE_END}`,
35123
- submit: policy.lineTerminator
35124
- };
34940
+ return [{
34941
+ data: usePasteMode ? `${BRACKETED_PASTE_START}${text}${BRACKETED_PASTE_END}${policy.lineTerminator}` : `${text}${policy.lineTerminator}`
34942
+ }];
34943
+ }
34944
+ function writeChunksWithDelay(write, chunks) {
34945
+ return new Promise((resolve2) => {
34946
+ let index = 0;
34947
+ const writeNext = () => {
34948
+ const chunk = chunks[index++];
34949
+ if (!chunk) {
34950
+ resolve2();
34951
+ return;
34952
+ }
34953
+ const commit = () => {
34954
+ try {
34955
+ write(chunk.data);
34956
+ } catch {
34957
+ }
34958
+ writeNext();
34959
+ };
34960
+ if (chunk.submitDelayMs === void 0) {
34961
+ commit();
34962
+ } else {
34963
+ setTimeout(commit, chunk.submitDelayMs);
34964
+ }
34965
+ };
34966
+ writeNext();
34967
+ });
35125
34968
  }
35126
34969
 
35127
34970
  // ../../packages/fleet-wiki/src/boundaries.ts
@@ -35319,7 +35162,7 @@ function extractLegacyMarkdownWikiLinks(body, wikiDir, basePath) {
35319
35162
  }
35320
35163
  function resolveLegacyWikiTarget(target, wikiDir, basePath) {
35321
35164
  if (!target || target.startsWith("#")) return null;
35322
- if (path29__default.isAbsolute(target)) return null;
35165
+ if (path28__default.isAbsolute(target)) return null;
35323
35166
  if (/^[a-z][a-z0-9+.-]*:/i.test(target)) return null;
35324
35167
  const withoutFragment = target.split("#", 1)[0]?.split("?", 1)[0] ?? "";
35325
35168
  if (!withoutFragment.endsWith(".md")) return null;
@@ -35329,12 +35172,12 @@ function resolveLegacyWikiTarget(target, wikiDir, basePath) {
35329
35172
  } catch {
35330
35173
  return null;
35331
35174
  }
35332
- const resolved = path29__default.resolve(path29__default.dirname(basePath), decodedTarget);
35333
- const relative = path29__default.relative(wikiDir, resolved);
35334
- if (!relative || relative.startsWith("..") || path29__default.isAbsolute(relative)) return null;
35175
+ const resolved = path28__default.resolve(path28__default.dirname(basePath), decodedTarget);
35176
+ const relative = path28__default.relative(wikiDir, resolved);
35177
+ if (!relative || relative.startsWith("..") || path28__default.isAbsolute(relative)) return null;
35335
35178
  return {
35336
35179
  target,
35337
- entryId: path29__default.basename(relative, ".md")
35180
+ entryId: path28__default.basename(relative, ".md")
35338
35181
  };
35339
35182
  }
35340
35183
 
@@ -35594,18 +35437,18 @@ Always read \`schema/wiki-schema.md\` directly before composing or revising entr
35594
35437
  `;
35595
35438
  async function ensureWorkspaceSchema(paths) {
35596
35439
  await mkdir(paths.schemaDir, { recursive: true });
35597
- await writeDefaultFileIfMissing(path29__default.join(paths.schemaDir, WORKSPACE_SCHEMA_AGENTS_FILENAME), DEFAULT_WORKSPACE_SCHEMA_AGENTS);
35598
- await writeDefaultFileIfMissing(path29__default.join(paths.schemaDir, WORKSPACE_SCHEMA_FILENAME), DEFAULT_WORKSPACE_WIKI_SCHEMA);
35440
+ await writeDefaultFileIfMissing(path28__default.join(paths.schemaDir, WORKSPACE_SCHEMA_AGENTS_FILENAME), DEFAULT_WORKSPACE_SCHEMA_AGENTS);
35441
+ await writeDefaultFileIfMissing(path28__default.join(paths.schemaDir, WORKSPACE_SCHEMA_FILENAME), DEFAULT_WORKSPACE_WIKI_SCHEMA);
35599
35442
  await writeDefaultFileIfMissing(buildTemplatePath(paths, "prd"), DEFAULT_TEMPLATE_PRD);
35600
35443
  return readWorkspaceSchemaSummary(paths);
35601
35444
  }
35602
35445
  async function ensureWorkspaceDoctrine(paths) {
35603
35446
  await mkdir(paths.root, { recursive: true });
35604
- await writeDefaultFileIfMissing(path29__default.join(paths.root, WORKSPACE_KNOWLEDGE_AGENTS_FILENAME), DEFAULT_WORKSPACE_KNOWLEDGE_AGENTS);
35447
+ await writeDefaultFileIfMissing(path28__default.join(paths.root, WORKSPACE_KNOWLEDGE_AGENTS_FILENAME), DEFAULT_WORKSPACE_KNOWLEDGE_AGENTS);
35605
35448
  }
35606
35449
  async function readWorkspaceSchemaSummary(paths) {
35607
- const agentsPath = path29__default.join(paths.schemaDir, WORKSPACE_SCHEMA_AGENTS_FILENAME);
35608
- const wikiSchemaPath = path29__default.join(paths.schemaDir, WORKSPACE_SCHEMA_FILENAME);
35450
+ const agentsPath = path28__default.join(paths.schemaDir, WORKSPACE_SCHEMA_AGENTS_FILENAME);
35451
+ const wikiSchemaPath = path28__default.join(paths.schemaDir, WORKSPACE_SCHEMA_FILENAME);
35609
35452
  const wikiSchemaContent = await tryReadFile(wikiSchemaPath);
35610
35453
  const templates = await scanTemplates(paths);
35611
35454
  if (wikiSchemaContent === null) {
@@ -35644,7 +35487,7 @@ async function scanTemplates(paths) {
35644
35487
  if (!entry.name.startsWith(WORKSPACE_TEMPLATE_PREFIX) || !entry.name.endsWith(WORKSPACE_TEMPLATE_SUFFIX)) continue;
35645
35488
  const id = entry.name.slice(WORKSPACE_TEMPLATE_PREFIX.length, -WORKSPACE_TEMPLATE_SUFFIX.length);
35646
35489
  if (!id) continue;
35647
- const filePath = path29__default.join(paths.schemaDir, entry.name);
35490
+ const filePath = path28__default.join(paths.schemaDir, entry.name);
35648
35491
  try {
35649
35492
  const parsed = parseTemplateMarkdown(await readFile(filePath, "utf8"));
35650
35493
  templates.push({
@@ -35678,7 +35521,7 @@ async function validateTemplateCompliance(paths, templateId, body) {
35678
35521
  }
35679
35522
  }
35680
35523
  function inferTemplateIdFromTarget(target, knownTemplateIds) {
35681
- const basename = path29__default.basename(target, ".md");
35524
+ const basename = path28__default.basename(target, ".md");
35682
35525
  const ids = knownTemplateIds ?? DEFAULT_TEMPLATE_IDS;
35683
35526
  const sorted = [...ids].sort((a, b) => b.length - a.length);
35684
35527
  for (const id of sorted) {
@@ -35707,7 +35550,7 @@ function extractSchemaSummary(content) {
35707
35550
  return lines.find((line) => line.length > 0 && !line.startsWith("#")) ?? "Workspace schema is present.";
35708
35551
  }
35709
35552
  function buildTemplatePath(paths, id) {
35710
- return path29__default.join(paths.schemaDir, `${WORKSPACE_TEMPLATE_PREFIX}${id}${WORKSPACE_TEMPLATE_SUFFIX}`);
35553
+ return path28__default.join(paths.schemaDir, `${WORKSPACE_TEMPLATE_PREFIX}${id}${WORKSPACE_TEMPLATE_SUFFIX}`);
35711
35554
  }
35712
35555
  function parseTemplateMarkdown(content) {
35713
35556
  const normalized = content.replace(/\r\n/g, "\n");
@@ -35734,16 +35577,16 @@ function isAlreadyExistsError(error51) {
35734
35577
 
35735
35578
  // ../../packages/fleet-wiki/src/paths.ts
35736
35579
  function resolveMemoryPaths(cwd) {
35737
- const root = path29__default.join(cwd, KNOWLEDGE_ROOT_DIRNAME);
35580
+ const root = path28__default.join(cwd, KNOWLEDGE_ROOT_DIRNAME);
35738
35581
  return {
35739
35582
  root,
35740
- rawDir: path29__default.join(root, RAW_DIRNAME),
35741
- wikiDir: path29__default.join(root, WIKI_DIRNAME),
35742
- schemaDir: path29__default.join(root, SCHEMA_DIRNAME),
35743
- queueDir: path29__default.join(root, QUEUE_DIRNAME),
35744
- archiveDir: path29__default.join(root, ARCHIVE_DIRNAME),
35745
- conflictsDir: path29__default.join(root, CONFLICTS_DIRNAME),
35746
- indexFile: path29__default.join(root, INDEX_FILENAME)
35583
+ rawDir: path28__default.join(root, RAW_DIRNAME),
35584
+ wikiDir: path28__default.join(root, WIKI_DIRNAME),
35585
+ schemaDir: path28__default.join(root, SCHEMA_DIRNAME),
35586
+ queueDir: path28__default.join(root, QUEUE_DIRNAME),
35587
+ archiveDir: path28__default.join(root, ARCHIVE_DIRNAME),
35588
+ conflictsDir: path28__default.join(root, CONFLICTS_DIRNAME),
35589
+ indexFile: path28__default.join(root, INDEX_FILENAME)
35747
35590
  };
35748
35591
  }
35749
35592
  async function ensureMemoryRoot(paths) {
@@ -35758,10 +35601,10 @@ async function ensureMemoryRoot(paths) {
35758
35601
  await ensureWorkspaceDoctrine(paths);
35759
35602
  }
35760
35603
  function getIndexMarkdownFile(paths) {
35761
- return path29__default.join(paths.wikiDir, INDEX_MD_FILENAME);
35604
+ return path28__default.join(paths.wikiDir, INDEX_MD_FILENAME);
35762
35605
  }
35763
35606
  function getLogFile(paths) {
35764
- return path29__default.join(paths.root, LOG_MD_FILENAME);
35607
+ return path28__default.join(paths.root, LOG_MD_FILENAME);
35765
35608
  }
35766
35609
 
35767
35610
  // ../../packages/fleet-wiki/src/log.ts
@@ -35925,12 +35768,12 @@ async function readWikiEntry(id, paths) {
35925
35768
  const index = await loadIndex(paths);
35926
35769
  const indexed = index[id];
35927
35770
  if (indexed) {
35928
- const resolved = path29__default.resolve(paths.root, indexed.path);
35929
- const rel = path29__default.relative(paths.wikiDir, resolved);
35930
- if (!rel || rel.startsWith("..") || path29__default.isAbsolute(rel)) return null;
35771
+ const resolved = path28__default.resolve(paths.root, indexed.path);
35772
+ const rel = path28__default.relative(paths.wikiDir, resolved);
35773
+ if (!rel || rel.startsWith("..") || path28__default.isAbsolute(rel)) return null;
35931
35774
  return readMarkdownFile(resolved);
35932
35775
  }
35933
- const fallbackPath = path29__default.join(paths.wikiDir, `${id}.md`);
35776
+ const fallbackPath = path28__default.join(paths.wikiDir, `${id}.md`);
35934
35777
  if (await pathExists(fallbackPath)) {
35935
35778
  return readMarkdownFile(fallbackPath);
35936
35779
  }
@@ -35941,20 +35784,20 @@ async function readWikiEntry(id, paths) {
35941
35784
  async function writeWikiEntryAtTarget(entry, target, paths) {
35942
35785
  await ensureMemoryRoot(paths);
35943
35786
  assertSafeEntryId(entry.id);
35944
- const absoluteTarget = path29__default.resolve(paths.root, target);
35945
- const relativeTarget = path29__default.relative(paths.wikiDir, absoluteTarget);
35946
- if (!relativeTarget || relativeTarget.startsWith("..") || path29__default.isAbsolute(relativeTarget)) {
35787
+ const absoluteTarget = path28__default.resolve(paths.root, target);
35788
+ const relativeTarget = path28__default.relative(paths.wikiDir, absoluteTarget);
35789
+ if (!relativeTarget || relativeTarget.startsWith("..") || path28__default.isAbsolute(relativeTarget)) {
35947
35790
  throw new Error(`[fleet-wiki] wiki target escapes wiki/: ${target}`);
35948
35791
  }
35949
35792
  if (!absoluteTarget.endsWith(".md")) {
35950
35793
  throw new Error(`[fleet-wiki] wiki target must end with .md: ${target}`);
35951
35794
  }
35952
- if (path29__default.basename(absoluteTarget, ".md") !== entry.id) {
35795
+ if (path28__default.basename(absoluteTarget, ".md") !== entry.id) {
35953
35796
  throw new Error("wiki patch body id must match target filename");
35954
35797
  }
35955
- await mkdir(path29__default.dirname(absoluteTarget), { recursive: true });
35798
+ await mkdir(path28__default.dirname(absoluteTarget), { recursive: true });
35956
35799
  await writeMarkdownAtomic(absoluteTarget, serializeWikiEntry(entry), paths);
35957
- return path29__default.join("wiki", relativeTarget).replaceAll(path29__default.sep, "/");
35800
+ return path28__default.join("wiki", relativeTarget).replaceAll(path28__default.sep, "/");
35958
35801
  }
35959
35802
  async function writeRawSourceEntry(entry, paths) {
35960
35803
  await ensureMemoryRoot(paths);
@@ -35973,11 +35816,11 @@ async function writeRawSourceEntry(entry, paths) {
35973
35816
  },
35974
35817
  entry.content
35975
35818
  );
35976
- await writeMarkdownAtomic(path29__default.join(paths.root, relativePath), content, paths);
35819
+ await writeMarkdownAtomic(path28__default.join(paths.root, relativePath), content, paths);
35977
35820
  return relativePath;
35978
35821
  }
35979
35822
  async function readRawSourceEntry(rawSourceRef, paths) {
35980
- const absolutePath = path29__default.resolve(paths.root, rawSourceRef);
35823
+ const absolutePath = path28__default.resolve(paths.root, rawSourceRef);
35981
35824
  assertWithinRawDir(absolutePath, paths);
35982
35825
  const parsed = parseMarkdown(await readFile(absolutePath, "utf8"));
35983
35826
  return {
@@ -36165,11 +36008,11 @@ function stripLeadingFrontmatter(body) {
36165
36008
  return stripped ? next : body;
36166
36009
  }
36167
36010
  function computeContentHash(content) {
36168
- return crypto4.createHash("sha256").update(content, "utf8").digest("hex").slice(0, 8);
36011
+ return crypto3.createHash("sha256").update(content, "utf8").digest("hex").slice(0, 8);
36169
36012
  }
36170
36013
  function assertWithinRawDir(absolutePath, paths) {
36171
- const relative = path29__default.relative(paths.rawDir, absolutePath);
36172
- if (!relative || relative.startsWith("..") || path29__default.isAbsolute(relative)) {
36014
+ const relative = path28__default.relative(paths.rawDir, absolutePath);
36015
+ if (!relative || relative.startsWith("..") || path28__default.isAbsolute(relative)) {
36173
36016
  throw new Error(`[fleet-wiki] raw source ref escapes raw/: ${absolutePath}`);
36174
36017
  }
36175
36018
  }
@@ -36225,7 +36068,7 @@ function parseWikiEntry(content) {
36225
36068
  async function listWikiRecords(paths) {
36226
36069
  return listMarkdownEntriesRecursive(paths.wikiDir, paths, (content, filePath) => ({
36227
36070
  entry: parseWikiEntry(content),
36228
- path: path29__default.relative(paths.root, filePath).replaceAll(path29__default.sep, "/")
36071
+ path: path28__default.relative(paths.root, filePath).replaceAll(path28__default.sep, "/")
36229
36072
  }));
36230
36073
  }
36231
36074
  async function listMarkdownEntriesRecursive(dirPath, paths, parser) {
@@ -36238,7 +36081,7 @@ async function listMarkdownEntriesRecursive(dirPath, paths, parser) {
36238
36081
  }
36239
36082
  const sortedEntries = entries.sort((left, right) => left.name.localeCompare(right.name));
36240
36083
  for (const entry of sortedEntries) {
36241
- const filePath = path29__default.join(dirPath, entry.name);
36084
+ const filePath = path28__default.join(dirPath, entry.name);
36242
36085
  if (entry.isDirectory()) {
36243
36086
  items.push(...await listMarkdownEntriesRecursive(filePath, paths, parser));
36244
36087
  continue;
@@ -36376,9 +36219,9 @@ async function writeJsonAtomic(filePath, value, paths) {
36376
36219
  }
36377
36220
  async function writeAtomic(filePath, content, paths) {
36378
36221
  await ensureMemoryRoot(paths);
36379
- const tempPath = path29__default.join(
36380
- path29__default.dirname(filePath),
36381
- `.tmp-${process.pid}-${Date.now()}-${crypto4.randomUUID()}-${os3__default.hostname()}`
36222
+ const tempPath = path28__default.join(
36223
+ path28__default.dirname(filePath),
36224
+ `.tmp-${process.pid}-${Date.now()}-${crypto3.randomUUID()}-${os3__default.hostname()}`
36382
36225
  );
36383
36226
  await writeFile(tempPath, content, "utf8");
36384
36227
  await rename(tempPath, filePath);
@@ -36424,7 +36267,7 @@ async function enhancedSearch(paths, options) {
36424
36267
  for (const entry of entries) {
36425
36268
  if (!index[entry.id]) {
36426
36269
  index[entry.id] = {
36427
- path: path29__default.join("wiki", `${entry.id}.md`),
36270
+ path: path28__default.join("wiki", `${entry.id}.md`),
36428
36271
  title: entry.title,
36429
36272
  tags: entry.tags,
36430
36273
  updated: entry.updated
@@ -36560,7 +36403,7 @@ function toEnhancedHit(entry, signals) {
36560
36403
  score: enhancedScore,
36561
36404
  reason: signals.legacyReason ?? "body",
36562
36405
  excerpt,
36563
- path: path29__default.join("wiki", `${entry.id}.md`),
36406
+ path: path28__default.join("wiki", `${entry.id}.md`),
36564
36407
  tags: entry.tags,
36565
36408
  updated: entry.updated,
36566
36409
  version: entry.version,
@@ -36756,7 +36599,7 @@ function toRankedHit(entry, reason, detail, graphBoost, backlinksById) {
36756
36599
  score: basePriority * 100 + statusPriority * 10 + graphScore + (detail.tagBoost ?? 0),
36757
36600
  reason,
36758
36601
  excerpt,
36759
- path: path29__default.join("wiki", `${entry.id}.md`),
36602
+ path: path28__default.join("wiki", `${entry.id}.md`),
36760
36603
  tags: entry.tags,
36761
36604
  updated: entry.updated,
36762
36605
  version: entry.version,
@@ -37184,15 +37027,15 @@ var PATCH_SET_DIRNAME = "_sets";
37184
37027
  var PATCH_SET_META_FILENAME = PATCH_META_FILENAME;
37185
37028
  function getPatchSetDir(paths, patchSetId) {
37186
37029
  assertSafePatchSetId(patchSetId);
37187
- const patchSetDir = path29__default.join(paths.queueDir, PATCH_SET_DIRNAME, patchSetId);
37188
- const relative = path29__default.relative(path29__default.join(paths.queueDir, PATCH_SET_DIRNAME), patchSetDir);
37189
- if (!relative || relative.startsWith("..") || path29__default.isAbsolute(relative)) {
37030
+ const patchSetDir = path28__default.join(paths.queueDir, PATCH_SET_DIRNAME, patchSetId);
37031
+ const relative = path28__default.relative(path28__default.join(paths.queueDir, PATCH_SET_DIRNAME), patchSetDir);
37032
+ if (!relative || relative.startsWith("..") || path28__default.isAbsolute(relative)) {
37190
37033
  throw new Error(`[fleet-wiki] patch set id escapes queue/_sets: ${patchSetId}`);
37191
37034
  }
37192
37035
  return patchSetDir;
37193
37036
  }
37194
37037
  function getPatchSetMetaFile(paths, patchSetId) {
37195
- return path29__default.join(getPatchSetDir(paths, patchSetId), PATCH_SET_META_FILENAME);
37038
+ return path28__default.join(getPatchSetDir(paths, patchSetId), PATCH_SET_META_FILENAME);
37196
37039
  }
37197
37040
  function buildPatchSetId(createdAt, sourceRef) {
37198
37041
  const compact = createdAt.replace(/[:.]/g, "-");
@@ -37225,7 +37068,7 @@ async function createConflict(input, paths) {
37225
37068
  await ensureMemoryRoot(paths);
37226
37069
  const now = input.now ?? /* @__PURE__ */ new Date();
37227
37070
  const conflictId = buildConflictId(now, input.wikiId, input.reason, input.proposed);
37228
- const conflictDir = path29__default.join(paths.conflictsDir, conflictId);
37071
+ const conflictDir = path28__default.join(paths.conflictsDir, conflictId);
37229
37072
  await mkdir(conflictDir, { recursive: true });
37230
37073
  const meta3 = {
37231
37074
  id: conflictId,
@@ -37245,13 +37088,13 @@ async function createConflict(input, paths) {
37245
37088
  currentHash: input.currentHash,
37246
37089
  warnings: input.warnings
37247
37090
  };
37248
- await writeJsonFile(path29__default.join(conflictDir, CONFLICT_META_FILENAME), meta3, paths);
37249
- await writePatchFile(path29__default.join(conflictDir, CONFLICT_PROPOSED_FILENAME), input.proposed, paths);
37091
+ await writeJsonFile(path28__default.join(conflictDir, CONFLICT_META_FILENAME), meta3, paths);
37092
+ await writePatchFile(path28__default.join(conflictDir, CONFLICT_PROPOSED_FILENAME), input.proposed, paths);
37250
37093
  if (input.current !== void 0) {
37251
- await writePatchFile(path29__default.join(conflictDir, CONFLICT_CURRENT_FILENAME), input.current, paths);
37094
+ await writePatchFile(path28__default.join(conflictDir, CONFLICT_CURRENT_FILENAME), input.current, paths);
37252
37095
  }
37253
37096
  if (input.rawSource !== void 0) {
37254
- await writePatchFile(path29__default.join(conflictDir, CONFLICT_RAW_SOURCE_FILENAME), input.rawSource, paths);
37097
+ await writePatchFile(path28__default.join(conflictDir, CONFLICT_RAW_SOURCE_FILENAME), input.rawSource, paths);
37255
37098
  }
37256
37099
  return {
37257
37100
  meta: meta3,
@@ -37265,7 +37108,7 @@ async function listConflicts(paths) {
37265
37108
  const metas = [];
37266
37109
  for (const id of ids) {
37267
37110
  try {
37268
- metas.push(await readJsonFile2(path29__default.join(paths.conflictsDir, id, CONFLICT_META_FILENAME)));
37111
+ metas.push(await readJsonFile2(path28__default.join(paths.conflictsDir, id, CONFLICT_META_FILENAME)));
37269
37112
  } catch {
37270
37113
  continue;
37271
37114
  }
@@ -37274,13 +37117,13 @@ async function listConflicts(paths) {
37274
37117
  }
37275
37118
  async function readConflict(conflictId, paths) {
37276
37119
  const conflictDir = resolveConflictDir(conflictId, paths);
37277
- const meta3 = await readJsonFile2(path29__default.join(conflictDir, CONFLICT_META_FILENAME));
37278
- const currentPath = path29__default.join(conflictDir, CONFLICT_CURRENT_FILENAME);
37279
- const rawSourcePath = path29__default.join(conflictDir, CONFLICT_RAW_SOURCE_FILENAME);
37120
+ const meta3 = await readJsonFile2(path28__default.join(conflictDir, CONFLICT_META_FILENAME));
37121
+ const currentPath = path28__default.join(conflictDir, CONFLICT_CURRENT_FILENAME);
37122
+ const rawSourcePath = path28__default.join(conflictDir, CONFLICT_RAW_SOURCE_FILENAME);
37280
37123
  return {
37281
37124
  meta: meta3,
37282
37125
  current: await pathExists(currentPath) ? await readPatchFile(currentPath) : void 0,
37283
- proposed: await readPatchFile(path29__default.join(conflictDir, CONFLICT_PROPOSED_FILENAME)),
37126
+ proposed: await readPatchFile(path28__default.join(conflictDir, CONFLICT_PROPOSED_FILENAME)),
37284
37127
  rawSource: await pathExists(rawSourcePath) ? await readPatchFile(rawSourcePath) : void 0
37285
37128
  };
37286
37129
  }
@@ -37299,9 +37142,9 @@ function sanitizeConflictToken(value) {
37299
37142
  return value.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64) || "unknown";
37300
37143
  }
37301
37144
  function resolveConflictDir(conflictId, paths) {
37302
- const conflictDir = path29__default.resolve(paths.conflictsDir, conflictId);
37303
- const relative = path29__default.relative(paths.conflictsDir, conflictDir);
37304
- if (!relative || relative.startsWith("..") || path29__default.isAbsolute(relative)) {
37145
+ const conflictDir = path28__default.resolve(paths.conflictsDir, conflictId);
37146
+ const relative = path28__default.relative(paths.conflictsDir, conflictDir);
37147
+ if (!relative || relative.startsWith("..") || path28__default.isAbsolute(relative)) {
37305
37148
  throw new Error(`[fleet-wiki] conflict id escapes conflicts/: ${conflictId}`);
37306
37149
  }
37307
37150
  return conflictDir;
@@ -37339,11 +37182,11 @@ async function validatePatch(patch, paths) {
37339
37182
  if (!target || !summary || !proposer || !created) throw new Error("patch frontmatter is incomplete");
37340
37183
  if (summary.length > 120) throw new Error("patch summary exceeds 120 chars");
37341
37184
  assertCanonicalPatchTarget(target);
37342
- const absoluteTarget = path29__default.resolve(paths.root, target);
37343
- if (!absoluteTarget.startsWith(`${paths.root}${path29__default.sep}`) && absoluteTarget !== paths.root) {
37185
+ const absoluteTarget = path28__default.resolve(paths.root, target);
37186
+ if (!absoluteTarget.startsWith(`${paths.root}${path28__default.sep}`) && absoluteTarget !== paths.root) {
37344
37187
  throw new Error("patch target escapes wiki root");
37345
37188
  }
37346
- if (!absoluteTarget.startsWith(`${paths.wikiDir}${path29__default.sep}`)) throw new Error("wiki patch must target wiki/");
37189
+ if (!absoluteTarget.startsWith(`${paths.wikiDir}${path28__default.sep}`)) throw new Error("wiki patch must target wiki/");
37347
37190
  assertNoSymlinkPathComponents(target, paths);
37348
37191
  if (op === "create_wiki" && await pathExists(absoluteTarget)) {
37349
37192
  throw new Error(
@@ -37364,19 +37207,19 @@ async function applyPatch(patch, paths) {
37364
37207
  async function enqueuePatch(patch, paths, metaOverrides) {
37365
37208
  await ensureMemoryRoot(paths);
37366
37209
  const patchId = buildPatchId(patch.frontmatter.created, patch.frontmatter.summary, patch.frontmatter.target, patch.body);
37367
- const queueDir = path29__default.join(paths.queueDir, patchId);
37210
+ const queueDir = path28__default.join(paths.queueDir, patchId);
37368
37211
  if (await pathExists(queueDir)) {
37369
37212
  throw new Error(`[fleet-wiki] patch id collision: ${patchId} - this should never happen with target+body hashing`);
37370
37213
  }
37371
37214
  await mkdir(queueDir, { recursive: true });
37372
- await writePatchFile(path29__default.join(queueDir, PATCH_FILENAME), serializePatch(patch), paths);
37215
+ await writePatchFile(path28__default.join(queueDir, PATCH_FILENAME), serializePatch(patch), paths);
37373
37216
  const meta3 = {
37374
37217
  id: patchId,
37375
37218
  status: "pending",
37376
37219
  createdAt: patch.frontmatter.created,
37377
37220
  ...metaOverrides
37378
37221
  };
37379
- await writeJsonFile(path29__default.join(queueDir, PATCH_META_FILENAME), meta3, paths);
37222
+ await writeJsonFile(path28__default.join(queueDir, PATCH_META_FILENAME), meta3, paths);
37380
37223
  await appendLog(paths, "patch enqueued", {
37381
37224
  patch_id: patchId,
37382
37225
  patch_set_id: meta3.patch_set_id ?? null,
@@ -37394,7 +37237,7 @@ async function listQueue(paths) {
37394
37237
  for (const id of ids) {
37395
37238
  if (id === "_sets") continue;
37396
37239
  try {
37397
- const meta3 = await readJsonFile2(path29__default.join(paths.queueDir, id, PATCH_META_FILENAME));
37240
+ const meta3 = await readJsonFile2(path28__default.join(paths.queueDir, id, PATCH_META_FILENAME));
37398
37241
  results.push({ id, meta: meta3 });
37399
37242
  } catch {
37400
37243
  continue;
@@ -37419,17 +37262,17 @@ async function resolveQueueSelection(id, paths) {
37419
37262
  }
37420
37263
  async function showQueue(id, paths) {
37421
37264
  const selection = await resolveQueueSelection(id, paths);
37422
- const queueDir = path29__default.join(paths.queueDir, selection.id);
37423
- const patch = await parsePatch(await readPatchFile(path29__default.join(queueDir, PATCH_FILENAME)));
37424
- const meta3 = await readJsonFile2(path29__default.join(queueDir, PATCH_META_FILENAME));
37265
+ const queueDir = path28__default.join(paths.queueDir, selection.id);
37266
+ const patch = await parsePatch(await readPatchFile(path28__default.join(queueDir, PATCH_FILENAME)));
37267
+ const meta3 = await readJsonFile2(path28__default.join(queueDir, PATCH_META_FILENAME));
37425
37268
  return { patch, meta: meta3 };
37426
37269
  }
37427
37270
  async function rewriteQueuedPatch(id, paths, patch, meta3, expectedPatchHash) {
37428
37271
  assertSafeQueueId(id);
37429
37272
  return withPatchEditLock(paths, id, async () => {
37430
- const queueDir = path29__default.join(paths.queueDir, id);
37273
+ const queueDir = path28__default.join(paths.queueDir, id);
37431
37274
  if (expectedPatchHash !== void 0) {
37432
- const currentMarkdown = await readPatchFile(path29__default.join(queueDir, PATCH_FILENAME));
37275
+ const currentMarkdown = await readPatchFile(path28__default.join(queueDir, PATCH_FILENAME));
37433
37276
  const currentHash = computeContentHash(currentMarkdown);
37434
37277
  if (currentHash !== expectedPatchHash) {
37435
37278
  throw new Error(`[fleet-wiki] wiki_patch_edit stale base_patch_hash: expected ${currentHash}, got ${expectedPatchHash}`);
@@ -37438,8 +37281,8 @@ async function rewriteQueuedPatch(id, paths, patch, meta3, expectedPatchHash) {
37438
37281
  const patchMarkdown = serializePatch(patch);
37439
37282
  const patchHash = computeContentHash(patchMarkdown);
37440
37283
  const nextMeta = { ...meta3, lastEditHash: patchHash };
37441
- await writePatchFile(path29__default.join(queueDir, PATCH_FILENAME), patchMarkdown, paths);
37442
- await writeJsonFile(path29__default.join(queueDir, PATCH_META_FILENAME), nextMeta, paths);
37284
+ await writePatchFile(path28__default.join(queueDir, PATCH_FILENAME), patchMarkdown, paths);
37285
+ await writeJsonFile(path28__default.join(queueDir, PATCH_META_FILENAME), nextMeta, paths);
37443
37286
  return patchHash;
37444
37287
  });
37445
37288
  }
@@ -37463,8 +37306,8 @@ async function approvePatch(id, paths) {
37463
37306
  rawSourceRef: meta3.rawSourceRef,
37464
37307
  warnings: meta3.warnings
37465
37308
  });
37466
- const queueDir = path29__default.join(paths.queueDir, id);
37467
- await writeJsonFile(path29__default.join(queueDir, PATCH_META_FILENAME), {
37309
+ const queueDir = path28__default.join(paths.queueDir, id);
37310
+ await writeJsonFile(path28__default.join(queueDir, PATCH_META_FILENAME), {
37468
37311
  ...meta3,
37469
37312
  conflictId
37470
37313
  }, paths);
@@ -37500,7 +37343,7 @@ async function approvePatchSet(patchSetId, paths) {
37500
37343
  const failed = [];
37501
37344
  const missing = [];
37502
37345
  for (const patchId of patchSet.patchIds) {
37503
- const queueDir = path29__default.join(paths.queueDir, patchId);
37346
+ const queueDir = path28__default.join(paths.queueDir, patchId);
37504
37347
  if (!await pathExists(queueDir)) {
37505
37348
  missing.push(patchId);
37506
37349
  continue;
@@ -37566,7 +37409,7 @@ ${patch.body}`;
37566
37409
  }
37567
37410
  async function normalizeWikiEntryPatch(entry, target, paths) {
37568
37411
  assertSafeEntryId(entry.id);
37569
- if (entry.id !== path29__default.basename(target, ".md")) {
37412
+ if (entry.id !== path28__default.basename(target, ".md")) {
37570
37413
  throw new Error("wiki patch body id must match target filename");
37571
37414
  }
37572
37415
  const inlineRawSourceRef = extractInlineRawSourceRef(entry.body);
@@ -37609,9 +37452,9 @@ function buildPatchId(createdAt, summary, target, body) {
37609
37452
  }
37610
37453
  async function validatePatchBase(patch, meta3, paths) {
37611
37454
  if (patch.frontmatter.op !== "update_wiki" || !meta3?.baseVersion && !meta3?.baseHash) return;
37612
- const wikiId = path29__default.basename(patch.frontmatter.target, ".md");
37455
+ const wikiId = path28__default.basename(patch.frontmatter.target, ".md");
37613
37456
  const currentEntry = await readWikiEntry(wikiId, paths);
37614
- const currentPath = path29__default.join(paths.root, patch.frontmatter.target);
37457
+ const currentPath = path28__default.join(paths.root, patch.frontmatter.target);
37615
37458
  const currentMarkdown = await pathExists(currentPath) ? await readPatchFile(currentPath) : void 0;
37616
37459
  if (meta3.baseVersion !== void 0 && currentEntry?.version !== meta3.baseVersion) {
37617
37460
  throw new Error(
@@ -37670,17 +37513,17 @@ function assertCanonicalPatchTarget(target) {
37670
37513
  if (target.endsWith("/")) {
37671
37514
  throw new Error("patch target must not end with a slash");
37672
37515
  }
37673
- if (target.startsWith("/") || path29__default.posix.isAbsolute(target) || path29__default.win32.isAbsolute(target)) {
37516
+ if (target.startsWith("/") || path28__default.posix.isAbsolute(target) || path28__default.win32.isAbsolute(target)) {
37674
37517
  throw new Error("patch target must be relative");
37675
37518
  }
37676
- if (path29__default.posix.normalize(target) !== target) {
37519
+ if (path28__default.posix.normalize(target) !== target) {
37677
37520
  throw new Error("patch target must not contain dot segments or redundant separators");
37678
37521
  }
37679
37522
  }
37680
37523
  function canonicalApprovalLockKey(paths, target) {
37681
37524
  const wikiRoot = realpathSync(paths.wikiDir);
37682
- const relativeTarget = path29__default.posix.relative("wiki", target);
37683
- const targetPath = path29__default.join(wikiRoot, ...relativeTarget.split("/"));
37525
+ const relativeTarget = path28__default.posix.relative("wiki", target);
37526
+ const targetPath = path28__default.join(wikiRoot, ...relativeTarget.split("/"));
37684
37527
  return `${wikiRoot}\0${targetPath}`.toLowerCase();
37685
37528
  }
37686
37529
  function canonicalPatchEditLockKey(paths, patchId) {
@@ -37696,7 +37539,7 @@ function assertNoSymlinkPathComponents(target, paths) {
37696
37539
  throw error51;
37697
37540
  }
37698
37541
  for (const part of parts) {
37699
- current = path29__default.join(current, part);
37542
+ current = path28__default.join(current, part);
37700
37543
  try {
37701
37544
  if (lstatSync(current).isSymbolicLink()) {
37702
37545
  throw new Error("patch target must not include symlink path components");
@@ -37711,8 +37554,8 @@ function assertSafeRawSourceRef(rawSourceRef, paths) {
37711
37554
  if (!rawSourceRef.startsWith("raw/")) {
37712
37555
  throw new Error("raw source provenance must point into raw/");
37713
37556
  }
37714
- const absoluteRef = path29__default.resolve(paths.root, rawSourceRef);
37715
- if (!absoluteRef.startsWith(`${paths.rawDir}${path29__default.sep}`)) {
37557
+ const absoluteRef = path28__default.resolve(paths.root, rawSourceRef);
37558
+ if (!absoluteRef.startsWith(`${paths.rawDir}${path28__default.sep}`)) {
37716
37559
  throw new Error("raw source provenance must point into raw/");
37717
37560
  }
37718
37561
  }
@@ -37728,14 +37571,14 @@ function classifyPatchConflict(error51) {
37728
37571
  }
37729
37572
  async function recordPatchConflict(patch, paths, reason, options) {
37730
37573
  const now = /* @__PURE__ */ new Date();
37731
- const targetPath = path29__default.join(paths.root, patch.frontmatter.target);
37574
+ const targetPath = path28__default.join(paths.root, patch.frontmatter.target);
37732
37575
  const current = await pathExists(targetPath) ? await readPatchFile(targetPath) : void 0;
37733
37576
  const currentEntry = current ? parseStoredWikiEntry(current) : void 0;
37734
37577
  const proposedEntry = parsePatchBodyEntry(patch.body);
37735
37578
  const record2 = await createConflict({
37736
37579
  reason,
37737
37580
  target: patch.frontmatter.target,
37738
- wikiId: proposedEntry?.id ?? path29__default.basename(patch.frontmatter.target, ".md"),
37581
+ wikiId: proposedEntry?.id ?? path28__default.basename(patch.frontmatter.target, ".md"),
37739
37582
  title: proposedEntry?.title,
37740
37583
  proposer: patch.frontmatter.proposer,
37741
37584
  rawSourceRef: options?.rawSourceRef,
@@ -37831,11 +37674,11 @@ function parseInlineArray(value) {
37831
37674
  return inner.split(",").map((item) => item.trim().replace(/^"(.*)"$/, "$1"));
37832
37675
  }
37833
37676
  async function archiveQueueEntry(id, paths, meta3) {
37834
- const fromDir = path29__default.join(paths.queueDir, id);
37835
- const toDir = path29__default.join(paths.archiveDir, id);
37677
+ const fromDir = path28__default.join(paths.queueDir, id);
37678
+ const toDir = path28__default.join(paths.archiveDir, id);
37836
37679
  await removePath(toDir);
37837
37680
  await movePath(fromDir, toDir);
37838
- await writeJsonFile(path29__default.join(toDir, PATCH_META_FILENAME), meta3, paths);
37681
+ await writeJsonFile(path28__default.join(toDir, PATCH_META_FILENAME), meta3, paths);
37839
37682
  }
37840
37683
  function buildQueueIdHelp(prefix, availableIds) {
37841
37684
  if (availableIds.length === 0) {
@@ -38047,7 +37890,7 @@ async function resolveCompileSource(input, paths, now) {
38047
37890
  }
38048
37891
  async function buildCompileProposals(input, paths, now, resolvedSource) {
38049
37892
  const sourceTarget = `wiki/sources/${resolvedSource.sourcePageId}.md`;
38050
- const sourceExists = await pathExists(path29__default.join(paths.root, sourceTarget));
37893
+ const sourceExists = await pathExists(path28__default.join(paths.root, sourceTarget));
38051
37894
  const existingEntries = await listWiki(paths);
38052
37895
  const sourcePageTitle = resolvedSource.sourceTitle?.trim() || `Source ${resolvedSource.sourcePageId}`;
38053
37896
  const existingSourceEntry = existingEntries.find((entry) => entry.id === resolvedSource.sourcePageId);
@@ -38069,7 +37912,7 @@ async function buildCompileProposals(input, paths, now, resolvedSource) {
38069
37912
  target: sourceTarget,
38070
37913
  summary: truncateSummary(`Compile source page ${sourcePageTitle}`),
38071
37914
  entry: sourceEntry,
38072
- baseHash: sourceExists ? computeContentHash(await readPatchFile(path29__default.join(paths.root, sourceTarget))) : void 0,
37915
+ baseHash: sourceExists ? computeContentHash(await readPatchFile(path28__default.join(paths.root, sourceTarget))) : void 0,
38073
37916
  baseVersion: existingSourceEntry?.version
38074
37917
  }];
38075
37918
  const relatedCandidates = await discoverRelatedEntryCandidates(paths, resolvedSource.sourceContent, resolvedSource.sourceTitle);
@@ -38089,7 +37932,7 @@ async function buildCompileProposals(input, paths, now, resolvedSource) {
38089
37932
  rawSourceRefs: mergeRawSourceRefs(existing.rawSourceRefs, existing.rawSourceRef, { ref: resolvedSource.rawSourceRef }),
38090
37933
  body: appendSourceCompileNote(existing.body, resolvedSource.sourcePageId, resolvedSource.rawSourceRef)
38091
37934
  },
38092
- baseHash: computeContentHash(await readPatchFile(path29__default.join(paths.wikiDir, `${existing.id}.md`))),
37935
+ baseHash: computeContentHash(await readPatchFile(path28__default.join(paths.wikiDir, `${existing.id}.md`))),
38093
37936
  baseVersion: existing.version
38094
37937
  });
38095
37938
  }
@@ -38224,13 +38067,13 @@ async function readClaims(entryId, paths) {
38224
38067
  }
38225
38068
  }
38226
38069
  function getClaimsDir(paths) {
38227
- return path29__default.join(paths.wikiDir, CLAIMS_DIRNAME);
38070
+ return path28__default.join(paths.wikiDir, CLAIMS_DIRNAME);
38228
38071
  }
38229
38072
  function getClaimsFile(paths, entryId) {
38230
38073
  assertSafeEntryId(entryId);
38231
- const claimsFile = path29__default.join(getClaimsDir(paths), `${entryId}.json`);
38232
- const relative = path29__default.relative(getClaimsDir(paths), claimsFile);
38233
- if (!relative || relative.startsWith("..") || path29__default.isAbsolute(relative)) {
38074
+ const claimsFile = path28__default.join(getClaimsDir(paths), `${entryId}.json`);
38075
+ const relative = path28__default.relative(getClaimsDir(paths), claimsFile);
38076
+ if (!relative || relative.startsWith("..") || path28__default.isAbsolute(relative)) {
38234
38077
  throw new Error(`[fleet-wiki] claims sidecar escapes wiki/.claims: ${entryId}`);
38235
38078
  }
38236
38079
  return claimsFile;
@@ -38321,7 +38164,7 @@ function assertSafeClaimRawRef(ref) {
38321
38164
  if (!ref.startsWith("raw/")) {
38322
38165
  throw new Error(`claim sourceRef must point into raw/: ${ref}`);
38323
38166
  }
38324
- if (ref.includes("..") || path29__default.isAbsolute(ref)) {
38167
+ if (ref.includes("..") || path28__default.isAbsolute(ref)) {
38325
38168
  throw new Error(`claim sourceRef escapes raw/: ${ref}`);
38326
38169
  }
38327
38170
  }
@@ -38399,22 +38242,22 @@ async function runDryDock(paths, options = {}) {
38399
38242
  }
38400
38243
  for (const fileName of await listFileNames(paths.rawDir)) {
38401
38244
  if (!fileName.endsWith(".md")) continue;
38402
- const filePath = path29__default.join(paths.rawDir, fileName);
38245
+ const filePath = path28__default.join(paths.rawDir, fileName);
38403
38246
  issues.push(...safetyIssues(await readPatchFile(filePath), filePath));
38404
38247
  }
38405
38248
  for (const queueId of await listDirectoryNames(paths.queueDir)) {
38406
38249
  if (queueId === PATCH_SET_DIRNAME) continue;
38407
- const queueDir = path29__default.join(paths.queueDir, queueId);
38250
+ const queueDir = path28__default.join(paths.queueDir, queueId);
38408
38251
  try {
38409
- const patchContent = await readPatchFile(path29__default.join(queueDir, PATCH_FILENAME));
38410
- issues.push(...safetyIssues(patchContent, path29__default.join(queueDir, PATCH_FILENAME)));
38411
- await readJsonFile2(path29__default.join(queueDir, PATCH_META_FILENAME));
38252
+ const patchContent = await readPatchFile(path28__default.join(queueDir, PATCH_FILENAME));
38253
+ issues.push(...safetyIssues(patchContent, path28__default.join(queueDir, PATCH_FILENAME)));
38254
+ await readJsonFile2(path28__default.join(queueDir, PATCH_META_FILENAME));
38412
38255
  } catch {
38413
38256
  issues.push(issue2("malformed_queue", "error", "\uC190\uC0C1\uB41C queue \uC5D4\uD2B8\uB9AC", queueDir));
38414
38257
  }
38415
38258
  }
38416
- for (const patchSetId of await listDirectoryNames(path29__default.join(paths.queueDir, PATCH_SET_DIRNAME))) {
38417
- const patchSetMetaFile = path29__default.join(paths.queueDir, PATCH_SET_DIRNAME, patchSetId, PATCH_META_FILENAME);
38259
+ for (const patchSetId of await listDirectoryNames(path28__default.join(paths.queueDir, PATCH_SET_DIRNAME))) {
38260
+ const patchSetMetaFile = path28__default.join(paths.queueDir, PATCH_SET_DIRNAME, patchSetId, PATCH_META_FILENAME);
38418
38261
  let patchSet;
38419
38262
  try {
38420
38263
  patchSet = await readPatchSet(paths, patchSetId);
@@ -38423,8 +38266,8 @@ async function runDryDock(paths, options = {}) {
38423
38266
  continue;
38424
38267
  }
38425
38268
  for (const patchId of patchSet.patchIds) {
38426
- const queueMetaFile = path29__default.join(paths.queueDir, patchId, PATCH_META_FILENAME);
38427
- const archiveMetaFile = path29__default.join(paths.archiveDir, patchId, PATCH_META_FILENAME);
38269
+ const queueMetaFile = path28__default.join(paths.queueDir, patchId, PATCH_META_FILENAME);
38270
+ const archiveMetaFile = path28__default.join(paths.archiveDir, patchId, PATCH_META_FILENAME);
38428
38271
  if (!await pathExists(queueMetaFile) && !await pathExists(archiveMetaFile)) {
38429
38272
  issues.push(
38430
38273
  issue2(
@@ -38461,7 +38304,7 @@ async function runDryDock(paths, options = {}) {
38461
38304
  "conflict_unresolved",
38462
38305
  "warning",
38463
38306
  `\uBBF8\uD574\uACB0 conflict: ${conflict.reason} (${conflict.target})`,
38464
- path29__default.join(paths.conflictsDir, conflict.id, "meta.json")
38307
+ path28__default.join(paths.conflictsDir, conflict.id, "meta.json")
38465
38308
  )
38466
38309
  );
38467
38310
  }
@@ -38474,7 +38317,7 @@ async function runDryDock(paths, options = {}) {
38474
38317
  "unresolved_conflict",
38475
38318
  "warning",
38476
38319
  "\uC190\uC0C1\uB41C conflict \uC5D4\uD2B8\uB9AC",
38477
- path29__default.join(paths.conflictsDir, conflictId, "meta.json")
38320
+ path28__default.join(paths.conflictsDir, conflictId, "meta.json")
38478
38321
  )
38479
38322
  );
38480
38323
  }
@@ -38531,8 +38374,8 @@ async function claimIssues(paths, wikiIds) {
38531
38374
  const claimsDir = getClaimsDir(paths);
38532
38375
  for (const fileName of await listFileNames(claimsDir)) {
38533
38376
  if (!fileName.endsWith(".json")) continue;
38534
- const filePath = path29__default.join(claimsDir, fileName);
38535
- const entryIdFromFile = path29__default.basename(fileName, ".json");
38377
+ const filePath = path28__default.join(claimsDir, fileName);
38378
+ const entryIdFromFile = path28__default.basename(fileName, ".json");
38536
38379
  let raw;
38537
38380
  try {
38538
38381
  raw = await readJsonFile2(filePath);
@@ -38611,7 +38454,7 @@ function toSemanticEntry(filePath, frontmatter, body) {
38611
38454
  async function schemaIssues(paths) {
38612
38455
  const issues = [];
38613
38456
  const schema = await readWorkspaceSchemaSummary(paths);
38614
- const agentsPath = path29__default.join(paths.schemaDir, WORKSPACE_SCHEMA_AGENTS_FILENAME);
38457
+ const agentsPath = path28__default.join(paths.schemaDir, WORKSPACE_SCHEMA_AGENTS_FILENAME);
38615
38458
  if (!await pathExists(schema.wikiSchemaPath)) {
38616
38459
  issues.push(issue2("schema_missing", "warning", `Workspace schema file is missing: schema/${WORKSPACE_SCHEMA_FILENAME}`, schema.wikiSchemaPath));
38617
38460
  } else {
@@ -38931,7 +38774,7 @@ function parseOptionalIsoDate(value) {
38931
38774
  return Number.isFinite(timestamp) ? timestamp : null;
38932
38775
  }
38933
38776
  function hashBodyForComparison(body) {
38934
- return crypto4.createHash("sha256").update(body.replace(/\s+/g, " ").trim(), "utf8").digest("hex").slice(0, 8);
38777
+ return crypto3.createHash("sha256").update(body.replace(/\s+/g, " ").trim(), "utf8").digest("hex").slice(0, 8);
38935
38778
  }
38936
38779
  function hasConflictingStatuses(entries) {
38937
38780
  const statuses = new Set(entries.map((entry) => entry.status).filter((status) => status !== "unknown"));
@@ -38998,7 +38841,7 @@ async function listWikiMarkdownFiles(dirPath) {
38998
38841
  const files = [];
38999
38842
  const sortedEntries = entries.sort((left, right) => left.name.localeCompare(right.name));
39000
38843
  for (const entry of sortedEntries) {
39001
- const filePath = path29__default.join(dirPath, entry.name);
38844
+ const filePath = path28__default.join(dirPath, entry.name);
39002
38845
  if (entry.isDirectory()) {
39003
38846
  files.push(...await listWikiMarkdownFiles(filePath));
39004
38847
  continue;
@@ -39082,7 +38925,7 @@ async function planIngest(input, paths, now) {
39082
38925
  const target = `wiki/${input.id}.md`;
39083
38926
  const proposer = input.proposer ?? "tool:wiki_ingest";
39084
38927
  const currentEntry = await readWikiEntry(input.id, paths);
39085
- const currentMarkdown = currentEntry ? await readPatchFile(path29__default.join(paths.wikiDir, `${input.id}.md`)) : void 0;
38928
+ const currentMarkdown = currentEntry ? await readPatchFile(path28__default.join(paths.wikiDir, `${input.id}.md`)) : void 0;
39086
38929
  const currentHash = currentMarkdown ? computeContentHash(currentMarkdown) : void 0;
39087
38930
  const rawSource = buildRawSourceEntry(input, now);
39088
38931
  await ensureWorkspaceSchema(paths);
@@ -39761,11 +39604,11 @@ async function editQueuedPatch(input, paths) {
39761
39604
  };
39762
39605
  }
39763
39606
  async function readQueuedPatchSnapshot(paths, patchId) {
39764
- const queueDir = path29__default.join(paths.queueDir, patchId);
39765
- const markdown = await readPatchFile(path29__default.join(queueDir, PATCH_FILENAME));
39607
+ const queueDir = path28__default.join(paths.queueDir, patchId);
39608
+ const markdown = await readPatchFile(path28__default.join(queueDir, PATCH_FILENAME));
39766
39609
  return {
39767
39610
  patch: await parsePatch(markdown),
39768
- meta: await readJsonFile2(path29__default.join(queueDir, PATCH_META_FILENAME)),
39611
+ meta: await readJsonFile2(path28__default.join(queueDir, PATCH_META_FILENAME)),
39769
39612
  patchHash: computeContentHash(markdown)
39770
39613
  };
39771
39614
  }
@@ -40527,7 +40370,7 @@ ${input.answer ?? ""}`)}`;
40527
40370
  assertSafeEntryId(targetId);
40528
40371
  const subdir = input.targetType === "synthesis" ? "synthesis" : "queries";
40529
40372
  const target = `wiki/${subdir}/${targetId}.md`;
40530
- const absoluteTarget = path29__default.join(paths.root, target);
40373
+ const absoluteTarget = path28__default.join(paths.root, target);
40531
40374
  const exists = await pathExists(absoluteTarget);
40532
40375
  const existingEntry = exists ? await readWikiEntry(targetId, paths) : null;
40533
40376
  if (exists && !existingEntry) {
@@ -40609,7 +40452,7 @@ function assertSafeRawRef(rawRef) {
40609
40452
  if (!rawRef.startsWith("raw/")) {
40610
40453
  throw new Error(`[fleet-wiki] wiki_query raw source ref must point into raw/: ${rawRef}`);
40611
40454
  }
40612
- if (rawRef.includes("..") || path29__default.isAbsolute(rawRef)) {
40455
+ if (rawRef.includes("..") || path28__default.isAbsolute(rawRef)) {
40613
40456
  throw new Error(`[fleet-wiki] wiki_query raw source ref escapes raw/: ${rawRef}`);
40614
40457
  }
40615
40458
  }
@@ -40728,7 +40571,7 @@ async function buildReadEntryResult(entry, paths, graph, input) {
40728
40571
  rawSourceRef: entry.rawSourceRef,
40729
40572
  rawSourceRefs,
40730
40573
  source: {
40731
- path: path29__default.join("wiki", `${entry.id}.md`),
40574
+ path: path28__default.join("wiki", `${entry.id}.md`),
40732
40575
  rawSourceRef: entry.rawSourceRef,
40733
40576
  rawSourceRefs
40734
40577
  },
@@ -40854,7 +40697,7 @@ function buildRelatedEntries(entry, graph) {
40854
40697
  deduped.set(candidate.id, {
40855
40698
  id: relatedEntry.id,
40856
40699
  title: relatedEntry.title,
40857
- path: path29__default.join("wiki", `${relatedEntry.id}.md`),
40700
+ path: path28__default.join("wiki", `${relatedEntry.id}.md`),
40858
40701
  reason: candidate.reason
40859
40702
  });
40860
40703
  }
@@ -41127,7 +40970,7 @@ var DEFAULT_TICKET_TTL_MS = 1e4;
41127
40970
  function createPluginTerminalTicketRegistry(deps = {}) {
41128
40971
  const ttlMs = deps.ttlMs ?? DEFAULT_TICKET_TTL_MS;
41129
40972
  const now = deps.now ?? Date.now;
41130
- const randomTicket = deps.randomTicket ?? (() => crypto4.randomBytes(32).toString("base64url"));
40973
+ const randomTicket = deps.randomTicket ?? (() => crypto3.randomBytes(32).toString("base64url"));
41131
40974
  const tickets = /* @__PURE__ */ new Map();
41132
40975
  function issue3(context) {
41133
40976
  prune();
@@ -41161,18 +41004,18 @@ function resolveConsolePackageRequire(currentFile, fallback) {
41161
41004
  function findConsolePackageRequire(currentFile) {
41162
41005
  const explicitRoot = process.env.FLEET_CONSOLE_PACKAGE_ROOT;
41163
41006
  if (explicitRoot) {
41164
- const explicitPackageJson = path29__default.join(explicitRoot, "package.json");
41007
+ const explicitPackageJson = path28__default.join(explicitRoot, "package.json");
41165
41008
  if (isFleetConsolePackage(explicitPackageJson)) return createRequire(explicitPackageJson);
41166
41009
  }
41167
- let dir = path29__default.dirname(currentFile);
41010
+ let dir = path28__default.dirname(currentFile);
41168
41011
  while (true) {
41169
- const packageJson = path29__default.join(dir, "package.json");
41012
+ const packageJson = path28__default.join(dir, "package.json");
41170
41013
  if (isFleetConsolePackage(packageJson)) return createRequire(packageJson);
41171
- const nestedConsolePackage = path29__default.join(dir, "runtime", "fleet-console", "package.json");
41014
+ const nestedConsolePackage = path28__default.join(dir, "runtime", "fleet-console", "package.json");
41172
41015
  if (isFleetConsolePackage(nestedConsolePackage)) return createRequire(nestedConsolePackage);
41173
- const siblingConsolePackage = path29__default.join(dir, "..", "..", "fleet-console", "package.json");
41016
+ const siblingConsolePackage = path28__default.join(dir, "..", "..", "fleet-console", "package.json");
41174
41017
  if (isFleetConsolePackage(siblingConsolePackage)) return createRequire(siblingConsolePackage);
41175
- const parent = path29__default.dirname(dir);
41018
+ const parent = path28__default.dirname(dir);
41176
41019
  if (parent === dir) return null;
41177
41020
  dir = parent;
41178
41021
  }
@@ -41208,10 +41051,10 @@ var DEFAULT_TERMINAL_CWD_FALLBACK = os3__default.homedir;
41208
41051
  var TERMINAL_TERM = "xterm-256color";
41209
41052
  var require2 = createRequire(import.meta.url);
41210
41053
  function createShellTerminalLaunchResolver(deps = {}) {
41211
- const baseCwd = deps.cwd ?? process5.cwd();
41212
- const env = deps.env ?? process5.env;
41054
+ const baseCwd = deps.cwd ?? process4.cwd();
41055
+ const env = deps.env ?? process4.env;
41213
41056
  const homedir3 = deps.homedir ?? DEFAULT_TERMINAL_CWD_FALLBACK;
41214
- const platform = deps.platform ?? process5.platform;
41057
+ const platform = deps.platform ?? process4.platform;
41215
41058
  return async (selectedCwd) => {
41216
41059
  const cwd = selectedCwd || baseCwd || homedir3();
41217
41060
  const shell = resolveWindowsLaunchBinary(resolveUserShell(env, platform), [], env, platform, "user shell");
@@ -41222,7 +41065,7 @@ function startTerminalShell(launch, size) {
41222
41065
  const testStartShell = globalThis.__fleetTerminalStartShell;
41223
41066
  if (testStartShell) return testStartShell(launch, size);
41224
41067
  const { spawn: spawnPty } = loadNodePty();
41225
- const useConptyDll = resolveUseConptyDll(process5.platform, process5.env);
41068
+ const useConptyDll = resolveUseConptyDll(process4.platform, process4.env);
41226
41069
  return spawnPty(launch.bin, [...launch.args], {
41227
41070
  cols: size.cols,
41228
41071
  rows: size.rows,
@@ -41238,11 +41081,26 @@ function resolveUseConptyDll(platform, env) {
41238
41081
  return override !== "0" && override !== "false";
41239
41082
  }
41240
41083
  function loadNodePty() {
41241
- return loadNodePtyRequire(fileURLToPath(import.meta.url))("node-pty");
41084
+ const nodePtyRequire = loadNodePtyRequire(fileURLToPath(import.meta.url));
41085
+ ensureNodePtySpawnHelpersExecutable(path28__default.dirname(nodePtyRequire.resolve("node-pty/package.json")));
41086
+ return nodePtyRequire("node-pty");
41242
41087
  }
41243
41088
  function loadNodePtyRequire(currentFile) {
41244
41089
  return resolveConsolePackageRequire(currentFile, require2);
41245
41090
  }
41091
+ function ensureNodePtySpawnHelpersExecutable(packageRoot, platform = process4.platform, architecture = process4.arch) {
41092
+ if (platform !== "darwin") return;
41093
+ for (const directory of ["build/Release", "build/Debug", `prebuilds/darwin-${architecture}`]) {
41094
+ const helper = path28__default.join(packageRoot, directory, "spawn-helper");
41095
+ try {
41096
+ const stat3 = lstatSync(helper);
41097
+ if (!stat3.isFile() || stat3.isSymbolicLink() || (stat3.mode & 73) === 73) continue;
41098
+ chmodSync(helper, stat3.mode | 73);
41099
+ } catch (error51) {
41100
+ if (error51.code !== "ENOENT") throw error51;
41101
+ }
41102
+ }
41103
+ }
41246
41104
  function resolveUserShell(env, platform) {
41247
41105
  if (env.SHELL) return env.SHELL;
41248
41106
  if (platform === "win32") return env.ComSpec || "powershell.exe";
@@ -42014,7 +41872,7 @@ function captureSession(options) {
42014
41872
  function readProviderSessionCapture(fleetSessionId, deps = {}) {
42015
41873
  if (!isSafeCaptureId(fleetSessionId)) return null;
42016
41874
  const capturesDir = deps.capturesDir ?? defaultCapturePaths().capturesDir;
42017
- const filePath = path29__default.join(capturesDir, `${fleetSessionId}.json`);
41875
+ const filePath = path28__default.join(capturesDir, `${fleetSessionId}.json`);
42018
41876
  try {
42019
41877
  const parsed = JSON.parse(fs2__default.readFileSync(filePath, "utf8"));
42020
41878
  return sanitizeProviderSession(parsed);
@@ -42026,7 +41884,7 @@ function unlinkProviderSessionCapture(fleetSessionId, deps = {}) {
42026
41884
  if (!isSafeCaptureId(fleetSessionId)) return false;
42027
41885
  const capturesDir = deps.capturesDir ?? defaultCapturePaths().capturesDir;
42028
41886
  try {
42029
- fs2__default.unlinkSync(path29__default.join(capturesDir, `${fleetSessionId}.json`));
41887
+ fs2__default.unlinkSync(path28__default.join(capturesDir, `${fleetSessionId}.json`));
42030
41888
  return true;
42031
41889
  } catch {
42032
41890
  return false;
@@ -42034,12 +41892,12 @@ function unlinkProviderSessionCapture(fleetSessionId, deps = {}) {
42034
41892
  }
42035
41893
  function captureSessionStrict(options) {
42036
41894
  const provider = parseProvider(options.provider);
42037
- const fleetSessionId = readFleetSessionId(options.env ?? process5.env);
41895
+ const fleetSessionId = readFleetSessionId(options.env ?? process4.env);
42038
41896
  const input = parseHookInput(options.input ?? "");
42039
41897
  const providerSession = toProviderSession(provider, input, options.now ?? (() => /* @__PURE__ */ new Date()));
42040
41898
  const capturesDir = (options.paths ?? defaultCapturePaths()).capturesDir;
42041
- const finalPath = path29__default.join(capturesDir, `${fleetSessionId}.json`);
42042
- const tempPath = path29__default.join(capturesDir, `${CAPTURE_TEMP_PREFIX}${fleetSessionId}.${process5.pid}.${Date.now()}.tmp`);
41899
+ const finalPath = path28__default.join(capturesDir, `${fleetSessionId}.json`);
41900
+ const tempPath = path28__default.join(capturesDir, `${CAPTURE_TEMP_PREFIX}${fleetSessionId}.${process4.pid}.${Date.now()}.tmp`);
42043
41901
  fs2__default.mkdirSync(capturesDir, { recursive: true, mode: 448 });
42044
41902
  fs2__default.writeFileSync(tempPath, `${JSON.stringify(providerSession, null, 2)}
42045
41903
  `, { mode: 384 });
@@ -42047,13 +41905,13 @@ function captureSessionStrict(options) {
42047
41905
  return { path: finalPath, providerSession };
42048
41906
  }
42049
41907
  function parseProvider(value) {
42050
- if (isProvider(value)) return value;
41908
+ if (value === "claude" || value === "codex") return value;
42051
41909
  throw new Error("invalid_provider");
42052
41910
  }
42053
41911
  function readFleetSessionId(env) {
42054
41912
  const value = env.FLEET_CONSOLE_SESSION_ID;
42055
41913
  if (!value) throw new Error("missing_fleet_session_id");
42056
- if (path29__default.basename(value) !== value || value.includes(path29__default.sep) || value.includes(path29__default.posix.sep)) {
41914
+ if (path28__default.basename(value) !== value || value.includes(path28__default.sep) || value.includes(path28__default.posix.sep)) {
42057
41915
  throw new Error("invalid_fleet_session_id");
42058
41916
  }
42059
41917
  return value;
@@ -42067,10 +41925,10 @@ function parseHookInput(input) {
42067
41925
  throw new Error("invalid_hook_input");
42068
41926
  }
42069
41927
  function toProviderSession(provider, input, now) {
42070
- const sessionId = readProviderSessionId(input);
41928
+ if (typeof input.session_id !== "string" || input.session_id.length === 0) throw new Error("missing_provider_session_id");
42071
41929
  return {
42072
41930
  provider,
42073
- sessionId,
41931
+ sessionId: input.session_id,
42074
41932
  ...typeof input.transcript_path === "string" && input.transcript_path.length > 0 ? { transcriptPath: input.transcript_path } : {},
42075
41933
  ...typeof input.source === "string" && input.source.length > 0 ? { source: input.source } : {},
42076
41934
  capturedAt: now().toISOString()
@@ -42079,7 +41937,7 @@ function toProviderSession(provider, input, now) {
42079
41937
  function sanitizeProviderSession(value) {
42080
41938
  if (!value || typeof value !== "object" || Array.isArray(value)) return null;
42081
41939
  const candidate = value;
42082
- if (!isProvider(candidate.provider) || typeof candidate.sessionId !== "string" || typeof candidate.capturedAt !== "string") return null;
41940
+ if (candidate.provider !== "claude" && candidate.provider !== "codex" || typeof candidate.sessionId !== "string" || typeof candidate.capturedAt !== "string") return null;
42083
41941
  return {
42084
41942
  provider: candidate.provider,
42085
41943
  sessionId: candidate.sessionId,
@@ -42088,20 +41946,11 @@ function sanitizeProviderSession(value) {
42088
41946
  capturedAt: candidate.capturedAt
42089
41947
  };
42090
41948
  }
42091
- function readProviderSessionId(input) {
42092
- for (const value of [input.session_id, input.conversation_id, input.chat_id]) {
42093
- if (typeof value === "string" && value.length > 0) return value;
42094
- }
42095
- throw new Error("missing_provider_session_id");
42096
- }
42097
- function isProvider(value) {
42098
- return value === "claude" || value === "codex" || value === "cursor";
42099
- }
42100
41949
  function isSafeCaptureId(value) {
42101
- return value.length > 0 && path29__default.basename(value) === value && !value.includes(path29__default.sep) && !value.includes(path29__default.posix.sep);
41950
+ return value.length > 0 && path28__default.basename(value) === value && !value.includes(path28__default.sep) && !value.includes(path28__default.posix.sep);
42102
41951
  }
42103
41952
  function defaultCapturePaths() {
42104
- return { capturesDir: path29__default.join(getFleetDataDir(), CONSOLE_DATA_DIR_NAME, CONSOLE_CAPTURES_DIR_NAME) };
41953
+ return { capturesDir: path28__default.join(getFleetDataDir(), CONSOLE_DATA_DIR_NAME, CONSOLE_CAPTURES_DIR_NAME) };
42105
41954
  }
42106
41955
  var JAVASCRIPT_ENTRY_EXTENSIONS = /* @__PURE__ */ new Set([".cjs", ".js", ".mjs"]);
42107
41956
  var TYPESCRIPT_ENTRY_EXTENSIONS = /* @__PURE__ */ new Set([".cts", ".mts", ".ts", ".tsx"]);
@@ -42116,7 +41965,7 @@ function buildConsoleAutoNameHookCommand(entry) {
42116
41965
  return buildConsoleCliHookExec(entry, ["hook", "auto-name"]);
42117
41966
  }
42118
41967
  function buildConsoleCaptureHookCommand(entry, cliId) {
42119
- const extension = path29__default.extname(entry.entryPath);
41968
+ const extension = path28__default.extname(entry.entryPath);
42120
41969
  if (JAVASCRIPT_ENTRY_EXTENSIONS.has(extension)) {
42121
41970
  return createSessionCaptureHookExec({
42122
41971
  entryPath: entry.entryPath,
@@ -42139,7 +41988,6 @@ function buildConsoleCaptureHookCommand(entry, cliId) {
42139
41988
  }
42140
41989
  function toCaptureProvider(cliId) {
42141
41990
  if (cliId === "codex") return "codex";
42142
- if (cliId === "cursor") return "cursor";
42143
41991
  return "claude";
42144
41992
  }
42145
41993
  function runCodexCommand(command) {
@@ -42152,11 +42000,11 @@ function runCodexCommand(command) {
42152
42000
  }
42153
42001
  function withConsoleMarketplaceLock(target, fn) {
42154
42002
  const lockDir = `${target}${MARKETPLACE_LOCK_DIR_SUFFIX}`;
42155
- mkdirSync(path29__default.dirname(lockDir), { recursive: true });
42003
+ mkdirSync(path28__default.dirname(lockDir), { recursive: true });
42156
42004
  return withDirectoryLock({ lockDir }, fn);
42157
42005
  }
42158
42006
  function buildConsoleCliHookExec(entry, trailingArgs) {
42159
- const extension = path29__default.extname(entry.entryPath);
42007
+ const extension = path28__default.extname(entry.entryPath);
42160
42008
  if (JAVASCRIPT_ENTRY_EXTENSIONS.has(extension)) {
42161
42009
  return {
42162
42010
  command: entry.execPath,
@@ -42182,12 +42030,12 @@ var CONSOLE_ENTRY_PATH = fileURLToPath(import.meta.url);
42182
42030
  var HOOK_ENTRY_EXTENSIONS = /* @__PURE__ */ new Set([".cjs", ".cts", ".js", ".mjs", ".mts", ".ts", ".tsx"]);
42183
42031
  var require4 = createRequire(import.meta.url);
42184
42032
  function createAgentTerminalLaunchResolver(deps = {}) {
42185
- const baseCwd = deps.cwd ?? process5.cwd();
42186
- const env = deps.env ?? process5.env;
42187
- const execPath = deps.execPath ?? process5.execPath;
42033
+ const baseCwd = deps.cwd ?? process4.cwd();
42034
+ const env = deps.env ?? process4.env;
42035
+ const execPath = deps.execPath ?? process4.execPath;
42188
42036
  const homedir3 = deps.homedir ?? DEFAULT_TERMINAL_CWD_FALLBACK2;
42189
- const platform = deps.platform ?? process5.platform;
42190
- const entryPath = resolveHookEntryPath(deps.entryPath ?? process5.argv[1]);
42037
+ const platform = deps.platform ?? process4.platform;
42038
+ const entryPath = resolveHookEntryPath(deps.entryPath ?? process4.argv[1]);
42191
42039
  const tsxLoaderPath = deps.tsxLoaderPath ?? resolveOptionalPackage("tsx");
42192
42040
  const dataDir = deps.dataDir ?? getFleetDataDir();
42193
42041
  const infraServices = deps.infraServices ?? createInfraServices();
@@ -42240,7 +42088,7 @@ function resolveHookEntryPath(candidate) {
42240
42088
  return CONSOLE_ENTRY_PATH;
42241
42089
  }
42242
42090
  function hasHookEntryExtension(entryPath) {
42243
- return HOOK_ENTRY_EXTENSIONS.has(path29__default.extname(entryPath));
42091
+ return HOOK_ENTRY_EXTENSIONS.has(path28__default.extname(entryPath));
42244
42092
  }
42245
42093
  async function createAgentCliLaunchSpec(options) {
42246
42094
  const cleanupStack = [];
@@ -42462,7 +42310,7 @@ function createConsoleObservabilityStore(deps = {}) {
42462
42310
  return terminalSessionsById.get(sessionId)?.cwd ?? workspacesByCliRunId.get(sessionId)?.session.cwd ?? null;
42463
42311
  }
42464
42312
  function createPendingTerminalSession(input) {
42465
- if (!path29__default.isAbsolute(input.cwd)) throw new Error("Terminal session cwd must be absolute");
42313
+ if (!path28__default.isAbsolute(input.cwd)) throw new Error("Terminal session cwd must be absolute");
42466
42314
  const createdAt = input.createdAt ?? now();
42467
42315
  const canonicalCwd = canonicalizeTheaterPath(input.cwd);
42468
42316
  const theaterId = workspaceHash(canonicalCwd);
@@ -42470,7 +42318,7 @@ function createConsoleObservabilityStore(deps = {}) {
42470
42318
  sessionId: input.sessionId,
42471
42319
  cwd: input.cwd,
42472
42320
  canonicalCwd,
42473
- cwdLabel: path29__default.basename(input.cwd) || input.cwd,
42321
+ cwdLabel: path28__default.basename(input.cwd) || input.cwd,
42474
42322
  cliId: input.cliId,
42475
42323
  createdAt,
42476
42324
  theaterId,
@@ -42485,7 +42333,7 @@ function createConsoleObservabilityStore(deps = {}) {
42485
42333
  sessionId: operation.sessionId,
42486
42334
  cwd: operation.cwd,
42487
42335
  canonicalCwd: canonicalizeTheaterPath(operation.cwd),
42488
- cwdLabel: path29__default.basename(operation.cwd) || operation.cwd,
42336
+ cwdLabel: path28__default.basename(operation.cwd) || operation.cwd,
42489
42337
  label: operation.label,
42490
42338
  labelSource: operation.labelSource,
42491
42339
  cliId: operation.cliId,
@@ -42711,10 +42559,10 @@ function toTerminalSessionInfo(state) {
42711
42559
  };
42712
42560
  }
42713
42561
  function defaultWorkspaceHash(canonicalCwd) {
42714
- return crypto4.createHash("sha256").update(canonicalCwd).digest("hex").slice(0, 12);
42562
+ return crypto3.createHash("sha256").update(canonicalCwd).digest("hex").slice(0, 12);
42715
42563
  }
42716
42564
  function defaultCanonicalizeTheaterPath(cwd) {
42717
- const resolved = path29__default.resolve(cwd);
42565
+ const resolved = path28__default.resolve(cwd);
42718
42566
  try {
42719
42567
  return fs2__default.realpathSync.native(resolved);
42720
42568
  } catch {
@@ -42980,8 +42828,10 @@ function createAgentApi(ctx, terminalRuntime, deps) {
42980
42828
  if (!sessionId) return;
42981
42829
  observability.appendTerminalRuntimeEvent(sessionId, withSignatureCli(event, runtime.carrierRuntime.registry));
42982
42830
  });
42831
+ const reminderWriter = createDelayedPtyWriter();
42983
42832
  const unsubscribeReminder = createCarrierResultReminderRouter({
42984
42833
  streamRegister: runtime.carrierRuntime.jobs.streaming.register,
42834
+ writer: reminderWriter,
42985
42835
  resolveSink: (event) => {
42986
42836
  const sessionId = resolveCarrierEventOrigin(event, jobOriginById);
42987
42837
  return sessionId ? { write: (data) => terminalRuntime.write(sessionId, data) } : void 0;
@@ -42989,7 +42839,9 @@ function createAgentApi(ctx, terminalRuntime, deps) {
42989
42839
  resolvePolicy: (event) => {
42990
42840
  const sessionId = resolveCarrierEventOrigin(event, jobOriginById);
42991
42841
  return sessionId ? terminalRuntime.getMessagePolicy(sessionId) ?? {} : {};
42992
- }
42842
+ },
42843
+ // 세션별 지연 제출 직렬화 키: 같은 터미널 세션으로 동시 도착한 리마인더가 뒤섞이지 않도록 한다.
42844
+ resolveSessionKey: (event) => resolveCarrierEventOrigin(event, jobOriginById) ?? void 0
42993
42845
  });
42994
42846
  const unsubscribeRename = ctx.host.events.subscribe(OPERATION_RENAMED_EVENT_CHANNEL, (payload) => {
42995
42847
  if (!isOperationRenamedEvent(payload)) return;
@@ -43138,14 +42990,14 @@ function createAgentApi(ctx, terminalRuntime, deps) {
43138
42990
  ctx.host.http.writeJson(res, 409, { error: "agent_cli_unavailable" });
43139
42991
  return;
43140
42992
  }
43141
- const sessionId = crypto4.randomUUID();
42993
+ const sessionId = crypto3.randomUUID();
43142
42994
  const session = observability.createPendingTerminalSession({ sessionId, cwd, cliId });
43143
42995
  ctx.host.operations.create({
43144
42996
  id: session.sessionId,
43145
42997
  theaterId,
43146
42998
  type: AGENT_OPERATION_TYPE,
43147
42999
  pluginId: ctx.pluginId,
43148
- title: session.label ?? path29__default.basename(cwd),
43000
+ title: session.label ?? path28__default.basename(cwd),
43149
43001
  payload: toOperationPayload(cwd, session),
43150
43002
  createdAt: session.createdAt
43151
43003
  });
@@ -43256,7 +43108,7 @@ function createAgentApi(ctx, terminalRuntime, deps) {
43256
43108
  if (result?.renamed) {
43257
43109
  observability.notifySessionUpdated(result.session);
43258
43110
  const autoNameCwd = readPayloadString(ctx.host.operations.get(sessionId)?.payload ?? {}, "cwd") ?? result.session.cwdLabel;
43259
- ctx.host.operations.patch(sessionId, { title: result.session.label ?? path29__default.basename(autoNameCwd) });
43111
+ ctx.host.operations.patch(sessionId, { title: result.session.label ?? path28__default.basename(autoNameCwd) });
43260
43112
  }
43261
43113
  ctx.host.http.writeJson(res, 200, { ok: true, renamed: result?.renamed === true });
43262
43114
  return true;
@@ -43270,8 +43122,8 @@ function createAgentApi(ctx, terminalRuntime, deps) {
43270
43122
  return true;
43271
43123
  }
43272
43124
  const result = captureSession({
43273
- diagnostics: process5.stderr,
43274
- env: { ...process5.env, FLEET_CONSOLE_SESSION_ID: sessionId },
43125
+ diagnostics: process4.stderr,
43126
+ env: { ...process4.env, FLEET_CONSOLE_SESSION_ID: sessionId },
43275
43127
  input: body.input,
43276
43128
  paths: ctx.host.paths,
43277
43129
  provider: body.provider
@@ -43290,7 +43142,7 @@ function createAgentApi(ctx, terminalRuntime, deps) {
43290
43142
  }
43291
43143
  async function buildAgentCliLaunchMetadata() {
43292
43144
  const metadata = getAgentCliMetadata();
43293
- if ((process5.env.FLEET_TERMINAL_CMD ?? "").trim().length > 0) {
43145
+ if ((process4.env.FLEET_TERMINAL_CMD ?? "").trim().length > 0) {
43294
43146
  return metadata.map((meta3) => ({ id: meta3.id, label: meta3.label, available: true, signedIn: true }));
43295
43147
  }
43296
43148
  const detected = await detector.detect();
@@ -43343,9 +43195,7 @@ function createAgentApi(ctx, terminalRuntime, deps) {
43343
43195
  const safeLabel = sanitizeCarrierResultReminder(label.replace(/[\r\n\t]+/g, " ")).trim();
43344
43196
  if (safeLabel.length === 0) return;
43345
43197
  const policy = terminalRuntime.getMessagePolicy(sessionId) ?? {};
43346
- for (const chunk of formatCarrierResultReminderMessage(policy, `${renameCommand} ${safeLabel}`)) {
43347
- terminalRuntime.write(sessionId, chunk);
43348
- }
43198
+ reminderWriter.enqueue(sessionId, (data) => terminalRuntime.write(sessionId, data), formatCarrierResultReminderMessage(policy, `${renameCommand} ${safeLabel}`));
43349
43199
  }
43350
43200
  function injectOperation(operation) {
43351
43201
  const cwd = readPayloadString(operation.payload, "cwd") ?? ctx.host.paths.resolveTheaterPath(operation.theaterId) ?? "";
@@ -43421,7 +43271,7 @@ function readProviderSession(value) {
43421
43271
  const providerSession = value?.providerSession;
43422
43272
  if (!providerSession || typeof providerSession !== "object") return void 0;
43423
43273
  const candidate = providerSession;
43424
- if (!isProvider2(candidate.provider) || typeof candidate.sessionId !== "string" || typeof candidate.capturedAt !== "string") return void 0;
43274
+ if (candidate.provider !== "claude" && candidate.provider !== "codex" || typeof candidate.sessionId !== "string" || typeof candidate.capturedAt !== "string") return void 0;
43425
43275
  return {
43426
43276
  provider: candidate.provider,
43427
43277
  sessionId: candidate.sessionId,
@@ -43430,9 +43280,6 @@ function readProviderSession(value) {
43430
43280
  ...typeof candidate.source === "string" ? { source: candidate.source } : {}
43431
43281
  };
43432
43282
  }
43433
- function isProvider2(value) {
43434
- return value === "claude" || value === "codex" || value === "cursor";
43435
- }
43436
43283
  function resolveCarrierEventOrigin(event, jobOriginById) {
43437
43284
  if (event.originSessionId) {
43438
43285
  jobOriginById.set(event.jobId, event.originSessionId);