@teqfw/di 2.5.1 → 2.6.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/ai/AGENTS.md CHANGED
@@ -1,94 +1,62 @@
1
1
  # AGENTS.md
2
2
 
3
- Version: 20260331
3
+ Version: 20260606
4
4
 
5
- ## Package Purpose
5
+ ## Purpose
6
6
 
7
- This directory provides the **Agent Interface** of the package. It contains a compact usage-oriented description intended for LLM agents that use the package as a dependency. The documents describe how the package is applied by external code and exclude development methodology, repository organization, testing infrastructure, and other internal aspects of the project.
7
+ This file defines the `ai/` level for agent-facing package documentation included in the distributable package.
8
8
 
9
- The package implements a **deterministic runtime dependency linker for ES modules** based on late binding. Dependencies between modules are resolved by the container using structured dependency identifiers and namespace resolution rules rather than application-level static imports. The container dynamically loads ES modules, instantiates exports according to CDC semantics, and returns linked frozen values.
9
+ The `ai/` directory provides a compact machine-oriented interface for agents that need to understand and use the package correctly.
10
10
 
11
- ## When to Use This Package
11
+ ## Level Boundary
12
12
 
13
- This package should be used when a system requires the following capabilities:
13
+ This level defines:
14
14
 
15
- - runtime dependency injection
16
- - late binding between ES modules
17
- - deterministic dependency resolution
18
- - controlled instantiation of components
19
- - modules that remain environment-agnostic across Node.js and browser runtimes
20
- - explicit machine-readable dependency structure for agent-assisted maintenance
15
+ - what documents exist in `ai/`;
16
+ - what each document is for;
17
+ - how an agent should navigate this directory;
18
+ - which documents describe supported usage.
21
19
 
22
- The container serves as the **composition root** of the application. Application modules declare dependencies and receive instantiated objects from the container rather than resolving dependencies directly.
20
+ This level does not define:
23
21
 
24
- This package is primarily a fit for:
22
+ - repository organization;
23
+ - development workflow;
24
+ - testing strategy;
25
+ - internal implementation details that are not part of the supported surface;
26
+ - behavior not described by the documents in `ai/`.
25
27
 
26
- - modular monolith web applications
27
- - isomorphic JavaScript systems with shared browser/server code
28
- - pure JavaScript + JSDoc codebases
28
+ ## Level Map
29
29
 
30
- It is usually not a natural fit for TypeScript-first architectures built around decorators, metadata, or framework-managed DI conventions.
30
+ - `AGENTS.md` entry point for this level; defines scope, navigation, and authority.
31
+ - `concepts.md` — core concepts behind runtime linking and dependency contracts.
32
+ - `container.md` — container lifecycle, state model, and resolution pipeline.
33
+ - `dependency-id.md` — normative CDC grammar and interpretation rules.
34
+ - `extensions.md` — preprocess hooks, postprocess hooks, and wrapper exports.
35
+ - `package-api.ts` — machine-readable contract of the supported programmatic surface.
36
+ - `usage.md` — canonical usage patterns and short integration recipes.
31
37
 
32
- ## Architectural Model
38
+ ## Reading Guide
33
39
 
34
- The system is based on four mechanisms:
40
+ Read documents by task:
35
41
 
36
- - **Late binding of dependencies at runtime**, allowing modules to remain independent of specific implementations.
37
- - **A container responsible for dependency resolution and instantiation**, which loads modules and produces linked objects.
38
- - **Structured dependency identifiers**, interpreted by the container to determine how a dependency must be resolved.
39
- - **Namespace mapping rules**, which deterministically translate identifiers into module locations.
42
+ - for supported imports and public surface, start with `package-api.ts`;
43
+ - for CDC syntax and meaning, read `dependency-id.md`;
44
+ - for runtime behavior of the container, read `container.md`;
45
+ - for extension behavior, read `extensions.md`;
46
+ - for practical integration examples, read `usage.md`;
47
+ - for conceptual orientation, read `concepts.md`.
40
48
 
