@kontourai/flow-agents 3.3.0 → 3.4.1
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/add-to-project.yml +15 -0
- package/.github/workflows/ci.yml +161 -0
- package/CHANGELOG.md +48 -0
- package/CONTEXT.md +5 -1
- package/README.md +19 -8
- package/build/src/builder-flow-run-adapter.d.ts +80 -0
- package/build/src/builder-flow-run-adapter.js +241 -0
- package/build/src/builder-flow-runtime.d.ts +16 -0
- package/build/src/builder-flow-runtime.js +290 -0
- package/build/src/cli/builder-run.d.ts +1 -0
- package/build/src/cli/builder-run.js +27 -0
- package/build/src/cli/effective-backlog-settings.js +70 -2
- package/build/src/cli/init.d.ts +34 -0
- package/build/src/cli/init.js +341 -61
- package/build/src/cli/kit.js +55 -12
- package/build/src/cli/pull-work-provider.js +346 -5
- package/build/src/cli/skill-drift-check.d.ts +1 -0
- package/build/src/cli/skill-drift-check.js +165 -0
- package/build/src/cli/telemetry-doctor.d.ts +37 -0
- package/build/src/cli/telemetry-doctor.js +53 -6
- package/build/src/cli/validate-hook-influence.js +37 -7
- package/build/src/cli/workflow-sidecar.d.ts +93 -8
- package/build/src/cli/workflow-sidecar.js +1175 -158
- package/build/src/cli.js +5 -0
- package/build/src/flow-kit/validate.d.ts +54 -34
- package/build/src/flow-kit/validate.js +237 -26
- package/build/src/index.d.ts +2 -0
- package/build/src/index.js +1 -0
- package/build/src/lib/console-connect-options.d.ts +97 -0
- package/build/src/lib/console-connect-options.js +199 -0
- package/build/src/lib/console-telemetry-validate.d.ts +49 -0
- package/build/src/lib/console-telemetry-validate.js +91 -0
- package/build/src/lib/flow-resolver.d.ts +56 -3
- package/build/src/lib/flow-resolver.js +151 -11
- package/build/src/lib/fs.d.ts +17 -0
- package/build/src/lib/fs.js +172 -0
- package/build/src/lib/local-artifact-root.d.ts +44 -1
- package/build/src/lib/local-artifact-root.js +131 -3
- package/build/src/runtime-adapters.d.ts +39 -3
- package/build/src/runtime-adapters.js +77 -31
- package/build/src/tools/build-universal-bundles.js +40 -2
- package/build/src/tools/codex-agent-routing.d.ts +2 -0
- package/build/src/tools/codex-agent-routing.js +49 -0
- package/build/src/tools/generate-context-map.js +1 -0
- package/build/src/tools/validate-source-tree.js +27 -1
- package/context/scripts/hooks/lib/kit-catalog.js +235 -0
- package/context/scripts/hooks/lib/runnable-command.js +177 -0
- package/context/scripts/hooks/stop-goal-fit.js +278 -48
- package/context/scripts/hooks/workflow-steering.js +121 -21
- package/context/scripts/package.json +3 -0
- package/context/scripts/telemetry/install-console-config.sh +25 -4
- package/context/scripts/telemetry/lib/config.sh +102 -12
- package/context/scripts/telemetry/lib/pricing.sh +50 -0
- package/context/scripts/telemetry/lib/session.sh +3 -0
- package/context/scripts/telemetry/lib/transport.sh +87 -0
- package/context/scripts/telemetry/lib/usage.sh +205 -4
- package/context/scripts/telemetry/telemetry.conf +6 -0
- package/context/scripts/telemetry/telemetry.sh +48 -0
- package/context/settings/workspace-backlog-provider-settings.example.json +48 -0
- package/docs/agent-usage-feedback-loop.md +35 -0
- package/docs/architecture-engine-and-kits.md +110 -0
- package/docs/context-map.md +2 -0
- package/docs/decisions/embeddable-engine.md +152 -0
- package/docs/decisions/index.md +3 -1
- package/docs/decisions/trust-ledger-retention.md +88 -0
- package/docs/decisions/workflow-enforcement.md +31 -9
- package/docs/fixture-ownership.md +3 -0
- package/docs/implementing-trust-reconciliation.md +129 -0
- package/docs/index.md +19 -9
- package/docs/integrations/flow-agents-console.md +167 -0
- package/docs/kit-authoring-guide.md +52 -21
- package/docs/spec/builder-flow-runtime.md +80 -0
- package/docs/spec/runtime-hook-surface.md +45 -1
- package/docs/specs/economics-record-contract.md +270 -0
- package/docs/specs/harness-capability-matrix.md +74 -0
- package/docs/specs/learning-review-proposals-contract.md +340 -0
- package/docs/specs/routing-efficiency-review.md +59 -0
- package/docs/verifiable-trust.md +74 -25
- package/docs/workflow-usage-guide.md +10 -0
- package/evals/acceptance/prove-capture-teeth.sh +132 -0
- package/evals/ci/antigaming-suite.sh +1 -0
- package/evals/ci/run-baseline.sh +72 -4
- package/evals/fixtures/economics/acceptance.json +12 -0
- package/evals/fixtures/economics/agents/tool-worker-1/events.jsonl +2 -0
- package/evals/fixtures/economics/agents/tool-worker-2/events.jsonl +2 -0
- package/evals/fixtures/economics/agents/tool-worker-3/events.jsonl +2 -0
- package/evals/fixtures/economics/agents/tool-worker-4/events.jsonl +1 -0
- package/evals/fixtures/economics/agents/tool-worker-5/events.jsonl +2 -0
- package/evals/fixtures/economics/critique.json +22 -0
- package/evals/fixtures/economics/expected-record.json +71 -0
- package/evals/fixtures/economics/session-usage-event.json +1 -0
- package/evals/fixtures/economics/state.json +11 -0
- package/evals/fixtures/economics/transcript.jsonl +3 -0
- package/evals/fixtures/hook-influence/cases.json +7 -7
- package/evals/fixtures/learning-review-proposals/balanced/economics.jsonl +6 -0
- package/evals/fixtures/learning-review-proposals/effect-follow-up/economics.jsonl +5 -0
- package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-1/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-2/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-3/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-4/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-5/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/economics.jsonl +6 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/expected-aggregates.json +30 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/expected-aggregates.md +66 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-1/gate-review.inquiries.json +26 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-1/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-2/gate-review.inquiries.json +26 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-2/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-3/gate-review.inquiries.json +26 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-3/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-4/gate-review.inquiries.json +26 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-4/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-5/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-6/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/repeat-window/economics.jsonl +6 -0
- package/evals/fixtures/learning-review-proposals/under-threshold/economics.jsonl +3 -0
- package/evals/fixtures/telemetry/usage-transcript-sample.jsonl +4 -0
- package/evals/fixtures/trust-reconcile-exploits/mcp-degrade.json +42 -0
- package/evals/integration/test_builder_entry_enforcement.sh +241 -0
- package/evals/integration/test_builder_step_producers.sh +18 -10
- package/evals/integration/test_bundle_install.sh +172 -0
- package/evals/integration/test_console_tenant_isolation.sh +167 -0
- package/evals/integration/test_critique_supersession_roundtrip.sh +4 -1
- package/evals/integration/test_dual_emit_flow_step.sh +10 -4
- package/evals/integration/test_economics_record.sh +674 -0
- package/evals/integration/test_effective_backlog_settings.sh +1 -1
- package/evals/integration/test_evidence_capture_hook.sh +17 -2
- package/evals/integration/test_exemption_usage_review.sh +198 -0
- package/evals/integration/test_fixture_retirement_audit.sh +2 -2
- package/evals/integration/test_flow_kit_install_git.sh +83 -0
- package/evals/integration/test_flowdef_session_activation.sh +0 -1
- package/evals/integration/test_flowdef_session_history_preservation.sh +13 -3
- package/evals/integration/test_gate_lockdown.sh +7 -0
- package/evals/integration/test_gate_review_inquiry_records.sh +9 -1
- package/evals/integration/test_goal_fit_hook.sh +2031 -0
- package/evals/integration/test_hook_category_behaviors.sh +8 -1
- package/evals/integration/test_hook_influence_cases.sh +25 -1
- package/evals/integration/test_install_merge.sh +227 -2
- package/evals/integration/test_kit_conformance_levels.sh +6 -6
- package/evals/integration/test_learning_review_proposals.sh +329 -0
- package/evals/integration/test_liveness_conflict_injection.sh +26 -22
- package/evals/integration/test_liveness_console_relay.sh +166 -0
- package/evals/integration/test_liveness_heartbeat.sh +17 -17
- package/evals/integration/test_liveness_worktree_root.sh +575 -0
- package/evals/integration/test_phase_map_and_gate_claim.sh +6 -1
- package/evals/integration/test_publish_delivery.sh +331 -1
- package/evals/integration/test_pull_work_board.sh +200 -0
- package/evals/integration/test_pull_work_provider.sh +1 -1
- package/evals/integration/test_record_check.sh +378 -0
- package/evals/integration/test_routing_efficiency.sh +71 -0
- package/evals/integration/test_runtime_adapter_activation.sh +28 -0
- package/evals/integration/test_session_resume_roundtrip.sh +16 -19
- package/evals/integration/test_skill_drift_check.sh +870 -0
- package/evals/integration/test_telemetry.sh +445 -0
- package/evals/integration/test_telemetry_doctor.sh +66 -0
- package/evals/integration/test_telemetry_usage_pipeline.sh +228 -0
- package/evals/integration/test_trust_reconcile_negatives.sh +30 -13
- package/evals/integration/test_trust_reconcile_trailer_diagnostic.sh +247 -0
- package/evals/integration/test_usage_cost.sh +61 -0
- package/evals/integration/test_workflow_sidecar_writer.sh +1395 -0
- package/evals/integration/test_workflow_steering_hook.sh +157 -16
- package/evals/integration/test_workspace_settings.sh +176 -0
- package/evals/lib/env.sh +26 -0
- package/evals/lib/node.sh +8 -0
- package/evals/run.sh +29 -0
- package/evals/static/test_ci_integration_coverage.sh +115 -0
- package/evals/static/test_declared_scope_forms_documented.sh +114 -0
- package/evals/static/test_universal_bundles.sh +34 -0
- package/evals/static/test_validate_source_kit_asset_scope.sh +259 -0
- package/evals/static/test_workflow_skills.sh +1 -1
- package/kits/builder/flows/build.flow.json +9 -18
- package/kits/builder/flows/publish-learn.flow.json +5 -1
- package/kits/builder/kit.json +120 -0
- package/kits/builder/skills/deliver/SKILL.md +42 -0
- package/kits/builder/skills/evidence-gate/SKILL.md +12 -0
- package/kits/builder/skills/execute-plan/SKILL.md +9 -0
- package/kits/builder/skills/learning-review/SKILL.md +51 -0
- package/kits/builder/skills/plan-work/SKILL.md +17 -20
- package/kits/builder/skills/pull-work/SKILL.md +21 -0
- package/kits/builder/skills/release-readiness/SKILL.md +12 -0
- package/kits/knowledge/kit.json +9 -0
- package/kits/veritas-governance/docs/README.md +35 -7
- package/kits/veritas-governance/fixtures/exemption-review/mixed-fresh-stale.DECLARED.json +14 -0
- package/kits/veritas-governance/kit.json +14 -0
- package/kits/veritas-governance/skills/exemption-usage-review/SKILL.md +128 -0
- package/kits/veritas-governance/skills/exemption-usage-review/review-exemptions.mjs +231 -0
- package/package.json +2 -2
- package/packaging/manifest.json +29 -0
- package/schemas/backlog-provider-settings.schema.json +13 -0
- package/schemas/workflow-state.schema.json +44 -0
- package/scripts/README.md +4 -0
- package/scripts/check-content-boundary.cjs +8 -1
- package/scripts/ci/trust-reconcile.js +136 -0
- package/scripts/hooks/codex-hook-adapter.js +77 -2
- package/scripts/hooks/evidence-capture.js +38 -5
- package/scripts/hooks/lib/codex-exit-code.js +316 -0
- package/scripts/hooks/lib/kit-catalog.js +235 -0
- package/scripts/hooks/lib/liveness-write.js +28 -1
- package/scripts/hooks/lib/local-artifact-paths.js +97 -1
- package/scripts/hooks/lib/runnable-command.js +177 -0
- package/scripts/hooks/lib/skill-drift.js +350 -0
- package/scripts/hooks/stop-goal-fit.js +278 -48
- package/scripts/hooks/workflow-steering.js +121 -21
- package/scripts/install-codex-home.sh +97 -47
- package/scripts/install-merge.js +72 -14
- package/scripts/install-owned-files.js +178 -0
- package/scripts/liveness/relay.sh +84 -0
- package/scripts/telemetry/economics-record.schema.json +145 -0
- package/scripts/telemetry/economics-record.sh +331 -0
- package/scripts/telemetry/install-console-config.sh +25 -4
- package/scripts/telemetry/learning-review-decide.sh +124 -0
- package/scripts/telemetry/learning-review-proposals.schema.json +161 -0
- package/scripts/telemetry/learning-review-proposals.sh +484 -0
- package/scripts/telemetry/lib/config.sh +102 -12
- package/scripts/telemetry/lib/pricing.sh +14 -6
- package/scripts/telemetry/lib/session.sh +3 -0
- package/scripts/telemetry/lib/transport.sh +133 -15
- package/scripts/telemetry/lib/usage.sh +121 -28
- package/scripts/telemetry/routing-efficiency.sh +0 -0
- package/scripts/telemetry/telemetry.conf +6 -0
- package/scripts/telemetry/telemetry.sh +48 -0
- package/src/builder-flow-run-adapter.ts +357 -0
- package/src/builder-flow-runtime.ts +348 -0
- package/src/cli/builder-flow-run-adapter.test.mjs +495 -0
- package/src/cli/builder-flow-runtime.test.mjs +213 -0
- package/src/cli/builder-run.ts +28 -0
- package/src/cli/codex-agent-routing.test.mjs +44 -0
- package/src/cli/codex-exit-code.test.mjs +207 -0
- package/src/cli/console-connect-options.test.mjs +329 -0
- package/src/cli/console-telemetry-validate.test.mjs +157 -0
- package/src/cli/effective-backlog-settings.ts +68 -2
- package/src/cli/flow-resolver-composition.test.mjs +101 -0
- package/src/cli/init.test.mjs +161 -0
- package/src/cli/init.ts +407 -62
- package/src/cli/kit-metadata-security.test.mjs +443 -0
- package/src/cli/kit.ts +50 -12
- package/src/cli/pull-work-provider.ts +377 -3
- package/src/cli/sidecar-pure-helpers.test.mjs +64 -0
- package/src/cli/skill-drift-check.ts +196 -0
- package/src/cli/telemetry-doctor.test.mjs +53 -0
- package/src/cli/telemetry-doctor.ts +50 -7
- package/src/cli/validate-hook-influence.ts +37 -6
- package/src/cli/workflow-sidecar.ts +1150 -151
- package/src/cli.ts +5 -0
- package/src/flow-kit/validate.ts +277 -38
- package/src/index.ts +19 -0
- package/src/lib/console-connect-options.ts +261 -0
- package/src/lib/console-telemetry-validate.ts +88 -0
- package/src/lib/flow-resolver.ts +153 -10
- package/src/lib/fs.ts +160 -0
- package/src/lib/local-artifact-root.ts +129 -3
- package/src/runtime-adapters.ts +113 -33
- package/src/tools/build-universal-bundles.ts +36 -2
- package/src/tools/codex-agent-routing.ts +48 -0
- package/src/tools/generate-context-map.ts +1 -0
- package/src/tools/validate-source-tree.ts +26 -1
|
@@ -73,6 +73,26 @@ else
|
|
|
73
73
|
_fail "multi-model parse returned empty"
|
|
74
74
|
fi
|
|
75
75
|
|
|
76
|
+
# --- 2b. remote/cache fallback: invalid cache or failed remote uses bundled -
|
|
77
|
+
price_cache_dir="$(mktemp -d)"
|
|
78
|
+
printf '%s' '<html>console auth gate</html>' > "$price_cache_dir/flow-agents-pricing-cache.json"
|
|
79
|
+
poisoned_cost=$(TMPDIR="$price_cache_dir" TELEMETRY_PRICING_FILE="" FLOW_AGENTS_PRICING_FILE="" TELEMETRY_PRICING_URL="http://127.0.0.1:1/api/telemetry/pricing" FLOW_AGENTS_PRICING_URL="" usage_parse_transcript "$tp" | jq '.estimated_cost_usd')
|
|
80
|
+
poisoned_ver=$(TMPDIR="$price_cache_dir" TELEMETRY_PRICING_FILE="" FLOW_AGENTS_PRICING_FILE="" TELEMETRY_PRICING_URL="http://127.0.0.1:1/api/telemetry/pricing" FLOW_AGENTS_PRICING_URL="" pricing_registry | jq -r '.current_version')
|
|
81
|
+
if [ "$poisoned_ver" = "2026-06-28" ] && [ "$(approx_eq "$poisoned_cost" 0.31)" = "true" ]; then
|
|
82
|
+
_pass "poisoned HTML pricing cache is ignored; bundled registry prices known models (cost=$poisoned_cost)"
|
|
83
|
+
else
|
|
84
|
+
_fail "poisoned cache fallback expected bundled version/cost 0.31 (version=$poisoned_ver cost=$poisoned_cost)"
|
|
85
|
+
fi
|
|
86
|
+
rm -f "$price_cache_dir/flow-agents-pricing-cache.json" 2>/dev/null
|
|
87
|
+
failed_remote_cost=$(TMPDIR="$price_cache_dir" TELEMETRY_PRICING_FILE="" FLOW_AGENTS_PRICING_FILE="" TELEMETRY_PRICING_URL="http://127.0.0.1:1/api/telemetry/pricing" FLOW_AGENTS_PRICING_URL="" usage_parse_transcript "$tp" | jq '.estimated_cost_usd')
|
|
88
|
+
failed_remote_ver=$(TMPDIR="$price_cache_dir" TELEMETRY_PRICING_FILE="" FLOW_AGENTS_PRICING_FILE="" TELEMETRY_PRICING_URL="http://127.0.0.1:1/api/telemetry/pricing" FLOW_AGENTS_PRICING_URL="" pricing_registry | jq -r '.current_version')
|
|
89
|
+
if [ "$failed_remote_ver" = "2026-06-28" ] && [ "$(approx_eq "$failed_remote_cost" 0.31)" = "true" ]; then
|
|
90
|
+
_pass "failed/401-style remote falls through to bundled registry with non-zero cost (cost=$failed_remote_cost)"
|
|
91
|
+
else
|
|
92
|
+
_fail "failed remote fallback expected bundled version/cost 0.31 (version=$failed_remote_ver cost=$failed_remote_cost)"
|
|
93
|
+
fi
|
|
94
|
+
rm -rf "$price_cache_dir" 2>/dev/null
|
|
95
|
+
|
|
76
96
|
# --- 3. empty / no-usage transcript ----------------------------------------
|
|
77
97
|
empty="$(mktemp)"; echo '{"type":"user","message":{"content":"hi"}}' > "$empty"
|
|
78
98
|
if usage_parse_transcript "$empty" >/dev/null 2>&1; then _fail "empty transcript should return non-zero"; else _pass "empty transcript → non-zero (null fallback)"; fi
|
|
@@ -94,6 +114,24 @@ old_cost=$(TELEMETRY_PRICING_FILE="$v2" usage_parse_transcript "$tp2" "old" | jq
|
|
|
94
114
|
{ [ "$(approx_eq "$new_cost" 25)" = "true" ] && [ "$(approx_eq "$old_cost" 1)" = "true" ]; } \
|
|
95
115
|
&& _pass "version selection (default=25 @new, override=1 @old)" || _fail "version selection (new=$new_cost old=$old_cost)"
|
|
96
116
|
|
|
117
|
+
# --- 5b. corrupt registry (present but unparseable) degrades to tokens-only -
|
|
118
|
+
# Regression for: a non-empty-but-malformed registry (truncated pricing.json,
|
|
119
|
+
# bad remote 200) must NOT crash the jq -n --argjson parse and discard tokens
|
|
120
|
+
# — it should degrade exactly like a missing registry (cost/version -> null).
|
|
121
|
+
corrupt="$(mktemp)"; printf '%s' '{not valid json' > "$corrupt"
|
|
122
|
+
corrupt_res="$(TELEMETRY_PRICING_FILE="$corrupt" usage_parse_transcript "$tp")"
|
|
123
|
+
if [ -n "$corrupt_res" ]; then
|
|
124
|
+
cit=$(echo "$corrupt_res" | jq '.input_tokens'); cot=$(echo "$corrupt_res" | jq '.output_tokens')
|
|
125
|
+
ccost=$(echo "$corrupt_res" | jq -r '.estimated_cost_usd'); cver=$(echo "$corrupt_res" | jq -r '.pricing_version')
|
|
126
|
+
cby=$(echo "$corrupt_res" | jq '.by_model|length')
|
|
127
|
+
{ [ "$cit" = "1000" ] && [ "$cot" = "2100" ] && [ "$ccost" = "null" ] && [ "$cver" = "null" ] && [ "$cby" -gt 0 ]; } \
|
|
128
|
+
&& _pass "corrupt registry: tokens/by_model survive, cost+version degrade to null" \
|
|
129
|
+
|| _fail "corrupt registry (in=$cit out=$cot cost=$ccost ver=$cver by_model_len=$cby)"
|
|
130
|
+
else
|
|
131
|
+
_fail "corrupt registry: usage_parse_transcript returned empty (tokens were discarded)"
|
|
132
|
+
fi
|
|
133
|
+
rm -f "$corrupt" 2>/dev/null
|
|
134
|
+
|
|
97
135
|
# --- 6. cross-runtime golden vectors ---------------------------------------
|
|
98
136
|
n=$(jq '.cases|length' "$GOLDEN")
|
|
99
137
|
for i in $(seq 0 $((n - 1))); do
|
|
@@ -112,6 +150,29 @@ for i in $(seq 0 $((n - 1))); do
|
|
|
112
150
|
rm -f "$gtp"
|
|
113
151
|
done
|
|
114
152
|
|
|
153
|
+
# --- 7. usage_model_from_transcript_usage() — runtime-agnostic model derivation
|
|
154
|
+
echo ""
|
|
155
|
+
echo "Model derivation tests"
|
|
156
|
+
|
|
157
|
+
single="$(mktemp)"; mk_line "claude-opus-4-8" 100 200 0 0 > "$single"
|
|
158
|
+
single_res="$(usage_parse_transcript "$single")"
|
|
159
|
+
single_model="$(usage_model_from_transcript_usage "$single_res")"
|
|
160
|
+
[ "$single_model" = "claude-opus-4-8" ] && _pass "single-model transcript resolves that model" || _fail "single-model transcript (got $single_model)"
|
|
161
|
+
|
|
162
|
+
multi="$(mktemp)"
|
|
163
|
+
{ mk_line "claude-opus-4-8" 1000 2000 0 500000; mk_line "claude-fable-5" 0 100 0 0; } > "$multi"
|
|
164
|
+
multi_res="$(usage_parse_transcript "$multi")"
|
|
165
|
+
multi_model="$(usage_model_from_transcript_usage "$multi_res")"
|
|
166
|
+
[ "$multi_model" = "claude-opus-4-8" ] && _pass "multi-model transcript resolves dominant-by-tokens model (opus over fable)" || _fail "multi-model dominant resolution (got $multi_model)"
|
|
167
|
+
|
|
168
|
+
empty_model="$(usage_model_from_transcript_usage "null")"
|
|
169
|
+
[ -z "$empty_model" ] && _pass "null transcript_usage resolves empty (falls through to usage_get_model)" || _fail "expected empty for null transcript_usage (got $empty_model)"
|
|
170
|
+
|
|
171
|
+
blank_model="$(usage_model_from_transcript_usage "")"
|
|
172
|
+
[ -z "$blank_model" ] && _pass "empty-string transcript_usage resolves empty (falls through to usage_get_model)" || _fail "expected empty for blank transcript_usage (got $blank_model)"
|
|
173
|
+
|
|
174
|
+
rm -f "$single" "$multi" 2>/dev/null
|
|
175
|
+
|
|
115
176
|
rm -f "$ov" "$bad" "$tp" "$empty" "$drift" "$dlog" "$tp2" "$v2" 2>/dev/null
|
|
116
177
|
|
|
117
178
|
echo ""
|