@paigy/mcp 0.40.1 → 0.40.3

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/README.md CHANGED
@@ -145,42 +145,48 @@ not a compatibility fallback for target MCP tools.
145
145
  no extra setup. Two edges: with `HTTP_PROXY` set, an `http://localhost` backend
146
146
  proxies too unless `NO_PROXY=localhost` (hostname entries work; CIDR ranges are
147
147
  ignored), and `paigy-listen`'s realtime wake channel is a websocket that doesn't
148
- proxy — its REST sweeps do.
148
+ proxy — its REST reads do.
149
149
 
150
150
  ## Wake any harness (`paigy-listen`)
151
151
 
152
152
  `paigy-listen` is the self-hosted push daemon: it subscribes to this connection's
153
- wake channel and sweeps on every nudge. Keep it alive past the terminal with
154
- `paigy-listen --install` (launchd on macOS, systemd user unit on Linux; `--uninstall`
155
- removes it).
153
+ wake channel and reads what is waiting on every nudge. Keep it alive past the terminal
154
+ with `paigy-listen --install` (launchd on macOS, systemd user unit on Linux;
155
+ `--uninstall` removes it).
156
+
157
+ The read is `check_replies` — the open Deliveries addressed to this agent — and it
158
+ **consumes nothing**: no lease, no acknowledgement, and the same read twice returns the
159
+ same list. So the daemon hands the launcher what it found and stops there; claiming is
160
+ the agent's own first act (`claim_goal`), because the daemon shares this machine's
161
+ token with the agent it launches and a second claimer on one identity eats the first
162
+ one's claim.
156
163
 
157
164
  To launch an agent — any agent, not just Claude — when work arrives, set
158
- `PAIGY_ON_WAKE` to a command before `--install`. The sweep has already claimed the
159
- work, so the launcher reads it from the environment rather than calling
160
- `check_replies` again:
165
+ `PAIGY_ON_WAKE` to a command before `--install`:
161
166
 
162
167
  | Variable | What it holds |
163
168
  | --- | --- |
164
- | `PAIGY_WORK` | the whole swept payload as JSON (`replies`, `requests`, `owedCallbacks`, `stalled`, `threads`) |
165
- | `PAIGY_EVENT` | the wake that caused this run — `boot`, `wake:reply`, `cron:callback`… |
166
- | `PAIGY_THREAD_ID` | the thread to continue on |
167
- | `PAIGY_NOTIFICATION_ID` | the notification being answered or acted on (unset for an owed callback) |
168
- | `PAIGY_CONTEXT_THREAD_ID` | a past conversation the user seeded this with — `get_thread` it **first** |
169
- | `PAIGY_TEXT` | what the user said (or the callback note you owe them), in prose |
169
+ | `PAIGY_WORK` | everything the wake found, as JSON (`deliveries`, `goal`) |
170
+ | `PAIGY_EVENT` | the wake that caused this run — `boot`, `wake:reply`, `wake:request`… |
171
+ | `PAIGY_PARENT_ID` | the thread to continue on (`PAIGY_THREAD_ID` is the same value, for existing scripts) |
172
+ | `PAIGY_DELIVERY_ID` | the Delivery being acted on — `contact({deliveryId})` rereads it |
173
+ | `PAIGY_GOAL_ID` | the Goal it belongs to — `claim_goal` it **first** |
174
+ | `PAIGY_CONTEXT_THREAD_ID` | a past conversation this Goal names — `get_thread` it **first** |
175
+ | `PAIGY_TEXT` | what the person said, in prose |
170
176
 
171
177
  Hand `$PAIGY_WORK` to a harness that can read JSON and decide for itself; use the
172
178
  scalars for a plain shell launcher that shouldn't need `jq`. They describe **one**
173
- item — the oldest thread without a turn already in flight — because the queue rail's
174
- contract is one thread at a time. An absent fact is unset rather than empty, so
175
- `${PAIGY_CONTEXT_THREAD_ID:-}` distinguishes "no seed" from "seeded with nothing".
179
+ item — the oldest open Delivery — because the contract is one thread at a time. An
180
+ absent fact is unset rather than empty, so `${PAIGY_CONTEXT_THREAD_ID:-}`
181
+ distinguishes "no seed" from "seeded with nothing".
176
182
 
