@ouro.bot/cli 0.1.0-alpha.1556 → 0.1.0-alpha.1558
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/changelog.json +12 -0
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/desk.lock.json +3 -3
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/vendor/desk/.claude-plugin/plugin.json +1 -1
- package/vendor/desk/.ouro-desk.json +3 -3
- package/vendor/desk/CHANGELOG.md +640 -0
- package/vendor/desk/activation/copilot-root.flattened-bundle.json +2 -2
- package/vendor/desk/activation/desk.activation.json +5 -5
- package/vendor/desk/agency.json +1 -1
- package/vendor/desk/docs/issue-drains.md +8 -6
- package/vendor/desk/docs/sessions.md +1 -1
- package/vendor/desk/hooks/lib/boot-checks.cjs +1 -1
- package/vendor/desk/hooks/lib/child-agent.cjs +2 -2
- package/vendor/desk/hooks/lib/factory-end.cjs +4 -1
- package/vendor/desk/mcp/README.md +9 -1
- package/vendor/desk/mcp/bootstrap.cjs +64 -38
- package/vendor/desk/mcp/idle-proxy.cjs +14 -6
- package/vendor/desk/mcp/scripts/crew.js +3 -3
- package/vendor/desk/mcp/scripts/drains-launcher.mjs +6 -5
- package/vendor/desk/mcp/scripts/factory.js +15 -6
- package/vendor/desk/mcp/scripts/local-recovery.js +89 -7
- package/vendor/desk/mcp/scripts/resolve-desk-root.js +1 -2
- package/vendor/desk/mcp/src/actions/desk-session.actions.mts +16 -1
- package/vendor/desk/mcp/src/actions/desk.actions.mts +2 -2
- package/vendor/desk/mcp/src/actions/generated/desk/actions.json +36 -1
- package/vendor/desk/mcp/src/actions/generated/desk/mcp.json +34 -1
- package/vendor/desk/mcp/src/activation/superpowers-context.js +9 -0
- package/vendor/desk/mcp/src/crew/workspace.js +30 -4
- package/vendor/desk/mcp/src/desk/card-commit-guard.js +3 -2
- package/vendor/desk/mcp/src/desk/content-home.js +16 -0
- package/vendor/desk/mcp/src/indexer/discover.js +8 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/ax-claims.ts +2 -1
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/ax-command.ts +20 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/mcp.ts +1 -1
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/xray.ts +40 -2
- package/vendor/desk/mcp/src/runtime/boot.js +0 -1
- package/vendor/desk/mcp/src/runtime/deliver.js +42 -5
- package/vendor/desk/mcp/src/runtime/drains-cli.js +9 -1
- package/vendor/desk/mcp/src/runtime/drains.js +479 -40
- package/vendor/desk/mcp/src/runtime/hosted.js +5 -3
- package/vendor/desk/mcp/src/runtime/pending-migrations.js +5 -1
- package/vendor/desk/mcp/src/runtime/pr-publication.js +55 -29
- package/vendor/desk/mcp/src/runtime/relays.js +10 -1
- package/vendor/desk/mcp/src/runtime/remote-identity.js +22 -0
- package/vendor/desk/mcp/src/runtime/sessions-cli.js +6 -6
- package/vendor/desk/mcp/src/runtime/sync-worker.js +10 -8
- package/vendor/desk/mcp/src/runtime/unmerged-saves.js +29 -3
- package/vendor/desk/mcp/src/server.js +3 -2
- package/vendor/desk/mcp/src/tool-names.js +0 -2
- package/vendor/desk/mcp/src/tool-schemas.js +3 -8
- package/vendor/desk/mcp/src/tools/archive-links.js +3 -0
- package/vendor/desk/mcp/src/tools/desk-save.js +8 -3
- package/vendor/desk/mcp/src/tools/move.js +32 -3
- package/vendor/desk/mcp/src/tools/sibling-desk.js +10 -4
- package/vendor/desk/mcp/src/tools/status.js +9 -6
- package/vendor/desk/mcp/src/tools/task-log.js +6 -2
- package/vendor/desk/mcp/src/tools/task.js +17 -5
- package/vendor/desk/mcp/src/util/citations.js +54 -0
- package/vendor/desk/mcp/web-auth.cjs +17 -0
- package/vendor/desk/mcp/web-sso.cjs +52 -0
- package/vendor/desk/plugin.json +2 -2
- package/vendor/desk/skills/add-workspace-mcp/SKILL.md +2 -2
- package/vendor/desk/skills/archive-workflow/SKILL.md +1 -1
- package/vendor/desk/skills/coordinating-lanes/SKILL.md +24 -0
- package/vendor/desk/skills/evidence-discipline/SKILL.md +8 -12
- package/vendor/desk/skills/git-hygiene/SKILL.md +6 -0
- package/vendor/desk/skills/interaction-style/SKILL.md +4 -2
- package/vendor/desk/skills/live-ui-iteration/SKILL.md +35 -0
- package/vendor/desk/skills/operator-voice-comments/SKILL.md +4 -0
- package/vendor/desk/skills/outside-approval/SKILL.md +10 -0
- package/vendor/desk/skills/pr-feedback-on-own-pr/SKILL.md +5 -1
- package/vendor/desk/skills/pr-reviewer-audit/SKILL.md +1 -1
- package/vendor/desk/skills/pr-reviewer-audit/helpers/audit.py +19 -1
- package/vendor/desk/skills/pr-reviewer-audit/helpers/test_audit.py +37 -1
- package/vendor/desk/skills/pr-self-review/SKILL.md +1 -1
- package/vendor/desk/skills/pr-surface-hygiene/SKILL.md +28 -4
- package/vendor/desk/skills/pr-surface-hygiene/check-visual-proof.cjs +27 -14
- package/vendor/desk/skills/prior-art/SKILL.md +14 -0
- package/vendor/desk/skills/runtime-symptom-investigation/SKILL.md +5 -1
- package/vendor/desk/skills/session-resumption/SKILL.md +3 -1
- package/vendor/desk/skills/using-desk/SKILL.md +3 -3
- package/vendor/desk/skills/using-superpowers-with-desk/SKILL.md +2 -0
- package/vendor/desk/skills/visual-proof/SKILL.md +42 -0
- package/vendor/desk/skills/work-orchestration/SKILL.md +17 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { spawn, spawnSync } from "node:child_process"
|
|
4
|
-
import { realpathSync, statSync, promises as fs } from "node:fs"
|
|
4
|
+
import { closeSync, constants, fstatSync, lstatSync, openSync, realpathSync, statSync, promises as fs } from "node:fs"
|
|
5
5
|
import * as path from "node:path"
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from "node:url"
|
|
7
7
|
import { resolveStartupStateBranch } from "../src/runtime/startup-resolve.js"
|
|
@@ -191,6 +191,64 @@ function gitHead(root, env) {
|
|
|
191
191
|
return result.status === 0 ? result.stdout.trim() : null
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
+
// The qualified namespace of one log: the root and every directory below it down to the leaf, each by exact (dev, ino). Any symbolic link, non-directory parent or non-regular leaf, and a root that is not its own real path, disqualifies it.
|
|
195
|
+
function qualifyLog(root, rel) {
|
|
196
|
+
try {
|
|
197
|
+
if (realpathSync(root) !== path.resolve(root)) return null
|
|
198
|
+
const identity = (stat) => ({ dev: stat.dev, ino: stat.ino })
|
|
199
|
+
const chain = []
|
|
200
|
+
let current = path.resolve(root)
|
|
201
|
+
const parts = rel.split(/[\\/]/u)
|
|
202
|
+
for (const [index, part] of [null, ...parts].entries()) {
|
|
203
|
+
if (part !== null) current = path.join(current, part)
|
|
204
|
+
const stat = lstatSync(current, { bigint: true })
|
|
205
|
+
const last = index === parts.length
|
|
206
|
+
if (stat.isSymbolicLink() || (last ? !stat.isFile() : !stat.isDirectory())) return null
|
|
207
|
+
chain.push(identity(stat))
|
|
208
|
+
}
|
|
209
|
+
return { file: current, chain }
|
|
210
|
+
} catch { return null }
|
|
211
|
+
}
|
|
212
|
+
const sameChain = (a, b) => a.chain.length === b.chain.length && a.chain.every((entry, i) => entry.dev === b.chain[i].dev && entry.ino === b.chain[i].ino)
|
|
213
|
+
|
|
214
|
+
// A queued log is already in the working tree. It counts as committed only when the working file, hashed with the path's own Git filters (EOL included), is the very blob `head` holds at that path. Status flags such as assume-unchanged cannot hide a difference from that comparison, and every path is literal. A path Git neither tracks at `head` nor lists as indexed or untracked (missing, ignored) stays unknown; that listing reads names only, never the file's bytes, and runs only through a qualified namespace.
|
|
215
|
+
// Acquisition: the qualified namespace is walked, the leaf opened with O_NOFOLLOW, and the descriptor must be the walked leaf (exact bigint dev/ino) and the walk must repeat unchanged BEFORE Git is handed the descriptor, and again after. Git then reads that descriptor; `--path` only supplies the logical attribute/filter context. This pins what is hashed to the object the qualified path named; it does not keep the namespace unchanged while reading, and Node has no race-free openat. It observes content at `head`; it does not attribute who wrote it. `probe` is a test seam between the steps.
|
|
216
|
+
export function logCommitState(root, env, rel, head, probe = {}) {
|
|
217
|
+
if (typeof rel !== "string" || !rel || path.isAbsolute(rel) || rel.split(/[\\/]/u).includes("..") || !head) return "unknown"
|
|
218
|
+
const git = (args, stdio) => spawnSync("git", ["--literal-pathspecs", ...args], { cwd: root, env, encoding: "utf8", timeout: 5000, windowsHide: true, ...(stdio ? { stdio } : {}) })
|
|
219
|
+
const first = qualifyLog(root, rel)
|
|
220
|
+
const blob = git(["rev-parse", "--verify", `${head}:${rel}`])
|
|
221
|
+
if (blob.status !== 0) {
|
|
222
|
+
// Not at `head`: only the names Git lists (index entries, untracked non-ignored files) are consulted, never the file's bytes, and only through a namespace that qualified before and still does after.
|
|
223
|
+
if (first === null) return "unknown"
|
|
224
|
+
probe.afterWalk?.()
|
|
225
|
+
const listed = git(["ls-files", "--cached", "--others", "--exclude-standard", "--", rel])
|
|
226
|
+
const again = qualifyLog(root, rel)
|
|
227
|
+
return listed.status === 0 && listed.stdout.trim() !== "" && again !== null && sameChain(first, again) ? "pending" : "unknown"
|
|
228
|
+
}
|
|
229
|
+
if (first === null) return "unknown"
|
|
230
|
+
probe.afterWalk?.()
|
|
231
|
+
let fd
|
|
232
|
+
try {
|
|
233
|
+
fd = openSync(first.file, constants.O_RDONLY | constants.O_NONBLOCK | constants.O_NOFOLLOW)
|
|
234
|
+
const opened = fstatSync(fd, { bigint: true })
|
|
235
|
+
const leaf = first.chain.at(-1)
|
|
236
|
+
if (!opened.isFile() || opened.dev !== leaf.dev || opened.ino !== leaf.ino) return "unknown"
|
|
237
|
+
probe.afterOpen?.()
|
|
238
|
+
const again = qualifyLog(root, rel)
|
|
239
|
+
if (again === null || !sameChain(first, again)) return "unknown"
|
|
240
|
+
const working = git(["hash-object", `--path=${rel}`, "--stdin"], [fd, "pipe", "pipe"])
|
|
241
|
+
probe.afterHash?.()
|
|
242
|
+
const after = fstatSync(fd, { bigint: true })
|
|
243
|
+
const last = qualifyLog(root, rel)
|
|
244
|
+
if (working.status !== 0 || last === null || !sameChain(first, last)
|
|
245
|
+
|| after.size !== opened.size || after.mtimeNs !== opened.mtimeNs || after.ctimeNs !== opened.ctimeNs) return "unknown"
|
|
246
|
+
return working.stdout.trim() === blob.stdout.trim() ? "committed" : "pending"
|
|
247
|
+
} catch { return "unknown" } finally {
|
|
248
|
+
if (fd !== undefined) closeSync(fd)
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
194
252
|
/** One mutation at most, through the ordinary MCP bootstrap and admission. */
|
|
195
253
|
export async function runRecovery({
|
|
196
254
|
argv = process.argv.slice(2), options, env = process.env, cwd = process.cwd(),
|
|
@@ -309,26 +367,50 @@ export async function runRecovery({
|
|
|
309
367
|
const response = await client.request("tools/call", { name: report.operation, arguments: payload }, Math.min(Date.now() + dispatchTimeoutMs, totalDeadline))
|
|
310
368
|
const result = toolPayload(response)
|
|
311
369
|
report.result = redact(result, payload)
|
|
370
|
+
// Only an admitted queued log is accepted; a bare "logged" without it stays unexpected.
|
|
371
|
+
const queuedPath = result.status === "logged" && result.commit === "queued" ? result.path
|
|
372
|
+
: result.status === "updated" && result.log?.commit === "queued" ? result.log.path : null
|
|
312
373
|
report.git.headAfter = gitHead(root, env)
|
|
374
|
+
const logState = queuedPath === null ? null : logCommitState(root, env, queuedPath, report.git.headAfter)
|
|
313
375
|
if (response.isError || result.status === "error") throw failure("tool_error")
|
|
314
|
-
if (!["updated", "created", "archived", "already_archived", "committed", "nothing_to_commit", "commit_failed", "commit_unknown"].includes(result.status)) {
|
|
376
|
+
if (!["logged", "updated", "created", "archived", "already_archived", "committed", "nothing_to_commit", "commit_failed", "commit_unknown"].includes(result.status) || (result.status === "logged" && queuedPath === null)) {
|
|
315
377
|
throw failure("unexpected_tool_result")
|
|
316
378
|
}
|
|
317
379
|
report.effects.mutation = ["nothing_to_commit", "already_archived"].includes(result.status)
|
|
318
380
|
? "reported_complete" : "reported_applied"
|
|
319
|
-
report.
|
|
381
|
+
const headChanged = report.git.headBefore !== null && report.git.headAfter !== null && report.git.headBefore !== report.git.headAfter
|
|
382
|
+
const logOnly = result.status === "logged"
|
|
383
|
+
if (queuedPath !== null) {
|
|
384
|
+
report.effects.log = logState === "pending" ? "queued" : logState === "committed" && headChanged ? "observed" : "unknown"
|
|
385
|
+
report.queued = { path: queuedPath, state: logState, committer: options["publication"] === "deferred" ? "next_session_start" : "background_worker" }
|
|
386
|
+
}
|
|
387
|
+
report.effects.commit = logOnly ? report.effects.log
|
|
388
|
+
: result.commit?.status === "failed" ? "failed"
|
|
320
389
|
: result.commit?.status === "unknown" ? "unknown"
|
|
321
390
|
: report.git.headBefore !== null && report.git.headAfter !== null
|
|
322
391
|
? report.git.headBefore !== report.git.headAfter ? "observed" : "not_observed"
|
|
323
392
|
: "unknown"
|
|
324
393
|
report.effects.push = status.sync === "no remote configured" ? "not_applicable" : options["publication"] === "deferred" ? "deferred" : "pending"
|
|
325
|
-
const commitExpected = ["updated", "created", "archived", "committed"].includes(result.status)
|
|
326
|
-
|
|
327
|
-
|
|
394
|
+
const commitExpected = ["updated", "created", "archived", "committed"].includes(result.status) || (logOnly && logState === "committed")
|
|
395
|
+
const logPending = report.effects.log === "queued"
|
|
396
|
+
if (report.effects.log === "unknown") {
|
|
397
|
+
report.readback = `The entry at ${queuedPath} was reported written, but Git does not show it committed or pending. Do not resend it: that may duplicate the entry. Read that path first. ${report.readback}`
|
|
398
|
+
}
|
|
399
|
+
if (logPending) {
|
|
400
|
+
// --publication deferred schedules no background worker, so nothing in this run will commit the entry.
|
|
401
|
+
const who = report.queued.committer === "background_worker" ? "its commit is pending in Desk's background writer"
|
|
402
|
+
: "publication is deferred, so no background commit is scheduled: the next Desk session start commits it, or commit that path yourself"
|
|
403
|
+
report.readback = `Entry written to ${queuedPath}; ${who}. Do not resend it: that would duplicate the entry. ${report.readback}`
|
|
404
|
+
}
|
|
405
|
+
if (report.effects.commit === "failed" || result.commit?.status === "unknown" || report.effects.push === "pending" || logPending ||
|
|
406
|
+
report.effects.log === "unknown" || (commitExpected && report.effects.commit !== "observed")) {
|
|
328
407
|
report.status = "partial"
|
|
329
408
|
report.code = report.effects.commit === "failed" ? "commit_failed"
|
|
330
409
|
: result.commit?.status === "unknown" ? "commit_unknown"
|
|
331
|
-
: report.effects.
|
|
410
|
+
: commitExpected && report.effects.commit !== "observed" ? "commit_not_observed"
|
|
411
|
+
: logPending ? "commit_queued"
|
|
412
|
+
: report.effects.log === "unknown" ? "log_evidence_unknown"
|
|
413
|
+
: "push_pending"
|
|
332
414
|
exitCode = 2
|
|
333
415
|
} else {
|
|
334
416
|
report.status = "completed"
|
|
@@ -32,7 +32,7 @@ export function resolveHookDeskRoot({ env = process.env, cwd = process.cwd(), ho
|
|
|
32
32
|
})
|
|
33
33
|
return { root: resolved.root, source: resolved.source, binding_path: bindingPath }
|
|
34
34
|
} catch (error) {
|
|
35
|
-
return { root: null, source: null, binding_path: bindingPath, tried: error.tried ?? [], error: error.message }
|
|
35
|
+
return { root: null, source: null, binding_path: bindingPath, tried: error.tried ?? [], error: error.message, code: "desk-root-not-found" }
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -57,7 +57,6 @@ export async function main({ argv = process.argv.slice(2), env = process.env, wr
|
|
|
57
57
|
name: "resolve-desk-root",
|
|
58
58
|
summary: "Print the bound desk root as JSON, or the one line a flag asks for.",
|
|
59
59
|
effect: "private",
|
|
60
|
-
readOnly: true,
|
|
61
60
|
protocol: true,
|
|
62
61
|
output: "the root's JSON, or the one line a flag asks for",
|
|
63
62
|
flags: FLAGS,
|
|
@@ -2,7 +2,7 @@ import { defineAction, field } from "../lib/ouro-actions/ouro-actions.mts";
|
|
|
2
2
|
|
|
3
3
|
export const deskStatus = defineAction({
|
|
4
4
|
id: "desk_status",
|
|
5
|
-
consent: "
|
|
5
|
+
consent: "read",
|
|
6
6
|
label: "Desk status",
|
|
7
7
|
description: "Check that Desk is ready for this session.",
|
|
8
8
|
agent: "Session-start health check for the resolved desk root. The compact answer has `state` (ready, degraded, admitting or setup_required), `degraded` (why), `fix` (what to do in this session), `search`, `notes`, where the desk is and `machine_desks` (every desk registered on this machine, with path, owner and remote). Retries admission when Desk is not ready. `detail: true` returns the full payload. A hosted Desk (claude.ai, ChatGPT) also returns its instructions, unless `has_instructions: true`; follow them and read the skills they name with desk_skill.",
|
|
@@ -40,3 +40,18 @@ export const improvementNext = defineAction({
|
|
|
40
40
|
},
|
|
41
41
|
output: {},
|
|
42
42
|
});
|
|
43
|
+
|
|
44
|
+
export const taskFocus = defineAction({
|
|
45
|
+
id: "task_focus",
|
|
46
|
+
consent: "read",
|
|
47
|
+
label: "Task focus",
|
|
48
|
+
description: "Declare the task this session is working on.",
|
|
49
|
+
agent: "Declare the task this session is working on, so its time is credited to it. Pass `track` and `slug` of an existing card (live or archived), or `clear: true` for a side conversation. A subagent shares this session's server, so its call would move the main agent's focus: only the main agent calls it. Writes nothing: the focus is held in memory. Returns `task_status`, `recent_progress`, `next_step`, any `shelved_lessons` to read before you act, and `archive_due` for a done/cancelled card. `task_create` with `focus: true` does the same for a new task.",
|
|
50
|
+
input: {
|
|
51
|
+
track: field.string({ label: "Track", description: "The track folder of the task you are working on; give it with `slug`.", optional: true }),
|
|
52
|
+
slug: field.string({ label: "Slug", description: "The task folder name; give it with `track`.", optional: true }),
|
|
53
|
+
clear: field.boolean({ label: "Clear", description: "Pass true, alone, to declare no task: for a side conversation that belongs to none.", optional: true }),
|
|
54
|
+
displayLabel: field.string({ label: "Display label", description: "Optional short description of the focused task, at most 72 characters; never paths, URLs, emails or credentials. Unsafe labels are ignored.", optional: true, wire: "display_label" }),
|
|
55
|
+
},
|
|
56
|
+
output: {},
|
|
57
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineActions } from "../lib/ouro-actions/ouro-actions.mts";
|
|
2
2
|
import { deskSearch, deskRecall, deskSkill } from "./desk-read.actions.mts";
|
|
3
|
-
import { deskStatus, deskDoctor, improvementNext } from "./desk-session.actions.mts";
|
|
3
|
+
import { taskFocus, deskStatus, deskDoctor, improvementNext } from "./desk-session.actions.mts";
|
|
4
4
|
|
|
5
|
-
export default defineActions("desk", [deskSearch, deskRecall, deskSkill, deskStatus, deskDoctor, improvementNext], { tool: "desk" });
|
|
5
|
+
export default defineActions("desk", [deskSearch, deskRecall, deskSkill, deskStatus, deskDoctor, improvementNext, taskFocus], { tool: "desk" });
|
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
},
|
|
188
188
|
{
|
|
189
189
|
"id": "desk_status",
|
|
190
|
-
"consent": "
|
|
190
|
+
"consent": "read",
|
|
191
191
|
"label": "Desk status",
|
|
192
192
|
"description": "Check that Desk is ready for this session.",
|
|
193
193
|
"agent": "Session-start health check for the resolved desk root. The compact answer has `state` (ready, degraded, admitting or setup_required), `degraded` (why), `fix` (what to do in this session), `search`, `notes`, where the desk is and `machine_desks` (every desk registered on this machine, with path, owner and remote). Retries admission when Desk is not ready. `detail: true` returns the full payload. A hosted Desk (claude.ai, ChatGPT) also returns its instructions, unless `has_instructions: true`; follow them and read the skills they name with desk_skill.",
|
|
@@ -275,6 +275,41 @@
|
|
|
275
275
|
}
|
|
276
276
|
},
|
|
277
277
|
"output": {}
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"id": "task_focus",
|
|
281
|
+
"consent": "read",
|
|
282
|
+
"label": "Task focus",
|
|
283
|
+
"description": "Declare the task this session is working on.",
|
|
284
|
+
"agent": "Declare the task this session is working on, so its time is credited to it. Pass `track` and `slug` of an existing card (live or archived), or `clear: true` for a side conversation. A subagent shares this session's server, so its call would move the main agent's focus: only the main agent calls it. Writes nothing: the focus is held in memory. Returns `task_status`, `recent_progress`, `next_step`, any `shelved_lessons` to read before you act, and `archive_due` for a done/cancelled card. `task_create` with `focus: true` does the same for a new task.",
|
|
285
|
+
"input": {
|
|
286
|
+
"track": {
|
|
287
|
+
"label": "Track",
|
|
288
|
+
"description": "The track folder of the task you are working on; give it with `slug`.",
|
|
289
|
+
"optional": true,
|
|
290
|
+
"kind": "string"
|
|
291
|
+
},
|
|
292
|
+
"slug": {
|
|
293
|
+
"label": "Slug",
|
|
294
|
+
"description": "The task folder name; give it with `track`.",
|
|
295
|
+
"optional": true,
|
|
296
|
+
"kind": "string"
|
|
297
|
+
},
|
|
298
|
+
"clear": {
|
|
299
|
+
"label": "Clear",
|
|
300
|
+
"description": "Pass true, alone, to declare no task: for a side conversation that belongs to none.",
|
|
301
|
+
"optional": true,
|
|
302
|
+
"kind": "boolean"
|
|
303
|
+
},
|
|
304
|
+
"displayLabel": {
|
|
305
|
+
"label": "Display label",
|
|
306
|
+
"description": "Optional short description of the focused task, at most 72 characters; never paths, URLs, emails or credentials. Unsafe labels are ignored.",
|
|
307
|
+
"optional": true,
|
|
308
|
+
"wire": "display_label",
|
|
309
|
+
"kind": "string"
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
"output": {}
|
|
278
313
|
}
|
|
279
314
|
]
|
|
280
315
|
}
|
|
@@ -181,7 +181,7 @@
|
|
|
181
181
|
"additionalProperties": false
|
|
182
182
|
},
|
|
183
183
|
"annotations": {
|
|
184
|
-
"readOnlyHint":
|
|
184
|
+
"readOnlyHint": true,
|
|
185
185
|
"destructiveHint": false,
|
|
186
186
|
"openWorldHint": false
|
|
187
187
|
}
|
|
@@ -250,6 +250,39 @@
|
|
|
250
250
|
"destructiveHint": false,
|
|
251
251
|
"openWorldHint": false
|
|
252
252
|
}
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"name": "task_focus",
|
|
256
|
+
"title": "Task focus",
|
|
257
|
+
"description": "Declare the task this session is working on, so its time is credited to it. Pass `track` and `slug` of an existing card (live or archived), or `clear: true` for a side conversation. A subagent shares this session's server, so its call would move the main agent's focus: only the main agent calls it. Writes nothing: the focus is held in memory. Returns `task_status`, `recent_progress`, `next_step`, any `shelved_lessons` to read before you act, and `archive_due` for a done/cancelled card. `task_create` with `focus: true` does the same for a new task.",
|
|
258
|
+
"inputSchema": {
|
|
259
|
+
"type": "object",
|
|
260
|
+
"properties": {
|
|
261
|
+
"track": {
|
|
262
|
+
"type": "string",
|
|
263
|
+
"description": "The track folder of the task you are working on; give it with `slug`."
|
|
264
|
+
},
|
|
265
|
+
"slug": {
|
|
266
|
+
"type": "string",
|
|
267
|
+
"description": "The task folder name; give it with `track`."
|
|
268
|
+
},
|
|
269
|
+
"clear": {
|
|
270
|
+
"type": "boolean",
|
|
271
|
+
"description": "Pass true, alone, to declare no task: for a side conversation that belongs to none."
|
|
272
|
+
},
|
|
273
|
+
"display_label": {
|
|
274
|
+
"type": "string",
|
|
275
|
+
"description": "Optional short description of the focused task, at most 72 characters; never paths, URLs, emails or credentials. Unsafe labels are ignored."
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
"required": [],
|
|
279
|
+
"additionalProperties": false
|
|
280
|
+
},
|
|
281
|
+
"annotations": {
|
|
282
|
+
"readOnlyHint": true,
|
|
283
|
+
"destructiveHint": false,
|
|
284
|
+
"openWorldHint": false
|
|
285
|
+
}
|
|
253
286
|
}
|
|
254
287
|
],
|
|
255
288
|
"refusals": {}
|
|
@@ -74,6 +74,14 @@ export function reportRule(implementationReportPath, reviewReportPath) {
|
|
|
74
74
|
return `Return your report as text in your final reply; do not write it to a file, because some hosts refuse a subagent's file write. The coordinator saves your reply at ${implementationReportPath} (implementer) or ${reviewReportPath} (reviewer).`
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
// An orphaned pull request has no findable owner unless it names the session that opened it. The child reads its own id from its
|
|
78
|
+
// environment; the coordinator's id is written into the rule here, because the child cannot look it up.
|
|
79
|
+
export function sessionRule(env) {
|
|
80
|
+
const parent = (env.COPILOT_AGENT_SESSION_ID ?? env.AGENCY_SESSION_ID ?? "").replace(/[^\x21-\x7e]/gu, "")
|
|
81
|
+
const parentLine = parent === "" ? "" : ` and \`Desk-Parent-Session: ${parent}\``
|
|
82
|
+
return `Name yourself on every pull request you open: put \`Desk-Session: <your session id>\`${parentLine} on their own lines in the pull-request body, beside any Desk-Task line. Read your id from COPILOT_AGENT_SESSION_ID, else AGENCY_SESSION_ID; if neither is set, write \`Desk-Session: unknown\`. When you hand work to a child of your own, give it the same rule with your id as its parent.`
|
|
83
|
+
}
|
|
84
|
+
|
|
77
85
|
// Two children sharing one scratchpad both wrote pr-body.md and one published the other's text as a live pull request body.
|
|
78
86
|
export function scratchRule(name) {
|
|
79
87
|
return `Write scratch and pull-request bodies only under a folder named for your task, node and attempt (\`${name}\`, made under the session scratchpad or with mktemp), never at the scratchpad's root, and use a uniquely named body file there (\`${name}/pr-body-${name}.md\`); pass that exact path to \`gh pr create\` or \`gh pr edit\` with --body-file.`
|
|
@@ -210,6 +218,7 @@ export async function resolveSuperpowersContext(input) {
|
|
|
210
218
|
// work-orchestration's scratch sentence, verbatim: a reviewer dispatched from a review skill never reads that skill.
|
|
211
219
|
"Write down the exact path of everything you create when you create it. Delete only those paths, each by that exact path written out in full in the delete command, never through a shell variable or a command substitution; leave anything else in place and list it in your return.",
|
|
212
220
|
"on return list every created worktree and branch, its exact repository/path/ref, current state, owner and verified disposition in the mapped Resources record; close out only exact-owned safe resources through desk:git-hygiene",
|
|
221
|
+
sessionRule(process.env),
|
|
213
222
|
VISUAL_PROOF_RULE,
|
|
214
223
|
],
|
|
215
224
|
cleanupPaths: [],
|
|
@@ -684,6 +684,18 @@ async function landByPush({ git, base, write, message, created }) {
|
|
|
684
684
|
}
|
|
685
685
|
}
|
|
686
686
|
|
|
687
|
+
// Whether the default branch publishes only through pull requests: it carries a .desk/publication.json (one this
|
|
688
|
+
// reader cannot parse counts too, the safe side). A push to such a branch is refused by the team's own guard.
|
|
689
|
+
function pullRequestOnly(git, base) {
|
|
690
|
+
const read = git(["show", `origin/${base}:.desk/publication.json`])
|
|
691
|
+
if (!read.ok) return false
|
|
692
|
+
try {
|
|
693
|
+
return JSON.parse(read.stdout)?.mode === "pull-request"
|
|
694
|
+
} catch {
|
|
695
|
+
return true
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
|
|
687
699
|
const prView = async (hub, url) => ghJson(await hub(["pr", "view", url, "--json", "state,mergeable,mergeStateStatus,mergeCommit"]))
|
|
688
700
|
|
|
689
701
|
/**
|
|
@@ -870,14 +882,14 @@ async function finishStart({ action, top, git, apply, connect, result, origin })
|
|
|
870
882
|
*
|
|
871
883
|
* Adds Crew's shape to a new or existing repository; `tooling.repo` makes it dual-repo, and that repository must exist
|
|
872
884
|
* and hold what is declared. `state`: "plan" (nothing written), "published" (landed on the default branch),
|
|
873
|
-
* "committed" (a clone with no origin), "pr_open", "already_crew", "refused" (before any write) or "failed" (with
|
|
885
|
+
* "committed" (a clone with no origin), "pr_open", "already_crew", "not_git", "refused" (before any write) or "failed" (with
|
|
874
886
|
* `stage`; the clone is put back as it was).
|
|
875
887
|
*/
|
|
876
888
|
export async function startWorkspace({ repo, apply = false, tooling, founder, team, spawnGit = spawnSync, gh = personGh(), wait = sleep, now = Date.now }) {
|
|
877
889
|
const action = "start"
|
|
878
890
|
const refuse = (message) => ({ action, state: "refused", repo, message: `${message}. Nothing was written.` })
|
|
879
891
|
const top = toplevel(repo, spawnGit)
|
|
880
|
-
if (top === null) return { action, state: "
|
|
892
|
+
if (top === null) return { action, state: "not_git", repo, message: notGit(repo) }
|
|
881
893
|
const { git, origin, base } = workspaceFacts(top, spawnGit)
|
|
882
894
|
const declaration = declarationFor({ tooling })
|
|
883
895
|
const parsed = parseCrewConfig(JSON.stringify(declaration))
|
|
@@ -1198,8 +1210,22 @@ export async function joinWorkspace({ repo, identity, alias, adoptExisting, appl
|
|
|
1198
1210
|
writeFiles(top, Object.fromEntries(missing.map((rel) => [`${desk}/${rel}`, render(readFileSync(path.join(top, ...TEMPLATE.split("/"), ...rel.split("/")), "utf8"), member)])), created)
|
|
1199
1211
|
return missing.map((rel) => `${desk}/${rel}`)
|
|
1200
1212
|
}
|
|
1201
|
-
|
|
1202
|
-
|
|
1213
|
+
const deskMessage = `Crew: ${adopting ? "adopt" : "add"} ${alias}'s desk`
|
|
1214
|
+
if (pullRequestOnly(git, checkout.base)) {
|
|
1215
|
+
// The team's .desk/publication.json requires a pull request for every write to the default branch, so the desk goes through one too.
|
|
1216
|
+
const deskPrefix = `crew/join-desk-${alias}-`
|
|
1217
|
+
const deskBody = `${deskMessage}.\n\nOpened by Crew's crew.js. It is merged at once: this team publishes through pull requests, and the desk's only writer is its owner.\n\n${IDENTITY_TRAILER}: ${identity}${adopting ? `\n${ADOPTION_TRAILER}: ${desk}` : ""}`
|
|
1218
|
+
const deskReuse = adopting ? undefined : await openPullRequest(checkout.hub, status.origin, { account: result.account, base: checkout.base, branch: new RegExp(`^${escaped(deskPrefix)}[0-9a-z]+$`, "u"), identity, paths: files })
|
|
1219
|
+
const landedDesk = await landByPullRequest({ git, base: checkout.base, origin: status.origin, write: writeDesk, message: deskMessage, body: deskBody, prefix: deskPrefix, stamp: now(), hub: checkout.hub, wait, result, reuse: deskReuse, created })
|
|
1220
|
+
if (landedDesk.open !== undefined) return openResult(result, landedDesk, checkout.base, `Not joined yet: ${desk}/ is not in ${checkout.base} yet, and `)
|
|
1221
|
+
if (landedDesk.unfetched !== undefined) return unconfirmedResult(result, landedDesk, "joined", "The desk is in", "Run join again to add the roster row.")
|
|
1222
|
+
result.deskPr = result.pr
|
|
1223
|
+
delete result.pr
|
|
1224
|
+
delete result.reused
|
|
1225
|
+
} else {
|
|
1226
|
+
// The member's own desk: they are its only writer, so it goes straight to the default branch.
|
|
1227
|
+
await landByPush({ git, base: checkout.base, write: writeDesk, message: `${deskMessage}\n\n${IDENTITY_TRAILER}: ${identity}${adopting ? `\n${ADOPTION_TRAILER}: ${desk}` : ""}`, created })
|
|
1228
|
+
}
|
|
1203
1229
|
deskPushed = true
|
|
1204
1230
|
}
|
|
1205
1231
|
if (adopting) expected[desk] = git(["rev-parse", "--verify", `HEAD:${desk}`]).stdout
|
|
@@ -44,7 +44,7 @@ import { DEFERRED_TOOLS_LOAD_HINT } from "../util/deferred-tools.js"
|
|
|
44
44
|
export const TOOL_COMMIT_ENV = "DESK_TOOL_COMMIT"
|
|
45
45
|
/** The first marker line of the hook Desk writes. */
|
|
46
46
|
export const HOOK_MARKER = "# desk-card-commit-guard"
|
|
47
|
-
const HOOK_VERSION =
|
|
47
|
+
const HOOK_VERSION = 8
|
|
48
48
|
export const CHAINED_NAME = "pre-commit.desk-chained"
|
|
49
49
|
/** Set by the hook while it runs; a second entry (the pre-commit framework's `pre-commit.legacy` chain) exits 0 instead of looping. */
|
|
50
50
|
const RUNNING_ENV = "DESK_CARD_GUARD_RUNNING"
|
|
@@ -112,7 +112,8 @@ desk_card_guard() {
|
|
|
112
112
|
echo "$refused" | sed 's/^/ /'
|
|
113
113
|
echo "Use task_update (status, repos, a progress note, the next step, more body text), task_create, task_update or task_archive: each writes the card and commits it for you."
|
|
114
114
|
recovery=$(cat "$(dirname "$0")/${RECOVERY_POINTER_NAME}" 2>/dev/null)
|
|
115
|
-
|
|
115
|
+
# A pointer into a source mirror has no bootstrap.cjs beside its scripts folder and could never start a server.
|
|
116
|
+
{ [ -f "$recovery" ] && [ -f "$(dirname "$recovery")/../bootstrap.cjs" ]; } || recovery="<Desk plugin folder>/mcp/scripts/local-recovery.js"
|
|
116
117
|
track=$(echo "$first" | awk -F/ '{print $(NF-2)}')
|
|
117
118
|
slug=$(echo "$first" | awk -F/ '{print $(NF-1)}')
|
|
118
119
|
person=""
|
|
@@ -137,6 +137,17 @@ function holdsOnlyDeskWrites(root, head, admission) {
|
|
|
137
137
|
return listed.stdout.split("\n").filter(Boolean).map((line) => line.trim().split(/\s+/u)).every(([sha, ...parents]) => delivered.has(sha) || (parents.length === 1 && made.has(sha)))
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
// True when every file HEAD changed since it left the base's history already has HEAD's bytes in the base, as after a squash merge of a branch that HEAD still holds as separate commits.
|
|
141
|
+
function holdsNothingUnpublished(root, head, base) {
|
|
142
|
+
const fork = git(root, ["merge-base", head, base])
|
|
143
|
+
if (fork.status !== 0) return false
|
|
144
|
+
const changed = git(root, ["diff", "--name-only", "-z", fork.stdout.trim(), head])
|
|
145
|
+
const paths = changed.stdout.split("\0").filter(Boolean)
|
|
146
|
+
// Merges of the base into HEAD leave no net change: with no path to compare, an empty pathspec would compare whole trees.
|
|
147
|
+
if (paths.length === 0) return true
|
|
148
|
+
return git(root, ["diff", "--quiet", head, base, "--", ...paths]).status === 0
|
|
149
|
+
}
|
|
150
|
+
|
|
140
151
|
// The policy file's digest at a commit never changes.
|
|
141
152
|
const headPolicies = new Map()
|
|
142
153
|
|
|
@@ -161,6 +172,11 @@ export function assertPublishedContentBase(root, admission, tool) {
|
|
|
161
172
|
return
|
|
162
173
|
}
|
|
163
174
|
if (holdsOnlyDeskWrites(root, tip, admission)) return
|
|
175
|
+
if (holdsNothingUnpublished(root, tip, admission.policy_commit)) {
|
|
176
|
+
// A squash or rebase merge published these commits as new ones, so the checkout never became an ancestor of the base: it holds no bytes the base lacks, and is moved onto the base, keeping any local edits.
|
|
177
|
+
git(root, ["reset", "--keep", "-q", admission.policy_commit])
|
|
178
|
+
return
|
|
179
|
+
}
|
|
164
180
|
throw new Error(deskFailure({
|
|
165
181
|
code: "content_home_unpublished_base",
|
|
166
182
|
thing: `${tool}: content_home_unpublished_base`,
|
|
@@ -273,6 +273,9 @@ export function isIndexable(relPath) {
|
|
|
273
273
|
return true
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
+
// A track's own card, so a track with no tasks is still found.
|
|
277
|
+
if (isTrackCard(segments)) return true
|
|
278
|
+
|
|
276
279
|
// Every other Markdown file inside a track (a task's runbook, notes or evidence, at any depth) is desk context too.
|
|
277
280
|
if (inTrack(segments) && base.endsWith(".md")) return true
|
|
278
281
|
|
|
@@ -343,11 +346,16 @@ export function classify(relPath) {
|
|
|
343
346
|
return { kind: "friction", track: segments[0], task_slug: null }
|
|
344
347
|
}
|
|
345
348
|
|
|
349
|
+
if (isTrackCard(segments)) return { kind: "track", track: segments[0], task_slug: null }
|
|
350
|
+
|
|
346
351
|
if (inTrack(segments)) return { kind: "task-file", track: segments[0], task_slug: segments[1].startsWith("_") ? null : segments[1] }
|
|
347
352
|
|
|
348
353
|
return { kind: "other", track: null, task_slug: null }
|
|
349
354
|
}
|
|
350
355
|
|
|
356
|
+
// `<track>/track.md`, outside the desk's reserved `_` and `.` folders.
|
|
357
|
+
const isTrackCard = (segments) => segments.length === 2 && segments[1] === "track.md" && !/^[_.]/u.test(segments[0])
|
|
358
|
+
|
|
351
359
|
// `<track>/<folder>/…/<file>`: below a track's own folder, outside the desk's reserved `_` and `.` folders.
|
|
352
360
|
const inTrack = (segments) => segments.length >= 3 && !/^[_.]/u.test(segments[0])
|
|
353
361
|
|
|
@@ -12,7 +12,7 @@ export type { Claim, ClaimEvidence, ClaimScope, ClaimSet, ClaimSurface, ClaimTie
|
|
|
12
12
|
*
|
|
13
13
|
* @claim "agents failing without it" registry/ouro/ax/ax-claims.test.mts verify:testExists(registry/ouro/ax/ax-claims.test.mts::the claim set follows its own admission rule: every must claim cites a run or states a hazard)
|
|
14
14
|
*/
|
|
15
|
-
const CLAIM_SET_VERSION = "1.
|
|
15
|
+
const CLAIM_SET_VERSION = "1.9.0";
|
|
16
16
|
|
|
17
17
|
type ClaimSurface = "cli" | "http" | "mcp" | "tools" | "ui";
|
|
18
18
|
type ClaimTier = "must" | "should";
|
|
@@ -125,6 +125,7 @@ const CLAIM_SET: ClaimSet = Object.freeze({
|
|
|
125
125
|
{"id": "http.refusals-change-nothing", "surface": "http", "tier": "must", "applies": "others-route", "rule": "A refused request changes nothing, except an audit record that says it was refused.", "why": "An agent that gets the request wrong must be able to try again safely.", "evidence": {"basis": "hazard", "source": "", "finding": "A refused request that leaves a partial write makes a retry unsafe."}, "check": "Snapshot the manifest's state routes around each refused probe. Pass when nothing changed, or when every added record mentions the refusal and nothing was removed.", "fix": "Refuse before writing anything; if you log the refusal, say so in the record."},
|
|
126
126
|
{"id": "mcp.tools-list", "surface": "mcp", "tier": "should", "applies": "tool", "rule": "The server lists its tools, each with a description and an input schema.", "why": "The tool list is the MCP surface's help.", "evidence": {"basis": "evaluation", "source": "docs/decisions/2026-10-30-ouro-ax/evidence/kit-probe.md", "finding": "The kit probe's MCP server passed every send (4 of 4) from tools/list alone."}, "check": "initialize, then tools/list.", "fix": "Give every tool a one-line description and a JSON Schema for its input."},
|
|
127
127
|
{"id": "mcp.effect-annotated", "surface": "mcp", "tier": "must", "applies": "tool", "rule": "Every tool says whether it only reads or changes something (`readOnlyHint` or `destructiveHint`).", "why": "The MCP form of `effect`: who sees it.", "evidence": {"basis": "hazard", "source": "", "finding": "A tool that does not say whether it only reads lets a client run a write other people see as if it were a read."}, "check": "Read `annotations` from tools/list.", "fix": "Set `annotations.readOnlyHint` on reads and `destructiveHint` on what others see."},
|
|
128
|
+
{"id": "mcp.no-stream-promise", "surface": "mcp", "tier": "must", "applies": "tool", "rule": "A tool's description does not promise a stream, events as they happen, or anything continuous.", "why": "tools/call answers once, in one message; nothing after it is MCP's stream.", "evidence": {"basis": "hazard", "source": "", "finding": "A description that promises a stream over a protocol that answers once per call sends an agent polling for updates that never come, or reading one reply as if more were on the way."}, "check": "Read each tool's description from tools/list; fail one that promises streaming, continuous or as-it-happens delivery.", "fix": "Say what the one reply gives (a snapshot, a cursor to resume from), never that it streams."},
|
|
128
129
|
{"id": "mcp.bad-call-teaches", "surface": "mcp", "tier": "should", "applies": "tool-required", "rule": "A call missing a required argument is refused, and the error names the argument.", "why": "Schemas that reject bad calls with the fix.", "evidence": {"basis": "principle", "source": "Ouro UI design record of 2026-10-11 (MCP kit)", "finding": "No evaluation has shown agents failing without it yet."}, "check": "Call each tool that has required arguments with none.", "fix": "Validate input against the schema before running and name each missing field."},
|
|
129
130
|
{"id": "mcp.unknown-tool", "surface": "mcp", "tier": "should", "applies": "interface", "rule": "An unknown tool is refused, and the error names the tools or tools/list.", "why": "The error should be the menu.", "evidence": {"basis": "principle", "source": "The first adopter's AX principles, P7", "finding": "No evaluation has shown agents failing without it yet."}, "check": "Call a tool that does not exist.", "fix": "Answer with the tool names."},
|
|
130
131
|
{"id": "mcp.inventory", "surface": "mcp", "tier": "must", "applies": "interface", "rule": "Every tool the server registers is in tools/list once and in the adopter's inventory.", "why": "A tool nobody listed is never checked.", "evidence": {"basis": "hazard", "source": "", "finding": "A tool missing from the inventory is never checked, so an untested surface passes as conforming."}, "check": "Compare tools/list with `--inventory <file>` (`{ \"mcp\": [names] }`). Fail on a name missing from either side or listed twice; skip without an inventory.", "fix": "Serve the tools from the same definitions the inventory is generated from (`ax-mcp`)."},
|
|
@@ -93,6 +93,16 @@ interface ArgSpec {
|
|
|
93
93
|
* @claim "A required word, a word that reads stdin" registry/ouro/ax/ax-command.test.mts verify:testExists(registry/ouro/ax/ax-command.test.mts::defineCli refuses a default that does not fit its word or flag, naming the fix)
|
|
94
94
|
*/
|
|
95
95
|
default?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Leaves the word out of the MCP input schema: it exists only so the CLI can tell apart an alternate, longer form of
|
|
98
|
+
* the same command (a fourth word some installs still send), and its own name carries no meaning an agent should
|
|
99
|
+
* read. The CLI still parses it and `run()` still gets it when given; an MCP call simply has no property for it, and
|
|
100
|
+
* is never asked to supply it.
|
|
101
|
+
*
|
|
102
|
+
* @claim "its own name carries no meaning an agent should read" registry/ouro/ax/mcp.test.mts verify:testExists(registry/ouro/ax/mcp.test.mts::a word that only disambiguates the CLI's longer form is left out of the MCP schema, with every other property described)
|
|
103
|
+
* @claim "an MCP call simply has no property for it" registry/ouro/ax/mcp.test.mts verify:testExists(registry/ouro/ax/mcp.test.mts::a word that only disambiguates the CLI's longer form is left out of the MCP schema, with every other property described)
|
|
104
|
+
*/
|
|
105
|
+
cliOnly?: boolean;
|
|
96
106
|
}
|
|
97
107
|
|
|
98
108
|
/**
|
|
@@ -178,6 +188,15 @@ interface CommandDef<R = unknown, C extends RunContext = RunContext> {
|
|
|
178
188
|
output?: string;
|
|
179
189
|
/** Out of the overview, still callable and with its help. */
|
|
180
190
|
hidden?: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* The CLI's own `run()` keeps printing until stopped or the thing it watches closes (a continuous stream, never a
|
|
193
|
+
* `wait/1` poll that returns once). MCP answers one reply per call and has no way to give that, so the command is
|
|
194
|
+
* left out of its tool list rather than carry a description MCP cannot honour.
|
|
195
|
+
*
|
|
196
|
+
* @claim "a continuous stream, never a `wait/1` poll that returns once" registry/ouro/ax/mcp.test.mts verify:testExists(registry/ouro/ax/mcp.test.mts::a command whose CLI streams forever is left out of the MCP tool list)
|
|
197
|
+
* @claim "left out of its tool list" registry/ouro/ax/mcp.test.mts verify:testExists(registry/ouro/ax/mcp.test.mts::a command whose CLI streams forever is left out of the MCP tool list)
|
|
198
|
+
*/
|
|
199
|
+
streams?: boolean;
|
|
181
200
|
/**
|
|
182
201
|
* The command is a protocol: another program reads its stdout as one JSON reply line (such as `wire`, which a --via
|
|
183
202
|
* Mac's caller reads), not a person. The X-ray takes that one line as the reply, and still checks the one stderr line
|
|
@@ -890,6 +909,7 @@ function inputSchema(cli: Pick<Cli, "globalFlags">, cmd: CommandDef): JsonSchema
|
|
|
890
909
|
const properties: Record<string, JsonSchema & { type: string }> = {};
|
|
891
910
|
const required: string[] = [];
|
|
892
911
|
for (const a of cmd.args ?? []) {
|
|
912
|
+
if (a.cliOnly) continue;
|
|
893
913
|
const unless = unlessOf(a);
|
|
894
914
|
const description = a.description + (unless.length ? ` Not needed with ${unless.join(" or ")}.` : "");
|
|
895
915
|
const enumOf = a.values && a.rest !== true ? { enum: a.values } : {};
|
|
@@ -64,7 +64,7 @@ const toolName = (cli: Pick<Cli, "name" | "defaultCommand">, cmd: CommandDef) =>
|
|
|
64
64
|
|
|
65
65
|
function toolsOf(options: McpOptions): CommandDef[] {
|
|
66
66
|
const include = options.include ?? ((c: CommandDef) => !c.hidden);
|
|
67
|
-
return options.cli.commands.filter((c) => !c.loose && include(c));
|
|
67
|
+
return options.cli.commands.filter((c) => !c.loose && !c.streams && include(c));
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
function mcpTools(options: McpOptions): McpTool[] {
|
|
@@ -249,6 +249,28 @@ function usageForms(cmd: Pick<CliCommand, "usage">): string[] {
|
|
|
249
249
|
return cmd.usage.flatMap((u) => u.split("|").map((f) => f.trim()));
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
+
/**
|
|
253
|
+
* The `<...>` words in a usage slice, in order, marked optional when found inside a `[...]` group (at any nesting
|
|
254
|
+
* depth), bracket or not. A `|` choice inside one group, such as `[<version> | latest | <dmg or zip>]`, names
|
|
255
|
+
* alternative values for a single optional word, so an alternative later in the group stays optional too.
|
|
256
|
+
*/
|
|
257
|
+
function foundWords(slice: string): { name: string; optional: boolean }[] {
|
|
258
|
+
const found: { name: string; optional: boolean }[] = [];
|
|
259
|
+
let depth = 0;
|
|
260
|
+
for (let i = 0; i < slice.length; i++) {
|
|
261
|
+
const ch = slice[i];
|
|
262
|
+
if (ch === "[") depth++;
|
|
263
|
+
else if (ch === "]") depth = Math.max(0, depth - 1);
|
|
264
|
+
else if (ch === "<") {
|
|
265
|
+
const end = slice.indexOf(">", i);
|
|
266
|
+
if (end === -1) break;
|
|
267
|
+
found.push({ name: slice.slice(i + 1, end).replace(/\.\.\.$/, ""), optional: depth > 0 });
|
|
268
|
+
i = end;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return found;
|
|
272
|
+
}
|
|
273
|
+
|
|
252
274
|
/**
|
|
253
275
|
* Returns the problems with a command's words, as lines with their fixes, and the count of words in its busiest usage
|
|
254
276
|
* line. Words come in the order the command reads them: an optional word, bracketed in usage, comes after the required
|
|
@@ -268,7 +290,7 @@ function wordProblems(cmd: CliCommand): { words: number; problems: string[] } {
|
|
|
268
290
|
// A default's value is no word: it leaves the line first, and the words end at the first flag.
|
|
269
291
|
const bare = u.replace(/=(?:"[^"]*"|'[^']*'|[^\]\s]*)/g, "");
|
|
270
292
|
const cut = bare.search(/(?:^| |\[)--/);
|
|
271
|
-
const found =
|
|
293
|
+
const found = foundWords(cut === -1 ? bare : bare.slice(0, cut));
|
|
272
294
|
words = Math.max(words, found.length);
|
|
273
295
|
const at = found.findIndex((w) => w.optional);
|
|
274
296
|
const late = at === -1 ? undefined : found.slice(at + 1).find((w) => !w.optional);
|
|
@@ -1573,6 +1595,18 @@ function rpcClient(line: string, env: Record<string, string>, timeoutMs: number)
|
|
|
1573
1595
|
return { request, notify, kill: () => child.kill() };
|
|
1574
1596
|
}
|
|
1575
1597
|
|
|
1598
|
+
/**
|
|
1599
|
+
* Words that promise a stream: an MCP tool call here answers once per call, over JSON-RPC, so no tool's description
|
|
1600
|
+
* can honestly make this promise, whatever the command behind it does on its own CLI. Only a promise that the tool
|
|
1601
|
+
* itself streams counts: a description that names a stream as a thing (a channel's streaming capability, which stream
|
|
1602
|
+
* to read) promises nothing.
|
|
1603
|
+
*
|
|
1604
|
+
* @claim "an MCP tool call here answers once per call, over JSON-RPC, so no tool's description can honestly make this promise" registry/ouro/ax/xray.test.mts verify:testExists(registry/ouro/ax/xray.test.mts::an MCP tool whose description promises a stream fails: this transport answers once per call, never a stream)
|
|
1605
|
+
* @claim "a description that names a stream as a thing (a channel's streaming capability, which stream to read) promises nothing" registry/ouro/ax/xray.test.mts verify:testExists(registry/ouro/ax/xray.test.mts::an MCP tool that only names a stream as a thing, such as a channel's streaming capability, is no stream promise)
|
|
1606
|
+
*/
|
|
1607
|
+
const STREAM_LANGUAGE =
|
|
1608
|
+
/^\s*streams?\b|\bstreams?\s+(back|out|in|new|live|the|its|their|every|each|all|updates?|results?|events?|lines?|messages?|output|logs?|changes?|tokens?|progress|data)\b|\b(a|the)\s+stream\s+of\b|\bstreaming\s+(back|out|updates?|results?|events?|lines?|messages?|output|logs?|changes?|tokens?|progress|responses?|data)\b|\bas (it|they) happens?\b|\bcontinuously\b/i;
|
|
1609
|
+
|
|
1576
1610
|
async function checkMcp(ctx: Context) {
|
|
1577
1611
|
const { rec, opts } = ctx;
|
|
1578
1612
|
const rpc = rpcClient(opts.mcp!, ctx.env, opts.timeoutMs);
|
|
@@ -1613,6 +1647,8 @@ async function checkMcp(ctx: Context) {
|
|
|
1613
1647
|
const a = isRecord(t["annotations"]) ? t["annotations"] : {};
|
|
1614
1648
|
const ann = typeof a["readOnlyHint"] === "boolean" || typeof a["destructiveHint"] === "boolean";
|
|
1615
1649
|
rec.add("mcp.effect-annotated", tname, ann ? "pass" : "fail", ann ? JSON.stringify(a) : "no readOnlyHint or destructiveHint");
|
|
1650
|
+
const streamed = STREAM_LANGUAGE.exec(String(t["description"] ?? ""));
|
|
1651
|
+
rec.add("mcp.no-stream-promise", tname, streamed ? "fail" : "pass", streamed ? `the description promises "${streamed[0]}", but tools/call answers one reply, never a stream` : "no streaming language in the description");
|
|
1616
1652
|
const required = isRecord(schema) && Array.isArray(schema["required"]) ? schema["required"].map(String) : [];
|
|
1617
1653
|
if (required.length && a["readOnlyHint"] !== true && !ctx.safety.ok) rec.add("mcp.bad-call-teaches", tname, "skip", refusedNote(ctx.safety));
|
|
1618
1654
|
else if (required.length) {
|
|
@@ -1782,7 +1818,9 @@ const effectsLine = (r: Report) => (r.effects.length ? `Effects the X-ray caused
|
|
|
1782
1818
|
|
|
1783
1819
|
function renderText(report: Report, max = 6): string {
|
|
1784
1820
|
const s = report.summary;
|
|
1785
|
-
|
|
1821
|
+
// Conforming is said with the bar beside it, the moment someone might call the door done.
|
|
1822
|
+
const bar = report.conformant ? ["Conforming is the floor, not the bar: before agents rely on a new door, pass the AX gate (https://ui.ouroboros.bot/docs/design-craft/#the-ax-gate)."] : [];
|
|
1823
|
+
const out = [`ax-xray: ${targetLine(report.target)}`, pinLine(report), verdictLine(report), ...bar, `Claims holding: ${s.holding} of ${s.claims} (must: ${s.mustHolding} of ${s.must}). Checks: ${s.checks.pass} pass, ${s.checks.fail} fail, ${s.checks.skip} skipped.`, safetyLine(report), effectsLine(report), ""];
|
|
1786
1824
|
for (const c of order(report.claims)) {
|
|
1787
1825
|
out.push(`${mark(c)} ${c.id} [${c.tier}] ${c.rule} (${c.pass} of ${c.pass + c.fail}${c.skip ? `, ${c.skip} skipped` : ""})`);
|
|
1788
1826
|
for (const f of c.failing.slice(0, max)) out.push(` ${f.surface}: ${f.note}`);
|
|
@@ -1616,7 +1616,6 @@ export async function runBootCli({ argv = [], env = process.env, io = process, b
|
|
|
1616
1616
|
name: "boot",
|
|
1617
1617
|
summary: "Run the session-start boot: migrations, host, prerequisites, workspace sync, active tasks, push accounts and open PRs.",
|
|
1618
1618
|
effect: "private",
|
|
1619
|
-
readOnly: true,
|
|
1620
1619
|
output: "the boot result",
|
|
1621
1620
|
flags: {
|
|
1622
1621
|
task: { type: "string", placeholder: "<name>", description: "The task to open; a blank name is no task." },
|