@dotobokuri/fleet-console 1.50.0 → 1.51.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 (69) hide show
  1. package/dist/cli.mjs +43 -29
  2. package/dist/client/assets/{_baseUniq-CXYajthv.js → _baseUniq-DFtleNrY.js} +1 -1
  3. package/dist/client/assets/{arc-CN2U0RJi.js → arc-CZWcxz4p.js} +1 -1
  4. package/dist/client/assets/{architectureDiagram-Q4EWVU46-KMYgwTU-.js → architectureDiagram-Q4EWVU46-CoLGMUbn.js} +1 -1
  5. package/dist/client/assets/{blockDiagram-DXYQGD6D-B2n_Ujhi.js → blockDiagram-DXYQGD6D-d4tcUrvS.js} +1 -1
  6. package/dist/client/assets/{c4Diagram-AHTNJAMY-BmExz-H8.js → c4Diagram-AHTNJAMY-CcDJVtsE.js} +1 -1
  7. package/dist/client/assets/channel-BkjngaUP.js +1 -0
  8. package/dist/client/assets/{chunk-4BX2VUAB-WxXjYCDb.js → chunk-4BX2VUAB-BxQcCCSB.js} +1 -1
  9. package/dist/client/assets/{chunk-4TB4RGXK-CoSmkS4d.js → chunk-4TB4RGXK-C1iJwPC-.js} +1 -1
  10. package/dist/client/assets/{chunk-55IACEB6-BQ6DMyRz.js → chunk-55IACEB6-Du7lkUwv.js} +1 -1
  11. package/dist/client/assets/{chunk-EDXVE4YY-DEhxxADi.js → chunk-EDXVE4YY-Chblko53.js} +1 -1
  12. package/dist/client/assets/{chunk-FMBD7UC4-BUW_vTgY.js → chunk-FMBD7UC4-B4fgWiDf.js} +1 -1
  13. package/dist/client/assets/{chunk-OYMX7WX6-xqJeGGdu.js → chunk-OYMX7WX6-BXyyJDJI.js} +1 -1
  14. package/dist/client/assets/{chunk-QZHKN3VN-DPXuiqFZ.js → chunk-QZHKN3VN-BXAPpxgc.js} +1 -1
  15. package/dist/client/assets/{chunk-YZCP3GAM-CJBloo9Q.js → chunk-YZCP3GAM-BuEMjN4I.js} +1 -1
  16. package/dist/client/assets/classDiagram-6PBFFD2Q-Bcn4Byd0.js +1 -0
  17. package/dist/client/assets/classDiagram-v2-HSJHXN6E-Bcn4Byd0.js +1 -0
  18. package/dist/client/assets/clone-HJ2xLTt3.js +1 -0
  19. package/dist/client/assets/{cose-bilkent-S5V4N54A-C7eVojQK.js → cose-bilkent-S5V4N54A-Bk4ys4DX.js} +1 -1
  20. package/dist/client/assets/{dagre-KV5264BT-DYPawRSP.js → dagre-KV5264BT-8e2uOIAZ.js} +1 -1
  21. package/dist/client/assets/{diagram-5BDNPKRD-9nbdU3Kr.js → diagram-5BDNPKRD-BUaee6EH.js} +1 -1
  22. package/dist/client/assets/{diagram-G4DWMVQ6-DtSzEakz.js → diagram-G4DWMVQ6-Y0F_eev2.js} +1 -1
  23. package/dist/client/assets/{diagram-MMDJMWI5-2FX1CuCi.js → diagram-MMDJMWI5-DeqlMgQv.js} +1 -1
  24. package/dist/client/assets/{diagram-TYMM5635-D1aBD1Sv.js → diagram-TYMM5635-DqtnAuqr.js} +1 -1
  25. package/dist/client/assets/{erDiagram-SMLLAGMA-AK79bFYW.js → erDiagram-SMLLAGMA-BBGN7fOL.js} +1 -1
  26. package/dist/client/assets/{flowDiagram-DWJPFMVM-C1ApmkLT.js → flowDiagram-DWJPFMVM-C0WwXtcb.js} +1 -1
  27. package/dist/client/assets/{ganttDiagram-T4ZO3ILL-CQvFUGlj.js → ganttDiagram-T4ZO3ILL-D00_-gLK.js} +1 -1
  28. package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-C-Vh-bKl.js → gitGraphDiagram-UUTBAWPF-D9-J9LVn.js} +1 -1
  29. package/dist/client/assets/{graph-DeEdzsTp.js → graph-DbpxB806.js} +1 -1
  30. package/dist/client/assets/index-BhOzl99v.css +1 -0
  31. package/dist/client/assets/index-Bnx3O7Op.js +482 -0
  32. package/dist/client/assets/{infoDiagram-42DDH7IO-B_0wD24T.js → infoDiagram-42DDH7IO-CoV_lg2_.js} +1 -1
  33. package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-DgGbx2eb.js → ishikawaDiagram-UXIWVN3A-DV9-YHTX.js} +1 -1
  34. package/dist/client/assets/{journeyDiagram-VCZTEJTY-BdQqxMsJ.js → journeyDiagram-VCZTEJTY-CFY3HNeL.js} +1 -1
  35. package/dist/client/assets/{kanban-definition-6JOO6SKY-DU8AwVYp.js → kanban-definition-6JOO6SKY-BsN5X8OC.js} +1 -1
  36. package/dist/client/assets/{layout-BF-OB3sH.js → layout-EvZfc466.js} +1 -1
  37. package/dist/client/assets/{linear-Cd22n3Ol.js → linear-ConFN_kQ.js} +1 -1
  38. package/dist/client/assets/{mermaid.core-CV1wZraa.js → mermaid.core-q1Rp6XrX.js} +4 -4
  39. package/dist/client/assets/{min-Avezts6s.js → min-CgGOD4w3.js} +1 -1
  40. package/dist/client/assets/{mindmap-definition-QFDTVHPH-BiYy2OKo.js → mindmap-definition-QFDTVHPH-CLvM_zrO.js} +1 -1
  41. package/dist/client/assets/{pieDiagram-DEJITSTG-Bg9O56EU.js → pieDiagram-DEJITSTG-Bw7QTbiY.js} +1 -1
  42. package/dist/client/assets/{quadrantDiagram-34T5L4WZ-B9NeeqFq.js → quadrantDiagram-34T5L4WZ-CJZW6aCq.js} +1 -1
  43. package/dist/client/assets/{requirementDiagram-MS252O5E-DV1FugSk.js → requirementDiagram-MS252O5E-CMUb9ODK.js} +1 -1
  44. package/dist/client/assets/{sankeyDiagram-XADWPNL6-BvIHcJf7.js → sankeyDiagram-XADWPNL6-DnjQJPPQ.js} +1 -1
  45. package/dist/client/assets/{sequenceDiagram-FGHM5R23-BCQ2xDy1.js → sequenceDiagram-FGHM5R23-BQLWPMCP.js} +1 -1
  46. package/dist/client/assets/{stateDiagram-FHFEXIEX-BpK4LvW_.js → stateDiagram-FHFEXIEX-CYUxN4zL.js} +1 -1
  47. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-BqJUiDHN.js +1 -0
  48. package/dist/client/assets/{timeline-definition-GMOUNBTQ-BEwHf_wL.js → timeline-definition-GMOUNBTQ-DakKVVdc.js} +1 -1
  49. package/dist/client/assets/{vennDiagram-DHZGUBPP-Cd0iA5Vu.js → vennDiagram-DHZGUBPP-CjJALOSl.js} +1 -1
  50. package/dist/client/assets/{wardley-RL74JXVD-cubfgt6B.js → wardley-RL74JXVD-DNN6iyI_.js} +1 -1
  51. package/dist/client/assets/{wardleyDiagram-NUSXRM2D-DTdlOJlu.js → wardleyDiagram-NUSXRM2D-CuoFFC8W.js} +1 -1
  52. package/dist/client/assets/{xychartDiagram-5P7HB3ND-BguY4oGj.js → xychartDiagram-5P7HB3ND-CLeb77Ra.js} +1 -1
  53. package/dist/client/index.html +2 -2
  54. package/dist/desktop-protocol.mjs +3 -3
  55. package/dist/fleet-plugins/file-explorer/routes.mjs +4 -4
  56. package/dist/fleet-plugins/ledger/routes.mjs +48 -50
  57. package/dist/fleet-plugins/quota/routes.mjs +2601 -2477
  58. package/dist/fleet-plugins/repository/routes.mjs +44 -43
  59. package/dist/fleet-plugins/scuttlebutt/routes.mjs +9 -8
  60. package/dist/fleet-plugins/skills/routes.mjs +44 -45
  61. package/dist/fleet-plugins/terminal/routes.mjs +6510 -5663
  62. package/package.json +1 -1
  63. package/dist/client/assets/channel-7u-T-USm.js +0 -1
  64. package/dist/client/assets/classDiagram-6PBFFD2Q-CdK4kqo5.js +0 -1
  65. package/dist/client/assets/classDiagram-v2-HSJHXN6E-CdK4kqo5.js +0 -1
  66. package/dist/client/assets/clone-BJX0Y00S.js +0 -1
  67. package/dist/client/assets/index-PYKMOCH4.css +0 -1
  68. package/dist/client/assets/index-rFuEoKaA.js +0 -482
  69. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-CEPxcteM.js +0 -1
