@lanework/contracts 0.5.0 → 0.5.1
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/dist/agent-notes.d.ts +30 -0
- package/dist/auth.d.ts +205 -0
- package/dist/avatar.d.ts +42 -0
- package/dist/boards.d.ts +809 -0
- package/dist/checkpoints.d.ts +86 -0
- package/dist/common.d.ts +54 -0
- package/dist/endpoints.d.ts +146 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +1540 -0
- package/dist/sync.d.ts +147 -0
- package/dist/tools/board.d.ts +159 -0
- package/dist/tools/control.d.ts +52 -0
- package/dist/tools/index.d.ts +15 -0
- package/dist/tools/instructions.d.ts +12 -0
- package/dist/tools/kit.d.ts +123 -0
- package/dist/tools/outputs.d.ts +21 -0
- package/dist/tools/schema.d.ts +78 -0
- package/package.json +10 -2
package/dist/index.js
ADDED
|
@@ -0,0 +1,1540 @@
|
|
|
1
|
+
// src/agent-notes.ts
|
|
2
|
+
var MCP_URL = "https://mcp.lanework.dev/v1";
|
|
3
|
+
var MCP_WORKER_URL = "https://mcp.lanework.dev/v1?toolset=worker";
|
|
4
|
+
var MCP_HOST = "mcp.lanework.dev";
|
|
5
|
+
var AGENT_NOTES = `## Lanework board
|
|
6
|
+
|
|
7
|
+
Cards for this repo live on Lanework, through the \`lanework\` MCP server.
|
|
8
|
+
Follow its instructions for finding the board, writing cards and working
|
|
9
|
+
them. If the server is not connected, say so and stop rather than tracking
|
|
10
|
+
the work another way.`;
|
|
11
|
+
var AGENT_NOTES_PREVIOUS = [
|
|
12
|
+
`## Lanework board
|
|
13
|
+
|
|
14
|
+
Cards for this repo live on Lanework, through the \`lanework\` MCP server.
|
|
15
|
+
|
|
16
|
+
- Find the board with \`git remote get-url origin\`, then
|
|
17
|
+
\`list_boards({ repo })\`. Never pick a board by its name. If no board is
|
|
18
|
+
linked, ask me which one it is — or whether to make a new one — then call
|
|
19
|
+
\`link_repo\` or \`create_board\`.
|
|
20
|
+
- Before creating a card, read \`board_summary\` and reuse the board's
|
|
21
|
+
categories and tags.
|
|
22
|
+
- Every \`create_review\` sets \`category\`, \`tags\` and \`priority\`.
|
|
23
|
+
- Put decisions in the card's checklist, and start the work only after I
|
|
24
|
+
have ticked them.
|
|
25
|
+
- Move cards with \`set_status\`; tick verify steps with \`toggle_item\`.
|
|
26
|
+
- A card that touches two or more separate areas gets \`streams\`: one
|
|
27
|
+
sub-agent each, with exact \`owns\` paths and a verify step tagged with
|
|
28
|
+
its key. Shared types go in a \`W0\` the others depend on; at most 4
|
|
29
|
+
streams per wave.
|
|
30
|
+
- Handed a card with \`streams\`, you are the lead: run \`dispatch\` wave
|
|
31
|
+
by wave, one sub-agent per stream in its own worktree, each given its
|
|
32
|
+
brief as is. Sub-agents write only in \`owns\`, never commit and never
|
|
33
|
+
call Lanework. After each wave, merge, re-run each stream's checks, tick
|
|
34
|
+
its verify steps and \`checkpoint\` once.`
|
|
35
|
+
];
|
|
36
|
+
// src/auth.ts
|
|
37
|
+
var LOOPBACK_CALLBACK_PATH = "/oauth/callback";
|
|
38
|
+
// src/avatar.ts
|
|
39
|
+
var PROJECT_AVATAR_COLORS = [
|
|
40
|
+
"slate",
|
|
41
|
+
"red",
|
|
42
|
+
"orange",
|
|
43
|
+
"amber",
|
|
44
|
+
"green",
|
|
45
|
+
"teal",
|
|
46
|
+
"sky",
|
|
47
|
+
"blue",
|
|
48
|
+
"violet",
|
|
49
|
+
"pink",
|
|
50
|
+
"sunset",
|
|
51
|
+
"ocean",
|
|
52
|
+
"forest",
|
|
53
|
+
"candy",
|
|
54
|
+
"dusk",
|
|
55
|
+
"aurora"
|
|
56
|
+
];
|
|
57
|
+
var PROJECT_AVATAR_ICONS = [
|
|
58
|
+
"Rocket01Icon",
|
|
59
|
+
"SourceCodeIcon",
|
|
60
|
+
"ComputerTerminal01Icon",
|
|
61
|
+
"GitBranchIcon",
|
|
62
|
+
"Bug01Icon",
|
|
63
|
+
"Database01Icon",
|
|
64
|
+
"ServerStack01Icon",
|
|
65
|
+
"CloudIcon",
|
|
66
|
+
"Globe02Icon",
|
|
67
|
+
"Link01Icon",
|
|
68
|
+
"Layers01Icon",
|
|
69
|
+
"Package01Icon",
|
|
70
|
+
"DashboardSquare01Icon",
|
|
71
|
+
"Settings01Icon",
|
|
72
|
+
"Wrench01Icon",
|
|
73
|
+
"Shield01Icon",
|
|
74
|
+
"LockIcon",
|
|
75
|
+
"Robot01Icon",
|
|
76
|
+
"AiBrain01Icon",
|
|
77
|
+
"SparklesIcon",
|
|
78
|
+
"MagicWand01Icon",
|
|
79
|
+
"Briefcase01Icon",
|
|
80
|
+
"Analytics01Icon",
|
|
81
|
+
"ChartLineData01Icon",
|
|
82
|
+
"Wallet01Icon",
|
|
83
|
+
"CreditCardIcon",
|
|
84
|
+
"ShoppingCart01Icon",
|
|
85
|
+
"ShoppingBag01Icon",
|
|
86
|
+
"Store01Icon",
|
|
87
|
+
"Target02Icon",
|
|
88
|
+
"Flag01Icon",
|
|
89
|
+
"Award01Icon",
|
|
90
|
+
"Mail01Icon",
|
|
91
|
+
"BubbleChatIcon",
|
|
92
|
+
"Notification01Icon",
|
|
93
|
+
"Calendar03Icon",
|
|
94
|
+
"Clock01Icon",
|
|
95
|
+
"Folder01Icon",
|
|
96
|
+
"File01Icon",
|
|
97
|
+
"Book02Icon",
|
|
98
|
+
"School01Icon",
|
|
99
|
+
"PencilEdit01Icon",
|
|
100
|
+
"Home01Icon",
|
|
101
|
+
"UserIcon",
|
|
102
|
+
"UserGroupIcon",
|
|
103
|
+
"Location01Icon",
|
|
104
|
+
"Compass01Icon",
|
|
105
|
+
"Car01Icon",
|
|
106
|
+
"Airplane01Icon",
|
|
107
|
+
"AnchorIcon",
|
|
108
|
+
"PaintBoardIcon",
|
|
109
|
+
"ColorsIcon",
|
|
110
|
+
"Image01Icon",
|
|
111
|
+
"Camera01Icon",
|
|
112
|
+
"MusicNote01Icon",
|
|
113
|
+
"HeadphonesIcon",
|
|
114
|
+
"GameController01Icon",
|
|
115
|
+
"PuzzleIcon",
|
|
116
|
+
"Atom01Icon",
|
|
117
|
+
"TestTube01Icon",
|
|
118
|
+
"Idea01Icon",
|
|
119
|
+
"Sun01Icon",
|
|
120
|
+
"Moon02Icon",
|
|
121
|
+
"FlashIcon",
|
|
122
|
+
"FireIcon",
|
|
123
|
+
"Leaf01Icon",
|
|
124
|
+
"Plant01Icon",
|
|
125
|
+
"Tree01Icon",
|
|
126
|
+
"Coffee01Icon",
|
|
127
|
+
"Pizza01Icon",
|
|
128
|
+
"BirthdayCakeIcon",
|
|
129
|
+
"GiftIcon",
|
|
130
|
+
"Diamond01Icon",
|
|
131
|
+
"CrownIcon",
|
|
132
|
+
"StarIcon",
|
|
133
|
+
"FavouriteIcon",
|
|
134
|
+
"SmileIcon"
|
|
135
|
+
];
|
|
136
|
+
var COLORS = new Set(PROJECT_AVATAR_COLORS);
|
|
137
|
+
var ICONS = new Set(PROJECT_AVATAR_ICONS);
|
|
138
|
+
var GRAPHEMES = new Intl.Segmenter(undefined, { granularity: "grapheme" });
|
|
139
|
+
var CONTROL = /\p{Cc}|\p{Cf}/u;
|
|
140
|
+
var EMOJI = /\p{Extended_Pictographic}|\p{Regional_Indicator}|⃣/u;
|
|
141
|
+
function graphemes(text) {
|
|
142
|
+
return Array.from(GRAPHEMES.segment(text), (s) => s.segment);
|
|
143
|
+
}
|
|
144
|
+
function isObject(value) {
|
|
145
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
146
|
+
}
|
|
147
|
+
function parseProjectAvatar(value) {
|
|
148
|
+
if (!isObject(value))
|
|
149
|
+
return null;
|
|
150
|
+
const { kind, color } = value;
|
|
151
|
+
if (typeof color !== "string" || !COLORS.has(color))
|
|
152
|
+
return null;
|
|
153
|
+
const c = color;
|
|
154
|
+
switch (kind) {
|
|
155
|
+
case "letter": {
|
|
156
|
+
const { text } = value;
|
|
157
|
+
if (typeof text !== "string" || text.trim() !== text)
|
|
158
|
+
return null;
|
|
159
|
+
if (CONTROL.test(text))
|
|
160
|
+
return null;
|
|
161
|
+
const n = graphemes(text).length;
|
|
162
|
+
if (n < 1 || n > 2)
|
|
163
|
+
return null;
|
|
164
|
+
return { kind, text, color: c };
|
|
165
|
+
}
|
|
166
|
+
case "emoji": {
|
|
167
|
+
const { emoji } = value;
|
|
168
|
+
if (typeof emoji !== "string")
|
|
169
|
+
return null;
|
|
170
|
+
const g = graphemes(emoji);
|
|
171
|
+
if (g.length !== 1 || !EMOJI.test(emoji))
|
|
172
|
+
return null;
|
|
173
|
+
return { kind, emoji, color: c };
|
|
174
|
+
}
|
|
175
|
+
case "icon": {
|
|
176
|
+
const { icon } = value;
|
|
177
|
+
if (typeof icon !== "string" || !ICONS.has(icon))
|
|
178
|
+
return null;
|
|
179
|
+
return { kind, icon, color: c };
|
|
180
|
+
}
|
|
181
|
+
default:
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// src/boards.ts
|
|
186
|
+
var WORK_ITEM_TYPES = ["epic", "issue", "task"];
|
|
187
|
+
var PRIORITIES = ["low", "medium", "high"];
|
|
188
|
+
var CHECKLIST_SECTIONS = ["decisions", "verify"];
|
|
189
|
+
var COLUMN_ROLES = [
|
|
190
|
+
"intake",
|
|
191
|
+
"start",
|
|
192
|
+
"active",
|
|
193
|
+
"review",
|
|
194
|
+
"done",
|
|
195
|
+
"archive"
|
|
196
|
+
];
|
|
197
|
+
var LINK_TYPES = [
|
|
198
|
+
"blocks",
|
|
199
|
+
"blocked_by",
|
|
200
|
+
"relates",
|
|
201
|
+
"duplicates"
|
|
202
|
+
];
|
|
203
|
+
var STREAM_ROLES = ["research", "implement", "test"];
|
|
204
|
+
var STREAM_ISOLATIONS = ["worktree", "shared"];
|
|
205
|
+
var MAX_CHANGES_REASON = 2000;
|
|
206
|
+
var DEFAULT_LIMIT = 50;
|
|
207
|
+
var MAX_LIMIT = 200;
|
|
208
|
+
var ICON_KEY_HEADER = "x-icon-key";
|
|
209
|
+
// src/checkpoints.ts
|
|
210
|
+
var CHECKPOINTS_KEPT = 5;
|
|
211
|
+
var CHECKPOINT_MAX_BYTES = 16 * 1024;
|
|
212
|
+
// src/common.ts
|
|
213
|
+
var DEFAULT_API_ORIGIN = "https://api.lanework.dev";
|
|
214
|
+
var AGENT_HEADER = "x-lanework-agent";
|
|
215
|
+
var TOKEN_PREFIXES = {
|
|
216
|
+
registration: "lw_reg_",
|
|
217
|
+
machine: "lw_mch_",
|
|
218
|
+
device: "lw_dev_",
|
|
219
|
+
code: "lw_code_"
|
|
220
|
+
};
|
|
221
|
+
var MACHINE_SECRET_PATTERN = new RegExp(`^${TOKEN_PREFIXES.machine}[A-Za-z0-9_-]{16,190}$`);
|
|
222
|
+
function isMachineSecret(value) {
|
|
223
|
+
return typeof value === "string" && MACHINE_SECRET_PATTERN.test(value);
|
|
224
|
+
}
|
|
225
|
+
function stripUserinfo(remote) {
|
|
226
|
+
const value = remote.trim();
|
|
227
|
+
if (!/^[a-z][a-z0-9+.-]*:\/\//i.test(value))
|
|
228
|
+
return value;
|
|
229
|
+
try {
|
|
230
|
+
const url = new URL(value);
|
|
231
|
+
if (!url.username && !url.password)
|
|
232
|
+
return value;
|
|
233
|
+
url.username = "";
|
|
234
|
+
url.password = "";
|
|
235
|
+
return url.toString();
|
|
236
|
+
} catch {
|
|
237
|
+
return value.replace(/^([a-z][a-z0-9+.-]*:\/\/)[^/]*@/i, "$1");
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
// src/endpoints.ts
|
|
241
|
+
function seg(value) {
|
|
242
|
+
if (value === "" || value === "." || value === "..")
|
|
243
|
+
throw new Error(`Refusing the path segment ${JSON.stringify(value)}.`);
|
|
244
|
+
return encodeURIComponent(value);
|
|
245
|
+
}
|
|
246
|
+
var paths = {
|
|
247
|
+
health: () => "/v1/health",
|
|
248
|
+
cliAuth: () => "/v1/cli/auth",
|
|
249
|
+
cliToken: () => "/v1/cli/token",
|
|
250
|
+
machinesRegister: () => "/v1/machines/register",
|
|
251
|
+
machinesMe: () => "/v1/machines/me",
|
|
252
|
+
machinesHeartbeat: () => "/v1/machines/heartbeat",
|
|
253
|
+
syncState: () => "/v1/sync/state",
|
|
254
|
+
syncWorkspace: () => "/v1/sync/state/workspace",
|
|
255
|
+
syncWorkspaceById: (id) => `/v1/sync/state/workspace/${seg(id)}`,
|
|
256
|
+
syncWorkspaceOrder: () => "/v1/sync/state/workspace-order",
|
|
257
|
+
boardsForRepo: (remote) => `/v1/boards?repo=${seg(stripUserinfo(remote))}`,
|
|
258
|
+
boardRepo: (workspaceId) => `/v1/boards/${seg(workspaceId)}/repo`,
|
|
259
|
+
boardConfig: (workspaceId) => `/v1/boards/${seg(workspaceId)}/config`,
|
|
260
|
+
boardIcon: (workspaceId) => `/v1/boards/${seg(workspaceId)}/icon`,
|
|
261
|
+
boardPresence: (workspaceId) => `/v1/boards/${seg(workspaceId)}/presence`,
|
|
262
|
+
boardStats: (workspaceId, query) => withQuery(`/v1/boards/${seg(workspaceId)}/stats`, query),
|
|
263
|
+
boardChanges: (workspaceId, since, limit) => `/v1/boards/${seg(workspaceId)}/changes?since=${since}${limit === undefined ? "" : `&limit=${limit}`}`,
|
|
264
|
+
boardLookup: (workspaceId, by) => `/v1/boards/${seg(workspaceId)}/lookup?${"taskId" in by ? `taskId=${seg(by.taskId)}` : `source=${seg(by.source)}`}`,
|
|
265
|
+
boardImport: (workspaceId) => `/v1/boards/${seg(workspaceId)}/import`,
|
|
266
|
+
boardMigrated: (workspaceId) => `/v1/boards/${seg(workspaceId)}/migrated`,
|
|
267
|
+
boardPurge: (workspaceId) => `/v1/boards/${seg(workspaceId)}/purge`,
|
|
268
|
+
items: (workspaceId, query) => withQuery(`/v1/boards/${seg(workspaceId)}/items`, query),
|
|
269
|
+
item: (workspaceId, itemId) => `/v1/boards/${seg(workspaceId)}/items/${seg(itemId)}`,
|
|
270
|
+
itemMove: (workspaceId, itemId) => `${paths.item(workspaceId, itemId)}/move`,
|
|
271
|
+
itemRestore: (workspaceId, itemId) => `${paths.item(workspaceId, itemId)}/restore`,
|
|
272
|
+
itemChecklist: (workspaceId, itemId) => `${paths.item(workspaceId, itemId)}/checklist`,
|
|
273
|
+
itemChecklistItem: (workspaceId, itemId, key) => `${paths.item(workspaceId, itemId)}/checklist/${seg(key)}`,
|
|
274
|
+
itemLinks: (workspaceId, itemId) => `${paths.item(workspaceId, itemId)}/links`,
|
|
275
|
+
itemLink: (workspaceId, itemId, linkId) => `${paths.item(workspaceId, itemId)}/links/${seg(linkId)}`,
|
|
276
|
+
itemComments: (workspaceId, itemId) => `${paths.item(workspaceId, itemId)}/comments`,
|
|
277
|
+
itemComment: (workspaceId, itemId, commentId) => `${paths.item(workspaceId, itemId)}/comments/${seg(commentId)}`,
|
|
278
|
+
itemSubscription: (workspaceId, itemId) => `${paths.item(workspaceId, itemId)}/subscription`,
|
|
279
|
+
itemFavorite: (workspaceId, itemId) => `${paths.item(workspaceId, itemId)}/favorite`,
|
|
280
|
+
itemAttachments: (workspaceId, itemId) => `${paths.item(workspaceId, itemId)}/attachments`,
|
|
281
|
+
itemAttachment: (workspaceId, itemId, attachmentId) => `${paths.item(workspaceId, itemId)}/attachments/${seg(attachmentId)}`,
|
|
282
|
+
itemAudit: (workspaceId, itemId) => `${paths.item(workspaceId, itemId)}/audit`,
|
|
283
|
+
itemActivity: (workspaceId, itemId, query) => withQuery(`${paths.item(workspaceId, itemId)}/activity`, query),
|
|
284
|
+
itemCheckpoints: (workspaceId, ref) => `/v1/boards/${seg(workspaceId)}/items/${seg(ref)}/checkpoints`
|
|
285
|
+
};
|
|
286
|
+
function withQuery(path, query) {
|
|
287
|
+
const text = query === undefined ? "" : String(query);
|
|
288
|
+
return text ? `${path}?${text}` : path;
|
|
289
|
+
}
|
|
290
|
+
// src/tools/control.ts
|
|
291
|
+
var CONTROL_TOOL_LIMITS = {
|
|
292
|
+
TITLE_MAX: 160,
|
|
293
|
+
PROMPT_MAX: 30000,
|
|
294
|
+
FILES_MAX: 64,
|
|
295
|
+
WAIT_MAX_SECONDS: 25,
|
|
296
|
+
AGENT_NAME_MAX: 120,
|
|
297
|
+
READ_LIMIT_MAX: 5,
|
|
298
|
+
READ_LIMIT_DEFAULT: 2,
|
|
299
|
+
READ_CHARS_MIN: 200,
|
|
300
|
+
READ_CHARS_MAX: 6000,
|
|
301
|
+
READ_CHARS_DEFAULT: 1500,
|
|
302
|
+
MEMORY_NOTES_MAX: 8000,
|
|
303
|
+
LEAD_NAME_MAX: 60,
|
|
304
|
+
LEAD_INSTRUCTIONS_MAX: 20000,
|
|
305
|
+
LEAD_CONTEXT_FILES_MAX: 20
|
|
306
|
+
};
|
|
307
|
+
var L = CONTROL_TOOL_LIMITS;
|
|
308
|
+
var EFFORTS = ["low", "medium", "high", "xhigh", "max"];
|
|
309
|
+
var AGENTS = ["claude", "codex", "opencode"];
|
|
310
|
+
var LEAD_AGENTS = ["claude", "codex"];
|
|
311
|
+
var PERMISSIONS = [
|
|
312
|
+
"manual",
|
|
313
|
+
"acceptEdits",
|
|
314
|
+
"auto",
|
|
315
|
+
"bypassPermissions"
|
|
316
|
+
];
|
|
317
|
+
var LEAD_ICONS = [
|
|
318
|
+
"Robot02Icon",
|
|
319
|
+
"Brain02Icon",
|
|
320
|
+
"Flowchart01Icon",
|
|
321
|
+
"Target02Icon",
|
|
322
|
+
"Shield01Icon",
|
|
323
|
+
"MagicWand01Icon",
|
|
324
|
+
"SparklesIcon",
|
|
325
|
+
"Wrench01Icon",
|
|
326
|
+
"Layers01Icon",
|
|
327
|
+
"Idea01Icon",
|
|
328
|
+
"FlashIcon",
|
|
329
|
+
"AiChipIcon"
|
|
330
|
+
];
|
|
331
|
+
var EFFORT = {
|
|
332
|
+
type: "string",
|
|
333
|
+
enum: EFFORTS,
|
|
334
|
+
description: "Reasoning effort"
|
|
335
|
+
};
|
|
336
|
+
var NOTIFY = {
|
|
337
|
+
type: "boolean",
|
|
338
|
+
description: "Default true: Lanework tells you once the session's turn ends, so you review it"
|
|
339
|
+
};
|
|
340
|
+
var SESSION_ID = {
|
|
341
|
+
type: "string",
|
|
342
|
+
description: "A sessionId from sessions_list"
|
|
343
|
+
};
|
|
344
|
+
var TASK_ID = {
|
|
345
|
+
type: "string",
|
|
346
|
+
description: "A taskId from run_list: 1-64 letters, digits, - or _"
|
|
347
|
+
};
|
|
348
|
+
var REQUEST_ID = {
|
|
349
|
+
type: "string",
|
|
350
|
+
description: "The requestId of the task's needsInput"
|
|
351
|
+
};
|
|
352
|
+
var WORKER_TEXT = {
|
|
353
|
+
type: "string",
|
|
354
|
+
description: `Instructions for the worker, at most ${L.PROMPT_MAX} characters`
|
|
355
|
+
};
|
|
356
|
+
var SCOPES = {
|
|
357
|
+
type: "string[]",
|
|
358
|
+
description: `The write scope: at most ${L.FILES_MAX} project-relative paths; a directory covers what is under it, ["."] the whole checkout, [] edits no file`
|
|
359
|
+
};
|
|
360
|
+
var CONTROL_TOOLS = /* @__PURE__ */ (() => [
|
|
361
|
+
{
|
|
362
|
+
name: "sessions_start",
|
|
363
|
+
action: "sessions.start",
|
|
364
|
+
role: "conductor",
|
|
365
|
+
description: "Start a separate session in this project's checkout and submit the prompt as its first turn. It runs on your permission mode, under the title, and is yours alone: the user reaches it through you. agent defaults to yours; model and effort to yours on your agent, else that agent's default (OpenCode's model is provider/model). Unless notifyOnComplete is false, Lanework tells you once its turn ends: review it then and report to the user. Returns as soon as it started, with its sessionId. At most 4 of your sessions may work at once.",
|
|
366
|
+
readOnly: false,
|
|
367
|
+
properties: {
|
|
368
|
+
title: {
|
|
369
|
+
type: "string",
|
|
370
|
+
description: `A short title, at most ${L.AGENT_NAME_MAX} characters`
|
|
371
|
+
},
|
|
372
|
+
prompt: {
|
|
373
|
+
type: "string",
|
|
374
|
+
description: `Self-contained instructions, at most ${L.PROMPT_MAX} characters`
|
|
375
|
+
},
|
|
376
|
+
agent: {
|
|
377
|
+
type: "string",
|
|
378
|
+
enum: AGENTS,
|
|
379
|
+
description: "The CLI it runs on"
|
|
380
|
+
},
|
|
381
|
+
model: {
|
|
382
|
+
type: "string",
|
|
383
|
+
description: "A model id; provider/model when agent is opencode"
|
|
384
|
+
},
|
|
385
|
+
effort: EFFORT,
|
|
386
|
+
taskId: {
|
|
387
|
+
type: "string",
|
|
388
|
+
description: 'The board card it works on, e.g. "FE-98"'
|
|
389
|
+
},
|
|
390
|
+
notifyOnComplete: NOTIFY
|
|
391
|
+
},
|
|
392
|
+
required: ["title", "prompt"]
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
name: "sessions_list",
|
|
396
|
+
action: "sessions.list",
|
|
397
|
+
role: "conductor",
|
|
398
|
+
description: "The sessions you started, newest first, with their status: working, waiting (on the user), idle, failed or terminal.",
|
|
399
|
+
readOnly: true,
|
|
400
|
+
properties: {}
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
name: "sessions_read",
|
|
404
|
+
action: "sessions.read",
|
|
405
|
+
role: "conductor",
|
|
406
|
+
description: "The last exchanges of one of your sessions, prompts and replies only, each cut to maxChars.",
|
|
407
|
+
readOnly: true,
|
|
408
|
+
properties: {
|
|
409
|
+
sessionId: SESSION_ID,
|
|
410
|
+
limit: {
|
|
411
|
+
type: "integer",
|
|
412
|
+
minimum: 1,
|
|
413
|
+
maximum: L.READ_LIMIT_MAX,
|
|
414
|
+
description: `Exchanges returned; default ${L.READ_LIMIT_DEFAULT}`
|
|
415
|
+
},
|
|
416
|
+
maxChars: {
|
|
417
|
+
type: "integer",
|
|
418
|
+
minimum: L.READ_CHARS_MIN,
|
|
419
|
+
maximum: L.READ_CHARS_MAX,
|
|
420
|
+
description: `Each message cut to this; default ${L.READ_CHARS_DEFAULT}`
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
required: ["sessionId"]
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
name: "sessions_send",
|
|
427
|
+
action: "sessions.send",
|
|
428
|
+
role: "conductor",
|
|
429
|
+
description: "A follow-up to one of your sessions. Refused while it works or waits on the user. notifyOnComplete works as in sessions_start.",
|
|
430
|
+
readOnly: false,
|
|
431
|
+
properties: {
|
|
432
|
+
sessionId: SESSION_ID,
|
|
433
|
+
prompt: {
|
|
434
|
+
type: "string",
|
|
435
|
+
description: `The follow-up, at most ${L.PROMPT_MAX} characters`
|
|
436
|
+
},
|
|
437
|
+
notifyOnComplete: NOTIFY
|
|
438
|
+
},
|
|
439
|
+
required: ["sessionId", "prompt"]
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
name: "memory_read",
|
|
443
|
+
action: "memory.read",
|
|
444
|
+
role: "conductor",
|
|
445
|
+
description: "What you remember of this project across your conversations: your last 30 sessions with a summary each, the last 20 orchestration runs you led with each worker's outcome, and your notes. Read it before you plan.",
|
|
446
|
+
readOnly: true,
|
|
447
|
+
properties: {}
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
name: "memory_append",
|
|
451
|
+
action: "memory.append",
|
|
452
|
+
role: "conductor",
|
|
453
|
+
description: "Add one fact to your notes for this project, on a new line; the rest stays. Prefer it to memory_write for one new decision or fact. Refused when the notes would grow past 8000 characters: then rewrite them shorter with memory_write.",
|
|
454
|
+
readOnly: false,
|
|
455
|
+
properties: {
|
|
456
|
+
text: {
|
|
457
|
+
type: "string",
|
|
458
|
+
description: "The fact to add, non-empty"
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
required: ["text"]
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
name: "memory_write",
|
|
465
|
+
action: "memory.write",
|
|
466
|
+
role: "conductor",
|
|
467
|
+
description: 'Replace your notes for this project, at most 8000 characters: send everything worth keeping, the old notes are gone. "" clears them. Use it only for a full rewrite; memory_append adds one fact. Lanework keeps the ledger.',
|
|
468
|
+
readOnly: false,
|
|
469
|
+
properties: {
|
|
470
|
+
notes: {
|
|
471
|
+
type: "string",
|
|
472
|
+
description: `The whole notes, at most ${L.MEMORY_NOTES_MAX} characters`
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
required: ["notes"]
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
name: "models_list",
|
|
479
|
+
action: "models.list",
|
|
480
|
+
role: "any",
|
|
481
|
+
description: "The models a proposal's tasks may name, grouped by agent (OpenCode ids grouped by provider: the id is provider/model), and for a conductor how each model fared in its past runs. Call it before naming a model; or leave agent and model null for Lanework to pick by tier.",
|
|
482
|
+
readOnly: true,
|
|
483
|
+
properties: {
|
|
484
|
+
agent: {
|
|
485
|
+
type: "string",
|
|
486
|
+
enum: AGENTS,
|
|
487
|
+
description: "Only this agent's models"
|
|
488
|
+
},
|
|
489
|
+
query: {
|
|
490
|
+
type: "string",
|
|
491
|
+
description: "Only ids containing this text, e.g. sonnet or glm"
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
name: "conductors_create",
|
|
497
|
+
action: "conductors.create",
|
|
498
|
+
role: "any",
|
|
499
|
+
description: "Save a conductor of your own in this project, as the Conductors rail's dialog would, and return its id. Only name is required: agent, model and effort default to yours, instructions to the dialog's template, contextFiles to none, permission to the composer's default. Never replaces one: a taken id gets -2, -3. It does not start the conductor; the user opens it from the rail.",
|
|
500
|
+
readOnly: false,
|
|
501
|
+
properties: {
|
|
502
|
+
name: {
|
|
503
|
+
type: "string",
|
|
504
|
+
description: `One line, at most ${L.LEAD_NAME_MAX} characters`
|
|
505
|
+
},
|
|
506
|
+
instructions: {
|
|
507
|
+
type: "string",
|
|
508
|
+
description: `Its instructions, markdown, at most ${L.LEAD_INSTRUCTIONS_MAX} characters`
|
|
509
|
+
},
|
|
510
|
+
icon: { type: "string", enum: LEAD_ICONS },
|
|
511
|
+
agent: { type: "string", enum: LEAD_AGENTS },
|
|
512
|
+
model: { type: "string", description: "A model id" },
|
|
513
|
+
effort: EFFORT,
|
|
514
|
+
contextFiles: {
|
|
515
|
+
type: "string[]",
|
|
516
|
+
description: `At most ${L.LEAD_CONTEXT_FILES_MAX} project-relative paths`
|
|
517
|
+
},
|
|
518
|
+
permission: { type: "string", enum: PERMISSIONS }
|
|
519
|
+
},
|
|
520
|
+
required: ["name"]
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
name: "run_list",
|
|
524
|
+
action: "list",
|
|
525
|
+
role: "lead",
|
|
526
|
+
description: "The run, every task with its status and latest result, and the agent/model ids run_delegate may name (run.choices).",
|
|
527
|
+
readOnly: true,
|
|
528
|
+
properties: {}
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
name: "run_delegate",
|
|
532
|
+
action: "delegate",
|
|
533
|
+
role: "lead",
|
|
534
|
+
description: "Queue a worker and return its taskId. files is its write scope. With no model, Jev picks a tier when it is on and sure, otherwise the standard tier runs it. dependsOn holds taskIds that must be reviewed (accepted) before this one starts. A scope beyond what the user approved, or naming agent config (.claude, .codex, .mcp.json, .vscode, .husky, .lanework), waits for the user on the run's panel: the task shows scopeApproval.",
|
|
535
|
+
readOnly: false,
|
|
536
|
+
properties: {
|
|
537
|
+
title: {
|
|
538
|
+
type: "string",
|
|
539
|
+
description: `A short title, at most ${L.TITLE_MAX} characters`
|
|
540
|
+
},
|
|
541
|
+
prompt: {
|
|
542
|
+
type: "string",
|
|
543
|
+
description: `Self-contained instructions, at most ${L.PROMPT_MAX} characters`
|
|
544
|
+
},
|
|
545
|
+
files: SCOPES,
|
|
546
|
+
agent: { type: "string", enum: AGENTS },
|
|
547
|
+
model: {
|
|
548
|
+
type: "string",
|
|
549
|
+
description: "A model id from run_list; provider/model for opencode"
|
|
550
|
+
},
|
|
551
|
+
effort: EFFORT,
|
|
552
|
+
dependsOn: { type: "string[]", description: "taskIds" }
|
|
553
|
+
},
|
|
554
|
+
required: ["title", "prompt", "files"]
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
name: "run_get",
|
|
558
|
+
action: "get",
|
|
559
|
+
role: "lead",
|
|
560
|
+
description: "One task, with its latest result. A tool approval it waits on shows in needsInput with the tool's input (secrets redacted): decide on that, not on summary.",
|
|
561
|
+
readOnly: true,
|
|
562
|
+
properties: { taskId: TASK_ID },
|
|
563
|
+
required: ["taskId"]
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
name: "run_wait",
|
|
567
|
+
action: "wait",
|
|
568
|
+
role: "lead",
|
|
569
|
+
description: "Block until a task changes, or until the timeout. changed lists the taskIds that moved; it is empty on a timeout or when nothing is left running or queued. For one short wait only: never loop on it; end your turn instead, and Lanework sends you a turn when a task needs you.",
|
|
570
|
+
readOnly: true,
|
|
571
|
+
properties: {
|
|
572
|
+
timeoutSeconds: {
|
|
573
|
+
type: "integer",
|
|
574
|
+
minimum: 0,
|
|
575
|
+
maximum: L.WAIT_MAX_SECONDS
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
name: "run_respond",
|
|
581
|
+
action: "respond",
|
|
582
|
+
role: "lead",
|
|
583
|
+
description: "Allow or deny the tool a worker is waiting on (its needsInput). It stays stopped until you decide.",
|
|
584
|
+
readOnly: false,
|
|
585
|
+
properties: {
|
|
586
|
+
taskId: TASK_ID,
|
|
587
|
+
requestId: REQUEST_ID,
|
|
588
|
+
decision: { type: "string", enum: ["allow", "deny"] }
|
|
589
|
+
},
|
|
590
|
+
required: ["taskId", "requestId", "decision"]
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
name: "run_answer",
|
|
594
|
+
action: "answer",
|
|
595
|
+
role: "lead",
|
|
596
|
+
description: "Answer the question a worker asked (its text and options come from needsInput), or skip it. Pass exactly one of answers and skip.",
|
|
597
|
+
readOnly: false,
|
|
598
|
+
properties: {
|
|
599
|
+
taskId: TASK_ID,
|
|
600
|
+
requestId: REQUEST_ID,
|
|
601
|
+
answers: {
|
|
602
|
+
type: "string-map",
|
|
603
|
+
description: "1-8 entries: question text to answer, each a string"
|
|
604
|
+
},
|
|
605
|
+
skip: { type: "boolean", description: "true to skip the question" }
|
|
606
|
+
},
|
|
607
|
+
required: ["taskId", "requestId"]
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
name: "run_steer",
|
|
611
|
+
action: "steer",
|
|
612
|
+
role: "lead",
|
|
613
|
+
description: "Redirect a worker that is still running, without discarding what it has done. Use it the moment one drifts; run_message only lands once it has stopped.",
|
|
614
|
+
readOnly: false,
|
|
615
|
+
properties: { taskId: TASK_ID, text: WORKER_TEXT },
|
|
616
|
+
required: ["taskId", "text"]
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
name: "run_message",
|
|
620
|
+
action: "message",
|
|
621
|
+
role: "lead",
|
|
622
|
+
description: "Give a stopped worker another turn in its own scope; it keeps its session, worktree and history.",
|
|
623
|
+
readOnly: false,
|
|
624
|
+
properties: { taskId: TASK_ID, text: WORKER_TEXT },
|
|
625
|
+
required: ["taskId", "text"]
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
name: "run_retry",
|
|
629
|
+
action: "retry",
|
|
630
|
+
role: "lead",
|
|
631
|
+
description: "Retry a stopped worker with corrected write scopes. Use it only when the extra files are really needed. Scopes beyond what the user approved wait for them, as with run_delegate.",
|
|
632
|
+
readOnly: false,
|
|
633
|
+
properties: { taskId: TASK_ID, text: WORKER_TEXT, files: SCOPES },
|
|
634
|
+
required: ["taskId", "text", "files"]
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
name: "run_cancel",
|
|
638
|
+
action: "cancel",
|
|
639
|
+
role: "lead",
|
|
640
|
+
description: "Cancel a task, running or still queued.",
|
|
641
|
+
readOnly: false,
|
|
642
|
+
properties: { taskId: TASK_ID },
|
|
643
|
+
required: ["taskId"]
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
name: "run_review",
|
|
647
|
+
action: "review",
|
|
648
|
+
role: "lead",
|
|
649
|
+
description: "Accept a completed task's result.",
|
|
650
|
+
readOnly: false,
|
|
651
|
+
properties: { taskId: TASK_ID },
|
|
652
|
+
required: ["taskId"]
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
name: "run_finish",
|
|
656
|
+
action: "finish",
|
|
657
|
+
role: "lead",
|
|
658
|
+
description: "End the run, once every task is accepted or cancelled.",
|
|
659
|
+
readOnly: false,
|
|
660
|
+
properties: {}
|
|
661
|
+
}
|
|
662
|
+
])();
|
|
663
|
+
function controlToolsFor(roles) {
|
|
664
|
+
return CONTROL_TOOLS.filter((tool) => tool.role === "any" || tool.role === "conductor" && roles.conductor || tool.role === "lead" && roles.lead);
|
|
665
|
+
}
|
|
666
|
+
function controlTool(name) {
|
|
667
|
+
return CONTROL_TOOLS.find((tool) => tool.name === name);
|
|
668
|
+
}
|
|
669
|
+
// src/tools/board.ts
|
|
670
|
+
var BOARD_ID = {
|
|
671
|
+
type: "string",
|
|
672
|
+
description: "Workspace id of the board, from `list_boards`."
|
|
673
|
+
};
|
|
674
|
+
var CARD = {
|
|
675
|
+
type: "string",
|
|
676
|
+
description: "Card id or task id, e.g. BE-07"
|
|
677
|
+
};
|
|
678
|
+
var REPO = {
|
|
679
|
+
type: "string",
|
|
680
|
+
description: "Output of `git remote get-url origin`, unmodified — ssh or https"
|
|
681
|
+
};
|
|
682
|
+
var PRIORITY = {
|
|
683
|
+
type: "string",
|
|
684
|
+
enum: ["low", "medium", "high"]
|
|
685
|
+
};
|
|
686
|
+
var ASSIGNEES = {
|
|
687
|
+
type: "object",
|
|
688
|
+
properties: {
|
|
689
|
+
users: { type: "string[]" },
|
|
690
|
+
agents: { type: "string[]" }
|
|
691
|
+
}
|
|
692
|
+
};
|
|
693
|
+
var streams = (description) => ({
|
|
694
|
+
type: "object[]",
|
|
695
|
+
description,
|
|
696
|
+
properties: {
|
|
697
|
+
key: {
|
|
698
|
+
type: "string",
|
|
699
|
+
description: "W0, W1, … — minted for you if omitted"
|
|
700
|
+
},
|
|
701
|
+
title: { type: "string", description: "One line, e.g. 'MCP tools'" },
|
|
702
|
+
goal: {
|
|
703
|
+
type: "string",
|
|
704
|
+
description: "What the sub-agent must deliver, self-contained: it starts with none of your context"
|
|
705
|
+
},
|
|
706
|
+
role: { type: "string", enum: ["research", "implement", "test"] },
|
|
707
|
+
owns: {
|
|
708
|
+
type: "string[]",
|
|
709
|
+
description: "Repo-relative paths it alone writes; a directory ends in '/'. No globs. Required unless role is research"
|
|
710
|
+
},
|
|
711
|
+
reads: { type: "string[]", description: "Paths it should read first" },
|
|
712
|
+
depends_on: {
|
|
713
|
+
type: "string[]",
|
|
714
|
+
description: "Stream keys that must finish before this one starts"
|
|
715
|
+
},
|
|
716
|
+
isolation: {
|
|
717
|
+
type: "string",
|
|
718
|
+
enum: ["worktree", "shared"],
|
|
719
|
+
description: "worktree (default): its own git worktree. shared: the lead's checkout, for read-only research"
|
|
720
|
+
}
|
|
721
|
+
},
|
|
722
|
+
required: ["title", "goal", "role"]
|
|
723
|
+
});
|
|
724
|
+
var BOARD_TOOLS = [
|
|
725
|
+
{
|
|
726
|
+
name: "list_boards",
|
|
727
|
+
title: "List boards",
|
|
728
|
+
description: "Every board you can see, with its workspace id and linked repo. Call this FIRST: every other tool needs a `board_id` and there is no default. Pass `repo` (your `git remote get-url origin`, as is) to get only the board(s) linked to the repo you are working in.",
|
|
729
|
+
readOnly: true,
|
|
730
|
+
properties: {
|
|
731
|
+
repo: REPO
|
|
732
|
+
}
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
name: "create_board",
|
|
736
|
+
title: "Create a board for this repo",
|
|
737
|
+
description: "Create a new board and link it to the git repo in one step. ONLY after the user chose to create a new board (offered next to the existing ones when list_boards({ repo }) found none) — never on your own initiative. Suggest `owner/name` from the remote as the name. Returns board_id for every other tool.",
|
|
738
|
+
readOnly: false,
|
|
739
|
+
properties: {
|
|
740
|
+
name: {
|
|
741
|
+
type: "string",
|
|
742
|
+
description: "Board name the user agreed to, e.g. `acme/widgets`"
|
|
743
|
+
},
|
|
744
|
+
slug: {
|
|
745
|
+
type: "string",
|
|
746
|
+
description: "Lower-case hyphenated key. Omit to derive it from the name."
|
|
747
|
+
},
|
|
748
|
+
repo: REPO
|
|
749
|
+
},
|
|
750
|
+
required: ["name", "repo"]
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
name: "link_repo",
|
|
754
|
+
title: "Link a board to a repo",
|
|
755
|
+
description: "Link a board to a git repo so list_boards({ repo }) finds it. Only call this after the USER has confirmed which board the repo belongs to — never on a guess from the board's name. Owner only. Refuses to replace a different linked repo unless `replace` is true.",
|
|
756
|
+
readOnly: false,
|
|
757
|
+
properties: {
|
|
758
|
+
board_id: BOARD_ID,
|
|
759
|
+
repo: REPO,
|
|
760
|
+
replace: {
|
|
761
|
+
type: "boolean",
|
|
762
|
+
description: "Move the link from the repo it has now. Only when the user asked."
|
|
763
|
+
}
|
|
764
|
+
},
|
|
765
|
+
required: ["board_id", "repo"]
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
name: "board_summary",
|
|
769
|
+
title: "Board summary",
|
|
770
|
+
description: "Lane-by-lane counts of live cards, plus the board's categories and tag policy. Read this before creating a card so its category and tags match what the board already uses. `stale` counts in-progress cards no agent has touched for over 2 hours — list_reviews flags which ones.",
|
|
771
|
+
readOnly: true,
|
|
772
|
+
properties: {
|
|
773
|
+
board_id: BOARD_ID
|
|
774
|
+
},
|
|
775
|
+
required: ["board_id"]
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
name: "lifecycle_status",
|
|
779
|
+
title: "Lifecycle status",
|
|
780
|
+
description: "What the board is waiting on: cards whose decisions are not all ticked (waiting), cards cleared to start (ready), cards being worked (in flight), and cards waiting for a human to review (review). Call this to pick up work rather than guessing from a list.",
|
|
781
|
+
readOnly: true,
|
|
782
|
+
properties: {
|
|
783
|
+
board_id: BOARD_ID
|
|
784
|
+
},
|
|
785
|
+
required: ["board_id"]
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
name: "list_reviews",
|
|
789
|
+
title: "List cards",
|
|
790
|
+
description: "Cards on a board, in the order the board draws them. Filter by lane, category, tag or priority. Archived cards are excluded unless asked for. Each card's `stale` is `{ since, lastAgent }` for in-progress work no agent has touched for over 2 hours, else null.",
|
|
791
|
+
readOnly: true,
|
|
792
|
+
properties: {
|
|
793
|
+
board_id: BOARD_ID,
|
|
794
|
+
column: {
|
|
795
|
+
type: "string",
|
|
796
|
+
description: "Lane key, e.g. todo | processing | done"
|
|
797
|
+
},
|
|
798
|
+
category: { type: "string", description: "Category key, e.g. backend" },
|
|
799
|
+
tag: { type: "string" },
|
|
800
|
+
priority: PRIORITY,
|
|
801
|
+
task_id: {
|
|
802
|
+
type: "string",
|
|
803
|
+
description: "Exact task id such as BE-07 — matched on the field, not the title"
|
|
804
|
+
},
|
|
805
|
+
include_archived: { type: "boolean" },
|
|
806
|
+
limit: { type: "integer", minimum: 1, maximum: 200 }
|
|
807
|
+
},
|
|
808
|
+
required: ["board_id"]
|
|
809
|
+
},
|
|
810
|
+
{
|
|
811
|
+
name: "get_review",
|
|
812
|
+
title: "Get a card",
|
|
813
|
+
description: "One card with its checklist, tags, assignees, links and `streams`, plus the latest `checkpoint` another agent left on it (or null) and `dispatch` — the card's run plan, `{ waves, briefs }`, or null when it has no streams. With a dispatch you are the lead: run it wave by wave, handing each stream's sub-agent its brief verbatim. `item.stale` is `{ since, lastAgent }` when the card sits in progress with no agent activity for over 2 hours (or null): resume it from its checkpoint. `card` takes either the card's id or its task id (e.g. BE-07).",
|
|
814
|
+
readOnly: true,
|
|
815
|
+
properties: {
|
|
816
|
+
board_id: BOARD_ID,
|
|
817
|
+
card: CARD
|
|
818
|
+
},
|
|
819
|
+
required: ["board_id", "card"]
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
name: "create_review",
|
|
823
|
+
title: "Create a card",
|
|
824
|
+
description: "Open a new card on a board. Setting `category` also mints the card's permanent task id (BE-07 and so on), so pass it unless you mean to leave the card unfiled. Split a card into `streams` only when it touches two or more independent write areas (e.g. db + mcp + desktop); a 1–2 file card has none. Shared files (types, schema, contracts) go in a W0 stream the others depend on. At most 4 streams can run in one wave, no two streams that run together may own the same path, and every stream needs at least one verify item tagged with its key (`checklist[].stream`). Untagged verify items are the lead's: gate, build, e2e. Isolation defaults to worktree.",
|
|
825
|
+
readOnly: false,
|
|
826
|
+
properties: {
|
|
827
|
+
board_id: BOARD_ID,
|
|
828
|
+
title: { type: "string" },
|
|
829
|
+
body: { type: "string", description: "Markdown body of the card" },
|
|
830
|
+
type: { type: "string", enum: ["epic", "issue", "task"] },
|
|
831
|
+
column: {
|
|
832
|
+
type: "string",
|
|
833
|
+
description: "Lane key; defaults to the board's start lane"
|
|
834
|
+
},
|
|
835
|
+
category: {
|
|
836
|
+
type: "string",
|
|
837
|
+
description: "Category key — this is what mints the task id"
|
|
838
|
+
},
|
|
839
|
+
priority: PRIORITY,
|
|
840
|
+
tags: {
|
|
841
|
+
type: "string[]",
|
|
842
|
+
description: "Reuse the board's existing tags"
|
|
843
|
+
},
|
|
844
|
+
assignees: ASSIGNEES,
|
|
845
|
+
checklist: {
|
|
846
|
+
type: "object[]",
|
|
847
|
+
properties: {
|
|
848
|
+
section: { type: "string", enum: ["decisions", "verify"] },
|
|
849
|
+
text: { type: "string" },
|
|
850
|
+
key: {
|
|
851
|
+
type: "string",
|
|
852
|
+
description: "Stable id like D1 — minted for you if omitted"
|
|
853
|
+
},
|
|
854
|
+
checked: { type: "boolean" },
|
|
855
|
+
group: {
|
|
856
|
+
type: "string",
|
|
857
|
+
description: "Same value on 2+ items makes them a 'pick ONE' group"
|
|
858
|
+
},
|
|
859
|
+
note: { type: "string" },
|
|
860
|
+
stream: {
|
|
861
|
+
type: "string",
|
|
862
|
+
description: "Verify items only: the stream key (W1…) this item proves. Each stream needs one"
|
|
863
|
+
}
|
|
864
|
+
},
|
|
865
|
+
required: ["section", "text"]
|
|
866
|
+
},
|
|
867
|
+
streams: streams("Sub-agent jobs a lead runs in waves (BE-19). Omit for a card one agent works end to end"),
|
|
868
|
+
parent_id: { type: "string" }
|
|
869
|
+
},
|
|
870
|
+
required: ["board_id", "title"]
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
name: "update_review",
|
|
874
|
+
title: "Update a card",
|
|
875
|
+
description: "Patch a card's title, body, priority, tags, assignees, category or streams. Omitted fields are left alone; `tags`, `assignees` and `streams` replace what is there (`streams: []` clears the plan). Streams are checked against the card's checklist: each one needs a verify item tagged with its key — tag them in the same call with `checklist_streams`, or one at a time with toggle_item's `stream`. Use set_status to move a card between lanes. Split a card into `streams` only when it touches two or more independent write areas (e.g. db + mcp + desktop); a 1–2 file card has none. Shared files (types, schema, contracts) go in a W0 stream the others depend on. At most 4 streams can run in one wave, no two streams that run together may own the same path, and every stream needs at least one verify item tagged with its key (`checklist[].stream`). Untagged verify items are the lead's: gate, build, e2e. Isolation defaults to worktree.",
|
|
876
|
+
readOnly: false,
|
|
877
|
+
properties: {
|
|
878
|
+
board_id: BOARD_ID,
|
|
879
|
+
card: CARD,
|
|
880
|
+
title: { type: "string" },
|
|
881
|
+
body: { type: "string" },
|
|
882
|
+
priority: PRIORITY,
|
|
883
|
+
tags: { type: "string[]", description: "Replaces the tag list" },
|
|
884
|
+
category: {
|
|
885
|
+
type: "string",
|
|
886
|
+
description: "Setting this on a card with no task id yet mints one"
|
|
887
|
+
},
|
|
888
|
+
assignees: ASSIGNEES,
|
|
889
|
+
streams: streams("Replaces the whole stream list; pass expected_revision so a concurrent edit is not lost"),
|
|
890
|
+
checklist_streams: {
|
|
891
|
+
type: "string-map",
|
|
892
|
+
description: 'Tag verify items with the stream they prove, applied with `streams` in one write: { V3: "W1", V4: null }'
|
|
893
|
+
},
|
|
894
|
+
expected_revision: {
|
|
895
|
+
type: "integer",
|
|
896
|
+
description: "Refuse the write unless the card is still at this revision — pass what get_review returned to avoid overwriting a concurrent edit."
|
|
897
|
+
}
|
|
898
|
+
},
|
|
899
|
+
required: ["board_id", "card"]
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
name: "set_status",
|
|
903
|
+
title: "Set a card's lane",
|
|
904
|
+
description: "Move a card to another lane — the board's status columns. Use list_boards then list_reviews to see the lane keys this board has. Finished, verified work goes to the review lane, not done. Review and done refuse a card while a verify item you ticked lacks passing `evidence` (toggle_item). Moving into review may return `retro` signals: propose lessons and ask the user before writing any.",
|
|
905
|
+
readOnly: false,
|
|
906
|
+
properties: {
|
|
907
|
+
board_id: BOARD_ID,
|
|
908
|
+
card: CARD,
|
|
909
|
+
status: {
|
|
910
|
+
type: "string",
|
|
911
|
+
description: "Lane key, e.g. todo | processing | review | done"
|
|
912
|
+
},
|
|
913
|
+
reason: {
|
|
914
|
+
type: "string",
|
|
915
|
+
maxLength: 2000,
|
|
916
|
+
description: "What to change — required when sending a card back from review to an in-progress lane, ignored on any other move."
|
|
917
|
+
}
|
|
918
|
+
},
|
|
919
|
+
required: ["board_id", "card", "status"]
|
|
920
|
+
},
|
|
921
|
+
{
|
|
922
|
+
name: "toggle_item",
|
|
923
|
+
title: "Toggle a checklist item",
|
|
924
|
+
description: "Tick or untick one checklist box on a card, and optionally leave a note under it, or tag a verify item with the stream it proves (BE-19). `key` is the item's stable id, e.g. D1 or V3. Ticking a verify item, send `evidence`. Answers with that box and the card in one line, not the whole card: get_review has the rest.",
|
|
925
|
+
readOnly: false,
|
|
926
|
+
properties: {
|
|
927
|
+
board_id: BOARD_ID,
|
|
928
|
+
card: CARD,
|
|
929
|
+
key: { type: "string", description: "Checklist item key, e.g. D1 or V3" },
|
|
930
|
+
checked: { type: "boolean", description: "Omit to leave the tick alone" },
|
|
931
|
+
note: {
|
|
932
|
+
type: "string",
|
|
933
|
+
description: "A note recorded under the item; empty string clears it"
|
|
934
|
+
},
|
|
935
|
+
text: {
|
|
936
|
+
type: "string",
|
|
937
|
+
description: "Reword the item, keeping its key and tick"
|
|
938
|
+
},
|
|
939
|
+
stream: {
|
|
940
|
+
type: "nullable-string",
|
|
941
|
+
description: "Verify items only: the stream key (W1…) this item proves; null removes the tag"
|
|
942
|
+
},
|
|
943
|
+
evidence: {
|
|
944
|
+
type: "object",
|
|
945
|
+
description: "Verify items: what you ran to prove it — required before the card can move to review or done.",
|
|
946
|
+
properties: {
|
|
947
|
+
command: { type: "string", maxLength: 1000 },
|
|
948
|
+
ok: { type: "boolean" },
|
|
949
|
+
url: {
|
|
950
|
+
type: "string",
|
|
951
|
+
maxLength: 2000,
|
|
952
|
+
pattern: "^https?:\\/\\/\\S+$"
|
|
953
|
+
}
|
|
954
|
+
},
|
|
955
|
+
required: ["command", "ok"]
|
|
956
|
+
}
|
|
957
|
+
},
|
|
958
|
+
required: ["board_id", "card", "key"]
|
|
959
|
+
},
|
|
960
|
+
{
|
|
961
|
+
name: "review_card",
|
|
962
|
+
title: "Record the user's review of a card",
|
|
963
|
+
description: "Write the user's review of a card's checklist in one call: every box they answered, with the tick it should end with. ONLY with picks the user just made (in the option picker, or said plainly in chat) — never tick a decision on your own judgement. Ticking one option of a pick-ONE group unticks the others; boxes not named are left as they are. Free text the user typed (\"Other\") goes in `note`. Returns `ready: true` once every decision is settled; it does not move the card.",
|
|
964
|
+
readOnly: false,
|
|
965
|
+
properties: {
|
|
966
|
+
board_id: BOARD_ID,
|
|
967
|
+
card: CARD,
|
|
968
|
+
picks: {
|
|
969
|
+
type: "object[]",
|
|
970
|
+
description: "Every box the user answered in this pass",
|
|
971
|
+
minItems: 1,
|
|
972
|
+
properties: {
|
|
973
|
+
key: { type: "string", description: "Checklist item key, e.g. D1" },
|
|
974
|
+
checked: { type: "boolean" },
|
|
975
|
+
note: {
|
|
976
|
+
type: "string",
|
|
977
|
+
description: "The user's own words; empty string clears the note"
|
|
978
|
+
}
|
|
979
|
+
},
|
|
980
|
+
required: ["key", "checked"]
|
|
981
|
+
},
|
|
982
|
+
revision: {
|
|
983
|
+
type: "integer",
|
|
984
|
+
description: "The card's `revision` from get_review; refused if it changed since"
|
|
985
|
+
}
|
|
986
|
+
},
|
|
987
|
+
required: ["board_id", "card", "picks"]
|
|
988
|
+
},
|
|
989
|
+
{
|
|
990
|
+
name: "checkpoint",
|
|
991
|
+
title: "Record a checkpoint",
|
|
992
|
+
description: "Record where you stopped on a card so another agent can resume it. Call after each checklist item you finish, and before you stop mid-task. `get_review` returns the latest checkpoint. Summarise — never paste transcripts, secrets, tokens or .env values. Refused on a finished or archived card.",
|
|
993
|
+
readOnly: false,
|
|
994
|
+
properties: {
|
|
995
|
+
board_id: BOARD_ID,
|
|
996
|
+
card: CARD,
|
|
997
|
+
summary: {
|
|
998
|
+
type: "string",
|
|
999
|
+
description: "What is done, what is verified (and how), what is not yet done"
|
|
1000
|
+
},
|
|
1001
|
+
next_step: {
|
|
1002
|
+
type: "string",
|
|
1003
|
+
description: "The first thing the next agent should do"
|
|
1004
|
+
},
|
|
1005
|
+
request: {
|
|
1006
|
+
type: "string",
|
|
1007
|
+
description: "What the user last asked for, in their words"
|
|
1008
|
+
},
|
|
1009
|
+
files: {
|
|
1010
|
+
type: "string[]",
|
|
1011
|
+
description: "Repo-relative paths you changed"
|
|
1012
|
+
},
|
|
1013
|
+
commands: {
|
|
1014
|
+
type: "object[]",
|
|
1015
|
+
description: "Verification commands you ran and whether they passed",
|
|
1016
|
+
properties: {
|
|
1017
|
+
command: { type: "string" },
|
|
1018
|
+
ok: { type: "boolean" }
|
|
1019
|
+
},
|
|
1020
|
+
required: ["command"]
|
|
1021
|
+
},
|
|
1022
|
+
git: {
|
|
1023
|
+
type: "object",
|
|
1024
|
+
description: "Where the code is: branch, HEAD sha, and a pushed ref holding uncommitted work, if any",
|
|
1025
|
+
properties: {
|
|
1026
|
+
branch: { type: "string" },
|
|
1027
|
+
head: { type: "string" },
|
|
1028
|
+
wip_ref: { type: "string" },
|
|
1029
|
+
wip_sha: { type: "string" }
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
},
|
|
1033
|
+
required: ["board_id", "card", "summary"]
|
|
1034
|
+
},
|
|
1035
|
+
{
|
|
1036
|
+
name: "delete_review",
|
|
1037
|
+
title: "Archive a card",
|
|
1038
|
+
description: "Take a card off the board. This ARCHIVES it — the card and its history stay in the database and can be restored. Nothing here deletes rows.",
|
|
1039
|
+
readOnly: false,
|
|
1040
|
+
properties: {
|
|
1041
|
+
board_id: BOARD_ID,
|
|
1042
|
+
card: CARD
|
|
1043
|
+
},
|
|
1044
|
+
required: ["board_id", "card"]
|
|
1045
|
+
}
|
|
1046
|
+
];
|
|
1047
|
+
|
|
1048
|
+
// src/tools/kit.ts
|
|
1049
|
+
var KIT_TOOL_LIMITS = {
|
|
1050
|
+
find_files: { default: 50, max: 200 },
|
|
1051
|
+
search_text: { default: 50, max: 200 },
|
|
1052
|
+
search_structural: { default: 50, max: 200 },
|
|
1053
|
+
list_files: { default: 1000, max: 50000 },
|
|
1054
|
+
search_sessions: { default: 20, max: 50 }
|
|
1055
|
+
};
|
|
1056
|
+
var STRUCTURAL_LANGS = [
|
|
1057
|
+
"ts",
|
|
1058
|
+
"tsx",
|
|
1059
|
+
"js",
|
|
1060
|
+
"jsx",
|
|
1061
|
+
"json",
|
|
1062
|
+
"css",
|
|
1063
|
+
"html",
|
|
1064
|
+
"python",
|
|
1065
|
+
"rust",
|
|
1066
|
+
"go"
|
|
1067
|
+
];
|
|
1068
|
+
var FOLDER = {
|
|
1069
|
+
type: "string",
|
|
1070
|
+
description: "The folder to search, an absolute path (e.g. the repo's root); the working directory when omitted"
|
|
1071
|
+
};
|
|
1072
|
+
function limit(tool, what) {
|
|
1073
|
+
const { default: fallback, max } = KIT_TOOL_LIMITS[tool];
|
|
1074
|
+
return {
|
|
1075
|
+
type: "integer",
|
|
1076
|
+
minimum: 1,
|
|
1077
|
+
maximum: max,
|
|
1078
|
+
description: `${what} returned; default ${fallback}`
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
var KIT_TOOLS = [
|
|
1082
|
+
{
|
|
1083
|
+
name: "find_files",
|
|
1084
|
+
description: "Fuzzy-find files by path in a folder, best match first. Respects .gitignore. Returns each file's path, score and the matched character ranges.",
|
|
1085
|
+
readOnly: true,
|
|
1086
|
+
properties: {
|
|
1087
|
+
query: {
|
|
1088
|
+
type: "string",
|
|
1089
|
+
description: "Part of a file name or path, e.g. `mcp tools`"
|
|
1090
|
+
},
|
|
1091
|
+
folder: FOLDER,
|
|
1092
|
+
limit: limit("find_files", "Files")
|
|
1093
|
+
},
|
|
1094
|
+
required: ["query"]
|
|
1095
|
+
},
|
|
1096
|
+
{
|
|
1097
|
+
name: "search_text",
|
|
1098
|
+
description: "Search the contents of a folder's files with ripgrep. Respects .gitignore; skips hidden and binary files. Returns each matching file with its matching lines (1-based) and match ranges; `truncated` marks where the search stopped.",
|
|
1099
|
+
readOnly: true,
|
|
1100
|
+
properties: {
|
|
1101
|
+
query: {
|
|
1102
|
+
type: "string",
|
|
1103
|
+
description: "A literal string, or a regex when `regex` is true"
|
|
1104
|
+
},
|
|
1105
|
+
folder: FOLDER,
|
|
1106
|
+
regex: {
|
|
1107
|
+
type: "boolean",
|
|
1108
|
+
description: "Read `query` as a regex (ripgrep's syntax)"
|
|
1109
|
+
},
|
|
1110
|
+
case_sensitive: {
|
|
1111
|
+
type: "boolean",
|
|
1112
|
+
description: "Match case; ignored when omitted"
|
|
1113
|
+
},
|
|
1114
|
+
globs: {
|
|
1115
|
+
type: "string[]",
|
|
1116
|
+
description: "ripgrep globs limiting the files; a leading `!` excludes"
|
|
1117
|
+
},
|
|
1118
|
+
limit: limit("search_text", "Files")
|
|
1119
|
+
},
|
|
1120
|
+
required: ["query"]
|
|
1121
|
+
},
|
|
1122
|
+
{
|
|
1123
|
+
name: "search_structural",
|
|
1124
|
+
description: "Search a folder's code by syntax with an ast-grep pattern, e.g. `console.log($A)`. Respects .gitignore. Returns each matching file with its matching lines and match ranges, as search_text does.",
|
|
1125
|
+
readOnly: true,
|
|
1126
|
+
properties: {
|
|
1127
|
+
pattern: {
|
|
1128
|
+
type: "string",
|
|
1129
|
+
description: "An ast-grep pattern; `$A` matches one node"
|
|
1130
|
+
},
|
|
1131
|
+
folder: FOLDER,
|
|
1132
|
+
lang: {
|
|
1133
|
+
type: "string",
|
|
1134
|
+
enum: STRUCTURAL_LANGS,
|
|
1135
|
+
description: "The pattern's language; each file's own, from its extension, when omitted"
|
|
1136
|
+
},
|
|
1137
|
+
limit: limit("search_structural", "Files")
|
|
1138
|
+
},
|
|
1139
|
+
required: ["pattern"]
|
|
1140
|
+
},
|
|
1141
|
+
{
|
|
1142
|
+
name: "list_files",
|
|
1143
|
+
description: "Every file in a folder that ripgrep would search: .gitignore respected, hidden files skipped. Paths in no particular order; `truncated` when cut at the limit.",
|
|
1144
|
+
readOnly: true,
|
|
1145
|
+
properties: {
|
|
1146
|
+
folder: FOLDER,
|
|
1147
|
+
limit: limit("list_files", "Paths")
|
|
1148
|
+
}
|
|
1149
|
+
},
|
|
1150
|
+
{
|
|
1151
|
+
name: "search_sessions",
|
|
1152
|
+
description: "Search this machine's Claude Code, Codex and OpenCode conversations for a phrase in what was said (prompts, answers, tool calls and output), newest first. Returns each session's harness, id, title, last write and up to 3 matching snippets.",
|
|
1153
|
+
readOnly: true,
|
|
1154
|
+
properties: {
|
|
1155
|
+
query: { type: "string", description: "A literal phrase, not a regex" },
|
|
1156
|
+
limit: limit("search_sessions", "Sessions"),
|
|
1157
|
+
folder: {
|
|
1158
|
+
type: "string",
|
|
1159
|
+
description: "Only sessions run in this folder (an absolute path, e.g. the repo's root); every folder's when omitted"
|
|
1160
|
+
}
|
|
1161
|
+
},
|
|
1162
|
+
required: ["query"]
|
|
1163
|
+
}
|
|
1164
|
+
];
|
|
1165
|
+
// src/tools/instructions.ts
|
|
1166
|
+
var INTRO = "lanework is a Kanban board for AI-driven development. A card is a " + "review checklist: decisions to approve, then verify steps to prove. ";
|
|
1167
|
+
var FIND_BOARD = "Every tool needs a board_id and there is no default. A conversation " + "the Lanework app started is told its board_id when it starts: use that " + "one. Otherwise run `git remote get-url origin` and call " + "list_boards({ repo }) with the output as is. Exactly one board: use it. ";
|
|
1168
|
+
var NO_BOARD = "None: list_boards without repo and ask which board this repo belongs to, " + "offering also a new one (suggest `owner/name` from the remote); then " + "link_repo their pick, or create_board only if they asked. Linking a board " + "that has another repo MOVES the link. Several, or no remote: ask. Never " + "pick a board by its name. ";
|
|
1169
|
+
var NEW_CARD = "Before create_review, read board_summary and reuse its categories and " + "tags (the category mints the task id; never invent one). Every " + "create_review passes category, 1-3 tags and priority (high: blockers, " + "release prerequisites; medium: planned work; low: polish). Body: context, " + "out of scope, files touched. Checklist: decisions the user approves, " + "verify steps that prove the work; a pick-ONE choice is boxes sharing a " + "`group`, the recommendation marked. ";
|
|
1170
|
+
var REVIEW_GATE = "Behavior-changing work starts only once every decision is ticked; " + "read-only requests, obvious one-file fixes and work whose exact shape the " + "user gave need no card. toggle_item ticks boxes and notes (a verify tick " + "sends evidence: the command and whether it passed), update_review edits " + "metadata, set_status moves lanes. ";
|
|
1171
|
+
var CHECKPOINT_FLOW = "While working a card, call checkpoint after each item you finish and " + "before you stop. To resume: get_review and read its checkpoint; if " + "checkpoint.git.wipRef is set and this is not the checkout it came from " + "(another host, a fresh clone, a sandbox), check out checkpoint.git.head " + "and `git fetch origin <wipRef> && git cherry-pick --no-commit FETCH_HEAD " + "&& git reset`. Re-run every check it claims passed, then continue from " + "nextStep. ";
|
|
1172
|
+
var STALE = "A card with `stale` set was left mid-task: resume it from its checkpoint " + "rather than opening a duplicate. ";
|
|
1173
|
+
var HAND_OFF = "Finished, verified work goes to the review-role lane via set_status; only " + "a human moves it to done. A card sent back carries changesRequested.reason " + "in get_review: read it first. When set_status returns retro, propose at " + "most 3 lessons and ask before writing any. ";
|
|
1174
|
+
var STREAMS_FLOW = "A card with streams comes back from get_review with `dispatch: { waves, " + "briefs }`, and you are its lead. Run it wave by wave: spawn every stream " + "of a wave at once, one sub-agent per stream, each in its own git worktree " + "from the current HEAD (in the shared checkout when its isolation is " + "shared), and hand each one `dispatch.briefs[key]` verbatim. No " + "sub-agents? Run the streams yourself, one by one, in wave order. " + "Sub-agents never call Lanework and never commit. After each wave, merge " + "each worktree into the main checkout, revert anything outside the " + "stream's `owns`, re-run the stream's checks, tick its verify items, and " + "call checkpoint once for the wave. After the last wave, run the untagged " + "verify items. On resume, re-dispatch only the streams whose verify items " + "are not all ticked. A card without streams (dispatch: null) works as " + "before: one agent, end to end.";
|
|
1175
|
+
var WRITE_STREAMS = "Split a card into streams only when it touches two or more independent " + "write areas: each has a key (W0…), goal, role, exact `owns` paths no " + "other stream in its wave owns, and a verify item tagged with its key; " + "shared types go in a W0 the others depend on; at most 4 per wave. ";
|
|
1176
|
+
var REVIEW_FLOW = "To review a card with the user in the CLI: get_review it, then ask the " + "user with your option picker (AskUserQuestion) if you have one. Each " + "pick-ONE group (boxes sharing a `group`) is one single-select question, " + "its options the group's boxes, the one marked (Recommended) first. Gather " + "the ungrouped decisions into multi-select questions of up to 4 boxes " + "each. At most 4 questions per turn — ask again for the rest. A group with " + "more than 4 options cannot fit: say so and send the user to the app for " + "that group. Then call review_card ONCE with exactly what the user picked: " + "a picked box checked: true, an offered but unpicked ungrouped box " + "checked: false, and anything they typed under Other as that box's note. " + "Never tick a decision the user did not pick; only a plain instruction in " + "chat (e.g. 'tick the recommended ones') stands in for the picker. " + "review_card does not move the card, and work starts only once it answers " + "ready: true.";
|
|
1177
|
+
var RUN_STREAMS = "A card with streams comes back from get_review with dispatch { waves, " + "briefs }: you are its lead. Per wave, spawn one sub-agent per stream at " + "once (own worktree unless shared) with its brief verbatim; sub-agents " + "never call Lanework or commit. After the wave, merge, revert anything " + "outside each stream's owns, re-run its checks, tick its verify items, " + "checkpoint once. Then the untagged verify items. ";
|
|
1178
|
+
var REVIEW_SHORT = "To review a card with the user: get_review it and ask with your option " + "picker, one single-select question per pick-ONE group (recommended " + "first) and the other decisions as multi-select, at most 4 questions a " + "turn; then call review_card ONCE with exactly what they picked (unpicked " + "offered boxes false, Other text as the note). Never tick a decision they " + "did not pick. Work starts only once it answers ready: true.";
|
|
1179
|
+
var BOARD_INSTRUCTIONS = INTRO + FIND_BOARD + NO_BOARD + NEW_CARD + REVIEW_GATE + CHECKPOINT_FLOW + STALE + HAND_OFF + WRITE_STREAMS + RUN_STREAMS + REVIEW_SHORT;
|
|
1180
|
+
var BOARD_WORKER_INSTRUCTIONS = INTRO + "This connection serves only the tools for working an existing card; " + "creating, linking or reviewing cards needs the full lanework server. " + FIND_BOARD + "None, several, or no git remote: ask the user. Never pick a board by " + "its name. Do not start a card still in todo with decisions unticked. " + CHECKPOINT_FLOW + HAND_OFF + RUN_STREAMS.trimEnd();
|
|
1181
|
+
// src/tools/outputs.ts
|
|
1182
|
+
var str = { kind: "string" };
|
|
1183
|
+
var num = { kind: "number" };
|
|
1184
|
+
var bool = { kind: "boolean" };
|
|
1185
|
+
var any = { kind: "any" };
|
|
1186
|
+
var nullable = (inner) => ({ kind: "nullable", inner });
|
|
1187
|
+
var optional = (inner) => ({ kind: "optional", inner });
|
|
1188
|
+
var list = (inner) => ({ kind: "list", inner });
|
|
1189
|
+
var record = (inner) => ({ kind: "record", inner });
|
|
1190
|
+
var obj = (fields) => ({
|
|
1191
|
+
kind: "object",
|
|
1192
|
+
fields
|
|
1193
|
+
});
|
|
1194
|
+
var oneOf = (...values) => ({ kind: "enum", values });
|
|
1195
|
+
var PRIORITY2 = nullable(oneOf("low", "medium", "high"));
|
|
1196
|
+
var COLUMN_ROLE = nullable(oneOf("intake", "start", "active", "review", "done", "archive"));
|
|
1197
|
+
var BOARD_SUMMARY = obj({
|
|
1198
|
+
workspaceId: str,
|
|
1199
|
+
name: str,
|
|
1200
|
+
role: str,
|
|
1201
|
+
changeSeq: num,
|
|
1202
|
+
repo: nullable(str)
|
|
1203
|
+
});
|
|
1204
|
+
var CHECKLIST_ITEM = obj({
|
|
1205
|
+
key: str,
|
|
1206
|
+
section: oneOf("decisions", "verify"),
|
|
1207
|
+
text: str,
|
|
1208
|
+
checked: bool,
|
|
1209
|
+
checkedAt: nullable(str),
|
|
1210
|
+
note: nullable(str),
|
|
1211
|
+
group: nullable(str),
|
|
1212
|
+
stream: nullable(str),
|
|
1213
|
+
checkedBy: optional(any),
|
|
1214
|
+
evidence: optional(any)
|
|
1215
|
+
});
|
|
1216
|
+
var STREAM = obj({
|
|
1217
|
+
key: str,
|
|
1218
|
+
title: str,
|
|
1219
|
+
goal: str,
|
|
1220
|
+
role: oneOf("research", "implement", "test"),
|
|
1221
|
+
owns: list(str),
|
|
1222
|
+
reads: list(str),
|
|
1223
|
+
dependsOn: list(str),
|
|
1224
|
+
isolation: oneOf("worktree", "shared"),
|
|
1225
|
+
position: num
|
|
1226
|
+
});
|
|
1227
|
+
var DISPATCH = obj({ waves: list(list(str)), briefs: record(str) });
|
|
1228
|
+
var CARD_FIELDS = {
|
|
1229
|
+
id: str,
|
|
1230
|
+
workspaceId: str,
|
|
1231
|
+
seq: num,
|
|
1232
|
+
revision: num,
|
|
1233
|
+
type: oneOf("epic", "issue", "task"),
|
|
1234
|
+
parentId: nullable(str),
|
|
1235
|
+
columnKey: str,
|
|
1236
|
+
rank: str,
|
|
1237
|
+
title: str,
|
|
1238
|
+
body: str,
|
|
1239
|
+
priority: PRIORITY2,
|
|
1240
|
+
estimate: nullable(num),
|
|
1241
|
+
categoryKey: nullable(str),
|
|
1242
|
+
taskId: nullable(str),
|
|
1243
|
+
tags: list(str),
|
|
1244
|
+
checklistProgress: obj({ done: num, total: num }),
|
|
1245
|
+
streams: list(STREAM),
|
|
1246
|
+
metadata: nullable(any),
|
|
1247
|
+
source: nullable(any),
|
|
1248
|
+
createdAt: nullable(str),
|
|
1249
|
+
updatedAt: nullable(str),
|
|
1250
|
+
startedAt: nullable(str),
|
|
1251
|
+
completedAt: nullable(str),
|
|
1252
|
+
dueAt: nullable(str),
|
|
1253
|
+
archivedAt: nullable(str),
|
|
1254
|
+
stale: optional(nullable(any)),
|
|
1255
|
+
changesRequested: optional(nullable(any))
|
|
1256
|
+
};
|
|
1257
|
+
var CARD2 = obj(CARD_FIELDS);
|
|
1258
|
+
var DETAIL_FIELDS = {
|
|
1259
|
+
...CARD_FIELDS,
|
|
1260
|
+
checklist: list(CHECKLIST_ITEM),
|
|
1261
|
+
assignees: obj({ users: list(str), agents: list(str) }),
|
|
1262
|
+
links: list(any),
|
|
1263
|
+
attachments: list(any),
|
|
1264
|
+
subscribers: list(str),
|
|
1265
|
+
subscribed: bool,
|
|
1266
|
+
favorite: bool,
|
|
1267
|
+
commentCount: num
|
|
1268
|
+
};
|
|
1269
|
+
var CARD_DETAIL = obj({ ...DETAIL_FIELDS, dispatch: nullable(DISPATCH) });
|
|
1270
|
+
var CARD_DETAIL_NO_DISPATCH = obj(DETAIL_FIELDS);
|
|
1271
|
+
var CHECKPOINT_FIELDS = {
|
|
1272
|
+
id: str,
|
|
1273
|
+
agent: str,
|
|
1274
|
+
userId: str,
|
|
1275
|
+
machineId: nullable(str),
|
|
1276
|
+
createdAt: str,
|
|
1277
|
+
request: nullable(str),
|
|
1278
|
+
summary: str,
|
|
1279
|
+
nextStep: nullable(str),
|
|
1280
|
+
files: list(str),
|
|
1281
|
+
commands: list(obj({ command: str, ok: nullable(bool) })),
|
|
1282
|
+
host: nullable(str),
|
|
1283
|
+
session: nullable(str),
|
|
1284
|
+
git: nullable(obj({
|
|
1285
|
+
branch: nullable(str),
|
|
1286
|
+
head: nullable(str),
|
|
1287
|
+
wipRef: nullable(str),
|
|
1288
|
+
wipSha: nullable(str),
|
|
1289
|
+
diffStat: nullable(str)
|
|
1290
|
+
}))
|
|
1291
|
+
};
|
|
1292
|
+
var CARD_REF_FIELDS = {
|
|
1293
|
+
id: str,
|
|
1294
|
+
taskId: nullable(str),
|
|
1295
|
+
title: str
|
|
1296
|
+
};
|
|
1297
|
+
var BOARD_TOOL_OUTPUT_SHAPES = {
|
|
1298
|
+
list_boards: obj({
|
|
1299
|
+
repo: optional(str),
|
|
1300
|
+
boards: list(BOARD_SUMMARY),
|
|
1301
|
+
next: optional(str)
|
|
1302
|
+
}),
|
|
1303
|
+
create_board: obj({ board_id: str, name: str, slug: str, repo: str }),
|
|
1304
|
+
link_repo: obj({
|
|
1305
|
+
repo: str,
|
|
1306
|
+
previous: nullable(str),
|
|
1307
|
+
boards: list(BOARD_SUMMARY)
|
|
1308
|
+
}),
|
|
1309
|
+
board_summary: obj({
|
|
1310
|
+
workspaceId: str,
|
|
1311
|
+
role: str,
|
|
1312
|
+
head: num,
|
|
1313
|
+
lanes: list(obj({ key: str, label: str, role: COLUMN_ROLE, count: num })),
|
|
1314
|
+
stale: num,
|
|
1315
|
+
categories: list(obj({ key: str, name: str })),
|
|
1316
|
+
tags: obj({ max: num, allowed: list(str) }),
|
|
1317
|
+
labels: list(obj({ tag: str, name: str, tone: str }))
|
|
1318
|
+
}),
|
|
1319
|
+
list_reviews: obj({
|
|
1320
|
+
items: list(CARD2),
|
|
1321
|
+
head: num,
|
|
1322
|
+
columns: list(obj({ key: str, name: str, role: COLUMN_ROLE }))
|
|
1323
|
+
}),
|
|
1324
|
+
get_review: obj({
|
|
1325
|
+
item: CARD_DETAIL_NO_DISPATCH,
|
|
1326
|
+
checkpoint: nullable(obj({
|
|
1327
|
+
...CHECKPOINT_FIELDS,
|
|
1328
|
+
nextStepFrom: nullable(obj({ id: str, agent: str, createdAt: str }))
|
|
1329
|
+
})),
|
|
1330
|
+
dispatch: nullable(DISPATCH)
|
|
1331
|
+
}),
|
|
1332
|
+
create_review: obj({ item: CARD_DETAIL }),
|
|
1333
|
+
update_review: obj({ item: CARD_DETAIL }),
|
|
1334
|
+
toggle_item: obj({
|
|
1335
|
+
checklistItem: CHECKLIST_ITEM,
|
|
1336
|
+
card: obj({
|
|
1337
|
+
...CARD_REF_FIELDS,
|
|
1338
|
+
columnKey: str,
|
|
1339
|
+
revision: num,
|
|
1340
|
+
done: num,
|
|
1341
|
+
total: num
|
|
1342
|
+
}),
|
|
1343
|
+
ready: bool,
|
|
1344
|
+
open: optional(list(str))
|
|
1345
|
+
}),
|
|
1346
|
+
review_card: obj({
|
|
1347
|
+
ready: bool,
|
|
1348
|
+
next: optional(str),
|
|
1349
|
+
open: optional(list(str)),
|
|
1350
|
+
item: CARD_DETAIL
|
|
1351
|
+
}),
|
|
1352
|
+
set_status: obj({
|
|
1353
|
+
item: CARD_DETAIL,
|
|
1354
|
+
retro: optional(obj({ signals: list(any), ask: str }))
|
|
1355
|
+
}),
|
|
1356
|
+
delete_review: obj({ archived: str, seq: nullable(num) }),
|
|
1357
|
+
checkpoint: obj({ checkpoint: obj(CHECKPOINT_FIELDS) }),
|
|
1358
|
+
lifecycle_status: obj({
|
|
1359
|
+
waiting: list(obj({ ...CARD_REF_FIELDS, done: num, total: num })),
|
|
1360
|
+
ready: list(obj(CARD_REF_FIELDS)),
|
|
1361
|
+
inFlight: list(obj({ ...CARD_REF_FIELDS, columnKey: str })),
|
|
1362
|
+
review: list(obj({ ...CARD_REF_FIELDS, columnKey: str }))
|
|
1363
|
+
})
|
|
1364
|
+
};
|
|
1365
|
+
function boardToolOutputProblems(name, value) {
|
|
1366
|
+
const out = [];
|
|
1367
|
+
const check = (shape, v, path) => {
|
|
1368
|
+
switch (shape.kind) {
|
|
1369
|
+
case "any":
|
|
1370
|
+
return;
|
|
1371
|
+
case "optional":
|
|
1372
|
+
if (v !== undefined)
|
|
1373
|
+
check(shape.inner, v, path);
|
|
1374
|
+
return;
|
|
1375
|
+
case "nullable":
|
|
1376
|
+
if (v !== null)
|
|
1377
|
+
check(shape.inner, v, path);
|
|
1378
|
+
return;
|
|
1379
|
+
case "string":
|
|
1380
|
+
case "number":
|
|
1381
|
+
case "boolean":
|
|
1382
|
+
if (typeof v !== shape.kind)
|
|
1383
|
+
out.push(`${path}: expected ${shape.kind}, got ${JSON.stringify(v)}`);
|
|
1384
|
+
return;
|
|
1385
|
+
case "enum":
|
|
1386
|
+
if (!shape.values.includes(v))
|
|
1387
|
+
out.push(`${path}: ${JSON.stringify(v)} is not one of ${shape.values.join(", ")}`);
|
|
1388
|
+
return;
|
|
1389
|
+
case "list":
|
|
1390
|
+
if (!Array.isArray(v))
|
|
1391
|
+
out.push(`${path}: expected a list`);
|
|
1392
|
+
else
|
|
1393
|
+
for (const [i, entry] of v.entries())
|
|
1394
|
+
check(shape.inner, entry, `${path}[${i}]`);
|
|
1395
|
+
return;
|
|
1396
|
+
case "record":
|
|
1397
|
+
if (typeof v !== "object" || v === null || Array.isArray(v))
|
|
1398
|
+
out.push(`${path}: expected an object`);
|
|
1399
|
+
else
|
|
1400
|
+
for (const [k, entry] of Object.entries(v))
|
|
1401
|
+
check(shape.inner, entry, `${path}.${k}`);
|
|
1402
|
+
return;
|
|
1403
|
+
case "object": {
|
|
1404
|
+
if (typeof v !== "object" || v === null || Array.isArray(v)) {
|
|
1405
|
+
out.push(`${path}: expected an object`);
|
|
1406
|
+
return;
|
|
1407
|
+
}
|
|
1408
|
+
const fields = v;
|
|
1409
|
+
for (const [k, field] of Object.entries(shape.fields)) {
|
|
1410
|
+
if (!(k in fields) && field.kind !== "optional")
|
|
1411
|
+
out.push(`${path}.${k}: missing`);
|
|
1412
|
+
else
|
|
1413
|
+
check(field, fields[k], `${path}.${k}`);
|
|
1414
|
+
}
|
|
1415
|
+
for (const k of Object.keys(fields))
|
|
1416
|
+
if (!(k in shape.fields))
|
|
1417
|
+
out.push(`${path}.${k}: not in the contract`);
|
|
1418
|
+
return;
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
};
|
|
1422
|
+
check(BOARD_TOOL_OUTPUT_SHAPES[name], value, name);
|
|
1423
|
+
return out;
|
|
1424
|
+
}
|
|
1425
|
+
// src/tools/schema.ts
|
|
1426
|
+
function paramSchema(param) {
|
|
1427
|
+
const described = (schema) => param.description ? { ...schema, description: param.description } : schema;
|
|
1428
|
+
switch (param.type) {
|
|
1429
|
+
case "string":
|
|
1430
|
+
return described({
|
|
1431
|
+
type: "string",
|
|
1432
|
+
...param.enum ? { enum: [...param.enum] } : {},
|
|
1433
|
+
...param.maxLength !== undefined ? { maxLength: param.maxLength } : {},
|
|
1434
|
+
...param.pattern !== undefined ? { pattern: param.pattern } : {}
|
|
1435
|
+
});
|
|
1436
|
+
case "boolean":
|
|
1437
|
+
return described({ type: "boolean" });
|
|
1438
|
+
case "integer":
|
|
1439
|
+
return described({
|
|
1440
|
+
type: "integer",
|
|
1441
|
+
...param.minimum !== undefined ? { minimum: param.minimum } : {},
|
|
1442
|
+
...param.maximum !== undefined ? { maximum: param.maximum } : {}
|
|
1443
|
+
});
|
|
1444
|
+
case "string[]":
|
|
1445
|
+
return described({ type: "array", items: { type: "string" } });
|
|
1446
|
+
case "nullable-string":
|
|
1447
|
+
return described({ type: ["string", "null"] });
|
|
1448
|
+
case "string-map":
|
|
1449
|
+
return described({
|
|
1450
|
+
type: "object",
|
|
1451
|
+
additionalProperties: { type: ["string", "null"] }
|
|
1452
|
+
});
|
|
1453
|
+
case "object":
|
|
1454
|
+
return described(toolInputSchema(param));
|
|
1455
|
+
case "object[]":
|
|
1456
|
+
return described({
|
|
1457
|
+
type: "array",
|
|
1458
|
+
items: toolInputSchema(param),
|
|
1459
|
+
...param.minItems ? { minItems: param.minItems } : {}
|
|
1460
|
+
});
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
function toolInputSchema(shape) {
|
|
1464
|
+
const properties = {};
|
|
1465
|
+
for (const [name, param] of Object.entries(shape.properties))
|
|
1466
|
+
properties[name] = paramSchema(param);
|
|
1467
|
+
return {
|
|
1468
|
+
type: "object",
|
|
1469
|
+
properties,
|
|
1470
|
+
...shape.required?.length ? { required: [...shape.required] } : {},
|
|
1471
|
+
additionalProperties: false
|
|
1472
|
+
};
|
|
1473
|
+
}
|
|
1474
|
+
function toolListEntry(tool) {
|
|
1475
|
+
return {
|
|
1476
|
+
name: tool.name,
|
|
1477
|
+
...tool.title ? { title: tool.title } : {},
|
|
1478
|
+
description: tool.description,
|
|
1479
|
+
inputSchema: toolInputSchema(tool),
|
|
1480
|
+
annotations: {
|
|
1481
|
+
readOnlyHint: tool.readOnly,
|
|
1482
|
+
destructiveHint: tool.name === "delete_review",
|
|
1483
|
+
openWorldHint: false
|
|
1484
|
+
}
|
|
1485
|
+
};
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
// src/tools/index.ts
|
|
1489
|
+
function toolContract(name) {
|
|
1490
|
+
return BOARD_TOOLS.find((tool) => tool.name === name) ?? KIT_TOOLS.find((tool) => tool.name === name);
|
|
1491
|
+
}
|
|
1492
|
+
export {
|
|
1493
|
+
AGENT_HEADER,
|
|
1494
|
+
AGENT_NOTES,
|
|
1495
|
+
AGENT_NOTES_PREVIOUS,
|
|
1496
|
+
BOARD_INSTRUCTIONS,
|
|
1497
|
+
BOARD_TOOLS,
|
|
1498
|
+
BOARD_TOOL_OUTPUT_SHAPES,
|
|
1499
|
+
BOARD_WORKER_INSTRUCTIONS,
|
|
1500
|
+
CHECKLIST_SECTIONS,
|
|
1501
|
+
CHECKPOINTS_KEPT,
|
|
1502
|
+
CHECKPOINT_MAX_BYTES,
|
|
1503
|
+
COLUMN_ROLES,
|
|
1504
|
+
CONTROL_TOOLS,
|
|
1505
|
+
CONTROL_TOOL_LIMITS,
|
|
1506
|
+
DEFAULT_API_ORIGIN,
|
|
1507
|
+
DEFAULT_LIMIT,
|
|
1508
|
+
ICON_KEY_HEADER,
|
|
1509
|
+
KIT_TOOLS,
|
|
1510
|
+
KIT_TOOL_LIMITS,
|
|
1511
|
+
LINK_TYPES,
|
|
1512
|
+
LOOPBACK_CALLBACK_PATH,
|
|
1513
|
+
MACHINE_SECRET_PATTERN,
|
|
1514
|
+
MAX_CHANGES_REASON,
|
|
1515
|
+
MAX_LIMIT,
|
|
1516
|
+
MCP_HOST,
|
|
1517
|
+
MCP_URL,
|
|
1518
|
+
MCP_WORKER_URL,
|
|
1519
|
+
PRIORITIES,
|
|
1520
|
+
PROJECT_AVATAR_COLORS,
|
|
1521
|
+
PROJECT_AVATAR_ICONS,
|
|
1522
|
+
REVIEW_FLOW,
|
|
1523
|
+
STREAMS_FLOW,
|
|
1524
|
+
STREAM_ISOLATIONS,
|
|
1525
|
+
STREAM_ROLES,
|
|
1526
|
+
STRUCTURAL_LANGS,
|
|
1527
|
+
TOKEN_PREFIXES,
|
|
1528
|
+
WORK_ITEM_TYPES,
|
|
1529
|
+
boardToolOutputProblems,
|
|
1530
|
+
controlTool,
|
|
1531
|
+
controlToolsFor,
|
|
1532
|
+
isMachineSecret,
|
|
1533
|
+
parseProjectAvatar,
|
|
1534
|
+
paths,
|
|
1535
|
+
seg,
|
|
1536
|
+
stripUserinfo,
|
|
1537
|
+
toolContract,
|
|
1538
|
+
toolInputSchema,
|
|
1539
|
+
toolListEntry
|
|
1540
|
+
};
|