onto-mcp 0.4.11 → 0.4.13

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 (139) hide show
  1. package/.onto/authority/core-lexicon.yaml +1 -1
  2. package/.onto/authority/supported-models.yaml +153 -0
  3. package/.onto/domains/accounting-kr/competency_qs.md +153 -153
  4. package/.onto/processes/reconstruct/obligation-coverage-ledger.yaml +842 -0
  5. package/.onto/processes/reconstruct/obligation-coverage-recorded.yaml +225 -0
  6. package/.onto/processes/reconstruct/ontology-seeding-and-maturation-design.md +93 -54
  7. package/.onto/processes/reconstruct/reconstruct-contract-registry.yaml +202 -49
  8. package/.onto/processes/reconstruct/reconstruct-execution-ux-contract.md +72 -1
  9. package/.onto/processes/reconstruct/source-profiles/spreadsheet.md +35 -0
  10. package/.onto/processes/review/nesting-batch-worker-contract.md +1 -1
  11. package/.onto/processes/review/productized-live-path.md +9 -5
  12. package/.onto/processes/review/prompt-execution-runner-contract.md +32 -8
  13. package/.onto/processes/review/review-target-profile-contract.md +47 -4
  14. package/.onto/processes/shared/pipeline-execution-ledger-contract.md +11 -0
  15. package/.onto/processes/shared/target-material-kind-contract.md +1 -1
  16. package/README.md +64 -1
  17. package/dist/cli.js +11 -1
  18. package/dist/core-api/reconstruct-api.js +679 -18
  19. package/dist/core-api/review-api.js +70 -5
  20. package/dist/core-api/review-progress.js +7 -0
  21. package/dist/core-api/runtime-observation.js +7 -0
  22. package/dist/core-runtime/artifact-io.js +131 -0
  23. package/dist/core-runtime/cli/claude-code-review-unit-executor.js +21 -9
  24. package/dist/core-runtime/cli/claude-nesting-batch-worker.js +4 -2
  25. package/dist/core-runtime/cli/materialize-review-prompt-packets.js +68 -14
  26. package/dist/core-runtime/cli/prepare-review-session.js +34 -1
  27. package/dist/core-runtime/cli/render-review-final-output.js +2 -1
  28. package/dist/core-runtime/cli/run-review-prompt-execution.js +758 -48
  29. package/dist/core-runtime/cli/run-seats.js +18 -0
  30. package/dist/core-runtime/cli/runtime-submit-context.js +10 -2
  31. package/dist/core-runtime/cli/unit-resubmit.js +269 -0
  32. package/dist/core-runtime/cli/worker-structured-output.js +80 -2
  33. package/dist/core-runtime/discovery/host-detection.js +71 -22
  34. package/dist/core-runtime/discovery/review-cert-assemble.js +208 -0
  35. package/dist/core-runtime/discovery/review-cert-record.js +442 -0
  36. package/dist/core-runtime/discovery/review-execution-units.js +22 -0
  37. package/dist/core-runtime/discovery/seat-inventory.js +167 -0
  38. package/dist/core-runtime/discovery/settings-chain.js +311 -52
  39. package/dist/core-runtime/discovery/supported-models.js +289 -25
  40. package/dist/core-runtime/discovery/synthesize-cert-assemble.js +197 -0
  41. package/dist/core-runtime/discovery/synthesize-cert-capsule.js +399 -0
  42. package/dist/core-runtime/discovery/synthesize-cert-judge.js +340 -0
  43. package/dist/core-runtime/discovery/synthesize-cert-loop.js +234 -0
  44. package/dist/core-runtime/discovery/synthesize-cert-mutation.js +117 -0
  45. package/dist/core-runtime/discovery/synthesize-cert-packet.js +182 -0
  46. package/dist/core-runtime/discovery/synthesize-cert-record.js +831 -0
  47. package/dist/core-runtime/discovery/synthesize-cert-sampler.js +336 -0
  48. package/dist/core-runtime/effort-calibration-ingest.js +326 -0
  49. package/dist/core-runtime/effort-calibration-reconstruct.js +47 -0
  50. package/dist/core-runtime/effort-calibration-review.js +22 -0
  51. package/dist/core-runtime/effort-calibration-sweep.js +110 -0
  52. package/dist/core-runtime/effort-frontier.js +134 -0
  53. package/dist/core-runtime/llm/claude-bin.js +77 -0
  54. package/dist/core-runtime/llm/dispatch-breaker.js +412 -0
  55. package/dist/core-runtime/llm/dispatch-fallback-adapter-capabilities.js +33 -0
  56. package/dist/core-runtime/llm/llm-caller.js +316 -35
  57. package/dist/core-runtime/llm/mock-llm-realization.js +35 -4
  58. package/dist/core-runtime/llm/model-switcher.js +1 -1
  59. package/dist/core-runtime/llm/openai-responses-incomplete-error.js +46 -0
  60. package/dist/core-runtime/llm/sealed-dispatch-capability.js +359 -0
  61. package/dist/core-runtime/llm/structured-dispatch-error.js +15 -0
  62. package/dist/core-runtime/onboard/claude-profile-scan.js +65 -0
  63. package/dist/core-runtime/onboard/cli-host.js +5 -2
  64. package/dist/core-runtime/onboard/configure-provider.js +33 -1
  65. package/dist/core-runtime/onboard/host-target.js +28 -3
  66. package/dist/core-runtime/onboard/register.js +54 -12
  67. package/dist/core-runtime/pipeline-execution-ledger.js +10 -0
  68. package/dist/core-runtime/reconstruct/artifact-types.js +37 -0
  69. package/dist/core-runtime/reconstruct/benchmark-evidence.js +16 -0
  70. package/dist/core-runtime/reconstruct/claim-projection-validation.js +19 -5
  71. package/dist/core-runtime/reconstruct/competency-projection-contract.js +63 -0
  72. package/dist/core-runtime/reconstruct/comprehension-artifact.js +321 -0
  73. package/dist/core-runtime/reconstruct/comprehension-reduce.js +367 -0
  74. package/dist/core-runtime/reconstruct/comprehension-semantic-map.js +771 -0
  75. package/dist/core-runtime/reconstruct/contract-registry.js +20 -0
  76. package/dist/core-runtime/reconstruct/directive-validation.js +4 -3
  77. package/dist/core-runtime/reconstruct/dispatch-fallback-artifacts.js +640 -0
  78. package/dist/core-runtime/reconstruct/execution-telemetry.js +84 -9
  79. package/dist/core-runtime/reconstruct/final-output-sections.js +89 -0
  80. package/dist/core-runtime/reconstruct/governing-snapshot.js +36 -1
  81. package/dist/core-runtime/reconstruct/leaf-reader.js +305 -0
  82. package/dist/core-runtime/reconstruct/llm-dispatch-failure.js +270 -0
  83. package/dist/core-runtime/reconstruct/llm-touch-fingerprint.js +94 -0
  84. package/dist/core-runtime/reconstruct/material-admission-validation.js +20 -5
  85. package/dist/core-runtime/reconstruct/material-profile-validation.js +24 -6
  86. package/dist/core-runtime/reconstruct/materialize-preparation.js +380 -23
  87. package/dist/core-runtime/reconstruct/maturation-validation.js +1522 -67
  88. package/dist/core-runtime/reconstruct/mock-llm-realization.js +120 -1
  89. package/dist/core-runtime/reconstruct/obligation-assertion.js +18 -0
  90. package/dist/core-runtime/reconstruct/ontology-seed-validation.js +39 -7
  91. package/dist/core-runtime/reconstruct/output-budget.js +6 -0
  92. package/dist/core-runtime/reconstruct/pipeline-execution-ledger.js +112 -5
  93. package/dist/core-runtime/reconstruct/post-seed-validation.js +122 -11
  94. package/dist/core-runtime/reconstruct/proof-authority-validation.js +2 -6
  95. package/dist/core-runtime/reconstruct/purpose-authority-validation.js +119 -7
  96. package/dist/core-runtime/reconstruct/record.js +49 -3
  97. package/dist/core-runtime/reconstruct/registry-verification-validation.js +41 -5
  98. package/dist/core-runtime/reconstruct/run-control-validation.js +1019 -37
  99. package/dist/core-runtime/reconstruct/run.js +5409 -517
  100. package/dist/core-runtime/reconstruct/seed-authoring-readiness-validation.js +56 -8
  101. package/dist/core-runtime/reconstruct/semantic-quality-gate.js +112 -7
  102. package/dist/core-runtime/reconstruct/source-observation-delta-validation.js +53 -5
  103. package/dist/core-runtime/reconstruct/source-observations.js +166 -0
  104. package/dist/core-runtime/reconstruct/source-safety-validation.js +77 -188
  105. package/dist/core-runtime/reconstruct/source-scout-pack-validation.js +50 -6
  106. package/dist/core-runtime/reconstruct/terminal-validation.js +145 -13
  107. package/dist/core-runtime/review/continuation-plan.js +12 -5
  108. package/dist/core-runtime/review/issue-artifact-runtime.js +4 -1
  109. package/dist/core-runtime/review/materializers.js +100 -11
  110. package/dist/core-runtime/review/nesting-batch.js +6 -2
  111. package/dist/core-runtime/review/obligation-shardability.js +138 -0
  112. package/dist/core-runtime/review/pipeline-execution-ledger.js +42 -2
  113. package/dist/core-runtime/review/review-artifact-utils.js +219 -7
  114. package/dist/core-runtime/review/review-execution-steps.js +32 -8
  115. package/dist/core-runtime/review/review-progress-contract.js +8 -0
  116. package/dist/core-runtime/review/review-prompt-budget.js +97 -0
  117. package/dist/core-runtime/review/semantic-quality-gate.js +33 -7
  118. package/dist/core-runtime/review/spreadsheet-review-disposition.js +94 -0
  119. package/dist/core-runtime/route-identity.js +182 -0
  120. package/dist/core-runtime/spreadsheet-header-escalation.js +204 -0
  121. package/dist/core-runtime/spreadsheet-structure-observer.js +2689 -0
  122. package/dist/core-runtime/target-material-kind.js +58 -0
  123. package/dist/mcp/server.js +27 -5
  124. package/dist/mcp/tool-schemas.js +8 -0
  125. package/dist/tui/app.js +167 -0
  126. package/dist/tui/data/event-follower.js +116 -0
  127. package/dist/tui/data/node-detail.js +42 -0
  128. package/dist/tui/data/projection-poll.js +26 -0
  129. package/dist/tui/data/session-discovery.js +65 -0
  130. package/dist/tui/index.js +108 -0
  131. package/dist/tui/screens/log.js +25 -0
  132. package/dist/tui/screens/node-detail.js +17 -0
  133. package/dist/tui/screens/session-selector.js +26 -0
  134. package/dist/tui/screens/workflow-tree.js +90 -0
  135. package/dist/tui/view-model/reconstruct-adapter.js +162 -0
  136. package/dist/tui/view-model/review-adapter.js +270 -0
  137. package/dist/tui/view-model/tree-view-model.js +19 -0
  138. package/package.json +20 -3
  139. package/settings.example.json +77 -16
