@paigy/mcp 0.40.25 → 0.40.26

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.
@@ -40,6 +40,7 @@ import {
40
40
  pollToken,
41
41
  reach,
42
42
  reachAs,
43
+ readDelivery,
43
44
  readSlot,
44
45
  readToken,
45
46
  receive,
@@ -61,12 +62,11 @@ import {
61
62
  slotName,
62
63
  submitTriage,
63
64
  subscribeWake,
64
- updateGoal,
65
65
  updateSlot,
66
66
  whoAmI,
67
67
  whoIsWorking,
68
68
  withCodexEnv
69
- } from "./chunk-EJYXBEWN.js";
69
+ } from "./chunk-OVSAQW3K.js";
70
70
  export {
71
71
  AGENT_TOOLS,
72
72
  AGENT_TOOL_NAMES,
@@ -109,6 +109,7 @@ export {
109
109
  pollToken,
110
110
  reach,
111
111
  reachAs,
112
+ readDelivery,
112
113
  readSlot,
113
114
  readToken,
114
115
  receive,
@@ -130,7 +131,6 @@ export {
130
131
  slotName,
131
132
  submitTriage,
132
133
  subscribeWake,
133
- updateGoal,
134
134
  updateSlot,
135
135
  whoAmI,
136
136
  whoIsWorking,
package/dist/enable.js CHANGED
@@ -3,9 +3,9 @@ import {
3
3
  PAIGY_TOOL_IDS,
4
4
  enablePaigyTools,
5
5
  installSessionListening
6
- } from "./chunk-UAVXYNLV.js";
7
- import "./chunk-GHSB2VP6.js";
8
- import "./chunk-EJYXBEWN.js";
6
+ } from "./chunk-5MQ3J6S3.js";
7
+ import "./chunk-7LQKX73K.js";
8
+ import "./chunk-OVSAQW3K.js";
9
9
 
10
10
  // src/enable.ts
11
11
  function main() {
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  resolvePairing,
10
10
  startPairing,
11
11
  suggestedAgentName
12
- } from "./chunk-2ROD77AW.js";
12
+ } from "./chunk-BLWC44CQ.js";
13
13
  import {
14
14
  ENABLE_COMMAND,
15
15
  OnboardSchema,
@@ -18,13 +18,14 @@ import {
18
18
  SERVER_INSTRUCTIONS,
19
19
  TOOLS,
20
20
  paigyToolsAllowlisted
21
- } from "./chunk-UAVXYNLV.js";
21
+ } from "./chunk-5MQ3J6S3.js";
22
22
  import {
23
23
  decideListen,
24
24
  existingListener,
25
+ harnessDriven,
25
26
  listenerKey,
26
27
  wakeStatusPath
27
- } from "./chunk-GHSB2VP6.js";
28
+ } from "./chunk-7LQKX73K.js";
28
29
  import {
29
30
  clearSurface,
30
31
  writeSurface
@@ -45,7 +46,7 @@ import {
45
46
  setClient,
46
47
  slotName,
47
48
  whoAmI
48
- } from "./chunk-EJYXBEWN.js";
49
+ } from "./chunk-OVSAQW3K.js";
49
50
 
50
51
  // src/index.ts
51
52
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
@@ -90,6 +91,12 @@ function traceTheTransport(transport2, log) {
90
91
  };
91
92
  }
92
93
 
94
+ // src/unpaired.ts
95
+ function afterUnpaired(hatched, deviceCredential) {
96
+ if (hatched && "ok" in hatched) return "retry";
97
+ return deviceCredential ? "unidentified" : "pair";
98
+ }
99
+
93
100
  // src/index.ts
94
101
  var JOIN_CAP_MS = 45e3;
