@kontourai/flow-agents 4.0.0 → 4.2.0
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/.github/workflows/ci.yml +8 -0
- package/CHANGELOG.md +34 -0
- package/CONTEXT.md +5 -0
- package/agents/tool-security-reviewer.json +1 -1
- package/build/src/cli/init.js +35 -3
- package/build/src/cli/kit.js +95 -2
- package/build/src/cli/pull-work-provider.js +7 -1
- package/build/src/cli/validate-workflow-artifacts.js +53 -0
- package/build/src/cli/workflow.js +5 -1
- package/build/src/flow-kit/provision.d.ts +23 -0
- package/build/src/flow-kit/provision.js +99 -0
- package/build/src/flow-kit/validate.d.ts +52 -0
- package/build/src/flow-kit/validate.js +214 -9
- package/build/src/runtime-adapters.js +1 -1
- package/context/contracts/execution-contract.md +30 -1
- package/context/contracts/review-contract.md +4 -0
- package/context/contracts/trigger-guards.md +73 -0
- package/context/scripts/telemetry/lib/config.sh +29 -0
- package/context/settings/backlog-provider-settings.json +1 -1
- package/context/settings/workspace-backlog-provider-settings.example.json +1 -1
- package/dist/base/build/package.json +1 -1
- package/dist/base/build/src/cli/init.js +35 -3
- package/dist/base/build/src/cli/kit.js +95 -2
- package/dist/base/build/src/cli/pull-work-provider.js +7 -1
- package/dist/base/build/src/cli/validate-workflow-artifacts.js +53 -0
- package/dist/base/build/src/cli/workflow.js +5 -1
- package/dist/base/build/src/flow-kit/provision.d.ts +23 -0
- package/dist/base/build/src/flow-kit/provision.js +99 -0
- package/dist/base/build/src/flow-kit/validate.d.ts +52 -0
- package/dist/base/build/src/flow-kit/validate.js +214 -9
- package/dist/base/build/src/runtime-adapters.js +1 -1
- package/dist/base/context/contracts/execution-contract.md +30 -1
- package/dist/base/context/contracts/review-contract.md +4 -0
- package/dist/base/context/contracts/trigger-guards.md +73 -0
- package/dist/base/context/scripts/telemetry/lib/config.sh +29 -0
- package/dist/base/context/settings/backlog-provider-settings.json +1 -1
- package/dist/base/context/settings/workspace-backlog-provider-settings.example.json +1 -1
- package/dist/base/docs/adr/0023-kit-provisioning.md +47 -0
- package/dist/base/docs/adr/index.md +1 -0
- package/dist/base/docs/architecture-engine-and-kits.md +17 -0
- package/dist/base/docs/context-map.md +3 -0
- package/dist/base/docs/decisions/backlog-readiness-source.md +89 -0
- package/dist/base/docs/decisions/index.md +1 -0
- package/dist/base/docs/developer-architecture.md +3 -3
- package/dist/base/docs/flow-kit-repository-contract.md +34 -3
- package/dist/base/docs/kit-authoring-guide.md +1 -1
- package/dist/base/docs/veritas-integration.md +12 -0
- package/dist/base/evals/ci/run-baseline.sh +4 -0
- package/dist/base/evals/integration/test_kit_provisioning.sh +112 -0
- package/dist/base/evals/integration/test_liveness_console_relay.sh +91 -1
- package/dist/base/evals/integration/test_liveness_heartbeat.sh +66 -0
- package/dist/base/evals/integration/test_pull_work_provider.sh +18 -0
- package/dist/base/evals/integration/test_veritas_governance_kit.sh +256 -0
- package/dist/base/evals/integration/test_workflow_artifacts.sh +257 -0
- package/dist/base/evals/static/test_package.sh +6 -0
- package/dist/base/evals/static/test_workflow_skills.sh +16 -0
- package/dist/base/install.sh +1 -1
- package/dist/base/kits/builder/flows/publish-learn.flow.json +9 -1
- package/dist/base/kits/builder/skills/execute-plan/SKILL.md +4 -3
- package/dist/base/kits/builder/skills/pull-work/SKILL.md +12 -0
- package/dist/base/kits/builder/skills/review-work/SKILL.md +11 -0
- package/dist/base/kits/veritas-governance/adapter/readiness-to-trust-bundle.mjs +19 -20
- package/dist/base/kits/veritas-governance/assets/starter-hooks/githooks/post-commit +13 -0
- package/dist/base/kits/veritas-governance/assets/starter-hooks/githooks/pre-push +13 -0
- package/dist/base/kits/veritas-governance/assets/starter-standards/veritas/GOVERNANCE.md +23 -0
- package/dist/base/kits/veritas-governance/assets/starter-standards/veritas/README.md +58 -0
- package/dist/base/kits/veritas-governance/assets/starter-standards/veritas/authority/default.authority-settings.json +30 -0
- package/dist/base/kits/veritas-governance/assets/starter-standards/veritas/repo-map.json +115 -0
- package/dist/base/kits/veritas-governance/assets/starter-standards/veritas/repo-standards/default.repo-standards.json +54 -0
- package/dist/base/kits/veritas-governance/assets/starter-standards/veritas.claims.json +179 -0
- package/dist/base/kits/veritas-governance/docs/README.md +141 -10
- package/dist/base/kits/veritas-governance/fixtures/standards-authoring/approved.trust-bundle.json +74 -0
- package/dist/base/kits/veritas-governance/fixtures/standards-authoring/not-approved.trust-bundle.json +74 -0
- package/dist/base/kits/veritas-governance/flows/standards-authoring.flow.json +35 -0
- package/dist/base/kits/veritas-governance/kit.json +65 -0
- package/dist/base/kits/veritas-governance/skills/consult-standards/SKILL.md +73 -0
- package/dist/base/kits/veritas-governance/skills/standards-authoring/SKILL.md +87 -0
- package/dist/base/schemas/backlog-provider-settings.schema.json +1 -1
- package/dist/base/schemas/workflow-waves.schema.json +347 -0
- package/dist/base/scripts/check-layer-boundary.mjs +98 -0
- package/dist/base/scripts/hooks/claude-telemetry-hook.js +6 -0
- package/dist/base/scripts/hooks/lib/liveness-heartbeat.js +42 -1
- package/dist/base/scripts/hooks/lib/liveness-write.js +109 -9
- package/dist/base/scripts/liveness/relay.sh +23 -11
- package/dist/base/scripts/telemetry/lib/config.sh +29 -0
- package/dist/catalog.json +2 -0
- package/dist/claude-code/.claude/agents/tool-security-reviewer.md +2 -1
- package/dist/claude-code/.claude/skills/consult-standards/SKILL.md +73 -0
- package/dist/claude-code/.claude/skills/execute-plan/SKILL.md +4 -3
- package/dist/claude-code/.claude/skills/pull-work/SKILL.md +12 -0
- package/dist/claude-code/.claude/skills/review-work/SKILL.md +11 -0
- package/dist/claude-code/.claude/skills/standards-authoring/SKILL.md +87 -0
- package/dist/claude-code/build/package.json +1 -1
- package/dist/claude-code/build/src/cli/init.js +35 -3
- package/dist/claude-code/build/src/cli/kit.js +95 -2
- package/dist/claude-code/build/src/cli/pull-work-provider.js +7 -1
- package/dist/claude-code/build/src/cli/validate-workflow-artifacts.js +53 -0
- package/dist/claude-code/build/src/cli/workflow.js +5 -1
- package/dist/claude-code/build/src/flow-kit/provision.d.ts +23 -0
- package/dist/claude-code/build/src/flow-kit/provision.js +99 -0
- package/dist/claude-code/build/src/flow-kit/validate.d.ts +52 -0
- package/dist/claude-code/build/src/flow-kit/validate.js +214 -9
- package/dist/claude-code/build/src/runtime-adapters.js +1 -1
- package/dist/claude-code/context/contracts/execution-contract.md +30 -1
- package/dist/claude-code/context/contracts/review-contract.md +4 -0
- package/dist/claude-code/context/contracts/trigger-guards.md +73 -0
- package/dist/claude-code/context/scripts/telemetry/lib/config.sh +29 -0
- package/dist/claude-code/context/settings/backlog-provider-settings.json +1 -1
- package/dist/claude-code/context/settings/workspace-backlog-provider-settings.example.json +1 -1
- package/dist/claude-code/docs/adr/0023-kit-provisioning.md +47 -0
- package/dist/claude-code/docs/adr/index.md +1 -0
- package/dist/claude-code/docs/architecture-engine-and-kits.md +17 -0
- package/dist/claude-code/docs/context-map.md +3 -0
- package/dist/claude-code/docs/decisions/backlog-readiness-source.md +89 -0
- package/dist/claude-code/docs/decisions/index.md +1 -0
- package/dist/claude-code/docs/developer-architecture.md +3 -3
- package/dist/claude-code/docs/flow-kit-repository-contract.md +34 -3
- package/dist/claude-code/docs/kit-authoring-guide.md +1 -1
- package/dist/claude-code/docs/veritas-integration.md +12 -0
- package/dist/claude-code/evals/ci/run-baseline.sh +4 -0
- package/dist/claude-code/evals/integration/test_kit_provisioning.sh +112 -0
- package/dist/claude-code/evals/integration/test_liveness_console_relay.sh +91 -1
- package/dist/claude-code/evals/integration/test_liveness_heartbeat.sh +66 -0
- package/dist/claude-code/evals/integration/test_pull_work_provider.sh +18 -0
- package/dist/claude-code/evals/integration/test_veritas_governance_kit.sh +256 -0
- package/dist/claude-code/evals/integration/test_workflow_artifacts.sh +257 -0
- package/dist/claude-code/evals/static/test_package.sh +6 -0
- package/dist/claude-code/evals/static/test_workflow_skills.sh +16 -0
- package/dist/claude-code/install.sh +1 -1
- package/dist/claude-code/kits/builder/flows/publish-learn.flow.json +9 -1
- package/dist/claude-code/kits/builder/skills/execute-plan/SKILL.md +4 -3
- package/dist/claude-code/kits/builder/skills/pull-work/SKILL.md +12 -0
- package/dist/claude-code/kits/builder/skills/review-work/SKILL.md +11 -0
- package/dist/claude-code/kits/veritas-governance/adapter/readiness-to-trust-bundle.mjs +19 -20
- package/dist/claude-code/kits/veritas-governance/assets/starter-hooks/githooks/post-commit +13 -0
- package/dist/claude-code/kits/veritas-governance/assets/starter-hooks/githooks/pre-push +13 -0
- package/dist/claude-code/kits/veritas-governance/assets/starter-standards/veritas/GOVERNANCE.md +23 -0
- package/dist/claude-code/kits/veritas-governance/assets/starter-standards/veritas/README.md +58 -0
- package/dist/claude-code/kits/veritas-governance/assets/starter-standards/veritas/authority/default.authority-settings.json +30 -0
- package/dist/claude-code/kits/veritas-governance/assets/starter-standards/veritas/repo-map.json +115 -0
- package/dist/claude-code/kits/veritas-governance/assets/starter-standards/veritas/repo-standards/default.repo-standards.json +54 -0
- package/dist/claude-code/kits/veritas-governance/assets/starter-standards/veritas.claims.json +179 -0
- package/dist/claude-code/kits/veritas-governance/docs/README.md +141 -10
- package/dist/claude-code/kits/veritas-governance/fixtures/standards-authoring/approved.trust-bundle.json +74 -0
- package/dist/claude-code/kits/veritas-governance/fixtures/standards-authoring/not-approved.trust-bundle.json +74 -0
- package/dist/claude-code/kits/veritas-governance/flows/standards-authoring.flow.json +35 -0
- package/dist/claude-code/kits/veritas-governance/kit.json +65 -0
- package/dist/claude-code/kits/veritas-governance/skills/consult-standards/SKILL.md +73 -0
- package/dist/claude-code/kits/veritas-governance/skills/standards-authoring/SKILL.md +87 -0
- package/dist/claude-code/schemas/backlog-provider-settings.schema.json +1 -1
- package/dist/claude-code/schemas/workflow-waves.schema.json +347 -0
- package/dist/claude-code/scripts/check-layer-boundary.mjs +98 -0
- package/dist/claude-code/scripts/hooks/claude-telemetry-hook.js +6 -0
- package/dist/claude-code/scripts/hooks/lib/liveness-heartbeat.js +42 -1
- package/dist/claude-code/scripts/hooks/lib/liveness-write.js +109 -9
- package/dist/claude-code/scripts/liveness/relay.sh +23 -11
- package/dist/claude-code/scripts/telemetry/lib/config.sh +29 -0
- package/dist/codex/.agents/skills/builder-shape/context/contracts/execution-contract.md +30 -1
- package/dist/codex/.agents/skills/consult-standards/SKILL.md +73 -0
- package/dist/codex/.agents/skills/deliver/context/contracts/execution-contract.md +30 -1
- package/dist/codex/.agents/skills/design-probe/context/contracts/execution-contract.md +30 -1
- package/dist/codex/.agents/skills/execute-plan/SKILL.md +4 -3
- package/dist/codex/.agents/skills/execute-plan/context/contracts/execution-contract.md +30 -1
- package/dist/codex/.agents/skills/fix-bug/context/contracts/execution-contract.md +30 -1
- package/dist/codex/.agents/skills/idea-to-backlog/context/contracts/execution-contract.md +30 -1
- package/dist/codex/.agents/skills/plan-work/context/contracts/execution-contract.md +30 -1
- package/dist/codex/.agents/skills/pull-work/SKILL.md +12 -0
- package/dist/codex/.agents/skills/pull-work/context/contracts/execution-contract.md +30 -1
- package/dist/codex/.agents/skills/review-work/SKILL.md +11 -0
- package/dist/codex/.agents/skills/review-work/context/contracts/execution-contract.md +30 -1
- package/dist/codex/.agents/skills/standards-authoring/SKILL.md +87 -0
- package/dist/codex/.agents/skills/tdd-workflow/context/contracts/execution-contract.md +30 -1
- package/dist/codex/.agents/skills/verify-work/context/contracts/execution-contract.md +30 -1
- package/dist/codex/.codex/agents/tool-security-reviewer.toml +1 -1
- package/dist/codex/build/package.json +1 -1
- package/dist/codex/build/src/cli/init.js +35 -3
- package/dist/codex/build/src/cli/kit.js +95 -2
- package/dist/codex/build/src/cli/pull-work-provider.js +7 -1
- package/dist/codex/build/src/cli/validate-workflow-artifacts.js +53 -0
- package/dist/codex/build/src/cli/workflow.js +5 -1
- package/dist/codex/build/src/flow-kit/provision.d.ts +23 -0
- package/dist/codex/build/src/flow-kit/provision.js +99 -0
- package/dist/codex/build/src/flow-kit/validate.d.ts +52 -0
- package/dist/codex/build/src/flow-kit/validate.js +214 -9
- package/dist/codex/build/src/runtime-adapters.js +1 -1
- package/dist/codex/context/contracts/execution-contract.md +30 -1
- package/dist/codex/context/contracts/review-contract.md +4 -0
- package/dist/codex/context/contracts/trigger-guards.md +73 -0
- package/dist/codex/context/scripts/telemetry/lib/config.sh +29 -0
- package/dist/codex/context/settings/backlog-provider-settings.json +1 -1
- package/dist/codex/context/settings/workspace-backlog-provider-settings.example.json +1 -1
- package/dist/codex/docs/adr/0023-kit-provisioning.md +47 -0
- package/dist/codex/docs/adr/index.md +1 -0
- package/dist/codex/docs/architecture-engine-and-kits.md +17 -0
- package/dist/codex/docs/context-map.md +3 -0
- package/dist/codex/docs/decisions/backlog-readiness-source.md +89 -0
- package/dist/codex/docs/decisions/index.md +1 -0
- package/dist/codex/docs/developer-architecture.md +3 -3
- package/dist/codex/docs/flow-kit-repository-contract.md +34 -3
- package/dist/codex/docs/kit-authoring-guide.md +1 -1
- package/dist/codex/docs/veritas-integration.md +12 -0
- package/dist/codex/evals/ci/run-baseline.sh +4 -0
- package/dist/codex/evals/integration/test_kit_provisioning.sh +112 -0
- package/dist/codex/evals/integration/test_liveness_console_relay.sh +91 -1
- package/dist/codex/evals/integration/test_liveness_heartbeat.sh +66 -0
- package/dist/codex/evals/integration/test_pull_work_provider.sh +18 -0
- package/dist/codex/evals/integration/test_veritas_governance_kit.sh +256 -0
- package/dist/codex/evals/integration/test_workflow_artifacts.sh +257 -0
- package/dist/codex/evals/static/test_package.sh +6 -0
- package/dist/codex/evals/static/test_workflow_skills.sh +16 -0
- package/dist/codex/install.sh +1 -1
- package/dist/codex/kits/builder/flows/publish-learn.flow.json +9 -1
- package/dist/codex/kits/builder/skills/execute-plan/SKILL.md +4 -3
- package/dist/codex/kits/builder/skills/pull-work/SKILL.md +12 -0
- package/dist/codex/kits/builder/skills/review-work/SKILL.md +11 -0
- package/dist/codex/kits/veritas-governance/adapter/readiness-to-trust-bundle.mjs +19 -20
- package/dist/codex/kits/veritas-governance/assets/starter-hooks/githooks/post-commit +13 -0
- package/dist/codex/kits/veritas-governance/assets/starter-hooks/githooks/pre-push +13 -0
- package/dist/codex/kits/veritas-governance/assets/starter-standards/veritas/GOVERNANCE.md +23 -0
- package/dist/codex/kits/veritas-governance/assets/starter-standards/veritas/README.md +58 -0
- package/dist/codex/kits/veritas-governance/assets/starter-standards/veritas/authority/default.authority-settings.json +30 -0
- package/dist/codex/kits/veritas-governance/assets/starter-standards/veritas/repo-map.json +115 -0
- package/dist/codex/kits/veritas-governance/assets/starter-standards/veritas/repo-standards/default.repo-standards.json +54 -0
- package/dist/codex/kits/veritas-governance/assets/starter-standards/veritas.claims.json +179 -0
- package/dist/codex/kits/veritas-governance/docs/README.md +141 -10
- package/dist/codex/kits/veritas-governance/fixtures/standards-authoring/approved.trust-bundle.json +74 -0
- package/dist/codex/kits/veritas-governance/fixtures/standards-authoring/not-approved.trust-bundle.json +74 -0
- package/dist/codex/kits/veritas-governance/flows/standards-authoring.flow.json +35 -0
- package/dist/codex/kits/veritas-governance/kit.json +65 -0
- package/dist/codex/kits/veritas-governance/skills/consult-standards/SKILL.md +73 -0
- package/dist/codex/kits/veritas-governance/skills/standards-authoring/SKILL.md +87 -0
- package/dist/codex/schemas/backlog-provider-settings.schema.json +1 -1
- package/dist/codex/schemas/workflow-waves.schema.json +347 -0
- package/dist/codex/scripts/check-layer-boundary.mjs +98 -0
- package/dist/codex/scripts/hooks/claude-telemetry-hook.js +6 -0
- package/dist/codex/scripts/hooks/lib/liveness-heartbeat.js +42 -1
- package/dist/codex/scripts/hooks/lib/liveness-write.js +109 -9
- package/dist/codex/scripts/liveness/relay.sh +23 -11
- package/dist/codex/scripts/telemetry/lib/config.sh +29 -0
- package/dist/kiro/agents/tool-security-reviewer.json +1 -1
- package/dist/kiro/build/package.json +1 -1
- package/dist/kiro/build/src/cli/init.js +35 -3
- package/dist/kiro/build/src/cli/kit.js +95 -2
- package/dist/kiro/build/src/cli/pull-work-provider.js +7 -1
- package/dist/kiro/build/src/cli/validate-workflow-artifacts.js +53 -0
- package/dist/kiro/build/src/cli/workflow.js +5 -1
- package/dist/kiro/build/src/flow-kit/provision.d.ts +23 -0
- package/dist/kiro/build/src/flow-kit/provision.js +99 -0
- package/dist/kiro/build/src/flow-kit/validate.d.ts +52 -0
- package/dist/kiro/build/src/flow-kit/validate.js +214 -9
- package/dist/kiro/build/src/runtime-adapters.js +1 -1
- package/dist/kiro/context/contracts/execution-contract.md +30 -1
- package/dist/kiro/context/contracts/review-contract.md +4 -0
- package/dist/kiro/context/contracts/trigger-guards.md +73 -0
- package/dist/kiro/context/scripts/telemetry/lib/config.sh +29 -0
- package/dist/kiro/context/settings/backlog-provider-settings.json +1 -1
- package/dist/kiro/context/settings/workspace-backlog-provider-settings.example.json +1 -1
- package/dist/kiro/docs/adr/0023-kit-provisioning.md +47 -0
- package/dist/kiro/docs/adr/index.md +1 -0
- package/dist/kiro/docs/architecture-engine-and-kits.md +17 -0
- package/dist/kiro/docs/context-map.md +3 -0
- package/dist/kiro/docs/decisions/backlog-readiness-source.md +89 -0
- package/dist/kiro/docs/decisions/index.md +1 -0
- package/dist/kiro/docs/developer-architecture.md +3 -3
- package/dist/kiro/docs/flow-kit-repository-contract.md +34 -3
- package/dist/kiro/docs/kit-authoring-guide.md +1 -1
- package/dist/kiro/docs/veritas-integration.md +12 -0
- package/dist/kiro/evals/ci/run-baseline.sh +4 -0
- package/dist/kiro/evals/integration/test_kit_provisioning.sh +112 -0
- package/dist/kiro/evals/integration/test_liveness_console_relay.sh +91 -1
- package/dist/kiro/evals/integration/test_liveness_heartbeat.sh +66 -0
- package/dist/kiro/evals/integration/test_pull_work_provider.sh +18 -0
- package/dist/kiro/evals/integration/test_veritas_governance_kit.sh +256 -0
- package/dist/kiro/evals/integration/test_workflow_artifacts.sh +257 -0
- package/dist/kiro/evals/static/test_package.sh +6 -0
- package/dist/kiro/evals/static/test_workflow_skills.sh +16 -0
- package/dist/kiro/install.sh +1 -1
- package/dist/kiro/kits/builder/flows/publish-learn.flow.json +9 -1
- package/dist/kiro/kits/builder/skills/execute-plan/SKILL.md +4 -3
- package/dist/kiro/kits/builder/skills/pull-work/SKILL.md +12 -0
- package/dist/kiro/kits/builder/skills/review-work/SKILL.md +11 -0
- package/dist/kiro/kits/veritas-governance/adapter/readiness-to-trust-bundle.mjs +19 -20
- package/dist/kiro/kits/veritas-governance/assets/starter-hooks/githooks/post-commit +13 -0
- package/dist/kiro/kits/veritas-governance/assets/starter-hooks/githooks/pre-push +13 -0
- package/dist/kiro/kits/veritas-governance/assets/starter-standards/veritas/GOVERNANCE.md +23 -0
- package/dist/kiro/kits/veritas-governance/assets/starter-standards/veritas/README.md +58 -0
- package/dist/kiro/kits/veritas-governance/assets/starter-standards/veritas/authority/default.authority-settings.json +30 -0
- package/dist/kiro/kits/veritas-governance/assets/starter-standards/veritas/repo-map.json +115 -0
- package/dist/kiro/kits/veritas-governance/assets/starter-standards/veritas/repo-standards/default.repo-standards.json +54 -0
- package/dist/kiro/kits/veritas-governance/assets/starter-standards/veritas.claims.json +179 -0
- package/dist/kiro/kits/veritas-governance/docs/README.md +141 -10
- package/dist/kiro/kits/veritas-governance/fixtures/standards-authoring/approved.trust-bundle.json +74 -0
- package/dist/kiro/kits/veritas-governance/fixtures/standards-authoring/not-approved.trust-bundle.json +74 -0
- package/dist/kiro/kits/veritas-governance/flows/standards-authoring.flow.json +35 -0
- package/dist/kiro/kits/veritas-governance/kit.json +65 -0
- package/dist/kiro/kits/veritas-governance/skills/consult-standards/SKILL.md +73 -0
- package/dist/kiro/kits/veritas-governance/skills/standards-authoring/SKILL.md +87 -0
- package/dist/kiro/schemas/backlog-provider-settings.schema.json +1 -1
- package/dist/kiro/schemas/workflow-waves.schema.json +347 -0
- package/dist/kiro/scripts/check-layer-boundary.mjs +98 -0
- package/dist/kiro/scripts/hooks/claude-telemetry-hook.js +6 -0
- package/dist/kiro/scripts/hooks/lib/liveness-heartbeat.js +42 -1
- package/dist/kiro/scripts/hooks/lib/liveness-write.js +109 -9
- package/dist/kiro/scripts/liveness/relay.sh +23 -11
- package/dist/kiro/scripts/telemetry/lib/config.sh +29 -0
- package/dist/opencode/.opencode/agents/tool-security-reviewer.md +2 -1
- package/dist/opencode/.opencode/skills/consult-standards/SKILL.md +73 -0
- package/dist/opencode/.opencode/skills/execute-plan/SKILL.md +4 -3
- package/dist/opencode/.opencode/skills/pull-work/SKILL.md +12 -0
- package/dist/opencode/.opencode/skills/review-work/SKILL.md +11 -0
- package/dist/opencode/.opencode/skills/standards-authoring/SKILL.md +87 -0
- package/dist/opencode/build/package.json +1 -1
- package/dist/opencode/build/src/cli/init.js +35 -3
- package/dist/opencode/build/src/cli/kit.js +95 -2
- package/dist/opencode/build/src/cli/pull-work-provider.js +7 -1
- package/dist/opencode/build/src/cli/validate-workflow-artifacts.js +53 -0
- package/dist/opencode/build/src/cli/workflow.js +5 -1
- package/dist/opencode/build/src/flow-kit/provision.d.ts +23 -0
- package/dist/opencode/build/src/flow-kit/provision.js +99 -0
- package/dist/opencode/build/src/flow-kit/validate.d.ts +52 -0
- package/dist/opencode/build/src/flow-kit/validate.js +214 -9
- package/dist/opencode/build/src/runtime-adapters.js +1 -1
- package/dist/opencode/context/contracts/execution-contract.md +30 -1
- package/dist/opencode/context/contracts/review-contract.md +4 -0
- package/dist/opencode/context/contracts/trigger-guards.md +73 -0
- package/dist/opencode/context/scripts/telemetry/lib/config.sh +29 -0
- package/dist/opencode/context/settings/backlog-provider-settings.json +1 -1
- package/dist/opencode/context/settings/workspace-backlog-provider-settings.example.json +1 -1
- package/dist/opencode/docs/adr/0023-kit-provisioning.md +47 -0
- package/dist/opencode/docs/adr/index.md +1 -0
- package/dist/opencode/docs/architecture-engine-and-kits.md +17 -0
- package/dist/opencode/docs/context-map.md +3 -0
- package/dist/opencode/docs/decisions/backlog-readiness-source.md +89 -0
- package/dist/opencode/docs/decisions/index.md +1 -0
- package/dist/opencode/docs/developer-architecture.md +3 -3
- package/dist/opencode/docs/flow-kit-repository-contract.md +34 -3
- package/dist/opencode/docs/kit-authoring-guide.md +1 -1
- package/dist/opencode/docs/veritas-integration.md +12 -0
- package/dist/opencode/evals/ci/run-baseline.sh +4 -0
- package/dist/opencode/evals/integration/test_kit_provisioning.sh +112 -0
- package/dist/opencode/evals/integration/test_liveness_console_relay.sh +91 -1
- package/dist/opencode/evals/integration/test_liveness_heartbeat.sh +66 -0
- package/dist/opencode/evals/integration/test_pull_work_provider.sh +18 -0
- package/dist/opencode/evals/integration/test_veritas_governance_kit.sh +256 -0
- package/dist/opencode/evals/integration/test_workflow_artifacts.sh +257 -0
- package/dist/opencode/evals/static/test_package.sh +6 -0
- package/dist/opencode/evals/static/test_workflow_skills.sh +16 -0
- package/dist/opencode/install.sh +1 -1
- package/dist/opencode/kits/builder/flows/publish-learn.flow.json +9 -1
- package/dist/opencode/kits/builder/skills/execute-plan/SKILL.md +4 -3
- package/dist/opencode/kits/builder/skills/pull-work/SKILL.md +12 -0
- package/dist/opencode/kits/builder/skills/review-work/SKILL.md +11 -0
- package/dist/opencode/kits/veritas-governance/adapter/readiness-to-trust-bundle.mjs +19 -20
- package/dist/opencode/kits/veritas-governance/assets/starter-hooks/githooks/post-commit +13 -0
- package/dist/opencode/kits/veritas-governance/assets/starter-hooks/githooks/pre-push +13 -0
- package/dist/opencode/kits/veritas-governance/assets/starter-standards/veritas/GOVERNANCE.md +23 -0
- package/dist/opencode/kits/veritas-governance/assets/starter-standards/veritas/README.md +58 -0
- package/dist/opencode/kits/veritas-governance/assets/starter-standards/veritas/authority/default.authority-settings.json +30 -0
- package/dist/opencode/kits/veritas-governance/assets/starter-standards/veritas/repo-map.json +115 -0
- package/dist/opencode/kits/veritas-governance/assets/starter-standards/veritas/repo-standards/default.repo-standards.json +54 -0
- package/dist/opencode/kits/veritas-governance/assets/starter-standards/veritas.claims.json +179 -0
- package/dist/opencode/kits/veritas-governance/docs/README.md +141 -10
- package/dist/opencode/kits/veritas-governance/fixtures/standards-authoring/approved.trust-bundle.json +74 -0
- package/dist/opencode/kits/veritas-governance/fixtures/standards-authoring/not-approved.trust-bundle.json +74 -0
- package/dist/opencode/kits/veritas-governance/flows/standards-authoring.flow.json +35 -0
- package/dist/opencode/kits/veritas-governance/kit.json +65 -0
- package/dist/opencode/kits/veritas-governance/skills/consult-standards/SKILL.md +73 -0
- package/dist/opencode/kits/veritas-governance/skills/standards-authoring/SKILL.md +87 -0
- package/dist/opencode/schemas/backlog-provider-settings.schema.json +1 -1
- package/dist/opencode/schemas/workflow-waves.schema.json +347 -0
- package/dist/opencode/scripts/check-layer-boundary.mjs +98 -0
- package/dist/opencode/scripts/hooks/claude-telemetry-hook.js +6 -0
- package/dist/opencode/scripts/hooks/lib/liveness-heartbeat.js +42 -1
- package/dist/opencode/scripts/hooks/lib/liveness-write.js +109 -9
- package/dist/opencode/scripts/liveness/relay.sh +23 -11
- package/dist/opencode/scripts/telemetry/lib/config.sh +29 -0
- package/dist/pi/.pi/skills/consult-standards/SKILL.md +73 -0
- package/dist/pi/.pi/skills/execute-plan/SKILL.md +4 -3
- package/dist/pi/.pi/skills/pull-work/SKILL.md +12 -0
- package/dist/pi/.pi/skills/review-work/SKILL.md +11 -0
- package/dist/pi/.pi/skills/standards-authoring/SKILL.md +87 -0
- package/dist/pi/build/package.json +1 -1
- package/dist/pi/build/src/cli/init.js +35 -3
- package/dist/pi/build/src/cli/kit.js +95 -2
- package/dist/pi/build/src/cli/pull-work-provider.js +7 -1
- package/dist/pi/build/src/cli/validate-workflow-artifacts.js +53 -0
- package/dist/pi/build/src/cli/workflow.js +5 -1
- package/dist/pi/build/src/flow-kit/provision.d.ts +23 -0
- package/dist/pi/build/src/flow-kit/provision.js +99 -0
- package/dist/pi/build/src/flow-kit/validate.d.ts +52 -0
- package/dist/pi/build/src/flow-kit/validate.js +214 -9
- package/dist/pi/build/src/runtime-adapters.js +1 -1
- package/dist/pi/context/contracts/execution-contract.md +30 -1
- package/dist/pi/context/contracts/review-contract.md +4 -0
- package/dist/pi/context/contracts/trigger-guards.md +73 -0
- package/dist/pi/context/scripts/telemetry/lib/config.sh +29 -0
- package/dist/pi/context/settings/backlog-provider-settings.json +1 -1
- package/dist/pi/context/settings/workspace-backlog-provider-settings.example.json +1 -1
- package/dist/pi/docs/adr/0023-kit-provisioning.md +47 -0
- package/dist/pi/docs/adr/index.md +1 -0
- package/dist/pi/docs/architecture-engine-and-kits.md +17 -0
- package/dist/pi/docs/context-map.md +3 -0
- package/dist/pi/docs/decisions/backlog-readiness-source.md +89 -0
- package/dist/pi/docs/decisions/index.md +1 -0
- package/dist/pi/docs/developer-architecture.md +3 -3
- package/dist/pi/docs/flow-kit-repository-contract.md +34 -3
- package/dist/pi/docs/kit-authoring-guide.md +1 -1
- package/dist/pi/docs/veritas-integration.md +12 -0
- package/dist/pi/evals/ci/run-baseline.sh +4 -0
- package/dist/pi/evals/integration/test_kit_provisioning.sh +112 -0
- package/dist/pi/evals/integration/test_liveness_console_relay.sh +91 -1
- package/dist/pi/evals/integration/test_liveness_heartbeat.sh +66 -0
- package/dist/pi/evals/integration/test_pull_work_provider.sh +18 -0
- package/dist/pi/evals/integration/test_veritas_governance_kit.sh +256 -0
- package/dist/pi/evals/integration/test_workflow_artifacts.sh +257 -0
- package/dist/pi/evals/static/test_package.sh +6 -0
- package/dist/pi/evals/static/test_workflow_skills.sh +16 -0
- package/dist/pi/install.sh +1 -1
- package/dist/pi/kits/builder/flows/publish-learn.flow.json +9 -1
- package/dist/pi/kits/builder/skills/execute-plan/SKILL.md +4 -3
- package/dist/pi/kits/builder/skills/pull-work/SKILL.md +12 -0
- package/dist/pi/kits/builder/skills/review-work/SKILL.md +11 -0
- package/dist/pi/kits/veritas-governance/adapter/readiness-to-trust-bundle.mjs +19 -20
- package/dist/pi/kits/veritas-governance/assets/starter-hooks/githooks/post-commit +13 -0
- package/dist/pi/kits/veritas-governance/assets/starter-hooks/githooks/pre-push +13 -0
- package/dist/pi/kits/veritas-governance/assets/starter-standards/veritas/GOVERNANCE.md +23 -0
- package/dist/pi/kits/veritas-governance/assets/starter-standards/veritas/README.md +58 -0
- package/dist/pi/kits/veritas-governance/assets/starter-standards/veritas/authority/default.authority-settings.json +30 -0
- package/dist/pi/kits/veritas-governance/assets/starter-standards/veritas/repo-map.json +115 -0
- package/dist/pi/kits/veritas-governance/assets/starter-standards/veritas/repo-standards/default.repo-standards.json +54 -0
- package/dist/pi/kits/veritas-governance/assets/starter-standards/veritas.claims.json +179 -0
- package/dist/pi/kits/veritas-governance/docs/README.md +141 -10
- package/dist/pi/kits/veritas-governance/fixtures/standards-authoring/approved.trust-bundle.json +74 -0
- package/dist/pi/kits/veritas-governance/fixtures/standards-authoring/not-approved.trust-bundle.json +74 -0
- package/dist/pi/kits/veritas-governance/flows/standards-authoring.flow.json +35 -0
- package/dist/pi/kits/veritas-governance/kit.json +65 -0
- package/dist/pi/kits/veritas-governance/skills/consult-standards/SKILL.md +73 -0
- package/dist/pi/kits/veritas-governance/skills/standards-authoring/SKILL.md +87 -0
- package/dist/pi/schemas/backlog-provider-settings.schema.json +1 -1
- package/dist/pi/schemas/workflow-waves.schema.json +347 -0
- package/dist/pi/scripts/check-layer-boundary.mjs +98 -0
- package/dist/pi/scripts/hooks/claude-telemetry-hook.js +6 -0
- package/dist/pi/scripts/hooks/lib/liveness-heartbeat.js +42 -1
- package/dist/pi/scripts/hooks/lib/liveness-write.js +109 -9
- package/dist/pi/scripts/liveness/relay.sh +23 -11
- package/dist/pi/scripts/telemetry/lib/config.sh +29 -0
- package/docs/adr/0023-kit-provisioning.md +47 -0
- package/docs/adr/index.md +1 -0
- package/docs/architecture-engine-and-kits.md +17 -0
- package/docs/context-map.md +3 -0
- package/docs/decisions/backlog-readiness-source.md +89 -0
- package/docs/decisions/index.md +1 -0
- package/docs/developer-architecture.md +3 -3
- package/docs/flow-kit-repository-contract.md +34 -3
- package/docs/kit-authoring-guide.md +1 -1
- package/docs/veritas-integration.md +12 -0
- package/evals/ci/run-baseline.sh +4 -0
- package/evals/integration/test_kit_provisioning.sh +112 -0
- package/evals/integration/test_liveness_console_relay.sh +91 -1
- package/evals/integration/test_liveness_heartbeat.sh +66 -0
- package/evals/integration/test_pull_work_provider.sh +18 -0
- package/evals/integration/test_veritas_governance_kit.sh +256 -0
- package/evals/integration/test_workflow_artifacts.sh +257 -0
- package/evals/static/test_package.sh +6 -0
- package/evals/static/test_workflow_skills.sh +16 -0
- package/kits/builder/flows/publish-learn.flow.json +9 -1
- package/kits/builder/skills/execute-plan/SKILL.md +4 -3
- package/kits/builder/skills/pull-work/SKILL.md +12 -0
- package/kits/builder/skills/review-work/SKILL.md +11 -0
- package/kits/veritas-governance/adapter/readiness-to-trust-bundle.mjs +19 -20
- package/kits/veritas-governance/assets/starter-hooks/githooks/post-commit +13 -0
- package/kits/veritas-governance/assets/starter-hooks/githooks/pre-push +13 -0
- package/kits/veritas-governance/assets/starter-standards/veritas/GOVERNANCE.md +23 -0
- package/kits/veritas-governance/assets/starter-standards/veritas/README.md +58 -0
- package/kits/veritas-governance/assets/starter-standards/veritas/authority/default.authority-settings.json +30 -0
- package/kits/veritas-governance/assets/starter-standards/veritas/repo-map.json +115 -0
- package/kits/veritas-governance/assets/starter-standards/veritas/repo-standards/default.repo-standards.json +54 -0
- package/kits/veritas-governance/assets/starter-standards/veritas.claims.json +179 -0
- package/kits/veritas-governance/docs/README.md +141 -10
- package/kits/veritas-governance/fixtures/standards-authoring/approved.trust-bundle.json +74 -0
- package/kits/veritas-governance/fixtures/standards-authoring/not-approved.trust-bundle.json +74 -0
- package/kits/veritas-governance/flows/standards-authoring.flow.json +35 -0
- package/kits/veritas-governance/kit.json +65 -0
- package/kits/veritas-governance/skills/consult-standards/SKILL.md +73 -0
- package/kits/veritas-governance/skills/standards-authoring/SKILL.md +87 -0
- package/package.json +2 -1
- package/schemas/backlog-provider-settings.schema.json +1 -1
- package/schemas/workflow-waves.schema.json +347 -0
- package/scripts/check-layer-boundary.mjs +98 -0
- package/scripts/hooks/claude-telemetry-hook.js +6 -0
- package/scripts/hooks/lib/liveness-heartbeat.js +42 -1
- package/scripts/hooks/lib/liveness-write.js +109 -9
- package/scripts/liveness/relay.sh +23 -11
- package/scripts/telemetry/lib/config.sh +29 -0
- package/src/cli/builder-flow-runtime.test.mjs +86 -0
- package/src/cli/flow-resolver-composition.test.mjs +20 -1
- package/src/cli/init.ts +31 -3
- package/src/cli/kit-metadata-security.test.mjs +163 -1
- package/src/cli/kit-provisioning.test.mjs +122 -0
- package/src/cli/kit.ts +83 -2
- package/src/cli/pull-work-provider.ts +7 -1
- package/src/cli/validate-waves.test.mjs +134 -0
- package/src/cli/validate-workflow-artifacts.ts +47 -0
- package/src/cli/workflow.ts +7 -1
- package/src/flow-kit/provision.ts +118 -0
- package/src/flow-kit/validate.ts +233 -10
- package/src/runtime-adapters.ts +1 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "standards-authoring"
|
|
3
|
+
description: "Author or update a repo's Veritas Repo Standards through the kit's standards-authoring flow: run `veritas init --explore`/`--guided` to derive a proposed starter set (project name, repo-shape-adaptive Repo Map nodes, evidence-check inference, and the AGENTS.md/CLAUDE.md governance-block splice), surface it for human approval, then `veritas init --apply` once a human-approved standards-authoring-approval trust.bundle claim satisfies the flow's human-approval gate. Use when adopting Veritas governance in a repo or re-deriving standards after its shape changes — beyond the static starter set `kit provision` scaffolds."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Standards Authoring
|
|
7
|
+
|
|
8
|
+
Derive a repo's Veritas Repo Standards, get a human to approve them, then write them — the
|
|
9
|
+
authoring UX `veritas init` provides, driven through the kit's `standards-authoring` flow so
|
|
10
|
+
the write is human-gated.
|
|
11
|
+
|
|
12
|
+
**Veritas does the derivation and the write; this skill only invokes the `veritas` CLI and
|
|
13
|
+
surfaces its recommendation for approval.** No standards evaluation, derivation, or splice
|
|
14
|
+
logic is reimplemented here (kit non-goal: never fork or reimplement Veritas).
|
|
15
|
+
|
|
16
|
+
## When to use this vs. `kit provision`
|
|
17
|
+
|
|
18
|
+
- **`flow-agents kit provision veritas-governance`** copies a *static* starter `.veritas/` set
|
|
19
|
+
(placeholder project name, generic nodes) — fastest path to a repo that runs
|
|
20
|
+
`veritas readiness`. See the kit README's "Scaffolding starter standards".
|
|
21
|
+
- **This skill** runs Veritas's *adaptive* authoring: it derives the project name, Repo Map
|
|
22
|
+
work-area nodes, and evidence-check command from the actual repo, and splices the governance
|
|
23
|
+
block into existing `AGENTS.md`/`CLAUDE.md` — the per-repo work a verbatim file copy cannot
|
|
24
|
+
do. Use it to author standards for real, or to re-derive after the repo's shape changes.
|
|
25
|
+
|
|
26
|
+
## Flow binding
|
|
27
|
+
|
|
28
|
+
This skill documents how to drive `flows/standards-authoring.flow.json` — a two-step
|
|
29
|
+
**agentless-gate** flow `propose -> apply` with one gate (the kit declares no
|
|
30
|
+
`flow_step_actions`; like `exemption-issuance`, the human produces the gate's approval bundle
|
|
31
|
+
out of band, and this skill is the operator's runbook, not a step-bound action):
|
|
32
|
+
|
|
33
|
+
- `human-approval-gate` (on `apply`) requires a **verified** `standards-authoring-approval`
|
|
34
|
+
trust.bundle claim (`subjectType: "repo-governance-change"`) before the apply write is
|
|
35
|
+
flow-sanctioned.
|
|
36
|
+
|
|
37
|
+
As with `exemption-issuance`'s `human-approval-gate`, "human-approved" is an **operating
|
|
38
|
+
convention** the gate's claim encodes, not a structural human-only guarantee — Flow's schema
|
|
39
|
+
does not distinguish a human-authored bundle from an agent-authored one (see the kit README's
|
|
40
|
+
"Human-approval evidence: what is and is not enforced"). The gate adds a named claim, a
|
|
41
|
+
documented sequence, and an audit trail on top of the same mitigation `veritas init --apply`
|
|
42
|
+
already carries (it refuses to overwrite existing standards without `--force`).
|
|
43
|
+
|
|
44
|
+
## Sequence
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# 1. PROPOSE — derive a recommendation without writing anything.
|
|
48
|
+
veritas init --explore
|
|
49
|
+
# (or `veritas init --guided --answers <answers.json>` for owner Q&A)
|
|
50
|
+
# -> writes a hash-pinned recommendation artifact (schema_version, project_name,
|
|
51
|
+
# repo_insights, artifact_payloads incl. AGENTS.md/CLAUDE.md governance blocks,
|
|
52
|
+
# artifact_hashes, recommended_repo_map/standards/authority, owner_questions,
|
|
53
|
+
# reasoning_summary, apply_command). Nothing under .veritas/ is written yet.
|
|
54
|
+
|
|
55
|
+
# 2. APPROVE — a human reviews the recommendation (its reasoning_summary and owner_questions),
|
|
56
|
+
# then authors a Hachure trust.bundle asserting the approval:
|
|
57
|
+
# claimType: "standards-authoring-approval", subjectType: "repo-governance-change",
|
|
58
|
+
# status: "verified".
|
|
59
|
+
flow init
|
|
60
|
+
flow start kits/veritas-governance/flows/standards-authoring.flow.json --run-id authoring
|
|
61
|
+
flow attach-evidence authoring --gate human-approval-gate --file approval.bundle --bundle
|
|
62
|
+
flow evaluate authoring --gate human-approval-gate --exit-code
|
|
63
|
+
# exit 0 once the approval claim is verified; exit 1 (block) otherwise.
|
|
64
|
+
|
|
65
|
+
# 3. APPLY — only after the gate passes, write the approved recommendation.
|
|
66
|
+
veritas init --apply --plan <path-to-recommendation-artifact>
|
|
67
|
+
# -> validates each artifact_hashes[path] === sha256(payload) (tamper/staleness check
|
|
68
|
+
# between propose and apply), refuses to overwrite existing starter files without
|
|
69
|
+
# --force, then writes .veritas/* and splices the governance block into the selected
|
|
70
|
+
# instruction files.
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Contract
|
|
74
|
+
|
|
75
|
+
- **Wraps the `veritas` CLI; reimplements nothing.** Project-name derivation, adaptive Repo Map
|
|
76
|
+
nodes, evidence-check inference, and the governance-block splice all live inside `veritas`
|
|
77
|
+
(`veritas init` / `src/bootstrap/*` / `src/governance.mjs`). This skill invokes and surfaces;
|
|
78
|
+
it does not compute standards.
|
|
79
|
+
- **The write is human-gated by convention, not structurally.** The flow's
|
|
80
|
+
`standards-authoring-approval` claim is the sign-off record; anyone who can
|
|
81
|
+
`flow attach-evidence --bundle` a conforming claim satisfies it. Read a passing gate as "a
|
|
82
|
+
verified approval claim of the right shape was attached," not as proof a human attached it.
|
|
83
|
+
- **`veritas init --apply` is create-safe by default:** it refuses to overwrite existing
|
|
84
|
+
`.veritas/` standards without `--force`. Re-authoring an already-governed repo is therefore an
|
|
85
|
+
explicit, opt-in action — the skill never silently replaces standards.
|
|
86
|
+
- **No engine dependency, no evaluation.** Nothing here runs or reimplements `veritas readiness`;
|
|
87
|
+
that stays the `readiness-check` flow's concern.
|
|
@@ -42,7 +42,36 @@ Execution may upgrade to a stronger mode when risk increases. Downgrades require
|
|
|
42
42
|
- Independent tasks with no shared files can run in the same wave.
|
|
43
43
|
- Shared files, generated artifacts, migrations, and cross-cutting contracts should be serialized unless the plan gives explicit file ownership.
|
|
44
44
|
- Worker delegation must name the exact worker role (`tool-worker`) rather than spawning an unnamed/default implementation agent.
|
|
45
|
-
- After each wave,
|
|
45
|
+
- After each wave, reconcile results against the wave manifest (below), check conflicts, and update the session artifact before starting the next wave.
|
|
46
|
+
|
|
47
|
+
## Wave Manifest And Reconciliation
|
|
48
|
+
|
|
49
|
+
Fan-out collection is machine-checkable, not prose. A reduce step that silently
|
|
50
|
+
drops a worker's stream is worse than one that errors.
|
|
51
|
+
|
|
52
|
+
- **Declare before dispatch.** Before dispatching a wave that delegates work,
|
|
53
|
+
declare it in the session's `waves.json` sidecar (schema:
|
|
54
|
+
`schemas/workflow-waves.schema.json`): `wave_id`, owning step, and one
|
|
55
|
+
`expected_workers` entry per worker. The expected count (M) must exist before
|
|
56
|
+
any result arrives.
|
|
57
|
+
- **One terminal record per worker.** Each worker lands exactly one terminal
|
|
58
|
+
status record: `completed`, `failed`, or `blocked`. Duplicate records and
|
|
59
|
+
undeclared reporters are validation errors.
|
|
60
|
+
- **Reconcile at wave close.** The orchestrator's collect step is
|
|
61
|
+
reconcile-against-manifest: record every declared worker that has no terminal
|
|
62
|
+
record as `not_reported` — never silently absorb a missing worker — then
|
|
63
|
+
record the wave's `reconciliation` with `expected_count` M, `reported_count`
|
|
64
|
+
N, and an explicit "N of M reported" summary naming the `not_reported`
|
|
65
|
+
workers (for example "2 of 3 reported; worker-3 not_reported").
|
|
66
|
+
- **Incomplete is visible, never silent.** A wave is `complete` only when N
|
|
67
|
+
equals M. An incomplete wave stays visible data and routes to re-dispatch, a
|
|
68
|
+
blocker report, or an explicit accepted gap; it must never be treated as
|
|
69
|
+
complete because the missing worker was forgotten.
|
|
70
|
+
- **Enforcement boundary (slice 1).** `validate-workflow-artifacts` enforces
|
|
71
|
+
the shape and the cross-record arithmetic (counts, exactly-one-record,
|
|
72
|
+
undeclared reporters, impossible `complete` claims) as data-level validation.
|
|
73
|
+
Stop-hook refusal of wave completion is #663 part 3 (slice 2), deferred until
|
|
74
|
+
the hook correctness issues (#453/#450/#494) are resolved.
|
|
46
75
|
|
|
47
76
|
## Delegation: Model Routing
|
|
48
77
|
|
|
@@ -42,7 +42,36 @@ Execution may upgrade to a stronger mode when risk increases. Downgrades require
|
|
|
42
42
|
- Independent tasks with no shared files can run in the same wave.
|
|
43
43
|
- Shared files, generated artifacts, migrations, and cross-cutting contracts should be serialized unless the plan gives explicit file ownership.
|
|
44
44
|
- Worker delegation must name the exact worker role (`tool-worker`) rather than spawning an unnamed/default implementation agent.
|
|
45
|
-
- After each wave,
|
|
45
|
+
- After each wave, reconcile results against the wave manifest (below), check conflicts, and update the session artifact before starting the next wave.
|
|
46
|
+
|
|
47
|
+
## Wave Manifest And Reconciliation
|
|
48
|
+
|
|
49
|
+
Fan-out collection is machine-checkable, not prose. A reduce step that silently
|
|
50
|
+
drops a worker's stream is worse than one that errors.
|
|
51
|
+
|
|
52
|
+
- **Declare before dispatch.** Before dispatching a wave that delegates work,
|
|
53
|
+
declare it in the session's `waves.json` sidecar (schema:
|
|
54
|
+
`schemas/workflow-waves.schema.json`): `wave_id`, owning step, and one
|
|
55
|
+
`expected_workers` entry per worker. The expected count (M) must exist before
|
|
56
|
+
any result arrives.
|
|
57
|
+
- **One terminal record per worker.** Each worker lands exactly one terminal
|
|
58
|
+
status record: `completed`, `failed`, or `blocked`. Duplicate records and
|
|
59
|
+
undeclared reporters are validation errors.
|
|
60
|
+
- **Reconcile at wave close.** The orchestrator's collect step is
|
|
61
|
+
reconcile-against-manifest: record every declared worker that has no terminal
|
|
62
|
+
record as `not_reported` — never silently absorb a missing worker — then
|
|
63
|
+
record the wave's `reconciliation` with `expected_count` M, `reported_count`
|
|
64
|
+
N, and an explicit "N of M reported" summary naming the `not_reported`
|
|
65
|
+
workers (for example "2 of 3 reported; worker-3 not_reported").
|
|
66
|
+
- **Incomplete is visible, never silent.** A wave is `complete` only when N
|
|
67
|
+
equals M. An incomplete wave stays visible data and routes to re-dispatch, a
|
|
68
|
+
blocker report, or an explicit accepted gap; it must never be treated as
|
|
69
|
+
complete because the missing worker was forgotten.
|
|
70
|
+
- **Enforcement boundary (slice 1).** `validate-workflow-artifacts` enforces
|
|
71
|
+
the shape and the cross-record arithmetic (counts, exactly-one-record,
|
|
72
|
+
undeclared reporters, impossible `complete` claims) as data-level validation.
|
|
73
|
+
Stop-hook refusal of wave completion is #663 part 3 (slice 2), deferred until
|
|
74
|
+
the hook correctness issues (#453/#450/#494) are resolved.
|
|
46
75
|
|
|
47
76
|
## Delegation: Model Routing
|
|
48
77
|
|
|
@@ -4,4 +4,4 @@ nickname_candidates = ["tool-security-reviewer","security-reviewer","security re
|
|
|
4
4
|
description = "Delegate to me for security analysis. Checks OWASP Top 10, secrets detection, input validation, injection vulnerabilities, auth/authz, and rate limiting. Read-only analysis with shell for scanning tools."
|
|
5
5
|
model = "gpt-5.6-sol"
|
|
6
6
|
model_reasoning_effort = "high"
|
|
7
|
-
developer_instructions = "You are a security reviewer. You analyze source code for vulnerabilities and produce a structured security report.\n\n## Input\nYou receive:\n- A list of files to review\n- Optional focus area (auth, input handling, DB, etc.)\n\n## Security Checklist\n\nFor each file, check:\n- **Hardcoded secrets**: API keys, tokens, passwords, connection strings, private keys\n- **SQL injection**: string concatenation in queries, missing parameterization\n- **XSS**: unescaped user input in HTML/templates, innerHTML usage\n- **CSRF**: missing CSRF tokens on state-changing endpoints\n- **Path traversal**: user input in file paths without sanitization\n- **Auth bypasses**: missing auth checks, broken access control, privilege escalation\n- **Rate limiting**: unprotected endpoints susceptible to abuse\n- **Error leakage**: stack traces, internal paths, or system info in error responses\n- **Dependency vulnerabilities**: run npm audit / pip-audit / cargo audit if available\n\n## OWASP Top 10 Mapping\n\nTag each finding with its OWASP category:\n- A01: Broken Access Control\n- A02: Cryptographic Failures\n- A03: Injection\n- A04: Insecure Design\n- A05: Security Misconfiguration\n- A06: Vulnerable Components\n- A07: Auth Failures\n- A08: Data Integrity Failures\n- A09: Logging Failures\n- A10: SSRF\n\n## Trigger Conditions\n\nPrioritize review of code involving:\n- Authentication or authorization logic\n- User input handling (forms, query params, headers)\n- Database queries\n- File system operations\n- External API calls\n- Cryptographic operations\n- Payment or financial code\n\n## Secret Patterns\n\nScan for common patterns:\n- `AKIA[0-9A-Z]{16}` (AWS access keys)\n- `-----BEGIN (RSA |EC )?PRIVATE KEY-----`\n- `(password|secret|token|api_key)\\s*[:=]\\s*['\"][^'\"]+['\"]`\n- Base64-encoded strings >40 chars in assignments\n\n## Output\n\nReturn a structured security report:\n```markdown\n## Security Review\n\nFiles analyzed: <count>\nFindings: <count by severity>\n\n### Findings\n\n#### [CRITICAL/HIGH/MEDIUM/LOW] <OWASP-ID> - <file>:<line> - <title>\n<description with evidence>\n**Remediation:** <specific fix>\n\n### Summary\n<overall assessment>\n```\n\n## Rules\n- No false positives without evidence
|
|
7
|
+
developer_instructions = "You are a security reviewer. You analyze source code for vulnerabilities and produce a structured security report.\n\n## Input\nYou receive:\n- A list of files to review\n- Optional focus area (auth, input handling, DB, etc.)\n\n## Security Checklist\n\nFor each file, check:\n- **Hardcoded secrets**: API keys, tokens, passwords, connection strings, private keys\n- **SQL injection**: string concatenation in queries, missing parameterization\n- **XSS**: unescaped user input in HTML/templates, innerHTML usage\n- **CSRF**: missing CSRF tokens on state-changing endpoints\n- **Path traversal**: user input in file paths without sanitization\n- **Auth bypasses**: missing auth checks, broken access control, privilege escalation\n- **Rate limiting**: unprotected endpoints susceptible to abuse\n- **Error leakage**: stack traces, internal paths, or system info in error responses\n- **Dependency vulnerabilities**: run npm audit / pip-audit / cargo audit if available\n\n## OWASP Top 10 Mapping\n\nTag each finding with its OWASP category:\n- A01: Broken Access Control\n- A02: Cryptographic Failures\n- A03: Injection\n- A04: Insecure Design\n- A05: Security Misconfiguration\n- A06: Vulnerable Components\n- A07: Auth Failures\n- A08: Data Integrity Failures\n- A09: Logging Failures\n- A10: SSRF\n\n## Trigger Conditions\n\nPrioritize review of code involving:\n- Authentication or authorization logic\n- User input handling (forms, query params, headers)\n- Database queries\n- File system operations\n- External API calls\n- Cryptographic operations\n- Payment or financial code\n\n## Secret Patterns\n\nScan for common patterns:\n- `AKIA[0-9A-Z]{16}` (AWS access keys)\n- `-----BEGIN (RSA |EC )?PRIVATE KEY-----`\n- `(password|secret|token|api_key)\\s*[:=]\\s*['\"][^'\"]+['\"]`\n- Base64-encoded strings >40 chars in assignments\n\n## Output\n\nReturn a structured security report:\n```markdown\n## Security Review\n\nFiles analyzed: <count>\nFindings: <count by severity>\n\n### Findings\n\n#### [CRITICAL/HIGH/MEDIUM/LOW] <OWASP-ID> - <file>:<line> - <title>\n<description with evidence>\n**Remediation:** <specific fix>\n\n### Summary\n<overall assessment>\n```\n\n## Rules\n- No false positives without evidence: cite the exact `file:line` and a one-line description of the weakness as the evidence.\n- Do NOT reproduce exploit payloads, working attack strings, or large copied blocks of vulnerable code in the report. A precise `file:line` reference plus a short description IS the evidence - reproduction detail belongs in the fix pass, not the recorded finding. (This keeps security findings recordable through `workflow critique`, whose reviewer runtime's provider may content-filter exploit-shaped prose.)\n- Run dependency audit tools if available (npm audit, pip-audit, cargo audit).\n- If no security issues found, say so clearly - don't invent findings.\n- This is read-only analysis. Do not modify any files.\n\n## Export Notes\n\nExported from a Kiro agent spec. Hooks, resource auto-loading, and tool allowlists were converted into prompt guidance only. Any explicit Kiro scheduler commands are preserved as optional shell workflows.\n"
|
|
@@ -8,6 +8,7 @@ import { createInterface } from "node:readline/promises";
|
|
|
8
8
|
import { stdin as input, stdout as output } from "node:process";
|
|
9
9
|
import { parseArgs, flagBool, flagList, flagString } from "../lib/args.js";
|
|
10
10
|
import { activateCodexLocal } from "../runtime-adapters.js";
|
|
11
|
+
import { provisionKit, ProvisionConflictError } from "../flow-kit/provision.js";
|
|
11
12
|
import { main as buildBundles } from "../tools/build-universal-bundles.js";
|
|
12
13
|
import { root } from "../tools/common.js";
|
|
13
14
|
import { defaultCodexHome, durableInstallRecordPath, skillsManifestPath } from "../lib/local-artifact-root.js";
|
|
@@ -571,7 +572,21 @@ function installBundle(bundle, options) {
|
|
|
571
572
|
}
|
|
572
573
|
return result.status ?? 1;
|
|
573
574
|
}
|
|
574
|
-
function
|
|
575
|
+
function kitPathForInit(kitId, dest) {
|
|
576
|
+
const catalogPath = path.join(root, "kits", "catalog.json");
|
|
577
|
+
if (fs.existsSync(catalogPath)) {
|
|
578
|
+
const catalog = JSON.parse(fs.readFileSync(catalogPath, "utf8"));
|
|
579
|
+
const entry = Array.isArray(catalog.kits)
|
|
580
|
+
? catalog.kits.find((item) => typeof item === "object" && item !== null && item.id === kitId)
|
|
581
|
+
: undefined;
|
|
582
|
+
const rel = entry && typeof entry === "object" ? entry.path : undefined;
|
|
583
|
+
if (typeof rel === "string")
|
|
584
|
+
return path.resolve(root, rel);
|
|
585
|
+
}
|
|
586
|
+
const installed = path.join(dest, "kits", "local", "repositories", kitId);
|
|
587
|
+
return fs.existsSync(installed) ? installed : null;
|
|
588
|
+
}
|
|
589
|
+
async function activateKits(options) {
|
|
575
590
|
const activeKitIds = options.activeKitIds ?? [];
|
|
576
591
|
if (!options.activateKits || activeKitIds.length === 0 || options.runtime !== "codex")
|
|
577
592
|
return 0;
|
|
@@ -582,6 +597,23 @@ function activateKits(options) {
|
|
|
582
597
|
}
|
|
583
598
|
const generated = Array.isArray(result.generated_runtime_files) ? result.generated_runtime_files : [];
|
|
584
599
|
console.log(`Activated ${generated.length} Codex local runtime asset(s)`);
|
|
600
|
+
for (const kitId of activeKitIds) {
|
|
601
|
+
const kitDir = kitPathForInit(kitId, options.dest);
|
|
602
|
+
if (!kitDir)
|
|
603
|
+
throw new Error(`activated kit '${kitId}' could not be resolved for provisioning`);
|
|
604
|
+
try {
|
|
605
|
+
const provisioned = await provisionKit(kitDir, options.dest);
|
|
606
|
+
if (provisioned.files.length > 0)
|
|
607
|
+
console.log(`Provisioned ${provisioned.files.length} file(s) from kit '${kitId}'`);
|
|
608
|
+
}
|
|
609
|
+
catch (error) {
|
|
610
|
+
if (!(error instanceof ProvisionConflictError))
|
|
611
|
+
throw error;
|
|
612
|
+
for (const conflict of error.conflicts) {
|
|
613
|
+
console.warn(`flow-agents init: warning: skipped existing provision '${conflict.target}' from kit '${kitId}'`);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
}
|
|
585
617
|
return 0;
|
|
586
618
|
}
|
|
587
619
|
/**
|
|
@@ -809,7 +841,7 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
809
841
|
if (installed !== 0)
|
|
810
842
|
return installed;
|
|
811
843
|
writeInstallRecord(options.dest, "codex", true, options.activeKitIds ?? []);
|
|
812
|
-
return activateKits(options);
|
|
844
|
+
return await activateKits(options);
|
|
813
845
|
}
|
|
814
846
|
// --global for pi: NOT_VERIFIED (no documented global dir). Warn and fall through to workspace install.
|
|
815
847
|
if (options.global && options.runtime === "pi") {
|
|
@@ -822,7 +854,7 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
822
854
|
if (installed !== 0)
|
|
823
855
|
return installed;
|
|
824
856
|
writeInstallRecord(options.dest, options.runtime, options.global, options.activeKitIds ?? []);
|
|
825
|
-
const activated = activateKits(options);
|
|
857
|
+
const activated = await activateKits(options);
|
|
826
858
|
// G2/G3: shared post-install auto-verify + summary tail. Applies
|
|
827
859
|
// identically whether main() reached here via headlessOptions() or
|
|
828
860
|
// interactiveOptions() -- never changes `activated`'s exit code.
|
|
@@ -6,7 +6,8 @@ import * as path from "node:path";
|
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import { parseArgs, flagBool, flagString } from "../lib/args.js";
|
|
8
8
|
import { assertPathContained, assertPathsDisjoint, atomicWriteJson, copyDirAtomic, ensureSafeDirectory, isoNow, readJson, walkFiles } from "../lib/fs.js";
|
|
9
|
-
import { assertKitRepository, deriveKitTargets, parseKitDependencies } from "../flow-kit/validate.js";
|
|
9
|
+
import { assertKitRepository, deriveKitTargets, parseKitDependencies, validateKitRepositoryDiagnostics } from "../flow-kit/validate.js";
|
|
10
|
+
import { provisionKit, ProvisionConflictError } from "../flow-kit/provision.js";
|
|
10
11
|
import { activateCodexLocal, activateStrandsLocal } from "../runtime-adapters.js";
|
|
11
12
|
import { defaultCodexHome } from "../lib/local-artifact-root.js";
|
|
12
13
|
import { root } from "../tools/common.js";
|
|
@@ -35,6 +36,18 @@ function resolveCatalogKitSource(source) {
|
|
|
35
36
|
return null;
|
|
36
37
|
return path.resolve(path.dirname(repoCatalogPath), "..", rel);
|
|
37
38
|
}
|
|
39
|
+
function resolveProvisionKitSource(source, dest) {
|
|
40
|
+
const localPath = path.resolve(source);
|
|
41
|
+
if (fs.existsSync(localPath))
|
|
42
|
+
return localPath;
|
|
43
|
+
const installed = loadRegistry(dest).kits.find((entry) => entry.id === source);
|
|
44
|
+
if (installed) {
|
|
45
|
+
const installedSource = installedPath(dest, source);
|
|
46
|
+
if (fs.existsSync(installedSource))
|
|
47
|
+
return installedSource;
|
|
48
|
+
}
|
|
49
|
+
return resolveCatalogKitSource(source);
|
|
50
|
+
}
|
|
38
51
|
function loadRegistry(dest) {
|
|
39
52
|
const file = registryPath(dest);
|
|
40
53
|
if (!fs.existsSync(file))
|
|
@@ -64,6 +77,17 @@ function warnUninstalledDependencies(manifest, manifestPath, dest) {
|
|
|
64
77
|
}
|
|
65
78
|
}
|
|
66
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Print non-blocking kit-validation warnings (e.g. an agent-spawning trigger surface
|
|
82
|
+
* declared without complete guard config — context/contracts/trigger-guards.md).
|
|
83
|
+
* Shared by BOTH install source forms (local path and git clone) so the standing
|
|
84
|
+
* warning contract cannot silently diverge between them. Same non-blocking
|
|
85
|
+
* `warning:` convention as warnUninstalledDependencies above.
|
|
86
|
+
*/
|
|
87
|
+
async function printKitValidationWarnings(kitDir) {
|
|
88
|
+
for (const warning of (await validateKitRepositoryDiagnostics(kitDir)).warnings)
|
|
89
|
+
console.log(`warning: ${warning}`);
|
|
90
|
+
}
|
|
67
91
|
function contentHash(root) {
|
|
68
92
|
const hash = crypto.createHash("sha256");
|
|
69
93
|
for (const file of walkFiles(root)) {
|
|
@@ -122,6 +146,7 @@ async function installLocalSource(source, argv) {
|
|
|
122
146
|
let manifest;
|
|
123
147
|
try {
|
|
124
148
|
manifest = await assertKitRepository(source);
|
|
149
|
+
await printKitValidationWarnings(source);
|
|
125
150
|
}
|
|
126
151
|
catch (error) {
|
|
127
152
|
console.log("Flow Kit repository validation failed:");
|
|
@@ -211,6 +236,7 @@ async function installGitSource(rawUrl, argv) {
|
|
|
211
236
|
let manifest;
|
|
212
237
|
try {
|
|
213
238
|
manifest = await assertKitRepository(tmpBase);
|
|
239
|
+
await printKitValidationWarnings(tmpBase);
|
|
214
240
|
}
|
|
215
241
|
catch (error) {
|
|
216
242
|
console.log("Flow Kit repository validation failed:");
|
|
@@ -321,6 +347,69 @@ function activate(argv) {
|
|
|
321
347
|
console.log(JSON.stringify(result, null, 2));
|
|
322
348
|
return Array.isArray(result.errors) && result.errors.length ? 1 : 0;
|
|
323
349
|
}
|
|
350
|
+
async function validate(argv) {
|
|
351
|
+
const args = parseArgs(argv);
|
|
352
|
+
const kitDir = path.resolve(args.positionals[0] ?? ".");
|
|
353
|
+
const diagnostics = await validateKitRepositoryDiagnostics(kitDir);
|
|
354
|
+
for (const warning of diagnostics.warnings)
|
|
355
|
+
console.log(`warning: ${warning}`);
|
|
356
|
+
if (diagnostics.errors.length) {
|
|
357
|
+
console.log("Flow Kit repository validation failed:");
|
|
358
|
+
for (const error of diagnostics.errors)
|
|
359
|
+
console.log(` - ${error}`);
|
|
360
|
+
return 1;
|
|
361
|
+
}
|
|
362
|
+
console.log(`Flow Kit repository validation passed: ${kitDir}`);
|
|
363
|
+
return 0;
|
|
364
|
+
}
|
|
365
|
+
async function provision(argv) {
|
|
366
|
+
const args = parseArgs(argv);
|
|
367
|
+
const source = args.positionals[0];
|
|
368
|
+
if (!source) {
|
|
369
|
+
console.error("provision: missing <kit-id-or-path> argument");
|
|
370
|
+
console.error("usage: flow-agents kit provision <kit-id-or-path> [--target <dir>] [--force] [--dry-run]");
|
|
371
|
+
return 2;
|
|
372
|
+
}
|
|
373
|
+
const dest = resolveDest(args.flags);
|
|
374
|
+
const kitDir = resolveProvisionKitSource(source, dest);
|
|
375
|
+
if (!kitDir) {
|
|
376
|
+
console.error(`provision: kit '${source}' was not found as a local path, installed kit, or catalog kit`);
|
|
377
|
+
return 1;
|
|
378
|
+
}
|
|
379
|
+
const target = path.resolve(flagString(args.flags, "target", process.cwd()) ?? process.cwd());
|
|
380
|
+
try {
|
|
381
|
+
const result = await provisionKit(kitDir, target, {
|
|
382
|
+
force: flagBool(args.flags, "force"),
|
|
383
|
+
dryRun: flagBool(args.flags, "dry-run"),
|
|
384
|
+
});
|
|
385
|
+
for (const file of result.files)
|
|
386
|
+
console.log(`${result.dry_run ? "would provision" : "provisioned"}: ${file.source} -> ${file.destination}`);
|
|
387
|
+
if (result.dry_run)
|
|
388
|
+
console.log(`dry-run: ${result.files.length} file(s) declared by kit '${result.kit_id}'; no files written`);
|
|
389
|
+
else if (result.files.length === 0)
|
|
390
|
+
console.log(`kit '${result.kit_id}' declares no provisions`);
|
|
391
|
+
else
|
|
392
|
+
console.log(`provisioned ${result.files.length} file(s) from kit '${result.kit_id}' into ${target}`);
|
|
393
|
+
return 0;
|
|
394
|
+
}
|
|
395
|
+
catch (error) {
|
|
396
|
+
if (error instanceof ProvisionConflictError) {
|
|
397
|
+
console.error(`provision: ${error.message}; rerun with --force to overwrite`);
|
|
398
|
+
for (const conflict of error.conflicts)
|
|
399
|
+
console.error(`conflict: ${conflict.target} (${conflict.destination})`);
|
|
400
|
+
return 1;
|
|
401
|
+
}
|
|
402
|
+
const diagnostics = error.diagnostics;
|
|
403
|
+
if (diagnostics?.length) {
|
|
404
|
+
console.error("Flow Kit repository validation failed:");
|
|
405
|
+
for (const diagnostic of diagnostics)
|
|
406
|
+
console.error(` - ${diagnostic}`);
|
|
407
|
+
}
|
|
408
|
+
else
|
|
409
|
+
console.error(`provision: ${error.message}`);
|
|
410
|
+
return 1;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
324
413
|
/**
|
|
325
414
|
* inspect <kit-dir> [--json]
|
|
326
415
|
*
|
|
@@ -375,9 +464,13 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
375
464
|
return status(rest);
|
|
376
465
|
if (command === "activate")
|
|
377
466
|
return activate(rest);
|
|
467
|
+
if (command === "validate")
|
|
468
|
+
return await validate(rest);
|
|
469
|
+
if (command === "provision")
|
|
470
|
+
return await provision(rest);
|
|
378
471
|
if (command === "inspect")
|
|
379
472
|
return await inspect(rest);
|
|
380
|
-
console.error("usage: flow-agents kit <install|activate|inspect|list|status> ...");
|
|
473
|
+
console.error("usage: flow-agents kit <install|activate|validate|provision|inspect|list|status> ...");
|
|
381
474
|
return 2;
|
|
382
475
|
}
|
|
383
476
|
// Use process.exitCode (not process.exit) to allow stdout to be flushed before exit.
|
|
@@ -804,7 +804,13 @@ export function main(argv = process.argv.slice(2)) {
|
|
|
804
804
|
const freshness = revisionFreshness(item, freshnessInputs);
|
|
805
805
|
return { ...item, dependency_impacts: dependencyImpacts(item, resolved), revision_freshness: freshness, readiness: applyFreshnessToReadiness(classify(item, settings, resolved), freshness) };
|
|
806
806
|
});
|
|
807
|
-
|
|
807
|
+
// A configured BoardProvider is the canonical readiness source (docs/decisions/backlog-readiness-source.md).
|
|
808
|
+
// Reaching this issue-level listing path with a board configured is a bypass that must be loud, never silent.
|
|
809
|
+
const bypassedBoard = asRecord(asRecord(settings.board_provider)?.board);
|
|
810
|
+
const warnings = bypassedBoard
|
|
811
|
+
? [{ code: "board_provider_bypassed", message: "A BoardProvider is configured but this pass used WorkItemProvider issue-level listing; board-driven selection is the canonical readiness source. Surface this bypass in the pull-work artifact instead of treating issue listing as a silent fallback." }]
|
|
812
|
+
: [];
|
|
813
|
+
console.log(JSON.stringify({ items, warnings }, null, 2));
|
|
808
814
|
return 0;
|
|
809
815
|
}
|
|
810
816
|
// Use process.exitCode (not process.exit) to allow stdout to be flushed before exit.
|
|
@@ -18,6 +18,7 @@ const sidecarSchemas = {
|
|
|
18
18
|
"critique.json": "schemas/workflow-critique.schema.json",
|
|
19
19
|
"release.json": "schemas/workflow-release.schema.json",
|
|
20
20
|
"learning.json": "schemas/workflow-learning.schema.json",
|
|
21
|
+
"waves.json": "schemas/workflow-waves.schema.json",
|
|
21
22
|
};
|
|
22
23
|
// Runtime coordination records live below a session but are not workflow
|
|
23
24
|
// sidecars. Recursing into them would validate continuation-driver/state.json
|
|
@@ -386,11 +387,63 @@ function validateSidecar(file) {
|
|
|
386
387
|
issues.push({ path: file, message: "deploy decision requires post_deploy_checks to be planned or pass" });
|
|
387
388
|
}
|
|
388
389
|
}
|
|
390
|
+
if (path.basename(file) === "waves.json") {
|
|
391
|
+
validateWaves(file, value, issues);
|
|
392
|
+
}
|
|
389
393
|
if (path.basename(file) === "state.json" && value && typeof value === "object" && !Array.isArray(value) && !("branch" in value)) {
|
|
390
394
|
warnings.push({ path: file, message: "state.json has no branch field (legacy/pre-#289 session) — re-run `ensure-session` to backfill agent/<actor>/<slug>." });
|
|
391
395
|
}
|
|
392
396
|
return { issues, warnings };
|
|
393
397
|
}
|
|
398
|
+
// #663 slice 1: wave-result reconciliation is machine-checkable, not prose. The schema
|
|
399
|
+
// (schemas/workflow-waves.schema.json) validates the shape; these semantic checks enforce the
|
|
400
|
+
// cross-record arithmetic the mini schema engine cannot express: exactly one terminal status
|
|
401
|
+
// record per declared worker, no undeclared reporters, reconciliation counts that match the
|
|
402
|
+
// records, and a `complete` claim that is impossible while any expected worker lacks a
|
|
403
|
+
// worker-landed terminal status. Missing workers must be recorded explicitly as not_reported —
|
|
404
|
+
// a reconciled wave never silently absorbs a dropped worker. Enforcement here is data-level
|
|
405
|
+
// validation only; stop-hook refusal of wave completion is #663 part 3 (slice 2).
|
|
406
|
+
function validateWaves(file, value, issues) {
|
|
407
|
+
const waves = Array.isArray(value?.waves) ? value.waves : [];
|
|
408
|
+
waves.forEach((wave, index) => {
|
|
409
|
+
const loc = `waves.json.waves[${index}]`;
|
|
410
|
+
const expected = Array.isArray(wave?.expected_workers) ? wave.expected_workers : [];
|
|
411
|
+
const results = Array.isArray(wave?.worker_results) ? wave.worker_results : [];
|
|
412
|
+
const expectedIds = expected.map((w) => w?.worker_id).filter((id) => typeof id === "string" && id.length > 0);
|
|
413
|
+
const expectedIdSet = new Set(expectedIds);
|
|
414
|
+
if (expectedIdSet.size !== expectedIds.length)
|
|
415
|
+
issues.push({ path: file, message: `${loc}.expected_workers must declare unique worker_id values` });
|
|
416
|
+
const resultIds = results.map((r) => r?.worker_id).filter((id) => typeof id === "string" && id.length > 0);
|
|
417
|
+
const seen = new Set();
|
|
418
|
+
for (const id of resultIds) {
|
|
419
|
+
if (seen.has(id))
|
|
420
|
+
issues.push({ path: file, message: `${loc}.worker_results has more than one terminal status record for worker ${id}; each worker lands exactly one` });
|
|
421
|
+
seen.add(id);
|
|
422
|
+
if (!expectedIdSet.has(id))
|
|
423
|
+
issues.push({ path: file, message: `${loc}.worker_results records worker ${id} that is not declared in expected_workers; declare every worker in the manifest before dispatch` });
|
|
424
|
+
}
|
|
425
|
+
const reconciliation = wave?.reconciliation;
|
|
426
|
+
if (!reconciliation || typeof reconciliation !== "object" || Array.isArray(reconciliation))
|
|
427
|
+
return;
|
|
428
|
+
const expectedCount = expectedIds.length;
|
|
429
|
+
const reportedIds = new Set(results.filter((r) => ["completed", "failed", "blocked"].includes(r?.status) && expectedIdSet.has(r?.worker_id)).map((r) => r.worker_id));
|
|
430
|
+
const reportedCount = reportedIds.size;
|
|
431
|
+
if (reconciliation.expected_count !== expectedCount)
|
|
432
|
+
issues.push({ path: file, message: `${loc}.reconciliation.expected_count is ${reconciliation.expected_count} but expected_workers declares ${expectedCount}` });
|
|
433
|
+
if (reconciliation.reported_count !== reportedCount)
|
|
434
|
+
issues.push({ path: file, message: `${loc}.reconciliation.reported_count is ${reconciliation.reported_count} but ${reportedCount} of ${expectedCount} expected workers have a worker-landed terminal status (completed|failed|blocked)` });
|
|
435
|
+
const missing = expectedIds.filter((id) => !results.some((r) => r?.worker_id === id));
|
|
436
|
+
for (const id of missing)
|
|
437
|
+
issues.push({ path: file, message: `${loc} is reconciled but worker ${id} has no terminal status record; record it explicitly as not_reported — never silently absorb a missing worker` });
|
|
438
|
+
const notReported = results.filter((r) => r?.status === "not_reported" && expectedIdSet.has(r?.worker_id));
|
|
439
|
+
if (reconciliation.status === "complete" && (missing.length > 0 || notReported.length > 0 || reportedCount !== expectedCount)) {
|
|
440
|
+
issues.push({ path: file, message: `${loc}.reconciliation.status complete requires every expected worker to have a worker-landed terminal status; got ${reportedCount} of ${expectedCount} reported` });
|
|
441
|
+
}
|
|
442
|
+
if (reconciliation.status === "incomplete" && missing.length === 0 && notReported.length === 0 && reportedCount === expectedCount) {
|
|
443
|
+
issues.push({ path: file, message: `${loc}.reconciliation.status incomplete contradicts the records: all ${expectedCount} expected workers reported` });
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
}
|
|
394
447
|
function validateLearningCorrections(file, status, records, issues) {
|
|
395
448
|
records.forEach((record, index) => {
|
|
396
449
|
const correction = record?.correction;
|
|
@@ -733,7 +733,11 @@ function assertDistinctReviewActor(sessionDir, slug) {
|
|
|
733
733
|
const assignment = readActiveAssignment(sessionDir, slug);
|
|
734
734
|
const caller = resolveCurrentAssignmentActor();
|
|
735
735
|
if (assignment.actor_key === caller.actorKey) {
|
|
736
|
-
throw new Error("workflow critique requires a reviewer identity distinct from the active implementation assignment actor"
|
|
736
|
+
throw new Error("workflow critique requires a reviewer identity distinct from the active implementation assignment actor. " +
|
|
737
|
+
"The reviewer identity is derived from the runtime actor, so an orchestrator that implemented and now reviews " +
|
|
738
|
+
"resolves to the same actor. To record an independent review, run the reviewer under a distinct actor: set " +
|
|
739
|
+
"FLOW_AGENTS_ACTOR=<reviewer-id> on the reviewing process, or run the reviewer in a separate runtime session " +
|
|
740
|
+
"(the runtime session id seeds the actor).");
|
|
737
741
|
}
|
|
738
742
|
return caller;
|
|
739
743
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type ProvisionedFile = {
|
|
2
|
+
id: string;
|
|
3
|
+
target: string;
|
|
4
|
+
};
|
|
5
|
+
export type ProvisionPlanEntry = ProvisionedFile & {
|
|
6
|
+
source: string;
|
|
7
|
+
destination: string;
|
|
8
|
+
};
|
|
9
|
+
export type ProvisionResult = {
|
|
10
|
+
kit_id: string;
|
|
11
|
+
kit_hash?: string;
|
|
12
|
+
files: ProvisionPlanEntry[];
|
|
13
|
+
manifest_path?: string;
|
|
14
|
+
dry_run: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare class ProvisionConflictError extends Error {
|
|
17
|
+
readonly conflicts: ProvisionPlanEntry[];
|
|
18
|
+
constructor(conflicts: ProvisionPlanEntry[]);
|
|
19
|
+
}
|
|
20
|
+
export declare function provisionKit(kitDir: string, targetDir: string, options?: {
|
|
21
|
+
force?: boolean;
|
|
22
|
+
dryRun?: boolean;
|
|
23
|
+
}): Promise<ProvisionResult>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as crypto from "node:crypto";
|
|
2
|
+
import * as fs from "node:fs";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import { atomicCopyFile, atomicWriteJson, canonicalProspectivePath, walkFiles } from "../lib/fs.js";
|
|
5
|
+
import { PROVISION_MANIFEST_DIR, assertKitRepository } from "./validate.js";
|
|
6
|
+
export class ProvisionConflictError extends Error {
|
|
7
|
+
conflicts;
|
|
8
|
+
constructor(conflicts) {
|
|
9
|
+
super(`provisioning conflicts with ${conflicts.length} existing destination(s)`);
|
|
10
|
+
this.name = "ProvisionConflictError";
|
|
11
|
+
this.conflicts = conflicts;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function kitContentHash(kitDir) {
|
|
15
|
+
const hash = crypto.createHash("sha256");
|
|
16
|
+
for (const file of walkFiles(kitDir)) {
|
|
17
|
+
const rel = path.relative(kitDir, file).split(path.sep).join("/");
|
|
18
|
+
if (rel.split("/").some((part) => [".git", "__pycache__", ".pytest_cache"].includes(part)))
|
|
19
|
+
continue;
|
|
20
|
+
hash.update(rel);
|
|
21
|
+
hash.update("\0");
|
|
22
|
+
hash.update(fs.readFileSync(file));
|
|
23
|
+
hash.update("\0");
|
|
24
|
+
}
|
|
25
|
+
return `sha256:${hash.digest("hex")}`;
|
|
26
|
+
}
|
|
27
|
+
function isContained(root, candidate) {
|
|
28
|
+
const relative = path.relative(root, candidate);
|
|
29
|
+
return relative !== "" && !relative.startsWith("..") && !path.isAbsolute(relative);
|
|
30
|
+
}
|
|
31
|
+
function assertSafeDestination(rootReal, destination) {
|
|
32
|
+
const prospective = canonicalProspectivePath(destination);
|
|
33
|
+
if (!isContained(rootReal, prospective))
|
|
34
|
+
throw new Error(`provision target escapes consumer repository: ${destination}`);
|
|
35
|
+
if (!fs.existsSync(destination))
|
|
36
|
+
return;
|
|
37
|
+
const stat = fs.lstatSync(destination);
|
|
38
|
+
if (stat.isSymbolicLink())
|
|
39
|
+
throw new Error(`refusing provision target symlink: ${destination}`);
|
|
40
|
+
if (!stat.isFile())
|
|
41
|
+
throw new Error(`provision target is not a regular file: ${destination}`);
|
|
42
|
+
}
|
|
43
|
+
function manifestProvisions(manifest) {
|
|
44
|
+
if (!Array.isArray(manifest.provisions))
|
|
45
|
+
return [];
|
|
46
|
+
return manifest.provisions.map((entry) => {
|
|
47
|
+
const record = entry;
|
|
48
|
+
return {
|
|
49
|
+
id: String(record.id),
|
|
50
|
+
path: String(record.path),
|
|
51
|
+
target: path.posix.normalize(String(record.target).replace(/\\/g, "/")),
|
|
52
|
+
...(typeof record.description === "string" ? { description: record.description } : {}),
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
export async function provisionKit(kitDir, targetDir, options = {}) {
|
|
57
|
+
const kitRoot = fs.realpathSync(path.resolve(kitDir));
|
|
58
|
+
const targetPath = path.resolve(targetDir);
|
|
59
|
+
if (!fs.existsSync(targetPath) || !fs.statSync(targetPath).isDirectory()) {
|
|
60
|
+
throw new Error(`provision target must exist and be a directory: ${targetPath}`);
|
|
61
|
+
}
|
|
62
|
+
const targetRoot = fs.realpathSync(targetPath);
|
|
63
|
+
const manifest = await assertKitRepository(kitRoot);
|
|
64
|
+
const kitId = String(manifest.id);
|
|
65
|
+
const files = manifestProvisions(manifest).map((entry) => ({
|
|
66
|
+
id: entry.id,
|
|
67
|
+
target: entry.target,
|
|
68
|
+
source: path.resolve(kitRoot, entry.path),
|
|
69
|
+
destination: path.resolve(targetRoot, ...entry.target.split("/")),
|
|
70
|
+
}));
|
|
71
|
+
for (const file of files)
|
|
72
|
+
assertSafeDestination(targetRoot, file.destination);
|
|
73
|
+
// Defense in depth against a source swapped to a link after validation: re-assert the
|
|
74
|
+
// link-resolved source stays inside the kit before we read and copy its bytes.
|
|
75
|
+
for (const file of files) {
|
|
76
|
+
const realSource = fs.realpathSync(file.source);
|
|
77
|
+
if (realSource !== kitRoot && !realSource.startsWith(`${kitRoot}${path.sep}`)) {
|
|
78
|
+
throw new Error(`provision source escapes the kit directory: ${file.id}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const conflicts = options.force ? [] : files.filter((file) => fs.existsSync(file.destination));
|
|
82
|
+
if (conflicts.length)
|
|
83
|
+
throw new ProvisionConflictError(conflicts);
|
|
84
|
+
const kitHash = kitContentHash(kitRoot);
|
|
85
|
+
if (options.dryRun || files.length === 0)
|
|
86
|
+
return { kit_id: kitId, kit_hash: kitHash, files, dry_run: Boolean(options.dryRun) };
|
|
87
|
+
const manifestPath = path.join(targetRoot, ...PROVISION_MANIFEST_DIR.split("/"), `${kitId}.json`);
|
|
88
|
+
assertSafeDestination(targetRoot, manifestPath);
|
|
89
|
+
for (const file of files)
|
|
90
|
+
atomicCopyFile(targetRoot, file.source, file.destination);
|
|
91
|
+
atomicWriteJson(targetRoot, manifestPath, {
|
|
92
|
+
schema_version: "1.0",
|
|
93
|
+
kit_id: kitId,
|
|
94
|
+
kit_hash: kitHash,
|
|
95
|
+
provisioned_at: new Date().toISOString(),
|
|
96
|
+
files: files.map(({ id, target }) => ({ id, target })),
|
|
97
|
+
});
|
|
98
|
+
return { kit_id: kitId, kit_hash: kitHash, files, manifest_path: manifestPath, dry_run: false };
|
|
99
|
+
}
|