@reachv2/sdk 0.5.0 → 0.5.1

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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,9 @@
1
+ Reach SDK (@reachv2/sdk)
2
+ Copyright 2026 sftgroup
3
+
4
+ This product includes software developed at sftgroup (https://reach.codes).
5
+
6
+ Licensed under the Apache License, Version 2.0 (see LICENSE).
7
+
8
+ Third-party components:
9
+ - TypeScript (Apache-2.0) — build-time only, not distributed in the published package.
package/README.md CHANGED
@@ -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
- - 工具规模:**255**(crm 87 + social 168),按域白名单裁剪(当前 `crm` / `social`),`tools/list` 返回实际可用集合
85
+ - 工具规模:**247**(crm 77 + social 170),按域白名单裁剪(当前 `crm` / `social`),`tools/list` 返回实际可用集合
86
86
 
87
87
  会话按 MCP Streamable HTTP 规范:先 `initialize` 取得 `mcp-session-id`,
88
88
  再发 `notifications/initialized`,之后 `tools/call`,结束时 `DELETE` 会话。
@@ -103,6 +103,25 @@ const res = await client.callTool({ name: "social_accounts_list", arguments: {}
103
103
  await transport.close(); // 释放会话
104
104
  ```
105
105
 
106
+ ### 本地客户端(只支持 stdio)
107
+
108
+ Claude Desktop / Cursor / Cline / Cherry Studio 等只支持 `command` + `args` 时,用
109
+ [`@reachv2/mcp`](https://github.com/sftgroup/reach/tree/main/mcp) 桥接(内部走上面的 Streamable HTTP):
110
+
111
+ ```json
112
+ {
113
+ "mcpServers": {
114
+ "reach": {
115
+ "command": "npx",
116
+ "args": ["-y", "@reachv2/mcp", "--preset", "social"],
117
+ "env": { "REACH_API_KEY": "sk-xxx" }
118
+ }
119
+ }
120
+ }
121
+ ```
122
+
123
+ `--preset` / `--domains` / `--tools` / `--exclude` 可裁剪工具面(261 个工具全量注入会占用大量上下文)。
124
+
106
125
  > 平台内部闭环(reach server → mcp,`/api/bridge/mcp/discover|call`)走 `x-reach-internal-token`,
107
126
  > 不对外暴露;外部集成一律使用 API Key。
108
127
 
package/dist/client.d.ts CHANGED
@@ -23,6 +23,7 @@ import { SeoGeoResource } from "./resources/seo-geo.js";
23
23
  import { ContentPlansResource } from "./resources/content-plans.js";
24
24
  import { PublishPlansResource } from "./resources/publish-plans.js";
25
25
  import { BrowserTemplatesResource } from "./resources/browser-templates.js";
26
+ import { BrowserResource } from "./resources/browser.js";
26
27
  import { AiMediaResource } from "./resources/ai-media.js";
27
28
  import { ContentRulesResource } from "./resources/content-rules.js";
28
29
  import { DataSourcesResource } from "./resources/data-sources.js";
@@ -65,6 +66,8 @@ export declare class ReachClient {
65
66
  contentPlans: ContentPlansResource;
66
67
  publishPlans: PublishPlansResource;
67
68
  browserTemplates: BrowserTemplatesResource;
69
+ /** 浏览器实时会话(/api/browser/live/*) */
70
+ browser: BrowserResource;
68
71
  aiMedia: AiMediaResource;
69
72
  effect: EffectResource;
70
73
  seoGeo: SeoGeoResource;
package/dist/client.js CHANGED
@@ -23,6 +23,7 @@ import { SeoGeoResource } from "./resources/seo-geo.js";
23
23
  import { ContentPlansResource } from "./resources/content-plans.js";
24
24
  import { PublishPlansResource } from "./resources/publish-plans.js";
25
25
  import { BrowserTemplatesResource } from "./resources/browser-templates.js";
26
+ import { BrowserResource } from "./resources/browser.js";
26
27
  import { AiMediaResource } from "./resources/ai-media.js";
27
28
  import { ContentRulesResource } from "./resources/content-rules.js";
28
29
  import { DataSourcesResource } from "./resources/data-sources.js";
@@ -70,6 +71,7 @@ export class ReachClient {
70
71
  this.contentPlans = new ContentPlansResource(this.requestServer.bind(this));
71
72
  this.publishPlans = new PublishPlansResource(this.requestServer.bind(this));
72
73
  this.browserTemplates = new BrowserTemplatesResource(this.requestServer.bind(this));
74
+ this.browser = new BrowserResource(this.requestServer.bind(this));
73
75
  this.aiMedia = new AiMediaResource(this.requestServer.bind(this));
74
76
  this.effect = new EffectResource(this.requestServer.bind(this));
75
77
  this.seoGeo = new SeoGeoResource(this.requestServer.bind(this));
package/dist/error.js CHANGED
@@ -1,3 +1,4 @@
1
+ // SPDX-License-Identifier: Apache-2.0
1
2
  export class ReachError extends Error {
2
3
  constructor(message, code, status, details) {
3
4
  super(message);
package/dist/index.d.ts CHANGED
@@ -25,6 +25,7 @@ export { SeoGeoResource } from "./resources/seo-geo.js";
25
25
  export { ContentPlansResource } from "./resources/content-plans.js";
26
26
  export { PublishPlansResource } from "./resources/publish-plans.js";
27
27
  export { BrowserTemplatesResource } from "./resources/browser-templates.js";
28
+ export { BrowserResource } from "./resources/browser.js";
28
29
  export { AiMediaResource } from "./resources/ai-media.js";
29
30
  export { ContentRulesResource } from "./resources/content-rules.js";
30
31
  export { DataSourcesResource } from "./resources/data-sources.js";
@@ -39,7 +40,9 @@ export { SharedBillingResource } from "./resources/shared-billing.js";
39
40
  export { QuotaResource } from "./resources/quota.js";
40
41
  export type { ReachClientConfig, BotType, AgentType, BotStatus, ChannelType, ChannelStatus, KnowledgeStatus, Pagination, PaginatedResponse, Project, ProjectCreateParams, ProjectUpdateParams, TransactionBotConfig, Bot, BotStats, BotCreateParams, BotUpdateParams, KnowledgeDoc, KnowledgeRecommendation, Channel, ChannelConfigureParams, Conversation, Message, ChatParams, ChatResponse, ChatToolDefinition, ChatToolFunction, DashboardData, BotMetrics, TxIntent, TxStep, PreparedTransaction, ContractInfo, ContractMethod, SimulationResult, DecodedCalldata, ProtocolSummary, ProtocolRegistryEntry, ChainDeployment, ProtocolAction, ParamHint, WalletNonce, WalletLoginParams, AuthAccount, AuthResult, MfaRequiredResult, CaptchaResponse, CaptchaAnswer, AgentXAgent, AgentXAgentDetail, AgentXMarketplaceResult, AgentXSubscriptionPlans, AgentXSubscriptionCheck, AgentXAgentContext, AgentXPublishParams, AgentXPublishResult, AgentXSkill, AgentXSkillCreateParams, AgentXAgentStatus, AgentXAgentUsage, AgentXSubscriptionDetail, AgentXSubscriptionList, ServerChatParams, ServerChatResponse, ChatUsage, ChatUsageSummary, AgentSummary, AgentListResult, AgentListParams, AgentChainInfo, AgentActionType, AgentCapabilities, AgentChatParams, AgentChatResult, LightRAGKeyInfo, LightRAGDocumentParams, LightRAGQueryParams, LightRAGQueryResult, LightRAGBatchItem, LightRAGBatchError, LightRAGBatchResult, GlobalAnalytics, AdminDashboard, AdminMerchant, AdminMerchantDetail, AdminBillingRecord, AdminCreateBillingParams, LlmSettings, LlmUpdateParams, ConversationTask, ConversationTaskStatus, ConversationSession, ConversationCapabilities, ConversationMessage, OrchestrationTaskParams, OrchestrateParams, OrchestratedTaskResult, OrchestrateResult, ScheduledTask, ScheduledTaskStatus, ScheduledTaskTriggerType, MonitorConnectorKind, EnterpriseDoc, MonitorConnector, MonitorEvent, MerchantAbi, MerchantAbiCreateParams, SimpleResult, TenantType, TenantMemberRole, TenantMemberStatus, Tenant, TenantMemberInfo, TenantInvite, PublicInviteInfo, InviteAcceptResult, MemberRoleUpdateResult, TransferOwnerResult, TeamMemberItem, TeamInviteResult, HealthInfo, MerchantOnboardParams, MerchantAuthResult, MerchantInviteInfo, EmailCodeSendResult, EmailCodeLoginParams, AccountMeResult, MerchantDashboardStats, MerchantTicket, MerchantTicketUpdateParams, MerchantProject, MerchantBot, MerchantProjectCreateParams, MerchantBotCreateParams, MerchantLlmConfig, MerchantLlmConfigInput, MerchantChain, MerchantChainAddParams, MerchantChainList, MerchantTeamRole, MerchantTeamMember, MerchantTeamResult, MerchantTeamMemberAddParams, MerchantTeamInviteParams, MerchantTeamInviteResult, ChannelActionResult, SendTextParams, TelegramSendFileParams, DiscordDmParams, DiscordDmOptInParams, MerchantGroupList, EmailMailbox, EmailMailboxCreateParams, EmailThreadList, } from "./types.js";
41
42
  export type { ApiKeyInfo, ApiKeyCreated } from "./resources/api-key.js";
42
- export type { SocialAccountCreateParams } from "./resources/accounts.js";
43
+ export type { BrandBusinessType, BrandProfileInput, BrandProfilePatch, } from "./resources/seo-geo.js";
44
+ export type { SocialAccountCreateParams, FingerprintProfileCreateParams, AccountEgressBindParams, } from "./resources/accounts.js";
45
+ export type { LiveSetCookiesParams } from "./resources/browser.js";
43
46
  export type { EmailSendParams, EmailPollParams, EmailInboundParams, } from "./resources/email-channel.js";
44
47
  export type { BillingPlan, BillingPlansResult, BillingTokenPack, BillingTokenPacksResult, BillingPrice, BillingPricesResult, TokenPackCheckoutResult, BrowserQuotaStatus, BrowserPackPurchase, BrowserPackPurchasesResult, } from "./resources/billing.js";
45
48
  export type { SharedSubscriptionPlanRef, SharedSubscription, SubscriptionQuotaResource, SubscriptionUsage, RecordUsageParams, UsageRecordResult, SharedTokenPackPurchaseParams, SharedTokenPackPurchaseResult, CryptoMethodsResult, CryptoOrderParams, CryptoOrder, CryptoOrderListResult, CryptoOrderConfirmParams, } from "./resources/shared-billing.js";
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ // SPDX-License-Identifier: Apache-2.0
1
2
  export { ReachClient } from "./client.js";
2
3
  export { ReachError } from "./error.js";
3
4
  export { ProjectResource } from "./resources/project.js";
@@ -25,6 +26,7 @@ export { SeoGeoResource } from "./resources/seo-geo.js";
25
26
  export { ContentPlansResource } from "./resources/content-plans.js";
26
27
  export { PublishPlansResource } from "./resources/publish-plans.js";
27
28
  export { BrowserTemplatesResource } from "./resources/browser-templates.js";
29
+ export { BrowserResource } from "./resources/browser.js";
28
30
  export { AiMediaResource } from "./resources/ai-media.js";
29
31
  export { ContentRulesResource } from "./resources/content-rules.js";
30
32
  export { DataSourcesResource } from "./resources/data-sources.js";
@@ -8,6 +8,20 @@ export interface SocialAccountCreateParams {
8
8
  credentials?: Record<string, unknown>;
9
9
  usageType?: "general" | "nurture" | "execute";
10
10
  }
11
+ export interface FingerprintProfileCreateParams {
12
+ /** Profile 标签(如 twitter-main) */
13
+ label: string;
14
+ /** 平台编码(twitter/facebook/instagram/...) */
15
+ platform: string;
16
+ }
17
+ export interface AccountEgressBindParams {
18
+ /** 住宅出口路由 ID(GET /api/egress/residential/routes) */
19
+ routeId: string;
20
+ /** 粘性会话时长(分钟,5-43200,默认 1440) */
21
+ stickyTtlMin?: number;
22
+ /** 换出口策略 */
23
+ rotatePolicy?: "manual" | "on_fail" | "daily";
24
+ }
11
25
  /**
12
26
  * Accounts 资源 — 社媒账号矩阵(源自 aiops-saas @aiops/sdk AccountsApi)。
13
27
  * 端点走 Server API(/api/accounts/*)。
@@ -15,13 +29,33 @@ export interface SocialAccountCreateParams {
15
29
  export declare class AccountsResource {
16
30
  private request;
17
31
  constructor(request: RequestFn);
18
- /** 账号列表(?usageType=general|nurture|execute) */
19
- list(usageType?: "general" | "nurture" | "execute"): Promise<any>;
32
+ /** 账号列表(?usageType=nurture|execute) */
33
+ list(usageType?: "nurture" | "execute"): Promise<any>;
20
34
  /**
21
35
  * 新增平台账号(POST /api/accounts;凭据服务端加密入库)。
22
36
  * v0.4.0 修复:旧 `connect(platform, credentials)` 指向不存在的
23
37
  * `/api/accounts/:platform/connect`,调用必 404。
24
38
  */
25
39
  create(params: SocialAccountCreateParams): Promise<any>;
40
+ /** 指纹 Profile 列表(GET /api/accounts/profiles) */
41
+ listProfiles(): Promise<any>;
42
+ /** 自助创建指纹 Profile(POST /api/accounts/profiles) */
43
+ createProfile(params: FingerprintProfileCreateParams): Promise<any>;
44
+ /**
45
+ * 粘贴 Cookie 导入/续期登录态(POST /api/accounts/:id/import-cookies)。
46
+ * 前置:账号已绑定 Profile,且该身份有在线浏览器实例。
47
+ */
48
+ importCookies(accountId: string, cookies: string | unknown[]): Promise<any>;
49
+ /** 账号当前住宅出口绑定(GET /api/accounts/:id/egress;密码不回显) */
50
+ getEgress(accountId: string): Promise<any>;
51
+ /** 绑定账号到住宅出口路由(PUT /api/accounts/:id/egress;账号↔路由 1:1) */
52
+ bindEgress(accountId: string, params: AccountEgressBindParams): Promise<any>;
53
+ /** 换出口(POST /api/accounts/:id/egress/rotate;新粘性会话,可同时换路由) */
54
+ rotateEgress(accountId: string, params?: {
55
+ routeId?: string;
56
+ reason?: string;
57
+ }): Promise<any>;
58
+ /** 解绑住宅出口,回落 Profile 出口(DELETE /api/accounts/:id/egress) */
59
+ unbindEgress(accountId: string): Promise<any>;
26
60
  }
27
61
  export {};
@@ -6,7 +6,7 @@ export class AccountsResource {
6
6
  constructor(request) {
7
7
  this.request = request;
8
8
  }
9
- /** 账号列表(?usageType=general|nurture|execute) */
9
+ /** 账号列表(?usageType=nurture|execute) */
10
10
  list(usageType) {
11
11
  const qs = usageType ? `?usageType=${encodeURIComponent(usageType)}` : "";
12
12
  return this.request("GET", `/api/accounts${qs}`);
@@ -19,4 +19,35 @@ export class AccountsResource {
19
19
  create(params) {
20
20
  return this.request("POST", "/api/accounts", params);
21
21
  }
22
+ /** 指纹 Profile 列表(GET /api/accounts/profiles) */
23
+ listProfiles() {
24
+ return this.request("GET", "/api/accounts/profiles");
25
+ }
26
+ /** 自助创建指纹 Profile(POST /api/accounts/profiles) */
27
+ createProfile(params) {
28
+ return this.request("POST", "/api/accounts/profiles", params);
29
+ }
30
+ /**
31
+ * 粘贴 Cookie 导入/续期登录态(POST /api/accounts/:id/import-cookies)。
32
+ * 前置:账号已绑定 Profile,且该身份有在线浏览器实例。
33
+ */
34
+ importCookies(accountId, cookies) {
35
+ return this.request("POST", `/api/accounts/${encodeURIComponent(accountId)}/import-cookies`, { cookies });
36
+ }
37
+ /** 账号当前住宅出口绑定(GET /api/accounts/:id/egress;密码不回显) */
38
+ getEgress(accountId) {
39
+ return this.request("GET", `/api/accounts/${encodeURIComponent(accountId)}/egress`);
40
+ }
41
+ /** 绑定账号到住宅出口路由(PUT /api/accounts/:id/egress;账号↔路由 1:1) */
42
+ bindEgress(accountId, params) {
43
+ return this.request("PUT", `/api/accounts/${encodeURIComponent(accountId)}/egress`, params);
44
+ }
45
+ /** 换出口(POST /api/accounts/:id/egress/rotate;新粘性会话,可同时换路由) */
46
+ rotateEgress(accountId, params = {}) {
47
+ return this.request("POST", `/api/accounts/${encodeURIComponent(accountId)}/egress/rotate`, params);
48
+ }
49
+ /** 解绑住宅出口,回落 Profile 出口(DELETE /api/accounts/:id/egress) */
50
+ unbindEgress(accountId) {
51
+ return this.request("DELETE", `/api/accounts/${encodeURIComponent(accountId)}/egress`);
52
+ }
22
53
  }
@@ -4,11 +4,11 @@ export declare class AuthResource {
4
4
  private request;
5
5
  constructor(request: RequestFn);
6
6
  /**
7
- * 获取钱包签名挑战(nonce)。
8
- * 服务端签发后存 Redis 10 分钟一次性;签名对象即返回的 nonce 字符串本体。
7
+ * 获取钱包登录挑战(nonce)。
8
+ * 服务端签发后存 Redis 10 分钟一次性;nonce 用作 SIWE 消息(EIP-4361)的 nonce 字段。
9
9
  */
10
10
  getChallenge(wallet: string): Promise<WalletNonce>;
11
- /** 钱包签名登录(server 契约:{ wallet, nonce, signature }) */
11
+ /** 钱包 SIWE(EIP-4361)签名登录(server 契约:{ message, signature }) */
12
12
  walletLogin(params: WalletLoginParams): Promise<AuthResult>;
13
13
  /**
14
14
  * 获取图形验证码(login/register 前置,可选)。
@@ -3,13 +3,13 @@ export class AuthResource {
3
3
  this.request = request;
4
4
  }
5
5
  /**
6
- * 获取钱包签名挑战(nonce)。
7
- * 服务端签发后存 Redis 10 分钟一次性;签名对象即返回的 nonce 字符串本体。
6
+ * 获取钱包登录挑战(nonce)。
7
+ * 服务端签发后存 Redis 10 分钟一次性;nonce 用作 SIWE 消息(EIP-4361)的 nonce 字段。
8
8
  */
9
9
  getChallenge(wallet) {
10
10
  return this.request("POST", "/api/auth/wallet-nonce", { wallet });
11
11
  }
12
- /** 钱包签名登录(server 契约:{ wallet, nonce, signature }) */
12
+ /** 钱包 SIWE(EIP-4361)签名登录(server 契约:{ message, signature }) */
13
13
  walletLogin(params) {
14
14
  return this.request("POST", "/api/auth/wallet-login", params);
15
15
  }
@@ -0,0 +1,21 @@
1
+ import { RequestMethod } from "../types.js";
2
+ type RequestFn = <T>(method: RequestMethod, path: string, body?: unknown) => Promise<T>;
3
+ export interface LiveSetCookiesParams {
4
+ /** 在线浏览器会话 ID */
5
+ sessionId: string;
6
+ /** Cookie 头字符串(`auth_token=...; ct0=...`)或 {name,value,domain,...} 数组 */
7
+ cookies: string | unknown[];
8
+ /** 可选平台编码,用于挑选期望的 Cookie 名 */
9
+ platform?: string;
10
+ }
11
+ /**
12
+ * Browser 资源 — 浏览器实时会话(/api/browser/live/*)。
13
+ * 对应 MCP 工具 browser_live_set_cookies。
14
+ */
15
+ export declare class BrowserResource {
16
+ private request;
17
+ constructor(request: RequestFn);
18
+ /** 向在线会话注入粘贴的 Cookie(免扫码登录;会话轮询登录态后自动保存) */
19
+ setLiveCookies(params: LiveSetCookiesParams): Promise<any>;
20
+ }
21
+ export {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Browser 资源 — 浏览器实时会话(/api/browser/live/*)。
3
+ * 对应 MCP 工具 browser_live_set_cookies。
4
+ */
5
+ export class BrowserResource {
6
+ constructor(request) {
7
+ this.request = request;
8
+ }
9
+ /** 向在线会话注入粘贴的 Cookie(免扫码登录;会话轮询登录态后自动保存) */
10
+ setLiveCookies(params) {
11
+ return this.request("POST", "/api/browser/live/set-cookies", params);
12
+ }
13
+ }
@@ -3,13 +3,18 @@ type RequestFn = <T>(method: RequestMethod, path: string, body?: unknown) => Pro
3
3
  /**
4
4
  * LightRAG Knowledge Base management.
5
5
  *
6
- * One botId = one LightRAG tenant. External apps can:
6
+ * One botId = one namespace in the platform RAG tenant (`reach`). External apps can:
7
7
  * - Manage API keys for direct LightRAG service access
8
8
  * - Insert/query/delete documents in the RAG vector store
9
9
  *
10
10
  * Per-user isolation: pass `namespace` to scope documents/queries to a specific user.
11
11
  * Defaults to botId (shared knowledge).
12
12
  *
13
+ * namespace 必须限定在 Bot 自有空间(2026-10-24 起网关强校验):
14
+ * - `botId`(默认,Bot 共享知识库)
15
+ * - `${botId}:<suffix>`(按用户/会话隔离的子空间)
16
+ * - 查询额外允许平台只读 `market` / `onchain`;其他值一律 403。
17
+ *
13
18
  * Platform shared namespaces: Keel RAG 侧维护共享 namespace 白名单(默认 `market` / `onchain`,
14
19
  * 用于跨租户只读的行情 / 链上知识)。查询时可直接作为 `namespace` 传入;
15
20
  * 写入(insertDocument / insertDocuments)到这两个 namespace 会被 Keel 以只读拒绝。
@@ -1,13 +1,18 @@
1
1
  /**
2
2
  * LightRAG Knowledge Base management.
3
3
  *
4
- * One botId = one LightRAG tenant. External apps can:
4
+ * One botId = one namespace in the platform RAG tenant (`reach`). External apps can:
5
5
  * - Manage API keys for direct LightRAG service access
6
6
  * - Insert/query/delete documents in the RAG vector store
7
7
  *
8
8
  * Per-user isolation: pass `namespace` to scope documents/queries to a specific user.
9
9
  * Defaults to botId (shared knowledge).
10
10
  *
11
+ * namespace 必须限定在 Bot 自有空间(2026-10-24 起网关强校验):
12
+ * - `botId`(默认,Bot 共享知识库)
13
+ * - `${botId}:<suffix>`(按用户/会话隔离的子空间)
14
+ * - 查询额外允许平台只读 `market` / `onchain`;其他值一律 403。
15
+ *
11
16
  * Platform shared namespaces: Keel RAG 侧维护共享 namespace 白名单(默认 `market` / `onchain`,
12
17
  * 用于跨租户只读的行情 / 链上知识)。查询时可直接作为 `namespace` 传入;
13
18
  * 写入(insertDocument / insertDocuments)到这两个 namespace 会被 Keel 以只读拒绝。
@@ -1,6 +1,32 @@
1
1
  import { RequestMethod } from "../types.js";
2
2
  import { QueryParams } from "./query.js";
3
3
  type RequestFn = <T>(method: RequestMethod, path: string, body?: unknown) => Promise<T>;
4
+ /** 业务类型(P11.7b):决定生成哪套行业化 JSON-LD 模板;必须显式选择,不做推断 */
5
+ export type BrandBusinessType = "organization" | "local_business" | "software_saas" | "product_ecommerce" | "website";
6
+ /** 品牌档案创建入参(businessInfo 结构随 businessType 变化) */
7
+ export interface BrandProfileInput {
8
+ name: string;
9
+ slogan?: string;
10
+ description?: string;
11
+ keywords?: string[];
12
+ competitors?: string[];
13
+ homepage?: string;
14
+ author?: string;
15
+ socialLinks?: Record<string, string>;
16
+ styleGuide?: string;
17
+ /** 缺省 organization */
18
+ businessType?: BrandBusinessType;
19
+ /**
20
+ * 行业化结构化资料;缺失必填项允许保存(该模板不会生成),
21
+ * 非法值 / 未知字段返回 400 INVALID_INPUT。
22
+ */
23
+ businessInfo?: Record<string, unknown>;
24
+ metadata?: Record<string, unknown>;
25
+ }
26
+ /** 品牌档案更新入参(部分字段) */
27
+ export type BrandProfilePatch = Partial<BrandProfileInput> & {
28
+ status?: "active" | "archived";
29
+ };
4
30
  /**
5
31
  * SeoGeo 资源 — P-REACH 角色2 SEO/GEO 域:品牌档案 / 渠道集 / 内容矩阵 / GEO 资产。
6
32
  * 端点走 Server API(/api/seo-geo/*),与社媒域 MCP seo_geo_* 工具同源。
@@ -13,12 +39,12 @@ export declare class SeoGeoResource {
13
39
  catalog(): Promise<any>;
14
40
  /** 品牌档案列表(可按 status/q 过滤) */
15
41
  listBrands(params?: QueryParams): Promise<any>;
16
- /** 创建品牌档案 */
17
- createBrand(data: unknown): Promise<any>;
42
+ /** 创建品牌档案(businessType / businessInfo 决定行业化 JSON-LD 模板) */
43
+ createBrand(data: BrandProfileInput): Promise<any>;
18
44
  /** 品牌档案详情 */
19
45
  getBrand(id: string): Promise<any>;
20
- /** 更新品牌档案(部分字段) */
21
- updateBrand(id: string, patch: unknown): Promise<any>;
46
+ /** 更新品牌档案(部分字段);换 businessType 未带 businessInfo 时旧资料会重置 */
47
+ updateBrand(id: string, patch: BrandProfilePatch): Promise<any>;
22
48
  /** 删除品牌档案(被矩阵引用时 409) */
23
49
  deleteBrand(id: string): Promise<any>;
24
50
  /** 渠道集列表(可按 status/q 过滤) */
@@ -18,7 +18,7 @@ export class SeoGeoResource {
18
18
  listBrands(params = {}) {
19
19
  return this.request("GET", `/api/seo-geo/brands${buildQuery(params)}`);
20
20
  }
21
- /** 创建品牌档案 */
21
+ /** 创建品牌档案(businessType / businessInfo 决定行业化 JSON-LD 模板) */
22
22
  createBrand(data) {
23
23
  return this.request("POST", "/api/seo-geo/brands", data);
24
24
  }
@@ -26,7 +26,7 @@ export class SeoGeoResource {
26
26
  getBrand(id) {
27
27
  return this.request("GET", `/api/seo-geo/brands/${encodeURIComponent(id)}`);
28
28
  }
29
- /** 更新品牌档案(部分字段) */
29
+ /** 更新品牌档案(部分字段);换 businessType 未带 businessInfo 时旧资料会重置 */
30
30
  updateBrand(id, patch) {
31
31
  return this.request("PUT", `/api/seo-geo/brands/${encodeURIComponent(id)}`, patch);
32
32
  }
package/dist/types.d.ts CHANGED
@@ -270,14 +270,13 @@ export interface ParamHint {
270
270
  source: "user_input" | "derived" | "user_address" | "computed";
271
271
  computeHint?: string;
272
272
  }
273
- /** 钱包登录 nonce(10 分钟一次性;签名对象即该 nonce 字符串本体) */
273
+ /** 钱包登录挑战 nonce(10 分钟一次性;用于构造 SIWE 消息的 nonce 字段) */
274
274
  export interface WalletNonce {
275
275
  nonce: string;
276
276
  }
277
- /** 钱包签名登录入参(server 契约:签名对象为 nonce) */
277
+ /** 钱包 SIWE(EIP-4361)登录入参(server 契约:标准 SIWE message + 钱包签名) */
278
278
  export interface WalletLoginParams {
279
- wallet: string;
280
- nonce: string;
279
+ message: string;
281
280
  signature: string;
282
281
  }
283
282
  /** 账户公开信息(server `publicAccount` 投影) */
@@ -570,13 +569,13 @@ export interface LightRAGKeyInfo {
570
569
  export interface LightRAGDocumentParams {
571
570
  text: string;
572
571
  file_name?: string;
573
- /** Per-user namespace within a bot (defaults to botId = shared). 平台共享 namespace `market` / `onchain` 只读(仅 query 可用) */
572
+ /** Bot 内用户空间:`botId`(默认)或 `${botId}:<suffix>`;其他值 403 */
574
573
  namespace?: string;
575
574
  }
576
575
  export interface LightRAGQueryParams {
577
576
  query: string;
578
577
  mode?: "mix" | "local" | "global" | "hybrid" | "naive";
579
- /** Per-user namespace within a bot (defaults to botId = shared). 平台共享 namespace `market` / `onchain` 只读可查 */
578
+ /** Bot 内用户空间:`botId`(默认)或 `${botId}:<suffix>`;查询额外允许平台只读 `market` / `onchain` */
580
579
  namespace?: string;
581
580
  }
582
581
  export interface LightRAGQueryResult {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reachv2/sdk",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
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 数据源)+ 商户域(Merchant 控制台/ChannelAdmin 通道与群发/EmailChannel 邮件通道)+ 计费与配额(Billing 社媒计费/SharedBilling 统一订阅与加密收款/Quota 社媒配额)+ 统一 DashboardApi(crm/social 看板)+ 统一租户成员模型(Tenants/Team/Health,G-1~G-3)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -12,14 +12,16 @@
12
12
  }
13
13
  },
14
14
  "files": [
15
- "dist"
15
+ "dist",
16
+ "NOTICE"
16
17
  ],
17
18
  "scripts": {
18
19
  "clean": "rm -rf dist",
19
20
  "build": "npm run clean && tsc",
20
21
  "test": "node --test",
22
+ "lint": "eslint .",
21
23
  "openapi": "node scripts/generate-openapi.mjs",
22
- "prepublishOnly": "npm run build && npm test"
24
+ "prepublishOnly": "npm run lint && npm run build && npm test"
23
25
  },
24
26
  "keywords": [
25
27
  "reach",
@@ -30,7 +32,7 @@
30
32
  "api"
31
33
  ],
32
34
  "author": "Reach Team",
33
- "license": "MIT",
35
+ "license": "Apache-2.0",
34
36
  "repository": {
35
37
  "type": "git",
36
38
  "url": "git+https://github.com/sftgroup/reach.git"
@@ -40,7 +42,9 @@
40
42
  "access": "public"
41
43
  },
42
44
  "devDependencies": {
43
- "typescript": "^5.5.0"
45
+ "eslint": "^10.14.0",
46
+ "typescript": "^5.5.0",
47
+ "typescript-eslint": "^8.72.1"
44
48
  },
45
49
  "engines": {
46
50
  "node": ">=18.0.0"