@awiki/dsh-plugin 0.3.3 → 0.3.4

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.
Files changed (66) hide show
  1. package/README.md +37 -31
  2. package/README.zh.md +30 -27
  3. package/cordis.patch.yml +17 -0
  4. package/lib/client.js +1269 -272
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +874 -314
  7. package/lib/provider.js +52 -16
  8. package/lib/{sdk-adapter-CDLTgHJA.mjs → sdk-adapter-BeJakxLP.mjs} +142 -4
  9. package/lib/typert.host.js +419 -89
  10. package/lib/typert.remote-client.d.ts +19 -3
  11. package/lib/typert.remote-client.d.ts.map +1 -1
  12. package/lib/typert.remote-client.js +419 -89
  13. package/lib/types/client/AwikiDevices.d.ts +28 -0
  14. package/lib/types/client/AwikiDevices.d.ts.map +1 -0
  15. package/lib/types/client/AwikiDevices.js +85 -0
  16. package/lib/types/client/AwikiDevices.js.map +1 -0
  17. package/lib/types/client/AwikiIdentityAccess.d.ts +6 -5
  18. package/lib/types/client/AwikiIdentityAccess.d.ts.map +1 -1
  19. package/lib/types/client/AwikiIdentityAccess.js +88 -27
  20. package/lib/types/client/AwikiIdentityAccess.js.map +1 -1
  21. package/lib/types/client/AwikiOverlay.d.ts.map +1 -1
  22. package/lib/types/client/AwikiOverlay.js +4 -3
  23. package/lib/types/client/AwikiOverlay.js.map +1 -1
  24. package/lib/types/client/controller.d.ts +20 -5
  25. package/lib/types/client/controller.d.ts.map +1 -1
  26. package/lib/types/client/controller.js +38 -7
  27. package/lib/types/client/controller.js.map +1 -1
  28. package/lib/types/client/index.d.ts.map +1 -1
  29. package/lib/types/client/index.js +8 -0
  30. package/lib/types/client/index.js.map +1 -1
  31. package/lib/types/client/slots.d.ts +10 -2
  32. package/lib/types/client/slots.d.ts.map +1 -1
  33. package/lib/types/index.d.ts +51 -10
  34. package/lib/types/index.d.ts.map +1 -1
  35. package/lib/types/index.js +675 -174
  36. package/lib/types/index.js.map +1 -1
  37. package/lib/types/listener-state.d.ts +5 -3
  38. package/lib/types/listener-state.d.ts.map +1 -1
  39. package/lib/types/listener-state.js +28 -13
  40. package/lib/types/listener-state.js.map +1 -1
  41. package/lib/types/listener.d.ts +9 -32
  42. package/lib/types/listener.d.ts.map +1 -1
  43. package/lib/types/listener.js +11 -127
  44. package/lib/types/listener.js.map +1 -1
  45. package/lib/types/provider-api.d.ts +96 -4
  46. package/lib/types/provider-api.d.ts.map +1 -1
  47. package/lib/types/provider.d.ts +7 -1
  48. package/lib/types/provider.d.ts.map +1 -1
  49. package/lib/types/provider.js +53 -15
  50. package/lib/types/provider.js.map +1 -1
  51. package/lib/types/realtime-supervisor.d.ts +43 -0
  52. package/lib/types/realtime-supervisor.d.ts.map +1 -0
  53. package/lib/types/realtime-supervisor.js +166 -0
  54. package/lib/types/realtime-supervisor.js.map +1 -0
  55. package/lib/types/sdk-adapter.d.ts +28 -2
  56. package/lib/types/sdk-adapter.d.ts.map +1 -1
  57. package/lib/types/sdk-adapter.js +132 -3
  58. package/lib/types/sdk-adapter.js.map +1 -1
  59. package/lib/types/types.d.ts +76 -6
  60. package/lib/types/types.d.ts.map +1 -1
  61. package/lib/types/types.js.map +1 -1
  62. package/package.json +18 -18
  63. package/lib/types/profile-state.d.ts +0 -11
  64. package/lib/types/profile-state.d.ts.map +0 -1
  65. package/lib/types/profile-state.js +0 -48
  66. package/lib/types/profile-state.js.map +0 -1
package/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # @awiki/dsh-plugin
2
2
 
3
- AWiki identity and messaging for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness).
4
- The package installs one Host service, its production Rust SDK provider,
5
- the model tools, and a Web client with a draggable AWiki Me launcher.
3
+ AWiki account, authorization, recovery, and messaging for
4
+ [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness). The package installs one Host
5
+ service, its IM Core provider, the model tools, and a Web client with a draggable AWiki Me launcher.
6
+ General DID documents and private keys are managed by the independent
7
+ `@agent-network-protocol/dsh-anp-identity` plugin and injected through Cordis.
6
8
 
