@smthrs/plugin 0.0.0-stage → 1.0.0-rc.4

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 (118) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/LICENSE +21 -0
  3. package/README.md +86 -2
  4. package/dist/cjs/Config.d.ts +129 -0
  5. package/dist/cjs/Config.d.ts.map +1 -0
  6. package/dist/cjs/Config.js +115 -0
  7. package/dist/cjs/Config.js.map +7 -0
  8. package/dist/cjs/Hooks.d.ts +176 -0
  9. package/dist/cjs/Hooks.d.ts.map +1 -0
  10. package/dist/cjs/Hooks.js +34 -0
  11. package/dist/cjs/Hooks.js.map +7 -0
  12. package/dist/cjs/Kernel.d.ts +81 -0
  13. package/dist/cjs/Kernel.d.ts.map +1 -0
  14. package/dist/cjs/Kernel.js +57 -0
  15. package/dist/cjs/Kernel.js.map +7 -0
  16. package/dist/cjs/Plugin.d.ts +71 -0
  17. package/dist/cjs/Plugin.d.ts.map +1 -0
  18. package/dist/cjs/Plugin.js +25 -0
  19. package/dist/cjs/Plugin.js.map +7 -0
  20. package/dist/cjs/PluginError.d.ts +50 -0
  21. package/dist/cjs/PluginError.d.ts.map +1 -0
  22. package/dist/cjs/PluginError.js +58 -0
  23. package/dist/cjs/PluginError.js.map +7 -0
  24. package/dist/cjs/Plugins.d.ts +97 -0
  25. package/dist/cjs/Plugins.d.ts.map +1 -0
  26. package/dist/cjs/Plugins.js +160 -0
  27. package/dist/cjs/Plugins.js.map +7 -0
  28. package/dist/cjs/Resolve.d.ts +128 -0
  29. package/dist/cjs/Resolve.d.ts.map +1 -0
  30. package/dist/cjs/Resolve.js +343 -0
  31. package/dist/cjs/Resolve.js.map +7 -0
  32. package/dist/cjs/index.d.ts +83 -0
  33. package/dist/cjs/index.d.ts.map +1 -0
  34. package/dist/cjs/index.js +45 -0
  35. package/dist/cjs/index.js.map +7 -0
  36. package/dist/cjs/internal/Boundary.d.ts +96 -0
  37. package/dist/cjs/internal/Boundary.d.ts.map +1 -0
  38. package/dist/cjs/internal/Boundary.js +129 -0
  39. package/dist/cjs/internal/Boundary.js.map +7 -0
  40. package/dist/cjs/internal/mergePluginLayers.d.ts +21 -0
  41. package/dist/cjs/internal/mergePluginLayers.d.ts.map +1 -0
  42. package/dist/cjs/internal/mergePluginLayers.js +57 -0
  43. package/dist/cjs/internal/mergePluginLayers.js.map +7 -0
  44. package/dist/cjs/internal/snapshotCacheEnvironment.d.ts +19 -0
  45. package/dist/cjs/internal/snapshotCacheEnvironment.d.ts.map +1 -0
  46. package/dist/cjs/internal/snapshotCacheEnvironment.js +92 -0
  47. package/dist/cjs/internal/snapshotCacheEnvironment.js.map +7 -0
  48. package/dist/cjs/package.json +1 -0
  49. package/dist/esm/Config.d.ts +129 -0
  50. package/dist/esm/Config.d.ts.map +1 -0
  51. package/dist/esm/Config.js +160 -0
  52. package/dist/esm/Config.js.map +1 -0
  53. package/dist/esm/Hooks.d.ts +176 -0
  54. package/dist/esm/Hooks.d.ts.map +1 -0
  55. package/dist/esm/Hooks.js +56 -0
  56. package/dist/esm/Hooks.js.map +1 -0
  57. package/dist/esm/Kernel.d.ts +81 -0
  58. package/dist/esm/Kernel.d.ts.map +1 -0
  59. package/dist/esm/Kernel.js +58 -0
  60. package/dist/esm/Kernel.js.map +1 -0
  61. package/dist/esm/Plugin.d.ts +71 -0
  62. package/dist/esm/Plugin.d.ts.map +1 -0
  63. package/dist/esm/Plugin.js +20 -0
  64. package/dist/esm/Plugin.js.map +1 -0
  65. package/dist/esm/PluginError.d.ts +50 -0
  66. package/dist/esm/PluginError.d.ts.map +1 -0
  67. package/dist/esm/PluginError.js +53 -0
  68. package/dist/esm/PluginError.js.map +1 -0
  69. package/dist/esm/Plugins.d.ts +97 -0
  70. package/dist/esm/Plugins.d.ts.map +1 -0
  71. package/dist/esm/Plugins.js +178 -0
  72. package/dist/esm/Plugins.js.map +1 -0
  73. package/dist/esm/Resolve.d.ts +128 -0
  74. package/dist/esm/Resolve.d.ts.map +1 -0
  75. package/dist/esm/Resolve.js +367 -0
  76. package/dist/esm/Resolve.js.map +1 -0
  77. package/dist/esm/index.d.ts +83 -0
  78. package/dist/esm/index.d.ts.map +1 -0
  79. package/dist/esm/index.js +48 -0
  80. package/dist/esm/index.js.map +1 -0
  81. package/dist/esm/internal/Boundary.d.ts +96 -0
  82. package/dist/esm/internal/Boundary.d.ts.map +1 -0
  83. package/dist/esm/internal/Boundary.js +162 -0
  84. package/dist/esm/internal/Boundary.js.map +1 -0
  85. package/dist/esm/internal/mergePluginLayers.d.ts +21 -0
  86. package/dist/esm/internal/mergePluginLayers.d.ts.map +1 -0
  87. package/dist/esm/internal/mergePluginLayers.js +41 -0
  88. package/dist/esm/internal/mergePluginLayers.js.map +1 -0
  89. package/dist/esm/internal/snapshotCacheEnvironment.d.ts +19 -0
  90. package/dist/esm/internal/snapshotCacheEnvironment.d.ts.map +1 -0
  91. package/dist/esm/internal/snapshotCacheEnvironment.js +63 -0
  92. package/dist/esm/internal/snapshotCacheEnvironment.js.map +1 -0
  93. package/docs/README.md +131 -0
  94. package/docs/api.md +522 -0
  95. package/docs/concepts/configuration.md +111 -0
  96. package/docs/concepts/hook-kinds.md +107 -0
  97. package/docs/concepts/resolution.md +132 -0
  98. package/docs/guides/cache-identity.md +106 -0
  99. package/docs/guides/contribute-services.md +84 -0
  100. package/docs/guides/host-your-own-hooks.md +129 -0
  101. package/docs/guides/order-handlers.md +76 -0
  102. package/docs/guides/select-plugins.md +72 -0
  103. package/docs/guides/testing.md +149 -0
  104. package/docs/installation.md +71 -0
  105. package/docs/quickstart.md +151 -0
  106. package/docs/troubleshooting.md +179 -0
  107. package/package.json +179 -3
  108. package/src/Config.ts +207 -0
  109. package/src/Hooks.ts +212 -0
  110. package/src/Kernel.ts +119 -0
  111. package/src/Plugin.ts +80 -0
  112. package/src/PluginError.ts +62 -0
  113. package/src/Plugins.ts +254 -0
  114. package/src/Resolve.ts +535 -0
  115. package/src/index.ts +91 -0
  116. package/src/internal/Boundary.ts +252 -0
  117. package/src/internal/mergePluginLayers.ts +57 -0
  118. package/src/internal/snapshotCacheEnvironment.ts +77 -0
