@wardby/cli 0.5.2 → 0.6.0

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 (411) hide show
  1. package/.env.example +33 -0
  2. package/README.md +25 -14
  3. package/dist/claude-coding-worker/context.d.ts +22 -0
  4. package/dist/claude-coding-worker/context.js +92 -0
  5. package/dist/claude-coding-worker/driver.d.ts +7 -1
  6. package/dist/claude-coding-worker/driver.js +38 -5
  7. package/dist/claude-coding-worker/sdk.js +13 -4
  8. package/dist/cli-help.d.ts +1 -1
  9. package/dist/cli-help.js +5 -2
  10. package/dist/cli-native-mode.d.ts +9 -0
  11. package/dist/cli-native-mode.js +20 -0
  12. package/dist/cli.d.ts +3 -1
  13. package/dist/cli.js +141 -5
  14. package/dist/coding/claude-context.d.ts +45 -0
  15. package/dist/coding/claude-context.js +434 -0
  16. package/dist/coding/local-git.js +9 -1
  17. package/dist/coding/profile.d.ts +12 -0
  18. package/dist/coding/profile.js +6 -0
  19. package/dist/coding/protocol.d.ts +104 -0
  20. package/dist/coding/protocol.js +87 -3
  21. package/dist/coding/registry/pypi.d.ts +25 -1
  22. package/dist/coding/registry/pypi.js +140 -16
  23. package/dist/coding/registry/types.d.ts +17 -3
  24. package/dist/coding-worker/artifact.d.ts +8 -0
  25. package/dist/coding-worker/artifact.js +2 -2
  26. package/dist/coding-worker/driver.js +2 -0
  27. package/dist/coding-worker/sdk.d.ts +6 -0
  28. package/dist/coding-worker/sdk.js +1 -0
  29. package/dist/coding-worker/skills.d.ts +23 -0
  30. package/dist/coding-worker/skills.js +117 -0
  31. package/dist/coding-worker/types.d.ts +2 -0
  32. package/dist/config/github-allowed-accounts.d.ts +15 -0
  33. package/dist/config/github-allowed-accounts.js +36 -0
  34. package/dist/config/low-power.d.ts +12 -0
  35. package/dist/config/low-power.js +18 -0
  36. package/dist/config/mobile.d.ts +12 -0
  37. package/dist/config/mobile.js +18 -0
  38. package/dist/config/providers.d.ts +56 -2
  39. package/dist/config/providers.js +92 -6
  40. package/dist/core/db.d.ts +16 -6
  41. package/dist/core/db.js +12 -10
  42. package/dist/core/dispatch.d.ts +11 -0
  43. package/dist/core/dispatch.js +36 -1
  44. package/dist/core/engine-native.js +9 -5
  45. package/dist/core/host-events.d.ts +49 -3
  46. package/dist/core/host-events.js +289 -15
  47. package/dist/core/http-runtime.js +13 -6
  48. package/dist/core/issue-bridge.js +42 -2
  49. package/dist/core/issue-events.js +12 -1
  50. package/dist/core/issue-status.js +14 -3
  51. package/dist/core/merge-order-check.d.ts +129 -0
  52. package/dist/core/merge-order-check.js +336 -0
  53. package/dist/core/notification-dispatcher.d.ts +70 -0
  54. package/dist/core/notification-dispatcher.js +368 -0
  55. package/dist/core/notification-templates.d.ts +25 -0
  56. package/dist/core/notification-templates.js +105 -0
  57. package/dist/core/notifications.d.ts +10 -0
  58. package/dist/core/notifications.js +38 -0
  59. package/dist/core/pg-auth.d.ts +22 -0
  60. package/dist/core/pg-auth.js +152 -0
  61. package/dist/core/power-composition.d.ts +16 -0
  62. package/dist/core/power-composition.js +37 -0
  63. package/dist/core/power-idle.d.ts +14 -0
  64. package/dist/core/power-idle.js +30 -0
  65. package/dist/core/power.d.ts +71 -0
  66. package/dist/core/power.js +202 -0
  67. package/dist/core/reconciler.d.ts +4 -2
  68. package/dist/core/reconciler.js +29 -5
  69. package/dist/core/related-pull-requests.d.ts +48 -4
  70. package/dist/core/related-pull-requests.js +113 -11
  71. package/dist/core/repo-access.d.ts +15 -0
  72. package/dist/core/repo-access.js +66 -0
  73. package/dist/core/review-fix.d.ts +37 -0
  74. package/dist/core/review-fix.js +207 -6
  75. package/dist/core/review-host-tools.d.ts +20 -0
  76. package/dist/core/review-host-tools.js +58 -2
  77. package/dist/core/runner.d.ts +336 -3
  78. package/dist/core/runner.js +894 -317
  79. package/dist/core/secret-broker-config.d.ts +103 -0
  80. package/dist/core/secret-broker-config.js +112 -0
  81. package/dist/core/secrets.d.ts +39 -4
  82. package/dist/core/secrets.js +148 -40
  83. package/dist/core/workflow-event-recorder.d.ts +14 -0
  84. package/dist/core/workflow-event-recorder.js +120 -0
  85. package/dist/core/workflow-events.d.ts +82 -0
  86. package/dist/core/workflow-events.js +44 -0
  87. package/dist/core/workflow-run-events.d.ts +16 -0
  88. package/dist/core/workflow-run-events.js +40 -0
  89. package/dist/generated/prisma/browser.d.ts +58 -0
  90. package/dist/generated/prisma/client.d.ts +58 -0
  91. package/dist/generated/prisma/commonInputTypes.d.ts +150 -0
  92. package/dist/generated/prisma/enums.d.ts +27 -0
  93. package/dist/generated/prisma/enums.js +23 -0
  94. package/dist/generated/prisma/internal/class.d.ts +88 -0
  95. package/dist/generated/prisma/internal/class.js +4 -4
  96. package/dist/generated/prisma/internal/prismaNamespace.d.ts +772 -1
  97. package/dist/generated/prisma/internal/prismaNamespace.js +135 -4
  98. package/dist/generated/prisma/internal/prismaNamespaceBrowser.d.ts +139 -0
  99. package/dist/generated/prisma/internal/prismaNamespaceBrowser.js +135 -4
  100. package/dist/generated/prisma/models/Agent.d.ts +360 -1
  101. package/dist/generated/prisma/models/CodingAgentProfile.d.ts +73 -1
  102. package/dist/generated/prisma/models/CodingRun.d.ts +205 -1
  103. package/dist/generated/prisma/models/DeferredReview.d.ts +78 -1
  104. package/dist/generated/prisma/models/NativeGatewayCall.d.ts +1675 -0
  105. package/dist/generated/prisma/models/NativeGatewayCall.js +1 -0
  106. package/dist/generated/prisma/models/NativeGatewaySession.d.ts +1517 -0
  107. package/dist/generated/prisma/models/NativeGatewaySession.js +1 -0
  108. package/dist/generated/prisma/models/NativeWarmWorker.d.ts +1296 -0
  109. package/dist/generated/prisma/models/NativeWarmWorker.js +1 -0
  110. package/dist/generated/prisma/models/NotificationChannel.d.ts +1543 -0
  111. package/dist/generated/prisma/models/NotificationChannel.js +1 -0
  112. package/dist/generated/prisma/models/NotificationDelivery.d.ts +1502 -0
  113. package/dist/generated/prisma/models/NotificationDelivery.js +1 -0
  114. package/dist/generated/prisma/models/NotificationThread.d.ts +1090 -0
  115. package/dist/generated/prisma/models/NotificationThread.js +1 -0
  116. package/dist/generated/prisma/models/Run.d.ts +826 -1
  117. package/dist/generated/prisma/models/RunHostCheck.d.ts +36 -1
  118. package/dist/generated/prisma/models/Secret.d.ts +37 -1
  119. package/dist/generated/prisma/models/SecretBrokerChange.d.ts +1101 -0
  120. package/dist/generated/prisma/models/SecretBrokerChange.js +1 -0
  121. package/dist/generated/prisma/models/WorkflowEvent.d.ts +1422 -0
  122. package/dist/generated/prisma/models/WorkflowEvent.js +1 -0
  123. package/dist/generated/prisma/models.d.ts +8 -0
  124. package/dist/help/build.js +4 -2
  125. package/dist/help/catalog.d.ts +1 -1
  126. package/dist/help/catalog.js +31 -6
  127. package/dist/help-index.json +1492 -113
  128. package/dist/import/create.js +17 -0
  129. package/dist/import/neutral-schema.d.ts +6 -2
  130. package/dist/import/neutral-schema.js +2 -0
  131. package/dist/mcp/auth/access.d.ts +1 -0
  132. package/dist/mcp/auth/ownership.d.ts +1 -1
  133. package/dist/mcp/auth/repo-authorization.js +14 -0
  134. package/dist/mcp/auth/resource-server.d.ts +2 -1
  135. package/dist/mcp/auth/resource-server.js +7 -2
  136. package/dist/mcp/auth/self-hosted/browser.d.ts +1 -1
  137. package/dist/mcp/auth/self-hosted/browser.js +19 -6
  138. package/dist/mcp/context.d.ts +6 -0
  139. package/dist/mcp/host-events/github-ingress.d.ts +23 -1
  140. package/dist/mcp/host-events/github-ingress.js +68 -0
  141. package/dist/mcp/index.d.ts +13 -0
  142. package/dist/mcp/index.js +59 -10
  143. package/dist/mcp/tools/agents.js +83 -12
  144. package/dist/mcp/tools/notification-channels.d.ts +2 -0
  145. package/dist/mcp/tools/notification-channels.js +293 -0
  146. package/dist/mcp/tools/power.d.ts +2 -0
  147. package/dist/mcp/tools/power.js +77 -0
  148. package/dist/mcp/tools/runs.d.ts +0 -6
  149. package/dist/mcp/tools/runs.js +7 -2
  150. package/dist/mcp/tools/secret-broker-compat.d.ts +12 -0
  151. package/dist/mcp/tools/secret-broker-compat.js +23 -0
  152. package/dist/mcp/tools/secret-elicitation-form.d.ts +22 -2
  153. package/dist/mcp/tools/secret-elicitation-form.js +200 -10
  154. package/dist/mcp/tools/secret-elicitation-server.js +8 -1
  155. package/dist/mcp/tools/secret-elicitation.d.ts +38 -3
  156. package/dist/mcp/tools/secret-elicitation.js +110 -12
  157. package/dist/mcp/tools/secrets.js +184 -7
  158. package/dist/mcp/tools/tools.d.ts +1 -1
  159. package/dist/mcp/tools/tools.js +22 -2
  160. package/dist/native-worker/composition.d.ts +23 -0
  161. package/dist/native-worker/composition.js +77 -0
  162. package/dist/native-worker/docker-isolation.d.ts +65 -0
  163. package/dist/native-worker/docker-isolation.js +183 -0
  164. package/dist/native-worker/docker-launcher.d.ts +74 -0
  165. package/dist/native-worker/docker-launcher.js +237 -0
  166. package/dist/native-worker/gateway-server.d.ts +39 -0
  167. package/dist/native-worker/gateway-server.js +315 -0
  168. package/dist/native-worker/gateway.d.ts +44 -0
  169. package/dist/native-worker/gateway.js +197 -0
  170. package/dist/native-worker/http-server.d.ts +22 -0
  171. package/dist/native-worker/http-server.js +109 -0
  172. package/dist/native-worker/http-transport.d.ts +17 -0
  173. package/dist/native-worker/http-transport.js +88 -0
  174. package/dist/native-worker/kubernetes-isolation.d.ts +90 -0
  175. package/dist/native-worker/kubernetes-isolation.js +218 -0
  176. package/dist/native-worker/kubernetes-launcher.d.ts +102 -0
  177. package/dist/native-worker/kubernetes-launcher.js +335 -0
  178. package/dist/native-worker/launch.d.ts +45 -0
  179. package/dist/native-worker/launch.js +44 -0
  180. package/dist/native-worker/ledger.d.ts +109 -0
  181. package/dist/native-worker/ledger.js +192 -0
  182. package/dist/native-worker/loopback.d.ts +12 -0
  183. package/dist/native-worker/loopback.js +49 -0
  184. package/dist/native-worker/main.d.ts +7 -0
  185. package/dist/native-worker/main.js +74 -0
  186. package/dist/native-worker/protocol.d.ts +744 -0
  187. package/dist/native-worker/protocol.js +200 -0
  188. package/dist/native-worker/sandbox-executor.d.ts +68 -0
  189. package/dist/native-worker/sandbox-executor.js +210 -0
  190. package/dist/native-worker/stdio.d.ts +29 -0
  191. package/dist/native-worker/stdio.js +188 -0
  192. package/dist/native-worker/warm-delivery.d.ts +16 -0
  193. package/dist/native-worker/warm-delivery.js +33 -0
  194. package/dist/native-worker/warm-pool-ledger.d.ts +39 -0
  195. package/dist/native-worker/warm-pool-ledger.js +73 -0
  196. package/dist/native-worker/warm-pool.d.ts +107 -0
  197. package/dist/native-worker/warm-pool.js +283 -0
  198. package/dist/native-worker/worker.d.ts +17 -0
  199. package/dist/native-worker/worker.js +115 -0
  200. package/dist/providers/auth/authorization-server.d.ts +3 -0
  201. package/dist/providers/auth/index.js +2 -0
  202. package/dist/providers/auth/self-hosted.d.ts +13 -1
  203. package/dist/providers/auth/self-hosted.js +54 -4
  204. package/dist/providers/chat/fake.d.ts +46 -0
  205. package/dist/providers/chat/fake.js +39 -0
  206. package/dist/providers/chat/index.d.ts +4 -0
  207. package/dist/providers/chat/index.js +8 -0
  208. package/dist/providers/chat/slack.d.ts +37 -0
  209. package/dist/providers/chat/slack.js +105 -0
  210. package/dist/providers/chat/types.d.ts +42 -0
  211. package/dist/providers/chat/types.js +19 -0
  212. package/dist/providers/coding-proxy/mock-upstream.d.ts +33 -0
  213. package/dist/providers/coding-proxy/mock-upstream.js +116 -0
  214. package/dist/providers/coding-proxy/registry/prisma-store.d.ts +3 -0
  215. package/dist/providers/coding-proxy/registry/prisma-store.js +17 -0
  216. package/dist/providers/coding-proxy/registry/service.d.ts +4 -0
  217. package/dist/providers/coding-proxy/registry/service.js +20 -3
  218. package/dist/providers/coding-proxy/registry/store.d.ts +18 -1
  219. package/dist/providers/coding-proxy/registry/store.js +33 -0
  220. package/dist/providers/coding-proxy/runtime.js +12 -1
  221. package/dist/providers/coding-proxy/types.d.ts +2 -0
  222. package/dist/providers/engine/types.d.ts +19 -0
  223. package/dist/providers/engine/types.js +22 -0
  224. package/dist/providers/executor/composition.d.ts +24 -1
  225. package/dist/providers/executor/composition.js +39 -6
  226. package/dist/providers/executor/container.d.ts +24 -1
  227. package/dist/providers/executor/container.js +101 -11
  228. package/dist/providers/executor/dbos.d.ts +42 -0
  229. package/dist/providers/executor/dbos.js +118 -12
  230. package/dist/providers/executor/deferred.d.ts +56 -0
  231. package/dist/providers/executor/deferred.js +119 -0
  232. package/dist/providers/executor/routing.d.ts +37 -10
  233. package/dist/providers/executor/routing.js +73 -32
  234. package/dist/providers/executor/types.d.ts +12 -0
  235. package/dist/providers/jobs/docker.js +3 -3
  236. package/dist/providers/jobs/fake-kubernetes-api.d.ts +21 -2
  237. package/dist/providers/jobs/fake-kubernetes-api.js +42 -1
  238. package/dist/providers/jobs/kubernetes-api.d.ts +17 -1
  239. package/dist/providers/jobs/kubernetes-api.js +7 -0
  240. package/dist/providers/jobs/kubernetes-client.d.ts +10 -1
  241. package/dist/providers/jobs/kubernetes-client.js +52 -3
  242. package/dist/providers/jobs/kubernetes-dry-run-fixture.d.ts +6 -1
  243. package/dist/providers/jobs/kubernetes-dry-run-fixture.js +6 -3
  244. package/dist/providers/jobs/kubernetes-isolation.d.ts +16 -1
  245. package/dist/providers/jobs/kubernetes-isolation.js +58 -5
  246. package/dist/providers/jobs/kubernetes-platform.d.ts +4 -1
  247. package/dist/providers/jobs/kubernetes-platform.js +38 -1
  248. package/dist/providers/jobs/kubernetes-preflight.d.ts +2 -1
  249. package/dist/providers/jobs/kubernetes-preflight.js +4 -2
  250. package/dist/providers/jobs/kubernetes.d.ts +56 -7
  251. package/dist/providers/jobs/kubernetes.js +117 -36
  252. package/dist/providers/jobs/metadata-probes.d.ts +11 -0
  253. package/dist/providers/jobs/metadata-probes.js +13 -0
  254. package/dist/providers/jobs/types.d.ts +9 -0
  255. package/dist/providers/llm/openai.js +0 -1
  256. package/dist/providers/review-host/github.d.ts +11 -1
  257. package/dist/providers/review-host/github.js +50 -0
  258. package/dist/providers/review-host/types.d.ts +23 -0
  259. package/dist/providers/vcs/github.d.ts +32 -6
  260. package/dist/providers/vcs/github.js +74 -16
  261. package/dist/quickstart/coding-db.js +14 -2
  262. package/dist/quickstart/coding-doctor.d.ts +3 -0
  263. package/dist/quickstart/coding-doctor.js +3 -0
  264. package/dist/quickstart/coding-images.d.ts +9 -0
  265. package/dist/quickstart/coding-images.js +39 -0
  266. package/dist/quickstart/coding-seed.d.ts +20 -1
  267. package/dist/quickstart/coding-seed.js +96 -7
  268. package/dist/quickstart/coding.d.ts +2 -0
  269. package/dist/quickstart/coding.js +75 -3
  270. package/dist/quickstart/config.d.ts +2 -0
  271. package/dist/quickstart/config.js +4 -0
  272. package/dist/quickstart/images.d.ts +13 -0
  273. package/dist/quickstart/images.js +80 -12
  274. package/dist/quickstart/index.d.ts +0 -2
  275. package/dist/quickstart/index.js +10 -14
  276. package/dist/quickstart/manifests.d.ts +56 -0
  277. package/dist/quickstart/manifests.js +523 -0
  278. package/dist/quickstart/python-detect.d.ts +10 -0
  279. package/dist/quickstart/python-detect.js +32 -0
  280. package/dist/quickstart/repo-packages.d.ts +10 -0
  281. package/dist/quickstart/repo-packages.js +132 -0
  282. package/dist/quickstart/reviewer-prompt.d.ts +12 -0
  283. package/dist/quickstart/reviewer-prompt.js +84 -0
  284. package/dist/quickstart/scenarios.d.ts +19 -0
  285. package/dist/quickstart/scenarios.js +28 -0
  286. package/dist/quickstart/sync-reviewer-prompt.d.ts +1 -0
  287. package/dist/quickstart/sync-reviewer-prompt.js +10 -0
  288. package/dist/quickstart-images.json +1 -1
  289. package/dist/sandbox/brokered-fetch.d.ts +23 -0
  290. package/dist/sandbox/brokered-fetch.js +37 -0
  291. package/dist/sandbox/host-functions.d.ts +34 -0
  292. package/dist/sandbox/host-functions.js +144 -80
  293. package/dist/sandbox/prelude.js +7 -1
  294. package/dist/sandbox/run-in-sandbox.d.ts +19 -0
  295. package/dist/sandbox/run-in-sandbox.js +28 -10
  296. package/dist/sandbox/safe-fetch.d.ts +2 -0
  297. package/dist/sandbox/safe-fetch.js +3 -1
  298. package/dist/sandbox/secret-broker-sigv4.d.ts +2 -0
  299. package/dist/sandbox/secret-broker-sigv4.js +49 -0
  300. package/dist/sandbox/secret-broker.d.ts +34 -0
  301. package/dist/sandbox/secret-broker.js +162 -0
  302. package/dist/sandbox/user-tool.d.ts +14 -0
  303. package/dist/sandbox/user-tool.js +32 -0
  304. package/dist/serve.js +18 -0
  305. package/dist/viewer/api-schema.d.ts +214 -18
  306. package/dist/viewer/api-schema.js +22 -0
  307. package/dist/viewer/build-schemas.js +4 -1
  308. package/dist/viewer/event-bus.d.ts +6 -0
  309. package/dist/viewer/event-bus.js +16 -7
  310. package/dist/viewer/graph.d.ts +5 -2
  311. package/dist/viewer/graph.js +7 -2
  312. package/dist/viewer/http.d.ts +0 -1
  313. package/dist/viewer/http.js +2 -2
  314. package/dist/viewer/infra.js +25 -2
  315. package/dist/viewer/limits.d.ts +4 -0
  316. package/dist/viewer/limits.js +4 -0
  317. package/dist/viewer/openapi.d.ts +15 -0
  318. package/dist/viewer/openapi.js +172 -0
  319. package/docs/README.md +7 -0
  320. package/docs/agent-recipes.md +57 -8
  321. package/docs/architecture-runtime.md +16 -1
  322. package/docs/code-review-agents.md +139 -5
  323. package/docs/coding-agent-setup.md +127 -2
  324. package/docs/coding-packages.md +105 -5
  325. package/docs/coding-services.md +3 -1
  326. package/docs/coding-worker-byo-images.md +239 -2
  327. package/docs/coding-worker-isolation.md +88 -23
  328. package/docs/getting-started-gke.md +225 -9
  329. package/docs/getting-started-identity-provider.md +21 -10
  330. package/docs/getting-started.md +140 -11
  331. package/docs/jira-agents.md +5 -1
  332. package/docs/knowledge.md +11 -0
  333. package/docs/native-sandbox.md +635 -0
  334. package/docs/release-verification.md +9 -0
  335. package/docs/security-deployment.md +113 -12
  336. package/docs/slack-notifications.md +252 -0
  337. package/docs/tool-secrets.md +252 -0
  338. package/docs/viewer-api.md +46 -5
  339. package/docs/viewer-api.openapi.yml +1404 -0
  340. package/help/admin-viewer.md +6 -2
  341. package/help/agent-recipes.md +27 -0
  342. package/help/architecture-agent.md +136 -0
  343. package/help/brokered-secrets.md +79 -0
  344. package/help/build-claude-code-image.md +131 -0
  345. package/help/build-worker-image.md +195 -0
  346. package/help/code-review-agents.md +68 -6
  347. package/help/coding-packages.md +31 -2
  348. package/help/creating-agents.md +14 -0
  349. package/help/deploy-gke.md +37 -6
  350. package/help/deployment-targets.md +24 -13
  351. package/help/errors/coding-provider-not-configured.md +2 -2
  352. package/help/errors/database-auth-invalid.md +28 -0
  353. package/help/errors/github-account-not-allowed.md +25 -0
  354. package/help/errors/low-power-disabled.md +29 -0
  355. package/help/errors/low-power-scale-forbidden.md +35 -0
  356. package/help/errors/low-power-wake-timeout.md +30 -0
  357. package/help/errors/mobile-disabled.md +31 -0
  358. package/help/errors/native-sandbox-capacity.md +22 -0
  359. package/help/errors/native-sandbox-deadline-exceeded.md +19 -0
  360. package/help/errors/native-sandbox-docker-failed.md +20 -0
  361. package/help/errors/native-sandbox-gateway-unavailable.md +21 -0
  362. package/help/errors/native-sandbox-image-not-pinned.md +19 -0
  363. package/help/errors/native-sandbox-isolation-mismatch.md +20 -0
  364. package/help/errors/native-sandbox-network-unenforced.md +22 -0
  365. package/help/errors/native-sandbox-requires-catalog.md +31 -0
  366. package/help/errors/native-sandbox-unavailable.md +19 -0
  367. package/help/errors/native-sandbox-warm-delivery-failed.md +21 -0
  368. package/help/errors/native-sandbox-worker-exited.md +20 -0
  369. package/help/errors/native-sandbox-worker-lost.md +20 -0
  370. package/help/errors/native-sandbox-worker-unready.md +22 -0
  371. package/help/errors/secret-broker-body-invalid.md +26 -0
  372. package/help/errors/secret-broker-changed.md +20 -0
  373. package/help/errors/secret-broker-config-invalid.md +30 -0
  374. package/help/errors/secret-broker-conflict.md +27 -0
  375. package/help/errors/secret-broker-destination-denied.md +28 -0
  376. package/help/errors/secret-broker-value-invalid.md +28 -0
  377. package/help/errors/secret-brokered.md +24 -0
  378. package/help/errors/secret-not-brokered.md +25 -0
  379. package/help/errors/slack-auth-failed.md +48 -0
  380. package/help/errors/slack-channel-unreachable.md +39 -0
  381. package/help/errors/slack-not-configured.md +33 -0
  382. package/help/getting-started.md +18 -0
  383. package/help/github.md +18 -1
  384. package/help/identity-and-access.md +5 -1
  385. package/help/local-repositories.md +35 -5
  386. package/help/low-power-mode.md +125 -0
  387. package/help/merge-order-check.md +117 -0
  388. package/help/mobile-app.md +54 -0
  389. package/help/native-sandbox.md +136 -0
  390. package/help/observability.md +8 -0
  391. package/help/related-pull-requests.md +70 -9
  392. package/help/repo-instructions-and-skills.md +91 -0
  393. package/help/review-fix-rounds.md +10 -0
  394. package/help/slack-notifications.md +62 -0
  395. package/help/troubleshooting/coding-workers.md +21 -0
  396. package/package.json +13 -5
  397. package/prisma/migrations/20261009000003_native_execution_mode/migration.sql +12 -0
  398. package/prisma/migrations/20261009000004_native_gateway_ledger/migration.sql +65 -0
  399. package/prisma/migrations/20261009000005_native_gateway_call_child_agent/migration.sql +5 -0
  400. package/prisma/migrations/20261009000006_run_deferred_start_stop/migration.sql +14 -0
  401. package/prisma/migrations/20261009000007_native_gateway_network_ready/migration.sql +5 -0
  402. package/prisma/migrations/20261010000001_workflow_notifications/migration.sql +99 -0
  403. package/prisma/migrations/20261011000001_native_gateway_session_status_index/migration.sql +2 -0
  404. package/prisma/migrations/20261012000001_native_warm_worker/migration.sql +32 -0
  405. package/prisma/migrations/20261013000001_coding_run_merge_order/migration.sql +2 -0
  406. package/prisma/migrations/20261013000001_secret_broker/migration.sql +17 -0
  407. package/prisma/migrations/20261013000002_deferred_review_request/migration.sql +4 -0
  408. package/prisma/migrations/20261014000000_repo_skills/migration.sql +15 -0
  409. package/prisma/migrations/20261015000001_coding_run_merge_order_index/migration.sql +2 -0
  410. package/prisma/migrations/20261015000002_no_change_rereview/migration.sql +2 -0
  411. package/prisma/schema.prisma +362 -91
