@r_masseater/plugin-kit 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,87 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 masseater
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.
22
+
23
+ ---
24
+
25
+ @tanstack/eslint-plugin-start
26
+
27
+ MIT License
28
+
29
+ Copyright (c) 2021-present Tanner Linsley
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining a copy
32
+ of this software and associated documentation files (the "Software"), to deal
33
+ in the Software without restriction, including without limitation the rights
34
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
35
+ copies of the Software, and to permit persons to whom the Software is
36
+ furnished to do so, subject to the following conditions:
37
+
38
+ The above copyright notice and this permission notice shall be included in all
39
+ copies or substantial portions of the Software.
40
+
41
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
44
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
45
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
46
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
47
+ SOFTWARE.
48
+
49
+ ---
50
+
51
+ @typescript-eslint/utils
52
+
53
+ MIT License
54
+
55
+ Copyright (c) 2019 typescript-eslint and other contributors
56
+
57
+ Permission is hereby granted, free of charge, to any person obtaining a copy
58
+ of this software and associated documentation files (the "Software"), to deal
59
+ in the Software without restriction, including without limitation the rights
60
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
61
+ copies of the Software, and to permit persons to whom the Software is
62
+ furnished to do so, subject to the following conditions:
63
+
64
+ The above copyright notice and this permission notice shall be included in all
65
+ copies or substantial portions of the Software.
66
+
67
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
68
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
69
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
70
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
71
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
72
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
73
+ SOFTWARE.
74
+
75
+ ---
76
+
77
+ globals
78
+
79
+ MIT License
80
+
81
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
82
+
83
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
84
+
85
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
86
+
87
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,30 @@
1
- # Temporary Holding Version
1
+ # @r_masseater/plugin-kit
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
+ Reads untrusted JSON in Claude Code plugin hooks and scripts.
4
+
5
+ It requires Node.js 26 or later. It bundles the little of Effect it needs, so installing it adds no other package.
6
+
7
+ ```sh
8
+ bun add @r_masseater/plugin-kit
9
+ ```
10
+
11
+ ## Read a hook payload
12
+
13
+ `parseJson` returns an `Option`: `{ _tag: "Some", value }` for JSON text and `{ _tag: "None" }` otherwise, and it never throws. `isRecord` narrows a value to a plain object, so you can read its keys without a cast.
14
+
15
+ ```ts
16
+ import { isRecord, parseJson } from "@r_masseater/plugin-kit";
17
+
18
+ const parsed = parseJson(text);
19
+ if (parsed._tag === "Some" && isRecord(parsed.value)) {
20
+ console.log(parsed.value["tool_name"]);
21
+ }
22
+ ```
23
+
24
+ ## Agent skills
25
+
26
+ The package ships an agent skill in `skills/`. Add `permissions: { "@r_masseater/plugin-kit": { skills: true } }` to `pnpm-workspace.yaml` and `vp install` links it into the skill directories of your agents.
27
+
28
+ ## License
29
+
30
+ [MIT](LICENSE)
@@ -0,0 +1,569 @@
1
+ /**
2
+ * Function-type alias encoding covariant variance for a phantom type
3
+ * parameter.
4
+ *
5
+ * **When to use**
6
+ *
7
+ * Use as a phantom field type to make a type parameter covariant in output
8
+ * position.
9
+ *
10
+ * **Details**
11
+ *
12
+ * `Covariant<A>` is assignable to `Covariant<B>` when `A extends B`, following
13
+ * the subtype direction.
14
+ *
15
+ * **Example** (Defining a covariant phantom type)
16
+ *
17
+ * ```ts import.meta.vitest
18
+ * import type { Types } from "effect"
19
+ *
20
+ * interface Producer<T> {
21
+ * readonly _phantom: Types.Covariant<T>
22
+ * readonly get: () => T
23
+ * }
24
+ *
25
+ * const producer: Producer<string> = { _phantom: () => "value", get: () => "value" }
26
+ * ```
27
+ *
28
+ * @see {@link Covariant.Type}
29
+ * @see {@link Contravariant}
30
+ * @see {@link Invariant}
31
+ *
32
+ * @stability stable
33
+ * @category utility types
34
+ * @since 2.0.0
35
+ */
36
+ type Covariant<A> = (_: never) => A;
37
+ /**
38
+ * Namespace for {@link Covariant}-related utilities.
39
+ *
40
+ * **When to use**
41
+ *
42
+ * Use when referring to type-level helpers nested under `Covariant`.
43
+ *
44
+ * @stability stable
45
+ * @since 3.9.0
46
+ */
47
+ declare namespace Covariant {
48
+ /**
49
+ * Extracts the type parameter `A` from a `Covariant<A>`.
50
+ *
51
+ * **When to use**
52
+ *
53
+ * Use to recover the carried type from a covariant phantom marker.
54
+ *
55
+ * **Example** (Extracting the inner type)
56
+ *
57
+ * ```ts import.meta.vitest
58
+ * import type { Types } from "effect"
59
+ *
60
+ * type Inner = Types.Covariant.Type<Types.Covariant<string>>
61
+ * // string
62
+ *
63
+ * const witness: Inner = "value"
64
+ * ```
65
+ *
66
+ * @see {@link Covariant}
67
+ *
68
+ * @category utility types
69
+ * @since 3.9.0
70
+ */
71
+ type Type<A> = A extends Covariant<infer U> ? U : never;
72
+ }
73
+ /**
74
+ * Defines the symbol used by Node.js for custom object inspection.
75
+ *
76
+ * **When to use**
77
+ *
78
+ * Use to implement Node.js custom inspection for a value.
79
+ *
80
+ * **Details**
81
+ *
82
+ * This symbol is recognized by Node.js's `util.inspect()` function and the REPL
83
+ * for custom object representation. When an object has a method with this symbol,
84
+ * it will be called to determine how the object should be displayed.
85
+ *
86
+ * **Example** (Defining custom Node inspection)
87
+ *
88
+ * ```ts import.meta.vitest
89
+ * import { Inspectable } from "effect"
90
+ *
91
+ * class CustomObject {
92
+ * constructor(private value: string) {}
93
+ *
94
+ * [Inspectable.NodeInspectSymbol]() {
95
+ * return `CustomObject(${this.value})`
96
+ * }
97
+ * }
98
+ *
99
+ * const obj = new CustomObject("hello")
100
+ * obj[Inspectable.NodeInspectSymbol]() // => "CustomObject(hello)"
101
+ * ```
102
+ *
103
+ * @stability stable
104
+ * @category symbols
105
+ * @since 2.0.0
106
+ */
107
+ declare const NodeInspectSymbol: unique symbol;
108
+ /**
109
+ * The type of the Node.js inspection symbol used for custom object inspection.
110
+ * This symbol type is used to implement custom inspection behavior in Node.js
111
+ * environments.
112
+ *
113
+ * **When to use**
114
+ *
115
+ * Use to type methods keyed by the Node.js custom inspection symbol.
116
+ *
117
+ * **Example** (Typing custom Node inspection)
118
+ *
119
+ * ```ts import.meta.vitest
120
+ * import { Inspectable } from "effect"
121
+ *
122
+ * class CustomObject {
123
+ * constructor(private value: string) {}
124
+ *
125
+ * [Inspectable.NodeInspectSymbol]() {
126
+ * return `CustomObject(${this.value})`
127
+ * }
128
+ * }
129
+ *
130
+ * const obj = new CustomObject("test")
131
+ * obj[Inspectable.NodeInspectSymbol]() // => "CustomObject(test)"
132
+ * ```
133
+ *
134
+ * @stability stable
135
+ * @category symbols
136
+ * @since 2.0.0
137
+ */
138
+ type NodeInspectSymbol = typeof NodeInspectSymbol;
139
+ /**
140
+ * Interface for objects that can be inspected and provide custom string representations.
141
+ *
142
+ * **When to use**
143
+ *
144
+ * Use to define values with custom string, JSON, and Node.js inspection output.
145
+ *
146
+ * **Details**
147
+ *
148
+ * Objects implementing this interface can control how they appear in debugging contexts,
149
+ * JSON serialization, and Node.js inspection. This is particularly useful for creating
150
+ * custom data types that display meaningful information during development.
151
+ *
152
+ * **Example** (Implementing inspectable objects)
153
+ *
154
+ * ```ts import.meta.vitest
155
+ * import { Formatter, Inspectable } from "effect"
156
+ *
157
+ * class Result implements Inspectable.Inspectable {
158
+ * constructor(
159
+ * private readonly tag: "Success" | "Failure",
160
+ * private readonly value: unknown
161
+ * ) {}
162
+ *
163
+ * toString(): string {
164
+ * return Formatter.format(this.toJSON())
165
+ * }
166
+ *
167
+ * toJSON() {
168
+ * return { _tag: this.tag, value: this.value }
169
+ * }
170
+ *
171
+ * [Inspectable.NodeInspectSymbol]() {
172
+ * return this.toJSON()
173
+ * }
174
+ * }
175
+ *
176
+ * const success = new Result("Success", 42)
177
+ * success.toString() // => "{\"_tag\":\"Success\",\"value\":42}"
178
+ * ```
179
+ *
180
+ * @stability stable
181
+ * @category models
182
+ * @since 2.0.0
183
+ */
184
+ interface Inspectable {
185
+ toString(): string;
186
+ toJSON(): unknown;
187
+ [NodeInspectSymbol](): unknown;
188
+ }
189
+ /**
190
+ * The `Pipeable` module defines the shared interface and implementation helpers
191
+ * for values that support Effect-style method chaining with `.pipe(...)`.
192
+ *
193
+ * A `Pipeable` value can pass itself through a sequence of unary functions from
194
+ * left to right, so code can be written as `value.pipe(f, g, h)` instead of
195
+ * deeply nesting calls. This is the method form used by many Effect data types
196
+ * to compose transformations, validations, and effectful operations while
197
+ * keeping the original value as the starting point of the pipeline.
198
+ *
199
+ * @stability stable
200
+ * @since 2.0.0
201
+ */
202
+ /**
203
+ * Interface for values that support method-style `pipe` composition.
204
+ *
205
+ * **When to use**
206
+ *
207
+ * Use to type values that expose an Effect-style `.pipe(...)` method.
208
+ *
209
+ * **Details**
210
+ *
211
+ * Calling `value.pipe(f, g, h)` passes the value through each function from
212
+ * left to right, returning the final result. Many Effect data types implement
213
+ * this so operations can be chained without nesting function calls.
214
+ *
215
+ * **Example** (Chaining operations with pipe)
216
+ *
217
+ * ```ts import.meta.vitest
218
+ * import { Effect } from "effect"
219
+ *
220
+ * // The Pipeable interface allows Effect values to be chained using the pipe method
221
+ * const program = Effect.succeed(1).pipe(
222
+ * Effect.map((x) => x + 1),
223
+ * Effect.flatMap((x) => Effect.succeed(x * 2))
224
+ * )
225
+ *
226
+ * Effect.runSync(program) // => 4
227
+ * ```
228
+ *
229
+ * @stability stable
230
+ * @category models
231
+ * @since 2.0.0
232
+ */
233
+ interface Pipeable {
234
+ pipe<A>(this: A): A;
235
+ pipe<A, B = never>(this: A, ab: (_: A) => B): B;
236
+ pipe<A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C;
237
+ pipe<A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D;
238
+ pipe<A, B = never, C = never, D = never, E = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E): E;
239
+ pipe<A, B = never, C = never, D = never, E = never, F = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F): F;
240
+ pipe<A, B = never, C = never, D = never, E = never, F = never, G = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G): G;
241
+ pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H): H;
242
+ pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I): I;
243
+ pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J): J;
244
+ pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K): K;
245
+ pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L): L;
246
+ pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M): M;
247
+ pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N): N;
248
+ pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O): O;
249
+ pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P): P;
250
+ pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P, pq: (_: P) => Q): Q;
251
+ pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P, pq: (_: P) => Q, qr: (_: Q) => R): R;
252
+ pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R = never, S = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P, pq: (_: P) => Q, qr: (_: Q) => R, rs: (_: R) => S): S;
253
+ pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R = never, S = never, T = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P, pq: (_: P) => Q, qr: (_: Q) => R, rs: (_: R) => S, st: (_: S) => T): T;
254
+ pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R = never, S = never, T = never, U = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P, pq: (_: P) => Q, qr: (_: Q) => R, rs: (_: R) => S, st: (_: S) => T, tu: (_: T) => U): U;
255
+ pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R = never, S = never, T = never, U = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P, pq: (_: P) => Q, qr: (_: Q) => R, rs: (_: R) => S, st: (_: S) => T, tu: (_: T) => U): U;
256
+ }
257
+ /**
258
+ * Defines Effect's type-level unification protocol.
259
+ *
260
+ * Unification collapses unions of protocol-enabled values into their public data
261
+ * types. It is mostly for maintainers of Effect data types and advanced library
262
+ * authors; application code usually benefits from it through APIs such as
263
+ * `Effect`, `Option`, `Result`, `Stream`, `Layer`, and `Match`. This module
264
+ * exports the protocol symbols, the `Unify` type that performs normalization,
265
+ * and `unify`, an identity function that changes only the inferred type.
266
+ *
267
+ * @stability stable
268
+ * @since 2.0.0
269
+ */
270
+ /**
271
+ * Defines the unique symbol used to identify unification behavior in Effect types.
272
+ *
273
+ * **When to use**
274
+ *
275
+ * Use to define the widened type produced by the `Unify` protocol for a custom
276
+ * protocol-enabled data type.
277
+ *
278
+ * **Details**
279
+ *
280
+ * This symbol is a type-level protocol key. It describes how a protocol-enabled
281
+ * type widens during unification and has no runtime behavior.
282
+ *
283
+ * @see {@link typeSymbol} for storing the source type information used during unification
284
+ * @see {@link ignoreSymbol} for excluding protocol entries from unification
285
+ *
286
+ * @stability stable
287
+ * @category symbols
288
+ * @since 2.0.0
289
+ */
290
+ declare const unifySymbol: unique symbol;
291
+ /**
292
+ * The type of the unifySymbol.
293
+ *
294
+ * **When to use**
295
+ *
296
+ * Use to reference the unification behavior property key in type-level
297
+ * protocol definitions.
298
+ *
299
+ * **Details**
300
+ *
301
+ * This type represents the unique symbol used for identifying unification
302
+ * behavior in Effect types. It's typically used in type-level operations
303
+ * to enable automatic type unification.
304
+ *
305
+ * @stability stable
306
+ * @category symbols
307
+ * @since 2.0.0
308
+ */
309
+ type unifySymbol = typeof unifySymbol;
310
+ /**
311
+ * Defines the unique symbol used to identify the type information for unification.
312
+ *
313
+ * **When to use**
314
+ *
315
+ * Use when you need a type-level protocol key that exposes the source type
316
+ * read by `Unify` from a protocol-enabled data type.
317
+ *
318
+ * **Details**
319
+ *
320
+ * This symbol is a type-level protocol key. It stores the source type that
321
+ * unification reads when widening protocol-enabled values.
322
+ *
323
+ * @see {@link unifySymbol} for defining how protocol entries widen
324
+ *
325
+ * @stability stable
326
+ * @category symbols
327
+ * @since 2.0.0
328
+ */
329
+ declare const typeSymbol: unique symbol;
330
+ /**
331
+ * The type of the typeSymbol.
332
+ *
333
+ * **When to use**
334
+ *
335
+ * Use to reference the type information property key in type-level protocol
336
+ * definitions.
337
+ *
338
+ * **Details**
339
+ *
340
+ * This type represents the unique symbol used for storing type information
341
+ * in types that support unification. It's used in type-level operations
342
+ * to access and manipulate type information.
343
+ *
344
+ * @stability stable
345
+ * @category symbols
346
+ * @since 2.0.0
347
+ */
348
+ type typeSymbol = typeof typeSymbol;
349
+ /**
350
+ * Defines the unique symbol used to specify types that should be ignored during unification.
351
+ *
352
+ * **When to use**
353
+ *
354
+ * Use to hide helper protocol entries from `Unify` when they should not
355
+ * contribute to the widened type.
356
+ *
357
+ * **Details**
358
+ *
359
+ * This symbol is a type-level protocol key. It lists protocol entries that
360
+ * unification should ignore when computing the widened type.
361
+ *
362
+ * @see {@link unifySymbol} for defining the protocol entries being filtered
363
+ *
364
+ * @stability stable
365
+ * @category symbols
366
+ * @since 2.0.0
367
+ */
368
+ declare const ignoreSymbol: unique symbol;
369
+ /**
370
+ * The type of the ignoreSymbol.
371
+ *
372
+ * **When to use**
373
+ *
374
+ * Use to reference the ignored-property key in type-level protocol
375
+ * definitions.
376
+ *
377
+ * **Details**
378
+ *
379
+ * This type represents the unique symbol used for marking types that should
380
+ * be ignored during unification operations. It's used in type-level operations
381
+ * to exclude specific types from the unification process.
382
+ *
383
+ * @stability stable
384
+ * @category symbols
385
+ * @since 2.0.0
386
+ */
387
+ type ignoreSymbol = typeof ignoreSymbol;
388
+ declare const TypeId = "~effect/Option";
389
+ /**
390
+ * The `Option` data type represents optional values. An `Option<A>` is either
391
+ * `Some<A>`, containing a value of type `A`, or `None`, representing absence.
392
+ *
393
+ * **When to use**
394
+ *
395
+ * Use to represent initial values that may not yet exist
396
+ * - Returning from partial functions (not defined for all inputs)
397
+ * - Managing optional fields in data structures
398
+ *
399
+ * @see {@link some} for creating a `Some`
400
+ * @see {@link none} for creating a `None`
401
+ * @see {@link match} for pattern matching
402
+ *
403
+ * @stability stable
404
+ * @category models
405
+ * @since 2.0.0
406
+ */
407
+ type Option<A> = None<A> | Some<A>;
408
+ /**
409
+ * Represents the absence of a value within an {@link Option}.
410
+ *
411
+ * **When to use**
412
+ *
413
+ * Use as a type guard target when narrowing via {@link isNone}
414
+ *
415
+ * **Details**
416
+ *
417
+ * - `_tag` is always `"None"`
418
+ * - Implements `Pipeable`, `Inspectable`, and structural equality
419
+ *
420
+ * @see {@link isNone} to check if an `Option` is `None`
421
+ * @see {@link none} to construct a `None`
422
+ *
423
+ * @stability stable
424
+ * @category models
425
+ * @since 2.0.0
426
+ */
427
+ interface None<out A> extends Pipeable, Inspectable {
428
+ readonly _tag: "None";
429
+ readonly _op: "None";
430
+ readonly valueOrUndefined: undefined;
431
+ readonly [TypeId]: {
432
+ readonly _A: Covariant<A>;
433
+ };
434
+ [Symbol.iterator](): OptionIterator<Option<A>>;
435
+ [typeSymbol]?: unknown;
436
+ [unifySymbol]?: OptionUnify<this>;
437
+ [ignoreSymbol]?: OptionUnifyIgnore;
438
+ }
439
+ /**
440
+ * Iterator protocol used to yield an `Option` inside {@link gen}, returning the
441
+ * contained value type back to the generator.
442
+ *
443
+ * **When to use**
444
+ *
445
+ * Use when defining or typing `[Symbol.iterator]()` for `Option` values so
446
+ * `yield*` can pass the contained value type back into `Option.gen`.
447
+ *
448
+ * @see {@link gen} for writing generator-based `Option` code that consumes this iterator protocol
449
+ *
450
+ * @stability stable
451
+ * @category generators
452
+ * @since 4.0.0
453
+ */
454
+ interface OptionIterator<T extends Option<any>> {
455
+ next(...args: ReadonlyArray<any>): IteratorResult<T, Option.Value<T>>;
456
+ }
457
+ /**
458
+ * Represents the presence of a value within an {@link Option}.
459
+ *
460
+ * **When to use**
461
+ *
462
+ * Use as a type guard target when narrowing via {@link isSome}
463
+ * - Access the inner value via `.value`
464
+ *
465
+ * **Details**
466
+ *
467
+ * - `_tag` is always `"Some"`
468
+ * - `.value` holds the contained value of type `A`
469
+ * - Implements `Pipeable`, `Inspectable`, and structural equality
470
+ *
471
+ * @see {@link isSome} to check if an `Option` is `Some`
472
+ * @see {@link some} to construct a `Some`
473
+ *
474
+ * @stability stable
475
+ * @category models
476
+ * @since 2.0.0
477
+ */
478
+ interface Some<out A> extends Pipeable, Inspectable {
479
+ readonly _tag: "Some";
480
+ readonly _op: "Some";
481
+ readonly value: A;
482
+ readonly valueOrUndefined: A;
483
+ readonly [TypeId]: {
484
+ readonly _A: Covariant<A>;
485
+ };
486
+ [Symbol.iterator](): OptionIterator<Option<A>>;
487
+ [typeSymbol]?: unknown;
488
+ [unifySymbol]?: OptionUnify<this>;
489
+ [ignoreSymbol]?: OptionUnifyIgnore;
490
+ }
491
+ /**
492
+ * Type-level unification support for `Option` values.
493
+ *
494
+ * **When to use**
495
+ *
496
+ * Use when extending Effect's type-level unification support for `Option`.
497
+ *
498
+ * **Details**
499
+ *
500
+ * This is used by Effect's `Unify` machinery to preserve the contained value
501
+ * type when generic code returns or combines `Option` values. Users normally
502
+ * do not need to reference this interface directly.
503
+ *
504
+ * @stability stable
505
+ * @category models
506
+ * @since 2.0.0
507
+ */
508
+ interface OptionUnify<A extends {
509
+ [typeSymbol]?: any;
510
+ }> {
511
+ Option?: () => A[typeSymbol] extends Option<infer A0> | (infer _) ? Option<A0> : never;
512
+ }
513
+ /**
514
+ * Namespace containing utility types for `Option`.
515
+ *
516
+ * **When to use**
517
+ *
518
+ * Use to access type-level helpers associated with `Option`.
519
+ *
520
+ * @stability stable
521
+ * @since 2.0.0
522
+ */
523
+ declare namespace Option {
524
+ /**
525
+ * Extracts the type of the value contained in an `Option`.
526
+ *
527
+ * **When to use**
528
+ *
529
+ * Use to infer the inner value type from an existing `Option` type.
530
+ *
531
+ * **Example** (Extracting the value type)
532
+ *
533
+ * ```ts import.meta.vitest
534
+ * import { Option } from "effect"
535
+ *
536
+ * const myOption: Option.Option<string> = Option.some("value")
537
+ * type MyType = Option.Option.Value<typeof myOption>
538
+ *
539
+ * const witness: MyType = "value"
540
+ * ```
541
+ *
542
+ * @category utility types
543
+ * @since 2.0.0
544
+ */
545
+ type Value<T extends Option<any>> = [T] extends [Option<infer _A>] ? _A : never;
546
+ }
547
+ /**
548
+ * Marker interface used by Effect's `Unify` machinery for `Option` values.
549
+ *
550
+ * **When to use**
551
+ *
552
+ * Use when marking generic code so `Option` unification should be ignored.
553
+ *
554
+ * **Details**
555
+ *
556
+ * This supports type-level unification behavior for `Option`. Users normally
557
+ * do not need to reference this interface directly.
558
+ *
559
+ * @stability stable
560
+ * @category models
561
+ * @since 2.0.0
562
+ */
563
+ interface OptionUnifyIgnore {}
564
+ export declare const isRecord: <I>(input: I) => input is I & {
565
+ readonly [x: string]: unknown;
566
+ };
567
+ export declare const parseJson: (text: string) => Option<unknown>;
568
+ export {};
569
+ //# sourceMappingURL=index.d.mts.map