di-bag 0.1.0 → 0.1.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/README.md +48 -50
- package/package.json +16 -3
package/README.md
CHANGED
|
@@ -1,65 +1,35 @@
|
|
|
1
1
|
# DI Bag
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript dependency composition and resource ownership for agentic development, LLM harnesses, and agent graphs.
|
|
4
4
|
|
|
5
|
-
[Documentation](https://dany-fedorov.github.io/di-bag/) · [Quickstart](#quickstart) · [Comparison](#how-it-compares) · [Tutorial](docs/guides/tutorial.md) · [API reference](docs/guides/api-reference.md)
|
|
5
|
+
[Documentation](https://dany-fedorov.github.io/di-bag/) · [Quickstart](#quickstart) · [Agent harnesses](docs/guides/agent-harnesses-and-graphs.md) · [Comparison](#how-it-compares) · [Tutorial](docs/guides/tutorial.md) · [API reference](docs/guides/api-reference.md)
|
|
6
6
|
|
|
7
7
|
## Why DI Bag?
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
- **[
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- **[TypeScript-first composition](docs/guides/examples-type-checking.md).**
|
|
21
|
-
Catch missing dependencies, incompatible service contracts, and invalid
|
|
22
|
-
replacements at compile time—not just incorrect arguments at the call site.
|
|
23
|
-
Coding agents can shorten their evaluation loop by checking wiring without
|
|
24
|
-
starting the app or running integration tests.
|
|
25
|
-
- **[A programmable DI layer for custom tooling](docs/guides/examples-extensibility.md).**
|
|
26
|
-
Give agents the building blocks to create the tooling your workflow needs:
|
|
27
|
-
custom inspectors, diagnostics, metadata-driven actions, and lifecycle tools.
|
|
28
|
-
Combine application-defined metadata, composable provider wrappers, and
|
|
29
|
-
configurable observers without changing your services.
|
|
9
|
+
Compose ordinary TypeScript factories into reusable features. DI Bag checks
|
|
10
|
+
declared dependencies, keeps module internals private, and manages resource
|
|
11
|
+
creation and cleanup. Build services, tools, or graph nodes against explicit
|
|
12
|
+
contracts, then replace their dependencies for tests.
|
|
13
|
+
|
|
14
|
+
- **[Reusable modules with private bindings](docs/guides/examples-modularity.md).**
|
|
15
|
+
Compose independently developed features without exposing their internals.
|
|
16
|
+
- **[Compile-time wiring checks](docs/guides/examples-type-checking.md).**
|
|
17
|
+
Catch missing dependencies and incompatible replacements before starting the app.
|
|
18
|
+
- **[Metadata inspection without service startup](docs/guides/examples-extensibility.md).**
|
|
19
|
+
Build capability catalogs without running factories or opening clients.
|
|
30
20
|
- **[Inject anything with a simple factory function](docs/guides/examples-plain-services.md).**
|
|
31
|
-
|
|
32
|
-
ordinary JavaScript function: receive dependencies and return a value.
|
|
33
|
-
Functions, class instances, configuration, clients, or promises—no decorators,
|
|
34
|
-
reflection metadata, or special base classes required.
|
|
35
|
-
|
|
36
|
-
Each guide above contains three complete application examples. Lazy creation,
|
|
37
|
-
configurable lifetimes, scopes, and dependency-ordered cleanup support these
|
|
38
|
-
patterns; the [tutorial](docs/guides/tutorial.md) explains how.
|
|
39
|
-
|
|
40
|
-
For a small graph, passing dependencies directly is often simpler. Other DI
|
|
41
|
-
libraries also offer typed composition and resource management; the
|
|
42
|
-
[comparison below](#how-it-compares) explains the tradeoffs.
|
|
21
|
+
Supply functions, objects, clients, or promises—no decorators or base classes.
|
|
43
22
|
|
|
44
23
|
## Install
|
|
45
24
|
|
|
46
|
-
|
|
47
|
-
It includes breaking API changes, so expect to review migrations when updating.
|
|
48
|
-
These instructions install the current checkout without assuming an npm release
|
|
49
|
-
is available. Build a local package with Node 24 and npm:
|
|
25
|
+
Install [di-bag from npm](https://www.npmjs.com/package/di-bag):
|
|
50
26
|
|
|
51
27
|
```sh
|
|
52
|
-
|
|
53
|
-
cd di-bag
|
|
54
|
-
npm ci
|
|
55
|
-
npm pack
|
|
28
|
+
npm install di-bag
|
|
56
29
|
```
|
|
57
30
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
```sh
|
|
61
|
-
npm install /path/to/di-bag/di-bag-0.1.0.tgz
|
|
62
|
-
```
|
|
31
|
+
The API is pre-1.0 and includes breaking changes, so review the changelog and
|
|
32
|
+
migration guides when updating.
|
|
63
33
|
|
|
64
34
|
The minimum supported TypeScript version is **6.0.3**; enable `strict` in your
|
|
65
35
|
`tsconfig.json`. The repository checks classic TypeScript 6.0.3 and native 7.0.2.
|
|
@@ -122,8 +92,9 @@ try {
|
|
|
122
92
|
}
|
|
123
93
|
```
|
|
124
94
|
|
|
125
|
-
The replacement must satisfy the original service contract. Each fork
|
|
126
|
-
|
|
95
|
+
The replacement must satisfy the original service contract. Each fork has
|
|
96
|
+
independent acquisition and cleanup ownership; close it separately. Factories
|
|
97
|
+
can still return shared objects captured outside the fork.
|
|
127
98
|
|
|
128
99
|
## Work with async services
|
|
129
100
|
|
|
@@ -192,6 +163,32 @@ The [tutorial](docs/guides/tutorial.md) also covers modules with private service
|
|
|
192
163
|
typed tokens, class and function adapters, optional and lazy dependencies,
|
|
193
164
|
collections, startup, metadata, observers, and plugin validation.
|
|
194
165
|
|
|
166
|
+
## LLM harnesses and agent graphs
|
|
167
|
+
|
|
168
|
+
Compose an **LLM harness** from model clients, tools, context sources, and
|
|
169
|
+
ordinary functions that serve as **agent graph** nodes.
|
|
170
|
+
|
|
171
|
+
- **Explicit feature boundaries:** give each node or tool a small contract
|
|
172
|
+
and private implementation. Keep feature contracts and focused tests together;
|
|
173
|
+
select tools and context for the LLM in the harness.
|
|
174
|
+
- **Contract checks and fixture tests:** check declared wiring before a model call,
|
|
175
|
+
then fork the composition with typed model and tool fixtures for deterministic
|
|
176
|
+
behavioral tests. Keep live-model evals for quality and task success.
|
|
177
|
+
- **Inspectable capability descriptions:** describe public nodes and tools next
|
|
178
|
+
to their factories. Inspect that metadata without creating services, and use
|
|
179
|
+
it in application-defined catalogs, diagnostics, or dispatch policies.
|
|
180
|
+
|
|
181
|
+
DI Bag's dependency graph describes how services are supplied. The agent graph
|
|
182
|
+
describes execution: which node runs next and what state it receives. Your
|
|
183
|
+
harness or graph framework owns routing, retries, persistence, and execution;
|
|
184
|
+
DI Bag supplies checked composition and resource ownership.
|
|
185
|
+
|
|
186
|
+
The [agent harness and graph guide](docs/guides/agent-harnesses-and-graphs.md)
|
|
187
|
+
combines private feature modules, an LLM-backed node, metadata inspection, and
|
|
188
|
+
fork-based fixture tests in one runnable example. Inspection describes selected
|
|
189
|
+
registrations, not complete dependency edges; observers track acquisition, not
|
|
190
|
+
ordinary node calls. Use your graph framework for workflow checkpoints.
|
|
191
|
+
|
|
195
192
|
## How it compares
|
|
196
193
|
|
|
197
194
|
DI Bag's appeal is the combination of object-parameter factories, checks across
|
|
@@ -250,6 +247,7 @@ for both setup options.
|
|
|
250
247
|
| [Complete tutorial](docs/guides/tutorial.md) | Learn every public API through examples, from first composition to advanced ownership. |
|
|
251
248
|
| [API reference](docs/guides/api-reference.md) | Exact generated signatures, overloads, type parameters, and API inventories. |
|
|
252
249
|
| [Server guide](docs/guides/server-integration.md) | Node HTTP, Express, Fastify, Bun, and Deno: shared services, request scopes, startup, and shutdown. |
|
|
250
|
+
| [Agent harnesses and graphs](docs/guides/agent-harnesses-and-graphs.md) | Compose model and tool dependencies, inspect metadata, and test nodes with typed fixtures. |
|
|
253
251
|
| [Runnable examples](examples) | Modules, tokens, composition, collections, plugins, observers, scopes, and provider metadata. |
|
|
254
252
|
| [Integration guide](docs/guides/enterprise-integration.md) | Tested recipes for request ownership, substitutions, and dynamic features. |
|
|
255
253
|
| [Comparison with alternatives](docs/guides/comparison.md) | When DI Bag or another approach may be a better fit, with primary sources. |
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "di-bag",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Type-checked dependency composition
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Type-checked dependency composition, private modules, and resource ownership for TypeScript apps and LLM harnesses.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -49,7 +49,20 @@
|
|
|
49
49
|
},
|
|
50
50
|
"keywords": [
|
|
51
51
|
"di",
|
|
52
|
-
"bag"
|
|
52
|
+
"bag",
|
|
53
|
+
"dependency-injection",
|
|
54
|
+
"typescript",
|
|
55
|
+
"modularity",
|
|
56
|
+
"context-engineering",
|
|
57
|
+
"agentic",
|
|
58
|
+
"agentic-development",
|
|
59
|
+
"llm",
|
|
60
|
+
"harness",
|
|
61
|
+
"agent-harness",
|
|
62
|
+
"graph",
|
|
63
|
+
"agent-graph",
|
|
64
|
+
"evals",
|
|
65
|
+
"metadata"
|
|
53
66
|
],
|
|
54
67
|
"author": "Dany Fedorov",
|
|
55
68
|
"license": "MIT",
|