@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.
Files changed (118) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/LICENSE +21 -0
  3. package/README.md +88 -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 +169 -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 +346 -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 +23 -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 +190 -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 +369 -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 +23 -0
  90. package/dist/esm/internal/snapshotCacheEnvironment.d.ts.map +1 -0
  91. package/dist/esm/internal/snapshotCacheEnvironment.js +64 -0
  92. package/dist/esm/internal/snapshotCacheEnvironment.js.map +1 -0
  93. package/docs/README.md +133 -0
  94. package/docs/api.md +524 -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 +75 -0
  105. package/docs/quickstart.md +152 -0
  106. package/docs/troubleshooting.md +180 -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 +271 -0
  114. package/src/Resolve.ts +539 -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 +78 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,79 @@
1
+ # @smthrs/plugin
2
+
3
+ ## [Unreleased]
4
+
5
+ ## [1.0.0-rc.0] - 2026-09-01
6
+
7
+ ### Added
8
+
9
+ - Added the public typed plugin kernel, bounded host hook catalogs, stable
10
+ ordering, configuration waterfalls, observer dispatch, and layer composition.
11
+ - Added complete `cacheEnvironment` identity for cross-run sealed reuse and a
12
+ package-owned generated API contract.
13
+ - Added the optional plugin `version` field and folded selected `name@version`
14
+ identities into every declared cache environment.
15
+ - Added stable runtime validation errors with value paths and published plugin,
16
+ handler, preset, configuration, and parallel-concurrency bounds.
17
+
18
+ ### Changed
19
+
20
+ - Configuration now contains only plugin-owned strict JSON namespaces. Removed
21
+ the inert `engine`, `retry`, `store`, and `plugins` keys; runtime policy stays
22
+ at the Effect service or constructor that applies it.
23
+ - Resolution now snapshots plugin records, hook entries, config, and cache
24
+ identity before dispatch. The public handler catalog has no mutation methods.
25
+ - Parallel observers run at bounded concurrency, and first hooks refuse a
26
+ non-`Option` result instead of silently skipping it.
27
+ - Declaring a cache environment now requires every selected plugin to provide a
28
+ bounded non-empty version.
29
+
30
+ ### Fixed
31
+
32
+ - Rejected prototype-control keys, accessors, exotic objects, sparse arrays,
33
+ cycles, malformed runtime plugins, and inherited hook names. A proxy is read
34
+ through descriptor reflection alone, so only the data its traps return is
35
+ copied and no accessor or trap result can place behavior in an admitted value.
36
+ - Bounded the merged output of `Config.merge`, so two individually valid
37
+ operands can no longer synthesize a config beyond the published byte, node,
38
+ member, and depth limits for a later `config` handler to observe.
39
+ - Checked host-catalog hook names after `apply` selection again, so a shared
40
+ preset carrying harness-only plugins resolves under a bare engine kernel.
41
+ Plugin, option, and hook-entry shapes are still validated before selection,
42
+ and the handler bound now counts the handlers the kernel dispatches rather
43
+ than the handlers of plugins `apply` dropped.
44
+ - Prevented plugins that omit a prototype-named hook from registering the
45
+ corresponding `Object.prototype` member as a handler.
46
+ - Kept plugin-built sealed keys run-local while complete capability identity is
47
+ unknown and detached declared identity from later caller mutation.
48
+
49
+ ### Breaking Changes
50
+
51
+ - Trimmed the published `engineHooks` catalog to the configuration lifecycle.
52
+ Removed hook names no longer resolve through that constant.
53
+ - First hooks now refuse a non-`Option` result instead of silently skipping it.
54
+ - Removed the `Config.RetryConfig` and `Config.EngineConfig` schemas and their
55
+ matching types. Both were root exports through `export * as Config`.
56
+ - Retyped `Config.FlowsConfig` and `Config.ResolvedConfig` from
57
+ `Schema.StructWithRest` over an engine and retry struct to
58
+ `Schema.Record(Schema.String, Schema.Json)`. Configuration that declared those
59
+ policy keys now fails with `config_invalid`: `Kernel.make([], { engine: {} })`
60
+ refuses at path `$.engine`.
61
+ - Narrowed `Config.merge` from `<A>(base: A, patch: unknown) => A` to
62
+ `(base: FlowsConfig, patch: unknown) => FlowsConfig`, and `Config.deepFreeze`
63
+ from `<A>(value: A) => A` to `<A extends ConfigValue>(value: A) => A`.
64
+ - Configuration refuses an `undefined` member instead of dropping it.
65
+ `{ ns: { a: 1, b: undefined } }` fails `config_invalid` at path `$.ns.b`, and
66
+ `Config.merge({ a: 1 }, { a: undefined })` now throws that error where it
67
+ previously returned `{ a: 1 }`. Omit the key, or write `null`.
68
+ - Refuses a whitespace-only plugin `name` or `version`, and a declared hook
69
+ entry whose value is `undefined`. All three previously resolved.
70
+ - Cache identity percent-escapes `%` and `@` in each `name@version` layer
71
+ entry, so two compositions can no longer collide on one sealed identity.
72
+ Existing sealed entries whose plugin names or versions contain either
73
+ character change identity once.
74
+
75
+ ## [0.1.0] - 2026-08-05
76
+
77
+ ### Added
78
+
79
+ - Added the first Vite-style typed plugin prototype.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 William Cory and the Smithers Flows contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,89 @@
1
- # Temporary Holding Version
1
+ # `@smthrs/plugin`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Release candidate scope, host requirements and compatibility review are defined in the [library support policy](https://github.com/smithersai/smithers/blob/main/RELEASE_SUPPORT.md).
4
+
5
+ This package declares `effect` as a `^4.0.4` peer dependency. Install one
6
+ `effect` release in that range so all Smithers packages share one Effect
7
+ runtime.
8
+
9
+ **Documentation:** https://github.com/smithersai/smithers/tree/main/packages/smithers/agent/plugin/docs
10
+
11
+ A typed, bounded plugin kernel for Effect programs: Vite's plugin model, with
12
+ hooks that are ordinary Effects, ordering that follows Vite's rules exactly, and
13
+ a resolution boundary that copies every value a caller hands it.
14
+
15
+ ```bash
16
+ npm install @smthrs/plugin@next effect
17
+ ```
18
+
19
+ ```ts
20
+ import { type FlowsPlugin, Kernel } from "@smthrs/plugin"
21
+ import { Effect } from "effect"
22
+
23
+ const feature: FlowsPlugin = {
24
+ name: "flows-plugin-feature",
25
+ hooks: {
26
+ config: () => Effect.succeed({ feature: { enabled: true } }),
27
+ configResolved: (config) => Effect.log(`feature enabled: ${config["feature"] !== undefined}`)
28
+ }
29
+ }
30
+
31
+ const kernel = await Effect.runPromise(Kernel.make([feature]))
32
+ ```
33
+
34
+ `kernel.config` is the frozen configuration every plugin agreed on,
35
+ `kernel.plugins` dispatches hooks, `kernel.layer` is every plugin's services
36
+ merged in resolved order, and `kernel.observerErrors` holds the failures that
37
+ `configResolved` observers reported without failing startup.
38
+
39
+ ## The hook catalog is yours
40
+
41
+ The kernel owns one catalog of its own, the two-step config lifecycle. Every
42
+ other hook belongs to a host: declare it with TypeScript module augmentation,
43
+ hand the kernel the matching runtime catalog, and dispatch that catalog and
44
+ nothing else. `FlowsHooks` is open for augmentation and closed for dispatch.
45
+
46
+ ```ts
47
+ declare module "@smthrs/plugin" {
48
+ interface FlowsHooks {
49
+ readonly toolCall: SequentialHook<(ctx: ToolCallContext) => Effect.Effect<Option.Option<ToolOverride>>>
50
+ }
51
+ }
52
+ ```
53
+
54
+ The shipped host is the Smithers agent loop in
55
+ [`@smthrs/agent`](https://github.com/smithersai/smithers/tree/main/packages/smithers/agent/docs), which adds three waterfalls to the
56
+ kernel's two hooks and dispatches them around each frame of an agent cell. Both
57
+ packages sit under the `smthrs` command line,
58
+ [`@smthrs/cli`](https://github.com/smithersai/smithers/tree/main/packages/smithers/docs).
59
+
60
+ ## What it does not do
61
+
62
+ This is not an engine lifecycle registry. Retry, storage, concurrency, cache,
63
+ wait, journal, and ownership policy stay on the Effect service or constructor
64
+ option that applies them, and configuration refuses the root keys `engine`,
65
+ `retry`, `store`, and `plugins` so that a configuration file cannot imply
66
+ otherwise.
67
+
68
+ ## Bounded by construction
69
+
70
+ Plugin names compare as exact Unicode and are never normalized. Resolution
71
+ validates every plugin record and hook entry before `apply` filtering, checks
72
+ hook names against the host catalog for the plugins it selected, snapshots
73
+ plugin records and hook objects, and exposes an immutable handler-map facade.
74
+ Configuration and cache identity are detached, bounded, strict JSON snapshots:
75
+ an `undefined` member is refused, not dropped. Mutating a caller's objects after
76
+ startup cannot change dispatch or sealed cache keys.
77
+
78
+ ## Documentation
79
+
80
+ - [Quickstart](https://github.com/smithersai/smithers/blob/main/packages/smithers/agent/plugin/docs/quickstart.md): build a host with a hook
81
+ of its own and run it.
82
+ - [Hook kinds](https://github.com/smithersai/smithers/blob/main/packages/smithers/agent/plugin/docs/concepts/hook-kinds.md),
83
+ [Resolution](https://github.com/smithersai/smithers/blob/main/packages/smithers/agent/plugin/docs/concepts/resolution.md), and
84
+ [Configuration](https://github.com/smithersai/smithers/blob/main/packages/smithers/agent/plugin/docs/concepts/configuration.md): the model
85
+ behind the kernel.
86
+ - [API reference](https://github.com/smithersai/smithers/blob/main/packages/smithers/agent/plugin/docs/api.md): every export, with
87
+ signatures and limits.
88
+ - [Troubleshooting](https://github.com/smithersai/smithers/blob/main/packages/smithers/agent/plugin/docs/troubleshooting.md): every error
89
+ code, what causes it, and what to change.
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Bounded JSON configuration consumed and produced by the plugin kernel.
3
+ *
4
+ * Configuration is an extension namespace, not an engine-policy surface.
5
+ * Durable retry, concurrency, and storage policy stay on their owning Effect
6
+ * services and constructor options. Every accepted value is copied before any
7
+ * plugin observes it, then frozen recursively.
8
+ *
9
+ * @since 1.0.0-rc.0
10
+ */
11
+ import * as Effect from "effect/Effect";
12
+ import * as Schema from "effect/Schema";
13
+ import { PluginError } from "./PluginError.ts";
14
+ /**
15
+ * Maximum encoded bytes accepted for one plugin configuration.
16
+ *
17
+ * @category limits
18
+ * @since 1.0.0-rc.0
19
+ */
20
+ export declare const maximumConfigBytes: number;
21
+ /**
22
+ * Maximum nesting accepted for one plugin configuration.
23
+ *
24
+ * @category limits
25
+ * @since 1.0.0-rc.0
26
+ */
27
+ export declare const maximumConfigDepth: number;
28
+ /**
29
+ * Maximum aggregate members accepted for one plugin configuration.
30
+ *
31
+ * @category limits
32
+ * @since 1.0.0-rc.0
33
+ */
34
+ export declare const maximumConfigMembers: number;
35
+ /**
36
+ * Maximum aggregate values accepted for one plugin configuration.
37
+ *
38
+ * @category limits
39
+ * @since 1.0.0-rc.0
40
+ */
41
+ export declare const maximumConfigNodes: number;
42
+ /**
43
+ * One value accepted in a plugin-owned configuration namespace.
44
+ *
45
+ * @category models
46
+ * @since 1.0.0-rc.0
47
+ */
48
+ export declare const ConfigValue: Schema.Codec<Schema.Json, Schema.Json, never, never>;
49
+ /**
50
+ * One value accepted in a plugin-owned configuration namespace.
51
+ *
52
+ * @category models
53
+ * @since 1.0.0-rc.0
54
+ */
55
+ export type ConfigValue = typeof ConfigValue.Type;
56
+ /**
57
+ * Admits pre-resolution configuration as a detached, recursively frozen snapshot.
58
+ *
59
+ * Keys name plugin-owned namespaces. `engine`, `retry`, `store`, and
60
+ * `plugins` are refused because accepting those names would imply policy the
61
+ * plugin kernel does not own or apply.
62
+ *
63
+ * @category models
64
+ * @since 1.0.0-rc.0
65
+ */
66
+ export declare const FlowsConfig: Schema.decodeTo<Schema.declare<Readonly<Record<string, Schema.Json>>, Readonly<Record<string, Schema.Json>>>, Schema.Unknown, never, never>;
67
+ /**
68
+ * The decoded form of {@link FlowsConfig}.
69
+ *
70
+ * @category models
71
+ * @since 1.0.0-rc.0
72
+ */
73
+ export type FlowsConfig = typeof FlowsConfig.Type;
74
+ /**
75
+ * Admits the detached, recursively frozen configuration handed to plugins.
76
+ *
77
+ * @category models
78
+ * @since 1.0.0-rc.0
79
+ */
80
+ export declare const ResolvedConfig: Schema.decodeTo<Schema.declare<Readonly<Record<string, Schema.Json>>, Readonly<Record<string, Schema.Json>>>, Schema.Unknown, never, never>;
81
+ /**
82
+ * The decoded form of {@link ResolvedConfig}.
83
+ *
84
+ * @category models
85
+ * @since 1.0.0-rc.0
86
+ */
87
+ export type ResolvedConfig = typeof ResolvedConfig.Type;
88
+ /**
89
+ * Empty defaults. Engine policy is deliberately not defaulted here.
90
+ *
91
+ * @category constructors
92
+ * @since 1.0.0-rc.0
93
+ */
94
+ export declare const defaults: ResolvedConfig;
95
+ /**
96
+ * Copies and deep-merges a configuration patch over a base configuration.
97
+ *
98
+ * Records merge key-by-key and every other JSON value replaces wholesale.
99
+ * Raw operands are admitted; known snapshots retain unchanged subtrees.
100
+ * Cached subtree totals enforce merged output bounds. Unsafe property names,
101
+ * accessors, cycles, exotic prototypes, and aggregate values outside the
102
+ * resource limits fail with `config_invalid`.
103
+ *
104
+ * @category combinators
105
+ * @since 1.0.0-rc.0
106
+ */
107
+ export declare const merge: (base: FlowsConfig, patch: unknown) => FlowsConfig;
108
+ /**
109
+ * Copies and freezes one JSON value without retaining caller-owned objects.
110
+ *
111
+ * @category utils
112
+ * @since 1.0.0-rc.0
113
+ */
114
+ export declare const deepFreeze: <A extends ConfigValue>(value: A) => A;
115
+ /**
116
+ * Admits a raw pre-resolution configuration as an immutable snapshot.
117
+ *
118
+ * @category constructors
119
+ * @since 1.0.0-rc.0
120
+ */
121
+ export declare const snapshot: (config: unknown) => Effect.Effect<FlowsConfig, PluginError>;
122
+ /**
123
+ * Decodes the post-waterfall configuration into its final immutable form.
124
+ *
125
+ * @category constructors
126
+ * @since 1.0.0-rc.0
127
+ */
128
+ export declare const resolve: (config: unknown) => Effect.Effect<ResolvedConfig, PluginError>;
129
+ //# sourceMappingURL=Config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAIvC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,QAAkC,CAAA;AAEjE;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,QAAkC,CAAA;AAEjE;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,QAAoC,CAAA;AAErE;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,QAAkC,CAAA;AAEjE;;;;;GAKG;AACH,eAAO,MAAM,WAAW,sDAAc,CAAA;AAEtC;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AAwBjD;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,6IAAsB,CAAA;AAE9C;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,6IAAsB,CAAA;AAEjD;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA;AAyBvD;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,EAAE,cAAmC,CAAA;AAE1D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,KAAK,GAAI,MAAM,WAAW,EAAE,OAAO,OAAO,KAAG,WAUzD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,WAAW,EAAE,OAAO,CAAC,KAAG,CAI5D,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,QAAQ,OAAO,KAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,WAAW,CACU,CAAA;AAE3F;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAAI,QAAQ,OAAO,KAAG,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,WAAW,CAAqB,CAAA"}
@@ -0,0 +1,115 @@
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 Config_exports = {};
30
+ __export(Config_exports, {
31
+ ConfigValue: () => ConfigValue,
32
+ FlowsConfig: () => FlowsConfig,
33
+ ResolvedConfig: () => ResolvedConfig,
34
+ deepFreeze: () => deepFreeze,
35
+ defaults: () => defaults,
36
+ maximumConfigBytes: () => maximumConfigBytes,
37
+ maximumConfigDepth: () => maximumConfigDepth,
38
+ maximumConfigMembers: () => maximumConfigMembers,
39
+ maximumConfigNodes: () => maximumConfigNodes,
40
+ merge: () => merge,
41
+ resolve: () => resolve,
42
+ snapshot: () => snapshot
43
+ });
44
+ module.exports = __toCommonJS(Config_exports);
45
+ var Effect = __toESM(require("effect/Effect"), 1);
46
+ var Schema = __toESM(require("effect/Schema"), 1);
47
+ var SchemaGetter = __toESM(require("effect/SchemaGetter"), 1);
48
+ var SchemaIssue = __toESM(require("effect/SchemaIssue"), 1);
49
+ var Boundary = __toESM(require("./internal/Boundary.js"), 1);
50
+ var import_PluginError = require("./PluginError.js");
51
+ const maximumConfigBytes = Boundary.defaultLimits.maxBytes;
52
+ const maximumConfigDepth = Boundary.defaultLimits.maxDepth;
53
+ const maximumConfigMembers = Boundary.defaultLimits.maxMembers;
54
+ const maximumConfigNodes = Boundary.defaultLimits.maxNodes;
55
+ const ConfigValue = Schema.Json;
56
+ const admittedConfigs = /* @__PURE__ */ new WeakSet();
57
+ const configurationSchema = Schema.Unknown.pipe(
58
+ Schema.decodeTo(
59
+ Schema.declare(
60
+ (value) => typeof value === "object" && value !== null && admittedConfigs.has(value)
61
+ ),
62
+ {
63
+ decode: SchemaGetter.transformEffect(
64
+ (value) => Effect.try({
65
+ try: () => snapshotRecord(value),
66
+ catch: (cause) => {
67
+ const error = cause;
68
+ return new SchemaIssue.InvalidValue({ message: `${error.path}: ${error.message}` });
69
+ }
70
+ })
71
+ ),
72
+ encode: SchemaGetter.transform((value) => value)
73
+ }
74
+ )
75
+ );
76
+ const FlowsConfig = configurationSchema;
77
+ const ResolvedConfig = configurationSchema;
78
+ const reservedRootKeys = /* @__PURE__ */ new Set(["engine", "retry", "store", "plugins"]);
79
+ const invalid = (path, complaint) => new import_PluginError.PluginError({
80
+ code: "config_invalid",
81
+ message: `plugin configuration ${complaint}`,
82
+ path
83
+ });
84
+ const snapshotRecord = (input, reuse = true) => {
85
+ if (reuse && typeof input === "object" && input !== null && admittedConfigs.has(input)) return input;
86
+ const admitted = Boundary.record(input);
87
+ if (!admitted.ok) throw invalid(admitted.path, admitted.complaint);
88
+ const record = admitted.value;
89
+ for (const key of Object.keys(record)) {
90
+ if (reservedRootKeys.has(key)) {
91
+ throw invalid(`$.${key}`, "uses a runtime-policy key that the plugin kernel does not own");
92
+ }
93
+ }
94
+ admittedConfigs.add(record);
95
+ return record;
96
+ };
97
+ const defaults = snapshotRecord({});
98
+ const merge = (base, patch) => {
99
+ const safeBase = snapshotRecord(base);
100
+ if (patch === void 0) return safeBase;
101
+ const safePatch = snapshotRecord(patch, false);
102
+ const merged = Boundary.mergeRecords(safeBase, safePatch);
103
+ if (!merged.ok) throw invalid(merged.path, merged.complaint);
104
+ const record = merged.value;
105
+ admittedConfigs.add(record);
106
+ return record;
107
+ };
108
+ const deepFreeze = (value) => {
109
+ const admitted = Boundary.admit(value);
110
+ if (!admitted.ok) throw invalid(admitted.path, admitted.complaint);
111
+ return admitted.value;
112
+ };
113
+ const snapshot = (config) => Effect.try({ try: () => snapshotRecord(config), catch: (cause) => cause });
114
+ const resolve = (config) => snapshot(config);
115
+ //# sourceMappingURL=Config.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Config.ts"],
4
+ "sourcesContent": ["/**\n * Bounded JSON configuration consumed and produced by the plugin kernel.\n *\n * Configuration is an extension namespace, not an engine-policy surface.\n * Durable retry, concurrency, and storage policy stay on their owning Effect\n * services and constructor options. Every accepted value is copied before any\n * plugin observes it, then frozen recursively.\n *\n * @since 1.0.0-rc.0\n */\n\nimport * as Effect from \"effect/Effect\"\nimport * as Schema from \"effect/Schema\"\nimport * as SchemaGetter from \"effect/SchemaGetter\"\nimport * as SchemaIssue from \"effect/SchemaIssue\"\nimport * as Boundary from \"./internal/Boundary.ts\"\nimport { PluginError } from \"./PluginError.ts\"\n\n/**\n * Maximum encoded bytes accepted for one plugin configuration.\n *\n * @category limits\n * @since 1.0.0-rc.0\n */\nexport const maximumConfigBytes = Boundary.defaultLimits.maxBytes\n\n/**\n * Maximum nesting accepted for one plugin configuration.\n *\n * @category limits\n * @since 1.0.0-rc.0\n */\nexport const maximumConfigDepth = Boundary.defaultLimits.maxDepth\n\n/**\n * Maximum aggregate members accepted for one plugin configuration.\n *\n * @category limits\n * @since 1.0.0-rc.0\n */\nexport const maximumConfigMembers = Boundary.defaultLimits.maxMembers\n\n/**\n * Maximum aggregate values accepted for one plugin configuration.\n *\n * @category limits\n * @since 1.0.0-rc.0\n */\nexport const maximumConfigNodes = Boundary.defaultLimits.maxNodes\n\n/**\n * One value accepted in a plugin-owned configuration namespace.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport const ConfigValue = Schema.Json\n\n/**\n * One value accepted in a plugin-owned configuration namespace.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport type ConfigValue = typeof ConfigValue.Type\n\nconst admittedConfigs = new WeakSet<object>()\n\nconst configurationSchema = Schema.Unknown.pipe(\n Schema.decodeTo(\n Schema.declare<Readonly<Record<string, ConfigValue>>>((value): value is Readonly<Record<string, ConfigValue>> =>\n typeof value === \"object\" && value !== null && admittedConfigs.has(value)\n ),\n {\n decode: SchemaGetter.transformEffect((value) =>\n Effect.try({\n try: () => snapshotRecord(value),\n catch: (cause) => {\n const error = cause as PluginError\n return new SchemaIssue.InvalidValue({ message: `${error.path}: ${error.message}` })\n }\n })\n ),\n encode: SchemaGetter.transform((value) => value)\n }\n )\n)\n\n/**\n * Admits pre-resolution configuration as a detached, recursively frozen snapshot.\n *\n * Keys name plugin-owned namespaces. `engine`, `retry`, `store`, and\n * `plugins` are refused because accepting those names would imply policy the\n * plugin kernel does not own or apply.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport const FlowsConfig = configurationSchema\n\n/**\n * The decoded form of {@link FlowsConfig}.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport type FlowsConfig = typeof FlowsConfig.Type\n\n/**\n * Admits the detached, recursively frozen configuration handed to plugins.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport const ResolvedConfig = configurationSchema\n\n/**\n * The decoded form of {@link ResolvedConfig}.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport type ResolvedConfig = typeof ResolvedConfig.Type\n\nconst reservedRootKeys = new Set([\"engine\", \"retry\", \"store\", \"plugins\"])\n\nconst invalid = (path: string, complaint: string): PluginError =>\n new PluginError({\n code: \"config_invalid\",\n message: `plugin configuration ${complaint}`,\n path\n })\n\nconst snapshotRecord = (input: unknown, reuse = true): Readonly<Record<string, ConfigValue>> => {\n if (reuse && typeof input === \"object\" && input !== null && admittedConfigs.has(input)) return input as ResolvedConfig\n const admitted = Boundary.record(input)\n if (!admitted.ok) throw invalid(admitted.path, admitted.complaint)\n const record = admitted.value as Readonly<Record<string, ConfigValue>>\n for (const key of Object.keys(record)) {\n if (reservedRootKeys.has(key)) {\n throw invalid(`$.${key}`, \"uses a runtime-policy key that the plugin kernel does not own\")\n }\n }\n admittedConfigs.add(record)\n return record\n}\n\n/**\n * Empty defaults. Engine policy is deliberately not defaulted here.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const defaults: ResolvedConfig = snapshotRecord({})\n\n/**\n * Copies and deep-merges a configuration patch over a base configuration.\n *\n * Records merge key-by-key and every other JSON value replaces wholesale.\n * Raw operands are admitted; known snapshots retain unchanged subtrees.\n * Cached subtree totals enforce merged output bounds. Unsafe property names,\n * accessors, cycles, exotic prototypes, and aggregate values outside the\n * resource limits fail with `config_invalid`.\n *\n * @category combinators\n * @since 1.0.0-rc.0\n */\nexport const merge = (base: FlowsConfig, patch: unknown): FlowsConfig => {\n const safeBase = snapshotRecord(base)\n if (patch === undefined) return safeBase\n // Even a known patch is copied so its tree cannot alias the retained base.\n const safePatch = snapshotRecord(patch, false)\n const merged = Boundary.mergeRecords(safeBase, safePatch)\n if (!merged.ok) throw invalid(merged.path, merged.complaint)\n const record = merged.value as ResolvedConfig\n admittedConfigs.add(record)\n return record\n}\n\n/**\n * Copies and freezes one JSON value without retaining caller-owned objects.\n *\n * @category utils\n * @since 1.0.0-rc.0\n */\nexport const deepFreeze = <A extends ConfigValue>(value: A): A => {\n const admitted = Boundary.admit(value)\n if (!admitted.ok) throw invalid(admitted.path, admitted.complaint)\n return admitted.value as A\n}\n\n/**\n * Admits a raw pre-resolution configuration as an immutable snapshot.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const snapshot = (config: unknown): Effect.Effect<FlowsConfig, PluginError> =>\n Effect.try({ try: () => snapshotRecord(config), catch: (cause) => cause as PluginError })\n\n/**\n * Decodes the post-waterfall configuration into its final immutable form.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const resolve = (config: unknown): Effect.Effect<ResolvedConfig, PluginError> => snapshot(config)\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,aAAwB;AACxB,aAAwB;AACxB,mBAA8B;AAC9B,kBAA6B;AAC7B,eAA0B;AAC1B,yBAA4B;AAQrB,MAAM,qBAAqB,SAAS,cAAc;AAQlD,MAAM,qBAAqB,SAAS,cAAc;AAQlD,MAAM,uBAAuB,SAAS,cAAc;AAQpD,MAAM,qBAAqB,SAAS,cAAc;AAQlD,MAAM,cAAc,OAAO;AAUlC,MAAM,kBAAkB,oBAAI,QAAgB;AAE5C,MAAM,sBAAsB,OAAO,QAAQ;AAAA,EACzC,OAAO;AAAA,IACL,OAAO;AAAA,MAA+C,CAAC,UACrD,OAAO,UAAU,YAAY,UAAU,QAAQ,gBAAgB,IAAI,KAAK;AAAA,IAC1E;AAAA,IACA;AAAA,MACE,QAAQ,aAAa;AAAA,QAAgB,CAAC,UACpC,OAAO,IAAI;AAAA,UACT,KAAK,MAAM,eAAe,KAAK;AAAA,UAC/B,OAAO,CAAC,UAAU;AAChB,kBAAM,QAAQ;AACd,mBAAO,IAAI,YAAY,aAAa,EAAE,SAAS,GAAG,MAAM,IAAI,KAAK,MAAM,OAAO,GAAG,CAAC;AAAA,UACpF;AAAA,QACF,CAAC;AAAA,MACH;AAAA,MACA,QAAQ,aAAa,UAAU,CAAC,UAAU,KAAK;AAAA,IACjD;AAAA,EACF;AACF;AAYO,MAAM,cAAc;AAgBpB,MAAM,iBAAiB;AAU9B,MAAM,mBAAmB,oBAAI,IAAI,CAAC,UAAU,SAAS,SAAS,SAAS,CAAC;AAExE,MAAM,UAAU,CAAC,MAAc,cAC7B,IAAI,+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+1,176 @@
1
+ /**
2
+ * The typed hook surface: hook kinds, the hook entry shape, and the shared
3
+ * kernel's base hook catalog.
4
+ *
5
+ * The public package contract is documented at
6
+ * {@link https://smithers.sh/docs/reference/api/plugin}. The shared catalog is limited to
7
+ * `config` and `configResolved`;
8
+ * `@smthrs/agent` adds only `cellRegistry`, `cellFlows`, and
9
+ * `cellModelRequest`. Durable-core lifecycle policy is not a hook catalog.
10
+ *
11
+ * `FlowsHooks` is **open for augmentation, closed for dispatch**: a host
12
+ * declares its hooks with `declare module "@smthrs/plugin"`, supplies the
13
+ * matching runtime catalog, and dispatches only that bounded set.
14
+ *
15
+ * @since 1.0.0-rc.0
16
+ */
17
+ import type * as Effect from "effect/Effect";
18
+ /**
19
+ * Dispatch semantics of a hook, fixed by the core.
20
+ *
21
+ * @category models
22
+ * @since 1.0.0-rc.0
23
+ */
24
+ export type HookKind = "sequential" | "parallel" | "first" | "waterfall";
25
+ declare const HookTypeId: unique symbol;
26
+ /**
27
+ * Phantom carrier that records a hook's kind and handler type in the type
28
+ * system without adding anything at runtime.
29
+ *
30
+ * @category models
31
+ * @since 1.0.0-rc.0
32
+ */
33
+ export interface HookMeta<K extends HookKind, F> {
34
+ readonly [HookTypeId]?: {
35
+ readonly kind: K;
36
+ readonly handler: F;
37
+ };
38
+ }
39
+ /**
40
+ * The object form of a hook entry: Vite's per-hook ordering object, verbatim.
41
+ *
42
+ * @category models
43
+ * @since 1.0.0-rc.0
44
+ */
45
+ export interface HookObject<F> {
46
+ readonly order?: "pre" | "post" | undefined;
47
+ readonly handler: F;
48
+ }
49
+ /**
50
+ * A hook entry is either the bare handler or `{ order?, handler }`.
51
+ *
52
+ * @category models
53
+ * @since 1.0.0-rc.0
54
+ */
55
+ export type HookEntry<K extends HookKind, F> = (F | HookObject<F>) & HookMeta<K, F>;
56
+ /**
57
+ * Every handler runs, in resolved order, one at a time.
58
+ *
59
+ * @category models
60
+ * @since 1.0.0-rc.0
61
+ */
62
+ export type SequentialHook<F> = HookEntry<"sequential", F>;
63
+ /**
64
+ * Every handler runs concurrently; results are ignored and failures are
65
+ * returned to the caller rather than failing it.
66
+ *
67
+ * @category models
68
+ * @since 1.0.0-rc.0
69
+ */
70
+ export type ParallelHook<F> = HookEntry<"parallel", F>;
71
+ /**
72
+ * Handlers run in order until one returns `Option.some`.
73
+ *
74
+ * @category models
75
+ * @since 1.0.0-rc.0
76
+ */
77
+ export type FirstHook<F> = HookEntry<"first", F>;
78
+ /**
79
+ * Each handler receives the previous handler's output.
80
+ *
81
+ * @category models
82
+ * @since 1.0.0-rc.0
83
+ */
84
+ export type WaterfallHook<F> = HookEntry<"waterfall", F>;
85
+ /**
86
+ * Extracts the declared kind of a hook entry type.
87
+ *
88
+ * @category type-level
89
+ * @since 1.0.0-rc.0
90
+ */
91
+ export type KindOf<T> = T extends HookMeta<infer K, any> ? K : never;
92
+ /**
93
+ * The runtime catalog a host supplies for a hook interface: each hook name
94
+ * mapped to its kind. A name declared in `H` must carry the kind its type
95
+ * declares. Names outside `H` are admitted with any kind, because the type
96
+ * system cannot enumerate an augmentable interface; resolution checks them
97
+ * at runtime and dispatch refuses a kind that disagrees with the catalog.
98
+ *
99
+ * @category type-level
100
+ * @since 1.0.0-rc.0
101
+ */
102
+ export type HookCatalog<H> = {
103
+ readonly [K in keyof H & string]?: KindOf<H[K]>;
104
+ } & {
105
+ readonly [name: string]: HookKind | undefined;
106
+ };
107
+ /**
108
+ * Extracts the handler type of a hook entry type.
109
+ *
110
+ * @category type-level
111
+ * @since 1.0.0-rc.0
112
+ */
113
+ export type HandlerOf<T> = T extends HookMeta<any, infer F> ? F : never;
114
+ /**
115
+ * Selects the hook names of a given kind from a hook interface.
116
+ *
117
+ * @category type-level
118
+ * @since 1.0.0-rc.0
119
+ */
120
+ export type KeysOfKind<H, K extends HookKind> = {
121
+ [P in keyof H]: KindOf<H[P]> extends K ? P : never;
122
+ }[keyof H] & string;
123
+ /**
124
+ * Extracts the positional argument tuple accepted by a hook entry.
125
+ *
126
+ * @category type-level
127
+ * @since 1.0.0-rc.0
128
+ */
129
+ export type ArgsOf<T> = HandlerOf<T> extends (...args: infer A) => any ? A : never;
130
+ /**
131
+ * Extracts the Effect returned by a hook entry.
132
+ *
133
+ * @category type-level
134
+ * @since 1.0.0-rc.0
135
+ */
136
+ export type ReturnOf<T> = HandlerOf<T> extends (...args: any) => infer R ? R : never;
137
+ /**
138
+ * Extracts the success value returned by a hook entry's Effect.
139
+ *
140
+ * @category type-level
141
+ * @since 1.0.0-rc.0
142
+ */
143
+ export type SuccessOf<T> = ReturnOf<T> extends Effect.Effect<infer A, any, any> ? A : never;
144
+ /**
145
+ * Extracts the context required by a hook entry's Effect.
146
+ *
147
+ * @category type-level
148
+ * @since 1.0.0-rc.0
149
+ */
150
+ export type ContextOf<T> = ReturnOf<T> extends Effect.Effect<any, any, infer R> ? R : never;
151
+ /**
152
+ * Frozen runtime catalog for the shared configuration hooks.
153
+ *
154
+ * @category models
155
+ * @since 1.0.0-rc.0
156
+ */
157
+ export declare const engineHooks: Readonly<{
158
+ readonly config: "waterfall";
159
+ readonly configResolved: "parallel";
160
+ }>;
161
+ /**
162
+ * Normalizes a hook entry to its handler.
163
+ *
164
+ * @category utils
165
+ * @since 1.0.0-rc.0
166
+ */
167
+ export declare const handlerOf: (entry: unknown) => (...args: Array<any>) => unknown;
168
+ /**
169
+ * Reads the per-hook `order` of a hook entry.
170
+ *
171
+ * @category utils
172
+ * @since 1.0.0-rc.0
173
+ */
174
+ export declare const orderOf: (entry: unknown) => "pre" | "post" | undefined;
175
+ export {};
176
+ //# sourceMappingURL=Hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Hooks.d.ts","sourceRoot":"","sources":["../../src/Hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAE5C;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,UA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