@paigy/mcp 0.40.24 → 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.
@@ -14,14 +14,13 @@ import {
14
14
  TOKEN_PATH,
15
15
  UnpairedError,
16
16
  acceptTriage,
17
+ acknowledge,
17
18
  agentName,
18
19
  authToken,
19
- checkReplies,
20
20
  claimGoal,
21
21
  claimSessionEnds,
22
22
  claimSessions,
23
23
  contact,
24
- createGoal,
25
24
  currentRepo,
26
25
  deleteToken,
27
26
  dismissTriage,
@@ -34,13 +33,18 @@ import {
34
33
  listConnections,
35
34
  listNotes,
36
35
  listSlots,
36
+ manageGoals,
37
37
  overrideToken,
38
38
  parseDue,
39
+ pendingEvents,
39
40
  pollToken,
40
41
  reach,
41
42
  reachAs,
43
+ readDelivery,
42
44
  readSlot,
43
45
  readToken,
46
+ receive,
47
+ receiveContact,
44
48
  recordDecision,
45
49
  registerDelivery,
46
50
  repoFromRemote,
@@ -48,6 +52,7 @@ import {
48
52
  revokeToken,
49
53
  runTool,
50
54
  saveToken,
55
+ searchRecords,
51
56
  sessionId,
52
57
  sessionSlot,
53
58
  setClient,
@@ -57,12 +62,11 @@ import {
57
62
  slotName,
58
63
  submitTriage,
59
64
  subscribeWake,
60
- updateGoal,
61
65
  updateSlot,
62
66
  whoAmI,
63
67
  whoIsWorking,
64
68
  withCodexEnv
65
- } from "./chunk-WR2M3RME.js";
69
+ } from "./chunk-OVSAQW3K.js";
66
70
  export {
67
71
  AGENT_TOOLS,
68
72
  AGENT_TOOL_NAMES,
@@ -79,14 +83,13 @@ export {
79
83
  TOKEN_PATH,
80
84
  UnpairedError,
81
85
  acceptTriage,
86
+ acknowledge,
82
87
  agentName,
83
88
  authToken,
84
- checkReplies,
85
89
  claimGoal,
86
90
  claimSessionEnds,
87
91
  claimSessions,
88
92
  contact,
89
- createGoal,
90
93
  currentRepo,
91
94
  deleteToken,
92
95
  dismissTriage,
@@ -99,13 +102,18 @@ export {
99
102
  listConnections,
100
103
  listNotes,
101
104
  listSlots,
105
+ manageGoals,
102
106
  overrideToken,
103
107
  parseDue,
108
+ pendingEvents,
104
109
  pollToken,
105
110
  reach,
106
111
  reachAs,
112
+ readDelivery,
107
113
  readSlot,
108
114
  readToken,
115
+ receive,
116
+ receiveContact,
109
117
  recordDecision,
110
118
  registerDelivery,
111
119
  repoFromRemote,
@@ -113,6 +121,7 @@ export {
113
121
  revokeToken,
114
122
  runTool,
115
123
  saveToken,
124
+ searchRecords,
116
125
  sessionId,
117
126
  sessionSlot,
118
127
  setClient,
@@ -122,7 +131,6 @@ export {
122
131
  slotName,
123
132
  submitTriage,
124
133
  subscribeWake,
125
- updateGoal,
126
134
  updateSlot,
127
135
  whoAmI,
128
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-J7T3EB5Y.js";
7
- import "./chunk-VUKR2E24.js";
8
- import "./chunk-WR2M3RME.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-TP7DM2MP.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-J7T3EB5Y.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-VUKR2E24.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-WR2M3RME.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-VUKR2E24.js";
14
+ } from "./chunk-7LQKX73K.js";
14
15
  import {
15
16
  agentName,
16
- checkReplies,
17
- contact,
18
17
  getGoal,
19
18
  heartbeat,
19
+ readDelivery,
20
+ receive,
20
21
  slotName,
21
22
  subscribeWake
22
- } from "./chunk-WR2M3RME.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];
@@ -169,9 +170,9 @@ async function sweep(reason, goalId, bridge = new WakeBridge(process.env, wakeSt
169
170
  try {
170
171
  void Promise.resolve().then(() => heartbeat(void 0, { listening: true })).catch(() => {
171
172
  });
172
- const { deliveries: rows, stalled, review, assigned } = await checkReplies();
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;
@@ -200,7 +201,7 @@ async function sweep(reason, goalId, bridge = new WakeBridge(process.env, wakeSt
200
201
  ...(assigned ?? []).map((g) => `assigned:${g.goalId}`),
201
202
  ...!rows.length && !reviews.length && !assigned?.length ? (stalled ?? []).map((g) => `stalled:${g.goalId}:${g.since}`) : []
202
203
  ];
203
- const message = `Paigy has waiting work${goalId ? ` on Goal ${goalId}` : ""}. Read check_replies and the relevant Goal conversation, handle new user input, and acknowledge only evidence actually handled. Preserve this session's current task; do not start unrelated old work. This wake is not new authorization.`;
204
+ const message = `Paigy has waiting work${goalId ? ` on Goal ${goalId}` : ""}. Read contact({ wait: false }) and the relevant Goal conversation, handle new user input, and acknowledge (contact({ ackEventIds })) only events actually handled. Preserve this session's current task; do not start unrelated old work. This wake is not new authorization.`;
204
205
  await bridge.deliver(fingerprints, message, launchEnv(waiting, reason, goalId));
205
206
  } else if (bridge.status().target.kind === "codex") {
206
207
  await bridge.deliver([], "", {});
package/dist/onboard.js CHANGED
@@ -3,13 +3,13 @@ import {
3
3
  resolvePairing,
4
4
  startPairing,
5
5
  suggestedAgentName
6
- } from "./chunk-TP7DM2MP.js";
6
+ } from "./chunk-BLWC44CQ.js";
7
7
  import {
8
8
  autoConfigureClients,
9
9
  claudeInstallHint,
10
10
  openBrowser
11
- } from "./chunk-J7T3EB5Y.js";
12
- import "./chunk-VUKR2E24.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-WR2M3RME.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-WR2M3RME.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, finish it, or cancel it.`;
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,8 +29,8 @@ 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 { checkReplies } = await import("./dist-EKLTLANV.js");
33
- const reply = stopReply((await checkReplies()).stalled ?? [], input.hook_event_name ?? "Stop");
32
+ const { receive } = await import("./dist-WGFUXFS4.js");
33
+ const reply = stopReply((await receive()).stalled ?? [], input.hook_event_name ?? "Stop");
34
34
  if (!reply) return;
35
35
  mkdirSync(dir, { recursive: true });
36
36
  writeFileSync(mark, "");
@@ -7,7 +7,7 @@ import {
7
7
  readToken,
8
8
  sessionSlot,
9
9
  slotName
10
- } from "./chunk-WR2M3RME.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.24",
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",