@paradow/ledge 0.20.0 → 0.21.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.
@@ -0,0 +1,6 @@
1
+ // src/version.ts
2
+ var LEDGE_VERSION = true ? "0.21.0" : "0.0.0-dev";
3
+
4
+ export {
5
+ LEDGE_VERSION
6
+ };
@@ -90,14 +90,19 @@ function formatLedgeMessage(m) {
90
90
  return `${open}${head} \u2026 [message de ${m.text.length} caract\xE8res, ${lineCount(m.text)} lignes : lis-le en entier avec ledge read ${attr(m.id)}]${LEDGE_CLOSE}`;
91
91
  }
92
92
  function ledgeMessages(text) {
93
- const m = LEDGE_BLOCK.exec(text.trimStart());
94
- if (!m) return void 0;
95
- const attrs = new Map([...m[1].matchAll(ATTR)].map((a) => [a[1], a[2]]));
96
- const from = attrs.get("from");
97
- const tool = attrs.get("tool");
98
- const id = attrs.get("id");
99
- if (!from) return void 0;
100
- return [{ from, ...tool ? { tool } : {}, ...id ? { id } : {}, text: stripNote(m[2]).text.trim() }];
93
+ const out = [];
94
+ let rest = text.trimStart();
95
+ let m;
96
+ while (rest && (m = LEDGE_BLOCK.exec(rest))) {
97
+ const attrs = new Map([...m[1].matchAll(ATTR)].map((a) => [a[1], a[2]]));
98
+ const from = attrs.get("from");
99
+ const tool = attrs.get("tool");
100
+ const id = attrs.get("id");
101
+ if (!from) break;
102
+ out.push({ from, ...tool ? { tool } : {}, ...id ? { id } : {}, text: stripNote(m[2]).text.trim() });
103
+ rest = rest.slice(m[0].length).trimStart();
104
+ }
105
+ return out.length ? out : void 0;
101
106
  }
102
107
  var NOTICE_BLOCK = /^<ledge-notice\b([^>]*)>([\s\S]*?)(?:<\/ledge-notice>|$)/;
103
108
  var NOTICE_QUOTE = 80;
@@ -9,7 +9,7 @@ import {
9
9
  startServer,
10
10
  tasksJournal,
11
11
  teamsJournal
12
- } from "./chunk-NVSBPIXY.js";
12
+ } from "./chunk-EKXZ45MQ.js";
13
13
  import "./chunk-2VSEIOGA.js";
14
14
  import "./chunk-OLLQBK6N.js";
15
15
  import {
@@ -26,7 +26,7 @@ import {
26
26
  readPeers,
27
27
  reduce,
28
28
  stripNote
29
- } from "./chunk-XR42PIDL.js";
29
+ } from "./chunk-WRE3PUTV.js";
30
30
  import "./chunk-24AHC55Y.js";
