@awiki/dsh-plugin 0.3.1 → 0.3.3

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 (37) hide show
  1. package/README.md +16 -2
  2. package/README.zh.md +13 -2
  3. package/lib/client.js +82 -18
  4. package/lib/client.js.map +1 -1
  5. package/lib/index.js +139 -19
  6. package/lib/provider.js +1 -1
  7. package/lib/{sdk-adapter-BIbsJmRj.mjs → sdk-adapter-CDLTgHJA.mjs} +13 -2
  8. package/lib/typert.host.js +45 -43
  9. package/lib/typert.remote-client.js +45 -43
  10. package/lib/types/client/AwikiIdentityAccess.d.ts +2 -0
  11. package/lib/types/client/AwikiIdentityAccess.d.ts.map +1 -1
  12. package/lib/types/client/AwikiIdentityAccess.js +1 -1
  13. package/lib/types/client/AwikiIdentityAccess.js.map +1 -1
  14. package/lib/types/client/AwikiOverlay.d.ts.map +1 -1
  15. package/lib/types/client/AwikiOverlay.js +1 -1
  16. package/lib/types/client/AwikiOverlay.js.map +1 -1
  17. package/lib/types/client/controller.d.ts +2 -0
  18. package/lib/types/client/controller.d.ts.map +1 -1
  19. package/lib/types/client/controller.js +17 -13
  20. package/lib/types/client/controller.js.map +1 -1
  21. package/lib/types/index.d.ts +11 -1
  22. package/lib/types/index.d.ts.map +1 -1
  23. package/lib/types/index.js +123 -14
  24. package/lib/types/index.js.map +1 -1
  25. package/lib/types/profile-state.d.ts +11 -0
  26. package/lib/types/profile-state.d.ts.map +1 -0
  27. package/lib/types/profile-state.js +48 -0
  28. package/lib/types/profile-state.js.map +1 -0
  29. package/lib/types/provider-api.d.ts +7 -0
  30. package/lib/types/provider-api.d.ts.map +1 -1
  31. package/lib/types/sdk-adapter.d.ts +4 -0
  32. package/lib/types/sdk-adapter.d.ts.map +1 -1
  33. package/lib/types/sdk-adapter.js +12 -1
  34. package/lib/types/sdk-adapter.js.map +1 -1
  35. package/lib/types/types.d.ts +5 -1
  36. package/lib/types/types.d.ts.map +1 -1
  37. package/package.json +2 -2
package/README.md CHANGED
@@ -26,6 +26,7 @@ TypeScript SDK `identity.json`; create a new Rust-backed identity after upgradin
26
26
  - A draggable circular launcher that defaults to the lower-left sidebar area, adaptive popup placement, dark mode, and remembered active conversation.
27
27
  - User-triggered AI summaries for up to 50 recent or unread messages, kept only in runtime memory with explicit stale, retry, copy, and source-navigation states.
28
28
  - OTP identity access keeps the verification form visible and disables resend with a visible server-directed cooldown countdown. Handle classification happens before OTP delivery, so each attempt sends exactly one purpose-correct registration or recovery code.
29
+ - After Recovery V4 reaches `applied`, the Host resolves the recovered Handle's original mailbox under the current DID. If the separate Model Proxy package is installed, the Host also obtains one short-lived, audience-bound recovery attestation and reconciles the current DID to the original billing account without copying or adding balances. A temporary failure keeps only the non-secret recovery operation ID and retries the same idempotent reconciliation after restart; the attestation and ledger identity never enter Browser state, Agent tools, logs, or model context.
29
30
  - When the separate `@awiki/dsh-model-proxy` package is installed, an AWiki-hosted DeepSeek choice appears before the official API-key onboarding step only when Harness has no usable model provider, with an explicit opt-in and an unchanged API-key escape path. New sessions do not show AWiki model or payment prompts after the official or another provider is usable.
30
31
  - The optional model-proxy package owns the Host short-token flow and every model-hosting Browser surface: onboarding plus Settings → Quick Recharge with Account & Recharge and Usage tabs. It registers `awiki-deepseek` with `deepseek-v4-flash` and `deepseek-v4-pro`; Flash is recommended and credentials never enter the Browser.
