@humwick/server 0.130.1 → 0.130.2

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 (437) hide show
  1. package/README.md +5 -0
  2. package/docs/guides/tools-administration.md +4 -0
  3. package/docs/guides/tools-coordination.md +1 -0
  4. package/docs/guides/tools-tasks.md +8 -0
  5. package/docs/guides/workflows.md +58 -0
  6. package/docs/openapi.json +414 -1
  7. package/package.json +8 -17
  8. package/public/assets/{MessageBubble-BWpoBjl4.js → MessageBubble-BWLqMGKG.js} +2 -2
  9. package/public/assets/{PlanGraphPanel-C0auck3n.js → PlanGraphPanel-3TlIQpjk.js} +2 -2
  10. package/public/assets/{TraceView-DBnOx7AQ.js → TraceView-Wimm0Czv.js} +2 -2
  11. package/public/assets/{VaultDecisionCard-0kp2oNBC.js → VaultDecisionCard-Bau_vNax.js} +2 -2
  12. package/public/assets/{activity-yLztXEBt.js → activity-CrSurn-r.js} +2 -2
  13. package/public/assets/{agent-lineage-BbJDR1dW.js → agent-lineage-CknAJKcb.js} +2 -2
  14. package/public/assets/agent-liveness-CaNwK0Zf.js +2 -0
  15. package/public/assets/{agent-name-CTZBrSD9.js → agent-name-DKbiIhBo.js} +2 -2
  16. package/public/assets/agent-profiles-DwF6EQ4R.js +2 -0
  17. package/public/assets/{agent-project-badge-9TqzUUYE.js → agent-project-badge-Diz4Sjjb.js} +2 -2
  18. package/public/assets/{agent-tools-D4n40pn8.js → agent-tools-CRhpRQza.js} +2 -2
  19. package/public/assets/{agent-type-icon-D6FUarOf.js → agent-type-icon-LrUEU3lB.js} +2 -2
  20. package/public/assets/{agents-BYDslkJc.js → agents-B-v66C-4.js} +2 -2
  21. package/public/assets/{analytics-B-XSbEMC.js → analytics-BqCb-LKi.js} +2 -2
  22. package/public/assets/{artifact-viewer-DdWIfV6M.js → artifact-viewer-kf4pGuAR.js} +2 -2
  23. package/public/assets/{artifacts-oBOqks-2.js → artifacts-D32zyw4Y.js} +2 -2
  24. package/public/assets/{artifacts-DPN1q4pA.js → artifacts-DJevXcvg.js} +2 -2
  25. package/public/assets/{automation-4KcRFXEu.js → automation-BpRajx_5.js} +2 -2
  26. package/public/assets/{backlog-Cw9xPTCF.js → backlog-D_UjTdzX.js} +2 -2
  27. package/public/assets/{busy-health-CTu32MZt.js → busy-health-N3VEh4ao.js} +2 -2
  28. package/public/assets/{channels-BiXzg1G9.js → channels-9jopungq.js} +2 -2
  29. package/public/assets/{chat-Ctk2qwvA.js → chat-CSXrTB3C.js} +2 -2
  30. package/public/assets/{code-preview-Bm1wWqAp.js → code-preview-p1NnmqK0.js} +2 -2
  31. package/public/assets/{connectors-C36ax4Vw.js → connectors-CZdqlDNL.js} +2 -2
  32. package/public/assets/{cosmos-Jj9LK2Wf.js → cosmos-BgdsE4dG.js} +2 -2
  33. package/public/assets/{crate-agent-H6S7-B9T.js → crate-agent-30aXTKva.js} +2 -2
  34. package/public/assets/{dependency-graph-Cd1E23wa.js → dependency-graph-B_jvw2GE.js} +2 -2
  35. package/public/assets/{deploys-Bwfq146q.js → deploys-DoN6bAb5.js} +2 -2
  36. package/public/assets/{display-CfO7rTuF.js → display-BrKWFGJz.js} +2 -2
  37. package/public/assets/{files-DhhZI2Ih.js → files-D6XEu8Ng.js} +2 -2
  38. package/public/assets/{fleet-B_rFEbnL.js → fleet-C7jQWbw2.js} +2 -2
  39. package/public/assets/{fleet-metrics-BkHP-P3R.js → fleet-metrics-BiDs3MLx.js} +2 -2
  40. package/public/assets/{formatted-body-Cm1RrzmN.js → formatted-body-CQBwc1fb.js} +3 -3
  41. package/public/assets/{formatted-body-impl-DQiOuOD1.js → formatted-body-impl-DyG0WsQS.js} +2 -2
  42. package/public/assets/{host-providers-dialog-CHqwXTov.js → host-providers-dialog-DKaW31dN.js} +2 -2
  43. package/public/assets/index-CRHep3M9.js +15 -0
  44. package/public/assets/index-MYAIwYTX.css +2 -0
  45. package/public/assets/{insights-fH1EL-qZ.js → insights-CzrtkpOE.js} +2 -2
  46. package/public/assets/{integrations-C5Oix6ng.js → integrations-aVsUmigt.js} +2 -2
  47. package/public/assets/{issue-ref-chip-ODyondIa.js → issue-ref-chip-BnSlM_95.js} +2 -2
  48. package/public/assets/{log-viewer-Cvfy6PW7.js → log-viewer-qe7Ee47Z.js} +2 -2
  49. package/public/assets/{maintenance-D8CDH5wZ.js → maintenance-NfjqFZAk.js} +2 -2
  50. package/public/assets/{managed-agents-egllbpij.js → managed-agents-BiH0HgaE.js} +2 -2
  51. package/public/assets/{markdown-preview-CYSFgVgK.js → markdown-preview-BixaT3Xr.js} +3 -3
  52. package/public/assets/{markdown-preview-impl-BteVIjX4.js → markdown-preview-impl-DNGlWIS3.js} +2 -2
  53. package/public/assets/{memory-C8WmXsyr.js → memory-DNsCl6UX.js} +2 -2
  54. package/public/assets/{messages-BzQdqlO6.js → messages-DopU1L1X.js} +2 -2
  55. package/public/assets/{orchestrators-B1HxzkNw.js → orchestrators-Cq7ckLQT.js} +2 -2
  56. package/public/assets/{overview-DCUnI4Z7.js → overview-C1DCTzzV.js} +2 -2
  57. package/public/assets/{pairs-ftCd2XcD.js → pairs-DE_m6rrE.js} +2 -2
  58. package/public/assets/{profile-icon-B2zH8DMH.js → profile-icon-B3rfh77F.js} +2 -2
  59. package/public/assets/project-profile-instructions-DQWZE0kA.js +2 -0
  60. package/public/assets/projects-Br2Bd2h1.js +2 -0
  61. package/public/assets/{prompt-settings-Bftq9czX.js → prompt-settings-BKvFsvGD.js} +2 -2
  62. package/public/assets/provider-display-DsuWMvVL.js +2 -0
  63. package/public/assets/{registry-DWCU5c8q.js → registry-Cw38_6gW.js} +2 -2
  64. package/public/assets/run-card-CpKqRbhg.js +2 -0
  65. package/public/assets/scroll-text-BKXS1ahr.js +2 -0
  66. package/public/assets/{secrets-C7GIUATz.js → secrets-DxI-vzSq.js} +2 -2
  67. package/public/assets/{service-access-settings-C3aujqTG.js → service-access-settings-D9s_VJbd.js} +2 -2
  68. package/public/assets/{settings-C6sZ9eBa.js → settings-CKZTVGIx.js} +2 -2
  69. package/public/assets/{shipping-Bu8p1gEw.js → shipping-B9YtnwtG.js} +2 -2
  70. package/public/assets/{stats-V9Z-GxUd.js → stats-DyUBKyWI.js} +2 -2
  71. package/public/assets/{status-dot-CVv0iGHL.js → status-dot-DYqlEUhJ.js} +2 -2
  72. package/public/assets/{store-BvtFdlGX.js → store-DcClXLH0.js} +3 -3
  73. package/public/assets/{tasks-CXU75HRF.js → tasks-Bh7Chr4-.js} +2 -2
  74. package/public/assets/{teams-BPf976zb.js → teams-bowI7qVY.js} +2 -2
  75. package/public/assets/{terminal-viewer-DE9BOe-8.js → terminal-viewer-BgVLHdsU.js} +3 -3
  76. package/public/assets/{terminal-viewer-impl-D04pjmGh.js → terminal-viewer-impl-Dz22UPy6.js} +2 -2
  77. package/public/assets/token-estimate-Co-Jdphh.js +2 -0
  78. package/public/assets/{use-agent-terminal-B1yR456R.js → use-agent-terminal-DSQQ-iY7.js} +2 -2
  79. package/public/assets/{use-decisions-D-S4tpDf.js → use-decisions-samMQhQf.js} +2 -2
  80. package/public/assets/use-project-list-59LheVP7.js +2 -0
  81. package/public/assets/{use-selectors-CnrAk2YP.js → use-selectors-BZa25xEB.js} +2 -2
  82. package/public/assets/{user-avatar-nBFIcR4M.js → user-avatar-DHxlvUvV.js} +2 -2
  83. package/public/assets/versioned-prompt-editor-BmED5DnJ.js +8 -0
  84. package/public/assets/{work-queue-TCjJxeT-.js → work-queue-CSvpuNLz.js} +2 -2
  85. package/public/assets/{workflow-marker-Cf3Hf2fN.js → workflow-marker-DAZcj5qt.js} +2 -2
  86. package/public/assets/{workflows-CXQX20Qj.js → workflows-DdmxRSyg.js} +2 -2
  87. package/public/assets/{workspaces-qSYzKYMA.js → workspaces-BxeKfVuF.js} +2 -2
  88. package/public/cosmos.html +4 -4
  89. package/public/index.html +31 -29
  90. package/runner/plugins/claude/.claude-plugin/plugin.json +1 -1
  91. package/runner/plugins/claude/hooks/gate-run-guard.provisioned.mjs +31 -1
  92. package/runner/src/adapters/claude-effort.ts +2 -4
  93. package/runner/src/adapters/codex-launch-config.ts +4 -5
  94. package/runner/src/adapters/codex.ts +1 -1
  95. package/runner/src/adapters/opencode-provider.ts +7 -22
  96. package/runner/src/adapters/opencode.ts +4 -4
  97. package/runner/src/agent-runner/credentials.ts +42 -12
  98. package/runner/src/agent-runner/inbox.ts +27 -0
  99. package/runner/src/agent-runner/lifecycle-milestones.ts +0 -2
  100. package/runner/src/bin/claude.ts +4 -0
  101. package/runner/src/bin/codex.ts +4 -0
  102. package/runner/src/bin/opencode.ts +4 -0
  103. package/runner/src/index.ts +5 -2
  104. package/runner/src/provider-setup.ts +34 -0
  105. package/runner/src/providers.ts +2 -1
  106. package/runner/src/runner-core.ts +18 -23
  107. package/runner/src/spawn-input.ts +2 -1
  108. package/runner/src/test-run-dedup.ts +59 -56
  109. package/scripts/cd-config.ts +8 -0
  110. package/scripts/gate-run-lease.ts +10 -7
  111. package/scripts/gate.sh +5 -1
  112. package/src/branch-land-notice.ts +93 -0
  113. package/src/branch-landed.ts +7 -76
  114. package/src/bus.ts +19 -20
  115. package/src/cd-deploy-notify.ts +30 -2
  116. package/src/cd-host-lag-notify.ts +7 -6
  117. package/src/ci/incidents.ts +2 -2
  118. package/src/ci/monitor.ts +5 -8
  119. package/src/ci/root-missing.ts +2 -7
  120. package/src/ci/transition-notify.ts +7 -39
  121. package/src/cli/cd-pauses.ts +19 -0
  122. package/src/cli/orchestrator.ts +1 -1
  123. package/src/cli/state.ts +2 -19
  124. package/src/cli/task-edit.ts +22 -0
  125. package/src/cli/task.ts +3 -1
  126. package/src/cli/workflow.ts +8 -2
  127. package/src/commands-db.ts +3 -3
  128. package/src/config-store-write.ts +13 -1
  129. package/src/config-store.ts +25 -14
  130. package/src/db/activity-async.ts +6 -1
  131. package/src/db/activity-write-ops.ts +12 -1
  132. package/src/db/activity.ts +1 -14
  133. package/src/db/agent-search.ts +1 -15
  134. package/src/db/agents-async.ts +52 -5
  135. package/src/db/agents-write-ops.ts +12 -3
  136. package/src/db/agents.ts +81 -54
  137. package/src/db/ci-incidents-async.ts +5 -5
  138. package/src/db/ci-incidents-write-ops.ts +2 -2
  139. package/src/db/command-row.ts +10 -2
  140. package/src/db/commands-list-query.ts +2 -0
  141. package/src/db/commands-spawn-read.ts +1 -1
  142. package/src/db/config-store-write-ops.ts +7 -2
  143. package/src/db/continuation-archives-async.ts +5 -0
  144. package/src/db/continuation-archives-write-ops.ts +7 -0
  145. package/src/db/continuations.ts +2 -2
  146. package/src/db/db-writer-worker.ts +8 -1
  147. package/src/db/deploy-events-async.ts +1 -0
  148. package/src/db/deploy-events-read-ops.ts +2 -1
  149. package/src/db/deploy-events.ts +35 -4
  150. package/src/db/hosts-registration.ts +10 -2
  151. package/src/db/hosts.ts +9 -6
  152. package/src/db/inbox.ts +0 -14
  153. package/src/db/index.ts +2 -0
  154. package/src/db/integrations-async.ts +8 -0
  155. package/src/db/integrations-ops.ts +15 -0
  156. package/src/db/integrations.ts +15 -21
  157. package/src/db/issue-lifecycle.ts +3 -4
  158. package/src/db/issue-refs-async.ts +20 -0
  159. package/src/db/issue-refs-write-ops.ts +29 -0
  160. package/src/db/issue-refs.ts +7 -8
  161. package/src/db/long-running-work.ts +2 -2
  162. package/src/db/main-connection-writes.ts +23 -2
  163. package/src/db/maintenance-job-reconcile.ts +61 -0
  164. package/src/db/maintenance-job-runs-async.ts +14 -0
  165. package/src/db/maintenance-job-write-ops.ts +9 -0
  166. package/src/db/mappers.ts +2 -14
  167. package/src/db/merge-lease.ts +1 -15
  168. package/src/db/migrations.ts +7 -15
  169. package/src/db/orchestrators.ts +4 -72
  170. package/src/db/pairs.ts +1 -13
  171. package/src/db/project-profile-instructions.ts +50 -0
  172. package/src/db/prompt-versions.ts +9 -2
  173. package/src/db/provider-config-history.ts +8 -3
  174. package/src/db/provider-model-seed.ts +34 -0
  175. package/src/db/read-op-marshaling-fixtures.ts +5 -0
  176. package/src/db/read-ops.ts +4 -0
  177. package/src/db/routing-policy.ts +2 -3
  178. package/src/db/schema.ts +9 -3
  179. package/src/db/spawn-delegation-state.ts +11 -4
  180. package/src/db/stats-async.ts +4 -3
  181. package/src/db/task-entity.ts +23 -2
  182. package/src/db/task-list.ts +3 -1
  183. package/src/db/tasks.ts +1 -17
  184. package/src/db/timer-ingress.ts +7 -1
  185. package/src/db/token-db-write-ops.ts +17 -0
  186. package/src/db/token-standing.ts +15 -11
  187. package/src/db/workflow-contact.ts +1 -1
  188. package/src/db/workflow-task-read-ops.ts +30 -0
  189. package/src/db/write-ops.ts +6 -0
  190. package/src/db/writer-gateway.ts +17 -11
  191. package/src/dispatch-availability.ts +10 -6
  192. package/src/ephemeral/{landing-ingress-proof-worker.ts → landing-ingress-proof.test-fixture.ts} +4 -2
  193. package/src/host/disk-alert.ts +121 -0
  194. package/src/lifecycle-manager.ts +3 -2
  195. package/src/maintenance/cd-watcher.ts +3 -3
  196. package/src/maintenance/critical-job-watchdog.ts +16 -17
  197. package/src/maintenance/index.ts +1 -0
  198. package/src/maintenance/jobs.ts +3 -2
  199. package/src/maintenance/scheduler.ts +84 -128
  200. package/src/maintenance/stalled-delivery-pager.ts +6 -5
  201. package/src/maintenance/workspaces.ts +1 -1
  202. package/src/managed-policy.ts +31 -27
  203. package/src/mcp/index.ts +5 -2
  204. package/src/mcp/output-descriptions.ts +8 -8
  205. package/src/mcp/presentation.ts +4 -4
  206. package/src/mcp/project-profile-instructions.ts +32 -0
  207. package/src/mcp/tool-groups.ts +1 -1
  208. package/src/mcp/tools-spawn.ts +4 -3
  209. package/src/mcp-agent-action.ts +1 -2
  210. package/src/mcp-issue-ref-tools.ts +12 -11
  211. package/src/mcp-maintenance-tools.ts +2 -2
  212. package/src/mcp-profile-trust-tools.ts +4 -4
  213. package/src/mcp-provider-catalog.ts +2 -2
  214. package/src/mcp-task-tools.ts +11 -5
  215. package/src/mcp-team-template-tools.ts +3 -3
  216. package/src/mcp-workflow-tools.ts +10 -3
  217. package/src/notification-types.ts +2 -1
  218. package/src/operator-alarm.ts +26 -11
  219. package/src/project-instructions.ts +4 -0
  220. package/src/project-profile-instruction-text.ts +6 -0
  221. package/src/project-profile-instructions.ts +20 -0
  222. package/src/provider-catalog-store.ts +3 -49
  223. package/src/provider-config-store.ts +12 -11
  224. package/src/provider-model-seed.ts +1 -18
  225. package/src/provider-quota-config-store.ts +5 -4
  226. package/src/provider-secrets.test-fixture.ts +3 -3
  227. package/src/recipe-runner.ts +2 -2
  228. package/src/repo-config-source.ts +10 -4
  229. package/src/routes/agent-profiles.ts +6 -6
  230. package/src/routes/agents-spawn.ts +1 -1
  231. package/src/routes/agents.ts +6 -6
  232. package/src/routes/commands-listing.ts +4 -0
  233. package/src/routes/commands.ts +2 -2
  234. package/src/routes/continuation-archives.ts +2 -2
  235. package/src/routes/index.ts +10 -1
  236. package/src/routes/integrations.ts +24 -50
  237. package/src/routes/issue-refs.ts +7 -7
  238. package/src/routes/orchestrator-bootstrap.ts +1 -1
  239. package/src/routes/orchestrator-host-registration.ts +2 -2
  240. package/src/routes/orchestrator-host-utilization.ts +3 -1
  241. package/src/routes/orchestrator-proxy.ts +2 -2
  242. package/src/routes/orchestrator.ts +2 -2
  243. package/src/routes/project-profile-instructions.ts +27 -0
  244. package/src/routes/project-trust.ts +2 -2
  245. package/src/routes/provider-config.ts +6 -6
  246. package/src/routes/provider-quota-config.ts +2 -2
  247. package/src/routes/settings.ts +5 -5
  248. package/src/routes/stats.ts +6 -6
  249. package/src/routes/task-http.ts +15 -1
  250. package/src/routes/task-issues.ts +11 -26
  251. package/src/routes/tasks.ts +22 -53
  252. package/src/routes/team-templates.ts +5 -5
  253. package/src/routes/teams-config.ts +2 -2
  254. package/src/routes/tokens.ts +12 -5
  255. package/src/routes/workflows.ts +20 -5
  256. package/src/routing-policy-normalize.ts +1 -2
  257. package/src/routing-step-defaults.ts +0 -2
  258. package/src/runner-token-mint-limit.ts +63 -0
  259. package/src/runtime-grant.ts +4 -2
  260. package/src/runtime-tokens.ts +39 -7
  261. package/src/security.ts +13 -20
  262. package/src/server-background.ts +1 -1
  263. package/src/server.ts +5 -2
  264. package/src/services/host-utilization.ts +23 -0
  265. package/src/services/idle-epics.ts +5 -6
  266. package/src/services/issue-lifecycle.ts +57 -61
  267. package/src/services/issue-refs.ts +9 -13
  268. package/src/services/kernel-timers-cutover-chaos-worker.ts +10 -7
  269. package/src/services/kernel-timers-ingress.ts +1 -1
  270. package/src/services/landed-ancestry.ts +19 -3
  271. package/src/services/memory-areas.ts +15 -51
  272. package/src/services/plan-ci-notice.ts +57 -0
  273. package/src/services/plan-ci-recovery.ts +2 -55
  274. package/src/services/plan-wake-digest.ts +1 -0
  275. package/src/services/profile-trust.ts +4 -3
  276. package/src/services/project-config-read.ts +70 -0
  277. package/src/services/project-profile-instructions.ts +54 -0
  278. package/src/services/provisioning-harness/budget-baseline.json +4 -4
  279. package/src/services/restart-spawn.ts +61 -49
  280. package/src/services/self-care-state.ts +2 -1
  281. package/src/services/self-effort.ts +5 -5
  282. package/src/services/send-message.ts +5 -1
  283. package/src/services/spawn-agent.ts +13 -2
  284. package/src/services/spawn-chain-inspector.ts +6 -13
  285. package/src/services/spawn-policy.ts +68 -0
  286. package/src/services/spawn-tree-cleanup.ts +2 -2
  287. package/src/services/task-dispatch.ts +3 -0
  288. package/src/services/task-state-reconcile.ts +6 -14
  289. package/src/services/team-templates.ts +9 -8
  290. package/src/services/transient-agent-reaper.ts +3 -1
  291. package/src/services/workflow-auto-start.ts +25 -13
  292. package/src/services/workflow-ci-main.ts +1 -1
  293. package/src/services/workflow-deferred-cleanup.ts +4 -2
  294. package/src/services/workflow-effect-driver.ts +2 -0
  295. package/src/services/workflow-effects.ts +18 -11
  296. package/src/services/workflow-land-notice.ts +10 -0
  297. package/src/services/workflow-pause-text.ts +43 -0
  298. package/src/services/workflow-reconcile.ts +13 -11
  299. package/src/services/workflow-run-view.ts +2 -0
  300. package/src/services/workflow-runs.ts +29 -13
  301. package/src/services/workflow-supervisor-state.ts +5 -0
  302. package/src/services/workflow-supervisor.ts +7 -3
  303. package/src/settings/registry.ts +1 -2
  304. package/src/spawn-command.ts +4 -4
  305. package/src/spawn-models.ts +10 -12
  306. package/src/spawn-placement.ts +1 -1
  307. package/src/spawn-targets.ts +1 -1
  308. package/src/startup-context-injection.ts +1 -0
  309. package/src/state-adoption/cd-cutover.ts +53 -7
  310. package/src/state-adoption/fleet-cutover.ts +35 -0
  311. package/src/state-adoption/fleet-plan.ts +36 -0
  312. package/src/state-adoption/index.ts +2 -2
  313. package/src/state-adoption/linux-plan.ts +2 -2
  314. package/src/state-adoption/linux.ts +2 -2
  315. package/src/state-adoption/macos-plan.ts +2 -2
  316. package/src/state-adoption/macos.ts +1 -1
  317. package/src/steward.ts +7 -6
  318. package/src/task-dispatch-live.ts +1 -1
  319. package/src/task-dispatcher.ts +1 -1
  320. package/src/teams-config-store.ts +4 -3
  321. package/src/token-db-write.ts +10 -0
  322. package/src/workspace-command-settle.ts +2 -1
  323. package/src/workspace-steward-wake.ts +2 -2
  324. package/node_modules/@humwick/kernel/LICENSE +0 -167
  325. package/node_modules/@humwick/kernel/async-entity-persistence.ts +0 -344
  326. package/node_modules/@humwick/kernel/async-event-log.ts +0 -107
  327. package/node_modules/@humwick/kernel/automations.pilot.ts +0 -147
  328. package/node_modules/@humwick/kernel/config.ts +0 -111
  329. package/node_modules/@humwick/kernel/contract.ts +0 -572
  330. package/node_modules/@humwick/kernel/control-authz.ts +0 -281
  331. package/node_modules/@humwick/kernel/control.ts +0 -645
  332. package/node_modules/@humwick/kernel/effects.ts +0 -493
  333. package/node_modules/@humwick/kernel/event-log.ts +0 -319
  334. package/node_modules/@humwick/kernel/http-transport.ts +0 -384
  335. package/node_modules/@humwick/kernel/identity-grammar.ts +0 -20
  336. package/node_modules/@humwick/kernel/identity.ts +0 -248
  337. package/node_modules/@humwick/kernel/index.ts +0 -28
  338. package/node_modules/@humwick/kernel/kernel-persistence.ts +0 -181
  339. package/node_modules/@humwick/kernel/landing-incident.ts +0 -306
  340. package/node_modules/@humwick/kernel/landing.ts +0 -953
  341. package/node_modules/@humwick/kernel/manifest-validation.ts +0 -460
  342. package/node_modules/@humwick/kernel/mcp-transport.ts +0 -109
  343. package/node_modules/@humwick/kernel/message-authority-chaos-worker.ts +0 -200
  344. package/node_modules/@humwick/kernel/message-authority.ts +0 -281
  345. package/node_modules/@humwick/kernel/module-host.ts +0 -722
  346. package/node_modules/@humwick/kernel/openapi-init.ts +0 -14
  347. package/node_modules/@humwick/kernel/package.json +0 -39
  348. package/node_modules/@humwick/kernel/persistence-schema.ts +0 -248
  349. package/node_modules/@humwick/kernel/persistence.ts +0 -510
  350. package/node_modules/@humwick/kernel/registry.ts +0 -60
  351. package/node_modules/@humwick/kernel/sqlite-kernel-persistence.ts +0 -499
  352. package/node_modules/@humwick/kernel/sqlite-module-host.ts +0 -87
  353. package/node_modules/@humwick/kernel/timers-chaos-worker.ts +0 -186
  354. package/node_modules/@humwick/kernel/timers.pilot.ts +0 -1411
  355. package/node_modules/@humwick/kernel/workflow-activation.ts +0 -25
  356. package/node_modules/@humwick/kernel/workflow-backstop.ts +0 -40
  357. package/node_modules/@humwick/kernel/workflow-cancel-tree.ts +0 -20
  358. package/node_modules/@humwick/kernel/workflow-chaos-worker.ts +0 -213
  359. package/node_modules/@humwick/kernel/workflow-composition.ts +0 -231
  360. package/node_modules/@humwick/kernel/workflow-container.ts +0 -72
  361. package/node_modules/@humwick/kernel/workflow-control.test-fixture.ts +0 -42
  362. package/node_modules/@humwick/kernel/workflow-control.ts +0 -178
  363. package/node_modules/@humwick/kernel/workflow-definition.ts +0 -507
  364. package/node_modules/@humwick/kernel/workflow-dispatch.ts +0 -60
  365. package/node_modules/@humwick/kernel/workflow-foreach.ts +0 -167
  366. package/node_modules/@humwick/kernel/workflow-journal-codec.ts +0 -339
  367. package/node_modules/@humwick/kernel/workflow-journal.ts +0 -922
  368. package/node_modules/@humwick/kernel/workflow-lane.ts +0 -48
  369. package/node_modules/@humwick/kernel/workflow-lease-owner.ts +0 -60
  370. package/node_modules/@humwick/kernel/workflow-recovery.test-fixture.ts +0 -19
  371. package/node_modules/@humwick/kernel/workflow-runtime.ts +0 -938
  372. package/node_modules/@humwick/kernel/workflow-script.ts +0 -11
  373. package/node_modules/@humwick/kernel/workflow-state.ts +0 -299
  374. package/node_modules/@humwick/kernel/workflow-step-commit.ts +0 -195
  375. package/node_modules/@humwick/kernel/workflow-transitions.ts +0 -317
  376. package/node_modules/@humwick/kernel/workflow-values.ts +0 -153
  377. package/node_modules/@humwick/kernel/workflow.pilot.ts +0 -376
  378. package/node_modules/@humwick/offload/LICENSE +0 -167
  379. package/node_modules/@humwick/offload/README.md +0 -57
  380. package/node_modules/@humwick/offload/dist/async-runner.d.ts +0 -18
  381. package/node_modules/@humwick/offload/dist/async-runner.d.ts.map +0 -1
  382. package/node_modules/@humwick/offload/dist/async-runner.js +0 -158
  383. package/node_modules/@humwick/offload/dist/async-runner.js.map +0 -1
  384. package/node_modules/@humwick/offload/dist/envelope.d.ts +0 -25
  385. package/node_modules/@humwick/offload/dist/envelope.d.ts.map +0 -1
  386. package/node_modules/@humwick/offload/dist/envelope.js +0 -80
  387. package/node_modules/@humwick/offload/dist/envelope.js.map +0 -1
  388. package/node_modules/@humwick/offload/dist/fixtures/worker-task.d.ts +0 -10
  389. package/node_modules/@humwick/offload/dist/fixtures/worker-task.d.ts.map +0 -1
  390. package/node_modules/@humwick/offload/dist/fixtures/worker-task.js +0 -59
  391. package/node_modules/@humwick/offload/dist/fixtures/worker-task.js.map +0 -1
  392. package/node_modules/@humwick/offload/dist/index.d.ts +0 -5
  393. package/node_modules/@humwick/offload/dist/index.d.ts.map +0 -1
  394. package/node_modules/@humwick/offload/dist/index.js +0 -5
  395. package/node_modules/@humwick/offload/dist/index.js.map +0 -1
  396. package/node_modules/@humwick/offload/dist/subprocess-runner.d.ts +0 -62
  397. package/node_modules/@humwick/offload/dist/subprocess-runner.d.ts.map +0 -1
  398. package/node_modules/@humwick/offload/dist/subprocess-runner.js +0 -295
  399. package/node_modules/@humwick/offload/dist/subprocess-runner.js.map +0 -1
  400. package/node_modules/@humwick/offload/dist/types.d.ts +0 -111
  401. package/node_modules/@humwick/offload/dist/types.d.ts.map +0 -1
  402. package/node_modules/@humwick/offload/dist/types.js +0 -176
  403. package/node_modules/@humwick/offload/dist/types.js.map +0 -1
  404. package/node_modules/@humwick/offload/dist/worker-pool.d.ts +0 -23
  405. package/node_modules/@humwick/offload/dist/worker-pool.d.ts.map +0 -1
  406. package/node_modules/@humwick/offload/dist/worker-pool.js +0 -435
  407. package/node_modules/@humwick/offload/dist/worker-pool.js.map +0 -1
  408. package/node_modules/@humwick/offload/dist/worker-runtime.d.ts +0 -2
  409. package/node_modules/@humwick/offload/dist/worker-runtime.d.ts.map +0 -1
  410. package/node_modules/@humwick/offload/dist/worker-runtime.js +0 -27
  411. package/node_modules/@humwick/offload/dist/worker-runtime.js.map +0 -1
  412. package/node_modules/@humwick/offload/dist/worker.d.ts +0 -5
  413. package/node_modules/@humwick/offload/dist/worker.d.ts.map +0 -1
  414. package/node_modules/@humwick/offload/dist/worker.js +0 -1
  415. package/node_modules/@humwick/offload/dist/worker.js.map +0 -1
  416. package/node_modules/@humwick/offload/package.json +0 -42
  417. package/node_modules/@humwick/offload/src/async-runner.ts +0 -170
  418. package/node_modules/@humwick/offload/src/envelope.ts +0 -92
  419. package/node_modules/@humwick/offload/src/fixtures/worker-task.ts +0 -49
  420. package/node_modules/@humwick/offload/src/index.ts +0 -4
  421. package/node_modules/@humwick/offload/src/subprocess-runner.ts +0 -334
  422. package/node_modules/@humwick/offload/src/types.ts +0 -235
  423. package/node_modules/@humwick/offload/src/worker-pool.ts +0 -463
  424. package/node_modules/@humwick/offload/src/worker-runtime.ts +0 -32
  425. package/node_modules/@humwick/offload/src/worker.ts +0 -5
  426. package/public/assets/agent-liveness-DyqxfB-t.js +0 -2
  427. package/public/assets/agent-profiles-BpI_jTxq.js +0 -2
  428. package/public/assets/index-B7ZerHLY.css +0 -2
  429. package/public/assets/index-BU3uWo2t.js +0 -15
  430. package/public/assets/projects-B_lmcqfO.js +0 -2
  431. package/public/assets/provider-display-DbLWpP3j.js +0 -2
  432. package/public/assets/run-card-CO_bguQf.js +0 -2
  433. package/public/assets/use-project-list-B-T2Bnnn.js +0 -2
  434. package/public/assets/versioned-prompt-editor-Diu8BIaM.js +0 -8
  435. package/runner/src/gate-run-lease-probe.ts +0 -38
  436. package/src/db/claude-catalog-reconcile.ts +0 -27
  437. package/src/routing-model-aliases.ts +0 -21
