pendingyou 0.42.0 → 0.43.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/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.43.1 (2026-11-16)
4
+
5
+ - Claude Code: when you answer a card while its session sits idle, the turn that wakes it now carries your answer in
6
+ words, and the version to acknowledge it with: "Pending You: your person answered “Which retry plan?” (req_…): “Job
7
+ queue. Try it twice first.” Act on their words, then ack_answer (…) with a one-line outcome." The assistant no longer
8
+ calls `get_request` just to read it, which saves a call of its model for each answer. Only your own answer, when the
9
+ words are all of it: an approved draft or an option that sends, a picture, a helper's or a teammate's answer, a
10
+ high-stakes card, and a reply on one of its answers still say to call `get_request`, as before. The words stay in the
11
+ session: never in the mod's store, a log or a program's arguments. Codex is unchanged (its wake goes through a
12
+ command's arguments, which other programs can read, so it still reads the answer itself).
13
+ - Needs Pending You's server from the same release (get_request's answer in words); against an older one the mod checks
14
+ as before and the wake says to call `get_request`.
15
+ - Run `npx pendingyou@latest init`; nothing to restart: an open Claude Code session reloads the mod by itself.
16
+
17
+ ## 0.43.0 (2026-11-16)
18
+
19
+ - Pending You for Herdr shows an assistant's question on a card it still has, and answers it. When a card you handed
20
+ to one of your assistants needs something from you, it's in the popup with the rest, first: "Maple needs you to:"
21
+ 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
22
+ options or a box for your words. Your answer goes to the question, not the card, which stays with the helper; u takes
23
+ it back for 5 seconds. A question that's high stakes, or carries a draft to send in your name, is answered in Pending
24
+ You (o opens it).
25
+ - "Ask Maple?": introductions go both ways now, so an assistant may ask the one whose card it worked on. The popup says
26
+ "Ask Maple?" for that, and "Wren worked on Maple’s “…”", until Maple has helped it; then "Ask Maple again?" as before.
27
+ - A card its helper handed back and then picked back up says so in the popup.
28
+ - Run `npx pendingyou@latest init`; nothing to restart but Herdr's popup, which picks it up the next time it opens.
29
+
3
30
  ## 0.42.0 (2026-11-16)
4
31
 
5
32
  - Fixed: a Codex thread that had only said its name to Pending You (`whoami`, then read its queue) was never woken for a
@@ -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: { cardId: sent.cardId, what: sent.what, words: sent.words, until },
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
- : `You handed ${name} “${helped.title}”${on}.`
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 === 'question'
801
- ? 'Your answer: '
802
- : 'Your answer: ';
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
- ...wrap(each.summary, inner, 3).map((line) => ` ${line}`),
849
- ...askLines(each, state, inner, now).map((line) => ` ${line}`),
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);
@@ -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 client.cards.list({ status: 'pending', limit: 50, whole: 0 });
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
- let cards = page.cards;
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: page.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, { cardId: effect.card.id, what, words: effect.words, until: done.undoUntil }, io.now());
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
@@ -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'), { body: {}, ...keyed(opts?.idempotencyKey) }),
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.42.0';
1
+ export const VERSION = '0.43.1';
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pendingyou-wake",
3
3
  "displayName": "Pending You",
4
- "version": "2.60.0",
4
+ "version": "2.61.1",
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.60.0; send changes there.
7
+ Generated from recordplane/pendingyou (packages/claude-plugin/src/wake) with Pending You’s guide 2.61.1; send changes there.
@@ -1,7 +1,7 @@
1
1
  // Generated from packages/claude-plugin/src/wake/register.ts in recordplane/pendingyou: edit that, then run
2
2
  // `pnpm --filter @pendingyou/claude-plugin generate`.
3
3
 
