@allocator-one/harness-cli 1.13.0 → 1.15.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 +726 -31
- package/dist/chunk-I2S2JVCQ.js +4761 -0
- package/dist/cli.js +495 -173
- package/dist/{server-CYBKYG5E.js → server-O7CX2ZCC.js} +333 -15
- package/package.json +3 -1
- package/spec/openapi.json +13784 -1496
- package/dist/chunk-XFMECLOU.js +0 -2258
|
@@ -2,20 +2,29 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ACTIVITY_MAX_LIMIT,
|
|
4
4
|
CLI_VERSION,
|
|
5
|
+
CONDITION_KINDS,
|
|
5
6
|
Client,
|
|
7
|
+
GATE_OWNER_ROLES,
|
|
6
8
|
HttpError,
|
|
7
9
|
IDEMPOTENCY_KEY_FORMAT,
|
|
10
|
+
JOBS_MAX_LIMIT,
|
|
11
|
+
JOB_STATES,
|
|
12
|
+
JOB_STATUS_ALIASES,
|
|
8
13
|
MAX_IDEMPOTENCY_KEY_BYTES,
|
|
14
|
+
PLAN_EXECUTORS,
|
|
9
15
|
RELATION_CREATE_TYPES,
|
|
10
16
|
RELATION_UPDATE_TYPES,
|
|
17
|
+
STEER_MAX_CHARACTERS,
|
|
11
18
|
TransportError,
|
|
12
19
|
UsageError,
|
|
13
20
|
activity,
|
|
14
21
|
archive,
|
|
22
|
+
assignments,
|
|
15
23
|
blocked,
|
|
16
24
|
close,
|
|
17
25
|
comment,
|
|
18
26
|
comments,
|
|
27
|
+
conditionList,
|
|
19
28
|
create,
|
|
20
29
|
deleteComment,
|
|
21
30
|
dep,
|
|
@@ -24,6 +33,15 @@ import {
|
|
|
24
33
|
docShow,
|
|
25
34
|
docUpdate,
|
|
26
35
|
editComment,
|
|
36
|
+
errorDetails,
|
|
37
|
+
explainExpertRefusal,
|
|
38
|
+
gateSet,
|
|
39
|
+
jobCancel,
|
|
40
|
+
jobContinue,
|
|
41
|
+
jobPause,
|
|
42
|
+
jobShow,
|
|
43
|
+
jobSteer,
|
|
44
|
+
jobsList,
|
|
27
45
|
labelCreate,
|
|
28
46
|
labelDelete,
|
|
29
47
|
labelList,
|
|
@@ -38,6 +56,14 @@ import {
|
|
|
38
56
|
memberSetRole,
|
|
39
57
|
milestoneCreate,
|
|
40
58
|
milestoneList,
|
|
59
|
+
planCreate,
|
|
60
|
+
planEdit,
|
|
61
|
+
planHold,
|
|
62
|
+
planRelease,
|
|
63
|
+
planShow,
|
|
64
|
+
procedureRun,
|
|
65
|
+
procedureSave,
|
|
66
|
+
procedureShow,
|
|
41
67
|
projectCreate,
|
|
42
68
|
projectList,
|
|
43
69
|
projectShow,
|
|
@@ -50,6 +76,7 @@ import {
|
|
|
50
76
|
resolveConfig,
|
|
51
77
|
search,
|
|
52
78
|
show,
|
|
79
|
+
skillsList,
|
|
53
80
|
stateAdd,
|
|
54
81
|
stateDelete,
|
|
55
82
|
stateOrder,
|
|
@@ -59,11 +86,13 @@ import {
|
|
|
59
86
|
teamList,
|
|
60
87
|
teamRename,
|
|
61
88
|
teamSetDefault,
|
|
89
|
+
toolsList,
|
|
90
|
+
toolsSearch,
|
|
62
91
|
update,
|
|
63
92
|
upload,
|
|
64
93
|
userList,
|
|
65
94
|
workflowStates
|
|
66
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-I2S2JVCQ.js";
|
|
67
96
|
|
|
68
97
|
// src/mcp/server.ts
|
|
69
98
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -86,8 +115,11 @@ function toolError(message) {
|
|
|
86
115
|
return { content: [{ type: "text", text: message }], isError: true };
|
|
87
116
|
}
|
|
88
117
|
async function run(work) {
|
|
118
|
+
let token = "";
|
|
89
119
|
try {
|
|
90
|
-
const
|
|
120
|
+
const ctx = context();
|
|
121
|
+
token = ctx.config.token;
|
|
122
|
+
const output = await work(ctx);
|
|
91
123
|
const content = [{ type: "text", text: JSON.stringify(output.json) }];
|
|
92
124
|
if (output.notice !== void 0 && output.notice !== "") {
|
|
93
125
|
content.push({ type: "text", text: output.notice.trimEnd() });
|
|
@@ -97,9 +129,12 @@ async function run(work) {
|
|
|
97
129
|
return { content, isError: true };
|
|
98
130
|
}
|
|
99
131
|
return { content };
|
|
100
|
-
} catch (
|
|
132
|
+
} catch (caught) {
|
|
133
|
+
const error = explainExpertRefusal(caught, token);
|
|
101
134
|
if (error instanceof NeedsLoginError) return toolError(error.message);
|
|
102
|
-
if (error instanceof HttpError)
|
|
135
|
+
if (error instanceof HttpError) {
|
|
136
|
+
return toolError(`${error.message} (HTTP ${error.status})${errorDetails(error.body)}`);
|
|
137
|
+
}
|
|
103
138
|
if (error instanceof TransportError) return toolError(`cannot reach the API: ${error.message}`);
|
|
104
139
|
if (error instanceof Error) return toolError(error.message);
|
|
105
140
|
throw error;
|
|
@@ -113,11 +148,179 @@ var page = {
|
|
|
113
148
|
var identifier = z.string().describe("issue identifier, e.g. IO-123");
|
|
114
149
|
var commentId = z.string().uuid().describe("comment UUID from issue_show or comment_list");
|
|
115
150
|
var dateField = z.string().optional().describe('YYYY-MM-DD; "" clears the date');
|
|
151
|
+
var planCondition = z.object({
|
|
152
|
+
kind: z.enum(CONDITION_KINDS).optional().describe("not_before, gate or event; optional with gate"),
|
|
153
|
+
not_before: z.string().optional().describe("not_before: an ISO 8601 UTC instant"),
|
|
154
|
+
gate: z.string().optional().describe("shorthand for kind gate with this key; the label defaults to it, e.g. finance-sign-off"),
|
|
155
|
+
key: z.string().optional().describe("gate: a stable lowercase slug (a-z, 0-9 and -), unique among the step's gates; gate_set takes it"),
|
|
156
|
+
label: z.string().optional().describe("gate: what a person ticks, e.g. Finance sign-off; defaults to the key"),
|
|
157
|
+
owner: z.string().nullable().optional().describe(
|
|
158
|
+
`gate: who ticks it. role:<role> (${GATE_OWNER_ROLES.join(", ")}), user:<id or email> (a member who can use Operator) or expert:<email> (an outside expert, never a member's email). Only the owner ticks an owned gate, and nobody names an owner they would hold themselves (owner_is_actor). null or absent: no owner`
|
|
159
|
+
),
|
|
160
|
+
event: z.string().optional().describe("event: deal_stage_changed, opportunity_stage_changed, form_submitted or investment_executed"),
|
|
161
|
+
subject_id: z.string().optional().describe("event: the record the event is about (one you can read)"),
|
|
162
|
+
target_id: z.string().optional().describe("event: the stage or status a stage change must reach")
|
|
163
|
+
}).passthrough();
|
|
164
|
+
var planIssueFields = {
|
|
165
|
+
title: z.string(),
|
|
166
|
+
description: z.string().optional().describe("an Operator step's description is its instruction (required for one)"),
|
|
167
|
+
design: z.string().optional(),
|
|
168
|
+
notes: z.string().optional(),
|
|
169
|
+
acceptance_criteria: z.string().optional(),
|
|
170
|
+
priority: z.number().int().optional().describe("0 none, 1 urgent, 2 high, 3 medium, 4 low"),
|
|
171
|
+
estimate: z.number().optional(),
|
|
172
|
+
due_date: z.string().optional().describe("YYYY-MM-DD"),
|
|
173
|
+
assignee: z.string().optional().describe("email or user id; never on an Operator step"),
|
|
174
|
+
label_ids: z.array(z.string()).optional()
|
|
175
|
+
};
|
|
176
|
+
var planStep = z.object({
|
|
177
|
+
...planIssueFields,
|
|
178
|
+
key: z.string().describe("unique in the plan; other steps refer to this step by it"),
|
|
179
|
+
parent: z.string().optional().describe("key of the step that contains this one; the root when absent"),
|
|
180
|
+
blocked_by: z.array(z.string()).optional().describe("keys of the steps this one waits for"),
|
|
181
|
+
executor: z.enum(PLAN_EXECUTORS).optional().describe("none (a person, the default) or operator"),
|
|
182
|
+
team: z.string().optional().describe("team key for a person's step; Operator steps go to the Operator team"),
|
|
183
|
+
conditions: z.array(planCondition).optional().describe("wait conditions: all must hold before the step is ready")
|
|
184
|
+
}).passthrough();
|
|
185
|
+
var planDocument = z.object({
|
|
186
|
+
...planIssueFields,
|
|
187
|
+
parent: z.string().optional().describe("an existing issue to file the root under, e.g. IO-12"),
|
|
188
|
+
retry_budget: z.number().int().min(0).optional().describe("retries per failed Operator step (default 2)"),
|
|
189
|
+
spend_budget_cents: z.number().int().min(0).nullable().optional().describe("needed to release a plan with Operator steps"),
|
|
190
|
+
steps: z.array(planStep).min(1).describe("at most 99 steps besides the root")
|
|
191
|
+
}).passthrough();
|
|
192
|
+
var planId = z.string().uuid().describe("plan UUID, from plan_create");
|
|
193
|
+
var planStepEdit = z.object({
|
|
194
|
+
step: z.string().optional().describe("the step's key; give this or issue"),
|
|
195
|
+
issue: z.string().optional().describe("the step's issue identifier; give this or step"),
|
|
196
|
+
executor: z.enum(PLAN_EXECUTORS).optional().describe("none hands the step to a person"),
|
|
197
|
+
key: z.string().nullable().optional().describe("the step's new key")
|
|
198
|
+
}).passthrough();
|
|
199
|
+
var idempotencyKey = z.string().min(1).max(MAX_IDEMPOTENCY_KEY_BYTES).regex(IDEMPOTENCY_KEY_FORMAT, "must use printable ASCII without leading or trailing spaces");
|
|
200
|
+
var OPERATOR_APPROVAL_NOTE = "Approval happens in the app: give a person the approval_url (pending_approval.url on job_show); no tool approves a change set. By reference only, never the objective's text.";
|
|
201
|
+
var OPERATOR_JOB_TOOLS = [
|
|
202
|
+
{
|
|
203
|
+
name: "jobs_list",
|
|
204
|
+
description: "List the Operator jobs the caller sees in the workbench, newest first: state, waiting_on (approval, person, reconciliation, verification or delivery), objective_kind, owner, plan step, window, and the workbench url and approval_url. " + OPERATOR_APPROVAL_NOTE + " Pages by cursor; all follows every page, and a second text item says when older jobs exist.",
|
|
205
|
+
readOnly: true,
|
|
206
|
+
shape: {
|
|
207
|
+
status: z.array(z.enum([...JOB_STATES, ...JOB_STATUS_ALIASES])).min(1).optional().describe("job states, or the aliases open (not done), waiting and done"),
|
|
208
|
+
mine: z.boolean().optional().describe("only jobs the caller owns"),
|
|
209
|
+
limit: z.number().int().min(1).max(JOBS_MAX_LIMIT).optional().describe("jobs per page (default 20)"),
|
|
210
|
+
all: z.boolean().optional().describe("follow every page")
|
|
211
|
+
},
|
|
212
|
+
handler: (ctx, args) => jobsList(ctx, {
|
|
213
|
+
status: args["status"] === void 0 ? void 0 : args["status"].join(","),
|
|
214
|
+
mine: args["mine"],
|
|
215
|
+
limit: args["limit"],
|
|
216
|
+
all: args["all"]
|
|
217
|
+
})
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
name: "job_show",
|
|
221
|
+
description: "One Operator job by reference: state and waiting_on, plan version, progress (stage, situation, needs_viewer), window (remaining and budget, in ms), spend in cents, blockers, pending_approval with its url, grant, verification status, effect counts, artifact links, pinned skill identity, people, saved procedures and viewer_can. " + OPERATOR_APPROVAL_NOTE + " Poll it to follow a job: it has ended when state is completed, failed or cancelled, and a person has to act exactly when waiting_on is set; a job paused with no waiting_on resumes by itself.",
|
|
222
|
+
readOnly: true,
|
|
223
|
+
shape: { id: z.string().uuid().describe("Operator job UUID, from jobs_list") },
|
|
224
|
+
handler: (ctx, args) => jobShow(ctx, args["id"])
|
|
225
|
+
}
|
|
226
|
+
];
|
|
227
|
+
var OPERATOR_CONTROL_NOTE = "Not idempotent: never retry it on your own; when an error says the outcome is unknown (a timeout, a dropped connection or a 5xx), read the job with job_show before trying again. Approving stays in the app: no tool approves a change set. Returns the job as job_show does, by reference only.";
|
|
228
|
+
var jobId = z.string().uuid().describe("Operator job UUID, from jobs_list");
|
|
229
|
+
var OPERATOR_CONTROL_TOOLS = [
|
|
230
|
+
{
|
|
231
|
+
name: "job_steer",
|
|
232
|
+
description: "Steer an Operator job as Steer does in the app: posts the instruction in the job's room, attributed to the caller. The job's owner and collaborators may steer, wherever the app offers it (not a finished, failed or awaiting-approval job). Work the instruction changes needs a fresh approval: earlier approvals stop applying to it. Steering a running job stops its current run so it can take the instruction. " + OPERATOR_CONTROL_NOTE,
|
|
233
|
+
readOnly: false,
|
|
234
|
+
idempotent: false,
|
|
235
|
+
shape: {
|
|
236
|
+
id: jobId,
|
|
237
|
+
instruction: z.string().min(1).describe(
|
|
238
|
+
`what to change, in plain language: 1 to ${STEER_MAX_CHARACTERS} characters once trimmed`
|
|
239
|
+
)
|
|
240
|
+
},
|
|
241
|
+
handler: (ctx, args) => jobSteer(ctx, args["id"], args["instruction"])
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
name: "job_cancel",
|
|
245
|
+
description: "Cancel an Operator job as Cancel does in the app; only the job's execution principal may. It cannot be undone, but committed effects stay committed: the job's effects still count them, and staged ones that never ran count as unknown. " + OPERATOR_CONTROL_NOTE,
|
|
246
|
+
readOnly: false,
|
|
247
|
+
destructive: true,
|
|
248
|
+
idempotent: false,
|
|
249
|
+
shape: { id: jobId },
|
|
250
|
+
handler: (ctx, args) => jobCancel(ctx, args["id"])
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
name: "job_pause",
|
|
254
|
+
description: "Pause a running Operator job as Pause does in the app; only the job's execution principal may. Holds it for a person without resetting its active-time budget; continuing it runs it again. " + OPERATOR_CONTROL_NOTE,
|
|
255
|
+
readOnly: false,
|
|
256
|
+
idempotent: false,
|
|
257
|
+
shape: { id: jobId },
|
|
258
|
+
handler: (ctx, args) => jobPause(ctx, args["id"])
|
|
259
|
+
}
|
|
260
|
+
];
|
|
261
|
+
var NOT_IDEMPOTENT = 'Not idempotent: never retry it automatically, not after a timeout or a 5xx either. An "Outcome unknown" error may have landed and says what to check before calling again; only "cannot reach the API" means the request never reached the server, so nothing changed.';
|
|
262
|
+
var OPERATOR_LIFECYCLE_TOOLS = [
|
|
263
|
+
{
|
|
264
|
+
name: "job_continue",
|
|
265
|
+
description: "Continue an Operator job, as Continue does in the app: opens a new audited window for a job that ran out of time or waits on a person, or retries a failed run or verification. Only the job's execution principal may. Returns the job as job_show does. Approval still happens in the app, at its approval_url. " + NOT_IDEMPOTENT,
|
|
266
|
+
readOnly: false,
|
|
267
|
+
destructive: false,
|
|
268
|
+
idempotent: false,
|
|
269
|
+
shape: { id: z.string().uuid().describe("Operator job UUID, from jobs_list") },
|
|
270
|
+
handler: (ctx, args) => jobContinue(ctx, args["id"])
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
name: "job_changes",
|
|
274
|
+
description: "An Operator job's latest change set by reference: its manifest id, version, status, digest, plan version, maximum effect count, and each action's type, version, order, effect count, required capability ids and digest; never values or targets. change_set is null while the job has proposed nothing. Beside it, the job's state, waiting_on, workbench url and approval_url: review and approve in the app, at that link.",
|
|
275
|
+
readOnly: true,
|
|
276
|
+
shape: { id: z.string().uuid().describe("Operator job UUID, from jobs_list") },
|
|
277
|
+
handler: (ctx, args) => jobShow(ctx, args["id"], { changes: true })
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
name: "procedure_save",
|
|
281
|
+
description: "Save a completed Operator job whose work was verified as a versioned procedure, as Save procedure does in the app. Only the job's owner can. Returns the procedure as procedure_show does, or only its id and url when it can't be read back. Saving again saves another procedure. " + NOT_IDEMPOTENT,
|
|
282
|
+
readOnly: false,
|
|
283
|
+
destructive: false,
|
|
284
|
+
idempotent: false,
|
|
285
|
+
shape: {
|
|
286
|
+
job_id: z.string().uuid().describe("Operator job UUID, from jobs_list"),
|
|
287
|
+
name: z.string().trim().min(1).describe("the procedure's name; trimmed and cut to 200 characters")
|
|
288
|
+
},
|
|
289
|
+
handler: (ctx, args) => procedureSave(ctx, args["job_id"], args["name"])
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
name: "procedure_show",
|
|
293
|
+
description: "One saved Operator procedure: its name, source job_id and job_url (the app), current_version, each version's recipe_digest, capability_ids and action_roster, and the parameter_schema a run of the current version takes (scoped_inputs.required naming contact_reconciliation means a run needs group_id and source_resource_id). Never a version's recipe or anything the saved job read.",
|
|
294
|
+
readOnly: true,
|
|
295
|
+
shape: { id: z.string().uuid().describe("Operator procedure UUID, from job_show's procedures") },
|
|
296
|
+
handler: (ctx, args) => procedureShow(ctx, args["id"])
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
name: "procedure_run",
|
|
300
|
+
description: "Run a saved Operator procedure as a new job, as Rerun does in the app: fresh inputs, the caller's own current rights, and a change set that needs its own approval in the app. Nothing of the saved job carries over. Returns the new job as job_show does, or only its id and url when it can't be read back; give a person its approval_url. " + NOT_IDEMPOTENT,
|
|
301
|
+
readOnly: false,
|
|
302
|
+
destructive: false,
|
|
303
|
+
idempotent: false,
|
|
304
|
+
shape: {
|
|
305
|
+
id: z.string().uuid().describe("Operator procedure UUID"),
|
|
306
|
+
version: z.number().int().min(1).optional().describe("the version expected to be current; the run is refused if it no longer is (default: the current one)"),
|
|
307
|
+
parameters: z.record(z.unknown()).optional().describe("values for the procedure's parameter_schema (procedure_show), default {}"),
|
|
308
|
+
group_id: z.string().min(1).optional().describe("the contact group to reconcile, when scoped_inputs require it"),
|
|
309
|
+
source_resource_id: z.string().min(1).optional().describe("the uploaded file to reconcile against, when scoped_inputs require it")
|
|
310
|
+
},
|
|
311
|
+
handler: (ctx, args) => procedureRun(ctx, args["id"], {
|
|
312
|
+
version: args["version"],
|
|
313
|
+
parameters: args["parameters"],
|
|
314
|
+
group: args["group_id"],
|
|
315
|
+
source: args["source_resource_id"]
|
|
316
|
+
})
|
|
317
|
+
}
|
|
318
|
+
];
|
|
116
319
|
var TOOLS = [
|
|
117
320
|
// ── Issues ──
|
|
118
321
|
{
|
|
119
322
|
name: "issue_list",
|
|
120
|
-
description: "List issues with filters. ready=true \u2192 unblocked open issues; blocked=true \u2192 issues waiting on a blocker.",
|
|
323
|
+
description: "List issues with filters. ready=true \u2192 unblocked open issues, each with agent_step (true when it is filed in the Operator team, where plan steps Operator runs live: only the plan driver claims those, and a claim refusal is the authority); blocked=true \u2192 issues waiting on a blocker.",
|
|
121
324
|
readOnly: true,
|
|
122
325
|
shape: {
|
|
123
326
|
...page,
|
|
@@ -160,14 +363,14 @@ var TOOLS = [
|
|
|
160
363
|
},
|
|
161
364
|
{
|
|
162
365
|
name: "issue_show",
|
|
163
|
-
description: "Full issue detail: fields, relations, children, comments. images=true downloads attached images to the local cache and includes their paths as local_images.",
|
|
366
|
+
description: "Full issue detail: fields, relations, children, comments. blockers gives each unresolved blocker's state_type and archived flag: only a completed blocker resolves, so a cancelled or archived one still blocks. waiting_on_condition and conditions say which wait conditions (not_before, gate, event) still hold it; tick a gate with gate_set. images=true downloads attached images to the local cache and includes their paths as local_images.",
|
|
164
367
|
readOnly: true,
|
|
165
368
|
shape: { id: identifier, images: z.boolean().optional() },
|
|
166
369
|
handler: (ctx, args) => show(ctx, args["id"], { images: args["images"] === true })
|
|
167
370
|
},
|
|
168
371
|
{
|
|
169
372
|
name: "activity_list",
|
|
170
|
-
description: "Mixed issue activity: comments, creation, state and assignee changes. Returns the newest page unless all=true.",
|
|
373
|
+
description: "Mixed issue activity: comments, creation, state and assignee changes, wait-condition events, and field changes (priority, labels, parent, title, description, archived) with from/to values. actor_label, when set, is the agent or CLI label a write was made under. Returns the newest page unless all=true.",
|
|
171
374
|
readOnly: true,
|
|
172
375
|
shape: {
|
|
173
376
|
id: identifier,
|
|
@@ -193,7 +396,7 @@ var TOOLS = [
|
|
|
193
396
|
parent: z.string().optional(),
|
|
194
397
|
assignee: z.string().optional(),
|
|
195
398
|
labels: z.array(z.string()).optional(),
|
|
196
|
-
idempotency_key:
|
|
399
|
+
idempotency_key: idempotencyKey.optional().describe("reuse the same printable-ASCII key when deliberately retrying this create")
|
|
197
400
|
},
|
|
198
401
|
handler: (ctx, args) => create(ctx, {
|
|
199
402
|
...args,
|
|
@@ -234,14 +437,14 @@ var TOOLS = [
|
|
|
234
437
|
},
|
|
235
438
|
{
|
|
236
439
|
name: "issue_claim",
|
|
237
|
-
description: "Atomically claim an issue: assigns it and moves it to the team's first started state. A conflict
|
|
440
|
+
description: "Atomically claim an issue: assigns it and moves it to the team's first started state. A conflict names its reason: someone else holds it, or it is not claimable (e.g. agent_step, waiting_on_condition).",
|
|
238
441
|
readOnly: false,
|
|
239
442
|
shape: { id: identifier },
|
|
240
443
|
handler: (ctx, args) => update(ctx, args["id"], { claim: true })
|
|
241
444
|
},
|
|
242
445
|
{
|
|
243
446
|
name: "issue_close",
|
|
244
|
-
description: "Close issues. Set duplicate_of for one source issue to close it as a duplicate; it cannot be combined with cancel. The result lists newly unblocked issues \u2014 surface them.",
|
|
447
|
+
description: "Close issues. Set duplicate_of for one source issue to close it as a duplicate; it cannot be combined with cancel. The result lists newly unblocked issues \u2014 surface them. still_blocking lists the dependents a cancelled or duplicate-closed issue still blocks: only completing releases them.",
|
|
245
448
|
readOnly: false,
|
|
246
449
|
shape: {
|
|
247
450
|
ids: z.array(identifier).min(1),
|
|
@@ -665,6 +868,94 @@ var TOOLS = [
|
|
|
665
868
|
shape: {},
|
|
666
869
|
handler: (ctx) => stats(ctx)
|
|
667
870
|
},
|
|
871
|
+
// ── Plans and gates ──
|
|
872
|
+
{
|
|
873
|
+
name: "plan_create",
|
|
874
|
+
description: "Create a plan: a root issue and up to 99 steps, created in one transaction or not at all, and held until a person releases it (plan_release). Steps refer to each other by key: parent (containment) and blocked_by (dependencies). executor operator files a step in the organization's Operator team, where only the plan driver claims it; a person's step goes to its team (or the plan's). conditions are wait conditions (not_before, gate, event); a gate may carry a key (gate: <key> is shorthand) and an owner, who alone ticks it. An invalid plan writes nothing and the error lists every violation by step key. Reuse idempotency_key when retrying.",
|
|
875
|
+
readOnly: false,
|
|
876
|
+
shape: {
|
|
877
|
+
team: z.string().optional().describe("team key for the root and people's steps; defaults to HARNESS_TEAM"),
|
|
878
|
+
plan: planDocument.describe("the root's fields plus steps"),
|
|
879
|
+
idempotency_key: idempotencyKey.optional().describe("reuse the same printable-ASCII key when deliberately retrying this create")
|
|
880
|
+
},
|
|
881
|
+
handler: (ctx, args) => planCreate(ctx, args["plan"], { team: args["team"], idempotencyKey: args["idempotency_key"] })
|
|
882
|
+
},
|
|
883
|
+
{
|
|
884
|
+
name: "plan_show",
|
|
885
|
+
description: "A plan's status, budgets, current revision and spend estimate, and its whole tree root first: each step's key, executor, parent, state, ready flag, held flag (edited since release), in_revision, wait conditions (a gate's key and owner) and waiting_for (each open gate's owner and holders, the people who can tick it: [] when nobody can, null when unowned or not known), plus the blocks edges between steps.",
|
|
886
|
+
readOnly: true,
|
|
887
|
+
shape: { id: planId },
|
|
888
|
+
handler: (ctx, args) => planShow(ctx, args["id"])
|
|
889
|
+
},
|
|
890
|
+
{
|
|
891
|
+
name: "plan_edit",
|
|
892
|
+
description: "Change step executors and keys (each step named by its key or issue identifier) and the plan's budgets. Editing a released step holds it until the plan is released again; a budget edit needs the plan held. Descriptions, parents and edges are edited with issue_update and relation_add/relation_rm; conditions are set at plan_create, and gate_set ticks a gate.",
|
|
893
|
+
readOnly: false,
|
|
894
|
+
shape: {
|
|
895
|
+
id: planId,
|
|
896
|
+
steps: z.array(planStepEdit).optional(),
|
|
897
|
+
retry_budget: z.number().int().min(0).optional(),
|
|
898
|
+
spend_budget_cents: z.number().int().min(0).nullable().optional().describe("null clears the budget")
|
|
899
|
+
},
|
|
900
|
+
handler: (ctx, args) => {
|
|
901
|
+
const { id, ...edits } = args;
|
|
902
|
+
return planEdit(ctx, id, edits);
|
|
903
|
+
}
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
name: "plan_release",
|
|
907
|
+
description: "Release a held plan (or one that needs attention) as the caller: freezes its next revision and lets its ready steps run. A plan with Operator steps needs a spend budget and the caller's right to run Operator; collaborators join its plan room.",
|
|
908
|
+
readOnly: false,
|
|
909
|
+
shape: {
|
|
910
|
+
id: planId,
|
|
911
|
+
collaborators: z.array(z.string()).max(20).optional().describe("people of this organization, by id or email"),
|
|
912
|
+
retry_budget: z.number().int().min(0).optional(),
|
|
913
|
+
spend_budget_cents: z.number().int().min(0).nullable().optional().describe("null clears the budget")
|
|
914
|
+
},
|
|
915
|
+
handler: (ctx, args) => planRelease(ctx, args["id"], {
|
|
916
|
+
collaborators: args["collaborators"],
|
|
917
|
+
retryBudget: args["retry_budget"],
|
|
918
|
+
spendBudgetCents: args["spend_budget_cents"]
|
|
919
|
+
})
|
|
920
|
+
},
|
|
921
|
+
{
|
|
922
|
+
name: "plan_hold",
|
|
923
|
+
description: "Pause every step of a plan: none is ready until it is released again.",
|
|
924
|
+
readOnly: false,
|
|
925
|
+
shape: { id: planId },
|
|
926
|
+
handler: (ctx, args) => planHold(ctx, args["id"])
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
name: "gate_set",
|
|
930
|
+
description: "Satisfy (satisfied true) or un-satisfy (false) a gate wait condition on an issue, found by its key, label or condition id (condition_list and issue_show list conditions). Needs staff standing in the organization or a place in its plan's room; only an owned gate's owner ticks it, and its owner or staff untick it. Anyone else gets a 403 naming the owner. An outside expert's pxc_ credential ticks the gates it owns on a step assigned to it (assignment_list); any other step is 404.",
|
|
931
|
+
readOnly: false,
|
|
932
|
+
shape: {
|
|
933
|
+
issue: identifier,
|
|
934
|
+
gate: z.string().describe("the gate's key, its label, or its condition id"),
|
|
935
|
+
satisfied: z.boolean()
|
|
936
|
+
},
|
|
937
|
+
handler: (ctx, args) => gateSet(ctx, args["issue"], args["gate"], args["satisfied"])
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
name: "condition_list",
|
|
941
|
+
description: "An issue's wait conditions (not_before, gate, event), oldest first: each one's id, kind, a gate's key, label and owner, and whether, when and by whom it was satisfied. gate_set ticks a gate. With an outside expert's pxc_ credential: only the gates it owns on a step assigned to it, in the expert view (owner as {kind, role}, satisfied_by as {kind: you|role|expert|member}); any other step is 404.",
|
|
942
|
+
readOnly: true,
|
|
943
|
+
shape: { issue: identifier },
|
|
944
|
+
handler: (ctx, args) => conditionList(ctx, args["issue"])
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
name: "assignment_list",
|
|
948
|
+
description: "An outside expert's own assignments, for their pxc_ credential: expert ({id, role}), plan ({id, status} or null), and assignments, each step assigned to them with its identifier, title, state, due_date, description (null when Operator runs the step), open_blockers (a count) and the gates on it they own. gate_set ticks one. A pxc_ credential reaches only this, condition_list and gate_set: every other tool is refused as expert_bound_credential. Any other credential is refused as expert_credential_required.",
|
|
949
|
+
readOnly: true,
|
|
950
|
+
shape: {},
|
|
951
|
+
handler: (ctx) => assignments(ctx)
|
|
952
|
+
},
|
|
953
|
+
// ── Operator jobs (CLI-43) ──
|
|
954
|
+
...OPERATOR_JOB_TOOLS,
|
|
955
|
+
// ── Operator job controls (CLI-46) ──
|
|
956
|
+
...OPERATOR_CONTROL_TOOLS,
|
|
957
|
+
// ── Operator job lifecycle (CLI-47) ──
|
|
958
|
+
...OPERATOR_LIFECYCLE_TOOLS,
|
|
668
959
|
// ── Uploads ──
|
|
669
960
|
{
|
|
670
961
|
name: "upload",
|
|
@@ -672,25 +963,52 @@ var TOOLS = [
|
|
|
672
963
|
readOnly: false,
|
|
673
964
|
shape: { path: z.string().describe("local file path") },
|
|
674
965
|
handler: (ctx, args) => upload(ctx, args["path"])
|
|
966
|
+
},
|
|
967
|
+
// ── Operator's catalog (CLI-44) ──
|
|
968
|
+
{
|
|
969
|
+
name: "tools_search",
|
|
970
|
+
description: "Browse or search what Operator can use now in this organization: only capabilities that are switched on appear. Without query, the index in id order (25 a page); with query, a keyword search ranked by score (15 a page). domain narrows either to one domain. Each capability carries its domain, summary, description, mode, effect and kind: read, write, or send (a write delivered beyond the platform). Write and send capabilities, and any proposal, always need a person's approval in the app before they take effect; nothing here runs or approves anything. A page that isn't the last comes with a notice naming the next cursor; all=true follows every page.",
|
|
971
|
+
readOnly: true,
|
|
972
|
+
shape: {
|
|
973
|
+
query: z.string().optional().describe("search terms, at most 200 bytes; omit to browse the index"),
|
|
974
|
+
domain: z.string().optional().describe("only this capability domain, e.g. crm"),
|
|
975
|
+
cursor: z.string().optional().describe("the next page's cursor, from the previous call's notice"),
|
|
976
|
+
all: z.boolean().optional().describe("follow every page")
|
|
977
|
+
},
|
|
978
|
+
handler: (ctx, args) => {
|
|
979
|
+
const opts = { domain: args["domain"], cursor: args["cursor"], all: args["all"] };
|
|
980
|
+
return args["query"] === void 0 ? toolsList(ctx, opts) : toolsSearch(ctx, args["query"], opts);
|
|
981
|
+
}
|
|
982
|
+
},
|
|
983
|
+
{
|
|
984
|
+
name: "skills_list",
|
|
985
|
+
description: "The organization's skills assigned to Operator, in title order: each skill's id, title, invocation_name and content_sha256. A skill's content and description are never exposed.",
|
|
986
|
+
readOnly: true,
|
|
987
|
+
shape: {},
|
|
988
|
+
handler: (ctx) => skillsList(ctx)
|
|
675
989
|
}
|
|
676
990
|
];
|
|
677
|
-
function buildServer() {
|
|
678
|
-
const server = new McpServer({ name
|
|
991
|
+
function buildServer(name = "harness") {
|
|
992
|
+
const server = new McpServer({ name, version: CLI_VERSION });
|
|
679
993
|
for (const tool of TOOLS) {
|
|
680
994
|
server.registerTool(
|
|
681
995
|
tool.name,
|
|
682
996
|
{
|
|
683
997
|
description: tool.description,
|
|
684
998
|
inputSchema: tool.shape,
|
|
685
|
-
annotations: {
|
|
999
|
+
annotations: {
|
|
1000
|
+
readOnlyHint: tool.readOnly,
|
|
1001
|
+
...tool.destructive === void 0 ? {} : { destructiveHint: tool.destructive },
|
|
1002
|
+
...tool.idempotent === void 0 ? {} : { idempotentHint: tool.idempotent }
|
|
1003
|
+
}
|
|
686
1004
|
},
|
|
687
1005
|
((args) => run((ctx) => tool.handler(ctx, args)))
|
|
688
1006
|
);
|
|
689
1007
|
}
|
|
690
1008
|
return server;
|
|
691
1009
|
}
|
|
692
|
-
async function startMcpServer() {
|
|
693
|
-
const server = buildServer();
|
|
1010
|
+
async function startMcpServer(name = "harness") {
|
|
1011
|
+
const server = buildServer(name);
|
|
694
1012
|
await server.connect(new StdioServerTransport());
|
|
695
1013
|
}
|
|
696
1014
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allocator-one/harness-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "CLI and MCP server for Harness, allocator.one's issue tracker",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"typecheck": "tsc --noEmit",
|
|
27
27
|
"pretest": "npm run build",
|
|
28
28
|
"test": "vitest run",
|
|
29
|
+
"package:operator": "node scripts/operator-package.mjs ./build/operator",
|
|
29
30
|
"codegen": "openapi-typescript spec/openapi.json -o src/generated/api.ts",
|
|
30
31
|
"spec:refresh": "node scripts/spec-refresh.mjs",
|
|
31
32
|
"prepublishOnly": "npm run build"
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
"dependencies": {
|
|
34
35
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
35
36
|
"commander": "^14.0.0",
|
|
37
|
+
"yaml": "^2.9.1",
|
|
36
38
|
"zod": "^3.25.76"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|