41
- Together these mechanisms form a deterministic runtime linking system for ES modules.
49
+ If the task is broad or unclear, read in this order:
42
50
 
43
- ## Runtime Linking Model
51
+ 1. `AGENTS.md`
52
+ 2. `package-api.ts`
53
+ 3. `usage.md`
54
+ 4. `dependency-id.md`
55
+ 5. `container.md`
56
+ 6. remaining documents as needed
44
57
 
45
- The container acts as a runtime linker for ES modules.
58
+ ## Authority
46
59
 
47
- Instead of relying on static `import` statements, modules declare dependency contracts through `__deps__` descriptors and CDC identifiers. When a dependency is requested, the container resolves the identifier, loads the required module, constructs the object graph, and returns the linked result.
60
+ The documents in `ai/` define the supported agent-facing usage semantics of the package.
48
61
 
49
- In this model:
50
-
51
- - ES modules provide implementations.
52
- - CDC identifiers define dependency contracts.
53
- - the container performs deterministic runtime linking.
54
- - linked values are frozen before they are returned.
55
-
56
- This mechanism separates module implementation from dependency binding and allows systems to assemble component graphs dynamically while preserving deterministic behavior.
57
-
58
- ## Reading Order
59
-
60
- Agents should read the documents in this directory in the following order:
61
-
62
- 1. **AGENTS.md** — overview of the package and navigation of the Agent Interface.
63
- 2. **package-api.ts** — machine-readable contract of the supported programmatic API, public entrypoints, structural contracts, and internal exclusions.
64
- 3. **concepts.md** — architectural concepts and design principles.
65
- 4. **container.md** — container responsibilities and dependency resolution pipeline.
66
- 5. **dependency-id.md** — syntax and semantics of dependency identifiers.
67
- 6. **extensions.md** — extension mechanisms such as preprocessors and wrappers.
68
- 7. **usage.md** — minimal usage scenarios and examples.
69
-
70
- This sequence reflects the intended agent workflow: contract surface first, then architectural model, operational mechanism, dependency addressing, extension points, and practical usage.
71
-
72
- Agents that need a working integration should prefer:
73
-
74
- 1. `package-api.ts` for the programmatic surface,
75
- 2. `usage.md` for examples,
76
- 3. `dependency-id.md` for CDC details,
77
- 4. `container.md` for behavioral guarantees.
78
-
79
- ## Interface Scope
80
-
81
- The documents in this directory define the supported usage semantics of the package. Behaviors not described here should be treated as undefined and should not be inferred. The interface intentionally contains only the information required to correctly apply the package in external code.
82
-
83
- ## Relation to TeqFW
84
-
85
- The package follows architectural principles used in the **Tequila Framework (TeqFW)** platform, including:
86
-
87
- - late binding between components
88
- - separation of data structures and logic handlers
89
- - namespace-based module organization
90
- - development in modern JavaScript without compilation
91
-
92
- Understanding the broader TeqFW ecosystem is not required to use the package, but the container follows the same architectural philosophy.
93
-
94
- For agent usage, this directory is the package's machine-oriented interface. Prefer these documents over inferring behavior from repository-level prose.
62
+ Agents should rely on these documents for package use and should treat behavior not described here as undefined.
package/ai/concepts.md CHANGED
@@ -1,68 +1,25 @@
1
1
  # concepts.md
2
2
 
3
- Version: 20260331
4
-
5
- ## Purpose of the Container
6
-
7
- The container provides a deterministic mechanism for linking ES modules at runtime. Instead of static imports between modules, dependencies are resolved through a central container that loads modules, instantiates exported factories, and returns linked objects. This approach separates module implementation from dependency resolution and allows systems to assemble components dynamically.
3
+ Version: 20260606
8
4
 
9
5
  ## Late Binding
10
6
 