7
9
  [中文说明](./README.zh.md)
8
10
 
@@ -11,13 +13,16 @@ phone and OTP never enter browser persistence, controller snapshots, or public
11
13
  Remote results. Closed registration, unavailable verification state, and commit conflicts each give
12
14
  a safe next action without exposing remote response details.
13
15
 
14
- The Rust SDK exclusively owns the identity, SecretVault, database, cache, and metadata below the
15
- configured `stateRoot`. This release performs a clean cutover and does not import the former
16
- TypeScript SDK `identity.json`; create a new Rust-backed identity after upgrading.
16
+ The two plugins deliberately own different state. ANP Identity owns the multi-DID Store, DID
17
+ documents, private keys, and publication transactions. AWiki IM Core owns Handle/account bindings,
18
+ device and recovery workflows, authentication tokens, messages, mail, SQLite, and caches below its
19
+ configured `stateRoot`. The Host-only provider lease is never exposed to Browser, Remote, Agent
20
+ tools, or model APIs.
17
21
 
18
22
  ## Features
19
23
 
20
- - Enter a Handle and phone through one Web UI flow. Before any code is sent, the Host classifies the Handle: a new Handle receives a registration OTP and creates the deployment identity, while an existing Handle receives one Recovery V4 OTP and enters the recovery state machine directly.
24
+ - Enter a Handle and phone through one Web UI flow and always request a registration OTP. A new Handle creates the deployment identity; an existing Handle offers ordinary Device Join first, with Recovery V4 as an explicit destructive alternative that requests a second purpose-scoped OTP.
25
+ - DSH can join an existing Handle as an independent member device. When DSH created or recovered the Handle and is the current ready-admin, the foreground Devices tab can list devices, verify an incoming request with SAS, approve one member, reject it, or revoke another device. These mutations are not Agent tools and require explicit `APPROVE` / `REVOKE` confirmation.
21
26
  - Open the top-left AWiki account menu to sign out locally without deleting the encrypted identity or message database; **Resume local identity** restores the same DID and Handle, including across DSH restarts. The signed-out screen reveals phone recovery only after local resume fails. Switching identities requires an explicit confirmation that permanently clears local AWiki data first.
22
27
  - Reuse that identity across the root Agent and its subagents.
23
28
  - Direct-message and existing-group conversation lists, unread counts, latest-message previews, and persisted display names. Core SQLite remains the persistent source of truth: the Host joins persisted peer profiles onto Direct roster rows, while the browser keeps the active identity's last trustworthy Direct profile and group title. Sparse polling identifiers therefore cannot overwrite a resolved display name or real group title. After an existing Handle is recovered, the Host synchronizes account projections before asking Core to restore old group memberships; pending or blocked groups expose a retryable status without disabling Direct messages or other groups. Opening a conversation renders the committed local timeline first, hydrates group sender labels from the Core display-profile cache, reconciles remote history and Direct profile data in the background, and keeps local messages visible if refresh fails. A failed background roster poll also leaves the usable local view quiet; explicit loads still surface their errors. This local-first path covers the newest projected page; loading older messages still requires the remote history service. Scrolling up reveals a latest-message control that counts newer arrivals without interrupting reading. A conversation is marked read only after its newest rendered message reaches the visible bottom.
@@ -33,7 +38,7 @@ TypeScript SDK `identity.json`; create a new Rust-backed identity after upgradin
33
38
  - A typed second confirmation in the Settings danger zone before permanently clearing local AWiki identity, key, token, registration-draft, and message-index state.
34
39
  - Five messaging Agent tools: identity status, conversations, history, approved text send, and approved attachment send.
35
40
  - Five on-demand mail Agent tools: mailbox account, inbox, plain-text read, approved mark-read, and approved plain-text send.
36
- - An opt-in realtime listener that lets exact-allowlisted Direct peers continue one DSH Agent session or use `/new`, `/status`, and `/help`.
41
+ - A default identity-level realtime connection for Direct, Group, and System Notification sync, plus an independent opt-in Agent consumer that lets exact-allowlisted Direct peers continue one DSH Agent session or use `/new`, `/status`, and `/help`.
37
42
 
38
43
  ## Screenshots
39
44
 
@@ -64,9 +69,10 @@ are independent of that private-chat boundary.
64
69
 
65
70
  ## Install
66
71
 
67
- Install the official public npm package:
72
+ Install the independent identity plugin first, then AWiki:
68
73
 
69
74
  ```bash
75
+ dsh plugin --profile web add @agent-network-protocol/dsh-anp-identity@latest
70
76
  dsh plugin --profile web add @awiki/dsh-plugin@latest
71
77
  ```
