brainfile 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -24
- package/dist/__tests__/helpers/mcp-wire.d.ts +45 -0
- package/dist/__tests__/helpers/mcp-wire.d.ts.map +1 -0
- package/dist/__tests__/helpers/mcp-wire.js +133 -0
- package/dist/__tests__/helpers/mcp-wire.js.map +1 -0
- package/dist/{chunk-YTFLC673.mjs → chunk-FOLBAGJS.mjs} +2483 -1075
- package/dist/cli.mjs +2526 -1656
- package/dist/commands/adr.d.ts +1 -9
- package/dist/commands/adr.d.ts.map +1 -1
- package/dist/commands/adr.js +11 -88
- package/dist/commands/adr.js.map +1 -1
- package/dist/commands/archive.d.ts +2 -5
- package/dist/commands/archive.d.ts.map +1 -1
- package/dist/commands/archive.js +43 -11
- package/dist/commands/archive.js.map +1 -1
- package/dist/commands/brief.d.ts +32 -0
- package/dist/commands/brief.d.ts.map +1 -0
- package/dist/commands/brief.js +161 -0
- package/dist/commands/brief.js.map +1 -0
- package/dist/commands/complete.js +1 -1
- package/dist/commands/complete.js.map +1 -1
- package/dist/commands/init.d.ts +14 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +115 -15
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/log.js +31 -18
- package/dist/commands/log.js.map +1 -1
- package/dist/commands/mcp.d.ts +9 -0
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +72 -17
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/merge-driver.d.ts +26 -0
- package/dist/commands/merge-driver.d.ts.map +1 -0
- package/dist/commands/merge-driver.js +195 -0
- package/dist/commands/merge-driver.js.map +1 -0
- package/dist/commands/migrate-tracked.d.ts +8 -0
- package/dist/commands/migrate-tracked.d.ts.map +1 -0
- package/dist/commands/migrate-tracked.js +428 -0
- package/dist/commands/migrate-tracked.js.map +1 -0
- package/dist/commands/migrate.d.ts +6 -0
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +19 -12
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/sync.d.ts +16 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +152 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/where.d.ts +21 -0
- package/dist/commands/where.d.ts.map +1 -0
- package/dist/commands/where.js +135 -0
- package/dist/commands/where.js.map +1 -0
- package/dist/mcp/helpers.d.ts +8 -0
- package/dist/mcp/helpers.d.ts.map +1 -1
- package/dist/mcp/helpers.js +44 -0
- package/dist/mcp/helpers.js.map +1 -1
- package/dist/mcp/schemas.d.ts +297 -0
- package/dist/mcp/schemas.d.ts.map +1 -0
- package/dist/mcp/schemas.js +328 -0
- package/dist/mcp/schemas.js.map +1 -0
- package/dist/mcp/tools/brief_tool.d.ts +14 -0
- package/dist/mcp/tools/brief_tool.d.ts.map +1 -0
- package/dist/mcp/tools/brief_tool.js +96 -0
- package/dist/mcp/tools/brief_tool.js.map +1 -0
- package/dist/mcp/tools/contract_tool.d.ts.map +1 -1
- package/dist/mcp/tools/contract_tool.js +43 -18
- package/dist/mcp/tools/contract_tool.js.map +1 -1
- package/dist/mcp/tools/get_task_tool.d.ts.map +1 -1
- package/dist/mcp/tools/get_task_tool.js +7 -2
- package/dist/mcp/tools/get_task_tool.js.map +1 -1
- package/dist/mcp/tools/list_tasks_tool.d.ts.map +1 -1
- package/dist/mcp/tools/list_tasks_tool.js +9 -3
- package/dist/mcp/tools/list_tasks_tool.js.map +1 -1
- package/dist/mcp/tools/search_tool.d.ts.map +1 -1
- package/dist/mcp/tools/search_tool.js +17 -4
- package/dist/mcp/tools/search_tool.js.map +1 -1
- package/dist/mcp/tools/subtask_tool.d.ts.map +1 -1
- package/dist/mcp/tools/subtask_tool.js +52 -17
- package/dist/mcp/tools/subtask_tool.js.map +1 -1
- package/dist/mcp/tools/task_add_tool.d.ts.map +1 -1
- package/dist/mcp/tools/task_add_tool.js +13 -7
- package/dist/mcp/tools/task_add_tool.js.map +1 -1
- package/dist/mcp/tools/task_complete_tool.d.ts.map +1 -1
- package/dist/mcp/tools/task_complete_tool.js +39 -10
- package/dist/mcp/tools/task_complete_tool.js.map +1 -1
- package/dist/mcp/tools/task_delete_tool.d.ts.map +1 -1
- package/dist/mcp/tools/task_delete_tool.js +12 -6
- package/dist/mcp/tools/task_delete_tool.js.map +1 -1
- package/dist/mcp/tools/task_move_tool.d.ts.map +1 -1
- package/dist/mcp/tools/task_move_tool.js +21 -11
- package/dist/mcp/tools/task_move_tool.js.map +1 -1
- package/dist/mcp/tools/task_patch_tool.d.ts.map +1 -1
- package/dist/mcp/tools/task_patch_tool.js +23 -10
- package/dist/mcp/tools/task_patch_tool.js.map +1 -1
- package/dist/schemas/board.json +1 -1
- package/dist/tui/theme.d.ts +98 -0
- package/dist/tui/theme.d.ts.map +1 -0
- package/dist/tui/theme.js +141 -0
- package/dist/tui/theme.js.map +1 -0
- package/dist/{tui-P56H4X7N.mjs → tui-M2KWIG2E.mjs} +1707 -2006
- package/dist/utils/board-autosync.d.ts +22 -0
- package/dist/utils/board-autosync.d.ts.map +1 -0
- package/dist/utils/board-autosync.js +166 -0
- package/dist/utils/board-autosync.js.map +1 -0
- package/dist/utils/board-commit-hooks.d.ts +12 -0
- package/dist/utils/board-commit-hooks.d.ts.map +1 -0
- package/dist/utils/board-commit-hooks.js +51 -0
- package/dist/utils/board-commit-hooks.js.map +1 -0
- package/dist/utils/board-repo.d.ts +108 -0
- package/dist/utils/board-repo.d.ts.map +1 -0
- package/dist/utils/board-repo.js +501 -0
- package/dist/utils/board-repo.js.map +1 -0
- package/dist/utils/board-sync.d.ts +111 -0
- package/dist/utils/board-sync.d.ts.map +1 -0
- package/dist/utils/board-sync.js +469 -0
- package/dist/utils/board-sync.js.map +1 -0
- package/dist/utils/brainfile-path.d.ts +11 -1
- package/dist/utils/brainfile-path.d.ts.map +1 -1
- package/dist/utils/brainfile-path.js +39 -2
- package/dist/utils/brainfile-path.js.map +1 -1
- package/dist/utils/cli-error.d.ts +20 -0
- package/dist/utils/cli-error.d.ts.map +1 -1
- package/dist/utils/cli-error.js +36 -0
- package/dist/utils/cli-error.js.map +1 -1
- package/package.json +3 -3
- package/dist/commands/rules.d.ts +0 -68
- package/dist/commands/rules.d.ts.map +0 -1
- package/dist/commands/rules.js +0 -322
- package/dist/commands/rules.js.map +0 -1
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.briefOutputSchema = exports.taskCompleteOutputSchema = exports.contractOutputSchema = exports.subtaskOutputSchema = exports.taskDeleteOutputSchema = exports.taskPatchOutputSchema = exports.taskMoveOutputSchema = exports.taskAddOutputSchema = exports.searchOutputSchema = exports.getTaskOutputSchema = exports.listTasksOutputSchema = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Output schemas for the 11 consolidated MCP tools.
|
|
6
|
+
*
|
|
7
|
+
* Each tool declares one of these as `outputSchema`, and every non-error
|
|
8
|
+
* success path returns the matching object as `structuredContent` alongside
|
|
9
|
+
* the `content` text block it already emitted. The text block is never
|
|
10
|
+
* removed, so clients that read only `content` are unaffected.
|
|
11
|
+
*
|
|
12
|
+
* Three SDK behaviours (v2.0.0) shape everything here — all verified against
|
|
13
|
+
* the installed `@modelcontextprotocol/server` runtime:
|
|
14
|
+
*
|
|
15
|
+
* 1. Declaring `outputSchema` makes `structuredContent` MANDATORY on every
|
|
16
|
+
* result that is not `isError: true`. `McpServer.validateToolOutput`
|
|
17
|
+
* throws `Output validation error: … no structured content was provided`
|
|
18
|
+
* otherwise. Adding a schema to a tool therefore means auditing *every*
|
|
19
|
+
* success `return` in that tool, not just the main one.
|
|
20
|
+
*
|
|
21
|
+
* 2. Output validation is SKIPPED when `isError: true`, so error paths need
|
|
22
|
+
* neither `structuredContent` nor schema conformance. Error returns are
|
|
23
|
+
* left exactly as they were.
|
|
24
|
+
*
|
|
25
|
+
* 3. Root shape decides whether the two protocol eras agree. The 2025-era
|
|
26
|
+
* wire codec re-wraps `structuredContent` as `{result: …}` whenever the
|
|
27
|
+
* ADVERTISED schema root is not `type: "object"`, while the 2026-era codec
|
|
28
|
+
* is identity — so a non-object root would hand the two eras different
|
|
29
|
+
* bytes. Unions are still safe: the SDK's `standardSchemaToJsonSchema`
|
|
30
|
+
* injects `type: "object"` for any `oneOf`/`anyOf` whose members are all
|
|
31
|
+
* object-shaped (`isProvablyObjectShapedRoot`). Every union below is a
|
|
32
|
+
* union of objects for exactly that reason — adding a non-object member
|
|
33
|
+
* (a bare `z.string()`, say) would silently split the eras apart.
|
|
34
|
+
*
|
|
35
|
+
* Enum-ish fields that originate in hand-editable YAML (notably `priority`)
|
|
36
|
+
* are typed `z.string()` rather than `z.enum([...])`. A board carrying
|
|
37
|
+
* `priority: urgent` would otherwise fail output validation and turn a
|
|
38
|
+
* working call into an error result.
|
|
39
|
+
*/
|
|
40
|
+
const zod_1 = require("zod");
|
|
41
|
+
// ── shared fragments ───────────────────────────────────────────────────────
|
|
42
|
+
/** A task as projected into list/search results (never the raw task file). */
|
|
43
|
+
const taskSummaryShape = {
|
|
44
|
+
id: zod_1.z.string(),
|
|
45
|
+
title: zod_1.z.string(),
|
|
46
|
+
priority: zod_1.z.string().optional(),
|
|
47
|
+
tags: zod_1.z.array(zod_1.z.string()).optional(),
|
|
48
|
+
assignee: zod_1.z.string().optional(),
|
|
49
|
+
};
|
|
50
|
+
// `column` is the column *id* (same as `get_task`), so a subsequent `task_move`
|
|
51
|
+
// can pass the value back without resolving titles.
|
|
52
|
+
const subtaskSchema = zod_1.z.looseObject({
|
|
53
|
+
id: zod_1.z.string(),
|
|
54
|
+
title: zod_1.z.string(),
|
|
55
|
+
completed: zod_1.z.boolean().optional(),
|
|
56
|
+
});
|
|
57
|
+
// ── list_tasks ─────────────────────────────────────────────────────────────
|
|
58
|
+
exports.listTasksOutputSchema = zod_1.z.object({
|
|
59
|
+
tasks: zod_1.z.array(zod_1.z.object({ ...taskSummaryShape, column: zod_1.z.string() })),
|
|
60
|
+
count: zod_1.z.number(),
|
|
61
|
+
});
|
|
62
|
+
// ── get_task ───────────────────────────────────────────────────────────────
|
|
63
|
+
/**
|
|
64
|
+
* `get_task` spreads the raw `Task`, whose TypeScript type carries an open
|
|
65
|
+
* `[key: string]: unknown` index signature so extension fields (`x-otto`,
|
|
66
|
+
* `x-cursor`, …) round-trip. Modelled with `z.looseObject` so the advertised
|
|
67
|
+
* JSON Schema says `additionalProperties: {}` instead of `false` — a closed
|
|
68
|
+
* object would advertise those extension fields as illegal.
|
|
69
|
+
*
|
|
70
|
+
* `id` and `title` are required because `parseTaskContent` returns null for
|
|
71
|
+
* any task file missing either, so a task that reached this point has both.
|
|
72
|
+
* `column` is always set by the handler.
|
|
73
|
+
*/
|
|
74
|
+
exports.getTaskOutputSchema = zod_1.z.looseObject({
|
|
75
|
+
id: zod_1.z.string(),
|
|
76
|
+
title: zod_1.z.string(),
|
|
77
|
+
column: zod_1.z.string(),
|
|
78
|
+
type: zod_1.z.string().optional(),
|
|
79
|
+
description: zod_1.z.string().optional(),
|
|
80
|
+
parentId: zod_1.z.string().optional(),
|
|
81
|
+
dependsOn: zod_1.z.array(zod_1.z.string()).optional(),
|
|
82
|
+
blockedBy: zod_1.z.array(zod_1.z.string()).optional(),
|
|
83
|
+
relatedFiles: zod_1.z.array(zod_1.z.string()).optional(),
|
|
84
|
+
assignee: zod_1.z.string().optional(),
|
|
85
|
+
tags: zod_1.z.array(zod_1.z.string()).optional(),
|
|
86
|
+
priority: zod_1.z.string().optional(),
|
|
87
|
+
dueDate: zod_1.z.string().optional(),
|
|
88
|
+
subtasks: zod_1.z.array(subtaskSchema).optional(),
|
|
89
|
+
contract: zod_1.z.looseObject({}).optional(),
|
|
90
|
+
createdAt: zod_1.z.string().optional(),
|
|
91
|
+
updatedAt: zod_1.z.string().optional(),
|
|
92
|
+
completedAt: zod_1.z.string().optional(),
|
|
93
|
+
position: zod_1.z.number().optional(),
|
|
94
|
+
archived: zod_1.z.boolean().optional(),
|
|
95
|
+
});
|
|
96
|
+
// ── search ─────────────────────────────────────────────────────────────────
|
|
97
|
+
/** `task:` — a single task/log entry rendered with its description and log. */
|
|
98
|
+
const searchTaskViewSchema = zod_1.z.object({
|
|
99
|
+
id: zod_1.z.string(),
|
|
100
|
+
title: zod_1.z.string(),
|
|
101
|
+
completedAt: zod_1.z.string().optional(),
|
|
102
|
+
isLog: zod_1.z.boolean(),
|
|
103
|
+
description: zod_1.z.string().optional(),
|
|
104
|
+
log: zod_1.z.string().optional(),
|
|
105
|
+
});
|
|
106
|
+
/** `recent: true` — the most recently completed tasks. */
|
|
107
|
+
const searchRecentSchema = zod_1.z.object({
|
|
108
|
+
logs: zod_1.z.array(zod_1.z.object({
|
|
109
|
+
id: zod_1.z.string(),
|
|
110
|
+
title: zod_1.z.string(),
|
|
111
|
+
completedAt: zod_1.z.string().optional(),
|
|
112
|
+
})),
|
|
113
|
+
count: zod_1.z.number(),
|
|
114
|
+
});
|
|
115
|
+
/** `query:` — ranked matches across board and logs. */
|
|
116
|
+
const searchResultsSchema = zod_1.z.object({
|
|
117
|
+
results: zod_1.z.array(zod_1.z.object({
|
|
118
|
+
...taskSummaryShape,
|
|
119
|
+
column: zod_1.z.string().optional(),
|
|
120
|
+
score: zod_1.z.number(),
|
|
121
|
+
isLog: zod_1.z.boolean().optional(),
|
|
122
|
+
})),
|
|
123
|
+
count: zod_1.z.number(),
|
|
124
|
+
});
|
|
125
|
+
/**
|
|
126
|
+
* Three genuinely different payloads selected by which input was supplied.
|
|
127
|
+
* The variants' required-field sets don't overlap (`isLog` scalar vs `logs`
|
|
128
|
+
* array vs `results` array), so an untagged union discriminates structurally
|
|
129
|
+
* and no payload had to change to add a tag.
|
|
130
|
+
*/
|
|
131
|
+
exports.searchOutputSchema = zod_1.z.union([
|
|
132
|
+
searchTaskViewSchema,
|
|
133
|
+
searchRecentSchema,
|
|
134
|
+
searchResultsSchema,
|
|
135
|
+
]);
|
|
136
|
+
// ── task_add ───────────────────────────────────────────────────────────────
|
|
137
|
+
/** New payload: `task_add` previously returned only a prose confirmation. */
|
|
138
|
+
exports.taskAddOutputSchema = zod_1.z.object({
|
|
139
|
+
id: zod_1.z.string(),
|
|
140
|
+
title: zod_1.z.string(),
|
|
141
|
+
});
|
|
142
|
+
// ── task_move / task_patch ─────────────────────────────────────────────────
|
|
143
|
+
/**
|
|
144
|
+
* Both tools branch their TEXT on single-vs-batch, but the structured payload
|
|
145
|
+
* is always the batch shape (a one-element `results` array for a single move),
|
|
146
|
+
* so agents parse one shape regardless of how many IDs they passed.
|
|
147
|
+
*/
|
|
148
|
+
exports.taskMoveOutputSchema = zod_1.z.object({
|
|
149
|
+
success: zod_1.z.boolean(),
|
|
150
|
+
successCount: zod_1.z.number(),
|
|
151
|
+
failureCount: zod_1.z.number(),
|
|
152
|
+
results: zod_1.z.array(zod_1.z.object({
|
|
153
|
+
taskId: zod_1.z.string(),
|
|
154
|
+
success: zod_1.z.boolean(),
|
|
155
|
+
message: zod_1.z.string().optional(),
|
|
156
|
+
warning: zod_1.z.string().optional(),
|
|
157
|
+
error: zod_1.z.string().optional(),
|
|
158
|
+
})),
|
|
159
|
+
});
|
|
160
|
+
exports.taskPatchOutputSchema = zod_1.z.object({
|
|
161
|
+
success: zod_1.z.boolean(),
|
|
162
|
+
successCount: zod_1.z.number(),
|
|
163
|
+
failureCount: zod_1.z.number(),
|
|
164
|
+
results: zod_1.z.array(zod_1.z.object({
|
|
165
|
+
taskId: zod_1.z.string(),
|
|
166
|
+
success: zod_1.z.boolean(),
|
|
167
|
+
error: zod_1.z.string().optional(),
|
|
168
|
+
})),
|
|
169
|
+
});
|
|
170
|
+
// ── task_delete ────────────────────────────────────────────────────────────
|
|
171
|
+
/** New payload: `task_delete` previously returned only a prose confirmation. */
|
|
172
|
+
exports.taskDeleteOutputSchema = zod_1.z.object({
|
|
173
|
+
id: zod_1.z.string(),
|
|
174
|
+
deleted: zod_1.z.literal(true),
|
|
175
|
+
});
|
|
176
|
+
// ── subtask ────────────────────────────────────────────────────────────────
|
|
177
|
+
/**
|
|
178
|
+
* `toggle` and `update` both key their payload `updated` but carry different
|
|
179
|
+
* item shapes (`{id, completed}` vs `{id, title}`), which is ambiguous without
|
|
180
|
+
* a tag. The tool's own `action` input is echoed into the output to
|
|
181
|
+
* discriminate — an added field, nothing renamed.
|
|
182
|
+
*
|
|
183
|
+
* The singular paths (which used to emit prose only) now emit the same plural
|
|
184
|
+
* array shape, so item count never changes the structure.
|
|
185
|
+
*/
|
|
186
|
+
exports.subtaskOutputSchema = zod_1.z.discriminatedUnion('action', [
|
|
187
|
+
zod_1.z.object({
|
|
188
|
+
action: zod_1.z.literal('add'),
|
|
189
|
+
added: zod_1.z.array(zod_1.z.object({ id: zod_1.z.string(), title: zod_1.z.string() })),
|
|
190
|
+
count: zod_1.z.number(),
|
|
191
|
+
}),
|
|
192
|
+
zod_1.z.object({
|
|
193
|
+
action: zod_1.z.literal('delete'),
|
|
194
|
+
deleted: zod_1.z.array(zod_1.z.string()),
|
|
195
|
+
missing: zod_1.z.array(zod_1.z.string()),
|
|
196
|
+
count: zod_1.z.number(),
|
|
197
|
+
}),
|
|
198
|
+
zod_1.z.object({
|
|
199
|
+
action: zod_1.z.literal('toggle'),
|
|
200
|
+
updated: zod_1.z.array(zod_1.z.object({ id: zod_1.z.string(), completed: zod_1.z.boolean().optional() })),
|
|
201
|
+
count: zod_1.z.number(),
|
|
202
|
+
}),
|
|
203
|
+
zod_1.z.object({
|
|
204
|
+
action: zod_1.z.literal('update'),
|
|
205
|
+
updated: zod_1.z.array(zod_1.z.object({ id: zod_1.z.string(), title: zod_1.z.string() })),
|
|
206
|
+
count: zod_1.z.number(),
|
|
207
|
+
}),
|
|
208
|
+
]);
|
|
209
|
+
// ── contract ───────────────────────────────────────────────────────────────
|
|
210
|
+
const deliverableSchema = zod_1.z.looseObject({
|
|
211
|
+
// Hand-edited YAML often omits `type` (path-only deliverables). Required here
|
|
212
|
+
// would fail output validation on a successful validate after the task was
|
|
213
|
+
// already completed.
|
|
214
|
+
type: zod_1.z.string().optional(),
|
|
215
|
+
path: zod_1.z.string(),
|
|
216
|
+
description: zod_1.z.string().optional(),
|
|
217
|
+
});
|
|
218
|
+
/**
|
|
219
|
+
* Six heterogeneous actions, tagged by the `action` input the caller already
|
|
220
|
+
* supplied. `pickup`'s payload is genuinely free-text agent-context markdown,
|
|
221
|
+
* so its variant is deliberately thin — an output schema does not have to
|
|
222
|
+
* invent structure that the payload does not have.
|
|
223
|
+
*/
|
|
224
|
+
exports.contractOutputSchema = zod_1.z.discriminatedUnion('action', [
|
|
225
|
+
zod_1.z.object({
|
|
226
|
+
action: zod_1.z.literal('attach'),
|
|
227
|
+
task: zod_1.z.string(),
|
|
228
|
+
status: zod_1.z.string(),
|
|
229
|
+
}),
|
|
230
|
+
zod_1.z.object({
|
|
231
|
+
action: zod_1.z.literal('pickup'),
|
|
232
|
+
task: zod_1.z.string(),
|
|
233
|
+
markdown: zod_1.z.string(),
|
|
234
|
+
}),
|
|
235
|
+
zod_1.z.object({
|
|
236
|
+
action: zod_1.z.literal('deliver'),
|
|
237
|
+
task: zod_1.z.string(),
|
|
238
|
+
}),
|
|
239
|
+
zod_1.z.object({
|
|
240
|
+
action: zod_1.z.literal('validate'),
|
|
241
|
+
ok: zod_1.z.boolean(),
|
|
242
|
+
status: zod_1.z.string(),
|
|
243
|
+
deliverables: zod_1.z.array(zod_1.z.looseObject({
|
|
244
|
+
deliverable: deliverableSchema,
|
|
245
|
+
ok: zod_1.z.boolean(),
|
|
246
|
+
resolvedPath: zod_1.z.string().optional(),
|
|
247
|
+
error: zod_1.z.string().optional(),
|
|
248
|
+
})),
|
|
249
|
+
commands: zod_1.z.array(zod_1.z.looseObject({
|
|
250
|
+
command: zod_1.z.string(),
|
|
251
|
+
exitCode: zod_1.z.number(),
|
|
252
|
+
stdout: zod_1.z.string(),
|
|
253
|
+
stderr: zod_1.z.string(),
|
|
254
|
+
})),
|
|
255
|
+
warnings: zod_1.z.array(zod_1.z.looseObject({
|
|
256
|
+
command: zod_1.z.string(),
|
|
257
|
+
message: zod_1.z.string(),
|
|
258
|
+
})),
|
|
259
|
+
}),
|
|
260
|
+
zod_1.z.object({
|
|
261
|
+
action: zod_1.z.literal('graph'),
|
|
262
|
+
attached: zod_1.z.array(zod_1.z.string()),
|
|
263
|
+
count: zod_1.z.number(),
|
|
264
|
+
order: zod_1.z.array(zod_1.z.string()),
|
|
265
|
+
graph: zod_1.z.string(),
|
|
266
|
+
}),
|
|
267
|
+
zod_1.z.object({
|
|
268
|
+
action: zod_1.z.literal('activate'),
|
|
269
|
+
activated: zod_1.z.array(zod_1.z.string()),
|
|
270
|
+
count: zod_1.z.number(),
|
|
271
|
+
}),
|
|
272
|
+
]);
|
|
273
|
+
// ── task_complete ──────────────────────────────────────────────────────────
|
|
274
|
+
/**
|
|
275
|
+
* New payload: every success path previously returned prose only, with the
|
|
276
|
+
* interesting values (`completedAt`, issue number/id, issue URL) interpolated
|
|
277
|
+
* into the message. They are now also returned as real fields.
|
|
278
|
+
*
|
|
279
|
+
* Tagged by the `destination` input. The default path (no `destination`) and
|
|
280
|
+
* `destination: 'local'` share the `local` variant and are told apart by
|
|
281
|
+
* `archived`.
|
|
282
|
+
*/
|
|
283
|
+
exports.taskCompleteOutputSchema = zod_1.z.discriminatedUnion('destination', [
|
|
284
|
+
zod_1.z.object({
|
|
285
|
+
destination: zod_1.z.literal('local'),
|
|
286
|
+
taskId: zod_1.z.string(),
|
|
287
|
+
completedAt: zod_1.z.string().optional(),
|
|
288
|
+
archived: zod_1.z.boolean(),
|
|
289
|
+
}),
|
|
290
|
+
zod_1.z.object({
|
|
291
|
+
destination: zod_1.z.literal('github'),
|
|
292
|
+
taskId: zod_1.z.string(),
|
|
293
|
+
issueNumber: zod_1.z.number().optional(),
|
|
294
|
+
issueUrl: zod_1.z.string().optional(),
|
|
295
|
+
}),
|
|
296
|
+
zod_1.z.object({
|
|
297
|
+
destination: zod_1.z.literal('linear'),
|
|
298
|
+
taskId: zod_1.z.string(),
|
|
299
|
+
issueId: zod_1.z.string().optional(),
|
|
300
|
+
issueUrl: zod_1.z.string().optional(),
|
|
301
|
+
}),
|
|
302
|
+
]);
|
|
303
|
+
/**
|
|
304
|
+
* `brief` — per-agent attention digest.
|
|
305
|
+
*
|
|
306
|
+
* Object root (not a bare array of lanes) so both protocol eras hand clients
|
|
307
|
+
* identical bytes, per note 3 above. `lastBriefAt` is nullable rather than
|
|
308
|
+
* optional: "this agent has never briefed" is a meaningful state a client must
|
|
309
|
+
* be able to distinguish from an omitted field.
|
|
310
|
+
*/
|
|
311
|
+
exports.briefOutputSchema = zod_1.z.object({
|
|
312
|
+
agent: zod_1.z.string(),
|
|
313
|
+
mode: zod_1.z.enum(['full', 'delta']),
|
|
314
|
+
generatedAt: zod_1.z.string(),
|
|
315
|
+
lastBriefAt: zod_1.z.string().nullable(),
|
|
316
|
+
peek: zod_1.z.boolean(),
|
|
317
|
+
lanes: zod_1.z.array(zod_1.z.object({
|
|
318
|
+
id: zod_1.z.string(),
|
|
319
|
+
label: zod_1.z.string(),
|
|
320
|
+
items: zod_1.z.array(zod_1.z.object({
|
|
321
|
+
taskId: zod_1.z.string().optional(),
|
|
322
|
+
text: zod_1.z.string(),
|
|
323
|
+
why: zod_1.z.string(),
|
|
324
|
+
at: zod_1.z.string().optional(),
|
|
325
|
+
})),
|
|
326
|
+
})),
|
|
327
|
+
});
|
|
328
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/mcp/schemas.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,6BAAwB;AAExB,8EAA8E;AAE9E,8EAA8E;AAC9E,MAAM,gBAAgB,GAAG;IACvB,EAAE,EAAE,OAAC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C;QACtB,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;QACd,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;QACjB,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,CAAC;YACtB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YAC7B,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;YAChB,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;YACf,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAC1B,CAAC,CAAC;KACJ,CAAC,CAAC;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/server";
|
|
2
|
+
/**
|
|
3
|
+
* `brief` — "what changed that I should care about?" for one agent.
|
|
4
|
+
*
|
|
5
|
+
* The first call for an agent returns a full orientation; later calls return a
|
|
6
|
+
* delta against that agent's stored checkpoint in `.brainfile/state/`. `peek`
|
|
7
|
+
* reads without advancing the checkpoint, so a client can inspect pending work
|
|
8
|
+
* without consuming it.
|
|
9
|
+
*
|
|
10
|
+
* Note that `buildBrief` itself is read-only — advancing the checkpoint is this
|
|
11
|
+
* handler's decision, which is what makes `peek` a no-op on the write step.
|
|
12
|
+
*/
|
|
13
|
+
export declare function registerBriefTool(server: McpServer, defaultFile: string): void;
|
|
14
|
+
//# sourceMappingURL=brief_tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brief_tool.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/brief_tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAS9D;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAmD9E"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.registerBriefTool = registerBriefTool;
|
|
37
|
+
const zod_1 = require("zod");
|
|
38
|
+
const core_1 = require("@brainfile/core");
|
|
39
|
+
const v2_detect_1 = require("../../utils/v2-detect");
|
|
40
|
+
const helpers_1 = require("../helpers");
|
|
41
|
+
const schemas_1 = require("../schemas");
|
|
42
|
+
const board_sync_1 = require("../../utils/board-sync");
|
|
43
|
+
const path = __importStar(require("path"));
|
|
44
|
+
/**
|
|
45
|
+
* `brief` — "what changed that I should care about?" for one agent.
|
|
46
|
+
*
|
|
47
|
+
* The first call for an agent returns a full orientation; later calls return a
|
|
48
|
+
* delta against that agent's stored checkpoint in `.brainfile/state/`. `peek`
|
|
49
|
+
* reads without advancing the checkpoint, so a client can inspect pending work
|
|
50
|
+
* without consuming it.
|
|
51
|
+
*
|
|
52
|
+
* Note that `buildBrief` itself is read-only — advancing the checkpoint is this
|
|
53
|
+
* handler's decision, which is what makes `peek` a no-op on the write step.
|
|
54
|
+
*/
|
|
55
|
+
function registerBriefTool(server, defaultFile) {
|
|
56
|
+
server.registerTool('brief', {
|
|
57
|
+
title: 'Agent Brief',
|
|
58
|
+
description: 'Get a per-agent brief: what changed on the board since this agent last checked in. '
|
|
59
|
+
+ 'First call returns a full orientation; later calls return only what is new.',
|
|
60
|
+
inputSchema: zod_1.z.object({
|
|
61
|
+
file: zod_1.z.string().optional().describe('Path to brainfile.md (default: brainfile.md)'),
|
|
62
|
+
agent: zod_1.z.string().describe('Agent identifier (required — brief state is per-agent)'),
|
|
63
|
+
peek: zod_1.z.boolean().optional().describe('Read the brief without marking it as seen'),
|
|
64
|
+
offline: zod_1.z.boolean().optional().describe('Skip syncing a shared board before the brief'),
|
|
65
|
+
}),
|
|
66
|
+
outputSchema: schemas_1.briefOutputSchema,
|
|
67
|
+
}, async ({ file, agent, peek, offline }) => {
|
|
68
|
+
const filePath = file || defaultFile;
|
|
69
|
+
const guard = (0, helpers_1.requireV2)(filePath);
|
|
70
|
+
if (guard)
|
|
71
|
+
return guard;
|
|
72
|
+
const agentName = agent?.trim();
|
|
73
|
+
if (!agentName) {
|
|
74
|
+
return {
|
|
75
|
+
content: [{ type: 'text', text: 'Error: agent is required' }],
|
|
76
|
+
isError: true,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const resolvedPath = (0, helpers_1.resolveBrainfile)(filePath);
|
|
80
|
+
if (!offline)
|
|
81
|
+
(0, board_sync_1.syncBoard)(path.dirname(resolvedPath), { agent: agentName });
|
|
82
|
+
const dirs = (0, v2_detect_1.getV2Dirs)(resolvedPath);
|
|
83
|
+
const isPeek = peek === true;
|
|
84
|
+
const state = (0, core_1.readBriefState)(resolvedPath, agentName);
|
|
85
|
+
const result = (0, core_1.buildBrief)(dirs, agentName, { lastBriefAt: state.lastBriefAt });
|
|
86
|
+
if (!isPeek) {
|
|
87
|
+
(0, core_1.writeBriefState)(resolvedPath, agentName, result.generatedAt);
|
|
88
|
+
}
|
|
89
|
+
const output = { ...result, peek: isPeek };
|
|
90
|
+
return {
|
|
91
|
+
content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
|
|
92
|
+
structuredContent: output,
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=brief_tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brief_tool.js","sourceRoot":"","sources":["../../../src/mcp/tools/brief_tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,8CAmDC;AAtED,6BAAwB;AACxB,0CAA8E;AAC9E,qDAAkD;AAClD,wCAAyD;AACzD,wCAA+C;AAC/C,uDAAmD;AACnD,2CAA6B;AAE7B;;;;;;;;;;GAUG;AACH,SAAgB,iBAAiB,CAAC,MAAiB,EAAE,WAAmB;IACtE,MAAM,CAAC,YAAY,CACjB,OAAO,EACP;QACE,KAAK,EAAE,aAAa;QACpB,WAAW,EACT,qFAAqF;cACnF,6EAA6E;QACjF,WAAW,EAAE,OAAC,CAAC,MAAM,CAAC;YACpB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,C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U,EAAC,IAAI,EAAE,SAAS,EAAE,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;QAE/E,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,IAAA,sBAAe,EAAC,YAAY,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAC/D,CAAC;QAED,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAE3C,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;YAC3E,iBAAiB,EAAE,MAAM;SAC1B,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract_tool.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/contract_tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"contract_tool.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/contract_tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAc9D,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CA0MjF"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerContractTool = registerContractTool;
|
|
4
|
+
const helpers_1 = require("../helpers");
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
6
|
const core_1 = require("@brainfile/core");
|
|
6
7
|
const v2_detect_1 = require("../../utils/v2-detect");
|
|
7
8
|
const contractRunner_1 = require("../../lib/contractRunner");
|
|
8
9
|
const contract_1 = require("./contract");
|
|
9
|
-
const
|
|
10
|
+
const helpers_2 = require("../helpers");
|
|
11
|
+
const schemas_1 = require("../schemas");
|
|
10
12
|
function registerContractTool(server, defaultFile) {
|
|
11
13
|
server.registerTool('contract', {
|
|
12
14
|
title: 'Contract',
|
|
@@ -40,15 +42,16 @@ function registerContractTool(server, defaultFile) {
|
|
|
40
42
|
dependsOn: zod_1.z.array(zod_1.z.string()).optional(),
|
|
41
43
|
})).optional().describe('graph only: array of contract graph task specs'),
|
|
42
44
|
activate: zod_1.z.boolean().optional().describe('graph only: when true, attached contracts start in ready instead of draft'),
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
+
}),
|
|
46
|
+
outputSchema: schemas_1.contractOutputSchema
|
|
47
|
+
}, (0, helpers_1.withBoardCommit)('contract', defaultFile, async ({ action, file, task, parentId, ready: attachReady, deliverables, validation_commands, constraints, tasks, activate }) => {
|
|
45
48
|
const filePath = file || defaultFile;
|
|
46
49
|
// ── attach ─────────────────────────────────────────────────────────────
|
|
47
50
|
if (action === 'attach') {
|
|
48
51
|
if (!task) {
|
|
49
52
|
return { content: [{ type: 'text', text: 'Error: task is required for action=attach' }], isError: true };
|
|
50
53
|
}
|
|
51
|
-
const guard = (0,
|
|
54
|
+
const guard = (0, helpers_2.requireV2)(filePath);
|
|
52
55
|
if (guard)
|
|
53
56
|
return guard;
|
|
54
57
|
const dirs = (0, v2_detect_1.getV2Dirs)(filePath);
|
|
@@ -66,7 +69,11 @@ function registerContractTool(server, defaultFile) {
|
|
|
66
69
|
if (!result.success || !result.task) {
|
|
67
70
|
return { content: [{ type: 'text', text: `Error: ${result.error || 'Failed to attach contract'}` }], isError: true };
|
|
68
71
|
}
|
|
69
|
-
|
|
72
|
+
const status = result.task.contract.status;
|
|
73
|
+
return {
|
|
74
|
+
content: [{ type: 'text', text: `Contract attached (${status}): ${task}` }],
|
|
75
|
+
structuredContent: { action: 'attach', task, status },
|
|
76
|
+
};
|
|
70
77
|
}
|
|
71
78
|
catch (e) {
|
|
72
79
|
return { content: [{ type: 'text', text: `Error: ${e.message}` }], isError: true };
|
|
@@ -81,7 +88,12 @@ function registerContractTool(server, defaultFile) {
|
|
|
81
88
|
if ('error' in result) {
|
|
82
89
|
return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
|
|
83
90
|
}
|
|
84
|
-
|
|
91
|
+
// The payload is genuinely free-text agent-context markdown, so the
|
|
92
|
+
// structured variant just carries it verbatim.
|
|
93
|
+
return {
|
|
94
|
+
content: [{ type: 'text', text: result.markdown }],
|
|
95
|
+
structuredContent: { action: 'pickup', task, markdown: result.markdown },
|
|
96
|
+
};
|
|
85
97
|
}
|
|
86
98
|
// ── deliver ────────────────────────────────────────────────────────────
|
|
87
99
|
if (action === 'deliver') {
|
|
@@ -92,7 +104,10 @@ function registerContractTool(server, defaultFile) {
|
|
|
92
104
|
if ('error' in result) {
|
|
93
105
|
return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
|
|
94
106
|
}
|
|
95
|
-
return {
|
|
107
|
+
return {
|
|
108
|
+
content: [{ type: 'text', text: `Contract delivered: ${task}` }],
|
|
109
|
+
structuredContent: { action: 'deliver', task },
|
|
110
|
+
};
|
|
96
111
|
}
|
|
97
112
|
// ── validate ───────────────────────────────────────────────────────────
|
|
98
113
|
if (action === 'validate') {
|
|
@@ -104,15 +119,19 @@ function registerContractTool(server, defaultFile) {
|
|
|
104
119
|
return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
|
|
105
120
|
}
|
|
106
121
|
const output = {
|
|
122
|
+
action: 'validate',
|
|
107
123
|
ok: result.ok,
|
|
108
124
|
status: result.ok ? 'done' : 'failed',
|
|
109
125
|
deliverables: result.deliverableChecks,
|
|
110
126
|
commands: result.commandResults,
|
|
111
127
|
warnings: result.warnings,
|
|
112
128
|
};
|
|
129
|
+
// Failed validation is a successful tool result (`ok: false`), not a
|
|
130
|
+
// tool error. `isError: true` would skip outputSchema checks and hide
|
|
131
|
+
// deliverable/command details from clients that drop error payloads.
|
|
113
132
|
return {
|
|
114
133
|
content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
|
|
115
|
-
|
|
134
|
+
structuredContent: output,
|
|
116
135
|
};
|
|
117
136
|
}
|
|
118
137
|
// ── graph ──────────────────────────────────────────────────────────────
|
|
@@ -126,13 +145,16 @@ function registerContractTool(server, defaultFile) {
|
|
|
126
145
|
tasks,
|
|
127
146
|
activate,
|
|
128
147
|
});
|
|
148
|
+
const output = {
|
|
149
|
+
action: 'graph',
|
|
150
|
+
attached: result.attached,
|
|
151
|
+
count: result.count,
|
|
152
|
+
order: result.order,
|
|
153
|
+
graph: result.graph,
|
|
154
|
+
};
|
|
129
155
|
return {
|
|
130
|
-
content: [{ type: 'text', text: JSON.stringify(
|
|
131
|
-
|
|
132
|
-
count: result.count,
|
|
133
|
-
order: result.order,
|
|
134
|
-
graph: result.graph,
|
|
135
|
-
}, null, 2) }],
|
|
156
|
+
content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
|
|
157
|
+
structuredContent: output,
|
|
136
158
|
};
|
|
137
159
|
}
|
|
138
160
|
catch (error) {
|
|
@@ -147,7 +169,7 @@ function registerContractTool(server, defaultFile) {
|
|
|
147
169
|
if (!task && !parentId) {
|
|
148
170
|
return { content: [{ type: 'text', text: 'Error: task or parentId is required for action=activate' }], isError: true };
|
|
149
171
|
}
|
|
150
|
-
const guard = (0,
|
|
172
|
+
const guard = (0, helpers_2.requireV2)(filePath);
|
|
151
173
|
if (guard)
|
|
152
174
|
return guard;
|
|
153
175
|
const activated = [];
|
|
@@ -167,10 +189,13 @@ function registerContractTool(server, defaultFile) {
|
|
|
167
189
|
// Bulk by parentId
|
|
168
190
|
activated.push(...(0, core_1.activateTaskContractsByParent)(dirs.boardDir, parentId).activated);
|
|
169
191
|
}
|
|
170
|
-
const output = { activated, count: activated.length };
|
|
171
|
-
return {
|
|
192
|
+
const output = { action: 'activate', activated, count: activated.length };
|
|
193
|
+
return {
|
|
194
|
+
content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
|
|
195
|
+
structuredContent: output,
|
|
196
|
+
};
|
|
172
197
|
}
|
|
173
198
|
return { content: [{ type: 'text', text: `Error: Unknown action: ${action}` }], isError: true };
|
|
174
|
-
});
|
|
199
|
+
}));
|
|
175
200
|
}
|
|
176
201
|
//# sourceMappingURL=contract_tool.js.map
|