@paradow/ledge 0.19.0 → 0.20.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/{attach-3BKQSEWC.js → attach-JNECAG6L.js} +11 -11
- package/dist/cli/{bridge-APNFBPNE.js → bridge-H3ZPGIUY.js} +2 -2
- package/dist/cli/{chunk-3HCID6NW.js → chunk-24AHC55Y.js} +3 -3
- package/dist/cli/{chunk-3EIRKAX7.js → chunk-2VSEIOGA.js} +4 -4
- package/dist/cli/{chunk-TRTS24PF.js → chunk-35BPMR6P.js} +2 -2
- package/dist/cli/{chunk-43D6NMYH.js → chunk-6IYPRUQG.js} +1 -1
- package/dist/cli/{chunk-ZUYOA55W.js → chunk-AJFC33TH.js} +2 -2
- package/dist/cli/{chunk-LOOOHYZR.js → chunk-CDME3WRV.js} +8 -8
- package/dist/cli/{chunk-BVBX222F.js → chunk-ERN736NQ.js} +3 -3
- package/dist/cli/{chunk-HP3G2TYJ.js → chunk-EX66KH66.js} +730 -646
- package/dist/cli/{chunk-7ZAA75HG.js → chunk-HOOHS3MX.js} +1 -1
- package/dist/cli/{chunk-FQZ3IX6E.js → chunk-K7UEKSB2.js} +2 -2
- package/dist/cli/{chunk-GXFU4XAX.js → chunk-KACRWFN3.js} +1 -1
- package/dist/cli/{chunk-WJ6YMZTT.js → chunk-NLL2EQJ2.js} +2 -2
- package/dist/cli/{chunk-WP77O5LC.js → chunk-NVSBPIXY.js} +844 -404
- package/dist/cli/chunk-PFBZUINN.js +6 -0
- package/dist/cli/{chunk-KKNE7BFZ.js → chunk-XR42PIDL.js} +22 -3
- package/dist/cli/{chunk-WCS24ICX.js → chunk-ZQON4EV7.js} +2 -2
- package/dist/cli/{chunk-Y5DJ5INP.js → chunk-ZZMZDAF6.js} +3 -3
- package/dist/cli/{daemon-66EUIZ3J.js → daemon-DVPDCY3V.js} +87 -25
- package/dist/cli/{handover-UXISKYPS.js → handover-AZ35QZRK.js} +5 -5
- package/dist/cli/{hook-5UAARBWU.js → hook-ERYA6BKY.js} +20 -13
- package/dist/cli/index.js +16 -16
- package/dist/cli/launch-LAER5DI6.js +34 -0
- package/dist/cli/{send-NLVR6PL2.js → send-BFPJBXXH.js} +5 -5
- package/dist/cli/{setup-EEIXRAMU.js → setup-47ODKJBM.js} +4 -4
- package/dist/cli/{status-2OCYHOWZ.js → status-JPF4NZNI.js} +3 -3
- package/dist/cli/{task-AOOWHPMN.js → task-K43WJIUX.js} +5 -5
- package/dist/cli/{team-TVNSVYWW.js → team-SZJHGA7D.js} +6 -6
- package/dist/cli/{tui-6JY7IS4D.js → tui-AMERXSL7.js} +825 -373
- package/dist/cli/{uninstall-UUN7LIIT.js → uninstall-QNWRD27D.js} +4 -4
- package/dist/cli/{version-XSEI3V2C.js → version-BFNXT3H4.js} +1 -1
- package/dist/cli/who-NYPVBO64.js +11 -0
- package/package.json +1 -1
- package/dist/cli/chunk-4RD7OJ2J.js +0 -6
- package/dist/cli/launch-YQYCDZ7N.js +0 -34
- package/dist/cli/who-52MENZTT.js +0 -11
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ledgeTitleRest
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-35BPMR6P.js";
|
|
4
4
|
import {
|
|
5
5
|
cleanTopic,
|
|
6
6
|
isArchived,
|
|
7
7
|
sessionTitle
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-EX66KH66.js";
|
|
9
9
|
|
|
10
10
|
// src/daemon/seat.ts
|
|
11
11
|
function teammates(team, sessions) {
|
|
@@ -609,6 +609,23 @@ function resolveTarget(to, sessions, peers) {
|
|
|
609
609
|
return address ? { outcome: "native", target: t, address } : { outcome: "refused", reason: `${t.name} n'est pas joignable` };
|
|
610
610
|
}
|
|
611
611
|
|
|
612
|
+
// src/attachmentText.ts
|
|
613
|
+
var imageBracket = (path) => `[Image attached: ${path}]`;
|
|
614
|
+
var withImages = (text, paths) => [text, ...paths.map(imageBracket)].join(" ").trim();
|
|
615
|
+
var BRACKET = /[ \t]*\[Image attached: ([^\]\n]*)\]/g;
|
|
616
|
+
function takeImages(text, dir) {
|
|
617
|
+
const prefix = dir.replace(/\/+$/, "") + "/";
|
|
618
|
+
const ids = [];
|
|
619
|
+
const rest = text.replace(BRACKET, (whole, path) => {
|
|
620
|
+
if (!path.startsWith(prefix)) return whole;
|
|
621
|
+
const m = /^([0-9a-f]{64})\.(?:webp|jpg|png|gif)$/.exec(path.slice(prefix.length));
|
|
622
|
+
if (!m) return whole;
|
|
623
|
+
ids.push(m[1]);
|
|
624
|
+
return "";
|
|
625
|
+
});
|
|
626
|
+
return { text: rest.trim(), ids };
|
|
627
|
+
}
|
|
628
|
+
|
|
612
629
|
export {
|
|
613
630
|
teammates,
|
|
614
631
|
seatContext,
|
|
@@ -647,5 +664,7 @@ export {
|
|
|
647
664
|
readPeers,
|
|
648
665
|
bareName,
|
|
649
666
|
ledgePeer,
|
|
650
|
-
resolveTarget
|
|
667
|
+
resolveTarget,
|
|
668
|
+
withImages,
|
|
669
|
+
takeImages
|
|
651
670
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CODEX_HOOK_VAR
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-35BPMR6P.js";
|
|
4
4
|
import {
|
|
5
5
|
connect
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KACRWFN3.js";
|
|
7
7
|
import {
|
|
8
8
|
BRIEF_MAX
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EX66KH66.js";
|
|
10
10
|
|
|
11
11
|
// src/cli/handover.ts
|
|
12
12
|
import { randomUUID } from "crypto";
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AttachmentStore,
|
|
2
3
|
fileJournal,
|
|
3
4
|
loginShellEnv,
|
|
5
|
+
quote,
|
|
4
6
|
reapOwner,
|
|
5
7
|
rpOf,
|
|
6
8
|
startPoller,
|
|
7
9
|
startServer,
|
|
8
10
|
tasksJournal,
|
|
9
11
|
teamsJournal
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-NVSBPIXY.js";
|
|
13
|
+
import "./chunk-2VSEIOGA.js";
|
|
12
14
|
import "./chunk-OLLQBK6N.js";
|
|
13
15
|
import {
|
|
14
16
|
QUESTION_TOOLS,
|
|
@@ -24,11 +26,11 @@ import {
|
|
|
24
26
|
readPeers,
|
|
25
27
|
reduce,
|
|
26
28
|
stripNote
|
|
27
|
-
} from "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
+
} from "./chunk-XR42PIDL.js";
|
|
30
|
+
import "./chunk-24AHC55Y.js";
|
|
29
31
|
import {
|
|
30
32
|
agentMessages
|
|
31
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-35BPMR6P.js";
|
|
32
34
|
import {
|
|
33
35
|
DEFAULT_RELAY_URL,
|
|
34
36
|
DevicePollResponseSchema,
|
|
@@ -42,26 +44,26 @@ import {
|
|
|
42
44
|
SealedFrameSchema,
|
|
43
45
|
SessionSchema,
|
|
44
46
|
backendOf
|
|
45
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-EX66KH66.js";
|
|
46
48
|
import {
|
|
47
49
|
LEDGE_VERSION
|
|
48
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-PFBZUINN.js";
|
|
49
51
|
import {
|
|
50
52
|
SERVICE,
|
|
51
53
|
inDaemonService,
|
|
52
54
|
tmuxServerAtRisk
|
|
53
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-K7UEKSB2.js";
|
|
54
56
|
import {
|
|
55
57
|
realTmux,
|
|
56
58
|
runFile
|
|
57
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-NLL2EQJ2.js";
|
|
58
60
|
import {
|
|
59
61
|
log
|
|
60
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-6IYPRUQG.js";
|
|
61
63
|
import {
|
|
62
64
|
ensureLedgeDir,
|
|
63
65
|
paths
|
|
64
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-HOOHS3MX.js";
|
|
65
67
|
|
|
66
68
|
// src/daemon/index.ts
|
|
67
69
|
import { writeFile as writeFile3, rm as rm2 } from "fs/promises";
|
|
@@ -367,9 +369,12 @@ var History = class {
|
|
|
367
369
|
dir;
|
|
368
370
|
/** The Ledge session a SendMessage address or a sender's name is, when it is one (peers.ts). */
|
|
369
371
|
peerOf;
|
|
372
|
+
/** The stored image an attachment id is, when the store still holds it. */
|
|
373
|
+
refOf;
|
|
370
374
|
constructor(opts = {}) {
|
|
371
375
|
this.dir = opts.dir ?? paths().history;
|
|
372
376
|
this.peerOf = opts.peerOf ?? (() => void 0);
|
|
377
|
+
this.refOf = opts.refOf ?? (() => null);
|
|
373
378
|
}
|
|
374
379
|
items(id) {
|
|
375
380
|
return this.threads.get(id) ?? [];
|
|
@@ -425,6 +430,35 @@ var History = class {
|
|
|
425
430
|
if (lines > items.length || lost) this.compact(id, items);
|
|
426
431
|
}
|
|
427
432
|
}
|
|
433
|
+
/** The ids of the images the journaled prompts refer to, read from every `<dir>/*.jsonl` once the pending writes landed. */
|
|
434
|
+
async attachmentIds() {
|
|
435
|
+
await this.writes;
|
|
436
|
+
const ids = /* @__PURE__ */ new Set();
|
|
437
|
+
let names;
|
|
438
|
+
try {
|
|
439
|
+
names = await readdir(this.dir);
|
|
440
|
+
} catch {
|
|
441
|
+
return ids;
|
|
442
|
+
}
|
|
443
|
+
for (const name of names) {
|
|
444
|
+
if (!name.endsWith(".jsonl")) continue;
|
|
445
|
+
let text;
|
|
446
|
+
try {
|
|
447
|
+
text = await readFile2(join(this.dir, name), "utf8");
|
|
448
|
+
} catch (e) {
|
|
449
|
+
log(`history not read for ${name}: ${e.message}`);
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
for (const line of text.split("\n")) {
|
|
453
|
+
if (!line.includes('"images"')) continue;
|
|
454
|
+
try {
|
|
455
|
+
for (const img of JSON.parse(line).images ?? []) if (typeof img?.id === "string") ids.add(img.id);
|
|
456
|
+
} catch {
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
return ids;
|
|
461
|
+
}
|
|
428
462
|
/** The ids of the threads held, loaded or recorded. */
|
|
429
463
|
ids() {
|
|
430
464
|
return [...this.threads.keys()];
|
|
@@ -443,25 +477,27 @@ var History = class {
|
|
|
443
477
|
}
|
|
444
478
|
switch (ev.name) {
|
|
445
479
|
case "UserPromptSubmit": {
|
|
446
|
-
|
|
447
|
-
|
|
480
|
+
const images = (ev.attachments ?? []).flatMap((a) => this.refOf(a) ?? []);
|
|
481
|
+
if (!ev.text && images.length === 0) return void 0;
|
|
482
|
+
const text = ev.text ?? "";
|
|
483
|
+
const back = handBack(text);
|
|
448
484
|
if (back) {
|
|
449
485
|
const helper = this.items(id).find((i) => i.id === back.helperId);
|
|
450
486
|
if (helper?.kind === "helper" && helper.state !== "exited") this.put(id, { ...helper, state: "exited" });
|
|
451
487
|
if (helper?.kind === "helper") this.settle(id, (i) => i.helperId === back.helperId);
|
|
452
488
|
return back.report ? this.put(id, { kind: "reply", id: `report-${back.helperId}`, at: ev.at, turn: helper?.turn ?? turn, helperId: back.helperId, text: back.report }) : void 0;
|
|
453
489
|
}
|
|
454
|
-
const messages = crossSession(
|
|
490
|
+
const messages = crossSession(text);
|
|
455
491
|
if (messages) {
|
|
456
492
|
this.turns.set(id, turn + 1);
|
|
457
493
|
let last;
|
|
458
494
|
messages.forEach((m, i) => {
|
|
459
|
-
const { sender, text } = stripNote(m.text);
|
|
460
|
-
last = this.receive(id, { kind: "received", id: `recv-${turn + 1}-${i}`, at: ev.at, turn: turn + 1, from: sender ?? m.name ?? m.from, text }, { ...m, ...sender ? { sender } : {} });
|
|
495
|
+
const { sender, text: text2 } = stripNote(m.text);
|
|
496
|
+
last = this.receive(id, { kind: "received", id: `recv-${turn + 1}-${i}`, at: ev.at, turn: turn + 1, from: sender ?? m.name ?? m.from, text: text2 }, { ...m, ...sender ? { sender } : {} });
|
|
461
497
|
});
|
|
462
498
|
return last;
|
|
463
499
|
}
|
|
464
|
-
const ledge = ledgeMessages(
|
|
500
|
+
const ledge = ledgeMessages(text);
|
|
465
501
|
if (ledge) {
|
|
466
502
|
this.turns.set(id, turn + 1);
|
|
467
503
|
let last;
|
|
@@ -470,7 +506,7 @@ var History = class {
|
|
|
470
506
|
});
|
|
471
507
|
return last;
|
|
472
508
|
}
|
|
473
|
-
const notices = crossSessionNotices(
|
|
509
|
+
const notices = crossSessionNotices(text);
|
|
474
510
|
if (notices) {
|
|
475
511
|
this.turns.set(id, turn + 1);
|
|
476
512
|
let last;
|
|
@@ -479,7 +515,7 @@ var History = class {
|
|
|
479
515
|
});
|
|
480
516
|
return last;
|
|
481
517
|
}
|
|
482
|
-
const failed = ledgeNotice(
|
|
518
|
+
const failed = ledgeNotice(text);
|
|
483
519
|
if (failed) {
|
|
484
520
|
this.turns.set(id, turn + 1);
|
|
485
521
|
const peer = this.peerOf(failed.to);
|
|
@@ -498,7 +534,7 @@ var History = class {
|
|
|
498
534
|
text: failed.text
|
|
499
535
|
});
|
|
500
536
|
}
|
|
501
|
-
const task = ledgeTask(
|
|
537
|
+
const task = ledgeTask(text);
|
|
502
538
|
if (task) {
|
|
503
539
|
this.turns.set(id, turn + 1);
|
|
504
540
|
const peer = task.from ? this.peerOf(task.from) : void 0;
|
|
@@ -515,13 +551,13 @@ var History = class {
|
|
|
515
551
|
text: task.text
|
|
516
552
|
});
|
|
517
553
|
}
|
|
518
|
-
const joined = ledgeTeamNotice(
|
|
554
|
+
const joined = ledgeTeamNotice(text);
|
|
519
555
|
if (joined) {
|
|
520
556
|
this.turns.set(id, turn + 1);
|
|
521
557
|
return this.put(id, { kind: "notice", id: `notice-${turn + 1}-0`, at: ev.at, turn: turn + 1, notice: "other", team: joined.team, summary: joined.text.replaceAll(" \u23CE ", "\n"), text: joined.text });
|
|
522
558
|
}
|
|
523
559
|
this.turns.set(id, turn + 1);
|
|
524
|
-
return this.put(id, { kind: "prompt", id: `prompt-${turn + 1}`, at: ev.at, turn: turn + 1, text
|
|
560
|
+
return this.put(id, { kind: "prompt", id: `prompt-${turn + 1}`, at: ev.at, turn: turn + 1, text, ...images.length ? { images } : {} });
|
|
525
561
|
}
|
|
526
562
|
case "PreToolUse": {
|
|
527
563
|
if (!ev.tool) return void 0;
|
|
@@ -604,7 +640,7 @@ var History = class {
|
|
|
604
640
|
if (!opts.force && now - (this.synced.get(key) ?? 0) < SYNC_MS) return [];
|
|
605
641
|
this.synced.set(key, now);
|
|
606
642
|
const items = this.items(id);
|
|
607
|
-
const since = opts.helperId ? items.find((i) => i.id === opts.helperId)?.at : [...items].reverse().find((i) => i.kind === "prompt" || i.kind === "received" || i.kind === "notice")?.at;
|
|
643
|
+
const since = opts.helperId ? items.find((i) => i.id === opts.helperId)?.at : [...items].reverse().find((i) => i.kind === "prompt" || i.kind === "received" || i.kind === "notice" && !i.outgoing)?.at;
|
|
608
644
|
if (!since) return [];
|
|
609
645
|
const have = new Set(items.map((i) => i.id));
|
|
610
646
|
const turn = this.turns.get(id) ?? 0;
|
|
@@ -622,6 +658,30 @@ var History = class {
|
|
|
622
658
|
if (existing) return this.put(senderId, { ...existing, ...m.peer ? { peer: m.peer } : {}, via: "ledge" });
|
|
623
659
|
return this.put(senderId, { kind: "sent", id: m.rid, at: m.at, turn: this.turns.get(senderId) ?? 0, to: m.to, ...m.peer ? { peer: m.peer } : {}, ...m.summary ? { summary: m.summary } : {}, text: m.text, status: "sending", via: "ledge" });
|
|
624
660
|
}
|
|
661
|
+
/**
|
|
662
|
+
* A task the session handed over (issue #92): its card in the sender's thread, in the turn it is in (not a prompt).
|
|
663
|
+
* One card per transmission: the same one again replaces it.
|
|
664
|
+
*/
|
|
665
|
+
recordTask(senderId, n) {
|
|
666
|
+
const { task, tr } = n;
|
|
667
|
+
const what = { give: "confi\xE9e \xE0", pass: "pass\xE9e \xE0", done: "rendue \xE0", refuse: "refus\xE9e, rendue \xE0", cancel: "annul\xE9e pour" }[tr.op];
|
|
668
|
+
const said = tr.op === "pass" ? tr.note : task.result;
|
|
669
|
+
return this.put(senderId, {
|
|
670
|
+
kind: "notice",
|
|
671
|
+
id: `task-${task.id}-${tr.index}`,
|
|
672
|
+
at: tr.at,
|
|
673
|
+
turn: this.turns.get(senderId) ?? 0,
|
|
674
|
+
notice: "other",
|
|
675
|
+
task: task.id,
|
|
676
|
+
taskOp: tr.op,
|
|
677
|
+
outgoing: true,
|
|
678
|
+
name: tr.toName,
|
|
679
|
+
...n.peer ? { peer: n.peer } : {},
|
|
680
|
+
summary: said ? `${task.title}
|
|
681
|
+
${quote(said)}` : task.title,
|
|
682
|
+
text: `T\xE2che \xAB ${task.title} \xBB ${what} ${tr.toName}${tr.op === "done" ? " (termin\xE9e)" : ""}`
|
|
683
|
+
});
|
|
684
|
+
}
|
|
625
685
|
/** The mailbox's outcome for a card; a `read` card stays read. */
|
|
626
686
|
markSent(senderId, rid, status) {
|
|
627
687
|
const sent = this.items(senderId).find((i) => i.kind === "sent" && i.id === rid);
|
|
@@ -2188,7 +2248,9 @@ async function startDaemon(opts = {}) {
|
|
|
2188
2248
|
const daemon = await daemonInfo();
|
|
2189
2249
|
let ompLive = () => 0;
|
|
2190
2250
|
const updater = createDaemonUpdater(realUpdaterDeps({ info: daemon, save: () => store.save(), ownedLive: () => ompLive() }));
|
|
2191
|
-
const
|
|
2251
|
+
const attachments = new AttachmentStore(paths().attachments);
|
|
2252
|
+
await attachments.load().catch((e) => log(`attachments not loaded: ${e.message}`));
|
|
2253
|
+
const history = new History({ peerOf: (t) => ledgePeer(t, readPeers(), store.all())?.id, refOf: (id) => attachments.ref(id) });
|
|
2192
2254
|
try {
|
|
2193
2255
|
await history.load();
|
|
2194
2256
|
} catch (e) {
|
|
@@ -2208,7 +2270,7 @@ async function startDaemon(opts = {}) {
|
|
|
2208
2270
|
const mail = fileJournal(paths().mail);
|
|
2209
2271
|
const taskJournal = tasksJournal(paths().tasks);
|
|
2210
2272
|
const teamJournal = teamsJournal(paths().teams);
|
|
2211
|
-
const server = await startServer({ store, tmux, port: opts.port, daemon, updater, history, mobile, mobileUnavailable, mail, tasks: taskJournal, teams: teamJournal });
|
|
2273
|
+
const server = await startServer({ store, tmux, port: opts.port, daemon, updater, history, mobile, mobileUnavailable, mail, tasks: taskJournal, teams: teamJournal, attachments });
|
|
2212
2274
|
ompLive = () => server.omp.liveCount();
|
|
2213
2275
|
const poller = startPoller({ store, tmux, broadcastPreview: server.preview, labelExited: server.labelExited });
|
|
2214
2276
|
await writeFile3(paths().pid, String(process.pid));
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
handoverArgs,
|
|
4
4
|
handoverOnClient,
|
|
5
5
|
runHandover
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-ZZMZDAF6.js";
|
|
7
|
+
import "./chunk-35BPMR6P.js";
|
|
8
|
+
import "./chunk-KACRWFN3.js";
|
|
9
|
+
import "./chunk-EX66KH66.js";
|
|
10
|
+
import "./chunk-HOOHS3MX.js";
|
|
11
11
|
export {
|
|
12
12
|
HANDOVER_USAGE,
|
|
13
13
|
handoverArgs,
|
|
@@ -6,41 +6,44 @@ import {
|
|
|
6
6
|
resolveRoleAddress,
|
|
7
7
|
resolveTarget,
|
|
8
8
|
seatContext,
|
|
9
|
+
takeImages,
|
|
9
10
|
teammates
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-XR42PIDL.js";
|
|
11
12
|
import {
|
|
12
13
|
findRole
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-24AHC55Y.js";
|
|
14
15
|
import {
|
|
15
16
|
parseLedgeCommand,
|
|
16
17
|
readOnClient,
|
|
17
18
|
sendOnClient
|
|
18
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-AJFC33TH.js";
|
|
19
20
|
import {
|
|
20
21
|
taskOnClient
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-ERN736NQ.js";
|
|
22
23
|
import {
|
|
23
24
|
handoverOnClient
|
|
24
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-ZZMZDAF6.js";
|
|
25
26
|
import {
|
|
26
27
|
CODEX_ENV_VAR,
|
|
27
28
|
CODEX_HOOK_VAR,
|
|
28
29
|
codexPlan
|
|
29
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-35BPMR6P.js";
|
|
30
31
|
import {
|
|
31
32
|
formatWho
|
|
32
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-ZQON4EV7.js";
|
|
33
34
|
import {
|
|
34
35
|
connect,
|
|
35
36
|
sendMessageAndAwaitAck
|
|
36
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-KACRWFN3.js";
|
|
37
38
|
import {
|
|
38
39
|
taskClosed
|
|
39
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-EX66KH66.js";
|
|
40
41
|
import {
|
|
41
42
|
log
|
|
42
|
-
} from "./chunk-
|
|
43
|
-
import
|
|
43
|
+
} from "./chunk-6IYPRUQG.js";
|
|
44
|
+
import {
|
|
45
|
+
paths
|
|
46
|
+
} from "./chunk-HOOHS3MX.js";
|
|
44
47
|
|
|
45
48
|
// src/cli/hook.ts
|
|
46
49
|
import { randomUUID } from "crypto";
|
|
@@ -50,8 +53,12 @@ var str = (v) => typeof v === "string" ? v : void 0;
|
|
|
50
53
|
var PROMPT_MAX = 500;
|
|
51
54
|
var fromAgent = (t) => t.startsWith('<agent-message from="') || t.startsWith("<cross-session-message ") || t.startsWith("[Cross-session ");
|
|
52
55
|
var promptText = (p) => {
|
|
53
|
-
const
|
|
54
|
-
|
|
56
|
+
const raw = str(p.prompt)?.trim();
|
|
57
|
+
if (!raw) return {};
|
|
58
|
+
const taken = takeImages(raw, paths().attachments);
|
|
59
|
+
const ids = taken.ids;
|
|
60
|
+
const t = ids.length ? taken.text : raw;
|
|
61
|
+
return { ...t ? { text: t.slice(0, fromAgent(t) ? INPUT_MAX : PROMPT_MAX) } : {}, ...ids.length ? { attachments: ids } : {} };
|
|
55
62
|
};
|
|
56
63
|
function describeTool(tool, input) {
|
|
57
64
|
const i = input && typeof input === "object" ? input : {};
|
package/dist/cli/index.js
CHANGED
|
@@ -23,7 +23,7 @@ async function hookMain(args) {
|
|
|
23
23
|
try {
|
|
24
24
|
const chunks = [];
|
|
25
25
|
for await (const c of process.stdin) chunks.push(c);
|
|
26
|
-
const { runHook } = await import("./hook-
|
|
26
|
+
const { runHook } = await import("./hook-ERYA6BKY.js");
|
|
27
27
|
const out = await runHook(event, Buffer.concat(chunks).toString("utf8"), { tool });
|
|
28
28
|
if (out) process.stdout.write(`${out}
|
|
29
29
|
`);
|
|
@@ -35,7 +35,7 @@ async function main(argv) {
|
|
|
35
35
|
const [cmd, ...rest] = argv;
|
|
36
36
|
switch (cmd) {
|
|
37
37
|
case "daemon": {
|
|
38
|
-
const { startDaemon } = await import("./daemon-
|
|
38
|
+
const { startDaemon } = await import("./daemon-DVPDCY3V.js");
|
|
39
39
|
await startDaemon();
|
|
40
40
|
await new Promise(() => {
|
|
41
41
|
});
|
|
@@ -43,17 +43,17 @@ async function main(argv) {
|
|
|
43
43
|
}
|
|
44
44
|
case "--version":
|
|
45
45
|
case "version": {
|
|
46
|
-
const { LEDGE_VERSION } = await import("./version-
|
|
46
|
+
const { LEDGE_VERSION } = await import("./version-BFNXT3H4.js");
|
|
47
47
|
console.log(LEDGE_VERSION);
|
|
48
48
|
return 0;
|
|
49
49
|
}
|
|
50
50
|
case "setup": {
|
|
51
|
-
const { runSetup } = await import("./setup-
|
|
51
|
+
const { runSetup } = await import("./setup-47ODKJBM.js");
|
|
52
52
|
for (const l of await runSetup()) console.log(l);
|
|
53
53
|
return 0;
|
|
54
54
|
}
|
|
55
55
|
case "uninstall": {
|
|
56
|
-
const { runUninstall, uninstallArgs } = await import("./uninstall-
|
|
56
|
+
const { runUninstall, uninstallArgs } = await import("./uninstall-QNWRD27D.js");
|
|
57
57
|
const args = uninstallArgs(rest);
|
|
58
58
|
if (!args) {
|
|
59
59
|
console.log(USAGE);
|
|
@@ -64,62 +64,62 @@ async function main(argv) {
|
|
|
64
64
|
return r.ok ? 0 : 1;
|
|
65
65
|
}
|
|
66
66
|
case "status": {
|
|
67
|
-
const { printStatus } = await import("./status-
|
|
67
|
+
const { printStatus } = await import("./status-JPF4NZNI.js");
|
|
68
68
|
console.log(await printStatus());
|
|
69
69
|
return 0;
|
|
70
70
|
}
|
|
71
71
|
case "who": {
|
|
72
|
-
const { printWho } = await import("./who-
|
|
72
|
+
const { printWho } = await import("./who-NYPVBO64.js");
|
|
73
73
|
console.log(await printWho());
|
|
74
74
|
return 0;
|
|
75
75
|
}
|
|
76
76
|
case "send": {
|
|
77
|
-
const { sendMessage } = await import("./send-
|
|
77
|
+
const { sendMessage } = await import("./send-BFPJBXXH.js");
|
|
78
78
|
const r = await sendMessage(rest);
|
|
79
79
|
console.log(r.line);
|
|
80
80
|
return r.code;
|
|
81
81
|
}
|
|
82
82
|
case "read": {
|
|
83
|
-
const { readMessage } = await import("./send-
|
|
83
|
+
const { readMessage } = await import("./send-BFPJBXXH.js");
|
|
84
84
|
const r = await readMessage(rest);
|
|
85
85
|
console.log(r.line);
|
|
86
86
|
return r.code;
|
|
87
87
|
}
|
|
88
88
|
case "task": {
|
|
89
|
-
const { runTask } = await import("./task-
|
|
89
|
+
const { runTask } = await import("./task-K43WJIUX.js");
|
|
90
90
|
const r = await runTask(rest);
|
|
91
91
|
console.log(r.line);
|
|
92
92
|
return r.code;
|
|
93
93
|
}
|
|
94
94
|
case "handover": {
|
|
95
|
-
const { runHandover } = await import("./handover-
|
|
95
|
+
const { runHandover } = await import("./handover-AZ35QZRK.js");
|
|
96
96
|
const r = await runHandover(rest);
|
|
97
97
|
console.log(r.line);
|
|
98
98
|
return r.code;
|
|
99
99
|
}
|
|
100
100
|
case "team": {
|
|
101
|
-
const { runTeam } = await import("./team-
|
|
101
|
+
const { runTeam } = await import("./team-SZJHGA7D.js");
|
|
102
102
|
const r = await runTeam(rest);
|
|
103
103
|
console.log(r.line);
|
|
104
104
|
return r.code;
|
|
105
105
|
}
|
|
106
106
|
case "tui": {
|
|
107
|
-
const { runTui } = await import("./tui-
|
|
107
|
+
const { runTui } = await import("./tui-AMERXSL7.js");
|
|
108
108
|
return runTui(rest);
|
|
109
109
|
}
|
|
110
110
|
case "bridge": {
|
|
111
|
-
const { bridge } = await import("./bridge-
|
|
111
|
+
const { bridge } = await import("./bridge-H3ZPGIUY.js");
|
|
112
112
|
await bridge();
|
|
113
113
|
return 0;
|
|
114
114
|
}
|
|
115
115
|
case "claude":
|
|
116
116
|
case "codex":
|
|
117
117
|
case "cursor": {
|
|
118
|
-
const { launch } = await import("./launch-
|
|
118
|
+
const { launch } = await import("./launch-LAER5DI6.js");
|
|
119
119
|
return launch(cmd, rest);
|
|
120
120
|
}
|
|
121
121
|
case "attach": {
|
|
122
|
-
const { attach } = await import("./attach-
|
|
122
|
+
const { attach } = await import("./attach-JNECAG6L.js");
|
|
123
123
|
return attach(rest.find((a) => !a.startsWith("--")) ?? "", { readOnly: rest.includes("--read-only") });
|
|
124
124
|
}
|
|
125
125
|
default:
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DaemonError,
|
|
3
|
+
attachEnv,
|
|
4
|
+
createSession,
|
|
5
|
+
ensureDaemon,
|
|
6
|
+
launch,
|
|
7
|
+
parseLaunchArgs,
|
|
8
|
+
roleArgs
|
|
9
|
+
} from "./chunk-CDME3WRV.js";
|
|
10
|
+
import "./chunk-NVSBPIXY.js";
|
|
11
|
+
import "./chunk-2VSEIOGA.js";
|
|
12
|
+
import "./chunk-OLLQBK6N.js";
|
|
13
|
+
import "./chunk-XR42PIDL.js";
|
|
14
|
+
import "./chunk-24AHC55Y.js";
|
|
15
|
+
import {
|
|
16
|
+
agentEnv,
|
|
17
|
+
exitFile
|
|
18
|
+
} from "./chunk-35BPMR6P.js";
|
|
19
|
+
import "./chunk-KACRWFN3.js";
|
|
20
|
+
import "./chunk-EX66KH66.js";
|
|
21
|
+
import "./chunk-NLL2EQJ2.js";
|
|
22
|
+
import "./chunk-6IYPRUQG.js";
|
|
23
|
+
import "./chunk-HOOHS3MX.js";
|
|
24
|
+
export {
|
|
25
|
+
DaemonError,
|
|
26
|
+
agentEnv,
|
|
27
|
+
attachEnv,
|
|
28
|
+
createSession,
|
|
29
|
+
ensureDaemon,
|
|
30
|
+
exitFile,
|
|
31
|
+
launch,
|
|
32
|
+
parseLaunchArgs,
|
|
33
|
+
roleArgs
|
|
34
|
+
};
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
readOnClient,
|
|
5
5
|
sendMessage,
|
|
6
6
|
sendOnClient
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-AJFC33TH.js";
|
|
8
|
+
import "./chunk-35BPMR6P.js";
|
|
9
|
+
import "./chunk-KACRWFN3.js";
|
|
10
|
+
import "./chunk-EX66KH66.js";
|
|
11
|
+
import "./chunk-HOOHS3MX.js";
|
|
12
12
|
export {
|
|
13
13
|
parseLedgeCommand,
|
|
14
14
|
readMessage,
|
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
stopDetachedDaemon,
|
|
15
15
|
systemdUnit,
|
|
16
16
|
writeBin
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-K7UEKSB2.js";
|
|
18
|
+
import "./chunk-NLL2EQJ2.js";
|
|
19
|
+
import "./chunk-6IYPRUQG.js";
|
|
20
|
+
import "./chunk-HOOHS3MX.js";
|
|
21
21
|
export {
|
|
22
22
|
BIN_MARK,
|
|
23
23
|
CLAUDE_EVENTS,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
connect
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-KACRWFN3.js";
|
|
4
|
+
import "./chunk-EX66KH66.js";
|
|
5
|
+
import "./chunk-HOOHS3MX.js";
|
|
6
6
|
|
|
7
7
|
// src/cli/status.ts
|
|
8
8
|
async function printStatus(opts = {}) {
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
runTask,
|
|
5
5
|
taskArgs,
|
|
6
6
|
taskOnClient
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-ERN736NQ.js";
|
|
8
|
+
import "./chunk-35BPMR6P.js";
|
|
9
|
+
import "./chunk-KACRWFN3.js";
|
|
10
|
+
import "./chunk-EX66KH66.js";
|
|
11
|
+
import "./chunk-HOOHS3MX.js";
|
|
12
12
|
export {
|
|
13
13
|
TASK_USAGE,
|
|
14
14
|
formatTask,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listDefinitions
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-2VSEIOGA.js";
|
|
4
|
+
import "./chunk-24AHC55Y.js";
|
|
5
5
|
import {
|
|
6
6
|
connect
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-KACRWFN3.js";
|
|
8
|
+
import "./chunk-EX66KH66.js";
|
|
9
|
+
import "./chunk-6IYPRUQG.js";
|
|
10
|
+
import "./chunk-HOOHS3MX.js";
|
|
11
11
|
|
|
12
12
|
// src/cli/team.ts
|
|
13
13
|
import { randomUUID } from "crypto";
|