72
78
 
@@ -88,10 +94,11 @@ families in a DSH root dependency tree.
88
94
  `0.2.0-rc.4`. The former `@awiki/dsh` registry entry was unpublished and is
89
95
  not an installation source for this release line.
90
96
 
91
- Apply the package after the normal DSH base and Web app bundles. Its
92
- The main `cordis.patch.yml` adds the AWiki Host service, Rust SDK provider, and
93
- summary provider; DSH discovers and injects the browser client through the
94
- package metadata. It does not insert Model Proxy. The optional package has its
97
+ Apply the packages after the normal DSH base and Web app bundles. The main
98
+ `cordis.patch.yml` loads the ANP Identity Service, its native Provider, the AWiki Host Service, the
99
+ AWiki IM Core Provider, and the summary Provider in that order; DSH discovers and injects the
100
+ browser client through package metadata. Teardown closes IM Core before revoking its identity
101
+ lease, and the identity Store Provider closes last. The patch does not insert Model Proxy. The optional package has its
95
102
  own patch, inserts exactly one `awiki-model-proxy` row after AWiki, and declares
96
103
  an explicit dependency on the loaded `awiki` service.
97
104
 
@@ -108,27 +115,23 @@ The plugin works against the public `awiki.ai` tenant without environment config
108
115
  | `DSH_AWIKI_MESSAGE_SERVICE_DID` | Authoritative message-service DID | `did:wba:awiki.ai` |
109
116
  | `DSH_AWIKI_MESSAGE_SERVICE_PUBLIC_URL` | Public endpoint written to protocol records | `https://awiki.ai` |
110
117
  | `DSH_AWIKI_ALLOWED_ATTACHMENT_ORIGINS` | JSON array of extra exact HTTPS origins | `[]` |
111
- | `DSH_AWIKI_STATE_ROOT` | Private Rust IM Core state directory; an explicit value overrides profile isolation | `$DSH_HOME/awiki/<profile>/im-core` or `~/.dsh/awiki/<profile>/im-core`; legacy `awiki/im-core` when no profile can be proven |
118
+ | `DSH_AWIKI_STATE_ROOT` | Private Rust IM Core state directory | `$DSH_HOME/awiki/im-core` or `~/.dsh/awiki/im-core` |
119
+ | `DSH_ANP_IDENTITY_STATE_ROOT` | Independent multi-DID ANP Identity Store | `$DSH_HOME/anp-identity` |
120
+ | `DSH_ANP_IDENTITY_ROOT_KEY_PROVIDER` | Store Root Key provider (`keyring`, `local-file`, `env`, or programmatic `injected`) | `keyring` |
121
+ | `DSH_ANP_IDENTITY_ROOT_KEY_PROVIDER_ID` | Keyring account, environment variable, or injected-provider identifier | `anp-identity/dsh` |
112
122
  | `DSH_AWIKI_VAULT_ROOT_KEY_FILE` | Existing private file containing a base64/base64url 32-byte Vault root key | `$DSH_HOME/awiki/secret-vault/root-key.b64u` |
113
123
  | `DSH_AWIKI_VAULT_WORKSPACE_ID` | Stable non-secret Vault workspace context | `dsh-awiki` |
114
124
  | `DSH_AWIKI_VAULT_DEVICE_ID` | Stable non-secret Vault device context | `local-device` |
115
125
  | `DSH_AWIKI_POLL_INTERVAL_MS` | Open-dialog polling interval | `5000` |
116
126
  | `DSH_AWIKI_ATTACHMENT_MAX_BYTES` | Decoded attachment limit | `10485760` |
117
127
  | `DSH_AWIKI_IMAGE_CACHE_MAX_BYTES` | Private verified image-preview cache budget | `67108864` |
128
+ | `DSH_AWIKI_REALTIME_ENABLED` | Enable the identity-level Direct/Group/System Notification WSS | `true` |
118
129
  | `DSH_AWIKI_LISTENER_ENABLED` | Enable the Direct-to-Agent listener | `false` |
119
130
  | `DSH_AWIKI_LISTENER_ALLOWED_PEERS` | JSON array of exact Handles or DIDs; required when enabled | `[]` |
120
131
  | `DSH_AWIKI_LISTENER_WORKSPACE_PATH` | Absolute shared Workspace for AWiki-originated Sessions | `$DSH_HOME/workspaces/awiki` or `~/.dsh/workspaces/awiki` |
121
132
  | `DSH_AWIKI_SUMMARY_MAX_INPUT_BYTES` | UTF-8 cap after Host-side summary minimization | `32768` |
122
133
  | `DSH_AWIKI_SUMMARY_TIMEOUT_MS` | One-shot model deadline | `30000` |
