@event4u/agent-config 9.25.0 → 9.27.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 +58 -143
- package/README.md +1 -1
- package/dist/agent-src/commands/analyze/conformance.md +21 -2
- package/dist/agent-src/commands/review/changes.md +6 -5
- package/dist/agent-src/commands/roadmap/next.md +256 -0
- package/dist/agent-src/commands/roadmap.md +12 -4
- package/dist/agent-src/contexts/execution/subagent-routing.md +4 -1
- package/dist/agent-src/rules/active-remediation.md +2 -0
- package/dist/agent-src/rules/analysis-skill-routing.md +2 -0
- package/dist/agent-src/rules/architecture.md +2 -0
- package/dist/agent-src/rules/artifact-drafting-protocol.md +2 -0
- package/dist/agent-src/rules/artifact-engagement-recording.md +2 -0
- package/dist/agent-src/rules/augment-edit-discipline.md +2 -0
- package/dist/agent-src/rules/autonomous-execution.md +2 -0
- package/dist/agent-src/rules/brand-consistency.md +2 -0
- package/dist/agent-src/rules/brand-source-of-truth.md +2 -0
- package/dist/agent-src/rules/broken-access-control.md +2 -0
- package/dist/agent-src/rules/cli-output-handling.md +2 -0
- package/dist/agent-src/rules/code-comment-discipline.md +2 -0
- package/dist/agent-src/rules/code-provenance.md +2 -0
- package/dist/agent-src/rules/command-suggestion-policy.md +2 -0
- package/dist/agent-src/rules/commit-conventions.md +2 -0
- package/dist/agent-src/rules/communication-through-line.md +2 -0
- package/dist/agent-src/rules/content-quoting-floor.md +2 -0
- package/dist/agent-src/rules/context-hygiene.md +10 -0
- package/dist/agent-src/rules/copilot-routing.md +2 -0
- package/dist/agent-src/rules/cross-source-consistency.md +2 -0
- package/dist/agent-src/rules/decision-revisit-gate.md +2 -0
- package/dist/agent-src/rules/delegation-policy.md +5 -2
- package/dist/agent-src/rules/design-fidelity.md +19 -1
- package/dist/agent-src/rules/design-review-after-ui-write.md +120 -0
- package/dist/agent-src/rules/devcontainer-routing.md +2 -0
- package/dist/agent-src/rules/doc-screenshot-hygiene.md +2 -0
- package/dist/agent-src/rules/docker-commands.md +2 -0
- package/dist/agent-src/rules/domain-adoption-policy.md +2 -0
- package/dist/agent-src/rules/domain-safety-disclaimer.md +2 -0
- package/dist/agent-src/rules/domain-safety-pii.md +2 -0
- package/dist/agent-src/rules/domain-safety-retention.md +2 -0
- package/dist/agent-src/rules/downstream-changes.md +2 -0
- package/dist/agent-src/rules/engineering-safety-floor.md +2 -0
- package/dist/agent-src/rules/evaluator-independence.md +19 -3
- package/dist/agent-src/rules/external-code-graph-interop.md +2 -0
- package/dist/agent-src/rules/external-reference-deep-dive.md +2 -0
- package/dist/agent-src/rules/fast-path-marker-visibility.md +2 -0
- package/dist/agent-src/rules/finance-safety-floor.md +2 -0
- package/dist/agent-src/rules/framework-neutrality-in-generic-skills.md +2 -0
- package/dist/agent-src/rules/git-history-discipline.md +3 -1
- package/dist/agent-src/rules/guidelines.md +2 -0
- package/dist/agent-src/rules/history-discipline.md +2 -0
- package/dist/agent-src/rules/icon-consistency.md +2 -0
- package/dist/agent-src/rules/image-likeness-and-rights.md +2 -0
- package/dist/agent-src/rules/improve-before-implement.md +2 -0
- package/dist/agent-src/rules/invite-challenge.md +2 -0
- package/dist/agent-src/rules/laravel-routing.md +2 -0
- package/dist/agent-src/rules/laravel-translations.md +2 -0
- package/dist/agent-src/rules/legal-safety-floor.md +2 -0
- package/dist/agent-src/rules/lethal-trifecta-guard.md +2 -0
- package/dist/agent-src/rules/linked-projects-onboarding-gate.md +2 -0
- package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +2 -0
- package/dist/agent-src/rules/markdown-safe-codeblocks.md +2 -0
- package/dist/agent-src/rules/media-governance-routing.md +2 -0
- package/dist/agent-src/rules/media-sync-ground-truth.md +2 -0
- package/dist/agent-src/rules/minimal-safe-diff.md +2 -0
- package/dist/agent-src/rules/missing-tool-handling.md +2 -0
- package/dist/agent-src/rules/model-recommendation.md +2 -0
- package/dist/agent-src/rules/no-attribution-footers.md +2 -0
- package/dist/agent-src/rules/no-decorative-emojis-in-git-surfaces.md +2 -0
- package/dist/agent-src/rules/no-pr-progress-comments.md +2 -0
- package/dist/agent-src/rules/no-roadmap-references.md +2 -0
- package/dist/agent-src/rules/notes-first-reasoning.md +2 -0
- package/dist/agent-src/rules/onboarding-gate.md +2 -0
- package/dist/agent-src/rules/output-discipline.md +2 -0
- package/dist/agent-src/rules/package-ci-checks.md +2 -0
- package/dist/agent-src/rules/persona-governance.md +2 -0
- package/dist/agent-src/rules/php-coding.md +2 -0
- package/dist/agent-src/rules/prefer-enums-over-literals.md +2 -0
- package/dist/agent-src/rules/preservation-guard.md +2 -0
- package/dist/agent-src/rules/provider-lifecycle-discipline.md +2 -0
- package/dist/agent-src/rules/question-not-instruction.md +2 -0
- package/dist/agent-src/rules/reviewer-awareness.md +2 -0
- package/dist/agent-src/rules/roadmap-ci-steps-policy.md +2 -0
- package/dist/agent-src/rules/roadmap-progress-sync.md +2 -0
- package/dist/agent-src/rules/role-mode-adherence.md +2 -0
- package/dist/agent-src/rules/rule-type-governance.md +2 -0
- package/dist/agent-src/rules/runtime-safety.md +2 -0
- package/dist/agent-src/rules/scale-discipline.md +2 -0
- package/dist/agent-src/rules/secret-vcs-guard.md +2 -0
- package/dist/agent-src/rules/security-sensitive-stop.md +2 -0
- package/dist/agent-src/rules/senior-engineering-discipline.md +2 -0
- package/dist/agent-src/rules/session-canary.md +63 -19
- package/dist/agent-src/rules/settings-ask-protocol.md +180 -0
- package/dist/agent-src/rules/size-enforcement.md +2 -0
- package/dist/agent-src/rules/skill-improvement-trigger.md +2 -0
- package/dist/agent-src/rules/skill-quality.md +2 -0
- package/dist/agent-src/rules/slash-command-routing-policy.md +2 -0
- package/dist/agent-src/rules/source-confidentiality.md +2 -0
- package/dist/agent-src/rules/source-discovery-gate.md +2 -0
- package/dist/agent-src/rules/source-of-truth.md +2 -0
- package/dist/agent-src/rules/spreadsheet-source-quality.md +2 -0
- package/dist/agent-src/rules/strategy-safety-floor.md +2 -0
- package/dist/agent-src/rules/symfony-routing.md +2 -0
- package/dist/agent-src/rules/think-before-action.md +2 -0
- package/dist/agent-src/rules/token-budget-discipline.md +8 -3
- package/dist/agent-src/rules/token-efficiency.md +2 -0
- package/dist/agent-src/rules/token-optimizer-maintenance.md +2 -0
- package/dist/agent-src/rules/tool-safety.md +2 -0
- package/dist/agent-src/rules/ui-audit-gate.md +7 -0
- package/dist/agent-src/rules/untrusted-input-defense.md +2 -0
- package/dist/agent-src/rules/upstream-proposal.md +2 -0
- package/dist/agent-src/rules/user-interaction.md +5 -2
- package/dist/agent-src/rules/user-interrupt-priority.md +2 -0
- package/dist/agent-src/skills/recursive-verification/SKILL.md +13 -0
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/cli/registry.js +2 -0
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/{chunk-SJQMJI7M.js → chunk-3KJIMFTB.js} +1 -1
- package/dist/cli-delegate/{chunk-BSLUHV2F.js → chunk-BCPIOAGV.js} +148 -133
- package/dist/cli-delegate/cmd_conformance.js +1 -1
- package/dist/cli-delegate/cmd_doctor.js +1 -1
- package/dist/cli-delegate/cmd_export.js +1 -1
- package/dist/cli-delegate/cmd_prune.js +1 -1
- package/dist/cli-delegate/cmd_route_audit.js +4 -1
- package/dist/cli-delegate/cmd_route_explain.js +4 -1
- package/dist/cli-delegate/cmd_settings_migrate.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +1 -1
- package/dist/cli-delegate/cmd_uninstall.js +1 -1
- package/dist/cli-delegate/cmd_validate.js +1 -1
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +191 -120
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +4 -4
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +11 -8
- package/dist/discovery/trust-report.md +3 -3
- package/dist/discovery/workspaces.json +9 -6
- package/dist/hooks/dispatch.js +1148 -349
- package/dist/install/install.mjs +1 -1
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +571 -417
- package/dist/router.json +1 -1
- package/dist/scripts/condense.js +33 -2
- package/dist/scripts/condense.js.map +1 -1
- package/dist/server/io/yamlIO.js +85 -0
- package/dist/server/io/yamlIO.js.map +1 -1
- package/dist/server/nicknameResolver.js +116 -0
- package/dist/server/nicknameResolver.js.map +1 -0
- package/dist/server/routes/ping.js +29 -11
- package/dist/server/routes/ping.js.map +1 -1
- package/dist/server/routes/settings.js +1 -12
- package/dist/server/routes/settings.js.map +1 -1
- package/dist/server/routes/wizard.js +52 -2
- package/dist/server/routes/wizard.js.map +1 -1
- package/dist/shared/interactiveContext.js +73 -0
- package/dist/shared/interactiveContext.js.map +1 -0
- package/dist/shared/nicknamePrefill.js +59 -0
- package/dist/shared/nicknamePrefill.js.map +1 -0
- package/dist/shared/settingsAsks.js +128 -0
- package/dist/shared/settingsAsks.js.map +1 -0
- package/dist/shared/settingsCarveOut.js +118 -0
- package/dist/shared/settingsCarveOut.js.map +1 -0
- package/dist/shared/settingsConsent.js +93 -0
- package/dist/shared/settingsConsent.js.map +1 -0
- package/dist/shared/settingsSurface.js +7 -1
- package/dist/shared/settingsSurface.js.map +1 -1
- package/dist/ui/assets/index-DmR0mbk4.js.map +1 -1
- package/package.json +1 -1
- package/src/config/agents-paths.yml +15 -0
- package/src/config/evaluator-budgets.json +4 -4
- package/src/config/gate-coverage.yml +29 -1
- package/src/config/gate-violation-baselines.json +13 -7
- package/src/scripts/_cli/cmd_doctor.ts +6 -21
- package/src/scripts/_cli/cmd_route_audit.ts +4 -1
- package/src/scripts/_cli/cmd_route_explain.ts +9 -1
- package/src/scripts/_dispatch.bash +18 -0
- package/src/scripts/_lib/git_common_dir.ts +128 -0
- package/src/scripts/_lib/obligation_frequency.ts +391 -0
- package/src/scripts/_lib/session_register.ts +361 -0
- package/src/scripts/ai-video/stitch.sh +27 -9
- package/src/scripts/before_complete_hook.ts +23 -4
- package/src/scripts/bench_ab_v2_run.ts +272 -16
- package/src/scripts/bench_ab_v2_stats.ts +156 -3
- package/src/scripts/check_completion_review.ts +80 -3
- package/src/scripts/check_corpus_staleness.ts +692 -0
- package/src/scripts/check_enforcement_coverage.ts +192 -7
- package/src/scripts/check_gate_coverage.ts +67 -0
- package/src/scripts/check_hook_bundle_freshness.ts +183 -0
- package/src/scripts/check_rule_projection_integrity.ts +364 -0
- package/src/scripts/condense.ts +36 -2
- package/src/scripts/conformance_scan.ts +82 -17
- package/src/scripts/dispatch_r2_reviewer.ts +31 -2
- package/src/scripts/generate_settings_reference.ts +232 -0
- package/src/scripts/git_authorization_hook.ts +75 -10
- package/src/scripts/hook_manifest.yaml +87 -27
- package/src/scripts/hooks/block_no_verify.ts +59 -2
- package/src/scripts/hooks/block_unauthorized_git.ts +199 -16
- package/src/scripts/hooks/concern_registry.ts +2 -0
- package/src/scripts/hooks/design_slop_hook.ts +13 -1
- package/src/scripts/hooks/dispatch_hook.ts +97 -2
- package/src/scripts/hooks/evidence_independence.ts +40 -6
- package/src/scripts/language_mirror_hook.ts +256 -17
- package/src/scripts/lint_abstraction_thresholds.ts +41 -8
- package/src/scripts/lint_agents_layout.ts +2 -0
- package/src/scripts/lint_hook_manifest.ts +29 -0
- package/src/scripts/memory_learn_hook.ts +109 -6
- package/src/scripts/orchestration_backfill.ts +354 -0
- package/src/scripts/pr_url_reminder_hook.ts +17 -2
- package/src/scripts/release.ts +180 -37
- package/src/scripts/schemas/review-findings.schema.json +99 -0
- package/src/scripts/schemas/rule.schema.json +5 -0
- package/src/scripts/session_canary_hook.ts +35 -3
- package/src/scripts/session_register_hook.ts +288 -0
- package/src/scripts/sessions_cli.ts +140 -0
- package/src/scripts/validate_frontmatter.ts +68 -0
- package/src/server/io/yamlIO.ts +87 -0
- package/src/shared/interactiveContext.ts +98 -0
- package/src/shared/nicknamePrefill.ts +96 -0
- package/src/shared/settingsAsks.ts +176 -0
- package/src/shared/settingsCarveOut.ts +143 -0
- package/src/shared/settingsConsent.ts +136 -0
- package/src/shared/settingsSurface.ts +7 -1
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The always-written carve-out set for the sparse settings file.
|
|
3
|
+
*
|
|
4
|
+
* `road-to-zero-ceremony-settings` Phase 3. The user's global settings file
|
|
5
|
+
* becomes a sparse record of decisions actually made, which is safe only while
|
|
6
|
+
* *key absent* resolves exactly like *key set to the template default*.
|
|
7
|
+
*
|
|
8
|
+
* An audit of every reader found that is NOT universally true. For the keys
|
|
9
|
+
* below a reader deliberately resolves an absent key to something other than
|
|
10
|
+
* the template's default, so omitting them from a fresh install's file would
|
|
11
|
+
* silently change behaviour. They are written explicitly instead, with their
|
|
12
|
+
* template value, and stamped `package-default` in the provenance sidecar so
|
|
13
|
+
* the file never claims the user decided them.
|
|
14
|
+
*
|
|
15
|
+
* This is the blocker's "carved out" branch. The alternative branch — "fixed at
|
|
16
|
+
* its reader" — was rejected for the `projection.*` family because the
|
|
17
|
+
* divergence there is the documented upgrade-safety contract
|
|
18
|
+
* (`agent-settings.template.yml`: *"a missing key also still means legacy-all,
|
|
19
|
+
* so only fresh installs get the scoped default"*). Changing those readers
|
|
20
|
+
* would flip existing 5.x installs from `legacy-all` to `scoped`, which is the
|
|
21
|
+
* silent narrowing the contract exists to prevent.
|
|
22
|
+
*
|
|
23
|
+
* Pure module — no I/O. The VALUES are not duplicated here; only the key paths
|
|
24
|
+
* and the reason. The emitter reads each value out of the template, so this
|
|
25
|
+
* list cannot drift from the defaults it is protecting.
|
|
26
|
+
*
|
|
27
|
+
* @see docs/contracts/settings-classes.md
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/** One key whose absence is not equivalent to its template default. */
|
|
31
|
+
export interface CarveOutKey {
|
|
32
|
+
/** Dotted path into the settings tree. */
|
|
33
|
+
key: string;
|
|
34
|
+
/** The reader that diverges, as `file:line`, so the claim is checkable. */
|
|
35
|
+
reader: string;
|
|
36
|
+
/** What an ABSENT key resolves to at that reader. */
|
|
37
|
+
absentResolvesTo: string;
|
|
38
|
+
/** Why it is carved out rather than fixed at the reader. */
|
|
39
|
+
reason: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const SETTINGS_CARVE_OUT: readonly CarveOutKey[] = [
|
|
43
|
+
{
|
|
44
|
+
key: 'projection.mode',
|
|
45
|
+
reader: 'src/scripts/install.ts:3409 _resolve_scoped_projection',
|
|
46
|
+
absentResolvesTo: 'legacy-all',
|
|
47
|
+
reason:
|
|
48
|
+
'The template fallback applies only when NO global settings file exists. '
|
|
49
|
+
+ 'Once a file exists, an absent key means legacy-all by documented contract, '
|
|
50
|
+
+ 'so an existing install is never silently narrowed on upgrade.',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
key: 'projection.rule_workspaces',
|
|
54
|
+
reader: 'src/install/rule_scope.ts:96 ruleScopeFromSettings',
|
|
55
|
+
absentResolvesTo: 'null — LEGACY_ALL, i.e. every rule ships including maintainer-only ones',
|
|
56
|
+
reason:
|
|
57
|
+
'Same upgrade contract as projection.mode, and the failure is louder: '
|
|
58
|
+
+ 'an absent list widens the projection instead of narrowing it.',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
key: 'subagents.auto',
|
|
62
|
+
reader: 'src/scripts/routing_doctor.ts:206',
|
|
63
|
+
absentResolvesTo: 'ask',
|
|
64
|
+
reason:
|
|
65
|
+
'The reader falls back to `ask` while the template ships `on`. Carved out '
|
|
66
|
+
+ 'rather than fixed at the reader because the doctor reports what the '
|
|
67
|
+
+ 'RESOLVED configuration is; changing its fallback would make the report '
|
|
68
|
+
+ 'disagree with what the other readers actually do.',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
key: 'discipline_profile',
|
|
72
|
+
reader: 'work_engine/_lib/agent_settings.ts:1263',
|
|
73
|
+
absentResolvesTo: 'essential, unconditionally',
|
|
74
|
+
reason:
|
|
75
|
+
'The template ships `auto`, which resolves to `off` on any measured-null model, '
|
|
76
|
+
+ 'any non-Claude host, and any host exposing no model id. Absent skips that '
|
|
77
|
+
+ 'resolution entirely and loads the essential tier everywhere.',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
key: 'chat_history.frequency',
|
|
81
|
+
reader: 'src/scripts/chat_history.ts:1140',
|
|
82
|
+
absentResolvesTo: 'per_phase',
|
|
83
|
+
reason:
|
|
84
|
+
'Canonical substitution is `per_turn`. Absent gives coarser capture than the '
|
|
85
|
+
+ 'shipped default — an audit-thinning change, which the class contract\'s own '
|
|
86
|
+
+ 'test 8 (what can the attacker HIDE) names as the severe direction.',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
key: 'profile.id',
|
|
90
|
+
reader: 'src/scripts/config/profiles.ts:221 resolve_profile',
|
|
91
|
+
absentResolvesTo:
|
|
92
|
+
'the id `developer`, but a DEGRADED profile — packs: [], personas: [], hints: []',
|
|
93
|
+
reason:
|
|
94
|
+
'Exactly the projection.mode shape: the template default is honoured only when '
|
|
95
|
+
+ 'no settings file exists. With a file present the id resolves but its profile '
|
|
96
|
+
+ 'body does not load, so the install silently loses every pack and persona.',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
key: 'quality.local_auto_run',
|
|
100
|
+
reader: 'src/scripts/lint_roadmap_ci_steps.ts:106',
|
|
101
|
+
absentResolvesTo: 'true — which DISABLES the CI-step gate',
|
|
102
|
+
reason:
|
|
103
|
+
'Inverted polarity, and the most dangerous row in the set: the template ships '
|
|
104
|
+
+ '`false`, which ARMS the gate. Omitting the key would disarm a quality gate '
|
|
105
|
+
+ 'for every fresh install while the reference page says it is on.',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
key: 'onboarding.onboarded',
|
|
109
|
+
reader: 'src/scripts/onboarding_gate_hook.ts:99',
|
|
110
|
+
absentResolvesTo: 'gate skipped, as if onboarding had already completed',
|
|
111
|
+
reason:
|
|
112
|
+
'Absent behaves like `onboarded: true`, not like the template default `false`. '
|
|
113
|
+
+ 'Omitting it would skip the onboarding gate on precisely the fresh installs '
|
|
114
|
+
+ 'the gate exists for.',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
key: 'chat_history.enabled',
|
|
118
|
+
reader: 'src/scripts/chat_history.ts:1025 _read_chat_history_enabled',
|
|
119
|
+
absentResolvesTo: 'false',
|
|
120
|
+
reason:
|
|
121
|
+
'The reader falls back to false while the template ships true. This one is '
|
|
122
|
+
+ 'privacy-shaped: fixing the reader would start recording history for every '
|
|
123
|
+
+ 'install whose file lacks the key. Writing it explicitly keeps the decision '
|
|
124
|
+
+ 'visible in the file the user can read.',
|
|
125
|
+
},
|
|
126
|
+
];
|
|
127
|
+
|
|
128
|
+
/** Just the paths — the emitter iterates these against the template. */
|
|
129
|
+
export function carveOutKeys(): readonly string[] {
|
|
130
|
+
return SETTINGS_CARVE_OUT.map((c) => c.key);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* `projection.*` is additionally stripped from the user-global layer by
|
|
135
|
+
* `load_agent_settings`'s `MERGEABLE_KEYS` whitelist, so `_globalRuleScope`
|
|
136
|
+
* (`src/server/routes/install.ts:234`) resolves LEGACY_ALL whether or not the
|
|
137
|
+
* key is written. That is a pre-existing defect, independent of sparseness —
|
|
138
|
+
* widening the whitelist requires an ADR, per its own comment — and the
|
|
139
|
+
* carve-out neither causes nor fixes it. Recorded so the next reader of this
|
|
140
|
+
* module does not mistake the carve-out for a fix.
|
|
141
|
+
*/
|
|
142
|
+
export const KNOWN_UNFIXED_BY_CARVE_OUT =
|
|
143
|
+
'src/server/routes/install.ts:234 _globalRuleScope — MERGEABLE_KEYS strips projection.*; needs an ADR.';
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Is a permissive B-class value a RECORDED CONSENT, or just a value?
|
|
3
|
+
*
|
|
4
|
+
* Phase 5 of `road-to-zero-ceremony-settings`, and the answer to that
|
|
5
|
+
* roadmap's Risk 3 — *"the provenance stamp becomes decoration; an unread stamp
|
|
6
|
+
* is cost with no return"*. Before this module the sidecar
|
|
7
|
+
* `settings/.agent-settings.provenance.json` was written by `settings:set` and
|
|
8
|
+
* read by exactly one caller, the GUI, to **display** it. Nothing decided
|
|
9
|
+
* anything on it. This is the reader that makes it load-bearing.
|
|
10
|
+
*
|
|
11
|
+
* The distinction it draws, which a bare value cannot: `true` that a human chose
|
|
12
|
+
* and `true` that the machine inferred are the same byte and are not the same
|
|
13
|
+
* permission. `auto-detected` is the provenance a machine writes about itself —
|
|
14
|
+
* a locale, an installed binary, a detected host. Letting it grant a consent
|
|
15
|
+
* would mean the agent could arrive at its own permission by observing the
|
|
16
|
+
* world, which is the confused-deputy shape in miniature.
|
|
17
|
+
*
|
|
18
|
+
* Modelled on `src/scripts/hooks/block_unauthorized_git.ts`: answer from a
|
|
19
|
+
* recorded fact rather than from the model's recollection, and treat a missing
|
|
20
|
+
* record as NOT granted rather than as probably-fine.
|
|
21
|
+
*
|
|
22
|
+
* WHAT THIS IS NOT. It is not a hook and it does not intercept anything. No
|
|
23
|
+
* B-class key currently gates an action through a guard — the two that gate
|
|
24
|
+
* behaviour at all (`personal.open_edited_files`, `memory.learn_on_session_end`)
|
|
25
|
+
* are read as values by the installer, the wizard and one session_end concern,
|
|
26
|
+
* and the *action* they govern is prose. So the enforcement gradient is honest
|
|
27
|
+
* and steep: this function is deterministic, the obligation to call it is
|
|
28
|
+
* model-carried, and on a prose-only host ask-once can degrade to ask-never.
|
|
29
|
+
*
|
|
30
|
+
* Pure — no I/O. Callers supply the value and the sidecar entry.
|
|
31
|
+
*
|
|
32
|
+
* @see src/rules/settings-ask-protocol.md
|
|
33
|
+
* @see docs/contracts/settings-classes.md
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
import { isConservativeDefault, type SettingsClass } from './settingsClasses.js';
|
|
37
|
+
|
|
38
|
+
/** The provenance vocabulary `settings:set` writes. Mirrors its own enum. */
|
|
39
|
+
export type ConsentSource = 'auto-detected' | 'jit-answer' | 'manual' | 'gui';
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The sources that can carry a human decision.
|
|
43
|
+
*
|
|
44
|
+
* `jit-answer` is a question the user answered. `gui` is a human at the settings
|
|
45
|
+
* editor. `manual` is a hand-edit or an explicit CLI write on the user's
|
|
46
|
+
* instruction. `auto-detected` is excluded on purpose — see the module header.
|
|
47
|
+
*/
|
|
48
|
+
const HUMAN_SOURCES: readonly ConsentSource[] = ['jit-answer', 'gui', 'manual'];
|
|
49
|
+
|
|
50
|
+
export type ConsentVerdict =
|
|
51
|
+
/** A human decided, and the value permits the action. */
|
|
52
|
+
| 'granted'
|
|
53
|
+
/** The value is the conservative default — absent and no are the same thing. */
|
|
54
|
+
| 'withheld-default'
|
|
55
|
+
/** Permissive, but nothing records who decided it. Fail closed. */
|
|
56
|
+
| 'withheld-unrecorded'
|
|
57
|
+
/** Permissive and recorded, but recorded as a machine inference. */
|
|
58
|
+
| 'withheld-machine-inferred'
|
|
59
|
+
/** Not a consent question at all: A needs none, C is human-only. */
|
|
60
|
+
| 'not-a-consent-key';
|
|
61
|
+
|
|
62
|
+
export interface ConsentQuery {
|
|
63
|
+
/** The key's class, from the contract — `undefined` means unclassified. */
|
|
64
|
+
cls: SettingsClass | undefined;
|
|
65
|
+
/** The effective value after normal resolution. */
|
|
66
|
+
value: unknown;
|
|
67
|
+
/**
|
|
68
|
+
* The sidecar entry for this key, or `undefined` when none exists.
|
|
69
|
+
*
|
|
70
|
+
* `undefined` covers both "the sidecar has no row" and "there is no sidecar",
|
|
71
|
+
* which are the same fact from here: nothing records a decision.
|
|
72
|
+
*/
|
|
73
|
+
source?: ConsentSource | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* `true` when the value came from a file only a human can write — a
|
|
76
|
+
* project-local `.agent-settings.yml` or a hand-edited user file.
|
|
77
|
+
*
|
|
78
|
+
* The class contract is explicit that *"the user may edit anything in their
|
|
79
|
+
* own file with an editor"*, so a hand-edit IS the consent even though it
|
|
80
|
+
* carries no stamp. Without this the check would refuse the one path the
|
|
81
|
+
* contract guarantees, which is how a fence becomes a bug.
|
|
82
|
+
*/
|
|
83
|
+
handEdited?: boolean;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The verdict for one consent-gated action.
|
|
88
|
+
*
|
|
89
|
+
* Order matters: class first (a C key never reaches a consent question at all),
|
|
90
|
+
* then the value (conservative means no, regardless of provenance), then the
|
|
91
|
+
* record.
|
|
92
|
+
*/
|
|
93
|
+
export function consentVerdict(query: ConsentQuery): ConsentVerdict {
|
|
94
|
+
if (query.cls !== 'B') {
|
|
95
|
+
return 'not-a-consent-key';
|
|
96
|
+
}
|
|
97
|
+
if (isConservativeDefault(query.value)) {
|
|
98
|
+
return 'withheld-default';
|
|
99
|
+
}
|
|
100
|
+
if (query.handEdited === true) {
|
|
101
|
+
return 'granted';
|
|
102
|
+
}
|
|
103
|
+
if (query.source === undefined) {
|
|
104
|
+
return 'withheld-unrecorded';
|
|
105
|
+
}
|
|
106
|
+
if (!HUMAN_SOURCES.includes(query.source)) {
|
|
107
|
+
return 'withheld-machine-inferred';
|
|
108
|
+
}
|
|
109
|
+
return 'granted';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** `true` only for `granted` — every other verdict withholds. */
|
|
113
|
+
export function consentGranted(query: ConsentQuery): boolean {
|
|
114
|
+
return consentVerdict(query) === 'granted';
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* One line explaining a withheld verdict, for the surface that refused.
|
|
119
|
+
*
|
|
120
|
+
* `null` for `granted`, so a caller cannot accidentally print a refusal reason
|
|
121
|
+
* on the allow path.
|
|
122
|
+
*/
|
|
123
|
+
export function withheldReason(verdict: ConsentVerdict, key: string): string | null {
|
|
124
|
+
switch (verdict) {
|
|
125
|
+
case 'granted':
|
|
126
|
+
return null;
|
|
127
|
+
case 'withheld-default':
|
|
128
|
+
return `${key} is at its conservative default — absent and no are the same answer.`;
|
|
129
|
+
case 'withheld-unrecorded':
|
|
130
|
+
return `${key} permits this, but nothing records who decided it. Ask, or set it via the GUI.`;
|
|
131
|
+
case 'withheld-machine-inferred':
|
|
132
|
+
return `${key} was auto-detected, not decided. A machine inference is not a consent.`;
|
|
133
|
+
case 'not-a-consent-key':
|
|
134
|
+
return `${key} is not a class-B consent key — this gate does not apply to it.`;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -84,7 +84,13 @@ function unwrapRef(root: JsonSchemaNode): JsonSchemaNode {
|
|
|
84
84
|
export function flattenSurface(schema: JsonSchemaNode, version: string): SettingsSurface {
|
|
85
85
|
const entries: Record<string, SurfaceEntry> = {};
|
|
86
86
|
const walk = (node: JsonSchemaNode, prefix: string): void => {
|
|
87
|
-
|
|
87
|
+
// `properties: {}` — a free-form map such as `z.object({}).passthrough()` —
|
|
88
|
+
// is a LEAF, per this function's own contract above. Recursing on the
|
|
89
|
+
// mere presence of the key walked zero children and emitted nothing, so
|
|
90
|
+
// the key vanished from the surface: `subagents.host_capabilities` was
|
|
91
|
+
// classified in the settings contract, present in the template, and
|
|
92
|
+
// absent from every snapshot and upgrade delta.
|
|
93
|
+
if (node.type === 'object' && node.properties !== undefined && Object.keys(node.properties).length > 0) {
|
|
88
94
|
for (const key of Object.keys(node.properties).sort()) {
|
|
89
95
|
const child = node.properties[key] as JsonSchemaNode;
|
|
90
96
|
walk(child, prefix === '' ? key : `${prefix}.${key}`);
|