pendingyou 0.27.0 → 0.28.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 +8 -0
- package/dist/apps/codex-wake.js +5 -0
- package/dist/format.js +22 -4
- package/dist/sdk/code.js +138 -0
- package/dist/sdk/index.js +1 -0
- package/dist/sdk/node.js +74 -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,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.28.0 (2026-10-07)
|
|
4
|
+
|
|
5
|
+
- When a card you asked was handed to another assistant and comes back to your person without its answer (handed
|
|
6
|
+
back, brought back after the two of you traded too many messages or went quiet, taken back, its answer back with
|
|
7
|
+
your person to send, or the helper removed), the session that asked hears it: “Pending You: req_… came back from
|
|
8
|
+
codex-setup to your person.”, Pending You's line saying why, and to ack_answer it (nothing to answer; your person's
|
|
9
|
+
answer reaches you as usual). Codex threads are woken with the same. Before, the card went quiet.
|
|
10
|
+
|
|
3
11
|
## 0.27.0 (2026-10-07)
|
|
4
12
|
|
|
5
13
|
- Claude Code's pendingyou MCP server no longer gets stuck on “needs authentication” after a computer sleeps. When it
|
package/dist/apps/codex-wake.js
CHANGED
|
@@ -390,6 +390,11 @@ function line(heard, card) {
|
|
|
390
390
|
`your person handed your open cards to ${from}, ${titled} among them`,
|
|
391
391
|
`stop working on them: ${from} answers them and follows up; ack_answer ${heard.requestId} with its version to say you’ve stopped`,
|
|
392
392
|
];
|
|
393
|
+
if (notice?.kind === 'came_back')
|
|
394
|
+
return [
|
|
395
|
+
`${titled} came back from ${from} to your person`,
|
|
396
|
+
`call ${get} to read why (helper.ended), then ack_answer with its version to say you’ve read it; their answer reaches you as usual`,
|
|
397
|
+
];
|
|
393
398
|
if (notice?.kind === 'follow_up' && heard.status !== 'answered')
|
|
394
399
|
return [
|
|
395
400
|
`${from} followed up on ${titled}, which it answered for your person`,
|
package/dist/format.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
const NOTICES = ['follow_up', 'handed_over', 'came_back'];
|
|
1
2
|
export function noticeOf(heard) {
|
|
2
3
|
const given = heard.notice;
|
|
3
4
|
if (typeof given !== 'object' || given === null)
|
|
4
5
|
return null;
|
|
5
6
|
const { kind, from } = given;
|
|
6
|
-
if ((kind
|
|
7
|
+
if (!NOTICES.includes(kind) || typeof from !== 'string')
|
|
7
8
|
return null;
|
|
8
|
-
return { kind, from };
|
|
9
|
+
return { kind: kind, from };
|
|
9
10
|
}
|
|
10
11
|
export function handledOf(heard) {
|
|
11
12
|
const given = heard.handled;
|
|
@@ -32,10 +33,15 @@ export function delegatedOf(heard) {
|
|
|
32
33
|
const given = heard.delegated;
|
|
33
34
|
if (typeof given !== 'object' || given === null)
|
|
34
35
|
return null;
|
|
35
|
-
const { from, mode, note } = given;
|
|
36
|
+
const { from, mode, note, authority } = given;
|
|
36
37
|
if (typeof from !== 'string' || (mode !== 'freely' && mode !== 'loop'))
|
|
37
38
|
return null;
|
|
38
|
-
return {
|
|
39
|
+
return {
|
|
40
|
+
from,
|
|
41
|
+
mode,
|
|
42
|
+
...(typeof authority === 'string' && authority.trim() ? { authority } : {}),
|
|
43
|
+
...(typeof note === 'string' && note.trim() ? { note } : {}),
|
|
44
|
+
};
|
|
39
45
|
}
|
|
40
46
|
export const modeWords = (mode, from) => mode === 'freely'
|
|
41
47
|
? `answer freely: your answer goes straight to ${from}`
|
|
@@ -44,6 +50,7 @@ export const HANDED_TODO = 'If you know, answer_delegated with your answer and h
|
|
|
44
50
|
const MAX_ANSWER = 600;
|
|
45
51
|
const MAX_MESSAGE = 400;
|
|
46
52
|
const MAX_TITLE = 140;
|
|
53
|
+
const MAX_AUTHORITY = 500;
|
|
47
54
|
const MAX_QUESTION = 100;
|
|
48
55
|
const MAX_QUESTION_ANSWER = 300;
|
|
49
56
|
export function clip(text, max) {
|
|
@@ -91,6 +98,7 @@ function describeHanded(heard, delegated) {
|
|
|
91
98
|
}
|
|
92
99
|
return [
|
|
93
100
|
`${HANDED_PREFIX} ${id}, a question from ${from} (${modeWords(delegated.mode, from)}).`,
|
|
101
|
+
...(delegated.authority ? [clip(delegated.authority, MAX_AUTHORITY).text] : []),
|
|
94
102
|
`Question: ${clip(heard.title, MAX_TITLE).text}`,
|
|
95
103
|
...(note ? [`Their note: “${note.text}”`] : []),
|
|
96
104
|
`Call get_request (requestId ${id}, name ${named(heard)}) to read it. ${HANDED_TODO}`,
|
|
@@ -106,6 +114,16 @@ function describeNotice(heard, notice) {
|
|
|
106
114
|
`Pending You: your person handed your open cards to ${from}, ${id} among them.`,
|
|
107
115
|
`Stop working on them: ${from} answers them and follows up. Call ${ack} to say you’ve stopped.`,
|
|
108
116
|
];
|
|
117
|
+
if (notice.kind === 'came_back') {
|
|
118
|
+
const why = heard.messages.at(-1)?.body.split(' Nothing to answer:')[0] ?? '';
|
|
119
|
+
const said = clip(why, MAX_MESSAGE);
|
|
120
|
+
return [
|
|
121
|
+
`Pending You: ${id} came back from ${from} to your person.`,
|
|
122
|
+
...(said.text ? [said.text] : []),
|
|
123
|
+
`Nothing to answer: call ${ack} to say you’ve read it. Your person’s answer reaches you as usual.`,
|
|
124
|
+
...(said.cut ? [`(Cut short: get_request ${id} has all of it.)`] : []),
|
|
125
|
+
];
|
|
126
|
+
}
|
|
109
127
|
let cut = false;
|
|
110
128
|
const wrote = heard.messages.map((message) => {
|
|
111
129
|
const said = quoted(message.body, MAX_MESSAGE);
|
package/dist/sdk/code.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { generateKey, importKey, sha256 } from "./dpop.js";
|
|
2
|
+
import { SignInError } from "./errors.js";
|
|
3
|
+
import { nonces, tokenRequest } from "./oauth.js";
|
|
4
|
+
export const AUTHORIZE_PATH = '/oauth/authorize';
|
|
5
|
+
const random = (bytes) => {
|
|
6
|
+
let binary = '';
|
|
7
|
+
for (const byte of crypto.getRandomValues(new Uint8Array(bytes)))
|
|
8
|
+
binary += String.fromCharCode(byte);
|
|
9
|
+
return btoa(binary).replaceAll('+', '-').replaceAll('/', '_').replace(/=+$/, '');
|
|
10
|
+
};
|
|
11
|
+
export async function codeSignIn(options) {
|
|
12
|
+
const { jwk } = await generateKey();
|
|
13
|
+
const pending = {
|
|
14
|
+
version: 1,
|
|
15
|
+
origin: options.origin.replace(/\/+$/, ''),
|
|
16
|
+
clientId: options.clientId,
|
|
17
|
+
redirectUri: options.redirectUri,
|
|
18
|
+
scopes: [...options.scopes],
|
|
19
|
+
state: random(16),
|
|
20
|
+
verifier: random(32),
|
|
21
|
+
key: jwk,
|
|
22
|
+
};
|
|
23
|
+
return resumeCodeSignIn(pending, options);
|
|
24
|
+
}
|
|
25
|
+
export async function resumeCodeSignIn(pending, options = {}) {
|
|
26
|
+
const http = {
|
|
27
|
+
fetch: options.fetch ?? ((input, init) => fetch(input, init)),
|
|
28
|
+
now: options.now ?? (() => Date.now()),
|
|
29
|
+
};
|
|
30
|
+
const key = await importKey(pending.key);
|
|
31
|
+
const url = new URL(`${pending.origin}${AUTHORIZE_PATH}`);
|
|
32
|
+
url.search = new URLSearchParams({
|
|
33
|
+
response_type: 'code',
|
|
34
|
+
client_id: pending.clientId,
|
|
35
|
+
redirect_uri: pending.redirectUri,
|
|
36
|
+
scope: pending.scopes.join(' '),
|
|
37
|
+
state: pending.state,
|
|
38
|
+
code_challenge: await sha256(pending.verifier),
|
|
39
|
+
code_challenge_method: 'S256',
|
|
40
|
+
resource: `${pending.origin}/v1`,
|
|
41
|
+
dpop_jkt: key.jkt,
|
|
42
|
+
}).toString();
|
|
43
|
+
let finished = false;
|
|
44
|
+
async function finish(callback) {
|
|
45
|
+
if (finished)
|
|
46
|
+
throw new SignInError('finished', 'This sign-in is finished already.');
|
|
47
|
+
const back = new URL(String(callback));
|
|
48
|
+
if (back.searchParams.get('state') !== pending.state)
|
|
49
|
+
throw new SignInError('state_mismatch', 'This isn’t the answer to this sign-in.');
|
|
50
|
+
const iss = back.searchParams.get('iss');
|
|
51
|
+
if (iss !== null && iss !== pending.origin)
|
|
52
|
+
throw new SignInError('issuer_mismatch', 'This answer came from somewhere else.');
|
|
53
|
+
const error = back.searchParams.get('error');
|
|
54
|
+
if (error)
|
|
55
|
+
throw new SignInError(error, error === 'access_denied'
|
|
56
|
+
? 'The person didn’t allow it.'
|
|
57
|
+
: `Pending You refused the sign-in (${error}).`);
|
|
58
|
+
const code = back.searchParams.get('code');
|
|
59
|
+
if (!code)
|
|
60
|
+
throw new SignInError('no_code', 'The answer had no code.');
|
|
61
|
+
finished = true;
|
|
62
|
+
const result = await tokenRequest(http, pending.origin, key, {
|
|
63
|
+
grant_type: 'authorization_code',
|
|
64
|
+
code,
|
|
65
|
+
redirect_uri: pending.redirectUri,
|
|
66
|
+
client_id: pending.clientId,
|
|
67
|
+
code_verifier: pending.verifier,
|
|
68
|
+
resource: `${pending.origin}/v1`,
|
|
69
|
+
}, nonces());
|
|
70
|
+
if (!result.ok)
|
|
71
|
+
throw new SignInError(result.error, `Pending You didn’t finish the sign-in (${result.error}). Start it again.`);
|
|
72
|
+
const credentials = {
|
|
73
|
+
version: 1,
|
|
74
|
+
origin: pending.origin,
|
|
75
|
+
clientId: pending.clientId,
|
|
76
|
+
accessToken: result.tokens.access_token,
|
|
77
|
+
refreshToken: result.tokens.refresh_token,
|
|
78
|
+
expiresAt: http.now() + result.tokens.expires_in * 1000,
|
|
79
|
+
scopes: result.tokens.scope ? result.tokens.scope.split(' ') : [...pending.scopes],
|
|
80
|
+
key: pending.key,
|
|
81
|
+
};
|
|
82
|
+
const store = options.store;
|
|
83
|
+
if (store)
|
|
84
|
+
await store.exclusive(() => store.save(credentials));
|
|
85
|
+
return credentials;
|
|
86
|
+
}
|
|
87
|
+
return { url: url.toString(), pending, finish };
|
|
88
|
+
}
|
|
89
|
+
export function isPendingCodeSignIn(value) {
|
|
90
|
+
const entry = value;
|
|
91
|
+
return (typeof entry === 'object' &&
|
|
92
|
+
entry !== null &&
|
|
93
|
+
entry.version === 1 &&
|
|
94
|
+
typeof entry.origin === 'string' &&
|
|
95
|
+
typeof entry.clientId === 'string' &&
|
|
96
|
+
typeof entry.redirectUri === 'string' &&
|
|
97
|
+
Array.isArray(entry.scopes) &&
|
|
98
|
+
typeof entry.state === 'string' &&
|
|
99
|
+
typeof entry.verifier === 'string' &&
|
|
100
|
+
typeof entry.key === 'object' &&
|
|
101
|
+
entry.key !== null);
|
|
102
|
+
}
|
|
103
|
+
export const PENDING_KEY = 'pendingyou.signin';
|
|
104
|
+
const sessionStorageHere = () => globalThis.sessionStorage;
|
|
105
|
+
export async function redirectToSignIn(options) {
|
|
106
|
+
const storage = options.storage ?? sessionStorageHere();
|
|
107
|
+
if (!storage)
|
|
108
|
+
throw new TypeError('No sessionStorage here: pass `storage`');
|
|
109
|
+
const started = await codeSignIn(options);
|
|
110
|
+
storage.setItem(PENDING_KEY, JSON.stringify(started.pending));
|
|
111
|
+
const go = options.go ??
|
|
112
|
+
((url) => {
|
|
113
|
+
const here = globalThis.location;
|
|
114
|
+
if (!here)
|
|
115
|
+
throw new TypeError('No location here: pass `go`');
|
|
116
|
+
here.assign(url);
|
|
117
|
+
});
|
|
118
|
+
go(started.url);
|
|
119
|
+
}
|
|
120
|
+
export async function finishRedirectSignIn(options = {}) {
|
|
121
|
+
const storage = options.storage ?? sessionStorageHere();
|
|
122
|
+
if (!storage)
|
|
123
|
+
throw new TypeError('No sessionStorage here: pass `storage`');
|
|
124
|
+
const kept = storage.getItem(PENDING_KEY);
|
|
125
|
+
storage.removeItem(PENDING_KEY);
|
|
126
|
+
let pending = null;
|
|
127
|
+
try {
|
|
128
|
+
pending = kept ? JSON.parse(kept) : null;
|
|
129
|
+
}
|
|
130
|
+
catch { }
|
|
131
|
+
if (!isPendingCodeSignIn(pending))
|
|
132
|
+
throw new SignInError('not_started', 'No sign-in was started in this tab.');
|
|
133
|
+
const url = options.url ?? globalThis.location?.href ?? undefined;
|
|
134
|
+
if (!url)
|
|
135
|
+
throw new TypeError('No location here: pass `url`');
|
|
136
|
+
const started = await resumeCodeSignIn(pending, options);
|
|
137
|
+
return started.finish(url);
|
|
138
|
+
}
|
package/dist/sdk/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { backoffMs, RESYNC_MS } from "./changes.js";
|
|
2
2
|
export { createClient } from "./client.js";
|
|
3
|
+
export { codeSignIn, finishRedirectSignIn, redirectToSignIn, resumeCodeSignIn, } from "./code.js";
|
|
3
4
|
export { deviceSignIn, } from "./device.js";
|
|
4
5
|
export { generateKey, importKey, thumbprint } from "./dpop.js";
|
|
5
6
|
export { ApiError, SignedOutError, SignInError } from "./errors.js";
|
package/dist/sdk/node.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { execFile } from 'node:child_process';
|
|
2
2
|
import { randomBytes } from 'node:crypto';
|
|
3
3
|
import { chmod, mkdir, readFile, rename, rm, stat, writeFile } from 'node:fs/promises';
|
|
4
|
+
import { createServer } from 'node:http';
|
|
4
5
|
import { dirname, join } from 'node:path';
|
|
6
|
+
import { codeSignIn } from "./code.js";
|
|
7
|
+
import { SignInError } from "./errors.js";
|
|
5
8
|
import { isCredentials } from "./store.js";
|
|
6
9
|
export const STALE_LOCK_MS = 30_000;
|
|
7
10
|
export const LOCK_WAIT_MS = 15_000;
|
|
@@ -87,6 +90,77 @@ export function fileStore(path) {
|
|
|
87
90
|
exclusive: (work) => withFileLock(path, work),
|
|
88
91
|
};
|
|
89
92
|
}
|
|
93
|
+
const page = (title, body) => `<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>${title}</title><body style="font:16px/1.5 system-ui,sans-serif;max-width:32rem;margin:15vh auto;padding:0 16px"><h1 style="font-weight:500">${title}</h1><p>${body}</p></body>`;
|
|
94
|
+
export async function loopbackSignIn(options) {
|
|
95
|
+
const registered = new URL(options.redirectUri ?? 'http://127.0.0.1/callback');
|
|
96
|
+
if (registered.protocol !== 'http:' ||
|
|
97
|
+
!['127.0.0.1', '[::1]', 'localhost'].includes(registered.hostname))
|
|
98
|
+
throw new TypeError('A loopback sign-in comes back to http://127.0.0.1');
|
|
99
|
+
const server = createServer();
|
|
100
|
+
await new Promise((done, fail) => {
|
|
101
|
+
server.once('error', fail);
|
|
102
|
+
server.listen(options.port ?? 0, registered.hostname === '[::1]' ? '::1' : '127.0.0.1', () => done());
|
|
103
|
+
});
|
|
104
|
+
const address = server.address();
|
|
105
|
+
const port = typeof address === 'object' && address ? address.port : 0;
|
|
106
|
+
const back = new URL(registered.toString());
|
|
107
|
+
back.port = String(port);
|
|
108
|
+
const redirectUri = back.toString();
|
|
109
|
+
const started = await codeSignIn({ ...options, redirectUri });
|
|
110
|
+
let timer;
|
|
111
|
+
let closed = false;
|
|
112
|
+
const close = () => {
|
|
113
|
+
if (closed)
|
|
114
|
+
return;
|
|
115
|
+
closed = true;
|
|
116
|
+
if (timer)
|
|
117
|
+
clearTimeout(timer);
|
|
118
|
+
server.close();
|
|
119
|
+
};
|
|
120
|
+
const html = { 'content-type': 'text/html; charset=utf-8', connection: 'close' };
|
|
121
|
+
const signedIn = new Promise((resolve, reject) => {
|
|
122
|
+
const stop = (error) => {
|
|
123
|
+
close();
|
|
124
|
+
reject(error);
|
|
125
|
+
};
|
|
126
|
+
timer = setTimeout(() => stop(new SignInError('expired_token', 'The browser didn’t come back in time.')), options.timeoutMs ?? 10 * 60_000);
|
|
127
|
+
options.signal?.addEventListener('abort', () => stop(new SignInError('aborted', 'The sign-in was stopped.')));
|
|
128
|
+
let taken = false;
|
|
129
|
+
server.on('request', (request, response) => {
|
|
130
|
+
const url = new URL(request.url ?? '/', redirectUri);
|
|
131
|
+
if (request.method !== 'GET' || url.pathname !== back.pathname) {
|
|
132
|
+
response
|
|
133
|
+
.writeHead(404, { 'content-type': 'text/plain', connection: 'close' })
|
|
134
|
+
.end('Not found');
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (taken) {
|
|
138
|
+
response
|
|
139
|
+
.writeHead(409, html)
|
|
140
|
+
.end(page('Already answered', 'Close this tab and go back to the app.'));
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
taken = true;
|
|
144
|
+
started.finish(url).then((credentials) => {
|
|
145
|
+
response
|
|
146
|
+
.writeHead(200, html)
|
|
147
|
+
.end(page('You’re signed in', 'Close this tab and go back to the app.'));
|
|
148
|
+
close();
|
|
149
|
+
resolve(credentials);
|
|
150
|
+
}, (error) => {
|
|
151
|
+
response
|
|
152
|
+
.writeHead(400, html)
|
|
153
|
+
.end(page('Not signed in', 'Go back to the app and start signing in again.'));
|
|
154
|
+
close();
|
|
155
|
+
reject(error);
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
signedIn.catch(() => { });
|
|
160
|
+
if (options.open)
|
|
161
|
+
await options.open(started.url);
|
|
162
|
+
return { url: started.url, redirectUri, signedIn, close };
|
|
163
|
+
}
|
|
90
164
|
const runFile = (command, args) => new Promise((resolve, reject) => {
|
|
91
165
|
execFile(command, args, { timeout: 60_000, maxBuffer: 64 * 1024 }, (error, stdout, stderr) => {
|
|
92
166
|
if (error)
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.28.0';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pendingyou-wake",
|
|
3
3
|
"displayName": "Pending You",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.44.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.44.0; send changes there.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pendingyou",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.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
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://www.pendingyou.com",
|