@mosadd/mcp 3.0.0-alpha.46 → 3.0.0-alpha.48

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.
@@ -1,99 +1,99 @@
1
- /**
2
- * mTALK_ingest_ptt — submit a recorded PTT "over" for transcription + RAG ingest.
3
- *
4
- * The actual mIRC/mDM voice-message PERSISTENCE (writing a message_meta row,
5
- * fanning it out to listeners) is owned by the message-send/send-voice path,
6
- * NOT by this tool. ptt-ingest exists purely to bridge a finished PTT segment
7
- * into the user's RAG index — a row in `ptt_transcripts` (status='pending')
8
- * + a transcribe job that lands in `user_embeddings(source_type='ptt')`.
9
- *
10
- * Use this when an agent has a PTT audio buffer it wants searchable in the
11
- * user's RAG later (e.g. "what did Alice tell me on PTT yesterday?"). The
12
- * voice message itself is sent separately via mDM_send_voice / mIRC_send_voice.
13
- *
14
- * Auth: standard Supabase session JWT (the caller's RAG opt-in is read from
15
- * their account; opted-out callers get status='skipped_optout').
16
- * LINEAR-3998 (P4.1 PTT unify) — re-arch 2026-06-27.
17
- */
18
- import { z } from "zod";
19
- import type { MosaddTool, MosaddToolContext } from "../types.js";
20
- import { invokeFunction, readSupabaseEnv } from "../providers/supabase.js";
21
-
22
- const mTALK_ingest_ptt_input = z.object({
23
- audio_base64: z
24
- .string()
25
- .min(1)
26
- .max(20_000_000)
27
- .describe("Recorded PTT 'over' as base64 (a 'data:audio/…;base64,…' prefix is stripped if present)."),
28
- mime_type: z
29
- .string()
30
- .min(1)
31
- .max(120)
32
- .default("audio/webm")
33
- .describe("MIME type of the audio. Default audio/webm (browser MediaRecorder default)."),
34
- direction: z
35
- .enum(["human_to_agent", "agent_to_human"])
36
- .describe("Direction the PTT crossed: who originated, who received. 'human_to_agent' = user spoke to an agent; 'agent_to_human' = agent spoke to the user."),
37
- message_id: z
38
- .string()
39
- .min(1)
40
- .max(120)
41
- .optional()
42
- .describe("Optional id of the messages_meta row this PTT belongs to. When present, links the transcript back to the message for jump-to-source from RAG."),
43
- thread_id: z
44
- .string()
45
- .min(1)
46
- .max(120)
47
- .optional()
48
- .describe("Optional thread id (e.g. `chat:<channel_id>` or `dm:<a>:<b>`) so the transcript carries its conversational scope into RAG."),
49
- });
50
-
51
- interface PttIngestResponse {
52
- ptt_id?: string;
53
- status?: "pending" | "skipped_optout" | "queued";
54
- enqueued?: boolean;
55
- }
56
-
57
- async function mTALK_ingest_ptt(
58
- input: z.infer<typeof mTALK_ingest_ptt_input>,
59
- ctx: MosaddToolContext,
60
- ): Promise<{ ptt_id: string; status: string; opted_in: boolean }> {
61
- readSupabaseEnv();
62
-
63
- // Tolerate a "data:audio/…;base64,…" prefix from MediaRecorder/canvas captures.
64
- const audio = input.audio_base64.replace(/^data:[^;]+;base64,/, "");
65
-
66
- ctx.log("debug", "mTALK_ingest_ptt invoking ptt-ingest", {
67
- direction: input.direction,
68
- thread_id: input.thread_id ?? null,
69
- mime_type: input.mime_type,
70
- });
71
-
72
- const res = await invokeFunction<PttIngestResponse>("ptt-ingest", {
73
- audio_base64: audio,
74
- mime_type: input.mime_type,
75
- direction: input.direction,
76
- message_id: input.message_id ?? null,
77
- thread_id: input.thread_id ?? null,
78
- });
79
-
80
- const status = res.status ?? "pending";
81
- return {
82
- ptt_id: res.ptt_id ?? "",
83
- status,
84
- opted_in: status !== "skipped_optout",
85
- };
86
- }
87
-
88
- export const pttIngestTools: MosaddTool[] = [
89
- {
90
- name: "mTALK_ingest_ptt",
91
- title: "Transcribe PTT audio into memory",
92
- annotations: { readOnlyHint: false },
93
- requires: "network",
94
- description:
95
- "Submit a finished PTT 'over' (push-to-talk audio segment) for transcription into the caller's RAG index — so 'what did X say on PTT?' is searchable later. The PERSISTENCE of the voice message itself (the message_meta row + fan-out) is handled by mDM_send_voice / mIRC_send_voice; this tool is the transcription bridge only. Honors per-user RAG opt-in: opted-out callers get status='skipped_optout' (no transcript stored). Auth: Supabase session JWT.",
96
- inputSchema: mTALK_ingest_ptt_input,
97
- handler: mTALK_ingest_ptt as MosaddTool["handler"],
98
- },
99
- ];
1
+ /**
2
+ * mTALK_ingest_ptt — submit a recorded PTT "over" for transcription + RAG ingest.
3
+ *
4
+ * The actual mIRC/mDM voice-message PERSISTENCE (writing a message_meta row,
5
+ * fanning it out to listeners) is owned by the message-send/send-voice path,
6
+ * NOT by this tool. ptt-ingest exists purely to bridge a finished PTT segment
7
+ * into the user's RAG index — a row in `ptt_transcripts` (status='pending')
8
+ * + a transcribe job that lands in `user_embeddings(source_type='ptt')`.
9
+ *
10
+ * Use this when an agent has a PTT audio buffer it wants searchable in the
11
+ * user's RAG later (e.g. "what did Alice tell me on PTT yesterday?"). The
12
+ * voice message itself is sent separately via mDM_send_voice / mIRC_send_voice.
13
+ *
14
+ * Auth: standard Supabase session JWT (the caller's RAG opt-in is read from
15
+ * their account; opted-out callers get status='skipped_optout').
16
+ * LINEAR-3998 (P4.1 PTT unify) — re-arch 2026-06-27.
17
+ */
18
+ import { z } from "zod";
19
+ import type { MosaddTool, MosaddToolContext } from "../types.js";
20
+ import { invokeFunction, readSupabaseEnv } from "../providers/supabase.js";
21
+
22
+ const mTALK_ingest_ptt_input = z.object({
23
+ audio_base64: z
24
+ .string()
25
+ .min(1)
26
+ .max(20_000_000)
27
+ .describe("Recorded PTT 'over' as base64 (a 'data:audio/…;base64,…' prefix is stripped if present)."),
28
+ mime_type: z
29
+ .string()
30
+ .min(1)
31
+ .max(120)
32
+ .default("audio/webm")
33
+ .describe("MIME type of the audio. Default audio/webm (browser MediaRecorder default)."),
34
+ direction: z
35
+ .enum(["human_to_agent", "agent_to_human"])
36
+ .describe("Direction the PTT crossed: who originated, who received. 'human_to_agent' = user spoke to an agent; 'agent_to_human' = agent spoke to the user."),
37
+ message_id: z
38
+ .string()
39
+ .min(1)
40
+ .max(120)
41
+ .optional()
42
+ .describe("Optional id of the messages_meta row this PTT belongs to. When present, links the transcript back to the message for jump-to-source from RAG."),
43
+ thread_id: z
44
+ .string()
45
+ .min(1)
46
+ .max(120)
47
+ .optional()
48
+ .describe("Optional thread id (e.g. `chat:<channel_id>` or `dm:<a>:<b>`) so the transcript carries its conversational scope into RAG."),
49
+ });
50
+
51
+ interface PttIngestResponse {
52
+ ptt_id?: string;
53
+ status?: "pending" | "skipped_optout" | "queued";
54
+ enqueued?: boolean;
55
+ }
56
+
57
+ async function mTALK_ingest_ptt(
58
+ input: z.infer<typeof mTALK_ingest_ptt_input>,
59
+ ctx: MosaddToolContext,
60
+ ): Promise<{ ptt_id: string; status: string; opted_in: boolean }> {
61
+ readSupabaseEnv();
62
+
63
+ // Tolerate a "data:audio/…;base64,…" prefix from MediaRecorder/canvas captures.
64
+ const audio = input.audio_base64.replace(/^data:[^;]+;base64,/, "");
65
+
66
+ ctx.log("debug", "mTALK_ingest_ptt invoking ptt-ingest", {
67
+ direction: input.direction,
68
+ thread_id: input.thread_id ?? null,
69
+ mime_type: input.mime_type,
70
+ });
71
+
72
+ const res = await invokeFunction<PttIngestResponse>("ptt-ingest", {
73
+ audio_base64: audio,
74
+ mime_type: input.mime_type,
75
+ direction: input.direction,
76
+ message_id: input.message_id ?? null,
77
+ thread_id: input.thread_id ?? null,
78
+ });
79
+
80
+ const status = res.status ?? "pending";
81
+ return {
82
+ ptt_id: res.ptt_id ?? "",
83
+ status,
84
+ opted_in: status !== "skipped_optout",
85
+ };
86
+ }
87
+
88
+ export const pttIngestTools: MosaddTool[] = [
89
+ {
90
+ name: "mTALK_ingest_ptt",
91
+ title: "Transcribe PTT audio into memory",
92
+ annotations: { readOnlyHint: false },
93
+ requires: "network",
94
+ description:
95
+ "Submit a finished PTT 'over' (push-to-talk audio segment) for transcription into the caller's RAG index — so 'what did X say on PTT?' is searchable later. The PERSISTENCE of the voice message itself (the message_meta row + fan-out) is handled by mDM_send_voice / mIRC_send_voice; this tool is the transcription bridge only. Honors per-user RAG opt-in: opted-out callers get status='skipped_optout' (no transcript stored). Auth: Supabase session JWT.",
96
+ inputSchema: mTALK_ingest_ptt_input,
97
+ handler: mTALK_ingest_ptt as MosaddTool["handler"],
98
+ },
99
+ ];
@@ -1,123 +1,123 @@
1
- /**
2
- * threat_* — defensive threat-event classification, exposed as MCP tools.
3
- *
4
- * Wraps `@mosadd/threat-engine` — the canonical mosadd threat-event taxonomy
5
- * (`THREAT_EVENTS`, the full 160+ event catalog the radar scores against) plus
6
- * the pure decision engine `evaluateEvent(event) → {action, severity, reason}`.
7
- *
8
- * These tools are PURE: deterministic, side-effect-free, no backend, no network.
9
- * `requires: "any"` — they run anywhere (hosted hub, BYOK, fully offline). The
10
- * engine DECIDES; the caller carries out any recommended action against its own
11
- * backend. There is no surveillance, no data collection — it classifies an event
12
- * the caller already has and returns a defensive recommendation.
13
- *
14
- * Founder decision (LINEAR-3498): the catalog is real and must be a real MCP
15
- * tool, not detoxed away. (The AUDIT-B detox concerns the dead "anti-Pegasus"
16
- * MARKETING framing, not this classification engine.)
17
- */
18
-
19
- import { z } from "zod";
20
- import type { MosaddTool, MosaddToolContext } from "../types.js";
21
- import {
22
- THREAT_EVENTS,
23
- THREAT_EVENT_COUNT,
24
- evaluateEvent,
25
- getEventDef,
26
- type ThreatEventDef,
27
- } from "@mosadd/threat-engine";
28
-
29
- // ── threat_catalog ──
30
-
31
- const threat_catalog_input = z.object({
32
- category: z
33
- .enum(["COMINT", "ELINT", "MASINT", "CYBER", "BEHAVIORAL", "PRIVACY", "SIGINT", "OSINT", "MPOST"])
34
- .optional()
35
- .describe("Filter the catalog to one intelligence-discipline category. Omit for the full catalog."),
36
- platform: z
37
- .enum(["apk", "ios", "pwa", "harmony"])
38
- .optional()
39
- .describe("Filter to events detectable on this platform. Omit for all platforms."),
40
- });
41
-
42
- async function threat_catalog(
43
- input: z.infer<typeof threat_catalog_input>,
44
- _ctx: MosaddToolContext,
45
- ): Promise<{ count: number; total: number; events: ThreatEventDef[] }> {
46
- let events = THREAT_EVENTS;
47
- if (input.category) events = events.filter((e) => e.category === input.category);
48
- if (input.platform) events = events.filter((e) => e.platforms.includes(input.platform!));
49
- return { count: events.length, total: THREAT_EVENT_COUNT, events };
50
- }
51
-
52
- // ── threat_classify ──
53
-
54
- const threat_classify_input = z.object({
55
- event_type: z
56
- .string()
57
- .min(1)
58
- .max(120)
59
- .describe("Event type to classify, e.g. \"SIM_SWAP\", \"AUTH_BRUTEFORCE\", \"TOLL_FRAUD\". Case-insensitive."),
60
- severity: z
61
- .string()
62
- .optional()
63
- .describe("Optional producer severity hint. \"killswitch\" → lock_account; \"critical\" → revoke_sessions; anything else is informational."),
64
- details: z.string().max(2_000).optional().describe("Optional free-text context (informational only)."),
65
- });
66
-
67
- async function threat_classify(
68
- input: z.infer<typeof threat_classify_input>,
69
- _ctx: MosaddToolContext,
70
- ): Promise<{
71
- action: string;
72
- severity: string;
73
- reason: string;
74
- known_event: boolean;
75
- category: string | null;
76
- label: string | null;
77
- }> {
78
- // Known taxonomy event → surface ITS severity immediately. Pegasus-class events
79
- // (PROCESS_INJECTION, STINGRAY_DETECT, IMSI_CATCHER_SCAN, MEMORY_INJECTION, SS7_PROBE…)
80
- // classify as critical/killswitch right away. But the engine NEVER auto-acts:
81
- // action is always "monitor" — it tells you, it never disconnects, locks, or wipes.
82
- // The taxonomy's own autoActions are what a stricter host policy COULD do; we do
83
- // not execute them here ("monitoruje, nie działa").
84
- const def = getEventDef(String(input.event_type).toUpperCase());
85
- if (def) {
86
- return {
87
- action: "monitor",
88
- severity: def.severity,
89
- reason: `${def.label} (${def.category}) — classified from the mosadd threat taxonomy. Monitor-only: surfaced for you to act on, no automatic action taken.`,
90
- known_event: true,
91
- category: def.category,
92
- label: def.label,
93
- };
94
- }
95
- // Unknown event string → fall back to the pure DECK decision engine (unchanged).
96
- const decision = evaluateEvent({ eventType: input.event_type, severity: input.severity, details: input.details });
97
- return { ...decision, known_event: false, category: null, label: null };
98
- }
99
-
100
- // ── Registration ──
101
-
102
- export const threatTools: MosaddTool[] = [
103
- {
104
- name: "threat_catalog",
105
- title: "Threat taxonomy catalog",
106
- annotations: { readOnlyHint: true },
107
- requires: "any",
108
- description:
109
- "List the canonical mosadd threat-event taxonomy (the full radar catalog: id, category, default severity, auto-actions, per-platform availability). Filter by category or platform. Pure/offline — returns { count, total, events }. Use to discover what the defensive engine recognises.",
110
- inputSchema: threat_catalog_input,
111
- handler: threat_catalog as MosaddTool["handler"],
112
- },
113
- {
114
- name: "threat_classify",
115
- title: "Classify threat event",
116
- annotations: { readOnlyHint: true },
117
- requires: "any",
118
- description:
119
- "Classify a single telemetry event against the mosadd threat taxonomy + DECK engine. For a known event type (e.g. PROCESS_INJECTION, STINGRAY_DETECT, IMSI_CATCHER_SCAN, MEMORY_INJECTION) it returns that event's real severity (info|warning|elevated|critical|killswitch) with action=\"monitor\" — Pegasus-class events surface as critical immediately, but the engine NEVER auto-acts (it tells you, it never disconnects/locks). Unknown strings fall back to the pure DECK decision (log_only|revoke_sessions|lock_account|suspend_did). Returns { action, severity, reason, known_event, category, label }. Deterministic, offline, no backend.",
120
- inputSchema: threat_classify_input,
121
- handler: threat_classify as MosaddTool["handler"],
122
- },
123
- ];
1
+ /**
2
+ * threat_* — defensive threat-event classification, exposed as MCP tools.
3
+ *
4
+ * Wraps `@mosadd/threat-engine` — the canonical mosadd threat-event taxonomy
5
+ * (`THREAT_EVENTS`, the full 160+ event catalog the radar scores against) plus
6
+ * the pure decision engine `evaluateEvent(event) → {action, severity, reason}`.
7
+ *
8
+ * These tools are PURE: deterministic, side-effect-free, no backend, no network.
9
+ * `requires: "any"` — they run anywhere (hosted hub, BYOK, fully offline). The
10
+ * engine DECIDES; the caller carries out any recommended action against its own
11
+ * backend. There is no surveillance, no data collection — it classifies an event
12
+ * the caller already has and returns a defensive recommendation.
13
+ *
14
+ * Founder decision (LINEAR-3498): the catalog is real and must be a real MCP
15
+ * tool, not detoxed away. (The AUDIT-B detox concerns the dead "anti-Pegasus"
16
+ * MARKETING framing, not this classification engine.)
17
+ */
18
+
19
+ import { z } from "zod";
20
+ import type { MosaddTool, MosaddToolContext } from "../types.js";
21
+ import {
22
+ THREAT_EVENTS,
23
+ THREAT_EVENT_COUNT,
24
+ evaluateEvent,
25
+ getEventDef,
26
+ type ThreatEventDef,
27
+ } from "@mosadd/threat-engine";
28
+
29
+ // ── threat_catalog ──
30
+
31
+ const threat_catalog_input = z.object({
32
+ category: z
33
+ .enum(["COMINT", "ELINT", "MASINT", "CYBER", "BEHAVIORAL", "PRIVACY", "SIGINT", "OSINT", "MPOST"])
34
+ .optional()
35
+ .describe("Filter the catalog to one intelligence-discipline category. Omit for the full catalog."),
36
+ platform: z
37
+ .enum(["apk", "ios", "pwa", "harmony"])
38
+ .optional()
39
+ .describe("Filter to events detectable on this platform. Omit for all platforms."),
40
+ });
41
+
42
+ async function threat_catalog(
43
+ input: z.infer<typeof threat_catalog_input>,
44
+ _ctx: MosaddToolContext,
45
+ ): Promise<{ count: number; total: number; events: ThreatEventDef[] }> {
46
+ let events = THREAT_EVENTS;
47
+ if (input.category) events = events.filter((e) => e.category === input.category);
48
+ if (input.platform) events = events.filter((e) => e.platforms.includes(input.platform!));
49
+ return { count: events.length, total: THREAT_EVENT_COUNT, events };
50
+ }
51
+
52
+ // ── threat_classify ──
53
+
54
+ const threat_classify_input = z.object({
55
+ event_type: z
56
+ .string()
57
+ .min(1)
58
+ .max(120)
59
+ .describe("Event type to classify, e.g. \"SIM_SWAP\", \"AUTH_BRUTEFORCE\", \"TOLL_FRAUD\". Case-insensitive."),
60
+ severity: z
61
+ .string()
62
+ .optional()
63
+ .describe("Optional producer severity hint. \"killswitch\" → lock_account; \"critical\" → revoke_sessions; anything else is informational."),
64
+ details: z.string().max(2_000).optional().describe("Optional free-text context (informational only)."),
65
+ });
66
+
67
+ async function threat_classify(
68
+ input: z.infer<typeof threat_classify_input>,
69
+ _ctx: MosaddToolContext,
70
+ ): Promise<{
71
+ action: string;
72
+ severity: string;
73
+ reason: string;
74
+ known_event: boolean;
75
+ category: string | null;
76
+ label: string | null;
77
+ }> {
78
+ // Known taxonomy event → surface ITS severity immediately. Pegasus-class events
79
+ // (PROCESS_INJECTION, STINGRAY_DETECT, IMSI_CATCHER_SCAN, MEMORY_INJECTION, SS7_PROBE…)
80
+ // classify as critical/killswitch right away. But the engine NEVER auto-acts:
81
+ // action is always "monitor" — it tells you, it never disconnects, locks, or wipes.
82
+ // The taxonomy's own autoActions are what a stricter host policy COULD do; we do
83
+ // not execute them here ("monitoruje, nie działa").
84
+ const def = getEventDef(String(input.event_type).toUpperCase());
85
+ if (def) {
86
+ return {
87
+ action: "monitor",
88
+ severity: def.severity,
89
+ reason: `${def.label} (${def.category}) — classified from the mosadd threat taxonomy. Monitor-only: surfaced for you to act on, no automatic action taken.`,
90
+ known_event: true,
91
+ category: def.category,
92
+ label: def.label,
93
+ };
94
+ }
95
+ // Unknown event string → fall back to the pure DECK decision engine (unchanged).
96
+ const decision = evaluateEvent({ eventType: input.event_type, severity: input.severity, details: input.details });
97
+ return { ...decision, known_event: false, category: null, label: null };
98
+ }
99
+
100
+ // ── Registration ──
101
+
102
+ export const threatTools: MosaddTool[] = [
103
+ {
104
+ name: "threat_catalog",
105
+ title: "Threat taxonomy catalog",
106
+ annotations: { readOnlyHint: true },
107
+ requires: "any",
108
+ description:
109
+ "List the canonical mosadd threat-event taxonomy (the full radar catalog: id, category, default severity, auto-actions, per-platform availability). Filter by category or platform. Pure/offline — returns { count, total, events }. Use to discover what the defensive engine recognises.",
110
+ inputSchema: threat_catalog_input,
111
+ handler: threat_catalog as MosaddTool["handler"],
112
+ },
113
+ {
114
+ name: "threat_classify",
115
+ title: "Classify threat event",
116
+ annotations: { readOnlyHint: true },
117
+ requires: "any",
118
+ description:
119
+ "Classify a single telemetry event against the mosadd threat taxonomy + DECK engine. For a known event type (e.g. PROCESS_INJECTION, STINGRAY_DETECT, IMSI_CATCHER_SCAN, MEMORY_INJECTION) it returns that event's real severity (info|warning|elevated|critical|killswitch) with action=\"monitor\" — Pegasus-class events surface as critical immediately, but the engine NEVER auto-acts (it tells you, it never disconnects/locks). Unknown strings fall back to the pure DECK decision (log_only|revoke_sessions|lock_account|suspend_did). Returns { action, severity, reason, known_event, category, label }. Deterministic, offline, no backend.",
120
+ inputSchema: threat_classify_input,
121
+ handler: threat_classify as MosaddTool["handler"],
122
+ },
123
+ ];
@@ -0,0 +1,28 @@
1
+ /**
2
+ * voice-format — W4 (rozkaz Króla 16.09): głos do agenta ma czytać się jak notka,
3
+ * nie jak 500 KB base64 w polu text.
4
+ *
5
+ * Wiadomości voice/ptt (message_type "voice"/"ptt") niosą payload w kształcie
6
+ * { audio, mime, dur } (base64 webm/mp4). Do tej pory mDM_list/mIRC_list_messages
7
+ * zwracały ten surowy JSON jako text — agent widział śmieć zamiast nagrania.
8
+ * Teraz dostaje zwięzły marker z czasem trwania. Audio zostaje w payloadzie;
9
+ * kto chce odsłuchać, sięga po narzędzie głosowe (mDM_voice_note / transkrypcję).
10
+ */
11
+ export function formatVoiceIfAny(text: string): string {
12
+ try {
13
+ const obj = JSON.parse(text) as unknown;
14
+ if (
15
+ obj &&
16
+ typeof obj === "object" &&
17
+ typeof (obj as { audio?: unknown }).audio === "string" &&
18
+ (obj as { audio: string }).audio.length > 1000 &&
19
+ typeof (obj as { dur?: unknown }).dur === "number"
20
+ ) {
21
+ const s = Math.max(1, Math.round((obj as { dur: number }).dur / 1000));
22
+ return `[voice note — ${s}s]`;
23
+ }
24
+ } catch {
25
+ // nie JSON — zwykły tekst, zwróć bez zmian
26
+ }
27
+ return text;
28
+ }
package/src/version.ts CHANGED
@@ -1,8 +1,8 @@
1
- // Single source of truth for the package version at RUNTIME.
2
- // ⛔ Never hand-type the version anywhere else (server.ts carried a hardcoded
3
- // "3.0.0-alpha.32" while package.json said alpha.34 — serverInfo lied to every
4
- // connected client). tsup bundles this JSON import, so the constant always
5
- // equals the version that was actually published.
6
- import pkg from "../package.json" with { type: "json" };
7
-
8
- export const PKG_VERSION: string = (pkg as { version: string }).version;
1
+ // Single source of truth for the package version at RUNTIME.
2
+ // ⛔ Never hand-type the version anywhere else (server.ts carried a hardcoded
3
+ // "3.0.0-alpha.32" while package.json said alpha.34 — serverInfo lied to every
4
+ // connected client). tsup bundles this JSON import, so the constant always
5
+ // equals the version that was actually published.
6
+ import pkg from "../package.json" with { type: "json" };
7
+
8
+ export const PKG_VERSION: string = (pkg as { version: string }).version;