agent-yes 1.261.0 → 1.262.0-beta.625.1

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 (31) hide show
  1. package/default.config.yaml +19 -1
  2. package/dist/{SUPPORTED_CLIS-C7FsxYKo.js → SUPPORTED_CLIS-BFWn3Ch_.js} +2 -2
  3. package/dist/{SUPPORTED_CLIS-DfL6KUv-.js → SUPPORTED_CLIS-DEjq_2pf.js} +3 -3
  4. package/dist/{agentShare-dgTDnrKQ.js → agentShare-BVKGlHMf.js} +2 -2
  5. package/dist/{callback-CgKU7Rrp.js → callback-CaBph6vJ.js} +2 -2
  6. package/dist/{callback-CM06pfRR.js → callback-le26KLuF.js} +3 -3
  7. package/dist/cli.js +5 -5
  8. package/dist/index.js +2 -2
  9. package/dist/{notifyDaemon-Bm4eQ69v.js → notifyDaemon-Bc2otuNE.js} +2 -2
  10. package/dist/{rustBinary-CMWOcL0R.js → rustBinary-BtGVAnEi.js} +2 -2
  11. package/dist/{schedule-C-ms-GAN.js → schedule-D1_zb-h7.js} +4 -4
  12. package/dist/{serve-B3hSz4DR.js → serve-COtnS9Hg.js} +185 -16
  13. package/dist/{setup-DNRepDra.js → setup-Czv0Hcd5.js} +2 -2
  14. package/dist/{subcommands-BoeWdX75.js → subcommands-B7TiSxUt.js} +78 -17
  15. package/dist/subcommands-kxK5fpF5.js +10 -0
  16. package/dist/{terminal-CrpyA-PX.js → terminal-BYFT2uG0.js} +2 -2
  17. package/dist/{trayApp-DCs0VI2Y.js → trayApp-cw25cAyO.js} +2 -2
  18. package/dist/trayApp-x_s_GmCl.js +5 -0
  19. package/dist/{ts-DvJMM3RY.js → ts-DHyghJ6S.js} +2 -2
  20. package/dist/{versionChecker-CUUvftlb.js → versionChecker-DlmgNzef.js} +2 -2
  21. package/dist/{widget-Bl-qcyxZ.js → widget-Di4RbxAl.js} +3 -3
  22. package/dist/{ws-CkE0e91M.js → ws-B_2CvwjK.js} +2 -2
  23. package/dist/{ws-BOtPIQ5j.js → ws-D267JE5o.js} +3 -3
  24. package/lab/ui/index.html +108 -2
  25. package/package.json +2 -1
  26. package/scripts/deepseek-codex.ts +580 -0
  27. package/ts/configShared.spec.ts +22 -0
  28. package/ts/serve.ts +216 -3
  29. package/ts/subcommands.ts +109 -1
  30. package/dist/subcommands-BcQONC2P.js +0 -10
  31. package/dist/trayApp-eemvFc-k.js +0 -5
@@ -535,10 +535,28 @@ clis:
535
535
 
536
536
  opencode:
537
537
  help: https://opencode.ai/
538
+ # opencode's positional arg is a PROJECT DIRECTORY, not a prompt — passing
539
+ # one makes it try to `cd` into it and die. The prompt goes via --prompt,
540
+ # which starts the TUI with the message already sent.
541
+ promptArg: --prompt
538
542
  install:
539
543
  bash: "curl -fsSL https://opencode.ai/install | bash"
540
544
  npm: "npm i -g opencode-ai"
541
- enter: []
545
+ enter:
546
+ # Permission confirm dialog ("△ Always allow — This will allow the
547
+ # following patterns until OpenCode is restarted"). Focus defaults to the
548
+ # Confirm button and the footer advertises "enter confirm" (verified live
549
+ # on OpenCode 1.18.15: a bare Enter accepted and the run resumed).
550
+ # Anchored on the dialog chrome — the "Always allow" heading plus the
551
+ # button row whose same line carries the "⇆ select enter confirm"
552
+ # footer — so prose merely mentioning Confirm/Cancel can't trigger it.
553
+ # [\s\S]{0,4000} spans the heading→button gap across the wide TUI rows.
554
+ - pattern: 'Always allow[\s\S]{0,4000}Confirm\s+Cancel[^\n]*⇆ select\s+enter confirm'
555
+ # Any other OpenCode confirm dialog (one the enter list doesn't auto-accept)
556
+ # still surfaces as needs_input instead of hanging silently.
557
+ needsInput:
558
+ - pattern: 'Confirm\s+Cancel[^\n]*⇆ select\s+enter confirm'
559
+ flags: m
542
560
  ready: []
