spectrum
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSpectrum
Spectrum
Spectrum is Photon's unified messaging SDK. Write your handler logic once against a single stream and deliver it across every platform — iMessage, WhatsApp Business, your terminal, or a custom platform you build yourself.
app.messagesThe current SDK is (TypeScript). Spectrum is multi-platform by design and multi-language is on the roadmap — additional language SDKs (e.g. Python, Go, Swift) will join the family. The architecture, primitives, and patterns described in this skill are intended to be language-neutral; code samples in the topic files are currently TypeScript and are flagged where the API surface is language-specific (imports, syntax, runtime types).
spectrum-tsSpectrum是Photon推出的统一消息SDK。只需针对单一流编写一次处理逻辑,即可将其部署到所有平台——iMessage、WhatsApp Business、终端,或是你自行构建的自定义平台。
app.messages当前的SDK为**(TypeScript)。Spectrum从设计之初就支持多平台,且多语言版本已在规划路线图中**——未来将推出更多语言的SDK(如Python、Go、Swift)。本技能中描述的架构、原语与模式均为语言无关;主题文件中的代码示例目前为TypeScript,当API表面存在语言特定内容(导入语句、语法、运行时类型)时会进行标记。
spectrum-tsHow this skill is organized
本技能的组织结构
Each topic lives in its own file in this directory. Read the file relevant to the user's question.
| File | When to consult |
|---|---|
| Installation, the |
| Receiving messages, the |
| Content builders for outgoing messages: |
| The |
| |
| Recovering platform-specific types from generic Spectrum primitives. |
| iMessage provider — cloud, local, dedicated modes, line model, per-phone routing, message effects, tapbacks. |
| Terminal TUI provider — chat sidebar, reactions, replies, attachments, slash commands. |
| WhatsApp Business Cloud API. 1:1 only. |
| Per-provider event streams ( |
| Authoring your own provider with |
| Production architecture patterns Photon uses internally — debounce pipeline, in-flight cancellation, carry-forward, idempotent retries, per-resource memory, job-failure audit log. |
每个主题都存放在本目录下的独立文件中。请根据你的问题查阅对应的文件。
| 文件 | 适用场景 |
|---|---|
| 安装、 |
| 消息接收、 |
| 用于发送消息的内容构建器: |
| |
| |
| 从通用Spectrum原语中恢复平台特定类型。 |
| iMessage提供商——云、本地、专用模式、线路模型、按手机路由、消息特效、轻触反馈(tapbacks)。 |
| 终端TUI提供商——聊天侧边栏、消息反应、回复、附件、斜杠命令。 |
| WhatsApp Business云API。仅支持一对一消息。 |
| 按提供商划分的事件流( |
| 使用 |
| Photon内部采用的生产架构模式——防抖流水线、在途请求取消、状态延续、幂等重试、按资源划分内存、作业失败审计日志。 |