onto-mcp 0.3.2 → 0.4.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.
- package/.onto/processes/reconstruct/actionable-ontology-seed-recomposition-design.md +447 -0
- package/.onto/processes/reconstruct/foundry-style-ontology-seed-contract.md +934 -0
- package/.onto/processes/reconstruct/reconstruct-boundary-contract.md +303 -725
- package/.onto/processes/reconstruct/reconstruct-contract-registry.yaml +1645 -0
- package/.onto/processes/reconstruct/reconstruct-execution-ux-contract.md +26 -22
- package/.onto/processes/reconstruct/source-profile-contract.md +49 -23
- package/.onto/processes/reconstruct/source-profiles/code.md +6 -3
- package/.onto/processes/reconstruct/source-profiles/database.md +5 -2
- package/.onto/processes/reconstruct/source-profiles/document.md +5 -2
- package/.onto/processes/reconstruct/source-profiles/spreadsheet.md +5 -4
- package/.onto/processes/review/review-execution-ux-contract.md +40 -0
- package/.onto/processes/shared/pipeline-execution-ledger-contract.md +26 -10
- package/.onto/processes/shared/target-material-kind-contract.md +29 -16
- package/AGENTS.md +6 -4
- package/README.md +149 -76
- package/dist/cli.js +8 -8
- package/dist/core-api/reconstruct-api.js +117 -31
- package/dist/core-api/review-api.js +47 -0
- package/dist/core-runtime/cli/codex-review-unit-executor.js +39 -2
- package/dist/core-runtime/cli/complete-review-session.js +2 -2
- package/dist/core-runtime/cli/mock-review-unit-executor.js +1 -1
- package/dist/core-runtime/cli/review-invoke.js +9 -9
- package/dist/core-runtime/cli/run-review-prompt-execution.js +39 -5
- package/dist/core-runtime/cli/spawn-watcher.js +266 -47
- package/dist/core-runtime/cli/start-review-session.js +3 -3
- package/dist/core-runtime/llm/llm-caller.js +11 -0
- package/dist/core-runtime/llm/llm-tool-loop.js +2 -0
- package/dist/core-runtime/observability/runtime-stream-observation.js +118 -0
- package/dist/core-runtime/onboard/cli-host.js +174 -0
- package/dist/core-runtime/onboard/host-target.js +22 -0
- package/dist/core-runtime/onboard/json-config-host.js +122 -0
- package/dist/core-runtime/onboard/path-scan.js +26 -0
- package/dist/core-runtime/onboard/prompt.js +51 -0
- package/dist/core-runtime/onboard/register.js +214 -0
- package/dist/core-runtime/onboard/types.js +27 -0
- package/dist/core-runtime/reconstruct/actionable-seed-validation.js +1777 -0
- package/dist/core-runtime/reconstruct/artifact-types.js +10 -4
- package/dist/core-runtime/reconstruct/contract-registry.js +623 -0
- package/dist/core-runtime/reconstruct/domain-id.js +10 -0
- package/dist/core-runtime/reconstruct/governing-snapshot.js +716 -0
- package/dist/core-runtime/reconstruct/material-profile-validation.js +191 -0
- package/dist/core-runtime/reconstruct/materialize-preparation.js +49 -11
- package/dist/core-runtime/reconstruct/pipeline-execution-ledger.js +269 -79
- package/dist/core-runtime/reconstruct/post-seed-validation.js +1194 -51
- package/dist/core-runtime/reconstruct/record.js +104 -20
- package/dist/core-runtime/reconstruct/run.js +2107 -413
- package/dist/core-runtime/reconstruct/seed-claim-projections.js +268 -0
- package/dist/core-runtime/reconstruct/source-profiles.js +93 -4
- package/dist/core-runtime/reconstruct/terminal-validation.js +807 -0
- package/dist/core-runtime/review/review-invocation-runner.js +4 -4
- package/dist/mcp/server.js +110 -38
- package/dist/mcp/tool-schemas.js +20 -6
- package/package.json +8 -17
- package/scripts/onto-review-watch.sh +486 -0
- package/scripts/onto-runtime-watch.sh +122 -0
- package/scripts/postinstall-hint.js +22 -0
- package/.onto/processes/reconstruct/top-level-concept-discovery-contract.md +0 -387
- package/dist/core-runtime/cli/bootstrap-review-binding.js +0 -186
- package/dist/core-runtime/cli/codex-nested-dispatch.test.js +0 -390
- package/dist/core-runtime/cli/codex-nested-teamlead-executor.test.js +0 -335
- package/dist/core-runtime/cli/coordinator-helpers.js +0 -583
- package/dist/core-runtime/cli/coordinator-state-machine-deliberation.test.js +0 -167
- package/dist/core-runtime/cli/coordinator-state-machine.js +0 -794
- package/dist/core-runtime/cli/e2e-codex-multi-agent-fixes.test.js +0 -615
- package/dist/core-runtime/cli/e2e-start-review-session.test.js +0 -312
- package/dist/core-runtime/cli/health.js +0 -44
- package/dist/core-runtime/cli/inline-http-review-unit-executor.test.js +0 -567
- package/dist/core-runtime/cli/materialize-review-execution-preparation.js +0 -104
- package/dist/core-runtime/cli/migrate-session-roots.js +0 -118
- package/dist/core-runtime/cli/repo-layout-migration-replace.smoke.test.js +0 -106
- package/dist/core-runtime/cli/review-invoke-auto-resolution.test.js +0 -268
- package/dist/core-runtime/cli/review-invoke-coordinator-topology.test.js +0 -136
- package/dist/core-runtime/cli/review-invoke-resolver-caching.test.js +0 -201
- package/dist/core-runtime/cli/review-invoke-topology-dispatch.test.js +0 -192
- package/dist/core-runtime/cli/session-root-guard.js +0 -168
- package/dist/core-runtime/cli/spawn-watcher.test.js +0 -457
- package/dist/core-runtime/cli/strip-wrapping-code-fence.test.js +0 -79
- package/dist/core-runtime/cli/teamcreate-lens-deliberation-executor.js +0 -412
- package/dist/core-runtime/cli/teamcreate-lens-deliberation-executor.test.js +0 -351
- package/dist/core-runtime/cli/topology-executor-mapping.js +0 -139
- package/dist/core-runtime/cli/topology-executor-mapping.test.js +0 -173
- package/dist/core-runtime/cli/write-review-interpretation.js +0 -81
- package/dist/core-runtime/config/onto-config-cli.js +0 -278
- package/dist/core-runtime/config/onto-config-key-path.js +0 -288
- package/dist/core-runtime/config/onto-config-key-path.test.js +0 -195
- package/dist/core-runtime/config/onto-config-preview.js +0 -108
- package/dist/core-runtime/config/onto-config-preview.test.js +0 -132
- package/dist/core-runtime/discovery/config-chain.js +0 -118
- package/dist/core-runtime/discovery/config-chain.test.js +0 -103
- package/dist/core-runtime/discovery/config-profile.js +0 -199
- package/dist/core-runtime/discovery/config-profile.test.js +0 -233
- package/dist/core-runtime/discovery/host-detection.test.js +0 -186
- package/dist/core-runtime/discovery/installation-paths.test.js +0 -65
- package/dist/core-runtime/discovery/lens-registry.test.js +0 -81
- package/dist/core-runtime/discovery/path-normalization.test.js +0 -22
- package/dist/core-runtime/discovery/plugin-path.js +0 -72
- package/dist/core-runtime/discovery/plugin-path.test.js +0 -95
- package/dist/core-runtime/evolve/adapters/code-product/compile/compile-defense.js +0 -344
- package/dist/core-runtime/evolve/adapters/code-product/compile/compile-defense.test.js +0 -915
- package/dist/core-runtime/evolve/adapters/code-product/compile/compile.js +0 -564
- package/dist/core-runtime/evolve/adapters/code-product/compile/compile.test.js +0 -708
- package/dist/core-runtime/evolve/adapters/code-product/parsers/brief-parser.js +0 -165
- package/dist/core-runtime/evolve/adapters/code-product/parsers/brief-parser.test.js +0 -227
- package/dist/core-runtime/evolve/adapters/code-product/validators/validate.js +0 -59
- package/dist/core-runtime/evolve/adapters/code-product/validators/validate.test.js +0 -205
- package/dist/core-runtime/evolve/adapters/methodology/adapter.js +0 -16
- package/dist/core-runtime/evolve/adapters/methodology/adapter.test.js +0 -9
- package/dist/core-runtime/evolve/adapters/methodology/perspectives/authority-consistency.js +0 -298
- package/dist/core-runtime/evolve/adapters/methodology/perspectives/authority-consistency.test.js +0 -70
- package/dist/core-runtime/evolve/adapters/methodology/scope-types/process.js +0 -46
- package/dist/core-runtime/evolve/adapters/methodology/scope-types/process.test.js +0 -73
- package/dist/core-runtime/evolve/adapters/registry.js +0 -47
- package/dist/core-runtime/evolve/adapters/registry.test.js +0 -67
- package/dist/core-runtime/evolve/cli.js +0 -256
- package/dist/core-runtime/evolve/commands/align.js +0 -194
- package/dist/core-runtime/evolve/commands/align.test.js +0 -82
- package/dist/core-runtime/evolve/commands/apply.js +0 -161
- package/dist/core-runtime/evolve/commands/apply.test.js +0 -138
- package/dist/core-runtime/evolve/commands/close.js +0 -39
- package/dist/core-runtime/evolve/commands/close.test.js +0 -99
- package/dist/core-runtime/evolve/commands/defer.js +0 -40
- package/dist/core-runtime/evolve/commands/defer.test.js +0 -134
- package/dist/core-runtime/evolve/commands/draft.js +0 -323
- package/dist/core-runtime/evolve/commands/draft.test.js +0 -178
- package/dist/core-runtime/evolve/commands/e2e-evolve-full-cycle.test.js +0 -208
- package/dist/core-runtime/evolve/commands/error-messages.js +0 -125
- package/dist/core-runtime/evolve/commands/error-messages.test.js +0 -167
- package/dist/core-runtime/evolve/commands/propose-align.js +0 -222
- package/dist/core-runtime/evolve/commands/propose-align.test.js +0 -136
- package/dist/core-runtime/evolve/commands/reconstruct.js +0 -330
- package/dist/core-runtime/evolve/commands/reconstruct.test.js +0 -278
- package/dist/core-runtime/evolve/commands/shared.js +0 -22
- package/dist/core-runtime/evolve/commands/stale-check.js +0 -103
- package/dist/core-runtime/evolve/commands/stale-check.test.js +0 -84
- package/dist/core-runtime/evolve/commands/start.js +0 -887
- package/dist/core-runtime/evolve/commands/start.test.js +0 -396
- package/dist/core-runtime/evolve/config/project-config.js +0 -99
- package/dist/core-runtime/evolve/config/project-config.test.js +0 -170
- package/dist/core-runtime/evolve/renderers/align-packet.js +0 -280
- package/dist/core-runtime/evolve/renderers/align-packet.test.js +0 -332
- package/dist/core-runtime/evolve/renderers/draft-packet.js +0 -303
- package/dist/core-runtime/evolve/renderers/draft-packet.test.js +0 -377
- package/dist/core-runtime/evolve/renderers/format.js +0 -5
- package/dist/core-runtime/evolve/renderers/scope-md.js +0 -237
- package/dist/core-runtime/evolve/renderers/scope-md.test.js +0 -306
- package/dist/core-runtime/govern/cli.js +0 -369
- package/dist/core-runtime/govern/cli.test.js +0 -314
- package/dist/core-runtime/govern/drift-engine.js +0 -103
- package/dist/core-runtime/govern/drift-engine.test.js +0 -319
- package/dist/core-runtime/govern/promote-principle.js +0 -206
- package/dist/core-runtime/govern/promote-principle.test.js +0 -368
- package/dist/core-runtime/govern/queue.js +0 -81
- package/dist/core-runtime/govern/types.js +0 -16
- package/dist/core-runtime/install/cli.js +0 -530
- package/dist/core-runtime/install/detect.js +0 -128
- package/dist/core-runtime/install/detect.test.js +0 -155
- package/dist/core-runtime/install/gitignore-update.js +0 -74
- package/dist/core-runtime/install/gitignore-update.test.js +0 -64
- package/dist/core-runtime/install/install-integration.test.js +0 -373
- package/dist/core-runtime/install/prompts.js +0 -389
- package/dist/core-runtime/install/prompts.test.js +0 -293
- package/dist/core-runtime/install/types.js +0 -26
- package/dist/core-runtime/install/validation.js +0 -295
- package/dist/core-runtime/install/validation.test.js +0 -313
- package/dist/core-runtime/install/writer.js +0 -254
- package/dist/core-runtime/install/writer.test.js +0 -218
- package/dist/core-runtime/learning/extractor.js +0 -461
- package/dist/core-runtime/learning/feedback.js +0 -179
- package/dist/core-runtime/learning/health-report.js +0 -165
- package/dist/core-runtime/learning/health-report.test.js +0 -169
- package/dist/core-runtime/learning/loader.js +0 -388
- package/dist/core-runtime/learning/loader.test.js +0 -102
- package/dist/core-runtime/learning/promote/apply-state.js +0 -240
- package/dist/core-runtime/learning/promote/audit-obligation.js +0 -195
- package/dist/core-runtime/learning/promote/collector.js +0 -432
- package/dist/core-runtime/learning/promote/degraded-state.js +0 -125
- package/dist/core-runtime/learning/promote/domain-doc-proposer.js +0 -166
- package/dist/core-runtime/learning/promote/e2e-promote.test.js +0 -6385
- package/dist/core-runtime/learning/promote/health-snapshot.js +0 -150
- package/dist/core-runtime/learning/promote/insight-reclassifier.js +0 -544
- package/dist/core-runtime/learning/promote/judgment-auditor.js +0 -517
- package/dist/core-runtime/learning/promote/panel-reviewer.js +0 -1158
- package/dist/core-runtime/learning/promote/promote-executor.js +0 -1675
- package/dist/core-runtime/learning/promote/promoter.js +0 -307
- package/dist/core-runtime/learning/promote/retirement.js +0 -122
- package/dist/core-runtime/learning/promote/types.js +0 -23
- package/dist/core-runtime/learning/prompt-sections.js +0 -51
- package/dist/core-runtime/learning/shared/artifact-registry-init.js +0 -45
- package/dist/core-runtime/learning/shared/artifact-registry.js +0 -254
- package/dist/core-runtime/learning/shared/audit-obligation-kernel.js +0 -73
- package/dist/core-runtime/learning/shared/audit-state.js +0 -99
- package/dist/core-runtime/learning/shared/duplicate-check.js +0 -28
- package/dist/core-runtime/learning/shared/llm-caller.js +0 -831
- package/dist/core-runtime/learning/shared/llm-caller.test.js +0 -601
- package/dist/core-runtime/learning/shared/llm-tool-loop.js +0 -393
- package/dist/core-runtime/learning/shared/mode.js +0 -25
- package/dist/core-runtime/learning/shared/paths.js +0 -84
- package/dist/core-runtime/learning/shared/paths.test.js +0 -79
- package/dist/core-runtime/learning/shared/patterns.js +0 -37
- package/dist/core-runtime/learning/shared/recoverability.js +0 -355
- package/dist/core-runtime/learning/shared/recovery-context.js +0 -374
- package/dist/core-runtime/learning/shared/scope.js +0 -1
- package/dist/core-runtime/learning/shared/semantic-classifier.js +0 -94
- package/dist/core-runtime/learning/shared/specs/apply-execution-state-spec.js +0 -42
- package/dist/core-runtime/learning/shared/specs/audit-state-spec.js +0 -37
- package/dist/core-runtime/learning/shared/specs/backup-metadata-spec.js +0 -39
- package/dist/core-runtime/learning/shared/specs/emergency-log-spec.js +0 -41
- package/dist/core-runtime/learning/shared/specs/layout-version-spec.js +0 -38
- package/dist/core-runtime/learning/shared/specs/promote-decisions-spec.js +0 -43
- package/dist/core-runtime/learning/shared/specs/promote-report-spec.js +0 -113
- package/dist/core-runtime/learning/shared/specs/prune-log-spec.js +0 -36
- package/dist/core-runtime/learning/shared/specs/recovery-resolution-spec.js +0 -48
- package/dist/core-runtime/learning/shared/specs/restore-manifest-spec.js +0 -43
- package/dist/core-runtime/learning/shared/specs/spec-helpers.js +0 -64
- package/dist/core-runtime/learning/usage-tracker.js +0 -190
- package/dist/core-runtime/learning/usage-tracker.test.js +0 -176
- package/dist/core-runtime/onboard/detect-review-axes.js +0 -122
- package/dist/core-runtime/onboard/detect-review-axes.test.js +0 -127
- package/dist/core-runtime/onboard/write-review-block.js +0 -188
- package/dist/core-runtime/onboard/write-review-block.test.js +0 -240
- package/dist/core-runtime/readers/brownfield-builder.js +0 -150
- package/dist/core-runtime/readers/brownfield-builder.test.js +0 -136
- package/dist/core-runtime/readers/code-chunk-collector.js +0 -53
- package/dist/core-runtime/readers/code-chunk-collector.test.js +0 -136
- package/dist/core-runtime/readers/file-utils.js +0 -240
- package/dist/core-runtime/readers/file-utils.test.js +0 -146
- package/dist/core-runtime/readers/lexicon-citation-check.js +0 -93
- package/dist/core-runtime/readers/lexicon-citation-check.test.js +0 -77
- package/dist/core-runtime/readers/mcp-figma.js +0 -30
- package/dist/core-runtime/readers/mcp-figma.test.js +0 -82
- package/dist/core-runtime/readers/mcp-generic.js +0 -31
- package/dist/core-runtime/readers/mcp-generic.test.js +0 -76
- package/dist/core-runtime/readers/ontology-index.js +0 -148
- package/dist/core-runtime/readers/ontology-index.test.js +0 -245
- package/dist/core-runtime/readers/ontology-query.js +0 -168
- package/dist/core-runtime/readers/ontology-query.test.js +0 -311
- package/dist/core-runtime/readers/ontology-resolve.js +0 -48
- package/dist/core-runtime/readers/ontology-resolve.test.js +0 -48
- package/dist/core-runtime/readers/patterns/index.js +0 -7
- package/dist/core-runtime/readers/review-log.js +0 -213
- package/dist/core-runtime/readers/review-log.test.js +0 -313
- package/dist/core-runtime/readers/scan-local.js +0 -102
- package/dist/core-runtime/readers/scan-local.test.js +0 -102
- package/dist/core-runtime/readers/scan-tarball.js +0 -121
- package/dist/core-runtime/readers/scan-tarball.test.js +0 -283
- package/dist/core-runtime/readers/scan-vault.js +0 -34
- package/dist/core-runtime/readers/scan-vault.test.js +0 -81
- package/dist/core-runtime/readers/types.js +0 -42
- package/dist/core-runtime/readers/types.test.js +0 -94
- package/dist/core-runtime/readers/viewpoint-collectors.js +0 -229
- package/dist/core-runtime/reconstruct/seed-candidate-validation.js +0 -385
- package/dist/core-runtime/review/citation-audit.test.js +0 -165
- package/dist/core-runtime/review/execution-plan-resolver.js +0 -247
- package/dist/core-runtime/review/execution-plan-resolver.test.js +0 -243
- package/dist/core-runtime/review/execution-topology-resolver-axis-first.test.js +0 -246
- package/dist/core-runtime/review/execution-topology-resolver.js +0 -401
- package/dist/core-runtime/review/execution-topology-resolver.test.js +0 -315
- package/dist/core-runtime/review/inline-context-embedder.test.js +0 -154
- package/dist/core-runtime/review/legacy-mode-policy.js +0 -88
- package/dist/core-runtime/review/materializers-effort-persist.test.js +0 -79
- package/dist/core-runtime/review/ontology-path-classifier.js +0 -179
- package/dist/core-runtime/review/ontology-path-classifier.test.js +0 -216
- package/dist/core-runtime/review/packet-boundary-policy.test.js +0 -107
- package/dist/core-runtime/review/participating-lens-paths.test.js +0 -73
- package/dist/core-runtime/review/review-config-legacy-translate.js +0 -244
- package/dist/core-runtime/review/review-config-legacy-translate.test.js +0 -161
- package/dist/core-runtime/review/review-config-validator.js +0 -289
- package/dist/core-runtime/review/review-config-validator.test.js +0 -236
- package/dist/core-runtime/review/shape-pipeline-audit.test.js +0 -311
- package/dist/core-runtime/review/shape-to-topology-id.js +0 -117
- package/dist/core-runtime/review/shape-to-topology-id.test.js +0 -132
- package/dist/core-runtime/review/topology-shape-derivation.js +0 -155
- package/dist/core-runtime/review/topology-shape-derivation.test.js +0 -195
- package/dist/core-runtime/scope-runtime/constants.js +0 -12
- package/dist/core-runtime/scope-runtime/constraint-pool.js +0 -166
- package/dist/core-runtime/scope-runtime/constraint-pool.test.js +0 -674
- package/dist/core-runtime/scope-runtime/domain-validation-log.js +0 -135
- package/dist/core-runtime/scope-runtime/domain-validation-log.test.js +0 -156
- package/dist/core-runtime/scope-runtime/eval-persistence.js +0 -65
- package/dist/core-runtime/scope-runtime/eval-persistence.test.js +0 -84
- package/dist/core-runtime/scope-runtime/event-pipeline.js +0 -64
- package/dist/core-runtime/scope-runtime/event-pipeline.test.js +0 -450
- package/dist/core-runtime/scope-runtime/event-store.js +0 -39
- package/dist/core-runtime/scope-runtime/event-store.test.js +0 -95
- package/dist/core-runtime/scope-runtime/gate-guard.js +0 -348
- package/dist/core-runtime/scope-runtime/gate-guard.test.js +0 -1047
- package/dist/core-runtime/scope-runtime/hash.js +0 -4
- package/dist/core-runtime/scope-runtime/hash.test.js +0 -33
- package/dist/core-runtime/scope-runtime/id.js +0 -4
- package/dist/core-runtime/scope-runtime/id.test.js +0 -17
- package/dist/core-runtime/scope-runtime/reducer.js +0 -297
- package/dist/core-runtime/scope-runtime/reducer.test.js +0 -759
- package/dist/core-runtime/scope-runtime/scope-manager.js +0 -161
- package/dist/core-runtime/scope-runtime/state-machine.js +0 -309
- package/dist/core-runtime/scope-runtime/state-machine.test.js +0 -704
- package/dist/core-runtime/scope-runtime/types.js +0 -116
- package/dist/core-runtime/scope-runtime/types.test.js +0 -69
- package/dist/core-runtime/translate/render-for-user.js +0 -169
- package/dist/core-runtime/translate/render-for-user.test.js +0 -122
- package/dist/providers/capability-contract.js +0 -1
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
|
|
2
|
-
import { PR_A_SUPPORTED_TOPOLOGIES, TOPOLOGY_CATALOG, UnsupportedTopologyError, assertSupportedInPrA, resolveExecutionTopology, } from "./execution-topology-resolver.js";
|
|
3
|
-
const CLEAN_ENV = {};
|
|
4
|
-
function withSignals(overrides) {
|
|
5
|
-
return {
|
|
6
|
-
ontoConfig: {},
|
|
7
|
-
env: CLEAN_ENV,
|
|
8
|
-
claudeHost: false,
|
|
9
|
-
experimentalAgentTeams: false,
|
|
10
|
-
codexAvailable: false,
|
|
11
|
-
codexSessionActive: false,
|
|
12
|
-
liteLlmEndpointAvailable: false,
|
|
13
|
-
...overrides,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function expectResolved(res) {
|
|
17
|
-
if (res.type !== "resolved") {
|
|
18
|
-
throw new Error(`expected resolved, got no_host: ${res.reason.slice(0, 120)}`);
|
|
19
|
-
}
|
|
20
|
-
return res;
|
|
21
|
-
}
|
|
22
|
-
function expectNoHost(res) {
|
|
23
|
-
if (res.type !== "no_host") {
|
|
24
|
-
throw new Error(`expected no_host, got resolved topology id=${res.topology.id}`);
|
|
25
|
-
}
|
|
26
|
-
return res;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Minimal `config.review` axis block that derives to `cc-main-agent-subagent`
|
|
30
|
-
* under a Claude host. Used as a vehicle for exercising resolver plumbing
|
|
31
|
-
* (overrides, observability) without duplicating axis-first happy-path
|
|
32
|
-
* coverage.
|
|
33
|
-
*/
|
|
34
|
-
const REVIEW_BLOCK_MAIN_NATIVE = {
|
|
35
|
-
teamlead: { model: "main" },
|
|
36
|
-
subagent: { provider: "main-native" },
|
|
37
|
-
};
|
|
38
|
-
// ---------------------------------------------------------------------------
|
|
39
|
-
// (3) review.max_concurrent_lenses — canonical concurrency override (P9.2)
|
|
40
|
-
// ---------------------------------------------------------------------------
|
|
41
|
-
describe("resolveExecutionTopology — review.max_concurrent_lenses override", () => {
|
|
42
|
-
it("positive review.max_concurrent_lenses takes effect and logs the change", () => {
|
|
43
|
-
const res = resolveExecutionTopology(withSignals({
|
|
44
|
-
ontoConfig: {
|
|
45
|
-
review: {
|
|
46
|
-
...REVIEW_BLOCK_MAIN_NATIVE,
|
|
47
|
-
max_concurrent_lenses: 6,
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
claudeHost: true,
|
|
51
|
-
}));
|
|
52
|
-
const resolved = expectResolved(res);
|
|
53
|
-
expect(resolved.topology.id).toBe("cc-main-agent-subagent");
|
|
54
|
-
expect(resolved.topology.max_concurrent_lenses).toBe(6);
|
|
55
|
-
expect(resolved.topology.plan_trace.some((l) => l.includes("override max_concurrent_lenses 10 → 6 (via review.max_concurrent_lenses)"))).toBe(true);
|
|
56
|
-
});
|
|
57
|
-
it("zero/negative review.max_concurrent_lenses is ignored with a warning log", () => {
|
|
58
|
-
const res = resolveExecutionTopology(withSignals({
|
|
59
|
-
ontoConfig: {
|
|
60
|
-
review: {
|
|
61
|
-
...REVIEW_BLOCK_MAIN_NATIVE,
|
|
62
|
-
max_concurrent_lenses: 0,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
claudeHost: true,
|
|
66
|
-
}));
|
|
67
|
-
const resolved = expectResolved(res);
|
|
68
|
-
expect(resolved.topology.plan_trace.some((l) => l.includes("review.max_concurrent_lenses=0 ignored (must be positive integer)"))).toBe(true);
|
|
69
|
-
expect(resolved.topology.max_concurrent_lenses).toBe(10);
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
// ---------------------------------------------------------------------------
|
|
73
|
-
// (4) plan_trace + [topology] STDERR — single source of truth
|
|
74
|
-
// ---------------------------------------------------------------------------
|
|
75
|
-
describe("resolveExecutionTopology — observability", () => {
|
|
76
|
-
let stderrSpy;
|
|
77
|
-
beforeEach(() => {
|
|
78
|
-
stderrSpy = vi.spyOn(process.stderr, "write").mockImplementation(() => true);
|
|
79
|
-
});
|
|
80
|
-
afterEach(() => {
|
|
81
|
-
stderrSpy.mockRestore();
|
|
82
|
-
});
|
|
83
|
-
it("emits [topology] prefix for every decision line", () => {
|
|
84
|
-
resolveExecutionTopology(withSignals({
|
|
85
|
-
ontoConfig: { review: REVIEW_BLOCK_MAIN_NATIVE },
|
|
86
|
-
claudeHost: true,
|
|
87
|
-
}));
|
|
88
|
-
const calls = stderrSpy.mock.calls.map((c) => String(c[0]));
|
|
89
|
-
const topologyLines = calls.filter((l) => l.startsWith("[topology]"));
|
|
90
|
-
expect(topologyLines.length).toBeGreaterThan(0);
|
|
91
|
-
for (const line of topologyLines) {
|
|
92
|
-
expect(line).toMatch(/^\[topology\] /);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
it("plan_trace matches the lines emitted to STDERR (no divergence)", () => {
|
|
96
|
-
const res = resolveExecutionTopology(withSignals({
|
|
97
|
-
ontoConfig: { review: REVIEW_BLOCK_MAIN_NATIVE },
|
|
98
|
-
claudeHost: true,
|
|
99
|
-
}));
|
|
100
|
-
const resolved = expectResolved(res);
|
|
101
|
-
const stderrLines = stderrSpy.mock.calls
|
|
102
|
-
.map((c) => String(c[0]))
|
|
103
|
-
.filter((l) => l.startsWith("[topology] "))
|
|
104
|
-
.map((l) => l.replace(/^\[topology\] /, "").replace(/\n$/, ""));
|
|
105
|
-
expect(resolved.topology.plan_trace).toEqual(stderrLines);
|
|
106
|
-
});
|
|
107
|
-
// (5) no_host composition
|
|
108
|
-
it("no_host resolution surfaces plan_trace + guidance reason", () => {
|
|
109
|
-
const res = resolveExecutionTopology(withSignals({}));
|
|
110
|
-
const nohost = expectNoHost(res);
|
|
111
|
-
expect(nohost.plan_trace.length).toBeGreaterThan(0);
|
|
112
|
-
expect(nohost.reason).toContain("Execution topology 를 도출할 수 없습니다");
|
|
113
|
-
expect(nohost.reason).toContain("현재 환경 시그널");
|
|
114
|
-
expect(nohost.reason).toContain("해결 방법");
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
// ---------------------------------------------------------------------------
|
|
118
|
-
// (2) PR-A support set — spawn-time guard
|
|
119
|
-
// ---------------------------------------------------------------------------
|
|
120
|
-
describe("resolveExecutionTopology — PR-A support set", () => {
|
|
121
|
-
it("PR-A supports exactly 3 topologies", () => {
|
|
122
|
-
expect(PR_A_SUPPORTED_TOPOLOGIES.size).toBe(3);
|
|
123
|
-
expect(PR_A_SUPPORTED_TOPOLOGIES.has("cc-main-agent-subagent")).toBe(true);
|
|
124
|
-
expect(PR_A_SUPPORTED_TOPOLOGIES.has("cc-main-codex-subprocess")).toBe(true);
|
|
125
|
-
expect(PR_A_SUPPORTED_TOPOLOGIES.has("codex-main-subprocess")).toBe(true);
|
|
126
|
-
});
|
|
127
|
-
it("assertSupportedInPrA passes for supported ids", () => {
|
|
128
|
-
for (const id of PR_A_SUPPORTED_TOPOLOGIES) {
|
|
129
|
-
expect(() => assertSupportedInPrA({
|
|
130
|
-
...TOPOLOGY_CATALOG[id],
|
|
131
|
-
plan_trace: [],
|
|
132
|
-
})).not.toThrow();
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
it("assertSupportedInPrA throws UnsupportedTopologyError for non-supported ids", () => {
|
|
136
|
-
const unsupported = [
|
|
137
|
-
"cc-teams-lens-agent-deliberation",
|
|
138
|
-
"cc-teams-agent-subagent",
|
|
139
|
-
"cc-teams-codex-subprocess",
|
|
140
|
-
"cc-teams-litellm-sessions",
|
|
141
|
-
"codex-nested-subprocess",
|
|
142
|
-
];
|
|
143
|
-
for (const id of unsupported) {
|
|
144
|
-
expect(() => assertSupportedInPrA({ ...TOPOLOGY_CATALOG[id], plan_trace: [] })).toThrow(UnsupportedTopologyError);
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
it("UnsupportedTopologyError message names the PR where the option lands", () => {
|
|
148
|
-
try {
|
|
149
|
-
assertSupportedInPrA({
|
|
150
|
-
...TOPOLOGY_CATALOG["cc-teams-agent-subagent"],
|
|
151
|
-
plan_trace: [],
|
|
152
|
-
});
|
|
153
|
-
expect.fail("expected throw");
|
|
154
|
-
}
|
|
155
|
-
catch (err) {
|
|
156
|
-
expect(err).toBeInstanceOf(UnsupportedTopologyError);
|
|
157
|
-
const msg = err.message;
|
|
158
|
-
expect(msg).toContain("PR-B");
|
|
159
|
-
expect(msg).toContain("cc-main-agent-subagent");
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
// ---------------------------------------------------------------------------
|
|
164
|
-
// (1) Catalog shape stability
|
|
165
|
-
// ---------------------------------------------------------------------------
|
|
166
|
-
const EXPECTED_CATALOG_IDS = [
|
|
167
|
-
"cc-teams-lens-agent-deliberation",
|
|
168
|
-
"cc-teams-agent-subagent",
|
|
169
|
-
"cc-teams-codex-subprocess",
|
|
170
|
-
"cc-main-agent-subagent",
|
|
171
|
-
"cc-main-codex-subprocess",
|
|
172
|
-
"cc-teams-litellm-sessions",
|
|
173
|
-
"codex-nested-subprocess",
|
|
174
|
-
"codex-main-subprocess",
|
|
175
|
-
];
|
|
176
|
-
describe("TOPOLOGY_CATALOG — shape", () => {
|
|
177
|
-
it("has exactly 8 canonical entries (post-P7 trim)", () => {
|
|
178
|
-
const catalogIds = Object.keys(TOPOLOGY_CATALOG).sort();
|
|
179
|
-
expect(catalogIds).toEqual([...EXPECTED_CATALOG_IDS].sort());
|
|
180
|
-
expect(catalogIds.length).toBe(8);
|
|
181
|
-
});
|
|
182
|
-
it("each entry has all required static attributes populated", () => {
|
|
183
|
-
for (const id of Object.keys(TOPOLOGY_CATALOG)) {
|
|
184
|
-
const entry = TOPOLOGY_CATALOG[id];
|
|
185
|
-
expect(entry.id).toBe(id);
|
|
186
|
-
expect(entry.teamlead_location).toBeTruthy();
|
|
187
|
-
expect(entry.lens_spawn_mechanism).toBeTruthy();
|
|
188
|
-
expect(entry.max_concurrent_lenses).toBeGreaterThan(0);
|
|
189
|
-
expect(["S0", "S1", "S2", "S3"]).toContain(entry.transport_rank);
|
|
190
|
-
expect(["sendmessage-a2a", "synthesizer-only"]).toContain(entry.deliberation_channel);
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
it("only cc-teams-lens-agent-deliberation declares SendMessage A2A deliberation", () => {
|
|
194
|
-
const a2a = Object.keys(TOPOLOGY_CATALOG).filter((id) => TOPOLOGY_CATALOG[id].deliberation_channel === "sendmessage-a2a");
|
|
195
|
-
expect(a2a).toEqual(["cc-teams-lens-agent-deliberation"]);
|
|
196
|
-
});
|
|
197
|
-
});
|
|
198
|
-
// ---------------------------------------------------------------------------
|
|
199
|
-
// (6) P9.1 — legacy `execution_topology_priority` is ignored at runtime
|
|
200
|
-
// (7) review absent → main_native degrade (no ladder walk)
|
|
201
|
-
// ---------------------------------------------------------------------------
|
|
202
|
-
describe("resolveExecutionTopology — P9.1 ladder retirement", () => {
|
|
203
|
-
let stderrSpy;
|
|
204
|
-
beforeEach(() => {
|
|
205
|
-
stderrSpy = vi.spyOn(process.stderr, "write").mockImplementation(() => true);
|
|
206
|
-
});
|
|
207
|
-
afterEach(() => {
|
|
208
|
-
stderrSpy.mockRestore();
|
|
209
|
-
});
|
|
210
|
-
it("no review block + CC host → main_native degrade → cc-main-agent-subagent", () => {
|
|
211
|
-
const res = resolveExecutionTopology(withSignals({
|
|
212
|
-
ontoConfig: {},
|
|
213
|
-
claudeHost: true,
|
|
214
|
-
}));
|
|
215
|
-
const resolved = expectResolved(res);
|
|
216
|
-
expect(resolved.topology.id).toBe("cc-main-agent-subagent");
|
|
217
|
-
expect(resolved.topology.plan_trace.some((l) => l.includes("topology source=fallback-main-native"))).toBe(true);
|
|
218
|
-
expect(resolved.topology.plan_trace.some((l) => l.includes("degraded: requested=<review-block-absent>"))).toBe(true);
|
|
219
|
-
});
|
|
220
|
-
it("no review block + no host signals → no_host (fail-fast, no ladder)", () => {
|
|
221
|
-
const res = resolveExecutionTopology(withSignals({}));
|
|
222
|
-
const nohost = expectNoHost(res);
|
|
223
|
-
expect(nohost.plan_trace.some((l) => l.includes("no topology resolved (axis-first + main_native fallback both failed)"))).toBe(true);
|
|
224
|
-
// Guarantee we did NOT emit the old priority-ladder trace shape.
|
|
225
|
-
expect(nohost.plan_trace.some((l) => l.includes("priority source="))).toBe(false);
|
|
226
|
-
});
|
|
227
|
-
// P9.2 (2026-04-21): the "legacy execution_topology_priority acknowledged
|
|
228
|
-
// but ignored" test was removed — the field no longer exists in `OntoConfig`,
|
|
229
|
-
// so TypeScript alone prevents its assignment. No runtime assertion needed.
|
|
230
|
-
});
|
|
231
|
-
// ---------------------------------------------------------------------------
|
|
232
|
-
// (2-bis) checkTopologyRequirements — per-branch negative coverage
|
|
233
|
-
//
|
|
234
|
-
// Restored in PR #161 self-review (2026-04-21). Axis-first pipeline
|
|
235
|
-
// produces each TopologyId, then the detailed requirements check rejects
|
|
236
|
-
// it due to a single missing signal. The resolver returns `no_host` and
|
|
237
|
-
// the plan_trace records the precise skip reason.
|
|
238
|
-
// ---------------------------------------------------------------------------
|
|
239
|
-
describe("checkTopologyRequirements — axis-first derives id but requirement fails", () => {
|
|
240
|
-
it("cc-teams-lens-agent-deliberation skips when lens_agent_teams_mode=false", () => {
|
|
241
|
-
const res = resolveExecutionTopology(withSignals({
|
|
242
|
-
ontoConfig: {
|
|
243
|
-
review: {
|
|
244
|
-
subagent: { provider: "main-native" },
|
|
245
|
-
lens_deliberation: "sendmessage-a2a",
|
|
246
|
-
},
|
|
247
|
-
lens_agent_teams_mode: false,
|
|
248
|
-
},
|
|
249
|
-
claudeHost: true,
|
|
250
|
-
experimentalAgentTeams: true,
|
|
251
|
-
}));
|
|
252
|
-
const nohost = expectNoHost(res);
|
|
253
|
-
expect(nohost.plan_trace.some((l) => l.includes("cc-teams-lens-agent-deliberation: skip — need config.lens_agent_teams_mode=true"))).toBe(true);
|
|
254
|
-
});
|
|
255
|
-
it("cc-teams-codex-subprocess skips when codex binary missing", () => {
|
|
256
|
-
const res = resolveExecutionTopology(withSignals({
|
|
257
|
-
ontoConfig: {
|
|
258
|
-
review: {
|
|
259
|
-
subagent: { provider: "codex", model_id: "gpt-5.4" },
|
|
260
|
-
},
|
|
261
|
-
},
|
|
262
|
-
claudeHost: true,
|
|
263
|
-
experimentalAgentTeams: true,
|
|
264
|
-
codexAvailable: false,
|
|
265
|
-
}));
|
|
266
|
-
const nohost = expectNoHost(res);
|
|
267
|
-
expect(nohost.plan_trace.some((l) => l.includes("cc-teams-codex-subprocess: skip — need codex binary + ~/.codex/auth.json"))).toBe(true);
|
|
268
|
-
});
|
|
269
|
-
it("cc-teams-litellm-sessions skips when LiteLLM endpoint missing", () => {
|
|
270
|
-
const res = resolveExecutionTopology(withSignals({
|
|
271
|
-
ontoConfig: {
|
|
272
|
-
review: {
|
|
273
|
-
subagent: { provider: "litellm", model_id: "gpt-4o" },
|
|
274
|
-
},
|
|
275
|
-
},
|
|
276
|
-
claudeHost: true,
|
|
277
|
-
experimentalAgentTeams: true,
|
|
278
|
-
liteLlmEndpointAvailable: false,
|
|
279
|
-
}));
|
|
280
|
-
const nohost = expectNoHost(res);
|
|
281
|
-
expect(nohost.plan_trace.some((l) => l.includes("cc-teams-litellm-sessions: skip — need LITELLM_BASE_URL or config.llm_base_url"))).toBe(true);
|
|
282
|
-
});
|
|
283
|
-
it("codex-main-subprocess skips when codex binary missing despite session signal", () => {
|
|
284
|
-
const res = resolveExecutionTopology(withSignals({
|
|
285
|
-
ontoConfig: {
|
|
286
|
-
review: {
|
|
287
|
-
subagent: { provider: "main-native" },
|
|
288
|
-
},
|
|
289
|
-
},
|
|
290
|
-
claudeHost: false,
|
|
291
|
-
codexSessionActive: true,
|
|
292
|
-
codexAvailable: false,
|
|
293
|
-
}));
|
|
294
|
-
const nohost = expectNoHost(res);
|
|
295
|
-
expect(nohost.plan_trace.some((l) => l.includes("codex-main-subprocess: skip — need codex binary + ~/.codex/auth.json"))).toBe(true);
|
|
296
|
-
});
|
|
297
|
-
});
|
|
298
|
-
// ---------------------------------------------------------------------------
|
|
299
|
-
// env-defaulting (no injected signals) — uses process.env
|
|
300
|
-
// ---------------------------------------------------------------------------
|
|
301
|
-
describe("resolveExecutionTopology — env defaults", () => {
|
|
302
|
-
it("falls back to host-detection helpers when signals are not injected", () => {
|
|
303
|
-
// Inject ontoConfig but omit detection flag args. The resolver should
|
|
304
|
-
// call detectClaudeCodeEnvSignal() etc. — we only assert the shape is
|
|
305
|
-
// valid (resolved or no_host with a trace).
|
|
306
|
-
const res = resolveExecutionTopology({
|
|
307
|
-
ontoConfig: { review: REVIEW_BLOCK_MAIN_NATIVE },
|
|
308
|
-
env: {},
|
|
309
|
-
});
|
|
310
|
-
expect(["resolved", "no_host"]).toContain(res.type);
|
|
311
|
-
if (res.type === "no_host") {
|
|
312
|
-
expect(res.plan_trace.length).toBeGreaterThan(0);
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
});
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
2
|
-
import { mkdtempSync, rmSync, writeFileSync, mkdirSync } from "node:fs";
|
|
3
|
-
import { tmpdir } from "node:os";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import { embedInlineContext } from "./inline-context-embedder.js";
|
|
6
|
-
let scratchDir;
|
|
7
|
-
let ontoHome;
|
|
8
|
-
let projectRoot;
|
|
9
|
-
let savedHome;
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
scratchDir = mkdtempSync(path.join(tmpdir(), "inline-embed-test-"));
|
|
12
|
-
ontoHome = path.join(scratchDir, ".onto");
|
|
13
|
-
projectRoot = path.join(scratchDir, "project");
|
|
14
|
-
mkdirSync(ontoHome, { recursive: true });
|
|
15
|
-
mkdirSync(projectRoot, { recursive: true });
|
|
16
|
-
savedHome = process.env.HOME;
|
|
17
|
-
process.env.HOME = scratchDir;
|
|
18
|
-
});
|
|
19
|
-
afterEach(() => {
|
|
20
|
-
if (savedHome === undefined) {
|
|
21
|
-
delete process.env.HOME;
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
process.env.HOME = savedHome;
|
|
25
|
-
}
|
|
26
|
-
rmSync(scratchDir, { recursive: true, force: true });
|
|
27
|
-
});
|
|
28
|
-
function writeDomain(domain, file, content) {
|
|
29
|
-
const dir = path.join(ontoHome, "domains", domain);
|
|
30
|
-
mkdirSync(dir, { recursive: true });
|
|
31
|
-
const filePath = path.join(dir, file);
|
|
32
|
-
writeFileSync(filePath, content, "utf8");
|
|
33
|
-
return filePath;
|
|
34
|
-
}
|
|
35
|
-
describe("embedInlineContext — domain doc embedding", () => {
|
|
36
|
-
it("expands `- Primary: <path>.md` reference to inline content block", () => {
|
|
37
|
-
writeDomain("software-engineering", "logic_rules.md", "## Logic Rules\n\nRule 1: ...\n");
|
|
38
|
-
const packet = `## Domain Documents
|
|
39
|
-
- Primary: ~/.onto/domains/software-engineering/logic_rules.md
|
|
40
|
-
`;
|
|
41
|
-
const result = embedInlineContext(packet, { ontoHome, projectRoot });
|
|
42
|
-
expect(result).toContain("Inline content (logic_rules.md)");
|
|
43
|
-
expect(result).toContain("## Logic Rules");
|
|
44
|
-
expect(result).toContain("Rule 1: ...");
|
|
45
|
-
expect(result).toContain("inline-context-embedder: domain doc references expanded");
|
|
46
|
-
});
|
|
47
|
-
it("expands Korean section labels (기본/보조)", () => {
|
|
48
|
-
writeDomain("ontology", "concepts.md", "## Concepts\n\nDefinition: X\n");
|
|
49
|
-
const packet = `## Domain Documents
|
|
50
|
-
- 기본: ~/.onto/domains/ontology/concepts.md
|
|
51
|
-
- 보조: ~/.onto/domains/ontology/concepts.md
|
|
52
|
-
`;
|
|
53
|
-
const result = embedInlineContext(packet, { ontoHome, projectRoot });
|
|
54
|
-
// Both Korean labels should produce inline content (twice)
|
|
55
|
-
const matches = result.match(/Inline content \(concepts\.md\)/g);
|
|
56
|
-
expect(matches).not.toBeNull();
|
|
57
|
-
expect(matches.length).toBe(2);
|
|
58
|
-
});
|
|
59
|
-
it("leaves missing file refs unchanged with `not-found` comment", () => {
|
|
60
|
-
const packet = `## Domain Documents
|
|
61
|
-
- Primary: ~/.onto/domains/nonexistent/missing.md
|
|
62
|
-
`;
|
|
63
|
-
const result = embedInlineContext(packet, { ontoHome, projectRoot });
|
|
64
|
-
expect(result).toContain("- Primary: ~/.onto/domains/nonexistent/missing.md");
|
|
65
|
-
expect(result).toContain("inline-embed: not-found");
|
|
66
|
-
expect(result).not.toContain("Inline content");
|
|
67
|
-
});
|
|
68
|
-
it("does not add header when no embeddings happened", () => {
|
|
69
|
-
const packet = `## Notes
|
|
70
|
-
Some unrelated content.
|
|
71
|
-
- Primary: ~/.onto/domains/missing/x.md
|
|
72
|
-
`;
|
|
73
|
-
const result = embedInlineContext(packet, { ontoHome, projectRoot });
|
|
74
|
-
// Failed embed does not add the "expansion happened" header
|
|
75
|
-
expect(result).not.toContain("inline-context-embedder: domain doc references expanded");
|
|
76
|
-
});
|
|
77
|
-
it("ignores non-md paths (only .md is matched)", () => {
|
|
78
|
-
const packet = `## Domain Documents
|
|
79
|
-
- Primary: ~/.onto/domains/x/file.txt
|
|
80
|
-
- Supplementary: ~/.onto/domains/y/script.sh
|
|
81
|
-
`;
|
|
82
|
-
const result = embedInlineContext(packet, { ontoHome, projectRoot });
|
|
83
|
-
// Original lines preserved untouched
|
|
84
|
-
expect(result).toContain("- Primary: ~/.onto/domains/x/file.txt");
|
|
85
|
-
expect(result).toContain("- Supplementary: ~/.onto/domains/y/script.sh");
|
|
86
|
-
expect(result).not.toContain("Inline content");
|
|
87
|
-
});
|
|
88
|
-
it("truncates very long files at maxEmbedLines", () => {
|
|
89
|
-
const longContent = Array.from({ length: 1000 }, (_, i) => `Line ${i + 1}`).join("\n");
|
|
90
|
-
writeDomain("big", "huge.md", longContent);
|
|
91
|
-
const packet = `## Domain Documents
|
|
92
|
-
- Primary: ~/.onto/domains/big/huge.md
|
|
93
|
-
`;
|
|
94
|
-
const result = embedInlineContext(packet, { ontoHome, projectRoot, maxEmbedLines: 50 });
|
|
95
|
-
expect(result).toContain("Inline content (huge.md)");
|
|
96
|
-
expect(result).toContain("Line 1");
|
|
97
|
-
expect(result).toContain("Line 50");
|
|
98
|
-
expect(result).not.toContain("Line 51");
|
|
99
|
-
expect(result).toContain("...truncated: 950 more lines omitted");
|
|
100
|
-
});
|
|
101
|
-
it("expands ${ONTO_PLUGIN_DIR:-default} fallback notation", () => {
|
|
102
|
-
// Set ONTO_PLUGIN_DIR to a real dir with a doc.
|
|
103
|
-
// Phase 4 layout: processes/ moved to .onto/processes/, so fixture
|
|
104
|
-
// must create the file at the new canonical location to match the
|
|
105
|
-
// packet path below.
|
|
106
|
-
const pluginDir = path.join(scratchDir, "plugin");
|
|
107
|
-
mkdirSync(path.join(pluginDir, ".onto", "processes"), { recursive: true });
|
|
108
|
-
writeFileSync(path.join(pluginDir, ".onto", "processes", "test.md"), "## Test Process\n", "utf8");
|
|
109
|
-
process.env.ONTO_PLUGIN_DIR = pluginDir;
|
|
110
|
-
try {
|
|
111
|
-
const packet = `## Domain Documents
|
|
112
|
-
- Primary: \${ONTO_PLUGIN_DIR:-~/.claude/plugins/onto}/.onto/processes/test.md
|
|
113
|
-
`;
|
|
114
|
-
const result = embedInlineContext(packet, { ontoHome, projectRoot });
|
|
115
|
-
expect(result).toContain("Inline content (test.md)");
|
|
116
|
-
expect(result).toContain("## Test Process");
|
|
117
|
-
}
|
|
118
|
-
finally {
|
|
119
|
-
delete process.env.ONTO_PLUGIN_DIR;
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
it("preserves untouched packet content surrounding refs", () => {
|
|
123
|
-
writeDomain("se", "logic.md", "Logic content");
|
|
124
|
-
const packet = `# Header
|
|
125
|
-
|
|
126
|
-
Some intro paragraph.
|
|
127
|
-
|
|
128
|
-
## Domain Documents
|
|
129
|
-
- Primary: ~/.onto/domains/se/logic.md
|
|
130
|
-
|
|
131
|
-
## Other Section
|
|
132
|
-
Unrelated content here.
|
|
133
|
-
`;
|
|
134
|
-
const result = embedInlineContext(packet, { ontoHome, projectRoot });
|
|
135
|
-
expect(result).toContain("# Header");
|
|
136
|
-
expect(result).toContain("Some intro paragraph.");
|
|
137
|
-
expect(result).toContain("## Other Section");
|
|
138
|
-
expect(result).toContain("Unrelated content here.");
|
|
139
|
-
expect(result).toContain("Inline content (logic.md)");
|
|
140
|
-
});
|
|
141
|
-
it("multiple refs in same packet all get embedded", () => {
|
|
142
|
-
writeDomain("se", "logic.md", "Logic body");
|
|
143
|
-
writeDomain("se", "concepts.md", "Concepts body");
|
|
144
|
-
const packet = `## Domain Documents
|
|
145
|
-
- Primary: ~/.onto/domains/se/logic.md
|
|
146
|
-
- Supplementary: ~/.onto/domains/se/concepts.md
|
|
147
|
-
`;
|
|
148
|
-
const result = embedInlineContext(packet, { ontoHome, projectRoot });
|
|
149
|
-
expect(result).toContain("Inline content (logic.md)");
|
|
150
|
-
expect(result).toContain("Logic body");
|
|
151
|
-
expect(result).toContain("Inline content (concepts.md)");
|
|
152
|
-
expect(result).toContain("Concepts body");
|
|
153
|
-
});
|
|
154
|
-
});
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Legacy review-mode policy — centralized seat for handling renamed mode values.
|
|
3
|
-
*
|
|
4
|
-
* # Why this file exists (evolution-F1)
|
|
5
|
-
*
|
|
6
|
-
* Before v0.2.0, `ReviewMode` values were `'light' | 'full'`. PR #127
|
|
7
|
-
* (2026-04-19) renamed `'light'` → `'core-axis'` to align the mode name with
|
|
8
|
-
* its selection rationale (at that time: meta-level 4 axes; revised in
|
|
9
|
-
* v0.2.1 to cost-constrained Pareto-optimal core lens set — registry is SSOT).
|
|
10
|
-
* The rename is big-bang (dual-read 미제공) but the runtime still needs to:
|
|
11
|
-
*
|
|
12
|
-
* 1. Reject new inputs that carry old values with a friendly migration
|
|
13
|
-
* message (not a bare "Invalid review mode" error).
|
|
14
|
-
* 2. Normalize old values found in historical persisted artifacts
|
|
15
|
-
* (`.onto/review/<session>/execution-result.yaml`) so progressiveness
|
|
16
|
-
* and audit readers remain functional.
|
|
17
|
-
*
|
|
18
|
-
* Previously (PR #127 initial) these two policies were duplicated across
|
|
19
|
-
* 4 consumers:
|
|
20
|
-
* - prepare-review-session.ts requireReviewMode validator
|
|
21
|
-
* - bootstrap-review-binding.ts requireReviewMode validator
|
|
22
|
-
* - write-review-interpretation.ts requireReviewMode validator
|
|
23
|
-
* - review-log.ts parseSession reader normalization
|
|
24
|
-
*
|
|
25
|
-
* Duplication means future rename/alias changes must touch 4 seats, each
|
|
26
|
-
* a drift risk. This module consolidates the policy into one canonical seat
|
|
27
|
-
* so future rename cycles have a single entry point.
|
|
28
|
-
*
|
|
29
|
-
* # What this file owns
|
|
30
|
-
*
|
|
31
|
-
* - `LEGACY_REVIEW_MODE_MAP`: single source of truth for old → new mode
|
|
32
|
-
* mappings
|
|
33
|
-
* - `isLegacyReviewMode`: predicate for old values
|
|
34
|
-
* - `getLegacyReplacement`: look up the new value for a legacy input
|
|
35
|
-
* - `formatLegacyMigrationError`: produce a user-facing friendly error for
|
|
36
|
-
* stale CLI/config inputs
|
|
37
|
-
* - `normalizeLegacyReviewMode`: map legacy values for reader-only
|
|
38
|
-
* normalization (returns `string` to preserve original when there is
|
|
39
|
-
* no mapping)
|
|
40
|
-
*
|
|
41
|
-
* # What this file does NOT own
|
|
42
|
-
*
|
|
43
|
-
* - The canonical `ReviewMode` union (that lives in `artifact-types.ts`)
|
|
44
|
-
* - Other legacy fields (e.g. `suggest_light` JSON key in
|
|
45
|
-
* `complexity-assessment.ts`) — those use structural `undefined`
|
|
46
|
-
* fallback, not this map
|
|
47
|
-
*
|
|
48
|
-
* Reference: CHANGELOG.md "Legacy persisted-state policy" + Consumer
|
|
49
|
-
* migration matrix; `development-records/evolve/20260418-light-to-core-axis-rename-proposal.md`
|
|
50
|
-
*/
|
|
51
|
-
/**
|
|
52
|
-
* Single source of truth for legacy → current ReviewMode value mappings.
|
|
53
|
-
* Adding a new rename cycle: add the old → new entry here; the 4 consumers
|
|
54
|
-
* automatically pick up the new mapping.
|
|
55
|
-
*/
|
|
56
|
-
export const LEGACY_REVIEW_MODE_MAP = {
|
|
57
|
-
light: "core-axis",
|
|
58
|
-
};
|
|
59
|
-
/** True if `value` is a known legacy ReviewMode name. */
|
|
60
|
-
export function isLegacyReviewMode(value) {
|
|
61
|
-
return Object.prototype.hasOwnProperty.call(LEGACY_REVIEW_MODE_MAP, value);
|
|
62
|
-
}
|
|
63
|
-
/** Returns the current ReviewMode for a legacy input, or null if unknown. */
|
|
64
|
-
export function getLegacyReplacement(value) {
|
|
65
|
-
return LEGACY_REVIEW_MODE_MAP[value] ?? null;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Friendly migration error for stale CLI/config inputs.
|
|
69
|
-
* `flag` is the surface the user was using (e.g. `--review-mode`,
|
|
70
|
-
* `review_mode`, `--review-mode-recommendation`).
|
|
71
|
-
*/
|
|
72
|
-
export function formatLegacyMigrationError(flag, legacyValue) {
|
|
73
|
-
const replacement = getLegacyReplacement(legacyValue);
|
|
74
|
-
if (replacement === null) {
|
|
75
|
-
return `Invalid ${flag}: ${legacyValue}`;
|
|
76
|
-
}
|
|
77
|
-
return (`\`${flag} ${legacyValue}\` was renamed to ` +
|
|
78
|
-
`\`${flag} ${replacement}\` in v0.2.0 (PR #127). ` +
|
|
79
|
-
`See CHANGELOG.md for migration.`);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Reader-only normalization: map a raw value to its canonical replacement
|
|
83
|
-
* when it is a known legacy name. Returns the original string otherwise
|
|
84
|
-
* (caller narrows to ReviewMode if it trusts the source).
|
|
85
|
-
*/
|
|
86
|
-
export function normalizeLegacyReviewMode(value) {
|
|
87
|
-
return LEGACY_REVIEW_MODE_MAP[value] ?? value;
|
|
88
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Effort persist (Option A) — bootstrap 시점에 OntoConfig 로부터 resolved_llm_plan
|
|
3
|
-
* 을 session-metadata.yaml 에 durable 기록하는 동작 검증.
|
|
4
|
-
*
|
|
5
|
-
* Source authority: development-records/plan (없음 — memory
|
|
6
|
-
* project_framework_v1_session_20260420.md backlog [4]).
|
|
7
|
-
*/
|
|
8
|
-
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
9
|
-
import fs from "node:fs/promises";
|
|
10
|
-
import path from "node:path";
|
|
11
|
-
import os from "node:os";
|
|
12
|
-
import { parse as parseYaml } from "yaml";
|
|
13
|
-
import { bootstrapInvocationBindingArtifacts } from "./materializers.js";
|
|
14
|
-
async function readYaml(p) {
|
|
15
|
-
const text = await fs.readFile(p, "utf8");
|
|
16
|
-
return parseYaml(text);
|
|
17
|
-
}
|
|
18
|
-
async function makeTmpProject() {
|
|
19
|
-
const base = await fs.mkdtemp(path.join(os.tmpdir(), "onto-effort-persist-"));
|
|
20
|
-
return base;
|
|
21
|
-
}
|
|
22
|
-
async function writeConfig(projectRoot, yaml) {
|
|
23
|
-
const dir = path.join(projectRoot, ".onto");
|
|
24
|
-
await fs.mkdir(dir, { recursive: true });
|
|
25
|
-
await fs.writeFile(path.join(dir, "config.yml"), yaml, "utf8");
|
|
26
|
-
}
|
|
27
|
-
function commonParams(projectRoot) {
|
|
28
|
-
return {
|
|
29
|
-
projectRoot,
|
|
30
|
-
requestedTarget: "src/foo.ts",
|
|
31
|
-
targetScopeKind: "file",
|
|
32
|
-
resolvedTargetRefs: [path.join(projectRoot, "src/foo.ts")],
|
|
33
|
-
domainFinalValue: "software-engineering",
|
|
34
|
-
domainSelectionMode: "auto",
|
|
35
|
-
executionRealization: "subagent",
|
|
36
|
-
hostRuntime: "codex",
|
|
37
|
-
reviewMode: "core-axis",
|
|
38
|
-
resolvedLensIds: ["structure"],
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
describe("bootstrapInvocationBindingArtifacts — resolved_llm_plan persistence", () => {
|
|
42
|
-
let tmp;
|
|
43
|
-
beforeEach(async () => {
|
|
44
|
-
tmp = await makeTmpProject();
|
|
45
|
-
});
|
|
46
|
-
afterEach(async () => {
|
|
47
|
-
await fs.rm(tmp, { recursive: true, force: true });
|
|
48
|
-
});
|
|
49
|
-
it("persists resolved_llm_plan from OntoConfig top-level model + codex.effort", async () => {
|
|
50
|
-
await writeConfig(tmp, "model: gpt-5.4\ncodex:\n effort: high\n");
|
|
51
|
-
const { sessionMetadataPath } = await bootstrapInvocationBindingArtifacts(commonParams(tmp));
|
|
52
|
-
const md = await readYaml(sessionMetadataPath);
|
|
53
|
-
expect(md.resolved_llm_plan).toBeDefined();
|
|
54
|
-
expect(md.resolved_llm_plan?.model).toBe("gpt-5.4");
|
|
55
|
-
expect(md.resolved_llm_plan?.reasoning_effort).toBe("high");
|
|
56
|
-
});
|
|
57
|
-
it("persists provider when external_http_provider is set", async () => {
|
|
58
|
-
await writeConfig(tmp, "external_http_provider: anthropic\nanthropic:\n model: claude-sonnet-4-6\n");
|
|
59
|
-
const { sessionMetadataPath } = await bootstrapInvocationBindingArtifacts(commonParams(tmp));
|
|
60
|
-
const md = await readYaml(sessionMetadataPath);
|
|
61
|
-
expect(md.resolved_llm_plan?.provider).toBe("anthropic");
|
|
62
|
-
expect(md.resolved_llm_plan?.model).toBe("claude-sonnet-4-6");
|
|
63
|
-
});
|
|
64
|
-
it("omits resolved_llm_plan field when config.yml is missing", async () => {
|
|
65
|
-
const { sessionMetadataPath } = await bootstrapInvocationBindingArtifacts(commonParams(tmp));
|
|
66
|
-
const md = await readYaml(sessionMetadataPath);
|
|
67
|
-
expect(md.resolved_llm_plan).toBeUndefined();
|
|
68
|
-
});
|
|
69
|
-
it("omits resolved_llm_plan field when config.yml has no LLM fields", async () => {
|
|
70
|
-
// Fixture writes an orthogonal-only field so the config YAML is
|
|
71
|
-
// non-empty but carries no LLM profile information. P9.6 (2026-04-21):
|
|
72
|
-
// swapped from legacy `execution_topology_priority` to `output_language`
|
|
73
|
-
// after the P9 runtime cleanup track retired all legacy fields.
|
|
74
|
-
await writeConfig(tmp, "output_language: en\n");
|
|
75
|
-
const { sessionMetadataPath } = await bootstrapInvocationBindingArtifacts(commonParams(tmp));
|
|
76
|
-
const md = await readYaml(sessionMetadataPath);
|
|
77
|
-
expect(md.resolved_llm_plan).toBeUndefined();
|
|
78
|
-
});
|
|
79
|
-
});
|