31
32
  - AWiki identity, domain, and local-data settings remain in the main package. Installing only the main package does not register model opt-in, recharge, usage, or model onboarding UI.
@@ -56,6 +57,11 @@ untrusted external data, never Agent instructions. `awiki_mail_mark_read` and `a
56
57
  require execution approval. Mail send is attempted once without automatic retry; a timeout or
57
58
  transport loss returns `delivery-unknown`, so inspect the mailbox before approving another send.
58
59
 
60
+ Identity recovery does not add server-side private-chat restoration. A fresh local state does not
61
+ reconstruct historical Direct conversations; only ordinary data already retained by the Rust SDK
62
+ continues to follow Core's existing local migration rules. Mailbox and hosted-model reconciliation
63
+ are independent of that private-chat boundary.
64
+
59
65
  ## Install
60
66
 
61
67
  Install the official public npm package:
@@ -102,7 +108,7 @@ The plugin works against the public `awiki.ai` tenant without environment config
102
108
  | `DSH_AWIKI_MESSAGE_SERVICE_DID` | Authoritative message-service DID | `did:wba:awiki.ai` |
103
109
  | `DSH_AWIKI_MESSAGE_SERVICE_PUBLIC_URL` | Public endpoint written to protocol records | `https://awiki.ai` |
104
110
  | `DSH_AWIKI_ALLOWED_ATTACHMENT_ORIGINS` | JSON array of extra exact HTTPS origins | `[]` |
105
- | `DSH_AWIKI_STATE_ROOT` | Private Rust IM Core state directory | `$DSH_HOME/awiki/im-core` or `~/.dsh/awiki/im-core` |
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 |
106
112
  | `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` |
107
113
  | `DSH_AWIKI_VAULT_WORKSPACE_ID` | Stable non-secret Vault workspace context | `dsh-awiki` |
108
114
  | `DSH_AWIKI_VAULT_DEVICE_ID` | Stable non-secret Vault device context | `local-device` |
@@ -115,6 +121,14 @@ The plugin works against the public `awiki.ai` tenant without environment config
115
121
  | `DSH_AWIKI_SUMMARY_MAX_INPUT_BYTES` | UTF-8 cap after Host-side summary minimization | `32768` |
116
122
  | `DSH_AWIKI_SUMMARY_TIMEOUT_MS` | One-shot model deadline | `30000` |
117
123
  | `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
+
118
132
  ## AWiki-hosted DeepSeek account
119
133
 
120
134
  This capability now requires the separate `@awiki/dsh-model-proxy` package. It
@@ -265,7 +279,7 @@ pnpm run verify:workspace
265
279
  pnpm pack --dry-run
266
280
  ```
267
281
 
268
- The production Host loads the exact `@awiki/im-core-node@0.1.6` runtime package;
282
+ The production Host loads the exact `@awiki/im-core-node@0.1.8` runtime package;
269
283
  the platform-specific native addon is selected through its optional dependencies
270
284
  and remains external to the JavaScript bundle. Consumers do not need Rust or an
271
285
  `awiki-cli-rs2` checkout. See `THIRD_PARTY_NOTICES.md` for provenance and
package/README.zh.md CHANGED
@@ -19,6 +19,7 @@ Rust 身份。
19
19
  - 圆形可拖动入口、自适应四角弹窗、深色模式和当前会话记忆。
20
20
  - 用户点击后才生成的 AI 对话总结:最多处理 50 条最近或未读消息,按会话保留本次运行期缓存,并支持过期提示、重试、复制与跳转原消息。
21
21
  - OTP 身份入口会保留验证码输入表单,并按服务端返回的冷却时间显示重发倒计时、禁用提前重发;Handle 分流发生在发送前,因此每次只会发送一个用途正确的注册或恢复验证码。
22
+ - Recovery V4 进入 `applied` 后,Host 会用 current DID 解析已恢复 Handle 的原邮箱;如同时安装独立 Model Proxy 包,还会获取一份短时、固定受众的恢复凭证,把 current DID 对账到原模型账本,不复制余额、不做金额相加。临时失败只保留非敏感 operation id,并在重启后对同一幂等操作自动重试;恢复凭证和账本标识不会进入 Browser 状态、Agent 工具、日志或模型上下文。
22
23
  - 安装独立的 `@awiki/dsh-model-proxy` 后,仅在 Harness 没有任何可用模型时,首次引导才会在官方 API Key 步骤前提供 AWiki 托管模型选项;用户可以明确启用,也可以跳过并继续原版 API Key 流程。已经配置官方或其他 Provider 时,新会话不会显示 AWiki 模型或支付提示。
