@paradow/ledge 0.20.0 → 0.22.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.
Files changed (40) hide show
  1. package/dist/cli/action-WNQ3NJGD.js +27 -0
  2. package/dist/cli/{attach-JNECAG6L.js → attach-UHM7QQ4W.js} +9 -8
  3. package/dist/cli/{bridge-H3ZPGIUY.js → bridge-R37AHVXS.js} +2 -1
  4. package/dist/cli/chunk-4DEVJE4H.js +6 -0
  5. package/dist/cli/{chunk-ZQON4EV7.js → chunk-5VFFJ3ZC.js} +2 -2
  6. package/dist/cli/{chunk-CDME3WRV.js → chunk-7XMGYJTN.js} +7 -7
  7. package/dist/cli/chunk-ARB4BKZJ.js +2302 -0
  8. package/dist/cli/{chunk-24AHC55Y.js → chunk-AVKFQSRP.js} +7 -21
  9. package/dist/cli/{chunk-2VSEIOGA.js → chunk-JNLARCUC.js} +7 -4
  10. package/dist/cli/{chunk-NVSBPIXY.js → chunk-KRFXWD5S.js} +1147 -406
  11. package/dist/cli/chunk-O6FTIYJV.js +85 -0
  12. package/dist/cli/{chunk-ERN736NQ.js → chunk-PUJLMKZC.js} +7 -6
  13. package/dist/cli/{chunk-ZZMZDAF6.js → chunk-RKV5KYKL.js} +3 -3
  14. package/dist/cli/{chunk-XR42PIDL.js → chunk-RYUDIFSI.js} +15 -10
  15. package/dist/cli/{chunk-AJFC33TH.js → chunk-TOFVC6IV.js} +2 -2
  16. package/dist/cli/{chunk-KACRWFN3.js → chunk-TZBI2RVU.js} +1 -1
  17. package/dist/cli/chunk-U67V476Y.js +35 -0
  18. package/dist/cli/{chunk-35BPMR6P.js → chunk-ZDEEHFU3.js} +9 -4
  19. package/dist/cli/{daemon-DVPDCY3V.js → daemon-7IGQIDWB.js} +8 -7
  20. package/dist/cli/decide-UWJMKDR4.js +57 -0
  21. package/dist/cli/{handover-AZ35QZRK.js → handover-5JHFA5EF.js} +5 -4
  22. package/dist/cli/{hook-ERYA6BKY.js → hook-XBSMUMZ7.js} +11 -10
  23. package/dist/cli/index.js +31 -17
  24. package/dist/cli/{launch-LAER5DI6.js → launch-OVB66BZJ.js} +9 -8
  25. package/dist/cli/{send-BFPJBXXH.js → send-Y2C3BIGK.js} +5 -4
  26. package/dist/cli/{setup-47ODKJBM.js → setup-K42IVMHS.js} +1 -0
  27. package/dist/cli/{status-JPF4NZNI.js → status-5YEORNTH.js} +3 -2
  28. package/dist/cli/{task-K43WJIUX.js → task-R44VWZHR.js} +5 -4
  29. package/dist/cli/team-F7B3IG3I.js +205 -0
  30. package/dist/cli/tui-ZJDNIBIB.js +19086 -0
  31. package/dist/cli/{uninstall-QNWRD27D.js → uninstall-4IMMR55T.js} +1 -0
  32. package/dist/cli/version-EHETEZAK.js +7 -0
  33. package/dist/cli/who-YMSQI64I.js +12 -0
  34. package/package.json +2 -1
  35. package/dist/cli/chunk-EX66KH66.js +0 -1856
  36. package/dist/cli/chunk-PFBZUINN.js +0 -6
  37. package/dist/cli/team-SZJHGA7D.js +0 -101
  38. package/dist/cli/tui-AMERXSL7.js +0 -4873
  39. package/dist/cli/version-BFNXT3H4.js +0 -6
  40. package/dist/cli/who-NYPVBO64.js +0 -11