@@ -0,0 +1,367 @@
1
+ /**
2
+ * Bounded plugin resolution: admit, filter, validate, order, and snapshot.
3
+ *
4
+ * The resulting catalog owns every record it exposes. Dispatch never reads a
5
+ * caller-owned map, plugin record, hook object, config value, or cache identity.
6
+ *
7
+ * @since 1.0.0-rc.0
8
+ */
9
+ import * as ImmutableMap from "@smthrs/canonical/ReadonlyMap";
10
+ import * as Effect from "effect/Effect";
11
+ import * as Layer from "effect/Layer";
12
+ import * as Config from "./Config.js";
13
+ import { engineHooks, handlerOf, orderOf } from "./Hooks.js";
14
+ import * as Boundary from "./internal/Boundary.js";
15
+ import { mergePluginLayers } from "./internal/mergePluginLayers.js";
16
+ import { snapshotCacheEnvironment } from "./internal/snapshotCacheEnvironment.js";
17
+ import { PluginError } from "./PluginError.js";
18
+ /**
19
+ * Maximum nested preset-array depth accepted at startup.
20
+ *
21
+ * @category limits
22
+ * @since 1.0.0-rc.0
23
+ */
24
+ export const maximumPluginDepth = 64;
25
+ /**
26
+ * Maximum plugins accepted by one kernel.
27
+ *
28
+ * @category limits
29
+ * @since 1.0.0-rc.0
30
+ */
31
+ export const maximumPlugins = 256;
32
+ /**
33
+ * Maximum aggregate hook handlers accepted by one kernel.
34
+ *
35
+ * @category limits
36
+ * @since 1.0.0-rc.0
37
+ */
38
+ export const maximumHandlers = 1_024;
39
+ /**
40
+ * Maximum input nodes, including arrays and omitted entries.
41
+ *
42
+ * @category limits
43
+ * @since 1.0.0-rc.0
44
+ */
45
+ export const maximumPluginInputNodes = 4_096;
46
+ /**
47
+ * Maximum UTF-16 length of one plugin or hook name.
48
+ *
49
+ * @category limits
50
+ * @since 1.0.0-rc.0
51
+ */
52
+ export const maximumPluginNameLength = 256;
53
+ /**
54
+ * Default fiber bound for parallel observers.
55
+ *
56
+ * @category limits
57
+ * @since 1.0.0-rc.0
58
+ */
59
+ export const defaultParallelConcurrency = 16;
60
+ /**
61
+ * Maximum configurable parallel-observer bound.
62
+ *
63
+ * @category limits
64
+ * @since 1.0.0-rc.0
65
+ */
66
+ export const maximumParallelConcurrency = 256;
67
+ const failure = (code, message, path, fields = {}) => new PluginError({ code, message, path, ...fields });
68
+ const invalidPlugin = (path, complaint, fields = {}) => failure("invalid_plugin", `plugin input ${complaint}`, path, fields);
69
+ // Bound before quoting or scanning caller-controlled keys. Keep Boundary's
70
+ // identifier/dot and JSON-quoted/bracket path convention.
71
+ const diagnosticKey = (key) => key.length > 64 ? `${key.slice(0, 64)}...` : key;
72
+ const childPath = (path, key) => {
73
+ const bounded = diagnosticKey(key);
74
+ return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(bounded) ? `${path}.${bounded}` : `${path}[${JSON.stringify(bounded)}]`;
75
+ };
76
+ const ownData = (input, path, allowed) => {
77
+ if (typeof input !== "object" || input === null || Array.isArray(input)) {
78
+ throw invalidPlugin(path, "must be an ordinary record");
79
+ }
80
+ const prototype = Object.getPrototypeOf(input);
81
+ if (prototype !== Object.prototype && prototype !== null)
82
+ throw invalidPlugin(path, "must be an ordinary record");
83
+ const output = {};
84
+ for (const key of Reflect.ownKeys(input)) {
85
+ if (typeof key !== "string")
86
+ throw invalidPlugin(path, "must not contain symbol keys");
87
+ if (allowed !== undefined && !allowed.has(key)) {
88
+ throw invalidPlugin(childPath(path, key), "contains an unknown property");
89
+ }
90
+ const descriptor = Object.getOwnPropertyDescriptor(input, key);
91
+ if (descriptor === undefined || !("value" in descriptor) || !descriptor.enumerable) {
92
+ throw invalidPlugin(childPath(path, key), "must be an enumerable data property");
93
+ }
94
+ Object.defineProperty(output, key, { value: descriptor.value, enumerable: true });
95
+ }
96
+ return output;
97
+ };
98
+ const snapshotOptions = (input) => {
99
+ const values = ownData(input, "$options", new Set(["config", "target", "hooks", "cacheEnvironment", "parallelConcurrency"]));
100
+ return {
101
+ config: values.config,
102
+ target: values.target,
103
+ hooks: values.hooks,
104
+ cacheEnvironment: values.cacheEnvironment,
105
+ parallelConcurrency: values.parallelConcurrency
106
+ };
107
+ };
108
+ const validName = (value) => typeof value === "string" && value.length > 0 && value.length <= maximumPluginNameLength &&
109
+ Boundary.isWellFormedText(value) && !/^\s*$/u.test(value) && !/\p{Cc}/u.test(value);
110
+ const snapshotCatalog = (input) => {
111
+ if (typeof input !== "object" || input === null || Array.isArray(input)) {
112
+ throw invalidPlugin("$options.hooks", "must be an ordinary hook catalog");
113
+ }
114
+ const prototype = Object.getPrototypeOf(input);
115
+ if (prototype !== Object.prototype && prototype !== null) {
116
+ throw invalidPlugin("$options.hooks", "must be an ordinary hook catalog");
117
+ }
118
+ const output = {};
119
+ for (const key of Reflect.ownKeys(input)) {
120
+ if (typeof key !== "string" || !validName(key)) {
121
+ throw invalidPlugin("$options.hooks", "contains an invalid hook name");
122
+ }
123
+ const descriptor = Object.getOwnPropertyDescriptor(input, key);
124
+ if (descriptor === undefined || !("value" in descriptor) || !descriptor.enumerable) {
125
+ throw invalidPlugin(childPath("$options.hooks", key), "must be an enumerable data property");
126
+ }
127
+ if (!["sequential", "parallel", "first", "waterfall"].includes(descriptor.value)) {
128
+ throw invalidPlugin(childPath("$options.hooks", key), "contains an invalid hook kind");
129
+ }
130
+ Object.defineProperty(output, key, { value: descriptor.value, enumerable: true });
131
+ }
132
+ for (const hook of Object.keys(engineHooks)) {
133
+ if (Object.hasOwn(output, hook) && output[hook] !== engineHooks[hook]) {
134
+ throw failure("hook_kind_mismatch", `hook catalog declares shared hook ${JSON.stringify(hook)} as ${JSON.stringify(output[hook])}, the kernel dispatches it as ${JSON.stringify(engineHooks[hook])}`, childPath("$options.hooks", hook), { hook });
135
+ }
136
+ }
137
+ return Object.freeze(output);
138
+ };
139
+ const snapshotHook = (entry, path, plugin, hook) => {
140
+ if (typeof entry === "function")
141
+ return entry;
142
+ if (entry === undefined) {
143
+ throw invalidPlugin(path, "must be a function or a hook object", { plugin, hook });
144
+ }
145
+ const values = ownData(entry, path, new Set(["order", "handler"]));
146
+ if (typeof values.handler !== "function") {
147
+ throw invalidPlugin(`${path}.handler`, "must be a function", { plugin, hook });
148
+ }
149
+ if (values.order !== undefined && values.order !== "pre" && values.order !== "post") {
150
+ throw invalidPlugin(`${path}.order`, "must be pre or post", { plugin, hook });
151
+ }
152
+ return Object.freeze({
153
+ ...(values.order === undefined ? {} : { order: values.order }),
154
+ handler: values.handler
155
+ });
156
+ };
157
+ const snapshotPlugin = (input, path) => {
158
+ const values = ownData(input, path, new Set(["name", "version", "enforce", "apply", "layer", "hooks"]));
159
+ if (!validName(values.name))
160
+ throw invalidPlugin(`${path}.name`, "requires a bounded non-empty name");
161
+ const name = values.name;
162
+ if (values.version !== undefined && !validName(values.version)) {
163
+ throw invalidPlugin(`${path}.version`, "requires a bounded non-empty version", { plugin: name });
164
+ }
165
+ if (values.enforce !== undefined && values.enforce !== "pre" && values.enforce !== "post") {
166
+ throw invalidPlugin(`${path}.enforce`, "must be pre or post", { plugin: name });
167
+ }
168
+ if (values.apply !== undefined && values.apply !== "engine" && values.apply !== "harness" &&
169
+ typeof values.apply !== "function")
170
+ throw invalidPlugin(`${path}.apply`, "must be engine, harness, or a predicate", { plugin: name });
171
+ if (values.layer !== undefined && !Layer.isLayer(values.layer)) {
172
+ throw invalidPlugin(`${path}.layer`, "must be an Effect Layer", { plugin: name });
173
+ }
174
+ let hooks;
175
+ if (values.hooks !== undefined) {
176
+ const rawHooks = ownData(values.hooks, `${path}.hooks`);
177
+ const snapshot = Object.create(null);
178
+ for (const [index, hook] of Object.keys(rawHooks).entries()) {
179
+ if (!validName(hook)) {
180
+ throw invalidPlugin(`${path}.hooks[${index}]`, "contains an invalid hook name");
181
+ }
182
+ const entry = rawHooks[hook];
183
+ Object.defineProperty(snapshot, hook, {
184
+ value: snapshotHook(entry, childPath(`${path}.hooks`, hook), name, hook),
185
+ enumerable: true
186
+ });
187
+ }
188
+ hooks = Object.freeze(snapshot);
189
+ }
190
+ return Object.freeze({
191
+ name,
192
+ ...(values.version === undefined ? {} : { version: values.version }),
193
+ ...(values.enforce === undefined ? {} : { enforce: values.enforce }),
194
+ ...(values.apply === undefined ? {} : { apply: values.apply }),
195
+ ...(values.layer === undefined ? {} : { layer: values.layer }),
196
+ ...(hooks === undefined ? {} : { hooks: hooks })
197
+ });
198
+ };
199
+ const flatten = (input) => {
200
+ const output = [];
201
+ const arrays = new WeakSet();
202
+ const stack = [
203
+ { value: input, path: "$", depth: 0 }
204
+ ];
205
+ let nodes = 0;
206
+ while (stack.length > 0) {
207
+ const current = stack.pop();
208
+ nodes += 1;
209
+ if (current.value === false || current.value === null || current.value === undefined)
210
+ continue;
211
+ if (Array.isArray(current.value)) {
212
+ if (current.depth >= maximumPluginDepth) {
213
+ throw failure("resource_limit", `plugin input exceeds the depth limit of ${maximumPluginDepth}`, current.path);
214
+ }
215
+ if (arrays.has(current.value))
216
+ throw invalidPlugin(current.path, "contains a cycle or repeated preset array");
217
+ arrays.add(current.value);
218
+ const length = current.value.length;
219
+ // Every queued frame and array element costs a node, including omitted
220
+ // entries. Refuse before enumerating keys, descriptors, or child frames.
221
+ if (length > maximumPluginInputNodes - nodes - stack.length) {
222
+ throw failure("resource_limit", `plugin input exceeds the ${maximumPluginInputNodes}-node limit`, current.path);
223
+ }
224
+ const keys = Reflect.ownKeys(current.value);
225
+ if (keys.length !== length + 1 || !keys.includes("length")) {
226
+ throw invalidPlugin(current.path, "must be a dense preset array with no extra properties");
227
+ }
228
+ for (let index = length - 1; index >= 0; index--) {
229
+ const descriptor = Object.getOwnPropertyDescriptor(current.value, String(index));
230
+ if (descriptor === undefined || !("value" in descriptor) || !descriptor.enumerable) {
231
+ throw invalidPlugin(`${current.path}[${index}]`, "must be an enumerable data property");
232
+ }
233
+ stack.push({ value: descriptor.value, path: `${current.path}[${index}]`, depth: current.depth + 1 });
234
+ }
235
+ continue;
236
+ }
237
+ output.push(Object.freeze({ plugin: snapshotPlugin(current.value, current.path), path: current.path }));
238
+ if (output.length > maximumPlugins) {
239
+ throw failure("resource_limit", `plugin input exceeds the ${maximumPlugins}-plugin limit`, current.path);
240
+ }
241
+ }
242
+ return output;
243
+ };
244
+ const included = (plugin, config, target) => {
245
+ const apply = plugin.apply;
246
+ if (apply === undefined)
247
+ return Effect.succeed(true);
248
+ if (typeof apply !== "function")
249
+ return Effect.succeed(apply === target);
250
+ return Effect.try({
251
+ try: () => apply(config),
252
+ catch: () => failure("apply_failed", `plugin "${plugin.name}" apply predicate failed`, "$.apply", {
253
+ plugin: plugin.name
254
+ })
255
+ }).pipe(Effect.flatMap((result) => typeof result === "boolean"
256
+ ? Effect.succeed(result)
257
+ : Effect.fail(invalidPlugin("$.apply", "predicate must return a boolean", { plugin: plugin.name }))));
258
+ };
259
+ const rank = (enforce) => (enforce === "pre" ? 0 : enforce === "post" ? 2 : 1);
260
+ /**
261
+ * Resolves a plugin preset into an immutable, resource-bounded catalog.
262
+ *
263
+ * @category constructors
264
+ * @since 1.0.0-rc.0
265
+ */
266
+ export const resolve = (input, options = {}, configOverride) => Effect.gen(function* () {
267
+ const raw = yield* Effect.try({
268
+ try: () => snapshotOptions(options),
269
+ catch: (cause) => cause instanceof PluginError
270
+ ? cause
271
+ : invalidPlugin("$options", "could not be inspected without executing user code")
272
+ });
273
+ if (configOverride !== undefined && raw.config !== undefined) {
274
+ return yield* Effect.fail(invalidPlugin("$options.config", "cannot declare config in options alongside the positional override"));
275
+ }
276
+ if (raw.target !== undefined && raw.target !== "engine" && raw.target !== "harness") {
277
+ return yield* Effect.fail(invalidPlugin("$options.target", "must be engine or harness"));
278
+ }
279
+ if (raw.parallelConcurrency !== undefined &&
280
+ (typeof raw.parallelConcurrency !== "number" || !Number.isSafeInteger(raw.parallelConcurrency) ||
281
+ raw.parallelConcurrency <= 0 ||
282
+ raw.parallelConcurrency > maximumParallelConcurrency)) {
283
+ return yield* Effect.fail(failure("resource_limit", `parallel concurrency must be between 1 and ${maximumParallelConcurrency}`, "$options.parallelConcurrency"));
284
+ }
285
+ const parallelConcurrency = raw.parallelConcurrency === undefined
286
+ ? defaultParallelConcurrency
287
+ : raw.parallelConcurrency;
288
+ const config = yield* Config.snapshot(configOverride ?? raw.config ?? {});
289
+ const known = yield* Effect.try({
290
+ try: () => snapshotCatalog(raw.hooks ?? engineHooks),
291
+ catch: (cause) => cause instanceof PluginError
292
+ ? cause
293
+ : invalidPlugin("$options.hooks", "could not be inspected without executing user code")
294
+ });
295
+ const admitted = yield* Effect.try({
296
+ try: () => flatten(input),
297
+ catch: (cause) => cause instanceof PluginError
298
+ ? cause
299
+ : invalidPlugin("$", "could not be inspected without executing user code")
300
+ });
301
+ const target = raw.target ?? "engine";
302
+ const selected = yield* Effect.filter(admitted, ({ plugin }) => included(plugin, config, target));
303
+ let handlerCount = 0;
304
+ for (const { path, plugin } of selected) {
305
+ const pluginHooks = plugin.hooks;
306
+ if (pluginHooks === undefined)
307
+ continue;
308
+ for (const hook of Object.keys(pluginHooks)) {
309
+ if (!Object.hasOwn(known, hook)) {
310
+ return yield* Effect.fail(failure("unknown_hook", `plugin ${JSON.stringify(plugin.name)} declares unknown hook ${JSON.stringify(diagnosticKey(hook))}`, childPath(`${path}.hooks`, hook), { plugin: plugin.name, hook }));
311
+ }
312
+ handlerCount += 1;
313
+ if (handlerCount > maximumHandlers) {
314
+ return yield* Effect.fail(failure("resource_limit", `plugin handlers exceed the limit of ${maximumHandlers}`, childPath(`${path}.hooks`, hook)));
315
+ }
316
+ }
317
+ }
318
+ const seen = new Set();
319
+ for (const { plugin } of selected) {
320
+ if (seen.has(plugin.name)) {
321
+ return yield* Effect.fail(failure("duplicate_name", `duplicate plugin name "${plugin.name}"`, "$.name", { plugin: plugin.name }));
322
+ }
323
+ seen.add(plugin.name);
324
+ }
325
+ const plugins = Object.freeze(selected
326
+ .map(({ plugin }, index) => ({ plugin, index }))
327
+ .sort((left, right) => rank(left.plugin.enforce) - rank(right.plugin.enforce) || left.index - right.index)
328
+ .map(({ plugin }) => plugin));
329
+ const entries = [];
330
+ for (const hook of Object.keys(known)) {
331
+ const records = [];
332
+ for (const [index, plugin] of plugins.entries()) {
333
+ const pluginHooks = plugin.hooks;
334
+ if (pluginHooks === undefined || !Object.hasOwn(pluginHooks, hook))
335
+ continue;
336
+ const entry = pluginHooks[hook];
337
+ const record = Object.freeze({ plugin: plugin.name, hook, handler: handlerOf(entry) });
338
+ records.push({ record, enforceRank: rank(plugin.enforce), orderRank: rank(orderOf(entry)), index });
339
+ }
340
+ // Vite's rule, verbatim: the per-hook `order` is the outer partition and
341
+ // the enforce-sorted plugin list supplies the stable order inside it, so a
342
+ // hook marked `order: "pre"` runs ahead of every normal-order handler even
343
+ // when its plugin is `enforce: "post"`.
344
+ const ordered = records
345
+ .sort((left, right) => left.orderRank - right.orderRank || left.enforceRank - right.enforceRank || left.index - right.index)
346
+ .map(({ record }) => record);
347
+ if (ordered.length > 0)
348
+ entries.push([hook, Object.freeze(ordered)]);
349
+ }
350
+ const cacheEnvironment = yield* snapshotCacheEnvironment(raw.cacheEnvironment, plugins);
351
+ return Object.freeze({
352
+ plugins,
353
+ handlers: ImmutableMap.make(entries),
354
+ kinds: known,
355
+ parallelConcurrency,
356
+ ...(cacheEnvironment === undefined ? {} : { cacheEnvironment })
357
+ });
358
+ });
359
+ /**
360
+ * Merges every resolved plugin layer left-to-right and supplies the detached
361
+ * cache environment captured during resolution.
362
+ *
363
+ * @category combinators
364
+ * @since 1.0.0-rc.0
365
+ */
366
+ export const layer = (resolved) => mergePluginLayers(resolved.plugins, resolved.cacheEnvironment);
367
+ //# sourceMappingURL=Resolve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Resolve.js","sourceRoot":"","sources":["../../src/Resolve.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,YAAY,MAAM,+BAA+B,CAAA;AAE7D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;A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AQ,CAAC,gBAAgB,CAAC,CAAA","sourcesContent":["/**\n * Bounded plugin resolution: admit, filter, validate, order, and snapshot.\n *\n * The resulting catalog owns every record it exposes. Dispatch never reads a\n * caller-owned map, plugin record, hook object, config value, or cache identity.\n *\n * @since 1.0.0-rc.0\n */\n\nimport * as ImmutableMap from \"@smthrs/canonical/ReadonlyMap\"\nimport type { Action } from \"@smthrs/flow\"\nimport * as Effect from \"effect/Effect\"\nimport * as Layer from \"effect/Layer\"\nimport type { FlowsConfig } from \"./Config.ts\"\nimport * as Config from \"./Config.ts\"\nimport type { HookCatalog, HookKind, HookObject } from \"./Hooks.ts\"\nimport { engineHooks, handlerOf, orderOf } from \"./Hooks.ts\"\nimport type { FlowsHooks } from \"./index.ts\"\nimport * as Boundary from \"./internal/Boundary.ts\"\nimport { mergePluginLayers } from \"./internal/mergePluginLayers.ts\"\nimport { snapshotCacheEnvironment } from \"./internal/snapshotCacheEnvironment.ts\"\nimport type { Apply, FlowsPlugin, PluginInput } from \"./Plugin.ts\"\nimport { PluginError, type PluginErrorCode } from \"./PluginError.ts\"\n\n/**\n * Maximum nested preset-array depth accepted at startup.\n *\n * @category limits\n * @since 1.0.0-rc.0\n */\nexport const maximumPluginDepth = 64\n\n/**\n * Maximum plugins accepted by one kernel.\n *\n * @category limits\n * @since 1.0.0-rc.0\n */\nexport const maximumPlugins = 256\n\n/**\n * Maximum aggregate hook handlers accepted by one kernel.\n *\n * @category limits\n * @since 1.0.0-rc.0\n */\nexport const maximumHandlers = 1_024\n\n/**\n * Maximum input nodes, including arrays and omitted entries.\n *\n * @category limits\n * @since 1.0.0-rc.0\n */\nexport const maximumPluginInputNodes = 4_096\n\n/**\n * Maximum UTF-16 length of one plugin or hook name.\n *\n * @category limits\n * @since 1.0.0-rc.0\n */\nexport const maximumPluginNameLength = 256\n\n/**\n * Default fiber bound for parallel observers.\n *\n * @category limits\n * @since 1.0.0-rc.0\n */\nexport const defaultParallelConcurrency = 16\n\n/**\n * Maximum configurable parallel-observer bound.\n *\n * @category limits\n * @since 1.0.0-rc.0\n */\nexport const maximumParallelConcurrency = 256\n\n/**\n * One resolved handler with immutable attribution.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport interface HandlerRecord {\n readonly plugin: string\n readonly hook: string\n readonly handler: (...args: Array<any>) => unknown\n}\n\n/**\n * The immutable output of plugin resolution.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport interface Resolved<H = FlowsHooks> {\n readonly plugins: ReadonlyArray<FlowsPlugin<H>>\n readonly handlers: ReadonlyMap<string, ReadonlyArray<HandlerRecord>>\n /** The frozen runtime catalog this resolution admitted. Dispatch refuses a method whose kind differs from it. */\n readonly kinds: Readonly<Record<string, HookKind>>\n readonly parallelConcurrency: number\n readonly cacheEnvironment?: Action.CacheEnvironment | undefined\n}\n\n/**\n * Options for {@link resolve}.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport interface Options<H = FlowsHooks> {\n /** Pre-resolution config tested by `apply` predicates. */\n readonly config?: FlowsConfig | undefined\n /** Host whose literal `apply` selectors are active. Defaults to `\"engine\"`. */\n readonly target?: \"engine\" | \"harness\" | undefined\n /**\n * Hook names recognized by this host, each with the kind `H` declares for\n * it. The shared `config` and `configResolved` hooks are fixed to\n * `waterfall` and `parallel`; another kind fails with `hook_kind_mismatch`.\n */\n readonly hooks?: HookCatalog<H> | undefined\n /** Complete composition identity for sealed activity keys. Requires every selected plugin to have a version. */\n readonly cacheEnvironment?: Action.CacheEnvironment | undefined\n /** Maximum observers run at once. Defaults to 16 and cannot exceed 256. */\n readonly parallelConcurrency?: number | undefined\n}\n\ninterface RawOptions {\n readonly config: unknown\n readonly target: unknown\n readonly hooks: unknown\n readonly cacheEnvironment: unknown\n readonly parallelConcurrency: unknown\n}\n\nconst failure = (\n code: PluginErrorCode,\n message: string,\n path: string,\n fields: { readonly plugin?: string; readonly hook?: string } = {}\n): PluginError => new PluginError({ code, message, path, ...fields })\n\nconst invalidPlugin = (\n path: string,\n complaint: string,\n fields: { readonly plugin?: string; readonly hook?: string } = {}\n): PluginError => failure(\"invalid_plugin\", `plugin input ${complaint}`, path, fields)\n\n// Bound before quoting or scanning caller-controlled keys. Keep Boundary's\n// identifier/dot and JSON-quoted/bracket path convention.\nconst diagnosticKey = (key: string): string => key.length > 64 ? `${key.slice(0, 64)}...` : key\n\nconst childPath = (path: string, key: string): string => {\n const bounded = diagnosticKey(key)\n return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(bounded) ? `${path}.${bounded}` : `${path}[${JSON.stringify(bounded)}]`\n}\n\nconst ownData = (\n input: unknown,\n path: string,\n allowed?: ReadonlySet<string>\n): Readonly<Record<string, unknown>> => {\n if (typeof input !== \"object\" || input === null || Array.isArray(input)) {\n throw invalidPlugin(path, \"must be an ordinary record\")\n }\n const prototype = Object.getPrototypeOf(input)\n if (prototype !== Object.prototype && prototype !== null) throw invalidPlugin(path, \"must be an ordinary record\")\n const output: Record<string, unknown> = {}\n for (const key of Reflect.ownKeys(input)) {\n if (typeof key !== \"string\") throw invalidPlugin(path, \"must not contain symbol keys\")\n if (allowed !== undefined && !allowed.has(key)) {\n throw invalidPlugin(childPath(path, key), \"contains an unknown property\")\n }\n const descriptor = Object.getOwnPropertyDescriptor(input, key)\n if (descriptor === undefined || !(\"value\" in descriptor) || !descriptor.enumerable) {\n throw invalidPlugin(childPath(path, key), \"must be an enumerable data property\")\n }\n Object.defineProperty(output, key, { value: descriptor.value, enumerable: true })\n }\n return output\n}\n\nconst snapshotOptions = (input: unknown): RawOptions => {\n const values = ownData(\n input,\n \"$options\",\n new Set([\"config\", \"target\", \"hooks\", \"cacheEnvironment\", \"parallelConcurrency\"])\n )\n return {\n config: values.config,\n target: values.target,\n hooks: values.hooks,\n cacheEnvironment: values.cacheEnvironment,\n parallelConcurrency: values.parallelConcurrency\n }\n}\n\nconst validName = (value: unknown): value is string =>\n typeof value === \"string\" && value.length > 0 && value.length <= maximumPluginNameLength &&\n Boundary.isWellFormedText(value) && !/^\\s*$/u.test(value) && !/\\p{Cc}/u.test(value)\n\nconst snapshotCatalog = (input: unknown): Readonly<Record<string, HookKind>> => {\n if (typeof input !== \"object\" || input === null || Array.isArray(input)) {\n throw invalidPlugin(\"$options.hooks\", \"must be an ordinary hook catalog\")\n }\n const prototype = Object.getPrototypeOf(input)\n if (prototype !== Object.prototype && prototype !== null) {\n throw invalidPlugin(\"$options.hooks\", \"must be an ordinary hook catalog\")\n }\n const output: Record<string, HookKind> = {}\n for (const key of Reflect.ownKeys(input)) {\n if (typeof key !== \"string\" || !validName(key)) {\n throw invalidPlugin(\"$options.hooks\", \"contains an invalid hook name\")\n }\n const descriptor = Object.getOwnPropertyDescriptor(input, key)\n if (descriptor === undefined || !(\"value\" in descriptor) || !descriptor.enumerable) {\n throw invalidPlugin(childPath(\"$options.hooks\", key), \"must be an enumerable data property\")\n }\n if (!([\"sequential\", \"parallel\", \"first\", \"waterfall\"] as ReadonlyArray<unknown>).includes(descriptor.value)) {\n throw invalidPlugin(childPath(\"$options.hooks\", key), \"contains an invalid hook kind\")\n }\n Object.defineProperty(output, key, { value: descriptor.value, enumerable: true })\n }\n for (const hook of Object.keys(engineHooks) as ReadonlyArray<keyof typeof engineHooks>) {\n if (Object.hasOwn(output, hook) && output[hook] !== engineHooks[hook]) {\n throw failure(\n \"hook_kind_mismatch\",\n `hook catalog declares shared hook ${JSON.stringify(hook)} as ${\n JSON.stringify(output[hook])\n }, the kernel dispatches it as ${JSON.stringify(engineHooks[hook])}`,\n childPath(\"$options.hooks\", hook),\n { hook }\n )\n }\n }\n return Object.freeze(output)\n}\n\nconst snapshotHook = (\n entry: unknown,\n path: string,\n plugin: string,\n hook: string\n): ((...args: Array<any>) => unknown) | HookObject<(...args: Array<any>) => unknown> => {\n if (typeof entry === \"function\") return entry as (...args: Array<any>) => unknown\n if (entry === undefined) {\n throw invalidPlugin(path, \"must be a function or a hook object\", { plugin, hook })\n }\n const values = ownData(entry, path, new Set([\"order\", \"handler\"]))\n if (typeof values.handler !== \"function\") {\n throw invalidPlugin(`${path}.handler`, \"must be a function\", { plugin, hook })\n }\n if (values.order !== undefined && values.order !== \"pre\" && values.order !== \"post\") {\n throw invalidPlugin(`${path}.order`, \"must be pre or post\", { plugin, hook })\n }\n return Object.freeze({\n ...(values.order === undefined ? {} : { order: values.order }),\n handler: values.handler\n }) as HookObject<(...args: Array<any>) => unknown>\n}\n\nconst snapshotPlugin = <H>(\n input: unknown,\n path: string\n): FlowsPlugin<H> => {\n const values = ownData(input, path, new Set([\"name\", \"version\", \"enforce\", \"apply\", \"layer\", \"hooks\"]))\n if (!validName(values.name)) throw invalidPlugin(`${path}.name`, \"requires a bounded non-empty name\")\n const name = values.name\n if (values.version !== undefined && !validName(values.version)) {\n throw invalidPlugin(`${path}.version`, \"requires a bounded non-empty version\", { plugin: name })\n }\n if (values.enforce !== undefined && values.enforce !== \"pre\" && values.enforce !== \"post\") {\n throw invalidPlugin(`${path}.enforce`, \"must be pre or post\", { plugin: name })\n }\n if (\n values.apply !== undefined && values.apply !== \"engine\" && values.apply !== \"harness\" &&\n typeof values.apply !== \"function\"\n ) throw invalidPlugin(`${path}.apply`, \"must be engine, harness, or a predicate\", { plugin: name })\n if (values.layer !== undefined && !Layer.isLayer(values.layer)) {\n throw invalidPlugin(`${path}.layer`, \"must be an Effect Layer\", { plugin: name })\n }\n\n let hooks: Readonly<Record<string, unknown>> | undefined\n if (values.hooks !== undefined) {\n const rawHooks = ownData(values.hooks, `${path}.hooks`)\n const snapshot: Record<string, unknown> = Object.create(null)\n for (const [index, hook] of Object.keys(rawHooks).entries()) {\n if (!validName(hook)) {\n throw invalidPlugin(`${path}.hooks[${index}]`, \"contains an invalid hook name\")\n }\n const entry = rawHooks[hook]\n Object.defineProperty(snapshot, hook, {\n value: snapshotHook(entry, childPath(`${path}.hooks`, hook), name, hook),\n enumerable: true\n })\n }\n hooks = Object.freeze(snapshot)\n }\n\n return Object.freeze({\n name,\n ...(values.version === undefined ? {} : { version: values.version }),\n ...(values.enforce === undefined ? {} : { enforce: values.enforce }),\n ...(values.apply === undefined ? {} : { apply: values.apply as Apply }),\n ...(values.layer === undefined ? {} : { layer: values.layer as Layer.Layer<never, any, any> }),\n ...(hooks === undefined ? {} : { hooks: hooks as Partial<H> })\n })\n}\n\ninterface AdmittedPlugin<H> {\n readonly plugin: FlowsPlugin<H>\n readonly path: string\n}\n\nconst flatten = <H>(input: unknown): ReadonlyArray<AdmittedPlugin<H>> => {\n const output: Array<AdmittedPlugin<H>> = []\n const arrays = new WeakSet<object>()\n const stack: Array<{ readonly value: unknown; readonly path: string; readonly depth: number }> = [\n { value: input, path: \"$\", depth: 0 }\n ]\n let nodes = 0\n while (stack.length > 0) {\n const current = stack.pop()!\n nodes += 1\n if (current.value === false || current.value === null || current.value === undefined) continue\n if (Array.isArray(current.value)) {\n if (current.depth >= maximumPluginDepth) {\n throw failure(\"resource_limit\", `plugin input exceeds the depth limit of ${maximumPluginDepth}`, current.path)\n }\n if (arrays.has(current.value)) throw invalidPlugin(current.path, \"contains a cycle or repeated preset array\")\n arrays.add(current.value)\n const length = current.value.length\n // Every queued frame and array element costs a node, including omitted\n // entries. Refuse before enumerating keys, descriptors, or child frames.\n if (length > maximumPluginInputNodes - nodes - stack.length) {\n throw failure(\"resource_limit\", `plugin input exceeds the ${maximumPluginInputNodes}-node limit`, current.path)\n }\n const keys = Reflect.ownKeys(current.value)\n if (keys.length !== length + 1 || !keys.includes(\"length\")) {\n throw invalidPlugin(current.path, \"must be a dense preset array with no extra properties\")\n }\n for (let index = length - 1; index >= 0; index--) {\n const descriptor = Object.getOwnPropertyDescriptor(current.value, String(index))\n if (descriptor === undefined || !(\"value\" in descriptor) || !descriptor.enumerable) {\n throw invalidPlugin(`${current.path}[${index}]`, \"must be an enumerable data property\")\n }\n stack.push({ value: descriptor.value, path: `${current.path}[${index}]`, depth: current.depth + 1 })\n }\n continue\n }\n output.push(Object.freeze({ plugin: snapshotPlugin<H>(current.value, current.path), path: current.path }))\n if (output.length > maximumPlugins) {\n throw failure(\"resource_limit\", `plugin input exceeds the ${maximumPlugins}-plugin limit`, current.path)\n }\n }\n return output\n}\n\nconst included = <H>(\n plugin: FlowsPlugin<H>,\n config: FlowsConfig,\n target: \"engine\" | \"harness\"\n): Effect.Effect<boolean, PluginError> => {\n const apply = plugin.apply\n if (apply === undefined) return Effect.succeed(true)\n if (typeof apply !== \"function\") return Effect.succeed(apply === target)\n return Effect.try({\n try: () => apply(config),\n catch: () =>\n failure(\"apply_failed\", `plugin \"${plugin.name}\" apply predicate failed`, \"$.apply\", {\n plugin: plugin.name\n })\n }).pipe(\n Effect.flatMap((result) =>\n typeof result === \"boolean\"\n ? Effect.succeed(result)\n : Effect.fail(invalidPlugin(\"$.apply\", \"predicate must return a boolean\", { plugin: plugin.name }))\n )\n )\n}\n\nconst rank = (enforce: \"pre\" | \"post\" | undefined): number => (enforce === \"pre\" ? 0 : enforce === \"post\" ? 2 : 1)\n\n/**\n * Resolves a plugin preset into an immutable, resource-bounded catalog.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const resolve = <H = FlowsHooks>(\n input: PluginInput<NoInfer<H>>,\n options: Options<NoInfer<H>> = {},\n configOverride?: FlowsConfig\n): Effect.Effect<Resolved<H>, PluginError> =>\n Effect.gen(function*() {\n const raw = yield* Effect.try({\n try: () => snapshotOptions(options),\n catch: (cause) =>\n cause instanceof PluginError\n ? cause\n : invalidPlugin(\"$options\", \"could not be inspected without executing user code\")\n })\n if (configOverride !== undefined && raw.config !== undefined) {\n return yield* Effect.fail(invalidPlugin(\n \"$options.config\",\n \"cannot declare config in options alongside the positional override\"\n ))\n }\n if (raw.target !== undefined && raw.target !== \"engine\" && raw.target !== \"harness\") {\n return yield* Effect.fail(invalidPlugin(\"$options.target\", \"must be engine or harness\"))\n }\n if (\n raw.parallelConcurrency !== undefined &&\n (typeof raw.parallelConcurrency !== \"number\" || !Number.isSafeInteger(raw.parallelConcurrency) ||\n raw.parallelConcurrency <= 0 ||\n raw.parallelConcurrency > maximumParallelConcurrency)\n ) {\n return yield* Effect.fail(failure(\n \"resource_limit\",\n `parallel concurrency must be between 1 and ${maximumParallelConcurrency}`,\n \"$options.parallelConcurrency\"\n ))\n }\n const parallelConcurrency = raw.parallelConcurrency === undefined\n ? defaultParallelConcurrency\n : raw.parallelConcurrency\n const config = yield* Config.snapshot(configOverride ?? raw.config ?? {})\n const known = yield* Effect.try({\n try: () => snapshotCatalog(raw.hooks ?? engineHooks),\n catch: (cause) =>\n cause instanceof PluginError\n ? cause\n : invalidPlugin(\"$options.hooks\", \"could not be inspected without executing user code\")\n })\n const admitted = yield* Effect.try({\n try: () => flatten<H>(input),\n catch: (cause) =>\n cause instanceof PluginError\n ? cause\n : invalidPlugin(\"$\", \"could not be inspected without executing user code\")\n })\n const target = raw.target ?? \"engine\"\n const selected = yield* Effect.filter(admitted, ({ plugin }) => included(plugin, config, target))\n\n let handlerCount = 0\n for (const { path, plugin } of selected) {\n const pluginHooks = plugin.hooks as Readonly<Record<string, unknown>> | undefined\n if (pluginHooks === undefined) continue\n for (const hook of Object.keys(pluginHooks)) {\n if (!Object.hasOwn(known, hook)) {\n return yield* Effect.fail(failure(\n \"unknown_hook\",\n `plugin ${JSON.stringify(plugin.name)} declares unknown hook ${JSON.stringify(diagnosticKey(hook))}`,\n childPath(`${path}.hooks`, hook),\n { plugin: plugin.name, hook }\n ))\n }\n handlerCount += 1\n if (handlerCount > maximumHandlers) {\n return yield* Effect.fail(failure(\n \"resource_limit\",\n `plugin handlers exceed the limit of ${maximumHandlers}`,\n childPath(`${path}.hooks`, hook)\n ))\n }\n }\n }\n\n const seen = new Set<string>()\n for (const { plugin } of selected) {\n if (seen.has(plugin.name)) {\n return yield* Effect.fail(failure(\n \"duplicate_name\",\n `duplicate plugin name \"${plugin.name}\"`,\n \"$.name\",\n { plugin: plugin.name }\n ))\n }\n seen.add(plugin.name)\n }\n\n const plugins = Object.freeze(\n selected\n .map(({ plugin }, index) => ({ plugin, index }))\n .sort((left, right) => rank(left.plugin.enforce) - rank(right.plugin.enforce) || left.index - right.index)\n .map(({ plugin }) => plugin)\n )\n const entries: Array<readonly [string, ReadonlyArray<HandlerRecord>]> = []\n for (const hook of Object.keys(known)) {\n const records: Array<{\n readonly record: HandlerRecord\n readonly enforceRank: number\n readonly orderRank: number\n readonly index: number\n }> = []\n for (const [index, plugin] of plugins.entries()) {\n const pluginHooks = plugin.hooks as Readonly<Record<string, unknown>> | undefined\n if (pluginHooks === undefined || !Object.hasOwn(pluginHooks, hook)) continue\n const entry = pluginHooks[hook]\n const record = Object.freeze({ plugin: plugin.name, hook, handler: handlerOf(entry) })\n records.push({ record, enforceRank: rank(plugin.enforce), orderRank: rank(orderOf(entry)), index })\n }\n // Vite's rule, verbatim: the per-hook `order` is the outer partition and\n // the enforce-sorted plugin list supplies the stable order inside it, so a\n // hook marked `order: \"pre\"` runs ahead of every normal-order handler even\n // when its plugin is `enforce: \"post\"`.\n const ordered = records\n .sort((left, right) =>\n left.orderRank - right.orderRank || left.enforceRank - right.enforceRank || left.index - right.index\n )\n .map(({ record }) => record)\n if (ordered.length > 0) entries.push([hook, Object.freeze(ordered)])\n }\n const cacheEnvironment = yield* snapshotCacheEnvironment(raw.cacheEnvironment, plugins)\n return Object.freeze({\n plugins,\n handlers: ImmutableMap.make(entries),\n kinds: known,\n parallelConcurrency,\n ...(cacheEnvironment === undefined ? {} : { cacheEnvironment })\n })\n })\n\n/**\n * Merges every resolved plugin layer left-to-right and supplies the detached\n * cache environment captured during resolution.\n *\n * @category combinators\n * @since 1.0.0-rc.0\n */\nexport const layer = <H>(resolved: Resolved<H>): Layer.Layer<any, PluginError, any> =>\n mergePluginLayers(resolved.plugins, resolved.cacheEnvironment)\n"]}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * The bounded cell-host plugin kernel: typed hooks, resolution and ordering,
3
+ * and the config pipeline.
4
+ *
5
+ * The public package contract is documented at
6
+ * {@link https://smithers.sh/docs/reference/api/plugin}, with the shipped host catalog in
7
+ * `packages/smithers/agent/src/CellPlugin.ts`. Durable
8
+ * engine extension remains dependency injection; this package does not expose
9
+ * an engine-wide lifecycle registry.
10
+ *
11
+ * @since 1.0.0-rc.0
12
+ */
13
+ import type * as Effect from "effect/Effect";
14
+ import type { FlowsConfig, ResolvedConfig } from "./Config.ts";
15
+ import type { ParallelHook, WaterfallHook } from "./Hooks.ts";
16
+ /**
17
+ * The shared kernel's base hook catalog.
18
+ *
19
+ * Declared here, in the package entry point, so that the documented
20
+ * augmentation specifier works: an interface can only be augmented in the
21
+ * module that declares it:
22
+ *
23
+ * ```ts
24
+ * declare module "@smthrs/plugin" {
25
+ * interface FlowsHooks {
26
+ * toolCall: SequentialHook<(ctx: ToolCallContext) => Effect.Effect<Option.Option<ToolOverride>>>
27
+ * }
28
+ * }
29
+ * ```
30
+ *
31
+ * Closed for dispatch, open for augmentation: the kernel dispatches only the
32
+ * config lifecycle below; a host supplies and dispatches its own catalog over
33
+ * the same augmented interface.
34
+ *
35
+ * Both startup hooks are context-free: `Kernel.make` runs them before any
36
+ * plugin layer exists and supplies no services of its own, so a handler that
37
+ * needs a service provides it inside the hook. A host whose startup hooks do
38
+ * require services declares a separate hook interface, and `Kernel.make` then
39
+ * surfaces those requirements as `Kernel.StartupContext<H>`.
40
+ *
41
+ * @category models
42
+ * @since 1.0.0-rc.0
43
+ */
44
+ export interface FlowsHooks {
45
+ readonly config: WaterfallHook<(config: FlowsConfig) => Effect.Effect<Partial<FlowsConfig> | void, any, never>>;
46
+ readonly configResolved: ParallelHook<(config: ResolvedConfig) => Effect.Effect<void, any, never>>;
47
+ }
48
+ /**
49
+ * @since 1.0.0-rc.0
50
+ * @category config
51
+ */
52
+ export * as Config from "./Config.ts";
53
+ /**
54
+ * @since 1.0.0-rc.0
55
+ * @category hooks
56
+ */
57
+ export * from "./Hooks.ts";
58
+ /**
59
+ * @since 1.0.0-rc.0
60
+ * @category startup
61
+ */
62
+ export * as Kernel from "./Kernel.ts";
63
+ /**
64
+ * @since 1.0.0-rc.0
65
+ * @category models
66
+ */
67
+ export * from "./Plugin.ts";
68
+ /**
69
+ * @since 1.0.0-rc.0
70
+ * @category errors
71
+ */
72
+ export * from "./PluginError.ts";
73
+ /**
74
+ * @since 1.0.0-rc.0
75
+ * @category dispatch
76
+ */
77
+ export * as Plugins from "./Plugins.ts";
78
+ /**
79
+ * @since 1.0.0-rc.0
80
+ * @category resolution
81
+ */
82
+ export * as Resolve from "./Resolve.ts";
83
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,MAAM,EAAE,WAAW,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,CAAA;IAC/G,QAAQ,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC,MAAM,EAAE,cAAc,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,CAAA;CACnG;AAED;;;GAGG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC;;;GAGG;AACH,cAAc,YAAY,CAAA;AAE1B;;;GAGG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC;;;GAGG;AACH,cAAc,aAAa,CAAA;AAE3B;;;GAGG;AACH,cAAc,kBAAkB,CAAA;AAEhC;;;GAGG;AACH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC;;;GAGG;AACH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * The bounded cell-host plugin kernel: typed hooks, resolution and ordering,
3
+ * and the config pipeline.
4
+ *
5
+ * The public package contract is documented at
6
+ * {@link https://smithers.sh/docs/reference/api/plugin}, with the shipped host catalog in
7
+ * `packages/smithers/agent/src/CellPlugin.ts`. Durable
8
+ * engine extension remains dependency injection; this package does not expose
9
+ * an engine-wide lifecycle registry.
10
+ *
11
+ * @since 1.0.0-rc.0
12
+ */
13
+ /**
14
+ * @since 1.0.0-rc.0
15
+ * @category config
16
+ */
17
+ export * as Config from "./Config.js";
18
+ /**
19
+ * @since 1.0.0-rc.0
20
+ * @category hooks
21
+ */
22
+ export * from "./Hooks.js";
23
+ /**
24
+ * @since 1.0.0-rc.0
25
+ * @category startup
26
+ */
27
+ export * as Kernel from "./Kernel.js";
28
+ /**
29
+ * @since 1.0.0-rc.0
30
+ * @category models
31
+ */
32
+ export * from "./Plugin.js";
33
+ /**
34
+ * @since 1.0.0-rc.0
35
+ * @category errors
36
+ */
37
+ export * from "./PluginError.js";
38
+ /**
39
+ * @since 1.0.0-rc.0
40
+ * @category dispatch
41
+ */
42
+ export * as Plugins from "./Plugins.js";
43
+ /**
44
+ * @since 1.0.0-rc.0
45
+ * @category resolution
46
+ */
47
+ export * as Resolve from "./Resolve.js";
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAuCH;;;GAGG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC;;;GAGG;AACH,cAAc,YAAY,CAAA;AAE1B;;;GAGG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC;;;GAGG;AACH,cAAc,aAAa,CAAA;AAE3B;;;GAGG;AACH,cAAc,kBAAkB,CAAA;AAEhC;;;GAGG;AACH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC;;;GAGG;AACH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA","sourcesContent":["/**\n * The bounded cell-host plugin kernel: typed hooks, resolution and ordering,\n * and the config pipeline.\n *\n * The public package contract is documented at\n * {@link https://smithers.sh/docs/reference/api/plugin}, with the shipped host catalog in\n * `packages/smithers/agent/src/CellPlugin.ts`. Durable\n * engine extension remains dependency injection; this package does not expose\n * an engine-wide lifecycle registry.\n *\n * @since 1.0.0-rc.0\n */\n\nimport type * as Effect from \"effect/Effect\"\nimport type { FlowsConfig, ResolvedConfig } from \"./Config.ts\"\nimport type { ParallelHook, WaterfallHook } from \"./Hooks.ts\"\n\n/**\n * The shared kernel's base hook catalog.\n *\n * Declared here, in the package entry point, so that the documented\n * augmentation specifier works: an interface can only be augmented in the\n * module that declares it:\n *\n * ```ts\n * declare module \"@smthrs/plugin\" {\n * interface FlowsHooks {\n * toolCall: SequentialHook<(ctx: ToolCallContext) => Effect.Effect<Option.Option<ToolOverride>>>\n * }\n * }\n * ```\n *\n * Closed for dispatch, open for augmentation: the kernel dispatches only the\n * config lifecycle below; a host supplies and dispatches its own catalog over\n * the same augmented interface.\n *\n * Both startup hooks are context-free: `Kernel.make` runs them before any\n * plugin layer exists and supplies no services of its own, so a handler that\n * needs a service provides it inside the hook. A host whose startup hooks do\n * require services declares a separate hook interface, and `Kernel.make` then\n * surfaces those requirements as `Kernel.StartupContext<H>`.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport interface FlowsHooks {\n readonly config: WaterfallHook<(config: FlowsConfig) => Effect.Effect<Partial<FlowsConfig> | void, any, never>>\n readonly configResolved: ParallelHook<(config: ResolvedConfig) => Effect.Effect<void, any, never>>\n}\n\n/**\n * @since 1.0.0-rc.0\n * @category config\n */\nexport * as Config from \"./Config.ts\"\n\n/**\n * @since 1.0.0-rc.0\n * @category hooks\n */\nexport * from \"./Hooks.ts\"\n\n/**\n * @since 1.0.0-rc.0\n * @category startup\n */\nexport * as Kernel from \"./Kernel.ts\"\n\n/**\n * @since 1.0.0-rc.0\n * @category models\n */\nexport * from \"./Plugin.ts\"\n\n/**\n * @since 1.0.0-rc.0\n * @category errors\n */\nexport * from \"./PluginError.ts\"\n\n/**\n * @since 1.0.0-rc.0\n * @category dispatch\n */\nexport * as Plugins from \"./Plugins.ts\"\n\n/**\n * @since 1.0.0-rc.0\n * @category resolution\n */\nexport * as Resolve from \"./Resolve.ts\"\n"]}