23
24
  - 可选 Model Proxy 包独占 Host 内部短期 Token 和全部模型托管界面:首次引导,以及“设置 → 快速充值”中的“账户与充值”“用量明细”。它提供 `deepseek-v4-flash` 和 `deepseek-v4-pro`,默认推荐 Flash;Token 不进入 Browser。
24
25
  - AWiki 主包只保留身份、域名和本地数据设置。只安装主包时,不会注册模型启停、充值、用量或模型首次引导界面。
@@ -46,6 +47,9 @@ Rust 身份。
46
47
  `awiki_mail_send` 每次执行都需要审批。邮件发送只尝试一次且不自动重试;超时或传输中断返回
47
48
  `delivery-unknown`,再次审批发送前应先检查邮箱。
48
49
 
50
+ 身份恢复不新增服务端私聊恢复。清空本地状态后不会重新构造历史私聊会话;只有 Rust SDK
51
+ 已经保留的普通本地数据继续遵循 Core 既有迁移规则。邮箱和托管模型账本对账与私聊边界相互独立。
52
+
49
53
  ## 安装
50
54
 
51
55
  安装公开发布的官方 npm 包:
@@ -87,7 +91,7 @@ AWiki Host Service、Rust SDK Provider 和 Summary Provider;浏览器客户端
87
91
  | `DSH_AWIKI_MESSAGE_SERVICE_DID` | 权威消息服务 DID | `did:wba:awiki.ai` |
88
92
  | `DSH_AWIKI_MESSAGE_SERVICE_PUBLIC_URL` | 写入协议记录的公开 endpoint | `https://awiki.ai` |
89
93
  | `DSH_AWIKI_ALLOWED_ATTACHMENT_ORIGINS` | 额外附件 HTTPS origin 的 JSON 数组 | `[]` |
90
- | `DSH_AWIKI_STATE_ROOT` | 私有 Rust IM Core 状态目录 | `$DSH_HOME/awiki/im-core` 或 `~/.dsh/awiki/im-core` |
94
+ | `DSH_AWIKI_STATE_ROOT` | 私有 Rust IM Core 状态目录;显式设置时覆盖 profile 隔离 | `$DSH_HOME/awiki/<profile>/im-core` 或 `~/.dsh/awiki/<profile>/im-core`;无法确认 profile 时兼容旧路径 `awiki/im-core` |
91
95
  | `DSH_AWIKI_VAULT_ROOT_KEY_FILE` | 含 base64/base64url 32-byte Vault root key 的既有私有文件 | `$DSH_HOME/awiki/secret-vault/root-key.b64u` |
92
96
  | `DSH_AWIKI_VAULT_WORKSPACE_ID` | 稳定、非秘密的 Vault workspace context | `dsh-awiki` |
93
97
  | `DSH_AWIKI_VAULT_DEVICE_ID` | 稳定、非秘密的 Vault device context | `local-device` |
@@ -100,6 +104,13 @@ AWiki Host Service、Rust SDK Provider 和 Summary Provider;浏览器客户端
100
104
  | `DSH_AWIKI_SUMMARY_MAX_INPUT_BYTES` | Host 最小化后的 UTF-8 输入上限 | `32768` |
101
105
  | `DSH_AWIKI_SUMMARY_TIMEOUT_MS` | 单次模型调用超时 | `30000` |
102
106
  | `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
+
103
114
  ## AWiki 托管模型账户
104
115
 
105
116
  该能力现在需要单独安装 `@awiki/dsh-model-proxy`。它通过
@@ -225,7 +236,7 @@ pnpm run verify:workspace
225
236
  pnpm pack --dry-run
226
237
  ```
227
238
 
228
- 生产 Host 加载固定版本 `@awiki/im-core-node@0.1.6`;平台原生 addon 由它的
239
+ 生产 Host 加载固定版本 `@awiki/im-core-node@0.1.8`;平台原生 addon 由它的
229
240
  optional dependencies 选择,并保持在 JavaScript bundle 外。使用者无需安装 Rust,
