@moretea-labs/forge 1.5.1 → 1.7.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 (434) hide show
  1. package/AGENTS.md +2 -0
  2. package/CHANGELOG.md +46 -0
  3. package/CLAUDE.md +2 -0
  4. package/DESIGN.md +7 -2
  5. package/README.md +4 -4
  6. package/README.zh-CN.md +2 -2
  7. package/SKILL.md +2 -2
  8. package/THIRD_PARTY_NOTICES.md +1 -1
  9. package/agents/openai.yaml +1 -1
  10. package/assets/hooks/hook-input.sh +11 -8
  11. package/assets/hooks/lib/session-state.sh +10 -7
  12. package/assets/hooks/lib/workflow-state.sh +13 -177
  13. package/assets/hooks/post-tool-observer.sh +8 -2
  14. package/assets/hooks/pre-edit-guard.sh +8 -39
  15. package/assets/hooks/prompt-guard.sh +7 -83
  16. package/assets/hooks/session-start-context.sh +56 -1
  17. package/assets/partials/05-workflow.partial.md +1 -1
  18. package/assets/partials-agents/03-orchestration.partial.md +1 -1
  19. package/assets/plugin-registry.v1.json +54 -3
  20. package/assets/reference-configs/document-generation.md +1 -1
  21. package/assets/reference-configs/harness-overview.md +1 -1
  22. package/assets/reference-configs/hook-operations.md +1 -1
  23. package/assets/reference-configs/sprint-contracts.md +3 -3
  24. package/assets/skill-version.json +2 -2
  25. package/assets/templates/contract.template.md +2 -7
  26. package/assets/templates/helpers/capture-plan.sh +2 -2
  27. package/assets/templates/helpers/check-task-workflow.sh +4 -4
  28. package/assets/templates/helpers/contract-worktree.sh +1 -21
  29. package/assets/templates/helpers/ensure-task-workflow.sh +13 -38
  30. package/assets/templates/helpers/migrate-project-template.sh +22 -45
  31. package/assets/templates/helpers/new-plan.sh +1 -1
  32. package/assets/templates/helpers/plan-to-todo.sh +12 -37
  33. package/assets/templates/helpers/ship-worktrees.sh +2 -29
  34. package/assets/templates/helpers/sprint-backlog.sh +6 -6
  35. package/assets/templates/helpers/verify-contract.sh +1 -111
  36. package/assets/templates/helpers/verify-sprint.sh +3 -180
  37. package/assets/templates/plan.template.md +1 -1
  38. package/assets/templates/review.template.md +9 -34
  39. package/assets/workflow-contract.v1.json +10 -19
  40. package/docs/README.md +10 -10
  41. package/docs/architecture/CURRENT.md +170 -0
  42. package/docs/architecture/EVOLUTION.md +42 -0
  43. package/docs/architecture/current/README.md +4 -156
  44. package/docs/architecture/decisions/20260803-release-identity-binding-and-exit-policy.md +2 -2
  45. package/docs/architecture/decisions/20260823-immediate-controller-relay.md +53 -0
  46. package/docs/architecture/decisions/20260826-browser-runtime-v2.md +73 -0
  47. package/docs/architecture/history/README.md +7 -0
  48. package/docs/architecture/{chatgpt-handoff-facade.md → history/chatgpt-handoff-facade.md} +4 -0
  49. package/docs/architecture/{global-hook-runtime.md → history/global-hook-runtime.md} +7 -3
  50. package/docs/architecture/{ios-semantic-automation-provider-v2.md → history/ios-semantic-automation-provider-v2.md} +6 -2
  51. package/docs/architecture/history.md +3 -34
  52. package/docs/architecture/index.md +15 -98
  53. package/docs/architecture/modules/controller-runtime/transport-lifecycle.md +1 -1
  54. package/docs/architecture/reviews/2026-08-22-semantic-harness-convergence-acceptance.md +39 -0
  55. package/docs/architecture/versions/1.6.md +38 -0
  56. package/docs/architecture/versions/1.7.md +41 -0
  57. package/docs/forge-chatgpt-browser-engine.md +2 -2
  58. package/docs/forge-chatgpt-mcp-setup.md +4 -28
  59. package/docs/forge-chatgpt-supervised-automation.md +3 -3
  60. package/docs/forge-github-issue-launcher.md +1 -1
  61. package/docs/forge-runtime-self-healing-loop.md +1 -1
  62. package/docs/operations/controller-browser-plugin.md +38 -22
  63. package/docs/operations/controller-performance-and-502.md +124 -0
  64. package/docs/operations/controller-reliability-runbook.md +1 -1
  65. package/docs/operations/features.md +3 -3
  66. package/docs/operations/github-repository.md +1 -1
  67. package/docs/operations/homebrew.md +2 -2
  68. package/docs/operations/mcp-tool-exposure.md +5 -3
  69. package/docs/tutorials/01-install-and-start.md +1 -1
  70. package/docs/tutorials/01-install-and-start.zh-CN.md +1 -1
  71. package/docs/wiki/Architecture.md +6 -6
  72. package/docs/wiki/Implementation.md +2 -2
  73. package/docs/wiki/Installation.md +1 -1
  74. package/docs/wiki/Integrations.md +2 -2
  75. package/docs/wiki/Quick-Start.md +1 -1
  76. package/docs/wiki/Work-Lifecycle.md +1 -1
  77. package/package.json +29 -10
  78. package/scripts/activate-source-baseline.ts +17 -13
  79. package/scripts/benchmark-background-check-overlap.ts +228 -0
  80. package/scripts/benchmark-mcp-host.sh +117 -0
  81. package/scripts/benchmark-mcp-transport.ts +170 -0
  82. package/scripts/benchmark-quality-harness.ts +146 -0
  83. package/scripts/benchmark-route-session-concurrency.ts +207 -6
  84. package/scripts/benchmark-thin-harness-mcp-e2e.ts +7 -1
  85. package/scripts/benchmark-typescript-navigation.ts +186 -0
  86. package/scripts/benchmark-work-efficiency.ts +334 -0
  87. package/scripts/capture-plan.sh +3 -3
  88. package/scripts/check-agent-tooling.sh +8 -35
  89. package/scripts/check-architecture-sync.sh +17 -86
  90. package/scripts/check-mcp-compatibility.ts +14 -0
  91. package/scripts/check-public-docs.sh +14 -1
  92. package/scripts/check-runtime-architecture.mjs +107 -64
  93. package/scripts/check-stable-baseline.ts +92 -0
  94. package/scripts/check-task-workflow.sh +4 -4
  95. package/scripts/contract-worktree.sh +1 -21
  96. package/scripts/ensure-task-workflow.sh +22 -55
  97. package/scripts/host-temporary-cloud-mcp-e2e.sh +265 -0
  98. package/scripts/install-standalone-recovery.ts +24 -0
  99. package/scripts/lib/project-init-lib.sh +15 -44
  100. package/scripts/migrate-chatgpt-automation-schedules.ts +64 -0
  101. package/scripts/migrate-project-template.sh +23 -1179
  102. package/scripts/new-plan.sh +1 -1
  103. package/scripts/plan-to-todo.sh +11 -36
  104. package/scripts/run-governed-gate.ts +2 -1
  105. package/scripts/ship-worktrees.sh +2 -29
  106. package/scripts/smoke-ios-physical-device.ts +4 -2
  107. package/scripts/smoke-runtime-recovery.ts +1 -35
  108. package/scripts/smoke-schedule-engine.ts +1 -20
  109. package/scripts/sprint-backlog.sh +1 -1
  110. package/scripts/verify-contract.sh +1 -111
  111. package/scripts/verify-forge-runtime.sh +0 -1
  112. package/scripts/verify-sprint.sh +3 -180
  113. package/scripts/workflow-contract.ts +1 -5
  114. package/src/cli/commands/chatgpt.ts +31 -2
  115. package/src/cli/commands/init-hook.ts +3 -3
  116. package/src/cli/commands/mcp.ts +9 -5
  117. package/src/cli/commands/plugin.ts +37 -10
  118. package/src/cli/commands/recovery.ts +25 -3
  119. package/src/cli/commands/runtime.ts +55 -3
  120. package/src/cli/commands/security.ts +12 -1
  121. package/src/cli/commands/setup-profile.ts +31 -21
  122. package/src/cli/controller/check-runner.ts +106 -3
  123. package/src/cli/controller/composite-result.ts +1 -1
  124. package/src/cli/controller/context/focus.ts +51 -0
  125. package/src/cli/controller/context/instruction-context.ts +114 -0
  126. package/src/cli/controller/context/known-paths.ts +76 -0
  127. package/src/cli/controller/context/query-planning.ts +110 -0
  128. package/src/cli/controller/context/rule-resolution.ts +532 -0
  129. package/src/cli/controller/context/source-materializer.ts +278 -0
  130. package/src/cli/controller/context/structural.ts +16 -0
  131. package/src/cli/controller/context/types.ts +286 -0
  132. package/src/cli/controller/context-pack.ts +898 -430
  133. package/src/cli/controller/launch-agents.ts +77 -2
  134. package/src/cli/controller/operational-plan.ts +2 -2
  135. package/src/cli/controller/work-mode.ts +6 -4
  136. package/src/cli/editing/edit-session.ts +60 -7
  137. package/src/cli/github/github.ts +133 -0
  138. package/src/cli/hook/prompt-guard-decision.ts +17 -18
  139. package/src/cli/hook/prompt-intents.ts +1 -1
  140. package/src/cli/installer/managed-entries.ts +15 -1
  141. package/src/cli/local-bridge/console-automations.ts +225 -67
  142. package/src/cli/local-bridge/console-view-models.ts +3 -35
  143. package/src/cli/local-bridge/facade-api.ts +2 -217
  144. package/src/cli/local-bridge/frontend/src/App.tsx +3 -3
  145. package/src/cli/local-bridge/frontend/src/features/automations/AutomationsView.tsx +153 -3
  146. package/src/cli/local-bridge/frontend/src/features/capabilities/CapabilitiesView.tsx +37 -4
  147. package/src/cli/local-bridge/frontend/src/features/overview/OverviewView.tsx +183 -3
  148. package/src/cli/local-bridge/frontend/src/features/repositories/RepositoriesView.tsx +1 -1
  149. package/src/cli/local-bridge/frontend/src/features/work/WorkView.tsx +4 -3
  150. package/src/cli/local-bridge/frontend/src/lib/api.ts +18 -11
  151. package/src/cli/local-bridge/frontend/src/lib/routes.ts +1 -1
  152. package/src/cli/local-bridge/frontend/src/shell/CommandBar.tsx +1 -1
  153. package/src/cli/local-bridge/frontend/src/shell/Sidebar.tsx +4 -3
  154. package/src/cli/local-bridge/frontend/src/styles.css +27 -11
  155. package/src/cli/local-bridge/frontend/src/types.ts +8 -7
  156. package/src/cli/local-bridge/job-store.ts +1 -490
  157. package/src/cli/local-bridge/server.ts +29 -532
  158. package/src/cli/local-bridge/ui-dist/app.css +1 -1
  159. package/src/cli/local-bridge/ui-dist/app.js +5101 -4967
  160. package/src/cli/mcp/auth.ts +5 -5
  161. package/src/cli/mcp/instructions.ts +3 -2
  162. package/src/cli/mcp/legacy-tool-service.ts +0 -189
  163. package/src/cli/mcp/multi-repository.ts +16 -5
  164. package/src/cli/mcp/oauth.ts +175 -26
  165. package/src/cli/mcp/paths.ts +8 -2
  166. package/src/cli/mcp/repository-tools.ts +356 -101
  167. package/src/cli/mcp/server.ts +625 -54
  168. package/src/cli/mcp/tool-capability-cache.ts +1 -1
  169. package/src/cli/mcp/toolset-selection.ts +1 -1
  170. package/src/cli/mcp/toolset.ts +42 -5
  171. package/src/cli/mcp/transports/http.ts +125 -15
  172. package/src/cli/mcp/transports/session-registry.ts +67 -5
  173. package/src/cli/mcp/types.ts +3 -3
  174. package/src/cli/repositories/command-classifier.ts +209 -14
  175. package/src/cli/repositories/command-executor.ts +55 -521
  176. package/src/cli/repositories/command-process.ts +108 -0
  177. package/src/cli/repositories/command-scope.ts +99 -41
  178. package/src/cli/repositories/controller-home.ts +7 -8
  179. package/src/cli/repositories/git-command-executor.ts +2 -0
  180. package/src/cli/repositories/locks.ts +53 -16
  181. package/src/cli/repositories/repository-snapshot.ts +121 -0
  182. package/src/cli/repositories/safe-patch.ts +6 -4
  183. package/src/cli/repositories/selected-path-actions.ts +17 -9
  184. package/src/cli/repositories/structured-git.ts +110 -10
  185. package/src/cli/repository/inspector.ts +565 -62
  186. package/src/cli/repository/session-cache.ts +58 -17
  187. package/src/cli/v81-entry.ts +1 -4
  188. package/src/effects/fs-transaction.ts +85 -17
  189. package/src/runtime/context/codegraph-read-provider.ts +233 -2
  190. package/src/runtime/context/codegraph-sidecar.cjs +74 -40
  191. package/src/runtime/context/generic-lsp-provider.ts +355 -0
  192. package/src/runtime/context/lsp-client.ts +283 -0
  193. package/src/runtime/context/semantic-navigation.ts +275 -0
  194. package/src/runtime/context/swift-navigation.ts +565 -0
  195. package/src/runtime/context/typescript-navigation.ts +226 -0
  196. package/src/runtime/control-plane/dispatch-priority.ts +28 -0
  197. package/src/runtime/control-plane/execution/direct-edit-work-completion.ts +196 -2
  198. package/src/runtime/control-plane/execution/edit-validation-coordinator.ts +86 -24
  199. package/src/runtime/control-plane/execution/execution-identity.ts +65 -14
  200. package/src/runtime/control-plane/execution/session-store.ts +18 -0
  201. package/src/runtime/control-plane/execution/validation.ts +15 -2
  202. package/src/runtime/control-plane/execution/verification-evidence.ts +58 -3
  203. package/src/runtime/control-plane/execution/work-handle-store.ts +27 -2
  204. package/src/runtime/control-plane/execution/work-lifecycle-audit.ts +258 -0
  205. package/src/runtime/control-plane/execution/work-remote-delivery.ts +215 -0
  206. package/src/runtime/control-plane/execution/work-task-receipt.ts +54 -11
  207. package/src/runtime/control-plane/execution/work-terminal-cleanup.ts +175 -8
  208. package/src/runtime/control-plane/execution/work-validation-reconciler.ts +28 -21
  209. package/src/runtime/control-plane/execution/work-verification-snapshot.ts +87 -9
  210. package/src/runtime/control-plane/facade/capability-registry.ts +129 -25
  211. package/src/runtime/control-plane/facade/controller-round-relay.ts +991 -0
  212. package/src/runtime/control-plane/facade/controller-session-store.ts +144 -14
  213. package/src/runtime/control-plane/facade/goal-workloop-access.ts +9 -2
  214. package/src/runtime/control-plane/facade/goal-workloop.ts +885 -105
  215. package/src/runtime/control-plane/facade/index.ts +1 -0
  216. package/src/runtime/control-plane/facade/plan-contract-store.ts +211 -26
  217. package/src/runtime/control-plane/facade/requirement-board.ts +24 -8
  218. package/src/runtime/control-plane/facade/semantic-admission.ts +205 -0
  219. package/src/runtime/control-plane/facade/suggested-actions.ts +5 -1
  220. package/src/runtime/control-plane/facade/types.ts +55 -11
  221. package/src/runtime/control-plane/facade/work-contract-store.ts +204 -73
  222. package/src/runtime/control-plane/generated-cache-retention.ts +271 -0
  223. package/src/runtime/control-plane/global-scheduler/config.ts +44 -0
  224. package/src/runtime/control-plane/global-scheduler/dispatch-capacity.ts +80 -0
  225. package/src/runtime/control-plane/global-scheduler/durable-admission.ts +46 -0
  226. package/src/runtime/control-plane/global-scheduler/maintenance.ts +145 -0
  227. package/src/runtime/control-plane/global-scheduler/projection-refresh.ts +84 -0
  228. package/src/runtime/control-plane/global-scheduler/reconciliation.ts +3 -3
  229. package/src/runtime/control-plane/global-scheduler/scheduler.ts +273 -542
  230. package/src/runtime/control-plane/global-scheduler/source-scan.ts +59 -0
  231. package/src/runtime/control-plane/global-scheduler/state.ts +88 -0
  232. package/src/runtime/control-plane/global-scheduler/worker-attachment.ts +57 -0
  233. package/src/runtime/control-plane/global-scheduler/worker-exit-decision.ts +38 -0
  234. package/src/runtime/control-plane/global-scheduler/worker-exit-reconciler.ts +175 -0
  235. package/src/runtime/control-plane/global-scheduler/worker-launch.ts +111 -0
  236. package/src/runtime/control-plane/global-scheduler/worker-lifecycle-store.ts +64 -0
  237. package/src/runtime/control-plane/global-scheduler/worker-lifecycle.ts +150 -0
  238. package/src/runtime/control-plane/global-scheduler/worker-process.ts +119 -0
  239. package/src/runtime/control-plane/global-scheduler/worker-stderr.ts +60 -0
  240. package/src/runtime/control-plane/launcher/chatgpt-work-binding-store.ts +50 -0
  241. package/src/runtime/control-plane/launcher/chatgpt-work-continuation.ts +642 -51
  242. package/src/runtime/control-plane/launcher/launch-reservation-store.ts +40 -0
  243. package/src/runtime/control-plane/launcher/thin-launcher.ts +194 -10
  244. package/src/runtime/control-plane/persistence/controller-home-migration.ts +487 -0
  245. package/src/runtime/control-plane/persistence/requirement-store.ts +15 -11
  246. package/src/runtime/control-plane/persistence/sqlite-store.ts +33 -2
  247. package/src/runtime/control-plane/release-retention.ts +62 -2
  248. package/src/runtime/control-plane/routing/route-policy.ts +7 -16
  249. package/src/runtime/control-plane/runtime-status-client.ts +0 -2
  250. package/src/runtime/diagnostics/mcp-timing.ts +19 -0
  251. package/src/runtime/diagnostics/mcp-transport-benchmark.ts +129 -0
  252. package/src/runtime/diagnostics/performance.ts +24 -1
  253. package/src/runtime/evidence/event-ledger.ts +1 -1
  254. package/src/runtime/execution/jobs/store.ts +58 -4
  255. package/src/runtime/execution/jobs/types.ts +1 -1
  256. package/src/runtime/execution/managed-workspace.ts +203 -1
  257. package/src/runtime/execution/process-runtime/check-facade.ts +52 -14
  258. package/src/runtime/execution/process-runtime/check-result.ts +63 -2
  259. package/src/runtime/execution/process-runtime/check-scheduling.ts +114 -0
  260. package/src/runtime/execution/process-runtime/command-facade.ts +346 -40
  261. package/src/runtime/execution/process-runtime/gc.ts +98 -12
  262. package/src/runtime/execution/process-runtime/lightweight-managed.ts +1184 -0
  263. package/src/runtime/execution/process-runtime/persisted-check.ts +57 -6
  264. package/src/runtime/execution/process-runtime/resource-claims.ts +97 -8
  265. package/src/runtime/execution/process-runtime/runtime.ts +59 -4
  266. package/src/runtime/execution/process-runtime/store.ts +7 -0
  267. package/src/runtime/execution/process-runtime/types.ts +2 -0
  268. package/src/runtime/execution/thin-harness/async-process.ts +12 -2
  269. package/src/runtime/execution/thin-harness/search-worker.ts +54 -5
  270. package/src/runtime/execution/workers/executor.ts +0 -48
  271. package/src/runtime/gateway/mcp/execution-tools.ts +1219 -126
  272. package/src/runtime/gateway/mcp/process-tools.ts +83 -37
  273. package/src/runtime/gateway/mcp/router.ts +185 -83
  274. package/src/runtime/gateway/mcp/runtime-tool-definitions.ts +546 -0
  275. package/src/runtime/gateway/mcp/runtime-tools.ts +2555 -1616
  276. package/src/runtime/model-clients/deepseek-adapter.ts +0 -32
  277. package/src/runtime/plugins/app-store-connect-adapter.ts +123 -19
  278. package/src/runtime/plugins/browser-adapter.ts +2925 -318
  279. package/src/runtime/plugins/browser-automation-service.ts +10 -0
  280. package/src/runtime/plugins/browser-handoff-host.ts +6 -31
  281. package/src/runtime/plugins/browser-handoff.ts +92 -5
  282. package/src/runtime/plugins/browser-macos-bridge.ts +586 -45
  283. package/src/runtime/plugins/browser-node-bridge.ts +6 -34
  284. package/src/runtime/plugins/browser-provider-registry.ts +109 -0
  285. package/src/runtime/plugins/browser-runtime-contract.ts +152 -0
  286. package/src/runtime/plugins/browser-runtime.ts +183 -0
  287. package/src/runtime/plugins/browser-session-authority.ts +332 -0
  288. package/src/runtime/plugins/capability-authorization-grants.ts +354 -0
  289. package/src/runtime/plugins/desktop-operator-registration.ts +15 -12
  290. package/src/runtime/plugins/external-adapter.ts +324 -3
  291. package/src/runtime/plugins/external-registration.ts +84 -5
  292. package/src/runtime/plugins/external-unix-socket.ts +7 -1
  293. package/src/runtime/plugins/first-party-registry.ts +4 -2
  294. package/src/runtime/plugins/github-adapter.ts +125 -0
  295. package/src/runtime/plugins/gmail-adapter.ts +28 -2
  296. package/src/runtime/plugins/ios/agent-device-provider.ts +1 -1
  297. package/src/runtime/plugins/ios/agent-device-typed-provider.ts +52 -9
  298. package/src/runtime/plugins/ios/remote-xpc-hid.ts +1171 -0
  299. package/src/runtime/plugins/ios-adapter.ts +106 -16
  300. package/src/runtime/plugins/ios-agent-device.ts +234 -64
  301. package/src/runtime/plugins/ios-physical-device.ts +1143 -392
  302. package/src/runtime/plugins/lightweight-action.ts +153 -0
  303. package/src/runtime/plugins/local-system-adapter.ts +125 -8
  304. package/src/runtime/plugins/macos-capability-broker.ts +55 -9
  305. package/src/runtime/plugins/plugin-action-sidecar.ts +59 -0
  306. package/src/runtime/plugins/plugin-management-adapter.ts +181 -0
  307. package/src/runtime/plugins/resend-adapter.ts +1 -1
  308. package/src/runtime/plugins/store.ts +366 -24
  309. package/src/runtime/plugins/types.ts +39 -2
  310. package/src/runtime/plugins/xiaohongshu-publish.ts +515 -0
  311. package/src/runtime/projections/git-status-sampler.ts +16 -16
  312. package/src/runtime/projections/materialized-view.ts +28 -10
  313. package/src/runtime/recovery/actions.ts +0 -10
  314. package/src/runtime/recovery/classifier.ts +0 -9
  315. package/src/runtime/recovery/maintenance-executor.ts +415 -18
  316. package/src/runtime/recovery/probe.ts +0 -1
  317. package/src/runtime/recovery/types.ts +0 -1
  318. package/src/runtime/root/mcp-transport.ts +180 -10
  319. package/src/runtime/root/package-connector-service.ts +186 -8
  320. package/src/runtime/root/package-runtime-release.ts +143 -17
  321. package/src/runtime/root/package-runtime-service.ts +430 -22
  322. package/src/runtime/root/release-manifest.ts +7 -2
  323. package/src/runtime/root/release-materialize.ts +162 -19
  324. package/src/runtime/root/release-store.ts +48 -11
  325. package/src/runtime/root/runtime.ts +23 -5
  326. package/src/runtime/root/service.ts +100 -27
  327. package/src/runtime/root/types.ts +2 -0
  328. package/src/runtime/safe-tooling/index.ts +0 -1
  329. package/src/runtime/safe-tooling/ios-development.ts +321 -63
  330. package/src/runtime/safe-tooling/types.ts +0 -30
  331. package/src/runtime/shared/trusted-executable.ts +62 -0
  332. package/src/runtime/shared/trusted-node-executable.ts +48 -0
  333. package/src/runtime/standalone-recovery/core.ts +702 -94
  334. package/src/runtime/standalone-recovery/entry.ts +99 -23
  335. package/src/runtime/standalone-recovery/installer.ts +19 -3
  336. package/src/runtime/standalone-recovery/service-labels.ts +2 -0
  337. package/src/runtime/standalone-recovery/watchdog-heartbeat.ts +160 -0
  338. package/src/runtime/workflow/schedules/browser-probe.ts +258 -0
  339. package/src/runtime/workflow/schedules/chatgpt-automation-migration.ts +40 -0
  340. package/src/runtime/workflow/schedules/engine.ts +509 -80
  341. package/src/runtime/workflow/schedules/github-issue-watch.ts +158 -0
  342. package/src/runtime/workflow/schedules/settlement.ts +48 -4
  343. package/src/runtime/workflow/schedules/store.ts +131 -10
  344. package/src/runtime/workflow/schedules/types.ts +6 -3
  345. package/src/runtime/workflow/schedules/work-continuation.ts +120 -34
  346. package/src/testing/test-governance.ts +8 -40
  347. package/assets/reference-configs/heartbeat-triage.md +0 -57
  348. package/assets/templates/helpers/harness-trace-grade.sh +0 -150
  349. package/assets/templates/helpers/heartbeat-triage.sh +0 -361
  350. package/assets/templates/helpers/maintenance-triage.sh +0 -167
  351. package/bin/forge-desktop-helper.mjs +0 -204
  352. package/docs/architecture/current/approved-target-architecture.zh-CN.md +0 -1501
  353. package/docs/architecture/current/architecture-invariants.md +0 -331
  354. package/docs/architecture/current/automation-and-schedule-engine.md +0 -453
  355. package/docs/architecture/current/codegraph-context-provider.md +0 -226
  356. package/docs/architecture/current/control-plane-authority-inventory.md +0 -94
  357. package/docs/architecture/current/controller-repository-decoupling.md +0 -148
  358. package/docs/architecture/current/dispatch-and-agent-strategy.md +0 -354
  359. package/docs/architecture/current/entity-model.md +0 -592
  360. package/docs/architecture/current/external-plugin-governance.md +0 -396
  361. package/docs/architecture/current/failure-recovery.md +0 -447
  362. package/docs/architecture/current/governance.md +0 -213
  363. package/docs/architecture/current/human-interaction-plane.md +0 -87
  364. package/docs/architecture/current/implementation-status.md +0 -128
  365. package/docs/architecture/current/job-and-run-lifecycle.md +0 -413
  366. package/docs/architecture/current/legacy-governance.md +0 -58
  367. package/docs/architecture/current/local-workspace-target-grants.md +0 -70
  368. package/docs/architecture/current/migration-roadmap.md +0 -105
  369. package/docs/architecture/current/multi-repository-execution.md +0 -371
  370. package/docs/architecture/current/operations-runbook.md +0 -45
  371. package/docs/architecture/current/peer-supercontroller-runtime.md +0 -32
  372. package/docs/architecture/current/personal-assistant-plugin-baseline.md +0 -206
  373. package/docs/architecture/current/repository-access-modes.md +0 -102
  374. package/docs/architecture/current/route-policy.md +0 -15
  375. package/docs/architecture/current/route-session-concurrency.md +0 -85
  376. package/docs/architecture/current/runtime-architecture-simplification.md +0 -214
  377. package/docs/architecture/current/runtime-directory-map.md +0 -49
  378. package/docs/architecture/current/runtime-health-and-resource-lifecycle.md +0 -85
  379. package/docs/architecture/current/scheduler-and-resource-claims.md +0 -422
  380. package/docs/architecture/current/session-aware-execution-and-authorization.md +0 -77
  381. package/docs/architecture/current/system-overview.md +0 -144
  382. package/docs/architecture/current/target-requirements-traceability.md +0 -202
  383. package/docs/architecture/current/thin-harness-governance-policy.md +0 -32
  384. package/docs/architecture/current/thin-harness-v1.md +0 -311
  385. package/docs/architecture/current/verification-and-release-gates.md +0 -391
  386. package/docs/forge-autonomous-goal-loop.md +0 -9
  387. package/docs/forge-provider-configuration.md +0 -7
  388. package/docs/operations/chatgpt-personal-assistant-runtime.md +0 -83
  389. package/docs/operations/controller-desktop-plugin.md +0 -112
  390. package/docs/operations/gmail-assistant-routines.md +0 -186
  391. package/docs/operations/personal-assistant-operator-guide.md +0 -61
  392. package/docs/operations/provider-configuration.md +0 -31
  393. package/scripts/harness-trace-grade.sh +0 -150
  394. package/scripts/heartbeat-triage.sh +0 -361
  395. package/scripts/maintenance-triage.sh +0 -167
  396. package/src/cli/local-bridge/frontend/src/features/settings/SettingsView.tsx +0 -2
  397. package/src/cli/repositories/goal-registry.ts +0 -239
  398. package/src/runtime/assistant/action-proposals.ts +0 -279
  399. package/src/runtime/assistant/intent.ts +0 -395
  400. package/src/runtime/assistant/model-provider.ts +0 -460
  401. package/src/runtime/assistant/openapi.ts +0 -223
  402. package/src/runtime/assistant/policy.ts +0 -89
  403. package/src/runtime/assistant/readiness.ts +0 -258
  404. package/src/runtime/assistant/routine-runtime.ts +0 -477
  405. package/src/runtime/assistant/schedule-binding.ts +0 -171
  406. package/src/runtime/assistant/standing-grants.ts +0 -375
  407. package/src/runtime/assistant/store.ts +0 -243
  408. package/src/runtime/assistant/types.ts +0 -135
  409. package/src/runtime/control-plane/goal-loop/config-facade.ts +0 -700
  410. package/src/runtime/control-plane/goal-loop/config-store.ts +0 -570
  411. package/src/runtime/control-plane/goal-loop/config-types.ts +0 -213
  412. package/src/runtime/control-plane/goal-loop/executor-router.ts +0 -109
  413. package/src/runtime/control-plane/goal-loop/failure-taxonomy.ts +0 -149
  414. package/src/runtime/control-plane/goal-loop/goal-contract-store.ts +0 -304
  415. package/src/runtime/control-plane/goal-loop/goal-loop-engine.ts +0 -1001
  416. package/src/runtime/control-plane/goal-loop/handoff-packet.ts +0 -160
  417. package/src/runtime/control-plane/goal-loop/index.ts +0 -13
  418. package/src/runtime/control-plane/goal-loop/local-tools.ts +0 -290
  419. package/src/runtime/control-plane/goal-loop/policy-gates.ts +0 -203
  420. package/src/runtime/control-plane/goal-loop/provider-dispatch.ts +0 -93
  421. package/src/runtime/control-plane/goal-loop/provider-registry.ts +0 -545
  422. package/src/runtime/control-plane/goal-loop/types.ts +0 -378
  423. package/src/runtime/control-plane/startup-recovery.ts +0 -198
  424. package/src/runtime/gateway/mcp/resource-policy.ts +0 -186
  425. package/src/runtime/personal-assistant/gmail-triage-manager.ts +0 -231
  426. package/src/runtime/personal-assistant/reporting-runtime.ts +0 -344
  427. package/src/runtime/personal-assistant/triage-runtime.ts +0 -748
  428. package/src/runtime/plugins/desktop-adapter.ts +0 -374
  429. package/src/runtime/safe-tooling/browser-safe.ts +0 -133
  430. package/src/runtime/workflow/findings/store.ts +0 -204
  431. package/src/runtime/workflow/findings/types.ts +0 -58
  432. package/src/runtime/workflow/portfolio/engine.ts +0 -20
  433. package/src/runtime/workflow/portfolio/store.ts +0 -185
  434. package/src/runtime/workflow/portfolio/types.ts +0 -29
