@paigy/mcp 0.40.0 → 0.40.2
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 +43 -30
- package/dist/{chunk-FYH6FW2D.js → chunk-647HS22P.js} +6 -91
- package/dist/{chunk-BOLKVO6W.js → chunk-BUTCP2ED.js} +1 -1
- package/dist/{chunk-DM6YPBQH.js → chunk-FFI3AIZE.js} +703 -644
- package/dist/{chunk-CWGZVTPZ.js → chunk-YJEJZT56.js} +832 -1108
- package/dist/enable.js +3 -3
- package/dist/index.js +11 -153
- package/dist/listen.js +34 -82
- package/dist/onboard.js +4 -4
- package/dist/slot.js +1 -1
- package/dist/statusline.js +4 -2
- package/package.json +12 -13
- package/dist/chunk-2SWUY5WK.js +0 -57
package/dist/enable.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
PAIGY_TOOL_IDS,
|
|
4
4
|
enablePaigyTools
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-647HS22P.js";
|
|
6
|
+
import "./chunk-FFI3AIZE.js";
|
|
7
|
+
import "./chunk-YJEJZT56.js";
|
|
8
8
|
|
|
9
9
|
// src/enable.ts
|
|
10
10
|
function main() {
|
package/dist/index.js
CHANGED
|
@@ -1,74 +1,44 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
awaitMessage,
|
|
4
|
-
contactMessage,
|
|
5
|
-
waitNow
|
|
6
|
-
} from "./chunk-2SWUY5WK.js";
|
|
7
2
|
import {
|
|
8
3
|
clearPairing,
|
|
9
4
|
joinBackgroundPair,
|
|
10
5
|
resolvePairing,
|
|
11
6
|
startPairing,
|
|
12
7
|
suggestedAgentName
|
|
13
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-BUTCP2ED.js";
|
|
14
9
|
import {
|
|
15
|
-
AnswerCallerQuestionSchema,
|
|
16
|
-
ClaimGoalSchema,
|
|
17
10
|
ENABLE_COMMAND,
|
|
18
|
-
GetThreadSchema,
|
|
19
11
|
OnboardSchema,
|
|
20
12
|
PAIGY_TOOL_IDS,
|
|
21
13
|
PairSchema,
|
|
22
14
|
SERVER_INSTRUCTIONS,
|
|
23
|
-
SearchThreadsSchema,
|
|
24
|
-
SetTaskStateToolSchema,
|
|
25
15
|
TOOLS,
|
|
26
|
-
UpdateGoalToolSchema,
|
|
27
16
|
autoConfigureClients,
|
|
28
17
|
claudeInstallHint,
|
|
29
18
|
paigyToolsAllowlisted
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
import
|
|
32
|
-
CreateGoalSchema,
|
|
33
|
-
HandoffSchema
|
|
34
|
-
} from "./chunk-DM6YPBQH.js";
|
|
19
|
+
} from "./chunk-647HS22P.js";
|
|
20
|
+
import "./chunk-FFI3AIZE.js";
|
|
35
21
|
import {
|
|
36
22
|
clearSurface,
|
|
37
23
|
writeSurface
|
|
38
24
|
} from "./chunk-3SVNPJPN.js";
|
|
39
25
|
import {
|
|
40
26
|
AGENT_NAME,
|
|
41
|
-
NotifyRequestSchema,
|
|
42
|
-
ScheduleCallbackSchema,
|
|
43
|
-
SetWorkStateSchema,
|
|
44
27
|
UnpairedError,
|
|
45
|
-
answerCallerQuestion,
|
|
46
|
-
awaitReply2,
|
|
47
|
-
checkReplies,
|
|
48
|
-
claimGoal,
|
|
49
|
-
contactParentId,
|
|
50
|
-
createGoal,
|
|
51
28
|
deleteKeyFile,
|
|
52
29
|
deleteToken,
|
|
53
|
-
getThread,
|
|
54
|
-
handoff,
|
|
55
30
|
hatch,
|
|
56
31
|
heartbeat,
|
|
57
32
|
listSlots,
|
|
58
33
|
overrideToken,
|
|
59
34
|
readToken,
|
|
60
35
|
revokeToken,
|
|
36
|
+
runTool,
|
|
61
37
|
saveToken,
|
|
62
|
-
scheduleCallback,
|
|
63
|
-
searchThreads,
|
|
64
38
|
setIdentity,
|
|
65
|
-
setTaskState,
|
|
66
|
-
setWorkState,
|
|
67
39
|
slotName,
|
|
68
|
-
submitNotification,
|
|
69
|
-
updateGoal,
|
|
70
40
|
whoAmI
|
|
71
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-YJEJZT56.js";
|
|
72
42
|
|
|
73
43
|
// src/index.ts
|
|
74
44
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
@@ -77,36 +47,8 @@ import {
|
|
|
77
47
|
CallToolRequestSchema,
|
|
78
48
|
ListToolsRequestSchema
|
|
79
49
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
80
|
-
import { execSync } from "child_process";
|
|
81
50
|
import qrcode from "qrcode-generator";
|
|
82
51
|
var JOIN_CAP_MS = 45e3;
|
|
83
|
-
function fixAndRetry(err) {
|
|
84
|
-
const msg = String(err?.message ?? err);
|
|
85
|
-
const m = msg.match(/^notify failed: 422 (\{[\s\S]*\})$/);
|
|
86
|
-
if (!m) return null;
|
|
87
|
-
try {
|
|
88
|
-
const body = JSON.parse(m[1]);
|
|
89
|
-
return body.error === "fix_and_retry" ? { error: "fix_and_retry", problems: body.problems ?? [] } : null;
|
|
90
|
-
} catch {
|
|
91
|
-
return null;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function detectGit() {
|
|
95
|
-
const run = (cmd) => {
|
|
96
|
-
try {
|
|
97
|
-
return execSync(cmd, { stdio: ["ignore", "pipe", "ignore"], encoding: "utf8" }).trim();
|
|
98
|
-
} catch {
|
|
99
|
-
return "";
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
const remote = run("git remote get-url origin");
|
|
103
|
-
const match = remote.match(/[:/]([^/:]+\/[^/]+?)(?:\.git)?$/);
|
|
104
|
-
const branch = run("git rev-parse --abbrev-ref HEAD");
|
|
105
|
-
return {
|
|
106
|
-
repo: match ? match[1] : void 0,
|
|
107
|
-
branch: branch && branch !== "HEAD" ? branch : void 0
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
52
|
function pairedResult(token, sas, note, e2ee) {
|
|
111
53
|
clearSurface();
|
|
112
54
|
const base = {
|
|
@@ -379,97 +321,13 @@ async function handleTool(request, signal) {
|
|
|
379
321
|
}]
|
|
380
322
|
};
|
|
381
323
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
const args = request.params.arguments ?? {};
|
|
389
|
-
if (typeof args.wait === "string" && args.ask === void 0) {
|
|
390
|
-
const item = await awaitReply2(args.wait, { ...signal ? { signal } : {} });
|
|
391
|
-
return { content: [{ type: "text", text: JSON.stringify({ ...item, message: awaitMessage(item) }) }] };
|
|
392
|
-
}
|
|
393
|
-
const parsed = NotifyRequestSchema.parse(request.params.arguments);
|
|
394
|
-
const git = detectGit();
|
|
395
|
-
const enriched = {
|
|
396
|
-
...parsed,
|
|
397
|
-
repo: parsed.repo ?? git.repo,
|
|
398
|
-
branch: parsed.branch ?? git.branch,
|
|
399
|
-
// THREAD-SCOPED IDENTITY (stage 3, identity-ownership-design.md). A worker subagent
|
|
400
|
-
// shares the parent's identity/slot, so its requests would otherwise scatter across
|
|
401
|
-
// fresh threads and mix with a sibling's. Default an unthreaded contact to THIS
|
|
402
|
-
// subagent's own thread so its requests group and siblings never collide. An explicit
|
|
403
|
-
// parentId (continuing a specific conversation) always wins; a top-level parent session
|
|
404
|
-
// is left untouched (undefined ⇒ the server mints a fresh thread, exactly as today).
|
|
405
|
-
parentId: contactParentId(parsed.parentId)
|
|
406
|
-
};
|
|
407
|
-
let result;
|
|
408
|
-
try {
|
|
409
|
-
result = await submitNotification(enriched);
|
|
410
|
-
} catch (err) {
|
|
411
|
-
const fixable = fixAndRetry(err);
|
|
412
|
-
if (fixable) return { isError: true, content: [{ type: "text", text: JSON.stringify(fixable) }] };
|
|
413
|
-
throw err;
|
|
414
|
-
}
|
|
415
|
-
const sentAs = slotName(AGENT_NAME);
|
|
416
|
-
const shown = waitNow(result) ? await (async () => {
|
|
417
|
-
const wait = await awaitReply2(result.notificationId, { ...signal ? { signal } : {} });
|
|
418
|
-
return { ...result, wait, message: awaitMessage(wait) };
|
|
419
|
-
})() : { ...result, message: contactMessage(result) };
|
|
420
|
-
return { content: [{ type: "text", text: JSON.stringify(sentAs ? { ...shown, sentAs } : shown) }] };
|
|
421
|
-
}
|
|
422
|
-
case "check_replies": {
|
|
423
|
-
const result = await checkReplies();
|
|
424
|
-
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
425
|
-
}
|
|
426
|
-
case "get_thread": {
|
|
427
|
-
const { parentId } = GetThreadSchema.parse(request.params.arguments);
|
|
428
|
-
return { content: [{ type: "text", text: JSON.stringify(await getThread(parentId)) }] };
|
|
429
|
-
}
|
|
430
|
-
case "search_threads": {
|
|
431
|
-
const { q } = SearchThreadsSchema.parse(request.params.arguments);
|
|
432
|
-
return { content: [{ type: "text", text: JSON.stringify(await searchThreads(q)) }] };
|
|
433
|
-
}
|
|
434
|
-
case "answer_caller_question": {
|
|
435
|
-
const { notificationId, answer } = AnswerCallerQuestionSchema.parse(request.params.arguments);
|
|
436
|
-
const result = await answerCallerQuestion(notificationId, answer);
|
|
437
|
-
return { content: [{ type: "text", text: JSON.stringify({
|
|
438
|
-
...result,
|
|
439
|
-
...result.live ? {} : { note: "The call already ended \u2014 send this as a threaded contact instead so the answer still reaches them." }
|
|
440
|
-
}) }] };
|
|
441
|
-
}
|
|
442
|
-
case "set_task_state": {
|
|
443
|
-
const { notificationId, state } = SetTaskStateToolSchema.parse(request.params.arguments);
|
|
444
|
-
const result = await setTaskState(notificationId, state);
|
|
445
|
-
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
446
|
-
}
|
|
447
|
-
case "set_work_state": {
|
|
448
|
-
const result = await setWorkState(SetWorkStateSchema.parse(request.params.arguments));
|
|
449
|
-
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
450
|
-
}
|
|
451
|
-
case "create_goal": {
|
|
452
|
-
const result = await createGoal(CreateGoalSchema.parse(request.params.arguments));
|
|
453
|
-
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
454
|
-
}
|
|
455
|
-
case "claim_goal": {
|
|
456
|
-
const { goalId } = ClaimGoalSchema.parse(request.params.arguments);
|
|
457
|
-
return { content: [{ type: "text", text: JSON.stringify(await claimGoal(goalId)) }] };
|
|
458
|
-
}
|
|
459
|
-
case "update_goal": {
|
|
460
|
-
const { goalId, ...input } = UpdateGoalToolSchema.parse(request.params.arguments);
|
|
461
|
-
return { content: [{ type: "text", text: JSON.stringify(await updateGoal(goalId, input)) }] };
|
|
462
|
-
}
|
|
463
|
-
case "schedule_callback": {
|
|
464
|
-
const result = await scheduleCallback(ScheduleCallbackSchema.parse(request.params.arguments));
|
|
465
|
-
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
466
|
-
}
|
|
467
|
-
case "handoff": {
|
|
468
|
-
const result = await handoff(HandoffSchema.parse(request.params.arguments));
|
|
469
|
-
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
324
|
+
default: {
|
|
325
|
+
const name = request.params.name;
|
|
326
|
+
const result = await runTool(name, request.params.arguments ?? {}, { waits: true, signal });
|
|
327
|
+
const sentAs = name === "contact" ? slotName(AGENT_NAME) : null;
|
|
328
|
+
const shaped = sentAs && result && typeof result === "object" ? { ...result, sentAs } : result;
|
|
329
|
+
return { content: [{ type: "text", text: JSON.stringify(shaped) }] };
|
|
470
330
|
}
|
|
471
|
-
default:
|
|
472
|
-
throw new Error(`Unknown tool: ${request.params.name}`);
|
|
473
331
|
}
|
|
474
332
|
}
|
|
475
333
|
var beatDown = false;
|
package/dist/listen.js
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
entryWords
|
|
4
|
+
} from "./chunk-FFI3AIZE.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
ackReply,
|
|
11
|
-
authToken,
|
|
12
|
-
decodeReply,
|
|
13
|
-
registerDelivery,
|
|
14
|
-
sweepLeased
|
|
15
|
-
} from "./chunk-CWGZVTPZ.js";
|
|
6
|
+
checkReplies,
|
|
7
|
+
getGoal,
|
|
8
|
+
subscribeWake
|
|
9
|
+
} from "./chunk-YJEJZT56.js";
|
|
16
10
|
|
|
17
11
|
// src/listen.ts
|
|
18
|
-
import { createClient } from "@supabase/supabase-js";
|
|
19
12
|
import { spawn } from "child_process";
|
|
20
13
|
import { realpathSync } from "fs";
|
|
21
14
|
import { fileURLToPath } from "url";
|
|
@@ -27,7 +20,7 @@ import { homedir } from "os";
|
|
|
27
20
|
import { join } from "path";
|
|
28
21
|
var LABEL = "ai.paigy.listen";
|
|
29
22
|
function frozenEnv() {
|
|
30
|
-
const keys = ["PAIGY_BACKEND_URL", "PAIGY_ON_WAKE"
|
|
23
|
+
const keys = ["PAIGY_BACKEND_URL", "PAIGY_ON_WAKE"];
|
|
31
24
|
return Object.fromEntries(keys.flatMap((k) => process.env[k] ? [[k, process.env[k]]] : []));
|
|
32
25
|
}
|
|
33
26
|
function renderLaunchd(nodePath, scriptPath, env) {
|
|
@@ -119,89 +112,47 @@ function uninstallService() {
|
|
|
119
112
|
|
|
120
113
|
// src/listen.ts
|
|
121
114
|
var emit = (obj) => void process.stdout.write(JSON.stringify(obj) + "\n");
|
|
122
|
-
function
|
|
123
|
-
|
|
115
|
+
function saidIn(delivery) {
|
|
116
|
+
return delivery.entries.filter((entry) => entry.kind === "contribution").map((entry) => entryWords(entry)).filter(Boolean).join("\n");
|
|
117
|
+
}
|
|
118
|
+
function launchEnv(waiting, reason, goalId) {
|
|
119
|
+
const env = { PAIGY_WORK: JSON.stringify(waiting), PAIGY_EVENT: reason };
|
|
124
120
|
const put = (key, value) => {
|
|
125
121
|
if (value) env[key] = value;
|
|
126
122
|
};
|
|
127
|
-
const
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
if (request) {
|
|
138
|
-
put("PAIGY_THREAD_ID", request.parentId);
|
|
139
|
-
put("PAIGY_PARENT_ID", request.parentId);
|
|
140
|
-
put("PAIGY_NOTIFICATION_ID", request.notificationId);
|
|
141
|
-
put("PAIGY_CONTEXT_THREAD_ID", request.contextParentId);
|
|
142
|
-
put("PAIGY_TEXT", request.text);
|
|
143
|
-
return env;
|
|
144
|
-
}
|
|
145
|
-
const callback = work.owedCallbacks[0];
|
|
146
|
-
if (callback) {
|
|
147
|
-
put("PAIGY_THREAD_ID", callback.parentId);
|
|
148
|
-
put("PAIGY_PARENT_ID", callback.parentId);
|
|
149
|
-
put("PAIGY_TEXT", callback.note);
|
|
150
|
-
}
|
|
123
|
+
const named = goalId ? waiting.deliveries.find((d) => d.goalIds.includes(goalId)) : void 0;
|
|
124
|
+
const lead = named ?? waiting.deliveries[0];
|
|
125
|
+
if (!lead) return env;
|
|
126
|
+
put("PAIGY_THREAD_ID", lead.threadId);
|
|
127
|
+
put("PAIGY_PARENT_ID", lead.threadId);
|
|
128
|
+
put("PAIGY_DELIVERY_ID", lead.deliveryId);
|
|
129
|
+
put("PAIGY_GOAL_ID", waiting.goal?.goalId ?? lead.goalIds[0]);
|
|
130
|
+
put("PAIGY_CONTEXT_THREAD_ID", waiting.goal?.contextThreadId);
|
|
131
|
+
put("PAIGY_TEXT", saidIn(lead) || lead.message);
|
|
151
132
|
return env;
|
|
152
133
|
}
|
|
153
|
-
|
|
154
|
-
async function sweep(reason) {
|
|
134
|
+
async function sweep(reason, goalId) {
|
|
155
135
|
try {
|
|
156
136
|
const cmd = process.env.PAIGY_ON_WAKE;
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const { type: _type, ...reply } = decodeReply({ ...r, type: "reply" });
|
|
166
|
-
return reply;
|
|
167
|
-
})
|
|
168
|
-
};
|
|
169
|
-
emit({ type: "sweep", reason, ...work });
|
|
170
|
-
const inbound = work.replies.length > 0 || work.requests.length > 0;
|
|
171
|
-
const reengage = work.owedCallbacks.length > 0 && (reason === "boot" || reason.includes("callback"));
|
|
172
|
-
if (cmd && (inbound || reengage)) {
|
|
173
|
-
spawn(cmd, { shell: true, stdio: "inherit", env: { ...process.env, ...launchEnv(work, reason) } });
|
|
174
|
-
}
|
|
175
|
-
if (cmd) for (const r of leased) await ackReply({ ...r, type: "reply" }, token);
|
|
176
|
-
if (leased.length === 0) return;
|
|
137
|
+
const { deliveries } = await checkReplies();
|
|
138
|
+
const lead = (goalId ? deliveries.find((d) => d.goalIds.includes(goalId)) : void 0) ?? deliveries[0];
|
|
139
|
+
const leadGoalId = lead?.goalIds[0];
|
|
140
|
+
const goal = leadGoalId ? await getGoal(leadGoalId).then((g) => ({ goalId: leadGoalId, contextThreadId: g.contextThreadId, progress: g.progress })).catch(() => null) : null;
|
|
141
|
+
const waiting = { deliveries, goal };
|
|
142
|
+
emit({ type: "sweep", reason, ...goalId ? { about: goalId } : {}, ...waiting });
|
|
143
|
+
if (cmd && deliveries.length) {
|
|
144
|
+
spawn(cmd, { shell: true, stdio: "inherit", env: { ...process.env, ...launchEnv(waiting, reason, goalId) } });
|
|
177
145
|
}
|
|
178
146
|
} catch (e) {
|
|
179
147
|
emit({ type: "error", reason, message: e.message });
|
|
180
148
|
}
|
|
181
149
|
}
|
|
182
150
|
async function main() {
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
const anonKey = cfg.realtime?.anonKey ?? process.env.PAIGY_SUPABASE_ANON_KEY;
|
|
186
|
-
if (!url || !anonKey) {
|
|
187
|
-
throw new Error(
|
|
188
|
-
"No Realtime credentials \u2014 set SUPABASE_ANON_KEY on the server, or PAIGY_SUPABASE_URL + PAIGY_SUPABASE_ANON_KEY locally."
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
const channel = wakeChannel(cfg.tokenId);
|
|
192
|
-
emit({ type: "listening", channel });
|
|
151
|
+
const sub = await subscribeWake((nudge) => void sweep(`wake:${nudge.kind ?? "?"}`, nudge.parentId));
|
|
152
|
+
emit({ type: "listening", channel: sub.channel });
|
|
193
153
|
await sweep("boot");
|
|
194
|
-
const sb = createClient(url, anonKey, { auth: { persistSession: false } });
|
|
195
|
-
sb.channel(channel).on(
|
|
196
|
-
"broadcast",
|
|
197
|
-
{ event: WAKE_EVENT },
|
|
198
|
-
(msg) => void sweep(`wake:${msg.payload?.kind ?? "?"}`)
|
|
199
|
-
).subscribe();
|
|
200
154
|
const shutdown = async () => {
|
|
201
|
-
|
|
202
|
-
await registerDelivery("poll");
|
|
203
|
-
} catch {
|
|
204
|
-
}
|
|
155
|
+
await sub.close();
|
|
205
156
|
process.exit(0);
|
|
206
157
|
};
|
|
207
158
|
process.on("SIGINT", () => void shutdown());
|
|
@@ -231,5 +182,6 @@ if (isEntry()) {
|
|
|
231
182
|
}
|
|
232
183
|
export {
|
|
233
184
|
launchEnv,
|
|
185
|
+
saidIn,
|
|
234
186
|
sweep
|
|
235
187
|
};
|
package/dist/onboard.js
CHANGED
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
resolvePairing,
|
|
4
4
|
startPairing,
|
|
5
5
|
suggestedAgentName
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BUTCP2ED.js";
|
|
7
7
|
import {
|
|
8
8
|
autoConfigureClients,
|
|
9
9
|
claudeInstallHint,
|
|
10
10
|
openBrowser
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-647HS22P.js";
|
|
12
|
+
import "./chunk-FFI3AIZE.js";
|
|
13
13
|
import {
|
|
14
14
|
AGENT_NAME,
|
|
15
15
|
TOKEN_PATH,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
saveToken,
|
|
21
21
|
setIdentity,
|
|
22
22
|
whoAmI
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-YJEJZT56.js";
|
|
24
24
|
|
|
25
25
|
// src/onboard.ts
|
|
26
26
|
function reportRegistered() {
|
package/dist/slot.js
CHANGED
package/dist/statusline.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
readToken,
|
|
10
10
|
sessionSlot,
|
|
11
11
|
slotName
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-YJEJZT56.js";
|
|
13
13
|
|
|
14
14
|
// src/statusline.ts
|
|
15
15
|
import { mkdirSync, readFileSync, realpathSync, writeFileSync } from "fs";
|
|
@@ -35,7 +35,9 @@ function render(v) {
|
|
|
35
35
|
case "session": {
|
|
36
36
|
const who = v.name ? `${v.name} \xB7 ` : "";
|
|
37
37
|
if (!v.status) return `paigy: ${who}revoked`;
|
|
38
|
-
|
|
38
|
+
const n = v.status.waiting ?? 0;
|
|
39
|
+
const waiting = n > 0 ? ` \xB7 ${n} waiting` : "";
|
|
40
|
+
return `paigy: ${who}${MODE_LABEL[v.status.sessionMode]} \xB7 ${v.status.phone ? "phone \u2713" : "no phone"}${waiting}`;
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paigy/mcp",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.2",
|
|
4
4
|
"description": "Paigy MCP server — the AI agent harness that calls you. Lets an agent notify a user and await their reply.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -24,13 +24,6 @@
|
|
|
24
24
|
"url": "git+https://github.com/mauurda/paigy.git",
|
|
25
25
|
"directory": "apps/mcp"
|
|
26
26
|
},
|
|
27
|
-
"scripts": {
|
|
28
|
-
"build": "tsup",
|
|
29
|
-
"dev": "tsup --watch",
|
|
30
|
-
"typecheck": "tsc --noEmit",
|
|
31
|
-
"test": "vitest run",
|
|
32
|
-
"prepublishOnly": "pnpm --filter @paigy/schema build && pnpm --filter @paigy/crypto build && pnpm --filter @paigy/sdk build && pnpm build"
|
|
33
|
-
},
|
|
34
27
|
"dependencies": {
|
|
35
28
|
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
36
29
|
"@supabase/supabase-js": "^2.47.10",
|
|
@@ -40,13 +33,19 @@
|
|
|
40
33
|
"zod-to-json-schema": "^3.24.1"
|
|
41
34
|
},
|
|
42
35
|
"devDependencies": {
|
|
43
|
-
"@paigy/crypto": "workspace:*",
|
|
44
|
-
"@paigy/schema": "workspace:*",
|
|
45
|
-
"@paigy/sdk": "workspace:*",
|
|
46
36
|
"@types/node": "^22.0.0",
|
|
47
37
|
"@types/qrcode-generator": "^1.0.6",
|
|
48
38
|
"tsup": "^8.3.5",
|
|
49
39
|
"typescript": "^5.7.2",
|
|
50
|
-
"vitest": "^2.1.8"
|
|
40
|
+
"vitest": "^2.1.8",
|
|
41
|
+
"@paigy/crypto": "0.0.0",
|
|
42
|
+
"@paigy/sdk": "0.2.1",
|
|
43
|
+
"@paigy/schema": "0.0.0"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "tsup",
|
|
47
|
+
"dev": "tsup --watch",
|
|
48
|
+
"typecheck": "tsc --noEmit",
|
|
49
|
+
"test": "vitest run"
|
|
51
50
|
}
|
|
52
|
-
}
|
|
51
|
+
}
|
package/dist/chunk-2SWUY5WK.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// src/message.ts
|
|
2
|
-
function waitNow(result) {
|
|
3
|
-
const units = result.plan?.units ?? [];
|
|
4
|
-
return units.some((unit) => unit.level === "call") || units.length > 0 && units.every((unit) => unit.settled);
|
|
5
|
-
}
|
|
6
|
-
function contactMessage(result) {
|
|
7
|
-
return result.message;
|
|
8
|
-
}
|
|
9
|
-
function answerText(answer) {
|
|
10
|
-
switch (answer.kind) {
|
|
11
|
-
case "text":
|
|
12
|
-
return answer.text;
|
|
13
|
-
case "option":
|
|
14
|
-
return answer.label ?? answer.optionId;
|
|
15
|
-
case "multi":
|
|
16
|
-
case "ranked":
|
|
17
|
-
return (answer.labels ?? answer.optionIds).join(", ");
|
|
18
|
-
case "confirm":
|
|
19
|
-
return answer.approved ? "approved" : "declined";
|
|
20
|
-
case "clarify":
|
|
21
|
-
return answer.chunks.join(" ");
|
|
22
|
-
case "turns":
|
|
23
|
-
return answer.turns.map((turn) => turn.reply).join(" ");
|
|
24
|
-
case "precedent":
|
|
25
|
-
return answer.answer;
|
|
26
|
-
case "ignored":
|
|
27
|
-
return "";
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function awaitMessage(item) {
|
|
31
|
-
switch (item.type) {
|
|
32
|
-
case "partial":
|
|
33
|
-
return `The user is on the call. This is provisional: ${item.turn.reply}`;
|
|
34
|
-
case "idle":
|
|
35
|
-
return item.inFlight === false ? "No call is live for this ask \u2014 it was delivered as a message. The reply arrives through check_replies (or your wake); do not wait on it again." : "Still waiting for the user. Call contact again with only { wait: notificationId } to keep waiting.";
|
|
36
|
-
case "remind":
|
|
37
|
-
return `The user asked to be reminded in ${item.remindInSeconds} seconds. Schedule a wake-up, then call contact again with only { wait: notificationId }.`;
|
|
38
|
-
case "superseded":
|
|
39
|
-
return "This ask was superseded. Stop waiting on it and re-orient on the thread.";
|
|
40
|
-
case "reply": {
|
|
41
|
-
const ended = item.transcript !== void 0 || item.answer.kind === "turns" ? "The call ended. " : "";
|
|
42
|
-
if (item.answer.kind === "option" || item.answer.kind === "multi" || item.answer.kind === "ranked") {
|
|
43
|
-
return `${ended}The user chose ${answerText(item.answer)}.`;
|
|
44
|
-
}
|
|
45
|
-
if (item.answer.kind === "confirm") return `${ended}The user ${answerText(item.answer)}.`;
|
|
46
|
-
if (item.answer.kind === "ignored") return `${ended}The user did not answer.`;
|
|
47
|
-
return `${ended}The user replied: ${answerText(item.answer)}`;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export {
|
|
53
|
-
waitNow,
|
|
54
|
-
contactMessage,
|
|
55
|
-
answerText,
|
|
56
|
-
awaitMessage
|
|
57
|
-
};
|