spectrum-ts 1.11.3 → 1.12.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.
@@ -2,7 +2,7 @@ import {
2
2
  bufferToStream,
3
3
  readSchema,
4
4
  streamSchema
5
- } from "./chunk-3BTOWGQL.js";
5
+ } from "./chunk-YDHES53X.js";
6
6
 
7
7
  // src/content/voice.ts
8
8
  import { createReadStream } from "fs";
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  asVoice
3
- } from "./chunk-EW5XWI3Y.js";
3
+ } from "./chunk-4TXLNBGE.js";
4
4
  import {
5
5
  asContact,
6
6
  fromVCard,
7
7
  toVCard
8
- } from "./chunk-LCJMR75R.js";
8
+ } from "./chunk-L3VXHUVY.js";
9
9
  import {
10
10
  UnsupportedError,
11
11
  asAttachment,
12
12
  asCustom,
13
13
  definePlatform,
14
14
  reactionSchema
15
- } from "./chunk-3BTOWGQL.js";
15
+ } from "./chunk-YDHES53X.js";
16
16
 
17
17
  // src/providers/terminal/index.ts
18
18
  import { spawn } from "child_process";
@@ -10,7 +10,7 @@ import {
10
10
  asReaction,
11
11
  asText,
12
12
  definePlatform
13
- } from "./chunk-3BTOWGQL.js";
13
+ } from "./chunk-YDHES53X.js";
14
14
 
15
15
  // src/providers/slack/index.ts
16
16
  import { createClient as createClient2, staticTokens } from "@photon-ai/slack";
@@ -2,7 +2,7 @@ import {
2
2
  asGroup,
3
3
  asRichlink,
4
4
  groupSchema
5
- } from "./chunk-YM4OAVPX.js";
5
+ } from "./chunk-UFJZIZDO.js";
6
6
  import {
7
7
  asPoll,
8
8
  asPollOption
@@ -16,88 +16,42 @@ import {
16
16
  asContact,
17
17
  fromVCard,
18
18
  toVCard
19
- } from "./chunk-LCJMR75R.js";
19
+ } from "./chunk-L3VXHUVY.js";
20
20
  import {
21
21
  UnsupportedError,
22
22
  asAttachment,
23
23
  asCustom,
24
24
  asText,
25
25
  attachmentSchema,
26
+ buildPhotoAction,
26
27
  definePlatform,
28
+ photoActionSchema,
27
29
  reactionSchema,
28
- readSchema,
29
30
  text,
30
31
  textSchema
31
- } from "./chunk-3BTOWGQL.js";
32
+ } from "./chunk-YDHES53X.js";
32
33
 
33
34
  // src/providers/imessage/index.ts
34
35
  import { createClient as createClient2, MessageEffect as MessageEffect2 } from "@photon-ai/advanced-imessage";
35
36
  import { IMessageSDK as IMessageSDK2 } from "@photon-ai/imessage-kit";
36
37
 
37
38
  // src/providers/imessage/content/background.ts
38
- import { readFile } from "fs/promises";
39
- import { basename } from "path";
40
- import { lookup as lookupMimeType } from "mime-types";
41
39
  import z from "zod";
42
- var backgroundActionSchema = z.discriminatedUnion("kind", [
43
- z.object({
44
- kind: z.literal("set"),
45
- read: readSchema,
46
- mimeType: z.string().nonempty()
47
- }),
48
- z.object({ kind: z.literal("clear") })
49
- ]);
50
40
  var backgroundSchema = z.object({
51
41
  type: z.literal("background"),
52
42
  __platform: z.literal("iMessage"),
53
43
  __fireAndForget: z.literal(true),
54
- action: backgroundActionSchema
44
+ action: photoActionSchema
55
45
  });
56
46
  var isBackground = (v) => backgroundSchema.safeParse(v).success;
