@repo-os/repoos 0.5.95 → 0.5.96

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 (97) hide show
  1. package/README.md +3 -3
  2. package/dist/.build-info.json +2 -2
  3. package/dist/.build-stamp.json +1 -1
  4. package/dist/cli/help.js +4 -1
  5. package/dist/commands/servers.d.ts +4 -0
  6. package/dist/commands/servers.js +34 -3
  7. package/dist/commands/upgrade.d.ts +5 -0
  8. package/dist/commands/upgrade.js +49 -13
  9. package/dist/core/tailnet-servers.d.ts +4 -2
  10. package/dist/core/tailnet-servers.js +7 -4
  11. package/dist/server/routes/servers.d.ts +2 -0
  12. package/dist/server/routes/servers.js +34 -3
  13. package/dist/server/server.js +5 -3
  14. package/dist/ui/assets/{ChecksView-BhIXC45z.js → ChecksView-CULwA_TL.js} +0 -0
  15. package/dist/ui/assets/{ContextView-CNCxybL_.js → ContextView-DqBHoosr.js} +2 -2
  16. package/dist/ui/assets/{DashboardView-DlIGbJ3n.js → DashboardView-BTdy_ySp.js} +1 -1
  17. package/dist/ui/assets/{DependencyChip-C0Vx0pXo.js → DependencyChip-C5VNY7gl.js} +1 -1
  18. package/dist/ui/assets/{DeploymentsView-Ds-pLQ08.js → DeploymentsView-BDfarOn-.js} +1 -1
  19. package/dist/ui/assets/{DevView-DazKc5XZ.js → DevView-ntdUzHkE.js} +1 -1
  20. package/dist/ui/assets/{DiffView-J0o7NRq_.js → DiffView-Cf2p3rFC.js} +1 -1
  21. package/dist/ui/assets/{InputsView-OoTYW1KQ.js → InputsView-D255PNzL.js} +1 -1
  22. package/dist/ui/assets/{LoginView-Slf4kTEd.js → LoginView-S0jogm1Y.js} +1 -1
  23. package/dist/ui/assets/{ReleasesView-C88j24ds.js → ReleasesView-D6lg-AWs.js} +1 -1
  24. package/dist/ui/assets/{SecretsView-CeQPCNS_.js → SecretsView-DOQmVf4V.js} +1 -1
  25. package/dist/ui/assets/{SettingsView-BC7-g8QG.js → SettingsView-BjHI0gdq.js} +2 -2
  26. package/dist/ui/assets/{StoriesView-sHbi4VGc.js → StoriesView-2kWYWs5P.js} +1 -1
  27. package/dist/ui/assets/{WorkView-DMTmK-Se.js → WorkView-CGtQZOnz.js} +1 -1
  28. package/dist/ui/assets/{abnfDiagram-VCTEODGH-d-MVY_Ya.js → abnfDiagram-VCTEODGH-D2A7SHug.js} +1 -1
  29. package/dist/ui/assets/{architectureDiagram-5GKGNRK7-CnWWiGwO.js → architectureDiagram-5GKGNRK7-Cou8SIPE.js} +1 -1
  30. package/dist/ui/assets/{blockDiagram-I7D4REHJ-Bcg-XeCf.js → blockDiagram-I7D4REHJ-SXNhhko2.js} +1 -1
  31. package/dist/ui/assets/{c4Diagram-7LVT6UL2-DPUc--cN.js → c4Diagram-7LVT6UL2-B-tpBfOx.js} +1 -1
  32. package/dist/ui/assets/channel-BEgkbNvj.js +1 -0
  33. package/dist/ui/assets/{chunk-2E4U76K2-BmfJHEYb.js → chunk-2E4U76K2-lmPqZMXN.js} +1 -1
  34. package/dist/ui/assets/{chunk-4HAMMTFA-nV5dBuKR.js → chunk-4HAMMTFA-C0tgf_1t.js} +1 -1
  35. package/dist/ui/assets/{chunk-75Z2AOVW-Bv79iNlv.js → chunk-75Z2AOVW-bSsW-KGE.js} +1 -1
  36. package/dist/ui/assets/{chunk-CLGD4ZFX-DYP6FTQd.js → chunk-CLGD4ZFX-VoCTMgMr.js} +1 -1
  37. package/dist/ui/assets/{chunk-DU6HZSFF-B6KGKg64.js → chunk-DU6HZSFF-DIqGroIg.js} +1 -1
  38. package/dist/ui/assets/{chunk-F27PBJKO-BrNr5GgL.js → chunk-F27PBJKO-DvA7R4Rh.js} +1 -1
  39. package/dist/ui/assets/{chunk-GMAD6QVW-BFea9tAC.js → chunk-GMAD6QVW-DEJGSb2v.js} +1 -1
  40. package/dist/ui/assets/{chunk-GVQU2GXP-4LrBgq22.js → chunk-GVQU2GXP-CazbgFu6.js} +1 -1
  41. package/dist/ui/assets/{chunk-IMKFNOWR--S7Q99JN.js → chunk-IMKFNOWR-DUtbLTE_.js} +1 -1
  42. package/dist/ui/assets/{chunk-L3NEJ4N5-DgyS4KZW.js → chunk-L3NEJ4N5-BVAy2-6E.js} +1 -1
  43. package/dist/ui/assets/{chunk-OSK3NFVY-CRSgeovc.js → chunk-OSK3NFVY-DqV-eD0o.js} +1 -1
  44. package/dist/ui/assets/{chunk-P2QGCYS3-yM5OTcCG.js → chunk-P2QGCYS3-NPQHSWha.js} +1 -1
  45. package/dist/ui/assets/{chunk-POPQ4Y6H-CXdSGWMk.js → chunk-POPQ4Y6H-Cbc2glFe.js} +1 -1
  46. package/dist/ui/assets/{chunk-PWAF6VOD-BjUqYYzZ.js → chunk-PWAF6VOD-E4hoWYnt.js} +1 -1
  47. package/dist/ui/assets/{chunk-SHT3W25Y-CkVKKjWI.js → chunk-SHT3W25Y-DbVXy1vA.js} +1 -1
  48. package/dist/ui/assets/{chunk-SVP7TREG-BZ2yerfk.js → chunk-SVP7TREG-VDz53lWo.js} +1 -1
  49. package/dist/ui/assets/{chunk-TICWLB2K-D2YLXcbV.js → chunk-TICWLB2K-Dp7_7G3W.js} +1 -1
  50. package/dist/ui/assets/{chunk-TLUHSLCS-D6_kCKKM.js → chunk-TLUHSLCS-RqBvuYFY.js} +2 -2
  51. package/dist/ui/assets/classDiagram-ZZMXUADV-Ca2957Wr.js +1 -0
  52. package/dist/ui/assets/classDiagram-v2-VYDZK3BY-Ca2957Wr.js +1 -0
  53. package/dist/ui/assets/{cynefinDiagram-5FMLGOSQ-C84hNxpr.js → cynefinDiagram-5FMLGOSQ-i8WRiMqt.js} +1 -1
  54. package/dist/ui/assets/{dagre-GXQ25YYZ-DTKWr0Ei.js → dagre-GXQ25YYZ-BJcNLyqh.js} +1 -1
  55. package/dist/ui/assets/{diagram-S7CK7UJ4-VGq4JrLk.js → diagram-S7CK7UJ4-BLliM3ye.js} +1 -1
  56. package/dist/ui/assets/{diagram-UQ7AKVKN-B8h2_6TT.js → diagram-UQ7AKVKN-Da1Hf0Hg.js} +1 -1
  57. package/dist/ui/assets/{diagram-VSXAHHWV-C5N42KUs.js → diagram-VSXAHHWV-RznGP5Tf.js} +1 -1
  58. package/dist/ui/assets/{diagram-VX7I27RA-CAu2OvU2.js → diagram-VX7I27RA-B8-ud1br.js} +1 -1
  59. package/dist/ui/assets/{diagram-Z3DM3KII-B9mdLYds.js → diagram-Z3DM3KII-DATmbaeB.js} +1 -1
  60. package/dist/ui/assets/{ebnfDiagram-PWID7BFC-Dov_WTug.js → ebnfDiagram-PWID7BFC-CUSxehdi.js} +1 -1
  61. package/dist/ui/assets/{erDiagram-RLTQ6QDP-CEY5uG1a.js → erDiagram-RLTQ6QDP-BYJ4oCZC.js} +1 -1
  62. package/dist/ui/assets/flowDiagram-HODETNUW-CUAGxYpY.js +1 -0
  63. package/dist/ui/assets/{ganttDiagram-EL5Y4UJY-B20eomMW.js → ganttDiagram-EL5Y4UJY-DyqNeerc.js} +1 -1
  64. package/dist/ui/assets/{gitGraphDiagram-WWUBYQGX-CMWlwcmC.js → gitGraphDiagram-WWUBYQGX-CY9iSA1O.js} +1 -1
  65. package/dist/ui/assets/{index-CIykDeE5.js → index-BX3Of6Ah.js} +3 -3
  66. package/dist/ui/assets/{infoDiagram-27XIBGKW-M6P4Hij8.js → infoDiagram-27XIBGKW-DMSn1eG4.js} +1 -1
  67. package/dist/ui/assets/{ishikawaDiagram-5VMMS53U-DYjDKPZN.js → ishikawaDiagram-5VMMS53U-mRPtZREa.js} +1 -1
  68. package/dist/ui/assets/{journeyDiagram-3NMN7TZE-BAWrVYw3.js → journeyDiagram-3NMN7TZE-S6tmN6FP.js} +1 -1
  69. package/dist/ui/assets/{kanban-definition-UXKFOSKX-Drymb6P2.js → kanban-definition-UXKFOSKX-CgjJlpFi.js} +1 -1
  70. package/dist/ui/assets/{line-Iw5WJt3F.js → line-DwXI6Hdc.js} +1 -1
  71. package/dist/ui/assets/{mermaid-parser.core-BmeI8qnP.js → mermaid-parser.core-DRyKTzV4.js} +1 -1
  72. package/dist/ui/assets/{mermaid.core-Pihow7Fd.js → mermaid.core-BPwYCwp1.js} +3 -3
  73. package/dist/ui/assets/{mindmap-definition-YA3MSWOX-Du7W46mq.js → mindmap-definition-YA3MSWOX-DX0qTdHQ.js} +1 -1
  74. package/dist/ui/assets/{pegDiagram-XKGWAZYB-BfxabksV.js → pegDiagram-XKGWAZYB-Bj8oYxfJ.js} +1 -1
  75. package/dist/ui/assets/{pieDiagram-E7YTZNPT-JvUYp_dn.js → pieDiagram-E7YTZNPT-D1pTO3_Q.js} +1 -1
  76. package/dist/ui/assets/{quadrantDiagram-AXDQQJYC-D8xbaohN.js → quadrantDiagram-AXDQQJYC-DGHdMJli.js} +1 -1
  77. package/dist/ui/assets/{railroadDiagram-O6MQD6OU-aZqYW-W4.js → railroadDiagram-O6MQD6OU-qnjLV-GN.js} +1 -1
  78. package/dist/ui/assets/{requirementDiagram-BXWQKSXE-BrUJ7eU0.js → requirementDiagram-BXWQKSXE-DFUkcL9F.js} +1 -1
  79. package/dist/ui/assets/{sankeyDiagram-P5KCCOFB-BLUUknwN.js → sankeyDiagram-P5KCCOFB-CIeQiPEH.js} +1 -1
  80. package/dist/ui/assets/{sequenceDiagram-WJ2MYXX4-CdGGwT3w.js → sequenceDiagram-WJ2MYXX4-D0cPk33G.js} +1 -1
  81. package/dist/ui/assets/{stateDiagram-D77RDMKH-D7BYLYEP.js → stateDiagram-D77RDMKH-b0dqXAMh.js} +1 -1
  82. package/dist/ui/assets/stateDiagram-v2-MP3YSRHH-OVe8wPLf.js +1 -0
  83. package/dist/ui/assets/{swimlanes-42K2YHIH-CIqdzNRN.js → swimlanes-42K2YHIH-Bc8GCCgs.js} +1 -1
  84. package/dist/ui/assets/swimlanesDiagram-VR7AAH4N-C8DnFsZY.js +8 -0
  85. package/dist/ui/assets/{timeline-definition-24CTP7MA-3LWWSIxv.js → timeline-definition-24CTP7MA-CigSMiUW.js} +1 -1
  86. package/dist/ui/assets/{vennDiagram-4TSXK5OY-D_MtyQqt.js → vennDiagram-4TSXK5OY-X3cL2aG1.js} +1 -1
  87. package/dist/ui/assets/{wardleyDiagram-VM6X3IG4-D7Pz_X6D.js → wardleyDiagram-VM6X3IG4-DrkrQT3-.js} +1 -1
  88. package/dist/ui/assets/{xychartDiagram-S5SC5T6Z-CsSUrPu6.js → xychartDiagram-S5SC5T6Z-rlQw2eQM.js} +1 -1
  89. package/dist/ui/index.html +1 -1
  90. package/dist/ui/sw.js +2 -2
  91. package/package.json +1 -1
  92. package/dist/ui/assets/channel-Gh-gAaek.js +0 -1
  93. package/dist/ui/assets/classDiagram-ZZMXUADV-CfJSdpvd.js +0 -1
  94. package/dist/ui/assets/classDiagram-v2-VYDZK3BY-CfJSdpvd.js +0 -1
  95. package/dist/ui/assets/flowDiagram-HODETNUW-CghwXXTC.js +0 -1
  96. package/dist/ui/assets/stateDiagram-v2-MP3YSRHH-jNlO3fWh.js +0 -1
  97. package/dist/ui/assets/swimlanesDiagram-VR7AAH4N-BfvAL3WJ.js +0 -8
package/README.md CHANGED
@@ -204,7 +204,7 @@ your task files, and serves a JSON API plus a live event stream. It adds no new
204
204
  business logic — it's a transport layer over the same core the CLI uses.
205
205
 
206
206
  ```bash
207
- repoos serve # http://127.0.0.1:7171 (or your Tailscale IP, if detected)
207
+ repoos serve # prints this project's address (or your Tailscale IP, if detected)
208
208
  repoos serve --port 8080 # custom port
209
209
  repoos serve --host 0.0.0.0 # listen on all interfaces
210
210
  repoos serve --quiet # no terminal activity log
@@ -277,8 +277,8 @@ won't clobber a body edit an agent made a moment earlier.
277
277
 
278
278
  ## The web UI
279
279
 
280
- `repoos serve` also serves a web UI at the root URL — open `http://127.0.0.1:7171`
281
- in a browser. It's a live control plane: a dashboard, the work board, an Agents
280
+ `repoos serve` also serves a web UI at the root URL. Open the address printed
281
+ at startup in a browser; each project has its own stable port. It's a live control plane: a dashboard, the work board, an Agents
282
282
  page for configuring and running coding agents, a context-docs viewer with
283
283
  skills, and settings. All reading from the API and updating in real time via the
284
284
  SSE stream. Edit a task file in your editor (or let an agent edit it) and the
