@moretea-labs/forge 1.5.0-rc.1 → 1.5.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 (264) hide show
  1. package/AGENTS.md +9 -11
  2. package/CHANGELOG.md +27 -1
  3. package/CLAUDE.md +8 -10
  4. package/DESIGN.md +278 -0
  5. package/README.md +70 -90
  6. package/README.zh-CN.md +52 -55
  7. package/SKILL.md +8 -11
  8. package/THIRD_PARTY_NOTICES.md +9 -3
  9. package/assets/branding/README.md +4 -2
  10. package/assets/hooks/lib/workflow-state.sh +19 -18
  11. package/assets/hooks/post-edit-guard.sh +6 -75
  12. package/assets/hooks/prompt-guard.sh +24 -12
  13. package/assets/hooks/session-start-context.sh +17 -17
  14. package/assets/hooks/stop-orchestrator.sh +2 -2
  15. package/assets/partials/04-project-structure.partial.md +6 -6
  16. package/assets/partials/05-workflow.partial.md +6 -6
  17. package/assets/partials/07-footer.partial.md +1 -1
  18. package/assets/partials/08-orchestration.partial.md +2 -2
  19. package/assets/partials-agents/02-operating-mode.partial.md +5 -5
  20. package/assets/partials-agents/03-orchestration.partial.md +3 -3
  21. package/assets/partials-agents/04-task-protocol.partial.md +3 -3
  22. package/assets/partials-agents/08-deep-docs.partial.md +1 -1
  23. package/assets/reference-configs/agentic-development-flow.md +49 -86
  24. package/assets/reference-configs/external-tooling.md +21 -61
  25. package/assets/reference-configs/handoff-protocol.md +25 -20
  26. package/assets/reference-configs/harness-overview.md +8 -8
  27. package/assets/skill-version.json +2 -2
  28. package/assets/templates/helpers/archive-workflow.sh +0 -1
  29. package/assets/templates/helpers/capture-plan.sh +3 -3
  30. package/assets/templates/helpers/check-task-workflow.sh +2 -2
  31. package/assets/templates/helpers/codex-handoff-resume.sh +5 -5
  32. package/assets/templates/helpers/ensure-task-workflow.sh +37 -35
  33. package/assets/templates/helpers/new-plan.sh +1 -1
  34. package/assets/templates/helpers/plan-to-todo.sh +2 -2
  35. package/assets/templates/helpers/prepare-codex-handoff.sh +2 -2
  36. package/assets/templates/helpers/prepare-handoff.sh +9 -9
  37. package/assets/templates/helpers/refresh-current-status.sh +2 -2
  38. package/assets/templates/helpers/ship-worktrees.sh +1 -1
  39. package/assets/templates/helpers/sprint-backlog.sh +1 -1
  40. package/assets/templates/helpers/verify-sprint.sh +7 -7
  41. package/assets/templates/helpers/workstream-sync.sh +1 -1
  42. package/assets/templates/plan.template.md +1 -1
  43. package/assets/workflow-contract.v1.json +6 -3
  44. package/docs/architecture/current/README.md +10 -9
  45. package/docs/architecture/current/approved-target-architecture.zh-CN.md +2 -2
  46. package/docs/architecture/current/architecture-invariants.md +2 -2
  47. package/docs/architecture/current/automation-and-schedule-engine.md +15 -15
  48. package/docs/architecture/current/codegraph-context-provider.md +2 -2
  49. package/docs/architecture/current/control-plane-authority-inventory.md +12 -0
  50. package/docs/architecture/current/dispatch-and-agent-strategy.md +11 -11
  51. package/docs/architecture/current/entity-model.md +0 -27
  52. package/docs/architecture/current/failure-recovery.md +0 -24
  53. package/docs/architecture/current/governance.md +1 -1
  54. package/docs/architecture/current/implementation-status.md +1 -1
  55. package/docs/architecture/current/legacy-governance.md +58 -0
  56. package/docs/architecture/current/multi-repository-execution.md +1 -1
  57. package/docs/architecture/current/peer-supercontroller-runtime.md +1 -1
  58. package/docs/architecture/current/personal-assistant-plugin-baseline.md +4 -5
  59. package/docs/architecture/current/scheduler-and-resource-claims.md +0 -10
  60. package/docs/architecture/current/target-requirements-traceability.md +2 -2
  61. package/docs/architecture/current/thin-harness-governance-policy.md +1 -1
  62. package/docs/architecture/current/thin-harness-v1.md +9 -11
  63. package/docs/architecture/domains/runtime-harness.md +1 -1
  64. package/docs/forge-autonomous-goal-loop.md +3 -1
  65. package/docs/forge-chatgpt-mcp-setup.md +67 -176
  66. package/docs/images/forge-banner-cn.svg +26 -1
  67. package/docs/images/forge-banner.svg +26 -1
  68. package/docs/operations/features.md +1 -1
  69. package/docs/operations/homebrew.md +3 -3
  70. package/docs/operations/mcp-tool-exposure.md +5 -5
  71. package/docs/operations/platform-support.md +45 -37
  72. package/docs/operations/platform-support.zh-CN.md +40 -38
  73. package/docs/operations/releasing.md +3 -3
  74. package/docs/operations/releasing.zh-CN.md +3 -3
  75. package/docs/operations/troubleshooting.md +11 -6
  76. package/docs/operations/troubleshooting.zh-CN.md +11 -6
  77. package/docs/public-usage-guide.md +28 -21
  78. package/docs/public-usage-guide.zh-CN.md +28 -21
  79. package/docs/tutorials/01-install-and-start.md +58 -35
  80. package/docs/tutorials/01-install-and-start.zh-CN.md +58 -35
  81. package/docs/tutorials/02-connect-chatgpt.md +118 -46
  82. package/docs/tutorials/02-connect-chatgpt.zh-CN.md +119 -45
  83. package/docs/wiki/Architecture.md +1 -1
  84. package/docs/wiki/Installation.md +2 -2
  85. package/docs/wiki/Quick-Start.md +1 -1
  86. package/docs/wiki/Work-Lifecycle.md +1 -1
  87. package/install.ps1 +4 -5
  88. package/install.sh +4 -6
  89. package/package.json +15 -5
  90. package/scripts/archive-workflow.sh +0 -1
  91. package/scripts/benchmark-thin-harness-mcp-e2e.ts +27 -14
  92. package/scripts/build-controller-ui.ts +28 -0
  93. package/scripts/capture-plan.sh +4 -4
  94. package/scripts/check-agent-tooling.sh +12 -1
  95. package/scripts/check-platform-support.mjs +2 -2
  96. package/scripts/check-public-docs.sh +16 -5
  97. package/scripts/check-release-readiness.sh +5 -11
  98. package/scripts/check-runtime-architecture.mjs +14 -22
  99. package/scripts/check-tarball-install-smoke.sh +3 -2
  100. package/scripts/check-task-workflow.sh +2 -2
  101. package/scripts/codex-handoff-resume.sh +5 -5
  102. package/scripts/create-project-dirs.sh +3 -3
  103. package/scripts/ensure-task-workflow.sh +45 -35
  104. package/scripts/init-project.sh +4 -4
  105. package/scripts/install-desktop-operator-registration.ts +2 -2
  106. package/scripts/lib/project-init-lib.sh +46 -44
  107. package/scripts/migrate-project-template.sh +7 -4
  108. package/scripts/new-plan.sh +1 -1
  109. package/scripts/plan-to-todo.sh +2 -2
  110. package/scripts/prepare-codex-handoff.sh +2 -2
  111. package/scripts/prepare-handoff.sh +9 -9
  112. package/scripts/refresh-current-status.sh +2 -2
  113. package/scripts/setup-plugins.sh +3 -3
  114. package/scripts/ship-worktrees.sh +1 -1
  115. package/scripts/sprint-backlog.sh +5 -5
  116. package/scripts/sync-codex-installed-copies.sh +2 -3
  117. package/scripts/verify-sprint.sh +7 -7
  118. package/scripts/workstream-sync.sh +1 -1
  119. package/src/cli/chatgpt-browser/bridge-extension.ts +1 -1
  120. package/src/cli/chatgpt-browser/bridge-provider.ts +29 -0
  121. package/src/cli/chatgpt-browser/file-policy.ts +3 -1
  122. package/src/cli/commands/chatgpt.ts +51 -0
  123. package/src/cli/commands/doctor.ts +1 -1
  124. package/src/cli/commands/init-hook.ts +213 -70
  125. package/src/cli/commands/init.ts +5 -6
  126. package/src/cli/commands/mcp.ts +31 -5
  127. package/src/cli/commands/runtime.ts +61 -8
  128. package/src/cli/commands/setup-profile.ts +472 -0
  129. package/src/cli/controller/check-runner.ts +20 -3
  130. package/src/cli/controller/codex-continuation.ts +4 -7
  131. package/src/cli/controller/context-pack.ts +118 -14
  132. package/src/cli/controller/operational-plan.ts +4 -4
  133. package/src/cli/controller/task-ledger.ts +10 -10
  134. package/src/cli/controller/work-mode.ts +6 -13
  135. package/src/cli/index.ts +14 -35
  136. package/src/cli/local-bridge/connector-freshness.ts +1 -1
  137. package/src/cli/local-bridge/console-assets.ts +17 -0
  138. package/src/cli/local-bridge/console-automations.ts +160 -0
  139. package/src/cli/local-bridge/dashboard.ts +8 -1303
  140. package/src/cli/local-bridge/facade-api.ts +16 -7
  141. package/src/cli/local-bridge/frontend/src/App.tsx +10 -0
  142. package/src/cli/local-bridge/frontend/src/components/Button.tsx +1 -0
  143. package/src/cli/local-bridge/frontend/src/components/DetailPane.tsx +3 -0
  144. package/src/cli/local-bridge/frontend/src/components/SearchField.tsx +1 -0
  145. package/src/cli/local-bridge/frontend/src/components/SectionHeader.tsx +1 -0
  146. package/src/cli/local-bridge/frontend/src/components/Segmented.tsx +1 -0
  147. package/src/cli/local-bridge/frontend/src/components/StatusText.tsx +3 -0
  148. package/src/cli/local-bridge/frontend/src/design/icons.tsx +11 -0
  149. package/src/cli/local-bridge/frontend/src/design/tokens.css +8 -0
  150. package/src/cli/local-bridge/frontend/src/features/automations/AutomationsView.tsx +3 -0
  151. package/src/cli/local-bridge/frontend/src/features/capabilities/CapabilitiesView.tsx +4 -0
  152. package/src/cli/local-bridge/frontend/src/features/overview/OverviewView.tsx +3 -0
  153. package/src/cli/local-bridge/frontend/src/features/repositories/RepositoriesView.tsx +2 -0
  154. package/src/cli/local-bridge/frontend/src/features/settings/SettingsView.tsx +2 -0
  155. package/src/cli/local-bridge/frontend/src/features/system/SystemView.tsx +2 -0
  156. package/src/cli/local-bridge/frontend/src/features/work/WorkView.tsx +3 -0
  157. package/src/cli/local-bridge/frontend/src/lib/api.ts +23 -0
  158. package/src/cli/local-bridge/frontend/src/lib/format.ts +4 -0
  159. package/src/cli/local-bridge/frontend/src/lib/routes.ts +7 -0
  160. package/src/cli/local-bridge/frontend/src/main.tsx +1 -0
  161. package/src/cli/local-bridge/frontend/src/shell/AppShell.tsx +1 -0
  162. package/src/cli/local-bridge/frontend/src/shell/CommandBar.tsx +2 -0
  163. package/src/cli/local-bridge/frontend/src/shell/Sidebar.tsx +3 -0
  164. package/src/cli/local-bridge/frontend/src/styles.css +12 -0
  165. package/src/cli/local-bridge/frontend/src/types.ts +14 -0
  166. package/src/cli/local-bridge/frontend/src/vite-env.d.ts +1 -0
  167. package/src/cli/local-bridge/frontend/vite.config.ts +27 -0
  168. package/src/cli/local-bridge/server.ts +45 -0
  169. package/src/cli/local-bridge/ui-dist/app.css +1 -0
  170. package/src/cli/local-bridge/ui-dist/app.js +11094 -0
  171. package/src/cli/mcp/auth.ts +2 -0
  172. package/src/cli/mcp/instructions.ts +3 -3
  173. package/src/cli/mcp/legacy-tool-service.ts +27 -23
  174. package/src/cli/mcp/multi-repository.ts +2 -0
  175. package/src/cli/mcp/policy.ts +7 -5
  176. package/src/cli/mcp/repository-tools.ts +53 -14
  177. package/src/cli/mcp/server.ts +5 -10
  178. package/src/cli/mcp/setup.ts +220 -276
  179. package/src/cli/mcp/tool-capability-cache.ts +1 -1
  180. package/src/cli/mcp/toolset-names.ts +1 -1
  181. package/src/cli/mcp/toolset.ts +0 -1
  182. package/src/cli/mcp/transports/http.ts +51 -4
  183. package/src/cli/repositories/branch-name-policy.ts +0 -7
  184. package/src/cli/repositories/controller-home.ts +110 -3
  185. package/src/cli/repositories/safe-patch.ts +1 -1
  186. package/src/cli/repositories/selected-path-actions.ts +26 -24
  187. package/src/core/adoption/gitignore-plan.ts +2 -3
  188. package/src/core/adoption/plan.ts +4 -1
  189. package/src/runtime/control-plane/execution/edit-validation-coordinator.ts +556 -0
  190. package/src/runtime/control-plane/execution/work-handle-store.ts +128 -1
  191. package/src/runtime/control-plane/execution/work-validation-reconciler.ts +277 -0
  192. package/src/runtime/control-plane/execution/work-verification-snapshot.ts +169 -0
  193. package/src/runtime/control-plane/facade/capability-registry.ts +0 -10
  194. package/src/runtime/control-plane/facade/handoff-inbox-store.ts +44 -25
  195. package/src/runtime/control-plane/facade/suggested-actions.ts +7 -1
  196. package/src/runtime/control-plane/facade/types.ts +0 -1
  197. package/src/runtime/control-plane/global-scheduler/scheduler.ts +30 -8
  198. package/src/runtime/control-plane/launcher/chatgpt-work-binding-store.ts +114 -0
  199. package/src/runtime/control-plane/launcher/chatgpt-work-continuation.ts +175 -0
  200. package/src/runtime/control-plane/launcher/launch-reservation-store.ts +161 -0
  201. package/src/runtime/control-plane/launcher/provider-mcp-bootstrap.ts +64 -0
  202. package/src/runtime/control-plane/launcher/thin-launcher.ts +117 -24
  203. package/src/runtime/control-plane/routing/route-policy.ts +14 -14
  204. package/src/runtime/control-plane/runtime-cleanup.ts +0 -1
  205. package/src/runtime/evidence/event-ledger.ts +1 -1
  206. package/src/runtime/{workflow/campaigns/workspace.ts → execution/managed-workspace.ts} +41 -43
  207. package/src/runtime/execution/process-runtime/check-facade.ts +6 -0
  208. package/src/runtime/execution/process-runtime/check-result.ts +45 -0
  209. package/src/runtime/execution/process-runtime/check-runner-sidecar.ts +42 -16
  210. package/src/runtime/execution/process-runtime/command-facade.ts +4 -2
  211. package/src/runtime/execution/process-runtime/gc.ts +1 -1
  212. package/src/runtime/execution/process-runtime/index.ts +3 -0
  213. package/src/runtime/execution/process-runtime/interactive-admission.ts +14 -5
  214. package/src/runtime/execution/process-runtime/persisted-check.ts +285 -0
  215. package/src/runtime/execution/process-runtime/resource-claims.ts +30 -0
  216. package/src/runtime/execution/process-runtime/runtime.ts +18 -1
  217. package/src/runtime/execution/process-runtime/store.ts +1 -19
  218. package/src/runtime/execution/process-runtime/types.ts +4 -0
  219. package/src/runtime/execution/thin-harness/execution-router.ts +0 -1
  220. package/src/runtime/execution/thin-harness/fast-executor.ts +1 -1
  221. package/src/runtime/execution/thin-harness/lightweight-lanes.ts +1 -2
  222. package/src/runtime/execution/thin-harness/types.ts +0 -1
  223. package/src/runtime/execution/workers/executor.ts +1 -1
  224. package/src/runtime/gateway/mcp/execution-tools.ts +1 -1
  225. package/src/runtime/gateway/mcp/persisted-check-process.ts +3 -255
  226. package/src/runtime/gateway/mcp/process-tools.ts +16 -3
  227. package/src/runtime/gateway/mcp/resource-policy.ts +0 -9
  228. package/src/runtime/gateway/mcp/router.ts +117 -182
  229. package/src/runtime/gateway/mcp/runtime-tools.ts +331 -409
  230. package/src/runtime/gateway/mcp/work-validation-reconciler.ts +1 -219
  231. package/src/runtime/plugins/browser-adapter.ts +5 -0
  232. package/src/runtime/plugins/desktop-operator-registration.ts +1 -1
  233. package/src/runtime/plugins/store.ts +14 -6
  234. package/src/runtime/plugins/types.ts +1 -1
  235. package/src/runtime/projections/materialized-view.ts +1 -23
  236. package/src/runtime/recovery/maintenance-executor.ts +9 -0
  237. package/src/runtime/resources/ownership.ts +0 -1
  238. package/src/runtime/root/gateway-adapter.ts +2 -0
  239. package/src/runtime/root/mcp-transport.ts +10 -2
  240. package/src/runtime/root/package-connector-service.ts +136 -0
  241. package/src/runtime/root/package-runtime-release.ts +161 -0
  242. package/src/runtime/root/package-runtime-service.ts +185 -0
  243. package/src/runtime/root/release-materialize.ts +19 -0
  244. package/src/runtime/root/runtime.ts +2 -1
  245. package/src/runtime/root/scheduler.ts +5 -0
  246. package/src/runtime/root/service.ts +18 -5
  247. package/src/runtime/standalone-recovery/core.ts +65 -16
  248. package/src/runtime/workflow/findings/store.ts +145 -106
  249. package/src/runtime/workflow/findings/types.ts +22 -0
  250. package/src/runtime/workflow/schedules/engine.ts +132 -2
  251. package/src/runtime/workflow/schedules/pending-activation.ts +139 -0
  252. package/src/runtime/workflow/schedules/work-continuation.ts +218 -0
  253. package/docs/CHANGELOG.md +0 -978
  254. package/docs/README.zh-CN.md +0 -58
  255. package/scripts/smoke-chatgpt-supervised-automation.ts +0 -208
  256. package/src/cli/commands/controller.ts +0 -680
  257. package/src/runtime/workflow/campaigns/cleanup.ts +0 -263
  258. package/src/runtime/workflow/campaigns/engine.ts +0 -112
  259. package/src/runtime/workflow/campaigns/normalize.ts +0 -100
  260. package/src/runtime/workflow/campaigns/review.ts +0 -315
  261. package/src/runtime/workflow/campaigns/store.ts +0 -526
  262. package/src/runtime/workflow/campaigns/supervisor.ts +0 -112
  263. package/src/runtime/workflow/campaigns/types.ts +0 -290
  264. /package/src/runtime/{workflow/campaigns → execution}/workspace-agent.ts +0 -0
