agent-yes 1.261.1 → 1.262.0-beta.626.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.
- package/dist/{SUPPORTED_CLIS-DGlkS83_.js → SUPPORTED_CLIS-DkxoCLoz.js} +2 -2
- package/dist/{SUPPORTED_CLIS-CUP5ABMb.js → SUPPORTED_CLIS-aLwUciKl.js} +3 -3
- package/dist/{agentShare-tL6j9Em4.js → agentShare-DRmd4F95.js} +2 -2
- package/dist/{callback-BfJqf5hh.js → callback-BYn4x_b3.js} +2 -2
- package/dist/{callback-JJh1_Zzp.js → callback-c7Oe2vIh.js} +3 -3
- package/dist/cli.js +5 -5
- package/dist/index.js +2 -2
- package/dist/{notifyDaemon-C1HL2AKc.js → notifyDaemon-DOtETcLA.js} +2 -2
- package/dist/{rustBinary-BBzI-0gG.js → rustBinary-pyF9zGmg.js} +2 -2
- package/dist/{schedule-DCR7zeRi.js → schedule-vg7zrUe9.js} +4 -4
- package/dist/{serve-DCPbGttS.js → serve-JL6zFz3h.js} +327 -16
- package/dist/{setup-DO75Uqec.js → setup-CFktAWaF.js} +2 -2
- package/dist/{subcommands-BSdA19Nv.js → subcommands-BQXIfCNL.js} +78 -17
- package/dist/subcommands-DOwbpkzb.js +10 -0
- package/dist/{terminal-CXIqdFAy.js → terminal-BO1dIvdc.js} +2 -2
- package/dist/{trayApp-DO9sPIPo.js → trayApp-B-LpxjEo.js} +2 -2
- package/dist/trayApp-Dul58eSZ.js +5 -0
- package/dist/{ts-BeFjrOhc.js → ts-B22KR56R.js} +2 -2
- package/dist/{versionChecker-d15cc3u7.js → versionChecker-D-TKJ1Y-.js} +2 -2
- package/dist/{widget-BFpPQNzh.js → widget-BZDtnQte.js} +3 -3
- package/dist/{ws-C7dDiQPE.js → ws-B--sMrM-.js} +2 -2
- package/dist/{ws-xrWDKWNS.js → ws-D6hRfHBF.js} +3 -3
- package/lab/ui/index.html +175 -4
- package/package.json +2 -1
- package/scripts/deepseek-codex.ts +580 -0
- package/ts/serve.spec.ts +36 -0
- package/ts/serve.ts +360 -4
- package/ts/subcommands.ts +109 -1
- package/dist/subcommands-C5qaj8cS.js +0 -10
- package/dist/trayApp-CpnLyvEB.js +0 -5
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as CLIS_CONFIG } from "./ts-
|
|
1
|
+
import { t as CLIS_CONFIG } from "./ts-B22KR56R.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-
|
|
8
|
+
//# sourceMappingURL=SUPPORTED_CLIS-DkxoCLoz.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import "./versionChecker-
|
|
3
|
-
import "./ts-
|
|
2
|
+
import "./versionChecker-D-TKJ1Y-.js";
|
|
3
|
+
import "./ts-B22KR56R.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-
|
|
9
|
+
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DkxoCLoz.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 {
|
|
6
|
+
import { L as resolveOne } from "./subcommands-BQXIfCNL.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-
|
|
232
|
+
//# sourceMappingURL=agentShare-DRmd4F95.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-
|
|
6
|
+
import "./subcommands-BQXIfCNL.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-
|
|
10
|
+
import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-c7Oe2vIh.js";
|
|
11
11
|
|
|
12
12
|
export { cmdCallback };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as agentYesHome } from "./agentYesHome-CtmsY6I-.js";
|
|
2
|
-
import {
|
|
2
|
+
import { L as resolveOne } from "./subcommands-BQXIfCNL.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-
|
|
75
|
+
const { resolveLocalServeUrl } = await import("./serve-JL6zFz3h.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-
|
|
190
|
+
//# sourceMappingURL=callback-c7Oe2vIh.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-
|
|
5
|
-
import { r as getRustBinary } from "./rustBinary-
|
|
4
|
+
import { i as versionString, n as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-D-TKJ1Y-.js";
|
|
5
|
+
import { r as getRustBinary } from "./rustBinary-pyF9zGmg.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-
|
|
298
|
+
const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken } = await import("./subcommands-DOwbpkzb.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-
|
|
308
|
+
const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-aLwUciKl.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-
|
|
359
|
+
const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-aLwUciKl.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-
|
|
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-
|
|
2
|
+
import "./versionChecker-D-TKJ1Y-.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-B22KR56R.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
|
|
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-BQXIfCNL.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-
|
|
839
|
+
//# sourceMappingURL=notifyDaemon-DOtETcLA.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as getInstalledPackage } from "./versionChecker-
|
|
1
|
+
import { r as getInstalledPackage } from "./versionChecker-D-TKJ1Y-.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-
|
|
246
|
+
//# sourceMappingURL=rustBinary-pyF9zGmg.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import "./versionChecker-
|
|
3
|
-
import "./ts-
|
|
2
|
+
import "./versionChecker-D-TKJ1Y-.js";
|
|
3
|
+
import "./ts-B22KR56R.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-
|
|
9
|
+
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DkxoCLoz.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-
|
|
156
|
+
//# sourceMappingURL=schedule-vg7zrUe9.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import { r as getInstalledPackage } from "./versionChecker-
|
|
3
|
-
import { t as findSpawnHiddenLauncher } from "./rustBinary-
|
|
4
|
-
import { c as permissionBadge, i as answerAsk, o as listAsks, u as CLAUDE_SESSION_PIN_ENV } from "./ts-
|
|
2
|
+
import { r as getInstalledPackage } from "./versionChecker-D-TKJ1Y-.js";
|
|
3
|
+
import { t as findSpawnHiddenLauncher } from "./rustBinary-pyF9zGmg.js";
|
|
4
|
+
import { c as permissionBadge, i as answerAsk, o as listAsks, u as CLAUDE_SESSION_PIN_ENV } from "./ts-B22KR56R.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-
|
|
15
|
-
import { A as
|
|
14
|
+
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DkxoCLoz.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-BQXIfCNL.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-
|
|
19
|
+
import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-c7Oe2vIh.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-
|
|
22
|
+
import { i as importProvisionModule } from "./ws-B--sMrM-.js";
|
|
23
23
|
import { r as spawnRejectionReason } from "./spawnGate-D-68B907.js";
|
|
24
|
-
import { i as launchTray } from "./trayApp-
|
|
24
|
+
import { i as launchTray } from "./trayApp-B-LpxjEo.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,63 @@ 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
|
+
function parseGitUrl(s) {
|
|
705
|
+
let host = "";
|
|
706
|
+
let pathPart = "";
|
|
707
|
+
const scp = /^git@([^:/\s]+):([^\s]+?)(?:\.git)?\/?$/.exec(s);
|
|
708
|
+
if (scp) {
|
|
709
|
+
host = scp[1];
|
|
710
|
+
pathPart = scp[2];
|
|
711
|
+
} else {
|
|
712
|
+
let u;
|
|
713
|
+
try {
|
|
714
|
+
u = new URL(s);
|
|
715
|
+
} catch {
|
|
716
|
+
return null;
|
|
717
|
+
}
|
|
718
|
+
if (!/^(https?|ssh|git)$/.test(u.protocol.replace(":", ""))) return null;
|
|
719
|
+
host = u.hostname;
|
|
720
|
+
pathPart = u.pathname.replace(/^\/+|\/+$/g, "").replace(/\.git$/, "");
|
|
721
|
+
}
|
|
722
|
+
if (/(^|\.)github\.com$/i.test(host)) return null;
|
|
723
|
+
const segs = pathPart.split("/").filter(Boolean);
|
|
724
|
+
if (segs.length < 2) return null;
|
|
725
|
+
const owner = segs[segs.length - 2];
|
|
726
|
+
const repo = segs[segs.length - 1].replace(/\.git$/, "");
|
|
727
|
+
if (!owner || !repo || owner === "." || owner === ".." || repo === "." || repo === "..") return null;
|
|
728
|
+
return {
|
|
729
|
+
url: s.replace(/\/+$/, ""),
|
|
730
|
+
owner,
|
|
731
|
+
repo
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
let ghRepoListMemo = null;
|
|
678
735
|
async function runProvisionHook(cwd, koho) {
|
|
679
736
|
const hook = getProvisionHook();
|
|
680
737
|
if (!hook) return { ran: false };
|
|
@@ -2368,7 +2425,7 @@ Options:
|
|
|
2368
2425
|
}
|
|
2369
2426
|
});
|
|
2370
2427
|
if (req.method === "GET" && p === "/api/ws") {
|
|
2371
|
-
const ws = await import("./ws-
|
|
2428
|
+
const ws = await import("./ws-D6hRfHBF.js");
|
|
2372
2429
|
try {
|
|
2373
2430
|
await ws.loadProvision();
|
|
2374
2431
|
} catch (e) {
|
|
@@ -2388,7 +2445,7 @@ Options:
|
|
|
2388
2445
|
if (req.method === "GET" && p === "/api/ws/status") {
|
|
2389
2446
|
const dirRaw = url.searchParams.get("path");
|
|
2390
2447
|
if (!dirRaw) return new Response("missing ?path=<workspace dir>", { status: 400 });
|
|
2391
|
-
const ws = await import("./ws-
|
|
2448
|
+
const ws = await import("./ws-D6hRfHBF.js");
|
|
2392
2449
|
let prov;
|
|
2393
2450
|
try {
|
|
2394
2451
|
prov = await ws.loadProvision();
|
|
@@ -2409,6 +2466,147 @@ Options:
|
|
|
2409
2466
|
return new Response(`git status failed: ${e.message}`, { status: 502 });
|
|
2410
2467
|
}
|
|
2411
2468
|
}
|
|
2469
|
+
if (req.method === "GET" && p === "/api/ws/repos") {
|
|
2470
|
+
const ws = await import("./ws-D6hRfHBF.js");
|
|
2471
|
+
try {
|
|
2472
|
+
await ws.loadProvision();
|
|
2473
|
+
} catch (e) {
|
|
2474
|
+
return new Response(e.message, { status: 501 });
|
|
2475
|
+
}
|
|
2476
|
+
let wsRoot;
|
|
2477
|
+
let workspaces;
|
|
2478
|
+
try {
|
|
2479
|
+
({wsRoot, workspaces} = await ws.collectWorkspaces());
|
|
2480
|
+
} catch (e) {
|
|
2481
|
+
return new Response(`workspace walk failed: ${e.message}`, { status: 500 });
|
|
2482
|
+
}
|
|
2483
|
+
const byRepo = /* @__PURE__ */ new Map();
|
|
2484
|
+
for (const w of workspaces) {
|
|
2485
|
+
const key = `${w.owner}/${w.repo}`;
|
|
2486
|
+
const entry = byRepo.get(key) ?? {
|
|
2487
|
+
owner: w.owner,
|
|
2488
|
+
repo: w.repo,
|
|
2489
|
+
local: true,
|
|
2490
|
+
branches: []
|
|
2491
|
+
};
|
|
2492
|
+
entry.branches.push({
|
|
2493
|
+
name: w.branch,
|
|
2494
|
+
path: w.path
|
|
2495
|
+
});
|
|
2496
|
+
byRepo.set(key, entry);
|
|
2497
|
+
}
|
|
2498
|
+
const gh = { ok: false };
|
|
2499
|
+
let ghRepos = [];
|
|
2500
|
+
const memo = ghRepoListMemo;
|
|
2501
|
+
if (memo && performance.now() - memo.t < 6e4) {
|
|
2502
|
+
gh.ok = memo.ok;
|
|
2503
|
+
if (memo.error) gh.error = memo.error;
|
|
2504
|
+
ghRepos = memo.repos;
|
|
2505
|
+
} else {
|
|
2506
|
+
const r = await runCapture([
|
|
2507
|
+
"gh",
|
|
2508
|
+
"repo",
|
|
2509
|
+
"list",
|
|
2510
|
+
"--limit",
|
|
2511
|
+
"200",
|
|
2512
|
+
"--json",
|
|
2513
|
+
"nameWithOwner"
|
|
2514
|
+
], { timeoutMs: 1e4 });
|
|
2515
|
+
if (r.ok) try {
|
|
2516
|
+
ghRepos = JSON.parse(r.stdout).map((x) => x.nameWithOwner);
|
|
2517
|
+
gh.ok = true;
|
|
2518
|
+
} catch {
|
|
2519
|
+
gh.error = "gh returned unparseable JSON";
|
|
2520
|
+
}
|
|
2521
|
+
else gh.error = (r.stderr.trim() || "gh unavailable").slice(0, 200);
|
|
2522
|
+
ghRepoListMemo = {
|
|
2523
|
+
t: performance.now(),
|
|
2524
|
+
ok: gh.ok,
|
|
2525
|
+
repos: ghRepos,
|
|
2526
|
+
error: gh.error
|
|
2527
|
+
};
|
|
2528
|
+
}
|
|
2529
|
+
for (const nameWithOwner of ghRepos) {
|
|
2530
|
+
const [owner, repo] = nameWithOwner.split("/");
|
|
2531
|
+
if (owner && repo && !byRepo.has(nameWithOwner)) byRepo.set(nameWithOwner, {
|
|
2532
|
+
owner,
|
|
2533
|
+
repo,
|
|
2534
|
+
local: false,
|
|
2535
|
+
branches: []
|
|
2536
|
+
});
|
|
2537
|
+
}
|
|
2538
|
+
const repos = [...byRepo.values()].sort((a, b) => a.local !== b.local ? a.local ? -1 : 1 : `${a.owner}/${a.repo}`.localeCompare(`${b.owner}/${b.repo}`));
|
|
2539
|
+
return Response.json({
|
|
2540
|
+
schema: ws.WS_JSON_SCHEMA,
|
|
2541
|
+
wsRoot,
|
|
2542
|
+
repos,
|
|
2543
|
+
gh
|
|
2544
|
+
});
|
|
2545
|
+
}
|
|
2546
|
+
if (req.method === "GET" && p === "/api/ws/branches") {
|
|
2547
|
+
const repoParam = url.searchParams.get("repo") ?? "";
|
|
2548
|
+
const m = /^([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)$/.exec(repoParam);
|
|
2549
|
+
if (!m || m[1] === "." || m[1] === ".." || m[2] === "." || m[2] === "..") return new Response("missing/invalid ?repo=<owner>/<repo>", { status: 400 });
|
|
2550
|
+
const [, owner, repo] = m;
|
|
2551
|
+
const ws = await import("./ws-D6hRfHBF.js");
|
|
2552
|
+
let prov;
|
|
2553
|
+
try {
|
|
2554
|
+
prov = await ws.loadProvision();
|
|
2555
|
+
} catch (e) {
|
|
2556
|
+
return new Response(e.message, { status: 501 });
|
|
2557
|
+
}
|
|
2558
|
+
const wsRoot = prov.resolveWsRoot(getProvisionRoot());
|
|
2559
|
+
const localByBranch = /* @__PURE__ */ new Map();
|
|
2560
|
+
try {
|
|
2561
|
+
for (const w of await ws.walkWorkspaces(wsRoot)) if (w.owner === owner && w.repo === repo) localByBranch.set(w.branch, w.path);
|
|
2562
|
+
} catch {}
|
|
2563
|
+
let remote = [];
|
|
2564
|
+
let source = "";
|
|
2565
|
+
let error;
|
|
2566
|
+
const anchor = localByBranch.values().next().value;
|
|
2567
|
+
if (anchor) {
|
|
2568
|
+
const r = await runCapture([
|
|
2569
|
+
"git",
|
|
2570
|
+
"-C",
|
|
2571
|
+
anchor,
|
|
2572
|
+
"ls-remote",
|
|
2573
|
+
"--heads",
|
|
2574
|
+
"origin"
|
|
2575
|
+
]);
|
|
2576
|
+
if (r.ok) {
|
|
2577
|
+
remote = [...r.stdout.matchAll(/\trefs\/heads\/(.+)/g)].map((x) => x[1].trim());
|
|
2578
|
+
source = "ls-remote";
|
|
2579
|
+
} else error = (r.stderr.trim() || "git ls-remote failed").slice(0, 200);
|
|
2580
|
+
}
|
|
2581
|
+
if (!source) {
|
|
2582
|
+
const r = await runCapture([
|
|
2583
|
+
"gh",
|
|
2584
|
+
"api",
|
|
2585
|
+
`repos/${owner}/${repo}/branches`,
|
|
2586
|
+
"--paginate",
|
|
2587
|
+
"--jq",
|
|
2588
|
+
".[].name"
|
|
2589
|
+
]);
|
|
2590
|
+
if (r.ok) {
|
|
2591
|
+
remote = r.stdout.split("\n").map((s) => s.trim()).filter(Boolean);
|
|
2592
|
+
source = "gh";
|
|
2593
|
+
error = void 0;
|
|
2594
|
+
} else if (!error) error = (r.stderr.trim() || "gh unavailable").slice(0, 200);
|
|
2595
|
+
}
|
|
2596
|
+
const branches = [...new Set([...remote, ...localByBranch.keys()])].sort((a, b) => a.localeCompare(b)).map((name) => ({
|
|
2597
|
+
name,
|
|
2598
|
+
remote: remote.includes(name),
|
|
2599
|
+
provisioned: localByBranch.has(name),
|
|
2600
|
+
...localByBranch.has(name) ? { path: localByBranch.get(name) } : {}
|
|
2601
|
+
}));
|
|
2602
|
+
return Response.json({
|
|
2603
|
+
schema: ws.WS_JSON_SCHEMA,
|
|
2604
|
+
repo: `${owner}/${repo}`,
|
|
2605
|
+
source: source || "local-only",
|
|
2606
|
+
branches,
|
|
2607
|
+
...error ? { error } : {}
|
|
2608
|
+
});
|
|
2609
|
+
}
|
|
2412
2610
|
if (req.method === "GET" && p === "/api/notes") {
|
|
2413
2611
|
const notes = await readNotes();
|
|
2414
2612
|
return Response.json(Object.fromEntries(notes));
|
|
@@ -3005,6 +3203,118 @@ Options:
|
|
|
3005
3203
|
action: result.action,
|
|
3006
3204
|
folder: result.folder
|
|
3007
3205
|
};
|
|
3206
|
+
} else if (from && parseGitUrl(from)) {
|
|
3207
|
+
const gitSrc = parseGitUrl(from);
|
|
3208
|
+
const branch = typeof body.branch === "string" ? body.branch.trim() : "";
|
|
3209
|
+
const badBranch = (b) => b.startsWith("-") || b.split("/").some((s) => !s || s === "." || s === "..");
|
|
3210
|
+
if (branch && badBranch(branch)) return new Response(`invalid branch name: ${branch}`, { status: 400 });
|
|
3211
|
+
const gitHook = await runProvisionHook(getProvisionRoot() ?? homedir(), {
|
|
3212
|
+
KOHO_ACTION: "from",
|
|
3213
|
+
KOHO_SOURCE: from,
|
|
3214
|
+
KOHO_OWNER: gitSrc.owner,
|
|
3215
|
+
KOHO_REPO: gitSrc.repo,
|
|
3216
|
+
KOHO_BRANCH: branch,
|
|
3217
|
+
KOHO_WS_ROOT: getProvisionRoot() ?? ""
|
|
3218
|
+
});
|
|
3219
|
+
if (gitHook.ran) {
|
|
3220
|
+
if (!gitHook.ok) return new Response(`provision hook denied '${gitSrc.owner}/${gitSrc.repo}' (exit ${gitHook.code})` + (gitHook.detail ? `:\n${gitHook.detail}` : ""), { status: 403 });
|
|
3221
|
+
} else if (!isProvisionAllowed(gitSrc.owner, gitSrc.repo)) return new Response(`provisioning '${gitSrc.owner}/${gitSrc.repo}' is not allowed — add the owner to provisionAllowlist in ~/.agent-yes/config.json (or "*" to allow all), or set a provisionHook to gate it yourself`, { status: 403 });
|
|
3222
|
+
const wsRootDir = getProvisionRoot() ?? path.join(homedir(), "ws");
|
|
3223
|
+
const base = path.join(wsRootDir, gitSrc.owner, gitSrc.repo, "tree");
|
|
3224
|
+
const destFor = (b) => path.join(base, b);
|
|
3225
|
+
if (branch && existsSync(path.join(destFor(branch), ".git"))) {
|
|
3226
|
+
cwd = destFor(branch);
|
|
3227
|
+
provisioned = {
|
|
3228
|
+
action: "existing",
|
|
3229
|
+
folder: cwd
|
|
3230
|
+
};
|
|
3231
|
+
} else {
|
|
3232
|
+
const tmp = path.join(base, `.clone-${process.pid}-${Date.now().toString(36)}`);
|
|
3233
|
+
try {
|
|
3234
|
+
await mkdir(base, { recursive: true });
|
|
3235
|
+
} catch (e) {
|
|
3236
|
+
return new Response(`cannot create ${base}: ${e.message}`, { status: 500 });
|
|
3237
|
+
}
|
|
3238
|
+
const cloneMs = 3e5;
|
|
3239
|
+
let created = false;
|
|
3240
|
+
let r = await runCapture(branch ? [
|
|
3241
|
+
"git",
|
|
3242
|
+
"clone",
|
|
3243
|
+
"--branch",
|
|
3244
|
+
branch,
|
|
3245
|
+
"--",
|
|
3246
|
+
gitSrc.url,
|
|
3247
|
+
tmp
|
|
3248
|
+
] : [
|
|
3249
|
+
"git",
|
|
3250
|
+
"clone",
|
|
3251
|
+
"--",
|
|
3252
|
+
gitSrc.url,
|
|
3253
|
+
tmp
|
|
3254
|
+
], { timeoutMs: cloneMs });
|
|
3255
|
+
if (!r.ok && branch && body.create === true) {
|
|
3256
|
+
await rm(tmp, {
|
|
3257
|
+
recursive: true,
|
|
3258
|
+
force: true
|
|
3259
|
+
}).catch(() => {});
|
|
3260
|
+
r = await runCapture([
|
|
3261
|
+
"git",
|
|
3262
|
+
"clone",
|
|
3263
|
+
"--",
|
|
3264
|
+
gitSrc.url,
|
|
3265
|
+
tmp
|
|
3266
|
+
], { timeoutMs: cloneMs });
|
|
3267
|
+
if (r.ok) {
|
|
3268
|
+
const co = await runCapture([
|
|
3269
|
+
"git",
|
|
3270
|
+
"-C",
|
|
3271
|
+
tmp,
|
|
3272
|
+
"checkout",
|
|
3273
|
+
"-b",
|
|
3274
|
+
branch
|
|
3275
|
+
]);
|
|
3276
|
+
if (!co.ok) r = co;
|
|
3277
|
+
else created = true;
|
|
3278
|
+
}
|
|
3279
|
+
}
|
|
3280
|
+
if (!r.ok) {
|
|
3281
|
+
await rm(tmp, {
|
|
3282
|
+
recursive: true,
|
|
3283
|
+
force: true
|
|
3284
|
+
}).catch(() => {});
|
|
3285
|
+
return new Response(`git clone failed: ${(r.stderr.trim() || "unknown").slice(0, 500)}` + (branch && body.create !== true ? "\n(if the branch doesn't exist yet, retry with create:true)" : ""), { status: 502 });
|
|
3286
|
+
}
|
|
3287
|
+
const head = await runCapture([
|
|
3288
|
+
"git",
|
|
3289
|
+
"-C",
|
|
3290
|
+
tmp,
|
|
3291
|
+
"rev-parse",
|
|
3292
|
+
"--abbrev-ref",
|
|
3293
|
+
"HEAD"
|
|
3294
|
+
]);
|
|
3295
|
+
let actual = branch || (head.ok ? head.stdout.trim() : "") || "main";
|
|
3296
|
+
if (badBranch(actual)) actual = "main";
|
|
3297
|
+
const dest = destFor(actual);
|
|
3298
|
+
if (existsSync(dest)) await rm(tmp, {
|
|
3299
|
+
recursive: true,
|
|
3300
|
+
force: true
|
|
3301
|
+
}).catch(() => {});
|
|
3302
|
+
else try {
|
|
3303
|
+
await mkdir(path.dirname(dest), { recursive: true });
|
|
3304
|
+
await rename(tmp, dest);
|
|
3305
|
+
} catch (e) {
|
|
3306
|
+
await rm(tmp, {
|
|
3307
|
+
recursive: true,
|
|
3308
|
+
force: true
|
|
3309
|
+
}).catch(() => {});
|
|
3310
|
+
return new Response(`cannot place checkout at ${dest}: ${e.message}`, { status: 500 });
|
|
3311
|
+
}
|
|
3312
|
+
cwd = dest;
|
|
3313
|
+
provisioned = {
|
|
3314
|
+
action: created ? "cloned+new-branch" : "cloned",
|
|
3315
|
+
folder: dest
|
|
3316
|
+
};
|
|
3317
|
+
}
|
|
3008
3318
|
} else if (from) {
|
|
3009
3319
|
let prov;
|
|
3010
3320
|
try {
|
|
@@ -3034,10 +3344,11 @@ Options:
|
|
|
3034
3344
|
try {
|
|
3035
3345
|
const wsRoot = getProvisionRoot();
|
|
3036
3346
|
result = await prov.provision(spec, wsRoot ? { wsRoot } : void 0);
|
|
3347
|
+
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
3348
|
} catch (e) {
|
|
3038
3349
|
return new Response(`provision failed: ${e.message}`, { status: 502 });
|
|
3039
3350
|
}
|
|
3040
|
-
if (!result?.ok) return new Response(result?.error ?? "provision failed", { status: 502 });
|
|
3351
|
+
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
3352
|
cwd = result.folder;
|
|
3042
3353
|
provisioned = {
|
|
3043
3354
|
action: result.action,
|
|
@@ -3145,7 +3456,7 @@ Options:
|
|
|
3145
3456
|
const perm = body.perm ?? "r";
|
|
3146
3457
|
if (perm !== "r" && perm !== "rw") return new Response(`invalid perm ${perm} (want r or rw)`, { status: 400 });
|
|
3147
3458
|
try {
|
|
3148
|
-
const { createScopedShare } = await import("./agentShare-
|
|
3459
|
+
const { createScopedShare } = await import("./agentShare-DRmd4F95.js");
|
|
3149
3460
|
const share = await createScopedShare({
|
|
3150
3461
|
agent: body.agent,
|
|
3151
3462
|
perm,
|
|
@@ -3160,12 +3471,12 @@ Options:
|
|
|
3160
3471
|
}
|
|
3161
3472
|
}
|
|
3162
3473
|
if (req.method === "GET" && p === "/api/shares") {
|
|
3163
|
-
const { listShares } = await import("./agentShare-
|
|
3474
|
+
const { listShares } = await import("./agentShare-DRmd4F95.js");
|
|
3164
3475
|
return Response.json(listShares());
|
|
3165
3476
|
}
|
|
3166
3477
|
const revokeM = /^\/api\/share\/([^/]+)$/.exec(p);
|
|
3167
3478
|
if (req.method === "DELETE" && revokeM) {
|
|
3168
|
-
const { revokeShare } = await import("./agentShare-
|
|
3479
|
+
const { revokeShare } = await import("./agentShare-DRmd4F95.js");
|
|
3169
3480
|
const ok = revokeShare(decodeURIComponent(revokeM[1]));
|
|
3170
3481
|
return new Response(ok ? "revoked" : "no such share", { status: ok ? 200 : 404 });
|
|
3171
3482
|
}
|
|
@@ -3467,7 +3778,7 @@ Options:
|
|
|
3467
3778
|
const shutdown = (resolve) => {
|
|
3468
3779
|
if (heartbeat) clearInterval(heartbeat);
|
|
3469
3780
|
closeShare?.();
|
|
3470
|
-
import("./agentShare-
|
|
3781
|
+
import("./agentShare-DRmd4F95.js").then((m) => m.revokeAllShares()).catch(() => {});
|
|
3471
3782
|
server?.stop();
|
|
3472
3783
|
Promise.resolve(releaseHostLock?.()).catch(() => {}).then(resolve);
|
|
3473
3784
|
};
|
|
@@ -3480,4 +3791,4 @@ Options:
|
|
|
3480
3791
|
|
|
3481
3792
|
//#endregion
|
|
3482
3793
|
export { cmdServe, loadTokenReadOnly, mintScopedTermToken, resolveDaemonHttpBase, resolveLocalServeUrl };
|
|
3483
|
-
//# sourceMappingURL=serve-
|
|
3794
|
+
//# sourceMappingURL=serve-JL6zFz3h.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-
|
|
43
|
+
const { cmdServe } = await import("./serve-JL6zFz3h.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-
|
|
53
|
+
//# sourceMappingURL=setup-CFktAWaF.js.map
|