@moretea-labs/forge 1.6.0 → 1.7.1

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 (469) hide show
  1. package/AGENTS.md +4 -0
  2. package/CHANGELOG.md +39 -0
  3. package/CLAUDE.md +4 -0
  4. package/README.md +2 -2
  5. package/README.zh-CN.md +1 -1
  6. package/SKILL.md +2 -2
  7. package/THIRD_PARTY_NOTICES.md +1 -1
  8. package/agents/openai.yaml +1 -1
  9. package/assets/hooks/hook-input.sh +11 -8
  10. package/assets/hooks/lib/session-state.sh +10 -7
  11. package/assets/hooks/lib/workflow-state.sh +13 -177
  12. package/assets/hooks/post-tool-observer.sh +8 -2
  13. package/assets/hooks/prompt-guard.sh +5 -81
  14. package/assets/hooks/session-start-context.sh +56 -1
  15. package/assets/partials/05-workflow.partial.md +1 -1
  16. package/assets/partials-agents/02-operating-mode.partial.md +2 -0
  17. package/assets/partials-agents/03-orchestration.partial.md +1 -1
  18. package/assets/plugin-registry.v1.json +3 -3
  19. package/assets/reference-configs/document-generation.md +1 -1
  20. package/assets/reference-configs/harness-overview.md +1 -1
  21. package/assets/reference-configs/sprint-contracts.md +3 -3
  22. package/assets/skill-version.json +2 -2
  23. package/assets/templates/contract.template.md +2 -7
  24. package/assets/templates/helpers/capture-plan.sh +2 -2
  25. package/assets/templates/helpers/check-architecture-sync.sh +17 -0
  26. package/assets/templates/helpers/check-task-workflow.sh +4 -4
  27. package/assets/templates/helpers/contract-worktree.sh +1 -21
  28. package/assets/templates/helpers/ensure-task-workflow.sh +11 -36
  29. package/assets/templates/helpers/inspect-project-state.ts +8 -6
  30. package/assets/templates/helpers/migrate-project-template.sh +22 -45
  31. package/assets/templates/helpers/migrate-workflow-docs.ts +9 -7
  32. package/assets/templates/helpers/new-plan.sh +1 -1
  33. package/assets/templates/helpers/plan-to-todo.sh +12 -37
  34. package/assets/templates/helpers/ship-worktrees.sh +2 -29
  35. package/assets/templates/helpers/verify-contract.sh +1 -111
  36. package/assets/templates/helpers/verify-sprint.sh +3 -180
  37. package/assets/templates/helpers/workflow-contract.ts +5 -1
  38. package/assets/templates/plan.template.md +1 -1
  39. package/assets/templates/review.template.md +9 -34
  40. package/assets/workflow-contract.v1.json +10 -19
  41. package/docs/README.md +10 -10
  42. package/docs/architecture/CURRENT.md +178 -0
  43. package/docs/architecture/EVOLUTION.md +42 -0
  44. package/docs/architecture/current/README.md +4 -156
  45. package/docs/architecture/decisions/20260803-release-identity-binding-and-exit-policy.md +2 -2
  46. package/docs/architecture/decisions/20260823-immediate-controller-relay.md +53 -0
  47. package/docs/architecture/decisions/20260826-browser-runtime-v2.md +73 -0
  48. package/docs/architecture/history/README.md +7 -0
  49. package/docs/architecture/{chatgpt-handoff-facade.md → history/chatgpt-handoff-facade.md} +4 -0
  50. package/docs/architecture/{global-hook-runtime.md → history/global-hook-runtime.md} +7 -3
  51. package/docs/architecture/{ios-semantic-automation-provider-v2.md → history/ios-semantic-automation-provider-v2.md} +6 -2
  52. package/docs/architecture/history.md +3 -34
  53. package/docs/architecture/index.md +15 -98
  54. package/docs/architecture/modules/controller-runtime/transport-lifecycle.md +1 -1
  55. package/docs/architecture/reviews/2026-08-22-semantic-harness-convergence-acceptance.md +39 -0
  56. package/docs/architecture/versions/1.6.md +38 -0
  57. package/docs/architecture/versions/1.7.md +41 -0
  58. package/docs/forge-chatgpt-browser-engine.md +2 -2
  59. package/docs/forge-chatgpt-mcp-setup.md +4 -28
  60. package/docs/forge-chatgpt-supervised-automation.md +3 -3
  61. package/docs/forge-github-issue-launcher.md +1 -1
  62. package/docs/forge-plugin-management.md +1 -1
  63. package/docs/forge-runtime-self-healing-loop.md +1 -1
  64. package/docs/operations/controller-browser-plugin.md +26 -6
  65. package/docs/operations/controller-performance-and-502.md +143 -0
  66. package/docs/operations/controller-reliability-runbook.md +1 -1
  67. package/docs/operations/features.md +2 -2
  68. package/docs/operations/github-repository.md +1 -1
  69. package/docs/operations/homebrew.md +2 -2
  70. package/docs/operations/mcp-tool-exposure.md +5 -3
  71. package/docs/wiki/Architecture.md +6 -6
  72. package/docs/wiki/Implementation.md +2 -2
  73. package/docs/wiki/Integrations.md +2 -2
  74. package/docs/wiki/Work-Lifecycle.md +1 -1
  75. package/package.json +33 -11
  76. package/scripts/activate-source-baseline.ts +17 -13
  77. package/scripts/architecture-event.ts +2 -820
  78. package/scripts/architecture-queue.sh +2 -645
  79. package/scripts/archive-architecture-request.sh +2 -242
  80. package/scripts/archive-workflow.sh +1 -291
  81. package/scripts/benchmark-background-check-overlap.ts +228 -0
  82. package/scripts/benchmark-mcp-host.sh +117 -0
  83. package/scripts/benchmark-mcp-transport.ts +170 -0
  84. package/scripts/benchmark-quality-harness.ts +146 -0
  85. package/scripts/benchmark-route-session-concurrency.ts +207 -6
  86. package/scripts/benchmark-thin-harness-mcp-e2e.ts +7 -1
  87. package/scripts/benchmark-typescript-navigation.ts +186 -0
  88. package/scripts/benchmark-work-efficiency.ts +334 -0
  89. package/scripts/capability-config.ts +2 -392
  90. package/scripts/capability-resolver.ts +2 -503
  91. package/scripts/capture-plan.sh +1 -332
  92. package/scripts/check-agent-tooling.sh +2 -1558
  93. package/scripts/check-architecture-sync.sh +2 -371
  94. package/scripts/check-brain-manifest.sh +2 -253
  95. package/scripts/check-context-files.sh +2 -47
  96. package/scripts/check-deploy-sql-order.sh +2 -115
  97. package/scripts/check-mcp-compatibility.ts +14 -0
  98. package/scripts/check-runtime-architecture.mjs +349 -79
  99. package/scripts/check-skill-version.ts +3 -191
  100. package/scripts/check-source-duplication.mjs +61 -0
  101. package/scripts/check-stable-baseline.ts +92 -0
  102. package/scripts/check-task-sync.sh +2 -63
  103. package/scripts/check-task-workflow.sh +2 -1000
  104. package/scripts/codex-handoff-resume.sh +2 -267
  105. package/scripts/context-contract-sync.sh +2 -514
  106. package/scripts/contract-run.ts +2 -463
  107. package/scripts/contract-worktree.sh +1 -722
  108. package/scripts/ensure-task-workflow.sh +1 -1225
  109. package/scripts/host-temporary-cloud-mcp-e2e.sh +265 -0
  110. package/scripts/inspect-project-state.ts +4 -279
  111. package/scripts/install-standalone-recovery.ts +24 -0
  112. package/scripts/lib/project-init-lib.sh +22 -46
  113. package/scripts/lib/run-forge-helper.sh +19 -0
  114. package/scripts/lib/run-forge-helper.ts +26 -0
  115. package/scripts/migrate-project-template.sh +1 -1189
  116. package/scripts/migrate-workflow-docs.ts +4 -412
  117. package/scripts/new-plan.sh +1 -180
  118. package/scripts/new-spec.sh +1 -47
  119. package/scripts/new-sprint.sh +1 -46
  120. package/scripts/plan-to-todo.sh +1 -796
  121. package/scripts/prepare-codex-handoff.sh +2 -201
  122. package/scripts/prepare-handoff.sh +1 -78
  123. package/scripts/refresh-current-status.sh +2 -467
  124. package/scripts/run-governed-gate.ts +5 -1
  125. package/scripts/select-agent-context-blocks.sh +2 -64
  126. package/scripts/ship-worktrees.sh +1 -558
  127. package/scripts/smoke-ios-physical-device.ts +4 -2
  128. package/scripts/smoke-runtime-recovery.ts +1 -35
  129. package/scripts/smoke-schedule-engine.ts +1 -20
  130. package/scripts/sprint-backlog.sh +1 -834
  131. package/scripts/stage-runtime-release.ts +2 -1
  132. package/scripts/summarize-failures.sh +2 -123
  133. package/scripts/switch-plan.sh +1 -150
  134. package/scripts/sync-brain-docs.sh +2 -379
  135. package/scripts/sync-generated-authority.mjs +175 -0
  136. package/scripts/verify-contract.sh +2 -703
  137. package/scripts/verify-forge-runtime.sh +0 -1
  138. package/scripts/verify-sprint.sh +1 -677
  139. package/scripts/workflow-contract.ts +4 -205
  140. package/scripts/workstream-sync.sh +2 -261
  141. package/src/cli/agent-jobs/executor-health.ts +1 -1
  142. package/src/cli/commands/init-hook.ts +3 -3
  143. package/src/cli/commands/mcp.ts +9 -5
  144. package/src/cli/commands/plugin.ts +12 -3
  145. package/src/cli/commands/recovery.ts +25 -3
  146. package/src/cli/commands/runtime.ts +55 -3
  147. package/src/cli/commands/security.ts +12 -1
  148. package/src/cli/commands/setup-profile.ts +31 -21
  149. package/src/cli/controller/check-runner.ts +113 -5
  150. package/src/cli/controller/composite-result.ts +1 -1
  151. package/src/cli/controller/context/focus.ts +51 -0
  152. package/src/cli/controller/context/instruction-context.ts +114 -0
  153. package/src/cli/controller/context/known-paths.ts +76 -0
  154. package/src/cli/controller/context/query-planning.ts +110 -0
  155. package/src/cli/controller/context/rule-resolution.ts +532 -0
  156. package/src/cli/controller/context/source-materializer.ts +278 -0
  157. package/src/cli/controller/context/structural.ts +16 -0
  158. package/src/cli/controller/context/types.ts +286 -0
  159. package/src/cli/controller/context-pack.ts +828 -487
  160. package/src/cli/controller/launch-agents.ts +77 -2
  161. package/src/cli/controller/operational-plan.ts +2 -2
  162. package/src/cli/controller/work-mode.ts +6 -4
  163. package/src/cli/editing/edit-session.ts +60 -7
  164. package/src/cli/github/contracts.ts +16 -0
  165. package/src/cli/github/github.ts +135 -16
  166. package/src/cli/github/session.ts +2 -1
  167. package/src/cli/installer/managed-entries.ts +15 -1
  168. package/src/cli/local-bridge/console-automations.ts +54 -78
  169. package/src/cli/local-bridge/console-view-models.ts +1 -35
  170. package/src/cli/local-bridge/facade-api.ts +37 -264
  171. package/src/cli/local-bridge/frontend/src/App.tsx +3 -3
  172. package/src/cli/local-bridge/frontend/src/features/automations/AutomationsView.tsx +23 -13
  173. package/src/cli/local-bridge/frontend/src/features/capabilities/CapabilitiesView.tsx +37 -4
  174. package/src/cli/local-bridge/frontend/src/features/overview/OverviewView.tsx +6 -4
  175. package/src/cli/local-bridge/frontend/src/lib/api.ts +1 -6
  176. package/src/cli/local-bridge/frontend/src/lib/routes.ts +1 -1
  177. package/src/cli/local-bridge/frontend/src/shell/Sidebar.tsx +2 -2
  178. package/src/cli/local-bridge/frontend/src/styles.css +1 -1
  179. package/src/cli/local-bridge/frontend/src/types.ts +5 -8
  180. package/src/cli/local-bridge/job-store.ts +1 -490
  181. package/src/cli/local-bridge/server.ts +2 -515
  182. package/src/cli/local-bridge/ui-dist/app.css +1 -1
  183. package/src/cli/local-bridge/ui-dist/app.js +3703 -3757
  184. package/src/cli/mcp/auth.ts +5 -5
  185. package/src/cli/mcp/instructions.ts +3 -2
  186. package/src/cli/mcp/legacy-tool-service.ts +10 -222
  187. package/src/cli/mcp/multi-repository.ts +16 -5
  188. package/src/cli/mcp/oauth.ts +175 -26
  189. package/src/cli/mcp/post-finalize-work-attribution.ts +150 -0
  190. package/src/cli/mcp/repository-tools.ts +282 -146
  191. package/src/cli/mcp/server.ts +586 -116
  192. package/src/cli/mcp/tool-capability-cache.ts +1 -1
  193. package/src/cli/mcp/tool-contract.ts +14 -0
  194. package/src/cli/mcp/toolset-selection.ts +1 -1
  195. package/src/cli/mcp/toolset.ts +44 -7
  196. package/src/cli/mcp/transports/http.ts +124 -14
  197. package/src/cli/mcp/transports/session-registry.ts +43 -5
  198. package/src/cli/mcp/types.ts +3 -3
  199. package/src/cli/repositories/command-classifier.ts +103 -21
  200. package/src/cli/repositories/command-executor.ts +78 -526
  201. package/src/cli/repositories/command-process.ts +108 -0
  202. package/src/cli/repositories/command-scope.ts +99 -41
  203. package/src/cli/repositories/controller-home.ts +7 -8
  204. package/src/cli/repositories/git-command-executor.ts +2 -0
  205. package/src/cli/repositories/locks.ts +53 -16
  206. package/src/cli/repositories/repository-snapshot.ts +124 -0
  207. package/src/cli/repositories/selected-path-actions.ts +17 -9
  208. package/src/cli/repositories/structured-git.ts +118 -6
  209. package/src/cli/repository/inspector.ts +563 -65
  210. package/src/cli/repository/session-cache.ts +58 -17
  211. package/src/cli/v81-entry.ts +1 -4
  212. package/src/effects/fs-transaction.ts +85 -17
  213. package/src/runtime/context/codegraph-read-provider.ts +233 -2
  214. package/src/runtime/context/codegraph-sidecar.cjs +74 -40
  215. package/src/runtime/context/generic-lsp-provider.ts +355 -0
  216. package/src/runtime/context/lsp-client.ts +283 -0
  217. package/src/runtime/context/semantic-navigation-contract.ts +61 -0
  218. package/src/runtime/context/semantic-navigation.ts +223 -0
  219. package/src/runtime/context/swift-navigation.ts +565 -0
  220. package/src/runtime/context/typescript-navigation.ts +226 -0
  221. package/src/runtime/control-plane/dispatch-priority.ts +28 -0
  222. package/src/runtime/control-plane/execution/direct-edit-work-completion.ts +48 -16
  223. package/src/runtime/control-plane/execution/edit-validation-coordinator.ts +86 -24
  224. package/src/runtime/control-plane/execution/repository-work-attribution.ts +106 -0
  225. package/src/runtime/control-plane/execution/retained-work-resume.ts +203 -0
  226. package/src/runtime/control-plane/execution/session-store.ts +18 -0
  227. package/src/runtime/control-plane/execution/verification-evidence.ts +58 -3
  228. package/src/runtime/control-plane/execution/work-completion-authority.ts +58 -0
  229. package/src/runtime/control-plane/execution/work-evidence-policy.ts +200 -0
  230. package/src/runtime/control-plane/execution/work-execution-support.ts +386 -0
  231. package/src/runtime/control-plane/execution/work-finalization-service.ts +1913 -0
  232. package/src/runtime/control-plane/execution/work-handle-authority.ts +96 -0
  233. package/src/runtime/control-plane/execution/work-handle-store.ts +27 -2
  234. package/src/runtime/control-plane/execution/work-lifecycle-audit.ts +258 -0
  235. package/src/runtime/control-plane/execution/work-operation-service.ts +468 -0
  236. package/src/runtime/control-plane/execution/work-path-scope.ts +37 -0
  237. package/src/runtime/control-plane/execution/work-preparation-service.ts +479 -0
  238. package/src/runtime/control-plane/execution/work-process-evidence.ts +129 -0
  239. package/src/runtime/control-plane/execution/work-remote-delivery.ts +215 -0
  240. package/src/runtime/control-plane/execution/work-task-receipt.ts +22 -18
  241. package/src/runtime/control-plane/execution/work-terminal-cleanup.ts +156 -11
  242. package/src/runtime/control-plane/execution/work-validation-reconciler.ts +22 -14
  243. package/src/runtime/control-plane/execution/work-verification-context.ts +56 -0
  244. package/src/runtime/control-plane/execution/work-verification-service.ts +388 -0
  245. package/src/runtime/control-plane/execution/work-verification-snapshot.ts +90 -9
  246. package/src/runtime/control-plane/facade/capability-registry.ts +129 -25
  247. package/src/runtime/control-plane/facade/controller-round-relay.ts +1118 -0
  248. package/src/runtime/control-plane/facade/controller-session-store.ts +302 -12
  249. package/src/runtime/control-plane/facade/goal-workloop-access.ts +17 -1
  250. package/src/runtime/control-plane/facade/goal-workloop.ts +928 -190
  251. package/src/runtime/control-plane/facade/index.ts +3 -0
  252. package/src/runtime/control-plane/facade/plan-contract-store.ts +275 -42
  253. package/src/runtime/control-plane/facade/repository-work-admission.ts +147 -0
  254. package/src/runtime/control-plane/facade/requirement-authority.ts +83 -0
  255. package/src/runtime/control-plane/facade/semantic-admission.ts +205 -0
  256. package/src/runtime/control-plane/facade/suggested-actions.ts +5 -1
  257. package/src/runtime/control-plane/facade/types.ts +90 -10
  258. package/src/runtime/control-plane/facade/work-contract-store.ts +157 -261
  259. package/src/runtime/control-plane/facade/work-state-machine.ts +250 -0
  260. package/src/runtime/control-plane/generated-cache-retention.ts +271 -0
  261. package/src/runtime/control-plane/global-scheduler/config.ts +44 -0
  262. package/src/runtime/control-plane/global-scheduler/dispatch-capacity.ts +80 -0
  263. package/src/runtime/control-plane/global-scheduler/durable-admission.ts +46 -0
  264. package/src/runtime/control-plane/global-scheduler/maintenance.ts +152 -0
  265. package/src/runtime/control-plane/global-scheduler/projection-refresh.ts +84 -0
  266. package/src/runtime/control-plane/global-scheduler/reconciliation.ts +3 -3
  267. package/src/runtime/control-plane/global-scheduler/scheduler.ts +278 -543
  268. package/src/runtime/control-plane/global-scheduler/source-scan.ts +59 -0
  269. package/src/runtime/control-plane/global-scheduler/state.ts +88 -0
  270. package/src/runtime/control-plane/global-scheduler/worker-attachment.ts +57 -0
  271. package/src/runtime/control-plane/global-scheduler/worker-exit-decision.ts +38 -0
  272. package/src/runtime/control-plane/global-scheduler/worker-exit-reconciler.ts +175 -0
  273. package/src/runtime/control-plane/global-scheduler/worker-launch.ts +111 -0
  274. package/src/runtime/control-plane/global-scheduler/worker-lifecycle-store.ts +64 -0
  275. package/src/runtime/control-plane/global-scheduler/worker-lifecycle.ts +150 -0
  276. package/src/runtime/control-plane/global-scheduler/worker-process.ts +119 -0
  277. package/src/runtime/control-plane/global-scheduler/worker-stderr.ts +60 -0
  278. package/src/runtime/control-plane/launcher/chatgpt-work-binding-store.ts +63 -0
  279. package/src/runtime/control-plane/launcher/chatgpt-work-continuation.ts +365 -117
  280. package/src/runtime/control-plane/launcher/launch-reservation-store.ts +89 -0
  281. package/src/runtime/control-plane/launcher/thin-launcher.ts +244 -11
  282. package/src/runtime/control-plane/persistence/controller-home-migration.ts +487 -0
  283. package/src/runtime/control-plane/persistence/requirement-store.ts +0 -12
  284. package/src/runtime/control-plane/persistence/sqlite-store.ts +33 -2
  285. package/src/runtime/control-plane/release-retention.ts +62 -2
  286. package/src/runtime/control-plane/repo-actor/registry.ts +4 -2
  287. package/src/runtime/control-plane/routing/route-policy.ts +24 -21
  288. package/src/runtime/control-plane/routing/workspace-admission.ts +70 -0
  289. package/src/runtime/control-plane/runtime-status-client.ts +0 -2
  290. package/src/runtime/diagnostics/mcp-timing.ts +13 -0
  291. package/src/runtime/diagnostics/mcp-transport-benchmark.ts +129 -0
  292. package/src/runtime/diagnostics/performance.ts +24 -1
  293. package/src/runtime/evidence/event-ledger.ts +1 -1
  294. package/src/runtime/evidence/process-check-execution.ts +18 -0
  295. package/src/runtime/execution/jobs/child-reference.ts +6 -2
  296. package/src/runtime/execution/jobs/store.ts +58 -4
  297. package/src/runtime/execution/jobs/types.ts +1 -1
  298. package/src/runtime/execution/managed-workspace.ts +203 -1
  299. package/src/runtime/execution/process-runtime/check-facade.ts +51 -4
  300. package/src/runtime/execution/process-runtime/check-result.ts +88 -0
  301. package/src/runtime/execution/process-runtime/check-runner-sidecar.ts +7 -1
  302. package/src/runtime/execution/process-runtime/check-scheduling.ts +114 -0
  303. package/src/runtime/execution/process-runtime/command-facade.ts +367 -40
  304. package/src/runtime/execution/process-runtime/gc.ts +38 -6
  305. package/src/runtime/execution/process-runtime/lightweight-managed.ts +1201 -0
  306. package/src/runtime/execution/process-runtime/persisted-check.ts +51 -5
  307. package/src/runtime/execution/process-runtime/resource-claims.ts +10 -6
  308. package/src/runtime/execution/process-runtime/runtime.ts +53 -3
  309. package/src/runtime/execution/process-runtime/store.ts +1 -0
  310. package/src/runtime/execution/process-runtime/types.ts +4 -12
  311. package/src/runtime/execution/thin-harness/async-process.ts +12 -2
  312. package/src/runtime/execution/thin-harness/search-worker.ts +54 -5
  313. package/src/runtime/execution/work-activity.ts +21 -0
  314. package/src/runtime/execution/workers/executor.ts +18 -61
  315. package/src/runtime/gateway/mcp/execution-tools.ts +35 -1852
  316. package/src/runtime/gateway/mcp/legacy-ios-tool-adapter.ts +61 -0
  317. package/src/runtime/gateway/mcp/process-tools.ts +83 -37
  318. package/src/runtime/gateway/mcp/router.ts +186 -84
  319. package/src/runtime/gateway/mcp/runtime-tool-definitions.ts +565 -0
  320. package/src/runtime/gateway/mcp/runtime-tools.ts +2378 -1947
  321. package/src/runtime/plugins/app-store-connect-adapter.ts +216 -47
  322. package/src/runtime/plugins/browser-adapter.ts +2662 -829
  323. package/src/runtime/plugins/browser-automation-service.ts +10 -0
  324. package/src/runtime/plugins/browser-handoff-host.ts +2 -25
  325. package/src/runtime/plugins/browser-handoff.ts +110 -5
  326. package/src/runtime/plugins/browser-macos-bridge.ts +701 -63
  327. package/src/runtime/plugins/browser-manifest-surface.ts +603 -0
  328. package/src/runtime/plugins/browser-native-session-service.ts +222 -0
  329. package/src/runtime/plugins/browser-node-bridge.ts +6 -34
  330. package/src/runtime/plugins/browser-provider-registry.ts +109 -0
  331. package/src/runtime/plugins/browser-runtime-contract.ts +154 -0
  332. package/src/runtime/plugins/browser-runtime.ts +193 -0
  333. package/src/runtime/plugins/browser-session-authority.ts +332 -0
  334. package/src/runtime/plugins/browser-session-store.ts +121 -0
  335. package/src/runtime/plugins/browser-session-types.ts +98 -0
  336. package/src/runtime/plugins/capability-authorization-grants.ts +354 -0
  337. package/src/runtime/plugins/desktop-operator-registration.ts +10 -4
  338. package/src/runtime/plugins/external-adapter.ts +358 -3
  339. package/src/runtime/plugins/external-unix-socket.ts +7 -1
  340. package/src/runtime/plugins/first-party-registry.ts +2 -0
  341. package/src/runtime/plugins/github-adapter.ts +125 -0
  342. package/src/runtime/plugins/ios/agent-device-provider.ts +1 -1
  343. package/src/runtime/plugins/ios/agent-device-typed-provider.ts +52 -9
  344. package/src/runtime/plugins/ios/remote-xpc-hid.ts +1171 -0
  345. package/src/runtime/plugins/ios-adapter.ts +106 -16
  346. package/src/runtime/plugins/ios-agent-device.ts +234 -64
  347. package/src/runtime/plugins/ios-physical-device.ts +1143 -392
  348. package/src/runtime/plugins/lightweight-action.ts +153 -0
  349. package/src/runtime/plugins/local-system-adapter.ts +123 -6
  350. package/src/runtime/plugins/macos-capability-broker.ts +47 -9
  351. package/src/runtime/plugins/plugin-action-sidecar.ts +59 -0
  352. package/src/runtime/plugins/plugin-management-adapter.ts +49 -8
  353. package/src/runtime/plugins/resend-adapter.ts +1 -1
  354. package/src/runtime/plugins/store.ts +330 -33
  355. package/src/runtime/plugins/types.ts +38 -3
  356. package/src/runtime/plugins/xiaohongshu-publish.ts +515 -0
  357. package/src/runtime/projections/git-status-sampler.ts +16 -16
  358. package/src/runtime/projections/materialized-view.ts +28 -10
  359. package/src/runtime/recovery/maintenance-executor.ts +426 -25
  360. package/src/runtime/root/mcp-transport.ts +180 -10
  361. package/src/runtime/root/package-connector-service.ts +230 -10
  362. package/src/runtime/root/package-runtime-release.ts +143 -17
  363. package/src/runtime/root/package-runtime-service.ts +461 -22
  364. package/src/runtime/root/release-manifest.ts +144 -18
  365. package/src/runtime/root/release-materialize.ts +125 -32
  366. package/src/runtime/root/release-store.ts +48 -11
  367. package/src/runtime/root/runtime.ts +23 -5
  368. package/src/runtime/root/service.ts +100 -29
  369. package/src/runtime/root/types.ts +12 -0
  370. package/src/runtime/safe-tooling/ios-development.ts +321 -63
  371. package/src/runtime/shared/trusted-executable.ts +62 -0
  372. package/src/runtime/shared/trusted-node-executable.ts +48 -0
  373. package/src/runtime/standalone-recovery/core.ts +1079 -240
  374. package/src/runtime/standalone-recovery/entry.ts +100 -24
  375. package/src/runtime/standalone-recovery/installer.ts +20 -4
  376. package/src/runtime/standalone-recovery/service-labels.ts +2 -0
  377. package/src/runtime/standalone-recovery/watchdog-heartbeat.ts +160 -0
  378. package/src/runtime/workflow/schedules/browser-probe.ts +81 -3
  379. package/src/runtime/workflow/schedules/engine.ts +364 -202
  380. package/src/runtime/workflow/schedules/github-issue-watch.ts +158 -0
  381. package/src/runtime/workflow/schedules/settlement.ts +64 -17
  382. package/src/runtime/workflow/schedules/store.ts +209 -19
  383. package/src/runtime/workflow/schedules/types.ts +2 -4
  384. package/src/runtime/workflow/schedules/work-continuation.ts +26 -13
  385. package/src/testing/test-governance.ts +8 -40
  386. package/assets/reference-configs/heartbeat-triage.md +0 -57
  387. package/assets/templates/helpers/harness-trace-grade.sh +0 -150
  388. package/assets/templates/helpers/heartbeat-triage.sh +0 -361
  389. package/assets/templates/helpers/maintenance-triage.sh +0 -167
  390. package/docs/architecture/current/approved-target-architecture.zh-CN.md +0 -1501
  391. package/docs/architecture/current/architecture-invariants.md +0 -331
  392. package/docs/architecture/current/automation-and-schedule-engine.md +0 -459
  393. package/docs/architecture/current/codegraph-context-provider.md +0 -238
  394. package/docs/architecture/current/control-plane-authority-inventory.md +0 -94
  395. package/docs/architecture/current/controller-repository-decoupling.md +0 -148
  396. package/docs/architecture/current/dispatch-and-agent-strategy.md +0 -373
  397. package/docs/architecture/current/entity-model.md +0 -612
  398. package/docs/architecture/current/external-plugin-governance.md +0 -396
  399. package/docs/architecture/current/failure-recovery.md +0 -447
  400. package/docs/architecture/current/governance.md +0 -213
  401. package/docs/architecture/current/human-interaction-plane.md +0 -87
  402. package/docs/architecture/current/implementation-status.md +0 -128
  403. package/docs/architecture/current/job-and-run-lifecycle.md +0 -413
  404. package/docs/architecture/current/legacy-governance.md +0 -58
  405. package/docs/architecture/current/local-workspace-target-grants.md +0 -70
  406. package/docs/architecture/current/migration-roadmap.md +0 -105
  407. package/docs/architecture/current/multi-repository-execution.md +0 -371
  408. package/docs/architecture/current/operations-runbook.md +0 -45
  409. package/docs/architecture/current/peer-supercontroller-runtime.md +0 -32
  410. package/docs/architecture/current/personal-assistant-plugin-baseline.md +0 -206
  411. package/docs/architecture/current/repository-access-modes.md +0 -102
  412. package/docs/architecture/current/route-policy.md +0 -15
  413. package/docs/architecture/current/route-session-concurrency.md +0 -85
  414. package/docs/architecture/current/runtime-architecture-simplification.md +0 -214
  415. package/docs/architecture/current/runtime-directory-map.md +0 -49
  416. package/docs/architecture/current/runtime-health-and-resource-lifecycle.md +0 -85
  417. package/docs/architecture/current/scheduler-and-resource-claims.md +0 -422
  418. package/docs/architecture/current/session-aware-execution-and-authorization.md +0 -77
  419. package/docs/architecture/current/system-overview.md +0 -169
  420. package/docs/architecture/current/target-requirements-traceability.md +0 -202
  421. package/docs/architecture/current/thin-harness-governance-policy.md +0 -32
  422. package/docs/architecture/current/thin-harness-v1.md +0 -321
  423. package/docs/architecture/current/verification-and-release-gates.md +0 -391
  424. package/docs/forge-autonomous-goal-loop.md +0 -9
  425. package/docs/forge-provider-configuration.md +0 -7
  426. package/docs/operations/chatgpt-personal-assistant-runtime.md +0 -93
  427. package/docs/operations/gmail-assistant-routines.md +0 -186
  428. package/docs/operations/personal-assistant-operator-guide.md +0 -61
  429. package/docs/operations/provider-configuration.md +0 -31
  430. package/scripts/harness-trace-grade.sh +0 -150
  431. package/scripts/heartbeat-triage.sh +0 -361
  432. package/scripts/maintenance-triage.sh +0 -167
  433. package/src/cli/local-bridge/frontend/src/features/settings/SettingsView.tsx +0 -2
  434. package/src/cli/repositories/goal-registry.ts +0 -239
  435. package/src/runtime/assistant/action-proposals.ts +0 -279
  436. package/src/runtime/assistant/intent.ts +0 -395
  437. package/src/runtime/assistant/model-provider.ts +0 -460
  438. package/src/runtime/assistant/openapi.ts +0 -223
  439. package/src/runtime/assistant/policy.ts +0 -89
  440. package/src/runtime/assistant/readiness.ts +0 -258
  441. package/src/runtime/assistant/routine-runtime.ts +0 -477
  442. package/src/runtime/assistant/schedule-binding.ts +0 -171
  443. package/src/runtime/assistant/standing-grants.ts +0 -375
  444. package/src/runtime/assistant/store.ts +0 -243
  445. package/src/runtime/assistant/types.ts +0 -135
  446. package/src/runtime/control-plane/goal-loop/config-facade.ts +0 -700
  447. package/src/runtime/control-plane/goal-loop/config-store.ts +0 -570
  448. package/src/runtime/control-plane/goal-loop/config-types.ts +0 -213
  449. package/src/runtime/control-plane/goal-loop/executor-router.ts +0 -109
  450. package/src/runtime/control-plane/goal-loop/failure-taxonomy.ts +0 -149
  451. package/src/runtime/control-plane/goal-loop/goal-contract-store.ts +0 -304
  452. package/src/runtime/control-plane/goal-loop/goal-loop-engine.ts +0 -1001
  453. package/src/runtime/control-plane/goal-loop/handoff-packet.ts +0 -160
  454. package/src/runtime/control-plane/goal-loop/index.ts +0 -13
  455. package/src/runtime/control-plane/goal-loop/local-tools.ts +0 -290
  456. package/src/runtime/control-plane/goal-loop/policy-gates.ts +0 -203
  457. package/src/runtime/control-plane/goal-loop/provider-dispatch.ts +0 -93
  458. package/src/runtime/control-plane/goal-loop/provider-registry.ts +0 -545
  459. package/src/runtime/control-plane/goal-loop/types.ts +0 -378
  460. package/src/runtime/control-plane/startup-recovery.ts +0 -198
  461. package/src/runtime/gateway/mcp/resource-policy.ts +0 -186
  462. package/src/runtime/personal-assistant/gmail-triage-manager.ts +0 -231
  463. package/src/runtime/personal-assistant/reporting-runtime.ts +0 -344
  464. package/src/runtime/personal-assistant/triage-runtime.ts +0 -748
  465. package/src/runtime/workflow/findings/store.ts +0 -204
  466. package/src/runtime/workflow/findings/types.ts +0 -58
  467. package/src/runtime/workflow/portfolio/engine.ts +0 -20
  468. package/src/runtime/workflow/portfolio/store.ts +0 -185
  469. package/src/runtime/workflow/portfolio/types.ts +0 -29