@@ -1,5 +1,5 @@
1
1
  {
2
- "hash": "38ef16f2c33e40bd60aceca50693e61c60656fcef7c07bdf8a27fdca3d92a32a",
3
- "version": "0.5.95",
2
+ "hash": "0ace623a83b55e6e4e16dd72c0de2867436edcc801e21a3591842a79037941b4",
3
+ "version": "0.5.96",
4
4
  "devUi": false
5
5
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "generatedAt": "2026-11-28T03:50:42.774Z"
2
+ "generatedAt": "2026-11-29T10:35:52.651Z"
3
3
  }
package/dist/cli/help.js CHANGED
@@ -450,7 +450,10 @@ const EXAMPLES = [
450
450
  { cmd: "repoos status", comment: "one-screen health snapshot" },
451
451
  { cmd: "repoos status --json", comment: "machine-readable, for agents/tools" },
452
452
  { cmd: "repoos index --json", comment: "machine-readable, for agents/tools" },
453
- { cmd: "repoos serve", comment: "live API + SSE at http://127.0.0.1:7171" },
453
+ {
454
+ cmd: "repoos serve",
455
+ comment: "live API + SSE at the project-specific address printed at startup",
456
+ },
454
457
  ];
455
458
  /** Command aliases accepted by the dispatcher (`src/cli/index.ts`). */
