onto-mcp 0.3.0 → 0.3.2

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 (61) hide show
  1. package/.onto/authority/core-lexicon.yaml +12 -0
  2. package/.onto/domains/software-engineering/competency_qs.md +192 -63
  3. package/.onto/domains/software-engineering/concepts.md +67 -5
  4. package/.onto/domains/software-engineering/conciseness_rules.md +22 -2
  5. package/.onto/domains/software-engineering/dependency_rules.md +78 -8
  6. package/.onto/domains/software-engineering/domain_scope.md +181 -150
  7. package/.onto/domains/software-engineering/extension_cases.md +318 -542
  8. package/.onto/domains/software-engineering/logic_rules.md +75 -3
  9. package/.onto/domains/software-engineering/problem_framing_profile.md +29 -2
  10. package/.onto/domains/software-engineering/prompt_interface.md +122 -0
  11. package/.onto/domains/software-engineering/structure_spec.md +53 -4
  12. package/.onto/principles/llm-native-development-guideline.md +20 -0
  13. package/.onto/principles/productization-charter.md +6 -0
  14. package/.onto/processes/evolve/material-kind-adapter-contract.md +6 -0
  15. package/.onto/processes/reconstruct/reconstruct-boundary-contract.md +468 -81
  16. package/.onto/processes/reconstruct/reconstruct-execution-ux-contract.md +177 -0
  17. package/.onto/processes/reconstruct/source-profile-contract.md +39 -6
  18. package/.onto/processes/reconstruct/top-level-concept-discovery-contract.md +387 -0
  19. package/.onto/processes/review/binding-contract.md +8 -0
  20. package/.onto/processes/review/lens-registry.md +16 -0
  21. package/.onto/processes/review/pre-dispatch-contracts.md +34 -13
  22. package/.onto/processes/review/productized-live-path.md +3 -1
  23. package/.onto/processes/shared/pipeline-execution-ledger-contract.md +185 -0
  24. package/.onto/processes/shared/target-material-kind-contract.md +24 -2
  25. package/.onto/roles/axiology.md +7 -2
  26. package/AGENTS.md +4 -2
  27. package/README.md +52 -29
  28. package/dist/core-api/reconstruct-api.js +92 -5
  29. package/dist/core-api/review-api.js +1744 -371
  30. package/dist/core-runtime/cli/mock-review-unit-executor.js +17 -0
  31. package/dist/core-runtime/cli/render-review-final-output.js +9 -0
  32. package/dist/core-runtime/cli/review-invoke.js +387 -55
  33. package/dist/core-runtime/cli/run-review-prompt-execution.js +361 -90
  34. package/dist/core-runtime/path-boundary.js +58 -0
  35. package/dist/core-runtime/pipeline-execution-ledger.js +100 -0
  36. package/dist/core-runtime/reconstruct/artifact-types.js +33 -1
  37. package/dist/core-runtime/reconstruct/materialize-preparation.js +54 -4
  38. package/dist/core-runtime/reconstruct/pipeline-execution-ledger.js +342 -0
  39. package/dist/core-runtime/reconstruct/post-seed-validation.js +630 -0
  40. package/dist/core-runtime/reconstruct/record.js +105 -1
  41. package/dist/core-runtime/reconstruct/run.js +1594 -38
  42. package/dist/core-runtime/reconstruct/seed-candidate-validation.js +29 -0
  43. package/dist/core-runtime/review/continuation-plan.js +160 -0
  44. package/dist/core-runtime/review/execution-plan-boundary.js +123 -0
  45. package/dist/core-runtime/review/materializers.js +8 -3
  46. package/dist/core-runtime/review/pipeline-execution-ledger.js +250 -0
  47. package/dist/core-runtime/review/review-artifact-utils.js +15 -2
  48. package/dist/core-runtime/review/review-invocation-runner.js +604 -0
  49. package/dist/core-runtime/target-material-kind.js +43 -5
  50. package/dist/mcp/server.js +289 -59
  51. package/dist/mcp/tool-schemas.js +28 -2
  52. package/package.json +4 -2
  53. package/.onto/domains/llm-native-development/competency_qs.md +0 -430
  54. package/.onto/domains/llm-native-development/concepts.md +0 -242
  55. package/.onto/domains/llm-native-development/conciseness_rules.md +0 -163
  56. package/.onto/domains/llm-native-development/dependency_rules.md +0 -216
  57. package/.onto/domains/llm-native-development/domain_scope.md +0 -197
  58. package/.onto/domains/llm-native-development/extension_cases.md +0 -474
  59. package/.onto/domains/llm-native-development/logic_rules.md +0 -123
  60. package/.onto/domains/llm-native-development/prompt_interface.md +0 -49
  61. package/.onto/domains/llm-native-development/structure_spec.md +0 -245