@@ -16,20 +16,116 @@
16
16
  * down) lives inside the engine now — there is exactly one place that
17
17
  * reasons about cost, not one here plus one in the engine.
18
18
  */
19
- import type { PrismaClient, Run, RunTrigger } from "#prisma";
19
+ import { z } from "zod";
20
+ import type { Prisma, PrismaClient, Run, RunTrigger } from "#prisma";
20
21
  import type { ProviderRegistry } from "../providers/index.js";
21
- import { type StepRunner } from "../providers/engine/types.js";
22
+ import type { EngineProgress, EngineResult, LoadedTool } from "../providers/engine/types.js";
23
+ import { RunOwnershipLostError, type StepRunner } from "../providers/engine/types.js";
24
+ import { type PrivilegedHost } from "../sandbox/host-functions.js";
25
+ import type { safeFetch } from "../sandbox/safe-fetch.js";
26
+ import { type RunDrivability, type WorkerLauncher } from "../native-worker/gateway.js";
27
+ import { type WorkerInput } from "../native-worker/protocol.js";
28
+ import type { PrismaGatewayLedger } from "../native-worker/ledger.js";
22
29
  import type { Executor } from "../providers/executor/types.js";
23
30
  import type { ReviewHostRegistry } from "../providers/review-host/types.js";
