You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 86368fa
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(server): follow the Effect service rules in plugin notifications
PluginNotifications reaches the plugin supervisor through its module
namespace and builds each PluginHostCallError where the call fails, without
a forwarding helper or a shared stopped error.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
message: `The plugin did not declare the "${PLUGIN_NOTIFICATIONS_CAPABILITY}" capability.`,
166
+
});
174
167
constrequest=yield*decodeShowInput(input).pipe(
175
-
Effect.mapError(()=>
176
-
hostError(
177
-
`A notification needs a title string; body is a string; threadId is a string of at most ${PLUGIN_NOTIFICATION_LIMITS.threadIdMaxLength} characters; tone is neutral, info, success, warning or error.`,
178
-
),
168
+
Effect.mapError(
169
+
()=>
170
+
newPluginSupervisor.PluginHostCallError({
171
+
message: `A notification needs a title string; body is a string; threadId is a string of at most ${PLUGIN_NOTIFICATION_LIMITS.threadIdMaxLength} characters; tone is neutral, info, success, warning or error.`,
172
+
}),
179
173
),
180
174
);
181
175
consttitle=normalizeContributionStatusText(
182
176
request.title,
183
177
PLUGIN_NOTIFICATION_TITLE_MAX_LENGTH,
184
178
);
185
-
if(title.length===0)returnyield*hostError("The notification title is empty.");
message: `The notification is too large: at most ${PLUGIN_NOTIFICATION_MAX_ENCODED_BYTES} bytes encoded.`,
203
+
});
207
204
constgeneration=yield*generationOf(lifetime);
208
205
if(!(yield*generation.bucket.take))
209
-
returnyield*hostError(
210
-
`Too many notifications: at most ${PLUGIN_NOTIFICATION_LIMITS.burst} at once, then one every ${PLUGIN_NOTIFICATION_LIMITS.refillMillis/1000} seconds.`,
message: `Too many notifications: at most ${PLUGIN_NOTIFICATION_LIMITS.burst} at once, then one every ${PLUGIN_NOTIFICATION_LIMITS.refillMillis/1000} seconds.`,
208
+
});
212
209
returnyield*lock.withPermit(
213
210
Effect.gen(function*(){
214
211
// Checked under the lock, so a withdrawal never misses a notification it races.
0 commit comments