@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,332 @@
1
+ // friction_add — append a friction entry to the operator's friction log.
2
+ //
3
+ // Two scopes per `plugins/desk/skills/friction-management/SKILL.md`:
4
+ // - Cross-cutting (no `track`): `<root>/_meta/friction.md`
5
+ // - Track-local (with `track`): `<root>/<track>/_friction/<YYYY-MM-DD>-<theme>.md`
6
+ //
7
+ // Both are append-only; if the file already exists, the new entry is
8
+ // appended with a separator (no rewriting of prior entries — see the skill's
9
+ // "never delete, never rewrite" rule).
10
+ //
11
+ // `about` says what the friction is about: `setup` (the default) is this
12
+ // desk's own setup and stays on the desk; `system` is the shared system
13
+ // (Desk, its skills, the factory): the entry is written, and then an
14
+ // improvement card opens by itself, with no signoff. The card is its own
15
+ // committed write; the entry names the card's key, which carries the
16
+ // friction fingerprint. Nothing leaves the machine until the loop's mirror
17
+ // step. `file_card: true` files the factory store's kaizen issue
18
+ // immediately (`src/factory/kaizen-file.js`, which routes, dedupes and caps
19
+ // it) and a short record of the outcome is appended to the desk.
20
+ //
21
+ // On a Git desk, stages the file it wrote and commits exactly that file
22
+ // right after, synchronously in the call (M4-6 Part 2); pushing is a later
23
+ // part.
24
+
25
+ import { promises as fs } from "node:fs"
26
+ import * as path from "node:path"
27
+ import { spawnSync } from "node:child_process"
28
+ import { findFilenameEquivalent, today, slugify, pathExists } from "../util/fm.js"
29
+ import { deskRelativePath, resolveWriteTarget, personPrefix } from "../util/paths.js"
30
+ import { schedulePush as schedulePushDefault } from "../runtime/sync-worker.js"
31
+ import { stagingAllowed, stageAndCommitFile, writeCardCommitted, cardCommitMessage } from "./_card-commit.js"
32
+ import { unfinishedNext } from "../util/route-around.js"
33
+ import { cardKey, openImprovement } from "../desk/improvement-cards.js"
34
+ import { FRICTION_CLASSES, fileKaizenCard, fingerprintOf } from "../factory/kaizen-file.js"
35
+ import { PATTERNS } from "../factory/schema.js"
36
+ import { OWNED_TOOLS, fileToolIssue, ownedToolFor } from "../factory/tool-issue-file.js"
37
+ import { factoryStateRoot } from "../factory/outbox.js"
38
+ import { failureEvidence } from "../runtime/failure-evidence.js"
39
+
40
+ const ISSUE_FIXES = {
41
+ not_generic: "the repo is public, so take credentials, home paths and email addresses out of `title` and `body`, then call again",
42
+ invalid_title: "`title` must be one line of at most 120 characters, then call again",
43
+ invalid_body: "`body` must hold the evidence and be at most 8000 characters, then call again",
44
+ no_suitable_account: "sign in to GitHub with an account that can open issues on that repo, then call again",
45
+ }
46
+
47
+ const ABOUT = new Set(["setup", "system"])
48
+
49
+ // Every field friction_add reads off `input`, kept next to the handler so a
50
+ // field added to its reads below is a field added here in the same diff.
51
+ // __tests__/tool_schema_parity.test.js checks this against the tool's
52
+ // declared schema in tool-schemas.js.
53
+ export const FRICTION_ADD_FIELDS = [
54
+ "track",
55
+ "theme",
56
+ "body",
57
+ "about",
58
+ "file_card",
59
+ "title",
60
+ "plugin",
61
+ "friction_class",
62
+ "signal",
63
+ "evidence_jobs",
64
+ "error_code",
65
+ ]
66
+
67
+ function relPath(deskRoot, absPath) {
68
+ return deskRelativePath(deskRoot, absPath)
69
+ }
70
+
71
+ function trackFrictionIdentity(themeSlug) {
72
+ return `<!-- desk-friction:v2 theme=${themeSlug} -->`
73
+ }
74
+
75
+ async function resolveTrackFrictionPath({ deskRoot, person, track, themeSlug }) {
76
+ const date = today()
77
+ const identity = trackFrictionIdentity(themeSlug)
78
+ let fileSlug = themeSlug
79
+ const resolveCandidate = (name) => resolveWriteTarget({
80
+ deskRoot,
81
+ person,
82
+ segments: [track, "_friction", name],
83
+ })
84
+ while (true) {
85
+ const filePath = await resolveCandidate(`${date}-${fileSlug}.md`)
86
+ const existingPath = await findFilenameEquivalent(filePath, resolveCandidate)
87
+ if (!existingPath) return { filePath, identity }
88
+ const [firstLine] = (await fs.readFile(existingPath, "utf8")).split(/\r?\n/u)
89
+ if (firstLine === identity) return { filePath: existingPath, identity }
90
+ fileSlug = `_${fileSlug}`
91
+ }
92
+ }
93
+
94
+ const OPENED_CODES = new Set(["opened", "duplicate", "reopened"])
95
+
96
+ // The friction fingerprint, or null when this machine has no factory state. The check never creates the state.
97
+ async function fingerprintIfReady(env, deskRoot, card) {
98
+ try {
99
+ if ((await factoryStateRoot(env, { create: false, deskRoot })) === null) return null
100
+ return await fingerprintOf(env, { plugin: card.plugin, frictionClass: card.frictionClass, title: card.title })
101
+ } catch {
102
+ return null
103
+ }
104
+ }
105
+
106
+ // Opens (or finds, or reopens) the improvement card for system friction, as its own committed write after the friction
107
+ // entry. Never throws: the entry is already written, so every failure is a stable code on the result. The library builds
108
+ // the card's title from fixed words, or for a lesson from its owner and topic; the card holds the key (which carries the
109
+ // fingerprint), the plugin, the signal and the evidence jobs as pointers, and nothing of the note. The result names the
110
+ // card it opened or found, by key and desk-relative path, so the caller can point at it.
111
+ async function openCard({ deskRoot, person, card, fingerprint, lesson, now, commitCard, spawnGit, schedulePush }) {
112
+ if (fingerprint === null) return { improvement: "factory_state_unavailable" }
113
+ const prefix = deskRelativePath(deskRoot, personPrefix(deskRoot, person))
114
+ const key = cardKey("friction_candidate", fingerprint)
115
+ const evidence = Array.isArray(card.evidenceJobs) ? card.evidenceJobs.map((job) => `job:${job}`) : []
116
+ try {
117
+ const { result, commit, route_around: routeAround } = await commitCard({
118
+ deskRoot,
119
+ personPrefix: prefix,
120
+ message: (written) => cardCommitMessage("friction", written.file_name ?? "set_aside"),
121
+ spawnGit,
122
+ schedulePush,
123
+ write: () => openImprovement({ deskRoot, personPrefix: prefix, key, source: "friction_candidate", lesson, evidence, plugin: card.plugin, signal: card.signal, now }),
124
+ })
125
+ const out = { improvement: result.result }
126
+ if (OPENED_CODES.has(result.result) && typeof result.file_name === "string") Object.assign(out, { improvement_key: key, improvement_path: path.posix.join(prefix, "_meta", "improvement", result.file_name) })
127
+ if (OPENED_CODES.has(result.result) && commit !== "committed" && commit !== "no_change" && commit !== "no_files") {
128
+ out.improvement_commit = commit
129
+ if (routeAround) {
130
+ out.improvement_route_around = routeAround
131
+ return { next: unfinishedNext(routeAround, "improvement_route_around"), ...out }
132
+ }
133
+ }
134
+ return out
135
+ } catch {
136
+ return { improvement: "card_write_failed" }
137
+ }
138
+ }
139
+
140
+ /**
141
+ * friction_add
142
+ *
143
+ * Input:
144
+ * {
145
+ * track?: string, // omit for cross-cutting; include for track-local
146
+ * theme?: string, // short slug for the track-local filename; defaults "untitled"
147
+ * body: string, // the entry body (without surrounding `---` separators)
148
+ * about?: "setup" | "system", // default "setup"; "system" records a kaizen candidate
149
+ * title?: string, // required for "system": the card's title
150
+ * plugin?: string, // "system": the plugin the friction is in; default "desk"
151
+ * friction_class?: string, // "system": one of FRICTION_CLASSES; default "other"
152
+ * signal?: string, // "system": the rollups measure the friction moves, when known
153
+ * evidence_jobs?: string[], // "system": factory job ids that show it, when known
154
+ * file_card?: true, // "system": also file the store's kaizen issue now (the immediate mirror)
155
+ * error_code?: string, // the code of a Desk failure line: the one call that reports it. Defaults `about` to "system" and `title` to "Desk error <code>", makes `body` optional, and appends the failure's evidence (its message and stack, the Desk version, host, desk path and recent sync status, credentials redacted) to the entry on the desk
156
+ * }
157
+ *
158
+ * Side effects: appends to the resolved friction file. Track-local files begin
159
+ * with an identity comment so lossy legacy filenames cannot absorb unrelated
160
+ * entries. Creates parent dirs + the file itself if missing. Adds a leading
161
+ * `---` separator between entries (and a trailing newline) so future entries
162
+ * land cleanly.
163
+ *
164
+ * On a Git desk, also stages the file it wrote — when it held no unstaged
165
+ * changes before this write — and commits exactly that file right after
166
+ * (M4-6 Part 2). A commit failure never loses the write: it comes back as
167
+ * `commit: { status: "failed", reason }` on the result, omitted entirely on
168
+ * a normal, silent success, when the file was already dirty, or on a
169
+ * non-Git desk.
170
+ *
171
+ * For system friction the improvement card is opened after the entry is written (the key is the friction fingerprint, so a
172
+ * retry never opens a second card; a closed card with the key is reopened), as a second, separate committed write; the
173
+ * result gains `improvement`: "opened" | "duplicate" | "reopened" or the card library's refusal code (for example
174
+ * `not_generic`), or `factory_state_unavailable` (no machine secret, so no fingerprint) or `card_write_failed`; and
175
+ * `improvement_commit` when the card was written but not committed; an opened, found or reopened card is named by
176
+ * `improvement_key` and `improvement_path` (desk-relative). `lesson: { owner, topic }` (lesson_add's own call) titles
177
+ * the card from the lesson. A refused or failed card never loses the entry.
178
+ * The call behaves the same in a noninteractive session; only picking a card up is refused there.
179
+ *
180
+ * System friction about a tool owned in ourostack files a GitHub issue on that tool's repo for its drain
181
+ * (`src/factory/tool-issue-file.js`): `plugin` defaults to "desk", and `desk-*` names and `superpowers` are Desk's repo. The title
182
+ * and `body` are the issue, so the body carries the evidence. Desk's own parts also keep the improvement card; the other
183
+ * tools get the issue alone. The result gains `issue` ("filed" | "known"), `issue_url` and `repo`. A `plugin` that names no
184
+ * owned tool gains `issue: "unknown_tool"` and `issue_next`, which names the argument that files it. A filing that fails
185
+ * writes the entry (with the paste-ready text), then throws `friction_add_issue_not_filed`. `error_code` reports and a
186
+ * `fileIssue` of `null` (a caller that must not file, such as lesson_add) file nothing.
187
+ *
188
+ * Returns: { status: "added", path, commit? }; { status: "added", path,
189
+ * kaizen: "candidate", commit? } for system friction; with `file_card`,
190
+ * { status: "filed", path, url, kaizen: "filed" | "duplicate", commit? } or
191
+ * { status: "added", path, kaizen: <code>, commit? } when the card was not
192
+ * filed.
193
+ */
194
+ export async function friction_add({ deskRoot, input, person = null, search, env = process.env, now, fileCard = fileKaizenCard, fileIssue = fileToolIssue, commitCard = writeCardCommitted, spawnGit = spawnSync, schedulePush = schedulePushDefault, lesson }) {
195
+ const values = input ?? {}
196
+ const { track, theme } = values
197
+ const errorCode = values.error_code
198
+ if (errorCode !== undefined && (typeof errorCode !== "string" || !/^[a-z][a-z0-9_]*$/u.test(errorCode))) {
199
+ throw Object.assign(new Error("friction_add: Pass `error_code` as the code a Desk failure line gave: `error_code` must be the code a Desk failure line gave in its friction_add call, such as desk_push_blocked"), { code: "friction_add_error_code_must_be_the" })
200
+ }
201
+ const reporting = errorCode !== undefined
202
+ if (!reporting && (!values.body || typeof values.body !== "string")) {
203
+ throw Object.assign(new Error("friction_add: Pass `body` as a string: `body` is required (string)"), { code: "friction_add_body_is_required_string" })
204
+ }
205
+ if (reporting && values.body !== undefined && typeof values.body !== "string") throw Object.assign(new Error("friction_add: Pass `body` as a string: `body` must be a string"), { code: "friction_add_body_must_be_a_string" })
206
+ const body = reporting ? [values.body?.trim(), failureEvidence({ code: errorCode, deskRoot, env })].filter(Boolean).join("\n\n") : values.body
207
+ const about = values.about ?? (reporting ? "system" : "setup")
208
+ if (!ABOUT.has(about)) throw Object.assign(new Error("friction_add: Pass `about` as \"setup\" or \"system\": `about` must be \"setup\" or \"system\""), { code: "friction_add_about_must_be_setup_or" })
209
+ const fileNow = values.file_card === true
210
+ if (values.file_card !== undefined && values.file_card !== false && !fileNow) throw Object.assign(new Error("friction_add: Pass `file_card` as true or false: `file_card` must be true or false"), { code: "friction_add_file_card_must_be_true" })
211
+ if (fileNow && about !== "system") throw Object.assign(new Error("friction_add: Drop `file_card`, or set `about` to \"system\": `file_card` is only for system friction"), { code: "friction_add_file_card_is_only_for" })
212
+ let card = null
213
+ if (about === "system") {
214
+ const title = values.title ?? (reporting ? `Desk error ${errorCode}` : undefined)
215
+ if (typeof title !== "string" || title.trim() === "" || /[\r\n]/u.test(title)) throw Object.assign(new Error("friction_add: Pass `title`: `title` is required for system friction, on one line"), { code: "friction_add_title_is_required_for_system" })
216
+ const plugin = values.plugin ?? "desk"
217
+ if (typeof plugin !== "string" || !PATTERNS.pluginName.test(plugin)) throw Object.assign(new Error("friction_add: Pass `plugin` as a plugin name: `plugin` must be a plugin name"), { code: "friction_add_plugin_must_be_a_plugin" })
218
+ const frictionClass = values.friction_class ?? "other"
219
+ if (!FRICTION_CLASSES.includes(frictionClass)) throw Object.assign(new Error(`friction_add: Pass \`friction_class\` as one of the listed values: \`friction_class\` must be one of ${FRICTION_CLASSES.join(", ")}`), { code: "friction_add_friction_class_must_be_one" })
220
+ card = { title: title.trim(), plugin, frictionClass, signal: values.signal ?? null, evidenceJobs: values.evidence_jobs ?? [] }
221
+ }
222
+
223
+ let filePath
224
+ let identity = null
225
+ if (typeof track === "string" && track.length > 0) {
226
+ const themeSlug = slugify(theme) || "untitled"
227
+ const resolved = await resolveTrackFrictionPath({
228
+ deskRoot,
229
+ person,
230
+ track,
231
+ themeSlug,
232
+ })
233
+ filePath = resolved.filePath
234
+ identity = resolved.identity
235
+ } else {
236
+ filePath = await resolveWriteTarget({
237
+ deskRoot,
238
+ person,
239
+ segments: ["_meta", "friction.md"],
240
+ })
241
+ }
242
+
243
+ // The desk write must be possible before anything is filed.
244
+ await fs.mkdir(path.dirname(filePath), { recursive: true })
245
+ // Checked once the parent dir exists (a brand-new track's `_friction/`
246
+ // folder may not, yet) and before this call's own write, so it reads only
247
+ // whether another session already left this file dirty.
248
+ const stage = stagingAllowed(filePath, spawnGit)
249
+
250
+ // Friction about a tool owned in ourostack (Desk included) becomes an issue on that tool's repo, where its drain reads it.
251
+ // Desk's own parts also keep their improvement card; the other tools get the issue alone.
252
+ const tool = card !== null && !reporting && fileIssue !== null ? ownedToolFor(card.plugin) : null
253
+ const keepsCard = card !== null && (tool === null || tool === "desk" || tool === "superpowers")
254
+ const fingerprint = card === null || !keepsCard ? null : await fingerprintIfReady(env, deskRoot, card)
255
+ let filed = null
256
+ let issue = null
257
+ let entry = body
258
+ if (keepsCard && fileNow) {
259
+ filed = await fileCard(env, { deskRoot, title: card.title, body, plugin: card.plugin, frictionClass: card.frictionClass, signal: card.signal, evidenceJobs: card.evidenceJobs })
260
+ entry = filed.result === "filed" || filed.result === "duplicate"
261
+ ? `Kaizen card for "${card.title}": ${filed.result === "filed" ? "filed" : "already open"} at ${filed.url}`
262
+ : `Kaizen card for "${card.title}": not filed (${filed.result}); it stays a candidate.`
263
+ } else if (keepsCard) {
264
+ const measure = card.signal === null ? "not chosen" : `\`${card.signal}\``
265
+ const jobs = Array.isArray(card.evidenceJobs) && card.evidenceJobs.length > 0 ? card.evidenceJobs.join(", ") : "none yet"
266
+ entry = `${body.trimEnd()}\n\nSystem friction: "${card.title}"; plugin \`${card.plugin}\`, class \`${card.frictionClass}\`, measure ${measure}, evidence jobs ${jobs}.`
267
+ }
268
+ if (tool !== null) {
269
+ issue = await fileIssue(env, { tool, title: card.title, body })
270
+ const ok = issue.result === "filed" || issue.result === "known"
271
+ const line = ok
272
+ ? `Issue for "${card.title}" on ${issue.repo}: ${issue.result === "filed" ? "filed" : "already open, new evidence added"} at ${issue.url}`
273
+ : `Issue for "${card.title}" on ${issue.repo ?? tool}: not filed (${issue.reason ?? issue.result}); file it by hand with the text below.\n\n${issue.body ?? body}`
274
+ entry = keepsCard ? `${entry.trimEnd()}\n\n${line}` : line
275
+ }
276
+
277
+ // The card's key carries the fingerprint, so the note names it: the agent that picks the card up finds the note by it.
278
+ if (fingerprint !== null) entry = `${entry.trimEnd()}\n\nImprovement card key: \`friction_candidate:${fingerprint}\`.`
279
+ const trimmedBody = entry.endsWith("\n") ? entry : `${entry}\n`
280
+ if (await pathExists(filePath)) {
281
+ // Append with a separator so each entry is visually distinct.
282
+ const existing = await fs.readFile(filePath, "utf8")
283
+ const sep = existing.endsWith("\n") ? "" : "\n"
284
+ await fs.writeFile(
285
+ filePath,
286
+ `${existing}${sep}\n---\n\n${trimmedBody}`,
287
+ "utf8",
288
+ )
289
+ } else {
290
+ const initial = identity ? `${identity}\n\n${trimmedBody}` : trimmedBody
291
+ await fs.writeFile(filePath, initial, "utf8")
292
+ }
293
+
294
+ const commit = stage
295
+ ? stageAndCommitFile(filePath, `friction_add: ${values.plugin ?? "desk-plugin"}`, spawnGit, deskRoot)
296
+ : undefined
297
+ if (stage && !commit) schedulePush({ root: deskRoot })
298
+
299
+ search?.noteChange(relPath(deskRoot, filePath))
300
+ const written = relPath(deskRoot, filePath)
301
+ let result
302
+ if (card === null) {
303
+ result = { status: "added", path: written }
304
+ } else if (keepsCard && filed === null) {
305
+ result = { status: "added", path: written, kaizen: "candidate" }
306
+ } else if (keepsCard && (filed.result === "filed" || filed.result === "duplicate")) {
307
+ result = { status: "filed", path: written, url: filed.url, kaizen: filed.result }
308
+ } else if (keepsCard) {
309
+ result = { status: "added", path: written, kaizen: filed.result }
310
+ } else {
311
+ result = { status: issue.url ? "filed" : "added", path: written }
312
+ }
313
+ if (issue !== null) Object.assign(result, issue.url ? { issue: issue.result, issue_url: issue.url, repo: issue.repo } : { issue: issue.reason ?? issue.result, repo: issue.repo })
314
+ if (issue?.url) {
315
+ result.status = "filed"
316
+ if (!keepsCard) result.url = issue.url
317
+ }
318
+ if (card !== null && !reporting && fileIssue !== null && tool === null) {
319
+ result.issue = "unknown_tool"
320
+ result.issue_next = `Not filed as an issue: Desk does not know a tool called \`${card.plugin}\`. Pass \`plugin\` as one of ${Object.keys(OWNED_TOOLS).join(", ")} to file it on that tool's repo.`
321
+ }
322
+ if (commit) result.commit = commit
323
+ if (keepsCard) {
324
+ const opened = await openCard({ deskRoot, person, card, fingerprint, lesson, now, commitCard, spawnGit, schedulePush })
325
+ // A card whose commit did not finish says what to do first, as the answer's first key (#623).
326
+ result = opened.next === undefined ? { ...result, ...opened } : { next: opened.next, ...result, ...opened }
327
+ }
328
+ if (issue !== null && issue.url === undefined) {
329
+ throw Object.assign(new Error(`friction_add: Pass a title and body the repo can take, or sign in: the issue on ${issue.repo ?? tool} was not filed (${issue.reason ?? issue.result}); ${ISSUE_FIXES[issue.reason] ?? "run the call again"}. Your note is saved at ${written}`), { code: "friction_add_issue_not_filed" })
330
+ }
331
+ return result
332
+ }
@@ -0,0 +1,156 @@
1
+ // improvement_open, improvement_next and improvement_update: the agent's three doors to the improvement cards that
2
+ // live on the desk (`desk/improvement-cards.js`). Every card write goes through `writeCardCommitted`, the same
3
+ // commit-and-push protocol the task tools and friction_add use.
4
+ //
5
+ // Answers carry the card's file name and stable codes, never an absolute path, an account or text from outside the
6
+ // card. A writing tool: the headless guard refuses all three under DESK_FACTORY_HEADLESS because none is on its
7
+ // read-only list.
8
+
9
+ import * as path from "node:path"
10
+ import { deskRelativePath, personPrefix } from "../util/paths.js"
11
+ import { isNoninteractive } from "../runtime/boot.js"
12
+ import { isHeadlessFactorySession } from "../factory/headless-flag.js"
13
+ import { cardKey, openImprovement, claimNext, updateCard, readCards, MAX_CARD_FILES } from "../desk/improvement-cards.js"
14
+ import { writeCardCommitted, cardCommitMessage } from "./_card-commit.js"
15
+ import { unfinishedNext } from "../util/route-around.js"
16
+ import { AUTHORITY } from "../desk/improvement-authority.js"
17
+
18
+ export const IMPROVEMENT_OPEN_FIELDS = ["source", "id", "title", "evidence", "plugin", "signal"]
19
+ export const IMPROVEMENT_NEXT_FIELDS = ["session"]
20
+ export const IMPROVEMENT_UPDATE_FIELDS = ["key", "claim_id", "state", "countermeasure", "close_reason"]
21
+
22
+ /** The fixed paragraph printed with every pickup (the authority-statement ruling). */
23
+ export { AUTHORITY }
24
+
25
+ /** What each refusal of `improvement_next` means, in one fixed sentence. */
26
+ export const NEXT_REFUSALS = Object.freeze({
27
+ claim_held: "This machine already holds a live claim; finish or release that card first.",
28
+ none_open: "No improvement card is open.",
29
+ too_many_cards: "The card folder holds more files than can be read safely; close or archive finished cards.",
30
+ machine_key_unavailable: "This machine has no factory state, so it cannot take improvement cards.",
31
+ noninteractive: "Improvement cards are only taken in a session with an operator present.",
32
+ })
33
+
34
+ /** The close reasons an agent may give for a card it holds. */
35
+ export const AGENT_CLOSE_REASONS = Object.freeze(["wont_fix", "duplicate", "not_reproducible"])
36
+
37
+ const OPENED = new Set(["opened", "duplicate", "reopened"])
38
+
39
+ // The card library takes the person prefix relative to the desk root: "" or desks/<alias>.
40
+ function prefixOf(deskRoot, person) {
41
+ return deskRelativePath(deskRoot, personPrefix(deskRoot, person))
42
+ }
43
+
44
+ function withCommit(answer, commit, setAside, leftAlone, routeAround) {
45
+ if (commit !== "committed" && commit !== "no_files" && commit !== "no_change") answer.commit = commit
46
+ if (routeAround) answer.route_around = routeAround
47
+ if (setAside) answer.set_aside = setAside
48
+ if (leftAlone) answer.left_alone = leftAlone
49
+ return routeAround ? { next: unfinishedNext(routeAround, "route_around"), ...answer } : answer
50
+ }
51
+
52
+ const messageFor = (verb) => (result) => cardCommitMessage(verb, result.file_name ?? "set_aside")
53
+
54
+ function record(search, prefix, fileName) {
55
+ if (fileName) search?.noteChange(path.posix.join(prefix, "_meta", "improvement", fileName))
56
+ }
57
+
58
+ /**
59
+ * improvement_open({ source, id, title?, evidence?, plugin?, signal? }) -> { status, result, file_name?, commit?, set_aside? }
60
+ * `status` is "ok" when the card is opened, reopened or already open, else "refused"; `result` is the library's code.
61
+ * `title` is never accepted (refused `title_not_allowed`): the library builds every title.
62
+ */
63
+ export async function improvement_open({ deskRoot, input, person = null, search, now, spawnGit, schedulePush }) {
64
+ const values = input ?? {}
65
+ let key
66
+ try {
67
+ key = cardKey(values.source, values.id)
68
+ } catch {
69
+ return { status: "refused", result: "invalid_source" }
70
+ }
71
+ const prefix = prefixOf(deskRoot, person)
72
+ const { result, commit, left_alone: leftAlone, route_around: routeAround } = await writeCardCommitted({
73
+ deskRoot,
74
+ personPrefix: prefix,
75
+ message: messageFor("open"),
76
+ spawnGit,
77
+ schedulePush,
78
+ write: () => openImprovement({
79
+ deskRoot, personPrefix: prefix, key, source: values.source, title: values.title,
80
+ evidence: values.evidence ?? [], plugin: values.plugin ?? "desk", signal: values.signal ?? null, now,
81
+ }),
82
+ })
83
+ record(search, prefix, result.file_name)
84
+ const answer = { status: OPENED.has(result.result) ? "ok" : "refused", result: result.result }
85
+ if (result.file_name) answer.file_name = result.file_name
86
+ return withCommit(answer, commit, result.set_aside, leftAlone, routeAround)
87
+ }
88
+
89
+ /**
90
+ * improvement_next({ session? }) -> { status: "claimed", card, claim_id, authority } | { status: <code>, meaning }
91
+ * The codes are the keys of NEXT_REFUSALS, plus the library's own (`invalid_session`, `unreadable_folder`, `lock_busy`,
92
+ * `invalid_location`).
93
+ */
94
+ export async function improvement_next({ deskRoot, input, person = null, search, env = process.env, now, spawnGit, schedulePush }) {
95
+ if (isNoninteractive(env) || isHeadlessFactorySession(env)) return { status: "noninteractive", meaning: NEXT_REFUSALS.noninteractive }
96
+ const prefix = prefixOf(deskRoot, person)
97
+ const { result, commit, left_alone: leftAlone, route_around: routeAround } = await writeCardCommitted({
98
+ deskRoot,
99
+ personPrefix: prefix,
100
+ message: messageFor("claim"),
101
+ spawnGit,
102
+ schedulePush,
103
+ write: () => claimNext({ env, deskRoot, personPrefix: prefix, now, session: input?.session }),
104
+ })
105
+ if (result.result !== "claimed") {
106
+ const answer = { status: result.result }
107
+ if (NEXT_REFUSALS[result.result]) answer.meaning = NEXT_REFUSALS[result.result]
108
+ if (result.result === "claim_held") answer.key = result.key
109
+ return withCommit(answer, commit, result.set_aside, leftAlone, routeAround)
110
+ }
111
+ record(search, prefix, result.file_name)
112
+ const { key, source, title, evidence, state, plugin, signal, countermeasure, kaizen_url: kaizenUrl, recurrences, reopened, checks_run: checksRun } = result.card
113
+ const card = { key, source, title, evidence, state, plugin, signal, countermeasure, kaizen_url: kaizenUrl, recurrences, reopened, checks_run: checksRun }
114
+ return withCommit({ status: "claimed", card, claim_id: result.claim_id, authority: AUTHORITY }, commit, result.set_aside, leftAlone, routeAround)
115
+ }
116
+
117
+ // What the holder of a claim may do, as the library patch it means; null when the input asks for something else.
118
+ function holderPatch(values) {
119
+ const { state, countermeasure, close_reason: reason } = values
120
+ if (countermeasure !== undefined && (state === undefined || state === "shipped") && reason === undefined) return { state: "shipped", countermeasure }
121
+ if (state === "open" && countermeasure === undefined && reason === undefined) return { state: "open" }
122
+ if (state === "closed_unverified" && countermeasure === undefined && AGENT_CLOSE_REASONS.includes(reason)) return { state, close_reason: reason }
123
+ return null
124
+ }
125
+
126
+ /**
127
+ * improvement_update({ key, claim_id, state?, countermeasure?, close_reason? }) -> { status: "updated", state } | { status: "refused", result }
128
+ * Allowed for the holder of the card's claim, and only these three: ship (`countermeasure`, with `state` "shipped" or
129
+ * omitted), release (`state: "open"`) and close (`state: "closed_unverified"` with a `close_reason` from
130
+ * AGENT_CLOSE_REASONS). Everything the verify step owns is out of reach.
131
+ */
132
+ export async function improvement_update({ deskRoot, input, person = null, search, now, spawnGit, schedulePush }) {
133
+ const values = input ?? {}
134
+ const prefix = prefixOf(deskRoot, person)
135
+ const patch = holderPatch(values)
136
+ if (patch === null) return { status: "refused", result: "invalid_patch" }
137
+ if (typeof values.key !== "string" || typeof values.claim_id !== "string") return { status: "refused", result: "not_your_claim" }
138
+ const held = await readCards({ deskRoot, personPrefix: prefix, limit: MAX_CARD_FILES })
139
+ if (held.unreadable) return { status: "refused", result: "unreadable_folder" }
140
+ const card = held.cards.find((candidate) => candidate.key === values.key)
141
+ if (!card) return { status: "refused", result: "not_found" }
142
+ if (card.state !== "claimed" || card.claim?.claim_id !== values.claim_id) return { status: "refused", result: "not_your_claim" }
143
+ const { result, commit, left_alone: leftAlone, route_around: routeAround } = await writeCardCommitted({
144
+ deskRoot,
145
+ personPrefix: prefix,
146
+ message: messageFor("update"),
147
+ spawnGit,
148
+ schedulePush,
149
+ write: () => updateCard({ deskRoot, personPrefix: prefix, key: values.key, claim_id: values.claim_id, patch, now }),
150
+ })
151
+ if (result.result !== "updated") {
152
+ return withCommit({ status: "refused", result: result.result }, commit, result.set_aside, leftAlone, routeAround)
153
+ }
154
+ record(search, prefix, result.file_name)
155
+ return withCommit({ status: "updated", state: result.card.state }, commit, result.set_aside, leftAlone, routeAround)
156
+ }
@@ -0,0 +1,22 @@
1
+ // The text side of lesson_add: one-line checks, and (from runtime/lesson-section.js, which session start can load without
2
+ // the runtime dependencies) the `## Lessons` section edit, shared by the personal write in lesson.js and the team write in
3
+ // lesson-team.js.
4
+
5
+ import { slugify } from "../util/fm.js"
6
+
7
+ export { SECTION, lead, lessonLine, withLesson } from "../runtime/lesson-section.js"
8
+
9
+ export function oneLine(value, name) {
10
+ if (typeof value !== "string" || value.trim() === "") throw Object.assign(new Error(`lesson_add: Pass the missing argument as a string: \`${name}\` is required (string)`), { code: "lesson_add_is_required_string" })
11
+ const trimmed = value.trim()
12
+ if (/[\r\n]/u.test(trimmed)) throw Object.assign(new Error(`lesson_add: Pass \`${name}\` on one line: \`${name}\` must be one line: a lesson is one rule`), { code: "lesson_add_must_be_one_line_a" })
13
+ return trimmed
14
+ }
15
+
16
+ /** The topic as the line's bold lead, without the full stop the line adds. */
17
+ export function topicOf(value) {
18
+ const topic = oneLine(value, "topic").replace(/[.\s]+$/u, "")
19
+ if (topic === "" || !slugify(topic)) throw Object.assign(new Error("lesson_add: Pass `topic` as a string that holds a word: `topic` is required (string) and must hold a word"), { code: "lesson_add_topic_is_required_string_and" })
20
+ return topic
21
+ }
22
+
@@ -0,0 +1,137 @@
1
+ // lesson_add's owners: the plugins a desk lesson can be filed against.
2
+ //
3
+ // A machine can run several hosts, each with its own plugins: MS Desk may be installed for Copilot only, while the lesson
4
+ // is recorded from Claude Code. So the owners are every plugin installed for any host on this machine, read from where
5
+ // each host keeps them, never from a fixed list:
6
+ //
7
+ // - the running Desk and what this session's host has installed beside it (`scan`, the factory's own reading);
8
+ // - Claude Code's registry, `<CLAUDE_CONFIG_DIR or ~/.claude>/plugins/installed_plugins.json`;
9
+ // - Copilot CLI's own installs, `<COPILOT_HOME or ~/.copilot>/installed-plugins/<marketplace>/<plugin>/`;
10
+ // - Agency's cache, which Copilot sessions under Agency copy their plugins from, `~/.local/agency/plugins/cache`;
11
+ // - Codex's plugin folder, `<CODEX_HOME or ~/.codex>/plugins/`, read a few levels deep.
12
+ //
13
+ // So "installed" means present on this machine for some host: Agency's cache keeps every plugin it has fetched, and Claude
14
+ // Code's registry lists disabled plugins too. A made-up plugin is in none of them. A host's folders keep old versions beside
15
+ // the active one; only the running Desk and the newest version of each other plugin count, so a skill an upgrade removed is
16
+ // no owner. A linked plugin folder (a local install often is one) is followed, each real folder once. Every read is bounded
17
+ // (folder and entry counts, manifest and registry sizes) and anything unreadable is skipped.
18
+
19
+ import { readdirSync, realpathSync, statSync } from "node:fs"
20
+ import * as os from "node:os"
21
+ import * as path from "node:path"
22
+ import { readSmallText } from "../factory/marker.js"
23
+ import { deskPluginRoot } from "../package-metadata.js"
24
+ import { agencyCacheEntries } from "../runtime/pending-migrations.js"
25
+ import { compareVersions } from "../runtime/stale-desk.js"
26
+
27
+ const MANIFESTS = ["plugin.json", path.join(".claude-plugin", "plugin.json"), path.join(".codex-plugin", "plugin.json"), "agency.json"]
28
+ // How many folders one host's reading may look at, so a large or looping folder never slows a lesson down.
29
+ const MAX_FOLDERS = 512
30
+ const MAX_INDEX_ENTRIES = 256
31
+ const MAX_MANIFEST_BYTES = 64 * 1024
32
+ const MAX_REGISTRY_BYTES = 4 * 1024 * 1024
33
+
34
+ const text = (value) => (typeof value === "string" && value.trim() !== "" ? value : null)
35
+
36
+ function readJson(file, limit) {
37
+ try {
38
+ return JSON.parse(readSmallText(file, limit))
39
+ } catch {
40
+ return null
41
+ }
42
+ }
43
+
44
+ function pluginManifest(dir) {
45
+ for (const manifest of MANIFESTS) {
46
+ const read = readJson(path.join(dir, manifest), MAX_MANIFEST_BYTES)
47
+ if (typeof read?.name === "string") return { name: read.name, version: typeof read.version === "string" ? read.version : null }
48
+ }
49
+ return null
50
+ }
51
+
52
+ function isFolder(dir) {
53
+ try {
54
+ return statSync(dir).isDirectory()
55
+ } catch {
56
+ return false
57
+ }
58
+ }
59
+
60
+ function realFolder(dir) {
61
+ try {
62
+ return realpathSync(dir)
63
+ } catch {
64
+ return dir
65
+ }
66
+ }
67
+
68
+ // The folders in `dir`, a link to a folder included; a dangling link is not a folder.
69
+ function subfolders(dir) {
70
+ try {
71
+ const entries = readdirSync(dir, { withFileTypes: true })
72
+ return entries.filter((entry) => entry.isDirectory() || (entry.isSymbolicLink() && isFolder(path.join(dir, entry.name)))).map((entry) => path.join(dir, entry.name))
73
+ } catch {
74
+ return []
75
+ }
76
+ }
77
+
78
+ // The plugin folders under `root`, at most `depth` levels down; a plugin's own folder is not searched further. Each real
79
+ // folder is visited once, so a link back up the tree or a second link to the same checkout adds nothing.
80
+ function pluginFolders(root, depth) {
81
+ const found = []
82
+ const visited = new Set([realFolder(root)])
83
+ let seen = 0
84
+ const walk = (dir, left) => {
85
+ for (const sub of subfolders(dir)) {
86
+ if (++seen > MAX_FOLDERS) return
87
+ const real = realFolder(sub)
88
+ if (visited.has(real)) continue
89
+ visited.add(real)
90
+ if (pluginManifest(sub) !== null) found.push(sub)
91
+ else if (left > 1) walk(sub, left - 1)
92
+ }
93
+ }
94
+ walk(root, depth)
95
+ return found
96
+ }
97
+
98
+ function claudeInstalls(env, home) {
99
+ const registry = readJson(path.join(text(env.CLAUDE_CONFIG_DIR) ?? path.join(home, ".claude"), "plugins", "installed_plugins.json"), MAX_REGISTRY_BYTES)
100
+ const records = Object.values(registry?.plugins ?? {}).filter(Array.isArray).flat().slice(0, MAX_INDEX_ENTRIES)
101
+ return records.map((record) => record?.installPath).filter((dir) => typeof dir === "string" && path.isAbsolute(dir))
102
+ }
103
+
104
+ /** Every plugin folder installed for any host on this machine, besides this session's own; none when the home folder is not absolute. */
105
+ function machinePluginDirs(env) {
106
+ const home = text(env.HOME) ?? text(env.USERPROFILE) ?? os.homedir()
107
+ if (!path.isAbsolute(home)) return []
108
+ return [
109
+ ...claudeInstalls(env, home),
110
+ ...pluginFolders(path.join(text(env.COPILOT_HOME) ?? path.join(home, ".copilot"), "installed-plugins"), 2),
111
+ ...agencyCacheEntries(home).slice(0, MAX_INDEX_ENTRIES).map((entry) => entry.dir),
112
+ ...pluginFolders(path.join(text(env.CODEX_HOME) ?? path.join(home, ".codex"), "plugins"), 4),
113
+ ]
114
+ }
115
+
116
+ // Whether `next` is a newer install of the same plugin than `kept`: a version beats none, and the higher version wins.
117
+ function newer(next, kept) {
118
+ if (next.version === null) return false
119
+ if (kept.version === null) return true
120
+ return compareVersions(next.version, kept.version) === 1
121
+ }
122
+
123
+ /**
124
+ * `installedPlugins(env, scan, hosts?) -> Map<name, { dir, version }>`: the plugins a desk lesson can name, each at its
125
+ * active folder: the running Desk, this host's plugins (`scan(env).dirs`) and every other host's (`hosts(env)`).
126
+ */
127
+ export function installedPlugins(env, scan, hosts = machinePluginDirs) {
128
+ const plugins = new Map()
129
+ const deskRoot = deskPluginRoot(env)
130
+ for (const dir of [deskRoot, ...scan(env).dirs, ...hosts(env)]) {
131
+ const manifest = pluginManifest(dir)
132
+ if (manifest === null) continue
133
+ const kept = plugins.get(manifest.name)
134
+ if (kept === undefined || (kept.dir !== deskRoot && newer(manifest, kept))) plugins.set(manifest.name, { dir, version: manifest.version })
135
+ }
136
+ return plugins
137
+ }