24
31
  import type { IssueTrackerRegistry } from "../providers/issue-tracker/types.js";
32
+ import { type RepositoryLink } from "./review-host-tools.js";
33
+ import { type IssueProjectLink } from "./issue-tracker-tools.js";
25
34
  import { type RepoAccessGate } from "./repo-access.js";
35
+ declare const DelegateArgs: z.ZodObject<{
36
+ task: z.ZodString;
37
+ datastoreRef: z.ZodOptional<z.ZodObject<{
38
+ name: z.ZodString;
39
+ key: z.ZodString;
40
+ }, "strict", z.ZodTypeAny, {
41
+ name: string;
42
+ key: string;
43
+ }, {
44
+ name: string;
45
+ key: string;
46
+ }>>;
47
+ grantParentMemoryKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
48
+ continuePriorRun: z.ZodOptional<z.ZodString>;
49
+ mergeOrder: z.ZodOptional<z.ZodNumber>;
50
+ }, "strict", z.ZodTypeAny, {
51
+ task: string;
52
+ mergeOrder?: number | undefined;
53
+ datastoreRef?: {
54
+ name: string;
55
+ key: string;
56
+ } | undefined;
57
+ grantParentMemoryKeys?: string[] | undefined;
58
+ continuePriorRun?: string | undefined;
59
+ }, {
60
+ task: string;
61
+ mergeOrder?: number | undefined;
62
+ datastoreRef?: {
63
+ name: string;
64
+ key: string;
65
+ } | undefined;
66
+ grantParentMemoryKeys?: string[] | undefined;
67
+ continuePriorRun?: string | undefined;
68
+ }>;
69
+ /** A delegate_to_* call's arguments, or the tool result refusing them. */
70
+ export declare function parseDelegateArgs(argsJson: string): {
71
+ args: z.infer<typeof DelegateArgs>;
72
+ } | {
73
+ refusal: string;
74
+ };
75
+ /**
76
+ * At most `limit` dispatches per run (default one: a classifier deciding plan-vs-implement
77
+ * commits to exactly one child), and never the same child twice, so a retry can't leave two
78
+ * children racing on the same task. A delegation waiting for budget holds its place.
79
+ */
80
+ export declare function delegationLimitRefusal(input: {
81
+ priorChildAgentIds: readonly string[];
82
+ waitingChildAgentIds: readonly string[];
83
+ childAgentId: string;
84
+ boundName: string;
85
+ limit: number;
86
+ }): string | null;
87
+ declare const DELEGATION_CHILD_SELECT: {
88
+ readonly id: true;
89
+ readonly kind: true;
90
+ readonly budgetGroupId: true;
91
+ readonly budgetUsd: true;
92
+ readonly ownerId: true;
93
+ readonly nativeExecutionMode: true;
94
+ readonly codingProfile: {
95
+ readonly select: {
96
+ readonly allowWebhookTaskOverride: true;
97
+ readonly timeoutSec: true;
98
+ };
99
+ };
100
+ };
101
+ /** The child agent fields a delegation decides on. */
102
+ export type DelegationChildAgent = Prisma.AgentGetPayload<{
103
+ select: typeof DELEGATION_CHILD_SELECT;
104
+ }>;
105
+ /**
106
+ * The live authorization of one delegation, and the child agent as it is now. Owners are re-read
107
+ * on every delegation (resource-sharing grants spec §3.4.4, N1): the child must have the parent's
108
+ * current owner, or that owner must still hold execute on the child. A revoked grant or a
109
+ * make_owner transfer stops the very next call.
110
+ */
111
+ export declare function authorizeDelegation(db: RunnerDb, parentAgentId: string, edge: {
112
+ childAgentId: string;
113
+ }, boundName: string, args: z.infer<typeof DelegateArgs>): Promise<{
114
+ refusal: string;
115
+ } | {
116
+ childAgent: DelegationChildAgent;
117
+ }>;
118
+ /** A native child's task text: the delegated task, with any datastore reference as a note. */
119
+ export declare function delegationTaskOverride(args: z.infer<typeof DelegateArgs>): string | undefined;
120
+ /** The tool result a native child's terminal run reports to its parent. `note` surfaces e.g. an ignored mergeOrder. */
121
+ export declare function nativeChildResult(run: Pick<Run, "status" | "finalText" | "costUsd" | "tokensIn" | "tokensOut" | "error">, note?: string): string;
26
122
  /**
27
123
  * The subset of the Prisma client the runner touches — mockable in tests.
28
124
  * Includes `codingRun`/`task`/`webhook`/`$transaction`/`$queryRaw` so this
29
125
  * also satisfies `dispatch.ts`'s `DispatchDb`, needed for dispatching a
30
126
  * coding-kind sub-agent from inside a running native turn loop.
31
127
  */