@@ -1,376 +0,0 @@
1
- import { workflowCancelTreeOps } from "./workflow-cancel-tree";
2
- import { isDeepStrictEqual } from "node:util";
3
- import { createHash } from "node:crypto";
4
- import { workflowDispatchOps, recordDispatchAgent } from "./workflow-dispatch";
5
- import { workflowControlOps } from "./workflow-control";
6
- import { compositionOps, allocateRunId, releaseReservation } from "./workflow-composition";
7
- import { foreachOps } from "./workflow-foreach";
8
- import { admissionSchema } from "./workflow-state";
9
- import { validateWorkflowValue } from "./workflow-values";
10
- import { workflowActivationSchema, workflowSnapshotSchema, workflowReservationSchema } from "./workflow-activation";
11
- import { z } from "zod";
12
- import { OpError, defineModule } from "./contract";
13
- import { checkWorkflowBackstop, workflowBackstop, workflowBackstopInput } from "./workflow-backstop";
14
- import { workflowScriptAttemptSchema } from "./workflow-script";
15
- import { stepReap, workflowAppliedPinSchema, workflowCallPinSchema, workflowDefinitionSchema } from "./workflow-definition";
16
- import { enter, route, type RunState } from "./workflow-transitions";
17
- import { SIGNAL_TOPIC, WORKFLOW_SOURCES, ADMIN_GRANT, RUN_STATUSES, json, runSchema, effectSchema, signalSchema, linkSchema, agentSchema, crossProviderSchema, FACT_FIELD, allocationSchema, stores, requireRun, linkTask, writeEffect, workflowEffectId } from "./workflow-state";
18
- export { workflowEffectId, workflowOwnsAgentCleanup, workflowReapIncludesAgent } from "./workflow-state";
19
- export type { WorkflowRunRecord, WorkflowEffect, WorkflowSignal, WorkflowAgent, WorkflowCiVerdict, Stores } from "./workflow-state";
20
- function textField(value: unknown): string | undefined { return typeof value === "string" && value.trim() ? value : undefined; }
21
-
22
- export const workflow = defineModule({
23
- id: "workflow",
24
- title: "Declarative workflows",
25
- description: "Repo-declared multi-agent workflows (#3045): build → review → fix → land loops Relay routes itself.",
26
- entities: {
27
- // The compound indexes serve the dashboard: the run list and stats walk one status newest first, the
28
- // Definitions tab one workflow's newest runs (#3076).
29
- run: { schema: runSchema, indexes: ["taskId", "status", ["status", "updatedAt", "id"], ["workflow", "updatedAt", "id"], ["parentRunId", "id"], ["taskId", "requestKey"], ["rootRunId", "status", "id"], ["callerAgentId", "status"]] },
30
- effect: { schema: effectSchema, indexes: ["status", "runId"] },
31
- signal: { schema: signalSchema, indexes: ["runId"] },
32
- link: { schema: linkSchema },
33
- agent: { schema: agentSchema, indexes: ["runId", "agentId"] },
34
- allocation: { schema: allocationSchema },
35
- admission: { schema: admissionSchema },
36
- activation: { schema: workflowActivationSchema, indexes: [["runId", "id"], ["runId", "state", "id"], ["parentId", "id"], ["parentId", "state", "id"], ["parentId", "state", "active", "id"], ["active", "id"], ["runId", "active", "id"], ["parentId", "active", "id"], ["scheduling", "id"]] },
37
- reservation: { schema: workflowReservationSchema, indexes: ["runId", "rootRunId"] },
38
- scriptAttempt: { schema: workflowScriptAttemptSchema, indexes: ["runId"] },
39
- },
40
- events: {
41
- "workflow.started": z.object({ runId: z.string(), taskId: z.number().int(), workflow: z.string() }),
42
- [SIGNAL_TOPIC]: z.object({ runId: z.string(), correlationId: z.string() }),
43
- "workflow.routed": z.object({ runId: z.string(), step: z.string(), outcome: z.string(), target: z.string() }),
44
- "workflow.finished": z.object({ runId: z.string(), status: z.enum(RUN_STATUSES) }),
45
- },
46
- workflows: {
47
- run: {
48
- input: z.object({ runId: z.string() }),
49
- state: z.object({ runId: z.string() }),
50
- init: (input): RunState => ({ runId: input.runId }),
51
- start: "enter",
52
- steps: { enter: { run: enter }, route: { run: route } },
53
- },
54
- },
55
- ops: {
56
- ...workflowControlOps,
57
- ...workflowCancelTreeOps,
58
- ...compositionOps,
59
- ...foreachOps,
60
- ...workflowDispatchOps,
61
- checkOverdue: {
62
- kind: "mutation", idempotent: true, grant: ADMIN_GRANT,
63
- summary: "Record one backstop escalation per overdue episode (system-only).",
64
- expose: { http: false, mcp: false, cli: false },
65
- input: workflowBackstopInput, output: z.object({ created: z.boolean(), effectId: z.string().optional() }),
66
- handler: (ctx, input) => checkWorkflowBackstop(ctx, input, stores(ctx)),
67
- },
68
- scriptAttempts: {
69
- kind: "query", grant: ADMIN_GRANT, summary: "Page script attempt logs for a run (system-only).",
70
- expose: { http: false, mcp: false, cli: false },
71
- input: z.object({ runId: z.string(), cursor: z.string().optional() }),
72
- output: z.object({ items: z.array(workflowScriptAttemptSchema), cursor: z.string().optional() }),
73
- handler: async (ctx, input) => stores(ctx).scriptAttempt.list({ where: { runId: input.runId }, limit: 200, ...(input.cursor ? { cursor: input.cursor } : {}) }),
74
- },
75
- start: {
76
- kind: "mutation",
77
- idempotent: true,
78
- grant: ADMIN_GRANT,
79
- summary: "Start a run of a validated workflow on its input Task; returns the Task's open run instead when one exists (system-only).",
80
- emits: ["workflow.started"],
81
- expose: { http: false, mcp: false, cli: false },
82
- input: z.object({
83
- workflow: z.string().min(1),
84
- ref: z.string().min(1),
85
- sha: z.string().min(1),
86
- source: z.enum(WORKFLOW_SOURCES).optional(),
87
- taskId: z.number().int(),
88
- coordinator: z.string().min(1),
89
- callerAgentId: z.string().optional(),
90
- maxLiveAgents: z.number().int().min(1).optional(),
91
- maxConcurrentRuns: z.number().int().min(1).optional(),
92
- tokenBudget: runSchema.shape.tokenBudget,
93
- cwd: z.string().min(1),
94
- orchestratorId: z.string().min(1),
95
- definition: workflowDefinitionSchema,
96
- /** Stamped and checked against the definition by the src caller (stampWorkflowPins). */
97
- pins: z.record(z.string(), workflowCallPinSchema).optional(),
98
- routingDefaults: runSchema.shape.routingDefaults,
99
- inputs: json.optional(), snapshot: workflowSnapshotSchema.optional(), requestKey: z.string().optional(),
100
- afterEventId: z.number().int().min(0),
101
- }),
102
- output: z.object({ run: runSchema, created: z.boolean() }),
103
- handler: async (ctx, input) => {
104
- const runs = stores(ctx).run;
105
- const prior = await runs.list({ where: { taskId: input.taskId, status: "running" }, limit: 200 });
106
- const parked = input.definition.version === 2 ? await runs.list({ where: { taskId: input.taskId, status: "escalated" }, limit: 200 }) : { items: [] };
107
- const replay = input.requestKey ? await runs.list({ where: { taskId: input.taskId, requestKey: input.requestKey }, limit: 1 }) : { items: [] };
108
- const open = [...replay.items, ...prior.items, ...parked.items].find(run => !run.parentRunId && (!run.cancel || Boolean(input.requestKey && run.requestKey === input.requestKey)));
109
- if (open) {
110
- if (input.callerAgentId && open.coordinator !== input.callerAgentId) throw new OpError("conflict", 409, "WORKFLOW_CALLER_CONFLICT: Task already has another caller’s run");
111
- if (input.definition.version === 2 && (open.workflow !== input.workflow || !isDeepStrictEqual(open.inputs ?? {}, input.inputs ?? {}))) throw new OpError("conflict", 409, "ROOT_INPUT_CONFLICT: root keeps its original inputs");
112
- return { run: open, created: false };
113
- }
114
- if (input.callerAgentId) {
115
- let occupied = 0;
116
- for (const status of ["running", "escalated"] as const) {
117
- let cursor: string | undefined;
118
- do {
119
- const page = await runs.list({ where: { callerAgentId: input.callerAgentId, status }, limit: 200, cursor });
120
- occupied += page.items.filter(run => !run.parentRunId).length;
121
- if (occupied >= (input.maxConcurrentRuns ?? 1)) throw new OpError("conflict", 409, "WORKFLOW_RUN_LIMIT: caller has reached its concurrent run limit");
122
- cursor = page.cursor;
123
- } while (cursor);
124
- }
125
- }
126
- validateWorkflowValue(input.definition.inputs, input.inputs ?? {}, "INPUT_INVALID");
127
- const now = ctx.clock.now();
128
- const id = await allocateRunId(ctx, input.taskId);
129
- const run = await runs.create({
130
- id, workflow: input.workflow, ref: input.ref, sha: input.sha, ...(input.source ? { source: input.source } : {}), taskId: input.taskId, coordinator: input.coordinator,
131
- ...(input.callerAgentId ? { callerAgentId: input.callerAgentId, maxLiveAgents: input.maxLiveAgents } : {}),
132
- ...(input.tokenBudget ? { tokenBudget: input.tokenBudget } : {}),
133
- cwd: input.cwd, orchestratorId: input.orchestratorId, definition: input.definition, ...(input.pins && Object.keys(input.pins).length ? { pins: input.pins } : {}), ...(input.routingDefaults ? { routingDefaults: input.routingDefaults } : {}), status: "running",
134
- step: input.definition.start, round: 1, entered: [], counters: {}, waitSeq: 0, awaiting: null,
135
- ...(input.definition.version === 2 ? { inputs: input.inputs ?? {}, rootRunId: id, depth: 0, generation: 0, snapshot: input.snapshot, snapshotDigest: createHash("sha256").update(JSON.stringify(input.snapshot ?? {})).digest("hex"), limits: input.definition.limits, requestKey: input.requestKey, budget: { children: 0, activations: 0, agents: 0 } } : {}),
136
- cursor: input.afterEventId, feedback: null, rounds: [], ...workflowBackstop({ definition: input.definition, step: input.definition.start }, now), createdAt: now, updatedAt: now,
137
- });
138
- if (!input.definition.version) await linkTask(ctx, input.taskId, id);
139
- await writeEffect(ctx, run, 0, "started", {});
140
- await ctx.events.emit("workflow.started", { runId: id, taskId: input.taskId, workflow: input.workflow });
141
- await ctx.workflows.start("run", { runId: id }, { idempotencyKey: id, enlist: "op-commit" });
142
- return { run, created: true };
143
- },
144
- },
145
- get: {
146
- kind: "query",
147
- grant: ADMIN_GRANT,
148
- summary: "Read one run record (system-only).",
149
- expose: { http: false, mcp: false, cli: false },
150
- input: z.object({ runId: z.string().min(1) }),
151
- output: runSchema,
152
- handler: async (ctx, input) => requireRun(ctx, input.runId),
153
- },
154
- openRuns: {
155
- kind: "query",
156
- grant: ADMIN_GRANT,
157
- summary: "List running runs, for the supervisor's signal reconcile (system-only).",
158
- expose: { http: false, mcp: false, cli: false },
159
- input: z.object({ taskId: z.number().int().optional(), limit: z.number().int().min(1).max(200).optional(), cursor: z.string().optional() }),
160
- output: z.object({ items: z.array(runSchema), cursor: z.string().optional() }),
161
- handler: async (ctx, input) => {
162
- const page = await stores(ctx).run.list({
163
- where: { status: "running", ...(input.taskId !== undefined ? { taskId: input.taskId } : {}) },
164
- ...(input.limit !== undefined ? { limit: input.limit } : {}),
165
- ...(input.cursor !== undefined ? { cursor: input.cursor } : {}),
166
- });
167
- return { items: [...page.items], ...(page.cursor ? { cursor: page.cursor } : {}) };
168
- },
169
- },
170
- taskRun: {
171
- kind: "query",
172
- grant: ADMIN_GRANT,
173
- summary: "The running run that routes a Task's deliveries and the Task's verdict gate, if any (system-only).",
174
- expose: { http: false, mcp: false, cli: false },
175
- input: z.object({ taskId: z.number().int() }),
176
- output: z.object({ runId: z.string().optional(), verdictGate: z.string().optional() }),
177
- handler: async (ctx, input) => {
178
- const link = await stores(ctx).link.get(String(input.taskId));
179
- const run = link ? await stores(ctx).run.get(link.runId) : undefined;
180
- if (run?.status !== "running") return {};
181
- return { runId: run.id, ...(link?.gate ? { verdictGate: link.gate } : {}) };
182
- },
183
- },
184
- signal: {
185
- kind: "mutation",
186
- idempotent: true,
187
- grant: ADMIN_GRANT,
188
- summary: "Satisfy a run's current wait with a durable src fact; a repeat or a stale key is a no-op (system-only).",
189
- emits: [SIGNAL_TOPIC],
190
- expose: { http: false, mcp: false, cli: false },
191
- input: z.object({ key: z.string().min(1), runId: z.string().min(1), kind: signalSchema.shape.kind, payload: json }),
192
- output: z.object({ created: z.boolean() }),
193
- handler: async (ctx, input) => {
194
- const run = await requireRun(ctx, input.runId);
195
- if (run.status !== "running" || run.awaiting?.key !== input.key) return { created: false };
196
- if (await stores(ctx).signal.get(input.key)) return { created: false };
197
- await stores(ctx).signal.create({ id: input.key, runId: input.runId, kind: input.kind, payload: input.payload, createdAt: ctx.clock.now() });
198
- await ctx.events.emit(SIGNAL_TOPIC, { runId: input.runId, correlationId: input.key });
199
- return { created: true };
200
- },
201
- },
202
- amendTokenBudget: {
203
- kind: "mutation",
204
- idempotent: true,
205
- grant: ADMIN_GRANT,
206
- summary: "Set a budgeted run's token cap; an absolute value, so a replay is a no-op (system-only).",
207
- expose: { http: false, mcp: false, cli: false },
208
- input: z.object({ runId: z.string().min(1), tokenCap: z.number().int().positive().max(Number.MAX_SAFE_INTEGER) }),
209
- output: runSchema,
210
- handler: async (ctx, input) => {
211
- const run = await requireRun(ctx, input.runId);
212
- if (!run.tokenBudget) throw new OpError("conflict", 409, `workflow run '${run.id}' has no token budget to amend`);
213
- return stores(ctx).run.update(run.id, { tokenBudget: { tokenCap: input.tokenCap }, updatedAt: ctx.clock.now() });
214
- },
215
- },
216
- exitedWaitAgent: {
217
- kind: "query",
218
- grant: ADMIN_GRANT,
219
- summary: "The step agent a running run's delivery wait depends on, if it exited: the one its dispatch spawned or its message went to (system-only).",
220
- expose: { http: false, mcp: false, cli: false },
221
- input: z.object({ runId: z.string().min(1) }),
222
- output: z.object({ agent: agentSchema.optional() }),
223
- handler: async (ctx, input) => {
224
- const run = await requireRun(ctx, input.runId);
225
- if (run.status !== "running" || run.awaiting?.kind !== "delivery") return {};
226
- const page = await stores(ctx).agent.list({ where: { runId: run.id }, limit: 200 });
227
- const exited = page.items.filter((agent) => agent.exitedAt !== undefined || (agent.spawnFailedAt !== undefined && agent.readyAt === undefined));
228
- if (!exited.length) return {};
229
- // The wait's own effect names its agent: a fresh dispatch's spawn, or the warm builder its findings or resume note reached.
230
- const ids = run.awaiting.effectId ? [run.awaiting.effectId] : (["dispatch", "findings"] as const).map((kind) => workflowEffectId(run.id, run.waitSeq, kind));
231
- for (const id of ids) {
232
- const effect = await stores(ctx).effect.get(id);
233
- if (effect?.status !== "done") continue;
234
- const spawned = textField(effect.result?.spawnRequestId);
235
- const to = textField(effect.result?.to);
236
- if (!spawned && !to) return {};
237
- const agent = exited.filter((row) => (spawned ? row.id === spawned : row.agentId === to)).sort((a, b) => b.createdAt - a.createdAt)[0];
238
- return agent ? { agent } : {};
239
- }
240
- return {};
241
- },
242
- },
243
- hasSignal: {
244
- kind: "query",
245
- grant: ADMIN_GRANT,
246
- summary: "Whether a wait's signal exists — the runtime's wait evaluator (system-only).",
247
- expose: { http: false, mcp: false, cli: false },
248
- input: z.object({ key: z.string().min(1) }),
249
- output: z.object({ present: z.boolean() }),
250
- handler: async (ctx, input) => ({ present: Boolean(await stores(ctx).signal.get(input.key)) }),
251
- },
252
- pendingEffects: {
253
- kind: "query",
254
- grant: ADMIN_GRANT,
255
- summary: "List effect intents the src supervisor has not performed yet, oldest first per run (system-only).",
256
- expose: { http: false, mcp: false, cli: false },
257
- input: z.object({ limit: z.number().int().min(1).max(200).optional() }),
258
- output: z.object({ items: z.array(effectSchema) }),
259
- handler: async (ctx, input) => {
260
- const page = await stores(ctx).effect.list({ where: { status: "pending" }, ...(input.limit !== undefined ? { limit: input.limit } : {}) });
261
- return { items: [...page.items] };
262
- },
263
- },
264
- resumeCleanup: {
265
- kind: "mutation", idempotent: true, grant: ADMIN_GRANT,
266
- summary: "Requeue deferred shutdowns for hosts that are online (system-only).",
267
- expose: { http: false, mcp: false, cli: false },
268
- input: z.object({ orchestratorIds: z.array(z.string()), cursor: z.string().optional() }),
269
- output: z.object({ resumed: z.number(), cursor: z.string().optional() }),
270
- handler: async (ctx, input) => {
271
- const page = await stores(ctx).effect.list({ where: { status: "deferred" }, limit: 100, ...(input.cursor ? { cursor: input.cursor } : {}) });
272
- const hosts = new Set(input.orchestratorIds);
273
- let resumed = 0;
274
- for (const effect of page.items) {
275
- const targets = z.array(z.object({ orchestratorId: z.string() })).safeParse(effect.result?.deferred);
276
- if (effect.kind !== "reap" || !targets.success || !targets.data.some(target => hosts.has(target.orchestratorId))) continue;
277
- await stores(ctx).effect.update(effect.id, { status: "pending" });
278
- resumed++;
279
- }
280
- return { resumed, ...(page.cursor ? { cursor: page.cursor } : {}) };
281
- },
282
- },
283
- getEffect: {
284
- kind: "query",
285
- grant: ADMIN_GRANT,
286
- summary: "Read one effect intent (system-only).",
287
- expose: { http: false, mcp: false, cli: false },
288
- input: z.object({ id: z.string().min(1) }),
289
- output: z.object({ effect: effectSchema.optional() }),
290
- handler: async (ctx, input) => {
291
- const effect = await stores(ctx).effect.get(input.id);
292
- return effect ? { effect } : {};
293
- },
294
- },
295
- runAgents: {
296
- kind: "query",
297
- grant: ADMIN_GRANT,
298
- summary: "The agents a run's steps spawned, oldest first (system-only).",
299
- expose: { http: false, mcp: false, cli: false },
300
- input: z.object({ runId: z.string().min(1) }),
301
- output: z.object({ items: z.array(agentSchema) }),
302
- handler: async (ctx, input) => {
303
- const page = await stores(ctx).agent.list({ where: { runId: input.runId }, limit: 200 });
304
- return { items: [...page.items].sort((a, b) => a.createdAt - b.createdAt) };
305
- },
306
- },
307
- noteAgent: {
308
- kind: "mutation",
309
- idempotent: true,
310
- grant: ADMIN_GRANT,
311
- summary: "Record a step agent's lifecycle fact (registered, ready, exited, reaped, kept) on its current generation; a successor's ready rebinds the row (system-only).",
312
- expose: { http: false, mcp: false, cli: false },
313
- input: z.object({ spawnRequestId: z.string().min(1), fact: z.enum(["registered", "spawn-failed", "ready", "exited", "reaped", "kept"]), runId: z.string().optional(), agentId: z.string().optional(), reason: z.string().optional() }),
314
- output: z.object({ recorded: z.boolean() }),
315
- handler: async (ctx, input) => {
316
- const store = stores(ctx).agent;
317
- let agent = await store.get(input.spawnRequestId);
318
- if (!agent && input.runId && input.agentId) {
319
- const page = await store.list({ where: { runId: input.runId, agentId: input.agentId }, limit: 10 });
320
- const prior = page.items.find((row) => row.spawnRequestId !== input.spawnRequestId);
321
- // Only a successor's ready proves the new generation is the live one.
322
- if (prior && input.fact === "ready") {
323
- await store.update(prior.id, { spawnRequestId: input.spawnRequestId, readyAt: ctx.clock.now(), exitedAt: undefined, exitReason: undefined });
324
- return { recorded: true };
325
- }
326
- agent = page.items.find((row) => row.spawnRequestId === input.spawnRequestId);
327
- }
328
- // A predecessor's late edge (register-before-kill restart) says nothing about the live generation.
329
- if (!agent || agent.spawnRequestId !== input.spawnRequestId) return { recorded: false };
330
- // #3160 — registration binds the agent id, whether or not a ready edge ever reaches the run.
331
- if (input.fact === "registered") {
332
- if (agent.agentId || !input.agentId) return { recorded: false };
333
- await store.update(agent.id, { agentId: input.agentId });
334
- return { recorded: true };
335
- }
336
- const run = input.fact === "spawn-failed" ? await requireRun(ctx, agent.runId) : undefined;
337
- if (agent.reservationId && ["spawn-failed", "exited", "reaped"].includes(input.fact) && !(run?.rootRunId && run.cancel)) await releaseReservation(ctx, agent.reservationId);
338
- const field = FACT_FIELD[input.fact as keyof typeof FACT_FIELD];
339
- if (agent[field] !== undefined) return { recorded: false };
340
- await store.update(agent.id, {
341
- [field]: ctx.clock.now(),
342
- ...(input.agentId && !agent.agentId ? { agentId: input.agentId } : {}),
343
- ...(input.fact === "spawn-failed" && input.reason ? { spawnError: input.reason.slice(0, 500) } : {}),
344
- ...(input.fact === "exited" && input.reason ? { exitReason: input.reason.slice(0, 500) } : {}),
345
- ...(input.fact === "kept" && input.reason ? { keptReason: input.reason.slice(0, 500) } : {}),
346
- });
347
- return { recorded: true };
348
- },
349
- },
350
- settleEffect: {
351
- kind: "mutation",
352
- idempotent: true,
353
- grant: ADMIN_GRANT,
354
- summary: "Record a performed (done), retryable (pending) or failed effect; a created Task joins the run (system-only).",
355
- expose: { http: false, mcp: false, cli: false },
356
- input: z.object({ id: z.string().min(1), status: effectSchema.shape.status, result: json.optional(), error: z.string().optional() }),
357
- output: effectSchema,
358
- handler: async (ctx, input) => {
359
- const effect = await stores(ctx).effect.get(input.id);
360
- if (!effect) throw new OpError("not_found", 404, `workflow effect '${input.id}' was not found`);
361
- if (effect.status !== "pending") return effect;
362
- const taskId = input.result?.taskId;
363
- const gate = typeof effect.payload.gate === "string" ? effect.payload.gate : undefined;
364
- if (input.status === "done" && typeof taskId === "number") await linkTask(ctx, taskId, effect.runId, gate, typeof effect.payload.activationId === "string" ? effect.payload.activationId : undefined);
365
- if (input.status === "done" && input.result) await recordDispatchAgent(ctx, effect, input.result);
366
- return stores(ctx).effect.update(input.id, {
367
- status: input.status,
368
- attempts: effect.attempts + 1,
369
- ...(input.result ? { result: input.result } : {}),
370
- ...(input.error ? { error: input.error } : {}),
371
- ...(input.status === "pending" || input.status === "deferred" ? {} : { settledAt: ctx.clock.now() }),
372
- });
373
- },
374
- },
375
- },
376
- });
@@ -1,167 +0,0 @@
1
- # PolyForm Shield License 1.0.0
2
-
3
- <https://polyformproject.org/licenses/shield/1.0.0>
4
-
5
- ## Acceptance
6
-
7
- In order to get any license under these terms, you must agree
8
- to them as both strict obligations and conditions to all
9
- your licenses.
10
-
11
- ## Copyright License
12
-
13
- The licensor grants you a copyright license for the
14
- software to do everything you might do with the software
15
- that would otherwise infringe the licensor's copyright
16
- in it for any permitted purpose. However, you may
17
- only distribute the software according to [Distribution
18
- License](#distribution-license) and make changes or new works
19
- based on the software according to [Changes and New Works
20
- License](#changes-and-new-works-license).
21
-
22
- ## Distribution License
23
-
24
- The licensor grants you an additional copyright license
25
- to distribute copies of the software. Your license
26
- to distribute covers distributing the software with
27
- changes and new works permitted by [Changes and New Works
28
- License](#changes-and-new-works-license).
29
-
30
- ## Notices
31
-
32
- You must ensure that anyone who gets a copy of any part of
33
- the software from you also gets a copy of these terms or the
34
- URL for them above, as well as copies of any plain-text lines
35
- beginning with `Required Notice:` that the licensor provided
36
- with the software. For example:
37
-
38
- > Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
39
-
40
- ## Changes and New Works License
41
-
42
- The licensor grants you an additional copyright license to
43
- make changes and new works based on the software for any
44
- permitted purpose.
45
-
46
- ## Patent License
47
-
48
- The licensor grants you a patent license for the software that
49
- covers patent claims the licensor can license, or becomes able
50
- to license, that you would infringe by using the software.
51
-
52
- ## Noncompete
53
-
54
- Any purpose is a permitted purpose, except for providing any
55
- product that competes with the software or any product the
56
- licensor or any of its affiliates provides using the software.
57
-
58
- ## Competition
59
-
60
- Goods and services compete even when they provide functionality
61
- through different kinds of interfaces or for different technical
62
- platforms. Applications can compete with services, libraries
63
- with plugins, frameworks with development tools, and so on,
64
- even if they're written in different programming languages
65
- or for different computer architectures. Goods and services
66
- compete even when provided free of charge. If you market a
67
- product as a practical substitute for the software or another
68
- product, it definitely competes.
69
-
70
- ## New Products
71
-
72
- If you are using the software to provide a product that does
73
- not compete, but the licensor or any of its affiliates brings
74
- your product into competition by providing a new version of
75
- the software or another product using the software, you may
76
- continue using versions of the software available under these
77
- terms beforehand to provide your competing product, but not
78
- any later versions.
79
-
80
- ## Discontinued Products
81
-
82
- You may begin using the software to compete with a product
83
- or service that the licensor or any of its affiliates has
84
- stopped providing, unless the licensor includes a plain-text
85
- line beginning with `Licensor Line of Business:` with the
86
- software that mentions that line of business. For example:
87
-
88
- > Licensor Line of Business: YoyodyneCMS Content Management
89
- System (http://example.com/cms)
90
-
91
- ## Sales of Business
92
-
93
- If the licensor or any of its affiliates sells a line of
94
- business developing the software or using the software
95
- to provide a product, the buyer can also enforce
96
- [Noncompete](#noncompete) for that product.
97
-
98
- ## Fair Use
99
-
100
- You may have "fair use" rights for the software under the
101
- law. These terms do not limit them.
102
-
103
- ## No Other Rights
104
-
105
- These terms do not allow you to sublicense or transfer any of
106
- your licenses to anyone else, or prevent the licensor from
107
- granting licenses to anyone else. These terms do not imply
108
- any other licenses.
109
-
110
- ## Patent Defense
111
-
112
- If you make any written claim that the software infringes or
113
- contributes to infringement of any patent, your patent license
114
- for the software granted under these terms ends immediately. If
115
- your company makes such a claim, your patent license ends
116
- immediately for work on behalf of your company.
117
-
118
- ## Violations
119
-
120
- The first time you are notified in writing that you have
121
- violated any of these terms, or done anything with the software
122
- not covered by your licenses, your licenses can nonetheless
123
- continue if you come into full compliance with these terms,
124
- and take practical steps to correct past violations, within
125
- 32 days of receiving notice. Otherwise, all your licenses
126
- end immediately.
127
-
128
- ## No Liability
129
-
130
- ***As far as the law allows, the software comes as is, without
131
- any warranty or condition, and the licensor will not be liable
132
- to you for any damages arising out of these terms or the use
133
- or nature of the software, under any kind of legal claim.***
134
-
135
- ## Definitions
136
-
137
- The **licensor** is the individual or entity offering these
138
- terms, and the **software** is the software the licensor makes
139
- available under these terms.
140
-
141
- A **product** can be a good or service, or a combination
142
- of them.
143
-
144
- **You** refers to the individual or entity agreeing to these
145
- terms.
146
-
147
- **Your company** is any legal entity, sole proprietorship,
148
- or other kind of organization that you work for, plus all
149
- its affiliates.
150
-
151
- **Affiliates** means the other organizations than an
152
- organization has control over, is under the control of, or is
153
- under common control with.
154
-
155
- **Control** means ownership of substantially all the assets of
156
- an entity, or the power to direct its management and policies
157
- by vote, contract, or otherwise. Control can be direct or
158
- indirect.
159
-
160
- **Your licenses** are all the licenses granted to you for the
161
- software under these terms.
162
-
163
- **Use** means anything you do with the software requiring one
164
- of your licenses.
165
-
166
- Required Notice: Copyright 2026 Exelerus AB
167
- Licensor Line of Business: provider-independent runtimes and coordination software for teams of AI agents
@@ -1,57 +0,0 @@
1
- # @humwick/offload
2
-
3
- Bounded execution primitives for CPU workers, cooperative async I/O, and subprocesses.
4
- All runners use `OffloadEnvelope` for timeout, abort, structured logging, labels, typed
5
- `OffloadError`, and injected escalation.
6
-
7
- ## Maintenance adoption
8
-
9
- `WorkerPool` and `SubprocessRunner` expose `offThread: true`; this is an intentional
10
- marker, not an automatic scheduler integration. A maintenance job that hands its heavy
11
- work to either runner must explicitly wire the existing #1757 seam immediately after
12
- starting it:
13
-
14
- ```ts
15
- const work = runner.run("heavy-job", input, { signal: context.signal });
16
- if (runner.offThread) context.markOffThread?.();
17
- await work;
18
- ```
19
-
20
- `AsyncRunner` is bounded but stays on the process event loop, so it does not advertise
21
- `offThread`.
22
-
23
- ## Shutdown
24
-
25
- Every runner has a teardown that cancels rather than waits: `WorkerPool.destroy()`,
26
- `AsyncRunner.destroy()` and `SubprocessRunner.destroy()` reject outstanding work with an
27
- `aborted` `OffloadError`, kill live subprocess groups, and refuse new work. `drain()` is
28
- the opposite — it waits for accepted work to finish and cancels nothing.
29
-
30
- Because subprocess children run in their own process group, they are reparented rather
31
- than reaped when the host dies; the runner installs a single process `exit` hook that
32
- SIGKILLs any group still alive. A host killed with SIGKILL cannot run that hook, so a
33
- supervisor is still the only guarantee there.
34
-
35
- ## Bounds worth knowing
36
-
37
- - `timeoutMs` (and abort) are hard for subprocesses: SIGTERM, then SIGKILL to the process
38
- group after `killGraceMs` (default 2s), so a child that traps SIGTERM cannot outlive
39
- its deadline. The concurrency slot is held until the child is actually reaped, so
40
- `stats` never reports a slot as free while its work is still running.
41
- - A non-zero exit is a failure by default (it rejects and takes an escalation strike). Probe
42
- callers whose answer *is* the exit code — `tmux has-session`, `which`, `git rev-parse`, a
43
- land gate — must declare it with `okExitCodes` (`[0, 1]`, or `"any"` when the failing codes
44
- are not enumerable). Without it the escalation signal inverts: the sink pages on a healthy
45
- fleet and then latches, so the real outage goes unreported.
46
- **`"any"` also accepts signal deaths** — 137 (SIGKILL, typically the OOM killer) and 139
47
- (SIGSEGV) come back as successes and re-arm the strike counter. That is deliberate for a
48
- land gate, where an OOM-killed gate is just a failed gate, but it means an infrastructure
49
- death reads as a healthy answer and never escalates. Prefer an explicit code list unless
50
- the failing codes genuinely cannot be enumerated; timeout and abort still throw either way.
51
- - Subprocess output is captured up to `maxOutputBytes` per stream (default 8 MiB) and the
52
- result carries `truncated`. The stream is still drained past the cap so a chatty child
53
- never blocks on a full pipe.
54
- - `AsyncRunner` work that ignores its signal keeps its slot until it returns: the cap
55
- degrades toward serial rather than over-admitting. `destroy()` still returns promptly.
56
- - A worker round-trip costs ~110µs, so tasks below roughly 1ms of CPU are not worth
57
- offloading. `run()` has no backpressure: the queue is unbounded by design.
@@ -1,18 +0,0 @@
1
- import { type OffloadDefaults, type OffloadEnvelope } from "./types.js";
2
- export interface AsyncRunnerOptions extends OffloadDefaults {
3
- concurrency: number;
4
- }
5
- export interface AsyncRunner {
6
- run<T>(taskName: string, fn: (signal: AbortSignal) => Promise<T> | T, env?: OffloadEnvelope): Promise<T>;
7
- readonly stats: {
8
- active: number;
9
- queued: number;
10
- };
11
- /** Resolves when everything accepted so far has finished. Does not cancel anything. */
12
- drain(): Promise<void>;
13
- /** Cancels in-flight work, settles every outstanding caller, and refuses new work. */
14
- destroy(): Promise<void>;
15
- }
16
- /** Bounded I/O runner. Work receives the composed signal and must cooperate with aborts. */
17
- export declare function createAsyncRunner(options: AsyncRunnerOptions): AsyncRunner;
18
- //# sourceMappingURL=async-runner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"async-runner.d.ts","sourceRoot":"","sources":["../src/async-runner.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAEtI,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACzG,QAAQ,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,uFAAuF;IACvF,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,sFAAsF;IACtF,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAYD,4FAA4F;AAC5F,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,CA6I1E"}