@dotobokuri/fleet-console 1.16.0 → 1.17.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/AGENTS.md +5 -2
  2. package/dist/cli.mjs +499 -299
  3. package/dist/client/assets/{_baseUniq-Dl47hoBn.js → _baseUniq-24vRkv8i.js} +1 -1
  4. package/dist/client/assets/{arc-gTL65oBG.js → arc-BTiCiQ57.js} +1 -1
  5. package/dist/client/assets/{architectureDiagram-Q4EWVU46-B4ysOekM.js → architectureDiagram-Q4EWVU46-B24oDJvB.js} +1 -1
  6. package/dist/client/assets/{blockDiagram-DXYQGD6D-Cn9GJTRY.js → blockDiagram-DXYQGD6D-BOAE3FdW.js} +1 -1
  7. package/dist/client/assets/{c4Diagram-AHTNJAMY-BIub3g5q.js → c4Diagram-AHTNJAMY-C0W9raQx.js} +1 -1
  8. package/dist/client/assets/channel-yb1CkB_S.js +1 -0
  9. package/dist/client/assets/{chunk-4BX2VUAB-DFHyuJK_.js → chunk-4BX2VUAB-DvyhIkzo.js} +1 -1
  10. package/dist/client/assets/{chunk-4TB4RGXK-CV_laQzm.js → chunk-4TB4RGXK-CMV1UZLH.js} +1 -1
  11. package/dist/client/assets/{chunk-55IACEB6-Cs5LeHXe.js → chunk-55IACEB6-CG75wbs4.js} +1 -1
  12. package/dist/client/assets/{chunk-EDXVE4YY-D_LyOot5.js → chunk-EDXVE4YY-9CjdVkNM.js} +1 -1
  13. package/dist/client/assets/{chunk-FMBD7UC4-B1dz5YRM.js → chunk-FMBD7UC4-i496V3zS.js} +1 -1
  14. package/dist/client/assets/{chunk-OYMX7WX6-CT0D_NEN.js → chunk-OYMX7WX6-CeRfBoEk.js} +1 -1
  15. package/dist/client/assets/{chunk-QZHKN3VN-CWNbvQat.js → chunk-QZHKN3VN-D1mXQVL_.js} +1 -1
  16. package/dist/client/assets/{chunk-YZCP3GAM-C_fp6KvG.js → chunk-YZCP3GAM-DUXK6jpB.js} +1 -1
  17. package/dist/client/assets/classDiagram-6PBFFD2Q-DgNTT8Lb.js +1 -0
  18. package/dist/client/assets/classDiagram-v2-HSJHXN6E-DgNTT8Lb.js +1 -0
  19. package/dist/client/assets/clone-BLvG1gy6.js +1 -0
  20. package/dist/client/assets/{cose-bilkent-S5V4N54A-B6xq1D1R.js → cose-bilkent-S5V4N54A-Cw97IMZH.js} +1 -1
  21. package/dist/client/assets/{dagre-KV5264BT-_leuW1pD.js → dagre-KV5264BT-CyY9URRi.js} +1 -1
  22. package/dist/client/assets/{diagram-5BDNPKRD-4wH1x31-.js → diagram-5BDNPKRD-BEVj5KaK.js} +1 -1
  23. package/dist/client/assets/{diagram-G4DWMVQ6-nlP8pQsq.js → diagram-G4DWMVQ6-IXOT_4VL.js} +1 -1
  24. package/dist/client/assets/{diagram-MMDJMWI5-CWgyNhRW.js → diagram-MMDJMWI5-CO2p0poL.js} +1 -1
  25. package/dist/client/assets/{diagram-TYMM5635-DfGqjepr.js → diagram-TYMM5635-DvRDFMNM.js} +1 -1
  26. package/dist/client/assets/{erDiagram-SMLLAGMA-CMpgXQfn.js → erDiagram-SMLLAGMA-C5uteguB.js} +1 -1
  27. package/dist/client/assets/{flowDiagram-DWJPFMVM-BaLRDaS7.js → flowDiagram-DWJPFMVM-JekEx60D.js} +1 -1
  28. package/dist/client/assets/{ganttDiagram-T4ZO3ILL-CAuXJ2xz.js → ganttDiagram-T4ZO3ILL-DRKjnKDn.js} +1 -1
  29. package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-KsfuOuTW.js → gitGraphDiagram-UUTBAWPF-Dhnk3n7N.js} +1 -1
  30. package/dist/client/assets/{graph-3375lXck.js → graph-DE-kEMug.js} +1 -1
  31. package/dist/client/assets/index-BY_CeGCl.js +402 -0
  32. package/dist/client/assets/{index-BRniWsxl.css → index-CfNSyAUJ.css} +1 -1
  33. package/dist/client/assets/{infoDiagram-42DDH7IO-GYhjUtOi.js → infoDiagram-42DDH7IO-DG9M_7T9.js} +1 -1
  34. package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-DfjzfJ87.js → ishikawaDiagram-UXIWVN3A-CiP4wnqc.js} +1 -1
  35. package/dist/client/assets/{journeyDiagram-VCZTEJTY-CjF_oAe2.js → journeyDiagram-VCZTEJTY-DklSog3d.js} +1 -1
  36. package/dist/client/assets/{kanban-definition-6JOO6SKY-DkIK9azu.js → kanban-definition-6JOO6SKY-BVB77h52.js} +1 -1
  37. package/dist/client/assets/{layout-g4DCAcmJ.js → layout-CAevigwv.js} +1 -1
  38. package/dist/client/assets/{linear-BXtneTLA.js → linear-CB_shmWV.js} +1 -1
  39. package/dist/client/assets/{mermaid.core-CFCyolqU.js → mermaid.core-DPLCTlKT.js} +4 -4
  40. package/dist/client/assets/{min-BOlS-Kpi.js → min-Cimc7NFp.js} +1 -1
  41. package/dist/client/assets/{mindmap-definition-QFDTVHPH-pM2WtK3x.js → mindmap-definition-QFDTVHPH-DnyowBeF.js} +1 -1
  42. package/dist/client/assets/{pieDiagram-DEJITSTG-DDIwX7uR.js → pieDiagram-DEJITSTG-B1mr5ZWu.js} +1 -1
  43. package/dist/client/assets/{quadrantDiagram-34T5L4WZ-BXaToAll.js → quadrantDiagram-34T5L4WZ-CJla4J4E.js} +1 -1
  44. package/dist/client/assets/{requirementDiagram-MS252O5E-DcniSPVW.js → requirementDiagram-MS252O5E-Bduy03Er.js} +1 -1
  45. package/dist/client/assets/{sankeyDiagram-XADWPNL6-BRSO8kbj.js → sankeyDiagram-XADWPNL6-G7I_cbR7.js} +1 -1
  46. package/dist/client/assets/{sequenceDiagram-FGHM5R23-CUIcqpcf.js → sequenceDiagram-FGHM5R23-D4Uf0SLt.js} +1 -1
  47. package/dist/client/assets/{stateDiagram-FHFEXIEX-DwQwUYPD.js → stateDiagram-FHFEXIEX-Fr0IevW-.js} +1 -1
  48. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-DXt_OYu8.js +1 -0
  49. package/dist/client/assets/{timeline-definition-GMOUNBTQ-DNrziHKp.js → timeline-definition-GMOUNBTQ-CzR6FMOJ.js} +1 -1
  50. package/dist/client/assets/{vennDiagram-DHZGUBPP-BEVuQytw.js → vennDiagram-DHZGUBPP-CCzsRm3-.js} +1 -1
  51. package/dist/client/assets/{wardley-RL74JXVD-Cwp-Pzm_.js → wardley-RL74JXVD-C9U_HC7W.js} +1 -1
  52. package/dist/client/assets/{wardleyDiagram-NUSXRM2D-Cd3w820H.js → wardleyDiagram-NUSXRM2D-BkwkDUKo.js} +1 -1
  53. package/dist/client/assets/{xychartDiagram-5P7HB3ND-CSVs_RZN.js → xychartDiagram-5P7HB3ND-CZ45hysw.js} +1 -1
  54. package/dist/client/index.html +2 -2
  55. package/dist/fleet-plugins/diff/routes.mjs +224 -57
  56. package/dist/fleet-plugins/file-explorer/routes.mjs +130 -0
  57. package/dist/fleet-plugins/skills/routes.mjs +17052 -0
  58. package/dist/fleet-plugins/terminal/routes.mjs +183 -73
  59. package/package.json +1 -1
  60. package/dist/client/assets/channel-kIwNtTP-.js +0 -1
  61. package/dist/client/assets/classDiagram-6PBFFD2Q-DGNebVYt.js +0 -1
  62. package/dist/client/assets/classDiagram-v2-HSJHXN6E-DGNebVYt.js +0 -1
  63. package/dist/client/assets/clone-DFRxH9FR.js +0 -1
  64. package/dist/client/assets/index-OEz1YKt3.js +0 -361
  65. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-oBGjXrxd.js +0 -1
package/dist/cli.mjs CHANGED
@@ -2,8 +2,8 @@
2
2
  import { spawn, execFileSync, execFile, execSync } from 'child_process';
3
3
  import * as fs11 from 'fs';
4
4
  import fs11__default, { readFileSync, realpathSync, accessSync, constants, existsSync, lstatSync } from 'fs';
5
- import * as path25 from 'path';
6
- import path25__default, { join, resolve, relative, sep, dirname } from 'path';
5
+ import * as path26 from 'path';
6
+ import path26__default, { join, resolve, relative, sep, dirname } from 'path';
7
7
  import process4 from 'process';
8
8
  import { fileURLToPath, pathToFileURL } from 'url';
9
9
  import * as os3 from 'os';
@@ -17124,6 +17124,27 @@ function isChildProcessRunning(child) {
17124
17124
  }
17125
17125
 
17126
17126
  // ../../packages/core-unified-agent/src/connection/BaseConnection.ts
17127
+ var STDERR_DIAGNOSTIC_LINE_LIMIT = 20;
17128
+ var STDERR_DIAGNOSTIC_LINE_CHAR_LIMIT = 2e3;
17129
+ var STDERR_DIAGNOSTIC_TOTAL_BYTE_LIMIT = 8e3;
17130
+ var ANSI_PATTERN = /\x1b\[[0-?]*[ -/]*[@-~]/g;
17131
+ var CONTROL_PATTERN = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g;
17132
+ var SECRET_PATTERNS = [
17133
+ { label: "aws_access_key", pattern: /AKIA[0-9A-Z]{16}/g },
17134
+ { label: "github_token", pattern: /gh[psour]_[A-Za-z0-9]{36}/g },
17135
+ { label: "jwt", pattern: /eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g },
17136
+ { label: "openai_key", pattern: /\bsk-[A-Za-z0-9_-]{20,}\b/g },
17137
+ {
17138
+ label: "generic_secret",
17139
+ pattern: /\b[A-Z0-9_]*(?:KEY|TOKEN|SECRET|PASSWORD|CREDENTIAL)[A-Z0-9_]*\s*[:=]\s*["']?[^\s"']+["']?/gi
17140
+ },
17141
+ {
17142
+ label: "pem_private_key",
17143
+ pattern: /-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]+?-----END [A-Z ]*PRIVATE KEY-----/g
17144
+ }
17145
+ ];
17146
+ var PEM_BEGIN_PATTERN = /-----BEGIN [A-Z ]*PRIVATE KEY-----/;
17147
+ var PEM_END_PATTERN = /-----END [A-Z ]*PRIVATE KEY-----/;
17127
17148
  var BaseConnection = class extends EventEmitter {
17128
17149
  child = null;
17129
17150
  state = "disconnected";
@@ -17137,6 +17158,9 @@ var BaseConnection = class extends EventEmitter {
17137
17158
  initTimeout;
17138
17159
  promptIdleTimeout;
17139
17160
  stderrBuffer = "";
17161
+ diagnosticStderrTail = [];
17162
+ // PEM 블록 내부 여부 추적 (줄 단위 수신 시 바디 라인 누출 방지)
17163
+ inPemBlock = false;
17140
17164
  constructor(options) {
17141
17165
  super();
17142
17166
  this.command = options.command;
@@ -17268,9 +17292,32 @@ var BaseConnection = class extends EventEmitter {
17268
17292
  if (!message) {
17269
17293
  return;
17270
17294
  }
17295
+ this.recordDiagnosticStderrLine(message);
17271
17296
  this.emit("log", message);
17272
17297
  this.emit("logEntry", this.createStructuredLogEntry(message));
17273
17298
  }
17299
+ /** 실패 메시지에 붙일 수 있는 짧고 마스킹된 stderr tail을 반환합니다. */
17300
+ getStderrDiagnosticTail() {
17301
+ return this.diagnosticStderrTail.join("\n");
17302
+ }
17303
+ /** 원본 에러에 stderr tail 진단을 붙여 상위 계층으로 전달합니다. */
17304
+ withStderrDiagnostics(error51, phase) {
17305
+ const baseError = error51 instanceof Error ? error51 : new Error(String(error51));
17306
+ this.flushStderrBuffer();
17307
+ const stderrTail = this.getStderrDiagnosticTail();
17308
+ if (!stderrTail || baseError.message.includes(`${phase} stderr tail:`)) {
17309
+ return baseError;
17310
+ }
17311
+ const diagnosticError = new Error(
17312
+ `${baseError.message}
17313
+
17314
+ ${phase} stderr tail:
17315
+ ${stderrTail}`,
17316
+ { cause: baseError }
17317
+ );
17318
+ diagnosticError.name = baseError.name;
17319
+ return diagnosticError;
17320
+ }
17274
17321
  /** 기본 구조화 stderr 로그 항목을 생성합니다. */
17275
17322
  createStructuredLogEntry(message) {
17276
17323
  return {
@@ -17307,6 +17354,27 @@ var BaseConnection = class extends EventEmitter {
17307
17354
  })
17308
17355
  ]);
17309
17356
  }
17357
+ recordDiagnosticStderrLine(message) {
17358
+ const pemMarkerLine = normalizePemMarkerLine(message);
17359
+ if (PEM_BEGIN_PATTERN.test(pemMarkerLine)) {
17360
+ this.inPemBlock = true;
17361
+ }
17362
+ const inBlock = this.inPemBlock;
17363
+ if (PEM_END_PATTERN.test(pemMarkerLine)) {
17364
+ this.inPemBlock = false;
17365
+ }
17366
+ const sanitized = sanitizeDiagnosticStderrLine(message, inBlock);
17367
+ if (!sanitized) {
17368
+ return;
17369
+ }
17370
+ this.diagnosticStderrTail.push(sanitized);
17371
+ while (this.diagnosticStderrTail.length > STDERR_DIAGNOSTIC_LINE_LIMIT) {
17372
+ this.diagnosticStderrTail.shift();
17373
+ }
17374
+ while (byteLength(this.getStderrDiagnosticTail()) > STDERR_DIAGNOSTIC_TOTAL_BYTE_LIMIT && this.diagnosticStderrTail.length > 1) {
17375
+ this.diagnosticStderrTail.shift();
17376
+ }
17377
+ }
17310
17378
  };
