pendingyou 0.40.0 → 0.41.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 +15 -0
- package/README.md +12 -0
- package/dist/app-login.js +3 -1
- package/dist/herdr/command.js +10 -2
- package/dist/herdr/focus.js +157 -0
- package/dist/herdr/watch.js +66 -9
- package/dist/herdr.js +7 -1
- package/dist/pickup.js +3 -0
- package/dist/sdk/client.js +1 -0
- 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,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.41.0 (2026-11-03)
|
|
4
|
+
|
|
5
|
+
- 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
|
|
6
|
+
asks you something there, Pending You keeps its card out of sight while you stay: answer it in the pane and it never
|
|
7
|
+
shows; leave the pane, go 5 minutes without a sign of you in Herdr, or let 30 minutes pass, and it shows as a new
|
|
8
|
+
card. The watcher tells Pending You which pane you're in and your last sign of you there: moving between panes, tabs
|
|
9
|
+
and workspaces, keys in the popup, and each message you send the agent in that pane (its app's next-message hook
|
|
10
|
+
notes the moment, never the words). Herdr can't tell anyone about keys typed in a pane, so those don't count.
|
|
11
|
+
- A held card stays off the pane's badges, so off the sidebar's row, the popup, `next` and the toasts, and comes back
|
|
12
|
+
the moment it shows. Each badge write keeps its pane's cards (the titles the badges already carry) in
|
|
13
|
+
`~/.config/pendingyou/herdr/` so the watcher can write them again.
|
|
14
|
+
- It needs Herdr signed in again (`npx pendingyou app login herdr`, or setup's "Sign Herdr in again now?"): a sign-in
|
|
15
|
+
from before doesn't hold the new `presence:focus`. Setup and doctor say so. With a Pending You that doesn't hold cards
|
|
16
|
+
yet, the watcher is told no and asks again 10 minutes later; nothing else changes.
|
|
17
|
+
|
|
3
18
|
## 0.40.0 (2026-10-28)
|
|
4
19
|
|
|
5
20
|
- Pending You for Herdr answers "Ask Maple again?": when one of your agents asks to send its card to another of your
|
package/README.md
CHANGED
|
@@ -427,6 +427,18 @@ Claude Code). Otherwise Pending You hears "not found", and nothing moves. It onl
|
|
|
427
427
|
never types into one, runs or opens anything, and logs nothing. Setup starts this version's watcher in place of one
|
|
428
428
|
from an older pendingyou, which doesn't listen.
|
|
429
429
|
|
|
430
|
+
### Holding cards while you're in the agent's pane (0.41.0)
|
|
431
|
+
|
|
432
|
+
When the agent in the Herdr pane you're in also asks you something there, Pending You keeps its card out of sight while
|
|
433
|
+
you stay: answer it in the pane and it never shows; leave the pane, go 5 minutes without a sign of you in Herdr, or let
|
|
434
|
+
30 minutes pass, and it shows as a new card. The watcher tells Pending You which pane you're in and your last sign of you
|
|
435
|
+
there once Herdr's sign-in allows it (`presence:focus`, which only Pending You's own apps may hold; a sign-in from before
|
|
436
|
+
0.41.0 doesn't hold it, and setup and doctor say to sign in again). The signs are moving between panes, tabs and
|
|
437
|
+
workspaces, keys in the popup, and each message you send the agent in that pane: its app's next-message hook notes the
|
|
438
|
+
moment in `~/.config/pendingyou/herdr/messages/`, never the words. A held card stays off the pane's badges (the sidebar's
|
|
439
|
+
row, the popup, `next`, the toasts) and comes back the moment it shows. Turn it off in Pending You: Settings ›
|
|
440
|
+
Notifications › In Herdr.
|
|
441
|
+
|
|
430
442
|
## How Claude Code hears your answer
|
|
431
443
|
|
|
432
444
|
**Claude Code 2.1.287 or later: the wake mod.** There's nothing to run. In each session the mod learns the cards
|
package/dist/app-login.js
CHANGED
|
@@ -21,8 +21,9 @@ export const APP_SCOPES = [
|
|
|
21
21
|
'assistants:show',
|
|
22
22
|
'presence:desk',
|
|
23
23
|
];
|
|
24
|
+
export const HERDR_SCOPES = [...APP_SCOPES, 'presence:focus'];
|
|
24
25
|
export const FIRST_PARTY_APPS = {
|
|
25
|
-
herdr: { name: 'Herdr', scopes:
|
|
26
|
+
herdr: { name: 'Herdr', scopes: HERDR_SCOPES },
|
|
26
27
|
};
|
|
27
28
|
export const DEFAULT_SCOPES = ['cards:read'];
|
|
28
29
|
export const APP_NAME = /^[a-z0-9][a-z0-9-]{0,39}$/;
|
|
@@ -57,6 +58,7 @@ const MAY = {
|
|
|
57
58
|
'assistants:read': 'see your assistants',
|
|
58
59
|
'assistants:show': 'bring the assistant that asked to the front when you press Show',
|
|
59
60
|
'presence:desk': 'keep your phone quiet while you use it',
|
|
61
|
+
'presence:focus': 'hold cards from the agent whose pane you’re in until you leave it',
|
|
60
62
|
};
|
|
61
63
|
const listed = (items) => items.length <= 1 ? (items[0] ?? '') : `${items.slice(0, -1).join(', ')} and ${items.at(-1)}`;
|
|
62
64
|
export function reachWords(me) {
|
package/dist/herdr/command.js
CHANGED
|
@@ -160,6 +160,9 @@ async function originHere(io, fallback) {
|
|
|
160
160
|
const line = (mark, text) => `${mark} ${text}\n`;
|
|
161
161
|
const showsHere = (stored) => stored.scopes.includes('assistants:show');
|
|
162
162
|
const signInAgainForShow = (origin) => `Sign Herdr in again to use Show in Herdr: npx pendingyou app login herdr${originArgs(origin)}`;
|
|
163
|
+
const holdsHere = (stored) => stored.scopes.includes('presence:focus');
|
|
164
|
+
const signInAgainForHold = (origin) => `Sign Herdr in again to hold cards while you’re in an agent’s pane: npx pendingyou app login herdr${originArgs(origin)}`;
|
|
165
|
+
export const HOLDING_LINE = 'Holding cards: a card the agent in the pane you’re in also asks you there waits in Pending You until you leave the pane, go 5 minutes without a sign of you in Herdr, or 30 minutes pass (Settings › Notifications › In Herdr).';
|
|
163
166
|
async function startWatcher(io, place) {
|
|
164
167
|
if (!place.socket)
|
|
165
168
|
return;
|
|
@@ -222,9 +225,12 @@ async function signInStep(io, options, ask) {
|
|
|
222
225
|
const stored = await readAppSignIn(io, 'herdr').catch(() => null);
|
|
223
226
|
if (stored) {
|
|
224
227
|
io.out(`${line('✓', `Herdr is signed in to Pending You at ${stored.origin}: its popup (prefix+y) answers your cards with a key.`)} npx pendingyou app status herdr says what it may do and for how long.\n\n`);
|
|
225
|
-
if (showsHere(stored))
|
|
228
|
+
if (showsHere(stored) && holdsHere(stored))
|
|
226
229
|
return;
|
|
227
|
-
|
|
230
|
+
if (!showsHere(stored))
|
|
231
|
+
io.out(line('!', signInAgainForShow(stored.origin)));
|
|
232
|
+
if (!holdsHere(stored))
|
|
233
|
+
io.out(line('!', signInAgainForHold(stored.origin)));
|
|
228
234
|
if (options.yes || !io.interactive || !(await ask('Sign Herdr in again now?'))) {
|
|
229
235
|
io.out('\n');
|
|
230
236
|
return;
|
|
@@ -299,6 +305,8 @@ async function doctor(io, place, options) {
|
|
|
299
305
|
io.out(showsHere(stored)
|
|
300
306
|
? line('✓', 'Show in Herdr: press it on a card in Pending You, and Herdr goes to the pane of the agent that asked.')
|
|
301
307
|
: line('!', signInAgainForShow(stored.origin)));
|
|
308
|
+
if (stored && status.ok)
|
|
309
|
+
io.out(holdsHere(stored) ? line('✓', HOLDING_LINE) : line('!', signInAgainForHold(stored.origin)));
|
|
302
310
|
}
|
|
303
311
|
else
|
|
304
312
|
io.out(line('·', 'Herdr isn’t signed in to Pending You: its popup lists what’s waiting. Setup signs it in.'));
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { readdir, rm } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { APP_IDS } from "../apps/ids.js";
|
|
4
|
+
import { configDir, readJson, readText, writeWhole } from "../files.js";
|
|
5
|
+
import { herdrBin, herdrPane, herdrServer, isUrgency, reportArgs, runHerdr, } from "../herdr.js";
|
|
6
|
+
export const IDLE_MS = 5 * 60_000;
|
|
7
|
+
export const EVERY_MS = 30_000;
|
|
8
|
+
export const GAP_MS = 2000;
|
|
9
|
+
export const REFUSED_MS = 10 * 60_000;
|
|
10
|
+
export const HELD_FRESH_MS = 2 * 60_000;
|
|
11
|
+
const herdrDir = (io) => join(configDir(io), 'herdr');
|
|
12
|
+
const heldPath = (io) => join(herdrDir(io), 'held.json');
|
|
13
|
+
const messagesDir = (io) => join(herdrDir(io), 'messages');
|
|
14
|
+
const panesDir = (io) => join(herdrDir(io), 'panes');
|
|
15
|
+
const paneFile = (server, pane) => `${server ?? 'local'}-${pane.replace(/[^A-Za-z0-9]/g, '_')}`;
|
|
16
|
+
export async function readHeld(io, now) {
|
|
17
|
+
const held = await readJson(heldPath(io)).catch(() => null);
|
|
18
|
+
if (!held || typeof held.at !== 'number' || now - held.at > HELD_FRESH_MS)
|
|
19
|
+
return new Set();
|
|
20
|
+
const ids = Array.isArray(held.ids) ? held.ids : [];
|
|
21
|
+
return new Set(ids.filter((id) => typeof id === 'string' && /^req_[A-Za-z0-9-]{1,40}$/.test(id)));
|
|
22
|
+
}
|
|
23
|
+
export async function writeHeld(io, ids, now) {
|
|
24
|
+
await writeWhole(heldPath(io), `${JSON.stringify({ version: 1, at: now, ids: [...ids] })}\n`, {
|
|
25
|
+
secret: true,
|
|
26
|
+
}).catch(() => { });
|
|
27
|
+
}
|
|
28
|
+
export const notHeld = (cards, held) => cards.filter((card) => !held.has(card.requestId));
|
|
29
|
+
export async function noteMessage(io) {
|
|
30
|
+
const pane = herdrPane(io.env);
|
|
31
|
+
if (!pane)
|
|
32
|
+
return;
|
|
33
|
+
const server = herdrServer(io.env, io.host);
|
|
34
|
+
await writeWhole(join(messagesDir(io), paneFile(server, pane.pane)), `${Math.floor(io.now())}\n`, { secret: true }).catch(() => { });
|
|
35
|
+
}
|
|
36
|
+
export async function lastMessage(io, server, pane) {
|
|
37
|
+
const text = await readText(join(messagesDir(io), paneFile(server, pane))).catch(() => null);
|
|
38
|
+
const at = Number(text?.trim());
|
|
39
|
+
return text && Number.isFinite(at) && at > 0 ? at : null;
|
|
40
|
+
}
|
|
41
|
+
export async function savePane(io, pane, report) {
|
|
42
|
+
if (report.cards === undefined)
|
|
43
|
+
return;
|
|
44
|
+
const saved = {
|
|
45
|
+
version: 1,
|
|
46
|
+
pane,
|
|
47
|
+
app: report.app,
|
|
48
|
+
...(report.agent !== undefined ? { agent: report.agent } : {}),
|
|
49
|
+
cards: report.cards.map((card) => ({
|
|
50
|
+
requestId: card.requestId,
|
|
51
|
+
...(card.title ? { title: card.title.slice(0, 200) } : {}),
|
|
52
|
+
...(card.urgency ? { urgency: card.urgency } : {}),
|
|
53
|
+
...(card.blocking ? { blocking: true } : {}),
|
|
54
|
+
...(card.askedFirst ? { askedFirst: true } : {}),
|
|
55
|
+
at: card.at,
|
|
56
|
+
})),
|
|
57
|
+
};
|
|
58
|
+
await writeWhole(join(panesDir(io), paneFile(herdrServer(io.env, io.host), pane)), `${JSON.stringify(saved)}\n`, { secret: true }).catch(() => { });
|
|
59
|
+
}
|
|
60
|
+
export async function forgetPane(io, pane) {
|
|
61
|
+
await rm(join(panesDir(io), paneFile(herdrServer(io.env, io.host), pane)), {
|
|
62
|
+
force: true,
|
|
63
|
+
}).catch(() => { });
|
|
64
|
+
}
|
|
65
|
+
async function savedPanes(io, server) {
|
|
66
|
+
const prefix = `${server ?? 'local'}-`;
|
|
67
|
+
const names = await readdir(panesDir(io)).catch(() => []);
|
|
68
|
+
const panes = [];
|
|
69
|
+
for (const name of names.filter((each) => each.startsWith(prefix))) {
|
|
70
|
+
const saved = await readJson(join(panesDir(io), name)).catch(() => null);
|
|
71
|
+
if (!saved ||
|
|
72
|
+
typeof saved.pane !== 'string' ||
|
|
73
|
+
!APP_IDS.includes(String(saved.app)) ||
|
|
74
|
+
!Array.isArray(saved.cards))
|
|
75
|
+
continue;
|
|
76
|
+
panes.push({
|
|
77
|
+
version: 1,
|
|
78
|
+
pane: saved.pane,
|
|
79
|
+
app: saved.app,
|
|
80
|
+
...(saved.agent !== undefined ? { agent: saved.agent } : {}),
|
|
81
|
+
cards: saved.cards.flatMap((card) => typeof card?.requestId === 'string'
|
|
82
|
+
? [
|
|
83
|
+
{
|
|
84
|
+
requestId: card.requestId,
|
|
85
|
+
...(typeof card.title === 'string' ? { title: card.title } : {}),
|
|
86
|
+
...(isUrgency(card.urgency) ? { urgency: card.urgency } : {}),
|
|
87
|
+
...(card.blocking === true ? { blocking: true } : {}),
|
|
88
|
+
...(card.askedFirst === true ? { askedFirst: true } : {}),
|
|
89
|
+
at: typeof card.at === 'number' ? card.at : 0,
|
|
90
|
+
},
|
|
91
|
+
]
|
|
92
|
+
: []),
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return panes;
|
|
96
|
+
}
|
|
97
|
+
export async function applyHeld(io, server, before, after, now) {
|
|
98
|
+
await writeHeld(io, [...after], now);
|
|
99
|
+
const bin = herdrBin(io.env);
|
|
100
|
+
if (!bin)
|
|
101
|
+
return 0;
|
|
102
|
+
const changed = (id) => before.has(id) !== after.has(id);
|
|
103
|
+
let written = 0;
|
|
104
|
+
for (const saved of await savedPanes(io, server).catch(() => [])) {
|
|
105
|
+
if (!saved.cards.some((card) => changed(card.requestId)))
|
|
106
|
+
continue;
|
|
107
|
+
await runHerdr(io, { bin, pane: saved.pane }, reportArgs(saved.pane, {
|
|
108
|
+
app: saved.app,
|
|
109
|
+
...(saved.agent !== undefined ? { agent: saved.agent } : {}),
|
|
110
|
+
cards: notHeld(saved.cards, after),
|
|
111
|
+
at: now,
|
|
112
|
+
}));
|
|
113
|
+
written++;
|
|
114
|
+
}
|
|
115
|
+
return written;
|
|
116
|
+
}
|
|
117
|
+
export const freshFocus = () => ({
|
|
118
|
+
sentAt: Number.NEGATIVE_INFINITY,
|
|
119
|
+
place: null,
|
|
120
|
+
active: false,
|
|
121
|
+
held: [],
|
|
122
|
+
every: EVERY_MS,
|
|
123
|
+
quietUntil: 0,
|
|
124
|
+
});
|
|
125
|
+
const placeKey = (spot) => (spot ? `${spot.server} ${spot.paneId}` : null);
|
|
126
|
+
export function focusDue(state, look) {
|
|
127
|
+
const { now } = look;
|
|
128
|
+
if (now < state.quietUntil || now - state.sentAt < GAP_MS)
|
|
129
|
+
return false;
|
|
130
|
+
if (state.sentAt === Number.NEGATIVE_INFINITY)
|
|
131
|
+
return true;
|
|
132
|
+
const active = look.activeAt !== null && now - look.activeAt < IDLE_MS;
|
|
133
|
+
if (placeKey(look.spot) !== state.place || look.nudge)
|
|
134
|
+
return true;
|
|
135
|
+
if ((active || state.held.length > 0) && now - state.sentAt >= state.every)
|
|
136
|
+
return true;
|
|
137
|
+
return state.active && !active;
|
|
138
|
+
}
|
|
139
|
+
export function focusSent(state, look, answer) {
|
|
140
|
+
return {
|
|
141
|
+
...state,
|
|
142
|
+
sentAt: look.now,
|
|
143
|
+
place: placeKey(look.spot),
|
|
144
|
+
active: look.activeAt !== null && look.now - look.activeAt < IDLE_MS,
|
|
145
|
+
held: [...answer.held],
|
|
146
|
+
every: typeof answer.everySeconds === 'number' && answer.everySeconds >= 5
|
|
147
|
+
? answer.everySeconds * 1000
|
|
148
|
+
: EVERY_MS,
|
|
149
|
+
quietUntil: 0,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
export const focusRefused = (state, now) => ({
|
|
153
|
+
...state,
|
|
154
|
+
sentAt: now,
|
|
155
|
+
held: [],
|
|
156
|
+
quietUntil: now + REFUSED_MS,
|
|
157
|
+
});
|
package/dist/herdr/watch.js
CHANGED
|
@@ -2,10 +2,11 @@ import { randomBytes } from 'node:crypto';
|
|
|
2
2
|
import { mkdir, readFile, rm, stat, utimes, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { appClient, RENEW_WITHIN_MS, readAppSignIn } from "../app-login.js";
|
|
5
|
-
import { herdrServer } from "../herdr.js";
|
|
5
|
+
import { herdrServer, TOKENS } from "../herdr.js";
|
|
6
6
|
import { atLeast } from "../mod.js";
|
|
7
|
-
import { SignedOutError } from "../sdk/index.js";
|
|
7
|
+
import { ApiError, SignedOutError } from "../sdk/index.js";
|
|
8
8
|
import { VERSION } from "../version.js";
|
|
9
|
+
import { applyHeld, focusDue, focusRefused, focusSent, freshFocus, lastMessage, } from "./focus.js";
|
|
9
10
|
import { due, emptyNotices, look } from "./notice.js";
|
|
10
11
|
import { readWaiting } from "./panes.js";
|
|
11
12
|
import { agentView, pluginOff, viewOn } from "./plugin.js";
|
|
@@ -121,7 +122,13 @@ export async function watchStep(io, socket, state, options) {
|
|
|
121
122
|
let next = state;
|
|
122
123
|
if (options.read) {
|
|
123
124
|
const { snapshot, waiting } = await readWaiting(socket);
|
|
124
|
-
|
|
125
|
+
const focused = snapshot.panes.find((pane) => pane.paneId === snapshot.focusedPane);
|
|
126
|
+
last = {
|
|
127
|
+
waiting,
|
|
128
|
+
viewing: snapshot.focusedTab,
|
|
129
|
+
focusedPane: snapshot.focusedPane,
|
|
130
|
+
focusedCards: focused?.tokens[TOKENS.cards] ?? '',
|
|
131
|
+
};
|
|
125
132
|
next = look(next, last.waiting, io.now());
|
|
126
133
|
}
|
|
127
134
|
const decided = due(next, last.waiting, io.now(), last.viewing);
|
|
@@ -129,6 +136,7 @@ export async function watchStep(io, socket, state, options) {
|
|
|
129
136
|
const toast = decided.toast ? await showToast(socket, decided.toast) : null;
|
|
130
137
|
return { state: next, last, toast };
|
|
131
138
|
}
|
|
139
|
+
export const nothingSeen = () => ({ waiting: [], viewing: null });
|
|
132
140
|
const FOCUS_EVENTS = new Set([
|
|
133
141
|
'pane.focused',
|
|
134
142
|
'tab.focused',
|
|
@@ -161,6 +169,18 @@ export function signInKeeper(io, socket, place) {
|
|
|
161
169
|
const server = herdrServer(io.env, io.host);
|
|
162
170
|
let following = null;
|
|
163
171
|
let refused = null;
|
|
172
|
+
let focusing = false;
|
|
173
|
+
let focus = freshFocus();
|
|
174
|
+
let held = new Set();
|
|
175
|
+
let cardsSeen = null;
|
|
176
|
+
const unhold = async () => {
|
|
177
|
+
if (!held.size)
|
|
178
|
+
return;
|
|
179
|
+
const before = held;
|
|
180
|
+
held = new Set();
|
|
181
|
+
focus = freshFocus();
|
|
182
|
+
await applyHeld(io, server, before, held, io.now()).catch(() => 0);
|
|
183
|
+
};
|
|
164
184
|
const stopShows = () => {
|
|
165
185
|
following?.stop.abort();
|
|
166
186
|
following = null;
|
|
@@ -170,6 +190,7 @@ export function signInKeeper(io, socket, place) {
|
|
|
170
190
|
return;
|
|
171
191
|
client = null;
|
|
172
192
|
stopShows();
|
|
193
|
+
await unhold();
|
|
173
194
|
if (endedSignIn !== which) {
|
|
174
195
|
endedSignIn = which;
|
|
175
196
|
await showToast(socket, SIGNED_OUT_TOAST);
|
|
@@ -207,6 +228,7 @@ export function signInKeeper(io, socket, place) {
|
|
|
207
228
|
client = null;
|
|
208
229
|
current = signIn;
|
|
209
230
|
stopShows();
|
|
231
|
+
await unhold();
|
|
210
232
|
return;
|
|
211
233
|
}
|
|
212
234
|
if (signIn !== current || !client) {
|
|
@@ -216,20 +238,55 @@ export function signInKeeper(io, socket, place) {
|
|
|
216
238
|
}
|
|
217
239
|
presence = stored.scopes.includes('presence:desk');
|
|
218
240
|
shows = stored.scopes.includes('assistants:show');
|
|
241
|
+
focusing = stored.scopes.includes('presence:focus');
|
|
242
|
+
if (!focusing)
|
|
243
|
+
await unhold();
|
|
219
244
|
if (shows)
|
|
220
245
|
followShows();
|
|
221
246
|
else
|
|
222
247
|
stopShows();
|
|
223
248
|
},
|
|
224
|
-
stop() {
|
|
249
|
+
async stop() {
|
|
225
250
|
stopShows();
|
|
251
|
+
await unhold();
|
|
226
252
|
},
|
|
227
|
-
async tick() {
|
|
253
|
+
async tick(seen = nothingSeen()) {
|
|
228
254
|
if (!client)
|
|
229
255
|
return;
|
|
230
256
|
const now = io.now();
|
|
257
|
+
const popup = await lastActive(place);
|
|
258
|
+
if (focusing && server) {
|
|
259
|
+
const pane = seen.focusedPane ?? null;
|
|
260
|
+
const said = pane ? await lastMessage(io, server, pane) : null;
|
|
261
|
+
const latest = Math.max(focusAt ?? -1, popup ?? -1, said ?? -1);
|
|
262
|
+
const spot = pane ? { server, paneId: pane } : null;
|
|
263
|
+
const cards = seen.focusedCards ?? '';
|
|
264
|
+
const nudge = cardsSeen !== null && cards !== '' && cards !== cardsSeen;
|
|
265
|
+
cardsSeen = cards;
|
|
266
|
+
const look = { now, spot, activeAt: latest >= 0 ? latest : null, nudge };
|
|
267
|
+
if (focusDue(focus, look))
|
|
268
|
+
try {
|
|
269
|
+
const answer = await client.focus({
|
|
270
|
+
place: spot ? { app: 'herdr', paneId: spot.paneId, server: spot.server } : null,
|
|
271
|
+
activeAt: new Date(Math.max(0, latest)).toISOString(),
|
|
272
|
+
});
|
|
273
|
+
focus = focusSent(focus, look, answer);
|
|
274
|
+
const before = held;
|
|
275
|
+
held = new Set(answer.held);
|
|
276
|
+
await applyHeld(io, server, before, held, now);
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
if (error instanceof SignedOutError)
|
|
280
|
+
return ended();
|
|
281
|
+
if (error instanceof ApiError && error.status >= 400 && error.status < 500) {
|
|
282
|
+
focus = focusRefused(focus, now);
|
|
283
|
+
await unhold();
|
|
284
|
+
}
|
|
285
|
+
else
|
|
286
|
+
focus = { ...focus, sentAt: now };
|
|
287
|
+
}
|
|
288
|
+
}
|
|
231
289
|
if (presence) {
|
|
232
|
-
const popup = await lastActive(place);
|
|
233
290
|
const activeAt = Math.max(focusAt ?? -1, popup ?? -1);
|
|
234
291
|
const step = deskStep(desk, activeAt >= 0 ? activeAt : null, now);
|
|
235
292
|
if (step.send !== null)
|
|
@@ -274,7 +331,7 @@ export async function watch(io, place, options) {
|
|
|
274
331
|
return 0;
|
|
275
332
|
const socket = place.socket;
|
|
276
333
|
let state = emptyNotices();
|
|
277
|
-
let last =
|
|
334
|
+
let last = nothingSeen();
|
|
278
335
|
const signIn = signInKeeper(io, socket, place);
|
|
279
336
|
try {
|
|
280
337
|
while (!io.signal.aborted) {
|
|
@@ -305,7 +362,7 @@ export async function watch(io, place, options) {
|
|
|
305
362
|
catch {
|
|
306
363
|
live.changed = true;
|
|
307
364
|
}
|
|
308
|
-
await signIn.tick().catch(() => { });
|
|
365
|
+
await signIn.tick(last).catch(() => { });
|
|
309
366
|
if (io.now() - checked >= RENEW_MS) {
|
|
310
367
|
checked = io.now();
|
|
311
368
|
await signIn.renew();
|
|
@@ -329,7 +386,7 @@ export async function watch(io, place, options) {
|
|
|
329
386
|
return 0;
|
|
330
387
|
}
|
|
331
388
|
finally {
|
|
332
|
-
signIn.stop();
|
|
389
|
+
await signIn.stop().catch(() => { });
|
|
333
390
|
if ((await holder(place))?.id === lease)
|
|
334
391
|
await rm(leasePath(place), { force: true }).catch(() => { });
|
|
335
392
|
}
|
package/dist/herdr.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { isAbsolute, join } from 'node:path';
|
|
3
3
|
import { configDir, readJson, writeWhole } from "./files.js";
|
|
4
|
+
import { forgetPane, notHeld, readHeld, savePane } from "./herdr/focus.js";
|
|
4
5
|
import { cut, redactText } from "./redact.js";
|
|
5
6
|
export const HERDR_SOURCE = 'pendingyou';
|
|
6
7
|
export const HERDR_TIMEOUT_MS = 1000;
|
|
@@ -186,12 +187,17 @@ export async function writeHerdr(io, report, pane) {
|
|
|
186
187
|
const target = pane === undefined ? await herdrTarget(io) : pane;
|
|
187
188
|
if (!target)
|
|
188
189
|
return 'off';
|
|
189
|
-
|
|
190
|
+
if (report.cards === undefined)
|
|
191
|
+
return runHerdr(io, target, reportArgs(target.pane, report));
|
|
192
|
+
await savePane(io, target.pane, report);
|
|
193
|
+
const held = await readHeld(io, io.now()).catch(() => new Set());
|
|
194
|
+
return runHerdr(io, target, reportArgs(target.pane, { ...report, cards: notHeld(report.cards, held) }));
|
|
190
195
|
}
|
|
191
196
|
export async function clearHerdr(io, at, pane) {
|
|
192
197
|
const target = pane === undefined ? await herdrTarget(io) : pane;
|
|
193
198
|
if (!target)
|
|
194
199
|
return 'off';
|
|
200
|
+
await forgetPane(io, target.pane);
|
|
195
201
|
return runHerdr(io, target, clearArgs(target.pane, at));
|
|
196
202
|
}
|
|
197
203
|
export function reportCommand(app, fields) {
|
package/dist/pickup.js
CHANGED
|
@@ -7,6 +7,7 @@ import { environmentWarning } from "./environment.js";
|
|
|
7
7
|
import { configDir, readJson } from "./files.js";
|
|
8
8
|
import { clip, delegatedOf, describe, HANDED_PREFIX, isHandedWake, } from "./format.js";
|
|
9
9
|
import { goesBy, HANDED_GRACE_MS, namesAnotherComputer } from "./handed.js";
|
|
10
|
+
import { noteMessage } from "./herdr/focus.js";
|
|
10
11
|
import { herdrTarget, reportCommand } from "./herdr.js";
|
|
11
12
|
import { holdCommand } from "./hold.js";
|
|
12
13
|
import { linkSoon } from "./link.js";
|
|
@@ -177,6 +178,8 @@ export async function pickup(io, options, hook = { fallback: '' }) {
|
|
|
177
178
|
try {
|
|
178
179
|
const input = await hookInput(io);
|
|
179
180
|
const { cwd } = input;
|
|
181
|
+
if (mode === 'handoff' && (await herdrTarget(io)))
|
|
182
|
+
await noteMessage(io);
|
|
180
183
|
await linkSoon(io, origin);
|
|
181
184
|
if (mode === 'handoff' && isPromptApp(app))
|
|
182
185
|
await settlePrompts(io, { session: input.session, event: 'prompt' });
|
package/dist/sdk/client.js
CHANGED
|
@@ -215,6 +215,7 @@ export function createClient(options) {
|
|
|
215
215
|
presence: async (here) => {
|
|
216
216
|
await request('POST', '/v1/presence', { body: { here } });
|
|
217
217
|
},
|
|
218
|
+
focus: (report) => request('POST', '/v1/focus', { body: report }),
|
|
218
219
|
changesPage: (query, opts) => request('GET', '/v1/changes', {
|
|
219
220
|
...opts,
|
|
220
221
|
...(query ? { query: query } : {}),
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.41.0';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pendingyou-wake",
|
|
3
3
|
"displayName": "Pending You",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.60.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.60.0; send changes there.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pendingyou",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.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",
|