31
31
  import {
32
32
  agentMessages
@@ -47,7 +47,7 @@ import {
47
47
  } from "./chunk-EX66KH66.js";
48
48
  import {
49
49
  LEDGE_VERSION
50
- } from "./chunk-PFBZUINN.js";
50
+ } from "./chunk-NFXFY5CT.js";
51
51
  import {
52
52
  SERVICE,
53
53
  inDaemonService,
@@ -0,0 +1,56 @@
1
+ import {
2
+ CODEX_HOOK_VAR
3
+ } from "./chunk-35BPMR6P.js";
4
+ import {
5
+ connect
6
+ } from "./chunk-KACRWFN3.js";
7
+ import {
8
+ LEDGE_GIVER,
9
+ TASK_TEXT_MAX
10
+ } from "./chunk-EX66KH66.js";
11
+ import "./chunk-HOOHS3MX.js";
12
+
13
+ // src/cli/decide.ts
14
+ import { randomUUID } from "crypto";
15
+ var DECIDE_USAGE = `ledge decide les d\xE9cisions que les sessions attendent de toi
16
+ ledge decide <id> "<r\xE9ponse>" y r\xE9pondre : la session qui l'a demand\xE9e reprend`;
17
+ var ID = /^t[0-9a-f]{6}$/;
18
+ var DECIDE_MS = 4e3;
19
+ function decideArgs(args) {
20
+ if (!args.length) return { op: "list" };
21
+ const [id, text] = args;
22
+ return args.length === 2 && ID.test(id) && text.trim() && text.length <= TASK_TEXT_MAX ? { op: "done", task: id, text } : void 0;
23
+ }
24
+ async function runDecide(args, opts = {}) {
25
+ const op = decideArgs(args);
26
+ if (!op) return { line: DECIDE_USAGE, code: 1 };
27
+ const env = opts.env ?? process.env;
28
+ if (env.LEDGE_SESSION || env[CODEX_HOOK_VAR]) return { line: "refus\xE9 : ledge decide est la r\xE9ponse de l'utilisateur, pas celle d'une session", code: 1 };
29
+ let client;
30
+ try {
31
+ client = await connect({ port: opts.port, timeoutMs: DECIDE_MS });
32
+ } catch {
33
+ return { line: "daemon not running (start a session with `ledge claude`, or run `ledge daemon`)", code: 1 };
34
+ }
35
+ try {
36
+ if (op.op === "list") {
37
+ client.send({ type: "task.cmd", rid: randomUUID(), by: LEDGE_GIVER, op: "list" });
38
+ const asked = ((await client.next("task.result", DECIDE_MS)).tasks ?? []).filter((t) => t.owner === LEDGE_GIVER);
39
+ if (!asked.length) return { line: "aucune d\xE9cision en attente", code: 0 };
40
+ return { line: asked.map((t) => [`${t.id} de ${t.giverName} ${t.title}`, ...t.text ? t.text.split("\n").map((l) => ` ${l}`) : []].join("\n")).join("\n\n"), code: 0 };
41
+ }
42
+ client.send({ type: "task.cmd", rid: randomUUID(), by: LEDGE_GIVER, op: "done", task: op.task, text: op.text });
43
+ const r = await client.next("task.result", DECIDE_MS);
44
+ if (r.reason !== void 0) return { line: `refus\xE9 : ${r.reason}`, code: 1 };
45
+ return { line: `r\xE9ponse envoy\xE9e \xE0 ${r.task.giverName}`, code: 0 };
46
+ } catch (e) {
47
+ return { line: `pas de r\xE9ponse de Ledge : ${e.message}`, code: 1 };
48
+ } finally {
49
+ await client.close();
50
+ }
51
+ }
52
+ export {
53
+ DECIDE_USAGE,
54
+ decideArgs,
55
+ runDecide
56
+ };
@@ -8,7 +8,7 @@ import {
8
8
  seatContext,
9
9
  takeImages,
10
10
  teammates
11
- } from "./chunk-XR42PIDL.js";
11
+ } from "./chunk-WRE3PUTV.js";
12
12
  import {
13
13
  findRole
14
14
  } from "./chunk-24AHC55Y.js";
@@ -19,7 +19,7 @@ import {
19
19
  } from "./chunk-AJFC33TH.js";
20
20
  import {
21
21
  taskOnClient
22
- } from "./chunk-ERN736NQ.js";
22
+ } from "./chunk-EBBAOQ2Z.js";
23
23
  import {
24
24
  handoverOnClient
25
25
  } from "./chunk-ZZMZDAF6.js";
