@moretea-labs/forge 1.5.0-rc.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 +120 -0
- package/CHANGELOG.md +36 -0
- package/CLAUDE.md +120 -0
- package/CODE_OF_CONDUCT.md +23 -0
- package/CONTRIBUTING.md +77 -0
- package/LICENSE +22 -0
- package/NOTICE +9 -0
- package/README.en.md +5 -0
- package/README.es.md +12 -0
- package/README.fr.md +12 -0
- package/README.ja.md +12 -0
- package/README.md +132 -0
- package/README.zh-CN.md +84 -0
- package/SECURITY.md +50 -0
- package/SKILL.md +431 -0
- package/SUPPORT.md +31 -0
- package/THIRD_PARTY_NOTICES.md +18 -0
- package/agents/openai.yaml +4 -0
- package/assets/AGENTS.md +68 -0
- package/assets/CLAUDE.md +68 -0
- package/assets/branding/README.md +10 -0
- package/assets/branding/forge-controller-flow.mmd +8 -0
- package/assets/hooks/AGENTS.md +75 -0
- package/assets/hooks/CLAUDE.md +75 -0
- package/assets/hooks/anti-simplification.sh +12 -0
- package/assets/hooks/changelog-guard.sh +80 -0
- package/assets/hooks/codex.hooks.template.json +60 -0
- package/assets/hooks/first-principles-guard.sh +72 -0
- package/assets/hooks/hook-input.sh +618 -0
- package/assets/hooks/lib/session-state.sh +106 -0
- package/assets/hooks/lib/workflow-state.sh +1730 -0
- package/assets/hooks/post-bash.sh +215 -0
- package/assets/hooks/post-edit-guard.sh +256 -0
- package/assets/hooks/post-tool-observer.sh +99 -0
- package/assets/hooks/pre-edit-guard.sh +240 -0
- package/assets/hooks/prompt-guard.sh +1077 -0
- package/assets/hooks/run-hook.sh +67 -0
- package/assets/hooks/security-sentinel.sh +115 -0
- package/assets/hooks/session-start-context.sh +593 -0
- package/assets/hooks/settings.template.json +60 -0
- package/assets/hooks/stop-orchestrator.sh +171 -0
- package/assets/hooks/subagent-return-channel-guard.sh +107 -0
- package/assets/hooks/worktree-guard.sh +39 -0
- package/assets/initializer-question-pack.v1.json +132 -0
- package/assets/initializer-question-pack.v1.schema.json +46 -0
- package/assets/initializer-question-pack.v2.json +174 -0
- package/assets/initializer-question-pack.v3.json +206 -0
- package/assets/initializer-question-pack.v3.schema.json +92 -0
- package/assets/initializer-question-pack.v4.json +557 -0
- package/assets/initializer-question-pack.v4.schema.json +169 -0
- package/assets/partials/01-header.partial.md +10 -0
- package/assets/partials/02-iron-rules.partial.md +30 -0
- package/assets/partials/03-philosophy.partial.md +32 -0
- package/assets/partials/04-project-structure.partial.md +56 -0
- package/assets/partials/05-workflow.partial.md +79 -0
- package/assets/partials/06-cloudflare.partial.md +20 -0
- package/assets/partials/07-footer.partial.md +38 -0
- package/assets/partials/08-orchestration.partial.md +49 -0
- package/assets/partials/09-compact-instructions.partial.md +11 -0
- package/assets/partials/_assembly-order.md +40 -0
- package/assets/partials-agents/01-header.partial.md +8 -0
- package/assets/partials-agents/02-operating-mode.partial.md +44 -0
- package/assets/partials-agents/03-orchestration.partial.md +45 -0
- package/assets/partials-agents/04-task-protocol.partial.md +69 -0
- package/assets/partials-agents/05-coding-constraints.partial.md +20 -0
- package/assets/partials-agents/06-quality-safety.partial.md +23 -0
- package/assets/partials-agents/07-cloudflare.partial.md +9 -0
- package/assets/partials-agents/08-deep-docs.partial.md +32 -0
- package/assets/plan-map.json +301 -0
- package/assets/plugin-registry.v1.json +8 -0
- package/assets/project-structures/ai-native-collaborative-editor.txt +25 -0
- package/assets/project-structures/ai-native-product-copilot.txt +21 -0
- package/assets/project-structures/ai-native-runtime-console.txt +25 -0
- package/assets/project-structures/ai-native-sidecar-kernel.txt +19 -0
- package/assets/project-structures/astro-ssr.txt +25 -0
- package/assets/project-structures/expo-nativewind.txt +52 -0
- package/assets/project-structures/monorepo.txt +63 -0
- package/assets/project-structures/remix.txt +50 -0
- package/assets/project-structures/tanstack-start-workers.txt +51 -0
- package/assets/project-structures/vite-tanstack.txt +58 -0
- package/assets/reference-configs/AGENTS.md +13 -0
- package/assets/reference-configs/CLAUDE.md +13 -0
- package/assets/reference-configs/agentic-development-flow.md +94 -0
- package/assets/reference-configs/ai-workflows.md +14 -0
- package/assets/reference-configs/changelog-versioning.md +13 -0
- package/assets/reference-configs/coding-standards.md +14 -0
- package/assets/reference-configs/development-protocol.md +21 -0
- package/assets/reference-configs/document-generation.md +38 -0
- package/assets/reference-configs/evaluator-rubric.md +19 -0
- package/assets/reference-configs/external-tooling.md +374 -0
- package/assets/reference-configs/git-strategy.md +14 -0
- package/assets/reference-configs/global-working-rules.md +64 -0
- package/assets/reference-configs/handoff-protocol.md +38 -0
- package/assets/reference-configs/harness-overview.md +124 -0
- package/assets/reference-configs/heartbeat-triage.md +57 -0
- package/assets/reference-configs/hook-operations.md +96 -0
- package/assets/reference-configs/release-deploy.md +40 -0
- package/assets/reference-configs/spa-day-protocol.md +14 -0
- package/assets/reference-configs/sprint-contracts.md +89 -0
- package/assets/reference-configs/workflow-orchestration.md +14 -0
- package/assets/skill-hooks.json +41 -0
- package/assets/skill-version.json +189 -0
- package/assets/skills/claude-review/SKILL.md +231 -0
- package/assets/skills/codex-review/SKILL.md +103 -0
- package/assets/templates/AGENTS.md +13 -0
- package/assets/templates/CLAUDE.md +13 -0
- package/assets/templates/architecture.template.md +80 -0
- package/assets/templates/brief.template.md +38 -0
- package/assets/templates/contract.template.md +104 -0
- package/assets/templates/decisions.template.md +85 -0
- package/assets/templates/factor-factory/factor-backtest-report.template.md +36 -0
- package/assets/templates/factor-factory/factor-hypothesis.template.md +30 -0
- package/assets/templates/factor-factory/factor-registry.template.json +5 -0
- package/assets/templates/gitignore.template +53 -0
- package/assets/templates/guides/metro-esm-gotchas.template.md +46 -0
- package/assets/templates/helpers/architecture-event.ts +822 -0
- package/assets/templates/helpers/architecture-queue.sh +647 -0
- package/assets/templates/helpers/archive-architecture-request.sh +244 -0
- package/assets/templates/helpers/archive-workflow.sh +295 -0
- package/assets/templates/helpers/capability-config.ts +394 -0
- package/assets/templates/helpers/capability-resolver.ts +505 -0
- package/assets/templates/helpers/capture-plan.sh +335 -0
- package/assets/templates/helpers/check-agent-tooling.sh +1533 -0
- package/assets/templates/helpers/check-architecture-sync.sh +287 -0
- package/assets/templates/helpers/check-brain-manifest.sh +255 -0
- package/assets/templates/helpers/check-context-files.sh +49 -0
- package/assets/templates/helpers/check-deploy-sql-order.sh +117 -0
- package/assets/templates/helpers/check-skill-version.ts +193 -0
- package/assets/templates/helpers/check-task-sync.sh +65 -0
- package/assets/templates/helpers/check-task-workflow.sh +1002 -0
- package/assets/templates/helpers/codex-handoff-resume.sh +269 -0
- package/assets/templates/helpers/context-contract-sync.sh +516 -0
- package/assets/templates/helpers/contract-run.ts +465 -0
- package/assets/templates/helpers/contract-worktree.sh +725 -0
- package/assets/templates/helpers/ensure-task-workflow.sh +1218 -0
- package/assets/templates/helpers/harness-trace-grade.sh +150 -0
- package/assets/templates/helpers/heartbeat-triage.sh +361 -0
- package/assets/templates/helpers/inspect-project-state.ts +280 -0
- package/assets/templates/helpers/maintenance-triage.sh +167 -0
- package/assets/templates/helpers/migrate-project-template.sh +54 -0
- package/assets/templates/helpers/migrate-workflow-docs.ts +413 -0
- package/assets/templates/helpers/new-plan.sh +183 -0
- package/assets/templates/helpers/new-spec.sh +50 -0
- package/assets/templates/helpers/new-sprint.sh +49 -0
- package/assets/templates/helpers/plan-to-todo.sh +799 -0
- package/assets/templates/helpers/prepare-codex-handoff.sh +203 -0
- package/assets/templates/helpers/prepare-handoff.sh +81 -0
- package/assets/templates/helpers/refresh-current-status.sh +469 -0
- package/assets/templates/helpers/select-agent-context-blocks.sh +66 -0
- package/assets/templates/helpers/ship-worktrees.sh +561 -0
- package/assets/templates/helpers/sprint-backlog.sh +837 -0
- package/assets/templates/helpers/summarize-failures.sh +125 -0
- package/assets/templates/helpers/switch-plan.sh +153 -0
- package/assets/templates/helpers/sync-brain-docs.sh +381 -0
- package/assets/templates/helpers/verify-contract.sh +705 -0
- package/assets/templates/helpers/verify-sprint.sh +680 -0
- package/assets/templates/helpers/workflow-contract.ts +202 -0
- package/assets/templates/helpers/workstream-sync.sh +263 -0
- package/assets/templates/implementation-notes.template.md +37 -0
- package/assets/templates/packages.template.md +45 -0
- package/assets/templates/plan.template.md +77 -0
- package/assets/templates/prd.template.md +165 -0
- package/assets/templates/research.template.md +25 -0
- package/assets/templates/review.template.md +78 -0
- package/assets/templates/spec.template.md +31 -0
- package/assets/templates/sprint.template.md +69 -0
- package/assets/templates/tech-stack.template.md +57 -0
- package/assets/versions.json +77 -0
- package/assets/workflow-contract.v1.json +671 -0
- package/bin/forge-desktop-helper.mjs +204 -0
- package/bin/forge-hook.mjs +32 -0
- package/bin/forge-runtime-service.mjs +34 -0
- package/bin/forge-runtime.mjs +30 -0
- package/bin/forge.mjs +32 -0
- package/docs/CHANGELOG.md +978 -0
- package/docs/README.md +72 -0
- package/docs/README.zh-CN.md +58 -0
- package/docs/architecture/chatgpt-handoff-facade.md +393 -0
- package/docs/architecture/current/README.md +158 -0
- package/docs/architecture/current/approved-target-architecture.zh-CN.md +1501 -0
- package/docs/architecture/current/architecture-invariants.md +331 -0
- package/docs/architecture/current/automation-and-schedule-engine.md +453 -0
- package/docs/architecture/current/codegraph-context-provider.md +226 -0
- package/docs/architecture/current/control-plane-authority-inventory.md +82 -0
- package/docs/architecture/current/controller-repository-decoupling.md +148 -0
- package/docs/architecture/current/dispatch-and-agent-strategy.md +354 -0
- package/docs/architecture/current/entity-model.md +619 -0
- package/docs/architecture/current/external-plugin-governance.md +396 -0
- package/docs/architecture/current/failure-recovery.md +471 -0
- package/docs/architecture/current/governance.md +213 -0
- package/docs/architecture/current/human-interaction-plane.md +87 -0
- package/docs/architecture/current/implementation-status.md +128 -0
- package/docs/architecture/current/job-and-run-lifecycle.md +413 -0
- package/docs/architecture/current/local-workspace-target-grants.md +70 -0
- package/docs/architecture/current/migration-roadmap.md +105 -0
- package/docs/architecture/current/multi-repository-execution.md +371 -0
- package/docs/architecture/current/operations-runbook.md +45 -0
- package/docs/architecture/current/peer-supercontroller-runtime.md +32 -0
- package/docs/architecture/current/personal-assistant-plugin-baseline.md +207 -0
- package/docs/architecture/current/repository-access-modes.md +102 -0
- package/docs/architecture/current/route-policy.md +15 -0
- package/docs/architecture/current/route-session-concurrency.md +85 -0
- package/docs/architecture/current/runtime-architecture-simplification.md +214 -0
- package/docs/architecture/current/runtime-directory-map.md +49 -0
- package/docs/architecture/current/runtime-health-and-resource-lifecycle.md +85 -0
- package/docs/architecture/current/scheduler-and-resource-claims.md +432 -0
- package/docs/architecture/current/session-aware-execution-and-authorization.md +77 -0
- package/docs/architecture/current/system-overview.md +144 -0
- package/docs/architecture/current/target-requirements-traceability.md +202 -0
- package/docs/architecture/current/thin-harness-governance-policy.md +32 -0
- package/docs/architecture/current/thin-harness-v1.md +313 -0
- package/docs/architecture/current/verification-and-release-gates.md +391 -0
- package/docs/architecture/decisions/20260801-controller-home-sqlite-state.md +100 -0
- package/docs/architecture/decisions/20260803-canonical-skill-surface.md +40 -0
- package/docs/architecture/decisions/20260803-release-identity-binding-and-exit-policy.md +53 -0
- package/docs/architecture/diagrams/.gitkeep +1 -0
- package/docs/architecture/diagrams/agentic-dev-plugin-architecture.html +186 -0
- package/docs/architecture/domains/.gitkeep +0 -0
- package/docs/architecture/domains/public-surface.md +30 -0
- package/docs/architecture/domains/runtime-harness.md +33 -0
- package/docs/architecture/domains/verification.md +33 -0
- package/docs/architecture/domains/workflow-engine.md +30 -0
- package/docs/architecture/global-hook-runtime.md +162 -0
- package/docs/architecture/history.md +38 -0
- package/docs/architecture/index.md +114 -0
- package/docs/architecture/ios-semantic-automation-provider-v2.md +166 -0
- package/docs/architecture/modules/.gitkeep +0 -0
- package/docs/architecture/modules/controller-runtime/transport-lifecycle.md +24 -0
- package/docs/architecture/requests/.gitkeep +1 -0
- package/docs/architecture/requests/archive/2026/20260528-154740-ai-hooks-ai-hooks-hook-input-sh.md +59 -0
- package/docs/architecture/requests/archive/2026/20260528-154816-assets-hooks-assets-hooks-hook-input-sh.md +59 -0
- package/docs/architecture/requests/archive/2026/20260528-161851-ai-harness-workflow-contract-json-ai-harness-workflow-contract-json.md +59 -0
- package/docs/architecture/requests/archive/2026/20260528-161853-scripts-check-task-workflow-sh-scripts-check-task-workflow-sh.md +59 -0
- package/docs/architecture/requests/archive/2026/20260528-161911-assets-workflow-contract-v1-json-assets-workflow-contract-v1-json.md +59 -0
- package/docs/architecture/requests/archive/2026/20260528-222416-ai-hooks-ai-hooks-hook-input-sh.md +59 -0
- package/docs/architecture/requests/archive/2026/20260528-222444-ai-hooks-ai-hooks-pre-edit-guard-sh.md +59 -0
- package/docs/architecture/requests/archive/2026/20260528-222457-ai-hooks-ai-hooks-pre-edit-guard-sh.md +59 -0
- package/docs/architecture/requests/archive/2026/20260528-222648-ai-hooks-ai-hooks-pre-edit-guard-sh.md +59 -0
- package/docs/architecture/requests/archive/2026/20260528-222705-ai-hooks-ai-hooks-worktree-guard-sh.md +59 -0
- package/docs/architecture/requests/archive/2026/20260528-222726-ai-hooks-ai-hooks-prompt-guard-sh.md +59 -0
- package/docs/architecture/requests/archive/2026/20260528-222727-ai-hooks-ai-hooks-prompt-guard-sh.md +59 -0
- package/docs/architecture/requests/archive/2026/20260528-224736-ai-hooks-ai-hooks-hook-input-sh.md +59 -0
- package/docs/architecture/requests/archive/2026/20260528-233259-ai-hooks-ai-hooks-prompt-guard-sh.md +59 -0
- package/docs/architecture/requests/archive/2026/20260528-233335-assets-hooks-assets-hooks-prompt-guard-sh.md +59 -0
- package/docs/architecture/requests/archive/2026/20260528-233456-ai-hooks-ai-hooks-prompt-guard-sh.md +59 -0
- package/docs/architecture/requests/archive/2026/20260528-233457-assets-hooks-assets-hooks-prompt-guard-sh.md +59 -0
- package/docs/architecture/requests/archive/2026/20260528-233637-ai-hooks-ai-hooks-prompt-guard-sh.md +59 -0
- package/docs/architecture/requests/archive/2026/20260528-233638-assets-hooks-assets-hooks-prompt-guard-sh.md +59 -0
- package/docs/architecture/requests/archive/2026/20260529-000322-root-package-json.md +59 -0
- package/docs/architecture/requests/archive/2026/20260529-004238-ai-hooks-ai-hooks-lib-workflow-state-sh.md +59 -0
- package/docs/architecture/requests/archive/2026/20260529-020654-ai-harness-policy-json-ai-harness-policy-json.md +63 -0
- package/docs/architecture/requests/archive/2026/20260529-094236-ai-hooks-ai-hooks-prompt-guard-sh.md +60 -0
- package/docs/architecture/requests/archive/2026/20260529-094323-assets-hooks-assets-hooks-prompt-guard-sh.md +60 -0
- package/docs/architecture/requests/archive/2026/20260529-094331-ai-hooks-ai-hooks-prompt-guard-sh.md +60 -0
- package/docs/architecture/requests/archive/2026/20260529-094339-assets-hooks-assets-hooks-prompt-guard-sh.md +60 -0
- package/docs/architecture/requests/archive/2026/20260529-094430-assets-hooks-assets-hooks-session-start-context-sh.md +60 -0
- package/docs/architecture/requests/archive/2026/20260529-094446-ai-hooks-ai-hooks-session-start-context-sh.md +60 -0
- package/docs/architecture/requests/archive/2026/20260613-002040-runtime-harness-hook-adapters.md +68 -0
- package/docs/architecture/requests/archive/2026/root.md +68 -0
- package/docs/architecture/requests/archive/2026/runtime-harness-hook-adapters.md +76 -0
- package/docs/architecture/requests/archive/2026/verification-evals-checks.md +68 -0
- package/docs/architecture/requests/archive/2026/workflow-engine-contract-assets.md +69 -0
- package/docs/architecture/reviews/2026-07-11-access-surface-review.md +99 -0
- package/docs/architecture/snapshots/.gitkeep +1 -0
- package/docs/forge-autonomous-goal-loop.md +7 -0
- package/docs/forge-chatgpt-browser-engine.md +11 -0
- package/docs/forge-chatgpt-mcp-setup.md +239 -0
- package/docs/forge-chatgpt-supervised-automation.md +11 -0
- package/docs/forge-github-issue-launcher.md +7 -0
- package/docs/forge-plugin-management.md +95 -0
- package/docs/forge-provider-configuration.md +7 -0
- package/docs/forge-runtime-self-healing-loop.md +7 -0
- package/docs/images/forge-banner-cn.svg +1 -0
- package/docs/images/forge-banner.svg +1 -0
- package/docs/images/forge-controller-flow.svg +1 -0
- package/docs/images/image.png +0 -0
- package/docs/images/repo-harness-gptpro-cn.png +0 -0
- package/docs/images/repo-harness-gptpro.png +0 -0
- package/docs/images/repo-harness-hook-carrot.png +0 -0
- package/docs/operations/chatgpt-personal-assistant-runtime.md +83 -0
- package/docs/operations/checkout-route-integrity.md +22 -0
- package/docs/operations/controller-browser-plugin.md +299 -0
- package/docs/operations/controller-desktop-plugin.md +112 -0
- package/docs/operations/controller-performance-and-502.md +126 -0
- package/docs/operations/controller-reliability-runbook.md +134 -0
- package/docs/operations/environment-hardening.md +50 -0
- package/docs/operations/features.md +45 -0
- package/docs/operations/features.zh-CN.md +45 -0
- package/docs/operations/github-repository.md +60 -0
- package/docs/operations/gmail-assistant-routines.md +186 -0
- package/docs/operations/homebrew.md +26 -0
- package/docs/operations/local-system-assistant.md +46 -0
- package/docs/operations/local-system-assistant.zh-CN.md +46 -0
- package/docs/operations/mcp-tool-exposure.md +58 -0
- package/docs/operations/mobile-intents-shortcuts.md +117 -0
- package/docs/operations/open-source-release-hygiene.md +31 -0
- package/docs/operations/personal-assistant-operator-guide.md +61 -0
- package/docs/operations/platform-support.md +62 -0
- package/docs/operations/platform-support.zh-CN.md +61 -0
- package/docs/operations/provider-configuration.md +31 -0
- package/docs/operations/releasing.md +86 -0
- package/docs/operations/releasing.zh-CN.md +86 -0
- package/docs/operations/route-session-concurrency-baseline.json +893 -0
- package/docs/operations/route-session-concurrency-baseline.md +94 -0
- package/docs/operations/runtime-performance-diagnostics.md +14 -0
- package/docs/operations/sqlite-control-plane-recovery.md +65 -0
- package/docs/operations/standalone-disaster-recovery.md +136 -0
- package/docs/operations/troubleshooting.md +72 -0
- package/docs/operations/troubleshooting.zh-CN.md +70 -0
- package/docs/public-usage-guide.md +33 -0
- package/docs/public-usage-guide.zh-CN.md +33 -0
- package/docs/tutorials/01-install-and-start.md +93 -0
- package/docs/tutorials/01-install-and-start.zh-CN.md +93 -0
- package/docs/tutorials/02-connect-chatgpt.md +82 -0
- package/docs/tutorials/02-connect-chatgpt.zh-CN.md +80 -0
- package/docs/tutorials/03-first-repository-task.md +57 -0
- package/docs/tutorials/03-first-repository-task.zh-CN.md +57 -0
- package/docs/tutorials/README.md +13 -0
- package/docs/tutorials/README.zh-CN.md +13 -0
- package/docs/wiki/Architecture.md +85 -0
- package/docs/wiki/Core-Concepts.md +27 -0
- package/docs/wiki/Home.md +36 -0
- package/docs/wiki/Implementation.md +172 -0
- package/docs/wiki/Installation.md +50 -0
- package/docs/wiki/Integrations.md +29 -0
- package/docs/wiki/Operations.md +26 -0
- package/docs/wiki/Quick-Start.md +46 -0
- package/docs/wiki/Releases-and-Upgrades.md +34 -0
- package/docs/wiki/Runtime-Architecture.md +50 -0
- package/docs/wiki/Security-Model.md +31 -0
- package/docs/wiki/Troubleshooting.md +38 -0
- package/docs/wiki/Work-Lifecycle.md +31 -0
- package/docs/wiki/_Sidebar.md +21 -0
- package/install.ps1 +48 -0
- package/install.sh +66 -0
- package/package.json +156 -0
- package/scripts/activate-source-baseline.ts +335 -0
- package/scripts/architecture-event.ts +822 -0
- package/scripts/architecture-queue.sh +647 -0
- package/scripts/archive-architecture-request.sh +244 -0
- package/scripts/archive-workflow.sh +295 -0
- package/scripts/assemble-template.ts +1172 -0
- package/scripts/benchmark-controller-hotpath.ts +212 -0
- package/scripts/benchmark-controller-round2.ts +139 -0
- package/scripts/benchmark-ios-agent-device.ts +514 -0
- package/scripts/benchmark-route-session-concurrency.ts +714 -0
- package/scripts/benchmark-thin-harness-gateway-ab.ts +632 -0
- package/scripts/benchmark-thin-harness-mcp-e2e.ts +479 -0
- package/scripts/benchmark-thin-harness.ts +251 -0
- package/scripts/bootstrap-runtime-maintenance-recovery.sh +183 -0
- package/scripts/canary-global-hook.sh +263 -0
- package/scripts/capability-config.ts +394 -0
- package/scripts/capability-resolver.ts +505 -0
- package/scripts/capture-plan.sh +335 -0
- package/scripts/check-agent-tooling.sh +1549 -0
- package/scripts/check-architecture-sync.sh +373 -0
- package/scripts/check-brain-manifest.sh +255 -0
- package/scripts/check-ci.sh +16 -0
- package/scripts/check-context-files.sh +49 -0
- package/scripts/check-deploy-sql-order.sh +117 -0
- package/scripts/check-mcp-compatibility.ts +93 -0
- package/scripts/check-npm-release.sh +32 -0
- package/scripts/check-open-source-tracked-surface.sh +146 -0
- package/scripts/check-package-identity.mjs +117 -0
- package/scripts/check-platform-support.mjs +79 -0
- package/scripts/check-public-docs.sh +105 -0
- package/scripts/check-public-release-surface.sh +19 -0
- package/scripts/check-release-published.sh +57 -0
- package/scripts/check-release-readiness.sh +43 -0
- package/scripts/check-release-version.mjs +74 -0
- package/scripts/check-runtime-architecture.mjs +593 -0
- package/scripts/check-runtime-env.mjs +89 -0
- package/scripts/check-skill-version.ts +193 -0
- package/scripts/check-tarball-install-smoke.sh +66 -0
- package/scripts/check-task-sync.sh +65 -0
- package/scripts/check-task-workflow.sh +1002 -0
- package/scripts/check-third-party-notices.mjs +36 -0
- package/scripts/codex-handoff-resume.sh +269 -0
- package/scripts/complete-control-plane-cutover.ts +126 -0
- package/scripts/context-contract-sync.sh +516 -0
- package/scripts/contract-run.ts +465 -0
- package/scripts/contract-worktree.sh +725 -0
- package/scripts/controller-ngrok-rotation.sh +678 -0
- package/scripts/create-project-dirs.sh +282 -0
- package/scripts/ensure-codegraph.sh +16 -0
- package/scripts/ensure-task-workflow.sh +1218 -0
- package/scripts/export-requirement-portfolio.ts +28 -0
- package/scripts/factor-lab-check.sh +73 -0
- package/scripts/factor-lab-new.sh +96 -0
- package/scripts/factor-lab-promote.sh +86 -0
- package/scripts/factor-lab-reject.sh +68 -0
- package/scripts/harness-trace-grade.sh +150 -0
- package/scripts/heartbeat-triage.sh +361 -0
- package/scripts/hook-dispatch-diet-report.ts +234 -0
- package/scripts/hook-shim.sh +93 -0
- package/scripts/init-project.sh +505 -0
- package/scripts/initializer-question-pack.ts +200 -0
- package/scripts/inspect-project-state.ts +280 -0
- package/scripts/install-desktop-operator-registration.ts +45 -0
- package/scripts/install-standalone-recovery.ts +74 -0
- package/scripts/lib/AGENTS.md +13 -0
- package/scripts/lib/CLAUDE.md +13 -0
- package/scripts/lib/controller-home-env.sh +69 -0
- package/scripts/lib/project-init-lib.sh +2759 -0
- package/scripts/load-standalone-recovery.sh +17 -0
- package/scripts/loop-engine-cutover-gate.ts +324 -0
- package/scripts/maintenance-triage.sh +167 -0
- package/scripts/migrate-project-template.sh +1189 -0
- package/scripts/migrate-requirement-portfolio.ts +86 -0
- package/scripts/migrate-workflow-docs.ts +413 -0
- package/scripts/new-plan.sh +183 -0
- package/scripts/new-spec.sh +50 -0
- package/scripts/new-sprint.sh +49 -0
- package/scripts/open-source-audit-allowlist.txt +46 -0
- package/scripts/package-source-archive.sh +147 -0
- package/scripts/plan-to-todo.sh +799 -0
- package/scripts/prepare-codex-handoff.sh +203 -0
- package/scripts/prepare-handoff.sh +81 -0
- package/scripts/public-release-files.txt +39 -0
- package/scripts/public-release.ts +174 -0
- package/scripts/publish-release-tarball.sh +27 -0
- package/scripts/refresh-current-status.sh +469 -0
- package/scripts/refresh-ios-physical-runtime.ts +196 -0
- package/scripts/repair-executable-modes.ts +8 -0
- package/scripts/rollout-all-registered-repos.sh +7 -0
- package/scripts/route-nl-vs-ts-eval.ts +679 -0
- package/scripts/run-bun-test-file.ts +182 -0
- package/scripts/run-governed-gate.ts +140 -0
- package/scripts/run-mobile-monitor-bridge.ts +71 -0
- package/scripts/run-skill-evals.ts +1022 -0
- package/scripts/run-skill-hook.ts +244 -0
- package/scripts/run-supervised-command.ts +24 -0
- package/scripts/run-tests-portable.sh +20 -0
- package/scripts/select-agent-context-blocks.sh +66 -0
- package/scripts/setup-plugins.sh +43 -0
- package/scripts/ship-worktrees.sh +561 -0
- package/scripts/smoke-browser-cdp-bridge.ts +93 -0
- package/scripts/smoke-chatgpt-supervised-automation.ts +208 -0
- package/scripts/smoke-ios-physical-device.ts +114 -0
- package/scripts/smoke-mcp-http-runtime.ts +216 -0
- package/scripts/smoke-mcp-tool-surface.ts +117 -0
- package/scripts/smoke-runtime-recovery.ts +220 -0
- package/scripts/smoke-schedule-engine.ts +283 -0
- package/scripts/sprint-backlog.sh +837 -0
- package/scripts/stage-runtime-release.ts +38 -0
- package/scripts/summarize-failures.sh +125 -0
- package/scripts/switch-plan.sh +153 -0
- package/scripts/sync-brain-docs.sh +381 -0
- package/scripts/sync-codex-installed-copies.sh +183 -0
- package/scripts/test-governance.ts +75 -0
- package/scripts/verify-contract.sh +705 -0
- package/scripts/verify-forge-runtime.sh +31 -0
- package/scripts/verify-sprint.sh +680 -0
- package/scripts/windows-paths.d.mts +7 -0
- package/scripts/windows-paths.mjs +28 -0
- package/scripts/workflow-contract.ts +206 -0
- package/scripts/workstream-sync.sh +263 -0
- package/src/cli/agent-jobs/executable-resolver.ts +289 -0
- package/src/cli/agent-jobs/executor-health.ts +252 -0
- package/src/cli/agent-jobs/integration.ts +963 -0
- package/src/cli/agent-jobs/job-manager.ts +2030 -0
- package/src/cli/agent-jobs/types.ts +219 -0
- package/src/cli/agent-jobs/worker-lifecycle.ts +288 -0
- package/src/cli/chatgpt-browser/bind-server.ts +504 -0
- package/src/cli/chatgpt-browser/binding.ts +140 -0
- package/src/cli/chatgpt-browser/bridge-extension.ts +221 -0
- package/src/cli/chatgpt-browser/bridge-provider.ts +268 -0
- package/src/cli/chatgpt-browser/engine.ts +569 -0
- package/src/cli/chatgpt-browser/file-policy.ts +158 -0
- package/src/cli/chatgpt-browser/native-provider.ts +553 -0
- package/src/cli/chatgpt-browser/oracle-provider.ts +437 -0
- package/src/cli/chatgpt-browser/prompt-assembler.ts +29 -0
- package/src/cli/chatgpt-browser/session-store.ts +301 -0
- package/src/cli/chatgpt-browser/types.ts +172 -0
- package/src/cli/commands/adopt-plan.ts +186 -0
- package/src/cli/commands/brain-root.ts +132 -0
- package/src/cli/commands/brain.ts +609 -0
- package/src/cli/commands/capability-context.ts +613 -0
- package/src/cli/commands/chatgpt.ts +424 -0
- package/src/cli/commands/controller.ts +680 -0
- package/src/cli/commands/docs.ts +103 -0
- package/src/cli/commands/doctor.ts +476 -0
- package/src/cli/commands/global-runtime.ts +323 -0
- package/src/cli/commands/hook.ts +34 -0
- package/src/cli/commands/init-hook.ts +870 -0
- package/src/cli/commands/init.ts +829 -0
- package/src/cli/commands/install.ts +86 -0
- package/src/cli/commands/mcp.ts +315 -0
- package/src/cli/commands/migrate.ts +154 -0
- package/src/cli/commands/plugin.ts +74 -0
- package/src/cli/commands/prompt-guard-decision.ts +238 -0
- package/src/cli/commands/recovery.ts +667 -0
- package/src/cli/commands/repository.ts +224 -0
- package/src/cli/commands/run.ts +23 -0
- package/src/cli/commands/runtime.ts +191 -0
- package/src/cli/commands/security.ts +440 -0
- package/src/cli/commands/status.ts +137 -0
- package/src/cli/commands/tools.ts +167 -0
- package/src/cli/controller/check-runner.ts +1022 -0
- package/src/cli/controller/codex-continuation.ts +153 -0
- package/src/cli/controller/completion-backlog.ts +380 -0
- package/src/cli/controller/completion-orchestrator.ts +1807 -0
- package/src/cli/controller/completion-target.ts +96 -0
- package/src/cli/controller/composite-operations.ts +196 -0
- package/src/cli/controller/composite-result.ts +130 -0
- package/src/cli/controller/context-pack.ts +652 -0
- package/src/cli/controller/execution-completion.ts +175 -0
- package/src/cli/controller/execution-policy.ts +392 -0
- package/src/cli/controller/governance.ts +594 -0
- package/src/cli/controller/issue-store.ts +1421 -0
- package/src/cli/controller/launch-agents.ts +410 -0
- package/src/cli/controller/legacy-issue-cutover.ts +415 -0
- package/src/cli/controller/lifecycle-authority.ts +16 -0
- package/src/cli/controller/migrated-issue-decision.ts +237 -0
- package/src/cli/controller/operational-plan.ts +226 -0
- package/src/cli/controller/postcondition.ts +134 -0
- package/src/cli/controller/progress.ts +656 -0
- package/src/cli/controller/project-state.ts +147 -0
- package/src/cli/controller/requirement-portfolio-export.ts +146 -0
- package/src/cli/controller/requirement-portfolio-migration.ts +613 -0
- package/src/cli/controller/run-evidence.ts +43 -0
- package/src/cli/controller/runtime-config.ts +92 -0
- package/src/cli/controller/stuck-state-migration.ts +396 -0
- package/src/cli/controller/task-ledger.ts +632 -0
- package/src/cli/controller/task-status-resolver.ts +403 -0
- package/src/cli/controller/types.ts +273 -0
- package/src/cli/controller/work-mode.ts +186 -0
- package/src/cli/controller/worklog.ts +201 -0
- package/src/cli/diagnostic-entry.ts +39 -0
- package/src/cli/editing/edit-session.ts +1606 -0
- package/src/cli/editing/executable-modes.ts +70 -0
- package/src/cli/github/github.ts +274 -0
- package/src/cli/github/plugin.ts +345 -0
- package/src/cli/github/session.ts +104 -0
- package/src/cli/hook/prompt-guard-decision.ts +238 -0
- package/src/cli/hook/prompt-intents.ts +534 -0
- package/src/cli/hook/route-registry.ts +107 -0
- package/src/cli/hook/runtime.ts +303 -0
- package/src/cli/hook/state-snapshot.ts +388 -0
- package/src/cli/hook-entry.ts +51 -0
- package/src/cli/index.ts +574 -0
- package/src/cli/installer/managed-entries.ts +78 -0
- package/src/cli/installer/shared.ts +65 -0
- package/src/cli/installer/targets/claude.ts +136 -0
- package/src/cli/installer/targets/codex.ts +174 -0
- package/src/cli/installer/targets/registry.ts +28 -0
- package/src/cli/installer/types.ts +72 -0
- package/src/cli/local-bridge/connector-freshness.ts +529 -0
- package/src/cli/local-bridge/console-view-models.ts +324 -0
- package/src/cli/local-bridge/dashboard.ts +1312 -0
- package/src/cli/local-bridge/facade-api.ts +1877 -0
- package/src/cli/local-bridge/job-store.ts +1451 -0
- package/src/cli/local-bridge/mobile-intents.ts +344 -0
- package/src/cli/local-bridge/mobile-monitor.ts +209 -0
- package/src/cli/local-bridge/server.ts +3183 -0
- package/src/cli/local-bridge/types.ts +176 -0
- package/src/cli/mcp/access-mode.ts +132 -0
- package/src/cli/mcp/access-tools.ts +387 -0
- package/src/cli/mcp/audit.ts +32 -0
- package/src/cli/mcp/auth.ts +402 -0
- package/src/cli/mcp/instructions.ts +33 -0
- package/src/cli/mcp/legacy-context.ts +16 -0
- package/src/cli/mcp/legacy-tool-service.ts +5516 -0
- package/src/cli/mcp/multi-repository.ts +423 -0
- package/src/cli/mcp/oauth.ts +226 -0
- package/src/cli/mcp/paths.ts +134 -0
- package/src/cli/mcp/policy.ts +230 -0
- package/src/cli/mcp/proxy-env.ts +62 -0
- package/src/cli/mcp/readiness-projection.ts +24 -0
- package/src/cli/mcp/redaction.ts +21 -0
- package/src/cli/mcp/repo.ts +24 -0
- package/src/cli/mcp/repository-tools.ts +1295 -0
- package/src/cli/mcp/server.ts +341 -0
- package/src/cli/mcp/setup.ts +793 -0
- package/src/cli/mcp/tool-capability-cache.ts +87 -0
- package/src/cli/mcp/tools.ts +9 -0
- package/src/cli/mcp/toolset-names.ts +70 -0
- package/src/cli/mcp/toolset-selection.ts +41 -0
- package/src/cli/mcp/toolset.ts +300 -0
- package/src/cli/mcp/transports/AGENTS.md +39 -0
- package/src/cli/mcp/transports/CLAUDE.md +39 -0
- package/src/cli/mcp/transports/http.ts +1234 -0
- package/src/cli/mcp/transports/session-registry.ts +428 -0
- package/src/cli/mcp/transports/stdio.ts +8 -0
- package/src/cli/mcp/types.ts +41 -0
- package/src/cli/mcp/umbrella-tools.ts +117 -0
- package/src/cli/repo-adoption/reclaim-runtime.ts +681 -0
- package/src/cli/repositories/branch-name-policy.ts +57 -0
- package/src/cli/repositories/command-classifier.ts +600 -0
- package/src/cli/repositories/command-executor.ts +1066 -0
- package/src/cli/repositories/command-normalization.ts +53 -0
- package/src/cli/repositories/command-scope.ts +264 -0
- package/src/cli/repositories/controller-home.ts +88 -0
- package/src/cli/repositories/entity-migration.ts +199 -0
- package/src/cli/repositories/ephemeral-workspace.ts +62 -0
- package/src/cli/repositories/git-command-executor.ts +301 -0
- package/src/cli/repositories/goal-registry.ts +239 -0
- package/src/cli/repositories/identity.ts +64 -0
- package/src/cli/repositories/local-project-onboarding.ts +539 -0
- package/src/cli/repositories/locks.ts +262 -0
- package/src/cli/repositories/registry.ts +1057 -0
- package/src/cli/repositories/runtime-storage.ts +411 -0
- package/src/cli/repositories/safe-patch.ts +421 -0
- package/src/cli/repositories/selected-path-actions.ts +341 -0
- package/src/cli/repositories/structured-git.ts +257 -0
- package/src/cli/repositories/types.ts +155 -0
- package/src/cli/repositories/umbrella.ts +134 -0
- package/src/cli/repositories/workbench.ts +140 -0
- package/src/cli/repositories/worktree-storage.ts +137 -0
- package/src/cli/repository/inspector.ts +637 -0
- package/src/cli/repository/session-cache.ts +453 -0
- package/src/cli/runtime/helper-runner.ts +172 -0
- package/src/cli/runtime-invocation.ts +318 -0
- package/src/cli/tools/codegraph.ts +676 -0
- package/src/cli/v81-entry.ts +29 -0
- package/src/core/adoption/gitignore-plan.ts +127 -0
- package/src/core/adoption/helper-wrapper-plan.ts +159 -0
- package/src/core/adoption/manifest-templates.ts +60 -0
- package/src/core/adoption/modes.ts +7 -0
- package/src/core/adoption/operations.ts +126 -0
- package/src/core/adoption/plan.ts +149 -0
- package/src/core/adoption/render.ts +70 -0
- package/src/core/adoption/rollback.ts +62 -0
- package/src/core/adoption/summary.ts +43 -0
- package/src/core/adoption/workflow-contract-asset.ts +14 -0
- package/src/core/adoption/workflow-contract-plan.ts +31 -0
- package/src/effects/fs-transaction.ts +540 -0
- package/src/effects/git-executable.ts +59 -0
- package/src/effects/managed-block.ts +86 -0
- package/src/effects/path-safety.ts +47 -0
- package/src/effects/process-runner.ts +192 -0
- package/src/runtime/assistant/action-proposals.ts +279 -0
- package/src/runtime/assistant/intent.ts +395 -0
- package/src/runtime/assistant/model-provider.ts +460 -0
- package/src/runtime/assistant/openapi.ts +223 -0
- package/src/runtime/assistant/policy.ts +89 -0
- package/src/runtime/assistant/readiness.ts +258 -0
- package/src/runtime/assistant/routine-runtime.ts +477 -0
- package/src/runtime/assistant/schedule-binding.ts +171 -0
- package/src/runtime/assistant/standing-grants.ts +375 -0
- package/src/runtime/assistant/store.ts +243 -0
- package/src/runtime/assistant/types.ts +135 -0
- package/src/runtime/context/codegraph-read-provider.ts +347 -0
- package/src/runtime/context/codegraph-sidecar.cjs +207 -0
- package/src/runtime/control-plane/dispatch-priority.ts +67 -0
- package/src/runtime/control-plane/execution/direct-edit-work-completion.ts +151 -0
- package/src/runtime/control-plane/execution/execution-identity.ts +456 -0
- package/src/runtime/control-plane/execution/session-store.ts +175 -0
- package/src/runtime/control-plane/execution/validation.ts +117 -0
- package/src/runtime/control-plane/execution/verification-evidence.ts +191 -0
- package/src/runtime/control-plane/execution/work-handle-store.ts +225 -0
- package/src/runtime/control-plane/execution/work-prepare-request-store.ts +159 -0
- package/src/runtime/control-plane/execution/work-task-receipt.ts +445 -0
- package/src/runtime/control-plane/execution/work-terminal-cleanup.ts +821 -0
- package/src/runtime/control-plane/facade/capability-registry.ts +279 -0
- package/src/runtime/control-plane/facade/check-normalization.ts +233 -0
- package/src/runtime/control-plane/facade/codex-delegation.ts +196 -0
- package/src/runtime/control-plane/facade/controller-session-store.ts +199 -0
- package/src/runtime/control-plane/facade/facade-result.ts +41 -0
- package/src/runtime/control-plane/facade/goal-workloop-access.ts +177 -0
- package/src/runtime/control-plane/facade/goal-workloop.ts +1216 -0
- package/src/runtime/control-plane/facade/handoff-inbox-store.ts +221 -0
- package/src/runtime/control-plane/facade/index.ts +16 -0
- package/src/runtime/control-plane/facade/operation-digest.ts +528 -0
- package/src/runtime/control-plane/facade/plan-contract-store.ts +403 -0
- package/src/runtime/control-plane/facade/policy-gate.ts +149 -0
- package/src/runtime/control-plane/facade/requirement-board.ts +280 -0
- package/src/runtime/control-plane/facade/self-healing-loop.ts +555 -0
- package/src/runtime/control-plane/facade/suggested-actions.ts +108 -0
- package/src/runtime/control-plane/facade/types.ts +729 -0
- package/src/runtime/control-plane/facade/work-admission-policy.ts +93 -0
- package/src/runtime/control-plane/facade/work-continuation.ts +104 -0
- package/src/runtime/control-plane/facade/work-contract-store.ts +1118 -0
- package/src/runtime/control-plane/facade/work-task-projection.ts +66 -0
- package/src/runtime/control-plane/global-scheduler/reconciliation.ts +365 -0
- package/src/runtime/control-plane/global-scheduler/scheduler.ts +920 -0
- package/src/runtime/control-plane/global-scheduler/wake-signal.ts +89 -0
- package/src/runtime/control-plane/goal-loop/config-facade.ts +700 -0
- package/src/runtime/control-plane/goal-loop/config-store.ts +570 -0
- package/src/runtime/control-plane/goal-loop/config-types.ts +213 -0
- package/src/runtime/control-plane/goal-loop/executor-router.ts +109 -0
- package/src/runtime/control-plane/goal-loop/failure-taxonomy.ts +149 -0
- package/src/runtime/control-plane/goal-loop/goal-contract-store.ts +304 -0
- package/src/runtime/control-plane/goal-loop/goal-loop-engine.ts +1001 -0
- package/src/runtime/control-plane/goal-loop/handoff-packet.ts +160 -0
- package/src/runtime/control-plane/goal-loop/index.ts +13 -0
- package/src/runtime/control-plane/goal-loop/local-tools.ts +290 -0
- package/src/runtime/control-plane/goal-loop/policy-gates.ts +203 -0
- package/src/runtime/control-plane/goal-loop/provider-dispatch.ts +93 -0
- package/src/runtime/control-plane/goal-loop/provider-registry.ts +545 -0
- package/src/runtime/control-plane/goal-loop/types.ts +378 -0
- package/src/runtime/control-plane/governance/access-policy.ts +147 -0
- package/src/runtime/control-plane/governance/authorization.ts +195 -0
- package/src/runtime/control-plane/governance/external-effects.ts +43 -0
- package/src/runtime/control-plane/launcher/thin-launcher.ts +97 -0
- package/src/runtime/control-plane/persistence/metadata-payload-policy.ts +53 -0
- package/src/runtime/control-plane/persistence/requirement-store.ts +241 -0
- package/src/runtime/control-plane/persistence/sqlite-store.ts +539 -0
- package/src/runtime/control-plane/release-retention.ts +447 -0
- package/src/runtime/control-plane/repo-actor/actor.ts +181 -0
- package/src/runtime/control-plane/repo-actor/registry.ts +20 -0
- package/src/runtime/control-plane/routing/index.ts +1 -0
- package/src/runtime/control-plane/routing/route-policy.ts +379 -0
- package/src/runtime/control-plane/runtime-cleanup.ts +727 -0
- package/src/runtime/control-plane/runtime-generation.ts +509 -0
- package/src/runtime/control-plane/runtime-pid-ownership.ts +11 -0
- package/src/runtime/control-plane/runtime-status-client.ts +90 -0
- package/src/runtime/control-plane/startup-recovery.ts +198 -0
- package/src/runtime/diagnostics/connectivity-observability.ts +475 -0
- package/src/runtime/diagnostics/mcp-timing.ts +64 -0
- package/src/runtime/diagnostics/performance.ts +379 -0
- package/src/runtime/diagnostics/process-facade.ts +350 -0
- package/src/runtime/diagnostics/read-only-tool.ts +226 -0
- package/src/runtime/evidence/artifact-store.ts +154 -0
- package/src/runtime/evidence/event-ledger.ts +80 -0
- package/src/runtime/evidence/evidence-store.ts +68 -0
- package/src/runtime/evidence/process-check-receipt.ts +43 -0
- package/src/runtime/evidence/result-store.ts +209 -0
- package/src/runtime/evidence/sensitive-output.ts +353 -0
- package/src/runtime/execution/jobs/child-reference.ts +124 -0
- package/src/runtime/execution/jobs/legacy-adapter.ts +22 -0
- package/src/runtime/execution/jobs/receipt-recovery.ts +119 -0
- package/src/runtime/execution/jobs/receipt-store.ts +243 -0
- package/src/runtime/execution/jobs/store.ts +737 -0
- package/src/runtime/execution/jobs/timeouts.ts +109 -0
- package/src/runtime/execution/jobs/types.ts +230 -0
- package/src/runtime/execution/jobs/wait.ts +45 -0
- package/src/runtime/execution/process-runtime/canary.ts +26 -0
- package/src/runtime/execution/process-runtime/check-facade.ts +272 -0
- package/src/runtime/execution/process-runtime/check-receipt.ts +185 -0
- package/src/runtime/execution/process-runtime/check-runner-sidecar.ts +60 -0
- package/src/runtime/execution/process-runtime/command-facade.ts +321 -0
- package/src/runtime/execution/process-runtime/gc.ts +171 -0
- package/src/runtime/execution/process-runtime/index.ts +9 -0
- package/src/runtime/execution/process-runtime/interactive-admission.ts +23 -0
- package/src/runtime/execution/process-runtime/process-runner-entry.ts +466 -0
- package/src/runtime/execution/process-runtime/resource-claims.ts +440 -0
- package/src/runtime/execution/process-runtime/runtime.ts +1816 -0
- package/src/runtime/execution/process-runtime/store.ts +687 -0
- package/src/runtime/execution/process-runtime/types.ts +352 -0
- package/src/runtime/execution/thin-harness/async-process.ts +181 -0
- package/src/runtime/execution/thin-harness/batch-executor.ts +671 -0
- package/src/runtime/execution/thin-harness/execution-router.ts +700 -0
- package/src/runtime/execution/thin-harness/fast-executor.ts +1263 -0
- package/src/runtime/execution/thin-harness/fast-receipt.ts +235 -0
- package/src/runtime/execution/thin-harness/fingerprint-worker.ts +191 -0
- package/src/runtime/execution/thin-harness/index.ts +13 -0
- package/src/runtime/execution/thin-harness/latency-trace.ts +107 -0
- package/src/runtime/execution/thin-harness/lightweight-lanes.ts +745 -0
- package/src/runtime/execution/thin-harness/mutation-gate.ts +578 -0
- package/src/runtime/execution/thin-harness/proposal-store.ts +409 -0
- package/src/runtime/execution/thin-harness/request-ledger.ts +595 -0
- package/src/runtime/execution/thin-harness/search-worker.ts +114 -0
- package/src/runtime/execution/thin-harness/types.ts +313 -0
- package/src/runtime/execution/thin-harness/workspace-savepoint.ts +333 -0
- package/src/runtime/execution/workers/executor.ts +687 -0
- package/src/runtime/execution/workers/ownership.ts +94 -0
- package/src/runtime/execution/workers/worker-entry.ts +277 -0
- package/src/runtime/gateway/mcp/execution-tools.ts +2009 -0
- package/src/runtime/gateway/mcp/persisted-check-process.ts +255 -0
- package/src/runtime/gateway/mcp/process-tools.ts +230 -0
- package/src/runtime/gateway/mcp/resource-policy.ts +195 -0
- package/src/runtime/gateway/mcp/router.ts +1088 -0
- package/src/runtime/gateway/mcp/runtime-tools.ts +5994 -0
- package/src/runtime/gateway/mcp/work-validation-reconciler.ts +219 -0
- package/src/runtime/health/evaluator.ts +474 -0
- package/src/runtime/health/index.ts +2 -0
- package/src/runtime/health/operational-view.ts +198 -0
- package/src/runtime/maintenance/cleanup.ts +419 -0
- package/src/runtime/model-clients/deepseek-adapter.ts +312 -0
- package/src/runtime/model-clients/index.ts +2 -0
- package/src/runtime/model-clients/types.ts +101 -0
- package/src/runtime/observability/gateway-contention-metrics.ts +129 -0
- package/src/runtime/observability/route-session-benchmark.ts +110 -0
- package/src/runtime/personal-assistant/gmail-triage-manager.ts +231 -0
- package/src/runtime/personal-assistant/reporting-runtime.ts +344 -0
- package/src/runtime/personal-assistant/triage-runtime.ts +748 -0
- package/src/runtime/plugins/app-store-connect-adapter.ts +868 -0
- package/src/runtime/plugins/browser-adapter.ts +2812 -0
- package/src/runtime/plugins/browser-automation-service.ts +46 -0
- package/src/runtime/plugins/browser-handoff-host.ts +304 -0
- package/src/runtime/plugins/browser-handoff.ts +371 -0
- package/src/runtime/plugins/browser-macos-bridge.ts +865 -0
- package/src/runtime/plugins/browser-node-bridge-host.ts +64 -0
- package/src/runtime/plugins/browser-node-bridge.ts +249 -0
- package/src/runtime/plugins/desktop-adapter.ts +374 -0
- package/src/runtime/plugins/desktop-operator-registration.ts +418 -0
- package/src/runtime/plugins/errors.ts +39 -0
- package/src/runtime/plugins/execution-origin.ts +26 -0
- package/src/runtime/plugins/external-adapter.ts +322 -0
- package/src/runtime/plugins/external-registration.ts +308 -0
- package/src/runtime/plugins/external-unix-socket-probe.cjs +79 -0
- package/src/runtime/plugins/external-unix-socket.ts +238 -0
- package/src/runtime/plugins/first-party-registry.ts +37 -0
- package/src/runtime/plugins/github-adapter.ts +266 -0
- package/src/runtime/plugins/gmail-adapter.ts +729 -0
- package/src/runtime/plugins/google-calendar-adapter.ts +468 -0
- package/src/runtime/plugins/google-shared.ts +578 -0
- package/src/runtime/plugins/google-tasks-adapter.ts +535 -0
- package/src/runtime/plugins/interaction-session.ts +252 -0
- package/src/runtime/plugins/ios/agent-device-capabilities.ts +258 -0
- package/src/runtime/plugins/ios/agent-device-failures.ts +95 -0
- package/src/runtime/plugins/ios/agent-device-provider.ts +63 -0
- package/src/runtime/plugins/ios/agent-device-typed-provider.ts +268 -0
- package/src/runtime/plugins/ios/app-adapters.ts +122 -0
- package/src/runtime/plugins/ios-adapter.ts +509 -0
- package/src/runtime/plugins/ios-agent-device.ts +2311 -0
- package/src/runtime/plugins/ios-physical-device.ts +955 -0
- package/src/runtime/plugins/local-system-adapter.ts +1016 -0
- package/src/runtime/plugins/macos-capability-broker.ts +73 -0
- package/src/runtime/plugins/managed-process-adapter.ts +366 -0
- package/src/runtime/plugins/resend-adapter.ts +506 -0
- package/src/runtime/plugins/store.ts +1025 -0
- package/src/runtime/plugins/types.ts +138 -0
- package/src/runtime/projections/controller-context.ts +596 -0
- package/src/runtime/projections/git-status-sampler.ts +84 -0
- package/src/runtime/projections/invalidation.ts +250 -0
- package/src/runtime/projections/materialized-view.ts +694 -0
- package/src/runtime/recovery/actions.ts +158 -0
- package/src/runtime/recovery/audit.ts +38 -0
- package/src/runtime/recovery/classifier.ts +163 -0
- package/src/runtime/recovery/index.ts +9 -0
- package/src/runtime/recovery/local-jobs-repair.ts +393 -0
- package/src/runtime/recovery/maintenance-executor.ts +822 -0
- package/src/runtime/recovery/patch-handoff.ts +50 -0
- package/src/runtime/recovery/probe.ts +308 -0
- package/src/runtime/recovery/store.ts +35 -0
- package/src/runtime/recovery/types.ts +175 -0
- package/src/runtime/release/identity.ts +101 -0
- package/src/runtime/release/release-gate.ts +137 -0
- package/src/runtime/resources/claims/conflicts.ts +205 -0
- package/src/runtime/resources/index.ts +1 -0
- package/src/runtime/resources/leases/store.ts +539 -0
- package/src/runtime/resources/leases/types.ts +50 -0
- package/src/runtime/resources/ownership.ts +72 -0
- package/src/runtime/root/controller-services.ts +42 -0
- package/src/runtime/root/entry.ts +70 -0
- package/src/runtime/root/gateway-adapter.ts +46 -0
- package/src/runtime/root/local-bridge.ts +72 -0
- package/src/runtime/root/mcp-transport.ts +198 -0
- package/src/runtime/root/ownership.ts +94 -0
- package/src/runtime/root/readiness.ts +69 -0
- package/src/runtime/root/release-manifest.ts +147 -0
- package/src/runtime/root/release-materialize.ts +509 -0
- package/src/runtime/root/release-store.ts +236 -0
- package/src/runtime/root/runtime.ts +318 -0
- package/src/runtime/root/scheduler.ts +58 -0
- package/src/runtime/root/service-runner-entry.ts +20 -0
- package/src/runtime/root/service-runner.ts +69 -0
- package/src/runtime/root/service.ts +291 -0
- package/src/runtime/root/status.ts +127 -0
- package/src/runtime/root/types.ts +112 -0
- package/src/runtime/root/write-fence.ts +309 -0
- package/src/runtime/safe-tooling/browser-safe.ts +133 -0
- package/src/runtime/safe-tooling/external-filesystem.ts +304 -0
- package/src/runtime/safe-tooling/google-credential-store.ts +95 -0
- package/src/runtime/safe-tooling/google-oauth-broker.ts +286 -0
- package/src/runtime/safe-tooling/index.ts +11 -0
- package/src/runtime/safe-tooling/ios-development.ts +1039 -0
- package/src/runtime/safe-tooling/job-summary.ts +361 -0
- package/src/runtime/safe-tooling/plugin-summary.ts +53 -0
- package/src/runtime/safe-tooling/resend-oauth.ts +387 -0
- package/src/runtime/safe-tooling/review-artifacts.ts +133 -0
- package/src/runtime/safe-tooling/types.ts +103 -0
- package/src/runtime/safe-tooling/workspace-auth.ts +116 -0
- package/src/runtime/shared/bounded-child-supervisor.ts +235 -0
- package/src/runtime/shared/idempotent-retry.ts +128 -0
- package/src/runtime/shared/json-files.ts +43 -0
- package/src/runtime/shared/local-bridge-surface.ts +231 -0
- package/src/runtime/shared/managed-env.ts +154 -0
- package/src/runtime/shared/node-ts-loader.mjs +50 -0
- package/src/runtime/shared/process-environment.ts +97 -0
- package/src/runtime/shared/process-identity.ts +72 -0
- package/src/runtime/shared/process-tree.ts +227 -0
- package/src/runtime/shared/response-budget.ts +246 -0
- package/src/runtime/standalone-recovery/core.ts +2275 -0
- package/src/runtime/standalone-recovery/entry.ts +686 -0
- package/src/runtime/standalone-recovery/http-transport.ts +317 -0
- package/src/runtime/standalone-recovery/installer.ts +747 -0
- package/src/runtime/standalone-recovery/release.ts +241 -0
- package/src/runtime/watchdog/workflow-watchdog.ts +118 -0
- package/src/runtime/workflow/campaigns/cleanup.ts +263 -0
- package/src/runtime/workflow/campaigns/engine.ts +112 -0
- package/src/runtime/workflow/campaigns/normalize.ts +100 -0
- package/src/runtime/workflow/campaigns/review.ts +315 -0
- package/src/runtime/workflow/campaigns/store.ts +526 -0
- package/src/runtime/workflow/campaigns/supervisor.ts +112 -0
- package/src/runtime/workflow/campaigns/types.ts +290 -0
- package/src/runtime/workflow/campaigns/workspace-agent.ts +155 -0
- package/src/runtime/workflow/campaigns/workspace.ts +200 -0
- package/src/runtime/workflow/findings/store.ts +165 -0
- package/src/runtime/workflow/findings/types.ts +36 -0
- package/src/runtime/workflow/portfolio/engine.ts +20 -0
- package/src/runtime/workflow/portfolio/store.ts +185 -0
- package/src/runtime/workflow/portfolio/types.ts +29 -0
- package/src/runtime/workflow/schedules/engine.ts +620 -0
- package/src/runtime/workflow/schedules/settlement.ts +144 -0
- package/src/runtime/workflow/schedules/store.ts +417 -0
- package/src/runtime/workflow/schedules/types.ts +124 -0
- package/src/runtime/workspace-targets/index.ts +24 -0
- package/src/runtime/workspace-targets/target-grant.ts +721 -0
- package/src/testing/test-governance.ts +626 -0
- package/src/version.ts +21 -0
|
@@ -0,0 +1,1501 @@
|
|
|
1
|
+
# 已批准的 Forge 目标架构
|
|
2
|
+
|
|
3
|
+
> 状态:**Approved Architecture Input**
|
|
4
|
+
> 日期:2026-06-25
|
|
5
|
+
> 本文保留本轮重构所依据的用户目标架构原文;运行时落实情况见 [`target-requirements-traceability.md`](target-requirements-traceability.md)。
|
|
6
|
+
|
|
7
|
+
Forge 目标架构清单
|
|
8
|
+
一、总体判断
|
|
9
|
+
|
|
10
|
+
现在的 Forge 已经不是一个简单的 MCP 工具集,也不只是一个“让 ChatGPT 调 Codex”的桥。
|
|
11
|
+
|
|
12
|
+
它实际上正在演化成一个:
|
|
13
|
+
|
|
14
|
+
面向多个本地代码仓库、由上层 AI 负责决策、以文件状态为事实源、可调度多个 Agent、可恢复执行、可验证交付的工程控制系统。
|
|
15
|
+
|
|
16
|
+
当前最核心的问题不是功能不足,而是:
|
|
17
|
+
|
|
18
|
+
控制面、调度面和执行面还没有彻底分离。
|
|
19
|
+
|
|
20
|
+
目前同一个 MCP/Node 进程既负责:
|
|
21
|
+
|
|
22
|
+
HTTP/MCP 会话
|
|
23
|
+
仓库选择
|
|
24
|
+
状态读取
|
|
25
|
+
锁管理
|
|
26
|
+
长命令执行
|
|
27
|
+
检查任务
|
|
28
|
+
Agent 调度
|
|
29
|
+
部分状态恢复
|
|
30
|
+
|
|
31
|
+
这意味着一个同步命令、一次大范围扫描、一个长期持有的仓库锁,都可能拖住整个事件循环,最终表现为:
|
|
32
|
+
|
|
33
|
+
短查询也出现 502
|
|
34
|
+
长任务结果丢失
|
|
35
|
+
同一个任务重复启动
|
|
36
|
+
一个项目阻塞其他项目
|
|
37
|
+
MCP 连接断开后不知道任务到底有没有执行
|
|
38
|
+
Controller 重启后只能靠扫描和猜测恢复
|
|
39
|
+
|
|
40
|
+
所以目标架构不应继续在现有链路上逐个加特殊处理,而应明确收敛为:
|
|
41
|
+
|
|
42
|
+
Thin Gateway + Global Scheduler + Per-Repository Actor + Durable Job + Isolated Worker + Evidence Plane
|
|
43
|
+
|
|
44
|
+
中文可以称为:
|
|
45
|
+
|
|
46
|
+
薄网关、全局调度、仓库自治、持久任务、隔离执行、证据闭环。
|
|
47
|
+
|
|
48
|
+
二、当前架构清单
|
|
49
|
+
1. 接入层:MCP Gateway
|
|
50
|
+
|
|
51
|
+
当前实现主要位于:
|
|
52
|
+
|
|
53
|
+
src/cli/mcp/server.ts
|
|
54
|
+
src/cli/mcp/transports/http.ts
|
|
55
|
+
src/cli/mcp/multi-repository.ts
|
|
56
|
+
src/cli/mcp/tools.ts
|
|
57
|
+
|
|
58
|
+
当前职责:
|
|
59
|
+
|
|
60
|
+
OAuth/Bearer 鉴权
|
|
61
|
+
Streamable HTTP MCP Session
|
|
62
|
+
工具定义和参数校验
|
|
63
|
+
仓库选择
|
|
64
|
+
多仓库上下文注入
|
|
65
|
+
直接调用工具实现
|
|
66
|
+
拼装完整返回结果
|
|
67
|
+
当前优点
|
|
68
|
+
已支持稳定 repoId
|
|
69
|
+
已支持 checkoutId
|
|
70
|
+
已支持多仓库选择
|
|
71
|
+
MCP 工具按 Profile 控制权限
|
|
72
|
+
有 /health
|
|
73
|
+
有 Tool Surface、Schema Version、Fingerprint
|
|
74
|
+
当前问题
|
|
75
|
+
|
|
76
|
+
http.ts 中的请求处理会等待整个工具调用:
|
|
77
|
+
|
|
78
|
+
handleMcpPost
|
|
79
|
+
-> transport.handleRequest
|
|
80
|
+
-> callMultiRepositoryTool
|
|
81
|
+
-> callMcpTool
|
|
82
|
+
-> 实际工作执行结束
|
|
83
|
+
|
|
84
|
+
也就是说,MCP 请求和实际工作仍然在同一条调用栈中。
|
|
85
|
+
|
|
86
|
+
另外:
|
|
87
|
+
|
|
88
|
+
src/cli/repositories/command-executor.ts
|
|
89
|
+
|
|
90
|
+
仍存在 spawnSync 执行命令的路径。它最多可以阻塞十几分钟。即使异步版本使用 spawn,如果 MCP Handler 一直 await 到任务结束,外部代理仍会超时。
|
|
91
|
+
|
|
92
|
+
目标定位
|
|
93
|
+
|
|
94
|
+
MCP Gateway 以后只允许做四件事:
|
|
95
|
+
|
|
96
|
+
鉴权
|
|
97
|
+
参数校验
|
|
98
|
+
读取轻量快照
|
|
99
|
+
创建持久 Job 并立即返回 ID
|
|
100
|
+
|
|
101
|
+
任何可能超过 1~2 秒的操作,都不能在 MCP 请求线程里完成。
|
|
102
|
+
|
|
103
|
+
2. 全局仓库控制层
|
|
104
|
+
|
|
105
|
+
当前实现主要位于:
|
|
106
|
+
|
|
107
|
+
src/cli/repositories/registry.ts
|
|
108
|
+
src/cli/repositories/types.ts
|
|
109
|
+
src/cli/repositories/runtime-storage.ts
|
|
110
|
+
src/cli/repositories/workbench.ts
|
|
111
|
+
src/cli/repositories/umbrella.ts
|
|
112
|
+
|
|
113
|
+
当前已有:
|
|
114
|
+
|
|
115
|
+
稳定 repoId
|
|
116
|
+
一个仓库多个 Checkout
|
|
117
|
+
Git Remote 映射
|
|
118
|
+
GitHub 插件映射
|
|
119
|
+
Controller Home
|
|
120
|
+
每仓库独立运行存储
|
|
121
|
+
Umbrella 跨仓库任务的初步模型
|
|
122
|
+
|
|
123
|
+
这是很重要的基础,应该保留。
|
|
124
|
+
|
|
125
|
+
当前问题
|
|
126
|
+
|
|
127
|
+
Umbrella 目前更像一个跨仓库状态聚合对象,还不是完整调度模型:
|
|
128
|
+
|
|
129
|
+
没有跨仓库 DAG
|
|
130
|
+
没有失败补偿策略
|
|
131
|
+
没有资源预算
|
|
132
|
+
没有跨仓库依赖门
|
|
133
|
+
没有分阶段发布协议
|
|
134
|
+
没有公平调度
|
|
135
|
+
目标定位
|
|
136
|
+
|
|
137
|
+
全局控制层只负责:
|
|
138
|
+
|
|
139
|
+
注册仓库
|
|
140
|
+
为每个仓库创建独立 Repo Actor
|
|
141
|
+
分配全局 Agent 并发资源
|
|
142
|
+
维护跨仓库工作流
|
|
143
|
+
做公平调度
|
|
144
|
+
管理全局发布窗口和系统级限流
|
|
145
|
+
|
|
146
|
+
它不能直接修改某个仓库的 Task、Run 或工作区。
|
|
147
|
+
|
|
148
|
+
3. 仓库控制层:Repo Actor
|
|
149
|
+
|
|
150
|
+
目前这部分职责分散在:
|
|
151
|
+
|
|
152
|
+
src/cli/controller/*
|
|
153
|
+
src/cli/local-bridge/*
|
|
154
|
+
src/cli/repositories/locks.ts
|
|
155
|
+
src/cli/agent-jobs/*
|
|
156
|
+
|
|
157
|
+
目标架构里,每个仓库应有一个逻辑上的 Repo Actor。
|
|
158
|
+
|
|
159
|
+
不一定立刻使用真正的 Actor Framework,但语义必须一致:
|
|
160
|
+
|
|
161
|
+
一个仓库的所有调度决策,都经过它自己的单线程邮箱顺序处理。
|
|
162
|
+
|
|
163
|
+
Repo Actor 负责:
|
|
164
|
+
|
|
165
|
+
当前仓库的 Issue/Task 状态
|
|
166
|
+
任务依赖
|
|
167
|
+
资源占用
|
|
168
|
+
工作区写入权
|
|
169
|
+
Worktree 分配
|
|
170
|
+
检查排队
|
|
171
|
+
集成队列
|
|
172
|
+
发布冻结
|
|
173
|
+
运行状态恢复
|
|
174
|
+
|
|
175
|
+
不同仓库拥有不同 Repo Actor,因此:
|
|
176
|
+
|
|
177
|
+
Repository A 卡住
|
|
178
|
+
≠ Repository B 卡住
|
|
179
|
+
|
|
180
|
+
这会成为多项目并行能力的核心边界。
|
|
181
|
+
|
|
182
|
+
4. Workflow 层:Issue 与 Task
|
|
183
|
+
|
|
184
|
+
当前实体设计基本正确,位于:
|
|
185
|
+
|
|
186
|
+
src/cli/controller/types.ts
|
|
187
|
+
src/cli/controller/issue-store.ts
|
|
188
|
+
src/cli/controller/task-status-resolver.ts
|
|
189
|
+
|
|
190
|
+
当前模型:
|
|
191
|
+
|
|
192
|
+
Issue
|
|
193
|
+
-> Task
|
|
194
|
+
-> Run 1
|
|
195
|
+
-> Run 2
|
|
196
|
+
-> Verification
|
|
197
|
+
|
|
198
|
+
其中一个非常正确的设计是:
|
|
199
|
+
|
|
200
|
+
Task 表达业务意图,Run 表达执行事实。
|
|
201
|
+
|
|
202
|
+
task-status-resolver.ts 已经明确:
|
|
203
|
+
|
|
204
|
+
只有最新 Run 可以成为当前生命周期拥有者
|
|
205
|
+
历史 Run 只是证据
|
|
206
|
+
老 Run 不能让已完成 Task 复活
|
|
207
|
+
Task 的显式终态优先
|
|
208
|
+
失败 Run 必须显式 Retry
|
|
209
|
+
Superseded Task 可以迁移依赖
|
|
210
|
+
|
|
211
|
+
这部分应当升级为正式架构规则,不允许后续代码绕开。
|
|
212
|
+
|
|
213
|
+
架构规则
|
|
214
|
+
Issue:需求或缺陷容器
|
|
215
|
+
Task:可独立验收的工作单元
|
|
216
|
+
Run:一次执行尝试
|
|
217
|
+
Job:一次系统异步操作
|
|
218
|
+
Verification:针对某个精确 Revision 的证据
|
|
219
|
+
Acceptance:业务层最终认可
|
|
220
|
+
|
|
221
|
+
Run 成功不等于 Task 完成。
|
|
222
|
+
|
|
223
|
+
Run succeeded
|
|
224
|
+
-> Integration
|
|
225
|
+
-> Verification
|
|
226
|
+
-> Acceptance
|
|
227
|
+
-> Task done
|
|
228
|
+
5. Direct Edit 层
|
|
229
|
+
|
|
230
|
+
当前实现:
|
|
231
|
+
|
|
232
|
+
src/cli/editing/edit-session.ts
|
|
233
|
+
|
|
234
|
+
这部分是现有架构里最成熟的能力之一:
|
|
235
|
+
|
|
236
|
+
Allowed Paths
|
|
237
|
+
SHA-256 前置条件
|
|
238
|
+
多 Revision
|
|
239
|
+
Savepoint
|
|
240
|
+
Backup
|
|
241
|
+
Rollback
|
|
242
|
+
Aggregate Diff
|
|
243
|
+
Named Checks
|
|
244
|
+
Finalization
|
|
245
|
+
|
|
246
|
+
应继续坚持:
|
|
247
|
+
|
|
248
|
+
已知且边界明确的修改,优先 Direct Edit,而不是启动 Agent。
|
|
249
|
+
|
|
250
|
+
Direct Edit 使用条件
|
|
251
|
+
|
|
252
|
+
适合:
|
|
253
|
+
|
|
254
|
+
修改目标已知
|
|
255
|
+
改动通常不超过 8 个文件
|
|
256
|
+
不需要大范围探索
|
|
257
|
+
不需要长时间自主编译修复循环
|
|
258
|
+
风险可控
|
|
259
|
+
可以用局部测试验证
|
|
260
|
+
|
|
261
|
+
不适合:
|
|
262
|
+
|
|
263
|
+
大范围跨模块调查
|
|
264
|
+
不知道根因
|
|
265
|
+
需要不断编译、测试、修正
|
|
266
|
+
需要多个方案比较
|
|
267
|
+
需要长时间运行
|
|
268
|
+
6. Agent Run 层
|
|
269
|
+
|
|
270
|
+
当前实现:
|
|
271
|
+
|
|
272
|
+
src/cli/agent-jobs/job-manager.ts
|
|
273
|
+
src/cli/agent-jobs/job-worker.ts
|
|
274
|
+
src/cli/agent-jobs/integration.ts
|
|
275
|
+
src/cli/agent-jobs/types.ts
|
|
276
|
+
|
|
277
|
+
已有强项:
|
|
278
|
+
|
|
279
|
+
Run 持久化
|
|
280
|
+
Agent 可运行时选择
|
|
281
|
+
Workspace/Worktree/GitHub 三种模式
|
|
282
|
+
PID、Heartbeat、Deadline
|
|
283
|
+
stdout、stderr、result、events
|
|
284
|
+
Retry 保留历史
|
|
285
|
+
集成记录
|
|
286
|
+
自动集成状态
|
|
287
|
+
GitHub Copilot Session
|
|
288
|
+
目标定位
|
|
289
|
+
|
|
290
|
+
Agent Run 是:
|
|
291
|
+
|
|
292
|
+
Task 的一次实施尝试,而不是万能后台任务。
|
|
293
|
+
|
|
294
|
+
例如以下事情不应该伪装成 Agent Run:
|
|
295
|
+
|
|
296
|
+
单纯执行测试
|
|
297
|
+
验证 Edit Session
|
|
298
|
+
Git 命令
|
|
299
|
+
发布检查
|
|
300
|
+
周期巡检
|
|
301
|
+
状态同步
|
|
302
|
+
|
|
303
|
+
这些应是不同类型的 Durable Job。
|
|
304
|
+
|
|
305
|
+
7. Local Job 层
|
|
306
|
+
|
|
307
|
+
当前实现:
|
|
308
|
+
|
|
309
|
+
src/cli/local-bridge/job-store.ts
|
|
310
|
+
src/cli/local-bridge/types.ts
|
|
311
|
+
|
|
312
|
+
当前 Local Job 支持:
|
|
313
|
+
|
|
314
|
+
launch-task
|
|
315
|
+
quick-agent-session
|
|
316
|
+
run-check
|
|
317
|
+
|
|
318
|
+
并已经具备:
|
|
319
|
+
|
|
320
|
+
状态持久化
|
|
321
|
+
Atomic JSON
|
|
322
|
+
Event Log
|
|
323
|
+
Active Index
|
|
324
|
+
Deadline
|
|
325
|
+
Owner PID
|
|
326
|
+
Worker PID
|
|
327
|
+
Orphan Recovery
|
|
328
|
+
Request ID 的部分支持
|
|
329
|
+
|
|
330
|
+
这是正确方向,但现在 Local Job 和 Agent Run 的职责边界还不够清楚。
|
|
331
|
+
|
|
332
|
+
目标模型
|
|
333
|
+
|
|
334
|
+
统一定义一个系统级 Job:
|
|
335
|
+
|
|
336
|
+
ExecutionJob
|
|
337
|
+
├─ DispatchTaskJob
|
|
338
|
+
├─ AgentRunJob
|
|
339
|
+
├─ CheckJob
|
|
340
|
+
├─ VerifyEditJob
|
|
341
|
+
├─ RepositoryCommandJob
|
|
342
|
+
├─ IntegrationJob
|
|
343
|
+
├─ ReleaseGateJob
|
|
344
|
+
├─ ReconciliationJob
|
|
345
|
+
└─ ScheduledOccurrenceJob
|
|
346
|
+
|
|
347
|
+
其中:
|
|
348
|
+
|
|
349
|
+
Job 是系统工作单元
|
|
350
|
+
Run 是 Agent 执行尝试
|
|
351
|
+
一个 Job 可以创建或关联一个 Run
|
|
352
|
+
Job 生命周期不能和 Run 生命周期混为一体
|
|
353
|
+
|
|
354
|
+
例如:
|
|
355
|
+
|
|
356
|
+
DispatchTaskJob
|
|
357
|
+
-> 创建 Agent Run
|
|
358
|
+
-> Job 状态 dispatched
|
|
359
|
+
-> 等待 Run 终态
|
|
360
|
+
-> Job 状态 succeeded/failed
|
|
361
|
+
三、目标架构拓扑
|
|
362
|
+
┌─────────────────────┐
|
|
363
|
+
│ ChatGPT / Local UI │
|
|
364
|
+
│ CLI / GitHub Plugin │
|
|
365
|
+
└──────────┬──────────┘
|
|
366
|
+
│
|
|
367
|
+
short request / query
|
|
368
|
+
│
|
|
369
|
+
┌───────────────▼───────────────┐
|
|
370
|
+
│ Thin MCP Gateway │
|
|
371
|
+
│ auth / validate / route / ack │
|
|
372
|
+
└───────────────┬───────────────┘
|
|
373
|
+
│
|
|
374
|
+
durable command
|
|
375
|
+
│
|
|
376
|
+
┌───────────────▼───────────────┐
|
|
377
|
+
│ Global Control Plane │
|
|
378
|
+
│ registry / scheduler / quota │
|
|
379
|
+
│ portfolio / cross-repo DAG │
|
|
380
|
+
└───────┬───────────────┬────────┘
|
|
381
|
+
│ │
|
|
382
|
+
┌──────────▼─────┐ ┌──────▼──────────┐
|
|
383
|
+
│ Repo Actor A │ │ Repo Actor B │
|
|
384
|
+
│ mailbox │ │ mailbox │
|
|
385
|
+
│ claims/leases │ │ claims/leases │
|
|
386
|
+
└──────┬─────────┘ └────────┬────────┘
|
|
387
|
+
│ │
|
|
388
|
+
┌───────▼────────────────────▼───────┐
|
|
389
|
+
│ Durable Job Queue │
|
|
390
|
+
│ requestId / state / events / lease │
|
|
391
|
+
└───────┬────────────────────┬────────┘
|
|
392
|
+
│ │
|
|
393
|
+
┌────────▼────────┐ ┌────────▼────────┐
|
|
394
|
+
│ Worker Process │ │ Worker Process │
|
|
395
|
+
│ command/check │ │ Codex/Claude │
|
|
396
|
+
└────────┬────────┘ └────────┬────────┘
|
|
397
|
+
│ │
|
|
398
|
+
┌───────▼────────────────────▼───────┐
|
|
399
|
+
│ Evidence / Artifacts / Event Ledger │
|
|
400
|
+
└─────────────────────────────────────┘
|
|
401
|
+
四、架构宪法
|
|
402
|
+
|
|
403
|
+
后续所有新增功能都必须遵守以下规则。
|
|
404
|
+
|
|
405
|
+
宪法 1:MCP 不执行长任务
|
|
406
|
+
|
|
407
|
+
MCP Handler 的目标响应时间:
|
|
408
|
+
|
|
409
|
+
轻量读取:500ms 以内
|
|
410
|
+
复杂快照:2 秒以内
|
|
411
|
+
写入/执行请求:持久化后立即返回
|
|
412
|
+
|
|
413
|
+
标准返回:
|
|
414
|
+
|
|
415
|
+
{
|
|
416
|
+
"accepted": true,
|
|
417
|
+
"jobId": "JOB-...",
|
|
418
|
+
"status": "queued",
|
|
419
|
+
"next": "Call get_job"
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
禁止:
|
|
423
|
+
|
|
424
|
+
MCP 内直接 spawnSync
|
|
425
|
+
MCP 内等待 Agent 结束
|
|
426
|
+
MCP 内等待完整测试结束
|
|
427
|
+
MCP 内持有仓库锁几十秒
|
|
428
|
+
MCP 内扫描全部历史记录
|
|
429
|
+
MCP 返回完整日志
|
|
430
|
+
宪法 2:先持久化,再执行
|
|
431
|
+
|
|
432
|
+
正确顺序:
|
|
433
|
+
|
|
434
|
+
validate
|
|
435
|
+
-> persist intent
|
|
436
|
+
-> assign requestId
|
|
437
|
+
-> persist Job
|
|
438
|
+
-> return Job ID
|
|
439
|
+
-> worker starts
|
|
440
|
+
|
|
441
|
+
禁止:
|
|
442
|
+
|
|
443
|
+
spawn process
|
|
444
|
+
-> later try to save state
|
|
445
|
+
|
|
446
|
+
否则连接断开后系统不知道任务是否已经启动。
|
|
447
|
+
|
|
448
|
+
宪法 3:所有修改操作必须幂等
|
|
449
|
+
|
|
450
|
+
每个写入或执行请求都必须有:
|
|
451
|
+
|
|
452
|
+
requestId
|
|
453
|
+
repoId
|
|
454
|
+
operationType
|
|
455
|
+
semanticKey
|
|
456
|
+
|
|
457
|
+
推荐语义键:
|
|
458
|
+
|
|
459
|
+
requestId = caller + action + repoId + logical-request
|
|
460
|
+
|
|
461
|
+
Schedule 触发则使用:
|
|
462
|
+
|
|
463
|
+
requestId = scheduleId + repoId + occurrenceWindow
|
|
464
|
+
|
|
465
|
+
同一 Request ID:
|
|
466
|
+
|
|
467
|
+
不得创建重复 Job
|
|
468
|
+
不得创建重复 Run
|
|
469
|
+
不得重复执行发布
|
|
470
|
+
不得重复创建 Issue
|
|
471
|
+
宪法 4:Task 与 Run 永远分离
|
|
472
|
+
|
|
473
|
+
Task 是意图;Run 是尝试。
|
|
474
|
+
|
|
475
|
+
必须保持:
|
|
476
|
+
|
|
477
|
+
Task 1
|
|
478
|
+
Run A failed
|
|
479
|
+
Run B succeeded
|
|
480
|
+
|
|
481
|
+
不能通过修改 Run A 把它“变成成功”。
|
|
482
|
+
|
|
483
|
+
Retry 必须生成新 Run。
|
|
484
|
+
|
|
485
|
+
宪法 5:每个仓库只有一个调度所有者
|
|
486
|
+
|
|
487
|
+
一个 Repo Actor 是该仓库调度状态的唯一所有者。
|
|
488
|
+
|
|
489
|
+
它可以允许多个 Worker,但:
|
|
490
|
+
|
|
491
|
+
谁可以运行
|
|
492
|
+
用哪个工作区
|
|
493
|
+
是否冲突
|
|
494
|
+
是否进入集成队列
|
|
495
|
+
是否进入发布冻结
|
|
496
|
+
|
|
497
|
+
只能由 Repo Actor 决定。
|
|
498
|
+
|
|
499
|
+
宪法 6:未知 Scope 必须保守处理
|
|
500
|
+
|
|
501
|
+
当前实现中没有 Allowed Paths 时,不一定判定冲突,这在 Workspace 并发时风险较大。
|
|
502
|
+
|
|
503
|
+
目标策略:
|
|
504
|
+
|
|
505
|
+
allowedPaths 为空
|
|
506
|
+
=> write scope = repo-content:*
|
|
507
|
+
|
|
508
|
+
也就是和所有写入任务冲突。
|
|
509
|
+
|
|
510
|
+
除非该任务被明确归类为只读。
|
|
511
|
+
|
|
512
|
+
宪法 7:锁只保护状态事务,Lease 才保护长执行
|
|
513
|
+
|
|
514
|
+
当前 withControllerLockAsync 可能持有 Repository Lock 等待整个工具完成。
|
|
515
|
+
|
|
516
|
+
目标拆分:
|
|
517
|
+
|
|
518
|
+
短事务锁
|
|
519
|
+
|
|
520
|
+
用于:
|
|
521
|
+
|
|
522
|
+
创建 Job
|
|
523
|
+
修改 Task
|
|
524
|
+
更新索引
|
|
525
|
+
领取资源
|
|
526
|
+
|
|
527
|
+
持续时间应以毫秒计算。
|
|
528
|
+
|
|
529
|
+
执行 Lease
|
|
530
|
+
|
|
531
|
+
用于:
|
|
532
|
+
|
|
533
|
+
Workspace 写入权
|
|
534
|
+
Heavy Check
|
|
535
|
+
Git Ref 修改
|
|
536
|
+
Release Freeze
|
|
537
|
+
Worktree Slot
|
|
538
|
+
|
|
539
|
+
Lease 必须有:
|
|
540
|
+
|
|
541
|
+
leaseId
|
|
542
|
+
resourceKey
|
|
543
|
+
ownerJobId
|
|
544
|
+
fencingToken
|
|
545
|
+
acquiredAt
|
|
546
|
+
expiresAt
|
|
547
|
+
heartbeatAt
|
|
548
|
+
|
|
549
|
+
并支持续租。
|
|
550
|
+
|
|
551
|
+
状态写入时需要校验 Fencing Token,防止旧 Worker 复活后覆盖新状态。
|
|
552
|
+
|
|
553
|
+
宪法 8:所有热路径必须依赖索引
|
|
554
|
+
|
|
555
|
+
禁止热路径扫描全部历史。
|
|
556
|
+
|
|
557
|
+
至少维护:
|
|
558
|
+
|
|
559
|
+
active-jobs index
|
|
560
|
+
request-id index
|
|
561
|
+
task-to-runs index
|
|
562
|
+
repo-resource-claims index
|
|
563
|
+
schedule-active-occurrence index
|
|
564
|
+
pending-integration index
|
|
565
|
+
|
|
566
|
+
历史数据用于审计,不用于每次状态查询。
|
|
567
|
+
|
|
568
|
+
宪法 9:执行和观察必须隔离
|
|
569
|
+
|
|
570
|
+
长任务运行期间,下列查询必须始终可用:
|
|
571
|
+
|
|
572
|
+
health
|
|
573
|
+
repository_get
|
|
574
|
+
controller_context
|
|
575
|
+
get_job
|
|
576
|
+
get_run
|
|
577
|
+
local_bridge_status
|
|
578
|
+
|
|
579
|
+
因此:
|
|
580
|
+
|
|
581
|
+
Worker 不得运行在 MCP Gateway 事件循环
|
|
582
|
+
Heavy Check 不得阻塞状态读取
|
|
583
|
+
日志读取必须有 maxBytes
|
|
584
|
+
快照必须使用 Materialized View
|
|
585
|
+
宪法 10:验证绑定精确 Revision
|
|
586
|
+
|
|
587
|
+
一次验证结果必须绑定:
|
|
588
|
+
|
|
589
|
+
repoId
|
|
590
|
+
checkoutId
|
|
591
|
+
revision
|
|
592
|
+
command/checkId
|
|
593
|
+
environmentFingerprint
|
|
594
|
+
executedAt
|
|
595
|
+
|
|
596
|
+
Repository Revision 变化后,旧验证应变为:
|
|
597
|
+
|
|
598
|
+
stale
|
|
599
|
+
|
|
600
|
+
而不是继续当作成功证据。
|
|
601
|
+
|
|
602
|
+
宪法 11:冲突默认排队,不默认失败
|
|
603
|
+
|
|
604
|
+
资源冲突不是错误,而是调度状态。
|
|
605
|
+
|
|
606
|
+
例如:
|
|
607
|
+
|
|
608
|
+
waiting_for_workspace
|
|
609
|
+
waiting_for_heavy_check
|
|
610
|
+
waiting_for_integration
|
|
611
|
+
waiting_for_release_barrier
|
|
612
|
+
waiting_for_dependency
|
|
613
|
+
|
|
614
|
+
只有以下情况才失败:
|
|
615
|
+
|
|
616
|
+
Scope 违反
|
|
617
|
+
不可恢复状态损坏
|
|
618
|
+
明确 Fail Fast
|
|
619
|
+
Deadline 到期
|
|
620
|
+
人工取消
|
|
621
|
+
验证失败
|
|
622
|
+
宪法 12:外部副作用必须人工授权
|
|
623
|
+
|
|
624
|
+
以下操作不能由循环任务自动执行:
|
|
625
|
+
|
|
626
|
+
push
|
|
627
|
+
merge
|
|
628
|
+
publish
|
|
629
|
+
production deploy
|
|
630
|
+
删除分支
|
|
631
|
+
force push
|
|
632
|
+
reset/rebase
|
|
633
|
+
数据库破坏性变更
|
|
634
|
+
对外关闭 Issue
|
|
635
|
+
|
|
636
|
+
自动化可以准备发布,但不能擅自发布。
|
|
637
|
+
|
|
638
|
+
五、任务分派策略
|
|
639
|
+
1. 第一阶段:工作模式选择
|
|
640
|
+
|
|
641
|
+
输入需求后,先产生 WorkAssessment:
|
|
642
|
+
|
|
643
|
+
理解是否充分
|
|
644
|
+
目标文件是否已知
|
|
645
|
+
预计文件数
|
|
646
|
+
预计改动行数
|
|
647
|
+
是否需要探索
|
|
648
|
+
是否需要依赖图
|
|
649
|
+
是否需要并发
|
|
650
|
+
是否长时间检查
|
|
651
|
+
风险等级
|
|
652
|
+
外部副作用
|
|
653
|
+
Direct Edit
|
|
654
|
+
|
|
655
|
+
选择条件:
|
|
656
|
+
|
|
657
|
+
已理解实现
|
|
658
|
+
Scope 明确
|
|
659
|
+
改动边界较小
|
|
660
|
+
不需要长时间探索
|
|
661
|
+
可以局部验证
|
|
662
|
+
Quick Agent
|
|
663
|
+
|
|
664
|
+
选择条件:
|
|
665
|
+
|
|
666
|
+
目标明确
|
|
667
|
+
实现需要探索
|
|
668
|
+
不需要长期 Issue DAG
|
|
669
|
+
可以一次 Agent 会话完成
|
|
670
|
+
失败后可以整体重试
|
|
671
|
+
Issue → Task
|
|
672
|
+
|
|
673
|
+
选择条件:
|
|
674
|
+
|
|
675
|
+
多步骤依赖
|
|
676
|
+
高风险
|
|
677
|
+
跨模块
|
|
678
|
+
跨仓库
|
|
679
|
+
需要多个 Agent
|
|
680
|
+
需要长期跟踪
|
|
681
|
+
需要发布门
|
|
682
|
+
需要周期执行
|
|
683
|
+
2. Agent 角色划分
|
|
684
|
+
|
|
685
|
+
不应该把所有 Agent 都当成相同的“代码生成器”。
|
|
686
|
+
|
|
687
|
+
Controller / Architect
|
|
688
|
+
|
|
689
|
+
职责:
|
|
690
|
+
|
|
691
|
+
理解需求
|
|
692
|
+
架构设计
|
|
693
|
+
Task 拆分
|
|
694
|
+
Scope 定义
|
|
695
|
+
风险和冲突决策
|
|
696
|
+
审核结果
|
|
697
|
+
|
|
698
|
+
一般由 ChatGPT 承担。
|
|
699
|
+
|
|
700
|
+
Explorer
|
|
701
|
+
|
|
702
|
+
职责:
|
|
703
|
+
|
|
704
|
+
只读调查
|
|
705
|
+
架构定位
|
|
706
|
+
根因分析
|
|
707
|
+
产生候选文件和方案
|
|
708
|
+
|
|
709
|
+
不允许修改代码。
|
|
710
|
+
|
|
711
|
+
Implementer
|
|
712
|
+
|
|
713
|
+
职责:
|
|
714
|
+
|
|
715
|
+
在限定 Scope 内实现
|
|
716
|
+
执行局部测试
|
|
717
|
+
产出 Diff
|
|
718
|
+
|
|
719
|
+
Codex、Claude 都可以担任。
|
|
720
|
+
|
|
721
|
+
Verifier
|
|
722
|
+
|
|
723
|
+
只在高风险任务需要,职责:
|
|
724
|
+
|
|
725
|
+
按原 Task Acceptance Criteria 验证
|
|
726
|
+
不允许自己发明新的评价标准
|
|
727
|
+
不允许把“代码看起来不错”当作验收
|
|
728
|
+
Integrator
|
|
729
|
+
|
|
730
|
+
应该是确定性程序,不应交给 LLM。
|
|
731
|
+
|
|
732
|
+
职责:
|
|
733
|
+
|
|
734
|
+
检查 Base Revision
|
|
735
|
+
检查 Diff
|
|
736
|
+
应用 Patch
|
|
737
|
+
检测冲突
|
|
738
|
+
记录 Integration Evidence
|
|
739
|
+
Release Steward
|
|
740
|
+
|
|
741
|
+
职责:
|
|
742
|
+
|
|
743
|
+
检查发布屏障
|
|
744
|
+
生成发布清单
|
|
745
|
+
等待用户授权执行外部副作用
|
|
746
|
+
3. Agent 选择策略
|
|
747
|
+
|
|
748
|
+
Task 不永久绑定 Agent。
|
|
749
|
+
|
|
750
|
+
运行时根据任务能力选择:
|
|
751
|
+
|
|
752
|
+
场景 默认方式
|
|
753
|
+
已知小改动 Direct Edit
|
|
754
|
+
大范围代码探索和反复测试 Codex
|
|
755
|
+
架构、文档、跨模块语义梳理 Claude 或 ChatGPT
|
|
756
|
+
GitHub PR 协作 GitHub Copilot
|
|
757
|
+
只读排查 Explorer Agent
|
|
758
|
+
确定性集成 程序执行,不用 Agent
|
|
759
|
+
|
|
760
|
+
Agent 失败后不能盲目切换 Agent。要先分类:
|
|
761
|
+
|
|
762
|
+
infrastructure failure
|
|
763
|
+
scope conflict
|
|
764
|
+
implementation failure
|
|
765
|
+
acceptance failure
|
|
766
|
+
environment failure
|
|
767
|
+
agent capability mismatch
|
|
768
|
+
|
|
769
|
+
只有最后一种才优先换 Agent。
|
|
770
|
+
|
|
771
|
+
六、单项目并发与冲突策略
|
|
772
|
+
1. 资源 Claim 模型
|
|
773
|
+
|
|
774
|
+
不能只用文件路径判断冲突,应声明资源:
|
|
775
|
+
|
|
776
|
+
repo-state
|
|
777
|
+
workspace:<checkoutId>
|
|
778
|
+
worktree:<worktreeId>
|
|
779
|
+
path:<glob>
|
|
780
|
+
git-index:<checkoutId>
|
|
781
|
+
git-refs:<repoId>
|
|
782
|
+
heavy-check:<repoId>
|
|
783
|
+
integration:<repoId>
|
|
784
|
+
remote:<repoId>
|
|
785
|
+
release:<repoId>
|
|
786
|
+
2. 冲突矩阵
|
|
787
|
+
工作类型 是否允许并发 策略
|
|
788
|
+
纯读取 是 不加写锁
|
|
789
|
+
状态查询 是 读取快照
|
|
790
|
+
两个 Direct Edit 默认否 同 Checkout 单写者
|
|
791
|
+
Workspace Agent + Direct Edit 否 后者排队
|
|
792
|
+
两个 Workspace Agent 否 只能一个
|
|
793
|
+
两个 Worktree Agent 可以 独立 Worktree
|
|
794
|
+
Worktree Agent 路径重叠 可以执行 但集成时串行检查冲突
|
|
795
|
+
Light Check 可以配置并发 设置每仓库上限
|
|
796
|
+
Heavy Check 默认每仓库一个 进入队列
|
|
797
|
+
Git Ref 修改 否 Repo Exclusive
|
|
798
|
+
Integration 否 串行 Integration Queue
|
|
799
|
+
Release 否 启动 Release Freeze
|
|
800
|
+
Remote Write 否 明确授权、串行
|
|
801
|
+
3. 默认执行位置
|
|
802
|
+
|
|
803
|
+
遵循你的工作习惯:
|
|
804
|
+
|
|
805
|
+
单个串行任务
|
|
806
|
+
=> 当前 Workspace
|
|
807
|
+
|
|
808
|
+
检测到并发写入
|
|
809
|
+
=> 新任务进入 Worktree
|
|
810
|
+
|
|
811
|
+
用户明确要求隔离
|
|
812
|
+
=> Worktree
|
|
813
|
+
|
|
814
|
+
外部 GitHub Agent
|
|
815
|
+
=> GitHub Branch/PR
|
|
816
|
+
|
|
817
|
+
不能为了“看起来安全”而所有任务都建立 Worktree,否则会带来大量:
|
|
818
|
+
|
|
819
|
+
集成延迟
|
|
820
|
+
残留 Worktree
|
|
821
|
+
冲突处理
|
|
822
|
+
分支清理
|
|
823
|
+
状态漂移
|
|
824
|
+
4. Worktree 集成策略
|
|
825
|
+
|
|
826
|
+
并发 Worktree 可以同时实现,但集成必须串行。
|
|
827
|
+
|
|
828
|
+
Run 完成
|
|
829
|
+
-> 检查 Diff
|
|
830
|
+
-> 进入 Integration Queue
|
|
831
|
+
-> 校验 Base Revision
|
|
832
|
+
-> 校验主工作区状态
|
|
833
|
+
-> 应用补丁
|
|
834
|
+
-> 运行受影响检查
|
|
835
|
+
-> 记录 Integration Evidence
|
|
836
|
+
-> 清理 Worktree
|
|
837
|
+
|
|
838
|
+
若主分支发生变化:
|
|
839
|
+
|
|
840
|
+
不自动 rebase
|
|
841
|
+
不自动 reset
|
|
842
|
+
不静默覆盖
|
|
843
|
+
尝试确定性 Patch Integration
|
|
844
|
+
有冲突则进入 integration_conflict
|
|
845
|
+
保留 Worktree 等待修复
|
|
846
|
+
七、多项目并发策略
|
|
847
|
+
1. 全局调度器
|
|
848
|
+
|
|
849
|
+
多个项目之间不能共用 Repository Lock。
|
|
850
|
+
|
|
851
|
+
全局调度器只控制系统资源:
|
|
852
|
+
|
|
853
|
+
maxAgentProcesses
|
|
854
|
+
maxHeavyChecks
|
|
855
|
+
maxConcurrentRepositories
|
|
856
|
+
perAgentQuota
|
|
857
|
+
perRepoQuota
|
|
858
|
+
memoryBudget
|
|
859
|
+
cpuBudget
|
|
860
|
+
|
|
861
|
+
例如:
|
|
862
|
+
|
|
863
|
+
全局最多 4 个 Agent
|
|
864
|
+
每个仓库最多 2 个写入 Worker
|
|
865
|
+
每个仓库最多 1 个 Heavy Check
|
|
866
|
+
全局最多 2 个 Heavy Check
|
|
867
|
+
2. 公平调度
|
|
868
|
+
|
|
869
|
+
建议使用:
|
|
870
|
+
|
|
871
|
+
Aging Weighted Fair Queue
|
|
872
|
+
|
|
873
|
+
排序因素:
|
|
874
|
+
|
|
875
|
+
priority
|
|
876
|
+
wait time
|
|
877
|
+
dependency criticality
|
|
878
|
+
user initiated vs scheduled
|
|
879
|
+
risk
|
|
880
|
+
estimated cost
|
|
881
|
+
repo quota
|
|
882
|
+
|
|
883
|
+
优先级建议:
|
|
884
|
+
|
|
885
|
+
P0 外部故障/系统不可用
|
|
886
|
+
P1 用户显式任务
|
|
887
|
+
P2 当前 Issue 后续任务
|
|
888
|
+
P3 自动巡检修复
|
|
889
|
+
P4 健康扫描和优化建议
|
|
890
|
+
|
|
891
|
+
Schedule 任务不能长期挤占用户显式任务。
|
|
892
|
+
|
|
893
|
+
3. 跨仓库工作流
|
|
894
|
+
|
|
895
|
+
Umbrella 应升级为:
|
|
896
|
+
|
|
897
|
+
PortfolioWorkflow
|
|
898
|
+
-> RepositoryTask A
|
|
899
|
+
-> RepositoryTask B depends on A
|
|
900
|
+
-> RepositoryTask C independent
|
|
901
|
+
|
|
902
|
+
跨仓库不应尝试“分布式原子事务”。
|
|
903
|
+
|
|
904
|
+
采用 Saga:
|
|
905
|
+
|
|
906
|
+
Prepare
|
|
907
|
+
-> Execute per repository
|
|
908
|
+
-> Verify per repository
|
|
909
|
+
-> Commit checkpoint
|
|
910
|
+
-> Continue dependent repositories
|
|
911
|
+
-> Compensate or stop on failure
|
|
912
|
+
|
|
913
|
+
例如一个 API 改动涉及三个项目:
|
|
914
|
+
|
|
915
|
+
Backend schema
|
|
916
|
+
-> SDK generation
|
|
917
|
+
-> Client migration
|
|
918
|
+
|
|
919
|
+
Backend 失败时,其他项目不能继续。
|
|
920
|
+
|
|
921
|
+
但无依赖的其他仓库任务仍可正常运行。
|
|
922
|
+
|
|
923
|
+
八、循环任务与 Schedule 架构
|
|
924
|
+
|
|
925
|
+
循环任务不能设计成:
|
|
926
|
+
|
|
927
|
+
启动一个 Agent
|
|
928
|
+
-> 让它永远循环
|
|
929
|
+
|
|
930
|
+
正确设计应是:
|
|
931
|
+
|
|
932
|
+
每次 Schedule 只产生一个有边界的 Occurrence。
|
|
933
|
+
|
|
934
|
+
1. 新增实体
|
|
935
|
+
Schedule
|
|
936
|
+
Trigger
|
|
937
|
+
Occurrence
|
|
938
|
+
Decision
|
|
939
|
+
Job
|
|
940
|
+
Outcome
|
|
941
|
+
Schedule
|
|
942
|
+
|
|
943
|
+
定义长期策略:
|
|
944
|
+
|
|
945
|
+
{
|
|
946
|
+
"scheduleId": "SCH-...",
|
|
947
|
+
"repoId": "repo-...",
|
|
948
|
+
"trigger": {
|
|
949
|
+
"type": "interval",
|
|
950
|
+
"everyMinutes": 60
|
|
951
|
+
},
|
|
952
|
+
"policy": {
|
|
953
|
+
"maxActiveOccurrences": 1,
|
|
954
|
+
"maxFailures": 3,
|
|
955
|
+
"cooldownMinutes": 120,
|
|
956
|
+
"dailyBudgetMinutes": 180
|
|
957
|
+
},
|
|
958
|
+
"stopConditions": [
|
|
959
|
+
"release_ready",
|
|
960
|
+
"external_blocker",
|
|
961
|
+
"human_review_required"
|
|
962
|
+
]
|
|
963
|
+
}
|
|
964
|
+
Occurrence
|
|
965
|
+
|
|
966
|
+
Schedule 的一次触发:
|
|
967
|
+
|
|
968
|
+
OCC-scheduleId-timeWindow
|
|
969
|
+
|
|
970
|
+
每个时间窗口只能创建一个 Occurrence。
|
|
971
|
+
|
|
972
|
+
2. 每次循环流程
|
|
973
|
+
Trigger
|
|
974
|
+
-> acquire schedule lease
|
|
975
|
+
-> read compact repo snapshot
|
|
976
|
+
-> deterministic triage
|
|
977
|
+
-> persist decision
|
|
978
|
+
-> no-op / create Task / create Job
|
|
979
|
+
-> execute one bounded unit
|
|
980
|
+
-> verify
|
|
981
|
+
-> record outcome
|
|
982
|
+
-> release lease
|
|
983
|
+
|
|
984
|
+
循环任务首先应该是 Triage Agent,而不是直接写代码。
|
|
985
|
+
|
|
986
|
+
它可以得出:
|
|
987
|
+
|
|
988
|
+
nothing_to_do
|
|
989
|
+
continue_existing_task
|
|
990
|
+
retry_infrastructure_failure
|
|
991
|
+
create_bug_task
|
|
992
|
+
create_improvement_candidate
|
|
993
|
+
release_ready
|
|
994
|
+
human_attention_required
|
|
995
|
+
3. 循环防失控策略
|
|
996
|
+
|
|
997
|
+
必须包含:
|
|
998
|
+
|
|
999
|
+
同一 Schedule 最多一个 Active Occurrence
|
|
1000
|
+
同一问题有 Semantic Dedupe Key
|
|
1001
|
+
最大连续失败次数
|
|
1002
|
+
指数退避
|
|
1003
|
+
每小时/每日预算
|
|
1004
|
+
最大 Agent Run 数
|
|
1005
|
+
Workspace Dirty 时不自动写入
|
|
1006
|
+
Release Freeze 时不启动修改
|
|
1007
|
+
外部服务异常时只记录,不无限重试
|
|
1008
|
+
已经存在同类 Issue 时不重复创建
|
|
1009
|
+
自动创建需求必须先进入 Candidate 状态
|
|
1010
|
+
自动新增需求规则
|
|
1011
|
+
|
|
1012
|
+
Schedule 可以创建:
|
|
1013
|
+
|
|
1014
|
+
candidate finding
|
|
1015
|
+
|
|
1016
|
+
只有满足以下之一才升级为正式 Task:
|
|
1017
|
+
|
|
1018
|
+
可复现 Bug
|
|
1019
|
+
检查明确失败
|
|
1020
|
+
有结构化证据
|
|
1021
|
+
连续多个周期出现
|
|
1022
|
+
用户要求自动处理此类问题
|
|
1023
|
+
|
|
1024
|
+
不能因为 Agent “觉得可以优化”就不断创建需求。
|
|
1025
|
+
|
|
1026
|
+
九、状态存储架构
|
|
1027
|
+
|
|
1028
|
+
目前 file-backed 是正确方向,不建议现在立刻改成数据库。
|
|
1029
|
+
|
|
1030
|
+
目标分三类状态。
|
|
1031
|
+
|
|
1032
|
+
1. 业务意图状态
|
|
1033
|
+
|
|
1034
|
+
可追踪、可审查:
|
|
1035
|
+
|
|
1036
|
+
tasks/issues/
|
|
1037
|
+
architecture decisions
|
|
1038
|
+
release manifests
|
|
1039
|
+
exported reports
|
|
1040
|
+
|
|
1041
|
+
可以进入 Git。
|
|
1042
|
+
|
|
1043
|
+
2. Controller Runtime 状态
|
|
1044
|
+
|
|
1045
|
+
位于 Controller Home:
|
|
1046
|
+
|
|
1047
|
+
repositories/<repoId>/
|
|
1048
|
+
jobs/
|
|
1049
|
+
runs/
|
|
1050
|
+
schedules/
|
|
1051
|
+
occurrences/
|
|
1052
|
+
leases/
|
|
1053
|
+
indexes/
|
|
1054
|
+
worktrees/
|
|
1055
|
+
edit-sessions/
|
|
1056
|
+
materialized-views/
|
|
1057
|
+
|
|
1058
|
+
不进入 Git。
|
|
1059
|
+
|
|
1060
|
+
3. Evidence 与 Artifact
|
|
1061
|
+
checks/
|
|
1062
|
+
logs/
|
|
1063
|
+
diffs/
|
|
1064
|
+
command-results/
|
|
1065
|
+
integration-records/
|
|
1066
|
+
release-evidence/
|
|
1067
|
+
|
|
1068
|
+
按 ID 可寻址。
|
|
1069
|
+
|
|
1070
|
+
4. Event Log 与 Snapshot
|
|
1071
|
+
|
|
1072
|
+
推荐继续文件模式,但采用:
|
|
1073
|
+
|
|
1074
|
+
append-only event log
|
|
1075
|
+
+
|
|
1076
|
+
atomic materialized snapshot
|
|
1077
|
+
+
|
|
1078
|
+
bounded indexes
|
|
1079
|
+
|
|
1080
|
+
每个事件统一包含:
|
|
1081
|
+
|
|
1082
|
+
{
|
|
1083
|
+
"eventId": "...",
|
|
1084
|
+
"eventType": "...",
|
|
1085
|
+
"repoId": "...",
|
|
1086
|
+
"entityType": "job",
|
|
1087
|
+
"entityId": "...",
|
|
1088
|
+
"correlationId": "...",
|
|
1089
|
+
"causationId": "...",
|
|
1090
|
+
"requestId": "...",
|
|
1091
|
+
"revision": 12,
|
|
1092
|
+
"occurredAt": "..."
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
任何状态都应该能回答:
|
|
1096
|
+
|
|
1097
|
+
谁创建的
|
|
1098
|
+
为什么创建
|
|
1099
|
+
由哪个请求触发
|
|
1100
|
+
当前由谁持有
|
|
1101
|
+
上一个状态是什么
|
|
1102
|
+
最终证据在哪里
|
|
1103
|
+
十、502 问题的架构级解决方案
|
|
1104
|
+
|
|
1105
|
+
当前 502 不是单一 Bug,而是架构耦合的结果。
|
|
1106
|
+
|
|
1107
|
+
当前高风险点
|
|
1108
|
+
1. MCP 和执行共享进程
|
|
1109
|
+
|
|
1110
|
+
http.ts 的 Handler 等待完整工具调用。
|
|
1111
|
+
|
|
1112
|
+
2. 同步子进程
|
|
1113
|
+
|
|
1114
|
+
command-executor.ts 中存在 spawnSync。
|
|
1115
|
+
|
|
1116
|
+
3. Repository Lock 包裹整个工具 Promise
|
|
1117
|
+
|
|
1118
|
+
multi-repository.ts 中 Repository Lock 可能持续到整个 Tool 完成。
|
|
1119
|
+
|
|
1120
|
+
4. 检查去重主要存在于内存
|
|
1121
|
+
|
|
1122
|
+
check-runner.ts 中:
|
|
1123
|
+
|
|
1124
|
+
activeAsyncChecks
|
|
1125
|
+
heavyCheckQueues
|
|
1126
|
+
|
|
1127
|
+
Controller 重启后会丢失订阅和队列信息。
|
|
1128
|
+
|
|
1129
|
+
5. 一个进程承担所有仓库
|
|
1130
|
+
|
|
1131
|
+
即使多仓库状态隔离,一个事件循环被阻塞仍会影响全部仓库。
|
|
1132
|
+
|
|
1133
|
+
目标进程结构
|
|
1134
|
+
|
|
1135
|
+
至少拆为三个进程:
|
|
1136
|
+
|
|
1137
|
+
Forge-gateway
|
|
1138
|
+
Forge-controller-daemon
|
|
1139
|
+
Forge-worker
|
|
1140
|
+
Gateway
|
|
1141
|
+
MCP/HTTP
|
|
1142
|
+
鉴权
|
|
1143
|
+
快速读取 Materialized View
|
|
1144
|
+
接受 Command
|
|
1145
|
+
返回 Job ID
|
|
1146
|
+
Canonical Forge Runtime
|
|
1147
|
+
Scheduler
|
|
1148
|
+
Repo Actors
|
|
1149
|
+
Lease
|
|
1150
|
+
Reconciliation
|
|
1151
|
+
Schedule Engine
|
|
1152
|
+
Job Queue
|
|
1153
|
+
Worker
|
|
1154
|
+
Agent CLI
|
|
1155
|
+
Check
|
|
1156
|
+
Repository Command
|
|
1157
|
+
Integration
|
|
1158
|
+
Release Gate
|
|
1159
|
+
|
|
1160
|
+
Worker 崩溃不能导致 Gateway 崩溃。
|
|
1161
|
+
|
|
1162
|
+
Gateway 重启不能取消已经接受的 Job。
|
|
1163
|
+
|
|
1164
|
+
健康检查拆分
|
|
1165
|
+
/health
|
|
1166
|
+
|
|
1167
|
+
只检查 Gateway Event Loop,必须始终快速返回。
|
|
1168
|
+
|
|
1169
|
+
/ready
|
|
1170
|
+
|
|
1171
|
+
检查:
|
|
1172
|
+
|
|
1173
|
+
Canonical Forge Runtime
|
|
1174
|
+
State Store
|
|
1175
|
+
Worker Pool
|
|
1176
|
+
Repository Registry
|
|
1177
|
+
/repos/<repoId>/health
|
|
1178
|
+
|
|
1179
|
+
检查单个仓库状态。
|
|
1180
|
+
|
|
1181
|
+
十一、验证与发布架构
|
|
1182
|
+
1. 分层验证
|
|
1183
|
+
修改过程中
|
|
1184
|
+
|
|
1185
|
+
运行最小专项检查。
|
|
1186
|
+
|
|
1187
|
+
Task 完成前
|
|
1188
|
+
|
|
1189
|
+
运行 Task 声明的 Checks。
|
|
1190
|
+
|
|
1191
|
+
Issue 完成前
|
|
1192
|
+
|
|
1193
|
+
运行集成测试。
|
|
1194
|
+
|
|
1195
|
+
发布前
|
|
1196
|
+
|
|
1197
|
+
运行完整 Release Gate。
|
|
1198
|
+
|
|
1199
|
+
不能每个小修改都跑完整发布检查,也不能只因为局部测试通过就认为可发布。
|
|
1200
|
+
|
|
1201
|
+
2. 发布屏障
|
|
1202
|
+
|
|
1203
|
+
进入 Release Candidate 前,Repo Actor 创建:
|
|
1204
|
+
|
|
1205
|
+
release:<repoId>
|
|
1206
|
+
|
|
1207
|
+
独占 Lease。
|
|
1208
|
+
|
|
1209
|
+
Release Freeze 后:
|
|
1210
|
+
|
|
1211
|
+
不接受新的写入任务
|
|
1212
|
+
Schedule 只能执行只读巡检
|
|
1213
|
+
等待当前写入任务完成
|
|
1214
|
+
等待 Integration Queue 清空
|
|
1215
|
+
|
|
1216
|
+
发布条件:
|
|
1217
|
+
|
|
1218
|
+
工作区干净
|
|
1219
|
+
无活跃写入 Job
|
|
1220
|
+
无活跃 Agent Run
|
|
1221
|
+
无未集成 Worktree
|
|
1222
|
+
无脏 Edit Session
|
|
1223
|
+
无 Orphan Job
|
|
1224
|
+
所有 Required Task 完成
|
|
1225
|
+
验证绑定当前 HEAD
|
|
1226
|
+
Registry Remote 与 Git Origin 一致
|
|
1227
|
+
GitHub Mapping 一致
|
|
1228
|
+
MCP / Controller / Worker 健康
|
|
1229
|
+
Package Metadata 正确
|
|
1230
|
+
Public Export 正确
|
|
1231
|
+
Release Check 全部通过
|
|
1232
|
+
|
|
1233
|
+
然后输出:
|
|
1234
|
+
|
|
1235
|
+
release_ready
|
|
1236
|
+
|
|
1237
|
+
Push、Tag、Publish 仍需用户明确授权。
|
|
1238
|
+
|
|
1239
|
+
十二、Agent 设计的“艺术”
|
|
1240
|
+
|
|
1241
|
+
真正好的 Agent 系统不是让 Agent 尽可能自由,而是:
|
|
1242
|
+
|
|
1243
|
+
把判断留给最擅长判断的角色,把确定性操作交给程序,把风险留在清晰边界内。
|
|
1244
|
+
|
|
1245
|
+
这里有四个关键平衡。
|
|
1246
|
+
|
|
1247
|
+
1. 不要把 Controller 变成 Worker
|
|
1248
|
+
|
|
1249
|
+
Controller 应该:
|
|
1250
|
+
|
|
1251
|
+
看全局
|
|
1252
|
+
做权衡
|
|
1253
|
+
分派
|
|
1254
|
+
审核
|
|
1255
|
+
|
|
1256
|
+
它不应该长时间占用在一次编译或写代码中。
|
|
1257
|
+
|
|
1258
|
+
2. 不要让 Worker 决定自己是否成功
|
|
1259
|
+
|
|
1260
|
+
Worker 可以报告:
|
|
1261
|
+
|
|
1262
|
+
implementation complete
|
|
1263
|
+
|
|
1264
|
+
但最终是否成功应由:
|
|
1265
|
+
|
|
1266
|
+
Check
|
|
1267
|
+
Acceptance Criteria
|
|
1268
|
+
Integration Result
|
|
1269
|
+
Controller Review
|
|
1270
|
+
|
|
1271
|
+
共同决定。
|
|
1272
|
+
|
|
1273
|
+
3. 不要为每个任务增加独立 Verifier
|
|
1274
|
+
|
|
1275
|
+
独立 Verifier 不是越多越好。
|
|
1276
|
+
|
|
1277
|
+
只在以下情况使用:
|
|
1278
|
+
|
|
1279
|
+
高风险
|
|
1280
|
+
业务逻辑复杂
|
|
1281
|
+
安全敏感
|
|
1282
|
+
实现者自测偏差明显
|
|
1283
|
+
|
|
1284
|
+
Verifier 的 Rubric 必须等于 Task Acceptance Criteria。
|
|
1285
|
+
|
|
1286
|
+
4. 自动化的目标不是“永远做事”
|
|
1287
|
+
|
|
1288
|
+
好的循环会经常返回:
|
|
1289
|
+
|
|
1290
|
+
nothing_to_do
|
|
1291
|
+
|
|
1292
|
+
它应该节制、安静、可暂停。
|
|
1293
|
+
|
|
1294
|
+
自动化的价值是:
|
|
1295
|
+
|
|
1296
|
+
在正确时间发现正确问题,而不是不断制造工作。
|
|
1297
|
+
|
|
1298
|
+
十三、推荐目录重构
|
|
1299
|
+
|
|
1300
|
+
后续可逐步收敛成:
|
|
1301
|
+
|
|
1302
|
+
src/runtime/
|
|
1303
|
+
gateway/
|
|
1304
|
+
mcp/
|
|
1305
|
+
http/
|
|
1306
|
+
auth/
|
|
1307
|
+
|
|
1308
|
+
control-plane/
|
|
1309
|
+
global-scheduler/
|
|
1310
|
+
repo-actor/
|
|
1311
|
+
portfolio/
|
|
1312
|
+
governance/
|
|
1313
|
+
|
|
1314
|
+
workflow/
|
|
1315
|
+
issues/
|
|
1316
|
+
tasks/
|
|
1317
|
+
schedules/
|
|
1318
|
+
occurrences/
|
|
1319
|
+
|
|
1320
|
+
execution/
|
|
1321
|
+
jobs/
|
|
1322
|
+
runs/
|
|
1323
|
+
workers/
|
|
1324
|
+
agents/
|
|
1325
|
+
commands/
|
|
1326
|
+
checks/
|
|
1327
|
+
|
|
1328
|
+
resources/
|
|
1329
|
+
claims/
|
|
1330
|
+
leases/
|
|
1331
|
+
workspaces/
|
|
1332
|
+
worktrees/
|
|
1333
|
+
integration/
|
|
1334
|
+
|
|
1335
|
+
evidence/
|
|
1336
|
+
checks/
|
|
1337
|
+
diffs/
|
|
1338
|
+
artifacts/
|
|
1339
|
+
verification/
|
|
1340
|
+
release/
|
|
1341
|
+
|
|
1342
|
+
repositories/
|
|
1343
|
+
registry/
|
|
1344
|
+
identity/
|
|
1345
|
+
storage/
|
|
1346
|
+
github/
|
|
1347
|
+
|
|
1348
|
+
projections/
|
|
1349
|
+
snapshots/
|
|
1350
|
+
indexes/
|
|
1351
|
+
dashboard/
|
|
1352
|
+
|
|
1353
|
+
src/cli/mcp/tools.ts 当前超过四千行,已经承担过多职责。后续工具文件只应负责:
|
|
1354
|
+
|
|
1355
|
+
schema
|
|
1356
|
+
-> command conversion
|
|
1357
|
+
-> service call
|
|
1358
|
+
-> compact response
|
|
1359
|
+
|
|
1360
|
+
不能继续承载业务实现。
|
|
1361
|
+
|
|
1362
|
+
十四、架构文档治理
|
|
1363
|
+
|
|
1364
|
+
当前文档存在明显代际漂移。
|
|
1365
|
+
|
|
1366
|
+
例如:
|
|
1367
|
+
|
|
1368
|
+
docs/architecture/index.md
|
|
1369
|
+
|
|
1370
|
+
仍写着 Forge 不是 MCP Server,但当前产品已经包含完整 MCP Controller Runtime。
|
|
1371
|
+
|
|
1372
|
+
另外 V5、V6、V7、V8 文档中存在:
|
|
1373
|
+
|
|
1374
|
+
手工集成与自动集成并存
|
|
1375
|
+
Approval Queue 与无 Approval Queue 并存
|
|
1376
|
+
Focus 是否是执行锁的表述不一致
|
|
1377
|
+
Worktree 默认策略不一致
|
|
1378
|
+
|
|
1379
|
+
后续应明确:
|
|
1380
|
+
|
|
1381
|
+
docs/architecture/current/
|
|
1382
|
+
|
|
1383
|
+
作为唯一事实源。
|
|
1384
|
+
|
|
1385
|
+
旧文档统一标记:
|
|
1386
|
+
|
|
1387
|
+
Historical Design
|
|
1388
|
+
Not Runtime Authority
|
|
1389
|
+
|
|
1390
|
+
建议建立以下当前文档:
|
|
1391
|
+
|
|
1392
|
+
architecture-overview.md
|
|
1393
|
+
entity-model.md
|
|
1394
|
+
job-and-run-lifecycle.md
|
|
1395
|
+
scheduler-and-resource-claims.md
|
|
1396
|
+
multi-repository-execution.md
|
|
1397
|
+
workspace-and-worktree-policy.md
|
|
1398
|
+
automation-and-schedule-engine.md
|
|
1399
|
+
verification-and-release-gates.md
|
|
1400
|
+
failure-recovery.md
|
|
1401
|
+
architecture-invariants.md
|
|
1402
|
+
|
|
1403
|
+
所有代码改动如果违反这些文档,必须先创建 ADR。
|
|
1404
|
+
|
|
1405
|
+
十五、实施顺序
|
|
1406
|
+
P0:先稳定系统
|
|
1407
|
+
修复 502
|
|
1408
|
+
禁止 MCP 直接执行长任务
|
|
1409
|
+
Repository Command Job 化
|
|
1410
|
+
Verify Edit Session Job 化
|
|
1411
|
+
Gateway 与 Worker 解耦
|
|
1412
|
+
状态接口保证非阻塞
|
|
1413
|
+
|
|
1414
|
+
这一步未完成前,不应增加循环执行功能。
|
|
1415
|
+
|
|
1416
|
+
P1:统一执行模型
|
|
1417
|
+
建立统一 Execution Job
|
|
1418
|
+
规范 Job 与 Run 的关系
|
|
1419
|
+
所有写操作支持 Request ID
|
|
1420
|
+
持久化 Active Index
|
|
1421
|
+
加入 Lease 与 Fencing Token
|
|
1422
|
+
统一终态和恢复语义
|
|
1423
|
+
P2:Repo Actor 与资源调度
|
|
1424
|
+
每仓库单独邮箱
|
|
1425
|
+
Resource Claim
|
|
1426
|
+
Workspace 单写者
|
|
1427
|
+
Worktree 并发
|
|
1428
|
+
Integration Queue
|
|
1429
|
+
Heavy Check Queue
|
|
1430
|
+
Unknown Scope 保守冲突
|
|
1431
|
+
P3:多仓库调度
|
|
1432
|
+
全局 Worker Pool
|
|
1433
|
+
每仓库配额
|
|
1434
|
+
公平队列
|
|
1435
|
+
Portfolio DAG
|
|
1436
|
+
跨仓库 Saga
|
|
1437
|
+
单仓库故障隔离
|
|
1438
|
+
P4:Schedule Engine
|
|
1439
|
+
Schedule
|
|
1440
|
+
Occurrence
|
|
1441
|
+
Triage Decision
|
|
1442
|
+
Budget
|
|
1443
|
+
Backoff
|
|
1444
|
+
Dedupe
|
|
1445
|
+
Stop Condition
|
|
1446
|
+
Candidate Requirement
|
|
1447
|
+
Shadow Mode
|
|
1448
|
+
|
|
1449
|
+
Schedule 应先运行两周 Shadow Mode,只记录“本来会做什么”,不自动修改代码。确认决策准确后再开启执行。
|
|
1450
|
+
|
|
1451
|
+
P5:发布门
|
|
1452
|
+
Release Freeze
|
|
1453
|
+
Exact Revision Evidence
|
|
1454
|
+
Full Gate
|
|
1455
|
+
Release Manifest
|
|
1456
|
+
Human Authorization
|
|
1457
|
+
Push/Publish
|
|
1458
|
+
十六、以后执行任务的标准流程
|
|
1459
|
+
|
|
1460
|
+
以后无论是 ChatGPT、Claude 还是 Codex,都应按照下面流程执行:
|
|
1461
|
+
|
|
1462
|
+
1. Resolve Repository
|
|
1463
|
+
2. Read compact snapshot
|
|
1464
|
+
3. Classify work mode
|
|
1465
|
+
4. Create or select Issue/Task
|
|
1466
|
+
5. Declare scope and resources
|
|
1467
|
+
6. Persist requestId
|
|
1468
|
+
7. Repo Actor schedules work
|
|
1469
|
+
8. Return Job ID immediately
|
|
1470
|
+
9. Worker executes
|
|
1471
|
+
10. Persist heartbeat and events
|
|
1472
|
+
11. Reconcile terminal state
|
|
1473
|
+
12. Review Diff
|
|
1474
|
+
13. Integrate serially
|
|
1475
|
+
14. Verify exact Revision
|
|
1476
|
+
15. Accept Task
|
|
1477
|
+
16. Evaluate next dependency
|
|
1478
|
+
17. Enter release gate or stop
|
|
1479
|
+
|
|
1480
|
+
任何 Agent 都不允许跳过:
|
|
1481
|
+
|
|
1482
|
+
Scope
|
|
1483
|
+
Resource Claim
|
|
1484
|
+
Persistent Job
|
|
1485
|
+
Evidence
|
|
1486
|
+
Verification
|
|
1487
|
+
最终设计结论
|
|
1488
|
+
|
|
1489
|
+
这套系统不应该继续被定义为“ChatGPT 调用本地 Agent 的 MCP”。
|
|
1490
|
+
|
|
1491
|
+
它更准确的定位应该是:
|
|
1492
|
+
|
|
1493
|
+
一个以仓库为自治边界、以上层 AI 为决策者、以持久 Job 为执行协议、以证据为完成标准、支持多个项目并行和周期自治的 Agent Engineering Control Plane。
|
|
1494
|
+
|
|
1495
|
+
最关键的三个设计选择是:
|
|
1496
|
+
|
|
1497
|
+
Gateway 永远保持轻薄,所有长任务 Job 化。
|
|
1498
|
+
每个仓库由独立 Repo Actor 自治,不使用跨仓库粗粒度锁。
|
|
1499
|
+
循环任务是一次次有边界的 Occurrence,而不是永不结束的 Agent。
|
|
1500
|
+
|
|
1501
|
+
这三条落实后,502、任务重复、冲突误判、状态失真、多项目互相拖累和循环失控,才会从架构层面得到解决,而不是继续靠补丁维持。
|