@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,347 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://flow-agents.dev/schemas/workflow-waves.schema.json",
|
|
4
|
+
"title": "Flow Agents Workflow Waves",
|
|
5
|
+
"description": "Fan-out wave manifest for a workflow session. Each wave declares its expected workers (M) before dispatch; every worker lands exactly one terminal status record; the orchestrator reconciles worker_results against expected_workers at wave close and records an explicit 'N of M reported' reconciliation. A worker that never reported is recorded as not_reported — visible data, never silently absorbed. This sidecar is additive: a session without waves.json declares no fan-out and is unaffected.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"schema_version",
|
|
10
|
+
"task_slug",
|
|
11
|
+
"waves"
|
|
12
|
+
],
|
|
13
|
+
"$defs": {
|
|
14
|
+
"evidence_ref": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"additionalProperties": false,
|
|
17
|
+
"required": [
|
|
18
|
+
"kind"
|
|
19
|
+
],
|
|
20
|
+
"properties": {
|
|
21
|
+
"kind": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"enum": [
|
|
24
|
+
"source",
|
|
25
|
+
"command",
|
|
26
|
+
"artifact",
|
|
27
|
+
"provider",
|
|
28
|
+
"external"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"url": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"minLength": 1
|
|
34
|
+
},
|
|
35
|
+
"file": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"minLength": 1
|
|
38
|
+
},
|
|
39
|
+
"line_start": {
|
|
40
|
+
"type": "integer",
|
|
41
|
+
"minimum": 1
|
|
42
|
+
},
|
|
43
|
+
"line_end": {
|
|
44
|
+
"type": "integer",
|
|
45
|
+
"minimum": 1
|
|
46
|
+
},
|
|
47
|
+
"excerpt": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"minLength": 1
|
|
50
|
+
},
|
|
51
|
+
"summary": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"minLength": 1
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"allOf": [
|
|
57
|
+
{
|
|
58
|
+
"if": {
|
|
59
|
+
"type": "object",
|
|
60
|
+
"properties": {
|
|
61
|
+
"kind": {
|
|
62
|
+
"const": "source"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"required": [
|
|
66
|
+
"kind"
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"then": {
|
|
70
|
+
"required": [
|
|
71
|
+
"file",
|
|
72
|
+
"line_start",
|
|
73
|
+
"line_end",
|
|
74
|
+
"excerpt"
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"if": {
|
|
80
|
+
"type": "object",
|
|
81
|
+
"properties": {
|
|
82
|
+
"kind": {
|
|
83
|
+
"const": "artifact"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"required": [
|
|
87
|
+
"kind"
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
"then": {
|
|
91
|
+
"allOf": [
|
|
92
|
+
{
|
|
93
|
+
"anyOf": [
|
|
94
|
+
{
|
|
95
|
+
"type": "object",
|
|
96
|
+
"required": [
|
|
97
|
+
"file"
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"type": "object",
|
|
102
|
+
"required": [
|
|
103
|
+
"url"
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"anyOf": [
|
|
110
|
+
{
|
|
111
|
+
"type": "object",
|
|
112
|
+
"required": [
|
|
113
|
+
"summary"
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"type": "object",
|
|
118
|
+
"required": [
|
|
119
|
+
"excerpt"
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"if": {
|
|
129
|
+
"type": "object",
|
|
130
|
+
"properties": {
|
|
131
|
+
"kind": {
|
|
132
|
+
"const": "command"
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"required": [
|
|
136
|
+
"kind"
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
"then": {
|
|
140
|
+
"anyOf": [
|
|
141
|
+
{
|
|
142
|
+
"type": "object",
|
|
143
|
+
"required": [
|
|
144
|
+
"excerpt"
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"type": "object",
|
|
149
|
+
"required": [
|
|
150
|
+
"summary"
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"type": "object",
|
|
155
|
+
"required": [
|
|
156
|
+
"url"
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"if": {
|
|
164
|
+
"type": "object",
|
|
165
|
+
"properties": {
|
|
166
|
+
"kind": {
|
|
167
|
+
"enum": [
|
|
168
|
+
"provider",
|
|
169
|
+
"external"
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"required": [
|
|
174
|
+
"kind"
|
|
175
|
+
]
|
|
176
|
+
},
|
|
177
|
+
"then": {
|
|
178
|
+
"required": [
|
|
179
|
+
"url"
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
},
|
|
185
|
+
"expected_worker": {
|
|
186
|
+
"type": "object",
|
|
187
|
+
"additionalProperties": false,
|
|
188
|
+
"required": [
|
|
189
|
+
"worker_id",
|
|
190
|
+
"task"
|
|
191
|
+
],
|
|
192
|
+
"properties": {
|
|
193
|
+
"worker_id": {
|
|
194
|
+
"type": "string",
|
|
195
|
+
"minLength": 1
|
|
196
|
+
},
|
|
197
|
+
"task": {
|
|
198
|
+
"type": "string",
|
|
199
|
+
"minLength": 1
|
|
200
|
+
},
|
|
201
|
+
"role": {
|
|
202
|
+
"type": "string",
|
|
203
|
+
"minLength": 1
|
|
204
|
+
},
|
|
205
|
+
"owned_files": {
|
|
206
|
+
"type": "array",
|
|
207
|
+
"items": {
|
|
208
|
+
"type": "string",
|
|
209
|
+
"minLength": 1
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
"worker_result": {
|
|
215
|
+
"type": "object",
|
|
216
|
+
"additionalProperties": false,
|
|
217
|
+
"required": [
|
|
218
|
+
"worker_id",
|
|
219
|
+
"status",
|
|
220
|
+
"summary",
|
|
221
|
+
"recorded_at"
|
|
222
|
+
],
|
|
223
|
+
"properties": {
|
|
224
|
+
"worker_id": {
|
|
225
|
+
"type": "string",
|
|
226
|
+
"minLength": 1
|
|
227
|
+
},
|
|
228
|
+
"status": {
|
|
229
|
+
"type": "string",
|
|
230
|
+
"enum": [
|
|
231
|
+
"completed",
|
|
232
|
+
"failed",
|
|
233
|
+
"blocked",
|
|
234
|
+
"not_reported"
|
|
235
|
+
]
|
|
236
|
+
},
|
|
237
|
+
"summary": {
|
|
238
|
+
"type": "string",
|
|
239
|
+
"minLength": 1
|
|
240
|
+
},
|
|
241
|
+
"recorded_at": {
|
|
242
|
+
"type": "string",
|
|
243
|
+
"format": "date-time"
|
|
244
|
+
},
|
|
245
|
+
"evidence_refs": {
|
|
246
|
+
"type": "array",
|
|
247
|
+
"items": {
|
|
248
|
+
"$ref": "#/$defs/evidence_ref"
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
"reconciliation": {
|
|
254
|
+
"type": "object",
|
|
255
|
+
"additionalProperties": false,
|
|
256
|
+
"required": [
|
|
257
|
+
"status",
|
|
258
|
+
"expected_count",
|
|
259
|
+
"reported_count",
|
|
260
|
+
"summary",
|
|
261
|
+
"reconciled_at"
|
|
262
|
+
],
|
|
263
|
+
"properties": {
|
|
264
|
+
"status": {
|
|
265
|
+
"type": "string",
|
|
266
|
+
"enum": [
|
|
267
|
+
"complete",
|
|
268
|
+
"incomplete"
|
|
269
|
+
]
|
|
270
|
+
},
|
|
271
|
+
"expected_count": {
|
|
272
|
+
"type": "integer",
|
|
273
|
+
"minimum": 0
|
|
274
|
+
},
|
|
275
|
+
"reported_count": {
|
|
276
|
+
"type": "integer",
|
|
277
|
+
"minimum": 0
|
|
278
|
+
},
|
|
279
|
+
"summary": {
|
|
280
|
+
"type": "string",
|
|
281
|
+
"minLength": 1
|
|
282
|
+
},
|
|
283
|
+
"reconciled_at": {
|
|
284
|
+
"type": "string",
|
|
285
|
+
"format": "date-time"
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
"wave": {
|
|
290
|
+
"type": "object",
|
|
291
|
+
"additionalProperties": false,
|
|
292
|
+
"required": [
|
|
293
|
+
"wave_id",
|
|
294
|
+
"step",
|
|
295
|
+
"declared_at",
|
|
296
|
+
"expected_workers"
|
|
297
|
+
],
|
|
298
|
+
"properties": {
|
|
299
|
+
"wave_id": {
|
|
300
|
+
"type": "string",
|
|
301
|
+
"minLength": 1
|
|
302
|
+
},
|
|
303
|
+
"step": {
|
|
304
|
+
"type": "string",
|
|
305
|
+
"minLength": 1
|
|
306
|
+
},
|
|
307
|
+
"declared_at": {
|
|
308
|
+
"type": "string",
|
|
309
|
+
"format": "date-time"
|
|
310
|
+
},
|
|
311
|
+
"expected_workers": {
|
|
312
|
+
"type": "array",
|
|
313
|
+
"minItems": 1,
|
|
314
|
+
"items": {
|
|
315
|
+
"$ref": "#/$defs/expected_worker"
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
"worker_results": {
|
|
319
|
+
"type": "array",
|
|
320
|
+
"items": {
|
|
321
|
+
"$ref": "#/$defs/worker_result"
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
"reconciliation": {
|
|
325
|
+
"$ref": "#/$defs/reconciliation"
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
"properties": {
|
|
331
|
+
"schema_version": {
|
|
332
|
+
"type": "string",
|
|
333
|
+
"const": "1.0"
|
|
334
|
+
},
|
|
335
|
+
"task_slug": {
|
|
336
|
+
"type": "string",
|
|
337
|
+
"minLength": 1
|
|
338
|
+
},
|
|
339
|
+
"waves": {
|
|
340
|
+
"type": "array",
|
|
341
|
+
"minItems": 1,
|
|
342
|
+
"items": {
|
|
343
|
+
"$ref": "#/$defs/wave"
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* check-layer-boundary — kit/engine layer-doctrine ratchet.
|
|
4
|
+
*
|
|
5
|
+
* Doctrine (veritas docs/architecture/engine-surface-seam.md, Invariant 3; ADR 0008/0016):
|
|
6
|
+
* kits distribute by copy/activate/CLI and consume a product engine via CLI + artifacts, NEVER
|
|
7
|
+
* as an npm library import. A kit that `import`s the veritas evaluation engine would fork the
|
|
8
|
+
* layer boundary — the kit must wrap the engine's CLI, not link its code. This is the executable
|
|
9
|
+
* enforcement of that invariant (flow-agents#651).
|
|
10
|
+
*
|
|
11
|
+
* FAILS if any tracked file under kits/ imports `@kontourai/veritas` (or its `/engine` subpath),
|
|
12
|
+
* or if any kit.json declares it as a dependency. The kit's trust-bundle adapter may import
|
|
13
|
+
* `@kontourai/surface` (the open trust format, Layer 3) — that is the sanctioned channel and is
|
|
14
|
+
* NOT matched here. No allowlist: the count is zero today and must stay zero.
|
|
15
|
+
*
|
|
16
|
+
* Not a violation (and not matched — import-syntax-scoped): the many descriptive strings naming
|
|
17
|
+
* "@kontourai/veritas" in kit.json descriptions, docs, and recorded CLI-output fixtures are prose
|
|
18
|
+
* and data, not code imports.
|
|
19
|
+
*/
|
|
20
|
+
import { execFileSync } from "node:child_process";
|
|
21
|
+
import { readFileSync } from "node:fs";
|
|
22
|
+
|
|
23
|
+
// Match import/require/dynamic-import of the veritas package (root or /engine subpath) only, so
|
|
24
|
+
// prose/fixture mentions of the package name can never trip it — only an actual code link does.
|
|
25
|
+
const PKG = String.raw`@kontourai/veritas(?:/[A-Za-z0-9_./-]+)?`;
|
|
26
|
+
const IMPORT_PATTERNS = [
|
|
27
|
+
new RegExp(String.raw`from\s+['"](?:${PKG})['"]`),
|
|
28
|
+
new RegExp(String.raw`require(?:\.resolve)?\(\s*['"](?:${PKG})['"]\s*\)`),
|
|
29
|
+
new RegExp(String.raw`import\(\s*['"](?:${PKG})['"]\s*\)`),
|
|
30
|
+
];
|
|
31
|
+
const SOURCE_EXT = /\.(ts|tsx|mjs|cjs|js|jsx)$/;
|
|
32
|
+
|
|
33
|
+
// Strip comments so an import-SHAPED example inside a doc comment (e.g. a JSDoc `* import ...`
|
|
34
|
+
// line) is not a false positive. A real import statement never starts a line with `//` or `*`,
|
|
35
|
+
// so this only removes prose, never a genuine dependency edge. (Line-scoped — not a full parser;
|
|
36
|
+
// a package name inside a string literal remains matchable, which is intentional.)
|
|
37
|
+
function codeOnly(line) {
|
|
38
|
+
const trimmed = line.trimStart();
|
|
39
|
+
if (trimmed.startsWith("//") || trimmed.startsWith("*") || trimmed.startsWith("/*")) return "";
|
|
40
|
+
return line.replace(/\/\*.*?\*\//g, "").replace(/\/\/.*$/, "");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function trackedFiles(dir) {
|
|
44
|
+
return execFileSync("git", ["ls-files", dir], { encoding: "utf8" })
|
|
45
|
+
.split("\n")
|
|
46
|
+
.map((line) => line.trim())
|
|
47
|
+
.filter(Boolean);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const violations = [];
|
|
51
|
+
|
|
52
|
+
// 1. Source imports under kits/.
|
|
53
|
+
for (const file of trackedFiles("kits").filter((f) => SOURCE_EXT.test(f))) {
|
|
54
|
+
let text;
|
|
55
|
+
try {
|
|
56
|
+
text = readFileSync(file, "utf8");
|
|
57
|
+
} catch {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
text.split("\n").forEach((line, index) => {
|
|
61
|
+
if (IMPORT_PATTERNS.some((re) => re.test(codeOnly(line)))) {
|
|
62
|
+
violations.push(`${file}:${index + 1} imports @kontourai/veritas — kits wrap the engine via CLI, not as a library`);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 2. kit.json dependency declarations.
|
|
68
|
+
for (const file of trackedFiles("kits").filter((f) => f.endsWith("kit.json"))) {
|
|
69
|
+
let manifest;
|
|
70
|
+
try {
|
|
71
|
+
manifest = JSON.parse(readFileSync(file, "utf8"));
|
|
72
|
+
} catch {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
for (const field of ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"]) {
|
|
76
|
+
const decl = manifest[field];
|
|
77
|
+
if (decl && typeof decl === "object" && !Array.isArray(decl)) {
|
|
78
|
+
for (const name of ["@kontourai/veritas"]) {
|
|
79
|
+
if (Object.prototype.hasOwnProperty.call(decl, name)) {
|
|
80
|
+
violations.push(`${file} ${field}.${name} — a kit must not declare the engine as an npm dependency`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (violations.length) {
|
|
88
|
+
console.error("[check-layer-boundary] FAILED — a kit imports/depends on the veritas engine as a library (engine/surface seam, Invariant 3):");
|
|
89
|
+
for (const v of violations) console.error(` ${v}`);
|
|
90
|
+
console.error(
|
|
91
|
+
"\nKits distribute by copy/activate/CLI and consume the engine via its CLI + recorded artifacts,\n" +
|
|
92
|
+
"never as an npm library import. The trust-bundle adapter may import @kontourai/surface (the open\n" +
|
|
93
|
+
"trust format); it must not import @kontourai/veritas. See veritas docs/architecture/engine-surface-seam.md.",
|
|
94
|
+
);
|
|
95
|
+
process.exitCode = 1;
|
|
96
|
+
} else {
|
|
97
|
+
console.log("[check-layer-boundary] OK — no kit imports or declares the veritas engine as a library.");
|
|
98
|
+
}
|
|
@@ -105,9 +105,15 @@ async function main() {
|
|
|
105
105
|
let conflict;
|
|
106
106
|
if (canonical === 'postToolUse') {
|
|
107
107
|
try {
|
|
108
|
+
// Richer "real liveness": name the tool this pulse rode in on so the heartbeat says WHAT the
|
|
109
|
+
// agent is doing, not just that it is alive. Claude Code's PostToolUse payload carries the
|
|
110
|
+
// tool name as `tool_name` (fall back to `toolName`); the heartbeat sanitizes it, so a
|
|
111
|
+
// missing/odd value degrades to a plain aliveness pulse rather than an error.
|
|
112
|
+
const toolName = payload.tool_name || payload.toolName;
|
|
108
113
|
const heartbeatResult = require('./lib/liveness-heartbeat').maybeEmitHeartbeat({
|
|
109
114
|
cwd: process.cwd(),
|
|
110
115
|
env: process.env,
|
|
116
|
+
activity: toolName ? { tool: toolName } : undefined,
|
|
111
117
|
});
|
|
112
118
|
conflict = heartbeatResult && heartbeatResult.conflict;
|
|
113
119
|
} catch (err) {
|
|
@@ -164,6 +164,39 @@ function readActiveSlug(root, actorKey) {
|
|
|
164
164
|
return sanitized === 'unknown' ? '' : sanitized;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
+
/**
|
|
168
|
+
* Sanitize an optional caller-supplied `activity` descriptor into a clean, bounded shape suitable
|
|
169
|
+
* for embedding in the emitted heartbeat event (issue: richer "real liveness" signals). The point
|
|
170
|
+
* is to make each pulse say WHAT the agent is doing right now — the tool it just ran — not merely
|
|
171
|
+
* that it is alive. Every field flows both into the local append-only JSONL and (via relay.sh) into
|
|
172
|
+
* the hosted Console record, so each value is passed through the same allowlist+64-cap
|
|
173
|
+
* `sanitizeSegment` the write side already applies to actors/slugs: a hostile or oversized tool
|
|
174
|
+
* name (a custom MCP tool string, a hand-edited hook payload) can never inject control bytes or
|
|
175
|
+
* unbounded text downstream. Returns `undefined` when there is no usable activity, so the caller
|
|
176
|
+
* omits the field entirely rather than emitting `activity: {}` noise.
|
|
177
|
+
*
|
|
178
|
+
* @param {{tool?: string}|undefined} activity
|
|
179
|
+
* @returns {{tool: string}|undefined}
|
|
180
|
+
*/
|
|
181
|
+
function sanitizeActivity(activity) {
|
|
182
|
+
// Fully self-contained fail-safe: this runs on the hot path just BEFORE the durable local append
|
|
183
|
+
// in maybeEmitHeartbeat, and local-first is sacred (ADR 0012 §5) — enriching the pulse must never
|
|
184
|
+
// be able to prevent the write. `String(activity.tool)` could in principle throw for an exotic
|
|
185
|
+
// caller value (a throwing toString/valueOf); swallow it here and degrade to a plain aliveness
|
|
186
|
+
// pulse rather than letting the durable write be skipped.
|
|
187
|
+
try {
|
|
188
|
+
if (!activity || typeof activity !== 'object') return undefined;
|
|
189
|
+
const out = {};
|
|
190
|
+
if (activity.tool != null && String(activity.tool).trim()) {
|
|
191
|
+
const tool = sanitizeSegment(activity.tool);
|
|
192
|
+
if (tool && tool !== 'unknown') out.tool = tool;
|
|
193
|
+
}
|
|
194
|
+
return Object.keys(out).length ? out : undefined;
|
|
195
|
+
} catch {
|
|
196
|
+
return undefined;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
167
200
|
/**
|
|
168
201
|
* Filter a list of parsed liveness events down to the ones matching a given
|
|
169
202
|
* (subjectId, actor) pair. Shared by the bounded tail read and the full-read
|
|
@@ -270,7 +303,11 @@ function attachConflictField(result, conflict) {
|
|
|
270
303
|
* wall-clock timer), so it fires once per genuinely new conflicting event, independent of
|
|
271
304
|
* whether our own heartbeat emits or throttles this call.
|
|
272
305
|
*
|
|
273
|
-
* @param {{cwd?: string, env?: NodeJS.ProcessEnv, now?: Date|string}} [opts]
|
|
306
|
+
* @param {{cwd?: string, env?: NodeJS.ProcessEnv, now?: Date|string, activity?: {tool?: string}}} [opts]
|
|
307
|
+
* `activity` is an optional descriptor of what the agent is doing right now (e.g. the tool this
|
|
308
|
+
* postToolUse pulse rode in on); when present + usable it is sanitized and embedded in the emitted
|
|
309
|
+
* heartbeat so the fleet view shows WHAT, not just aliveness. Purely additive — never affects the
|
|
310
|
+
* throttle/emit/conflict decisions.
|
|
274
311
|
* @returns {{emitted: boolean, reason?: string, conflict?: {actor: string, lastAt: string, ttlSeconds: number}}}
|
|
275
312
|
*/
|
|
276
313
|
function maybeEmitHeartbeat(opts = {}) {
|
|
@@ -383,12 +420,16 @@ function maybeEmitHeartbeat(opts = {}) {
|
|
|
383
420
|
const conflict = computeConflict(holderEvents, slug, actor, nowMs, last.at);
|
|
384
421
|
|
|
385
422
|
const nowIso = new Date(nowMs).toISOString();
|
|
423
|
+
const activity = sanitizeActivity(opts.activity);
|
|
386
424
|
appendLivenessEvent(root, {
|
|
387
425
|
type: 'heartbeat',
|
|
388
426
|
subjectId: slug,
|
|
389
427
|
actor,
|
|
390
428
|
at: nowIso,
|
|
391
429
|
source: 'tool-activity',
|
|
430
|
+
// Richer "real liveness": name the tool this pulse rode in on, so the fleet view shows WHAT
|
|
431
|
+
// each agent is doing, not just that it is alive. Omitted entirely when no usable activity.
|
|
432
|
+
...(activity ? { activity } : {}),
|
|
392
433
|
});
|
|
393
434
|
return attachConflictField({ emitted: true }, conflict);
|
|
394
435
|
} catch (err) {
|
|
@@ -18,27 +18,127 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
const fs = require('fs');
|
|
21
|
+
const os = require('os');
|
|
21
22
|
const path = require('path');
|
|
22
23
|
const { spawn } = require('child_process');
|
|
23
24
|
|
|
25
|
+
const TRUTHY = new Set(['1', 'true', 'yes', 'on']);
|
|
26
|
+
const FALSY = new Set(['0', 'false', 'no', 'off']);
|
|
27
|
+
// Cheap per-process memo keyed by the exact env inputs, so a throttled hot path does at most one
|
|
28
|
+
// conf read per (env flag, conf path) signature. Keyed inputs make unit tests that vary
|
|
29
|
+
// TELEMETRY_CONFIG_FILE independent.
|
|
30
|
+
const relayEnabledCache = new Map();
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The console-conf resolution chain, mirroring scripts/telemetry/lib/config.sh's slot order:
|
|
34
|
+
* 1. TELEMETRY_CONFIG_FILE (env) if set + readable
|
|
35
|
+
* 2. per-workspace override: <workspace-root>/.kontourai/telemetry-console.conf
|
|
36
|
+
* 3. user-global durable override: ~/.flow-agents/telemetry-console.conf
|
|
37
|
+
* 4. the shipped default: scripts/telemetry/telemetry.conf (relative to this file)
|
|
38
|
+
* Slot 4's path is <this file>/../../telemetry/telemetry.conf; the workspace root for slot 2 is
|
|
39
|
+
* three levels up from scripts/hooks/lib. This resolver is only the SPAWN pre-gate — it is
|
|
40
|
+
* intentionally lenient (no mode-600 trust gate). relay.sh re-sources config.sh, which applies the
|
|
41
|
+
* trust gate and is the authoritative decision for both enablement and the POST endpoint, so a
|
|
42
|
+
* lenient "enabled" here at worst spawns a relay.sh that then trust-gates itself to a no-op.
|
|
43
|
+
*
|
|
44
|
+
* ACCEPTED, BY DESIGN (security review LOW, A04): because this pre-gate does NOT re-apply
|
|
45
|
+
* config.sh's mode-600/owner gate, it can read an explicit key from an UNtrusted default-path conf
|
|
46
|
+
* (a mode-644 .kontourai/telemetry-console.conf a local tool dropped) that config.sh would skip.
|
|
47
|
+
* This is fail-toward-no-op, never fail-toward-exfil: the only divergence is (a) we spawn a
|
|
48
|
+
* relay.sh that config.sh then no-ops (harmless), or (b) an untrusted `=0` here suppresses a spawn
|
|
49
|
+
* that a trusted conf would have enabled (a missed pulse — availability only, requiring local FS
|
|
50
|
+
* write access). The pre-gate deliberately does not guarantee relay AVAILABILITY — only that we
|
|
51
|
+
* avoid spawning when nothing plausibly enables it. It NEVER weakens the exfil defense, which lives
|
|
52
|
+
* entirely in relay.sh's authoritative, trust-gated re-resolution.
|
|
53
|
+
* @returns {string|null} first readable conf path, or null
|
|
54
|
+
*/
|
|
55
|
+
function resolveConsoleConfPath(env) {
|
|
56
|
+
const candidates = [
|
|
57
|
+
env.TELEMETRY_CONFIG_FILE,
|
|
58
|
+
path.join(__dirname, '..', '..', '..', '.kontourai', 'telemetry-console.conf'),
|
|
59
|
+
path.join(os.homedir(), '.flow-agents', 'telemetry-console.conf'),
|
|
60
|
+
path.join(__dirname, '..', '..', 'telemetry', 'telemetry.conf'),
|
|
61
|
+
];
|
|
62
|
+
for (const c of candidates) {
|
|
63
|
+
try {
|
|
64
|
+
if (c && fs.existsSync(c) && fs.statSync(c).isFile()) return c;
|
|
65
|
+
} catch {
|
|
66
|
+
/* keep scanning */
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Conf-driven liveness relay enablement (#567 — parity with the economics relay #469, so an
|
|
74
|
+
* operator enables via `console_liveness_relay=1` in the console conf, NOT an env var/.profile).
|
|
75
|
+
* Precedence mirrors config.sh's economics rule EXACTLY (config.sh:182-204): an explicit
|
|
76
|
+
* `console_liveness_relay` conf key wins over the env var; absent a key, a pre-set env var is
|
|
77
|
+
* honored; absent both, default ON once a console sink is configured (any console_*url key present)
|
|
78
|
+
* — opt-out, not silent-off. Best-effort and cheap: any FS/parse failure falls back to the env-only
|
|
79
|
+
* decision; never throws. This is the spawn pre-gate; relay.sh+config.sh is authoritative.
|
|
80
|
+
*/
|
|
81
|
+
function resolveLivenessRelayEnabled(env) {
|
|
82
|
+
const envFlag = String(env.FLOW_AGENTS_CONSOLE_LIVENESS_RELAY || '').toLowerCase();
|
|
83
|
+
const envDecision = TRUTHY.has(envFlag) ? true : FALSY.has(envFlag) ? false : null;
|
|
84
|
+
const cacheKey = `${envFlag}|${env.TELEMETRY_CONFIG_FILE || ''}`;
|
|
85
|
+
if (relayEnabledCache.has(cacheKey)) return relayEnabledCache.get(cacheKey);
|
|
86
|
+
let enabled;
|
|
87
|
+
try {
|
|
88
|
+
let explicit = null;
|
|
89
|
+
let hasConsoleUrl = false;
|
|
90
|
+
const confPath = resolveConsoleConfPath(env);
|
|
91
|
+
if (confPath) {
|
|
92
|
+
for (const raw of fs.readFileSync(confPath, 'utf8').split('\n')) {
|
|
93
|
+
const line = raw.trim();
|
|
94
|
+
if (!line || line.startsWith('#')) continue;
|
|
95
|
+
const eq = line.indexOf('=');
|
|
96
|
+
if (eq < 0) continue;
|
|
97
|
+
const key = line.slice(0, eq).trim();
|
|
98
|
+
const value = line.slice(eq + 1).trim().toLowerCase();
|
|
99
|
+
if (key === 'console_liveness_relay') {
|
|
100
|
+
if (TRUTHY.has(value)) explicit = true;
|
|
101
|
+
else if (FALSY.has(value)) explicit = false;
|
|
102
|
+
} else if (key === 'console_telemetry_url' || key === 'console_url' || key === 'console_telemetry_endpoint_url') {
|
|
103
|
+
if (value) hasConsoleUrl = true;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// config.sh precedence: explicit conf key > pre-set env var > default-on when a console url resolves.
|
|
108
|
+
enabled = explicit !== null ? explicit : envDecision !== null ? envDecision : hasConsoleUrl;
|
|
109
|
+
} catch {
|
|
110
|
+
enabled = envDecision === true; // best-effort: honor only an explicit env-on if the conf read failed
|
|
111
|
+
}
|
|
112
|
+
relayEnabledCache.set(cacheKey, enabled);
|
|
113
|
+
return enabled;
|
|
114
|
+
}
|
|
115
|
+
|
|
24
116
|
/**
|
|
25
|
-
* OPTIONAL console liveness relay (#295, ADR 0021 §4/§7). Best-effort, FULLY
|
|
26
|
-
* liveness event to the hosted Console via `scripts/liveness/relay.sh`.
|
|
27
|
-
* runs AFTER the durable local append and can never block, throw, or
|
|
28
|
-
* `
|
|
29
|
-
* spawn error) is swallowed.
|
|
117
|
+
* OPTIONAL console liveness relay (#295, ADR 0021 §4/§7; conf-driven per #567). Best-effort, FULLY
|
|
118
|
+
* detached mirror of a liveness event to the hosted Console via `scripts/liveness/relay.sh`.
|
|
119
|
+
* Local-first is sacred: this runs AFTER the durable local append and can never block, throw, or
|
|
120
|
+
* affect it — gated on `resolveLivenessRelayEnabled`, the whole thing wrapped so any failure
|
|
121
|
+
* (missing script, spawn error) is swallowed. Not enabled ⇒ a cheap resolve and return (true no-op).
|
|
30
122
|
*
|
|
31
123
|
* @param {object} evt The liveness event just written locally.
|
|
32
124
|
* @returns {void}
|
|
33
125
|
*/
|
|
34
126
|
function relayLivenessEvent(evt) {
|
|
35
127
|
try {
|
|
36
|
-
|
|
37
|
-
if (flag !== '1' && flag !== 'true' && flag !== 'yes' && flag !== 'on') return;
|
|
128
|
+
if (!resolveLivenessRelayEnabled(process.env)) return;
|
|
38
129
|
// scripts/hooks/lib/ -> scripts/liveness/relay.sh (same relative layout in dist/* bundles).
|
|
39
130
|
const relay = path.join(__dirname, '..', '..', 'liveness', 'relay.sh');
|
|
40
131
|
if (!fs.existsSync(relay)) return;
|
|
41
|
-
|
|
132
|
+
// Pass the environment through UNCHANGED — do not force the enable flag. relay.sh re-sources
|
|
133
|
+
// config.sh, which is the authoritative, trust-gated decision for both enablement (conf key >
|
|
134
|
+
// env > default-on) and the POST endpoint. Our resolve above is only a lenient spawn pre-gate:
|
|
135
|
+
// if we enabled from an untrusted default-path conf, config.sh trust-gates relay.sh to a no-op
|
|
136
|
+
// rather than us bypassing it by forcing the flag on.
|
|
137
|
+
const child = spawn('bash', [relay, JSON.stringify(evt)], {
|
|
138
|
+
detached: true,
|
|
139
|
+
stdio: 'ignore',
|
|
140
|
+
env: process.env,
|
|
141
|
+
});
|
|
42
142
|
child.on('error', () => {}); // never surface a spawn failure
|
|
43
143
|
child.unref(); // fully detach — the parent never waits on the relay
|
|
44
144
|
} catch {
|
|
@@ -70,4 +170,4 @@ function appendLivenessEvent(root, evt) {
|
|
|
70
170
|
relayLivenessEvent(evt); // then optionally mirror to the Console — best-effort, detached, off by default
|
|
71
171
|
}
|
|
72
172
|
|
|
73
|
-
module.exports = { livenessStreamFile, appendLivenessEvent };
|
|
173
|
+
module.exports = { livenessStreamFile, appendLivenessEvent, resolveLivenessRelayEnabled };
|