pendingyou 0.4.0 → 0.5.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/CHANGELOG.md +12 -0
- package/dist/format.js +30 -5
- package/dist/pickup.js +9 -2
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
- A card with several questions (guide 2.6) prints each answer on its own line when `hold` ends (and when a hook
|
|
6
|
+
hands the answer over): `1. Pay Kaiser’s invoice 09/30 for $1,200? (pay): Approved`, numbered in the card's order,
|
|
7
|
+
with the question's id as `answer.answers` has it. A question your person split out into a card of its own is named
|
|
8
|
+
with its new request id: hear its answer there.
|
|
9
|
+
- When an answer is ready, the line telling Claude Code to call `ack_answer` (or `reply_in_thread`) now names the
|
|
10
|
+
session too (`name “billing-webhooks”`): since guide 2.5 the sessions sharing a computer's sign-in each act only on
|
|
11
|
+
their own cards, and pass their name to do so.
|
|
12
|
+
- The next-message hook's open-cards line names the session that asked each card (`(req_…, by dns-setup)`, from
|
|
13
|
+
servers on guide 2.5, cut to 24 characters) and says to cancel only one of yours, with `answeredHere` and your name.
|
|
14
|
+
|
|
3
15
|
## 0.4.0
|
|
4
16
|
|
|
5
17
|
- The next-message hook's reminder now names this folder's open cards still waiting on you, so a question you answer
|
package/dist/format.js
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
const MAX_ANSWER = 600;
|
|
5
5
|
const MAX_MESSAGE = 400;
|
|
6
6
|
const MAX_TITLE = 140;
|
|
7
|
+
/** A grouped card's question and its answer, each: four of them stay well under one long answer. */
|
|
8
|
+
const MAX_QUESTION = 100;
|
|
9
|
+
const MAX_QUESTION_ANSWER = 300;
|
|
7
10
|
/** Cuts text to `max` characters on one line, and says so. */
|
|
8
11
|
export function clip(text, max) {
|
|
9
12
|
const flat = text.replace(/\s+/g, ' ').trim();
|
|
@@ -22,6 +25,11 @@ const quoted = (text, max) => {
|
|
|
22
25
|
const { text: clipped, cut } = clip(text, max);
|
|
23
26
|
return { line: `“${clipped}”`, cut };
|
|
24
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* The session's name, as it asked (its session label): the card tools take it, and need it where other sessions share
|
|
30
|
+
* the sign-in (guide 2.5).
|
|
31
|
+
*/
|
|
32
|
+
const named = (heard) => `“${clip(heard.sessionLabel, MAX_TITLE).text}”`;
|
|
25
33
|
/** Closed for good: nothing more to wait for. */
|
|
26
34
|
export const isClosed = (heard) => heard.status === 'answered' ||
|
|
27
35
|
heard.status === 'resolved' ||
|
|
@@ -40,12 +48,24 @@ export function describe(heard, again) {
|
|
|
40
48
|
const lines = [];
|
|
41
49
|
switch (heard.status) {
|
|
42
50
|
case 'answered': {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
51
|
+
if (heard.answers?.length) {
|
|
52
|
+
// One line per question, so each answer reads against its own question (and its id, as answer.answers has it).
|
|
53
|
+
lines.push(`Pending You: ${id} is answered, all ${heard.answers.length} questions.`, question);
|
|
54
|
+
for (const [index, each] of heard.answers.entries()) {
|
|
55
|
+
const asked = clip(each.title, MAX_QUESTION);
|
|
56
|
+
const answer = clip(each.said, MAX_QUESTION_ANSWER);
|
|
57
|
+
cut ||= asked.cut || answer.cut;
|
|
58
|
+
lines.push(`${index + 1}. ${asked.text} (${each.questionId}): ${answer.text}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const answer = clip(heard.said ?? 'Answered', MAX_ANSWER);
|
|
63
|
+
cut ||= answer.cut;
|
|
64
|
+
lines.push(`Pending You: ${id} is answered.`, question, `Answer: ${answer.text}`);
|
|
65
|
+
}
|
|
46
66
|
if (wrote.length)
|
|
47
67
|
lines.push(`They also wrote: ${wrote.join(' ')}`);
|
|
48
|
-
lines.push(`Act on it, then call ack_answer with requestId ${id}, expectedVersion ${heard.version} and a one-line outcome.`);
|
|
68
|
+
lines.push(`Act on it, then call ack_answer with requestId ${id}, name ${named(heard)}, expectedVersion ${heard.version} and a one-line outcome.`);
|
|
49
69
|
break;
|
|
50
70
|
}
|
|
51
71
|
case 'expired':
|
|
@@ -59,12 +79,17 @@ export function describe(heard, again) {
|
|
|
59
79
|
break;
|
|
60
80
|
default:
|
|
61
81
|
if (heard.turn === 'agent') {
|
|
62
|
-
lines.push(`Pending You: they wrote back on ${id}.`, question, `They wrote: ${wrote.join(' ') || '(a follow-up; call get_request to read it)'}`, `Answer with reply_in_thread (requestId ${id}), then ${again}.`);
|
|
82
|
+
lines.push(`Pending You: they wrote back on ${id}.`, question, `They wrote: ${wrote.join(' ') || '(a follow-up; call get_request to read it)'}`, `Answer with reply_in_thread (requestId ${id}, name ${named(heard)}), then ${again}.`);
|
|
63
83
|
}
|
|
64
84
|
else {
|
|
65
85
|
lines.push(`Pending You: ${id} is still waiting for them (${heard.status}).`, question);
|
|
66
86
|
}
|
|
67
87
|
}
|
|
88
|
+
// Questions split out of a grouped card are cards of their own now, with answers of their own.
|
|
89
|
+
if (heard.splits?.length && heard.status !== 'cancelled' && heard.status !== 'resolved')
|
|
90
|
+
lines.push(`They split ${heard.splits
|
|
91
|
+
.map((split) => `“${clip(split.title, MAX_QUESTION).text}” (${split.requestId})`)
|
|
92
|
+
.join(', ')} out into ${heard.splits.length === 1 ? 'a card of its own' : 'cards of their own'}: hear ${heard.splits.length === 1 ? 'its answer' : 'their answers'} there.`);
|
|
68
93
|
if (cut)
|
|
69
94
|
lines.push(`(Cut short: get_request ${id} has all of it.)`);
|
|
70
95
|
return lines;
|
package/dist/pickup.js
CHANGED
|
@@ -21,6 +21,8 @@ export const REMINDER = 'Pending You: anything you need from your person also go
|
|
|
21
21
|
/** The most open cards the line names, and how much of each title. */
|
|
22
22
|
export const OPEN_SHOWN = 3;
|
|
23
23
|
export const OPEN_TITLE = 50;
|
|
24
|
+
/** How much of the asking session's name each card shows. */
|
|
25
|
+
export const OPEN_NAME = 24;
|
|
24
26
|
/**
|
|
25
27
|
* The reminder, naming this folder's open cards still waiting on the person when there are any (about 45 tokens plus
|
|
26
28
|
* 20 a card): `… Your open cards here: "Which DNS host?" (req_…); … +2 more. If this message answers …`.
|
|
@@ -40,9 +42,14 @@ export function openLine(open) {
|
|
|
40
42
|
return REMINDER;
|
|
41
43
|
const more = typeof total === 'number' && total > cards.length ? total - cards.length : 0;
|
|
42
44
|
const named = cards
|
|
43
|
-
.map((card) =>
|
|
45
|
+
.map((card) => {
|
|
46
|
+
const by = typeof card.name === 'string' && card.name.trim()
|
|
47
|
+
? `, by ${clip(card.name.replaceAll('"', "'"), OPEN_NAME).text}`
|
|
48
|
+
: '';
|
|
49
|
+
return `"${clip(card.title.replaceAll('"', "'"), OPEN_TITLE).text}" (${card.requestId}${by})`;
|
|
50
|
+
})
|
|
44
51
|
.join('; ');
|
|
45
|
-
return `${REMINDER} Your open cards here: ${named}${more ? ` +${more} more` : ''}. If this message answers or settles one, cancel_request it with answeredHere (or update_request if it changed).`;
|
|
52
|
+
return `${REMINDER} Your open cards here: ${named}${more ? ` +${more} more` : ''}. If this message answers or settles one of yours, cancel_request it with answeredHere and your name (or update_request if it changed).`;
|
|
46
53
|
}
|
|
47
54
|
/** The folder Claude Code says the session is in (the hook's stdin), or where this runs. */
|
|
48
55
|
async function sessionFolder(io) {
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// The command line's version, as published (package.json). A test keeps them the same.
|
|
2
|
-
export const VERSION = '0.
|
|
2
|
+
export const VERSION = '0.5.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pendingyou",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Pending You for Claude Code: hear your answers from Pending You in the background, and set Claude Code up in one command.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://www.pendingyou.com",
|