@paigy/mcp 0.36.0 → 0.37.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.
@@ -42,6 +42,16 @@ var CreateGoalSchema = z.object({
42
42
  idempotencyKey: z.string().trim().min(1).max(200)
43
43
  });
44
44
  var CREATE_GOAL_DESCRIPTION = "Create a durable root Goal for an outcome. Admission only: claim it before doing work, then update its state as it advances. Use a stable idempotencyKey so retries do not create duplicates. Returns goalId, state, revision, ownerParticipant, and next claim_goal.";
45
+ var UpdateGoalSchema = z.object({
46
+ revision: z.number().int().positive(),
47
+ changes: z.object({
48
+ outcome: z.string().trim().min(1).max(1e4).optional(),
49
+ state: z.enum(["active", "waiting", "done", "cancelled"]).optional(),
50
+ progress: z.string().trim().min(1).max(1e4).optional(),
51
+ reviewed: z.literal(true).optional()
52
+ }).refine((v) => Object.keys(v).length > 0),
53
+ reason: z.string().trim().min(1).max(2e3)
54
+ });
45
55
  var fmtMin = (m) => m >= 60 ? `${m / 60} hr` : `${m} min`;
46
56
  var STANDARD_MEANS = (() => {
47
57
  const plan = MISSED_CALL_PLAN.backoff_standard;
@@ -13,10 +13,10 @@ import {
13
13
  SetWorkStateSchema,
14
14
  mcpInputSchema,
15
15
  serverInstructions
16
- } from "./chunk-WNE6STMA.js";
16
+ } from "./chunk-242XN7FD.js";
17
17
  import {
18
18
  AGENT_NAME
19
- } from "./chunk-PRC6GKRN.js";
19
+ } from "./chunk-VXHTA4PB.js";
20
20
 
21
21
  // src/toolset.ts
22
22
  var ONBOARD_DESCRIPTION = "Get this agent talking to Paigy \u2014 call it FIRST, before contact/await_reply, 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.";
@@ -24,9 +24,11 @@ var SERVER_INSTRUCTIONS = serverInstructions({ waits: true });
24
24
 
25
25
  // src/tools.ts
26
26
  import { z } from "zod";
27
+ var UpdateGoalToolSchema = z.object({ goalId: z.string().uuid(), revision: z.number().int().positive(), changes: z.record(z.unknown()), reason: z.string().min(1) });
27
28
  var AwaitReplySchema = z.object({
28
29
  notificationId: z.string().describe("The notificationId returned by contact \u2014 waits for the user's reply to THIS notification only.")
29
30
  });
