@arki/dot 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/README.md +86 -86
  2. package/dist/cli/discover.js +2 -2
  3. package/dist/cli/discover.js.map +1 -1
  4. package/dist/cli/error-codes.d.ts +8 -0
  5. package/dist/cli/error-codes.d.ts.map +1 -1
  6. package/dist/cli/error-codes.js +12 -0
  7. package/dist/cli/error-codes.js.map +1 -1
  8. package/dist/cli/index.d.ts +9 -2
  9. package/dist/cli/index.d.ts.map +1 -1
  10. package/dist/cli/index.js +54 -23
  11. package/dist/cli/index.js.map +1 -1
  12. package/dist/cli/new.d.ts +1 -1
  13. package/dist/cli/new.js +1 -1
  14. package/dist/cli/render-doctor.d.ts +1 -1
  15. package/dist/cli/render-doctor.js +23 -23
  16. package/dist/cli/render-doctor.js.map +1 -1
  17. package/dist/cli/render-explain.d.ts.map +1 -1
  18. package/dist/cli/render-explain.js +33 -19
  19. package/dist/cli/render-explain.js.map +1 -1
  20. package/dist/cli/render-graph.d.ts +3 -3
  21. package/dist/cli/render-graph.js +12 -12
  22. package/dist/cli/render-graph.js.map +1 -1
  23. package/dist/cli/render-projection.d.ts +29 -0
  24. package/dist/cli/render-projection.d.ts.map +1 -0
  25. package/dist/cli/render-projection.js +202 -0
  26. package/dist/cli/render-projection.js.map +1 -0
  27. package/dist/define-app.d.ts +49 -17
  28. package/dist/define-app.d.ts.map +1 -1
  29. package/dist/define-app.js +16 -9
  30. package/dist/define-app.js.map +1 -1
  31. package/dist/diagnostics.d.ts +19 -15
  32. package/dist/diagnostics.d.ts.map +1 -1
  33. package/dist/diagnostics.js +2 -2
  34. package/dist/index.d.ts +15 -12
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +7 -5
  37. package/dist/index.js.map +1 -1
  38. package/dist/init-pips.d.ts +45 -0
  39. package/dist/init-pips.d.ts.map +1 -0
  40. package/dist/init-pips.js +49 -0
  41. package/dist/init-pips.js.map +1 -0
  42. package/dist/init-plugins.d.ts +45 -0
  43. package/dist/init-plugins.d.ts.map +1 -0
  44. package/dist/init-plugins.js +49 -0
  45. package/dist/init-plugins.js.map +1 -0
  46. package/dist/kernel/app-instance.d.ts +5 -5
  47. package/dist/kernel/app-instance.d.ts.map +1 -1
  48. package/dist/kernel/app-instance.js +375 -244
  49. package/dist/kernel/app-instance.js.map +1 -1
  50. package/dist/kernel/otel.d.ts +19 -19
  51. package/dist/kernel/otel.d.ts.map +1 -1
  52. package/dist/kernel/otel.js +22 -22
  53. package/dist/kernel/otel.js.map +1 -1
  54. package/dist/lifecycle-observer.d.ts +10 -10
  55. package/dist/lifecycle-observer.d.ts.map +1 -1
  56. package/dist/lifecycle-observer.js +1 -1
  57. package/dist/lifecycle.d.ts +18 -14
  58. package/dist/lifecycle.d.ts.map +1 -1
  59. package/dist/lifecycle.js +13 -9
  60. package/dist/lifecycle.js.map +1 -1
  61. package/dist/manifest.d.ts +70 -48
  62. package/dist/manifest.d.ts.map +1 -1
  63. package/dist/manifest.js +74 -5
  64. package/dist/manifest.js.map +1 -1
  65. package/dist/pip-contract.d.ts +29 -21
  66. package/dist/pip-contract.d.ts.map +1 -1
  67. package/dist/pip-contract.js +1 -0
  68. package/dist/pip-contract.js.map +1 -1
  69. package/dist/pip.d.ts +7 -4
  70. package/dist/pip.d.ts.map +1 -1
  71. package/dist/pip.js +2 -0
  72. package/dist/pip.js.map +1 -1
  73. package/dist/plugin-contract.d.ts +335 -143
  74. package/dist/plugin-contract.d.ts.map +1 -1
  75. package/dist/plugin-contract.js +201 -36
  76. package/dist/plugin-contract.js.map +1 -1
  77. package/dist/plugin.d.ts +18 -15
  78. package/dist/plugin.d.ts.map +1 -1
  79. package/dist/plugin.js +11 -11
  80. package/dist/plugin.js.map +1 -1
  81. package/dist/test-harness.d.ts +31 -31
  82. package/dist/test-harness.d.ts.map +1 -1
  83. package/dist/test-harness.js +29 -28
  84. package/dist/test-harness.js.map +1 -1
  85. package/dist/timeline.d.ts +2 -2
  86. package/dist/timeline.js +5 -5
  87. package/dist/timeline.js.map +1 -1
  88. package/package.json +9 -9
  89. package/src/cli/discover.ts +2 -2
  90. package/src/cli/error-codes.ts +12 -0
  91. package/src/cli/index.ts +76 -29
  92. package/src/cli/new.ts +1 -1
  93. package/src/cli/render-doctor.ts +21 -21
  94. package/src/cli/render-explain.ts +37 -19
  95. package/src/cli/render-graph.ts +12 -12
  96. package/src/cli/render-projection.ts +239 -0
  97. package/src/define-app.ts +85 -22
  98. package/src/diagnostics.ts +19 -15
  99. package/src/index.ts +37 -20
  100. package/src/init-plugins.ts +142 -0
  101. package/src/kernel/app-instance.ts +428 -282
  102. package/src/kernel/otel.ts +27 -27
  103. package/src/lifecycle-observer.ts +10 -10
  104. package/src/lifecycle.ts +19 -15
  105. package/src/manifest.ts +128 -50
  106. package/src/{pip-contract.ts → plugin-contract.ts} +73 -62
  107. package/src/{pip.ts → plugin.ts} +37 -18
  108. package/src/test-harness.ts +52 -51
  109. package/src/timeline.ts +6 -6
  110. package/templates/app-minimal/AGENTS.md.tmpl +9 -9
  111. package/templates/app-minimal/README.md.tmpl +1 -1
  112. package/templates/app-minimal/tests/boot.test.ts.tmpl +1 -1
  113. package/src/cli/render-openapi.ts +0 -147
