forgeos 0.1.0-alpha.7 → 0.1.0-alpha.71
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/skills/forge-agent-fabric/SKILL.md +178 -0
- package/.agents/skills/forge-agent-fabric/references/managed-workflows.md +95 -0
- package/.agents/skills/forge-agent-fabric/references/repository-analysis.md +102 -0
- package/.agents/skills/forge-agent-fabric/scripts/fabric.mjs +46 -0
- package/.agents/skills/forge-agent-fabric/scripts/repository.mjs +44 -0
- package/.npmignore +10 -0
- package/AGENTS.md +142 -90
- package/CHANGELOG.md +870 -9
- package/LICENSE +21 -0
- package/README.md +121 -6
- package/adapters/go/README.md +23 -0
- package/adapters/go/go.mod +3 -0
- package/adapters/go/http.go +149 -0
- package/adapters/go/registry.go +234 -0
- package/adapters/go/types.go +136 -0
- package/adapters/java/README.md +68 -0
- package/adapters/java/pom.xml +47 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/Auth.java +20 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/Diagnostic.java +16 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/Entry.java +38 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/EntryKind.java +16 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/ErrorInfo.java +4 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/Forge.java +94 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/ForgeCall.java +12 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/ForgeContext.java +11 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/ForgeHandler.java +8 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/ForgeHttpHandler.java +179 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/ForgeRegistry.java +121 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/Json.java +14 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/Manifest.java +14 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/RequestEnvelope.java +6 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/ResponseEnvelope.java +25 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/Risk.java +18 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/Schemas.java +36 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/Service.java +65 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/TransactionMode.java +18 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/TypedForgeHandler.java +6 -0
- package/adapters/java-spring-boot-starter/README.md +32 -0
- package/adapters/java-spring-boot-starter/pom.xml +49 -0
- package/adapters/java-spring-boot-starter/src/main/java/dev/forgeos/adapter/spring/ForgeCommand.java +22 -0
- package/adapters/java-spring-boot-starter/src/main/java/dev/forgeos/adapter/spring/ForgeExternalService.java +15 -0
- package/adapters/java-spring-boot-starter/src/main/java/dev/forgeos/adapter/spring/ForgeQuery.java +16 -0
- package/adapters/java-spring-boot-starter/src/main/java/dev/forgeos/adapter/spring/ForgeServiceBeanCondition.java +18 -0
- package/adapters/java-spring-boot-starter/src/main/java/dev/forgeos/adapter/spring/ForgeSpringAutoConfiguration.java +16 -0
- package/adapters/java-spring-boot-starter/src/main/java/dev/forgeos/adapter/spring/ForgeSpringRuntime.java +104 -0
- package/adapters/java-spring-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +1 -0
- package/bin/forge.mjs +18 -0
- package/docs/agent-fabric-programs.md +151 -0
- package/docs/agent-fabric.md +582 -0
- package/docs/architecture/agent-fabric/PORTABLE_PROJECTS_PLAN.md +136 -0
- package/docs/architecture/agent-fabric/README.md +180 -0
- package/docs/architecture/agent-fabric/REPOSITORY_MANIFEST_PLAN.md +284 -0
- package/docs/architecture/agent-fabric/WORKFLOW_PROGRAM_V2_ADR.md +81 -0
- package/docs/architecture/agent-fabric/WORKFLOW_PROGRAM_V2_CORRECTIONS.md +39 -0
- package/docs/architecture/agent-fabric/WORKFLOW_PROGRAM_V2_CORRECTIONS_EVIDENCE.md +53 -0
- package/docs/architecture/agent-fabric/WORKFLOW_PROGRAM_V2_EVIDENCE.md +49 -0
- package/docs/architecture/agent-fabric/WORKFLOW_PROGRAM_V2_PLAN.md +590 -0
- package/docs/cair-protocol.md +103 -0
- package/docs/changelog.md +1070 -0
- package/docs/forge-protocol.md +189 -0
- package/docs/repository-agent-benchmark.md +179 -0
- package/docs/repository-analysis.md +139 -0
- package/docs/repository-context-quality.md +179 -0
- package/docs/repository-runtime-observation.md +82 -0
- package/examples/agent-fabric-v2/README.md +70 -0
- package/examples/agent-fabric-v2/item-child.workflow.ts +11 -0
- package/examples/agent-fabric-v2/make-request.mjs +4 -0
- package/examples/agent-fabric-v2/map-child.workflow.ts +10 -0
- package/examples/agent-fabric-v2/migrate.workflow.ts +35 -0
- package/examples/agent-fabric-v2/registry.example.json +256 -0
- package/examples/agent-fabric-v2/run-ui-fixture.ts +48 -0
- package/examples/agent-fabric-v2/ui-audit.workflow.ts +28 -0
- package/examples/agent-fabric-v2/ui-fixture-worker.cjs +36 -0
- package/examples/agent-fabric-v2/visual-population.json +13 -0
- package/examples/agent-fabric-v2/workers/check.mjs +2 -0
- package/examples/agent-fabric-v2/workers/common.mjs +7 -0
- package/examples/agent-fabric-v2/workers/discover.mjs +2 -0
- package/examples/agent-fabric-v2/workers/migrate.mjs +4 -0
- package/examples/agent-fabric-v2/workers/review.mjs +3 -0
- package/examples/go-billing/go.mod +7 -0
- package/examples/go-billing/main.go +120 -0
- package/examples/java-billing/pom.xml +60 -0
- package/examples/java-billing/src/main/java/dev/forgeos/examples/billing/CreateInvoiceInput.java +4 -0
- package/examples/java-billing/src/main/java/dev/forgeos/examples/billing/Invoice.java +11 -0
- package/examples/java-billing/src/main/java/dev/forgeos/examples/billing/Main.java +127 -0
- package/package.json +60 -5
- package/schemas/agent-fabric/v0.1/control-event.schema.json +281 -0
- package/schemas/forge-manifest.schema.json +389 -0
- package/scripts/field-test-forgeos.mjs +1021 -0
- package/scripts/install-agent-fabric-skill.mjs +105 -0
- package/src/forge/_generated/releaseManifest.json +1 -2
- package/src/forge/_generated/releaseManifest.ts +3 -3
- package/src/forge/agent-adapters/index.ts +1592 -125
- package/src/forge/agent-adapters/types.ts +225 -1
- package/src/forge/agent-fabric/adapter.ts +131 -0
- package/src/forge/agent-fabric/attached-snapshot.ts +55 -0
- package/src/forge/agent-fabric/attached-task-contract.ts +105 -0
- package/src/forge/agent-fabric/attached-task-service.ts +127 -0
- package/src/forge/agent-fabric/attached-task-store.ts +109 -0
- package/src/forge/agent-fabric/authority.ts +298 -0
- package/src/forge/agent-fabric/canonical.ts +135 -0
- package/src/forge/agent-fabric/codex-adversarial-review.ts +229 -0
- package/src/forge/agent-fabric/codex-sdk-worker.ts +203 -0
- package/src/forge/agent-fabric/conductor.ts +754 -0
- package/src/forge/agent-fabric/dictionary.ts +12 -0
- package/src/forge/agent-fabric/errors.ts +32 -0
- package/src/forge/agent-fabric/hardened-conductor.ts +485 -0
- package/src/forge/agent-fabric/hardened-reducer.ts +211 -0
- package/src/forge/agent-fabric/index.ts +48 -0
- package/src/forge/agent-fabric/journal.ts +116 -0
- package/src/forge/agent-fabric/local-adaptive-digest-worker.mjs +26 -0
- package/src/forge/agent-fabric/local-adaptive-harness.ts +343 -0
- package/src/forge/agent-fabric/local-adaptive-service.ts +398 -0
- package/src/forge/agent-fabric/local-adaptive-worker.ts +146 -0
- package/src/forge/agent-fabric/local-approval-window.ts +211 -0
- package/src/forge/agent-fabric/local-change-review-service.ts +374 -0
- package/src/forge/agent-fabric/local-coding-worker.ts +285 -0
- package/src/forge/agent-fabric/local-control-store.ts +239 -0
- package/src/forge/agent-fabric/local-effect-broker.ts +348 -0
- package/src/forge/agent-fabric/local-evolution-approval.ts +81 -0
- package/src/forge/agent-fabric/local-evolution-profile.ts +87 -0
- package/src/forge/agent-fabric/local-evolution-registry.ts +427 -0
- package/src/forge/agent-fabric/local-evolution-service.ts +200 -0
- package/src/forge/agent-fabric/local-intelligence.ts +281 -0
- package/src/forge/agent-fabric/local-paths.ts +18 -0
- package/src/forge/agent-fabric/local-task-contract.ts +203 -0
- package/src/forge/agent-fabric/local-task-inbox.ts +543 -0
- package/src/forge/agent-fabric/local-task-server.ts +374 -0
- package/src/forge/agent-fabric/local-task-service.ts +982 -0
- package/src/forge/agent-fabric/local-verification.ts +551 -0
- package/src/forge/agent-fabric/managed-environment.ts +205 -0
- package/src/forge/agent-fabric/managed-run-contract.ts +103 -0
- package/src/forge/agent-fabric/managed-run-service.ts +401 -0
- package/src/forge/agent-fabric/managed-run-store.ts +165 -0
- package/src/forge/agent-fabric/managed-workspace.ts +253 -0
- package/src/forge/agent-fabric/p0a.ts +104 -0
- package/src/forge/agent-fabric/p0b-model-adapter.ts +434 -0
- package/src/forge/agent-fabric/planning.ts +155 -0
- package/src/forge/agent-fabric/program-api.ts +37 -0
- package/src/forge/agent-fabric/program-contract.ts +283 -0
- package/src/forge/agent-fabric/program-dsl.ts +126 -0
- package/src/forge/agent-fabric/program-evidence.ts +22 -0
- package/src/forge/agent-fabric/program-image.ts +15 -0
- package/src/forge/agent-fabric/program-lock.ts +50 -0
- package/src/forge/agent-fabric/program-owner.ts +16 -0
- package/src/forge/agent-fabric/program-scheduler.ts +38 -0
- package/src/forge/agent-fabric/program-service.ts +793 -0
- package/src/forge/agent-fabric/program-store.ts +142 -0
- package/src/forge/agent-fabric/program-structure.ts +65 -0
- package/src/forge/agent-fabric/program-types.ts +110 -0
- package/src/forge/agent-fabric/program-view.ts +12 -0
- package/src/forge/agent-fabric/program-worker.ts +108 -0
- package/src/forge/agent-fabric/project-profile.ts +50 -0
- package/src/forge/agent-fabric/project-registry.ts +120 -0
- package/src/forge/agent-fabric/project-runtime.ts +85 -0
- package/src/forge/agent-fabric/readiness.ts +26 -0
- package/src/forge/agent-fabric/reducer.ts +863 -0
- package/src/forge/agent-fabric/repository-context.ts +83 -0
- package/src/forge/agent-fabric/resource-ledger.ts +266 -0
- package/src/forge/agent-fabric/serialized-local-adapter.ts +60 -0
- package/src/forge/agent-fabric/types.ts +424 -0
- package/src/forge/agent-fabric/validation.ts +500 -0
- package/src/forge/agent-fabric/workflow-engine.ts +218 -0
- package/src/forge/agent-fabric/workflow-task-actions.ts +104 -0
- package/src/forge/agent-fabric/workflow-templates.ts +11 -0
- package/src/forge/agent-memory/bridge.ts +1728 -0
- package/src/forge/agent-memory/context-pack.ts +284 -0
- package/src/forge/agent-memory/hook-runner.ts +331 -0
- package/src/forge/agent-memory/mcp.ts +597 -0
- package/src/forge/agent-memory/normalize.ts +498 -0
- package/src/forge/agent-memory/redaction.ts +103 -0
- package/src/forge/agent-memory/sources/claude-code.ts +51 -0
- package/src/forge/agent-memory/sources/codex-hook-runner.mjs +343 -0
- package/src/forge/agent-memory/sources/codex.ts +161 -0
- package/src/forge/agent-memory/sources/cursor.ts +35 -0
- package/src/forge/agent-memory/types.ts +215 -0
- package/src/forge/bench.ts +248 -0
- package/src/forge/brownfield-import/index.ts +896 -0
- package/src/forge/brownfield-import/types.ts +127 -0
- package/src/forge/cair/action-journal.ts +61 -0
- package/src/forge/cair/action-parser.ts +314 -0
- package/src/forge/cair/action-validator.ts +40 -0
- package/src/forge/cair/actions.ts +1818 -0
- package/src/forge/cair/format.ts +77 -0
- package/src/forge/cair/index.ts +118 -0
- package/src/forge/cair/query.ts +478 -0
- package/src/forge/cair/snapshot.ts +315 -0
- package/src/forge/cair/types.ts +255 -0
- package/src/forge/cli/adaptive.ts +51 -0
- package/src/forge/cli/ai.ts +16 -1
- package/src/forge/cli/auth.ts +459 -15
- package/src/forge/cli/authmd.ts +441 -0
- package/src/forge/cli/baseline.ts +112 -0
- package/src/forge/cli/build.ts +20 -4
- package/src/forge/cli/changed.ts +418 -0
- package/src/forge/cli/codex-app-server.ts +877 -0
- package/src/forge/cli/commands.ts +1859 -20
- package/src/forge/cli/db.ts +209 -2
- package/src/forge/cli/deploy.ts +1339 -0
- package/src/forge/cli/deps.ts +150 -23
- package/src/forge/cli/dev.ts +1137 -53
- package/src/forge/cli/docs.ts +265 -0
- package/src/forge/cli/doctor.ts +297 -0
- package/src/forge/cli/env-placeholders.ts +62 -0
- package/src/forge/cli/evolution.ts +40 -0
- package/src/forge/cli/fabric.ts +253 -0
- package/src/forge/cli/field-test.ts +568 -0
- package/src/forge/cli/golden-path.ts +487 -0
- package/src/forge/cli/handoff.ts +336 -0
- package/src/forge/cli/index.ts +1 -0
- package/src/forge/cli/last-run.ts +84 -0
- package/src/forge/cli/main.ts +196 -3
- package/src/forge/cli/new.ts +169 -17
- package/src/forge/cli/next-actions.ts +23 -0
- package/src/forge/cli/output.ts +398 -6
- package/src/forge/cli/parse.ts +1377 -38
- package/src/forge/cli/progress.ts +51 -0
- package/src/forge/cli/query.ts +32 -0
- package/src/forge/cli/release.ts +35 -11
- package/src/forge/cli/repository.ts +151 -0
- package/src/forge/cli/run.ts +42 -0
- package/src/forge/cli/secrets.ts +137 -1
- package/src/forge/cli/seed.ts +581 -0
- package/src/forge/cli/self-host.ts +56 -14
- package/src/forge/cli/studio.ts +2282 -0
- package/src/forge/cli/verify.ts +1458 -32
- package/src/forge/cli/windows.ts +23 -0
- package/src/forge/cli/workos.ts +3509 -0
- package/src/forge/compiler/agent-contract/build.ts +728 -64
- package/src/forge/compiler/agent-contract/types.ts +45 -2
- package/src/forge/compiler/ai-registry/parse.ts +71 -2
- package/src/forge/compiler/api-surface/build.ts +47 -0
- package/src/forge/compiler/app-graph/build.ts +112 -9
- package/src/forge/compiler/app-graph/extract.ts +107 -0
- package/src/forge/compiler/app-graph/module-graph.ts +73 -78
- package/src/forge/compiler/app-graph/parser.ts +24 -24
- package/src/forge/compiler/app-graph/profile.ts +26 -0
- package/src/forge/compiler/app-graph/tsconfig-hash.ts +41 -4
- package/src/forge/compiler/app-graph/versions.ts +1 -1
- package/src/forge/compiler/classifier/capabilities.ts +3 -2
- package/src/forge/compiler/classifier/classify.ts +32 -8
- package/src/forge/compiler/classifier/secrets.ts +3 -2
- package/src/forge/compiler/classifier/signals.ts +91 -1
- package/src/forge/compiler/client-sdk/build-manifest.ts +59 -0
- package/src/forge/compiler/client-sdk/render-client.ts +295 -13
- package/src/forge/compiler/data-graph/build.ts +29 -1
- package/src/forge/compiler/data-graph/parse.ts +20 -4
- package/src/forge/compiler/data-graph/sql/ddl.ts +144 -31
- package/src/forge/compiler/data-graph/sql/serialize.ts +4 -0
- package/src/forge/compiler/data-graph/sql/types.ts +1 -0
- package/src/forge/compiler/diagnostics/codes.ts +38 -0
- package/src/forge/compiler/diagnostics/create.ts +28 -2
- package/src/forge/compiler/diagnostics/index.ts +2 -0
- package/src/forge/compiler/emitter/barrel.ts +3 -0
- package/src/forge/compiler/emitter/render.ts +9 -0
- package/src/forge/compiler/external-manifest/registry.ts +217 -0
- package/src/forge/compiler/external-manifest/types.ts +91 -0
- package/src/forge/compiler/external-manifest/validate.ts +373 -0
- package/src/forge/compiler/frontend-graph/build.ts +142 -14
- package/src/forge/compiler/integration/add.ts +991 -33
- package/src/forge/compiler/integration/plan.ts +43 -12
- package/src/forge/compiler/integration/render.ts +29 -0
- package/src/forge/compiler/integration/snapshot.ts +2 -0
- package/src/forge/compiler/integration/templates/convex.ts +70 -0
- package/src/forge/compiler/integration/templates/index.ts +1 -0
- package/src/forge/compiler/integration/templates/render.ts +38 -0
- package/src/forge/compiler/integration/templates/types.ts +3 -0
- package/src/forge/compiler/integration/templates/workos.ts +1439 -0
- package/src/forge/compiler/make-registry/build.ts +8 -9
- package/src/forge/compiler/orchestrator/fast-check.ts +4 -0
- package/src/forge/compiler/orchestrator/generate-lock.ts +14 -3
- package/src/forge/compiler/orchestrator/manifest.ts +1 -1
- package/src/forge/compiler/orchestrator/plan-profile.ts +23 -0
- package/src/forge/compiler/orchestrator/plan.ts +249 -10
- package/src/forge/compiler/orchestrator/profile.ts +65 -0
- package/src/forge/compiler/orchestrator/run.ts +101 -33
- package/src/forge/compiler/orchestrator/serialize.ts +33 -8
- package/src/forge/compiler/orchestrator/types.ts +1 -1
- package/src/forge/compiler/package-graph/compiler.ts +3 -1
- package/src/forge/compiler/package-graph/constants.ts +1 -1
- package/src/forge/compiler/package-graph/dts-extractor.ts +14 -1
- package/src/forge/compiler/package-manager/adapter.ts +4 -1
- package/src/forge/compiler/package-manager/commands.ts +4 -0
- package/src/forge/compiler/package-manager/executor.ts +30 -1
- package/src/forge/compiler/package-manager/version.ts +36 -12
- package/src/forge/compiler/package-upgrades/planner.ts +155 -18
- package/src/forge/compiler/package-upgrades/types.ts +2 -0
- package/src/forge/compiler/policy-registry/build.ts +47 -2
- package/src/forge/compiler/policy-registry/parse.ts +32 -2
- package/src/forge/compiler/recipes/definitions.ts +63 -0
- package/src/forge/compiler/recipes/index.ts +2 -0
- package/src/forge/compiler/recipes/profiles.ts +81 -0
- package/src/forge/compiler/recipes/registry.ts +6 -0
- package/src/forge/compiler/test-graph/build.ts +11 -3
- package/src/forge/compiler/types/app-graph.ts +8 -2
- package/src/forge/compiler/types/cli.ts +76 -1
- package/src/forge/compiler/types/dev-manifest.ts +4 -0
- package/src/forge/compiler/types/emit.ts +2 -0
- package/src/forge/compiler/types/frontend-graph.ts +2 -2
- package/src/forge/compiler/types/integration.ts +1 -0
- package/src/forge/compiler/types/package-graph.ts +6 -0
- package/src/forge/compiler/types/policy-registry.ts +3 -1
- package/src/forge/delta/broker-runner.mjs +5 -0
- package/src/forge/delta/broker.ts +429 -0
- package/src/forge/delta/classifier.ts +52 -0
- package/src/forge/delta/explain.ts +238 -0
- package/src/forge/delta/git-observer.ts +67 -0
- package/src/forge/delta/ids.ts +44 -0
- package/src/forge/delta/index.ts +25 -0
- package/src/forge/delta/process-identity.ts +37 -0
- package/src/forge/delta/queue-status.ts +190 -0
- package/src/forge/delta/recorder.ts +540 -0
- package/src/forge/delta/redaction.ts +50 -0
- package/src/forge/delta/schema.ts +240 -0
- package/src/forge/delta/session.ts +142 -0
- package/src/forge/delta/status.ts +1139 -0
- package/src/forge/delta/store.ts +3329 -0
- package/src/forge/delta/timeline.ts +178 -0
- package/src/forge/dev/server.ts +1061 -22
- package/src/forge/dev/types.ts +15 -1
- package/src/forge/dev/watch.ts +17 -7
- package/src/forge/dev-console/cycle.ts +285 -33
- package/src/forge/dev-console/types.ts +47 -1
- package/src/forge/impact/index.ts +222 -30
- package/src/forge/impact/types.ts +33 -1
- package/src/forge/intent/index.ts +35 -16
- package/src/forge/make/fields.ts +26 -0
- package/src/forge/make/index.ts +42 -6
- package/src/forge/make/templates.ts +211 -4
- package/src/forge/make/types.ts +2 -1
- package/src/forge/policy.ts +1 -1
- package/src/forge/react/index.ts +160 -2
- package/src/forge/refactor/index.ts +1 -0
- package/src/forge/repair/rules/index.ts +2 -2
- package/src/forge/repository-analysis/adapters/common.ts +72 -0
- package/src/forge/repository-analysis/adapters/docker.ts +185 -0
- package/src/forge/repository-analysis/adapters/java.ts +133 -0
- package/src/forge/repository-analysis/adapters/typescript.ts +350 -0
- package/src/forge/repository-analysis/adapters/vue.ts +71 -0
- package/src/forge/repository-analysis/analyze.ts +434 -0
- package/src/forge/repository-analysis/benchmark.ts +336 -0
- package/src/forge/repository-analysis/cache-gc.ts +154 -0
- package/src/forge/repository-analysis/check-selection.ts +123 -0
- package/src/forge/repository-analysis/context-node.ts +17 -0
- package/src/forge/repository-analysis/context.ts +456 -0
- package/src/forge/repository-analysis/http-resolution.ts +135 -0
- package/src/forge/repository-analysis/identity.ts +45 -0
- package/src/forge/repository-analysis/index.ts +18 -0
- package/src/forge/repository-analysis/nuxt-resolution.ts +188 -0
- package/src/forge/repository-analysis/quality.ts +60 -0
- package/src/forge/repository-analysis/retrieval.ts +309 -0
- package/src/forge/repository-analysis/runtime-artifacts.ts +195 -0
- package/src/forge/repository-analysis/runtime-observation.ts +325 -0
- package/src/forge/repository-analysis/scanner.ts +174 -0
- package/src/forge/repository-analysis/storage.ts +193 -0
- package/src/forge/repository-analysis/test-associations.ts +59 -0
- package/src/forge/repository-analysis/types.ts +99 -0
- package/src/forge/repository-manifest/index.ts +178 -0
- package/src/forge/repository-manifest/types.ts +63 -0
- package/src/forge/review/index.ts +162 -12
- package/src/forge/review/types.ts +15 -0
- package/src/forge/runtime/ai/providers.ts +19 -4
- package/src/forge/runtime/auth/config.ts +17 -0
- package/src/forge/runtime/auth/evaluate.ts +15 -2
- package/src/forge/runtime/auth/resolve.ts +61 -6
- package/src/forge/runtime/auth/types.ts +1 -0
- package/src/forge/runtime/db/factory.ts +1 -3
- package/src/forge/runtime/db/generated-client.ts +13 -2
- package/src/forge/runtime/db/memory-adapter.ts +139 -32
- package/src/forge/runtime/db/pglite-adapter.ts +285 -2
- package/src/forge/runtime/executor.ts +129 -16
- package/src/forge/runtime/external/bridge.ts +663 -0
- package/src/forge/runtime/runner/run-entry.ts +16 -7
- package/src/forge/runtime/telemetry/buffer.ts +4 -1
- package/src/forge/runtime/telemetry/scrubber.ts +35 -5
- package/src/forge/runtime/webhooks/security.ts +12 -7
- package/src/forge/server.ts +71 -7
- package/src/forge/ui/index.ts +831 -19
- package/src/forge/ui/types.ts +3 -1
- package/src/forge/version.ts +1 -1
- package/src/forge/vue/index.ts +422 -0
- package/src/forge/workspace/baseline.ts +112 -0
- package/src/forge/workspace/change-summary.ts +292 -0
- package/src/forge/workspace/forge-cli.ts +42 -0
- package/src/forge/workspace/git-summary.ts +393 -0
- package/templates/agent-workroom/AGENTS.md +29 -0
- package/templates/agent-workroom/README.md +34 -0
- package/templates/agent-workroom/forge.config.ts +3 -0
- package/templates/agent-workroom/package.json +34 -0
- package/templates/agent-workroom/pnpm-workspace.yaml +2 -0
- package/templates/agent-workroom/src/actions/indexAgentSignal.ts +10 -0
- package/templates/agent-workroom/src/commands/openWorkroom.ts +61 -0
- package/templates/agent-workroom/src/commands/recordAgentSignal.ts +119 -0
- package/templates/agent-workroom/src/commands/recordCheckRun.ts +52 -0
- package/templates/agent-workroom/src/forge/schema.ts +54 -0
- package/templates/agent-workroom/src/policies.ts +6 -0
- package/templates/agent-workroom/src/queries/listWorkrooms.ts +11 -0
- package/templates/agent-workroom/src/queries/liveWorkroom.ts +63 -0
- package/templates/agent-workroom/tsconfig.json +16 -0
- package/templates/agent-workroom/web/index.html +13 -0
- package/templates/agent-workroom/web/package.json +21 -0
- package/templates/agent-workroom/web/src/App.tsx +345 -0
- package/templates/agent-workroom/web/src/lib/forge.ts +20 -0
- package/templates/agent-workroom/web/src/main.tsx +13 -0
- package/templates/agent-workroom/web/src/styles.css +545 -0
- package/templates/agent-workroom/web/tsconfig.json +27 -0
- package/templates/agent-workroom/web/vite.config.ts +36 -0
- package/templates/b2b-support-web/package.json +2 -0
- package/templates/b2b-support-web/pnpm-workspace.yaml +2 -0
- package/templates/b2b-support-web/web/app/page.tsx +2 -2
- package/templates/b2b-support-web/web/lib/forge.ts +9 -2
- package/templates/b2b-support-web/web/next.config.ts +24 -0
- package/templates/b2b-support-web/web/package.json +1 -1
- package/templates/minimal-web/package.json +2 -1
- package/templates/minimal-web/pnpm-workspace.yaml +2 -0
- package/templates/minimal-web/web/index.html +1 -0
- package/templates/minimal-web/web/src/App.tsx +12 -6
- package/templates/minimal-web/web/src/lib/forge.ts +9 -2
- package/templates/minimal-web/web/src/styles.css +34 -0
- package/templates/minimal-web/web/vite.config.ts +36 -0
- package/templates/nuxt-web/.vscode/settings.json +14 -0
- package/templates/nuxt-web/.yarnrc.yml +1 -0
- package/templates/nuxt-web/README.md +30 -0
- package/templates/nuxt-web/forge.config.ts +3 -0
- package/templates/nuxt-web/package.json +37 -0
- package/templates/nuxt-web/pnpm-workspace.yaml +2 -0
- package/templates/nuxt-web/src/actions/logNoteCreated.ts +11 -0
- package/templates/nuxt-web/src/commands/createNote.ts +26 -0
- package/templates/nuxt-web/src/forge/schema.ts +12 -0
- package/templates/nuxt-web/src/policies.ts +6 -0
- package/templates/nuxt-web/src/queries/listNotes.ts +8 -0
- package/templates/nuxt-web/src/queries/liveNotes.ts +8 -0
- package/templates/nuxt-web/tsconfig.json +17 -0
- package/templates/nuxt-web/web/app.vue +67 -0
- package/templates/nuxt-web/web/components/LiveNotes.vue +89 -0
- package/templates/nuxt-web/web/components/NoteComposer.vue +100 -0
- package/templates/nuxt-web/web/composables/forge.ts +13 -0
- package/templates/nuxt-web/web/composables/useNotes.ts +24 -0
- package/templates/nuxt-web/web/nuxt.config.ts +11 -0
- package/templates/nuxt-web/web/package.json +22 -0
- package/templates/nuxt-web/web/plugins/forge.client.ts +10 -0
- package/templates/nuxt-web/web/plugins/forge.server.ts +10 -0
- package/templates/nuxt-web/web/server/api/forge-health.get.ts +7 -0
- package/templates/nuxt-web/web/tsconfig.json +6 -0
- package/templates/vendor-access/.vscode/settings.json +14 -0
- package/templates/vendor-access/README.md +30 -0
- package/templates/vendor-access/forge.config.ts +3 -0
- package/templates/vendor-access/package.json +35 -0
- package/templates/vendor-access/pnpm-workspace.yaml +2 -0
- package/templates/vendor-access/src/commands/addEvidence.ts +42 -0
- package/templates/vendor-access/src/commands/approveAccessRequest.ts +43 -0
- package/templates/vendor-access/src/commands/createAccessRequest.ts +49 -0
- package/templates/vendor-access/src/commands/seedVendorAccessDemo.ts +200 -0
- package/templates/vendor-access/src/forge/schema.ts +74 -0
- package/templates/vendor-access/src/policies.ts +11 -0
- package/templates/vendor-access/src/queries/listVendorAccessDashboard.ts +24 -0
- package/templates/vendor-access/src/queries/liveVendorAccessDashboard.ts +24 -0
- package/templates/vendor-access/tsconfig.json +17 -0
- package/templates/vendor-access/web/index.html +13 -0
- package/templates/vendor-access/web/package.json +21 -0
- package/templates/vendor-access/web/src/App.tsx +573 -0
- package/templates/vendor-access/web/src/lib/forge.ts +20 -0
- package/templates/vendor-access/web/src/main.tsx +205 -0
- package/templates/vendor-access/web/src/styles.css +682 -0
- package/templates/vendor-access/web/tsconfig.json +18 -0
- package/templates/vendor-access/web/vite.config.ts +36 -0
- package/src/forge/_generated/actionSubscriptions.json +0 -2
- package/src/forge/_generated/actionSubscriptions.ts +0 -10
- package/src/forge/_generated/agentAdapterManifest.json +0 -2
- package/src/forge/_generated/agentAdapterManifest.ts +0 -73
- package/src/forge/_generated/agentContract.json +0 -2
- package/src/forge/_generated/agentContract.ts +0 -7829
- package/src/forge/_generated/agentQuickstart.md +0 -34
- package/src/forge/_generated/agentTools.json +0 -2
- package/src/forge/_generated/agentTools.md +0 -16
- package/src/forge/_generated/agentTools.ts +0 -12
- package/src/forge/_generated/aiContext.ts +0 -125
- package/src/forge/_generated/aiModels.json +0 -2
- package/src/forge/_generated/aiModels.ts +0 -51
- package/src/forge/_generated/aiProviders.json +0 -2
- package/src/forge/_generated/aiProviders.ts +0 -23
- package/src/forge/_generated/aiRegistry.json +0 -2
- package/src/forge/_generated/aiRegistry.ts +0 -31
- package/src/forge/_generated/api.json +0 -2
- package/src/forge/_generated/api.ts +0 -8
- package/src/forge/_generated/appGraph.json +0 -2
- package/src/forge/_generated/appGraph.ts +0 -14937
- package/src/forge/_generated/appMap.md +0 -55
- package/src/forge/_generated/artifactManifest.json +0 -2
- package/src/forge/_generated/artifactManifest.ts +0 -7
- package/src/forge/_generated/authClaims.json +0 -2
- package/src/forge/_generated/authClaims.ts +0 -13
- package/src/forge/_generated/authConfig.json +0 -2
- package/src/forge/_generated/authConfig.ts +0 -17
- package/src/forge/_generated/authContext.ts +0 -23
- package/src/forge/_generated/authRegistry.json +0 -2
- package/src/forge/_generated/authRegistry.ts +0 -25
- package/src/forge/_generated/buildInfo.json +0 -2
- package/src/forge/_generated/buildInfo.ts +0 -9
- package/src/forge/_generated/capabilityMap.json +0 -2
- package/src/forge/_generated/capabilityMap.md +0 -15
- package/src/forge/_generated/capabilityMap.ts +0 -17
- package/src/forge/_generated/client.ts +0 -282
- package/src/forge/_generated/clientApi.ts +0 -9
- package/src/forge/_generated/clientManifest.json +0 -2
- package/src/forge/_generated/clientManifest.ts +0 -39
- package/src/forge/_generated/clientTypes.ts +0 -78
- package/src/forge/_generated/configRegistry.json +0 -2
- package/src/forge/_generated/configRegistry.ts +0 -4
- package/src/forge/_generated/dataGraph.json +0 -2
- package/src/forge/_generated/dataGraph.ts +0 -8
- package/src/forge/_generated/db.json +0 -2
- package/src/forge/_generated/db.ts +0 -2
- package/src/forge/_generated/dbSecurityManifest.json +0 -2
- package/src/forge/_generated/dbSecurityManifest.ts +0 -15
- package/src/forge/_generated/dbSessionContext.json +0 -2
- package/src/forge/_generated/dbSessionContext.ts +0 -39
- package/src/forge/_generated/deployManifest.json +0 -2
- package/src/forge/_generated/deployManifest.ts +0 -14
- package/src/forge/_generated/devManifest.json +0 -2
- package/src/forge/_generated/devManifest.ts +0 -62
- package/src/forge/_generated/envSchema.json +0 -2
- package/src/forge/_generated/envSchema.ts +0 -59
- package/src/forge/_generated/frontendGraph.json +0 -2
- package/src/forge/_generated/frontendGraph.ts +0 -27
- package/src/forge/_generated/importGuards.json +0 -2
- package/src/forge/_generated/importGuards.ts +0 -686
- package/src/forge/_generated/index.ts +0 -68
- package/src/forge/_generated/liveProductionManifest.json +0 -2
- package/src/forge/_generated/liveProductionManifest.ts +0 -23
- package/src/forge/_generated/liveProtocol.json +0 -2
- package/src/forge/_generated/liveProtocol.ts +0 -21
- package/src/forge/_generated/liveQueryRegistry.json +0 -2
- package/src/forge/_generated/liveQueryRegistry.ts +0 -9
- package/src/forge/_generated/liveTransportConfig.json +0 -2
- package/src/forge/_generated/liveTransportConfig.ts +0 -19
- package/src/forge/_generated/makeRegistry.json +0 -2
- package/src/forge/_generated/makeRegistry.ts +0 -177
- package/src/forge/_generated/makeTemplates.json +0 -2
- package/src/forge/_generated/makeTemplates.ts +0 -66
- package/src/forge/_generated/mockMap.json +0 -2
- package/src/forge/_generated/mockMap.ts +0 -7
- package/src/forge/_generated/operationPlaybooks.md +0 -167
- package/src/forge/_generated/packageGraph.json +0 -2
- package/src/forge/_generated/packageGraph.ts +0 -249334
- package/src/forge/_generated/packageUpgradeRegistry.json +0 -2
- package/src/forge/_generated/packageUpgradeRegistry.ts +0 -15
- package/src/forge/_generated/permissionMatrix.json +0 -2
- package/src/forge/_generated/permissionMatrix.ts +0 -7
- package/src/forge/_generated/policyRegistry.json +0 -2
- package/src/forge/_generated/policyRegistry.ts +0 -11
- package/src/forge/_generated/queryRegistry.json +0 -2
- package/src/forge/_generated/queryRegistry.ts +0 -9
- package/src/forge/_generated/react.d.ts +0 -22
- package/src/forge/_generated/react.ts +0 -29
- package/src/forge/_generated/reactManifest.json +0 -2
- package/src/forge/_generated/reactManifest.ts +0 -19
- package/src/forge/_generated/rlsPolicies.json +0 -2
- package/src/forge/_generated/rlsPolicies.sql +0 -34
- package/src/forge/_generated/rlsPolicies.ts +0 -6
- package/src/forge/_generated/runtimeGraph.json +0 -2
- package/src/forge/_generated/runtimeGraph.ts +0 -8
- package/src/forge/_generated/runtimeMatrix.json +0 -2
- package/src/forge/_generated/runtimeMatrix.ts +0 -334130
- package/src/forge/_generated/runtimeRegistry.ts +0 -2
- package/src/forge/_generated/runtimeRules.md +0 -91
- package/src/forge/_generated/secretRegistry.json +0 -2
- package/src/forge/_generated/secretRegistry.ts +0 -50
- package/src/forge/_generated/secretsContext.ts +0 -11
- package/src/forge/_generated/serverApi.ts +0 -10
- package/src/forge/_generated/sourceMapManifest.json +0 -2
- package/src/forge/_generated/sourceMapManifest.ts +0 -7
- package/src/forge/_generated/sqlPlan.json +0 -2
- package/src/forge/_generated/sqlPlan.ts +0 -88
- package/src/forge/_generated/subscriptionManifest.json +0 -2
- package/src/forge/_generated/subscriptionManifest.ts +0 -7
- package/src/forge/_generated/symbolicationManifest.json +0 -2
- package/src/forge/_generated/symbolicationManifest.ts +0 -17
- package/src/forge/_generated/telemetryRegistry.json +0 -2
- package/src/forge/_generated/telemetryRegistry.ts +0 -9
- package/src/forge/_generated/telemetrySinks.json +0 -2
- package/src/forge/_generated/telemetrySinks.ts +0 -11
- package/src/forge/_generated/tenantScope.json +0 -2
- package/src/forge/_generated/tenantScope.ts +0 -8
- package/src/forge/_generated/testGraph.json +0 -2
- package/src/forge/_generated/testGraph.ts +0 -3452
- package/src/forge/_generated/testPlanRegistry.json +0 -2
- package/src/forge/_generated/testPlanRegistry.ts +0 -33
- package/src/forge/_generated/uiRoutes.json +0 -2
- package/src/forge/_generated/uiRoutes.ts +0 -16
- package/src/forge/_generated/uiScenarios.json +0 -2
- package/src/forge/_generated/uiScenarios.ts +0 -30
- package/src/forge/_generated/uiTestManifest.json +0 -2
- package/src/forge/_generated/uiTestManifest.ts +0 -27
- package/src/forge/_generated/workflowRegistry.json +0 -2
- package/src/forge/_generated/workflowRegistry.ts +0 -9
- package/src/forge/_generated/workflowSubscriptions.json +0 -2
- package/src/forge/_generated/workflowSubscriptions.ts +0 -10
|
@@ -9,8 +9,16 @@ export type AgentSubcommand =
|
|
|
9
9
|
| "export"
|
|
10
10
|
| "check"
|
|
11
11
|
| "doctor"
|
|
12
|
+
| "onboard"
|
|
12
13
|
| "print-context"
|
|
13
|
-
| "clean"
|
|
14
|
+
| "clean"
|
|
15
|
+
| "prepare"
|
|
16
|
+
| "hooks"
|
|
17
|
+
| "install"
|
|
18
|
+
| "ingest"
|
|
19
|
+
| "context"
|
|
20
|
+
| "memory"
|
|
21
|
+
| "timeline";
|
|
14
22
|
|
|
15
23
|
export interface AgentCommandOptions {
|
|
16
24
|
subcommand: AgentSubcommand;
|
|
@@ -19,9 +27,22 @@ export interface AgentCommandOptions {
|
|
|
19
27
|
target: AgentAdapterTarget;
|
|
20
28
|
dryRun: boolean;
|
|
21
29
|
force: boolean;
|
|
30
|
+
mcpServer?: string;
|
|
22
31
|
preserveUserSections: boolean;
|
|
23
32
|
skills: boolean;
|
|
24
33
|
rules: boolean;
|
|
34
|
+
eventName?: string;
|
|
35
|
+
hookAction?: "smoke" | "status" | string;
|
|
36
|
+
input?: unknown;
|
|
37
|
+
entry?: string;
|
|
38
|
+
change?: string;
|
|
39
|
+
proof?: string;
|
|
40
|
+
handoff?: boolean;
|
|
41
|
+
current?: boolean;
|
|
42
|
+
limit?: number;
|
|
43
|
+
watch?: boolean;
|
|
44
|
+
file?: string;
|
|
45
|
+
pollIntervalMs?: number;
|
|
25
46
|
}
|
|
26
47
|
|
|
27
48
|
export interface AgentExportFile {
|
|
@@ -119,9 +140,212 @@ export interface AgentPrintContextResult {
|
|
|
119
140
|
exitCode: 0 | 1;
|
|
120
141
|
}
|
|
121
142
|
|
|
143
|
+
export type AgentHookBridgeState = "ready" | "missing" | "not-supported" | "waiting-for-user-trust" | "memory-unavailable";
|
|
144
|
+
export type AgentHookApprovalStatus = "not-required" | "waiting-for-user-trust" | "unverified" | "trusted" | "memory-unavailable";
|
|
145
|
+
export type AgentHookNativeTrustStatus = "not-required" | "waiting-for-native-signal" | "trusted" | "memory-unavailable";
|
|
146
|
+
export type AgentHookReadinessLevel = "none" | "canary" | "trusted-native";
|
|
147
|
+
|
|
122
148
|
export interface AgentDoctorResult {
|
|
123
149
|
ok: boolean;
|
|
150
|
+
target: AgentAdapterTarget;
|
|
151
|
+
summary: {
|
|
152
|
+
adapter: "ready" | "missing" | "stale";
|
|
153
|
+
hookBridge: AgentHookBridgeState;
|
|
154
|
+
approvalRequired: boolean;
|
|
155
|
+
approvalStatus: AgentHookApprovalStatus;
|
|
156
|
+
nativeTrustStatus: AgentHookNativeTrustStatus;
|
|
157
|
+
recentEvents: number;
|
|
158
|
+
queuedEvents?: number;
|
|
159
|
+
usefulSignals: number;
|
|
160
|
+
nativeSignals: number;
|
|
161
|
+
canarySignals: number;
|
|
162
|
+
lastEventAt?: string;
|
|
163
|
+
};
|
|
164
|
+
checks: Array<{ name: string; ok: boolean; message?: string; evidence?: unknown }>;
|
|
165
|
+
nextActions: string[];
|
|
166
|
+
diagnostics: Diagnostic[];
|
|
167
|
+
exitCode: 0 | 1;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface AgentPrepareResult {
|
|
171
|
+
ok: boolean;
|
|
172
|
+
target: AgentAdapterTarget;
|
|
173
|
+
exportResult: AgentExportResult;
|
|
174
|
+
checkResult: AgentCheckResult;
|
|
175
|
+
installResult?: unknown;
|
|
176
|
+
commands: {
|
|
177
|
+
context: string;
|
|
178
|
+
export: string;
|
|
179
|
+
check: string;
|
|
180
|
+
install?: string;
|
|
181
|
+
hooksStatus?: string;
|
|
182
|
+
hooksSmoke?: string;
|
|
183
|
+
open?: string;
|
|
184
|
+
};
|
|
185
|
+
diagnostics: Diagnostic[];
|
|
186
|
+
exitCode: 0 | 1;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export interface AgentOnboardResult {
|
|
190
|
+
schemaVersion: "0.1.0";
|
|
191
|
+
ok: boolean;
|
|
192
|
+
target: AgentAdapterTarget;
|
|
193
|
+
readyToEdit: boolean;
|
|
194
|
+
summary: {
|
|
195
|
+
adapter: "ready" | "missing" | "stale";
|
|
196
|
+
hookBridge: AgentHookBridgeState;
|
|
197
|
+
approvalRequired: boolean;
|
|
198
|
+
approvalStatus: AgentHookApprovalStatus;
|
|
199
|
+
nativeTrustStatus: AgentHookNativeTrustStatus;
|
|
200
|
+
memorySignals: number;
|
|
201
|
+
nativeSignals: number;
|
|
202
|
+
canarySignals: number;
|
|
203
|
+
generatedFresh: boolean;
|
|
204
|
+
generatedChanged: boolean;
|
|
205
|
+
generatedChangedFiles: number;
|
|
206
|
+
safeToEdit: boolean;
|
|
207
|
+
changedFiles: number;
|
|
208
|
+
primaryAction?: string;
|
|
209
|
+
};
|
|
210
|
+
steps: Array<{
|
|
211
|
+
name: string;
|
|
212
|
+
ok: boolean;
|
|
213
|
+
message: string;
|
|
214
|
+
}>;
|
|
215
|
+
recommendedReadFiles: string[];
|
|
216
|
+
commands: {
|
|
217
|
+
changed: string;
|
|
218
|
+
dev: string;
|
|
219
|
+
context: string;
|
|
220
|
+
verify: string;
|
|
221
|
+
hooksStatus?: string;
|
|
222
|
+
hooksSmoke?: string;
|
|
223
|
+
open?: string;
|
|
224
|
+
};
|
|
225
|
+
nextActions: string[];
|
|
226
|
+
diagnostics: Diagnostic[];
|
|
227
|
+
exitCode: 0 | 1;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export interface AgentHooksSmokeResult {
|
|
231
|
+
ok: boolean;
|
|
232
|
+
target: AgentAdapterTarget;
|
|
233
|
+
installTarget?: string;
|
|
234
|
+
smokeReady: boolean;
|
|
235
|
+
trustedNativeReady: boolean;
|
|
236
|
+
readinessLevel: AgentHookReadinessLevel;
|
|
237
|
+
installed: boolean;
|
|
238
|
+
bridgeWritable: boolean;
|
|
239
|
+
deltaWritable: boolean;
|
|
240
|
+
visibleInMemory: boolean;
|
|
241
|
+
usefulSignals: number;
|
|
242
|
+
nativeSignals: number;
|
|
243
|
+
canarySignals: number;
|
|
244
|
+
approvalRequired: boolean;
|
|
245
|
+
approvalStatus: AgentHookApprovalStatus;
|
|
246
|
+
nativeTrustStatus: AgentHookNativeTrustStatus;
|
|
247
|
+
lastSignal?: {
|
|
248
|
+
kind: string;
|
|
249
|
+
summary?: string;
|
|
250
|
+
capturedAt: string;
|
|
251
|
+
workspaceRoot?: string;
|
|
252
|
+
};
|
|
253
|
+
canary?: {
|
|
254
|
+
marker: string;
|
|
255
|
+
source: string;
|
|
256
|
+
eventName: string;
|
|
257
|
+
ingestedEventId?: string;
|
|
258
|
+
memoryEventsChecked: number;
|
|
259
|
+
visible: boolean;
|
|
260
|
+
};
|
|
261
|
+
hookRunnerProbe?: {
|
|
262
|
+
ok: boolean;
|
|
263
|
+
durationMs: number;
|
|
264
|
+
exitCode: number | null;
|
|
265
|
+
queued: boolean;
|
|
266
|
+
stdinHangSafe: boolean;
|
|
267
|
+
stdinHangDurationMs?: number;
|
|
268
|
+
error?: string;
|
|
269
|
+
};
|
|
124
270
|
checks: Array<{ name: string; ok: boolean; message?: string }>;
|
|
271
|
+
nextActions: string[];
|
|
272
|
+
installResult?: unknown;
|
|
273
|
+
ingestResult?: unknown;
|
|
274
|
+
diagnostics: Diagnostic[];
|
|
275
|
+
exitCode: 0 | 1;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export interface AgentHooksStatusResult {
|
|
279
|
+
ok: boolean;
|
|
280
|
+
target: AgentAdapterTarget;
|
|
281
|
+
installTarget?: string;
|
|
282
|
+
installed: boolean;
|
|
283
|
+
bridgeWritable: boolean;
|
|
284
|
+
deltaWritable: boolean;
|
|
285
|
+
visibleInMemory: boolean;
|
|
286
|
+
recentEvents: number;
|
|
287
|
+
queuedEvents?: number;
|
|
288
|
+
usefulSignals: number;
|
|
289
|
+
nativeSignals: number;
|
|
290
|
+
canarySignals: number;
|
|
291
|
+
approvalRequired: boolean;
|
|
292
|
+
approvalStatus: AgentHookApprovalStatus;
|
|
293
|
+
nativeTrustStatus: AgentHookNativeTrustStatus;
|
|
294
|
+
lastSignal?: {
|
|
295
|
+
kind: string;
|
|
296
|
+
summary?: string;
|
|
297
|
+
capturedAt: string;
|
|
298
|
+
workspaceRoot?: string;
|
|
299
|
+
};
|
|
300
|
+
workspaceRoot?: string;
|
|
301
|
+
ignoredOutOfWorkspaceEvents?: number;
|
|
302
|
+
checks: Array<{ name: string; ok: boolean; message?: string; evidence?: unknown }>;
|
|
303
|
+
nextActions: string[];
|
|
304
|
+
installResult?: unknown;
|
|
305
|
+
diagnostics: Diagnostic[];
|
|
306
|
+
exitCode: 0 | 1;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export interface AgentTimelineItem {
|
|
310
|
+
id: string;
|
|
311
|
+
source: string;
|
|
312
|
+
integration: string;
|
|
313
|
+
trustLevel: string;
|
|
314
|
+
kind: string;
|
|
315
|
+
capturedAt: string;
|
|
316
|
+
sessionId?: string;
|
|
317
|
+
turnId?: string;
|
|
318
|
+
summary?: string;
|
|
319
|
+
toolName?: string;
|
|
320
|
+
command?: string;
|
|
321
|
+
status?: string;
|
|
322
|
+
files: string[];
|
|
323
|
+
entries: string[];
|
|
324
|
+
proofs: string[];
|
|
325
|
+
confidence: number;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export interface AgentTimelineResult {
|
|
329
|
+
schemaVersion: "0.1.0";
|
|
330
|
+
ok: boolean;
|
|
331
|
+
timeline: "agent";
|
|
332
|
+
target: AgentAdapterTarget;
|
|
333
|
+
sourceFilter?: string;
|
|
334
|
+
summary: {
|
|
335
|
+
events: number;
|
|
336
|
+
sessions: number;
|
|
337
|
+
files: number;
|
|
338
|
+
entries: number;
|
|
339
|
+
proofs: number;
|
|
340
|
+
tools: number;
|
|
341
|
+
latestEventAt?: string;
|
|
342
|
+
};
|
|
343
|
+
events: AgentTimelineItem[];
|
|
344
|
+
files: string[];
|
|
345
|
+
entries: string[];
|
|
346
|
+
proofs: string[];
|
|
347
|
+
sessions: string[];
|
|
348
|
+
nextActions: string[];
|
|
125
349
|
diagnostics: Diagnostic[];
|
|
126
350
|
exitCode: 0 | 1;
|
|
127
351
|
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { AgentFabricError } from "./errors.ts";
|
|
2
|
+
import type {
|
|
3
|
+
AdapterManifest,
|
|
4
|
+
AdapterOutcomeResult,
|
|
5
|
+
AdapterStartResult,
|
|
6
|
+
AgentAdapter,
|
|
7
|
+
AttemptExecutionPermit,
|
|
8
|
+
Digest,
|
|
9
|
+
RuntimeObservation,
|
|
10
|
+
WorkerResultReport,
|
|
11
|
+
} from "./types.ts";
|
|
12
|
+
|
|
13
|
+
export interface DeterministicAdapterFixture {
|
|
14
|
+
effectiveRunSpecDigest: Digest;
|
|
15
|
+
outcomeStatus: "succeeded" | "failed";
|
|
16
|
+
resultDigest: Digest;
|
|
17
|
+
evidenceDigests?: readonly Digest[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface AttemptRecord {
|
|
21
|
+
permit: AttemptExecutionPermit;
|
|
22
|
+
startedAt: number;
|
|
23
|
+
cancelled: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export class DeterministicTestAdapter implements AgentAdapter {
|
|
27
|
+
private readonly fixtures = new Map<Digest, DeterministicAdapterFixture>();
|
|
28
|
+
private readonly attempts = new Map<string, AttemptRecord>();
|
|
29
|
+
|
|
30
|
+
constructor(
|
|
31
|
+
fixtures: readonly DeterministicAdapterFixture[],
|
|
32
|
+
private readonly now: () => number,
|
|
33
|
+
) {
|
|
34
|
+
for (const fixture of fixtures) this.fixtures.set(fixture.effectiveRunSpecDigest, fixture);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
manifest(): AdapterManifest {
|
|
38
|
+
return {
|
|
39
|
+
adapterId: "forge-agent-fabric/deterministic-test-adapter",
|
|
40
|
+
version: "0.1.0",
|
|
41
|
+
capabilities: ["deterministic_fixture_execution", "observation", "cancellation"],
|
|
42
|
+
supportsCancellation: true,
|
|
43
|
+
supportsObservation: true,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async startAttempt(permit: AttemptExecutionPermit): Promise<AdapterStartResult> {
|
|
48
|
+
const existing = this.attempts.get(permit.attemptId);
|
|
49
|
+
if (existing) {
|
|
50
|
+
if (existing.permit.permitId !== permit.permitId) {
|
|
51
|
+
throw new AgentFabricError(
|
|
52
|
+
"AF_CONFLICT",
|
|
53
|
+
`Attempt ${permit.attemptId} was started with a different permit`,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
status: "started",
|
|
58
|
+
report: {
|
|
59
|
+
startupReportId: `startup:${permit.attemptId}`,
|
|
60
|
+
attemptId: permit.attemptId,
|
|
61
|
+
observedSpecDigest: permit.effectiveRunSpecDigest,
|
|
62
|
+
startedAt: existing.startedAt,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (!this.fixtures.has(permit.effectiveRunSpecDigest)) {
|
|
67
|
+
return { status: "unknown", reason: "fixture_not_found" };
|
|
68
|
+
}
|
|
69
|
+
const startedAt = this.now();
|
|
70
|
+
this.attempts.set(permit.attemptId, { permit, startedAt, cancelled: false });
|
|
71
|
+
return {
|
|
72
|
+
status: "started",
|
|
73
|
+
report: {
|
|
74
|
+
startupReportId: `startup:${permit.attemptId}`,
|
|
75
|
+
attemptId: permit.attemptId,
|
|
76
|
+
observedSpecDigest: permit.effectiveRunSpecDigest,
|
|
77
|
+
startedAt,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async observeAttempt(attemptId: string): Promise<readonly RuntimeObservation[]> {
|
|
83
|
+
const attempt = this.attempts.get(attemptId);
|
|
84
|
+
if (!attempt) return [];
|
|
85
|
+
return [
|
|
86
|
+
{
|
|
87
|
+
observationId: `observation:${attemptId}:adapter-state`,
|
|
88
|
+
attemptId,
|
|
89
|
+
sourceClass: "adapter_observation",
|
|
90
|
+
claim: attempt.cancelled ? "cancelled" : "running_or_completed",
|
|
91
|
+
observedAt: this.now(),
|
|
92
|
+
},
|
|
93
|
+
];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async collectOutcome(attemptId: string): Promise<AdapterOutcomeResult> {
|
|
97
|
+
const attempt = this.attempts.get(attemptId);
|
|
98
|
+
if (!attempt) return { status: "unknown", reason: "attempt_not_observed" };
|
|
99
|
+
if (attempt.cancelled) return { status: "unknown", reason: "attempt_cancelled" };
|
|
100
|
+
const fixture = this.fixtures.get(attempt.permit.effectiveRunSpecDigest);
|
|
101
|
+
if (!fixture) return { status: "unknown", reason: "fixture_not_found" };
|
|
102
|
+
const permit = attempt.permit;
|
|
103
|
+
const report: WorkerResultReport = {
|
|
104
|
+
reportId: `report:${attemptId}`,
|
|
105
|
+
attemptId,
|
|
106
|
+
permitId: permit.permitId,
|
|
107
|
+
intentId: permit.intentId,
|
|
108
|
+
planRevisionId: permit.planRevisionId,
|
|
109
|
+
effectiveRunSpecDigest: permit.effectiveRunSpecDigest,
|
|
110
|
+
fencingToken: permit.fencingToken,
|
|
111
|
+
status: fixture.outcomeStatus,
|
|
112
|
+
resultDigest: fixture.resultDigest,
|
|
113
|
+
evidenceDigests: fixture.evidenceDigests ?? [],
|
|
114
|
+
reportedAt: this.now(),
|
|
115
|
+
};
|
|
116
|
+
return { status: "reported", report };
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async requestCancellation(attemptId: string): Promise<{ acknowledged: boolean }> {
|
|
120
|
+
const attempt = this.attempts.get(attemptId);
|
|
121
|
+
if (!attempt) return { acknowledged: false };
|
|
122
|
+
attempt.cancelled = true;
|
|
123
|
+
return { acknowledged: true };
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async observeTermination(attemptId: string): Promise<"terminated" | "running" | "unknown"> {
|
|
127
|
+
const attempt = this.attempts.get(attemptId);
|
|
128
|
+
if (!attempt) return "unknown";
|
|
129
|
+
return attempt.cancelled ? "terminated" : "running";
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { execFile } from "node:child_process";
|
|
3
|
+
import { lstat, readFile } from "node:fs/promises";
|
|
4
|
+
import { join, resolve, relative } from "node:path";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
import { stableStringify } from "./canonical.ts";
|
|
7
|
+
import { attachedFail, attachedScope, type AttachedSnapshot } from "./attached-task-contract.ts";
|
|
8
|
+
|
|
9
|
+
const exec = promisify(execFile);
|
|
10
|
+
export function attachedDigest(value: string | Buffer): string { return createHash("sha256").update(value).digest("hex"); }
|
|
11
|
+
async function git(root: string, args: string[]): Promise<string> {
|
|
12
|
+
const result = await exec("git", args, { cwd: root, windowsHide: true, encoding: "utf8", maxBuffer: 8 * 1024 * 1024, timeout: 10000 });
|
|
13
|
+
return result.stdout;
|
|
14
|
+
}
|
|
15
|
+
export async function attachedHead(root: string): Promise<string> { return (await git(root, ["rev-parse", "HEAD"])).trim(); }
|
|
16
|
+
export async function assertAttachedSafePath(root: string, target: string): Promise<void> {
|
|
17
|
+
const rel = relative(resolve(root), resolve(target));
|
|
18
|
+
if (rel.startsWith("..") || resolve(target) === resolve(root)) attachedFail("AF_ATTACHED_PATH", "Path escapes repository");
|
|
19
|
+
let path = resolve(root);
|
|
20
|
+
for (const part of rel.split(/[\\/]/u)) {
|
|
21
|
+
path = join(path, part);
|
|
22
|
+
try { if ((await lstat(path)).isSymbolicLink()) attachedFail("AF_ATTACHED_PATH", "Symlink paths are unsupported"); }
|
|
23
|
+
catch (error) { if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error; }
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/** Hashes actual working files, including nonignored untracked files and deletions. */
|
|
27
|
+
export async function captureAttachedSnapshot(root: string, scopeInput: string[], baseHead: string): Promise<AttachedSnapshot> {
|
|
28
|
+
const scope = attachedScope(scopeInput);
|
|
29
|
+
const currentHead = await attachedHead(root);
|
|
30
|
+
const listing = await git(root, ["--literal-pathspecs", "ls-files", "-z", "--cached", "--others", "--exclude-standard", "--", ...scope]);
|
|
31
|
+
const paths = [...new Set(listing.split("\0").filter(Boolean))].filter((path) => !path.startsWith(".forge/local/")).sort();
|
|
32
|
+
if (paths.length > 4000) attachedFail("AF_ATTACHED_SNAPSHOT_LIMIT", "Scope exceeds 4000 files");
|
|
33
|
+
let size = 0;
|
|
34
|
+
const files: AttachedSnapshot["files"] = [];
|
|
35
|
+
for (const path of paths) {
|
|
36
|
+
const absolute = join(root, path);
|
|
37
|
+
await assertAttachedSafePath(root, absolute);
|
|
38
|
+
try {
|
|
39
|
+
const stat = await lstat(absolute);
|
|
40
|
+
if (!stat.isFile()) attachedFail("AF_ATTACHED_PATH", `Unsupported snapshot entry: ${path}`);
|
|
41
|
+
size += stat.size;
|
|
42
|
+
if (stat.size > 16 * 1024 * 1024 || size > 128 * 1024 * 1024) attachedFail("AF_ATTACHED_SNAPSHOT_LIMIT", "Snapshot byte limit exceeded");
|
|
43
|
+
const bytes = await readFile(absolute);
|
|
44
|
+
const after = await lstat(absolute);
|
|
45
|
+
if (after.isSymbolicLink() || after.size !== stat.size || after.mtimeMs !== stat.mtimeMs || after.ctimeMs !== stat.ctimeMs) attachedFail("AF_ATTACHED_SNAPSHOT_CHANGED", `File changed during capture: ${path}`);
|
|
46
|
+
files.push({ path, digest: attachedDigest(bytes), mode: stat.mode & 0o111 });
|
|
47
|
+
} catch (error) {
|
|
48
|
+
if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
|
|
49
|
+
files.push({ path, digest: null, mode: null });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (currentHead !== await attachedHead(root)) attachedFail("AF_ATTACHED_SNAPSHOT_CHANGED", "Git HEAD changed during capture");
|
|
53
|
+
const content = { baseHead, currentHead, scope, files };
|
|
54
|
+
return { ...content, digest: attachedDigest(stableStringify(content)) };
|
|
55
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { stableStringify } from "./canonical.ts";
|
|
2
|
+
import { validateWorkflowState, type WorkflowState } from "./workflow-engine.ts";
|
|
3
|
+
|
|
4
|
+
export interface AttachedSnapshot {
|
|
5
|
+
digest: string;
|
|
6
|
+
baseHead: string;
|
|
7
|
+
currentHead: string;
|
|
8
|
+
scope: string[];
|
|
9
|
+
files: { path: string; digest: string | null; mode: number | null }[];
|
|
10
|
+
}
|
|
11
|
+
export interface AttachedAssignment { assignmentId: string; role: "implementer" | "reviewer"; sessionId: string; agentId: string }
|
|
12
|
+
export interface AttachedAttempt { attemptId: string; assignmentId: string; status: "running" | "succeeded" | "failed" | "uncertain" }
|
|
13
|
+
export interface AttachedReview {
|
|
14
|
+
reviewToken: string; snapshotDigest: string; reviewerAttemptId: string; implementationAttemptId: string;
|
|
15
|
+
verdict: "approved" | "changes_requested";
|
|
16
|
+
findings: { findingId: string; description: string; resolved: boolean }[];
|
|
17
|
+
provenance: "agent_reported";
|
|
18
|
+
}
|
|
19
|
+
export interface AttachedTaskState {
|
|
20
|
+
schemaVersion: 1; taskId: string; version: number; goal: string;
|
|
21
|
+
criteria: { criterionId: string; description: string }[];
|
|
22
|
+
scope: string[]; baseHead: string; requiredChecks: string[];
|
|
23
|
+
sessions: { sessionId: string; agentId: string }[];
|
|
24
|
+
assignments: AttachedAssignment[]; attempts: AttachedAttempt[];
|
|
25
|
+
preparedReviews: { reviewToken: string; snapshot: AttachedSnapshot; reviewerAttemptId: string; implementationAttemptId: string }[];
|
|
26
|
+
review?: AttachedReview;
|
|
27
|
+
verifications: { checkId: string; snapshotDigest: string; outcome: "passed" | "failed" | "inconclusive"; command: string; summary: string; provenance: "agent_reported" }[];
|
|
28
|
+
coverage: { criterionId: string; snapshotDigest: string; evidence: string; provenance: "agent_reported" }[];
|
|
29
|
+
workflow?: import("./workflow-task-actions.ts").WorkflowState;
|
|
30
|
+
workflowSnapshots?: { nodeId: string; attemptId: string; snapshotDigest: string }[];
|
|
31
|
+
}
|
|
32
|
+
export class AttachedTaskError extends Error {
|
|
33
|
+
constructor(public readonly code: string, message: string) { super(message); this.name = "AttachedTaskError"; }
|
|
34
|
+
}
|
|
35
|
+
export function attachedFail(code: string, message: string): never { throw new AttachedTaskError(code, message); }
|
|
36
|
+
export function attachedObject(value: unknown, keys: string[], maxBytes = 128 * 1024): Record<string, unknown> {
|
|
37
|
+
if (!value || typeof value !== "object" || Array.isArray(value) || Object.getPrototypeOf(value) !== Object.prototype) attachedFail("AF_ATTACHED_INPUT", "Expected a plain object");
|
|
38
|
+
const body = value as Record<string, unknown>;
|
|
39
|
+
stableStringify(body);
|
|
40
|
+
if (Buffer.byteLength(stableStringify(body)) > maxBytes) attachedFail("AF_ATTACHED_INPUT", "Payload exceeds size limit");
|
|
41
|
+
for (const key of Object.keys(body)) if (!keys.includes(key)) attachedFail("AF_ATTACHED_INPUT", `Unknown field: ${key}`);
|
|
42
|
+
return body;
|
|
43
|
+
}
|
|
44
|
+
export function attachedText(value: unknown, label: string, max = 4096): string {
|
|
45
|
+
if (typeof value !== "string" || !value.trim() || value.length > max || value.includes("\0")) attachedFail("AF_ATTACHED_INPUT", `Invalid ${label}`);
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
export function attachedId(value: unknown, label: string): string {
|
|
49
|
+
const text = attachedText(value, label, 128);
|
|
50
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9_.:-]*$/u.test(text) || ["__proto__", "constructor", "prototype"].includes(text)) attachedFail("AF_ATTACHED_INPUT", `Invalid ${label}`);
|
|
51
|
+
return text;
|
|
52
|
+
}
|
|
53
|
+
export function attachedList(value: unknown, label: string, max = 128): unknown[] {
|
|
54
|
+
if (!Array.isArray(value) || value.length > max) attachedFail("AF_ATTACHED_INPUT", `Invalid ${label}`);
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
export function attachedUnique(values: string[], label: string): void {
|
|
58
|
+
if (new Set(values).size !== values.length) attachedFail("AF_ATTACHED_INPUT", `Duplicate ${label}`);
|
|
59
|
+
}
|
|
60
|
+
export function attachedScope(value: unknown): string[] {
|
|
61
|
+
const scope = attachedList(value, "scope").map((item) => {
|
|
62
|
+
const path = attachedText(item, "scope path", 512).replace(/\\/gu, "/");
|
|
63
|
+
if (path !== "." && (path.startsWith("/") || path.split("/").some((part) => !part || part === ".." || part === "." || part === ".git") || path.includes(":"))) attachedFail("AF_ATTACHED_INPUT", "Scope must contain repository relative paths");
|
|
64
|
+
if (path.startsWith(".forge/local")) attachedFail("AF_ATTACHED_INPUT", "Runtime store cannot be task scope");
|
|
65
|
+
return path;
|
|
66
|
+
});
|
|
67
|
+
if (!scope.length) attachedFail("AF_ATTACHED_INPUT", "Scope cannot be empty");
|
|
68
|
+
attachedUnique(scope, "scope"); return scope.sort();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Validate persisted JSON before it participates in transitions. */
|
|
72
|
+
export function validateAttachedTaskState(value: unknown): AttachedTaskState {
|
|
73
|
+
const state = attachedObject(value, ["schemaVersion", "taskId", "version", "goal", "criteria", "scope", "baseHead", "requiredChecks", "sessions", "assignments", "attempts", "preparedReviews", "review", "verifications", "coverage", "workflow", "workflowSnapshots"], 16 * 1024 * 1024);
|
|
74
|
+
if (state.schemaVersion !== 1 || !Number.isSafeInteger(state.version) || (state.version as number) < 1) attachedFail("AF_ATTACHED_STORE", "Invalid task version");
|
|
75
|
+
attachedId(state.taskId, "taskId"); attachedText(state.goal, "goal"); attachedScope(state.scope);
|
|
76
|
+
if (!/^[0-9a-f]{40,64}$/u.test(attachedText(state.baseHead, "baseHead", 64))) attachedFail("AF_ATTACHED_STORE", "Invalid baseHead");
|
|
77
|
+
const criteria = attachedList(state.criteria, "criteria"); if (!criteria.length) attachedFail("AF_ATTACHED_STORE", "Missing criteria");
|
|
78
|
+
const criterionIds = criteria.map((item) => { const c = attachedObject(item, ["criterionId", "description"]); attachedText(c.description, "description"); return attachedId(c.criterionId, "criterionId"); }); attachedUnique(criterionIds, "criteria");
|
|
79
|
+
const checks = attachedList(state.requiredChecks, "checks").map((item) => attachedId(item, "checkId")); attachedUnique(checks, "checks");
|
|
80
|
+
const sessions = attachedList(state.sessions, "sessions", 2048).map((item) => { const s = attachedObject(item, ["sessionId", "agentId"]); return { sessionId: attachedId(s.sessionId, "sessionId"), agentId: attachedId(s.agentId, "agentId") }; });
|
|
81
|
+
const assignments = attachedList(state.assignments, "assignments", 2048).map((item) => { const a = attachedObject(item, ["assignmentId", "role", "sessionId", "agentId"]); attachedId(a.sessionId, "sessionId"); attachedId(a.agentId, "agentId"); if (!["implementer", "reviewer"].includes(a.role as string) || !sessions.some((s) => s.sessionId === a.sessionId && s.agentId === a.agentId)) attachedFail("AF_ATTACHED_STORE", "Invalid assignment"); return attachedId(a.assignmentId, "assignmentId"); }); attachedUnique(assignments, "assignments");
|
|
82
|
+
const attempts = attachedList(state.attempts, "attempts", 4096).map((item) => { const a = attachedObject(item, ["attemptId", "assignmentId", "status"]); if (!assignments.includes(attachedId(a.assignmentId, "assignmentId")) || !["running", "succeeded", "failed", "uncertain"].includes(a.status as string)) attachedFail("AF_ATTACHED_STORE", "Invalid attempt"); return attachedId(a.attemptId, "attemptId"); }); attachedUnique(attempts, "attempts");
|
|
83
|
+
const digest = (value: unknown) => { if (!/^[0-9a-f]{64}$/u.test(attachedText(value, "digest", 64))) attachedFail("AF_ATTACHED_STORE", "Invalid digest"); };
|
|
84
|
+
for (const item of attachedList(state.preparedReviews, "preparedReviews", 4096)) {
|
|
85
|
+
const r = attachedObject(item, ["reviewToken", "snapshot", "reviewerAttemptId", "implementationAttemptId"], 4 * 1024 * 1024);
|
|
86
|
+
attachedText(r.reviewToken, "reviewToken", 128);
|
|
87
|
+
if (!attempts.includes(attachedId(r.reviewerAttemptId, "reviewerAttemptId")) || !attempts.includes(attachedId(r.implementationAttemptId, "implementationAttemptId"))) attachedFail("AF_ATTACHED_STORE", "Unknown review attempt");
|
|
88
|
+
const s = attachedObject(r.snapshot, ["digest", "baseHead", "currentHead", "scope", "files"], 4 * 1024 * 1024);
|
|
89
|
+
digest(s.digest); attachedText(s.baseHead, "baseHead", 64); attachedText(s.currentHead, "currentHead", 64); attachedScope(s.scope);
|
|
90
|
+
const paths = attachedList(s.files, "snapshot files", 4000).map((item) => {
|
|
91
|
+
const f = attachedObject(item, ["path", "digest", "mode"]);
|
|
92
|
+
const path = attachedScope([f.path])[0]!;
|
|
93
|
+
if (f.digest !== null) digest(f.digest);
|
|
94
|
+
if ((f.digest === null) !== (f.mode === null) || (f.mode !== null && (!Number.isInteger(f.mode) || (f.mode as number) < 0 || (f.mode as number) > 0o111))) attachedFail("AF_ATTACHED_STORE", "Invalid snapshot file mode");
|
|
95
|
+
return path;
|
|
96
|
+
});
|
|
97
|
+
attachedUnique(paths, "snapshot paths");
|
|
98
|
+
}
|
|
99
|
+
if (state.review !== undefined) { const r = attachedObject(state.review, ["reviewToken", "snapshotDigest", "reviewerAttemptId", "implementationAttemptId", "verdict", "findings", "provenance"]); digest(r.snapshotDigest); attachedText(r.reviewToken, "reviewToken", 128); if (!attempts.includes(attachedId(r.reviewerAttemptId, "reviewerAttemptId")) || !attempts.includes(attachedId(r.implementationAttemptId, "implementationAttemptId")) || !["approved", "changes_requested"].includes(r.verdict as string) || r.provenance !== "agent_reported") attachedFail("AF_ATTACHED_STORE", "Invalid review"); for (const item of attachedList(r.findings, "findings")) { const f = attachedObject(item, ["findingId", "description", "resolved"]); attachedId(f.findingId, "findingId"); attachedText(f.description, "description"); if (typeof f.resolved !== "boolean") attachedFail("AF_ATTACHED_STORE", "Invalid finding"); } }
|
|
100
|
+
for (const item of attachedList(state.verifications, "verifications", 4096)) { const v = attachedObject(item, ["checkId", "snapshotDigest", "outcome", "command", "summary", "provenance"]); if (!checks.includes(attachedId(v.checkId, "checkId")) || !["passed", "failed", "inconclusive"].includes(v.outcome as string) || v.provenance !== "agent_reported") attachedFail("AF_ATTACHED_STORE", "Invalid verification"); digest(v.snapshotDigest); attachedText(v.command, "command"); attachedText(v.summary, "summary"); }
|
|
101
|
+
for (const item of attachedList(state.coverage, "coverage", 4096)) { const c = attachedObject(item, ["criterionId", "snapshotDigest", "evidence", "provenance"]); if (!criterionIds.includes(attachedId(c.criterionId, "criterionId")) || c.provenance !== "agent_reported") attachedFail("AF_ATTACHED_STORE", "Invalid coverage"); digest(c.snapshotDigest); attachedText(c.evidence, "evidence"); }
|
|
102
|
+
if (state.workflow !== undefined) validateWorkflowState(state.workflow as WorkflowState);
|
|
103
|
+
if (state.workflowSnapshots !== undefined) for (const item of attachedList(state.workflowSnapshots, "workflowSnapshots", 4096)) { const entry = attachedObject(item, ["nodeId", "attemptId", "snapshotDigest"]); attachedId(entry.nodeId, "nodeId"); attachedId(entry.attemptId, "attemptId"); digest(entry.snapshotDigest); }
|
|
104
|
+
return state as unknown as AttachedTaskState;
|
|
105
|
+
}
|