11
- Dependencies between modules are resolved at runtime rather than during module loading. Modules do not import their collaborators directly and therefore remain independent of concrete implementations. The container performs dependency resolution when an object is requested, which allows components to be replaced, extended, or mocked without modifying module code.
12
-
13
- Late binding enables the following properties:
14
-
15
- - reduced coupling between modules
16
- - runtime replacement of implementations
17
- - simplified testing through dependency substitution
18
- - compatibility with different runtime environments
19
-
20
- ## Dependency Container
21
-
22
- The container acts as the composition root of the application. It receives dependency requests expressed as identifiers, resolves them into module locations, loads the corresponding ES modules, and produces linked objects.
23
-
24
- The container is responsible for:
25
-
26
- - translating dependency identifiers into module references
27
- - loading ES modules dynamically
28
- - instantiating exported factories
29
- - applying preprocessing and postprocessing steps
30
- - returning fully linked objects to the caller
31
-
32
- Application modules do not construct their dependencies directly and do not perform dependency resolution.
33
-
34
- ## Dependency Identifiers
35
-
36
- Dependencies are addressed using structured identifiers interpreted by the container. An identifier describes how the dependency should be resolved and how the resulting object should be instantiated.
37
-
38
- Dependency identifiers define:
39
-
40
- - which module provides the dependency
41
- - which export must be used
42
- - whether the dependency represents a singleton or a new instance
43
-
44
- Module dependency descriptors complement CDCs by declaring export-scoped dependency maps. The canonical form is hierarchical and keyed by export name; a flat descriptor is shorthand for limited single-export cases; omission means there are no dependencies.
45
-
46
- The identifier syntax and resolution rules are described in **dependency-id.md**.
7
+ Dependencies are resolved at runtime rather than through direct static imports between application modules. This keeps modules independent of concrete implementations and moves dependency binding into the container.
47
8
 
48
- ## Namespaces
9
+ ## Runtime Linker
49
10
 
50
- Namespaces provide deterministic mapping between logical identifiers and module locations. Each package defines one or more namespace roots that map a CDC prefix to a module-specifier base.
11
+ The container acts as a runtime linker for ES modules. It interprets CDC identifiers, resolves modules, selects exports, and produces linked values for callers.
51
12
 
52
- The container resolves identifiers by applying namespace rules that translate identifier prefixes into module specifiers. In Node.js this often means filesystem-backed paths. In browser-oriented or isomorphic systems this may also mean URL-based import roots.
13
+ ## Dependency Contracts
53
14
 
54
- Namespace resolution ensures:
15
+ Dependencies are declared through CDC strings and module-level `__deps__` descriptors. Together they form the contract between module code and runtime composition.
55
16
 
56
- - predictable module addressing
57
- - isolation between packages
58
- - consistent mapping between identifiers and modules
17
+ The canonical `__deps__` form is hierarchical and keyed by export name.
59
18
 
60
- ## Immutable Linked Objects
19
+ ## Namespace Mapping
61
20
 
62
- Objects returned by the container represent linked components of the application and are treated as immutable values. After an object is created and linked, it is frozen to prevent runtime modification.
21
+ Logical module identifiers are translated into module-specifier bases through namespace roots. This keeps dependency addressing independent from concrete filesystem paths or URL locations.
63
22
 
64
- Immutability ensures that:
23
+ ## Immutable Linked Values
65
24
 
66
- - components behave consistently after linking
67
- - shared instances cannot be altered by consumers
68
- - the container remains the single authority responsible for object construction
25
+ Values returned by the container are frozen after linking. Consumers should treat them as stable resolved values rather than mutable construction targets.
package/ai/container.md CHANGED
@@ -1,75 +1,84 @@
1
1
  # container.md
2
2
 
3
- Version: 20260331
3
+ Version: 20260606
4
4
 
5
- ## Role of the Container
5
+ ## Role
6
6
 