230
241
  也无需检出 `awiki-cli-rs2`。来源与许可证见 `THIRD_PARTY_NOTICES.md`。
231
242
 
package/lib/client.js CHANGED
@@ -4112,6 +4112,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4112
4112
  literal("forbidden"),
4113
4113
  literal("identity-recovery-required"),
4114
4114
  literal("conflict"),
4115
+ literal("state-in-use"),
4115
4116
  literal("rate-limited"),
4116
4117
  literal("group-membership-required"),
4117
4118
  literal("group-identity-stale"),
@@ -4171,6 +4172,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4171
4172
  literal("forbidden"),
4172
4173
  literal("identity-recovery-required"),
4173
4174
  literal("conflict"),
4175
+ literal("state-in-use"),
4174
4176
  literal("rate-limited"),
4175
4177
  literal("group-membership-required"),
4176
4178
  literal("group-identity-stale"),
@@ -4209,6 +4211,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4209
4211
  literal("forbidden"),
4210
4212
  literal("identity-recovery-required"),
4211
4213
  literal("conflict"),
4214
+ literal("state-in-use"),
4212
4215
  literal("rate-limited"),
4213
4216
  literal("group-membership-required"),
4214
4217
  literal("group-identity-stale"),
@@ -4247,6 +4250,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4247
4250
  literal("forbidden"),
4248
4251
  literal("identity-recovery-required"),
4249
4252
  literal("conflict"),
4253
+ literal("state-in-use"),
4250
4254
  literal("rate-limited"),
4251
4255
  literal("group-membership-required"),
4252
4256
  literal("group-identity-stale"),
@@ -4293,6 +4297,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4293
4297
  literal("forbidden"),
4294
4298
  literal("identity-recovery-required"),
4295
4299
  literal("conflict"),
4300
+ literal("state-in-use"),
4296
4301
  literal("rate-limited"),
4297
4302
  literal("group-membership-required"),
4298
4303
  literal("group-identity-stale"),
@@ -4327,6 +4332,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4327
4332
  literal("forbidden"),
4328
4333
  literal("identity-recovery-required"),
4329
4334
  literal("conflict"),
4335
+ literal("state-in-use"),
4330
4336
  literal("rate-limited"),
4331
4337
  literal("group-membership-required"),
4332
4338
  literal("group-identity-stale"),
@@ -4365,6 +4371,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4365
4371
  literal("forbidden"),
4366
4372
  literal("identity-recovery-required"),
4367
4373
  literal("conflict"),
4374
+ literal("state-in-use"),
4368
4375
  literal("rate-limited"),
4369
4376
  literal("group-membership-required"),
4370
4377
  literal("group-identity-stale"),
@@ -4408,6 +4415,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4408
4415
  literal("forbidden"),
4409
4416
  literal("identity-recovery-required"),
4410
4417
  literal("conflict"),
4418
+ literal("state-in-use"),
4411
4419
  literal("rate-limited"),
4412
4420
  literal("group-membership-required"),
4413
4421
  literal("group-identity-stale"),
@@ -4427,7 +4435,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4427
4435
  "ok": literal(true).readonly(),
4428
4436
  "value": object({
4429
4437
  "pollIntervalMs": number().readonly(),
4430
- "attachmentMaxBytes": number().readonly()
4438
+ "attachmentMaxBytes": number().readonly(),
4439
+ "profileName": string().readonly().optional(),
4440
+ "legacySharedStateDetected": boolean().readonly().optional()
4431
4441
  }).readonly()
4432
4442
  })]);