@@ -2,12 +2,16 @@ import crypto from "node:crypto";
2
2
  import fs from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import { parse as parseYaml } from "yaml";
5
+ import { RECONSTRUCT_STAGE_IDS, } from "../core-runtime/reconstruct/artifact-types.js";
5
6
  import { materializeReconstructPreparationArtifacts, } from "../core-runtime/reconstruct/materialize-preparation.js";
6
7
  import { assembleReconstructRecord, } from "../core-runtime/reconstruct/record.js";
7
- import { createAutoAcceptReconstructConfirmationProvider, createMockReconstructDirectiveAuthor, runReconstruct, } from "../core-runtime/reconstruct/run.js";
8
+ import { createAutoAcceptReconstructConfirmationProvider, createDirectCallReconstructConfirmationProvider, createDirectCallReconstructDirectiveAuthor, createMockReconstructDirectiveAuthor, runReconstruct, } from "../core-runtime/reconstruct/run.js";
9
+ import { resolveSettingsChain, } from "../core-runtime/discovery/settings-chain.js";
10
+ import { resolveLlmProviderConfig, } from "../core-runtime/llm/llm-caller.js";
8
11
  import { writeSeedCandidateValidationArtifact, } from "../core-runtime/reconstruct/seed-candidate-validation.js";
9
12
  import { writeSourceObservationDirectiveValidationArtifact, } from "../core-runtime/reconstruct/directive-validation.js";
10
13
  import { loadReconstructSourceProfiles, } from "../core-runtime/reconstruct/source-profiles.js";
14
+ import { buildReconstructPipelineExecutionLedger, } from "../core-runtime/reconstruct/pipeline-execution-ledger.js";
11
15
  async function directoryExists(directoryPath) {
12
16
  try {
13
17
  const stat = await fs.stat(directoryPath);
@@ -75,10 +79,66 @@ async function readTextIfPresent(filePath) {
75
79
  return null;
76
80
  }
77
81
  }
82
+ function deriveReconstructProgress(args) {
83
+ const stepById = new Map(args.runManifest?.steps.map((step) => [step.step_id, step]) ?? []);
84
+ const stages = RECONSTRUCT_STAGE_IDS.map((stageId) => {
85
+ const step = stepById.get(stageId);
86
+ return {
87
+ stageId,
88
+ state: step?.status === "completed"
89
+ ? "completed"
90
+ : step?.status === "skipped"
91
+ ? "skipped"
92
+ : step?.status === "failed"
93
+ ? "halted"
94
+ : "pending",
95
+ owner: step?.owner ?? null,
96
+ artifactRefs: step?.artifact_refs ?? [],
97
+ reason: step?.reason ?? null,
98
+ authorityImpact: step?.authority_impact ?? null,
99
+ };
100
+ });
101
+ const lastReachedStage = [...stages].reverse().find((stage) => stage.state !== "pending") ??
102
+ stages[0];
103
+ return {
104
+ executionProfile: args.runManifest?.execution_profile ?? null,
105
+ currentStageId: lastReachedStage.stageId,
106
+ stageCount: RECONSTRUCT_STAGE_IDS.length,
107
+ liveness: {
108
+ state: args.record.record_stage === "completed"
109
+ ? "completed"
110
+ : "halted_or_partial",
111
+ recommendedPollIntervalMs: args.record.record_stage === "completed" ? null : 1000,
112
+ },
113
+ countSummary: {
114
+ sourceObservationCount: args.metrics?.source_observation_count ?? null,
115
+ selectedObservationCount: args.metrics?.selected_observation_count ?? null,
116
+ semanticClaimCount: args.metrics?.semantic_claim_count ??
117
+ args.record.validation_summary.semantic_claim_count,
118
+ confirmedClaimCount: args.metrics?.confirmed_claim_count ??
119
+ args.record.validation_summary.confirmed_claim_count,
120
+ partialClaimCount: args.metrics?.partial_claim_count ??
121
+ args.record.validation_summary.partial_claim_count,
122
+ deferredClaimCount: args.metrics?.deferred_claim_count ??
123
+ args.record.validation_summary.deferred_claim_count,
124
+ competencyQuestionCount: args.metrics?.competency_question_count ??
125
+ args.record.validation_summary.competency_question_count,
126
+ assessmentCount: args.metrics?.competency_question_assessment_count ??
127
+ args.record.validation_summary.competency_question_assessment_count,
128
+ failureCount: args.record.validation_summary.failure_count,
129
+ revisionProposalCount: args.record.validation_summary.revision_proposal_count,
130
+ unresolvedCount: args.metrics?.unresolved_question_count ??
131
+ args.record.validation_summary.unresolved_count,
132
+ passRate: args.metrics?.pass_rate ?? args.record.validation_summary.pass_rate,
133
+ },
134
+ stages,
135
+ };
136
+ }
78
137
  function recordArtifactRefsFromPreparation(refs) {
79
138
  return {
80
139
  target_material_profile: refs.target_material_profile,
81
140
  source_inventory: refs.source_inventory,
141
+ initial_source_frontier: refs.initial_source_frontier,
82
142
  source_observations: refs.source_observations,
83
143
  };
84
144
  }
@@ -143,16 +203,27 @@ export function createOntoReconstructCoreApi(options = {}) {
143
203
  ...(ontoHome ? { ontoHome } : {}),
144
204
  });