17311
17379
  function quoteForCmd(token) {
17312
17380
  if (token === "") {
@@ -17321,6 +17389,26 @@ function buildWindowsCmdArgs(command2, args) {
17321
17389
  const line = [command2, ...args].map(quoteForCmd).join(" ");
17322
17390
  return ["/S", "/C", `"${line}"`];
17323
17391
  }
17392
+ function sanitizeDiagnosticStderrLine(value, isPemLine) {
17393
+ const cleaned = (isPemLine ? "[REDACTED:pem_private_key]" : redactDiagnosticSecrets(value.replace(ANSI_PATTERN, "").replace(CONTROL_PATTERN, ""))).trim();
17394
+ if (cleaned.length <= STDERR_DIAGNOSTIC_LINE_CHAR_LIMIT) {
17395
+ return cleaned;
17396
+ }
17397
+ const omitted = cleaned.length - STDERR_DIAGNOSTIC_LINE_CHAR_LIMIT;
17398
+ return `${cleaned.slice(0, STDERR_DIAGNOSTIC_LINE_CHAR_LIMIT)} [truncated ${omitted} chars]`;
17399
+ }
17400
+ function normalizePemMarkerLine(value) {
17401
+ return value.replace(ANSI_PATTERN, "").replace(CONTROL_PATTERN, "").trim();
17402
+ }
17403
+ function redactDiagnosticSecrets(value) {
17404
+ return SECRET_PATTERNS.reduce(
17405
+ (text, { label, pattern }) => text.replace(pattern, `[REDACTED:${label}]`),
17406
+ value
17407
+ );
17408
+ }
17409
+ function byteLength(value) {
17410
+ return Buffer.byteLength(value, "utf8");
17411
+ }
17324
17412
 
17325
17413
  // ../../packages/core-unified-agent/src/connection/AcpConnection.ts
17326
17414
  var AcpConnection = class extends BaseConnection {
@@ -17381,7 +17469,7 @@ var AcpConnection = class extends BaseConnection {
17381
17469
  await this.disconnect();
17382
17470
  } catch {
17383
17471
  }
17384
- throw error51;
17472
+ throw this.withStderrDiagnostics(error51, "ACP initialize");
17385
17473
  }
17386
17474
  }
17387
17475
  /**
@@ -17393,46 +17481,50 @@ var AcpConnection = class extends BaseConnection {
17393
17481
  * @returns 세션 정보
17394
17482
  */
17395
17483
  async createSession(workspace, sessionId, mcpServers, systemPrompt, strictMcp, effort) {
17396
- const agent = this.getAgent();
17397
- const servers = mcpServers ?? [];
17398
- let session;
17399
- if (sessionId) {
17400
- if (!agent.loadSession) {
17401
- throw new Error("\uC5F0\uACB0\uB41C \uC5D0\uC774\uC804\uD2B8\uAC00 session/load\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
17402
- }
17403
- const loadSessionParams = {
17404
- sessionId,
17405
- cwd: workspace,
17406
- mcpServers: servers
17407
- };
17408
- const meta3 = this.buildClaudeSessionMeta(systemPrompt, strictMcp, effort);
17409
- if (meta3) {
17410
- loadSessionParams._meta = meta3;
17484
+ try {
17485
+ const agent = this.getAgent();
17486
+ const servers = mcpServers ?? [];
17487
+ let session;
17488
+ if (sessionId) {
17489
+ if (!agent.loadSession) {
17490
+ throw new Error("\uC5F0\uACB0\uB41C \uC5D0\uC774\uC804\uD2B8\uAC00 session/load\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
17491
+ }
17492
+ const loadSessionParams = {
17493
+ sessionId,
17494
+ cwd: workspace,
17495
+ mcpServers: servers
17496
+ };
17497
+ const meta3 = this.buildClaudeSessionMeta(systemPrompt, strictMcp, effort);
17498
+ if (meta3) {
17499
+ loadSessionParams._meta = meta3;
17500
+ }
17501
+ const loadResult = await this.withFixedTimeout(
17502
+ agent.loadSession(loadSessionParams),
17503
+ this.initTimeout,
17504
+ "session/load"
17505
+ );
17506
+ session = { ...loadResult, sessionId };
17507
+ } else {
17508
+ const newSessionParams = {
17509
+ cwd: workspace,
17510
+ mcpServers: servers
17511
+ };
17512
+ const meta3 = this.buildClaudeSessionMeta(systemPrompt, strictMcp, effort);
17513
+ if (meta3) {
17514
+ newSessionParams._meta = meta3;
17515
+ }
17516
+ session = await this.withFixedTimeout(
17517
+ agent.newSession(newSessionParams),
17518
+ this.initTimeout,
17519
+ "session/new"
17520
+ );
17411
17521
  }
17412
- const loadResult = await this.withFixedTimeout(
17413
- agent.loadSession(loadSessionParams),
17414
- this.initTimeout,
17415
- "session/load"
17416
- );
17417
- session = { ...loadResult, sessionId };
17418
- } else {
17419
- const newSessionParams = {
17420
- cwd: workspace,
17421
- mcpServers: servers
17422
- };
17423
- const meta3 = this.buildClaudeSessionMeta(systemPrompt, strictMcp, effort);
17424
- if (meta3) {
17425
- newSessionParams._meta = meta3;
17426
- }
17427
- session = await this.withFixedTimeout(
17428
- agent.newSession(newSessionParams),
17429
- this.initTimeout,
17430
- "session/new"
17431
- );
17522
+ this.setState("ready");
17523
+ this.activeSessionId = session.sessionId;
17524
+ return session;
17525
+ } catch (error51) {
17526
+ throw this.withStderrDiagnostics(error51, sessionId ? "ACP session/load" : "ACP session/new");
17432
17527
  }
17433
- this.setState("ready");
17434
- this.activeSessionId = session.sessionId;
17435
- return session;
17436
17528
  }
17437
17529
  /**
17438
17530
  * ACP 연결을 시작합니다.
@@ -17475,14 +17567,18 @@ var AcpConnection = class extends BaseConnection {
17475
17567
  if (meta3) {
17476
17568
  loadSessionParams._meta = meta3;
17477
17569
  }
17478
- const result = await this.withFixedTimeout(
17479
- agent.loadSession(loadSessionParams),
17480
- this.requestTimeout,
17481
- "session/load"
17482
- );
17483
- this.activeSessionId = params.sessionId;
17484
- this.setState("ready");
17485
- return result;
17570
+ try {
17571
+ const result = await this.withFixedTimeout(
17572
+ agent.loadSession(loadSessionParams),
17573
+ this.requestTimeout,
17574
+ "session/load"
17575
+ );
17576
+ this.activeSessionId = params.sessionId;
17577
+ this.setState("ready");
17578
+ return result;
17579
+ } catch (error51) {
17580
+ throw this.withStderrDiagnostics(error51, "ACP session/load");
17581
+ }
17486
17582
  }
17487
17583
  /**
17488
17584
  * 현재 세션을 종료합니다 (프로세스는 유지).
@@ -19790,12 +19886,12 @@ var CodexAppServerConnection = class extends BaseConnection {
19790
19886
  );
19791
19887
  }
19792
19888
  findRolloutPathForThreadId(threadId) {
19793
- const codexHome = this.codexHome ?? this.env.CODEX_HOME ?? path25.join(this.env.HOME ?? "", ".codex");
19889
+ const codexHome = this.codexHome ?? this.env.CODEX_HOME ?? path26.join(this.env.HOME ?? "", ".codex");
19794
19890
  if (!codexHome) {
19795
19891
  return null;
19796
19892
  }
19797
19893
  for (const rootName of ["sessions", "archived_sessions"]) {
19798
- const found = findRolloutPath(path25.join(codexHome, rootName), threadId);
19894
+ const found = findRolloutPath(path26.join(codexHome, rootName), threadId);
19799
19895
  if (found) {
19800
19896
  return found;
19801
19897
  }
@@ -19906,7 +20002,7 @@ function findRolloutPath(root, threadId) {
19906
20002
  return null;
19907
20003
  }
19908
20004
  for (const entry of fs11.readdirSync(root, { withFileTypes: true })) {
19909
- const entryPath = path25.join(root, entry.name);
20005
+ const entryPath = path26.join(root, entry.name);
19910
20006
  if (entry.isDirectory()) {
19911
20007
  const found = findRolloutPath(entryPath, threadId);
19912
20008
  if (found) {
@@ -21740,7 +21836,7 @@ function resolvePathBinary(command2, env, options = {}) {
21740
21836
  return resolved ? wrapWindowsShim(resolved, env, platform) : void 0;
21741
21837
  }
21742
21838
  function wrapWindowsShim(resolved, env, platform) {
21743
- if (platform !== "win32" || !WINDOWS_SHIM_EXTENSIONS.has(path25__default.extname(resolved).toLowerCase())) {
21839
+ if (platform !== "win32" || !WINDOWS_SHIM_EXTENSIONS.has(path26__default.extname(resolved).toLowerCase())) {
21744
21840
  return { bin: resolved, prefixArgs: [] };
21745
21841
  }
21746
21842
  rejectCmdExpansionSensitiveShim(resolved);
@@ -21758,13 +21854,13 @@ function forceWindowsArgQuoting(value) {
21758
21854
  return `${value} `;
21759
21855
  }
21760
21856
  function findOnPath(bin, pathValue, pathExts, platform) {
21761
- const pathSeparator = platform === "win32" ? WINDOWS_PATH_SEPARATOR : path25__default.delimiter;
21762
- if (hasPathSeparator(bin, platform) || path25__default.isAbsolute(bin)) {
21857
+ const pathSeparator = platform === "win32" ? WINDOWS_PATH_SEPARATOR : path26__default.delimiter;
21858
+ if (hasPathSeparator(bin, platform) || path26__default.isAbsolute(bin)) {
21763
21859
  return resolveWithExtensions(bin, pathExts, platform);
21764
21860
  }
21765
21861
  for (const entry of pathValue.split(pathSeparator)) {
21766
21862
  const searchDir = entry.length === 0 ? "." : entry;
21767
- const candidate = resolveWithExtensions(path25__default.join(searchDir, bin), pathExts, platform);
21863
+ const candidate = resolveWithExtensions(path26__default.join(searchDir, bin), pathExts, platform);
21768
21864
  if (candidate) {
21769
21865
  return candidate;
21770
21866
  }
@@ -21772,7 +21868,7 @@ function findOnPath(bin, pathValue, pathExts, platform) {
21772
21868
  return void 0;
21773
21869
  }
21774
21870
  function resolveWithExtensions(candidate, pathExts, platform) {
21775
- if (platform !== "win32" || path25__default.extname(candidate).length > 0) {
21871
+ if (platform !== "win32" || path26__default.extname(candidate).length > 0) {
21776
21872
  return existsSync(candidate) ? candidate : void 0;
21777
21873
  }
21778
21874
  for (const ext of pathExts) {
@@ -22837,7 +22933,7 @@ function formatInstallCommand(packageNames, command2, versionOrChannel) {
22837
22933
  return `${command2} i -g ${packageNames.map((name) => `${name}@${versionOrChannel}`).join(" ")}`;
22838
22934
  }
22839
22935
  function isPathInside(deps, child, parent) {
22840
- const separator = deps.platform === "win32" ? "\\" : path25__default.sep;
22936
+ const separator = deps.platform === "win32" ? "\\" : path26__default.sep;
22841
22937
  return child === parent || child.startsWith(`${parent}${separator}`);
22842
22938
  }
22843
22939
  function normalizeExistingPath(deps, value) {
@@ -22852,10 +22948,10 @@ function normalizePath(deps, value) {
22852
22948
  return deps.platform === "win32" ? resolved.toLowerCase() : resolved;
22853
22949
  }
22854
22950
  function resolvePathForPlatform(platform, value) {
22855
- return platform === "win32" ? path25__default.win32.resolve(value) : path25__default.resolve(value);
22951
+ return platform === "win32" ? path26__default.win32.resolve(value) : path26__default.resolve(value);
22856
22952
  }
22857
22953
  function joinPathForPlatform(platform, ...parts) {
22858
- return platform === "win32" ? path25__default.win32.join(...parts) : path25__default.join(...parts);
22954
+ return platform === "win32" ? path26__default.win32.join(...parts) : path26__default.join(...parts);
22859
22955
  }
22860
22956
  function defaultExecFile(file2, args) {
22861
22957
  return execFileSync(file2, args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
@@ -23021,7 +23117,7 @@ function cleanupTempFiles(dir, prefix, minAgeMs, now) {
23021
23117
  if (!entry.startsWith(prefix)) {
23022
23118
  continue;
23023
23119
  }
23024
- const tempPath = path25.join(dir, entry);
23120
+ const tempPath = path26.join(dir, entry);
23025
23121
  try {
23026
23122
  const stat5 = fs11.lstatSync(tempPath);
23027
23123
  if (stat5?.isFile() && !stat5.isSymbolicLink() && now - stat5.mtimeMs >= minAgeMs) {
@@ -23127,7 +23223,7 @@ function writeLockOwner(lockDir, ownerFileName, startedAt) {
23127
23223
  hostname: os3.hostname(),
23128
23224
  startedAt
23129
23225
  };
23130
- const ownerPath = path25.join(lockDir, ownerFileName);
23226
+ const ownerPath = path26.join(lockDir, ownerFileName);
23131
23227
  try {
23132
23228
  fs11.writeFileSync(ownerPath, JSON.stringify(owner), { encoding: "utf-8", mode: 384 });
23133
23229
  } catch (error51) {
@@ -23136,7 +23232,7 @@ function writeLockOwner(lockDir, ownerFileName, startedAt) {
23136
23232
  }
23137
23233
  }
23138
23234
  function readLockOwner(lockDir, ownerFileName) {
23139
- const ownerPath = path25.join(lockDir, ownerFileName);
23235
+ const ownerPath = path26.join(lockDir, ownerFileName);
23140
23236
  try {
23141
23237
  return sanitizeLockOwner(JSON.parse(fs11.readFileSync(ownerPath, "utf-8")));
23142
23238
  } catch (error51) {
@@ -23200,7 +23296,7 @@ function createDurableJsonStore(deps) {
23200
23296
  const sensitivity = deps.sensitivity;
23201
23297
  const mode = sensitivity === "sensitive" ? SECURE_FILE_MODE : 420;
23202
23298
  const minAgeMs = deps.tempCleanupMinAgeMs ?? DEFAULT_TEMP_FILE_MIN_AGE_MS;
23203
- const dir = path25.dirname(deps.filePath);
23299
+ const dir = path26.dirname(deps.filePath);
23204
23300
  return {
23205
23301
  path: deps.filePath,
23206
23302
  load() {
@@ -23309,7 +23405,7 @@ function readRawCarriersOrDefaultStore() {
23309
23405
  }
23310
23406
  function getCarriersFilePath() {
23311
23407
  if (!runtimeState.storeDir) return null;
23312
- return path25.join(runtimeState.storeDir, FILENAME);
23408
+ return path26.join(runtimeState.storeDir, FILENAME);
23313
23409
  }
23314
23410
  function updateCarriers(mutator) {
23315
23411
  if (!runtimeState.storeDir) return;
@@ -23324,7 +23420,7 @@ function updateCarriers(mutator) {
23324
23420
  function withStoreLock(operation) {
23325
23421
  if (!runtimeState.storeDir) return operation();
23326
23422
  fs11.mkdirSync(runtimeState.storeDir, { recursive: true });
23327
- const lockDir = path25.join(runtimeState.storeDir, LOCK_DIRNAME);
23423
+ const lockDir = path26.join(runtimeState.storeDir, LOCK_DIRNAME);
23328
23424
  return withDirectoryLock(
23329
23425
  { lockDir, ownerFileName: LOCK_OWNER_FILENAME },
23330
23426
  operation
@@ -23335,10 +23431,10 @@ function readCarriers() {
23335
23431
  return readCarriersFromDir(runtimeState.storeDir);
23336
23432
  }
23337
23433
  function resolveDefaultStoreDir() {
23338
- return path25.join(os3.homedir(), DEFAULT_STORE_DIRNAME);
23434
+ return path26.join(os3.homedir(), DEFAULT_STORE_DIRNAME);
23339
23435
  }
23340
23436
  function readCarriersFromDir(dir) {
23341
- const filePath = path25.join(dir, FILENAME);
23437
+ const filePath = path26.join(dir, FILENAME);
23342
23438
  let fd;
23343
23439
  try {
23344
23440
  const stat5 = fs11.lstatSync(filePath);
@@ -23368,7 +23464,7 @@ function recordLastLocalWriteFingerprint(filePath, generation) {
23368
23464
  function writeCarriers(s) {
23369
23465
  if (!runtimeState.storeDir) throw new Error("Fleet store is not initialized.");
23370
23466
  fs11.mkdirSync(runtimeState.storeDir, { recursive: true });
23371
- const filePath = path25.join(runtimeState.storeDir, FILENAME);
23467
+ const filePath = path26.join(runtimeState.storeDir, FILENAME);
23372
23468
  const next = serializeFleetCarriers(s);
23373
23469
  writeAtomicSync(filePath, `${JSON.stringify(next, null, 2)}
23374
23470
  `, { fsync: false, mode: 420 });
@@ -23393,7 +23489,7 @@ function sanitizeFleetCarriers(value) {
23393
23489
  }
23394
23490
  function unlinkStaleSubagentModeFile(dir) {
23395
23491
  try {
23396
- fs11.unlinkSync(path25.join(dir, STALE_SUBAGENT_MODE_FILENAME));
23492
+ fs11.unlinkSync(path26.join(dir, STALE_SUBAGENT_MODE_FILENAME));
23397
23493
  } catch {
23398
23494
  }
23399
23495
  }
@@ -24852,9 +24948,9 @@ function buildJobSummaryText(prefix, status, successCount, failureCount, error51
24852
24948
  var HEAD_BYTE_RATIO = 0.25;
24853
24949
  var MAX_TEXT_CHARS = 24e3;
24854
24950
  var MAX_RAW_OUTPUT_CHARS = 12e3;
24855
- var ANSI_PATTERN = /\x1b\[[0-?]*[ -/]*[@-~]/g;
24856
- var CONTROL_PATTERN = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g;
24857
- var SECRET_PATTERNS = [
24951
+ var ANSI_PATTERN2 = /\x1b\[[0-?]*[ -/]*[@-~]/g;
24952
+ var CONTROL_PATTERN2 = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g;
24953
+ var SECRET_PATTERNS2 = [
24858
24954
  { label: "aws_access_key", pattern: /AKIA[0-9A-Z]{16}/g },
24859
24955
  { label: "jwt", pattern: /eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g },
24860
24956
  { label: "github_token", pattern: /gh[psour]_[A-Za-z0-9]{36}/g },
@@ -24936,7 +25032,7 @@ function emptyGroupPlaceholderBlock(label, timestamp) {
24936
25032
  function applyByteCap(blocks, maxBytes, truncatedInLabel, enableSingleBlockCharSlice = false) {
24937
25033
  if (!maxBytes || maxBytes <= 0) return blocks;
24938
25034
  const full = blocks.map((block) => renderBlock(block)).join("\n\n").trimEnd();
24939
- if (byteLength(full) <= maxBytes) return blocks;
25035
+ if (byteLength2(full) <= maxBytes) return blocks;
24940
25036
  if (enableSingleBlockCharSlice) {
24941
25037
  const sliced = trySliceOversizedSingleOrHeaderPayload(blocks, maxBytes, truncatedInLabel);
24942
25038
  if (sliced) return sliced;
@@ -24975,7 +25071,7 @@ function trySliceOversizedSingleOrHeaderPayload(blocks, maxBytes, truncatedInLab
24975
25071
  if (blocks.length === 1) {
24976
25072
  const block = blocks[0];
24977
25073
  const rendered = renderBlock(block);
24978
- if (byteLength(rendered) <= maxBytes) return null;
25074
+ if (byteLength2(rendered) <= maxBytes) return null;
24979
25075
  return sliceSingleOversizedTextBlock(block, rendered, maxBytes, truncatedInLabel);
24980
25076
  }
24981
25077
  if (blocks.length === 2 && isSerializerGroupHeaderBlock(blocks[0]) && blocks[1]?.kind === "text") {
@@ -24984,12 +25080,12 @@ function trySliceOversizedSingleOrHeaderPayload(blocks, maxBytes, truncatedInLab
24984
25080
  const headerRendered = renderBlock(headerBlock);
24985
25081
  const bodyRendered = renderBlock(payloadBlock);
24986
25082
  const sep3 = "\n\n";
24987
- const prefixBytes = byteLength(headerRendered) + byteLength(sep3);
25083
+ const prefixBytes = byteLength2(headerRendered) + byteLength2(sep3);
24988
25084
  const innerBudget = maxBytes - prefixBytes;
24989
25085
  if (innerBudget <= 0) {
24990
25086
  return [headerBlock, buildCharTruncatedMarkerBlock(payloadBlock.timestamp, countCodepointsInUtf8Buffer(Buffer.from(bodyRendered, "utf8")), truncatedInLabel)];
24991
25087
  }
24992
- if (byteLength(bodyRendered) <= innerBudget) return null;
25088
+ if (byteLength2(bodyRendered) <= innerBudget) return null;
24993
25089
  const { head, marker, tail } = splitRenderedUtf8AtByteCap(bodyRendered, innerBudget, truncatedInLabel);
24994
25090
  return [
24995
25091
  headerBlock,
@@ -25025,7 +25121,7 @@ function splitRenderedUtf8AtByteCap(rendered, maxBytes, charLabel) {
25025
25121
  if (buf.length <= maxBytes) {
25026
25122
  return { head: rendered, marker: "", tail: "" };
25027
25123
  }
25028
- const sepLen = byteLength("\n\n");
25124
+ const sepLen = byteLength2("\n\n");
25029
25125
  let headBudget = Math.min(buf.length, Math.floor(maxBytes * HEAD_BYTE_RATIO));
25030
25126
  const tailBudget = Math.min(buf.length, Math.floor(maxBytes * (1 - HEAD_BYTE_RATIO)));
25031
25127
  for (let iter = 0; iter < 200; iter++) {
@@ -25042,7 +25138,7 @@ function splitRenderedUtf8AtByteCap(rendered, maxBytes, charLabel) {
25042
25138
  const marker2 = buildCharTruncatedMarker(omittedChars, charLabel);
25043
25139
  const headStr = buf.subarray(0, headLen2).toString("utf8");
25044
25140
  const tailStr = buf.subarray(tailStart2).toString("utf8");
25045
- const total = byteLength(headStr) + sepLen + byteLength(marker2) + sepLen + byteLength(tailStr);
25141
+ const total = byteLength2(headStr) + sepLen + byteLength2(marker2) + sepLen + byteLength2(tailStr);
25046
25142
  if (total <= maxBytes) {
25047
25143
  return { head: headStr, marker: marker2, tail: tailStr };
25048
25144
  }
@@ -25050,7 +25146,7 @@ function splitRenderedUtf8AtByteCap(rendered, maxBytes, charLabel) {
25050
25146
  if (headBudget === 0) break;
25051
25147
  }
25052
25148
  const marker = buildCharTruncatedMarker(Math.max(1, countCodepointsInUtf8Buffer(buf) - 1), charLabel);
25053
- const markerTotal = byteLength(marker) + 2 * sepLen;
25149
+ const markerTotal = byteLength2(marker) + 2 * sepLen;
25054
25150
  const room = Math.max(1, maxBytes - markerTotal);
25055
25151
  const tailBudgetFallback = Math.min(buf.length, Math.max(1, Math.floor(room * (1 - HEAD_BYTE_RATIO))));
25056
25152
  let tailStart = utf8SuffixStartIndex(buf, tailBudgetFallback);
@@ -25122,12 +25218,12 @@ function buildTruncatedMarker(blocks, omittedStart, omittedCount, truncatedInLab
25122
25218
  };
25123
25219
  }
25124
25220
  function serializedBlocksBytes(blocks) {
25125
- return byteLength(blocks.map((block) => renderBlock(block)).join("\n\n").trimEnd());
25221
+ return byteLength2(blocks.map((block) => renderBlock(block)).join("\n\n").trimEnd());
25126
25222
  }
25127
25223
  function serializedBlockBytes(block, includeSeparator) {
25128
- return byteLength(`${includeSeparator ? "\n\n" : ""}${renderBlock(block)}`);
25224
+ return byteLength2(`${includeSeparator ? "\n\n" : ""}${renderBlock(block)}`);
25129
25225
  }
25130
- function byteLength(value) {
25226
+ function byteLength2(value) {
25131
25227
  return Buffer.byteLength(value, "utf8");
25132
25228
  }
25133
25229
  function toArchiveBlock(kind, source, text, label, timestamp = Date.now()) {
@@ -25158,13 +25254,13 @@ function toToolCallArchiveBlock(source, title, status, rawOutput, toolCallId, la
25158
25254
  };
25159
25255
  }
25160
25256
  function sanitizeArchiveText(value, maxChars = MAX_TEXT_CHARS) {
25161
- const cleaned = value.replace(ANSI_PATTERN, "").replace(CONTROL_PATTERN, "");
25257
+ const cleaned = value.replace(ANSI_PATTERN2, "").replace(CONTROL_PATTERN2, "");
25162
25258
  if (cleaned.length <= maxChars) return cleaned;
25163
25259
  return `${cleaned.slice(0, maxChars)}
25164
25260
  [truncated ${cleaned.length - maxChars} chars]`;
25165
25261
  }
25166
25262
  function redactSecrets(value) {
25167
- return SECRET_PATTERNS.reduce(
25263
+ return SECRET_PATTERNS2.reduce(
25168
25264
  (text, { label, pattern }) => text.replace(pattern, `[REDACTED:${label}]`),
25169
25265
  value
25170
25266
  );
@@ -30813,6 +30909,9 @@ async function runCarrierJobInBackground(opts) {
30813
30909
  try {
30814
30910
  result = await runSingleCarrier(opts);
30815
30911
  finalStatus = result.status;
30912
+ if (finalStatus === "error") {
30913
+ finalError = result.error ?? result.responseText;
30914
+ }
30816
30915
  } catch (error51) {
30817
30916
  finalStatus = "error";
30818
30917
  finalError = error51 instanceof Error ? error51.message : String(error51);
@@ -31011,7 +31110,7 @@ function resolveDispatchCwd(rawCwd, fallbackCwd) {
31011
31110
  if (rawCwd === void 0) return { ok: true, cwd: fallbackCwd };
31012
31111
  const trimmed = rawCwd.trim();
31013
31112
  if (trimmed.length === 0) return { ok: true, cwd: fallbackCwd };
31014
- if (!path25__default.isAbsolute(trimmed)) {
31113
+ if (!path26__default.isAbsolute(trimmed)) {
31015
31114
  return {
31016
31115
  ok: false,
31017
31116
  error: `Invalid cwd "${rawCwd}": must be an absolute path. Provide an absolute directory or omit cwd to use the host session cwd.`
@@ -31208,8 +31307,8 @@ function createBoundCarrierJobs(registry3, boundStream = createBoundCarrierStrea
31208
31307
  // core/host/hooks/subagents-context.ts
31209
31308
  var FLEET_PLUGIN_NAME = "fleet";
31210
31309
  function runSubagentsContextHook(env) {
31211
- const fleetRoot = env.FLEET_ROOT ?? path25__default.join(env.HOME ?? os3__default.homedir(), ".fleet");
31212
- if (!canReadCarrierState(path25__default.join(fleetRoot, "carriers.json"))) {
31310
+ const fleetRoot = env.FLEET_ROOT ?? path26__default.join(env.HOME ?? os3__default.homedir(), ".fleet");
31311
+ if (!canReadCarrierState(path26__default.join(fleetRoot, "carriers.json"))) {
31213
31312
  return JSON.stringify({ hookSpecificOutput: { hookEventName: "SessionStart", additionalContext: "" } });
31214
31313
  }
31215
31314
  const carrierRuntime = createCarrierRuntime();
@@ -31342,7 +31441,7 @@ function createConsoleLock(deps = {}) {
31342
31441
  }
31343
31442
  function assertLockModes(lockFile) {
31344
31443
  if (typeof process.getuid !== "function") return;
31345
- const dir = path25__default.dirname(lockFile);
31444
+ const dir = path26__default.dirname(lockFile);
31346
31445
  const dirMode = fsImpl.statSync(dir).mode & 511;
31347
31446
  const fileMode = fsImpl.statSync(lockFile).mode & 511;
31348
31447
  if (dirMode !== LOCK_DIR_MODE) {
@@ -31384,7 +31483,7 @@ function createConsoleLock(deps = {}) {
31384
31483
  }
31385
31484
  var FLEET_DATA_DIR_NAME = ".fleet";
31386
31485
  function getFleetDataDir() {
31387
- return path25.join(os3.homedir(), FLEET_DATA_DIR_NAME);
31486
+ return path26.join(os3.homedir(), FLEET_DATA_DIR_NAME);
31388
31487
  }
31389
31488
  function readAuthStoreFile(filePath) {
31390
31489
  let fd;
@@ -31407,7 +31506,7 @@ function readAuthStoreFile(filePath) {
31407
31506
  }
31408
31507
 
31409
31508
  // ../../packages/fleet-infra/src/auth/auth-storage.ts
31410
- var DEFAULT_AUTH_PATH = path25.join(getFleetDataDir(), "auth.json");
31509
+ var DEFAULT_AUTH_PATH = path26.join(getFleetDataDir(), "auth.json");
31411
31510
  var AUTH_LOCK_OWNER_FILE_NAME = "owner.json";
31412
31511
  var AUTH_LOCK_TIMEOUT_MS = 5e3;
31413
31512
  function createAuthService(deps = {}) {
@@ -31463,7 +31562,7 @@ function createAuthService(deps = {}) {
31463
31562
  }
31464
31563
  },
31465
31564
  async setApiKey(providerId, key) {
31466
- const dir = path25.dirname(authPath);
31565
+ const dir = path26.dirname(authPath);
31467
31566
  ensureSafeDirectory(dir);
31468
31567
  withAuthLock(authPath, lockDir, () => {
31469
31568
  const data = fs11.existsSync(authPath) ? readAuthStoreFile(authPath) : {};
@@ -31500,8 +31599,8 @@ var LOCK_OWNER_FILE_NAME = "owner";
31500
31599
  var TEMP_FILE_PREFIX = `.tmp-${GLOBAL_OPTIONS_FILE_NAME}-`;
31501
31600
  function createGlobalOptionsStore(deps = {}) {
31502
31601
  const dataDir = deps.dataDir ?? getFleetDataDir();
31503
- const optionsPath = path25.join(dataDir, GLOBAL_OPTIONS_FILE_NAME);
31504
- const lockDir = path25.join(dataDir, LOCK_DIR_NAME);
31602
+ const optionsPath = path26.join(dataDir, GLOBAL_OPTIONS_FILE_NAME);
31603
+ const lockDir = path26.join(dataDir, LOCK_DIR_NAME);
31505
31604
  const store2 = createDurableJsonStore({
31506
31605
  filePath: optionsPath,
31507
31606
  lockDir,
@@ -31588,7 +31687,7 @@ function readFleetConsoleRelease() {
31588
31687
  const requireFromHere = createRequire(import.meta.url);
31589
31688
  const packageJsonPath = resolvePackageJsonPath(requireFromHere);
31590
31689
  const pkg = requireFromHere(packageJsonPath);
31591
- const packageRoot = path25__default.dirname(packageJsonPath);
31690
+ const packageRoot = path26__default.dirname(packageJsonPath);
31592
31691
  const version2 = pkg.version ?? "";
31593
31692
  if (pkg.private === true) {
31594
31693
  return { channel: "local", version: version2, packageRoot };
@@ -31617,15 +31716,15 @@ var CONSOLE_CAPTURES_DIR_NAME = "captures";
31617
31716
  function createConsolePaths(deps = {}) {
31618
31717
  const env = deps.env ?? process.env;
31619
31718
  const base = env.FLEET_CONSOLE_DIR ?? defaultConsoleBaseDir(deps);
31620
- return { dir: base, lockFile: path25__default.join(base, LOCK_FILE_NAME) };
31719
+ return { dir: base, lockFile: path26__default.join(base, LOCK_FILE_NAME) };
31621
31720
  }
31622
31721
  function createConsoleDataPaths(deps = {}) {
31623
31722
  const dir = defaultConsoleDataBaseDir(deps);
31624
31723
  return {
31625
31724
  dir,
31626
- stateFile: path25__default.join(dir, CONSOLE_STATE_FILE_NAME),
31627
- settingsFile: path25__default.join(dir, CONSOLE_SETTINGS_FILE_NAME),
31628
- capturesDir: path25__default.join(dir, CONSOLE_CAPTURES_DIR_NAME)
31725
+ stateFile: path26__default.join(dir, CONSOLE_STATE_FILE_NAME),
31726
+ settingsFile: path26__default.join(dir, CONSOLE_SETTINGS_FILE_NAME),
31727
+ capturesDir: path26__default.join(dir, CONSOLE_CAPTURES_DIR_NAME)
31629
31728
  };
31630
31729
  }
31631
31730
  function defaultConsoleBaseDir(deps) {
@@ -31636,11 +31735,11 @@ function defaultConsoleBaseDir(deps) {
31636
31735
  return localConsoleDir(packageRoot);
31637
31736
  }
31638
31737
  const uid = deps.uid ?? (typeof process.getuid === "function" ? process.getuid() : 0);
31639
- return path25__default.join(os3__default.tmpdir(), `${LOCK_DIR_NAME2}-${uid}-${channel}`);
31738
+ return path26__default.join(os3__default.tmpdir(), `${LOCK_DIR_NAME2}-${uid}-${channel}`);
31640
31739
  }
31641
31740
  function defaultConsoleDataBaseDir(deps) {
31642
31741
  if (deps.fleetDataDir !== void 0) {
31643
- return path25__default.join(deps.fleetDataDir, CONSOLE_DATA_DIR_NAME);
31742
+ return path26__default.join(deps.fleetDataDir, CONSOLE_DATA_DIR_NAME);
31644
31743
  }
31645
31744
  const env = deps.env ?? process.env;
31646
31745
  if (env.FLEET_CONSOLE_DIR) {
@@ -31652,10 +31751,10 @@ function defaultConsoleDataBaseDir(deps) {
31652
31751
  const packageRoot = deps.packageRoot ?? (release ??= readFleetConsoleRelease()).packageRoot;
31653
31752
  return localConsoleDir(packageRoot);
31654
31753
  }
31655
- return path25__default.join(getFleetDataDir(), CONSOLE_DATA_DIR_NAME);
31754
+ return path26__default.join(getFleetDataDir(), CONSOLE_DATA_DIR_NAME);
31656
31755
  }
31657
31756
  function localConsoleDir(packageRoot) {
31658
- return path25__default.join(path25__default.resolve(packageRoot, "..", ".."), ".fleet", CONSOLE_RUNTIME_DIR_NAME);
31757
+ return path26__default.join(path26__default.resolve(packageRoot, "..", ".."), ".fleet", CONSOLE_RUNTIME_DIR_NAME);
31659
31758
  }
31660
31759
 
31661
31760
  // core/host/carrier-settings-routes.ts
@@ -32196,6 +32295,147 @@ function isJsonRequest2(req) {
32196
32295
  function isValidConsoleStaticPort(value) {
32197
32296
  return typeof value === "number" && Number.isInteger(value) && value >= MIN_CONSOLE_STATIC_PORT && value <= MAX_CONSOLE_STATIC_PORT;
32198
32297
  }
32298
+ var PLUGIN_ID_PATTERN = /^[a-z0-9][a-z0-9._-]*$/;
32299
+ var SETTINGS_VERSION = 1;
32300
+ var SETTINGS_LOCK_DIR_NAME = "settings.lock";
32301
+ var SETTINGS_LOCK_OWNER_FILE_NAME = "owner.json";
32302
+ var SETTINGS_TEMP_PREFIX = ".settings.";
32303
+ var MIN_CONSOLE_STATIC_PORT2 = 1024;
32304
+ var MAX_CONSOLE_STATIC_PORT2 = 65535;
32305
+ function createConsoleSettingsStore(deps = {}) {
32306
+ const paths = deps.paths ?? createConsoleDataPaths();
32307
+ const createStore = deps.createStore ?? createDurableJsonStore;
32308
+ return createStore({
32309
+ filePath: paths.settingsFile,
32310
+ lockDir: path26__default.join(paths.dir, SETTINGS_LOCK_DIR_NAME),
32311
+ lockOwnerFileName: SETTINGS_LOCK_OWNER_FILE_NAME,
32312
+ now: deps.now,
32313
+ sanitize: sanitizeConsoleSettingsData,
32314
+ sensitivity: "sensitive",
32315
+ tempCleanupPrefix: SETTINGS_TEMP_PREFIX
32316
+ });
32317
+ }
32318
+ function sanitizeConsoleSettingsData(value) {
32319
+ if (!isRecord4(value)) return emptyConsoleSettingsData();
32320
+ if (value.version !== SETTINGS_VERSION) return emptyConsoleSettingsData();
32321
+ const general = readConsoleGeneralSettings(value.general);
32322
+ const plugins = readConsolePluginSettings(value.plugins);
32323
+ return {
32324
+ version: SETTINGS_VERSION,
32325
+ general: general ?? {},
32326
+ plugins: plugins ?? {}
32327
+ };
32328
+ }
32329
+ function emptyConsoleSettingsData() {
32330
+ return { version: 1, general: {}, plugins: {} };
32331
+ }
32332
+ function readConsoleGeneralSettings(value) {
32333
+ if (!isRecord4(value)) return null;
32334
+ const consolePortMode = value.consolePortMode === "dynamic" || value.consolePortMode === "static" ? value.consolePortMode : void 0;
32335
+ const consoleStaticPort = isValidConsoleStaticPort2(value.consoleStaticPort) ? value.consoleStaticPort : void 0;
32336
+ const theme = value.theme === "maritime" || value.theme === "carbon" ? value.theme : void 0;
32337
+ return {
32338
+ ...consolePortMode !== void 0 ? { consolePortMode } : {},
32339
+ ...consoleStaticPort !== void 0 ? { consoleStaticPort } : {},
32340
+ ...theme !== void 0 ? { theme } : {}
32341
+ };
32342
+ }
32343
+ function readConsolePluginSettings(value) {
32344
+ if (!isRecord4(value)) return null;
32345
+ const result = {};
32346
+ for (const [key, entry] of Object.entries(value)) {
32347
+ if (!PLUGIN_ID_PATTERN.test(key)) continue;
32348
+ if (!isRecord4(entry)) continue;
32349
+ result[key] = entry;
32350
+ }
32351
+ return result;
32352
+ }
32353
+ function isRecord4(value) {
32354
+ return typeof value === "object" && value !== null && !Array.isArray(value);
32355
+ }
32356
+ function isValidConsoleStaticPort2(value) {
32357
+ return typeof value === "number" && Number.isInteger(value) && value >= MIN_CONSOLE_STATIC_PORT2 && value <= MAX_CONSOLE_STATIC_PORT2;
32358
+ }
32359
+
32360
+ // core/host/plugin-settings-routes.ts
32361
+ var PLUGIN_SETTINGS_PREFIX = "/api/v1/settings/plugins/";
32362
+ var MAX_PLUGIN_SETTINGS_BYTES = 32 * 1024;
32363
+ var PLUGIN_SETTINGS_API_CATALOG = [
32364
+ {
32365
+ method: "GET",
32366
+ path: "/api/v1/settings/plugins/:pluginId",
32367
+ summary: "Get the settings for a specific plugin.",
32368
+ category: "Settings",
32369
+ gate: "loopback"
32370
+ },
32371
+ {
32372
+ method: "PUT",
32373
+ path: "/api/v1/settings/plugins/:pluginId",
32374
+ summary: "Save the settings for a specific plugin.",
32375
+ category: "Settings",
32376
+ gate: "origin-write"
32377
+ }
32378
+ ];
32379
+ function createPluginSettingsRouter(deps) {
32380
+ return async function handlePluginSettingsRoute(context) {
32381
+ const { req, res, pathname } = context;
32382
+ if (!pathname.startsWith(PLUGIN_SETTINGS_PREFIX)) return false;
32383
+ const rest = pathname.slice(PLUGIN_SETTINGS_PREFIX.length);
32384
+ if (rest.includes("/")) return false;
32385
+ let pluginId;
32386
+ try {
32387
+ pluginId = decodeURIComponent(rest);
32388
+ } catch {
32389
+ deps.writeJson(res, 400, { error: "invalid_plugin_id" });
32390
+ return true;
32391
+ }
32392
+ if (!PLUGIN_ID_PATTERN.test(pluginId)) {
32393
+ deps.writeJson(res, 400, { error: "invalid_plugin_id" });
32394
+ return true;
32395
+ }
32396
+ if (req.method === "GET") {
32397
+ const data = deps.consoleSettingsStore.load();
32398
+ const value = data.plugins?.[pluginId] ?? null;
32399
+ deps.writeJson(res, 200, { value });
32400
+ return true;
32401
+ }
32402
+ if (req.method === "PUT") {
32403
+ if (!deps.isAuthorized(req)) {
32404
+ deps.writeJson(res, 401, { error: "unauthorized" });
32405
+ return true;
32406
+ }
32407
+ if (!isJsonRequest3(req)) {
32408
+ deps.writeJson(res, 415, { error: "unsupported_media_type" });
32409
+ return true;
32410
+ }
32411
+ const body = await deps.readJsonBody(req);
32412
+ if (!isRecord5(body)) {
32413
+ deps.writeJson(res, 400, { error: "invalid_json" });
32414
+ return true;
32415
+ }
32416
+ if (Buffer.byteLength(JSON.stringify(body), "utf8") > MAX_PLUGIN_SETTINGS_BYTES) {
32417
+ deps.writeJson(res, 413, { error: "payload_too_large" });
32418
+ return true;
32419
+ }
32420
+ const updated = deps.consoleSettingsStore.update((current) => ({
32421
+ ...current,
32422
+ version: 1,
32423
+ plugins: { ...current.plugins, [pluginId]: body }
32424
+ }));
32425
+ deps.writeJson(res, 200, { value: updated.plugins?.[pluginId] ?? null });
32426
+ return true;
32427
+ }
32428
+ deps.writeJson(res, 405, { error: "Method not allowed" });
32429
+ return true;
32430
+ };
32431
+ }
32432
+ function isRecord5(value) {
32433
+ return typeof value === "object" && value !== null && !Array.isArray(value);
32434
+ }
32435
+ function isJsonRequest3(req) {
32436
+ const contentType = req.headers["content-type"];
32437
+ return typeof contentType === "string" && contentType.toLowerCase().split(";")[0]?.trim() === "application/json";
32438
+ }
32199
32439
 
32200
32440
  // core/host/api-catalog.ts
32201
32441
  var compareApiCatalogEntries = (left, right) => left.category.localeCompare(right.category) || left.path.localeCompare(right.path) || left.method.localeCompare(right.method);
@@ -32203,7 +32443,8 @@ function buildApiCatalog() {
32203
32443
  return [
32204
32444
  ...SERVER_API_CATALOG,
32205
32445
  ...CARRIER_SETTINGS_API_CATALOG,
32206
- ...GLOBAL_SETTINGS_API_CATALOG
32446
+ ...GLOBAL_SETTINGS_API_CATALOG,
32447
+ ...PLUGIN_SETTINGS_API_CATALOG
32207
32448
  ].slice().sort(compareApiCatalogEntries);
32208
32449
  }
32209
32450
 
@@ -32613,18 +32854,18 @@ Always read \`schema/wiki-schema.md\` directly before composing or revising entr
32613
32854
  `;
32614
32855
  async function ensureWorkspaceSchema(paths) {
32615
32856
  await mkdir(paths.schemaDir, { recursive: true });
32616
- await writeDefaultFileIfMissing(path25__default.join(paths.schemaDir, WORKSPACE_SCHEMA_AGENTS_FILENAME), DEFAULT_WORKSPACE_SCHEMA_AGENTS);
32617
- await writeDefaultFileIfMissing(path25__default.join(paths.schemaDir, WORKSPACE_SCHEMA_FILENAME), DEFAULT_WORKSPACE_WIKI_SCHEMA);
32857
+ await writeDefaultFileIfMissing(path26__default.join(paths.schemaDir, WORKSPACE_SCHEMA_AGENTS_FILENAME), DEFAULT_WORKSPACE_SCHEMA_AGENTS);
32858
+ await writeDefaultFileIfMissing(path26__default.join(paths.schemaDir, WORKSPACE_SCHEMA_FILENAME), DEFAULT_WORKSPACE_WIKI_SCHEMA);
32618
32859
  await writeDefaultFileIfMissing(buildTemplatePath(paths, "prd"), DEFAULT_TEMPLATE_PRD);
32619
32860
  return readWorkspaceSchemaSummary(paths);
32620
32861
  }
32621
32862
  async function ensureWorkspaceDoctrine(paths) {
32622
32863
  await mkdir(paths.root, { recursive: true });
32623
- await writeDefaultFileIfMissing(path25__default.join(paths.root, WORKSPACE_KNOWLEDGE_AGENTS_FILENAME), DEFAULT_WORKSPACE_KNOWLEDGE_AGENTS);
32864
+ await writeDefaultFileIfMissing(path26__default.join(paths.root, WORKSPACE_KNOWLEDGE_AGENTS_FILENAME), DEFAULT_WORKSPACE_KNOWLEDGE_AGENTS);
32624
32865
  }
32625
32866
  async function readWorkspaceSchemaSummary(paths) {
32626
- const agentsPath = path25__default.join(paths.schemaDir, WORKSPACE_SCHEMA_AGENTS_FILENAME);
32627
- const wikiSchemaPath = path25__default.join(paths.schemaDir, WORKSPACE_SCHEMA_FILENAME);
32867
+ const agentsPath = path26__default.join(paths.schemaDir, WORKSPACE_SCHEMA_AGENTS_FILENAME);
32868
+ const wikiSchemaPath = path26__default.join(paths.schemaDir, WORKSPACE_SCHEMA_FILENAME);
32628
32869
  const wikiSchemaContent = await tryReadFile(wikiSchemaPath);
32629
32870
  const templates = await scanTemplates(paths);
32630
32871
  if (wikiSchemaContent === null) {
@@ -32663,7 +32904,7 @@ async function scanTemplates(paths) {
32663
32904
  if (!entry.name.startsWith(WORKSPACE_TEMPLATE_PREFIX) || !entry.name.endsWith(WORKSPACE_TEMPLATE_SUFFIX)) continue;
32664
32905
  const id = entry.name.slice(WORKSPACE_TEMPLATE_PREFIX.length, -WORKSPACE_TEMPLATE_SUFFIX.length);
32665
32906
  if (!id) continue;
32666
- const filePath = path25__default.join(paths.schemaDir, entry.name);
32907
+ const filePath = path26__default.join(paths.schemaDir, entry.name);
32667
32908
  try {
32668
32909
  const parsed = parseTemplateMarkdown(await readFile(filePath, "utf8"));
32669
32910
  templates.push({
@@ -32697,7 +32938,7 @@ async function validateTemplateCompliance(paths, templateId, body) {
32697
32938
  }
32698
32939
  }
32699
32940
  function inferTemplateIdFromTarget(target, knownTemplateIds) {
32700
- const basename = path25__default.basename(target, ".md");
32941
+ const basename = path26__default.basename(target, ".md");
32701
32942
  const ids = knownTemplateIds ?? DEFAULT_TEMPLATE_IDS;
32702
32943
  const sorted = [...ids].sort((a, b) => b.length - a.length);
32703
32944
  for (const id of sorted) {
@@ -32726,7 +32967,7 @@ function extractSchemaSummary(content) {
32726
32967
  return lines.find((line) => line.length > 0 && !line.startsWith("#")) ?? "Workspace schema is present.";
32727
32968
  }
32728
32969
  function buildTemplatePath(paths, id) {
32729
- return path25__default.join(paths.schemaDir, `${WORKSPACE_TEMPLATE_PREFIX}${id}${WORKSPACE_TEMPLATE_SUFFIX}`);
32970
+ return path26__default.join(paths.schemaDir, `${WORKSPACE_TEMPLATE_PREFIX}${id}${WORKSPACE_TEMPLATE_SUFFIX}`);
32730
32971
  }
32731
32972
  function parseTemplateMarkdown(content) {
32732
32973
  const normalized = content.replace(/\r\n/g, "\n");
@@ -32753,16 +32994,16 @@ function isAlreadyExistsError(error51) {
32753
32994
 
32754
32995
  // ../../packages/fleet-wiki/src/paths.ts
32755
32996
  function resolveMemoryPaths(cwd) {
32756
- const root = path25__default.join(cwd, KNOWLEDGE_ROOT_DIRNAME);
32997
+ const root = path26__default.join(cwd, KNOWLEDGE_ROOT_DIRNAME);
32757
32998
  return {
32758
32999
  root,
32759
- rawDir: path25__default.join(root, RAW_DIRNAME),
32760
- wikiDir: path25__default.join(root, WIKI_DIRNAME),
32761
- schemaDir: path25__default.join(root, SCHEMA_DIRNAME),
32762
- queueDir: path25__default.join(root, QUEUE_DIRNAME),
32763
- archiveDir: path25__default.join(root, ARCHIVE_DIRNAME),
32764
- conflictsDir: path25__default.join(root, CONFLICTS_DIRNAME),
32765
- indexFile: path25__default.join(root, INDEX_FILENAME)
33000
+ rawDir: path26__default.join(root, RAW_DIRNAME),
33001
+ wikiDir: path26__default.join(root, WIKI_DIRNAME),
33002
+ schemaDir: path26__default.join(root, SCHEMA_DIRNAME),
33003
+ queueDir: path26__default.join(root, QUEUE_DIRNAME),
33004
+ archiveDir: path26__default.join(root, ARCHIVE_DIRNAME),
33005
+ conflictsDir: path26__default.join(root, CONFLICTS_DIRNAME),
33006
+ indexFile: path26__default.join(root, INDEX_FILENAME)
32766
33007
  };
32767
33008
  }
32768
33009
  async function ensureMemoryRoot(paths) {
@@ -32777,10 +33018,10 @@ async function ensureMemoryRoot(paths) {
32777
33018
  await ensureWorkspaceDoctrine(paths);
32778
33019
  }
32779
33020
  function getIndexMarkdownFile(paths) {
32780
- return path25__default.join(paths.wikiDir, INDEX_MD_FILENAME);
33021
+ return path26__default.join(paths.wikiDir, INDEX_MD_FILENAME);
32781
33022
  }
32782
33023
  function getLogFile(paths) {
32783
- return path25__default.join(paths.root, LOG_MD_FILENAME);
33024
+ return path26__default.join(paths.root, LOG_MD_FILENAME);
32784
33025
  }
32785
33026
 
32786
33027
  // ../../packages/fleet-wiki/src/log.ts
@@ -32846,12 +33087,12 @@ async function readWikiEntry(id, paths) {
32846
33087
  const index = await loadIndex(paths);
32847
33088
  const indexed = index[id];
32848
33089
  if (indexed) {
32849
- const resolved = path25__default.resolve(paths.root, indexed.path);
32850
- const rel = path25__default.relative(paths.wikiDir, resolved);
32851
- if (!rel || rel.startsWith("..") || path25__default.isAbsolute(rel)) return null;
33090
+ const resolved = path26__default.resolve(paths.root, indexed.path);
33091
+ const rel = path26__default.relative(paths.wikiDir, resolved);
33092
+ if (!rel || rel.startsWith("..") || path26__default.isAbsolute(rel)) return null;
32852
33093
  return readMarkdownFile(resolved);
32853
33094
  }
32854
- const fallbackPath = path25__default.join(paths.wikiDir, `${id}.md`);
33095
+ const fallbackPath = path26__default.join(paths.wikiDir, `${id}.md`);
32855
33096
  if (await pathExists(fallbackPath)) {
32856
33097
  return readMarkdownFile(fallbackPath);
32857
33098
  }
@@ -32862,20 +33103,20 @@ async function readWikiEntry(id, paths) {
32862
33103
  async function writeWikiEntryAtTarget(entry, target, paths) {
32863
33104
  await ensureMemoryRoot(paths);
32864
33105
  assertSafeEntryId(entry.id);
32865
- const absoluteTarget = path25__default.resolve(paths.root, target);
32866
- const relativeTarget = path25__default.relative(paths.wikiDir, absoluteTarget);
32867
- if (!relativeTarget || relativeTarget.startsWith("..") || path25__default.isAbsolute(relativeTarget)) {
33106
+ const absoluteTarget = path26__default.resolve(paths.root, target);
33107
+ const relativeTarget = path26__default.relative(paths.wikiDir, absoluteTarget);
33108
+ if (!relativeTarget || relativeTarget.startsWith("..") || path26__default.isAbsolute(relativeTarget)) {
32868
33109
  throw new Error(`[fleet-wiki] wiki target escapes wiki/: ${target}`);
32869
33110
  }
32870
33111
  if (!absoluteTarget.endsWith(".md")) {
32871
33112
  throw new Error(`[fleet-wiki] wiki target must end with .md: ${target}`);
32872
33113
  }
32873
- if (path25__default.basename(absoluteTarget, ".md") !== entry.id) {
33114
+ if (path26__default.basename(absoluteTarget, ".md") !== entry.id) {
32874
33115
  throw new Error("wiki patch body id must match target filename");
32875
33116
  }
32876
- await mkdir(path25__default.dirname(absoluteTarget), { recursive: true });
33117
+ await mkdir(path26__default.dirname(absoluteTarget), { recursive: true });
32877
33118
  await writeMarkdownAtomic(absoluteTarget, serializeWikiEntry(entry), paths);
32878
- return path25__default.join("wiki", relativeTarget).replaceAll(path25__default.sep, "/");
33119
+ return path26__default.join("wiki", relativeTarget).replaceAll(path26__default.sep, "/");
32879
33120
  }
32880
33121
  async function listWiki(paths) {
32881
33122
  const entries = await listWikiRecords(paths);
@@ -33098,7 +33339,7 @@ function parseWikiEntry(content) {
33098
33339
  async function listWikiRecords(paths) {
33099
33340
  return listMarkdownEntriesRecursive(paths.wikiDir, paths, (content, filePath) => ({
33100
33341
  entry: parseWikiEntry(content),
33101
- path: path25__default.relative(paths.root, filePath).replaceAll(path25__default.sep, "/")
33342
+ path: path26__default.relative(paths.root, filePath).replaceAll(path26__default.sep, "/")
33102
33343
  }));
33103
33344
  }
33104
33345
  async function listMarkdownEntriesRecursive(dirPath, paths, parser) {
@@ -33111,7 +33352,7 @@ async function listMarkdownEntriesRecursive(dirPath, paths, parser) {
33111
33352
  }
33112
33353
  const sortedEntries = entries.sort((left, right) => left.name.localeCompare(right.name));
33113
33354
  for (const entry of sortedEntries) {
33114
- const filePath = path25__default.join(dirPath, entry.name);
33355
+ const filePath = path26__default.join(dirPath, entry.name);
33115
33356
  if (entry.isDirectory()) {
33116
33357
  items.push(...await listMarkdownEntriesRecursive(filePath, paths, parser));
33117
33358
  continue;
@@ -33249,8 +33490,8 @@ async function writeJsonAtomic(filePath, value, paths) {
33249
33490
  }
33250
33491
  async function writeAtomic(filePath, content, paths) {
33251
33492
  await ensureMemoryRoot(paths);
33252
- const tempPath = path25__default.join(
33253
- path25__default.dirname(filePath),
33493
+ const tempPath = path26__default.join(
33494
+ path26__default.dirname(filePath),
33254
33495
  `.tmp-${process.pid}-${Date.now()}-${crypto5.randomUUID()}-${os3__default.hostname()}`
33255
33496
  );
33256
33497
  await writeFile(tempPath, content, "utf8");
@@ -33344,7 +33585,7 @@ function toRankedHit(entry, reason, detail, graphBoost, backlinksById) {
33344
33585
  score: basePriority * 100 + statusPriority * 10 + graphScore + (detail.tagBoost ?? 0),
33345
33586
  reason,
33346
33587
  excerpt,
33347
- path: path25__default.join("wiki", `${entry.id}.md`),
33588
+ path: path26__default.join("wiki", `${entry.id}.md`),
33348
33589
  tags: entry.tags,
33349
33590
  updated: entry.updated,
33350
33591
  version: entry.version,
@@ -33454,15 +33695,15 @@ var PATCH_SET_DIRNAME = "_sets";
33454
33695
  var PATCH_SET_META_FILENAME = PATCH_META_FILENAME;
33455
33696
  function getPatchSetDir(paths, patchSetId) {
33456
33697
  assertSafePatchSetId(patchSetId);
33457
- const patchSetDir = path25__default.join(paths.queueDir, PATCH_SET_DIRNAME, patchSetId);
33458
- const relative = path25__default.relative(path25__default.join(paths.queueDir, PATCH_SET_DIRNAME), patchSetDir);
33459
- if (!relative || relative.startsWith("..") || path25__default.isAbsolute(relative)) {
33698
+ const patchSetDir = path26__default.join(paths.queueDir, PATCH_SET_DIRNAME, patchSetId);
33699
+ const relative = path26__default.relative(path26__default.join(paths.queueDir, PATCH_SET_DIRNAME), patchSetDir);
33700
+ if (!relative || relative.startsWith("..") || path26__default.isAbsolute(relative)) {
33460
33701
  throw new Error(`[fleet-wiki] patch set id escapes queue/_sets: ${patchSetId}`);
33461
33702
  }
33462
33703
  return patchSetDir;
33463
33704
  }
33464
33705
  function getPatchSetMetaFile(paths, patchSetId) {
33465
- return path25__default.join(getPatchSetDir(paths, patchSetId), PATCH_SET_META_FILENAME);
33706
+ return path26__default.join(getPatchSetDir(paths, patchSetId), PATCH_SET_META_FILENAME);
33466
33707
  }
33467
33708
  async function readPatchSet(paths, patchSetId) {
33468
33709
  const patchSet = await readJsonFile2(getPatchSetMetaFile(paths, patchSetId));
@@ -33485,7 +33726,7 @@ async function createConflict(input, paths) {
33485
33726
  await ensureMemoryRoot(paths);
33486
33727
  const now = input.now ?? /* @__PURE__ */ new Date();
33487
33728
  const conflictId = buildConflictId(now, input.wikiId, input.reason, input.proposed);
33488
- const conflictDir = path25__default.join(paths.conflictsDir, conflictId);
33729
+ const conflictDir = path26__default.join(paths.conflictsDir, conflictId);
33489
33730
  await mkdir(conflictDir, { recursive: true });
33490
33731
  const meta3 = {
33491
33732
  id: conflictId,
@@ -33505,13 +33746,13 @@ async function createConflict(input, paths) {
33505
33746
  currentHash: input.currentHash,
33506
33747
  warnings: input.warnings
33507
33748
  };
33508
- await writeJsonFile(path25__default.join(conflictDir, CONFLICT_META_FILENAME), meta3, paths);
33509
- await writePatchFile(path25__default.join(conflictDir, CONFLICT_PROPOSED_FILENAME), input.proposed, paths);
33749
+ await writeJsonFile(path26__default.join(conflictDir, CONFLICT_META_FILENAME), meta3, paths);
33750
+ await writePatchFile(path26__default.join(conflictDir, CONFLICT_PROPOSED_FILENAME), input.proposed, paths);
33510
33751
  if (input.current !== void 0) {
33511
- await writePatchFile(path25__default.join(conflictDir, CONFLICT_CURRENT_FILENAME), input.current, paths);
33752
+ await writePatchFile(path26__default.join(conflictDir, CONFLICT_CURRENT_FILENAME), input.current, paths);
33512
33753
  }
33513
33754
  if (input.rawSource !== void 0) {
33514
- await writePatchFile(path25__default.join(conflictDir, CONFLICT_RAW_SOURCE_FILENAME), input.rawSource, paths);
33755
+ await writePatchFile(path26__default.join(conflictDir, CONFLICT_RAW_SOURCE_FILENAME), input.rawSource, paths);
33515
33756
  }
33516
33757
  return {
33517
33758
  meta: meta3,
@@ -33561,11 +33802,11 @@ async function validatePatch(patch, paths) {
33561
33802
  if (!target || !summary || !proposer || !created) throw new Error("patch frontmatter is incomplete");
33562
33803
  if (summary.length > 120) throw new Error("patch summary exceeds 120 chars");
33563
33804
  assertCanonicalPatchTarget(target);
33564
- const absoluteTarget = path25__default.resolve(paths.root, target);
33565
- if (!absoluteTarget.startsWith(`${paths.root}${path25__default.sep}`) && absoluteTarget !== paths.root) {
33805
+ const absoluteTarget = path26__default.resolve(paths.root, target);
33806
+ if (!absoluteTarget.startsWith(`${paths.root}${path26__default.sep}`) && absoluteTarget !== paths.root) {
33566
33807
  throw new Error("patch target escapes wiki root");
33567
33808
  }
33568
- if (!absoluteTarget.startsWith(`${paths.wikiDir}${path25__default.sep}`)) throw new Error("wiki patch must target wiki/");
33809
+ if (!absoluteTarget.startsWith(`${paths.wikiDir}${path26__default.sep}`)) throw new Error("wiki patch must target wiki/");
33569
33810
  assertNoSymlinkPathComponents(target, paths);
33570
33811
  if (op === "create_wiki" && await pathExists(absoluteTarget)) {
33571
33812
  throw new Error(
@@ -33589,7 +33830,7 @@ async function listQueue(paths) {
33589
33830
  for (const id of ids) {
33590
33831
  if (id === "_sets") continue;
33591
33832
  try {
33592
- const meta3 = await readJsonFile2(path25__default.join(paths.queueDir, id, PATCH_META_FILENAME));
33833
+ const meta3 = await readJsonFile2(path26__default.join(paths.queueDir, id, PATCH_META_FILENAME));
33593
33834
  results.push({ id, meta: meta3 });
33594
33835
  } catch {
33595
33836
  continue;
@@ -33614,9 +33855,9 @@ async function resolveQueueSelection(id, paths) {
33614
33855
  }
33615
33856
  async function showQueue(id, paths) {
33616
33857
  const selection = await resolveQueueSelection(id, paths);
33617
- const queueDir = path25__default.join(paths.queueDir, selection.id);
33618
- const patch = await parsePatch(await readPatchFile(path25__default.join(queueDir, PATCH_FILENAME)));
33619
- const meta3 = await readJsonFile2(path25__default.join(queueDir, PATCH_META_FILENAME));
33858
+ const queueDir = path26__default.join(paths.queueDir, selection.id);
33859
+ const patch = await parsePatch(await readPatchFile(path26__default.join(queueDir, PATCH_FILENAME)));
33860
+ const meta3 = await readJsonFile2(path26__default.join(queueDir, PATCH_META_FILENAME));
33620
33861
  return { patch, meta: meta3 };
33621
33862
  }
33622
33863
  async function approvePatch(id, paths) {
@@ -33639,8 +33880,8 @@ async function approvePatch(id, paths) {
33639
33880
  rawSourceRef: meta3.rawSourceRef,
33640
33881
  warnings: meta3.warnings
33641
33882
  });
33642
- const queueDir = path25__default.join(paths.queueDir, id);
33643
- await writeJsonFile(path25__default.join(queueDir, PATCH_META_FILENAME), {
33883
+ const queueDir = path26__default.join(paths.queueDir, id);
33884
+ await writeJsonFile(path26__default.join(queueDir, PATCH_META_FILENAME), {
33644
33885
  ...meta3,
33645
33886
  conflictId
33646
33887
  }, paths);
@@ -33693,7 +33934,7 @@ async function rejectPatch(id, reason, paths) {
33693
33934
  }
33694
33935
  async function normalizeWikiEntryPatch(entry, target, paths) {
33695
33936
  assertSafeEntryId(entry.id);
33696
- if (entry.id !== path25__default.basename(target, ".md")) {
33937
+ if (entry.id !== path26__default.basename(target, ".md")) {
33697
33938
  throw new Error("wiki patch body id must match target filename");
33698
33939
  }
33699
33940
  const inlineRawSourceRef = extractInlineRawSourceRef(entry.body);
@@ -33731,9 +33972,9 @@ function extractInlineRawSourceRef(body) {
33731
33972
  }
33732
33973
  async function validatePatchBase(patch, meta3, paths) {
33733
33974
  if (patch.frontmatter.op !== "update_wiki" || !meta3?.baseVersion && !meta3?.baseHash) return;
33734
- const wikiId = path25__default.basename(patch.frontmatter.target, ".md");
33975
+ const wikiId = path26__default.basename(patch.frontmatter.target, ".md");
33735
33976
  const currentEntry = await readWikiEntry(wikiId, paths);
33736
- const currentPath = path25__default.join(paths.root, patch.frontmatter.target);
33977
+ const currentPath = path26__default.join(paths.root, patch.frontmatter.target);
33737
33978
  const currentMarkdown = await pathExists(currentPath) ? await readPatchFile(currentPath) : void 0;
33738
33979
  if (meta3.baseVersion !== void 0 && currentEntry?.version !== meta3.baseVersion) {
33739
33980
  throw new Error(
@@ -33792,17 +34033,17 @@ function assertCanonicalPatchTarget(target) {
33792
34033
  if (target.endsWith("/")) {
33793
34034
  throw new Error("patch target must not end with a slash");
33794
34035
  }
33795
- if (target.startsWith("/") || path25__default.posix.isAbsolute(target) || path25__default.win32.isAbsolute(target)) {
34036
+ if (target.startsWith("/") || path26__default.posix.isAbsolute(target) || path26__default.win32.isAbsolute(target)) {
33796
34037
  throw new Error("patch target must be relative");
33797
34038
  }
33798
- if (path25__default.posix.normalize(target) !== target) {
34039
+ if (path26__default.posix.normalize(target) !== target) {
33799
34040
  throw new Error("patch target must not contain dot segments or redundant separators");
33800
34041
  }
33801
34042
  }
33802
34043
  function canonicalApprovalLockKey(paths, target) {
33803
34044
  const wikiRoot = realpathSync(paths.wikiDir);
33804
- const relativeTarget = path25__default.posix.relative("wiki", target);
33805
- const targetPath = path25__default.join(wikiRoot, ...relativeTarget.split("/"));
34045
+ const relativeTarget = path26__default.posix.relative("wiki", target);
34046
+ const targetPath = path26__default.join(wikiRoot, ...relativeTarget.split("/"));
33806
34047
  return `${wikiRoot}\0${targetPath}`.toLowerCase();
33807
34048
  }
33808
34049
  function canonicalPatchEditLockKey(paths, patchId) {
@@ -33818,7 +34059,7 @@ function assertNoSymlinkPathComponents(target, paths) {
33818
34059
  throw error51;
33819
34060
  }
33820
34061
  for (const part of parts) {
33821
- current = path25__default.join(current, part);
34062
+ current = path26__default.join(current, part);
33822
34063
  try {
33823
34064
  if (lstatSync(current).isSymbolicLink()) {
33824
34065
  throw new Error("patch target must not include symlink path components");
@@ -33833,8 +34074,8 @@ function assertSafeRawSourceRef(rawSourceRef, paths) {
33833
34074
  if (!rawSourceRef.startsWith("raw/")) {
33834
34075
  throw new Error("raw source provenance must point into raw/");
33835
34076
  }
33836
- const absoluteRef = path25__default.resolve(paths.root, rawSourceRef);
33837
- if (!absoluteRef.startsWith(`${paths.rawDir}${path25__default.sep}`)) {
34077
+ const absoluteRef = path26__default.resolve(paths.root, rawSourceRef);
34078
+ if (!absoluteRef.startsWith(`${paths.rawDir}${path26__default.sep}`)) {
33838
34079
  throw new Error("raw source provenance must point into raw/");
33839
34080
  }
33840
34081
  }
@@ -33850,14 +34091,14 @@ function classifyPatchConflict(error51) {
33850
34091
  }
33851
34092
  async function recordPatchConflict(patch, paths, reason, options) {
33852
34093
  const now = /* @__PURE__ */ new Date();
33853
- const targetPath = path25__default.join(paths.root, patch.frontmatter.target);
34094
+ const targetPath = path26__default.join(paths.root, patch.frontmatter.target);
33854
34095
  const current = await pathExists(targetPath) ? await readPatchFile(targetPath) : void 0;
33855
34096
  const currentEntry = current ? parseStoredWikiEntry(current) : void 0;
33856
34097
  const proposedEntry = parsePatchBodyEntry(patch.body);
33857
34098
  const record2 = await createConflict({
33858
34099
  reason,
33859
34100
  target: patch.frontmatter.target,
33860
- wikiId: proposedEntry?.id ?? path25__default.basename(patch.frontmatter.target, ".md"),
34101
+ wikiId: proposedEntry?.id ?? path26__default.basename(patch.frontmatter.target, ".md"),
33861
34102
  title: proposedEntry?.title,
33862
34103
  proposer: patch.frontmatter.proposer,
33863
34104
  rawSourceRef: options?.rawSourceRef,
@@ -33953,11 +34194,11 @@ function parseInlineArray(value) {
33953
34194
  return inner.split(",").map((item) => item.trim().replace(/^"(.*)"$/, "$1"));
33954
34195
  }
33955
34196
  async function archiveQueueEntry(id, paths, meta3) {
33956
- const fromDir = path25__default.join(paths.queueDir, id);
33957
- const toDir = path25__default.join(paths.archiveDir, id);
34197
+ const fromDir = path26__default.join(paths.queueDir, id);
34198
+ const toDir = path26__default.join(paths.archiveDir, id);
33958
34199
  await removePath(toDir);
33959
34200
  await movePath(fromDir, toDir);
33960
- await writeJsonFile(path25__default.join(toDir, PATCH_META_FILENAME), meta3, paths);
34201
+ await writeJsonFile(path26__default.join(toDir, PATCH_META_FILENAME), meta3, paths);
33961
34202
  }
33962
34203
  function buildQueueIdHelp(prefix, availableIds) {
33963
34204
  if (availableIds.length === 0) {
@@ -34679,7 +34920,7 @@ async function canonicalizeTheaterPath(cwd) {
34679
34920
  return canonicalizeTheaterPathSync(cwd);
34680
34921
  }
34681
34922
  function canonicalizeTheaterPathSync(cwd) {
34682
- const resolved = path25__default.resolve(cwd);
34923
+ const resolved = path26__default.resolve(cwd);
34683
34924
  try {
34684
34925
  return fs11__default.realpathSync.native(resolved);
34685
34926
  } catch {
@@ -34687,7 +34928,7 @@ function canonicalizeTheaterPathSync(cwd) {
34687
34928
  }
34688
34929
  }
34689
34930
  function theaterLabel(cwd) {
34690
- return path25__default.basename(cwd) || cwd;
34931
+ return path26__default.basename(cwd) || cwd;
34691
34932
  }
34692
34933
 
34693
34934
  // core/host/codex/workspaces.ts
@@ -34695,7 +34936,7 @@ var WorkspaceRegistry = class {
34695
34936
  #items = /* @__PURE__ */ new Map();
34696
34937
  #mruId = null;
34697
34938
  async register(cwdInput, lastOpenedAt) {
34698
- const cwd = path25__default.resolve(cwdInput);
34939
+ const cwd = path26__default.resolve(cwdInput);
34699
34940
  const real = await canonicalizeTheaterPath(cwd);
34700
34941
  const paths = resolveMemoryPaths(real);
34701
34942
  if (!await directoryExists(paths.root)) {
@@ -34711,7 +34952,7 @@ var WorkspaceRegistry = class {
34711
34952
  id,
34712
34953
  cwd,
34713
34954
  realpath: real,
34714
- label: path25__default.basename(cwd),
34955
+ label: path26__default.basename(cwd),
34715
34956
  paths,
34716
34957
  registeredAt: existing?.registeredAt ?? now,
34717
34958
  // 복원 경로는 durable lastOpenedAt을 그대로 보존해 재시작 후에도 워크스페이스 최근성
@@ -34807,7 +35048,7 @@ function createCodexGateway(deps) {
34807
35048
  return true;
34808
35049
  }
34809
35050
  if (selected.kind === "no-workspace") {
34810
- if (isJsonRequest3(request)) {
35051
+ if (isJsonRequest4(request)) {
34811
35052
  sendJson2(response, 404, { error: "no_workspace_registered" });
34812
35053
  return true;
34813
35054
  }
@@ -34922,7 +35163,7 @@ function legacyWorkspacePath(url2) {
34922
35163
  }
34923
35164
  return null;
34924
35165
  }
34925
- function isJsonRequest3(request) {
35166
+ function isJsonRequest4(request) {
34926
35167
  const accept = Array.isArray(request.headers.accept) ? request.headers.accept.join(",") : request.headers.accept ?? "";
34927
35168
  const requestedWith = Array.isArray(request.headers["x-requested-with"]) ? request.headers["x-requested-with"].join(",") : request.headers["x-requested-with"] ?? "";
34928
35169
  return accept.includes("application/json") || requestedWith.toLowerCase() === "xmlhttprequest";
@@ -34997,54 +35238,6 @@ function readRawHeaderValues(rawHeaders, name) {
34997
35238
  function stripIpv6Brackets2(host) {
34998
35239
  return host.startsWith("[") && host.endsWith("]") ? host.slice(1, -1) : host;
34999
35240
  }
35000
- var SETTINGS_VERSION = 1;
35001
- var SETTINGS_LOCK_DIR_NAME = "settings.lock";
35002
- var SETTINGS_LOCK_OWNER_FILE_NAME = "owner.json";
35003
- var SETTINGS_TEMP_PREFIX = ".settings.";
35004
- var MIN_CONSOLE_STATIC_PORT2 = 1024;
35005
- var MAX_CONSOLE_STATIC_PORT2 = 65535;
35006
- function createConsoleSettingsStore(deps = {}) {
35007
- const paths = deps.paths ?? createConsoleDataPaths();
35008
- const createStore = deps.createStore ?? createDurableJsonStore;
35009
- return createStore({
35010
- filePath: paths.settingsFile,
35011
- lockDir: path25__default.join(paths.dir, SETTINGS_LOCK_DIR_NAME),
35012
- lockOwnerFileName: SETTINGS_LOCK_OWNER_FILE_NAME,
35013
- now: deps.now,
35014
- sanitize: sanitizeConsoleSettingsData,
35015
- sensitivity: "sensitive",
35016
- tempCleanupPrefix: SETTINGS_TEMP_PREFIX
35017
- });
35018
- }
35019
- function sanitizeConsoleSettingsData(value) {
35020
- if (!isRecord4(value)) return emptyConsoleSettingsData();
35021
- if (value.version !== SETTINGS_VERSION) return emptyConsoleSettingsData();
35022
- const general = readConsoleGeneralSettings(value.general);
35023
- return {
35024
- version: SETTINGS_VERSION,
35025
- general: general ?? {}
35026
- };
35027
- }
35028
- function emptyConsoleSettingsData() {
35029
- return { version: 1, general: {} };
35030
- }
35031
- function readConsoleGeneralSettings(value) {
35032
- if (!isRecord4(value)) return null;
35033
- const consolePortMode = value.consolePortMode === "dynamic" || value.consolePortMode === "static" ? value.consolePortMode : void 0;
35034
- const consoleStaticPort = isValidConsoleStaticPort2(value.consoleStaticPort) ? value.consoleStaticPort : void 0;
35035
- const theme = value.theme === "maritime" || value.theme === "carbon" ? value.theme : void 0;
35036
- return {
35037
- ...consolePortMode !== void 0 ? { consolePortMode } : {},
35038
- ...consoleStaticPort !== void 0 ? { consoleStaticPort } : {},
35039
- ...theme !== void 0 ? { theme } : {}
35040
- };
35041
- }
35042
- function isRecord4(value) {
35043
- return typeof value === "object" && value !== null && !Array.isArray(value);
35044
- }
35045
- function isValidConsoleStaticPort2(value) {
35046
- return typeof value === "number" && Number.isInteger(value) && value >= MIN_CONSOLE_STATIC_PORT2 && value <= MAX_CONSOLE_STATIC_PORT2;
35047
- }
35048
35241
 
35049
35242
  // core/host/operations/types.ts
35050
35243
  var MAX_GROUP_NAME_LENGTH = 64;
@@ -35077,7 +35270,7 @@ function createConsoleDurableStateStore(deps = {}) {
35077
35270
  const createStore = deps.createStore ?? createDurableJsonStore;
35078
35271
  return createStore({
35079
35272
  filePath: paths.stateFile,
35080
- lockDir: path25__default.join(paths.dir, STATE_LOCK_DIR_NAME),
35273
+ lockDir: path26__default.join(paths.dir, STATE_LOCK_DIR_NAME),
35081
35274
  lockOwnerFileName: STATE_LOCK_OWNER_FILE_NAME,
35082
35275
  now: deps.now,
35083
35276
  sanitize: sanitizeDurableConsoleState,
@@ -35086,7 +35279,7 @@ function createConsoleDurableStateStore(deps = {}) {
35086
35279
  });
35087
35280
  }
35088
35281
  function sanitizeDurableConsoleState(value) {
35089
- if (!isRecord5(value)) return emptyDurableConsoleState();
35282
+ if (!isRecord6(value)) return emptyDurableConsoleState();
35090
35283
  const upgraded = migrateToCurrentVersion(value);
35091
35284
  if (upgraded.version !== STATE_VERSION) return emptyDurableConsoleState();
35092
35285
  return {
@@ -35113,13 +35306,13 @@ function migrateV1ToV2(v1) {
35113
35306
  };
35114
35307
  }
35115
35308
  function migrateV1Operation(value) {
35116
- if (!isRecord5(value)) return null;
35309
+ if (!isRecord6(value)) return null;
35117
35310
  const sessionId = readNonEmptyString(value.sessionId);
35118
35311
  const theaterId = readNonEmptyString(value.theaterId);
35119
35312
  const cwd = readNonEmptyString(value.cwd);
35120
35313
  const createdAt = readFiniteNumber(value.createdAt);
35121
35314
  if (!sessionId || !theaterId || !cwd || createdAt === null) return null;
35122
- const title = readOptionalString(value.label) ?? (path25__default.basename(cwd) || cwd);
35315
+ const title = readOptionalString(value.label) ?? (path26__default.basename(cwd) || cwd);
35123
35316
  const payload = { cwd };
35124
35317
  const cliId = readOptionalString(value.cliId);
35125
35318
  const cliLabel = readOptionalString(value.cliLabel);
@@ -35127,7 +35320,7 @@ function migrateV1Operation(value) {
35127
35320
  if (cliId) payload.cliId = cliId;
35128
35321
  if (cliLabel) payload.cliLabel = cliLabel;
35129
35322
  if (labelSource) payload.labelSource = labelSource;
35130
- if (isRecord5(value.providerSession)) payload.providerSession = value.providerSession;
35323
+ if (isRecord6(value.providerSession)) payload.providerSession = value.providerSession;
35131
35324
  return {
35132
35325
  id: sessionId,
35133
35326
  theaterId,
@@ -35158,7 +35351,7 @@ function readOperations(value) {
35158
35351
  return nodes;
35159
35352
  }
35160
35353
  function sanitizeTheaterRegistration(value) {
35161
- if (!isRecord5(value)) return null;
35354
+ if (!isRecord6(value)) return null;
35162
35355
  const id = readNonEmptyString(value.id);
35163
35356
  const theaterPath = readNonEmptyString(value.path);
35164
35357
  const realpath2 = readNonEmptyString(value.realpath);
@@ -35169,7 +35362,7 @@ function sanitizeTheaterRegistration(value) {
35169
35362
  return { id, path: theaterPath, realpath: realpath2, label, registeredAt, lastOpenedAt };
35170
35363
  }
35171
35364
  function sanitizeOperationNode(value) {
35172
- if (!isRecord5(value)) return null;
35365
+ if (!isRecord6(value)) return null;
35173
35366
  const id = readNonEmptyString(value.id);
35174
35367
  const theaterId = readNonEmptyString(value.theaterId);
35175
35368
  const type = readNonEmptyString(value.type);
@@ -35193,7 +35386,7 @@ function sanitizeOperationNode(value) {
35193
35386
  };
35194
35387
  }
35195
35388
  function sanitizeOperationTimestamps(value) {
35196
- if (!isRecord5(value)) return null;
35389
+ if (!isRecord6(value)) return null;
35197
35390
  const createdAt = readFiniteNumber(value.createdAt);
35198
35391
  const updatedAt = readFiniteNumber(value.updatedAt);
35199
35392
  if (createdAt === null || updatedAt === null) return null;
@@ -35201,7 +35394,7 @@ function sanitizeOperationTimestamps(value) {
35201
35394
  }
35202
35395
  function sanitizeOperationGeometry(value) {
35203
35396
  if (value === null || value === void 0) return null;
35204
- if (!isRecord5(value)) return null;
35397
+ if (!isRecord6(value)) return null;
35205
35398
  const x = readFiniteNumber(value.x);
35206
35399
  const y = readFiniteNumber(value.y);
35207
35400
  const width = readFiniteNumber(value.width);
@@ -35210,7 +35403,7 @@ function sanitizeOperationGeometry(value) {
35210
35403
  if (x === null || y === null || width === null || height === null || zIndex === null) return null;
35211
35404
  return { x, y, width, height, zIndex };
35212
35405
  }
35213
- function isRecord5(value) {
35406
+ function isRecord6(value) {
35214
35407
  return typeof value === "object" && value !== null && !Array.isArray(value);
35215
35408
  }
35216
35409
  function readNonEmptyString(value) {
@@ -35220,7 +35413,7 @@ function readOptionalString(value) {
35220
35413
  return typeof value === "string" && value.length > 0 ? value : void 0;
35221
35414
  }
35222
35415
  function readRecord(value) {
35223
- return isRecord5(value) ? value : {};
35416
+ return isRecord6(value) ? value : {};
35224
35417
  }
35225
35418
  function remapTerminalPluginId(pluginId) {
35226
35419
  return pluginId === "agent" || pluginId === "shell" ? "terminal" : pluginId;
@@ -35254,7 +35447,7 @@ function readOperationGroups(value) {
35254
35447
  return groups;
35255
35448
  }
35256
35449
  function sanitizeOperationGroup(value) {
35257
- if (!isRecord5(value)) return null;
35450
+ if (!isRecord6(value)) return null;
35258
35451
  const id = readNonEmptyString(value.id);
35259
35452
  const theaterId = readNonEmptyString(value.theaterId);
35260
35453
  const rawName = readNonEmptyString(value.name);
@@ -35296,10 +35489,10 @@ function sanitizeRecord(value, sensitiveFields) {
35296
35489
  }
35297
35490
  function sanitizeValue(value, sensitiveFields) {
35298
35491
  if (Array.isArray(value)) return value.map((item) => sanitizeValue(item, sensitiveFields));
35299
- if (!isRecord6(value)) return value;
35492
+ if (!isRecord7(value)) return value;
35300
35493
  return sanitizeRecord(value, sensitiveFields);
35301
35494
  }
35302
- function isRecord6(value) {
35495
+ function isRecord7(value) {
35303
35496
  return typeof value === "object" && value !== null && !Array.isArray(value);
35304
35497
  }
35305
35498
 
@@ -35367,8 +35560,8 @@ async function handleCollection(req, res, deps) {
35367
35560
  pluginId: body.pluginId,
35368
35561
  title: body.title,
35369
35562
  ...typeof body.accent === "string" ? { accent: body.accent } : {},
35370
- payload: isRecord7(body.payload) ? body.payload : {},
35371
- geometry: isRecord7(body.geometry) ? readGeometry(body.geometry) : null
35563
+ payload: isRecord8(body.payload) ? body.payload : {},
35564
+ geometry: isRecord8(body.geometry) ? readGeometry(body.geometry) : null
35372
35565
  });
35373
35566
  deps.persist();
35374
35567
  deps.writeJson(res, 201, { operation: sanitizeOperationNode2(node, deps) });
@@ -35425,8 +35618,8 @@ async function handleItem(req, res, id, deps) {
35425
35618
  ...typeof body.title === "string" ? { title: body.title } : {},
35426
35619
  ...typeof body.accent === "string" || body.accent === null ? { accent: body.accent } : {},
35427
35620
  ...typeof body.groupId === "string" || body.groupId === null ? { groupId: body.groupId } : {},
35428
- ...isRecord7(body.payload) ? { payload: body.payload } : {},
35429
- ...isRecord7(body.geometry) || body.geometry === null ? { geometry: body.geometry === null ? null : readGeometry(body.geometry) } : {}
35621
+ ...isRecord8(body.payload) ? { payload: body.payload } : {},
35622
+ ...isRecord8(body.geometry) || body.geometry === null ? { geometry: body.geometry === null ? null : readGeometry(body.geometry) } : {}
35430
35623
  });
35431
35624
  if (!node) {
35432
35625
  deps.writeJson(res, 404, { error: "operation_not_found" });
@@ -35530,7 +35723,7 @@ function readFiniteNumber2(value) {
35530
35723
  function readRequestUrl(req) {
35531
35724
  return new URL(req.url ?? "/", "http://127.0.0.1");
35532
35725
  }
35533
- function isRecord7(value) {
35726
+ function isRecord8(value) {
35534
35727
  return typeof value === "object" && value !== null && !Array.isArray(value);
35535
35728
  }
35536
35729
  function createOperationStore(deps = {}) {
@@ -35701,7 +35894,7 @@ var SDK_API_VERSION = 1;
35701
35894
  var SHIM_NAMED_EXPORTS = {
35702
35895
  "react": ["Activity", "Children", "Component", "Fragment", "Profiler", "PureComponent", "StrictMode", "Suspense", "__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE", "__COMPILER_RUNTIME", "act", "cache", "cacheSignal", "captureOwnerStack", "cloneElement", "createContext", "createElement", "createRef", "forwardRef", "isValidElement", "lazy", "memo", "startTransition", "unstable_useCacheRefresh", "use", "useActionState", "useCallback", "useContext", "useDebugValue", "useDeferredValue", "useEffect", "useEffectEvent", "useId", "useImperativeHandle", "useInsertionEffect", "useLayoutEffect", "useMemo", "useOptimistic", "useReducer", "useRef", "useState", "useSyncExternalStore", "useTransition", "version"],
35703
35896
  "react/jsx-runtime": ["Fragment", "jsx", "jsxs"],
35704
- "@fleet-console/sdk/plugin/browser": ["React", "createClientCapabilities", "defineOperationKind", "definePlugin", "useOperationStatus", "useOperations", "usePluginApi", "usePluginStorage", "useStoreSnapshot"],
35897
+ "@fleet-console/sdk/plugin/browser": ["React", "createClientCapabilities", "defineOperationKind", "definePlugin", "useOperationStatus", "useOperations", "usePluginApi", "usePluginSettings", "usePluginStorage", "useStoreSnapshot"],
35705
35898
  "@fleet-console/sdk/settings/browser": ["SettingsCard", "SettingsField", "SettingsRow", "SettingsSelect", "SettingsToggle", "defineSettingsSection"],
35706
35899
  "@fleet-console/sdk/operations/browser": ["ApiError", "OperationBody", "assertOperationNode", "fetchOperationCatalog", "hasForbiddenBrowserPayloadKey"],
35707
35900
  "@fleet-console/sdk/notifications/browser": ["defineNotificationKind"],
@@ -35815,14 +36008,14 @@ function renderShim(definition) {
35815
36008
  ].join("\n");
35816
36009
  }
35817
36010
  function isSubpath(root, target) {
35818
- const relative = path25__default.relative(root, target);
35819
- return relative === "" || !relative.startsWith("..") && !path25__default.isAbsolute(relative);
36011
+ const relative = path26__default.relative(root, target);
36012
+ return relative === "" || !relative.startsWith("..") && !path26__default.isAbsolute(relative);
35820
36013
  }
35821
36014
  function discoverFleetPlugins(options = {}) {
35822
- const builtInSourceRoot = options.builtInSourceRoot ?? (options.cwd ? path25__default.resolve(options.cwd, "runtime/fleet-plugins") : null);
36015
+ const builtInSourceRoot = options.builtInSourceRoot ?? (options.cwd ? path26__default.resolve(options.cwd, "runtime/fleet-plugins") : null);
35823
36016
  const roots = [
35824
36017
  ...builtInSourceRoot ? [{ root: builtInSourceRoot, builtInDistRoot: options.builtInDistRoot ?? null, external: false }] : [],
35825
- { root: path25__default.join(options.homeDir ?? os3__default.homedir(), ".fleet", "plugins"), builtInDistRoot: null, external: true }
36018
+ { root: path26__default.join(options.homeDir ?? os3__default.homedir(), ".fleet", "plugins"), builtInDistRoot: null, external: true }
35826
36019
  ];
35827
36020
  const sourcePlugins = roots.flatMap((root) => discoverPluginRoot(root.root, root.builtInDistRoot, root.external));
35828
36021
  const sourcePluginIds = new Set(sourcePlugins.map((plugin) => plugin.manifest.id));
@@ -35830,7 +36023,7 @@ function discoverFleetPlugins(options = {}) {
35830
36023
  return [...sourcePlugins, ...distPlugins];
35831
36024
  }
35832
36025
  function parseFleetPluginManifest(value) {
35833
- if (!isRecord8(value)) return null;
36026
+ if (!isRecord9(value)) return null;
35834
36027
  const id = readPluginId(value.id);
35835
36028
  if (!id) return null;
35836
36029
  return {
@@ -35848,8 +36041,8 @@ function discoverPluginRoot(root, builtInDistRoot, external) {
35848
36041
  const plugins = [];
35849
36042
  for (const entry of entries) {
35850
36043
  if (!entry.isDirectory() || entry.name === "shared") continue;
35851
- const pluginRoot = path25__default.join(root, entry.name);
35852
- const manifestPath = path25__default.join(pluginRoot, "plugin.json");
36044
+ const pluginRoot = path26__default.join(root, entry.name);
36045
+ const manifestPath = path26__default.join(pluginRoot, "plugin.json");
35853
36046
  if (!fs11__default.existsSync(manifestPath)) continue;
35854
36047
  const manifest = readManifest(manifestPath);
35855
36048
  if (!manifest) continue;
@@ -35867,8 +36060,8 @@ function discoverDistPluginRoot(root) {
35867
36060
  const plugins = [];
35868
36061
  for (const entry of entries) {
35869
36062
  if (!entry.isDirectory() || entry.name === "shared") continue;
35870
- const pluginRoot = path25__default.join(root, entry.name);
35871
- const manifestPath = path25__default.join(pluginRoot, "plugin.json");
36063
+ const pluginRoot = path26__default.join(root, entry.name);
36064
+ const manifestPath = path26__default.join(pluginRoot, "plugin.json");
35872
36065
  const manifest = fs11__default.existsSync(manifestPath) ? readManifest(manifestPath) : readDistPluginManifest(entry.name);
35873
36066
  if (!manifest) continue;
35874
36067
  const clientEntry = resolveOptionalManifestEntry(pluginRoot, manifest.client, "client");
@@ -35895,10 +36088,10 @@ function resolveRoutesEntry(pluginRoot, manifest, builtInDistRoot) {
35895
36088
  if (manifestRoute2 === false) return false;
35896
36089
  if (manifestRoute2) return manifestRoute2;
35897
36090
  }
35898
- const manifestRoute = path25__default.join(pluginRoot, "routes.ts");
36091
+ const manifestRoute = path26__default.join(pluginRoot, "routes.ts");
35899
36092
  if (fs11__default.existsSync(manifestRoute)) return manifestRoute;
35900
36093
  if (!builtInDistRoot) return null;
35901
- const builtRoute = path25__default.join(builtInDistRoot, manifest.id, "routes.mjs");
36094
+ const builtRoute = path26__default.join(builtInDistRoot, manifest.id, "routes.mjs");
35902
36095
  return fs11__default.existsSync(builtRoute) ? builtRoute : null;
35903
36096
  }
35904
36097
  function resolveDistRoutesEntry(pluginRoot, manifest) {
@@ -35912,7 +36105,7 @@ function resolveOptionalManifestEntry(pluginRoot, entryPath, label) {
35912
36105
  console.warn(`[fleet-console] Plugin ${label} entry skipped: unsafe relative path ${entryPath}`);
35913
36106
  return false;
35914
36107
  }
35915
- const candidate = path25__default.resolve(pluginRoot, entryPath);
36108
+ const candidate = path26__default.resolve(pluginRoot, entryPath);
35916
36109
  if (!fs11__default.existsSync(candidate)) return null;
35917
36110
  const rootRealpath = fs11__default.realpathSync.native(pluginRoot);
35918
36111
  const entryRealpath = fs11__default.realpathSync.native(candidate);
@@ -35930,14 +36123,14 @@ function readDistPluginManifest(id) {
35930
36123
  return pluginId ? { id: pluginId, routes: "routes.mjs" } : null;
35931
36124
  }
35932
36125
  function isSafeRelativeEntry(entryPath) {
35933
- if (path25__default.isAbsolute(entryPath)) return false;
36126
+ if (path26__default.isAbsolute(entryPath)) return false;
35934
36127
  return entryPath.split(/[\\/]+/u).every((segment) => segment !== "..");
35935
36128
  }
35936
36129
  function isSubpath2(root, candidate) {
35937
- const relative = path25__default.relative(root, candidate);
35938
- return relative === "" || !relative.startsWith("..") && !path25__default.isAbsolute(relative);
36130
+ const relative = path26__default.relative(root, candidate);
36131
+ return relative === "" || !relative.startsWith("..") && !path26__default.isAbsolute(relative);
35939
36132
  }
35940
- function isRecord8(value) {
36133
+ function isRecord9(value) {
35941
36134
  return typeof value === "object" && value !== null && !Array.isArray(value);
35942
36135
  }
35943
36136
 
@@ -35958,7 +36151,7 @@ var PLUGIN_DEV_EXTERNALS = [
35958
36151
  "@dotobokuri/*",
35959
36152
  "@fleet-plugins/*"
35960
36153
  ];
35961
- var __dirname$1 = path25__default.dirname(fileURLToPath(import.meta.url));
36154
+ var __dirname$1 = path26__default.dirname(fileURLToPath(import.meta.url));
35962
36155
  function createFleetPluginHost(deps) {
35963
36156
  const plugins = filterDiscoveredPlugins(discoverFleetPlugins(deps));
35964
36157
  const sensitiveFieldsByPluginId = new Map(plugins.map((plugin) => [plugin.manifest.id, plugin.manifest.sensitiveFields ?? []]));
@@ -36032,39 +36225,39 @@ async function importPluginModule(entry) {
36032
36225
  return await import(pathToFileURL(entry).href);
36033
36226
  }
36034
36227
  async function writeTemporaryPluginBundle(entry, source) {
36035
- const cacheRoot = path25__default.join(resolvePluginBundleNodeModules(entry), ".cache");
36228
+ const cacheRoot = path26__default.join(resolvePluginBundleNodeModules(entry), ".cache");
36036
36229
  await mkdir(cacheRoot, { recursive: true });
36037
- const dir = await mkdtemp(path25__default.join(cacheRoot, "fleet-console-plugin-"));
36038
- const file2 = path25__default.join(dir, "routes.mjs");
36230
+ const dir = await mkdtemp(path26__default.join(cacheRoot, "fleet-console-plugin-"));
36231
+ const file2 = path26__default.join(dir, "routes.mjs");
36039
36232
  await writeFile(file2, source, "utf8");
36040
36233
  return file2;
36041
36234
  }
36042
36235
  function resolvePluginBundleNodeModules(entry) {
36043
36236
  const packageNodeModules = resolveConsolePackageNodeModules();
36044
- let dir = path25__default.dirname(entry);
36237
+ let dir = path26__default.dirname(entry);
36045
36238
  let fallback = packageNodeModules;
36046
36239
  while (true) {
36047
- const workspaceConsoleNodeModules = path25__default.join(dir, "runtime", "fleet-console", "node_modules");
36240
+ const workspaceConsoleNodeModules = path26__default.join(dir, "runtime", "fleet-console", "node_modules");
36048
36241
  if (hasFleetConsoleSdk(workspaceConsoleNodeModules)) return workspaceConsoleNodeModules;
36049
- const candidate = path25__default.join(dir, "node_modules");
36242
+ const candidate = path26__default.join(dir, "node_modules");
36050
36243
  if (hasFleetConsoleSdk(candidate)) return candidate;
36051
36244
  if (fallback === null && existsSync(candidate)) fallback = candidate;
36052
- const parent = path25__default.dirname(dir);
36053
- if (parent === dir) return fallback ?? path25__default.join(path25__default.dirname(entry), "node_modules");
36245
+ const parent = path26__default.dirname(dir);
36246
+ if (parent === dir) return fallback ?? path26__default.join(path26__default.dirname(entry), "node_modules");
36054
36247
  dir = parent;
36055
36248
  }
36056
36249
  }
36057
36250
  function resolveConsolePackageNodeModules() {
36058
36251
  for (const candidate of [
36059
- path25__default.resolve(__dirname$1, "..", "node_modules"),
36060
- path25__default.resolve(__dirname$1, "..", "..", "..", "node_modules")
36252
+ path26__default.resolve(__dirname$1, "..", "node_modules"),
36253
+ path26__default.resolve(__dirname$1, "..", "..", "..", "node_modules")
36061
36254
  ]) {
36062
36255
  if (hasFleetConsoleSdk(candidate)) return candidate;
36063
36256
  }
36064
36257
  return null;
36065
36258
  }
36066
36259
  function hasFleetConsoleSdk(nodeModules) {
36067
- return existsSync(path25__default.join(nodeModules, "@fleet-console", "sdk"));
36260
+ return existsSync(path26__default.join(nodeModules, "@fleet-console", "sdk"));
36068
36261
  }
36069
36262
  function resolveRegister(mod) {
36070
36263
  if (mod.register) return mod.register;
@@ -36332,7 +36525,7 @@ var MIME_TYPES = {
36332
36525
  ".woff2": "font/woff2"
36333
36526
  };
36334
36527
  function createStaticConsoleHandler(packageRoot) {
36335
- const consoleRoot = path25__default.join(packageRoot, "dist", "client");
36528
+ const consoleRoot = path26__default.join(packageRoot, "dist", "client");
36336
36529
  return (req, res, pathname) => tryServeStaticConsole(req, res, pathname, consoleRoot);
36337
36530
  }
36338
36531
  function tryServeStaticConsole(req, res, pathname, consoleRoot) {
@@ -36348,7 +36541,7 @@ function tryServeStaticConsole(req, res, pathname, consoleRoot) {
36348
36541
  res.end(JSON.stringify({ error: "Not found" }));
36349
36542
  return true;
36350
36543
  }
36351
- const absolutePath = path25__default.resolve(consoleRoot, relativePath2);
36544
+ const absolutePath = path26__default.resolve(consoleRoot, relativePath2);
36352
36545
  if (!absolutePath.startsWith(consoleRoot)) {
36353
36546
  res.writeHead(404, withSecurityHeaders2({ "Content-Type": "application/json" }));
36354
36547
  res.end(JSON.stringify({ error: "Not found" }));
@@ -36356,7 +36549,7 @@ function tryServeStaticConsole(req, res, pathname, consoleRoot) {
36356
36549
  }
36357
36550
  try {
36358
36551
  const data = fs11__default.readFileSync(absolutePath);
36359
- const contentType = MIME_TYPES[path25__default.extname(absolutePath)] ?? "application/octet-stream";
36552
+ const contentType = MIME_TYPES[path26__default.extname(absolutePath)] ?? "application/octet-stream";
36360
36553
  res.writeHead(200, withSecurityHeaders2({ "Content-Type": contentType }));
36361
36554
  if (req.method === "HEAD") {
36362
36555
  res.end();
@@ -36376,7 +36569,7 @@ function tryServeStaticConsole(req, res, pathname, consoleRoot) {
36376
36569
  }
36377
36570
  function serveFallbackIndex(req, res, consoleRoot) {
36378
36571
  try {
36379
- const data = fs11__default.readFileSync(path25__default.join(consoleRoot, "index.html"));
36572
+ const data = fs11__default.readFileSync(path26__default.join(consoleRoot, "index.html"));
36380
36573
  res.writeHead(200, withSecurityHeaders2({ "Content-Type": MIME_TYPES[".html"] }));
36381
36574
  if (req.method === "HEAD") {
36382
36575
  res.end();
@@ -36402,7 +36595,7 @@ function resolveConsolePath(pathname) {
36402
36595
  }
36403
36596
  if (withoutPrefix === "") return "index.html";
36404
36597
  if (withoutPrefix.includes("\0")) return null;
36405
- if (!path25__default.extname(withoutPrefix)) return "index.html";
36598
+ if (!path26__default.extname(withoutPrefix)) return "index.html";
36406
36599
  return withoutPrefix;
36407
36600
  }
36408
36601
  var TheaterFolderListError = class extends Error {
@@ -36436,14 +36629,14 @@ async function listTheaterFolders(requestedPath, deps = {}) {
36436
36629
  }
36437
36630
  function normalizeFolderBrowserPath(value, platform = process.platform) {
36438
36631
  if (typeof value !== "string" || value.length === 0 || value.includes("\0")) throw new TheaterFolderListError("invalid_path");
36439
- if (isWindowsAmbiguousPath(value, platform) || !path25__default.isAbsolute(value)) throw new TheaterFolderListError("invalid_path");
36440
- return path25__default.resolve(value);
36632
+ if (isWindowsAmbiguousPath(value, platform) || !path26__default.isAbsolute(value)) throw new TheaterFolderListError("invalid_path");
36633
+ return path26__default.resolve(value);
36441
36634
  }
36442
36635
  function normalizeListPath(requestedPath, platform, deps) {
36443
36636
  if (requestedPath === null || requestedPath === void 0) {
36444
36637
  const home = deps.homedir?.() ?? os3__default.homedir();
36445
36638
  const start = home || deps.cwd?.() || process.cwd();
36446
- return path25__default.resolve(start);
36639
+ return path26__default.resolve(start);
36447
36640
  }
36448
36641
  return normalizeFolderBrowserPath(requestedPath, platform);
36449
36642
  }
@@ -36494,7 +36687,7 @@ async function openDirectory(targetPath, opendir) {
36494
36687
  }
36495
36688
  async function toTheaterFolderEntry(targetPath, dirent, stat5) {
36496
36689
  if (!dirent.isDirectory() && !dirent.isSymbolicLink()) return null;
36497
- const entryPath = path25__default.join(targetPath, dirent.name);
36690
+ const entryPath = path26__default.join(targetPath, dirent.name);
36498
36691
  if (dirent.isDirectory()) return { name: dirent.name, path: entryPath, kind: "dir", accessible: true };
36499
36692
  const accessible = await statSymlinkDirectory(entryPath, stat5);
36500
36693
  if (accessible === null) return null;
@@ -36514,10 +36707,10 @@ function mapFsError(error51) {
36514
36707
  return new TheaterFolderListError("invalid_path");
36515
36708
  }
36516
36709
  function parentPath(targetPath, platform) {
36517
- const parsed = path25__default.parse(targetPath);
36518
- const resolved = path25__default.resolve(targetPath);
36519
- if (resolved === path25__default.resolve(parsed.root)) return null;
36520
- const parent = path25__default.dirname(resolved);
36710
+ const parsed = path26__default.parse(targetPath);
36711
+ const resolved = path26__default.resolve(targetPath);
36712
+ if (resolved === path26__default.resolve(parsed.root)) return null;
36713
+ const parent = path26__default.dirname(resolved);
36521
36714
  if (platform === "win32" && parent === resolved) return null;
36522
36715
  return parent;
36523
36716
  }
@@ -36557,8 +36750,8 @@ function createFolderGrantStore(deps = {}) {
36557
36750
  }
36558
36751
  function validateAbsoluteDirectory(cwd, statSync2 = fs11__default.statSync) {
36559
36752
  if (typeof cwd !== "string" || cwd.length === 0 || cwd.includes("\0")) throw new Error("invalid_folder");
36560
- if (isWindowsAmbiguousPath2(cwd) || !path25__default.isAbsolute(cwd)) throw new Error("invalid_folder");
36561
- const normalized = path25__default.resolve(cwd);
36753
+ if (isWindowsAmbiguousPath2(cwd) || !path26__default.isAbsolute(cwd)) throw new Error("invalid_folder");
36754
+ const normalized = path26__default.resolve(cwd);
36562
36755
  if (!statSync2(normalized).isDirectory()) throw new Error("invalid_folder");
36563
36756
  return normalized;
36564
36757
  }
@@ -36570,7 +36763,7 @@ var TheaterRegistry = class {
36570
36763
  #items = /* @__PURE__ */ new Map();
36571
36764
  #mruId = null;
36572
36765
  async register(cwd) {
36573
- const resolved = path25__default.resolve(cwd);
36766
+ const resolved = path26__default.resolve(cwd);
36574
36767
  const real = await canonicalizeTheaterPath(resolved);
36575
36768
  const id = workspaceHash(real);
36576
36769
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -36649,10 +36842,10 @@ function createConsoleUpdateApplyService(deps = {}) {
36649
36842
  async function start(request) {
36650
36843
  const packageManager = await preflightInstall(request.currentPackageRoot);
36651
36844
  const stamp = `${now()}-${processPid}`;
36652
- const workerPath = path25__default.join(tmpDir, `${WORKER_FILE_PREFIX}${stamp}${WORKER_FILE_SUFFIX}`);
36845
+ const workerPath = path26__default.join(tmpDir, `${WORKER_FILE_PREFIX}${stamp}${WORKER_FILE_SUFFIX}`);
36653
36846
  makeDir(request.dataDir, { recursive: true, mode: 448 });
36654
- const statusFile = path25__default.join(request.dataDir, `${WORKER_FILE_PREFIX}${stamp}${STATUS_FILE_SUFFIX}`);
36655
- const logFile = path25__default.join(request.dataDir, `${WORKER_FILE_PREFIX}${stamp}${LOG_FILE_SUFFIX}`);
36847
+ const statusFile = path26__default.join(request.dataDir, `${WORKER_FILE_PREFIX}${stamp}${STATUS_FILE_SUFFIX}`);
36848
+ const logFile = path26__default.join(request.dataDir, `${WORKER_FILE_PREFIX}${stamp}${LOG_FILE_SUFFIX}`);
36656
36849
  const script = emitConsoleUpdateWorkerScript({
36657
36850
  currentEndpoint: request.currentEndpoint,
36658
36851
  currentPackageRoot: request.currentPackageRoot,
@@ -37000,7 +37193,7 @@ function resolveDefaultServerModulePath() {
37000
37193
  if (sourcePath.endsWith(".ts")) {
37001
37194
  return sourcePath.replace(/update-apply\.ts$/, "cli.ts");
37002
37195
  }
37003
- return path25__default.join(path25__default.dirname(sourcePath), "cli.mjs");
37196
+ return path26__default.join(path26__default.dirname(sourcePath), "cli.mjs");
37004
37197
  }
37005
37198
 
37006
37199
  // core/host/update-check.ts
@@ -37280,7 +37473,7 @@ function createConsoleServer(deps = {}) {
37280
37473
  paths: {
37281
37474
  dataDir: durablePaths.dir,
37282
37475
  capturesDir: durablePaths.capturesDir,
37283
- pluginDataDir: (pluginId) => path25__default.join(durablePaths.dir, "plugins", pluginId),
37476
+ pluginDataDir: (pluginId) => path26__default.join(durablePaths.dir, "plugins", pluginId),
37284
37477
  resolveTheaterPath: (theaterId) => theaters.get(theaterId)?.path ?? null,
37285
37478
  canonicalizeTheaterPath: canonicalizeTheaterPathSync,
37286
37479
  workspaceHash
@@ -37366,6 +37559,12 @@ function createConsoleServer(deps = {}) {
37366
37559
  readJsonBody,
37367
37560
  writeJson
37368
37561
  });
37562
+ const pluginSettingsRouter = createPluginSettingsRouter({
37563
+ consoleSettingsStore,
37564
+ isAuthorized: isTerminalAuthorized,
37565
+ readJsonBody,
37566
+ writeJson
37567
+ });
37369
37568
  const operationsRouter = createOperationsRouter({
37370
37569
  store: operations,
37371
37570
  isAuthorized: isTerminalAuthorized,
@@ -37388,6 +37587,7 @@ function createConsoleServer(deps = {}) {
37388
37587
  return true;
37389
37588
  }
37390
37589
  if (await carrierSettingsRouter(ctx)) return true;
37590
+ if (await pluginSettingsRouter(ctx)) return true;
37391
37591
  return globalSettingsRouter(ctx);
37392
37592
  });
37393
37593
  routeRegistry.register("/plugin-runtime", handlePluginRuntimeRoute);
@@ -37934,11 +38134,11 @@ function createConsoleServer(deps = {}) {
37934
38134
  return returnedServer;
37935
38135
  }
37936
38136
  function resolveBuiltInPluginDiscoveryRoots(packageRoot) {
37937
- const packageRootRepo = path25__default.resolve(packageRoot, "..", "..");
37938
- const sourceRoot = path25__default.join(packageRootRepo, "runtime", "fleet-plugins");
38137
+ const packageRootRepo = path26__default.resolve(packageRoot, "..", "..");
38138
+ const sourceRoot = path26__default.join(packageRootRepo, "runtime", "fleet-plugins");
37939
38139
  return {
37940
38140
  ...fs11__default.existsSync(sourceRoot) ? { builtInSourceRoot: sourceRoot } : {},
37941
- builtInDistRoot: path25__default.join(packageRoot, "dist", "fleet-plugins")
38141
+ builtInDistRoot: path26__default.join(packageRoot, "dist", "fleet-plugins")
37942
38142
  };
37943
38143
  }
37944
38144
  function createHttpServer(handler, upgradeRegistry) {
@@ -38091,14 +38291,14 @@ async function readPluginStorageJson(dataDir, pluginId, key) {
38091
38291
  }
38092
38292
  async function writePluginStorageJson(dataDir, pluginId, key, value) {
38093
38293
  const file2 = resolvePluginStorageFile(dataDir, pluginId, key);
38094
- await fs11__default.promises.mkdir(path25__default.dirname(file2), { recursive: true });
38294
+ await fs11__default.promises.mkdir(path26__default.dirname(file2), { recursive: true });
38095
38295
  await fs11__default.promises.writeFile(file2, JSON.stringify(value), "utf8");
38096
38296
  }
38097
38297
  function resolvePluginStorageFile(dataDir, pluginId, key) {
38098
38298
  if (!/^[a-z0-9][a-z0-9._-]*$/i.test(pluginId) || !/^[a-z0-9][a-z0-9._-]*$/i.test(key)) {
38099
38299
  throw new Error("invalid_plugin_storage_key");
38100
38300
  }
38101
- return path25__default.join(dataDir, "plugins", pluginId, `${key}.json`);
38301
+ return path26__default.join(dataDir, "plugins", pluginId, `${key}.json`);
38102
38302
  }
38103
38303
  function isNodeError(error51) {
38104
38304
  return error51 instanceof Error && "code" in error51;
@@ -38422,7 +38622,7 @@ function readStdinBestEffort() {
38422
38622
  });
38423
38623
  });
38424
38624
  }
38425
- var isDirectRun = process4.argv[1] && path25__default.resolve(process4.argv[1]) === fileURLToPath(import.meta.url);
38625
+ var isDirectRun = process4.argv[1] && path26__default.resolve(process4.argv[1]) === fileURLToPath(import.meta.url);
38426
38626
  if (isDirectRun) {
38427
38627
  await main().catch((error51) => {
38428
38628
  process4.stderr.write(`${error51 instanceof Error ? error51.message : String(error51)}