@voltro/plugin-moderation 0.83.1 → 0.85.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.
@@ -5,7 +5,7 @@ property of its respective copyright holders and is used under the terms of
5
5
  its license. This file is provided for attribution; it grants no rights in
6
6
  @voltro/plugin-moderation itself, which is proprietary (see LICENSE).
7
7
 
8
- Generated from the resolved runtime dependency closure (37 packages).
8
+ Generated from the resolved runtime dependency closure (32 packages).
9
9
 
10
10
  ---
11
11
 
@@ -75,118 +75,6 @@ License: Apache-2.0
75
75
 
76
76
  _(no bundled license text found in the package; see its npm page.)_
77
77
 
78
- ## @effect/cluster@0.60.2
79
-
80
- License: MIT
81
-
82
- ```
83
- MIT License
84
-
85
- Copyright (c) 2023-present The Contributors
86
-
87
- Permission is hereby granted, free of charge, to any person obtaining a copy
88
- of this software and associated documentation files (the "Software"), to deal
89
- in the Software without restriction, including without limitation the rights
90
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
91
- copies of the Software, and to permit persons to whom the Software is
92
- furnished to do so, subject to the following conditions:
93
-
94
- The above copyright notice and this permission notice shall be included in all
95
- copies or substantial portions of the Software.
96
-
97
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
98
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
99
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
100
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
101
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
102
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
103
- SOFTWARE.
104
- ```
105
-
106
- ## @effect/experimental@0.61.1
107
-
108
- License: MIT
109
-
110
- ```
111
- MIT License
112
-
113
- Copyright (c) 2023-present The Contributors
114
-
115
- Permission is hereby granted, free of charge, to any person obtaining a copy
116
- of this software and associated documentation files (the "Software"), to deal
117
- in the Software without restriction, including without limitation the rights
118
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
119
- copies of the Software, and to permit persons to whom the Software is
120
- furnished to do so, subject to the following conditions:
121
-
122
- The above copyright notice and this permission notice shall be included in all
123
- copies or substantial portions of the Software.
124
-
125
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
126
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
127
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
128
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
129
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
130
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
131
- SOFTWARE.
132
- ```
133
-
134
- ## @effect/sql@0.52.1
135
-
136
- License: MIT
137
-
138
- ```
139
- MIT License
140
-
141
- Copyright (c) 2023-present The Contributors
142
-
143
- Permission is hereby granted, free of charge, to any person obtaining a copy
144
- of this software and associated documentation files (the "Software"), to deal
145
- in the Software without restriction, including without limitation the rights
146
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
147
- copies of the Software, and to permit persons to whom the Software is
148
- furnished to do so, subject to the following conditions:
149
-
150
- The above copyright notice and this permission notice shall be included in all
151
- copies or substantial portions of the Software.
152
-
153
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
154
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
155
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
156
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
157
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
158
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
159
- SOFTWARE.
160
- ```
161
-
162
- ## @effect/workflow@0.19.1
163
-
164
- License: MIT
165
-
166
- ```
167
- MIT License
168
-
169
- Copyright (c) 2023-present The Contributors
170
-
171
- Permission is hereby granted, free of charge, to any person obtaining a copy
172
- of this software and associated documentation files (the "Software"), to deal
173
- in the Software without restriction, including without limitation the rights
174
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
175
- copies of the Software, and to permit persons to whom the Software is
176
- furnished to do so, subject to the following conditions:
177
-
178
- The above copyright notice and this permission notice shall be included in all
179
- copies or substantial portions of the Software.
180
-
181
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
182
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
183
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
184
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
185
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
186
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
187
- SOFTWARE.
188
- ```
189
-
190
78
  ## @ioredis/commands@1.10.0
191
79
 
192
80
  License: MIT
@@ -971,12 +859,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
971
859
  SOFTWARE.
