pendingyou 0.44.0 → 0.45.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.
@@ -9,6 +9,7 @@ import { APPROVED_DRAFT_NOTICE, approvesDraft, clip, delegatedOf, handledOf, isC
9
9
  import { chooseThread, goesBy, HANDED_FOR_MS, handedCard, handedMessage, namesAnotherComputer, OPEN_FOR_MS, } from "../handed.js";
10
10
  import { clearHerdr, herdrTarget, isUrgency, PANE_ID, reportCommand, writeHerdr, } from "../herdr.js";
11
11
  import { linkSoon } from "../link.js";
12
+ import { presenceArgs, readSaid } from "../presence.js";
12
13
  import { macName, tailscaleName } from "../remote.js";
13
14
  import { claimHanded, markHanded, momentOf, releaseHanded, wasHanded } from "../state.js";
14
15
  import { findCodex } from "./codex-app.js";
@@ -33,6 +34,7 @@ const CARD_TOOLS = {
33
34
  codex: MCP_CARD_TOOL,
34
35
  opencode: /^([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,
35
36
  pi: MCP_CARD_TOOL,
37
+ antigravity: MCP_CARD_TOOL,
36
38
  };
37
39
  const HELPER_CALLS = new Set(['answer_delegated', 'hand_back']);
38
40
  const MCP_NAMED_TOOL = /^mcp__([A-Za-z0-9_]*pendingyou[A-Za-z0-9_]*)__(whoami|list_pending|get_request)$/i;
@@ -40,6 +42,7 @@ const NAMED_TOOLS = {
40
42
  codex: MCP_NAMED_TOOL,
41
43
  opencode: /^([A-Za-z0-9_-]*pendingyou[A-Za-z0-9_-]*)_(whoami|list_pending|get_request)$/i,
42
44
  pi: MCP_NAMED_TOOL,
45
+ antigravity: MCP_NAMED_TOOL,
43
46
  };
44
47
  export function cardTool(app, name) {
45
48
  const pattern = CARD_TOOLS[app];
@@ -183,7 +186,9 @@ export async function posted(io, options) {
183
186
  const cwd = text(input.cwd, 1000);
184
187
  const now = io.now();
185
188
  const pane = await herdrTarget(io);
189
+ let renamed = null;
186
190
  await change(io, app, (state) => {
191
+ renamed = newName(state.threads[thread], nameOf(args));
187
192
  if (turn && call !== 'cancel_request') {
188
193
  const record = state.turns[turn] ?? { at: now, cards: [] };
189
194
  record.cards = [...record.cards, wordsIn(args)].slice(-10);
@@ -226,6 +231,8 @@ export async function posted(io, options) {
226
231
  });
227
232
  if (pane)
228
233
  io.background(reportCommand(app, { session: thread, at: now }));
234
+ if (renamed)
235
+ await liveByName(io, options, thread, renamed, cwd, now);
229
236
  if (app === 'codex')
230
237
  await keepListening(io, options.origin, thread);
231
238
  return 0;
@@ -250,7 +257,9 @@ async function named(io, options, input, thread) {
250
257
  const cwd = text(input.cwd, 1000);
251
258
  const now = io.now();
252
259
  const pane = await herdrTarget(io);
260
+ let renamed = null;
253
261
  await change(io, app, (state) => {
262
+ renamed = newName(state.threads[thread], name);
254
263
  const known = withName(state.threads[thread] ?? { origin: options.origin, cards: {}, at: now }, name);
255
264
  if (cwd)
256
265
  known.cwd = cwd;
@@ -262,10 +271,34 @@ async function named(io, options, input, thread) {
262
271
  });
263
272
  if (pane)
264
273
  io.background(reportCommand(app, { session: thread, at: now }));
274
+ if (renamed)
275
+ await liveByName(io, options, thread, renamed, cwd, now);
265
276
  if (app === 'codex')
266
277
  await keepListening(io, options.origin, thread);
267
278
  return 0;
268
279
  }
280
+ function newName(thread, name) {
281
+ if (!name)
282
+ return null;
283
+ const now = thread?.names?.at(-1);
284
+ return now && goesBy([now], name) ? null : name;
285
+ }
286
+ async function liveByName(io, options, thread, name, cwd, at) {
287
+ try {
288
+ if (io.platform === 'win32')
289
+ return;
290
+ if ((await readSaid(io, options.app))[thread]?.state !== 'live')
291
+ return;
292
+ io.background(presenceArgs(options.origin, options.app, {
293
+ state: 'live',
294
+ session: thread,
295
+ name,
296
+ ...(cwd ? { cwd } : {}),
297
+ at,
298
+ }));
299
+ }
300
+ catch { }
301
+ }
269
302
  function askedIn(args) {
270
303
  let asked = args.askedFirst;
271
304
  if (typeof asked === 'string')
@@ -711,9 +744,9 @@ export async function listen(io, options) {
711
744
  }
712
745
  const waiting = app === 'codex' && (await hasHeard(io, thread));
713
746
  const record = (await load(io, app)).threads[thread];
714
- const cards = record?.cards ?? {};
715
747
  if (!waiting &&
716
- (!record || (Object.keys(cards).length === 0 && !(takes && mayBeHanded(record, io.now())))))
748
+ (!record ||
749
+ (Object.keys(record.cards).length === 0 && !(takes && mayBeHanded(record, io.now())))))
717
750
  return 0;
718
751
  if (!(await renew(io, app, thread, lease)))
719
752
  return 0;
@@ -743,6 +776,7 @@ export async function listen(io, options) {
743
776
  for (const heard of requests)
744
777
  if (!since || heard.changedAt > since)
745
778
  since = heard.changedAt;
779
+ const cards = (await load(io, app)).threads[thread]?.cards ?? {};
746
780
  const ready = [];
747
781
  const done = [];
748
782
  for (const heard of requests) {
package/dist/apps/ids.js CHANGED
@@ -1,9 +1,10 @@
1
- export const APP_IDS = ['claude-code', 'codex', 'opencode', 'pi'];
1
+ export const APP_IDS = ['claude-code', 'codex', 'opencode', 'pi', 'antigravity'];
2
2
  export const APP_NAMES = {
3
3
  'claude-code': 'Claude Code',
4
4
  codex: 'Codex',
5
5
  opencode: 'OpenCode',
6
6
  pi: 'Pi',
7
+ antigravity: 'Antigravity',
7
8
  };
8
9
  export const DEFAULT_APP = 'claude-code';
9
10
  export const isAppId = (text) => APP_IDS.includes(text);
@@ -1,9 +1,10 @@
1
+ import { antigravity } from "./antigravity.js";
1
2
  import { claudeCode } from "./claude-code.js";
2
3
  import { codex } from "./codex.js";
3
4
  import { opencode } from "./opencode.js";
4
5
  import { pi } from "./pi.js";
5
6
  export { atLeast } from "../mod.js";
6
- export const APPS = [claudeCode, codex, opencode, pi];
7
+ export const APPS = [claudeCode, codex, opencode, pi, antigravity];
7
8
  export function appModule(id) {
8
9
  const found = APPS.find((app) => app.id === id);
9
10
  if (!found)
package/dist/args.js CHANGED
@@ -682,7 +682,7 @@ function appCommandOf(origin, positional, flags, machine, device) {
682
682
  browser: !flags.has('no-browser'),
683
683
  };
684
684
  }
685
- export const USAGE = `pendingyou: Pending You for your coding agents (Claude Code, Codex, OpenCode and Pi)
685
+ export const USAGE = `pendingyou: Pending You for your coding agents (Claude Code, Codex, OpenCode, Pi and Antigravity)
686
686
 
687
687
  npx -y pendingyou@latest init
688
688
  Set up every agent on this computer: its MCP server, signed in through
@@ -691,10 +691,13 @@ export const USAGE = `pendingyou: Pending You for your coding agents (Claude Cod
691
691
  connects them all: your browser opens on Pending You, or over SSH you
692
692
  approve a code on your phone. Claude Code 2.1.287 or later also gets the
693
693
  wake mod; Codex is woken by codex queue; OpenCode gets a plugin and Pi
694
- an extension that do all of that. --app limits it to some
694
+ an extension that do all of that. --app limits it to some.
695
+ Antigravity is set up only when named (--app antigravity), as a
696
+ first version to try: a plugin, and, if you say yes, its OK to run
697
+ Pending You's tools and hold without asking
695
698
  npx pendingyou hold <req_…> Wait in the background until the answer to a request is ready,
696
- print it, and exit (which wakes Claude Code); with the wake mod,
697
- the mod answers it and nothing runs
699
+ print it, and exit (which wakes Claude Code, or Antigravity); with
700
+ the wake mod, the mod answers it and nothing runs
698
701
  npx pendingyou status What's set up for each agent, and whether it hears answers right away
699
702
  npx pendingyou login [--app <app>] | logout
700
703
  Sign an agent in again (Claude Code's when none is named), or out
package/dist/asked.js CHANGED
@@ -40,7 +40,7 @@ function spoken(text) {
40
40
  return kept.join('\n');
41
41
  }
42
42
  const FILLER = /^(?:(?:pending\s*(?:you|new|view)|hey|hi|hello|yo|ok(?:ay)?|so|um+|uh+|well|alright|all right|right|oh|and|also|now|please|quick question)\b[\s,.:;!?-]*)+/i;
43
- const ASSISTANT = /^(?:claude|codex|opencode|pi|cursor|grok|chatgpt|gemini)\b[\s,.:;!-]*/i;
43
+ const ASSISTANT = /^(?:claude|codex|opencode|pi|cursor|grok|chatgpt|gemini|antigravity)\b[\s,.:;!-]*/i;
44
44
  const NAMED = /^[A-Z][\p{L}’'-]*,\s+/u;
45
45
  function opening(sentence) {
46
46
  let text = sentence.trim();
@@ -1,4 +1,5 @@
1
1
  import { join } from 'node:path';
2
+ import { antigravityServerUrl } from "./apps/antigravity.js";
2
3
  import { codexServer } from "./apps/codex.js";
3
4
  import { DEFAULT_APP } from "./apps/ids.js";
4
5
  import { opencodeServer } from "./apps/opencode.js";
@@ -75,7 +76,9 @@ export async function environmentWarning(io, folder, origin, app = DEFAULT_APP)
75
76
  ? await opencodeServer(io).then((url) => (url ? { url, scope: 'user' } : null))
76
77
  : app === 'pi'
77
78
  ? await piServerUrl(io).then((url) => (url ? { url, scope: 'user' } : null))
78
- : await serverForFolder(io, folder);
79
+ : app === 'antigravity'
80
+ ? await antigravityServerUrl(io).then((url) => (url ? { url, scope: 'user' } : null))
81
+ : await serverForFolder(io, folder);
79
82
  return differs(server, origin) ? mismatchLine(server, origin) : null;
80
83
  }
81
84
  catch {
package/dist/herdr.js CHANGED
@@ -27,6 +27,7 @@ export const HERDR_AGENTS = {
27
27
  codex: 'codex',
28
28
  opencode: 'opencode',
29
29
  pi: 'pi',
30
+ antigravity: 'antigravity_cli',
30
31
  };
31
32
  export const URGENCIES = ['now', 'today', 'whenever'];
32
33
  export const PRESSING = ['blocking', ...URGENCIES];
package/dist/hold.js CHANGED
@@ -1,10 +1,12 @@
1
1
  import { getJson, SignInNeeded, Unavailable } from "./api.js";
2
- import { DEFAULT_APP } from "./apps/ids.js";
2
+ import { APP_NAMES, DEFAULT_APP } from "./apps/ids.js";
3
3
  import { readPiManifest } from "./apps/pi.js";
4
4
  import { DEFAULT_ORIGIN, DEFAULT_TIMEOUT_MS } from "./args.js";
5
5
  import { readCredential } from "./credentials.js";
6
+ import { configDir, readJson } from "./files.js";
6
7
  import { describe } from "./format.js";
7
8
  import { linkSoon } from "./link.js";
9
+ import { agentProcess } from "./presence.js";
8
10
  import { markHanded, momentOf } from "./state.js";
9
11
  export const LONG_POLL_SECONDS = 25;
10
12
  const PATIENT_AFTER_MS = 30 * 60 * 1000;
@@ -37,12 +39,25 @@ export const inPi = (env) => env.AI_AGENT === 'pi' || (!env.AI_AGENT && env.PI_C
37
39
  export const piHoldReply = (requestId, extension) => extension
38
40
  ? `Pending You: no hold is needed in Pi, and Pi’s shell would wait on it. Pending You’s extension wakes this session when your person answers ${requestId}, writes to you on it, or its fallback runs, even while it’s idle. Nothing is running in the background: keep working, or end your turn.`
39
41
  : `Pending You: Pi’s shell waits for a command to end, so a hold would stop this session for hours. While you’re blocked on ${requestId}, call get_request every pollAfterSeconds; otherwise list_pending at breakpoints.`;
42
+ const AGY_DEPTH = 10;
43
+ export async function holdApp(io) {
44
+ try {
45
+ const manifest = await readJson(`${configDir(io)}/antigravity.json`).catch(() => null);
46
+ if (manifest === null)
47
+ return DEFAULT_APP;
48
+ return (await agentProcess(io, 'antigravity', AGY_DEPTH)) ? 'antigravity' : DEFAULT_APP;
49
+ }
50
+ catch {
51
+ return DEFAULT_APP;
52
+ }
53
+ }
40
54
  export async function hold(io, options) {
41
55
  const { origin, requestId } = options;
42
56
  if (inPi(io.env)) {
43
57
  io.out(`${piHoldReply(requestId, (await readPiManifest(io)) !== null)}\n`);
44
58
  return 0;
45
59
  }
60
+ const app = await holdApp(io);
46
61
  const again = holdCommand(requestId, origin, options.timeoutMs);
47
62
  const started = io.now();
48
63
  const deadline = started + options.timeoutMs;
@@ -52,11 +67,11 @@ export async function hold(io, options) {
52
67
  ended
53
68
  ? `Pending You: this computer’s pendingyou sign-in has ended, so I can’t wait on ${requestId}.`
54
69
  : `Pending You: the pendingyou command isn’t signed in on this computer, so I can’t wait on ${requestId}.`,
55
- 'Ask your person to run `npx pendingyou login`. Until then, call get_request at breakpoints.',
70
+ `Ask your person to run \`npx pendingyou login${app === DEFAULT_APP ? '' : ` --app ${app}`}\`. Until then, call get_request at breakpoints.`,
56
71
  ]);
57
72
  return 1;
58
73
  };
59
- if (!(await readCredential(io, origin)))
74
+ if (!(await readCredential(io, origin, app)))
60
75
  return signInNeeded(false);
61
76
  await linkSoon(io, origin);
62
77
  let failures = 0;
@@ -79,7 +94,7 @@ export async function hold(io, options) {
79
94
  const wait = Math.max(1, Math.min(LONG_POLL_SECONDS, Math.floor(left / 1000)));
80
95
  let result;
81
96
  try {
82
- result = await getJson(io, origin, `/mcp/cli/requests/${encodeURIComponent(requestId)}?wait=${wait}&source=${DEFAULT_APP}`, (wait + 20) * 1000, io.signal);
97
+ result = await getJson(io, origin, `/mcp/cli/requests/${encodeURIComponent(requestId)}?wait=${wait}&source=${app}`, (wait + 20) * 1000, io.signal, { app });
83
98
  }
84
99
  catch (error) {
85
100
  if (io.signal.aborted)
@@ -96,8 +111,8 @@ export async function hold(io, options) {
96
111
  failures = 0;
97
112
  if (result.status === 404) {
98
113
  print([
99
- `Pending You: can’t find ${requestId} among your person’s Claude Code questions on ${origin}.`,
100
- 'Check the id from post_request. If this Claude Code signed in to Pending You as someone else, use get_request instead.',
114
+ `Pending You: can’t find ${requestId} among your person’s ${APP_NAMES[app]} questions on ${origin}.`,
115
+ `Check the id from post_request. If this ${APP_NAMES[app]} signed in to Pending You as someone else, use get_request instead.`,
101
116
  ]);
102
117
  return 1;
103
118
  }
package/dist/init.js CHANGED
@@ -1,4 +1,4 @@
1
- import { APP_IDS, DEFAULT_APP, namesOf } from "./apps/ids.js";
1
+ import { DEFAULT_APP, namesOf } from "./apps/ids.js";
2
2
  import { opencodePluginPath, pluginCopyVersion } from "./apps/opencode.js";
3
3
  import { APPS, appModule, atLeast } from "./apps/registry.js";
4
4
  import { bridgeCommand, removeBridge, writeBridge } from "./bridge.js";
@@ -21,7 +21,7 @@ async function findApps(io, wanted) {
21
21
  const found = [];
22
22
  const problems = [];
23
23
  for (const app of APPS) {
24
- if (wanted && !wanted.includes(app.id))
24
+ if (wanted ? !wanted.includes(app.id) : app.optIn)
25
25
  continue;
26
26
  const detected = await app.detect(io);
27
27
  if (!detected) {
@@ -123,7 +123,9 @@ export async function init(io, options) {
123
123
  if (found.length === 0) {
124
124
  for (const problem of problems)
125
125
  io.out(`${problem}\n`);
126
- io.out(`Didn’t find ${namesOf([...APP_IDS], 'or')} on this computer’s PATH. Install one, then run: npx -y pendingyou@latest init${flag}\n`);
126
+ io.out(`Didn’t find ${namesOf(APPS.filter((app) => !app.optIn).map((app) => app.id), 'or')} on this computer’s PATH. Install one, then run: npx -y pendingyou@latest init${flag}\n`);
127
+ for (const app of APPS.filter((each) => each.optIn))
128
+ io.out(`${app.name} is set up only when you name it: npx -y pendingyou@latest init --app ${app.id}${flag}\n`);
127
129
  return 1;
128
130
  }
129
131
  const versions = found.map(({ app, detected }) => `${app.name} ${detected.version}${detected.from ? ` (${detected.from})` : ''}`);
@@ -235,7 +237,7 @@ async function coveredApps(io, wanted) {
235
237
  return installed;
236
238
  const found = [];
237
239
  for (const app of APPS)
238
- if (await app.detect(io))
240
+ if (!app.optIn && (await app.detect(io)))
239
241
  found.push(app);
240
242
  return found.length ? found : [appModule(DEFAULT_APP)];
241
243
  }
package/dist/main.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { HOOK_DEADLINE_MS, refreshInBackground, SignInNeeded, Unavailable } from "./api.js";
2
+ import { antigravityHook, isAgyHook } from "./apps/antigravity-hooks.js";
2
3
  import { setAnswerWait } from "./apps/codex.js";
3
4
  import { heardHook } from "./apps/codex-midturn.js";
4
5
  import { listen, listenHanded, posted } from "./apps/codex-wake.js";
@@ -177,6 +178,7 @@ export const isHook = (argv) => {
177
178
  return false;
178
179
  return HOOK_COMMANDS.has(command);
179
180
  };
181
+ const forAntigravity = (argv) => argv.some((arg, index) => arg === '--app=antigravity' || (arg === '--app' && argv[index + 1] === 'antigravity'));
180
182
  export async function main(argv, io) {
181
183
  const hook = isHook(argv);
182
184
  let command;
@@ -187,6 +189,8 @@ export async function main(argv, io) {
187
189
  if (hook) {
188
190
  const message = error instanceof UsageError ? error.message : 'Something went wrong.';
189
191
  io.err(`pendingyou: ${message} Skipped this hook; run npx pendingyou@latest init to repair it.\n`);
192
+ if (forAntigravity(argv))
193
+ io.out('{}\n');
190
194
  return 0;
191
195
  }
192
196
  if (error instanceof UsageError) {
@@ -198,6 +202,8 @@ export async function main(argv, io) {
198
202
  if (hook && !HOOK_COMMANDS.has(command.name))
199
203
  return 0;
200
204
  try {
205
+ if (hook && 'app' in command && command.app === 'antigravity' && isAgyHook(command.name))
206
+ return await antigravityHook(io, command.name, command.origin, (agyIo) => runHook(agyIo, command));
201
207
  return hook ? await runHook(io, command) : await run(io, command);
202
208
  }
203
209
  catch (error) {
package/dist/pickup.js CHANGED
@@ -71,6 +71,7 @@ async function hookInput(io) {
71
71
  transcript: string(input.transcript_path),
72
72
  prompt: string(input.prompt),
73
73
  turn: string(input.turn_id),
74
+ woken: input.woken === true,
74
75
  };
75
76
  }
76
77
  async function takesHanded(io, context, heard, delegated) {
@@ -193,8 +194,8 @@ export async function pickup(io, options, hook = { fallback: '' }) {
193
194
  : (known ??
194
195
  (await readSaid(io, app).catch(() => ({})))[input.session])?.fork
195
196
  : undefined;
196
- if (app === 'codex')
197
- await keepPresent(io, origin, input.session, input.given ? cwd : null);
197
+ if (app === 'codex' || app === 'antigravity')
198
+ await keepPresent(io, origin, input.session, input.given ? cwd : null, app);
198
199
  else if (app === DEFAULT_APP && (mode === 'pickup' || input.session))
199
200
  await announce(io, origin, app, {
200
201
  state: 'live',
@@ -242,7 +243,7 @@ export async function pickup(io, options, hook = { fallback: '' }) {
242
243
  transcript: input.transcript,
243
244
  name: named ?? null,
244
245
  });
245
- if (mode === 'handoff' && readsAnswers(asker, input.prompt, io.now()))
246
+ if (mode === 'handoff' && !input.woken && readsAnswers(asker, input.prompt, io.now()))
246
247
  reading = readHere(io, origin, app, cwd, asker);
247
248
  const query = new URLSearchParams([
248
249
  ...folderForms(cwd, io.home).map((form) => ['cwd', form]),
@@ -320,7 +321,7 @@ export async function pickup(io, options, hook = { fallback: '' }) {
320
321
  await releaseHanded(io, origin, heard.requestId, momentOf(heard)).catch(() => { });
321
322
  return 0;
322
323
  }
323
- const again = (id) => app === DEFAULT_APP
324
+ const again = (id) => app === DEFAULT_APP || app === 'antigravity'
324
325
  ? `run \`${holdCommand(id, origin)}\` in the background`
325
326
  : `carry on: Pending You wakes this ${app === 'codex' ? 'thread' : 'session'} when they write back`;
326
327
  io.out(`${[
package/dist/presence.js CHANGED
@@ -21,6 +21,11 @@ const REOPEN_PAUSE_MS = 1500;
21
21
  const FORGET_MS = 2 * 24 * 60 * 60_000;
22
22
  const SESSION = /^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/;
23
23
  const ANCESTORS = 6;
24
+ export const AGENT_PROGRAMS = {
25
+ codex: /^codex/i,
26
+ antigravity: /^agy$/i,
27
+ };
28
+ const isKept = (app) => app === 'codex' || app === 'antigravity';
24
29
  export function presenceCwd(cwd, home) {
25
30
  if (!cwd)
26
31
  return null;
@@ -238,40 +243,41 @@ async function processOf(io, pid) {
238
243
  const match = /^\s*(\d+)\s+(.+?)\s*$/m.exec(result.stdout);
239
244
  return match ? { ppid: Number(match[1]), command: match[2] } : null;
240
245
  }
241
- const isCodex = (command) => /^codex/i.test(command.split('/').at(-1) ?? '');
242
- export async function codexProcess(io) {
246
+ const isProgram = (app, command) => AGENT_PROGRAMS[app].test(command.split('/').at(-1) ?? '');
247
+ export async function agentProcess(io, app, depth = ANCESTORS) {
243
248
  let pid = io.ppid;
244
- for (let step = 0; step < ANCESTORS && pid && pid > 1; step++) {
249
+ for (let step = 0; step < depth && pid && pid > 1; step++) {
245
250
  const found = await processOf(io, pid);
246
251
  if (!found)
247
252
  return null;
248
- if (isCodex(found.command))
253
+ if (isProgram(app, found.command))
249
254
  return pid;
250
255
  pid = found.ppid;
251
256
  }
252
257
  return null;
253
258
  }
254
- async function stillRuns(io, pid) {
259
+ export const codexProcess = (io) => agentProcess(io, 'codex');
260
+ async function stillRuns(io, app, pid) {
255
261
  const result = await io.run('ps', ['-o', 'comm=', '-p', String(pid)], 2000);
256
- return result.code === 0 && isCodex(result.stdout.trim());
262
+ return result.code === 0 && isProgram(app, result.stdout.trim());
257
263
  }
258
264
  async function keeping(io, app, session) {
259
265
  return stat(leasePath(io, app, session)).then((info) => Date.now() - info.mtimeMs < LEASE_STALE_MS, () => false);
260
266
  }
261
- export async function keepPresent(io, origin, session, cwd) {
267
+ export async function keepPresent(io, origin, session, cwd, app = 'codex') {
262
268
  try {
263
269
  if (!session || !SESSION.test(session) || io.platform === 'win32')
264
270
  return;
265
- if (!(await connected(io, origin, 'codex')) && !(await herdrTarget(io)))
271
+ if (!(await connected(io, origin, app)) && !(await herdrTarget(io)))
266
272
  return;
267
- if (await keeping(io, 'codex', session))
273
+ if (await keeping(io, app, session))
268
274
  return;
269
- const pid = await codexProcess(io);
275
+ const pid = await agentProcess(io, app);
270
276
  if (!pid) {
271
- await announce(io, origin, 'codex', { state: 'live', session, cwd, again: true });
277
+ await announce(io, origin, app, { state: 'live', session, cwd, again: true });
272
278
  return;
273
279
  }
274
- io.background(presenceArgs(origin, 'codex', { state: 'live', session, cwd, keep: true, pid, at: io.now() }));
280
+ io.background(presenceArgs(origin, app, { state: 'live', session, cwd, keep: true, pid, at: io.now() }));
275
281
  }
276
282
  catch { }
277
283
  }
@@ -321,7 +327,7 @@ async function keep(io, command) {
321
327
  taken = held === 'taken';
322
328
  return;
323
329
  }
324
- if (!(await stillRuns(io, pid))) {
330
+ if (!(await stillRuns(io, app, pid))) {
325
331
  if (speaking)
326
332
  await sendOnce(io, { ...command, state: 'closed', at: io.now() });
327
333
  return;
@@ -331,7 +337,7 @@ async function keep(io, command) {
331
337
  const outcome = await sendOnce(io, { ...command, state: 'live', at: io.now() });
332
338
  if (outcome && GIVE_UP.has(outcome))
333
339
  speaking = false;
334
- else
340
+ else if (app === 'codex')
335
341
  await keepListening(io, command.origin, session);
336
342
  }
337
343
  if (badges)
@@ -383,8 +389,9 @@ export async function presence(io, command) {
383
389
  const { session } = command;
384
390
  if (!session || !SESSION.test(session))
385
391
  return 0;
386
- if (command.keep && command.pid && command.app === 'codex' && command.state === 'live') {
387
- await keep(io, { ...command, session, pid: command.pid });
392
+ const { app } = command;
393
+ if (command.keep && command.pid && isKept(app) && command.state === 'live') {
394
+ await keep(io, { ...command, app, session, pid: command.pid });
388
395
  return 0;
389
396
  }
390
397
  if (command.app !== 'claude-code')
package/dist/setup.js CHANGED
@@ -39,7 +39,10 @@ export function setupOf(heard) {
39
39
  };
40
40
  }
41
41
  export function setupCalls(app, stopFirst) {
42
- return `Three calls, nothing to install or approve: 1. whoami with your name.${stopFirst ? ' If it says app.setUp is true, another session did this: stop.' : ''} 2. report_setup with source ${app}, your name, skillSaved true, hears instant, and skillVersion set to whoami’s skill.latest. Its answer has a testAreaId. 3. post_request a short test question in that testAreaId, tell your person it’s on its way, and end your turn: you’re woken when they answer, so don’t ask them to type anything.`;
42
+ const third = app === 'antigravity'
43
+ ? '3. post_request a short test question in that testAreaId, start its hold in the background as your rules say (npx pendingyou hold with its requestId), tell your person it’s on its way, and end your turn: the hold wakes you when they answer, so don’t ask them to type anything.'
44
+ : '3. post_request a short test question in that testAreaId, tell your person it’s on its way, and end your turn: you’re woken when they answer, so don’t ask them to type anything.';
45
+ return `Three calls, nothing to install or approve: 1. whoami with your name.${stopFirst ? ' If it says app.setUp is true, another session did this: stop.' : ''} 2. report_setup with source ${app}, your name, skillSaved true, hears instant, and skillVersion set to whoami’s skill.latest. Its answer has a testAreaId. ${third}`;
43
46
  }
44
47
  export function setupLine(app, heard, setup) {
45
48
  if (setup.verified)
package/dist/shim.js CHANGED
@@ -36,6 +36,8 @@ if [ ! -x "$node" ]; then
36
36
  fi
37
37
  if [ -z "$node" ] || [ ! -r "$cli" ]; then
38
38
  echo "pendingyou: its Node or its copy of pendingyou is gone. Run: npx -y pendingyou@latest init" >&2
39
+ # Antigravity reads a hook's output as a JSON object, always.
40
+ case " $* " in *" --app antigravity "*) echo '{}' ;; esac
39
41
  exit 0
40
42
  fi
41
43
  exec "$node" "$cli" "$@"
package/dist/stopcheck.js CHANGED
@@ -6,7 +6,7 @@ import { markNudged, turnRecord } from "./apps/codex-wake.js";
6
6
  import { APP_NAMES, DEFAULT_APP } from "./apps/ids.js";
7
7
  import { DEFAULT_ORIGIN } from "./args.js";
8
8
  import { asksQuestion, wordsOf } from "./asked.js";
9
- import { asksToTypeHere, cardFits, confirmReason, sessionLink } from "./confirm.js";
9
+ import { asksToTypeHere, cardFits, confirmReason, sessionLink, telling } from "./confirm.js";
10
10
  import { readCredential } from "./credentials.js";
11
11
  import { isHandedWake } from "./format.js";
12
12
  import { isPermissionCard, isPromptApp, sessionName, settlePrompts, subagentsRunning, } from "./permission.js";
@@ -84,11 +84,57 @@ function itemsIn(plain) {
84
84
  }
85
85
  if (STEPS_FOR_THEM.test(plain))
86
86
  return 'steps';
87
- for (const sentence of plain.split(/(?<=[.!?])\s+|\n/))
88
- if (sentence.trim().endsWith('?') && YOU.test(sentence))
89
- return 'question';
90
- return null;
87
+ return questionsIn(plain).length ? 'question' : null;
91
88
  }
89
+ const sentenceEnd = (sentence) => sentence.trim().replace(/[*_\s]+$/, '');
90
+ function lastSentence(plain) {
91
+ let text = plain.trim();
92
+ for (let aside = /\s*\([^()]*\)[\s*_]*$/.exec(text); aside; aside = /\s*\([^()]*\)[\s*_]*$/.exec(text)) {
93
+ const before = text.slice(0, aside.index).trim();
94
+ if (!before)
95
+ break;
96
+ text = before;
97
+ }
98
+ const line = text
99
+ .split('\n')
100
+ .filter((each) => each.trim())
101
+ .at(-1) ?? '';
102
+ return sentenceEnd(line.split(SENTENCE_END).at(-1) ?? '');
103
+ }
104
+ export const endsOnQuestion = (text) => lastSentence(plainText(text)).endsWith('?');
105
+ function questionsIn(plain) {
106
+ const found = plain
107
+ .split(/(?<=[.!?])\s+|\n/)
108
+ .map(sentenceEnd)
109
+ .filter((sentence) => sentence.endsWith('?') && YOU.test(sentence));
110
+ const last = lastSentence(plain);
111
+ return last.endsWith('?') && !found.includes(last) ? [...found, last] : found;
112
+ }
113
+ const ASKING = new Set([
114
+ 'you',
115
+ 'your',
116
+ 'want',
117
+ 'do',
118
+ 'does',
119
+ 'i',
120
+ 'me',
121
+ 'we',
122
+ 'us',
123
+ 'should',
124
+ 'shall',
125
+ 'would',
126
+ 'like',
127
+ 'to',
128
+ 'use',
129
+ ]);
130
+ const tellingOf = (text) => telling(text).filter((word) => !ASKING.has(word));
131
+ export function onCard(question, title) {
132
+ const asked = tellingOf(question);
133
+ const titled = tellingOf(title);
134
+ const within = (part, whole) => part.length >= 2 && part.every((word) => whole.includes(word));
135
+ return within(titled, asked) || within(asked, titled);
136
+ }
137
+ export const questionsOutsideRecaps = (text) => questionsIn(withoutRecaps(plainText(text)));
92
138
  export function itemsForPerson(text) {
93
139
  return itemsIn(plainText(text));
94
140
  }
@@ -334,9 +380,10 @@ function opencodeTurn(input) {
334
380
  const text = final.join('\n').trim();
335
381
  return text ? { text, posted, cards, handed, asked } : null;
336
382
  }
337
- async function openTitles(io, origin, cwd, app, session) {
383
+ export async function openCards(io, origin, cwd, app, session, unlisted = 'unknown') {
338
384
  try {
339
- const name = app === 'claude-code' ? await sessionName(session.transcript ?? undefined) : undefined;
385
+ const name = session.name ??
386
+ (app === 'claude-code' ? await sessionName(session.transcript ?? undefined) : undefined);
340
387
  const query = new URLSearchParams([
341
388
  ...folderForms(cwd, io.home).map((form) => ['cwd', form]),
342
389
  ['limit', '0'],
@@ -345,20 +392,30 @@ async function openTitles(io, origin, cwd, app, session) {
345
392
  ...(await askerParams(io, origin, app, { ...session, name: name ?? null })),
346
393
  ]);
347
394
  const { status, body } = await getJson(io, origin, `/mcp/cli/answers?${query}`, OPEN_TIME_BOX_MS, io.signal, { hook: true, app });
348
- const requests = status === 200 ? body.open?.requests : undefined;
349
- if (!Array.isArray(requests))
395
+ if (status !== 200)
350
396
  return null;
351
- return requests.flatMap((card) => typeof card?.title === 'string' ? [card.title] : []);
397
+ const requests = body.open?.requests;
398
+ if (!Array.isArray(requests))
399
+ return unlisted === 'none' ? [] : null;
400
+ return requests.flatMap((card) => typeof card?.title === 'string'
401
+ ? [
402
+ {
403
+ requestId: typeof card.requestId === 'string' ? card.requestId : null,
404
+ title: card.title,
405
+ },
406
+ ]
407
+ : []);
352
408
  }
353
409
  catch {
354
410
  return null;
355
411
  }
356
412
  }
413
+ const openTitles = async (...args) => (await openCards(...args))?.map((card) => card.title) ?? null;
357
414
  async function turnOf(io, input, app) {
358
415
  const final = typeof input.last_assistant_message === 'string' && input.last_assistant_message.trim()
359
416
  ? input.last_assistant_message
360
417
  : '';
361
- if (app === 'codex' || app === 'pi') {
418
+ if (app === 'codex' || app === 'pi' || app === 'antigravity') {
362
419
  if (typeof input.turn_id !== 'string' || !input.turn_id || !final)
363
420
  return null;
364
421
  const record = await turnRecord(io, input.turn_id, app);
@@ -472,13 +529,25 @@ export async function stopcheck(io, options) {
472
529
  return 0;
473
530
  if (turn.asked && isAnswer(text) && (await seesAnswers(io, app)))
474
531
  return block(ANSWER_REASON);
475
- if (!itemsOutsideRecaps(text))
532
+ const items = itemsOutsideRecaps(text);
533
+ if (!items)
476
534
  return 0;
535
+ let open;
477
536
  if (mentionsCards(text)) {
478
- const open = await openTitles(io, options.origin, cwd, app, session);
537
+ open = await openTitles(io, options.origin, cwd, app, session);
479
538
  if (open === null || open.some((title) => !isPermissionCard(title)))
480
539
  return 0;
481
540
  }
541
+ if (items === 'question') {
542
+ open ??= await openTitles(io, options.origin, cwd, app, session, 'none');
543
+ if (open === null)
544
+ return 0;
545
+ const titles = open;
546
+ const asked = questionsOutsideRecaps(text);
547
+ if (asked.length &&
548
+ asked.every((question) => titles.some((title) => onCard(question, title))))
549
+ return 0;
550
+ }
482
551
  return block(STOP_REASON);
483
552
  }
484
553
  catch {
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.44.0';
1
+ export const VERSION = '0.45.0';
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pendingyou-wake",
3
3
  "displayName": "Pending You",
4
- "version": "2.62.1",
4
+ "version": "2.63.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",