7
- The container provides the operational mechanism that links ES modules at runtime. It resolves dependency identifiers, loads modules, instantiates exported factories, and returns fully linked objects. The container serves as the composition root of the system and centralizes all dependency resolution.
7
+ The container is the runtime composition root of the package. It interprets CDC identifiers, resolves them into modules, produces linked values, and returns frozen results.
8
8
 
9
- Application modules do not resolve dependencies themselves and do not construct collaborators directly. Instead, they request dependencies from the container using dependency identifiers.
9
+ Application modules do not resolve dependencies themselves. They declare dependency contracts and rely on the container to perform linking.
10
10
 
11
- ## Container Responsibilities
11
+ ## Configuration Stage
12
12
 
13
- The container performs the following responsibilities:
13
+ Before the first `get()`, the container is in builder stage.
14
14
 
15
- - interpret dependency identifiers
16
- - resolve identifiers into module locations
17
- - load ES modules dynamically
18
- - instantiate exported factories
19
- - apply preprocess and postprocess handlers
20
- - manage object lifecycle semantics
21
- - freeze linked objects before returning them
15
+ During this stage external code may:
22
16
 
23
- These responsibilities ensure deterministic runtime linking between modules.
17
+ - register namespace roots with `addNamespaceRoot()`;
18
+ - replace the CDC parser with `setParser()`;
19
+ - add preprocess hooks with `addPreprocess()`;
20
+ - add postprocess hooks with `addPostprocess()`;
21
+ - enable diagnostics with `enableLogging()`;
22
+ - enable test-only mock registration with `enableTestMode()` and `register()`.
24
23
 
25
- ## Dependency Resolution Pipeline
24
+ On the first `get()`:
26
25
 
27
- When a dependency is requested, the container processes the request through a deterministic pipeline consisting of the following stages:
26
+ - configuration is locked;
27
+ - namespace rules are snapshotted;
28
+ - internal resolution infrastructure is created.
28
29
 
29
- 1. **Parse** interpret the dependency identifier.
30
- 2. **Preprocess** — allow registered preprocess handlers to transform the identifier.
31
- 3. **Resolve** — translate the identifier into a module reference.
32
- 4. **Instantiate** — load the module and create the object using the selected export.
33
- 5. **Postprocess** — apply wrapper handlers to the created object.
34
- 6. **Lifecycle** — apply lifecycle semantics such as singleton caching or instance creation.
35
- 7. **Freeze** — freeze the resulting object before returning it.
30
+ After the first `get()`, builder-stage methods are no longer supported.
36
31
 
37
- This pipeline ensures that all dependencies are created and linked through a consistent process.
32
+ ## Resolution Pipeline
38
33
 
39
- ## Container API
34
+ For each `get(cdc)` request the container applies this pipeline:
40
35
 
41
- The container exposes a minimal public interface used by application code and configuration code.
36
+ 1. `Parse` convert the CDC string into a DepId DTO.
37
+ 2. `Preprocess hooks` — transform the DepId DTO through ordered `addPreprocess()` hooks.
38
+ 3. `Resolve` — map the identifier to a concrete module location.
39
+ 4. `Instantiate` — load the module and either return the selected export as-is or instantiate it according to lifecycle composition rules.
40
+ 5. `Postprocess hooks` — apply ordered `addPostprocess()` value transforms.
41
+ 6. `Wrapper exports` — apply ordered wrapper exports selected by CDC suffixes.
42
+ 7. `Lifecycle` — apply singleton caching or transient behavior.
43
+ 8. `Freeze` — freeze the resolved value before returning it.
42
44
 
43
- The core operations are:
45
+ The pipeline is deterministic for a fixed configuration and input CDC.
44
46
 
45
- - **addNamespaceRoot(prefix, target, defaultExt)** — register namespace resolution rule for Teq modules.
46
- - **register(identifier, value)** — register a predefined dependency or instance in the container.
47
- - **get(identifier)** — resolve a dependency identifier and return the linked object.
48
- - **addPreprocess(handler)** — register a handler that can transform dependency identifiers before resolution.
49
- - **addPostprocess(handler)** — register a handler that can modify created objects after instantiation.
47
+ ## State Model
50
48
 
