pendingyou 0.41.0 → 0.42.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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.42.0 (2026-11-16)
4
+
5
+ - Fixed: a Codex thread that had only said its name to Pending You (`whoami`, then read its queue) was never woken for a
6
+ question you handed it from another assistant. Only a card call made a thread known on your computer, so the question
7
+ waited for the next session start or message in its folder. Now a thread that calls `whoami`, `list_pending` or
8
+ `get_request` with its name is known by that name and folder, as one that posted a card is, and a question handed to
9
+ 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
10
+ it as one posted, and it makes no card the thread's own.
11
+ - Codex: it comes from a new hook, PostToolUse on those three tools, added last so every hook you trusted stays trusted.
12
+ Codex skips it until you trust it in `/hooks`: `npx pendingyou@latest init` adds it, says "Codex has new Pending You
13
+ hooks (questions handed to a thread)" and waits for you there, and `status` has a "Handed questions" line saying how
14
+ it stands. The card hook is unchanged, so answers to a thread's own cards wake it as before meanwhile.
15
+ - OpenCode and Pi had the same gap: the plugin and the extension now hand those three calls to the command line too,
16
+ when they carry a name. Run `npx pendingyou@latest init` there, then restart OpenCode or `/reload` Pi.
17
+ - Claude Code never had it: its wake mod learns the session's name from any Pending You call, `whoami` included.
18
+
3
19
  ## 0.41.0 (2026-11-03)
4
20
 
5
21
  - 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, which Codex
107
- skips until you trust them once; `init` says so, and the ones you trusted stay trusted. A `pendingyou` server or
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
 
@@ -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 || !thread)
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')
@@ -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
- ].join(' and ');
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
- if (!CARD_TOOL.test(input.tool))
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
- if (!CARD_TOOL.test(event.toolName) || !session)
342
+ const named = NAMED_TOOL.test(event.toolName);
343
+ if (named && !(isObject(event.input) && typeof event.input.name === 'string'))
342
344
  return;
343
- turn ??= `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
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: 'posted', origin, ...app() };
364
+ return { name: first, origin, ...app() };
361
365
  case 'listen': {
362
366
  none();
363
367
  const thread = text('thread');
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/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.41.0';
1
+ export const VERSION = '0.42.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pendingyou",
3
- "version": "0.41.0",
3
+ "version": "0.42.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",