123
134
  | `DSH_AWIKI_SUMMARY_MAX_OUTPUT_TOKENS` | Structured summary output cap | `768` |
124
-
125
- The default state directory is isolated by DSH profile. Desktop uses the Host's
126
- `desktopProfiles.current.name`; ordinary `dsh --profile` accepts the name only when the Loader
127
- root exactly matches `$DSH_HOME/profiles/<name>`. The plugin does not guess from argv, ports, or
128
- process type, and does not copy a legacy database automatically. The old shared `awiki/im-core`
129
- directory remains untouched. When it is detected, the identity screen explains the isolation and
130
- guides the user to recover with the original Handle and phone as a separate device.
131
-
132
135
  ## AWiki-hosted DeepSeek account
133
136
 
134
137
  This capability now requires the separate `@awiki/dsh-model-proxy` package. It
@@ -215,14 +218,17 @@ underlying disk and backups.
215
218
  The Node facade owns `stateRoot/vault/root-key.b64u`; the Host does not provide, copy, or log Vault
216
219
  key material. Preserve the complete SDK state root across ordinary restarts and upgrades.
217
220
 
218
- The listener is disabled unless both `DSH_AWIKI_LISTENER_ENABLED=true` and a non-empty exact
219
- allowlist are configured. On startup and every Core realtime scheduling signal it runs canonical
220
- reliable sync before reading committed history. Core owns WebSocket connection and reconnect;
221
- stream closure is recovered as stop, reconnect sync, then replacement realtime session. One
222
- persisted route and message watermark per Direct conversation preserve the current DSH Session
223
- across restarts. Every AWiki-originated Session is created in and attached to the registered shared
224
- AWiki Workspace. Listener messages are untrusted user data and do not approve tools or bridge
225
- approval/user-question prompts.
221
+ The identity-level realtime supervisor is enabled by default and owns the deployment identity's
222
+ single Core WebSocket without depending on Workspace or Agent configuration. Direct, Group, and
223
+ System Notification events schedule canonical reliable sync; WSS never advances a checkpoint or
224
+ authorizes a device by itself. `DSH_AWIKI_REALTIME_ENABLED=false` explicitly falls back to HTTP
225
+ refresh. The optional Direct-to-Agent consumer still requires both
226
+ `DSH_AWIKI_LISTENER_ENABLED=true` and a non-empty exact allowlist. It reads only committed Direct
227
+ text after eligible sync causes and cannot start or stop WSS. One identity-scoped route and message
228
+ watermark per Direct conversation preserve the current DSH Session across restarts. Every
229
+ AWiki-originated Session is created in and attached to the registered shared AWiki Workspace.
230
+ Listener messages are untrusted user data and do not approve tools or bridge approval/user-question
231
+ prompts.
226
232
 
227
233
  For the default 10 MiB decoded attachment cap, configure a reverse-proxy request
228
234
  limit of at least 14 MiB to account for base64 and JSON overhead.
@@ -279,7 +285,7 @@ pnpm run verify:workspace
279
285
  pnpm pack --dry-run
