@kontourai/flow-agents 2.4.0 → 3.1.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 +8 -0
- package/.github/workflows/ci.yml +20 -0
- package/.github/workflows/trust-reconcile.yml +62 -4
- package/CHANGELOG.md +38 -0
- package/CONTEXT.md +88 -1
- package/README.md +4 -0
- package/build/src/cli/assignment-provider.d.ts +144 -0
- package/build/src/cli/assignment-provider.js +805 -0
- 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/validate-workflow-artifacts.js +5 -1
- package/build/src/cli/workflow-sidecar.d.ts +2 -2
- package/build/src/cli/workflow-sidecar.js +549 -145
- package/build/src/cli.js +6 -0
- package/build/src/lib/flow-resolver.d.ts +12 -6
- package/build/src/lib/flow-resolver.js +30 -14
- package/build/src/tools/validate-source-tree.js +2 -0
- package/context/contracts/artifact-contract.md +2 -0
- package/context/contracts/assignment-provider-contract.md +248 -0
- package/context/contracts/builder-kit-workflow-state-contract.md +2 -0
- package/context/contracts/decision-registry-contract.md +2 -0
- package/context/contracts/delivery-contract.md +2 -0
- 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 +2 -0
- package/context/contracts/probe-docs-write-contract.md +187 -0
- package/context/contracts/review-contract.md +2 -0
- package/context/contracts/sandbox-policy.md +2 -0
- package/context/contracts/standing-directives.md +13 -0
- package/context/contracts/verification-contract.md +2 -0
- package/context/contracts/work-item-contract.md +2 -0
- package/context/scripts/hooks/config-protection.js +14 -1
- package/context/scripts/hooks/lib/config-protection-remedies.js +9 -0
- package/context/scripts/hooks/stop-goal-fit.js +4 -2
- package/context/scripts/hooks/workflow-steering.js +42 -0
- package/context/settings/assignment-provider-settings.json +33 -0
- package/docs/adr/0001-flow-agents-consumes-flow.md +2 -0
- package/docs/adr/0002-flow-kits-as-extension-unit.md +2 -0
- package/docs/adr/0003-flow-agents-coordinates-kits-and-adapters.md +2 -0
- package/docs/adr/0004-gates-expect-surface-claims.md +2 -0
- package/docs/adr/0005-kubernetes-inspired-resource-contracts.md +2 -0
- package/docs/adr/0006-typescript-first-source-policy.md +2 -0
- package/docs/adr/0007-flow-skill-kit-tool-boundary.md +2 -0
- package/docs/adr/0007-skill-audit.md +2 -0
- package/docs/adr/0008-kit-operation-boundary.md +2 -0
- package/docs/adr/0009-canonical-hook-core-kit-boundary.md +2 -0
- package/docs/adr/0010-workflow-trust-state-as-hachure-bundle.md +2 -0
- package/docs/adr/0011-mcp-posture.md +2 -0
- package/docs/adr/0012-agent-coordination-as-liveness-claims.md +2 -0
- package/docs/adr/0013-context-lifecycle.md +2 -0
- package/docs/adr/0014-core-vs-domain-kit-boundary.md +2 -0
- package/docs/adr/0015-flow-flow-agents-boundary-reconciliation.md +2 -0
- package/docs/adr/0016-three-hard-boundary-model.md +2 -0
- package/docs/adr/0017-anti-gaming-trust-security-model.md +2 -0
- package/docs/adr/0018-freeze-local-shell-heuristics.md +2 -0
- package/docs/adr/0019-kit-dependency-ownership.md +2 -0
- package/docs/adr/0020-trust-reconcile-manifest-and-claim-classification.md +2 -0
- package/docs/adr/0021-assignment-leases-and-stale-claim-takeover.md +3 -1
- package/docs/adr/0022-fail-closed-delivery-reconciliation-with-governed-exemptions.md +182 -0
- package/docs/adr/README.md +49 -0
- package/docs/adr/index.md +34 -0
- package/docs/context-map.md +1 -0
- package/docs/decisions/agent-coordination.md +20 -0
- package/docs/decisions/anti-gaming-trust-security.md +20 -0
- package/docs/decisions/context-lifecycle.md +18 -0
- package/docs/decisions/core-domain-kit-boundary.md +18 -0
- package/docs/decisions/flow-flow-agents-boundary.md +18 -0
- package/docs/decisions/flow-kit.md +20 -0
- package/docs/decisions/flow-skill-kit-tool-boundary.md +20 -0
- package/docs/decisions/graph-knowledge-provider.md +63 -0
- package/docs/decisions/hook-core-kit-boundary.md +18 -0
- package/docs/decisions/index.md +22 -0
- package/docs/decisions/kit-dependency-ownership.md +18 -0
- package/docs/decisions/kit-operation-boundary.md +18 -0
- package/docs/decisions/knowledge-promote-sub-flow.md +59 -0
- package/docs/decisions/knowledge-store-provider.md +51 -0
- package/docs/decisions/kontour-resource-contract.md +18 -0
- package/docs/decisions/mcp-posture.md +18 -0
- package/docs/decisions/model-routing.md +63 -0
- package/docs/decisions/standing-directives.md +66 -0
- package/docs/decisions/three-hard-boundary-model.md +18 -0
- package/docs/decisions/trust-reconcile.md +20 -0
- package/docs/decisions/typescript-source-policy.md +48 -0
- package/docs/decisions/workflow-enforcement.md +18 -0
- package/docs/decisions/workflow-trust-state.md +20 -0
- package/docs/fixture-ownership.md +1 -0
- package/docs/workflow-shared-contracts.md +2 -1
- package/docs/workflow-usage-guide.md +7 -1
- package/evals/ci/run-baseline.sh +10 -0
- 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/hostile-effective-state.json +11 -0
- package/evals/fixtures/assignment-provider/liveness-fresh.json +9 -0
- package/evals/fixtures/assignment-provider/liveness-stale.json +9 -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_critique_supersession_roundtrip.sh +182 -0
- package/evals/integration/test_current_json_per_actor.sh +516 -0
- package/evals/integration/test_ensure_session_ownership_guard.sh +435 -0
- package/evals/integration/test_fixture_retirement_audit.sh +2 -2
- package/evals/integration/test_gate_lockdown.sh +10 -0
- package/evals/integration/test_publish_delivery.sh +21 -4
- package/evals/integration/test_pull_work_assignment_join.sh +132 -0
- package/evals/integration/test_pull_work_liveness_preflight.sh +20 -7
- package/evals/integration/test_reconcile_soundness.sh +33 -9
- package/evals/integration/test_trust_reconcile.sh +9 -8
- package/evals/integration/test_trust_reconcile_negatives.sh +608 -0
- package/evals/integration/test_workflow_sidecar_writer.sh +91 -3
- package/evals/run.sh +14 -0
- package/evals/static/test_flowdef_codeowners_coverage.sh +6 -0
- package/evals/static/test_knowledge_providers.sh +32 -0
- package/evals/static/test_workflow_skills.sh +15 -2
- package/kits/builder/skills/deliver/SKILL.md +36 -0
- package/kits/builder/skills/design-probe/SKILL.md +37 -0
- package/kits/builder/skills/pickup-probe/SKILL.md +4 -4
- package/kits/builder/skills/pull-work/SKILL.md +78 -10
- package/kits/knowledge/adapters/default-store/index.js +92 -4
- package/kits/knowledge/adapters/obsidian-store/index.js +69 -4
- package/kits/knowledge/adapters/shared/codec.js +141 -0
- package/kits/knowledge/docs/README.md +121 -2
- package/kits/knowledge/docs/store-contract.md +112 -4
- package/kits/knowledge/evals/contract-suite/suite.test.js +176 -0
- package/kits/knowledge/flows/promote.flow.json +84 -0
- package/kits/knowledge/kit.json +50 -0
- package/kits/knowledge/promote/distill.js +96 -0
- package/kits/knowledge/promote/fixtures/contradiction-registry/CONTEXT.md +7 -0
- package/kits/knowledge/promote/fixtures/contradiction-registry/docs/decisions/cache-eviction-policy.md +12 -0
- package/kits/knowledge/promote/fixtures/contradiction-registry/docs/decisions/cache-eviction.md +12 -0
- package/kits/knowledge/promote/fixtures/repo/CONTEXT.md +11 -0
- package/kits/knowledge/promote/fixtures/repo/docs/decisions/index.md +9 -0
- package/kits/knowledge/promote/fixtures/repo/docs/decisions/liveness-claim.md +12 -0
- package/kits/knowledge/promote/fixtures/session/acceptance.json +9 -0
- package/kits/knowledge/promote/fixtures/session/agents/tool-planner/events.jsonl +1 -0
- package/kits/knowledge/promote/fixtures/session/agents/tool-verifier/events.jsonl +1 -0
- package/kits/knowledge/promote/fixtures/session/agents/tool-worker-1-1/events.jsonl +1 -0
- package/kits/knowledge/promote/fixtures/session/kontourai-flow-agents-287--deliver.md +47 -0
- package/kits/knowledge/promote/fixtures/session/learning.json +35 -0
- package/kits/knowledge/promote/fixtures/session/state.json +19 -0
- package/kits/knowledge/promote/health.js +137 -0
- package/kits/knowledge/promote/index.js +176 -0
- package/kits/knowledge/promote/ingest.js +103 -0
- package/kits/knowledge/promote/lib.js +132 -0
- package/kits/knowledge/promote/link.js +84 -0
- package/kits/knowledge/promote/promote.test.js +174 -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 +143 -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 +25 -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/neo4j/connection.js +121 -0
- package/kits/knowledge/providers/neo4j/cypher.js +190 -0
- package/kits/knowledge/providers/neo4j/fake-driver.js +123 -0
- package/kits/knowledge/providers/neo4j/fixtures/spike-ground-truth.json +29 -0
- package/kits/knowledge/providers/neo4j/graph-queries.js +210 -0
- package/kits/knowledge/providers/neo4j/index.js +280 -0
- package/kits/knowledge/providers/neo4j/integration.test.js +122 -0
- package/kits/knowledge/providers/neo4j/neo4j.test.js +219 -0
- package/kits/knowledge/providers/neo4j/sync.js +235 -0
- package/kits/knowledge/providers/work-item/index.js +204 -0
- package/package.json +7 -3
- package/schemas/assignment-provider-settings.schema.json +125 -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/scripts/README.md +1 -0
- package/scripts/ci/trust-reconcile.js +521 -24
- package/scripts/freeze-adrs.mjs +364 -0
- package/scripts/hooks/config-protection.js +14 -1
- package/scripts/hooks/evidence-capture.js +4 -1
- package/scripts/hooks/lib/config-protection-remedies.js +9 -0
- package/scripts/hooks/lib/current-pointer.js +123 -0
- package/scripts/hooks/lib/liveness-heartbeat.js +75 -35
- package/scripts/hooks/stop-goal-fit.js +4 -2
- package/scripts/hooks/workflow-steering.js +42 -0
- package/scripts/statusline/flow-agents-statusline.js +3 -1
- package/src/cli/assignment-provider.ts +927 -0
- package/src/cli/effective-assignment-provider-settings.ts +112 -0
- package/src/cli/validate-workflow-artifacts.ts +5 -1
- package/src/cli/workflow-sidecar.ts +577 -139
- package/src/cli.ts +6 -0
- package/src/lib/flow-resolver.ts +35 -14
- package/src/tools/validate-source-tree.ts +2 -0
package/.github/CODEOWNERS
CHANGED
|
@@ -13,6 +13,14 @@
|
|
|
13
13
|
/evals/ci/ @briananderson1222
|
|
14
14
|
/scripts/ci/ @briananderson1222
|
|
15
15
|
|
|
16
|
+
# delivery/DECLARED (ADR 0022 §2) is the no-agent-delivery exemption marker
|
|
17
|
+
# trust-reconcile.js reads to skip Step 2 when no bundle is delivered — a
|
|
18
|
+
# self-asserted governance artifact naming approved_by, so it gets the same
|
|
19
|
+
# owner-review protection as the other verify-config/anchor paths above. This
|
|
20
|
+
# closes #301's file-level half; branch-protection enforcement of CODEOWNERS
|
|
21
|
+
# review itself remains #225 (server-side, not code).
|
|
22
|
+
/delivery/DECLARED @briananderson1222
|
|
23
|
+
|
|
16
24
|
# The verification config the CI anchor depends on — an agent must not redefine
|
|
17
25
|
# trust-reconcile-verify to a fake/laundered command or rewire the lane runner
|
|
18
26
|
# without owner review (convergence red-team finding).
|
package/.github/workflows/ci.yml
CHANGED
|
@@ -149,6 +149,26 @@ jobs:
|
|
|
149
149
|
continue-on-error: true
|
|
150
150
|
run: bash evals/ci/run-baseline.sh --check actor-identity-resolver-integration
|
|
151
151
|
|
|
152
|
+
- name: Assignment provider local-file integration
|
|
153
|
+
continue-on-error: true
|
|
154
|
+
run: bash evals/ci/run-baseline.sh --check assignment-provider-local-file-integration
|
|
155
|
+
|
|
156
|
+
- name: Assignment provider github integration
|
|
157
|
+
continue-on-error: true
|
|
158
|
+
run: bash evals/ci/run-baseline.sh --check assignment-provider-github-integration
|
|
159
|
+
|
|
160
|
+
- name: Pull work assignment join integration
|
|
161
|
+
continue-on-error: true
|
|
162
|
+
run: bash evals/ci/run-baseline.sh --check pull-work-assignment-join-integration
|
|
163
|
+
|
|
164
|
+
- name: Ensure-session ownership guard integration
|
|
165
|
+
continue-on-error: true
|
|
166
|
+
run: bash evals/ci/run-baseline.sh --check ensure-session-ownership-guard-integration
|
|
167
|
+
|
|
168
|
+
- name: Current.json per-actor integration
|
|
169
|
+
continue-on-error: true
|
|
170
|
+
run: bash evals/ci/run-baseline.sh --check current-json-per-actor-integration
|
|
171
|
+
|
|
152
172
|
- name: Finalize CI evidence
|
|
153
173
|
if: always()
|
|
154
174
|
run: bash evals/ci/run-baseline.sh --finalize
|
|
@@ -27,12 +27,41 @@
|
|
|
27
27
|
# The agent cannot self-declare success here: it cannot modify the CI environment,
|
|
28
28
|
# pre-disable this job, or post-forge results after the check runs.
|
|
29
29
|
#
|
|
30
|
-
# THIS JOB IS
|
|
31
|
-
#
|
|
32
|
-
#
|
|
30
|
+
# THIS JOB IS ALREADY A REQUIRED, ADMIN-ENFORCED STATUS CHECK on main (verified via
|
|
31
|
+
# `gh api repos/kontourai/flow-agents/branches/main/protection`: "Trust Reconcile" is in
|
|
32
|
+
# required_status_checks.contexts, enforce_admins.enabled: true). No PR — including from
|
|
33
|
+
# admins — can merge past a failing run. Disabling/relaxing this requires a server-side
|
|
34
|
+
# branch-protection change (GitHub UI/API), not a code change in this repo.
|
|
33
35
|
#
|
|
34
36
|
# Additive — NOT a gate-hook change. Does not modify scripts/hooks/*, kits/knowledge,
|
|
35
37
|
# or continue-work. Mirrors the structure of .github/workflows/ci.yml.
|
|
38
|
+
#
|
|
39
|
+
# CI-context contract for the bundle-ownership staleness check (ADR 0022 addendum, part
|
|
40
|
+
# 2; scripts/ci/trust-reconcile.js bundleAttestsThisChange()): an auto-discovered bundle
|
|
41
|
+
# is treated as owned only if its checkpoint's commit_sha is a git-ancestor of (or equal
|
|
42
|
+
# to) this change's own commit sha, checked via `git merge-base --is-ancestor`. That
|
|
43
|
+
# check requires TWO things this workflow provides deliberately, not by accident:
|
|
44
|
+
# 1. Checkout step below uses `fetch-depth: 0` (full history) — the default
|
|
45
|
+
# fetch-depth: 1 (shallow clone) lacks the parent commit objects merge-base needs;
|
|
46
|
+
# an ancestor check against a shallow clone exits 128 (unresolvable), which
|
|
47
|
+
# correctly fails CLOSED (treated as stale) per trust-reconcile.js's own
|
|
48
|
+
# fail-closed-on-ambiguity contract, but would falsely stale EVERY legitimate
|
|
49
|
+
# fresh bundle on this required check without full history.
|
|
50
|
+
# 2. Trust reconcile step below sets TRUST_RECONCILE_SHA to the PR's own HEAD commit
|
|
51
|
+
# (github.event.pull_request.head.sha), not github.sha — on a pull_request trigger,
|
|
52
|
+
# github.sha is GitHub's synthetic merge commit (refs/pull/N/merge), which is NOT
|
|
53
|
+
# the commit a locally-run seal-checkpoint ever stamps as commit_sha (checkpoints
|
|
54
|
+
# are always sealed against a real branch commit). Falling back to github.sha only
|
|
55
|
+
# applies on push/workflow_dispatch, where it IS the real commit. The checkout ref
|
|
56
|
+
# itself is unchanged — Step 1 (fresh verify) still runs against the same tree it
|
|
57
|
+
# always has; only the identity used for the OWNERSHIP COMPARISON changes.
|
|
58
|
+
# 3. Trust reconcile step below also sets TRUST_RECONCILE_EVENT to github.event_name so
|
|
59
|
+
# trust-reconcile.js can event-scope bundle-required enforcement (ADR 0022 addendum,
|
|
60
|
+
# part 4): a push run on `main` (post-merge, after a squash-merge whose commit has no
|
|
61
|
+
# git ancestry back to the feature-branch commit a checkpoint was sealed against) is
|
|
62
|
+
# a loud no-op on Step 2 instead of a false failure — gating already happened on the
|
|
63
|
+
# PR run. This does NOT weaken PR-time gating: on pull_request, enforcement is
|
|
64
|
+
# unchanged.
|
|
36
65
|
|
|
37
66
|
name: Trust Reconcile
|
|
38
67
|
|
|
@@ -63,6 +92,13 @@ jobs:
|
|
|
63
92
|
steps:
|
|
64
93
|
- name: Checkout
|
|
65
94
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
95
|
+
with:
|
|
96
|
+
# Full history (not the default shallow fetch-depth: 1): the bundle-ownership
|
|
97
|
+
# staleness check (ADR 0022 addendum, part 2) resolves `git merge-base
|
|
98
|
+
# --is-ancestor` against the checked-out repo, which needs parent commit
|
|
99
|
+
# objects a shallow clone does not have. See the CI-context contract note
|
|
100
|
+
# above this job.
|
|
101
|
+
fetch-depth: 0
|
|
66
102
|
|
|
67
103
|
- name: Set up Node.js
|
|
68
104
|
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
@@ -80,6 +116,23 @@ jobs:
|
|
|
80
116
|
- name: Trust reconcile
|
|
81
117
|
id: trust-reconcile
|
|
82
118
|
run: node scripts/ci/trust-reconcile.js
|
|
119
|
+
env:
|
|
120
|
+
# The change identity the bundle-ownership staleness check compares the
|
|
121
|
+
# discovered checkpoint's commit_sha against (ADR 0022 addendum, part 2). On a
|
|
122
|
+
# pull_request trigger, github.sha is GitHub's synthetic merge commit, not a
|
|
123
|
+
# commit any real seal-checkpoint run ever stamps — so this MUST be the PR's
|
|
124
|
+
# own head sha. On push/workflow_dispatch there is no pull_request context, and
|
|
125
|
+
# github.sha already is the real commit, so the fallback is exact, not a guess.
|
|
126
|
+
# This does NOT change what gets checked out/verified (Step 1 fresh verify is
|
|
127
|
+
# untouched) — only the sha used for the Step-2-ownership comparison.
|
|
128
|
+
TRUST_RECONCILE_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
129
|
+
# Event-scoped enforcement (ADR 0022 addendum, part 4): lets trust-reconcile.js
|
|
130
|
+
# tell a gating pull_request run apart from a post-merge push run on `main` — a
|
|
131
|
+
# push run's bundle is expected to be absent/stale (squash-merge commits have no
|
|
132
|
+
# ancestry back to the feature-branch sha a checkpoint was sealed against) and
|
|
133
|
+
# must be a no-op, not a failure. Unset/unrecognized values fail toward the
|
|
134
|
+
# STRICTER (pull_request-shaped) enforcement — see resolveEnforcementEvent().
|
|
135
|
+
TRUST_RECONCILE_EVENT: ${{ github.event_name }}
|
|
83
136
|
# Canonical verify: auto-discovered from package.json scripts["trust-reconcile-verify"]
|
|
84
137
|
# = npm run build && npm run eval:static
|
|
85
138
|
# (integration + the anti-gaming regression suite run in ci.yml's required
|
|
@@ -88,7 +141,12 @@ jobs:
|
|
|
88
141
|
# compile-only check. Override via TRUST_RECONCILE_COMMANDS or --commands if needed.
|
|
89
142
|
# Bundle auto-discovery: if delivery/trust.bundle or delivery/trust.checkpoint.json
|
|
90
143
|
# exists in the checkout, CI reconciles per-command claimed passes against fresh
|
|
91
|
-
# results automatically. When absent,
|
|
144
|
+
# results automatically. When absent, a bundle is REQUIRED by default (ADR 0022 §1):
|
|
145
|
+
# the job fails closed unless a well-formed, in-scope delivery/DECLARED
|
|
146
|
+
# no-agent-delivery marker is present, which exempts Step 2 (reconcile) only —
|
|
147
|
+
# Step 1 (fresh verify) still always runs. An auto-discovered bundle/checkpoint
|
|
148
|
+
# that does not attest THIS change (see the CI-context contract note above this
|
|
149
|
+
# job) is treated the same as absent (ADR 0022 addendum, part 2).
|
|
92
150
|
# Phase 2: on success, writes ci-trust-reconcile-results.json to RUNNER_TEMP
|
|
93
151
|
# for mint-attestation.js to consume.
|
|
94
152
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.1.0](https://github.com/kontourai/flow-agents/compare/v3.0.0...v3.1.0) (2026-07-04)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **docs:** probe docs-write contract — vocabulary + decision deltas ([#311](https://github.com/kontourai/flow-agents/issues/311)) ([#371](https://github.com/kontourai/flow-agents/issues/371)) ([867c3b5](https://github.com/kontourai/flow-agents/commit/867c3b5b645c896e5df6886177171b05e73e8fa9))
|
|
9
|
+
* **knowledge:** neo4j knowledge-store provider — Cypher-backed [#317](https://github.com/kontourai/flow-agents/issues/317) interface (opt-in default) ([#373](https://github.com/kontourai/flow-agents/issues/373)) ([2ef2523](https://github.com/kontourai/flow-agents/commit/2ef2523cc65a5e56dec8dcbf84edc3718cfe190c))
|
|
10
|
+
* **knowledge:** promote sub-flow — ingest→distill→link→health (flow within a flow) ([#313](https://github.com/kontourai/flow-agents/issues/313)) ([#372](https://github.com/kontourai/flow-agents/issues/372)) ([b345d89](https://github.com/kontourai/flow-agents/commit/b345d89873c99f65f00d0fe8ede6a8702b1a2b43))
|
|
11
|
+
* **knowledge:** stable record identity — short-id prefix + slug aliases ([#339](https://github.com/kontourai/flow-agents/issues/339)) ([ff54bc7](https://github.com/kontourai/flow-agents/commit/ff54bc74f893321f13276cd147d500f91e1fc133))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Documentation
|
|
15
|
+
|
|
16
|
+
* **adr:** ADR freeze cutover + liveness coordination experiment ([#332](https://github.com/kontourai/flow-agents/issues/332)) ([#368](https://github.com/kontourai/flow-agents/issues/368)) ([2c845b8](https://github.com/kontourai/flow-agents/commit/2c845b81675db02622fee8fa1efa6aa197ce96c0))
|
|
17
|
+
|
|
18
|
+
## [3.0.0](https://github.com/kontourai/flow-agents/compare/v2.4.0...v3.0.0) (2026-07-04)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### ⚠ BREAKING CHANGES
|
|
22
|
+
|
|
23
|
+
* **trust:** require origin/check_kind stamps — remove pre-supersession read fallback ([#355](https://github.com/kontourai/flow-agents/issues/355))
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **routing:** model-routing policy as datum roles — orchestrator resolves at delegation ([#365](https://github.com/kontourai/flow-agents/issues/365)) ([7acf663](https://github.com/kontourai/flow-agents/commit/7acf6635125623505097eb0f7d2b0da7026c1b00))
|
|
28
|
+
* **trust-anchor:** fail-closed delivery reconciliation with governed exemptions (ADR 0022 §1) ([#358](https://github.com/kontourai/flow-agents/issues/358)) ([0631050](https://github.com/kontourai/flow-agents/commit/0631050c7d88f3dd38d7c90ee1af5adf63410334))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Fixes
|
|
32
|
+
|
|
33
|
+
* **trust:** critique supersession + lossless check/critique round-trip (closes [#267](https://github.com/kontourai/flow-agents/issues/267), [#268](https://github.com/kontourai/flow-agents/issues/268), [#282](https://github.com/kontourai/flow-agents/issues/282)) ([#344](https://github.com/kontourai/flow-agents/issues/344)) ([c2c3fd5](https://github.com/kontourai/flow-agents/commit/c2c3fd5d322d2537847d67a6fefc6daae6893070))
|
|
34
|
+
* **trust:** require origin/check_kind stamps — remove pre-supersession read fallback ([#355](https://github.com/kontourai/flow-agents/issues/355)) ([ab27f71](https://github.com/kontourai/flow-agents/commit/ab27f71ac1ee652b7125ce01336895d34162472b))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Documentation
|
|
38
|
+
|
|
39
|
+
* **contracts:** standing owner directives — durable home for ratified policy ([#351](https://github.com/kontourai/flow-agents/issues/351)) ([e335d54](https://github.com/kontourai/flow-agents/commit/e335d540378ba7eaae5bb7162427d8db16f58e4b))
|
|
40
|
+
|
|
3
41
|
## [2.4.0](https://github.com/kontourai/flow-agents/compare/v2.3.0...v2.4.0) (2026-07-03)
|
|
4
42
|
|
|
5
43
|
|
package/CONTEXT.md
CHANGED
|
@@ -56,6 +56,26 @@ A configured implementation of a capability, such as GitHub for backlog, Obsidia
|
|
|
56
56
|
|
|
57
57
|
The declared capabilities, defaults, conventions, and limits of a provider type. Provider contracts make integrations predictable and testable without requiring the live provider.
|
|
58
58
|
|
|
59
|
+
### Knowledge Graph
|
|
60
|
+
|
|
61
|
+
The Knowledge Kit's storage-independent model: typed nodes (recommended core: note, decision, issue, session, person — extensible) and typed edges (supersedes, merged-into, blocks, evidence-of, mentions, relates — a closed vocabulary), each carrying provenance so every assertion is traceable to the store it came from. Storage and synchronisation are provider concerns; the same ingest, link, and health verbs run over every provider.
|
|
62
|
+
_Avoid_: Graph database as the generic term (the model is provider-independent; a graph-database provider is a separate spike)
|
|
63
|
+
|
|
64
|
+
### Knowledge Store Provider
|
|
65
|
+
|
|
66
|
+
A configured implementation of the knowledge-store capability behind the Knowledge Graph model. Providers expose a read interface (nodes, edges, query-by-type) and a proposals-only write interface (proposeWrite returns a proposal, never mutating a human-curated store). The reference providers are markdown-vault (the Obsidian-shaped vault), git-repo (decision registry, CONTEXT.md vocabulary, learnings), and work-item (GitHub issues as a source/sink adapter). See context/contracts/knowledge-store-contract.md.
|
|
67
|
+
_Avoid_: Knowledge adapter when contrasting the provider interface with a single store adapter
|
|
68
|
+
|
|
69
|
+
### Graph Knowledge Provider
|
|
70
|
+
|
|
71
|
+
The owner's opt-in Neo4j-backed Knowledge Store Provider (the `neo4j` provider). A queryable materialized view of the Knowledge Graph, synced from the file/work-item providers with idempotent MERGE semantics — the file stores stay the source of truth and the write side stays proposals-only. Selected via `KNOWLEDGE_PROVIDER=neo4j`; degrades to the file providers when no Neo4j is reachable. The file providers remain the portfolio default; the graph is a personal default only. See docs/decisions/graph-knowledge-provider.md.
|
|
72
|
+
_Avoid_: Graph database as the default store (it is opt-in and a view, not the source of truth)
|
|
73
|
+
|
|
74
|
+
### Knowledge Promote Sub-Flow
|
|
75
|
+
|
|
76
|
+
The Knowledge Kit's codebase-facing pipeline (the "flow within a flow") that a delivered session's promotion runs through: ingest the session artifacts, distill schema-valid draft decision/vocabulary/learning deltas, link their provenance (PR, merge SHA, session archive, touched topics), and health-check the registry for contradictions with a merge-repair proposal. It is proposals-only — every output is a draft under the session's proposals directory that the promote step applies; the sub-flow never writes docs directly. Invokable standalone and composable from the Builder promote step. See docs/decisions/knowledge-promote-sub-flow.md.
|
|
77
|
+
_Avoid_: Promotion gate as a synonym (the gate is the recorded promote claim; this is the assisted pipeline)
|
|
78
|
+
|
|
59
79
|
### Kontour Resource Contract
|
|
60
80
|
|
|
61
81
|
A versioned Kontour record shape for durable machine-readable configuration, scope, run state, evidence, provider output, and cross-product interchange. Kontour Resource Contracts are the default for new pre-public durable contracts unless a product records why a native shape is clearer.
|
|
@@ -215,7 +235,7 @@ A reason code for a Gate that cannot be evaluated or cannot pass because a requi
|
|
|
215
235
|
|
|
216
236
|
### Probe
|
|
217
237
|
|
|
218
|
-
A Builder Kit Alignment Gate that explores context, challenges assumptions, and records aligned decisions before the process continues. A Probe asks one question at a time, recommends an answer, and uses repository context before asking when the answer can be discovered.
|
|
238
|
+
A Builder Kit Alignment Gate that explores context, challenges assumptions, and records aligned decisions before the process continues. A Probe asks one question at a time, recommends an answer, and uses repository context before asking when the answer can be discovered. As understanding crystallizes, a Probe writes it into durable docs in the same motion: a vocabulary delta into this glossary and a decision delta into the Decision Registry, per [context/contracts/probe-docs-write-contract.md](context/contracts/probe-docs-write-contract.md).
|
|
219
239
|
_Avoid_: Grill, interrogation
|
|
220
240
|
|
|
221
241
|
### Flow
|
|
@@ -265,6 +285,11 @@ _Avoid_: Numbered ADR as the format for new decisions
|
|
|
265
285
|
|
|
266
286
|
The system of Decision Records plus the generated index at [docs/decisions/index.md](docs/decisions/index.md) (slug + one-line summary). The contract is [context/contracts/decision-registry-contract.md](context/contracts/decision-registry-contract.md); the frontmatter schema is `schemas/decision-record.schema.json`; `npm run check:decisions` validates it. Consult the index at write time to decide revise-vs-create.
|
|
267
287
|
|
|
288
|
+
### Standing Directives
|
|
289
|
+
|
|
290
|
+
A short, numbered, quotable list of ratified owner directives, each with a one-line rationale and date, kept at [context/contracts/standing-directives.md](context/contracts/standing-directives.md) and pointed to from the header of every other contract file in `context/contracts/`. Standing Directives override default engineering conservatism (such as keeping a compatibility path "just in case") wherever they apply; they exist so a ratified correction has a durable home instead of living only in the ephemeral context of the orchestrator session that ratified it.
|
|
291
|
+
_Avoid_: Operating discipline as the generic term for owner-ratified policy, restating a directive from memory instead of citing the file
|
|
292
|
+
|
|
268
293
|
### Promotion Gate
|
|
269
294
|
|
|
270
295
|
The gated sequence — final acceptance -> promote -> archive — that makes durable-residue extraction the archival act: a delivered session's decisions, vocabulary, learnings, and doc updates must be promoted into durable living docs before the session is archived. The `promote` step records what was promoted where and writes a session-local **promotion claim** into the session `trust.bundle` (evidence refs = the durable doc paths written, or an explicit `--none` no-residue reason). `workflow-artifact-cleanup-audit` classifies a delivered/accepted session with no promotion claim as a cleanup candidate (archive blocked), not terminal. See [docs/decisions/promotion-gate.md](docs/decisions/promotion-gate.md) and [docs/workflow-artifact-lifecycle.md](docs/workflow-artifact-lifecycle.md).
|
|
@@ -312,3 +337,65 @@ The Console overview for global setup, registered projects, cross-project usage,
|
|
|
312
337
|
### Control API
|
|
313
338
|
|
|
314
339
|
The shared tool layer used by the Console, CLI, AI agents, and automation. The Control API owns operations such as reading effective settings, explaining provider resolution, testing provider health, previewing config changes, writing config, inspecting workflow state, and reporting usage or eval outcomes.
|
|
340
|
+
|
|
341
|
+
### Workflow trust state
|
|
342
|
+
|
|
343
|
+
The trust bundle a workflow gate reads to decide whether to advance — claims, evidence, verification events, and derived status expressed as a Hachure Trust Bundle — so gates consume inspectable trust state rather than raw tool output. Provenance lives in frozen ADRs; the subject is open in the Decision Registry as [docs/decisions/workflow-trust-state.md](docs/decisions/workflow-trust-state.md).
|
|
344
|
+
|
|
345
|
+
### TypeScript-first source policy
|
|
346
|
+
|
|
347
|
+
The policy that Kontour product and runtime source defaults to TypeScript, with narrow JavaScript/MJS exceptions (config/tooling, generated assets, thin launchers, fixtures, historical artifacts) and staged per-repo migration for existing non-TypeScript source. Ratified in the Decision Registry as [docs/decisions/typescript-source-policy.md](docs/decisions/typescript-source-policy.md).
|
|
348
|
+
|
|
349
|
+
### Flow / Skill / Kit / Tool boundary
|
|
350
|
+
|
|
351
|
+
The layering that separates a Flow (workflow semantics) from a Skill (agent-facing procedure), a Flow Kit (installable bundle), and a Tool (an executable operation), so each concern has one home and does not leak into the others. Subject open in the Decision Registry as [docs/decisions/flow-skill-kit-tool-boundary.md](docs/decisions/flow-skill-kit-tool-boundary.md).
|
|
352
|
+
|
|
353
|
+
### Kit operation boundary
|
|
354
|
+
|
|
355
|
+
The rule for what a kit-owned operation may do versus what belongs to the core, keeping kit operations scoped to their capability and free of core enforcement responsibilities. Subject open in the Decision Registry as [docs/decisions/kit-operation-boundary.md](docs/decisions/kit-operation-boundary.md).
|
|
356
|
+
|
|
357
|
+
### Hook core/kit boundary
|
|
358
|
+
|
|
359
|
+
The division between canonical hook behavior owned by the core and hook contributions owned by kits, so enforcement hooks have a single authoritative implementation. Subject open in the Decision Registry as [docs/decisions/hook-core-kit-boundary.md](docs/decisions/hook-core-kit-boundary.md).
|
|
360
|
+
|
|
361
|
+
### MCP posture
|
|
362
|
+
|
|
363
|
+
Flow Agents' stance on the Model Context Protocol: enforcement stays in hooks, Surface owns any MCP projection, and no MCP configuration is auto-injected into a runtime. Subject open in the Decision Registry as [docs/decisions/mcp-posture.md](docs/decisions/mcp-posture.md).
|
|
364
|
+
|
|
365
|
+
### Agent coordination
|
|
366
|
+
|
|
367
|
+
How concurrent agents avoid stepping on each other's work, modeled as Hachure liveness claims plus assignment leases with stale-claim takeover, so a work item's holder is advisory-visible and reclaimable when stale. Subject open in the Decision Registry as [docs/decisions/agent-coordination.md](docs/decisions/agent-coordination.md).
|
|
368
|
+
|
|
369
|
+
### Context lifecycle
|
|
370
|
+
|
|
371
|
+
The lifecycle of an agent's working context — workflow-boundary compaction, freshness-gated reuse, and the split between durable learnings and ephemeral context — so context is refreshed rather than silently stale. Subject open in the Decision Registry as [docs/decisions/context-lifecycle.md](docs/decisions/context-lifecycle.md).
|
|
372
|
+
|
|
373
|
+
### Core vs domain kit boundary
|
|
374
|
+
|
|
375
|
+
The generic/kit boundary that keeps the Flow Agents core domain-agnostic while domain behavior lives in kits, so the core carries no kit-specific knowledge. Subject open in the Decision Registry as [docs/decisions/core-domain-kit-boundary.md](docs/decisions/core-domain-kit-boundary.md).
|
|
376
|
+
|
|
377
|
+
### Flow / Flow Agents boundary
|
|
378
|
+
|
|
379
|
+
The reconciled division of responsibility between Flow (the workflow engine consumed for enforcement) and Flow Agents (the product that consumes it), so each owns a distinct layer without duplicating the other. Subject open in the Decision Registry as [docs/decisions/flow-flow-agents-boundary.md](docs/decisions/flow-flow-agents-boundary.md).
|
|
380
|
+
|
|
381
|
+
### Three-hard-boundary model
|
|
382
|
+
|
|
383
|
+
The FlowDefinition-driven, kit-agnostic model that names the three hard boundaries the core enforces, unifying the individual boundary decisions into one architecture. Subject open in the Decision Registry as [docs/decisions/three-hard-boundary-model.md](docs/decisions/three-hard-boundary-model.md).
|
|
384
|
+
|
|
385
|
+
### Anti-gaming trust security
|
|
386
|
+
|
|
387
|
+
The layered-defense trust security model that assumes the local agent can be gamed and anchors enforcement in an external CI check, freezing the local shell-parsing heuristics and routing new enforcement to the CI anchor. Subject open in the Decision Registry as [docs/decisions/anti-gaming-trust-security.md](docs/decisions/anti-gaming-trust-security.md).
|
|
388
|
+
|
|
389
|
+
### Kit dependency ownership
|
|
390
|
+
|
|
391
|
+
The rule for which layer owns a kit's runtime dependencies, keeping dependency declaration and installation with the kit that needs them rather than the core. Subject open in the Decision Registry as [docs/decisions/kit-dependency-ownership.md](docs/decisions/kit-dependency-ownership.md).
|
|
392
|
+
|
|
393
|
+
### Trust-reconcile and delivery reconciliation
|
|
394
|
+
|
|
395
|
+
The CI-anchored reconciliation of a session's trust claims against a manifest — classifying command, session-local, and attested claims, honoring governed waivers — and the fail-closed delivery reconciliation that blocks publication on unreconciled residue unless an exemption is recorded. Subject open in the Decision Registry as [docs/decisions/trust-reconcile.md](docs/decisions/trust-reconcile.md).
|
|
396
|
+
|
|
397
|
+
### Model Routing
|
|
398
|
+
|
|
399
|
+
The policy that maps a delegate role name (such as `delegate-mechanical`, `delegate-implementation`, `delegate-design`, `orchestrator`, `extraction-default`) to a specific `model@provider` ref. Model Routing is data, not code: it lives in `.datum/config.json` (read by the `@kontourai/datum` registry, schema `datum.schema.json`) and never in generated files or per-agent frontmatter. The orchestrator resolves the role at delegation time (`datum resolve <role> --json`) and passes the resolved model explicitly when spawning each delegate. See [context/contracts/execution-contract.md](context/contracts/execution-contract.md) § Delegation: Model Routing and [docs/decisions/model-routing.md](docs/decisions/model-routing.md).
|
|
400
|
+
_Avoid_: Generated per-agent model frontmatter, environment-variable-only model selection
|
|
401
|
+
|
package/README.md
CHANGED
|
@@ -217,6 +217,10 @@ See [Repository Structure](docs/repository-structure.md) for the canonical map.
|
|
|
217
217
|
- `kits/`, `schemas/`, `packaging/`, `evals/`, `docs/`, and `integrations/` hold Flow Kit assets, contracts, package metadata, evals, durable docs, and optional integrations.
|
|
218
218
|
- `dist/`, `build/`, and `_site/` are generated output. Local `.kontourai/`, `.flow-agents/`, `.codex/`, `.claude/`, telemetry, promptfoo, Veritas, and cache directories stay ignored; durable outcomes belong in docs, source, schemas, or provider records.
|
|
219
219
|
|
|
220
|
+
## Graph provider (opt-in)
|
|
221
|
+
|
|
222
|
+
The Knowledge Kit ships an optional `neo4j` graph provider — the owner's opt-in personal default, while the file providers remain the portfolio default. It is a queryable **materialized view** synced from the file/work-item stores (which stay the source of truth), with Cypher-backed health/query verbs when selected and graceful degradation to the file providers when no Neo4j is reachable (never a hard dependency). Opt in with `KNOWLEDGE_PROVIDER=neo4j` and see [Graph provider (opt-in)](kits/knowledge/docs/README.md#graph-provider-opt-in) for the `docker run` one-liner, env vars, sync command, and an example Cypher session.
|
|
223
|
+
|
|
220
224
|
## Documentation
|
|
221
225
|
|
|
222
226
|
The [GitHub Pages site](https://kontourai.github.io/flow-agents/) is the product overview and quickstart. The repository docs are the developer reference for contracts, workflow behavior, evals, and integration boundaries. For the gate semantics underneath — definitions, runs, evidence, route-back — read the [Kontour Flow documentation](https://kontourai.github.io/flow/).
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
export type ActorStruct = {
|
|
2
|
+
runtime: string;
|
|
3
|
+
session_id: string;
|
|
4
|
+
host: string;
|
|
5
|
+
human?: string | null;
|
|
6
|
+
};
|
|
7
|
+
type AssignmentClaimRecordStatus = "claimed" | "released" | "superseded";
|
|
8
|
+
type AssignmentAuditEntry = {
|
|
9
|
+
at: string;
|
|
10
|
+
transition: "claim" | "release" | "supersede";
|
|
11
|
+
from_actor?: ActorStruct | null;
|
|
12
|
+
to_actor?: ActorStruct | null;
|
|
13
|
+
reason?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The versioned claim-record shape from the contract doc's "Versioned claim-record format"
|
|
17
|
+
* section (Design Decision 2). `schema_version` is bumped only on an incompatible change, per
|
|
18
|
+
* artifact-contract.md's existing sidecar rule.
|
|
19
|
+
*
|
|
20
|
+
* `actor_key` (F1 fix, fix-plan iteration 1, HIGH — additive field, schema_version unchanged):
|
|
21
|
+
* the canonical `resolveActor(env).actor` string for the claiming actor — the SAME flat/bare
|
|
22
|
+
* token every other tool (`liveness whoami`, `liveness claim --actor`, per-actor current.json,
|
|
23
|
+
* pull-work's `--self-actor`) already uses. Optional so every pre-fix record and every #290 eval
|
|
24
|
+
* fixture with no `actor_key` still parses; `computeEffectiveState` falls back to
|
|
25
|
+
* `serializeActor(record.actor)` (today's behavior) whenever it's absent. Present, it is the ONLY
|
|
26
|
+
* correct self-recognition/liveness-join key — see computeEffectiveState's holderActorKey.
|
|
27
|
+
*/
|
|
28
|
+
export type AssignmentClaimRecord = {
|
|
29
|
+
schema_version: "1.0";
|
|
30
|
+
role: "AssignmentClaimRecord";
|
|
31
|
+
subject_id: string;
|
|
32
|
+
actor: ActorStruct;
|
|
33
|
+
actor_key?: string;
|
|
34
|
+
claimed_at: string;
|
|
35
|
+
ttl_seconds: number;
|
|
36
|
+
branch: string;
|
|
37
|
+
artifact_dir: string;
|
|
38
|
+
status: AssignmentClaimRecordStatus;
|
|
39
|
+
audit_trail?: AssignmentAuditEntry[];
|
|
40
|
+
};
|
|
41
|
+
export type FreshHolder = {
|
|
42
|
+
actor: string;
|
|
43
|
+
lastAt: string;
|
|
44
|
+
ttlSeconds: number;
|
|
45
|
+
fresh: boolean;
|
|
46
|
+
};
|
|
47
|
+
export type EffectiveState = "held" | "reclaimable" | "human-held" | "free";
|
|
48
|
+
/** Provider-neutral assignment-layer read, before any liveness join (contract doc's status()). */
|
|
49
|
+
export type AssignmentStatus = {
|
|
50
|
+
subject_id: string;
|
|
51
|
+
provider: "local-file" | "github";
|
|
52
|
+
assignee: string | null;
|
|
53
|
+
record: AssignmentClaimRecord | null;
|
|
54
|
+
has_claim_label?: boolean;
|
|
55
|
+
};
|
|
56
|
+
export declare function assignmentFilePath(artifactRoot: string, subjectId: string): string;
|
|
57
|
+
export declare function readLocalRecord(artifactRoot: string, subjectId: string): AssignmentClaimRecord | null;
|
|
58
|
+
export declare function writeLocalRecord(artifactRoot: string, subjectId: string, record: AssignmentClaimRecord): void;
|
|
59
|
+
/**
|
|
60
|
+
* F1 fix (fix-plan iteration 1, CRITICAL): claimLocalFile/releaseLocalFile/supersedeLocalFile were
|
|
61
|
+
* a plain read -> compare-actor -> write with no lock, so two concurrently-launched OS processes
|
|
62
|
+
* could both read "no conflicting claim" before either wrote, and the second write would silently
|
|
63
|
+
* clobber the first with zero error and zero audit-trail entry for the loser (reproduced 29/40
|
|
64
|
+
* races against the built CLI). This mirrors the EXACT mechanism `withLock` already uses in
|
|
65
|
+
* workflow-sidecar.ts:908 for the same class of shared-state mutation — atomic `fs.mkdirSync`
|
|
66
|
+
* lockdir create as the mutual-exclusion primitive, EEXIST-spin with a staleness-reclaim check
|
|
67
|
+
* (a lock directory older than the stale threshold is presumed abandoned by a crashed process and
|
|
68
|
+
* is reclaimed rather than waited on forever) and a bounded deadline, `finally` rmSync release —
|
|
69
|
+
* as a small LOCAL helper (not a cross-import of that private function, which would pull the
|
|
70
|
+
* entire workflow-sidecar module in for one primitive). Deliberately synchronous (sleepSync's
|
|
71
|
+
* Atomics.wait spin, not setTimeout/await) so claim/release/supersede can stay sync `number`
|
|
72
|
+
* -returning functions and the CLI dispatcher (src/cli.ts, `number | Promise<number>`) does not
|
|
73
|
+
* need any ripple to async. On lock-acquire failure (any error other than a live contested lock,
|
|
74
|
+
* or a timeout waiting one out) this THROWS — never a silent no-op — "fail loud, never fail-open"
|
|
75
|
+
* (artifact-contract.md). Wrap the ENTIRE read-modify-write body (the existing-claim check AND
|
|
76
|
+
* the write) of all three local-file mutators in this, since all three mutate the same record
|
|
77
|
+
* file for a given subject.
|
|
78
|
+
*/
|
|
79
|
+
export declare function withSubjectLock<T>(artifactRoot: string, subjectId: string, body: () => T): T;
|
|
80
|
+
/**
|
|
81
|
+
* The assignment ⋈ liveness join (contract doc's "assignment ⋈ liveness join" section, ADR 0021
|
|
82
|
+
* §1). Pure function: `{ assignment, freshHoldersList, selfActor, nowMs }` -> one of five
|
|
83
|
+
* effective states (held/reclaimable/human-held/free — "held" covers both the plain and
|
|
84
|
+
* assignment-lagging rows, matching the contract table's own repeated "held" label).
|
|
85
|
+
*
|
|
86
|
+
* The human-assignee gate (AC11, Design Decision 3) reads `record.actor.human` being *present*,
|
|
87
|
+
* never a username heuristic — an idle human assignment is always `human-held`, regardless of
|
|
88
|
+
* idle duration, and is never auto-reclaimable by this function.
|
|
89
|
+
*
|
|
90
|
+
* `nowMs` (F3 fix, fix-plan iteration 1) is the SAME resolved "now" the caller already threads
|
|
91
|
+
* into `freshHolders()` (the `--now` override, when passed, else `Date.now()`) — passing it
|
|
92
|
+
* through here too means `--now` deterministically governs idle_days as well as liveness
|
|
93
|
+
* freshness, rather than idle_days silently reading the real wall clock regardless of `--now`.
|
|
94
|
+
*/
|
|
95
|
+
export declare function computeEffectiveState(assignment: AssignmentStatus, freshHoldersList: FreshHolder[], selfActor: string | undefined, nowMs: number): {
|
|
96
|
+
effective_state: EffectiveState;
|
|
97
|
+
reason: string;
|
|
98
|
+
holder?: {
|
|
99
|
+
actor?: string;
|
|
100
|
+
assignee?: string | null;
|
|
101
|
+
idle_days?: number | null;
|
|
102
|
+
last_at?: string;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Wave 1 (#291) extraction: the durable-write body previously inlined inside claimLocalFile's
|
|
107
|
+
* withSubjectLock() closure, now a parameter-driven pure function so ensure-session's ownership
|
|
108
|
+
* guard (workflow-sidecar.ts, Wave 2) can reuse the EXACT same claim logic — same-actor idempotent
|
|
109
|
+
* refresh, different-actor throw, atomic write under withSubjectLock — rather than reimplementing
|
|
110
|
+
* a second, parallel claim path. claimLocalFile (CLI wrapper, below) is now a thin
|
|
111
|
+
* parse-args/print-envelope shell around this.
|
|
112
|
+
*/
|
|
113
|
+
export declare function performLocalClaim(artifactRoot: string, subjectId: string, actor: ActorStruct, opts: {
|
|
114
|
+
ttlSeconds: number;
|
|
115
|
+
branch: string;
|
|
116
|
+
artifactDir: string;
|
|
117
|
+
reason?: string;
|
|
118
|
+
actorKey?: string;
|
|
119
|
+
}): AssignmentClaimRecord;
|
|
120
|
+
/**
|
|
121
|
+
* Wave 1 (#291) extraction: the durable-write body previously inlined inside supersedeLocalFile's
|
|
122
|
+
* withSubjectLock() closure, now a parameter-driven pure function so ensure-session's
|
|
123
|
+
* `--supersede-stale` takeover path (workflow-sidecar.ts, Wave 2) can reuse the EXACT same
|
|
124
|
+
* supersede logic — from-actor holder verification, ttl/branch/artifact_dir carry-forward,
|
|
125
|
+
* audit-trail append, atomic write under withSubjectLock — rather than reimplementing a second,
|
|
126
|
+
* parallel supersede path. supersedeLocalFile (CLI wrapper, below) is now a thin
|
|
127
|
+
* parse-args/print-envelope shell around this.
|
|
128
|
+
*/
|
|
129
|
+
export declare function performLocalSupersede(artifactRoot: string, subjectId: string, fromActor: ActorStruct, toActor: ActorStruct, opts?: {
|
|
130
|
+
ttlSeconds?: number;
|
|
131
|
+
branch?: string;
|
|
132
|
+
artifactDir?: string;
|
|
133
|
+
reason?: string;
|
|
134
|
+
actorKey?: string;
|
|
135
|
+
}): AssignmentClaimRecord;
|
|
136
|
+
/**
|
|
137
|
+
* Wave 1 (#291) extraction: the local-file branch of statusCommand's assignment-layer read,
|
|
138
|
+
* mirrored exactly so ensure-session's ownership guard (workflow-sidecar.ts, Wave 2) derives an
|
|
139
|
+
* AssignmentStatus identically to the `assignment-provider status` CLI command — a single
|
|
140
|
+
* implementation, not a second parallel local-file read.
|
|
141
|
+
*/
|
|
142
|
+
export declare function readLocalAssignmentStatus(artifactRoot: string, subjectId: string): AssignmentStatus;
|
|
143
|
+
export declare function main(argv?: string[]): number;
|
|
144
|
+
export {};
|