57
- var CLEAR_SENTINEL = "clear";
58
- var resolveMimeType = (input, mimeType) => {
59
- if (mimeType) {
60
- return mimeType;
61
- }
62
- if (typeof input === "string") {
63
- const resolved = lookupMimeType(basename(input));
64
- if (resolved) {
65
- return resolved;
66
- }
67
- }
68
- throw new Error(
69
- "Unable to resolve MIME type for background. Pass options.mimeType explicitly."
70
- );
71
- };
72
- var cachedRead = (read2) => {
73
- let cached;
74
- return () => {
75
- cached ??= read2().catch((err) => {
76
- cached = void 0;
77
- throw err;
78
- });
79
- return cached;
80
- };
81
- };
82
47
  function background(input, options) {
83
- if (input === CLEAR_SENTINEL) {
84
- return {
85
- build: async () => backgroundSchema.parse({
86
- type: "background",
87
- __platform: "iMessage",
88
- __fireAndForget: true,
89
- action: { kind: "clear" }
90
- })
91
- };
92
- }
93
- const mimeType = resolveMimeType(input, options?.mimeType);
94
- const read2 = typeof input === "string" ? cachedRead(() => readFile(input)) : cachedRead(async () => input);
48
+ const action = buildPhotoAction(input, options, "background");
95
49
  return {
96
50
  build: async () => backgroundSchema.parse({
97
51
  type: "background",
98
52
  __platform: "iMessage",
99
53
  __fireAndForget: true,
100
- action: { kind: "set", read: read2, mimeType }
54
+ action
101
55
  })
102
56
  };
103
57
  }
