claude-yes 1.149.3 → 1.150.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ import "./ts-Cng1o5fC.js";
2
+ import "./logger-CDIsZ-Pp.js";
3
+ import "./versionChecker-CeVZzVQB.js";
4
+ import "./pidStore-fqXqTKkh.js";
5
+ import "./globalPidIndex-DlmmJlO8.js";
6
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-D8mK1P78.js";
7
+
8
+ export { SUPPORTED_CLIS };
@@ -1,8 +1,8 @@
1
- import { t as CLIS_CONFIG } from "./ts-DIrs0jef.js";
1
+ import { t as CLIS_CONFIG } from "./ts-Cng1o5fC.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-B52NvCuZ.js.map
8
+ //# sourceMappingURL=SUPPORTED_CLIS-D8mK1P78.js.map
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
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, r as getInstalledPackage, t as checkAndAutoUpdate } from "./versionChecker-D0pC8VFv.js";
4
+ import { i as versionString, n as displayVersion, r as getInstalledPackage, t as checkAndAutoUpdate } from "./versionChecker-CeVZzVQB.js";
5
5
  import { argv } from "process";
6
6
  import { execFileSync, spawn } from "child_process";
7
7
  import ms from "ms";
@@ -480,7 +480,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
480
480
  const rawArg = process.argv[2];
481
481
  const managerCommands = !invokedCliName(process.argv);
482
482
  const isHelpFlag = rawArg === "-h" || rawArg === "--help";
483
- const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-CU3G6_N5.js");
483
+ const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-BDftiFrp.js");
484
484
  if (isHelpFlag && process.argv.length === 3) {
485
485
  cmdHelp(managerCommands);
486
486
  process.exit(0);
@@ -513,7 +513,7 @@ if (config.useRust) {
513
513
  }
514
514
  }