456
459
  const ALIASES = {
@@ -1,4 +1,5 @@
1
1
  import { collectTailnetServers } from "../core/tailnet-servers.js";
2
+ import { getServiceStatus, listServices } from "../core/service-manager.js";
2
3
  export { collectTailnetServers, parseTailnetPeers, remoteFailureReason, remoteShellCommand, remoteShellScript, serversSshArgs, shellQuote, } from "../core/tailnet-servers.js";
3
4
  export type { ListedServer, RemoteExec } from "../core/tailnet-servers.js";
4
5
  /** Human-readable fallback line when the local Tailscale status is unavailable. */
@@ -8,5 +9,8 @@ export interface ServersCommandDeps {
8
9
  root?: string;
9
10
  /** Test seam: replace tailnet collection (the CLI path has no network seam). */
10
11
  collect?: typeof collectTailnetServers;
12
+ /** Test seams for installed service discovery and live status. */
13
+ listServices?: typeof listServices;
14
+ getServiceStatus?: typeof getServiceStatus;
11
15
  }
12
16
  export declare function cmdServers(argv: string[], deps?: ServersCommandDeps): Promise<void>;
@@ -1,9 +1,11 @@
1
1
  /** `repoos servers` — list registered RepoOS control-plane processes. */
2
2
  import { findRepoRoot, loadConfig } from "../core/config.js";
3
3
  import { resolveRemoteHosts } from "../core/remote-hosts.js";
4
- import { listValidatedServerRegistry, pruneStaleServerRegistryEntries, } from "../core/server-registry.js";
4
+ import { listValidatedServerRegistry, pruneStaleServerRegistryEntries, canonicalRegistryRoot, } from "../core/server-registry.js";
5
5
  import { collectTailnetServers } from "../core/tailnet-servers.js";
6
6
  import { c } from "../cli/colors.js";
7
+ import { existsSync } from "node:fs";
8
+ import { getServiceStatus, listServices } from "../core/service-manager.js";
7
9
  // Re-exported for callers (and tests) that used to import these from the CLI
8
10
  // command before tailnet discovery moved into `src/core/tailnet-servers.ts` so
9
11
  // the server endpoint can share it.
@@ -70,6 +72,25 @@ export async function cmdServers(argv, deps = {}) {
70
72
  if (prune)
71
73
  pruned = await pruneStaleServerRegistryEntries();
72
74
  const localRows = await listValidatedServerRegistry();
75
+ const activeRows = localRows.filter((row) => row.valid);
76
+ const inactiveServices = [];
77
+ let staleCount = localRows.filter((row) => !row.valid).length;
78
+ if (!tailscale) {
79
+ const installed = (deps.listServices ?? listServices)().services;
80
+ const runningRoots = new Set(activeRows.map((row) => canonicalRegistryRoot(row.entry.root)));
81
+ for (const service of installed) {
82
+ if (!existsSync(service.root) || runningRoots.has(canonicalRegistryRoot(service.root)))
83
+ continue;
84
+ const live = await (deps.getServiceStatus ?? getServiceStatus)(service.root);
85
+ if (!live || live.status !== "running") {
86
+ inactiveServices.push({
87
+ name: service.id.replace(/-[a-f0-9]{8}$/, ""),
88
+ port: service.port,
89
+ root: service.root,
90
+ });
91
+ }
92
+ }
93
+ }
73
94
  const local = localRows.map((row) => ({
74
95
  host: "local",
75
96
  port: row.entry.port,
@@ -110,7 +131,7 @@ export async function cmdServers(argv, deps = {}) {
110
131
  console.log(c.yellow(tailnetFallbackNotice(remoteHosts.map((host) => host.host))));
111
132
  }
112
133
  if (!tailscale && !prune && pruned === undefined) {
113
- if (localRows.length === 0) {
134
+ if (localRows.length === 0 && inactiveServices.length === 0) {
114
135
  console.log(c.dim(" No registered RepoOS servers."));
115
136
  console.log(c.dim(" Control-plane `repoos serve` processes register under ") +
116
137
  c.cyan("~/.repoos/servers/") +
@@ -118,8 +139,18 @@ export async function cmdServers(argv, deps = {}) {
118
139
  return;
119
140
  }
120
141
  console.log(c.bold(" Registered RepoOS servers:\n"));
121
- for (const row of localRows)
142
+ console.log(c.bold(" Running:\n"));
143
+ for (const row of activeRows)
122
144
  printLocalRow(row);
145
+ console.log(c.bold("\n Inactive:\n"));
146
+ if (!inactiveServices.length)
147
+ console.log(c.dim(" None."));
148
+ for (const service of inactiveServices) {
149
+ console.log(` ${c.cyan(String(service.port).padStart(5))} ${c.dim("inactive")} ${c.bold(service.name)}`);
150
+ console.log(` ${c.dim(service.root)}`);
151
+ }
152
+ if (staleCount)
153
+ console.log(c.yellow(`\n ${staleCount} stale registry entr${staleCount === 1 ? "y" : "ies"}; run repoos servers --prune to remove.`));
123
154
  return;
124
155
  }
125
156
  console.log(c.bold(tailscale ? " RepoOS servers by host:\n" : " Registered RepoOS servers:\n"));
@@ -1,4 +1,9 @@
1
1
  export { launcherScript } from "../core/launcher-runtime.js";
2
+ /** Keep in sync with install.sh's PAYLOAD_NAMES. */
3
+ export declare const INSTALL_PAYLOAD_NAMES: string[];
4
+ export declare function isLegacyStateInstall(root: string, home?: string): boolean;
5
+ /** Swap an extracted build while carrying every non-program entry forward. */
6
+ export declare function swapInstall(root: string, staged: string): void;
2
7
  /** Upgrade completion note when the server is still serving an older build. */
3
8
  export declare function upgradeRestartReminder(runningVersion: string | null, installedVersion: string): string | null;
4
9
  /**
@@ -7,7 +7,7 @@
7
7
  * command can give an actionable, source-specific instruction.
8
8
  */
9
9
  import { execFileSync } from "node:child_process";
10
- import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync, } from "node:fs";
10
+ import { chmodSync, cpSync, existsSync, readdirSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync, } from "node:fs";
11
11
  import { homedir } from "node:os";
12
12
  import { dirname, join } from "node:path";
13
13
  import { fileURLToPath } from "node:url";
@@ -18,6 +18,37 @@ import { boardRoot } from "../core/config.js";
18
18
  import { locateRepoServer } from "../core/server-locate.js";
19
19
  export { launcherScript } from "../core/launcher-runtime.js";
20
20
  const REPO = "repo-os/repoos";
21
+ /** Keep in sync with install.sh's PAYLOAD_NAMES. */
22
+ export const INSTALL_PAYLOAD_NAMES = [
23
+ "cli",
24
+ "commands",
25
+ "core",
26
+ "server",
27
+ "ui",
28
+ ".build-info.json",
29
+ ];
30
+ export function isLegacyStateInstall(root, home = homedir()) {
31
+ return root === join(home, ".repoos");
32
+ }
33
+ /** Swap an extracted build while carrying every non-program entry forward. */
34
+ export function swapInstall(root, staged) {
35
+ for (const name of readdirSync(root)) {
36
+ if (!INSTALL_PAYLOAD_NAMES.includes(name))
37
+ cpSync(join(root, name), join(staged, name), { recursive: true, errorOnExist: true });
38
+ }
39
+ const displaced = `${root}.upgrade-old`;
40
+ if (existsSync(displaced))
41
+ throw new Error(`Upgrade backup already exists: ${displaced}`);
42
+ renameSync(root, displaced);
43
+ try {
44
+ renameSync(staged, root);
45
+ }
46
+ catch (error) {
47
+ renameSync(displaced, root);
48
+ throw error;
49
+ }
50
+ rmSync(displaced, { recursive: true, force: true });
51
+ }
21
52
  /** Upgrade completion note when the server is still serving an older build. */
22
53
  export function upgradeRestartReminder(runningVersion, installedVersion) {
23
54
  if (!runningVersion || runningVersion === installedVersion)
@@ -231,11 +262,13 @@ export async function cmdUpgrade(args) {
231
262
  return;
232
263
  }
233
264
  }
234
- const root = installRoot();
265
+ const installedRoot = installRoot();
266
+ const legacy = isLegacyStateInstall(installedRoot);
267
+ const root = legacy ? join(homedir(), ".local", "share", "repoos") : installedRoot;
235
268
  const channel = parseChannel(args);
236
269
  const instruction = upgradeInstruction({
237
- installRoot: root,
238
- version: readInstallVersion(root),
270
+ installRoot: installedRoot,
271
+ version: readInstallVersion(installedRoot),
239
272
  channel,
240
273
  });
241
274
  if (instruction.installKind === "package-manager") {
@@ -252,7 +285,7 @@ export async function cmdUpgrade(args) {
252
285
  console.log(c.dim(` Update it with: ${instruction.command}`));
253
286
  return;
254
287
  }
255
- const current = readInstallVersion(root);
288
+ const current = readInstallVersion(installedRoot);
256
289
  console.log(c.dim(` Current version: v${current}`));
257
290
  console.log(c.dim(channel ? ` Checking latest "${channel}" release…` : " Checking latest release…"));
258
291
  let release;
@@ -283,8 +316,7 @@ export async function cmdUpgrade(args) {
283
316
  // final swap is a plain rename.
284
317
  const work = `${root}.upgrade-download`;
285
318
  const staged = `${root}.upgrade-staged`;
286
- const displaced = `${root}.upgrade-old`;
287
- for (const dir of [work, staged, displaced]) {
319
+ for (const dir of [work, staged]) {
288
320
  if (existsSync(dir))
289
321
  rmSync(dir, { recursive: true, force: true });
290
322
  }
@@ -295,15 +327,17 @@ export async function cmdUpgrade(args) {
295
327
  mkdirSync(staged, { recursive: true });
296
328
  execFileSync("tar", ["-xzf", tmpTar, "-C", staged]);
297
329
  execFileSync("chmod", ["+x", join(staged, "cli", "index.js")]);
298
- renameSync(root, displaced);
299
- try {
330
+ if (legacy) {
331
+ if (existsSync(root))
332
+ throw new Error(`Install destination already exists: ${root}`);
333
+ mkdirSync(dirname(root), { recursive: true });
300
334
  renameSync(staged, root);
335
+ for (const name of INSTALL_PAYLOAD_NAMES)
336
+ rmSync(join(installedRoot, name), { recursive: true, force: true });
301
337
  }
302
- catch (e) {
303
- renameSync(displaced, root);
304
- throw e;
338
+ else {
339
+ swapInstall(root, staged);
305
340
  }
306
- rmSync(displaced, { recursive: true, force: true });
307
341
  }
308
342
  finally {
309
343
  rmSync(work, { recursive: true, force: true });
@@ -311,6 +345,8 @@ export async function cmdUpgrade(args) {
311
345
  rmSync(staged, { recursive: true, force: true });
312
346
  }
313
347
  regenerateLauncher(root);
348
+ if (legacy)
349
+ console.log(c.green(` Moved the legacy install to ${root}; kept machine state in ${installedRoot}.`));
314
350
  console.log(c.green(` Upgraded to v${latest}.`));
315
351
  try {
316
352
  const server = await locateRepoServer(boardRoot().root);
@@ -1,8 +1,8 @@
1
1
  import type { RemoteValidationConfig, RemoteValidationHost } from "./types.js";
2
2
  /** Per-command budget for one remote host. */
3
- export declare const HOST_TIMEOUT_MS = 8000;
3
+ export declare const HOST_TIMEOUT_MS = 3500;
4
4
  /** Whole-request budget for one discovery pass; slow hosts become `unreachable`. */
5
- export declare const DISCOVERY_DEADLINE_MS = 25000;
5
+ export declare const DISCOVERY_DEADLINE_MS = 4800;
6
6
  /** Machine-level HTTP endpoint bound directly to the Tailscale interface. */
7
7
  export declare const TAILNET_DISCOVERY_PORT = 41641;
8
8
  export interface ListedServer {
@@ -146,6 +146,8 @@ export interface CollectTailnetOptions {
146
146
  annotateUrls?: boolean;
147
147
  /** Test seam for the deadline clock. */
148
148
  now?: () => number;
149
+ /** Called as each peer finishes; local rows are emitted first. */
150
+ onPeerResult?: (rows: ListedServer[]) => void;
149
151
  }
150
152
  export declare function defaultHttpDiscovery(peer: TailnetPeer, timeoutMs: number): Promise<string | null>;
151
153
  export interface TailnetCollection {
@@ -14,13 +14,13 @@ import { promisify } from "node:util";
14
14
  import { remoteHostUser } from "./remote-hosts.js";
15
15
  const execFileAsync = promisify(execFile);
16
16
  /** Per-command budget for one remote host. */
17
- export const HOST_TIMEOUT_MS = 8_000;
17
+ export const HOST_TIMEOUT_MS = 3_500;
18
18
  /** Whole-request budget for one discovery pass; slow hosts become `unreachable`. */
19
- export const DISCOVERY_DEADLINE_MS = 25_000;
19
+ export const DISCOVERY_DEADLINE_MS = 4_800;
20
20
  /** Machine-level HTTP endpoint bound directly to the Tailscale interface. */
21
21
  export const TAILNET_DISCOVERY_PORT = 41641;
22
22
  /** Leave time for the peer listener's local Tailscale URL enrichment. */
23
- const HTTP_DISCOVERY_TIMEOUT_MS = 7_000;
23
+ const HTTP_DISCOVERY_TIMEOUT_MS = 1_800;
24
24
  /** `tailscale status --json` is local and cheap; never let it hold a request. */
25
25
  const TAILSCALE_STATUS_TIMEOUT_MS = 2_000;
26
26
  /** URL enrichment is a nicety; a slow `serve status` must not hide servers. */
@@ -502,6 +502,7 @@ export async function collectTailnetServers(local, options = {}) {
502
502
  }),
503
503
  }))
504
504
  : local;
505
+ options.onPeerResult?.(localRows);
505
506
  const remoteExec = options.remoteExec ?? defaultRemoteExec;
506
507
  const configuredByHost = new Map((options.remoteHosts ?? []).map((host) => [host.host, host]));
507
508
  const remotes = await Promise.all(peers.map(async (peer) => {
@@ -585,9 +586,11 @@ export async function collectTailnetServers(local, options = {}) {
585
586
  ];
586
587
  }
587
588
  };
588
- return within(work(), deadlineAt - now(), () => [
589
+ const rows = await within(work(), deadlineAt - now(), () => [
589
590
  { host: peer.host, ...displayFields, unreachable: true, reason: "timed out" },
590
591
  ]);
592
+ options.onPeerResult?.(rows);
593
+ return rows;
591
594
  }));
592
595
  return {
593
596
  servers: [...localRows, ...remotes.flat()],
@@ -31,12 +31,14 @@ export interface TailnetDiscoveryDeps {
31
31
  httpDiscovery?: CollectTailnetOptions["httpDiscovery"];
32
32
  deadlineMs?: number;
33
33
  now?: () => number;
34
+ onPeerResult?: (rows: ListedServer[]) => void;
34
35
  }
35
36
  /**
36
37
  * Build the endpoint's response. Exported separately from the route handler so
37
38
  * tests can fake the Tailscale CLI and SSH without a live server or network.
38
39
  */
39
40
  export declare function buildTailnetDiscoveryPayload(config: Pick<RepoOSConfig, "remoteValidation" | "tailnetDiscovery">, deps?: TailnetDiscoveryDeps): Promise<TailnetDiscoveryPayload>;
41
+ export declare function createTailnetServersHandler(discoveryDeps?: TailnetDiscoveryDeps): RouteHandler;
40
42
  export declare const getTailnetServers: RouteHandler;
41
43
  /** Validate the direct socket address; forwarded or loopback requests are never trusted. */
42
44
  export declare function isTailnetPeerDiscoveryRequest(req: IncomingMessage): boolean;
@@ -65,6 +65,7 @@ export async function buildTailnetDiscoveryPayload(config, deps = {}) {
65
65
  ...(deps.remoteExec ? { remoteExec: deps.remoteExec } : {}),
66
66
  ...(deps.httpDiscovery ? { httpDiscovery: deps.httpDiscovery } : {}),
67
67
  ...(deps.now ? { now: deps.now } : {}),
68
+ ...(deps.onPeerResult ? { onPeerResult: deps.onPeerResult } : {}),
68
69
  });
69
70
  return {
70
71
  ok: true,
@@ -73,9 +74,39 @@ export async function buildTailnetDiscoveryPayload(config, deps = {}) {
73
74
  discoverySource: result.source,
74
75
  };
75
76
  }
76
- export const getTailnetServers = async (ctx, _req, res) => {
77
- return json(res, 200, await buildTailnetDiscoveryPayload(ctx.config));
78
- };
77
+ export function createTailnetServersHandler(discoveryDeps = {}) {
78
+ return async (ctx, req, res) => {
79
+ if (!new URL(req.url ?? "/", "http://localhost").searchParams.has("stream"))
80
+ return json(res, 200, await buildTailnetDiscoveryPayload(ctx.config, discoveryDeps));
81
+ res.writeHead(200, {
82
+ "Content-Type": "text/event-stream",
83
+ "Cache-Control": "no-cache",
84
+ Connection: "keep-alive",
85
+ "X-Accel-Buffering": "no",
86
+ });
87
+ try {
88
+ const payload = await buildTailnetDiscoveryPayload(ctx.config, {
89
+ ...discoveryDeps,
90
+ onPeerResult(rows) {
91
+ discoveryDeps.onPeerResult?.(rows);
92
+ if (!res.writableEnded)
93
+ res.write(`event: peer\ndata: ${JSON.stringify({ servers: rows })}\n\n`);
94
+ },
95
+ });
96
+ if (!res.writableEnded) {
97
+ res.write(`event: done\ndata: ${JSON.stringify(payload)}\n\n`);
98
+ res.end();
99
+ }
100
+ }
101
+ catch {
102
+ if (!res.writableEnded) {
103
+ res.write(`event: error\ndata: ${JSON.stringify({ reason: "Tailnet discovery stopped before it finished." })}\n\n`);
104
+ res.end();
105
+ }
106
+ }
107
+ };
108
+ }
109
+ export const getTailnetServers = createTailnetServersHandler();
79
110
  function normalizedAddress(value) {
80
111
  return (value ?? "")
81
112
  .trim()
@@ -337,7 +337,9 @@ async function tunnelReadiness(root, port) {
337
337
  present: existsSync(certPath),
338
338
  usable: usableOriginCertificate(certPath),
339
339
  };
340
- const originListening = typeof port === "number" && Number.isInteger(port) ? await portListening(port) : null;
340
+ const serveDefaultPort = resolveServePort(root, loadConfig(root));
341
+ const originPort = port ?? serveDefaultPort;
342
+ const originListening = await portListening(originPort);
341
343
  return {
342
344
  cloudflared: { installed: !!bin, version },
343
345
  originCertificate,
@@ -347,8 +349,8 @@ async function tunnelReadiness(root, port) {
347
349
  tunnelId: tunnel.tunnelId || null,
348
350
  baseDomain: tunnel.domain || null,
349
351
  },
350
- localOrigin: { port: port ?? null, listening: originListening },
351
- serveDefaultPort: resolveServePort(root, loadConfig(root)),
352
+ localOrigin: { port: originPort, listening: originListening },
353
+ serveDefaultPort,
352
354
  running: (await tunnelProcessRunning()) || (await serviceRunning()),
353
355
  publishedHostnames: Object.values(allApps)
354
356
  .map((app) => app.hostname)
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-Pihow7Fd.js","assets/index-CIykDeE5.js","assets/vendor-vue-BbjysADZ.js","assets/_plugin-vue_export-helper-GoZ6r0T0.js","assets/repo-9gQ3oGZ8.js","assets/rolldown-runtime-hePW80VL.js","assets/docs-Dgsl2Lus.js","assets/vendor-ui-DdxFTke2.js","assets/useResponsiveLayout-CWHmiJKK.js","assets/title-Dchwkc3-.js","assets/close-BDbRl7Nq.js","assets/VoiceDictate-CUu1gx3E.js","assets/VoiceDictate-CS-9Kmsa.css","assets/format-B31EJAKm.js","assets/check-setup-n5dbhIZo.js","assets/agent-failure-DxB0Ba74.js","assets/input-DWzP9viW.js","assets/ActivityIndicator-BeAbS87n.js","assets/activity-motion-kvEPH_et.js","assets/useChatScroll--_KRDDa8.js","assets/clipboard-CkhTprDX.js","assets/text-insertion-sXVs8rKF.js","assets/viewport-D7hXjRfS.js","assets/value-BqMWzKIQ.js","assets/AgentModelModal-5rdh-PXq.js","assets/AgentModelControl-2Sbq7lGX.js","assets/switch-C9h1H2Kp.js","assets/ChatAgentModelChip-Cv96nrE3.js","assets/PageSkeleton-D_YN16NR.js","assets/PageSkeleton-Dylw_rCI.css","assets/index-BWc2yVOL.css","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-B6xuSHsQ.js","assets/chunk-DU6HZSFF-B6KGKg64.js","assets/chunk-75Z2AOVW-Bv79iNlv.js","assets/dist-v5Q1xZ2K.js","assets/chunk-CLGD4ZFX-DYP6FTQd.js","assets/chunk-PWAF6VOD-BjUqYYzZ.js","assets/chunk-GMAD6QVW-BFea9tAC.js","assets/chunk-P2QGCYS3-yM5OTcCG.js","assets/chunk-4HAMMTFA-nV5dBuKR.js","assets/rough.esm-By172zw-.js","assets/chunk-GVQU2GXP-4LrBgq22.js","assets/chunk-OSK3NFVY-CRSgeovc.js","assets/line-Iw5WJt3F.js","assets/path-COt_16Va.js","assets/array-BifhSqXX.js","assets/chunk-L3NEJ4N5-DgyS4KZW.js","assets/chunk-TLUHSLCS-D6_kCKKM.js","assets/chunk-2E4U76K2-BmfJHEYb.js","assets/graphlib-DS17s2tU.js","assets/chunk-LNGE3PJU-p78rraeW.js"])))=>i.map(i=>d[i]);
2
- import{A as e,C as t,D as n,E as r,Et as i,J as a,K as o,Ot as s,T as c,U as l,W as u,X as ee,_ as d,b as f,c as p,f as m,gt as h,h as g,i as _,j as v,k as y,kt as b,mt as x,nt as S,ot as C,r as w,st as T,v as te,w as E,wt as D,z as ne}from"./vendor-vue-BbjysADZ.js";import{At as O,Nt as k,a as A,jt as j,n as re,t as M}from"./_plugin-vue_export-helper-GoZ6r0T0.js";import{Y as N,d as ie}from"./repo-9gQ3oGZ8.js";import{t as P}from"./docs-Dgsl2Lus.js";import{B as F,Et as I,st as L,w as R,wt as z}from"./vendor-ui-DdxFTke2.js";import{a as ae,i as oe,n as B,r as V,s as H,t as se}from"./title-Dchwkc3-.js";import{t as U}from"./close-BDbRl7Nq.js";import{o as W,t as G}from"./VoiceDictate-CUu1gx3E.js";import{t as K}from"./input-DWzP9viW.js";import{t as ce}from"./ActivityIndicator-BeAbS87n.js";import{t as le}from"./text-insertion-sXVs8rKF.js";import{a as ue,i as de,n as q,r as J,t as Y}from"./viewport-D7hXjRfS.js";import{t as fe}from"./value-BqMWzKIQ.js";import{t as X}from"./AgentModelControl-2Sbq7lGX.js";import{S as pe,bt as me,ft as Z,gt as Q,ht as he,mt as ge,t as _e}from"./index-CIykDeE5.js";import{t as ve}from"./checkbox-BC4PYsB5.js";var ye=null;function be(){let e=document.documentElement.getAttribute(`data-theme`);return e===`dark`?`dark`:e===`light`?`default`:window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`default`}async function xe(){return ye||=_e(async()=>{let{default:e}=await import(`./mermaid.core-Pihow7Fd.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51])).then(({default:e})=>(e.initialize({startOnLoad:!1,securityLevel:`strict`,maxTextSize:5e4,maxEdges:1e3,theme:be()}),e)),ye}async function $(e){let t=e.querySelectorAll(`.md-mermaid:not([data-processed])`);if(t.length)try{await(await xe()).run({nodes:t,suppressErrors:!0})}catch{}}function Se(e){let t={};for(let n of e){if(!n.path)continue;let e=n.path.split(`/`),r=t;for(let t=0;t<e.length;t++){let i=e[t],a=t===e.length-1,o=e.slice(0,t+1).join(`/`);r[i]||(r[i]={name:i,key:o,isFile:a,path:a?n.path:void 0,children:{}}),a||(r=r[i].children)}}let n=e=>Object.values(e).sort((e,t)=>e.isFile===t.isFile?e.name.localeCompare(t.name):e.isFile?1:-1).map(e=>{let t={name:e.name,key:e.key,isFile:e.isFile,path:e.path},r=n(e.children);return r.length&&(t.children=r),t});return n(t)}function Ce(e,t){let n=[],r=(e,i)=>{for(let a of e)n.push({key:a.key,name:a.name,isFile:a.isFile,path:a.path,depth:i}),!a.isFile&&a.children&&t.has(a.key)&&r(a.children,i+1)};return r(e,0),n}var we={class:`drawer-head`},Te={class:`drawer-head-title`},Ee={class:`drawer-tabs`},De={class:`drawer-body`},Oe={class:`field`},ke={class:`field-header`},Ae={class:`ff-agent-bar`},je={class:`agent-pick-grid`},Me={class:`agent-field`},Ne={class:`agent-field`,style:{"grid-column":`1 / -1`}},Pe={key:0,class:`ff-notice`},Fe={key:1,class:`ff-error`},Ie={class:`btn-row`,style:{"margin-top":`20px`}},Le={key:2,class:`ff-stream`},Re={class:`ff-stream-head`},ze={class:`field`},Be={class:`field`},Ve={class:`field-header`},He={class:`btn-row`,style:{"margin-top":`20px`}},Ue={class:`field`},We={class:`field`},Ge={key:0,class:`upload-file-info`},Ke={key:0,class:`upload-dest`},qe={key:0,class:`ff-error`},Je={class:`btn-row`,style:{"margin-top":`20px`}},Ye=M(v({__name:`NewDocPanel`,setup(l){let u=re(),p=ie(),m=A(),_=P(),v=t(()=>u.isNewDoc);function w(e){e||u.close()}function O(e){u.isNewDoc&&(e.preventDefault(),requestAnimationFrame(()=>{let e;e=k.value===`freeform`?`nd-freeform`:k.value===`upload`?`nd-upload-path`:`nd-path`,document.getElementById(e)?.focus()}))}let k=h(`freeform`),j=h(``),M=h(``),N=h(!1),F=h(null),I=h(null),L=h(``),z=h(``),W=t(()=>{let e=L.value.trim();return e?/\/\s*$/.test(e)&&I.value?e.replace(/\s*$/,``)+I.value.name:e:``}),pe=t(()=>!m.loaded||(m.agents??[]).some(e=>e.name===`pm`&&e.enabled));S(()=>u.isNewDoc,e=>{e&&(k.value=m.form.defaultTaskMode===`manual`?`manual`:`freeform`,j.value=``,M.value=``,I.value=null,L.value=``,z.value=``,Se())});async function me(){let e=j.value.trim();if(e){u.saving=!0,N.value=!0,M.value=``,F.value&&p.clearOutput(F.value),F.value=Z();try{let t=Ce.value?{agent:$.agent,cli:$.cli,model:$.model}:void 0,n=await p.createFreeformDocument(e,F.value,t);u.close(),j.value=``,await p.refresh(),n.path&&(await _.syncDocAfterCreate(n.path),await _.loadDoc(n.path))}catch(e){M.value=e instanceof Error?e.message:String(e)}finally{N.value=!1,F.value=null,u.saving=!1}}}async function Q(){if(!(!u.nd.path||!u.nd.content)){u.saving=!0;try{let e=u.nd.path;await p.createDocument({path:e,content:u.nd.content}),u.close(),u.nd.path=``,u.nd.content=``,await p.refresh(),await _.syncDocAfterCreate(e),await _.loadDoc(e)}catch(e){p.onError(e)}finally{u.saving=!1}}}function he(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result).split(`,`)[1]??``),r.onerror=()=>n(r.error??Error(`could not read file`)),r.readAsDataURL(e)})}async function ge(){if(!(!I.value||!L.value.trim())){u.saving=!0,z.value=``;try{let e=I.value,t=W.value,n=await he(e);await p.createDocument({path:t,contentBase64:n}),u.close(),I.value=null,L.value=``,await p.refresh(),await _.syncDocAfterCreate(t),/\.(md|markdown|txt|svg)$/i.test(t)&&await _.loadDoc(t)}catch(e){z.value=e instanceof Error?e.message:String(e)}finally{u.saving=!1}}}function _e(e){let t=e.target.files;t&&t.length>0&&(I.value=t[0])}let ve=t(()=>(m.agents??[]).filter(e=>e.enabled)),ye=t(()=>m.agentsMeta.clis??[]),be=t(()=>m.modelsFor($.cli,$.model||void 0)),xe=t(()=>(m.agents?.length?m.agents:[]).find(e=>e.enabled&&e.name===`pm`)??null),$=x({agent:``,cli:``,model:``});function Se(){let e=xe.value;$.agent=e?.name||``,$.cli=e?.cli||``,$.model=e?.model||``}let Ce=t(()=>{let e=xe.value;return e?$.agent!==e.name||$.cli!==e.cli||$.model!==e.model:!1}),Ye=t(()=>(F.value?p.outputs[F.value]??[]:[]).map(e=>`type`in e?{s:`out`,d:e.type===`text`?e.text:e.d??``}:{s:e.s===`err`?`err`:`out`,d:e.d})),Xe=h(null);S(Ye,()=>{ne(()=>{let e=Xe.value;e&&(e.scrollTop=e.scrollHeight)})});let Ze=h(null),Qe=h(null);function $e(e){Ze.value&&le(Ze.value,e)}function et(e){Qe.value&&le(Qe.value,e)}return(t,l)=>{let p=ee(`router-link`);return o(),c(ae,{open:v.value,"onUpdate:open":w},{default:C(()=>[e(B),e(oe,{style:s({width:D(u).drawerWidth+`px`,"max-width":`100vw`}),onOpenAutoFocus:O},{default:C(()=>[E(`div`,{class:`drawer-resize`,onMousedown:l[0]||=te((...e)=>D(u).startResize&&D(u).startResize(...e),[`prevent`])},null,32),E(`div`,we,[E(`div`,Te,[e(se,null,{default:C(()=>[...l[15]||=[y(`New doc`,-1)]]),_:1}),e(V,{class:`sr-only`},{default:C(()=>[...l[16]||=[y(`Create a new document`,-1)]]),_:1})]),e(U,{class:`close-x`},{default:C(()=>[e(D(R),{class:`size-[15px]`})]),_:1})]),E(`div`,Ee,[E(`button`,{type:`button`,class:i([`tab-btn`,{active:k.value===`freeform`}]),onClick:l[1]||=e=>k.value=`freeform`},` Freeform `,2),E(`button`,{type:`button`,class:i([`tab-btn`,{active:k.value===`manual`}]),onClick:l[2]||=e=>k.value=`manual`},` Manual `,2),E(`button`,{type:`button`,class:i([`tab-btn`,{active:k.value===`upload`}]),onClick:l[3]||=e=>k.value=`upload`},` Upload `,2)]),E(`div`,De,[k.value===`freeform`?(o(),n(f,{key:0},[E(`div`,Oe,[E(`div`,ke,[l[17]||=E(`label`,{for:`nd-freeform`},`Describe the document`,-1),e(G,{onTranscribed:$e})]),T(E(`textarea`,{id:`nd-freeform`,ref_key:`freeformTextarea`,ref:Ze,"onUpdate:modelValue":l[4]||=e=>j.value=e,class:`ff-textarea`,rows:`10`,placeholder:`Type the document description — like explaining what should be documented. The PM agent writes the document and chooses an appropriate path.`},null,512),[[g,j.value]])]),E(`div`,Ae,[E(`div`,je,[E(`div`,Me,[l[18]||=E(`label`,null,`Role`,-1),e(ue,{modelValue:$.agent,"onUpdate:modelValue":l[5]||=e=>$.agent=e,disabled:N.value},{default:C(()=>[e(q,{class:`h-[34px] w-full rounded-[9px] px-[11px]`},{default:C(()=>[e(fe,{placeholder:`agent`})]),_:1}),e(de,{position:`popper`},{default:C(()=>[e(Y,{class:`min-w-[var(--radix-select-trigger-width)]`},{default:C(()=>[(o(!0),n(f,null,a(ve.value,e=>(o(),c(J,{key:e.name,value:e.name},{default:C(()=>[y(b(e.name),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`modelValue`,`disabled`])]),E(`div`,Ne,[e(X,{"cli-options":ye.value,"model-options":be.value,"memory-key":`panel:new-doc`,cli:$.cli,"onUpdate:cli":l[6]||=e=>$.cli=e,model:$.model,"onUpdate:model":l[7]||=e=>$.model=e,disabled:N.value},null,8,[`cli-options`,`model-options`,`cli`,`model`,`disabled`])])])]),pe.value?r(``,!0):(o(),n(`div`,Pe,[l[20]||=y(` No PM agent is configured. `,-1),e(p,{to:{name:`agents`},onClick:l[8]||=e=>D(u).close()},{default:C(()=>[...l[19]||=[y(` Set one up on the Agents page `,-1)]]),_:1}),l[21]||=y(` — until then use the Manual doc tab. `,-1)])),M.value?(o(),n(`div`,Fe,b(M.value),1)):r(``,!0),E(`div`,Ie,[e(H,{variant:`outline`,onClick:l[9]||=e=>D(u).close()},{default:C(()=>[...l[22]||=[y(`Cancel`,-1)]]),_:1}),e(H,{variant:`default`,onClick:me,disabled:D(u).saving||!j.value.trim()},{default:C(()=>[N.value?(o(),c(ce,{key:0,activity:`agent`})):r(``,!0),y(` `+b(N.value?`Asking the PM agent…`:`Create document`),1)]),_:1},8,[`disabled`])]),Ye.value.length?(o(),n(`div`,Le,[E(`div`,Re,[e(ce,{activity:`agent`}),l[23]||=y(` PM agent `,-1)]),E(`div`,{class:`ff-stream-log`,ref_key:`ffLogEl`,ref:Xe},[(o(!0),n(f,null,a(Ye.value,(e,t)=>(o(),n(`div`,{key:t,class:i([`ff-stream-line`,e.s===`err`?`err`:``])},b(e.d),3))),128))],512)])):r(``,!0)],64)):k.value===`manual`?(o(),n(f,{key:1},[E(`div`,ze,[l[24]||=E(`label`,{for:`nd-path`},`File path`,-1),e(K,{id:`nd-path`,modelValue:D(u).nd.path,"onUpdate:modelValue":l[10]||=e=>D(u).nd.path=e,placeholder:`docs/my-document.md`,onKeyup:d(Q,[`enter`])},null,8,[`modelValue`])]),E(`div`,Be,[E(`div`,Ve,[l[25]||=E(`label`,{for:`nd-content`},`Content`,-1),e(G,{onTranscribed:et})]),T(E(`textarea`,{id:`nd-content`,ref_key:`docBodyTextarea`,ref:Qe,"onUpdate:modelValue":l[11]||=e=>D(u).nd.content=e,class:`doc-textarea`,rows:`15`,placeholder:`Enter the document content in Markdown format...`},null,512),[[g,D(u).nd.content]])]),E(`div`,He,[e(H,{variant:`outline`,onClick:l[12]||=e=>D(u).close()},{default:C(()=>[...l[26]||=[y(`Cancel`,-1)]]),_:1}),e(H,{variant:`default`,onClick:Q,disabled:D(u).saving||!D(u).nd.path||!D(u).nd.content},{default:C(()=>[...l[27]||=[y(` Create `,-1)]]),_:1},8,[`disabled`])])],64)):k.value===`upload`?(o(),n(f,{key:2},[E(`div`,Ue,[l[28]||=E(`label`,{for:`nd-upload-path`},`File path`,-1),e(K,{id:`nd-upload-path`,modelValue:L.value,"onUpdate:modelValue":l[13]||=e=>L.value=e,placeholder:`docs/my-document.md — or docs/design/assets/ to keep the filename`},null,8,[`modelValue`])]),E(`div`,We,[l[29]||=E(`label`,{for:`nd-upload-file`},`Select file`,-1),E(`input`,{id:`nd-upload-file`,type:`file`,class:`upload-input`,onChange:_e},null,32),I.value?(o(),n(`div`,Ge,[y(b(I.value.name)+` (`+b((I.value.size/1024).toFixed(1))+` KB) `,1),W.value?(o(),n(`span`,Ke,`→ `+b(W.value),1)):r(``,!0)])):r(``,!0)]),z.value?(o(),n(`div`,qe,b(z.value),1)):r(``,!0),E(`div`,Je,[e(H,{variant:`outline`,onClick:l[14]||=e=>D(u).close()},{default:C(()=>[...l[30]||=[y(`Cancel`,-1)]]),_:1}),e(H,{variant:`default`,onClick:ge,disabled:D(u).saving||!I.value||!L.value.trim()},{default:C(()=>[...l[31]||=[y(` Upload `,-1)]]),_:1},8,[`disabled`])])],64)):r(``,!0)])]),_:1},8,[`style`])]),_:1},8,[`open`])}}}),[[`__scopeId`,`data-v-073ec576`]]),Xe={class:`drawer-head`},Ze={class:`drawer-head-title`},Qe={class:`drawer-tabs`},$e={class:`drawer-body`},et={class:`field`},tt={class:`ff-agent-bar`},nt={key:0,class:`ff-notice`},rt={key:1,class:`ff-error`},it={class:`btn-row`,style:{"margin-top":`20px`}},at={key:2,class:`ff-stream`},ot={class:`ff-stream-head`},st={class:`field`},ct={key:0,class:`hint`},lt={class:`field`},ut={class:`field`},dt={key:0,class:`ff-error`},ft={class:`btn-row`,style:{"margin-top":`20px`}},pt={class:`field`},mt={key:0,class:`hint`},ht={class:`field`},gt={key:0,class:`upload-file-info`},_t={key:0,class:`ff-error`},vt={class:`btn-row`,style:{"margin-top":`20px`}},yt=M(v({__name:`NewSkillPanel`,setup(l){let u=re(),d=ie(),p=A(),m=P(),_=t(()=>u.isNewSkill);function v(e){e||u.close()}let w=h(`freeform`),O=h(``),k=h(``),j=h(!1),M=h(null),N=h(``),F=h(null),I=h(``),L=t(()=>!p.loaded||(p.agents??[]).some(e=>e.name===`pm`&&e.enabled)),z=t(()=>(p.agents??[]).find(e=>e.enabled&&e.name===`pm`)??null),W=x({cli:``,model:``});function G(){W.cli=z.value?.cli||``,W.model=z.value?.model||``}let le=t(()=>{let e=z.value;return e?W.cli!==e.cli||W.model!==e.model:!1}),ue=t(()=>p.agentsMeta.clis??[]),de=t(()=>p.modelsFor(W.cli,W.model||void 0)),q=t(()=>u.ns.name.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``));S(()=>u.isNewSkill,e=>{e&&(w.value=`freeform`,O.value=``,k.value=``,N.value=``,F.value=null,I.value=``,G())});async function J(e){u.close(),await d.refresh(),await m.loadSkills(),e&&await m.loadSkill(e)}async function Y(){let e=O.value.trim();if(e){u.saving=!0,j.value=!0,k.value=``,M.value&&d.clearOutput(M.value),M.value=Z();try{let t=le.value?{cli:W.cli,model:W.model}:void 0,n=await d.createFreeformSkill(e,M.value,t);O.value=``,await J(n.path)}catch(e){k.value=e instanceof Error?e.message:String(e)}finally{j.value=!1,M.value=null,u.saving=!1}}}async function fe(){if(!(!u.ns.name.trim()||!u.ns.description.trim()||!u.ns.content.trim())){u.saving=!0,N.value=``;try{await J((await d.createSkill({name:u.ns.name.trim(),description:u.ns.description.trim(),body:u.ns.content})).path)}catch(e){N.value=e instanceof Error?e.message:String(e)}finally{u.saving=!1}}}async function pe(){if(!(!F.value||!u.ns.name.trim())){u.saving=!0,I.value=``;try{let e=await F.value.text();await J((await d.createSkill({name:u.ns.name.trim(),content:e})).path)}catch(e){I.value=e instanceof Error?e.message:String(e)}finally{u.saving=!1}}}function me(e){let t=e.target.files;t&&t.length>0&&(F.value=t[0])}let Q=t(()=>(M.value?d.outputs[M.value]??[]:[]).map(e=>`type`in e?{s:`out`,d:e.type===`text`?e.text:e.d??``}:{s:e.s===`err`?`err`:`out`,d:e.d})),he=h(null);return S(Q,()=>{ne(()=>{let e=he.value;e&&(e.scrollTop=e.scrollHeight)})}),(t,l)=>{let d=ee(`router-link`);return o(),c(ae,{open:_.value,"onUpdate:open":v},{default:C(()=>[e(B),e(oe,{style:s({width:D(u).drawerWidth+`px`,"max-width":`100vw`})},{default:C(()=>[E(`div`,{class:`drawer-resize`,onMousedown:l[0]||=te((...e)=>D(u).startResize&&D(u).startResize(...e),[`prevent`])},null,32),E(`div`,Xe,[E(`div`,Ze,[e(se,null,{default:C(()=>[...l[15]||=[y(`New skill`,-1)]]),_:1}),e(V,{class:`sr-only`},{default:C(()=>[...l[16]||=[y(`Create a new skill`,-1)]]),_:1})]),e(U,{class:`close-x`},{default:C(()=>[e(D(R),{class:`size-[15px]`})]),_:1})]),E(`div`,Qe,[E(`button`,{type:`button`,class:i([`tab-btn`,{active:w.value===`freeform`}]),onClick:l[1]||=e=>w.value=`freeform`},` Freeform `,2),E(`button`,{type:`button`,class:i([`tab-btn`,{active:w.value===`manual`}]),onClick:l[2]||=e=>w.value=`manual`},` Manual `,2),E(`button`,{type:`button`,class:i([`tab-btn`,{active:w.value===`upload`}]),onClick:l[3]||=e=>w.value=`upload`},` Upload `,2)]),E(`div`,$e,[w.value===`freeform`?(o(),n(f,{key:0},[E(`div`,et,[l[17]||=E(`label`,{for:`ns-freeform`},`Describe the skill`,-1),T(E(`textarea`,{id:`ns-freeform`,"onUpdate:modelValue":l[4]||=e=>O.value=e,class:`ff-textarea`,rows:`10`,placeholder:`Describe what the skill should do and when an agent should reach for it. The PM agent writes the SKILL.md and picks the skills/<name>/ folder.`},null,512),[[g,O.value]])]),E(`div`,tt,[e(X,{"cli-options":ue.value,"model-options":de.value,"memory-key":`panel:new-skill`,cli:W.cli,"onUpdate:cli":l[5]||=e=>W.cli=e,model:W.model,"onUpdate:model":l[6]||=e=>W.model=e,disabled:j.value},null,8,[`cli-options`,`model-options`,`cli`,`model`,`disabled`])]),L.value?r(``,!0):(o(),n(`div`,nt,[l[19]||=y(` No PM agent is configured. `,-1),e(d,{to:{name:`agents`},onClick:l[7]||=e=>D(u).close()},{default:C(()=>[...l[18]||=[y(` Set one up on the Agents page `,-1)]]),_:1}),l[20]||=y(` — until then use the Manual tab. `,-1)])),k.value?(o(),n(`div`,rt,b(k.value),1)):r(``,!0),E(`div`,it,[e(H,{variant:`outline`,onClick:l[8]||=e=>D(u).close()},{default:C(()=>[...l[21]||=[y(`Cancel`,-1)]]),_:1}),e(H,{variant:`default`,onClick:Y,disabled:D(u).saving||!O.value.trim()},{default:C(()=>[j.value?(o(),c(ce,{key:0,activity:`agent`})):r(``,!0),y(` `+b(j.value?`Asking the PM agent…`:`Create skill`),1)]),_:1},8,[`disabled`])]),Q.value.length?(o(),n(`div`,at,[E(`div`,ot,[e(ce,{activity:`agent`}),l[22]||=y(` PM agent `,-1)]),E(`div`,{class:`ff-stream-log`,ref_key:`ffLogEl`,ref:he},[(o(!0),n(f,null,a(Q.value,(e,t)=>(o(),n(`div`,{key:t,class:i([`ff-stream-line`,e.s===`err`?`err`:``])},b(e.d),3))),128))],512)])):r(``,!0)],64)):w.value===`manual`?(o(),n(f,{key:1},[E(`div`,st,[l[23]||=E(`label`,{for:`ns-name`},`Skill name`,-1),e(K,{id:`ns-name`,modelValue:D(u).ns.name,"onUpdate:modelValue":l[9]||=e=>D(u).ns.name=e,placeholder:`my-skill`},null,8,[`modelValue`]),q.value?(o(),n(`div`,ct,`→ skills/`+b(q.value)+`/SKILL.md`,1)):r(``,!0)]),E(`div`,lt,[l[24]||=E(`label`,{for:`ns-desc`},`Description`,-1),e(K,{id:`ns-desc`,modelValue:D(u).ns.description,"onUpdate:modelValue":l[10]||=e=>D(u).ns.description=e,placeholder:`One line: when should an agent use this skill?`},null,8,[`modelValue`])]),E(`div`,ut,[l[25]||=E(`label`,{for:`ns-body`},`Instructions (Markdown)`,-1),T(E(`textarea`,{id:`ns-body`,"onUpdate:modelValue":l[11]||=e=>D(u).ns.content=e,class:`doc-textarea`,rows:`14`,placeholder:`# My skill
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-BPwYCwp1.js","assets/index-BX3Of6Ah.js","assets/vendor-vue-BbjysADZ.js","assets/_plugin-vue_export-helper-GoZ6r0T0.js","assets/repo-9gQ3oGZ8.js","assets/rolldown-runtime-hePW80VL.js","assets/docs-Dgsl2Lus.js","assets/vendor-ui-DdxFTke2.js","assets/useResponsiveLayout-CWHmiJKK.js","assets/title-Dchwkc3-.js","assets/close-BDbRl7Nq.js","assets/VoiceDictate-CUu1gx3E.js","assets/VoiceDictate-CS-9Kmsa.css","assets/format-B31EJAKm.js","assets/check-setup-n5dbhIZo.js","assets/agent-failure-DxB0Ba74.js","assets/input-DWzP9viW.js","assets/ActivityIndicator-BeAbS87n.js","assets/activity-motion-kvEPH_et.js","assets/useChatScroll--_KRDDa8.js","assets/clipboard-CkhTprDX.js","assets/text-insertion-sXVs8rKF.js","assets/viewport-D7hXjRfS.js","assets/value-BqMWzKIQ.js","assets/AgentModelModal-5rdh-PXq.js","assets/AgentModelControl-2Sbq7lGX.js","assets/switch-C9h1H2Kp.js","assets/ChatAgentModelChip-Cv96nrE3.js","assets/PageSkeleton-D_YN16NR.js","assets/PageSkeleton-Dylw_rCI.css","assets/index-BWc2yVOL.css","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-B6xuSHsQ.js","assets/chunk-DU6HZSFF-DIqGroIg.js","assets/chunk-75Z2AOVW-bSsW-KGE.js","assets/dist-v5Q1xZ2K.js","assets/chunk-CLGD4ZFX-VoCTMgMr.js","assets/chunk-PWAF6VOD-E4hoWYnt.js","assets/chunk-GMAD6QVW-DEJGSb2v.js","assets/chunk-P2QGCYS3-NPQHSWha.js","assets/chunk-4HAMMTFA-C0tgf_1t.js","assets/rough.esm-By172zw-.js","assets/chunk-GVQU2GXP-CazbgFu6.js","assets/chunk-OSK3NFVY-DqV-eD0o.js","assets/line-DwXI6Hdc.js","assets/path-COt_16Va.js","assets/array-BifhSqXX.js","assets/chunk-L3NEJ4N5-BVAy2-6E.js","assets/chunk-TLUHSLCS-RqBvuYFY.js","assets/chunk-2E4U76K2-lmPqZMXN.js","assets/graphlib-DS17s2tU.js","assets/chunk-LNGE3PJU-p78rraeW.js"])))=>i.map(i=>d[i]);
2
+ import{A as e,C as t,D as n,E as r,Et as i,J as a,K as o,Ot as s,T as c,U as l,W as u,X as ee,_ as d,b as f,c as p,f as m,gt as h,h as g,i as _,j as v,k as y,kt as b,mt as x,nt as S,ot as C,r as w,st as T,v as te,w as E,wt as D,z as ne}from"./vendor-vue-BbjysADZ.js";import{At as O,Nt as k,a as A,jt as j,n as re,t as M}from"./_plugin-vue_export-helper-GoZ6r0T0.js";import{Y as N,d as ie}from"./repo-9gQ3oGZ8.js";import{t as P}from"./docs-Dgsl2Lus.js";import{B as F,Et as I,st as L,w as R,wt as z}from"./vendor-ui-DdxFTke2.js";import{a as ae,i as oe,n as B,r as V,s as H,t as se}from"./title-Dchwkc3-.js";import{t as U}from"./close-BDbRl7Nq.js";import{o as W,t as G}from"./VoiceDictate-CUu1gx3E.js";import{t as K}from"./input-DWzP9viW.js";import{t as ce}from"./ActivityIndicator-BeAbS87n.js";import{t as le}from"./text-insertion-sXVs8rKF.js";import{a as ue,i as de,n as q,r as J,t as Y}from"./viewport-D7hXjRfS.js";import{t as fe}from"./value-BqMWzKIQ.js";import{t as X}from"./AgentModelControl-2Sbq7lGX.js";import{S as pe,bt as me,ft as Z,gt as Q,ht as he,mt as ge,t as _e}from"./index-BX3Of6Ah.js";import{t as ve}from"./checkbox-BC4PYsB5.js";var ye=null;function be(){let e=document.documentElement.getAttribute(`data-theme`);return e===`dark`?`dark`:e===`light`?`default`:window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`default`}async function xe(){return ye||=_e(async()=>{let{default:e}=await import(`./mermaid.core-BPwYCwp1.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51])).then(({default:e})=>(e.initialize({startOnLoad:!1,securityLevel:`strict`,maxTextSize:5e4,maxEdges:1e3,theme:be()}),e)),ye}async function $(e){let t=e.querySelectorAll(`.md-mermaid:not([data-processed])`);if(t.length)try{await(await xe()).run({nodes:t,suppressErrors:!0})}catch{}}function Se(e){let t={};for(let n of e){if(!n.path)continue;let e=n.path.split(`/`),r=t;for(let t=0;t<e.length;t++){let i=e[t],a=t===e.length-1,o=e.slice(0,t+1).join(`/`);r[i]||(r[i]={name:i,key:o,isFile:a,path:a?n.path:void 0,children:{}}),a||(r=r[i].children)}}let n=e=>Object.values(e).sort((e,t)=>e.isFile===t.isFile?e.name.localeCompare(t.name):e.isFile?1:-1).map(e=>{let t={name:e.name,key:e.key,isFile:e.isFile,path:e.path},r=n(e.children);return r.length&&(t.children=r),t});return n(t)}function Ce(e,t){let n=[],r=(e,i)=>{for(let a of e)n.push({key:a.key,name:a.name,isFile:a.isFile,path:a.path,depth:i}),!a.isFile&&a.children&&t.has(a.key)&&r(a.children,i+1)};return r(e,0),n}var we={class:`drawer-head`},Te={class:`drawer-head-title`},Ee={class:`drawer-tabs`},De={class:`drawer-body`},Oe={class:`field`},ke={class:`field-header`},Ae={class:`ff-agent-bar`},je={class:`agent-pick-grid`},Me={class:`agent-field`},Ne={class:`agent-field`,style:{"grid-column":`1 / -1`}},Pe={key:0,class:`ff-notice`},Fe={key:1,class:`ff-error`},Ie={class:`btn-row`,style:{"margin-top":`20px`}},Le={key:2,class:`ff-stream`},Re={class:`ff-stream-head`},ze={class:`field`},Be={class:`field`},Ve={class:`field-header`},He={class:`btn-row`,style:{"margin-top":`20px`}},Ue={class:`field`},We={class:`field`},Ge={key:0,class:`upload-file-info`},Ke={key:0,class:`upload-dest`},qe={key:0,class:`ff-error`},Je={class:`btn-row`,style:{"margin-top":`20px`}},Ye=M(v({__name:`NewDocPanel`,setup(l){let u=re(),p=ie(),m=A(),_=P(),v=t(()=>u.isNewDoc);function w(e){e||u.close()}function O(e){u.isNewDoc&&(e.preventDefault(),requestAnimationFrame(()=>{let e;e=k.value===`freeform`?`nd-freeform`:k.value===`upload`?`nd-upload-path`:`nd-path`,document.getElementById(e)?.focus()}))}let k=h(`freeform`),j=h(``),M=h(``),N=h(!1),F=h(null),I=h(null),L=h(``),z=h(``),W=t(()=>{let e=L.value.trim();return e?/\/\s*$/.test(e)&&I.value?e.replace(/\s*$/,``)+I.value.name:e:``}),pe=t(()=>!m.loaded||(m.agents??[]).some(e=>e.name===`pm`&&e.enabled));S(()=>u.isNewDoc,e=>{e&&(k.value=m.form.defaultTaskMode===`manual`?`manual`:`freeform`,j.value=``,M.value=``,I.value=null,L.value=``,z.value=``,Se())});async function me(){let e=j.value.trim();if(e){u.saving=!0,N.value=!0,M.value=``,F.value&&p.clearOutput(F.value),F.value=Z();try{let t=Ce.value?{agent:$.agent,cli:$.cli,model:$.model}:void 0,n=await p.createFreeformDocument(e,F.value,t);u.close(),j.value=``,await p.refresh(),n.path&&(await _.syncDocAfterCreate(n.path),await _.loadDoc(n.path))}catch(e){M.value=e instanceof Error?e.message:String(e)}finally{N.value=!1,F.value=null,u.saving=!1}}}async function Q(){if(!(!u.nd.path||!u.nd.content)){u.saving=!0;try{let e=u.nd.path;await p.createDocument({path:e,content:u.nd.content}),u.close(),u.nd.path=``,u.nd.content=``,await p.refresh(),await _.syncDocAfterCreate(e),await _.loadDoc(e)}catch(e){p.onError(e)}finally{u.saving=!1}}}function he(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result).split(`,`)[1]??``),r.onerror=()=>n(r.error??Error(`could not read file`)),r.readAsDataURL(e)})}async function ge(){if(!(!I.value||!L.value.trim())){u.saving=!0,z.value=``;try{let e=I.value,t=W.value,n=await he(e);await p.createDocument({path:t,contentBase64:n}),u.close(),I.value=null,L.value=``,await p.refresh(),await _.syncDocAfterCreate(t),/\.(md|markdown|txt|svg)$/i.test(t)&&await _.loadDoc(t)}catch(e){z.value=e instanceof Error?e.message:String(e)}finally{u.saving=!1}}}function _e(e){let t=e.target.files;t&&t.length>0&&(I.value=t[0])}let ve=t(()=>(m.agents??[]).filter(e=>e.enabled)),ye=t(()=>m.agentsMeta.clis??[]),be=t(()=>m.modelsFor($.cli,$.model||void 0)),xe=t(()=>(m.agents?.length?m.agents:[]).find(e=>e.enabled&&e.name===`pm`)??null),$=x({agent:``,cli:``,model:``});function Se(){let e=xe.value;$.agent=e?.name||``,$.cli=e?.cli||``,$.model=e?.model||``}let Ce=t(()=>{let e=xe.value;return e?$.agent!==e.name||$.cli!==e.cli||$.model!==e.model:!1}),Ye=t(()=>(F.value?p.outputs[F.value]??[]:[]).map(e=>`type`in e?{s:`out`,d:e.type===`text`?e.text:e.d??``}:{s:e.s===`err`?`err`:`out`,d:e.d})),Xe=h(null);S(Ye,()=>{ne(()=>{let e=Xe.value;e&&(e.scrollTop=e.scrollHeight)})});let Ze=h(null),Qe=h(null);function $e(e){Ze.value&&le(Ze.value,e)}function et(e){Qe.value&&le(Qe.value,e)}return(t,l)=>{let p=ee(`router-link`);return o(),c(ae,{open:v.value,"onUpdate:open":w},{default:C(()=>[e(B),e(oe,{style:s({width:D(u).drawerWidth+`px`,"max-width":`100vw`}),onOpenAutoFocus:O},{default:C(()=>[E(`div`,{class:`drawer-resize`,onMousedown:l[0]||=te((...e)=>D(u).startResize&&D(u).startResize(...e),[`prevent`])},null,32),E(`div`,we,[E(`div`,Te,[e(se,null,{default:C(()=>[...l[15]||=[y(`New doc`,-1)]]),_:1}),e(V,{class:`sr-only`},{default:C(()=>[...l[16]||=[y(`Create a new document`,-1)]]),_:1})]),e(U,{class:`close-x`},{default:C(()=>[e(D(R),{class:`size-[15px]`})]),_:1})]),E(`div`,Ee,[E(`button`,{type:`button`,class:i([`tab-btn`,{active:k.value===`freeform`}]),onClick:l[1]||=e=>k.value=`freeform`},` Freeform `,2),E(`button`,{type:`button`,class:i([`tab-btn`,{active:k.value===`manual`}]),onClick:l[2]||=e=>k.value=`manual`},` Manual `,2),E(`button`,{type:`button`,class:i([`tab-btn`,{active:k.value===`upload`}]),onClick:l[3]||=e=>k.value=`upload`},` Upload `,2)]),E(`div`,De,[k.value===`freeform`?(o(),n(f,{key:0},[E(`div`,Oe,[E(`div`,ke,[l[17]||=E(`label`,{for:`nd-freeform`},`Describe the document`,-1),e(G,{onTranscribed:$e})]),T(E(`textarea`,{id:`nd-freeform`,ref_key:`freeformTextarea`,ref:Ze,"onUpdate:modelValue":l[4]||=e=>j.value=e,class:`ff-textarea`,rows:`10`,placeholder:`Type the document description — like explaining what should be documented. The PM agent writes the document and chooses an appropriate path.`},null,512),[[g,j.value]])]),E(`div`,Ae,[E(`div`,je,[E(`div`,Me,[l[18]||=E(`label`,null,`Role`,-1),e(ue,{modelValue:$.agent,"onUpdate:modelValue":l[5]||=e=>$.agent=e,disabled:N.value},{default:C(()=>[e(q,{class:`h-[34px] w-full rounded-[9px] px-[11px]`},{default:C(()=>[e(fe,{placeholder:`agent`})]),_:1}),e(de,{position:`popper`},{default:C(()=>[e(Y,{class:`min-w-[var(--radix-select-trigger-width)]`},{default:C(()=>[(o(!0),n(f,null,a(ve.value,e=>(o(),c(J,{key:e.name,value:e.name},{default:C(()=>[y(b(e.name),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`modelValue`,`disabled`])]),E(`div`,Ne,[e(X,{"cli-options":ye.value,"model-options":be.value,"memory-key":`panel:new-doc`,cli:$.cli,"onUpdate:cli":l[6]||=e=>$.cli=e,model:$.model,"onUpdate:model":l[7]||=e=>$.model=e,disabled:N.value},null,8,[`cli-options`,`model-options`,`cli`,`model`,`disabled`])])])]),pe.value?r(``,!0):(o(),n(`div`,Pe,[l[20]||=y(` No PM agent is configured. `,-1),e(p,{to:{name:`agents`},onClick:l[8]||=e=>D(u).close()},{default:C(()=>[...l[19]||=[y(` Set one up on the Agents page `,-1)]]),_:1}),l[21]||=y(` — until then use the Manual doc tab. `,-1)])),M.value?(o(),n(`div`,Fe,b(M.value),1)):r(``,!0),E(`div`,Ie,[e(H,{variant:`outline`,onClick:l[9]||=e=>D(u).close()},{default:C(()=>[...l[22]||=[y(`Cancel`,-1)]]),_:1}),e(H,{variant:`default`,onClick:me,disabled:D(u).saving||!j.value.trim()},{default:C(()=>[N.value?(o(),c(ce,{key:0,activity:`agent`})):r(``,!0),y(` `+b(N.value?`Asking the PM agent…`:`Create document`),1)]),_:1},8,[`disabled`])]),Ye.value.length?(o(),n(`div`,Le,[E(`div`,Re,[e(ce,{activity:`agent`}),l[23]||=y(` PM agent `,-1)]),E(`div`,{class:`ff-stream-log`,ref_key:`ffLogEl`,ref:Xe},[(o(!0),n(f,null,a(Ye.value,(e,t)=>(o(),n(`div`,{key:t,class:i([`ff-stream-line`,e.s===`err`?`err`:``])},b(e.d),3))),128))],512)])):r(``,!0)],64)):k.value===`manual`?(o(),n(f,{key:1},[E(`div`,ze,[l[24]||=E(`label`,{for:`nd-path`},`File path`,-1),e(K,{id:`nd-path`,modelValue:D(u).nd.path,"onUpdate:modelValue":l[10]||=e=>D(u).nd.path=e,placeholder:`docs/my-document.md`,onKeyup:d(Q,[`enter`])},null,8,[`modelValue`])]),E(`div`,Be,[E(`div`,Ve,[l[25]||=E(`label`,{for:`nd-content`},`Content`,-1),e(G,{onTranscribed:et})]),T(E(`textarea`,{id:`nd-content`,ref_key:`docBodyTextarea`,ref:Qe,"onUpdate:modelValue":l[11]||=e=>D(u).nd.content=e,class:`doc-textarea`,rows:`15`,placeholder:`Enter the document content in Markdown format...`},null,512),[[g,D(u).nd.content]])]),E(`div`,He,[e(H,{variant:`outline`,onClick:l[12]||=e=>D(u).close()},{default:C(()=>[...l[26]||=[y(`Cancel`,-1)]]),_:1}),e(H,{variant:`default`,onClick:Q,disabled:D(u).saving||!D(u).nd.path||!D(u).nd.content},{default:C(()=>[...l[27]||=[y(` Create `,-1)]]),_:1},8,[`disabled`])])],64)):k.value===`upload`?(o(),n(f,{key:2},[E(`div`,Ue,[l[28]||=E(`label`,{for:`nd-upload-path`},`File path`,-1),e(K,{id:`nd-upload-path`,modelValue:L.value,"onUpdate:modelValue":l[13]||=e=>L.value=e,placeholder:`docs/my-document.md — or docs/design/assets/ to keep the filename`},null,8,[`modelValue`])]),E(`div`,We,[l[29]||=E(`label`,{for:`nd-upload-file`},`Select file`,-1),E(`input`,{id:`nd-upload-file`,type:`file`,class:`upload-input`,onChange:_e},null,32),I.value?(o(),n(`div`,Ge,[y(b(I.value.name)+` (`+b((I.value.size/1024).toFixed(1))+` KB) `,1),W.value?(o(),n(`span`,Ke,`→ `+b(W.value),1)):r(``,!0)])):r(``,!0)]),z.value?(o(),n(`div`,qe,b(z.value),1)):r(``,!0),E(`div`,Je,[e(H,{variant:`outline`,onClick:l[14]||=e=>D(u).close()},{default:C(()=>[...l[30]||=[y(`Cancel`,-1)]]),_:1}),e(H,{variant:`default`,onClick:ge,disabled:D(u).saving||!I.value||!L.value.trim()},{default:C(()=>[...l[31]||=[y(` Upload `,-1)]]),_:1},8,[`disabled`])])],64)):r(``,!0)])]),_:1},8,[`style`])]),_:1},8,[`open`])}}}),[[`__scopeId`,`data-v-073ec576`]]),Xe={class:`drawer-head`},Ze={class:`drawer-head-title`},Qe={class:`drawer-tabs`},$e={class:`drawer-body`},et={class:`field`},tt={class:`ff-agent-bar`},nt={key:0,class:`ff-notice`},rt={key:1,class:`ff-error`},it={class:`btn-row`,style:{"margin-top":`20px`}},at={key:2,class:`ff-stream`},ot={class:`ff-stream-head`},st={class:`field`},ct={key:0,class:`hint`},lt={class:`field`},ut={class:`field`},dt={key:0,class:`ff-error`},ft={class:`btn-row`,style:{"margin-top":`20px`}},pt={class:`field`},mt={key:0,class:`hint`},ht={class:`field`},gt={key:0,class:`upload-file-info`},_t={key:0,class:`ff-error`},vt={class:`btn-row`,style:{"margin-top":`20px`}},yt=M(v({__name:`NewSkillPanel`,setup(l){let u=re(),d=ie(),p=A(),m=P(),_=t(()=>u.isNewSkill);function v(e){e||u.close()}let w=h(`freeform`),O=h(``),k=h(``),j=h(!1),M=h(null),N=h(``),F=h(null),I=h(``),L=t(()=>!p.loaded||(p.agents??[]).some(e=>e.name===`pm`&&e.enabled)),z=t(()=>(p.agents??[]).find(e=>e.enabled&&e.name===`pm`)??null),W=x({cli:``,model:``});function G(){W.cli=z.value?.cli||``,W.model=z.value?.model||``}let le=t(()=>{let e=z.value;return e?W.cli!==e.cli||W.model!==e.model:!1}),ue=t(()=>p.agentsMeta.clis??[]),de=t(()=>p.modelsFor(W.cli,W.model||void 0)),q=t(()=>u.ns.name.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``));S(()=>u.isNewSkill,e=>{e&&(w.value=`freeform`,O.value=``,k.value=``,N.value=``,F.value=null,I.value=``,G())});async function J(e){u.close(),await d.refresh(),await m.loadSkills(),e&&await m.loadSkill(e)}async function Y(){let e=O.value.trim();if(e){u.saving=!0,j.value=!0,k.value=``,M.value&&d.clearOutput(M.value),M.value=Z();try{let t=le.value?{cli:W.cli,model:W.model}:void 0,n=await d.createFreeformSkill(e,M.value,t);O.value=``,await J(n.path)}catch(e){k.value=e instanceof Error?e.message:String(e)}finally{j.value=!1,M.value=null,u.saving=!1}}}async function fe(){if(!(!u.ns.name.trim()||!u.ns.description.trim()||!u.ns.content.trim())){u.saving=!0,N.value=``;try{await J((await d.createSkill({name:u.ns.name.trim(),description:u.ns.description.trim(),body:u.ns.content})).path)}catch(e){N.value=e instanceof Error?e.message:String(e)}finally{u.saving=!1}}}async function pe(){if(!(!F.value||!u.ns.name.trim())){u.saving=!0,I.value=``;try{let e=await F.value.text();await J((await d.createSkill({name:u.ns.name.trim(),content:e})).path)}catch(e){I.value=e instanceof Error?e.message:String(e)}finally{u.saving=!1}}}function me(e){let t=e.target.files;t&&t.length>0&&(F.value=t[0])}let Q=t(()=>(M.value?d.outputs[M.value]??[]:[]).map(e=>`type`in e?{s:`out`,d:e.type===`text`?e.text:e.d??``}:{s:e.s===`err`?`err`:`out`,d:e.d})),he=h(null);return S(Q,()=>{ne(()=>{let e=he.value;e&&(e.scrollTop=e.scrollHeight)})}),(t,l)=>{let d=ee(`router-link`);return o(),c(ae,{open:_.value,"onUpdate:open":v},{default:C(()=>[e(B),e(oe,{style:s({width:D(u).drawerWidth+`px`,"max-width":`100vw`})},{default:C(()=>[E(`div`,{class:`drawer-resize`,onMousedown:l[0]||=te((...e)=>D(u).startResize&&D(u).startResize(...e),[`prevent`])},null,32),E(`div`,Xe,[E(`div`,Ze,[e(se,null,{default:C(()=>[...l[15]||=[y(`New skill`,-1)]]),_:1}),e(V,{class:`sr-only`},{default:C(()=>[...l[16]||=[y(`Create a new skill`,-1)]]),_:1})]),e(U,{class:`close-x`},{default:C(()=>[e(D(R),{class:`size-[15px]`})]),_:1})]),E(`div`,Qe,[E(`button`,{type:`button`,class:i([`tab-btn`,{active:w.value===`freeform`}]),onClick:l[1]||=e=>w.value=`freeform`},` Freeform `,2),E(`button`,{type:`button`,class:i([`tab-btn`,{active:w.value===`manual`}]),onClick:l[2]||=e=>w.value=`manual`},` Manual `,2),E(`button`,{type:`button`,class:i([`tab-btn`,{active:w.value===`upload`}]),onClick:l[3]||=e=>w.value=`upload`},` Upload `,2)]),E(`div`,$e,[w.value===`freeform`?(o(),n(f,{key:0},[E(`div`,et,[l[17]||=E(`label`,{for:`ns-freeform`},`Describe the skill`,-1),T(E(`textarea`,{id:`ns-freeform`,"onUpdate:modelValue":l[4]||=e=>O.value=e,class:`ff-textarea`,rows:`10`,placeholder:`Describe what the skill should do and when an agent should reach for it. The PM agent writes the SKILL.md and picks the skills/<name>/ folder.`},null,512),[[g,O.value]])]),E(`div`,tt,[e(X,{"cli-options":ue.value,"model-options":de.value,"memory-key":`panel:new-skill`,cli:W.cli,"onUpdate:cli":l[5]||=e=>W.cli=e,model:W.model,"onUpdate:model":l[6]||=e=>W.model=e,disabled:j.value},null,8,[`cli-options`,`model-options`,`cli`,`model`,`disabled`])]),L.value?r(``,!0):(o(),n(`div`,nt,[l[19]||=y(` No PM agent is configured. `,-1),e(d,{to:{name:`agents`},onClick:l[7]||=e=>D(u).close()},{default:C(()=>[...l[18]||=[y(` Set one up on the Agents page `,-1)]]),_:1}),l[20]||=y(` — until then use the Manual tab. `,-1)])),k.value?(o(),n(`div`,rt,b(k.value),1)):r(``,!0),E(`div`,it,[e(H,{variant:`outline`,onClick:l[8]||=e=>D(u).close()},{default:C(()=>[...l[21]||=[y(`Cancel`,-1)]]),_:1}),e(H,{variant:`default`,onClick:Y,disabled:D(u).saving||!O.value.trim()},{default:C(()=>[j.value?(o(),c(ce,{key:0,activity:`agent`})):r(``,!0),y(` `+b(j.value?`Asking the PM agent…`:`Create skill`),1)]),_:1},8,[`disabled`])]),Q.value.length?(o(),n(`div`,at,[E(`div`,ot,[e(ce,{activity:`agent`}),l[22]||=y(` PM agent `,-1)]),E(`div`,{class:`ff-stream-log`,ref_key:`ffLogEl`,ref:he},[(o(!0),n(f,null,a(Q.value,(e,t)=>(o(),n(`div`,{key:t,class:i([`ff-stream-line`,e.s===`err`?`err`:``])},b(e.d),3))),128))],512)])):r(``,!0)],64)):w.value===`manual`?(o(),n(f,{key:1},[E(`div`,st,[l[23]||=E(`label`,{for:`ns-name`},`Skill name`,-1),e(K,{id:`ns-name`,modelValue:D(u).ns.name,"onUpdate:modelValue":l[9]||=e=>D(u).ns.name=e,placeholder:`my-skill`},null,8,[`modelValue`]),q.value?(o(),n(`div`,ct,`→ skills/`+b(q.value)+`/SKILL.md`,1)):r(``,!0)]),E(`div`,lt,[l[24]||=E(`label`,{for:`ns-desc`},`Description`,-1),e(K,{id:`ns-desc`,modelValue:D(u).ns.description,"onUpdate:modelValue":l[10]||=e=>D(u).ns.description=e,placeholder:`One line: when should an agent use this skill?`},null,8,[`modelValue`])]),E(`div`,ut,[l[25]||=E(`label`,{for:`ns-body`},`Instructions (Markdown)`,-1),T(E(`textarea`,{id:`ns-body`,"onUpdate:modelValue":l[11]||=e=>D(u).ns.content=e,class:`doc-textarea`,rows:`14`,placeholder:`# My skill
3
3
 
4
4
  What the agent should do when this skill is active...`},null,512),[[g,D(u).ns.content]])]),N.value?(o(),n(`div`,dt,b(N.value),1)):r(``,!0),E(`div`,ft,[e(H,{variant:`outline`,onClick:l[12]||=e=>D(u).close()},{default:C(()=>[...l[26]||=[y(`Cancel`,-1)]]),_:1}),e(H,{variant:`default`,onClick:fe,disabled:D(u).saving||!D(u).ns.name.trim()||!D(u).ns.description.trim()||!D(u).ns.content.trim()},{default:C(()=>[...l[27]||=[y(` Create `,-1)]]),_:1},8,[`disabled`])])],64)):(o(),n(f,{key:2},[E(`div`,pt,[l[28]||=E(`label`,{for:`ns-upload-name`},`Skill name`,-1),e(K,{id:`ns-upload-name`,modelValue:D(u).ns.name,"onUpdate:modelValue":l[13]||=e=>D(u).ns.name=e,placeholder:`my-skill`},null,8,[`modelValue`]),q.value?(o(),n(`div`,mt,`→ skills/`+b(q.value)+`/SKILL.md`,1)):r(``,!0)]),E(`div`,ht,[l[29]||=E(`label`,{for:`ns-upload-file`},`Select SKILL.md`,-1),E(`input`,{id:`ns-upload-file`,type:`file`,class:`upload-input`,onChange:me},null,32),F.value?(o(),n(`div`,gt,b(F.value.name)+` (`+b((F.value.size/1024).toFixed(1))+` KB) `,1)):r(``,!0)]),I.value?(o(),n(`div`,_t,b(I.value),1)):r(``,!0),E(`div`,vt,[e(H,{variant:`outline`,onClick:l[14]||=e=>D(u).close()},{default:C(()=>[...l[30]||=[y(`Cancel`,-1)]]),_:1}),e(H,{variant:`default`,onClick:pe,disabled:D(u).saving||!F.value||!D(u).ns.name.trim()},{default:C(()=>[...l[31]||=[y(` Upload `,-1)]]),_:1},8,[`disabled`])])],64))])]),_:1},8,[`style`])]),_:1},8,[`open`])}}}),[[`__scopeId`,`data-v-cf1524a6`]]),bt={class:`hist`},xt={class:`hist-toolbar`},St={class:`hist-field`},Ct={class:`hist-field hist-field-grow`},wt={class:`hist-docs-toggle`,title:`Task-status flips, activity entries, and other documentation bookkeeping commits.`},Tt={key:0,class:`hist-state`},Et={key:1,class:`hist-state hist-empty`},Dt={key:2,class:`hist-state hist-error`},Ot={key:3,class:`hist-state hist-empty`},kt={key:4,class:`hist-rail`,role:`list`},At={key:0,class:`hist-state hist-error`},jt={class:`hist-day-head`},Mt=[`onClick`],Nt=[`title`],Pt={class:`hist-main`},Ft={class:`hist-subject`},It={class:`hist-type`},Lt=[`onClick`],Rt={class:`hist-meta`},zt={class:`hist-aside`},Bt=[`title`,`onClick`],Vt=[`datetime`,`title`],Ht={key:0,class:`hist-detail`},Ut={key:0,class:`hist-body`},Wt={key:1,class:`hist-body hist-body-empty`},Gt={key:2,class:`hist-state hist-error`},Kt={key:3,class:`hist-files`},qt=[`onClick`],Jt={class:`hist-file-path`},Yt={class:`hist-file-add`},Xt={class:`hist-file-del`},Zt={key:0,class:`hist-body-empty`},Qt={key:4,class:`hist-state`},$t={class:`hist-more`},en={key:1,class:`hist-end`},tn=M(v({__name:`RepoHistoryPanel`,setup(s){let u=_(),ee=ie(),d=re(),p=h([]),m=h(`main`),g=h(``),v=h(``),x=h(``),w=h([]),T=h(null),ne=h(!1),A=h(!1),j=h(``),M=h(!1),P=h(null),F=h({}),I=h({}),L=h(null),R,z=h(!1),ae=t(()=>he(w.value));function oe(e){return e.outcome===`skipped`?{cls:`skip`,label:`no checks configured`}:e.passed?{cls:`pass`,label:`checks passed`}:{cls:`fail`,label:`checks failed`}}l(async()=>{await B(),M.value||await U(!1),z.value=!0}),S(g,()=>{z.value&&U(!1)});async function B(){try{let e=await k(`/api/repo/branches`);if(!e.ok){M.value=!0,j.value=e.error||`This folder is not a git repository.`;return}m.value=e.defaultBranch||`main`,p.value=e.branches?.length?e.branches:[m.value],g.value||=m.value}catch(e){j.value=e instanceof Error?e.message:`Could not load branches.`}}function V(e){let t=new URLSearchParams;return g.value&&t.set(`branch`,g.value),x.value&&t.set(`path`,x.value),d.historyShowDocsCommits&&t.set(`includeDocs`,`1`),t.set(`limit`,`50`),e&&t.set(`before`,e),`/api/repo/log?${t.toString()}`}function se(e){d.setHistoryShowDocsCommits(e),z.value&&U(!1)}async function U(e){e?A.value=!0:(ne.value=!0,w.value=[],T.value=null,P.value=null),j.value=``,M.value=!1;try{let t=await k(V(e?T.value:null));if(!t.ok){M.value=/not a git/i.test(t.error??``),j.value=t.error||`Could not load history.`;return}let n=t.commits??[];w.value=e?[...w.value,...n]:n,T.value=t.nextCursor??null}catch(e){e instanceof O&&e.status===400?j.value=e.message:j.value=e instanceof Error?e.message:`Could not load history.`}finally{ne.value=!1,A.value=!1}}function W(){x.value=v.value.trim().replace(/\/+$/,``),U(!1)}async function G(e){if(P.value===e.sha){P.value=null;return}if(P.value=e.sha,!F.value[e.sha])try{let t=await k(`/api/repo/commits/${encodeURIComponent(e.sha)}`);if(!t.ok){I.value={...I.value,[e.sha]:t.error||`Could not load commit.`};return}F.value={...F.value,[e.sha]:t}}catch(t){I.value={...I.value,[e.sha]:t instanceof Error?t.message:`Could not load commit.`}}}async function ce(e){try{await navigator.clipboard.writeText(e)}catch{}L.value=e,clearTimeout(R),R=setTimeout(()=>{L.value===e&&(L.value=null)},1200)}async function le(e){let t=ee.tasks.find(t=>t.id===e);if(t){await d.openTask(t);return}try{let t=await ee.fetchTask(e);await d.openTask(t)}catch{j.value=`Task #${e} is not on this board.`}}function X(e){return Q(e.subject)}function pe(e,t){u.push({name:`commit-diff`,params:{sha:e},query:t?{file:t}:{}})}return(t,s)=>(o(),n(`div`,bt,[E(`div`,xt,[E(`label`,St,[s[3]||=E(`span`,{class:`hist-label`},`Branch`,-1),e(ue,{modelValue:g.value,"onUpdate:modelValue":s[0]||=e=>g.value=e},{default:C(()=>[e(q,{class:`h-[34px] min-w-[180px] rounded-[9px] px-[11px]`,"aria-label":`Branch`},{default:C(()=>[e(fe,{placeholder:m.value},null,8,[`placeholder`])]),_:1}),e(de,{position:`popper`},{default:C(()=>[e(Y,{class:`min-w-[var(--radix-select-trigger-width)]`},{default:C(()=>[(o(!0),n(f,null,a(p.value,e=>(o(),c(J,{key:e,value:e},{default:C(()=>[y(b(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`modelValue`])]),E(`form`,{class:`hist-path`,onSubmit:te(W,[`prevent`])},[E(`label`,Ct,[s[4]||=E(`span`,{class:`hist-label`},`Path`,-1),e(K,{modelValue:v.value,"onUpdate:modelValue":s[1]||=e=>v.value=e,class:`h-[34px] py-0`,placeholder:`Filter by path, e.g. src/ui-app`,title:`A trailing slash is ignored. Paths must be relative (no ..).`,"aria-label":`Path filter`},null,8,[`modelValue`])]),e(H,{type:`submit`,variant:`ghost`,size:`sm`,class:`hist-apply`},{default:C(()=>[...s[5]||=[y(`Apply`,-1)]]),_:1})],32),E(`label`,wt,[e(ve,{checked:D(d).historyShowDocsCommits,"aria-label":`Show docs commits`,"onUpdate:checked":se},null,8,[`checked`]),s[6]||=E(`span`,{class:`hist-docs-label`},`Show docs commits`,-1)])]),ne.value?(o(),n(`div`,Tt,`Loading history…`)):M.value?(o(),n(`div`,Et,` This folder is not a git repository, so there is no commit history to show. `)):j.value&&!w.value.length?(o(),n(`div`,Dt,b(j.value),1)):w.value.length?(o(),n(`div`,kt,[j.value?(o(),n(`div`,At,b(j.value),1)):r(``,!0),(o(!0),n(f,null,a(ae.value,t=>(o(),n(`section`,{key:t.key,class:`hist-day`},[E(`header`,jt,[s[13]||=E(`span`,{class:`hist-tick`,"aria-hidden":`true`},null,-1),E(`h2`,null,b(t.label),1)]),(o(!0),n(f,null,a(t.commits,t=>(o(),n(`article`,{key:t.sha,class:i([`hist-commit`,{open:P.value===t.sha}]),role:`listitem`},[E(`button`,{class:`hist-row`,type:`button`,onClick:e=>G(t)},[s[15]||=E(`span`,{class:`hist-node`,"aria-hidden":`true`},null,-1),E(`span`,{class:`hist-avatar`,title:t.authorName},b(D(ge)(t.authorName)),9,Nt),E(`span`,Pt,[E(`span`,Ft,[X(t).taskId?(o(),n(f,{key:0},[E(`span`,It,b(X(t).type)+`(`,1),E(`a`,{class:`hist-task`,href:`#`,onClick:te(e=>le(X(t).taskId),[`prevent`,`stop`])},b(X(t).taskId),9,Lt),s[14]||=E(`span`,{class:`hist-type`},`):`,-1),y(` `+b(X(t).rest),1)],64)):(o(),n(f,{key:1},[y(b(t.subject),1)],64))]),E(`span`,Rt,[(o(!0),n(f,null,a(t.refs,e=>(o(),n(`span`,{key:e,class:i([`hist-ref`,{head:e===`HEAD`}])},b(e),3))),128)),t.check?(o(),n(`span`,{key:0,class:i([`hist-badge`,oe(t.check).cls])},b(oe(t.check).label),3)):r(``,!0)])]),E(`span`,zt,[E(`button`,{type:`button`,class:`hist-sha`,title:L.value===t.sha?`Copied`:t.sha,onClick:te(e=>ce(t.sha),[`stop`])},b(L.value===t.sha?`copied`:t.shortSha),9,Bt),E(`time`,{class:`hist-when`,datetime:t.date,title:t.date},b(D(N)(t.date)),9,Vt)])],8,Mt),P.value===t.sha?(o(),n(`div`,Ht,[t.body?(o(),n(`p`,Ut,b(t.body),1)):(o(),n(`p`,Wt,`No commit message body.`)),I.value[t.sha]?(o(),n(`div`,Gt,b(I.value[t.sha]),1)):F.value[t.sha]?(o(),n(`ul`,Kt,[(o(!0),n(f,null,a(F.value[t.sha].files,e=>(o(),n(`li`,{key:e.path},[E(`button`,{type:`button`,class:`hist-file`,onClick:n=>pe(t.sha,e.path)},[E(`span`,Jt,b(e.path),1),E(`span`,Yt,`+`+b(e.additions),1),E(`span`,Xt,`−`+b(e.deletions),1)],8,qt)]))),128)),F.value[t.sha].files.length?r(``,!0):(o(),n(`li`,Zt,`No file changes.`))])):(o(),n(`p`,Qt,`Loading changes…`)),e(H,{variant:`accent`,size:`sm`,class:`hist-open-diff`,onClick:e=>pe(t.sha)},{default:C(()=>[...s[16]||=[y(`Open diff`,-1)]]),_:1},8,[`onClick`])])):r(``,!0)],2))),128))]))),128)),E(`div`,$t,[T.value?(o(),c(H,{key:0,variant:`ghost`,disabled:A.value,onClick:s[2]||=e=>U(!0)},{default:C(()=>[y(b(A.value?`Loading…`:`Load more`),1)]),_:1},8,[`disabled`])):(o(),n(`span`,en,`End of history`))])])):(o(),n(`div`,Ot,[D(d).historyShowDocsCommits?x.value?(o(),n(f,{key:1},[y(` No commits touch that path on this branch. `)],64)):(o(),n(f,{key:2},[y(` No commits on this branch yet. `)],64)):(o(),n(f,{key:0},[x.value?(o(),n(f,{key:0},[s[7]||=y(` No non-docs commits touch that path on this branch. Turn on `,-1),s[8]||=E(`strong`,null,`Show docs commits`,-1),s[9]||=y(` above to include documentation bookkeeping. `,-1)],64)):(o(),n(f,{key:1},[s[10]||=y(` Documentation and task-status commits are hidden. Turn on `,-1),s[11]||=E(`strong`,null,`Show docs commits`,-1),s[12]||=y(` above to include them. `,-1)],64))],64))]))]))}}),[[`__scopeId`,`data-v-78827891`]]);function nn(e,t){let n=new Map(t.map(e=>[e.path,e.mtimeMs??0])),r=0,i=0,a=0;for(let[t,a]of n)e.has(t)?e.get(t)!==a&&i++:r++;for(let t of e.keys())n.has(t)||a++;return{added:r,changed:i,removed:a}}function rn(e){if(e.added===0&&e.changed===0&&e.removed===0)return`No changes`;let t=[];return e.added&&t.push(`${e.added} added`),e.changed&&t.push(`${e.changed} changed`),e.removed&&t.push(`${e.removed} removed`),t.join(`, `)}var an={id:`context-top`,class:`ctx-page`},on={class:`page-header`},sn={class:`page-header-actions ctx-header-actions`},cn={class:`ctx-tabs`},ln={key:1,class:`ctx-refresh-summary`,role:`status`},un={key:0,class:`hist-wrap`},dn={key:1,class:`repo-grid`},fn={key:0,class:`ctx-empty`},pn={key:1,class:`ctx-empty ctx-load-error`,role:`alert`},mn={key:2,class:`ctx-empty`},hn={key:3,class:`doc-tree`},gn={key:0,class:`ctx-refresh-error`},_n=[`onClick`],vn=[`aria-expanded`,`onClick`],yn={class:`dir-name`},bn={key:0,class:`ctx-empty`},xn=[`onClick`],Sn={class:`skill-name`},Cn={key:0,class:`skill-desc`},wn={class:`ctx-discover-head`},Tn={key:0,class:`ctx-refresh-error`,role:`alert`},En={key:1,class:`ctx-empty`},Dn=[`onClick`],On={class:`skill-name`},kn={class:`ctx-skill-meta`},An={key:0,class:`ctx-installed`},jn={key:0},Mn={class:`spec-head doc-view-head`},Nn={class:`doc-title`},Pn={class:`doc-path`},Fn=[`innerHTML`],In={key:1,style:{color:`var(--txt-faint)`}},Ln={key:0},Rn={class:`doc-title`},zn={class:`doc-path`},Bn={key:0,class:`skill-desc-line`},Vn=[`innerHTML`],Hn={key:1,style:{color:`var(--txt-faint)`}},Un={class:`doc-title`},Wn={class:`ctx-detail-meta`},Gn={class:`ctx-detail-copy`},Kn={key:0,class:`ctx-detail-copy`},qn={class:`ctx-detail-copy`},Jn={key:1,class:`ctx-review-check`},Yn={class:`ctx-detail-actions`},Xn=`Open this document in your configured editor`,Zn=M(v({__name:`ContextView`,setup(d){let v=P(),x=A(),te=ie(),O=re(),M=w(),N=_(),{docs:R,docsLoading:ae,docsLoadError:oe,selDoc:B,docContent:V,docTitle:se,skills:U,selSkill:G,skillContent:K,skillName:ce,skillDesc:le}=p(v),ue=[`docs`,`skills`,`discover`,`history`];function de(e){return typeof e==`string`&&ue.includes(e)?e:`docs`}let q=h(de(M.query.tab));function J(e){q.value=e;let t={...M.query};e===`docs`?delete t.tab:t.tab=e,N.replace({query:t})}let Y=h(``),fe=h([]),X=h(!1),Z=h(``),Q=h(null),he=h(null),ge=h(!1),_e=h(!1),ve=t(()=>new Set(U.value.map(e=>e.name)));async function ye(){X.value=!0,Z.value=``;try{let e=Y.value.trim().length>=2?`/api/skill-registry/search?q=${encodeURIComponent(Y.value.trim())}`:`/api/skill-registry/curated`;fe.value=(await k(e)).skills}catch(e){Z.value=e instanceof Error?e.message:`Skills.sh is unavailable`}finally{X.value=!1}}async function be(e){try{let t=await k(`/api/skill-registry/detail?id=${encodeURIComponent(e.id)}`);Q.value=t.detail,he.value=t.audit,ge.value=!1}catch(e){Z.value=e instanceof Error?e.message:`Could not load skill details`}}async function xe(){if(!(!Q.value||_e.value)){_e.value=!0,Z.value=``;try{await k(`/api/skill-registry/install`,j(`POST`,{id:Q.value.id})),await v.loadSkills()}catch(e){Z.value=e instanceof Error?e.message:`Could not install skill`}finally{_e.value=!1}}}function we(e){let t=U.value.find(t=>t.name===e);t&&(q.value=`skills`,v.loadSkill(t.path))}let Te=h(new Set),Ee=h(!1),De=h(``),Oe=h(``),ke,Ae=h(!1),je=h(null);function Me(){Ae.value=!0}function Ne(e){(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),Me())}function Pe(e){Oe.value=e,clearTimeout(ke),ke=setTimeout(()=>{Oe.value=``},5e3)}let Fe=h(null),Ie=e=>!!e&&/\.md$/i.test(e),Le=t(()=>W(V.value)),Re=t(()=>W(K.value)),ze=t(()=>{let e=x.data?.dev?.inspector,t=typeof e?.editorCommand==`string`?e.editorCommand.trim():``,n=!!t;if(n&&e?.enabled===!1)return!1;let r=typeof x.data?.editor?.command==`string`?(x.data?.editor).command.trim():``;return!(!(n?t:r)||n&&te.health?.copyInspectorAvailable!==!0)});async function Be(){let e=B.value;if(!(!e||!ze.value))try{await k(`/api/dev/open-in-editor`,j(`POST`,{file:e}))}catch(e){te.pushToast(e instanceof Error?e.message:`Could not open editor`,`error`)}}async function Ve(){await ne(),Fe.value&&await $(Fe.value)}S([V,K,q],()=>void Ve(),{flush:`post`}),l(()=>{Ve(),window.addEventListener(`keydown`,Ne)}),u(()=>{window.removeEventListener(`keydown`,Ne),clearTimeout(ke)}),S(q,e=>{e===`discover`&&!fe.value.length&&ye()});let He;S(Y,()=>{clearTimeout(He),He=setTimeout(()=>void ye(),250)});let Ue=t(()=>Ce(Se(R.value),Te.value));function We(e){Te.value.has(e)?Te.value.delete(e):Te.value.add(e)}function Ge(e){return{paddingLeft:`${8+e*16}px`}}async function Ke(){Ee.value=!0,De.value=``;let e=new Map(R.value.map(e=>[e.path,e.mtimeMs??0]));try{await v.loadDocs()?(Pe(rn(nn(e,R.value))),B.value&&!R.value.some(e=>e.path===B.value)&&(R.value.length?v.loadDoc(R.value[0].path):(B.value=null,V.value=``))):De.value=`Could not refresh docs. Try again in a moment.`}finally{Ee.value=!1}}function qe(){let e=typeof M.query.doc==`string`?M.query.doc:null;!e||!R.value.some(t=>t.path===e)||(q.value!==`docs`&&J(`docs`),B.value!==e&&v.loadDoc(e))}return S(()=>M.query.doc,()=>qe(),{immediate:!0}),S(R,()=>qe()),S(()=>M.query.tab,e=>{let t=de(e);q.value!==t&&(q.value=t)},{immediate:!0}),(t,l)=>{let u=ee(`router-link`);return o(),n(`div`,an,[E(`header`,on,[l[11]||=E(`div`,null,[E(`div`,{class:`page-title`},`Repo Context`),E(`div`,{class:`page-desc`},`AI-readable docs · ADRs · skills · history`)],-1),E(`div`,sn,[E(`button`,{ref_key:`contextSearchBtn`,ref:je,type:`button`,class:`ctx-search-trigger search-input`,"aria-label":`Search context docs and skills`,onClick:Me},[...l[9]||=[E(`svg`,{class:`search-ico`,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`},[E(`circle`,{cx:`11`,cy:`11`,r:`7`,stroke:`currentColor`,"stroke-width":`2`}),E(`path`,{d:`M20 20l-3.5-3.5`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`})],-1),E(`span`,{class:`search-placeholder hidden sm:inline`},`Search docs and skills…`,-1),E(`kbd`,null,`⌘K`,-1)]],512),q.value===`docs`||q.value===`skills`?(o(),c(H,{key:0,variant:`accent`,class:`new-btn`,onClick:l[0]||=e=>q.value===`docs`?D(O).openNewDoc():D(O).openNewSkill()},{default:C(()=>[l[10]||=E(`svg`,{viewBox:`0 0 24 24`,fill:`none`},[E(`path`,{d:`M12 5v14M5 12h14`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`})],-1),y(` `+b(q.value===`docs`?`New doc`:`New skill`),1)]),_:1})):r(``,!0)])]),e(me,{open:Ae.value,"onUpdate:open":l[1]||=e=>Ae.value=e,scope:`context`,"return-focus-el":je.value},null,8,[`open`,`return-focus-el`]),E(`div`,cn,[E(`button`,{class:i([`ctx-tab`,{on:q.value===`docs`}]),onClick:l[2]||=e=>J(`docs`)},`Docs`,2),E(`button`,{class:i([`ctx-tab`,{on:q.value===`skills`}]),onClick:l[3]||=e=>J(`skills`)},` Skills `,2),E(`button`,{class:i([`ctx-tab`,{on:q.value===`discover`}]),onClick:l[4]||=e=>J(`discover`)},` Discover `,2),E(`button`,{class:i([`ctx-tab`,{on:q.value===`history`}]),onClick:l[5]||=e=>J(`history`)},` History `,2),q.value===`docs`?(o(),c(H,{key:0,variant:`ghost`,size:`sm`,class:`ctx-refresh-btn`,disabled:Ee.value,title:`Refresh documentation`,onClick:Ke},{default:C(()=>[e(D(F),{class:i([`size-4`,{refreshing:Ee.value}])},null,8,[`class`])]),_:1},8,[`disabled`])):r(``,!0),Oe.value?(o(),n(`span`,ln,b(Oe.value),1)):r(``,!0)]),q.value===`history`?(o(),n(`div`,un,[e(pe,{class:`hist-card`},{default:C(()=>[e(tn)]),_:1})])):(o(),n(`div`,dn,[e(pe,{class:`doc-list`},{default:C(()=>[q.value===`docs`?(o(),n(f,{key:0},[D(ae)?(o(),n(`div`,fn,`Loading docs…`)):D(oe)?(o(),n(`div`,pn,[E(`div`,null,b(D(oe)),1),e(H,{variant:`outline`,size:`sm`,onClick:Ke},{default:C(()=>[...l[12]||=[y(`Retry`,-1)]]),_:1})])):D(R).length?(o(),n(`div`,hn,[De.value?(o(),n(`div`,gn,b(De.value),1)):r(``,!0),(o(!0),n(f,null,a(Ue.value,t=>(o(),n(f,{key:t.key},[t.isFile?(o(),n(`button`,{key:0,type:`button`,class:i([`tree-item tree-file`,{sel:D(B)===t.path}]),style:s(Ge(t.depth)),onClick:e=>D(v).loadDoc(t.path)},[e(D(L),{class:`size-4`}),E(`span`,null,b(t.name),1)],14,_n)):(o(),n(`button`,{key:1,type:`button`,class:`tree-item tree-dir`,"aria-expanded":Te.value.has(t.key),style:s(Ge(t.depth)),onClick:e=>We(t.key)},[Te.value.has(t.key)?(o(),c(D(I),{key:0,class:`size-4 chevron`})):(o(),c(D(z),{key:1,class:`size-4 chevron`})),E(`span`,yn,b(t.name),1)],12,vn))],64))),128))])):(o(),n(`div`,mn,[...l[13]||=[y(` No docs found. Add a Markdown file under `,-1),E(`code`,null,`docs/`,-1),y(`, then select the refresh button above. `,-1)]]))],64)):q.value===`skills`?(o(),n(f,{key:1},[D(U).length?r(``,!0):(o(),n(`div`,bn,[...l[14]||=[y(` No skills yet — add a `,-1),E(`code`,null,`skills/<name>/SKILL.md`,-1),y(`. `,-1)]])),(o(!0),n(f,null,a(D(U),e=>(o(),n(`button`,{key:e.path,type:`button`,class:i([`skill-row`,{sel:D(G)===e.path}]),onClick:t=>D(v).loadSkill(e.path)},[E(`span`,Sn,[l[15]||=E(`svg`,{viewBox:`0 0 24 24`,fill:`none`},[E(`path`,{d:`M13 2L4.5 13.5H11L9.5 22 19.5 10H13L13 2z`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linejoin":`round`})],-1),y(` `+b(e.name),1)]),e.description?(o(),n(`span`,Cn,b(e.description),1)):r(``,!0)],10,xn))),128))],64)):(o(),n(f,{key:2},[E(`div`,wn,[l[16]||=E(`strong`,null,`Skills.sh curated catalog`,-1),l[17]||=E(`span`,null,`Inspect files and audits before installing into this project.`,-1),T(E(`input`,{"onUpdate:modelValue":l[6]||=e=>Y.value=e,class:`ctx-skill-search`,placeholder:`Search skills`,"aria-label":`Filter skills`},null,512),[[g,Y.value]]),l[18]||=E(`span`,{class:`ctx-skill-search-hint`},`Type to filter skills`,-1)]),Z.value?(o(),n(`div`,Tn,[E(`span`,null,b(Z.value),1),l[19]||=E(`span`,{class:`ctx-error-next`},`Try again in a moment, or pick another skill.`,-1)])):X.value?(o(),n(`div`,En,`Loading Skills.sh…`)):r(``,!0),(o(!0),n(f,null,a(fe.value,e=>(o(),n(`button`,{key:e.id,type:`button`,class:i([`skill-row ctx-catalog-skill`,{sel:Q.value?.id===e.id}]),onClick:t=>be(e)},[E(`span`,On,b(e.name),1),E(`span`,kn,b(e.source)+` · `+b(e.installs.toLocaleString())+` installs`,1),ve.value.has(e.slug)?(o(),n(`span`,An,`Installed`)):r(``,!0)],10,Dn))),128))],64))]),_:1}),e(pe,{class:`doc-view`},{default:C(()=>[q.value===`docs`?(o(),n(f,{key:0},[D(V)?(o(),n(`div`,jn,[E(`div`,Mn,[E(`div`,null,[E(`div`,Nn,b(D(se)),1),E(`div`,Pn,b(D(B)),1)]),ze.value?(o(),n(`button`,{key:0,type:`button`,class:`page-help-link`,"data-test-id":`context-open-in-editor`,"aria-label":Xn,onClick:Be},` Open in editor ↗ `)):(o(),c(u,{key:1,class:`editor-config-hint`,"data-test-id":`context-open-in-editor-hint`,to:{path:`/settings`,query:{tab:`general`,section:`general`}},"aria-label":`Configure an editor in Settings → General to enable Open in editor`},{default:C(()=>[...l[20]||=[y(` Set editor in Settings → General `,-1)]]),_:1}))]),Ie(D(B))?(o(),n(`div`,{key:0,ref_key:`markdownRoot`,ref:Fe,class:`md-rendered`,innerHTML:Le.value},null,8,Fn)):(o(),n(f,{key:1},[y(b(D(V)),1)],64))])):(o(),n(`div`,In,`Select a document.`))],64)):q.value===`skills`?(o(),n(f,{key:1},[D(K)?(o(),n(`div`,Ln,[E(`div`,Rn,b(D(ce)),1),E(`div`,zn,b(D(G)),1),D(le)?(o(),n(`div`,Bn,b(D(le)),1)):r(``,!0),Ie(D(G))?(o(),n(`div`,{key:1,ref_key:`markdownRoot`,ref:Fe,class:`md-rendered`,innerHTML:Re.value},null,8,Vn)):(o(),n(f,{key:2},[y(b(D(K)),1)],64))])):(o(),n(`div`,Hn,`Select a skill.`))],64)):(o(),n(f,{key:2},[Q.value?(o(),n(f,{key:0},[E(`div`,Un,b(Q.value.slug),1),E(`div`,Wn,b(Q.value.source)+` · `+b(Q.value.installs.toLocaleString())+` installs · `+b(Q.value.hash??`unhashed`),1),E(`div`,Gn,[y(b(Q.value.files?.length??0)+` files will be copied into `,1),E(`code`,null,`skills/`+b(Q.value.slug)+`/`,1),l[21]||=y(` and locked in `,-1),l[22]||=E(`code`,null,`skills.lock.json`,-1),l[23]||=y(`. `,-1)]),he.value?.audits?.length?(o(),n(`div`,Kn,[l[25]||=E(`strong`,null,`Security audits`,-1),l[26]||=E(`br`,null,null,-1),(o(!0),n(f,null,a(he.value.audits,e=>(o(),n(`span`,{key:e.provider},[y(b(e.provider)+`: `+b(e.status)+` — `+b(e.summary),1),l[24]||=E(`br`,null,null,-1)]))),128))])):r(``,!0),E(`details`,qn,[l[27]||=E(`summary`,null,`Review files before installing`,-1),(o(!0),n(f,null,a(Q.value.files,e=>(o(),n(`pre`,{key:e.path},[E(`strong`,null,b(e.path),1),y(b(`
5
5
  `)+b(e.contents),1)]))),128))]),ve.value.has(Q.value.slug)?r(``,!0):(o(),n(`label`,Jn,[T(E(`input`,{"onUpdate:modelValue":l[7]||=e=>ge.value=e,type:`checkbox`},null,512),[[m,ge.value]]),l[28]||=y(` I reviewed these files and want to add this skill to the project. `,-1)])),E(`div`,Yn,[ve.value.has(Q.value.slug)?(o(),c(H,{key:0,variant:`accent`,onClick:l[8]||=e=>we(Q.value.slug)},{default:C(()=>[...l[29]||=[y(`Open installed skill`,-1)]]),_:1})):(o(),c(H,{key:1,variant:`accent`,disabled:_e.value||!ge.value,onClick:xe},{default:C(()=>[y(b(_e.value?`Installing…`:`Install to project`),1)]),_:1},8,[`disabled`]))])],64)):(o(),n(f,{key:1},[l[30]||=E(`div`,{class:`doc-title`},`Discover skills`,-1),l[31]||=E(`div`,{class:`skill-desc-line`},` Select a skill to inspect its exact files, content hash, publisher, and security audit before installing it. `,-1)],64))],64))]),_:1})])),e(Ye),e(yt)])}}}),[[`__scopeId`,`data-v-aeaafcf3`]]);export{Zn as default};