145
205
  const targetRefs = request.targetRefs.map((targetRef) => resolveFromBase(projectRoot, targetRef));
206
+ const settings = await resolveSettingsChain(ontoHome ?? projectRoot, projectRoot);
207
+ const llmConfig = resolveLlmProviderConfig({ config: settings });
208
+ const semanticAuthorRealization = request.semanticAuthorRealization ?? "direct_call";
209
+ const confirmationProviderRealization = request.confirmationProviderRealization ?? "direct_call";
210
+ const directiveAuthor = semanticAuthorRealization === "mock"
211
+ ? createMockReconstructDirectiveAuthor()
212
+ : createDirectCallReconstructDirectiveAuthor({ llmConfig });
213
+ const confirmationProvider = confirmationProviderRealization === "mock"
214
+ ? createAutoAcceptReconstructConfirmationProvider()
215
+ : createDirectCallReconstructConfirmationProvider({ llmConfig });
146
216
  return runReconstruct({
147
217
  projectRoot,
148
218
  targetRefs,
149
219
  intent: request.intent,
150
220
  sessionRoot,
151
221
  profilesRoot,
152
- semanticAuthorRealization: request.semanticAuthorRealization,
153
- confirmationProviderRealization: request.confirmationProviderRealization,
154
- directiveAuthor: createMockReconstructDirectiveAuthor(),
155
- confirmationProvider: createAutoAcceptReconstructConfirmationProvider(),
222
+ semanticAuthorRealization,
223
+ confirmationProviderRealization,
224
+ directiveAuthor,
225
+ confirmationProvider,
226
+ llmConfig,
156
227
  filesystemAllowedRoots: request.filesystemAllowedRoots?.map((root) => resolveFromBase(projectRoot, root)) ??
157
228
  [projectRoot],
158
229
  });
@@ -198,11 +269,27 @@ export function createOntoReconstructCoreApi(options = {}) {
198
269
  async getRunStatus(sessionRoot) {
199
270
  const resolvedSessionRoot = path.resolve(sessionRoot);
200
271
  const reconstructRecord = await readYamlArtifact(path.join(resolvedSessionRoot, "reconstruct-record.yaml"));
272
+ const reconstructRunManifest = await readYamlArtifactIfPresent(reconstructRecord.artifact_refs.reconstruct_run_manifest);
273
+ const reconstructMetrics = await readYamlArtifactIfPresent(reconstructRecord.artifact_refs.reconstruct_metrics);
274
+ const reconstructRecordRef = path.join(resolvedSessionRoot, "reconstruct-record.yaml");
275
+ const pipelineExecutionLedger = await buildReconstructPipelineExecutionLedger({
276
+ sessionRoot: resolvedSessionRoot,
277
+ reconstructRecord,
278
+ reconstructRecordRef,
279
+ reconstructRunManifest,
280
+ reconstructRunManifestRef: reconstructRecord.artifact_refs.reconstruct_run_manifest,
281
+ });
201
282
  return {
202
283
  sessionId: path.basename(resolvedSessionRoot),
203
284
  sessionRoot: resolvedSessionRoot,
204
285
  status: reconstructRecord.record_stage,
205
286
  artifactRefs: reconstructRecord.artifact_refs,
287
+ progress: deriveReconstructProgress({
288
+ record: reconstructRecord,
289
+ runManifest: reconstructRunManifest,
290
+ metrics: reconstructMetrics,
291
+ }),
292
+ pipelineExecutionLedger,
206
293
  reconstructRecord,
207
294
  };
208
295
  },