pendingyou 0.10.0 → 0.11.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 +58 -0
- package/README.md +141 -82
- package/dist/api.js +41 -31
- package/dist/apps/claude-code.js +365 -0
- package/dist/apps/codex-wake.js +386 -0
- package/dist/apps/codex.js +615 -0
- package/dist/apps/ids.js +24 -0
- package/dist/apps/registry.js +12 -0
- package/dist/apps/types.js +1 -0
- package/dist/args.js +109 -36
- package/dist/claude.js +164 -362
- package/dist/confirm.js +5 -4
- package/dist/credentials.js +68 -26
- package/dist/environment.js +10 -3
- package/dist/hold.js +3 -2
- package/dist/hooks.js +117 -0
- package/dist/index.js +3 -1
- package/dist/init.js +280 -0
- package/dist/main.js +37 -314
- package/dist/mod.js +7 -5
- package/dist/oauth.js +147 -51
- package/dist/pickup.js +56 -15
- package/dist/remote.js +98 -57
- package/dist/setup.js +109 -0
- package/dist/shim.js +93 -0
- package/dist/signin.js +227 -0
- package/dist/state.js +19 -3
- package/dist/stopcheck.js +46 -20
- package/dist/toml.js +277 -0
- package/dist/version.js +1 -1
- package/mod/hooks/register.js +66 -3
- package/mod/hooks/wake.js +54 -1
- package/mod/tests/wake.test.ts +50 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.11.0
|
|
4
|
+
|
|
5
|
+
- One step for the coding agents on a computer (Darin, 2026-10-04): `npx -y pendingyou@latest init` finds Claude Code
|
|
6
|
+
and Codex (`--app claude-code,codex` names some), says what it found and which it can't set up (an agent too old for
|
|
7
|
+
it is named, with the version it needs), and sets each up with one approval. Then: restart the agent, and its first
|
|
8
|
+
session finishes setting up by itself (whoami, report_setup, a test card). Asked for by name and not installed, or
|
|
9
|
+
nothing found at all: it says so and stops before anyone signs in.
|
|
10
|
+
- One sign-in everywhere: each agent's MCP server signs in through this computer's own connection ("Claude Code on
|
|
11
|
+
Ann-MBP", "Codex on Ann-MBP"), through the headers helper, on every computer but Windows; 0.10.0 did that only over
|
|
12
|
+
SSH. The hooks use the same connection, so there's nothing to Authenticate and no second sign-in. Each agent gets a
|
|
13
|
+
sign-in and a client of its own (`credentials.json`: Claude Code's under the address as before, another agent's under
|
|
14
|
+
`<address>#<app>`, so a 0.10.0 process still running keeps it; a `.gitignore` of `*` in the folder).
|
|
15
|
+
- Several agents, one approval: a device sign-in each, started together and shown as one link,
|
|
16
|
+
`/device?code=A&code=B`, which Pending You turns into one consent card naming each agent and the computer, with one
|
|
17
|
+
Allow (needs Pending You's Worker from this release). On a computer with a browser, the browser opens on it ("Your
|
|
18
|
+
browser is open on Pending You: press Allow once for Claude Code and Codex (codes …)"); over SSH, the link, a QR code
|
|
19
|
+
and each code. `--device` shows the codes anywhere, `--browser` opens the browser anyway, `--no-browser` only prints
|
|
20
|
+
the address. Cancel stops `init` before it changes anything. `login --app <app>` signs one agent in again, with its
|
|
21
|
+
own client, so it keeps its connection; `login --browser` no longer refuses a connection.
|
|
22
|
+
- Codex CLI (0.152 or later, whose `http_headers_helper` can give Authorization): its `[mcp_servers.pendingyou]` table
|
|
23
|
+
in `~/.codex/config.toml`, edited in place with every other line as it was, signed in through the helper
|
|
24
|
+
(`--app codex`) with `default_tools_approval_mode = "approve"`; a stored OAuth sign-in, which would win over the
|
|
25
|
+
helper, is logged out first. Its skill in `~/.agents/skills/pendingyou/SKILL.md`, and four hooks in
|
|
26
|
+
`~/.codex/hooks.json`, added after the person's own: a session start (startup, resume, clear), each message, Pending
|
|
27
|
+
You's card tools, and the Stop check (pattern matching on Codex's final message, once a turn at most). Codex runs a
|
|
28
|
+
hook only once the person trusts it: `init` says to choose “Trust all and continue”, `status` says which are trusted
|
|
29
|
+
(from Codex's own hash of each), and `uninstall` keeps the trust of the person's own hooks that move up when ours go.
|
|
30
|
+
When a card a Codex thread posted is answered, a listener the hooks start for that thread runs `codex queue` in the
|
|
31
|
+
wake mod's words (never with the answer itself, which other programs could read in its arguments) (Codex 0.157 or later starts a turn on an idle thread; `init` says so on an older
|
|
32
|
+
one). A server and hooks Codex's `/import` copied from Claude Code are replaced. Not on Windows yet.
|
|
33
|
+
- What happens to a `pendingyou` server that's there is decided before anyone signs in. At this Pending You, signing
|
|
34
|
+
in by itself (the agent's own OAuth, or the Pending You plugin with no server added by hand): moved to this
|
|
35
|
+
computer's sign-in without a word where there's no browser, on Yes (the default) at a terminal after saying what
|
|
36
|
+
that means, or with `--yes`; with nobody to ask, kept, with the command that switches it. Kept, the agent's hooks get
|
|
37
|
+
a sign-in that only hears, and a kept plugin carries the skill, so none is saved. At another Pending You: replaced
|
|
38
|
+
once the person says so (or `--yes`); kept, that agent is left as it is.
|
|
39
|
+
- `--oauth`: every agent signs in to its MCP server by itself, as before 0.11.0 (Claude Code's `claude mcp add`; Codex's
|
|
40
|
+
table without the helper, then `codex mcp login pendingyou`).
|
|
41
|
+
- Finishing setup by itself: a session start (new, resumed or cleared, never a compaction) adds one line while Pending
|
|
42
|
+
You says the agent's setup isn't finished (hear_answers' `for.setup`, on the request the hook makes anyway): what to
|
|
43
|
+
call, or that the test card's answer is waiting to be picked up; at most 3 times per `init`, none after 7 days, never
|
|
44
|
+
once it's verified. `init`'s copy of the wake mod starts that turn itself in Claude Code 2.1.287 or later. `init`
|
|
45
|
+
ends with the sentence to say when it doesn't, on its own line: “Finish setting up Pending You: it’s connected here
|
|
46
|
+
already.” (`FINISH_SAY`, the same as Pending You's pages).
|
|
47
|
+
- The hooks run a script with a path that never changes, `~/.config/pendingyou/bin/pendingyou-hook <command> --app
|
|
48
|
+
<app>`, which runs this version's private copy: upgrading rewrites the script, never the hook lines. Every request a
|
|
49
|
+
hook or the listener makes names its app (`source`).
|
|
50
|
+
- Node, without the shell's PATH (a Claude Code started from its desktop app or an IDE, Codex's stripped environment):
|
|
51
|
+
`init` records the Node it ran with by its stable path (`/opt/homebrew/bin/node`, not the Cellar folder an upgrade
|
|
52
|
+
removes), and the helper and the hooks' script also look in `/opt/homebrew/bin`, `/usr/local/bin` and `~/.volta/bin`.
|
|
53
|
+
A Mac is named by its own name (`scutil --get ComputerName`) unless `--name` says otherwise.
|
|
54
|
+
- `status` has a section for each agent `init` set up, a `Setup:` line (finished, waiting for the first session with
|
|
55
|
+
the sentence to say, the test card waiting on you, or answered and being picked up) that never changes Ready, and
|
|
56
|
+
"no browser here" in its header only when that's true. `uninstall` covers each agent, takes out the shared parts once
|
|
57
|
+
none is left, says which connections stay on your Assistants page, and ends with how to connect again.
|
|
58
|
+
- `pendingyou mcp --app <app>` is reserved for a stdio MCP server for an agent that can't run a headers helper; it says
|
|
59
|
+
it isn't ready yet.
|
|
60
|
+
|
|
3
61
|
## 0.10.0
|
|
4
62
|
|
|
5
63
|
- The wake mod: Claude Code 2.1.287 or later is woken when you answer, with nothing waiting in the background. A
|
package/README.md
CHANGED
|
@@ -1,51 +1,101 @@
|
|
|
1
1
|
# pendingyou
|
|
2
2
|
|
|
3
|
-
Pending You for
|
|
4
|
-
this command
|
|
3
|
+
Pending You for your coding agents. Your agents ask you in [Pending You](https://www.pendingyou.com) when you're away;
|
|
4
|
+
this command sets Claude Code and Codex up to ask there and to hear your answer the moment it's ready, even while they
|
|
5
|
+
sit idle at the prompt.
|
|
5
6
|
|
|
6
7
|
```sh
|
|
7
|
-
npx pendingyou init
|
|
8
|
+
npx -y pendingyou@latest init
|
|
8
9
|
```
|
|
9
10
|
|
|
10
|
-
Run it once on each computer. It
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Adding the MCP server can take Claude Code a minute or more (it checks its servers); `init` says when it's waiting on
|
|
29
|
-
that. If Claude Code already has a `pendingyou` server pointing somewhere else (staging, say), `init` names both and
|
|
30
|
-
asks before replacing it; `--yes` replaces it without asking, and with nobody to ask it prints the two commands to
|
|
31
|
-
run. Afterwards restart Claude Code, run `/mcp`, choose pendingyou and Authenticate (on a computer with no browser
|
|
32
|
-
there's nothing to authenticate: [below](#a-computer-with-no-browser)).
|
|
11
|
+
Run it once on each computer, in a terminal. It finds the agents on the computer (Claude Code, Codex; `--app` names
|
|
12
|
+
some), says what it found, and for each one:
|
|
13
|
+
|
|
14
|
+
- connects it to Pending You through **this computer's own sign-in**: its own connection ("Claude Code on Ann-MBP",
|
|
15
|
+
"Codex on Ann-MBP" on your Assistants page), which its MCP server and its hooks share, so there's nothing to
|
|
16
|
+
Authenticate in the agent and no second sign-in,
|
|
17
|
+
- signs them all in with **one approval**: your browser opens on Pending You with one card naming each agent and this
|
|
18
|
+
computer, and you press Allow once (over SSH: a code and a QR code for your phone, [below](#a-computer-with-no-browser)),
|
|
19
|
+
- adds the Pending You MCP server for every project, signed in through a small helper script, and lets the agent use
|
|
20
|
+
Pending You's tools without asking each time,
|
|
21
|
+
- saves the Pending You skill (Claude Code: `~/.claude/skills/pendingyou/SKILL.md`; Codex:
|
|
22
|
+
`~/.agents/skills/pendingyou/SKILL.md`),
|
|
23
|
+
- adds the hooks that hand it your answers: a new session picks up answers that arrived while nothing was running,
|
|
24
|
+
your next message brings a waiting answer with it, and a check when it finishes a turn catches what it left you only
|
|
25
|
+
in chat ([below](#nothing-left-only-in-chat)),
|
|
26
|
+
- and wakes it when you answer: Claude Code 2.1.287 or later through the wake mod, Codex through `codex queue`.
|
|
27
|
+
|
|
28
|
+
Then it says what to do next, and the one sentence to say if it's needed:
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
```
|
|
31
|
+
Next: restart Claude Code here (/exit, then claude --continue), or start it in the folder you work in.
|
|
32
|
+
It finishes setting up by itself and sends you a test card. If it doesn't, say this to it:
|
|
33
|
+
|
|
34
|
+
Finish setting up Pending You: it’s connected here already.
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The first session finishes setting up on its own: it checks in with Pending You, reports what's set up and sends you a
|
|
38
|
+
test card. Claude Code 2.1.287 or later starts that turn by itself; otherwise (and in Codex, after you choose “Trust all
|
|
39
|
+
and continue” for its hooks) the session start adds one line saying what's left, and you say the sentence.
|
|
40
|
+
`npx pendingyou status` says what's set up for each agent, what's missing with the command that fixes it, and how setup
|
|
41
|
+
stands. `npx pendingyou uninstall` removes exactly what `init` added.
|
|
42
|
+
|
|
43
|
+
Your other settings are kept as they are: `init` merges into Claude Code's `~/.claude/settings.json`, Codex's
|
|
44
|
+
`~/.codex/config.toml` (its `[mcp_servers.pendingyou]` table and nothing else, every other line as it was) and
|
|
45
|
+
`~/.codex/hooks.json`, and running it again changes nothing it doesn't need to.
|
|
46
|
+
|
|
47
|
+
**A pendingyou server that's there already** is decided on before anyone signs in. One at another Pending You
|
|
48
|
+
(staging, say) is named and replaced only once you say so (`--yes` replaces it without asking); keep it and that agent
|
|
49
|
+
is left as it is. One at this Pending You that signs in by itself (Claude Code's `/mcp` → Authenticate, Codex's
|
|
50
|
+
`codex mcp login`, or the Pending You plugin for Claude) is moved to this computer's sign-in: without asking where
|
|
51
|
+
there's no browser (it can't finish there anyway), on Yes (the default) at a terminal, or with `--yes`; with nobody to
|
|
52
|
+
ask it's kept, and `init` prints the command that switches it. The connection it had stays on your Assistants page for
|
|
53
|
+
you to remove, and answers to the cards it asked through that one won't reach the agent by themselves. A kept plugin
|
|
54
|
+
carries the skill, so none is saved. `--oauth` keeps every agent signing in by itself, as before 0.11.0.
|
|
55
|
+
|
|
56
|
+
The hooks run a copy of this version kept in `~/.config/pendingyou/cli/<version>/`, through a small script with a path
|
|
57
|
+
that never changes, `~/.config/pendingyou/bin/pendingyou-hook`:
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
"~/.config/pendingyou/bin/pendingyou-hook" pickup --app claude-code || true
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
(the path in full). Upgrading rewrites that script, never the hook lines, so Codex, which runs a hook only while you
|
|
64
|
+
trust its exact definition, doesn't ask again. The script runs the copy with the Node `init` ran with, by its stable
|
|
65
|
+
path (Homebrew's `/opt/homebrew/bin/node`, which outlives an upgrade), or the first Node it finds. If the copy can't be
|
|
66
|
+
made (no npm, no network), the hooks run through `npx -y --prefer-offline pendingyou@<version>` instead.
|
|
38
67
|
|
|
39
68
|
The hooks never get in your way: if anything goes wrong (no network, not signed in, a bad option), they print nothing
|
|
40
69
|
and let your message through. Each one stops within 3 seconds whatever happens, with at most its one-line reminder, and
|
|
41
70
|
never refreshes the sign-in itself: when that's due, it starts the refresh in the background, which finishes on its
|
|
42
|
-
own.
|
|
71
|
+
own. Each hands an agent only its own app's cards from its folder, never one another agent posted there.
|
|
72
|
+
|
|
73
|
+
If the `pendingyou` MCP server Claude Code uses in a session's folder is another Pending You than the hooks' (staging
|
|
74
|
+
and production, say), both hooks add one line telling Claude Code so, and to ask you which one you use: its cards
|
|
75
|
+
would otherwise go where you don't look. `npx pendingyou status` flags it too. Fix it with `npx pendingyou init
|
|
76
|
+
--origin <the one you use>`, then restart the session. Codex's hooks do the same for Codex's server.
|
|
77
|
+
|
|
78
|
+
## Codex
|
|
43
79
|
|
|
44
|
-
|
|
45
|
-
`
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
80
|
+
Codex CLI 0.152 or later (its `http_headers_helper` gives the sign-in; 0.157 or later wakes an idle thread by itself).
|
|
81
|
+
`init` writes, in `~/.codex/config.toml`:
|
|
82
|
+
|
|
83
|
+
```toml
|
|
84
|
+
[mcp_servers.pendingyou]
|
|
85
|
+
url = "https://www.pendingyou.com/mcp"
|
|
86
|
+
http_headers_helper = "/Users/ann/.config/pendingyou/bin/pendingyou-mcp-headers --app codex"
|
|
87
|
+
default_tools_approval_mode = "approve"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
and four hooks in `~/.codex/hooks.json`: a session start, each message, Pending You's card tools (so the Stop check
|
|
91
|
+
knows a turn posted, and so the thread is woken), and the Stop check. **Codex runs a hook only once you trust it**: start
|
|
92
|
+
`codex` and choose “Trust all and continue” (or trust them in `/hooks`). `status` says which are trusted. A
|
|
93
|
+
`pendingyou` server or hooks Codex's `/import` copied from Claude Code (without its sign-in) are replaced.
|
|
94
|
+
|
|
95
|
+
When you answer a card a Codex thread posted, a small listener `init`'s hooks start for that thread puts a message into
|
|
96
|
+
it with `codex queue`: “Pending You: your person answered “…” (req_…). Call get_request …”, which reads your answer (the
|
|
97
|
+
answer itself never goes in a command's arguments, where other programs could see it). Codex starts a turn at
|
|
98
|
+
once when the thread is open and idle, after the current one when it's working, or when you next open it.
|
|
49
99
|
|
|
50
100
|
## Nothing left only in chat
|
|
51
101
|
|
|
@@ -78,6 +128,10 @@ card titled “Confirm in Claude Code on <computer>: <step>”, with the exact w
|
|
|
78
128
|
session's link when Remote Control or Claude Code on the web gives one) and what it'll do then. Only such a message
|
|
79
129
|
costs a request: this folder's open cards, given up after 1.5 seconds.
|
|
80
130
|
|
|
131
|
+
Codex gets the same two (0.11.0). Its Stop check reads Codex's final message, and whether the turn posted, updated or
|
|
132
|
+
replied on a card comes from Codex's own hook for Pending You's tools in that turn; it asks once a turn at most, for an
|
|
133
|
+
action card titled “Confirm in Codex on <computer>: <step>” when it asked you to type something there.
|
|
134
|
+
|
|
81
135
|
**On 0.2.0 with another origin?** Its hooks blocked every message (`There's no "--origin" command`). Run
|
|
82
136
|
`npx pendingyou@latest init --origin <url>` again to repair them; see [CHANGELOG.md](CHANGELOG.md).
|
|
83
137
|
|
|
@@ -111,41 +165,37 @@ next message brings any answer with it too.
|
|
|
111
165
|
When you're at the terminal, Claude Code asks you there and puts the same question in Pending You at once; the
|
|
112
166
|
first answer wins. If you answer in the terminal, it withdraws the card and the hold ends by itself.
|
|
113
167
|
|
|
168
|
+
**Finishing setup by itself (0.11.0).** In `init`'s copy of the mod, a few seconds after a session you're at opens
|
|
169
|
+
(never `claude -p`), it asks Pending You whether Claude Code is set up here (`whoami`, once Pending You's tools are
|
|
170
|
+
allowed and the server has connected). When it isn't, it starts one turn once the session is idle: “Finish setting up
|
|
171
|
+
Pending You: it’s connected here already.” and exactly what to do. Once per session, in at most three sessions, never
|
|
172
|
+
two within ten minutes, and never again once Pending You says it's set up.
|
|
173
|
+
|
|
114
174
|
## A computer with no browser
|
|
115
175
|
|
|
116
|
-
On a devbox or server you reach over SSH,
|
|
117
|
-
reach.
|
|
176
|
+
On a devbox or server you reach over SSH, an agent's own sign-in opens a browser on that machine, which you can't
|
|
177
|
+
reach. `init` signs in with a code there instead: SSH in, and at the prompt there run
|
|
118
178
|
|
|
119
179
|
```sh
|
|
120
|
-
npx pendingyou init
|
|
180
|
+
npx -y pendingyou@latest init
|
|
121
181
|
```
|
|
122
182
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
- adds the `pendingyou` MCP server for every project with a `headersHelper` instead of OAuth
|
|
129
|
-
(`claude mcp add-json --scope user pendingyou '{"type":"http","url":"…/mcp","headersHelper":"…"}'`), so Claude Code
|
|
130
|
-
signs in through this machine's sign-in and there's nothing to Authenticate,
|
|
131
|
-
- writes that helper, `~/.config/pendingyou/bin/pendingyou-mcp-headers`, a small sh script Claude Code runs each time
|
|
132
|
-
it connects. It finds Node on PATH, else nvm's default (`$NVM_DIR` or `~/.nvm`), else the Node `init` ran with,
|
|
133
|
-
runs this version's own copy (never npx), and prints only `{"Authorization":"Bearer …"}`, refreshing the sign-in
|
|
134
|
-
when it's due,
|
|
135
|
-
- adds the wake mod, the hooks and Pending You's tools to `~/.claude/settings.json` as above, so Remote Control,
|
|
136
|
-
terminal multiplexers and plain SSH sessions all get them, whatever shell profile they read.
|
|
183
|
+
It sees it's an SSH session (or Linux with no display) and shows a link for your phone, a QR code of it, and each code,
|
|
184
|
+
for every agent it found. Open it on your phone, sign in, check the codes match and press Allow once. Only allow codes
|
|
185
|
+
your own computer is showing you. `--device` shows codes like this anywhere; `--browser` opens the browser anyway;
|
|
186
|
+
`--no-browser` only prints the address.
|
|
137
187
|
|
|
138
188
|
Run it at an interactive prompt after you SSH in, not as `ssh host npx pendingyou init`: on stock Ubuntu that one-line
|
|
139
|
-
form doesn't read your shell's setup, so nvm's Node and `
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
If the sign-in ends (30 days, or you remove the machine on your Assistants page), `npx pendingyou login` approves a
|
|
143
|
-
new code and keeps the same connection.
|
|
189
|
+
form doesn't read your shell's setup, so nvm's Node, `claude` and `codex` may not be on PATH. The helper script and the
|
|
190
|
+
hooks find Node anyway when the agents run without your shell's PATH (a systemd service, a terminal multiplexer,
|
|
191
|
+
Remote Control): on PATH, nvm's default, the one `init` ran with, or where Node usually is.
|
|
144
192
|
|
|
145
193
|
The machine is called by its Tailscale name when Tailscale is installed and running (as `tailscale status` shows it),
|
|
146
|
-
else by its hostname, or by `--name devbox` on `init` or `login
|
|
147
|
-
kept when there's nothing better, and `login` says how to change it:
|
|
148
|
-
|
|
194
|
+
else by its hostname, or by `--name devbox` on `init` or `login`; a Mac by its own name (Sharing in System Settings). A
|
|
195
|
+
cloud's own hostname (AWS's `ip-10-42-1-252`) is kept when there's nothing better, and `login` says how to change it:
|
|
196
|
+
`npx pendingyou login --name <name>` asks for one more approval and renames the connection, which stays the same one.
|
|
197
|
+
If an agent's sign-in ends (30 days, or you remove it on your Assistants page), `npx pendingyou login` (`--app codex`
|
|
198
|
+
for Codex's) approves a new code and keeps the same connection.
|
|
149
199
|
|
|
150
200
|
Only want this command's own sign-in (for `watch`, below)? `npx pendingyou login --device` signs it in with a code,
|
|
151
201
|
hearing answers only, and adds no connection. Your phone asks "Let devbox hear your answers for the assistants running
|
|
@@ -170,35 +220,44 @@ more, then skipped. `--once` stops after the first.
|
|
|
170
220
|
|
|
171
221
|
| Command | What it does |
|
|
172
222
|
| --- | --- |
|
|
173
|
-
| `init` | Set up
|
|
223
|
+
| `init` | Set up every agent on this computer (`--app`, `--oauth`, `--no-login`, `--no-browser`, `--device`, `--browser`, `--yes`, `--name`) |
|
|
174
224
|
| `hold <requestId>` | Wait for the answer, print it, exit (`--timeout 4h`); the wake mod answers it itself |
|
|
175
|
-
| `status` | What's set up; exits 0 when
|
|
176
|
-
| `login` / `logout` | Sign
|
|
225
|
+
| `status` | What's set up for each agent; exits 0 when each hears answers right away (`--app`) |
|
|
226
|
+
| `login` / `logout` | Sign an agent in again, or out (`--app`, `--device`, `--browser`, `--force`, `--name`, `--all`) |
|
|
177
227
|
| `watch -- <command>` | Run a command each time an answer is ready (`--once`) |
|
|
178
|
-
| `pickup` / `handoff` | The session-start and next-message hooks |
|
|
179
|
-
| `stopcheck` | The Stop hook: items for you left only in chat |
|
|
180
|
-
| `uninstall` | Remove what `init` added, and sign out |
|
|
228
|
+
| `pickup` / `handoff` | The session-start and next-message hooks (`--app`) |
|
|
229
|
+
| `stopcheck` | The Stop hook: items for you left only in chat (`--app`) |
|
|
230
|
+
| `uninstall` | Remove what `init` added, and sign out (`--app`) |
|
|
231
|
+
| `mcp --app <app>` | Not yet: a stdio MCP server for an agent that can't run a headers helper |
|
|
181
232
|
|
|
182
|
-
Every command takes `--origin` (default `https://www.pendingyou.com`, or `$PENDINGYOU_ORIGIN`).
|
|
183
|
-
|
|
233
|
+
Every command takes `--origin` (default `https://www.pendingyou.com`, or `$PENDINGYOU_ORIGIN`). `--app` takes
|
|
234
|
+
`claude-code` or `codex` (several with commas where a command sets up or reports several); with none, a command that
|
|
235
|
+
acts for one agent acts for Claude Code. Options can come before or after the command.
|
|
184
236
|
|
|
185
237
|
## What it can see, and where it keeps things
|
|
186
238
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
239
|
+
Each agent's sign-in is that agent's own connection on Pending You, signed in from this computer: it can post cards,
|
|
240
|
+
change or cancel its own, read the answers to them and reply in their threads, and it can't answer anything for you.
|
|
241
|
+
The hooks use the same sign-in, and hand a session only the cards its own app posted from its folder. An agent that
|
|
242
|
+
signs in by itself (`--oauth`, or one you kept) gets a sign-in that only hears its answers instead: it can't ask,
|
|
243
|
+
answer or change anything, and doesn't show up as an assistant. They're stored in `~/.config/pendingyou/credentials.json`
|
|
244
|
+
(readable only by you, in a folder with a `.gitignore` of `*` so a dotfiles repository never takes it), refresh
|
|
245
|
+
themselves, and end after 30 days or on `logout`. The headers helper hands an agent's token only to that agent's
|
|
246
|
+
Pending You (Claude Code says which server it's for; Codex's is the one `init` wrote). `clients.json` remembers which
|
|
247
|
+
sign-in each agent's connection used, so signing in again keeps it.
|
|
248
|
+
|
|
249
|
+
`state.json` beside them remembers which answers were already handed over (ids only) and how many session starts
|
|
250
|
+
reminded an unfinished setup; `claude-code.json` and `codex.json` what `init` added; `codex-threads.json` which cards
|
|
251
|
+
each Codex thread waits on (ids, names and titles: never an answer); and `cli/` the hooks' copy of the command line.
|
|
252
|
+
`init`, `status` and the hooks read `~/.claude.json` (and a folder's `.mcp.json`, and `~/.claude/settings.json`'s
|
|
253
|
+
enabled plugins) and `~/.codex/config.toml` only to see whether the agent has a `pendingyou` MCP server and where it
|
|
254
|
+
points. Nothing is sent anywhere but Pending You.
|
|
197
255
|
|
|
198
256
|
The wake mod runs inside Claude Code and reaches Pending You only through the session's own connection, with
|
|
199
|
-
`get_request` on the session's own cards
|
|
200
|
-
|
|
201
|
-
It marks the copy acting for a session in
|
|
257
|
+
`get_request` on the session's own cards (and, in `init`'s copy, `whoami` to see whether setup is finished). It keeps
|
|
258
|
+
each session's cards (id, title, the agent's name, where each stands) in Claude Code's store for mods,
|
|
259
|
+
`~/.claude/plugins/store/`, and forgets them once they close or after 7 days. It marks the copy acting for a session in
|
|
260
|
+
that session's environment (`PENDINGYOU_WAKE_OWNER`).
|
|
202
261
|
|
|
203
262
|
## Development
|
|
204
263
|
|
package/dist/api.js
CHANGED
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
// a hook that needs a new token starts `pendingyou refresh` detached (background), which runs to the end under the
|
|
10
10
|
// lock whatever happens to the hook, and waits for it only briefly; until it lands the hook uses the token it has, or
|
|
11
11
|
// gives up and prints its plain fallback.
|
|
12
|
+
//
|
|
13
|
+
// Since 0.11.0 each app has its own sign-in (credentials.ts), and every call names the app it's for: its sign-in is
|
|
14
|
+
// the one used, and a session's request names it as `source` (routing by sender, 2026-10-04), so Pending You returns
|
|
15
|
+
// only that app's cards, never one Codex posted from the same folder to a Claude Code session there. `watch` names no
|
|
16
|
+
// app: it hands answers to a script, not a session, with Claude Code's sign-in as before.
|
|
17
|
+
import { DEFAULT_APP } from "./apps/ids.js";
|
|
12
18
|
import { credentialsPath, readCredential, updateCredential, } from "./credentials.js";
|
|
13
19
|
import { isLocked } from "./files.js";
|
|
14
20
|
import { OAuthError, refresh } from "./oauth.js";
|
|
15
|
-
/**
|
|
16
|
-
* The app whose sessions the command line hands answers to: its hooks and holds run in Claude Code. Routing by sender
|
|
17
|
-
* (2026-10-04): every request for a session names it, so Pending You returns only Claude Code's cards, never one Codex
|
|
18
|
-
* or another app posted from the same folder. `watch` names none: it hands answers to a script, not a session.
|
|
19
|
-
*/
|
|
20
|
-
export const SESSION_APP = 'claude-code';
|
|
21
21
|
/** Refresh this long before the access token runs out. */
|
|
22
22
|
const EARLY_MS = 60_000;
|
|
23
23
|
/** A hook starts a background refresh this long before the access token runs out, and goes on with the old one. */
|
|
@@ -49,7 +49,7 @@ export class Unavailable extends Error {
|
|
|
49
49
|
* Refreshes the sign-in under the lock unless it no longer needs it: a token with more than `earlyMs` left (or, when
|
|
50
50
|
* `force`d after a 401, a refresh token another process already replaced) is used as it is.
|
|
51
51
|
*/
|
|
52
|
-
async function refreshStored(io, origin, stored, options) {
|
|
52
|
+
async function refreshStored(io, origin, stored, options, app) {
|
|
53
53
|
let ended = false;
|
|
54
54
|
const updated = await updateCredential(io, origin, async (current) => {
|
|
55
55
|
if (!current)
|
|
@@ -71,35 +71,43 @@ async function refreshStored(io, origin, stored, options) {
|
|
|
71
71
|
}
|
|
72
72
|
throw error;
|
|
73
73
|
}
|
|
74
|
-
});
|
|
74
|
+
}, app);
|
|
75
75
|
if (!updated)
|
|
76
76
|
throw new SignInNeeded(ended);
|
|
77
77
|
return updated;
|
|
78
78
|
}
|
|
79
|
-
async function freshToken(io, origin, force) {
|
|
80
|
-
const stored = await readCredential(io, origin);
|
|
79
|
+
async function freshToken(io, origin, force, app) {
|
|
80
|
+
const stored = await readCredential(io, origin, app);
|
|
81
81
|
if (!stored)
|
|
82
82
|
throw new SignInNeeded(false);
|
|
83
83
|
if (!force && stored.expiresAt - EARLY_MS > io.now())
|
|
84
84
|
return stored.accessToken;
|
|
85
|
-
return (await refreshStored(io, origin, stored, { force, earlyMs: EARLY_MS })).accessToken;
|
|
85
|
+
return (await refreshStored(io, origin, stored, { force, earlyMs: EARLY_MS }, app)).accessToken;
|
|
86
86
|
}
|
|
87
|
+
/** What a process starts to refresh an app's sign-in in the background: `--app` only for an app but Claude Code. */
|
|
88
|
+
export const refreshArgs = (origin, app, force = false) => [
|
|
89
|
+
'refresh',
|
|
90
|
+
'--origin',
|
|
91
|
+
origin,
|
|
92
|
+
...(app === DEFAULT_APP ? [] : ['--app', app]),
|
|
93
|
+
...(force ? ['--force'] : []),
|
|
94
|
+
];
|
|
87
95
|
/**
|
|
88
96
|
* `pendingyou refresh`, what a hook starts in the background: refreshes the sign-in when it runs out within SOON_MS
|
|
89
97
|
* (or `force`, after a 401), under the lock, to the end. Quiet; true when there's a sign-in afterwards.
|
|
90
98
|
*/
|
|
91
|
-
export async function refreshInBackground(io, origin, force) {
|
|
92
|
-
const stored = await readCredential(io, origin);
|
|
99
|
+
export async function refreshInBackground(io, origin, force, app = DEFAULT_APP) {
|
|
100
|
+
const stored = await readCredential(io, origin, app);
|
|
93
101
|
if (!stored)
|
|
94
102
|
return false;
|
|
95
103
|
if (!force && stored.expiresAt - SOON_MS > io.now())
|
|
96
104
|
return true;
|
|
97
|
-
await refreshStored(io, origin, stored, { force, earlyMs: SOON_MS });
|
|
105
|
+
await refreshStored(io, origin, stored, { force, earlyMs: SOON_MS }, app);
|
|
98
106
|
return true;
|
|
99
107
|
}
|
|
100
108
|
/** A hook's token: never refreshed here (see the top of this file). */
|
|
101
|
-
async function hookToken(io, origin, force, signal) {
|
|
102
|
-
const stored = await readCredential(io, origin);
|
|
109
|
+
async function hookToken(io, origin, force, signal, app) {
|
|
110
|
+
const stored = await readCredential(io, origin, app);
|
|
103
111
|
if (!stored)
|
|
104
112
|
throw new SignInNeeded(false);
|
|
105
113
|
const left = stored.expiresAt - io.now();
|
|
@@ -107,14 +115,14 @@ async function hookToken(io, origin, force, signal) {
|
|
|
107
115
|
return stored.accessToken;
|
|
108
116
|
// One refresher at a time: a lock held now is a refresh (or a write) already under way.
|
|
109
117
|
if (!(await isLocked(credentialsPath(io))))
|
|
110
|
-
io.background(
|
|
118
|
+
io.background(refreshArgs(origin, app, force));
|
|
111
119
|
// Still good for a few seconds: this request goes with it, the next one with the new token.
|
|
112
120
|
if (!force && left > USABLE_MS)
|
|
113
121
|
return stored.accessToken;
|
|
114
122
|
const until = io.now() + REFRESH_WAIT_MS;
|
|
115
123
|
while (io.now() < until && !signal?.aborted) {
|
|
116
124
|
await io.sleep(50, signal);
|
|
117
|
-
const current = await readCredential(io, origin);
|
|
125
|
+
const current = await readCredential(io, origin, app);
|
|
118
126
|
if (!current)
|
|
119
127
|
throw new SignInNeeded(true);
|
|
120
128
|
if (current.refreshToken !== stored.refreshToken)
|
|
@@ -123,23 +131,23 @@ async function hookToken(io, origin, force, signal) {
|
|
|
123
131
|
throw new Unavailable('The sign-in is being refreshed in the background.');
|
|
124
132
|
}
|
|
125
133
|
/**
|
|
126
|
-
* The token `pendingyou mcp-headers` hands
|
|
127
|
-
* and gives it 10 seconds, so, as for a hook, a refresh is never made in this process: within 5 minutes of
|
|
128
|
-
* starts `pendingyou refresh` detached and waits for its token, up to `waitMs`, then uses the old one while it
|
|
129
|
-
* works. A token handed over has at least 10 seconds left;
|
|
134
|
+
* The token `pendingyou mcp-headers` hands an app's MCP server (remote.ts). The app runs the helper each time it
|
|
135
|
+
* connects and gives it 10 seconds, so, as for a hook, a refresh is never made in this process: within 5 minutes of
|
|
136
|
+
* expiry it starts `pendingyou refresh` detached and waits for its token, up to `waitMs`, then uses the old one while it
|
|
137
|
+
* still works. A token handed over has at least 10 seconds left; the app runs the helper again on a 401.
|
|
130
138
|
*/
|
|
131
|
-
export async function helperToken(io, origin, waitMs) {
|
|
132
|
-
const stored = await readCredential(io, origin);
|
|
139
|
+
export async function helperToken(io, origin, waitMs, app = DEFAULT_APP) {
|
|
140
|
+
const stored = await readCredential(io, origin, app);
|
|
133
141
|
if (!stored)
|
|
134
142
|
throw new SignInNeeded(false);
|
|
135
143
|
if (stored.expiresAt - io.now() > SOON_MS)
|
|
136
144
|
return stored.accessToken;
|
|
137
145
|
if (!(await isLocked(credentialsPath(io))))
|
|
138
|
-
io.background(
|
|
146
|
+
io.background(refreshArgs(origin, app));
|
|
139
147
|
const until = io.now() + waitMs;
|
|
140
148
|
while (io.now() < until) {
|
|
141
149
|
await io.sleep(100);
|
|
142
|
-
const current = await readCredential(io, origin);
|
|
150
|
+
const current = await readCredential(io, origin, app);
|
|
143
151
|
if (!current)
|
|
144
152
|
throw new SignInNeeded(true);
|
|
145
153
|
if (current.refreshToken !== stored.refreshToken)
|
|
@@ -163,17 +171,19 @@ function either(signal, ms) {
|
|
|
163
171
|
return controller.signal;
|
|
164
172
|
}
|
|
165
173
|
/**
|
|
166
|
-
* GETs `path` on `origin` as the command line,
|
|
167
|
-
* the sign-in is over (revoked, or 30 days passed). Network
|
|
174
|
+
* GETs `path` on `origin` as the command line, with an app's sign-in (Claude Code's unless `app` says), and returns the
|
|
175
|
+
* JSON body with its status. 401 after a refresh means the sign-in is over (revoked, or 30 days passed). Network
|
|
176
|
+
* failures and 5xx are `Unavailable`.
|
|
168
177
|
*/
|
|
169
178
|
export async function getJson(io, origin, path, timeoutMs, signal, options = {}) {
|
|
179
|
+
const app = options.app ?? DEFAULT_APP;
|
|
170
180
|
for (let attempt = 0;; attempt++) {
|
|
171
181
|
let token;
|
|
172
182
|
try {
|
|
173
183
|
token =
|
|
174
184
|
options.hook && io.background
|
|
175
|
-
? await hookToken(io, origin, attempt > 0, signal)
|
|
176
|
-
: await freshToken(io, origin, attempt > 0);
|
|
185
|
+
? await hookToken(io, origin, attempt > 0, signal, app)
|
|
186
|
+
: await freshToken(io, origin, attempt > 0, app);
|
|
177
187
|
}
|
|
178
188
|
catch (error) {
|
|
179
189
|
if (error instanceof Unavailable)
|
|
@@ -198,7 +208,7 @@ export async function getJson(io, origin, path, timeoutMs, signal, options = {})
|
|
|
198
208
|
await response.body?.cancel();
|
|
199
209
|
if (attempt === 0)
|
|
200
210
|
continue;
|
|
201
|
-
await updateCredential(io, origin, () => null);
|
|
211
|
+
await updateCredential(io, origin, () => null, app);
|
|
202
212
|
throw new SignInNeeded(true);
|
|
203
213
|
}
|
|
204
214
|
if (response.status >= 500 || response.status === 429) {
|