31
+ var ClaimGoalSchema = z.object({ goalId: z.string().uuid() });
30
32
  var OnboardSchema = z.object({
31
33
  name: z.string().max(60).optional(),
32
34
  voice: z.string().max(40).optional(),
@@ -106,6 +108,8 @@ var TOOLS = [
106
108
  description: CREATE_GOAL_DESCRIPTION,
107
109
  inputSchema: mcpInputSchema(CreateGoalSchema)
108
110
  },
111
+ { name: "claim_goal", description: "Claim a ready Goal you own and begin work. Returns its active revision.", inputSchema: mcpInputSchema(ClaimGoalSchema) },
112
+ { name: "update_goal", description: "Update an owned Goal at an exact revision; stale revisions are rejected.", inputSchema: mcpInputSchema(UpdateGoalToolSchema) },
109
113
  {
110
114
  name: "set_work_state",
111
115
  description: SET_WORK_STATE_DESCRIPTION,
@@ -291,7 +295,9 @@ function enablePaigyTools(scope = "user", cwd = process.cwd()) {
291
295
 
292
296
  export {
293
297
  SERVER_INSTRUCTIONS,
298
+ UpdateGoalToolSchema,
294
299
  AwaitReplySchema,
300
+ ClaimGoalSchema,
295
301
  OnboardSchema,
296
302
  PairSchema,
297
303
  GetThreadSchema,
@@ -10,7 +10,7 @@ import {
10
10
  saveToken,
11
11
  sleep,
12
12
  startE2ee
13
- } from "./chunk-PRC6GKRN.js";
13
+ } from "./chunk-VXHTA4PB.js";
14
14
 
15
15
  // src/identity.ts
16
16
  var CLIENT_LABELS = {
@@ -1,12 +1,12 @@
1
1
  // ../../packages/sdk/dist/index.js
2
2
  import { createRequire as __sdkCreateRequire } from "module";
3
- import { randomUUID } from "crypto";
3
+ import { createHash, randomUUID } from "crypto";
4
4
  import { z as z2 } from "zod";
5
5
  import { z } from "zod";
6
6
  import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind3 } from "zod/v3";
7
7
  import { ZodFirstPartyTypeKind } from "zod/v3";
8
8
  import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind2 } from "zod/v3";
9
- import { createHash } from "crypto";
9
+ import { createHash as createHash2 } from "crypto";
10
10
  import { closeSync, existsSync, mkdirSync, openSync, readFileSync, rmSync, statSync, writeFileSync } from "fs";
11
11
  import { homedir } from "os";
12
12
  import { join } from "path";
@@ -2274,7 +2274,18 @@ async function proxy() {
2274
2274
  return agent ??= new (await import("undici")).EnvHttpProxyAgent();
2275
2275
  }
2276
2276
  var INSTANCE_ID = randomUUID();
2277
- var SESSION_ID = process.env.PAIGY_SESSION_ID ?? process.env.CLAUDE_CODE_SESSION_ID ?? INSTANCE_ID;
2277
+ var WORKSPACE_ID = (() => {
2278
+ try {
2279
+ return `cwd-${createHash("sha256").update(process.cwd()).digest("hex").slice(0, 16)}`;
2280
+ } catch {
2281
+ return INSTANCE_ID;
2282
+ }
2283
+ })();
2284
+ var envSession = (key) => {
2285
+ const v = process.env[key];
2286
+ return v && v.trim() ? v : void 0;
2287
+ };
2288
+ var SESSION_ID = envSession("PAIGY_SESSION_ID") ?? envSession("CLAUDE_CODE_SESSION_ID") ?? envSession("CODEX_THREAD_ID") ?? envSession("CODEX_SESSION_ID") ?? WORKSPACE_ID;
2278
2289
  function sessionId() {
2279
2290
  return SESSION_ID;
2280
2291
  }
@@ -3542,6 +3553,16 @@ var CreateGoalSchema = z.object({
3542
3553
  ownerParticipant: z.string().trim().min(1).optional(),
3543
3554
  idempotencyKey: z.string().trim().min(1).max(200)
3544
3555
  });
3556
+ var UpdateGoalSchema = z.object({
3557
+ revision: z.number().int().positive(),
3558
+ changes: z.object({
3559
+ outcome: z.string().trim().min(1).max(1e4).optional(),
3560
+ state: z.enum(["active", "waiting", "done", "cancelled"]).optional(),
3561
+ progress: z.string().trim().min(1).max(1e4).optional(),
3562
+ reviewed: z.literal(true).optional()
3563
+ }).refine((v) => Object.keys(v).length > 0),
3564
+ reason: z.string().trim().min(1).max(2e3)
3565
+ });
3545
3566
  var fmtMin = (m) => m >= 60 ? `${m / 60} hr` : `${m} min`;
3546
3567
  var STANDARD_MEANS = (() => {
3547
3568
  const plan = MISSED_CALL_PLAN.backoff_standard;
@@ -5140,7 +5161,7 @@ function subagentThread(env = process.env, sessionId2) {
5140
5161
  return sub ? `${base}:sub:${sub}` : base;
5141
5162
  }
5142
5163
  function uuidFromKey(key) {
5143
- const h = createHash("sha1").update(`paigy-thread:${key}`).digest();
5164
+ const h = createHash2("sha1").update(`paigy-thread:${key}`).digest();
5144
5165
  h[6] = h[6] & 15 | 80;
5145
5166
  h[8] = h[8] & 63 | 128;
5146
5167
  const hex = h.subarray(0, 16).toString("hex");
@@ -5424,6 +5445,18 @@ async function createGoal(input, opts = {}) {
5424
5445
  if (!res.ok) throw new Error(`create_goal failed: ${res.status} ${await res.text()}`);
5425
5446
  return await res.json();
5426
5447
  }
5448
+ async function claimGoal(goalId, opts = {}) {
5449
+ const token = authToken(opts.token) ?? "";
5450
+ const res = ensureAuthed(await reach(`${BACKEND_URL}/api/goals/${encodeURIComponent(goalId)}/claim`, { method: "POST", headers: { authorization: `Bearer ${token}` } }));
5451
+ if (!res.ok) throw new Error(`claim_goal failed: ${res.status} ${await res.text()}`);
5452
+ return await res.json();
5453
+ }
5454
+ async function updateGoal(goalId, input, opts = {}) {
5455
+ const token = authToken(opts.token) ?? "";
5456
+ const res = ensureAuthed(await reach(`${BACKEND_URL}/api/goals/${encodeURIComponent(goalId)}`, { method: "PATCH", headers: { "content-type": "application/json", authorization: `Bearer ${token}` }, body: JSON.stringify(input) }));
5457
+ if (!res.ok) throw new Error(`update_goal failed: ${res.status} ${await res.text()}`);
5458
+ return await res.json();
5459
+ }
5427
5460
  async function submitNotification(req, opts = {}) {
5428
5461
  const token = authToken(opts.token) ?? "";
5429
5462
  const body = await sealForE2ee(req, token);
@@ -5794,6 +5827,8 @@ export {
5794
5827
  pairStep,
5795
5828
  UnpairedError,
5796
5829
  createGoal,
5830
+ claimGoal,
5831
+ updateGoal,
5797
5832
  submitNotification,
5798
5833
  getThread,
5799
5834
  searchThreads,
package/dist/enable.js CHANGED
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  PAIGY_TOOL_IDS,
4
4
  enablePaigyTools
5
- } from "./chunk-XIPO3U6I.js";
6
- import "./chunk-WNE6STMA.js";
7
- import "./chunk-PRC6GKRN.js";
5
+ } from "./chunk-PN7FDW26.js";
6
+ import "./chunk-242XN7FD.js";
7
+ import "./chunk-VXHTA4PB.js";
8
8
 
9
9
  // src/enable.ts
10
10
  function main() {
package/dist/index.js CHANGED
@@ -9,10 +9,11 @@ import {
9
9
  resolvePairing,
10
10
  startPairing,
11
11
  suggestedAgentName
12
- } from "./chunk-VWVZLPZD.js";
12
+ } from "./chunk-V66NUNSQ.js";
13
13
  import {
14
14
  AnswerCallerQuestionSchema,
15
15
  AwaitReplySchema,
16
+ ClaimGoalSchema,
16
17
  ENABLE_COMMAND,
17
18
  GetThreadSchema,
18
19
  OnboardSchema,
@@ -22,14 +23,15 @@ import {
22
23
  SearchThreadsSchema,
23
24
  SetTaskStateToolSchema,
24
25
  TOOLS,
26
+ UpdateGoalToolSchema,
25
27
  autoConfigureClients,
26
28
  claudeInstallHint,
27
29
  paigyToolsAllowlisted
28
- } from "./chunk-XIPO3U6I.js";
30
+ } from "./chunk-PN7FDW26.js";
29
31
  import {
30
32
  CreateGoalSchema,
31
33
  HandoffSchema
32
- } from "./chunk-WNE6STMA.js";
34
+ } from "./chunk-242XN7FD.js";
33
35
  import {
34
36
  clearSurface,
35
37
  writeSurface
@@ -43,6 +45,7 @@ import {
43
45
  answerCallerQuestion,
44
46
  awaitReply2,
45
47
  checkReplies,
48
+ claimGoal,
46
49
  contactParentId,
47
50
  createGoal,
48
51
  deleteKeyFile,
@@ -63,8 +66,9 @@ import {
63
66
  setWorkState,
64
67
  slotName,
65
68
  submitNotification,
69
+ updateGoal,
66
70
  whoAmI
67
- } from "./chunk-PRC6GKRN.js";
71
+ } from "./chunk-VXHTA4PB.js";
68
72
 
69
73
  // src/index.ts
70
74
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
@@ -443,6 +447,14 @@ async function handleTool(request, signal) {
443
447
  const result = await createGoal(CreateGoalSchema.parse(request.params.arguments));
444
448
  return { content: [{ type: "text", text: JSON.stringify(result) }] };
445
449
  }
450
+ case "claim_goal": {
451
+ const { goalId } = ClaimGoalSchema.parse(request.params.arguments);
452
+ return { content: [{ type: "text", text: JSON.stringify(await claimGoal(goalId)) }] };
453
+ }
454
+ case "update_goal": {
455
+ const { goalId, ...input } = UpdateGoalToolSchema.parse(request.params.arguments);
456
+ return { content: [{ type: "text", text: JSON.stringify(await updateGoal(goalId, input)) }] };
457
+ }
446
458
  case "schedule_callback": {
447
459
  const result = await scheduleCallback(ScheduleCallbackSchema.parse(request.params.arguments));
448
460
  return { content: [{ type: "text", text: JSON.stringify(result) }] };
package/dist/listen.js CHANGED
@@ -5,14 +5,14 @@ import {
5
5
  import {
6
6
  WAKE_EVENT,
7
7
  wakeChannel
8
- } from "./chunk-WNE6STMA.js";
8
+ } from "./chunk-242XN7FD.js";
9
9
  import {
10
10
  ackReply,
11
11
  authToken,
12
12
  decodeReply,
13
13
  registerDelivery,
14
14
  sweepLeased
15
- } from "./chunk-PRC6GKRN.js";
15
+ } from "./chunk-VXHTA4PB.js";
16
16
 
17
17
  // src/listen.ts
18
18
  import { createClient } from "@supabase/supabase-js";
package/dist/onboard.js CHANGED
@@ -3,13 +3,13 @@ import {
3
3
  resolvePairing,
4
4
  startPairing,
5
5
  suggestedAgentName
6
- } from "./chunk-VWVZLPZD.js";
6
+ } from "./chunk-V66NUNSQ.js";
7
7
  import {
8
8
  autoConfigureClients,
9
9
  claudeInstallHint,
10
10
  openBrowser
11
- } from "./chunk-XIPO3U6I.js";
12
- import "./chunk-WNE6STMA.js";
11
+ } from "./chunk-PN7FDW26.js";
12
+ import "./chunk-242XN7FD.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-PRC6GKRN.js";
23
+ } from "./chunk-VXHTA4PB.js";
24
24
 
25
25
  // src/onboard.ts
26
26
  function reportRegistered() {
package/dist/slot.js ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ AGENT_NAME
4
+ } from "./chunk-VXHTA4PB.js";
5
+
6
+ // src/slot.ts
7
+ process.stdout.write(AGENT_NAME);
@@ -6,7 +6,7 @@ import {
6
6
  BACKEND_URL,
7
7
  reach,
8
8
  readToken
9
- } from "./chunk-PRC6GKRN.js";
9
+ } from "./chunk-VXHTA4PB.js";
10
10
 
11
11
  // src/statusline.ts
12
12
  import { mkdirSync, readFileSync, realpathSync, writeFileSync } from "fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paigy/mcp",
3
- "version": "0.36.0",
3
+ "version": "0.37.0",
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",
@@ -10,7 +10,8 @@
10
10
  "paigy-mcp-onboard": "dist/onboard.js",
11
11
  "paigy-listen": "dist/listen.js",
12
12
  "paigy-statusline": "dist/statusline.js",
13
- "paigy-enable-tools": "dist/enable.js"
13
+ "paigy-enable-tools": "dist/enable.js",
14
+ "paigy-slot": "dist/slot.js"
14
15
  },
15
16
  "files": [
16
17
  "dist"
@@ -23,6 +24,13 @@
23
24
  "url": "git+https://github.com/mauurda/paigy.git",
24
25
  "directory": "apps/mcp"
25
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
+ },
26
34
  "dependencies": {
27
35
  "@modelcontextprotocol/sdk": "^1.0.4",
28
36
  "@supabase/supabase-js": "^2.47.10",
@@ -32,19 +40,13 @@
32
40
  "zod-to-json-schema": "^3.24.1"
33
41
  },
34
42
  "devDependencies": {
43
+ "@paigy/crypto": "workspace:*",
44
+ "@paigy/schema": "workspace:*",
45
+ "@paigy/sdk": "workspace:*",
35
46
  "@types/node": "^22.0.0",
36
47
  "@types/qrcode-generator": "^1.0.6",
37
48
  "tsup": "^8.3.5",
38
49
  "typescript": "^5.7.2",
39
- "vitest": "^2.1.8",
40
- "@paigy/crypto": "0.0.0",
41
- "@paigy/schema": "0.0.0",
42
- "@paigy/sdk": "0.2.0"
43
- },
44
- "scripts": {
45
- "build": "tsup",
46
- "dev": "tsup --watch",
47
- "typecheck": "tsc --noEmit",
48
- "test": "vitest run"
50
+ "vitest": "^2.1.8"
49
51
  }
50
- }
52
+ }