feat(#1416): formalize Resolution convention + agent-skills value envelope (Resolution Provenance P3) (#1425)

Narrows P3 of ADR-1411 (Resolution Provenance, epic #1411) based on an
adversarial fit-analysis that showed a single Resolution<T> envelope adopted
by agent-skills, capability-state, and capability-writer fails the deletion
test: configured/reason are meaningless for capability verbs, and
capability-writer's errors[] (operation-not-applied) cannot fold into
warnings[]. The only genuinely shared seam is warnings: string[].

Changes:

- src/resolution.cts: new pure types+builder leaf — exports Resolution<T>
  {value, configured, reason, warnings}, makeResolution<T>() builder, and
  AgentSkillsValue {block, skills_count}. No other src/ imports.

- src/init.cts: cmdAgentSkills --json IR gains additive value:{block,
  skills_count} field (built via makeResolution). All existing flat fields
  (agent_type, block, skills_count, warnings, configured, reason, source,
  degraded) are retained unchanged for back-compat.

- src/capability-state.cts: doc comment on ResolveCapabilityRuntimeStateResult
  naming it the canonical read-verb envelope. No JSON change.

- src/capability-writer.cts: doc comment on SetCapabilityStateResult naming it
  the canonical mutation-verb result (warnings=advisory, errors=operation-
  not-applied). No JSON change.

- CONTEXT.md: new ### Resolution Convention glossary entry after
  ### Resolution Provenance.

- docs/adr/1411-resolution-provenance.md: P3 narrowing amendment appended.

- tests/resolution.test.cjs: 9 unit tests for makeResolution (new).
- tests/agent-skills.test.cjs: 2 P3 tests for value.block/value.skills_count
  and back-compat of all flat fields.

All 277 tests pass (5 suites). npm run lint clean. All lint checks pass.

Part of #1411

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-06-18 07:44:52 -04:00
committed by GitHub
parent 484a5b7b86
commit b0c774c2e3
11 changed files with 261 additions and 0 deletions

View File

@@ -125,6 +125,18 @@ interface ResolveCapabilityStateResult {
capabilities: CapabilityStateEntry[];
}
/**
* Canonical **read-verb envelope** for the capability-state seam (ADR-1411 P3 / #1416).
*
* This is the shape emitted by the capability-state read verb:
* `{ runtimeConfigDir, capabilities, warnings? }`
*
* The shared contract with other diagnostic shapes is `warnings: string[]`.
* Unlike `Resolution<T>` (src/resolution.cts, for config-interpreting read verbs),
* this read verb does not carry `configured`/`reason` — those fields are meaningful
* only for config-interpreting verbs such as agent-skills. Do NOT change the emitted
* JSON shape; this comment names the convention, it does not alter the contract.
*/
interface ResolveCapabilityRuntimeStateResult {
runtimeConfigDir: string;
warnings: string[];