515
515
  if (rustBinary) {
516
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-Cx4SPJk7.js");
516
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-BsjC_rd9.js");
517
517
  const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
518
518
  if (config.verbose) {
519
519
  console.log(`[rust] Using binary: ${rustBinary}`);
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts-DIrs0jef.js";
1
+ import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts-Cng1o5fC.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-D0pC8VFv.js";
3
+ import "./versionChecker-CeVZzVQB.js";
4
4
  import "./pidStore-fqXqTKkh.js";
5
5
  import "./globalPidIndex-DlmmJlO8.js";
6
6
 
@@ -1,9 +1,9 @@
1
- import "./ts-DIrs0jef.js";
1
+ import "./ts-Cng1o5fC.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-D0pC8VFv.js";
3
+ import "./versionChecker-CeVZzVQB.js";
4
4
  import "./pidStore-fqXqTKkh.js";
5
5
  import "./globalPidIndex-DlmmJlO8.js";
6
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-B52NvCuZ.js";
6
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-D8mK1P78.js";
7
7
  import { i as resolveSpawnCwd } from "./workspaceConfig-B9VX8tVO.js";
8
8
  import { createHash } from "node:crypto";
9
9
 
@@ -141,4 +141,4 @@ async function cmdSchedule(rest) {
141
141
 
142
142
  //#endregion
143
143
  export { cmdSchedule };
144
- //# sourceMappingURL=schedule-BBxvNa3v.js.map
144
+ //# sourceMappingURL=schedule-3FpLAXCx.js.map
@@ -1,16 +1,16 @@
1
- import "./ts-DIrs0jef.js";
1
+ import "./ts-Cng1o5fC.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import { r as getInstalledPackage } from "./versionChecker-D0pC8VFv.js";
3
+ import { r as getInstalledPackage } from "./versionChecker-CeVZzVQB.js";
4
4
  import "./pidStore-fqXqTKkh.js";
5
5
  import { a as updateGlobalPidStatus } from "./globalPidIndex-DlmmJlO8.js";
6
6
  import { t as pgidForWrapper } from "./reaper-C-eWAxIj.js";
7
7
  import "./configShared-C1C04bbq.js";
8
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-B52NvCuZ.js";
8
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-D8mK1P78.js";
9
9
  import "./e2e-ClOI_aqV.js";
10
10
  import "./webrtcLink-BWhuA74k.js";
11
11
  import "./remotes-qK6uozO4.js";
12
12
  import { i as resolveSpawnCwd, r as isProvisionAllowed, t as getProvisionRoot } from "./workspaceConfig-B9VX8tVO.js";
13
- import { C as snapshotStatus, T as writeToIpc, _ as readPtysize, b as resolveOne, c as extractTaskCounts, g as readNotes, i as controlCodeFromName, m as listRecords, o as deriveLiveStatus, v as renderRawLog } from "./subcommands-Dl8RuPbC.js";
13
+ import { C as snapshotStatus, T as writeToIpc, _ as readPtysize, b as resolveOne, c as extractTaskCounts, g as readNotes, i as controlCodeFromName, m as listRecords, o as deriveLiveStatus, v as renderRawLog } from "./subcommands-BtUKGF4n.js";
14
14
  import yargs from "yargs";
15
15
  import { mkdir, open, readFile, stat, writeFile } from "fs/promises";
16
16
  import { homedir, hostname, userInfo } from "os";
@@ -1046,8 +1046,37 @@ Options:
1046
1046
  const prompt = String(body.prompt ?? "");
1047
1047
  let cwd;
1048
1048
  let provisioned = null;
1049
+ const fork = body.fork && typeof body.fork.fromCwd === "string" && typeof body.fork.branch === "string" ? {
1050
+ fromCwd: body.fork.fromCwd,
1051
+ branch: body.fork.branch
1052
+ } : null;
1049
1053
  const from = typeof body.from === "string" ? body.from.trim() : "";
1050
- if (from) {
1054
+ if (fork) {
1055
+ let prov;
1056
+ try {
1057
+ prov = await import("codehost/provision");
1058
+ } catch (e) {
1059
+ return new Response(`fork needs the 'codehost' package (codehost/provision) — install it (npm i -g codehost) or 'bun link' it for local dev: ${e.message}`, { status: 501 });
1060
+ }
1061
+ let result;
1062
+ try {
1063
+ const wsRoot = getProvisionRoot();
1064
+ result = await prov.forkWorktree({
1065
+ fromCwd: fork.fromCwd,
1066
+ branch: fork.branch,
1067
+ ...wsRoot ? { wsRoot } : {}
1068
+ });
1069
+ } catch (e) {
1070
+ return new Response(`fork failed: ${e.message}`, { status: 502 });
1071
+ }
1072
+ if (!result?.ok) return new Response(result?.error ?? "fork failed", { status: 502 });
1073
+ if (result.spec && !isProvisionAllowed(result.spec.owner, result.spec.repo)) return new Response(`forking '${result.spec.owner}/${result.spec.repo}' is not allowed — add the owner to provisionAllowlist in ~/.agent-yes/config.json (or "*" to allow all)`, { status: 403 });
1074
+ cwd = result.folder;
1075
+ provisioned = {
1076
+ action: result.action,
1077
+ folder: result.folder
1078
+ };
1079
+ } else if (from) {
1051
1080
  let prov;
1052
1081
  try {
1053
1082
  prov = await import("codehost/provision");
@@ -1083,7 +1112,7 @@ Options:
1083
1112
  return new Response(`cannot create cwd ${cwd}: ${e.message}`, { status: 500 });
1084
1113
  }
1085
1114
  }
1086
- process.stderr.write(`→ console spawned: ay ${cli}${prompt ? ` -- "${prompt.slice(0, 60)}"` : ""} (cwd: ${cwd}${provisioned ? `, ${provisioned.action} from ${from}` : ""})\n`);
1115
+ process.stderr.write(`→ console spawned: ay ${cli}${prompt ? ` -- "${prompt.slice(0, 60)}"` : ""} (cwd: ${cwd}${provisioned ? `, ${provisioned.action}` : ""})\n`);
1087
1116
  const ayBin = Bun.which("ay") ?? process.argv[1];
1088
1117
  const ayCmd = process.platform === "win32" && ayBin.toLowerCase().endsWith(".exe") ? [ayBin] : [process.execPath, ayBin];
1089
1118
  try {
@@ -1230,4 +1259,4 @@ Options:
1230
1259
 
1231
1260
  //#endregion
1232
1261
  export { cmdServe };
1233
- //# sourceMappingURL=serve-CC4R9M3V.js.map
1262
+ //# sourceMappingURL=serve-plR3NUPH.js.map
@@ -32,7 +32,7 @@ async function cmdSetup(rest) {
32
32
  if (!existsSync(abs)) process.stderr.write(` note: that directory doesn't exist yet — create it, or agents spawned there will fail\n`);
33
33
  if (noShare) return 0;
34
34
  process.stdout.write(`\nsharing this machine to agent-yes.com…\n`);
35
- const { cmdServe } = await import("./serve-CC4R9M3V.js");
35
+ const { cmdServe } = await import("./serve-plR3NUPH.js");
36
36
  return cmdServe([
37
37
  "install",
38
38
  "--share",
@@ -42,4 +42,4 @@ async function cmdSetup(rest) {
42
42
 
43
43
  //#endregion
44
44
  export { cmdSetup };
45
- //# sourceMappingURL=setup-CKRssOuZ.js.map
45
+ //# sourceMappingURL=setup-BWGYyij8.js.map
@@ -4,6 +4,6 @@ import "./configShared-C1C04bbq.js";
4
4
  import "./e2e-ClOI_aqV.js";
5
5
  import "./webrtcLink-BWhuA74k.js";
6
6
  import "./remotes-qK6uozO4.js";
7
- import { C as snapshotStatus, S as runSubcommand, T as writeToIpc, _ as readPtysize, a as cursorAbs, b as resolveOne, c as extractTaskCounts, d as isExitRequest, f as isPidAlive, g as readNotes, h as matchKeyword, i as controlCodeFromName, l as finalizedLines, m as listRecords, n as READ_PAGE_DEFAULT, o as deriveLiveStatus, p as isSubcommand, r as cmdHelp, s as extractNeedsInput, t as GRACEFUL_EXIT_COMMANDS, u as isAgentStuck, v as renderRawLog, w as stopTipForCli, x as resolveReadWindow, y as renderRawLogLines } from "./subcommands-Dl8RuPbC.js";
7
+ import { C as snapshotStatus, S as runSubcommand, T as writeToIpc, _ as readPtysize, a as cursorAbs, b as resolveOne, c as extractTaskCounts, d as isExitRequest, f as isPidAlive, g as readNotes, h as matchKeyword, i as controlCodeFromName, l as finalizedLines, m as listRecords, n as READ_PAGE_DEFAULT, o as deriveLiveStatus, p as isSubcommand, r as cmdHelp, s as extractNeedsInput, t as GRACEFUL_EXIT_COMMANDS, u as isAgentStuck, v as renderRawLog, w as stopTipForCli, x as resolveReadWindow, y as renderRawLogLines } from "./subcommands-BtUKGF4n.js";
8
8
 
9
9
  export { cmdHelp, isSubcommand, runSubcommand };
@@ -554,15 +554,15 @@ async function runSubcommand(argv) {
554
554
  case "restart": return await cmdRestart(rest);
555
555
  case "note": return await cmdNote(rest);
556
556
  case "serve": {
557
- const { cmdServe } = await import("./serve-CC4R9M3V.js");
557
+ const { cmdServe } = await import("./serve-plR3NUPH.js");
558
558
  return cmdServe(rest);
559
559
  }
560
560
  case "setup": {
561
- const { cmdSetup } = await import("./setup-CKRssOuZ.js");
561
+ const { cmdSetup } = await import("./setup-BWGYyij8.js");
562
562
  return cmdSetup(rest);
563
563
  }
564
564
  case "schedule": {
565
- const { cmdSchedule } = await import("./schedule-BBxvNa3v.js");
565
+ const { cmdSchedule } = await import("./schedule-3FpLAXCx.js");
566
566
  return cmdSchedule(rest);
567
567
  }
568
568
  case "remote": {
@@ -2619,4 +2619,4 @@ async function cmdResultSet(rest) {
2619
2619
 
2620
2620
  //#endregion
2621
2621
  export { snapshotStatus as C, runSubcommand as S, writeToIpc as T, readPtysize as _, cursorAbs as a, resolveOne as b, extractTaskCounts as c, isExitRequest as d, isPidAlive as f, readNotes as g, matchKeyword as h, controlCodeFromName as i, finalizedLines as l, listRecords as m, READ_PAGE_DEFAULT as n, deriveLiveStatus as o, isSubcommand as p, cmdHelp as r, extractNeedsInput as s, GRACEFUL_EXIT_COMMANDS as t, isAgentStuck as u, renderRawLog as v, stopTipForCli as w, resolveReadWindow as x, renderRawLogLines as y };
2622
- //# sourceMappingURL=subcommands-Dl8RuPbC.js.map
2622
+ //# sourceMappingURL=subcommands-BtUKGF4n.js.map
@@ -1,5 +1,5 @@
1
1
  import { n as logger, t as addTransport } from "./logger-CDIsZ-Pp.js";
2
- import { r as getInstalledPackage } from "./versionChecker-D0pC8VFv.js";
2
+ import { r as getInstalledPackage } from "./versionChecker-CeVZzVQB.js";
3
3
  import { t as agentYesHome } from "./agentYesHome-_eJa3DaX.js";
4
4
  import { i as shouldUseLock, r as releaseLock, t as acquireLock } from "./runningLock-V4qvXgAw.js";
5
5
  import { t as PidStore } from "./pidStore-fqXqTKkh.js";
@@ -1802,4 +1802,4 @@ function sleep(ms) {
1802
1802
 
1803
1803
  //#endregion
1804
1804
  export { removeControlCharacters as a, AgentContext as i, agentYes as n, config as r, CLIS_CONFIG as t };
1805
- //# sourceMappingURL=ts-DIrs0jef.js.map
1805
+ //# sourceMappingURL=ts-Cng1o5fC.js.map
@@ -7,7 +7,7 @@ import { fileURLToPath } from "url";
7
7
 
8
8
  //#region package.json
9
9
  var name = "claude-yes";
10
- var version = "1.149.3";
10
+ var version = "1.150.0";
11
11
 
12
12
  //#endregion
13
13
  //#region ts/versionChecker.ts
@@ -215,4 +215,4 @@ async function displayVersion() {
215
215
 
216
216
  //#endregion
217
217
  export { versionString as i, displayVersion as n, getInstalledPackage as r, checkAndAutoUpdate as t };
218
- //# sourceMappingURL=versionChecker-D0pC8VFv.js.map
218
+ //# sourceMappingURL=versionChecker-CeVZzVQB.js.map
package/lab/ui/index.html CHANGED
@@ -3794,6 +3794,18 @@
3794
3794
  }, 120);
3795
3795
  }
3796
3796
 
3797
+ // Auto-derive a branch name from the typed prompt for the Cmd+K fork action
3798
+ // (editable at launch). e.g. "fix the auth bug" → "fork/fix-the-auth-bug".
3799
+ function forkSlug(q) {
3800
+ const s = q
3801
+ .toLowerCase()
3802
+ .replace(/[^a-z0-9]+/g, "-")
3803
+ .replace(/^-+|-+$/g, "")
3804
+ .slice(0, 40)
3805
+ .replace(/-+$/, "");
3806
+ return "fork/" + (s || "wip");
3807
+ }
3808
+
3797
3809
  function renderOmni() {
3798
3810
  const q = $("omni-input").value.trim();
3799
3811
  if (omniIdx >= omniRows.length) omniIdx = Math.max(0, omniRows.length - 1);
@@ -3809,6 +3821,22 @@
3809
3821
  <div class="omni-sub">${esc(anchor?.cwd || "(host default)")} &nbsp;·&nbsp; prompt: ${esc(q || "(empty)")}</div>
3810
3822
  </div></div>`;
3811
3823
  }
3824
+ if (r.kind === "fork") {
3825
+ return `<div class="omni-row omni-spawn${sc}" data-i="${i}">
3826
+ <span class="dot active"></span>
3827
+ <div class="omni-main">
3828
+ <div class="omni-title">⑂ Fork current branch &amp; run <span style="opacity:.55">(carries uncommitted work)</span></div>
3829
+ <div class="omni-sub">${esc(anchor?.cwd || "?")} &nbsp;→&nbsp; new branch <b>${esc(r.branch)}</b> &nbsp;·&nbsp; ⏎ to edit &amp; launch</div>
3830
+ </div></div>`;
3831
+ }
3832
+ if (r.kind === "spawncwd") {
3833
+ return `<div class="omni-row omni-spawn${sc}" data-i="${i}">
3834
+ <span class="dot active"></span>
3835
+ <div class="omni-main">
3836
+ <div class="omni-title">⊕ Spawn new ${esc(anchor?.cli || "claude")} agent in a directory…</div>
3837
+ <div class="omni-sub">⏎ to choose a working dir &nbsp;·&nbsp; prompt: ${esc(q || "(empty)")}</div>
3838
+ </div></div>`;
3839
+ }
3812
3840
  const e = r.entry;
3813
3841
  const snip = r.snippet ? `<div class="omni-snip">…${r.snippet}…</div>` : "";
3814
3842
  return `<div class="omni-row${sc}" data-i="${i}">
@@ -3837,7 +3865,12 @@
3837
3865
  )
3838
3866
  .slice(0, 30);
3839
3867
  omniRows = hits.map((entry) => ({ kind: "agent", entry }));
3840
- if (q) omniRows.push({ kind: "spawn" });
3868
+ if (q) {
3869
+ omniRows.push({ kind: "spawn" });
3870
+ const anchor = omniAnchor();
3871
+ if (anchor?.cwd) omniRows.push({ kind: "fork", branch: forkSlug(q) });
3872
+ omniRows.push({ kind: "spawncwd" });
3873
+ }
3841
3874
  omniIdx = 0;
3842
3875
  renderOmni();
3843
3876
  // Tier 2 — debounced output (tail) search for alive agents not already shown.
@@ -3902,8 +3935,9 @@
3902
3935
  async function omniActivate(forceSpawn) {
3903
3936
  const q = $("omni-input").value.trim();
3904
3937
  const row = omniRows[omniIdx];
3938
+ const anchor = omniAnchor();
3939
+ // ⌘⏎ always = spawn-here (the fast default), regardless of the selected row.
3905
3940
  if (forceSpawn || (row && row.kind === "spawn")) {
3906
- const anchor = omniAnchor();
3907
3941
  closeOmni(false); // committing — keep the bg as-is, spawnAndSelect takes over
3908
3942
  await spawnAndSelect(
3909
3943
  { cli: anchor?.cli || "claude", cwd: anchor?.cwd || undefined, prompt: q || undefined },
@@ -3911,6 +3945,31 @@
3911
3945
  );
3912
3946
  return;
3913
3947
  }
3948
+ if (row && row.kind === "fork") {
3949
+ // Editable at launch (auto-slug is the default); carries the anchor's WIP.
3950
+ const branch = prompt("Fork to a new branch (carries your uncommitted work):", row.branch);
3951
+ if (!branch || !branch.trim()) return; // cancelled — leave the omnibox open
3952
+ closeOmni(false);
3953
+ await spawnAndSelect(
3954
+ {
3955
+ cli: anchor?.cli || "claude",
3956
+ prompt: q || undefined,
3957
+ fork: { fromCwd: anchor?.cwd, branch: branch.trim() },
3958
+ },
3959
+ anchor?._room,
3960
+ );
3961
+ return;
3962
+ }
3963
+ if (row && row.kind === "spawncwd") {
3964
+ const cwd = prompt("Spawn in which working directory?", anchor?.cwd || "");
3965
+ if (cwd == null) return; // cancelled
3966
+ closeOmni(false);
3967
+ await spawnAndSelect(
3968
+ { cli: anchor?.cli || "claude", cwd: cwd.trim() || undefined, prompt: q || undefined },
3969
+ anchor?._room,
3970
+ );
3971
+ return;
3972
+ }
3914
3973
  if (row && row.kind === "agent") {
3915
3974
  closeOmni(false); // committing the previewed agent — don't restore the original
3916
3975
  select(row.entry._key);
@@ -4335,6 +4394,7 @@
4335
4394
  const res = await target.tx.post("/api/spawn", {
4336
4395
  cli: spec.cli || "claude",
4337
4396
  from: spec.from || undefined,
4397
+ fork: spec.fork || undefined,
4338
4398
  cwd: spec.cwd || undefined,
4339
4399
  prompt: spec.prompt || undefined,
4340
4400
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-yes",
3
- "version": "1.149.3",
3
+ "version": "1.150.0",
4
4
  "description": "A wrapper tool that automates interactions with various AI CLI tools by automatically handling common prompts and responses.",
5
5
  "keywords": [
6
6
  "ai",
package/ts/serve.ts CHANGED
@@ -1472,7 +1472,13 @@ export async function cmdServe(rest: string[]): Promise<number> {
1472
1472
  // standard); otherwise `cwd` is resolved against the workspace root and
1473
1473
  // created if missing (Layer-0 plain-dir provisioning — no more ENOENT 500).
1474
1474
  if (req.method === "POST" && p === "/api/spawn") {
1475
- let body: { cli?: string; cwd?: string; from?: string; prompt?: string };
1475
+ let body: {
1476
+ cli?: string;
1477
+ cwd?: string;
1478
+ from?: string;
1479
+ prompt?: string;
1480
+ fork?: { fromCwd?: string; branch?: string };
1481
+ };
1476
1482
  try {
1477
1483
  body = (await req.json()) as typeof body;
1478
1484
  } catch {
@@ -1488,8 +1494,61 @@ export async function cmdServe(rest: string[]): Promise<number> {
1488
1494
  // workspace root and mkdir-p'd so a missing dir no longer ENOENTs.
1489
1495
  let cwd: string;
1490
1496
  let provisioned: { action: string; folder: string } | null = null;
1497
+ const fork =
1498
+ body.fork && typeof body.fork.fromCwd === "string" && typeof body.fork.branch === "string"
1499
+ ? { fromCwd: body.fork.fromCwd, branch: body.fork.branch }
1500
+ : null;
1491
1501
  const from = typeof body.from === "string" ? body.from.trim() : "";
1492
- if (from) {
1502
+ if (fork) {
1503
+ // Fork the anchor agent's branch (carrying its WIP) into a new sibling
1504
+ // worktree via codehost/provision (git worktree off HEAD, no clone), then
1505
+ // spawn the agent there.
1506
+ let prov: {
1507
+ forkWorktree: (o: { fromCwd: string; branch: string; wsRoot?: string }) => Promise<{
1508
+ ok: boolean;
1509
+ folder: string;
1510
+ action: string;
1511
+ error?: string;
1512
+ spec?: { owner: string; repo: string };
1513
+ }>;
1514
+ };
1515
+ try {
1516
+ prov = (await import("codehost/provision")) as typeof prov;
1517
+ } catch (e) {
1518
+ return new Response(
1519
+ `fork needs the 'codehost' package (codehost/provision) — install it ` +
1520
+ `(npm i -g codehost) or 'bun link' it for local dev: ${(e as Error).message}`,
1521
+ { status: 501 },
1522
+ );
1523
+ }
1524
+ let result: {
1525
+ ok: boolean;
1526
+ folder: string;
1527
+ action: string;
1528
+ error?: string;
1529
+ spec?: { owner: string; repo: string };
1530
+ };
1531
+ try {
1532
+ const wsRoot = getProvisionRoot();
1533
+ result = await prov.forkWorktree({
1534
+ fromCwd: fork.fromCwd,
1535
+ branch: fork.branch,
1536
+ ...(wsRoot ? { wsRoot } : {}),
1537
+ });
1538
+ } catch (e) {
1539
+ return new Response(`fork failed: ${(e as Error).message}`, { status: 502 });
1540
+ }
1541
+ if (!result?.ok) return new Response(result?.error ?? "fork failed", { status: 502 });
1542
+ // Same allowlist gate as `from` — the fork runs setup-repo.sh (code exec).
1543
+ if (result.spec && !isProvisionAllowed(result.spec.owner, result.spec.repo))
1544
+ return new Response(
1545
+ `forking '${result.spec.owner}/${result.spec.repo}' is not allowed — add the owner ` +
1546
+ `to provisionAllowlist in ~/.agent-yes/config.json (or "*" to allow all)`,
1547
+ { status: 403 },
1548
+ );
1549
+ cwd = result.folder;
1550
+ provisioned = { action: result.action, folder: result.folder };
1551
+ } else if (from) {
1493
1552
  type Spec = { owner: string; repo: string; branch: string };
1494
1553
  let prov: {
1495
1554
  parseSource?: (s: string) => Spec | null;
@@ -1547,7 +1606,7 @@ export async function cmdServe(rest: string[]): Promise<number> {
1547
1606
  }
1548
1607
  }
1549
1608
  process.stderr.write(
1550
- `→ console spawned: ay ${cli}${prompt ? ` -- "${prompt.slice(0, 60)}"` : ""} (cwd: ${cwd}${provisioned ? `, ${provisioned.action} from ${from}` : ""})\n`,
1609
+ `→ console spawned: ay ${cli}${prompt ? ` -- "${prompt.slice(0, 60)}"` : ""} (cwd: ${cwd}${provisioned ? `, ${provisioned.action}` : ""})\n`,
1551
1610
  );
1552
1611
  // Resolve `ay` to an absolute command. The detached daemon (oxmgr/launchd/
1553
1612
  // pm2) usually has a PATH WITHOUT ~/.bun/bin, so a bare "ay" fails with
@@ -1,8 +0,0 @@
1
- import "./ts-DIrs0jef.js";
2
- import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-D0pC8VFv.js";
4
- import "./pidStore-fqXqTKkh.js";
5
- import "./globalPidIndex-DlmmJlO8.js";
6
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-B52NvCuZ.js";
7
-
8
- export { SUPPORTED_CLIS };