@paradow/ledge 0.29.0 → 0.31.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.
- package/dist/cli/{action-MAPPYLUM.js → action-CFYJM2A2.js} +4 -4
- package/dist/cli/{attach-OC64CLB2.js → attach-23PTEIAA.js} +9 -8
- package/dist/cli/{bridge-TWX4V37E.js → bridge-UJKWEKA5.js} +1 -1
- package/dist/cli/{chunk-RFFTWAAF.js → chunk-6YBIZZQG.js} +1 -1
- package/dist/cli/{chunk-TREGH6WM.js → chunk-GMG3ROBU.js} +504 -302
- package/dist/cli/{chunk-MZVMW356.js → chunk-HEYHVOD6.js} +2 -2
- package/dist/cli/{chunk-XZYQMKKO.js → chunk-HNC5Q5PV.js} +3 -3
- package/dist/cli/{chunk-WCBXS3EU.js → chunk-HUY4CFMX.js} +107 -15
- package/dist/cli/{chunk-73YNZ3BN.js → chunk-MIPE2FWL.js} +2 -1
- package/dist/cli/{chunk-7S7ZLGIY.js → chunk-MYIBYAZC.js} +36 -8
- package/dist/cli/{chunk-WIUJNSAZ.js → chunk-NXNIRIGI.js} +5 -5
- package/dist/cli/{chunk-353WRRGG.js → chunk-QXH2L4UH.js} +3 -3
- package/dist/cli/{chunk-UWDE365N.js → chunk-TCJG3EHB.js} +47 -3
- package/dist/cli/{chunk-K3SDHHZF.js → chunk-TLFKLMBN.js} +1 -1
- package/dist/cli/{chunk-TNYBWWRO.js → chunk-WF27BASF.js} +2 -2
- package/dist/cli/chunk-WY5WSK2D.js +6 -0
- package/dist/cli/{chunk-ETGOWBUL.js → chunk-YI4V7YVW.js} +3 -3
- package/dist/cli/{daemon-ZTZ7VMYA.js → daemon-WW2P7RDV.js} +7 -7
- package/dist/cli/{decide-4BIYS3Y2.js → decide-HLRD37PW.js} +8 -6
- package/dist/cli/{handover-IS7BJYGZ.js → handover-56M4LIOP.js} +4 -4
- package/dist/cli/{hook-3VKVD4IP.js → hook-UJVKYSQ5.js} +34 -13
- package/dist/cli/index.js +16 -16
- package/dist/cli/{launch-XAPN2M3Q.js → launch-GIPQDPAC.js} +9 -8
- package/dist/cli/{send-ZLF2ZXMJ.js → send-HWZHE65N.js} +4 -4
- package/dist/cli/{status-NONO6E2S.js → status-V6ITP7VT.js} +2 -2
- package/dist/cli/{task-47MVWDCY.js → task-N53TM34B.js} +4 -4
- package/dist/cli/{team-EJ4YIXJH.js → team-CZFZ24P6.js} +6 -6
- package/dist/cli/{tui-CAP4O4YQ.js → tui-K32C34XI.js} +1274 -1176
- package/dist/cli/{version-EHBPJO7K.js → version-QIFJVKAQ.js} +1 -1
- package/dist/cli/{who-FHAXYCM2.js → who-NIOLHHB3.js} +3 -3
- package/dist/ledge-guide.md +268 -0
- package/package.json +1 -1
- package/dist/cli/chunk-JZEWCO6X.js +0 -6
|
@@ -6,38 +6,42 @@ import {
|
|
|
6
6
|
resolveRoleAddress,
|
|
7
7
|
resolveTarget,
|
|
8
8
|
seatContext,
|
|
9
|
+
seatKey,
|
|
10
|
+
seatView,
|
|
9
11
|
takeImages,
|
|
12
|
+
teamChangeLine,
|
|
10
13
|
teammates
|
|
11
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-TCJG3EHB.js";
|
|
12
15
|
import {
|
|
13
16
|
findRole
|
|
14
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-MIPE2FWL.js";
|
|
15
18
|
import {
|
|
16
19
|
parseLedgeCommand,
|
|
17
20
|
readOnClient,
|
|
18
21
|
sendOnClient
|
|
19
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-HEYHVOD6.js";
|
|
20
23
|
import {
|
|
21
24
|
taskOnClient
|
|
22
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-YI4V7YVW.js";
|
|
23
26
|
import {
|
|
24
27
|
handoverOnClient
|
|
25
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-HNC5Q5PV.js";
|
|
26
29
|
import {
|
|
27
30
|
CODEX_ENV_VAR,
|
|
28
31
|
CODEX_HOOK_VAR,
|
|
29
32
|
codexPlan
|
|
30
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-TLFKLMBN.js";
|
|
31
34
|
import {
|
|
32
35
|
formatWho
|
|
33
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-WF27BASF.js";
|
|
34
37
|
import {
|
|
35
38
|
connect,
|
|
36
39
|
sendMessageAndAwaitAck
|
|
37
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-6YBIZZQG.js";
|
|
38
41
|
import {
|
|
42
|
+
MESSAGE_MAX,
|
|
39
43
|
taskClosed
|
|
40
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-MYIBYAZC.js";
|
|
41
45
|
import {
|
|
42
46
|
log
|
|
43
47
|
} from "./chunk-6IYPRUQG.js";
|
|
@@ -51,15 +55,14 @@ import { randomUUID } from "crypto";
|
|
|
51
55
|
import { readFileSync, openSync, fstatSync, readSync, closeSync } from "fs";
|
|
52
56
|
import { basename, join } from "path";
|
|
53
57
|
var str = (v) => typeof v === "string" ? v : void 0;
|
|
54
|
-
var PROMPT_MAX =
|
|
55
|
-
var fromAgent = (t) => t.startsWith('<agent-message from="') || t.startsWith("<cross-session-message ") || t.startsWith("[Cross-session ");
|
|
58
|
+
var PROMPT_MAX = MESSAGE_MAX;
|
|
56
59
|
var promptText = (p) => {
|
|
57
60
|
const raw = str(p.prompt)?.trim();
|
|
58
61
|
if (!raw) return {};
|
|
59
62
|
const taken = takeImages(raw, paths().attachments);
|
|
60
63
|
const ids = taken.ids;
|
|
61
64
|
const t = ids.length ? taken.text : raw;
|
|
62
|
-
return { ...t ? { text: t.slice(0,
|
|
65
|
+
return { ...t ? { text: t.slice(0, PROMPT_MAX) } : {}, ...ids.length ? { attachments: ids } : {} };
|
|
63
66
|
};
|
|
64
67
|
function describeTool(tool, input) {
|
|
65
68
|
const i = input && typeof input === "object" ? input : {};
|
|
@@ -391,6 +394,19 @@ function seatOf(known, dir, live) {
|
|
|
391
394
|
const seat = seatContext({ ...role ? { role } : {}, roleId, roleLabel: known?.roleLabel, ...team ? { team: { name: team.name, members: teammates(team, live.sessions).filter((m) => m.name !== known?.name) } } : {} });
|
|
392
395
|
return seat ? { seat } : {};
|
|
393
396
|
}
|
|
397
|
+
var SEAT_REFRESH_MS = 500;
|
|
398
|
+
async function seatChange(client, id, deadline) {
|
|
399
|
+
const left = () => Math.max(0, deadline - Date.now());
|
|
400
|
+
const snapshot = await client.next("snapshot", left()).catch(() => void 0);
|
|
401
|
+
const me = snapshot?.sessions.find((s) => s.id === id);
|
|
402
|
+
if (!snapshot || !me || !me.team && !me.teamSeen) return void 0;
|
|
403
|
+
const teams = me.team ? (await client.next("teams", left()).catch(() => void 0))?.teams : [];
|
|
404
|
+
if (!teams) return void 0;
|
|
405
|
+
const key = seatKey(seatView(id, snapshot.sessions, teams));
|
|
406
|
+
if (key === me.teamSeen) return void 0;
|
|
407
|
+
client.send({ type: "seat.seen", id, key });
|
|
408
|
+
return teamChangeLine(me.teamSeen, key);
|
|
409
|
+
}
|
|
394
410
|
var SEND_MESSAGE_MS = 1500;
|
|
395
411
|
var deny = (reason) => JSON.stringify({ hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny", permissionDecisionReason: reason } });
|
|
396
412
|
async function relayMessage(client, from, toolUseId, input, deadline) {
|
|
@@ -446,6 +462,7 @@ async function runHook(eventName, stdin, opts = {}) {
|
|
|
446
462
|
let live = { sessions: [], teams: [] };
|
|
447
463
|
let deadline = Date.now() + (opts.timeoutMs ?? 100);
|
|
448
464
|
let relayed;
|
|
465
|
+
let seatLine;
|
|
449
466
|
let held = [];
|
|
450
467
|
try {
|
|
451
468
|
const payload = JSON.parse(stdin || "{}");
|
|
@@ -456,10 +473,11 @@ async function runHook(eventName, stdin, opts = {}) {
|
|
|
456
473
|
}
|
|
457
474
|
const launchedId = agent === "codex" ? codexLedgeId() : agent === "claude" ? process.env.LEDGE_SESSION : void 0;
|
|
458
475
|
identify = eventName === "SessionStart" && !!launchedId && mapped.id === launchedId;
|
|
476
|
+
const refresh = eventName === "UserPromptSubmit" && agent !== "cursor" && !!launchedId && mapped.id === launchedId;
|
|
459
477
|
const input = payload.tool_input ?? {};
|
|
460
478
|
const intercept = agent === "claude" && eventName === "PreToolUse" && str(payload.tool_name) === "SendMessage" && typeof input.to === "string" && typeof input.message === "string" && !!input.message;
|
|
461
479
|
const command = agent === "codex" && eventName === "PreToolUse" && str(payload.tool_name) === "Bash" && typeof input.command === "string" ? parseLedgeCommand(input.command) : void 0;
|
|
462
|
-
const timeoutMs = opts.timeoutMs ?? (identify ? 1e3 : intercept || command ? SEND_MESSAGE_MS : 100);
|
|
480
|
+
const timeoutMs = opts.timeoutMs ?? (identify ? 1e3 : intercept || command ? SEND_MESSAGE_MS : refresh ? SEAT_REFRESH_MS : 100);
|
|
463
481
|
deadline = Date.now() + timeoutMs;
|
|
464
482
|
const client = await connect({ port: opts.port, timeoutMs });
|
|
465
483
|
client.send({ type: "session.event", id: mapped.id, event: mapped.event, agent: mapped.agent, ...mapped.cwd ? { cwd: mapped.cwd } : {} });
|
|
@@ -468,10 +486,12 @@ async function runHook(eventName, stdin, opts = {}) {
|
|
|
468
486
|
known = snapshot?.sessions.find((s) => s.id === mapped.id);
|
|
469
487
|
const teamList = known?.team ? (await client.next("teams", Math.max(0, deadline - Date.now())).catch(() => void 0))?.teams : void 0;
|
|
470
488
|
live = { sessions: snapshot?.sessions ?? [], teams: teamList ?? [] };
|
|
489
|
+
if (snapshot && known && (!known.team || teamList)) client.send({ type: "seat.seen", id: known.id, key: seatKey(seatView(known.id, live.sessions, live.teams)) });
|
|
471
490
|
client.send({ type: "task.cmd", rid: randomUUID(), by: mapped.id, op: "list" });
|
|
472
491
|
const listed = await client.next("task.result", Math.max(0, deadline - Date.now())).catch(() => void 0);
|
|
473
492
|
held = (listed?.tasks ?? []).filter((t) => t.owner === mapped.id && !taskClosed(t));
|
|
474
493
|
}
|
|
494
|
+
if (refresh) seatLine = await seatChange(client, mapped.id, deadline);
|
|
475
495
|
if (intercept) relayed = await relayMessage(client, mapped.id, str(payload.tool_use_id), input, deadline);
|
|
476
496
|
if (command) relayed = await runLedgeCommand(client, command, mapped.id, deadline);
|
|
477
497
|
await Promise.race([client.close(), new Promise((r) => setTimeout(r, Math.max(0, deadline - Date.now())))]);
|
|
@@ -479,6 +499,7 @@ async function runHook(eventName, stdin, opts = {}) {
|
|
|
479
499
|
log(`hook ${label} dropped: ${e.message}`);
|
|
480
500
|
}
|
|
481
501
|
if (relayed) return relayed;
|
|
502
|
+
if (seatLine) return JSON.stringify({ hookSpecificOutput: { hookEventName: "UserPromptSubmit", additionalContext: seatLine } });
|
|
482
503
|
if (!identify || !mapped) return void 0;
|
|
483
504
|
const found = await identity(agent, mapped.cwd, known, deadline, live);
|
|
484
505
|
const who = found ? { ...found, ...held.length ? { tasks: held } : {}, ...known?.relieves ? { relieves: known.relieves } : {} } : void 0;
|
package/dist/cli/index.js
CHANGED
|
@@ -25,7 +25,7 @@ async function hookMain(args) {
|
|
|
25
25
|
try {
|
|
26
26
|
const chunks = [];
|
|
27
27
|
for await (const c of process.stdin) chunks.push(c);
|
|
28
|
-
const { runHook } = await import("./hook-
|
|
28
|
+
const { runHook } = await import("./hook-UJVKYSQ5.js");
|
|
29
29
|
const out = await runHook(event, Buffer.concat(chunks).toString("utf8"), { tool });
|
|
30
30
|
if (out) process.stdout.write(`${out}
|
|
31
31
|
`);
|
|
@@ -37,7 +37,7 @@ async function main(argv) {
|
|
|
37
37
|
const [cmd, ...rest] = argv;
|
|
38
38
|
switch (cmd) {
|
|
39
39
|
case "daemon": {
|
|
40
|
-
const { startDaemon } = await import("./daemon-
|
|
40
|
+
const { startDaemon } = await import("./daemon-WW2P7RDV.js");
|
|
41
41
|
await startDaemon();
|
|
42
42
|
await new Promise(() => {
|
|
43
43
|
});
|
|
@@ -45,7 +45,7 @@ async function main(argv) {
|
|
|
45
45
|
}
|
|
46
46
|
case "--version":
|
|
47
47
|
case "version": {
|
|
48
|
-
const { LEDGE_VERSION } = await import("./version-
|
|
48
|
+
const { LEDGE_VERSION } = await import("./version-QIFJVKAQ.js");
|
|
49
49
|
console.log(LEDGE_VERSION);
|
|
50
50
|
return 0;
|
|
51
51
|
}
|
|
@@ -66,74 +66,74 @@ async function main(argv) {
|
|
|
66
66
|
return r.ok ? 0 : 1;
|
|
67
67
|
}
|
|
68
68
|
case "status": {
|
|
69
|
-
const { printStatus } = await import("./status-
|
|
69
|
+
const { printStatus } = await import("./status-V6ITP7VT.js");
|
|
70
70
|
console.log(await printStatus());
|
|
71
71
|
return 0;
|
|
72
72
|
}
|
|
73
73
|
case "who": {
|
|
74
|
-
const { printWho } = await import("./who-
|
|
74
|
+
const { printWho } = await import("./who-NIOLHHB3.js");
|
|
75
75
|
console.log(await printWho());
|
|
76
76
|
return 0;
|
|
77
77
|
}
|
|
78
78
|
case "send": {
|
|
79
|
-
const { sendMessage } = await import("./send-
|
|
79
|
+
const { sendMessage } = await import("./send-HWZHE65N.js");
|
|
80
80
|
const r = await sendMessage(rest);
|
|
81
81
|
console.log(r.line);
|
|
82
82
|
return r.code;
|
|
83
83
|
}
|
|
84
84
|
case "read": {
|
|
85
|
-
const { readMessage } = await import("./send-
|
|
85
|
+
const { readMessage } = await import("./send-HWZHE65N.js");
|
|
86
86
|
const r = await readMessage(rest);
|
|
87
87
|
console.log(r.line);
|
|
88
88
|
return r.code;
|
|
89
89
|
}
|
|
90
90
|
case "task": {
|
|
91
|
-
const { runTask } = await import("./task-
|
|
91
|
+
const { runTask } = await import("./task-N53TM34B.js");
|
|
92
92
|
const r = await runTask(rest);
|
|
93
93
|
console.log(r.line);
|
|
94
94
|
return r.code;
|
|
95
95
|
}
|
|
96
96
|
case "decide": {
|
|
97
|
-
const { runDecide } = await import("./decide-
|
|
97
|
+
const { runDecide } = await import("./decide-HLRD37PW.js");
|
|
98
98
|
const r = await runDecide(rest);
|
|
99
99
|
console.log(r.line);
|
|
100
100
|
return r.code;
|
|
101
101
|
}
|
|
102
102
|
case "handover": {
|
|
103
|
-
const { runHandover } = await import("./handover-
|
|
103
|
+
const { runHandover } = await import("./handover-56M4LIOP.js");
|
|
104
104
|
const r = await runHandover(rest);
|
|
105
105
|
console.log(r.line);
|
|
106
106
|
return r.code;
|
|
107
107
|
}
|
|
108
108
|
case "close": {
|
|
109
|
-
const { runClose } = await import("./action-
|
|
109
|
+
const { runClose } = await import("./action-CFYJM2A2.js");
|
|
110
110
|
const r = await runClose(rest);
|
|
111
111
|
console.log(r.line);
|
|
112
112
|
return r.code;
|
|
113
113
|
}
|
|
114
114
|
case "team": {
|
|
115
|
-
const { runTeam } = await import("./team-
|
|
115
|
+
const { runTeam } = await import("./team-CZFZ24P6.js");
|
|
116
116
|
const r = await runTeam(rest);
|
|
117
117
|
console.log(r.line);
|
|
118
118
|
return r.code;
|
|
119
119
|
}
|
|
120
120
|
case "tui": {
|
|
121
|
-
const { runTui } = await import("./tui-
|
|
121
|
+
const { runTui } = await import("./tui-K32C34XI.js");
|
|
122
122
|
return runTui(rest);
|
|
123
123
|
}
|
|
124
124
|
case "bridge": {
|
|
125
|
-
const { bridge } = await import("./bridge-
|
|
125
|
+
const { bridge } = await import("./bridge-UJKWEKA5.js");
|
|
126
126
|
await bridge();
|
|
127
127
|
return 0;
|
|
128
128
|
}
|
|
129
129
|
case "claude":
|
|
130
130
|
case "codex":
|
|
131
131
|
case "cursor": {
|
|
132
|
-
const { launch } = await import("./launch-
|
|
132
|
+
const { launch } = await import("./launch-GIPQDPAC.js");
|
|
133
133
|
return launch(cmd, rest);
|
|
134
134
|
}
|
|
135
135
|
case "attach": {
|
|
136
|
-
const { attach } = await import("./attach-
|
|
136
|
+
const { attach } = await import("./attach-23PTEIAA.js");
|
|
137
137
|
return attach(rest.find((a) => !a.startsWith("--")) ?? "", { readOnly: rest.includes("--read-only") });
|
|
138
138
|
}
|
|
139
139
|
default:
|
|
@@ -6,18 +6,19 @@ import {
|
|
|
6
6
|
launch,
|
|
7
7
|
parseLaunchArgs,
|
|
8
8
|
roleArgs
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-NXNIRIGI.js";
|
|
10
|
+
import "./chunk-GMG3ROBU.js";
|
|
11
11
|
import "./chunk-OLLQBK6N.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-HUY4CFMX.js";
|
|
13
|
+
import "./chunk-TCJG3EHB.js";
|
|
14
|
+
import "./chunk-MIPE2FWL.js";
|
|
15
15
|
import {
|
|
16
16
|
agentEnv,
|
|
17
17
|
exitFile
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-TLFKLMBN.js";
|
|
19
|
+
import "./chunk-6YBIZZQG.js";
|
|
20
|
+
import "./chunk-MYIBYAZC.js";
|
|
21
|
+
import "./chunk-WY5WSK2D.js";
|
|
21
22
|
import "./chunk-NLL2EQJ2.js";
|
|
22
23
|
import "./chunk-6IYPRUQG.js";
|
|
23
24
|
import "./chunk-HOOHS3MX.js";
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
readOnClient,
|
|
5
5
|
sendMessage,
|
|
6
6
|
sendOnClient
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-HEYHVOD6.js";
|
|
8
|
+
import "./chunk-TLFKLMBN.js";
|
|
9
|
+
import "./chunk-6YBIZZQG.js";
|
|
10
|
+
import "./chunk-MYIBYAZC.js";
|
|
11
11
|
import "./chunk-HOOHS3MX.js";
|
|
12
12
|
import "./chunk-U67V476Y.js";
|
|
13
13
|
export {
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
runTask,
|
|
5
5
|
taskArgs,
|
|
6
6
|
taskOnClient
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-YI4V7YVW.js";
|
|
8
|
+
import "./chunk-TLFKLMBN.js";
|
|
9
|
+
import "./chunk-6YBIZZQG.js";
|
|
10
|
+
import "./chunk-MYIBYAZC.js";
|
|
11
11
|
import "./chunk-HOOHS3MX.js";
|
|
12
12
|
import "./chunk-U67V476Y.js";
|
|
13
13
|
export {
|
|
@@ -4,20 +4,20 @@ import {
|
|
|
4
4
|
callerOf,
|
|
5
5
|
resultLine,
|
|
6
6
|
runOnClient
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QXH2L4UH.js";
|
|
8
8
|
import {
|
|
9
9
|
listDefinitions
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-HUY4CFMX.js";
|
|
11
|
+
import "./chunk-MIPE2FWL.js";
|
|
12
|
+
import "./chunk-TLFKLMBN.js";
|
|
13
13
|
import {
|
|
14
14
|
connect
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-6YBIZZQG.js";
|
|
16
16
|
import {
|
|
17
17
|
RoleIdSchema,
|
|
18
18
|
SeatsSchema,
|
|
19
19
|
ToolSchema
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-MYIBYAZC.js";
|
|
21
21
|
import "./chunk-6IYPRUQG.js";
|
|
22
22
|
import "./chunk-HOOHS3MX.js";
|
|
23
23
|
import "./chunk-U67V476Y.js";
|