@@ -355,7 +355,7 @@ function identityContext(s) {
355
355
  "Pour voir les autres sessions (nom, outil, \xE9tat, projet, branche, sujet), lance `ledge who`.",
356
356
  s.tool === "claude" ? "Pour \xE9crire \xE0 une autre session Ledge, Claude ou Codex, utilise son nom Ledge (donn\xE9 par `ledge who`) comme adresse SendMessage : Ledge le transmet. `ListAgents` montre les noms internes de Claude, pas les noms Ledge." : "Pour \xE9crire \xE0 une autre session Ledge, lance `ledge send <nom> \"<message>\"` (seul, sans && ni |). Ledge ex\xE9cute lui-m\xEAme `ledge send`, `ledge read`, `ledge task` et `ledge who` : leur r\xE9sultat t'arrive comme \xAB Command blocked by PreToolUse hook: \u2026 \xBB, c'est la r\xE9ponse, pas une erreur.",
357
357
  "Un long message d'une autre session t'arrive en aper\xE7u avec son id : lance `ledge read <id>` pour le lire en entier. Une `<ledge-notice>` te dit qu'un de tes messages n'a pas pu \xEAtre remis.",
358
- 'Un message sert \xE0 pr\xE9venir ; pour confier un travail qui ne doit pas se perdre, lance plut\xF4t `ledge task give <nom> "<titre>" "<d\xE9tail>"` (`ledge task` pour le reste). Une `<ledge-task>` t\'en confie une, ou te dit comment une des tiennes a fini : quand on t\'en confie une, prends-la (`ledge task take <id>`) et termine-la toujours (`ledge task done <id> "<r\xE9sultat>"`, ou `refuse`).',
358
+ 'Un message sert \xE0 pr\xE9venir ; pour confier un travail qui ne doit pas se perdre, lance plut\xF4t `ledge task give <nom> "<titre>" "<d\xE9tail>"` (`ledge task` pour le reste). Une `<ledge-task>` t\'en confie une, ou te dit comment une des tiennes a fini : quand on t\'en confie une, prends-la (`ledge task take <id>`) et termine-la toujours (`ledge task done <id> "<r\xE9sultat>"`, ou `refuse`). Une d\xE9cision qui revient \xE0 l\'utilisateur se pose avec `ledge task give ledge "<question>" "<options, ta recommandation>"` : sa r\xE9ponse te r\xE9veille, inutile d\'attendre la fin pour la poser.',
359
359
  ...s.seat ? [s.seat] : [],
360
360
  ...s.relieves ? [`Tu as pris la rel\xE8ve de ${s.relieves.name}, dont le contexte \xE9tait plein : relis son bilan avec \`ledge handover show\`.`] : [],
361
361
  ...s.tasks ? [tasksContext(s.tasks) ?? ""].filter(Boolean) : []
package/dist/cli/index.js CHANGED
@@ -12,6 +12,7 @@ ledge who list the live sessi
12
12
  ledge send <nom> "<message>" [--summary <texte>] write to another Ledge session
13
13
  ledge read <id> print a long message whole (the id is in its pointer)
14
14
  ledge task <give|list|show|take|done|refuse|pass> \u2026 give another session work, take it, close it (ledge task: details)
15
+ ledge decide [<id> "<r\xE9ponse>"] the decisions sessions wait for from you; answer one
15
16
  ledge handover "<bilan>" | show the relief brief, when Ledge asks for it; show: read your predecessor's
16
17
  ledge team <up|list> \u2026 start a team from a template, list templates, roles and live teams
17
18
  ledge tui [--notify bell|osc9|off] [--here] follow and answer the sessions (in a Ledge tab of Windows Terminal unless --here)
@@ -23,7 +24,7 @@ async function hookMain(args) {
23
24
  try {
24
25
  const chunks = [];
25
26
  for await (const c of process.stdin) chunks.push(c);
26
- const { runHook } = await import("./hook-ERYA6BKY.js");
27
+ const { runHook } = await import("./hook-KANGO46Y.js");
27
28
  const out = await runHook(event, Buffer.concat(chunks).toString("utf8"), { tool });
28
29
  if (out) process.stdout.write(`${out}
29
30
  `);
@@ -35,7 +36,7 @@ async function main(argv) {
35
36
  const [cmd, ...rest] = argv;
36
37
  switch (cmd) {
37
38
  case "daemon": {
38
- const { startDaemon } = await import("./daemon-DVPDCY3V.js");
39
+ const { startDaemon } = await import("./daemon-5FPZG5R3.js");
39
40
  await startDaemon();
40
41
  await new Promise(() => {
41
42
  });
@@ -43,7 +44,7 @@ async function main(argv) {
43
44
  }
44
45
  case "--version":
45
46
  case "version": {
46
- const { LEDGE_VERSION } = await import("./version-BFNXT3H4.js");
47
+ const { LEDGE_VERSION } = await import("./version-YUO6SLAF.js");
47
48
  console.log(LEDGE_VERSION);
48
49
  return 0;
49
50
  }
@@ -86,11 +87,17 @@ async function main(argv) {
86
87
  return r.code;
87
88
  }
88
89
  case "task": {
89
- const { runTask } = await import("./task-K43WJIUX.js");
90
+ const { runTask } = await import("./task-UTRG4KA5.js");
90
91
  const r = await runTask(rest);
91
92
  console.log(r.line);
92
93
  return r.code;
93
94
  }
95
+ case "decide": {
96
+ const { runDecide } = await import("./decide-2ZKSX7O5.js");
97
+ const r = await runDecide(rest);
98
+ console.log(r.line);
99
+ return r.code;
100
+ }
94
101
  case "handover": {
95
102
  const { runHandover } = await import("./handover-AZ35QZRK.js");
96
103
  const r = await runHandover(rest);
@@ -104,7 +111,7 @@ async function main(argv) {
104
111
  return r.code;
105
112
  }
106
113
  case "tui": {
107
- const { runTui } = await import("./tui-AMERXSL7.js");
114
+ const { runTui } = await import("./tui-GEJHBWP5.js");
108
115
  return runTui(rest);
109
116
  }
110
117
  case "bridge": {
@@ -115,11 +122,11 @@ async function main(argv) {
115
122
  case "claude":
116
123
  case "codex":
117
124
  case "cursor": {
118
- const { launch } = await import("./launch-LAER5DI6.js");
125
+ const { launch } = await import("./launch-DEKJ5HI4.js");
119
126
  return launch(cmd, rest);
120
127
  }
121
128
  case "attach": {
122
- const { attach } = await import("./attach-JNECAG6L.js");
129
+ const { attach } = await import("./attach-IVICSJYB.js");
123
130
  return attach(rest.find((a) => !a.startsWith("--")) ?? "", { readOnly: rest.includes("--read-only") });
124
131
  }
125
132
  default:
@@ -6,11 +6,11 @@ import {
6
6
  launch,
7
7
  parseLaunchArgs,
8
8
  roleArgs
9
- } from "./chunk-CDME3WRV.js";
10
- import "./chunk-NVSBPIXY.js";
9
+ } from "./chunk-ALEZJFJ3.js";
10
+ import "./chunk-EKXZ45MQ.js";
11
11
  import "./chunk-2VSEIOGA.js";
12
12
  import "./chunk-OLLQBK6N.js";
13
- import "./chunk-XR42PIDL.js";
13
+ import "./chunk-WRE3PUTV.js";
14
14
  import "./chunk-24AHC55Y.js";
15
15
  import {
16
16
  agentEnv,
@@ -4,7 +4,7 @@ import {
4
4
  runTask,
5
5
  taskArgs,
6
6
  taskOnClient
7
- } from "./chunk-ERN736NQ.js";
7
+ } from "./chunk-EBBAOQ2Z.js";
8
8
  import "./chunk-35BPMR6P.js";
9
9
  import "./chunk-KACRWFN3.js";
10
10
  import "./chunk-EX66KH66.js";
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  attachEnv
3
- } from "./chunk-CDME3WRV.js";
3
+ } from "./chunk-ALEZJFJ3.js";
4
4
  import {
5
5
  imageInfo
6
- } from "./chunk-NVSBPIXY.js";
6
+ } from "./chunk-EKXZ45MQ.js";
7
7
  import "./chunk-2VSEIOGA.js";
8
8
  import {
9
9
  MAX_FRAME
10
10
  } from "./chunk-OLLQBK6N.js";
11
- import "./chunk-XR42PIDL.js";
11
+ import "./chunk-WRE3PUTV.js";
12
12
  import "./chunk-24AHC55Y.js";
13
13
  import "./chunk-35BPMR6P.js";
14
14
  import "./chunk-KACRWFN3.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  LEDGE_VERSION
3
- } from "./chunk-PFBZUINN.js";
3
+ } from "./chunk-NFXFY5CT.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.20.0",
3
+ "version": "0.21.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.20.0" : "0.0.0-dev";
3
-
4
- export {
5
- LEDGE_VERSION
6
- };