95
102
  function pairedResult(token, sas, note) {
@@ -253,10 +260,11 @@ server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
253
260
  return await handleTool(request, extra?.signal);
254
261
  } catch (e) {
255
262
  if (e instanceof UnpairedError) {
256
- const IDENTITY_TOOLS = /* @__PURE__ */ new Set(["pair", "onboard", "unpair", "listen"]);
263
+ const IDENTITY_TOOLS = /* @__PURE__ */ new Set(["pair", "onboard", "unpair"]);
257
264
  const hatched = IDENTITY_TOOLS.has(request.params.name) ? null : await hatchUnderDevice();
258
- if (hatched) return await handleTool(request, extra?.signal);
259
- if (listSlots().includes("Desktop")) return unidentifiedResult();
265
+ const next = afterUnpaired(hatched, listSlots().includes("Desktop"));
266
+ if (next === "retry") return await handleTool(request, extra?.signal);
267
+ if (next === "unidentified") return unidentifiedResult();
260
268
  return pairStartResult(await startPairing(suggestedAgentName2()));
261
269
  }
262
270
  throw e;
@@ -349,12 +357,12 @@ async function handleTool(request, signal) {
349
357
  // a live listener's mark for this slot, and where THIS server's node and daemon live. The
350
358
  // daemon is the `listen.js` beside our own entry, so the command never resolves a package.
351
359
  case "listen": {
360
+ if (!harnessDriven(process.env) && !readToken()) throw new UnpairedError();
352
361
  const slot = agentName();
353
362
  const key = listenerKey(slot, process.env);
354
363
  const pid = existingListener(slot, process.env);
355
364
  const decision = decideListen({
356
365
  env: process.env,
357
- token: !!readToken(),
358
366
  pidAlive: pid !== null,
359
367
  wake: readWakeStatus(wakeStatusPath(key)),
360
368
  ...pid !== null ? { pid } : {},
package/dist/listen.js CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  WakeBridge
4
4
  } from "./chunk-RK5LT7NH.js";
5
5
  import {
6
+ entryUnit,
6
7
  entryWords,
7
8
  existingListener,
8
9
  harnessDriven,
@@ -10,16 +11,16 @@ import {
10
11
  removeListenMark,
11
12
  wakeStatusPath,
12
13
  writeListenMark
13
- } from "./chunk-GHSB2VP6.js";
14
+ } from "./chunk-7LQKX73K.js";
14
15
  import {
15
16
  agentName,
16
- contact,
17
17
  getGoal,
18
18
  heartbeat,
19
+ readDelivery,
19
20
  receive,
20
21
  slotName,
21
22
  subscribeWake
22
- } from "./chunk-EJYXBEWN.js";
23
+ } from "./chunk-OVSAQW3K.js";
23
24
 
24
25
  // src/listen.ts
25
26
  import { createHash } from "crypto";
@@ -134,7 +135,7 @@ var emit = (obj) => line(JSON.stringify(obj));
134
135
  var listeningAs = () => slotName(agentName()) ?? agentName();
135
136
  var SWEEP_EVERY_MS = Number(process.env.PAIGY_SWEEP_MS) || 9e4;
136
137
  function saidIn(delivery) {
137
- return ("entries" in delivery ? delivery.entries : []).filter((entry) => entry.kind === "contribution").map((entry) => entryWords(entry)).filter(Boolean).join("\n");
138
+ return ("entries" in delivery ? delivery.entries : []).filter((entry) => entry.kind === "contribution" && !entryUnit(entry)).map((entry) => entryWords(entry)).filter(Boolean).join("\n");
138
139
  }
139
140
  function leadOf(deliveries, goalId) {
140
141
  return (goalId ? deliveries.find((d) => d.goalIds.includes(goalId)) : void 0) ?? deliveries[0];
@@ -171,7 +172,7 @@ async function sweep(reason, goalId, bridge = new WakeBridge(process.env, wakeSt
171
172
  });
172
173
  const { deliveries: rows, stalled, review, assigned } = await receive();
173
174
  const lead = leadOf(rows, goalId);
174
- const full = lead ? await contact({ deliveryId: lead.deliveryId }, { waits: false }).then((d) => "sent" in d ? null : d).catch(() => null) : null;
175
+ const full = lead ? await readDelivery(lead.deliveryId).catch(() => null) : null;
175
176
  const deliveries = rows.map((d) => d === lead && full ? full : d);
176
177
  const leadGoalId = lead?.goalIds[0];
177
178
  const goal = leadGoalId ? await getGoal(leadGoalId).then((g) => ({ goalId: leadGoalId, progress: g.progress })).catch(() => null) : null;
package/dist/onboard.js CHANGED
@@ -3,13 +3,13 @@ import {
3
3
  resolvePairing,
4
4
  startPairing,
5
5
  suggestedAgentName
6
- } from "./chunk-2ROD77AW.js";
6
+ } from "./chunk-BLWC44CQ.js";
7
7
  import {
8
8
  autoConfigureClients,
9
9
  claudeInstallHint,
10
10
  openBrowser
11
- } from "./chunk-UAVXYNLV.js";
12
- import "./chunk-GHSB2VP6.js";
11
+ } from "./chunk-5MQ3J6S3.js";
12
+ import "./chunk-7LQKX73K.js";
13
13
  import {
14
14
  TOKEN_PATH,
15
15
  agentName,
@@ -20,7 +20,7 @@ import {
20
20
  saveToken,
21
21
  setIdentity,
22
22
  whoAmI
23
- } from "./chunk-EJYXBEWN.js";
23
+ } from "./chunk-OVSAQW3K.js";
24
24
 
25
25
  // src/onboard.ts
26
26
  function reportRegistered() {
package/dist/slot.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  agentName
4
- } from "./chunk-EJYXBEWN.js";
4
+ } from "./chunk-OVSAQW3K.js";
5
5
 
6
6
  // src/slot.ts
7
7
  process.stdout.write(agentName());
package/dist/stalled.js CHANGED
@@ -15,7 +15,7 @@ function stopReply(stalled, event = "Stop") {
15
15
  if (!stalled.length) return null;
16
16
  const list = stalled.slice(0, 8).map((g) => `"${g.title}" (${g.goalId})`).join(", ");
17
17
  const more = stalled.length > 8 ? ` and ${stalled.length - 8} more` : "";
18
- const reason = `Before you stop: ${stalled.length} of your Paigy Goals have had no progress for 3 days: ${list}${more}. For each, update_goal with progress, or finish or cancel it with manage_goals.`;
18
+ const reason = `Before you stop: ${stalled.length} of your Paigy Goals have had no progress for 3 days: ${list}${more}. For each, report where it stands with a contact update, or finish or cancel it with manage_goals.`;
19
19
  return event === "AfterAgent" ? { decision: "block", reason, systemMessage: reason } : { decision: "block", reason };
20
20
  }
21
21
  async function main() {
@@ -29,7 +29,7 @@ async function main() {
29
29
  const dir = join(homedir(), ".paigy", "stalled-reminded");
30
30
  const mark = join(dir, `${session || "session"}-${day}`);
31
31
  if (existsSync(mark)) return;
32
- const { receive } = await import("./dist-NMHU2UNG.js");
32
+ const { receive } = await import("./dist-WGFUXFS4.js");
33
33
  const reply = stopReply((await receive()).stalled ?? [], input.hook_event_name ?? "Stop");
34
34
  if (!reply) return;
35
35
  mkdirSync(dir, { recursive: true });
@@ -7,7 +7,7 @@ import {
7
7
  readToken,
8
8
  sessionSlot,
9
9
  slotName
10
- } from "./chunk-EJYXBEWN.js";
10
+ } from "./chunk-OVSAQW3K.js";
11
11
 
12
12
  // src/statusline.ts
13
13
  import { realpathSync } from "fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paigy/mcp",
3
- "version": "0.40.25",
3
+ "version": "0.40.26",
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",