dsh-agora 0.2.5 → 0.2.7

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/index.js CHANGED
@@ -1,76 +1,49 @@
1
- // dsh-agora — bundled skill providers for DeepSeek Harness.
1
+ // dsh-agora — bundled skill provider for DeepSeek Harness.
2
2
  //
3
- // Registers two skills on ctx.skills, mirroring the official
4
- // `@deepseek-ai/dsh-skill-badge` provider pattern:
5
- // - `agora` — the official Agora skill, synced verbatim from
6
- // AgoraIO/skills at a pinned release tag (zero rewrite).
7
- // The SKILL.md body and references/ live in assets/agora/.
8
- // - `agora-cn` — a shell-maintained companion documenting only the
9
- // China-mainland (国内/声网) delta. It lives in
10
- // assets/agora-cn/, which scripts/sync-deps.sh never touches.
3
+ // Registers a single `agora` skill on ctx.skills, mirroring the official
4
+ // `@deepseek-ai/dsh-skill-badge` provider pattern: a Cordis plugin whose
5
+ // apply() registers one immutable provider. The SKILL.md body and references/
6
+ // live in assets/agora/.
7
+ //
8
+ // assets/agora/ is produced by scripts/sync-deps.sh at prepack time:
9
+ // 1. rsync the official AgoraIO/skills content verbatim (zero rewrite), then
10
+ // 2. append our China-mainland (国内/声网) deltas (assets/agora-cn/*.md)
11
+ // into the corresponding product READMEs.
12
+ // So one `agora` skill covers both global and CN regions.
11
13
  import { readFile } from 'node:fs/promises'
12
14
  import { fileURLToPath } from 'node:url'
13
15
  import { BUNDLED_SKILL_RANK } from '@deepseek-ai/dsh-skill'
14
16
 
15
17
  const PROVIDER_NAME = 'agora'
16
-
17
- const AGORA_DIR_URL = new URL('./assets/agora/', import.meta.url)
18
- const AGORA_BODY_URL = new URL('./assets/agora/SKILL.md', import.meta.url)
19
-
20
- const CN_DIR_URL = new URL('./assets/agora-cn/', import.meta.url)
21
- const CN_BODY_URL = new URL('./assets/agora-cn/SKILL.md', import.meta.url)
18
+ const SKILL_DIR_URL = new URL('./assets/agora/', import.meta.url)
19
+ const SKILL_BODY_URL = new URL('./assets/agora/SKILL.md', import.meta.url)
20
+ const RESOURCE_BASE = {
21
+ kind: 'directory',
22
+ path: fileURLToPath(SKILL_DIR_URL),
23
+ }
22
24
 
23
25
  const CANDIDATE = {
24
26
  name: 'agora',
25
27
  description:
26
- 'Activate when the user wants to build voice AI agents, video or voice calls, live streaming, screen sharing, in-app messaging and presence, recording, token or auth flows, or use the `agora` CLI for login, quickstarts, env setup, diagnostics, introspection, skills, or MCP serving, especially when integrating Agora into an app. For China-mainland (国内/声网) deployment, load the `agora-cn` skill instead.',
27
- invocation: {
28
- modelInvocable: true,
29
- userInvocable: true,
30
- },
31
- provider: PROVIDER_NAME,
32
- source: 'bundled',
33
- resourceBase: {
34
- kind: 'directory',
35
- path: fileURLToPath(AGORA_DIR_URL),
36
- },
37
- rank: BUNDLED_SKILL_RANK,
38
- locator: AGORA_BODY_URL,
39
- }
40
-
41
- const CN_CANDIDATE = {
42
- name: 'agora-cn',
43
- description:
44
- 'Activate for China-mainland (国内/声网) Agora deployment: console.shengwang.cn control plane, CN endpoints on the sd-rtn.com domain, `agora login --region cn` + CN data center, ConvoAI (Area.CN → api-cn-*.sd-rtn.com/cn + CN vendor/BYOK), and CN region selection for RTC (setArea CHINA / AREA_CODE_CN), RTM (setArea areaCodes / RtmAreaCode.CN), and Cloud Recording (clientRequest.region). Use when the user wants domestic deployment, 声网, China region (CN), or mainland data residency. Supplements the `agora` skill.',
45
- whenToUse:
46
- 'Use when the user wants China-mainland (国内/声网) or CN-region deployment. Load the `agora` skill alongside it for the baseline mechanics.',
28
+ 'Activate when the user wants to build voice AI agents, video or voice calls, live streaming, screen sharing, in-app messaging and presence, recording, token or auth flows, or use the `agora` CLI for login, quickstarts, env setup, diagnostics, introspection, skills, or MCP serving, especially when integrating Agora into an app. Covers both global (console.agora.io) and China-mainland (国内/声网, console.shengwang.cn) deployments.',
47
29
  invocation: {
48
30
  modelInvocable: true,
49
31
  userInvocable: true,
50
32
  },
51
33
  provider: PROVIDER_NAME,
52
34
  source: 'bundled',
53
- resourceBase: {
54
- kind: 'directory',
55
- path: fileURLToPath(CN_DIR_URL),
56
- },
35
+ resourceBase: RESOURCE_BASE,
57
36
  rank: BUNDLED_SKILL_RANK,
58
- locator: CN_BODY_URL,
59
- }
60
-
61
- const BODY_BY_NAME = {
62
- agora: AGORA_BODY_URL,
63
- 'agora-cn': CN_BODY_URL,
37
+ locator: SKILL_BODY_URL,
64
38
  }