280
286
  ```
281
287
 
282
- The production Host loads the exact `@awiki/im-core-node@0.1.8` runtime package;
288
+ The production Host loads the exact `@awiki/im-core-node@0.2.0` runtime package;
283
289
  the platform-specific native addon is selected through its optional dependencies
284
290
  and remains external to the JavaScript bundle. Consumers do not need Rust or an
285
291
  `awiki-cli-rs2` checkout. See `THIRD_PARTY_NOTICES.md` for provenance and
package/README.zh.md CHANGED
@@ -1,16 +1,18 @@
1
1
  # @awiki/dsh-plugin
2
2
 
3
3
  为 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 提供 AWiki
4
- 身份与消息能力。一个包同时包含 Host Service、Rust SDK Provider、Agent 工具,
5
- 以及带可拖动 AWiki Me 悬浮入口的 Web 客户端;入口默认位于 DSH 左下角侧栏区域。
4
+ 账号、授权、恢复与消息能力。主包包含 Host Service、IM Core Provider、Agent 工具,
5
+ 以及带可拖动 AWiki Me 悬浮入口的 Web 客户端;通用 DID 文档与私钥由独立的
6
+ `@agent-network-protocol/dsh-anp-identity` 插件管理,并通过 Cordis 注入。
6
7
 
7
- Rust SDK 独占管理配置的 `stateRoot` 下的身份、SecretVault、数据库、缓存和元数据。
8
- 本版本采用干净切换,不导入旧 TypeScript SDK `identity.json`;升级后需创建新的
9
- Rust 身份。
8
+ 两个插件的状态所有权相互独立:ANP Identity 管理多 DID Store、DID 文档、私钥和发布事务;
9
+ AWiki IM Core 管理 Handle/账号绑定、设备与恢复流程、认证令牌、消息、邮件、SQLite 和缓存。
10
+ Host-only Provider lease 不会进入 Browser、Remote、Agent tools 或模型 API。
10
11
 
11
12
  ## 功能
12
13
 
13
- - 在 Web UI 的统一入口输入 Handle 和手机号。Host 会在发送验证码前判断 Handle 状态:新 Handle 只发送注册验证码并创建部署级身份,已有 Handle 只发送 Recovery V4 恢复验证码并直接进入恢复流程;根 Agent 与子 Agent 共用最终身份。
14
+ - 在 Web UI 的统一入口输入 Handle 和手机号,并始终先发送注册验证码。新 Handle 创建部署级身份;已有 Handle 优先进入普通 Device Join,Recovery V4 仅作为显式危险替代项,并重新发送用途隔离的恢复验证码;根 Agent 与子 Agent 共用最终身份。
15
+ - DSH 可以作为独立 member 设备加入已有 Handle;当 DSH 创建或恢复 Handle、当前设备为 ready-admin 时,前台“设备”页可列出设备、通过 SAS 验证并批准 member、拒绝请求或撤销其他设备。管理动作不进入 Agent 工具,并要求显式输入 `APPROVE` / `REVOKE`。
14
16
  - 点击 AWiki 面板左上角图标可打开账户菜单;普通退出只锁定本机会话,不删除加密身份或消息数据库,重新进入及重启 DSH 后仍恢复同一个 DID 和 Handle。退出页默认只提供重新进入本机身份和使用其他身份;只有本机重新进入失败后才显示手机号恢复入口。改用其他身份必须先确认永久清除本地 AWiki 数据。
15
17
  - 身份入口失败时保留当前挂载表单中的手机号、Handle 和验证码,以便修正后重试;手机号和验证码不进入 Browser 持久化状态、controller snapshot 或公开 Remote 结果。仅恢复操作编号可用于崩溃续跑。注册未开放、验证码状态失效和提交冲突会给出对应的安全处理提示。
16
18
  - 私聊和已有群聊列表、未读角标、最新消息预览、时间更新与昵称持久化。Core SQLite 是持久化真相源:Host 将持久化的对端资料合并进私聊列表,浏览器再按当前身份保留最后一次可信的私聊资料和群名,稀疏轮询中的 Handle、DID 或 Group DID 占位不会覆盖真实名称。恢复已有 Handle 后,Host 会先同步账号投影,再让 Core 自动恢复旧群聊成员身份;未完成或受阻的群聊会显示可重试状态,但不影响私聊和其他群聊。打开会话时先显示 Core 已提交的本地时间线,并从 Core 显示资料缓存补齐群消息发送者名称,再在后台补齐远端历史和私聊资料;刷新失败不会清空本地消息。后台会话轮询失败也不会用全局红条打断仍可用的本地页面,用户主动加载失败仍会正常提示。当前 local-first 只覆盖本地最新一页,“加载更早消息”仍需访问远端 history。向上阅读时显示下滑箭头,新消息到达后在同一控件中累计数量且不打断阅读位置。只有最新一条已渲染消息到达可视区域底部后,当前会话才会自动标记为已读。
@@ -18,7 +20,7 @@ Rust 身份。
18
20
  - 文本和单附件消息;Enter 发送、Shift+Enter 换行,发送中立即显示带 loading 动画的乐观气泡,并通过精确的客户端消息 ID 与已提交消息对账,避免同一条消息显示两个气泡;同时支持图片预览、附件说明与 SHA 校验。校验通过的图片字节使用三层有界缓存:浏览器运行期 LRU 让会话重新挂载时立即出图,按身份隔离的 IndexedDB 在整页刷新后无需访问 Host,Host 私有磁盘缓存则应对浏览器缓存丢失并跨 Harness 重启复用;“清除本地数据”会删除三层缓存。
19
21
  - 圆形可拖动入口、自适应四角弹窗、深色模式和当前会话记忆。
20
22
  - 用户点击后才生成的 AI 对话总结:最多处理 50 条最近或未读消息,按会话保留本次运行期缓存,并支持过期提示、重试、复制与跳转原消息。
21
- - OTP 身份入口会保留验证码输入表单,并按服务端返回的冷却时间显示重发倒计时、禁用提前重发;Handle 分流发生在发送前,因此每次只会发送一个用途正确的注册或恢复验证码。
23
+ - OTP 身份入口会保留验证码输入表单,并按服务端返回的冷却时间显示重发倒计时、禁用提前重发;已有 Handle 在消费 registration OTP 后再选择 Join 或 Recovery,Recovery 不复用 registration grant。
22
24
  - Recovery V4 进入 `applied` 后,Host 会用 current DID 解析已恢复 Handle 的原邮箱;如同时安装独立 Model Proxy 包,还会获取一份短时、固定受众的恢复凭证,把 current DID 对账到原模型账本,不复制余额、不做金额相加。临时失败只保留非敏感 operation id,并在重启后对同一幂等操作自动重试;恢复凭证和账本标识不会进入 Browser 状态、Agent 工具、日志或模型上下文。
23
25
  - 安装独立的 `@awiki/dsh-model-proxy` 后,仅在 Harness 没有任何可用模型时,首次引导才会在官方 API Key 步骤前提供 AWiki 托管模型选项;用户可以明确启用,也可以跳过并继续原版 API Key 流程。已经配置官方或其他 Provider 时,新会话不会显示 AWiki 模型或支付提示。
24
26
  - 可选 Model Proxy 包独占 Host 内部短期 Token 和全部模型托管界面:首次引导,以及“设置 → 快速充值”中的“账户与充值”“用量明细”。它提供 `deepseek-v4-flash` 和 `deepseek-v4-pro`,默认推荐 Flash;Token 不进入 Browser。
@@ -26,7 +28,7 @@ Rust 身份。
26
28
  - 在设置页危险区域中,经输入确认词的二次确认后,永久清空本机 AWiki 身份、密钥、令牌、注册草稿和消息索引。
27
29
  - 五个消息 Agent 工具:身份、会话、历史、需审批的文本发送和需审批的附件发送。
28
30
  - 五个按需邮件 Agent 工具:邮箱账户、收件箱、纯文本读取、需审批的标记已读和需审批的纯文本发送。
29
- - 可选的实时监听模式:exact allowlist 中的私聊对方可续接一个 DSH Agent 会话,或使用 `/new`、`/status`、`/help`。
31
+ - 默认身份级 realtime 连接统一调度 Direct、Group 和 System Notification 同步;独立、可选的 Agent consumer 允许 exact allowlist 中的私聊对方续接一个 DSH Agent 会话,或使用 `/new`、`/status`、`/help`。
30
32
 
31
33
  ## 界面截图
32
34
 
@@ -52,9 +54,10 @@ Rust 身份。
52
54
 
53
55
  ## 安装
54
56
 
55
- 安装公开发布的官方 npm 包:
57
+ 先安装独立身份插件,再安装 AWiki:
56
58
 
57
59
  ```bash