4
- import { argumentsOf, blockedNote, CLAIM_PREFIX, CLI_COPY, cardTool, checked, claimedElsewhere, claimHeld, claimLease, cliConfigOf, connectionOf, dueCards, emptyBook, failed, folderOf, graceEnds, HANDED_FAST_MS, HANDED_READS, HERDR_EVERY_MS, HERDR_RUN_MS, handedDue, handedNext, handedOf, handedText, handedView, herdrArgv, herdrPayload, holdOf, holdReply, inHerdr, isFresh, isRefusal, isStale, isWaitingOnYou, KEEP_MS, LISTEN_RUN_MS, LISTENER_KEY, learn, leaseFor, leaseHolder, listenArgv, listened, loadedNote, loadedPath, mayListen, momentOf, originOf, PRESENCE_EVERY_MS, PRESENCE_RUN_MS, presenceArgv, prompted, put, readBook, readClaim, readListener, readSetup, readSignal, readSince, readWait, resultObject, SETUP_AFTER_MS, SETUP_RETRY_MS, SETUP_SERVER, SETUP_TRIES, SIGNAL_KEY, settle, setUpOf, setupNeeded, setupPrompt, stateOf, statusText, TICK_MS, takesHanded, told, toTell, untold, wakeText, } from "./wake.js";
4
+ import { argumentsOf, blockedNote, CLAIM_PREFIX, CLI_COPY, cardTool, checkArgs, checked, claimedElsewhere, claimHeld, claimLease, cliConfigOf, connectionOf, dueCards, emptyBook, failed, folderOf, graceEnds, HANDED_FAST_MS, HANDED_READS, HERDR_EVERY_MS, HERDR_RUN_MS, handedDue, handedNext, handedOf, handedText, handedView, herdrArgv, herdrPayload, holdOf, holdReply, inHerdr, isFresh, isRefusal, isStale, isWaitingOnYou, KEEP_MS, LISTEN_RUN_MS, LISTENER_KEY, learn, leaseFor, leaseHolder, listenArgv, listened, loadedNote, loadedPath, mayListen, momentOf, originOf, PRESENCE_EVERY_MS, PRESENCE_RUN_MS, presenceArgv, prompted, put, readBook, readClaim, readListener, readSetup, readSignal, readSince, readWait, resultObject, SETUP_AFTER_MS, SETUP_RETRY_MS, SETUP_SERVER, SETUP_TRIES, SIGNAL_KEY, settle, setUpOf, setupNeeded, setupPrompt, stateOf, statusText, TICK_MS, takesHanded, told, toTell, untold, wakeText, wordsOf, } from "./wake.js";
5
5
  const UNHEARD = { error: 'unavailable' };
6
6
  const RETRY_MS = 60_000;
