@koda-sl/baker-bridge 0.109.0-dev.fa751dbf1 → 0.109.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.
- package/README.md +19 -19
- package/dist/hono/agent-session.d.ts +1 -0
- package/dist/hono/agent-session.d.ts.map +1 -1
- package/dist/hono/agent-session.js +13 -2
- package/dist/hono/agent-session.js.map +1 -1
- package/dist/hono/agent-session.test.js +37 -0
- package/dist/hono/agent-session.test.js.map +1 -1
- package/dist/hono/agent-tasks.d.ts.map +1 -1
- package/dist/hono/agent-tasks.js +7 -3
- package/dist/hono/agent-tasks.js.map +1 -1
- package/dist/hono/agent-tasks.test.js +15 -0
- package/dist/hono/agent-tasks.test.js.map +1 -1
- package/dist/hono/agent.d.ts.map +1 -1
- package/dist/hono/agent.js +12 -9
- package/dist/hono/agent.js.map +1 -1
- package/dist/hono/attachments.d.ts +6 -1
- package/dist/hono/attachments.d.ts.map +1 -1
- package/dist/hono/attachments.js +9 -4
- package/dist/hono/attachments.js.map +1 -1
- package/dist/hono/attachments.test.js +5 -0
- package/dist/hono/attachments.test.js.map +1 -1
- package/dist/hono/bridge-job.d.ts +31 -12
- package/dist/hono/bridge-job.d.ts.map +1 -1
- package/dist/hono/bridge-job.js +130 -68
- package/dist/hono/bridge-job.js.map +1 -1
- package/dist/hono/bridge-job.test.js +227 -170
- package/dist/hono/bridge-job.test.js.map +1 -1
- package/dist/hono/session-continuity.d.ts +0 -1
- package/dist/hono/session-continuity.d.ts.map +1 -1
- package/dist/hono/session-continuity.js +2 -5
- package/dist/hono/session-continuity.js.map +1 -1
- package/dist/hono/types.d.ts +7 -6
- package/dist/hono/types.d.ts.map +1 -1
- package/dist/hono/workspace-settle.d.ts +20 -0
- package/dist/hono/workspace-settle.d.ts.map +1 -0
- package/dist/hono/workspace-settle.js +46 -0
- package/dist/hono/workspace-settle.js.map +1 -0
- package/dist/review/digest.d.ts +7 -1
- package/dist/review/digest.d.ts.map +1 -1
- package/dist/review/digest.js +80 -16
- package/dist/review/digest.js.map +1 -1
- package/dist/review/digest.test.js +83 -0
- package/dist/review/digest.test.js.map +1 -1
- package/package.json +2 -1
- package/dist/hono/main-sync.d.ts +0 -46
- package/dist/hono/main-sync.d.ts.map +0 -1
- package/dist/hono/main-sync.js +0 -409
- package/dist/hono/main-sync.js.map +0 -1
- package/dist/hono/main-sync.test.d.ts +0 -2
- package/dist/hono/main-sync.test.d.ts.map +0 -1
- package/dist/hono/main-sync.test.js +0 -276
- package/dist/hono/main-sync.test.js.map +0 -1
package/dist/hono/main-sync.js
DELETED
|
@@ -1,409 +0,0 @@
|
|
|
1
|
-
import { execFile } from "node:child_process";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
4
|
-
import { dirname, isAbsolute, join, relative } from "node:path";
|
|
5
|
-
import { promisify } from "node:util";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
/**
|
|
8
|
-
* Tells a chat's agent what other chats published after its workspace was
|
|
9
|
-
* prepared, and brings the workspace up to date when that cannot disturb it.
|
|
10
|
-
*
|
|
11
|
-
* A Runtime clones `main` once. Other Sessions keep publishing, and nothing told
|
|
12
|
-
* this one: its agent edited a superseded hero for hours, and in another Session
|
|
13
|
-
* told a user that a page a sibling had published minutes earlier did not exist.
|
|
14
|
-
*
|
|
15
|
-
* Baker, not git, says what was published: the backend sends each turn the
|
|
16
|
-
* publishes it recorded for the company since the chat started (`repoCommits`),
|
|
17
|
-
* with the chat that made each one. Git only answers whether this workspace
|
|
18
|
-
* already holds them — locally, so a turn with nothing new pays no network call.
|
|
19
|
-
*
|
|
20
|
-
* Files move only when nothing can go wrong: the chat has changed nothing, and
|
|
21
|
-
* every commit it would take is one of those recorded publishes — never a
|
|
22
|
-
* platform update, which lands mid-Session under processes that loaded the old
|
|
23
|
-
* one. Otherwise the workspace stays exactly as it is and the agent is told what
|
|
24
|
-
* it does not show and how to read it. Publish rebases onto `main` either way.
|
|
25
|
-
*/
|
|
26
|
-
const execFileAsync = promisify(execFile);
|
|
27
|
-
// The timeout is what keeps an unreachable remote from holding a turn open.
|
|
28
|
-
const FETCH_TIMEOUT_MS = 20_000;
|
|
29
|
-
const LOCAL_TIMEOUT_MS = 10_000;
|
|
30
|
-
// A checkout killed halfway leaves stray files; give a large one room to finish.
|
|
31
|
-
const CHECKOUT_TIMEOUT_MS = 120_000;
|
|
32
|
-
const MAX_PUBLISHES_LISTED = 8;
|
|
33
|
-
const MAX_AREAS_LISTED = 6;
|
|
34
|
-
const MAX_TITLE_LENGTH = 80;
|
|
35
|
-
/** A Runtime checks out `chat/<chatId>` (`buildBranchName`); any other checkout is not a chat's. */
|
|
36
|
-
const CHAT_BRANCH = /^chat\/./;
|
|
37
|
-
/**
|
|
38
|
-
* Written by the scaffold's `prepare-publish.mjs` for as long as a Publish is
|
|
39
|
-
* in flight or owes Baker its outcome (`__tooling__/publish-state.mjs`). While
|
|
40
|
-
* it exists the branch is being squashed and rebased — Publish's to move.
|
|
41
|
-
*/
|
|
42
|
-
const PUBLISH_STATE_FILE = join(".cache", "publish-state.json");
|
|
43
|
-
/**
|
|
44
|
-
* What threads were told, kept on disk so a bridge restart neither repeats nor
|
|
45
|
-
* loses a note — inside `.git`, where it can never read as the chat's own work.
|
|
46
|
-
*/
|
|
47
|
-
const STATE_FILE = join(".git", "baker-main-sync.json");
|
|
48
|
-
/**
|
|
49
|
-
* Files a Runtime installed from when it started. Taking a change to them
|
|
50
|
-
* would leave it running packages its own files no longer describe.
|
|
51
|
-
*/
|
|
52
|
-
const INSTALLED_FROM = /(^|\/)(package\.json|pnpm-lock\.yaml|package-lock\.json|yarn\.lock|pnpm-workspace\.yaml|\.npmrc|\.pnpmfile\.cjs|\.nvmrc|\.node-version|\.tool-versions)$|^patches\//;
|
|
53
|
-
const PAGES = "src/pages/";
|
|
54
|
-
const publishedElsewhereSchema = z.object({
|
|
55
|
-
sha: z.string().regex(/^[0-9a-f]{40}$/),
|
|
56
|
-
chatId: z.string().optional(),
|
|
57
|
-
title: z.string(),
|
|
58
|
-
publishedAt: z.number(),
|
|
59
|
-
paths: z.array(z.string()),
|
|
60
|
-
});
|
|
61
|
-
/** What the backend sent with a turn, keeping only the entries this module can act on. */
|
|
62
|
-
export function parsePublishedElsewhere(value) {
|
|
63
|
-
if (!Array.isArray(value)) {
|
|
64
|
-
return [];
|
|
65
|
-
}
|
|
66
|
-
return value.flatMap((entry) => {
|
|
67
|
-
const parsed = publishedElsewhereSchema.safeParse(entry);
|
|
68
|
-
return parsed.success ? [parsed.data] : [];
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
function gitIn(projectRoot) {
|
|
72
|
-
return async (args, options = {}) => {
|
|
73
|
-
try {
|
|
74
|
-
const { stdout } = await execFileAsync("git", [...args], {
|
|
75
|
-
cwd: projectRoot,
|
|
76
|
-
timeout: options.timeoutMs ?? LOCAL_TIMEOUT_MS,
|
|
77
|
-
maxBuffer: 8 * 1024 * 1024,
|
|
78
|
-
});
|
|
79
|
-
return { ok: true, out: stdout };
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
const code = error.code;
|
|
83
|
-
return { ok: false, code: typeof code === "number" ? code : null };
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
const EMPTY_STATE = { arrived: [], told: {}, held: [] };
|
|
88
|
-
const stateSchema = z.object({
|
|
89
|
-
arrived: z.array(publishedElsewhereSchema).catch([]),
|
|
90
|
-
told: z.record(z.string(), z.array(z.string())).catch({}),
|
|
91
|
-
held: z.array(z.string()).catch([]),
|
|
92
|
-
});
|
|
93
|
-
function parseState(raw) {
|
|
94
|
-
const parsed = stateSchema.safeParse(JSON.parse(raw));
|
|
95
|
-
return parsed.success ? parsed.data : EMPTY_STATE;
|
|
96
|
-
}
|
|
97
|
-
/** Whether HEAD already holds `sha`: `unknown` when the commit is not in this (shallow) clone at all. */
|
|
98
|
-
async function containment(git, sha) {
|
|
99
|
-
const result = await git(["merge-base", "--is-ancestor", sha, "HEAD"]);
|
|
100
|
-
if (result.ok) {
|
|
101
|
-
return "contained";
|
|
102
|
-
}
|
|
103
|
-
return result.code === 1 ? "missing" : "unknown";
|
|
104
|
-
}
|
|
105
|
-
function sorted(results) {
|
|
106
|
-
return {
|
|
107
|
-
missing: results.filter(({ is }) => is === "missing").map(({ entry }) => entry),
|
|
108
|
-
held: results.filter(({ is }) => is !== "missing").map(({ entry }) => entry.sha),
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
async function missingFromWorkspace(git, published) {
|
|
112
|
-
const first = await Promise.all(published.map(async (entry) => ({ entry, is: await containment(git, entry.sha) })));
|
|
113
|
-
if (!first.some(({ is }) => is === "unknown")) {
|
|
114
|
-
return sorted(first);
|
|
115
|
-
}
|
|
116
|
-
const fetched = await git(["fetch", "--quiet", "--no-tags", "origin", "+refs/heads/main:refs/remotes/origin/main"], {
|
|
117
|
-
timeoutMs: FETCH_TIMEOUT_MS,
|
|
118
|
-
});
|
|
119
|
-
if (!fetched.ok) {
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
const settled = await Promise.all(first.map(async ({ entry, is }) => ({ entry, is: is === "unknown" ? await containment(git, entry.sha) : is })));
|
|
123
|
-
// Still absent after fetching main: older than the shallow clone's tip, so the
|
|
124
|
-
// clone already holds it — or no longer on main, which is nothing to report.
|
|
125
|
-
return sorted(settled);
|
|
126
|
-
}
|
|
127
|
-
function linesOf(out) {
|
|
128
|
-
return out.split("\n").filter((line) => line.length > 0);
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Why the workspace cannot take `main` as it stands, or null when it can: this
|
|
132
|
-
* chat has changed nothing, and every commit on the way is a recorded publish.
|
|
133
|
-
*/
|
|
134
|
-
async function reasonToHoldBack(git, recordedShas) {
|
|
135
|
-
const isAncestor = await git(["merge-base", "--is-ancestor", "HEAD", "origin/main"]);
|
|
136
|
-
if (!isAncestor.ok) {
|
|
137
|
-
return "own_commits";
|
|
138
|
-
}
|
|
139
|
-
const status = await git(["status", "--porcelain=v1", "--untracked-files=all"]);
|
|
140
|
-
if (!status.ok || status.out.trim().length > 0) {
|
|
141
|
-
return "own_work";
|
|
142
|
-
}
|
|
143
|
-
const incoming = await git(["rev-list", "HEAD..origin/main"]);
|
|
144
|
-
if (!incoming.ok || linesOf(incoming.out).some((sha) => !recordedShas.has(sha))) {
|
|
145
|
-
return "platform_update";
|
|
146
|
-
}
|
|
147
|
-
const paths = await git(["diff", "--name-only", "-z", "HEAD", "origin/main"]);
|
|
148
|
-
if (!paths.ok || paths.out.split("\0").some((path) => INSTALLED_FROM.test(path))) {
|
|
149
|
-
return "installed_packages";
|
|
150
|
-
}
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* `main` in a Runtime is the point the chat's work starts from: the dashboard's
|
|
155
|
-
* list of this chat's changes diffs `main...HEAD`. Keep it there as the chat's
|
|
156
|
-
* base moves, or every file another chat published reads as this chat's own.
|
|
157
|
-
*/
|
|
158
|
-
async function keepBaseAt(git, base) {
|
|
159
|
-
const current = await git(["rev-parse", "--verify", "--quiet", "refs/heads/main"]);
|
|
160
|
-
if (!current.ok) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
const at = current.out.trim();
|
|
164
|
-
if (at === base) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
const behindBase = await git(["merge-base", "--is-ancestor", at, base]);
|
|
168
|
-
if (behindBase.ok) {
|
|
169
|
-
await git(["update-ref", "refs/heads/main", base, at]);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
async function fastForward(git) {
|
|
173
|
-
const before = await git(["rev-parse", "HEAD"]);
|
|
174
|
-
const target = await git(["rev-parse", "origin/main"]);
|
|
175
|
-
if (!before.ok || !target.ok) {
|
|
176
|
-
return false;
|
|
177
|
-
}
|
|
178
|
-
// The base moves first, so the changes list never sees the new files against the old base.
|
|
179
|
-
await keepBaseAt(git, target.out.trim());
|
|
180
|
-
const merged = await git(["merge", "--ff-only", "--quiet", "origin/main"], { timeoutMs: CHECKOUT_TIMEOUT_MS });
|
|
181
|
-
if (merged.ok) {
|
|
182
|
-
return true;
|
|
183
|
-
}
|
|
184
|
-
// The tree was clean a moment ago, so whatever a failed checkout left is its own.
|
|
185
|
-
const incoming = await git(["diff", "--name-only", "-z", before.out.trim(), target.out.trim()]);
|
|
186
|
-
await git(["reset", "--quiet", "--hard", before.out.trim()]);
|
|
187
|
-
if (incoming.ok) {
|
|
188
|
-
const paths = incoming.out.split("\0").filter((path) => path.length > 0);
|
|
189
|
-
if (paths.length > 0) {
|
|
190
|
-
await git(["clean", "--quiet", "-fd", "--", ...paths]);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
await git(["update-ref", "refs/heads/main", before.out.trim()]);
|
|
194
|
-
return false;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Whether this checkout is a chat's workspace this module may touch: not while
|
|
198
|
-
* a Publish is squashing and rebasing it, and never a developer's checkout (the
|
|
199
|
-
* bridge's own tests, a local run) — only a chat's branch is ours to move.
|
|
200
|
-
*/
|
|
201
|
-
async function isChatWorkspace(git, projectRoot) {
|
|
202
|
-
if (existsSync(join(projectRoot, PUBLISH_STATE_FILE))) {
|
|
203
|
-
return false;
|
|
204
|
-
}
|
|
205
|
-
const branch = await git(["branch", "--show-current"]);
|
|
206
|
-
return branch.ok && CHAT_BRANCH.test(branch.out.trim());
|
|
207
|
-
}
|
|
208
|
-
async function keepBaseAtChatStart(git) {
|
|
209
|
-
const base = await git(["merge-base", "HEAD", "origin/main"]);
|
|
210
|
-
if (base.ok) {
|
|
211
|
-
await keepBaseAt(git, base.out.trim());
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
async function standing(git, projectRoot, published, known) {
|
|
215
|
-
if (!(await isChatWorkspace(git, projectRoot))) {
|
|
216
|
-
return { kind: "unavailable" };
|
|
217
|
-
}
|
|
218
|
-
await keepBaseAtChatStart(git);
|
|
219
|
-
const found = await missingFromWorkspace(git, published.filter((entry) => !known.has(entry.sha)));
|
|
220
|
-
if (found === null) {
|
|
221
|
-
return { kind: "unavailable" };
|
|
222
|
-
}
|
|
223
|
-
const { missing } = found;
|
|
224
|
-
const held = [...known, ...found.held];
|
|
225
|
-
if (missing.length === 0) {
|
|
226
|
-
return { kind: "current", held };
|
|
227
|
-
}
|
|
228
|
-
const why = await reasonToHoldBack(git, new Set(published.map((entry) => entry.sha)));
|
|
229
|
-
if (why !== null) {
|
|
230
|
-
return { kind: "behind", held, missing, why };
|
|
231
|
-
}
|
|
232
|
-
if (!(await fastForward(git))) {
|
|
233
|
-
return { kind: "behind", held, missing, why: "checkout_failed" };
|
|
234
|
-
}
|
|
235
|
-
return { kind: "updated", held: [...held, ...missing.map((entry) => entry.sha)], arrived: missing };
|
|
236
|
-
}
|
|
237
|
-
function sanitize(text, max) {
|
|
238
|
-
const flat = text.replace(/\s+/g, " ").replaceAll("`", "'").trim();
|
|
239
|
-
return flat.length > max ? `${flat.slice(0, max - 1)}…` : flat;
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* The unit a marketer's work is organised in: a page folder, a Knowledge entry,
|
|
243
|
-
* a Form. Three path segments reach it for everything under `src/`.
|
|
244
|
-
*/
|
|
245
|
-
function areaOf(path) {
|
|
246
|
-
return path.split("/").slice(0, 3).join("/");
|
|
247
|
-
}
|
|
248
|
-
function describePublish(entry) {
|
|
249
|
-
const areas = [...new Set(entry.paths.map(areaOf))];
|
|
250
|
-
const shown = areas.slice(0, MAX_AREAS_LISTED).map((area) => `\`${area}\``);
|
|
251
|
-
const more = areas.length > shown.length ? ` and ${areas.length - shown.length} more` : "";
|
|
252
|
-
const where = shown.length > 0 ? `: ${shown.join(", ")}${more}` : "";
|
|
253
|
-
const who = entry.chatId
|
|
254
|
-
? `chat "${sanitize(entry.title, MAX_TITLE_LENGTH)}" (\`baker chats diff ${entry.chatId}\`)`
|
|
255
|
-
: "a change made in the dashboard";
|
|
256
|
-
return `- ${who}${where}`;
|
|
257
|
-
}
|
|
258
|
-
function describePublishes(entries) {
|
|
259
|
-
const newestFirst = [...entries].sort((a, b) => b.publishedAt - a.publishedAt);
|
|
260
|
-
const shown = newestFirst.slice(0, MAX_PUBLISHES_LISTED).map(describePublish);
|
|
261
|
-
const rest = newestFirst.length - shown.length;
|
|
262
|
-
return rest > 0 ? [...shown, `- and ${rest} earlier publish${rest === 1 ? "" : "es"}`] : shown;
|
|
263
|
-
}
|
|
264
|
-
function reminder(lines) {
|
|
265
|
-
return [
|
|
266
|
-
"<system-reminder>",
|
|
267
|
-
...lines,
|
|
268
|
-
"This note comes from Baker, not from the user: reply in the language of the user's own message.",
|
|
269
|
-
"</system-reminder>",
|
|
270
|
-
].join("\n");
|
|
271
|
-
}
|
|
272
|
-
function updatedReminder(arrived) {
|
|
273
|
-
return reminder([
|
|
274
|
-
"Baker: this workspace was brought up to date with work other chats published since your last look.",
|
|
275
|
-
...describePublishes(arrived),
|
|
276
|
-
"Anything you read from those files earlier in this conversation is out of date: read them again before you edit them or tell the user what they contain.",
|
|
277
|
-
]);
|
|
278
|
-
}
|
|
279
|
-
const WHY_HELD_BACK = {
|
|
280
|
-
own_work: "This chat has changes of its own, so its files were left exactly as they are and do not show those publishes.",
|
|
281
|
-
platform_update: "It is waiting behind a platform update that only a Publish applies, so the files were left exactly as they are.",
|
|
282
|
-
installed_packages: "It changes the packages this workspace installed when it started, so the files were left exactly as they are.",
|
|
283
|
-
own_commits: "This chat's work cannot be brought forward without Publishing, so its files were left as they are.",
|
|
284
|
-
checkout_failed: "Bringing it in did not finish, so the files were left exactly as they were.",
|
|
285
|
-
};
|
|
286
|
-
/** How the agent takes published work in when the user wants to change it — never a second copy. */
|
|
287
|
-
const BRING_IT_IN = "To change one of those, bring the published work into this workspace first with `git merge --ff-only origin/main` (git refuses, changing nothing, if that would touch this chat's own changes) and edit it there; a second copy made here collides with the published one when this chat publishes. If git refuses, tell the user that page will need their decision when this chat publishes.";
|
|
288
|
-
function behindReminder(missing, why) {
|
|
289
|
-
return reminder([
|
|
290
|
-
"Baker: other chats published work that this workspace does not show yet.",
|
|
291
|
-
...describePublishes(missing),
|
|
292
|
-
WHY_HELD_BACK[why],
|
|
293
|
-
"Those pages and entries are live even though they are not in this workspace. Before you create a page, name one, or tell the user what exists, read the published version: `git show origin/main:<path>`, or `git ls-tree -r --name-only origin/main -- <folder>` for a folder.",
|
|
294
|
-
BRING_IT_IN,
|
|
295
|
-
]);
|
|
296
|
-
}
|
|
297
|
-
/** The page folder a path is in (`src/pages/<slug>`), or null outside the pages. */
|
|
298
|
-
function pageFolderOf(path) {
|
|
299
|
-
if (!path.startsWith(PAGES)) {
|
|
300
|
-
return null;
|
|
301
|
-
}
|
|
302
|
-
const slug = path.slice(PAGES.length).split("/")[0];
|
|
303
|
-
return slug && !slug.includes(".") ? `${PAGES}${slug}` : null;
|
|
304
|
-
}
|
|
305
|
-
/** The notes a thread needs now, and the state that records it was told them. */
|
|
306
|
-
function notesFor(loaded, now, threadId, withNote) {
|
|
307
|
-
const arrived = [...loaded.arrived, ...(now.kind === "updated" ? now.arrived : [])];
|
|
308
|
-
// A thread that starts here reads the files as they are now: what arrived
|
|
309
|
-
// before it existed is nothing it could have read stale.
|
|
310
|
-
const alreadyTold = new Set(loaded.told[threadId] ?? loaded.arrived.map((entry) => entry.sha));
|
|
311
|
-
const newlyArrived = arrived.filter((entry) => !alreadyTold.has(entry.sha));
|
|
312
|
-
const behind = now.kind === "behind" ? now : null;
|
|
313
|
-
const newlyMissing = behind ? behind.missing.filter((entry) => !alreadyTold.has(entry.sha)) : [];
|
|
314
|
-
const told = withNote ? [...alreadyTold, ...[...newlyArrived, ...newlyMissing].map((entry) => entry.sha)] : [];
|
|
315
|
-
const next = {
|
|
316
|
-
arrived,
|
|
317
|
-
told: { ...loaded.told, [threadId]: withNote ? [...new Set(told)] : [...alreadyTold] },
|
|
318
|
-
held: [...new Set(now.held)],
|
|
319
|
-
};
|
|
320
|
-
if (!withNote) {
|
|
321
|
-
return { notes: {}, next };
|
|
322
|
-
}
|
|
323
|
-
const updatedNote = newlyArrived.length > 0 ? updatedReminder(newlyArrived) : undefined;
|
|
324
|
-
const behindNote = behind ? behindReminder(behind.missing, behind.why) : undefined;
|
|
325
|
-
const resumed = joined([updatedNote, newlyMissing.length > 0 ? behindNote : undefined]);
|
|
326
|
-
const recovered = joined([updatedNote, behindNote]);
|
|
327
|
-
return { notes: { ...(resumed ? { resumed } : {}), ...(recovered ? { recovered } : {}) }, next };
|
|
328
|
-
}
|
|
329
|
-
/** The publish a new file at `path` would clash with, and the place it names. */
|
|
330
|
-
function clashAt(projectRoot, missing, path) {
|
|
331
|
-
if (path.startsWith("../") || existsSync(join(projectRoot, path))) {
|
|
332
|
-
return null;
|
|
333
|
-
}
|
|
334
|
-
const folder = pageFolderOf(path);
|
|
335
|
-
if (folder && existsSync(join(projectRoot, folder))) {
|
|
336
|
-
return null;
|
|
337
|
-
}
|
|
338
|
-
const clashes = (published) => (folder ? pageFolderOf(published) === folder : published === path);
|
|
339
|
-
const entry = missing.find((candidate) => candidate.paths.some(clashes));
|
|
340
|
-
return entry ? { entry, place: folder ?? path, folder } : null;
|
|
341
|
-
}
|
|
342
|
-
function clashMessage(clash) {
|
|
343
|
-
const who = clash.entry.chatId
|
|
344
|
-
? `another chat ("${sanitize(clash.entry.title, MAX_TITLE_LENGTH)}")`
|
|
345
|
-
: "the dashboard";
|
|
346
|
-
const readIt = clash.folder
|
|
347
|
-
? `\`git ls-tree -r --name-only origin/main -- ${clash.folder}\` and \`git show origin/main:<path>\``
|
|
348
|
-
: `\`git show origin/main:${clash.place}\``;
|
|
349
|
-
return [
|
|
350
|
-
`\`${clash.place}\` was already published by ${who} after this chat started, so it is live but not in this workspace.`,
|
|
351
|
-
`Creating it here would clash with it when this chat publishes. Read the published version first (${readIt}).`,
|
|
352
|
-
"If the user wants something new, use a different name.",
|
|
353
|
-
BRING_IT_IN,
|
|
354
|
-
"Only if the user, knowing it exists, still wants a separate copy here, write it again.",
|
|
355
|
-
].join(" ");
|
|
356
|
-
}
|
|
357
|
-
export function createMainSync(projectRoot) {
|
|
358
|
-
const git = gitIn(projectRoot);
|
|
359
|
-
const statePath = join(projectRoot, STATE_FILE);
|
|
360
|
-
/** What this workspace was last found not to show, for `refuseWrite`. */
|
|
361
|
-
let missing = [];
|
|
362
|
-
const refused = new Set();
|
|
363
|
-
async function load() {
|
|
364
|
-
try {
|
|
365
|
-
return parseState(await readFile(statePath, "utf-8"));
|
|
366
|
-
}
|
|
367
|
-
catch {
|
|
368
|
-
return EMPTY_STATE;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
async function save(state) {
|
|
372
|
-
await mkdir(dirname(statePath), { recursive: true });
|
|
373
|
-
const temporary = `${statePath}.${process.pid}.tmp`;
|
|
374
|
-
await writeFile(temporary, `${JSON.stringify(state)}\n`, "utf-8");
|
|
375
|
-
await rename(temporary, statePath);
|
|
376
|
-
}
|
|
377
|
-
return {
|
|
378
|
-
beforeTurn: async (threadId, published, turn = {}) => {
|
|
379
|
-
const loaded = await load();
|
|
380
|
-
const now = await standing(git, projectRoot, published, new Set(loaded.held));
|
|
381
|
-
if (now.kind === "unavailable") {
|
|
382
|
-
return {};
|
|
383
|
-
}
|
|
384
|
-
missing = now.kind === "behind" ? now.missing : [];
|
|
385
|
-
const { notes, next } = notesFor(loaded, now, threadId, turn.withNote !== false);
|
|
386
|
-
await save(next);
|
|
387
|
-
return notes;
|
|
388
|
-
},
|
|
389
|
-
refuseWrite: (threadId, filePath) => {
|
|
390
|
-
const path = (isAbsolute(filePath) ? relative(projectRoot, filePath) : filePath).replaceAll("\\", "/");
|
|
391
|
-
const clash = missing.length > 0 ? clashAt(projectRoot, missing, path) : null;
|
|
392
|
-
const key = clash ? `${threadId}\0${clash.place}` : null;
|
|
393
|
-
if (!clash || !key || refused.has(key)) {
|
|
394
|
-
return null;
|
|
395
|
-
}
|
|
396
|
-
refused.add(key);
|
|
397
|
-
return clashMessage(clash);
|
|
398
|
-
},
|
|
399
|
-
afterTurn: async () => {
|
|
400
|
-
if (await isChatWorkspace(git, projectRoot)) {
|
|
401
|
-
await keepBaseAtChatStart(git);
|
|
402
|
-
}
|
|
403
|
-
},
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
function joined(blocks) {
|
|
407
|
-
return blocks.filter((block) => block !== undefined).join("\n\n") || undefined;
|
|
408
|
-
}
|
|
409
|
-
//# sourceMappingURL=main-sync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main-sync.js","sourceRoot":"","sources":["../../src/hono/main-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,4EAA4E;AAC5E,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,iFAAiF;AACjF,MAAM,mBAAmB,GAAG,OAAO,CAAC;AACpC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,oGAAoG;AACpG,MAAM,WAAW,GAAG,UAAU,C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