@ouro.bot/cli 0.1.0-alpha.1469 → 0.1.0-alpha.1470

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.
Files changed (567) hide show
  1. package/README.md +1 -1
  2. package/changelog.json +6 -2
  3. package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
  4. package/deploy/unraid/sanctuary.xml +1 -1
  5. package/desk.lock.json +8 -0
  6. package/dist/heart/identity.js +27 -1
  7. package/dist/mind/desk-section.js +33 -43
  8. package/dist/repertoire/desk-mcp.js +140 -0
  9. package/dist/repertoire/mcp-manager.js +22 -0
  10. package/dist/repertoire/mcp-tools.js +11 -7
  11. package/npm-shrinkwrap.json +2 -2
  12. package/package.json +4 -1
  13. package/vendor/desk/.claude-plugin/plugin.json +35 -0
  14. package/vendor/desk/.mcp.claude-codex.json +28 -0
  15. package/vendor/desk/.mcp.copilot.json +16 -0
  16. package/vendor/desk/.ouro-desk.json +6 -0
  17. package/vendor/desk/CHANGELOG.md +7004 -0
  18. package/vendor/desk/README.md +195 -0
  19. package/vendor/desk/activation/README.md +98 -0
  20. package/vendor/desk/activation/copilot-root.flattened-bundle.json +38 -0
  21. package/vendor/desk/activation/desk.activation.json +251 -0
  22. package/vendor/desk/activation/host-capability-evidence.md +46 -0
  23. package/vendor/desk/activation/support-matrix.json +84 -0
  24. package/vendor/desk/agency.json +20 -0
  25. package/vendor/desk/agents/observer.agent.md +26 -0
  26. package/vendor/desk/agents/observer.md +29 -0
  27. package/vendor/desk/agents/worker.agent.md +32 -0
  28. package/vendor/desk/agents/worker.md +40 -0
  29. package/vendor/desk/artifacts/tombstones/tombstone.schema.json +53 -0
  30. package/vendor/desk/artifacts/tombstones/tombstones.jsonl +1 -0
  31. package/vendor/desk/changelog.d/README.md +12 -0
  32. package/vendor/desk/docs/agent-files.md +104 -0
  33. package/vendor/desk/docs/agentic-engineering-v2-rfc.md +206 -0
  34. package/vendor/desk/docs/agentic-engineering-v3-rfc.md +109 -0
  35. package/vendor/desk/docs/browser-remote-desktops.md +69 -0
  36. package/vendor/desk/docs/dependency-activation-stories-and-criteria.md +500 -0
  37. package/vendor/desk/docs/evaluation-packet.md +363 -0
  38. package/vendor/desk/docs/factory-local-capture.md +651 -0
  39. package/vendor/desk/docs/factory-store-playbook.md +927 -0
  40. package/vendor/desk/docs/images/factory-site.png +0 -0
  41. package/vendor/desk/docs/issue-drains.md +79 -0
  42. package/vendor/desk/docs/lfs-inspection.md +55 -0
  43. package/vendor/desk/docs/preview-diagnostics.md +11 -0
  44. package/vendor/desk/docs/relays.md +88 -0
  45. package/vendor/desk/docs/schedules.md +69 -0
  46. package/vendor/desk/docs/search-recovery.md +22 -0
  47. package/vendor/desk/docs/session-labels.md +157 -0
  48. package/vendor/desk/docs/session-retention.md +125 -0
  49. package/vendor/desk/docs/sessions.md +17 -0
  50. package/vendor/desk/docs/stalled-nudges.md +54 -0
  51. package/vendor/desk/docs/webhooks.md +80 -0
  52. package/vendor/desk/docs/workspace-tidy.md +74 -0
  53. package/vendor/desk/hooks/boot-checks.cjs +7 -0
  54. package/vendor/desk/hooks/claude-session-start.cjs +123 -0
  55. package/vendor/desk/hooks/compatible-node.cjs +97 -0
  56. package/vendor/desk/hooks/copilot-boot-prompt.cjs +69 -0
  57. package/vendor/desk/hooks/copilot-durable-files.cjs +8 -0
  58. package/vendor/desk/hooks/copilot-hooks.json +61 -0
  59. package/vendor/desk/hooks/copilot-intake-context.cjs +5 -0
  60. package/vendor/desk/hooks/copilot-lane-model.cjs +8 -0
  61. package/vendor/desk/hooks/copilot-session-start.cjs +264 -0
  62. package/vendor/desk/hooks/copilot-skill-current.cjs +28 -0
  63. package/vendor/desk/hooks/factory-end.cjs +5 -0
  64. package/vendor/desk/hooks/factory-start.cjs +27 -0
  65. package/vendor/desk/hooks/hooks.json +40 -0
  66. package/vendor/desk/hooks/lib/boot-checks.cjs +643 -0
  67. package/vendor/desk/hooks/lib/child-agent.cjs +14 -0
  68. package/vendor/desk/hooks/lib/copilot-intake-context.cjs +73 -0
  69. package/vendor/desk/hooks/lib/current-release.cjs +162 -0
  70. package/vendor/desk/hooks/lib/delivery-stop.cjs +326 -0
  71. package/vendor/desk/hooks/lib/detach-worker.cjs +43 -0
  72. package/vendor/desk/hooks/lib/durable-files.cjs +102 -0
  73. package/vendor/desk/hooks/lib/factory-end.cjs +327 -0
  74. package/vendor/desk/hooks/lib/lane-model.cjs +82 -0
  75. package/vendor/desk/hooks/lib/node-required.cjs +56 -0
  76. package/vendor/desk/hooks/lib/orca-session-title.cjs +60 -0
  77. package/vendor/desk/hooks/lib/session-end.cjs +30 -0
  78. package/vendor/desk/hooks/lib/sync-end.cjs +89 -0
  79. package/vendor/desk/hooks/loop-start.cjs +105 -0
  80. package/vendor/desk/hooks/node-missing.sh +78 -0
  81. package/vendor/desk/hooks/orca-session-title.cjs +8 -0
  82. package/vendor/desk/hooks/session-end.cjs +8 -0
  83. package/vendor/desk/mcp/README.md +269 -0
  84. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
  85. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
  86. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
  87. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
  88. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
  89. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
  90. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
  91. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
  92. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
  93. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
  94. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
  95. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
  96. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
  97. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
  98. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
  99. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/support-matrix.json +72 -0
  100. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
  101. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
  102. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
  103. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
  104. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
  105. package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
  106. package/vendor/desk/mcp/artifacts/runtime-deps/README.md +25 -0
  107. package/vendor/desk/mcp/bootstrap.cjs +761 -0
  108. package/vendor/desk/mcp/docs/private-feedback.md +13 -0
  109. package/vendor/desk/mcp/idle-proxy.cjs +423 -0
  110. package/vendor/desk/mcp/index.js +813 -0
  111. package/vendor/desk/mcp/package-lock.json +3717 -0
  112. package/vendor/desk/mcp/package.json +44 -0
  113. package/vendor/desk/mcp/scripts/agency-desk-channel.js +7 -0
  114. package/vendor/desk/mcp/scripts/build-runtime-deps-pack.js +5 -0
  115. package/vendor/desk/mcp/scripts/crew.js +89 -0
  116. package/vendor/desk/mcp/scripts/drains-launcher.mjs +329 -0
  117. package/vendor/desk/mcp/scripts/drains.js +5 -0
  118. package/vendor/desk/mcp/scripts/factory.js +657 -0
  119. package/vendor/desk/mcp/scripts/file-desk-problem.js +9 -0
  120. package/vendor/desk/mcp/scripts/finish-commit.js +7 -0
  121. package/vendor/desk/mcp/scripts/lfs.js +37 -0
  122. package/vendor/desk/mcp/scripts/local-recovery.js +363 -0
  123. package/vendor/desk/mcp/scripts/migrations.js +11 -0
  124. package/vendor/desk/mcp/scripts/private-view.js +177 -0
  125. package/vendor/desk/mcp/scripts/resolve-desk-root.js +106 -0
  126. package/vendor/desk/mcp/scripts/session-boot.js +22 -0
  127. package/vendor/desk/mcp/scripts/session-retention.js +5 -0
  128. package/vendor/desk/mcp/scripts/session-sync.js +10 -0
  129. package/vendor/desk/mcp/scripts/sessions.js +5 -0
  130. package/vendor/desk/mcp/scripts/sync-push.js +13 -0
  131. package/vendor/desk/mcp/scripts/tidy-status.js +8 -0
  132. package/vendor/desk/mcp/scripts/verify-runtime-deps-pack.js +5 -0
  133. package/vendor/desk/mcp/src/actions/desk-read.actions.mts +73 -0
  134. package/vendor/desk/mcp/src/actions/desk-session.actions.mts +42 -0
  135. package/vendor/desk/mcp/src/actions/desk-web.actions.mts +52 -0
  136. package/vendor/desk/mcp/src/actions/desk.actions.mts +5 -0
  137. package/vendor/desk/mcp/src/actions/generated/desk/OuroActions.swift +649 -0
  138. package/vendor/desk/mcp/src/actions/generated/desk/OuroActionsReins.swift +61 -0
  139. package/vendor/desk/mcp/src/actions/generated/desk/actions.json +280 -0
  140. package/vendor/desk/mcp/src/actions/generated/desk/commands.json +145 -0
  141. package/vendor/desk/mcp/src/actions/generated/desk/mcp.json +256 -0
  142. package/vendor/desk/mcp/src/actions/generated/desk/web.ts +59 -0
  143. package/vendor/desk/mcp/src/actions/generated/desk/webmcp.json +250 -0
  144. package/vendor/desk/mcp/src/actions/generated/desk-web/OuroActions.swift +241 -0
  145. package/vendor/desk/mcp/src/actions/generated/desk-web/OuroActionsReins.swift +25 -0
  146. package/vendor/desk/mcp/src/actions/generated/desk-web/actions.json +73 -0
  147. package/vendor/desk/mcp/src/actions/generated/desk-web/commands.json +53 -0
  148. package/vendor/desk/mcp/src/actions/generated/desk-web/mcp.json +83 -0
  149. package/vendor/desk/mcp/src/actions/generated/desk-web/web.ts +47 -0
  150. package/vendor/desk/mcp/src/actions/generated/desk-web/webmcp.json +81 -0
  151. package/vendor/desk/mcp/src/actions/served.js +5 -0
  152. package/vendor/desk/mcp/src/activation/admit.js +77 -0
  153. package/vendor/desk/mcp/src/activation/failures.js +65 -0
  154. package/vendor/desk/mcp/src/activation/readiness-policy.js +102 -0
  155. package/vendor/desk/mcp/src/activation/schema.js +17 -0
  156. package/vendor/desk/mcp/src/activation/superpowers-context.js +265 -0
  157. package/vendor/desk/mcp/src/activation/validate.js +540 -0
  158. package/vendor/desk/mcp/src/artifacts/tombstones.js +61 -0
  159. package/vendor/desk/mcp/src/crew/initiative.js +287 -0
  160. package/vendor/desk/mcp/src/crew/workspace.js +1259 -0
  161. package/vendor/desk/mcp/src/db/init.js +75 -0
  162. package/vendor/desk/mcp/src/db/schema.sql +83 -0
  163. package/vendor/desk/mcp/src/desk/active-tasks.js +408 -0
  164. package/vendor/desk/mcp/src/desk/card-commit-guard.js +281 -0
  165. package/vendor/desk/mcp/src/desk/cleanup-index.js +53 -0
  166. package/vendor/desk/mcp/src/desk/content-home.js +246 -0
  167. package/vendor/desk/mcp/src/desk/crew-config.js +102 -0
  168. package/vendor/desk/mcp/src/desk/crew-member.js +196 -0
  169. package/vendor/desk/mcp/src/desk/crew-roster.js +151 -0
  170. package/vendor/desk/mcp/src/desk/frontmatter-lite.js +228 -0
  171. package/vendor/desk/mcp/src/desk/gh-logins.js +109 -0
  172. package/vendor/desk/mcp/src/desk/handles.js +123 -0
  173. package/vendor/desk/mcp/src/desk/handoff-reference.js +35 -0
  174. package/vendor/desk/mcp/src/desk/improvement-authority.js +3 -0
  175. package/vendor/desk/mcp/src/desk/improvement-cards.js +704 -0
  176. package/vendor/desk/mcp/src/desk/improvement-person.js +51 -0
  177. package/vendor/desk/mcp/src/desk/lifecycle.js +16 -0
  178. package/vendor/desk/mcp/src/desk/machine-desks.js +119 -0
  179. package/vendor/desk/mcp/src/desk/naming.js +333 -0
  180. package/vendor/desk/mcp/src/desk/organization.js +592 -0
  181. package/vendor/desk/mcp/src/desk/resources.js +274 -0
  182. package/vendor/desk/mcp/src/desk/runtime-resolver.js +30 -0
  183. package/vendor/desk/mcp/src/desk/scratch-paths.js +44 -0
  184. package/vendor/desk/mcp/src/desk/step-delivery.js +140 -0
  185. package/vendor/desk/mcp/src/desk/steps.js +263 -0
  186. package/vendor/desk/mcp/src/desk/tidy.js +930 -0
  187. package/vendor/desk/mcp/src/desk/unsigned-deliveries.js +359 -0
  188. package/vendor/desk/mcp/src/factory/agent-types.js +45 -0
  189. package/vendor/desk/mcp/src/factory/andon-watch.js +109 -0
  190. package/vendor/desk/mcp/src/factory/binding.js +612 -0
  191. package/vendor/desk/mcp/src/factory/boot-check.js +645 -0
  192. package/vendor/desk/mcp/src/factory/capture-classify.js +158 -0
  193. package/vendor/desk/mcp/src/factory/capture-count.js +183 -0
  194. package/vendor/desk/mcp/src/factory/capture-flush.js +268 -0
  195. package/vendor/desk/mcp/src/factory/capture-publish.js +141 -0
  196. package/vendor/desk/mcp/src/factory/capture-schema.js +193 -0
  197. package/vendor/desk/mcp/src/factory/capture-sweep.js +239 -0
  198. package/vendor/desk/mcp/src/factory/catch-point.js +60 -0
  199. package/vendor/desk/mcp/src/factory/commit-resolve.js +94 -0
  200. package/vendor/desk/mcp/src/factory/consent-answer.js +37 -0
  201. package/vendor/desk/mcp/src/factory/context-capability.js +15 -0
  202. package/vendor/desk/mcp/src/factory/context-outbox.js +885 -0
  203. package/vendor/desk/mcp/src/factory/context-run.js +386 -0
  204. package/vendor/desk/mcp/src/factory/context-schema.js +249 -0
  205. package/vendor/desk/mcp/src/factory/copilot-turn-index.js +93 -0
  206. package/vendor/desk/mcp/src/factory/copilot-usage.js +148 -0
  207. package/vendor/desk/mcp/src/factory/credential.js +45 -0
  208. package/vendor/desk/mcp/src/factory/derive-claude.js +960 -0
  209. package/vendor/desk/mcp/src/factory/derive-codex.js +734 -0
  210. package/vendor/desk/mcp/src/factory/derive-common.js +279 -0
  211. package/vendor/desk/mcp/src/factory/derive-copilot.js +1057 -0
  212. package/vendor/desk/mcp/src/factory/derive-run.js +807 -0
  213. package/vendor/desk/mcp/src/factory/desk-problem-file.js +310 -0
  214. package/vendor/desk/mcp/src/factory/desk-problem-fingerprint.js +70 -0
  215. package/vendor/desk/mcp/src/factory/desk-problem-known.js +246 -0
  216. package/vendor/desk/mcp/src/factory/desk-problem-template.js +107 -0
  217. package/vendor/desk/mcp/src/factory/desk-repo.js +1223 -0
  218. package/vendor/desk/mcp/src/factory/desk-task-line.js +28 -0
  219. package/vendor/desk/mcp/src/factory/desk-visibility.js +48 -0
  220. package/vendor/desk/mcp/src/factory/end-hook.js +14 -0
  221. package/vendor/desk/mcp/src/factory/evaluate-kick.js +164 -0
  222. package/vendor/desk/mcp/src/factory/evaluate-run.js +678 -0
  223. package/vendor/desk/mcp/src/factory/evaluator-step.js +484 -0
  224. package/vendor/desk/mcp/src/factory/filer-launch.js +79 -0
  225. package/vendor/desk/mcp/src/factory/flush-health.js +26 -0
  226. package/vendor/desk/mcp/src/factory/flush.js +1758 -0
  227. package/vendor/desk/mcp/src/factory/focus.js +326 -0
  228. package/vendor/desk/mcp/src/factory/headless-flag.cjs +32 -0
  229. package/vendor/desk/mcp/src/factory/headless-flag.js +25 -0
  230. package/vendor/desk/mcp/src/factory/headless-ledger.js +743 -0
  231. package/vendor/desk/mcp/src/factory/headless.js +567 -0
  232. package/vendor/desk/mcp/src/factory/held-route.js +93 -0
  233. package/vendor/desk/mcp/src/factory/host-flags.js +36 -0
  234. package/vendor/desk/mcp/src/factory/improvement-verify.js +429 -0
  235. package/vendor/desk/mcp/src/factory/kaizen-file.js +231 -0
  236. package/vendor/desk/mcp/src/factory/label-binding.js +90 -0
  237. package/vendor/desk/mcp/src/factory/label-schema.js +426 -0
  238. package/vendor/desk/mcp/src/factory/local-status.js +368 -0
  239. package/vendor/desk/mcp/src/factory/loop-conditions.js +121 -0
  240. package/vendor/desk/mcp/src/factory/loop-health.js +500 -0
  241. package/vendor/desk/mcp/src/factory/loop-slot.js +90 -0
  242. package/vendor/desk/mcp/src/factory/loop-status.js +100 -0
  243. package/vendor/desk/mcp/src/factory/loop-switch.cjs +14 -0
  244. package/vendor/desk/mcp/src/factory/loop-worker-state.js +96 -0
  245. package/vendor/desk/mcp/src/factory/loop-worker.js +290 -0
  246. package/vendor/desk/mcp/src/factory/marker.js +61 -0
  247. package/vendor/desk/mcp/src/factory/mirror-step.js +145 -0
  248. package/vendor/desk/mcp/src/factory/os-protect.js +243 -0
  249. package/vendor/desk/mcp/src/factory/outbox.js +2231 -0
  250. package/vendor/desk/mcp/src/factory/outcome.js +431 -0
  251. package/vendor/desk/mcp/src/factory/pipeline/andon.js +319 -0
  252. package/vendor/desk/mcp/src/factory/pipeline/attention-rollup.js +158 -0
  253. package/vendor/desk/mcp/src/factory/pipeline/attention.js +146 -0
  254. package/vendor/desk/mcp/src/factory/pipeline/build.js +299 -0
  255. package/vendor/desk/mcp/src/factory/pipeline/compare.js +148 -0
  256. package/vendor/desk/mcp/src/factory/pipeline/formulas.js +652 -0
  257. package/vendor/desk/mcp/src/factory/pipeline/kaizen.js +387 -0
  258. package/vendor/desk/mcp/src/factory/pipeline/lifecycle-clocks.js +345 -0
  259. package/vendor/desk/mcp/src/factory/pipeline/normalize.js +73 -0
  260. package/vendor/desk/mcp/src/factory/pipeline/number-states.js +154 -0
  261. package/vendor/desk/mcp/src/factory/pipeline/outcomes.js +268 -0
  262. package/vendor/desk/mcp/src/factory/pipeline/report.js +737 -0
  263. package/vendor/desk/mcp/src/factory/pipeline/rollups.js +883 -0
  264. package/vendor/desk/mcp/src/factory/pipeline/stretches.js +523 -0
  265. package/vendor/desk/mcp/src/factory/pipeline/timeline.js +199 -0
  266. package/vendor/desk/mcp/src/factory/pipeline/validate-pr.js +238 -0
  267. package/vendor/desk/mcp/src/factory/pipeline/versions.js +42 -0
  268. package/vendor/desk/mcp/src/factory/pipeline/walk.js +1177 -0
  269. package/vendor/desk/mcp/src/factory/plugin-registry.js +72 -0
  270. package/vendor/desk/mcp/src/factory/plugin-sources.cjs +249 -0
  271. package/vendor/desk/mcp/src/factory/pr-green.js +77 -0
  272. package/vendor/desk/mcp/src/factory/process-lock.js +142 -0
  273. package/vendor/desk/mcp/src/factory/proof-session.js +75 -0
  274. package/vendor/desk/mcp/src/factory/publish.js +637 -0
  275. package/vendor/desk/mcp/src/factory/published-schema.js +648 -0
  276. package/vendor/desk/mcp/src/factory/reconcile-reasons.js +22 -0
  277. package/vendor/desk/mcp/src/factory/reconcile-step.js +251 -0
  278. package/vendor/desk/mcp/src/factory/reconcile.js +808 -0
  279. package/vendor/desk/mcp/src/factory/release-version.js +134 -0
  280. package/vendor/desk/mcp/src/factory/repo-name.js +13 -0
  281. package/vendor/desk/mcp/src/factory/retention.js +60 -0
  282. package/vendor/desk/mcp/src/factory/route-desk.js +40 -0
  283. package/vendor/desk/mcp/src/factory/route-issues.js +251 -0
  284. package/vendor/desk/mcp/src/factory/route-local.js +264 -0
  285. package/vendor/desk/mcp/src/factory/schema.js +957 -0
  286. package/vendor/desk/mcp/src/factory/session-kind.js +16 -0
  287. package/vendor/desk/mcp/src/factory/session-lifetime.js +56 -0
  288. package/vendor/desk/mcp/src/factory/session-route.js +183 -0
  289. package/vendor/desk/mcp/src/factory/shell-git.js +500 -0
  290. package/vendor/desk/mcp/src/factory/store-issues.js +143 -0
  291. package/vendor/desk/mcp/src/factory/store-route.js +208 -0
  292. package/vendor/desk/mcp/src/factory/test-state-guard.js +103 -0
  293. package/vendor/desk/mcp/src/factory/time.js +36 -0
  294. package/vendor/desk/mcp/src/factory/tool-issue-file.js +84 -0
  295. package/vendor/desk/mcp/src/factory/tool-kinds.js +87 -0
  296. package/vendor/desk/mcp/src/factory/triage-schema.js +233 -0
  297. package/vendor/desk/mcp/src/factory/windows-acl.js +679 -0
  298. package/vendor/desk/mcp/src/indexer/chunk.js +232 -0
  299. package/vendor/desk/mcp/src/indexer/discover.js +434 -0
  300. package/vendor/desk/mcp/src/indexer/exclusions.js +247 -0
  301. package/vendor/desk/mcp/src/indexer/index.js +167 -0
  302. package/vendor/desk/mcp/src/indexer/refs.js +0 -0
  303. package/vendor/desk/mcp/src/indexer/text-hash.js +18 -0
  304. package/vendor/desk/mcp/src/lib/ouro-actions/actions.claims.json +75 -0
  305. package/vendor/desk/mcp/src/lib/ouro-actions/dist-manifest.json +70 -0
  306. package/vendor/desk/mcp/src/lib/ouro-actions/ouro-actions.mts +1416 -0
  307. package/vendor/desk/mcp/src/lib/ouro-ui/LICENSE +21 -0
  308. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/ax-claims.ts +190 -0
  309. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/ax-command.ts +1020 -0
  310. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/checks.ts +343 -0
  311. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/cli.ts +240 -0
  312. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/component.ts +430 -0
  313. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/dev-commands.ts +204 -0
  314. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/doctor.ts +126 -0
  315. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/effects.ts +68 -0
  316. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/exit-codes.ts +75 -0
  317. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/help.ts +220 -0
  318. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/mcp.ts +268 -0
  319. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/outcome.ts +265 -0
  320. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/output.ts +67 -0
  321. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/precise-copy.ts +235 -0
  322. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/problem.ts +124 -0
  323. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/surfaces.kit.mts +8 -0
  324. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/surfaces.ts +568 -0
  325. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/terminal.ts +245 -0
  326. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/voice.ts +136 -0
  327. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/wait.ts +226 -0
  328. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/work-event.ts +181 -0
  329. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/xray.kit.mts +18 -0
  330. package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/xray.ts +2072 -0
  331. package/vendor/desk/mcp/src/package-metadata.js +20 -0
  332. package/vendor/desk/mcp/src/protected/legacy-ledger.js +55 -0
  333. package/vendor/desk/mcp/src/readiness/leftovers.js +75 -0
  334. package/vendor/desk/mcp/src/readiness/process-start.js +149 -0
  335. package/vendor/desk/mcp/src/runtime/admission-worker.js +194 -0
  336. package/vendor/desk/mcp/src/runtime/admission.js +177 -0
  337. package/vendor/desk/mcp/src/runtime/agency-desk-channel.js +342 -0
  338. package/vendor/desk/mcp/src/runtime/agents-md.js +62 -0
  339. package/vendor/desk/mcp/src/runtime/append-lane.js +68 -0
  340. package/vendor/desk/mcp/src/runtime/argv-safe-reason.js +55 -0
  341. package/vendor/desk/mcp/src/runtime/boot-dependencies.js +75 -0
  342. package/vendor/desk/mcp/src/runtime/boot-text.js +504 -0
  343. package/vendor/desk/mcp/src/runtime/boot.js +1677 -0
  344. package/vendor/desk/mcp/src/runtime/bootstrap.js +1455 -0
  345. package/vendor/desk/mcp/src/runtime/chunked-import.js +102 -0
  346. package/vendor/desk/mcp/src/runtime/copilot-commit-trailer.js +133 -0
  347. package/vendor/desk/mcp/src/runtime/copilot-session.js +155 -0
  348. package/vendor/desk/mcp/src/runtime/deliver.js +469 -0
  349. package/vendor/desk/mcp/src/runtime/desk-channel.js +86 -0
  350. package/vendor/desk/mcp/src/runtime/desk-failure.js +26 -0
  351. package/vendor/desk/mcp/src/runtime/desk-health.js +168 -0
  352. package/vendor/desk/mcp/src/runtime/desk-session.js +1451 -0
  353. package/vendor/desk/mcp/src/runtime/diagnostic-server.js +72 -0
  354. package/vendor/desk/mcp/src/runtime/diagnostics.js +241 -0
  355. package/vendor/desk/mcp/src/runtime/drains-cli.js +187 -0
  356. package/vendor/desk/mcp/src/runtime/drains.js +781 -0
  357. package/vendor/desk/mcp/src/runtime/elsewhere-note.js +9 -0
  358. package/vendor/desk/mcp/src/runtime/failure-evidence.js +21 -0
  359. package/vendor/desk/mcp/src/runtime/fast-refs.js +209 -0
  360. package/vendor/desk/mcp/src/runtime/filer-throttle.js +66 -0
  361. package/vendor/desk/mcp/src/runtime/focused-card.js +147 -0
  362. package/vendor/desk/mcp/src/runtime/front-door.js +204 -0
  363. package/vendor/desk/mcp/src/runtime/gate-wait.js +2 -0
  364. package/vendor/desk/mcp/src/runtime/git-inspection.js +201 -0
  365. package/vendor/desk/mcp/src/runtime/git-read-worker.js +157 -0
  366. package/vendor/desk/mcp/src/runtime/health.js +50 -0
  367. package/vendor/desk/mcp/src/runtime/hooks.js +353 -0
  368. package/vendor/desk/mcp/src/runtime/hosted.js +163 -0
  369. package/vendor/desk/mcp/src/runtime/inbox.js +102 -0
  370. package/vendor/desk/mcp/src/runtime/index-drift.js +118 -0
  371. package/vendor/desk/mcp/src/runtime/last-start.js +133 -0
  372. package/vendor/desk/mcp/src/runtime/lesson-section.js +92 -0
  373. package/vendor/desk/mcp/src/runtime/lessons-shelf.js +100 -0
  374. package/vendor/desk/mcp/src/runtime/lfs.js +319 -0
  375. package/vendor/desk/mcp/src/runtime/native-path.js +12 -0
  376. package/vendor/desk/mcp/src/runtime/newest-release.js +197 -0
  377. package/vendor/desk/mcp/src/runtime/node-selection.js +233 -0
  378. package/vendor/desk/mcp/src/runtime/orca-session-title.js +225 -0
  379. package/vendor/desk/mcp/src/runtime/other-sessions.js +183 -0
  380. package/vendor/desk/mcp/src/runtime/pending-migrations.js +653 -0
  381. package/vendor/desk/mcp/src/runtime/plugin-update.js +215 -0
  382. package/vendor/desk/mcp/src/runtime/pluginless-runtimes.js +34 -0
  383. package/vendor/desk/mcp/src/runtime/pr-publication.js +226 -0
  384. package/vendor/desk/mcp/src/runtime/preview-snapshot.js +23 -0
  385. package/vendor/desk/mcp/src/runtime/publication-mode.js +19 -0
  386. package/vendor/desk/mcp/src/runtime/relays.js +974 -0
  387. package/vendor/desk/mcp/src/runtime/release-alert.js +148 -0
  388. package/vendor/desk/mcp/src/runtime/remote-identity.js +140 -0
  389. package/vendor/desk/mcp/src/runtime/resolve-here.js +4 -0
  390. package/vendor/desk/mcp/src/runtime/runtime-deps-cli.js +65 -0
  391. package/vendor/desk/mcp/src/runtime/runtime-deps.js +1109 -0
  392. package/vendor/desk/mcp/src/runtime/runtime-identity.js +22 -0
  393. package/vendor/desk/mcp/src/runtime/runtime-swap.js +101 -0
  394. package/vendor/desk/mcp/src/runtime/schedules.js +235 -0
  395. package/vendor/desk/mcp/src/runtime/session-activity.js +190 -0
  396. package/vendor/desk/mcp/src/runtime/session-label.js +30 -0
  397. package/vendor/desk/mcp/src/runtime/session-retention.js +662 -0
  398. package/vendor/desk/mcp/src/runtime/session-sync.js +333 -0
  399. package/vendor/desk/mcp/src/runtime/session-trailer.js +126 -0
  400. package/vendor/desk/mcp/src/runtime/sessions-cli.js +301 -0
  401. package/vendor/desk/mcp/src/runtime/signoff-listed.js +81 -0
  402. package/vendor/desk/mcp/src/runtime/skills.js +76 -0
  403. package/vendor/desk/mcp/src/runtime/stale-card-lead.js +52 -0
  404. package/vendor/desk/mcp/src/runtime/stale-desk-refresh.js +198 -0
  405. package/vendor/desk/mcp/src/runtime/stale-desk.js +219 -0
  406. package/vendor/desk/mcp/src/runtime/stalled.js +255 -0
  407. package/vendor/desk/mcp/src/runtime/standing-authority.js +79 -0
  408. package/vendor/desk/mcp/src/runtime/startup-boot.js +341 -0
  409. package/vendor/desk/mcp/src/runtime/startup-resolve.js +140 -0
  410. package/vendor/desk/mcp/src/runtime/state-branch.js +203 -0
  411. package/vendor/desk/mcp/src/runtime/status-compact.js +165 -0
  412. package/vendor/desk/mcp/src/runtime/status-inspection-child.js +26 -0
  413. package/vendor/desk/mcp/src/runtime/status-inspection.js +147 -0
  414. package/vendor/desk/mcp/src/runtime/status-root.js +39 -0
  415. package/vendor/desk/mcp/src/runtime/sync-worker.js +911 -0
  416. package/vendor/desk/mcp/src/runtime/test-state-guard.js +107 -0
  417. package/vendor/desk/mcp/src/runtime/unmerged-saves.js +247 -0
  418. package/vendor/desk/mcp/src/runtime/workspace-claim.js +53 -0
  419. package/vendor/desk/mcp/src/runtime/workspace-evidence.js +96 -0
  420. package/vendor/desk/mcp/src/runtime/workspace-tidy.js +509 -0
  421. package/vendor/desk/mcp/src/search/direct-lexical.js +54 -0
  422. package/vendor/desk/mcp/src/search/embedder.js +108 -0
  423. package/vendor/desk/mcp/src/search/engine.js +406 -0
  424. package/vendor/desk/mcp/src/search/files-router.js +22 -0
  425. package/vendor/desk/mcp/src/search/old-index.js +46 -0
  426. package/vendor/desk/mcp/src/search/vectors.js +60 -0
  427. package/vendor/desk/mcp/src/server.js +389 -0
  428. package/vendor/desk/mcp/src/tool-names.js +73 -0
  429. package/vendor/desk/mcp/src/tool-refusal.cjs +35 -0
  430. package/vendor/desk/mcp/src/tool-schema-parts.js +12 -0
  431. package/vendor/desk/mcp/src/tool-schemas.js +325 -0
  432. package/vendor/desk/mcp/src/tools/_card-commit.js +148 -0
  433. package/vendor/desk/mcp/src/tools/archive-links.js +185 -0
  434. package/vendor/desk/mcp/src/tools/archive-move.js +18 -0
  435. package/vendor/desk/mcp/src/tools/archive-native-session.js +728 -0
  436. package/vendor/desk/mcp/src/tools/archive-state.js +513 -0
  437. package/vendor/desk/mcp/src/tools/delivery-gate.js +251 -0
  438. package/vendor/desk/mcp/src/tools/desk-save.js +444 -0
  439. package/vendor/desk/mcp/src/tools/doctor.js +122 -0
  440. package/vendor/desk/mcp/src/tools/done-evidence.js +260 -0
  441. package/vendor/desk/mcp/src/tools/factory-context.js +204 -0
  442. package/vendor/desk/mcp/src/tools/friction.js +332 -0
  443. package/vendor/desk/mcp/src/tools/improvement.js +156 -0
  444. package/vendor/desk/mcp/src/tools/lesson-lines.js +22 -0
  445. package/vendor/desk/mcp/src/tools/lesson-owners.js +137 -0
  446. package/vendor/desk/mcp/src/tools/lesson-team.js +169 -0
  447. package/vendor/desk/mcp/src/tools/lesson.js +254 -0
  448. package/vendor/desk/mcp/src/tools/local-only.js +151 -0
  449. package/vendor/desk/mcp/src/tools/move.js +794 -0
  450. package/vendor/desk/mcp/src/tools/native-stage-context.js +32 -0
  451. package/vendor/desk/mcp/src/tools/note.js +267 -0
  452. package/vendor/desk/mcp/src/tools/search.js +634 -0
  453. package/vendor/desk/mcp/src/tools/shared-write.js +196 -0
  454. package/vendor/desk/mcp/src/tools/sibling-desk.js +37 -0
  455. package/vendor/desk/mcp/src/tools/status.js +233 -0
  456. package/vendor/desk/mcp/src/tools/task-archive-due.js +9 -0
  457. package/vendor/desk/mcp/src/tools/task-archived-resource.js +53 -0
  458. package/vendor/desk/mcp/src/tools/task-body.js +141 -0
  459. package/vendor/desk/mcp/src/tools/task-focus.js +164 -0
  460. package/vendor/desk/mcp/src/tools/task-log.js +76 -0
  461. package/vendor/desk/mcp/src/tools/task-signoff.js +155 -0
  462. package/vendor/desk/mcp/src/tools/task.js +1768 -0
  463. package/vendor/desk/mcp/src/tools/track-row.js +89 -0
  464. package/vendor/desk/mcp/src/tools/track.js +240 -0
  465. package/vendor/desk/mcp/src/util/agency-session.cjs +29 -0
  466. package/vendor/desk/mcp/src/util/archive-links.js +105 -0
  467. package/vendor/desk/mcp/src/util/bash.js +36 -0
  468. package/vendor/desk/mcp/src/util/capture-record.js +73 -0
  469. package/vendor/desk/mcp/src/util/cas-commit.js +252 -0
  470. package/vendor/desk/mcp/src/util/created-dirs.js +71 -0
  471. package/vendor/desk/mcp/src/util/deferred-tools.js +51 -0
  472. package/vendor/desk/mcp/src/util/desk-owner.js +99 -0
  473. package/vendor/desk/mcp/src/util/env-value.js +13 -0
  474. package/vendor/desk/mcp/src/util/file-identity.js +40 -0
  475. package/vendor/desk/mcp/src/util/finish-commit.js +145 -0
  476. package/vendor/desk/mcp/src/util/fm.js +410 -0
  477. package/vendor/desk/mcp/src/util/git-config-file.js +85 -0
  478. package/vendor/desk/mcp/src/util/git-stage.js +440 -0
  479. package/vendor/desk/mcp/src/util/main-publish.js +240 -0
  480. package/vendor/desk/mcp/src/util/markdown-links.cjs +555 -0
  481. package/vendor/desk/mcp/src/util/object-input.js +59 -0
  482. package/vendor/desk/mcp/src/util/paths.js +647 -0
  483. package/vendor/desk/mcp/src/util/rank.js +189 -0
  484. package/vendor/desk/mcp/src/util/redact.js +92 -0
  485. package/vendor/desk/mcp/src/util/remove-retry.js +35 -0
  486. package/vendor/desk/mcp/src/util/rename-retry.js +73 -0
  487. package/vendor/desk/mcp/src/util/route-around.js +265 -0
  488. package/vendor/desk/mcp/src/util/shell-quote.js +18 -0
  489. package/vendor/desk/mcp/src/util/startup-direction.js +124 -0
  490. package/vendor/desk/mcp/src/util/state-ignore.js +33 -0
  491. package/vendor/desk/mcp/src/util/tool-commits.js +64 -0
  492. package/vendor/desk/mcp/src/util/unicode-16/LICENSE-MIT.txt +7 -0
  493. package/vendor/desk/mcp/src/util/unicode-16/README.md +9 -0
  494. package/vendor/desk/mcp/src/util/unicode-16/letter.cjs +1 -0
  495. package/vendor/desk/mcp/src/util/unicode-16/mark.cjs +1 -0
  496. package/vendor/desk/mcp/src/util/unicode-16/number.cjs +1 -0
  497. package/vendor/desk/mcp/web-auth.cjs +1897 -0
  498. package/vendor/desk/mcp/web-browser-discovery.cjs +53 -0
  499. package/vendor/desk/mcp/web-catalog.json +34 -0
  500. package/vendor/desk/mcp/web-launch.cjs +101 -0
  501. package/vendor/desk/mcp/web.cjs +1239 -0
  502. package/vendor/desk/migrations/01-move-to-ourostack-desk.md +188 -0
  503. package/vendor/desk/migrations/02-tidy-desk.md +87 -0
  504. package/vendor/desk/migrations/03-desk-release-channel.md +38 -0
  505. package/vendor/desk/optional/session-label/consumer.mjs +237 -0
  506. package/vendor/desk/optional/session-label/extension.mjs +32 -0
  507. package/vendor/desk/plugin.json +54 -0
  508. package/vendor/desk/settings.json +3 -0
  509. package/vendor/desk/skills/add-workspace-mcp/SKILL.md +180 -0
  510. package/vendor/desk/skills/adopt-inflight-work/SKILL.md +212 -0
  511. package/vendor/desk/skills/archive-workflow/SKILL.md +132 -0
  512. package/vendor/desk/skills/content-routing/SKILL.md +95 -0
  513. package/vendor/desk/skills/core-meeting-capture/SKILL.md +47 -0
  514. package/vendor/desk/skills/core-meeting-capture/references/capture-contract.md +175 -0
  515. package/vendor/desk/skills/curator/SKILL.md +103 -0
  516. package/vendor/desk/skills/delightful-decks/SKILL.md +67 -0
  517. package/vendor/desk/skills/desk-problem/SKILL.md +87 -0
  518. package/vendor/desk/skills/directory-structure/SKILL.md +169 -0
  519. package/vendor/desk/skills/doc-review-rigor/SKILL.md +63 -0
  520. package/vendor/desk/skills/draining-issues/SKILL.md +62 -0
  521. package/vendor/desk/skills/evaluate-release/SKILL.md +96 -0
  522. package/vendor/desk/skills/evidence-discipline/SKILL.md +150 -0
  523. package/vendor/desk/skills/factory-evaluator/SKILL.md +122 -0
  524. package/vendor/desk/skills/factory-task-context/SKILL.md +116 -0
  525. package/vendor/desk/skills/factory-work/SKILL.md +16 -0
  526. package/vendor/desk/skills/fast-honest-ci/SKILL.md +70 -0
  527. package/vendor/desk/skills/fast-honest-ci/examples.md +49 -0
  528. package/vendor/desk/skills/first-run-bootstrap/SKILL.md +95 -0
  529. package/vendor/desk/skills/friction-management/SKILL.md +98 -0
  530. package/vendor/desk/skills/git-hygiene/SKILL.md +253 -0
  531. package/vendor/desk/skills/independent-review/SKILL.md +34 -0
  532. package/vendor/desk/skills/interaction-style/SKILL.md +239 -0
  533. package/vendor/desk/skills/lesson-capture/SKILL.md +85 -0
  534. package/vendor/desk/skills/lesson-capture/agents-md-budget.mjs +61 -0
  535. package/vendor/desk/skills/online-evaluation/SKILL.md +81 -0
  536. package/vendor/desk/skills/operator-voice-comments/LICENSE-humanize +21 -0
  537. package/vendor/desk/skills/operator-voice-comments/SKILL.md +90 -0
  538. package/vendor/desk/skills/operator-voice-comments/human-voice.md +43 -0
  539. package/vendor/desk/skills/peer-pr-review/SKILL.md +104 -0
  540. package/vendor/desk/skills/pr-feedback-on-own-pr/SKILL.md +145 -0
  541. package/vendor/desk/skills/pr-review-interrogation/SKILL.md +121 -0
  542. package/vendor/desk/skills/pr-reviewer-audit/SKILL.md +68 -0
  543. package/vendor/desk/skills/pr-reviewer-audit/helpers/audit.py +335 -0
  544. package/vendor/desk/skills/pr-reviewer-audit/helpers/test_audit.py +486 -0
  545. package/vendor/desk/skills/pr-self-review/SKILL.md +86 -0
  546. package/vendor/desk/skills/pr-surface-hygiene/SKILL.md +105 -0
  547. package/vendor/desk/skills/pr-surface-hygiene/check-visual-proof.cjs +99 -0
  548. package/vendor/desk/skills/pr-surface-hygiene/repository-setup.md +19 -0
  549. package/vendor/desk/skills/pr-surface-hygiene/resources/pr-visual-proof.yml +29 -0
  550. package/vendor/desk/skills/pr-surface-hygiene/resources/pull-request-template.md +5 -0
  551. package/vendor/desk/skills/preflight-actions/SKILL.md +60 -0
  552. package/vendor/desk/skills/preview-feedback/SKILL.md +70 -0
  553. package/vendor/desk/skills/repo-handling/SKILL.md +67 -0
  554. package/vendor/desk/skills/rnd-lab/SKILL.md +52 -0
  555. package/vendor/desk/skills/runtime-symptom-investigation/SKILL.md +106 -0
  556. package/vendor/desk/skills/session-resumption/SKILL.md +126 -0
  557. package/vendor/desk/skills/session-start/SKILL.md +54 -0
  558. package/vendor/desk/skills/session-start/details.md +150 -0
  559. package/vendor/desk/skills/session-start-migrations/README.md +71 -0
  560. package/vendor/desk/skills/session-start-migrations/SKILL.md +108 -0
  561. package/vendor/desk/skills/start-task/SKILL.md +88 -0
  562. package/vendor/desk/skills/task-card-format/SKILL.md +198 -0
  563. package/vendor/desk/skills/task-lifecycle/SKILL.md +217 -0
  564. package/vendor/desk/skills/track-card-format/SKILL.md +90 -0
  565. package/vendor/desk/skills/using-desk/SKILL.md +58 -0
  566. package/vendor/desk/skills/using-superpowers-with-desk/SKILL.md +156 -0
  567. package/vendor/desk/skills/work-orchestration/SKILL.md +162 -0
