@zhin.js/adapter-sandbox 1.1.7 → 1.1.8
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/CHANGELOG.md +31 -0
- package/lib/endpoint.d.ts +1 -2
- package/lib/endpoint.js +4 -0
- package/package.json +16 -16
- package/src/endpoint.ts +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @zhin.js/adapter-process
|
|
2
2
|
|
|
3
|
+
## 1.1.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9891e66: Endpoint 新增运行期 `selfUserId` 访问器与受保护的 `reportSelfUserId()`(`EndpointImplementation` 另可声明 `selfUserId`,`EndpointActivationContext` 提供 `reportSelfUserId`),并新增进程级 Peer Registry(`getProcessPeerRegistry()` / `createPeerRegistry()`)。账号仅在 generation active 后登记,回滚 / retire / stop 后移除;`EndpointIdentity` 保持不可变。ICQQ 在 `system.online` 上报 uin;OneBot11 ws/wss 从事件 `self_id` 与 `get_login_info` 上报;Sandbox 以配置的 bot id 作为合成账号。未上报的旧 Endpoint 不进入 Registry(fail closed),不会用配置 id 兜底。OneBot12 / napcat / milky 等其余适配器留待后续。
|
|
8
|
+
|
|
9
|
+
Peer Registry 使用登记序号(新 generation 胜出),旧实例在新实例登记后再次上报不会覆盖新条目;空值或非字符串的读取查询返回未命中而不抛错;OneBot11 在 stop 时清空 `selfUserId`。
|
|
10
|
+
|
|
11
|
+
登记序号在 Endpoint 激活时通过 `PeerRegistry.reserve()` 分配,新实例先上报、旧实例晚到的首次上报不会覆盖新条目。
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [9891e66]
|
|
14
|
+
- Updated dependencies [bf52b40]
|
|
15
|
+
- Updated dependencies [bf52b40]
|
|
16
|
+
- Updated dependencies [bf52b40]
|
|
17
|
+
- Updated dependencies [386150d]
|
|
18
|
+
- Updated dependencies [9891e66]
|
|
19
|
+
- Updated dependencies [9891e66]
|
|
20
|
+
- Updated dependencies [4778587]
|
|
21
|
+
- Updated dependencies [40537e3]
|
|
22
|
+
- Updated dependencies [681abf3]
|
|
23
|
+
- Updated dependencies [b3fea8c]
|
|
24
|
+
- Updated dependencies [9891e66]
|
|
25
|
+
- Updated dependencies [9891e66]
|
|
26
|
+
- @zhin.js/adapter@1.1.18
|
|
27
|
+
- @zhin.js/core@1.1.43
|
|
28
|
+
- @zhin.js/host-http@1.1.5
|
|
29
|
+
- @zhin.js/feature-kit@1.1.4
|
|
30
|
+
- @zhin.js/client@1.1.10
|
|
31
|
+
- @zhin.js/page@1.1.5
|
|
32
|
+
- @zhin.js/skill@1.1.5
|
|
33
|
+
|
|
3
34
|
## 1.1.7
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
package/lib/endpoint.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Endpoint } from 'zhin.js/adapter';
|
|
2
|
-
import { type EndpointSendRequest } from 'zhin.js/adapter';
|
|
1
|
+
import { Endpoint, type EndpointSendRequest } from 'zhin.js/adapter';
|
|
3
2
|
import type { HttpHost } from '@zhin.js/host-http';
|
|
4
3
|
import type { CapabilityId } from 'zhin.js';
|
|
5
4
|
import { type ResolvedSandboxBot } from './protocol.js';
|
package/lib/endpoint.js
CHANGED
|
@@ -117,12 +117,16 @@ export class SandboxWsEndpoint extends Endpoint {
|
|
|
117
117
|
}
|
|
118
118
|
open() {
|
|
119
119
|
this.#open = true;
|
|
120
|
+
// Synthetic account: Sandbox has no platform login, so its Bot identity is the
|
|
121
|
+
// configured bot id. Per-connection random names are not Bot accounts.
|
|
122
|
+
this.reportSelfUserId(this.#options.defaults.id);
|
|
120
123
|
}
|
|
121
124
|
close() {
|
|
122
125
|
this.#open = false;
|
|
123
126
|
}
|
|
124
127
|
stop() {
|
|
125
128
|
this.#open = false;
|
|
129
|
+
this.reportSelfUserId(undefined);
|
|
126
130
|
this.#wsHandleRelease?.();
|
|
127
131
|
this.#wsHandleRelease = undefined;
|
|
128
132
|
this.#wsPathRelease?.();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-sandbox",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "Zhin.js Sandbox adapter for Plugin Runtime (WebSocket /sandbox)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -48,16 +48,16 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"lucide-react": "^0.525.0",
|
|
50
50
|
"react": "^19.2.8",
|
|
51
|
-
"@zhin.js/adapter": "1.1.
|
|
52
|
-
"@zhin.js/client": "1.1.
|
|
51
|
+
"@zhin.js/adapter": "1.1.18",
|
|
52
|
+
"@zhin.js/client": "1.1.10",
|
|
53
53
|
"@zhin.js/console-contract": "1.1.1",
|
|
54
|
-
"@zhin.js/core": "1.1.
|
|
55
|
-
"@zhin.js/feature-kit": "1.1.
|
|
56
|
-
"@zhin.js/host-http": "1.1.
|
|
54
|
+
"@zhin.js/core": "1.1.43",
|
|
55
|
+
"@zhin.js/feature-kit": "1.1.4",
|
|
56
|
+
"@zhin.js/host-http": "1.1.5",
|
|
57
57
|
"@zhin.js/im-contract": "1.1.3",
|
|
58
58
|
"@zhin.js/logger": "1.1.1",
|
|
59
|
-
"@zhin.js/page": "1.1.
|
|
60
|
-
"@zhin.js/skill": "1.1.
|
|
59
|
+
"@zhin.js/page": "1.1.5",
|
|
60
|
+
"@zhin.js/skill": "1.1.5"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/react": "^19.2.18",
|
|
@@ -65,18 +65,18 @@
|
|
|
65
65
|
"typescript": "^6.0.3",
|
|
66
66
|
"vitest": "^4.1.10",
|
|
67
67
|
"ws": "^8.21.1",
|
|
68
|
-
"@zhin.js/pagemanager": "1.1.
|
|
69
|
-
"@zhin.js/runtime": "1.1.
|
|
70
|
-
"zhin.js": "1.1.
|
|
68
|
+
"@zhin.js/pagemanager": "1.1.6",
|
|
69
|
+
"@zhin.js/runtime": "1.1.6",
|
|
70
|
+
"zhin.js": "1.1.8"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"react": "^19.0.0",
|
|
74
|
-
"@zhin.js/adapter": "^1.1.
|
|
74
|
+
"@zhin.js/adapter": "^1.1.18",
|
|
75
75
|
"@zhin.js/console-contract": "^1.1.1",
|
|
76
|
-
"@zhin.js/core": "^1.1.
|
|
77
|
-
"@zhin.js/host-http": "^1.1.
|
|
78
|
-
"@zhin.js/page": "^1.1.
|
|
79
|
-
"zhin.js": "^1.1.
|
|
76
|
+
"@zhin.js/core": "^1.1.43",
|
|
77
|
+
"@zhin.js/host-http": "^1.1.5",
|
|
78
|
+
"@zhin.js/page": "^1.1.5",
|
|
79
|
+
"zhin.js": "^1.1.8"
|
|
80
80
|
},
|
|
81
81
|
"peerDependenciesMeta": {
|
|
82
82
|
"react": {
|
package/src/endpoint.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Endpoint } from 'zhin.js/adapter';
|
|
1
|
+
import { Endpoint, type EndpointSendRequest } from 'zhin.js/adapter';
|
|
2
2
|
/**
|
|
3
3
|
* SandboxWsEndpoint — WebSocket lifecycle and OutboundMessageService bridge for /sandbox.
|
|
4
4
|
*/
|
|
5
5
|
import { randomUUID } from 'node:crypto';
|
|
6
6
|
import { execFile } from 'node:child_process';
|
|
7
|
-
import { type EndpointSendRequest } from 'zhin.js/adapter';
|
|
8
7
|
import type { HttpHost, WsConnection } from '@zhin.js/host-http';
|
|
9
8
|
import { formatCompact, getAdapterLogger } from '@zhin.js/logger';
|
|
10
9
|
import type { CapabilityId } from 'zhin.js';
|
|
@@ -179,6 +178,9 @@ export class SandboxWsEndpoint extends Endpoint<SandboxClient> {
|
|
|
179
178
|
|
|
180
179
|
open(): void {
|
|
181
180
|
this.#open = true;
|
|
181
|
+
// Synthetic account: Sandbox has no platform login, so its Bot identity is the
|
|
182
|
+
// configured bot id. Per-connection random names are not Bot accounts.
|
|
183
|
+
this.reportSelfUserId(this.#options.defaults.id);
|
|
182
184
|
}
|
|
183
185
|
|
|
184
186
|
close(): void {
|
|
@@ -187,6 +189,7 @@ export class SandboxWsEndpoint extends Endpoint<SandboxClient> {
|
|
|
187
189
|
|
|
188
190
|
stop(): void {
|
|
189
191
|
this.#open = false;
|
|
192
|
+
this.reportSelfUserId(undefined);
|
|
190
193
|
this.#wsHandleRelease?.();
|
|
191
194
|
this.#wsHandleRelease = undefined;
|
|
192
195
|
this.#wsPathRelease?.();
|