@reachv2/sdk 0.3.1 → 0.3.2

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @reachv2/sdk
2
2
 
3
- Reach(reach.codes)统一平台的官方 TypeScript SDK —— 由 aiservicer SDK(crm 域,18 资源)与 aiops-saas SDK(social 域,5 资源)合并而来(P2.4),现统一为 **27 个资源类 / 203 个资源方法**。一个客户端覆盖客服 / 销售引导、社群维护与社媒运营全部资源(含效果追踪、SEO/GEO、内容规则与数据源)。
3
+ Reach(reach.codes)统一平台的官方 TypeScript SDK —— 由 aiservicer SDK(crm 域,18 资源)与 aiops-saas SDK(social 域,5 资源)合并而来(P2.4),现统一为 **31 个资源类 / 210 个资源方法**。一个客户端覆盖客服 / 销售引导、社群维护与社媒运营全部资源(含效果追踪、SEO/GEO、内容规则与数据源)。
4
4
 
5
5
  - 运行时:Node.js >= 18(ESM)
6
6
  - 类型:完整 TypeScript 类型定义(自带 `dist/index.d.ts`)
@@ -82,7 +82,7 @@ Reach 将自身能力以 **MCP(Model Context Protocol)** 形式对外开放
82
82
  - 权限(读 / 写门禁):只读 Key(scope 不含 `write` / `all` / `*`)**只能调用读工具**(工具名按 `_` 分词命中
83
83
  `list` / `get` / `status` / `query` / `summary` / `check` / `history` / `usage` … 即视为读,未命中一律按写拒绝);
84
84
  写工具需 `write` / `all` / `*` scope,否则 `tools/call` 返回 JSON-RPC `-32001 requires a write-scoped API key`
85
- - 工具规模:**269**(crm 87 + social 182),按域白名单裁剪(当前 `crm` / `social`),`tools/list` 返回实际可用集合
85
+ - 工具规模:**255**(crm 87 + social 168),按域白名单裁剪(当前 `crm` / `social`),`tools/list` 返回实际可用集合
86
86
 
87
87
  会话按 MCP Streamable HTTP 规范:先 `initialize` 取得 `mcp-session-id`,
88
88
  再发 `notifications/initialized`,之后 `tools/call`,结束时 `DELETE` 会话。