60
+ dsh plugin --profile web add @agent-network-protocol/dsh-anp-identity@latest
58
61
  dsh plugin --profile web add @awiki/dsh-plugin@latest
59
62
  ```
60
63
 
@@ -73,9 +76,10 @@ Profile 命令。本发布线面向 `0.1.1-rc.2` 包族,并精确锁定所有
73
76
  从 `0.2.0-rc.4` 起,`@awiki/dsh-plugin` 是唯一规范包名。原
74
77
  `@awiki/dsh` registry 条目已被 unpublish,不再作为本发布线的安装来源。
75
78
 
76
- 请在常规 DSH base 和 Web app bundle 之后应用本包。主包 `cordis.patch.yml` 会加入
77
- AWiki Host Service、Rust SDK Provider 和 Summary Provider;浏览器客户端由 DSH 根据
78
- 包元数据自动发现并注入。主 patch 不再插入 Model Proxy。可选包使用自己的 patch
79
+ 请在常规 DSH base 和 Web app bundle 之后应用本包。主包 `cordis.patch.yml` 会依次加入
80
+ ANP Identity Service、其 Native Provider、AWiki Host Service、AWiki IM Core Provider 和
81
+ Summary Provider;浏览器客户端由 DSH 根据包元数据自动发现并注入。卸载时先关闭 IM Core
82
+ 再撤销身份 lease,最后关闭身份 Store Provider。主 patch 不再插入 Model Proxy。可选包使用自己的 patch,
79
83
  只插入一个 `awiki-model-proxy`,并显式依赖已经加载的 `awiki` 服务。
80
84
 
81
85
  ## 配置
@@ -91,26 +95,23 @@ AWiki Host Service、Rust SDK Provider 和 Summary Provider;浏览器客户端
91
95
  | `DSH_AWIKI_MESSAGE_SERVICE_DID` | 权威消息服务 DID | `did:wba:awiki.ai` |
92
96
  | `DSH_AWIKI_MESSAGE_SERVICE_PUBLIC_URL` | 写入协议记录的公开 endpoint | `https://awiki.ai` |
93
97
  | `DSH_AWIKI_ALLOWED_ATTACHMENT_ORIGINS` | 额外附件 HTTPS origin 的 JSON 数组 | `[]` |