@@ -0,0 +1,85 @@
1
+ import {
2
+ CODEX_HOOK_VAR
3
+ } from "./chunk-ZDEEHFU3.js";
4
+ import {
5
+ connect
6
+ } from "./chunk-TZBI2RVU.js";
7
+ import {
8
+ SESSION_KEY_VAR,
9
+ actionById
10
+ } from "./chunk-ARB4BKZJ.js";
11
+
12
+ // src/cli/action.ts
13
+ import { randomUUID } from "crypto";
14
+ var CLOSE_USAGE = "ledge close <session>\u2026 [--json] fermer proprement des sessions (leur conversation reste reprenable)";
15
+ var DAEMON_DOWN = "daemon not running (start a session with `ledge claude`, or run `ledge daemon`)";
16
+ var RUN_MS = 6e4;
17
+ function actionArgs(id, args) {
18
+ const parsed = actionById(id).args.safeParse(args);
19
+ return parsed.success ? args : void 0;
20
+ }
21
+ function callerOf(env) {
22
+ const by = env[CODEX_HOOK_VAR] || env.LEDGE_SESSION;
23
+ const key = env[SESSION_KEY_VAR];
24
+ return by ? { by, ...key ? { key } : {} } : void 0;
25
+ }
26
+ async function runOnClient(client, action, args, opts = {}) {
27
+ const rid = randomUUID();
28
+ const by = opts.by;
29
+ client.send({ type: "action.run", rid, action, args, ...by ? { by: by.by, ...by.key ? { key: by.key } : {} } : {}, ...opts.confirmed ? { confirmed: true } : {} });
30
+ const deadline = Date.now() + (opts.ms ?? RUN_MS);
31
+ for (; ; ) {
32
+ const { type: _t, rid: got, ...r } = await client.next("action.result", Math.max(0, deadline - Date.now()));
33
+ if (got === rid) return r;
34
+ }
35
+ }
36
+ var plain = (s) => s.replace(/\*\*/g, "");
37
+ function resultLine(r, json = false) {
38
+ const ok = r.reason === void 0;
39
+ if (json) return { line: JSON.stringify({ ok, ...r }), code: ok ? 0 : 1 };
40
+ if (ok) return { line: [`fait : ${plain(r.row?.summary ?? r.action)}`, ...r.path ? [`mod\xE8le \xE9crit : ${r.path}`] : []].join("\n"), code: 0 };
41
+ if (r.code === "confirm_required") return { line: `${plain(r.row?.summary ?? r.action)} : irr\xE9versible ; relance avec --yes pour confirmer`, code: 1 };
42
+ return { line: `${r.code === "failed" ? "\xE9chec" : "refus\xE9"} : ${r.reason}`, code: 1 };
43
+ }
44
+ function closeArgs(args) {
45
+ const json = args.includes("--json");
46
+ const sessions = args.filter((a) => a !== "--json");
47
+ if (!sessions.length || sessions.some((s) => s.startsWith("--") || !actionArgs("session.close", { session: s }))) return void 0;
48
+ return { sessions, ...json ? { json: true } : {} };
49
+ }
50
+ async function runClose(args, opts = {}) {
51
+ const parsed = closeArgs(args);
52
+ if (!parsed) return { line: CLOSE_USAGE, code: args.length ? 1 : 0 };
53
+ let client;
54
+ try {
55
+ client = await connect({ port: opts.port, timeoutMs: 1500 });
56
+ } catch {
57
+ return { line: DAEMON_DOWN, code: 1 };
58
+ }
59
+ const by = callerOf(opts.env ?? process.env);
60
+ const lines = [];
61
+ try {
62
+ for (const session of parsed.sessions) {
63
+ const r = resultLine(await runOnClient(client, "session.close", { session }, { by }), parsed.json);
64
+ lines.push(r.line);
65
+ if (r.code) return { line: lines.join("\n"), code: 1 };
66
+ }
67
+ return { line: lines.join("\n"), code: 0 };
68
+ } catch (e) {
69
+ return { line: [...lines, `pas de r\xE9ponse de Ledge : ${e.message}`].join("\n"), code: 1 };
70
+ } finally {
71
+ await client.close();
72
+ }
73
+ }
74
+
75
+ export {
76
+ CLOSE_USAGE,
77
+ DAEMON_DOWN,
78
+ RUN_MS,
79
+ actionArgs,
80
+ callerOf,
81
+ runOnClient,
82
+ resultLine,
83
+ closeArgs,
84
+ runClose
85
+ };
@@ -1,22 +1,23 @@
1
1
  import {
2
2
  CODEX_HOOK_VAR
3
- } from "./chunk-35BPMR6P.js";
3
+ } from "./chunk-ZDEEHFU3.js";
4
4
  import {
5
5
  connect
6
- } from "./chunk-KACRWFN3.js";
6
+ } from "./chunk-TZBI2RVU.js";
7
7
  import {
8
8
  LEDGE_GIVER,
9
9
  TASK_TEXT_MAX,
10
10
  TASK_TITLE_MAX
11
- } from "./chunk-EX66KH66.js";
11
+ } from "./chunk-ARB4BKZJ.js";
12
12
 