7
7
  const live = {
@@ -32,6 +32,8 @@ const live = {
32
32
  herdrTimer: null,
33
33
  waiting: false,
34
34
  signalSeen: 0,
35
+ words: new Map(),
36
+ wordless: new Set(),
35
37
  };
36
38
  const keyOf = (sessionId) => `session:${sessionId}`;
37
39
  function blockedServer() {
@@ -107,23 +109,37 @@ async function allowed($, server, args, tool = 'get_request') {
107
109
  return false;
108
110
  }
109
111
  }
112
+ async function readCard($, card, words) {
113
+ const args = checkArgs(card, words);
114
+ if (!(await allowed($, card.server, args)))
115
+ return { output: null, blocked: true };
116
+ try {
117
+ return {
118
+ output: resultObject(await $.mcp.call(card.server, 'get_request', args)),
119
+ blocked: false,
120
+ };
121
+ }
122
+ catch (error) {
123
+ return { output: null, blocked: isRefusal(error) };
124
+ }
125
+ }
110
126
  async function check($, requestId) {
111
127
  const card = live.book.cards[requestId];
112
128
  if (!card)
113
129
  return 'error';
114
- let output = null;
115
- let blocked = false;
116
- const args = { requestId, ...(card.name ? { name: card.name } : {}) };
117
- if (await allowed($, card.server, args)) {
118
- try {
119
- output = resultObject(await $.mcp.call(card.server, 'get_request', args));
120
- }
121
- catch (error) {
122
- blocked = isRefusal(error);
123
- }
130
+ const words = !live.wordless.has(card.server);
131
+ let read = await readCard($, card, words);
132
+ if (words && !read.blocked && !(read.output && stateOf(read.output))) {
133
+ read = await readCard($, card, false);
134
+ if (read.output && stateOf(read.output))
135
+ live.wordless.add(card.server);
124
136
  }
125
- else
126
- blocked = true;
137
+ const { output, blocked } = read;
138
+ const said = output ? wordsOf(output) : undefined;
139
+ if (said)
140
+ live.words.set(requestId, said);
141
+ else if (output && stateOf(output))
142
+ live.words.delete(requestId);
127
143
  const outcome = output && stateOf(output) ? 'ok' : blocked ? 'blocked' : 'error';
128
144
  if (outcome === 'ok') {
129
145
  live.verified.add(card.server);
@@ -160,7 +176,7 @@ async function deliver($) {
160
176
  return false;
161
177
  live.book = told(live.book, cards);
162
178
  await save($);
163
- $.prompt.submit({ text: wakeText(cards) }).catch(async () => {
179
+ $.prompt.submit({ text: wakeText(cards, live.words) }).catch(async () => {
164
180
  live.book = untold(live.book, cards);
165
181
  live.quietUntil = (await $.clock.now()) + RETRY_MS;
166
182
  await save($).catch(() => { });
@@ -462,6 +478,7 @@ async function switchSession($, e) {
462
478
  live.sessionId = id;
463
479
  live.book = carried ?? readBook(await $.store.get(keyOf(id)));
464
480
  live.noted.clear();
481
+ live.words.clear();
465
482
  freshHanded();
466
483
  await noteLoaded($);
467
484
  if (typeof e.cwd === 'string' && e.cwd)
package/mod/hooks/wake.js CHANGED
@@ -417,9 +417,71 @@ export function settle(book, now) {
417
417
  export const isStale = (book, now) => now - book.updatedAt > KEEP_MS;
418
418
  const titled = (card) => card.title ? `“${clip(card.title)}” (${card.requestId})` : card.requestId;
419
419
  const named = (card) => (card.name ? `name “${card.name}”` : 'your name');
420
- function line(card) {
420
+ export const WORDS_CHARS = 600;
421
+ export function wordsOf(output) {
422
+ const state = stateOf(output);
423
+ if (state?.status !== 'answered' || state.turn !== 'agent' || state.approvedDraft)
424
+ return undefined;
425
+ const given = isObject(output.answer) ? output.answer.words : undefined;
426
+ if (typeof given !== 'string')
427
+ return undefined;
428
+ const flat = given.replace(/\s+/g, ' ').trim().replaceAll('“', '‘').replaceAll('”', '’');
429
+ if (!flat)
430
+ return undefined;
431
+ const chars = [...flat];
432
+ const cut = chars.length > WORDS_CHARS;
433
+ const text = cut
434
+ ? `${chars
435
+ .slice(0, WORDS_CHARS - 1)
436
+ .join('')
437
+ .trimEnd()}…`
438
+ : flat;
439
+ return { moment: momentOf(state), text, cut };
440
+ }
441
+ export const checkArgs = (card, words) => ({
442
+ requestId: card.requestId,
443
+ ...(card.name ? { name: card.name } : {}),
444
+ ...(words ? { words: true } : {}),
445
+ });
446
+ function wordsFor(card, words) {
447
+ const state = card.state;
448
+ if (!words || !state || card.kind === 'answer')
449
+ return undefined;
450
+ if (state.status !== 'answered' || state.approvedDraft)
451
+ return undefined;
452
+ return words.moment === momentOf(state) ? words : undefined;
453
+ }
454
+ function line(card, given) {
421
455
  const state = card.state;
422
456
  const get = `get_request (requestId ${card.requestId}, ${named(card)})`;
457
+ const words = wordsFor(card, given);
458
+ if (words) {
459
+ const ack = `ack_answer (requestId ${card.requestId}, ${named(card)}, expectedVersion ${state.version})`;
460
+ const quoted = `: “${words.text}”`;
461
+ const after = words.cut ? `Cut short: ${get} has all of it.` : undefined;
462
+ const rest = { quoted: true, ...(after ? { after } : {}) };
463
+ if (state.handled === 'self')
464
+ return {
465
+ happened: `your person will handle ${titled(card)} themselves${quoted}`,
466
+ todo: `close it out: take no action on it, leave things as they are and don’t follow up; ${ack} with an outcome like “Left to you”`,
467
+ ...rest,
468
+ };
469
+ if (state.handled === 'leave')
470
+ return {
471
+ happened: `your person won’t do ${titled(card)}${quoted}`,
472
+ todo: `close it out: don’t do it for them and don’t follow up; ${ack} with an outcome like “Skipped”`,
473
+ ...rest,
474
+ };
475
+ return {
476
+ happened: `your person answered ${titled(card)}${quoted}`,
477
+ todo: `act on their words, then ${ack} with a one-line outcome`,
478
+ ...rest,
479
+ };
480
+ }
481
+ const [happened, todo] = plainLine(card, get, state);
482
+ return { happened, todo };
483
+ }
484
+ function plainLine(card, get, state) {
423
485
  if (card.kind === 'answer')
424
486
  return [
425
487
  `your person replied to your answer ${titled(card)}`,
@@ -461,7 +523,7 @@ function line(card) {
461
523
  }
462
524
  }
463
525
  const capital = (sentence) => sentence.charAt(0).toUpperCase() + sentence.slice(1);
464
- export function wakeText(cards) {
526
+ export function wakeText(cards, words) {
465
527
  const asked = cards.some((card) => card.state?.turn === 'agent' &&
466
528
  !isClosed(card.state.status) &&
467
529
  card.state.status !== 'delegated' &&
@@ -469,15 +531,16 @@ export function wakeText(cards) {
469
531
  const reopen = asked
470
532
  ? ' If you need more from them, or the next step, post a new card with follows: that card’s requestId; never reopen.'
471
533
  : '';
534
+ const lineOf = (card) => line(card, words?.get(card.requestId));
472
535
  if (cards.length === 1) {
473
- const [happened, todo] = line(cards[0]);
474
- return `Pending You: ${happened}. ${capital(todo)}.${reopen}`;
536
+ const { happened, todo, quoted, after } = lineOf(cards[0]);
537
+ return `Pending You: ${happened}${quoted ? '' : '.'} ${capital(todo)}.${after ? ` ${after}` : ''}${reopen}`;
475
538
  }
476
539
  return [
477
540
  `Pending You: ${cards.length} of your cards need you.`,
478
541
  ...cards.map((card) => {
479
- const [happened, todo] = line(card);
480
- return `- ${capital(happened)}: ${todo}.`;
542
+ const { happened, todo, after } = lineOf(card);
543
+ return `- ${capital(happened)}: ${todo}.${after ? ` ${after}` : ''}`;
481
544
  }),
482
545
  ...(reopen ? [reopen.trim()] : []),
483
546
  ].join('\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pendingyou",
3
- "version": "0.42.0",
3
+ "version": "0.43.1",
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",