Skip to content

Commit 7f0cced

Browse files
docs: update spectrum-ts documentation for v1.12.0 (#47)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 73899f7 commit 7f0cced

5 files changed

Lines changed: 80 additions & 8 deletions

File tree

docs-src/spectrum-ts/content.mdx.vel

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: "Content"
3-
description: "Build text, attachments, voice, contacts, polls, rich links, groups, replies, edits, typing indicators, and platform-specific content for outgoing messages"
3+
description: "Build text, attachments, voice, contacts, polls, rich links, groups, replies, edits, typing indicators, rename, avatar, and platform-specific content for outgoing messages"
44
---
55

66
import { TypeTooltip } from "/snippets/type-tooltip.mdx";
77

88
{% set ci = symbol("ts:spectrum-ts#ContentInput") %}
99
{% set cb = symbol("ts:spectrum-ts#ContentBuilder") %}
1010

11-
Spectrum exposes a family of content builders — `text`, `attachment`, `voice`, `contact`, `richlink`, `poll`, `group`, `custom`, `reaction`, `reply`, `edit`, and `typing` — plus a string shortcut that's equivalent to `text()`. Any API that takes a <TypeTooltip name="ContentInput" type={`{{ ci.signature }}`} /> accepts a plain string or a <TypeTooltip name="ContentBuilder" type={`{{ cb.signature }}`} />.
11+
Spectrum exposes a family of content builders — `text`, `attachment`, `voice`, `contact`, `richlink`, `poll`, `group`, `custom`, `reaction`, `reply`, `edit`, `typing`, `rename`, and `avatar` — plus a string shortcut that's equivalent to `text()`. Any API that takes a <TypeTooltip name="ContentInput" type={`{{ ci.signature }}`} /> accepts a plain string or a <TypeTooltip name="ContentBuilder" type={`{{ cb.signature }}`} />.
1212

1313
## Text
1414

@@ -212,7 +212,7 @@ import { reply, text } from "spectrum-ts";
212212
await space.send(reply(text("Got it"), message));
213213
```
214214

215-
`reply()` cannot wrap `reply`, `edit`, `reaction`, `group`, or `typing` content.
215+
`reply()` cannot wrap `reply`, `edit`, `reaction`, `group`, `typing`, `rename`, or `avatar` content.
216216

217217
## Edits
218218

@@ -225,7 +225,7 @@ const sent = await space.send("Draft");
225225
await space.send(edit(text("Final version"), sent));
226226
```
227227

228-
`edit()` cannot wrap `edit`, `reply`, `reaction`, `group`, or `typing` content.
228+
`edit()` cannot wrap `edit`, `reply`, `reaction`, `group`, `typing`, `rename`, or `avatar` content.
229229

230230
## Typing indicators
231231

@@ -240,6 +240,41 @@ await space.send(typing("stop")); // stop typing
240240

241241
`space.startTyping()`, `space.stopTyping()`, and `space.responding(fn)` are sugar over `space.send(typing(...))`. Platforms without a typing-indicator API silently no-op.
242242

243+
## Rename
244+
245+
Rename the current chat. Fire-and-forget — `space.send(rename(...))` resolves to `undefined`.
246+
247+
```ts
248+
import { rename } from "spectrum-ts";
249+
250+
await space.send(rename("New Chat Name"));
251+
```
252+
253+
`space.rename(displayName)` is sugar for `space.send(rename(displayName))`. The builder throws at construction time if `displayName` is empty. Per-platform constraints (e.g. iMessage requires remote mode and a group chat) surface as `UnsupportedError` from the provider's send action.
254+
255+
## Avatar
256+
257+
Set or clear the chat avatar (group icon). Fire-and-forget — `space.send(avatar(...))` resolves to `undefined`.
258+
259+
```ts
260+
import { avatar } from "spectrum-ts";
261+
262+
// Set from a file path — MIME type inferred from the extension
263+
await space.send(avatar("./icon.png"));
264+
265+
// Set from a buffer — mimeType is required
266+
await space.send(avatar(buffer, { mimeType: "image/jpeg" }));
267+
268+
// Clear the current avatar
269+
await space.send(avatar("clear"));
270+
```
271+
272+
`space.avatar(...)` is sugar for `space.send(avatar(...))`. Per-platform constraints (e.g. iMessage requires remote mode and a group chat) surface as `UnsupportedError` from the provider's send action.
273+
274+
<Note>
275+
The string `"clear"` is a reserved sentinel. If you have a file literally named `clear` with no extension, pass `"./clear"` or load it as a `Buffer`.
276+
</Note>
277+
243278
## Composing multiple items
244279

245280
All send methods take a variadic list. Items are sent sequentially as separate messages:

docs-src/spectrum-ts/introduction.mdx.vel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Every provider feeds the same message stream. Your agent can send, react, reply,
7979

8080
iMessage is where Spectrum is most mature.
8181

82-
Spectrum gives you production iMessage infrastructure with the richest iMessage feature set we offer today. You get managed iMessage lines, so your agent can run on any server and connect to iMessage through Spectrum. The managed iMessage provider supports local development, DMs and groups, typing indicators, reactions, threaded replies, group creation, message effects, chat backgrounds, per-line routing, dedicated line auto-scale, and automatic token renewal.
82+
Spectrum gives you production iMessage infrastructure with the richest iMessage feature set we offer today. You get managed iMessage lines, so your agent can run on any server and connect to iMessage through Spectrum. The managed iMessage provider supports local development, DMs and groups, typing indicators, reactions, threaded replies, group creation, message effects, chat backgrounds, chat renaming, group avatars, per-line routing, dedicated line auto-scale, and automatic token renewal.
8383

8484
That matters because iMessage is not a generic SMS fallback. Users expect native behavior, reliable delivery, and conversations that feel like they belong on Apple devices.
8585

docs-src/spectrum-ts/providers/imessage.mdx.vel

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ The iMessage provider supports three connection modes — local, cloud, and dedi
3737
```
3838

3939
<Note>
40-
Local mode only supports sending text and attachments. Reactions, typing indicators, threaded replies, group creation, and chat backgrounds are not available.
40+
Local mode only supports sending text and attachments. Reactions, typing indicators, threaded replies, group creation, chat backgrounds, chat renaming, and group avatars are not available.
4141
</Note>
4242
</Tab>
4343
<Tab title="Dedicated">
@@ -170,6 +170,41 @@ The wrapped content can be a string or any `attachment(...)`. Effects only apply
170170
</Accordion>
171171
</AccordionGroup>
172172

173+
## Chat renaming
174+
175+
Rename a group chat using `space.rename()` or the canonical `rename()` content builder:
176+
177+
```ts
178+
import { rename } from "spectrum-ts";
179+
180+
// Sugar
181+
await space.rename("Book Club");
182+
183+
// Canonical
184+
await space.send(rename("Book Club"));
185+
```
186+
187+
Renaming requires cloud or dedicated mode and only works on group chats. In local mode or on a DM, `rename()` throws an `UnsupportedError`.
188+
189+
## Group avatars
190+
191+
Set or clear the group chat icon using `space.avatar()` or the canonical `avatar()` content builder:
192+
193+
```ts
194+
import { avatar } from "spectrum-ts";
195+
196+
// Sugar — set from a file path
197+
await space.avatar("./icon.png");
198+
199+
// Sugar — clear the current avatar
200+
await space.avatar("clear");
201+
202+
// Canonical
203+
await space.send(avatar("./icon.png"));
204+
```
205+
206+
Group avatars require cloud or dedicated mode and only work on group chats. In local mode or on a DM, `avatar()` throws an `UnsupportedError`.
207+
173208
## Chat backgrounds
174209

175210
Set or clear the chat background image. Import `background` from the iMessage provider and use the sugar method on a narrowed space:

docs-src/spectrum-ts/reactions-and-replies.mdx.vel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Both forms are equivalent — `message.reply(content)` wraps each content item i
7373

7474
On platforms with thread support (iMessage, WhatsApp Business), this sends a threaded reply. On platforms without, the call resolves as a no-op — **the reply is not downgraded to a regular send**. If you need guaranteed delivery, use `space.send(...)` instead.
7575

76-
`reply()` cannot wrap `reply`, `edit`, `reaction`, `group`, or `typing` content — the builder throws at construction time.
76+
`reply()` cannot wrap `reply`, `edit`, `reaction`, `group`, `typing`, `rename`, or `avatar` content — the builder throws at construction time.
7777

7878
## Editing messages
7979

@@ -96,7 +96,7 @@ On platforms with thread support (iMessage, WhatsApp Business), this sends a thr
9696

9797
`edit()` takes new content and the outbound message to rewrite. Edits are fire-and-forget — `space.send(edit(...))` resolves to `undefined`.
9898

99-
`edit()` cannot wrap `edit`, `reply`, `reaction`, `group`, or `typing` content.
99+
`edit()` cannot wrap `edit`, `reply`, `reaction`, `group`, `typing`, `rename`, or `avatar` content.
100100

101101
## When to use what
102102

docs-src/spectrum-ts/spaces-and-users.mdx.vel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Every <TypeTooltip name="Space" type={`{{ space.signature }}`} /> exposes the sa
2020
| `startTyping()` | Show a typing indicator. No-op if the platform doesn't support it. |
2121
| `stopTyping()` | Hide the typing indicator. |
2222
| `responding(fn)` | Start a typing indicator, run `fn`, and stop the indicator when it completes — even if `fn` throws. |
23+
| `rename(displayName)` | Rename the chat. Sugar for `send(rename(displayName))`. |
24+
| `avatar(input, options?)` | Set or clear the chat avatar. Sugar for `send(avatar(input, options?))`. |
2325

2426
```ts
2527
for await (const [space, message] of app.messages) {

0 commit comments

Comments
 (0)