@aiwg/cli 2026.10.11 → 2026.10.14

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.
Files changed (174) hide show
  1. package/agentic/code/providers/model-catalog.v1.json +62 -12
  2. package/agentic/code/providers/pi/aiwg-bridge.ts +44 -1
  3. package/dist/src/artifacts/binding-target-identity.js +51 -0
  4. package/dist/src/artifacts/checksum-manifest.js +12 -0
  5. package/dist/src/artifacts/index-builder.js +11 -13
  6. package/dist/src/artifacts/query-engine.js +5 -11
  7. package/dist/src/cli/handlers/doctor-help.js +32 -0
  8. package/dist/src/cli/handlers/gates.js +19 -18
  9. package/dist/src/cli/handlers/models-help.js +7 -1
  10. package/dist/src/cli/handlers/models.js +3 -3
  11. package/dist/src/cli/handlers/script-runner.js +8 -5
  12. package/dist/src/cli/handlers/sessions-intake.js +104 -0
  13. package/dist/src/cli/handlers/sessions-tail.js +172 -0
  14. package/dist/src/cli/handlers/sessions.js +90 -17
  15. package/dist/src/cli/handlers/skill-lint.js +10 -3
  16. package/dist/src/cli/handlers/steward-format.js +100 -0
  17. package/dist/src/cli/handlers/steward-models.js +167 -0
  18. package/dist/src/cli/handlers/steward.js +14 -248
  19. package/dist/src/cli/handlers/use-bundle-counts.js +87 -0
  20. package/dist/src/cli/handlers/use-skill-assets.js +207 -0
  21. package/dist/src/cli/handlers/use.js +35 -216
  22. package/dist/src/cli/handlers/utilities.js +1 -24
  23. package/dist/src/config/aiwg-config.js +7 -0
  24. package/dist/src/config/authorization-cli.js +97 -0
  25. package/dist/src/config/cli-help.js +1 -0
  26. package/dist/src/config/cli.js +10 -1
  27. package/dist/src/decision/context-pruning-common.js +41 -0
  28. package/dist/src/decision/context-pruning-evaluation.js +366 -0
  29. package/dist/src/decision/context-pruning-pilot.js +431 -0
  30. package/dist/src/decision/context-pruning-types.js +19 -0
  31. package/dist/src/decision/context-pruning.js +5 -846
  32. package/dist/src/decision/ensemble/contract.js +17 -26
  33. package/dist/src/decision/ensemble-study/artifacts.js +5 -0
  34. package/dist/src/decision/ensemble-study/score.js +4 -3
  35. package/dist/src/decision/feature-export.js +3 -9
  36. package/dist/src/decision/heldout/collector.js +2 -2
  37. package/dist/src/decision/issue-triage/runtime.js +3 -9
  38. package/dist/src/decision/qualification/gates.js +2 -1
  39. package/dist/src/decision/qualification/release.js +6 -64
  40. package/dist/src/decision/routing/report.js +2 -0
  41. package/dist/src/decision/sdlc-screening.js +3 -5
  42. package/dist/src/decision/sensitivity/comparative.js +5 -3
  43. package/dist/src/extensions/manifest.js +8 -1
  44. package/dist/src/extensions/project-local-doctor.js +78 -2
  45. package/dist/src/extensions/validation.js +10 -11
  46. package/dist/src/gates/driver.js +6 -77
  47. package/dist/src/gates/evaluate.js +6 -23
  48. package/dist/src/gates/floors.js +4 -4
  49. package/dist/src/gates/index.js +3 -3
  50. package/dist/src/gates/lattice.js +26 -0
  51. package/dist/src/gates/registry.js +2 -1
  52. package/dist/src/gates/report.js +19 -7
  53. package/dist/src/gates/upstream-ceiling.js +111 -0
  54. package/dist/src/issues/audit-cli.js +120 -0
  55. package/dist/src/issues/audit-contract.js +64 -0
  56. package/dist/src/issues/audit-local.js +82 -0
  57. package/dist/src/issues/audit.js +220 -0
  58. package/dist/src/lint/rule-activation.js +15 -1
  59. package/dist/src/mission-protocol/canonical-codecs.js +270 -0
  60. package/dist/src/mission-protocol/codecs.js +22 -550
  61. package/dist/src/mission-protocol/health-trace-codecs.js +281 -0
  62. package/dist/src/mission-protocol/health-trace-types.js +43 -0
  63. package/dist/src/mission-protocol/types.js +2 -42
  64. package/dist/src/mission-protocol/worker-contract-json.js +10 -0
  65. package/dist/src/mission-protocol/worker-review-gate.js +100 -0
  66. package/dist/src/mission-protocol/worker-review-types.js +2 -0
  67. package/dist/src/models/catalog-policy.js +280 -0
  68. package/dist/src/models/index.js +1 -1
  69. package/dist/src/models/model-catalog.v1.json +62 -12
  70. package/dist/src/models/policy-resources.js +28 -0
  71. package/dist/src/models/provider-models.js +5 -8
  72. package/dist/src/models/provider-policy.js +10 -546
  73. package/dist/src/models/resolver.js +26 -8
  74. package/dist/src/models/router.js +15 -2
  75. package/dist/src/models/tiers.js +13 -0
  76. package/dist/src/models/types.js +0 -6
  77. package/dist/src/models/worker-ceilings.js +59 -0
  78. package/dist/src/models/worker-invocation-policy.js +243 -0
  79. package/dist/src/models/worker-plan.js +16 -20
  80. package/dist/src/models/worker-review-lineage.js +55 -0
  81. package/dist/src/models/worker-selection-policy.js +1 -1
  82. package/dist/src/models/wrapper-definitions.js +14 -0
  83. package/dist/src/models/wrapper-deployment.js +48 -25
  84. package/dist/src/models/wrapper-enforcement.js +72 -0
  85. package/dist/src/models/wrapper-route.js +6 -3
  86. package/dist/src/policy/authorization.js +1 -0
  87. package/dist/src/policy/hitl-check.js +80 -0
  88. package/dist/src/policy/hitl-config.js +63 -0
  89. package/dist/src/policy/hitl-receipt.js +57 -0
  90. package/dist/src/policy/hitl-types.js +4 -0
  91. package/dist/src/policy/hitl-validation.js +39 -0
  92. package/dist/src/policy/hitl.js +117 -0
  93. package/dist/src/rules/activation.d.mts +3 -1
  94. package/dist/src/rules/activation.mjs +23 -2
  95. package/dist/src/rules/gate-coverage.js +51 -0
  96. package/dist/src/rules/gate-references.js +16 -0
  97. package/dist/src/rules/rule-frontmatter.schema.json +7 -1
  98. package/dist/src/serve/worker-command-request.js +21 -4
  99. package/dist/src/serve/worker-invocation-preparation.js +3 -1
  100. package/dist/src/serve/worker-invocation.js +21 -10
  101. package/dist/src/sessions/adapters/deepseek-harness.js +1 -0
  102. package/dist/src/sessions/adapters/grok-build-native.js +269 -0
  103. package/dist/src/sessions/adapters/grok-build.js +57 -15
  104. package/dist/src/sessions/adapters/hermes-state-db.js +252 -0
  105. package/dist/src/sessions/adapters/hermes.js +42 -3
  106. package/dist/src/sessions/adapters/warp.js +1 -1
  107. package/dist/src/sessions/batch-import.js +10 -0
  108. package/dist/src/sessions/contracts.js +1 -1
  109. package/dist/src/sessions/discovery-capability.js +38 -0
  110. package/dist/src/sessions/importer.js +8 -251
  111. package/dist/src/sessions/index.js +4 -0
  112. package/dist/src/sessions/intake-dir.js +71 -0
  113. package/dist/src/sessions/normalization.js +251 -0
  114. package/dist/src/sessions/tail.js +91 -0
  115. package/dist/src/sessions/workspace-discovery.js +83 -7
  116. package/dist/src/skills/adapters/local.js +32 -9
  117. package/dist/src/skills/agent-skill-sidecar.js +28 -0
  118. package/dist/src/skills/agent-skills.js +6 -23
  119. package/dist/src/skills/claude-surface-projection.js +25 -0
  120. package/dist/src/skills/cli-display.js +33 -0
  121. package/dist/src/skills/cli.js +2 -26
  122. package/dist/src/skills/collision-discovery.js +84 -0
  123. package/dist/src/skills/deployer.js +26 -361
  124. package/dist/src/skills/deployment-ownership.js +74 -0
  125. package/dist/src/skills/deployment-policy.js +114 -0
  126. package/dist/src/skills/deployment-projection.js +152 -0
  127. package/dist/src/skills/deployment-types.js +20 -0
  128. package/dist/src/skills/doctor.js +2 -2
  129. package/dist/src/skills/exporter.js +8 -31
  130. package/dist/src/skills/importer.js +4 -26
  131. package/dist/src/skills/provider-extensions.js +41 -0
  132. package/dist/src/skills/registry.js +22 -7
  133. package/dist/src/skills/run.js +6 -0
  134. package/dist/src/skills/types.js +0 -8
  135. package/dist/src/skills/validator-resources.js +68 -0
  136. package/dist/src/skills/validator.js +6 -55
  137. package/dist/src/smiths/context-pipeline/parallelism-section.js +7 -3
  138. package/dist/src/storage/cli-migrate-options.js +125 -0
  139. package/dist/src/storage/cli-migrate.js +111 -0
  140. package/dist/src/storage/cli.js +4 -279
  141. package/dist/src/storage/migration-adapter.js +79 -0
  142. package/dist/src/storage/migration-copy.js +108 -0
  143. package/dist/src/storage/migration-protocol.js +14 -197
  144. package/dist/src/storage/migration-records.js +186 -0
  145. package/dist/src/storage/migration-types.js +12 -0
  146. package/dist/src/tracker/forge-http.js +2 -1
  147. package/dist/src/tracker/issue-pages.js +110 -0
  148. package/package.json +3 -1
  149. package/schemas/mission-v1.schema.json +335 -0
  150. package/schemas/models/model-catalog.v1.schema.json +19 -1
  151. package/schemas/models/model-config-compatibility.v1.schema.json +3 -2
  152. package/schemas/models/model-policy.v1.schema.json +1 -1
  153. package/tools/agents/providers/antigravity.mjs +3 -5
  154. package/tools/agents/providers/base.mjs +3 -3
  155. package/tools/agents/providers/claude.mjs +3 -5
  156. package/tools/agents/providers/codex.mjs +3 -5
  157. package/tools/agents/providers/copilot.mjs +3 -5
  158. package/tools/agents/providers/cursor.mjs +3 -5
  159. package/tools/agents/providers/factory.mjs +3 -5
  160. package/tools/agents/providers/grok-build.mjs +9 -7
  161. package/tools/agents/providers/model-wrapper.mjs +86 -0
  162. package/tools/agents/providers/omp.mjs +3 -1
  163. package/tools/agents/providers/openclaw.mjs +3 -5
  164. package/tools/agents/providers/opencode.mjs +3 -5
  165. package/tools/agents/providers/provider-paths-staging.mjs +44 -0
  166. package/tools/agents/providers/rule-binding-targets.mjs +146 -0
  167. package/tools/agents/providers/rule-delivery.mjs +9 -128
  168. package/tools/agents/providers/warp.mjs +3 -5
  169. package/tools/agents/providers/windsurf.mjs +3 -5
  170. package/tools/plugin/package-plugins.mjs +2 -2
  171. package/tools/skills/codex-skill-transform.mjs +232 -0
  172. package/tools/skills/deploy-skills-codex.mjs +8 -249
  173. package/tools/warp/warp-content.mjs +548 -0
  174. package/vscode-extension/schemas/aiwg.config.v1.json +177 -0
