@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.
- package/AGENTS.md +4 -0
- package/CHANGELOG.md +39 -0
- package/CLAUDE.md +4 -0
- package/README.md +2 -2
- package/README.zh-CN.md +1 -1
- package/SKILL.md +2 -2
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/agents/openai.yaml +1 -1
- package/assets/hooks/hook-input.sh +11 -8
- package/assets/hooks/lib/session-state.sh +10 -7
- package/assets/hooks/lib/workflow-state.sh +13 -177
- package/assets/hooks/post-tool-observer.sh +8 -2
- package/assets/hooks/prompt-guard.sh +5 -81
- package/assets/hooks/session-start-context.sh +56 -1
- package/assets/partials/05-workflow.partial.md +1 -1
- package/assets/partials-agents/02-operating-mode.partial.md +2 -0
- package/assets/partials-agents/03-orchestration.partial.md +1 -1
- package/assets/plugin-registry.v1.json +3 -3
- package/assets/reference-configs/document-generation.md +1 -1
- package/assets/reference-configs/harness-overview.md +1 -1
- package/assets/reference-configs/sprint-contracts.md +3 -3
- package/assets/skill-version.json +2 -2
- package/assets/templates/contract.template.md +2 -7
- package/assets/templates/helpers/capture-plan.sh +2 -2
- package/assets/templates/helpers/check-architecture-sync.sh +17 -0
- package/assets/templates/helpers/check-task-workflow.sh +4 -4
- package/assets/templates/helpers/contract-worktree.sh +1 -21
- package/assets/templates/helpers/ensure-task-workflow.sh +11 -36
- package/assets/templates/helpers/inspect-project-state.ts +8 -6
- package/assets/templates/helpers/migrate-project-template.sh +22 -45
- package/assets/templates/helpers/migrate-workflow-docs.ts +9 -7
- package/assets/templates/helpers/new-plan.sh +1 -1
- package/assets/templates/helpers/plan-to-todo.sh +12 -37
- package/assets/templates/helpers/ship-worktrees.sh +2 -29
- package/assets/templates/helpers/verify-contract.sh +1 -111
- package/assets/templates/helpers/verify-sprint.sh +3 -180
- package/assets/templates/helpers/workflow-contract.ts +5 -1
- package/assets/templates/plan.template.md +1 -1
- package/assets/templates/review.template.md +9 -34
- package/assets/workflow-contract.v1.json +10 -19
- package/docs/README.md +10 -10
- package/docs/architecture/CURRENT.md +178 -0
- package/docs/architecture/EVOLUTION.md +42 -0
- package/docs/architecture/current/README.md +4 -156
- package/docs/architecture/decisions/20260803-release-identity-binding-and-exit-policy.md +2 -2
- package/docs/architecture/decisions/20260823-immediate-controller-relay.md +53 -0
- package/docs/architecture/decisions/20260826-browser-runtime-v2.md +73 -0
- package/docs/architecture/history/README.md +7 -0
- package/docs/architecture/{chatgpt-handoff-facade.md → history/chatgpt-handoff-facade.md} +4 -0
- package/docs/architecture/{global-hook-runtime.md → history/global-hook-runtime.md} +7 -3
- package/docs/architecture/{ios-semantic-automation-provider-v2.md → history/ios-semantic-automation-provider-v2.md} +6 -2
- package/docs/architecture/history.md +3 -34
- package/docs/architecture/index.md +15 -98
- package/docs/architecture/modules/controller-runtime/transport-lifecycle.md +1 -1
- package/docs/architecture/reviews/2026-08-22-semantic-harness-convergence-acceptance.md +39 -0
- package/docs/architecture/versions/1.6.md +38 -0
- package/docs/architecture/versions/1.7.md +41 -0
- package/docs/forge-chatgpt-browser-engine.md +2 -2
- package/docs/forge-chatgpt-mcp-setup.md +4 -28
- package/docs/forge-chatgpt-supervised-automation.md +3 -3
- package/docs/forge-github-issue-launcher.md +1 -1
- package/docs/forge-plugin-management.md +1 -1
- package/docs/forge-runtime-self-healing-loop.md +1 -1
- package/docs/operations/controller-browser-plugin.md +26 -6
- package/docs/operations/controller-performance-and-502.md +143 -0
- package/docs/operations/controller-reliability-runbook.md +1 -1
- package/docs/operations/features.md +2 -2
- package/docs/operations/github-repository.md +1 -1
- package/docs/operations/homebrew.md +2 -2
- package/docs/operations/mcp-tool-exposure.md +5 -3
- package/docs/wiki/Architecture.md +6 -6
- package/docs/wiki/Implementation.md +2 -2
- package/docs/wiki/Integrations.md +2 -2
- package/docs/wiki/Work-Lifecycle.md +1 -1
- package/package.json +33 -11
- package/scripts/activate-source-baseline.ts +17 -13
- package/scripts/architecture-event.ts +2 -820
- package/scripts/architecture-queue.sh +2 -645
- package/scripts/archive-architecture-request.sh +2 -242
- package/scripts/archive-workflow.sh +1 -291
- package/scripts/benchmark-background-check-overlap.ts +228 -0
- package/scripts/benchmark-mcp-host.sh +117 -0
- package/scripts/benchmark-mcp-transport.ts +170 -0
- package/scripts/benchmark-quality-harness.ts +146 -0
- package/scripts/benchmark-route-session-concurrency.ts +207 -6
- package/scripts/benchmark-thin-harness-mcp-e2e.ts +7 -1
- package/scripts/benchmark-typescript-navigation.ts +186 -0
- package/scripts/benchmark-work-efficiency.ts +334 -0
- package/scripts/capability-config.ts +2 -392
- package/scripts/capability-resolver.ts +2 -503
- package/scripts/capture-plan.sh +1 -332
- package/scripts/check-agent-tooling.sh +2 -1558
- package/scripts/check-architecture-sync.sh +2 -371
- package/scripts/check-brain-manifest.sh +2 -253
- package/scripts/check-context-files.sh +2 -47
- package/scripts/check-deploy-sql-order.sh +2 -115
- package/scripts/check-mcp-compatibility.ts +14 -0
- package/scripts/check-runtime-architecture.mjs +349 -79
- package/scripts/check-skill-version.ts +3 -191
- package/scripts/check-source-duplication.mjs +61 -0
- package/scripts/check-stable-baseline.ts +92 -0
- package/scripts/check-task-sync.sh +2 -63
- package/scripts/check-task-workflow.sh +2 -1000
- package/scripts/codex-handoff-resume.sh +2 -267
- package/scripts/context-contract-sync.sh +2 -514
- package/scripts/contract-run.ts +2 -463
- package/scripts/contract-worktree.sh +1 -722
- package/scripts/ensure-task-workflow.sh +1 -1225
- package/scripts/host-temporary-cloud-mcp-e2e.sh +265 -0
- package/scripts/inspect-project-state.ts +4 -279
- package/scripts/install-standalone-recovery.ts +24 -0
- package/scripts/lib/project-init-lib.sh +22 -46
- package/scripts/lib/run-forge-helper.sh +19 -0
- package/scripts/lib/run-forge-helper.ts +26 -0
- package/scripts/migrate-project-template.sh +1 -1189
- package/scripts/migrate-workflow-docs.ts +4 -412
- package/scripts/new-plan.sh +1 -180
- package/scripts/new-spec.sh +1 -47
- package/scripts/new-sprint.sh +1 -46
- package/scripts/plan-to-todo.sh +1 -796
- package/scripts/prepare-codex-handoff.sh +2 -201
- package/scripts/prepare-handoff.sh +1 -78
- package/scripts/refresh-current-status.sh +2 -467
- package/scripts/run-governed-gate.ts +5 -1
- package/scripts/select-agent-context-blocks.sh +2 -64
- package/scripts/ship-worktrees.sh +1 -558
- package/scripts/smoke-ios-physical-device.ts +4 -2
- package/scripts/smoke-runtime-recovery.ts +1 -35
- package/scripts/smoke-schedule-engine.ts +1 -20
- package/scripts/sprint-backlog.sh +1 -834
- package/scripts/stage-runtime-release.ts +2 -1
- package/scripts/summarize-failures.sh +2 -123
- package/scripts/switch-plan.sh +1 -150
- package/scripts/sync-brain-docs.sh +2 -379
- package/scripts/sync-generated-authority.mjs +175 -0
- package/scripts/verify-contract.sh +2 -703
- package/scripts/verify-forge-runtime.sh +0 -1
- package/scripts/verify-sprint.sh +1 -677
- package/scripts/workflow-contract.ts +4 -205
- package/scripts/workstream-sync.sh +2 -261
- package/src/cli/agent-jobs/executor-health.ts +1 -1
- package/src/cli/commands/init-hook.ts +3 -3
- package/src/cli/commands/mcp.ts +9 -5
- package/src/cli/commands/plugin.ts +12 -3
- package/src/cli/commands/recovery.ts +25 -3
- package/src/cli/commands/runtime.ts +55 -3
- package/src/cli/commands/security.ts +12 -1
- package/src/cli/commands/setup-profile.ts +31 -21
- package/src/cli/controller/check-runner.ts +113 -5
- package/src/cli/controller/composite-result.ts +1 -1
- package/src/cli/controller/context/focus.ts +51 -0
- package/src/cli/controller/context/instruction-context.ts +114 -0
- package/src/cli/controller/context/known-paths.ts +76 -0
- package/src/cli/controller/context/query-planning.ts +110 -0
- package/src/cli/controller/context/rule-resolution.ts +532 -0
- package/src/cli/controller/context/source-materializer.ts +278 -0
- package/src/cli/controller/context/structural.ts +16 -0
- package/src/cli/controller/context/types.ts +286 -0
- package/src/cli/controller/context-pack.ts +828 -487
- package/src/cli/controller/launch-agents.ts +77 -2
- package/src/cli/controller/operational-plan.ts +2 -2
- package/src/cli/controller/work-mode.ts +6 -4
- package/src/cli/editing/edit-session.ts +60 -7
- package/src/cli/github/contracts.ts +16 -0
- package/src/cli/github/github.ts +135 -16
- package/src/cli/github/session.ts +2 -1
- package/src/cli/installer/managed-entries.ts +15 -1
- package/src/cli/local-bridge/console-automations.ts +54 -78
- package/src/cli/local-bridge/console-view-models.ts +1 -35
- package/src/cli/local-bridge/facade-api.ts +37 -264
- package/src/cli/local-bridge/frontend/src/App.tsx +3 -3
- package/src/cli/local-bridge/frontend/src/features/automations/AutomationsView.tsx +23 -13
- package/src/cli/local-bridge/frontend/src/features/capabilities/CapabilitiesView.tsx +37 -4
- package/src/cli/local-bridge/frontend/src/features/overview/OverviewView.tsx +6 -4
- package/src/cli/local-bridge/frontend/src/lib/api.ts +1 -6
- package/src/cli/local-bridge/frontend/src/lib/routes.ts +1 -1
- package/src/cli/local-bridge/frontend/src/shell/Sidebar.tsx +2 -2
- package/src/cli/local-bridge/frontend/src/styles.css +1 -1
- package/src/cli/local-bridge/frontend/src/types.ts +5 -8
- package/src/cli/local-bridge/job-store.ts +1 -490
- package/src/cli/local-bridge/server.ts +2 -515
- package/src/cli/local-bridge/ui-dist/app.css +1 -1
- package/src/cli/local-bridge/ui-dist/app.js +3703 -3757
- package/src/cli/mcp/auth.ts +5 -5
- package/src/cli/mcp/instructions.ts +3 -2
- package/src/cli/mcp/legacy-tool-service.ts +10 -222
- package/src/cli/mcp/multi-repository.ts +16 -5
- package/src/cli/mcp/oauth.ts +175 -26
- package/src/cli/mcp/post-finalize-work-attribution.ts +150 -0
- package/src/cli/mcp/repository-tools.ts +282 -146
- package/src/cli/mcp/server.ts +586 -116
- package/src/cli/mcp/tool-capability-cache.ts +1 -1
- package/src/cli/mcp/tool-contract.ts +14 -0
- package/src/cli/mcp/toolset-selection.ts +1 -1
- package/src/cli/mcp/toolset.ts +44 -7
- package/src/cli/mcp/transports/http.ts +124 -14
- package/src/cli/mcp/transports/session-registry.ts +43 -5
- package/src/cli/mcp/types.ts +3 -3
- package/src/cli/repositories/command-classifier.ts +103 -21
- package/src/cli/repositories/command-executor.ts +78 -526
- package/src/cli/repositories/command-process.ts +108 -0
- package/src/cli/repositories/command-scope.ts +99 -41
- package/src/cli/repositories/controller-home.ts +7 -8
- package/src/cli/repositories/git-command-executor.ts +2 -0
- package/src/cli/repositories/locks.ts +53 -16
- package/src/cli/repositories/repository-snapshot.ts +124 -0
- package/src/cli/repositories/selected-path-actions.ts +17 -9
- package/src/cli/repositories/structured-git.ts +118 -6
- package/src/cli/repository/inspector.ts +563 -65
- package/src/cli/repository/session-cache.ts +58 -17
- package/src/cli/v81-entry.ts +1 -4
- package/src/effects/fs-transaction.ts +85 -17
- package/src/runtime/context/codegraph-read-provider.ts +233 -2
- package/src/runtime/context/codegraph-sidecar.cjs +74 -40
- package/src/runtime/context/generic-lsp-provider.ts +355 -0
- package/src/runtime/context/lsp-client.ts +283 -0
- package/src/runtime/context/semantic-navigation-contract.ts +61 -0
- package/src/runtime/context/semantic-navigation.ts +223 -0
- package/src/runtime/context/swift-navigation.ts +565 -0
- package/src/runtime/context/typescript-navigation.ts +226 -0
- package/src/runtime/control-plane/dispatch-priority.ts +28 -0
- package/src/runtime/control-plane/execution/direct-edit-work-completion.ts +48 -16
- package/src/runtime/control-plane/execution/edit-validation-coordinator.ts +86 -24
- package/src/runtime/control-plane/execution/repository-work-attribution.ts +106 -0
- package/src/runtime/control-plane/execution/retained-work-resume.ts +203 -0
- package/src/runtime/control-plane/execution/session-store.ts +18 -0
- package/src/runtime/control-plane/execution/verification-evidence.ts +58 -3
- package/src/runtime/control-plane/execution/work-completion-authority.ts +58 -0
- package/src/runtime/control-plane/execution/work-evidence-policy.ts +200 -0
- package/src/runtime/control-plane/execution/work-execution-support.ts +386 -0
- package/src/runtime/control-plane/execution/work-finalization-service.ts +1913 -0
- package/src/runtime/control-plane/execution/work-handle-authority.ts +96 -0
- package/src/runtime/control-plane/execution/work-handle-store.ts +27 -2
- package/src/runtime/control-plane/execution/work-lifecycle-audit.ts +258 -0
- package/src/runtime/control-plane/execution/work-operation-service.ts +468 -0
- package/src/runtime/control-plane/execution/work-path-scope.ts +37 -0
- package/src/runtime/control-plane/execution/work-preparation-service.ts +479 -0
- package/src/runtime/control-plane/execution/work-process-evidence.ts +129 -0
- package/src/runtime/control-plane/execution/work-remote-delivery.ts +215 -0
- package/src/runtime/control-plane/execution/work-task-receipt.ts +22 -18
- package/src/runtime/control-plane/execution/work-terminal-cleanup.ts +156 -11
- package/src/runtime/control-plane/execution/work-validation-reconciler.ts +22 -14
- package/src/runtime/control-plane/execution/work-verification-context.ts +56 -0
- package/src/runtime/control-plane/execution/work-verification-service.ts +388 -0
- package/src/runtime/control-plane/execution/work-verification-snapshot.ts +90 -9
- package/src/runtime/control-plane/facade/capability-registry.ts +129 -25
- package/src/runtime/control-plane/facade/controller-round-relay.ts +1118 -0
- package/src/runtime/control-plane/facade/controller-session-store.ts +302 -12
- package/src/runtime/control-plane/facade/goal-workloop-access.ts +17 -1
- package/src/runtime/control-plane/facade/goal-workloop.ts +928 -190
- package/src/runtime/control-plane/facade/index.ts +3 -0
- package/src/runtime/control-plane/facade/plan-contract-store.ts +275 -42
- package/src/runtime/control-plane/facade/repository-work-admission.ts +147 -0
- package/src/runtime/control-plane/facade/requirement-authority.ts +83 -0
- package/src/runtime/control-plane/facade/semantic-admission.ts +205 -0
- package/src/runtime/control-plane/facade/suggested-actions.ts +5 -1
- package/src/runtime/control-plane/facade/types.ts +90 -10
- package/src/runtime/control-plane/facade/work-contract-store.ts +157 -261
- package/src/runtime/control-plane/facade/work-state-machine.ts +250 -0
- package/src/runtime/control-plane/generated-cache-retention.ts +271 -0
- package/src/runtime/control-plane/global-scheduler/config.ts +44 -0
- package/src/runtime/control-plane/global-scheduler/dispatch-capacity.ts +80 -0
- package/src/runtime/control-plane/global-scheduler/durable-admission.ts +46 -0
- package/src/runtime/control-plane/global-scheduler/maintenance.ts +152 -0
- package/src/runtime/control-plane/global-scheduler/projection-refresh.ts +84 -0
- package/src/runtime/control-plane/global-scheduler/reconciliation.ts +3 -3
- package/src/runtime/control-plane/global-scheduler/scheduler.ts +278 -543
- package/src/runtime/control-plane/global-scheduler/source-scan.ts +59 -0
- package/src/runtime/control-plane/global-scheduler/state.ts +88 -0
- package/src/runtime/control-plane/global-scheduler/worker-attachment.ts +57 -0
- package/src/runtime/control-plane/global-scheduler/worker-exit-decision.ts +38 -0
- package/src/runtime/control-plane/global-scheduler/worker-exit-reconciler.ts +175 -0
- package/src/runtime/control-plane/global-scheduler/worker-launch.ts +111 -0
- package/src/runtime/control-plane/global-scheduler/worker-lifecycle-store.ts +64 -0
- package/src/runtime/control-plane/global-scheduler/worker-lifecycle.ts +150 -0
- package/src/runtime/control-plane/global-scheduler/worker-process.ts +119 -0
- package/src/runtime/control-plane/global-scheduler/worker-stderr.ts +60 -0
- package/src/runtime/control-plane/launcher/chatgpt-work-binding-store.ts +63 -0
- package/src/runtime/control-plane/launcher/chatgpt-work-continuation.ts +365 -117
- package/src/runtime/control-plane/launcher/launch-reservation-store.ts +89 -0
- package/src/runtime/control-plane/launcher/thin-launcher.ts +244 -11
- package/src/runtime/control-plane/persistence/controller-home-migration.ts +487 -0
- package/src/runtime/control-plane/persistence/requirement-store.ts +0 -12
- package/src/runtime/control-plane/persistence/sqlite-store.ts +33 -2
- package/src/runtime/control-plane/release-retention.ts +62 -2
- package/src/runtime/control-plane/repo-actor/registry.ts +4 -2
- package/src/runtime/control-plane/routing/route-policy.ts +24 -21
- package/src/runtime/control-plane/routing/workspace-admission.ts +70 -0
- package/src/runtime/control-plane/runtime-status-client.ts +0 -2
- package/src/runtime/diagnostics/mcp-timing.ts +13 -0
- package/src/runtime/diagnostics/mcp-transport-benchmark.ts +129 -0
- package/src/runtime/diagnostics/performance.ts +24 -1
- package/src/runtime/evidence/event-ledger.ts +1 -1
- package/src/runtime/evidence/process-check-execution.ts +18 -0
- package/src/runtime/execution/jobs/child-reference.ts +6 -2
- package/src/runtime/execution/jobs/store.ts +58 -4
- package/src/runtime/execution/jobs/types.ts +1 -1
- package/src/runtime/execution/managed-workspace.ts +203 -1
- package/src/runtime/execution/process-runtime/check-facade.ts +51 -4
- package/src/runtime/execution/process-runtime/check-result.ts +88 -0
- package/src/runtime/execution/process-runtime/check-runner-sidecar.ts +7 -1
- package/src/runtime/execution/process-runtime/check-scheduling.ts +114 -0
- package/src/runtime/execution/process-runtime/command-facade.ts +367 -40
- package/src/runtime/execution/process-runtime/gc.ts +38 -6
- package/src/runtime/execution/process-runtime/lightweight-managed.ts +1201 -0
- package/src/runtime/execution/process-runtime/persisted-check.ts +51 -5
- package/src/runtime/execution/process-runtime/resource-claims.ts +10 -6
- package/src/runtime/execution/process-runtime/runtime.ts +53 -3
- package/src/runtime/execution/process-runtime/store.ts +1 -0
- package/src/runtime/execution/process-runtime/types.ts +4 -12
- package/src/runtime/execution/thin-harness/async-process.ts +12 -2
- package/src/runtime/execution/thin-harness/search-worker.ts +54 -5
- package/src/runtime/execution/work-activity.ts +21 -0
- package/src/runtime/execution/workers/executor.ts +18 -61
- package/src/runtime/gateway/mcp/execution-tools.ts +35 -1852
- package/src/runtime/gateway/mcp/legacy-ios-tool-adapter.ts +61 -0
- package/src/runtime/gateway/mcp/process-tools.ts +83 -37
- package/src/runtime/gateway/mcp/router.ts +186 -84
- package/src/runtime/gateway/mcp/runtime-tool-definitions.ts +565 -0
- package/src/runtime/gateway/mcp/runtime-tools.ts +2378 -1947
- package/src/runtime/plugins/app-store-connect-adapter.ts +216 -47
- package/src/runtime/plugins/browser-adapter.ts +2662 -829
- package/src/runtime/plugins/browser-automation-service.ts +10 -0
- package/src/runtime/plugins/browser-handoff-host.ts +2 -25
- package/src/runtime/plugins/browser-handoff.ts +110 -5
- package/src/runtime/plugins/browser-macos-bridge.ts +701 -63
- package/src/runtime/plugins/browser-manifest-surface.ts +603 -0
- package/src/runtime/plugins/browser-native-session-service.ts +222 -0
- package/src/runtime/plugins/browser-node-bridge.ts +6 -34
- package/src/runtime/plugins/browser-provider-registry.ts +109 -0
- package/src/runtime/plugins/browser-runtime-contract.ts +154 -0
- package/src/runtime/plugins/browser-runtime.ts +193 -0
- package/src/runtime/plugins/browser-session-authority.ts +332 -0
- package/src/runtime/plugins/browser-session-store.ts +121 -0
- package/src/runtime/plugins/browser-session-types.ts +98 -0
- package/src/runtime/plugins/capability-authorization-grants.ts +354 -0
- package/src/runtime/plugins/desktop-operator-registration.ts +10 -4
- package/src/runtime/plugins/external-adapter.ts +358 -3
- package/src/runtime/plugins/external-unix-socket.ts +7 -1
- package/src/runtime/plugins/first-party-registry.ts +2 -0
- package/src/runtime/plugins/github-adapter.ts +125 -0
- package/src/runtime/plugins/ios/agent-device-provider.ts +1 -1
- package/src/runtime/plugins/ios/agent-device-typed-provider.ts +52 -9
- package/src/runtime/plugins/ios/remote-xpc-hid.ts +1171 -0
- package/src/runtime/plugins/ios-adapter.ts +106 -16
- package/src/runtime/plugins/ios-agent-device.ts +234 -64
- package/src/runtime/plugins/ios-physical-device.ts +1143 -392
- package/src/runtime/plugins/lightweight-action.ts +153 -0
- package/src/runtime/plugins/local-system-adapter.ts +123 -6
- package/src/runtime/plugins/macos-capability-broker.ts +47 -9
- package/src/runtime/plugins/plugin-action-sidecar.ts +59 -0
- package/src/runtime/plugins/plugin-management-adapter.ts +49 -8
- package/src/runtime/plugins/resend-adapter.ts +1 -1
- package/src/runtime/plugins/store.ts +330 -33
- package/src/runtime/plugins/types.ts +38 -3
- package/src/runtime/plugins/xiaohongshu-publish.ts +515 -0
- package/src/runtime/projections/git-status-sampler.ts +16 -16
- package/src/runtime/projections/materialized-view.ts +28 -10
- package/src/runtime/recovery/maintenance-executor.ts +426 -25
- package/src/runtime/root/mcp-transport.ts +180 -10
- package/src/runtime/root/package-connector-service.ts +230 -10
- package/src/runtime/root/package-runtime-release.ts +143 -17
- package/src/runtime/root/package-runtime-service.ts +461 -22
- package/src/runtime/root/release-manifest.ts +144 -18
- package/src/runtime/root/release-materialize.ts +125 -32
- package/src/runtime/root/release-store.ts +48 -11
- package/src/runtime/root/runtime.ts +23 -5
- package/src/runtime/root/service.ts +100 -29
- package/src/runtime/root/types.ts +12 -0
- package/src/runtime/safe-tooling/ios-development.ts +321 -63
- package/src/runtime/shared/trusted-executable.ts +62 -0
- package/src/runtime/shared/trusted-node-executable.ts +48 -0
- package/src/runtime/standalone-recovery/core.ts +1079 -240
- package/src/runtime/standalone-recovery/entry.ts +100 -24
- package/src/runtime/standalone-recovery/installer.ts +20 -4
- package/src/runtime/standalone-recovery/service-labels.ts +2 -0
- package/src/runtime/standalone-recovery/watchdog-heartbeat.ts +160 -0
- package/src/runtime/workflow/schedules/browser-probe.ts +81 -3
- package/src/runtime/workflow/schedules/engine.ts +364 -202
- package/src/runtime/workflow/schedules/github-issue-watch.ts +158 -0
- package/src/runtime/workflow/schedules/settlement.ts +64 -17
- package/src/runtime/workflow/schedules/store.ts +209 -19
- package/src/runtime/workflow/schedules/types.ts +2 -4
- package/src/runtime/workflow/schedules/work-continuation.ts +26 -13
- package/src/testing/test-governance.ts +8 -40
- package/assets/reference-configs/heartbeat-triage.md +0 -57
- package/assets/templates/helpers/harness-trace-grade.sh +0 -150
- package/assets/templates/helpers/heartbeat-triage.sh +0 -361
- package/assets/templates/helpers/maintenance-triage.sh +0 -167
- package/docs/architecture/current/approved-target-architecture.zh-CN.md +0 -1501
- package/docs/architecture/current/architecture-invariants.md +0 -331
- package/docs/architecture/current/automation-and-schedule-engine.md +0 -459
- package/docs/architecture/current/codegraph-context-provider.md +0 -238
- package/docs/architecture/current/control-plane-authority-inventory.md +0 -94
- package/docs/architecture/current/controller-repository-decoupling.md +0 -148
- package/docs/architecture/current/dispatch-and-agent-strategy.md +0 -373
- package/docs/architecture/current/entity-model.md +0 -612
- package/docs/architecture/current/external-plugin-governance.md +0 -396
- package/docs/architecture/current/failure-recovery.md +0 -447
- package/docs/architecture/current/governance.md +0 -213
- package/docs/architecture/current/human-interaction-plane.md +0 -87
- package/docs/architecture/current/implementation-status.md +0 -128
- package/docs/architecture/current/job-and-run-lifecycle.md +0 -413
- package/docs/architecture/current/legacy-governance.md +0 -58
- package/docs/architecture/current/local-workspace-target-grants.md +0 -70
- package/docs/architecture/current/migration-roadmap.md +0 -105
- package/docs/architecture/current/multi-repository-execution.md +0 -371
- package/docs/architecture/current/operations-runbook.md +0 -45
- package/docs/architecture/current/peer-supercontroller-runtime.md +0 -32
- package/docs/architecture/current/personal-assistant-plugin-baseline.md +0 -206
- package/docs/architecture/current/repository-access-modes.md +0 -102
- package/docs/architecture/current/route-policy.md +0 -15
- package/docs/architecture/current/route-session-concurrency.md +0 -85
- package/docs/architecture/current/runtime-architecture-simplification.md +0 -214
- package/docs/architecture/current/runtime-directory-map.md +0 -49
- package/docs/architecture/current/runtime-health-and-resource-lifecycle.md +0 -85
- package/docs/architecture/current/scheduler-and-resource-claims.md +0 -422
- package/docs/architecture/current/session-aware-execution-and-authorization.md +0 -77
- package/docs/architecture/current/system-overview.md +0 -169
- package/docs/architecture/current/target-requirements-traceability.md +0 -202
- package/docs/architecture/current/thin-harness-governance-policy.md +0 -32
- package/docs/architecture/current/thin-harness-v1.md +0 -321
- package/docs/architecture/current/verification-and-release-gates.md +0 -391
- package/docs/forge-autonomous-goal-loop.md +0 -9
- package/docs/forge-provider-configuration.md +0 -7
- package/docs/operations/chatgpt-personal-assistant-runtime.md +0 -93
- package/docs/operations/gmail-assistant-routines.md +0 -186
- package/docs/operations/personal-assistant-operator-guide.md +0 -61
- package/docs/operations/provider-configuration.md +0 -31
- package/scripts/harness-trace-grade.sh +0 -150
- package/scripts/heartbeat-triage.sh +0 -361
- package/scripts/maintenance-triage.sh +0 -167
- package/src/cli/local-bridge/frontend/src/features/settings/SettingsView.tsx +0 -2
- package/src/cli/repositories/goal-registry.ts +0 -239
- package/src/runtime/assistant/action-proposals.ts +0 -279
- package/src/runtime/assistant/intent.ts +0 -395
- package/src/runtime/assistant/model-provider.ts +0 -460
- package/src/runtime/assistant/openapi.ts +0 -223
- package/src/runtime/assistant/policy.ts +0 -89
- package/src/runtime/assistant/readiness.ts +0 -258
- package/src/runtime/assistant/routine-runtime.ts +0 -477
- package/src/runtime/assistant/schedule-binding.ts +0 -171
- package/src/runtime/assistant/standing-grants.ts +0 -375
- package/src/runtime/assistant/store.ts +0 -243
- package/src/runtime/assistant/types.ts +0 -135
- package/src/runtime/control-plane/goal-loop/config-facade.ts +0 -700
- package/src/runtime/control-plane/goal-loop/config-store.ts +0 -570
- package/src/runtime/control-plane/goal-loop/config-types.ts +0 -213
- package/src/runtime/control-plane/goal-loop/executor-router.ts +0 -109
- package/src/runtime/control-plane/goal-loop/failure-taxonomy.ts +0 -149
- package/src/runtime/control-plane/goal-loop/goal-contract-store.ts +0 -304
- package/src/runtime/control-plane/goal-loop/goal-loop-engine.ts +0 -1001
- package/src/runtime/control-plane/goal-loop/handoff-packet.ts +0 -160
- package/src/runtime/control-plane/goal-loop/index.ts +0 -13
- package/src/runtime/control-plane/goal-loop/local-tools.ts +0 -290
- package/src/runtime/control-plane/goal-loop/policy-gates.ts +0 -203
- package/src/runtime/control-plane/goal-loop/provider-dispatch.ts +0 -93
- package/src/runtime/control-plane/goal-loop/provider-registry.ts +0 -545
- package/src/runtime/control-plane/goal-loop/types.ts +0 -378
- package/src/runtime/control-plane/startup-recovery.ts +0 -198
- package/src/runtime/gateway/mcp/resource-policy.ts +0 -186
- package/src/runtime/personal-assistant/gmail-triage-manager.ts +0 -231
- package/src/runtime/personal-assistant/reporting-runtime.ts +0 -344
- package/src/runtime/personal-assistant/triage-runtime.ts +0 -748
- package/src/runtime/workflow/findings/store.ts +0 -204
- package/src/runtime/workflow/findings/types.ts +0 -58
- package/src/runtime/workflow/portfolio/engine.ts +0 -20
- package/src/runtime/workflow/portfolio/store.ts +0 -185
- package/src/runtime/workflow/portfolio/types.ts +0 -29
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
# CodeGraph Context Provider
|
|
2
|
-
|
|
3
|
-
Status: **Runtime Authority — impact-context convergence implemented**
|
|
4
|
-
Source baseline: `a49465096c4e2532da37ab2f9d10dca2238217ac`
|
|
5
|
-
Scope: Controller Context Plane only
|
|
6
|
-
|
|
7
|
-
## Problem
|
|
8
|
-
|
|
9
|
-
Forge already installs and diagnoses `@colbymchenry/codegraph`, and the repository already has a local `.codegraph/codegraph.db`. However, ChatGPT/Controller planning still relies on token search plus bounded raw file reads. CodeGraph is not available as a policy-bounded Controller read capability, so `-plan` and `-debug` cannot use symbol, call-graph, dependency, or impact data directly.
|
|
10
|
-
|
|
11
|
-
The missing capability is not another top-level MCP tool. It is a Context Plane provider that can add structural evidence to the existing `rh_context` / `controller_context_pack` path.
|
|
12
|
-
|
|
13
|
-
## Constraints
|
|
14
|
-
|
|
15
|
-
1. The default workflow remains unchanged. No explicit mode directive still uses the existing automatic Direct-first routing.
|
|
16
|
-
2. `-plan` and `-debug` are opt-in routing instructions. CodeGraph must not add latency to ordinary Direct edits by default.
|
|
17
|
-
3. Forge continues to support Node.js `>=20.10.0`.
|
|
18
|
-
4. CodeGraph's embedded SDK requires Node.js `>=22.5` to open its SQLite database through `node:sqlite`.
|
|
19
|
-
5. CodeGraph's CLI/MCP server uses its own bundled runtime and may auto-sync the index. Planning must not silently mutate source files or silently refresh derived indexes.
|
|
20
|
-
6. Source reads remain governed by the existing repository/path policy. A graph hit is discovery evidence, not permission to read a denied path.
|
|
21
|
-
7. The existing five facade tools remain the preferred host surface. Do not add a `codegraph_*` top-level Forge tool family.
|
|
22
|
-
8. If CodeGraph is absent, stale, incompatible, or unavailable, Context Pack must fail open to the existing bounded text search when structural context is optional, and fail clearly when structural context was explicitly required.
|
|
23
|
-
|
|
24
|
-
## Decision
|
|
25
|
-
|
|
26
|
-
Add a `CodeGraphReadProvider` to the Context Plane, backed by a self-contained CodeGraph sidecar running on CodeGraph's bundled Node runtime.
|
|
27
|
-
|
|
28
|
-
The Forge Controller process never imports and opens CodeGraph directly on Node 20. Instead it launches a small packaged sidecar with the matching platform bundle runtime and communicates through a bounded JSON protocol.
|
|
29
|
-
|
|
30
|
-
The sidecar opens CodeGraph with:
|
|
31
|
-
|
|
32
|
-
```text
|
|
33
|
-
CodeGraph.open(projectRoot, { sync: false, readOnly: true })
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
It never calls:
|
|
37
|
-
|
|
38
|
-
- `init` / `initSync`
|
|
39
|
-
- `indexAll` / `indexFiles`
|
|
40
|
-
- `sync`
|
|
41
|
-
- `watch`
|
|
42
|
-
- `optimize`
|
|
43
|
-
- `clear`
|
|
44
|
-
- `uninitialize`
|
|
45
|
-
|
|
46
|
-
This keeps structural planning read-only with respect to both the repository and the derived CodeGraph index.
|
|
47
|
-
|
|
48
|
-
## Runtime layout
|
|
49
|
-
|
|
50
|
-
```text
|
|
51
|
-
ChatGPT
|
|
52
|
-
-> rh_context / controller_context_pack
|
|
53
|
-
-> Context Pack builder
|
|
54
|
-
-> bounded text search + raw repository reads
|
|
55
|
-
-> CodeGraphReadProvider (only when requested)
|
|
56
|
-
-> CodeGraph sidecar
|
|
57
|
-
-> bundled CodeGraph Node runtime
|
|
58
|
-
-> CodeGraph.open(... readOnly=true, sync=false)
|
|
59
|
-
-> .codegraph/codegraph.db
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
The sidecar is a provider implementation detail. It is not a second Forge Runtime and does not own Controller state, Work, scheduling, repository mutation, or recovery.
|
|
63
|
-
|
|
64
|
-
## Provider contract
|
|
65
|
-
|
|
66
|
-
Phase 1 provider operations:
|
|
67
|
-
|
|
68
|
-
- `status`
|
|
69
|
-
- initialized
|
|
70
|
-
- provider/runtime availability
|
|
71
|
-
- index last indexed time
|
|
72
|
-
- index build version/extraction version
|
|
73
|
-
- stale-engine signal
|
|
74
|
-
- changed-file signal from CodeGraph when available
|
|
75
|
-
- `search`
|
|
76
|
-
- symbol/name search
|
|
77
|
-
- bounded node metadata only
|
|
78
|
-
- `context`
|
|
79
|
-
- task/query relevant subgraph via CodeGraph structural context
|
|
80
|
-
- bounded nodes and edges
|
|
81
|
-
- `impact`
|
|
82
|
-
- impact radius from a resolved node
|
|
83
|
-
- `file_dependencies`
|
|
84
|
-
- dependencies and dependents for explicit files
|
|
85
|
-
|
|
86
|
-
Later operations may add callers/callees/usages and affected-test calculation, but Phase 1 should not expand before the Context Pack integration is proven useful.
|
|
87
|
-
|
|
88
|
-
Every request includes the canonical repository root chosen by Repository Registry. The sidecar must reject attempts to substitute an arbitrary root after startup.
|
|
89
|
-
|
|
90
|
-
## Context Pack integration
|
|
91
|
-
|
|
92
|
-
Extend `ControllerContextPackOptions` with a structural context policy:
|
|
93
|
-
|
|
94
|
-
```text
|
|
95
|
-
structuralContext = off | auto | required
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
Default is `off` to preserve current Direct performance and behavior.
|
|
99
|
-
|
|
100
|
-
Expected mode usage:
|
|
101
|
-
|
|
102
|
-
- ordinary Direct: `off` (zero CodeGraph provider calls)
|
|
103
|
-
- explicit `-debug`: `auto`
|
|
104
|
-
- explicit `-plan`: `required` when a CodeGraph index is present; otherwise return a clear degraded-plan warning and use bounded text search
|
|
105
|
-
- Goal/Plan planning and review: `auto` or `required` when structural evidence materially improves the decision
|
|
106
|
-
|
|
107
|
-
When enabled, graph results augment candidate ranking and the bounded impact contract. They do not replace raw source reads. Important files selected through CodeGraph still pass through `resolveMcpPath` and `readRepositoryRange` before implementation.
|
|
108
|
-
|
|
109
|
-
After the initial structural `context` query, the Context Plane may issue bounded `file_dependencies` queries for a small number of entry-point files. Dependencies and dependents are folded into the same policy-filtered Context Pack; they are not exposed as another ChatGPT tool flow. The pack derives an `impactContext` containing primary targets, must-inspect and likely-affected files, related tests/checks, architecture contracts, coverage gaps, freshness, and confidence. These remain discovery evidence: ChatGPT is still the semantic-sufficiency authority.
|
|
110
|
-
|
|
111
|
-
Context Pack gains a bounded `structuralContext` section containing:
|
|
112
|
-
|
|
113
|
-
- provider: `codegraph`
|
|
114
|
-
- requested mode
|
|
115
|
-
- status: `ready | unavailable | stale | degraded`
|
|
116
|
-
- index freshness/build metadata
|
|
117
|
-
- query terms used
|
|
118
|
-
- selected structural entry points
|
|
119
|
-
- related/impact file paths
|
|
120
|
-
- graph truncation metadata
|
|
121
|
-
- fallback reason when graph data was not used
|
|
122
|
-
|
|
123
|
-
Candidate reasons should distinguish graph evidence, for example:
|
|
124
|
-
|
|
125
|
-
- `codegraph:search:<symbol>`
|
|
126
|
-
- `codegraph:context`
|
|
127
|
-
- `codegraph:impact:<node-id>`
|
|
128
|
-
- `codegraph:dependent:<path>`
|
|
129
|
-
|
|
130
|
-
## Freshness policy
|
|
131
|
-
|
|
132
|
-
Read-only planning never auto-syncs CodeGraph.
|
|
133
|
-
|
|
134
|
-
If the provider reports changed files, stale extraction, or an index built by an older extraction engine:
|
|
135
|
-
|
|
136
|
-
1. mark structural context stale/degraded;
|
|
137
|
-
2. do not silently run `sync` or `index`;
|
|
138
|
-
3. use direct repository reads for affected files;
|
|
139
|
-
4. optionally recommend an explicit CodeGraph refresh action outside the read-only planning step.
|
|
140
|
-
|
|
141
|
-
A later typed maintenance action may perform refresh. That action is separate from planning and may write only derived `.codegraph` state, never source files.
|
|
142
|
-
|
|
143
|
-
### Isolated checkout baseline overlay
|
|
144
|
-
|
|
145
|
-
CodeGraph binds source root and `.codegraph` database root to the same `projectRoot`; the embedded API does not expose a separate read-only database path. Forge therefore does **not** copy or synchronously build an 84MB-class structural index for every managed worktree.
|
|
146
|
-
|
|
147
|
-
When structural context is requested for an isolated checkout that has no local index, the Context Plane may reuse an indexed non-worktree checkout from the same Repository Registry family as **repository-baseline structural evidence**. Current-checkout lexical/raw source remains authoritative. Forge overlays the selected checkout's current Git-changed paths on the graph candidates and reports `indexSource=repository_baseline` plus explicit coverage gaps.
|
|
148
|
-
|
|
149
|
-
The baseline is never presented as current-checkout truth. A dirty current checkout or a baseline/current HEAD mismatch marks the structural evidence stale and prevents `structural_context=required` from being satisfied. Optional structural requests may still use the graph as bounded discovery evidence while raw current-checkout reads cover changed files.
|
|
150
|
-
|
|
151
|
-
This fallback executes only when structural context was already requested. Ordinary Direct routing remains `structural_context=off`, performs zero CodeGraph provider calls, and pays no baseline lookup or structural refresh cost.
|
|
152
|
-
|
|
153
|
-
## Packaging and platform behavior
|
|
154
|
-
|
|
155
|
-
The provider locates the matching optional platform package:
|
|
156
|
-
|
|
157
|
-
```text
|
|
158
|
-
@colbymchenry/codegraph-<platform>-<arch>
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
and uses its bundled `node` / `node.exe` to launch the packaged sidecar.
|
|
162
|
-
|
|
163
|
-
If the platform package is missing, provider status is `unavailable` with remediation to reinstall CodeGraph with optional dependencies enabled. Forge must remain usable without CodeGraph.
|
|
164
|
-
|
|
165
|
-
The sidecar code ships inside Forge's existing published `src/` or `scripts/` package surface; no new external service or daemon is required for Phase 1.
|
|
166
|
-
|
|
167
|
-
## Security and policy
|
|
168
|
-
|
|
169
|
-
- Structural queries are repository-scoped and read-only.
|
|
170
|
-
- Sidecar stdin accepts typed JSON requests, not shell commands.
|
|
171
|
-
- Sidecar output is bounded before returning to the host.
|
|
172
|
-
- Telemetry is disabled for provider subprocesses (`CODEGRAPH_TELEMETRY=0`, `DO_NOT_TRACK=1`).
|
|
173
|
-
- No network capability is required.
|
|
174
|
-
- No arbitrary executable path is accepted from the user.
|
|
175
|
-
- No arbitrary repository root is accepted from the user after Controller selection.
|
|
176
|
-
- Graph-selected paths are rechecked through Forge read policy before raw code is returned.
|
|
177
|
-
- Errors return bounded diagnostics and never dump database contents.
|
|
178
|
-
|
|
179
|
-
## Performance policy
|
|
180
|
-
|
|
181
|
-
Phase 1 uses an on-demand sidecar request path and records timing for:
|
|
182
|
-
|
|
183
|
-
- process startup
|
|
184
|
-
- CodeGraph open
|
|
185
|
-
- graph query
|
|
186
|
-
- Context Pack merge
|
|
187
|
-
|
|
188
|
-
Do not introduce a persistent sidecar pool until measurements show startup/open dominates p95 planning latency. If pooling is later justified, use bounded per-repository LRU instances with explicit close/eviction and no file watcher.
|
|
189
|
-
|
|
190
|
-
This avoids adding a new always-running process before benchmark evidence exists.
|
|
191
|
-
|
|
192
|
-
## Phase 1 implementation steps
|
|
193
|
-
|
|
194
|
-
1. Add the read-only sidecar and host provider with availability/freshness reporting.
|
|
195
|
-
2. Add unit tests proving no mutation operations are exposed by the provider protocol.
|
|
196
|
-
3. Add `structural_context` to `controller_context_pack`; default remains `off`.
|
|
197
|
-
4. Merge CodeGraph structural candidates with existing text-search candidates while retaining policy checks and raw snippets.
|
|
198
|
-
5. Update `SKILL.md` so explicit `-plan` requests structural context and explicit `-debug` prefers it when available. Do not change automatic Direct routing.
|
|
199
|
-
6. Add focused tests for unavailable provider fallback, stale-index warnings, graph candidate ranking, denied-path rechecks, and output bounds.
|
|
200
|
-
7. Run a live Forge CodeGraph query and record evidence before declaring CodeGraph integration ready.
|
|
201
|
-
|
|
202
|
-
## Acceptance criteria
|
|
203
|
-
|
|
204
|
-
Phase 1 is accepted only when all of the following are true:
|
|
205
|
-
|
|
206
|
-
- Node.js 20.10 remains the public Forge baseline.
|
|
207
|
-
- Default Direct workflow and Route Policy are unchanged.
|
|
208
|
-
- `controller_context_pack` with no structural option performs no CodeGraph process work.
|
|
209
|
-
- `structural_context=auto` degrades cleanly when CodeGraph is unavailable.
|
|
210
|
-
- `structural_context=required` reports a clear blocker/degraded state instead of silently pretending structural evidence exists.
|
|
211
|
-
- Sidecar opens the index read-only with sync disabled.
|
|
212
|
-
- A query cannot invoke CodeGraph mutation APIs.
|
|
213
|
-
- CodeGraph-selected files still obey Forge path policy before raw source is returned.
|
|
214
|
-
- Context Pack output remains bounded.
|
|
215
|
-
- Typecheck and targeted Context Pack/provider tests pass.
|
|
216
|
-
- A real query against Forge's `.codegraph` index returns structural evidence.
|
|
217
|
-
- No second Forge Runtime, rollout slot, or hidden managed browser/process authority is introduced.
|
|
218
|
-
|
|
219
|
-
## Architecture review
|
|
220
|
-
|
|
221
|
-
Review result: approved for Phase 1.
|
|
222
|
-
|
|
223
|
-
Reasons:
|
|
224
|
-
|
|
225
|
-
- Reuses the existing Context Plane instead of widening the top-level tool surface.
|
|
226
|
-
- Preserves the Node 20 public contract by isolating the SDK runtime requirement.
|
|
227
|
-
- Separates derived-index maintenance from read-only planning.
|
|
228
|
-
- Keeps Direct fast by making structural context opt-in.
|
|
229
|
-
- Preserves Forge path policy as the final authority for raw code access.
|
|
230
|
-
- Provides a measurable migration path: on-demand sidecar first, pooling only after benchmark evidence.
|
|
231
|
-
|
|
232
|
-
Rejected alternatives:
|
|
233
|
-
|
|
234
|
-
1. Import CodeGraph directly into Controller: rejected because it raises the effective Node runtime requirement to 22.5+.
|
|
235
|
-
2. Use `codegraph serve --mcp` directly for Plan reads: rejected for Phase 1 because its normal lifecycle includes connect-time catch-up and watcher/auto-sync behavior, which blurs the read-only planning boundary.
|
|
236
|
-
3. Add new Forge top-level `codegraph_*` MCP tools: rejected because the existing five-facade architecture should remain the preferred host surface.
|
|
237
|
-
4. Parse CodeGraph CLI human-readable output: rejected because the SDK provides a typed API and CLI text is a weaker protocol contract.
|
|
238
|
-
5. Auto-sync before every Plan: rejected because derived-state mutation must be explicit and should not inflate planning latency without evidence.
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
# Control-plane authority inventory
|
|
2
|
-
|
|
3
|
-
Status: current implementation
|
|
4
|
-
Cutover date: 2026-08-05
|
|
5
|
-
|
|
6
|
-
## Invariant
|
|
7
|
-
|
|
8
|
-
Each mutable control-plane record family has exactly one writer. For the
|
|
9
|
-
migrated families below that writer targets
|
|
10
|
-
`<durable-controller-home>/control-plane.sqlite`. Git stores source and accepted
|
|
11
|
-
documentation; artifact roots store bounded external evidence. Neither is a
|
|
12
|
-
second lifecycle writer.
|
|
13
|
-
|
|
14
|
-
## Mutable families and writers
|
|
15
|
-
|
|
16
|
-
| Family | SQLite identity | Sole writer boundary | Read/default projection |
|
|
17
|
-
| --- | --- | --- | --- |
|
|
18
|
-
| Requirement | `requirement/controller/<requirementId>` | Requirement store and Requirement facade CAS operations | Requirement Board |
|
|
19
|
-
| ExecutionPlan | `plan_contract/<repoId>/<planId>` | Plan-contract store and migrated completion transaction | Requirement Board and Execution Diagnostics |
|
|
20
|
-
| PlanStep | versioned member of its ExecutionPlan row | Plan mutation transaction; never Task JSON | Execution Diagnostics; deprecated Task alias derives from this state |
|
|
21
|
-
| Work and Requirement/Plan relationship | Work/contract namespaces scoped to repository | Work lifecycle store | Execution Diagnostics |
|
|
22
|
-
| Portfolio migration marker | `requirement_portfolio_migration/<repoId>/requirement-portfolio-20260802-v1` | one-time migration transaction | cutover guard and audit diagnostics |
|
|
23
|
-
| Revision/audit | `control_plane_records`, `control_plane_audit` | SQLite store transaction | integrity and recovery inspection |
|
|
24
|
-
| Repository identity | Git and repository registry, not Issue/Task | repository registration and Git observation paths | Work/diagnostic identity fields |
|
|
25
|
-
| Logs, binaries and large evidence | artifact files referenced by stable IDs | process/check/artifact owners | evidence references only |
|
|
26
|
-
|
|
27
|
-
## Frozen compatibility surfaces
|
|
28
|
-
|
|
29
|
-
The following surfaces have no durable runtime mutation authority after the
|
|
30
|
-
migration marker exists:
|
|
31
|
-
|
|
32
|
-
- repository Issue JSON/Markdown creation, status, archive and update;
|
|
33
|
-
- repository Task status, verification, completion and dependency mutation;
|
|
34
|
-
- `currentIssue` and legacy project-state mutation;
|
|
35
|
-
- legacy project-board mutation and default Issue/Task board;
|
|
36
|
-
- task-ledger and handoff artifact writes;
|
|
37
|
-
- governance reconciliation that mutates Issue/Task/project state;
|
|
38
|
-
- MCP aliases for legacy Issue/Task/currentIssue mutation;
|
|
39
|
-
- Local Bridge Issue/Task/currentIssue mutation routes;
|
|
40
|
-
- fallback overwrite or repository-to-SQLite reconciliation;
|
|
41
|
-
- Work-to-Task durable reverse projection.
|
|
42
|
-
|
|
43
|
-
Pre-cutover parsing helpers and ephemeral Issue support may remain for an
|
|
44
|
-
unmigrated fixture or historical tool compatibility. Every durable public entry
|
|
45
|
-
checks the migration marker before reading or writing a legacy file. This is not
|
|
46
|
-
a dual-writer allowance.
|
|
47
|
-
|
|
48
|
-
## Compatibility read contract
|
|
49
|
-
|
|
50
|
-
A historical Issue/Task alias may appear only in Execution Diagnostics or an
|
|
51
|
-
explicit legacy read API. Its state is derived from authoritative Requirement,
|
|
52
|
-
ExecutionPlan, PlanStep and Work rows. Responses identify themselves as
|
|
53
|
-
`deprecated`, `frozen`, `readOnly` and `controller-home-sqlite` authoritative.
|
|
54
|
-
Changing the source Issue/Task file after cutover cannot alter the projection.
|
|
55
|
-
|
|
56
|
-
The default user view is Requirement Board. It does not select a
|
|
57
|
-
`currentIssue`, expose a mutable legacy board or infer execution state from Git
|
|
58
|
-
JSON.
|
|
59
|
-
|
|
60
|
-
## Export contract
|
|
61
|
-
|
|
62
|
-
`requirement-portfolio-export` is SQLite-to-offline only. It includes the source
|
|
63
|
-
revision, migration fingerprint, per-record SQLite revisions and a content
|
|
64
|
-
fingerprint. Publication is staged and atomic. It cannot target `tasks/issues`,
|
|
65
|
-
has `replayAllowed: false`, and export failure does not affect the committed
|
|
66
|
-
SQLite transaction.
|
|
67
|
-
|
|
68
|
-
## Deletion verification
|
|
69
|
-
|
|
70
|
-
The final cutover tests prove:
|
|
71
|
-
|
|
72
|
-
1. all durable Issue/Task writer entry points fail at the cutover guard;
|
|
73
|
-
2. no source file contains both an authoritative SQLite writer call and a
|
|
74
|
-
legacy writer call;
|
|
75
|
-
3. no reverse export importer or stale-projection replay path exists;
|
|
76
|
-
4. late legacy writes leave SQLite-derived views unchanged;
|
|
77
|
-
5. Canonical Runtime and standalone Recovery minimum bootstrap do not depend on
|
|
78
|
-
legacy Issue/Task files.
|
|
79
|
-
|
|
80
|
-
Any later non-critical compatibility residue is recorded as a
|
|
81
|
-
MaintenanceFinding. It does not reopen a completed Requirement unless the user
|
|
82
|
-
outcome itself regresses.
|
|
83
|
-
|
|
84
|
-
## Session continuation versus HandoffItem
|
|
85
|
-
|
|
86
|
-
The frozen `handoff artifact writes` rule refers to lifecycle/decision handoff state. Current hooks may write only the ignored, rebuildable host-session cache under `.ai/harness/session/`; those files are projections for fresh-session context and are never control-plane writers.
|
|
87
|
-
|
|
88
|
-
A decision requiring ChatGPT or user judgement is represented by Runtime `HandoffItem` and surfaced through `rh_inbox`. Session Markdown cannot create, acknowledge, resolve, dismiss, supersede, or expire a `HandoffItem`.
|
|
89
|
-
|
|
90
|
-
`HandoffItem` persistence intentionally remains Controller-owned JSON at `Controller Home/repositories/<repoId>/handoff-inbox/index.json`, written atomically under the repository handoff-inbox lock. It is the sole authority for the attention/decision inbox. It is not moved into the Requirement/Plan/Work SQLite tables merely for storage uniformity: those tables own transactional delivery lifecycle, while the inbox owns bounded human/controller judgement points. Runtime restart recovery reopens this Controller Home record; repo-local session, projection, controller-packet, and transfer files are never replayed into it.
|
|
91
|
-
|
|
92
|
-
Repo-local recovery artifacts now have disjoint namespaces: `.ai/harness/session/` for rebuildable host-session context, `.ai/harness/controller/packets/` for bounded external-controller packets, `.ai/harness/projections/` for read-only compatibility/status views, and `.ai/harness/transfers/` for patch-transfer artifacts. The generic `.ai/harness/handoff/` namespace is retired.
|
|
93
|
-
|
|
94
|
-
See `docs/architecture/current/legacy-governance.md` for the RepoHarness-to-Forge disposition rules.
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
# Controller 与仓库解耦计划
|
|
2
|
-
|
|
3
|
-
## 背景
|
|
4
|
-
|
|
5
|
-
forge 已经具备 Repository Registry、`repoId`、`checkoutId` 和 controller home 运行态目录,但历史启动入口仍然以 `--repo` 为中心。这会让 MCP Gateway、Local Bridge 和具体仓库之间的边界变得模糊:服务看起来像是“从某个仓库启动并代表该仓库”,而不是“全局 controller 服务管理多个仓库”。
|
|
6
|
-
|
|
7
|
-
目标架构应改为:
|
|
8
|
-
|
|
9
|
-
```text
|
|
10
|
-
ChatGPT / Local UI
|
|
11
|
-
-> MCP Gateway / Local Bridge
|
|
12
|
-
-> Controller Runtime
|
|
13
|
-
-> Repository Registry
|
|
14
|
-
-> repoId + checkoutId scoped repository operation
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
`repoRoot` 只应在注册仓库、兼容旧配置、具体执行命令时出现;服务级配置和运行态应逐步迁移到 controller home。
|
|
18
|
-
|
|
19
|
-
## 命名边界
|
|
20
|
-
|
|
21
|
-
- **MCP Gateway**:ChatGPT 连接的全局工具网关,不应绑定某个仓库身份。
|
|
22
|
-
- **Local Bridge**:本机 Local Workbench/API 兼容名称,负责本地 GUI、移动 intent、本地任务入口。
|
|
23
|
-
- **Repository**:被注册、选择、执行的工作目标。
|
|
24
|
-
- **repoId / checkoutId**:所有仓库级操作的显式作用域。
|
|
25
|
-
- **repoRoot**:仓库本地路径,只在注册和执行层使用。
|
|
26
|
-
|
|
27
|
-
## 分阶段改动
|
|
28
|
-
|
|
29
|
-
### Phase 1:文档与入口语义收敛
|
|
30
|
-
|
|
31
|
-
- 将 `--repo` 描述为兼容默认仓库和配置引导入口。
|
|
32
|
-
- 文档中明确 MCP Gateway / Local Bridge 是全局 controller 服务。
|
|
33
|
-
- GUI 和用户文案避免把 Local Bridge 暴露成用户需要理解的概念。
|
|
34
|
-
|
|
35
|
-
### Phase 2:Local Bridge 支持 repoId-scoped 业务入口
|
|
36
|
-
|
|
37
|
-
先不迁移存储,降低风险。
|
|
38
|
-
|
|
39
|
-
- `LocalBridgeServerOptions` 保留 `repoRoot` 作为兼容 fallback。
|
|
40
|
-
- 新增 `controllerHome` 和 `defaultRepoId` 选项。
|
|
41
|
-
- `/api/snapshot`、`/api/user-snapshot` 支持 `?repoId=` 和 `?checkoutId=`。
|
|
42
|
-
- 新增 `/api/repositories/:repoId/snapshot`。
|
|
43
|
-
- 新增 `/api/repositories/:repoId/user-snapshot`。
|
|
44
|
-
- 仓库列表按 selected repoId 标记 current,而不是只能按启动 repoRoot 判断。
|
|
45
|
-
- completion、progress、governance、assistant readiness/intent 和 recovery probe/plan/apply 入口通过 request 解析目标仓库。
|
|
46
|
-
- assistant inbox/routines/memory、runtime cleanup、mobile devices 入口通过 request 解析目标仓库。
|
|
47
|
-
- project-state、issue focus、launch/archive/restore、task launch/verify/accept/request-changes/cancel/dependencies 和 timeline 入口通过 request 解析目标仓库。
|
|
48
|
-
- task detail、worklog export、edit session list/detail/diff/savepoint/verify/finalize/rollback 入口通过 request 解析目标仓库。
|
|
49
|
-
- plugin、GitHub sync、browser target、DeepSeek handoff/request 入口通过 request 解析目标仓库。
|
|
50
|
-
- local jobs 与 runs 的 detail/log/events/finish/diff/integrate/cancel/retry 入口通过 request 解析目标仓库。
|
|
51
|
-
|
|
52
|
-
### Phase 3:迁移服务级运行态到 controllerHome
|
|
53
|
-
|
|
54
|
-
后续迁移应拆独立任务,避免和 UI/执行逻辑混在一起。
|
|
55
|
-
|
|
56
|
-
MCP service-level 配置以 controller home 为 authority:
|
|
57
|
-
|
|
58
|
-
```text
|
|
59
|
-
controllerHome/
|
|
60
|
-
mcp/mcp.local.json
|
|
61
|
-
mcp/mcp.runtime.json
|
|
62
|
-
mcp/mcp.oauth.json
|
|
63
|
-
mcp/mcp.oauth-tokens.json
|
|
64
|
-
mcp/mcp.tokens.json
|
|
65
|
-
local-bridge/server.json
|
|
66
|
-
local-bridge/sessions.json
|
|
67
|
-
plugins/*.json
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
继续 repo-scoped:
|
|
71
|
-
|
|
72
|
-
```text
|
|
73
|
-
controllerHome/repositories/<repoId>/runs
|
|
74
|
-
controllerHome/repositories/<repoId>/local-jobs
|
|
75
|
-
controllerHome/repositories/<repoId>/worktrees
|
|
76
|
-
controllerHome/repositories/<repoId>/edit-sessions
|
|
77
|
-
controllerHome/repositories/<repoId>/artifacts
|
|
78
|
-
controllerHome/repositories/<repoId>/controller-state
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
仓库目录可继续保留 repo policy、兼容 symlink / projection,以及 MCP 旧版本 fallback:
|
|
82
|
-
|
|
83
|
-
```text
|
|
84
|
-
.forge/mcp.policy.json
|
|
85
|
-
.forge/mcp.local.json # legacy service config fallback
|
|
86
|
-
.forge/mcp.tokens.json # legacy bearer fallback
|
|
87
|
-
.forge/mcp.oauth.json # legacy OAuth passphrase fallback
|
|
88
|
-
.forge/mcp.oauth-tokens.json # legacy OAuth token-store fallback
|
|
89
|
-
.forge/mcp.runtime.json # legacy runtime fallback
|
|
90
|
-
.forge/plugins/*.json
|
|
91
|
-
.forge/external-filesystem-grants.json
|
|
92
|
-
.ai/harness/* # compatibility/projection only
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## 兼容策略
|
|
96
|
-
|
|
97
|
-
- 多仓库启用时,MCP 工具和 Local Bridge 写操作必须显式携带 `repoId`,不能靠启动目录猜测。
|
|
98
|
-
- 单仓库启用时可以保留 sole repository fallback。
|
|
99
|
-
- `--repo` 在迁移完成前继续可用,但不应被描述为服务身份。
|
|
100
|
-
- MCP service-level 配置读取顺序为 controllerHome 优先、repo-local `.forge/mcp.*` legacy fallback 其次;新 controller profile setup/restart/keepalive 写入 controllerHome。
|
|
101
|
-
|
|
102
|
-
## 当前完成状态
|
|
103
|
-
|
|
104
|
-
- 已新增 Local Bridge request-level repo selection helper。
|
|
105
|
-
- 已让 `/api/snapshot` 和 `/api/user-snapshot` 支持 repoId / checkoutId。
|
|
106
|
-
- 已新增 repoId-scoped snapshot 和 user-snapshot endpoints。
|
|
107
|
-
- 已将主要 Local Bridge 业务 API 改为 request-scoped repo selection,包括 completion、progress、governance、assistant、recovery、project-state、issue/task、timeline、worklog、edit-session、plugin、GitHub、toolchain、local jobs 和 runs。
|
|
108
|
-
- 已将 README 的启动说明改为 registry-first / compatibility `--repo` 语义。
|
|
109
|
-
- MCP HTTP service-level 配置、auth token、OAuth passphrase/token store、public origin 和 runtime state 已迁移到 controllerHome-backed storage,并保留 `.forge/mcp.*` legacy fallback。
|
|
110
|
-
- 当前剩余的 `options.repoRoot` 用法集中在启动默认仓库 fallback、启动时 reconcile、stream signature、runtime policy/mobile intent 兼容入口、仓库列表默认选择和 server close/cache cleanup。
|
|
111
|
-
|
|
112
|
-
## 仍未完成的架构收口
|
|
113
|
-
|
|
114
|
-
### 1. MCP Gateway 身份边界复核
|
|
115
|
-
|
|
116
|
-
已复核 MCP Gateway 的 controller profile 主路径:
|
|
117
|
-
|
|
118
|
-
- `src/cli/mcp/server.ts` 在 controller profile 下创建 multi-repository context;`--repo .` 会被降级为未指定 repo,避免把当前目录强行当作服务身份。
|
|
119
|
-
- `src/cli/mcp/multi-repository.ts` 会给工具 schema 注入 `repo_id` / `checkout_id`,并在调用时通过 Repository Registry 解析目标仓库。
|
|
120
|
-
- 未传 `repo_id` 时只允许 explicit repository fallback 或 sole-repository fallback;多仓库场景应返回解析错误。
|
|
121
|
-
- MCP tool 调用会使用目标仓库的 `repository.canonicalRoot` 构造 scoped context,并把 repository/runtimeStorage envelope 写回结果。
|
|
122
|
-
- `src/cli/mcp/repository-tools.ts` 的 repository/git/safe-patch/command tools 已按 `repo_id` / `checkout_id` 解析目标仓库,并把 command job payload 绑定到 `repoId` / `checkoutId`。
|
|
123
|
-
|
|
124
|
-
durable router 和 runtime gateway 主路径均已完成补充复核:
|
|
125
|
-
|
|
126
|
-
- `src/runtime/gateway/mcp/router.ts` 会对可持久化 MCP 调用执行 `resolveRepositorySelection`,将 `repoId` / `checkoutId` 写入 ExecutionJob,并通过 `repositoryScopedToolArgs` 注入目标仓库上下文。
|
|
127
|
-
- controller-scoped repository tools 仅限 `repository_register` 以及未指定仓库的 `repository_workbench`;其他 repository tools 会解析目标仓库。
|
|
128
|
-
- `src/runtime/gateway/mcp/runtime-tools.ts` 的 tool definitions 暴露 `repo_id`,执行 helper `selected(ctx,args)` 使用 `repo_id` / `checkout_id` / explicit repository / sole-repository fallback 统一解析目标仓库;已抽查 work/git/local-bridge/plugin/recovery/iOS/review/runtime-cleanup 等工具段,均通过目标 repository 执行。
|
|
129
|
-
|
|
130
|
-
### 2. 服务级运行态迁移
|
|
131
|
-
|
|
132
|
-
MCP Gateway 的 service-level runtime/config 已迁移到 `controllerHome/mcp/mcp.*`,并将 repo-local `.forge/mcp.*` 降级为 legacy fallback。Local Bridge 仍保留 `options.repoRoot` 用于启动级 reconcile、stream signature、runtime policy 和缓存清理。短期允许作为 compatibility default;长期应迁移为 controller-home/global runtime state,并让 `repoRoot` 只出现在 repository registration 和 repository-scoped execution 层。
|
|
133
|
-
|
|
134
|
-
### 3. 最小多仓库验收
|
|
135
|
-
|
|
136
|
-
不需要膨胀测试,但至少应做以下针对性验证:
|
|
137
|
-
|
|
138
|
-
- 注册两个仓库后,分别请求 snapshot / issue / run / plugin API,不串仓。
|
|
139
|
-
- `repoId`、`checkoutId`、默认 fallback 三条路径行为明确且可解释。
|
|
140
|
-
- GUI 切换仓库后,所有业务请求携带选中的 repoId。
|
|
141
|
-
- Local Bridge 重启后,默认仓库只影响初始选择,不影响 request-scoped API。
|
|
142
|
-
|
|
143
|
-
## 后续验收点
|
|
144
|
-
|
|
145
|
-
- GUI 切换仓库后,请求应带 `repoId`,而不是依赖启动目录。
|
|
146
|
-
- 多仓库注册时,Local Bridge 首页应能显示所有仓库,并正确标记当前选择。
|
|
147
|
-
- MCP Gateway 启动和 ChatGPT Connector 配置应逐步不再要求用户位于某个仓库目录。
|
|
148
|
-
- repo-local `.forge/mcp.*` 文件只作为 legacy fallback;后续可在迁移窗口结束后进一步降级提示或清理。
|