32
- export type RunnerDb = Pick<PrismaClient, "agent" | "run" | "agentTool" | "agentSecret" | "agentDatastore" | "budgetGroup" | "agentSubAgent" | "resourceGrant" | "codingRun" | "task" | "webhook" | "$transaction" | "$queryRaw" | "agentRepository" | "runModelUsage" | "runHostCheck" | "runHostStatus" | "hostIdentity" | "agentIssueProject" | "issuePullRequest" | "runIssueStatus" | "issueFingerprint" | "workItem">;
128
+ export type RunnerDb = Pick<PrismaClient, "agent" | "run" | "agentTool" | "agentSecret" | "agentDatastore" | "budgetGroup" | "agentSubAgent" | "resourceGrant" | "codingRun" | "task" | "webhook" | "$transaction" | "$queryRaw" | "agentRepository" | "runModelUsage" | "runHostCheck" | "runHostStatus" | "hostIdentity" | "agentIssueProject" | "issuePullRequest" | "runIssueStatus" | "issueFingerprint" | "workItem" | "deferredReview" | "runAttribution">;
33
129
  /** The providers a native run needs; `executor`, `reviewHosts` and `issueTrackers` are optional capabilities. */
34
130
  export type NativeRunProviders = Pick<ProviderRegistry, "llm" | "engine" | "datastore" | "secrets" | "memory"> & {
35
131
  executor?: ProviderRegistry["executor"];
@@ -38,6 +134,13 @@ export type NativeRunProviders = Pick<ProviderRegistry, "llm" | "engine" | "data
38
134
  issueTrackers?: IssueTrackerRegistry;
39
135
  /** Repository authorization for repo_* calls; built from reviewHosts when absent. */
40
136
  repoAccess?: RepoAccessGate;
137
+ /**
138
+ * Runs sandbox-mode native runs: the engine runs in a worker this launcher starts, served by the
139
+ * native gateway (src/native-worker). Absent: a run whose snapshot says sandbox fails closed.
140
+ */
141
+ nativeSandbox?: WorkerLauncher;
142
+ /** Overrides the sandbox's outbound network call — tests only. */
143
+ sandboxFetch?: typeof safeFetch;
41
144
  };