543
561
 
544
562
  # Bare interactive shells. Unlike the agent CLIs above, these aren't AI tools
@@ -1,8 +1,8 @@
1
- import { t as CLIS_CONFIG } from "./ts-DvJMM3RY.js";
1
+ import { t as CLIS_CONFIG } from "./ts-DHyghJ6S.js";
2
2
 
3
3
  //#region ts/SUPPORTED_CLIS.ts
4
4
  const SUPPORTED_CLIS = Object.keys(CLIS_CONFIG);
5
5
 
6
6
  //#endregion
7
7
  export { SUPPORTED_CLIS as t };
8
- //# sourceMappingURL=SUPPORTED_CLIS-C7FsxYKo.js.map
8
+ //# sourceMappingURL=SUPPORTED_CLIS-BFWn3Ch_.js.map
@@ -1,11 +1,11 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./versionChecker-CUUvftlb.js";
3
- import "./ts-DvJMM3RY.js";
2
+ import "./versionChecker-DlmgNzef.js";
3
+ import "./ts-DHyghJ6S.js";
4
4
  import "./todoAutomation-BQRW614S.js";
5
5
  import "./JsonlStore-CPGIR0Wy.js";
6
6
  import "./globalPidIndex-pwp7Vb7o.js";
7
7
  import "./pidStore-DfSm1jog.js";
8
8
  import "./messageLog-BYFwioFY.js";
9
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-C7FsxYKo.js";
9
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-BFWn3Ch_.js";
10
10
 
11
11
  export { SUPPORTED_CLIS };
@@ -3,7 +3,7 @@ import "./globalPidIndex-pwp7Vb7o.js";
3
3
  import "./messageLog-BYFwioFY.js";
4
4
  import "./e2e-CUMZC53I.js";
5
5
  import "./configShared-DtHMBCl7.js";
6
- import { I as resolveOne } from "./subcommands-BoeWdX75.js";
6
+ import { L as resolveOne } from "./subcommands-B7TiSxUt.js";
7
7
  import "./webrtcLink-CS4D-3G1.js";
8
8
  import "./remotes-Cn-wszbK.js";
9
9
  import { a as startShare } from "./share-B-e_9WBx.js";
