@teqfw/di 2.4.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +159 -284
- package/ai/AGENTS.md +20 -1
- package/ai/concepts.md +2 -2
- package/ai/container.md +3 -0
- package/ai/dependency-id.md +4 -2
- package/ai/package-api.ts +2 -2
- package/ai/usage.md +58 -43
- package/dist/esm.js +1 -1
- package/dist/umd.js +1 -1
- package/package.json +1 -1
- package/src/Config/NamespaceRegistry.mjs +6 -1
- package/src/Container/Instantiate/ExportSelector.mjs +6 -1
- package/src/Container/Instantiate/Instantiator.mjs +7 -2
- package/src/Container/Lifecycle/Registry.mjs +7 -2
- package/src/Container/Resolve/GraphResolver.mjs +28 -11
- package/src/Container/Resolver.mjs +10 -5
- package/src/Container/Wrapper/Executor.mjs +6 -1
- package/src/Container.mjs +40 -20
- package/src/Def/Parser.mjs +8 -3
- package/src/Dto/DepId.mjs +6 -1
- package/src/Dto/Resolver/Config/Namespace.mjs +9 -4
- package/src/Dto/Resolver/Config.mjs +10 -5
- package/src/Enum/Composition.mjs +5 -0
- package/src/Enum/Life.mjs +5 -0
- package/src/Enum/Platform.mjs +5 -0
- package/src/Internal/Logger.mjs +5 -0
- package/types.d.ts +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.5.1 - 2026-04-12 - Documentation refresh and dependency fix
|
|
4
|
+
|
|
5
|
+
* Fixed named-only `__deps__` resolution in the container and updated the related tests.
|
|
6
|
+
* Rewrote the README and refreshed the `ai/` agent documentation for the current release line.
|
|
7
|
+
* Updated package version metadata to `2.5.1`.
|
|
8
|
+
|
|
9
|
+
## 2.5.0 - 2026-04-04 - Parser and documentation refinement
|
|
10
|
+
|
|
11
|
+
* Clarified JSDoc typing and module headers to align with TeqFW specifications.
|
|
12
|
+
* Allowed parser recognition of Node.js built-ins that include underscores in their names.
|
|
13
|
+
* Updated package version metadata to `2.5.0`.
|
|
14
|
+
|
|
3
15
|
## 2.4.0 - 2026-03-31 - Test coverage cleanup
|
|
4
16
|
|
|
5
17
|
* Removed low-value unit tests in favor of broader integration coverage.
|
package/README.md
CHANGED
|
@@ -3,141 +3,65 @@
|
|
|
3
3
|

|
|
4
4
|