@@ -0,0 +1,565 @@
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
+ controller_authority_id: { type: 'string', description: 'Opaque durable authority for the currently dispatched ChatGPT controller round. Required with relay_scope_id for lifecycle mutation of relay-bound Work; rotates before a successor round while surviving MCP transport/Runtime rotation within the same round.' },
96
+ state_fingerprint: { type: 'string', description: 'Optional controller-observed semantic-state fingerprint. When omitted, Forge derives a mechanical fingerprint from current Requirement/Work/Handoff state.' },
97
+ max_rounds: { type: 'number', description: 'Mechanical immediate-relay round budget; defaults to 8 and cannot be loosened within an existing relay scope.' },
98
+ max_repeated_state: { type: 'number', description: 'Mechanical repeated-state fence; defaults to 2 repeated observations and cannot be loosened within an existing relay scope.' },
99
+ controller_id: { type: 'string', description: 'Stable external SuperController identity for controller_claim/release.' },
100
+ controller_type: { type: 'string', enum: ['chatgpt', 'codex', 'grok', 'claude', 'human'], description: 'Controller kind for claims and launcher_start.' },
101
+ session_id: { type: 'string', description: 'Controller-owned session identity used for an exclusive Work lease.' },
102
+ 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.' },
103
+ launch_reservation_ms: { type: 'number', description: 'Short duplicate-spawn reservation TTL for launcher_start or schedule_create; does not grant Work ownership.' },
104
+ executable: { type: 'string', description: 'External controller executable for launcher_start. This is owned by the Launcher, not the Kernel.' },
105
+ launch_args: { type: 'array', items: { type: 'string' }, description: 'Provider-specific arguments for launcher_start.' },
106
+ browser_session_id: { type: 'string', description: 'Saved Forge ChatGPT browser session to continue when controller_type=chatgpt.' },
107
+ conversation_url: { type: 'string', description: 'Explicit https://chatgpt.com conversation URL used when no saved Forge browser session exists.' },
108
+ continuation_prompt: { type: 'string', description: 'Bounded Work continuation instruction.' },
109
+ schedule_id: { type: 'string', description: 'Schedule identity for schedule_get/pause/resume/delete/trigger.' },
110
+ schedule_name: { type: 'string', description: 'Human-readable schedule name.' },
111
+ schedule_request_id: { type: 'string', description: 'Stable idempotency key for schedule_create.' },
112
+ 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.' },
113
+ probe_url: { type: 'string', description: 'Allowed URL to navigate or refresh for browser_watch/browser_keepalive.' },
114
+ probe_browser_session_id: { type: 'string', description: 'Existing Forge browser session used as the external observation target.' },
115
+ probe_selector: { type: 'string', description: 'Optional selector limiting text extraction for browser_watch.' },
116
+ probe_max_chars: { type: 'number', description: 'Bounded extracted text size for browser_watch.' },
117
+ probe_timeout_ms: { type: 'number', description: 'Bounded browser probe timeout.' },
118
+ include_terms: { type: 'array', items: { type: 'string' }, description: 'Optional case-insensitive terms; only matching normalized lines contribute to the observation fingerprint.' },
119
+ ignore_patterns: { type: 'array', items: { type: 'string' }, description: 'Optional regex patterns stripped before fingerprinting volatile text such as relative timestamps.' },
120
+ login_url_terms: { type: 'array', items: { type: 'string' }, description: 'Configured URL markers that classify the browser observation as authentication-required.' },
121
+ login_text_terms: { type: 'array', items: { type: 'string' }, description: 'Configured page-text markers that classify the browser observation as authentication-required.' },
122
+ wake_on_first_observation: { type: 'boolean', description: 'Defaults false so the first browser_watch occurrence records a silent baseline.' },
123
+ 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.' },
124
+ auth_required_prompt: { type: 'string', description: 'Optional ChatGPT continuation instruction when the probe detects a login marker.' },
125
+ trigger_type: { type: 'string', enum: ['interval', 'cron', 'calendar', 'condition', 'repository-event', 'dependency-checkpoint', 'manual'] },
126
+ every_minutes: { type: 'number', description: 'Interval trigger cadence in minutes.' },
127
+ cron_expression: { type: 'string' },
128
+ schedule_timezone: { type: 'string' },
129
+ catch_up_minutes: { type: 'number' },
130
+ calendar_at: { type: 'string' },
131
+ condition: { type: 'object' },
132
+ event_name: { type: 'string' },
133
+ event_id: { type: 'string' },
134
+ event_data: { type: 'object' },
135
+ dependency_job_ids: { type: 'array', items: { type: 'string' } },
136
+ max_failures: { type: 'number' },
137
+ cooldown_minutes: { type: 'number' },
138
+ daily_budget_minutes: { type: 'number' },
139
+ shadow_mode: { type: 'boolean', description: 'Defaults to true. Set false only after the continuation path has been validated.' },
140
+ backoff_base_minutes: { type: 'number' },
141
+ backoff_max_minutes: { type: 'number' },
142
+ include_occurrences: { type: 'boolean' },
143
+ plan_id: { type: 'string' },
144
+ plan_step_id: { type: 'string', description: 'PlanContract step identity. Used to bind a complex Goal Workloop start and to accept a validating step.' },
145
+ acceptance_rationale: { type: 'string', description: 'Controller rationale for plan_accept_step after reviewing the completed Work evidence against the Plan step acceptance criteria.' },
146
+ scope_key: { type: 'string', description: 'Stable normalized scope identity used to prevent overlapping active plans.' },
147
+ source_revision: { type: 'string', description: 'Repository revision observed during read-only planning preflight.' },
148
+ 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.' },
149
+ non_goals: { type: 'array', items: { type: 'string' } },
150
+ assumptions: { type: 'array', items: { type: 'string' } },
151
+ resolved_decisions: { type: 'array', items: { type: 'string' } },
152
+ stop_conditions: { type: 'array', items: { type: 'string' } },
153
+ replan_conditions: { type: 'array', items: { type: 'string' } },
154
+ integration_strategy: { type: 'string' },
155
+ superseded_by: { type: 'string' },
156
+ expected_files: { type: 'number' },
157
+ expected_changed_lines: { type: 'number' },
158
+ 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.' },
159
+ work_kind: { type: 'string', enum: ['repository_change', 'completed_no_change', 'read_only_review', 'investigation', 'local_effect', 'remote_effect', 'reconciliation'], description: 'Explicit technical Work evidence shape for operation=start. read_only_review is a recoverable source-frozen review lifecycle: it permits inspected-path/finding persistence without repository edits and only clean-finalizes after unchanged-source proof. local_effect/remote_effect represent effect-only execution; completed_no_change/investigation/reconciliation likewise do not imply a source mutation. None imply semantic completion; ChatGPT must still explicitly finalize after reviewing evidence.' },
160
+ scope_clear: { type: 'boolean' },
161
+ requires_investigation: { type: 'boolean' },
162
+ requires_long_running_checks: { type: 'boolean' },
163
+ requires_parallelism: { type: 'boolean' },
164
+ needs_dependencies: { type: 'boolean' },
165
+ requires_recovery: { type: 'boolean' },
166
+ 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.' },
167
+ requires_external_effect: { type: 'boolean' },
168
+ requires_approval: { type: 'boolean' },
169
+ requires_user_approval: { type: 'boolean' },
170
+ destructive: { type: 'boolean' },
171
+ remote_write: { type: 'boolean' },
172
+ secret_access: { type: 'boolean' },
173
+ approval_confirmed: { type: 'boolean' },
174
+ dry_run: { type: 'boolean', description: 'Defaults to true for repair.' },
175
+ 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.' },
176
+ check_id: { type: 'string' },
177
+ acceptance_criteria: { type: 'array', items: { type: 'string' } },
178
+ allowed_paths: { type: 'array', items: { type: 'string' } },
179
+ 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.' },
180
+ additional_likely_paths: { type: 'array', items: { type: 'string' }, description: 'Non-authoritative candidates discovered after Work start. Valid for continue; does not widen allowed_paths.' },
181
+ inspected_paths: { type: 'array', items: { type: 'string' }, description: 'Paths actually inspected during progressive discovery. Valid for continue; does not widen allowed_paths.' },
182
+ review_findings: { type: 'array', items: { type: 'string' }, description: 'Concise semantic findings for operation=continue on work_kind=read_only_review. Findings are source-bound durable review evidence and prevent clean completed_no_change finalization until a successor repair/review resolves them.' },
183
+ acceptance_evidence: { type: 'array', items: { type: 'object', required: ['criterion', 'evidence_ids', 'rationale'], properties: { criterion: { type: 'string', description: 'Exact declared Work acceptance criterion reviewed by the Controller.' }, evidence_ids: { type: 'array', items: { type: 'string' }, description: 'Durable evidence ids already attributed to this Work that support this exact criterion.' }, rationale: { type: 'string', description: 'Controller rationale for why the cited evidence satisfies this exact criterion.' } }, additionalProperties: false }, description: 'Operation=continue only. Explicit Controller-reviewed criterion-to-evidence bindings for no-check local_effect Work. Mechanical plugin/process attribution alone never implies semantic acceptance.' },
184
+ 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.' },
185
+ forbidden_paths: { type: 'array', items: { type: 'string' } },
186
+ constraints: {
187
+ type: 'object',
188
+ properties: {
189
+ max_changed_files: { type: 'number' },
190
+ max_changed_lines: { type: 'number' },
191
+ allow_commit: { type: 'boolean' },
192
+ allow_merge: { type: 'boolean' },
193
+ allow_cleanup: { type: 'boolean' },
194
+ allow_destructive: { type: 'boolean' },
195
+ require_handoff_on_ambiguity: { type: 'boolean' },
196
+ access_mode: { type: 'string', enum: ['request', 'full_access'] },
197
+ workspace_mode: { type: 'string', enum: ['current', 'isolated', 'auto'], description: 'Typed placement policy. isolated is an admission fence and cannot be downgraded to Direct Control.' },
198
+ require_worktree: { type: 'boolean', description: 'Typed placement policy. true requires isolated Work placement before routing.' },
199
+ direct_main_prohibited: { type: 'boolean', description: 'Typed admission fence. true forbids Direct Control/current-main repository mutation.' },
200
+ },
201
+ additionalProperties: true,
202
+ },
203
+ repair_operation: { type: 'string', enum: ['diagnose', 'repair', 'verify', 'handoff'] },
204
+ target: { type: 'string', enum: ['codex', 'grok', 'claude'], description: 'Explicit small-brain delegate target for operation=delegate. Delegation is never the default execution path.' },
205
+ available: { type: 'boolean', description: 'Whether the delegate target is currently available.' },
206
+ codex_available: { type: 'boolean' },
207
+ simulate_check: { type: 'boolean', description: 'Test hook: skip real check execution and use infrastructure_failed/check_failed flags.' },
208
+ infrastructure_failed: { type: 'boolean' },
209
+ check_failed: { type: 'boolean' },
210
+ authorize_destructive_cleanup: { type: 'boolean' },
211
+ commit: { type: 'boolean', description: 'Finalize override. Defaults to true only when the Work owns uncommitted changes.' },
212
+ merge: { type: 'boolean', description: 'Finalize override. Defaults to true for managed Work delivery.' },
213
+ cleanup: { type: 'boolean', description: 'Finalize/stop override. Defaults to true so managed worktrees close automatically.' },
214
+ target_branch: { type: 'string', description: 'Delivery branch; defaults to the repository default branch.' },
215
+ delete_branch: { type: 'boolean', description: 'Defaults to true after target-branch containment is proven.' },
216
+ no_ff: { type: 'boolean' },
217
+ 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.' },
218
+ 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.' },
219
+ 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.' },
220
+ reconcile_target_revision: { type: 'string', description: 'Exact already-integrated commit accepted by the reviewer.' },
221
+ reconcile_compared_paths: { type: 'array', items: { type: 'string' }, description: 'Complete exact path set changed from the Work base revision to reconcile_target_revision.' },
222
+ reconcile_rationale: { type: 'string', description: 'Bounded reviewer rationale for accepting the historical delivery.' },
223
+ reconcile_cleanup_proof: { type: 'string', description: 'Concrete proof that no owned cleanup remains or that cleanup is complete.' },
224
+ detail_level: { type: 'string', enum: ['summary', 'detail'] },
225
+ reason: { type: 'string', description: 'Bounded reason for a work stop or repair record.' },
226
+ }, [], false),
227
+ definition('work_get', 'Resume one Work by work_id or request_id. Repository scope is always enforced.', {
228
+ repo_id: repoId,
229
+ work_id: { type: 'string' },
230
+ request_id: { type: 'string' },
231
+ include_events: { type: 'boolean' },
232
+ wait: { type: 'boolean', description: 'When true, wait for terminal status before returning digest.' },
233
+ wait_ms: { type: 'number' },
234
+ }),
235
+ definition('work_list', 'List recent resumable Work for one repository.', {
236
+ repo_id: repoId,
237
+ limit: { type: 'number' },
238
+ }),
239
+ definition('work_cancel', 'Cancel one queued or running Work by work_id or request_id.', {
240
+ repo_id: repoId,
241
+ work_id: { type: 'string' },
242
+ request_id: { type: 'string' },
243
+ reason: { type: 'string' },
244
+ }, [], false),
245
+ definition('work_wait', 'Wait for one Work/ExecutionJob/managed process to reach a terminal status and return a bounded operation digest.', {
246
+ repo_id: repoId,
247
+ work_id: { type: 'string' },
248
+ request_id: { type: 'string' },
249
+ wait_ms: { type: 'number', description: 'Max wait in ms. Default 15000, max 120000.' },
250
+ }),
251
+ definition('git_diff_paths', 'Return a bounded Git diff and status for explicit repository-relative paths only.', {
252
+ repo_id: repoId,
253
+ paths: { type: 'array', items: { type: 'string' } },
254
+ staged: { type: 'boolean' },
255
+ max_bytes: { type: 'number' },
256
+ }, ['paths']),
257
+ definition('git_stage_paths', 'Stage explicit repository-relative paths only using git add --all -- <paths>.', {
258
+ repo_id: repoId,
259
+ paths: { type: 'array', items: { type: 'string' } },
260
+ }, ['paths'], false),
261
+ definition('git_commit_paths', 'Stage and commit explicit repository-relative paths only, leaving unrelated staged changes untouched.', {
262
+ repo_id: repoId,
263
+ paths: { type: 'array', items: { type: 'string' } },
264
+ message: { type: 'string' },
265
+ }, ['paths', 'message'], false),
266
+ definition('prepare_transfer_artifacts', 'Refresh rebuildable session continuation plus a selected-path patch transfer artifact when recovery context is needed.', {
267
+ repo_id: repoId,
268
+ reason: { type: 'string' },
269
+ }, [], false),
270
+ definition('get_job', 'Read one durable Execution Job. Summary is the default; opt in to full state only when needed.', {
271
+ job_id: { type: 'string' },
272
+ repo_id: repoId,
273
+ include_events: { type: 'boolean' },
274
+ detail_level: { type: 'string', enum: ['summary', 'full'] },
275
+ wait: { type: 'boolean', description: 'When true, wait for terminal status before returning digest.' },
276
+ wait_ms: { type: 'number' },
277
+ }, ['job_id']),
278
+ 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']),
279
+ definition('repository_change_verify', 'Composite: verify checkout/SHA, apply bounded patch, run checks, return first failure inline without get_job/get_artifact follow-ups.', {
280
+ repo_id: repoId,
281
+ expected_branch: { type: 'string' },
282
+ expected_head: { type: 'string' },
283
+ expected_file_shas: { type: 'object', additionalProperties: { type: 'string' } },
284
+ patch: { type: 'string', description: 'Unified diff applied with git apply.' },
285
+ allowed_paths: { type: 'array', items: { type: 'string' } },
286
+ checks: { type: 'array', items: { type: 'string' } },
287
+ check_timeout_ms: { type: 'number' },
288
+ }, [], false),
289
+ definition('list_jobs', 'List durable Execution Jobs for one repository. Summary is the default.', {
290
+ repo_id: repoId,
291
+ limit: { type: 'number' },
292
+ detail_level: { type: 'string', enum: ['summary', 'full'] },
293
+ }),
294
+ definition('cancel_job', 'Cancel one queued or running durable Execution Job.', { job_id: { type: 'string' }, repo_id: repoId, reason: { type: 'string' } }, ['job_id'], false),
295
+ definition('controller_ready', 'Return one binary Runtime readiness decision with bounded diagnostic evidence.', {
296
+ repo_id: repoId,
297
+ }),
298
+ definition('repository_runtime_snapshot', 'Read the materialized runtime projection without scanning historical state.', { repo_id: repoId }),
299
+ definition('schedule_dedupe_report', 'Read-only report that groups duplicate schedules by semantic trigger/action identity.', {
300
+ repo_id: repoId,
301
+ }, ['repo_id']),
302
+ definition('schedule_dedupe_apply', 'Pause duplicate schedules after explicit authorization, keeping one canonical enabled schedule per semantic identity.', {
303
+ repo_id: repoId,
304
+ dry_run: { type: 'boolean', description: 'When true, only returns the proposed changes.' },
305
+ confirm_authorization: { type: 'boolean', description: 'Must be true unless dry_run is true.' },
306
+ }, ['repo_id']),
307
+ definition('runtime_performance_diagnostics', 'Diagnose forge host performance, orphan workers, Local Controller presence, and cleanup candidates.', {
308
+ repo_id: repoId,
309
+ include_processes: { type: 'boolean', description: 'Include bounded forge related process samples. Defaults to true.' },
310
+ include_temp_dirs: { type: 'boolean', description: 'Include bounded forge temporary directory scan. Defaults to true.' },
311
+ cleanup_preview: { type: 'boolean', description: 'Return a no-side-effect cleanup plan for orphan workers and stale temp entries.' },
312
+ }),
313
+ definition('capability_recovery_probe', 'Read-only Runtime diagnostic evidence. This tool never starts, stops, restarts, repairs, or replaces Runtime modules.', {
314
+ repo_id: repoId,
315
+ recent_errors: { type: 'array', items: { type: 'string' } },
316
+ command_preview_available: { type: 'boolean' },
317
+ command_execute_available: { type: 'boolean' },
318
+ issue_tools_available: { type: 'boolean' },
319
+ job_tools_available: { type: 'boolean' },
320
+ }),
321
+ definition('capability_recovery_plan', 'Return a diagnostic handoff plan without Runtime lifecycle actions or automatic source repair.', {
322
+ repo_id: repoId,
323
+ recent_errors: { type: 'array', items: { type: 'string' } },
324
+ }),
325
+ definition('capability_recovery_apply', 'Apply one currently supported bounded recovery action after explicit authorization. Runtime lifecycle actions are outside this surface.', {
326
+ repo_id: repoId,
327
+ action_id: { type: 'string' },
328
+ confirm_authorization: { type: 'boolean' },
329
+ authorization: { type: 'string', description: 'Must equal action_id for actions that require authorization.' },
330
+ reason: { type: 'string' },
331
+ min_age_minutes: { type: 'number' },
332
+ max_candidates: { type: 'number' },
333
+ }, ['action_id'], false),
334
+ definition('runtime_maintenance_status', 'Read the self-contained runtime maintenance plan without using repository_command_execute or Local Job tickets.', {
335
+ repo_id: repoId,
336
+ min_age_minutes: { type: 'number' },
337
+ max_candidates: { type: 'number' },
338
+ cancel_pending_approvals: { type: 'boolean' },
339
+ }),
340
+ definition('runtime_maintenance_apply', 'Apply one bounded runtime maintenance action without repository_command_execute or Local Job tickets.', {
341
+ repo_id: repoId,
342
+ action_id: { type: 'string', enum: ['local_jobs_reconcile', 'quarantine_unreadable_local_jobs', 'runtime_storage_finalize_relocation', 'rebuild_projection', 'full_maintenance_pass'] },
343
+ confirm_maintenance: { type: 'boolean' },
344
+ authorization: { type: 'string', description: 'Must equal action_id.' },
345
+ min_age_minutes: { type: 'number' },
346
+ max_candidates: { type: 'number' },
347
+ cancel_pending_approvals: { type: 'boolean' },
348
+ }, ['action_id', 'confirm_maintenance', 'authorization'], false),
349
+ definition('workspace_auth_status', 'Summarize Workspace/Gmail auth readiness without returning or persisting secrets.', {
350
+ repo_id: repoId,
351
+ }),
352
+ definition('workspace_auth_login_prepare', 'Prepare a state-protected local Google Workspace/Gmail OAuth login with PKCE and Keychain persistence.', {
353
+ repo_id: repoId,
354
+ service: { type: 'string', enum: ['gmail', 'calendar', 'tasks', 'google-workspace'] },
355
+ scopes: { type: 'array', items: { type: 'string' } },
356
+ redirect_uri: { type: 'string' },
357
+ }),
358
+ definition('external_filesystem_targets_list', 'List pre-authorized external filesystem targets. Does not expose arbitrary absolute-path access.', {
359
+ repo_id: repoId,
360
+ }),
361
+ definition('external_filesystem_grant_preview', 'Preview a read-only external filesystem grant for a narrow absolute directory without writing config.', {
362
+ repo_id: repoId,
363
+ grant_key: { type: 'string' },
364
+ root_path: { type: 'string' },
365
+ mode: { type: 'string', enum: ['read', 'copy_into_repo'] },
366
+ expires_in_minutes: { type: 'number', description: 'Optional expiry in minutes, capped at 24h. Defaults to 8h.' },
367
+ reason: { type: 'string' },
368
+ }, ['grant_key', 'root_path', 'reason']),
369
+ definition('external_filesystem_grant_apply', 'Apply a previously previewed read-only external filesystem grant with explicit authorization.', {
370
+ repo_id: repoId,
371
+ grant_key: { type: 'string' },
372
+ root_path: { type: 'string' },
373
+ mode: { type: 'string', enum: ['read', 'copy_into_repo'] },
374
+ expires_in_minutes: { type: 'number', description: 'Optional expiry in minutes, capped at 24h. Defaults to 8h.' },
375
+ reason: { type: 'string' },
376
+ preview_ticket_id: { type: 'string' },
377
+ confirm_authorization: { type: 'boolean' },
378
+ }, ['grant_key', 'root_path', 'reason', 'preview_ticket_id', 'confirm_authorization'], false),
379
+ definition('external_filesystem_text_snapshot', 'Read a bounded text/directory snapshot from a pre-authorized external filesystem target key.', {
380
+ repo_id: repoId,
381
+ target_key: { type: 'string' },
382
+ path: { type: 'string' },
383
+ max_chars: { type: 'number' },
384
+ }, ['target_key']),
385
+ definition('runtime_storage_repair_preview', 'Preview repo-scoped local-jobs runtime storage repair candidates without mutation.', {
386
+ repo_id: repoId,
387
+ min_age_minutes: { type: 'number' },
388
+ max_candidates: { type: 'number' },
389
+ }),
390
+ definition('runtime_storage_repair_apply', 'Apply safe repo-scoped local-jobs runtime storage repairs after explicit confirmation.', {
391
+ repo_id: repoId,
392
+ candidate_ids: { type: 'array', items: { type: 'string' } },
393
+ min_age_minutes: { type: 'number' },
394
+ max_candidates: { type: 'number' },
395
+ confirm_repair: { type: 'boolean' },
396
+ }, ['confirm_repair'], false),
397
+ definition('list_plugins', 'List repository plugins, or controller-scoped plugins when repo_id is omitted.', {
398
+ repo_id: repoId,
399
+ }),
400
+ definition('get_plugin', 'Read one repository or controller-scoped plugin manifest including action schemas and policy requirements.', {
401
+ repo_id: repoId,
402
+ plugin_id: { type: 'string' },
403
+ }, ['plugin_id']),
404
+ 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.', {
405
+ repo_id: repoId,
406
+ plugin_id: { type: 'string' },
407
+ action_id: { type: 'string' },
408
+ request_id: { type: 'string' },
409
+ work_id: { type: 'string', description: 'Optional existing remote-effect Work that should own the successful typed plugin receipt.' },
410
+ arguments: { type: 'object' },
411
+ timeout_ms: { type: 'number' },
412
+ 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.' },
413
+ confirmation_text: { type: 'string', description: 'Exact confirmation text for strong_confirmation actions only.' },
414
+ }, ['plugin_id', 'action_id', 'request_id'], false),
415
+ definition('toolchain_plugin_summary', 'Return a redacted, low-interception plugin summary without raw config files or full action schemas.', {
416
+ repo_id: repoId,
417
+ plugin_id: { type: 'string' },
418
+ }, ['plugin_id']),
419
+ definition('work_result_summary', 'Return a redacted job result summary with failure class and suggested next actions. Does not return raw stdout or stderr.', {
420
+ repo_id: repoId,
421
+ job_id: { type: 'string' },
422
+ }, ['job_id']),
423
+ definition('work_status_digest', 'Return a redacted work status digest using a neutral work_ref. Does not return raw stdout or stderr.', {
424
+ repo_id: repoId,
425
+ work_ref: { type: 'string' },
426
+ }, ['work_ref']),
427
+ definition('model_clients_summary', 'List enabled model clients and DeepSeek adapter configuration state. Policy remains enforced by forge.', {
428
+ repo_id: repoId,
429
+ }),
430
+ definition('model_control_plane_summary', 'Summarize primary and backup model controllers, handoff modes, and concurrency policy.', {
431
+ repo_id: repoId,
432
+ }),
433
+ definition('deepseek_tool_manifest', 'Return DeepSeek function-calling tool manifests for the low-interception forge surface.', {
434
+ repo_id: repoId,
435
+ }),
436
+ definition('deepseek_tool_call_prepare', 'Translate one DeepSeek function call into a forge operation without executing it.', {
437
+ repo_id: repoId,
438
+ function_name: { type: 'string' },
439
+ function_arguments: { type: 'object' },
440
+ }, ['function_name', 'function_arguments']),
441
+ definition('deepseek_controller_manifest', 'Return DeepSeek backup-controller manifest, boundaries, and function tools.', {
442
+ repo_id: repoId,
443
+ }),
444
+ definition('deepseek_controller_handoff_prepare', 'Prepare a safe DeepSeek backup-controller handoff packet without calling the external model.', {
445
+ repo_id: repoId,
446
+ reason: { type: 'string', enum: ['manual', 'chatgpt_platform_blocked', 'chatgpt_unavailable', 'parallel_review', 'local_gui_request'] },
447
+ objective: { type: 'string' },
448
+ current_controller: { type: 'string' },
449
+ blocked_tool_name: { type: 'string' },
450
+ recent_safe_error: { type: 'string' },
451
+ }),
452
+ definition('deepseek_controller_request_prepare', 'Prepare a DeepSeek chat-completions request for backup controller mode without sending it.', {
453
+ repo_id: repoId,
454
+ reason: { type: 'string', enum: ['manual', 'chatgpt_platform_blocked', 'chatgpt_unavailable', 'parallel_review', 'local_gui_request'] },
455
+ objective: { type: 'string' },
456
+ user_message: { type: 'string' },
457
+ current_controller: { type: 'string' },
458
+ blocked_tool_name: { type: 'string' },
459
+ recent_safe_error: { type: 'string' },
460
+ model: { type: 'string' },
461
+ }),
462
+ definition('review_artifacts_prepare', 'Create bounded repo-local review artifact roots for browser/iOS screenshot review workflows.', { repo_id: repoId }, [], false),
463
+ definition('review_artifacts_index', 'Index bounded repo-local browser/iOS screenshots, logs, and build reports for visual review.', { repo_id: repoId, limit: { type: 'number' } }),
464
+ definition('browser_review_packet', 'Build a browser visual review packet from indexed browser screenshots.', { repo_id: repoId, limit: { type: 'number' } }),
465
+ definition('ios_review_packet', 'Build or capture an iOS visual review packet from simulator screenshots and logs.', {
466
+ repo_id: repoId,
467
+ udid: { type: 'string' },
468
+ label: { type: 'string' },
469
+ capture: { type: 'boolean' },
470
+ limit: { type: 'number' },
471
+ }, [], false),
472
+ definition('workflow_watchdog_report', 'Diagnose stuck repository workflows across execution jobs, local bridge jobs, schedules, and runtime processes.', {
473
+ repo_id: repoId,
474
+ stale_minutes: { type: 'number' },
475
+ include_processes: { type: 'boolean' },
476
+ }),
477
+ definition('ios_xcode_status', 'Check local Xcode, xcodebuild, and simctl availability without mutation.', { repo_id: repoId }),
478
+ definition('ios_simulators_list', 'List available iOS Simulator devices using structured simctl JSON output.', {
479
+ repo_id: repoId,
480
+ runtime: { type: 'string' },
481
+ name: { type: 'string' },
482
+ }),
483
+ definition('ios_project_discover', 'Discover iOS workspaces, projects, Package.swift, and Info.plist files inside the repository.', { repo_id: repoId }),
484
+ definition('ios_schemes_list', 'List Xcode schemes for a repository-bounded workspace or project.', {
485
+ repo_id: repoId,
486
+ workspace: { type: 'string' },
487
+ project: { type: 'string' },
488
+ }),
489
+ definition('ios_simulator_boot', 'Boot an explicitly selected iOS Simulator UDID. Requires authorization.', {
490
+ repo_id: repoId,
491
+ udid: { type: 'string' },
492
+ open_simulator: { type: 'boolean' },
493
+ confirm_authorization: { type: 'boolean' },
494
+ timeout_ms: { type: 'number' },
495
+ }, ['udid', 'confirm_authorization'], false),
496
+ definition('ios_app_build', 'Build an iOS app into .forge/ios/DerivedData using xcodebuild structured arguments.', {
497
+ repo_id: repoId,
498
+ scheme: { type: 'string' },
499
+ udid: { type: 'string' },
500
+ workspace: { type: 'string' },
501
+ project: { type: 'string' },
502
+ configuration: { type: 'string' },
503
+ timeout_ms: { type: 'number' },
504
+ }, ['scheme'], false),
505
+ definition('ios_app_install', 'Install a bounded .app product from .forge/ios/DerivedData into a booted simulator. Requires authorization.', {
506
+ repo_id: repoId,
507
+ udid: { type: 'string' },
508
+ app_path: { type: 'string' },
509
+ confirm_authorization: { type: 'boolean' },
510
+ }, ['udid', 'app_path', 'confirm_authorization'], false),
511
+ definition('ios_app_launch', 'Launch a simulator app by bundle id with structured launch arguments. Requires authorization.', {
512
+ repo_id: repoId,
513
+ udid: { type: 'string' },
514
+ bundle_id: { type: 'string' },
515
+ arguments: { type: 'array', items: { type: 'string' } },
516
+ confirm_authorization: { type: 'boolean' },
517
+ }, ['udid', 'bundle_id', 'confirm_authorization'], false),
518
+ definition('ios_simulator_screenshot', 'Capture a simulator screenshot to .forge/ios/screenshots as a bounded artifact.', {
519
+ repo_id: repoId,
520
+ udid: { type: 'string' },
521
+ label: { type: 'string' },
522
+ }, ['udid'], false),
523
+ definition('ios_simulator_log_tail', 'Collect a bounded recent simulator log tail into .forge/ios/logs.', {
524
+ repo_id: repoId,
525
+ udid: { type: 'string' },
526
+ process: { type: 'string' },
527
+ last: { type: 'string' },
528
+ max_bytes: { type: 'number' },
529
+ }),
530
+ definition('ios_ui_smoke_test', 'Compose build, boot, launch, screenshot, and bounded logs for simulator UI review. Requires authorization.', {
531
+ repo_id: repoId,
532
+ udid: { type: 'string' },
533
+ scheme: { type: 'string' },
534
+ bundle_id: { type: 'string' },
535
+ workspace: { type: 'string' },
536
+ project: { type: 'string' },
537
+ configuration: { type: 'string' },
538
+ app_path: { type: 'string' },
539
+ screenshot_label: { type: 'string' },
540
+ confirm_authorization: { type: 'boolean' },
541
+ }, ['udid', 'scheme', 'bundle_id', 'confirm_authorization'], false),
542
+ definition('runtime_cleanup_preview', 'Preview stale forge temp directories, terminal local jobs, and historical attention cleanup candidates.', {
543
+ repo_id: repoId,
544
+ min_age_minutes: { type: 'number' },
545
+ include_temp_dirs: { type: 'boolean' },
546
+ include_terminal_local_jobs: { type: 'boolean' },
547
+ include_legacy_runs: { type: 'boolean' },
548
+ include_historical_attention: { type: 'boolean' },
549
+ max_candidates: { type: 'number' },
550
+ }),
551
+ definition('runtime_cleanup_apply', 'Apply safe cleanup candidates. Requires confirm_cleanup=true and remains limited to explicit forge candidates.', {
552
+ repo_id: repoId,
553
+ min_age_minutes: { type: 'number' },
554
+ include_temp_dirs: { type: 'boolean' },
555
+ include_terminal_local_jobs: { type: 'boolean' },
556
+ include_legacy_runs: { type: 'boolean' },
557
+ include_historical_attention: { type: 'boolean' },
558
+ max_candidates: { type: 'number' },
559
+ confirm_cleanup: { type: 'boolean' },
560
+ }, [], false),
561
+ 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),
562
+ ];
563
+
564
+ export const connectorExposedTools = runtimeToolDefinitions.map((tool) => tool.name);
565
+ export const currentCallableTools = new Set(connectorExposedTools);