@@ -229,4 +229,4 @@ function transformEvent(rawEvent, agentId, forwarded) {
229
229
 
230
230
  //#endregion
231
231
  export { createScopedShare, listShares, revokeAllShares, revokeShare };
232
- //# sourceMappingURL=agentShare-dgTDnrKQ.js.map
232
+ //# sourceMappingURL=agentShare-BVKGlHMf.js.map
@@ -3,10 +3,10 @@ import "./globalPidIndex-pwp7Vb7o.js";
3
3
  import "./messageLog-BYFwioFY.js";
4
4
  import "./e2e-CUMZC53I.js";
5
5
  import "./configShared-DtHMBCl7.js";
6
- import "./subcommands-BoeWdX75.js";
6
+ import "./subcommands-B7TiSxUt.js";
7
7
  import "./webrtcLink-CS4D-3G1.js";
8
8
  import "./remotes-Cn-wszbK.js";
9
9
  import "./callbackCore-Cg3Ye0ZS.js";
10
- import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-CM06pfRR.js";
10
+ import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-le26KLuF.js";
11
11
 
12
12
  export { cmdCallback };
@@ -1,5 +1,5 @@
1
1
  import { t as agentYesHome } from "./agentYesHome-CtmsY6I-.js";
2
- import { I as resolveOne } from "./subcommands-BoeWdX75.js";
2
+ import { L as resolveOne } from "./subcommands-B7TiSxUt.js";
3
3
  import { a as mintCapability, o as parseExpires } from "./callbackCore-Cg3Ye0ZS.js";
4
4
  import { randomBytes } from "node:crypto";
5
5
  import { chmodSync, readFileSync, renameSync, writeFileSync } from "node:fs";
@@ -72,7 +72,7 @@ async function resolveBase(flag) {
72
72
  if (flag) return flag;
73
73
  if (process.env.AGENT_YES_CALLBACK_BASE) return process.env.AGENT_YES_CALLBACK_BASE;
74
74
  try {
75
- const { resolveLocalServeUrl } = await import("./serve-B3hSz4DR.js");
75
+ const { resolveLocalServeUrl } = await import("./serve-COtnS9Hg.js");
76
76
  const url = await resolveLocalServeUrl();
77
77
  if (url) return url;
78
78
  } catch {}
@@ -187,4 +187,4 @@ async function cmdCallback(rest) {
187
187
 
188
188
  //#endregion
189
189
  export { loadOrCreateCallbackSecret as i, isCallbackRevoked as n, loadCallbackSecretReadOnly as r, cmdCallback as t };
190
- //# sourceMappingURL=callback-CM06pfRR.js.map
190
+ //# sourceMappingURL=callback-le26KLuF.js.map
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env bun
2
2
  import { t as invokedCliName } from "./invokedCli-uqM2YYA7.js";
3
3
  import { n as logger } from "./logger-CDIsZ-Pp.js";
4
- import { i as versionString, n as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-CUUvftlb.js";
5
- import { r as getRustBinary } from "./rustBinary-CMWOcL0R.js";
4
+ import { i as versionString, n as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-DlmgNzef.js";
5
+ import { r as getRustBinary } from "./rustBinary-BtGVAnEi.js";
6
6
  import { argv } from "process";
7
7
  import { spawn } from "child_process";
8
8
  import ms from "ms";
@@ -295,7 +295,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
295
295
  const rawArg = process.argv[2];
296
296
  const managerCommands = !invokedCliName(process.argv);
297
297
  const isHelpFlag = rawArg === "-h" || rawArg === "--help";
298
- const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken } = await import("./subcommands-BcQONC2P.js");
298
+ const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken } = await import("./subcommands-kxK5fpF5.js");
299
299
  if (isHelpFlag && process.argv.length === 3) {
300
300
  await cmdHelp(managerCommands);
301
301
  process.exit(0);
@@ -305,7 +305,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
305
305
  process.exit(code ?? 0);
306
306
  }
307
307
  {
308
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-DfL6KUv-.js");
308
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-DEjq_2pf.js");
309
309
  if (isUnknownManagerToken(rawArg, managerCommands, SUPPORTED_CLIS)) {
310
310
  process.stderr.write(`ay: unknown subcommand or CLI '${rawArg}'.\n See 'ay help' for subcommands. To run an agent, name a CLI:\n 'ay <cli> …' (e.g. 'ay claude …') or 'ay --cli <cli> …'.\n`);
311
311
  process.exit(1);
@@ -356,7 +356,7 @@ if (config.useRust) {
356
356
  }
357
357
  }
358
358
  if (rustBinary) {
359
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-DfL6KUv-.js");
359
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-DEjq_2pf.js");
360
360
  const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
361
361
  if (config.verbose) {
362
362
  console.log(`[rust] Using binary: ${rustBinary}`);
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./versionChecker-CUUvftlb.js";
3
- import { a as hasTodoStore, i as answerAsk, l as AgentContext, n as agentYes, o as listAsks, r as config, s as listAsksForProject, t as CLIS_CONFIG } from "./ts-DvJMM3RY.js";
2
+ import "./versionChecker-DlmgNzef.js";
3
+ import { a as hasTodoStore, i as answerAsk, l as AgentContext, n as agentYes, o as listAsks, r as config, s as listAsksForProject, t as CLIS_CONFIG } from "./ts-DHyghJ6S.js";
4
4
  import { _ as isKnownKind, a as renderTree, b as statesOf, c as monitorHint, d as openStore, f as DONE_STATE, g as initialState, h as canTransition, i as renderDigest, l as CycleError, m as ORPHANED_STATE, o as unblockedTasks, p as LIFECYCLES, r as openBlockers, s as describeBlock, t as reconcileTodos, u as TodoStore, v as nextStates, x as removeControlCharacters, y as requiredGate } from "./todoAutomation-BQRW614S.js";
5
5
  import "./JsonlStore-CPGIR0Wy.js";
6
6
  import "./globalPidIndex-pwp7Vb7o.js";
@@ -3,7 +3,7 @@ import "./globalPidIndex-pwp7Vb7o.js";
3
3
  import "./messageLog-BYFwioFY.js";
4
4
  import "./e2e-CUMZC53I.js";
5
5
  import "./configShared-DtHMBCl7.js";
6
- import { $ as liveWatchers, J as appendEvent, N as renderLogTailLines, Q as listInboxParents, X as hostId, Y as gcInboxes, et as readInbox, it as notifyDir, l as deriveLiveState, nt as daemonLockDir, rt as daemonLockOwnerPath, tt as shouldStealLock, v as isPidAlive, w as listRecords } from "./subcommands-BoeWdX75.js";
6
+ import { $ as listInboxParents, P as renderLogTailLines, T as listRecords, X as gcInboxes, Y as appendEvent, Z as hostId, at as notifyDir, et as liveWatchers, it as daemonLockOwnerPath, nt as shouldStealLock, rt as daemonLockDir, tt as readInbox, u as deriveLiveState, y as isPidAlive } from "./subcommands-B7TiSxUt.js";
7
7
  import "./webrtcLink-CS4D-3G1.js";
8
8
  import "./remotes-Cn-wszbK.js";
9
9
  import { mkdir, readFile, rename, rm, stat, writeFile } from "fs/promises";
@@ -836,4 +836,4 @@ async function ensureDaemon() {
836
836
 
837
837
  //#endregion
838
838
  export { daemonStatus, ensureDaemon, requestDaemonStop, runDaemon };
839
- //# sourceMappingURL=notifyDaemon-Bm4eQ69v.js.map
839
+ //# sourceMappingURL=notifyDaemon-Bc2otuNE.js.map
@@ -1,4 +1,4 @@
1
- import { r as getInstalledPackage } from "./versionChecker-CUUvftlb.js";
1
+ import { r as getInstalledPackage } from "./versionChecker-DlmgNzef.js";
2
2
  import { execFileSync } from "child_process";
3
3
  import { existsSync, mkdirSync, unlinkSync } from "fs";
4
4
  import { chmod, copyFile } from "fs/promises";
@@ -243,4 +243,4 @@ async function getRustBinary(options = {}) {
243
243
 
244
244
  //#endregion
245
245
  export { findTrayLauncher as n, getRustBinary as r, findSpawnHiddenLauncher as t };
246
- //# sourceMappingURL=rustBinary-CMWOcL0R.js.map
246
+ //# sourceMappingURL=rustBinary-BtGVAnEi.js.map
@@ -1,12 +1,12 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./versionChecker-CUUvftlb.js";
3
- import "./ts-DvJMM3RY.js";
2
+ import "./versionChecker-DlmgNzef.js";
3
+ import "./ts-DHyghJ6S.js";
4
4
  import "./todoAutomation-BQRW614S.js";
5
5
  import "./JsonlStore-CPGIR0Wy.js";
6
6
  import "./globalPidIndex-pwp7Vb7o.js";
7
7
  import "./pidStore-DfSm1jog.js";
8
8
  import "./messageLog-BYFwioFY.js";
9
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-C7FsxYKo.js";
9
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-BFWn3Ch_.js";
10
10
  import { f as resolveSpawnCwd } from "./workspaceConfig-Bxuk_MOq.js";
11
11
  import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-vhOBffJ3.js";
12
12
  import { createHash } from "node:crypto";
@@ -153,4 +153,4 @@ async function cmdSchedule(rest) {
153
153
 
154
154
  //#endregion
155
155
  export { cmdSchedule };
156
- //# sourceMappingURL=schedule-C-ms-GAN.js.map
156
+ //# sourceMappingURL=schedule-D1_zb-h7.js.map
@@ -1,7 +1,7 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import { r as getInstalledPackage } from "./versionChecker-CUUvftlb.js";
3
- import { t as findSpawnHiddenLauncher } from "./rustBinary-CMWOcL0R.js";
4
- import { c as permissionBadge, i as answerAsk, o as listAsks, u as CLAUDE_SESSION_PIN_ENV } from "./ts-DvJMM3RY.js";
2
+ import { r as getInstalledPackage } from "./versionChecker-DlmgNzef.js";
3
+ import { t as findSpawnHiddenLauncher } from "./rustBinary-BtGVAnEi.js";
4
+ import { c as permissionBadge, i as answerAsk, o as listAsks, u as CLAUDE_SESSION_PIN_ENV } from "./ts-DHyghJ6S.js";
5
5
  import { t as agentYesHome$1 } from "./agentYesHome-CtmsY6I-.js";
6
6
  import { x as removeControlCharacters } from "./todoAutomation-BQRW614S.js";
7
7
  import "./JsonlStore-CPGIR0Wy.js";
@@ -11,17 +11,17 @@ import { r as recordInbox } from "./messageLog-BYFwioFY.js";
11
11
  import { t as pgidForWrapper } from "./reaper-C4BvNylH.js";
12
12
  import "./e2e-CUMZC53I.js";
13
13
  import "./configShared-DtHMBCl7.js";
14
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-C7FsxYKo.js";
15
- import { A as readPtysize, F as renderRawLogLines, I as resolveOne, M as recentReadEdges, N as renderLogTailLines, O as readLogForRender, P as renderRawLog, S as isUserTyping, V as snapshotStatus, Z as isTransientLockMkdirError, at as TYPING_BADGE, d as extractBadges, j as recentMessageEdges, k as readNotes, m as extractTaskCounts, p as extractNeedsInput, q as writeToIpc, s as controlCodeFromName, u as deriveLiveStatus, w as listRecords } from "./subcommands-BoeWdX75.js";
14
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-BFWn3Ch_.js";
15
+ import { A as readNotes, C as isUserTyping, F as renderRawLog, H as snapshotStatus, I as renderRawLogLines, J as writeToIpc, L as resolveOne, M as recentMessageEdges, N as recentReadEdges, P as renderLogTailLines, Q as isTransientLockMkdirError, T as listRecords, c as controlCodeFromName, d as deriveLiveStatus, f as extractBadges, h as extractTaskCounts, j as readPtysize, k as readLogForRender, m as extractNeedsInput, ot as TYPING_BADGE } from "./subcommands-B7TiSxUt.js";
16
16
  import "./webrtcLink-CS4D-3G1.js";
17
17
  import "./remotes-Cn-wszbK.js";
18
18
  import { i as frameVisitorMessage, s as verifyCapability, t as MAX_CALLBACK_MSG_BYTES } from "./callbackCore-Cg3Ye0ZS.js";
19
- import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-CM06pfRR.js";
19
+ import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-le26KLuF.js";
20
20
  import { a as getProvisionRoot, d as isProvisionAllowed, f as resolveSpawnCwd, i as getProvisionHook, l as hasProvisionHook, o as getSpawnHook, t as allowsSkipPermissions, u as hasSpawnHook } from "./workspaceConfig-Bxuk_MOq.js";
21
21
  import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-vhOBffJ3.js";
22
- import { i as importProvisionModule } from "./ws-CkE0e91M.js";
22
+ import { i as importProvisionModule } from "./ws-B_2CvwjK.js";
23
23
  import { r as spawnRejectionReason } from "./spawnGate-D-68B907.js";
24
- import { i as launchTray } from "./trayApp-DCs0VI2Y.js";
24
+ import { i as launchTray } from "./trayApp-cw25cAyO.js";
25
25
  import yargs from "yargs";
26
26
  import { appendFile, mkdir, open, readFile, readdir, rename, rm, stat, unlink, writeFile } from "fs/promises";
27
27
  import { arch, cpus, freemem, homedir, hostname, loadavg, platform, totalmem, uptime, userInfo } from "os";
@@ -675,6 +675,33 @@ function originOwnerRepo(cwd) {
675
675
  return null;
676
676
  }
677
677
  }
678
+ async function runCapture(argv, opts) {
679
+ try {
680
+ const child = Bun.spawn(argv, {
681
+ cwd: opts?.cwd,
682
+ env: freshAgentEnv(),
683
+ stdin: "ignore",
684
+ stdout: "pipe",
685
+ stderr: "pipe"
686
+ });
687
+ const timeoutMs = opts?.timeoutMs ?? 15e3;
688
+ const code = await Promise.race([child.exited, new Promise((r) => setTimeout(() => r(124), timeoutMs))]);
689
+ if (code === 124) child.kill();
690
+ const [stdout, stderr] = await Promise.all([new Response(child.stdout).text(), new Response(child.stderr).text()]);
691
+ return {
692
+ ok: code === 0,
693
+ stdout,
694
+ stderr
695
+ };
696
+ } catch (e) {
697
+ return {
698
+ ok: false,
699
+ stdout: "",
700
+ stderr: e.message
701
+ };
702
+ }
703
+ }
704
+ let ghRepoListMemo = null;
678
705
  async function runProvisionHook(cwd, koho) {
679
706
  const hook = getProvisionHook();
680
707
  if (!hook) return { ran: false };
@@ -2368,7 +2395,7 @@ Options:
2368
2395
  }
2369
2396
  });
2370
2397
  if (req.method === "GET" && p === "/api/ws") {
2371
- const ws = await import("./ws-BOtPIQ5j.js");
2398
+ const ws = await import("./ws-D267JE5o.js");
2372
2399
  try {
2373
2400
  await ws.loadProvision();
2374
2401
  } catch (e) {
@@ -2388,7 +2415,7 @@ Options:
2388
2415
  if (req.method === "GET" && p === "/api/ws/status") {
2389
2416
  const dirRaw = url.searchParams.get("path");
2390
2417
  if (!dirRaw) return new Response("missing ?path=<workspace dir>", { status: 400 });
2391
- const ws = await import("./ws-BOtPIQ5j.js");
2418
+ const ws = await import("./ws-D267JE5o.js");
2392
2419
  let prov;
2393
2420
  try {
2394
2421
  prov = await ws.loadProvision();
@@ -2409,6 +2436,147 @@ Options:
2409
2436
  return new Response(`git status failed: ${e.message}`, { status: 502 });
2410
2437
  }
2411
2438
  }
2439
+ if (req.method === "GET" && p === "/api/ws/repos") {
2440
+ const ws = await import("./ws-D267JE5o.js");
2441
+ try {
2442
+ await ws.loadProvision();
2443
+ } catch (e) {
2444
+ return new Response(e.message, { status: 501 });
2445
+ }
2446
+ let wsRoot;
2447
+ let workspaces;
2448
+ try {
2449
+ ({wsRoot, workspaces} = await ws.collectWorkspaces());
2450
+ } catch (e) {
2451
+ return new Response(`workspace walk failed: ${e.message}`, { status: 500 });
2452
+ }
2453
+ const byRepo = /* @__PURE__ */ new Map();
2454
+ for (const w of workspaces) {
2455
+ const key = `${w.owner}/${w.repo}`;
2456
+ const entry = byRepo.get(key) ?? {
2457
+ owner: w.owner,
2458
+ repo: w.repo,
2459
+ local: true,
2460
+ branches: []
2461
+ };
2462
+ entry.branches.push({
2463
+ name: w.branch,
2464
+ path: w.path
2465
+ });
2466
+ byRepo.set(key, entry);
2467
+ }
2468
+ const gh = { ok: false };
2469
+ let ghRepos = [];
2470
+ const memo = ghRepoListMemo;
2471
+ if (memo && performance.now() - memo.t < 6e4) {
2472
+ gh.ok = memo.ok;
2473
+ if (memo.error) gh.error = memo.error;
2474
+ ghRepos = memo.repos;
2475
+ } else {
2476
+ const r = await runCapture([
2477
+ "gh",
2478
+ "repo",
2479
+ "list",
2480
+ "--limit",
2481
+ "200",
2482
+ "--json",
2483
+ "nameWithOwner"
2484
+ ], { timeoutMs: 1e4 });
2485
+ if (r.ok) try {
2486
+ ghRepos = JSON.parse(r.stdout).map((x) => x.nameWithOwner);
2487
+ gh.ok = true;
2488
+ } catch {
2489
+ gh.error = "gh returned unparseable JSON";
2490
+ }
2491
+ else gh.error = (r.stderr.trim() || "gh unavailable").slice(0, 200);
2492
+ ghRepoListMemo = {
2493
+ t: performance.now(),
2494
+ ok: gh.ok,
2495
+ repos: ghRepos,
2496
+ error: gh.error
2497
+ };
2498
+ }
2499
+ for (const nameWithOwner of ghRepos) {
2500
+ const [owner, repo] = nameWithOwner.split("/");
2501
+ if (owner && repo && !byRepo.has(nameWithOwner)) byRepo.set(nameWithOwner, {
2502
+ owner,
2503
+ repo,
2504
+ local: false,
2505
+ branches: []
2506
+ });
2507
+ }
2508
+ const repos = [...byRepo.values()].sort((a, b) => a.local !== b.local ? a.local ? -1 : 1 : `${a.owner}/${a.repo}`.localeCompare(`${b.owner}/${b.repo}`));
2509
+ return Response.json({
2510
+ schema: ws.WS_JSON_SCHEMA,
2511
+ wsRoot,
2512
+ repos,
2513
+ gh
2514
+ });
2515
+ }
2516
+ if (req.method === "GET" && p === "/api/ws/branches") {
2517
+ const repoParam = url.searchParams.get("repo") ?? "";
2518
+ const m = /^([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)$/.exec(repoParam);
2519
+ if (!m || m[1] === "." || m[1] === ".." || m[2] === "." || m[2] === "..") return new Response("missing/invalid ?repo=<owner>/<repo>", { status: 400 });
2520
+ const [, owner, repo] = m;
2521
+ const ws = await import("./ws-D267JE5o.js");
2522
+ let prov;
2523
+ try {
2524
+ prov = await ws.loadProvision();
2525
+ } catch (e) {
2526
+ return new Response(e.message, { status: 501 });
2527
+ }
2528
+ const wsRoot = prov.resolveWsRoot(getProvisionRoot());
2529
+ const localByBranch = /* @__PURE__ */ new Map();
2530
+ try {
2531
+ for (const w of await ws.walkWorkspaces(wsRoot)) if (w.owner === owner && w.repo === repo) localByBranch.set(w.branch, w.path);
2532
+ } catch {}
2533
+ let remote = [];
2534
+ let source = "";
2535
+ let error;
2536
+ const anchor = localByBranch.values().next().value;
2537
+ if (anchor) {
2538
+ const r = await runCapture([
2539
+ "git",
2540
+ "-C",
2541
+ anchor,
2542
+ "ls-remote",
2543
+ "--heads",
2544
+ "origin"
2545
+ ]);
2546
+ if (r.ok) {
2547
+ remote = [...r.stdout.matchAll(/\trefs\/heads\/(.+)/g)].map((x) => x[1].trim());
2548
+ source = "ls-remote";
2549
+ } else error = (r.stderr.trim() || "git ls-remote failed").slice(0, 200);
2550
+ }
2551
+ if (!source) {
2552
+ const r = await runCapture([
2553
+ "gh",
2554
+ "api",
2555
+ `repos/${owner}/${repo}/branches`,
2556
+ "--paginate",
2557
+ "--jq",
2558
+ ".[].name"
2559
+ ]);
2560
+ if (r.ok) {
2561
+ remote = r.stdout.split("\n").map((s) => s.trim()).filter(Boolean);
2562
+ source = "gh";
2563
+ error = void 0;
2564
+ } else if (!error) error = (r.stderr.trim() || "gh unavailable").slice(0, 200);
2565
+ }
2566
+ const branches = [...new Set([...remote, ...localByBranch.keys()])].sort((a, b) => a.localeCompare(b)).map((name) => ({
2567
+ name,
2568
+ remote: remote.includes(name),
2569
+ provisioned: localByBranch.has(name),
2570
+ ...localByBranch.has(name) ? { path: localByBranch.get(name) } : {}
2571
+ }));
2572
+ return Response.json({
2573
+ schema: ws.WS_JSON_SCHEMA,
2574
+ repo: `${owner}/${repo}`,
2575
+ source: source || "local-only",
2576
+ branches,
2577
+ ...error ? { error } : {}
2578
+ });
2579
+ }
2412
2580
  if (req.method === "GET" && p === "/api/notes") {
2413
2581
  const notes = await readNotes();
2414
2582
  return Response.json(Object.fromEntries(notes));
@@ -3034,10 +3202,11 @@ Options:
3034
3202
  try {
3035
3203
  const wsRoot = getProvisionRoot();
3036
3204
  result = await prov.provision(spec, wsRoot ? { wsRoot } : void 0);
3205
+ if (!result?.ok && body.create === true && result?.reason === "branch-not-found" && typeof prov.createBranch === "function") result = await prov.createBranch(spec, wsRoot ? { wsRoot } : void 0);
3037
3206
  } catch (e) {
3038
3207
  return new Response(`provision failed: ${e.message}`, { status: 502 });
3039
3208
  }
3040
- if (!result?.ok) return new Response(result?.error ?? "provision failed", { status: 502 });
3209
+ if (!result?.ok) return new Response((result?.error ?? "provision failed") + (result?.reason === "branch-not-found" && body.create !== true ? "\n(branch missing on the remote — retry with create:true to branch off the default)" : ""), { status: 502 });
3041
3210
  cwd = result.folder;
3042
3211
  provisioned = {
3043
3212
  action: result.action,
@@ -3145,7 +3314,7 @@ Options:
3145
3314
  const perm = body.perm ?? "r";
3146
3315
  if (perm !== "r" && perm !== "rw") return new Response(`invalid perm ${perm} (want r or rw)`, { status: 400 });
3147
3316
  try {
3148
- const { createScopedShare } = await import("./agentShare-dgTDnrKQ.js");
3317
+ const { createScopedShare } = await import("./agentShare-BVKGlHMf.js");
3149
3318
  const share = await createScopedShare({
3150
3319
  agent: body.agent,
3151
3320
  perm,
@@ -3160,12 +3329,12 @@ Options:
3160
3329
  }
3161
3330
  }
3162
3331
  if (req.method === "GET" && p === "/api/shares") {
3163
- const { listShares } = await import("./agentShare-dgTDnrKQ.js");
3332
+ const { listShares } = await import("./agentShare-BVKGlHMf.js");
3164
3333
  return Response.json(listShares());
3165
3334
  }
3166
3335
  const revokeM = /^\/api\/share\/([^/]+)$/.exec(p);
3167
3336
  if (req.method === "DELETE" && revokeM) {
3168
- const { revokeShare } = await import("./agentShare-dgTDnrKQ.js");
3337
+ const { revokeShare } = await import("./agentShare-BVKGlHMf.js");
3169
3338
  const ok = revokeShare(decodeURIComponent(revokeM[1]));
3170
3339
  return new Response(ok ? "revoked" : "no such share", { status: ok ? 200 : 404 });
3171
3340
  }
@@ -3467,7 +3636,7 @@ Options:
3467
3636
  const shutdown = (resolve) => {
3468
3637
  if (heartbeat) clearInterval(heartbeat);
3469
3638
  closeShare?.();
3470
- import("./agentShare-dgTDnrKQ.js").then((m) => m.revokeAllShares()).catch(() => {});
3639
+ import("./agentShare-BVKGlHMf.js").then((m) => m.revokeAllShares()).catch(() => {});
3471
3640
  server?.stop();
3472
3641
  Promise.resolve(releaseHostLock?.()).catch(() => {}).then(resolve);
3473
3642
  };
@@ -3480,4 +3649,4 @@ Options:
3480
3649
 
3481
3650
  //#endregion
3482
3651
  export { cmdServe, loadTokenReadOnly, mintScopedTermToken, resolveDaemonHttpBase, resolveLocalServeUrl };
3483
- //# sourceMappingURL=serve-B3hSz4DR.js.map
3652
+ //# sourceMappingURL=serve-COtnS9Hg.js.map
@@ -40,7 +40,7 @@ async function cmdSetup(rest) {
40
40
  } catch {}
41
41
  if (noShare) return 0;
42
42
  process.stdout.write(`\nsharing this machine to agent-yes.com…\n`);
43
- const { cmdServe } = await import("./serve-B3hSz4DR.js");
43
+ const { cmdServe } = await import("./serve-COtnS9Hg.js");
44
44
  return cmdServe([
45
45
  "install",
46
46
  "--share",
@@ -50,4 +50,4 @@ async function cmdSetup(rest) {
50
50
 
51
51
  //#endregion
52
52
  export { cmdSetup };
53
- //# sourceMappingURL=setup-DNRepDra.js.map
53
+ //# sourceMappingURL=setup-Czv0Hcd5.js.map