@@ -0,0 +1,546 @@
1
+ import type { McpToolDefinition } from '../../../cli/mcp/tools';
2
+ import { CONTROLLER_CONTEXT_IMPACT_DOMAINS } from '../../../cli/controller/context-pack';
3
+
4
+ function definition(name: string, description: string, properties: Record<string, unknown>, required: string[] = [], readOnly = true): McpToolDefinition {
5
+ return {
6
+ name,
7
+ description,
8
+ inputSchema: { type: 'object', properties, ...(required.length ? { required } : {}), additionalProperties: false },
9
+ annotations: { readOnlyHint: readOnly, openWorldHint: false, destructiveHint: false },
10
+ };
11
+ }
12
+ const repoId = { type: 'string', description: 'Stable repository id.' };
13
+ export const runtimeToolDefinitions: McpToolDefinition[] = [
14
+ definition('rh_status', 'Preferred ChatGPT facade: bounded controller status, capability readiness, and self-healing diagnose/repair.', {
15
+ repo_id: repoId,
16
+ operation: { type: 'string', enum: ['list', 'get', 'repair'], description: 'Defaults to get.' },
17
+ detail_level: { type: 'string', enum: ['summary', 'detail'], description: 'Defaults to summary.' },
18
+ repair_operation: { type: 'string', enum: ['diagnose', 'repair', 'verify', 'handoff'] },
19
+ dry_run: { type: 'boolean', description: 'Defaults to true for repair/diagnose.' },
20
+ approval_confirmed: { type: 'boolean' },
21
+ chatgpt_pull_failed: { type: 'boolean' },
22
+ destructive: { type: 'boolean' },
23
+ }),
24
+ definition('rh_inbox', 'Preferred ChatGPT facade: pending handoff decisions only (not logs).', {
25
+ repo_id: repoId,
26
+ operation: { type: 'string', enum: ['list', 'get', 'ack', 'accept', 'resolve', 'dismiss', 'create'], description: 'Defaults to list (pending).' },
27
+ handoff_id: { type: 'string' },
28
+ work_id: { type: 'string' },
29
+ title: { type: 'string' },
30
+ reason: { type: 'string' },
31
+ summary: { type: 'string' },
32
+ recommended_decision: { type: 'string' },
33
+ recommended_prompt: { type: 'string' },
34
+ decision: { type: 'string', description: 'Recorded on resolve/dismiss.' },
35
+ resolver: { type: 'string', description: 'Who resolved or dismissed the handoff.' },
36
+ detail_level: { type: 'string', enum: ['summary', 'detail'] },
37
+ limit: { type: 'number' },
38
+ }),
39
+ definition('rh_context', 'Preferred ChatGPT facade and default repository code-discovery/read path. Start broad once to combine heuristic lexical discovery, current raw source, and optional CodeGraph structural evidence with few round trips. Natural-language lexical terms are discovery hints: do not require every guessed term to match and do not repeat the same broad search merely because a heuristic term missed. After credible files or symbols are found, derive follow-up paths/symbols from the returned source and prefer known_paths, compiler semantic_navigation/@tsnav for TypeScript, or structural relationships before another broad lexical pass. Call rh_context repeatedly only when that progressive expansion can materially improve correctness; follow-ups reuse session-scoped evidence when source identity is unchanged. Shell rg/grep/sed/cat loops are fallback-only when this Context Plane cannot supply the needed evidence.', {
40
+ repo_id: repoId,
41
+ checkout_id: { type: 'string', description: 'Optional checkout identity for repositories with multiple worktrees.' },
42
+ operation: { type: 'string', enum: ['list', 'get', 'search'], description: 'Defaults to get. Use search as the default code-location path when an exact file is unknown.' },
43
+ query: { type: 'string', description: 'Code/content intent for operation=search. For operation=list, a natural-language capability intent such as "configure Xcode provisioning" returns ranked read-only capability candidates while execution remains on the capability\'s typed executor. Frozen-schema clients may append @tsnav or @swiftnav references|definition|implementations <repo-path>:<line>:<column> for compiler/LSP-backed semantic navigation.' },
44
+ known_paths: { type: 'array', items: { type: 'string' }, description: 'Optional exact paths or globs that should receive highest retrieval priority.' },
45
+ include_globs: { type: 'array', items: { type: 'string' } },
46
+ exclude_globs: { type: 'array', items: { type: 'string' } },
47
+ retrieval_mode: { type: 'string', enum: ['implementation', 'plan', 'debug', 'review'], description: 'Defaults to implementation. Implementation returns current raw impact evidence for ChatGPT to judge; plan/debug/review intentionally widen evidence.' },
48
+ impact_domains: { type: 'array', items: { type: 'string', enum: [...CONTROLLER_CONTEXT_IMPACT_DOMAINS] }, description: 'Optional GPT-selected cross-cutting evidence dimensions. Forge expands these mechanically in the same retrieval call; it never treats them as proof of semantic completeness.' },
49
+ structural_context: { type: 'string', enum: ['off', 'auto', 'required'], description: 'Optional override. Defaults to auto for implementation/review and required for plan/debug.' },
50
+ semantic_navigation: {
51
+ type: 'array',
52
+ maxItems: 8,
53
+ description: 'Optional bounded semantic navigation through the provider registry. TypeScript uses the in-process Language Service; Swift uses SourceKit-LSP only with existing build settings; registered generic LSP providers currently cover Rust, Go, Python, and C/C++ when their language-server executable and project root markers already exist. Providers start lazily only for explicit semantic requests; Forge never installs a server, triggers a build, or treats language-server output as source authority.',
54
+ items: {
55
+ type: 'object',
56
+ required: ['navigation', 'path', 'line', 'column'],
57
+ additionalProperties: false,
58
+ properties: {
59
+ navigation: { type: 'string', enum: ['definition', 'references', 'implementations'] },
60
+ path: { type: 'string' },
61
+ line: { type: 'number' },
62
+ column: { type: 'number' },
63
+ tsconfig_path: { type: 'string' },
64
+ language: { type: 'string', description: 'Optional provider-routing hint. File extension remains the default routing signal.' },
65
+ },
66
+ },
67
+ },
68
+ max_files: { type: 'number' },
69
+ max_snippets: { type: 'number' },
70
+ requested_check_ids: { type: 'array', items: { type: 'string' }, description: 'Optional execution preflight. When supplied, returns registered checks plus dependency and resource-compatible scheduling readiness; omit for source-only retrieval.' },
71
+ capability_id: { type: 'string', description: 'Optional capability identity. For plugin.<pluginId>.<actionId>, returns the exact typed action schema/policy for plugin_action_execute.' },
72
+ work_id: { type: 'string' },
73
+ detail_level: { type: 'string', enum: ['summary', 'detail', 'raw'], description: 'Defaults to summary; raw is still bounded.' },
74
+ }),
75
+ definition('rh_work', 'Preferred ChatGPT facade for bounded execution, optional Requirement authority, optional planning, controller ownership, and external SuperController launch. Requirement and Plan are not universal prerequisites: start explicit bounded work directly when safe, establish Requirement authority only when durable goal identity is useful, and use Plan only for real decomposition, dependency ordering, or replanning.', {
76
+ repo_id: repoId,
77
+ operation: { type: 'string', enum: ['start', 'continue', 'verify', 'repair', 'finalize', 'stop', 'delegate', 'controller_claim', 'controller_release', 'controller_disposition', 'controller_get_owner', 'launcher_start', 'requirement_create', 'plan_create', 'plan_get', 'plan_list', 'plan_approve', 'plan_accept_step', 'plan_supersede', 'schedule_create', 'schedule_list', 'schedule_get', 'schedule_pause', 'schedule_resume', 'schedule_delete', 'schedule_trigger'], description: 'Defaults to start. controller_disposition records ChatGPT\'s explicit end-of-round continue/wait decision; Forge never infers the semantic next step. requirement_create establishes optional durable Requirement authority only and never implies plan_create. Plan-bound starts require plan_id and plan_step_id, but Plan is a late semantic commitment for real decomposition/replanning rather than a universal complex-task wrapper. plan_accept_step records explicit Controller semantic acceptance after machine delivery leaves a step validating. schedule_* manages Work-bound continuation, bounded browser observation, and explicit standalone browser keepalive.' },
78
+ objective: { type: 'string' },
79
+ capability_id: { type: 'string', description: 'Legacy-readable compatibility input. operation=repair with capability_id=schedule.delete:<scheduleId> maps to canonical schedule_delete; controller.disposition:<disposition>:<relayScopeId> maps to canonical controller_disposition for frozen clients.' },
80
+ work_id: { type: 'string' },
81
+ related_work_id: { type: 'string', description: 'Optional explicit existing Work ownership target for continue/extend semantics. Unrelated active Work is never inferred as a semantic target.' },
82
+ work_relation: { type: 'string', enum: ['continue', 'extend', 'parallel', 'new_goal'], description: 'Optional semantic relation to an explicitly related Work. This field never selects Direct/Process/Durable execution depth; checkout conflicts are resolved by placement.' },
83
+ related_plan_id: { type: 'string', description: 'Existing active Plan selected when resolving another slice under the same Requirement.' },
84
+ plan_relation: { type: 'string', enum: ['extend', 'parallel'], description: 'Relationship to another active Plan under the same Requirement. Omit to receive candidates first. parallel explicitly permits a distinct Plan slice; extend reuses the existing Plan authority and requires replanning/supersession instead of creating another draft.' },
85
+ requested_by: { type: 'string', enum: ['chatgpt', 'user', 'system', 'scheduler'], description: 'Origin of the request. Scheduler-origin starts are continuation-only and cannot create new durable Work.' },
86
+ requirement_id: { type: 'string', description: 'Optional stable Requirement authority used to find related active Work before creation; ordinary Work may start without Requirement or Plan authority.' },
87
+ requirement_title: { type: 'string', description: 'Human-readable Requirement title for requirement_create.' },
88
+ requirement_outcome: { type: 'string', description: 'Durable outcome statement for requirement_create.' },
89
+ requirement_acceptance_criteria: { type: 'array', items: { type: 'string' }, description: 'Bounded semantic acceptance criteria for requirement_create.' },
90
+ requirement_delivery_references: { type: 'array', items: { type: 'string' }, description: 'Optional durable delivery/reference identifiers for requirement_create.' },
91
+ requirement_legacy_aliases: { type: 'array', items: { type: 'string' }, description: 'Optional migration aliases for requirement_create; not a second identity authority.' },
92
+ handoff_id: { type: 'string', description: 'Optional existing HandoffItem used to resume controller context. Required for controller_disposition=wait_for_user.' },
93
+ disposition: { type: 'string', enum: ['continue_immediately', 'wait', 'wait_for_user', 'goal_complete'], description: 'Explicit ChatGPT end-of-round semantic decision. continue_immediately is consumed only after the current controller lease closes.' },
94
+ relay_scope_id: { type: 'string', description: 'Stable Requirement/Goal relay identity. Requirement-bound Work uses requirement:<id>; otherwise reuse the exact returned goal scope across Works.' },
95
+ state_fingerprint: { type: 'string', description: 'Optional controller-observed semantic-state fingerprint. When omitted, Forge derives a mechanical fingerprint from current Requirement/Work/Handoff state.' },
96
+ max_rounds: { type: 'number', description: 'Mechanical immediate-relay round budget; defaults to 8 and cannot be loosened within an existing relay scope.' },
97
+ max_repeated_state: { type: 'number', description: 'Mechanical repeated-state fence; defaults to 2 repeated observations and cannot be loosened within an existing relay scope.' },
98
+ controller_id: { type: 'string', description: 'Stable external SuperController identity for controller_claim/release.' },
99
+ controller_type: { type: 'string', enum: ['chatgpt', 'codex', 'grok', 'claude', 'human'], description: 'Controller kind for claims and launcher_start.' },
100
+ session_id: { type: 'string', description: 'Controller-owned session identity used for an exclusive Work lease.' },
101
+ lease_ms: { type: 'number', description: 'Authenticated Controller ownership lease duration, bounded to one hour. Legacy launcher callers may still use this as a launch-reservation TTL.' },
102
+ launch_reservation_ms: { type: 'number', description: 'Short duplicate-spawn reservation TTL for launcher_start or schedule_create; does not grant Work ownership.' },
103
+ executable: { type: 'string', description: 'External controller executable for launcher_start. This is owned by the Launcher, not the Kernel.' },
104
+ launch_args: { type: 'array', items: { type: 'string' }, description: 'Provider-specific arguments for launcher_start.' },
105
+ browser_session_id: { type: 'string', description: 'Saved Forge ChatGPT browser session to continue when controller_type=chatgpt.' },
106
+ conversation_url: { type: 'string', description: 'Explicit https://chatgpt.com conversation URL used when no saved Forge browser session exists.' },
107
+ continuation_prompt: { type: 'string', description: 'Bounded Work continuation instruction.' },
108
+ schedule_id: { type: 'string', description: 'Schedule identity for schedule_get/pause/resume/delete/trigger.' },
109
+ schedule_name: { type: 'string', description: 'Human-readable schedule name.' },
110
+ schedule_request_id: { type: 'string', description: 'Stable idempotency key for schedule_create.' },
111
+ schedule_mode: { type: 'string', enum: ['continuation', 'browser_watch', 'browser_keepalive'], description: 'Defaults to continuation when work_id is present. browser_keepalive may run without a durable Work; continuation and browser_watch remain Work-bound.' },
112
+ probe_url: { type: 'string', description: 'Allowed URL to navigate or refresh for browser_watch/browser_keepalive.' },
113
+ probe_browser_session_id: { type: 'string', description: 'Existing Forge browser session used as the external observation target.' },
114
+ probe_selector: { type: 'string', description: 'Optional selector limiting text extraction for browser_watch.' },
115
+ probe_max_chars: { type: 'number', description: 'Bounded extracted text size for browser_watch.' },
116
+ probe_timeout_ms: { type: 'number', description: 'Bounded browser probe timeout.' },
117
+ include_terms: { type: 'array', items: { type: 'string' }, description: 'Optional case-insensitive terms; only matching normalized lines contribute to the observation fingerprint.' },
118
+ ignore_patterns: { type: 'array', items: { type: 'string' }, description: 'Optional regex patterns stripped before fingerprinting volatile text such as relative timestamps.' },
119
+ login_url_terms: { type: 'array', items: { type: 'string' }, description: 'Configured URL markers that classify the browser observation as authentication-required.' },
120
+ login_text_terms: { type: 'array', items: { type: 'string' }, description: 'Configured page-text markers that classify the browser observation as authentication-required.' },
121
+ wake_on_first_observation: { type: 'boolean', description: 'Defaults false so the first browser_watch occurrence records a silent baseline.' },
122
+ wake_on_auth_required: { type: 'boolean', description: 'Defaults true for browser schedules. Standalone browser_keepalive dispatches the configured ChatGPT auth-required prompt without creating a synthetic Work.' },
123
+ auth_required_prompt: { type: 'string', description: 'Optional ChatGPT continuation instruction when the probe detects a login marker.' },
124
+ trigger_type: { type: 'string', enum: ['interval', 'cron', 'calendar', 'condition', 'repository-event', 'dependency-checkpoint', 'manual'] },
125
+ every_minutes: { type: 'number', description: 'Interval trigger cadence in minutes.' },
126
+ cron_expression: { type: 'string' },
127
+ schedule_timezone: { type: 'string' },
128
+ catch_up_minutes: { type: 'number' },
129
+ calendar_at: { type: 'string' },
130
+ condition: { type: 'object' },
131
+ event_name: { type: 'string' },
132
+ event_id: { type: 'string' },
133
+ event_data: { type: 'object' },
134
+ dependency_job_ids: { type: 'array', items: { type: 'string' } },
135
+ max_failures: { type: 'number' },
136
+ cooldown_minutes: { type: 'number' },
137
+ daily_budget_minutes: { type: 'number' },
138
+ shadow_mode: { type: 'boolean', description: 'Defaults to true. Set false only after the continuation path has been validated.' },
139
+ backoff_base_minutes: { type: 'number' },
140
+ backoff_max_minutes: { type: 'number' },
141
+ include_occurrences: { type: 'boolean' },
142
+ plan_id: { type: 'string' },
143
+ plan_step_id: { type: 'string', description: 'PlanContract step identity. Used to bind a complex Goal Workloop start and to accept a validating step.' },
144
+ acceptance_rationale: { type: 'string', description: 'Controller rationale for plan_accept_step after reviewing the completed Work evidence against the Plan step acceptance criteria.' },
145
+ scope_key: { type: 'string', description: 'Stable normalized scope identity used to prevent overlapping active plans.' },
146
+ source_revision: { type: 'string', description: 'Repository revision observed during read-only planning preflight.' },
147
+ plan_steps: { type: 'array', items: { type: 'object' }, description: 'Bounded plan steps with id, objective, dependencies, authoritative_files, allowed_paths, forbidden_paths, check_ids, and acceptance_criteria.' },
148
+ non_goals: { type: 'array', items: { type: 'string' } },
149
+ assumptions: { type: 'array', items: { type: 'string' } },
150
+ resolved_decisions: { type: 'array', items: { type: 'string' } },
151
+ stop_conditions: { type: 'array', items: { type: 'string' } },
152
+ replan_conditions: { type: 'array', items: { type: 'string' } },
153
+ integration_strategy: { type: 'string' },
154
+ superseded_by: { type: 'string' },
155
+ expected_files: { type: 'number' },
156
+ expected_changed_lines: { type: 'number' },
157
+ mode: { type: 'string', enum: ['scale'], description: 'Explicit Scale coordination mode for start. Scale requires a bound approved PlanContract step and uses existing Work/Process/resource-claim authorities; it does not create an agent-swarm lifecycle.' },
158
+ work_kind: { type: 'string', enum: ['repository_change', 'completed_no_change', 'investigation', 'local_effect', 'remote_effect', 'reconciliation'], description: 'Explicit technical Work evidence shape for operation=start. local_effect/remote_effect represent effect-only execution and do not require a repository diff; completed_no_change/investigation/reconciliation likewise do not imply a source mutation. None of these imply semantic completion; ChatGPT must still explicitly finalize after reviewing evidence.' },
159
+ scope_clear: { type: 'boolean' },
160
+ requires_investigation: { type: 'boolean' },
161
+ requires_long_running_checks: { type: 'boolean' },
162
+ requires_parallelism: { type: 'boolean' },
163
+ needs_dependencies: { type: 'boolean' },
164
+ requires_recovery: { type: 'boolean' },
165
+ requires_worker: { type: 'boolean', description: 'Opt-in only. Set true only when the user explicitly requests Codex/Claude or another agent worker; never infer it from task complexity.' },
166
+ requires_external_effect: { type: 'boolean' },
167
+ requires_approval: { type: 'boolean' },
168
+ requires_user_approval: { type: 'boolean' },
169
+ destructive: { type: 'boolean' },
170
+ remote_write: { type: 'boolean' },
171
+ secret_access: { type: 'boolean' },
172
+ approval_confirmed: { type: 'boolean' },
173
+ dry_run: { type: 'boolean', description: 'Defaults to true for repair.' },
174
+ check_ids: { type: 'array', items: { type: 'string' }, description: 'Requested checks. Before launching multiple checks concurrently, call rh_context with requested_check_ids to read resource-compatible checkScheduling waves; do not overlap checks from different waves.' },
175
+ check_id: { type: 'string' },
176
+ acceptance_criteria: { type: 'array', items: { type: 'string' } },
177
+ allowed_paths: { type: 'array', items: { type: 'string' } },
178
+ initial_likely_paths: { type: 'array', items: { type: 'string' }, description: 'Non-authoritative first-pass discovery candidates. May expand after investigation; allowed_paths remains a policy fence only.' },
179
+ additional_likely_paths: { type: 'array', items: { type: 'string' }, description: 'Non-authoritative candidates discovered after Work start. Valid for continue; does not widen allowed_paths.' },
180
+ inspected_paths: { type: 'array', items: { type: 'string' }, description: 'Paths actually inspected during progressive discovery. Valid for continue; does not widen allowed_paths.' },
181
+ acceptance_failure_decision: { type: 'string', enum: ['repair', 'rescope'], description: 'Explicit Controller decision for operation=continue after a deterministic valid_fail. Bypasses acceptance-review handoff only for this bounded repair/re-scope decision; never inferred from free text.' },
182
+ forbidden_paths: { type: 'array', items: { type: 'string' } },
183
+ constraints: { type: 'object' },
184
+ repair_operation: { type: 'string', enum: ['diagnose', 'repair', 'verify', 'handoff'] },
185
+ target: { type: 'string', enum: ['codex', 'grok', 'claude'], description: 'Explicit small-brain delegate target for operation=delegate. Delegation is never the default execution path.' },
186
+ available: { type: 'boolean', description: 'Whether the delegate target is currently available.' },
187
+ codex_available: { type: 'boolean' },
188
+ simulate_check: { type: 'boolean', description: 'Test hook: skip real check execution and use infrastructure_failed/check_failed flags.' },
189
+ infrastructure_failed: { type: 'boolean' },
190
+ check_failed: { type: 'boolean' },
191
+ authorize_destructive_cleanup: { type: 'boolean' },
192
+ commit: { type: 'boolean', description: 'Finalize override. Defaults to true only when the Work owns uncommitted changes.' },
193
+ merge: { type: 'boolean', description: 'Finalize override. Defaults to true for managed Work delivery.' },
194
+ cleanup: { type: 'boolean', description: 'Finalize/stop override. Defaults to true so managed worktrees close automatically.' },
195
+ target_branch: { type: 'string', description: 'Delivery branch; defaults to the repository default branch.' },
196
+ delete_branch: { type: 'boolean', description: 'Defaults to true after target-branch containment is proven.' },
197
+ no_ff: { type: 'boolean' },
198
+ completion_outcome: { type: 'string', enum: ['completed_changed', 'completed_no_change', 'completed_local', 'completed_remote'], description: 'Explicit completion semantics. completed_local is for controller-local effect Work finalized from durable result evidence; completed_remote remains bound to a durable remote plugin receipt.' },
199
+ no_change_evidence: { type: 'string', description: 'Optional explicit proof for a no-change completion; otherwise the lifecycle coordinator derives proof only for an unchanged validated HEAD.' },
200
+ reconcile_historical_delivery: { type: 'boolean', description: 'Explicitly request reviewed reconciliation for a historically delivered repository Work whose original receipt is missing. Managed Work is eligible only after merge, branch cleanup, and worktree cleanup are durably complete.' },
201
+ reconcile_target_revision: { type: 'string', description: 'Exact already-integrated commit accepted by the reviewer.' },
202
+ reconcile_compared_paths: { type: 'array', items: { type: 'string' }, description: 'Complete exact path set changed from the Work base revision to reconcile_target_revision.' },
203
+ reconcile_rationale: { type: 'string', description: 'Bounded reviewer rationale for accepting the historical delivery.' },
204
+ reconcile_cleanup_proof: { type: 'string', description: 'Concrete proof that no owned cleanup remains or that cleanup is complete.' },
205
+ detail_level: { type: 'string', enum: ['summary', 'detail'] },
206
+ reason: { type: 'string', description: 'Bounded reason for a work stop or repair record.' },
207
+ }, [], false),
208
+ definition('work_get', 'Resume one Work by work_id or request_id. Repository scope is always enforced.', {
209
+ repo_id: repoId,
210
+ work_id: { type: 'string' },
211
+ request_id: { type: 'string' },
212
+ include_events: { type: 'boolean' },
213
+ wait: { type: 'boolean', description: 'When true, wait for terminal status before returning digest.' },
214
+ wait_ms: { type: 'number' },
215
+ }),
216
+ definition('work_list', 'List recent resumable Work for one repository.', {
217
+ repo_id: repoId,
218
+ limit: { type: 'number' },
219
+ }),
220
+ definition('work_cancel', 'Cancel one queued or running Work by work_id or request_id.', {
221
+ repo_id: repoId,
222
+ work_id: { type: 'string' },
223
+ request_id: { type: 'string' },
224
+ reason: { type: 'string' },
225
+ }, [], false),
226
+ definition('work_wait', 'Wait for one Work/ExecutionJob/managed process to reach a terminal status and return a bounded operation digest.', {
227
+ repo_id: repoId,
228
+ work_id: { type: 'string' },
229
+ request_id: { type: 'string' },
230
+ wait_ms: { type: 'number', description: 'Max wait in ms. Default 15000, max 120000.' },
231
+ }),
232
+ definition('git_diff_paths', 'Return a bounded Git diff and status for explicit repository-relative paths only.', {
233
+ repo_id: repoId,
234
+ paths: { type: 'array', items: { type: 'string' } },
235
+ staged: { type: 'boolean' },
236
+ max_bytes: { type: 'number' },
237
+ }, ['paths']),
238
+ definition('git_stage_paths', 'Stage explicit repository-relative paths only using git add --all -- <paths>.', {
239
+ repo_id: repoId,
240
+ paths: { type: 'array', items: { type: 'string' } },
241
+ }, ['paths'], false),
242
+ definition('git_commit_paths', 'Stage and commit explicit repository-relative paths only, leaving unrelated staged changes untouched.', {
243
+ repo_id: repoId,
244
+ paths: { type: 'array', items: { type: 'string' } },
245
+ message: { type: 'string' },
246
+ }, ['paths', 'message'], false),
247
+ definition('prepare_transfer_artifacts', 'Refresh rebuildable session continuation plus a selected-path patch transfer artifact when recovery context is needed.', {
248
+ repo_id: repoId,
249
+ reason: { type: 'string' },
250
+ }, [], false),
251
+ definition('get_job', 'Read one durable Execution Job. Summary is the default; opt in to full state only when needed.', {
252
+ job_id: { type: 'string' },
253
+ repo_id: repoId,
254
+ include_events: { type: 'boolean' },
255
+ detail_level: { type: 'string', enum: ['summary', 'full'] },
256
+ wait: { type: 'boolean', description: 'When true, wait for terminal status before returning digest.' },
257
+ wait_ms: { type: 'number' },
258
+ }, ['job_id']),
259
+ definition('get_artifact', 'Read one bounded Evidence Plane artifact by id. Large content remains bounded.', { artifact_id: { type: 'string' }, repo_id: repoId, max_bytes: { type: 'number' } }, ['artifact_id', 'repo_id']),
260
+ definition('repository_change_verify', 'Composite: verify checkout/SHA, apply bounded patch, run checks, return first failure inline without get_job/get_artifact follow-ups.', {
261
+ repo_id: repoId,
262
+ expected_branch: { type: 'string' },
263
+ expected_head: { type: 'string' },
264
+ expected_file_shas: { type: 'object', additionalProperties: { type: 'string' } },
265
+ patch: { type: 'string', description: 'Unified diff applied with git apply.' },
266
+ allowed_paths: { type: 'array', items: { type: 'string' } },
267
+ checks: { type: 'array', items: { type: 'string' } },
268
+ check_timeout_ms: { type: 'number' },
269
+ }, [], false),
270
+ definition('list_jobs', 'List durable Execution Jobs for one repository. Summary is the default.', {
271
+ repo_id: repoId,
272
+ limit: { type: 'number' },
273
+ detail_level: { type: 'string', enum: ['summary', 'full'] },
274
+ }),
275
+ definition('cancel_job', 'Cancel one queued or running durable Execution Job.', { job_id: { type: 'string' }, repo_id: repoId, reason: { type: 'string' } }, ['job_id'], false),
276
+ definition('controller_ready', 'Return one binary Runtime readiness decision with bounded diagnostic evidence.', {
277
+ repo_id: repoId,
278
+ }),
279
+ definition('repository_runtime_snapshot', 'Read the materialized runtime projection without scanning historical state.', { repo_id: repoId }),
280
+ definition('schedule_dedupe_report', 'Read-only report that groups duplicate schedules by semantic trigger/action identity.', {
281
+ repo_id: repoId,
282
+ }, ['repo_id']),
283
+ definition('schedule_dedupe_apply', 'Pause duplicate schedules after explicit authorization, keeping one canonical enabled schedule per semantic identity.', {
284
+ repo_id: repoId,
285
+ dry_run: { type: 'boolean', description: 'When true, only returns the proposed changes.' },
286
+ confirm_authorization: { type: 'boolean', description: 'Must be true unless dry_run is true.' },
287
+ }, ['repo_id']),
288
+ definition('runtime_performance_diagnostics', 'Diagnose forge host performance, orphan workers, Local Controller presence, and cleanup candidates.', {
289
+ repo_id: repoId,
290
+ include_processes: { type: 'boolean', description: 'Include bounded forge related process samples. Defaults to true.' },
291
+ include_temp_dirs: { type: 'boolean', description: 'Include bounded forge temporary directory scan. Defaults to true.' },
292
+ cleanup_preview: { type: 'boolean', description: 'Return a no-side-effect cleanup plan for orphan workers and stale temp entries.' },
293
+ }),
294
+ definition('capability_recovery_probe', 'Read-only Runtime diagnostic evidence. This tool never starts, stops, restarts, repairs, or replaces Runtime modules.', {
295
+ repo_id: repoId,
296
+ recent_errors: { type: 'array', items: { type: 'string' } },
297
+ command_preview_available: { type: 'boolean' },
298
+ command_execute_available: { type: 'boolean' },
299
+ issue_tools_available: { type: 'boolean' },
300
+ job_tools_available: { type: 'boolean' },
301
+ }),
302
+ definition('capability_recovery_plan', 'Return a diagnostic handoff plan without Runtime lifecycle actions or automatic source repair.', {
303
+ repo_id: repoId,
304
+ recent_errors: { type: 'array', items: { type: 'string' } },
305
+ }),
306
+ definition('capability_recovery_apply', 'Apply one currently supported bounded recovery action after explicit authorization. Runtime lifecycle actions are outside this surface.', {
307
+ repo_id: repoId,
308
+ action_id: { type: 'string' },
309
+ confirm_authorization: { type: 'boolean' },
310
+ authorization: { type: 'string', description: 'Must equal action_id for actions that require authorization.' },
311
+ reason: { type: 'string' },
312
+ min_age_minutes: { type: 'number' },
313
+ max_candidates: { type: 'number' },
314
+ }, ['action_id'], false),
315
+ definition('runtime_maintenance_status', 'Read the self-contained runtime maintenance plan without using repository_command_execute or Local Job tickets.', {
316
+ repo_id: repoId,
317
+ min_age_minutes: { type: 'number' },
318
+ max_candidates: { type: 'number' },
319
+ cancel_pending_approvals: { type: 'boolean' },
320
+ }),
321
+ definition('runtime_maintenance_apply', 'Apply one bounded runtime maintenance action without repository_command_execute or Local Job tickets.', {
322
+ repo_id: repoId,
323
+ action_id: { type: 'string', enum: ['local_jobs_reconcile', 'quarantine_unreadable_local_jobs', 'runtime_storage_finalize_relocation', 'rebuild_projection', 'full_maintenance_pass'] },
324
+ confirm_maintenance: { type: 'boolean' },
325
+ authorization: { type: 'string', description: 'Must equal action_id.' },
326
+ min_age_minutes: { type: 'number' },
327
+ max_candidates: { type: 'number' },
328
+ cancel_pending_approvals: { type: 'boolean' },
329
+ }, ['action_id', 'confirm_maintenance', 'authorization'], false),
330
+ definition('workspace_auth_status', 'Summarize Workspace/Gmail auth readiness without returning or persisting secrets.', {
331
+ repo_id: repoId,
332
+ }),
333
+ definition('workspace_auth_login_prepare', 'Prepare a state-protected local Google Workspace/Gmail OAuth login with PKCE and Keychain persistence.', {
334
+ repo_id: repoId,
335
+ service: { type: 'string', enum: ['gmail', 'calendar', 'tasks', 'google-workspace'] },
336
+ scopes: { type: 'array', items: { type: 'string' } },
337
+ redirect_uri: { type: 'string' },
338
+ }),
339
+ definition('external_filesystem_targets_list', 'List pre-authorized external filesystem targets. Does not expose arbitrary absolute-path access.', {
340
+ repo_id: repoId,
341
+ }),
342
+ definition('external_filesystem_grant_preview', 'Preview a read-only external filesystem grant for a narrow absolute directory without writing config.', {
343
+ repo_id: repoId,
344
+ grant_key: { type: 'string' },
345
+ root_path: { type: 'string' },
346
+ mode: { type: 'string', enum: ['read', 'copy_into_repo'] },
347
+ expires_in_minutes: { type: 'number', description: 'Optional expiry in minutes, capped at 24h. Defaults to 8h.' },
348
+ reason: { type: 'string' },
349
+ }, ['grant_key', 'root_path', 'reason']),
350
+ definition('external_filesystem_grant_apply', 'Apply a previously previewed read-only external filesystem grant with explicit authorization.', {
351
+ repo_id: repoId,
352
+ grant_key: { type: 'string' },
353
+ root_path: { type: 'string' },
354
+ mode: { type: 'string', enum: ['read', 'copy_into_repo'] },
355
+ expires_in_minutes: { type: 'number', description: 'Optional expiry in minutes, capped at 24h. Defaults to 8h.' },
356
+ reason: { type: 'string' },
357
+ preview_ticket_id: { type: 'string' },
358
+ confirm_authorization: { type: 'boolean' },
359
+ }, ['grant_key', 'root_path', 'reason', 'preview_ticket_id', 'confirm_authorization'], false),
360
+ definition('external_filesystem_text_snapshot', 'Read a bounded text/directory snapshot from a pre-authorized external filesystem target key.', {
361
+ repo_id: repoId,
362
+ target_key: { type: 'string' },
363
+ path: { type: 'string' },
364
+ max_chars: { type: 'number' },
365
+ }, ['target_key']),
366
+ definition('runtime_storage_repair_preview', 'Preview repo-scoped local-jobs runtime storage repair candidates without mutation.', {
367
+ repo_id: repoId,
368
+ min_age_minutes: { type: 'number' },
369
+ max_candidates: { type: 'number' },
370
+ }),
371
+ definition('runtime_storage_repair_apply', 'Apply safe repo-scoped local-jobs runtime storage repairs after explicit confirmation.', {
372
+ repo_id: repoId,
373
+ candidate_ids: { type: 'array', items: { type: 'string' } },
374
+ min_age_minutes: { type: 'number' },
375
+ max_candidates: { type: 'number' },
376
+ confirm_repair: { type: 'boolean' },
377
+ }, ['confirm_repair'], false),
378
+ definition('list_plugins', 'List repository plugins, or controller-scoped plugins when repo_id is omitted.', {
379
+ repo_id: repoId,
380
+ }),
381
+ definition('get_plugin', 'Read one repository or controller-scoped plugin manifest including action schemas and policy requirements.', {
382
+ repo_id: repoId,
383
+ plugin_id: { type: 'string' },
384
+ }, ['plugin_id']),
385
+ definition('plugin_action_execute', 'Execute one typed repository or controller-scoped plugin action through the plugin provider authority. rh_context exposes plugin schemas/policy; rh_work does not execute plugin capabilities. For confirmation=authorization, normal host permission is authoritative and an exact-target Forge capability grant may be reused; do not set confirm_authorization merely because an ordinary authorization-class action was previously allowed. Strong-confirmation actions still require their explicit confirmation contract.', {
386
+ repo_id: repoId,
387
+ plugin_id: { type: 'string' },
388
+ action_id: { type: 'string' },
389
+ request_id: { type: 'string' },
390
+ work_id: { type: 'string', description: 'Optional existing remote-effect Work that should own the successful typed plugin receipt.' },
391
+ arguments: { type: 'object' },
392
+ timeout_ms: { type: 'number' },
393
+ confirm_authorization: { type: 'boolean', description: 'Explicit confirmation flag for strong_confirmation actions. Ordinary confirmation=authorization actions follow the host permission model and do not require this field.' },
394
+ confirmation_text: { type: 'string', description: 'Exact confirmation text for strong_confirmation actions only.' },
395
+ }, ['plugin_id', 'action_id', 'request_id'], false),
396
+ definition('toolchain_plugin_summary', 'Return a redacted, low-interception plugin summary without raw config files or full action schemas.', {
397
+ repo_id: repoId,
398
+ plugin_id: { type: 'string' },
399
+ }, ['plugin_id']),
400
+ definition('work_result_summary', 'Return a redacted job result summary with failure class and suggested next actions. Does not return raw stdout or stderr.', {
401
+ repo_id: repoId,
402
+ job_id: { type: 'string' },
403
+ }, ['job_id']),
404
+ definition('work_status_digest', 'Return a redacted work status digest using a neutral work_ref. Does not return raw stdout or stderr.', {
405
+ repo_id: repoId,
406
+ work_ref: { type: 'string' },
407
+ }, ['work_ref']),
408
+ definition('model_clients_summary', 'List enabled model clients and DeepSeek adapter configuration state. Policy remains enforced by forge.', {
409
+ repo_id: repoId,
410
+ }),
411
+ definition('model_control_plane_summary', 'Summarize primary and backup model controllers, handoff modes, and concurrency policy.', {
412
+ repo_id: repoId,
413
+ }),
414
+ definition('deepseek_tool_manifest', 'Return DeepSeek function-calling tool manifests for the low-interception forge surface.', {
415
+ repo_id: repoId,
416
+ }),
417
+ definition('deepseek_tool_call_prepare', 'Translate one DeepSeek function call into a forge operation without executing it.', {
418
+ repo_id: repoId,
419
+ function_name: { type: 'string' },
420
+ function_arguments: { type: 'object' },
421
+ }, ['function_name', 'function_arguments']),
422
+ definition('deepseek_controller_manifest', 'Return DeepSeek backup-controller manifest, boundaries, and function tools.', {
423
+ repo_id: repoId,
424
+ }),
425
+ definition('deepseek_controller_handoff_prepare', 'Prepare a safe DeepSeek backup-controller handoff packet without calling the external model.', {
426
+ repo_id: repoId,
427
+ reason: { type: 'string', enum: ['manual', 'chatgpt_platform_blocked', 'chatgpt_unavailable', 'parallel_review', 'local_gui_request'] },
428
+ objective: { type: 'string' },
429
+ current_controller: { type: 'string' },
430
+ blocked_tool_name: { type: 'string' },
431
+ recent_safe_error: { type: 'string' },
432
+ }),
433
+ definition('deepseek_controller_request_prepare', 'Prepare a DeepSeek chat-completions request for backup controller mode without sending it.', {
434
+ repo_id: repoId,
435
+ reason: { type: 'string', enum: ['manual', 'chatgpt_platform_blocked', 'chatgpt_unavailable', 'parallel_review', 'local_gui_request'] },
436
+ objective: { type: 'string' },
437
+ user_message: { type: 'string' },
438
+ current_controller: { type: 'string' },
439
+ blocked_tool_name: { type: 'string' },
440
+ recent_safe_error: { type: 'string' },
441
+ model: { type: 'string' },
442
+ }),
443
+ definition('review_artifacts_prepare', 'Create bounded repo-local review artifact roots for browser/iOS screenshot review workflows.', { repo_id: repoId }, [], false),
444
+ definition('review_artifacts_index', 'Index bounded repo-local browser/iOS screenshots, logs, and build reports for visual review.', { repo_id: repoId, limit: { type: 'number' } }),
445
+ definition('browser_review_packet', 'Build a browser visual review packet from indexed browser screenshots.', { repo_id: repoId, limit: { type: 'number' } }),
446
+ definition('ios_review_packet', 'Build or capture an iOS visual review packet from simulator screenshots and logs.', {
447
+ repo_id: repoId,
448
+ udid: { type: 'string' },
449
+ label: { type: 'string' },
450
+ capture: { type: 'boolean' },
451
+ limit: { type: 'number' },
452
+ }, [], false),
453
+ definition('workflow_watchdog_report', 'Diagnose stuck repository workflows across execution jobs, local bridge jobs, schedules, and runtime processes.', {
454
+ repo_id: repoId,
455
+ stale_minutes: { type: 'number' },
456
+ include_processes: { type: 'boolean' },
457
+ }),
458
+ definition('ios_xcode_status', 'Check local Xcode, xcodebuild, and simctl availability without mutation.', { repo_id: repoId }),
459
+ definition('ios_simulators_list', 'List available iOS Simulator devices using structured simctl JSON output.', {
460
+ repo_id: repoId,
461
+ runtime: { type: 'string' },
462
+ name: { type: 'string' },
463
+ }),
464
+ definition('ios_project_discover', 'Discover iOS workspaces, projects, Package.swift, and Info.plist files inside the repository.', { repo_id: repoId }),
465
+ definition('ios_schemes_list', 'List Xcode schemes for a repository-bounded workspace or project.', {
466
+ repo_id: repoId,
467
+ workspace: { type: 'string' },
468
+ project: { type: 'string' },
469
+ }),
470
+ definition('ios_simulator_boot', 'Boot an explicitly selected iOS Simulator UDID. Requires authorization.', {
471
+ repo_id: repoId,
472
+ udid: { type: 'string' },
473
+ open_simulator: { type: 'boolean' },
474
+ confirm_authorization: { type: 'boolean' },
475
+ timeout_ms: { type: 'number' },
476
+ }, ['udid', 'confirm_authorization'], false),
477
+ definition('ios_app_build', 'Build an iOS app into .forge/ios/DerivedData using xcodebuild structured arguments.', {
478
+ repo_id: repoId,
479
+ scheme: { type: 'string' },
480
+ udid: { type: 'string' },
481
+ workspace: { type: 'string' },
482
+ project: { type: 'string' },
483
+ configuration: { type: 'string' },
484
+ timeout_ms: { type: 'number' },
485
+ }, ['scheme'], false),
486
+ definition('ios_app_install', 'Install a bounded .app product from .forge/ios/DerivedData into a booted simulator. Requires authorization.', {
487
+ repo_id: repoId,
488
+ udid: { type: 'string' },
489
+ app_path: { type: 'string' },
490
+ confirm_authorization: { type: 'boolean' },
491
+ }, ['udid', 'app_path', 'confirm_authorization'], false),
492
+ definition('ios_app_launch', 'Launch a simulator app by bundle id with structured launch arguments. Requires authorization.', {
493
+ repo_id: repoId,
494
+ udid: { type: 'string' },
495
+ bundle_id: { type: 'string' },
496
+ arguments: { type: 'array', items: { type: 'string' } },
497
+ confirm_authorization: { type: 'boolean' },
498
+ }, ['udid', 'bundle_id', 'confirm_authorization'], false),
499
+ definition('ios_simulator_screenshot', 'Capture a simulator screenshot to .forge/ios/screenshots as a bounded artifact.', {
500
+ repo_id: repoId,
501
+ udid: { type: 'string' },
502
+ label: { type: 'string' },
503
+ }, ['udid'], false),
504
+ definition('ios_simulator_log_tail', 'Collect a bounded recent simulator log tail into .forge/ios/logs.', {
505
+ repo_id: repoId,
506
+ udid: { type: 'string' },
507
+ process: { type: 'string' },
508
+ last: { type: 'string' },
509
+ max_bytes: { type: 'number' },
510
+ }),
511
+ definition('ios_ui_smoke_test', 'Compose build, boot, launch, screenshot, and bounded logs for simulator UI review. Requires authorization.', {
512
+ repo_id: repoId,
513
+ udid: { type: 'string' },
514
+ scheme: { type: 'string' },
515
+ bundle_id: { type: 'string' },
516
+ workspace: { type: 'string' },
517
+ project: { type: 'string' },
518
+ configuration: { type: 'string' },
519
+ app_path: { type: 'string' },
520
+ screenshot_label: { type: 'string' },
521
+ confirm_authorization: { type: 'boolean' },
522
+ }, ['udid', 'scheme', 'bundle_id', 'confirm_authorization'], false),
523
+ definition('runtime_cleanup_preview', 'Preview stale forge temp directories, terminal local jobs, and historical attention cleanup candidates.', {
524
+ repo_id: repoId,
525
+ min_age_minutes: { type: 'number' },
526
+ include_temp_dirs: { type: 'boolean' },
527
+ include_terminal_local_jobs: { type: 'boolean' },
528
+ include_legacy_runs: { type: 'boolean' },
529
+ include_historical_attention: { type: 'boolean' },
530
+ max_candidates: { type: 'number' },
531
+ }),
532
+ definition('runtime_cleanup_apply', 'Apply safe cleanup candidates. Requires confirm_cleanup=true and remains limited to explicit forge candidates.', {
533
+ repo_id: repoId,
534
+ min_age_minutes: { type: 'number' },
535
+ include_temp_dirs: { type: 'boolean' },
536
+ include_terminal_local_jobs: { type: 'boolean' },
537
+ include_legacy_runs: { type: 'boolean' },
538
+ include_historical_attention: { type: 'boolean' },
539
+ max_candidates: { type: 'number' },
540
+ confirm_cleanup: { type: 'boolean' },
541
+ }, [], false),
542
+ definition('request_release_gate', 'Return an explicit external-Controller handoff for release evidence. Push, tag, and publish remain separately authorized.', { repo_id: repoId, request_id: { type: 'string' } }, [], false),
543
+ ];
544
+
545
+ export const connectorExposedTools = runtimeToolDefinitions.map((tool) => tool.name);
546
+ export const currentCallableTools = new Set(connectorExposedTools);