@paradow/ledge 0.7.0 → 0.8.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.
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  attachEnv
3
- } from "./chunk-HR6VWBLT.js";
4
- import "./chunk-3TXM4DM7.js";
3
+ } from "./chunk-7AKUPFMS.js";
4
+ import "./chunk-ZPANTZKC.js";
5
5
  import {
6
6
  realTmux
7
7
  } from "./chunk-3TNPEAMR.js";
8
8
  import "./chunk-L6IGH4LF.js";
9
9
  import {
10
10
  connect
11
- } from "./chunk-MK7NEXY7.js";
11
+ } from "./chunk-6ZKNEJND.js";
12
12
  import {
13
13
  PROTOCOL_PORT
14
- } from "./chunk-4BBKLTDB.js";
14
+ } from "./chunk-KJWMK65Y.js";
15
15
 
16
16
  // src/cli/attach.ts
17
17
  import { spawn } from "child_process";
@@ -6,7 +6,7 @@ import {
6
6
  PROTOCOL_PORT,
7
7
  parseClientMessage,
8
8
  parseServerMessage
9
- } from "./chunk-4BBKLTDB.js";
9
+ } from "./chunk-KJWMK65Y.js";
10
10
 
11
11
  // src/cli/bridge.ts
12
12
  import WebSocket from "ws";
@@ -0,0 +1,6 @@
1
+ // src/version.ts
2
+ var LEDGE_VERSION = true ? "0.8.0" : "0.0.0-dev";
3
+
4
+ export {
5
+ LEDGE_VERSION
6
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PROTOCOL_PORT,
3
3
  parseServerMessage
4
- } from "./chunk-4BBKLTDB.js";
4
+ } from "./chunk-KJWMK65Y.js";
5
5
 
6
6
  // src/client.ts
7
7
  import WebSocket from "ws";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  exitFile,
3
3
  spawnSession
4
- } from "./chunk-3TXM4DM7.js";
4
+ } from "./chunk-ZPANTZKC.js";
5
5
  import {
6
6
  realTmux
7
7
  } from "./chunk-3TNPEAMR.js";
@@ -11,10 +11,10 @@ import {
11
11
  } from "./chunk-L6IGH4LF.js";
12
12
  import {
13
13
  connect
14
- } from "./chunk-MK7NEXY7.js";
14
+ } from "./chunk-6ZKNEJND.js";
15
15
  import {
16
16
  PROTOCOL_PORT
17
- } from "./chunk-4BBKLTDB.js";
17
+ } from "./chunk-KJWMK65Y.js";
18
18
 
19
19
  // src/cli/launch.ts
20
20
  import { spawn } from "child_process";
@@ -30,7 +30,9 @@ var HelperSchema = z.object({
30
30
  id: z.string(),
31
31
  kind: z.string(),
32
32
  task: z.string(),
33
- state: SessionStateSchema
33
+ state: SessionStateSchema,
34
+ /** When this helper finished; retained across daemon restarts until its five-minute expiry. */
35
+ finishedAt: z.string().datetime().optional()
34
36
  });
35
37
  var TopicSourceSchema = z.enum(["user", "pane", "prompt"]);
36
38
  var SessionSchema = z.object({
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  cleanTopic,
3
3
  sessionTitle
4
- } from "./chunk-4BBKLTDB.js";
4
+ } from "./chunk-KJWMK65Y.js";
5
5
 
6
6
  // src/daemon/crossSession.ts
7
7
  var FIRST_LINE = /^Another Claude session sent a message:\s*\n/;
@@ -151,6 +151,23 @@ function withTopic(s, text, source) {
151
151
  return { ...next, title: sessionTitle(next) };
152
152
  }
153
153
  function reduce(s, ev) {
154
+ const next = reduceEvent(s, ev);
155
+ if (next === s) return s;
156
+ let changed = false;
157
+ const helpers = next.helpers.map((h) => {
158
+ if (h.state === "exited" || next.state === "exited") {
159
+ if (h.state === "exited" && h.finishedAt) return h;
160
+ changed = true;
161
+ return { ...h, state: "exited", finishedAt: h.finishedAt ?? next.exitedAt ?? ev.at };
162
+ }
163
+ if (!h.finishedAt) return h;
164
+ changed = true;
165
+ const { finishedAt: _gone, ...active } = h;
166
+ return active;
167
+ });
168
+ return changed ? { ...next, helpers } : next;
169
+ }
170
+ function reduceEvent(s, ev) {
154
171
  if (ev.agentSessionId && !ev.helperId && ev.agentSessionId !== s.agentSessionId) s = { ...s, agentSessionId: ev.agentSessionId };
155
172
  if (s.state === "exited") return s;
156
173
  s = endCursorHelpers(s, ev);
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-L6IGH4LF.js";
4
4
  import {
5
5
  pickName
6
- } from "./chunk-4BBKLTDB.js";
6
+ } from "./chunk-KJWMK65Y.js";
7
7
 
