@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,319 @@
1
+ import { createHash } from "node:crypto"
2
+ import { closeSync, constants, fstatSync, lstatSync, openSync, readSync, realpathSync } from "node:fs"
3
+ import * as path from "node:path"
4
+ import { spawnSync } from "node:child_process"
5
+ import { exclusionForPath } from "../indexer/exclusions.js"
6
+
7
+ const LIMITS = { paths: 512, prefix_bytes: 4096, file_bytes: 16 * 1024 * 1024, total_bytes: 64 * 1024 * 1024, command_bytes: 2 * 1024 * 1024, duration_ms: 10_000 }
8
+ const EXTENSIONS = new Set("pdf doc docx ppt pptx xls xlsx odt odp ods png jpg jpeg gif webp avif tif tiff bmp heic ico zip 7z tar gz tgz mp3 wav m4a mp4 mov webm".split(" "))
9
+ const ATTRIBUTES = ["filter", "diff", "merge", "text"]
10
+ const POINTER_HEADER = "version https://git-lfs.github.com/spec/v1\n"
11
+ const SENSITIVE = /(?:^|\/)(?:\.env(?:\..*)?|\.ssh|\.aws|\.azure|credentials(?:\.[^/]*)?|secrets?(?:\.[^/]*)?|tokens?(?:\.[^/]*)?)(?:\/|$)|\.(?:key|pem|pfx|p12|kdbx)$/iu
12
+ const CONFIG_KEYS = "^(filter\\.lfs\\.|core\\.(hookspath|sparsecheckout)|extensions\\.partialclone|remote\\.origin\\.url|remote\\..*\\.promisor|lfs\\.storage)"
13
+
14
+ const sensitivePath = (file) => exclusionForPath(file).reason === "sensitive_path" || SENSITIVE.test(file)
15
+
16
+ function relativePath(value) {
17
+ if (typeof value !== "string" || value === "" || value.includes("\0") || value.includes("\\") || path.posix.isAbsolute(value) || /^[A-Za-z]:/u.test(value)) return null
18
+ const parts = value.split("/")
19
+ if (parts.some((part) => part === ".." || part === ".git")) return null
20
+ return parts.filter((part) => part !== "" && part !== ".").join("/")
21
+ }
22
+
23
+ function directoryRoot(root) {
24
+ if (typeof root !== "string" || !path.isAbsolute(root)) return { state: "unsafe_path" }
25
+ const raw = process.platform === "win32" ? root.replaceAll("/", path.sep) : root
26
+ const anchor = path.parse(raw).root
27
+ let current = anchor
28
+ try {
29
+ const parts = ["", ...raw.slice(anchor.length).split(path.sep)]
30
+ for (const part of parts) {
31
+ if (part === "..") current = path.dirname(current)
32
+ else if (part !== "" && part !== ".") current = path.join(current, part)
33
+ const stat = lstatSync(current)
34
+ if (stat.isSymbolicLink() || !stat.isDirectory()) return { state: "unsafe_path" }
35
+ }
36
+ return path.relative(current, realpathSync(current)) === "" ? { state: "directory", root: current } : { state: "unsafe_path" }
37
+ } catch (error) {
38
+ return { state: error.code === "ENOENT" ? "missing" : "unreadable" }
39
+ }
40
+ }
41
+
42
+ // Check the root and its ancestors too: a symlinked common Git directory must not expose another cache.
43
+ function safeStat(root, relative) {
44
+ const rel = relativePath(relative)
45
+ if (rel === null || rel === "") return { state: "unsafe_path" }
46
+ const checked = directoryRoot(root)
47
+ if (checked.state !== "directory") return { state: checked.state }
48
+ let current = checked.root
49
+ try {
50
+ let stat
51
+ for (const part of rel.split("/")) {
52
+ current = path.join(current, part)
53
+ stat = lstatSync(current)
54
+ if (stat.isSymbolicLink()) return { state: "unsafe_path" }
55
+ }
56
+ return stat.isFile() ? { state: "file", file: current, stat } : { state: "unsafe_path" }
57
+ } catch (error) {
58
+ return { state: error.code === "ENOENT" ? "missing" : "unreadable" }
59
+ }
60
+ }
61
+
62
+ function readLocal(root, rel, budget, { expected, prefix = false }) {
63
+ const found = safeStat(root, rel)
64
+ if (found.state !== "file") return { state: found.state }
65
+ const size = found.stat.size
66
+ if (expected !== undefined && size !== expected.size) return { state: "mismatch" }
67
+ const length = prefix ? Math.min(size, LIMITS.prefix_bytes) : size
68
+ if (length > LIMITS.file_bytes || length > budget.bytes || performance.now() >= budget.deadline) return { state: "not_checked_limit" }
69
+ let fd
70
+ try {
71
+ fd = openSync(found.file, constants.O_RDONLY | constants.O_NOFOLLOW)
72
+ const before = fstatSync(fd)
73
+ if (!before.isFile() || before.ino !== found.stat.ino || before.dev !== found.stat.dev || before.size !== size) return { state: "changed_during_read" }
74
+ const hash = expected === undefined ? null : createHash("sha256")
75
+ const chunk = Buffer.alloc(Math.min(length, 64 * 1024))
76
+ const parts = []
77
+ let offset = 0
78
+ while (offset < length) {
79
+ if (performance.now() >= budget.deadline) return { state: "not_checked_limit" }
80
+ const read = readSync(fd, chunk, 0, Math.min(chunk.length, length - offset), offset)
81
+ if (read === 0) return { state: "changed_during_read" }
82
+ budget.bytes -= read
83
+ if (hash === null) parts.push(Buffer.from(chunk.subarray(0, read)))
84
+ else hash.update(chunk.subarray(0, read))
85
+ offset += read
86
+ }
87
+ const after = fstatSync(fd)
88
+ const still = safeStat(root, rel)
89
+ if (after.size !== size || after.mtimeMs !== before.mtimeMs || still.state !== "file" || still.stat.ino !== before.ino || still.stat.dev !== before.dev) return { state: "changed_during_read" }
90
+ return hash === null ? { state: "read", data: Buffer.concat(parts), size } : { state: hash.digest("hex") === expected.oid ? "verified" : "mismatch" }
91
+ } catch {
92
+ return { state: "unreadable" }
93
+ } finally {
94
+ if (fd !== undefined) closeSync(fd)
95
+ }
96
+ }
97
+
98
+ function pointerOf(data) {
99
+ const text = data.toString("utf8")
100
+ if (!text.startsWith(POINTER_HEADER)) return null
101
+ const match = /^version https:\/\/git-lfs.github.com\/spec\/v1\noid sha256:([a-f0-9]{64})\nsize (0|[1-9][0-9]*)\n$/u.exec(text)
102
+ if (match === null || !Number.isSafeInteger(Number(match[2]))) return { invalid: true }
103
+ return { oid: match[1], size: Number(match[2]) }
104
+ }
105
+
106
+ function configuration(data) {
107
+ const values = new Map()
108
+ for (const entry of data.toString("utf8").split("\0")) {
109
+ const split = entry.indexOf("\n")
110
+ if (split > 0) values.set(entry.slice(0, split).toLowerCase(), entry.slice(split + 1))
111
+ }
112
+ return values
113
+ }
114
+
115
+ function attributeValue(value) {
116
+ return ["lfs", "set", "unset", "unspecified"].includes(value) ? value : "custom"
117
+ }
118
+
119
+ function packageRoots(entries, read, findings) {
120
+ const roots = new Set(["plugins"])
121
+ const add = (value) => {
122
+ const rel = relativePath(value)
123
+ if (rel === null) findings.push({ code: "package_declaration_invalid" })
124
+ else roots.add(rel)
125
+ }
126
+ for (const entry of entries) {
127
+ if (/(?:^|\/)(?:plugin\.json|agency\.json)$/u.test(entry.path)) {
128
+ const dir = path.posix.dirname(entry.path)
129
+ add(dir.endsWith("/.claude-plugin") ? path.posix.dirname(dir) : dir === ".claude-plugin" ? "." : dir)
130
+ }
131
+ if (![".claude-plugin/marketplace.json", ".github/plugin/marketplace.json", "_meta/crew.json"].includes(entry.path)) continue
132
+ const content = read(entry.path)
133
+ if (content.state !== "read" || content.size > LIMITS.prefix_bytes) {
134
+ findings.push({ code: "package_declaration_unreadable", path: entry.path })
135
+ continue
136
+ }
137
+ let value
138
+ try {
139
+ value = JSON.parse(content.data.toString("utf8"))
140
+ } catch {
141
+ findings.push({ code: "package_declaration_invalid", path: entry.path })
142
+ continue
143
+ }
144
+ if (entry.path === "_meta/crew.json") {
145
+ if (value?.tooling?.repo == null && typeof value?.tooling?.path === "string") add(value.tooling.path || ".")
146
+ } else if (Array.isArray(value?.plugins)) {
147
+ for (const plugin of value.plugins) {
148
+ if (typeof plugin?.source === "string" && !plugin.source.includes("://")) add(plugin.source)
149
+ }
150
+ }
151
+ }
152
+ return [...roots].sort()
153
+ }
154
+
155
+ /**
156
+ * Inspect local index, attributes and bounded file bytes. Never runs content filters,
157
+ * hooks, network commands or repairs. Remote publication and installed readiness remain unqualified.
158
+ */
159
+ export function inspectLfs({ repo = process.cwd(), spawn = spawnSync, env = process.env } = {}) {
160
+ const result = {
161
+ schema_version: 1,
162
+ action: "inspect",
163
+ state: "unavailable",
164
+ repository: { kind: "unknown", context: "unknown", has_origin: "unknown", partial: "unknown", sparse: "unknown", package_roots: [] },
165
+ tool: { state: "not_checked" },
166
+ configuration: { filters: "unknown", hooks: { location: "unknown", pre_push: "not_checked", integration: "not_checked" } },
167
+ policy: { id: "desk-context-binaries-v1", extensions: [...EXTENSIONS].sort() },
168
+ files: [],
169
+ findings: [],
170
+ limits: { ...LIMITS },
171
+ qualification: { remote_publication: "not_checked", network_auth: "not_checked", installed_payload: "not_checked" },
172
+ }
173
+ let cwd
174
+ try {
175
+ if (typeof repo !== "string" || repo.trim() === "") throw new Error("invalid path")
176
+ cwd = realpathSync(repo)
177
+ if (!lstatSync(cwd).isDirectory()) throw new Error("not a directory")
178
+ } catch {
179
+ result.state = "not_git"
180
+ result.findings.push({ code: "repository_unavailable" })
181
+ return result
182
+ }
183
+ const budget = { bytes: LIMITS.total_bytes, deadline: performance.now() + LIMITS.duration_ms }
184
+ const gitEnv = { ...env, GIT_NO_LAZY_FETCH: "1", GIT_OPTIONAL_LOCKS: "0", GIT_TERMINAL_PROMPT: "0", GIT_LFS_SKIP_SMUDGE: "1", GIT_ALLOW_PROTOCOL: "", GIT_PROTOCOL_FROM_USER: "0" }
185
+ for (const key of ["GIT_DIR", "GIT_WORK_TREE", "GIT_COMMON_DIR", "GIT_INDEX_FILE", "GIT_OBJECT_DIRECTORY", "GIT_ALTERNATE_OBJECT_DIRECTORIES", "GIT_ATTR_SOURCE"]) delete gitEnv[key]
186
+ const git = (args, input) => {
187
+ if (performance.now() >= budget.deadline) return { status: null, data: Buffer.alloc(0) }
188
+ // An inherited attribute tree can otherwise replace the working-tree/index policy.
189
+ const answer = spawn("git", ["-c", "core.fsmonitor=false", "-c", "protocol.allow=never", "-c", "attr.tree=", "-C", cwd, ...args], {
190
+ env: gitEnv, windowsHide: true, input, timeout: Math.max(1, Math.min(3000, Math.ceil(budget.deadline - performance.now()))), killSignal: "SIGKILL", maxBuffer: LIMITS.command_bytes,
191
+ })
192
+ return { status: answer.error ? null : answer.status, data: Buffer.isBuffer(answer.stdout) ? answer.stdout : Buffer.from(answer.stdout ?? "") }
193
+ }
194
+ const top = git(["rev-parse", "--show-toplevel"])
195
+ if (top.status !== 0) {
196
+ try {
197
+ lstatSync(path.join(cwd, ".git"))
198
+ } catch (error) {
199
+ if (error.code === "ENOENT") result.state = "not_git"
200
+ }
201
+ result.findings.push({ code: "git_metadata_unavailable" })
202
+ return result
203
+ }
204
+ cwd = top.data.toString("utf8").trim()
205
+ const config = git(["config", "--null", "--get-regexp", CONFIG_KEYS])
206
+ const index = git(["ls-files", "--stage", "-z"])
207
+ const ignored = git(["ls-files", "--cached", "--ignored", "--exclude-standard", "-z"])
208
+ if (![0, 1].includes(config.status) || index.status !== 0 || ignored.status !== 0) {
209
+ result.findings.push({ code: "git_metadata_unavailable" })
210
+ return result
211
+ }
212
+ const values = configuration(config.data)
213
+ result.repository.has_origin = values.has("remote.origin.url")
214
+ result.repository.partial = values.has("extensions.partialclone") || [...values].some(([key, value]) => key.endsWith(".promisor") && /^(?:true|yes|on|1)$/iu.test(value))
215
+ result.repository.sparse = /^(?:true|yes|on|1)$/iu.test(values.get("core.sparsecheckout") ?? "")
216
+ const filters = ["clean", "smudge", "process", "required"].map((key) => values.get(`filter.lfs.${key}`))
217
+ result.configuration.filters = filters.every((value) => value === undefined) ? "unconfigured"
218
+ : /^(?:git-lfs|git lfs) clean -- %f$/u.test(filters[0] ?? "") && /^(?:git-lfs|git lfs) smudge -- %f$/u.test(filters[1] ?? "") && /^(?:git-lfs|git lfs) filter-process$/u.test(filters[2] ?? "") && /^(?:true|yes|on|1)$/iu.test(filters[3] ?? "") ? "standard" : "custom_or_incomplete"
219
+ result.configuration.skip_smudge = /^(?:true|yes|on|1)$/iu.test(env.GIT_LFS_SKIP_SMUDGE ?? "") || filters.some((value) => value?.includes("--skip"))
220
+ result.configuration.custom_storage = values.has("lfs.storage")
221
+ const common = git(["rev-parse", "--git-common-dir"])
222
+ const rawCommon = common.data.toString("utf8").trim()
223
+ const commonDir = common.status === 0 && rawCommon !== "" ? path.isAbsolute(rawCommon) ? rawCommon : `${cwd}${path.sep}${rawCommon}` : null
224
+ const hooks = values.get("core.hookspath")
225
+ result.configuration.hooks.location = hooks === undefined ? "default" : "custom"
226
+ if (hooks === undefined && commonDir !== null) result.configuration.hooks.pre_push = safeStat(commonDir, "hooks/pre-push").state
227
+ else if (hooks !== undefined) {
228
+ const rel = relativePath(hooks)
229
+ result.configuration.hooks.pre_push = rel === null ? "not_checked_external" : safeStat(cwd, `${rel}/pre-push`).state
230
+ }
231
+ if (performance.now() < budget.deadline) {
232
+ const tool = spawn("git-lfs", ["version"], { cwd, env: gitEnv, windowsHide: true, timeout: Math.max(1, Math.min(1000, Math.ceil(budget.deadline - performance.now()))), killSignal: "SIGKILL", maxBuffer: 4096 })
233
+ const version = /^git-lfs\/(\d+\.\d+\.\d+)(?:\s|$)/u.exec(String(tool.stdout ?? ""))
234
+ result.tool = tool.error?.code === "ENOENT" ? { state: "missing" } : tool.status === 0 && version !== null ? { state: "available", version: version[1] } : { state: "unavailable" }
235
+ }
236
+ const ignoredPaths = new Set(ignored.data.toString("utf8").split("\0"))
237
+ const entries = []
238
+ for (const line of index.data.toString("utf8").split("\0")) {
239
+ if (line === "") continue
240
+ const match = /^([0-7]{6}) ([a-f0-9]{40,64}) ([0-3])\t([\s\S]*)$/u.exec(line)
241
+ if (match === null || relativePath(match[4]) === null) {
242
+ result.findings.push({ code: "index_entry_unreadable" })
243
+ continue
244
+ }
245
+ entries.push({ mode: match[1], oid: match[2], stage: match[3], path: match[4] })
246
+ }
247
+ if (entries.length > LIMITS.paths) result.findings.push({ code: "path_limit", total: entries.length })
248
+ const scoped = entries.slice(0, LIMITS.paths)
249
+ const skipped = (entry) => ignoredPaths.has(entry.path) ? "ignored" : sensitivePath(entry.path) ? "sensitive_path"
250
+ : entry.mode !== "100644" && entry.mode !== "100755" || entry.stage !== "0" ? "non_regular_or_unmerged" : null
251
+ const read = (file) => readLocal(cwd, file, budget, { prefix: true })
252
+ result.repository.package_roots = packageRoots(scoped, (file) => ignoredPaths.has(file) ? { state: "ignored" } : read(file), result.findings)
253
+ const isPackage = (file) => result.repository.package_roots.some((root) => root === "" || file === root || file.startsWith(`${root}/`))
254
+ const shared = entries.some((entry) => entry.path.startsWith("desks/"))
255
+ const personal = entries.some((entry) => entry.path.startsWith("_meta/")) && entries.some((entry) => entry.path.startsWith("_archive/"))
256
+ result.repository.kind = isPackage("") ? "package" : shared || personal ? "context" : "unknown"
257
+ result.repository.context = shared ? "shared" : personal ? "personal" : "unknown"
258
+ const attributePaths = scoped.filter((entry) => skipped(entry) === null).map((entry) => entry.path)
259
+ const attrs = git(["check-attr", "-z", "--stdin", ...ATTRIBUTES], Buffer.from(attributePaths.join("\0") + (attributePaths.length > 0 ? "\0" : "")))
260
+ const byPath = new Map()
261
+ if (attrs.status === 0) {
262
+ const parts = attrs.data.toString("utf8").split("\0")
263
+ for (let i = 0; i + 2 < parts.length; i += 3) {
264
+ if (!byPath.has(parts[i])) byPath.set(parts[i], {})
265
+ byPath.get(parts[i])[parts[i + 1]] = attributeValue(parts[i + 2])
266
+ }
267
+ } else result.findings.push({ code: "attributes_unavailable" })
268
+ const blobs = new Map()
269
+ const blob = (entry) => {
270
+ if (blobs.has(entry.oid)) return blobs.get(entry.oid)
271
+ const size = git(["cat-file", "-s", entry.oid])
272
+ const count = Number(size.data.toString("utf8").trim())
273
+ let value = { state: "not_checked_limit" }
274
+ if (size.status !== 0 || !Number.isSafeInteger(count) || count < 0) value = { state: "unavailable" }
275
+ else if (count <= LIMITS.prefix_bytes && count <= budget.bytes) {
276
+ const contents = git(["cat-file", "blob", entry.oid])
277
+ if (contents.status === 0 && contents.data.length === count) {
278
+ budget.bytes -= count
279
+ value = { state: "read", data: contents.data }
280
+ } else value = { state: "unavailable" }
281
+ }
282
+ blobs.set(entry.oid, value)
283
+ return value
284
+ }
285
+ for (const entry of scoped) {
286
+ const file = { path: entry.path, inspection: "inspected", attributes: byPath.get(entry.path) ?? { filter: "unknown", diff: "unknown", merge: "unknown", text: "unknown" }, tracking: "unknown", format: "unknown", proposal: "none", local_object: "not_applicable", materialization: "not_checked" }
287
+ result.files.push(file)
288
+ const excluded = skipped(entry)
289
+ if (excluded !== null) {
290
+ file.inspection = excluded
291
+ continue
292
+ }
293
+ const indexed = blob(entry)
294
+ const local = read(entry.path)
295
+ const pointer = indexed.state === "read" ? pointerOf(indexed.data) : null
296
+ const extension = path.posix.extname(entry.path).slice(1).toLowerCase()
297
+ file.format = EXTENSIONS.has(extension) ? "context_binary" : (indexed.data ?? local.data)?.includes(0) ? "unknown_binary" : "not_identified_as_binary"
298
+ file.tracking = pointer?.invalid ? "invalid_pointer" : pointer !== null ? "lfs_pointer" : indexed.state === "unavailable" ? "unknown" : "ordinary_git"
299
+ if (pointer !== null && !pointer.invalid) {
300
+ file.pointer = pointer
301
+ file.materialization = local.state !== "read" ? local.state
302
+ : local.size === indexed.data.length && local.data.equals(indexed.data) ? "pointer"
303
+ : readLocal(cwd, entry.path, budget, { expected: pointer }).state
304
+ const cache = `lfs/objects/${pointer.oid.slice(0, 2)}/${pointer.oid.slice(2, 4)}/${pointer.oid}`
305
+ file.local_object = values.has("lfs.storage") ? "not_checked_custom_storage" : commonDir === null ? "unknown" : readLocal(commonDir, cache, budget, { expected: pointer }).state
306
+ } else if (pointer?.invalid) result.findings.push({ code: "invalid_pointer", path: entry.path })
307
+ if (isPackage(entry.path)) file.proposal = "package_exempt"
308
+ else if (result.findings.some((finding) => ["path_limit", "package_declaration_invalid", "package_declaration_unreadable", "index_entry_unreadable"].includes(finding.code))) file.proposal = "review_incomplete_inventory"
309
+ else if (["unset", "set"].includes(file.attributes.filter) || ATTRIBUTES.some((attribute) => ["custom", "unknown"].includes(file.attributes[attribute]))) file.proposal = "review_existing_policy"
310
+ else if (file.tracking === "ordinary_git" && local.state !== "read") file.proposal = "review_worktree_state"
311
+ else if (file.tracking === "ordinary_git" && file.format === "context_binary") file.proposal = result.repository.kind === "context" ? "track_exact_path" : "review_repository_scope"
312
+ else if (file.tracking === "ordinary_git" && file.format === "unknown_binary") file.proposal = "review_exact_path"
313
+ if (indexed.state === "unavailable") result.findings.push({ code: "index_blob_unavailable", path: entry.path })
314
+ if (local.state !== "read") result.findings.push({ code: `worktree_${local.state}`, path: entry.path })
315
+ }
316
+ if (performance.now() >= budget.deadline || budget.bytes <= 0) result.findings.push({ code: "inspection_limit" })
317
+ result.state = result.findings.length > 0 ? "limited" : "inspected"
318
+ return result
319
+ }
@@ -0,0 +1,12 @@
1
+ import path from "node:path"
2
+
3
+ // Git for Windows reports every path with forward slashes (`C:/Users/me/repo`), while the desk, a receipt written from the owner's own paths and `fs` use backslashes and may differ in drive-letter or folder case for the same folder. A path read from Git is turned into the platform's own spelling first, and two paths are the same folder when they match after that, ignoring case on Windows. Only the spelling is compared: a symlink or junction alias is a different path, and the callers that need the real path check that themselves. Off Windows every spelling is exact, as before.
4
+ export const nativeGitPath = (value, platform = process.platform) => platform === "win32" && typeof value === "string" ? path.win32.normalize(value) : value
5
+ export const foldPath = (value, platform = process.platform) => platform === "win32" ? path.win32.normalize(value).toLowerCase() : value
6
+ export const samePath = (a, b, platform = process.platform) => foldPath(a, platform) === foldPath(b, platform)
7
+ export const insidePath = (root, target, platform = process.platform) => {
8
+ const sep = platform === "win32" ? "\\" : "/"
9
+ const folded = foldPath(root, platform)
10
+ const candidate = foldPath(target, platform)
11
+ return candidate === folded || candidate.startsWith(`${folded}${sep}`)
12
+ }
@@ -0,0 +1,197 @@
1
+ // The newest release at session start. An Agency install of `plugins/desk@release` is served from Agency's cache, which refreshes
2
+ // in the background, so the first session after a release runs the release before it. Desk's own tools do not have to: when the
3
+ // `release` branch holds a newer Desk than the copy that launched this server, the server loads the newer `plugins/desk/mcp` from
4
+ // a copy it keeps under its cache folder, and the runtime pack, source mirror and everything else restore from there as usual.
5
+ // A session's hooks run the newer release's scripts and a skill the agent loads is followed by its current text (`hooks/lib/current-release.cjs`);
6
+ // the host fixes the list of skills, their descriptions, agents and the tool descriptions at its start, so those stay as they were.
7
+ //
8
+ // The whole step has a time budget (`BUDGET_MS`). A check or download that cannot finish in it, an offline machine, a copy that
9
+ // fails to load: the server keeps running the cached copy and says which version that is and why (`newest_release` in
10
+ // desk_status, and the stale-Desk line boot prints). Nothing here sends credentials or runs fetched code outside the pack
11
+ // verification the runtime already applies; the copy is `ourostack/desk`'s own release branch over HTTPS, as Agency fetches it.
12
+
13
+ import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs"
14
+ import * as os from "node:os"
15
+ import * as path from "node:path"
16
+ import { promisify } from "node:util"
17
+ import { gunzip } from "node:zlib"
18
+ import { resolveDeskChannel } from "./desk-channel.js"
19
+ import { compareVersions, latestPluginUrl, parseVersion } from "./stale-desk.js"
20
+ import { renameWithRetry } from "../util/rename-retry.js"
21
+ import { looksLikeNodeTestRunner } from "./test-state-guard.js"
22
+
23
+ const gunzipAsync = promisify(gunzip)
24
+
25
+ const RELEASE_TARBALL_URL = "https://codeload.github.com/ourostack/desk/tar.gz/refs/heads/release"
26
+ /** Everything this step may spend before it falls back to the cached copy. */
27
+ const BUDGET_MS = 8000
28
+ const VERSION_BUDGET_MS = 1500
29
+ const MAX_TARBALL_BYTES = 40 * 1024 * 1024
30
+ const MAX_EXTRACTED_BYTES = 60 * 1024 * 1024
31
+ const KEEP_COPIES = 3
32
+ const COMPLETE_FILE = ".complete.json"
33
+ const SWITCH = "DESK_NEWEST_RELEASE"
34
+ // What a copy keeps from the release: the plugin manifest, the MCP server with its runtime packs, and the skills, docs, hooks and
35
+ // activation files that hooks and skills read on demand (`hooks/lib/current-release.cjs`).
36
+ const WANTED = /^(?:plugin\.json|(?:mcp|skills|docs|hooks|activation|agents)\/.+)$/u
37
+
38
+ /** Where the copies live: next to the runtime caches, `<cache>/ouroboros-skills/desk/release-copies`. */
39
+ function releaseCopiesDir({ env, homeDir }) {
40
+ const cacheHome = typeof env.XDG_CACHE_HOME === "string" && env.XDG_CACHE_HOME.trim() !== "" ? env.XDG_CACHE_HOME : path.join(env.HOME || homeDir, ".cache")
41
+ return path.join(cacheHome, "ouroboros-skills", "desk", "release-copies")
42
+ }
43
+
44
+ /** The `mcp` folder of a complete copy of `version`, or null. */
45
+ function copyMcpRoot({ copiesDir, version }) {
46
+ const dir = path.join(copiesDir, version)
47
+ return existsSync(path.join(dir, COMPLETE_FILE)) ? path.join(dir, "mcp") : null
48
+ }
49
+
50
+ /** Entries of a gzip-decompressed tar as `{ name, data }` for regular files, reading the pax long names git archive writes. Throws on a malformed archive. */
51
+ export function* tarFiles(buffer) {
52
+ let offset = 0
53
+ let paxName = null
54
+ const field = (start, length) => {
55
+ const raw = buffer.subarray(offset + start, offset + start + length)
56
+ const end = raw.indexOf(0)
57
+ return raw.subarray(0, end === -1 ? raw.length : end).toString("utf8")
58
+ }
59
+ while (offset + 512 <= buffer.length) {
60
+ if (buffer.subarray(offset, offset + 512).every((byte) => byte === 0)) return
61
+ const size = Number.parseInt(field(124, 12).trim(), 8)
62
+ const type = String.fromCharCode(buffer[offset + 156])
63
+ const bodyStart = offset + 512
64
+ if (!(size >= 0) || bodyStart + size > buffer.length) throw new Error("the archive is damaged")
65
+ const body = buffer.subarray(bodyStart, bodyStart + size)
66
+ if (type === "x") paxName = /(?:^|\n)\d+ path=([^\n]*)\n/u.exec(body.toString("utf8"))?.[1] ?? null
67
+ else if (type === "0") {
68
+ yield { name: paxName ?? `${field(345, 155)}${field(345, 155) === "" ? "" : "/"}${field(0, 100)}`, data: body }
69
+ paxName = null
70
+ }
71
+ offset = bodyStart + Math.ceil(size / 512) * 512
72
+ }
73
+ }
74
+
75
+ // `<repo>-release/plugins/desk/<rest>` to `<rest>`, for the files a copy keeps; null for anything else or an unsafe path.
76
+ function copyPath(name) {
77
+ const parts = name.split("/")
78
+ const rest = parts.slice(3)
79
+ const unsafe = rest.some((part) => part === "" || part === "." || part === ".." || part.includes("\\") || part.includes(":"))
80
+ return parts[1] === "plugins" && parts[2] === "desk" && !unsafe && WANTED.test(rest.join("/")) ? rest.join("/") : null
81
+ }
82
+
83
+ /** Writes the wanted files of the release tarball into `dir`. Returns the version in its `plugin.json`. */
84
+ export function extractRelease({ tar, dir }) {
85
+ let total = 0
86
+ for (const { name, data } of tarFiles(tar)) {
87
+ const rest = copyPath(name)
88
+ if (rest === null) continue
89
+ total += data.length
90
+ if (total > MAX_EXTRACTED_BYTES) throw new Error("the release is larger than a copy may be")
91
+ const target = path.join(dir, ...rest.split("/"))
92
+ mkdirSync(path.dirname(target), { recursive: true })
93
+ writeFileSync(target, data)
94
+ }
95
+ const version = JSON.parse(readFileSync(path.join(dir, "plugin.json"), "utf8")).version
96
+ if (parseVersion(version) === null || !existsSync(path.join(dir, "mcp", "index.js"))) throw new Error("the download is not a Desk release")
97
+ return version
98
+ }
99
+
100
+ // One request with a hard abort at the budget, no headers beyond the default and no credentials.
101
+ async function fetchBody(fetchFn, url, budgetMs, read) {
102
+ const controller = new AbortController()
103
+ const timer = setTimeout(() => controller.abort(), budgetMs)
104
+ try {
105
+ const response = await fetchFn(url, { signal: controller.signal, redirect: "follow", credentials: "omit" })
106
+ if (!response.ok) throw new Error(`HTTP ${response.status}`)
107
+ return await read(response)
108
+ } finally {
109
+ clearTimeout(timer)
110
+ }
111
+ }
112
+
113
+ const readTarball = async (response) => {
114
+ const packed = Buffer.from(await response.arrayBuffer())
115
+ if (packed.length > MAX_TARBALL_BYTES) throw new Error("the release download is too large")
116
+ return gunzipAsync(packed)
117
+ }
118
+
119
+ // Keeps the newest few copies; a copy that will not go stays for the next start.
120
+ function prune(copiesDir, keep) {
121
+ try {
122
+ const old = readdirSync(copiesDir)
123
+ .filter((name) => name !== keep)
124
+ .map((name) => ({ name, at: statSync(path.join(copiesDir, name)).mtimeMs }))
125
+ .sort((a, b) => b.at - a.at)
126
+ .slice(KEEP_COPIES - 1)
127
+ for (const { name } of old) rmSync(path.join(copiesDir, name), { recursive: true, force: true })
128
+ } catch {
129
+ // Nothing to prune.
130
+ }
131
+ }
132
+
133
+ /** Why this step does not apply, or null when it does. */
134
+ function notApplicable({ env, pluginRoot, agentHost, running, homeDir, readFile, fetchFn }) {
135
+ if (String(env[SWITCH] ?? "").trim() === "0") return `${SWITCH}=0`
136
+ if (fetchFn === undefined && looksLikeNodeTestRunner(env)) return "a test run"
137
+ const headless = String(env.DESK_FACTORY_HEADLESS ?? "")
138
+ if (headless !== "" && headless !== "0") return "a headless evaluator"
139
+ const { channel, agency } = resolveDeskChannel({ env, agentHost, pluginRoot, running, homeDir, readFile })
140
+ return agency && channel === "release" ? null : "not an Agency install on the release channel"
141
+ }
142
+
143
+ const short = (error) => String(error.message).split("\n")[0].slice(0, 80)
144
+
145
+ /**
146
+ * The newest release, as one of:
147
+ * - `{ state: "not_applicable", reason }`: this install does not follow the release channel through Agency (or the step is off)
148
+ * - `{ state: "current", running, latest }`: the running copy is the newest release
149
+ * - `{ state: "loaded", running, latest, mcpRoot }`: `mcpRoot` is a complete copy of the newest release
150
+ * - `{ state: "fell_back", running, latest, reason }`: the cached copy stays, and `reason` says why
151
+ * Never rejects and never takes longer than `budgetMs`.
152
+ */
153
+ export async function ensureNewestRelease({ env, pluginRoot, running, agentHost, homeDir = os.homedir(), readFile, fetchFn, budgetMs = BUDGET_MS, now = Date.now, copiesDir = releaseCopiesDir({ env, homeDir }) }) {
154
+ const skip = notApplicable({ env, pluginRoot, agentHost, running, homeDir, readFile, fetchFn })
155
+ if (skip !== null) return { state: "not_applicable", reason: skip }
156
+ const started = now()
157
+ // istanbul ignore next -- outside a node:test run the real fetch is used; every test hands its own.
158
+ const doFetch = fetchFn ?? globalThis.fetch
159
+ const fellBack = (latest, reason) => ({ state: "fell_back", running, latest, reason })
160
+ let latest
161
+ try {
162
+ latest = JSON.parse(await fetchBody(doFetch, latestPluginUrl("release"), VERSION_BUDGET_MS, (response) => response.text())).version
163
+ } catch (error) {
164
+ return fellBack(undefined, `it could not read the release channel's version (${short(error)})`)
165
+ }
166
+ const order = compareVersions(running, latest)
167
+ if (order === null) return fellBack(undefined, "the release channel's version was not readable")
168
+ if (order >= 0) return { state: "current", running, latest }
169
+ const ready = copyMcpRoot({ copiesDir, version: latest })
170
+ if (ready !== null) return { state: "loaded", running, latest, mcpRoot: ready }
171
+ const stage = path.join(copiesDir, `.stage-${process.pid}-${started}`)
172
+ try {
173
+ const tar = await fetchBody(doFetch, RELEASE_TARBALL_URL, Math.max(0, budgetMs - (now() - started)), readTarball)
174
+ mkdirSync(stage, { recursive: true })
175
+ const got = extractRelease({ tar, dir: stage })
176
+ if (compareVersions(got, running) <= 0) return { state: "current", running, latest: got }
177
+ writeFileSync(path.join(stage, COMPLETE_FILE), `${JSON.stringify({ version: got, fetched_at: new Date(now()).toISOString() })}\n`)
178
+ // Another start may have finished the same copy first; its copy is as good.
179
+ if (copyMcpRoot({ copiesDir, version: got }) === null) {
180
+ rmSync(path.join(copiesDir, got), { recursive: true, force: true })
181
+ renameWithRetry(stage, path.join(copiesDir, got))
182
+ }
183
+ prune(copiesDir, got)
184
+ return { state: "loaded", running, latest: got, mcpRoot: copyMcpRoot({ copiesDir, version: got }) }
185
+ } catch (error) {
186
+ return fellBack(latest, error.name === "AbortError" ? `the download did not finish within ${Math.round(budgetMs / 1000)} s` : `the download failed (${short(error)})`)
187
+ } finally {
188
+ rmSync(stage, { recursive: true, force: true })
189
+ }
190
+ }
191
+
192
+ /** One plain sentence about the outcome, for the agent: which version Desk's tools run and why. Empty when there is nothing to say. */
193
+ export function newestReleaseLine(result) {
194
+ if (result.state === "loaded") return `Desk's tools run ${result.latest}, the newest release; this session's skill list, skill descriptions, agents and tool descriptions come from the ${result.running} copy Agency cached, and refresh when the Copilot app restarts.`
195
+ if (result.state === "fell_back") return `Desk's tools run ${result.running} from the cached copy${result.latest === undefined ? "" : `, though the newest release is ${result.latest}`}: ${result.reason}. The next session start tries again.`
196
+ return ""
197
+ }