94
- | `DSH_AWIKI_STATE_ROOT` | 私有 Rust IM Core 状态目录;显式设置时覆盖 profile 隔离 | `$DSH_HOME/awiki/<profile>/im-core` 或 `~/.dsh/awiki/<profile>/im-core`;无法确认 profile 时兼容旧路径 `awiki/im-core` |
98
+ | `DSH_AWIKI_STATE_ROOT` | 私有 Rust IM Core 状态目录 | `$DSH_HOME/awiki/im-core` 或 `~/.dsh/awiki/im-core` |
99
+ | `DSH_ANP_IDENTITY_STATE_ROOT` | 独立的 ANP Identity 多 DID Store | `$DSH_HOME/anp-identity` |
100
+ | `DSH_ANP_IDENTITY_ROOT_KEY_PROVIDER` | Store 根密钥提供方(`keyring`、`local-file`、`env` 或程序注入的 `injected`) | `keyring` |
101
+ | `DSH_ANP_IDENTITY_ROOT_KEY_PROVIDER_ID` | Keyring account、环境变量名或 injected provider 标识 | `anp-identity/dsh` |
95
102
  | `DSH_AWIKI_VAULT_ROOT_KEY_FILE` | 含 base64/base64url 32-byte Vault root key 的既有私有文件 | `$DSH_HOME/awiki/secret-vault/root-key.b64u` |
96
103
  | `DSH_AWIKI_VAULT_WORKSPACE_ID` | 稳定、非秘密的 Vault workspace context | `dsh-awiki` |
97
104
  | `DSH_AWIKI_VAULT_DEVICE_ID` | 稳定、非秘密的 Vault device context | `local-device` |
98
105
  | `DSH_AWIKI_POLL_INTERVAL_MS` | 弹窗打开时的轮询间隔 | `5000` |
99
106
  | `DSH_AWIKI_ATTACHMENT_MAX_BYTES` | 解码后的附件上限 | `10485760` |
100
107
  | `DSH_AWIKI_IMAGE_CACHE_MAX_BYTES` | 私有图片预览缓存的磁盘预算 | `67108864` |
108
+ | `DSH_AWIKI_REALTIME_ENABLED` | 开启身份级 Direct/Group/System Notification WSS | `true` |
101
109
  | `DSH_AWIKI_LISTENER_ENABLED` | 开启私聊到 Agent 的 listener | `false` |
102
110
  | `DSH_AWIKI_LISTENER_ALLOWED_PEERS` | exact Handle/DID JSON 数组;开启时必填 | `[]` |
103
111
  | `DSH_AWIKI_LISTENER_WORKSPACE_PATH` | 所有 AWiki Session 共用的绝对 Workspace 路径 | `$DSH_HOME/workspaces/awiki` 或 `~/.dsh/workspaces/awiki` |
104
112
  | `DSH_AWIKI_SUMMARY_MAX_INPUT_BYTES` | Host 最小化后的 UTF-8 输入上限 | `32768` |
105
113
  | `DSH_AWIKI_SUMMARY_TIMEOUT_MS` | 单次模型调用超时 | `30000` |
106
114
  | `DSH_AWIKI_SUMMARY_MAX_OUTPUT_TOKENS` | 结构化摘要输出上限 | `768` |
107
-
108
- 默认状态目录按 DSH profile 隔离:Desktop 以 Host 公开的 `desktopProfiles.current.name`
109
- 为准,普通 `dsh --profile` 仅在 Loader 根目录严格匹配 `$DSH_HOME/profiles/<name>`
110
- 时采用该名称。插件不会从 argv、端口或进程类型猜测 profile,也不会自动复制旧数据库;
111
- 旧的共享 `awiki/im-core` 仍保留在原处。若检测到旧目录,身份入口会说明隔离原因并引导
112
- 用户通过原 Handle 和手机号恢复,把目标 profile 作为独立设备接入。
113
-
114
115
  ## AWiki 托管模型账户
115
116
 
116
117
  该能力现在需要单独安装 `@awiki/dsh-model-proxy`。它通过
@@ -180,12 +181,14 @@ Provider 域名和消息服务 DID 都是协议标识,不能根据 API host
180
181
  Node facade 独占 `stateRoot/vault/root-key.b64u`;Host 不提供、不复制也不记录 Vault key
181
182
  material。普通重启与升级期间应完整保留 SDK state root。
182
183
 