13
13
  // src/cli/task.ts
14
14
  import { randomUUID } from "crypto";
15
15
  var TASK_USAGE = `ledge task give <nom|@r\xF4le> "<titre>" ["<d\xE9tail>"] confier un travail \xE0 une session (@r\xF4le : dans ton \xE9quipe)
16
+ ledge task give ledge "<question>" "<options, recommandation>" une d\xE9cision pour l'utilisateur ; sa r\xE9ponse te r\xE9veille
16
17
  ledge task list [--all] tes t\xE2ches (tenues ou confi\xE9es), ouvertes ; --all : closes aussi
17
18
  ledge task show <id> une t\xE2che, son d\xE9tail et son historique
18
19
  ledge task take <id> la prendre
19
- ledge task done <id> ["<r\xE9sultat>"] la terminer (la session qui l'a confi\xE9e est pr\xE9venue)
20
+ ledge task done <id> "<r\xE9sultat>" la terminer, avec ce qui en est sorti (la session qui l'a confi\xE9e est pr\xE9venue)
20
21
  ledge task refuse <id> "<raison>" la refuser, ou l'annuler si tu l'as confi\xE9e
21
22
  ledge task pass <id> <nom|@r\xF4le> ["<note>"] la passer \xE0 une autre session`;
22
23
  var TASK_MS = 4e3;
@@ -34,7 +35,7 @@ function taskArgs(args) {
34
35
  case "take":
35
36
  return fits(1, 1) && id ? { op, task: id } : void 0;
36
37
  case "done":
37
- return fits(1, 2) && id && (rest[1]?.length ?? 0) <= TASK_TEXT_MAX ? { op, task: id, ...rest[1] ? { text: rest[1] } : {} } : void 0;
38
+ return fits(2, 2) && id && rest[1].length <= TASK_TEXT_MAX ? { op, task: id, text: rest[1] } : void 0;
38
39
  case "refuse":
39
40
  return fits(2, 2) && id && rest[1].length <= TASK_TEXT_MAX ? { op, task: id, text: rest[1] } : void 0;
40
41
  case "pass":
@@ -72,7 +73,7 @@ async function taskOnClient(client, args, by, ms) {
72
73
  const t = r.task;
73
74
  switch (op.op) {
74
75
  case "give":
75
- return { line: `t\xE2che ${t.id} confi\xE9e \xE0 ${t.ownerName} : elle lui arrive \xE0 son prochain moment libre`, code: 0 };
76
+ return { line: t.owner === LEDGE_GIVER ? `d\xE9cision ${t.id} pos\xE9e \xE0 l'utilisateur (ledge decide) : sa r\xE9ponse t'arrivera comme une t\xE2che termin\xE9e` : `t\xE2che ${t.id} confi\xE9e \xE0 ${t.ownerName} : elle lui arrive \xE0 son prochain moment libre`, code: 0 };
76
77
  case "take":
77
78
  return { line: `t\xE2che ${t.id} prise`, code: 0 };
78
79
  case "done":
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  CODEX_HOOK_VAR
3
- } from "./chunk-35BPMR6P.js";
3
+ } from "./chunk-ZDEEHFU3.js";
4
4
  import {
5
5
  connect
6
- } from "./chunk-KACRWFN3.js";
6
+ } from "./chunk-TZBI2RVU.js";
7
7
  import {
8
8
  BRIEF_MAX
9
- } from "./chunk-EX66KH66.js";
9
+ } from "./chunk-ARB4BKZJ.js";
10
10
 
11
11
  // src/cli/handover.ts
12
12
  import { randomUUID } from "crypto";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  ledgeTitleRest