@@ -1,7 +1,9 @@
1
1
  import crypto from "node:crypto";
2
2
  import fs from "node:fs/promises";
3
3
  import path from "node:path";
4
- import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
4
+ import { parse as parseYaml } from "yaml";
5
+ import { assertArrayField, atomicWriteYamlDocument as writeYamlDocument } from "../artifact-io.js";
6
+ import { assertObligation } from "./obligation-assertion.js";
5
7
  import { loadReconstructContractRegistry, } from "./contract-registry.js";
6
8
  function isoNow() {
7
9
  return new Date().toISOString();
@@ -12,10 +14,6 @@ async function sha256File(filePath) {
12
14
  .update(await fs.readFile(filePath))
13
15
  .digest("hex");
14
16
  }
15
- async function writeYamlDocument(filePath, value) {
16
- await fs.mkdir(path.dirname(filePath), { recursive: true });
17
- await fs.writeFile(filePath, stringifyYaml(value), "utf8");
18
- }
19
17
  async function readYamlDocument(filePath) {
20
18
  return parseYaml(await fs.readFile(filePath, "utf8"));
21
19
  }
@@ -30,6 +28,10 @@ function evidenceRow(args) {
30
28
  };
31
29
  }
32
30
  export async function buildRegistryVerificationEvidenceArtifact(args) {
31
+ assertArrayField(args.contractRegistry.validation_gate_catalog, "contract-registry", "validation_gate_catalog");
32
+ assertArrayField(args.contractRegistry.validator_records, "contract-registry", "validator_records");
33
+ assertArrayField(args.contractRegistry.required_when_predicate_catalog, "contract-registry", "required_when_predicate_catalog");
34
+ assertArrayField(args.contractRegistry.source_profile_records, "contract-registry", "source_profile_records");
33
35
  const registryRef = path.resolve(args.registryPath);
34
36
  const registryHash = await sha256File(registryRef);
35
37
  const artifactAuthorityIds = Object.keys(args.contractRegistry.artifact_authorities)
@@ -106,19 +108,23 @@ function sortedArtifactAuthorityIds(registry) {
106
108
  return Object.keys(registry.artifact_authorities).sort();
107
109
  }
108
110
  function sortedValidationGateIds(registry) {
111
+ assertArrayField(registry.validation_gate_catalog, "contract-registry", "validation_gate_catalog");
109
112
  return registry.validation_gate_catalog.map((gate) => gate.gate_id).sort();
110
113
  }
111
114
  function sortedValidatorIds(registry) {
115
+ assertArrayField(registry.validator_records, "contract-registry", "validator_records");
112
116
  return registry.validator_records
113
117
  .map((validator) => validator.validator_id)
114
118
  .sort();
115
119
  }
116
120
  function sortedPredicateIds(registry) {
121
+ assertArrayField(registry.required_when_predicate_catalog, "contract-registry", "required_when_predicate_catalog");
117
122
  return registry.required_when_predicate_catalog
118
123
  .map((predicate) => predicate.predicate_id)
119
124
  .sort();
120
125
  }
121
126
  function sortedSourceProfileIds(registry) {
127
+ assertArrayField(registry.source_profile_records, "contract-registry", "source_profile_records");
122
128
  return registry.source_profile_records
123
129
  .map((profile) => profile.profile_id)
124
130
  .sort();
@@ -142,7 +148,30 @@ function violation(args) {
142
148
  };
143
149
  }
144
150
  export function validateRegistryVerificationEvidence(args) {
151
+ assertArrayField(args.evidence.evidence_rows, "registry-verification-evidence", "evidence_rows");
152
+ assertArrayField(args.evidence.active_artifact_authority_ids, "registry-verification-evidence", "active_artifact_authority_ids");
153
+ assertArrayField(args.evidence.active_validation_gate_ids, "registry-verification-evidence", "active_validation_gate_ids");
154
+ assertArrayField(args.evidence.active_validator_ids, "registry-verification-evidence", "active_validator_ids");
155
+ assertArrayField(args.evidence.required_when_predicate_ids, "registry-verification-evidence", "required_when_predicate_ids");
156
+ assertArrayField(args.evidence.source_profile_ids, "registry-verification-evidence", "source_profile_ids");
157
+ assertArrayField(args.contractRegistry.validator_records, "contract-registry", "validator_records");
158
+ assertArrayField(args.contractRegistry.validation_gate_catalog, "contract-registry", "validation_gate_catalog");
159
+ assertArrayField(args.contractRegistry.required_when_predicate_catalog, "contract-registry", "required_when_predicate_catalog");
145
160
  const violations = [];
161
+ // G(a) obligation recorder (INV-OBLIGATION-COVERAGE-1): record that control
162
+ // reached each enforcer block below. Unconditional, before any per-row/per-loop
163
+ // guard so a zero-row clean input still stamps every recorded obligation.
164
+ // (validate_registry_snapshot_hash_matches_current_registry_file is PARKED: the
165
+ // match check is gated on the caller-supplied optional expectedRegistrySha256,
166
+ // not enforced internally — see obligation-coverage-ledger.yaml.)
167
+ const assertedObligationIds = [];
168
+ assertObligation(assertedObligationIds, "validate_registry_snapshot_hash_is_recorded");
169
+ assertObligation(assertedObligationIds, "validate_active_artifact_gate_validator_predicate_and_source_profile_ids_are_unique");
170
+ assertObligation(assertedObligationIds, "validate_active_registry_subject_lists_match_current_registry_catalogs");
171
+ assertObligation(assertedObligationIds, "validate_every_active_gate_has_a_validator_record");
172
+ assertObligation(assertedObligationIds, "validate_every_validator_gate_ref_resolves_to_an_active_gate");
173
+ assertObligation(assertedObligationIds, "validate_every_active_gate_required_when_predicate_resolves");
174
+ assertObligation(assertedObligationIds, "require_evidence_row_for_each_current_registry_subject_id");
146
175
  const expectedRegistryRef = args.expectedRegistryRef
147
176
  ? path.resolve(args.expectedRegistryRef)
148
177
  : null;
@@ -339,10 +368,14 @@ export function validateRegistryVerificationEvidence(args) {
339
368
  validation_results: violations.length === 0
340
369
  ? ["registry_verification_evidence_valid"]
341
370
  : ["registry_verification_evidence_invalid"],
371
+ asserted_obligation_ids: assertedObligationIds,
342
372
  violations,
343
373
  };
344
374
  }
345
375
  export async function writeRegistryVerificationEvidenceArtifact(args) {
376
+ // Registry verification is the gate that proves the on-disk registry is
377
+ // well-formed, so it always loads from `registryPath` itself rather than
378
+ // accepting a threaded in-memory registry that could belong to another path.
346
379
  const contractRegistry = await loadReconstructContractRegistry({
347
380
  registryPath: args.registryPath,
348
381
  });
@@ -355,6 +388,9 @@ export async function writeRegistryVerificationEvidenceArtifact(args) {
355
388
  return artifact;
356
389
  }
357
390
  export async function writeRegistryVerificationEvidenceValidationArtifact(args) {
391
+ // Loads the registry from `registryPath` itself (never a threaded object):
392
+ // this gate hashes the on-disk file and compares it against the evidence, so
393
+ // the parsed IDs must come from the same path being hashed.
358
394
  const [evidence, contractRegistry] = await Promise.all([
359
395
  readYamlDocument(args.evidencePath),
360
396
  loadReconstructContractRegistry({ registryPath: args.registryPath }),