@paradow/ledge 0.5.4 → 0.7.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,7 +1,24 @@
1
1
  import {
2
2
  cleanTopic,
3
3
  sessionTitle
4
- } from "./chunk-E6ZQOGY4.js";
4
+ } from "./chunk-4BBKLTDB.js";
5
+
6
+ // src/daemon/crossSession.ts
7
+ var FIRST_LINE = /^Another Claude session sent a message:\s*\n/;
8
+ var BLOCK = /<cross-session-message\b([^>]*)>([\s\S]*?)(?:<\/cross-session-message>|(?=\n[ \t]*<cross-session-message\b)|$)/g;
9
+ var ATTR = /([\w-]+)="([^"]*)"/g;
10
+ function crossSession(text) {
11
+ const body = text.trimStart().replace(FIRST_LINE, "");
12
+ if (!body.startsWith("<cross-session-message")) return void 0;
13
+ const out = [];
14
+ for (const m of body.matchAll(BLOCK)) {
15
+ const attrs = new Map([...m[1].matchAll(ATTR)].map((a) => [a[1], a[2]]));
16
+ const from = attrs.get("from");
17
+ const name = attrs.get("from-name");
18
+ if (from) out.push({ from, ...name ? { name } : {}, text: m[2].trim() });
19
+ }
20
+ return out.length ? out : void 0;
21
+ }
5
22
 
6
23
  // src/daemon/state.ts
7
24
  var HOOK_PRIORITY_MS = 2e3;
@@ -119,7 +136,7 @@ function withoutReply(s) {
119
136
  return rest;
120
137
  }
121
138
  function samePending(a, b) {
122
- return a.kind === b.kind && a.text === b.text && a.tool === b.tool && a.source === b.source && JSON.stringify(a.options) === JSON.stringify(b.options) && JSON.stringify(a.optionDetails) === JSON.stringify(b.optionDetails);
139
+ return a.kind === b.kind && a.text === b.text && a.body === b.body && a.tool === b.tool && a.source === b.source && JSON.stringify(a.options) === JSON.stringify(b.options) && JSON.stringify(a.optionDetails) === JSON.stringify(b.optionDetails);
123
140
  }
124
141
  function endCursorHelpers(s, ev) {
125
142
  if (s.tool !== "cursor" || ev.source !== "hook" || ev.helperId || !s.helpers.some((h) => h.state === "working")) return s;
@@ -134,6 +151,7 @@ function withTopic(s, text, source) {
134
151
  return { ...next, title: sessionTitle(next) };
135
152
  }
136
153
  function reduce(s, ev) {
154
+ if (ev.agentSessionId && !ev.helperId && ev.agentSessionId !== s.agentSessionId) s = { ...s, agentSessionId: ev.agentSessionId };
137
155
  if (s.state === "exited") return s;
138
156
  s = endCursorHelpers(s, ev);
139
157
  const at = ev.at;
@@ -200,7 +218,7 @@ function reduce(s, ev) {
200
218
  case "PreToolUse":
201
219
  case "PermissionRequest":
202
220
  case "Notification": {
203
- if (ev.name === "UserPromptSubmit" && ev.text && !s.topic) s = withTopic(s, ev.text, "prompt");
221
+ if (ev.name === "UserPromptSubmit" && ev.text && !s.topic && !crossSession(ev.text)) s = withTopic(s, ev.text, "prompt");
204
222
  const incoming = pendingFor(ev);
205
223
  if (incoming) {
206
224
  if (ev.name === "Notification" && s.pending?.source === "hook") return { ...s, lastHookAt: at, lastActivityAt: at };
@@ -218,6 +236,7 @@ function reduce(s, ev) {
218
236
  }
219
237
 
220
238
  export {
239
+ crossSession,
221
240
  QUESTION_TOOLS,
222
241
  reduce
223
242
  };
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  exitFile,
3
3
  spawnSession
4
- } from "./chunk-U4RU6V35.js";
4
+ } from "./chunk-3TXM4DM7.js";
5
5
  import {
6
6
  realTmux
7
- } from "./chunk-XZMLFV6H.js";
7
+ } from "./chunk-3TNPEAMR.js";
8
8
  import {
9
9
  ensureLedgeDir,
10
10
  log
11
- } from "./chunk-P2SHPHAN.js";
11
+ } from "./chunk-L6IGH4LF.js";
12
12
  import {
13
13
  connect
14
- } from "./chunk-IDGN7JGC.js";
14
+ } from "./chunk-MK7NEXY7.js";
15
15
  import {
16
16
  PROTOCOL_PORT
17
- } from "./chunk-E6ZQOGY4.js";
17
+ } from "./chunk-4BBKLTDB.js";
18
18
 
19
19
  // src/cli/launch.ts
20
20
  import { spawn } from "child_process";
@@ -0,0 +1,6 @@
1
+ // src/version.ts
2
+ var LEDGE_VERSION = true ? "0.7.0" : "0.0.0-dev";
3
+
4
+ export {
5
+ LEDGE_VERSION
6
+ };
@@ -17,7 +17,7 @@ function ledgeDir() {
17
17
  }
18
18
  function paths() {
19
19
  const dir = ledgeDir();
20
- return { dir, tmuxConf: join(dir, "tmux.conf"), journal: join(dir, "sessions.json"), log: join(dir, "daemon.log"), pid: join(dir, "daemon.pid"), history: join(dir, "history") };
20
+ return { dir, tmuxConf: join(dir, "tmux.conf"), journal: join(dir, "sessions.json"), log: join(dir, "daemon.log"), pid: join(dir, "daemon.pid"), history: join(dir, "history"), machines: join(dir, "machines.json"), projects: join(dir, "projects.json"), island: join(dir, "island.json") };
21
21
  }
22
22
  async function ensureLedgeDir() {
23
23
  const p = paths();
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PROTOCOL_PORT,
3
3
  parseServerMessage
4
- } from "./chunk-E6ZQOGY4.js";
4
+ } from "./chunk-4BBKLTDB.js";
5
5
 
6
6
  // src/client.ts
7
7
  import WebSocket from "ws";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  run
3
- } from "./chunk-XZMLFV6H.js";
3
+ } from "./chunk-3TNPEAMR.js";
4
4
  import {
5
5
  ensureLedgeDir,
6
6
  paths
7
- } from "./chunk-P2SHPHAN.js";
7
+ } from "./chunk-L6IGH4LF.js";
8
8
 
9
9
  // src/cli/setup.ts
10
10
  import { readFile as readFile2, writeFile, mkdir, rename, realpath, rm, stat, lstat, readlink, symlink, unlink } from "fs/promises";