@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,523 @@
1
+ // The evaluator's stretches as the Lean walk reads them: what each waiting
2
+ // stretch waited on, the honest split of waiting time during which the job's
3
+ // own workers were working, and each job's stretches, workers, human turns,
4
+ // pull requests, after-stop waits and ask-tool idle time on the job clock.
5
+ //
6
+ // Rules:
7
+ // - A stretch's evidence ranges resolve to the session's fact intervals
8
+ // with exactly that `[start_ms, end_ms]` (the store checks that every
9
+ // range is one); a range two intervals share resolves to both.
10
+ // - `waited_on`, for a `waiting` stretch, comes from its evidence. Each
11
+ // evidence interval names at most one cause: a `human_wait` is
12
+ // `next_prompt` (the time from the agent stopping to the next prompt,
13
+ // nights included), an `api_retry` is `api_retry`, a tool call with any
14
+ // outcome other than `ok` (an error, a timeout, a denial or an
15
+ // interruption) is `tool_failure`, and a successful tool call of five
16
+ // minutes or more is `long_tool_call`. Any other interval names none.
17
+ // When the evidence names several causes, the cause whose intervals add
18
+ // up to the most time wins (each interval's whole length, counted once);
19
+ // a tie goes to the cause listed first in `WAITED_ON`. Evidence that
20
+ // names no cause is `unknown`.
21
+ // - Honest correction: a stretch where any worker of the job is doing work
22
+ // is not waiting. The part of a `waiting` stretch during which a worker
23
+ // of the job (the binding's workers, the controller cut to the job's
24
+ // segments) has a `turn` or `tool` interval is split off as its own
25
+ // stretch with `class: "unlabeled"`, `waste: null` and
26
+ // `reason: "agents_working"`; the rest stays `waiting`. The workers the
27
+ // stretch's own evidence shows waiting (the workers of its cause-naming
28
+ // intervals) are left out of that test: the tool call a worker is
29
+ // blocked on, and the turn around it, are the wait itself, not other
30
+ // work. So are their ancestors' intervals that hold a cause-naming
31
+ // interval (a parent's turn around the subagent it waits on), and a
32
+ // parent's `subagent` interval never counts: the subagent's own
33
+ // intervals carry its work. The split reads one session's own workers: a concurrent session
34
+ // of the same job does not split another session's wait (the stack-up
35
+ // counts such moments once, by precedence). Existing totals keep reading
36
+ // the labels as written; the corrected figures have their own keys.
37
+ // - Nothing here adds a time the facts do not carry: a session without a
38
+ // job offset (a public desk, or a card with no readable creation time)
39
+ // places nothing on the job clock, and a pull request without `at_ms`
40
+ // is listed with no time.
41
+ //
42
+ // `src/factory/**` imports only `node:` built-ins and other `src/factory/`
43
+ // files.
44
+
45
+ import { ownerOf } from "./attention.js"
46
+ import { jobOwnsPullRequest } from "./formulas.js"
47
+ import { stableStringify } from "./normalize.js"
48
+ import { boundIntervals, union } from "./timeline.js"
49
+
50
+ /** What a `waiting` stretch waited on, in tie-break order. */
51
+ export const WAITED_ON = Object.freeze(["next_prompt", "api_retry", "tool_failure", "long_tool_call", "unknown"])
52
+
53
+ /**
54
+ * How a turn ends when the agent asks the operator through a tool (`intervals[kind=human_wait].stop.end`, facts `/4`): a question tool or
55
+ * a plan for approval. The operator's answer is the next prompt, so the time inside such a wait is idle, not working (`askIdle`).
56
+ */
57
+ export const ASK_ENDS = Object.freeze(["ask_question", "ask_plan"])
58
+
59
+ /** A successful tool call at least this long is a wait on the call (`long_tool_call`): five minutes. */
60
+ export const LONG_TOOL_CALL_MS = 5 * 60 * 1000
61
+
62
+ /** The class and reason of the part of a waiting stretch split off because a worker of the job was working. */
63
+ export const UNLABELED_CLASS = "unlabeled"
64
+ export const AGENTS_WORKING = "agents_working"
65
+
66
+ /** The finest bin a swimlane file's intervals are merged at when the file would pass its size budget; it doubles until the file fits. */
67
+ const FIRST_BIN_MS = 1000
68
+
69
+ /** Why a swimlane file is larger than its budget: binning merged every run, and the intervals its stretches cite still do not fit. */
70
+ const OVER_BUDGET = "over_budget_after_binning"
71
+
72
+ /** How many stretch references each cause in `rollups/causes.json` lists, largest first. */
73
+ export const CAUSE_REFERENCES = 10
74
+
75
+ function compareText(left, right) {
76
+ return Number(left > right) - Number(left < right)
77
+ }
78
+
79
+ /** Orders two entries by the named fields in turn, each compared as a number or as text. */
80
+ export function compareFields(left, right, fields) {
81
+ for (const field of fields) {
82
+ const order = compareText(left[field], right[field])
83
+ if (order !== 0) return order
84
+ }
85
+ return 0
86
+ }
87
+
88
+ function bindingOf(session, job) {
89
+ return session.jobs.find((binding) => binding.job === job)
90
+ }
91
+
92
+ /** `evidenceIntervals(session, ranges)`: the fact intervals each `[start_ms, end_ms]` range names, in the session's interval order, each once. */
93
+ export function evidenceIntervals(session, ranges) {
94
+ const byRange = rangeIndex(session)
95
+ const wanted = new Set(ranges.map(([start, end]) => `${start}:${end}`))
96
+ return [...wanted].flatMap((key) => byRange.get(key) ?? []).sort((left, right) => left.position - right.position).map((entry) => entry.interval)
97
+ }
98
+
99
+ // Each session's intervals by `start:end`, with their positions, built once per session object.
100
+ const RANGE_INDEX = new WeakMap()
101
+ function rangeIndex(session) {
102
+ let index = RANGE_INDEX.get(session)
103
+ if (index === undefined) {
104
+ index = new Map()
105
+ session.intervals.forEach((interval, position) => {
106
+ const key = `${interval.start_ms}:${interval.end_ms}`
107
+ index.set(key, [...(index.get(key) ?? []), { interval, position }])
108
+ })
109
+ RANGE_INDEX.set(session, index)
110
+ }
111
+ return index
112
+ }
113
+
114
+ /** The cause one evidence interval names, or `null` when it names none. */
115
+ function waitCauseOf(interval) {
116
+ if (interval.kind === "human_wait") return "next_prompt"
117
+ if (interval.kind === "api_retry") return "api_retry"
118
+ if (interval.kind !== "tool") return null
119
+ if (interval.outcome !== "ok") return "tool_failure"
120
+ return interval.end_ms - interval.start_ms >= LONG_TOOL_CALL_MS ? "long_tool_call" : null
121
+ }
122
+
123
+ /**
124
+ * `waitedOn(intervals) -> cause`: the cause whose evidence intervals add up to the most time; a tie goes to the cause listed first in
125
+ * `WAITED_ON`, and evidence that names no cause is `unknown`.
126
+ */
127
+ export function waitedOn(intervals) {
128
+ const time = new Map()
129
+ for (const interval of intervals) {
130
+ const cause = waitCauseOf(interval)
131
+ if (cause !== null) time.set(cause, (time.get(cause) ?? 0) + interval.end_ms - interval.start_ms)
132
+ }
133
+ return mostTime(WAITED_ON, time)
134
+ }
135
+
136
+ /** The first of `order` with the most time in `time` (a `Map`), or `unknown` when none has any. */
137
+ export function mostTime(order, time) {
138
+ let best = "unknown"
139
+ let most = 0
140
+ for (const cause of order) {
141
+ if (time.get(cause) > most) {
142
+ best = cause
143
+ most = time.get(cause)
144
+ }
145
+ }
146
+ return best
147
+ }
148
+
149
+ /** The failed tool kind a `defects` stretch rests on most (by time, then by name), or `all` when its evidence holds no failed tool call. */
150
+ function failingToolOf(intervals) {
151
+ const time = new Map()
152
+ for (const interval of intervals) {
153
+ if (interval.kind === "tool" && interval.outcome !== "ok") time.set(interval.tool, (time.get(interval.tool) ?? 0) + interval.end_ms - interval.start_ms)
154
+ }
155
+ const ranked = [...time.entries()].map(([tool, ms]) => ({ tool, rank: -ms })).sort((left, right) => compareFields(left, right, ["rank", "tool"]))
156
+ return ranked.length === 0 ? "all" : ranked[0].tool
157
+ }
158
+
159
+ /** A corrected muda stretch's cause key, `<waste>:<waited_on, failing tool kind or "all">`, from its resolved evidence. */
160
+ export function causeKey(stretch, intervals) {
161
+ if (stretch.waste === "waiting") return `waiting:${stretch.waited_on}`
162
+ if (stretch.waste === "defects") return `defects:${failingToolOf(intervals)}`
163
+ return `${stretch.waste}:all`
164
+ }
165
+
166
+ // The parts of [start, end) inside and outside the merged spans (each of which overlaps it), as [start, end] pairs in order.
167
+ function splitBySpans(start, end, spans) {
168
+ const inside = []
169
+ const outside = []
170
+ let from = start
171
+ for (const [spanStart, spanEnd] of spans) {
172
+ if (spanStart > from) outside.push([from, spanStart])
173
+ const to = Math.min(spanEnd, end)
174
+ inside.push([Math.max(spanStart, from), to])
175
+ from = to
176
+ }
177
+ if (from < end) outside.push([from, end])
178
+ return { inside, outside }
179
+ }
180
+
181
+ // What counts as a worker doing work in the split: its own turns and tool calls. A parent's `subagent` interval only stands for the
182
+ // subagent's work, which the subagent's own intervals carry.
183
+ const WORK_KINDS = new Set(["turn", "tool"])
184
+
185
+ // Whether worker `ancestor` is a parent, grandparent or further up of worker `worker` (`parentOf` maps a worker to its parent).
186
+ function ancestorOf(parentOf, ancestor, worker) {
187
+ const seen = new Set()
188
+ for (let at = parentOf.get(worker); at !== null && at !== undefined && !seen.has(at); at = parentOf.get(at)) {
189
+ if (at === ancestor) return true
190
+ seen.add(at)
191
+ }
192
+ return false
193
+ }
194
+
195
+ // Keeps the stretch's original label on a part, for counting stretches and flags once each (not enumerable, so it is never written out).
196
+ function piece(stretch, fields, source) {
197
+ const part = { ...stretch, ...fields }
198
+ Object.defineProperty(part, "source", { value: source, enumerable: false })
199
+ return part
200
+ }
201
+
202
+ /**
203
+ * `correctStretches(stretches, session, binding) -> stretches`: the job's stretches of one session (on the session clock, already cut to
204
+ * the job's share) with every `waiting` stretch given its `waited_on` and split where a worker of the job was working (see the header).
205
+ * Every other stretch is returned as it is. Each returned part keeps the label it came from as a non-enumerable `source`.
206
+ */
207
+ export function correctStretches(stretches, session, binding) {
208
+ const bound = boundIntervals(session, binding).filter((interval) => WORK_KINDS.has(interval.kind))
209
+ const parentOf = new Map(session.agents.map((agent) => [agent.n, agent.parent]))
210
+ return stretches.flatMap((stretch) => {
211
+ if (stretch.class !== "muda" || stretch.waste !== "waiting") return [piece(stretch, {}, stretch)]
212
+ const evidence = evidenceIntervals(session, stretch.evidence)
213
+ const cause = waitedOn(evidence)
214
+ // The workers the evidence shows waiting do not count as working against their own wait. The turn that holds a long or failing
215
+ // tool call spans the whole wait, so counting it would split away every `long_tool_call` and `tool_failure` stretch. Their
216
+ // ancestors' turns around a cause-naming interval are the same wait one level up (a parent's turn holds the subagent it waits
217
+ // on), so they do not count either. Only the other workers' own turns and tool calls, such as a sibling subagent running while
218
+ // one waits, make part of a wait agent work.
219
+ const causes = evidence.filter((interval) => waitCauseOf(interval) !== null)
220
+ const waiting = new Set(causes.map((interval) => interval.agent))
221
+ const enclosing = (interval) => causes.some((cause) => ancestorOf(parentOf, interval.agent, cause.agent) && interval.start_ms <= cause.start_ms && interval.end_ms >= cause.end_ms)
222
+ const work = union(bound.filter((interval) => !waiting.has(interval.agent) && !enclosing(interval) && interval.start_ms < stretch.end_ms && interval.end_ms > stretch.start_ms))
223
+ const { inside, outside } = splitBySpans(stretch.start_ms, stretch.end_ms, work)
224
+ return [
225
+ ...outside.map(([start, end]) => piece(stretch, { start_ms: start, end_ms: end, waited_on: cause }, stretch)),
226
+ ...inside.map(([start, end]) => piece(stretch, { start_ms: start, end_ms: end, class: UNLABELED_CLASS, waste: null, reason: AGENTS_WORKING }, stretch)),
227
+ ].sort((left, right) => left.start_ms - right.start_ms)
228
+ })
229
+ }
230
+
231
+ // The parts of `wait` (an interval of `session`) during which no other worker of the job did work: its own worker, and an ancestor's turn or
232
+ // tool call that holds it (a parent's turn around the subagent that asks), are the wait itself, and a `subagent` interval only stands for
233
+ // the subagent's own intervals, as in the honest correction.
234
+ function idleParts(wait, work, parentOf) {
235
+ const others = work.filter((interval) => interval.agent !== wait.agent
236
+ && !(ancestorOf(parentOf, interval.agent, wait.agent) && interval.start_ms <= wait.start_ms && interval.end_ms >= wait.end_ms)
237
+ && interval.start_ms < wait.end_ms && interval.end_ms > wait.start_ms)
238
+ return splitBySpans(wait.start_ms, wait.end_ms, union(others)).outside
239
+ }
240
+
241
+ /**
242
+ * `askIdle(timeline) -> Map<"host/session", spans>`: for each placed session of the job, the idle time inside its ask-tool waits (a
243
+ * `human_wait` whose `stop.end` is in `ASK_ENDS`) as merged `[start, end]` pairs on the job clock: the agent was waiting on the operator's
244
+ * answer, so that time is not working time, except where another worker of the job did work meanwhile. Only the job's own share of each
245
+ * wait counts (the binding's workers, worker 0 cut to its segments).
246
+ */
247
+ export function askIdle(timeline) {
248
+ const out = new Map()
249
+ timeline.source_sessions.forEach((session, index) => {
250
+ const offset = timeline.sessions[index].offset_ms
251
+ if (offset === null) return
252
+ const held = boundIntervals(session, bindingOf(session, timeline.job))
253
+ const asks = held.filter((interval) => interval.kind === "human_wait" && ASK_ENDS.includes(interval.stop?.end))
254
+ if (asks.length === 0) return
255
+ const work = held.filter((interval) => WORK_KINDS.has(interval.kind))
256
+ const parentOf = new Map(session.agents.map((agent) => [agent.n, agent.parent]))
257
+ const spans = asks.flatMap((wait) => idleParts(wait, work, parentOf)).map(([start, end]) => ({ start_ms: offset + start, end_ms: offset + end }))
258
+ out.set(`${session.session.host}/${session.session.id}`, union(spans))
259
+ })
260
+ return out
261
+ }
262
+
263
+ /**
264
+ * `jobWaits(timeline) -> waits`: every wait of the job on the operator on the job clock: each `human_wait` interval the job's binding
265
+ * holds, of any worker (the root's after-stop waits, and an ask-tool wait of whichever worker asked), cut to the binding's segments, so a
266
+ * wait the segments cut is one entry per part. Each is `{ host, session, worker, start_ms, end_ms, stop, range }`, where `stop` is the
267
+ * facts' record of how the turn ended (facts `/4`), or `null` when the facts carry none, and `range` is the whole interval's
268
+ * `[start_ms, end_ms]` on the session clock, which an evaluator's stop label names. In start order. A session without a job offset places
269
+ * none.
270
+ */
271
+ export function jobWaits(timeline) {
272
+ const waits = []
273
+ timeline.source_sessions.forEach((session, index) => {
274
+ const offset = timeline.sessions[index].offset_ms
275
+ if (offset === null) return
276
+ const binding = bindingOf(session, timeline.job)
277
+ for (const interval of session.intervals) {
278
+ if (interval.kind !== "human_wait") continue
279
+ const stop = Object.hasOwn(interval, "stop") ? { end: interval.stop.end, asks: interval.stop.asks, pending_agents: interval.stop.pending_agents } : null
280
+ for (const part of boundIntervals({ intervals: [interval] }, binding)) {
281
+ waits.push({ host: session.session.host, session: session.session.id, worker: interval.agent, start_ms: offset + part.start_ms, end_ms: offset + part.end_ms, stop, range: [interval.start_ms, interval.end_ms] })
282
+ }
283
+ }
284
+ })
285
+ return waits.sort(byStart)
286
+ }
287
+
288
+ // An interval as a detail file lists it, on the job clock.
289
+ function laneInterval(interval, offset) {
290
+ const entry = { kind: interval.kind, worker: interval.agent, start_ms: offset + interval.start_ms, end_ms: offset + interval.end_ms }
291
+ if (interval.kind === "tool") {
292
+ entry.tool = interval.tool
293
+ entry.outcome = interval.outcome
294
+ }
295
+ return entry
296
+ }
297
+
298
+ const intervalKey = (interval) => [interval.start_ms, interval.end_ms, interval.kind, interval.worker, interval.tool ?? "", interval.outcome ?? ""].join(":")
299
+
300
+ // Only tool intervals carry a tool and an outcome, and the kind is compared first, so those two are compared only between tool calls.
301
+ const LANE_ORDER = Object.freeze(["start_ms", "end_ms", "kind", "worker", "tool", "outcome"])
302
+
303
+ /**
304
+ * `jobStretches(timeline, labels) -> stretches`: every placed session's corrected stretches (`resolveLabels`' `corrected`) on the job
305
+ * clock, each with its `host` and `session`, in start order. Each also carries, not enumerable, its resolved `intervals` (on the
306
+ * session clock) for cause keys. A session without a job offset places nothing.
307
+ */
308
+ export function jobStretches(timeline, labels) {
309
+ const out = []
310
+ timeline.source_sessions.forEach((session, index) => {
311
+ const offset = timeline.sessions[index].offset_ms
312
+ const entry = labels.byJobSession.get(`${timeline.job}/${session.session.id}`)
313
+ if (offset === null || entry === undefined) return
314
+ for (const stretch of entry.corrected) {
315
+ const placed = { ...stretch, host: session.session.host, session: session.session.id, start_ms: offset + stretch.start_ms, end_ms: offset + stretch.end_ms }
316
+ Object.defineProperty(placed, "intervals", { value: evidenceIntervals(session, stretch.evidence), enumerable: false })
317
+ Object.defineProperty(placed, "source", { value: stretch.source, enumerable: false })
318
+ out.push(placed)
319
+ }
320
+ })
321
+ return out.sort(byStart)
322
+ }
323
+
324
+ /**
325
+ * `sessionDetail(timeline, index, labels) -> document | null`: the swimlane file of the job's `index`-th session,
326
+ * `jobs/<job>/<session id>.json`, or `null` when the session has no job offset (nothing can be placed). Every time is on the job clock.
327
+ * - `intervals`: the job's lane intervals of the session (its workers, the controller cut to the job's segments, as in the job's
328
+ * timeline), then every interval a stretch cites that is not among them, whole and marked `evidence_only: true`, all in time order.
329
+ * - `stretches`: the corrected stretches (`correctStretches`), each with `evidence` as indices into `intervals`, `waited_on` on waiting
330
+ * stretches and `reason: "agents_working"` on the parts split off them. `labeled` says whether the session has used labels at all.
331
+ * - `labels_from_shared_session`: whether these labels may count another job's time (`resolveLabels`' `sharedLabels`).
332
+ * - When the file would be larger than `budgetBytes`, its intervals are binned: each run of a worker's intervals of one kind whose gaps
333
+ * are under the bin is merged into one entry `{ kind, worker, start_ms, end_ms, binned: <count> }` (no tool or outcome), the bin
334
+ * starting at `FIRST_BIN_MS` and doubling until the file fits or every run is merged. An interval a stretch cites is never merged, so
335
+ * evidence still names it exactly. A binned file says `intervals_binned: true` and `bin_resolution_ms`; one still over budget once
336
+ * every run is merged also says `over_budget: true` with `reasons: ["over_budget_after_binning"]`.
337
+ */
338
+ export function sessionDetail(timeline, index, labels, budgetBytes = Infinity) {
339
+ const session = timeline.source_sessions[index]
340
+ const placedSession = timeline.sessions[index]
341
+ const offset = placedSession.offset_ms
342
+ if (offset === null) return null
343
+ const host = session.session.host
344
+ const id = session.session.id
345
+ const key = `${timeline.job}/${id}`
346
+ const entry = labels.byJobSession.get(key)
347
+ const lane = timeline.intervals.filter((interval) => interval.host === host && interval.session_id === id).map((interval) => {
348
+ const item = { kind: interval.kind, worker: interval.agent, start_ms: interval.start_ms, end_ms: interval.end_ms }
349
+ if (interval.kind === "tool") {
350
+ item.tool = interval.tool
351
+ item.outcome = interval.outcome
352
+ }
353
+ return item
354
+ })
355
+ const known = new Set(lane.map(intervalKey))
356
+ const cited = new Set()
357
+ const corrected = entry === undefined ? [] : entry.corrected
358
+ for (const stretch of corrected) {
359
+ for (const interval of evidenceIntervals(session, stretch.evidence)) {
360
+ const item = laneInterval(interval, offset)
361
+ const itemKey = intervalKey(item)
362
+ cited.add(itemKey)
363
+ if (known.has(itemKey)) continue
364
+ known.add(itemKey)
365
+ lane.push({ ...item, evidence_only: true })
366
+ }
367
+ }
368
+ // An evidence-only interval is never the same as a lane interval, so the order is total.
369
+ lane.sort((left, right) => compareFields(left, right, LANE_ORDER))
370
+ const document = (intervals) => {
371
+ // Two identical lane intervals are one for evidence: either index names the same interval.
372
+ const position = new Map(intervals.map((item, at) => [intervalKey(item), at]))
373
+ return {
374
+ job: timeline.job,
375
+ host,
376
+ session: id,
377
+ offset_ms: offset,
378
+ end_ms: placedSession.end_ms,
379
+ labeled: entry !== undefined,
380
+ labels_from_shared_session: labels.sharedLabels?.has(key) === true,
381
+ intervals,
382
+ stretches: detailStretches(corrected, { session, offset, entry, position }),
383
+ }
384
+ }
385
+ const whole = document(lane)
386
+ if (sizeOf(whole) <= budgetBytes) return whole
387
+ let resolution = FIRST_BIN_MS
388
+ let binned = binLane(lane, cited, resolution)
389
+ const span = placedSession.end_ms - offset
390
+ while (sizeOf(document(binned)) > budgetBytes && resolution <= span) {
391
+ resolution *= 2
392
+ binned = binLane(lane, cited, resolution)
393
+ }
394
+ const result = { ...document(binned), intervals_binned: true, bin_resolution_ms: resolution }
395
+ // Cited intervals are never merged, so a file can stay over budget with every run merged: it says so rather than pass silently.
396
+ return sizeOf(result) <= budgetBytes ? result : { ...result, over_budget: true, reasons: [OVER_BUDGET] }
397
+ }
398
+
399
+ // The bytes a document takes as a file.
400
+ const sizeOf = (value) => Buffer.byteLength(`${stableStringify(value)}\n`)
401
+
402
+ // The lane with each run of a worker's same-kind intervals whose gaps are under `resolution` merged into one `binned` entry; an interval
403
+ // in `cited` stays as it is and ends a run.
404
+ function binLane(lane, cited, resolution) {
405
+ const groups = new Map()
406
+ const out = []
407
+ for (const item of lane) {
408
+ if (cited.has(intervalKey(item))) {
409
+ out.push(item)
410
+ continue
411
+ }
412
+ const group = `${item.kind}/${item.worker}`
413
+ const run = groups.get(group)
414
+ if (run !== undefined && item.start_ms - run.end_ms < resolution) {
415
+ run.end_ms = Math.max(run.end_ms, item.end_ms)
416
+ run.items.push(item)
417
+ continue
418
+ }
419
+ const next = { start_ms: item.start_ms, end_ms: item.end_ms, items: [item] }
420
+ groups.set(group, next)
421
+ out.push(next)
422
+ }
423
+ return out
424
+ .map((entry) => {
425
+ if (!Object.hasOwn(entry, "items")) return entry
426
+ if (entry.items.length === 1) return entry.items[0]
427
+ return { kind: entry.items[0].kind, worker: entry.items[0].worker, start_ms: entry.start_ms, end_ms: entry.end_ms, binned: entry.items.length }
428
+ })
429
+ .sort((left, right) => compareFields(left, right, LANE_ORDER))
430
+ }
431
+
432
+ // The corrected stretches as a swimlane file lists them, evidence as indices into its intervals.
433
+ function detailStretches(corrected, { session, offset, entry, position }) {
434
+ return corrected.map((stretch) => {
435
+ const placed = {
436
+ start_ms: offset + stretch.start_ms,
437
+ end_ms: offset + stretch.end_ms,
438
+ class: stretch.class,
439
+ waste: stretch.waste,
440
+ confidence: stretch.confidence ?? null,
441
+ evaluator_version: stretch.evaluator_version ?? entry.evaluator.plugin_version,
442
+ mura: stretch.mura,
443
+ muri: stretch.muri,
444
+ evidence: evidenceIntervals(session, stretch.evidence).map((interval) => position.get(intervalKey(laneInterval(interval, offset)))),
445
+ }
446
+ if (Object.hasOwn(stretch, "waited_on")) placed.waited_on = stretch.waited_on
447
+ if (Object.hasOwn(stretch, "reason")) placed.reason = stretch.reason
448
+ if (Object.hasOwn(stretch, "caught")) placed.caught = stretch.caught
449
+ return placed
450
+ })
451
+ }
452
+
453
+ // Each pull request once. One a session created is the earliest creating call, timed first, and has no time when no creating call was
454
+ // timed: a mention's time never stands for its opening. Any other is the earliest timed mention when any session times it, else the
455
+ // first by host and session. `created` is `true` when any session created it, else `false` when any session's facts say so, else `null`
456
+ // (facts before `/4` do not say). Timed entries come first, earliest first; untimed ones after, by repository and number.
457
+ function firstOfEachPr(prs) {
458
+ const created = new Map()
459
+ for (const pr of prs) {
460
+ const prKey = `${pr.repo}#${pr.number}`
461
+ if (pr.created === true || (pr.created === false && created.get(prKey) !== true)) created.set(prKey, pr.created)
462
+ }
463
+ const seen = new Set()
464
+ const key = (pr) => ({ ...pr, untimed: Number(!Object.hasOwn(pr, "at_ms")), time: pr.at_ms ?? 0 })
465
+ const order = ["untimed", "time", "repo", "number", "host", "session"]
466
+ // A pull request a session created is placed only by a creating call: a mention's time is not its opening.
467
+ const creating = prs.filter((pr) => created.get(`${pr.repo}#${pr.number}`) !== true || pr.created === true)
468
+ const first = creating.sort((left, right) => compareFields(key(left), key(right), order)).filter((pr) => {
469
+ const prKey = `${pr.repo}#${pr.number}`
470
+ if (seen.has(prKey)) return false
471
+ seen.add(prKey)
472
+ return true
473
+ })
474
+ return first.map((pr) => ({ ...pr, created: created.get(`${pr.repo}#${pr.number}`) ?? null }))
475
+ }
476
+
477
+ const byStart = (left, right) => compareFields(left, right, ["start_ms", "end_ms", "host", "session"])
478
+
479
+ /**
480
+ * `timelineAdditions(timeline) -> { agents, human_turns, prs }`: what the job's timeline adds for the Lean walk, every time on the job
481
+ * clock. A session without a job offset places nothing; its workers and untimed pull requests are still listed.
482
+ * - `agents`: each session's workers the job holds, `{ host, session, n, parent }`. The worker's model and agent type stay in the
483
+ * session's published facts: the reports carry no token a facts file names (a model ID is one), only the facts do.
484
+ * - `human_turns`: the human turns whose time falls in the job's own segments (the attention formula's rule), with their basis, window
485
+ * and size classes.
486
+ * - `prs`: the job's pull requests (the formulas' ownership rule), each once, with the worker that opened it and `at_ms` only when the
487
+ * facts carry them (a public desk's facts withhold both), and `created`: whether a session of the job created it (`true`), only
488
+ * mentioned it (`false`), or `null` when its facts predate `/4`. A created one's `at_ms` is only ever a creating call's time.
489
+ */
490
+ export function timelineAdditions(timeline) {
491
+ const agents = []
492
+ const humanTurns = []
493
+ const prs = []
494
+ timeline.source_sessions.forEach((session, index) => {
495
+ const binding = bindingOf(session, timeline.job)
496
+ const host = session.session.host
497
+ const id = session.session.id
498
+ const offset = timeline.sessions[index].offset_ms
499
+ for (const agent of session.agents) {
500
+ if (Object.hasOwn(binding, "agents") && !binding.agents.includes(agent.n)) continue
501
+ agents.push({ host, session: id, n: agent.n, parent: agent.parent })
502
+ }
503
+ for (const pr of session.refs.prs) {
504
+ if (!jobOwnsPullRequest(session, binding, pr)) continue
505
+ const entry = { host, session: id, repo: pr.repo, number: pr.number }
506
+ if (Object.hasOwn(pr, "created")) entry.created = pr.created
507
+ if (Object.hasOwn(pr, "agent")) entry.worker = pr.agent
508
+ if (Object.hasOwn(pr, "at_ms") && offset !== null) entry.at_ms = offset + pr.at_ms
509
+ prs.push(entry)
510
+ }
511
+ if (offset === null) return
512
+ const segmented = session.jobs.filter((candidate) => Array.isArray(candidate.segments) && candidate.segments.length > 0)
513
+ if (Array.isArray(session.human_turns) && segmented.length > 0) {
514
+ for (const turn of session.human_turns) {
515
+ if (ownerOf(segmented, turn.at_ms) !== timeline.job) continue
516
+ humanTurns.push({ host, session: id, at_ms: offset + turn.at_ms, basis: turn.basis, window_ms: turn.window_ms, prompt_class: turn.prompt_class, output_class: turn.output_class })
517
+ }
518
+ }
519
+ })
520
+ agents.sort((left, right) => compareFields(left, right, ["host", "session", "n"]))
521
+ humanTurns.sort((left, right) => compareFields(left, right, ["at_ms", "host", "session"]))
522
+ return { agents, human_turns: humanTurns, prs: firstOfEachPr(prs) }
523
+ }