51
- The exact semantics of dependency identifiers are defined in **dependency-id.md**. Dependency descriptors are export-scoped: canonical descriptors are hierarchical and keyed by export name, while flat descriptors are shorthand for limited single-export cases.
49
+ The container operates in three states:
52
50
 
53
- `addNamespaceRoot(prefix, target, defaultExt)` accepts a module-specifier base. The `target` may point to a filesystem-backed path or to a URL-backed import base depending on runtime environment.
51
+ - `builder` configuration is still mutable.
52
+ - `operational` — dependency resolution is active.
53
+ - `failed` — a fatal pipeline error has occurred.
54
54
 
55
- ## Container State Model
55
+ State transitions:
56
56
 
57
- The container operates in three states:
57
+ - construction starts in `builder`;
58
+ - the first successful or failed `get()` transitions the container out of mutable builder configuration;
59
+ - a fatal resolution error moves the container to `failed`.
58
60
 
59
- - **notConfigured** — the container is being configured and dependencies may be registered.
60
- - **operational** — the container resolves dependencies and produces linked objects.
61
- - **failed** — the container has encountered an unrecoverable error.
61
+ ## Freeze Semantics
62
62
 
63
- If an error occurs during dependency resolution or any pipeline stage, the container transitions to the **failed** state. Once the container enters this state, all subsequent dependency requests are rejected.
63
+ Values returned by the container are frozen before they are returned to callers.
64
64
 
65
- This fail-fast behavior prevents partially linked systems from continuing execution.
65
+ Freeze happens after:
66
+
67
+ - instantiation;
68
+ - postprocess hooks;
69
+ - wrapper exports;
70
+ - lifecycle application.
66
71
 
67
- ## Object Linking and Freezing
72
+ This means consumers receive stable linked values and should not mutate them.
68
73
 
69
- Objects returned by the container represent linked components of the application. After an object is created and all pipeline stages are completed, the container freezes the object before returning it.
74
+ ## Failure Semantics
70
75
 
71
- Freezing ensures that:
76
+ If any fatal error occurs during parsing, preprocessing, resolution, instantiation, postprocessing, wrapping, or lifecycle handling, the container enters `failed` state.
72
77
 
73
- - linked objects cannot be modified by consumers
74
- - shared instances remain stable
75
- - the container remains the only authority responsible for object construction and linking
78
+ Once in `failed` state:
79
+
80
+ - the current `get()` request rejects;
81
+ - all subsequent `get()` calls reject;
82
+ - the container does not attempt partial recovery.
83
+
84
+ This fail-fast behavior prevents partially linked systems from continuing execution.
@@ -1,56 +1,52 @@
1
1
  # dependency-id.md
2
2
 
3
- Version: 20260331
3
+ Version: 20260606
4
4
 
5
5
  ## Purpose
6
6
 
7
- Dependencies in the container are addressed using **Canonical Dependency Codes (CDC)**. A CDC is a structured identifier interpreted by the container to determine which module must be loaded, which export must be used, and how the resulting object must be instantiated.
7
+ Dependencies in the container are addressed using **Canonical Dependency Codes (CDC)**. A CDC is a structured identifier interpreted by the container to determine which module must be loaded, which export must be selected, and whether the resolved value is returned as-is or instantiated with lifecycle semantics.
8
8
 
9
- CDC provides a stable logical addressing mechanism that is independent of file paths and runtime environments.
10
-
11
- ## Canonical Form
12
-
13
- A CDC follows the canonical structure:
9
+ ## Grammar
14
10
 
15
11
  ```txt
16
- [PlatformPrefix]ModuleName[__ExportName][Lifecycle][WrapperSuffixes]
12
+ CDC := [PlatformPrefix]ModuleName[__ExportName][Lifecycle][WrapperSuffixes]
17
13
  ```
