bailian-memo-dsh 0.0.0-stage → 2.3.2

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,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Aliyun Model Studio (DashScope) AI Platform
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,84 @@
1
- # Temporary Holding Version
1
+ # bailian-memo-dsh
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ English | [中文](./README.zh.md)
4
+
5
+ Bailian personal memory plugin for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (`dsh` ≥ 0.2.1-alpha.1).
6
+
7
+ It adds automatic recall on top-level turns, silent auxiliary curation with recoverable async writes, explicit remember/forget tools, and a Plugins settings page. Identity and consent live in `~/.bailian/personal-memory/config.json` (shared with the `bailian-memory` skill). API keys use dsh credentials (`BAILIAN_MEMO_API_KEY`).
8
+
9
+ > **Release gate:** stable publish requires Memory GA, verified profile-value delete (`need_detail` + `PATCH profile_values`), and a live dsh 0.2.1 install check. Until then, treat this package as internal / channel-only.
10
+
11
+ ## Install
12
+
13
+ ```sh
14
+ dsh plugin --profile <profile> add bailian-memo-dsh
15
+ # or from a local checkout:
16
+ dsh plugin --profile <profile> add /path/to/cli/packages/bailian-memo-dsh
17
+ ```
18
+
19
+ Open **Sidebar → Plugins → Bailian Personal Memory**, automatically retrieve/update the credentials (or ensure `BAILIAN_MEMO_API_KEY` and the Workspace ID already match), then click **Enable personal memory**. This is a dedicated personal-memory page, not the legacy Knowledge Base Settings section. Browser authorization is a one-time credential retrieval flow, not a persistent login session.
20
+
21
+ The installed bundle row also exposes **Configure** for `bailian-memo-dsh#tool-bailian-memo`; it opens the same configuration page and shared draft state.
22
+
23
+ ## What it does
24
+
25
+ | Capability | Behavior |
26
+ | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
27
+ | Automatic recall | On each top-level turn’s first step, searches observations + profile and injects a sourced context message (`startsRequestSeries`). Fail-open. Subagents skipped. |
28
+ | Silent curation | On `turn-stopping`, an auxiliary LLM decides commit/skip; commits go through `add-async` with background polling. |
29
+ | Tools | `bailian_memo_search`, `status`, `remember`, `forget`, `pause`, `resume` |
30
+ | Forget | Candidate search → dsh approval → node delete; optional profile value delete when API supports it |
31
+ | Pause / resume | Local status only; cloud data is kept |
32
+
33
+ ## Configuration
34
+
35
+ - **Personal identity:** `~/.bailian/personal-memory/config.json` (`status`: `unconfigured` / `initializing` / `active` / `paused`)
36
+ - **Plugin settings (Volatile):** real toggles for `enabled`, `autoRecall`, and `autoCurate`, plus the visible `recallTopK` result limit and `minScore` threshold (default 0). The threshold applies to automatic recall and to manual search when `min_score` is omitted. `workspaceId` and curator options also live in dsh settings. The endpoint uses the fixed default Memory host.
37
+ - **Secrets:** never stored in the personal config file; the UI shows only whether the effective credential is configured and its source category, never its value
38
+ - **Plugin control:** use the switch in the installed plugins list to enable or disable the plugin. The settings page has no pause/resume buttons and does not expose a full wipe; cloud data is kept.
39
+ - **Diagnostics:** async writes distinguish submitted, succeeded with changes, succeeded without changes, and failed. Empty searches include a sanitized scope (hashes and lengths only); `bailian_memo_search` accepts optional `min_score`.
40
+
41
+ On first startup, an absent dsh `workspaceId` is seeded from the personal identity binding, then from the active `bl` profile. Explicit dsh values are preserved. `configInitialized` records this migration, so clearing a setting does not reimport it on restart. Missing API keys may be seeded into the plugin-specific dsh `BAILIAN_MEMO_API_KEY` credential; requests never fall back to `bl` or environment workspace values.
42
+
43
+ The personal file stores identity, consent, status, and its workspace binding; the request Workspace always comes from dsh. A different Workspace is rejected before requests or credential autofill; restore the original binding in dsh settings. Enabling and autofill write connection settings to dsh, never silently rebind an existing identity.
44
+
45
+ Enter a new API key in the password field and select **Verify and save** to update it together with the Workspace. Leave the key blank to retain the effective credential. The key and Workspace belong only to Memory; replacing them does not affect Bailian Knowledge Base. The page never displays the stored key; drafts remain only in memory and are cleared after a successful save or when the page closes. Connection edits are saved separately from automatic behavior.
46
+
47
+ Both manual save and automatic retrieval verify the candidate API key/Workspace pair with a read-only Memory request before writing either value. Verification failures leave the previous settings untouched. If `BAILIAN_MEMO_API_KEY` comes from the environment that launched dsh, it takes priority and cannot be replaced in the page: unset it in that shell or service, restart dsh, then retry. Workspace-only saves with a blank key can still use that environment credential.
48
+
49
+ If setup reports the raw server error `Endpoint.AccessDenied: Workspace endpoint access denied.`, verify that the effective API key and Workspace belong to the same Alibaba Cloud account, then automatically update the credential pair from this page. If they already match, confirm that Bailian Memory is enabled or allowlisted for that account.
50
+
51
+ ## Privacy
52
+
53
+ - Ordinary personal facts may be remembered after enablement consent
54
+ - Sensitive content only when the user explicitly asks
55
+ - Passwords / API keys / private keys are never stored
56
+ - You can pause anytime
57
+
58
+ ## Uninstall
59
+
60
+ ```sh
61
+ dsh plugin --profile <profile> remove bailian-memo-dsh
62
+ ```
63
+
64
+ Uninstall does **not** delete cloud memories or `~/.bailian/personal-memory/config.json`.
65
+
66
+ ## License
67
+
68
+ Apache-2.0
69
+
70
+ The former shared `DASHSCOPE_API_KEY` is no longer read, modified, or deleted. If the plugin-specific key is absent and bl has no default to import, save a key on each plugin’s page.
71
+
72
+ ## User profile extraction
73
+
74
+ **Extract user profile** is off by default and is saved with automatic behavior in dsh settings. When enabled, each new remember/curation submission queries existing profile rules in the default memory-library scope before passing the selected ID to add-async. The plugin never creates a schema or modifies cloud rules. The selected `profileSchemaId` is saved in this plugin’s dsh settings. With extraction disabled, add-async omits `profile_schema`.
75
+
76
+ When extraction is enabled, select a profile rule by name and schemaId in the automatic-behavior card. With no selection, the last item in the complete API list is selected by default (this is list order, not creation time). Save persists that ID together with the extraction switch. Existing selections are preserved; a missing/deleted selection requires reselection instead of silently changing the rule. Each submission uses only one rule. Search does not require a schema. Existing profile recall independently resolves the current rule before GetUserProfile, even when extraction is off; lookup failures do not block observation recall. Forget resolves the rule once and uses that same ID for inspection, deletion, and verification.
77
+
78
+ Personal identity format v3 drops the obsolete `profile_schema_id` / `profile_schema_version` fields on read and subsequent writes while retaining user identity, consent, binding and pause state. Existing cloud schemas and profile data are not deleted. Initialization only performs a read-only connection check and no longer depends on a profile schema.
79
+
80
+ When `remember` successfully submits in a turn, automatic curation skips that entire turn to avoid writing the same facts twice. Later turns are unaffected; failed submissions do not suppress curation.
81
+
82
+ Automatic recall has a five-second deadline and stops when the turn is cancelled. A paused identity stays paused across plugin restarts. Repeated retries of one remember tool call share an intent, while a later independent call can remember the same fact again (including after forgetting it).
83
+
84
+ The shared personal config accepts v2/v3 and preserves optional Skill-owned profile schema fields. The plugin selects its profile rule independently through dsh settings.
package/README.zh.md ADDED
@@ -0,0 +1,86 @@
1
+ # bailian-memo-dsh
2
+
3
+ [English](./README.md) | 中文
4
+
5
+ 面向 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(`dsh` ≥ 0.2.1-alpha.1)的百炼个人记忆插件。
6
+
7
+ 提供顶层回合自动召回、静默辅助筛选与可恢复异步写入、显式记住/遗忘工具,以及 Plugins 设置页。身份与授权保存在 `~/.bailian/personal-memory/config.json`(与 `bailian-memory` skill 共享)。API Key 使用 dsh credentials(`BAILIAN_MEMO_API_KEY`)。
8
+
9
+ > **发布门槛:** stable 发布前需确认 Memory 主能力上线、画像值精确删除(`need_detail` + `PATCH profile_values`)实链路,以及 dsh 0.2.1 实机安装验证。此前仅用于内部 / channel 验证。
10
+
11
+ ## 安装
12
+
13
+ ```sh
14
+ dsh plugin --profile <profile> add bailian-memo-dsh
15
+ # 或本地路径:
16
+ dsh plugin --profile <profile> add /path/to/cli/packages/bailian-memo-dsh
17
+ ```
18
+
19
+ 打开 **侧边栏 → 插件 → 百炼个人记忆**,自动获取/更新凭据(或确保 `BAILIAN_MEMO_API_KEY` 与 Workspace ID 已匹配),然后点击 **启用个人记忆**。这是独立的个人记忆页面,不是旧版知识库 Settings 区域。浏览器授权只是一次性获取凭据,并不建立持久登录会话。
20
+
21
+ 已安装 Bundle 的 `bailian-memo-dsh#tool-bailian-memo` 行也提供**配置**入口;它会打开同一个页面并共享同一份草稿状态。
22
+
23
+ ## 能力
24
+
25
+ | 能力 | 行为 |
26
+ | ----------- | ---------------------------------------------------------------------------------------------------------------------------------- |
27
+ | 自动召回 | 顶层 Agent 每个 turn 首个 step 搜索 observation/画像,注入带来源的上下文(`startsRequestSeries`)。失败不阻断。Subagent 默认跳过。 |
28
+ | 静默筛选 | 在 `turn-stopping` 用辅助 LLM 决定 commit/skip;提交走 `add-async` 并后台轮询。 |
29
+ | 工具 | `bailian_memo_search` / `status` / `remember` / `forget` / `pause` / `resume` |
30
+ | 遗忘 | 候选定位 → dsh 审批 → 删除节点;画像值删除取决于 API 是否就绪 |
31
+ | 暂停 / 恢复 | 只改本地状态,不删云端数据 |
32
+
33
+ ## 配置
34
+
35
+ - **个人身份:** `~/.bailian/personal-memory/config.json`(`status`:`unconfigured` / `initializing` / `active` / `paused`)
36
+ - **插件设置(Volatile):** `enabled`、`autoRecall`、`autoCurate` 使用真实开关,并直接显示 `recallTopK` 召回结果数量和 `minScore` 最小分数阈值(默认 0)。该阈值用于自动召回,也用于未传 `min_score` 的手动检索。`workspaceId` 与 curator 参数同样保存在 dsh 设置中;端点使用固定的 Memory 默认域名。
37
+ - **密钥:** 不写入个人配置文件;设置页只显示当前生效凭据是否已配置及其来源类别,绝不显示值
38
+ - **插件控制:** 通过已安装插件列表右侧的开关启用或停用插件。设置页不再提供暂停/恢复按钮,也不提供全量清除;云端数据保留。
39
+ - **诊断:** 异步写入会区分已提交、成功且有变更、成功但无变更和失败。空检索会附带只含哈希与长度的脱敏范围;`bailian_memo_search` 支持可选 `min_score`。
40
+
41
+ 自动更新将 API Key 与 Workspace 视为同一组凭据,先发起只读 Memory 请求验证,再保存两者并显示**凭据已更新**。若 `BAILIAN_MEMO_API_KEY` 来自启动 dsh 的环境变量,它具有更高优先级且无法在页面中替换:请在启动 dsh 的 Shell 或服务中取消该变量、重启 dsh 后重试。
42
+
43
+ 若初始化显示服务端原始错误 `Endpoint.AccessDenied: Workspace endpoint access denied.`,请确认当前生效的 API Key 与 Workspace 属于同一个阿里云账号,再从本页面自动更新整组凭据。若凭据已匹配,请确认该账号已开通百炼 Memory 或已加入白名单。
44
+
45
+ ## 隐私
46
+
47
+ - 启用授权后可自动记忆普通个人信息
48
+ - 敏感信息仅在用户明确要求时保存
49
+ - 密码 / API Key / 私钥永不保存
50
+ - 可随时暂停
51
+
52
+ ## 卸载
53
+
54
+ ```sh
55
+ dsh plugin --profile <profile> remove bailian-memo-dsh
56
+ ```
57
+
58
+ 卸载**不会**删除云端记忆,也不会删除 `~/.bailian/personal-memory/config.json`。
59
+
60
+ ## 许可证
61
+
62
+ Apache-2.0
63
+
64
+ 首次启动时,仅在 dsh 未设置 `workspaceId` 时依次从个人身份绑定、当前激活的 `bl` Profile 导入;已有 dsh 值保持不变。`configInitialized` 标记完成迁移,因此主动清空后重启不会重新导入。缺失的 API Key 可导入个人记忆插件独立的 dsh `BAILIAN_MEMO_API_KEY` 凭据;请求期间不会回退读取 `bl` 或环境 Workspace。
65
+
66
+ 个人文件只承担身份、授权、状态及 Workspace 绑定;实际请求 Workspace 始终读取 dsh 设置。若与身份绑定不同,请求和自动填充均拒绝执行,请在 dsh 中恢复原 Workspace。启用和自动填充将连接设置写入 dsh,绝不自动改变已有身份绑定。
67
+
68
+ 在密码输入框填写新 API 密钥,点击**验证并保存**可同时更新密钥与工作空间;密钥留空则保留当前生效凭据。密钥和工作空间仅属于个人记忆插件,修改不会影响百炼知识库插件。页面不回显已存密钥,草稿仅保留在内存,成功保存或关闭页面后清空。连接设置与自动行为分别保存。
69
+
70
+ 手动保存和自动获取都在持久化前通过只读 Memory 请求验证候选凭据组合,验证失败不修改原值。启动环境变量密钥不可在页面替换;但密钥留空时仍可使用它验证并保存 Workspace。
71
+
72
+ 升级后不再读取原来共用的 `DASHSCOPE_API_KEY`,也不会修改或删除它。若插件专属 Key 尚未配置且 bl 没有可导入的默认值,请在各插件页面分别保存 Key。
73
+
74
+ ## 用户画像抽取
75
+
76
+ **抽取用户画像**默认关闭,与自动行为一起保存在 dsh 设置中。开启后,每次新的显式记忆或自动整理提交前,都查询默认记忆库范围内已有的画像规则,再将选定 ID 传入 add-async。插件不创建模板、不修改云端规则;所选 `profileSchemaId` 保存在本插件的 dsh 设置中。关闭时 add-async 不传 `profile_schema`。
77
+
78
+ 开启画像抽取后,在自动行为卡片中按规则名称和 schemaId 选择。尚未选择时默认使用完整接口列表的最后一项(按返回顺序,不表示创建时间)。点击保存会一起保存开关和所选 ID;已有选择保持不变,规则删除后提示重新选择,不静默切换。每次提交只使用一条规则。search 不需要 schemaId。已有画像召回独立于抽取开关,在调用 GetUserProfile 前查询规则;画像读取失败不阻断普通记忆召回。画像遗忘在操作开始时解析一次规则,同一次查看、删除和验证均使用该 ID。
79
+
80
+ 个人身份文件升级为 v3,读取及后续写入时去掉旧 `profile_schema_id` / `profile_schema_version`,保留身份、授权、绑定和暂停状态;不删除已有云端模板或画像。初始化仅做只读连接检查,不再依赖画像模板。
81
+
82
+ 同一回合中 `remember` 成功提交后,自动筛选跳过整个回合,避免重复写入相同事实。后续回合不受影响;提交失败不会阻止自动筛选。
83
+
84
+ 自动召回总时限为五秒,取消当前轮次会停止等待。插件重启后仍保持暂停状态。同一次记忆工具调用的重试共用一个 intent;后续独立调用可以再次记住相同事实(包括遗忘后重新记忆)。
85
+
86
+ 共享个人配置兼容 v2/v3,并保留可选的 Skill 画像模板字段。插件的画像规则仍由 dsh 设置独立选择。
@@ -0,0 +1,11 @@
1
+ <svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect x="4" y="4" width="28" height="28" rx="9" fill="url(#a)" />
3
+ <path d="M13 13.5C13 11.57 14.57 10 16.5 10C18.43 10 20 11.57 20 13.5V25.5C20 27.43 18.43 29 16.5 29C14.57 29 13 27.43 13 25.5V13.5Z" stroke="#FFFFFF" stroke-width="2" />
4
+ <path d="M20 14H22.5C24.43 14 26 15.57 26 17.5C26 19.43 24.43 21 22.5 21H20M13 17H11.5C10.12 17 9 18.12 9 19.5C9 20.88 10.12 22 11.5 22H13" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" />
5
+ <defs>
6
+ <linearGradient id="a" x1="7" y1="5" x2="30" y2="32" gradientUnits="userSpaceOnUse">
7
+ <stop stop-color="#7AC2FF" />
8
+ <stop offset="1" stop-color="#4A65E8" />
9
+ </linearGradient>
10
+ </defs>
11
+ </svg>
@@ -0,0 +1,15 @@
1
+ # bailian-memo-dsh: Bailian personal memory over dsh-base.
2
+ # Identity/consent live in ~/.bailian/personal-memory/config.json (cross-profile).
3
+ # API key resolves from dsh credentials (BAILIAN_MEMO_API_KEY).
4
+
5
+ - insert:
6
+ - id: tool-bailian-memo
7
+ name: "bailian-memo-dsh"
8
+ config:
9
+ enabled: true
10
+ autoRecall: true
11
+ autoCurate: true
12
+ recallTopK: 5
13
+ minScore: 0
14
+ curatorMaxOutputTokens: 512
15
+ curatorTimeoutMs: 30000
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Best-effort read of ~/.bailian/config.json for one-time credential/workspace seed.
3
+ */
4
+ export interface BlCliConfigSeed {
5
+ apiKey?: string;
6
+ workspaceId?: string;
7
+ }
8
+ export declare function readBlCliConfig(home?: string): BlCliConfigSeed;
package/dist/bl-cli.js ADDED
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Best-effort read of ~/.bailian/config.json for one-time credential/workspace seed.
3
+ */
4
+ import { readFileSync } from "node:fs";
5
+ import { homedir } from "node:os";
6
+ import { join } from "node:path";
7
+ export function readBlCliConfig(home = homedir()) {
8
+ try {
9
+ const text = readFileSync(join(home, ".bailian", "config.json"), "utf8");
10
+ const parsed = JSON.parse(text);
11
+ const activeName = parsed.active_config;
12
+ const selected = typeof activeName === "string" && activeName !== "" && activeName !== "default"
13
+ ? parsed[activeName]
14
+ : parsed;
15
+ if (!selected || typeof selected !== "object")
16
+ return {};
17
+ const active = selected;
18
+ const apiKey = active.api_key ?? active.apiKey;
19
+ const workspaceId = active.workspace_id ?? active.workspaceId;
20
+ return {
21
+ ...(typeof apiKey === "string" && apiKey.trim().length > 0 ? { apiKey: apiKey.trim() } : {}),
22
+ ...(typeof workspaceId === "string" && workspaceId.trim().length > 0
23
+ ? { workspaceId: workspaceId.trim() }
24
+ : {}),
25
+ };
26
+ }
27
+ catch {
28
+ return {};
29
+ }
30
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Plugin Config: Volatile fields project into the Host settings document (dsh 0.2.1).
3
+ */
4
+ import type { Volatile } from "@deepseek-ai/cordis";
5
+ import z from "@deepseek-ai/schemastery";
6
+ /** Settings namespace / Loader entry id. */
7
+ export declare const MEMO_SETTINGS_NAMESPACE = "tool-bailian-memo";
8
+ export interface Config {
9
+ /** Master switch for automatic recall + curation (tools still work when paused via personal config). */
10
+ enabled: Volatile<boolean>;
11
+ /** Inject recalled memories on top-level turn first steps. */
12
+ autoRecall: Volatile<boolean>;
13
+ /** Run silent curator on turn-stopping. */
14
+ autoCurate: Volatile<boolean>;
15
+ /** Extract profiles using an existing server rule; never create a schema. */
16
+ extractProfile: Volatile<boolean>;
17
+ profileSchemaId: Volatile<string | undefined>;
18
+ /** Search top_k for automatic recall. */
19
+ recallTopK: Volatile<number>;
20
+ /** Minimum similarity for automatic recall and for search when min_score is omitted. */
21
+ minScore: Volatile<number>;
22
+ /** Auxiliary curator max output tokens. */
23
+ curatorMaxOutputTokens: Volatile<number>;
24
+ /** Auxiliary curator deadline in milliseconds. */
25
+ curatorTimeoutMs: Volatile<number>;
26
+ /** Optional explicit curator provider (must pair with model). */
27
+ curatorProvider: Volatile<string | undefined>;
28
+ /** Optional explicit curator model id. */
29
+ curatorModel: Volatile<string | undefined>;
30
+ /** Request workspace, persisted in the active dsh profile. */
31
+ workspaceId: Volatile<string | undefined>;
32
+ configInitialized: Volatile<boolean>;
33
+ }
34
+ export declare const Config: z<Config>;
35
+ export type ResolvedConfig = {
36
+ enabled: boolean;
37
+ autoRecall: boolean;
38
+ autoCurate: boolean;
39
+ extractProfile: boolean;
40
+ profileSchemaId: string | undefined;
41
+ recallTopK: number;
42
+ minScore: number;
43
+ curatorMaxOutputTokens: number;
44
+ curatorTimeoutMs: number;
45
+ curatorProvider: string | undefined;
46
+ curatorModel: string | undefined;
47
+ workspaceId: string | undefined;
48
+ };
49
+ export declare function resolveConfig(config: Config): ResolvedConfig;
package/dist/config.js ADDED
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Plugin Config: Volatile fields project into the Host settings document (dsh 0.2.1).
3
+ */
4
+ import z from "@deepseek-ai/schemastery";
5
+ import { PLUGIN_ENTRY_ID } from "./plugin-meta.js";
6
+ /** Settings namespace / Loader entry id. */
7
+ export const MEMO_SETTINGS_NAMESPACE = PLUGIN_ENTRY_ID;
8
+ // Volatile schema inference does not round-trip through `z<Config>`; cast for
9
+ // portable declaration emit (same pattern as out-of-tree dsh plugins).
10
+ export const Config = z.object({
11
+ enabled: z.boolean().default(true).volatile(),
12
+ autoRecall: z.boolean().default(true).volatile(),
13
+ autoCurate: z.boolean().default(true).volatile(),
14
+ extractProfile: z.boolean().default(false).volatile(),
15
+ profileSchemaId: z.string().volatile(),
16
+ recallTopK: z.number().step(1).min(1).max(20).default(5).volatile(),
17
+ minScore: z.number().min(0).max(1).default(0).volatile(),
18
+ curatorMaxOutputTokens: z.number().step(1).min(64).max(4096).default(512).volatile(),
19
+ curatorTimeoutMs: z.number().step(1).min(1000).max(120000).default(30000).volatile(),
20
+ curatorProvider: z.string().volatile(),
21
+ curatorModel: z.string().volatile(),
22
+ workspaceId: z.string().volatile(),
23
+ configInitialized: z.boolean().default(false).volatile(),
24
+ });
25
+ export function resolveConfig(config) {
26
+ return {
27
+ enabled: config.enabled.get(),
28
+ autoRecall: config.autoRecall.get(),
29
+ autoCurate: config.autoCurate.get(),
30
+ extractProfile: config.extractProfile.get(),
31
+ profileSchemaId: config.profileSchemaId.get(),
32
+ recallTopK: config.recallTopK.get(),
33
+ minScore: config.minScore.get(),
34
+ curatorMaxOutputTokens: config.curatorMaxOutputTokens.get(),
35
+ curatorTimeoutMs: config.curatorTimeoutMs.get(),
36
+ curatorProvider: config.curatorProvider.get(),
37
+ curatorModel: config.curatorModel.get(),
38
+ workspaceId: config.workspaceId.get(),
39
+ };
40
+ }
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Self-contained Bailian console login: the plugin drives the console's browser
3
+ * login itself and persists what comes back, rather than shelling out to the
4
+ * `bl` CLI.
5
+ *
6
+ * Driving the flow here lets it always request a freshly issued api key, so the
7
+ * key and the workspace id both come from the account that just signed in, and
8
+ * the values land straight in the dsh stores.
9
+ *
10
+ * Shape of the flow: bind a loopback-only port, open the console login page
11
+ * pointed at that port, then accept one callback carrying the credentials as
12
+ * query parameters or a JSON / form-encoded body.
13
+ */
14
+ /** Credentials the console callback can carry. */
15
+ export interface ConsoleLoginCredentials {
16
+ /** Freshly issued DashScope api key. */
17
+ apiKey?: string;
18
+ /** Workspace id of the account that signed in. */
19
+ workspaceId?: string;
20
+ }
21
+ /**
22
+ * Where the login flow stands. Deliberately carries no secret: the plain key
23
+ * is handed to the completion callback and never retained here, so polling
24
+ * this state from the browser cannot leak it.
25
+ */
26
+ export type ConsoleLoginState = {
27
+ phase: "idle";
28
+ } | {
29
+ phase: "waiting";
30
+ loginUrl: string;
31
+ } | {
32
+ phase: "done";
33
+ fields: string[];
34
+ } | {
35
+ phase: "failed";
36
+ reason: string;
37
+ };
38
+ /** Read the current flow state (safe to expose to the panel). */
39
+ export declare function consoleLoginState(): ConsoleLoginState;
40
+ /**
41
+ * Parse a callback body as JSON (optionally wrapped in `data`) or as form
42
+ * encoding. Content-type is a hint only: both shapes occur in practice, so both
43
+ * are attempted.
44
+ * @param raw - the raw request body.
45
+ * @returns the flattened fields; an unparseable body yields no fields.
46
+ */
47
+ export declare function parseCallbackBody(raw: string): Record<string, unknown>;
48
+ /**
49
+ * Pick the api key and workspace id out of a callback's fields, query
50
+ * parameters taking priority over the body.
51
+ * @param query - the callback URL's query parameters.
52
+ * @param body - the parsed callback body.
53
+ * @returns the credentials found; fields are absent rather than blank.
54
+ */
55
+ export declare function pickCallbackCredentials(query: Record<string, unknown>, body: Record<string, unknown>): ConsoleLoginCredentials;
56
+ /** Outcome of asking the host to start a console login. */
57
+ export type ConsoleLoginStart = {
58
+ status: "started";
59
+ loginUrl: string;
60
+ } | {
61
+ status: "already-running";
62
+ loginUrl: string;
63
+ } | {
64
+ status: "failed";
65
+ reason: string;
66
+ };
67
+ /**
68
+ * Start a console login on the host: binds a loopback listener, opens the
69
+ * console login page in the host's default browser, and hands the credentials
70
+ * from the callback to `onComplete` (which persists them). Fire-and-forget —
71
+ * this resolves once the browser has been opened; poll {@link consoleLoginState}
72
+ * for the outcome.
73
+ * @param opts.site - console site, `domestic` (default) or `international`.
74
+ * @param opts.onComplete - persists the received credentials; its resolved
75
+ * field names become the `done` state's `fields`.
76
+ * @returns whether the flow started, plus the URL to open manually if needed.
77
+ */
78
+ export declare function startConsoleLogin(opts: {
79
+ site?: string;
80
+ onComplete: (credentials: ConsoleLoginCredentials) => Promise<string[]>;
81
+ }): Promise<ConsoleLoginStart>;
82
+ /** Abandon an in-flight login (closes the listener). */
83
+ export declare function cancelConsoleLogin(): void;