@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,141 @@
1
+ // The two body edits `task_update` makes for the agent, so a task card's progress is only ever written through
2
+ // Desk's tools: `note` appends a dated line to the card's `## Progress log`, and `next_step` replaces the card's
3
+ // recorded `**Next step:**` paragraph. An agent that could edit the card freely once wrote "Push routing
4
+ // confirmed ... scenario is handled" into it with no PR and no check (boot acceptance round A); the desk's
5
+ // pre-commit hook (desk/card-commit-guard.js) now refuses a hand commit of a card.
6
+ //
7
+ // Both edits read the body line by line and ignore fenced code blocks, so a marker or heading quoted inside a
8
+ // fence is never mistaken for the card's own. Line endings are kept: a card written with CRLF stays CRLF.
9
+
10
+ const PROGRESS_HEADING = "## Progress log"
11
+ const NEXT_STEP_MARKER = "**Next step:**"
12
+ const FENCE = /^\s{0,3}(`{3,}|~{3,})/u
13
+ const LIST_ITEM = /^\s*(?:[-*+]|\d+[.)])\s/u
14
+ const HEADING = /^#{1,6}\s/u
15
+
16
+ /** One logical line: a note or next step never carries the line breaks that would split a bullet or paragraph. */
17
+ function oneLine(text) {
18
+ return text.trim().replace(/\s*\r?\n\s*/gu, " ")
19
+ }
20
+
21
+ /** The body's lines, its line ending, and which lines sit inside a fenced code block (fence lines included). */
22
+ export function scan(body) {
23
+ const eol = body.includes("\r\n") ? "\r\n" : "\n"
24
+ const lines = body.split(/\r?\n/u)
25
+ const fenced = []
26
+ let open = null
27
+ for (const line of lines) {
28
+ const match = FENCE.exec(line)
29
+ if (open === null) {
30
+ fenced.push(match !== null)
31
+ if (match !== null) open = match[1]
32
+ } else {
33
+ fenced.push(true)
34
+ if (match !== null && match[1][0] === open[0] && match[1].length >= open.length && line.trim() === match[1]) open = null
35
+ }
36
+ }
37
+ return { eol, lines, fenced, open: open !== null }
38
+ }
39
+
40
+ function appendParagraph(body, paragraph, eol) {
41
+ const trimmed = body.replace(/\s+$/u, "")
42
+ return `${trimmed === "" ? "" : `${trimmed}${eol}${eol}`}${paragraph}${eol}`
43
+ }
44
+
45
+ /** Where the paragraph that starts at `start` ends: at a blank line, a list item, a heading or a fence. */
46
+ function paragraphEnd(lines, fenced, start) {
47
+ let end = start + 1
48
+ while (end < lines.length && lines[end].trim() !== "" && !LIST_ITEM.test(lines[end]) && !HEADING.test(lines[end]) && !fenced[end]) end += 1
49
+ return end
50
+ }
51
+
52
+ /**
53
+ * The body with its `**Next step:**` paragraph replaced by `text`: the first marker outside a fenced code block is
54
+ * replaced and any later ones are dropped. A card with none gets the paragraph appended.
55
+ */
56
+ export function replaceNextStep(body, text) {
57
+ const { eol, lines, fenced } = scan(body)
58
+ const paragraph = `${NEXT_STEP_MARKER} ${oneLine(text)}`
59
+ const out = []
60
+ let replaced = false
61
+ for (let index = 0; index < lines.length;) {
62
+ if (fenced[index] || !lines[index].startsWith(NEXT_STEP_MARKER)) {
63
+ out.push(lines[index])
64
+ index += 1
65
+ continue
66
+ }
67
+ const end = paragraphEnd(lines, fenced, index)
68
+ if (!replaced) {
69
+ out.push(paragraph)
70
+ replaced = true
71
+ index = end
72
+ } else {
73
+ // A duplicate goes, with the blank line that separated it.
74
+ index = end < lines.length && lines[end].trim() === "" ? end + 1 : end
75
+ }
76
+ }
77
+ return replaced ? out.join(eol) : appendParagraph(body, paragraph, eol)
78
+ }
79
+
80
+ /**
81
+ * The body with `- <date>: <note>` added at the end of its `## Progress log` section (the first such heading outside
82
+ * a fenced code block); the section is created at the end of the card when it is missing.
83
+ */
84
+ export function appendProgressNote(body, text, date) {
85
+ const { eol, lines, fenced } = scan(body)
86
+ const bullet = `- ${date}: ${oneLine(text)}`
87
+ const heading = lines.findIndex((line, index) => !fenced[index] && line.trim() === PROGRESS_HEADING)
88
+ if (heading === -1) return appendParagraph(body, `${PROGRESS_HEADING}${eol}${eol}${bullet}`, eol)
89
+ let end = heading + 1
90
+ while (end < lines.length && (fenced[end] || !/^## /u.test(lines[end]))) end += 1
91
+ let last = end - 1
92
+ while (last > heading && lines[last].trim() === "") last -= 1
93
+ const spacer = last === heading ? [""] : []
94
+ return [...lines.slice(0, last + 1), ...spacer, bullet, ...lines.slice(last + 1)].join(eol)
95
+ }
96
+
97
+ /**
98
+ * The body with the first `## <heading>` section outside a fenced code block given `markdown` as its content, up to the next `## ` heading (the heading line stays). A card without that section gets it appended.
99
+ * The replacement may not hold a `## ` heading of its own outside a fence, because that would split the section it replaces; only the body is touched, never the frontmatter.
100
+ */
101
+ export function replaceSection(body, heading, markdown) {
102
+ const name = typeof heading === "string" ? heading.trim().replace(/^##\s+/u, "").trim() : ""
103
+ if (name === "" || /[\r\n]/u.test(name)) throw Object.assign(new Error("Pass `replace_section.heading` as the name of one `## ` section on a single line: `replace_section.heading` must be the name of one `## ` section on a single line, such as \"Progress log\""), { code: "task_body_pass_replace_section_heading_as" })
104
+ if (/^(?:steps|resources)$/iu.test(name)) throw Object.assign(new Error(`Use the table's own field instead of \`replace_section\`: \`replace_section\` cannot replace the \`## ${name}\` table, because Desk checks every change to it; use the \`${name.toLowerCase() === "steps" ? "step" : "resource"}\` field instead`), { code: "task_body_use_the_table_s_own" })
105
+ if (typeof markdown !== "string" || markdown.trim() === "") throw Object.assign(new Error("Pass the new text in `replace_section.markdown`: `replace_section.markdown` must be the new text of the section, not empty"), { code: "task_body_pass_the_new_text_in" })
106
+ const inner = scan(markdown)
107
+ if (inner.open) throw Object.assign(new Error("Close the code fence in `replace_section.markdown`: `replace_section.markdown` has a code fence that is never closed; close the code fence in replace_section.markdown"), { code: "task_body_close_the_code_fence_in" })
108
+ if (inner.lines.some((line, index) => !inner.fenced[index] && /^## /u.test(line))) throw Object.assign(new Error("Pass one section at a time in `replace_section.markdown`: `replace_section.markdown` must not contain its own `## ` heading; pass one section at a time"), { code: "task_body_pass_one_section_at_a" })
109
+ const { eol, lines, fenced } = scan(body)
110
+ const text = markdown.trim().split(/\r?\n/u)
111
+ const start = lines.findIndex((line, index) => !fenced[index] && line.trimEnd() === `## ${name}`)
112
+ if (start === -1) return appendParagraph(body, [`## ${name}`, "", ...text].join(eol), eol)
113
+ let end = start + 1
114
+ while (end < lines.length && (fenced[end] || !/^## /u.test(lines[end]))) end += 1
115
+ const tail = end < lines.length ? ["", ...lines.slice(end)] : [""]
116
+ return [...lines.slice(0, start + 1), "", ...text, ...tail].join(eol)
117
+ }
118
+
119
+ /** Today's date in the operator's own time zone, `YYYY-MM-DD`. */
120
+ export function localDate(now = new Date()) {
121
+ const two = (value) => String(value).padStart(2, "0")
122
+ return `${now.getFullYear()}-${two(now.getMonth() + 1)}-${two(now.getDate())}`
123
+ }
124
+
125
+ /**
126
+ * The last `count` entries of the card's `## Progress log` section (the first such heading outside a fenced code
127
+ * block), oldest first: each list item is one entry, trimmed of its bullet and cut to `cap` characters with an
128
+ * ellipsis. A card with no such section has no entries.
129
+ */
130
+ export function recentProgress(body, count, cap) {
131
+ const { lines, fenced } = scan(body)
132
+ const heading = lines.findIndex((line, index) => !fenced[index] && line.trim() === PROGRESS_HEADING)
133
+ if (heading === -1) return []
134
+ const entries = []
135
+ for (let index = heading + 1; index < lines.length && (fenced[index] || !/^## /u.test(lines[index])); index += 1) {
136
+ if (fenced[index] || !LIST_ITEM.test(lines[index])) continue
137
+ const entry = lines[index].replace(/^\s*(?:[-*+]|\d+[.)])\s+/u, "").trim()
138
+ if (entry !== "") entries.push(entry.length > cap ? `${entry.slice(0, cap - 1)}…` : entry)
139
+ }
140
+ return entries.slice(-count)
141
+ }
@@ -0,0 +1,164 @@
1
+ // task_focus — a session's main agent declares the task it is working on.
2
+ //
3
+ // The factory reads these calls from the transcript to credit the session's time to that task (the transcript is the
4
+ // only record: nothing here is written to disk). The call is light on purpose: no network, no git, no card write. It
5
+ // answers with the card's status and its last progress entries, so declaring is also the cheapest way to see where
6
+ // the task stands.
7
+ //
8
+ // The held focus lives in the session layer (runtime/desk-session.js), handed in as `statusContext.focus`:
9
+ // `{ get(): { track, slug } | null, set(value), declared(): boolean }`. The hints built here are only hints:
10
+ // no tool call fails, waits or changes because focus is unset or different, and every hint is worded for the
11
+ // session's main agent because a subagent shares the session's server.
12
+
13
+ import * as path from "node:path"
14
+ import { readMarkdown, pathExists } from "../util/fm.js"
15
+ import { EFFECTIVE_ROOT_MISSING, deskRelativePath, resolveWriteTarget, validateWriteSegment } from "../util/paths.js"
16
+ import { recentProgress } from "./task-body.js"
17
+ import { nextStepOf } from "../desk/active-tasks.js"
18
+ import { redactCredentialLikeText } from "../util/redact.js"
19
+ import { makeSessionLabelProposal } from "../runtime/session-label.js"
20
+ import { archiveDueAnswer } from "./task-archive-due.js"
21
+ import { SHELF_FILE, readShelf, shelfForTask } from "../runtime/lessons-shelf.js"
22
+ import { logSummary } from "./task-log.js"
23
+ import { otherDeskHoldingCard } from "../util/desk-owner.js"
24
+ import { deskFailure } from "../runtime/desk-failure.js"
25
+
26
+ export const TASK_FOCUS_FIELDS = ["track", "slug", "clear", "display_label"]
27
+
28
+ /** How many progress entries a focus answer carries, and the longest an entry may be (longer ones end in an ellipsis). */
29
+ export const PROGRESS_ENTRIES = 5
30
+ export const PROGRESS_ENTRY_CHARS = 300
31
+
32
+ const ACCEPTED = "pass `track` and `slug` to focus a task, or `clear: true` alone to declare no task; `display_label` is optional only with a task"
33
+
34
+ export const NO_FOCUS_HINT = "If you are the session's main agent: no task in focus; call task_focus with the task you are working on, or with clear: true for none."
35
+ export const focusedHint = ({ track, slug }) => `If you are the session's main agent: focused on ${track}/${slug}; call task_focus if you have switched tasks, or with clear: true for none.`
36
+
37
+ const sameTask = (a, b) => a.track === b.track && a.slug === b.slug
38
+
39
+ function folderName(field, value) {
40
+ if (typeof value !== "string") throw Object.assign(new Error(`task_focus: Pass \`${field}\` as a string: \`${field}\` must be a string; ${ACCEPTED}`), { code: "task_focus_must_be_a_string" })
41
+ try {
42
+ validateWriteSegment(value)
43
+ } catch {
44
+ throw Object.assign(new Error(`task_focus: Pass \`${field}\` as a task folder name: \`${field}\` is not a valid task folder name; ${ACCEPTED}`), { code: "task_focus_is_not_a_valid_task" })
45
+ }
46
+ return value
47
+ }
48
+
49
+ // The card at its live path, else under the track's `_archive`, else in a track that was archived whole into the desk's `_archive/`
50
+ // (`trackArchived`; the track is archived once its tasks are terminal, often before the operator answers a delivery). A missing
51
+ // person folder reads as a missing card.
52
+ export async function findCard({ deskRoot, person, track, slug }) {
53
+ const layouts = [[track, slug, "task.md"], [track, "_archive", slug, "task.md"], ["_archive", track, slug, "task.md"], ["_archive", track, "_archive", slug, "task.md"]]
54
+ for (const segments of layouts) {
55
+ let file
56
+ try {
57
+ file = await resolveWriteTarget({ deskRoot, person, segments, createPersonRoot: false })
58
+ } catch (error) {
59
+ if (!String(error?.message).startsWith(EFFECTIVE_ROOT_MISSING)) throw error
60
+ return null
61
+ }
62
+ if (await pathExists(file)) return { file, archived: segments.includes("_archive"), trackArchived: segments[0] === "_archive" }
63
+ }
64
+ return null
65
+ }
66
+
67
+ /**
68
+ * The lessons on this person's shelf (LESSONS.md beside their AGENTS.md) for a session focusing the task described by
69
+ * `task` (any text about it), as `{ path, lessons, not_shown }`, or undefined when there is no shelf or it cannot be
70
+ * read. lesson_add moves lessons there when AGENTS.md outgrows what session start prints; this is where they load.
71
+ */
72
+ export async function shelvedLessons({ deskRoot, person, task }) {
73
+ let file
74
+ try {
75
+ file = await resolveWriteTarget({ deskRoot, person, segments: [SHELF_FILE], createPersonRoot: false })
76
+ } catch {
77
+ return undefined
78
+ }
79
+ const shelf = readShelf(path.dirname(file))
80
+ if (shelf === null) return undefined
81
+ const { shown, not_shown: notShown } = shelfForTask(shelf.entries, task)
82
+ return { path: deskRelativePath(deskRoot, file), lessons: shown.map(redactCredentialLikeText), not_shown: notShown }
83
+ }
84
+
85
+ /**
86
+ * task_focus
87
+ *
88
+ * Input: { track, slug } or { clear: true }
89
+ *
90
+ * Returns: { status: "focused", track, slug, task_status, title, recent_progress: [string], next_step: string | null, archived?: true,
91
+ * shelved_lessons?: { path, lessons: [string], not_shown } } or { status: "cleared" }. `shelved_lessons` carries the
92
+ * person's shelved lessons (see `shelvedLessons`) when they have any, those closest to this task first. `title` is the card's title (null when it has none), which names the session's Orca tab (runtime/orca-session-title.js). A card found only under `_archive/` is still focused (a session may be wrapping up or
93
+ * reopening finished work) and the answer says `archived: true`. `log` names the task's `log.md` with its entry count and newest entry when it has one. `recent_progress` is the last PROGRESS_ENTRIES entries
94
+ * of the card's `## Progress log`, each cut to PROGRESS_ENTRY_CHARS characters, and is empty when the card has none.
95
+ * Throws `card not found: <track>/<slug>` for a missing card, leaving the focus as it was.
96
+ */
97
+ export async function taskFocus({ deskRoot, input, person = null, statusContext = {} }) {
98
+ const values = input ?? {}
99
+ const { track, slug, clear, display_label: displayLabel } = values
100
+ const named = track !== undefined || slug !== undefined
101
+ if (clear !== undefined && clear !== true) throw Object.assign(new Error(`task_focus: \`clear\` can only be true; ${ACCEPTED}`), { code: "task_focus_clear_can_only_be_true" })
102
+ if (clear === true && named) throw Object.assign(new Error(`task_focus: \`clear\` cannot be combined with \`track\` or \`slug\`; ${ACCEPTED}`), { code: "task_focus_clear_cannot_be_combined_with_2" })
103
+ if (clear === true && displayLabel !== undefined) throw Object.assign(new Error(`task_focus: \`clear\` cannot be combined with \`display_label\`; ${ACCEPTED}`), { code: "task_focus_clear_cannot_be_combined_with" })
104
+ if (clear === true) {
105
+ statusContext.focus?.set(null)
106
+ return { status: "cleared" }
107
+ }
108
+ if (track === undefined || slug === undefined) throw Object.assign(new Error(`task_focus: Pass \`track\` and \`slug\`: \`track\` and \`slug\` are both required; ${ACCEPTED}`), { code: "task_focus_track_and_slug_are_both" })
109
+ folderName("track", track)
110
+ folderName("slug", slug)
111
+
112
+ const found = await findCard({ deskRoot, person, track, slug })
113
+ if (found === null) {
114
+ const holder = otherDeskHoldingCard(deskRoot, track, slug)
115
+ if (holder !== null) {
116
+ const code = "task_focus_card_in_another_desk"
117
+ const from = path.join(holder.root, track, slug)
118
+ const into = path.join(path.resolve(deskRoot), track)
119
+ throw Object.assign(new Error(deskFailure({
120
+ code,
121
+ thing: "task_focus: card",
122
+ probably: `${track}/${slug} is in the ${holder.name} desk at ${holder.root}, not in the ${path.resolve(deskRoot)} desk this session is bound to`,
123
+ look: "call desk_status to see which desk this session is bound to and why",
124
+ keepWorking: `to admit the card here, run \`mkdir -p ${into} && cp -R ${from} ${into}/\`, then call task_update with {"track":"${track}","slug":"${slug}","note":"moved from ${holder.name}"} (it commits and publishes the card), then task_focus again; afterwards remove it from ${holder.root} with Git`,
125
+ fix: `or start the session from a repository the ${holder.name} desk serves, or pass --root ${holder.root}`,
126
+ })), { code, owner_desk: holder.root })
127
+ }
128
+ throw Object.assign(new Error(`Check the track and slug, then try again: card not found: ${track}/${slug}`), { code: "task_focus_check_the_track_and_slug" })
129
+ }
130
+ const card = await readMarkdown(found.file)
131
+ statusContext.focus?.set({ track, slug })
132
+ const result = {
133
+ status: "focused",
134
+ track,
135
+ slug,
136
+ task_status: typeof card.data.status === "string" ? card.data.status : null,
137
+ title: typeof card.data.title === "string" ? redactCredentialLikeText(card.data.title) : null,
138
+ recent_progress: recentProgress(card.content, PROGRESS_ENTRIES, PROGRESS_ENTRY_CHARS).map(redactCredentialLikeText),
139
+ next_step: nextStepOf(card.content),
140
+ }
141
+ if (card.data.planning_complete === true) result.planning_complete = true
142
+ if (found.archived) result.archived = true
143
+ const log = logSummary(deskRoot, found.file)
144
+ if (log !== undefined) result.log = log
145
+ const lessons = await shelvedLessons({ deskRoot, person, task: [track, slug, card.data.title, result.next_step].join(" ") })
146
+ if (lessons !== undefined) result.shelved_lessons = lessons
147
+ const proposal = makeSessionLabelProposal({ task: { track, slug }, displayLabel })
148
+ if (proposal.code !== "missing_safe_label") result.session_label = proposal
149
+ Object.assign(result, archiveDueAnswer({ track, slug, status: card.data.status, archived: found.archived }))
150
+ return result
151
+ }
152
+
153
+ /**
154
+ * The `focus_note` hint a task tool adds to its result, or undefined. `target` is the card an update or archive acted
155
+ * on: a different card than the focus gets the "focused on" hint. With nothing focused and nothing ever declared (a focus
156
+ * set, or a deliberate clear), every task tool call gets the "no task in focus" hint.
157
+ */
158
+ export function focusNote(statusContext, target) {
159
+ const focus = statusContext?.focus
160
+ if (!focus) return undefined
161
+ const current = focus.get()
162
+ if (current === null) return focus.declared() ? undefined : NO_FOCUS_HINT
163
+ return target !== undefined && !sameTask(current, target) ? focusedHint(current) : undefined
164
+ }
@@ -0,0 +1,76 @@
1
+ // `task_update`'s `log`: a dated entry appended to `log.md` beside the task card, the cheap way to keep a long record of
2
+ // rulings, decisions and evidence pointers in Git. The entry is in the file when the call returns; the detached push worker
3
+ // commits it with the entries that follow it (`runtime/append-lane.js`), so ten rapid entries are one commit and one push,
4
+ // a call never waits on a publication that is still running, and the server ending does not lose the commit.
5
+
6
+ import { existsSync, appendFileSync, readFileSync, writeFileSync } from "node:fs"
7
+ import { createHash } from "node:crypto"
8
+ import * as path from "node:path"
9
+ import { assertCleanContentTarget } from "../desk/content-home.js"
10
+ import { deskRelativePath, resolveWriteTarget } from "../util/paths.js"
11
+ import { pathExists } from "../util/fm.js"
12
+ import { scratchPathWarning } from "../desk/scratch-paths.js"
13
+
14
+ const LOG_FILE = "log.md"
15
+ // What this process last wrote to each log: a log holding exactly those bytes is Desk's own entry waiting for its commit, not a held draft.
16
+ const written = new Map()
17
+ const digest = (file) => createHash("sha256").update(readFileSync(file)).digest("hex")
18
+
19
+ const pad = (value) => String(value).padStart(2, "0")
20
+ const stamp = (date) => `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}`
21
+
22
+ /**
23
+ * Appends `text` to the task's log and schedules the push worker that commits it. Returns the answer fields: the log's path
24
+ * and the note that says no git is needed. Throws before writing anything when the task does not exist or the purpose policy
25
+ * refuses; `admission` is the receipt `admitContent` gave this call, which has checked the base.
26
+ */
27
+ export async function appendCardLog({ deskRoot, person, track, slug, text, admission, search, schedulePush, now = new Date() }) {
28
+ const card = await resolveWriteTarget({ deskRoot, person, segments: [track, slug, "task.md"] })
29
+ if (!(await pathExists(card))) {
30
+ throw Object.assign(new Error(`task_update: Check the track and slug, then try again: task does not exist at ${deskRelativePath(deskRoot, card)}`), { code: "task_update_task_does_not_exist_at" })
31
+ }
32
+ const file = path.join(path.dirname(card), LOG_FILE)
33
+ const rel = deskRelativePath(deskRoot, file)
34
+ assertCleanContentTarget(deskRoot, rel, admission, "task_update", written.get(file))
35
+ const entry = `\n## ${stamp(now)}\n\n${text.trim()}\n`
36
+ if (existsSync(file)) appendFileSync(file, entry)
37
+ else writeFileSync(file, `# Log: ${track}/${slug}\n\nAppend-only record for this task, oldest first: rulings, decisions and where the evidence is. Write entries with task_update's \`log\`.\n${entry}`)
38
+ written.set(file, digest(file))
39
+ schedulePush({ root: deskRoot, logs: true })
40
+ search?.noteChange(rel)
41
+ const scratch = scratchPathWarning(text, "This entry")
42
+ return {
43
+ ...(scratch === undefined ? {} : { scratch_paths: scratch }),
44
+ status: "logged",
45
+ path: rel,
46
+ commit: "queued",
47
+ desk_note: "Desk wrote the entry to the log and commits it with the entries that follow within a few seconds as one commit, then pushes once, so run no git for it. Say 'logged', not 'pushed'.",
48
+ }
49
+ }
50
+
51
+ const ENTRY = /^## (\d{4}-\d\d-\d\d \d\d:\d\d)\s*$/u
52
+ const LATEST_CHARS = 240
53
+
54
+ /**
55
+ * What a successor reads first about a task's log: where it is, how many entries it holds and the newest one's start, or
56
+ * undefined when the task has no log. `card` is the card's file.
57
+ */
58
+ export function logSummary(deskRoot, card) {
59
+ const file = path.join(path.dirname(card), LOG_FILE)
60
+ let lines
61
+ try {
62
+ lines = readFileSync(file, "utf8").split(/\r?\n/u)
63
+ } catch {
64
+ return undefined
65
+ }
66
+ const at = lines.flatMap((line, index) => (ENTRY.test(line) ? [index] : []))
67
+ const last = at.at(-1)
68
+ const body = last === undefined ? "" : lines.slice(last + 1).join(" ").replace(/\s+/gu, " ").trim()
69
+ const text = body.length > LATEST_CHARS ? `${body.slice(0, LATEST_CHARS).trimEnd()} ...` : body
70
+ return {
71
+ path: deskRelativePath(deskRoot, file),
72
+ entries: at.length,
73
+ ...(last === undefined ? {} : { latest: `${ENTRY.exec(lines[last])[1]}: ${text}` }),
74
+ note: "Read this log before asking the operator for a ruling or redoing work; it is the record a successor resumes from, not a host checkpoint.",
75
+ }
76
+ }
@@ -0,0 +1,155 @@
1
+ // task_signoff — records the operator's answer to a delivered task: accepted or refused.
2
+ //
3
+ // The one tool that writes `signoff`. A call is recorded as the operator's answer: Desk does not check which turn or which agent made it.
4
+ //
5
+ // A refusal also sends the task back to `processing` and records the return (`refuse`), after bringing an archived card back to the live tree through
6
+ // `task_update`. The card is written, staged, committed and finalized the way `task_update` writes it. Everything is checked before anything is written.
7
+ //
8
+ // The answer carries the slug, codes and the desk-relative card path only: no title, no body text, no absolute path.
9
+
10
+ import * as path from "node:path"
11
+ import { existsSync } from "node:fs"
12
+ import { spawnSync } from "node:child_process"
13
+ import { readMarkdown, patchMarkdownFrontmatter } from "../util/fm.js"
14
+ import { validateWriteSegment } from "../util/paths.js"
15
+ import { readRecord, toFrontmatter, sign, refuse, STATUSES, REFUSAL_REASONS, RETURN_REASONS } from "../factory/outcome.js"
16
+ import { deskFailure } from "../runtime/desk-failure.js"
17
+ import { deskPushNote, schedulePush as schedulePushDefault } from "../runtime/sync-worker.js"
18
+ import { findCard } from "./task-focus.js"
19
+ import { readSteps } from "../desk/steps.js"
20
+ import { refreshSignoffStatus } from "../desk/unsigned-deliveries.js"
21
+ import { moveTask } from "./move.js"
22
+ import { DESK_COMMIT_NOTE, commitHashAnswer, relPath, stagingAllowed, stageAndCommitCard, headSha, updateTrackRow, taskJobOrNull, requestTaskFinalize } from "./task.js"
23
+
24
+ export const TASK_SIGNOFF_FIELDS = ["track", "slug", "outcome", "reason", "return_reason", "desk"]
25
+
26
+ const given = (value) => value !== undefined && value !== null
27
+
28
+ function folderName(field, value) {
29
+ try {
30
+ validateWriteSegment(value)
31
+ } catch {
32
+ throw Object.assign(new Error(`task_signoff: Pass \`${field}\` as a task folder name: \`${field}\` is not a valid task folder name.`), { code: "task_signoff_is_not_a_valid_task" })
33
+ }
34
+ }
35
+
36
+ // Everything the call can get wrong, checked before the card is read.
37
+ function checkInput(values) {
38
+ const { track, slug, outcome, reason, return_reason: returnReason } = values
39
+ if (typeof track !== "string" || typeof slug !== "string") throw Object.assign(new Error("task_signoff: Pass `track` and `slug`: `track` and `slug` are required."), { code: "task_signoff_track_and_slug_are_required" })
40
+ if (outcome !== "accepted" && outcome !== "refused") throw Object.assign(new Error("task_signoff: Pass `outcome` as one of the listed values: `outcome` must be accepted or refused."), { code: "task_signoff_outcome_must_be_accepted_or" })
41
+ folderName("track", track)
42
+ folderName("slug", slug)
43
+ if (outcome === "accepted") {
44
+ if (given(reason) || given(returnReason)) throw Object.assign(new Error("task_signoff: Drop `reason` and `return_reason` from an acceptance: an acceptance takes no `reason` or `return_reason`; drop them."), { code: "task_signoff_an_acceptance_takes_no_reason" })
45
+ return
46
+ }
47
+ if (!REFUSAL_REASONS.includes(reason)) throw Object.assign(new Error(`task_signoff: Pass \`reason\` with a refusal: a refusal needs \`reason\`, the operator's reason, one of ${REFUSAL_REASONS.join(", ")}.`), { code: "task_signoff_a_refusal_needs_reason_the" })
48
+ if (!RETURN_REASONS.includes(returnReason)) throw Object.assign(new Error(`task_signoff: Pass \`return_reason\` with a refusal: a refusal needs \`return_reason\`, your own reading of the cause, one of ${RETURN_REASONS.join(", ")}.`), { code: "task_signoff_a_refusal_needs_return_reason" })
49
+ }
50
+
51
+ // The one sentence the agent includes in its reply.
52
+ function sentence({ slug, outcome, reason, changed }) {
53
+ const lead = changed ? "Recorded" : "Already recorded"
54
+ if (outcome === "refused") return changed ? `${lead}: ${slug} sent back (${reason}); it is back in processing.` : `${lead}: ${slug} sent back.`
55
+ return `${lead}: ${slug} accepted.`
56
+ }
57
+
58
+ /**
59
+ * task_signoff
60
+ *
61
+ * Input: { track, slug, outcome: "accepted" | "refused", reason?, return_reason? }
62
+ *
63
+ * `reason` (the operator's, one of REFUSAL_REASONS) and `return_reason` (the agent's own reading, one of RETURN_REASONS) are required for a refusal and refused for an acceptance.
64
+ * `now` (milliseconds), `finalize` and `refreshSignoff` are injected in tests; `refreshSignoff(env, deskRoot, { now })` refreshes `status.json.signoff`; the default is the session-start scan's own `refreshSignoffStatus`.
65
+ *
66
+ * Returns: { status: "signed" | "unchanged", path, signoff, say, report_as?, report_note?, commit?, desk_commit?, desk_pushed?, desk_note? }.
67
+ * `say` is the sentence the agent includes in its reply. Every refusal of the call writes nothing.
68
+ */
69
+ export async function taskSignoff({
70
+ deskRoot, input, person = null, search, statusContext = {}, env = process.env, spawnGit = spawnSync,
71
+ schedulePush = schedulePushDefault, now = Date.now, finalize = requestTaskFinalize, refreshSignoff = refreshSignoffStatus,
72
+ }) {
73
+ const values = input ?? {}
74
+ checkInput(values)
75
+ const { track, slug, outcome, reason, return_reason: returnReason } = values
76
+
77
+ const found = await findCard({ deskRoot, person, track, slug })
78
+ if (found === null) throw Object.assign(new Error(`task_signoff: Check the track and slug, then try again: there is no task ${track}/${slug} in this desk; check the track and slug. Nothing was recorded.`), { code: "task_signoff_there_is_no_task_in" })
79
+ const card = await readMarkdown(found.file)
80
+ if (card.data.status !== "done") {
81
+ const shown = STATUSES.includes(card.data.status) ? card.data.status : "no recognised status"
82
+ // A card at validating whose work the operator now accepts needs one more call, which this refusal names so the agent does not have to find it.
83
+ const exactCall = card.data.status === "validating" ? ` If the work is finished and the operator accepted it, make this exact call first, then call task_signoff again: task_update ${JSON.stringify({ track, slug, status: "done", evidence: readSteps(card.content).found ? { kind: "steps" } : { kind: "pr", ref: "<pull request URL>" } })}${readSteps(card.content).found ? " (every step must be delivered or dropped; the call's refusal names any that are not)" : " (use kind commit, ci_run or non_code when there is no pull request)"}.` : ""
84
+ // A task that is not at done was never delivered, so nobody should have been asked to accept it: say what to do instead.
85
+ throw Object.assign(new Error(`task_signoff: Finish the task and move it to done with task_update first: only a delivered task can be signed; this one is at ${shown}. Nothing was recorded. It is not delivered yet, so do not ask the person to accept it: tell them what is left, finish it, move the task to done with task_update, and ask "Accept or send back?" in that delivery.${exactCall}`), { code: "task_signoff_only_a_delivered_task_can" })
86
+ }
87
+
88
+ const atMs = now()
89
+ const at = new Date(atMs).toISOString()
90
+ let signed
91
+ try {
92
+ signed = sign(readRecord(card.data), { status: "done", outcome, reason, returnReason, at })
93
+ } catch (error) {
94
+ throw new Error(deskFailure({
95
+ code: "task_signoff_refused",
96
+ thing: "task_signoff: outcome",
97
+ probably: error.message,
98
+ look: "read the card's `signoff` record with desk_status",
99
+ keepWorking: "nothing was recorded, so keep working and call task_signoff again with a corrected outcome",
100
+ fix: "pass `outcome`, `reason` and `return_reason` as the tool description lists them",
101
+ }))
102
+ }
103
+ const result = { status: "unchanged", path: relPath(deskRoot, found.file), signoff: signed.record.signoff }
104
+ result.say = sentence({ slug, outcome, reason: signed.record.signoff.reason, changed: signed.changed })
105
+ if (!signed.changed) return result
106
+
107
+ const refused = outcome === "refused"
108
+ const next = refused ? refuse(signed.record, { at, reason, returnReason }) : signed.record
109
+ let file = found.file
110
+ // A refusal reopens the task, and a task cannot be worked in an archived track. No tool brings a track back yet, so say the one command.
111
+ if (refused && found.trackArchived) {
112
+ const taskDir = path.dirname(found.file)
113
+ const archivedTrack = path.basename(path.dirname(taskDir)) === "_archive" ? path.dirname(path.dirname(taskDir)) : path.dirname(taskDir)
114
+ const liveTrack = path.join(path.dirname(path.dirname(archivedTrack)), track)
115
+ // With a live track of the same name, moving the archived track would nest it inside: only the task moves.
116
+ const how = existsSync(liveTrack)
117
+ ? `A live track ${track} exists too: from the desk root, move the task into it with \`git mv ${relPath(deskRoot, taskDir)} ${relPath(deskRoot, path.join(liveTrack, slug))}\``
118
+ : `From the desk root, bring the track back with \`git mv ${relPath(deskRoot, archivedTrack)} ${relPath(deskRoot, liveTrack)}\``
119
+ throw Object.assign(new Error(`task_signoff: Move the track back out of the archive, commit that, then call task_signoff again: the task's track is archived, so the task cannot go back to processing there; nothing was recorded. ${how}, commit that, then call task_signoff again.`), { code: "task_signoff_the_task_s_track_is" })
120
+ }
121
+ if (refused && found.archived) {
122
+ try {
123
+ await moveTask({ deskRoot, input: { track, slug, unarchive: true }, person, search, statusContext, spawnGit, schedulePush })
124
+ } catch (error) {
125
+ throw Object.assign(new Error(`task_signoff: Use task_update (unarchive: true) to bring it back, then try again: the archived task could not be brought back (${error.message}); nothing was recorded. Bring it back with task_update (unarchive: true), then call task_signoff again.`), { code: "task_signoff_true_to_bring_it_back" })
126
+ }
127
+ file = path.join(path.dirname(path.dirname(path.dirname(found.file))), slug, "task.md")
128
+ result.path = relPath(deskRoot, file)
129
+ }
130
+
131
+ const stage = stagingAllowed(file, spawnGit)
132
+ await patchMarkdownFrontmatter(file, { ...(refused ? { status: "processing" } : {}), updated: at.replace(/\.\d+Z$/u, "Z"), ...toFrontmatter(next) })
133
+ const trackRow = refused ? await updateTrackRow({ filePath: file, slug, status: "processing", spawnGit }) : null
134
+ const commit = stage ? stageAndCommitCard(file, `task_signoff: ${track}/${slug}`, spawnGit, trackRow === null ? [] : ["../track.md"], `${track}/${slug}`, deskRoot) : undefined
135
+ if (stage && !commit) schedulePush({ root: deskRoot })
136
+ const deskCommit = stage && !commit ? headSha(path.dirname(file), spawnGit) : null
137
+ search?.noteChange(relPath(deskRoot, file))
138
+ await finalize({ deskRoot, env, identity: await taskJobOrNull({ deskRoot, person, track, slug }) })
139
+ try {
140
+ await refreshSignoff(env, deskRoot, { now: atMs })
141
+ } catch {
142
+ console.error("desk_factory: signoff_status_refresh_deferred")
143
+ }
144
+
145
+ result.status = "signed"
146
+ if (commit) result.commit = commit
147
+ if (refused) {
148
+ result.report_as = `Task ${slug} is back at processing (not done).`
149
+ result.report_note = "Do not tell the operator this task is done; it is at processing."
150
+ }
151
+ if (deskCommit === null) return result
152
+ // Said outright, and first, so no agent runs git for a card Desk has committed and is pushing.
153
+ const pushNote = deskPushNote({ root: deskRoot, env, spawnGit, note: DESK_COMMIT_NOTE })
154
+ return { status: result.status, desk_note: pushNote.desk_note, ...result, ...pushNote, ...commitHashAnswer({ env, hash: deskCommit }), desk_pushed: false }
155
+ }