@ouro.bot/cli 0.1.0-alpha.1556 → 0.1.0-alpha.1557
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 +6 -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 +600 -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/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 +6 -0
- 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/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 +7 -4
- 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
|
@@ -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." },
|
|
@@ -299,6 +299,20 @@ export function replay({ git, spawnGit, paths, onto, commits, prefix }) {
|
|
|
299
299
|
return { head: wt(["rev-parse", "HEAD"]).stdout.trim(), replayed, skipped }
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
+
// A refusal that is neither the network, the credentials, a timeout nor the remote having moved on is a hook or a remote rule.
|
|
303
|
+
const refusedByHook = (pushed) => classifyPullFailure({ stderr: pushed.stderr, timedOut: pushed.status === null }) === "other" && !/\[rejected\]/u.test(pushed.stderr)
|
|
304
|
+
|
|
305
|
+
// Pushes the rebuilt commit from a full checkout of it, so a pre-push hook sees the tree that would land. Returns `fallback`, the
|
|
306
|
+
// first push's result, when that checkout cannot be made.
|
|
307
|
+
function pushFromCandidate({ git, spawnGit, paths, upstream, built, onto, fallback }) {
|
|
308
|
+
removeWorktree(git, paths)
|
|
309
|
+
const added = git(["-c", `core.hooksPath=${paths.hooks}`, "worktree", "add", "--detach", "--force", "--no-checkout", paths.tree, built.head], CHECKOUT_TIMEOUT_MS)
|
|
310
|
+
if (added.status !== 0) return fallback
|
|
311
|
+
const inTree = runner(spawnGit, paths.tree)
|
|
312
|
+
if (inTree(["-c", `core.hooksPath=${paths.hooks}`, "read-tree", "-mu", "HEAD"], CHECKOUT_TIMEOUT_MS).status !== 0) return fallback
|
|
313
|
+
return inTree(["push", "--quiet", upstream.remote, `${built.head}:${upstream.merge}`], NETWORK_TIMEOUT_MS, lfsSkipEnv(git, onto, built.head))
|
|
314
|
+
}
|
|
315
|
+
|
|
302
316
|
export function upstreamOf(git) {
|
|
303
317
|
const branch = git(["symbolic-ref", "-q", "--short", "HEAD"]).stdout.trim()
|
|
304
318
|
const remote = git(["config", `branch.${branch}.remote`]).stdout.trim()
|
|
@@ -390,7 +404,12 @@ export function deliver({ root, env = process.env, spawnGit = spawnSync, deliver
|
|
|
390
404
|
const recovery = error.message.includes("Fix:") ? "" : `. Fix: run ${publicationRecovery(root)}`
|
|
391
405
|
return { state: "failed", reason: "publication_blocked", error: error.message + recovery, publication: error.publication ?? null, delivered: [], skipped: [] }
|
|
392
406
|
}
|
|
393
|
-
} else
|
|
407
|
+
} else {
|
|
408
|
+
pushed = built.head === onto ? { status: 0 } : git(["push", "--quiet", upstream.remote, `${built.head}:${upstream.merge}`], NETWORK_TIMEOUT_MS, lfsSkipEnv(git, onto, built.head))
|
|
409
|
+
// A repository's own pre-push hook tests the tree it runs in. After a replay that tree is the shared checkout, which has not
|
|
410
|
+
// received the commits already on the remote, so it can refuse a push the rebuilt tree would pass (#1680).
|
|
411
|
+
if (pushed.status !== 0 && !fastForward && refusedByHook(pushed)) pushed = pushFromCandidate({ git, spawnGit, paths, upstream, built, onto, fallback: pushed })
|
|
412
|
+
}
|
|
394
413
|
cleanup()
|
|
395
414
|
if (pushed.status === 0) {
|
|
396
415
|
git(["update-ref", upstream.tracking, target])
|
|
@@ -432,6 +451,21 @@ function removeIdenticalUntracked(git, target, stderr) {
|
|
|
432
451
|
return removed
|
|
433
452
|
}
|
|
434
453
|
|
|
454
|
+
// A tracked file whose working-tree bytes are exactly the incoming file's is staged: the checkout puts the same bytes back, and a stale index entry no longer refuses the move.
|
|
455
|
+
function stageIdenticalTracked(git, target, stderr) {
|
|
456
|
+
const top = git(["rev-parse", "--show-toplevel"]).stdout.trim()
|
|
457
|
+
let staged = 0
|
|
458
|
+
for (const match of stderr.matchAll(/^(?:error: )?Entry '(.+)' not uptodate\./gmu)) {
|
|
459
|
+
const file = match[1]
|
|
460
|
+
const incoming = git(["rev-parse", "--verify", "--quiet", `${target}:${file}`]).stdout.trim()
|
|
461
|
+
const local = git(["hash-object", "--", path.join(top, file)]).stdout.trim()
|
|
462
|
+
if (incoming !== local) continue
|
|
463
|
+
git(["add", "--", path.join(top, file)])
|
|
464
|
+
staged += 1
|
|
465
|
+
}
|
|
466
|
+
return staged
|
|
467
|
+
}
|
|
468
|
+
|
|
435
469
|
/**
|
|
436
470
|
* Moves the checkout with its upstream only when both name the same branch. A checkout on another branch (a worktree on a
|
|
437
471
|
* feature branch that tracks the default branch) keeps its branch: moving it would move the work it holds.
|
|
@@ -447,16 +481,19 @@ function followsUpstream({ git, upstream, head, target }) {
|
|
|
447
481
|
* an untracked file in the way, leaves the checkout where it was (`behind`), naming what stopped it.
|
|
448
482
|
*/
|
|
449
483
|
function catchUp({ git, upstream, head, target }) {
|
|
484
|
+
// Moving the checkout writes its files, so Git LFS must smudge them: with the skip on, a changed LFS file would land as its pointer.
|
|
485
|
+
const smudge = { GIT_LFS_SKIP_SMUDGE: "0" }
|
|
450
486
|
const now = git(["rev-parse", "HEAD"]).stdout.trim()
|
|
451
487
|
if (now === target) return { state: "current" }
|
|
452
488
|
if (now !== head) return { state: "behind", reason: "moved" }
|
|
453
489
|
// Git's index may hold stale file stamps, and refreshing them stats every file; do it only when the move is refused for them.
|
|
454
|
-
let moved = git(["read-tree", "-m", "-u", head, target], CHECKOUT_TIMEOUT_MS)
|
|
490
|
+
let moved = git(["read-tree", "-m", "-u", head, target], CHECKOUT_TIMEOUT_MS, smudge)
|
|
455
491
|
if (moved.status !== 0 && /not uptodate/u.test(moved.stderr)) {
|
|
456
492
|
git(["update-index", "-q", "--refresh"])
|
|
457
|
-
moved = git(["read-tree", "-m", "-u", head, target], CHECKOUT_TIMEOUT_MS)
|
|
493
|
+
moved = git(["read-tree", "-m", "-u", head, target], CHECKOUT_TIMEOUT_MS, smudge)
|
|
458
494
|
}
|
|
459
|
-
if (moved.status !== 0 &&
|
|
495
|
+
if (moved.status !== 0 && stageIdenticalTracked(git, target, moved.stderr) > 0) moved = git(["read-tree", "-m", "-u", head, target], CHECKOUT_TIMEOUT_MS, smudge)
|
|
496
|
+
if (moved.status !== 0 && removeIdenticalUntracked(git, target, moved.stderr) > 0) moved = git(["read-tree", "-m", "-u", head, target], CHECKOUT_TIMEOUT_MS, smudge)
|
|
460
497
|
if (moved.status !== 0) {
|
|
461
498
|
const named = [...moved.stderr.matchAll(/^(?:error: )?Entry '(.+)' (?:not uptodate|would be overwritten)/gmu)].map((match) => match[1])
|
|
462
499
|
return { state: "behind", reason: "local_changes", paths: [...new Set([...named, ...namedUntrackedPaths(moved.stderr)])] }
|
|
@@ -464,6 +501,6 @@ function catchUp({ git, upstream, head, target }) {
|
|
|
464
501
|
// Through HEAD, so the move is in HEAD's reflog as well as the branch's; the old value makes it a compare-and-swap.
|
|
465
502
|
if (git(["update-ref", "-m", "desk: catch up with delivered commits", "HEAD", target, head]).status === 0) return { state: "caught_up" }
|
|
466
503
|
// Another commit landed in the moment between: put the files back to match the branch as it now is.
|
|
467
|
-
git(["read-tree", "-m", "-u", target, "HEAD"], CHECKOUT_TIMEOUT_MS)
|
|
504
|
+
git(["read-tree", "-m", "-u", target, "HEAD"], CHECKOUT_TIMEOUT_MS, smudge)
|
|
468
505
|
return { state: "behind", reason: "moved" }
|
|
469
506
|
}
|
|
@@ -177,7 +177,15 @@ function drainsCli({ script, env, now, connect, listProcesses, signedIn, fetchHo
|
|
|
177
177
|
const paths = pathsOf(hookPaths({ env }), input)
|
|
178
178
|
return withDesk({ status: await hookStatus({ paths, now: now(), fetchImpl: fetchHooks, token: hookToken, env }) }, { script, env })
|
|
179
179
|
}),
|
|
180
|
-
command("runtimes status", { ...READ, summary: "Name the Copilot server runtimes started without Desk's plugin, and how to recover." }, () =>
|
|
180
|
+
command("runtimes status", { ...READ, summary: "Name the Copilot server runtimes started without Desk's plugin, and how to recover." }, () => {
|
|
181
|
+
let processes
|
|
182
|
+
try {
|
|
183
|
+
processes = listProcesses()
|
|
184
|
+
} catch (error) {
|
|
185
|
+
throw new AxError({ code: "process-list-failed", exit: 1, thing: "runtimes status", problem: `ps could not list this host's processes, probably because ps is missing or blocked here (${error.message})`, fix: "Run ps -axo pid=,command= yourself to see why it fails, then run runtimes status again." })
|
|
186
|
+
}
|
|
187
|
+
return { status: pluginlessRuntimeLines(findPluginlessRuntimes(processes)) }
|
|
188
|
+
}),
|
|
181
189
|
],
|
|
182
190
|
})
|
|
183
191
|
}
|
|
@@ -306,7 +306,7 @@ const ownStatus = (comment, login) => comment.user?.login?.toLowerCase() === log
|
|
|
306
306
|
/** A comment a drain's `ignoreComments` rule skips: written by the rule's author (case-insensitive) and, when the rule has a `match`, a body that matches it. */
|
|
307
307
|
const ignoredComment = (comment, rules) => rules.some((rule) => comment.user?.login?.toLowerCase() === rule.author && (rule.match === null || rule.match.test(comment.body ?? "")))
|
|
308
308
|
|
|
309
|
-
const isBot = (
|
|
309
|
+
const isBot = (item) => item.user?.type === "Bot" || (item.user?.login ?? "").toLowerCase().endsWith("[bot]")
|
|
310
310
|
|
|
311
311
|
/** A bot comment's text without what changes from run to run: run URLs and IDs, dates, times and durations. */
|
|
312
312
|
function repeatableText(body) {
|
|
@@ -354,10 +354,10 @@ function newsEvent(event, rules, claims, login, openedAt) {
|
|
|
354
354
|
/** An issue the drain filed or already triaged: a label in its `drain:` namespace, or its status marker in the body, is there before the poll first sees it, so it is already seen. */
|
|
355
355
|
const filedByDrain = (issue) => (issue.labels ?? []).some((label) => (label?.name ?? "").toLowerCase().startsWith(DRAIN_LABEL_PREFIX)) || (issue.body ?? "").includes(DRAIN_STATUS_MARKER)
|
|
356
356
|
|
|
357
|
-
/** What someone but the drain changed since `before` (a new issue, an edit, another comment, a reopen or a label outside the drain's own), or null. The reason travels with the event. */
|
|
357
|
+
/** What someone but the drain changed since `before` (a new issue, an edit to a human's issue (a bot that rewrites its own issue's body, such as a health table, is not news), an edit, another comment, a reopen or a label outside the drain's own), or null. The reason travels with the event. */
|
|
358
358
|
async function changedByOthers(api, repo, issue, before, digest, ignored, rules) {
|
|
359
359
|
if (!before) return filedByDrain(issue) ? null : "new issue"
|
|
360
|
-
if (before.digest && (before.ignored ?? "") === ignored && before.digest !== digest) return "title or body edited"
|
|
360
|
+
if (before.digest && (before.ignored ?? "") === ignored && before.digest !== digest && !isBot(issue)) return "title or body edited"
|
|
361
361
|
const since = before.updatedAt
|
|
362
362
|
const comments = (await api.comments(repo, issue.number, since)).filter((comment) => comment.updated_at > since)
|
|
363
363
|
const all = {}
|
|
@@ -444,8 +444,11 @@ export async function pollDrain(drain, states, { connect, now, desk }) {
|
|
|
444
444
|
if (!listed.untouched) await recordChanges(api, drain, state, listed, { now, desk })
|
|
445
445
|
state.lastOkAt = new Date(now).toISOString()
|
|
446
446
|
delete state.lastError
|
|
447
|
+
delete state.lastErrorCode
|
|
447
448
|
} catch (error) {
|
|
448
449
|
state.lastError = error.message
|
|
450
|
+
if (typeof error.code === "string") state.lastErrorCode = error.code
|
|
451
|
+
else delete state.lastErrorCode
|
|
449
452
|
}
|
|
450
453
|
const quota = api?.quota?.()
|
|
451
454
|
if (quota) state.quota = quota
|
|
@@ -569,7 +572,7 @@ export async function pollDrains({ paths, connect, now, ackCommand, ackFlags = [
|
|
|
569
572
|
const id = wakeId(drain.repo, events)
|
|
570
573
|
return { id, repo: drain.repo, session: sessionOf(drain, states[drain.repo]), message: wakeMessage(drain.repo, events), replaces: wakePrefix(drain.repo), events, done: [...ackCommand, "ack", "--repo", drain.repo, "--wake", id, ...ackFlags] }
|
|
571
574
|
})
|
|
572
|
-
const errors = drains.filter((drain) => states[drain.repo].lastError).map((drain) => ({ repo: drain.repo, error: states[drain.repo].lastError }))
|
|
575
|
+
const errors = drains.filter((drain) => states[drain.repo].lastError).map((drain) => ({ repo: drain.repo, error: states[drain.repo].lastError, ...(states[drain.repo].lastErrorCode ? { code: states[drain.repo].lastErrorCode } : {}) }))
|
|
573
576
|
const calls = drains.reduce((sum, drain) => sum + states[drain.repo].calls.total, 0)
|
|
574
577
|
return { at: new Date(now).toISOString(), wakes, errors, calls, status: drainStatusLines(drains, states, now) }
|
|
575
578
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { existsSync, readFileSync } from "node:fs"
|
|
8
8
|
import * as path from "node:path"
|
|
9
|
+
import { ACTION_TOOLS } from "../actions/served.js"
|
|
9
10
|
import { TOOL_NAMES } from "../tool-names.js"
|
|
10
11
|
import { readAgentsMd } from "./agents-md.js"
|
|
11
12
|
|
|
@@ -49,17 +50,18 @@ const READ_ONLY = new Set(["desk_search", "desk_recall", "desk_status", "desk_sk
|
|
|
49
50
|
// Tools that can remove or overwrite what was there: archive relocates a task and desk_save replaces files.
|
|
50
51
|
const DESTRUCTIVE = new Set(["task_archive", "desk_save"])
|
|
51
52
|
|
|
52
|
-
//
|
|
53
|
+
// A tool declared in actions/ serves its generated annotations, so the declaration is the one truth; the lists above
|
|
54
|
+
// cover only tools without one. desk_doctor is not read-only even though a read-only session may call it: its repairs change state.
|
|
53
55
|
export const TOOL_ANNOTATIONS = Object.freeze(Object.fromEntries(TOOL_NAMES.map((name) => [
|
|
54
56
|
name,
|
|
55
|
-
Object.freeze({ readOnlyHint: READ_ONLY.has(name), destructiveHint: DESTRUCTIVE.has(name) }),
|
|
57
|
+
ACTION_TOOLS[name]?.annotations ?? Object.freeze({ readOnlyHint: READ_ONLY.has(name), destructiveHint: DESTRUCTIVE.has(name) }),
|
|
56
58
|
])))
|
|
57
59
|
|
|
58
60
|
// A hosted client's own memory (claude.ai's, ChatGPT's) would split durable context between the client and the desk.
|
|
59
61
|
const CLIENT_MEMORY = "Don't use this client's built-in memory. Durable context, preferences and task state live in the desk, written through Desk's tools, and the desk wins over anything the client's memory recalls. Never save to that memory. If the client lets you turn its memory off, do so. If it doesn't and its memory is on, tell the user once that Desk keeps their memory in the desk and that they can turn the client's memory off in its settings."
|
|
60
62
|
const DESK_STATUS_FIRST = "Start by calling desk_status: it is this session's startup status block."
|
|
61
63
|
// The opening of the instructions. OpenAI's MCP server guide (https://developers.openai.com/plugins/build/mcp-server) advises putting key details in the first 512 characters, so this holds the rules that matter most; the password rule is copied from the using-desk foundation. A test keeps it inside 512 characters.
|
|
62
|
-
const LEAD = "Desk keeps this user's work, memory and task state in their desk. Call desk_status first: it is this session's startup status block. Don't use this client's built-in memory; write what lasts through Desk's tools. Never type a password or
|
|
64
|
+
const LEAD = "Desk keeps this user's work, memory and task state in their desk. Call desk_status first: it is this session's startup status block. Don't use this client's built-in memory; write what lasts through Desk's tools. Never type a password into a page or put a secret in context, a log, a transcript or Git; piping one from a page or the clipboard into its store, unread, is allowed. Skip the session-start procedure (it needs a shell) and the shell-only skills named under \"Hosted Desk\" below."
|
|
63
65
|
const SKILLS = "Desk's skills are its working procedures. When these instructions or a tool answer name a skill, read it with desk_skill (no name lists them all) and follow it; this client cannot load them any other way."
|
|
64
66
|
|
|
65
67
|
/**
|
|
@@ -577,7 +577,11 @@ export async function runMigrationCli({ argv, env = process.env, io, pluginRoot,
|
|
|
577
577
|
output: "{ roots: string[] }",
|
|
578
578
|
flags: { engine: { type: "string", placeholder: "<engine>", description: "The agent engine whose plugin folders to list (copilot)." } },
|
|
579
579
|
text: (result) => result.roots.map((root) => `${root}\n`).join(""),
|
|
580
|
-
run: (input) =>
|
|
580
|
+
run: (input) => {
|
|
581
|
+
const engine = input.engine ?? "copilot"
|
|
582
|
+
if (!["copilot", "claude"].includes(engine)) throw new AxError({ code: "unknown-engine", exit: 2, thing: "roots --engine", problem: `${engine} is not an agent engine Agency caches plugins for`, fix: "migrations roots --engine copilot, or --engine claude" })
|
|
583
|
+
return { roots: agencyMigrationRoots({ home, engine }) }
|
|
584
|
+
},
|
|
581
585
|
}),
|
|
582
586
|
],
|
|
583
587
|
})
|