terminalhire 0.15.0 → 0.16.1
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/bin/jpi-chat-read.js +35 -21
- package/dist/bin/jpi-chat.js +1033 -48
- package/dist/bin/jpi-dispatch.js +694 -80
- package/dist/bin/jpi-inbox.js +6521 -0
- package/dist/bin/jpi-intro.js +20 -1
- package/dist/bin/jpi-refresh.js +31 -2
- package/dist/bin/jpi-spinner.js +17 -1
- package/dist/bin/jpi-statusline.js +2 -2
- package/dist/bin/jpi.js +5 -5
- package/dist/bin/spinner.js +19 -1
- package/dist/src/config.js +4 -0
- package/dist/src/intro.js +20 -1
- package/package.json +2 -2
|
@@ -4597,29 +4597,14 @@ async function gateDisclosure(ensureDisclosure, input, output) {
|
|
|
4597
4597
|
}
|
|
4598
4598
|
return true;
|
|
4599
4599
|
}
|
|
4600
|
-
async function
|
|
4600
|
+
async function buildInboxItems(deps = {}) {
|
|
4601
4601
|
const {
|
|
4602
|
-
output = process.stdout,
|
|
4603
|
-
input = process.stdin,
|
|
4604
4602
|
client = createChatClient(),
|
|
4605
4603
|
listConnections = defaultListConnections,
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
ensureDisclosure = ensureChatDisclosure
|
|
4609
|
-
} = opts;
|
|
4610
|
-
if (!await gateDisclosure(ensureDisclosure, input, output)) {
|
|
4611
|
-
return { ok: false, reason: "not-acknowledged" };
|
|
4612
|
-
}
|
|
4604
|
+
readCursors = readReadCursors
|
|
4605
|
+
} = deps;
|
|
4613
4606
|
const listed = await listConnections();
|
|
4614
|
-
if (listed.status !== "ok")
|
|
4615
|
-
return { ok: false, reason: writeProblem(output, listed, "") };
|
|
4616
|
-
}
|
|
4617
|
-
let invites = [];
|
|
4618
|
-
try {
|
|
4619
|
-
const inv = await listInvites();
|
|
4620
|
-
if (inv && inv.status === "ok") invites = inv.invites;
|
|
4621
|
-
} catch {
|
|
4622
|
-
}
|
|
4607
|
+
if (listed.status !== "ok") return listed;
|
|
4623
4608
|
const cursors = readCursors();
|
|
4624
4609
|
const items = [];
|
|
4625
4610
|
for (const conn of listed.connections) {
|
|
@@ -4639,11 +4624,39 @@ async function runInbox(opts = {}) {
|
|
|
4639
4624
|
presence: REACHABLE_DISPLAY,
|
|
4640
4625
|
unread,
|
|
4641
4626
|
lastStamp: last ? formatStamp(last.createdAt) : "",
|
|
4627
|
+
// Raw ISO of the newest message — the TUI's `r` key marks the thread read at
|
|
4628
|
+
// this exact watermark (postReadCursor). The formatted lastStamp is display-only.
|
|
4629
|
+
lastStampIso: last ? last.createdAt : null,
|
|
4642
4630
|
preview: last ? last.plaintext : ""
|
|
4643
4631
|
});
|
|
4644
4632
|
}
|
|
4645
|
-
|
|
4646
|
-
|
|
4633
|
+
return { status: "ok", items };
|
|
4634
|
+
}
|
|
4635
|
+
async function runInbox(opts = {}) {
|
|
4636
|
+
const {
|
|
4637
|
+
output = process.stdout,
|
|
4638
|
+
input = process.stdin,
|
|
4639
|
+
client = createChatClient(),
|
|
4640
|
+
listConnections = defaultListConnections,
|
|
4641
|
+
listInvites = defaultListPendingInvites,
|
|
4642
|
+
readCursors = readReadCursors,
|
|
4643
|
+
ensureDisclosure = ensureChatDisclosure
|
|
4644
|
+
} = opts;
|
|
4645
|
+
if (!await gateDisclosure(ensureDisclosure, input, output)) {
|
|
4646
|
+
return { ok: false, reason: "not-acknowledged" };
|
|
4647
|
+
}
|
|
4648
|
+
const built = await buildInboxItems({ client, listConnections, readCursors });
|
|
4649
|
+
if (built.status !== "ok") {
|
|
4650
|
+
return { ok: false, reason: writeProblem(output, built, "") };
|
|
4651
|
+
}
|
|
4652
|
+
let invites = [];
|
|
4653
|
+
try {
|
|
4654
|
+
const inv = await listInvites();
|
|
4655
|
+
if (inv && inv.status === "ok") invites = inv.invites;
|
|
4656
|
+
} catch {
|
|
4657
|
+
}
|
|
4658
|
+
output.write(renderInbox(built.items, invites));
|
|
4659
|
+
return { ok: true, count: built.items.length, invites: invites.length };
|
|
4647
4660
|
}
|
|
4648
4661
|
async function runReadThread(opts = {}) {
|
|
4649
4662
|
const {
|
|
@@ -4781,6 +4794,7 @@ var init_jpi_chat_read = __esm({
|
|
|
4781
4794
|
});
|
|
4782
4795
|
init_jpi_chat_read();
|
|
4783
4796
|
export {
|
|
4797
|
+
buildInboxItems,
|
|
4784
4798
|
formatClock,
|
|
4785
4799
|
formatStamp,
|
|
4786
4800
|
postReadCursor,
|