@@ -1,3 +1,5 @@
1
+ import { evaluateUpstreamCeiling, integrityProblems } from '../../gates/upstream-ceiling.js';
2
+ import { assertDecisionCeiling, GATE_RANK, GateDecisionUpgradeError } from '../../gates/lattice.js';
1
3
  import { createHash } from 'node:crypto';
2
4
  import { existsSync, readFileSync } from 'node:fs';
3
5
  import { dirname, resolve } from 'node:path';
@@ -10,8 +12,8 @@ import { admitEntry } from '../entry.js';
10
12
  export class EnsembleContractError extends Error {
11
13
  layer;
12
14
  details;
13
- constructor(message, layer = 'semantic', details = []) {
14
- super(message);
15
+ constructor(message, layer = 'semantic', details = [], cause) {
16
+ super(message, { cause });
15
17
  this.layer = layer;
16
18
  this.details = details;
17
19
  this.name = 'EnsembleContractError';
@@ -41,7 +43,6 @@ export const ENSEMBLE_DISAGREEMENT_PRIMITIVES = {
41
43
  const UNCERTAINTY_COMBINING = new Set(['mean-probability-v1', 'jensen-shannon-v1']);
42
44
  export const REQUIRED_PAIRED_METRICS = ['quality', 'calibration', 'risk-coverage', 'abstention', 'latency', 'tokens', 'cost', 'slice'];
43
45
  const CEILING_FIELDS = ['members', 'attempts', 'deadlineMs', 'tokens', 'costMicros', 'concurrency', 'fallbackDepth'];
44
- const GATE_RANK = { PROMOTE: 0, HOLD: 1, ROLLBACK: 2 };
45
46
  let validators = null;
46
47
  function schemaValidator(kind) {
47
48
  if (!validators) {
@@ -297,26 +298,7 @@ export function validateEnsembleAggregate(value) {
297
298
  }
298
299
  /** D17 findings derived from the carried #2037/#2048 integrity fields alone. */
299
300
  export function integrityMetadataFindings(integrity, minimumPairs) {
300
- const findings = [];
301
- if (integrity.integrity_state !== 'verified')
302
- findings.push('integrity-not-verified');
303
- if (integrity.integrity_mode === 'standard')
304
- findings.push('integrity-mode-standard');
305
- if (integrity.trusted_score_source === 'local-unverified')
306
- findings.push('untrusted-score-source');
307
- if (integrity.fresh_workspace_required && !integrity.fresh_workspace_verified)
308
- findings.push('fresh-workspace-unverified');
309
- if (integrity.uncertainty === null)
310
- findings.push('uncertainty-missing');
311
- if (integrity.paired_baseline === null)
312
- findings.push('paired-baseline-missing');
313
- if (integrity.weak_signal_reason !== null)
314
- findings.push('weak-signal');
315
- if (integrity.compromise_labels.length > 0)
316
- findings.push('compromised');
317
- if (integrity.sample_n < minimumPairs)
318
- findings.push('insufficient-samples');
319
- return findings;
301
+ return integrityProblems(integrity, 'ensemble', minimumPairs);
320
302
  }
321
303
  /** The finding for one paired delta against its preregistered threshold, or null when it passes. */
322
304
  export function pairedDeltaFinding(threshold, item) {
@@ -332,9 +314,7 @@ export function pairedDeltaFinding(threshold, item) {
332
314
  }
333
315
  /** Upstream ROLLBACK or any compromise gives ROLLBACK; upstream HOLD or any finding gives HOLD. */
334
316
  export function ensembleIntegrityDecision(integrity, findingCount) {
335
- const upstream = integrity.release_gate.decision;
336
- const compromised = integrity.integrity_state === 'compromised' || integrity.compromise_labels.length > 0;
337
- return upstream === 'ROLLBACK' || compromised ? 'ROLLBACK' : upstream === 'HOLD' || findingCount > 0 ? 'HOLD' : 'PROMOTE';
317
+ return evaluateUpstreamCeiling(integrity, { policy: 'upstream', findings: findingCount }).ceiling;
338
318
  }
339
319
  /** A D17 report may keep or tighten the upstream #2037/#2048 decision, never loosen it. Every
340
320
  * finding, passed flag and the decision are recomputed from the carried integrity fields and the
@@ -346,6 +326,15 @@ export function validateEnsembleIntegrityReport(value) {
346
326
  const problems = [];
347
327
  if (report.upstreamDecision !== report.integrity.release_gate.decision)
348
328
  problems.push('upstream decision must be the eval-integrity release gate decision');
329
+ let upgrade;
330
+ try {
331
+ assertDecisionCeiling(report.decision, report.upstreamDecision, ensembleIntegrityDecision(report.integrity, report.findings.length));
332
+ }
333
+ catch (error) {
334
+ if (!(error instanceof GateDecisionUpgradeError))
335
+ throw error;
336
+ upgrade = error;
337
+ }
349
338
  if (GATE_RANK[report.decision] < GATE_RANK[report.upstreamDecision])
350
339
  problems.push(`D17 cannot upgrade ${report.upstreamDecision} to ${report.decision}`);
351
340
  if (report.decision === 'PROMOTE' && (report.findings.length > 0 || report.pairedDeltas.some(item => !item.passed)))
@@ -372,6 +361,8 @@ export function validateEnsembleIntegrityReport(value) {
372
361
  problems.push(`decision ${report.decision} does not follow from its integrity and findings (${decision})`);
373
362
  if (digest !== ensembleContractDigest(payload))
374
363
  problems.push('integrity report digest does not match its content');
364
+ if (upgrade)
365
+ throw new EnsembleContractError('ensemble integrity report rejected', 'semantic', problems, upgrade);
375
366
  semantic(problems, 'ensemble integrity report rejected');
376
367
  return report;
377
368
  }
@@ -1,3 +1,4 @@
1
+ import { assertDecisionCeiling, ceilingDecision } from '../../gates/lattice.js';
1
2
  import { existsSync, readFileSync } from 'node:fs';
2
3
  import { dirname, resolve } from 'node:path';
3
4
  import { fileURLToPath } from 'node:url';
@@ -32,6 +33,10 @@ export function validateD17Artifact(name, value) {
32
33
  admitEntry(value, name === 'report' || name === 'reportV2' ? reportLimits : limits);
33
34
  if (!validators[name]?.(value))
34
35
  throw new Error(`D17 invalid ${name} artifact`);
36
+ if (name === 'report' || name === 'reportV2') {
37
+ const report = value;
38
+ assertDecisionCeiling(report.decision, ceilingDecision('HOLD', report.integrity.release_gate.decision, report.integrity.compromise_labels.length ? 'ROLLBACK' : 'PROMOTE'));
39
+ }
35
40
  if (name === 'splits') {
36
41
  const manifest = value;
37
42
  const ids = new Set(), inputs = new Set(), families = new Map();
@@ -1,3 +1,4 @@
1
+ import { ceilingDecision } from '../../gates/lattice.js';
1
2
  import { heldoutDigest, validateHeldoutAttempt, validateHeldoutInputs } from '../heldout/contract.js';
2
3
  import { artifactPin } from '../validate.js';
3
4
  import { aggregateEnsembleResults } from '../ensemble/aggregate.js';
@@ -145,7 +146,7 @@ export async function scoreD17Study(input, prepared) {
145
146
  calibrationDiagnostics: { champion: binary('champion'), challenger: binary('challenger'), calibrated: false },
146
147
  pending: ['D09 compatible member and aggregate calibration', 'blind gold audit and delayed repeats', 'separate extra-cost tradeoff approval',
147
148
  'protected native report approval and eligibility'],
148
- decision: input.integrity.release_gate.decision === 'ROLLBACK' || input.integrity.compromise_labels.length ? 'ROLLBACK' : 'HOLD' };
149
+ decision: ceilingDecision('HOLD', input.integrity.release_gate.decision, input.integrity.compromise_labels.length ? 'ROLLBACK' : 'PROMOTE') };
149
150
  validateD17Artifact('report', report);
150
151
  return report;
151
152
  }
@@ -325,7 +326,7 @@ export async function scoreD17StagedStudy(input, prepared, context) {
325
326
  mappingDigest: heldoutDigest(verified[role].mapping), compatibility: { action: 'allow',
326
327
  state: verified[role].compatibility.state, pinId: verified[role].compatibility.pinId } });
327
328
  const approved = input.approvedCalibration;
328
- const decision = input.integrity.release_gate.decision === 'ROLLBACK' || input.integrity.compromise_labels.length ? 'ROLLBACK' : 'HOLD';
329
+ const decision = ceilingDecision('HOLD', input.integrity.release_gate.decision, input.integrity.compromise_labels.length ? 'ROLLBACK' : 'PROMOTE');
329
330
  const report = { schemaVersion: 'decision-d17-study-report/v2', scope: 'synthetic-staged-calibrated',
330
331
  calibrated: true, d09Qualified: true, calibratedGate: true,
331
332
  corpusDigest: heldoutDigest(prepared.corpus), preregistrationDigest: heldoutDigest(prepared.preregistration),
@@ -453,7 +454,7 @@ export function d17NativeIntegrity(input) {
453
454
  // The ensemble integrity contract carries only the gate decision and reasons (eval-tool thresholds are dropped).
454
455
  const gate = { decision: input.base.release_gate.decision, reasons: [...input.base.release_gate.reasons] };
455
456
  const release_gate = gate.decision === 'PROMOTE' && missing.length
456
- ? { decision: 'HOLD', reasons: [...gate.reasons, ...missing.map(reason => `promotion withheld: ${reason}`)] } : gate;
457
+ ? { decision: ceilingDecision(gate.decision, 'HOLD'), reasons: [...gate.reasons, ...missing.map(reason => `promotion withheld: ${reason}`)] } : gate;
457
458
  const { sample_n, uncertainty, integrity_mode, fresh_workspace_required, fresh_workspace_verified, integrity_state, trusted_score_source, compromise_labels, weak_signal_reason } = input.base;
458
459
  return { sample_n, uncertainty, paired_baseline: { ...input.pairedBaseline, d17TradeoffApprovalDigest: tradeoffDigest },
459
460
  integrity_mode, fresh_workspace_required, fresh_workspace_verified, integrity_state, trusted_score_source,
@@ -1,3 +1,4 @@
1
+ import { assertDecisionCeiling } from '../gates/lattice.js';
1
2
  import { createHash } from 'node:crypto';
2
3
  import { existsSync, readFileSync } from 'node:fs';
3
4
  import { dirname, resolve } from 'node:path';
@@ -942,9 +943,7 @@ function normalizeEvalIntegrity(value) {
942
943
  if (value.upstreamDisposition !== value.qualificationRelease.decision) {
943
944
  throw new DecisionFeatureExportError('Feature export integrity must preserve the upstream qualification release decision');
944
945
  }
945
- if (integrityRank(value.disposition) < integrityRank(value.upstreamDisposition)) {
946
- throw new DecisionFeatureExportError(`Feature export integrity cannot upgrade ${value.upstreamDisposition} to ${value.disposition}`);
947
- }
946
+ assertDecisionCeiling(value.disposition, value.upstreamDisposition);
948
947
  const { digest, ...payload } = value;
949
948
  if (digest !== digestEvalIntegrity(payload))
950
949
  throw new DecisionFeatureExportError('Feature export integrity digest does not match its content');
@@ -966,9 +965,7 @@ function validateQualificationRelease(record) {
966
965
  throw new DecisionFeatureExportError('Feature export qualification release digest does not match its content');
967
966
  }
968
967
  validateQualificationIntegrity(record.integrity);
969
- if (integrityRank(record.decision) < integrityRank(record.integrity.release_gate.decision)) {
970
- throw new DecisionFeatureExportError('Feature export qualification release cannot upgrade its integrity release gate');
971
- }
968
+ assertDecisionCeiling(record.decision, record.integrity.release_gate.decision, record.integrity.integrity_state === 'compromised' || record.integrity.compromise_labels.length ? 'ROLLBACK' : 'PROMOTE', ...record.gates.map(gate => gate.status === 'pass' ? 'PROMOTE' : 'HOLD'));
972
969
  }
973
970
  function validateQualificationIntegrity(value) {
974
971
  if (!value || !Number.isSafeInteger(value.sample_n) || value.sample_n < 0
@@ -986,9 +983,6 @@ function validateQualificationIntegrity(value) {
986
983
  function digestEvalIntegrity(value) {
987
984
  return `sha256:${createHash('sha256').update(canonicalJson(value)).digest('hex')}`;
988
985
  }
989
- function integrityRank(decision) {
990
- return { PROMOTE: 0, HOLD: 1, ROLLBACK: 2 }[decision];
991
- }
992
986
  function activeExportHold(hold, subject, nowEpochMs) {
993
987
  return hold.subject === subject && hold.expiresAt > nowEpochMs && hold.scope.includes('export');
994
988
  }
@@ -1,3 +1,4 @@
1
+ import { ceilingDecision } from '../../gates/lattice.js';
1
2
  import { createHash } from 'node:crypto';
2
3
  import { mkdir, readFile, rm } from 'node:fs/promises';
3
4
  import { join, resolve } from 'node:path';
@@ -425,7 +426,6 @@ export async function scoreHeldoutStudy(input) {
425
426
  return { schemaVersion: 'decision-heldout-score/v1', source: frozen.priorRuns.some(run => run.source === 'injected-transport') ? 'injected-transport' : frozen.source, evidenceDigest: input.trustedEvidenceDigest, integrityDigest: input.trustedIntegrityDigest,
426
427
  complete, diagnostics, approvedCalibration, calibrated: studyValidated ? true : calibrated, d09Qualified: studyValidated,
427
428
  calibratedGate: studyValidated && study?.calibratedGate === true,
428
- calibrationArtifactValidation: studyValidated ? 'performed-by-study-scorer' : 'not-performed', integrityProblems: problems, decision: input.integrity.release_gate.decision === 'ROLLBACK'
429
- || input.integrity.compromise_labels.length > 0 ? 'ROLLBACK' : 'HOLD' };
429
+ calibrationArtifactValidation: studyValidated ? 'performed-by-study-scorer' : 'not-performed', integrityProblems: problems, decision: ceilingDecision('HOLD', input.integrity.release_gate.decision, input.integrity.compromise_labels.length > 0 ? 'ROLLBACK' : 'PROMOTE') };
430
430
  }
431
431
  //# sourceMappingURL=collector.js.map
@@ -1,3 +1,4 @@
1
+ import { assertDecisionCeiling, ceilingDecision } from '../../gates/lattice.js';
1
2
  import { createHash } from 'node:crypto';
2
3
  import { existsSync, readFileSync } from 'node:fs';
3
4
  import { dirname, resolve } from 'node:path';
@@ -26,7 +27,6 @@ const SCHEMA_FILES = {
26
27
  manifest: 'DecisionIssueTriageEvaluationManifest.v1.schema.json',
27
28
  report: 'DecisionIssueTriageEvaluationReport.v1.schema.json',
28
29
  };
29
- const GATE_RANK = { PROMOTE: 0, HOLD: 1, ROLLBACK: 2 };
30
30
  const FINAL_FIELDS = ['finalLabels', 'finalDuplicateOf', 'resolution', 'closedAt'];
31
31
  const RESPONSE_FIELDS = ['issueId', 'issueType', 'area', 'urgency', 'completeness', 'clarificationNeed', 'duplicate',
32
32
  'uncertaintyProfile', 'accepted', 'actualModel', 'requestedModel', 'latencyMs', 'usage', 'usageReceipts', 'calls', 'retries', 'fallbacks',
@@ -156,9 +156,7 @@ function checkIssueTriageEvaluationReportShape(value) {
156
156
  checkSchema('report', value);
157
157
  const report = value;
158
158
  const problems = [];
159
- if (GATE_RANK[report.decision] < GATE_RANK[report.integrity.upstreamDecision]) {
160
- problems.push(`issue triage report cannot upgrade ${report.integrity.upstreamDecision} to ${report.decision}`);
161
- }
159
+ assertDecisionCeiling(report.decision, report.integrity.upstreamDecision, gateDecision(report.integrity.upstreamDecision, report.integrity.findings));
162
160
  if (report.decision === 'PROMOTE' && report.integrity.findings.length > 0)
163
161
  problems.push('PROMOTE requires no findings');
164
162
  if (report.decision === 'PROMOTE' && report.baselineComparison.qualityNonInferiority?.decision !== 'non-inferior') {
@@ -603,11 +601,7 @@ function correct(sample, which) {
603
601
  && observed.duplicate.issueId === sample.label.duplicateOf;
604
602
  }
605
603
  function gateDecision(upstream, findings) {
606
- if (upstream === 'ROLLBACK')
607
- return 'ROLLBACK';
608
- if (upstream === 'HOLD' || findings.length > 0)
609
- return 'HOLD';
610
- return 'PROMOTE';
604
+ return ceilingDecision(upstream, findings.length > 0 ? 'HOLD' : 'PROMOTE');
611
605
  }
612
606
  /** Supported interval level in bps, or null. The paired helpers accept integer levels strictly in (5000, 9999). */
613
607
  function levelInBps(confidenceInterval) {
@@ -1,3 +1,4 @@
1
+ import { ceilingDecision } from '../../gates/lattice.js';
1
2
  import { expectedQualificationCaseIds, validateCaseInventory } from './manifest.js';
2
3
  import { deriveGateEvidence, DERIVED_GATE_EVIDENCE } from './gate-evidence.js';
3
4
  // Negative evidence always overrides a positive suite result. A release reviewer
@@ -76,7 +77,7 @@ export function evaluateQualification(manifest, definitions = DECISION_RELEASE_G
76
77
  schemaVersion: 'decision-qualification-report/v1',
77
78
  runId: manifest.runId,
78
79
  generatedAt: manifest.generatedAt,
79
- decision: mandatoryFailed ? 'HOLD' : 'PROMOTE',
80
+ decision: ceilingDecision('PROMOTE', mandatoryFailed ? 'HOLD' : 'PROMOTE'),
80
81
  gates,
81
82
  };
82
83
  }
@@ -1,58 +1,7 @@
1
+ import { ceilingDecision } from '../../gates/lattice.js';
1
2
  import { canonicalSha256, matchEvidenceDigest } from '../../gates/stats/index.js';
2
- /**
3
- * #2037/#2048 integrity modes whose verified state has a trusted score source.
4
- * Mirrors tools/eval buildIntegrityMetadata: each strict mode maps to exactly one source.
5
- */
6
- export const VERIFIED_QUALIFICATION_INTEGRITY_SOURCES = Object.freeze({
7
- fresh: 'fresh-workspace',
8
- locked: 'locked-artifact-snapshot',
9
- 'full-locked': 'full-locked-workspace',
10
- });
11
- /**
12
- * Allowlist check for promotable integrity metadata. Any malformed, unknown or
13
- * unverified mode/state/score-source is a problem; an empty result is the only
14
- * state that may PROMOTE. Callers still honour upstream HOLD/ROLLBACK separately.
15
- */
16
- export function qualificationIntegrityAllowlistProblems(integrity) {
17
- const value = integrity;
18
- if (!value || typeof value !== 'object' || Array.isArray(value)
19
- || !Number.isSafeInteger(value.sample_n) || value.sample_n < 0
20
- || typeof value.integrity_mode !== 'string' || typeof value.integrity_state !== 'string'
21
- || typeof value.trusted_score_source !== 'string'
22
- || typeof value.fresh_workspace_required !== 'boolean' || typeof value.fresh_workspace_verified !== 'boolean'
23
- || !Array.isArray(value.compromise_labels) || value.compromise_labels.some(label => typeof label !== 'string')
24
- || !(value.weak_signal_reason === null || typeof value.weak_signal_reason === 'string')
25
- || !('uncertainty' in value) || !('paired_baseline' in value)
26
- || !value.release_gate || typeof value.release_gate !== 'object'
27
- || !['PROMOTE', 'HOLD', 'ROLLBACK'].includes(value.release_gate.decision)
28
- || !Array.isArray(value.release_gate.reasons)) {
29
- return ['integrity-invalid'];
30
- }
31
- const problems = [];
32
- const expectedSource = Object.hasOwn(VERIFIED_QUALIFICATION_INTEGRITY_SOURCES, value.integrity_mode)
33
- ? VERIFIED_QUALIFICATION_INTEGRITY_SOURCES[value.integrity_mode] : undefined;
34
- if (value.integrity_state !== 'verified')
35
- problems.push('integrity-not-verified');
36
- if (expectedSource === undefined)
37
- problems.push('integrity-mode-not-allowlisted');
38
- else if (value.trusted_score_source !== expectedSource)
39
- problems.push('untrusted-score-source');
40
- if (value.fresh_workspace_required && !value.fresh_workspace_verified)
41
- problems.push('fresh-workspace-unverified');
42
- if (value.uncertainty === null || value.uncertainty === undefined)
43
- problems.push('uncertainty-missing');
44
- if (value.paired_baseline === null || value.paired_baseline === undefined)
45
- problems.push('paired-baseline-missing');
46
- if (value.weak_signal_reason !== null)
47
- problems.push('weak-signal');
48
- if (value.compromise_labels.length > 0)
49
- problems.push('compromised');
50
- if (value.sample_n <= 0)
51
- problems.push('insufficient-samples');
52
- if (value.release_gate.decision !== 'PROMOTE')
53
- problems.push(`upstream-integrity-${value.release_gate.decision.toLowerCase()}`);
54
- return problems;
55
- }
3
+ export { VERIFIED_QUALIFICATION_INTEGRITY_SOURCES, qualificationIntegrityAllowlistProblems, } from '../../gates/upstream-ceiling.js';
4
+ import { evaluateUpstreamCeiling } from '../../gates/upstream-ceiling.js';
56
5
  /** D30 compile/prefix cache, D03 receipt replay and D15 result cache evidence, each a verified evidence manifest. */
57
6
  export const QUALIFICATION_CACHE_LAYERS = ['compilePrefixCache', 'receiptReplay', 'resultCache'];
58
7
  const REQUIRED_PINS = [
@@ -110,15 +59,10 @@ export function buildQualificationReleaseRecord(executed, input) {
110
59
  const suites = manifest.evidence.map(item => ({
111
60
  caseId: item.caseId, outcome: item.outcome, evidenceHash: item.digest, verified: verified.get(item.caseId) === true,
112
61
  })).sort((a, b) => a.caseId.localeCompare(b.caseId));
113
- const releaseDecision = input.integrity.release_gate.decision;
62
+ const integrityGate = evaluateUpstreamCeiling(input.integrity, { policy: 'qualification-release' });
114
63
  const withinBudgets = Object.entries(input.budgets).length > 0
115
64
  && Object.keys(input.actuals).length === Object.keys(input.budgets).length
116
65
  && Object.entries(input.budgets).every(([name, limit]) => input.actuals[name] !== undefined && input.actuals[name] <= limit);
117
- const integrityVerified = input.integrity.integrity_state === 'verified'
118
- && input.integrity.integrity_mode !== 'standard'
119
- && input.integrity.trusted_score_source !== 'local-unverified'
120
- && input.integrity.compromise_labels.length === 0
121
- && input.integrity.sample_n > 0 && input.integrity.uncertainty !== null;
122
66
  const benchmark = input.benchmark;
123
67
  const benchmarkVerified = benchmark !== undefined && benchmark.decision === 'pass'
124
68
  && /^sha256:[0-9a-f]{64}$/.test(benchmark.planDigest)
@@ -129,13 +73,11 @@ export function buildQualificationReleaseRecord(executed, input) {
129
73
  const snapshotVerified = snapshot !== undefined && /^sha256:[0-9a-f]{64}$/.test(snapshot.digest)
130
74
  && Number.isSafeInteger(snapshot.artifactCount) && snapshot.artifactCount > 0;
131
75
  const metricsRecorded = input.metrics !== undefined && input.metrics.overall.sampleN > 0;
132
- const complete = withinBudgets && integrityVerified && benchmarkVerified && snapshotVerified && metricsRecorded && !manifest.dirty && input.reviewer !== null && input.reviewer.trim().length > 0
76
+ const complete = withinBudgets && benchmarkVerified && snapshotVerified && metricsRecorded && !manifest.dirty && input.reviewer !== null && input.reviewer.trim().length > 0
133
77
  && suites.length === manifest.cases.length && suites.every(item => item.outcome === 'pass' && item.verified)
134
78
  && report.gates.length === 7 && report.gates.every(gate => gate.status === 'pass')
135
79
  && report.decision === 'PROMOTE';
136
- const decision = releaseDecision === 'ROLLBACK'
137
- || report.decision === 'ROLLBACK' || input.integrity.integrity_state === 'compromised' || input.integrity.compromise_labels.length > 0 ? 'ROLLBACK'
138
- : complete && releaseDecision === 'PROMOTE' ? 'PROMOTE' : 'HOLD';
80
+ const decision = ceilingDecision(integrityGate.ceiling, report.decision, complete ? 'PROMOTE' : 'HOLD');
139
81
  const fields = {
140
82
  schemaVersion: 'decision-qualification-release/v2',
141
83
  runId: manifest.runId, sourceCommit: manifest.sourceCommit, dirty: manifest.dirty,
@@ -1,3 +1,4 @@
1
+ import { assertDecisionCeiling } from '../../gates/lattice.js';
1
2
  import { canonicalJson } from '../../security/artifact-trust.js';
2
3
  import { ensembleIntegrityDecision, integrityMetadataFindings } from '../ensemble/contract.js';
3
4
  import { pairedBinaryDifferenceInterval, pairedNonInferiority } from '../qualification/quality.js';
@@ -20,6 +21,7 @@ export function buildRoutingShadowReport(input) {
20
21
  export function validateRoutingShadowReport(value, trustedPreregistrationDigest) {
21
22
  checkRoutingSchema('shadowReport', value);
22
23
  const report = value;
24
+ assertDecisionCeiling(report.decision, ensembleIntegrityDecision(report.integrity, report.reasons.length));
23
25
  const rebuilt = computeRoutingShadowReport({
24
26
  id: report.id, preregistration: report.preregistration, trustedPreregistrationDigest,
25
27
  holdoutAccessedAt: report.holdoutAccessedAt, evaluatedAt: report.evaluatedAt,
@@ -1,3 +1,4 @@
1
+ import { ceilingDecision } from '../gates/lattice.js';
1
2
  import { createHash } from 'node:crypto';
2
3
  import { DECISION_API_VERSION, DECISION_API_VERSION_STRUCTURED, } from './types.js';
3
4
  import { reviewDigest } from './review/validate.js';
@@ -1135,11 +1136,8 @@ export function buildSdlcScreeningReleaseReport(input) {
1135
1136
  const preregistered = evaluateSdlcScreeningPreregistration(input.preregistration, input.trustedPreregistrationDigest, input.heldout, input.nowEpochMs);
1136
1137
  const integrityProblems = qualificationIntegrityAllowlistProblems(input.integrity);
1137
1138
  const readable = !integrityProblems.includes('integrity-invalid');
1138
- const compromised = readable && (input.integrity.release_gate.decision === 'ROLLBACK'
1139
- || input.integrity.integrity_state === 'compromised' || input.integrity.compromise_labels.length > 0);
1140
- const decision = compromised ? 'ROLLBACK'
1141
- : readable && integrityProblems.length === 0 && preregistered.decision === 'pass'
1142
- && input.integrity.release_gate.decision === 'PROMOTE' ? 'PROMOTE' : 'HOLD';
1139
+ const compromised = readable && (input.integrity.integrity_state === 'compromised' || input.integrity.compromise_labels.length > 0);
1140
+ const decision = ceilingDecision(readable ? input.integrity.release_gate.decision : 'HOLD', compromised ? 'ROLLBACK' : 'PROMOTE', integrityProblems.length === 0 && preregistered.decision === 'pass' ? 'PROMOTE' : 'HOLD');
1143
1141
  const unsigned = {
1144
1142
  schemaVersion: input.preregistration.schemaVersion === SDLC_SCREENING_PREREGISTRATION_VERSION_V2
1145
1143
  ? SDLC_SCREENING_RELEASE_VERSION_V2 : SDLC_SCREENING_RELEASE_VERSION,
@@ -1,3 +1,4 @@
1
+ import { assertDecisionCeiling, ceilingDecision } from '../../gates/lattice.js';
1
2
  import { pairedBinaryDifferenceInterval, wilsonScoreInterval } from '../qualification/quality.js';
2
3
  import { qualificationIntegrityAllowlistProblems } from '../qualification/release.js';
3
4
  import { checkSensitivitySchema, sensitivityDigest, validateSensitivityReport } from './contract.js';
@@ -128,9 +129,8 @@ export function buildComparativeReplayReport(input) {
128
129
  throw new Error('operator review ingestion is not implemented');
129
130
  findings.add('reviewer-audit-pending');
130
131
  const upstreamDecision = input.integrity.release_gate.decision;
131
- const decision = upstreamDecision === 'ROLLBACK' || input.integrity.integrity_state === 'compromised'
132
- || input.integrity.compromise_labels.length > 0 ? 'ROLLBACK'
133
- : upstreamDecision === 'HOLD' || findings.size > 0 ? 'HOLD' : 'PROMOTE';
132
+ const decision = ceilingDecision(upstreamDecision, input.integrity.integrity_state === 'compromised'
133
+ || input.integrity.compromise_labels.length > 0 ? 'ROLLBACK' : 'PROMOTE', findings.size > 0 ? 'HOLD' : 'PROMOTE');
134
134
  const payload = {
135
135
  schemaVersion: 'decision-comparative-replay-report/v1', mode: 'shadow',
136
136
  semantics: 'associative-sensitivity-not-causal', actionAuthorization: 'not-authorized',
@@ -147,7 +147,9 @@ export function buildComparativeReplayReport(input) {
147
147
  }
148
148
  export function validateComparativeReplayReport(report, input) {
149
149
  checkSensitivitySchema('comparativeReport', report);
150
+ assertDecisionCeiling(report.decision, report.upstreamDecision, input.integrity.release_gate.decision);
150
151
  const expected = buildComparativeReplayReport(input);
152
+ assertDecisionCeiling(report.decision, expected.decision);
151
153
  if (sensitivityDigest(report) !== sensitivityDigest(expected))
152
154
  throw new Error('comparative replay report differs from bound inputs');
153
155
  }
@@ -272,12 +272,19 @@ export function zodErrorToValidationErrors(err, manifestPath, input) {
272
272
  && issue.path.length === 3 && issue.path[0] === 'providerConfig'
273
273
  && issue.path[1] === 'capabilities'
274
274
  && ['nativeFeatures', 'emulation'].includes(String(issue.path[2]))) {
275
- return issue.keys.map(key => ({ ...issue, path: [...issue.path, key] }));
275
+ return issue.keys.map(key => ({ ...issue, path: [...issue.path, key], keys: [key] }));
276
276
  }
277
277
  return [issue];
278
278
  });
279
279
  return issues.map((issue) => {
280
280
  let actual = 'invalid';
281
+ if (issue.code === 'unrecognized_keys') {
282
+ // Name each rejected key so doctor/use output identifies the culprit
283
+ // (#3724: a typo'd or unknown platform key must not vanish into
284
+ // a bare "invalid").
285
+ const keys = issue.keys.map((key) => `"${String(key)}"`).join(', ');
286
+ actual = `unknown key(s): ${keys}`;
287
+ }
281
288
  if (issue.code === 'invalid_type' && hasInput) {
282
289
  let value = input;
283
290
  for (const segment of issue.path) {
@@ -13,7 +13,9 @@
13
13
  * @implements #1037
14
14
  */
15
15
  import { join } from 'path';
16
+ import { readFile, readdir } from 'fs/promises';
16
17
  import { discoverProjectLocalBundles } from './project-local-discovery.js';
18
+ import { parseRuleFrontmatter, formatRuleFrontmatterError } from '../rules/activation.mjs';
17
19
  import { buildUpstreamRegistry } from './upstream-registry.js';
18
20
  import { resolveShadows } from './shadow-resolver.js';
19
21
  import { checkBundleManifestIgnored } from './project-local-gitignore.js';
@@ -48,6 +50,56 @@ const TYPE_DIR = {
48
50
  plugin: 'plugins',
49
51
  provider: 'providers',
50
52
  };
53
+ /**
54
+ * Rule files `aiwg use` validates at deploy time via the shared frontmatter
55
+ * contract (`parseRuleFrontmatter` in `src/rules/activation.mjs`, #3728).
56
+ * Mirrors deploy's selection for a bundle source root: top-level `rules/`
57
+ * markdown (minus deploy's excluded/generated names) plus every
58
+ * `BEHAVIOR.md` under `behaviors/`.
59
+ */
60
+ const RULE_MD_EXCLUDED = new Set([
61
+ 'README.md', 'manifest.md', 'agent-template.md', 'openai-compat.md',
62
+ 'factory-compat.md', 'windsurf-compat.md', 'DEVELOPMENT_GUIDE.md',
63
+ ]);
64
+ async function collectBundleRuleFiles(artifactPath) {
65
+ const files = [];
66
+ try {
67
+ const entries = await readdir(join(artifactPath, 'rules'), { withFileTypes: true });
68
+ for (const entry of entries) {
69
+ if (!entry.isFile() || !entry.name.toLowerCase().endsWith('.md'))
70
+ continue;
71
+ if (RULE_MD_EXCLUDED.has(entry.name))
72
+ continue;
73
+ const lower = entry.name.toLowerCase();
74
+ if (lower.endsWith('.soul.md') || lower.endsWith('.core.md'))
75
+ continue;
76
+ if (/^(RULES-INDEX|RULES-ONDEMAND)\.(md|mdc)$/.test(entry.name))
77
+ continue;
78
+ files.push(join(artifactPath, 'rules', entry.name));
79
+ }
80
+ }
81
+ catch {
82
+ // Absent rules dir — nothing to validate.
83
+ }
84
+ const walkBehaviors = async (dir) => {
85
+ let entries;
86
+ try {
87
+ entries = await readdir(dir, { withFileTypes: true });
88
+ }
89
+ catch {
90
+ return;
91
+ }
92
+ for (const entry of entries) {
93
+ const full = join(dir, entry.name);
94
+ if (entry.isDirectory())
95
+ await walkBehaviors(full);
96
+ else if (entry.isFile() && entry.name === 'BEHAVIOR.md')
97
+ files.push(full);
98
+ }
99
+ };
100
+ await walkBehaviors(join(artifactPath, 'behaviors'));
101
+ return files;
102
+ }
51
103
  export async function buildProjectLocalDoctorSection(opts) {
52
104
  const { projectDir, frameworkRoot, config, quiet = false } = opts;
53
105
  const discovery = await discoverProjectLocalBundles(projectDir);
@@ -87,8 +139,27 @@ export async function buildProjectLocalDoctorSection(opts) {
87
139
  lines.push('');
88
140
  }
89
141
  }
142
+ // Rule frontmatter validation (#3728): the same validator `aiwg use`
143
+ // applies at deploy time, so a bundle that would fail deployment is
144
+ // flagged here instead of passing with a clean bill of health.
145
+ const ruleErrors = [];
146
+ for (const bundle of discovery.bundles) {
147
+ for (const file of await collectBundleRuleFiles(bundle.artifactPath)) {
148
+ let content;
149
+ try {
150
+ content = await readFile(file, 'utf-8');
151
+ }
152
+ catch {
153
+ continue;
154
+ }
155
+ const parsed = parseRuleFrontmatter(content);
156
+ if (!parsed.valid) {
157
+ ruleErrors.push(formatRuleFrontmatterError(projectRelativePathIfInside(projectDir, file) ?? file, parsed.data, parsed.diagnostics));
158
+ }
159
+ }
160
+ }
90
161
  // Validation
91
- const validationErrors = discovery.errors.length + quickrefErrors.length;
162
+ const validationErrors = discovery.errors.length + quickrefErrors.length + ruleErrors.length;
92
163
  if (validationErrors === 0) {
93
164
  if (!quiet)
94
165
  lines.push(` Validation: ✓ all manifests${quickrefAudit.exists ? ' and project quickref source' : ''} valid`);
@@ -98,7 +169,12 @@ export async function buildProjectLocalDoctorSection(opts) {
98
169
  for (const e of discovery.errors.slice(0, 10)) {
99
170
  lines.push(` ✗ ${e.path}: ${e.field} — ${e.actual}`);
100
171
  }
101
- for (const error of quickrefErrors.slice(0, Math.max(0, 10 - discovery.errors.length))) {
172
+ const quickrefShown = quickrefErrors.slice(0, Math.max(0, 10 - discovery.errors.length));
173
+ for (const error of quickrefShown) {
174
+ lines.push(` ✗ ${error}`);
175
+ }
176
+ const ruleShown = ruleErrors.slice(0, Math.max(0, 10 - discovery.errors.length - quickrefShown.length));
177
+ for (const error of ruleShown) {
102
178
  lines.push(` ✗ ${error}`);
103
179
  }
104
180
  if (validationErrors > 10) {
@@ -11,6 +11,7 @@
11
11
  */
12
12
  import { z } from 'zod';
13
13
  import { integer, dateTime, url, number } from '../schema/zod-validation.mjs';
14
+ import { PROVIDER_IDS } from '../providers/provider-definitions.js';
14
15
  // ============================================
15
16
  // Core Enums & Primitives
16
17
  // ============================================
@@ -68,17 +69,15 @@ export const HookEventSchema = z.enum([
68
69
  // ============================================
69
70
  /**
70
71
  * Platform compatibility matrix
71
- */
72
- export const PlatformCompatibilitySchema = z.object({
73
- claude: PlatformSupportSchema.optional(),
74
- factory: PlatformSupportSchema.optional(),
75
- cursor: PlatformSupportSchema.optional(),
76
- copilot: PlatformSupportSchema.optional(),
77
- windsurf: PlatformSupportSchema.optional(),
78
- codex: PlatformSupportSchema.optional(),
79
- opencode: PlatformSupportSchema.optional(),
80
- generic: PlatformSupportSchema.optional(),
81
- }).refine((data) => Object.values(data).some((val) => val !== undefined), { error: 'At least one platform must be specified' });
72
+ *
73
+ * Keys are derived from the provider registry (`PROVIDER_IDS` in
74
+ * `src/providers/provider-definitions.ts`), the single source of truth for
75
+ * provider ids — so every registered provider (pi, hermes, …) is accepted.
76
+ * Strict: an unknown platform key is a validation error, never silently
77
+ * stripped (#3724).
78
+ */
79
+ const platformCompatibilityShape = Object.fromEntries(PROVIDER_IDS.map((id) => [id, PlatformSupportSchema.optional()]));
80
+ export const PlatformCompatibilitySchema = z.strictObject(platformCompatibilityShape).refine((data) => Object.values(data).some((val) => val !== undefined), { error: 'At least one platform must be specified' });
82
81
  /**
83
82
  * Deployment configuration
84
83
  */