4433
4443
  const _awiki_dsh_plugin_awiki_getConversationPreferences_result$schema = union([object({
@@ -4445,6 +4455,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4445
4455
  literal("forbidden"),
4446
4456
  literal("identity-recovery-required"),
4447
4457
  literal("conflict"),
4458
+ literal("state-in-use"),
4448
4459
  literal("rate-limited"),
4449
4460
  literal("group-membership-required"),
4450
4461
  literal("group-identity-stale"),
@@ -4504,6 +4515,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4504
4515
  literal("forbidden"),
4505
4516
  literal("identity-recovery-required"),
4506
4517
  literal("conflict"),
4518
+ literal("state-in-use"),
4507
4519
  literal("rate-limited"),
4508
4520
  literal("group-membership-required"),
4509
4521
  literal("group-identity-stale"),
@@ -4551,6 +4563,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4551
4563
  literal("forbidden"),
4552
4564
  literal("identity-recovery-required"),
4553
4565
  literal("conflict"),
4566
+ literal("state-in-use"),
4554
4567
  literal("rate-limited"),
4555
4568
  literal("group-membership-required"),
4556
4569
  literal("group-identity-stale"),
@@ -4619,6 +4632,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4619
4632
  literal("forbidden"),
4620
4633
  literal("identity-recovery-required"),
4621
4634
  literal("conflict"),
4635
+ literal("state-in-use"),
4622
4636
  literal("rate-limited"),
4623
4637
  literal("group-membership-required"),
4624
4638
  literal("group-identity-stale"),
@@ -4663,6 +4677,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4663
4677
  literal("forbidden"),
4664
4678
  literal("identity-recovery-required"),
4665
4679
  literal("conflict"),
4680
+ literal("state-in-use"),
4666
4681
  literal("rate-limited"),
4667
4682
  literal("group-membership-required"),
4668
4683
  literal("group-identity-stale"),
@@ -4731,6 +4746,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4731
4746
  literal("forbidden"),
4732
4747
  literal("identity-recovery-required"),
4733
4748
  literal("conflict"),
4749
+ literal("state-in-use"),
4734
4750
  literal("rate-limited"),
4735
4751
  literal("group-membership-required"),
4736
4752
  literal("group-identity-stale"),
@@ -4769,6 +4785,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4769
4785
  literal("forbidden"),
4770
4786
  literal("identity-recovery-required"),
4771
4787
  literal("conflict"),
4788
+ literal("state-in-use"),
4772
4789
  literal("rate-limited"),
4773
4790
  literal("group-membership-required"),
4774
4791
  literal("group-identity-stale"),
@@ -4811,6 +4828,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4811
4828
  literal("forbidden"),
4812
4829
  literal("identity-recovery-required"),
4813
4830
  literal("conflict"),
4831
+ literal("state-in-use"),
4814
4832
  literal("rate-limited"),
4815
4833
  literal("group-membership-required"),
4816
4834
  literal("group-identity-stale"),
@@ -4865,6 +4883,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4865
4883
  literal("forbidden"),
4866
4884
  literal("identity-recovery-required"),
4867
4885
  literal("conflict"),
4886
+ literal("state-in-use"),
4868
4887
  literal("rate-limited"),
4869
4888
  literal("group-membership-required"),
4870
4889
  literal("group-identity-stale"),
@@ -4912,6 +4931,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4912
4931
  literal("forbidden"),
4913
4932
  literal("identity-recovery-required"),
4914
4933
  literal("conflict"),
4934
+ literal("state-in-use"),
4915
4935
  literal("rate-limited"),
4916
4936
  literal("group-membership-required"),
4917
4937
  literal("group-identity-stale"),
@@ -4950,6 +4970,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4950
4970
  literal("forbidden"),
4951
4971
  literal("identity-recovery-required"),
4952
4972
  literal("conflict"),
4973
+ literal("state-in-use"),
4953
4974
  literal("rate-limited"),
4954
4975
  literal("group-membership-required"),
4955
4976
  literal("group-identity-stale"),
@@ -4993,6 +5014,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4993
5014
  literal("forbidden"),
4994
5015
  literal("identity-recovery-required"),
4995
5016
  literal("conflict"),
5017
+ literal("state-in-use"),
4996
5018
  literal("rate-limited"),
4997
5019
  literal("group-membership-required"),
4998
5020
  literal("group-identity-stale"),
@@ -5031,6 +5053,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5031
5053
  literal("forbidden"),
5032
5054
  literal("identity-recovery-required"),
5033
5055
  literal("conflict"),
5056
+ literal("state-in-use"),
5034
5057
  literal("rate-limited"),
5035
5058
  literal("group-membership-required"),
5036
5059
  literal("group-identity-stale"),
@@ -5092,6 +5115,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5092
5115
  literal("forbidden"),
5093
5116
  literal("identity-recovery-required"),
5094
5117
  literal("conflict"),
5118
+ literal("state-in-use"),
5095
5119
  literal("rate-limited"),
5096
5120
  literal("group-membership-required"),
5097
5121
  literal("group-identity-stale"),
@@ -5151,6 +5175,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5151
5175
  literal("forbidden"),
5152
5176
  literal("identity-recovery-required"),
5153
5177
  literal("conflict"),
5178
+ literal("state-in-use"),
5154
5179
  literal("rate-limited"),
5155
5180
  literal("group-membership-required"),
5156
5181
  literal("group-identity-stale"),
@@ -5204,6 +5229,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5204
5229
  literal("forbidden"),
5205
5230
  literal("identity-recovery-required"),
5206
5231
  literal("conflict"),
5232
+ literal("state-in-use"),
5207
5233
  literal("rate-limited"),
5208
5234
  literal("group-membership-required"),
5209
5235
  literal("group-identity-stale"),
@@ -5251,6 +5277,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5251
5277
  literal("forbidden"),
5252
5278
  literal("identity-recovery-required"),
5253
5279
  literal("conflict"),
5280
+ literal("state-in-use"),
5254
5281
  literal("rate-limited"),
5255
5282
  literal("group-membership-required"),
5256
5283
  literal("group-identity-stale"),
@@ -5298,6 +5325,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5298
5325
  literal("forbidden"),
5299
5326
  literal("identity-recovery-required"),
5300
5327
  literal("conflict"),
5328
+ literal("state-in-use"),
5301
5329
  literal("rate-limited"),
5302
5330
  literal("group-membership-required"),
5303
5331
  literal("group-identity-stale"),
@@ -5333,6 +5361,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5333
5361
  literal("forbidden"),
5334
5362
  literal("identity-recovery-required"),
5335
5363
  literal("conflict"),
5364
+ literal("state-in-use"),
5336
5365
  literal("rate-limited"),
5337
5366
  literal("group-membership-required"),
5338
5367
  literal("group-identity-stale"),
@@ -5372,6 +5401,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5372
5401
  literal("forbidden"),
5373
5402
  literal("identity-recovery-required"),
5374
5403
  literal("conflict"),
5404
+ literal("state-in-use"),
5375
5405
  literal("rate-limited"),
5376
5406
  literal("group-membership-required"),
5377
5407
  literal("group-identity-stale"),
@@ -5427,6 +5457,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5427
5457
  literal("forbidden"),
5428
5458
  literal("identity-recovery-required"),
5429
5459
  literal("conflict"),
5460
+ literal("state-in-use"),
5430
5461
  literal("rate-limited"),
5431
5462
  literal("group-membership-required"),
5432
5463
  literal("group-identity-stale"),
@@ -5492,6 +5523,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5492
5523
  literal("forbidden"),
5493
5524
  literal("identity-recovery-required"),
5494
5525
  literal("conflict"),
5526
+ literal("state-in-use"),
5495
5527
  literal("rate-limited"),
5496
5528
  literal("group-membership-required"),
5497
5529
  literal("group-identity-stale"),
@@ -5535,6 +5567,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5535
5567
  literal("forbidden"),
5536
5568
  literal("identity-recovery-required"),
5537
5569
  literal("conflict"),
5570
+ literal("state-in-use"),
5538
5571
  literal("rate-limited"),
5539
5572
  literal("group-membership-required"),
5540
5573
  literal("group-identity-stale"),
@@ -5573,6 +5606,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5573
5606
  literal("forbidden"),
5574
5607
  literal("identity-recovery-required"),
5575
5608
  literal("conflict"),
5609
+ literal("state-in-use"),
5576
5610
  literal("rate-limited"),
5577
5611
  literal("group-membership-required"),
5578
5612
  literal("group-identity-stale"),
@@ -5612,6 +5646,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5612
5646
  literal("forbidden"),
5613
5647
  literal("identity-recovery-required"),
5614
5648
  literal("conflict"),
5649
+ literal("state-in-use"),
5615
5650
  literal("rate-limited"),
5616
5651
  literal("group-membership-required"),
5617
5652
  literal("group-identity-stale"),
@@ -5656,6 +5691,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5656
5691
  literal("forbidden"),
5657
5692
  literal("identity-recovery-required"),
5658
5693
  literal("conflict"),
5694
+ literal("state-in-use"),
5659
5695
  literal("rate-limited"),
5660
5696
  literal("group-membership-required"),
5661
5697
  literal("group-identity-stale"),
@@ -5724,6 +5760,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5724
5760
  literal("forbidden"),
5725
5761
  literal("identity-recovery-required"),
5726
5762
  literal("conflict"),
5763
+ literal("state-in-use"),
5727
5764
  literal("rate-limited"),
5728
5765
  literal("group-membership-required"),
5729
5766
  literal("group-identity-stale"),
@@ -5794,6 +5831,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5794
5831
  literal("forbidden"),
5795
5832
  literal("identity-recovery-required"),
5796
5833
  literal("conflict"),
5834
+ literal("state-in-use"),
5797
5835
  literal("rate-limited"),
5798
5836
  literal("group-membership-required"),
5799
5837
  literal("group-identity-stale"),
@@ -5836,6 +5874,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5836
5874
  literal("forbidden"),
5837
5875
  literal("identity-recovery-required"),
5838
5876
  literal("conflict"),
5877
+ literal("state-in-use"),
5839
5878
  literal("rate-limited"),
5840
5879
  literal("group-membership-required"),
5841
5880
  literal("group-identity-stale"),
@@ -5879,6 +5918,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5879
5918
  literal("forbidden"),
5880
5919
  literal("identity-recovery-required"),
5881
5920
  literal("conflict"),
5921
+ literal("state-in-use"),
5882
5922
  literal("rate-limited"),
5883
5923
  literal("group-membership-required"),
5884
5924
  literal("group-identity-stale"),
@@ -5934,6 +5974,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5934
5974
  literal("forbidden"),
5935
5975
  literal("identity-recovery-required"),
5936
5976
  literal("conflict"),
5977
+ literal("state-in-use"),
5937
5978
  literal("rate-limited"),
5938
5979
  literal("group-membership-required"),
5939
5980
  literal("group-identity-stale"),
@@ -6002,6 +6043,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6002
6043
  literal("forbidden"),
6003
6044
  literal("identity-recovery-required"),
6004
6045
  literal("conflict"),
6046
+ literal("state-in-use"),
6005
6047
  literal("rate-limited"),
6006
6048
  literal("group-membership-required"),
6007
6049
  literal("group-identity-stale"),
@@ -6084,6 +6126,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6084
6126
  literal("forbidden"),
6085
6127
  literal("identity-recovery-required"),
6086
6128
  literal("conflict"),
6129
+ literal("state-in-use"),
6087
6130
  literal("rate-limited"),
6088
6131
  literal("group-membership-required"),
6089
6132
  literal("group-identity-stale"),
@@ -6143,6 +6186,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6143
6186
  literal("forbidden"),
6144
6187
  literal("identity-recovery-required"),
6145
6188
  literal("conflict"),
6189
+ literal("state-in-use"),
6146
6190
  literal("rate-limited"),
6147
6191
  literal("group-membership-required"),
6148
6192
  literal("group-identity-stale"),
@@ -6187,6 +6231,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6187
6231
  literal("forbidden"),
6188
6232
  literal("identity-recovery-required"),
6189
6233
  literal("conflict"),
6234
+ literal("state-in-use"),
6190
6235
  literal("rate-limited"),
6191
6236
  literal("group-membership-required"),
6192
6237
  literal("group-identity-stale"),
@@ -8167,6 +8212,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8167
8212
  className: _dsh_awiki_css_AwikiIdentityAccess_module_css_default.headingGroup,
8168
8213
  children: [(0, react_jsx_runtime.jsx)("h3", { children: registrationOtpSent ? "创建新身份" : "进入 AWiki" }), (0, react_jsx_runtime.jsx)("p", { children: registrationOtpSent ? "这个 Handle 尚未注册。输入刚收到的验证码以创建身份。" : "输入 Handle 和手机号。已有 Handle 会恢复身份,新 Handle 会创建身份。" })]
8169
8214
  }),
8215
+ props.legacySharedStateDetected === true && props.profileName != null && (0, react_jsx_runtime.jsxs)("div", {
8216
+ className: _dsh_awiki_css_AwikiIdentityAccess_module_css_default.existingNotice,
8217
+ role: "status",
8218
+ children: [(0, react_jsx_runtime.jsx)("strong", { children: "已为当前 Profile 隔离 AWiki 数据" }), (0, react_jsx_runtime.jsxs)("p", { children: [
8219
+ "检测到旧版共享数据。为避免多个 DSH Profile 同时占用数据库,当前 Profile「",
8220
+ props.profileName,
8221
+ "」使用独立数据目录;旧数据未删除或复制。请用原 Handle 和手机号恢复到此设备。"
8222
+ ] })]
8223
+ }),
8170
8224
  (0, react_jsx_runtime.jsxs)("label", {
8171
8225
  className: _dsh_awiki_css_AwikiIdentityAccess_module_css_default.field,
8172
8226
  children: ["Handle", (0, react_jsx_runtime.jsx)("input", {
@@ -8492,6 +8546,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8492
8546
  pending: null,
8493
8547
  error: null,
8494
8548
  attachmentMaxBytes: 0,
8549
+ profileName: null,
8550
+ legacySharedStateDetected: false,
8495
8551
  summaries: Object.freeze({}),
8496
8552
  recoveryOperationId: null,
8497
8553
  recoveryProgress: null
@@ -8911,8 +8967,30 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8911
8967
  identity: session.value.status === "active" ? session.value.identity : null,
8912
8968
  error: null,
8913
8969
  attachmentMaxBytes: config.value.attachmentMaxBytes,
8970
+ profileName: config.value.profileName ?? null,
8971
+ legacySharedStateDetected: config.value.legacySharedStateDetected ?? false,
8914
8972
  recoveryOperationId: storedRecoveryOperation()
8915
8973
  });
8974
+ const operationId = storedRecoveryOperation();
8975
+ if (operationId !== null) {
8976
+ const recovery = await call(() => this.remote.getRecoveryStatus({ operationId }));
8977
+ if (this.current(generation) && recovery.ok) {
8978
+ this.publish({
8979
+ ...this.view,
8980
+ recoveryOperationId: operationId,
8981
+ recoveryProgress: recovery.value
8982
+ });
8983
+ if (recovery.value.phase === "applied") {
8984
+ storeRecoveryOperation(null);
8985
+ this.publish({
8986
+ ...this.view,
8987
+ recoveryOperationId: null,
8988
+ recoveryProgress: recovery.value
8989
+ });
8990
+ if (identity === null) return this.loadSession();
8991
+ }
8992
+ }
8993
+ }
8916
8994
  if (identity !== null) {
8917
8995
  await this.loadConversationPreferences(generation);
8918
8996
  const profile = await call(() => this.remote.getProfile());
@@ -8920,22 +8998,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8920
8998
  ...this.view,
8921
8999
  profile: profile.value
8922
9000
  });
8923
- } else {
8924
- const operationId = storedRecoveryOperation();
8925
- if (operationId !== null) {
8926
- const recovery = await call(() => this.remote.getRecoveryStatus({ operationId }));
8927
- if (this.current(generation) && recovery.ok) {
8928
- this.publish({
8929
- ...this.view,
8930
- recoveryOperationId: operationId,
8931
- recoveryProgress: recovery.value
8932
- });
8933
- if (recovery.value.phase === "applied") {
8934
- storeRecoveryOperation(null);
8935
- return this.loadSession();
8936
- }
8937
- }
8938
- }
8939
9001
  }
8940
9002
  return {
8941
9003
  ok: true,
@@ -14509,7 +14571,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14509
14571
  identity: view.identity,
14510
14572
  recoveryOperationId: view.recoveryOperationId,
14511
14573
  recoveryProgress: view.recoveryProgress,
14512
- pending: view.pending !== null
14574
+ pending: view.pending !== null,
14575
+ profileName: view.profileName,
14576
+ legacySharedStateDetected: view.legacySharedStateDetected
14513
14577
  })
14514
14578
  }),
14515
14579
  view.status === "ready" && view.sessionStatus === "active" && view.identity !== null && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("div", {