183
- Listener 只有在 `DSH_AWIKI_LISTENER_ENABLED=true` exact allowlist 非空时才启用。启动和每个
184
- Core realtime 调度信号都会先执行 canonical reliable sync,再读取已提交 history。WebSocket
185
- 连接与重连由 Core 所有;stream 关闭固定按“停止旧 session、reconnect sync、启动 replacement”
186
- 恢复。每个私聊持久化一个当前 DSH Session route 和消息 watermark,重启后可续接;所有 AWiki
187
- 来源 Session 都创建并 attach 到已注册的共享 AWiki Workspace。Listener 消息始终是不可信用户
188
- 数据,不会自动批准工具,也不会桥接 approval user-question prompt。
184
+ 身份级 realtime supervisor 默认开启,独占部署身份的一条 Core WebSocket,不依赖 Workspace 或
185
+ Agent 配置。Direct、Group System Notification 事件只调度 canonical reliable sync;WSS 本身
186
+ 不推进 checkpoint,也不授权设备。显式设置 `DSH_AWIKI_REALTIME_ENABLED=false` 可回退到 HTTP
187
+ refresh。私聊 Agent consumer 仍只有在 `DSH_AWIKI_LISTENER_ENABLED=true` exact allowlist
188
+ 非空时才启用;它只读取合格同步原因之后的已提交 Direct 文本,不能启动或停止 WSS。每个私聊的
189
+ DSH Session route 和消息 watermark 按身份隔离持久化,重启后可续接;所有 AWiki 来源 Session 都
190
+ 创建并 attach 到已注册的共享 AWiki Workspace。Listener 消息始终是不可信用户数据,不会自动批准
191
+ 工具,也不会桥接 approval 或 user-question prompt。
189
192
 
190
193
  默认附件上限为解码后 10 MiB;反向代理请求体上限至少应为 14 MiB,以容纳
191
194
  base64 与 JSON 封装开销。
@@ -236,7 +239,7 @@ pnpm run verify:workspace
236
239
  pnpm pack --dry-run
237
240
  ```
238
241
 
239
- 生产 Host 加载固定版本 `@awiki/im-core-node@0.1.8`;平台原生 addon 由它的
242
+ 生产 Host 加载固定版本 `@awiki/im-core-node@0.2.0`;平台原生 addon 由它的
240
243
  optional dependencies 选择,并保持在 JavaScript bundle 外。使用者无需安装 Rust,
241
244
  也无需检出 `awiki-cli-rs2`。来源与许可证见 `THIRD_PARTY_NOTICES.md`。
242
245
 
package/cordis.patch.yml CHANGED
@@ -2,6 +2,22 @@
2
2
  # @deepseek-ai/dsh-base and @deepseek-ai/dsh-web-app.
3
3
 
4
4
  - insert:
5
+ - id: anp-identity
6
+ name: '@agent-network-protocol/dsh-anp-identity'
7
+ config:
8
+ stateRoot: !!js process.env.DSH_ANP_IDENTITY_STATE_ROOT
9
+ allowConsumers: ['@awiki/dsh-plugin']
10
+ allowProviderConsumers: ['@awiki/dsh-plugin']
11
+ recoveryOnOpen: true
12
+
13
+ - id: anp-identity-provider
14
+ name: '@agent-network-protocol/dsh-anp-identity/provider'
15
+ config:
16
+ stateRoot: !!js process.env.DSH_ANP_IDENTITY_STATE_ROOT
17
+ rootKeyProvider: !!js process.env.DSH_ANP_IDENTITY_ROOT_KEY_PROVIDER ?? 'keyring'
18
+ rootKeyProviderId: !!js process.env.DSH_ANP_IDENTITY_ROOT_KEY_PROVIDER_ID ?? 'anp-identity/dsh'
19
+ keyringFallbackToLocalFile: false
20
+
5
21
  - id: awiki
6
22
  name: '@awiki/dsh-plugin'
7
23
  config:
@@ -17,6 +33,7 @@
17
33
  attachmentMaxBytes: !!js Number(process.env.DSH_AWIKI_ATTACHMENT_MAX_BYTES ?? '10485760')
18
34
  imageAttachmentCacheMaxBytes: !!js Number(process.env.DSH_AWIKI_IMAGE_CACHE_MAX_BYTES ?? '67108864')
19
35
  summaryMaxInputBytes: !!js Number(process.env.DSH_AWIKI_SUMMARY_MAX_INPUT_BYTES ?? '32768')
36
+ realtimeEnabled: !!js JSON.parse(process.env.DSH_AWIKI_REALTIME_ENABLED || 'true')
20
37
  listenerEnabled: !!js process.env.DSH_AWIKI_LISTENER_ENABLED === 'true'
21
38
  listenerAllowedPeers: !!js JSON.parse(process.env.DSH_AWIKI_LISTENER_ALLOWED_PEERS ?? '[]')
22
39
  listenerWorkspacePath: !!js process.env.DSH_AWIKI_LISTENER_WORKSPACE_PATH