@voltro/plugin-chat 0.89.2 → 0.91.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/dist/index.js CHANGED
@@ -1,26 +1,27 @@
1
1
  import { ChatError as e, chatError as t } from "./errors.js";
2
- import { chatAdmissionsTable as n } from "./admissions.entity.js";
3
- import { chatEvidenceTable as r } from "./evidence.entity.js";
4
- import { CHAT_MAX_MESSAGE_VERSION as i, CHAT_MEDIA_SWEEP_BATCH_SIZE as a, CHAT_RETENTION_BATCH_SIZE as o, CHAT_RETENTION_RUN_BATCHES as s } from "./contract.js";
5
- import { chatMediaTable as c } from "./media.entity.js";
6
- import { chatRetentionTable as l } from "./retention.entity.js";
7
- import { mentioned as u, messageChanged as d, typing as f } from "./events.js";
8
- import { chatChannelsTable as p } from "./channels.entity.js";
9
- import { chatMembersTable as m } from "./members.entity.js";
10
- import { chatMessagesTable as h } from "./messages.entity.js";
11
- import { dataStoreChat as g } from "./service.js";
12
- import { BASE_NAME as _, chatRpcClientImports as v } from "./rpc.js";
13
- import { chatRpcRoutes as y } from "./rpcRoutes.js";
14
- import { defaultChatStrategies as b, resolveChatOptions as x } from "./strategies.js";
15
- import { chatStatus as S } from "./inspect.js";
16
- import { ChatAdministration as C } from "./server.js";
17
- import { defineLicensedGamePlugin as w } from "@voltro/plugin-licensing/gate";
18
- import { Effect as T, Layer as E } from "effect";
19
- import { fileURLToPath as D } from "node:url";
20
- import { replicaEvidence as O } from "@voltro/protocol/identity";
21
- import { redisStore as k } from "@voltro/plugin-ratelimit";
2
+ import { dataStoreChat as n } from "./service.js";
3
+ import { chatAdmissionsTable as r } from "./admissions.entity.js";
4
+ import { chatEvidenceTable as i } from "./evidence.entity.js";
5
+ import { chatMediaTable as a } from "./media.entity.js";
6
+ import { chatRetentionTable as o } from "./retention.entity.js";
7
+ import { chatChannelsTable as s } from "./channels.entity.js";
8
+ import { chatMembersTable as c } from "./members.entity.js";
9
+ import { chatMessagesTable as l } from "./messages.entity.js";
10
+ import { chatRpcRoutes as u } from "./rpcRoutes.js";
11
+ import { devVoiceProvider as d, liveKitVoiceProvider as f, resolveChatVoice as p } from "./voice.js";
12
+ import { defaultChatStrategies as m, resolveChatOptions as h } from "./strategies.js";
13
+ import { chatStatus as g } from "./inspect.js";
14
+ import { mentioned as _, messageChanged as v, typing as y } from "./events.js";
15
+ import { ChatAdministration as b } from "./server.js";
16
+ import { BASE_NAME as x, chatRpcClientImports as S, chatVoiceRpcClientImports as C, voiceJoinDescriptor as w } from "./rpc.js";
17
+ import { CHAT_MAX_MESSAGE_VERSION as T, CHAT_MEDIA_SWEEP_BATCH_SIZE as E, CHAT_RETENTION_BATCH_SIZE as D, CHAT_RETENTION_RUN_BATCHES as O } from "./contract.js";
18
+ import { defineLicensedGamePlugin as k } from "@voltro/plugin-licensing/gate";
19
+ import { Effect as A, Layer as j } from "effect";
20
+ import { fileURLToPath as M } from "node:url";
21
+ import { replicaEvidence as N } from "@voltro/protocol/identity";
22
+ import { redisStore as P } from "@voltro/plugin-ratelimit";
22
23
  // src/index.ts