3
- } from "./chunk-35BPMR6P.js";
3
+ } from "./chunk-ZDEEHFU3.js";
4
4
  import {
5
5
  cleanTopic,
6
6
  isArchived,
7
7
  sessionTitle
8
- } from "./chunk-EX66KH66.js";
8
+ } from "./chunk-ARB4BKZJ.js";
9
9
 
10
10
  // src/daemon/seat.ts
11
11
  function teammates(team, sessions) {
@@ -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;
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  CODEX_HOOK_VAR
3
- } from "./chunk-35BPMR6P.js";
3
+ } from "./chunk-ZDEEHFU3.js";
4
4
  import {
5
5
  connect,
6
6
  sendMessageAndAwaitAck
7
- } from "./chunk-KACRWFN3.js";
7
+ } from "./chunk-TZBI2RVU.js";
8
8
 
9
9
  // src/cli/send.ts
10
10
  import { randomUUID } from "crypto";
@@ -4,7 +4,7 @@ import {
4
4
  SUMMARY_MAX,
5
5
  parseServerMessage,
6
6
  readDaemonToken
7
- } from "./chunk-EX66KH66.js";
7
+ } from "./chunk-ARB4BKZJ.js";
8
8
 
9
9
  // src/client.ts
10
10
  import WebSocket from "ws";
@@ -0,0 +1,35 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+
31
+ export {
32
+ __commonJS,
33
+ __export,
34
+ __toESM
35
+ };
@@ -1,7 +1,9 @@
1
1
  import {
2
2
  NAMES,
3
- pickName
4
- } from "./chunk-EX66KH66.js";
3
+ SESSION_KEY_VAR,
4
+ pickName,
5
+ sessionKey
6
+ } from "./chunk-ARB4BKZJ.js";
5
7
  import {
6
8
  paths
7
9
  } from "./chunk-HOOHS3MX.js";
