@wanji_dsh/dsh-sales 0.10.6 → 0.11.0
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.zh.md +3 -1
- package/dist/client.js +351 -163
- package/dist/host.js +903 -602
- package/dist/types/company/host.d.ts +37 -0
- package/dist/types/company/identity.d.ts +23 -0
- package/dist/types/company/remote.d.ts +36 -0
- package/dist/types/generation-runtime.d.ts +9 -1
- package/dist/types/wechat/native.d.ts +3 -0
- package/dist/types/wechat/receiver.d.ts +5 -4
- package/dist/types/wechat/types.d.ts +1 -0
- package/docs/wechat-native-implementation.md +1 -1
- package/docs/wechat-sync.md +1 -1
- package/package.json +1 -1
- package/runtime/wechat-manifest.json +11 -11
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { HostContext } from '../knowledge-host.ts';
|
|
2
|
+
import { type CompanyBindingHint } from './identity.ts';
|
|
3
|
+
export type VerifiedIdentity = {
|
|
4
|
+
status: 'unavailable' | 'unbound' | 'ineligible';
|
|
5
|
+
} | {
|
|
6
|
+
status: 'awaiting';
|
|
7
|
+
authorizeUrl: string;
|
|
8
|
+
verificationCode?: string;
|
|
9
|
+
} | {
|
|
10
|
+
status: 'bound';
|
|
11
|
+
alias: string;
|
|
12
|
+
company?: string;
|
|
13
|
+
department?: string;
|
|
14
|
+
position?: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The company account integration owns credential storage and verification.
|
|
18
|
+
* Every request on its registered model provider must enforce current permission.
|
|
19
|
+
*/
|
|
20
|
+
export interface SalesCompanyIdentity {
|
|
21
|
+
readonly authorizeOrigin: string;
|
|
22
|
+
refresh(signal: AbortSignal): Promise<VerifiedIdentity>;
|
|
23
|
+
begin(hint: CompanyBindingHint, signal: AbortSignal): Promise<VerifiedIdentity>;
|
|
24
|
+
unbind(signal: AbortSignal): Promise<void>;
|
|
25
|
+
canUseSharedModel(): boolean;
|
|
26
|
+
}
|
|
27
|
+
type ModelSelection = {
|
|
28
|
+
provider: string;
|
|
29
|
+
model: string;
|
|
30
|
+
reasoningEffort?: string;
|
|
31
|
+
};
|
|
32
|
+
export declare function resolveCompanySalesModel(service: SalesCompanyIdentity | undefined, companyModelReady: boolean, local?: ModelSelection): {
|
|
33
|
+
readonly provider: "wanji-sales-company-flash";
|
|
34
|
+
readonly model: "deepseek-v4.1-flash";
|
|
35
|
+
} | ModelSelection | undefined;
|
|
36
|
+
export declare function registerCompanyIdentityRoute(ctx: HostContext, findService: () => SalesCompanyIdentity | undefined, modelReady: () => boolean): void;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const COMPANY_IDENTITY_ENDPOINT = "wanji-sales-company/identity";
|
|
2
|
+
export declare const COMPANY_FLASH: {
|
|
3
|
+
readonly provider: "wanji-sales-company-flash";
|
|
4
|
+
readonly model: "deepseek-v4.1-flash";
|
|
5
|
+
};
|
|
6
|
+
export interface CompanyBindingHint {
|
|
7
|
+
alias?: string;
|
|
8
|
+
phone?: string;
|
|
9
|
+
}
|
|
10
|
+
export type CompanyIdentityView = {
|
|
11
|
+
status: 'unavailable' | 'unbound' | 'ineligible';
|
|
12
|
+
} | {
|
|
13
|
+
status: 'awaiting';
|
|
14
|
+
authorizeUrl: string;
|
|
15
|
+
verificationCode?: string;
|
|
16
|
+
} | {
|
|
17
|
+
status: 'bound';
|
|
18
|
+
alias: string;
|
|
19
|
+
company?: string;
|
|
20
|
+
department?: string;
|
|
21
|
+
position?: string;
|
|
22
|
+
modelReady: boolean;
|
|
23
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { SalesCompanyIdentity } from './host.ts';
|
|
2
|
+
export declare const COMPANY_ORIGIN = "https://wanjidazi.com";
|
|
3
|
+
interface CredentialStore {
|
|
4
|
+
resolve(ref: string): Promise<{
|
|
5
|
+
value: string;
|
|
6
|
+
source: string;
|
|
7
|
+
} | undefined>;
|
|
8
|
+
set(ref: string, value: string): Promise<void>;
|
|
9
|
+
unset(ref: string): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
interface Settings {
|
|
12
|
+
describe(options: {
|
|
13
|
+
redactSecrets: true;
|
|
14
|
+
}): {
|
|
15
|
+
ns: string;
|
|
16
|
+
revision: number;
|
|
17
|
+
value: unknown;
|
|
18
|
+
base?: unknown;
|
|
19
|
+
user?: unknown;
|
|
20
|
+
}[];
|
|
21
|
+
update(ns: string, patch: object, revision: number): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
interface Connection {
|
|
24
|
+
credentials: CredentialStore;
|
|
25
|
+
settings: Settings;
|
|
26
|
+
fetch?: typeof fetch;
|
|
27
|
+
}
|
|
28
|
+
export declare function createCompanyConnection({ credentials, settings, fetch: request }: Connection): {
|
|
29
|
+
identity: SalesCompanyIdentity;
|
|
30
|
+
ready: () => boolean;
|
|
31
|
+
};
|
|
32
|
+
export declare function companyConnectionFor(credentials: unknown, settings: unknown): {
|
|
33
|
+
identity: SalesCompanyIdentity;
|
|
34
|
+
ready: () => boolean;
|
|
35
|
+
} | undefined;
|
|
36
|
+
export {};
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import type { GenerationServices } from './generation-sessions.ts';
|
|
2
2
|
export declare const SALES_GENERATION_PRESET = "wanji-sales-generation";
|
|
3
|
+
type GenerationModel = {
|
|
4
|
+
provider: string;
|
|
5
|
+
model: string;
|
|
6
|
+
reasoningEffort?: string;
|
|
7
|
+
};
|
|
3
8
|
/** Permanent product-owned composition; never borrows the coding preset or its AGENTS/tools. */
|
|
4
9
|
export declare function createGenerationRuntime(sdk: {
|
|
5
10
|
agents: any;
|
|
6
11
|
presets: any;
|
|
7
|
-
defaults:
|
|
12
|
+
defaults: {
|
|
13
|
+
currentSelection(): GenerationModel | undefined;
|
|
14
|
+
};
|
|
8
15
|
registry: any;
|
|
9
16
|
titles?: {
|
|
10
17
|
rename(session: any, title: string): unknown;
|
|
@@ -15,3 +22,4 @@ export declare function createGenerationRuntime(sdk: {
|
|
|
15
22
|
}): GenerationServices & {
|
|
16
23
|
close(): Promise<void>;
|
|
17
24
|
};
|
|
25
|
+
export {};
|
|
@@ -4,9 +4,12 @@ export interface NativeCapabilities {
|
|
|
4
4
|
ready: boolean;
|
|
5
5
|
limitations: string[];
|
|
6
6
|
version?: string;
|
|
7
|
+
dynamicBridge?: boolean;
|
|
7
8
|
}
|
|
8
9
|
export declare class WechatLoginPendingError extends Error {
|
|
9
10
|
}
|
|
11
|
+
export declare class WechatCaptureBusyError extends Error {
|
|
12
|
+
}
|
|
10
13
|
export interface NativeCompletion {
|
|
11
14
|
type: 'completed';
|
|
12
15
|
stats: Record<string, number>;
|
|
@@ -10,15 +10,16 @@ interface Options {
|
|
|
10
10
|
export declare class LoopbackReceiver {
|
|
11
11
|
readonly address: string;
|
|
12
12
|
private headers;
|
|
13
|
-
private
|
|
13
|
+
private readonly pairingPort;
|
|
14
14
|
private options;
|
|
15
|
-
private
|
|
16
|
-
private
|
|
15
|
+
private endpoint?;
|
|
16
|
+
private desiredPort?;
|
|
17
17
|
private connected;
|
|
18
18
|
private stopped;
|
|
19
19
|
constructor(options: Options);
|
|
20
20
|
private request;
|
|
21
|
-
start(): void;
|
|
21
|
+
start(port?: number): void;
|
|
22
|
+
suspend(): void;
|
|
22
23
|
waitConnected(timeout?: number): Promise<void>;
|
|
23
24
|
private delay;
|
|
24
25
|
private poll;
|
|
@@ -43,6 +43,7 @@ export interface SyncCapabilities {
|
|
|
43
43
|
ready: boolean;
|
|
44
44
|
limitations: string[];
|
|
45
45
|
version?: string;
|
|
46
|
+
dynamicBridge?: boolean;
|
|
46
47
|
}
|
|
47
48
|
export type SyncPhase = 'disconnected' | 'ready' | 'starting' | 'authorizing' | 'collecting' | 'importing' | 'awaiting-login' | 'waiting' | 'paused' | 'error';
|
|
48
49
|
export interface SyncProgress {
|
|
@@ -12,7 +12,7 @@ Mac 固定 `DSHWechatWorker --serve`,普通用户常驻 stdio,每轮/授权
|
|
|
12
12
|
|
|
13
13
|
Windows 固定 `DSHWechatLauncher.exe`(本插件 C++ 源码),只接受有界十进制端口和64位hex令牌,只通过 ShellExecuteExW/runas 启动同目录固定 Worker,没有 shell/PowerShell/拼接脚本。Host 绑定随机 loopback TCP,以随机32字节令牌和 protocolVersion 2 鉴别首帧后复用连接。原用户 profile 来自 Node OS userInfo;提权 Worker 用 OS API 取得实际 token 用户 profile,不信任继承的 USERPROFILE。拒绝其他管理员账号。Host EOF 监视线程可撤销正在执行的采集,取消解码并结束 Worker,不等下一轮命令。
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
配对地址沿用 `http://127.0.0.1:18765/#wanji-local-sync=<64hex>`,用于保留既有同步检查点。Host 核验组件后,新版 Mac Worker 绑定系统分配的回环端口,通过当前请求的 `bridge_ready` 帧通知接收器。旧版 Mac 和 Windows 组件仍使用配对地址的固定端口。并行实例仍遵守同一用户的采集锁。新版 Mac 遇到锁被占用时,自动同步会稍后按原模式重试。手动全量同步仍保留后续增量检查点。其他断线按原有流程暂停或重新连接。
|
|
16
16
|
|
|
17
17
|
## 源码、许可证与构建
|
|
18
18
|
|
package/docs/wechat-sync.md
CHANGED
|
@@ -38,7 +38,7 @@ Mac 采集器按原值读取微信联系人标识,包括以短横线开头的
|
|
|
38
38
|
|
|
39
39
|
数据库/WAL/journal事件合并300ms,连续事件最长1秒唤醒;当前轮在运行时只记变化,完成后继续一轮,避免并发读取。可靠快速检查时5秒兜底,否则30秒;失败有上限退避。Mac 自动同步开始检查时,如遇微信尚未运行或尚未完成登录,页面显示“等待微信登录”。插件分别间隔 5、15、30、60 秒重试,最多四次,每次重新核验当前账号,并沿用原来的全量或增量模式。等待时可暂停;重试用尽后,登录微信并点击“重新同步”。其他 Worker 断连仍需手动重连。上述是调度参数,首次历史、解密、媒体与SQLite耗时另计,实际文字延迟待各平台真机测量。
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
原始数据库与读取密钥留在本机采集链路。批次通过 `127.0.0.1` 交给 Host,新版 Mac 组件使用系统分配的端口,旧版 Mac 和 Windows 组件使用 `18765`。SQLite 在独立线程提交消息、媒体、来源映射、分片基线及回执后才 ACK,失败或 ACK 丢失后可重放保留的快照。切号显示新账号,已入库旧账号历史保留并隔离。相同 server_id 跨平台归一,来源游标和无 server_id 的消息仍按平台设备区分。
|
|
42
42
|
|
|
43
43
|
消息库位于插件`storageDir/wechat/sales.sqlite`,目录0700、库文件0600;备份时应停止插件并保留SQLite相关文件。真实消息不写入旧演示journal。AI草稿绑定微信源版本,新消息会使其失效;人工稿保留并提示复核。生成只使用有界的文字证据,系统/未知消息及媒体占位不作为客户事实。AI仍使用已配置模型服务,不代表全部离线。
|
|
44
44
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"targets": {
|
|
5
5
|
"win32-x64": {
|
|
6
6
|
"url": "https://wanjidazi.com/plugins/sales-assistant/runtimes/wanji-wechat-runtime-1.0.1-win32-x64-5a5d6835924de5cf.tgz",
|
|
@@ -10,18 +10,18 @@
|
|
|
10
10
|
"componentSha256": "bfd4ca56fcc0b2ae7eb9b46cedd9ae726aa48a1232c6decffa292bfa55358f06"
|
|
11
11
|
},
|
|
12
12
|
"darwin-arm64": {
|
|
13
|
-
"url": "https://wanjidazi.com/plugins/sales-assistant/runtimes/wanji-wechat-runtime-1.0.
|
|
14
|
-
"sha256": "
|
|
15
|
-
"bytes":
|
|
16
|
-
"unpackedBytes":
|
|
17
|
-
"componentSha256": "
|
|
13
|
+
"url": "https://wanjidazi.com/plugins/sales-assistant/runtimes/wanji-wechat-runtime-1.0.3-darwin-arm64-aadc792973a0a385.tgz",
|
|
14
|
+
"sha256": "aadc792973a0a3854991aef5f6a411e47a3c4d6100b7a9f1e7ecfd73a0ef76a1",
|
|
15
|
+
"bytes": 26130583,
|
|
16
|
+
"unpackedBytes": 63490407,
|
|
17
|
+
"componentSha256": "81328adb34ce95e0c65ea8a80907ae6ec9c67f2d5b9294c6ee84cd52dfcc9b4c"
|
|
18
18
|
},
|
|
19
19
|
"darwin-x64": {
|
|
20
|
-
"url": "https://wanjidazi.com/plugins/sales-assistant/runtimes/wanji-wechat-runtime-1.0.
|
|
21
|
-
"sha256": "
|
|
22
|
-
"bytes":
|
|
23
|
-
"unpackedBytes":
|
|
24
|
-
"componentSha256": "
|
|
20
|
+
"url": "https://wanjidazi.com/plugins/sales-assistant/runtimes/wanji-wechat-runtime-1.0.2-darwin-x64-8307fbe4128e5f98.tgz",
|
|
21
|
+
"sha256": "8307fbe4128e5f989eb6ed1da9a6b41563bdc7222ffc5610e778e3c0c08df12d",
|
|
22
|
+
"bytes": 27823936,
|
|
23
|
+
"unpackedBytes": 66629042,
|
|
24
|
+
"componentSha256": "27f79bd4fbe41565e49cc6dc956312dd89d48b5c44baa94a100fb0a117047bb1"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|