@pergy-ai/mcp 0.2.1 → 0.3.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.
- package/README.md +1 -1
- package/dist/index.js +16 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ It talks to the hosted backend by default — no config needed. Set
|
|
|
34
34
|
|
|
35
35
|
## Tools
|
|
36
36
|
|
|
37
|
-
- **`notify_user`** — notify the user (
|
|
37
|
+
- **`notify_user`** — notify the user (context: title + description chunks, plus optional options — each an answerable choice that can carry a sandboxed `html` or `image` preview for visual "pick one" decisions — visuals, `urgency`, and `parentId` for a clarification). Returns a request id + thread id. If a reply comes back as `{kind:'clarify', chunks:[...]}`, respond via notify_user with the SAME threadId and an expanded description.
|
|
38
38
|
- **`await_reply`** — wait for the user's reply to a specific notification (pass its id). Scoped: will not return replies meant for other notifications. Returns `reply` / `remind` / `idle`.
|
|
39
39
|
- **`check_replies`** — catch-up sweep: returns replies you haven't consumed yet (now marked seen) plus still-pending notifications.
|
|
40
40
|
- **`poll_answer`** — fetch the answer to a specific request by id.
|
package/dist/index.js
CHANGED
|
@@ -11,10 +11,9 @@ import { execSync } from "child_process";
|
|
|
11
11
|
|
|
12
12
|
// ../../packages/schema/dist/index.js
|
|
13
13
|
import { z } from "zod";
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
long: z.string().describe("A standalone version of 1-3 paragraphs.")
|
|
14
|
+
var ContextSchema = z.object({
|
|
15
|
+
title: z.string().describe("One-line headline of what you need."),
|
|
16
|
+
description: z.array(z.string()).min(1).describe("Semantic chunks of detail (each a standalone piece). The user can select chunks to ask you to expand.")
|
|
18
17
|
});
|
|
19
18
|
var OptionSchema = z.object({
|
|
20
19
|
id: z.string(),
|
|
@@ -36,7 +35,7 @@ var AgentSchema = z.object({
|
|
|
36
35
|
name: z.string()
|
|
37
36
|
});
|
|
38
37
|
var NotifyRequestSchema = z.object({
|
|
39
|
-
context:
|
|
38
|
+
context: ContextSchema,
|
|
40
39
|
options: z.array(OptionSchema).optional(),
|
|
41
40
|
visuals: z.array(VisualSchema).optional(),
|
|
42
41
|
agent: AgentSchema,
|
|
@@ -50,7 +49,9 @@ var NotifyRequestSchema = z.object({
|
|
|
50
49
|
/** Whether this should ring the user (SP3) or sit in the inbox. Inert until SP3. */
|
|
51
50
|
urgency: z.enum(["inbox", "call"]).default("inbox"),
|
|
52
51
|
/** The request this one was spawned from, for a clarification. */
|
|
53
|
-
parentId: z.string().optional()
|
|
52
|
+
parentId: z.string().optional(),
|
|
53
|
+
/** How the user answers the options: pick one (default), pick several, or pick & order. */
|
|
54
|
+
select: z.enum(["one", "many", "rank"]).default("one")
|
|
54
55
|
});
|
|
55
56
|
var NotifyStatusSchema = z.enum(["pending", "answered", "ignored"]);
|
|
56
57
|
var AgentStateSchema = z.enum(["idle", "in_progress", "completed", "needs_input"]);
|
|
@@ -60,7 +61,10 @@ var SetTaskStateSchema = z.object({
|
|
|
60
61
|
var UserAnswerSchema = z.discriminatedUnion("kind", [
|
|
61
62
|
z.object({ kind: z.literal("option"), optionId: z.string() }),
|
|
62
63
|
z.object({ kind: z.literal("text"), text: z.string() }),
|
|
63
|
-
z.object({ kind: z.literal("ignored") })
|
|
64
|
+
z.object({ kind: z.literal("ignored") }),
|
|
65
|
+
z.object({ kind: z.literal("multi"), optionIds: z.array(z.string()) }),
|
|
66
|
+
z.object({ kind: z.literal("ranked"), optionIds: z.array(z.string()) }),
|
|
67
|
+
z.object({ kind: z.literal("clarify"), chunks: z.array(z.string()).min(1) })
|
|
64
68
|
]);
|
|
65
69
|
var AwaitItemSchema = z.discriminatedUnion("type", [
|
|
66
70
|
z.object({
|
|
@@ -102,7 +106,7 @@ var UserResponseSchema = z.object({
|
|
|
102
106
|
var InboxItemSchema = z.object({
|
|
103
107
|
id: z.string(),
|
|
104
108
|
status: NotifyStatusSchema,
|
|
105
|
-
context:
|
|
109
|
+
context: ContextSchema,
|
|
106
110
|
options: z.array(OptionSchema).optional(),
|
|
107
111
|
visuals: z.array(VisualSchema).optional(),
|
|
108
112
|
agent: z.string(),
|
|
@@ -112,7 +116,8 @@ var InboxItemSchema = z.object({
|
|
|
112
116
|
createdAt: z.string().datetime(),
|
|
113
117
|
snoozedUntil: z.string().datetime().optional(),
|
|
114
118
|
agentState: AgentStateSchema.default("idle"),
|
|
115
|
-
parentId: z.string().optional()
|
|
119
|
+
parentId: z.string().optional(),
|
|
120
|
+
select: z.enum(["one", "many", "rank"]).default("one")
|
|
116
121
|
});
|
|
117
122
|
var SnoozeRequestSchema = z.object({
|
|
118
123
|
requestId: z.string(),
|
|
@@ -264,14 +269,14 @@ var server = new Server(
|
|
|
264
269
|
{ name: "pergy", version: "0.0.0" },
|
|
265
270
|
{
|
|
266
271
|
capabilities: { tools: {} },
|
|
267
|
-
instructions: "On startup, call check_replies once to pick up any replies or pending work you missed while away. To wait for the answer to something you just asked, call await_reply with that notification's id \u2014 it's scoped to that one request, so it never returns replies meant for other requests. Use check_replies again only when re-booting or after waiting a long time on something else. Never end a turn that still needs the user without notify_user + await_reply."
|
|
272
|
+
instructions: "On startup, call check_replies once to pick up any replies or pending work you missed while away. To wait for the answer to something you just asked, call await_reply with that notification's id \u2014 it's scoped to that one request, so it never returns replies meant for other requests. Use check_replies again only when re-booting or after waiting a long time on something else. Never end a turn that still needs the user without notify_user + await_reply. If a reply comes back as { kind: 'clarify', chunks: [...] }, the user wants more detail on those chunks \u2014 respond by calling notify_user again with the SAME threadId and an expanded description covering them."
|
|
268
273
|
}
|
|
269
274
|
);
|
|
270
275
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
271
276
|
tools: [
|
|
272
277
|
{
|
|
273
278
|
name: "notify_user",
|
|
274
|
-
description: "Notify the user via Pergy and get a request id to poll for their answer. Provide context
|
|
279
|
+
description: "Notify the user via Pergy and get a request id to poll for their answer. Provide context.title (one-line headline) and context.description (an array of standalone detail chunks the user can selectively ask you to expand). Plus optional options (answerable choices; each may carry a sandboxed `html` or an `image` preview for a visual 'pick one' \u2014 e.g. show layout/UI alternatives) and visuals. Use `select` to control how the user answers options: 'one' (default) = pick a single option; 'many' = multi-select, user checks any subset \u2192 answer arrives as {kind:'multi', optionIds:[...]}; 'rank' = select and order, user taps options in preferred order \u2192 answer arrives as {kind:'ranked', optionIds:[...]} (ordered by choice). If a reply comes back as {kind:'clarify', chunks:[...]}, the user wants more detail on those chunks \u2014 respond via notify_user with the SAME threadId and an expanded description. Pass `threadId` from a prior notify_user result or an await_reply reply to continue that conversation thread; omit it to start a new one.",
|
|
275
280
|
inputSchema: zodToJsonSchema(NotifyRequestSchema, { target: "openApi3" })
|
|
276
281
|
},
|
|
277
282
|
{
|