@kontourai/flow-agents 2.3.0 → 3.0.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/CODEOWNERS +16 -0
- package/.github/workflows/ci.yml +44 -0
- package/.github/workflows/trust-reconcile.yml +62 -4
- package/AGENTS.md +4 -4
- package/CHANGELOG.md +62 -0
- package/CONTEXT.md +35 -0
- package/README.md +9 -3
- package/agents/dev.json +1 -1
- package/agents/tool-code-reviewer.json +1 -1
- package/agents/tool-planner.json +3 -3
- package/agents/tool-verifier.json +3 -3
- package/build/src/cli/assignment-provider.d.ts +1 -0
- package/build/src/cli/assignment-provider.js +748 -0
- package/build/src/cli/console-learning-projection.js +3 -2
- package/build/src/cli/effective-assignment-provider-settings.d.ts +1 -0
- package/build/src/cli/effective-assignment-provider-settings.js +125 -0
- package/build/src/cli/init.js +104 -21
- package/build/src/cli/kit.js +37 -6
- package/build/src/cli/pull-work-provider.js +1 -1
- package/build/src/cli/usage-feedback.js +3 -3
- package/build/src/cli/validate-hook-influence.js +1 -0
- package/build/src/cli/validate-workflow-artifacts.js +27 -7
- package/build/src/cli/workflow-artifact-cleanup-audit.js +36 -2
- package/build/src/cli/workflow-sidecar.d.ts +14 -7
- package/build/src/cli/workflow-sidecar.js +938 -168
- package/build/src/cli.js +6 -0
- package/build/src/flow-kit/validate.d.ts +23 -0
- package/build/src/flow-kit/validate.js +67 -1
- package/build/src/index.d.ts +1 -1
- package/build/src/index.js +1 -1
- package/build/src/lib/flow-resolver.d.ts +6 -4
- package/build/src/lib/flow-resolver.js +125 -58
- package/build/src/lib/local-artifact-root.d.ts +14 -2
- package/build/src/lib/local-artifact-root.js +22 -5
- package/build/src/lib/workflow-learning-projection.js +2 -2
- package/build/src/runtime-adapters.d.ts +12 -0
- package/build/src/runtime-adapters.js +56 -16
- package/build/src/tools/build-universal-bundles.js +49 -16
- package/build/src/tools/generate-context-map.js +10 -8
- package/build/src/tools/validate-source-tree.js +24 -1
- package/console.telemetry.json +22 -0
- package/context/contracts/artifact-contract.md +40 -7
- package/context/contracts/assignment-provider-contract.md +239 -0
- package/context/contracts/builder-kit-workflow-state-contract.md +5 -2
- package/context/contracts/decision-registry-contract.md +265 -0
- package/context/contracts/delivery-contract.md +3 -1
- package/context/contracts/execution-contract.md +25 -0
- package/context/contracts/governance-adapter-contract.md +2 -0
- package/context/contracts/knowledge-store-contract.md +197 -0
- package/context/contracts/planning-contract.md +4 -1
- package/context/contracts/review-contract.md +7 -3
- package/context/contracts/sandbox-policy.md +2 -0
- package/context/contracts/standing-directives.md +13 -0
- package/context/contracts/verification-contract.md +11 -1
- package/context/contracts/work-item-contract.md +3 -1
- package/context/deferred/parallelization.md +1 -1
- package/context/gate-awareness.md +4 -4
- package/context/scripts/git-status.sh +2 -2
- package/context/scripts/hooks/config-protection.js +502 -2
- package/context/scripts/hooks/lib/config-protection-remedies.js +69 -0
- package/context/scripts/hooks/run-hook.js +14 -1
- package/context/scripts/hooks/stop-goal-fit.js +1140 -99
- package/context/scripts/hooks/workflow-steering.js +212 -6
- package/context/settings/assignment-provider-settings.json +33 -0
- package/docs/adr/0007-flow-skill-kit-tool-boundary.md +2 -0
- package/docs/adr/0015-flow-flow-agents-boundary-reconciliation.md +35 -0
- package/docs/adr/0019-kit-dependency-ownership.md +62 -0
- package/docs/adr/0020-trust-reconcile-manifest-and-claim-classification.md +290 -0
- package/docs/adr/0021-assignment-leases-and-stale-claim-takeover.md +221 -0
- package/docs/adr/0022-fail-closed-delivery-reconciliation-with-governed-exemptions.md +463 -0
- package/docs/agent-system-guidebook.md +3 -3
- package/docs/agent-usage-feedback-loop.md +6 -6
- package/docs/context-map.md +10 -7
- package/docs/decisions/decision-records.md +57 -0
- package/docs/decisions/index.md +17 -0
- package/docs/decisions/knowledge-store-provider.md +51 -0
- package/docs/decisions/model-routing.md +63 -0
- package/docs/decisions/promotion-gate.md +52 -0
- package/docs/decisions/standing-directives.md +66 -0
- package/docs/developer-architecture.md +1 -1
- package/docs/fixture-ownership.md +4 -0
- package/docs/flow-kit-repository-contract.md +5 -5
- package/docs/getting-started.md +12 -2
- package/docs/integrations/harness-install.md +2 -1
- package/docs/kit-authoring-guide.md +64 -5
- package/docs/knowledge-kit.md +5 -1
- package/docs/learnings/2026-07-improvement-program.md +203 -0
- package/docs/migrations.md +6 -5
- package/docs/north-star.md +2 -2
- package/docs/operating-layers.md +4 -3
- package/docs/repository-structure.md +5 -5
- package/docs/skills-map.md +8 -8
- package/docs/spec/runtime-hook-surface.md +19 -15
- package/docs/spikes/graph-provider-2026-07.md +155 -0
- package/docs/standards-register.md +7 -7
- package/docs/trust-anchor-adoption.md +105 -4
- package/docs/work-item-adapters.md +1 -1
- package/docs/workflow-artifact-lifecycle.md +72 -9
- package/docs/workflow-eval-strategy.md +3 -3
- package/docs/workflow-shared-contracts.md +3 -2
- package/docs/workflow-usage-guide.md +260 -21
- package/evals/acceptance/DEMO-false-completion.md +20 -11
- package/evals/acceptance/prove-capture-teeth-declared.sh +15 -15
- package/evals/acceptance/prove-capture-teeth.sh +11 -11
- package/evals/acceptance/test_kiro_harness.sh +1 -1
- package/evals/ci/antigaming-suite.sh +5 -0
- package/evals/ci/run-baseline.sh +71 -1
- package/evals/fixtures/assignment-provider/actor-a.json +6 -0
- package/evals/fixtures/assignment-provider/actor-b.json +6 -0
- package/evals/fixtures/assignment-provider/github-issue-claimed.json +27 -0
- package/evals/fixtures/assignment-provider/github-issue-unassigned.json +7 -0
- package/evals/fixtures/assignment-provider/liveness-fresh.json +9 -0
- package/evals/fixtures/assignment-provider/liveness-stale.json +9 -0
- package/evals/fixtures/flow-kit-repository/invalid-bad-dependency/flows/review.flow.json +26 -0
- package/evals/fixtures/flow-kit-repository/invalid-bad-dependency/kit.json +13 -0
- package/evals/fixtures/flow-kit-repository/valid-with-dependency/flows/review.flow.json +26 -0
- package/evals/fixtures/flow-kit-repository/valid-with-dependency/kit.json +13 -0
- package/evals/fixtures/hook-influence/cases.json +32 -0
- package/evals/fixtures/pull-work-provider/github-issues.json +6 -6
- package/evals/fixtures/trust-reconcile-exploits/fabricated-attestation.json +59 -0
- package/evals/fixtures/trust-reconcile-exploits/no-label-bypass.json +36 -0
- package/evals/fixtures/trust-reconcile-exploits/skip-assumed-bypass.json +59 -0
- package/evals/fixtures/trust-reconcile-exploits/status-misassertion.json +48 -0
- package/evals/fixtures/trust-reconcile-exploits/waived-command-check.json +44 -0
- package/evals/fixtures/trust-reconcile-mixed-bundle/mixed-bundle.json +159 -0
- package/evals/fixtures/trust-reconcile-ws3/ws3-bundle.json +920 -0
- package/evals/integration/test_actor_identity.sh +254 -0
- package/evals/integration/test_assignment_provider_github.sh +318 -0
- package/evals/integration/test_assignment_provider_local_file.sh +222 -0
- package/evals/integration/test_builder_step_producers.sh +33 -23
- package/evals/integration/test_bundle_install.sh +22 -16
- package/evals/integration/test_bundle_lifecycle.sh +11 -11
- package/evals/integration/test_captured_fail_reconciliation.sh +50 -50
- package/evals/integration/test_checkpoint_signing.sh +43 -0
- package/evals/integration/test_claim_lookup.sh +4 -4
- package/evals/integration/test_codex_hook_resolution.sh +114 -0
- package/evals/integration/test_command_log_concurrency.sh +8 -8
- package/evals/integration/test_command_log_fork_classification.sh +3 -3
- package/evals/integration/test_command_log_integrity.sh +16 -16
- package/evals/integration/test_console_learning_projection.sh +1 -1
- package/evals/integration/test_critique_supersession_roundtrip.sh +182 -0
- package/evals/integration/test_dual_emit_flow_step.sh +145 -0
- package/evals/integration/test_enforcer_expects_driven.sh +12 -12
- package/evals/integration/test_evidence_capture_hook.sh +14 -13
- package/evals/integration/test_fixture_retirement_audit.sh +2 -2
- package/evals/integration/test_flow_agents_statusline.sh +2 -2
- package/evals/integration/test_flow_kit_install_git.sh +52 -0
- package/evals/integration/test_flow_kit_repository.sh +2 -0
- package/evals/integration/test_flowdef_session_activation.sh +6 -6
- package/evals/integration/test_flowdef_union_floor_regression.sh +429 -0
- package/evals/integration/test_gate_bypass_chain.sh +52 -40
- package/evals/integration/test_gate_lockdown.sh +97 -73
- package/evals/integration/test_gate_review_inquiry_records.sh +3 -3
- package/evals/integration/test_goal_fit_escape_hatch.sh +10 -10
- package/evals/integration/test_goal_fit_ghost_session.sh +104 -0
- package/evals/integration/test_goal_fit_hook.sh +32 -32
- package/evals/integration/test_goal_fit_rederive.sh +9 -9
- package/evals/integration/test_hook_category_behaviors.sh +103 -0
- package/evals/integration/test_hook_influence_cases.sh +1 -0
- package/evals/integration/test_install_merge.sh +262 -1
- package/evals/integration/test_kit_identity_trust.sh +6 -6
- package/evals/integration/test_liveness_conflict_injection.sh +587 -0
- package/evals/integration/test_liveness_heartbeat.sh +677 -0
- package/evals/integration/test_liveness_verdict.sh +394 -0
- package/evals/integration/test_local_flow_kit_install.sh +15 -0
- package/evals/integration/test_phase_map_and_gate_claim.sh +63 -11
- package/evals/integration/test_promote_gate.sh +178 -0
- package/evals/integration/test_publish_delivery.sh +23 -6
- package/evals/integration/test_pull_work_assignment_join.sh +132 -0
- package/evals/integration/test_pull_work_liveness_preflight.sh +394 -0
- package/evals/integration/test_pull_work_provider.sh +2 -2
- package/evals/integration/test_reconcile_soundness.sh +37 -13
- package/evals/integration/test_resolvefirststep_security.sh +22 -0
- package/evals/integration/test_runtime_adapter_activation.sh +87 -18
- package/evals/integration/test_session_resume_roundtrip.sh +147 -0
- package/evals/integration/test_sidecar_field_preservation.sh +249 -0
- package/evals/integration/test_trust_reconcile.sh +11 -10
- package/evals/integration/test_trust_reconcile_manifest.sh +79 -0
- package/evals/integration/test_trust_reconcile_mixed_bundle.sh +96 -0
- package/evals/integration/test_trust_reconcile_negatives.sh +759 -0
- package/evals/integration/test_usage_feedback_global.sh +5 -5
- package/evals/integration/test_validate_artifacts_portability.sh +60 -0
- package/evals/integration/test_verify_cli.sh +2 -2
- package/evals/integration/test_veritas_governance_kit.sh +117 -0
- package/evals/integration/test_workflow_artifact_cleanup_audit.sh +26 -1
- package/evals/integration/test_workflow_artifacts.sh +33 -0
- package/evals/integration/test_workflow_sidecar_writer.sh +802 -74
- package/evals/integration/test_workflow_steering_hook.sh +175 -5
- package/evals/lib/codex-provider.sh +1 -1
- package/evals/lib/node.sh +19 -1
- package/evals/run.sh +32 -0
- package/evals/static/test_decisions.sh +150 -0
- package/evals/static/test_flowdef_codeowners_coverage.sh +62 -0
- package/evals/static/test_knowledge_providers.sh +23 -0
- package/evals/static/test_package.sh +19 -10
- package/evals/static/test_universal_bundles.sh +48 -3
- package/evals/static/test_workflow_skills.sh +41 -8
- package/kits/builder/flows/build.flow.json +3 -74
- package/kits/builder/flows/publish-learn.flow.json +90 -0
- package/kits/builder/kit.json +11 -0
- package/kits/builder/skills/builder-shape/SKILL.md +1 -1
- package/kits/builder/skills/deliver/SKILL.md +32 -11
- package/kits/builder/skills/design-probe/SKILL.md +4 -4
- package/kits/builder/skills/evidence-gate/SKILL.md +26 -1
- package/kits/builder/skills/execute-plan/SKILL.md +2 -2
- package/kits/builder/skills/fix-bug/SKILL.md +2 -0
- package/kits/builder/skills/gate-review/SKILL.md +6 -6
- package/kits/builder/skills/idea-to-backlog/SKILL.md +1 -1
- package/kits/builder/skills/learning-review/SKILL.md +7 -7
- package/kits/builder/skills/pickup-probe/SKILL.md +5 -4
- package/kits/builder/skills/plan-work/SKILL.md +27 -5
- package/kits/builder/skills/pull-work/SKILL.md +148 -5
- package/kits/builder/skills/release-readiness/SKILL.md +4 -4
- package/kits/builder/skills/review-work/SKILL.md +24 -1
- package/kits/builder/skills/tdd-workflow/SKILL.md +2 -0
- package/kits/builder/skills/verify-work/SKILL.md +8 -1
- package/kits/catalog.json +6 -0
- package/kits/knowledge/kit.json +35 -0
- package/kits/knowledge/providers/conformance/fixtures/git-repo/CONTEXT.md +12 -0
- package/kits/knowledge/providers/conformance/fixtures/git-repo/docs/decisions/old-sprocket-shape.md +13 -0
- package/kits/knowledge/providers/conformance/fixtures/git-repo/docs/decisions/sprocket-shape.md +14 -0
- package/kits/knowledge/providers/conformance/fixtures/git-repo/docs/decisions/widget-format.md +14 -0
- package/kits/knowledge/providers/conformance/fixtures/git-repo/docs/learnings/fixture-learning.md +7 -0
- package/kits/knowledge/providers/conformance/fixtures/work-item/issues.json +30 -0
- package/kits/knowledge/providers/conformance/suite.test.js +125 -0
- package/kits/knowledge/providers/git-repo/index.js +236 -0
- package/kits/knowledge/providers/health/health-pass.test.js +99 -0
- package/kits/knowledge/providers/health/index.js +153 -0
- package/kits/knowledge/providers/index.js +24 -0
- package/kits/knowledge/providers/lib/model.js +91 -0
- package/kits/knowledge/providers/lib/schema-validate.js +119 -0
- package/kits/knowledge/providers/markdown-vault/index.js +169 -0
- package/kits/knowledge/providers/work-item/index.js +204 -0
- package/kits/veritas-governance/adapter/readiness-to-trust-bundle.mjs +178 -0
- package/kits/veritas-governance/docs/README.md +75 -0
- package/kits/veritas-governance/fixtures/readiness/not-ready.readiness-report.json +4645 -0
- package/kits/veritas-governance/fixtures/readiness/ready.readiness-report.json +4403 -0
- package/kits/veritas-governance/flows/readiness-check.flow.json +35 -0
- package/kits/veritas-governance/kit.json +16 -0
- package/package.json +11 -5
- package/packaging/README.md +2 -2
- package/packaging/conformance/fixtures/config-protection--allow-read-state-json.json +20 -0
- package/packaging/conformance/fixtures/config-protection--block-write-state-json.json +20 -0
- package/packaging/conformance/fixtures/stop-goal-fit--block-bundle-disputed-claim.json +1 -1
- package/packaging/conformance/fixtures/stop-goal-fit--block-capture-contradicts-claimed-pass.json +1 -1
- package/packaging/manifest.json +9 -10
- package/schemas/assignment-provider-settings.schema.json +125 -0
- package/schemas/decision-record.schema.json +109 -0
- package/schemas/knowledge/edge.schema.json +54 -0
- package/schemas/knowledge/health-report.schema.json +45 -0
- package/schemas/knowledge/node.schema.json +49 -0
- package/schemas/knowledge/proposal.schema.json +53 -0
- package/schemas/workflow-evidence.schema.json +1 -1
- package/schemas/workflow-state.schema.json +5 -0
- package/scripts/README.md +8 -3
- package/scripts/check-content-boundary.cjs +1 -1
- package/scripts/check-decisions.cjs +356 -0
- package/scripts/ci/derive-claim-status.mjs +74 -0
- package/scripts/ci/trust-reconcile.js +957 -103
- package/scripts/git-status.sh +2 -2
- package/scripts/hooks/claude-telemetry-hook.js +37 -3
- package/scripts/hooks/codex-telemetry-hook.js +36 -2
- package/scripts/hooks/config-protection.js +102 -30
- package/scripts/hooks/evidence-capture.js +3 -3
- package/scripts/hooks/lib/actor-identity.js +368 -0
- package/scripts/hooks/lib/config-protection-remedies.js +69 -0
- package/scripts/hooks/lib/liveness-heartbeat.js +361 -0
- package/scripts/hooks/lib/liveness-policy.js +127 -0
- package/scripts/hooks/lib/liveness-read.js +105 -12
- package/scripts/hooks/lib/liveness-write.js +46 -0
- package/scripts/hooks/lib/local-artifact-paths.js +12 -6
- package/scripts/hooks/opencode-telemetry-hook.js +27 -1
- package/scripts/hooks/pi-telemetry-hook.js +27 -1
- package/scripts/hooks/stop-goal-fit.js +157 -26
- package/scripts/hooks/workflow-steering.js +77 -3
- package/scripts/install-codex-home.sh +138 -38
- package/scripts/statusline/flow-agents-statusline.js +2 -2
- package/src/cli/assignment-provider.ts +845 -0
- package/src/cli/console-learning-projection.ts +3 -2
- package/src/cli/effective-assignment-provider-settings.ts +112 -0
- package/src/cli/init.ts +101 -21
- package/src/cli/kit.ts +37 -6
- package/src/cli/public-api.test.mjs +58 -6
- package/src/cli/pull-work-provider.ts +1 -1
- package/src/cli/trust-bundle-policy-order.test.mjs +87 -0
- package/src/cli/usage-feedback.ts +3 -3
- package/src/cli/validate-hook-influence.ts +1 -0
- package/src/cli/validate-workflow-artifacts.ts +27 -7
- package/src/cli/veritas-readiness-adapter.test.mjs +267 -0
- package/src/cli/workflow-artifact-cleanup-audit.ts +35 -2
- package/src/cli/workflow-sidecar.ts +933 -168
- package/src/cli.ts +6 -0
- package/src/flow-kit/validate.ts +74 -1
- package/src/index.ts +6 -2
- package/src/lib/flow-resolver.ts +123 -55
- package/src/lib/local-artifact-root.ts +24 -5
- package/src/lib/workflow-learning-projection.ts +2 -2
- package/src/runtime-adapters.ts +61 -15
- package/src/tools/build-universal-bundles.ts +49 -16
- package/src/tools/generate-context-map.ts +10 -8
- package/src/tools/validate-source-tree.ts +24 -1
|
@@ -20,16 +20,16 @@ echo ""
|
|
|
20
20
|
global="$TMPDIR_EVAL/global"
|
|
21
21
|
repo_a="$TMPDIR_EVAL/repo-a"
|
|
22
22
|
repo_b="$TMPDIR_EVAL/repo-b"
|
|
23
|
-
mkdir -p "$repo_a/.flow-agents/alpha" "$repo_b/.flow-agents/beta"
|
|
23
|
+
mkdir -p "$repo_a/.kontourai/flow-agents/alpha" "$repo_b/.kontourai/flow-agents/beta"
|
|
24
24
|
|
|
25
|
-
cat > "$repo_a/.flow-agents/alpha/alpha--deliver.md" <<'MARKDOWN'
|
|
25
|
+
cat > "$repo_a/.kontourai/flow-agents/alpha/alpha--deliver.md" <<'MARKDOWN'
|
|
26
26
|
# Deliver Alpha
|
|
27
27
|
|
|
28
28
|
status: delivered
|
|
29
29
|
type: deliver
|
|
30
30
|
MARKDOWN
|
|
31
31
|
|
|
32
|
-
cat > "$repo_b/.flow-agents/beta/beta--verify.md" <<'MARKDOWN'
|
|
32
|
+
cat > "$repo_b/.kontourai/flow-agents/beta/beta--verify.md" <<'MARKDOWN'
|
|
33
33
|
# Verify Beta
|
|
34
34
|
|
|
35
35
|
status: failed
|
|
@@ -94,8 +94,8 @@ fi
|
|
|
94
94
|
|
|
95
95
|
discover_root="$TMPDIR_EVAL/discover-root"
|
|
96
96
|
repo_c="$discover_root/gamma"
|
|
97
|
-
mkdir -p "$repo_c/.flow-agents/gamma"
|
|
98
|
-
cat > "$repo_c/.flow-agents/gamma/gamma--deliver.md" <<'MARKDOWN'
|
|
97
|
+
mkdir -p "$repo_c/.kontourai/flow-agents/gamma"
|
|
98
|
+
cat > "$repo_c/.kontourai/flow-agents/gamma/gamma--deliver.md" <<'MARKDOWN'
|
|
99
99
|
# Deliver Gamma
|
|
100
100
|
|
|
101
101
|
status: delivered
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_validate_artifacts_portability.sh — flow-agents-validate-artifacts must resolve its
|
|
3
|
+
# JSON Schemas relative to its own installed package, so it runs from any cwd that has no
|
|
4
|
+
# local schemas/ directory (the bug reproduced during planning was an uncaught ENOENT).
|
|
5
|
+
set -uo pipefail
|
|
6
|
+
|
|
7
|
+
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
8
|
+
source "$ROOT/evals/lib/node.sh"
|
|
9
|
+
|
|
10
|
+
errors=0
|
|
11
|
+
TMP_DIR="$(mktemp -d)"
|
|
12
|
+
trap 'rm -rf "$TMP_DIR"' EXIT
|
|
13
|
+
|
|
14
|
+
pass() { echo " ✓ $1"; }
|
|
15
|
+
fail() { echo " ✗ $1"; errors=$((errors + 1)); }
|
|
16
|
+
|
|
17
|
+
flow_agents_build_ts || { echo " ✗ build failed (prerequisite)"; exit 1; }
|
|
18
|
+
SIDECAR="$ROOT/build/src/cli/workflow-sidecar.js"
|
|
19
|
+
VALIDATE="$ROOT/build/src/cli/validate-workflow-artifacts.js"
|
|
20
|
+
|
|
21
|
+
echo "=== validate-workflow-artifacts portability (foreign cwd, no local schemas/) ==="
|
|
22
|
+
|
|
23
|
+
FOREIGN="$TMP_DIR/foreign"
|
|
24
|
+
mkdir -p "$FOREIGN"
|
|
25
|
+
|
|
26
|
+
# Create a minimal valid sidecar set from the foreign cwd (no package.json/kits/schemas here).
|
|
27
|
+
( cd "$FOREIGN" && node "$SIDECAR" ensure-session --source-request "portability smoke" --summary "smoke" --criterion "c1" --task-slug port-smoke ) >"$TMP_DIR/ensure.out" 2>&1
|
|
28
|
+
if [[ -f "$FOREIGN/.kontourai/flow-agents/port-smoke/state.json" ]]; then
|
|
29
|
+
pass "sidecar writer created a sidecar set from a foreign cwd"
|
|
30
|
+
else
|
|
31
|
+
fail "ensure-session did not create sidecars in foreign cwd"
|
|
32
|
+
sed -n '1,80p' "$TMP_DIR/ensure.out"
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
if [[ ! -d "$FOREIGN/schemas" ]]; then
|
|
36
|
+
pass "foreign cwd has no local schemas/ directory (faithful to the bug repro)"
|
|
37
|
+
else
|
|
38
|
+
fail "foreign cwd unexpectedly has a schemas/ directory"
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
# Run validate-artifacts from the foreign cwd; the schema load must resolve package-relative.
|
|
42
|
+
if ( cd "$FOREIGN" && node "$VALIDATE" .kontourai/flow-agents/port-smoke ) >"$TMP_DIR/validate.out" 2>&1; then
|
|
43
|
+
if rg -q "Validated" "$TMP_DIR/validate.out"; then
|
|
44
|
+
pass "validate-workflow-artifacts runs from a foreign cwd (schemas resolved package-relative)"
|
|
45
|
+
else
|
|
46
|
+
fail "validate-artifacts exited 0 but printed no validation summary"
|
|
47
|
+
sed -n '1,80p' "$TMP_DIR/validate.out"
|
|
48
|
+
fi
|
|
49
|
+
else
|
|
50
|
+
fail "validate-artifacts crashed from a foreign cwd (schema-path ENOENT regression?)"
|
|
51
|
+
sed -n '1,80p' "$TMP_DIR/validate.out"
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
echo ""
|
|
55
|
+
if [[ "$errors" -eq 0 ]]; then
|
|
56
|
+
echo "validate-artifacts portability checks passed."
|
|
57
|
+
exit 0
|
|
58
|
+
fi
|
|
59
|
+
echo "validate-artifacts portability checks failed: $errors issue(s)."
|
|
60
|
+
exit 1
|
|
@@ -50,7 +50,7 @@ const fs = require('fs');
|
|
|
50
50
|
const [,, outPath, label, passingStr] = process.argv;
|
|
51
51
|
const passing = passingStr === 'true';
|
|
52
52
|
const bundle = {
|
|
53
|
-
schemaVersion:
|
|
53
|
+
schemaVersion: 5,
|
|
54
54
|
source: "test-fixture",
|
|
55
55
|
claims: [
|
|
56
56
|
{
|
|
@@ -59,7 +59,7 @@ const bundle = {
|
|
|
59
59
|
value: passing ? "pass" : "fail",
|
|
60
60
|
status: passing ? "verified" : "disputed",
|
|
61
61
|
subjectId: "test/build",
|
|
62
|
-
|
|
62
|
+
facet: "flow-agents.workflow",
|
|
63
63
|
subjectType: "workflow-check",
|
|
64
64
|
fieldOrBehavior: "build",
|
|
65
65
|
createdAt: "2026-06-27T00:00:00Z",
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_veritas_governance_kit.sh — Veritas Governance Kit slice 1 gate demo (agentless).
|
|
3
|
+
#
|
|
4
|
+
# Proves the kit's readiness-check flow gates a REAL `veritas readiness` verdict, projected
|
|
5
|
+
# into a Hachure trust.bundle by the kit adapter (kits/veritas-governance/adapter/
|
|
6
|
+
# readiness-to-trust-bundle.mjs):
|
|
7
|
+
# POSITIVE: a ready readiness report -> verified software-readiness-verdict claim ->
|
|
8
|
+
# flow evaluate exits 0 (gate passes).
|
|
9
|
+
# NEGATIVE: a not-ready readiness report (injected Repo Standards violation) -> disputed
|
|
10
|
+
# claim -> flow evaluate --exit-code exits 1 (gate BLOCKS, not silently passed).
|
|
11
|
+
#
|
|
12
|
+
# The two committed fixtures under kits/veritas-governance/fixtures/readiness/ are REAL,
|
|
13
|
+
# captured `veritas readiness --check evidence --working-tree` evidence reports (ready = a
|
|
14
|
+
# clean checkout of kontourai/veritas; not-ready = the same tree with a required CLI artifact
|
|
15
|
+
# deleted, a Require-enforcement violation). When a Veritas binary is resolvable (VERITAS_BIN,
|
|
16
|
+
# or `veritas` on PATH) AND VERITAS_GOVERNED_REPO points at a Veritas-governed repo, the eval
|
|
17
|
+
# ALSO runs Veritas live and re-derives both paths; otherwise it prints SKIP for the live leg
|
|
18
|
+
# and relies on the captured real-output fixtures (deterministic in CI).
|
|
19
|
+
set -uo pipefail
|
|
20
|
+
|
|
21
|
+
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
22
|
+
source "$ROOT/evals/lib/node.sh"
|
|
23
|
+
|
|
24
|
+
errors=0
|
|
25
|
+
TMP_DIR="$(mktemp -d)"
|
|
26
|
+
trap 'rm -rf "$TMP_DIR"' EXIT
|
|
27
|
+
pass() { echo " ✓ $1"; }
|
|
28
|
+
fail() { echo " ✗ $1"; errors=$((errors + 1)); }
|
|
29
|
+
|
|
30
|
+
KIT="$ROOT/kits/veritas-governance"
|
|
31
|
+
ADAPTER="$KIT/adapter/readiness-to-trust-bundle.mjs"
|
|
32
|
+
FLOWDEF="$KIT/flows/readiness-check.flow.json"
|
|
33
|
+
FLOW_CLI="$ROOT/node_modules/@kontourai/flow/dist/cli.js"
|
|
34
|
+
|
|
35
|
+
echo "=== Veritas Governance Kit — slice 1 gate demo ==="
|
|
36
|
+
|
|
37
|
+
# --- Kit container is K0-valid --------------------------------------------------
|
|
38
|
+
if node "$FLOW_CLI" kit validate "$KIT" >"$TMP_DIR/kitval.out" 2>&1; then
|
|
39
|
+
pass "kit container validates (flow kit validate)"
|
|
40
|
+
else
|
|
41
|
+
fail "kit container failed validation"; sed -n '1,40p' "$TMP_DIR/kitval.out"
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
# --- No-fork: kit does not vendor/reimplement Veritas rule/claim evaluation ------
|
|
45
|
+
# Scope to kit SOURCE (adapter + flows), not fixtures/ — the fixtures are real Veritas
|
|
46
|
+
# OUTPUT and legitimately embed Veritas rule ids and check labels.
|
|
47
|
+
if rg -q -i 'evaluateRepoStandards|evidence-check-runner\.mjs|class +[A-Za-z]*RuleEngine|repo-standards/default\.repo-standards\.json' "$KIT/adapter" "$KIT/flows" 2>/dev/null; then
|
|
48
|
+
fail "kit source appears to vendor/reimplement Veritas evaluation logic (no-fork violated)"
|
|
49
|
+
else
|
|
50
|
+
pass "no-fork: kit source references Veritas recorded output only (no vendored rule/claim engine)"
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
# --- Gate one readiness fixture; assert the expected evaluate exit code ----------
|
|
54
|
+
# $1 fixture path, $2 label, $3 expected exit (0=pass, 1=block)
|
|
55
|
+
gate_case() {
|
|
56
|
+
local fixture="$1" label="$2" expect="$3"
|
|
57
|
+
local work="$TMP_DIR/$label"; mkdir -p "$work"; ( cd "$work" && node "$FLOW_CLI" init >/dev/null 2>&1 )
|
|
58
|
+
local bundle="$work/readiness.bundle"
|
|
59
|
+
if ! node "$ADAPTER" --report "$fixture" --out "$bundle" >"$work/adapter.out" 2>&1; then
|
|
60
|
+
fail "[$label] adapter failed to project readiness report"; sed -n '1,20p' "$work/adapter.out"; return
|
|
61
|
+
fi
|
|
62
|
+
( cd "$work" && node "$FLOW_CLI" start "$FLOWDEF" --run-id "$label" >/dev/null 2>&1 )
|
|
63
|
+
( cd "$work" && node "$FLOW_CLI" attach-evidence "$label" --gate gate-check-gate --file "$bundle" --bundle >"$work/attach.out" 2>&1 )
|
|
64
|
+
if ! rg -q 'kind: trust.bundle' "$work/attach.out"; then
|
|
65
|
+
fail "[$label] evidence did not attach as kind: trust.bundle"; sed -n '1,20p' "$work/attach.out"; return
|
|
66
|
+
fi
|
|
67
|
+
( cd "$work" && node "$FLOW_CLI" evaluate "$label" --gate gate-check-gate --exit-code >"$work/eval.out" 2>&1 )
|
|
68
|
+
local got=$?
|
|
69
|
+
if [[ "$got" == "$expect" ]]; then
|
|
70
|
+
pass "[$label] gate evaluate exit $got as expected ($(rg -o '^(pass|block|route-back) gate-check-gate.*' "$work/eval.out" | head -1))"
|
|
71
|
+
else
|
|
72
|
+
fail "[$label] gate evaluate exit $got, expected $expect"; sed -n '1,20p' "$work/eval.out"
|
|
73
|
+
fi
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
echo "--- captured real-veritas-output fixtures ---"
|
|
77
|
+
gate_case "$KIT/fixtures/readiness/ready.readiness-report.json" "positive" 0
|
|
78
|
+
gate_case "$KIT/fixtures/readiness/not-ready.readiness-report.json" "negative" 1
|
|
79
|
+
|
|
80
|
+
# --- Optional live Veritas leg --------------------------------------------------
|
|
81
|
+
VBIN="${VERITAS_BIN:-veritas}"
|
|
82
|
+
if command -v "$VBIN" >/dev/null 2>&1 && [[ -n "${VERITAS_GOVERNED_REPO:-}" && -d "${VERITAS_GOVERNED_REPO:-}/.veritas" ]]; then
|
|
83
|
+
echo "--- live Veritas leg (VERITAS_GOVERNED_REPO=$VERITAS_GOVERNED_REPO) ---"
|
|
84
|
+
live="$TMP_DIR/live"; mkdir -p "$live"
|
|
85
|
+
rsync -a --exclude .git --exclude node_modules --exclude .kontourai "$VERITAS_GOVERNED_REPO/" "$live/repo/" >/dev/null 2>&1
|
|
86
|
+
ln -s "$VERITAS_GOVERNED_REPO/node_modules" "$live/repo/node_modules" 2>/dev/null || true
|
|
87
|
+
# `veritas readiness --working-tree` diffs against git; the copy needs its own git repo.
|
|
88
|
+
( cd "$live/repo" && git init -q && git add -A && git -c user.email=eval@local -c user.name=eval commit -qm baseline ) >/dev/null 2>&1
|
|
89
|
+
# live-positive: clean tree
|
|
90
|
+
( cd "$live/repo" && "$VBIN" readiness --check evidence --working-tree >/dev/null 2>&1 )
|
|
91
|
+
live_rep="$(ls -t "$live/repo/.kontourai/veritas/evidence/"*.json 2>/dev/null | head -1)"
|
|
92
|
+
if [[ -n "$live_rep" ]]; then
|
|
93
|
+
gate_case "$live_rep" "live-positive" 0
|
|
94
|
+
else
|
|
95
|
+
fail "live Veritas clean run produced no evidence report"
|
|
96
|
+
fi
|
|
97
|
+
# live-negative: inject a Require-enforcement violation (delete a required CLI artifact)
|
|
98
|
+
rm -f "$live/repo/bin/veritas-report.mjs"
|
|
99
|
+
( cd "$live/repo" && "$VBIN" readiness --check evidence --working-tree >/dev/null 2>&1 )
|
|
100
|
+
live_neg="$(ls -t "$live/repo/.kontourai/veritas/evidence/"*.json 2>/dev/null | head -1)"
|
|
101
|
+
if [[ -n "$live_neg" && "$live_neg" != "$live_rep" ]]; then
|
|
102
|
+
gate_case "$live_neg" "live-negative" 1
|
|
103
|
+
else
|
|
104
|
+
fail "live Veritas injected-violation run produced no fresh evidence report"
|
|
105
|
+
fi
|
|
106
|
+
else
|
|
107
|
+
echo " - SKIP live Veritas leg (set VERITAS_BIN + VERITAS_GOVERNED_REPO to enable); fixtures are captured real output"
|
|
108
|
+
fi
|
|
109
|
+
|
|
110
|
+
echo ""
|
|
111
|
+
if [[ "$errors" -eq 0 ]]; then
|
|
112
|
+
echo "PASS: veritas-governance kit gate demo (positive passes, negative blocks)"
|
|
113
|
+
exit 0
|
|
114
|
+
else
|
|
115
|
+
echo "FAIL: $errors check(s) failed"
|
|
116
|
+
exit 1
|
|
117
|
+
fi
|
|
@@ -13,7 +13,11 @@ errors=0
|
|
|
13
13
|
pass() { echo " ✓ $1"; }
|
|
14
14
|
fail() { echo " ✗ $1"; errors=$((errors + 1)); }
|
|
15
15
|
|
|
16
|
-
mkdir -p "$ARTIFACT_ROOT"/{active-wip,terminal-done,stale-verified,learning-followup,delivered-learning-followup,invalid-learning-route,invalid-sidecar,symlink-state,large-learning,missing-state-next-action,missing-learning-records,non-array-learning-records,changes,archive,.hidden}
|
|
16
|
+
mkdir -p "$ARTIFACT_ROOT"/{active-wip,terminal-done,stale-verified,learning-followup,delivered-learning-followup,invalid-learning-route,invalid-sidecar,symlink-state,large-learning,missing-state-next-action,missing-learning-records,non-array-learning-records,changes,archive,liveness,.hidden}
|
|
17
|
+
|
|
18
|
+
cat > "$ARTIFACT_ROOT/liveness/events.jsonl" <<'JSONL'
|
|
19
|
+
{"type":"claim","subjectId":"active-wip","actor":"agent-1","at":"2026-06-01T00:00:00Z"}
|
|
20
|
+
JSONL
|
|
17
21
|
|
|
18
22
|
cat > "$ARTIFACT_ROOT/active-wip/state.json" <<'JSON'
|
|
19
23
|
{
|
|
@@ -37,6 +41,14 @@ cat > "$ARTIFACT_ROOT/terminal-done/state.json" <<'JSON'
|
|
|
37
41
|
}
|
|
38
42
|
JSON
|
|
39
43
|
|
|
44
|
+
# Promote-then-archive gate (issue #312): a delivered/accepted session stays terminal_done
|
|
45
|
+
# ONLY when its trust.bundle carries a promotion claim (claim.metadata.promotion). Without
|
|
46
|
+
# this, terminal-done would (correctly) reclassify as a cleanup_candidate. See the dedicated
|
|
47
|
+
# WITHOUT-claim coverage in test_promote_gate.sh.
|
|
48
|
+
cat > "$ARTIFACT_ROOT/terminal-done/trust.bundle" <<'JSON'
|
|
49
|
+
{ "schemaVersion": 5, "claims": [ { "id": "smoke-promotion.flow-agents-workflow.promoted", "claimType": "workflow.check.policy", "status": "verified", "metadata": { "promotion": { "schema_version": "1.0", "none": false, "targets": ["docs/decisions/promotion-gate.md"], "promoted_at": "2026-06-01T00:00:00Z" } } } ], "evidence": [], "policies": [], "events": [] }
|
|
50
|
+
JSON
|
|
51
|
+
|
|
40
52
|
cat > "$ARTIFACT_ROOT/stale-verified/state.json" <<'JSON'
|
|
41
53
|
{
|
|
42
54
|
"schema_version": "1.0",
|
|
@@ -241,6 +253,7 @@ json_query() {
|
|
|
241
253
|
|
|
242
254
|
[[ "$(json_query "$TMPDIR_EVAL/audit.json" "buckets.active_wip.0.slug")" == "active-wip" ]] && pass "json classifies active fixture" || fail "json classifies active fixture"
|
|
243
255
|
[[ "$(json_query "$TMPDIR_EVAL/audit.json" "buckets.terminal_done.0.slug")" == "terminal-done" ]] && pass "json classifies terminal fixture" || fail "json classifies terminal fixture"
|
|
256
|
+
grep -q "Cleanup candidates: 1" "$TMPDIR_EVAL/audit.txt" && pass "promoted terminal fixture is not a cleanup candidate" || fail "promoted terminal fixture is not a cleanup candidate"
|
|
244
257
|
[[ "$(json_query "$TMPDIR_EVAL/audit.json" "buckets.cleanup_candidate.0.slug")" == "stale-verified" ]] && pass "json classifies stale verified cleanup fixture" || fail "json classifies stale verified cleanup fixture"
|
|
245
258
|
[[ "$(json_query "$TMPDIR_EVAL/audit.json" "buckets.active_learning_followup.0.slug")" == "delivered-learning-followup" ]] && pass "json keeps delivered done open learning active" || fail "json keeps delivered done open learning active"
|
|
246
259
|
[[ "$(json_query "$TMPDIR_EVAL/audit.json" "buckets.active_learning_followup.1.slug")" == "learning-followup" ]] && pass "json keeps open learning routing active" || fail "json keeps open learning routing active"
|
|
@@ -258,6 +271,18 @@ json_query() {
|
|
|
258
271
|
[[ "$(json_query "$TMPDIR_EVAL/audit.json" "buckets.invalid.6.reasons.0")" == "state.json must not be a symlink" ]] && pass "json reports symlink rejection without reading target" || fail "json reports symlink rejection without reading target"
|
|
259
272
|
[[ "$(json_query "$TMPDIR_EVAL/audit.json" "buckets.cleanup_candidate.0.classification")" == "cleanup_candidate" ]] && pass "json includes stable classification field" || fail "json includes stable classification field"
|
|
260
273
|
|
|
274
|
+
node -e '
|
|
275
|
+
const fs = require("fs");
|
|
276
|
+
const data = JSON.parse(fs.readFileSync(process.argv[1], "utf8"));
|
|
277
|
+
const found = Object.values(data.buckets).some((arr) => Array.isArray(arr) && arr.some((entry) => entry.slug === "liveness"));
|
|
278
|
+
process.exit(found ? 1 : 0);
|
|
279
|
+
' "$TMPDIR_EVAL/audit.json"
|
|
280
|
+
if [[ $? -eq 0 ]]; then
|
|
281
|
+
pass "liveness directory never appears in any bucket"
|
|
282
|
+
else
|
|
283
|
+
fail "liveness directory never appears in any bucket"
|
|
284
|
+
fi
|
|
285
|
+
|
|
261
286
|
if flow_agents_node "$SCRIPT" --artifact-root "$TMPDIR_EVAL/missing-root" > "$TMPDIR_EVAL/missing-root.out" 2> "$TMPDIR_EVAL/missing-root.err"; then
|
|
262
287
|
fail "missing artifact root exits nonzero"
|
|
263
288
|
else
|
|
@@ -422,6 +422,39 @@ else
|
|
|
422
422
|
_fail "valid artifact chain failed: $(cat "$TMPDIR_EVAL/valid.out" "$TMPDIR_EVAL/valid.err")"
|
|
423
423
|
fi
|
|
424
424
|
|
|
425
|
+
if rg -q 'WARN .*state\.json: state\.json has no branch field' "$TMPDIR_EVAL/valid.err"; then
|
|
426
|
+
_pass "legacy state.json without branch warns (not fails) on stderr, exit 0"
|
|
427
|
+
else
|
|
428
|
+
_fail "legacy state.json without branch did not warn on stderr: $(cat "$TMPDIR_EVAL/valid.err")"
|
|
429
|
+
fi
|
|
430
|
+
|
|
431
|
+
BRANCH_PRESENT="$TMPDIR_EVAL/branch-present"
|
|
432
|
+
mkdir -p "$BRANCH_PRESENT"
|
|
433
|
+
cat > "$BRANCH_PRESENT/state.json" <<'JSON'
|
|
434
|
+
{
|
|
435
|
+
"schema_version": "1.0",
|
|
436
|
+
"task_slug": "branch-present",
|
|
437
|
+
"status": "planned",
|
|
438
|
+
"phase": "planning",
|
|
439
|
+
"branch": "agent/test-actor/branch-present",
|
|
440
|
+
"updated_at": "2026-05-06T00:00:00Z",
|
|
441
|
+
"next_action": {
|
|
442
|
+
"status": "continue",
|
|
443
|
+
"summary": "Continue."
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
JSON
|
|
447
|
+
|
|
448
|
+
if flow_agents_node "$VALIDATOR" "$BRANCH_PRESENT" >"$TMPDIR_EVAL/branch-present.out" 2>"$TMPDIR_EVAL/branch-present.err"; then
|
|
449
|
+
if rg -q 'WARN' "$TMPDIR_EVAL/branch-present.err"; then
|
|
450
|
+
_fail "state.json with a branch field should not warn: $(cat "$TMPDIR_EVAL/branch-present.err")"
|
|
451
|
+
else
|
|
452
|
+
_pass "state.json with a branch field passes with no warning"
|
|
453
|
+
fi
|
|
454
|
+
else
|
|
455
|
+
_fail "state.json with a branch field should pass: $(cat "$TMPDIR_EVAL/branch-present.out" "$TMPDIR_EVAL/branch-present.err")"
|
|
456
|
+
fi
|
|
457
|
+
|
|
425
458
|
BAD="$TMPDIR_EVAL/bad"
|
|
426
459
|
mkdir -p "$BAD"
|
|
427
460
|
|