@paigy/mcp 0.20.0 → 0.22.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.
|
@@ -3243,24 +3243,36 @@ var PROTO = "paigy-pair-v2|sas=24";
|
|
|
3243
3243
|
var SAS_BITS = 24;
|
|
3244
3244
|
var TOKEN_PATH = join(homedir(), ".paigy", "token.json");
|
|
3245
3245
|
var KEY_PATH = join(homedir(), ".paigy", "key.json");
|
|
3246
|
-
|
|
3246
|
+
var SHARED = "*";
|
|
3247
|
+
function readTokenFile() {
|
|
3248
|
+
if (!existsSync(TOKEN_PATH)) return {};
|
|
3249
|
+
try {
|
|
3250
|
+
const parsed = JSON.parse(readFileSync(TOKEN_PATH, "utf8"));
|
|
3251
|
+
if (typeof parsed.access_token === "string") return { [SHARED]: parsed };
|
|
3252
|
+
return parsed;
|
|
3253
|
+
} catch {
|
|
3254
|
+
return {};
|
|
3255
|
+
}
|
|
3256
|
+
}
|
|
3257
|
+
function saveToken(token, agent2 = AGENT_NAME) {
|
|
3258
|
+
const slots = { ...readTokenFile(), [agent2]: token };
|
|
3247
3259
|
mkdirSync(join(homedir(), ".paigy"), { recursive: true });
|
|
3248
|
-
writeFileSync(TOKEN_PATH, JSON.stringify(
|
|
3260
|
+
writeFileSync(TOKEN_PATH, JSON.stringify(slots, null, 2) + "\n", { mode: 384 });
|
|
3249
3261
|
}
|
|
3250
3262
|
var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
3251
|
-
function readToken() {
|
|
3263
|
+
function readToken(agent2 = AGENT_NAME) {
|
|
3252
3264
|
if (process.env.PAIGY_TOKEN) return process.env.PAIGY_TOKEN;
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
return
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
if (
|
|
3263
|
-
|
|
3265
|
+
const slots = readTokenFile();
|
|
3266
|
+
return (slots[agent2] ?? slots[SHARED])?.access_token ?? "";
|
|
3267
|
+
}
|
|
3268
|
+
function deleteToken(agent2 = AGENT_NAME) {
|
|
3269
|
+
const slots = readTokenFile();
|
|
3270
|
+
const removed = agent2 in slots || SHARED in slots;
|
|
3271
|
+
if (!removed) return false;
|
|
3272
|
+
delete slots[agent2];
|
|
3273
|
+
delete slots[SHARED];
|
|
3274
|
+
if (Object.keys(slots).length === 0) rmSync(TOKEN_PATH);
|
|
3275
|
+
else writeFileSync(TOKEN_PATH, JSON.stringify(slots, null, 2) + "\n", { mode: 384 });
|
|
3264
3276
|
return true;
|
|
3265
3277
|
}
|
|
3266
3278
|
async function revokeToken(token) {
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
autoConfigureClients,
|
|
8
8
|
claudeInstallHint,
|
|
9
9
|
enablePaigyTools
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JNQ4KHZA.js";
|
|
11
11
|
import {
|
|
12
12
|
clearSurface,
|
|
13
13
|
writeSurface
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
sleep,
|
|
39
39
|
startE2ee,
|
|
40
40
|
submitNotification
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-XVZDHNKB.js";
|
|
42
42
|
|
|
43
43
|
// src/index.ts
|
|
44
44
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
@@ -267,7 +267,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
267
267
|
tools: [
|
|
268
268
|
{
|
|
269
269
|
name: "pair",
|
|
270
|
-
description: "Pair this agent with the user's Paigy account (one-time) \u2014 required before notify_user/await_reply work. It does NOT open a browser; the user enters the code in the Paigy app (or scans `qr`). Step 1: call with NO args \u2014 returns { user_code, device_code, qr, user_message } AND starts polling for approval in the background.
|
|
270
|
+
description: "Pair this agent with the user's Paigy account (one-time) \u2014 required before notify_user/await_reply work. It does NOT open a browser; the user enters the code in the Paigy app (or scans `qr`). Step 1: call with NO args \u2014 returns { user_code, device_code, qr, user_message } AND starts polling for approval in the background. REQUIRED: You MUST immediately print the `user_message` (the bare code) as a text message to the user, AND in that same turn call step 2 (pair with the device_code). This ensures the user sees the code in chat while the tool blocks/polls in the background for approval. Step 2: call with that device_code to collect the result. Because approval is already being polled in the background, this returns the moment the user approves; on { status:'pending' } just call again to keep waiting; on { status:'awaiting_confirmation' } (E2EE) show the bare `user_message` verify code and call again to finish. The leading text block of every result states the code plainly, so it shows even if you emit no prose. On { status:'paired' } ALWAYS follow the `enable_prompt` \u2014 ask the user to allowlist Paigy's tools so notify/await don't prompt each time.",
|
|
271
271
|
inputSchema: json(PairSchema)
|
|
272
272
|
},
|
|
273
273
|
{
|
|
@@ -382,7 +382,7 @@ Enter it in the Paigy app: Inbox \u2192 Add a new agent.` },
|
|
|
382
382
|
user_message: `# ${code.user_code}
|
|
383
383
|
|
|
384
384
|
Enter it in the Paigy app (Inbox \u2192 Add a new agent).`,
|
|
385
|
-
message: `
|
|
385
|
+
message: `REQUIRED: You MUST immediately print \`user_message\` (the bare code) as a text message to the user, AND in that same turn call pair again with this device_code to poll. Do NOT end your turn without printing the code text, or it will be hidden inside the tool output. Because approval is already polling in the background, this call will wait for the user to approve and then return the token. Do NOT open a browser. The user may prefer scanning \`qr\` (print it verbatim in a fenced code block on request).`
|
|
386
386
|
})
|
|
387
387
|
}
|
|
388
388
|
]
|
package/dist/listen.js
CHANGED
package/dist/onboard.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
autoConfigureClients,
|
|
4
4
|
claudeInstallHint,
|
|
5
5
|
openBrowser
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JNQ4KHZA.js";
|
|
7
7
|
import {
|
|
8
8
|
AGENT_NAME,
|
|
9
9
|
TOKEN_PATH,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
requestCode,
|
|
12
12
|
saveToken,
|
|
13
13
|
sleep
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-XVZDHNKB.js";
|
|
15
15
|
|
|
16
16
|
// src/onboard.ts
|
|
17
17
|
async function main() {
|
package/dist/statusline.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paigy/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Paigy MCP server — a voice inbox for your AI agents. Lets an agent notify a user and await their reply.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"tsup": "^8.3.5",
|
|
37
37
|
"typescript": "^5.7.2",
|
|
38
38
|
"vitest": "^2.1.8",
|
|
39
|
-
"@paigy/sdk": "0.1.0",
|
|
40
39
|
"@paigy/schema": "0.0.0",
|
|
40
|
+
"@paigy/sdk": "0.1.0",
|
|
41
41
|
"@paigy/crypto": "0.0.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|