@@ -182,7 +184,9 @@ var AGENT_BIN = { claude: "claude", codex: "codex", cursor: "cursor-agent", omp:
182
184
  var CODEX_ENV_VAR = "LEDGE_CODEX_SESSION";
183
185
  var CODEX_HOOK_VAR = "LEDGE_CODEX_HOOK_SESSION";
184
186
  function agentIdArgs(tool, id) {
185
- return tool === "codex" ? ["-c", `shell_environment_policy.set.${CODEX_HOOK_VAR}="${id}"`] : [];
187
+ if (tool !== "codex") return [];
188
+ const key = sessionKey(id);
189
+ return ["-c", `shell_environment_policy.set.${CODEX_HOOK_VAR}="${id}"`, ...key ? ["-c", `shell_environment_policy.set.${SESSION_KEY_VAR}="${key}"`] : []];
186
190
  }
187
191
  var CLAUDE_OWN_SESSION = /^(--resume|-r|--continue|-c|--session-id|--fork-session)(=|$)/;
188
192
  function claudeSessionId(tool, args) {
@@ -224,7 +228,8 @@ async function spawnSession(opts) {
224
228
  const env = opts.env ?? process.env;
225
229
  const transcriptPath = agentSessionId ? claudeTranscriptPath(opts.cwd, agentSessionId, env) : void 0;
226
230
  const command = opts.recordExit ? ["sh", "-c", '"$@"; echo $? > "$0"', exitFile(id), ...agent] : agent;
227
- await opts.tmux.newSession({ name: tmuxSession, cwd: opts.cwd, env: agentEnv(env, { LEDGE_SESSION: id, LEDGE_NAME: name, ...opts.role ? { LEDGE_ROLE: opts.role.id } : {}, ...opts.team ? { LEDGE_TEAM: opts.team } : {}, ...opts.tool === "codex" ? { [CODEX_ENV_VAR]: id } : {} }), unset: PARENT_AGENT_VARS, command });
231
+ const key = sessionKey(id);
232
+ await opts.tmux.newSession({ name: tmuxSession, cwd: opts.cwd, env: agentEnv(env, { LEDGE_SESSION: id, ...key ? { [SESSION_KEY_VAR]: key } : {}, LEDGE_NAME: name, ...opts.role ? { LEDGE_ROLE: opts.role.id } : {}, ...opts.team ? { LEDGE_TEAM: opts.team } : {}, ...opts.tool === "codex" ? { [CODEX_ENV_VAR]: id } : {} }), unset: PARENT_AGENT_VARS, command });
228
233
  const at = now();
229
234
  return {
230
235
  id,
@@ -9,9 +9,9 @@ import {
9
9
  startServer,
10
10
  tasksJournal,
11
11
  teamsJournal
12
- } from "./chunk-NVSBPIXY.js";
13
- import "./chunk-2VSEIOGA.js";
12
+ } from "./chunk-KRFXWD5S.js";
14
13
  import "./chunk-OLLQBK6N.js";
14
+ import "./chunk-JNLARCUC.js";
15
15
  import {
16
16
  QUESTION_TOOLS,
17
17
  crossSession,
@@ -26,11 +26,11 @@ import {
26
26
  readPeers,
27
27
  reduce,
28
28
  stripNote
29
- } from "./chunk-XR42PIDL.js";
30
- import "./chunk-24AHC55Y.js";
29
+ } from "./chunk-RYUDIFSI.js";
30
+ import "./chunk-AVKFQSRP.js";
31
31
  import {
32
32
  agentMessages
33
- } from "./chunk-35BPMR6P.js";
33
+ } from "./chunk-ZDEEHFU3.js";
34
34
  import {
35
35
  DEFAULT_RELAY_URL,
36
36
  DevicePollResponseSchema,
@@ -44,10 +44,10 @@ import {
44
44
  SealedFrameSchema,
45
45
  SessionSchema,
46
46
  backendOf
47
- } from "./chunk-EX66KH66.js";
47
+ } from "./chunk-ARB4BKZJ.js";
48
48
  import {
49
49
  LEDGE_VERSION
50
- } from "./chunk-PFBZUINN.js";
50
+ } from "./chunk-4DEVJE4H.js";
51
51
  import {
52
52
  SERVICE,
53
53
  inDaemonService,
@@ -64,6 +64,7 @@ import {
64
64
  ensureLedgeDir,
65
65
  paths
66
66
  } from "./chunk-HOOHS3MX.js";
67
+ import "./chunk-U67V476Y.js";
67
68
 
68
69
  // src/daemon/index.ts
69
70
  import { writeFile as writeFile3, rm as rm2 } from "fs/promises";
@@ -0,0 +1,57 @@
1
+ import {
2
+ CODEX_HOOK_VAR
3
+ } from "./chunk-ZDEEHFU3.js";
4
+ import {
5
+ connect
6
+ } from "./chunk-TZBI2RVU.js";
7
+ import {
8
+ LEDGE_GIVER,
9
+ TASK_TEXT_MAX
10
+ } from "./chunk-ARB4BKZJ.js";
11
+ import "./chunk-HOOHS3MX.js";
12
+ import "./chunk-U67V476Y.js";
13
+
14
+ // src/cli/decide.ts
15
+ import { randomUUID } from "crypto";
16
+ var DECIDE_USAGE = `ledge decide les d\xE9cisions que les sessions attendent de toi
17
+ ledge decide <id> "<r\xE9ponse>" y r\xE9pondre : la session qui l'a demand\xE9e reprend`;
18
+ var ID = /^t[0-9a-f]{6}$/;
19
+ var DECIDE_MS = 4e3;
20
+ function decideArgs(args) {
21
+ if (!args.length) return { op: "list" };
22
+ const [id, text] = args;
23
+ return args.length === 2 && ID.test(id) && text.trim() && text.length <= TASK_TEXT_MAX ? { op: "done", task: id, text } : void 0;
24
+ }
25
+ async function runDecide(args, opts = {}) {
26
+ const op = decideArgs(args);
27
+ if (!op) return { line: DECIDE_USAGE, code: 1 };
28
+ const env = opts.env ?? process.env;
29
+ 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 };
30
+ let client;
31
+ try {
32
+ client = await connect({ port: opts.port, timeoutMs: DECIDE_MS });
33
+ } catch {
34
+ return { line: "daemon not running (start a session with `ledge claude`, or run `ledge daemon`)", code: 1 };
35
+ }
36
+ try {
37
+ if (op.op === "list") {
38
+ client.send({ type: "task.cmd", rid: randomUUID(), by: LEDGE_GIVER, op: "list" });
39
+ const asked = ((await client.next("task.result", DECIDE_MS)).tasks ?? []).filter((t) => t.owner === LEDGE_GIVER);
40
+ if (!asked.length) return { line: "aucune d\xE9cision en attente", code: 0 };
41
+ 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 };
42
+ }
43
+ client.send({ type: "task.cmd", rid: randomUUID(), by: LEDGE_GIVER, op: "done", task: op.task, text: op.text });
44
+ const r = await client.next("task.result", DECIDE_MS);
45
+ if (r.reason !== void 0) return { line: `refus\xE9 : ${r.reason}`, code: 1 };
46
+ return { line: `r\xE9ponse envoy\xE9e \xE0 ${r.task.giverName}`, code: 0 };
47
+ } catch (e) {
48
+ return { line: `pas de r\xE9ponse de Ledge : ${e.message}`, code: 1 };
49
+ } finally {
50
+ await client.close();
51
+ }
52
+ }
53
+ export {
54
+ DECIDE_USAGE,
55
+ decideArgs,
56
+ runDecide
57
+ };
@@ -3,11 +3,12 @@ import {
3
3
  handoverArgs,
4
4
  handoverOnClient,
5
5
  runHandover
6
- } from "./chunk-ZZMZDAF6.js";
7
- import "./chunk-35BPMR6P.js";
8
- import "./chunk-KACRWFN3.js";
9
- import "./chunk-EX66KH66.js";
6
+ } from "./chunk-RKV5KYKL.js";
7
+ import "./chunk-ZDEEHFU3.js";
8
+ import "./chunk-TZBI2RVU.js";
9
+ import "./chunk-ARB4BKZJ.js";
10
10
  import "./chunk-HOOHS3MX.js";
