@event4u/agent-config 14.6.0 → 14.8.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/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +255 -145
- package/README.md +1 -1
- package/dist/agent-src/commands/analyze/inbox.md +264 -10
- package/dist/agent-src/commands/analyze.md +1 -1
- package/dist/agent-src/commands/evals/git-pr-merge.json +13 -0
- package/dist/agent-src/commands/evals/roadmap.json +17 -1
- package/dist/agent-src/commands/pr/create.md +14 -2
- package/dist/agent-src/commands/pr/merge.md +379 -0
- package/dist/agent-src/commands/roadmap/process-full.md +272 -32
- package/dist/agent-src/commands/roadmap.md +1 -1
- package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +46 -36
- package/dist/agent-src/contexts/execution/autonomy-mechanics.md +37 -2
- package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +95 -2
- package/dist/agent-src/contexts/execution/roadmap-process-loop.md +289 -106
- package/dist/agent-src/rules/artifact-drafting-protocol.md +5 -1
- package/dist/agent-src/rules/context-hygiene.md +2 -0
- package/dist/agent-src/rules/decision-revisit-gate.md +67 -32
- package/dist/agent-src/rules/fix-what-you-see.md +108 -0
- package/dist/agent-src/rules/no-roadmap-references.md +0 -5
- package/dist/agent-src/rules/recurring-criticism.md +110 -0
- package/dist/agent-src/rules/roadmap-progress-sync.md +20 -1
- package/dist/agent-src/rules/rule-type-governance.md +0 -2
- package/dist/agent-src/rules/self-repair-loop.md +17 -0
- package/dist/agent-src/rules/skill-quality.md +0 -2
- package/dist/agent-src/rules/source-confidentiality.md +37 -7
- package/dist/agent-src/scripts/archival_sweep.ts +117 -0
- package/dist/agent-src/scripts/archive_completed_roadmaps.ts +26 -7
- package/dist/agent-src/scripts/dashboard_mode.ts +212 -0
- package/dist/agent-src/scripts/gate_budget.ts +282 -0
- package/dist/agent-src/scripts/gate_execute.ts +72 -31
- package/dist/agent-src/scripts/roadmap_gates.ts +74 -3
- package/dist/agent-src/scripts/update_roadmap_progress.ts +296 -53
- package/dist/agent-src/skills/adr-create/SKILL.md +124 -5
- package/dist/agent-src/skills/ai-council/SKILL.md +48 -807
- package/dist/agent-src/skills/ai-council/references/advanced-modes.md +320 -0
- package/dist/agent-src/skills/ai-council/references/cost-and-redaction.md +99 -0
- package/dist/agent-src/skills/ai-council/references/execution-modes.md +162 -0
- package/dist/agent-src/skills/ai-council/references/output-and-synthesis.md +125 -0
- package/dist/agent-src/skills/ai-council/references/procedure.md +143 -0
- package/dist/agent-src/skills/decision-record/SKILL.md +61 -3
- package/dist/agent-src/skills/decision-review/SKILL.md +65 -0
- package/dist/agent-src/skills/merge-conflicts/SKILL.md +26 -0
- package/dist/agent-src/skills/quality-tools/SKILL.md +34 -326
- package/dist/agent-src/skills/quality-tools/references/js-ts-tools.md +113 -0
- package/dist/agent-src/skills/quality-tools/references/php-tools.md +222 -0
- package/dist/agent-src/skills/roadmap-management/SKILL.md +15 -409
- package/dist/agent-src/skills/roadmap-management/references/archival.md +226 -0
- package/dist/agent-src/skills/roadmap-management/references/authoring.md +107 -0
- package/dist/agent-src/skills/roadmap-management/references/dashboard.md +47 -0
- package/dist/agent-src/skills/roadmap-management/references/lifecycle.md +58 -0
- package/dist/agent-src/skills/security/SKILL.md +8 -0
- package/dist/agent-src/skills/security-audit/SKILL.md +12 -1
- package/dist/agent-src/skills/skill-writing/SKILL.md +34 -570
- package/dist/agent-src/skills/skill-writing/references/procedure.md +275 -0
- package/dist/agent-src/skills/skill-writing/references/read-only-scripts.md +18 -0
- package/dist/agent-src/skills/skill-writing/references/section-patterns.md +298 -0
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/roadmaps.md +65 -4
- package/dist/agent-src/templates/scripts/telemetry/flush_sender.mjs +163 -0
- package/dist/agent-src/templates/scripts/telemetry/remote.ts +160 -7
- package/dist/agent-src/templates/scripts/telemetry/transport.ts +169 -0
- package/dist/cli/registry.js +2 -1
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/chunk-2GNWGMAL.js +172 -0
- package/dist/cli-delegate/{chunk-P6LQDIWK.js → chunk-7PRE6ZV2.js} +338 -0
- package/dist/cli-delegate/{chunk-BKO2AZ7Z.js → chunk-B2ERU2VA.js} +1 -1
- package/dist/cli-delegate/chunk-E4XIZDIB.js +402 -0
- package/dist/cli-delegate/{chunk-3UCJWMMP.js → chunk-EEJUMCDZ.js} +16 -16
- package/dist/cli-delegate/{chunk-NXFWFAYV.js → chunk-G23AT6GD.js} +1 -0
- package/dist/cli-delegate/{chunk-XURJ4AQC.js → chunk-H4VIVD4C.js} +385 -284
- package/dist/cli-delegate/chunk-I3EIN2YG.js +36 -0
- package/dist/cli-delegate/{chunk-RLN73PR5.js → chunk-LPPWO5CE.js} +12 -8
- package/dist/cli-delegate/chunk-MWRD5YOH.js +100 -0
- package/dist/cli-delegate/{chunk-UEZ7D35A.js → chunk-N7CDDGI3.js} +4 -23
- package/dist/cli-delegate/{chunk-63WSP6YZ.js → chunk-PMEKGDED.js} +74 -167
- package/dist/cli-delegate/{chunk-GRRPEPRN.js → chunk-T7L2QK3K.js} +24 -5
- package/dist/cli-delegate/{chunk-EVTY7ISR.js → chunk-YM4GZDJG.js} +9 -1
- package/dist/cli-delegate/cmd_adr_effective.js +1162 -0
- package/dist/cli-delegate/cmd_conformance.js +466 -716
- package/dist/cli-delegate/cmd_converge.js +3 -3
- package/dist/cli-delegate/cmd_doctor.js +10 -10
- package/dist/cli-delegate/cmd_explain.js +1 -1
- package/dist/cli-delegate/cmd_export.js +10 -9
- package/dist/cli-delegate/cmd_handoff.js +10 -9
- package/dist/cli-delegate/cmd_memory_get.js +2 -1
- package/dist/cli-delegate/cmd_migrate.js +2 -2
- package/dist/cli-delegate/cmd_packs_active.js +1 -1
- package/dist/cli-delegate/cmd_preflight.js +5 -5
- package/dist/cli-delegate/cmd_prune.js +11 -10
- package/dist/cli-delegate/cmd_route_audit.js +6 -5
- package/dist/cli-delegate/cmd_route_explain.js +3 -3
- package/dist/cli-delegate/cmd_session_recycle.js +840 -30
- package/dist/cli-delegate/cmd_settings_get.js +3 -3
- package/dist/cli-delegate/cmd_settings_migrate.js +10 -9
- package/dist/cli-delegate/cmd_settings_set.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +11 -10
- package/dist/cli-delegate/cmd_uninstall.js +13 -11
- package/dist/cli-delegate/cmd_update.js +4 -4
- package/dist/cli-delegate/cmd_upgrade.js +4 -4
- package/dist/cli-delegate/cmd_validate.js +11 -10
- package/dist/cli-delegate/cmd_versions.js +3 -3
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +111 -37
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +5 -5
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +15 -12
- package/dist/discovery/trust-report.md +3 -3
- package/dist/discovery/workspaces.json +11 -8
- package/dist/hooks/dispatch.js +3165 -2192
- package/dist/install/claudePathsPlan.js +187 -0
- package/dist/install/claudePathsPlan.js.map +1 -0
- package/dist/install/globalRuleLayers.js +169 -0
- package/dist/install/globalRuleLayers.js.map +1 -0
- package/dist/install/hostLayerFingerprint.js +136 -0
- package/dist/install/hostLayerFingerprint.js.map +1 -0
- package/dist/install/install.mjs +553 -425
- package/dist/install/partitionEligibility.js +432 -0
- package/dist/install/partitionEligibility.js.map +1 -0
- package/dist/install/ruleLayerPartition.js +157 -0
- package/dist/install/ruleLayerPartition.js.map +1 -0
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +1863 -1234
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/agent_src.js +41 -0
- package/dist/scripts/_lib/agent_src.js.map +1 -1
- package/dist/scripts/_lib/install_layout.js +83 -0
- package/dist/scripts/_lib/install_layout.js.map +1 -0
- package/dist/scripts/_lib/installed_lock.js +444 -0
- package/dist/scripts/_lib/installed_lock.js.map +1 -0
- package/dist/scripts/_lib/prune_empty_dirs.js +85 -0
- package/dist/scripts/_lib/prune_empty_dirs.js.map +1 -0
- package/dist/scripts/condense.js +63 -251
- package/dist/scripts/condense.js.map +1 -1
- package/dist/server/schemas/settings.js +4 -0
- package/dist/server/schemas/settings.js.map +1 -1
- package/docs/contracts/settings-classes.md +12 -6
- package/docs/guidelines/agent-infra/agent-interaction-and-decision-quality.md +8 -3
- package/docs/guidelines/agent-infra/artifact-drafting-protocol-mechanics.md +45 -1
- package/docs/guidelines/agent-infra/context-hygiene-mechanics.md +26 -0
- package/docs/guidelines/agent-infra/false-green.md +47 -1
- package/docs/guidelines/agent-infra/memory-access.md +17 -0
- package/docs/guidelines/agent-infra/recurring-criticism-mechanics.md +96 -0
- package/package.json +1 -1
- package/src/agent-src/scripts/archival_sweep.ts +117 -0
- package/src/agent-src/scripts/archive_completed_roadmaps.ts +26 -7
- package/src/agent-src/scripts/dashboard_mode.ts +212 -0
- package/src/agent-src/scripts/gate_budget.ts +282 -0
- package/src/agent-src/scripts/gate_execute.ts +72 -31
- package/src/agent-src/scripts/roadmap_gates.ts +74 -3
- package/src/agent-src/scripts/update_roadmap_progress.ts +296 -53
- package/src/agent-src/templates/scripts/telemetry/flush_sender.mjs +163 -0
- package/src/agent-src/templates/scripts/telemetry/remote.ts +160 -7
- package/src/agent-src/templates/scripts/telemetry/transport.ts +169 -0
- package/src/config/agent-settings.template.yml +27 -2
- package/src/config/ci-local-parity.yml +39 -0
- package/src/config/estate-count-budget.json +612 -3
- package/src/config/evaluator-budgets.json +3 -3
- package/src/config/gate-coverage.yml +220 -12
- package/src/config/gate-violation-baselines.json +73 -63
- package/src/config/gitignore-block.txt +15 -2
- package/src/config/hook-latency-budget.json +5 -0
- package/src/config/rule-activation-census.json +14 -6
- package/src/config/rule-stub-ceilings.json +34 -7
- package/src/install/claudePathsPlan.ts +196 -0
- package/src/install/globalRuleLayers.ts +197 -0
- package/src/install/hostLayerFingerprint.ts +145 -0
- package/src/install/partitionEligibility.ts +502 -0
- package/src/install/ruleLayerPartition.ts +212 -0
- package/src/scripts/_cli/cmd_adr_effective.ts +484 -0
- package/src/scripts/_cli/cmd_session_recycle.ts +9 -1
- package/src/scripts/_dispatch.bash +17 -1
- package/src/scripts/_lib/ac_heading.ts +30 -0
- package/src/scripts/_lib/adr_frontmatter.test.ts +365 -0
- package/src/scripts/_lib/adr_frontmatter.ts +459 -0
- package/src/scripts/_lib/agent_src.ts +42 -0
- package/src/scripts/_lib/bench_ab_pinned_repo.ts +162 -0
- package/src/scripts/_lib/bench_ab_workspace.ts +10 -1
- package/src/scripts/_lib/envelope_grounding.ts +49 -9
- package/src/scripts/_lib/installed_lock.ts +50 -5
- package/src/scripts/_lib/layer_overlap_notice.ts +11 -2
- package/src/scripts/_lib/md_section.ts +129 -0
- package/src/scripts/_lib/prune_empty_dirs.ts +80 -0
- package/src/scripts/_lib/scope_guard.sh +26 -3
- package/src/scripts/_lib/self_repair.ts +19 -0
- package/src/scripts/_lib/self_repair_class_b.ts +171 -0
- package/src/scripts/adr/evidence_census.ts +899 -0
- package/src/scripts/adr/regenerate_index.ts +12 -32
- package/src/scripts/adr_cite_check.ts +540 -39
- package/src/scripts/ai_council/cli_help.ts +55 -0
- package/src/scripts/audit_adr_coverage.ts +103 -17
- package/src/scripts/before_complete_hook.ts +153 -28
- package/src/scripts/bench_ab_v2_complexity.ts +27 -7
- package/src/scripts/bench_hook_latency.ts +204 -0
- package/src/scripts/build_archive_index.ts +34 -0
- package/src/scripts/check_adr_frontmatter.ts +574 -39
- package/src/scripts/check_hook_bundle_content.ts +219 -0
- package/src/scripts/check_new_adr_evidence.ts +529 -0
- package/src/scripts/check_references.ts +78 -0
- package/src/scripts/check_release_published.ts +32 -11
- package/src/scripts/check_rule_layer_partition.ts +531 -0
- package/src/scripts/check_single_delivery.ts +194 -17
- package/src/scripts/check_standing_rule_delivery.ts +8 -2
- package/src/scripts/ci_settle.ts +170 -0
- package/src/scripts/condense.ts +79 -259
- package/src/scripts/council_cli.ts +3 -3
- package/src/scripts/dispatch_r2_reviewer.ts +6 -14
- package/src/scripts/external_sources_denylist.json +4 -1
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +77 -14
- package/src/scripts/hooks/block_no_verify.ts +61 -10
- package/src/scripts/hooks/block_unauthorized_git.ts +21 -1
- package/src/scripts/hooks/concern_registry.ts +4 -0
- package/src/scripts/hooks/dispatch_hook.ts +154 -187
- package/src/scripts/hooks/dispatch_issues.ts +38 -19
- package/src/scripts/hooks/fallback_yaml.ts +66 -0
- package/src/scripts/hooks/host_semantics.ts +21 -0
- package/src/scripts/hooks/injection_budget.ts +13 -3
- package/src/scripts/hooks/py_json_dumps.ts +103 -0
- package/src/scripts/hooks/rtk_wrap_hook.ts +8 -3
- package/src/scripts/hooks/run_continuation_hook.ts +8 -5
- package/src/scripts/hooks/ship_diff_volume_hook.ts +81 -15
- package/src/scripts/hooks/source_first_gate_hook.ts +464 -0
- package/src/scripts/hooks/state_io.ts +870 -21
- package/src/scripts/hooks/stdin_failure_policy.ts +96 -0
- package/src/scripts/hooks/subagent_ledger_hook.ts +44 -15
- package/src/scripts/hooks/telemetry_flush_hook.ts +139 -0
- package/src/scripts/hooks/telemetry_self_repair.ts +128 -0
- package/src/scripts/hooks/telemetry_usage_hook.ts +22 -4
- package/src/scripts/hooks/turn_end_gate_hook.ts +81 -15
- package/src/scripts/injection_scan_hook.ts +137 -5
- package/src/scripts/install.ts +16 -11
- package/src/scripts/language_mirror_hook.ts +561 -25
- package/src/scripts/lint_framework_leakage_allowlist.json +2 -2
- package/src/scripts/lint_hook_manifest.ts +49 -0
- package/src/scripts/lint_plan_risk_register.ts +4 -3
- package/src/scripts/lint_provenance_vocabulary.ts +472 -4
- package/src/scripts/lint_skill_router_head.ts +4 -4
- package/src/scripts/mcp_server/tools.ts +2 -2
- package/src/scripts/new_roadmap.ts +136 -0
- package/src/scripts/pack_mcp_content.ts +20 -5
- package/src/scripts/release.ts +37 -38
- package/src/scripts/report_layer_overlap.ts +6 -0
- package/src/scripts/routing_doctor.ts +5 -1
- package/src/scripts/self_repair_hook.ts +37 -5
- package/src/scripts/session_register_hook.ts +11 -0
- package/src/scripts/skill_usage_collect.ts +11 -1
- package/src/scripts/skill_usage_report.ts +278 -8
- package/src/scripts/sync_pr_branch.ts +170 -20
- package/src/server/schemas/settings.ts +8 -0
- package/dist/cli-delegate/chunk-EJITJBJX.js +0 -172
- package/dist/cli-delegate/chunk-PZWRPRWP.js +0 -38
- package/dist/cli-delegate/{chunk-PPQO4NGR.js → chunk-6RJA2F5A.js} +3 -3
- package/dist/cli-delegate/{chunk-RYNADUFG.js → chunk-LWTYTX6F.js} +0 -0
- package/dist/cli-delegate/{chunk-FBKL6JWT.js → chunk-MMSGVZKV.js} +3 -3
|
@@ -22,11 +22,17 @@
|
|
|
22
22
|
* instead of one entry.
|
|
23
23
|
* - **No resolve on failure.** A non-zero exit reports and changes nothing.
|
|
24
24
|
* A gate marked resolved by a command that failed is worse than an open one.
|
|
25
|
-
* - **No
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
25
|
+
* - **No spend outside the standing budget.** Class 1 runs only under the
|
|
26
|
+
* caps `b-gate-budget-preauth` decided (option (a), 2026-08-20): a per-run
|
|
27
|
+
* cap AND a rolling-7-day cap, with an append-only receipt as the audit
|
|
28
|
+
* surface. No caps configured, no USD estimate in the entry, over either
|
|
29
|
+
* cap — every one of those RENDERS instead of running, which is the
|
|
30
|
+
* behaviour the blocker itself prescribes for a missing ledger.
|
|
31
|
+
* - **No consent from the ledger.** The receipt records CONSUMPTION only.
|
|
32
|
+
* `agents/runtime/state/` is agent-writable, so reading an "authorisation"
|
|
33
|
+
* out of it would be the agent consenting on the user's behalf — the exact
|
|
34
|
+
* threat model the live-trigger-eval terminal abort exists for. `--confirm`
|
|
35
|
+
* remains the consent on every class-1 run.
|
|
30
36
|
* - **No class-3 change.** The class-3 branch executes nothing and writes
|
|
31
37
|
* nothing, so `agent-config gates` renders a class-3 entry exactly as it did
|
|
32
38
|
* before this module existed. `--execute` on one returns a one-line notice
|
|
@@ -35,8 +41,9 @@
|
|
|
35
41
|
* markdown field. Without the flag the command is echoed and refused, so
|
|
36
42
|
* the operator sees the exact string first — the this-turn, names-the-object
|
|
37
43
|
* confirmation `non-destructive-by-default` requires. A command carrying a
|
|
38
|
-
* Hard-Floor action is refused even WITH the flag:
|
|
39
|
-
* so such an entry is misclassified rather than
|
|
44
|
+
* Hard-Floor action is refused even WITH the flag: classes 0 and 1 are both
|
|
45
|
+
* defined as reversible, so such an entry is misclassified rather than
|
|
46
|
+
* merely dangerous.
|
|
40
47
|
*/
|
|
41
48
|
|
|
42
49
|
import * as fs from 'node:fs';
|
|
@@ -44,15 +51,24 @@ import * as path from 'node:path';
|
|
|
44
51
|
import { spawnSync } from 'node:child_process';
|
|
45
52
|
|
|
46
53
|
import { collect, blocker_class, type Blocker } from './update_roadmap_progress.js';
|
|
54
|
+
import {
|
|
55
|
+
appendGateBudgetReceipt,
|
|
56
|
+
evaluateGateBudget,
|
|
57
|
+
GATE_BUDGET_LEDGER_REL,
|
|
58
|
+
parseBudgetUsd,
|
|
59
|
+
readGateBudgetCaps,
|
|
60
|
+
readGateBudgetLedger,
|
|
61
|
+
} from './gate_budget.js';
|
|
62
|
+
import { load_agent_settings } from '../templates/scripts/work_engine/_lib/agent_settings.js';
|
|
47
63
|
|
|
48
64
|
/**
|
|
49
|
-
* Where
|
|
65
|
+
* Where the class-1 receipt ledger lives.
|
|
50
66
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
67
|
+
* Kept as a name here because it was already exported, but the definition
|
|
68
|
+
* moved to `gate_budget.ts` when the budget decision landed — one path, one
|
|
69
|
+
* builder, so a relocation cannot leave a second joiner behind.
|
|
54
70
|
*/
|
|
55
|
-
const LEDGER_REL =
|
|
71
|
+
const LEDGER_REL = GATE_BUDGET_LEDGER_REL;
|
|
56
72
|
|
|
57
73
|
type Outcome = 'resolved' | 'failed' | 'rendered' | 'not-found';
|
|
58
74
|
|
|
@@ -260,6 +276,7 @@ function execute(
|
|
|
260
276
|
}
|
|
261
277
|
const { blocker, file, rel } = found;
|
|
262
278
|
const cls = blocker_class(blocker);
|
|
279
|
+
const repoRoot = path.dirname(path.dirname(roadmapRoot));
|
|
263
280
|
|
|
264
281
|
if (cls === '3') {
|
|
265
282
|
// Byte-identical to today by construction: nothing is executed and
|
|
@@ -273,28 +290,32 @@ function execute(
|
|
|
273
290
|
if (cls === '2') {
|
|
274
291
|
return { outcome: 'rendered', report: consentLine(blocker), code: 0 };
|
|
275
292
|
}
|
|
293
|
+
// Class 1 runs under the standing budget decided by `b-gate-budget-preauth`
|
|
294
|
+
// option (a): a per-run cap AND a rolling-7-day cap, with an append-only
|
|
295
|
+
// receipt as the audit surface. Every refusal path RENDERS rather than
|
|
296
|
+
// running — the blocker's own prescription for a missing ledger,
|
|
297
|
+
// generalised to every way the budget can say no. The `--confirm`
|
|
298
|
+
// requirement below is untouched: the caps bound the size of an authorised
|
|
299
|
+
// spend, they never supply the authorisation.
|
|
300
|
+
let budgeted: { estimateUsd: number } | null = null;
|
|
276
301
|
if (cls === '1') {
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
302
|
+
const verdict = evaluateGateBudget({
|
|
303
|
+
caps: readGateBudgetCaps(load_agent_settings({ cwd: repoRoot })),
|
|
304
|
+
records: readGateBudgetLedger(repoRoot),
|
|
305
|
+
estimateUsd: parseBudgetUsd(blocker.budget),
|
|
306
|
+
now,
|
|
307
|
+
});
|
|
308
|
+
if (!verdict.ok) {
|
|
282
309
|
return {
|
|
283
310
|
outcome: 'rendered',
|
|
284
311
|
report: consentLine(
|
|
285
312
|
blocker,
|
|
286
|
-
|
|
313
|
+
`class 1 and ${verdict.detail}, so it renders instead of running`,
|
|
287
314
|
),
|
|
288
315
|
code: 0,
|
|
289
316
|
};
|
|
290
317
|
}
|
|
291
|
-
|
|
292
|
-
outcome: 'rendered',
|
|
293
|
-
report:
|
|
294
|
-
`${id} is class 1 and a ledger exists at ${LEDGER_REL}, but spend execution ` +
|
|
295
|
-
'is gated on `b-gate-budget-preauth`, which is open. Rendering instead of running.\n',
|
|
296
|
-
code: 0,
|
|
297
|
-
};
|
|
318
|
+
budgeted = { estimateUsd: verdict.estimateUsd };
|
|
298
319
|
}
|
|
299
320
|
|
|
300
321
|
const command = commandOf(blocker);
|
|
@@ -304,7 +325,7 @@ function execute(
|
|
|
304
325
|
// and guessing a command here is the one thing that must not happen.
|
|
305
326
|
return {
|
|
306
327
|
outcome: 'failed',
|
|
307
|
-
report: `${id} is class
|
|
328
|
+
report: `${id} is class ${cls} but carries no **Run:** command. Nothing was executed.\n`,
|
|
308
329
|
code: 1,
|
|
309
330
|
};
|
|
310
331
|
}
|
|
@@ -318,9 +339,9 @@ function execute(
|
|
|
318
339
|
return {
|
|
319
340
|
outcome: 'failed',
|
|
320
341
|
report:
|
|
321
|
-
`${id} is class
|
|
322
|
-
'Hard-Floor action under non-destructive-by-default.
|
|
323
|
-
'
|
|
342
|
+
`${id} is class ${cls} but its **Run:** command contains \`${floor}\`, which is a ` +
|
|
343
|
+
'Hard-Floor action under non-destructive-by-default. Classes 0 and 1 are ' +
|
|
344
|
+
'both defined as REVERSIBLE, so this entry is misclassified. ' +
|
|
324
345
|
'Nothing was executed; re-author the class.\n',
|
|
325
346
|
code: 1,
|
|
326
347
|
};
|
|
@@ -333,7 +354,7 @@ function execute(
|
|
|
333
354
|
return {
|
|
334
355
|
outcome: 'rendered',
|
|
335
356
|
report:
|
|
336
|
-
`${id} is class
|
|
357
|
+
`${id} is class ${cls} and would run, from the repo root:\n\n` +
|
|
337
358
|
` ${command}\n\n` +
|
|
338
359
|
'Nothing has been executed. Re-run with `--confirm` to execute it and ' +
|
|
339
360
|
'record the evidence at the blocker.\n',
|
|
@@ -344,7 +365,7 @@ function execute(
|
|
|
344
365
|
const r = spawnSync(command, {
|
|
345
366
|
shell: true,
|
|
346
367
|
encoding: 'utf-8',
|
|
347
|
-
cwd:
|
|
368
|
+
cwd: repoRoot,
|
|
348
369
|
timeout: 120_000,
|
|
349
370
|
});
|
|
350
371
|
const output = `${r.stdout ?? ''}${r.stderr ?? ''}`;
|
|
@@ -367,6 +388,22 @@ function execute(
|
|
|
367
388
|
code: 1,
|
|
368
389
|
};
|
|
369
390
|
}
|
|
391
|
+
if (budgeted !== null) {
|
|
392
|
+
// Written BEFORE the file rewrite: an unreceipted spend is invisible to
|
|
393
|
+
// the rolling cap, and the cap failing open is the one way this
|
|
394
|
+
// mechanism could become a blank cheque. `actual_usd` is null because
|
|
395
|
+
// nothing on this path observes the provider's billed amount — the
|
|
396
|
+
// estimate is what the cap compared against and what it records.
|
|
397
|
+
appendGateBudgetReceipt(repoRoot, {
|
|
398
|
+
kind: 'consumption',
|
|
399
|
+
blocker: id,
|
|
400
|
+
authorization: 'confirm-flag',
|
|
401
|
+
estimated_usd: budgeted.estimateUsd,
|
|
402
|
+
actual_usd: null,
|
|
403
|
+
at: now.toISOString(),
|
|
404
|
+
single_use: true,
|
|
405
|
+
});
|
|
406
|
+
}
|
|
370
407
|
const when = today(now);
|
|
371
408
|
if (!appendEvidence(file, id, command, output, when)) {
|
|
372
409
|
return {
|
|
@@ -382,6 +419,10 @@ function execute(
|
|
|
382
419
|
report:
|
|
383
420
|
`${id} resolved. Ran \`${command}\` (exit 0); evidence appended in ${rel} ` +
|
|
384
421
|
`and the status flipped to resolved ${when}.\n` +
|
|
422
|
+
(budgeted === null
|
|
423
|
+
? ''
|
|
424
|
+
: `Receipt appended to ${LEDGER_REL} ` +
|
|
425
|
+
`($${budgeted.estimateUsd.toFixed(2)} estimated).\n`) +
|
|
385
426
|
// The dashboard is derived from the file this just rewrote, so it
|
|
386
427
|
// is now stale. Saying so is the same follow-up `renderResumed`
|
|
387
428
|
// already prints for its own file-move suggestion.
|
|
@@ -427,13 +427,83 @@ export function sheetQuestion(b: Blocker): { text: string; source: 'question' |
|
|
|
427
427
|
* none is recorded it says so and names what the reader must supply, so
|
|
428
428
|
* regenerating the sheet cannot silently overwrite an answer with a guess.
|
|
429
429
|
*/
|
|
430
|
-
|
|
430
|
+
/**
|
|
431
|
+
* The recorded answer to the consolidated decision sheet.
|
|
432
|
+
*
|
|
433
|
+
* The sheet is DERIVED, so an answer written into it is lost on the next run —
|
|
434
|
+
* the file says so in its own header. But `road-to-estate-drawdown` blocker
|
|
435
|
+
* `b-consolidated-decision-sheet` resolves only when "the sheet records which
|
|
436
|
+
* option was used", and a derived file cannot carry that by being edited. So the
|
|
437
|
+
* option lives in a NON-derived sibling and the sheet reads it, which keeps the
|
|
438
|
+
* sheet deterministic and still lets it state the answer.
|
|
439
|
+
*
|
|
440
|
+
* Read, never written, and absent is a first-class answer: no marker means the
|
|
441
|
+
* sheet renders exactly as before, so this is additive to every existing caller.
|
|
442
|
+
*/
|
|
443
|
+
interface SheetAnswer {
|
|
444
|
+
option: string;
|
|
445
|
+
answered: string;
|
|
446
|
+
authority: string;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
const SHEET_ANSWER_REL = path.join('agents', 'decisions', 'consolidated-decision-sheet-answer.md');
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* One line, three fields, all required — a partial marker is treated as absent
|
|
453
|
+
* rather than rendered half-filled, because a header that named an option with
|
|
454
|
+
* no date or authority would be less honest than one that says nothing.
|
|
455
|
+
*/
|
|
456
|
+
const SHEET_ANSWER_RE =
|
|
457
|
+
/<!--\s*sheet-answer:\s*(.+?)\s*\|\s*answered:\s*(\d{4}-\d{2}-\d{2})\s*\|\s*authority:\s*(\S+)\s*-->/;
|
|
458
|
+
|
|
459
|
+
export function readSheetAnswer(repoRoot: string): SheetAnswer | null {
|
|
460
|
+
const file = path.join(repoRoot, SHEET_ANSWER_REL);
|
|
461
|
+
let text: string;
|
|
462
|
+
try {
|
|
463
|
+
text = fs.readFileSync(file, 'utf8');
|
|
464
|
+
} catch {
|
|
465
|
+
return null;
|
|
466
|
+
}
|
|
467
|
+
const m = SHEET_ANSWER_RE.exec(text);
|
|
468
|
+
if (m === null) {
|
|
469
|
+
return null;
|
|
470
|
+
}
|
|
471
|
+
return {
|
|
472
|
+
option: (m[1] as string).trim(),
|
|
473
|
+
answered: (m[2] as string).trim(),
|
|
474
|
+
authority: (m[3] as string).trim(),
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/** The header block naming the recorded answer, or nothing when none is recorded. */
|
|
479
|
+
function answerBanner(answer: SheetAnswer | null): string[] {
|
|
480
|
+
if (answer === null) {
|
|
481
|
+
return [];
|
|
482
|
+
}
|
|
483
|
+
return [
|
|
484
|
+
'>',
|
|
485
|
+
`> **ANSWERED ${answer.answered} — ${answer.option}.**`,
|
|
486
|
+
`> Recorded in \`${SHEET_ANSWER_REL}\` (not derived);`,
|
|
487
|
+
`> authority \`${answer.authority}\`.`,
|
|
488
|
+
'> The rows below are the ones still OPEN: an answered',
|
|
489
|
+
'> row stays here until the work its own entry names is done, so this is a work',
|
|
490
|
+
'> queue and not a count of unanswered questions.',
|
|
491
|
+
];
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
function renderSheet(
|
|
495
|
+
entries: readonly Entry[],
|
|
496
|
+
now: Date,
|
|
497
|
+
answer: SheetAnswer | null = null,
|
|
498
|
+
): string {
|
|
431
499
|
const mine = entries.filter((e) => needsUser(e.blocker.owner));
|
|
432
500
|
const stamp = now.toISOString().slice(0, 10);
|
|
433
501
|
if (mine.length === 0) {
|
|
502
|
+
const banner = answerBanner(answer);
|
|
434
503
|
return (
|
|
435
504
|
`# Consolidated decision sheet — nothing owned by you (${stamp})\n\n` +
|
|
436
|
-
'No open blocker in the active roadmap tree carries `Owner: user`. Nothing to answer.\n'
|
|
505
|
+
'No open blocker in the active roadmap tree carries `Owner: user`. Nothing to answer.\n' +
|
|
506
|
+
(banner.length === 0 ? '' : '\n' + banner.slice(1).join('\n') + '\n')
|
|
437
507
|
);
|
|
438
508
|
}
|
|
439
509
|
|
|
@@ -461,6 +531,7 @@ function renderSheet(entries: readonly Entry[], now: Date): string {
|
|
|
461
531
|
'> This file is DERIVED — every line above and below comes from the roadmaps themselves,',
|
|
462
532
|
'> so regenerating is deterministic and an answer written into this file would be lost.',
|
|
463
533
|
'> Answers go back into each roadmap at its own blocker; the agent does that.',
|
|
534
|
+
...answerBanner(answer),
|
|
464
535
|
'',
|
|
465
536
|
'| # | Decision | Roadmap | Unblocks | Default source |',
|
|
466
537
|
'|---:|---|---|---:|---|',
|
|
@@ -847,7 +918,7 @@ function main(argv?: readonly string[]): number {
|
|
|
847
918
|
const resumed = reply || sheet ? [] : probeLater(roadmapRoot, repoRoot);
|
|
848
919
|
process.stdout.write(
|
|
849
920
|
sheet
|
|
850
|
-
? renderSheet(entries, new Date())
|
|
921
|
+
? renderSheet(entries, new Date(), readSheetAnswer(repoRoot))
|
|
851
922
|
: reply
|
|
852
923
|
? renderReply(entries)
|
|
853
924
|
: json
|