@smthrs/plugin 0.0.0-stage → 1.0.0-rc.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +79 -0
- package/LICENSE +21 -0
- package/README.md +88 -2
- package/dist/cjs/Config.d.ts +129 -0
- package/dist/cjs/Config.d.ts.map +1 -0
- package/dist/cjs/Config.js +115 -0
- package/dist/cjs/Config.js.map +7 -0
- package/dist/cjs/Hooks.d.ts +176 -0
- package/dist/cjs/Hooks.d.ts.map +1 -0
- package/dist/cjs/Hooks.js +34 -0
- package/dist/cjs/Hooks.js.map +7 -0
- package/dist/cjs/Kernel.d.ts +81 -0
- package/dist/cjs/Kernel.d.ts.map +1 -0
- package/dist/cjs/Kernel.js +57 -0
- package/dist/cjs/Kernel.js.map +7 -0
- package/dist/cjs/Plugin.d.ts +71 -0
- package/dist/cjs/Plugin.d.ts.map +1 -0
- package/dist/cjs/Plugin.js +25 -0
- package/dist/cjs/Plugin.js.map +7 -0
- package/dist/cjs/PluginError.d.ts +50 -0
- package/dist/cjs/PluginError.d.ts.map +1 -0
- package/dist/cjs/PluginError.js +58 -0
- package/dist/cjs/PluginError.js.map +7 -0
- package/dist/cjs/Plugins.d.ts +97 -0
- package/dist/cjs/Plugins.d.ts.map +1 -0
- package/dist/cjs/Plugins.js +169 -0
- package/dist/cjs/Plugins.js.map +7 -0
- package/dist/cjs/Resolve.d.ts +128 -0
- package/dist/cjs/Resolve.d.ts.map +1 -0
- package/dist/cjs/Resolve.js +346 -0
- package/dist/cjs/Resolve.js.map +7 -0
- package/dist/cjs/index.d.ts +83 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +45 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/internal/Boundary.d.ts +96 -0
- package/dist/cjs/internal/Boundary.d.ts.map +1 -0
- package/dist/cjs/internal/Boundary.js +129 -0
- package/dist/cjs/internal/Boundary.js.map +7 -0
- package/dist/cjs/internal/mergePluginLayers.d.ts +21 -0
- package/dist/cjs/internal/mergePluginLayers.d.ts.map +1 -0
- package/dist/cjs/internal/mergePluginLayers.js +57 -0
- package/dist/cjs/internal/mergePluginLayers.js.map +7 -0
- package/dist/cjs/internal/snapshotCacheEnvironment.d.ts +23 -0
- package/dist/cjs/internal/snapshotCacheEnvironment.d.ts.map +1 -0
- package/dist/cjs/internal/snapshotCacheEnvironment.js +92 -0
- package/dist/cjs/internal/snapshotCacheEnvironment.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/Config.d.ts +129 -0
- package/dist/esm/Config.d.ts.map +1 -0
- package/dist/esm/Config.js +160 -0
- package/dist/esm/Config.js.map +1 -0
- package/dist/esm/Hooks.d.ts +176 -0
- package/dist/esm/Hooks.d.ts.map +1 -0
- package/dist/esm/Hooks.js +56 -0
- package/dist/esm/Hooks.js.map +1 -0
- package/dist/esm/Kernel.d.ts +81 -0
- package/dist/esm/Kernel.d.ts.map +1 -0
- package/dist/esm/Kernel.js +58 -0
- package/dist/esm/Kernel.js.map +1 -0
- package/dist/esm/Plugin.d.ts +71 -0
- package/dist/esm/Plugin.d.ts.map +1 -0
- package/dist/esm/Plugin.js +20 -0
- package/dist/esm/Plugin.js.map +1 -0
- package/dist/esm/PluginError.d.ts +50 -0
- package/dist/esm/PluginError.d.ts.map +1 -0
- package/dist/esm/PluginError.js +53 -0
- package/dist/esm/PluginError.js.map +1 -0
- package/dist/esm/Plugins.d.ts +97 -0
- package/dist/esm/Plugins.d.ts.map +1 -0
- package/dist/esm/Plugins.js +190 -0
- package/dist/esm/Plugins.js.map +1 -0
- package/dist/esm/Resolve.d.ts +128 -0
- package/dist/esm/Resolve.d.ts.map +1 -0
- package/dist/esm/Resolve.js +369 -0
- package/dist/esm/Resolve.js.map +1 -0
- package/dist/esm/index.d.ts +83 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +48 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/Boundary.d.ts +96 -0
- package/dist/esm/internal/Boundary.d.ts.map +1 -0
- package/dist/esm/internal/Boundary.js +162 -0
- package/dist/esm/internal/Boundary.js.map +1 -0
- package/dist/esm/internal/mergePluginLayers.d.ts +21 -0
- package/dist/esm/internal/mergePluginLayers.d.ts.map +1 -0
- package/dist/esm/internal/mergePluginLayers.js +41 -0
- package/dist/esm/internal/mergePluginLayers.js.map +1 -0
- package/dist/esm/internal/snapshotCacheEnvironment.d.ts +23 -0
- package/dist/esm/internal/snapshotCacheEnvironment.d.ts.map +1 -0
- package/dist/esm/internal/snapshotCacheEnvironment.js +64 -0
- package/dist/esm/internal/snapshotCacheEnvironment.js.map +1 -0
- package/docs/README.md +133 -0
- package/docs/api.md +524 -0
- package/docs/concepts/configuration.md +111 -0
- package/docs/concepts/hook-kinds.md +107 -0
- package/docs/concepts/resolution.md +132 -0
- package/docs/guides/cache-identity.md +106 -0
- package/docs/guides/contribute-services.md +84 -0
- package/docs/guides/host-your-own-hooks.md +129 -0
- package/docs/guides/order-handlers.md +76 -0
- package/docs/guides/select-plugins.md +72 -0
- package/docs/guides/testing.md +149 -0
- package/docs/installation.md +75 -0
- package/docs/quickstart.md +152 -0
- package/docs/troubleshooting.md +180 -0
- package/package.json +179 -3
- package/src/Config.ts +207 -0
- package/src/Hooks.ts +212 -0
- package/src/Kernel.ts +119 -0
- package/src/Plugin.ts +80 -0
- package/src/PluginError.ts +62 -0
- package/src/Plugins.ts +271 -0
- package/src/Resolve.ts +539 -0
- package/src/index.ts +91 -0
- package/src/internal/Boundary.ts +252 -0
- package/src/internal/mergePluginLayers.ts +57 -0
- package/src/internal/snapshotCacheEnvironment.ts +78 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var Plugins_exports = {};
|
|
30
|
+
__export(Plugins_exports, {
|
|
31
|
+
Plugins: () => Plugins,
|
|
32
|
+
layer: () => layer,
|
|
33
|
+
layerNoop: () => layerNoop,
|
|
34
|
+
make: () => make,
|
|
35
|
+
makeNoop: () => makeNoop
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(Plugins_exports);
|
|
38
|
+
var ImmutableMap = __toESM(require("@smthrs/canonical/ReadonlyMap"), 1);
|
|
39
|
+
var Context = __toESM(require("effect/Context"), 1);
|
|
40
|
+
var Effect = __toESM(require("effect/Effect"), 1);
|
|
41
|
+
var Layer = __toESM(require("effect/Layer"), 1);
|
|
42
|
+
var Option = __toESM(require("effect/Option"), 1);
|
|
43
|
+
var import_Hooks = require("./Hooks.js");
|
|
44
|
+
var import_PluginError = require("./PluginError.js");
|
|
45
|
+
var import_Resolve = require("./Resolve.js");
|
|
46
|
+
const empty = Object.freeze([]);
|
|
47
|
+
const kindMismatch = (resolved, hook, kind, handlers) => {
|
|
48
|
+
if (!Object.hasOwn(resolved.kinds, hook)) {
|
|
49
|
+
if (handlers.length === 0) return void 0;
|
|
50
|
+
return new import_PluginError.PluginError({
|
|
51
|
+
code: "hook_kind_mismatch",
|
|
52
|
+
message: `hook "${hook}" has handlers but is not declared in the runtime catalog`,
|
|
53
|
+
hook
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const declared = resolved.kinds[hook];
|
|
57
|
+
if (declared === kind) return void 0;
|
|
58
|
+
return new import_PluginError.PluginError({
|
|
59
|
+
code: "hook_kind_mismatch",
|
|
60
|
+
message: `hook "${hook}" is declared ${JSON.stringify(declared)} in the runtime catalog but was dispatched as ${JSON.stringify(kind)}`,
|
|
61
|
+
hook
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
const runHandler = (record, args) => {
|
|
65
|
+
const onCause = (cause) => Effect.fail(
|
|
66
|
+
new import_PluginError.PluginError({
|
|
67
|
+
code: "hook_failed",
|
|
68
|
+
message: `hook "${record.hook}" failed in plugin "${record.plugin}"`,
|
|
69
|
+
plugin: record.plugin,
|
|
70
|
+
hook: record.hook,
|
|
71
|
+
cause
|
|
72
|
+
})
|
|
73
|
+
);
|
|
74
|
+
return Effect.sync(() => record.handler(...args)).pipe(
|
|
75
|
+
Effect.catchCause(onCause),
|
|
76
|
+
Effect.flatMap(
|
|
77
|
+
(result) => Effect.isEffect(result) ? result.pipe(Effect.catchCause(onCause)) : Effect.fail(
|
|
78
|
+
new import_PluginError.PluginError({
|
|
79
|
+
code: "hook_failed",
|
|
80
|
+
message: `hook "${record.hook}" in plugin "${record.plugin}" returned a non-Effect (${typeof result})`,
|
|
81
|
+
plugin: record.plugin,
|
|
82
|
+
hook: record.hook
|
|
83
|
+
})
|
|
84
|
+
)
|
|
85
|
+
)
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
const make = (resolved) => {
|
|
89
|
+
const handlers = (hook) => resolved.handlers.get(hook) ?? empty;
|
|
90
|
+
const sequential = ((hook, ...args) => Effect.gen(function* () {
|
|
91
|
+
const mismatch = kindMismatch(resolved, hook, "sequential", handlers(hook));
|
|
92
|
+
if (mismatch !== void 0) return yield* Effect.fail(mismatch);
|
|
93
|
+
const results = [];
|
|
94
|
+
for (const record of handlers(hook)) {
|
|
95
|
+
results.push(yield* runHandler(record, args));
|
|
96
|
+
}
|
|
97
|
+
return results;
|
|
98
|
+
}));
|
|
99
|
+
const parallel = ((hook, ...args) => {
|
|
100
|
+
const mismatch = kindMismatch(resolved, hook, "parallel", handlers(hook));
|
|
101
|
+
if (mismatch !== void 0) return Effect.succeed([mismatch]);
|
|
102
|
+
return Effect.forEach(
|
|
103
|
+
handlers(hook),
|
|
104
|
+
(record) => runHandler(record, args).pipe(
|
|
105
|
+
Effect.match({ onFailure: (error) => [error], onSuccess: () => [] })
|
|
106
|
+
),
|
|
107
|
+
{ concurrency: resolved.parallelConcurrency }
|
|
108
|
+
).pipe(Effect.map((chunks) => chunks.flat()));
|
|
109
|
+
});
|
|
110
|
+
const first = ((hook, ...args) => Effect.gen(function* () {
|
|
111
|
+
const mismatch = kindMismatch(resolved, hook, "first", handlers(hook));
|
|
112
|
+
if (mismatch !== void 0) return yield* Effect.fail(mismatch);
|
|
113
|
+
for (const record of handlers(hook)) {
|
|
114
|
+
const result = yield* runHandler(record, args);
|
|
115
|
+
if (!Option.isOption(result)) {
|
|
116
|
+
return yield* Effect.fail(
|
|
117
|
+
new import_PluginError.PluginError({
|
|
118
|
+
code: "invalid_hook_result",
|
|
119
|
+
message: `first hook "${record.hook}" in plugin "${record.plugin}" did not return an Option`,
|
|
120
|
+
plugin: record.plugin,
|
|
121
|
+
hook: record.hook
|
|
122
|
+
})
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
if (Option.isSome(result)) return result;
|
|
126
|
+
}
|
|
127
|
+
return Option.none();
|
|
128
|
+
}));
|
|
129
|
+
const waterfall = ((hook, initial, merge) => Effect.gen(function* () {
|
|
130
|
+
const mismatch = kindMismatch(resolved, hook, "waterfall", handlers(hook));
|
|
131
|
+
if (mismatch !== void 0) return yield* Effect.fail(mismatch);
|
|
132
|
+
let value = initial;
|
|
133
|
+
for (const record of handlers(hook)) {
|
|
134
|
+
const patch = yield* runHandler(record, [value]);
|
|
135
|
+
if (patch !== void 0) {
|
|
136
|
+
value = yield* Effect.try({
|
|
137
|
+
try: () => merge(value, patch),
|
|
138
|
+
catch: (cause) => cause instanceof import_PluginError.PluginError ? new import_PluginError.PluginError({
|
|
139
|
+
code: cause.code,
|
|
140
|
+
message: cause.message,
|
|
141
|
+
plugin: record.plugin,
|
|
142
|
+
hook: record.hook,
|
|
143
|
+
path: cause.path,
|
|
144
|
+
cause
|
|
145
|
+
}) : new import_PluginError.PluginError({
|
|
146
|
+
code: "config_invalid",
|
|
147
|
+
message: `waterfall hook "${record.hook}" in plugin "${record.plugin}" returned an invalid patch`,
|
|
148
|
+
plugin: record.plugin,
|
|
149
|
+
hook: record.hook,
|
|
150
|
+
cause
|
|
151
|
+
})
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return value;
|
|
156
|
+
}));
|
|
157
|
+
return Object.freeze({ resolved, handlers, sequential, parallel, first, waterfall });
|
|
158
|
+
};
|
|
159
|
+
const makeNoop = () => make(Object.freeze({
|
|
160
|
+
plugins: Object.freeze([]),
|
|
161
|
+
handlers: ImmutableMap.make(),
|
|
162
|
+
kinds: import_Hooks.engineHooks,
|
|
163
|
+
parallelConcurrency: import_Resolve.defaultParallelConcurrency
|
|
164
|
+
}));
|
|
165
|
+
class Plugins extends Context.Service()("flows/plugin/Plugins") {
|
|
166
|
+
}
|
|
167
|
+
const layer = (resolved) => Layer.succeed(Plugins)(make(resolved));
|
|
168
|
+
const layerNoop = Layer.succeed(Plugins)(makeNoop());
|
|
169
|
+
//# sourceMappingURL=Plugins.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Plugins.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * The dispatcher: a plain service over a resolved plugin list, generic over the\n * hook interface.\n *\n * The public package contract is documented at\n * {@link https://smithers.sh/docs/reference/api/plugin}. Each host holds an instance over its\n * augmented `FlowsHooks` and may dispatch only the runtime catalog it supplied.\n * The shipped cell host owns the three\n * waterfalls declared in `packages/smithers/agent/src/CellPlugin.ts`; there is\n * no engine-wide lifecycle dispatcher.\n *\n * Cancellation is fiber interruption via scope closure; nothing here threads an\n * `AbortSignal`.\n *\n * @since 1.0.0-rc.0\n */\n\nimport * as ImmutableMap from \"@smthrs/canonical/ReadonlyMap\"\nimport type * as Cause from \"effect/Cause\"\nimport * as Context from \"effect/Context\"\nimport * as Effect from \"effect/Effect\"\nimport * as Layer from \"effect/Layer\"\nimport * as Option from \"effect/Option\"\nimport type { ArgsOf, ContextOf, HookKind, KeysOfKind, SuccessOf } from \"./Hooks.ts\"\nimport { engineHooks } from \"./Hooks.ts\"\nimport type { FlowsHooks } from \"./index.ts\"\nimport { PluginError } from \"./PluginError.ts\"\nimport { defaultParallelConcurrency, type HandlerRecord, type Resolved } from \"./Resolve.ts\"\n\nconst empty: ReadonlyArray<HandlerRecord> = Object.freeze([])\n\n// The typed catalog and the runtime catalog can only drift when a host casts\n// around `KeysOfKind`; refuse before any handler runs rather than execute a\n// hook under semantics its declaration never promised.\n// A hook the catalog does not declare dispatches as empty, unless a\n// hand-built resolution registered handlers for it: those have no declared\n// kind to honor, so they are refused too.\nconst kindMismatch = (\n resolved: Resolved<unknown>,\n hook: string,\n kind: HookKind,\n handlers: ReadonlyArray<HandlerRecord>\n): PluginError | undefined => {\n if (!Object.hasOwn(resolved.kinds, hook)) {\n if (handlers.length === 0) return undefined\n return new PluginError({\n code: \"hook_kind_mismatch\",\n message: `hook \"${hook}\" has handlers but is not declared in the runtime catalog`,\n hook\n })\n }\n const declared = resolved.kinds[hook]\n if (declared === kind) return undefined\n return new PluginError({\n code: \"hook_kind_mismatch\",\n message: `hook \"${hook}\" is declared ${JSON.stringify(declared)} in the runtime catalog but was dispatched as ${\n JSON.stringify(kind)\n }`,\n hook\n })\n}\n\nconst runHandler = (\n record: HandlerRecord,\n args: ReadonlyArray<unknown>\n): Effect.Effect<unknown, PluginError, any> => {\n const onCause = (cause: Cause.Cause<unknown>) =>\n Effect.fail(\n new PluginError({\n code: \"hook_failed\",\n message: `hook \"${record.hook}\" failed in plugin \"${record.plugin}\"`,\n plugin: record.plugin,\n hook: record.hook,\n cause\n })\n )\n\n return Effect.sync(() => record.handler(...args)).pipe(\n Effect.catchCause(onCause),\n Effect.flatMap((result) =>\n Effect.isEffect(result)\n ? result.pipe(Effect.catchCause(onCause))\n : Effect.fail(\n new PluginError({\n code: \"hook_failed\",\n message: `hook \"${record.hook}\" in plugin \"${record.plugin}\" returned a non-Effect (${typeof result})`,\n plugin: record.plugin,\n hook: record.hook\n })\n )\n )\n )\n}\n\n/**\n * The dispatch surface.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport interface Service<H = FlowsHooks> {\n /** The resolved list this dispatcher walks. */\n readonly resolved: Resolved<H>\n /** Frozen, ordered handler records for a hook. */\n readonly handlers: (hook: string) => ReadonlyArray<HandlerRecord>\n /** Runs every handler in resolved order, one at a time. */\n readonly sequential: <K extends KeysOfKind<H, \"sequential\">>(\n hook: K,\n ...args: ArgsOf<H[K]>\n ) => Effect.Effect<ReadonlyArray<SuccessOf<H[K]>>, PluginError, ContextOf<H[K]>>\n /**\n * Runs every handler concurrently, ignoring results. Never fails: handler\n * failures are returned so the caller can report them at its own boundary.\n */\n readonly parallel: <K extends KeysOfKind<H, \"parallel\">>(\n hook: K,\n ...args: ArgsOf<H[K]>\n ) => Effect.Effect<ReadonlyArray<PluginError>, never, ContextOf<H[K]>>\n /** Runs handlers in order until one returns `Option.some`. */\n readonly first: <K extends KeysOfKind<H, \"first\">>(\n hook: K,\n ...args: ArgsOf<H[K]>\n ) => Effect.Effect<SuccessOf<H[K]>, PluginError, ContextOf<H[K]>>\n /** Threads a value through every handler, merging each returned patch. */\n readonly waterfall: <K extends KeysOfKind<H, \"waterfall\">>(\n hook: K,\n initial: ArgsOf<H[K]>[0],\n merge: (previous: ArgsOf<H[K]>[0], patch: Exclude<SuccessOf<H[K]>, void>) => ArgsOf<H[K]>[0]\n ) => Effect.Effect<ArgsOf<H[K]>[0], PluginError, ContextOf<H[K]>>\n}\n\n/**\n * Builds a dispatcher over an already resolved plugin list.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const make = <H = FlowsHooks>(resolved: Resolved<H>): Service<H> => {\n const handlers = (hook: string): ReadonlyArray<HandlerRecord> => resolved.handlers.get(hook) ?? empty\n\n const sequential = ((hook: string, ...args: Array<unknown>) =>\n Effect.gen(function*() {\n const mismatch = kindMismatch(resolved, hook, \"sequential\", handlers(hook))\n if (mismatch !== undefined) return yield* Effect.fail(mismatch)\n const results: Array<unknown> = []\n for (const record of handlers(hook)) {\n results.push(yield* runHandler(record, args))\n }\n return results\n })) as Service<H>[\"sequential\"]\n\n const parallel = ((hook: string, ...args: Array<unknown>) => {\n const mismatch = kindMismatch(resolved, hook, \"parallel\", handlers(hook))\n if (mismatch !== undefined) return Effect.succeed([mismatch])\n return Effect.forEach(\n handlers(hook),\n (record) =>\n runHandler(record, args).pipe(\n Effect.match({ onFailure: (error) => [error], onSuccess: () => [] as Array<PluginError> })\n ),\n { concurrency: resolved.parallelConcurrency }\n ).pipe(Effect.map((chunks) => chunks.flat()))\n }) as Service<H>[\"parallel\"]\n\n const first = ((hook: string, ...args: Array<unknown>) =>\n Effect.gen(function*() {\n const mismatch = kindMismatch(resolved, hook, \"first\", handlers(hook))\n if (mismatch !== undefined) return yield* Effect.fail(mismatch)\n for (const record of handlers(hook)) {\n const result = yield* runHandler(record, args)\n if (!Option.isOption(result)) {\n return yield* Effect.fail(\n new PluginError({\n code: \"invalid_hook_result\",\n message: `first hook \"${record.hook}\" in plugin \"${record.plugin}\" did not return an Option`,\n plugin: record.plugin,\n hook: record.hook\n })\n )\n }\n if (Option.isSome(result)) return result\n }\n return Option.none()\n })) as unknown as Service<H>[\"first\"]\n\n const waterfall =\n ((hook: string, initial: unknown, merge: (previous: unknown, patch: unknown) => unknown) =>\n Effect.gen(function*() {\n const mismatch = kindMismatch(resolved, hook, \"waterfall\", handlers(hook))\n if (mismatch !== undefined) return yield* Effect.fail(mismatch)\n let value = initial\n for (const record of handlers(hook)) {\n const patch = yield* runHandler(record, [value])\n if (patch !== undefined) {\n value = yield* Effect.try({\n try: () => merge(value, patch),\n catch: (cause) =>\n cause instanceof PluginError\n ? new PluginError({\n code: cause.code,\n message: cause.message,\n plugin: record.plugin,\n hook: record.hook,\n path: cause.path,\n cause\n })\n : new PluginError({\n code: \"config_invalid\",\n message: `waterfall hook \"${record.hook}\" in plugin \"${record.plugin}\" returned an invalid patch`,\n plugin: record.plugin,\n hook: record.hook,\n cause\n })\n })\n }\n }\n return value\n })) as Service<H>[\"waterfall\"]\n\n return Object.freeze({ resolved, handlers, sequential, parallel, first, waterfall })\n}\n\n/**\n * A dispatcher with no plugins at all.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const makeNoop = <H = FlowsHooks>(): Service<H> =>\n make<H>(Object.freeze({\n plugins: Object.freeze([]),\n handlers: ImmutableMap.make<string, ReadonlyArray<HandlerRecord>>(),\n kinds: engineHooks,\n parallelConcurrency: defaultParallelConcurrency\n }))\n\n/**\n * The shared dispatcher, as a service tag.\n *\n * This tag holds one dispatcher over the process-wide augmented `FlowsHooks`.\n * `declare module \"@smthrs/plugin\"` augmentation is the supported extension\n * mechanism for values placed in the tag. A host typed against a separate hook\n * interface holds its `Service<H>` directly, as `@smthrs/agent` does, and does\n * not use this tag or its layers.\n *\n * @category context\n * @since 1.0.0-rc.0\n */\nexport class Plugins extends Context.Service<Plugins, Service>()(\"flows/plugin/Plugins\") {}\n\n/**\n * Layer providing a dispatcher over an already resolved plugin list.\n *\n * This layer targets the shared augmented `FlowsHooks` catalog only. A host\n * with a separate hook interface holds its `Service<H>` directly.\n *\n * @category layers\n * @since 1.0.0-rc.0\n */\nexport const layer = (resolved: Resolved): Layer.Layer<Plugins> => Layer.succeed(Plugins)(make(resolved))\n\n/**\n * Layer providing a dispatcher with no plugins.\n *\n * This layer targets the shared augmented `FlowsHooks` catalog only. A host\n * with a separate hook interface holds its `Service<H>` directly.\n *\n * @category layers\n * @since 1.0.0-rc.0\n */\nexport const layerNoop: Layer.Layer<Plugins> = Layer.succeed(Plugins)(makeNoop())\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBA,mBAA8B;AAE9B,cAAyB;AACzB,aAAwB;AACxB,YAAuB;AACvB,aAAwB;AAExB,mBAA4B;AAE5B,yBAA4B;AAC5B,qBAA8E;AAE9E,MAAM,QAAsC,OAAO,OAAO,CAAC,CAAC;AAQ5D,MAAM,eAAe,CACnB,UACA,MACA,MACA,aAC4B;AAC5B,MAAI,CAAC,OAAO,OAAO,SAAS,OAAO,IAAI,GAAG;AACxC,QAAI,SAAS,WAAW,EAAG,QAAO;AAClC,WAAO,IAAI,+BAAY;AAAA,MACrB,MAAM;AAAA,MACN,SAAS,SAAS,IAAI;AAAA,MACtB;AAAA,IACF,CAAC;AAAA,EACH;AACA,QAAM,WAAW,SAAS,MAAM,IAAI;AACpC,MAAI,aAAa,KAAM,QAAO;AAC9B,SAAO,IAAI,+BAAY;AAAA,IACrB,MAAM;AAAA,IACN,SAA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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 type { Action } from "@smthrs/flow";
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import * as Layer from "effect/Layer";
|
|
12
|
+
import type { FlowsConfig } from "./Config.ts";
|
|
13
|
+
import type { HookCatalog, HookKind } from "./Hooks.ts";
|
|
14
|
+
import type { FlowsHooks } from "./index.ts";
|
|
15
|
+
import type { FlowsPlugin, PluginInput } from "./Plugin.ts";
|
|
16
|
+
import { PluginError } from "./PluginError.ts";
|
|
17
|
+
/**
|
|
18
|
+
* Maximum nested preset-array depth accepted at startup.
|
|
19
|
+
*
|
|
20
|
+
* @category limits
|
|
21
|
+
* @since 1.0.0-rc.0
|
|
22
|
+
*/
|
|
23
|
+
export declare const maximumPluginDepth = 64;
|
|
24
|
+
/**
|
|
25
|
+
* Maximum plugins accepted by one kernel.
|
|
26
|
+
*
|
|
27
|
+
* @category limits
|
|
28
|
+
* @since 1.0.0-rc.0
|
|
29
|
+
*/
|
|
30
|
+
export declare const maximumPlugins = 256;
|
|
31
|
+
/**
|
|
32
|
+
* Maximum aggregate hook handlers accepted by one kernel.
|
|
33
|
+
*
|
|
34
|
+
* @category limits
|
|
35
|
+
* @since 1.0.0-rc.0
|
|
36
|
+
*/
|
|
37
|
+
export declare const maximumHandlers = 1024;
|
|
38
|
+
/**
|
|
39
|
+
* Maximum input nodes, including arrays and omitted entries.
|
|
40
|
+
*
|
|
41
|
+
* @category limits
|
|
42
|
+
* @since 1.0.0-rc.0
|
|
43
|
+
*/
|
|
44
|
+
export declare const maximumPluginInputNodes = 4096;
|
|
45
|
+
/**
|
|
46
|
+
* Maximum UTF-16 length of one plugin or hook name.
|
|
47
|
+
*
|
|
48
|
+
* @category limits
|
|
49
|
+
* @since 1.0.0-rc.0
|
|
50
|
+
*/
|
|
51
|
+
export declare const maximumPluginNameLength = 256;
|
|
52
|
+
/**
|
|
53
|
+
* Default fiber bound for parallel observers.
|
|
54
|
+
*
|
|
55
|
+
* @category limits
|
|
56
|
+
* @since 1.0.0-rc.0
|
|
57
|
+
*/
|
|
58
|
+
export declare const defaultParallelConcurrency = 16;
|
|
59
|
+
/**
|
|
60
|
+
* Maximum configurable parallel-observer bound.
|
|
61
|
+
*
|
|
62
|
+
* @category limits
|
|
63
|
+
* @since 1.0.0-rc.0
|
|
64
|
+
*/
|
|
65
|
+
export declare const maximumParallelConcurrency = 256;
|
|
66
|
+
/**
|
|
67
|
+
* One resolved handler with immutable attribution.
|
|
68
|
+
*
|
|
69
|
+
* @category models
|
|
70
|
+
* @since 1.0.0-rc.0
|
|
71
|
+
*/
|
|
72
|
+
export interface HandlerRecord {
|
|
73
|
+
readonly plugin: string;
|
|
74
|
+
readonly hook: string;
|
|
75
|
+
readonly handler: (...args: Array<any>) => unknown;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The immutable output of plugin resolution.
|
|
79
|
+
*
|
|
80
|
+
* @category models
|
|
81
|
+
* @since 1.0.0-rc.0
|
|
82
|
+
*/
|
|
83
|
+
export interface Resolved<H = FlowsHooks> {
|
|
84
|
+
readonly plugins: ReadonlyArray<FlowsPlugin<H>>;
|
|
85
|
+
readonly handlers: ReadonlyMap<string, ReadonlyArray<HandlerRecord>>;
|
|
86
|
+
/** The frozen runtime catalog this resolution admitted. Dispatch refuses a method whose kind differs from it. */
|
|
87
|
+
readonly kinds: Readonly<Record<string, HookKind>>;
|
|
88
|
+
readonly parallelConcurrency: number;
|
|
89
|
+
readonly cacheEnvironment?: Action.CacheEnvironment | undefined;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Options for {@link resolve}.
|
|
93
|
+
*
|
|
94
|
+
* @category models
|
|
95
|
+
* @since 1.0.0-rc.0
|
|
96
|
+
*/
|
|
97
|
+
export interface Options<H = FlowsHooks> {
|
|
98
|
+
/** Pre-resolution config tested by `apply` predicates. */
|
|
99
|
+
readonly config?: FlowsConfig | undefined;
|
|
100
|
+
/** Host whose literal `apply` selectors are active. Defaults to `"engine"`. */
|
|
101
|
+
readonly target?: "engine" | "harness" | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Hook names recognized by this host, each with the kind `H` declares for
|
|
104
|
+
* it. The shared `config` and `configResolved` hooks are fixed to
|
|
105
|
+
* `waterfall` and `parallel`; another kind fails with `hook_kind_mismatch`.
|
|
106
|
+
*/
|
|
107
|
+
readonly hooks?: HookCatalog<H> | undefined;
|
|
108
|
+
/** Complete composition identity for sealed activity keys. Requires every selected plugin to have a version. */
|
|
109
|
+
readonly cacheEnvironment?: Action.CacheEnvironment | undefined;
|
|
110
|
+
/** Maximum observers run at once. Defaults to 16 and cannot exceed 256. */
|
|
111
|
+
readonly parallelConcurrency?: number | undefined;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Resolves a plugin preset into an immutable, resource-bounded catalog.
|
|
115
|
+
*
|
|
116
|
+
* @category constructors
|
|
117
|
+
* @since 1.0.0-rc.0
|
|
118
|
+
*/
|
|
119
|
+
export declare const resolve: <H = FlowsHooks>(input: PluginInput<NoInfer<H>>, options?: Options<NoInfer<H>>, configOverride?: FlowsConfig) => Effect.Effect<Resolved<H>, PluginError>;
|
|
120
|
+
/**
|
|
121
|
+
* Merges every resolved plugin layer left-to-right and supplies the detached
|
|
122
|
+
* cache environment captured during resolution.
|
|
123
|
+
*
|
|
124
|
+
* @category combinators
|
|
125
|
+
* @since 1.0.0-rc.0
|
|
126
|
+
*/
|
|
127
|
+
export declare const layer: <H>(resolved: Resolved<H>) => Layer.Layer<any, PluginError, any>;
|
|
128
|
+
//# sourceMappingURL=Resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Resolve.d.ts","sourceRoot":"","sources":["../../src/Res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