972
860
  ```
973
861
 
974
- ## kubernetes-types@1.30.0
975
-
976
- License: Apache-2.0
977
-
978
- _(no bundled license text found in the package; see its npm page.)_
979
-
980
862
  ## layerr@3.0.0
981
863
 
982
864
  License: MIT
package/dist/errors.d.ts CHANGED
@@ -1,18 +1,17 @@
1
1
  import { Schema } from 'effect';
2
+ import { YieldableError } from 'effect/Cause';
2
3
 
3
4
  /** Raised when a `block`-action rule flags the content — the write never
4
5
  * commits. Merged into every procedure's wire-error union (typed on the client). */
5
6
  export declare class ContentRejected extends ContentRejected_base {
6
7
  }
7
8
 
8
- declare const ContentRejected_base: Schema.TaggedErrorClass<ContentRejected, "ContentRejected", {
9
- readonly _tag: Schema.tag<"ContentRejected">;
10
- } & {
9
+ declare const ContentRejected_base: Schema.Class<ContentRejected, Schema.TaggedStruct<"ContentRejected", {
11
10
  /** The rpc tag that was moderated. */
12
- tag: typeof Schema.String;
11
+ readonly tag: Schema.String;
13
12
  /** Matched categories / keywords. */
14
- categories: Schema.Array$<typeof Schema.String>;
15
- reason: typeof Schema.String;
16
- }>;
13
+ readonly categories: Schema.$Array<Schema.String>;
14
+ readonly reason: Schema.String;
15
+ }>, YieldableError>;
17
16
 
18
17
  export { }
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { Effect } from 'effect';
3
3
  import { generateObject } from '@voltro/ai';
4
4
  import { Schema } from 'effect';
5
5
  import { VoltroPlugin } from '@voltro/protocol';
6
+ import { YieldableError } from 'effect/Cause';
6
7
 
7
8
  /** AI moderation via @voltro/ai (lazy, OPTIONAL dependency). Uses a structured
8
9
  * classification. `threshold` (0..1) decides flagged from the model's max
@@ -33,15 +34,13 @@ declare interface AiProviderOptions {
33
34
  export declare class ContentRejected extends ContentRejected_base {
34
35
  }
35
36
 
36
- declare const ContentRejected_base: Schema.TaggedErrorClass<ContentRejected, "ContentRejected", {
37
- readonly _tag: Schema.tag<"ContentRejected">;
38
- } & {
37
+ declare const ContentRejected_base: Schema.Class<ContentRejected, Schema.TaggedStruct<"ContentRejected", {
39
38
  /** The rpc tag that was moderated. */
40
- tag: typeof Schema.String;
39
+ readonly tag: Schema.String;
41
40
  /** Matched categories / keywords. */
42
- categories: Schema.Array$<typeof Schema.String>;
43
- reason: typeof Schema.String;
44
- }>;
41
+ readonly categories: Schema.$Array<Schema.String>;
42
+ readonly reason: Schema.String;
43
+ }>, YieldableError>;
45
44
 
46
45
  /** A flagged-content item awaiting review (the dashboard queue). */
47
46
  export declare interface FlaggedItem {
@@ -107,14 +106,14 @@ export declare interface ModerationRule {
107
106
  readonly action?: 'block' | 'flag';
108
107
  }
109
108
 
110
- /** `Context.Tag` for the moderation service — `yield* ModerationService` in any
109
+ /** `Context.Service` for the moderation service — `yield* ModerationService` in any
111
110
  * handler once `moderationPlugin(...)` is wired. The handler depends on the
112
111
  * Tag; the plugin owns the provider-backed implementation (no module-level
113
112
  * global). Mirrors `@voltro/plugin-mail`'s `MailService`. */
114
113
  export declare class ModerationService extends ModerationService_base {
115
114
  }
116
115
 
117
- declare const ModerationService_base: Context.TagClass<ModerationService, "@voltro/plugin-moderation/ModerationService", ModerationServiceShape>;
116
+ declare const ModerationService_base: Context.ServiceClass<ModerationService, "@voltro/plugin-moderation/ModerationService", ModerationServiceShape>;
118
117
 
119
118
  /** The moderation runtime surface a handler reads to classify arbitrary text.
120
119
  * Backed by the configured provider; contributed once per app by
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ var s = o({ scope: "@voltro/plugin-moderation" }), c = { flagged: !1 }, l = /[.*
29
29
  "illicit"
30
30
  ], i = e.load ?? (() => import("@voltro/ai")), a = !1;
31
31
  return (e) => n.gen(function* () {
32
- let o = yield* n.tryPromise(i).pipe(n.catchAll(() => n.succeed(null)));
32
+ let o = yield* n.tryPromise(i).pipe(n.catch(() => n.succeed(null)));
33
33
  return o === null ? (a || (a = !0, s.warn("aiProvider configured but @voltro/ai could not be loaded — content is NOT being moderated; install @voltro/ai")), c) : yield* n.tryPromise(async () => {
34
34
  let { Schema: i } = await import("effect"), a = i.Struct({
35
35
  flagged: i.Boolean,
@@ -46,9 +46,9 @@ var s = o({ scope: "@voltro/plugin-moderation" }), c = { flagged: !1 }, l = /[.*
46
46
  ...s.topCategory ? { categories: [s.topCategory] } : {},
47
47
  ...c ? { reason: `ai moderation: ${s.topCategory ?? "policy"} (${s.score.toFixed(2)})` } : {}
48
48
  };
49
- }).pipe(n.catchAll(() => n.succeed(c)));
49
+ }).pipe(n.catch(() => n.succeed(c)));
50
50
  });
51
- }, p = class extends t.Tag("@voltro/plugin-moderation/ModerationService")() {}, m = (e) => n.flatMap(p, (t) => t.moderate(e)), h = (e, t) => {
51
+ }, p = class extends t.Service()("@voltro/plugin-moderation/ModerationService") {}, m = (e) => n.flatMap(p, (t) => t.moderate(e)), h = (e, t) => {
52
52
  if (typeof e != "object" || !e) return "";
53
53
  let n = e;
54
54
  return t.map((e) => n[e]).filter((e) => typeof e == "string").join("\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltro/plugin-moderation",
3
- "version": "0.83.1",
3
+ "version": "0.85.0",
4
4
  "description": "Content moderation — run an AI / keyword / custom check on user-content fields and block or flag a write before it commits. Declarative per-rpc rules + an in-handler moderate() helper for redact/inline control.",
5
5
  "keywords": [
6
6
  "voltro",
@@ -38,14 +38,14 @@
38
38
  "node": ">=24.0.0"
39
39
  },
40
40
  "dependencies": {
41
- "@voltro/logger": "0.83.1",
42
- "@voltro/protocol": "0.83.1"
41
+ "@voltro/logger": "0.85.0",
42
+ "@voltro/protocol": "0.85.0"
43
43
  },
44
44
  "optionalDependencies": {
45
- "@voltro/ai": "0.83.1"
45
+ "@voltro/ai": "0.85.0"
46
46
  },
47
47
  "peerDependencies": {
48
- "effect": "^3.22.2"
48
+ "effect": "4.0.1"
49
49
  },
50
50
  "publishConfig": {
51
51
  "access": "public"