@@ -163,6 +163,10 @@ const client = new ReachClient({
163
163
  | `client.content` | 社媒文案生成(generate/list/platforms/styles/get/update/delete) | Server |
164
164
  | `client.tts` | 文本转语音(synthesize/voices/history) | Server |
165
165
  | `client.accounts` | 社媒账号矩阵(list/connect) | Server |
166
+ | `client.contentPlans` | **内容计划(ContentPlansResource)**:计划名 + 主题时间轴(list/create) | Server |
167
+ | `client.publishPlans` | **发布计划(PublishPlansResource)**:多站点分步编排,get 返回每步待审草稿(list/get) | Server |
168
+ | `client.browserTemplates` | **浏览器操作模板(BrowserTemplatesResource)**:流程编排模板(list/update) | Server |
169
+ | `client.aiMedia` | **AI 媒体(AiMediaResource)**:视频脚本生成(script) | Server |
166
170
 
167
171
  ### social 域 — P-REACH(效果 / SEO-GEO / 内容规则 / 数据源,v0.3.0 新增)
168
172
 
package/dist/client.d.ts CHANGED
@@ -20,6 +20,10 @@ import { TtsResource } from "./resources/tts.js";
20
20
  import { AccountsResource } from "./resources/accounts.js";
21
21
  import { EffectResource } from "./resources/effect.js";
22
22
  import { SeoGeoResource } from "./resources/seo-geo.js";
23
+ import { ContentPlansResource } from "./resources/content-plans.js";
24
+ import { PublishPlansResource } from "./resources/publish-plans.js";
25
+ import { BrowserTemplatesResource } from "./resources/browser-templates.js";
26
+ import { AiMediaResource } from "./resources/ai-media.js";
23
27
  import { ContentRulesResource } from "./resources/content-rules.js";
24
28
  import { DataSourcesResource } from "./resources/data-sources.js";
25
29
  import { DashboardApi } from "./resources/dashboard-api.js";
@@ -52,6 +56,10 @@ export declare class ReachClient {
52
56
  content: ContentResource;
53
57
  tts: TtsResource;
54
58
  accounts: AccountsResource;
59
+ contentPlans: ContentPlansResource;
60
+ publishPlans: PublishPlansResource;
61
+ browserTemplates: BrowserTemplatesResource;
62
+ aiMedia: AiMediaResource;
55
63
  effect: EffectResource;
56
64
  seoGeo: SeoGeoResource;
57
65
  contentRules: ContentRulesResource;
package/dist/client.js CHANGED
@@ -20,6 +20,10 @@ import { TtsResource } from "./resources/tts.js";
20
20
  import { AccountsResource } from "./resources/accounts.js";
21
21
  import { EffectResource } from "./resources/effect.js";
22
22
  import { SeoGeoResource } from "./resources/seo-geo.js";
23
+ import { ContentPlansResource } from "./resources/content-plans.js";
24
+ import { PublishPlansResource } from "./resources/publish-plans.js";
25
+ import { BrowserTemplatesResource } from "./resources/browser-templates.js";
26
+ import { AiMediaResource } from "./resources/ai-media.js";
23
27
  import { ContentRulesResource } from "./resources/content-rules.js";
24
28
  import { DataSourcesResource } from "./resources/data-sources.js";
25
29
  import { DashboardApi } from "./resources/dashboard-api.js";
@@ -57,6 +61,10 @@ export class ReachClient {
57
61
  this.content = new ContentResource(this.requestServer.bind(this));
58
62
  this.tts = new TtsResource(this.requestServer.bind(this));
59
63
  this.accounts = new AccountsResource(this.requestServer.bind(this));
64
+ this.contentPlans = new ContentPlansResource(this.requestServer.bind(this));
65
+ this.publishPlans = new PublishPlansResource(this.requestServer.bind(this));
66
+ this.browserTemplates = new BrowserTemplatesResource(this.requestServer.bind(this));
67
+ this.aiMedia = new AiMediaResource(this.requestServer.bind(this));
60
68
  this.effect = new EffectResource(this.requestServer.bind(this));
61
69
  this.seoGeo = new SeoGeoResource(this.requestServer.bind(this));
62
70
  this.contentRules = new ContentRulesResource(this.requestServer.bind(this));
package/dist/index.d.ts CHANGED
@@ -22,6 +22,10 @@ export { TtsResource } from "./resources/tts.js";
22
22
  export { AccountsResource } from "./resources/accounts.js";
23
23
  export { EffectResource } from "./resources/effect.js";
24
24
  export { SeoGeoResource } from "./resources/seo-geo.js";
25
+ export { ContentPlansResource } from "./resources/content-plans.js";
26
+ export { PublishPlansResource } from "./resources/publish-plans.js";
27
+ export { BrowserTemplatesResource } from "./resources/browser-templates.js";
28
+ export { AiMediaResource } from "./resources/ai-media.js";
25
29
  export { ContentRulesResource } from "./resources/content-rules.js";
26
30
  export { DataSourcesResource } from "./resources/data-sources.js";
27
31
  export { HealthResource } from "./resources/health.js";
package/dist/index.js CHANGED
@@ -22,6 +22,10 @@ export { TtsResource } from "./resources/tts.js";
22
22
  export { AccountsResource } from "./resources/accounts.js";
23
23
  export { EffectResource } from "./resources/effect.js";
24
24
  export { SeoGeoResource } from "./resources/seo-geo.js";
25
+ export { ContentPlansResource } from "./resources/content-plans.js";
26
+ export { PublishPlansResource } from "./resources/publish-plans.js";
27
+ export { BrowserTemplatesResource } from "./resources/browser-templates.js";
28
+ export { AiMediaResource } from "./resources/ai-media.js";
25
29
  export { ContentRulesResource } from "./resources/content-rules.js";
26
30
  export { DataSourcesResource } from "./resources/data-sources.js";
27
31
  export { HealthResource } from "./resources/health.js";
@@ -0,0 +1,17 @@
1
+ import { RequestMethod } from "../types.js";
2
+ type RequestFn = <T>(method: RequestMethod, path: string, body?: unknown) => Promise<T>;
3
+ /**
4
+ * AiMedia 资源 — AI 视频(脚本生成)。
5
+ * 端点走 Server API(/api/ai-media/*)。
6
+ * 与社媒域 MCP 工具 video_script_generate 同源。
7
+ */
8
+ export declare class AiMediaResource {
9
+ private request;
10
+ constructor(request: RequestFn);
11
+ /** 生成视频脚本(提示词):主题必填,可指定语言与时长 */
12
+ script(subject: string, opts?: {
13
+ language?: string;
14
+ duration?: number;
15
+ }): Promise<any>;
16
+ }
17
+ export {};
@@ -0,0 +1,17 @@
1
+ /**
2
+ * AiMedia 资源 — AI 视频(脚本生成)。
3
+ * 端点走 Server API(/api/ai-media/*)。
4
+ * 与社媒域 MCP 工具 video_script_generate 同源。
5
+ */
6
+ export class AiMediaResource {
7
+ constructor(request) {
8
+ this.request = request;
9
+ }
10
+ /** 生成视频脚本(提示词):主题必填,可指定语言与时长 */
11
+ script(subject, opts = {}) {
12
+ return this.request("POST", "/api/ai-media/video/script", {
13
+ subject,
14
+ ...opts,
15
+ });
16
+ }
17
+ }
@@ -0,0 +1,16 @@
1
+ import { RequestMethod } from "../types.js";
2
+ type RequestFn = <T>(method: RequestMethod, path: string, body?: unknown) => Promise<T>;
3
+ /**
4
+ * BrowserTemplates 资源 — 浏览器操作模板(流程编排:navigate/click/type/extract …)。
5
+ * 端点走 Server API(/api/browser-templates/*)。
6
+ * 与社媒域 MCP 工具 browser_templates_list / browser_templates_update 同源。
7
+ */
8
+ export declare class BrowserTemplatesResource {
9
+ private request;
10
+ constructor(request: RequestFn);
11
+ /** 模板列表 */
12
+ list(): Promise<any>;
13
+ /** 更新模板(部分更新;改 steps 会提升模板版本) */
14
+ update(templateId: string, data: Record<string, unknown>): Promise<any>;
15
+ }
16
+ export {};
@@ -0,0 +1,18 @@
1
+ /**
2
+ * BrowserTemplates 资源 — 浏览器操作模板(流程编排:navigate/click/type/extract …)。
3
+ * 端点走 Server API(/api/browser-templates/*)。
4
+ * 与社媒域 MCP 工具 browser_templates_list / browser_templates_update 同源。
5
+ */
6
+ export class BrowserTemplatesResource {
7
+ constructor(request) {
8
+ this.request = request;
9
+ }
10
+ /** 模板列表 */
11
+ list() {
12
+ return this.request("GET", "/api/browser-templates");
13
+ }
14
+ /** 更新模板(部分更新;改 steps 会提升模板版本) */
15
+ update(templateId, data) {
16
+ return this.request("PUT", `/api/browser-templates/${templateId}`, data);
17
+ }
18
+ }
@@ -0,0 +1,20 @@
1
+ import { RequestMethod } from "../types.js";
2
+ type RequestFn = <T>(method: RequestMethod, path: string, body?: unknown) => Promise<T>;
3
+ /**
4
+ * ContentPlans 资源 — 内容计划(计划名 + 主题时间轴,媒体运营 campaign)。
5
+ * 端点走 Server API(/api/media-ops/*)。
6
+ * 与社媒域 MCP 工具 content_plans_list / content_plans_create 同源。
7
+ */
8
+ export declare class ContentPlansResource {
9
+ private request;
10
+ constructor(request: RequestFn);
11
+ /** 内容计划列表(按租户 + 创建时间倒序) */
12
+ list(): Promise<any>;
13
+ /** 创建内容计划:计划名 + 主题列表 + 时间范围 + 风格 */
14
+ create(name: string, topics: string[], opts?: {
15
+ startDate?: string;
16
+ endDate?: string;
17
+ strategy?: string;
18
+ }): Promise<any>;
19
+ }
20
+ export {};
@@ -0,0 +1,22 @@
1
+ /**
2
+ * ContentPlans 资源 — 内容计划(计划名 + 主题时间轴,媒体运营 campaign)。
3
+ * 端点走 Server API(/api/media-ops/*)。
4
+ * 与社媒域 MCP 工具 content_plans_list / content_plans_create 同源。
5
+ */
6
+ export class ContentPlansResource {
7
+ constructor(request) {
8
+ this.request = request;
9
+ }
10
+ /** 内容计划列表(按租户 + 创建时间倒序) */
11
+ list() {
12
+ return this.request("GET", "/api/media-ops");
13
+ }
14
+ /** 创建内容计划:计划名 + 主题列表 + 时间范围 + 风格 */
15
+ create(name, topics, opts = {}) {
16
+ return this.request("POST", "/api/media-ops", {
17
+ name,
18
+ topics,
19
+ ...opts,
20
+ });
21
+ }
22
+ }
@@ -0,0 +1,16 @@
1
+ import { RequestMethod } from "../types.js";
2
+ type RequestFn = <T>(method: RequestMethod, path: string, body?: unknown) => Promise<T>;
3
+ /**
4
+ * PublishPlans 资源 — 发布计划(多站点分步编排 + 每步待审草稿)。
5
+ * 端点走 Server API(/api/publish-plans/*)。
6
+ * 与社媒域 MCP 工具 publish_plans_list / publish_plans_get 同源。
7
+ */
8
+ export declare class PublishPlansResource {
9
+ private request;
10
+ constructor(request: RequestFn);
11
+ /** 发布计划列表(含每步状态汇总) */
12
+ list(): Promise<any>;
13
+ /** 发布计划详情:每步的生成文案(draftText)与状态 — 用于审批前展示内容 */
14
+ get(planId: string): Promise<any>;
15
+ }
16
+ export {};
@@ -0,0 +1,18 @@
1
+ /**
2
+ * PublishPlans 资源 — 发布计划(多站点分步编排 + 每步待审草稿)。
3
+ * 端点走 Server API(/api/publish-plans/*)。
4
+ * 与社媒域 MCP 工具 publish_plans_list / publish_plans_get 同源。
5
+ */
6
+ export class PublishPlansResource {
7
+ constructor(request) {
8
+ this.request = request;
9
+ }
10
+ /** 发布计划列表(含每步状态汇总) */
11
+ list() {
12
+ return this.request("GET", "/api/publish-plans");
13
+ }
14
+ /** 发布计划详情:每步的生成文案(draftText)与状态 — 用于审批前展示内容 */
15
+ get(planId) {
16
+ return this.request("GET", `/api/publish-plans/${planId}`);
17
+ }
18
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@reachv2/sdk",
3
- "version": "0.3.1",
4
- "description": "Reach unified REST API client library for TypeScript — crm 域(AgentApi/Project/Bot/Knowledge/Channel/Conversation/Transaction/Auth/Chat/ApiKey/LightRAG/Orchestration/ScheduledTasks/Internal/Abis/Admin)+ social 域(Content/Tts/Accounts/Effect 效果追踪/SeoGeo SEO-GEO 矩阵/ContentRules 内容规则引擎/DataSources 数据源)+ 统一 DashboardApi(crm/social 看板)+ 统一租户成员模型(Tenants/Team/Health,G-1~G-3)",
3
+ "version": "0.3.2",
4
+ "description": "Reach unified REST API client library for TypeScript — crm 域(AgentApi/Project/Bot/Knowledge/Channel/Conversation/Transaction/Auth/Chat/ApiKey/LightRAG/Orchestration/ScheduledTasks/Internal/Abis/Admin)+ social 域(Content/Tts/Accounts/ContentPlans 内容计划/PublishPlans 发布计划/BrowserTemplates 流程模板/AiMedia 视频脚本/Effect 效果追踪/SeoGeo SEO-GEO 矩阵/ContentRules 内容规则引擎/DataSources 数据源)+ 统一 DashboardApi(crm/social 看板)+ 统一租户成员模型(Tenants/Team/Health,G-1~G-3)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",