42
145
  /**
43
146
  * Raised when a run's step boundary observed a cancellation (DbosExecutor's
@@ -47,12 +150,28 @@ export type NativeRunProviders = Pick<ProviderRegistry, "llm" | "engine" | "data
47
150
  export declare class RunCancelledError extends Error {
48
151
  constructor(message: string);
49
152
  }
153
+ /** Re-exported beside RunCancelledError: thrown by a step runner when another attempt owns the run. */
154
+ export { RunOwnershipLostError };
155
+ /**
156
+ * Why a sandbox-mode native run is not executed here. The runner only ever
157
+ * executes native runs in the control plane; a run whose snapshot says
158
+ * `sandbox` reaches it only when no native sandbox executor is composed in
159
+ * (RoutingExecutor sends it to the native executor), and must fail closed
160
+ * rather than run unisolated.
161
+ */
162
+ export declare const NATIVE_SANDBOX_NOT_CONFIGURED: string;
50
163
  /**
51
164
  * Slack past the child's own queue wait + container deadline before the
52
165
  * parent gives up: the executor needs a moment after a deadline kill to
53
166
  * write the terminal row, and the queue timeout only fires on a drain tick.
54
167
  */
55
168
  export declare const CODING_CHILD_WAIT_GRACE_SEC = 60;