18
14
 
19
- The components have the following roles:
15
+ Component order is fixed.
16
+
17
+ - `PlatformPrefix` is optional.
18
+ - `__ExportName` is optional.
19
+ - `Lifecycle` is optional.
20
+ - `WrapperSuffixes` are optional and require a lifecycle marker.
20
21
 
21
- - **PlatformPrefix** — optional prefix identifying a platform module source.
22
- - **ModuleName** — logical module identifier within a namespace.
23
- - **ExportName** — optional named export selector.
24
- - **Lifecycle** — marker defining instantiation semantics.
25
- - **WrapperSuffixes** — optional sequence of wrapper identifiers.
22
+ ## Components
26
23
 
27
- Each CDC is interpreted deterministically by the container.
24
+ - `PlatformPrefix` optional source selector such as `node:` or `npm:`.
25
+ - `ModuleName` — logical module identifier inside a namespace.
26
+ - `__ExportName` — optional named export selector. Omission means the default export for composition, or whole-module namespace for as-is resolution.
27
+ - `Lifecycle` — optional instantiation marker.
28
+ - `WrapperSuffixes` — optional ordered wrapper export names appended after the lifecycle marker.
28
29
 
29
- ## Platform Prefix
30
+ ## Platform Prefixes
30
31
 
31
- A CDC may reference modules provided by the runtime platform or external packages.
32
+ Supported prefixes:
32
33
 
33
- The following prefixes are supported:
34
+ - `node:` reference a built-in Node.js module.
35
+ - `npm:` — reference an npm package.
34
36
 
35
- - **`node:`** reference a built-in Node.js module.
36
- - **`npm:`** — reference a module from the npm ecosystem.
37
+ If no platform prefix is present, the identifier refers to an application module resolved through namespace roots.
37
38
 
38
39
  Examples:
39
40
 
40
41
  ```txt
41
- node:fs$
42
- npm:@humanfs/core$
43
- node:worker_threads$
44
- npm:lodash$
42
+ node:fs
43
+ npm:@humanfs/core
44
+ App_Service_User$
45
45
  ```
46
46
 
47
- If no platform prefix is present, the identifier refers to an application module resolved through namespace mapping.
48
-
49
47
  ## Module Identification
50
48
 
51
- The **ModuleName** identifies the module that provides the dependency. Module identifiers use namespace-based naming and are translated into module specifiers according to namespace resolution rules described in **container.md**.
52
-
53
- Identifier segments separated by underscores correspond to directory boundaries in the module path.
49
+ `ModuleName` identifies the provider module. Identifier segments separated by underscores correspond to path segments inside the configured namespace root.
54
50
 
55
51
  Example:
56
52
 
@@ -58,19 +54,17 @@ Example:
58
54
  App_Service_User
59
55
  ```
60
56
 
61
- maps to a module path such as:
57
+ may map to a module-specifier base such as:
62
58
 
63
59
  ```txt
64
- AppRoot/Service/User.js
60
+ AppRoot/Service/User.mjs
65
61
  ```
66
62
 
67
- In URL-backed namespace configurations the same logical name may instead map to a URL-based module specifier with the same segment structure.
63
+ The base may be filesystem-backed or URL-backed depending on runtime configuration.
68
64
 
69
65
  ## Export Selection
70
66
 
71
- A CDC may reference either the default export of a module or a named export.
72
-
73
- Named exports are selected using a double underscore separator.
67
+ Named exports are selected with a double underscore separator.
74
68
 
75
69
  Examples:
76
70
 
@@ -79,49 +73,73 @@ App_Service_User$
79
73
  App_Service_User__Factory$
80
74
  ```
81
75
 
82
- The first identifier resolves the module default export. The second resolves the named export `Factory`.
76
+ - `App_Service_User$` selects the default export for lifecycle-based composition.
77
+ - `App_Service_User__Factory$` selects the named export `Factory` for lifecycle-based composition.
83
78
 