@@ -0,0 +1,203 @@
1
+ // The state branch: the one branch a desk checkout must be on for Desk to write.
2
+ //
3
+ // A host passes `--state-branch <name>` (or `desk.state_branch` in its activation config). Desk then checks the checkout that holds the desk root at every admission and before every write. When HEAD is elsewhere, Desk switches back only when that is provably safe, and otherwise serves reads and refuses writes with a fix the agent can act on in the session.
4
+ //
5
+ // Safe means all of these hold (the always-on investigation, §3(b), and Ari's ruling 1 of 2026-09-25):
6
+ // - no tracked change (`git status --porcelain=v1 --untracked-files=no` is empty);
7
+ // - no Git operation in progress (merge, cherry-pick, revert, bisect, rebase) and no index.lock;
8
+ // - no local-only commits: `git branch -r --contains HEAD` is non-empty, or the branch equals its upstream;
9
+ // - `refs/heads/<state branch>` exists.
10
+ // The repair is `git switch --no-guess <state branch>`, which keeps untracked files and refuses rather than overwrite one; HEAD is read again right before it, and a HEAD that moved since the check aborts it. Desk never fetches or resets.
11
+ //
12
+ // When the switch happens (fix round 1 ruling): automatically only during the session's first admission attempt, whatever that attempt ends in (fix round 3 ruling), and then only for a detached HEAD or a branch equal to its upstream. Mid-session, a HEAD that leaves the state branch makes writes read-only and is never switched back automatically; the agent asks for the switch with desk_doctor's switch_state_branch repair, which runs the same preconditions.
13
+ //
14
+ // Git runs asynchronously, never blocking the thread that answers the host.
15
+
16
+ import { execFile } from "node:child_process"
17
+ import { existsSync } from "node:fs"
18
+ import * as path from "node:path"
19
+ import { fastGitAnswer } from "./fast-refs.js"
20
+
21
+ export const STATE_BRANCH_REPAIR = "switch_state_branch"
22
+ const OPERATION_MARKERS = ["MERGE_HEAD", "CHERRY_PICK_HEAD", "REVERT_HEAD", "BISECT_LOG", "rebase-merge", "rebase-apply"]
23
+ const BRANCH_NAME = /^(?!-)(?!.*\.\.)(?!.*\/\/)(?!.*@\{)[A-Za-z0-9._/-]+(?<![./])$/u
24
+ const LEFT_BEHIND = /leaving (\d+) commits? behind[\s\S]*?\n\n((?:\s+[0-9a-f]{7,40} .*\n?)+)/u
25
+
26
+ // Git reads its location from these variables before `-C`; a host hook can leave them set, so they are dropped.
27
+ const GIT_LOCATION_VARIABLES = ["GIT_DIR", "GIT_WORK_TREE", "GIT_INDEX_FILE", "GIT_COMMON_DIR", "GIT_OBJECT_DIRECTORY"]
28
+
29
+ export function isStateBranchName(value) {
30
+ return typeof value === "string" && BRANCH_NAME.test(value) && !value.endsWith(".lock")
31
+ }
32
+
33
+ /** Run one git command in `cwd` without blocking. Never rejects: a missing git or a failed command is `{ ok: false }`. */
34
+ export function runGit({ cwd, args, execFileImpl = execFile, env = process.env }) {
35
+ // Branch and ref questions on a plain checkout are answered from `.git`; a process costs 100-250 ms on a loaded machine.
36
+ const quick = execFileImpl === execFile && env === process.env ? fastGitAnswer(cwd, args) : null
37
+ if (quick !== null) return Promise.resolve({ ok: quick.status === 0, stdout: String(quick.stdout).trim(), stderr: "" })
38
+ const childEnv = { ...env, GIT_OPTIONAL_LOCKS: "0", GIT_TERMINAL_PROMPT: "0", LC_ALL: "C" }
39
+ for (const name of GIT_LOCATION_VARIABLES) delete childEnv[name]
40
+ return new Promise((resolve) => {
41
+ execFileImpl("git", ["-C", cwd, ...args], {
42
+ encoding: "utf8",
43
+ env: childEnv,
44
+ timeout: 15000,
45
+ windowsHide: true,
46
+ maxBuffer: 16 * 1024 * 1024,
47
+ }, (error, stdout, stderr) => {
48
+ resolve({
49
+ ok: !error,
50
+ stdout: String(stdout ?? "").trim(),
51
+ stderr: String(stderr ?? "").trim() || (error ? error.message : ""),
52
+ })
53
+ })
54
+ })
55
+ }
56
+
57
+ /**
58
+ * Where HEAD is relative to the state branch, and whether switching back is safe.
59
+ * `ok` is true when there is nothing to protect: no state branch configured, a root outside any Git checkout, or HEAD already on the state branch.
60
+ */
61
+ export async function inspectStateBranch({ root, branch, git = runGit, exists = existsSync }) {
62
+ if (!isStateBranchName(branch)) {
63
+ return { checked: false, ok: true, kind: "not_configured", branch: branch ?? null }
64
+ }
65
+ const located = await git({ cwd: root, args: ["rev-parse", "--show-toplevel", "--absolute-git-dir"] })
66
+ if (!located.ok) {
67
+ return { checked: false, ok: true, kind: "not_a_checkout", branch }
68
+ }
69
+ const [toplevel, gitDir] = located.stdout.split(/\r?\n/u)
70
+ const { detached, headBranch, sha } = await readHead(git, toplevel)
71
+ const base = { checked: true, branch, toplevel, gitDir, head: { branch: headBranch, sha } }
72
+ if (headBranch === branch) {
73
+ return { ...base, ok: true, kind: "on_state_branch", blockers: [], repairable: false, automatic: false }
74
+ }
75
+ const blockers = []
76
+ if (!(await git({ cwd: toplevel, args: ["show-ref", "--verify", "--quiet", `refs/heads/${branch}`] })).ok) blockers.push("state_branch_missing")
77
+ const status = await git({ cwd: toplevel, args: ["status", "--porcelain=v1", "--untracked-files=no"] })
78
+ if (!status.ok || status.stdout.length > 0) blockers.push("tracked_changes")
79
+ if (OPERATION_MARKERS.some((marker) => exists(path.join(gitDir, marker)))) blockers.push("operation_in_progress")
80
+ if (exists(path.join(gitDir, "index.lock"))) blockers.push("index_locked")
81
+ const upstream = detached ? null : await git({ cwd: toplevel, args: ["rev-parse", "--verify", "--quiet", "@{upstream}"] })
82
+ const equalsUpstream = upstream?.ok === true && sha !== null && upstream.stdout === sha
83
+ const onRemote = equalsUpstream || (await git({ cwd: toplevel, args: ["branch", "-r", "--contains", "HEAD"] })).stdout.length > 0
84
+ if (!onRemote) blockers.push("local_only_commits")
85
+ const repairable = blockers.length === 0
86
+ return {
87
+ ...base,
88
+ ok: false,
89
+ kind: detached ? "detached" : "other_branch",
90
+ blockers,
91
+ repairable,
92
+ automatic: repairable && (detached || equalsUpstream),
93
+ }
94
+ }
95
+
96
+ /**
97
+ * The rule for a desk with no state branch configured (a configured one is judged by `inspectStateBranch`): HEAD must not be detached. When the remote names a default branch (`origin/HEAD`) and HEAD is on another branch, the write still publishes to that default branch (util/main-publish.js), so it is allowed while this checkout can reach it: a worktree on a feature branch writes to main.
98
+ * With no such remote, any named branch is allowed, so a `master` desk, a fetched-but-not-cloned remote and a local-only desk all pass. `ok` is also true outside a Git checkout.
99
+ */
100
+ export async function inspectWriteBranch({ root, branch, git }) {
101
+ if (isStateBranchName(branch)) return { ok: true }
102
+ const located = await git({ cwd: root, args: ["rev-parse", "--show-toplevel"] })
103
+ if (!located.ok) return { ok: true }
104
+ const toplevel = located.stdout.split(/\r?\n/u)[0]
105
+ const head = await git({ cwd: toplevel, args: ["symbolic-ref", "--quiet", "--short", "HEAD"] })
106
+ if (!head.ok) return { ok: false, kind: "detached", found: null, expected: null }
107
+ const remote = await git({ cwd: toplevel, args: ["symbolic-ref", "--quiet", "--short", "refs/remotes/origin/HEAD"] })
108
+ const expected = remote.ok && remote.stdout.startsWith("origin/") ? remote.stdout.slice("origin/".length) : null
109
+ if (expected === null || head.stdout === expected) return { ok: true }
110
+ const reachable = await git({ cwd: toplevel, args: ["rev-parse", "--verify", "--quiet", `refs/remotes/origin/${expected}`] })
111
+ if (reachable.ok) return { ok: true }
112
+ return { ok: false, kind: "unpublishable", root: toplevel, found: head.stdout, expected }
113
+ }
114
+
115
+ /** The degraded answer for a refused write from `inspectWriteBranch`, with a fix the agent can act on. */
116
+ export function writeBranchProblem(inspection) {
117
+ if (inspection.kind === "detached") {
118
+ return { code: "write_branch_detached", fix: "The desk checkout is on a detached HEAD, so Desk wrote nothing. Switch it to a branch (git switch <branch>), then retry." }
119
+ }
120
+ const { root, found, expected } = inspection
121
+ return {
122
+ code: "write_publication_unreachable",
123
+ fix: `Desk did not write: this checkout is on branch ${found}, and its card writes publish to ${expected}, but Git has no origin/${expected} to publish to. Probable cause: this checkout was never fetched from origin, or its origin remote was removed. Look further: git -C "${root}" remote -v, then git -C "${root}" fetch origin ${expected}. Keep working: nothing was written; retry the write once origin/${expected} exists.`,
124
+ }
125
+ }
126
+
127
+
128
+ async function readHead(git, toplevel) {
129
+ const symbolic = await git({ cwd: toplevel, args: ["symbolic-ref", "--quiet", "--short", "HEAD"] })
130
+ const sha = (await git({ cwd: toplevel, args: ["rev-parse", "--verify", "--quiet", "HEAD"] })).stdout || null
131
+ return { detached: !symbolic.ok, headBranch: symbolic.ok ? symbolic.stdout : null, sha }
132
+ }
133
+
134
+ /** Switch back to the state branch when `inspection` says it is safe. Returns the one-line report, or why it did not switch. */
135
+ export async function repairStateBranch({ inspection, git = runGit }) {
136
+ if (!inspection?.checked || inspection.ok || !inspection.repairable) {
137
+ return { repaired: false, reason: "preconditions_not_met", blockers: inspection?.blockers ?? [] }
138
+ }
139
+ // The checks above took several git calls; a commit or checkout in between would make them stale.
140
+ const now = await readHead(git, inspection.toplevel)
141
+ if (now.headBranch !== inspection.head.branch || now.sha !== inspection.head.sha) {
142
+ return { repaired: false, reason: "head_moved", message: "Run it again: HEAD moved while Desk was checking it", blockers: inspection.blockers }
143
+ }
144
+ const switched = await git({ cwd: inspection.toplevel, args: ["switch", "--no-guess", inspection.branch] })
145
+ if (!switched.ok) {
146
+ return { repaired: false, reason: "switch_failed", message: switched.stderr, blockers: inspection.blockers }
147
+ }
148
+ const was = shortSha(inspection.head.sha)
149
+ const from = inspection.kind === "detached" ? "detached HEAD" : `branch ${inspection.head.branch}`
150
+ const leftBehind = LEFT_BEHIND.exec(switched.stderr)
151
+ const note = leftBehind
152
+ ? `; git noted ${leftBehind[1]} commit(s) not on a local branch: ${leftBehind[2].trim().split(/\s*\n\s*/u).map((entry) => entry.split(" ")[0]).join(", ")}`
153
+ : ""
154
+ return { repaired: true, line: `repaired: ${from} → ${inspection.branch} (was ${was})${note}`, was: inspection.head.sha }
155
+ }
156
+
157
+ /**
158
+ * The degraded state for an inspection that is not ok, with a fix the agent can act on in the session.
159
+ * `automatic` says the problem was found by the first admission attempt, the only one that switches on its own. The agent reads the fix after that attempt, so every fix ends with desk_doctor's switch_state_branch repair: once the blockers are gone, Desk never switches back by itself.
160
+ */
161
+ export function stateBranchProblem(inspection, { failedRepair = null, automatic = false } = {}) {
162
+ const code = inspection.kind === "detached" ? "state_branch_detached" : "state_branch_mismatch"
163
+ const where = inspection.toplevel
164
+ const here = inspection.kind === "detached"
165
+ ? `HEAD in ${where} is detached at ${shortSha(inspection.head.sha)}`
166
+ : `${where} is on branch ${inspection.head.branch}`
167
+ const doctor = `call desk_doctor with {"repair":"${STATE_BRANCH_REPAIR}"} to switch back to ${inspection.branch}`
168
+ const then = `then ${doctor}`
169
+ const steps = inspection.blockers.map((blocker) => blockerFix(blocker, inspection, then))
170
+ if (failedRepair?.reason === "switch_failed" || failedRepair?.reason === "head_moved") {
171
+ steps.push(`git switch ${inspection.branch} did not run cleanly (${failedRepair.message}); resolve what it names, then ${doctor}.`)
172
+ }
173
+ if (steps.length === 0) {
174
+ steps.push(automatic
175
+ ? `Its preconditions for a safe switch hold, but someone may be using this branch on purpose: ${doctor}.`
176
+ : `HEAD left the state branch during this session, and Desk never switches it back on its own mid-session. If the move was not deliberate, ${doctor}; its preconditions for a safe switch hold.`)
177
+ }
178
+ return {
179
+ code,
180
+ summary: `${here}, not on the state branch ${inspection.branch}. Desk serves reads; writes wait until the checkout is back on ${inspection.branch}.`,
181
+ fix: steps.join(" "),
182
+ blockers: inspection.blockers,
183
+ }
184
+ }
185
+
186
+ function blockerFix(blocker, inspection, then) {
187
+ const where = JSON.stringify(inspection.toplevel)
188
+ const branch = inspection.branch
189
+ const fixes = {
190
+ state_branch_missing: `The local branch ${branch} does not exist; create it from the remote (git -C ${where} branch --track ${branch} origin/${branch}), ${then}.`,
191
+ tracked_changes: `Tracked files have changes (git -C ${where} status); commit them on a pushed branch or move them elsewhere, ${then}.`,
192
+ operation_in_progress: `A Git operation is in progress (git -C ${where} status names it); finish or abort it, ${then}.`,
193
+ index_locked: `Another Git process holds ${path.join(inspection.gitDir, "index.lock")}; wait for it to finish (remove the lock only if no Git process is running), ${then}.`,
194
+ local_only_commits: inspection.kind === "detached"
195
+ ? `HEAD has commits that are on no remote branch; keep them on a pushed branch (git -C ${where} push origin HEAD:refs/heads/<name>), ${then}.`
196
+ : `Branch ${inspection.head.branch} has commits that are on no remote branch; push them (git -C ${where} push -u origin ${inspection.head.branch}), ${then}.`,
197
+ }
198
+ return fixes[blocker]
199
+ }
200
+
201
+ function shortSha(sha) {
202
+ return typeof sha === "string" ? sha.slice(0, 12) : "unknown"
203
+ }
@@ -0,0 +1,165 @@
1
+ // The compact `desk_status` answer. The full payload runs to tens of KB (index, snapshots, vector packs, admission
2
+ // internals) and agents only ever asked "ready or not?" of it, then read `readiness.state: degraded` and
3
+ // `startup_fallback.degraded: true` beside an admitted Desk as an outage (boot acceptance round 6).
4
+ //
5
+ // One health word, the one the session-start boot script's `status` uses: `ready`, `degraded`, `setup_required`, plus
6
+ // `admitting` (boot never admits). It says whether Desk works. The search index is a separate word, `search`, that never
7
+ // moves `state`: a degraded index only means search reads the files directly. Boot does not check the index at all
8
+ // (slow, network-bound), so "boot ready, desk_status ready, search degraded" is one consistent picture, not a contradiction.
9
+
10
+ import { shellQuote } from "../util/shell-quote.js"
11
+ import { healthWord, syncDegradation } from "./health.js"
12
+ import { GATE_WAIT_MS } from "./gate-wait.js"
13
+
14
+ const DETAIL_POINTER =
15
+ "Call desk_status with { detail: true } for the full payload (index, snapshots, vector packs, admission internals), or desk_doctor for diagnostics and repairs."
16
+
17
+ function stateWord(payload) {
18
+ if (payload.status === "ok") return "ready"
19
+ if (payload.status === "setup_required") return "setup_required"
20
+ if (payload.status === "admitting" || payload.state === "admitting") return "admitting"
21
+ return "degraded"
22
+ }
23
+
24
+ // The wait a tool call allows a running admission before it refuses with `admitting`.
25
+ const STARTING_WAIT = `${GATE_WAIT_MS / 1000} s`
26
+ const STARTING_FIX = `desk_status and desk_skill answer at once. Every other Desk tool waits up to ${STARTING_WAIT} for startup: task reads and updates and exact-word search (desk_search) need only the desk's files, so they run as soon as startup finishes, and meaning-based search (desk_recall) can take longer to catch up. If startup is still running after ${STARTING_WAIT}, the call is refused with code admitting; retry it then.`
27
+ // The admission steps (setPhase / onPhase names) in words an agent can pass on.
28
+ const LOADING = "loading Desk"
29
+ const STEP_WORDS = {
30
+ resolving_inputs: "finding this session's desk",
31
+ loading_runtime: LOADING,
32
+ inspecting_runtime_pack: LOADING,
33
+ restoring_runtime_dependencies: LOADING,
34
+ waiting_for_publication_lock: LOADING,
35
+ building: LOADING,
36
+ mirroring_source: LOADING,
37
+ importing_runtime: LOADING,
38
+ inspecting_state_branch: "checking the desk's Git branch",
39
+ admitting_authority: "checking write access",
40
+ verifying_authority: "checking write access",
41
+ starting_search: "starting search",
42
+ }
43
+
44
+ function startingSummary(admission) {
45
+ const words = Object.hasOwn(STEP_WORDS, admission.phase ?? "") ? STEP_WORDS[admission.phase] : null
46
+ const since = Date.parse(admission.phase_since ?? "")
47
+ const elapsed = Number.isFinite(since) ? `, ${Math.max(0, Math.round((Date.now() - since) / 1000))} s so far` : ""
48
+ return `Desk is still starting${words === null ? "" : ` (${words}${elapsed})`}. Call desk_status again in about ${STARTING_WAIT}.`
49
+ }
50
+
51
+ function line(value) {
52
+ if (typeof value === "string") return value
53
+ if (value !== null && typeof value === "object") return typeof value.message === "string" ? value.message : JSON.stringify(value)
54
+ return String(value)
55
+ }
56
+
57
+ function whyNotReady(payload, syncProblem, ready) {
58
+ const reasons = []
59
+ const add = (value) => {
60
+ if (value === undefined || value === null || value === "") return
61
+ const text = line(value)
62
+ if (!reasons.includes(text)) reasons.push(text)
63
+ }
64
+ add(syncProblem)
65
+ if (ready) return reasons
66
+ add(payload.admission?.summary)
67
+ add(payload.summary)
68
+ for (const blocker of Array.isArray(payload.admission?.blockers) ? payload.admission.blockers : []) add(blocker)
69
+ add(payload.status_error)
70
+ if (payload.root?.valid === false) add(`desk root ${payload.root.path ?? "(none)"}: ${payload.root.diagnostic ?? "not usable"}`)
71
+ if (reasons.length === 0) add(payload.code ?? "Desk is not ready")
72
+ return reasons
73
+ }
74
+
75
+ function syncLine(sync) {
76
+ if (typeof sync === "string") return sync
77
+ if (sync === null || typeof sync !== "object") return null
78
+ if (sync.blocked === true) return `push blocked${sync.reason ? ` (${sync.reason})` : ""}${sync.unpushed > 0 ? `: ${sync.unpushed} local commit(s) not on the remote` : ""}`
79
+ if (syncDegradation(sync.last_pull) !== null) return `last pull failed${sync.last_pull.cause ? ` (${sync.last_pull.cause})` : ""}: not known to be in sync`
80
+ if (sync.behind > 0) return `${sync.behind} commit(s) behind origin`
81
+ if (sync.ahead > 0) return `${sync.ahead} commit(s) ahead of origin, not pushed yet`
82
+ return "in sync"
83
+ }
84
+
85
+ function notesFor(payload) {
86
+ const notes = []
87
+ if (typeof payload.search?.old_index_removed === "string") notes.push(payload.search.old_index_removed)
88
+ const sync = typeof payload.sync === "object" && payload.sync !== null ? payload.sync : null
89
+ if (sync?.blocked === true) notes.push(`Pushing the desk is blocked${sync.reason ? ` (${sync.reason})` : ""}${sync.unpushed > 0 ? `: ${sync.unpushed} local commit(s) are only on this machine, so do not call them pushed` : ""}.`)
90
+ // The latest thing Desk repaired by itself in this session (at its start, the checkout switched back to the state branch, for example), in the repair log's own words: the agent was not there to see it.
91
+ if (typeof payload.repair === "string") notes.push(payload.repair)
92
+ return notes
93
+ }
94
+
95
+ // A diagnostic that is not ready carries what the agent must act on (the onboarding remediation, the binding path, the
96
+ // paths tried); those payloads are small, so the keys are passed through whole.
97
+ const DIAGNOSTIC_KEYS = ["mode", "reason", "reason_detail", "binding_path", "paths_tried", "remediation"]
98
+
99
+ const DETAIL_PENDING_SUMMARY = "Desk is ready, but its details (root, search, sync) are still loading, so the empty fields below are not a missing desk. Do not wait on it: task_focus the task you are on, or task_create one with focus: true (desk:start-task), so your work has a desk folder. Call desk_status again shortly."
100
+ // The usual first answer of a session: the desk the session admitted is already named, and only the runtime's own detail is still to come.
101
+ const DETAIL_PENDING_ROOTED_SUMMARY = "Desk is ready, but its details (search, sync) are still loading, so the empty fields below are not a fault. Do not wait on it: task_focus the task you are on, or task_create one with focus: true (desk:start-task), so your work has a desk folder. Call desk_status again shortly."
102
+
103
+ // The first line of a runtime status error, at most 200 characters, so a stack or a long message never fills the answer.
104
+ function errorLine(error) {
105
+ const first = error.trim().split(/\r?\n/u)[0].trim()
106
+ if (first === "") return "unknown error"
107
+ return first.length > 200 ? `${first.slice(0, 199)}…` : first
108
+ }
109
+
110
+ const statusErrorSummary = (error) => `Desk is ready, but its runtime status failed (${error}), so the empty fields below (root, search, sync) are not a missing desk. Call desk_status again; if it fails the same way, call desk_doctor.`
111
+ const NO_DETAIL_SUMMARY = "Desk is ready, but this answer carries no runtime detail (the runtime is not loaded, or Desk is in refuse mode), so the empty root, search and sync fields below are not a missing desk. Call desk_doctor to see why."
112
+
113
+ // What the compact answer shows of the full answer's `runtime`: who is serving, not the runtime's own diagnostics.
114
+ const identityOf = ({ plugin, plugin_root, source_mirror_path, source_mirror_hash, loaded, newest_release, refresh, swapped_at, from }) => (
115
+ { plugin, plugin_root, source_mirror_path, source_mirror_hash, loaded, ...(newest_release === undefined ? {} : { newest_release }),
116
+ ...(refresh === undefined ? {} : { refresh }), ...(swapped_at === undefined ? {} : { swapped_at, from }) })
117
+ // The fields of the compact answer that stay empty while the runtime's status is pending.
118
+ const COMPACT_PENDING = ["activation", "write_scope", "sync"]
119
+
120
+ /** The compact answer for a full desk_status payload (already merged with the admission fields). */
121
+ export function compactStatus(payload) {
122
+ const syncProblem = syncDegradation(payload.sync?.last_pull)
123
+ const base = stateWord(payload)
124
+ // A desk that is otherwise ready is degraded by a failed sync, exactly as the boot script reports it.
125
+ const state = base === "ready" ? healthWord(syncProblem === null ? [] : [syncProblem]) : base
126
+ // Search in plain words: ready, or how many sections are still being prepared.
127
+ const search = payload.search?.message ?? "not_checked"
128
+ // Only the session's first admission is a start; a desk that re-admits after a change keeps its own summary and fix.
129
+ const starting = base === "admitting" && payload.admission?.starting === true
130
+ // Desk is ready, but the runtime's status detail missed this call's short budget: the root, search and sync fields below are empty because they are not loaded yet, not because there is no desk.
131
+ const detailPending = state === "ready" && payload.detail_pending === true
132
+ // The other ways a ready desk answers without its root, each with its own cause, so the empty fields are never read as "no desk".
133
+ const statusError = state === "ready" && typeof payload.status_error === "string" ? errorLine(payload.status_error) : null
134
+ const noDetail = state === "ready" && !detailPending && statusError === null && !payload.root?.path
135
+ const readySummary = detailPending ? (payload.root?.path ? DETAIL_PENDING_ROOTED_SUMMARY : DETAIL_PENDING_SUMMARY) : statusError !== null ? statusErrorSummary(statusError) : noDetail ? NO_DETAIL_SUMMARY : "Desk is ready."
136
+ const compact = {
137
+ state,
138
+ summary: state === "ready" ? readySummary : starting ? startingSummary(payload.admission) : (base === "ready" ? "Desk works, but the last sync failed." : (payload.admission?.summary ?? payload.summary ?? "Desk is not ready.")),
139
+ degraded: state === "ready" ? [] : whyNotReady(payload, syncProblem, base === "ready"),
140
+ ...(state === "ready" || !payload.code ? {} : { code: payload.code }),
141
+ ...(state === "ready" ? {} : starting ? { fix: STARTING_FIX } : base === "ready" ? { fix: `Retry the sync: git -C ${shellQuote(payload.root?.path ?? "<desk>")} fetch --no-tags origin. Work continues on local state until it succeeds.` } : (payload.fix ? { fix: payload.fix } : {})),
142
+ ...(typeof payload.onboarding_skill === "string" ? { onboarding_skill: payload.onboarding_skill } : {}),
143
+ ...(state === "ready" ? {} : Object.fromEntries(DIAGNOSTIC_KEYS.filter((key) => payload[key] !== undefined).map((key) => [key, payload[key]]))),
144
+ ...(payload.activation?.selected_id ? { activation: { selected_id: payload.activation.selected_id, chain: payload.activation.chain ?? [] } } : {}),
145
+ search,
146
+ notes: notesFor(payload),
147
+ ...(detailPending ? { detail_pending: true } : {}),
148
+ ...(statusError === null ? {} : { status_error: statusError }),
149
+ root: { path: payload.root?.path ?? null, source: payload.root?.source ?? null },
150
+ // The person a migration or a person-scoped write needs (`--tools-person`); null for a single-person desk. `source` says where a person came from.
151
+ write_scope: {
152
+ mode: payload.write_scope?.mode ?? null,
153
+ person: payload.write_scope?.person ?? null,
154
+ ...(typeof payload.write_scope?.source === "string" ? { source: payload.write_scope.source } : {}),
155
+ },
156
+ sync: syncLine(payload.sync),
157
+ plugin_version: payload.runtime?.plugin?.version ?? null,
158
+ ...(typeof payload.plugin_update?.line === "string" ? { plugin_update: { line: payload.plugin_update.line, relay: payload.plugin_update.relay } } : {}),
159
+ ...(payload.runtime?.plugin_root === undefined ? {} : { runtime: identityOf(payload.runtime) }),
160
+ ...(detailPending && Array.isArray(payload.pending) ? { pending: payload.pending.filter((field) => COMPACT_PENDING.includes(field)) } : {}),
161
+ ...(payload.status_detail === undefined ? {} : { status_detail: payload.status_detail }),
162
+ detail: DETAIL_POINTER,
163
+ }
164
+ return compact
165
+ }
@@ -0,0 +1,26 @@
1
+ import { serializeError } from "./admission-worker.js"
2
+ import { rootStatus } from "./status-root.js"
3
+
4
+ export function inspectStatusInputs({ deskRoot, phase = "root", rootContext }) {
5
+ if (phase === "root") return rootStatus(deskRoot, rootContext)
6
+ throw Object.assign(new TypeError(`Use a known status inspection phase: unknown status inspection phase: ${phase}`), { code: "status_inspection_child_use_a_known_status_inspection" })
7
+ }
8
+
9
+ export function attachStatusInspectionChild(port) {
10
+ if (!port) return false
11
+ // This dedicated reader owns no work after its parent closes IPC. Exit even
12
+ // when a host preload has left timers or signal handlers in the process.
13
+ port.once("disconnect", () => port.exit(0))
14
+ port.on("message", (input) => {
15
+ let reply
16
+ try {
17
+ reply = { ok: true, value: inspectStatusInputs(input) }
18
+ } catch (error) {
19
+ reply = { ok: false, error: serializeError(error) }
20
+ }
21
+ port.send(reply)
22
+ })
23
+ return true
24
+ }
25
+
26
+ attachStatusInspectionChild(process.send ? process : null)
@@ -0,0 +1,147 @@
1
+ import { fork } from "node:child_process"
2
+ import { fileURLToPath } from "node:url"
3
+ import { reviveError } from "./admission-worker.js"
4
+
5
+ const childEntry = fileURLToPath(new URL("./status-inspection-child.js", import.meta.url))
6
+ const ownedInspections = new WeakMap()
7
+
8
+ export function waitForStatusInspection(signal) {
9
+ return ownedInspections.get(signal)?.wait() ?? Promise.resolve()
10
+ }
11
+
12
+ // The child once read the on-disk index, which SQLite could not do safely on a worker thread on Windows. It now reads only
13
+ // the desk root, so a later change can drop the child. The session's single status run owns its lifetime, not each tools/call.
14
+ export function inspectStatusDb(deskRoot, { signal, phase = "root", spawn = fork } = {}) {
15
+ const reader = createStatusInspection(deskRoot, { signal, spawn })
16
+ return reader.inspect(phase).finally(() => reader.close())
17
+ }
18
+
19
+ export function createStatusInspection(deskRoot, {
20
+ signal, spawn = fork, closeGraceMs = 100, terminateGraceMs = 100, killGraceMs = 200,
21
+ } = {}) {
22
+ signal?.throwIfAborted()
23
+ const child = spawn(childEntry, [], {
24
+ execArgv: [], stdio: ["ignore", "ignore", "inherit", "ipc"],
25
+ windowsHide: true, serialization: "advanced",
26
+ })
27
+ let pending = null
28
+ let failure = null
29
+ let closing = false
30
+ let ended = false
31
+ let resolveClosed
32
+ const closed = new Promise((resolve) => { resolveClosed = resolve })
33
+ let terminationTimer = null
34
+ const resource = { pid: child.pid ?? null, exited: false, signals: [], failures: [] }
35
+ const wait = async () => {
36
+ const outcome = await closed
37
+ if (outcome.error) throw outcome.error
38
+ }
39
+ if (signal) ownedInspections.set(signal, { child, wait })
40
+ const nonexit = () => {
41
+ terminationTimer = null
42
+ const error = Object.assign(new Error(`Stop that child process by hand: status inspection child did not exit after bounded termination (pid ${resource.pid})`), {
43
+ code: "status_reader_not_exited", pid: resource.pid,
44
+ signals: [...resource.signals], failures: [...resource.failures],
45
+ })
46
+ pending?.reject(error)
47
+ pending = null
48
+ // Keep the exact child and rejected wait in ownedInspections until its real
49
+ // exit. A replacement must fail rather than overlap an unaccounted reader.
50
+ resolveClosed({ error })
51
+ }
52
+ const terminate = (name, next, ms) => {
53
+ resource.signals.push(name)
54
+ // `kill` returns false when the process no longer exists. On Windows that includes a child that has just exited by itself and whose exit event has not arrived yet (POSIX still signals such a child and returns true). That is the stop this close wanted, so a false return is a failure only if the child has still not exited when this step's grace ends.
55
+ let unsent = false
56
+ try {
57
+ unsent = !child.kill(name)
58
+ } catch (error) {
59
+ resource.failures.push(`${name}: ${error.message}`)
60
+ failure ??= Object.assign(new Error(`Stop that child process by hand: status inspection child termination failed (pid ${resource.pid}, ${name}): ${error.message}`), {
61
+ code: "status_reader_termination_failed", pid: resource.pid, signal: name,
62
+ })
63
+ }
64
+ if (!ended) terminationTimer = setTimeout(() => {
65
+ if (unsent) {
66
+ resource.failures.push(`${name}: child.kill returned false`)
67
+ failure ??= Object.assign(new Error(`Stop that child process by hand: status inspection child termination failed (pid ${resource.pid}, ${name})`), {
68
+ code: "status_reader_termination_failed", pid: resource.pid, signal: name,
69
+ })
70
+ }
71
+ next()
72
+ }, ms)
73
+ }
74
+ const force = () => {
75
+ terminationTimer = null
76
+ terminate("SIGKILL", nonexit, killGraceMs)
77
+ }
78
+ const graceful = () => {
79
+ terminationTimer = null
80
+ terminate("SIGTERM", force, terminateGraceMs)
81
+ }
82
+ const stop = (error) => {
83
+ failure ??= error
84
+ if (ended || closing) return
85
+ closing = true
86
+ graceful()
87
+ }
88
+ const abort = () => stop(signal.reason)
89
+ signal?.addEventListener("abort", abort, { once: true })
90
+ child.once("error", stop)
91
+ child.on("message", (message) => {
92
+ if (!pending) return stop(Object.assign(new Error("Call desk_status again: status inspection child sent an unexpected reply"), { code: "status_inspection_call_desk_status_again_status_4" }))
93
+ const reply = pending
94
+ pending = null
95
+ if (message?.ok === true) reply.resolve(message.value)
96
+ else if (message?.ok === false) reply.reject(reviveError(message.error))
97
+ else {
98
+ const error = Object.assign(new Error("Call desk_status again: status inspection child sent an invalid reply"), { code: "status_inspection_call_desk_status_again_status_3" })
99
+ reply.reject(error)
100
+ stop(error)
101
+ }
102
+ })
103
+ const finish = (code, exitSignal) => {
104
+ if (ended) return
105
+ ended = true
106
+ resource.exited = true
107
+ clearTimeout(terminationTimer)
108
+ terminationTimer = null
109
+ signal?.removeEventListener("abort", abort)
110
+ if (signal) ownedInspections.delete(signal)
111
+ failure ??= closing && (code === 0 || resource.signals.includes(exitSignal)) ? null :
112
+ Object.assign(new Error(`Call desk_status again: status inspection child exited before completing (code ${code})`), { code: "status_inspection_call_desk_status_again_status_2" })
113
+ if (pending && failure === null) failure = Object.assign(new Error("Call desk_status again: status inspection child exited before completing its request"), { code: "status_inspection_call_desk_status_again_status" })
114
+ pending?.reject(failure)
115
+ pending = null
116
+ resolveClosed({ error: null })
117
+ }
118
+ child.once("exit", finish)
119
+ child.once("close", finish)
120
+ return {
121
+ resource,
122
+ inspect(phase, rootContext) {
123
+ signal?.throwIfAborted()
124
+ if (ended) return Promise.reject(failure ?? Object.assign(new Error("Open a new status inspection: status inspection already closed"), { code: "status_inspection_open_a_new_status_inspection" }))
125
+ if (pending) return Promise.reject(Object.assign(new Error("Wait for the running inspection to finish: status inspection already running"), { code: "status_inspection_wait_for_the_running_inspection" }))
126
+ return new Promise((resolve, reject) => {
127
+ pending = { resolve, reject }
128
+ child.send({ deskRoot, phase, rootContext }, (error) => { if (error) stop(error) })
129
+ })
130
+ },
131
+ async close() {
132
+ if (!closing && !ended) {
133
+ closing = true
134
+ terminationTimer = setTimeout(graceful, closeGraceMs)
135
+ try {
136
+ child.disconnect()
137
+ } catch (error) {
138
+ failure ??= error
139
+ clearTimeout(terminationTimer)
140
+ graceful()
141
+ }
142
+ }
143
+ await wait()
144
+ if (failure !== null) throw failure
145
+ },
146
+ }
147
+ }
@@ -0,0 +1,39 @@
1
+ import { existsSync } from "node:fs"
2
+
3
+ export function rootStatus(deskRoot, rootContext = {}) {
4
+ const pathValue = typeof deskRoot === "string" && deskRoot.trim().length > 0
5
+ ? deskRoot
6
+ : null
7
+ const source = typeof rootContext?.source === "string" && rootContext.source.trim().length > 0
8
+ ? rootContext.source
9
+ : "unknown"
10
+ const tried = Array.isArray(rootContext?.tried)
11
+ ? rootContext.tried.filter(isRootAttempt)
12
+ : []
13
+ const exists = pathValue === null ? false : existsSync(pathValue)
14
+ const malformed_context = rootContext !== null
15
+ && typeof rootContext === "object"
16
+ && (rootContext.source !== undefined && source === "unknown"
17
+ || rootContext.tried !== undefined && !Array.isArray(rootContext.tried))
18
+
19
+ return {
20
+ path: pathValue,
21
+ source,
22
+ tried,
23
+ exists,
24
+ valid: exists,
25
+ diagnostic: exists ? null : rootDiagnostic(pathValue),
26
+ malformed_context,
27
+ }
28
+ }
29
+
30
+ function isRootAttempt(value) {
31
+ return value !== null
32
+ && typeof value === "object"
33
+ && typeof value.source === "string"
34
+ && typeof value.path === "string"
35
+ }
36
+
37
+ function rootDiagnostic(pathValue) {
38
+ return pathValue === null ? "missing_desk_root" : "desk_root_not_found"
39
+ }