23
- var A = {
24
+ var F = {
24
25
  slots: {
25
26
  moderate: {
26
27
  defaultExport: "keywordChatModeration",
@@ -45,64 +46,77 @@ var A = {
45
46
  },
46
47
  ports: {},
47
48
  events: [
48
- d.name,
49
- u.name,
50
- f.name
49
+ v.name,
50
+ _.name,
51
+ y.name
51
52
  ]
52
- }, j = (i = {}) => {
53
- let a = x(i), o = k(a.rateLimit), s, u, d = !1, b = (e) => T.suspend(() => u === void 0 ? T.fail(t("unavailable")) : e(u)), A = (e, n, r) => {
53
+ }, I = (d = {}) => {
54
+ let { voice: f, ...m } = d, _ = h(m), v = P(_.rateLimit), T = f === void 0 ? void 0 : p(f), E, D, O = !1, F = (e) => {
55
+ let n = D;
56
+ return A.suspend(() => n === void 0 || n !== D ? A.fail(t("unavailable")) : e(n).pipe(A.flatMap((e) => n === D ? A.succeed(e) : A.fail(t("unavailable")))));
57
+ }, I = (e, n, r) => {
54
58
  try {
55
59
  let t = structuredClone(e), i = structuredClone(n);
56
- return b((e) => r(e, t, i));
60
+ return F((e) => r(e, t, i));
57
61
  } catch {
58
- return T.fail(t("invalid_input"));
62
+ return A.fail(t("invalid_input"));
59
63
  }
64
+ }, L = {
65
+ mentionCandidates: (e, t) => I(e, t, (e, t, n) => e.service.mentionCandidates(t, n)),
66
+ authors: (e, t) => I(e, t, (e, t, n) => e.service.authors(t, n)),
67
+ prepareTyping: (e, t) => F((n) => n.service.prepareTyping(e, t)),
68
+ dm: (e, t) => F((n) => n.service.dm(e, t)),
69
+ send: (e, t) => F((n) => n.service.send(e, t)),
70
+ edit: (e, t) => F((n) => n.service.edit(e, t)),
71
+ remove: (e, t) => F((n) => n.service.remove(e, t)),
72
+ messages: (e, t) => F((n) => n.service.messages(e, t)),
73
+ channel: (e, t) => F((n) => n.service.channel(e, t)),
74
+ membership: (e, t) => F((n) => n.service.membership(e, t)),
75
+ unread: (e) => F((t) => t.service.unread(e)),
76
+ original: (e, t) => F((n) => n.service.original(e, t)),
77
+ mediaUrl: (e, t) => F((n) => n.service.mediaUrl(e, t)),
78
+ channels: (e) => F((t) => t.service.channels(e)),
79
+ markRead: (e, t, n) => F((r) => r.service.markRead(e, t, n)),
80
+ moderateMember: (e, t) => F((n) => n.service.moderateMember(e, t)),
81
+ configure: (e, t) => F((n) => n.service.configure(e, t)),
82
+ join: (e, t) => F((n) => n.service.join(e, t)),
83
+ leave: (e, t) => F((n) => n.service.leave(e, t)),
84
+ transferOwnership: (e, t, n) => F((r) => r.service.transferOwnership(e, t, n))
60
85
  };
61
- return w({
62
- name: _,
86
+ return k({
87
+ name: x,
63
88
  description: "Membership-filtered durable chat with replaceable rule slots.",
64
89
  eventClientPolicies: [{
65
- id: f.clientPolicy,
66
- admit: (e) => b((t) => t.typingPolicy.admit(e)),
67
- deliver: (e) => b((t) => t.typingPolicy.deliver(e)),
68
- monitor: (e) => b((t) => t.typingPolicy.monitor(e))
90
+ id: y.clientPolicy,
91
+ admit: (e) => F((t) => t.typingPolicy.admit(e)),
92
+ deliver: (e) => F((t) => t.typingPolicy.deliver(e)),
93
+ monitor: (e) => F((t) => t.typingPolicy.monitor(e))
69
94
  }],
70
- services: E.succeed(C, {
71
- readReportEvidence: (e, t) => A(e, t, (e, t, n) => e.readReportEvidence(t, n)),
72
- collectReportContext: (e, t) => A(e, t, (e, t, n) => e.collectReportContext(t, n)),
73
- prune: (e) => A(e, null, (e, t) => e.prune(t)),
74
- sweepMedia: (e) => A(e, null, (e, t) => e.sweepMedia(t)),
75
- canNotifyMention: (e, t) => A(e, t, (e, t, n) => e.canNotifyMention(t, n)),
76
- createChannel: (e, t) => A(e, t, (e, t, n) => e.createChannel(t, n)),
77
- addMember: (e, t) => A(e, t, (e, t, n) => e.addMember(t, n)),
78
- removeMember: (e, t) => A(e, t, (e, t, n) => e.removeMember(t, n)),
79
- archiveMatch: (e, t) => A(e, t, (e, t, n) => e.archiveMatch(t, n))
95
+ services: j.succeed(b, {
96
+ readReportEvidence: (e, t) => I(e, t, (e, t, n) => e.readReportEvidence(t, n)),
97
+ collectReportContext: (e, t) => I(e, t, (e, t, n) => e.collectReportContext(t, n)),
98
+ prune: (e) => I(e, null, (e, t) => e.prune(t)),
99
+ sweepMedia: (e) => I(e, null, (e, t) => e.sweepMedia(t)),
100
+ canNotifyMention: (e, t) => I(e, t, (e, t, n) => e.canNotifyMention(t, n)),
101
+ createChannel: (e, t) => I(e, t, (e, t, n) => e.createChannel(t, n)),
102
+ addMember: (e, t) => I(e, t, (e, t, n) => e.addMember(t, n)),
103
+ removeMember: (e, t) => I(e, t, (e, t, n) => e.removeMember(t, n)),
104
+ archiveMatch: (e, t) => I(e, t, (e, t, n) => e.archiveMatch(t, n))
80
105
  }),
81
106
  permissions: ["store:write", "inspect:read"],
82
- routes: y({
83
- mentionCandidates: (e, t) => A(e, t, (e, t, n) => e.service.mentionCandidates(t, n)),
84
- authors: (e, t) => A(e, t, (e, t, n) => e.service.authors(t, n)),
85
- prepareTyping: (e, t) => b((n) => n.service.prepareTyping(e, t)),
86
- dm: (e, t) => b((n) => n.service.dm(e, t)),
87
- send: (e, t) => b((n) => n.service.send(e, t)),
88
- edit: (e, t) => b((n) => n.service.edit(e, t)),
89
- remove: (e, t) => b((n) => n.service.remove(e, t)),
90
- messages: (e, t) => b((n) => n.service.messages(e, t)),
91
- channel: (e, t) => b((n) => n.service.channel(e, t)),
92
- membership: (e, t) => b((n) => n.service.membership(e, t)),
93
- unread: (e) => b((t) => t.service.unread(e)),
94
- original: (e, t) => b((n) => n.service.original(e, t)),
95
- mediaUrl: (e, t) => b((n) => n.service.mediaUrl(e, t)),
96
- channels: (e) => b((t) => t.service.channels(e)),
97
- markRead: (e, t, n) => b((r) => r.service.markRead(e, t, n)),
98
- moderateMember: (e, t) => b((n) => n.service.moderateMember(e, t)),
99
- configure: (e, t) => b((n) => n.service.configure(e, t)),
100
- join: (e, t) => b((n) => n.service.join(e, t)),
101
- leave: (e, t) => b((n) => n.service.leave(e, t)),
102
- transferOwnership: (e, t, n) => b((r) => r.service.transferOwnership(e, t, n))
103
- }),
104
- rpcClientDescriptors: v,
105
- sources: D(new URL("./chat-app", "" + import.meta.url)),
107
+ routes: [...u(L), ...T === void 0 ? [] : [{
108
+ ...w,
109
+ execute: (e, n) => {
110
+ let r = n.request.subject;
111
+ return r.type !== "user" || typeof r.tenantId != "string" ? A.fail(t("forbidden")) : A.flatMap(L.membership(r, e.channelId), (t) => T.join({
112
+ tenantId: r.tenantId,
113
+ subjectId: String(r.id),
114
+ channelId: e.channelId
115
+ }, t));
116
+ }
117
+ }]],
118
+ rpcClientDescriptors: T === void 0 ? S : [...S, ...C],
119
+ sources: M(new URL("./chat-app", "" + import.meta.url)),
106
120
  errorSchemas: [{
107
121
  schema: e,
108
122
  import: {
@@ -111,23 +125,23 @@ var A = {
111
125
  }
112
126
  }],
113
127
  extendSchema: { tables: [
114
- p,
115
- m,
116
- h,
128
+ s,
129
+ c,
117
130
  l,
131
+ o,
132
+ i,
118
133
  r,
119
- n,
120
- c
134
+ a
121
135
  ] },
122
136
  subjectPrivacy: {
123
137
  tables: [
124
- p.tableName,
125
- m.tableName,
126
- h.tableName,
138
+ s.tableName,
139
+ c.tableName,
127
140
  l.tableName,
141
+ o.tableName,
142
+ i.tableName,
128
143
  r.tableName,
129
- n.tableName,
130
- c.tableName
144
+ a.tableName
131
145
  ],
132
146
  kinds: ["user", "guest"]
133
147
  },
@@ -136,45 +150,58 @@ var A = {
136
150
  path: "/status",
137
151
  scope: "process",
138
152
  description: "Declared chat budgets and process binding; no channel/message/body enumeration.",
139
- handler: () => T.try({
153
+ handler: () => A.try({
140
154
  try: () => ({
141
155
  kind: "json",
142
- data: S(a, u !== void 0, d)
156
+ data: g(_, D !== void 0, O)
143
157
  }),
144
158
  catch: () => t("unavailable")
145
159
  })
146
160
  }],
147
161
  bindDataStore: (e) => {
148
- if (s !== void 0 && s !== e) throw Error("Chat plugin instance cannot cross app stores");
149
- s = e, u ??= g(e, a, o);
162
+ if (E !== void 0 && E !== e) throw Error("Chat plugin instance cannot cross app stores");
163
+ E = e, D ??= n(e, _, v);
150
164
  },
151
- onActivate: (e) => T.tryPromise({
165
+ onActivate: (e) => A.tryPromise({
152
166
  try: async () => {
153
- if (a.rateLimit?.hotStore !== void 0 && O(e.env) !== null) throw t("unavailable");
154
- await o.activate(e.env, e.connectionRegistry), d = !0;
167
+ if (_.rateLimit?.hotStore !== void 0 && N(e.env) !== null) throw t("unavailable");
168
+ await v.activate(e.env, e.connectionRegistry), O = !0;
155
169
  },
156
170
  catch: () => t("unavailable")
157
171
  }),
158
- onExport: (e, t) => b((n) => n.exportSubject({
172
+ onExport: (e, t) => F((n) => n.exportSubject({
159
173
  subjectId: e,
160
174
  tenantId: t.tenantId,
161
175
  kind: t.kind
162
176
  })),
163
- onErase: (e, t) => b((n) => n.eraseSubject({
177
+ onErase: (e, t) => F((n) => n.eraseSubject({
164
178
  subjectId: e,
165
179
  tenantId: t.tenantId,
166
180
  kind: t.kind
167
181
  })),
168
- onDeactivate: () => T.tryPromise({
182
+ subjectMerge: {
183
+ tables: [
184
+ s,
185
+ c,
186
+ l,
187
+ o,
188
+ i,
189
+ r,
190
+ a
191
+ ].map((e) => e.tableName),
192
+ kinds: ["guest"]
193
+ },
194
+ onMergeAccounts: (e) => F((t) => t.mergeSubject(e)),
195
+ onDeactivate: () => A.tryPromise({
169
196
  try: async () => {
170
197
  try {
171
- u?.disposeTyping();
198
+ D?.disposeTyping();
172
199
  } finally {
173
- u = void 0, s = void 0, d = !1, await o.deactivate();
200
+ D = void 0, E = void 0, O = !1, await v.deactivate();
174
201
  }
175
202
  },
176
203
  catch: () => t("unavailable")
177
204
  })
178
205
  });
179
206
  };
180
- export { i as CHAT_MAX_MESSAGE_VERSION, a as CHAT_MEDIA_SWEEP_BATCH_SIZE, o as CHAT_RETENTION_BATCH_SIZE, s as CHAT_RETENTION_RUN_BATCHES, e as ChatError, n as chatAdmissionsTable, p as chatChannelsTable, r as chatEvidenceTable, c as chatMediaTable, m as chatMembersTable, h as chatMessagesTable, j as chatPlugin, l as chatRetentionTable, A as chatSystemContract, g as dataStoreChat, b as defaultChatStrategies, x as resolveChatOptions };
207
+ export { T as CHAT_MAX_MESSAGE_VERSION, E as CHAT_MEDIA_SWEEP_BATCH_SIZE, D as CHAT_RETENTION_BATCH_SIZE, O as CHAT_RETENTION_RUN_BATCHES, e as ChatError, r as chatAdmissionsTable, s as chatChannelsTable, i as chatEvidenceTable, a as chatMediaTable, c as chatMembersTable, l as chatMessagesTable, I as chatPlugin, o as chatRetentionTable, F as chatSystemContract, n as dataStoreChat, m as defaultChatStrategies, d as devVoiceProvider, f as liveKitVoiceProvider, h as resolveChatOptions };
package/dist/inspect.js CHANGED
@@ -1,28 +1,29 @@
1
- import { chatError as e } from "./errors.js";
2
- import { defaultChatStrategies as t } from "./strategies.js";
1
+ import { defaultChatStrategies as e } from "./strategies.js";
2
+ import { chatError as t } from "./errors.js";
3
+ import { decodeChatStatus as n } from "@voltro/protocol/inspect";
3
4
  // src/inspect.ts
4
- var n = (n, r, i) => {
5
- let a = n.now();
6
- if (!Number.isSafeInteger(a) || a < 0 || a > 864e13) throw e("unavailable");
7
- return {
8
- observedAt: a,
9
- bound: r,
10
- rateActive: i,
11
- maxBodyLength: n.maxBodyLength,
12
- pageSize: n.pageSize,
13
- maxMembers: n.maxMembers,
14
- maxChannelsPerSubject: n.maxChannelsPerSubject,
15
- retentionMs: n.retentionMs,
16
- evidenceRetentionMs: n.evidenceRetentionMs,
17
- perChannelRate: n.perChannelRate,
18
- globalRate: n.globalRate,
19
- maxMentions: n.maxMentions,
20
- moderationAction: n.moderationAction,
21
- denyWordCount: n.denyWords.length,
22
- mediaContentTypes: n.mediaContentTypes,
23
- maxMediaBytes: n.maxMediaBytes,
24
- mediaUrlTtlSec: n.mediaUrlTtlSec,
25
- slots: Object.fromEntries(Object.entries(t).map(([e, t]) => [e, n.strategies[e] === t ? "default" : "custom"])),
5
+ var r = (r, i, a) => {
6
+ let o = r.now();
7
+ if (!Number.isSafeInteger(o) || o < 0 || o > 864e13) throw t("unavailable");
8
+ return n({
9
+ observedAt: o,
10
+ bound: i,
11
+ rateActive: a,
12
+ maxBodyLength: r.maxBodyLength,
13
+ pageSize: r.pageSize,
14
+ maxMembers: r.maxMembers,
15
+ maxChannelsPerSubject: r.maxChannelsPerSubject,
16
+ retentionMs: r.retentionMs,
17
+ evidenceRetentionMs: r.evidenceRetentionMs,
18
+ perChannelRate: r.perChannelRate,
19
+ globalRate: r.globalRate,
20
+ maxMentions: r.maxMentions,
21
+ moderationAction: r.moderationAction,
22
+ denyWordCount: r.denyWords.length,
23
+ mediaContentTypes: r.mediaContentTypes,
24
+ maxMediaBytes: r.maxMediaBytes,
25
+ mediaUrlTtlSec: r.mediaUrlTtlSec,
26
+ slots: Object.fromEntries(Object.entries(e).map(([e, t]) => [e, r.strategies[e] === t ? "default" : "custom"])),
26
27
  tables: [
27
28
  "_voltro_chat_channels",
28
29
  "_voltro_chat_members",
@@ -32,6 +33,6 @@ var n = (n, r, i) => {
32
33
  "_voltro_chat_admissions",
33
34
  "_voltro_chat_media"
34
35
  ]
35
- };
36
+ });
36
37
  };
37
- export { n as chatStatus };
38
+ export { r as chatStatus };
@@ -1,7 +1,7 @@
1
- import { chatError as e } from "./errors.js";
2
- import { MESSAGES_TABLE as t } from "./contract.js";
1
+ import { ChatAdministration as e } from "./server.js";
2
+ import { chatError as t } from "./errors.js";
3
3
  import { chatEventTenant as n, committedChatMentions as r } from "./eventProducer.js";
4
- import { ChatAdministration as i } from "./server.js";
4
+ import { MESSAGES_TABLE as i } from "./contract.js";
5
5
  import { Effect as a, Schema as o } from "effect";
6
6
  import { createHash as s } from "node:crypto";
7
7
  import { defineOutboxHandler as c, defineSubscriber as l } from "@voltro/runtime";
@@ -34,7 +34,7 @@ var f = "voltro.chat.mention.notify", p = "chat.mention", m = o.NonEmptyString.p
34
34
  }
35
35
  })
36
36
  }), v = (u) => {
37
- let m = structuredClone(u.subject), v = u.run, y = u.service, b = u.outboxForTenant, x = u.localeFor, S = (e) => v(a.flatMap(i, (t) => t.canNotifyMention(m, e))), C = async (e) => {
37
+ let m = structuredClone(u.subject), v = u.run, y = u.service, b = u.outboxForTenant, x = u.localeFor, S = (t) => v(a.flatMap(e, (e) => e.canNotifyMention(m, t))), C = async (e) => {
38
38
  let t = o.decodeUnknownSync(h)(e.payload);
39
39
  return e.tenantId !== t.tenantId || e.recipientId !== t.recipientId ? !1 : S(t);
40
40
  }, w = async (e) => {
@@ -59,17 +59,17 @@ var f = "voltro.chat.mention.notify", p = "chat.mention", m = o.NonEmptyString.p
59
59
  outboxHandler: c({
60
60
  effect: f,
61
61
  maxAttempts: 5,
62
- handler: async (t) => {
63
- let n = o.decodeUnknownSync(g)(t.payload);
64
- if (t.tenantId !== n.tenantId) throw e("identity_required");
62
+ handler: async (e) => {
63
+ let n = o.decodeUnknownSync(g)(e.payload);
64
+ if (e.tenantId !== n.tenantId) throw t("identity_required");
65
65
  if (!await S(n)) return { skipped: !0 };
66
66
  let r = y();
67
- if (!r) throw e("unavailable");
67
+ if (!r) throw t("unavailable");
68
68
  return d({
69
69
  notifications: [_],
70
- service: () => ({ send: async (t) => {
70
+ service: () => ({ send: async (e) => {
71
71
  let i = await r.send({
72
- ...t,
72
+ ...e,
73
73
  deliveryGuard: {
74
74
  id: p,
75
75
  payload: {
@@ -80,7 +80,7 @@ var f = "voltro.chat.mention.notify", p = "chat.mention", m = o.NonEmptyString.p
80
80
  }
81
81
  }
82
82
  });
83
- if (i.failed.length > 0) throw e("unavailable");
83
+ if (i.failed.length > 0) throw t("unavailable");
84
84
  return i;
85
85
  } })
86
86
  }).handler({ payload: {
@@ -96,7 +96,7 @@ var f = "voltro.chat.mention.notify", p = "chat.mention", m = o.NonEmptyString.p
96
96
  }
97
97
  }),
98
98
  subscriber: l({
99
- table: t,
99
+ table: i,
100
100
  on: ["insert"],
101
101
  once: !0,
102
102
  eventTenant: n,
@@ -0,0 +1,29 @@
1
+ // src/messageLinks.ts
2
+ var e = /\bhttps?:\/\/[^\s<>"'`]+/gi, t = /[.,;:!?)\]}'"»”’]+$/, n = (n, r = 20) => {
3
+ if (typeof n != "string" || n === "") return [];
4
+ let i = [], a = 0, o = 0;
5
+ for (let s of n.matchAll(e)) {
6
+ if (o >= r) break;
7
+ let e = s.index ?? 0, c = s[0].replace(t, ""), l;
8
+ try {
9
+ let e = new URL(c);
10
+ if (e.protocol !== "http:" && e.protocol !== "https:" || e.username || e.password || !e.hostname) continue;
11
+ l = e.href;
12
+ } catch {
13
+ continue;
14
+ }
15
+ e > a && i.push({
16
+ kind: "text",
17
+ text: n.slice(a, e)
18
+ }), i.push({
19
+ kind: "link",
20
+ text: c,
21
+ href: l
22
+ }), a = e + c.length, o++;
23
+ }
24
+ return a < n.length && i.push({
25
+ kind: "text",
26
+ text: n.slice(a)
27
+ }), i;
28
+ };
29
+ export { n as chatMessageSegments };
package/dist/rpc.d.ts CHANGED
@@ -52,6 +52,8 @@ declare const ChatError_base: Schema.Class<ChatError, Schema.TaggedStruct<"ChatE
52
52
 
53
53
  export declare const chatRpcClientImports: ReadonlyArray<PluginRpcClientDescriptor>;
54
54
 
55
+ export declare const chatVoiceRpcClientImports: ReadonlyArray<PluginRpcClientDescriptor>;
56
+
55
57
  export declare const configureDescriptor: ActionProcedureDescriptor<"chat.configure", Schema.Struct<{
56
58
  readonly channelId: Schema.NonEmptyString;
57
59
  readonly slowModeMs: Schema.optional<Schema.Number>;
@@ -292,4 +294,16 @@ export declare const unreadDescriptor: QueryProcedureDescriptor<"chat.unread", S
292
294
  readonly truncated: Schema.Boolean;
293
295
  }>>, typeof ChatError>;
294
296
 
297
+ /** Voice chat (`chatPlugin({ voice })`): a join ticket for the channel's voice room at the configured SFU. */
298
+ export declare const voiceJoinDescriptor: ActionProcedureDescriptor<"chat.voice.join", Schema.Struct<{
299
+ readonly channelId: Schema.NonEmptyString;
300
+ }>, Schema.Struct<{
301
+ readonly provider: Schema.String;
302
+ readonly room: Schema.String;
303
+ readonly canPublish: Schema.Boolean;
304
+ readonly url: Schema.String;
305
+ readonly token: Schema.String;
306
+ readonly expiresAt: Schema.Number;
307
+ }>, typeof ChatError>;
308
+
295
309
  export { }
package/dist/rpc.js CHANGED
@@ -226,7 +226,27 @@ var g = "@voltro/plugin-chat", _ = "The handler verifies human identity, same-te
226
226
  output: p.Void,
227
227
  error: e,
228
228
  openAccess: _
229
- }), B = [...[
229
+ }), B = m({
230
+ name: "chat.voice.join",
231
+ input: y,
232
+ output: p.Struct({
233
+ provider: p.String,
234
+ room: p.String,
235
+ canPublish: p.Boolean,
236
+ url: p.String,
237
+ token: p.String,
238
+ expiresAt: p.Number
239
+ }),
240
+ error: e,
241
+ openAccess: "Channel member; a muted member may listen only. The token is short-lived and for this channel only."
242
+ }), V = [{
243
+ tag: "chat.voice.join",
244
+ kind: "action",
245
+ import: {
246
+ module: "@voltro/plugin-chat/rpc",
247
+ name: "voiceJoinDescriptor"
248
+ }
249
+ }], H = [...[
230
250
  "setTyping",
231
251
  "dm",
232
252
  "send",
@@ -263,4 +283,4 @@ var g = "@voltro/plugin-chat", _ = "The handler verifies human identity, same-te
263
283
  name: e + "Descriptor"
264
284
  }
265
285
  }))];
266
- export { g as BASE_NAME, D as authorsDescriptor, O as channelDescriptor, A as channelsDescriptor, B as chatRpcClientImports, I as configureDescriptor, x as dmDescriptor, C as editDescriptor, L as joinDescriptor, R as leaveDescriptor, P as markReadDescriptor, N as mediaUrlDescriptor, k as membershipDescriptor, E as mentionCandidatesDescriptor, T as messagesDescriptor, F as muteDescriptor, M as originalDescriptor, w as removeDescriptor, S as sendDescriptor, b as setTypingDescriptor, z as transferOwnershipDescriptor, j as unreadDescriptor };
286
+ export { g as BASE_NAME, D as authorsDescriptor, O as channelDescriptor, A as channelsDescriptor, H as chatRpcClientImports, V as chatVoiceRpcClientImports, I as configureDescriptor, x as dmDescriptor, C as editDescriptor, L as joinDescriptor, R as leaveDescriptor, P as markReadDescriptor, N as mediaUrlDescriptor, k as membershipDescriptor, E as mentionCandidatesDescriptor, T as messagesDescriptor, F as muteDescriptor, M as originalDescriptor, w as removeDescriptor, S as sendDescriptor, b as setTypingDescriptor, z as transferOwnershipDescriptor, j as unreadDescriptor, B as voiceJoinDescriptor };
package/dist/server.d.ts CHANGED
@@ -68,6 +68,9 @@ export declare interface ChatAdministrationService {
68
68
 
69
69
  declare type ChatChannel = typeof ChatChannelSchema.Type;
70
70
 
71
+ /** The id of the channel `createChannel` makes for one tenant, kind and reference. */
72
+ export declare const chatChannelId: (tenantId: string, kind: string, refId: string) => string;
73
+
71
74
  declare const ChatChannelSchema: Schema.Struct<{
72
75
  readonly id: Schema.String;
73
76
  readonly kind: Schema.Literals<readonly ["global", "lobby", "party", "guild", "match", "dm", "custom"]>;
package/dist/server.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { CHAT_MENTION_NOTIFICATION_EFFECT as e, CHAT_MENTION_NOTIFICATION_GUARD as t, createChatMentionNotifications as n } from "./mentionNotifications.js";
2
2
  import { chatSanctionEvidenceCollector as r } from "./reportEvidence.js";
3
- import { Context as i } from "effect";
3
+ import { chatChannelId as i } from "./service.js";
4
+ import { Context as a } from "effect";
4
5
  // src/server.ts
5
- var a = class extends i.Service()("@voltro/ChatAdministration") {};
6
- export { e as CHAT_MENTION_NOTIFICATION_EFFECT, t as CHAT_MENTION_NOTIFICATION_GUARD, a as ChatAdministration, r as chatSanctionEvidenceCollector, n as createChatMentionNotifications };
6
+ var o = class extends a.Service()("@voltro/ChatAdministration") {};
7
+ export { e as CHAT_MENTION_NOTIFICATION_EFFECT, t as CHAT_MENTION_NOTIFICATION_GUARD, o as ChatAdministration, i as chatChannelId, r as chatSanctionEvidenceCollector, n as createChatMentionNotifications };