@@ -1,20 +1,21 @@
1
1
  #!/usr/bin/env node
2
- import { spawn } from 'child_process';
3
- import 'fs';
4
- import path4 from 'path';
5
- import fs2 from 'fs/promises';
2
+ import { spawn } from 'node:child_process';
3
+ import fs2 from 'node:fs/promises';
4
+ import path3 from 'node:path';
6
5
 
7
6
  // sdk/plugin/node.ts
8
7
  function definePlugin(definition) {
9
8
  return definition;
10
9
  }
11
- function registerRouter(ctx, path10, handler) {
12
- ctx.registerRouter(normalizePath(path10), handler);
10
+ function registerRouter(ctx, path9, handler) {
11
+ ctx.registerRouter(normalizePath(path9), handler);
13
12
  }
14
- function normalizePath(path10) {
15
- if (path10.length === 0 || path10 === "/") return "/";
16
- return path10;
13
+ function normalizePath(path9) {
14
+ if (path9.length === 0 || path9 === "/") return "/";
15
+ return path9;
17
16
  }
17
+
18
+ // ../../packages/core-process/src/bin-resolver.ts
18
19
  function withHidden(options) {
19
20
  return { ...options ?? {}, windowsHide: true };
20
21
  }
@@ -139,20 +140,20 @@ function runGit(args, opts) {
139
140
  });
140
141
  }