11
+ import "./chunk-U67V476Y.js";
11
12
  export {
12
13
  HANDOVER_USAGE,
13
14
  handoverArgs,
@@ -8,42 +8,43 @@ import {
8
8
  seatContext,
9
9
  takeImages,
10
10
  teammates
11
- } from "./chunk-XR42PIDL.js";
11
+ } from "./chunk-RYUDIFSI.js";
12
12
  import {
13
13
  findRole
14
- } from "./chunk-24AHC55Y.js";
14
+ } from "./chunk-AVKFQSRP.js";
15
15
  import {
16
16
  parseLedgeCommand,
17
17
  readOnClient,
18
18
  sendOnClient
19
- } from "./chunk-AJFC33TH.js";
19
+ } from "./chunk-TOFVC6IV.js";
20
20
  import {
21
21
  taskOnClient
22
- } from "./chunk-ERN736NQ.js";
22
+ } from "./chunk-PUJLMKZC.js";
23
23
  import {
24
24
  handoverOnClient
25
- } from "./chunk-ZZMZDAF6.js";
25
+ } from "./chunk-RKV5KYKL.js";
26
26
  import {
27
27
  CODEX_ENV_VAR,
28
28
  CODEX_HOOK_VAR,
29
29
  codexPlan
30
- } from "./chunk-35BPMR6P.js";
30
+ } from "./chunk-ZDEEHFU3.js";
31
31
  import {
32
32
  formatWho
33
- } from "./chunk-ZQON4EV7.js";
33
+ } from "./chunk-5VFFJ3ZC.js";
34
34
  import {
35
35
  connect,
36
36
  sendMessageAndAwaitAck
37
- } from "./chunk-KACRWFN3.js";
37
+ } from "./chunk-TZBI2RVU.js";
38
38
  import {
39
39
  taskClosed
40
- } from "./chunk-EX66KH66.js";
40
+ } from "./chunk-ARB4BKZJ.js";
41
41
  import {
42
42
  log
43
43
  } from "./chunk-6IYPRUQG.js";
44
44
  import {
45
45
  paths
46
46
  } from "./chunk-HOOHS3MX.js";
47
+ import "./chunk-U67V476Y.js";
47
48
 
48
49
  // src/cli/hook.ts
49
50
  import { randomUUID } from "crypto";
