@nimiplatform/nimi-coding 0.2.8 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/CHANGELOG.md +10 -90
  2. package/CONTRIBUTING.md +5 -34
  3. package/README.md +47 -350
  4. package/README.zh-CN.md +33 -287
  5. package/cli/commands/start.mjs +48 -688
  6. package/cli/commands/validate-spec-audit.mjs +1 -5
  7. package/cli/commands/validate-spec-governance.mjs +20 -0
  8. package/cli/constants.mjs +9 -417
  9. package/cli/help.mjs +28 -145
  10. package/cli/index.mjs +5 -33
  11. package/cli/lib/blueprint-audit.mjs +5 -12
  12. package/cli/lib/bootstrap.mjs +0 -9
  13. package/cli/lib/contracts.mjs +0 -163
  14. package/cli/lib/doctor.mjs +155 -10
  15. package/cli/lib/entrypoints.mjs +63 -167
  16. package/cli/lib/internal/contracts-loaders.mjs +0 -85
  17. package/cli/lib/internal/contracts-parse.mjs +84 -520
  18. package/cli/lib/internal/governance/ai/check-agents-freshness.mjs +13 -8
  19. package/cli/lib/internal/surface-taxonomy-validators.mjs +316 -66
  20. package/cli/lib/internal/validators-shared.mjs +0 -16
  21. package/cli/lib/internal/validators-spec-helpers.mjs +7 -140
  22. package/cli/lib/internal/validators-spec.mjs +103 -342
  23. package/cli/lib/shared.mjs +1 -42
  24. package/cli/lib/validators.mjs +0 -48
  25. package/cli/seeds/seed-policy.yaml +0 -3
  26. package/config/bootstrap.yaml +4 -4
  27. package/config/spec-generation-inputs.yaml +6 -12
  28. package/contracts/domain-admission.schema.yaml +3 -3
  29. package/contracts/migration-inventory.schema.yaml +12 -75
  30. package/contracts/negative-fixtures.yaml +19 -99
  31. package/contracts/placement-contract.schema.yaml +49 -78
  32. package/contracts/projection-edge.schema.yaml +37 -121
  33. package/contracts/shared-enums.yaml +4 -8
  34. package/contracts/spec-generation-inputs.schema.yaml +15 -112
  35. package/contracts/spec-layout.schema.yaml +32 -0
  36. package/contracts/surface-taxonomy.schema.yaml +43 -94
  37. package/contracts/table-family.schema.yaml +1 -1
  38. package/contracts/tracked-output-admission.schema.yaml +13 -66
  39. package/methodology/core.yaml +33 -25
  40. package/methodology/four-closure-policy.yaml +18 -26
  41. package/methodology/role-separation-policy.yaml +21 -27
  42. package/methodology/spec-reconstruction.yaml +17 -34
  43. package/package.json +2 -4
  44. package/spec/_meta/spec-tree-model.yaml +5 -101
  45. package/spec/product-scope.yaml +25 -57
  46. package/adapters/README.md +0 -25
  47. package/adapters/claude/README.md +0 -89
  48. package/adapters/claude/profile.yaml +0 -70
  49. package/adapters/codex/README.md +0 -53
  50. package/adapters/codex/profile.yaml +0 -78
  51. package/adapters/oh-my-codex/README.md +0 -184
  52. package/adapters/oh-my-codex/profile.yaml +0 -46
  53. package/cli/commands/admit-high-risk-decision.mjs +0 -108
  54. package/cli/commands/audit-sweep.mjs +0 -364
  55. package/cli/commands/closeout.mjs +0 -186
  56. package/cli/commands/decide-high-risk-execution.mjs +0 -124
  57. package/cli/commands/handoff.mjs +0 -123
  58. package/cli/commands/ingest-high-risk-execution.mjs +0 -95
  59. package/cli/commands/review-high-risk-execution.mjs +0 -95
  60. package/cli/commands/sweep-design.mjs +0 -295
  61. package/cli/commands/sweep.mjs +0 -22
  62. package/cli/commands/topic-formatters.mjs +0 -382
  63. package/cli/commands/topic-goal.mjs +0 -33
  64. package/cli/commands/topic-options-shared.mjs +0 -27
  65. package/cli/commands/topic-options-workflow.mjs +0 -767
  66. package/cli/commands/topic-options.mjs +0 -626
  67. package/cli/commands/topic-runner.mjs +0 -169
  68. package/cli/commands/topic.mjs +0 -795
  69. package/cli/commands/validate-acceptance.mjs +0 -5
  70. package/cli/commands/validate-execution-packet.mjs +0 -5
  71. package/cli/commands/validate-orchestration-state.mjs +0 -5
  72. package/cli/commands/validate-prompt.mjs +0 -5
  73. package/cli/commands/validate-worker-output.mjs +0 -5
  74. package/cli/lib/adapter-profiles.mjs +0 -403
  75. package/cli/lib/audit-execution.mjs +0 -52
  76. package/cli/lib/audit-sweep-runtime/admissions.mjs +0 -508
  77. package/cli/lib/audit-sweep-runtime/audit-validity.mjs +0 -356
  78. package/cli/lib/audit-sweep-runtime/chunks.mjs +0 -697
  79. package/cli/lib/audit-sweep-runtime/claude-auditor.mjs +0 -658
  80. package/cli/lib/audit-sweep-runtime/closeout.mjs +0 -144
  81. package/cli/lib/audit-sweep-runtime/codex-auditor-evidence.mjs +0 -654
  82. package/cli/lib/audit-sweep-runtime/codex-auditor.mjs +0 -527
  83. package/cli/lib/audit-sweep-runtime/common.mjs +0 -341
  84. package/cli/lib/audit-sweep-runtime/coverage-quality.mjs +0 -172
  85. package/cli/lib/audit-sweep-runtime/evidence-assignment.mjs +0 -155
  86. package/cli/lib/audit-sweep-runtime/format.mjs +0 -57
  87. package/cli/lib/audit-sweep-runtime/ingest.mjs +0 -486
  88. package/cli/lib/audit-sweep-runtime/inventory-spec-chunks.mjs +0 -425
  89. package/cli/lib/audit-sweep-runtime/inventory.mjs +0 -798
  90. package/cli/lib/audit-sweep-runtime/ledger.mjs +0 -315
  91. package/cli/lib/audit-sweep-runtime/p0p1-profile.mjs +0 -101
  92. package/cli/lib/audit-sweep-runtime/remediation.mjs +0 -349
  93. package/cli/lib/audit-sweep-runtime/rerun.mjs +0 -129
  94. package/cli/lib/audit-sweep-runtime/risk-budget.mjs +0 -300
  95. package/cli/lib/audit-sweep-runtime/status.mjs +0 -62
  96. package/cli/lib/audit-sweep-runtime/validators-ledger.mjs +0 -215
  97. package/cli/lib/audit-sweep-runtime/validators.mjs +0 -797
  98. package/cli/lib/audit-sweep.mjs +0 -19
  99. package/cli/lib/authority-convergence.mjs +0 -720
  100. package/cli/lib/closeout.mjs +0 -732
  101. package/cli/lib/codex-sdk-runner.mjs +0 -76
  102. package/cli/lib/external-execution.mjs +0 -101
  103. package/cli/lib/handoff.mjs +0 -812
  104. package/cli/lib/high-risk-admission.mjs +0 -512
  105. package/cli/lib/high-risk-decision.mjs +0 -353
  106. package/cli/lib/high-risk-ingest.mjs +0 -321
  107. package/cli/lib/high-risk-review.mjs +0 -267
  108. package/cli/lib/internal/contracts-parse-high-risk.mjs +0 -131
  109. package/cli/lib/internal/contracts-validators.mjs +0 -399
  110. package/cli/lib/internal/doctor-bootstrap-surface.mjs +0 -406
  111. package/cli/lib/internal/doctor-delegated-surface.mjs +0 -256
  112. package/cli/lib/internal/doctor-finalize.mjs +0 -383
  113. package/cli/lib/internal/doctor-format.mjs +0 -286
  114. package/cli/lib/internal/doctor-inspectors.mjs +0 -327
  115. package/cli/lib/internal/doctor-state.mjs +0 -205
  116. package/cli/lib/internal/validators-artifacts.mjs +0 -515
  117. package/cli/lib/sweep-design-runtime/common.mjs +0 -246
  118. package/cli/lib/sweep-design-runtime/engine.mjs +0 -733
  119. package/cli/lib/sweep-design-runtime/fix-topic.mjs +0 -414
  120. package/cli/lib/sweep-design-runtime/lifecycle.mjs +0 -54
  121. package/cli/lib/sweep-design-runtime/results.mjs +0 -324
  122. package/cli/lib/sweep-design.mjs +0 -8
  123. package/cli/lib/topic-artifacts.mjs +0 -186
  124. package/cli/lib/topic-authority-coverage.mjs +0 -73
  125. package/cli/lib/topic-closeout.mjs +0 -560
  126. package/cli/lib/topic-common.mjs +0 -404
  127. package/cli/lib/topic-decisions.mjs +0 -332
  128. package/cli/lib/topic-draft-packets.mjs +0 -167
  129. package/cli/lib/topic-execution.mjs +0 -533
  130. package/cli/lib/topic-goal.mjs +0 -440
  131. package/cli/lib/topic-ledger.mjs +0 -281
  132. package/cli/lib/topic-lifecycle-artifacts.mjs +0 -173
  133. package/cli/lib/topic-root-validation.mjs +0 -288
  134. package/cli/lib/topic-runner-commands.mjs +0 -174
  135. package/cli/lib/topic-runner-deferral.mjs +0 -532
  136. package/cli/lib/topic-runner-stale-gates.mjs +0 -114
  137. package/cli/lib/topic-runner-validation.mjs +0 -138
  138. package/cli/lib/topic-runner.mjs +0 -727
  139. package/cli/lib/topic-scaffold.mjs +0 -252
  140. package/cli/lib/topic-waves.mjs +0 -403
  141. package/cli/lib/topic.mjs +0 -81
  142. package/config/audit-execution-artifacts.yaml +0 -20
  143. package/config/external-execution-artifacts.yaml +0 -16
  144. package/config/host-adapter.yaml +0 -30
  145. package/config/host-profile.yaml +0 -29
  146. package/config/installer-evidence.yaml +0 -31
  147. package/config/skill-installer.yaml +0 -23
  148. package/config/skill-manifest.yaml +0 -48
  149. package/config/skills.yaml +0 -30
  150. package/contracts/acceptance.schema.yaml +0 -16
  151. package/contracts/admission-checklist.schema.yaml +0 -15
  152. package/contracts/audit-chunk.schema.yaml +0 -123
  153. package/contracts/audit-closeout.schema.yaml +0 -51
  154. package/contracts/audit-finding.schema.yaml +0 -61
  155. package/contracts/audit-ledger.schema.yaml +0 -138
  156. package/contracts/audit-plan.schema.yaml +0 -138
  157. package/contracts/audit-remediation-map.schema.yaml +0 -52
  158. package/contracts/audit-rerun.schema.yaml +0 -31
  159. package/contracts/audit-sweep-result.yaml +0 -53
  160. package/contracts/authority-convergence-audit.schema.yaml +0 -19
  161. package/contracts/closeout.schema.yaml +0 -25
  162. package/contracts/decision-review.schema.yaml +0 -16
  163. package/contracts/doc-spec-audit-result.yaml +0 -19
  164. package/contracts/execution-packet.schema.yaml +0 -49
  165. package/contracts/external-host-compatibility.yaml +0 -22
  166. package/contracts/forbidden-shortcuts.catalog.yaml +0 -23
  167. package/contracts/high-risk-admission.schema.yaml +0 -23
  168. package/contracts/high-risk-execution-result.yaml +0 -20
  169. package/contracts/orchestration-state.schema.yaml +0 -41
  170. package/contracts/overflow-continuation.schema.yaml +0 -12
  171. package/contracts/packet.schema.yaml +0 -30
  172. package/contracts/pending-note.schema.yaml +0 -17
  173. package/contracts/prompt.schema.yaml +0 -12
  174. package/contracts/remediation.schema.yaml +0 -16
  175. package/contracts/result.schema.yaml +0 -24
  176. package/contracts/spec-reconstruction-result.yaml +0 -41
  177. package/contracts/sweep-design-result.yaml +0 -349
  178. package/contracts/topic-goal.schema.yaml +0 -87
  179. package/contracts/topic-run-ledger.schema.yaml +0 -72
  180. package/contracts/topic-step-decision.schema.yaml +0 -45
  181. package/contracts/topic.schema.yaml +0 -65
  182. package/contracts/true-close.schema.yaml +0 -15
  183. package/contracts/wave.schema.yaml +0 -29
  184. package/contracts/worker-output.schema.yaml +0 -15
  185. package/contracts/workflow-consumer.schema.yaml +0 -110
  186. package/methodology/audit-sweep-p0p1-recall.yaml +0 -45
  187. package/methodology/authority-convergence-policy.yaml +0 -42
  188. package/methodology/overflow-continuation-policy.yaml +0 -14
  189. package/methodology/skill-exchange-projection.yaml +0 -114
  190. package/methodology/skill-handoff.yaml +0 -34
  191. package/methodology/skill-installer-result.yaml +0 -27
  192. package/methodology/skill-installer-summary-projection.yaml +0 -181
  193. package/methodology/skill-runtime.yaml +0 -23
  194. package/methodology/spec-target-truth-profile.yaml +0 -46
  195. package/methodology/topic-lifecycle-report.yaml +0 -144
  196. package/methodology/topic-lifecycle.yaml +0 -37
  197. package/methodology/topic-naming-ontology.yaml +0 -21
  198. package/methodology/topic-ontology.yaml +0 -38
  199. package/methodology/topic-validation-policy.yaml +0 -9
  200. package/methodology/wave-dag-policy.yaml +0 -14
  201. package/spec/_meta/command-gating-matrix.yaml +0 -143
  202. package/spec/_meta/generate-drift-migration-checklist.yaml +0 -137
  203. package/spec/_meta/governance-routing-cutover-checklist.yaml +0 -35
  204. package/spec/_meta/phase2-impacted-surface-matrix.yaml +0 -44
  205. package/spec/_meta/spec-authority-cutover-readiness.yaml +0 -102
  206. package/spec/bootstrap-state.yaml +0 -99
