pendingyou 0.41.0 → 0.43.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 +29 -0
- package/README.md +9 -4
- package/dist/apps/codex-wake.js +44 -2
- package/dist/apps/codex.js +15 -3
- package/dist/apps/opencode-plugin.js +5 -1
- package/dist/apps/pi-extension.js +9 -4
- package/dist/args.js +5 -1
- package/dist/herdr/answer.js +143 -9
- package/dist/herdr/queue.js +24 -6
- package/dist/main.js +1 -0
- package/dist/sdk/client.js +4 -1
- package/dist/version.js +1 -1
- package/mod/.claude-plugin/plugin.json +1 -1
- package/mod/README.md +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.43.0 (2026-11-16)
|
|
4
|
+
|
|
5
|
+
- Pending You for Herdr shows an assistant's question on a card it still has, and answers it. When a card you handed
|
|
6
|
+
to one of your assistants needs something from you, it's in the popup with the rest, first: "Maple needs you to:"
|
|
7
|
+
and the steps, for a helper's to-do (y Done, n "I can't", with your words if you have any), or "Maple asks:" and its
|
|
8
|
+
options or a box for your words. Your answer goes to the question, not the card, which stays with the helper; u takes
|
|
9
|
+
it back for 5 seconds. A question that's high stakes, or carries a draft to send in your name, is answered in Pending
|
|
10
|
+
You (o opens it).
|
|
11
|
+
- "Ask Maple?": introductions go both ways now, so an assistant may ask the one whose card it worked on. The popup says
|
|
12
|
+
"Ask Maple?" for that, and "Wren worked on Maple’s “…”", until Maple has helped it; then "Ask Maple again?" as before.
|
|
13
|
+
- A card its helper handed back and then picked back up says so in the popup.
|
|
14
|
+
- Run `npx pendingyou@latest init`; nothing to restart but Herdr's popup, which picks it up the next time it opens.
|
|
15
|
+
|
|
16
|
+
## 0.42.0 (2026-11-16)
|
|
17
|
+
|
|
18
|
+
- Fixed: a Codex thread that had only said its name to Pending You (`whoami`, then read its queue) was never woken for a
|
|
19
|
+
question you handed it from another assistant. Only a card call made a thread known on your computer, so the question
|
|
20
|
+
waited for the next session start or message in its folder. Now a thread that calls `whoami`, `list_pending` or
|
|
21
|
+
`get_request` with its name is known by that name and folder, as one that posted a card is, and a question handed to
|
|
22
|
+
it is queued into it for the next 12 hours. Such a call is never a card: the check at the end of the turn doesn't count
|
|
23
|
+
it as one posted, and it makes no card the thread's own.
|
|
24
|
+
- Codex: it comes from a new hook, PostToolUse on those three tools, added last so every hook you trusted stays trusted.
|
|
25
|
+
Codex skips it until you trust it in `/hooks`: `npx pendingyou@latest init` adds it, says "Codex has new Pending You
|
|
26
|
+
hooks (questions handed to a thread)" and waits for you there, and `status` has a "Handed questions" line saying how
|
|
27
|
+
it stands. The card hook is unchanged, so answers to a thread's own cards wake it as before meanwhile.
|
|
28
|
+
- OpenCode and Pi had the same gap: the plugin and the extension now hand those three calls to the command line too,
|
|
29
|
+
when they carry a name. Run `npx pendingyou@latest init` there, then restart OpenCode or `/reload` Pi.
|
|
30
|
+
- Claude Code never had it: its wake mod learns the session's name from any Pending You call, `whoami` included.
|
|
31
|
+
|
|
3
32
|
## 0.41.0 (2026-11-03)
|
|
4
33
|
|
|
5
34
|
- Pending You for Herdr holds a card while you're in its agent's pane. When the agent in the Herdr pane you're in also
|
package/README.md
CHANGED
|
@@ -103,8 +103,10 @@ call that ran (a card when Codex waits for your OK, [below](#when-claude-code-wa
|
|
|
103
103
|
`status` finds Pending You's hooks not trusted yet, it prints the one command that opens a Codex here (`codex`, or
|
|
104
104
|
the one the ChatGPT app brings, by its full path) and says to type `/hooks` there and trust them; at a terminal it
|
|
105
105
|
then waits (every 3 seconds, for up to 10 minutes; Ctrl-C stops it) until Codex trusts them, and says whether Codex is
|
|
106
|
-
ready. It never trusts them for you. `status` says which are trusted. Upgrading from 0.14.0 adds three hooks,
|
|
107
|
-
|
|
106
|
+
ready. It never trusts them for you. `status` says which are trusted. Upgrading from 0.14.0 adds three hooks, and
|
|
107
|
+
from 0.41.0 or earlier one more (0.42.0: whoami, list_pending and get_request, so a question you hand a thread that only
|
|
108
|
+
said its name wakes it), which Codex skips until you trust them once; `init` says so, and the ones you trusted stay
|
|
109
|
+
trusted. A `pendingyou` server or
|
|
108
110
|
hooks Codex's `/import` copied from Claude Code (without its sign-in) are replaced.
|
|
109
111
|
|
|
110
112
|
**The Codex app** (on a Mac, in the ChatGPT app) shares all of this with Codex CLI: the same `~/.codex`, server, hooks
|
|
@@ -507,9 +509,12 @@ answers, once the 5-second window to undo is over:
|
|
|
507
509
|
know; if not, hand_back with what you checked.” Among sessions by one name, the one working in the task's folder
|
|
508
510
|
takes it (as `list_pending` gives it, `~/…` or a full path), one in another folder never does, and one that can't
|
|
509
511
|
tell its folder waits half a minute (5 minutes before 0.35.0).
|
|
510
|
-
- **Codex**: one listener for the app queues it into the thread it's for (`codex queue`, the same words)
|
|
512
|
+
- **Codex**: one listener for the app queues it into the thread it's for (`codex queue`, the same words), for 12 hours
|
|
513
|
+
after the thread last used Pending You's card tools or (0.42.0) said its name with `whoami`, `list_pending` or
|
|
514
|
+
`get_request`. That last needs a hook of its own (PostToolUse on those three), which Codex runs once you trust it in
|
|
515
|
+
`/hooks`: `npx pendingyou@latest init` adds it and says so, and `status`'s "Handed questions" line says how it stands.
|
|
511
516
|
- **OpenCode and Pi**: the session's listener starts the turn through the plugin or extension; a session that used
|
|
512
|
-
Pending You's card tools keeps listening for 12 hours, while the app is open.
|
|
517
|
+
Pending You's card tools or (0.42.0) said its name keeps listening for 12 hours, while the app is open.
|
|
513
518
|
- **Otherwise**: a session start or your next message in that folder brings it, with your note: at once in the
|
|
514
519
|
session that goes by the task's name, after 5 minutes in any other.
|
|
515
520
|
|
package/dist/apps/codex-wake.js
CHANGED
|
@@ -34,10 +34,20 @@ const CARD_TOOLS = {
|
|
|
34
34
|
pi: MCP_CARD_TOOL,
|
|
35
35
|
};
|
|
36
36
|
const HELPER_CALLS = new Set(['answer_delegated', 'hand_back']);
|
|
37
|
+
const MCP_NAMED_TOOL = /^mcp__([A-Za-z0-9_]*pendingyou[A-Za-z0-9_]*)__(whoami|list_pending|get_request)$/i;
|
|
38
|
+
const NAMED_TOOLS = {
|
|
39
|
+
codex: MCP_NAMED_TOOL,
|
|
40
|
+
opencode: /^([A-Za-z0-9_-]*pendingyou[A-Za-z0-9_-]*)_(whoami|list_pending|get_request)$/i,
|
|
41
|
+
pi: MCP_NAMED_TOOL,
|
|
42
|
+
};
|
|
37
43
|
export function cardTool(app, name) {
|
|
38
44
|
const pattern = CARD_TOOLS[app];
|
|
39
45
|
return pattern && typeof name === 'string' ? (pattern.exec(name)?.[2] ?? null) : null;
|
|
40
46
|
}
|
|
47
|
+
export function namedTool(app, name) {
|
|
48
|
+
const pattern = NAMED_TOOLS[app];
|
|
49
|
+
return pattern && typeof name === 'string' ? (pattern.exec(name)?.[2] ?? null) : null;
|
|
50
|
+
}
|
|
41
51
|
const statePath = (io, app) => join(configDir(io), `${app}-threads.json`);
|
|
42
52
|
const leasePath = (io, app, thread) => join(configDir(io), `${app}-listen`, `${thread}.lease`);
|
|
43
53
|
export const threadFiles = (io, app) => [
|
|
@@ -151,10 +161,14 @@ export async function posted(io, options) {
|
|
|
151
161
|
const input = JSON.parse(await io.readStdin(1000));
|
|
152
162
|
if (!isObject(input))
|
|
153
163
|
return 0;
|
|
154
|
-
const call = cardTool(app, input.tool_name);
|
|
155
164
|
const thread = typeof input.session_id === 'string' ? input.session_id : null;
|
|
165
|
+
if (!thread)
|
|
166
|
+
return 0;
|
|
167
|
+
if (namedTool(app, input.tool_name))
|
|
168
|
+
return await named(io, options, input, thread);
|
|
169
|
+
const call = cardTool(app, input.tool_name);
|
|
156
170
|
const turn = typeof input.turn_id === 'string' ? input.turn_id : null;
|
|
157
|
-
if (!call
|
|
171
|
+
if (!call)
|
|
158
172
|
return 0;
|
|
159
173
|
const args = isObject(input.tool_input) ? input.tool_input : {};
|
|
160
174
|
const output = resultOf(input.tool_response);
|
|
@@ -213,6 +227,34 @@ export async function posted(io, options) {
|
|
|
213
227
|
return 0;
|
|
214
228
|
}
|
|
215
229
|
}
|
|
230
|
+
async function named(io, options, input, thread) {
|
|
231
|
+
const { app } = options;
|
|
232
|
+
if (!THREAD.test(thread))
|
|
233
|
+
return 0;
|
|
234
|
+
if (isObject(input.tool_response) && input.tool_response.isError === true)
|
|
235
|
+
return 0;
|
|
236
|
+
const name = nameOf(isObject(input.tool_input) ? input.tool_input : {});
|
|
237
|
+
if (!name)
|
|
238
|
+
return 0;
|
|
239
|
+
const cwd = text(input.cwd, 1000);
|
|
240
|
+
const now = io.now();
|
|
241
|
+
const pane = await herdrTarget(io);
|
|
242
|
+
await change(io, app, (state) => {
|
|
243
|
+
const known = withName(state.threads[thread] ?? { origin: options.origin, cards: {}, at: now }, name);
|
|
244
|
+
if (cwd)
|
|
245
|
+
known.cwd = cwd;
|
|
246
|
+
if (pane)
|
|
247
|
+
known.herdr = pane.pane;
|
|
248
|
+
known.origin = options.origin;
|
|
249
|
+
known.at = now;
|
|
250
|
+
state.threads[thread] = known;
|
|
251
|
+
});
|
|
252
|
+
if (pane)
|
|
253
|
+
io.background(reportCommand(app, { session: thread, at: now }));
|
|
254
|
+
if (app === 'codex')
|
|
255
|
+
await keepListening(io, options.origin, thread);
|
|
256
|
+
return 0;
|
|
257
|
+
}
|
|
216
258
|
function askedIn(args) {
|
|
217
259
|
let asked = args.askedFirst;
|
|
218
260
|
if (typeof asked === 'string')
|
package/dist/apps/codex.js
CHANGED
|
@@ -39,6 +39,7 @@ export function trustSteps(found) {
|
|
|
39
39
|
const DONT_SAVE = 'In the Codex app, don’t press Save on pendingyou in Settings › MCP: that writes it again without this computer’s sign-in (if you did, run init again to put it back).';
|
|
40
40
|
const CARD_TOOLS = '^mcp__pendingyou__(post_request|post_answer|update_request|reply_in_thread|cancel_request)$';
|
|
41
41
|
const POST_ANSWER = 'mcp__pendingyou__post_answer';
|
|
42
|
+
const NAMED_TOOLS = '^mcp__pendingyou__(whoami|list_pending|get_request)$';
|
|
42
43
|
export const CODEX_HOOKS = [
|
|
43
44
|
{ event: 'SessionStart', sub: 'pickup', matcher: 'startup|resume|clear' },
|
|
44
45
|
{ event: 'UserPromptSubmit', sub: 'handoff' },
|
|
@@ -53,10 +54,14 @@ export const codexPermissionHooks = (wait) => CODEX_PERMISSION_HOOKS.map((spec)
|
|
|
53
54
|
export const CODEX_PRESENCE_HOOKS = [
|
|
54
55
|
{ event: 'SessionEnd', sub: 'presence', timeout: 3 },
|
|
55
56
|
];
|
|
57
|
+
export const CODEX_NAMED_HOOKS = [
|
|
58
|
+
{ event: 'PostToolUse', sub: 'named', matcher: NAMED_TOOLS },
|
|
59
|
+
];
|
|
56
60
|
export const ALL_CODEX_HOOKS = [
|
|
57
61
|
...CODEX_HOOKS,
|
|
58
62
|
...CODEX_PERMISSION_HOOKS,
|
|
59
63
|
...CODEX_PRESENCE_HOOKS,
|
|
64
|
+
...CODEX_NAMED_HOOKS,
|
|
60
65
|
];
|
|
61
66
|
const EVENT_LABELS = {
|
|
62
67
|
SessionStart: 'session_start',
|
|
@@ -283,6 +288,7 @@ function keepTheirTrust(config, file, before) {
|
|
|
283
288
|
}
|
|
284
289
|
return next;
|
|
285
290
|
}
|
|
291
|
+
const listed = (words) => words.length > 1 ? `${words.slice(0, -1).join(', ')} and ${words.at(-1)}` : (words[0] ?? '');
|
|
286
292
|
export function answerWaitWords(wait) {
|
|
287
293
|
return wait > 0
|
|
288
294
|
? `Ask on your phone first: Codex’s permission prompts wait up to ${minutes(wait)} for Allow or Deny on their Pending You card, then Codex asks in its terminal (npx pendingyou codex-answers --wait 0 turns it off).`
|
|
@@ -487,6 +493,7 @@ export const codex = {
|
|
|
487
493
|
...CODEX_HOOKS,
|
|
488
494
|
...(extra && cards ? codexPermissionHooks(wait) : []),
|
|
489
495
|
...(extra ? CODEX_PRESENCE_HOOKS : []),
|
|
496
|
+
...CODEX_NAMED_HOOKS,
|
|
490
497
|
];
|
|
491
498
|
const wantedKeys = new Set(wanted.map(lineKey));
|
|
492
499
|
const unwanted = ALL_CODEX_HOOKS.filter((spec) => !wantedKeys.has(lineKey(spec)));
|
|
@@ -505,16 +512,19 @@ export const codex = {
|
|
|
505
512
|
await writeWhole(file.path, `${JSON.stringify({ ...file.json, hooks: removed.hooks }, null, 2)}\n`);
|
|
506
513
|
const fresh = wanted.filter((spec) => !CODEX_HOOKS.includes(spec) && !(lineKey(spec) in (before?.hooks ?? {})));
|
|
507
514
|
if (before && merged.changed && fresh.length)
|
|
508
|
-
newHooks = [
|
|
515
|
+
newHooks = listed([
|
|
509
516
|
...(fresh.some((spec) => spec.sub === 'presence') ? ['session end'] : []),
|
|
510
517
|
...(fresh.some((spec) => spec.sub.startsWith('permission'))
|
|
511
518
|
? ['permission prompts']
|
|
512
519
|
: []),
|
|
513
|
-
|
|
520
|
+
...(fresh.some((spec) => spec.sub === 'named')
|
|
521
|
+
? ['questions handed to a thread']
|
|
522
|
+
: []),
|
|
523
|
+
]);
|
|
514
524
|
report({
|
|
515
525
|
ok: true,
|
|
516
526
|
text: merged.changed
|
|
517
|
-
? `Installed or updated Codex’s session-start pickup, next-message hand-off, card and Stop check hooks${extra ? `, ${cards ? 'its permission-prompt hooks (a card when Codex waits for your OK; --no-permission-cards leaves them out) ' : ''}and its session-end hook (Pending You hears when a thread is open)` : ''} in ${file.path}. Codex runs them once you trust them (how: below).`
|
|
527
|
+
? `Installed or updated Codex’s session-start pickup, next-message hand-off, card, name and Stop check hooks${extra ? `, ${cards ? 'its permission-prompt hooks (a card when Codex waits for your OK; --no-permission-cards leaves them out) ' : ''}and its session-end hook (Pending You hears when a thread is open)` : ''} in ${file.path}. Codex runs them once you trust them (how: below).`
|
|
518
528
|
: removed.changed
|
|
519
529
|
? `Took out Codex’s permission-prompt hooks, as you asked: no card when Codex waits for your OK. To turn them on: npx pendingyou init --app codex --permission-cards${originArgs(ictx.origin)}`
|
|
520
530
|
: 'Codex’s hooks were already installed.',
|
|
@@ -706,6 +716,7 @@ export const codex = {
|
|
|
706
716
|
: 'off: Codex asks in its terminal at once (npx pendingyou codex-answers --wait 2 sends its prompts to your card first, for up to 2 minutes)'}`
|
|
707
717
|
: null;
|
|
708
718
|
const presenceText = extraLine('Presence:', 'tells Pending You when this session is open', CODEX_PRESENCE_HOOKS.map((spec) => spec.sub), ownConnection ? null : notOwn);
|
|
719
|
+
const namedText = extraLine('Handed questions:', 'a question you hand a thread that said its name to Pending You wakes it', CODEX_NAMED_HOOKS.map((spec) => spec.sub), null);
|
|
709
720
|
const wakes = detected
|
|
710
721
|
? atLeast(detected.version, detected.command ? CODEX_APP_WAKE : CODEX_WAKE)
|
|
711
722
|
: false;
|
|
@@ -726,6 +737,7 @@ export const codex = {
|
|
|
726
737
|
permissionText,
|
|
727
738
|
...(askFirst ? [askFirst] : []),
|
|
728
739
|
presenceText,
|
|
740
|
+
namedText,
|
|
729
741
|
` ${mark(wakes)} Wake: ${wakes
|
|
730
742
|
? detected?.command
|
|
731
743
|
? 'codex queue wakes a chat the Codex app has open when you answer, while the app runs (one it let go, idle 3 hours or behind 10 newer idle chats, hears it when you open it again)'
|
|
@@ -11,6 +11,7 @@ const HOOK_MS = 5000;
|
|
|
11
11
|
const TURN_MESSAGES = 200;
|
|
12
12
|
const TEXT_CHARS = 100_000;
|
|
13
13
|
const CARD_TOOL = /^[A-Za-z0-9_-]*pendingyou[A-Za-z0-9_-]*_(post_request|post_answer|update_request|reply_in_thread|cancel_request|answer_delegated|hand_back)$/i;
|
|
14
|
+
const NAMED_TOOL = /^[A-Za-z0-9_-]*pendingyou[A-Za-z0-9_-]*_(whoami|list_pending|get_request)$/i;
|
|
14
15
|
export const HANDED_FOR_MS = 12 * 60 * 60_000;
|
|
15
16
|
const NUDGED = 'Asked OpenCode to put what it needs from you on a card.';
|
|
16
17
|
const isObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
@@ -433,7 +434,10 @@ export async function pendingYou(input, deps) {
|
|
|
433
434
|
},
|
|
434
435
|
async 'tool.execute.after'(input, output) {
|
|
435
436
|
try {
|
|
436
|
-
|
|
437
|
+
const named = NAMED_TOOL.test(input.tool);
|
|
438
|
+
if (named && !(isObject(input.args) && typeof input.args.name === 'string'))
|
|
439
|
+
return;
|
|
440
|
+
if (!named && !CARD_TOOL.test(input.tool))
|
|
437
441
|
return;
|
|
438
442
|
const session = await known(input.sessionID);
|
|
439
443
|
const id = session.parent ?? input.sessionID;
|
|
@@ -9,6 +9,7 @@ export const READY_FOR_MS = 30_000;
|
|
|
9
9
|
const WHOAMI = /^mcp__[A-Za-z0-9_]*pendingyou[A-Za-z0-9_]*__whoami$/i;
|
|
10
10
|
const STOP_MS = 2000;
|
|
11
11
|
export const CARD_TOOL = /^mcp__[A-Za-z0-9_]*pendingyou[A-Za-z0-9_]*__(post_request|post_answer|update_request|reply_in_thread|cancel_request|answer_delegated|hand_back)$/i;
|
|
12
|
+
export const NAMED_TOOL = /^mcp__[A-Za-z0-9_]*pendingyou[A-Za-z0-9_]*__(whoami|list_pending|get_request)$/i;
|
|
12
13
|
export const HANDED_FOR_MS = 12 * 60 * 60_000;
|
|
13
14
|
export const HANDED_PREFIX = 'Pending You: your person handed you';
|
|
14
15
|
const HANDED_REPLY = ' on the question handed to you, ';
|
|
@@ -336,14 +337,18 @@ export function pendingYou(setup, options = {}) {
|
|
|
336
337
|
return said ? { message: { customType: TYPE, content: said, display: false } } : undefined;
|
|
337
338
|
});
|
|
338
339
|
pi.on('tool_result', (event) => {
|
|
339
|
-
if (event.isError === true || typeof event.toolName !== 'string')
|
|
340
|
+
if (event.isError === true || typeof event.toolName !== 'string' || !session)
|
|
340
341
|
return;
|
|
341
|
-
|
|
342
|
+
const named = NAMED_TOOL.test(event.toolName);
|
|
343
|
+
if (named && !(isObject(event.input) && typeof event.input.name === 'string'))
|
|
342
344
|
return;
|
|
343
|
-
|
|
345
|
+
if (!named && !CARD_TOOL.test(event.toolName))
|
|
346
|
+
return;
|
|
347
|
+
if (!named)
|
|
348
|
+
turn ??= `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
344
349
|
const input = {
|
|
345
350
|
session_id: session,
|
|
346
|
-
turn_id: turn,
|
|
351
|
+
...(named ? {} : { turn_id: turn }),
|
|
347
352
|
cwd,
|
|
348
353
|
tool_name: event.toolName,
|
|
349
354
|
tool_input: clipped(event.input ?? {}),
|
package/dist/args.js
CHANGED
|
@@ -76,6 +76,7 @@ const COMMANDS = new Set([
|
|
|
76
76
|
'refresh',
|
|
77
77
|
'mcp-headers',
|
|
78
78
|
'posted',
|
|
79
|
+
'named',
|
|
79
80
|
'listen',
|
|
80
81
|
'mcp',
|
|
81
82
|
'permission',
|
|
@@ -109,6 +110,7 @@ const FLAGS = {
|
|
|
109
110
|
handoff: { origin: true, app: true },
|
|
110
111
|
stopcheck: { origin: true, app: true },
|
|
111
112
|
posted: { origin: true, app: true },
|
|
113
|
+
named: { origin: true, app: true },
|
|
112
114
|
listen: { origin: true, app: true, thread: true, handed: false, since: true },
|
|
113
115
|
permission: { origin: true, app: true },
|
|
114
116
|
'permission-done': { origin: true, app: true },
|
|
@@ -206,6 +208,7 @@ export const HOOK_COMMANDS = new Set([
|
|
|
206
208
|
'handoff',
|
|
207
209
|
'stopcheck',
|
|
208
210
|
'posted',
|
|
211
|
+
'named',
|
|
209
212
|
'permission',
|
|
210
213
|
'permission-done',
|
|
211
214
|
'notify',
|
|
@@ -356,8 +359,9 @@ export function parseArgs(argv, env = {}) {
|
|
|
356
359
|
none();
|
|
357
360
|
return { name: 'stopcheck', origin, ...app() };
|
|
358
361
|
case 'posted':
|
|
362
|
+
case 'named':
|
|
359
363
|
none();
|
|
360
|
-
return { name:
|
|
364
|
+
return { name: first, origin, ...app() };
|
|
361
365
|
case 'listen': {
|
|
362
366
|
none();
|
|
363
367
|
const thread = text('thread');
|
package/dist/herdr/answer.js
CHANGED
|
@@ -26,6 +26,8 @@ export const SAY_YES_THERE = 'Say yes in Pending You: o opens it.';
|
|
|
26
26
|
const ASK_AGAIN_KEYS = 'y: yes, this time; n: no.';
|
|
27
27
|
export const sendToOf = (card) => card.sendTo && (card.status === 'pending' || card.status === 'snoozed') ? card.sendTo : null;
|
|
28
28
|
const asksAgain = (sendTo) => sendTo.kind === 'assistant';
|
|
29
|
+
export const openAskOf = (card) => card.ask && !card.ask.answered ? card.ask : null;
|
|
30
|
+
const TODO_KEYS = 'y: done; n: I can’t.';
|
|
29
31
|
export const toTeammate = (card) => `Send this to ${card.sendTo?.name ?? 'them'}? Answer it in Pending You: o opens it.`;
|
|
30
32
|
const dayOf = (at) => {
|
|
31
33
|
const when = new Date(at);
|
|
@@ -160,10 +162,47 @@ function listKey(state, key, now) {
|
|
|
160
162
|
const sendTo = sendToOf(card);
|
|
161
163
|
if (sendTo)
|
|
162
164
|
return sendToKey(state, card, sendTo, key);
|
|
165
|
+
const ask = openAskOf(card);
|
|
166
|
+
if (ask)
|
|
167
|
+
return askKey(state, card, ask, key);
|
|
163
168
|
if (!answersHere(card))
|
|
164
169
|
return [{ ...state, note: NOT_HERE }, NONE];
|
|
165
170
|
return answerKey(state, card, key);
|
|
166
171
|
}
|
|
172
|
+
function askKey(state, card, ask, key) {
|
|
173
|
+
if (ask.highStakes)
|
|
174
|
+
return [{ ...state, note: HIGH_STAKES }, NONE];
|
|
175
|
+
if (!card.actions.includes('answer'))
|
|
176
|
+
return [{ ...state, note: NOT_HERE }, NONE];
|
|
177
|
+
const send = (answer, words) => [
|
|
178
|
+
{ ...state, note: '' },
|
|
179
|
+
{ kind: 'answer', card, answer: { version: card.version, askId: ask.id, ...answer }, words },
|
|
180
|
+
];
|
|
181
|
+
const enter = key === '\r' || key === '\n';
|
|
182
|
+
if (ask.action) {
|
|
183
|
+
if (key === 'y' || enter)
|
|
184
|
+
return send({ done: true }, 'Done');
|
|
185
|
+
if (key === 'n')
|
|
186
|
+
return [{ ...state, screen: { kind: 'write', purpose: 'cant', text: '' }, note: '' }, NONE];
|
|
187
|
+
return [{ ...state, note: TODO_KEYS }, NONE];
|
|
188
|
+
}
|
|
189
|
+
if (ask.options?.length) {
|
|
190
|
+
const n = digit(key);
|
|
191
|
+
const option = n ? ask.options[n - 1] : undefined;
|
|
192
|
+
if (option)
|
|
193
|
+
return send({ choiceIds: [option.id] }, option.label);
|
|
194
|
+
return [
|
|
195
|
+
{
|
|
196
|
+
...state,
|
|
197
|
+
note: `Press 1–${Math.min(KEYS_MAX, ask.options.length)} to answer ${ask.name}.`,
|
|
198
|
+
},
|
|
199
|
+
NONE,
|
|
200
|
+
];
|
|
201
|
+
}
|
|
202
|
+
if (enter)
|
|
203
|
+
return [{ ...state, screen: { kind: 'write', purpose: 'ask', text: '' }, note: '' }, NONE];
|
|
204
|
+
return [{ ...state, note: 'Enter writes your answer.' }, NONE];
|
|
205
|
+
}
|
|
167
206
|
function sendToKey(state, card, sendTo, key) {
|
|
168
207
|
if (!asksAgain(sendTo))
|
|
169
208
|
return [{ ...state, note: toTeammate(card) }, NONE];
|
|
@@ -377,9 +416,34 @@ function writeKey(state, screen, key) {
|
|
|
377
416
|
return [{ ...state, screen: { ...screen, text: [...screen.text].slice(0, -1).join('') } }, NONE];
|
|
378
417
|
if (key === '\r' || key === '\n') {
|
|
379
418
|
const text = screen.text.trim();
|
|
419
|
+
const ask = openAskOf(card);
|
|
420
|
+
if (screen.purpose === 'cant' && ask)
|
|
421
|
+
return [
|
|
422
|
+
{ ...state, screen: { kind: 'list' }, note: '' },
|
|
423
|
+
{
|
|
424
|
+
kind: 'answer',
|
|
425
|
+
card,
|
|
426
|
+
answer: { version: card.version, askId: ask.id, done: false, ...(text ? { text } : {}) },
|
|
427
|
+
words: text ? `Couldn’t: ${text}` : 'Couldn’t',
|
|
428
|
+
},
|
|
429
|
+
];
|
|
380
430
|
if (!text)
|
|
381
431
|
return [{ ...state, note: 'Write something first, or Esc to go back.' }, NONE];
|
|
382
432
|
switch (screen.purpose) {
|
|
433
|
+
case 'cant':
|
|
434
|
+
return said(state, '');
|
|
435
|
+
case 'ask':
|
|
436
|
+
if (!ask)
|
|
437
|
+
return said(state, '');
|
|
438
|
+
return [
|
|
439
|
+
{ ...state, screen: { kind: 'list' }, note: '' },
|
|
440
|
+
{
|
|
441
|
+
kind: 'answer',
|
|
442
|
+
card,
|
|
443
|
+
answer: { version: card.version, askId: ask.id, text },
|
|
444
|
+
words: text,
|
|
445
|
+
},
|
|
446
|
+
];
|
|
383
447
|
case 'reply':
|
|
384
448
|
return [
|
|
385
449
|
{ ...state, screen: { kind: 'list' }, note: '' },
|
|
@@ -508,7 +572,13 @@ export function sentState(state, sent, now) {
|
|
|
508
572
|
: (sent.until ?? now + UNDO_MS);
|
|
509
573
|
return {
|
|
510
574
|
...fresh(state),
|
|
511
|
-
sent: {
|
|
575
|
+
sent: {
|
|
576
|
+
cardId: sent.cardId,
|
|
577
|
+
what: sent.what,
|
|
578
|
+
words: sent.words,
|
|
579
|
+
until,
|
|
580
|
+
...(sent.askId ? { askId: sent.askId } : {}),
|
|
581
|
+
},
|
|
512
582
|
note: '',
|
|
513
583
|
};
|
|
514
584
|
}
|
|
@@ -554,6 +624,9 @@ function tagOf(card, state, now) {
|
|
|
554
624
|
return 'sent';
|
|
555
625
|
if (card.highStakes)
|
|
556
626
|
return 'high stakes';
|
|
627
|
+
const ask = openAskOf(card);
|
|
628
|
+
if (ask)
|
|
629
|
+
return ask.action ? `${ask.name} needs you` : `${ask.name} asks`;
|
|
557
630
|
if (card.turn === 'agent')
|
|
558
631
|
return 'their turn';
|
|
559
632
|
return card.blocking ? 'blocking' : card.urgency;
|
|
@@ -655,28 +728,82 @@ function askLines(card, state, room, now) {
|
|
|
655
728
|
lines.push(...wrap(NOT_HERE, room, 2));
|
|
656
729
|
return lines;
|
|
657
730
|
}
|
|
731
|
+
const possessive = (name) => (/s$/i.test(name) ? `${name}’` : `${name}’s`);
|
|
732
|
+
function askedLines(card, ask, room) {
|
|
733
|
+
const fit = (text) => cleanValue(text, room);
|
|
734
|
+
const helper = ask.from === 'helper';
|
|
735
|
+
const lines = [
|
|
736
|
+
BOLD(fit(ask.action
|
|
737
|
+
? `${ask.name} needs you to:`
|
|
738
|
+
: helper
|
|
739
|
+
? `${ask.name} asks:`
|
|
740
|
+
: `${ask.name} has a question for you first:`)),
|
|
741
|
+
BOLD(fit(ask.title)),
|
|
742
|
+
...(ask.summary ? wrap(ask.summary, room, 3) : []),
|
|
743
|
+
...(ask.why ? wrap(ask.why, room, 3) : []),
|
|
744
|
+
];
|
|
745
|
+
if (ask.action) {
|
|
746
|
+
for (const [index, step] of ask.action.steps.entries()) {
|
|
747
|
+
const each = typeof step === 'string' ? { text: step } : step;
|
|
748
|
+
lines.push(fit(`${index + 1}. ${each.text}`));
|
|
749
|
+
if (each.command)
|
|
750
|
+
lines.push(fit(` $ ${each.command}`));
|
|
751
|
+
}
|
|
752
|
+
if (ask.action.where)
|
|
753
|
+
lines.push(DIM(fit(`Where: ${ask.action.where}`)));
|
|
754
|
+
if (ask.action.done)
|
|
755
|
+
lines.push(...wrap(`You’ll know it worked: ${ask.action.done}`, room, 2));
|
|
756
|
+
}
|
|
757
|
+
for (const [index, option] of (ask.options ?? []).slice(0, KEYS_MAX).entries()) {
|
|
758
|
+
const star = ask.recommendedIds?.includes(option.id) ? '★ ' : '';
|
|
759
|
+
lines.push(fit(`${index + 1} ${star}${option.label}${option.detail ? ` · ${option.detail}` : ''}`));
|
|
760
|
+
}
|
|
761
|
+
if (helper) {
|
|
762
|
+
lines.push(DIM(fit(`${askerName(card)} asked: ${card.title}`)));
|
|
763
|
+
if (card.delegation?.resumes?.length)
|
|
764
|
+
lines.push(DIM(fit(`${ask.name} handed it back, then picked it back up.`)));
|
|
765
|
+
lines.push(...wrap(`Your answer goes to ${ask.name}.`, room, 2));
|
|
766
|
+
}
|
|
767
|
+
if (ask.highStakes)
|
|
768
|
+
lines.push(...wrap(HIGH_STAKES, room, 2));
|
|
769
|
+
else if (!card.actions.includes('answer'))
|
|
770
|
+
lines.push(...wrap(NOT_HERE, room, 2));
|
|
771
|
+
return lines;
|
|
772
|
+
}
|
|
658
773
|
function sendToLines(card, sendTo, room) {
|
|
659
774
|
if (!asksAgain(sendTo))
|
|
660
775
|
return wrap(toTeammate(card), room, 2);
|
|
661
776
|
const name = sendTo.name;
|
|
662
777
|
const helped = sendTo.helped;
|
|
663
778
|
const on = helped && dayOf(helped.at) ? ` on ${dayOf(helped.at)}` : '';
|
|
779
|
+
const theirs = Boolean(helped?.theirs && !helped.answered);
|
|
664
780
|
const before = helped
|
|
665
781
|
? helped.answered
|
|
666
782
|
? `${name} helped with “${helped.title}”${on}.`
|
|
667
|
-
:
|
|
783
|
+
: theirs
|
|
784
|
+
? `${askerName(card)} worked on ${possessive(name)} “${helped.title}”${on}.`
|
|
785
|
+
: `You handed ${name} “${helped.title}”${on}.`
|
|
668
786
|
: null;
|
|
669
787
|
const goes = sendTo.mode === 'freely'
|
|
670
788
|
? `${name}’s answer goes straight to ${askerName(card)}.`
|
|
671
789
|
: `${name}’s answer comes back to you first.`;
|
|
672
790
|
const yesHere = Boolean(sendTo.to) && card.actions.includes('delegate');
|
|
673
791
|
return [
|
|
674
|
-
BOLD(cleanValue(`Ask ${name} again?`, room)),
|
|
792
|
+
BOLD(cleanValue(theirs ? `Ask ${name}?` : `Ask ${name} again?`, room)),
|
|
675
793
|
...(before ? wrap(before, room, 2) : []),
|
|
676
794
|
...wrap(goes, room, 2),
|
|
677
795
|
...(yesHere || card.highStakes ? [] : wrap(SAY_YES_THERE, room, 2)),
|
|
678
796
|
];
|
|
679
797
|
}
|
|
798
|
+
function askKeys(card, ask) {
|
|
799
|
+
if (ask.highStakes || !card.actions.includes('answer'))
|
|
800
|
+
return [];
|
|
801
|
+
if (ask.action)
|
|
802
|
+
return ['y done', 'n I can’t'];
|
|
803
|
+
if (ask.options?.length)
|
|
804
|
+
return [`1–${Math.min(KEYS_MAX, ask.options.length)} answer`];
|
|
805
|
+
return ['Enter write'];
|
|
806
|
+
}
|
|
680
807
|
function sendToKeys(card, sendTo) {
|
|
681
808
|
if (!asksAgain(sendTo))
|
|
682
809
|
return [];
|
|
@@ -752,8 +879,11 @@ export function keysLine(state, now) {
|
|
|
752
879
|
const busy = state.sent?.cardId === card.id && now < state.sent.until;
|
|
753
880
|
if (!card.highStakes && !busy) {
|
|
754
881
|
const sendTo = sendToOf(card);
|
|
882
|
+
const ask = openAskOf(card);
|
|
755
883
|
if (sendTo)
|
|
756
884
|
keys.push(...sendToKeys(card, sendTo));
|
|
885
|
+
else if (ask)
|
|
886
|
+
keys.push(...askKeys(card, ask));
|
|
757
887
|
else if (answersHere(card))
|
|
758
888
|
keys.push(...answerKeys(card, state));
|
|
759
889
|
if (card.actions.includes('reply'))
|
|
@@ -797,9 +927,11 @@ export function queueLines(state, width, height, now) {
|
|
|
797
927
|
? `To ${askerName(card)}: `
|
|
798
928
|
: screen.purpose === 'failed'
|
|
799
929
|
? `What happened at step ${screen.step ?? 1}? `
|
|
800
|
-
: screen.purpose === '
|
|
801
|
-
? '
|
|
802
|
-
:
|
|
930
|
+
: screen.purpose === 'cant'
|
|
931
|
+
? 'I can’t, because (or just Enter): '
|
|
932
|
+
: screen.purpose === 'ask'
|
|
933
|
+
? `To ${openAskOf(card)?.name ?? askerName(card)}: `
|
|
934
|
+
: 'Your answer: ';
|
|
803
935
|
const typed = [...screen.text];
|
|
804
936
|
const shown = typed.slice(Math.max(0, typed.length - (room - label.length - 1))).join('');
|
|
805
937
|
foot.push(`${label}${shown}▏`);
|
|
@@ -833,8 +965,9 @@ export function queueLines(state, width, height, now) {
|
|
|
833
965
|
if (!chosen)
|
|
834
966
|
return [first];
|
|
835
967
|
const pane = state.panes[each.id];
|
|
968
|
+
const ask = openAskOf(each);
|
|
836
969
|
const where = [
|
|
837
|
-
askerOf(each),
|
|
970
|
+
ask?.from === 'helper' ? `${askerOf(each)} → ${ask.name}` : askerOf(each),
|
|
838
971
|
each.area.name,
|
|
839
972
|
...(each.asker.machine && each.asker.machine.name !== state.machine
|
|
840
973
|
? [each.asker.machine.name]
|
|
@@ -845,8 +978,9 @@ export function queueLines(state, width, height, now) {
|
|
|
845
978
|
return [
|
|
846
979
|
INVERSE(first),
|
|
847
980
|
` ${DIM(fit(where, inner))}`,
|
|
848
|
-
...
|
|
849
|
-
|
|
981
|
+
...(ask
|
|
982
|
+
? askedLines(each, ask, inner)
|
|
983
|
+
: [...wrap(each.summary, inner, 3), ...askLines(each, state, inner, now)]).map((line) => ` ${line}`),
|
|
850
984
|
];
|
|
851
985
|
});
|
|
852
986
|
const space = Math.max(4, height - head.length - foot.length - 2);
|
package/dist/herdr/queue.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { appClient, readAppSignIn } from "../app-login.js";
|
|
2
2
|
import { herdrServer } from "../herdr.js";
|
|
3
|
-
import { ApiError, SignedOutError } from "../sdk/index.js";
|
|
3
|
+
import { ApiError, SignedOutError, } from "../sdk/index.js";
|
|
4
4
|
import { askerOf, emptyQueue, HIGH_STAKES, queueKey, queueLines, sentState, targetsFor, UNDO_MS, } from "./answer.js";
|
|
5
5
|
import { idsOf, readSnapshot } from "./panes.js";
|
|
6
6
|
import { markActive } from "./presence.js";
|
|
@@ -37,6 +37,13 @@ export function failureWords(error) {
|
|
|
37
37
|
return error.message || `Pending You couldn’t do that (${error.code}).`;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
+
export function queueCards(pending, delegated) {
|
|
41
|
+
const asked = delegated.cards.filter((card) => card.ask && !card.ask.answered);
|
|
42
|
+
return {
|
|
43
|
+
cards: [...asked, ...pending.cards.filter((card) => !asked.some((one) => one.id === card.id))],
|
|
44
|
+
counts: { ...pending.counts, pending: pending.counts.pending + asked.length },
|
|
45
|
+
};
|
|
46
|
+
}
|
|
40
47
|
export function panesOf(cards, snapshot, assistants, server) {
|
|
41
48
|
const panes = {};
|
|
42
49
|
if (!snapshot)
|
|
@@ -225,9 +232,13 @@ export async function queuePopup(io, place, options) {
|
|
|
225
232
|
if (!client || ended)
|
|
226
233
|
return;
|
|
227
234
|
try {
|
|
228
|
-
const page = await
|
|
235
|
+
const [page, handed] = await Promise.all([
|
|
236
|
+
client.cards.list({ status: 'pending', limit: 50, whole: 0 }),
|
|
237
|
+
client.cards.list({ status: 'delegated', limit: 50, whole: 0 }),
|
|
238
|
+
]);
|
|
229
239
|
const keep = state.cards[state.selected]?.id;
|
|
230
|
-
|
|
240
|
+
const listed = queueCards(page, handed);
|
|
241
|
+
let cards = listed.cards;
|
|
231
242
|
const sent = state.sent;
|
|
232
243
|
if (sent && io.now() < sent.until && !cards.some((card) => card.id === sent.cardId)) {
|
|
233
244
|
const held = state.cards.find((card) => card.id === sent.cardId);
|
|
@@ -239,7 +250,7 @@ export async function queuePopup(io, place, options) {
|
|
|
239
250
|
state = {
|
|
240
251
|
...state,
|
|
241
252
|
cards,
|
|
242
|
-
counts:
|
|
253
|
+
counts: listed.counts,
|
|
243
254
|
selected: at >= 0 ? at : Math.max(0, Math.min(state.selected, cards.length - 1)),
|
|
244
255
|
...(moved
|
|
245
256
|
? { screen: { kind: 'list' }, chosen: [], answers: {}, question: 0 }
|
|
@@ -352,7 +363,13 @@ export async function queuePopup(io, place, options) {
|
|
|
352
363
|
}
|
|
353
364
|
try {
|
|
354
365
|
const done = await client.cards.answer(effect.card.id, effect.answer);
|
|
355
|
-
state = sentState(state, {
|
|
366
|
+
state = sentState(state, {
|
|
367
|
+
cardId: effect.card.id,
|
|
368
|
+
what,
|
|
369
|
+
words: effect.words,
|
|
370
|
+
until: done.undoUntil,
|
|
371
|
+
...(effect.answer.askId ? { askId: effect.answer.askId } : {}),
|
|
372
|
+
}, io.now());
|
|
356
373
|
}
|
|
357
374
|
catch (error) {
|
|
358
375
|
fail(error);
|
|
@@ -367,8 +384,9 @@ export async function queuePopup(io, place, options) {
|
|
|
367
384
|
}
|
|
368
385
|
try {
|
|
369
386
|
const { cardId, what } = effect.sent;
|
|
387
|
+
const { askId } = effect.sent;
|
|
370
388
|
if (what === 'answer' || what === 'not_sent')
|
|
371
|
-
await client.cards.undo(cardId);
|
|
389
|
+
await client.cards.undo(cardId, askId ? { askId } : {});
|
|
372
390
|
else if (what === 'later')
|
|
373
391
|
await client.cards.back(cardId);
|
|
374
392
|
else
|
package/dist/main.js
CHANGED
|
@@ -50,6 +50,7 @@ async function run(io, command, hook = { fallback: '' }) {
|
|
|
50
50
|
case 'stopcheck':
|
|
51
51
|
return stopcheck(io, { origin: command.origin, app: command.app ?? DEFAULT_APP });
|
|
52
52
|
case 'posted':
|
|
53
|
+
case 'named':
|
|
53
54
|
return posted(io, { origin: command.origin, app: command.app ?? DEFAULT_APP });
|
|
54
55
|
case 'permission':
|
|
55
56
|
case 'permission-done':
|
package/dist/sdk/client.js
CHANGED
|
@@ -190,7 +190,10 @@ export function createClient(options) {
|
|
|
190
190
|
body: answer,
|
|
191
191
|
...keyed(opts?.idempotencyKey),
|
|
192
192
|
}),
|
|
193
|
-
undo: (id, opts) => request('POST', path(id, 'undo'), {
|
|
193
|
+
undo: (id, opts) => request('POST', path(id, 'undo'), {
|
|
194
|
+
body: opts?.askId ? { askId: opts.askId } : {},
|
|
195
|
+
...keyed(opts?.idempotencyKey),
|
|
196
|
+
}),
|
|
194
197
|
reply: (id, message, opts) => request('POST', path(id, 'messages'), {
|
|
195
198
|
body: typeof message === 'string' ? { body: message } : message,
|
|
196
199
|
...keyed(opts?.idempotencyKey),
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.43.0';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pendingyou-wake",
|
|
3
3
|
"displayName": "Pending You",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.61.0",
|
|
5
5
|
"description": "Wakes Claude Code when your person answers a Pending You card it posted, even while it sits idle. Installed by `npx pendingyou init`.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "RecordPlane",
|
package/mod/README.md
CHANGED
|
@@ -4,4 +4,4 @@ The pendingyou command line’s copy of the Pending You plugin’s wake mod, for
|
|
|
4
4
|
|
|
5
5
|
In each session it learns the cards the session posts to Pending You, checks them through the session’s own Pending You connection, and starts a turn when your person answers, writes back or a fallback comes due, or hands the session a question from another of their assistants (CLI 0.14.0), even while it sits idle. It answers `npx pendingyou hold` itself, so nothing waits in the background, and shows “2 waiting on you” under the prompt, after the plugin’s name. With the Pending You plugin installed too, only one copy acts.
|
|
6
6
|
|
|
7
|
-
Generated from recordplane/pendingyou (packages/claude-plugin/src/wake) with Pending You’s guide 2.
|
|
7
|
+
Generated from recordplane/pendingyou (packages/claude-plugin/src/wake) with Pending You’s guide 2.61.0; send changes there.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pendingyou",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.0",
|
|
4
4
|
"description": "Pending You for your coding agents: one command sets up Claude Code, Codex, OpenCode and Pi to ask you through Pending You and hear your answers, even while they sit idle.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pendingyou",
|