@@ -1,175 +1,367 @@
1
1
  /**
2
- * Public plugin contract for the DOT kernel.
2
+ * Public plugin contract for the DOT kernel (v2).
3
3
  *
4
- * A `DotPlugin` is a plain object with a name, optional dependency list, and
5
- * up to five lifecycle hooks. The kernel calls each hook in dependency order
6
- * (or reverse-dependency order for `stop`/`dispose`).
4
+ * A plugin declares what it **needs** as a shape of type witnesses and
5
+ * publishes what it **provides** from its `boot` hook. The kernel wires
6
+ * services by key, injects them into hook contexts under the plugin's local
7
+ * aliases, and fails loudly (coded errors) on unsatisfied needs or key
8
+ * collisions.
7
9
  *
8
10
  * Design constraints:
9
11
  *
10
- * - `configure` is SYNC. Returning a Promise is an error — the kernel will
11
- * throw {@link DotLifecycleError} with code `DOT_LIFECYCLE_E001`.
12
- * - `boot` may publish services into the app; downstream plugins see them via
13
- * {@link DotBootContext.services}.
14
- * - `stop` and `dispose` continue through individual plugin failures and
15
- * report an aggregate error.
16
- */
17
- import type { DotLifecycleHook } from './lifecycle.js';
18
- import type { DependencyEdgeKind, RouteTransport, ServiceKind } from './manifest.js';
19
- /**
20
- * Aggregate registration record produced during the `configure` phase.
21
- *
22
- * The kernel exposes one of these to each plugin via {@link DotConfigureContext}
23
- * and uses the merged result to build the final `DotAppManifest`.
24
- */
25
- export type DotManifestContribution = {
26
- /** Services this plugin publishes. */
27
- services?: readonly {
28
- name: string;
29
- kind: ServiceKind;
30
- }[];
31
- /** Routes this plugin exposes. */
32
- routes?: readonly {
33
- id: string;
34
- method?: string;
35
- path?: string;
36
- transport: RouteTransport;
37
- }[];
38
- /** Additional `provides` capability strings (joined with the plugin's `provides`). */
39
- provides?: readonly string[];
40
- /** Additional dependency edges. */
41
- dependencies?: readonly {
42
- to: string;
43
- kind?: DependencyEdgeKind;
44
- }[];
12
+ * - `configure` is SYNC. Returning a Promise is an error — the kernel
13
+ * throws {@link DotLifecycleError} with code `DOT_LIFECYCLE_E001`.
14
+ * - Declaration order IS boot order. The app builder's type-level guard
15
+ * makes out-of-order composition a compile error; the kernel re-validates
16
+ * at runtime for erased/dynamic composition.
17
+ * - `stop` and `dispose` run in reverse declaration order and continue
18
+ * through individual plugin failures, reporting an aggregate error.
19
+ */
20
+ import type { ActionManifest, ProjectionManifest, JsonObject, ServiceKind } from './manifest.js';
21
+ declare const TypeOf: unique symbol;
22
+ /**
23
+ * Phantom type witness for a service. Carries `T` at the type level only —
24
+ * the runtime value is an empty object.
25
+ */
26
+ export type Service<T> = {
27
+ readonly [TypeOf]?: T;
45
28
  };
46
- /** Context provided to a `manifest` callback. */
47
- export type DotManifestContext<TServices extends Record<string, unknown>> = {
48
- pluginName: string;
49
- /** Services published by dependencies that have already booted (read-only). */
50
- services: Readonly<Partial<TServices>>;
29
+ declare const LazyInner: unique symbol;
30
+ /**
31
+ * A lazy-lifting witness (create via {@link service.lazy}). The consumer
32
+ * always receives a `Lazy<T>` handle, regardless of whether the provider
33
+ * published a plain `T` (the kernel lifts it into a pre-initialized
34
+ * handle) or a `Lazy<T>` (passed through). This decouples consumers from
35
+ * the provider's eager-vs-lazy strategy.
36
+ *
37
+ * The phantom `Service<T | Lazy<T>>` base is what the wiring guard checks
38
+ * against — either provider shape satisfies it structurally.
39
+ */
40
+ export type LazyService<T> = Service<T | Lazy<T>> & {
41
+ readonly lazy: true;
42
+ readonly [LazyInner]?: T;
51
43
  };
52
- /** Context provided to a `configure` hook. */
53
- export type DotConfigureContext = {
54
- pluginName: string;
55
- /** App name. */
56
- appName: string;
44
+ /**
45
+ * Create an app-local (anonymous) service witness for a `needs` shape.
46
+ *
47
+ * `service.lazy<T>()` creates a lifting witness instead — the hook context
48
+ * delivers a `Lazy<T>` handle whether the provider is eager or lazy.
49
+ */
50
+ export declare const service: (<T>() => Service<T>) & {
51
+ readonly lazy: <T>() => LazyService<T>;
52
+ };
53
+ /** Internal (kernel) check: is this witness a lazy-lifting one? */
54
+ export declare function isLazyWitness(witness: object): boolean;
55
+ /**
56
+ * Shared, named witness — a cross-package service contract. The `key` is
57
+ * the wire name used for satisfaction checks and runtime lookup; the local
58
+ * property name in a `needs` shape becomes a free-choice alias.
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * // packages/db owns the contract:
63
+ * export const Db = token<NodePgDatabase<Schema>>()('arki.db');
64
+ *
65
+ * // any consumer, any local alias:
66
+ * const reports = plugin({
67
+ * name: 'reports',
68
+ * needs: { db: Db },
69
+ * async boot({ db }) { ... },
70
+ * });
71
+ * ```
72
+ */
73
+ export type Token<T, K extends string = string> = Service<T> & {
74
+ readonly key: K;
75
+ /** Derive a token for an additional instance of the same contract. */
76
+ instance<N extends string>(name: N): Token<T, `${K}#${N}`>;
77
+ };
78
+ /**
79
+ * Create a token. Curried so `T` is explicit while `K` is inferred as a
80
+ * literal: `const Db = token<DbHandle>()('arki.db')`.
81
+ */
82
+ export declare function token<T>(): <K extends string>(key: K) => Token<T, K>;
83
+ /**
84
+ * Publish a value under a token's wire key. Returns a record typed by the
85
+ * token's literal key, so `boot: () => provide(Db, handle)` infers
86
+ * `TProvides = { 'arki.db': DbHandle }`.
87
+ */
88
+ export declare function provide<T, K extends string>(tok: Token<T, K>, value: T): {
89
+ [P in K]: T;
90
+ };
91
+ /** Record of wire-keyed services. */
92
+ export type ServiceRecord = Record<string, unknown>;
93
+ /** Runtime brand for lazy service handles (kernel detects these for auto-dispose). */
94
+ export declare const LazyTag: unique symbol;
95
+ /**
96
+ * A lazily-initialized service handle. Publish one from `boot` to defer an
97
+ * expensive open until first use:
98
+ *
99
+ * ```ts
100
+ * boot: () => ({ db: lazy(() => openDb(), { dispose: db => db.close() }) })
101
+ * ```
102
+ *
103
+ * Laziness is visible in the type — consumers declare
104
+ * `needs: { db: service<Lazy<Db>>() }` and call `await db.get()`. The
105
+ * kernel auto-disposes initialized handles in reverse declaration order
106
+ * during `dispose` (and boot rollback), even when the publishing plugin has
107
+ * no `dispose` hook. A handle that was never `get()`ed never initializes
108
+ * and never runs cleanup.
109
+ */
110
+ export type Lazy<T> = {
111
+ readonly [LazyTag]: true;
57
112
  /**
58
- * Register a service this plugin publishes.
59
- * Registration is metadata-only — the actual service instance is returned
60
- * from the `boot` hook in `DotBootResult.services`.
113
+ * Initialize (once) and return the value. Concurrent callers share one
114
+ * attempt. A failed attempt is NOT cached — the next call retries.
115
+ * Throws if the handle has been disposed.
61
116
  */
62
- registerService(name: string, kind: ServiceKind): void;
63
- /** Register a route this plugin exposes. */
64
- registerRoute(route: {
65
- id: string;
66
- method?: string;
67
- path?: string;
68
- transport: RouteTransport;
69
- }): void;
70
- /** Mark the plugin as participating in a lifecycle hook. */
71
- registerLifecycleHook(hook: DotLifecycleHook): void;
72
- /** Append `provides` capability strings. */
73
- declareProvides(...capabilities: string[]): void;
74
- /** Append an extra dependency edge (alongside `plugin.dependencies`). */
75
- declareDependency(to: string, kind?: DependencyEdgeKind): void;
76
- };
77
- /** Context provided to a `boot` hook. */
78
- export type DotBootContext = {
79
- pluginName: string;
80
- appName: string;
117
+ get(): Promise<T>;
118
+ /** True once an initialization attempt has succeeded. */
119
+ readonly initialized: boolean;
120
+ /** The value if initialized, else `undefined`. Never triggers initialization. */
121
+ peek(): T | undefined;
81
122
  /**
82
- * Services published by prior-booted plugins, keyed by service name.
83
- * Use this for dependency injection between plugins.
123
+ * Run cleanup if initialized (awaits an in-flight initialization first).
124
+ * Idempotent. Called automatically by the kernel for published handles.
84
125
  */
85
- services: ReadonlyMap<string, unknown>;
86
- /** Read-only configuration bag. */
87
- config: Readonly<Record<string, unknown>>;
126
+ dispose(): Promise<void>;
88
127
  };
89
- /** Context provided to a `start` hook. */
90
- export type DotStartContext<TServices extends Record<string, unknown>> = {
91
- pluginName: string;
92
- appName: string;
93
- services: TServices;
128
+ /**
129
+ * Create a lazy service handle. See {@link Lazy} for semantics.
130
+ *
131
+ * @param init - Opens the resource. Runs at most once concurrently; a
132
+ * rejected attempt is not cached, so a later `get()` retries.
133
+ * @param options.dispose - Cleanup for the initialized value. Skipped when
134
+ * the handle was never initialized.
135
+ */
136
+ export declare function lazy<T>(init: () => Promise<T> | T, options?: {
137
+ readonly dispose?: (value: T) => Promise<void> | void;
138
+ }): Lazy<T>;
139
+ /** Type guard: is this published value a lazy service handle? */
140
+ export declare function isLazy(value: unknown): value is Lazy<unknown>;
141
+ /**
142
+ * Wrap an already-available value in a pre-initialized `Lazy<T>` handle.
143
+ * Used by the kernel to lift eager provides for `service.lazy` consumers;
144
+ * also handy for handing fakes to lazy-consuming plugins in tests. The handle
145
+ * has no cleanup of its own — the underlying value's lifecycle belongs to
146
+ * whoever created it.
147
+ */
148
+ export declare function lazyOf<T>(value: T): Lazy<T>;
149
+ /** A `needs` declaration: local alias → witness (anonymous or token). */
150
+ export type NeedsShape = Record<string, Service<unknown>>;
151
+ export type EmptyShape = {};
152
+ /**
153
+ * Local-alias view of a needs shape — what lifecycle hooks destructure.
154
+ * `{ cache: Token<KV, 'arki.kv'> }` → `{ cache: KV }`.
155
+ * `{ search: service.lazy<S>() }` → `{ search: Lazy<S> }`.
156
+ */
157
+ export type CtxOf<S extends NeedsShape> = {
158
+ [K in keyof S]: S[K] extends LazyService<infer T> ? Lazy<T> : S[K] extends Service<infer T> ? T : never;
94
159
  };
95
- /** Context provided to a `stop` hook. */
96
- export type DotStopContext<TServices extends Record<string, unknown>> = {
97
- pluginName: string;
98
- appName: string;
99
- services: TServices;
160
+ /**
161
+ * Wire-key view of a needs shape — what the app builder checks
162
+ * satisfaction against. Tokens contribute their owned key; anonymous
163
+ * witnesses contribute the property name.
164
+ * `{ cache: Token<KV, 'arki.kv'> }` → `{ 'arki.kv': KV }`.
165
+ */
166
+ export type WireNeeds<S extends NeedsShape> = {
167
+ [K in keyof S as S[K] extends Token<unknown, infer WK> ? WK : K]: S[K] extends Service<infer T> ? T : never;
100
168
  };
101
- /** Context provided to a `dispose` hook. */
102
- export type DotDisposeContext<TServices extends Record<string, unknown>> = {
169
+ /**
170
+ * No `$`-prefixed keys that prefix is the kernel context namespace
171
+ * ({@link KernelCtx}). Used as a constraint on needs shapes and provides
172
+ * records: a matching key makes the property type `never`, which no
173
+ * witness or service value satisfies, so the violation errors at the
174
+ * exact offending property. The kernel re-validates at runtime with
175
+ * `DOT_LIFECYCLE_E014` for paths the constraint cannot see (renames,
176
+ * erased plugins).
177
+ */
178
+ export type NoReservedKeys = Readonly<Record<`$${string}`, never>>;
179
+ /**
180
+ * Kernel-supplied context keys, present in every service-carrying hook
181
+ * context. The `$` prefix is a reserved namespace: `plugin()` rejects
182
+ * `$`-prefixed needs aliases and publish keys at compile time (via
183
+ * {@link NoReservedKeys}) and the kernel enforces it at runtime
184
+ * (`DOT_LIFECYCLE_E014`), so these keys can never be shadowed.
185
+ */
186
+ export type KernelCtx = {
187
+ /** App name (passed to `defineApp`). */
188
+ readonly $app: string;
189
+ /** This plugin's name. */
190
+ readonly $plugin: string;
191
+ /** Read-only runtime config bag from `defineApp(name, { config })`. */
192
+ readonly $config: Readonly<Record<string, unknown>>;
193
+ };
194
+ /** Context provided to a `configure` hook (sync registration only). */
195
+ export type ActionDeclaration = Omit<ActionManifest, 'plugin'>;
196
+ /** Structural protocol for adapter-owned declarations. */
197
+ export type ActionSource = ActionDeclaration | {
198
+ toDotAction(): ActionDeclaration;
199
+ };
200
+ export type ProjectionDeclaration = Omit<ProjectionManifest, 'plugin'>;
201
+ type LegacyRouteDeclaration = {
202
+ id: string;
203
+ method?: string;
204
+ path?: string;
205
+ transport: string;
206
+ description?: string;
207
+ input?: {
208
+ readonly query?: Readonly<JsonObject>;
209
+ readonly body?: Readonly<JsonObject>;
210
+ };
211
+ output?: Readonly<JsonObject>;
212
+ streaming?: boolean;
213
+ };
214
+ export type DotConfigureContext = {
103
215
  pluginName: string;
216
+ /** App name. */
104
217
  appName: string;
105
- services: TServices;
106
- };
107
- /** Return value of a `boot` hook. */
108
- export type DotBootResult<TServices extends Record<string, unknown>> = {
109
- /** Services this plugin publishes — added to `app.services` and visible to dependent plugins. */
110
- services?: TServices;
218
+ /**
219
+ * Register a service this plugin publishes, for manifest/diagnostics
220
+ * purposes. Registration is metadata-only the actual service instance
221
+ * is returned from the `boot` hook.
222
+ */
223
+ registerService(name: string, kind: ServiceKind): void;
224
+ /** Register an action this plugin contributes at an app boundary. */
225
+ registerAction(action: ActionDeclaration): void;
226
+ /** Register a projection renderer this plugin contributes. */
227
+ registerProjection(projection: ProjectionDeclaration): void;
228
+ /** @deprecated Use `registerAction`; removed in DOT 0.5.0. */
229
+ registerRoute(route: LegacyRouteDeclaration): void;
230
+ /** Mark the plugin as participating in a lifecycle hook. */
231
+ registerLifecycleHook(hook: 'configure' | 'boot' | 'start' | 'stop' | 'dispose'): void;
232
+ /** Append `provides` capability strings (informational, manifest-only). */
233
+ declareProvides(...capabilities: string[]): void;
111
234
  };
235
+ type MaybePromise<T> = T | Promise<T>;
236
+ declare const NeedsSym: unique symbol;
237
+ declare const ProvidesSym: unique symbol;
112
238
  /**
113
- * The DOT plugin contract.
239
+ * The DOT plugin (v2). Author through {@link plugin} — never construct directly.
240
+ *
241
+ * Hook signatures are type-erased here (`ctx: never`): the typed view
242
+ * lives on `plugin()`'s parameter, and `(ctx: Typed) => R` is assignable to
243
+ * `(ctx: never) => R` without casts (parameter contravariance from the
244
+ * bottom type). The kernel crosses the erasure boundary at the call site.
114
245
  *
115
- * Default `TServices` is `Record<string, never>` so plugins that don't publish
116
- * services don't have to specify a type argument. Default `TManifest` is the
117
- * full contribution shape.
246
+ * The phantom symbol properties carry `TNeeds` / `TProvides` for the app
247
+ * builder's compile-time wiring check; they never exist at runtime.
118
248
  */
119
- export type DotPlugin<TServices extends Record<string, unknown> = Record<string, never>, TManifest extends DotManifestContribution = DotManifestContribution> = {
249
+ export type Plugin<TNeeds extends ServiceRecord = ServiceRecord, TProvides extends ServiceRecord = ServiceRecord> = {
120
250
  /** Unique identifier for this plugin within the app. */
121
- name: string;
251
+ readonly name: string;
122
252
  /** Optional semantic version string. */
123
- version?: string;
124
- /**
125
- * Names of plugins this one depends on.
126
- * The kernel ensures dependencies are configured/booted/started first, and
127
- * stopped/disposed last.
128
- */
129
- dependencies?: readonly string[];
130
- /** Capability strings this plugin advertises (for `dependencies` resolution by capability). */
131
- provides?: readonly string[];
132
- /**
133
- * Optional static or callback-form manifest contribution. The kernel merges
134
- * this into the final manifest after `configure` runs.
135
- */
136
- manifest?: TManifest | ((ctx: DotManifestContext<TServices>) => TManifest);
137
- /**
138
- * SYNC registration hook. Declare metadata, register routes/services/jobs.
139
- * MUST NOT perform IO, MUST NOT return a Promise.
140
- */
141
- configure?: (ctx: DotConfigureContext) => void;
142
- /** Async open-resources hook. Returns published services for DI. */
143
- boot?: (ctx: DotBootContext) => Promise<DotBootResult<TServices>> | DotBootResult<TServices>;
144
- /** Async begin-active-work hook. Runs after every plugin's `boot` succeeds. */
145
- start?: (ctx: DotStartContext<TServices>) => Promise<void> | void;
146
- /** Async halt-active-work hook. Runs in reverse-topological order. */
147
- stop?: (ctx: DotStopContext<TServices>) => Promise<void> | void;
148
- /** Async release-resources hook. Runs in reverse-topological order. */
149
- dispose?: (ctx: DotDisposeContext<TServices>) => Promise<void> | void;
253
+ readonly version?: string;
254
+ /** Runtime needs shape (local alias → witness). */
255
+ readonly needs: NeedsShape;
256
+ readonly actions: readonly ActionSource[];
257
+ /** Mount-time renames: publish key → new wire key (see {@link rename}). */
258
+ readonly renames: Readonly<Record<string, string>>;
259
+ readonly hooks: {
260
+ readonly configure?: (ctx: DotConfigureContext) => void;
261
+ readonly boot?: (ctx: never) => MaybePromise<ServiceRecord | void>;
262
+ readonly start?: (ctx: never) => MaybePromise<void>;
263
+ readonly stop?: (ctx: never) => MaybePromise<void>;
264
+ readonly dispose?: (ctx: never) => MaybePromise<void>;
265
+ };
266
+ readonly [NeedsSym]?: TNeeds;
267
+ readonly [ProvidesSym]?: TProvides;
150
268
  };
269
+ /** Extract a plugin's (wire-keyed) needs record. */
270
+ export type PluginNeeds<P> = P extends Plugin<infer N, ServiceRecord> ? N : never;
271
+ /** Extract a plugin's (wire-keyed) provides record. */
272
+ export type PluginProvides<P> = P extends Plugin<ServiceRecord, infer Pr> ? Pr : never;
273
+ /** Internal type alias used by the kernel to erase plugin service generics. */
274
+ export type AnyPlugin = Plugin<ServiceRecord, ServiceRecord>;
151
275
  /**
152
- * Type-narrowing helper for plugin authors.
276
+ * Author a DOT plugin.
277
+ *
278
+ * - `TShape` is inferred from the `needs` object literal.
279
+ * - `TProvides` is inferred from `boot`'s return type — no generic argument.
280
+ * - `boot({ db, log, $app })` destructures typed services under the local
281
+ * aliases declared in `needs`, plus the `$`-prefixed kernel keys.
282
+ * - `start` / `stop` / `dispose` additionally receive the plugin's own
283
+ * provides. Reverse-order teardown guarantees needs are still alive in
284
+ * `dispose`.
153
285
  *
154
286
  * @example
155
- * export const myPlugin = defineDotPlugin<{ db: MyDb }>({
156
- * name: 'my-plugin',
157
- * async boot() {
158
- * const db = await openDb();
159
- * return { services: { db } };
287
+ * ```ts
288
+ * export const billing = plugin({
289
+ * name: 'billing',
290
+ * needs: { db: service<Db>(), log: service<Logger>() },
291
+ * async boot({ db, log }) {
292
+ * return { billing: new BillingService(db, log) };
160
293
  * },
161
- * async dispose({ services }) {
162
- * await services.db.close();
294
+ * async dispose({ billing }) {
295
+ * await billing.flush();
163
296
  * },
164
297
  * });
298
+ * ```
165
299
  */
166
- export declare function defineDotPlugin<TServices extends Record<string, unknown> = Record<string, never>>(plugin: DotPlugin<TServices>): DotPlugin<TServices>;
167
- /** Internal type alias used by the kernel to erase plugin service generics. */
168
- export type AnyDotPlugin = DotPlugin<Record<string, unknown>, DotManifestContribution>;
169
- /** Internal helper: extract the `provides` field from a plugin (always returns an array). */
170
- export declare function pluginProvides(plugin: AnyDotPlugin): readonly string[];
171
- /** Internal helper: extract the `dependencies` field from a plugin (always returns an array). */
172
- export declare function pluginDependencies(plugin: AnyDotPlugin): readonly string[];
300
+ /**
301
+ * A `boot` that returns `void` gives `TProvides` no inference candidate,
302
+ * and TypeScript then substitutes the CONSTRAINT (`ServiceRecord & …`,
303
+ * whose `keyof` is `string`) rather than the declared default. That wide
304
+ * record would poison the app builder's collision check for every later
305
+ * `.use()` `keyof TAvail & string` is never empty. Detect the fallback
306
+ * by its tell (a full string index signature — no `plugin()`-authored
307
+ * provides record has one) and collapse it to "provides nothing".
308
+ */
309
+ export type InferredProvides<TP extends ServiceRecord> = string extends keyof TP ? EmptyShape : TP;
310
+ export declare function plugin<TShape extends NeedsShape & NoReservedKeys = EmptyShape, TProvides extends ServiceRecord & NoReservedKeys = EmptyShape>(def: {
311
+ readonly name: string;
312
+ readonly version?: string;
313
+ readonly needs?: TShape;
314
+ readonly actions?: readonly ActionSource[];
315
+ readonly configure?: (ctx: DotConfigureContext) => void;
316
+ readonly boot?: (ctx: CtxOf<TShape> & KernelCtx) => MaybePromise<TProvides | void>;
317
+ readonly start?: (ctx: CtxOf<TShape> & TProvides & KernelCtx) => MaybePromise<void>;
318
+ readonly stop?: (ctx: CtxOf<TShape> & TProvides & KernelCtx) => MaybePromise<void>;
319
+ readonly dispose?: (ctx: CtxOf<TShape> & TProvides & KernelCtx) => MaybePromise<void>;
320
+ }): Plugin<WireNeeds<TShape>, InferredProvides<TProvides>>;
321
+ /** Rename a plugin's published wire keys — the multi-instance primitive. */
322
+ export type RenamedProvides<TP, M> = {
323
+ [K in keyof TP as K extends keyof M ? (M[K] extends string ? M[K] : K) : K]: TP[K];
324
+ };
325
+ /**
326
+ * Mount-time rename. `rename(dbPlugin, { db: 'reportsDb' }, 'reports-db')`
327
+ * publishes the same service under a different wire key, retyped
328
+ * accordingly — the way to mount a second instance of an adapter without
329
+ * a key collision. Renames compose: renaming an already-renamed key
330
+ * rewrites the earlier entry.
331
+ */
332
+ export declare function rename<TN extends ServiceRecord, TP extends ServiceRecord, const M extends {
333
+ readonly [K in keyof TP]?: string;
334
+ }>(p: Plugin<TN, TP>, map: M, newName?: string): Plugin<TN, RenamedProvides<TP, M>>;
335
+ /**
336
+ * Stable error thrown by DOT plugin adapters.
337
+ *
338
+ * Adapters MUST throw `DotPluginError` (not raw `Error`) when surfacing a
339
+ * misconfiguration, missing-input, or other fail-fast condition. Consumers
340
+ * and coding agents can then match on a stable `code`, follow `docsUrl`,
341
+ * and apply `remediation` without parsing the message.
342
+ *
343
+ * Codes are per-adapter. Recommended prefix is `<PKG>_PLUGIN_E<NNN>` (e.g.
344
+ * `KV_PLUGIN_E001`, `DB_PLUGIN_E001`). The kernel does not own the code
345
+ * namespace — each adapter defines its own constants and links them in
346
+ * its README.
347
+ *
348
+ * @see packages/dot/docs/principles.md — principle 1.3 ("errors are part
349
+ * of the API") and principle 4 ("agent-discoverable everywhere").
350
+ */
351
+ export declare class DotPluginError extends Error {
352
+ /** Stable error code, e.g. `KV_PLUGIN_E001`. */
353
+ readonly code: string;
354
+ /** One-sentence guidance on how to fix the underlying problem. */
355
+ readonly remediation: string;
356
+ /** URL of the documentation page that explains this error. */
357
+ readonly docsUrl: string;
358
+ constructor(args: {
359
+ readonly code: string;
360
+ readonly message: string;
361
+ readonly remediation: string;
362
+ readonly docsUrl: string;
363
+ });
364
+ }
173
365
  /** Re-exported for downstream typing. */
174
- export { type DotAppManifest, type PluginManifest } from './manifest.js';
366
+ export { type ActionManifest, type DotAppManifest, type PluginManifest, type ProjectionManifest } from './manifest.js';
175
367
  //# sourceMappingURL=plugin-contract.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-contract.d.ts","sourceRoot":"","sources":["../src/plugin-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAErF;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,sCAAsC;IACtC,QAAQ,CAAC,EAAE,SAAS;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,WAAW,CAAC;KACnB,EAAE,CAAC;IACJ,kCAAkC;IAClC,MAAM,CAAC,EAAE,SAAS;QAChB,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,cAAc,CAAC;KAC3B,EAAE,CAAC;IACJ,sFAAsF;IACtF,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,mCAAmC;IACnC,YAAY,CAAC,EAAE,SAAS;QACtB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,CAAC,EAAE,kBAAkB,CAAC;KAC3B,EAAE,CAAC;CACL,CAAC;AAEF,iDAAiD;AACjD,MAAM,MAAM,kBAAkB,C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