65
39
 
66
40
  const provider = {
67
41
  name: PROVIDER_NAME,
68
- list: () => Promise.resolve([CANDIDATE, CN_CANDIDATE]),
69
- async get(candidate) {
70
- const bodyUrl = BODY_BY_NAME[candidate.name]
42
+ list: () => Promise.resolve([CANDIDATE]),
43
+ async get(_candidate) {
71
44
  return {
72
- ...candidate,
73
- content: bodyUrl ? await readFile(bodyUrl, 'utf8') : '',
45
+ ...CANDIDATE,
46
+ content: await readFile(SKILL_BODY_URL, 'utf8'),
74
47
  }
75
48
  },
76
49
  }
@@ -79,7 +52,7 @@ const provider = {
79
52
  export const name = 'agora-skills'
80
53
  /** Service required by the bundled provider. */
81
54
  export const inject = ['skills']
82
- /** Register the bundled `agora` providers on `ctx.skills`. */
55
+ /** Register the bundled `agora` provider on `ctx.skills`. */
83
56
  export function apply(ctx) {
84
57
  ctx.skills.registerProvider(() => provider)
85
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agora",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "DSH skill bundle: the Agora skill (RTC, RTM, ConvoAI, CLI, Cloud Recording, tokens) synced verbatim from AgoraIO/skills at a pinned release tag. Install to add the `agora` skill to DeepSeek Harness.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -12,8 +12,7 @@
12
12
  "files": [
13
13
  "index.js",
14
14
  "cordis.patch.yml",
15
- "assets/agora",
16
- "assets/agora-cn"
15
+ "assets/agora"
17
16
  ],
18
17
  "license": "MIT",
19
18
  "repository": {
@@ -1,58 +0,0 @@
1
- ---
2
- name: agora-cn
3
- description: >-
4
- Activate for China-mainland (国内/声网) Agora deployment: console.shengwang.cn
5
- control plane, CN endpoints on the sd-rtn.com domain, `agora login --region
6
- cn` + CN data center, ConvoAI (Area.CN → api-cn-*.sd-rtn.com/cn + CN vendor/
7
- BYOK), and CN region selection for RTC (setArea CHINA / AREA_CODE_CN), RTM
8
- (setArea areaCodes / RtmAreaCode.CN), and Cloud Recording (clientRequest.
9
- region). Use when the user wants domestic deployment, 声网, China region (CN),
10
- or mainland data residency. Supplements the `agora` skill.
11
- metadata:
12
- author: agora
13
- version: '0.1.0'
14
- ---
15
-
16
- # Agora 国内区域(声网 / CN Region)
17
-
18
- > 本 skill 是 `agora` 的**国内补充**:只覆盖"大陆 / 声网 / CN 区域"与海外版的差异。
19
- > 基础机制(quickstart、token flow、生命周期)仍以 `agora` skill 为准。
20
- > 验证基线:CLI `0.2.8`(本机 `introspect --json` 实测)+ 声网/海外官方文档对照(各产品 SDK 版本见各 reference)。
21
-
22
- ## 何时用本 skill
23
-
24
- 用户目标是**国内/大陆部署**、`声网`、`console.shengwang.cn`、`CN 区域`、或国内数据合规时使用。
25
- 否则仍走 `agora`。
26
-
27
- ## 国内 vs 海外:四件套差异
28
-
29
- 1. **账号**:国内控制台是 `console.shengwang.cn`(声网),且需在控制台**开通对应服务**(海外没有这个独立步骤)。
30
- 2. **CLI**:`agora login --region cn`;`agora init --rtm-data-center CN`。
31
- 3. **端点**:各产品 CN 端点以 `sd-rtn.com` 为主域名(详见各产品 reference)。
32
- 4. **vendor**:ConvoAI 需换 CN vendor 目录,并按 managed/BYOK 矩阵填 key(详见 `conversational-ai.md`)。
33
-
34
- ## Routing(按产品,与 `agora` 同构)
35
-
36
- | 产品 | 国内 delta | 读这里 |
37
- |---|---|---|
38
- | **RTC** | area code / CN 域名 / 云代理 | [references/rtc.md](references/rtc.md) ✅ |
39
- | **RTM** | region / 数据中心 | [references/rtm.md](references/rtm.md) ✅ |
40
- | **Cloud Recording** | CN 端点 / `clientRequest.region` / 存储 | [references/cloud-recording.md](references/cloud-recording.md) ✅ |
41
- | **Server(token)** | token 不变 / CN 域名 / 菜单路径 | [references/server.md](references/server.md) ✅ |
42
- | **CLI** | 国内命令 / 版本要求 | [references/cli.md](references/cli.md) ✅ |
43
- | **ConvoAI** | 端点 + CN vendor + managed/BYOK | [references/conversational-ai.md](references/conversational-ai.md) 📋 现状已记录(端到端待验证) |
44
-
45
- ## 状态标注(诚实边界)
46
-
47
- | 状态 | 内容 |
48
- |---|---|
49
- | ✅ 已确认(源码/文档级) | RTC/RTM/Cloud Recording/Server/CLI 国内 delta 已填实(各文件内仍有"待验证"小节) |
50
- | 📋 ConvoAI 现状 | 端点 + CN vendor + managed/BYOK 已源码确认;但**免-key 直接启动体验未端到端验证**,不承诺与海外一致 |
51
- | ⚠️ 待运行时验证 | 原生 RTC/RTM 精确信令 host、`clientRequest.region` 是否需显式传、迁移期 `api.agora.io` 可用性、ConvoAI 免-key 组合等(见各文件"待验证") |
52
-
53
- ## Guardrails
54
-
55
- 1. **本 skill 只补差异**;quickstart 克隆 / 生命周期 / token / baseline-first 约束沿用 `agora` skill。
56
- 2. **区域取值别混用**:Web SDK 用 `"CHINA"`、原生 SDK 用 `CN`(RTC/RTM 一致);RTM Web 是复数 `areaCodes`、RTC Web 是单数 `areaCode`。
57
- 3. **ConvoAI 别断言"改一行 `Area` 就国内跑通"**:`Area.CN` 只解决端点路由,vendor 仍需换 CN 类并处理 key;国内免-key 体验未验证。
58
- 4. 未在本 skill 标注为"已确认"的能力,不要凭记忆承诺;必要时回落到声网官方文档(`doc.shengwang.cn`)现查。
@@ -1,41 +0,0 @@
1
- ---
2
- name: agora-cn-cli
3
- description: |
4
- China-mainland Agora CLI commands: login/console region, CN RTM data center,
5
- webhook delivery region, and the version requirement for CN flags. Use for
6
- 国内 CLI, agora login --region cn, or --rtm-data-center CN.
7
- license: MIT
8
- metadata:
9
- author: agora
10
- version: '0.1.0'
11
- ---
12
-
13
- # 国内 CLI 命令与版本
14
-
15
- 验证基线:CLI `0.2.8`(`agora introspect --json` 实测)。
16
-
17
- > 注意版本漂移:`agora` skill 内容基线是 CLI `0.2.1`,其中 `agora project create --region global|cn`
18
- > 在 `0.2.8` 已**不存在**——国内 flag 已经搬家到 login / data-center。
19
-
20
- ## 国内命令面(0.2.8 实测)
21
-
22
- - 登录国内控制台:`agora login --region cn`(等价 `agora auth login --region cn`;默认 `global`)
23
- - RTM 数据中心:`agora project create ... --rtm-data-center CN`(可选 `CN|NA|EU|AP`,默认 `NA`)
24
- - 一键脚手架:`agora init <name> --template <t> --rtm-data-center CN`
25
- - Webhook 投递区域:`agora project webhook create ... --delivery-region cn`(可选 `cn|sea|na|eu`)
26
-
27
- ## 版本要求
28
-
29
- - CN 入口(`login --region cn`、`--rtm-data-center CN`)比 `agora` skill 的验证基线 `0.2.1` 新。
30
- - **确切引入版本待钉**:本机 `0.2.8` 已实测具备这两个 flag;低于该版本的 CLI 没有它们。
31
- - 落地建议:国内路径要求 CLI 至少为实测具备 CN flag 的版本(当前以 `0.2.8` 为参照下界)。
32
-
33
- ## 端点相关环境变量(`agora env-help --json` 实测)
34
-
35
- - `AGORA_CONSOLE_URL` — 覆盖 `agora open --target console` 的 URL
36
- - `AGORA_API_BASE_URL`(默认 `https://agora-cli.agora.io`)
37
- - `AGORA_OAUTH_BASE_URL`(默认 `https://sso2.agora.io`)
38
-
39
- ## 待验证
40
-
41
- - `agora login --region cn` 的 OAuth 流程端到端(需声网账号实测)。
@@ -1,59 +0,0 @@
1
- ---
2
- name: agora-cn-cloud-recording
3
- description: |
4
- China-mainland (国内/声网) Cloud Recording delta: 声网 console + enable-service,
5
- the (now-unified) api.sd-rtn.com base URL, clientRequest.region="CN", and CN
6
- storage regions. Use for 国内录制, cloud recording CN, clientRequest.region, 录制存储.
7
- license: MIT
8
- metadata:
9
- author: agora
10
- version: '0.1.0'
11
- ---
12
-
13
- # 国内 Cloud Recording:控制台 / 端点 / 存储
14
-
15
- 验证基线:声网 `doc.shengwang.cn` 与海外 `docs.agora.io` 对照。
16
-
17
- ## 已确认的国内 delta
18
-
19
- ### 1. 控制台 / 账号 / 开通
20
-
21
- - 国内控制台 `console.shengwang.cn`(声网)。App ID / App 证书 / 客户 ID·密钥 / 开通服务都在声网控制台完成。
22
- - 需先**开通云端录制服务**(项目类型选**通用项目**)。
23
-
24
- ### 2. 端点:`api.sd-rtn.com`(关键修正:云端录制已基本统一,非 CN 独有)
25
-
26
- - 国内 quick-start 全程 `https://api.sd-rtn.com/v1/apps/{appid}/cloud_recording/...`(acquire/start/stop 一致)。
27
- - **海外 canonical 参考也写 base URL `https://api.sd-rtn.com`**——即云端录制当前 base URL 在两套文档里**已统一为 `api.sd-rtn.com`**。
28
- `api.agora.io` 只残留在海外 quickstart/认证示例里,属陈旧内容。
29
- - 路径与海外**完全一致,且无 `/cn/` 前缀**。
30
-
31
- ### 3. CN 区域绑定:`clientRequest.region = "CN"`
32
-
33
- - acquire 请求体有 `clientRequest.region`(string):`"CN"`(中国大陆)/ `"AP"` / `"EU"` / `"NA"`。
34
- - 默认「使用发起请求所在服务器的区域」;一旦显式设置,服务不访问该区域之外。
35
- - **约束**:`start` 时第三方云存储的 `region` 必须与之匹配。
36
-
37
- ## 与海外一致(无 delta)
38
-
39
- - **操作路径**:acquire / start / query / update / updateLayout / stop 六个操作 path 完全一致。
40
- - **存储 vendor 枚举**:`1`=Amazon S3、`2`=阿里云 OSS、`3`=腾讯云 COS、`5`=Azure、`6`=GCP、`7`=华为云 OBS、`8`=百度云 BOS、`11`=其他 S3(需 `extensionParams.endpoint`);无 vendor 4。
41
- - **存储 region(大陆可用,两边都有)**:阿里云 `CN_*`(杭州/上海/北京/广州/成都…)、腾讯云 `AP_Beijing/AP_Shanghai/AP_Guangzhou/…`、AWS `CN_NORTH_1`/`CN_NORTHWEST_1`、华为云 `CN_*`、百度云(保定/苏州/广州)。
42
- - **鉴权机制**:HTTP Basic Auth `Authorization: Basic base64(CustomerID:CustomerSecret)` 完全一致;仅 Customer ID/Secret 的生成控制台不同(声网:设置 → RESTful API)。
43
- - **录制模式/特性**:`individual`/`mix`/`web`、`streamMode`、`transcodingConfig`、订阅黑白名单、NCS webhook、云端截图、格式转换——均一致。
44
- - **storageConfig 字段集**:bucket/accessKey/secretKey/fileNamePrefix + `stsToken`/`stsExpiration`(S3/Aliyun/Tencent)一致。
45
-
46
- ## 待验证 / 未知
47
-
48
- 1. `clientRequest.region` 字段在**声网(CN)文档**里是否逐字一致未直接取到(CN operation 页 doc-mcp 返回"获取文档内容失败";字段已从海外 canonical acquire 参考确认,但 CN 侧逐字出处缺失)。
49
- 2. 阿里云 region 编号 26/27 命名在 CN 与海外文档不一致(一方疑似笔误,未判定哪方正确)。
50
- 3. 迁移期 `api.agora.io` 是否仍实际可用(海外 canonical 已统一为 `api.sd-rtn.com`)。
51
- 4. 是否需要显式传 `clientRequest.region="CN"`(默认按发起服务器区域;声网账号默认是否已落 CN 未实测)。硬性大陆数据驻留时建议显式 `"CN"` 并匹配存储 region,但未经运行时验证。
52
-
53
- ## 来源
54
-
55
- - 声网云端录制快速开始:https://doc.shengwang.cn/doc/cloud-recording/restful/get-started/quick-start
56
- - 声网开通服务:https://doc.shengwang.cn/doc/cloud-recording/restful/get-started/enable-service
57
- - 海外 canonical:https://docs.agora.io/en/realtime-media/cloud-recording/reference/restful-api.md
58
- - acquire `clientRequest.region`:https://docs.agora.io/en/api-reference/api-ref/cloud-recording/acquire.md
59
- - region/vendor 对照:https://docs.agora.io/en/realtime-media/cloud-recording/reference/region-vendor.md
@@ -1,110 +0,0 @@
1
- ---
2
- name: agora-cn-conversational-ai
3
- description: |
4
- China-mainland (国内/声网) Conversational AI delta: console.shengwang.cn + service
5
- enablement, CN REST endpoint routing (Area.CN), and the CN vendor catalog with its
6
- managed-vs-BYOK credential matrix. Use for 国内 voice agent, 声网 ConvoAI, Area.CN,
7
- or CN vendor/BYOK questions.
8
- license: MIT
9
- metadata:
10
- author: agora
11
- version: '0.1.0'
12
- ---
13
-
14
- # 国内 ConvoAI:现状 + 端点 / vendor
15
-
16
- > **现状说明(先读)**:国内 ConvoAI 的**端点路由 + CN vendor 清单 + managed/BYOK 矩阵已从 SDK 源码确认**
17
- > (下面这些是可信事实);但"像海外那样只填 App ID / App Certificate 就一键启动"的体验
18
- > **尚未端到端跑通**——国内 LLM/TTS 的免-key(托管)面更窄,且整条链路未经运行时验证。
19
- > 因此本文是**现状记录**,不是"照着就能跑通"的承诺;动手前按"待验证"清单实测。
20
-
21
- 验证基线:SDK `agora-agents` 2.6.0(TypeScript 与 Python 一致)。
22
-
23
- ## 账号与控制台
24
-
25
- - 国内控制台:`https://console.shengwang.cn`(声网);ConvoAI 入口
26
- `https://console.shengwang.cn/product/ConversationAI?tab=Playground`。
27
- - **开通服务(enable-service)**:国内需先在声网控制台开通 ConvoAI 服务(海外没有这个独立步骤)。
28
- - 海外控制台是 `console.agora.io`;两者账号/项目体系不同,国内用声网账号。
29
-
30
- ## CN 端点(Area.CN)
31
-
32
- `Area` 枚举(`agora-agents` 2.6.0):
33
-
34
- ```text
35
- US = 1, EU = 2, AP = 3, CN = 4 # CN = "eastern and northern regions of Chinese mainland"
36
- ```
37
-
38
- `Area.CN` 时 SDK 自动路由(DNS 解析选择):
39
-
40
- - 区域前缀:`api-cn-east-1`、`api-cn-north-1`
41
- - 主域名:`sd-rtn.com`(回退 `agora.io`)
42
- - 路径:`/cn/api/conversational-ai-agent`(海外是 `/api/conversational-ai-agent`)
43
-
44
- 即完整端点形如:
45
-
46
- ```text
47
- https://api-cn-east-1.sd-rtn.com/cn/api/conversational-ai-agent/v2/projects/{appid}/join
48
- https://api-cn-north-1.sd-rtn.com/cn/api/conversational-ai-agent/v2/projects/{appid}/join
49
- ```
50
-
51
- > 说明:声网文档示例里也出现过 `https://api.agora.io/cn/api/conversational-ai-agent/v2/projects/...`
52
- > 这种写法(`api.agora.io` + `/cn/` 路径)。以 SDK 2.6.0 的实际运行时为准:设置 `Area.CN` 后
53
- > 走 `api-cn-*.sd-rtn.com` + `/cn/` 路径。
54
-
55
- ## 区域绑定方式
56
-
57
- - 客户端:`AgoraClient({ area: Area.CN, ... })`(TS)/ `AsyncAgora(area=Area.CN, ...)`(Python)。
58
- - SDK 提供 CN 专属类:`CNAgora` / `CNAsyncAgora`(Python,预绑定 `Area.CN`)。
59
- - `Agent(client=...)` 在 `area_scope == "cn"` 时返回 `CNAgent`。
60
-
61
- ## CN vendor 目录(`agentkit/vendors/cn.py`)
62
-
63
- `area_scope == "cn"` 时切换到 CN vendor 命名空间,可选厂商与海外不同:
64
-
65
- | 类别 | CN 可选厂商 |
66
- |---|---|
67
- | ASR | fengming, tencent, microsoft, xfyun, xfyun_bigmodel, xfyun_dialect |
68
- | TTS | minimax, tencent, bytedance, microsoft, cosyvoice, bytedance_duplex, stepfun, generic |
69
- | LLM | aliyun, bytedance, deepseek, tencent |
70
- | MLLM | qwen_omni |
71
- | Avatar | sensetime, spatius |
72
-
73
- ## managed / BYOK 矩阵(源码级确认)
74
-
75
- 概念:**managed(免 key)** = 不填 vendor key、Agora 托管(常见 vendor 的表达式是"省略 api_key");
76
- **BYOK** = 填 vendor 自己的 key(LLM 还需 base_url)。没有统一的顶层 `credential_mode` 开关——
77
- `credential_mode: "managed"|"byok"` 字面量**只存在于 `RimeTTS`** 单个 vendor。
78
-
79
- | 环节 | 免 key(managed) | 需 BYOK |
80
- |---|---|---|
81
- | ASR | `fengming`(风鸣,无 key 字段,纯托管) | `tencent`(key/app_id/secret 必填)、`microsoft`;`xfyun` 系列 api_key 等可选(BYOK 时填) |
82
- | LLM | 仅白名单 `gpt-4o-mini` / `gpt-4.1-mini` / `gpt-5-nano` / `gpt-5-mini`(托管) | `deepseek` / `aliyun` / `bytedance` / `tencent` 必须 api_key + base_url |
83
- | TTS | (见"待验证") | CN `minimax` 通常要 key(官方说明 "not Agora-managed in the same way and typically includes key");`tencent` / `bytedance` / `cosyvoice` / `stepfun` |
84
- | MLLM | 无 | `qwen_omni`(api_key 必填) |
85
- | Avatar | 无 | `sensetime` / `spatius`(BYOK) |
86
-
87
- 要点:
88
-
89
- - CN 原生 LLM(DeepSeek/阿里/字节/腾讯)**没有免 key 托管**——托管白名单仍是 OpenAI 的
90
- `gpt-4o-mini` 等几个模型(`_OPENAI_MANAGED_MODELS`)。
91
- - SDK 默认 ASR:`area_scope == "cn"` 且未显式传 STT 时,默认 `fengming`(否则 `ares`)。
92
-
93
- ## 已知组合(待验证,勿当作"可用配方")
94
-
95
- 以下组合基于上面的矩阵推导,**均未端到端跑通**:
96
-
97
- 1. **免 key 最小组合(理论)**:ASR `fengming` + LLM `gpt-4o-mini`(托管白名单)+ TTS(⚠️ 是否有免 key 项未知)
98
- 2. **国内原生组合(需 BYOK)**:ASR `fengming` + LLM `deepseek`(api_key + base_url)+ TTS `minimax`(key)
99
-
100
- ## 不支持的边界
101
-
102
- - `properties.geofence.area` 可选值只有 `GLOBAL / NORTH_AMERICA / EUROPE / ASIA / INDIA / JAPAN`,
103
- **没有 `CHINA`**。即无法用 `geofence` 强制 agent 引擎只在大陆运行(`ASIA` 是最近的一档,不等于大陆)。
104
-
105
- ## 待验证 / 未知
106
-
107
- - 免 key 组合是否端到端跑通(尤其 TTS 环节)。
108
- - 国内是否存在一款完全托管的 TTS(源码里 CN MiniMax 的 `key` 为可选,但官方说明"通常要 key")。
109
- - "只把 `Area.US` 改成 `Area.CN`、vendor 仍用海外类(Deepgram/OpenAI/MiniMax)"能否在 CN 端点跑通——未实测,不要默认可行。
110
- - ConvoAI 直接 REST 在 CN 的官方推荐 host:`api.agora.io/cn/...` 还是 `api-cn-*.sd-rtn.com/cn/...`(未实测)。
@@ -1,180 +0,0 @@
1
- ---
2
- name: agora-cn-rtc
3
- description: |
4
- China-mainland (国内/声网) delta for Agora RTC (video/voice calling, live
5
- streaming, screen share, join/publish/subscribe): CN region selection
6
- (Web setArea / native areaCode), CN signaling domain (sd-rtn.com), and the
7
- cloud-proxy / firewall setup for mainland restricted networks. Use for 国内
8
- RTC, 声网 RTC, AREA_CODE_CN, setArea CHINA, or 云代理 questions.
9
- license: MIT
10
- metadata:
11
- author: agora
12
- version: '0.1.0'
13
- ---
14
-
15
- # 国内 RTC 差异(声网 / CN Region)
16
-
17
- > 本页只记录国内(大陆 / 声网 / CN 区域)与海外 RTC 的差异。
18
- > 基础机制(join / publish / subscribe / token / channel profile)仍以 `agora` skill 的
19
- > `references/rtc/*` 为准。海外基线里**完全没有** region/area/domain 内容,本页补齐。
20
-
21
- 验证基线:Web SDK `agora-rtc-sdk-ng` 4.24.7(`rtc-sdk_en.d.ts` 实测);原生 SDK 4.x 声网文档
22
- (`doc.shengwang.cn` + `docs-md.agora.io`)。
23
-
24
- ---
25
-
26
- ## 已确认的国内 delta
27
-
28
- ### 1. Web SDK(`agora-rtc-sdk-ng`)选择 CN 区域
29
-
30
- **正确 API 是 `AgoraRTC.setArea`,值是大写 `"CHINA"`,不是 `"CN"`。**
31
-
32
- ```js
33
- // 只连国内服务器
34
- AgoraRTC.setArea({ areaCode: "CHINA" });
35
-
36
- // 或:全球里排除中国大陆
37
- AgoraRTC.setArea({ areaCode: "GLOBAL", excludedArea: "CHINA" });
38
- ```
39
-
40
- - 枚举:`AREAS.CHINA = "CHINA"`(`ASIA / NORTH_AMERICA / EUROPE / JAPAN / INDIA / GLOBAL` 等并列)。
41
- - TS 签名(4.24.7):`setArea(area: AREAS[] | { areaCode: AREAS[]; excludedArea?: AREAS })`,自 4.2.0 起。
42
- - ⚠️ **不是** `AgoraRTC.createClient({ areaCode: "CN" })`:4.x 的 `ClientConfig` 里没有 `areaCode` 字段
43
- (`createClient` 只接受 `mode/codec/role/clientRoleOptions` 等)。
44
- - ⚠️ **没有**静态 `AgoraRTC.setCloudProxy`(这个猜测不存在于当前 Web SDK)。
45
-
46
- 来源:
47
- - `https://cdn.jsdelivr.net/npm/agora-rtc-sdk-ng@4.24.7/rtc-sdk_en.d.ts`(`AREAS` 枚举 + `setArea` 签名 + `ClientConfig`)
48
- - `https://registry.npmjs.org/agora-rtc-sdk-ng`(latest = 4.24.7)
49
- - `https://doc.shengwang.cn/doc/rtc/javascript/advanced-features/region`
50
-
51
- ### 2. Web SDK 云代理(受限网络)
52
-
53
- 云代理是 **client 实例方法**,不是全局静态方法;需先向声网申请开通。
54
-
55
- ```js
56
- const client = AgoraRTC.createClient({ mode: "rtc", codec: "vp8" });
57
-
58
- client.startProxyServer(3); // 3 = Force UDP 云代理;5 = Force TCP/TLS 443(v4.9.0+)
59
- await client.join(APP_ID, channel, token, null);
60
- // ...
61
- await client.leave();
62
- client.stopProxyServer(); // 离开频道后才能关闭
63
- ```
64
-
65
- - `startProxyServer` 必须在 `join` **之前**调用;`stopProxyServer` 必须在 `leave` **之后**调用。
66
- - 开通前置:联系 `sales@shengwang.cn` 提供 App ID / 使用区域 / 并发规模 / 运营商(不是开箱即用)。
67
- - 判断媒体是否走代理:`client.on("is-using-cloud-proxy", (isUsingProxy) => ...)`。
68
- - 自建代理(私有化/混合部署,非云代理):`client.setProxyServer(domain)`(ASCII 域名)+ `client.setTurnServer(config)`;
69
- 二者与 `startProxyServer` **不能混用**。
70
-
71
- 来源:
72
- - `https://doc.shengwang.cn/doc/rtc/javascript/basic-features/firewall`
73
- - `https://cdn.jsdelivr.net/npm/agora-rtc-sdk-ng@4.24.7/rtc-sdk_en.d.ts`(`startProxyServer`/`stopProxyServer`/`setProxyServer`)
74
-
75
- ### 3. 原生 SDK 区域码(Android / iOS / C++)
76
-
77
- **Android**(`RtcEngineConfig.mAreaCode`):
78
-
79
- ```java
80
- RtcEngineConfig config = new RtcEngineConfig();
81
- config.mAppId = appId;
82
- config.mContext = mContext;
83
- config.mAreaCode = AREA_CODE_CN; // 中国大陆
84
- mRtcEngine = RtcEngine.create(config);
85
- ```
86
-
87
- - 常量 `AREA_CODE_CN = 0x00000001`(`Constants.AreaCode`)。其余:`AREA_CODE_GLOB`(默认)/ `NA` / `EU` / `AS` / `JP` / `IN`。
88
- - 支持位运算:排除大陆用 `AREA_CODE_GLOB ^ AREA_CODE_CN`。
89
-
90
- **iOS**(`AgoraRtcEngineConfig.areaCode`):
91
-
92
- ```swift
93
- let config = AgoraRtcEngineConfig()
94
- config.appId = "YourAppId"
95
- config.areaCode = .CN // AgoraAreaCodeTypeCN
96
- agoraKit = AgoraRtcEngineKit.sharedEngine(with: config, delegate: self)
97
- ```
98
-
99
- - 枚举:`AgoraAreaCodeTypeGlobal`(默认)/ `AgoraAreaCodeTypeCN` / `...NA` / `...EUR` / `...AS` / `...JP` / `...IN`。
100
-
101
- **C++ / Windows**(`RtcEngineContext.areaCode`):
102
-
103
- ```cpp
104
- RtcEngineContext context;
105
- context.appId = appId;
106
- context.areaCode = AREA_CODE_CN; // 中国大陆
107
- m_rtcEngine->initialize(context);
108
- ```
109
-
110
- 来源:
111
- - `https://doc.shengwang.cn/doc/rtc/android/advanced-features/region`
112
- - `https://doc.shengwang.cn/doc/rtc/ios/advanced-features/region`
113
- - `https://doc.shengwang.cn/doc/rtc/windows/advanced-features/region`
114
- - `https://doc.shengwang.cn/api-ref/rtc/android/API/class_areacode`(`AREA_CODE_CN = 0x00000001`)
115
-
116
- ### 4. 原生 SDK 云代理(受限网络)
117
-
118
- 原生在受限网络下**只支持云代理,不支持防火墙域名白名单**(见 §6 表格)。
119
-
120
- - Android/C++:`RtcEngine.setCloudProxy(proxyType)`
121
- - `TRANSPORT_TYPE_NONE_PROXY`(0) 默认自动;`TRANSPORT_TYPE_UDP_PROXY`(1) Force UDP;`TRANSPORT_TYPE_TCP_PROXY`(2) Force TCP/TLS 443。
122
- - iOS:`setCloudProxy(_ proxyType: AgoraCloudProxyType)`
123
- - `AgoraNoneProxy`(0) / `AgoraUdpProxy`(1) / `AgoraTcpProxy`(2)。
124
- - 需在频道外调用,`RtcEngine` 生命周期内有效;同样要先向 `sales@shengwang.cn` 申请开通并加白名单 IP。
125
-
126
- 来源:
127
- - `https://doc.shengwang.cn/doc/rtc/android/basic-features/firewall`
128
- - `https://doc.shengwang.cn/api-ref/rtc/ios/API/enum_cloudproxytype`
129
-
130
- ### 5. CN 域名后缀 / 信令域名
131
-
132
- - 国内主域名后缀 **`sd-rtn.com`**(海外 `agora.io`)。
133
- - Web SDK 防火墙白名单域名(国内部分):
134
- `*.sd-rtn.com`、`*.edge.sd-rtn.com`、`*.ap.sd-rtn.com`、`*.statscollector.sd-rtn.com`、`*.webrtc-cloud-proxy.sd-rtn.com`
135
- (海外是 `*.agora.io` / `*.edge.agora.io`)。
136
- - REST API 主域名(服务端在大陆时):`api.sd-rtn.com`(海外 `api.agora.io`);CN 区域子域
137
- `api-cn-east-1.sd-rtn.com` / `api-cn-north-1.sd-rtn.com`。
138
-
139
- 来源:
140
- - `https://docs-md.agora.io/en/broadcast-streaming/reference/firewall_web.md`
141
- - `https://docs-md.agora.io/en/broadcast-streaming/channel-management-api/best-practices/ensure-service-reliability.md`
142
-
143
- ### 6. 网络/防火墙策略差异(Web vs 原生)
144
-
145
- | 产品 | 防火墙域名白名单 | 声网云代理 |
146
- |---|---|---|
147
- | Video SDK(原生 / 三方框架) | ✘ 不支持 | ✔ |
148
- | Video SDK(Web) | ✔ | ✔ |
149
-
150
- - 即:**原生 RTC 在受限网络只能走云代理**(申请开通 + `setCloudProxy`);只有 Web SDK 能走域名白名单。
151
-
152
- 来源:
153
- - `https://docs-md.agora.io/en/broadcast-streaming/reference/firewall_android.md`
154
-
155
- ---
156
-
157
- ## 与海外一致(无 delta)
158
-
159
- - **凭据模型**:App ID + App Certificate + token(`join` 传 token)这套完全不变;国内只是去
160
- `console.shengwang.cn`(声网)建项目拿 App ID,拿到后 SDK 用法与海外一致。
161
- - **频道机制**:`joinChannel` / `createClient` / `publish` / `subscribe` / channel profile
162
- (`rtc`/`live`) / client role (`host`/`audience`) 全部同海外。
163
- - **token 续期**:`token-privilege-will-expire`(Web)/ `onTokenPrivilegeWillExpire`(原生)+ `renewToken` 同海外。
164
- - **编解码/双流/屏幕共享**等能力面无 CN 差异;差异只在"连哪个区域/什么网络"。
165
-
166
- ---
167
-
168
- ## 待验证 / 未知
169
-
170
- - **原生 RTC 信令的精确接入点域名**:设置 `AREA_CODE_CN` 后原生 SDK 连接的确切信令主机名
171
- (是否字面就是 `api.sd-rtn.com`)没有公开的"白名单域名"页可查(原生不支持防火墙白名单,官方未列域名)。
172
- 已确认的是后缀 `sd-rtn.com` + REST 主域名 `api.sd-rtn.com`;原生媒体信令具体 host 记为待验证。
173
- - **私有媒体网关(本地接入点 / 混合部署)**:确认原生有 `AgoraLocalAccessPointConfiguration` +
174
- `setLocalAccessPoint`、Web 有 `setProxyServer`,但这是单独的企业私有化/混合部署项目(需声网部署本地媒体网关),
175
- 未在本任务里核实其完整开通流程与字段,落地前需按 `doc.shengwang.cn` 现查。
176
- - **Web `setArea` 单字符串写法**:中文文档示例是 `AgoraRTC.setArea("ASIA")`(单字符串),
177
- 而 4.24.7 类型签名是 `AREAS[] | { areaCode, excludedArea }`;运行时是否仍兼容单字符串未实测,
178
- 建议统一用 `setArea({ areaCode: "CHINA" })`。
179
- - **云代理"国内测试 IP"清单会漂移**:中文防火墙文档列出的国内测试 IP(如 `150.138.153.78` 等)
180
- 仅供测试、正式上线要声网另发,且清单随版本更新,落地以申请后声网提供为准。