141
142
  function isPathContained(root, candidate) {
142
- const relative = path4.relative(root, candidate);
143
- return relative === "" || !path4.isAbsolute(relative) && relative !== ".." && !relative.startsWith(`..${path4.sep}`);
143
+ const relative = path3.relative(root, candidate);
144
+ return relative === "" || !path3.isAbsolute(relative) && relative !== ".." && !relative.startsWith(`..${path3.sep}`);
144
145
  }
145
146
  function isSelectableRepoRel(repoRel) {
146
147
  if (repoRel === "") return true;
147
- if (path4.isAbsolute(repoRel)) return false;
148
- const normalized = path4.normalize(repoRel);
149
- return !normalized.startsWith("-") && normalized !== ".." && !normalized.startsWith(`..${path4.sep}`);
148
+ if (path3.isAbsolute(repoRel)) return false;
149
+ const normalized = path3.normalize(repoRel);
150
+ return !normalized.startsWith("-") && normalized !== ".." && !normalized.startsWith(`..${path3.sep}`);
150
151
  }
151
152
 
152
153
  // ../fleet-plugins/repository/server/git-marker.ts
153
154
  var GITDIR_PREFIX = "gitdir:";
154
155
  async function resolveContainedGitDir(repoDir, realTheaterPath) {
155
- const markerPath = path4.join(repoDir, ".git");
156
+ const markerPath = path3.join(repoDir, ".git");
156
157
  let marker;
157
158
  try {
158
159
  marker = await fs2.stat(markerPath);
@@ -171,7 +172,7 @@ async function resolveContainedGitDir(repoDir, realTheaterPath) {
171
172
  if (!line) return null;
172
173
  const target = line.trim().slice(GITDIR_PREFIX.length).trim();
173
174
  if (!target) return null;
174
- gitDir = path4.resolve(repoDir, target);
175
+ gitDir = path3.resolve(repoDir, target);
175
176
  } else if (marker.isDirectory()) {
176
177
  gitDir = markerPath;
177
178
  } else {
@@ -186,7 +187,7 @@ async function resolveContainedGitDir(repoDir, realTheaterPath) {
186
187
  if (!isPathContained(realTheaterPath, realGitDir)) return null;
187
188
  let commonRaw = null;
188
189
  try {
189
- commonRaw = await fs2.readFile(path4.join(realGitDir, "commondir"), "utf8");
190
+ commonRaw = await fs2.readFile(path3.join(realGitDir, "commondir"), "utf8");
190
191
  } catch {
191
192
  }
192
193
  if (commonRaw !== null) {
@@ -194,7 +195,7 @@ async function resolveContainedGitDir(repoDir, realTheaterPath) {
194
195
  if (!commonTarget) return null;
195
196
  let realCommonDir;
196
197
  try {
197
- realCommonDir = await fs2.realpath(path4.resolve(realGitDir, commonTarget));
198
+ realCommonDir = await fs2.realpath(path3.resolve(realGitDir, commonTarget));
198
199
  } catch {
199
200
  return null;
200
201
  }
@@ -266,9 +267,9 @@ var InvalidRepoError = class extends Error {
266
267
  };
267
268
  async function resolveGitCwd(theaterPath, repoRel = "") {
268
269
  if (repoRel === void 0 || repoRel === "") return { gitCwd: theaterPath };
269
- if (typeof repoRel !== "string" || path4.isAbsolute(repoRel)) throw new InvalidRepoError("Repository path must be relative");
270
+ if (typeof repoRel !== "string" || path3.isAbsolute(repoRel)) throw new InvalidRepoError("Repository path must be relative");
270
271
  if (!isSelectableRepoRel(repoRel)) throw new InvalidRepoError("Repository path is invalid");
271
- const resolved = path4.resolve(theaterPath, path4.normalize(repoRel));
272
+ const resolved = path3.resolve(theaterPath, path3.normalize(repoRel));
272
273
  if (!isPathContained(theaterPath, resolved)) throw new InvalidRepoError("Repository path escapes Theater");
273
274
  let realTheater;
274
275
  let realRepo;
@@ -399,12 +400,12 @@ async function handleRepositoryFile(req, res, ctx) {
399
400
  }
400
401
  const { gitCwd } = cwdResult;
401
402
  const rawFilePath = body.filePath;
402
- const resolvedFilePath = path4.resolve(gitCwd, rawFilePath);
403
- if (!resolvedFilePath.startsWith(gitCwd + path4.sep) && resolvedFilePath !== gitCwd) {
403
+ const resolvedFilePath = path3.resolve(gitCwd, rawFilePath);
404
+ if (!resolvedFilePath.startsWith(gitCwd + path3.sep) && resolvedFilePath !== gitCwd) {
404
405
  ctx.host.http.writeJson(res, 403, { error: "path_outside_theater" });
405
406
  return;
406
407
  }
407
- const relativePath = path4.normalize(rawFilePath);
408
+ const relativePath = path3.normalize(rawFilePath);
408
409
  if (relativePath.startsWith("..")) {
409
410
  ctx.host.http.writeJson(res, 403, { error: "path_outside_theater" });
410
411
  return;
@@ -422,7 +423,7 @@ async function handleRepositoryFile(req, res, ctx) {
422
423
  ctx.host.http.writeJson(res, 404, { error: "file_not_found" });
423
424
  return;
424
425
  }
425
- if (realFile !== realGitCwd && !realFile.startsWith(realGitCwd + path4.sep)) {
426
+ if (realFile !== realGitCwd && !realFile.startsWith(realGitCwd + path3.sep)) {
426
427
  ctx.host.http.writeJson(res, 403, { error: "path_outside_theater" });
427
428
  return;
428
429
  }
@@ -438,7 +439,7 @@ async function handleRepositoryFile(req, res, ctx) {
438
439
  fs2.realpath(gitCwd),
439
440
  fs2.realpath(resolvedFilePath)
440
441
  ]);
441
- if (realFile !== realGitCwd && !realFile.startsWith(realGitCwd + path4.sep)) {
442
+ if (realFile !== realGitCwd && !realFile.startsWith(realGitCwd + path3.sep)) {
442
443
  ctx.host.http.writeJson(res, 403, { error: "path_outside_theater" });
443
444
  return;
444
445
  }
@@ -558,9 +559,9 @@ function isPlainObject3(value) {
558
559
  return typeof value === "object" && value !== null && !Array.isArray(value);
559
560
  }
560
561
  function resolveLiteralFilePath(gitCwd, rawPath) {
561
- const relativePath = path4.normalize(rawPath);
562
- const resolved = path4.resolve(gitCwd, relativePath);
563
- if (relativePath === ".." || relativePath.startsWith(".." + path4.sep) || !resolved.startsWith(gitCwd + path4.sep)) return null;
562
+ const relativePath = path3.normalize(rawPath);
563
+ const resolved = path3.resolve(gitCwd, relativePath);
564
+ if (relativePath === ".." || relativePath.startsWith(".." + path3.sep) || !resolved.startsWith(gitCwd + path3.sep)) return null;
564
565
  return relativePath;
565
566
  }
566
567
  function literalPathspec2(relativePath) {
@@ -746,9 +747,9 @@ function isPlainObject5(value) {
746
747
  return typeof value === "object" && value !== null && !Array.isArray(value);
747
748
  }
748
749
  function resolveLiteralFilePath2(gitCwd, rawPath) {
749
- const relativePath = path4.normalize(rawPath);
750
- const resolved = path4.resolve(gitCwd, relativePath);
751
- if (relativePath === ".." || relativePath.startsWith(".." + path4.sep) || !resolved.startsWith(gitCwd + path4.sep)) return null;
750
+ const relativePath = path3.normalize(rawPath);
751
+ const resolved = path3.resolve(gitCwd, relativePath);
752
+ if (relativePath === ".." || relativePath.startsWith(".." + path3.sep) || !resolved.startsWith(gitCwd + path3.sep)) return null;
752
753
  return relativePath;
753
754
  }
754
755
  function literalPathspec3(relativePath) {
@@ -849,8 +850,8 @@ async function resolveGitIdentity(gitCwd) {
849
850
  runGit(["rev-parse", "--git-common-dir"], { cwd: gitCwd })
850
851
  ]);
851
852
  const [gitDir, commonDir] = await Promise.all([
852
- fs2.realpath(path4.resolve(gitCwd, gitDirResult.stdout.trim())),
853
- fs2.realpath(path4.resolve(gitCwd, commonDirResult.stdout.trim()))
853
+ fs2.realpath(path3.resolve(gitCwd, gitDirResult.stdout.trim())),
854
+ fs2.realpath(path3.resolve(gitCwd, commonDirResult.stdout.trim()))
854
855
  ]);
855
856
  return { gitDir, commonDir };
856
857
  }
@@ -858,7 +859,7 @@ async function readLastFetchAt(gitDirs) {
858
859
  let newest = null;
859
860
  for (const gitDir of gitDirs) {
860
861
  try {
861
- const stats = await fs2.stat(path4.join(gitDir, "FETCH_HEAD"));
862
+ const stats = await fs2.stat(path3.join(gitDir, "FETCH_HEAD"));
862
863
  if (stats.size === 0) continue;
863
864
  if (!newest || stats.mtime.getTime() > newest.getTime()) newest = stats.mtime;
864
865
  } catch (error) {
@@ -959,9 +960,9 @@ async function fetchRepository(gitCwd) {
959
960
  async function fetchHeadCandidates(identity) {
960
961
  const candidates = /* @__PURE__ */ new Set([identity.gitDir, identity.commonDir]);
961
962
  try {
962
- const worktreesDir = path4.join(identity.commonDir, "worktrees");
963
+ const worktreesDir = path3.join(identity.commonDir, "worktrees");
963
964
  for (const entry of await fs2.readdir(worktreesDir, { withFileTypes: true })) {
964
- if (entry.isDirectory()) candidates.add(path4.join(worktreesDir, entry.name));
965
+ if (entry.isDirectory()) candidates.add(path3.join(worktreesDir, entry.name));
965
966
  }
966
967
  } catch (error) {
967
968
  if (error.code !== "ENOENT") throw error;
@@ -1377,18 +1378,18 @@ async function scanRepos(theaterPath, realTheaterPath, dir, currentDepth, maxDep
1377
1378
  if (repos.length >= cap) return true;
1378
1379
  if (visits.remaining <= 0) return true;
1379
1380
  visits.remaining -= 1;
1380
- const relPath = path4.relative(realTheaterPath, dir);
1381
+ const relPath = path3.relative(realTheaterPath, dir);
1381
1382
  const gitDir = isSelectableRepoRel(relPath) ? await resolveContainedGitDir(dir, realTheaterPath) : null;
1382
1383
  let linkedWorktree = false;
1383
1384
  if (gitDir !== null) {
1384
1385
  try {
1385
- await fs2.access(path4.join(gitDir, "commondir"));
1386
+ await fs2.access(path3.join(gitDir, "commondir"));
1386
1387
  linkedWorktree = true;
1387
1388
  } catch {
1388
1389
  }
1389
1390
  }
1390
1391
  if (gitDir !== null && !linkedWorktree) {
1391
- repos.push({ relPath, name: relPath === "" ? path4.basename(realTheaterPath) : path4.basename(dir), repoDir: dir });
1392
+ repos.push({ relPath, name: relPath === "" ? path3.basename(realTheaterPath) : path3.basename(dir), repoDir: dir });
1392
1393
  if (repos.length >= cap) return true;
1393
1394
  }
1394
1395
  if (currentDepth >= maxDepth) return false;
@@ -1399,7 +1400,7 @@ async function scanRepos(theaterPath, realTheaterPath, dir, currentDepth, maxDep
1399
1400
  while (dirent !== null) {
1400
1401
  if (repos.length >= cap || visits.remaining <= 0) return true;
1401
1402
  if (dirent.isDirectory() && dirent.name !== "node_modules" && dirent.name !== ".git") {
1402
- const childPath = path4.join(dir, dirent.name);
1403
+ const childPath = path3.join(dir, dirent.name);
1403
1404
  let realChildPath;
1404
1405
  try {
1405
1406
  realChildPath = await fs2.realpath(childPath);
@@ -1478,7 +1479,7 @@ async function handleRepositoryRepos(req, res, ctx) {
1478
1479
  }
1479
1480
  }
1480
1481
  if (rootIsRepo) {
1481
- repos.push({ relPath: "", name: path4.basename(theaterPath), branch: await resolveRepoBranch(theaterPath), kind: "root" });
1482
+ repos.push({ relPath: "", name: path3.basename(theaterPath), branch: await resolveRepoBranch(theaterPath), kind: "root" });
1482
1483
  seen.add("");
1483
1484
  }
1484
1485
  const scanned = [];
@@ -1637,12 +1638,12 @@ async function handleRepositoryWorktrees(req, res, ctx) {
1637
1638
  continue;
1638
1639
  }
1639
1640
  if (!isPathContained(realTheaterPath, realWorktree)) continue;
1640
- const relPath = path4.relative(realTheaterPath, realWorktree);
1641
+ const relPath = path3.relative(realTheaterPath, realWorktree);
1641
1642
  if (!isSelectableRepoRel(relPath) || seen.has(relPath)) continue;
1642
1643
  if (await resolveContainedGitDir(realWorktree, realTheaterPath) === null) continue;
1643
1644
  worktrees.push({
1644
1645
  relPath,
1645
- name: path4.basename(realWorktree),
1646
+ name: path3.basename(realWorktree),
1646
1647
  branch: worktree.branch ?? worktree.sha.slice(0, 7),
1647
1648
  current: realWorktree === realGitCwd
1648
1649
  });
@@ -1,13 +1,14 @@
1
1
  #!/usr/bin/env node
2
- import * as fs from 'fs';
3
- import { promises, existsSync, accessSync, constants } from 'fs';
4
- import * as path from 'path';
5
- import path__default, { dirname } from 'path';
6
- import crypto from 'crypto';
7
- import fs2, { mkdir, writeFile, access, readFile } from 'fs/promises';
2
+ import * as fs from 'node:fs';
3
+ import { promises, existsSync, accessSync, constants } from 'node:fs';
4
+ import * as path from 'node:path';
5
+ import path__default, { dirname } from 'node:path';
6
+ import crypto from 'node:crypto';
7
+ import fs2, { mkdir, writeFile, access, readFile } from 'node:fs/promises';
8
8
  import { EventEmitter } from 'events';
9
- import { execFile, spawn, execSync } from 'child_process';
10
- import { Writable, Readable } from 'stream';
9
+ import { spawn } from 'node:child_process';
10
+ import { Writable, Readable } from 'node:stream';
11
+ import { execFile, execSync } from 'child_process';
11
12
 
12
13
  var __defProp = Object.defineProperty;
13
14
  var __export = (target, all) => {
@@ -1,12 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import path from 'path';
3
- import { execFile } from 'child_process';
4
- import fs4 from 'fs/promises';
5
- import os2 from 'os';
6
- import crypto4 from 'crypto';
7
- import 'http';
8
- import 'stream';
9
- import { existsSync, accessSync, constants } from 'fs';
2
+ import path from 'node:path';
3
+ import { execFile } from 'node:child_process';
4
+ import fs3 from 'node:fs/promises';
5
+ import os2 from 'node:os';
6
+ import 'node:http';
7
+ import { existsSync, accessSync, constants } from 'node:fs';
8
+ import crypto from 'node:crypto';
10
9
 
11
10
  var __defProp = Object.defineProperty;
12
11
  var __export = (target, all) => {
@@ -18,12 +17,12 @@ var __export = (target, all) => {
18
17
  function definePlugin(definition) {
19
18
  return definition;
20
19
  }
21
- function registerRouter(ctx, path8, handler) {
22
- ctx.registerRouter(normalizePath(path8), handler);
20
+ function registerRouter(ctx, path6, handler) {
21
+ ctx.registerRouter(normalizePath(path6), handler);
23
22
  }
24
- function normalizePath(path8) {
25
- if (path8.length === 0 || path8 === "/") return "/";
26
- return path8;
23
+ function normalizePath(path6) {
24
+ if (path6.length === 0 || path6 === "/") return "/";
25
+ return path6;
27
26
  }
28
27
 
29
28
  // ../../node_modules/.pnpm/@agentclientprotocol+sdk@1.2.1_zod@4.4.1/node_modules/@agentclientprotocol/sdk/dist/schema/index.js
@@ -832,10 +831,10 @@ function mergeDefs(...defs) {
832
831
  function cloneDef(schema) {
833
832
  return mergeDefs(schema._zod.def);
834
833
  }
835
- function getElementAtPath(obj, path8) {
836
- if (!path8)
834
+ function getElementAtPath(obj, path6) {
835
+ if (!path6)
837
836
  return obj;
838
- return path8.reduce((acc, key) => acc?.[key], obj);
837
+ return path6.reduce((acc, key) => acc?.[key], obj);
839
838
  }
840
839
  function promiseAllObject(promisesObj) {
841
840
  const keys = Object.keys(promisesObj);
@@ -1244,11 +1243,11 @@ function explicitlyAborted(x, startIndex = 0) {
1244
1243
  }
1245
1244
  return false;
1246
1245
  }
1247
- function prefixIssues(path8, issues) {
1246
+ function prefixIssues(path6, issues) {
1248
1247
  return issues.map((iss) => {
1249
1248
  var _a3;
1250
1249
  (_a3 = iss).path ?? (_a3.path = []);
1251
- iss.path.unshift(path8);
1250
+ iss.path.unshift(path6);
1252
1251
  return iss;
1253
1252
  });
1254
1253
  }
@@ -1395,16 +1394,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
1395
1394
  }
1396
1395
  function formatError(error51, mapper = (issue2) => issue2.message) {
1397
1396
  const fieldErrors = { _errors: [] };
1398
- const processError = (error52, path8 = []) => {
1397
+ const processError = (error52, path6 = []) => {
1399
1398
  for (const issue2 of error52.issues) {
1400
1399
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1401
- issue2.errors.map((issues) => processError({ issues }, [...path8, ...issue2.path]));
1400
+ issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
1402
1401
  } else if (issue2.code === "invalid_key") {
1403
- processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1402
+ processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
1404
1403
  } else if (issue2.code === "invalid_element") {
1405
- processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1404
+ processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
1406
1405
  } else {
1407
- const fullpath = [...path8, ...issue2.path];
1406
+ const fullpath = [...path6, ...issue2.path];
1408
1407
  if (fullpath.length === 0) {
1409
1408
  fieldErrors._errors.push(mapper(issue2));
1410
1409
  } else {
@@ -1431,17 +1430,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
1431
1430
  }
1432
1431
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
1433
1432
  const result = { errors: [] };
1434
- const processError = (error52, path8 = []) => {
1433
+ const processError = (error52, path6 = []) => {
1435
1434
  var _a3, _b;
1436
1435
  for (const issue2 of error52.issues) {
1437
1436
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1438
- issue2.errors.map((issues) => processError({ issues }, [...path8, ...issue2.path]));
1437
+ issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
1439
1438
  } else if (issue2.code === "invalid_key") {
1440
- processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1439
+ processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
1441
1440
  } else if (issue2.code === "invalid_element") {
1442
- processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1441
+ processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
1443
1442
  } else {
1444
- const fullpath = [...path8, ...issue2.path];
1443
+ const fullpath = [...path6, ...issue2.path];
1445
1444
  if (fullpath.length === 0) {
1446
1445
  result.errors.push(mapper(issue2));
1447
1446
  continue;
@@ -1473,8 +1472,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
1473
1472
  }
1474
1473
  function toDotPath(_path) {
1475
1474
  const segs = [];
1476
- const path8 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1477
- for (const seg of path8) {
1475
+ const path6 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1476
+ for (const seg of path6) {
1478
1477
  if (typeof seg === "number")
1479
1478
  segs.push(`[${seg}]`);
1480
1479
  else if (typeof seg === "symbol")
@@ -14138,13 +14137,13 @@ function resolveRef(ref, ctx) {
14138
14137
  if (!ref.startsWith("#")) {
14139
14138
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
14140
14139
  }
14141
- const path8 = ref.slice(1).split("/").filter(Boolean);
14142
- if (path8.length === 0) {
14140
+ const path6 = ref.slice(1).split("/").filter(Boolean);
14141
+ if (path6.length === 0) {
14143
14142
  return ctx.rootSchema;
14144
14143
  }
14145
14144
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
14146
- if (path8[0] === defsKey) {
14147
- const key = path8[1];
14145
+ if (path6[0] === defsKey) {
14146
+ const key = path6[1];
14148
14147
  if (!key || !ctx.defs[key]) {
14149
14148
  throw new Error(`Reference not found: ${ref}`);
14150
14149
  }
@@ -16605,14 +16604,14 @@ async function ensureCliMjs(cliHome, onBootstrap) {
16605
16604
  const pkgPath = path.join(cliHome, "node_modules", SKILLS_PACKAGE, "package.json");
16606
16605
  let needsInstall = true;
16607
16606
  try {
16608
- const raw = await fs4.readFile(pkgPath, "utf-8");
16607
+ const raw = await fs3.readFile(pkgPath, "utf-8");
16609
16608
  const pkg = JSON.parse(raw);
16610
16609
  if (pkg.version === SKILLS_VERSION) needsInstall = false;
16611
16610
  } catch {
16612
16611
  }
16613
16612
  if (needsInstall) {
16614
16613
  onBootstrap?.(WARMUP_LINE);
16615
- await fs4.mkdir(cliHome, { recursive: true });
16614
+ await fs3.mkdir(cliHome, { recursive: true });
16616
16615
  await runNpmInstall(cliHome);
16617
16616
  }
16618
16617
  _cliMjsPath = mjsPath;
@@ -16679,7 +16678,7 @@ function createJob(scope, theaterId) {
16679
16678
  sweep();
16680
16679
  const key = makeKey(scope, theaterId);
16681
16680
  if (activeKeys.has(key)) return null;
16682
- const id = crypto4.randomUUID();
16681
+ const id = crypto.randomUUID();
16683
16682
  jobs.set(id, {
16684
16683
  lines: [],
16685
16684
  status: "running",
@@ -16749,12 +16748,12 @@ async function resolveProjectCwd(theaterRoot) {
16749
16748
  const lexicalRoot = path.resolve(theaterRoot);
16750
16749
  let realRoot;
16751
16750
  try {
16752
- realRoot = await fs4.realpath(lexicalRoot);
16751
+ realRoot = await fs3.realpath(lexicalRoot);
16753
16752
  } catch (error51) {
16754
16753
  throw mapFilesystemError(error51);
16755
16754
  }
16756
16755
  try {
16757
- if (!(await fs4.stat(realRoot)).isDirectory()) {
16756
+ if (!(await fs3.stat(realRoot)).isDirectory()) {
16758
16757
  throw new ProjectPathError("invalid_path");
16759
16758
  }
16760
16759
  } catch (error51) {
@@ -16849,7 +16848,7 @@ var installedSkillsByTheater = /* @__PURE__ */ new Map();
16849
16848
  async function readSkillSources(cwd) {
16850
16849
  const sources = /* @__PURE__ */ new Map();
16851
16850
  try {
16852
- const raw = await fs4.readFile(path.join(cwd, "skills-lock.json"), "utf-8");
16851
+ const raw = await fs3.readFile(path.join(cwd, "skills-lock.json"), "utf-8");
16853
16852
  const parsed = JSON.parse(raw);
16854
16853
  if (typeof parsed === "object" && parsed !== null) {
16855
16854
  for (const [name, entry] of Object.entries(parsed)) {
@@ -16860,7 +16859,7 @@ async function readSkillSources(cwd) {
16860
16859
  } catch {
16861
16860
  }
16862
16861
  try {
16863
- const raw = await fs4.readFile(path.join(cwd, ".agents", ".skill-lock.json"), "utf-8");
16862
+ const raw = await fs3.readFile(path.join(cwd, ".agents", ".skill-lock.json"), "utf-8");
16864
16863
  const parsed = JSON.parse(raw);
16865
16864
  if (typeof parsed === "object" && parsed !== null) {
16866
16865
  for (const [name, entry] of Object.entries(parsed)) {
@@ -17344,9 +17343,9 @@ async function handleInstalledFile(req, res, ctx, executor) {
17344
17343
  // CLI가 보고한 skillRoot 자체도 신뢰하지 않는다 — scope의 정당한 상위 경계
17345
17344
  // (project=theater 루트, global=홈)를 벗어나면 읽지 않는다. `.agents/skills`로
17346
17345
  // 고정하지 않는 이유: claude 단독 설치는 `.claude/skills` 아래에 놓인다.
17347
- fs4.realpath(cwd),
17348
- fs4.realpath(skillRoot),
17349
- fs4.realpath(skillMdPath).catch(() => null)
17346
+ fs3.realpath(cwd),
17347
+ fs3.realpath(skillRoot),
17348
+ fs3.realpath(skillMdPath).catch(() => null)
17350
17349
  ]);
17351
17350
  if (!realMd) {
17352
17351
  ctx.host.http.writeJson(res, 404, { error: "skill_not_found" });
@@ -17360,7 +17359,7 @@ async function handleInstalledFile(req, res, ctx, executor) {
17360
17359
  ctx.host.http.writeJson(res, 403, { error: "path_outside_theater" });
17361
17360
  return;
17362
17361
  }
17363
- const markdown = await fs4.readFile(realMd, "utf-8");
17362
+ const markdown = await fs3.readFile(realMd, "utf-8");
17364
17363
  ctx.host.http.writeJson(res, 200, { markdown });
17365
17364
  } catch {
17366
17365
  ctx.host.http.writeJson(res, 502, { error: "read_failed" });