|
|
5
5
|
|
|
6
|
-
**
|
|
6
|
+
**Deterministic runtime dependency linker for ES modules, built for pure JavaScript applications with explicit contracts.**
|
|
7
7
|
|
|
8
|
-
`@teqfw/di` is
|
|
8
|
+
`@teqfw/di` is a runtime container for JavaScript applications that want **late binding**, **explicit dependency declarations**, and **deterministic runtime linking** instead of application-level wiring through static imports.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
It is the reference implementation of the **Tequila Framework (TeqFW)** method: a way to structure modular monolith and isomorphic web applications around **Canonical Dependency Codes (CDC)** and module-level dependency descriptors (`__deps__`).
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
In practice, "reference implementation of a method" means this package is not only a container library. It is also the concrete runtime model for a broader way of structuring JavaScript applications around explicit contracts, namespace-based addressing, and late binding.
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
- generate
|
|
16
|
-
- refactor
|
|
17
|
-
- extend
|
|
14
|
+
This package is designed primarily for:
|
|
18
15
|
|
|
19
|
-
|
|
16
|
+
- modular monolith web applications;
|
|
17
|
+
- isomorphic JavaScript systems that share code between browser and server;
|
|
18
|
+
- pure JavaScript + JSDoc codebases;
|
|
19
|
+
- projects developed or maintained with significant LLM-agent involvement.
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## Why Use It
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
`@teqfw/di` provides:
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
- deterministic runtime linking of ES modules;
|
|
26
|
+
- explicit dependency contracts through CDC and `__deps__`;
|
|
27
|
+
- namespace-based module resolution;
|
|
28
|
+
- lifecycle control for singleton and new-instance dependencies;
|
|
29
|
+
- immutable linked objects;
|
|
30
|
+
- wrapper-based extension points for cross-cutting behavior.
|
|
26
31
|
|
|
27
|
-
|
|
32
|
+
The result is an application structure that is easier to analyze, test, replace, and evolve when dependency relationships need to remain explicit.
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
- implicit dependency graphs
|
|
31
|
-
- tight coupling to file structure
|
|
32
|
-
- constructor-based dependency inference
|
|
34
|
+
## How It Fits in JavaScript
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
This approach is unusual in mainstream JavaScript.
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
Most JavaScript and TypeScript projects express dependency structure through some mix of:
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
- static imports;
|
|
41
|
+
- framework conventions;
|
|
42
|
+
- TypeScript-first source architecture;
|
|
43
|
+
- decorators or metadata-driven injection;
|
|
44
|
+
- framework-managed DI.
|
|
39
45
|
|
|
40
|
-
|
|
46
|
+
`@teqfw/di` makes a different tradeoff. It favors **explicit runtime contracts** over hidden or inferred wiring. Instead of relying on TypeScript metadata or decorator-driven injection, modules declare dependencies directly as data and the container resolves them deterministically at runtime.
|
|
41
47
|
|
|
42
|
-
|
|
48
|
+
That tradeoff is intentional.
|
|
43
49
|
|
|
44
|
-
|
|
50
|
+
TypeScript has had a major influence on the JavaScript ecosystem, and that influence has been broadly positive. At the same time, JavaScript itself continues to evolve every year, steadily narrowing part of the gap in developer ergonomics and language expressiveness.
|
|
45
51
|
|
|
46
|
-
|
|
52
|
+
For TypeScript-first ecosystems, other DI approaches are often a more natural fit because those ecosystems already rely on compile-time metadata, annotations, and framework or container conventions. TeqFW targets a different design space: **pure JavaScript + JSDoc**, isomorphic runtime behavior, and codebases where a single explicit structural representation is more valuable than TypeScript-oriented convenience.
|
|
47
53
|
|
|
48
|
-
|
|
49
|
-
- explicit dependency contracts (**CDC — Canonical Dependency Codes**)
|
|
50
|
-
- module dependency descriptors (`__deps__`)
|
|
51
|
-
- namespace-based module resolution
|
|
52
|
-
- runtime lifecycle management
|
|
53
|
-
- wrapper-based behavioral extensions
|
|
54
|
+
This is not presented as the only correct way to structure JavaScript. It is a deliberate alternative for projects that benefit from stronger runtime explicitness and machine-reconstructible structure.
|
|
54
55
|
|
|
55
|
-
|
|
56
|
+
## Comparison
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
| Dependency graph | implicit | deterministic |
|
|
65
|
-
| Refactoring | fragile | stable |
|
|
66
|
-
| Testing | manual wiring | container driven |
|
|
67
|
-
| AI compatibility | accidental | intentional |
|
|
68
|
-
|
|
69
|
-
TeqFW structures the application so that **LLM agents can reliably understand and modify the system.**
|
|
70
|
-
|
|
71
|
-
## Agent-Driven Implementation
|
|
72
|
-
|
|
73
|
-
Starting from version **2.0.0**, the source code of this library is **written primarily by Codex agents**.
|
|
74
|
-
|
|
75
|
-
The development workflow follows **specification-driven development**:
|
|
76
|
-
|
|
77
|
-
1. The human architect defines **product specifications**
|
|
78
|
-
2. LLM agents generate the implementation
|
|
79
|
-
3. The generated code is reviewed and integrated
|
|
80
|
-
|
|
81
|
-
This workflow follows the **ADSM methodology (Agent-Driven Software Management)** developed by **Alex Gusev**.
|
|
82
|
-
|
|
83
|
-
Earlier versions of the library (<2.0.0) were written manually.
|
|
84
|
-
The current version demonstrates how software can be developed using **human-defined architecture and AI-generated code**.
|
|
85
|
-
|
|
86
|
-
## Learn the Architecture (Interactive Onboarding)
|
|
87
|
-
|
|
88
|
-
Understanding this architecture can take time.
|
|
89
|
-
|
|
90
|
-
To make onboarding easier, an **interactive AI assistant** [is available](https://fly.wiredgeese.com/flancer/gpt/teqfw/guide/di/).
|
|
91
|
-
|
|
92
|
-
The assistant can explain:
|
|
93
|
-
|
|
94
|
-
- how the container works
|
|
95
|
-
- what Canonical Dependency Codes are
|
|
96
|
-
- how modules declare dependencies
|
|
97
|
-
- how runtime linking works
|
|
98
|
-
- how to integrate the library in real applications
|
|
99
|
-
|
|
100
|
-
The assistant acts as **interactive documentation** for the project.
|
|
101
|
-
|
|
102
|
-
Custom onboarding assistants like this can also be created **as a service** for other projects and libraries.
|
|
103
|
-
|
|
104
|
-
## Agent Interface (Documentation for LLM Agents)
|
|
105
|
-
|
|
106
|
-
This package includes **agent interface documentation** intended for LLM agents that use the library as an npm dependency.
|
|
107
|
-
|
|
108
|
-
These documents are distributed inside the package in:
|
|
109
|
-
|
|
110
|
-
```txt
|
|
111
|
-
./ai/
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
The files in this directory describe the **public interface of the package in an agent-friendly form**.
|
|
115
|
-
|
|
116
|
-
They explain:
|
|
117
|
-
|
|
118
|
-
- the container API
|
|
119
|
-
- dependency descriptors (`__deps__`)
|
|
120
|
-
- Canonical Dependency Codes (CDC)
|
|
121
|
-
- dependency resolution behavior
|
|
122
|
-
- integration patterns
|
|
123
|
-
|
|
124
|
-
Human developers typically read the README and source code, while **LLM agents can rely on the documentation in `./ai/`.**
|
|
125
|
-
|
|
126
|
-
## Tequila Framework Philosophy
|
|
127
|
-
|
|
128
|
-
`@teqfw/di` is the core building block of the **Tequila Framework (TeqFW)** ecosystem.
|
|
129
|
-
|
|
130
|
-
TeqFW is based on several architectural principles:
|
|
131
|
-
|
|
132
|
-
- runtime late binding between components
|
|
133
|
-
- namespace-based module organization
|
|
134
|
-
- modular monolith architecture
|
|
135
|
-
- pure JavaScript without compilation
|
|
136
|
-
- system structures optimized for collaboration with LLM agents
|
|
137
|
-
|
|
138
|
-
Full philosophy:
|
|
139
|
-
|
|
140
|
-
`PHILOSOPHY.md`
|
|
58
|
+
| Concern | Common TS/JS Approach | `@teqfw/di` |
|
|
59
|
+
| --- | --- | --- |
|
|
60
|
+
| Dependency structure | static imports, decorators, framework wiring | explicit CDC + `__deps__` |
|
|
61
|
+
| Resolution model | partly implicit or framework-driven | deterministic runtime linking |
|
|
62
|
+
| Structural source of truth | spread across code, metadata, config | declared in module contracts |
|
|
63
|
+
| Best fit | TypeScript-first applications | pure JavaScript + JSDoc, isomorphic modular systems |
|
|
64
|
+
| LLM readability | mixed, often indirect | intentionally explicit |
|
|
141
65
|
|
|
142
66
|
## Installation
|
|
143
67
|
|
|
@@ -145,17 +69,9 @@ Full philosophy:
|
|
|
145
69
|
npm install @teqfw/di
|
|
146
70
|
```
|
|
147
71
|
|
|
148
|
-
## Quick
|
|
149
|
-
|
|
150
|
-
### Define modules
|
|
72
|
+
## Quick Start
|
|
151
73
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
```javascript
|
|
155
|
-
export default function App_Child() {
|
|
156
|
-
return { name: "child" };
|
|
157
|
-
}
|
|
158
|
-
```
|
|
74
|
+
Define one helper module and one module that declares its dependency explicitly.
|
|
159
75
|
|
|
160
76
|
`src/App/Helper/Cast.mjs`
|
|
161
77
|
|
|
@@ -174,28 +90,20 @@ export const __deps__ = {
|
|
|
174
90
|
cast: "App_Helper_Cast$",
|
|
175
91
|
};
|
|
176
92
|
|
|
177
|
-
export default class
|
|
178
|
-
constructor() {
|
|
179
|
-
return {
|
|
180
|
-
mode: "runtime-wrapper",
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export class Factory {
|
|
93
|
+
export default class App_Root {
|
|
186
94
|
constructor({ cast }) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
95
|
+
return {
|
|
96
|
+
configure(params = {}) {
|
|
97
|
+
return {
|
|
98
|
+
name: cast(params.name ?? "app"),
|
|
99
|
+
};
|
|
100
|
+
},
|
|
193
101
|
};
|
|
194
102
|
}
|
|
195
103
|
}
|
|
196
104
|
```
|
|
197
105
|
|
|
198
|
-
|
|
106
|
+
Configure the container and request the dependency:
|
|
199
107
|
|
|
200
108
|
```javascript
|
|
201
109
|
import path from "node:path";
|
|
@@ -206,116 +114,57 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
206
114
|
const __dirname = path.dirname(__filename);
|
|
207
115
|
|
|
208
116
|
const container = new Container();
|
|
209
|
-
|
|
210
117
|
container.addNamespaceRoot("App_", path.resolve(__dirname, "./src/App"), ".mjs");
|
|
211
118
|
|
|
212
|
-
const
|
|
119
|
+
const app = await container.get("App_Root$");
|
|
213
120
|
|
|
214
|
-
console.log(
|
|
121
|
+
console.log(app.configure({ name: 123 }).name);
|
|
122
|
+
// "123"
|
|
215
123
|
```
|
|
216
124
|
|
|
217
|
-
|
|
125
|
+
In this flow the container:
|
|
126
|
+
|
|
127
|
+
- parses the dependency request;
|
|
128
|
+
- resolves the module through the registered namespace root;
|
|
129
|
+
- reads `__deps__` for the selected export;
|
|
130
|
+
- recursively links dependencies;
|
|
131
|
+
- returns a frozen linked object.
|
|
218
132
|
|
|
219
|
-
|
|
220
|
-
- resolves dependency contracts
|
|
221
|
-
- constructs the object graph
|
|
222
|
-
- returns **frozen linked objects**
|
|
133
|
+
## Core Concepts
|
|
223
134
|
|
|
224
|
-
|
|
135
|
+
### `__deps__`
|
|
225
136
|
|
|
226
|
-
|
|
137
|
+
For a single-export module, dependencies can be declared in shorthand form:
|
|
227
138
|
|
|
228
139
|
```javascript
|
|
229
140
|
export const __deps__ = {
|
|
230
|
-
|
|
231
|
-
localName: "Dependency_CDC",
|
|
232
|
-
},
|
|
233
|
-
Factory: {
|
|
234
|
-
localName: "Dependency_CDC",
|
|
235
|
-
},
|
|
141
|
+
localName: "Dependency_CDC",
|
|
236
142
|
};
|
|
237
143
|
```
|
|
238
144
|
|
|
239
145
|
Rules:
|
|
240
146
|
|
|
241
|
-
- the canonical form is hierarchical and keyed by export name
|
|
242
|
-
- each export entry maps constructor argument names to CDC
|
|
243
|
-
- if `__deps__` is absent
|
|
244
|
-
- a flat `__deps__` object is
|
|
245
|
-
- dependencies are resolved recursively
|
|
147
|
+
- the canonical form is hierarchical and keyed by export name;
|
|
148
|
+
- each export entry maps constructor argument names to CDC strings;
|
|
149
|
+
- if `__deps__` is absent, the export has no declared dependencies;
|
|
150
|
+
- a flat `__deps__` object is shorthand for limited single-export cases.
|
|
246
151
|
|
|
247
|
-
Canonical
|
|
152
|
+
Canonical export-scoped form:
|
|
248
153
|
|
|
249
154
|
```javascript
|
|
250
155
|
export const __deps__ = {
|
|
251
156
|
default: {
|
|
252
|
-
|
|
157
|
+
localName: "Dependency_CDC",
|
|
253
158
|
},
|
|
254
159
|
Factory: {
|
|
255
|
-
|
|
160
|
+
localName: "Dependency_CDC",
|
|
256
161
|
},
|
|
257
162
|
};
|
|
258
|
-
|
|
259
|
-
export default class RuntimeWrapper {
|
|
260
|
-
constructor() {
|
|
261
|
-
return {
|
|
262
|
-
mode: "runtime-wrapper",
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
export class Factory {
|
|
268
|
-
constructor({ cast }) {
|
|
269
|
-
this.configure = function (params = {}) {
|
|
270
|
-
// DI-managed component
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
163
|
```
|
|
275
164
|
|
|
276
|
-
|
|
165
|
+
### CDC
|
|
277
166
|
|
|
278
|
-
|
|
279
|
-
- the named `Factory` export is the DI-managed component
|
|
280
|
-
- `__deps__` applies to the export selected by the CDC, such as `App_Module__Factory$`
|
|
281
|
-
|
|
282
|
-
Shorthand example for a single-export module:
|
|
283
|
-
|
|
284
|
-
```javascript
|
|
285
|
-
export const __deps__ = {
|
|
286
|
-
cast: "Fl32_Web_Helper_Cast$",
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
export default class RuntimeWrapper {
|
|
290
|
-
constructor() {
|
|
291
|
-
return {
|
|
292
|
-
mode: "runtime-wrapper",
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
Empty descriptor example:
|
|
299
|
-
|
|
300
|
-
```javascript
|
|
301
|
-
export default class App_Empty {
|
|
302
|
-
constructor() {
|
|
303
|
-
this.ready = function () {
|
|
304
|
-
return true;
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
In this pattern:
|
|
311
|
-
|
|
312
|
-
- the module has no declared dependencies
|
|
313
|
-
- `__deps__` is omitted entirely
|
|
314
|
-
- the empty form is valid and intentionally explicit through omission
|
|
315
|
-
|
|
316
|
-
## Canonical Dependency Codes (CDC)
|
|
317
|
-
|
|
318
|
-
CDC identifiers describe **how dependencies should be resolved**.
|
|
167
|
+
A **Canonical Dependency Code** is the string contract used to request a dependency.
|
|
319
168
|
|
|
320
169
|
General form:
|
|
321
170
|
|
|
@@ -326,89 +175,80 @@ General form:
|
|
|
326
175
|
Examples:
|
|
327
176
|
|
|
328
177
|
```txt
|
|
329
|
-
App_Service
|
|
330
178
|
App_Service$
|
|
331
|
-
|
|
332
|
-
App_Service$$_wrapLog_wrapTrace
|
|
179
|
+
App_Service__Factory$$
|
|
333
180
|
node:fs
|
|
334
|
-
npm:@humanfs/core
|
|
335
|
-
node:worker_threads
|
|
336
181
|
npm:lodash
|
|
337
182
|
```
|
|
338
183
|
|
|
339
184
|
Where:
|
|
340
185
|
|
|
341
|
-
- `
|
|
342
|
-
-
|
|
343
|
-
-
|
|
344
|
-
-
|
|
345
|
-
- wrappers modify runtime behavior
|
|
186
|
+
- `__Factory` selects a named export;
|
|
187
|
+
- `$` means singleton lifecycle;
|
|
188
|
+
- `$$` means new instance lifecycle;
|
|
189
|
+
- `node:` and `npm:` address platform-specific modules.
|
|
346
190
|
|
|
347
|
-
|
|
191
|
+
### Namespace Root
|
|
192
|
+
|
|
193
|
+
A namespace root maps a CDC prefix to a module-specifier base:
|
|
348
194
|
|
|
349
195
|
```javascript
|
|
350
|
-
|
|
196
|
+
container.addNamespaceRoot("App_", "/abs/path/to/src/App", ".mjs");
|
|
351
197
|
```
|
|
352
198
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
- `setParser(parser)`
|
|
356
|
-
- `addNamespaceRoot(prefix, target, defaultExt)`
|
|
357
|
-
- `addPreprocess(fn)`
|
|
358
|
-
- `addPostprocess(fn)`
|
|
359
|
-
- `enableLogging()`
|
|
360
|
-
- `enableTestMode()`
|
|
361
|
-
- `register(cdc, mock)`
|
|
199
|
+
This lets the container translate logical module names such as `App_Root__Factory$` into concrete ES module files or URL-based module specifiers.
|
|
362
200
|
|
|
363
|
-
|
|
201
|
+
In Node.js, that often means filesystem-backed module roots:
|
|
364
202
|
|
|
365
203
|
```javascript
|
|
366
|
-
|
|
204
|
+
container.addNamespaceRoot("App_", "/project/src/App", ".mjs");
|
|
367
205
|
```
|
|
368
206
|
|
|
369
|
-
|
|
207
|
+
In a web-oriented or isomorphic application, it can also mean URL-backed roots for browser imports:
|
|
370
208
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
209
|
+
```javascript
|
|
210
|
+
container.addNamespaceRoot("App_", "https://cdn.example.com/app", ".mjs");
|
|
211
|
+
container.addNamespaceRoot("Web_", "//cdn.example.com/web", ".mjs");
|
|
212
|
+
```
|
|
375
213
|
|
|
376
|
-
|
|
214
|
+
This keeps dependency addressing stable while allowing the same logical naming model to work across shared application code, browser-facing modules, and different runtime environments.
|
|
377
215
|
|
|
378
|
-
|
|
216
|
+
## Public API
|
|
379
217
|
|
|
380
|
-
|
|
218
|
+
Create a container:
|
|
381
219
|
|
|
382
|
-
```
|
|
383
|
-
|
|
220
|
+
```javascript
|
|
221
|
+
const container = new Container();
|
|
384
222
|
```
|
|
385
223
|
|
|
386
|
-
|
|
224
|
+
Configure it before the first `get(...)`:
|
|
387
225
|
|
|
388
|
-
-
|
|
389
|
-
-
|
|
390
|
-
-
|
|
391
|
-
-
|
|
392
|
-
-
|
|
393
|
-
|
|
394
|
-
|
|
226
|
+
- `setParser(parser)`
|
|
227
|
+
- `addNamespaceRoot(prefix, target, defaultExt)`
|
|
228
|
+
- `addPreprocess(fn)`
|
|
229
|
+
- `addPostprocess(fn)`
|
|
230
|
+
- `enableLogging()`
|
|
231
|
+
- `enableTestMode()`
|
|
232
|
+
- `register(cdc, mock)`
|
|
395
233
|
|
|
396
|
-
|
|
234
|
+
Resolve dependencies:
|
|
397
235
|
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
npm:@humanfs/core
|
|
236
|
+
```javascript
|
|
237
|
+
await container.get(cdc);
|
|
401
238
|
```
|
|
402
239
|
|
|
240
|
+
The container is builder-configurable until the first `get(...)`. After that point configuration is locked.
|
|
241
|
+
|
|
403
242
|
## Test Mode
|
|
404
243
|
|
|
244
|
+
Test mode allows registered mocks to be resolved before module instantiation:
|
|
245
|
+
|
|
405
246
|
```javascript
|
|
406
247
|
container.enableTestMode();
|
|
407
|
-
|
|
408
248
|
container.register("App_Service$", mockService);
|
|
409
249
|
```
|
|
410
250
|
|
|
411
|
-
|
|
251
|
+
This keeps replacement explicit and local to container configuration.
|
|
412
252
|
|
|
413
253
|
## Browser Usage
|
|
414
254
|
|
|
@@ -420,24 +260,59 @@ Mocks are resolved before module instantiation.
|
|
|
420
260
|
</script>
|
|
421
261
|
```
|
|
422
262
|
|
|
423
|
-
##
|
|
263
|
+
## LLM-Oriented Development
|
|
264
|
+
|
|
265
|
+
This package is designed for codebases where LLM agents participate in implementation and maintenance.
|
|
266
|
+
|
|
267
|
+
That affects the architecture directly. In many human-oriented JavaScript codebases, local explicitness is treated as extra ceremony. Here it is a deliberate tradeoff: dependency structure stays visible where it is needed, instead of being inferred from decorators, reflection, framework conventions, or scattered configuration.
|
|
268
|
+
|
|
269
|
+
This increases local structural surface area, but it reduces ambiguity. For LLM-driven maintenance, that makes dependency structure easier to reconstruct, edit, and verify from source code alone.
|
|
270
|
+
|
|
271
|
+
## When This Fits
|
|
272
|
+
|
|
273
|
+
This approach is a good fit when you want:
|
|
274
|
+
|
|
275
|
+
- a modular monolith with explicit component boundaries;
|
|
276
|
+
- shared JavaScript code across browser and Node.js;
|
|
277
|
+
- runtime late binding instead of static application wiring;
|
|
278
|
+
- explicit, machine-readable dependency structure;
|
|
279
|
+
- a pure JavaScript + JSDoc stack instead of TypeScript-first architecture.
|
|
280
|
+
|
|
281
|
+
## When It Probably Does Not
|
|
282
|
+
|
|
283
|
+
This approach is probably a poor fit when:
|
|
284
|
+
|
|
285
|
+
- your project is deeply committed to TypeScript-first conventions;
|
|
286
|
+
- you prefer decorator-based or framework-managed injection;
|
|
287
|
+
- your team values minimal local ceremony over explicit structural contracts;
|
|
288
|
+
- you do not need isomorphic runtime structure or late binding;
|
|
289
|
+
- the codebase is optimized only for human authorship and not for machine-assisted maintenance.
|
|
290
|
+
|
|
291
|
+
## Documentation for Agents
|
|
292
|
+
|
|
293
|
+
This package includes a machine-oriented package interface under `./ai/`.
|
|
294
|
+
|
|
295
|
+
Those files are intended for system prompts, examples, and agent consumption. They describe:
|
|
424
296
|
|
|
425
|
-
|
|
297
|
+
- container usage;
|
|
298
|
+
- dependency descriptors;
|
|
299
|
+
- CDC behavior;
|
|
300
|
+
- integration patterns.
|
|
426
301
|
|
|
427
|
-
-
|
|
428
|
-
- `ctx/docs/product/default-cdc-profile.md`
|
|
429
|
-
- `ctx/docs/architecture/cdc-profile/default/grammar.md`
|
|
430
|
-
- `ctx/docs/architecture/cdc-profile/default/transformation.md`
|
|
431
|
-
- `ctx/docs/architecture/cdc-profile/default/validation.md`
|
|
432
|
-
- `ctx/docs/code/components/container.md`
|
|
302
|
+
In other words, the package ships a human-facing README and a machine-oriented interface for agents that need to use it as a dependency.
|
|
433
303
|
|
|
434
|
-
##
|
|
304
|
+
## Further Reading
|
|
435
305
|
|
|
436
|
-
|
|
306
|
+
- Product overview: `ctx/docs/product/overview.md`
|
|
307
|
+
- Product scope and boundaries: `ctx/docs/product/scope.md`
|
|
308
|
+
- Default CDC profile and compatibility surface: `ctx/docs/product/default-cdc-profile.md`
|
|
309
|
+
- Architecture overview: `ctx/docs/architecture/overview.md`
|
|
310
|
+
- Runtime linking model: `ctx/docs/architecture/linking-model.md`
|
|
311
|
+
- Container implementation contract: `ctx/docs/code/components/container.md`
|
|
312
|
+
- Project philosophy and intended application domain: `PHILOSOPHY.md`
|
|
437
313
|
|
|
438
|
-
|
|
314
|
+
## TeqFW Context
|
|
439
315
|
|
|
440
|
-
|
|
441
|
-
- **ADSM (Agent-Driven Software Management)**
|
|
316
|
+
`@teqfw/di` is the core building block of the Tequila Framework (TeqFW).
|
|
442
317
|
|
|
443
|
-
The
|
|
318
|
+
TeqFW is aimed at building modular monolith web applications with a unified JavaScript codebase across browser and server runtimes. The method favors late binding, namespace-based structure, explicit contracts, and source artifacts that remain legible to both humans and LLM agents.
|
package/ai/AGENTS.md
CHANGED
|
@@ -6,7 +6,7 @@ Version: 20260331
|
|
|
6
6
|
|
|
7
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.
|
|
8
8
|
|
|
9
|
-
The package implements a **dependency
|
|
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.
|
|
10
10
|
|
|
11
11
|
## When to Use This Package
|
|
12
12
|
|
|
@@ -17,9 +17,18 @@ This package should be used when a system requires the following capabilities:
|
|
|
17
17
|
- deterministic dependency resolution
|
|
18
18
|
- controlled instantiation of components
|
|
19
19
|
- modules that remain environment-agnostic across Node.js and browser runtimes
|
|
20
|
+
- explicit machine-readable dependency structure for agent-assisted maintenance
|
|
20
21
|
|
|
21
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.
|
|
22
23
|
|
|
24
|
+
This package is primarily a fit for:
|
|
25
|
+
|
|
26
|
+
- modular monolith web applications
|
|
27
|
+
- isomorphic JavaScript systems with shared browser/server code
|
|
28
|
+
- pure JavaScript + JSDoc codebases
|
|
29
|
+
|
|
30
|
+
It is usually not a natural fit for TypeScript-first architectures built around decorators, metadata, or framework-managed DI conventions.
|
|
31
|
+
|
|
23
32
|
## Architectural Model
|
|
24
33
|
|
|
25
34
|
The system is based on four mechanisms:
|
|
@@ -42,6 +51,7 @@ In this model:
|
|
|
42
51
|
- ES modules provide implementations.
|
|
43
52
|
- CDC identifiers define dependency contracts.
|
|
44
53
|
- the container performs deterministic runtime linking.
|
|
54
|
+
- linked values are frozen before they are returned.
|
|
45
55
|
|
|
46
56
|
This mechanism separates module implementation from dependency binding and allows systems to assemble component graphs dynamically while preserving deterministic behavior.
|
|
47
57
|
|
|
@@ -59,6 +69,13 @@ Agents should read the documents in this directory in the following order:
|
|
|
59
69
|
|
|
60
70
|
This sequence reflects the intended agent workflow: contract surface first, then architectural model, operational mechanism, dependency addressing, extension points, and practical usage.
|
|
61
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
|
+
|
|
62
79
|
## Interface Scope
|
|
63
80
|
|
|
64
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.
|
|
@@ -73,3 +90,5 @@ The package follows architectural principles used in the **Tequila Framework (Te
|
|
|
73
90
|
- development in modern JavaScript without compilation
|
|
74
91
|
|
|
75
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.
|
package/ai/concepts.md
CHANGED
|
@@ -47,9 +47,9 @@ The identifier syntax and resolution rules are described in **dependency-id.md**
|
|
|
47
47
|
|
|
48
48
|
## Namespaces
|
|
49
49
|
|
|
50
|
-
Namespaces provide deterministic mapping between logical identifiers and module locations. Each package defines
|
|
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.
|
|
51
51
|
|
|
52
|
-
The container resolves identifiers by applying namespace rules that translate identifier prefixes into
|
|
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.
|
|
53
53
|
|
|
54
54
|
Namespace resolution ensures:
|
|
55
55
|
|