@imenam/mcp-organizer 1.0.35 → 1.0.37
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/README.md +5 -5
- package/dist/shared/schemas/broadcast-api.schema.d.ts +127 -0
- package/dist/shared/schemas/broadcast-api.schema.js +68 -0
- package/dist/src/core/broadcast.d.ts +40 -0
- package/dist/src/core/broadcast.js +92 -0
- package/dist/src/core/mail-render.d.ts +5 -0
- package/dist/src/core/mail-render.js +4 -0
- package/dist/src/core/mail.d.ts +2 -0
- package/dist/src/core/mail.js +5 -3
- package/dist/src/core/migrations.js +14 -0
- package/dist/src/core/store.d.ts +5 -0
- package/dist/src/core/store.js +26 -0
- package/dist/src/gui-api.js +32 -0
- package/gui/dist/assets/{index-BuYH_-i4.css → index-CB0X_FZW.css} +1 -1
- package/gui/dist/assets/index-xC5hAFk-.js +122 -0
- package/gui/dist/index.html +2 -2
- package/package.json +1 -1
- package/gui/dist/assets/index-B6cGTeVR.js +0 -106
package/dist/src/gui-api.js
CHANGED
|
@@ -31,6 +31,8 @@ import { getRunnerSettings, listAdminSpaces, processQueueNow, requireAdmin, runn
|
|
|
31
31
|
import { RunnerSettingsSchema, RunnerUsageQuerySchema, SaveClaudeTokenRequestSchema, SetRunnerAllowedRequestSchema } from "../shared/schemas/admin-api.schema.js";
|
|
32
32
|
import { getSiteInstructions, getSpaceInstructions, setSiteInstructions, setSpaceInstructions } from "./core/agent-instructions.js";
|
|
33
33
|
import { SetAgentInstructionsRequestSchema } from "../shared/schemas/instructions-api.schema.js";
|
|
34
|
+
import { broadcastOverview, previewBroadcast, sendBroadcast, sendBroadcastTest } from "./core/broadcast.js";
|
|
35
|
+
import { BroadcastDraftSchema } from "../shared/schemas/broadcast-api.schema.js";
|
|
34
36
|
import { confirmPasswordReset, passwordResetBlocker, requestPasswordReset } from "./core/password-reset.js";
|
|
35
37
|
import { TranscriptionError } from "./core/transcription.js";
|
|
36
38
|
import { MAX_TRANSCRIPTION_BYTES, TranscribeRequestSchema } from "../shared/schemas/transcription-api.schema.js";
|
|
@@ -522,6 +524,36 @@ route("GET", "/admin/agent-instructions", (ctx, { user }) => ({ body: getSiteIns
|
|
|
522
524
|
route("PUT", "/admin/agent-instructions", (ctx, { user, request }) => ({
|
|
523
525
|
body: setSiteInstructions(ctx.store, user.id, parseBody(SetAgentInstructionsRequestSchema, request.body).text),
|
|
524
526
|
}));
|
|
527
|
+
// --- E-mail aux utilisateurs ------------------------------------------------------
|
|
528
|
+
/** Dépendances de l'e-mail aux utilisateurs, tirées du contexte. */
|
|
529
|
+
function broadcastDeps(ctx) {
|
|
530
|
+
return { mailer: ctx.mailer, publicUrl: ctx.publicUrl, now: () => now(ctx) };
|
|
531
|
+
}
|
|
532
|
+
/** L'envoi d'e-mail est configuré ; sinon, erreur 503 avec ce qu'il faut configurer. */
|
|
533
|
+
function requireMailer(ctx) {
|
|
534
|
+
if (!ctx.mailer.enabled)
|
|
535
|
+
throw new ApiError("unavailable", ctx.mailer.disabledReason ?? "Envoi d'e-mail désactivé.");
|
|
536
|
+
}
|
|
537
|
+
route("GET", "/admin/broadcasts", (ctx, { user }) => ({ body: broadcastOverview(ctx.store, user.id, ctx.mailer) }));
|
|
538
|
+
route("POST", "/admin/broadcasts/preview", (ctx, { user, request }) => ({
|
|
539
|
+
body: previewBroadcast(ctx.store, user.id, parseBody(BroadcastDraftSchema, request.body), broadcastDeps(ctx)),
|
|
540
|
+
}));
|
|
541
|
+
route("POST", "/admin/broadcasts/test", async (ctx, { user, request }) => {
|
|
542
|
+
requireAdmin(ctx.store, user.id);
|
|
543
|
+
const draft = parseBody(BroadcastDraftSchema, request.body);
|
|
544
|
+
requireMailer(ctx);
|
|
545
|
+
const { to, outcome } = await sendBroadcastTest(ctx.store, user.id, draft, broadcastDeps(ctx));
|
|
546
|
+
if (!outcome.sent)
|
|
547
|
+
throw new ApiError("upstream", outcome.reason);
|
|
548
|
+
const body = { to };
|
|
549
|
+
return { body };
|
|
550
|
+
});
|
|
551
|
+
route("POST", "/admin/broadcasts", async (ctx, { user, request }) => {
|
|
552
|
+
requireAdmin(ctx.store, user.id);
|
|
553
|
+
const draft = parseBody(BroadcastDraftSchema, request.body);
|
|
554
|
+
requireMailer(ctx);
|
|
555
|
+
return { body: await sendBroadcast(ctx.store, user.id, draft, broadcastDeps(ctx)) };
|
|
556
|
+
});
|
|
525
557
|
// --- Dictée ------------------------------------------------------------------------
|
|
526
558
|
route("POST", "/transcribe", async (ctx, { request }) => {
|
|
527
559
|
const input = parseBody(TranscribeRequestSchema, request.body);
|