@@ -355,7 +356,7 @@ function identityContext(s) {
355
356
  "Pour voir les autres sessions (nom, outil, \xE9tat, projet, branche, sujet), lance `ledge who`.",
356
357
  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
358
  "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`).',
359
+ '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
360
  ...s.seat ? [s.seat] : [],
360
361
  ...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
362
  ...s.tasks ? [tasksContext(s.tasks) ?? ""].filter(Boolean) : []
package/dist/cli/index.js CHANGED
@@ -12,8 +12,10 @@ 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
- ledge team <up|list> \u2026 start a team from a template, list templates, roles and live teams
17
+ ledge team <up|list|join|leave|resume|dissolve|save> \u2026 start, list and run teams (ledge team: details; --json for agents)
18
+ ledge close <session>\u2026 [--json] close sessions cleanly (their conversation stays resumable)
17
19
  ledge tui [--notify bell|osc9|off] [--here] follow and answer the sessions (in a Ledge tab of Windows Terminal unless --here)
18
20
  ledge bridge exchange Ledge messages over SSH stdio
19
21
  ledge --version print the installed version`;
@@ -23,7 +25,7 @@ async function hookMain(args) {
23
25
  try {
24
26
  const chunks = [];
25
27
  for await (const c of process.stdin) chunks.push(c);
26
- const { runHook } = await import("./hook-ERYA6BKY.js");
28
+ const { runHook } = await import("./hook-XBSMUMZ7.js");
27
29
  const out = await runHook(event, Buffer.concat(chunks).toString("utf8"), { tool });
28
30
  if (out) process.stdout.write(`${out}
29
31
  `);
@@ -35,7 +37,7 @@ async function main(argv) {
35
37
  const [cmd, ...rest] = argv;
36
38
  switch (cmd) {
37
39
  case "daemon": {
38
- const { startDaemon } = await import("./daemon-DVPDCY3V.js");
40
+ const { startDaemon } = await import("./daemon-7IGQIDWB.js");
39
41
  await startDaemon();
40
42
  await new Promise(() => {
41
43
  });
@@ -43,17 +45,17 @@ async function main(argv) {
43
45
  }
44
46
  case "--version":
45
47
  case "version": {
46
- const { LEDGE_VERSION } = await import("./version-BFNXT3H4.js");
48
+ const { LEDGE_VERSION } = await import("./version-EHETEZAK.js");
47
49
  console.log(LEDGE_VERSION);
48
50
  return 0;
49
51
  }
50
52
  case "setup": {
51
- const { runSetup } = await import("./setup-47ODKJBM.js");
53
+ const { runSetup } = await import("./setup-K42IVMHS.js");
52
54
  for (const l of await runSetup()) console.log(l);
53
55
  return 0;
54
56
  }
55
57
  case "uninstall": {
56
- const { runUninstall, uninstallArgs } = await import("./uninstall-QNWRD27D.js");
58
+ const { runUninstall, uninstallArgs } = await import("./uninstall-4IMMR55T.js");
57
59
  const args = uninstallArgs(rest);
58
60
  if (!args) {
59
61
  console.log(USAGE);
@@ -64,62 +66,74 @@ async function main(argv) {
64
66
  return r.ok ? 0 : 1;
65
67
  }
66
68
  case "status": {
67
- const { printStatus } = await import("./status-JPF4NZNI.js");
69
+ const { printStatus } = await import("./status-5YEORNTH.js");
68
70
  console.log(await printStatus());
69
71
  return 0;
70
72
  }
71
73
  case "who": {
72
- const { printWho } = await import("./who-NYPVBO64.js");
74
+ const { printWho } = await import("./who-YMSQI64I.js");
73
75
  console.log(await printWho());
74
76
  return 0;
75
77
  }
76
78
  case "send": {
77
- const { sendMessage } = await import("./send-BFPJBXXH.js");
79
+ const { sendMessage } = await import("./send-Y2C3BIGK.js");
78
80
  const r = await sendMessage(rest);
79
81
  console.log(r.line);
80
82
  return r.code;
81
83
  }
82
84
  case "read": {
83
- const { readMessage } = await import("./send-BFPJBXXH.js");
85
+ const { readMessage } = await import("./send-Y2C3BIGK.js");
84
86
  const r = await readMessage(rest);
85
87
  console.log(r.line);
86
88
  return r.code;
87
89
  }
88
90
  case "task": {
89
- const { runTask } = await import("./task-K43WJIUX.js");
91
+ const { runTask } = await import("./task-R44VWZHR.js");
90
92
  const r = await runTask(rest);
91
93
  console.log(r.line);
92
94
  return r.code;
93
95
  }
96
+ case "decide": {
97
+ const { runDecide } = await import("./decide-UWJMKDR4.js");
98
+ const r = await runDecide(rest);
99
+ console.log(r.line);
100
+ return r.code;
101
+ }
94
102
  case "handover": {
95
- const { runHandover } = await import("./handover-AZ35QZRK.js");
103
+ const { runHandover } = await import("./handover-5JHFA5EF.js");
96
104
  const r = await runHandover(rest);
97
105
  console.log(r.line);
98
106
  return r.code;
99
107
  }
108
+ case "close": {
109
+ const { runClose } = await import("./action-WNQ3NJGD.js");
110
+ const r = await runClose(rest);
111
+ console.log(r.line);
112
+ return r.code;
113
+ }
100
114
  case "team": {
101
- const { runTeam } = await import("./team-SZJHGA7D.js");
115
+ const { runTeam } = await import("./team-F7B3IG3I.js");
102
116
  const r = await runTeam(rest);
103
117
  console.log(r.line);
104
118
  return r.code;
105
119
  }
106
120
  case "tui": {
107
- const { runTui } = await import("./tui-AMERXSL7.js");
121
+ const { runTui } = await import("./tui-ZJDNIBIB.js");
108
122
  return runTui(rest);
109
123
  }
110
124
  case "bridge": {
111
- const { bridge } = await import("./bridge-H3ZPGIUY.js");
125
+ const { bridge } = await import("./bridge-R37AHVXS.js");
112
126
  await bridge();
113
127
  return 0;
114
128
  }
115
129
  case "claude":
116
130
  case "codex":
117
131
  case "cursor": {
118
- const { launch } = await import("./launch-LAER5DI6.js");
132
+ const { launch } = await import("./launch-OVB66BZJ.js");
119
133
  return launch(cmd, rest);
120
134
  }
121
135
  case "attach": {
122
- const { attach } = await import("./attach-JNECAG6L.js");
136
+ const { attach } = await import("./attach-UHM7QQ4W.js");
123
137
  return attach(rest.find((a) => !a.startsWith("--")) ?? "", { readOnly: rest.includes("--read-only") });
124
138
  }
125
139
  default:
@@ -6,21 +6,22 @@ import {
6
6
  launch,
7
7
  parseLaunchArgs,
8
8
  roleArgs
9
- } from "./chunk-CDME3WRV.js";
10
- import "./chunk-NVSBPIXY.js";
11
- import "./chunk-2VSEIOGA.js";
9
+ } from "./chunk-7XMGYJTN.js";
10
+ import "./chunk-KRFXWD5S.js";
12
11
  import "./chunk-OLLQBK6N.js";
13
- import "./chunk-XR42PIDL.js";
14
- import "./chunk-24AHC55Y.js";
12
+ import "./chunk-JNLARCUC.js";
13
+ import "./chunk-RYUDIFSI.js";
14
+ import "./chunk-AVKFQSRP.js";
15
15
  import {
16
16
  agentEnv,
17
17
  exitFile
18
- } from "./chunk-35BPMR6P.js";
19
- import "./chunk-KACRWFN3.js";
20
- import "./chunk-EX66KH66.js";
18
+ } from "./chunk-ZDEEHFU3.js";
19
+ import "./chunk-TZBI2RVU.js";
20
+ import "./chunk-ARB4BKZJ.js";
21
21
  import "./chunk-NLL2EQJ2.js";
22
22
  import "./chunk-6IYPRUQG.js";
23
23
  import "./chunk-HOOHS3MX.js";
24
+ import "./chunk-U67V476Y.js";
24
25
  export {
25
26
  DaemonError,
26
27
  agentEnv,
@@ -4,11 +4,12 @@ import {
4
4
  readOnClient,
5
5
  sendMessage,
6
6
  sendOnClient
7
- } from "./chunk-AJFC33TH.js";
8
- import "./chunk-35BPMR6P.js";
9
- import "./chunk-KACRWFN3.js";
10
- import "./chunk-EX66KH66.js";
7
+ } from "./chunk-TOFVC6IV.js";
8
+ import "./chunk-ZDEEHFU3.js";
9
+ import "./chunk-TZBI2RVU.js";
10
+ import "./chunk-ARB4BKZJ.js";
11
11
  import "./chunk-HOOHS3MX.js";
12
+ import "./chunk-U67V476Y.js";
12
13
  export {
13
14
  parseLedgeCommand,
14
15
  readMessage,