@anhlp/alp-runtime 0.0.0-stage → 0.0.1-beta.10
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/LICENSE +202 -0
- package/NOTICE +7 -0
- package/README.md +6 -2
- package/dist/acp-transport.d.ts +130 -0
- package/dist/acp-transport.js +482 -0
- package/dist/antigravity-transport.d.ts +107 -0
- package/dist/antigravity-transport.js +665 -0
- package/dist/assignment-results.d.ts +55 -0
- package/dist/assignment-results.js +181 -0
- package/dist/attachments.d.ts +84 -0
- package/dist/attachments.js +213 -0
- package/dist/board-domain.d.ts +56 -0
- package/dist/board-domain.js +157 -0
- package/dist/board.d.ts +27 -0
- package/dist/board.js +76 -0
- package/dist/catalog.d.ts +44 -0
- package/dist/catalog.js +47 -0
- package/dist/claude-transport.d.ts +251 -0
- package/dist/claude-transport.js +931 -0
- package/dist/compact.d.ts +29 -0
- package/dist/compact.js +49 -0
- package/dist/configure.d.ts +44 -0
- package/dist/configure.js +64 -0
- package/dist/contracts.d.ts +378 -0
- package/dist/contracts.js +16 -0
- package/dist/conversation.d.ts +45 -0
- package/dist/conversation.js +62 -0
- package/dist/events.d.ts +1 -0
- package/dist/events.js +0 -0
- package/dist/github.d.ts +10 -0
- package/dist/github.js +39 -0
- package/dist/handoff.d.ts +36 -0
- package/dist/handoff.js +73 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +122 -0
- package/dist/input-limits.d.ts +25 -0
- package/dist/input-limits.js +48 -0
- package/dist/language.d.ts +51 -0
- package/dist/language.js +94 -0
- package/dist/live.d.ts +48 -0
- package/dist/live.js +50 -0
- package/dist/mailbox.d.ts +26 -0
- package/dist/mailbox.js +38 -0
- package/dist/mcp-tools.d.ts +123 -0
- package/dist/mcp-tools.js +97 -0
- package/dist/model-catalog.d.ts +162 -0
- package/dist/model-catalog.js +338 -0
- package/dist/model-probes.d.ts +7 -0
- package/dist/model-probes.js +69 -0
- package/dist/permission-path.d.ts +2 -0
- package/dist/permission-path.js +44 -0
- package/dist/process-info.d.ts +14 -0
- package/dist/process-info.js +32 -0
- package/dist/providers.d.ts +28 -0
- package/dist/providers.js +73 -0
- package/dist/recall.d.ts +42 -0
- package/dist/recall.js +61 -0
- package/dist/resolve.d.ts +123 -0
- package/dist/resolve.js +242 -0
- package/dist/runtime-context.d.ts +43 -0
- package/dist/runtime-context.js +61 -0
- package/dist/runtime.d.ts +13 -0
- package/dist/runtime.js +4818 -0
- package/dist/session-config.d.ts +2345 -0
- package/dist/session-config.js +209 -0
- package/dist/session-state.d.ts +190 -0
- package/dist/session-state.js +0 -0
- package/dist/skill-resources.d.ts +30 -0
- package/dist/skill-resources.js +55 -0
- package/dist/tool-detail.d.ts +81 -0
- package/dist/tool-detail.js +332 -0
- package/dist/tool-results.d.ts +12 -0
- package/dist/tool-results.js +25 -0
- package/dist/tools.d.ts +827 -0
- package/dist/tools.js +463 -0
- package/dist/transport.d.ts +47 -0
- package/dist/transport.js +171 -0
- package/dist/usage.d.ts +25 -0
- package/dist/usage.js +60 -0
- package/dist/workspace.d.ts +127 -0
- package/dist/workspace.js +340 -0
- package/dist/worktree-domain.d.ts +89 -0
- package/dist/worktree-domain.js +199 -0
- package/dist/write-error.d.ts +2 -0
- package/dist/write-error.js +10 -0
- package/package.json +262 -4
- package/src/acp-transport.ts +481 -0
- package/src/antigravity-transport.ts +740 -0
- package/src/assignment-results.ts +154 -0
- package/src/attachments.ts +254 -0
- package/src/board-domain.ts +185 -0
- package/src/board.ts +87 -0
- package/src/catalog.ts +43 -0
- package/src/claude-transport.ts +1097 -0
- package/src/compact.ts +62 -0
- package/src/configure.ts +93 -0
- package/src/contracts.ts +363 -0
- package/src/conversation.ts +81 -0
- package/src/events.ts +1 -0
- package/src/github.ts +37 -0
- package/src/handoff.ts +86 -0
- package/src/index.ts +41 -0
- package/src/input-limits.ts +65 -0
- package/src/language.ts +130 -0
- package/src/live.ts +90 -0
- package/src/mailbox.ts +49 -0
- package/src/mcp-tools.ts +106 -0
- package/src/model-catalog.ts +316 -0
- package/src/model-probes.ts +58 -0
- package/src/permission-path.ts +37 -0
- package/src/process-info.ts +40 -0
- package/src/providers.ts +87 -0
- package/src/recall.ts +86 -0
- package/src/resolve.ts +238 -0
- package/src/runtime-context.ts +49 -0
- package/src/runtime.ts +5608 -0
- package/src/session-config.ts +312 -0
- package/src/session-state.ts +180 -0
- package/src/skill-resources.ts +73 -0
- package/src/tool-detail.ts +397 -0
- package/src/tool-results.ts +26 -0
- package/src/tools.ts +466 -0
- package/src/transport.ts +118 -0
- package/src/usage.ts +79 -0
- package/src/workspace.ts +424 -0
- package/src/worktree-domain.ts +220 -0
- package/src/write-error.ts +4 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
// packages/runtime/src/workspace.ts
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
import { copyFile, lstat, mkdir, mkdtemp, readdir, readFile, realpath, rename, rm, stat, symlink, unlink, writeFile } from "node:fs/promises";
|
|
5
|
+
import os from "node:os";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
var IDENTITY = ["-c", "user.name=ALP", "-c", "user.email=alp@localhost", "-c", "commit.gpgsign=false"];
|
|
8
|
+
var GIT_CONTEXT = [
|
|
9
|
+
"GIT_DIR",
|
|
10
|
+
"GIT_WORK_TREE",
|
|
11
|
+
"GIT_INDEX_FILE",
|
|
12
|
+
"GIT_COMMON_DIR",
|
|
13
|
+
"GIT_OBJECT_DIRECTORY",
|
|
14
|
+
"GIT_ALTERNATE_OBJECT_DIRECTORIES",
|
|
15
|
+
"GIT_PREFIX",
|
|
16
|
+
"GIT_NAMESPACE",
|
|
17
|
+
"GIT_IMPLICIT_WORK_TREE",
|
|
18
|
+
"GIT_GRAFT_FILE",
|
|
19
|
+
"GIT_REPLACE_REF_BASE",
|
|
20
|
+
"GIT_NO_REPLACE_OBJECTS",
|
|
21
|
+
"GIT_SHALLOW_FILE",
|
|
22
|
+
"GIT_CONFIG",
|
|
23
|
+
"GIT_CONFIG_PARAMETERS",
|
|
24
|
+
"GIT_CONFIG_COUNT"
|
|
25
|
+
];
|
|
26
|
+
function gitEnvironment(env = process.env) {
|
|
27
|
+
const clean = { ...env, GIT_TERMINAL_PROMPT: "0" };
|
|
28
|
+
for (const key of Object.keys(clean)) {
|
|
29
|
+
if (GIT_CONTEXT.includes(key) || /^GIT_CONFIG_(KEY|VALUE)_\d+$/.test(key)) delete clean[key];
|
|
30
|
+
}
|
|
31
|
+
return clean;
|
|
32
|
+
}
|
|
33
|
+
function git(cwd, args, input) {
|
|
34
|
+
return new Promise((resolve, reject) => {
|
|
35
|
+
const child = spawn("git", args, { cwd, stdio: [input === void 0 ? "ignore" : "pipe", "pipe", "pipe"], windowsHide: true, env: gitEnvironment() });
|
|
36
|
+
let stdout = "";
|
|
37
|
+
let stderr = "";
|
|
38
|
+
child.stdout.on("data", (chunk) => {
|
|
39
|
+
stdout += chunk;
|
|
40
|
+
});
|
|
41
|
+
child.stderr.on("data", (chunk) => {
|
|
42
|
+
stderr += chunk;
|
|
43
|
+
});
|
|
44
|
+
child.once("error", reject);
|
|
45
|
+
child.once("close", (code) => resolve({ code: code ?? 1, stdout, stderr }));
|
|
46
|
+
if (child.stdin) {
|
|
47
|
+
child.stdin.on("error", () => {
|
|
48
|
+
});
|
|
49
|
+
child.stdin.end(input);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
async function checked(cwd, args, input) {
|
|
54
|
+
const result = await git(cwd, args, input);
|
|
55
|
+
if (result.code !== 0) throw new Error(`git ${args[0]} failed: ${(result.stderr || result.stdout).trim()}`);
|
|
56
|
+
return result.stdout.trim();
|
|
57
|
+
}
|
|
58
|
+
function blob(cwd, revision, file) {
|
|
59
|
+
return new Promise((resolve, reject) => {
|
|
60
|
+
const child = spawn("git", ["cat-file", "blob", `${revision}:${file}`], { cwd, stdio: ["ignore", "pipe", "ignore"], windowsHide: true, env: gitEnvironment() });
|
|
61
|
+
const chunks = [];
|
|
62
|
+
child.stdout.on("data", (chunk) => chunks.push(chunk));
|
|
63
|
+
child.once("error", reject);
|
|
64
|
+
child.once("close", (code) => resolve(code === 0 ? Buffer.concat(chunks) : void 0));
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
var binary = (content) => content.subarray(0, 8e3).includes(0);
|
|
68
|
+
var same = (a, b) => a === b || !!a && !!b && a.equals(b);
|
|
69
|
+
async function mergeText(ours, base, theirs) {
|
|
70
|
+
const directory = await mkdtemp(path.join(os.tmpdir(), "alp-merge-"));
|
|
71
|
+
try {
|
|
72
|
+
const [o, b, t] = ["ours", "base", "theirs"].map((name) => path.join(directory, name));
|
|
73
|
+
await Promise.all([writeFile(o, ours), writeFile(b, base), writeFile(t, theirs)]);
|
|
74
|
+
const result = await git(directory, ["merge-file", "-p", "-L", "yours", "-L", "base", "-L", "assignment", o, b, t]);
|
|
75
|
+
if (result.code < 0 || result.code > 127) throw new Error(`git merge-file failed: ${result.stderr.trim()}`);
|
|
76
|
+
return { content: result.stdout, conflict: result.code > 0 };
|
|
77
|
+
} finally {
|
|
78
|
+
await rm(directory, { recursive: true, force: true });
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async function checkoutOf(directory) {
|
|
82
|
+
const result = await git(directory, ["rev-parse", "--show-toplevel"]).catch(() => void 0);
|
|
83
|
+
return result?.code === 0 ? realpath(result.stdout.trim()) : void 0;
|
|
84
|
+
}
|
|
85
|
+
async function checkoutKey(directory) {
|
|
86
|
+
return await checkoutOf(directory) ?? realpath(directory).catch(() => path.resolve(directory));
|
|
87
|
+
}
|
|
88
|
+
async function branchExists(directory, branch) {
|
|
89
|
+
const result = await git(directory, ["rev-parse", "--verify", "--quiet", `refs/heads/${branch}`]).catch(() => void 0);
|
|
90
|
+
return result?.code === 0;
|
|
91
|
+
}
|
|
92
|
+
async function createWorktree(workdir, root, id, from) {
|
|
93
|
+
const checkout = await checkoutOf(workdir);
|
|
94
|
+
if (!checkout) throw new Error("Worktree isolation needs a git repository");
|
|
95
|
+
const head = await git(checkout, ["rev-parse", "--verify", "HEAD"]);
|
|
96
|
+
if (head.code !== 0) throw new Error("Worktree isolation needs at least one commit");
|
|
97
|
+
const fingerprint = from ? from.fingerprint : await checkoutFingerprint(checkout);
|
|
98
|
+
const base = from ? from.base : await checked(checkout, ["stash", "create"]) || head.stdout.trim();
|
|
99
|
+
const target = path.join(root, id);
|
|
100
|
+
const branch = `alp/${id}`;
|
|
101
|
+
await mkdir(root, { recursive: true, mode: 448 });
|
|
102
|
+
await checked(checkout, ["worktree", "add", "--quiet", "-b", branch, target, from ? from.commit : base]);
|
|
103
|
+
const relative = path.relative(checkout, await realpath(workdir));
|
|
104
|
+
return { checkout, path: target, workdir: path.join(target, relative), branch, base, ...fingerprint ? { fingerprint } : {} };
|
|
105
|
+
}
|
|
106
|
+
async function validWorktree(directory) {
|
|
107
|
+
const top = await git(directory, ["rev-parse", "--show-toplevel"]).catch(() => void 0);
|
|
108
|
+
if (top?.code !== 0) return false;
|
|
109
|
+
const [a, b] = await Promise.all([realpath(top.stdout.trim()).catch(() => ""), realpath(directory).catch(() => directory)]);
|
|
110
|
+
return a === b && (await git(directory, ["status", "--porcelain"])).code === 0;
|
|
111
|
+
}
|
|
112
|
+
async function reattachWorktree(worktree) {
|
|
113
|
+
const exists = !!await stat(worktree.path).catch(() => void 0);
|
|
114
|
+
if (exists && await validWorktree(worktree.path)) {
|
|
115
|
+
const dirs = await gitDirs(worktree.path);
|
|
116
|
+
if (dirs) await clearStaleLocks(dirs, worktree.branch);
|
|
117
|
+
return worktree;
|
|
118
|
+
}
|
|
119
|
+
if (!await branchExists(worktree.checkout, worktree.branch)) throw new Error(`Branch ${worktree.branch} of the worktree no longer exists`);
|
|
120
|
+
let preserved;
|
|
121
|
+
if (exists) {
|
|
122
|
+
preserved = `${worktree.path}.preserved-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}`;
|
|
123
|
+
await rename(worktree.path, preserved);
|
|
124
|
+
}
|
|
125
|
+
await mkdir(path.dirname(worktree.path), { recursive: true, mode: 448 });
|
|
126
|
+
await git(worktree.checkout, ["worktree", "prune"]);
|
|
127
|
+
await checked(worktree.checkout, ["worktree", "add", "--quiet", worktree.path, worktree.branch]);
|
|
128
|
+
return preserved ? { ...worktree, preserved } : worktree;
|
|
129
|
+
}
|
|
130
|
+
async function checkoutFingerprint(checkout) {
|
|
131
|
+
const head = await git(checkout, ["rev-parse", "--verify", "HEAD"]);
|
|
132
|
+
if (head.code !== 0) return void 0;
|
|
133
|
+
const diff = await git(checkout, ["diff", "--binary", "HEAD"]);
|
|
134
|
+
const untracked = await git(checkout, ["ls-files", "--others", "--exclude-standard", "-z"]);
|
|
135
|
+
return createHash("sha256").update(head.stdout).update("\0").update(diff.stdout).update("\0").update(untracked.stdout).digest("hex");
|
|
136
|
+
}
|
|
137
|
+
async function linkModules(projectDir, worktreeDir) {
|
|
138
|
+
const source = path.join(projectDir, "node_modules");
|
|
139
|
+
const target = path.join(worktreeDir, "node_modules");
|
|
140
|
+
if (!(await stat(source).catch(() => void 0))?.isDirectory() || await lstat(target).catch(() => void 0)) return async () => {
|
|
141
|
+
};
|
|
142
|
+
await symlink(source, target, "dir");
|
|
143
|
+
return async () => {
|
|
144
|
+
await unlink(target).catch(() => {
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
async function commitWorktree(worktree, message) {
|
|
149
|
+
await checked(worktree.path, ["add", "-A"]);
|
|
150
|
+
const staged = await git(worktree.path, ["diff", "--cached", "--quiet"]);
|
|
151
|
+
if (staged.code === 1) await checked(worktree.path, [...IDENTITY, "commit", "--quiet", "--no-verify", "-m", message]);
|
|
152
|
+
const commit = await checked(worktree.path, ["rev-parse", "HEAD"]);
|
|
153
|
+
const names = await checked(worktree.path, ["diff", "--name-only", worktree.base, commit]);
|
|
154
|
+
const stat2 = await checked(worktree.path, ["diff", "--shortstat", worktree.base, commit]);
|
|
155
|
+
return { commit, files: names ? names.split("\n") : [], stat: stat2 };
|
|
156
|
+
}
|
|
157
|
+
async function mergeWorktree(worktree, change) {
|
|
158
|
+
if (!change.files.length) return { status: "empty", files: [] };
|
|
159
|
+
const patch = await checked(worktree.checkout, ["diff", "--binary", worktree.base, change.commit]);
|
|
160
|
+
if ((await git(worktree.checkout, ["apply", "--whitespace=nowarn"], `${patch}
|
|
161
|
+
`)).code === 0) return { status: "applied", files: change.files };
|
|
162
|
+
const conflicts = [];
|
|
163
|
+
for (const file of change.files) {
|
|
164
|
+
const target = path.join(worktree.checkout, file);
|
|
165
|
+
const ours = await readFile(target).catch(() => void 0);
|
|
166
|
+
const base = await blob(worktree.checkout, worktree.base, file);
|
|
167
|
+
const theirs = await blob(worktree.checkout, change.commit, file);
|
|
168
|
+
if (same(ours, theirs)) continue;
|
|
169
|
+
if (same(ours, base)) {
|
|
170
|
+
if (theirs) {
|
|
171
|
+
await mkdir(path.dirname(target), { recursive: true });
|
|
172
|
+
await writeFile(target, theirs);
|
|
173
|
+
} else {
|
|
174
|
+
await rm(target, { force: true });
|
|
175
|
+
}
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
if (!ours || !theirs || binary(ours) || binary(theirs) || base && binary(base)) {
|
|
179
|
+
conflicts.push(file);
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
const merged = await mergeText(ours, base ?? Buffer.alloc(0), theirs);
|
|
183
|
+
await writeFile(target, merged.content);
|
|
184
|
+
if (merged.conflict) conflicts.push(file);
|
|
185
|
+
}
|
|
186
|
+
return conflicts.length ? { status: "conflicts", files: change.files, conflicts } : { status: "applied", files: change.files };
|
|
187
|
+
}
|
|
188
|
+
async function removeWorktree(worktree, { deleteBranch = false } = {}) {
|
|
189
|
+
await git(worktree.checkout, ["worktree", "remove", "--force", worktree.path]);
|
|
190
|
+
await rm(worktree.path, { recursive: true, force: true });
|
|
191
|
+
await git(worktree.checkout, ["worktree", "prune"]);
|
|
192
|
+
if (deleteBranch) await git(worktree.checkout, ["branch", "-D", worktree.branch]);
|
|
193
|
+
}
|
|
194
|
+
async function gitDirs(target) {
|
|
195
|
+
const result = await git(target, ["rev-parse", "--path-format=absolute", "--absolute-git-dir", "--git-common-dir"]);
|
|
196
|
+
if (result.code !== 0) return void 0;
|
|
197
|
+
const [own, common] = result.stdout.trim().split("\n").map((line) => path.resolve(line.trim()));
|
|
198
|
+
return own && common ? { own, common } : void 0;
|
|
199
|
+
}
|
|
200
|
+
var SHARED_LOCK_STALE_MS = 1e4;
|
|
201
|
+
async function clearStaleLocks(dirs, branch) {
|
|
202
|
+
if (dirs.own === dirs.common) return;
|
|
203
|
+
const own = (await readdir(dirs.own).catch(() => [])).filter((name) => name.endsWith(".lock"));
|
|
204
|
+
const refs = (await readdir(path.join(dirs.own, "refs"), { recursive: true }).catch(() => [])).filter((name) => name.endsWith(".lock")).map((name) => path.join("refs", name));
|
|
205
|
+
for (const name of [...own, ...refs]) await unlink(path.join(dirs.own, name)).catch(() => {
|
|
206
|
+
});
|
|
207
|
+
const shared = `${path.join(dirs.common, "refs", "heads", ...branch.split("/"))}.lock`;
|
|
208
|
+
const info = await lstat(shared).catch(() => void 0);
|
|
209
|
+
if (info?.isFile() && Date.now() - info.mtimeMs >= SHARED_LOCK_STALE_MS) await unlink(shared).catch(() => {
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
var KEEP_IGNORED = /^\.env/;
|
|
213
|
+
async function ignoredToKeep(target) {
|
|
214
|
+
const result = await git(target, ["ls-files", "-z", "--others", "--ignored", "--exclude-standard", "--directory"]);
|
|
215
|
+
if (result.code !== 0) return void 0;
|
|
216
|
+
return result.stdout.split("\0").filter(Boolean).map((entry) => entry.replace(/\/$/, "")).filter((entry) => KEEP_IGNORED.test(path.posix.basename(entry))).sort();
|
|
217
|
+
}
|
|
218
|
+
var firstLine = (result) => (result.stderr || result.stdout).trim().split("\n")[0] ?? "";
|
|
219
|
+
async function reclaimWorktrees(root) {
|
|
220
|
+
const kept = [];
|
|
221
|
+
const left = [];
|
|
222
|
+
const entries = await readdir(root).catch(() => []);
|
|
223
|
+
for (const name of entries) {
|
|
224
|
+
const target = path.join(root, name);
|
|
225
|
+
const leave = (reason, extra = {}) => {
|
|
226
|
+
left.push({ name, path: target, reason, ...extra });
|
|
227
|
+
};
|
|
228
|
+
if (!(await stat(target).catch(() => void 0))?.isDirectory()) continue;
|
|
229
|
+
if (!await validWorktree(target)) {
|
|
230
|
+
leave("invalid");
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
const dirs = await gitDirs(target);
|
|
234
|
+
if (!dirs) {
|
|
235
|
+
leave("invalid");
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
if (dirs.own === dirs.common) {
|
|
239
|
+
leave("not-linked");
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
const checkout = path.dirname(dirs.common);
|
|
243
|
+
const ref = await git(target, ["symbolic-ref", "--quiet", "--short", "HEAD"]);
|
|
244
|
+
const branch = ref.stdout.trim();
|
|
245
|
+
if (ref.code !== 0 || branch !== `alp/${name}`) {
|
|
246
|
+
leave("other-branch", ref.code === 0 && branch ? { branch } : {});
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
await clearStaleLocks(dirs, branch);
|
|
250
|
+
const added = await git(target, ["add", "-A"]);
|
|
251
|
+
if (added.code !== 0) {
|
|
252
|
+
leave("commit-failed", { branch, detail: firstLine(added) });
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
if ((await git(target, ["diff", "--cached", "--quiet"])).code === 1) {
|
|
256
|
+
const committed = await git(target, [...IDENTITY, "commit", "--quiet", "--no-verify", "-m", "alp: work left by an interrupted assignment"]);
|
|
257
|
+
if (committed.code !== 0) {
|
|
258
|
+
leave("commit-failed", { branch, detail: firstLine(committed) });
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
const status = await git(target, ["status", "--porcelain", "--ignored=no"]);
|
|
263
|
+
if (status.code !== 0 || status.stdout.trim()) {
|
|
264
|
+
leave("uncommitted", { branch });
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
const ignored = await ignoredToKeep(target);
|
|
268
|
+
if (!ignored) {
|
|
269
|
+
leave("ignored-files", { branch, detail: "git could not list its ignored files" });
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
if (ignored.length) {
|
|
273
|
+
leave("ignored-files", { branch, files: ignored });
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
await removeWorktree({ checkout, path: target, workdir: target, branch, base: "" });
|
|
277
|
+
kept.push(branch);
|
|
278
|
+
}
|
|
279
|
+
return { kept, left };
|
|
280
|
+
}
|
|
281
|
+
async function createCopy(workdir, root, id) {
|
|
282
|
+
const checkout = await checkoutOf(workdir);
|
|
283
|
+
if (!checkout) throw new Error("A review copy needs a git repository");
|
|
284
|
+
const head = await git(checkout, ["rev-parse", "--verify", "HEAD"]);
|
|
285
|
+
if (head.code !== 0) throw new Error("A review copy needs at least one commit");
|
|
286
|
+
const target = path.join(root, id);
|
|
287
|
+
await mkdir(root, { recursive: true, mode: 448 });
|
|
288
|
+
await checked(checkout, ["worktree", "add", "--quiet", "--detach", target, head.stdout.trim()]);
|
|
289
|
+
try {
|
|
290
|
+
const patch = (await git(checkout, ["diff", "--binary", "HEAD"])).stdout;
|
|
291
|
+
if (patch.trim()) await checked(target, ["apply", "--whitespace=nowarn", "--binary"], patch);
|
|
292
|
+
const untracked = (await checked(checkout, ["ls-files", "--others", "--exclude-standard", "-z"])).split("\0").filter(Boolean);
|
|
293
|
+
for (const file of untracked) {
|
|
294
|
+
const from = path.join(checkout, file);
|
|
295
|
+
if (!(await lstat(from).catch(() => void 0))?.isFile()) continue;
|
|
296
|
+
await mkdir(path.dirname(path.join(target, file)), { recursive: true });
|
|
297
|
+
await copyFile(from, path.join(target, file));
|
|
298
|
+
}
|
|
299
|
+
const modules = path.join(checkout, "node_modules");
|
|
300
|
+
if ((await stat(modules).catch(() => void 0))?.isDirectory()) await symlink(modules, path.join(target, "node_modules"), "dir");
|
|
301
|
+
} catch (error) {
|
|
302
|
+
await removeCopy({ checkout, path: target, workdir: target });
|
|
303
|
+
throw error;
|
|
304
|
+
}
|
|
305
|
+
const relative = path.relative(checkout, await realpath(workdir));
|
|
306
|
+
return { checkout, path: target, workdir: path.join(target, relative) };
|
|
307
|
+
}
|
|
308
|
+
async function removeCopy(copy) {
|
|
309
|
+
await git(copy.checkout, ["worktree", "remove", "--force", copy.path]).catch(() => void 0);
|
|
310
|
+
await rm(copy.path, { recursive: true, force: true });
|
|
311
|
+
await git(copy.checkout, ["worktree", "prune"]).catch(() => void 0);
|
|
312
|
+
}
|
|
313
|
+
async function reclaimCopies(root) {
|
|
314
|
+
let removed = 0;
|
|
315
|
+
for (const name of await readdir(root).catch(() => [])) {
|
|
316
|
+
const target = path.join(root, name);
|
|
317
|
+
const common = await git(target, ["rev-parse", "--path-format=absolute", "--git-common-dir"]).catch(() => void 0);
|
|
318
|
+
if (common?.code === 0) await removeCopy({ checkout: path.dirname(common.stdout.trim()), path: target, workdir: target });
|
|
319
|
+
else await rm(target, { recursive: true, force: true });
|
|
320
|
+
removed++;
|
|
321
|
+
}
|
|
322
|
+
return removed;
|
|
323
|
+
}
|
|
324
|
+
export {
|
|
325
|
+
branchExists,
|
|
326
|
+
checkoutFingerprint,
|
|
327
|
+
checkoutKey,
|
|
328
|
+
checkoutOf,
|
|
329
|
+
commitWorktree,
|
|
330
|
+
createCopy,
|
|
331
|
+
createWorktree,
|
|
332
|
+
gitEnvironment,
|
|
333
|
+
linkModules,
|
|
334
|
+
mergeWorktree,
|
|
335
|
+
reattachWorktree,
|
|
336
|
+
reclaimCopies,
|
|
337
|
+
reclaimWorktrees,
|
|
338
|
+
removeCopy,
|
|
339
|
+
removeWorktree
|
|
340
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { type Verification, type VerifyConfig } from '@anhlp/alp-core/verify';
|
|
2
|
+
import { type WorktreeChange } from './workspace.js';
|
|
3
|
+
import type { RuntimeOptions } from './contracts.js';
|
|
4
|
+
import type { Session, Assignment } from './session-state.js';
|
|
5
|
+
type WorktreeContext = {
|
|
6
|
+
options: RuntimeOptions;
|
|
7
|
+
releaseResult(assignmentId: string): Promise<void>;
|
|
8
|
+
leases: Map<string, {
|
|
9
|
+
assignment: string;
|
|
10
|
+
agent: string;
|
|
11
|
+
}>;
|
|
12
|
+
rootOf(sessionId: string): string;
|
|
13
|
+
lineage(sessionId: string): string[];
|
|
14
|
+
runLog(rootId: string, entry: Record<string, unknown>): void;
|
|
15
|
+
runHooks(sessionId: string, session: Session, event: string, details?: Record<string, unknown>, taskId?: string): Promise<string | undefined>;
|
|
16
|
+
touchTask(rootId: string, id: string): void;
|
|
17
|
+
};
|
|
18
|
+
/** Checkout mutation and verification retain one shared queue per checkout. */
|
|
19
|
+
export declare function createWorktreeDomain({ options, leases, releaseResult, rootOf, lineage, runLog, runHooks, touchTask }: WorktreeContext): {
|
|
20
|
+
settleWorktree: (parentId: string, parent: Session, assignment: Assignment) => Promise<{
|
|
21
|
+
branch: string;
|
|
22
|
+
files: never[];
|
|
23
|
+
note: string;
|
|
24
|
+
error?: undefined;
|
|
25
|
+
} | {
|
|
26
|
+
note: string;
|
|
27
|
+
branch: string;
|
|
28
|
+
base: string;
|
|
29
|
+
commit: string;
|
|
30
|
+
files: string[];
|
|
31
|
+
stat: string;
|
|
32
|
+
error?: undefined;
|
|
33
|
+
} | {
|
|
34
|
+
next: string;
|
|
35
|
+
branch: string;
|
|
36
|
+
base: string;
|
|
37
|
+
commit: string;
|
|
38
|
+
files: string[];
|
|
39
|
+
stat: string;
|
|
40
|
+
note?: undefined;
|
|
41
|
+
error?: undefined;
|
|
42
|
+
} | {
|
|
43
|
+
branch: string;
|
|
44
|
+
error: string;
|
|
45
|
+
files?: undefined;
|
|
46
|
+
note?: undefined;
|
|
47
|
+
}>;
|
|
48
|
+
worktreeTool: (sessionId: string, session: Session, args: unknown, action: "merge" | "discard") => Promise<{
|
|
49
|
+
success: boolean;
|
|
50
|
+
contentItems: {
|
|
51
|
+
type: string;
|
|
52
|
+
text: string;
|
|
53
|
+
}[];
|
|
54
|
+
}>;
|
|
55
|
+
inCheckout: <T>(checkout: string, work: () => Promise<T>) => Promise<T>;
|
|
56
|
+
verifyIn: (project: string, directory: string, config: VerifyConfig) => Promise<Verification>;
|
|
57
|
+
verificationResult: (verification: Verification | {
|
|
58
|
+
passed: boolean;
|
|
59
|
+
commands: Array<Record<string, any>>;
|
|
60
|
+
cwd?: string;
|
|
61
|
+
skipped?: string;
|
|
62
|
+
}) => {
|
|
63
|
+
output?: any;
|
|
64
|
+
steps: {
|
|
65
|
+
idle?: any;
|
|
66
|
+
timedOut?: any;
|
|
67
|
+
step: any;
|
|
68
|
+
command: any;
|
|
69
|
+
exitCode: any;
|
|
70
|
+
ms: any;
|
|
71
|
+
}[];
|
|
72
|
+
skipped?: string | undefined;
|
|
73
|
+
passed: boolean;
|
|
74
|
+
};
|
|
75
|
+
noteVerification: (rootId: string, project: string, taskId: string | undefined, assignmentId: string | undefined, where: "worktree" | "checkout", verification: Verification) => void;
|
|
76
|
+
continuedBrief: (from: string, continued: {
|
|
77
|
+
agent: string;
|
|
78
|
+
change: WorktreeChange;
|
|
79
|
+
verification?: Verification;
|
|
80
|
+
}) => string;
|
|
81
|
+
verifyTool: (sessionId: string, session: Session, args: unknown) => Promise<{
|
|
82
|
+
success: boolean;
|
|
83
|
+
contentItems: {
|
|
84
|
+
type: string;
|
|
85
|
+
text: string;
|
|
86
|
+
}[];
|
|
87
|
+
}>;
|
|
88
|
+
};
|
|
89
|
+
export {};
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
// packages/runtime/src/worktree-domain.ts
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { describeVerification, runVerify, verifyConfig } from "@anhlp/alp-core/verify";
|
|
5
|
+
import { recordVerification, loadTasks } from "@anhlp/alp-core/tasks";
|
|
6
|
+
import { checkoutFingerprint, checkoutKey, commitWorktree, linkModules, mergeWorktree, removeWorktree } from "./workspace.js";
|
|
7
|
+
import { writes } from "./catalog.js";
|
|
8
|
+
import { nativeEnvironment } from "./providers.js";
|
|
9
|
+
import { mainOf } from "./tools.js";
|
|
10
|
+
import { errorData, plainObject, toolResult } from "./tool-results.js";
|
|
11
|
+
function createWorktreeDomain({ options, leases, releaseResult, rootOf, lineage, runLog, runHooks, touchTask }) {
|
|
12
|
+
const merging = /* @__PURE__ */ new Map();
|
|
13
|
+
async function settleWorktree(parentId, parent, assignment) {
|
|
14
|
+
const worktree = assignment.worktree;
|
|
15
|
+
try {
|
|
16
|
+
const change = await commitWorktree(worktree, `alp: ${assignment.agent} assignment ${assignment.id}`);
|
|
17
|
+
if (!change.files.length) {
|
|
18
|
+
await removeWorktree(worktree, { deleteBranch: true });
|
|
19
|
+
await releaseResult(assignment.id);
|
|
20
|
+
return { branch: worktree.branch, files: [], note: "No changes; the worktree was removed" };
|
|
21
|
+
}
|
|
22
|
+
const described = { branch: worktree.branch, base: worktree.base, commit: change.commit, files: change.files, stat: change.stat };
|
|
23
|
+
if (parent.closed) {
|
|
24
|
+
await removeWorktree(worktree);
|
|
25
|
+
runLog(rootOf(parentId), { event: "worktree.kept", assignmentId: assignment.id, branch: worktree.branch });
|
|
26
|
+
return { ...described, note: "The requester closed; the change stays on the branch" };
|
|
27
|
+
}
|
|
28
|
+
parent.worktrees.set(assignment.id, { agent: assignment.agent, worktree, change, ...assignment.taskId ? { taskId: assignment.taskId } : {} });
|
|
29
|
+
return { ...described, next: "Apply it with alp_merge, or drop it with alp_discard" };
|
|
30
|
+
} catch (error) {
|
|
31
|
+
await removeWorktree(worktree).catch(() => {
|
|
32
|
+
});
|
|
33
|
+
return { branch: worktree.branch, error: errorData(error).message };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async function worktreeTool(sessionId, session, args, action) {
|
|
37
|
+
if (!plainObject(args, ["assignmentId", "skipVerify"]) || typeof args.assignmentId !== "string" || args.skipVerify !== void 0 && (action !== "merge" || typeof args.skipVerify !== "string" || !args.skipVerify.trim())) {
|
|
38
|
+
return toolResult(false, { error: action === "merge" ? "assignmentId is required; skipVerify, when given, says why to merge without verification" : "assignmentId is required" });
|
|
39
|
+
}
|
|
40
|
+
const pending = session.worktrees.get(args.assignmentId);
|
|
41
|
+
if (!pending) {
|
|
42
|
+
return toolResult(false, { error: session.assignments.has(args.assignmentId) ? "The assignment is still running; wait for its result" : "No unmerged worktree change with that assignment id" });
|
|
43
|
+
}
|
|
44
|
+
const { worktree, change } = pending;
|
|
45
|
+
if (action === "discard") {
|
|
46
|
+
session.worktrees.delete(args.assignmentId);
|
|
47
|
+
await removeWorktree(worktree, { deleteBranch: true });
|
|
48
|
+
await releaseResult(args.assignmentId);
|
|
49
|
+
runLog(rootOf(sessionId), { event: "worktree.discarded", assignmentId: args.assignmentId, branch: worktree.branch });
|
|
50
|
+
return toolResult(true, { discarded: args.assignmentId, branch: worktree.branch });
|
|
51
|
+
}
|
|
52
|
+
if (!writes(session.mapping.mode)) return toolResult(false, { error: "Merging needs workspace-write or full-access" });
|
|
53
|
+
if ([...session.assignments.values()].some((assignment) => assignment.mode !== "read-only" && assignment.isolation === "shared")) {
|
|
54
|
+
return toolResult(false, { error: "A writer assignment is working in this checkout; merge after its result" });
|
|
55
|
+
}
|
|
56
|
+
session.worktrees.delete(args.assignmentId);
|
|
57
|
+
const checkout = await checkoutKey(session.mapping.workdir);
|
|
58
|
+
const holder = leases.get(checkout);
|
|
59
|
+
if (holder && !lineage(sessionId).includes(holder.assignment)) {
|
|
60
|
+
session.worktrees.set(args.assignmentId, pending);
|
|
61
|
+
return toolResult(false, { error: `${holder.agent} in another session is writing this checkout; merge after it finishes` });
|
|
62
|
+
}
|
|
63
|
+
const project = session.mapping.agent.projectRoot;
|
|
64
|
+
const rootId = rootOf(sessionId);
|
|
65
|
+
let config;
|
|
66
|
+
try {
|
|
67
|
+
config = await verifyConfig(project);
|
|
68
|
+
} catch (error) {
|
|
69
|
+
session.worktrees.set(args.assignmentId, pending);
|
|
70
|
+
return toolResult(false, { error: errorData(error).message });
|
|
71
|
+
}
|
|
72
|
+
let verified;
|
|
73
|
+
if (config && args.skipVerify === void 0) {
|
|
74
|
+
const verification = verified = await verifyIn(project, worktreeDirectory(worktree, project), config);
|
|
75
|
+
noteVerification(rootId, project, pending.taskId, args.assignmentId, "worktree", verification);
|
|
76
|
+
if (!verification.passed) {
|
|
77
|
+
session.worktrees.set(args.assignmentId, { ...pending, verification });
|
|
78
|
+
return toolResult(false, {
|
|
79
|
+
assignmentId: args.assignmentId,
|
|
80
|
+
error: `${describeVerification(verification)} in the assignment's worktree; nothing was applied`,
|
|
81
|
+
verification: verificationResult(verification),
|
|
82
|
+
branch: worktree.branch,
|
|
83
|
+
next: verification.skipped ? "The check could not run, which says nothing about the change; call alp_merge again, or alp_merge it with skipVerify saying why" : `Delegate again with continueFrom "${args.assignmentId}"${pending.taskId ? ` and taskId ${pending.taskId}` : ""} to fix it in a worktree that starts from this change; or alp_discard it; or alp_merge it with skipVerify saying why`
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
} else if (config && pending.taskId) {
|
|
87
|
+
await recordVerification(project, pending.taskId, { passed: false, skipped: args.skipVerify }, session.mapping.agent.name).catch(() => {
|
|
88
|
+
});
|
|
89
|
+
runLog(rootId, { event: "verify", assignmentId: args.assignmentId, where: "worktree", skipped: args.skipVerify });
|
|
90
|
+
}
|
|
91
|
+
const refused = await runHooks(sessionId, session, "merge", { assignment: args.assignmentId, branch: worktree.branch }, pending.taskId);
|
|
92
|
+
if (refused) {
|
|
93
|
+
session.worktrees.set(args.assignmentId, pending);
|
|
94
|
+
return toolResult(false, { assignmentId: args.assignmentId, error: `A merge hook refused it; nothing was applied:
|
|
95
|
+
${refused}`, branch: worktree.branch, next: `Fix what it reports in a new assignment with continueFrom "${args.assignmentId}", or alp_discard it` });
|
|
96
|
+
}
|
|
97
|
+
let merged;
|
|
98
|
+
let moved = false;
|
|
99
|
+
try {
|
|
100
|
+
({ merged, moved } = await inCheckout(checkout, async () => {
|
|
101
|
+
const before = await checkoutFingerprint(worktree.checkout).catch(() => void 0);
|
|
102
|
+
return { merged: await mergeWorktree(worktree, change), moved: !worktree.fingerprint || before !== worktree.fingerprint };
|
|
103
|
+
}));
|
|
104
|
+
} catch (error) {
|
|
105
|
+
session.worktrees.set(args.assignmentId, pending);
|
|
106
|
+
return toolResult(false, { error: errorData(error).message, branch: worktree.branch, next: "Merge the branch yourself, or alp_discard it" });
|
|
107
|
+
}
|
|
108
|
+
await removeWorktree(worktree, { deleteBranch: merged.status !== "conflicts" });
|
|
109
|
+
if (merged.status !== "conflicts") await releaseResult(args.assignmentId);
|
|
110
|
+
runLog(rootId, { event: "worktree.merged", assignmentId: args.assignmentId, branch: worktree.branch, ...merged });
|
|
111
|
+
let checked;
|
|
112
|
+
if (config && args.skipVerify === void 0 && merged.status === "applied" && moved) {
|
|
113
|
+
checked = await inCheckout(checkout, () => verifyIn(project, session.mapping.workdir, config));
|
|
114
|
+
noteVerification(rootId, project, pending.taskId, args.assignmentId, "checkout", checked);
|
|
115
|
+
}
|
|
116
|
+
return toolResult(true, {
|
|
117
|
+
assignmentId: args.assignmentId,
|
|
118
|
+
...merged,
|
|
119
|
+
...merged.status === "conflicts" ? { branch: worktree.branch } : {},
|
|
120
|
+
...verified ? { verification: verificationResult(checked ?? verified), ...checked ? { verifiedIn: "your checkout, which changed since the assignment started" } : {} } : {},
|
|
121
|
+
...args.skipVerify !== void 0 && config ? { verification: { skipped: args.skipVerify } } : {},
|
|
122
|
+
next: merged.status === "conflicts" ? `Resolve the conflict markers in the listed files, then verify${config ? " with alp_verify" : ""}` : checked && !checked.passed ? `The change passed in its worktree but ${describeVerification(checked)} in your checkout, which changed meanwhile; fix it, then run alp_verify` : "Review the applied change; it is not committed"
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function inCheckout(checkout, work) {
|
|
126
|
+
const previous = merging.get(checkout) ?? Promise.resolve();
|
|
127
|
+
const attempt = previous.catch(() => {
|
|
128
|
+
}).then(work);
|
|
129
|
+
merging.set(checkout, attempt);
|
|
130
|
+
void attempt.finally(() => {
|
|
131
|
+
if (merging.get(checkout) === attempt) merging.delete(checkout);
|
|
132
|
+
}).catch(() => {
|
|
133
|
+
});
|
|
134
|
+
return attempt;
|
|
135
|
+
}
|
|
136
|
+
function worktreeDirectory(worktree, project) {
|
|
137
|
+
let real = project;
|
|
138
|
+
try {
|
|
139
|
+
real = realpathSync(project);
|
|
140
|
+
} catch {
|
|
141
|
+
}
|
|
142
|
+
return path.join(worktree.path, path.relative(worktree.checkout, real));
|
|
143
|
+
}
|
|
144
|
+
async function verifyIn(project, directory, config) {
|
|
145
|
+
const same = path.resolve(directory) === path.resolve(project);
|
|
146
|
+
const unlinkModules = same ? async () => {
|
|
147
|
+
} : await linkModules(project, directory).catch(() => async () => {
|
|
148
|
+
});
|
|
149
|
+
try {
|
|
150
|
+
return await runVerify(directory, config, { env: nativeEnvironment(options) });
|
|
151
|
+
} finally {
|
|
152
|
+
await unlinkModules();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function verificationResult(verification) {
|
|
156
|
+
const failed = verification.commands.find((command) => command.exitCode !== 0);
|
|
157
|
+
return {
|
|
158
|
+
passed: verification.passed,
|
|
159
|
+
...verification.skipped ? { skipped: verification.skipped } : {},
|
|
160
|
+
steps: verification.commands.map(({ step, command, exitCode, ms, timedOut, idle }) => ({ step, command, exitCode, ms, ...timedOut ? { timedOut } : {}, ...idle ? { idle } : {} })),
|
|
161
|
+
...failed?.output ? { output: failed.output } : {}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function noteVerification(rootId, project, taskId, assignmentId, where, verification) {
|
|
165
|
+
runLog(rootId, { event: "verify", ...assignmentId ? { assignmentId } : {}, ...taskId ? { taskId } : {}, where, passed: verification.passed, detail: describeVerification(verification) });
|
|
166
|
+
if (taskId) void recordVerification(project, taskId, { ...verification, where }, "alpd").then(() => touchTask(rootId, taskId), () => {
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function continuedBrief(from, continued) {
|
|
170
|
+
const failed = continued.verification?.commands.find((command) => command.exitCode !== 0);
|
|
171
|
+
return `Your worktree starts from the change of ${continued.agent}'s assignment ${from}, committed on your branch (${continued.change.files.length} files: ${continued.change.files.slice(0, 20).join(", ")}). Build on it rather than starting over.` + (continued.verification && !continued.verification.passed ? ` The project's checks failed on it: ${describeVerification(continued.verification)}, running \`${failed?.command}\`. The end of its output:
|
|
172
|
+
${failed?.output.slice(-1500) ?? ""}` : "");
|
|
173
|
+
}
|
|
174
|
+
async function verifyTool(sessionId, session, args) {
|
|
175
|
+
if (!plainObject(args, ["taskId"]) || args.taskId !== void 0 && typeof args.taskId !== "string") return toolResult(false, { error: "alp_verify takes only taskId" });
|
|
176
|
+
if (args.taskId !== void 0 && (session.parent || session.mapping.agent.name !== mainOf(session.mapping))) return toolResult(false, { error: "Only main records a verification on a task; call alp_verify without taskId" });
|
|
177
|
+
const project = session.mapping.agent.projectRoot;
|
|
178
|
+
let config;
|
|
179
|
+
try {
|
|
180
|
+
config = await verifyConfig(project);
|
|
181
|
+
} catch (error) {
|
|
182
|
+
return toolResult(false, { error: errorData(error).message });
|
|
183
|
+
}
|
|
184
|
+
if (!config) return toolResult(false, { error: "This project has no verify commands (verify in .alp/settings.json); run its checks yourself" });
|
|
185
|
+
if (args.taskId !== void 0) {
|
|
186
|
+
const task = (await loadTasks(project)).tasks.find((entry) => entry.id === args.taskId);
|
|
187
|
+
if (!task) return toolResult(false, { error: `No task ${args.taskId}` });
|
|
188
|
+
if (task.status === "closed") return toolResult(false, { error: `${args.taskId} is closed` });
|
|
189
|
+
}
|
|
190
|
+
const checkout = await checkoutKey(session.mapping.workdir);
|
|
191
|
+
const verification = await inCheckout(checkout, () => verifyIn(project, session.mapping.workdir, config));
|
|
192
|
+
noteVerification(rootOf(sessionId), project, args.taskId, void 0, "checkout", verification);
|
|
193
|
+
return toolResult(true, { ...verificationResult(verification), summary: describeVerification(verification), ...args.taskId ? { recordedOn: args.taskId } : {} });
|
|
194
|
+
}
|
|
195
|
+
return { settleWorktree, worktreeTool, inCheckout, verifyIn, verificationResult, noteVerification, continuedBrief, verifyTool };
|
|
196
|
+
}
|
|
197
|
+
export {
|
|
198
|
+
createWorktreeDomain
|
|
199
|
+
};
|