@moretea-labs/forge 1.8.1 → 1.8.2
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 +5 -2
- package/CHANGELOG.md +20 -0
- package/README.en.md +24 -3
- package/README.md +10 -6
- package/README.zh-CN.md +5 -3
- package/THIRD_PARTY_NOTICES.md +1 -2
- package/adapters/chatgpt/browser-delivery-runtime.ts +5 -3
- package/adapters/chatgpt/provider-delivery.ts +1 -1
- package/adapters/chatgpt/work-conversation-binding-store.ts +20 -1
- package/adapters/computer/chatgpt-extension-target.ts +295 -50
- package/adapters/computer/chrome-extension/background.js +227 -71
- package/adapters/computer/chrome-extension/content.js +181 -157
- package/adapters/computer/chrome-extension/manifest.json +3 -1
- package/adapters/computer/desktop-operator-provider.ts +18 -6
- package/adapters/computer/interaction-target-authority.ts +39 -9
- package/adapters/mcp/access-mode.ts +18 -39
- package/adapters/mcp/auth.ts +2 -6
- package/adapters/mcp/instructions.ts +2 -2
- package/adapters/mcp/multi-repository.ts +7 -28
- package/adapters/mcp/runtime-gateway/context-adapter.ts +79 -40
- package/adapters/mcp/runtime-gateway/context-pack-sidecar.ts +7 -15
- package/adapters/mcp/runtime-gateway/execution-tools.ts +7 -13
- package/adapters/mcp/runtime-gateway/plugin-adapter.ts +16 -3
- package/adapters/mcp/runtime-gateway/process-tools.ts +3 -21
- package/adapters/mcp/runtime-gateway/router.ts +3 -5
- package/adapters/mcp/runtime-gateway/routing-policy.ts +17 -10
- package/adapters/mcp/runtime-gateway/runtime-observation-adapter.ts +1 -1
- package/adapters/mcp/runtime-gateway/runtime-tool-definitions.ts +14 -9
- package/adapters/mcp/runtime-gateway/runtime-tools.ts +1 -5
- package/adapters/mcp/runtime-gateway/scheduler-adapter.ts +36 -1
- package/adapters/mcp/runtime-gateway/status-inbox-adapter.ts +58 -4
- package/adapters/mcp/runtime-gateway/typescript-navigation-sidecar.ts +7 -3
- package/adapters/mcp/runtime-gateway/work-adapter.ts +16 -16
- package/adapters/mcp/runtime-gateway/work-input-wire-migration.ts +0 -17
- package/adapters/mcp/runtime-gateway/work-semantic-operations.ts +69 -12
- package/adapters/mcp/runtime-gateway/workflow-supervisor-adapter.ts +26 -2
- package/adapters/mcp/server.ts +24 -3
- package/adapters/mcp/setup.ts +4 -10
- package/adapters/mcp/tool-mapping/access-tools.ts +0 -6
- package/adapters/mcp/tool-mapping/legacy-tool-service.ts +672 -2935
- package/adapters/mcp/tool-mapping/post-finalize-work-attribution.ts +1 -1
- package/adapters/mcp/tool-mapping/repository-tools.ts +52 -86
- package/adapters/mcp/toolset-names.ts +11 -42
- package/adapters/mcp/toolset.ts +16 -90
- package/{src/cli → adapters}/mcp/transports/AGENTS.md +5 -5
- package/{src/cli → adapters}/mcp/transports/CLAUDE.md +5 -5
- package/adapters/mcp/transports/http-observation.ts +18 -6
- package/adapters/mcp/transports/http-post-lifecycle.ts +19 -0
- package/adapters/mcp/transports/http.ts +54 -14
- package/adapters/mcp/types.ts +0 -6
- package/assets/hooks/lib/session-state.sh +0 -38
- package/assets/hooks/post-bash.sh +1 -1
- package/assets/hooks/post-tool-observer.sh +0 -5
- package/assets/hooks/prompt-guard.sh +0 -55
- package/assets/partials/04-project-structure.partial.md +1 -1
- package/assets/partials/07-footer.partial.md +1 -1
- package/assets/partials-agents/02-operating-mode.partial.md +1 -1
- package/assets/partials-agents/08-deep-docs.partial.md +1 -1
- package/assets/reference-configs/agentic-development-flow.md +1 -1
- package/assets/reference-configs/external-tooling.md +0 -76
- package/assets/reference-configs/release-deploy.md +1 -1
- package/assets/templates/helpers/architecture-queue.sh +1 -1
- package/assets/templates/helpers/check-agent-tooling.sh +1 -327
- package/assets/templates/helpers/check-task-workflow.sh +1 -1
- package/assets/templates/helpers/ensure-task-workflow.sh +0 -14
- package/assets/templates/helpers/migrate-project-template.sh +2 -2
- package/assets/workflow-contract.v1.json +0 -2
- package/docs/README.md +5 -2
- package/docs/architecture/CURRENT.md +114 -30
- package/docs/architecture/decisions/20260904-ios-device-migration-baseline.md +42 -0
- package/docs/architecture/decisions/20260918-stable-candidate-release-lifecycle.md +15 -2
- package/docs/architecture/decisions/20260924-thin-semantic-working-context.md +4 -2
- package/docs/architecture/decisions/20261001-supervisor-turn-authority.md +109 -4
- package/docs/architecture/decisions/20261009-exact-code-context-discovery.md +19 -0
- package/docs/architecture/decisions/20261009-generated-xcode-cache-retention.md +37 -0
- package/docs/architecture/decisions/20261011-autonomous-continuation-convergence.md +597 -0
- package/docs/architecture/decisions/20261017-edit-session-finalization-reconciliation.md +17 -0
- package/docs/architecture/decisions/20261019-retire-host-skills.md +16 -0
- package/docs/architecture/diagrams/agentic-dev-plugin-architecture.html +1 -1
- package/docs/architecture/domains/public-surface.md +3 -5
- package/docs/architecture/domains/verification.md +5 -5
- package/docs/architecture/modules/controller-runtime/transport-lifecycle.md +2 -2
- package/docs/architecture/requests/2026-09-04-computer-plugin-workflow-taxonomy.md +4 -4
- package/docs/architecture/reviews/20261015-code-search-runtime-acceptance.md +75 -0
- package/docs/forge-plugin-management.md +14 -2
- package/docs/operations/controller-browser-plugin.md +23 -0
- package/docs/operations/features.md +6 -7
- package/docs/operations/features.zh-CN.md +1 -1
- package/docs/operations/github-repository.md +4 -4
- package/docs/operations/github-semantic-release-projection.md +20 -0
- package/docs/operations/homebrew.md +2 -2
- package/docs/operations/mcp-tool-exposure.md +13 -54
- package/docs/operations/runtime-performance-diagnostics.md +8 -0
- package/docs/operations/standalone-disaster-recovery.md +1 -1
- package/docs/tutorials/01-install-and-start.zh-CN.md +1 -1
- package/docs/tutorials/03-first-repository-task.md +2 -0
- package/docs/wiki/Computer-and-Plugins.md +78 -0
- package/docs/wiki/Computer-and-Plugins.zh-CN.md +88 -0
- package/docs/wiki/Home.md +16 -2
- package/docs/wiki/Implementation.md +24 -12
- package/docs/wiki/Installation.md +28 -32
- package/docs/wiki/Integrations.md +4 -0
- package/docs/wiki/Quick-Start.md +35 -22
- package/docs/wiki/Releases-and-Upgrades.md +15 -25
- package/docs/wiki/_Sidebar.md +5 -1
- package/package.json +1 -12
- package/packages/kernel/controller/infrastructure/controller-session-store.ts +63 -38
- package/packages/kernel/identity/infrastructure/activity-projection-store.ts +10 -0
- package/packages/kernel/scheduler/application/eligibility.ts +4 -1
- package/packages/kernel/scheduler/infrastructure/schedule-store.ts +13 -10
- package/packages/kernel/work/application/work-service.ts +1 -0
- package/packages/kernel/work/domain/repository-completion-receipt.ts +1 -1
- package/packages/kernel/work/domain/state-machine.ts +9 -2
- package/packages/kernel/work/infrastructure/work-contract-store.ts +28 -1
- package/packages/plugin-runtime/browser/provider-registry.ts +12 -36
- package/packages/plugin-runtime/computer/conversation-target.ts +17 -7
- package/scripts/assemble-template.ts +11 -72
- package/scripts/check-mcp-compatibility.ts +55 -74
- package/scripts/check-package-identity.mjs +0 -5
- package/scripts/check-runtime-architecture.mjs +305 -28
- package/scripts/init-project.sh +0 -46
- package/scripts/install-ios-hid-toolchain.sh +60 -0
- package/scripts/install-standalone-recovery.ts +1 -1
- package/scripts/lib/project-init-lib.sh +3 -3
- package/scripts/migrate-windows-wsl-controller-home.ts +2 -0
- package/scripts/open-source-audit-allowlist.txt +0 -1
- package/scripts/run-governed-gate.ts +2 -0
- package/scripts/smoke-ios-physical-device.ts +38 -10
- package/scripts/smoke-mcp-http-runtime.ts +7 -8
- package/scripts/smoke-mcp-tool-surface.ts +27 -41
- package/scripts/smoke-workflow-supervisor-chrome-adapter.ts +6 -3
- package/scripts/sync-generated-authority.mjs +0 -1
- package/src/cli/agent-jobs/executor-health.ts +1 -1
- package/src/cli/agent-jobs/integration.ts +2 -2
- package/src/cli/chatgpt-browser/file-policy.ts +2 -2
- package/src/cli/commands/doctor.ts +1 -143
- package/src/cli/commands/global-runtime.ts +3 -196
- package/src/cli/commands/init-hook.ts +6 -23
- package/src/cli/commands/init.ts +3 -252
- package/src/cli/commands/mcp.ts +0 -5
- package/src/cli/commands/prompt-guard-decision.ts +0 -2
- package/src/cli/commands/recovery.ts +2 -14
- package/src/cli/commands/repository.ts +17 -1
- package/src/cli/commands/setup-execution.ts +41 -0
- package/src/cli/controller/completion-orchestrator.ts +1 -1
- package/src/cli/controller/composite-operations.ts +1 -1
- package/src/cli/controller/context/instruction-context.ts +1 -1
- package/src/cli/controller/context/known-paths.ts +2 -2
- package/src/cli/controller/context/query-planning.ts +11 -4
- package/src/cli/controller/context/rule-resolution.ts +2 -2
- package/src/cli/controller/context/source-materializer.ts +2 -2
- package/src/cli/controller/context/structural-provider.ts +84 -0
- package/src/cli/controller/context/structural.ts +6 -6
- package/src/cli/controller/context/types.ts +8 -9
- package/src/cli/controller/context-pack.ts +97 -76
- package/src/cli/controller/operational-plan.ts +1 -1
- package/src/cli/controller/systemd-user.ts +4 -10
- package/src/cli/editing/edit-session.ts +17 -5
- package/src/cli/github/github.ts +4 -4
- package/src/cli/github/semantic-projection.ts +174 -0
- package/src/cli/hook/prompt-intents.ts +0 -9
- package/src/cli/index.ts +1 -43
- package/src/cli/local-bridge/connector-freshness.ts +1 -12
- package/src/cli/local-bridge/console-automations.ts +1 -1
- package/src/cli/local-bridge/console-view-models.ts +1 -1
- package/src/cli/local-bridge/facade-api.ts +0 -2
- package/src/cli/repositories/command-classifier.ts +0 -9
- package/src/cli/repositories/command-scope.ts +2 -2
- package/src/cli/repositories/locks.ts +20 -0
- package/src/cli/repositories/registry.ts +2 -1
- package/src/cli/repositories/safe-patch.ts +2 -12
- package/src/cli/repositories/structured-git.ts +39 -3
- package/src/cli/repository/inspector.ts +185 -343
- package/src/effects/process-runner.ts +17 -1
- package/src/runtime/context/generic-lsp-provider.ts +1 -1
- package/src/runtime/context/semantic-navigation-contract.ts +7 -0
- package/src/runtime/context/semantic-navigation.ts +1 -1
- package/src/runtime/control-plane/cleanup-artifact-retention.ts +4 -4
- package/src/runtime/control-plane/execution/work-delivery-service.ts +150 -31
- package/src/runtime/control-plane/execution/work-handle-authority.ts +12 -4
- package/src/runtime/control-plane/execution/work-handle-store.ts +53 -1
- package/src/runtime/control-plane/execution/work-operation-service.ts +20 -10
- package/src/runtime/control-plane/execution/work-preparation-service.ts +108 -4
- package/src/runtime/control-plane/execution/work-process-evidence.ts +2 -2
- package/src/runtime/control-plane/execution/work-terminal-cleanup.ts +28 -13
- package/src/runtime/control-plane/execution/work-validation-reconciler.ts +5 -1
- package/src/runtime/control-plane/execution/work-verification-snapshot.ts +1 -1
- package/src/runtime/control-plane/facade/capability-registry.ts +2 -0
- package/src/runtime/control-plane/facade/work-continuation.ts +1 -1
- package/src/runtime/control-plane/generated-cache-retention.ts +114 -63
- package/src/runtime/control-plane/global-scheduler/maintenance.ts +20 -8
- package/src/runtime/control-plane/global-scheduler/reconciliation.ts +1 -11
- package/src/runtime/control-plane/governance/external-effects.ts +1 -1
- package/src/runtime/control-plane/launcher/chatgpt-work-continuation.ts +1 -0
- package/src/runtime/control-plane/runtime-cleanup.ts +12 -93
- package/src/runtime/evidence/sensitive-output.ts +22 -2
- package/src/runtime/execution/jobs/child-reference.ts +11 -0
- package/src/runtime/execution/jobs/receipt-recovery.ts +1 -11
- package/src/runtime/execution/process-runtime/command-facade.ts +3 -3
- package/src/runtime/execution/process-runtime/runtime.ts +20 -16
- package/src/runtime/execution/thin-harness/execution-router.ts +16 -16
- package/src/runtime/execution/thin-harness/fast-executor.ts +2 -2
- package/src/runtime/execution/thin-harness/search-worker.ts +2 -2
- package/src/runtime/execution/workers/executor.ts +1 -2
- package/src/runtime/maintenance/cleanup.ts +41 -5
- package/src/runtime/plugins/action-application.ts +12 -1
- package/src/runtime/plugins/app-store-connect-adapter.ts +252 -4
- package/src/runtime/plugins/browser-adapter.ts +381 -313
- package/src/runtime/plugins/browser-macos-bridge.ts +114 -112
- package/src/runtime/plugins/browser-manifest-surface.ts +2 -1
- package/src/runtime/plugins/browser-registration.ts +2 -0
- package/src/runtime/plugins/browser-runtime.ts +26 -35
- package/src/runtime/plugins/computer-chatgpt-browser-adapter-installer.ts +11 -2
- package/src/runtime/plugins/computer-registration.ts +76 -9
- package/src/runtime/plugins/github-adapter.ts +30 -3
- package/src/runtime/plugins/gmail-adapter.ts +166 -1
- package/src/runtime/plugins/google-shared.ts +10 -5
- package/src/runtime/plugins/ios/remote-xpc-hid.ts +70 -30
- package/src/runtime/plugins/ios-adapter.ts +45 -40
- package/src/runtime/plugins/ios-agent-device.ts +54 -4
- package/src/runtime/plugins/ios-device-ownership.ts +103 -0
- package/src/runtime/plugins/ios-physical-device.ts +497 -79
- package/src/runtime/plugins/local-system-adapter.ts +1 -99
- package/src/runtime/plugins/store.ts +80 -7
- package/src/runtime/plugins/types.ts +4 -0
- package/src/runtime/projections/git-status-sampler.ts +2 -19
- package/src/runtime/recovery/actions.ts +1 -1
- package/src/runtime/recovery/lifecycle-inventory.ts +1 -11
- package/src/runtime/recovery/probe.ts +2 -2
- package/src/runtime/release/release-coordinator.ts +20 -4
- package/src/runtime/root/controller-progression-composition.ts +67 -5
- package/src/runtime/root/package-connector-service.ts +123 -11
- package/src/runtime/root/package-runtime-release.ts +6 -18
- package/src/runtime/root/package-runtime-service.ts +7 -13
- package/src/runtime/root/release-execution-canary.ts +18 -5
- package/src/runtime/root/release-manifest.ts +0 -34
- package/src/runtime/root/release-materialize.ts +0 -78
- package/src/runtime/root/runtime.ts +1 -2
- package/src/runtime/root/scheduled-controller-composition.ts +2 -1
- package/src/runtime/root/service.ts +90 -11
- package/src/runtime/root/types.ts +0 -6
- package/src/runtime/root/workflow-supervisor-composition.ts +207 -19
- package/src/runtime/root/workflow-supervisor-runtime.ts +365 -10
- package/src/runtime/safe-tooling/google-credential-store.ts +1 -11
- package/src/runtime/safe-tooling/ios-development.ts +22 -8
- package/src/runtime/safe-tooling/job-summary.ts +1 -1
- package/src/runtime/safe-tooling/workspace-auth.ts +4 -1
- package/src/runtime/shared/atomic-text-file.ts +21 -0
- package/src/runtime/shared/json-files.ts +8 -3
- package/src/runtime/standalone-recovery/core.ts +189 -174
- package/src/runtime/standalone-recovery/entry.ts +62 -30
- package/src/runtime/standalone-recovery/operation-lock.ts +11 -1
- package/src/runtime/workflow/schedules/chatgpt-automation-migration.ts +1 -0
- package/src/runtime/workflow/schedules/engine.ts +36 -14
- package/src/runtime/workflow/schedules/pending-activation.ts +11 -4
- package/src/runtime/workflow/schedules/work-continuation.ts +51 -6
- package/supervisor/client.ts +31 -14
- package/supervisor/control-plane.ts +210 -115
- package/supervisor/forge-validators.ts +88 -21
- package/supervisor/native-browser-adapter.ts +393 -28
- package/supervisor/native-messaging/host.ts +21 -2
- package/supervisor/protocol.ts +74 -26
- package/supervisor/server.ts +16 -8
- package/supervisor/store.ts +476 -57
- package/supervisor/types.ts +19 -13
- package/SKILL.md +0 -427
- package/adapters/computer/chatgpt-target-router.ts +0 -103
- package/adapters/mcp/runtime-gateway/automation-receipt-adapter.ts +0 -87
- package/adapters/mcp/runtime-gateway/work-validation-reconciler.ts +0 -1
- package/adapters/mcp/toolset-selection.ts +0 -41
- package/agents/openai.yaml +0 -4
- package/assets/skill-hooks.json +0 -41
- package/assets/skill-version.json +0 -189
- package/assets/skills/claude-review/SKILL.md +0 -231
- package/assets/skills/codex-review/SKILL.md +0 -103
- package/assets/templates/helpers/check-skill-version.ts +0 -193
- package/scripts/check-skill-version.ts +0 -5
- package/scripts/ensure-codegraph.sh +0 -16
- package/scripts/run-skill-hook.ts +0 -244
- package/scripts/sync-codex-installed-copies.sh +0 -182
- package/src/cli/commands/tools.ts +0 -167
- package/src/cli/mcp/access-mode.ts +0 -2
- package/src/cli/mcp/access-tools.ts +0 -2
- package/src/cli/mcp/audit.ts +0 -2
- package/src/cli/mcp/auth.ts +0 -2
- package/src/cli/mcp/instructions.ts +0 -2
- package/src/cli/mcp/legacy-context.ts +0 -2
- package/src/cli/mcp/legacy-tool-service.ts +0 -2
- package/src/cli/mcp/multi-repository.ts +0 -2
- package/src/cli/mcp/oauth.ts +0 -2
- package/src/cli/mcp/openai-secure-tunnel.ts +0 -2
- package/src/cli/mcp/paths.ts +0 -2
- package/src/cli/mcp/policy.ts +0 -2
- package/src/cli/mcp/post-finalize-work-attribution.ts +0 -2
- package/src/cli/mcp/proxy-env.ts +0 -2
- package/src/cli/mcp/readiness-projection.ts +0 -2
- package/src/cli/mcp/redaction.ts +0 -2
- package/src/cli/mcp/repo.ts +0 -2
- package/src/cli/mcp/repository-tools.ts +0 -2
- package/src/cli/mcp/server.ts +0 -2
- package/src/cli/mcp/setup.ts +0 -2
- package/src/cli/mcp/tool-capability-cache.ts +0 -2
- package/src/cli/mcp/tool-contract.ts +0 -2
- package/src/cli/mcp/tools.ts +0 -2
- package/src/cli/mcp/toolset-names.ts +0 -2
- package/src/cli/mcp/toolset-selection.ts +0 -2
- package/src/cli/mcp/toolset.ts +0 -2
- package/src/cli/mcp/transports/http.ts +0 -2
- package/src/cli/mcp/transports/session-registry.ts +0 -2
- package/src/cli/mcp/transports/stdio.ts +0 -2
- package/src/cli/mcp/types.ts +0 -2
- package/src/cli/mcp/umbrella-tools.ts +0 -2
- package/src/cli/tools/codegraph.ts +0 -695
- package/src/core/adoption/helper-wrapper-plan.ts +0 -159
- package/src/runtime/context/codegraph-cache-boundary.ts +0 -255
- package/src/runtime/context/codegraph-read-provider.ts +0 -611
- package/src/runtime/context/codegraph-sidecar.cjs +0 -248
- package/src/runtime/control-plane/codegraph-cache-retention.ts +0 -164
- package/src/runtime/gateway/mcp/execution-tools.ts +0 -2
- package/src/runtime/gateway/mcp/legacy-ios-tool-adapter.ts +0 -2
- package/src/runtime/gateway/mcp/persisted-check-process.ts +0 -2
- package/src/runtime/gateway/mcp/process-tools.ts +0 -2
- package/src/runtime/gateway/mcp/router.ts +0 -2
- package/src/runtime/gateway/mcp/runtime-tool-definitions.ts +0 -2
- package/src/runtime/gateway/mcp/runtime-tools.ts +0 -2
- package/src/runtime/gateway/mcp/work-validation-reconciler.ts +0 -2
- package/src/runtime/plugins/browser-provider-registry.ts +0 -2
- package/src/runtime/plugins/computer-chatgpt-macos-target.ts +0 -891
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Express } from 'express';
|
|
1
|
+
import type { Express, Response } from 'express';
|
|
2
2
|
import { NodeStreamableHTTPServerTransport } from '@modelcontextprotocol/node';
|
|
3
3
|
import { createMcpToolContext } from '../server';
|
|
4
4
|
import { loadMcpServiceRuntimeState, type McpHttpAuthMode } from '../auth';
|
|
@@ -20,13 +20,14 @@ import {
|
|
|
20
20
|
repositoryIdentity,
|
|
21
21
|
} from '../../../src/cli/controller/runtime-config';
|
|
22
22
|
import { McpSessionRegistry } from './session-registry';
|
|
23
|
+
import { reconcileFinishedMcpPosts } from './http-post-lifecycle';
|
|
23
24
|
|
|
24
25
|
type McpToolContext = ReturnType<typeof createMcpToolContext>;
|
|
25
26
|
type HttpSessionRegistry = McpSessionRegistry<NodeStreamableHTTPServerTransport, McpToolContext>;
|
|
26
27
|
|
|
27
28
|
interface McpRuntimeStats {
|
|
28
29
|
initializing: number;
|
|
29
|
-
|
|
30
|
+
activePostStartedAt: Map<Response, number>;
|
|
30
31
|
rejectedOverload: number;
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -190,6 +191,14 @@ export function registerMcpHttpObservationRoutes(input: McpHttpObservationRouteO
|
|
|
190
191
|
if (health?.runtimeToolSurfaceFingerprint) res.setHeader('x-forge-runtime-tool-surface-fingerprint', health.runtimeToolSurfaceFingerprint);
|
|
191
192
|
if (health?.toolSurfaceFingerprint) res.setHeader('x-forge-tool-surface-fingerprint', health.toolSurfaceFingerprint);
|
|
192
193
|
const sessionSnapshot = sessionRegistry.snapshot();
|
|
194
|
+
// Legacy session age excludes modern stateless POSTs. The same response-
|
|
195
|
+
// owned admission map backs both capacity and this diagnostic; no second
|
|
196
|
+
// activity counter or release authority is introduced.
|
|
197
|
+
reconcileFinishedMcpPosts(runtimeStats.activePostStartedAt);
|
|
198
|
+
const oldestActivePostAt = runtimeStats.activePostStartedAt.size
|
|
199
|
+
? Math.min(...runtimeStats.activePostStartedAt.values()) : undefined;
|
|
200
|
+
const oldestActivePostAgeMs = oldestActivePostAt === undefined
|
|
201
|
+
? 0 : Math.max(0, Date.now() - oldestActivePostAt);
|
|
193
202
|
const transportEvidence = runtimeControllerHome
|
|
194
203
|
? recentMcpTransportEvidence(readRecentMcpTransportEvents(runtimeControllerHome), startedAt)
|
|
195
204
|
: { current: 'healthy' as const, recentStatus: 'stable' as const, gatewayStartedAt: startedAt, gatewayPid: process.pid };
|
|
@@ -237,7 +246,8 @@ export function registerMcpHttpObservationRoutes(input: McpHttpObservationRouteO
|
|
|
237
246
|
sessions: {
|
|
238
247
|
...sessionSnapshot,
|
|
239
248
|
initializing: runtimeStats.initializing,
|
|
240
|
-
activePosts: runtimeStats.
|
|
249
|
+
activePosts: runtimeStats.activePostStartedAt.size,
|
|
250
|
+
oldestActivePostAgeMs,
|
|
241
251
|
maximumActivePosts: maxActivePosts,
|
|
242
252
|
rejectedOverload: runtimeStats.rejectedOverload,
|
|
243
253
|
},
|
|
@@ -246,9 +256,10 @@ export function registerMcpHttpObservationRoutes(input: McpHttpObservationRouteO
|
|
|
246
256
|
|
|
247
257
|
app.get('/transport-ready', (_req, res) => {
|
|
248
258
|
const sessionSnapshot = sessionRegistry.snapshot();
|
|
259
|
+
reconcileFinishedMcpPosts(runtimeStats.activePostStartedAt);
|
|
249
260
|
const sessionCapacityReady = sessionSnapshot.acceptingNewSessions
|
|
250
261
|
&& runtimeStats.initializing < maxInitializingSessions
|
|
251
|
-
&& runtimeStats.
|
|
262
|
+
&& runtimeStats.activePostStartedAt.size < maxActivePosts;
|
|
252
263
|
res.status(sessionCapacityReady ? 200 : 503).json({
|
|
253
264
|
ready: sessionCapacityReady,
|
|
254
265
|
profile: toolContext.policy.profile,
|
|
@@ -257,7 +268,7 @@ export function registerMcpHttpObservationRoutes(input: McpHttpObservationRouteO
|
|
|
257
268
|
runtimeCapacity: {
|
|
258
269
|
initializing: runtimeStats.initializing,
|
|
259
270
|
maximumInitializing: maxInitializingSessions,
|
|
260
|
-
activePosts: runtimeStats.
|
|
271
|
+
activePosts: runtimeStats.activePostStartedAt.size,
|
|
261
272
|
maximumActivePosts: maxActivePosts,
|
|
262
273
|
},
|
|
263
274
|
});
|
|
@@ -266,9 +277,10 @@ export function registerMcpHttpObservationRoutes(input: McpHttpObservationRouteO
|
|
|
266
277
|
app.get('/ready', async (_req, res) => {
|
|
267
278
|
const runtimeGeneration = runtimeControllerHome ? readRuntimeGeneration(runtimeControllerHome) : undefined;
|
|
268
279
|
const sessionSnapshot = sessionRegistry.snapshot();
|
|
280
|
+
reconcileFinishedMcpPosts(runtimeStats.activePostStartedAt);
|
|
269
281
|
const sessionCapacityReady = sessionSnapshot.acceptingNewSessions
|
|
270
282
|
&& runtimeStats.initializing < maxInitializingSessions
|
|
271
|
-
&& runtimeStats.
|
|
283
|
+
&& runtimeStats.activePostStartedAt.size < maxActivePosts;
|
|
272
284
|
if (!runtimeControllerHome) {
|
|
273
285
|
res.status(sessionCapacityReady ? 200 : 503).json({
|
|
274
286
|
ready: sessionCapacityReady,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Response } from 'express';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Converge the response-owned POST registry from Node's authoritative response
|
|
5
|
+
* state. Event listeners remain the hot path, but an SDK may remove or replace
|
|
6
|
+
* listeners while the terminal ServerResponse flags still remain authoritative.
|
|
7
|
+
* Request age is deliberately irrelevant: a connected unfinished response is
|
|
8
|
+
* retained for as long as it remains live.
|
|
9
|
+
*/
|
|
10
|
+
export function reconcileFinishedMcpPosts(activePostStartedAt: Map<Response, number>): void {
|
|
11
|
+
for (const response of activePostStartedAt.keys()) {
|
|
12
|
+
if (
|
|
13
|
+
response.writableEnded
|
|
14
|
+
|| response.writableFinished
|
|
15
|
+
|| response.destroyed
|
|
16
|
+
|| response.closed
|
|
17
|
+
) activePostStartedAt.delete(response);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -38,7 +38,9 @@ import {
|
|
|
38
38
|
import { McpSessionRegistry, type ClosableMcpTransport, type McpSessionRegistryOptions, type McpSessionRoute } from './session-registry';
|
|
39
39
|
import { getConfiguredPublicOrigin, getPublicOrigin, registerMcpOAuthHttpRoutes } from './oauth-http';
|
|
40
40
|
import { registerMcpHttpObservationRoutes } from './http-observation';
|
|
41
|
+
import { reconcileFinishedMcpPosts } from './http-post-lifecycle';
|
|
41
42
|
import { RUNTIME_MCP_CUTOVER_OUTCOME_UNKNOWN } from '../../../src/runtime/root/mcp-transport';
|
|
43
|
+
import { packageConnectorCutoverDrainIsActive } from '../../../src/runtime/root/package-connector-service';
|
|
42
44
|
export { isAllowedMcpOAuthRedirectUri, isIncompleteOAuthAuthorizeRequest } from './oauth-http';
|
|
43
45
|
import {
|
|
44
46
|
connectionIdentity,
|
|
@@ -339,7 +341,8 @@ function requireMcpHttpAuth(
|
|
|
339
341
|
|
|
340
342
|
interface McpRuntimeStats {
|
|
341
343
|
initializing: number;
|
|
342
|
-
|
|
344
|
+
/** Canonical HTTP POST admission owner; one entry per unfinished response. */
|
|
345
|
+
activePostStartedAt: Map<Response, number>;
|
|
343
346
|
rejectedOverload: number;
|
|
344
347
|
}
|
|
345
348
|
|
|
@@ -358,8 +361,38 @@ const MCP_STREAM_LEASE_MS = positiveIntegerEnv('FORGE_MCP_STREAM_LEASE_MS', 30 *
|
|
|
358
361
|
const MCP_SESSION_ABSOLUTE_LIFETIME_MS = positiveIntegerEnv('FORGE_MCP_SESSION_ABSOLUTE_LIFETIME_MS', 2 * 60 * 60_000);
|
|
359
362
|
const MCP_ACTIVE_POST_STALL_MS = positiveIntegerEnv('FORGE_MCP_ACTIVE_POST_STALL_MS', 10 * 60_000);
|
|
360
363
|
|
|
361
|
-
|
|
362
|
-
|
|
364
|
+
function sendReleaseCutoverDraining(res: Response): void {
|
|
365
|
+
res.setHeader('retry-after', '1');
|
|
366
|
+
res.status(503).json({
|
|
367
|
+
error: 'release_cutover_draining',
|
|
368
|
+
code: 'MCP_RELEASE_CUTOVER_DRAINING',
|
|
369
|
+
message: 'This Connector is draining admitted MCP requests for a Runtime release cutover; retry shortly.',
|
|
370
|
+
recoverable: true,
|
|
371
|
+
retryable: true,
|
|
372
|
+
sessionPreserved: true,
|
|
373
|
+
action: 'retry',
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function connectorCutoverDrainActive(req: Request, controllerHome?: string): boolean {
|
|
378
|
+
if (!controllerHome || !req.socket.localPort) return false;
|
|
379
|
+
return packageConnectorCutoverDrainIsActive(
|
|
380
|
+
controllerHome,
|
|
381
|
+
`http://127.0.0.1:${req.socket.localPort}/mcp`,
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export function admitMcpPost(
|
|
386
|
+
stats: McpRuntimeStats,
|
|
387
|
+
res: Response,
|
|
388
|
+
cutoverDrain?: { controllerHome: string; connectorEndpoint: string },
|
|
389
|
+
): boolean {
|
|
390
|
+
if (cutoverDrain && packageConnectorCutoverDrainIsActive(cutoverDrain.controllerHome, cutoverDrain.connectorEndpoint)) {
|
|
391
|
+
sendReleaseCutoverDraining(res);
|
|
392
|
+
return false;
|
|
393
|
+
}
|
|
394
|
+
reconcileFinishedMcpPosts(stats.activePostStartedAt);
|
|
395
|
+
if (stats.activePostStartedAt.size >= MAX_ACTIVE_POSTS) {
|
|
363
396
|
stats.rejectedOverload += 1;
|
|
364
397
|
res.setHeader('retry-after', '1');
|
|
365
398
|
res.status(503).json({
|
|
@@ -374,12 +407,10 @@ export function admitMcpPost(stats: McpRuntimeStats, res: Response): boolean {
|
|
|
374
407
|
return false;
|
|
375
408
|
}
|
|
376
409
|
|
|
377
|
-
stats.
|
|
378
|
-
let released = false;
|
|
410
|
+
stats.activePostStartedAt.set(res, Date.now());
|
|
379
411
|
const release = (): void => {
|
|
380
|
-
if (
|
|
381
|
-
|
|
382
|
-
stats.activePosts = Math.max(0, stats.activePosts - 1);
|
|
412
|
+
if (!stats.activePostStartedAt.has(res)) return;
|
|
413
|
+
stats.activePostStartedAt.delete(res);
|
|
383
414
|
res.off('finish', release);
|
|
384
415
|
res.off('close', release);
|
|
385
416
|
};
|
|
@@ -458,7 +489,12 @@ async function handleMcpPost(
|
|
|
458
489
|
res.status(400).json({ error: 'invalid JSON request body' });
|
|
459
490
|
return;
|
|
460
491
|
}
|
|
461
|
-
|
|
492
|
+
const connectorEndpoint = req.socket.localPort
|
|
493
|
+
? `http://127.0.0.1:${req.socket.localPort}/mcp`
|
|
494
|
+
: undefined;
|
|
495
|
+
if (!admitMcpPost(stats, res, baseOptions.controllerHome && connectorEndpoint
|
|
496
|
+
? { controllerHome: baseOptions.controllerHome, connectorEndpoint }
|
|
497
|
+
: undefined)) return;
|
|
462
498
|
if (modernHandler) {
|
|
463
499
|
const webRequest = await toWebRequest(req, body);
|
|
464
500
|
if (!(await isLegacyRequest(webRequest, body))) {
|
|
@@ -645,7 +681,12 @@ async function handleMcpGet(
|
|
|
645
681
|
route: McpSessionRoute,
|
|
646
682
|
currentToolSurfaceFingerprint: () => string | undefined,
|
|
647
683
|
resolveRuntimeSchema?: (context: McpToolContext) => Promise<CanonicalRuntimeToolSchema | undefined>,
|
|
684
|
+
controllerHome?: string,
|
|
648
685
|
): Promise<void> {
|
|
686
|
+
if (connectorCutoverDrainActive(req, controllerHome)) {
|
|
687
|
+
sendReleaseCutoverDraining(res);
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
649
690
|
const sessionId = req.headers['mcp-session-id'] as string | undefined;
|
|
650
691
|
const managed = sessionId ? registry.get(sessionId) : undefined;
|
|
651
692
|
if (!managed || managed.route !== route || managed.principalId !== principalFromRequest(req)) {
|
|
@@ -740,13 +781,12 @@ export async function startMcpHttp(opts: McpHttpOptions): Promise<void> {
|
|
|
740
781
|
});
|
|
741
782
|
},
|
|
742
783
|
});
|
|
743
|
-
const runtimeStats: McpRuntimeStats = { initializing: 0,
|
|
784
|
+
const runtimeStats: McpRuntimeStats = { initializing: 0, activePostStartedAt: new Map(), rejectedOverload: 0 };
|
|
744
785
|
const toolContext = createMcpToolContext({ ...opts, repo: repoRoot, controllerHome, profile });
|
|
745
786
|
const baseOptions: McpServerOptions = {
|
|
746
787
|
repo: repoRoot,
|
|
747
788
|
controllerHome,
|
|
748
789
|
profile,
|
|
749
|
-
toolset: opts.toolset,
|
|
750
790
|
enableChatgptBrowser: opts.enableChatgptBrowser,
|
|
751
791
|
enableDevRunner: opts.enableDevRunner,
|
|
752
792
|
devRunnerAgents: opts.devRunnerAgents,
|
|
@@ -844,7 +884,7 @@ export async function startMcpHttp(opts: McpHttpOptions): Promise<void> {
|
|
|
844
884
|
});
|
|
845
885
|
});
|
|
846
886
|
app.get('/mcp', requireMcpHttpAuth(authMode, authToken, oauthProvider, configuredPublicOrigin), (req, res) => {
|
|
847
|
-
handleMcpGet(req, res, sessionRegistry, '/mcp', currentRuntimeToolSurfaceFingerprint, resolveRuntimeSchema).catch((error: unknown) => {
|
|
887
|
+
handleMcpGet(req, res, sessionRegistry, '/mcp', currentRuntimeToolSurfaceFingerprint, resolveRuntimeSchema, controllerHome).catch((error: unknown) => {
|
|
848
888
|
if (!res.headersSent) sendMcpRequestError(res, error);
|
|
849
889
|
});
|
|
850
890
|
});
|
|
@@ -862,7 +902,7 @@ export async function startMcpHttp(opts: McpHttpOptions): Promise<void> {
|
|
|
862
902
|
});
|
|
863
903
|
});
|
|
864
904
|
app.get('/mcp-grok', requireMcpHttpAuth(authMode, authToken, oauthProvider, configuredPublicOrigin, '/mcp-grok'), (req, res) => {
|
|
865
|
-
handleMcpGet(req, res, sessionRegistry, '/mcp-grok', currentRuntimeToolSurfaceFingerprint, resolveRuntimeSchema).catch((error: unknown) => {
|
|
905
|
+
handleMcpGet(req, res, sessionRegistry, '/mcp-grok', currentRuntimeToolSurfaceFingerprint, resolveRuntimeSchema, controllerHome).catch((error: unknown) => {
|
|
866
906
|
if (!res.headersSent) sendMcpRequestError(res, error);
|
|
867
907
|
});
|
|
868
908
|
});
|
|
@@ -880,7 +920,7 @@ export async function startMcpHttp(opts: McpHttpOptions): Promise<void> {
|
|
|
880
920
|
});
|
|
881
921
|
});
|
|
882
922
|
app.get('/mcp-bearer', requireMcpHttpAuth('bearer', authToken, null, configuredPublicOrigin), (req, res) => {
|
|
883
|
-
handleMcpGet(req, res, sessionRegistry, '/mcp-bearer', currentRuntimeToolSurfaceFingerprint, resolveRuntimeSchema).catch((error: unknown) => {
|
|
923
|
+
handleMcpGet(req, res, sessionRegistry, '/mcp-bearer', currentRuntimeToolSurfaceFingerprint, resolveRuntimeSchema, controllerHome).catch((error: unknown) => {
|
|
884
924
|
if (!res.headersSent) sendMcpRequestError(res, error);
|
|
885
925
|
});
|
|
886
926
|
});
|
package/adapters/mcp/types.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
export type McpProfileName = 'planner' | 'executor' | 'orchestrator' | 'controller';
|
|
2
2
|
export type McpPathIntent = 'read' | 'write';
|
|
3
3
|
export type McpAgentRunnerName = 'codex' | 'claude';
|
|
4
|
-
/** Controller MCP tools/list exposure profile.
|
|
5
|
-
* - facade: explicit five-tool ChatGPT orchestration surface
|
|
6
|
-
* - core/advanced (default compatibility labels): bounded stable controller surface
|
|
7
|
-
* - full: compatibility mode — all legacy + runtime tools
|
|
8
|
-
*/
|
|
9
|
-
export type McpToolset = 'facade' | 'core' | 'advanced' | 'full';
|
|
10
4
|
|
|
11
5
|
export interface McpPolicy {
|
|
12
6
|
profile: McpProfileName;
|
|
@@ -69,41 +69,3 @@ session_state_read_count() {
|
|
|
69
69
|
|
|
70
70
|
printf '%s' "$count"
|
|
71
71
|
}
|
|
72
|
-
|
|
73
|
-
session_state_codegraph_dir() {
|
|
74
|
-
printf '%s' ".claude/.codegraph-state"
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
session_state_codegraph_marker_file() {
|
|
78
|
-
local key="$1"
|
|
79
|
-
local suffix="$2"
|
|
80
|
-
local safe_key
|
|
81
|
-
safe_key="$(session_state_safe_key "$key")"
|
|
82
|
-
printf '%s/%s.%s' "$(session_state_codegraph_dir)" "$safe_key" "$suffix"
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
session_state_mark_codegraph_used() {
|
|
86
|
-
local key="$1"
|
|
87
|
-
local marker
|
|
88
|
-
marker="$(session_state_codegraph_marker_file "$key" "used")"
|
|
89
|
-
mkdir -p "$(dirname "$marker")"
|
|
90
|
-
: > "$marker"
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
session_state_codegraph_used() {
|
|
94
|
-
local key="$1"
|
|
95
|
-
[[ -f "$(session_state_codegraph_marker_file "$key" "used")" ]]
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
session_state_mark_codegraph_nudged() {
|
|
99
|
-
local key="$1"
|
|
100
|
-
local marker
|
|
101
|
-
marker="$(session_state_codegraph_marker_file "$key" "nudged")"
|
|
102
|
-
mkdir -p "$(dirname "$marker")"
|
|
103
|
-
: > "$marker"
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
session_state_codegraph_nudged() {
|
|
107
|
-
local key="$1"
|
|
108
|
-
[[ -f "$(session_state_codegraph_marker_file "$key" "nudged")" ]]
|
|
109
|
-
}
|
|
@@ -121,7 +121,7 @@ broad_command=false
|
|
|
121
121
|
recommended_next_tool=""
|
|
122
122
|
if post_bash_broad_command "$COMMAND_TEXT"; then
|
|
123
123
|
broad_command=true
|
|
124
|
-
recommended_next_tool="
|
|
124
|
+
recommended_next_tool="rh_context"
|
|
125
125
|
fi
|
|
126
126
|
output_line_count="$(post_bash_output_line_count "$TOOL_OUTPUT")"
|
|
127
127
|
raw_output_bytes="$(post_bash_output_byte_count "$TOOL_OUTPUT")"
|
|
@@ -41,11 +41,6 @@ duration_ms="${duration_ms:-0}"
|
|
|
41
41
|
run_id="${run_id:-unknown}"
|
|
42
42
|
session_source="${session_source:-unknown}"
|
|
43
43
|
|
|
44
|
-
case "$tool_name" in
|
|
45
|
-
mcp__codegraph__*|codegraph_*)
|
|
46
|
-
session_state_mark_codegraph_used "$SESSION_KEY" || true
|
|
47
|
-
;;
|
|
48
|
-
esac
|
|
49
44
|
|
|
50
45
|
# An event source is explicit evidence. Inherited host variables are only a
|
|
51
46
|
# fallback for payloads that omit it, such as local compatibility shims.
|
|
@@ -566,59 +566,6 @@ emit_agentic_packaging_hint() {
|
|
|
566
566
|
fi
|
|
567
567
|
}
|
|
568
568
|
|
|
569
|
-
resolve_codegraph_bin() {
|
|
570
|
-
local common_git_dir canonical_root candidate
|
|
571
|
-
if [[ -x "node_modules/.bin/codegraph" ]]; then
|
|
572
|
-
printf '%s\n' "node_modules/.bin/codegraph"
|
|
573
|
-
return 0
|
|
574
|
-
fi
|
|
575
|
-
|
|
576
|
-
# Linked worktrees normally reuse the canonical checkout's dependency tree.
|
|
577
|
-
# Resolve it before falling back to a user-global CodeGraph installation.
|
|
578
|
-
common_git_dir="$(git rev-parse --path-format=absolute --git-common-dir 2>/dev/null || true)"
|
|
579
|
-
if [[ -n "$common_git_dir" ]]; then
|
|
580
|
-
canonical_root="$(dirname "$common_git_dir")"
|
|
581
|
-
candidate="$canonical_root/node_modules/.bin/codegraph"
|
|
582
|
-
if [[ -x "$candidate" ]]; then
|
|
583
|
-
printf '%s\n' "$candidate"
|
|
584
|
-
return 0
|
|
585
|
-
fi
|
|
586
|
-
fi
|
|
587
|
-
|
|
588
|
-
command -v codegraph 2>/dev/null || return 1
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
run_codegraph_init_command() {
|
|
592
|
-
local codegraph_bin status cursor_dir_existed cursor_rules_dir_existed cursor_rule_existed
|
|
593
|
-
codegraph_bin="$(resolve_codegraph_bin)" || return 127
|
|
594
|
-
|
|
595
|
-
cursor_dir_existed=false
|
|
596
|
-
cursor_rules_dir_existed=false
|
|
597
|
-
cursor_rule_existed=false
|
|
598
|
-
[[ -d ".cursor" ]] && cursor_dir_existed=true
|
|
599
|
-
[[ -d ".cursor/rules" ]] && cursor_rules_dir_existed=true
|
|
600
|
-
[[ -e ".cursor/rules/codegraph.mdc" ]] && cursor_rule_existed=true
|
|
601
|
-
|
|
602
|
-
set +e
|
|
603
|
-
CODEGRAPH_NO_DAEMON=1 "$codegraph_bin" init -i .
|
|
604
|
-
status=$?
|
|
605
|
-
set -e
|
|
606
|
-
|
|
607
|
-
if [[ "$cursor_rule_existed" == "false" && -f ".cursor/rules/codegraph.mdc" ]]; then
|
|
608
|
-
rm -f ".cursor/rules/codegraph.mdc"
|
|
609
|
-
[[ "$cursor_rules_dir_existed" == "false" ]] && rmdir ".cursor/rules" 2>/dev/null || true
|
|
610
|
-
[[ "$cursor_dir_existed" == "false" ]] && rmdir ".cursor" 2>/dev/null || true
|
|
611
|
-
fi
|
|
612
|
-
|
|
613
|
-
return "$status"
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
emit_codegraph_route_hint() {
|
|
617
|
-
if pg_fact CODEGRAPH_ROUTE || pg_fact NONTRIVIAL_CODE_TASK; then
|
|
618
|
-
echo "[CodegraphRoute] Structural code-navigation intent detected. Prefer Forge rh_context/semantic navigation or an already-configured structural provider; do not initialize repo-local .codegraph state from a prompt hook."
|
|
619
|
-
fi
|
|
620
|
-
}
|
|
621
|
-
|
|
622
569
|
modern_controller_home_workflow() {
|
|
623
570
|
[[ -f "forge.config.json" ]]
|
|
624
571
|
}
|
|
@@ -839,7 +786,6 @@ prompt_guard_engine_call
|
|
|
839
786
|
if modern_controller_home_workflow; then
|
|
840
787
|
emit_agentic_packaging_hint
|
|
841
788
|
emit_forge_route_hint
|
|
842
|
-
emit_codegraph_route_hint
|
|
843
789
|
emit_modern_controller_home_guidance
|
|
844
790
|
exit 0
|
|
845
791
|
fi
|
|
@@ -858,7 +804,6 @@ fi
|
|
|
858
804
|
|
|
859
805
|
emit_agentic_packaging_hint
|
|
860
806
|
emit_forge_route_hint
|
|
861
|
-
emit_codegraph_route_hint
|
|
862
807
|
emit_pending_orchestration_discussion
|
|
863
808
|
|
|
864
809
|
implement_intent=0
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
- Route knowledge sync and handoff retrieval to `gbrain`.
|
|
51
51
|
- Register valuable repo-authored docs in `.ai/harness/brain-manifest.json` with `sync.direction=repo-to-brain`; `.ai/harness/scripts/sync-brain-docs.sh` and the PostEdit hook mirror only those explicit entries into the default brain vault.
|
|
52
52
|
- Codex automation profile is runtime-referenced, not vendored: required skills are `health`, `check`, and `mermaid` from `~/.codex/skills`.
|
|
53
|
-
-
|
|
53
|
+
- Code navigation uses bounded ripgrep discovery and explicit language-service symbol navigation; no graph index is required.
|
|
54
54
|
- Treat third-party host skills as optional. Their installation state must not change Forge workflow correctness.
|
|
55
55
|
- Use `docs/reference-configs/agentic-development-flow.md` for routing details and `docs/reference-configs/external-tooling.md` plus `bash .ai/harness/scripts/check-agent-tooling.sh --host both --check-updates` for environment checks.
|
|
56
56
|
- If repo state conflicts with the task, use an isolated `codex/<task-slug>` worktree, validate with Forge `/review`, and merge back to `main` without unrelated dirty changes.
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
- Agentic skill routing: product discovery -> gstack `office-hours`; complex engineering plans -> gstack `plan-eng-review`; design plans -> gstack `plan-design-review`; daily small/medium planning, bug hunts, and checks -> Forge `/plan`, `/hunt`, `/check`.
|
|
33
33
|
- Knowledge sync and handoff retrieval -> `gbrain`.
|
|
34
34
|
- Codex automation profile: required `health`, `check`, and `mermaid` from `~/.codex/skills`; do not vendor skill bodies.
|
|
35
|
-
-
|
|
35
|
+
- Code navigation uses bounded ripgrep discovery and explicit language-service definitions/references/implementations; no graph index is required.
|
|
36
36
|
- External tooling reference: `docs/reference-configs/agentic-development-flow.md` for routing details, `docs/reference-configs/external-tooling.md` for install/update guidance.
|
|
37
37
|
- Waza runtime boundary: Codex reads `~/.codex/skills`; `~/.agents/skills` is only skills CLI staging/cache and must be copied into Codex with verification after updates.
|
|
38
38
|
- Environment check: `bash .ai/harness/scripts/check-agent-tooling.sh --host both --check-updates`.
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
- Terminal plan/task history: Git history plus durable Control Plane evidence; do not create repository archive directories.
|
|
19
19
|
- `docs/reference-configs/agentic-development-flow.md`: gstack/Waza routing, P1/P2/P3 reporting triggers, and daily flow
|
|
20
20
|
- `docs/reference-configs/harness-overview.md`: orchestration playbook
|
|
21
|
-
- `docs/reference-configs/external-tooling.md`: gstack/Waza/gbrain routing, Codex-first Waza sync, and
|
|
21
|
+
- `docs/reference-configs/external-tooling.md`: gstack/Waza/gbrain routing, Codex-first Waza sync, and source-based navigation guidance
|
|
22
22
|
- `docs/reference-configs/document-generation.md`: minimal docs profile and on-demand document rules
|
|
23
23
|
- `docs/reference-configs/global-working-rules.md`: user-level Claude/Codex rule template
|
|
24
24
|
- `docs/reference-configs/sprint-contracts.md`: contract rules
|
|
@@ -66,7 +66,7 @@ For small work keep this internal. For architecture, debugging, risky refactors,
|
|
|
66
66
|
|
|
67
67
|
1. Read the current user request and current Canonical Runtime state first.
|
|
68
68
|
2. Use `/direct`, `/plan`, `/debug`, `/review`, `/release`, or `/scale` according to intent.
|
|
69
|
-
3. Use
|
|
69
|
+
3. Use bounded rh_context search for current source, then explicit semantic_navigation for known symbols and their references.
|
|
70
70
|
4. If a decision-complete plan is useful, capture it into `plans/` as a durable business/engineering artifact. It is not a second Runtime lifecycle authority.
|
|
71
71
|
5. Execute bounded work through Forge repository/Process/Work primitives and collect verification evidence.
|
|
72
72
|
6. Use `/review` plus focused checks before closeout. Optional peer or Waza reviews may add evidence but may not become the only pass condition.
|
|
@@ -9,7 +9,6 @@ Optional enhancements:
|
|
|
9
9
|
- `gbrain`: optional knowledge tooling;
|
|
10
10
|
- `Mermaid` host skill: optional rendered diagrams; Markdown Mermaid remains sufficient;
|
|
11
11
|
- Forge peer-review helpers (`codex-review`, `claude-review`): optional cross-model acceptance evidence;
|
|
12
|
-
- CodeGraph host MCP/CLI: optional direct host integration. Forge's own `rh_context` structural backend uses the bundled CodeGraph runtime when available.
|
|
13
12
|
|
|
14
13
|
`forge install` installs the Forge CLI/runtime and managed host adapters. It does **not** install Waza, Mermaid, or cross-review skills unless `--with-external-skills` is explicitly supplied. `forge setup` is the guided readiness workflow; `forge setup check` is the one-shot read-only report.
|
|
15
14
|
|
|
@@ -40,9 +39,6 @@ The detector intentionally avoids side-effecting commands. It does not run:
|
|
|
40
39
|
- `npx skills update`
|
|
41
40
|
- `gbrain serve`
|
|
42
41
|
- `gbrain sync`
|
|
43
|
-
- `codegraph init`
|
|
44
|
-
- `codegraph sync`
|
|
45
|
-
- `codegraph install`
|
|
46
42
|
|
|
47
43
|
With `--check-updates`, Waza update checks fetch upstream GitHub raw
|
|
48
44
|
`SKILL.md` and shared `rules/` files, then compare versions/hashes against each
|
|
@@ -118,12 +114,6 @@ CLI and does not ship the forge advisory command.
|
|
|
118
114
|
check` may report its local state, but missing or stale `gbrain` must not
|
|
119
115
|
create Agent repair/update actions or change the setup readiness result.
|
|
120
116
|
|
|
121
|
-
### CodeGraph
|
|
122
|
-
|
|
123
|
-
`CodeGraph` has two integration levels. Forge-internal structural retrieval is provided through `rh_context` and the bundled CodeGraph runtime when available. A global `codegraph` CLI or host MCP entry is optional and exists only for direct Codex/Claude use. Neither replaces workflow checks, tests, architecture evidence, or raw source reads.
|
|
124
|
-
|
|
125
|
-
Forge packages a CodeGraph runtime for its own structural context provider and can ensure the repository index without requiring a user-global CLI. `forge tools configure codegraph` remains an explicit optional host integration.
|
|
126
|
-
|
|
127
117
|
### Runtime Ownership Boundary
|
|
128
118
|
|
|
129
119
|
`forge setup check --target <host> --check-updates --json` reports the
|
|
@@ -151,66 +141,6 @@ script reports unsupported link-mode and tells the caller to use copy-mode.
|
|
|
151
141
|
`rsync` is missing, the script reports unsupported copy-mode instead of a
|
|
152
142
|
generic command failure.
|
|
153
143
|
|
|
154
|
-
Read-only check:
|
|
155
|
-
|
|
156
|
-
```bash
|
|
157
|
-
codegraph status .
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
Local index mutation:
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
codegraph init -i .
|
|
164
|
-
codegraph sync .
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
Do not ask users to copy MCP TOML or Claude JSON by hand. The user-facing path
|
|
168
|
-
is one terminal command, or explicit authorization for their agent to run the
|
|
169
|
-
same command:
|
|
170
|
-
|
|
171
|
-
```bash
|
|
172
|
-
bun add -g @colbymchenry/codegraph && forge tools configure codegraph --target codex --location global
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
This delegates host-specific MCP config to CodeGraph's target adapters for
|
|
176
|
-
Codex and Claude, so do not run CodeGraph setup automatically from
|
|
177
|
-
`forge install`, `forge adopt`, or explicit tooling configuration. Restart Codex after the installer
|
|
178
|
-
finishes so the MCP server is discovered; Claude Code should pick up its config
|
|
179
|
-
according to its own settings reload behavior. If a launch environment still
|
|
180
|
-
cannot find `codegraph`, an authorized agent should diagnose `PATH` and the
|
|
181
|
-
`~/.local/bin/codegraph` shim. Do not make the user hand-edit MCP config as the
|
|
182
|
-
fallback.
|
|
183
|
-
|
|
184
|
-
For troubleshooting only, inspect host config snippets without writing:
|
|
185
|
-
|
|
186
|
-
```bash
|
|
187
|
-
codegraph install --print-config codex
|
|
188
|
-
codegraph install --print-config claude
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
Project-local indexes are ignored runtime state:
|
|
192
|
-
|
|
193
|
-
```bash
|
|
194
|
-
codegraph init -i .
|
|
195
|
-
codegraph status .
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
Before non-trivial code work, agents should sync the local index and use it for
|
|
199
|
-
P1/P2 discovery:
|
|
200
|
-
|
|
201
|
-
```bash
|
|
202
|
-
codegraph sync .
|
|
203
|
-
codegraph context "<task>"
|
|
204
|
-
codegraph query <symbol> --json
|
|
205
|
-
codegraph callers <symbol> --json
|
|
206
|
-
codegraph callees <symbol> --json
|
|
207
|
-
codegraph impact <symbol> --json
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
For this repo, do not treat `codegraph affected` as an authoritative test
|
|
211
|
-
selector. Many tests execute scripts by path or subprocess rather than import
|
|
212
|
-
edges, so run the repo verification commands instead.
|
|
213
|
-
|
|
214
144
|
### Bash Output Evidence and RTK
|
|
215
145
|
|
|
216
146
|
`forge` treats Bash output as runtime evidence, not durable task state.
|
|
@@ -267,12 +197,6 @@ gbrain check-update --json
|
|
|
267
197
|
gbrain upgrade
|
|
268
198
|
```
|
|
269
199
|
|
|
270
|
-
### CodeGraph
|
|
271
|
-
|
|
272
|
-
```bash
|
|
273
|
-
bun add -g @colbymchenry/codegraph@latest && codegraph sync . && codegraph status .
|
|
274
|
-
```
|
|
275
|
-
|
|
276
200
|
## Manual Knowledge Sync
|
|
277
201
|
|
|
278
202
|
`gbrain` stays advisory-first in this contract. Manual repo sync is allowed:
|
|
@@ -35,6 +35,6 @@ evidence must record `full_test_count`, `dry_run_ratio`, `grader_pass_rate`, and
|
|
|
35
35
|
evidence is non-authoritative, and missing eval evidence must be called out as
|
|
36
36
|
unavailable. Readiness yellow flags from `forge-check` must be recorded
|
|
37
37
|
with either the accepted reason or the concrete repair command, including Waza
|
|
38
|
-
staging drift, gbrain warnings,
|
|
38
|
+
staging drift, gbrain warnings, or non-authoritative
|
|
39
39
|
skill eval evidence. Do not rely only on npm or GitHub release metadata for this
|
|
40
40
|
local audit trail.
|
|
@@ -307,7 +307,7 @@ classify_change() {
|
|
|
307
307
|
[[ "$rel_path" == ".ai/harness/policy.json" ]] ||
|
|
308
308
|
[[ "$rel_path" == ".ai/harness/workflow-contract.json" ]] ||
|
|
309
309
|
[[ "$rel_path" == "assets/workflow-contract.v1.json" ]] ||
|
|
310
|
-
[[ "$rel_path" =~ ^scripts/(architecture-queue|context-contract-sync|workstream-sync|migrate-project-template|migrate-workflow-docs|inspect-project-state|
|
|
310
|
+
[[ "$rel_path" =~ ^scripts/(architecture-queue|context-contract-sync|workstream-sync|migrate-project-template|migrate-workflow-docs|inspect-project-state|capability-resolver|capability-config|create-project-dirs|init-project|ensure-task-workflow|check-task-workflow|check-deploy-sql-order|refresh-current-status|workflow-contract|select-agent-context-blocks)\.(sh|ts)$ ]] ||
|
|
311
311
|
[[ "$rel_path" == "scripts/lib/project-init-lib.sh" ]]; then
|
|
312
312
|
printf 'high workflow-surface\n'
|
|
313
313
|
return
|