@derive-to/mcp 0.1.0 → 0.2.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/SKILL.md +10 -3
- package/package.json +12 -12
- package/src/client.ts +42 -2
- package/src/index.ts +144 -19
- package/LICENSE +0 -105
package/SKILL.md
CHANGED
|
@@ -23,9 +23,9 @@ Your identity (agent name, workspace, role) is in the server instructions — th
|
|
|
23
23
|
|---|---|
|
|
24
24
|
| `list_artifacts` | Find: the artifacts in your workspace (short id, title, kind, version, visibility). Optional `query` filters by title. |
|
|
25
25
|
| `read` | Read an artifact's content by short id. For a bundle, omit `section` for the outline or pass a `section` (page path) for one page; pass `version` to read history. |
|
|
26
|
-
| `catch_up` | Start here on an artifact: its state in one call — what changed since `since_version`, the open/outdated comment threads, and version history. Pass `comments` (open/addressed/resolved/outdated) for that filtered feedback queue, or `response_format='detailed'` (with optional `since_version`/`to_version`) to fold in the exact line diff. |
|
|
27
|
-
| `comment` | Leave feedback, reply (`reply_to` a thread id), anchor to a `quote`, and/or resolve/reopen (`set_state`). |
|
|
28
|
-
| `publish` | Save a revision. `content` for a single file, `files` (path→content map) for a multi-page bundle. Omit `short_id` to create new (title required); pass it to add a version. `addresses` lists thread ids this revision resolves. |
|
|
26
|
+
| `catch_up` | Start here on an artifact: its state in one call — what changed since `since_version`, the open/outdated comment threads, the `review` round state, and version history. Pass `comments` (open/addressed/resolved/outdated) for that filtered feedback queue, or `response_format='detailed'` (with optional `since_version`/`to_version`) to fold in the exact line diff. Waiting on a review? Pass `wait` (seconds, max 50) to long-poll: the call blocks until the human sends back / approves / comments — chain these instead of sleeping. |
|
|
27
|
+
| `comment` | Leave feedback, reply (`reply_to` a thread id), anchor to a `quote`, react (`react: "👍"` with `reply_to` — the loop's lightweight ack, landing on the thread's latest human comment), and/or resolve/reopen (`set_state`). |
|
|
28
|
+
| `publish` | Save a revision. `content` for a single file, `files` (path→content map) for a multi-page bundle. Omit `short_id` to create new (title required); pass it to add a version. `addresses` lists thread ids this revision resolves; `request_review:true` opens a review round for your human. New artifacts land **private** by default (the human you act for owns the draft) — they promote via the share dialog, so don't pass a wider `visibility` unasked. The result's `opened_in_tab` says whether an open Derive tab caught the push; when false, open the `url` for the user if they should see it now. |
|
|
29
29
|
|
|
30
30
|
## Role decides: live publish vs proposal
|
|
31
31
|
|
|
@@ -46,6 +46,13 @@ human approves rather than live content.
|
|
|
46
46
|
3. **Revise**, then **`comment`** (reply/resolve) and/or **`publish`** (pass `addresses`
|
|
47
47
|
to resolve the threads this revision fixes) — same URL, a new version. Comment
|
|
48
48
|
highlights re-anchor to the moved text.
|
|
49
|
+
4. **Review rounds** (the /derive loop): publish with `request_review:true`, then
|
|
50
|
+
chain `catch_up(short_id, wait: 50)` — each call returns the moment the human
|
|
51
|
+
hits Send back / Approve (or ~50s pass). On `sent_back`, sweep ALL threads (any
|
|
52
|
+
author, anchored or not), ack every human comment FIRST
|
|
53
|
+
(`comment(reply_to, react:"👍")` at minimum), then revise and publish with
|
|
54
|
+
`addresses` + `request_review:true` for the next round. The human never
|
|
55
|
+
resolves threads — you settle thread state.
|
|
49
56
|
|
|
50
57
|
## Keep comments anchorable
|
|
51
58
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@derive-to/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Stdio MCP server for Derive — list, read, catch up on, comment on, and publish artifacts on a Derive instance.",
|
|
6
6
|
"keywords": [
|
|
@@ -37,24 +37,24 @@
|
|
|
37
37
|
".": "./src/index.ts",
|
|
38
38
|
"./client": "./src/client.ts"
|
|
39
39
|
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"start": "tsx src/index.ts",
|
|
42
|
+
"typecheck": "tsc --noEmit",
|
|
43
|
+
"test": "vitest run",
|
|
44
|
+
"test:coverage": "vitest run --coverage"
|
|
45
|
+
},
|
|
40
46
|
"dependencies": {
|
|
41
47
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
42
48
|
"tsx": "^4.19.0",
|
|
43
49
|
"zod": "^4.4.3"
|
|
44
50
|
},
|
|
45
51
|
"devDependencies": {
|
|
52
|
+
"@derive/api": "workspace:*",
|
|
53
|
+
"@derive/db": "workspace:*",
|
|
54
|
+
"@derive/storage": "workspace:*",
|
|
46
55
|
"@hono/node-server": "^2.0.5",
|
|
47
56
|
"@types/node": "^25.9.3",
|
|
48
57
|
"typescript": "^6.0.3",
|
|
49
|
-
"vitest": "^4.1.9"
|
|
50
|
-
"@derive/api": "0.1.0",
|
|
51
|
-
"@derive/db": "0.1.0",
|
|
52
|
-
"@derive/storage": "0.1.0"
|
|
53
|
-
},
|
|
54
|
-
"scripts": {
|
|
55
|
-
"start": "tsx src/index.ts",
|
|
56
|
-
"typecheck": "tsc --noEmit",
|
|
57
|
-
"test": "vitest run",
|
|
58
|
-
"test:coverage": "vitest run --coverage"
|
|
58
|
+
"vitest": "^4.1.9"
|
|
59
59
|
}
|
|
60
|
-
}
|
|
60
|
+
}
|
package/src/client.ts
CHANGED
|
@@ -7,13 +7,15 @@ export interface PublishArgs {
|
|
|
7
7
|
slug?: string
|
|
8
8
|
spa?: boolean
|
|
9
9
|
message?: string
|
|
10
|
-
visibility?: "public" | "
|
|
11
|
-
/**
|
|
10
|
+
visibility?: "public" | "org" | "private"
|
|
11
|
+
/** A lock on a public link (optional). */
|
|
12
12
|
password?: string
|
|
13
13
|
/** When set, publishes a new version of this artifact instead of a new one. */
|
|
14
14
|
id?: string
|
|
15
15
|
/** Comment ids whose threads to resolve as part of this (re)publish. */
|
|
16
16
|
resolves?: string[]
|
|
17
|
+
/** Open a review round for this version (the /derive loop's ask). */
|
|
18
|
+
requestReview?: boolean
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
export type CommentState = "open" | "addressed" | "resolved" | "outdated"
|
|
@@ -28,6 +30,8 @@ export interface CommentJson {
|
|
|
28
30
|
author: string
|
|
29
31
|
state: CommentState
|
|
30
32
|
created_at: string
|
|
33
|
+
/** emoji → actor display names (the ack surface). */
|
|
34
|
+
reactions?: Record<string, string[]>
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
export interface ArtifactSummaryJson {
|
|
@@ -86,6 +90,19 @@ export interface ArtifactJson {
|
|
|
86
90
|
versions: VersionJson[]
|
|
87
91
|
/** Time-grouped version view (newest-first); present on the detail endpoint. */
|
|
88
92
|
sessions?: SessionJson[]
|
|
93
|
+
/** Publish-response extras (agent-credentialed publishes only). */
|
|
94
|
+
review_requested?: boolean
|
|
95
|
+
opened_in_tab?: boolean
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** One review round: the human-ack primitive of the /derive loop. */
|
|
99
|
+
export interface ReviewRoundJson {
|
|
100
|
+
id: string
|
|
101
|
+
state: "pending" | "sent_back" | "approved"
|
|
102
|
+
version: number
|
|
103
|
+
note: string | null
|
|
104
|
+
created_at: string
|
|
105
|
+
resolved_at: string | null
|
|
89
106
|
}
|
|
90
107
|
|
|
91
108
|
export interface DiffOpJson {
|
|
@@ -120,6 +137,12 @@ export interface DeriveClient {
|
|
|
120
137
|
setThreadState(shortId: string, commentId: string, state: "resolved" | "open"): Promise<void>
|
|
121
138
|
/** Line diff between two versions (defaults: current-1 → current). */
|
|
122
139
|
diff(shortId: string, from?: number, to?: number): Promise<DiffJson>
|
|
140
|
+
/** The artifact's review rounds (newest first) + the pending one, if any. */
|
|
141
|
+
getReview(
|
|
142
|
+
shortId: string,
|
|
143
|
+
): Promise<{ rounds: ReviewRoundJson[]; pending: ReviewRoundJson | null }>
|
|
144
|
+
/** Toggle an emoji reaction on a comment (the loop's lightweight ack). */
|
|
145
|
+
react(shortId: string, commentId: string, emoji: string): Promise<void>
|
|
123
146
|
/** Restore a past version as a new current revision. */
|
|
124
147
|
restore(shortId: string, version: number): Promise<ArtifactJson>
|
|
125
148
|
/** Aggregated view analytics. */
|
|
@@ -167,6 +190,7 @@ export function createClient(opts: ClientOptions): DeriveClient {
|
|
|
167
190
|
if (args.password) form.append("password", args.password)
|
|
168
191
|
if (args.spa) form.append("spa", "true")
|
|
169
192
|
if (args.resolves?.length) form.append("resolves", args.resolves.join(","))
|
|
193
|
+
if (args.requestReview) form.append("request_review", "true")
|
|
170
194
|
const url = args.id ? `${base}/v1/artifacts/${args.id}/versions` : `${base}/v1/artifacts`
|
|
171
195
|
return ok(
|
|
172
196
|
await f(url, { method: "POST", body: form, headers: authHeaders }),
|
|
@@ -244,6 +268,22 @@ export function createClient(opts: ClientOptions): DeriveClient {
|
|
|
244
268
|
) as Promise<DiffJson>
|
|
245
269
|
},
|
|
246
270
|
|
|
271
|
+
async getReview(shortId) {
|
|
272
|
+
return ok(
|
|
273
|
+
await f(`${base}/v1/artifacts/${shortId}/review`, { headers: authHeaders }),
|
|
274
|
+
) as Promise<{ rounds: ReviewRoundJson[]; pending: ReviewRoundJson | null }>
|
|
275
|
+
},
|
|
276
|
+
|
|
277
|
+
async react(shortId, commentId, emoji) {
|
|
278
|
+
await ok(
|
|
279
|
+
await f(`${base}/v1/artifacts/${shortId}/comments/${commentId}/react`, {
|
|
280
|
+
method: "POST",
|
|
281
|
+
headers: { ...authHeaders, "content-type": "application/json" },
|
|
282
|
+
body: JSON.stringify({ emoji }),
|
|
283
|
+
}),
|
|
284
|
+
)
|
|
285
|
+
},
|
|
286
|
+
|
|
247
287
|
async restore(shortId, version) {
|
|
248
288
|
return ok(
|
|
249
289
|
await f(`${base}/v1/artifacts/${shortId}/restore`, {
|
package/src/index.ts
CHANGED
|
@@ -69,9 +69,10 @@ server.registerTool(
|
|
|
69
69
|
"catch_up",
|
|
70
70
|
{
|
|
71
71
|
description:
|
|
72
|
-
"START HERE on an artifact. Its state in one call: a summary, the versions since `since_version`, the open (and outdated) comment threads, and the full version history. " +
|
|
72
|
+
"START HERE on an artifact. Its state in one call: a summary, the review round, the versions since `since_version`, the open (and outdated) comment threads, and the full version history. " +
|
|
73
73
|
"Pass `comments` (open / addressed / resolved / outdated) to instead get that filtered thread list — your feedback queue. " +
|
|
74
|
-
"Pass `response_format='detailed'` (optionally with `since_version`/`to_version`) to fold in the exact line diff between two versions."
|
|
74
|
+
"Pass `response_format='detailed'` (optionally with `since_version`/`to_version`) to fold in the exact line diff between two versions. " +
|
|
75
|
+
"WAITING ON A REVIEW? Pass `wait` (seconds, max 50) to block until the human sends back or approves — chain these instead of sleeping between polls.",
|
|
75
76
|
inputSchema: {
|
|
76
77
|
short_id: z.string(),
|
|
77
78
|
since_version: z
|
|
@@ -94,9 +95,18 @@ server.registerTool(
|
|
|
94
95
|
.enum(["summary", "detailed"])
|
|
95
96
|
.optional()
|
|
96
97
|
.describe("'summary' (default) omits the line diff; 'detailed' includes it."),
|
|
98
|
+
wait: z
|
|
99
|
+
.number()
|
|
100
|
+
.int()
|
|
101
|
+
.min(1)
|
|
102
|
+
.max(50)
|
|
103
|
+
.optional()
|
|
104
|
+
.describe(
|
|
105
|
+
"Long-poll: block up to this many seconds for the human's next review action before returning. Returns immediately when something is already actionable.",
|
|
106
|
+
),
|
|
97
107
|
},
|
|
98
108
|
},
|
|
99
|
-
async ({ short_id, since_version, to_version, comments, response_format }) => {
|
|
109
|
+
async ({ short_id, since_version, to_version, comments, response_format, wait }) => {
|
|
100
110
|
const summarizeComment = (c: {
|
|
101
111
|
thread_id: string
|
|
102
112
|
author: string
|
|
@@ -121,17 +131,71 @@ server.registerTool(
|
|
|
121
131
|
})
|
|
122
132
|
}
|
|
123
133
|
|
|
134
|
+
// Long-poll (self-host shim flavor): the /v1 API has no blocking endpoint,
|
|
135
|
+
// so poll every 2.5s until the human acts or the wait runs out — the same
|
|
136
|
+
// contract as the remote server's wait on a coarser clock. "Acts" = the
|
|
137
|
+
// round changes OR the open-comment count moves (so waiting works with no
|
|
138
|
+
// round open, exactly like the server's comment.created wake). Transient
|
|
139
|
+
// errors retry; they never end the wait early. A settled round that still
|
|
140
|
+
// applies to the current head is already actionable and returns at once.
|
|
141
|
+
if (wait) {
|
|
142
|
+
const deadline = Date.now() + wait * 1000
|
|
143
|
+
const snap = () =>
|
|
144
|
+
Promise.all([
|
|
145
|
+
client.get(short_id),
|
|
146
|
+
client.getReview(short_id),
|
|
147
|
+
client.listComments(short_id, "open"),
|
|
148
|
+
]).then(([art, rev, open]) => {
|
|
149
|
+
const round = rev.pending ?? rev.rounds[0] ?? null
|
|
150
|
+
return {
|
|
151
|
+
key: `${round?.id ?? "none"}:${round?.state ?? "none"}:${open.length}`,
|
|
152
|
+
actionable:
|
|
153
|
+
!!round && round.state !== "pending" && round.version >= art.current_version,
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
let baseline: string | null = null
|
|
157
|
+
for (;;) {
|
|
158
|
+
const cur = await snap().catch(() => null)
|
|
159
|
+
if (cur) {
|
|
160
|
+
if (baseline === null) {
|
|
161
|
+
baseline = cur.key
|
|
162
|
+
if (cur.actionable) break
|
|
163
|
+
} else if (cur.key !== baseline) break
|
|
164
|
+
}
|
|
165
|
+
if (Date.now() >= deadline) break
|
|
166
|
+
await new Promise((r) => setTimeout(r, 2500))
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
124
170
|
const a = await client.get(short_id)
|
|
125
171
|
const head = a.current_version
|
|
126
172
|
const to = Math.min(head, Math.max(1, to_version ?? head))
|
|
127
173
|
const since = Math.min(to, Math.max(1, since_version ?? to - 1))
|
|
128
174
|
const history = a.versions.slice().sort((x, y) => y.n - x.n)
|
|
129
175
|
const newVersions = history.filter((v) => v.n > since && v.n <= to)
|
|
130
|
-
const [open, outdated, addressed] = await Promise.all([
|
|
176
|
+
const [open, outdated, addressed, reviewState] = await Promise.all([
|
|
131
177
|
client.listComments(short_id, "open"),
|
|
132
178
|
client.listComments(short_id, "outdated"),
|
|
133
179
|
client.listComments(short_id, "addressed"),
|
|
180
|
+
client.getReview(short_id).catch(() => ({ rounds: [], pending: null })),
|
|
134
181
|
])
|
|
182
|
+
const round = reviewState.pending ?? reviewState.rounds[0] ?? null
|
|
183
|
+
const review = round
|
|
184
|
+
? {
|
|
185
|
+
state: round.state,
|
|
186
|
+
version: round.version,
|
|
187
|
+
requested_at: round.created_at,
|
|
188
|
+
resolved_at: round.resolved_at,
|
|
189
|
+
note: round.note,
|
|
190
|
+
}
|
|
191
|
+
: null
|
|
192
|
+
const reviewBit = review
|
|
193
|
+
? review.state === "pending"
|
|
194
|
+
? ` Review requested on v${review.version} — waiting for the human.`
|
|
195
|
+
: review.state === "sent_back"
|
|
196
|
+
? ` The human sent back their review of v${review.version} — read the open threads, revise, and re-request.`
|
|
197
|
+
: ` The human approved v${review.version} — you're clear to proceed.`
|
|
198
|
+
: ""
|
|
135
199
|
let entryDiff: string | undefined
|
|
136
200
|
if (response_format === "detailed" && since < to) {
|
|
137
201
|
const d = await client.diff(short_id, since, to)
|
|
@@ -143,10 +207,11 @@ server.registerTool(
|
|
|
143
207
|
const addressedBit = addressed.length ? ` ${addressed.length} addressed (pending review).` : ""
|
|
144
208
|
const summary =
|
|
145
209
|
since >= to
|
|
146
|
-
? `You're up to date on "${a.title}" (v${head}); ${open.length} open comment(s).${addressedBit}${outdatedBit}`
|
|
147
|
-
: `"${a.title}": ${newVersions.length} new version(s) since v${since} (now v${to}). ${open.length} open comment(s).${addressedBit}${outdatedBit}`
|
|
210
|
+
? `You're up to date on "${a.title}" (v${head}); ${open.length} open comment(s).${addressedBit}${outdatedBit}${reviewBit}`
|
|
211
|
+
: `"${a.title}": ${newVersions.length} new version(s) since v${since} (now v${to}). ${open.length} open comment(s).${addressedBit}${outdatedBit}${reviewBit}`
|
|
148
212
|
return json({
|
|
149
213
|
summary,
|
|
214
|
+
review,
|
|
150
215
|
short_id,
|
|
151
216
|
since,
|
|
152
217
|
to,
|
|
@@ -170,7 +235,7 @@ server.registerTool(
|
|
|
170
235
|
"comment",
|
|
171
236
|
{
|
|
172
237
|
description:
|
|
173
|
-
"Leave feedback, reply in a thread, and/or resolve or reopen a thread. Anchor a NEW comment to a quoted span with `quote`. Reply by passing the thread id as `reply_to`. Resolve/reopen by passing `set_state` with a `comment_id` from the thread (or the comment you just left).",
|
|
238
|
+
"Leave feedback, reply in a thread, react, and/or resolve or reopen a thread. Anchor a NEW comment to a quoted span with `quote`. Reply by passing the thread id as `reply_to`. Pass `react` with a `comment_id` (or `reply_to` to hit the thread's latest comment) to acknowledge feedback without the noise of a reply — the loop's minimum ack. Resolve/reopen by passing `set_state` with a `comment_id` from the thread (or the comment you just left).",
|
|
174
239
|
inputSchema: {
|
|
175
240
|
short_id: z.string(),
|
|
176
241
|
body: z
|
|
@@ -182,16 +247,22 @@ server.registerTool(
|
|
|
182
247
|
.optional()
|
|
183
248
|
.describe("A thread id to reply in; omit to start a new thread."),
|
|
184
249
|
quote: z.string().optional().describe("Exact text to anchor a NEW comment to."),
|
|
250
|
+
react: z
|
|
251
|
+
.enum(["👍", "❤️", "🎉", "😄", "👀", "🙏", "🚀", "👎"])
|
|
252
|
+
.optional()
|
|
253
|
+
.describe("React to a comment (with `comment_id` or `reply_to`) — 👍 is the loop's ack."),
|
|
185
254
|
set_state: z.enum(["resolved", "open"]).optional().describe("Resolve or reopen a thread."),
|
|
186
255
|
comment_id: z
|
|
187
256
|
.string()
|
|
188
257
|
.optional()
|
|
189
|
-
.describe("A comment in the thread to set_state on (when not posting)."),
|
|
258
|
+
.describe("A comment in the thread to react to / set_state on (when not posting)."),
|
|
190
259
|
},
|
|
191
260
|
},
|
|
192
|
-
async ({ short_id, body, reply_to, quote, set_state, comment_id }) => {
|
|
193
|
-
if (!body && !set_state)
|
|
194
|
-
return text(
|
|
261
|
+
async ({ short_id, body, reply_to, quote, react, set_state, comment_id }) => {
|
|
262
|
+
if (!body && !set_state && !react)
|
|
263
|
+
return text(
|
|
264
|
+
"Provide `body` (to comment), `react` (to acknowledge), or `set_state` (to resolve/reopen).",
|
|
265
|
+
)
|
|
195
266
|
let posted: Awaited<ReturnType<typeof client.createComment>> | undefined
|
|
196
267
|
if (body) {
|
|
197
268
|
const anchor = quote ? { type: "TextQuoteSelector", exact: quote } : undefined
|
|
@@ -202,6 +273,32 @@ server.registerTool(
|
|
|
202
273
|
author: "agent",
|
|
203
274
|
})
|
|
204
275
|
}
|
|
276
|
+
let reactNote = ""
|
|
277
|
+
if (react) {
|
|
278
|
+
// The ack target: an explicit comment, else the newest comment in the
|
|
279
|
+
// thread by someone ELSE — never the agent's own just-posted reply. One
|
|
280
|
+
// unfiltered fetch covers every thread state (the human may have replied
|
|
281
|
+
// on a resolved thread).
|
|
282
|
+
const all = await client.listComments(short_id)
|
|
283
|
+
let target = comment_id
|
|
284
|
+
if (!target && reply_to) {
|
|
285
|
+
const thread = all
|
|
286
|
+
.filter((cm) => cm.thread_id === reply_to)
|
|
287
|
+
.sort((x, y) => x.created_at.localeCompare(y.created_at))
|
|
288
|
+
const other = [...thread].reverse().find((cm) => cm.author !== "agent")
|
|
289
|
+
target = (other ?? thread[thread.length - 1])?.id
|
|
290
|
+
}
|
|
291
|
+
if (!target)
|
|
292
|
+
return text("`react` needs a `comment_id` or a `reply_to` thread to acknowledge.")
|
|
293
|
+
// The /react route TOGGLES; skipping an already-present emoji keeps a
|
|
294
|
+
// retried ack from silently removing it.
|
|
295
|
+
if (all.find((cm) => cm.id === target)?.reactions?.[react]?.length) {
|
|
296
|
+
reactNote = ` · already acknowledged with ${react}`
|
|
297
|
+
} else {
|
|
298
|
+
await client.react(short_id, target, react)
|
|
299
|
+
reactNote = ` · acknowledged with ${react}`
|
|
300
|
+
}
|
|
301
|
+
}
|
|
205
302
|
let stateNote = ""
|
|
206
303
|
if (set_state) {
|
|
207
304
|
const ref = posted?.id ?? comment_id
|
|
@@ -216,9 +313,12 @@ server.registerTool(
|
|
|
216
313
|
const where = reply_to
|
|
217
314
|
? `replied in thread ${posted.thread_id}`
|
|
218
315
|
: `new thread ${posted.thread_id}`
|
|
219
|
-
return text(
|
|
316
|
+
return text(
|
|
317
|
+
`${where} (comment ${posted.id})${quote ? ` on “${quote}”` : ""}${reactNote}${stateNote}.`,
|
|
318
|
+
)
|
|
220
319
|
}
|
|
221
|
-
return text(`
|
|
320
|
+
if (!set_state) return text(`Acknowledged${reactNote.replace(" · acknowledged", "")}.`)
|
|
321
|
+
return text(`Thread ${set_state === "resolved" ? "resolved" : "reopened"}${reactNote}.`)
|
|
222
322
|
},
|
|
223
323
|
)
|
|
224
324
|
|
|
@@ -239,10 +339,9 @@ server.registerTool(
|
|
|
239
339
|
.optional()
|
|
240
340
|
.describe("Omit to create a new artifact; pass it to add a version."),
|
|
241
341
|
title: z.string().optional(),
|
|
242
|
-
//
|
|
243
|
-
//
|
|
244
|
-
|
|
245
|
-
visibility: z.enum(["public", "link", "org", "private"]).optional(),
|
|
342
|
+
// Omitted ⇒ the workspace's agent default (usually `private` — the
|
|
343
|
+
// human you act for owns the draft and promotes it when ready).
|
|
344
|
+
visibility: z.enum(["private", "org", "public"]).optional(),
|
|
246
345
|
message: z.string().optional().describe("What changed in this version."),
|
|
247
346
|
for_review: z
|
|
248
347
|
.boolean()
|
|
@@ -252,9 +351,25 @@ server.registerTool(
|
|
|
252
351
|
.array(z.string())
|
|
253
352
|
.optional()
|
|
254
353
|
.describe("Thread ids this revision resolves (live publish) or addresses (proposal)."),
|
|
354
|
+
request_review: z
|
|
355
|
+
.boolean()
|
|
356
|
+
.optional()
|
|
357
|
+
.describe(
|
|
358
|
+
"Open a review round asking your human to review this version — the /derive loop. Poll catch_up's `review` (or pass `wait`) for the state.",
|
|
359
|
+
),
|
|
255
360
|
},
|
|
256
361
|
},
|
|
257
|
-
async ({
|
|
362
|
+
async ({
|
|
363
|
+
content,
|
|
364
|
+
filename,
|
|
365
|
+
short_id,
|
|
366
|
+
title,
|
|
367
|
+
visibility,
|
|
368
|
+
message,
|
|
369
|
+
for_review,
|
|
370
|
+
addresses,
|
|
371
|
+
request_review,
|
|
372
|
+
}) => {
|
|
258
373
|
if (for_review) {
|
|
259
374
|
if (!short_id) return text("A proposal revises an EXISTING artifact — pass its short_id.")
|
|
260
375
|
const p = await client.propose(short_id, {
|
|
@@ -279,15 +394,25 @@ server.registerTool(
|
|
|
279
394
|
visibility,
|
|
280
395
|
message,
|
|
281
396
|
resolves: addresses,
|
|
397
|
+
requestReview: request_review,
|
|
282
398
|
})
|
|
283
399
|
const note = addresses?.length ? ` · resolved ${addresses.length} thread(s)` : ""
|
|
400
|
+
const openNote =
|
|
401
|
+
a.opened_in_tab === false
|
|
402
|
+
? " No open Derive tab caught this push — open the url for the user if they should see it now."
|
|
403
|
+
: ""
|
|
284
404
|
return json({
|
|
285
405
|
published: true,
|
|
286
406
|
short_id: a.short_id,
|
|
407
|
+
...(a.review_requested ? { review_requested: true } : {}),
|
|
287
408
|
version: a.current_version,
|
|
288
409
|
url: a.url,
|
|
289
410
|
title: a.title,
|
|
290
|
-
|
|
411
|
+
visibility: a.visibility,
|
|
412
|
+
...(a.opened_in_tab !== undefined ? { opened_in_tab: a.opened_in_tab } : {}),
|
|
413
|
+
note:
|
|
414
|
+
(short_id ? `Live — new version${note}.` : `Live — created "${a.title}"${note}.`) +
|
|
415
|
+
openNote,
|
|
291
416
|
})
|
|
292
417
|
},
|
|
293
418
|
)
|
package/LICENSE
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
# Functional Source License, Version 1.1, ALv2 Future License
|
|
2
|
-
|
|
3
|
-
## Abbreviation
|
|
4
|
-
|
|
5
|
-
FSL-1.1-ALv2
|
|
6
|
-
|
|
7
|
-
## Notice
|
|
8
|
-
|
|
9
|
-
Copyright 2026 Anir Agarwal <Agarwal.anir@gmail.com>
|
|
10
|
-
|
|
11
|
-
## Terms and Conditions
|
|
12
|
-
|
|
13
|
-
### Licensor ("We")
|
|
14
|
-
|
|
15
|
-
The party offering the Software under these Terms and Conditions.
|
|
16
|
-
|
|
17
|
-
### The Software
|
|
18
|
-
|
|
19
|
-
The "Software" is each version of the software that we make available under
|
|
20
|
-
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
-
Conditions with the Software.
|
|
22
|
-
|
|
23
|
-
### License Grant
|
|
24
|
-
|
|
25
|
-
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
-
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
-
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
-
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
-
|
|
30
|
-
### Permitted Purpose
|
|
31
|
-
|
|
32
|
-
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
-
means making the Software available to others in a commercial product or
|
|
34
|
-
service that:
|
|
35
|
-
|
|
36
|
-
1. substitutes for the Software;
|
|
37
|
-
|
|
38
|
-
2. substitutes for any other product or service we offer using the Software
|
|
39
|
-
that exists as of the date we make the Software available; or
|
|
40
|
-
|
|
41
|
-
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
-
|
|
43
|
-
Permitted Purposes specifically include using the Software:
|
|
44
|
-
|
|
45
|
-
1. for your internal use and access;
|
|
46
|
-
|
|
47
|
-
2. for non-commercial education;
|
|
48
|
-
|
|
49
|
-
3. for non-commercial research; and
|
|
50
|
-
|
|
51
|
-
4. in connection with professional services that you provide to a licensee
|
|
52
|
-
using the Software in accordance with these Terms and Conditions.
|
|
53
|
-
|
|
54
|
-
### Patents
|
|
55
|
-
|
|
56
|
-
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
-
patents, the license grant above includes a license under our patents. If you
|
|
58
|
-
make a claim against any party that the Software infringes or contributes to
|
|
59
|
-
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
-
immediately.
|
|
61
|
-
|
|
62
|
-
### Redistribution
|
|
63
|
-
|
|
64
|
-
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
-
the Software.
|
|
66
|
-
|
|
67
|
-
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
-
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
-
remove any copyright notices provided in or with the Software.
|
|
70
|
-
|
|
71
|
-
### Disclaimer
|
|
72
|
-
|
|
73
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
-
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
-
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
-
|
|
77
|
-
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
-
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
-
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
-
|
|
81
|
-
### Trademarks
|
|
82
|
-
|
|
83
|
-
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
-
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
-
trademarks, trade names, service marks or product names.
|
|
86
|
-
|
|
87
|
-
## Grant of Future License
|
|
88
|
-
|
|
89
|
-
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
-
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
-
the date we make the Software available. On or after that date, you may use the
|
|
92
|
-
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
-
will apply:
|
|
94
|
-
|
|
95
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
-
this file except in compliance with the License.
|
|
97
|
-
|
|
98
|
-
You may obtain a copy of the License at
|
|
99
|
-
|
|
100
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
-
|
|
102
|
-
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
-
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
-
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
-
specific language governing permissions and limitations under the License.
|