@@ -1,15 +1,11 @@
1
1
  import path from "node:path";
2
2
 
3
3
  import { validateSpecAudit, buildValidatorCliReport } from "../lib/validators.mjs";
4
- import { loadSpecGenerationInputsConfig } from "../lib/contracts.mjs";
5
4
  import { localize } from "../lib/ui.mjs";
6
5
 
7
6
  export async function runValidateSpecAudit(args) {
8
7
  const normalized = args[0] === "--" ? args.slice(1) : args;
9
- const generationInputs = await loadSpecGenerationInputsConfig(process.cwd());
10
- let targetPath = generationInputs.ok && generationInputs.mode === "class_filtered"
11
- ? ".nimi/local/state/spec-generation/spec-generation-audit.yaml"
12
- : ".nimi/spec/_meta/spec-generation-audit.yaml";
8
+ let targetPath = ".nimi/local/state/spec-generation/spec-generation-audit.yaml";
13
9
 
14
10
  if (normalized.length > 1) {
15
11
  process.stderr.write(localize(
@@ -1,4 +1,7 @@
1
+ import path from "node:path";
2
+
1
3
  import { localize } from "../lib/ui.mjs";
4
+ import { buildValidatorCliReport, validateSpecTree } from "../lib/validators.mjs";
2
5
  import { loadGovernanceConfig, requireProfile } from "../lib/internal/governance/config.mjs";
3
6
  import { runCommand } from "../lib/internal/governance/runner.mjs";
4
7
 
@@ -94,6 +97,23 @@ export async function runValidateSpecGovernance(args) {
94
97
  return 2;
95
98
  }
96
99
 
100
+ if (parsed.options.scope === "all") {
101
+ if (governance.config.specGovernance.canonicalRoot !== ".nimi/spec") {
102
+ process.stderr.write(localize(
103
+ "nimicoding validate-spec-governance refused: spec_governance.canonical_root must be .nimi/spec.\n",
104
+ "nimicoding validate-spec-governance 已拒绝:spec_governance.canonical_root 必须为 .nimi/spec。\n",
105
+ ));
106
+ return 2;
107
+ }
108
+ const canonicalRoot = path.resolve(process.cwd(), ".nimi/spec");
109
+ const treeReport = await validateSpecTree(canonicalRoot, { projectRoot: process.cwd() });
110
+ if (!treeReport.ok) {
111
+ const cliReport = buildValidatorCliReport("validate-spec-tree", canonicalRoot, treeReport);
112
+ process.stdout.write(`${JSON.stringify(cliReport, null, 2)}\n`);
113
+ return 1;
114
+ }
115
+ }
116
+
97
117
  let failed = false;
98
118
  for (const scope of scopeResolution.scopes) {
99
119
  const commands = governance.config.specGovernance.validateCommands[scope] || [];
package/cli/constants.mjs CHANGED
@@ -1,143 +1,21 @@
1
- export const VERSION = "0.2.8";
1
+ export const VERSION = "0.3.1";
2
2
  export const PACKAGE_NAME = "@nimiplatform/nimi-coding";
3
3
  export const BOOTSTRAP_CONTRACT_ID = "nimicoding.bootstrap";
4
- export const BOOTSTRAP_CONTRACT_VERSION = 1;
5
- export const HANDOFF_PAYLOAD_CONTRACT_VERSION = "nimicoding.handoff.v1";
6
- export const CLOSEOUT_PAYLOAD_CONTRACT_VERSION = "nimicoding.closeout.v1";
7
- export const HIGH_RISK_INGEST_PAYLOAD_CONTRACT_VERSION = "nimicoding.high-risk-ingest.v1";
8
- export const HIGH_RISK_REVIEW_PAYLOAD_CONTRACT_VERSION = "nimicoding.high-risk-review.v1";
9
- export const HIGH_RISK_DECISION_PAYLOAD_CONTRACT_VERSION = "nimicoding.high-risk-decision.v1";
10
- export const HIGH_RISK_ADMISSION_PAYLOAD_CONTRACT_VERSION = "nimicoding.high-risk-admission.v1";
11
- export const STANDALONE_COMPLETION_PROFILE = "boundary_complete";
12
- export const STANDALONE_COMPLETION_STATUS = {
13
- COMPLETE: "complete",
14
- DRIFTED: "drifted",
15
- INCOMPLETE: "incomplete",
16
- };
17
- export const STANDALONE_COMPLETED_SURFACES = [
18
- "bootstrap",
19
- "doctor",
20
- "handoff",
21
- "sweep_audit",
22
- "sweep_design",
23
- "validators",
24
- "topic_lifecycle_report_methodology",
25
- "closeout",
26
- "ingest",
27
- "review",
28
- "decision",
29
- "admission",
30
- "host_overlay_recognition",
31
- ];
32
- export const STANDALONE_DEFERRED_EXECUTION_SURFACES = [
33
- "packet_bound_run_kernel",
34
- "provider_backed_execution",
35
- "scheduler",
36
- "notification",
37
- "automation_backend",
38
- "multi_topic_orchestration",
39
- ];
40
- export const STANDALONE_PROMOTED_PARITY_GAP_SUMMARY = [
41
- "packet_bound_run_kernel",
42
- "provider_backed_execution",
43
- "scheduler_automation_notification",
44
- ];
4
+ export const BOOTSTRAP_CONTRACT_VERSION = 2;
45
5
 
46
- export const LOCAL_GITIGNORE_ENTRIES = [".nimi/local/", ".nimi/cache/", ".nimi/topics/"];
6
+ export const LOCAL_GITIGNORE_ENTRIES = [".nimi/local/", ".nimi/cache/"];
7
+ export const REQUIRED_LOCAL_DIRS = [".nimi/local", ".nimi/cache"];
47
8
 
48
9
  export const AGENTS_BEGIN = "<!-- nimicoding:managed:agents:start -->";
49
10
  export const AGENTS_END = "<!-- nimicoding:managed:agents:end -->";
50
11
  export const CLAUDE_BEGIN = "<!-- nimicoding:managed:claude:start -->";
51
12
  export const CLAUDE_END = "<!-- nimicoding:managed:claude:end -->";
52
13
 
53
- export const SPEC_RECONSTRUCTION_RESULT_CONTRACT_REF = ".nimi/contracts/spec-reconstruction-result.yaml";
54
- export const DOC_SPEC_AUDIT_RESULT_CONTRACT_REF = ".nimi/contracts/doc-spec-audit-result.yaml";
55
- export const AUDIT_SWEEP_RESULT_CONTRACT_REF = ".nimi/contracts/audit-sweep-result.yaml";
56
- export const SWEEP_DESIGN_RESULT_CONTRACT_REF = ".nimi/contracts/sweep-design-result.yaml";
57
- export const AUDIT_PLAN_SCHEMA_REF = ".nimi/contracts/audit-plan.schema.yaml";
58
- export const AUDIT_CHUNK_SCHEMA_REF = ".nimi/contracts/audit-chunk.schema.yaml";
59
- export const AUDIT_FINDING_SCHEMA_REF = ".nimi/contracts/audit-finding.schema.yaml";
60
- export const AUDIT_LEDGER_SCHEMA_REF = ".nimi/contracts/audit-ledger.schema.yaml";
61
- export const AUDIT_REMEDIATION_MAP_SCHEMA_REF = ".nimi/contracts/audit-remediation-map.schema.yaml";
62
- export const AUDIT_RERUN_SCHEMA_REF = ".nimi/contracts/audit-rerun.schema.yaml";
63
- export const AUDIT_CLOSEOUT_SCHEMA_REF = ".nimi/contracts/audit-closeout.schema.yaml";
64
- export const HIGH_RISK_EXECUTION_RESULT_CONTRACT_REF = ".nimi/contracts/high-risk-execution-result.yaml";
65
- export const HIGH_RISK_ADMISSION_CONTRACT_REF = ".nimi/contracts/high-risk-admission.schema.yaml";
66
- export const EXTERNAL_HOST_COMPATIBILITY_CONTRACT_REF = ".nimi/contracts/external-host-compatibility.yaml";
67
- export const HOST_ADAPTER_CONFIG_REF = ".nimi/config/host-adapter.yaml";
68
- export const EXTERNAL_EXECUTION_ARTIFACTS_CONFIG_REF = ".nimi/config/external-execution-artifacts.yaml";
69
- export const AUDIT_EXECUTION_ARTIFACTS_CONFIG_REF = ".nimi/config/audit-execution-artifacts.yaml";
70
- export const EXECUTION_PACKET_SCHEMA_REF = ".nimi/contracts/execution-packet.schema.yaml";
71
- export const ORCHESTRATION_STATE_SCHEMA_REF = ".nimi/contracts/orchestration-state.schema.yaml";
72
- export const PROMPT_SCHEMA_REF = ".nimi/contracts/prompt.schema.yaml";
73
- export const WORKER_OUTPUT_SCHEMA_REF = ".nimi/contracts/worker-output.schema.yaml";
74
- export const ACCEPTANCE_SCHEMA_REF = ".nimi/contracts/acceptance.schema.yaml";
75
- export const ADAPTER_PACKAGE_PROFILE_REFS = {
76
- codex: "adapters/codex/profile.yaml",
77
- oh_my_codex: "adapters/oh-my-codex/profile.yaml",
78
- claude: "adapters/claude/profile.yaml",
79
- };
80
- export const EXTERNAL_HOST_COMPATIBILITY_REQUIRED_BEHAVIOR = [
81
- "consume_handoff_json_as_authoritative_contract",
82
- "treat_handoff_prompt_as_human_projection_only",
83
- "read_project_local_nimi_truth",
84
- "route_declared_external_skills",
85
- "fail_closed_on_missing_authority",
86
- ];
87
- export const EXTERNAL_HOST_COMPATIBILITY_SUPPORTED_POSTURE = [
88
- "host_agnostic_external_host",
89
- ];
90
- export const EXTERNAL_HOST_COMPATIBILITY_FORBIDDEN_BEHAVIOR = [
91
- "assume_packaged_run_kernel",
92
- "assume_provider_or_scheduler_ownership",
93
- "promote_runtime_state_to_semantic_truth",
94
- "redefine_acceptance_disposition_or_finding_judgment",
95
- ];
96
- export const EXTERNAL_HOST_COMPATIBILITY_SUPPORTED_HOST_EXAMPLES = [
97
- "oh_my_codex",
98
- "codex",
99
- "claude",
100
- "gemini",
101
- ];
102
-
103
- export const HIGH_RISK_ADMISSION_REQUIRED_TOP_LEVEL_KEYS = [
104
- "admissions",
105
- "admission_rules",
106
- "semantic_constraints",
107
- ];
108
-
109
- export const HIGH_RISK_ADMISSION_RECORD_REQUIRED_FIELDS = [
110
- "topic_id",
111
- "packet_id",
112
- "disposition",
113
- "admitted_at",
114
- "manager_review_owner",
115
- "summary",
116
- "source_decision_contract",
117
- ];
118
-
119
- export const HIGH_RISK_ADMISSION_DISPOSITION_ENUM = [
120
- "complete",
121
- "partial",
122
- "deferred",
123
- ];
124
-
125
- export const SPEC_RECONSTRUCTION_SUMMARY_REQUIRED_FIELDS = [
126
- "generated_paths",
127
- "audit_ref",
128
- "coverage_summary",
129
- "unresolved_file_count",
130
- "inferred_file_count",
131
- "status",
132
- "summary",
133
- "verified_at",
134
- ];
135
-
136
- export const SPEC_RECONSTRUCTION_SUMMARY_STATUS = [
137
- "reconstructed",
138
- "partial",
139
- "blocked",
140
- ];
14
+ export const SPEC_GENERATION_AUDIT_REF = ".nimi/local/state/spec-generation/spec-generation-audit.yaml";
15
+ export const SPEC_GENERATION_AUDIT_CONTRACT_REF = ".nimi/contracts/spec-generation-audit.schema.yaml";
16
+ export const SPEC_GENERATION_INPUTS_REF = ".nimi/config/spec-generation-inputs.yaml";
17
+ export const SPEC_GENERATION_INPUTS_CONTRACT_REF = ".nimi/contracts/spec-generation-inputs.schema.yaml";
18
+ export const BLUEPRINT_REFERENCE_REF = ".nimi/local/state/spec-generation/blueprint-reference.yaml";
141
19
 
142
20
  export const SPEC_GENERATION_AUDIT_REQUIRED_TOP_LEVEL_FIELDS = [
143
21
  "generation_mode",
@@ -146,16 +24,6 @@ export const SPEC_GENERATION_AUDIT_REQUIRED_TOP_LEVEL_FIELDS = [
146
24
  "input_roots",
147
25
  "files",
148
26
  ];
149
-
150
- export const SPEC_GENERATION_AUDIT_FILE_REQUIRED_FIELDS = [
151
- "canonical_path",
152
- "file_class",
153
- "source_refs",
154
- "source_basis",
155
- "coverage_status",
156
- "unresolved_items",
157
- ];
158
-
159
27
  export const SPEC_GENERATION_AUDIT_SOURCE_BASIS_ENUM = [
160
28
  "grounded",
161
29
  "mixed_grounded_and_inferred",
@@ -167,279 +35,3 @@ export const SPEC_GENERATION_AUDIT_COVERAGE_STATUS_ENUM = [
167
35
  "partial",
168
36
  "placeholder_not_allowed",
169
37
  ];
170
-
171
- export const DOC_SPEC_AUDIT_SUMMARY_REQUIRED_FIELDS = [
172
- "compared_paths",
173
- "finding_count",
174
- "status",
175
- "summary",
176
- "verified_at",
177
- ];
178
-
179
- export const DOC_SPEC_AUDIT_SUMMARY_STATUS = [
180
- "aligned",
181
- "drift_detected",
182
- "blocked",
183
- ];
184
-
185
- export const AUDIT_SWEEP_SUMMARY_REQUIRED_FIELDS = [
186
- "plan_ref",
187
- "chunk_refs",
188
- "ledger_ref",
189
- "report_ref",
190
- "remediation_map_ref",
191
- "audit_closeout_ref",
192
- "evidence_refs",
193
- "finding_count",
194
- "unresolved_finding_count",
195
- "status",
196
- "coverage_scope",
197
- "coverage_quality",
198
- "audit_validity",
199
- "summary",
200
- "verified_at",
201
- ];
202
-
203
- export const AUDIT_SWEEP_SUMMARY_STATUS = [
204
- "candidate_ready",
205
- "partial",
206
- "partial_authority_only",
207
- "blocked_evidence_incomplete",
208
- "blocked",
209
- ];
210
-
211
- export const HIGH_RISK_EXECUTION_SUMMARY_REQUIRED_FIELDS = [
212
- "packet_ref",
213
- "orchestration_state_ref",
214
- "prompt_ref",
215
- "worker_output_ref",
216
- "evidence_refs",
217
- "status",
218
- "summary",
219
- "verified_at",
220
- ];
221
-
222
- export const HIGH_RISK_EXECUTION_SUMMARY_STATUS = [
223
- "candidate_ready",
224
- "blocked",
225
- "failed",
226
- ];
227
-
228
- export const HIGH_RISK_EXECUTION_ARTIFACT_ROOTS = {
229
- packet_ref: ".nimi/local/packets",
230
- orchestration_state_ref: ".nimi/local/orchestration",
231
- prompt_ref: ".nimi/local/prompts",
232
- worker_output_ref: ".nimi/local/outputs",
233
- evidence_refs: ".nimi/local/evidence",
234
- };
235
-
236
- export const AUDIT_SWEEP_ARTIFACT_ROOTS = {
237
- plan_ref: ".nimi/local/audit/plans",
238
- chunk_refs: ".nimi/local/audit/chunks",
239
- ledger_ref: ".nimi/local/audit/ledgers",
240
- report_ref: ".nimi/local/audit/reports",
241
- remediation_map_ref: ".nimi/local/audit/remediation-maps",
242
- audit_closeout_ref: ".nimi/local/audit/closeouts",
243
- packet_ref: ".nimi/local/audit/packets",
244
- evidence_refs: ".nimi/local/audit/evidence",
245
- run_ledger_ref: ".nimi/local/audit/runs",
246
- };
247
-
248
- export const HIGH_RISK_EXECUTION_ARTIFACT_HARD_CONSTRAINTS = [
249
- "external_execution_artifacts_remain_operational_only",
250
- "imported_refs_must_stay_under_declared_local_roots",
251
- "candidate_artifacts_must_not_override_semantic_truth",
252
- ];
253
-
254
- export const AUDIT_SWEEP_ARTIFACT_HARD_CONSTRAINTS = [
255
- "audit_execution_artifacts_remain_operational_only",
256
- "imported_refs_must_stay_under_declared_local_roots",
257
- "candidate_artifacts_must_not_override_semantic_truth",
258
- ];
259
-
260
- export const DOC_SPEC_AUDIT_DEFAULT_COMPARED_PATHS = [
261
- "README.md",
262
- ".nimi/spec",
263
- ];
264
-
265
- export const SPEC_TREE_MODEL_REF = ".nimi/spec/_meta/spec-tree-model.yaml";
266
- export const BLUEPRINT_REFERENCE_REF = ".nimi/local/state/spec-generation/blueprint-reference.yaml";
267
- export const COMMAND_GATING_MATRIX_REF = ".nimi/spec/_meta/command-gating-matrix.yaml";
268
- export const GENERATE_DRIFT_MIGRATION_CHECKLIST_REF = ".nimi/spec/_meta/generate-drift-migration-checklist.yaml";
269
- export const GOVERNANCE_ROUTING_CUTOVER_CHECKLIST_REF = ".nimi/spec/_meta/governance-routing-cutover-checklist.yaml";
270
- export const PHASE2_IMPACTED_SURFACE_MATRIX_REF = ".nimi/spec/_meta/phase2-impacted-surface-matrix.yaml";
271
- export const SPEC_GENERATION_AUDIT_REF = ".nimi/spec/_meta/spec-generation-audit.yaml";
272
- export const SPEC_GENERATION_INPUTS_REF = ".nimi/config/spec-generation-inputs.yaml";
273
- export const SPEC_GENERATION_INPUTS_CONTRACT_REF = ".nimi/contracts/spec-generation-inputs.schema.yaml";
274
- export const SPEC_GENERATION_AUDIT_CONTRACT_REF = ".nimi/contracts/spec-generation-audit.schema.yaml";
275
-
276
- export const SKILL_RESULT_CONTRACT_REFS = {
277
- spec_reconstruction: SPEC_RECONSTRUCTION_RESULT_CONTRACT_REF,
278
- doc_spec_audit: DOC_SPEC_AUDIT_RESULT_CONTRACT_REF,
279
- audit_sweep: AUDIT_SWEEP_RESULT_CONTRACT_REF,
280
- high_risk_execution: HIGH_RISK_EXECUTION_RESULT_CONTRACT_REF,
281
- };
282
-
283
- export const REQUIRED_LOCAL_DIRS = [".nimi/local", ".nimi/cache"];
284
-
285
- export const REQUIRED_BOOTSTRAP_DIRS = [
286
- ".nimi/methodology",
287
- ".nimi/spec",
288
- ".nimi/config",
289
- ".nimi/contracts",
290
- ".nimi/local",
291
- ".nimi/cache",
292
- ];
293
-
294
- export const HIGH_RISK_SCHEMA_SPECS = {
295
- [EXECUTION_PACKET_SCHEMA_REF]: {
296
- id: "nimi-coding.execution-packet.v1",
297
- kind: "execution-packet",
298
- listFields: {
299
- required: [
300
- "packet_id",
301
- "topic_id",
302
- "status",
303
- "owner",
304
- "created_at",
305
- "updated_at",
306
- "baseline_ref",
307
- "entry_phase_id",
308
- "phases",
309
- "escalation_policy",
310
- "notification_settings",
311
- "resume_policy",
312
- ],
313
- status_enum: ["draft", "frozen", "superseded", "archived"],
314
- phase_required: [
315
- "phase_id",
316
- "goal",
317
- "authority_refs",
318
- "write_scope",
319
- "read_scope",
320
- "required_checks",
321
- "completion_criteria",
322
- "escalation_conditions",
323
- "next_on_success",
324
- "stop_on_failure",
325
- ],
326
- phase_stop_on_failure_enum: ["pause", "stop"],
327
- escalation_policy_required: ["pause_conditions", "manager_decision_required"],
328
- notification_settings_required: ["on_block", "on_final_completion", "on_progress"],
329
- resume_policy_required: ["same_revision_resume_allowed_reasons", "new_packet_required_on"],
330
- },
331
- requiredRules: [
332
- "baseline_ref must resolve to a baseline artifact",
333
- "entry_phase_id must exist in phases[].phase_id",
334
- "next_on_success must be null or an existing phase_id",
335
- "packet must not encode transport secrets, runtime state, or semantic acceptance outcomes",
336
- ],
337
- },
338
- [ORCHESTRATION_STATE_SCHEMA_REF]: {
339
- id: "nimi-coding.orchestration-state.v1",
340
- kind: "orchestration-state",
341
- listFields: {
342
- required: [
343
- "state_id",
344
- "topic_id",
345
- "packet_ref",
346
- "run_status",
347
- "current_phase_id",
348
- "last_completed_phase_id",
349
- "awaiting_human_action",
350
- "updated_at",
351
- "owner",
352
- ],
353
- optional: [
354
- "pause_reason",
355
- "notification_refs",
356
- "current_prompt_ref",
357
- "latest_worker_output_ref",
358
- "latest_acceptance_ref",
359
- "latest_evidence_refs",
360
- "started_at",
361
- ],
362
- run_status_enum: [
363
- "running",
364
- "paused",
365
- "awaiting_confirmation",
366
- "completed",
367
- "failed",
368
- "superseded",
369
- ],
370
- notification_ref_required: ["event", "correlation_id"],
371
- },
372
- requiredRules: [
373
- "packet_ref must resolve to an execution packet artifact",
374
- "current_phase_id and last_completed_phase_id must be null or existing packet phase ids",
375
- "running state requires current_phase_id",
376
- "paused state requires current_phase_id, pause_reason, and awaiting_human_action",
377
- "awaiting_confirmation state requires current_phase_id and awaiting_human_action and is legacy-only for older runs",
378
- "failed state requires awaiting_human_action",
379
- "completed state requires last_completed_phase_id and must not carry current_phase_id, awaiting_human_action, or pause_reason",
380
- "resume_token and transport secrets are forbidden",
381
- "notification_refs entries may track event/correlation emission refs, but they must not become notification log state ownership",
382
- "orchestration state must not encode semantic acceptance or finding judgments",
383
- ],
384
- },
385
- [PROMPT_SCHEMA_REF]: {
386
- id: "nimi-coding.prompt.v1",
387
- kind: "prompt",
388
- listFields: {
389
- required_blocks: [
390
- "Task Goal",
391
- "Authority Reads",
392
- "Confirmed State",
393
- "Hard Constraints",
394
- "Must Complete",
395
- "Explicit Non-Goals",
396
- "Required Checks",
397
- "Required Final Output Format",
398
- "Blocker Escalation Rule",
399
- ],
400
- },
401
- requiredRules: [],
402
- },
403
- [WORKER_OUTPUT_SCHEMA_REF]: {
404
- id: "nimi-coding.worker-output.v1",
405
- kind: "worker-output",
406
- listFields: {
407
- required_blocks: [
408
- "Findings",
409
- "Implementation summary",
410
- "Files changed",
411
- "Checks run",
412
- "Remaining gaps / risks",
413
- "Runner Signal",
414
- ],
415
- optional_blocks: [
416
- "Chosen decision",
417
- "Authority / spec impact",
418
- "Guard behavior decision",
419
- "Next implementation step",
420
- "Remaining blockers",
421
- ],
422
- },
423
- requiredRules: [],
424
- },
425
- [ACCEPTANCE_SCHEMA_REF]: {
426
- id: "nimi-coding.acceptance.v1",
427
- kind: "acceptance",
428
- listFields: {
429
- required_order: [
430
- "authority alignment",
431
- "phase closure",
432
- "evidence sufficiency",
433
- "disposition",
434
- "next step or reopen",
435
- ],
436
- disposition_enum: ["complete", "partial", "deferred"],
437
- required_blocks: [
438
- "Findings",
439
- "Current Phase Disposition",
440
- "Next Step or Reopen Condition",
441
- ],
442
- },
443
- requiredRules: [],
444
- },
445
- };