177
183
  ```sh
178
184
  # Claude Code — hand it everything and let it plan:
179
- PAIGY_ON_WAKE='claude -p "Handle the Paigy work in $PAIGY_WORK — rehydrate threads you do not recognize via get_thread first."' \
185
+ PAIGY_ON_WAKE='claude -p "Handle the Paigy work in $PAIGY_WORK — claim_goal first, and rehydrate threads you do not recognize via get_thread."' \
180
186
  npx -y -p @paigy/mcp paigy-listen --install
181
187
 
182
188
  # Codex (or any CLI harness) — the scalars are enough for a one-liner:
183
- PAIGY_ON_WAKE='codex exec "Continue Paigy thread $PAIGY_THREAD_ID. The user said: $PAIGY_TEXT. Call get_thread on it first if you do not recognize it, then reply with contact."' \
189
+ PAIGY_ON_WAKE='codex exec "Claim Paigy goal $PAIGY_GOAL_ID and continue thread $PAIGY_THREAD_ID. The user said: $PAIGY_TEXT. Reply with contact."' \
184
190
  npx -y -p @paigy/mcp paigy-listen --install
185
191
  ```
186
192
 
@@ -194,10 +200,7 @@ script and branch on `$PAIGY_EVENT` there:
194
200
  seed=""
195
201
  [ -n "${PAIGY_CONTEXT_THREAD_ID:-}" ] && seed="It continues thread $PAIGY_CONTEXT_THREAD_ID — get_thread that first."
196
202
 
197
- case "$PAIGY_EVENT" in
198
- cron:callback*) codex exec "You owe the user a callback on thread $PAIGY_THREAD_ID: $PAIGY_TEXT. Deliver it with contact." ;;
199
- *) codex exec "Paigy thread $PAIGY_THREAD_ID. The user said: $PAIGY_TEXT. $seed Reply with contact when done." ;;
200
- esac
203
+ codex exec "Paigy goal $PAIGY_GOAL_ID on thread $PAIGY_THREAD_ID. claim_goal it first. The user said: $PAIGY_TEXT. $seed Reply with contact when done."
201
204
  ```
202
205
 
203
206
  ## Statusline (Claude Code)
@@ -2,10 +2,10 @@ import {
2
2
  AGENT_TOOLS,
3
3
  mcpInputSchema,
4
4
  serverInstructions
5
- } from "./chunk-3QUIB42M.js";
5
+ } from "./chunk-V3VVCML7.js";
6
6
  import {
7
7
  AGENT_NAME
8
- } from "./chunk-4UZAPBKK.js";
8
+ } from "./chunk-6QQHTUKJ.js";
9
9
 
10
10
  // src/toolset.ts
11
11
  var ONBOARD_DESCRIPTION = "Get this agent talking to Paigy \u2014 call it FIRST, before contact, and any time you're unsure who you are. One call, and it does whatever the situation needs: NOT SET UP \u2192 hatches an identity instantly if this machine holds a device credential (the user ran the Paigy desktop app or harness), otherwise starts the code ceremony; ALREADY SET UP \u2192 returns your current identity and offers the two things left to decide, renaming it or unpairing; TOKEN NO LONGER VALID \u2192 says so, then re-pairs. Pass { name, voice } to choose who you are when hatching, or to RENAME yourself when already set up (voices: rachel, george, jessica, brian, lily). Safe to call any time: idempotent, and it never writes settings \u2014 the tool-allowlist state it reports is read-only. If it returns a `user_code`, print it to the user immediately and call onboard again with the `device_code`. If it returns `enable_command`, PRINT that command for the user to run \u2014 you cannot apply it yourself (it writes your own permission allowlist, which hosts block as privilege escalation), so print it, don't wait for it, and carry on.";