@koda-sl/baker-bridge 0.108.0 → 0.109.0-dev.afb6a264b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The end-of-turn steps the scaffold's Stop hooks take, run by the bridge.
3
+ *
4
+ * Those hooks skip a Stop given while background work still runs and act on
5
+ * the turn's last Stop instead. A background task can settle without waking the
6
+ * model, and then the turn ends with no further Stop: the markdown edit lock
7
+ * stays held and a stalled background publish is never reported. So once a turn
8
+ * that ran tasks has really ended, the bridge runs the same scripts itself —
9
+ * with no background work in their input, which is now true. Each is
10
+ * idempotent, so a last Stop that did fire costs nothing extra.
11
+ *
12
+ * Not the autorender hook: it asks the model to re-render, and there is no
13
+ * model left to ask. Its marker survives to the next turn's Stop, and the
14
+ * workspace's verify refuses to publish a stale render.
15
+ *
16
+ * Source of truth: __tooling__/hooks/base/flush-format-on-stop.mjs, and
17
+ * recover-stalled-publish.mjs through `recoverStalledPublish`.
18
+ */
19
+ export declare function settleWorkspaceAfterTasks(cwd?: string): Promise<void>;
20
+ //# sourceMappingURL=workspace-settle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-settle.d.ts","sourceRoot":"","sources":["../../src/hono/workspace-settle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAUH,wBAAsB,yBAAyB,CAAC,GAAG,SAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGlF"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The end-of-turn steps the scaffold's Stop hooks take, run by the bridge.
3
+ *
4
+ * Those hooks skip a Stop given while background work still runs and act on
5
+ * the turn's last Stop instead. A background task can settle without waking the
6
+ * model, and then the turn ends with no further Stop: the markdown edit lock
7
+ * stays held and a stalled background publish is never reported. So once a turn
8
+ * that ran tasks has really ended, the bridge runs the same scripts itself —
9
+ * with no background work in their input, which is now true. Each is
10
+ * idempotent, so a last Stop that did fire costs nothing extra.
11
+ *
12
+ * Not the autorender hook: it asks the model to re-render, and there is no
13
+ * model left to ask. Its marker survives to the next turn's Stop, and the
14
+ * workspace's verify refuses to publish a stale render.
15
+ *
16
+ * Source of truth: __tooling__/hooks/base/flush-format-on-stop.mjs, and
17
+ * recover-stalled-publish.mjs through `recoverStalledPublish`.
18
+ */
19
+ import { execFile } from "node:child_process";
20
+ import { existsSync } from "node:fs";
21
+ import { join } from "node:path";
22
+ import { recoverStalledPublish } from "./publish-recovery.js";
23
+ const FLUSH_FORMAT_SCRIPT = "__tooling__/hooks/base/flush-format-on-stop.mjs";
24
+ const SCRIPT_TIMEOUT_MS = 35_000;
25
+ export async function settleWorkspaceAfterTasks(cwd = process.cwd()) {
26
+ await runStopScript(cwd, FLUSH_FORMAT_SCRIPT);
27
+ await recoverStalledPublish(cwd);
28
+ }
29
+ async function runStopScript(cwd, script) {
30
+ const path = join(cwd, script);
31
+ if (!existsSync(path)) {
32
+ return;
33
+ }
34
+ await new Promise((resolve) => {
35
+ const child = execFile("node", [path], { cwd, timeout: SCRIPT_TIMEOUT_MS }, (err) => {
36
+ if (err) {
37
+ console.error(`[workspace-settle] ${script} failed:`, err.message);
38
+ }
39
+ resolve();
40
+ });
41
+ child.stdin?.end(JSON.stringify({ hook_event_name: "Stop", background_tasks: [] }));
42
+ child.stdout?.resume();
43
+ child.stderr?.resume();
44
+ });
45
+ }
46
+ //# sourceMappingURL=workspace-settle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-settle.js","sourceRoot":"","sources":["../../src/hono/workspace-settle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAA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6a264b",
4
4
  "description": "HTTP server wrapping the Claude Agent SDK. Persists chat events to Convex; the dashboard subscribes via Convex realtime",
5
5
  "license": "MIT",
6
6
  "type": "module",