8
8
  // src/daemon/transcript.ts
9
9
  import { closeSync, fstatSync, openSync, readSync } from "fs";
@@ -2,15 +2,15 @@ import {
2
2
  QUESTION_TOOLS,
3
3
  crossSession,
4
4
  reduce
5
- } from "./chunk-GZFSUQZJ.js";
5
+ } from "./chunk-Y5TCZTFL.js";
6
6
  import {
7
7
  agentMessages,
8
8
  claudePlan,
9
9
  spawnSession
10
- } from "./chunk-3TXM4DM7.js";
10
+ } from "./chunk-ZPANTZKC.js";
11
11
  import {
12
12
  LEDGE_VERSION
13
- } from "./chunk-KD7LKXIF.js";
13
+ } from "./chunk-3KKTSYHP.js";
14
14
  import {
15
15
  SERVICE,
16
16
  inDaemonService,
@@ -52,7 +52,7 @@ import {
52
52
  pendingKey,
53
53
  pickName,
54
54
  projectOf
55
- } from "./chunk-4BBKLTDB.js";
55
+ } from "./chunk-KJWMK65Y.js";
56
56
 
57
57
  // src/daemon/index.ts
58
58
  import { writeFile as writeFile5, rm as rm5 } from "fs/promises";
@@ -1341,6 +1341,7 @@ async function gitSummary(cwd, exec = execGit) {
1341
1341
  // src/daemon/poller.ts
1342
1342
  var DETECT_LINES = 60;
1343
1343
  var REST_MS = 2e3;
1344
+ var HELPER_RETENTION_MS = 5 * 60 * 1e3;
1344
1345
  function startPoller(opts) {
1345
1346
  const { store, tmux } = opts;
1346
1347
  const adapterFor2 = opts.adapterFor ?? adapterFor;
@@ -1372,7 +1373,9 @@ function startPoller(opts) {
1372
1373
  const deadCheck = t - lastDeadCheck >= deadCheckMs;
1373
1374
  if (deadCheck) lastDeadCheck = t;
1374
1375
  for (const id of previews.keys()) if (!store.get(id)) previews.delete(id);
1375
- for (const s of store.all()) {
1376
+ for (const snapshot of store.all()) {
1377
+ const s = store.get(snapshot.id);
1378
+ if (!s) continue;
1376
1379
  try {
1377
1380
  await pollOne(s, t, deadCheck);
1378
1381
  } catch (e) {
@@ -1384,6 +1387,16 @@ function startPoller(opts) {
1384
1387
  }
1385
1388
  }
1386
1389
  async function pollOne(s, t, deadCheck) {
1390
+ const helpers = s.helpers.flatMap((h2) => {
1391
+ if (s.pending?.helperId === h2.id || h2.state !== "exited" && s.state !== "exited") return [h2];
1392
+ const finishedAt = h2.finishedAt ?? s.exitedAt ?? s.lastActivityAt;
1393
+ if (t - Date.parse(finishedAt) >= HELPER_RETENTION_MS) return [];
1394
+ return h2.finishedAt && h2.state === "exited" ? [h2] : [{ ...h2, state: "exited", finishedAt }];
1395
+ });
1396
+ if (helpers.length !== s.helpers.length || helpers.some((h2, i) => h2 !== s.helpers[i])) {
1397
+ s = { ...s, helpers };
1398
+ store.upsert(s);
1399
+ }
1387
1400
  if (s.state === "exited") {
1388
1401
  forget(s.id);
1389
1402
  if (!s.archivedAt && s.exitedAt) {
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  QUESTION_TOOLS
3
- } from "./chunk-GZFSUQZJ.js";
3
+ } from "./chunk-Y5TCZTFL.js";
4
4
  import {
5
5
  CODEX_ENV_VAR,
6
6
  CODEX_HOOK_VAR,
7
7
  codexPlan
8
- } from "./chunk-3TXM4DM7.js";
8
+ } from "./chunk-ZPANTZKC.js";
9
9
  import {
10
10
  log
11
11
  } from "./chunk-L6IGH4LF.js";
12
12
  import {
13
13
  connect
14
- } from "./chunk-MK7NEXY7.js";
15
- import "./chunk-4BBKLTDB.js";
14
+ } from "./chunk-6ZKNEJND.js";
15
+ import "./chunk-KJWMK65Y.js";
16
16
 
17
17
  // src/cli/hook.ts
18
18
  import { readFileSync, openSync, fstatSync, readSync, closeSync } from "fs";
package/dist/cli/index.js CHANGED
@@ -16,7 +16,7 @@ async function hookMain(args) {
16
16
  try {
17
17
  const chunks = [];
18
18
  for await (const c of process.stdin) chunks.push(c);
19
- const { runHook } = await import("./hook-ZVXQ3MGS.js");
19
+ const { runHook } = await import("./hook-BBVUY4RK.js");
20
20
  await runHook(event, Buffer.concat(chunks).toString("utf8"), { tool });
21
21
  } catch {
22
22
  }
@@ -26,7 +26,7 @@ async function main(argv) {
26
26
  const [cmd, ...rest] = argv;
27
27
  switch (cmd) {
28
28
  case "daemon": {
29
- const { startDaemon } = await import("./daemon-GREPJUOS.js");
29
+ const { startDaemon } = await import("./daemon-SRNTDIZW.js");
30
30
  await startDaemon();
31
31
  await new Promise(() => {
32
32
  });
@@ -34,7 +34,7 @@ async function main(argv) {
34
34
  }
35
35
  case "--version":
36
36
  case "version": {
37
- const { LEDGE_VERSION } = await import("./version-X3LYAGKA.js");
37
+ const { LEDGE_VERSION } = await import("./version-M6IZZGUV.js");
38
38
  console.log(LEDGE_VERSION);
39
39
  return 0;
40
40
  }
@@ -50,23 +50,23 @@ async function main(argv) {
50
50
  return r.ok ? 0 : 1;
51
51
  }
52
52
  case "status": {
53
- const { printStatus } = await import("./status-RVD4U2XH.js");
53
+ const { printStatus } = await import("./status-L2GROM4J.js");
54
54
  console.log(await printStatus());
55
55
  return 0;
56
56
  }
57
57
  case "bridge": {
58
- const { bridge } = await import("./bridge-ZYR3IBVM.js");
58
+ const { bridge } = await import("./bridge-QKQW7UD6.js");
59
59
  await bridge();
60
60
  return 0;
61
61
  }
62
62
  case "claude":
63
63
  case "codex":
64
64
  case "cursor": {
65
- const { launch } = await import("./launch-PIFVOOJV.js");
65
+ const { launch } = await import("./launch-RWT4EWWI.js");
66
66
  return launch(cmd, rest);
67
67
  }
68
68
  case "attach": {
69
- const { attach } = await import("./attach-P6CWCJ2R.js");
69
+ const { attach } = await import("./attach-KTZOG7E5.js");
70
70
  return attach(rest[0] ?? "");
71
71
  }
72
72
  default:
@@ -5,15 +5,15 @@ import {
5
5
  ensureDaemon,
6
6
  launch,
7
7
  parseLaunchArgs
8
- } from "./chunk-HR6VWBLT.js";
8
+ } from "./chunk-7AKUPFMS.js";
9
9
  import {
10
10
  agentEnv,
11
11
  exitFile
12
- } from "./chunk-3TXM4DM7.js";
12
+ } from "./chunk-ZPANTZKC.js";
13
13
  import "./chunk-3TNPEAMR.js";
14
14
  import "./chunk-L6IGH4LF.js";
15
- import "./chunk-MK7NEXY7.js";
16
- import "./chunk-4BBKLTDB.js";
15
+ import "./chunk-6ZKNEJND.js";
16
+ import "./chunk-KJWMK65Y.js";
17
17
  export {
18
18
  DaemonError,
19
19
  agentEnv,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-MK7NEXY7.js";
4
- import "./chunk-4BBKLTDB.js";
3
+ } from "./chunk-6ZKNEJND.js";
4
+ import "./chunk-KJWMK65Y.js";
5
5
 
6
6
  // src/cli/status.ts
7
7
  async function printStatus(opts = {}) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  LEDGE_VERSION
3
- } from "./chunk-KD7LKXIF.js";
3
+ } from "./chunk-3KKTSYHP.js";
4
4
  export {
5
5
  LEDGE_VERSION
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paradow/ledge",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Follow and answer your WSL agent sessions (Claude Code, Codex, Cursor Agent) from the Ledge island on Windows.",
5
5
  "type": "module",
6
6
  "bin": { "ledge": "dist/cli/index.js" },
@@ -1,6 +0,0 @@
1
- // src/version.ts
2
- var LEDGE_VERSION = true ? "0.7.0" : "0.0.0-dev";
3
-
4
- export {
5
- LEDGE_VERSION
6
- };