169
+ /**
170
+ * How long a parent waits for a sandbox-mode native child before stopping it. Native runs have
171
+ * no run timeout of their own; until the sandbox executor brings a per-run deadline, this bounds
172
+ * a parent left waiting on a child that never finishes.
173
+ */
174
+ export declare const SANDBOX_CHILD_WAIT_SEC: number;
56
175
  export type CodingChildWaitOutcome = {
57
176
  kind: "terminal";
58
177
  run: Run;
@@ -102,6 +221,220 @@ export declare function codingChildResult(run: {
102
221
  export declare function waitForCodingChild(options: WaitForCodingChildOptions): Promise<CodingChildWaitOutcome>;
103
222
  /** Persists a new pending Run for the named agent. Throws if the agent is unknown. */
104
223
  export declare function createRun(db: RunnerDb, agentName: string, trigger?: RunTrigger): Promise<Run>;
224
+ export interface LoadNativeRunOptions {
225
+ runId: string;
226
+ existingRun: Run;
227
+ providers: NativeRunProviders;
228
+ db: RunnerDb;
229
+ step: StepRunner;
230
+ reviewHosts: ReviewHostRegistry | undefined;
231
+ issueTrackers: IssueTrackerRegistry | undefined;
232
+ }
233
+ /**
234
+ * The trusted load of a native run: the agent, its attached tools and their
235
+ * consented capabilities, the pinned catalog entry, the effective budget,
236
+ * sub-agent edges, and repository/issue links. Shared by in-process execution
237
+ * and the native sandbox gateway, which hands the worker this result.
238
+ *
239
+ * Pinned in one checkpointed step: on replay after a crash, the agent row
240
+ * or its budget group may have changed since first execution. The
241
+ * engine's control flow depends on budgetUsd and maxTurns, so they must
242
+ * be pinned to the values seen on first execution or the replay's step
243
+ * order diverges from the record.
244
+ */
245
+ export declare function loadNativeRun(options: LoadNativeRunOptions): Promise<{
246
+ repositoryLinks: RepositoryLink[];
247
+ issueProjectLinks: IssueProjectLink[];
248
+ agent: {
249
+ untrustedContext?: string | undefined;
250
+ effort?: "low" | "medium" | "high" | "xhigh" | "max" | undefined;
251
+ systemPrompt: string;
252
+ model: string;
253
+ budgetUsd: number;
254
+ maxTurns: number;
255
+ };
256
+ tools: LoadedTool[];
257
+ toolsByName: {
258
+ [k: string]: {
259
+ code: string;
260
+ paramsZod: string;
261
+ allowedSecrets: string[];
262
+ allowedDatastorePrefixes: string[];
263
+ allowedHosts: string[];
264
+ allowedSharedDatastorePrefixes: Record<string, string[]>;
265
+ };
266
+ };
267
+ parallelDelegations?: boolean | undefined;
268
+ maxDelegationsPerRun?: number | undefined;
269
+ agentId: string;
270
+ kind: import("#prisma").AgentKind;
271
+ pricing: import("./run-pricing.js").PinnedPricing | undefined;
272
+ memoryEnabled: boolean;
273
+ subAgentEdges: {
274
+ boundName: string;
275
+ childAgentId: string;
276
+ }[];
277
+ } | {
278
+ readonly unavailable: string;
279
+ }>;
280
+ /** A loaded native run (loadNativeRun without its model-unavailable outcome). */
281
+ export type LoadedNativeRun = Exclude<Awaited<ReturnType<typeof loadNativeRun>>, {
282
+ unavailable: string;
283
+ }>;
284
+ export interface NativeRunToolsOptions {
285
+ runId: string;
286
+ existingRun: Run;
287
+ loaded: LoadedNativeRun;
288
+ providers: NativeRunProviders;
289
+ db: RunnerDb;
290
+ reviewHosts: ReviewHostRegistry | undefined;
291
+ repoAccess: RepoAccessGate | undefined;
292
+ issueTrackers: IssueTrackerRegistry | undefined;
293
+ }
294
+ /** An attached user tool as the load step pinned it: its code, schema, and consented capabilities. */
295
+ export type LoadedUserTool = LoadedNativeRun["toolsByName"][string];
296
+ /** A built-in tool's handler for one call; built-ins run on the trusted side, never in a sandbox. */
297
+ export type BuiltinToolHandler = (argsJson: string) => Promise<string>;
298
+ /**
299
+ * One attempt's tool surface for a native run. `builtinHandler(name)` is the
300
+ * single source of truth for which names are trusted built-ins (memory,
301
+ * repo_*, jira_*, sub-agent/parent memory, delegate_to_*) and returns undefined
302
+ * for everything else, which `runUserTool` runs in the WASM sandbox. Per-attempt
303
+ * state (the delegation gate, siblings, issue creation counters) lives here.
304
+ */
305
+ export declare function createNativeRunTools(options: NativeRunToolsOptions): {
306
+ toolsByName: Map<string, {
307
+ code: string;
308
+ paramsZod: string;
309
+ allowedSecrets: string[];
310
+ allowedDatastorePrefixes: string[];
311
+ allowedHosts: string[];
312
+ allowedSharedDatastorePrefixes: Record<string, string[]>;
313
+ }>;
314
+ builtinHandler: (name: string) => BuiltinToolHandler | undefined;
315
+ privilegedHostFor: (name: string, signal: AbortSignal, redactSecretValues?: readonly string[]) => PrivilegedHost | undefined;
316
+ readableSecretValues: (name: string) => Promise<string[]>;
317
+ runUserTool: (name: string, argsJson: string) => Promise<string>;
318
+ runSandboxTool: (name: string, argsJson: string) => Promise<string>;
319
+ };
320
+ /**
321
+ * Live progress for observers (MCP get_run, the viewer). Absolute totals, so a DBOS replay
322
+ * re-writing them is harmless. Written into the run's own cost columns on purpose: the run
323
+ * tree's shared budget (computeRunTreeSpend) then counts a running parent's spend so far, as it
324
+ * already does for coding runs, whose proxy ledger writes their totals live. Best-effort: a
325
+ * failed write only delays what observers see, and finishRun writes the final totals anyway.
326
+ */
327
+ export declare function recordNativeRunProgress(db: RunnerDb, runId: string, progress: EngineProgress): Promise<void>;
328
+ /** What finishing a native run needs: the run, and the integrations its trigger may have opened. */
329
+ export interface NativeRunFinishContext {
330
+ runId: string;
331
+ db: RunnerDb;
332
+ providers: NativeRunProviders;
333
+ reviewHosts: ReviewHostRegistry | undefined;
334
+ repoAccess: RepoAccessGate | undefined;
335
+ issueTrackers: IssueTrackerRegistry | undefined;
336
+ }
337
+ /** The terminal write for an engine result, then its usage, host/issue status, and follow-ups. */
338
+ export declare function finishNativeRun(ctx: NativeRunFinishContext, model: string, result: EngineResult): Promise<Run>;
339
+ /** The backstop terminal write for a run that threw. A cancellation is not a failure: it carries the operator's own reason. */
340
+ export declare function failNativeRun(ctx: NativeRunFinishContext, err: unknown): Promise<Run>;
341
+ /** Where a run stands for the native gateway: still drivable, cancelled (its task), or otherwise ended. */
342
+ export declare function runDrivability(db: RunnerDb, runId: string): Promise<RunDrivability>;
343
+ /**
344
+ * What a sandbox worker is given: the pinned agent and tool definitions, which names are built-ins
345
+ * (served by the gateway), and each user tool's code and schema only — never its capabilities,
346
+ * secret names, or values, which stay with the gateway's privileged host.
347
+ */
348
+ export declare function sandboxWorkerInput(runId: string, loaded: LoadedNativeRun, tools: Pick<ReturnType<typeof createNativeRunTools>, "builtinHandler" | "toolsByName">): WorkerInput;
349
+ /** What the durable delegation needs from the gateway ledger (src/native-worker/ledger.ts). */
350
+ export type DelegationLedger = Pick<PrismaGatewayLedger, "claim" | "recordResult" | "setDelegation" | "delegation" | "waitingChildAgentIds">;
351
+ export interface DurableDelegationContext {
352
+ runId: string;
353
+ existingRun: Run;
354
+ loaded: LoadedNativeRun;
355
+ providers: NativeRunProviders;
356
+ db: RunnerDb;
357
+ issueTrackers: IssueTrackerRegistry | undefined;
358
+ ledger: DelegationLedger;
359
+ sessionId: string;
360
+ /** How long one call waits on the child before answering `pending` (the worker calls again). */
361
+ pollWindowMs?: number;
362
+ pollIntervalMs?: number;
363
+ now?: () => number;
364
+ sleep?: (ms: number) => Promise<void>;
365
+ }
366
+ export type DurableDelegationOutcome = {
367
+ result: string;
368
+ } | {
369
+ pending: true;
370
+ };
371
+ /** Long-poll window: well under common proxy and load-balancer idle timeouts. */
372
+ export declare const DELEGATION_POLL_WINDOW_MS = 20000;
373
+ /**
374
+ * A delegate_to_* call from a sandboxed run, served by the native gateway. The in-process branch
375
+ * holds its admission, budget wait, and child wait in one process's memory for the child's whole
376
+ * life; this one keeps them on the call's ledger row, so the worker can call again with the same
377
+ * callId — on any control-plane replica, before or after a restart — and continue where it was:
378
+ *
379
+ * - every child, native or coding, is a managed run dispatched through dispatchRun and the
380
+ * Executor (never inline: an inline child dies with the replica, and the reconciler does not
381
+ * reap unmanaged runs);
382
+ * - admission re-checks the per-run delegation limit under a run-scoped advisory lock inside the
383
+ * child's own transaction, so parallel delegations on different replicas cannot exceed it;
384
+ * - a delegation the budget would refuse while sibling children still run is recorded as waiting
385
+ * and re-evaluated on each call (parallelDelegations), up to the same bound as in process;
386
+ * - each call waits on the child row up to `pollWindowMs`, then answers `pending`.
387
+ *
388
+ * Every refusal and result uses the same helpers, and so the same messages, as in process.
389
+ */
390
+ export declare function durableDelegate(ctx: DurableDelegationContext, callId: string, name: string, argsJson: string): Promise<DurableDelegationOutcome>;
391
+ /** The integrations a native run uses, as executeRun derives them from its providers. */
392
+ export declare function nativeRunIntegrations(providers: NativeRunProviders, db: RunnerDb): {
393
+ reviewHosts: Partial<Record<import("../providers/review-host/types.js").ReviewHostProvider, import("../providers/review-host/types.js").CodeReviewHost>> | undefined;
394
+ repoAccess: RepoAccessGate | undefined;
395
+ issueTrackers: Partial<Record<"jira", import("../providers/issue-tracker/types.js").IssueTracker>> | undefined;
396
+ };
397
+ /** How long a sandbox run's gateway session (and so its capability) stays valid. */
398
+ export declare const SANDBOX_RUN_MAX_SEC: number;
399
+ /** What a sandbox session pins: the worker's input (without its capability) and the trusted load. */
400
+ export interface SandboxSessionSnapshot {
401
+ input: WorkerInput;
402
+ loaded: LoadedNativeRun;
403
+ }
404
+ export type SandboxSessionOutcome = {
405
+ kind: "started";
406
+ input: WorkerInput;
407
+ capability: string;
408
+ sessionId: string;
409
+ }
410
+ /** The run ended before a worker was needed (already terminal, or failed at load). */
411
+ | {
412
+ kind: "ended";
413
+ run: Run;
414
+ };
415
+ /**
416
+ * Starts a sandbox-mode run's trusted half: loads and pins the run, marks it running, records its
417
+ * gateway session (capability hash, deadline, budget, snapshot), and records `native-sandbox` as
418
+ * its execution backend — all before any worker exists. The caller launches the worker with the
419
+ * returned input, which carries the gateway URL and the one-time capability.
420
+ */
421
+ export declare function createSandboxSession(options: {
422
+ runId: string;
423
+ providers: NativeRunProviders;
424
+ db: RunnerDb;
425
+ ledger: Pick<PrismaGatewayLedger, "createSession">;
426
+ gatewayUrl: string;
427
+ now?: Date;
428
+ /**
429
+ * Whether the worker's network isolation exists before the worker does (Docker's internal
430
+ * network). False (Kubernetes): the gateway refuses calls until the launcher proves it.
431
+ */
432
+ networkReady?: boolean;
433
+ }): Promise<SandboxSessionOutcome>;
434
+ /** Run.executionBackend for a sandbox-mode run whose worker is (or was) launched. */
435
+ export declare const NATIVE_SANDBOX_BACKEND = "native-sandbox";
436
+ /** The stored form of a sandbox capability: never the token itself. */
437
+ export declare function sandboxCapabilityHash(capability: string): string;
105
438
  /** Drives an existing Run (created by `createRun` or the scheduler) to a terminal state. */
106
439
  export declare function executeRun(runId: string, providers: NativeRunProviders, db?: RunnerDb, onText?: (delta: string) => void, step?: StepRunner): Promise<Run>;
107
440
  /**