84
79
  ## Lifecycle Markers
85
80
 
86
- Lifecycle markers define how the container instantiates and returns objects.
81
+ Supported lifecycle markers:
87
82
 
88
- The following markers are supported:
83
+ - `$` singleton lifecycle; create once and reuse the same instance.
84
+ - `$$` — transient lifecycle; create a new instance each time.
85
+ - `$$$` — transient alias; behaves the same as `$$` in the current implementation.
89
86
 
90
- - **`$`** singleton lifecycle; the container creates the object once and returns the same instance for subsequent requests.
91
- - **`$$`** — transient lifecycle; a new instance is created for each request.
92
- - **`$$$`** — transient lifecycle alias; behaves the same as `$$`.
87
+ If the lifecycle marker is omitted, the selected module export is resolved **as-is** and is not instantiated by lifecycle rules.
88
+
89
+ Examples:
93
90
 
94
- Lifecycle markers are appended at the end of the identifier.
91
+ ```txt
92
+ App_Math
93
+ App_Service$
94
+ App_Task$$
95
+ ```
95
96
 
96
97
  ## Wrapper Suffixes
97
98
 
98
- Wrappers allow postprocessing of created objects. Wrapper identifiers are appended after the lifecycle marker and separated by underscores.
99
+ Wrapper suffixes are appended after the lifecycle marker and separated by underscores.
99
100
 
100
101
  Example:
101
102
 
102
103
  ```txt
103
- App_Service_User$$_wrapLog_wrapTrace
104
+ App_Service$$_wrapLog_wrapTrace
104
105
  ```
105
106
 
106
- In this example the container creates a new instance and applies the wrappers `wrapLog` and `wrapTrace` during the postprocess stage.
107
+ In this example the container creates a transient instance, then applies wrapper exports `wrapLog` and `wrapTrace` in the declared order.
107
108
 
108
- Wrapper behavior is described in **extensions.md**.
109
+ Wrapper exports are described in `extensions.md`.
109
110
 
110
- Platform-specific examples:
111
+ ## Interpretation Rules
111
112
 
112
- ```txt
113
- node:worker_threads$
114
- npm:@humanfs/core$
115
- ```
113
+ When the container receives a CDC it interprets it in this order:
114
+
115
+ 1. determine the platform prefix and module namespace;
116
+ 2. resolve the module identifier into a module location;
117
+ 3. select the default export, a named export, or the whole module namespace for as-is resolution;
118
+ 4. apply lifecycle semantics if a lifecycle marker is present;
119
+ 5. apply wrapper exports if wrapper suffixes are present.
116
120
 
117
- ## Resolution Semantics
121
+ Important rules:
118
122
 
119
- When the container receives a CDC it performs the following interpretation steps:
123
+ - no lifecycle marker means as-is resolution of the selected export;
124
+ - wrapper suffixes are meaningful only for lifecycle-based composition;
125
+ - named export selection does not by itself imply singleton or transient behavior;
126
+ - lifecycle and wrappers are interpreted after export selection.
127
+
128
+ ## Canonical Examples
129
+
130
+ ```txt
131
+ App_Math
132
+ App_Service$
133
+ App_Service__Factory$
134
+ App_Task$$_wrapLog
135
+ node:fs
136
+ npm:@humanfs/core
137
+ ```
120
138
 
121
- 1. determine the platform prefix and module namespace
122
- 2. resolve the module identifier into a module location
123
- 3. select the requested export
124
- 4. apply lifecycle semantics
125
- 5. apply wrapper suffixes if present
139
+ These examples cover:
126
140
 
127
- These interpretation steps integrate with the dependency resolution pipeline described in **container.md**.
141
+ - as-is module or export resolution;
142
+ - singleton composition;
143
+ - named export composition;
144
+ - transient composition with wrapper exports;
145
+ - platform module access.