@@ -148,7 +102,7 @@ function effect(input, messageEffect) {
148
102
  // src/providers/imessage/content/read.ts
149
103
  import z3 from "zod";
150
104
  var isMessage = (v) => typeof v === "object" && v !== null && "id" in v && "content" in v;
151
- var readSchema2 = z3.object({
105
+ var readSchema = z3.object({
152
106
  type: z3.literal("read"),
153
107
  __platform: z3.literal("iMessage"),
154
108
  __fireAndForget: z3.literal(true),
@@ -156,7 +110,7 @@ var readSchema2 = z3.object({
156
110
  message: "read target must be a Message"
157
111
  })
158
112
  });
159
- var isRead = (v) => readSchema2.safeParse(v).success;
113
+ var isRead = (v) => readSchema.safeParse(v).success;
160
114
  function read(target) {
161
115
  return {
162
116
  build: async () => {
@@ -165,7 +119,7 @@ function read(target) {
165
119
  `read() target must be an inbound message (got direction "${target.direction}", message id "${target.id}")`
166
120
  );
167
121
  }
168
- return readSchema2.parse({
122
+ return readSchema.parse({
169
123
  type: "read",
170
124
  __platform: "iMessage",
171
125
  __fireAndForget: true,
@@ -332,7 +286,7 @@ import { setTimeout as sleep } from "timers/promises";
332
286
 
333
287
  // src/providers/imessage/local/attachments.ts
334
288
  import { createReadStream } from "fs";
335
- import { readFile as readFile2 } from "fs/promises";
289
+ import { readFile } from "fs/promises";
336
290
  import { Readable } from "stream";
337
291
 
338
292
  // src/providers/imessage/shared/vcard.ts
@@ -363,7 +317,7 @@ var readLocalAttachment = async (att) => {
363
317
  `iMessage attachment ${att.id} has no local file available on disk`
364
318
  );
365
319
  }
366
- return readFile2(att.localPath);
320
+ return readFile(att.localPath);
367
321
  };
368
322
  var toAttachmentContent = (att) => {
369
323
  const { localPath } = att;
@@ -482,7 +436,7 @@ var messages = (client) => stream((emit, end) => {
482
436
  // src/providers/imessage/local/send.ts
483
437
  import { mkdtemp, rm, writeFile } from "fs/promises";
484
438
  import { tmpdir } from "os";
485
- import { basename as basename2, join } from "path";
439
+ import { basename, join } from "path";
486
440
 
487
441
  // src/providers/imessage/shared/errors.ts
488
442
  var IMESSAGE_PLATFORM = "iMessage";
@@ -498,7 +452,7 @@ var synthRecord = (spaceId, content) => ({
498
452
  timestamp: /* @__PURE__ */ new Date()
499
453
  });
500
454
  var sendTempFile = async (client, spaceId, name, data) => {
501
- const safeName = basename2(name) || DEFAULT_ATTACHMENT_NAME;
455
+ const safeName = basename(name) || DEFAULT_ATTACHMENT_NAME;
502
456
  const dir = await mkdtemp(join(tmpdir(), "spectrum-"));
503
457
  const tmp = join(dir, safeName);
504
458
  await writeFile(tmp, data);
@@ -562,6 +516,20 @@ var parseChildId = (id) => {
562
516
  };
563
517
  };
564
518
 
519
+ // src/providers/imessage/remote/avatar.ts
520
+ var setIcon = async (remote, spaceId, content) => {
521
+ const chat = toChatGuid(spaceId);
522
+ if (content.action.kind === "clear") {
523
+ await remote.groups.removeIcon(chat);
524
+ return;
525
+ }
526
+ const buffer = await content.action.read();
527
+ await remote.groups.setIcon(
528
+ chat,
529
+ new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength)
530
+ );
531
+ };
532
+
565
533
  // src/providers/imessage/remote/background.ts
566
534
  var setBackground = async (remote, spaceId, content) => {
567
535
  const chat = toChatGuid(spaceId);
@@ -1056,9 +1024,14 @@ var markRead = async (remote, spaceId) => {
1056
1024
  await remote.chats.markRead(toChatGuid(spaceId));
1057
1025
  };
1058
1026
 
1027
+ // src/providers/imessage/remote/rename.ts
1028
+ var setDisplayName = async (remote, spaceId, content) => {
1029
+ await remote.groups.setDisplayName(toChatGuid(spaceId), content.displayName);
1030
+ };
1031
+
1059
1032
  // src/utils/audio.ts
1060
1033
  import { spawn } from "child_process";
1061
- import { mkdtemp as mkdtemp2, readFile as readFile3, rm as rm2, writeFile as writeFile2 } from "fs/promises";
1034
+ import { mkdtemp as mkdtemp2, readFile as readFile2, rm as rm2, writeFile as writeFile2 } from "fs/promises";
1062
1035
  import { tmpdir as tmpdir2 } from "os";
1063
1036
  import { join as join2 } from "path";
1064
1037
  var M4A_BRANDS = /* @__PURE__ */ new Set([
@@ -1165,7 +1138,7 @@ var transcodeToM4a = async (buffer) => {
1165
1138
  if (code !== 0) {
1166
1139
  throw new Error(`ffmpeg conversion failed (exit ${code}): ${stderr}`);
1167
1140
  }
1168
- const out = await readFile3(outPath);
1141
+ const out = await readFile2(outPath);
1169
1142
  return { buffer: out, duration: parseDuration(stderr) };
1170
1143
  } finally {
1171
1144
  await rm2(dir, { recursive: true, force: true }).catch(() => {
@@ -1918,6 +1891,8 @@ var stopTyping = async (remote, spaceId) => {
1918
1891
  // src/providers/imessage/remote/api.ts
1919
1892
  var messages4 = (clients) => messages3(clients);
1920
1893
  var setBackground2 = async (remote, spaceId, content) => setBackground(remote, spaceId, content);
1894
+ var setDisplayName2 = async (remote, spaceId, content) => setDisplayName(remote, spaceId, content);
1895
+ var setIcon2 = async (remote, spaceId, content) => setIcon(remote, spaceId, content);
1921
1896
  var markRead2 = async (remote, spaceId) => {
1922
1897
  await markRead(remote, spaceId);
1923
1898
  };
@@ -2007,6 +1982,53 @@ var handleRead = async (client, space) => {
2007
1982
  const remote = clientForPhone(client, space.phone);
2008
1983
  await markRead2(remote, space.id);
2009
1984
  };
1985
+ var handleTyping = async (client, space, state) => {
1986
+ if (isLocal(client)) {
1987
+ return;
1988
+ }
1989
+ const remote = clientForPhone(client, space.phone);
1990
+ if (state === "start") {
1991
+ await startTyping2(remote, space.id);
1992
+ } else {
1993
+ await stopTyping2(remote, space.id);
1994
+ }
1995
+ };
1996
+ var handleRename = async (client, space, content) => {
1997
+ if (isLocal(client)) {
1998
+ throw UnsupportedError.action(
1999
+ "rename",
2000
+ "iMessage (local mode)",
2001
+ "renaming chats requires remote iMessage"
2002
+ );
2003
+ }
2004
+ if (space.type !== "group") {
2005
+ throw UnsupportedError.action(
2006
+ "rename",
2007
+ "iMessage",
2008
+ "only group chats can be renamed (this space is a DM)"
2009
+ );
2010
+ }
2011
+ const remote = clientForPhone(client, space.phone);
2012
+ await setDisplayName2(remote, space.id, content);
2013
+ };
2014
+ var handleAvatar = async (client, space, content) => {
2015
+ if (isLocal(client)) {
2016
+ throw UnsupportedError.action(
2017
+ "avatar",
2018
+ "iMessage (local mode)",
2019
+ "setting group avatars requires remote iMessage"
2020
+ );
2021
+ }
2022
+ if (space.type !== "group") {
2023
+ throw UnsupportedError.action(
2024
+ "avatar",
2025
+ "iMessage",
2026
+ "only group chats have avatars (this space is a DM)"
2027
+ );
2028
+ }
2029
+ const remote = clientForPhone(client, space.phone);
2030
+ await setIcon2(remote, space.id, content);
2031
+ };
2010
2032
  var imessage = definePlatform("iMessage", {
2011
2033
  config: configSchema,
2012
2034
  static: {
@@ -2150,21 +2172,21 @@ var imessage = definePlatform("iMessage", {
2150
2172
  return;
2151
2173
  }
2152
2174
  if (content.type === "typing") {
2153
- if (isLocal(client)) {
2154
- return;
2155
- }
2156
- const remote2 = clientForPhone(client, space.phone);
2157
- if (content.state === "start") {
2158
- await startTyping2(remote2, space.id);
2159
- } else {
2160
- await stopTyping2(remote2, space.id);
2161
- }
2175
+ await handleTyping(client, space, content.state);
2162
2176
  return;
2163
2177
  }
2164
2178
  if (content.type === "edit") {
2165
2179
  await handleEdit(client, space, content);
2166
2180
  return;
2167
2181
  }
2182
+ if (content.type === "rename") {
2183
+ await handleRename(client, space, content);
2184
+ return;
2185
+ }
2186
+ if (content.type === "avatar") {
2187
+ await handleAvatar(client, space, content);
2188
+ return;
2189
+ }
2168
2190
  if (isBackground(content)) {
2169
2191
  await handleBackground(client, space, content);
2170
2192
  return;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readSchema
3
- } from "./chunk-3BTOWGQL.js";
3
+ } from "./chunk-YDHES53X.js";
4
4
 
5
5
  // src/utils/vcard.ts
6
6
  import vCard from "vcf";
@@ -3,7 +3,7 @@ import {
3
3
  readSchema,
4
4
  resolveContents,
5
5
  streamSchema
6
- } from "./chunk-3BTOWGQL.js";
6
+ } from "./chunk-YDHES53X.js";
7
7
 
8
8
  // src/content/group.ts
9
9
  import z from "zod";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-YKWKZ2PZ.js";
9
9
  import {
10
10
  asContact
11
- } from "./chunk-LCJMR75R.js";
11
+ } from "./chunk-L3VXHUVY.js";
12
12
  import {
13
13
  UnsupportedError,
14
14
  asAttachment,
@@ -16,7 +16,7 @@ import {
16
16
  asReaction,
17
17
  asText,
18
18
  definePlatform
19
- } from "./chunk-3BTOWGQL.js";
19
+ } from "./chunk-YDHES53X.js";
20
20
 
21
21
  // src/providers/whatsapp-business/index.ts
22
22
  import { createClient as createClient2 } from "@photon-ai/whatsapp-business";
@@ -93,11 +93,79 @@ function attachment(input, options) {
93
93
  };
94
94
  }
95
95
 
96
- // src/content/custom.ts
96
+ // src/content/avatar.ts
97
+ import z4 from "zod";
98
+
99
+ // src/utils/photo-content.ts
100
+ import { readFile as readFile2 } from "fs/promises";
101
+ import { basename as basename2 } from "path";
102
+ import { lookup as lookupMimeType2 } from "mime-types";
97
103
  import z3 from "zod";
98
- var customSchema = z3.object({
99
- type: z3.literal("custom"),
100
- raw: z3.unknown()
104
+ var CLEAR_SENTINEL = "clear";
105
+ var photoActionSchema = z3.discriminatedUnion("kind", [
106
+ z3.object({
107
+ kind: z3.literal("set"),
108
+ read: readSchema,
109
+ mimeType: z3.string().nonempty()
110
+ }),
111
+ z3.object({ kind: z3.literal("clear") })
112
+ ]);
113
+ var resolveMimeType = (input, mimeType, contentLabel) => {
114
+ if (mimeType) {
115
+ return mimeType;
116
+ }
117
+ if (typeof input === "string") {
118
+ const resolved = lookupMimeType2(basename2(input));
119
+ if (resolved) {
120
+ return resolved;
121
+ }
122
+ }
123
+ throw new Error(
124
+ `Unable to resolve MIME type for ${contentLabel}. Pass options.mimeType explicitly.`
125
+ );
126
+ };
127
+ var cachedRead = (read) => {
128
+ let cached;
129
+ return () => {
130
+ cached ??= read().catch((err) => {
131
+ cached = void 0;
132
+ throw err;
133
+ });
134
+ return cached;
135
+ };
136
+ };
137
+ var buildPhotoAction = (input, options, contentLabel) => {
138
+ if (input === CLEAR_SENTINEL) {
139
+ return { kind: "clear" };
140
+ }
141
+ const mimeType = resolveMimeType(input, options?.mimeType, contentLabel);
142
+ let read;
143
+ if (typeof input === "string") {
144
+ read = cachedRead(() => readFile2(input));
145
+ } else {
146
+ const snapshot = Buffer.from(input);
147
+ read = cachedRead(async () => snapshot);
148
+ }
149
+ return { kind: "set", read, mimeType };
150
+ };
151
+
152
+ // src/content/avatar.ts
153
+ var avatarSchema = z4.object({
154
+ type: z4.literal("avatar"),
155
+ action: photoActionSchema
156
+ });
157
+ function avatar(input, options) {
158
+ const action = buildPhotoAction(input, options, "avatar");
159
+ return {
160
+ build: async () => avatarSchema.parse({ type: "avatar", action })
161
+ };
162
+ }
163
+
164
+ // src/content/custom.ts
165
+ import z5 from "zod";
166
+ var customSchema = z5.object({
167
+ type: z5.literal("custom"),
168
+ raw: z5.unknown()
101
169
  });
102
170
  var asCustom = (raw) => customSchema.parse({ type: "custom", raw });
103
171
  function custom(raw) {
@@ -107,10 +175,10 @@ function custom(raw) {
107
175
  }
108
176
 
109
177
  // src/content/text.ts
110
- import z4 from "zod";
111
- var textSchema = z4.object({
112
- type: z4.literal("text"),
113
- text: z4.string().nonempty()
178
+ import z6 from "zod";
179
+ var textSchema = z6.object({
180
+ type: z6.literal("text"),
181
+ text: z6.string().nonempty()
114
182
  });
115
183
  var asText = (text2) => textSchema.parse({ type: "text", text: text2 });
116
184
  function text(text2) {
@@ -125,15 +193,15 @@ var resolveContents = (items) => Promise.all(
125
193
  );
126
194
 
127
195
  // src/content/edit.ts
128
- import z5 from "zod";
196
+ import z7 from "zod";
129
197
  var isMessage = (v) => typeof v === "object" && v !== null && "id" in v && "content" in v;
130
198
  var isContent = (v) => typeof v === "object" && v !== null && "type" in v && typeof v.type === "string";
131
- var editSchema = z5.object({
132
- type: z5.literal("edit"),
133
- content: z5.custom(isContent, {
199
+ var editSchema = z7.object({
200
+ type: z7.literal("edit"),
201
+ content: z7.custom(isContent, {
134
202
  message: "edit content must be a Content value"
135
203
  }),
136
- target: z5.custom(isMessage, {
204
+ target: z7.custom(isMessage, {
137
205
  message: "edit target must be a Message"
138
206
  })
139
207
  });
@@ -150,7 +218,7 @@ function edit(content, target) {
150
218
  if (!resolved) {
151
219
  throw new Error("edit() requires content");
152
220
  }
153
- if (resolved.type === "edit" || resolved.type === "reply" || resolved.type === "reaction" || resolved.type === "group" || resolved.type === "typing") {
221
+ if (resolved.type === "edit" || resolved.type === "reply" || resolved.type === "reaction" || resolved.type === "group" || resolved.type === "typing" || resolved.type === "rename" || resolved.type === "avatar") {
154
222
  throw new Error(`edit() cannot wrap "${resolved.type}" content`);
155
223
  }
156
224
  return asEdit({ content: resolved, target });
@@ -159,12 +227,12 @@ function edit(content, target) {
159
227
  }
160
228
 
161
229
  // src/content/reaction.ts
162
- import z6 from "zod";
230
+ import z8 from "zod";
163
231
  var isMessage2 = (v) => typeof v === "object" && v !== null && "id" in v && "content" in v;
164
- var reactionSchema = z6.object({
165
- type: z6.literal("reaction"),
166
- emoji: z6.string().min(1),
167
- target: z6.custom(isMessage2, {
232
+ var reactionSchema = z8.object({
233
+ type: z8.literal("reaction"),
234
+ emoji: z8.string().min(1),
235
+ target: z8.custom(isMessage2, {
168
236
  message: "reaction target must be a Message"
169
237
  })
170
238
  });
@@ -180,16 +248,28 @@ function reaction(emoji, target) {
180
248
  };
181
249
  }
182
250
 
251
+ // src/content/rename.ts
252
+ import z9 from "zod";
253
+ var renameSchema = z9.object({
254
+ type: z9.literal("rename"),
255
+ displayName: z9.string().min(1, "rename() displayName must be non-empty")
256
+ });
257
+ function rename(displayName) {
258
+ return {
259
+ build: async () => renameSchema.parse({ type: "rename", displayName })
260
+ };
261
+ }
262
+
183
263
  // src/content/reply.ts
184
- import z7 from "zod";
264
+ import z10 from "zod";
185
265
  var isMessage3 = (v) => typeof v === "object" && v !== null && "id" in v && "content" in v;
186
266
  var isContent2 = (v) => typeof v === "object" && v !== null && "type" in v && typeof v.type === "string";
187
- var replySchema = z7.object({
188
- type: z7.literal("reply"),
189
- content: z7.custom(isContent2, {
267
+ var replySchema = z10.object({
268
+ type: z10.literal("reply"),
269
+ content: z10.custom(isContent2, {
190
270
  message: "reply content must be a Content value"
191
271
  }),
192
- target: z7.custom(isMessage3, {
272
+ target: z10.custom(isMessage3, {
193
273
  message: "reply target must be a Message"
194
274
  })
195
275
  });
@@ -201,7 +281,7 @@ function reply(content, target) {
201
281
  if (!resolved) {
202
282
  throw new Error("reply() requires content");
203
283
  }
204
- if (resolved.type === "reply" || resolved.type === "edit" || resolved.type === "reaction" || resolved.type === "group" || resolved.type === "typing") {
284
+ if (resolved.type === "reply" || resolved.type === "edit" || resolved.type === "reaction" || resolved.type === "group" || resolved.type === "typing" || resolved.type === "rename" || resolved.type === "avatar") {
205
285
  throw new Error(`reply() cannot wrap "${resolved.type}" content`);
206
286
  }
207
287
  return asReply({ content: resolved, target });
@@ -210,10 +290,10 @@ function reply(content, target) {
210
290
  }
211
291
 
212
292
  // src/content/typing.ts
213
- import z8 from "zod";
214
- var typingSchema = z8.object({
215
- type: z8.literal("typing"),
216
- state: z8.enum(["start", "stop"])
293
+ import z11 from "zod";
294
+ var typingSchema = z11.object({
295
+ type: z11.literal("typing"),
296
+ state: z11.enum(["start", "stop"])
217
297
  });
218
298
  function typing(state = "start") {
219
299
  return {
@@ -405,7 +485,9 @@ var supportsAnsiColor = () => {
405
485
  var FIRE_AND_FORGET_TYPES = /* @__PURE__ */ new Set([
406
486
  "reaction",
407
487
  "typing",
408
- "edit"
488
+ "edit",
489
+ "rename",
490
+ "avatar"
409
491
  ]);
410
492
  var isFireAndForget = (item) => FIRE_AND_FORGET_TYPES.has(item.type) || item.__fireAndForget === true;
411
493
  var RESERVED_SPACE_KEYS = /* @__PURE__ */ new Set([
@@ -414,6 +496,8 @@ var RESERVED_SPACE_KEYS = /* @__PURE__ */ new Set([
414
496
  "send",
415
497
  "edit",
416
498
  "getMessage",
499
+ "rename",
500
+ "avatar",
417
501
  "startTyping",
418
502
  "stopTyping",
419
503
  "responding"
@@ -697,6 +781,21 @@ function buildSpace(params) {
697
781
  await space.send(edit(newContent, message));
698
782
  },
699
783
  getMessage: getMessageImpl,
784
+ rename: async (displayName) => {
785
+ await space.send(rename(displayName));
786
+ },
787
+ avatar: (async (input, options) => {
788
+ if (typeof input === "string") {
789
+ await space.send(avatar(input, options));
790
+ return;
791
+ }
792
+ if (!options?.mimeType) {
793
+ throw new Error(
794
+ "space.avatar(Buffer) requires options.mimeType \u2014 pass { mimeType: '...' }"
795
+ );
796
+ }
797
+ await space.send(avatar(input, { mimeType: options.mimeType }));
798
+ }),
700
799
  startTyping: async () => {
701
800
  await space.send(typing("start"));
702
801
  },
@@ -1025,6 +1124,9 @@ export {
1025
1124
  attachmentSchema,
1026
1125
  asAttachment,
1027
1126
  attachment,
1127
+ photoActionSchema,
1128
+ buildPhotoAction,
1129
+ avatar,
1028
1130
  asCustom,
1029
1131
  custom,
1030
1132
  textSchema,
@@ -1035,6 +1137,7 @@ export {
1035
1137
  reactionSchema,
1036
1138
  asReaction,
1037
1139
  reaction,
1140
+ rename,
1038
1141
  reply,
1039
1142
  typing,
1040
1143
  UnsupportedError,