onto-mcp 0.3.2 → 0.4.0
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 +135 -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 +149 -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 +207 -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,387 +0,0 @@
|
|
|
1
|
-
# Reconstruct Top-Level Concept Discovery Contract
|
|
2
|
-
|
|
3
|
-
> Status: design contract.
|
|
4
|
-
> Purpose: define how `reconstruct` discovers purpose-relative top-level
|
|
5
|
-
> concepts for an ontology Seed without turning the Seed into a broad claim
|
|
6
|
-
> ledger or a full ontology draft.
|
|
7
|
-
|
|
8
|
-
## 1. Position
|
|
9
|
-
|
|
10
|
-
`reconstruct` Seed generation is a top-level concept discovery process.
|
|
11
|
-
|
|
12
|
-
The Seed is not the full ontology. It is not a complete list of entities,
|
|
13
|
-
relations, actions, properties, rules, implementation details, or all possible
|
|
14
|
-
evidence-backed claims. Its purpose is to identify the smallest stable set of
|
|
15
|
-
top-level concepts that explains the declared purpose of the target material,
|
|
16
|
-
with explicit boundaries, evidence, open questions, and deferred lower-level
|
|
17
|
-
details.
|
|
18
|
-
|
|
19
|
-
Top-level concepts are purpose-relative. They are not the highest possible
|
|
20
|
-
abstractions in a universal hierarchy. A concept is top-level for a reconstruct
|
|
21
|
-
run when it is the most useful stable axis for explaining the declared purpose
|
|
22
|
-
from the observed source evidence.
|
|
23
|
-
|
|
24
|
-
Example:
|
|
25
|
-
|
|
26
|
-
```text
|
|
27
|
-
RawIngestEvent
|
|
28
|
-
-> Usage Event
|
|
29
|
-
-> Usage Activity
|
|
30
|
-
-> User Behavior
|
|
31
|
-
-> Organizational Knowledge Flow
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
For an AI usage dashboard Seed, `Usage Event` may be a top-level concept while
|
|
35
|
-
`Organizational Knowledge Flow` is too abstract and `RawIngestEvent` is usually
|
|
36
|
-
a lower-level implementation detail.
|
|
37
|
-
|
|
38
|
-
## 2. Ownership Boundary
|
|
39
|
-
|
|
40
|
-
Runtime owns material-aware observation, source inventories, artifact refs,
|
|
41
|
-
validation gates, deterministic metrics, and source frontier boundary checks.
|
|
42
|
-
|
|
43
|
-
The host LLM owns semantic grouping, abstraction-level judgment, top-level
|
|
44
|
-
concept naming, boundary explanation, relation interpretation, convergence
|
|
45
|
-
interpretation, and final user-facing explanation.
|
|
46
|
-
|
|
47
|
-
Runtime must not decide that a source symbol, spreadsheet range, document
|
|
48
|
-
section, database table, UI component, or service method is a top-level concept.
|
|
49
|
-
Runtime may validate that LLM-authored top-level concept artifacts cite known
|
|
50
|
-
evidence refs and preserve declared artifact shape.
|
|
51
|
-
|
|
52
|
-
## 3. Design-Local Terms
|
|
53
|
-
|
|
54
|
-
These names are design-contract terms until promoted through the concept
|
|
55
|
-
registration gate in `reconstruct-boundary-contract.md`.
|
|
56
|
-
|
|
57
|
-
| Term | Seat | Meaning |
|
|
58
|
-
|---|---|---|
|
|
59
|
-
| `TopLevelConcept` | reconstruct-local semantic artifact candidate | Purpose-relative concept that explains multiple lower-level observations and remains stable across likely implementation changes. |
|
|
60
|
-
| `TopLevelConceptSet` | reconstruct-local semantic artifact candidate | Small selected set of top-level concepts for the declared purpose. |
|
|
61
|
-
| `LowerLevelDetail` | design shorthand | Source-specific field, method, component, rule, property, table, sheet, or claim that should support a top-level concept rather than become the Seed center. |
|
|
62
|
-
| `TopLevelnessPressure` | design shorthand | Unresolved reason that may change the selected concept set, concept boundary, or core relation. |
|
|
63
|
-
| `ConceptConvergence` | design shorthand | State where further source exploration is expected to refine evidence or details rather than materially change the top-level concept set, boundaries, or core relations. |
|
|
64
|
-
|
|
65
|
-
Do not introduce these names as TypeScript types, MCP fields, public artifact
|
|
66
|
-
fields, or enum values before the concept registration gate is explicitly
|
|
67
|
-
closed.
|
|
68
|
-
|
|
69
|
-
## 4. Discovery Strategy
|
|
70
|
-
|
|
71
|
-
Top-level concept discovery uses bottom-up observation, top-down purpose
|
|
72
|
-
constraint, and graph compression.
|
|
73
|
-
|
|
74
|
-
The process is not "keep climbing the hierarchy." It alternates between lifting
|
|
75
|
-
source details into candidate concepts and grounding those candidates back into
|
|
76
|
-
the declared purpose and observed evidence.
|
|
77
|
-
|
|
78
|
-
```text
|
|
79
|
-
material-aware source observations
|
|
80
|
-
-> local semantic labels and gaps
|
|
81
|
-
-> candidate concept clusters
|
|
82
|
-
-> abstraction-level tests
|
|
83
|
-
-> top-level concept set
|
|
84
|
-
-> source frontier aligned to unresolved top-levelness pressure
|
|
85
|
-
-> convergence assessment
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### 4.1 Collect Local Candidates
|
|
89
|
-
|
|
90
|
-
The first semantic pass may name many local candidates from files, symbols,
|
|
91
|
-
tables, fields, formulas, headings, UI components, services, actions, states,
|
|
92
|
-
rules, and document claims. This pass should avoid deciding top-level status too
|
|
93
|
-
early.
|
|
94
|
-
|
|
95
|
-
Local candidates are evidence-bearing raw material for clustering. They are not
|
|
96
|
-
Seed output by default.
|
|
97
|
-
|
|
98
|
-
### 4.2 Cluster By Purpose Role
|
|
99
|
-
|
|
100
|
-
Local candidates should be clustered by the role they play in explaining the
|
|
101
|
-
declared purpose:
|
|
102
|
-
|
|
103
|
-
- shared lifecycle
|
|
104
|
-
- shared user-facing meaning
|
|
105
|
-
- shared source flow
|
|
106
|
-
- shared ownership or authority
|
|
107
|
-
- shared change fate
|
|
108
|
-
- repeated co-occurrence across material slices
|
|
109
|
-
- ability to explain multiple lower-level observations
|
|
110
|
-
|
|
111
|
-
Example for an AI usage dashboard:
|
|
112
|
-
|
|
113
|
-
| Local candidates | Candidate top-level concept |
|
|
114
|
-
|---|---|
|
|
115
|
-
| session row, session metrics, session context, session classification | `Usage Session` |
|
|
116
|
-
| raw payload, ingest event, fingerprint, deduplication status | `Usage Event` |
|
|
117
|
-
| billing aggregate, cost KPI, token cost, provider cost | `Usage Cost` |
|
|
118
|
-
| page, KPI cards, session table, analytics summary | `Dashboard View` |
|
|
119
|
-
|
|
120
|
-
### 4.3 Test Abstraction Level
|
|
121
|
-
|
|
122
|
-
Each candidate must pass both upward and downward tests.
|
|
123
|
-
|
|
124
|
-
Upward test:
|
|
125
|
-
|
|
126
|
-
- Does this candidate explain multiple lower-level observations?
|
|
127
|
-
- Does it survive likely implementation changes?
|
|
128
|
-
- Is it necessary to explain the declared purpose?
|
|
129
|
-
- Can a user understand it without reading implementation names?
|
|
130
|
-
|
|
131
|
-
Downward test:
|
|
132
|
-
|
|
133
|
-
- Is it still grounded in concrete evidence?
|
|
134
|
-
- Does it avoid becoming a generic business abstraction?
|
|
135
|
-
- Does it preserve enough boundary detail to guide later ontology work?
|
|
136
|
-
- Does it avoid hiding materially different concepts that must be split?
|
|
137
|
-
|
|
138
|
-
The target is the stable middle level that explains the purpose, not the most
|
|
139
|
-
abstract reachable parent.
|
|
140
|
-
|
|
141
|
-
### 4.4 Select A Small Concept Set
|
|
142
|
-
|
|
143
|
-
The Seed should prefer a compact top-level concept set. The normal target range
|
|
144
|
-
is small enough for a user to inspect in one pass, usually 3-7 concepts for a
|
|
145
|
-
bounded product slice.
|
|
146
|
-
|
|
147
|
-
The concept set may be larger when the declared purpose or target bundle is
|
|
148
|
-
explicitly broad, but growth must be justified by purpose coverage, not by
|
|
149
|
-
implementation surface area.
|
|
150
|
-
|
|
151
|
-
### 4.5 Demote Lower-Level Detail
|
|
152
|
-
|
|
153
|
-
Implementation details, fields, service methods, UI widgets, spreadsheet cells,
|
|
154
|
-
schema columns, narrow rules, and action-level claims should be demoted unless
|
|
155
|
-
they independently satisfy the top-level tests.
|
|
156
|
-
|
|
157
|
-
Demotion does not discard evidence. The detail should be attached to one of:
|
|
158
|
-
|
|
159
|
-
- `included_lower_concepts`
|
|
160
|
-
- `supporting_evidence`
|
|
161
|
-
- `deferred_detail_candidates`
|
|
162
|
-
- `open_questions`
|
|
163
|
-
- `boundary_notes`
|
|
164
|
-
|
|
165
|
-
## 5. Top-Levelness Criteria
|
|
166
|
-
|
|
167
|
-
A top-level concept candidate is strong when it satisfies most of the criteria
|
|
168
|
-
below.
|
|
169
|
-
|
|
170
|
-
| Criterion | Question |
|
|
171
|
-
|---|---|
|
|
172
|
-
| Purpose criticality | Would the declared purpose become hard to explain without this concept? |
|
|
173
|
-
| Explanatory compression | Does it explain multiple lower-level observations without losing important distinctions? |
|
|
174
|
-
| Boundary clarity | Can the run state what belongs under this concept and what is excluded or deferred? |
|
|
175
|
-
| Relation centrality | Does it participate in core relations with other selected concepts? |
|
|
176
|
-
| Material grounding | Is it supported by concrete source observations from the current material boundary? |
|
|
177
|
-
| User-facing intelligibility | Can the concept be named in service language, not only implementation language? |
|
|
178
|
-
| Evolution stability | Would the concept likely survive refactors, UI rewrites, schema reshaping, or source-format changes? |
|
|
179
|
-
| Split pressure | Is there no unresolved material reason to split it now? |
|
|
180
|
-
| Merge pressure | Is there no unresolved material reason to merge it with another selected concept now? |
|
|
181
|
-
|
|
182
|
-
No single criterion is sufficient. Frequent source mentions or central code
|
|
183
|
-
location do not by themselves make a concept top-level.
|
|
184
|
-
|
|
185
|
-
## 6. Source Frontier Alignment
|
|
186
|
-
|
|
187
|
-
Source frontier selection must align to top-level concept convergence.
|
|
188
|
-
|
|
189
|
-
The frontier should not ask "what else can be read?" It should ask "what source
|
|
190
|
-
could materially change the selected top-level concept set, concept boundaries,
|
|
191
|
-
core relations, or convergence confidence?"
|
|
192
|
-
|
|
193
|
-
Each LLM-authored frontier ref should carry the decision pressure it is meant
|
|
194
|
-
to resolve.
|
|
195
|
-
|
|
196
|
-
Recommended semantic payload:
|
|
197
|
-
|
|
198
|
-
```yaml
|
|
199
|
-
frontier_refs:
|
|
200
|
-
- source_ref: src/services/usage-mart.service.ts
|
|
201
|
-
frontier_question: Is UsageMart a top-level concept or a lower-level read model under Usage Cost or Dashboard View?
|
|
202
|
-
target_concepts:
|
|
203
|
-
- Usage Cost
|
|
204
|
-
- Dashboard View
|
|
205
|
-
- Usage Mart
|
|
206
|
-
pressure_type: split_or_demote
|
|
207
|
-
expected_decision_impact: May demote UsageMart from top-level concept to supporting detail.
|
|
208
|
-
priority: high
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
The exact public artifact field names remain subject to the registration gate.
|
|
212
|
-
Until then, runtime may preserve this information inside existing rationale
|
|
213
|
-
fields or design-local prompt payloads.
|
|
214
|
-
|
|
215
|
-
Valid frontier pressure categories:
|
|
216
|
-
|
|
217
|
-
| Pressure | Use when |
|
|
218
|
-
|---|---|
|
|
219
|
-
| `missing_axis` | The declared purpose may require a top-level concept not yet represented. |
|
|
220
|
-
| `split_or_merge` | Two candidates may be the same concept, or one candidate may hide two materially different concepts. |
|
|
221
|
-
| `boundary` | The concept's included and excluded lower-level details are unclear. |
|
|
222
|
-
| `core_relation` | The relation between selected concepts may be wrong or incomplete. |
|
|
223
|
-
| `abstraction_level` | A candidate may be too implementation-specific or too generic. |
|
|
224
|
-
| `evidence_saturation` | The run needs to know whether additional source will introduce new top-level concepts or only reinforce existing ones. |
|
|
225
|
-
|
|
226
|
-
Frontier requests that only gather lower-level implementation detail are valid
|
|
227
|
-
only when that detail can resolve one of these pressures.
|
|
228
|
-
|
|
229
|
-
## 7. Convergence Conditions
|
|
230
|
-
|
|
231
|
-
Top-level concept discovery converges when further source exploration is
|
|
232
|
-
expected to refine evidence, properties, rules, or lower-level details, but is
|
|
233
|
-
not expected to materially change the selected top-level concept set, each
|
|
234
|
-
concept's boundary, or the core relations between concepts for the declared
|
|
235
|
-
purpose.
|
|
236
|
-
|
|
237
|
-
Convergence is not the absence of all issues. It is a bounded claim about the
|
|
238
|
-
stability of the top-level concept set.
|
|
239
|
-
|
|
240
|
-
The run may report one of three convergence states:
|
|
241
|
-
|
|
242
|
-
| State | Meaning | Typical next action |
|
|
243
|
-
|---|---|---|
|
|
244
|
-
| `not_converged` | Top-level concept candidates, boundaries, or relations are still changing materially. | Continue source frontier exploration. |
|
|
245
|
-
| `provisionally_converged` | The main concept set is stable, but some split, merge, boundary, or deferred-detail questions remain. | Present Seed with disclosed limits and revision proposals. |
|
|
246
|
-
| `converged_for_seed` | Purpose coverage, concept boundaries, and core relations are stable enough for Seed handoff. | Present Seed as the current top-level concept discovery result. |
|
|
247
|
-
|
|
248
|
-
Signals for convergence:
|
|
249
|
-
|
|
250
|
-
- selected concept set is stable across the latest exploration round
|
|
251
|
-
- new observations map into existing concepts rather than creating new top-level
|
|
252
|
-
concepts
|
|
253
|
-
- remaining issues concern evidence depth, properties, rules, or lower-level
|
|
254
|
-
details
|
|
255
|
-
- no lens raises a material objection that a selected concept is too broad, too
|
|
256
|
-
narrow, too generic, too implementation-specific, missing, or duplicated
|
|
257
|
-
- next frontier value is expected to improve confidence rather than change the
|
|
258
|
-
concept set
|
|
259
|
-
|
|
260
|
-
Signals against convergence:
|
|
261
|
-
|
|
262
|
-
- a new source slice introduces a previously missing purpose axis
|
|
263
|
-
- selected concepts repeatedly require split or merge
|
|
264
|
-
- relation direction between selected concepts changes
|
|
265
|
-
- a selected concept cannot state included and excluded detail
|
|
266
|
-
- a concept is only a code artifact, UI widget, schema artifact, spreadsheet
|
|
267
|
-
range, or document section with no purpose-level role
|
|
268
|
-
- the concept set explains source structure but not the declared purpose
|
|
269
|
-
|
|
270
|
-
## 8. Seed Output Shape
|
|
271
|
-
|
|
272
|
-
The Seed should center top-level concepts. Current artifacts may continue to use
|
|
273
|
-
existing Seed claim fields while the contract migrates, but the semantic shape
|
|
274
|
-
should project to:
|
|
275
|
-
|
|
276
|
-
```yaml
|
|
277
|
-
purpose:
|
|
278
|
-
claim_id:
|
|
279
|
-
name:
|
|
280
|
-
statement:
|
|
281
|
-
evidence_refs:
|
|
282
|
-
top_level_concepts:
|
|
283
|
-
- concept_id:
|
|
284
|
-
name:
|
|
285
|
-
definition:
|
|
286
|
-
why_top_level:
|
|
287
|
-
evidence_refs:
|
|
288
|
-
included_lower_concepts:
|
|
289
|
-
excluded_or_deferred_details:
|
|
290
|
-
core_relations:
|
|
291
|
-
open_questions:
|
|
292
|
-
confidence:
|
|
293
|
-
top_level_relations:
|
|
294
|
-
- relation_id:
|
|
295
|
-
source_concept_id:
|
|
296
|
-
target_concept_id:
|
|
297
|
-
relation:
|
|
298
|
-
statement:
|
|
299
|
-
evidence_refs:
|
|
300
|
-
deferred_detail_candidates:
|
|
301
|
-
- name:
|
|
302
|
-
belongs_to_concept_id:
|
|
303
|
-
reason_deferred:
|
|
304
|
-
evidence_refs:
|
|
305
|
-
convergence:
|
|
306
|
-
state:
|
|
307
|
-
rationale:
|
|
308
|
-
remaining_pressures:
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
If existing `entities`, `relations`, `actions`, `properties`, and `rules`
|
|
312
|
-
fields are used before schema migration, they must be interpreted narrowly:
|
|
313
|
-
|
|
314
|
-
- `entities` should contain only top-level concept candidates or explicitly
|
|
315
|
-
marked provisional top-level entities.
|
|
316
|
-
- `relations` should contain only relations between top-level concepts.
|
|
317
|
-
- `actions`, `properties`, and `rules` should be sparse and limited to
|
|
318
|
-
purpose-level facts that affect top-level concept boundaries or relations.
|
|
319
|
-
- lower-level actions, properties, rules, fields, methods, UI elements, and
|
|
320
|
-
schema details should move to deferred detail or supporting notes.
|
|
321
|
-
|
|
322
|
-
## 9. Lens Responsibilities
|
|
323
|
-
|
|
324
|
-
Reconstruct lenses should evaluate top-level concept discovery rather than
|
|
325
|
-
merely collecting claim improvements.
|
|
326
|
-
|
|
327
|
-
| Lens | Discovery question |
|
|
328
|
-
|---|---|
|
|
329
|
-
| semantics | Are the concept names and definitions meaningfully distinct and grounded? |
|
|
330
|
-
| structure | Is the concept set neither over-split nor over-merged? |
|
|
331
|
-
| dependency | Do selected concepts have stable dependency and flow relations? |
|
|
332
|
-
| pragmatics | Can target users understand and act on this concept set? |
|
|
333
|
-
| evolution | Will the concepts survive likely implementation and material changes? |
|
|
334
|
-
| coverage | Does the set cover the declared purpose without missing a major axis? |
|
|
335
|
-
| logic | Are relations and boundaries coherent and non-contradictory? |
|
|
336
|
-
| conciseness | Is the Seed compact enough to serve as a Seed rather than a full ontology? |
|
|
337
|
-
| axiology | Does the concept set preserve what matters for trust, value, and declared purpose? |
|
|
338
|
-
|
|
339
|
-
Lens disagreement should be represented as split, merge, boundary, abstraction,
|
|
340
|
-
or missing-axis pressure when it can affect top-level convergence.
|
|
341
|
-
|
|
342
|
-
## 10. Validation Expectations
|
|
343
|
-
|
|
344
|
-
Runtime validation should remain deterministic. It can validate:
|
|
345
|
-
|
|
346
|
-
- artifact shape
|
|
347
|
-
- required fields
|
|
348
|
-
- known evidence refs
|
|
349
|
-
- duplicate ids
|
|
350
|
-
- relation endpoints referencing known top-level concepts
|
|
351
|
-
- every top-level concept having at least one evidence ref
|
|
352
|
-
- every top-level concept having a boundary statement
|
|
353
|
-
- convergence state being one of the allowed values once promoted
|
|
354
|
-
|
|
355
|
-
Runtime should not validate semantic truth such as whether `Usage Session` is
|
|
356
|
-
really the right top-level concept. That remains LLM-authored and lens-reviewed.
|
|
357
|
-
|
|
358
|
-
## 11. Non-Goals
|
|
359
|
-
|
|
360
|
-
This contract does not require:
|
|
361
|
-
|
|
362
|
-
- a full ontology graph
|
|
363
|
-
- exhaustive entity extraction
|
|
364
|
-
- automatic semantic repair by runtime
|
|
365
|
-
- a universal hierarchy of concepts
|
|
366
|
-
- reading every source file
|
|
367
|
-
- turning every source detail into a Seed claim
|
|
368
|
-
- declaring lower-level implementation details final
|
|
369
|
-
|
|
370
|
-
## 12. Implementation Path
|
|
371
|
-
|
|
372
|
-
Recommended implementation order:
|
|
373
|
-
|
|
374
|
-
1. Update the Seed author prompt to make top-level concept discovery the primary
|
|
375
|
-
objective.
|
|
376
|
-
2. Add compact prompt payloads that pass candidate labels, gaps, evidence ids,
|
|
377
|
-
and unresolved top-levelness pressure rather than full artifacts.
|
|
378
|
-
3. Add a design-local top-level concept projection in final output before
|
|
379
|
-
changing public schema.
|
|
380
|
-
4. Add Seed validation checks for required `name`, boundary, evidence, compact
|
|
381
|
-
concept set, and relation endpoints.
|
|
382
|
-
5. Add frontier rationale fields or prompt requirements that align every
|
|
383
|
-
source frontier request to top-level concept pressure.
|
|
384
|
-
6. Add convergence projection to metrics and final output.
|
|
385
|
-
7. Promote stable names through `.onto/authority/core-lexicon.yaml` only after
|
|
386
|
-
the artifact shape has stabilized.
|
|
387
|
-
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { parseArgs } from "node:util";
|
|
4
|
-
import { hasOptionFlag } from "../review/review-artifact-utils.js";
|
|
5
|
-
import { bootstrapInvocationBindingArtifacts } from "../review/materializers.js";
|
|
6
|
-
import { printOntoReleaseChannelNotice } from "../release-channel/release-channel.js";
|
|
7
|
-
import { detectClaudeCodeEnvSignal, detectCodexEnvSignal, } from "../discovery/host-detection.js";
|
|
8
|
-
function requireString(value, optionName) {
|
|
9
|
-
if (typeof value !== "string" || value.length === 0) {
|
|
10
|
-
throw new Error(`Missing required option --${optionName}`);
|
|
11
|
-
}
|
|
12
|
-
return value;
|
|
13
|
-
}
|
|
14
|
-
function optionalString(value) {
|
|
15
|
-
return typeof value === "string" ? value : "";
|
|
16
|
-
}
|
|
17
|
-
function requireExecutionRealization(value) {
|
|
18
|
-
if (value === "worker" || value === "host-team" || value === "direct-call") {
|
|
19
|
-
return value;
|
|
20
|
-
}
|
|
21
|
-
throw new Error(`Invalid --execution-realization: ${value}`);
|
|
22
|
-
}
|
|
23
|
-
function normalizeHostRuntime(hostRuntimeValue) {
|
|
24
|
-
if (typeof hostRuntimeValue !== "string" || hostRuntimeValue.length === 0) {
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
if (hostRuntimeValue === "codex" || hostRuntimeValue === "claude") {
|
|
28
|
-
return hostRuntimeValue;
|
|
29
|
-
}
|
|
30
|
-
if (hostRuntimeValue === "standalone" ||
|
|
31
|
-
hostRuntimeValue === "anthropic" ||
|
|
32
|
-
hostRuntimeValue === "openai" ||
|
|
33
|
-
hostRuntimeValue === "grok" ||
|
|
34
|
-
hostRuntimeValue === "lmstudio") {
|
|
35
|
-
return hostRuntimeValue;
|
|
36
|
-
}
|
|
37
|
-
throw new Error(`Invalid --host-runtime: ${hostRuntimeValue}`);
|
|
38
|
-
}
|
|
39
|
-
function detectHostRuntimeFromEnvironment() {
|
|
40
|
-
// Delegated to canonical seat. Note: this consumer expects undefined when
|
|
41
|
-
// no signal is present (so caller can apply its own default), so we DO NOT
|
|
42
|
-
// call `detectHostRuntime()` (which always returns "standalone" as default).
|
|
43
|
-
if (detectCodexEnvSignal()) {
|
|
44
|
-
return "codex";
|
|
45
|
-
}
|
|
46
|
-
if (detectClaudeCodeEnvSignal()) {
|
|
47
|
-
return "claude";
|
|
48
|
-
}
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
function resolveHostRuntime(argv, executionRealizationValue, hostRuntimeValue) {
|
|
52
|
-
const explicitHostRuntime = normalizeHostRuntime(hostRuntimeValue);
|
|
53
|
-
if (explicitHostRuntime) {
|
|
54
|
-
return explicitHostRuntime;
|
|
55
|
-
}
|
|
56
|
-
if (hasOptionFlag(argv, "codex")) {
|
|
57
|
-
return "codex";
|
|
58
|
-
}
|
|
59
|
-
if (hasOptionFlag(argv, "claude")) {
|
|
60
|
-
return "claude";
|
|
61
|
-
}
|
|
62
|
-
const normalizedExecutionRealization = typeof executionRealizationValue === "string" && executionRealizationValue.length > 0
|
|
63
|
-
? requireExecutionRealization(executionRealizationValue)
|
|
64
|
-
: undefined;
|
|
65
|
-
if (normalizedExecutionRealization) {
|
|
66
|
-
if (normalizedExecutionRealization === "worker")
|
|
67
|
-
return "codex";
|
|
68
|
-
if (normalizedExecutionRealization === "host-team")
|
|
69
|
-
return "claude";
|
|
70
|
-
return "standalone";
|
|
71
|
-
}
|
|
72
|
-
return detectHostRuntimeFromEnvironment() ?? "codex";
|
|
73
|
-
}
|
|
74
|
-
function resolveExecutionRealization(argv, executionRealizationValue, hostRuntime) {
|
|
75
|
-
if (typeof executionRealizationValue === "string" &&
|
|
76
|
-
executionRealizationValue.length > 0) {
|
|
77
|
-
return requireExecutionRealization(executionRealizationValue);
|
|
78
|
-
}
|
|
79
|
-
if (hasOptionFlag(argv, "codex")) {
|
|
80
|
-
return "worker";
|
|
81
|
-
}
|
|
82
|
-
if (hasOptionFlag(argv, "claude")) {
|
|
83
|
-
return "host-team";
|
|
84
|
-
}
|
|
85
|
-
if (hostRuntime === "codex")
|
|
86
|
-
return "worker";
|
|
87
|
-
if (hostRuntime === "claude")
|
|
88
|
-
return "host-team";
|
|
89
|
-
return "direct-call";
|
|
90
|
-
}
|
|
91
|
-
function requireReviewMode(value) {
|
|
92
|
-
if (value === "core-axis" || value === "full") {
|
|
93
|
-
return value;
|
|
94
|
-
}
|
|
95
|
-
throw new Error(`Invalid --review-mode: ${value}`);
|
|
96
|
-
}
|
|
97
|
-
function requireTargetScopeKind(value) {
|
|
98
|
-
if (value === "file" || value === "directory" || value === "bundle") {
|
|
99
|
-
return value;
|
|
100
|
-
}
|
|
101
|
-
throw new Error(`Invalid --target-scope-kind: ${value}`);
|
|
102
|
-
}
|
|
103
|
-
async function main() {
|
|
104
|
-
await printOntoReleaseChannelNotice();
|
|
105
|
-
const { values } = parseArgs({
|
|
106
|
-
options: {
|
|
107
|
-
"project-root": { type: "string", default: "." },
|
|
108
|
-
"requested-target": { type: "string" },
|
|
109
|
-
"requested-domain-token": { type: "string", default: "" },
|
|
110
|
-
"plugin-root": { type: "string" },
|
|
111
|
-
"session-id": { type: "string" },
|
|
112
|
-
"target-scope-kind": { type: "string" },
|
|
113
|
-
"bundle-kind": { type: "string" },
|
|
114
|
-
"resolved-target-ref": { type: "string", multiple: true, default: [] },
|
|
115
|
-
"domain-recommendation": { type: "string", default: "" },
|
|
116
|
-
"domain-final-value": { type: "string" },
|
|
117
|
-
"domain-selection-mode": { type: "string" },
|
|
118
|
-
"execution-realization": { type: "string" },
|
|
119
|
-
"execution-mode": { type: "string" },
|
|
120
|
-
"host-runtime": { type: "string" },
|
|
121
|
-
"runtime-provider": { type: "string" },
|
|
122
|
-
"auth-mode": { type: "string" },
|
|
123
|
-
"effective-worker-executor": { type: "string" },
|
|
124
|
-
codex: { type: "boolean", default: false },
|
|
125
|
-
claude: { type: "boolean", default: false },
|
|
126
|
-
"review-mode": { type: "string" },
|
|
127
|
-
"lens-id": { type: "string", multiple: true, default: [] },
|
|
128
|
-
"binding-note": { type: "string", multiple: true, default: [] },
|
|
129
|
-
},
|
|
130
|
-
strict: true,
|
|
131
|
-
allowPositionals: false,
|
|
132
|
-
});
|
|
133
|
-
const resolvedTargetRefs = values["resolved-target-ref"];
|
|
134
|
-
const resolvedLensIds = values["lens-id"];
|
|
135
|
-
if (resolvedTargetRefs.length === 0) {
|
|
136
|
-
throw new Error("At least one --resolved-target-ref is required.");
|
|
137
|
-
}
|
|
138
|
-
if (resolvedLensIds.length === 0) {
|
|
139
|
-
throw new Error("At least one --lens-id is required.");
|
|
140
|
-
}
|
|
141
|
-
const projectRoot = path.resolve(requireString(values["project-root"], "project-root"));
|
|
142
|
-
const hostRuntime = resolveHostRuntime(process.argv.slice(2), values["execution-realization"] ?? values["execution-mode"], values["host-runtime"]);
|
|
143
|
-
const executionRealization = resolveExecutionRealization(process.argv.slice(2), values["execution-realization"] ?? values["execution-mode"], hostRuntime);
|
|
144
|
-
const bindingParams = {
|
|
145
|
-
projectRoot,
|
|
146
|
-
requestedTarget: requireString(values["requested-target"], "requested-target"),
|
|
147
|
-
requestedDomainToken: optionalString(values["requested-domain-token"]),
|
|
148
|
-
targetScopeKind: requireTargetScopeKind(requireString(values["target-scope-kind"], "target-scope-kind")),
|
|
149
|
-
resolvedTargetRefs,
|
|
150
|
-
domainRecommendation: optionalString(values["domain-recommendation"]),
|
|
151
|
-
domainFinalValue: requireString(values["domain-final-value"], "domain-final-value"),
|
|
152
|
-
domainSelectionMode: requireString(values["domain-selection-mode"], "domain-selection-mode"),
|
|
153
|
-
executionRealization,
|
|
154
|
-
hostRuntime,
|
|
155
|
-
...(typeof values["runtime-provider"] === "string" &&
|
|
156
|
-
values["runtime-provider"].length > 0
|
|
157
|
-
? { runtimeProvider: values["runtime-provider"] }
|
|
158
|
-
: {}),
|
|
159
|
-
...(typeof values["auth-mode"] === "string" && values["auth-mode"].length > 0
|
|
160
|
-
? { authMode: values["auth-mode"] === "none" ? null : values["auth-mode"] }
|
|
161
|
-
: {}),
|
|
162
|
-
...(typeof values["effective-worker-executor"] === "string" &&
|
|
163
|
-
values["effective-worker-executor"].length > 0
|
|
164
|
-
? { effectiveWorkerExecutor: values["effective-worker-executor"] }
|
|
165
|
-
: {}),
|
|
166
|
-
reviewMode: requireReviewMode(requireString(values["review-mode"], "review-mode")),
|
|
167
|
-
resolvedLensIds,
|
|
168
|
-
bindingNotes: values["binding-note"],
|
|
169
|
-
...(typeof values["plugin-root"] === "string" && values["plugin-root"].length > 0
|
|
170
|
-
? { pluginRoot: values["plugin-root"] }
|
|
171
|
-
: {}),
|
|
172
|
-
...(typeof values["session-id"] === "string" && values["session-id"].length > 0
|
|
173
|
-
? { sessionId: values["session-id"] }
|
|
174
|
-
: {}),
|
|
175
|
-
...(typeof values["bundle-kind"] === "string" && values["bundle-kind"].length > 0
|
|
176
|
-
? { bundleKind: values["bundle-kind"] }
|
|
177
|
-
: {}),
|
|
178
|
-
};
|
|
179
|
-
const { sessionRoot } = await bootstrapInvocationBindingArtifacts(bindingParams);
|
|
180
|
-
console.log(sessionRoot);
|
|
181
|
-
return 0;
|
|
182
|
-
}
|
|
183
|
-
main().then((exitCode) => process.exit(exitCode), (error) => {
|
|
184
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
185
|
-
process.exit(1);
|
|
186
|
-
});
|