dna-sdk 0.1.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/LICENSE +21 -0
- package/README.md +58 -0
- package/dist/adapters/embedding/onnx.d.ts +32 -0
- package/dist/adapters/embedding/onnx.js +51 -0
- package/dist/adapters/filesystem/cache.d.ts +16 -0
- package/dist/adapters/filesystem/cache.js +113 -0
- package/dist/adapters/filesystem/index.d.ts +2 -0
- package/dist/adapters/filesystem/index.js +2 -0
- package/dist/adapters/filesystem/source.d.ts +82 -0
- package/dist/adapters/filesystem/source.js +357 -0
- package/dist/adapters/postgres/index.d.ts +2 -0
- package/dist/adapters/postgres/index.js +2 -0
- package/dist/adapters/postgres/migrations.d.ts +14 -0
- package/dist/adapters/postgres/migrations.js +88 -0
- package/dist/adapters/postgres/source.d.ts +172 -0
- package/dist/adapters/postgres/source.js +569 -0
- package/dist/adapters/resolvers/github.d.ts +12 -0
- package/dist/adapters/resolvers/github.js +47 -0
- package/dist/adapters/resolvers/http.d.ts +22 -0
- package/dist/adapters/resolvers/http.js +145 -0
- package/dist/adapters/resolvers/index.d.ts +3 -0
- package/dist/adapters/resolvers/index.js +3 -0
- package/dist/adapters/resolvers/local.d.ts +24 -0
- package/dist/adapters/resolvers/local.js +132 -0
- package/dist/adapters/search/driver.d.ts +45 -0
- package/dist/adapters/search/driver.js +138 -0
- package/dist/adapters/search/migrations.d.ts +26 -0
- package/dist/adapters/search/migrations.js +58 -0
- package/dist/adapters/search/rrf.d.ts +23 -0
- package/dist/adapters/search/rrf.js +42 -0
- package/dist/adapters/search/sqlite-vec.d.ts +66 -0
- package/dist/adapters/search/sqlite-vec.js +294 -0
- package/dist/bootstrap.d.ts +45 -0
- package/dist/bootstrap.js +134 -0
- package/dist/extensions/agentskills/DOCS.md +18 -0
- package/dist/extensions/agentskills.d.ts +28 -0
- package/dist/extensions/agentskills.js +252 -0
- package/dist/extensions/agentsmd/DOCS.md +18 -0
- package/dist/extensions/agentsmd.d.ts +22 -0
- package/dist/extensions/agentsmd.js +170 -0
- package/dist/extensions/audit/kinds/audit-log.kind.yaml +148 -0
- package/dist/extensions/audit.d.ts +25 -0
- package/dist/extensions/audit.js +62 -0
- package/dist/extensions/automation/kinds/automation.kind.yaml +296 -0
- package/dist/extensions/automation/query.d.ts +49 -0
- package/dist/extensions/automation/query.js +77 -0
- package/dist/extensions/automation/write-guards.d.ts +59 -0
- package/dist/extensions/automation/write-guards.js +153 -0
- package/dist/extensions/automation.d.ts +41 -0
- package/dist/extensions/automation.js +54 -0
- package/dist/extensions/collab.d.ts +16 -0
- package/dist/extensions/collab.js +79 -0
- package/dist/extensions/doc/kinds/doc.kind.yaml +118 -0
- package/dist/extensions/doc.d.ts +25 -0
- package/dist/extensions/doc.js +10 -0
- package/dist/extensions/eval/kinds/eval-baseline.kind.yaml +65 -0
- package/dist/extensions/eval/kinds/eval-case.kind.yaml +140 -0
- package/dist/extensions/eval/kinds/eval-run.kind.yaml +134 -0
- package/dist/extensions/eval/kinds/eval-suite.kind.yaml +87 -0
- package/dist/extensions/eval.d.ts +24 -0
- package/dist/extensions/eval.js +31 -0
- package/dist/extensions/evidence/kinds/evidence.kind.yaml +92 -0
- package/dist/extensions/evidence.d.ts +17 -0
- package/dist/extensions/evidence.js +94 -0
- package/dist/extensions/federation.d.ts +22 -0
- package/dist/extensions/federation.js +173 -0
- package/dist/extensions/guardrails/DOCS.md +20 -0
- package/dist/extensions/guardrails.d.ts +31 -0
- package/dist/extensions/guardrails.js +228 -0
- package/dist/extensions/helix/DOCS-Actor.md +20 -0
- package/dist/extensions/helix/DOCS-Agent.md +20 -0
- package/dist/extensions/helix/DOCS-UseCase.md +20 -0
- package/dist/extensions/helix/layers.d.ts +12 -0
- package/dist/extensions/helix/layers.js +18 -0
- package/dist/extensions/helix/write-guards.d.ts +70 -0
- package/dist/extensions/helix/write-guards.js +172 -0
- package/dist/extensions/helix.d.ts +29 -0
- package/dist/extensions/helix.js +963 -0
- package/dist/extensions/helix_extras.d.ts +124 -0
- package/dist/extensions/helix_extras.js +328 -0
- package/dist/extensions/hooks.d.ts +31 -0
- package/dist/extensions/hooks.js +247 -0
- package/dist/extensions/kinddef/DOCS.md +24 -0
- package/dist/extensions/kinddef.d.ts +40 -0
- package/dist/extensions/kinddef.js +171 -0
- package/dist/extensions/lesson.d.ts +6 -0
- package/dist/extensions/lesson.js +194 -0
- package/dist/extensions/modelreg/kinds/model-profile.kind.yaml +155 -0
- package/dist/extensions/modelreg.d.ts +30 -0
- package/dist/extensions/modelreg.js +38 -0
- package/dist/extensions/recognizer.d.ts +34 -0
- package/dist/extensions/recognizer.js +272 -0
- package/dist/extensions/research.d.ts +32 -0
- package/dist/extensions/research.js +292 -0
- package/dist/extensions/safety.d.ts +33 -0
- package/dist/extensions/safety.js +230 -0
- package/dist/extensions/sdlc/kinds/adr.kind.yaml +136 -0
- package/dist/extensions/sdlc/kinds/archive-proposal.kind.yaml +107 -0
- package/dist/extensions/sdlc/kinds/changelog.kind.yaml +108 -0
- package/dist/extensions/sdlc/kinds/cognitive-policy.kind.yaml +470 -0
- package/dist/extensions/sdlc/kinds/forecast.kind.yaml +125 -0
- package/dist/extensions/sdlc/kinds/insight.kind.yaml +87 -0
- package/dist/extensions/sdlc/kinds/kaizen.kind.yaml +106 -0
- package/dist/extensions/sdlc/kinds/lesson-learned.kind.yaml +270 -0
- package/dist/extensions/sdlc/kinds/narrative.kind.yaml +189 -0
- package/dist/extensions/sdlc/kinds/pattern-insight.kind.yaml +204 -0
- package/dist/extensions/sdlc/kinds/postmortem.kind.yaml +168 -0
- package/dist/extensions/sdlc/kinds/pre-mortem.kind.yaml +145 -0
- package/dist/extensions/sdlc/kinds/prompt-template.kind.yaml +109 -0
- package/dist/extensions/sdlc/kinds/retrospective.kind.yaml +186 -0
- package/dist/extensions/sdlc/kinds/risk-register.kind.yaml +178 -0
- package/dist/extensions/sdlc/kinds/saved-view.kind.yaml +127 -0
- package/dist/extensions/sdlc/kinds/status-report.kind.yaml +129 -0
- package/dist/extensions/sdlc/kinds/synthesis-run.kind.yaml +279 -0
- package/dist/extensions/sdlc/kinds/synthesizer-state.kind.yaml +196 -0
- package/dist/extensions/sdlc/kinds/workflow-event.kind.yaml +195 -0
- package/dist/extensions/sdlc.d.ts +32 -0
- package/dist/extensions/sdlc.js +1318 -0
- package/dist/extensions/soulspec/DOCS.md +19 -0
- package/dist/extensions/soulspec.d.ts +22 -0
- package/dist/extensions/soulspec.js +287 -0
- package/dist/extensions/tenant.d.ts +6 -0
- package/dist/extensions/tenant.js +291 -0
- package/dist/extensions/testkit.d.ts +24 -0
- package/dist/extensions/testkit.js +211 -0
- package/dist/index.d.ts +80 -0
- package/dist/index.js +102 -0
- package/dist/kernel/_text.d.ts +28 -0
- package/dist/kernel/_text.js +42 -0
- package/dist/kernel/bundle-handle.d.ts +83 -0
- package/dist/kernel/bundle-handle.js +184 -0
- package/dist/kernel/capabilities.d.ts +157 -0
- package/dist/kernel/capabilities.js +109 -0
- package/dist/kernel/collaborator-ports.d.ts +91 -0
- package/dist/kernel/collaborator-ports.js +1 -0
- package/dist/kernel/composition-resolver.d.ts +215 -0
- package/dist/kernel/composition-resolver.js +558 -0
- package/dist/kernel/composition.d.ts +10 -0
- package/dist/kernel/composition.js +1 -0
- package/dist/kernel/descriptor-loader.d.ts +13 -0
- package/dist/kernel/descriptor-loader.js +48 -0
- package/dist/kernel/document.d.ts +43 -0
- package/dist/kernel/document.js +71 -0
- package/dist/kernel/embedding.d.ts +28 -0
- package/dist/kernel/embedding.js +78 -0
- package/dist/kernel/errors.d.ts +62 -0
- package/dist/kernel/errors.js +82 -0
- package/dist/kernel/events.d.ts +6 -0
- package/dist/kernel/events.js +21 -0
- package/dist/kernel/evidence-capture.d.ts +69 -0
- package/dist/kernel/evidence-capture.js +138 -0
- package/dist/kernel/fs.d.ts +20 -0
- package/dist/kernel/fs.js +128 -0
- package/dist/kernel/generic-rw.d.ts +33 -0
- package/dist/kernel/generic-rw.js +235 -0
- package/dist/kernel/hooks.d.ts +172 -0
- package/dist/kernel/hooks.js +256 -0
- package/dist/kernel/index.d.ts +624 -0
- package/dist/kernel/index.js +1638 -0
- package/dist/kernel/instance.d.ts +211 -0
- package/dist/kernel/instance.js +487 -0
- package/dist/kernel/kind-registry.d.ts +183 -0
- package/dist/kernel/kind-registry.js +710 -0
- package/dist/kernel/kind_base.d.ts +106 -0
- package/dist/kernel/kind_base.js +244 -0
- package/dist/kernel/layer-resolver.d.ts +48 -0
- package/dist/kernel/layer-resolver.js +284 -0
- package/dist/kernel/lock-manager.d.ts +21 -0
- package/dist/kernel/lock-manager.js +43 -0
- package/dist/kernel/lock.d.ts +38 -0
- package/dist/kernel/lock.js +115 -0
- package/dist/kernel/meta.d.ts +135 -0
- package/dist/kernel/meta.js +817 -0
- package/dist/kernel/models.d.ts +3089 -0
- package/dist/kernel/models.js +764 -0
- package/dist/kernel/navigator.d.ts +36 -0
- package/dist/kernel/navigator.js +132 -0
- package/dist/kernel/port-surface.d.ts +33 -0
- package/dist/kernel/port-surface.js +180 -0
- package/dist/kernel/preview.d.ts +60 -0
- package/dist/kernel/preview.js +54 -0
- package/dist/kernel/prompt-budget.d.ts +39 -0
- package/dist/kernel/prompt-budget.js +43 -0
- package/dist/kernel/prompt-builder.d.ts +25 -0
- package/dist/kernel/prompt-builder.js +237 -0
- package/dist/kernel/protocols.d.ts +751 -0
- package/dist/kernel/protocols.js +493 -0
- package/dist/kernel/reports.d.ts +26 -0
- package/dist/kernel/reports.js +215 -0
- package/dist/kernel/resolver.d.ts +146 -0
- package/dist/kernel/resolver.js +232 -0
- package/dist/kernel/resource.d.ts +57 -0
- package/dist/kernel/resource.js +97 -0
- package/dist/kernel/runtime.d.ts +16 -0
- package/dist/kernel/runtime.js +18 -0
- package/dist/kernel/safety-scanner.d.ts +38 -0
- package/dist/kernel/safety-scanner.js +228 -0
- package/dist/kernel/serialize-to-files.d.ts +29 -0
- package/dist/kernel/serialize-to-files.js +23 -0
- package/dist/kernel/spec-access.d.ts +23 -0
- package/dist/kernel/spec-access.js +40 -0
- package/dist/kernel/studio_ui.d.ts +88 -0
- package/dist/kernel/studio_ui.js +135 -0
- package/dist/kernel/templates.d.ts +77 -0
- package/dist/kernel/templates.js +116 -0
- package/dist/kernel/tool-registry.d.ts +52 -0
- package/dist/kernel/tool-registry.js +89 -0
- package/dist/kernel/write-pipeline.d.ts +65 -0
- package/dist/kernel/write-pipeline.js +271 -0
- package/dist/kernel/writer-helpers.d.ts +24 -0
- package/dist/kernel/writer-helpers.js +42 -0
- package/dist/memory/decay.d.ts +31 -0
- package/dist/memory/decay.js +97 -0
- package/dist/memory/ecphory.d.ts +25 -0
- package/dist/memory/ecphory.js +178 -0
- package/dist/memory/encodingContext.d.ts +21 -0
- package/dist/memory/encodingContext.js +62 -0
- package/dist/memory/index.d.ts +23 -0
- package/dist/memory/index.js +23 -0
- package/dist/memory/memoryType.d.ts +7 -0
- package/dist/memory/memoryType.js +24 -0
- package/dist/memory/policy.d.ts +35 -0
- package/dist/memory/policy.js +35 -0
- package/dist/memory/retrieval.d.ts +21 -0
- package/dist/memory/retrieval.js +145 -0
- package/dist/testing/index.d.ts +8 -0
- package/dist/testing/index.js +8 -0
- package/dist/testing/recordSearchConformance.d.ts +43 -0
- package/dist/testing/recordSearchConformance.js +147 -0
- package/dist/viz/ascii.d.ts +7 -0
- package/dist/viz/ascii.js +60 -0
- package/dist/viz/health.d.ts +8 -0
- package/dist/viz/health.js +161 -0
- package/dist/viz/index.d.ts +10 -0
- package/dist/viz/index.js +10 -0
- package/dist/viz/matrix.d.ts +8 -0
- package/dist/viz/matrix.js +84 -0
- package/dist/viz/mermaid.d.ts +38 -0
- package/dist/viz/mermaid.js +706 -0
- package/package.json +82 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The kernel's unified composition motor — TS twin of
|
|
3
|
+
* `packages/sdk-py/dna/kernel/composition_resolver.py`
|
|
4
|
+
* (s-unify-composition-subsystems). One module, four composition
|
|
5
|
+
* concerns:
|
|
6
|
+
*
|
|
7
|
+
* 1. CompositionProfile (V1) — declarative wiring + UI hints
|
|
8
|
+
* registered by extensions (moved here from `composition.ts`,
|
|
9
|
+
* now a deprecated re-export shim).
|
|
10
|
+
* 2. `validateRefs` — THE shared cross-kind ref validation core;
|
|
11
|
+
* target resolution via `resolveDepFilterTargetOver`
|
|
12
|
+
* (kind-registry.ts) — the same canonical resolver the Kernel
|
|
13
|
+
* uses, so alias + legacy `kind=` resolve identically everywhere.
|
|
14
|
+
* 3. CompositionEngine — the `mi.composition` namespace (moved here
|
|
15
|
+
* from `composition-engine.ts`, deleted).
|
|
16
|
+
* 4. CompositionResolver — the Composition-V2 chain-resolution engine.
|
|
17
|
+
*
|
|
18
|
+
* Pure resolution types + merges stay in `resolver.ts` (Py:
|
|
19
|
+
* `kernel/resolver.py`).
|
|
20
|
+
*
|
|
21
|
+
* Record-plane rule (two-planes F2.5) — ONE rule for every reader: a ref
|
|
22
|
+
* whose TARGET Kind is plane="record" resolves when present in the doc
|
|
23
|
+
* index and is DEFERRED otherwise (never false-missing).
|
|
24
|
+
*
|
|
25
|
+
* # CompositionResolver — Composition-V2 (Phase 17 /
|
|
26
|
+
* s-ts-composition-v2-port).
|
|
27
|
+
*
|
|
28
|
+
* Behavior parity is 1:1 with the Python engine on the RESOLUTION SEMANTICS:
|
|
29
|
+
* chain walk (`computeResolutionChain` — cycle guard + MAX_RESOLUTION_DEPTH +
|
|
30
|
+
* V1 fallback to `_lib`), composition-rule lookup (`getCompositionRule` —
|
|
31
|
+
* LayerPolicy.composition_rules else the inherit-by-default denylist),
|
|
32
|
+
* `resolveDocument` (bootstrap bypass, tenant overlay, Catalog splice
|
|
33
|
+
* Local > Catalog > Base, override_full / field_level merge, provenance) and
|
|
34
|
+
* `personalizeDocument`. The behavioral gate is the shared fixture harness
|
|
35
|
+
* `tests/parity-fixtures/composition/` (s-parity-behavioral-harness), executed
|
|
36
|
+
* by BOTH `packages/sdk-py/tests/test_composition_parity_fixtures.py` and
|
|
37
|
+
* `packages/sdk-ts/tests/composition-parity-fixtures.test.ts`.
|
|
38
|
+
*
|
|
39
|
+
* Documented divergences from Python — PERF / infra, NOT semantics:
|
|
40
|
+
*
|
|
41
|
+
* 1. **No granular layer cache.** The Py kernel reads each layer through
|
|
42
|
+
* `_granular_doc_cached` (LRU 2000 / TTL 60s / single-flight). The TS
|
|
43
|
+
* kernel has no kernel-level doc cache, so `Kernel._granularDoc` hits the
|
|
44
|
+
* source directly on every layer read. Same inputs → same outputs; each
|
|
45
|
+
* resolve just costs O(chain) source reads instead of cache hits.
|
|
46
|
+
* 2. **No `_layer_observers` reverse-dep graph.** That structure exists purely
|
|
47
|
+
* to invalidate the Py granular cache across scopes on parent/catalog
|
|
48
|
+
* writes; with no cache there is nothing to invalidate. It is intentionally
|
|
49
|
+
* NOT ported (would be dead state).
|
|
50
|
+
* 3. **Catalog tier surface.** The TS kernel has no catalog machinery yet
|
|
51
|
+
* (package scan + tenant lockfile — deferred as `i-185`). The splice HOOK
|
|
52
|
+
* is fully implemented here (identical to Py: insert after the local
|
|
53
|
+
* entries, before the first parent, conflict surfacing on ≥2 hits) but
|
|
54
|
+
* `Kernel._catalogScopes` returns `[]` until i-185 lands, so the Catalog
|
|
55
|
+
* tier contributes no layers on TS today.
|
|
56
|
+
* 4. **`personalizeDocument` clones spec + envelope only.** The Py engine also
|
|
57
|
+
* clones binary bundle entries via `source._load_bundle_entries` +
|
|
58
|
+
* `kernel.write_bundle_entry_async`; the TS kernel has no bundle-entry
|
|
59
|
+
* write surface yet, so bundle payload cloning is Py-only (best-effort in
|
|
60
|
+
* Py anyway — failures there are swallowed).
|
|
61
|
+
*/
|
|
62
|
+
import { ResolvedDocument } from "./resolver.js";
|
|
63
|
+
import type { CompositionResolverHost } from "./collaborator-ports.js";
|
|
64
|
+
import type { Document } from "./document.js";
|
|
65
|
+
import type { CompositionResult, KindPort } from "./protocols.js";
|
|
66
|
+
import type { ManifestInstance } from "./instance.js";
|
|
67
|
+
/** Timeline rendering hints for a composition slot. */
|
|
68
|
+
export interface TimelineHint {
|
|
69
|
+
readonly label: string;
|
|
70
|
+
readonly itemLabel: string;
|
|
71
|
+
}
|
|
72
|
+
/** Health check rule for a composition slot. */
|
|
73
|
+
export interface HealthCheckHint {
|
|
74
|
+
/** "at-least-one": agent must reference ≥1 doc of this slot.
|
|
75
|
+
* "has-error-severity": at least one doc of this kind with
|
|
76
|
+
* severity=error must be referenced. */
|
|
77
|
+
readonly rule: "at-least-one" | "has-error-severity";
|
|
78
|
+
readonly severity: "warn" | "error";
|
|
79
|
+
/** Key in the health report output dict. e.g. "agents_without_guardrails". */
|
|
80
|
+
readonly issueKey: string;
|
|
81
|
+
/** Human message for the issue. */
|
|
82
|
+
readonly message: string;
|
|
83
|
+
}
|
|
84
|
+
/** Quadrant chart configuration for a composition slot. */
|
|
85
|
+
export interface QuadrantHint {
|
|
86
|
+
readonly axis: "x" | "y";
|
|
87
|
+
/** Axis label. e.g. "Few Skills --> Many Skills". */
|
|
88
|
+
readonly label: string;
|
|
89
|
+
/** Divide doc count by this to normalize to 0..1 range. */
|
|
90
|
+
readonly maxScale: number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* A named slot in a composition profile. Each slot describes how an
|
|
94
|
+
* orchestrator kind connects to a target kind.
|
|
95
|
+
*/
|
|
96
|
+
export interface CompositionSlot {
|
|
97
|
+
/** The spec field name on the orchestrator that holds refs to this kind.
|
|
98
|
+
* e.g. "skills", "soul", "guardrails". */
|
|
99
|
+
readonly name: string;
|
|
100
|
+
/** Alias of the target KindPort. e.g. "agentskills-skill". */
|
|
101
|
+
readonly targetAlias: string;
|
|
102
|
+
/** "one" = scalar ref (soul), "many" = array ref (skills, guardrails). */
|
|
103
|
+
readonly cardinality: "one" | "many";
|
|
104
|
+
/** Rendering order in timeline diagrams. Lower = earlier. */
|
|
105
|
+
readonly order: number;
|
|
106
|
+
/** If true, buildPrompt callers can filter this slot via enabledSlots. */
|
|
107
|
+
readonly filterable: boolean;
|
|
108
|
+
/** Timeline rendering hints. Null = skip this slot in timelines. */
|
|
109
|
+
readonly timeline: TimelineHint | null;
|
|
110
|
+
/** Health check rule. Null = no health check for this slot. */
|
|
111
|
+
readonly healthCheck: HealthCheckHint | null;
|
|
112
|
+
/** Quadrant chart configuration. Null = not plotted. */
|
|
113
|
+
readonly quadrant: QuadrantHint | null;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* A CompositionProfile describes how an orchestrator kind connects to
|
|
117
|
+
* other kinds. Registered by extensions via kernel.compositionProfile().
|
|
118
|
+
*/
|
|
119
|
+
export interface CompositionProfile {
|
|
120
|
+
/** Alias of the orchestrator KindPort. e.g. "helix-agent". */
|
|
121
|
+
readonly orchestratorAlias: string;
|
|
122
|
+
/** Human-readable label for the profile. e.g. "Helix Agent". */
|
|
123
|
+
readonly label: string;
|
|
124
|
+
/** Ordered list of composition slots. */
|
|
125
|
+
readonly slots: readonly CompositionSlot[];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Find the profile whose orchestrator matches a given alias.
|
|
129
|
+
* Returns null if none registered. Pure helper — no kernel dependency.
|
|
130
|
+
*/
|
|
131
|
+
export declare function profileForOrchestrator(profiles: readonly CompositionProfile[], orchestratorAlias: string): CompositionProfile | null;
|
|
132
|
+
/**
|
|
133
|
+
* Validate declared dep_filter refs of `docs` against `docIndex`
|
|
134
|
+
* (`${kind}\0${name}` keys). The ONE implementation behind
|
|
135
|
+
* `mi.composition.validate()` — target resolution via
|
|
136
|
+
* `resolveDepFilterTargetOver` (canonical s-alias resolver: alias
|
|
137
|
+
* contract + deprecated `kind=` shim). Unresolvable target → warnings;
|
|
138
|
+
* ref in index → resolved; absent + record-plane target → deferred
|
|
139
|
+
* (records resolve lazily via the kernel record plane — never
|
|
140
|
+
* false-missing); absent otherwise → missing.
|
|
141
|
+
* Py twin: `composition_resolver.validate_refs`.
|
|
142
|
+
*/
|
|
143
|
+
export declare function validateRefs(docs: Iterable<Document>, docIndex: Set<string>, kinds: Map<string, KindPort>): CompositionResult;
|
|
144
|
+
export declare class CompositionEngine {
|
|
145
|
+
private host;
|
|
146
|
+
constructor(host: ManifestInstance);
|
|
147
|
+
/**
|
|
148
|
+
* Validate all composition references over the MI plane.
|
|
149
|
+
* Equivalent to `mi.compositionResult`. Delegates to `validateRefs` —
|
|
150
|
+
* records are excluded from the MI materialization, so record-target
|
|
151
|
+
* refs land in `deferred` (they resolve lazily via the kernel record
|
|
152
|
+
* plane at read time).
|
|
153
|
+
*/
|
|
154
|
+
validate(): CompositionResult;
|
|
155
|
+
/**
|
|
156
|
+
* Iterate a document's declared dep_filters dynamically.
|
|
157
|
+
* Equivalent to `mi.iterDocDeps(doc)`.
|
|
158
|
+
*/
|
|
159
|
+
iterDocDeps(doc: Document): {
|
|
160
|
+
label: string;
|
|
161
|
+
targetKind: string;
|
|
162
|
+
names: string[];
|
|
163
|
+
}[];
|
|
164
|
+
/**
|
|
165
|
+
* Walk the manifest and return every doc that references this one.
|
|
166
|
+
* Equivalent to `mi.consumersOf(kind, name)`.
|
|
167
|
+
*/
|
|
168
|
+
consumersOf(kind: string, name: string): Array<{
|
|
169
|
+
kind: string;
|
|
170
|
+
name: string;
|
|
171
|
+
}>;
|
|
172
|
+
/**
|
|
173
|
+
* Build a dependency tree for the manifest.
|
|
174
|
+
* Equivalent to `mi.dependencyTree()`.
|
|
175
|
+
*/
|
|
176
|
+
dependencyTree(): Record<string, unknown>;
|
|
177
|
+
}
|
|
178
|
+
export declare class CompositionResolver {
|
|
179
|
+
private readonly _k;
|
|
180
|
+
constructor(kernel: CompositionResolverHost);
|
|
181
|
+
/**
|
|
182
|
+
* Walk `Genome.spec.parent_scope` transitively → ordered chain of
|
|
183
|
+
* `[scope, tenant]` pairs, HIGHEST priority first. Cycle-guarded; depth
|
|
184
|
+
* capped at MAX_RESOLUTION_DEPTH; missing Genome terminates the walk.
|
|
185
|
+
* 1:1 with Py `compute_resolution_chain`.
|
|
186
|
+
*/
|
|
187
|
+
computeResolutionChain(scope: string, tenant: string | null): Promise<Array<[string, string | null]>>;
|
|
188
|
+
/**
|
|
189
|
+
* Resolve `[scope_inheritance, merge_strategy, tenant_overlay]` for
|
|
190
|
+
* (scope, kind) — from the scope's LayerPolicy composition_rules, else
|
|
191
|
+
* the inherit-by-default denylist (everything inherits from _lib except
|
|
192
|
+
* the per-scope ledger + structural Kinds). 1:1 with Py
|
|
193
|
+
* `get_composition_rule`.
|
|
194
|
+
*/
|
|
195
|
+
getCompositionRule(scope: string, kind: string): Promise<[string, string, string]>;
|
|
196
|
+
/**
|
|
197
|
+
* Resolve a doc through the composition chain (Phase 17). Returns a
|
|
198
|
+
* ResolvedDocument with merged doc + full provenance. Bootstrap Kinds
|
|
199
|
+
* bypass inheritance (local-only). 1:1 with Py `resolve_document`.
|
|
200
|
+
*/
|
|
201
|
+
resolveDocument(scope: string, kind: string, name: string, opts?: {
|
|
202
|
+
tenant?: string | null;
|
|
203
|
+
}): Promise<ResolvedDocument>;
|
|
204
|
+
/**
|
|
205
|
+
* Clone an inherited doc into `targetScope` as a local override
|
|
206
|
+
* (Phase 17). Throws if the doc isn't inherited / target exists (without
|
|
207
|
+
* overwrite). Clones spec + envelope atomically via `writeDocument`.
|
|
208
|
+
* 1:1 with Py `personalize_document` EXCEPT bundle-entry payload cloning
|
|
209
|
+
* (Py-only — see divergence #4 in the module docstring).
|
|
210
|
+
*/
|
|
211
|
+
personalizeDocument(targetScope: string, kind: string, name: string, opts?: {
|
|
212
|
+
tenant?: string | null;
|
|
213
|
+
overwrite?: boolean;
|
|
214
|
+
}): Promise<ResolvedDocument>;
|
|
215
|
+
}
|