@@ -53,7 +53,6 @@ common_excludes=(
53
53
  --exclude='.claude/.trace.jsonl'
54
54
  --exclude='.claude/.session-handoff.md'
55
55
  --exclude='.claude/.task-state.json'
56
- --exclude='.claude/.task-handoff.md'
57
56
  --exclude='.claude/*.tmp'
58
57
  --exclude='.claude/*.bak'
59
58
  --exclude='.claude/*.bak.*'
@@ -62,8 +61,8 @@ common_excludes=(
62
61
  --exclude='.ai/harness/events.jsonl'
63
62
  --exclude='.ai/harness/archive/'
64
63
  --exclude='.ai/harness/failures/latest.jsonl'
65
- --exclude='.ai/harness/handoff/current.md'
66
- --exclude='.ai/harness/handoff/resume.md'
64
+ --exclude='.ai/harness/session/continuation.md'
65
+ --exclude='.ai/harness/session/resume.md'
67
66
  --exclude='.ai/harness/architecture/events.jsonl'
68
67
  --exclude='.ai/harness/worktrees/'
69
68
  --exclude='.ai/harness/runs/'
@@ -366,7 +366,7 @@ contract_command="bash scripts/verify-contract.sh --contract $contract_file --st
366
366
  if [[ -f "scripts/sync-brain-docs.sh" && -f ".ai/harness/brain-manifest.json" ]]; then
367
367
  bash scripts/sync-brain-docs.sh --all >/dev/null || true
368
368
  fi
369
- if [[ -f "scripts/prepare-codex-handoff.sh" && ( -f ".ai/harness/handoff/current.md" || -f ".ai/harness/handoff/resume.md" ) ]]; then
369
+ if [[ -f "scripts/prepare-codex-handoff.sh" && ( -f ".ai/harness/session/continuation.md" || -f ".ai/harness/session/resume.md" ) ]]; then
370
370
  bash scripts/prepare-codex-handoff.sh --reason "forge-verify-sprint" >/dev/null || true
371
371
  fi
372
372
  set +e
@@ -473,8 +473,8 @@ else
473
473
  fi
474
474
  handoff_current_exists=false
475
475
  handoff_resume_exists=false
476
- [[ -f ".ai/harness/handoff/current.md" ]] && handoff_current_exists=true
477
- [[ -f ".ai/harness/handoff/resume.md" ]] && handoff_resume_exists=true
476
+ [[ -f ".ai/harness/session/continuation.md" ]] && handoff_current_exists=true
477
+ [[ -f ".ai/harness/session/resume.md" ]] && handoff_resume_exists=true
478
478
 
479
479
  if command -v jq >/dev/null 2>&1 && jq -e . "$contract_report" >/dev/null 2>&1; then
480
480
  jq -n \
@@ -543,8 +543,8 @@ if command -v jq >/dev/null 2>&1 && jq -e . "$contract_report" >/dev/null 2>&1;
543
543
  {name: "allowed_paths", status: ($allowed_paths_check.status // "unavailable")}
544
544
  ],
545
545
  handoffs: [
546
- {file: ".ai/harness/handoff/current.md", exists: $handoff_current_exists},
547
- {file: ".ai/harness/handoff/resume.md", exists: $handoff_resume_exists}
546
+ {file: ".ai/harness/session/continuation.md", exists: $handoff_current_exists},
547
+ {file: ".ai/harness/session/resume.md", exists: $handoff_resume_exists}
548
548
  ],
549
549
  files_changed: $files_changed,
550
550
  allowed_paths_check: $allowed_paths_check,
@@ -622,8 +622,8 @@ else
622
622
  {"name": "allowed_paths", "status": "$(json_escape "$allowed_paths_status")"}
623
623
  ],
624
624
  "handoffs": [
625
- {"file": ".ai/harness/handoff/current.md", "exists": $handoff_current_exists},
626
- {"file": ".ai/harness/handoff/resume.md", "exists": $handoff_resume_exists}
625
+ {"file": ".ai/harness/session/continuation.md", "exists": $handoff_current_exists},
626
+ {"file": ".ai/harness/session/resume.md", "exists": $handoff_resume_exists}
627
627
  ],
628
628
  "files_changed": [],
629
629
  "allowed_paths_check": {
@@ -235,7 +235,7 @@ if [[ ! -f "$workstream_file" ]]; then
235
235
  > **Architecture Module**: \`${architecture_module}\`
236
236
  > **Source Plan**: ${source_plan}
237
237
  > **Current Slice**: ${current_slice}
238
- > **Last Handoff**: \`.ai/harness/handoff/current.md\`
238
+ > **Last Handoff**: \`.ai/harness/session/continuation.md\`
239
239
  > **Architecture Request**: ${request_file}
240
240
 
241
241
  ## Purpose
@@ -176,7 +176,7 @@ async function forgeRunTask(task) {
176
176
 
177
177
  async function forgePoll() {
178
178
  await forgeHeartbeat();
179
- const task = await forgeJson('/api/extension/task');
179
+ const task = await forgeJson('/api/extension/task?pageUrl=' + encodeURIComponent(location.href));
180
180
  if (task && task.kind === 'consult' && task.id && task.prompt) {
181
181
  await forgeRunTask(task);
182
182
  }
@@ -28,6 +28,7 @@ interface ExtensionTask {
28
28
  kind: 'consult';
29
29
  prompt: string;
30
30
  timeoutMs: number;
31
+ targetUrl?: string;
31
32
  }
32
33
 
33
34
  interface ExtensionResult {
@@ -83,6 +84,31 @@ function isStatusOnlyOutput(output: string): boolean {
83
84
  return STATUS_ONLY_OUTPUTS.has(output.trim().toLowerCase());
84
85
  }
85
86
 
87
+
88
+ function normalizeTargetPage(value: string): { path: string; conversationId?: string } | undefined {
89
+ try {
90
+ const url = new URL(value);
91
+ if (!['chatgpt.com', 'www.chatgpt.com', 'chat.openai.com'].includes(url.hostname)) return undefined;
92
+ const parts = url.pathname.split('/').filter(Boolean);
93
+ const c = parts.lastIndexOf('c');
94
+ const conversationId = c >= 0 ? parts[c + 1] : undefined;
95
+ const path = `/${parts.join('/')}`.replace(/\/$/, '') || '/';
96
+ return { path, conversationId };
97
+ } catch {
98
+ return undefined;
99
+ }
100
+ }
101
+
102
+ export function chatgptBridgeTargetMatchesPage(targetUrl: string | undefined, pageUrl: string | undefined): boolean {
103
+ if (!targetUrl) return true;
104
+ if (!pageUrl) return false;
105
+ const target = normalizeTargetPage(targetUrl);
106
+ const page = normalizeTargetPage(pageUrl);
107
+ if (!target || !page) return false;
108
+ if (target.conversationId) return page.conversationId === target.conversationId;
109
+ return page.path === target.path;
110
+ }
111
+
86
112
  function bridgePort(): number {
87
113
  const raw = process.env.FORGE_CHATGPT_BRIDGE_PORT;
88
114
  if (!raw) return CHATGPT_BRIDGE_DEFAULT_PORT;
@@ -115,6 +141,7 @@ export async function runBridgeProvider(input: BrowserConsultInput, bundle: Prom
115
141
  kind: 'consult',
116
142
  prompt: bundle.rendered,
117
143
  timeoutMs,
144
+ targetUrl: input.chatgptUrl,
118
145
  };
119
146
  const state: {
120
147
  heartbeat?: ExtensionHeartbeat;
@@ -155,6 +182,8 @@ export async function runBridgeProvider(input: BrowserConsultInput, bundle: Prom
155
182
  }
156
183
  if (request.method === 'GET' && url.pathname === '/api/extension/task') {
157
184
  if (state.result || state.claimed) return jsonResponse({ kind: 'idle' });
185
+ const pageUrl = url.searchParams.get('pageUrl') ?? undefined;
186
+ if (!chatgptBridgeTargetMatchesPage(task.targetUrl, pageUrl)) return jsonResponse({ kind: 'idle' });
158
187
  state.claimed = true;
159
188
  return jsonResponse(task);
160
189
  }
@@ -74,7 +74,9 @@ const BROWSER_MCP_OUTPUT_POLICY: McpPolicy = {
74
74
  profile: 'planner',
75
75
  readGlobs: [],
76
76
  writeGlobs: [
77
- '.ai/harness/handoff/*.md',
77
+ '.ai/harness/session/*.md',
78
+ '.ai/harness/controller/packets/*.md',
79
+ '.ai/harness/projections/*.md',
78
80
  'tasks/reviews/**',
79
81
  '.ai/harness/checks/**',
80
82
  'plans/prds/**',
@@ -12,6 +12,8 @@ import {
12
12
  runBrowserSetup,
13
13
  } from '../chatgpt-browser/engine';
14
14
  import type { BrowserProviderName, BrowserSessionStatus, NativeBrowserChannel, ThinkingLevel } from '../chatgpt-browser/types';
15
+ import { durableControllerHome } from '../repositories/controller-home';
16
+ import { runWorkChatgptContinuation } from '../../runtime/control-plane/launcher/chatgpt-work-continuation';
15
17
 
16
18
  interface BrowserCommonOptions {
17
19
  repo?: string;
@@ -74,6 +76,17 @@ interface BrowserConsultOptions extends BrowserCommonOptions {
74
76
  headless?: boolean;
75
77
  }
76
78
 
79
+ interface WorkChatgptContinueOptions extends BrowserCommonOptions {
80
+ controllerHome: string;
81
+ repoId: string;
82
+ workId: string;
83
+ prompt: string;
84
+ title?: string;
85
+ session?: string;
86
+ conversationUrl?: string;
87
+ timeoutMs?: string;
88
+ }
89
+
77
90
  interface BrowserFollowupOptions extends BrowserCommonOptions {
78
91
  session: string;
79
92
  title?: string;
@@ -363,6 +376,44 @@ export function buildChatgptCommand(): Command {
363
376
  });
364
377
  });
365
378
 
379
+ const workContinue = new Command('work-continue')
380
+ .description('Internal: continue one Forge Work in its bound ChatGPT Web conversation')
381
+ .option('--repo <path>', 'Repository root for the Work browser session', '.')
382
+ .requiredOption('--controller-home <path>', 'Explicit Controller Home containing the authoritative Work and conversation binding')
383
+ .requiredOption('--repo-id <repo-id>', 'Stable Forge repository id')
384
+ .requiredOption('--work-id <work-id>', 'Stable Forge Work id')
385
+ .requiredOption('--prompt <text>', 'Bounded continuation prompt')
386
+ .option('--title <title>', 'Human-readable local conversation alias')
387
+ .option('--session <session-id>', 'Legacy saved browser session to seed the binding')
388
+ .option('--conversation-url <url>', 'Explicit ChatGPT conversation URL to seed the binding')
389
+ .option('--timeout-ms <ms>', 'Assistant timeout in milliseconds')
390
+ .action((rawOpts: WorkChatgptContinueOptions) => {
391
+ void runChatgptAction(async () => {
392
+ const result = await runWorkChatgptContinuation({
393
+ controllerHome: durableControllerHome(rawOpts.controllerHome),
394
+ repoId: rawOpts.repoId,
395
+ repoRoot: resolveRepoRoot(rawOpts.repo),
396
+ workId: rawOpts.workId,
397
+ prompt: rawOpts.prompt,
398
+ title: rawOpts.title,
399
+ browserSessionId: rawOpts.session,
400
+ conversationUrl: rawOpts.conversationUrl,
401
+ timeoutMs: parsePositiveInteger('timeout-ms', rawOpts.timeoutMs),
402
+ });
403
+ console.log(JSON.stringify({
404
+ status: result.status,
405
+ provider: result.provider,
406
+ sessionId: result.browserSessionId,
407
+ conversationUrl: result.conversationUrl,
408
+ conversationId: result.conversationId,
409
+ localAlias: result.localAlias,
410
+ resumedFromBinding: result.resumedFromBinding,
411
+ error: result.error,
412
+ }, null, 2));
413
+ });
414
+ });
415
+ chatgpt.addCommand(workContinue, { hidden: true });
416
+
366
417
  chatgpt
367
418
  .command('browser-open')
368
419
  .description('Print a saved ChatGPT browser session conversation URL; pass --launch to open it in the system browser')
@@ -162,7 +162,7 @@ function checkCliUpdate(): DoctorCheckResult {
162
162
  id,
163
163
  describe,
164
164
  status: 'warn',
165
- detail: `current=${CLI_VERSION}; latest=${latest.version}; agent_action=bun add -g ${PACKAGE_NAME}@latest && forge init`,
165
+ detail: `current=${CLI_VERSION}; latest=${latest.version}; agent_action=bun add -g ${PACKAGE_NAME}@latest && forge install`,
166
166
  };
167
167
  }
168
168
  return { id, describe, status: 'ok', detail: `current=${CLI_VERSION}; latest=${latest.version}` };