@ftai/dsh-plugin-acn 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +90 -0
- package/LICENSE-APACHE +201 -0
- package/LICENSE-MIT +19 -0
- package/README.md +82 -2
- package/README_EN.md +83 -0
- package/cordis.patch.yml +29 -0
- package/docs/acn-compat.md +33 -0
- package/docs/architecture.md +130 -0
- package/docs/assets/acn-claim-reuse.png +0 -0
- package/docs/assets/activity-view.png +0 -0
- package/docs/assets/install-package.png +0 -0
- package/docs/assets/knowledge-model.png +0 -0
- package/docs/assets/knowledge-view.png +0 -0
- package/docs/assets/personal-configuration.png +0 -0
- package/docs/assets/session-upstream.png +0 -0
- package/docs/assets/upstream-settings.png +0 -0
- package/docs/assets/upstream-team.png +0 -0
- package/docs/command-reference.md +201 -0
- package/docs/config.md +253 -0
- package/docs/development.md +197 -0
- package/docs/dsh-compat.md +59 -0
- package/docs/index.md +16 -0
- package/docs/outstanding-issues.md +61 -0
- package/docs/user_guide.md +185 -0
- package/icon.svg +8 -0
- package/lib/activities-B8U-iW4-.js +407 -0
- package/lib/alignment-CwH0nBf-.js +80 -0
- package/lib/auth-DFI9yowX.js +71 -0
- package/lib/checkpoint-CPFPOxBM.js +188 -0
- package/lib/checkpoint-c7aI4D-X.js +318 -0
- package/lib/claim-DOAGe8ZK.js +168 -0
- package/lib/client.js +18417 -0
- package/lib/deliver-C-dmhkfm.js +168 -0
- package/lib/delivery-status-M7-Rwoyj.js +89 -0
- package/lib/dispute-CtrInHzf.js +20 -0
- package/lib/disputes-ByEmi43j.js +51 -0
- package/lib/dream-agent-BVqxbKFc.js +249 -0
- package/lib/dream.js +4 -0
- package/lib/effects-DX1iy6FM.js +268 -0
- package/lib/errors-Bp_2WXBr.js +19 -0
- package/lib/errors-pPumDOGD.js +18 -0
- package/lib/evidence-store-DW7kj20i.js +1030 -0
- package/lib/formation-D4LO31WW.js +187 -0
- package/lib/formation-replay-Bf4TSBiz.js +87 -0
- package/lib/formation.js +9 -0
- package/lib/history-DPMHX3ZE.js +214 -0
- package/lib/inbox-2CugZZQm.js +188 -0
- package/lib/inbox-DFtE2fOp.js +71 -0
- package/lib/inbox.js +3 -0
- package/lib/index.js +1373 -0
- package/lib/lock-DbmlKOoX.js +332 -0
- package/lib/pages-BEWC3kmZ.js +51 -0
- package/lib/paths-B7NI9Ano.js +157 -0
- package/lib/plugins/commands.js +590 -0
- package/lib/plugins/dream.js +66 -0
- package/lib/plugins/formation.js +66 -0
- package/lib/plugins/inbox.js +53 -0
- package/lib/plugins/knowledge.js +1109 -0
- package/lib/plugins/prompt.js +102 -0
- package/lib/plugins/tools.js +280 -0
- package/lib/policy-DnyHh7Bl.js +16 -0
- package/lib/prepare-CGXwBEcu.js +134 -0
- package/lib/protocol.js +8 -0
- package/lib/queue-M917xHPS.js +153 -0
- package/lib/regular-file-BFpqMoub.js +136 -0
- package/lib/render-CJaVcKKC.js +48 -0
- package/lib/reported-sets-DdEKdeVb.js +122 -0
- package/lib/revision-DeoL_IUN.js +11 -0
- package/lib/scheduler-BfJSY1eq.js +64 -0
- package/lib/service-BPwaZzFF.js +1106 -0
- package/lib/service-BQaszW_v.js +344 -0
- package/lib/service-BhniAHLo.js +305 -0
- package/lib/service-C2lXoygJ.js +505 -0
- package/lib/session-binding-zCSuizHs.js +342 -0
- package/lib/session-state-CYqUhC95.js +38 -0
- package/lib/sessions-C2xuPFQv.js +218 -0
- package/lib/store.js +16 -0
- package/lib/structured-C9byFuzm.js +453 -0
- package/lib/subagent-yJsFxHmH.js +9 -0
- package/lib/team.js +3 -0
- package/lib/tool-schema-3b4gH1zf.js +28 -0
- package/lib/trace-Da0RnL5R.js +14 -0
- package/lib/traces-CHBo8y1z.js +11 -0
- package/lib/types/activities.d.ts +73 -0
- package/lib/types/advanced-configuration.d.ts +11 -0
- package/lib/types/client/ActivityCard.d.ts +14 -0
- package/lib/types/client/ActivityDetails.d.ts +18 -0
- package/lib/types/client/AdvancedPreferences.d.ts +8 -0
- package/lib/types/client/BlankCommandFeedback.d.ts +10 -0
- package/lib/types/client/ComposerMenu.d.ts +24 -0
- package/lib/types/client/ConfigurationPage.d.ts +11 -0
- package/lib/types/client/ConnectionCheckDialog.d.ts +12 -0
- package/lib/types/client/KnowledgeDetail.d.ts +6 -0
- package/lib/types/client/KnowledgeDirectoryField.d.ts +11 -0
- package/lib/types/client/KnowledgePanel.d.ts +12 -0
- package/lib/types/client/KnowledgeReference.d.ts +13 -0
- package/lib/types/client/SessionToolbar.d.ts +16 -0
- package/lib/types/client/SettingsToast.d.ts +3 -0
- package/lib/types/client/SourceSessionLink.d.ts +16 -0
- package/lib/types/client/TeamCredentialField.d.ts +16 -0
- package/lib/types/client/TeamSettingsPage.d.ts +28 -0
- package/lib/types/client/configuration-errors.d.ts +2 -0
- package/lib/types/client/interaction-styles.d.ts +1 -0
- package/lib/types/client/interaction-ui.d.ts +30 -0
- package/lib/types/client/knowledge-labels.d.ts +5 -0
- package/lib/types/client/locales.d.ts +51 -0
- package/lib/types/commands/claim.d.ts +4 -0
- package/lib/types/commands/import.d.ts +10 -0
- package/lib/types/commands/status.d.ts +5 -0
- package/lib/types/config.d.ts +111 -0
- package/lib/types/configuration.d.ts +235 -0
- package/lib/types/credentials.d.ts +59 -0
- package/lib/types/dream/audit.d.ts +4 -0
- package/lib/types/dream/autonomous.d.ts +185 -0
- package/lib/types/dream/candidates.d.ts +34 -0
- package/lib/types/dream/checkpoint.d.ts +35 -0
- package/lib/types/dream/evidence-files.d.ts +10 -0
- package/lib/types/dream/evidence-store.d.ts +103 -0
- package/lib/types/dream/evidence.d.ts +30 -0
- package/lib/types/dream/index.d.ts +10 -0
- package/lib/types/dream/plan.d.ts +18 -0
- package/lib/types/dream/preservation.d.ts +6 -0
- package/lib/types/dream/review.d.ts +10 -0
- package/lib/types/dream/schema.d.ts +1475 -0
- package/lib/types/dream/service.d.ts +56 -0
- package/lib/types/dream/sync.d.ts +147 -0
- package/lib/types/dsh-adapter/configuration-remote.d.ts +1 -0
- package/lib/types/dsh-adapter/configuration-service.d.ts +28 -0
- package/lib/types/dsh-adapter/dream-agent.d.ts +4 -0
- package/lib/types/dsh-adapter/dream-evidence.d.ts +3 -0
- package/lib/types/dsh-adapter/formation-archive.d.ts +3 -0
- package/lib/types/dsh-adapter/formation-replay.d.ts +5 -0
- package/lib/types/dsh-adapter/formation.d.ts +4 -0
- package/lib/types/dsh-adapter/interaction-service.d.ts +13 -0
- package/lib/types/dsh-adapter/knowledge-paths.d.ts +3 -0
- package/lib/types/dsh-adapter/llm.d.ts +10 -0
- package/lib/types/dsh-adapter/project-upstream.d.ts +4 -0
- package/lib/types/dsh-adapter/runtime-pool.d.ts +110 -0
- package/lib/types/dsh-adapter/session-binding.d.ts +43 -0
- package/lib/types/dsh-adapter/source-sessions.d.ts +3 -0
- package/lib/types/dsh-adapter/team-credentials.d.ts +5 -0
- package/lib/types/dsh-adapter/tool-schema.d.ts +4 -0
- package/lib/types/dsh-adapter/tools.d.ts +5 -0
- package/lib/types/formation/capture.d.ts +19 -0
- package/lib/types/formation/checkpoint.d.ts +136 -0
- package/lib/types/formation/index.d.ts +10 -0
- package/lib/types/formation/prepare.d.ts +16 -0
- package/lib/types/formation/schema.d.ts +45 -0
- package/lib/types/formation/service.d.ts +58 -0
- package/lib/types/formation/transcript.d.ts +75 -0
- package/lib/types/formation/triggers.d.ts +3 -0
- package/lib/types/inbox/cascade.d.ts +3 -0
- package/lib/types/inbox/effects.d.ts +275 -0
- package/lib/types/inbox/index.d.ts +5 -0
- package/lib/types/inbox/prepare.d.ts +380 -0
- package/lib/types/inbox/service.d.ts +26 -0
- package/lib/types/inbox/sync.d.ts +9 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/interaction-messages.d.ts +69 -0
- package/lib/types/interaction.d.ts +541 -0
- package/lib/types/knowledge/alignment.d.ts +49 -0
- package/lib/types/knowledge/catalog.d.ts +5 -0
- package/lib/types/knowledge/changes.d.ts +32 -0
- package/lib/types/knowledge/disputes.d.ts +3 -0
- package/lib/types/knowledge/errors.d.ts +9 -0
- package/lib/types/knowledge/ordering.d.ts +7 -0
- package/lib/types/knowledge/pages.d.ts +7 -0
- package/lib/types/knowledge/safety.d.ts +2 -0
- package/lib/types/knowledge/service.d.ts +52 -0
- package/lib/types/knowledge/sessions.d.ts +59 -0
- package/lib/types/knowledge/sources.d.ts +2 -0
- package/lib/types/knowledge/timestamps.d.ts +1 -0
- package/lib/types/knowledge/types.d.ts +84 -0
- package/lib/types/llm/response.d.ts +1 -0
- package/lib/types/llm/structured.d.ts +27 -0
- package/lib/types/local-name.d.ts +1 -0
- package/lib/types/plugins/client.d.ts +9 -0
- package/lib/types/plugins/commands.d.ts +11 -0
- package/lib/types/plugins/configuration.d.ts +8 -0
- package/lib/types/plugins/dream.d.ts +16 -0
- package/lib/types/plugins/formation.d.ts +16 -0
- package/lib/types/plugins/inbox.d.ts +16 -0
- package/lib/types/plugins/knowledge.d.ts +19 -0
- package/lib/types/plugins/prompt.d.ts +17 -0
- package/lib/types/plugins/tools.d.ts +10 -0
- package/lib/types/prompt/render.d.ts +2 -0
- package/lib/types/protocol/arbitration.d.ts +154 -0
- package/lib/types/protocol/auth.d.ts +31 -0
- package/lib/types/protocol/claim.d.ts +36 -0
- package/lib/types/protocol/dispute.d.ts +17 -0
- package/lib/types/protocol/ids.d.ts +20 -0
- package/lib/types/protocol/inbox.d.ts +141 -0
- package/lib/types/protocol/index.d.ts +11 -0
- package/lib/types/protocol/policy.d.ts +21 -0
- package/lib/types/protocol/revision.d.ts +2 -0
- package/lib/types/protocol/router.d.ts +114 -0
- package/lib/types/protocol/schema.d.ts +4 -0
- package/lib/types/protocol/time.d.ts +5 -0
- package/lib/types/protocol/trace.d.ts +11 -0
- package/lib/types/store/atomic.d.ts +8 -0
- package/lib/types/store/claim-edits.d.ts +33 -0
- package/lib/types/store/claims.d.ts +7 -0
- package/lib/types/store/context.d.ts +13 -0
- package/lib/types/store/delivery-status.d.ts +48 -0
- package/lib/types/store/disputes.d.ts +6 -0
- package/lib/types/store/entities.d.ts +16 -0
- package/lib/types/store/errors.d.ts +8 -0
- package/lib/types/store/history.d.ts +65 -0
- package/lib/types/store/inbox.d.ts +27 -0
- package/lib/types/store/index.d.ts +16 -0
- package/lib/types/store/jobs.d.ts +5 -0
- package/lib/types/store/library-directory.d.ts +4 -0
- package/lib/types/store/lock.d.ts +11 -0
- package/lib/types/store/path-names.d.ts +2 -0
- package/lib/types/store/paths.d.ts +45 -0
- package/lib/types/store/presentation.d.ts +13 -0
- package/lib/types/store/regular-file.d.ts +2 -0
- package/lib/types/store/rejected-disputes.d.ts +18 -0
- package/lib/types/store/rename.d.ts +1 -0
- package/lib/types/store/reported-sets.d.ts +24 -0
- package/lib/types/store/session-state.d.ts +17 -0
- package/lib/types/store/traces.d.ts +6 -0
- package/lib/types/store/uploads.d.ts +312 -0
- package/lib/types/store/yaml.d.ts +8 -0
- package/lib/types/team/errors.d.ts +10 -0
- package/lib/types/team/http.d.ts +20 -0
- package/lib/types/team/index.d.ts +5 -0
- package/lib/types/team/maintainer-client.d.ts +18 -0
- package/lib/types/team/router-client.d.ts +14 -0
- package/lib/types/team/service.d.ts +28 -0
- package/lib/types/team/system-proxy.d.ts +9 -0
- package/lib/types/tools/claim.d.ts +63 -0
- package/lib/types/tools/consult-router.d.ts +11 -0
- package/lib/types/tools/subagent.d.ts +8 -0
- package/lib/types/tools/validation.d.ts +2 -0
- package/lib/types/upload/consolidation.d.ts +63 -0
- package/lib/types/upload/deliver.d.ts +15 -0
- package/lib/types/upload/index.d.ts +2 -0
- package/lib/types/upload/scheduler.d.ts +19 -0
- package/lib/types/upstreams.d.ts +5 -0
- package/lib/types/worker/queue.d.ts +17 -0
- package/lib/types/worker/types.d.ts +51 -0
- package/lib/types/worker/worker.d.ts +39 -0
- package/lib/types-C2ST2Zdg.js +17 -0
- package/lib/upload.js +3 -0
- package/lib/uploads-BCA2p92b.js +210 -0
- package/lib/upstreams-DEi-56tD.js +495 -0
- package/lib/worker-HMGzJFWd.js +185 -0
- package/locale/commands/en.json +1 -0
- package/locale/commands/zh.json +1 -0
- package/locale/dream/en.json +1 -0
- package/locale/dream/zh.json +1 -0
- package/locale/en.json +7 -0
- package/locale/formation/en.json +1 -0
- package/locale/formation/zh.json +1 -0
- package/locale/inbox/en.json +1 -0
- package/locale/inbox/zh.json +1 -0
- package/locale/knowledge/en.json +1 -0
- package/locale/knowledge/zh.json +1 -0
- package/locale/prompt/en.json +1 -0
- package/locale/prompt/zh.json +1 -0
- package/locale/tools/en.json +1 -0
- package/locale/tools/zh.json +1 -0
- package/locale/zh.json +7 -0
- package/package.json +262 -3
- package/prompts/claim_dream.j2 +77 -0
- package/prompts/claim_dream_legacy.j2 +63 -0
- package/prompts/dream_compaction.j2 +11 -0
- package/prompts/dream_evidence.j2 +5 -0
- package/prompts/inbox_claim_attribute_update_internalize.j2 +112 -0
- package/prompts/inbox_policy_update_internalize.j2 +87 -0
- package/prompts/knowledge.j2 +38 -0
- package/prompts/session_recap.j2 +113 -0
- package/prompts/what_is_claim.j2 +51 -0
- package/prompts/what_is_dispute.j2 +21 -0
- package/prompts/what_is_policy.j2 +22 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# ACN 记忆框架使用指南
|
|
2
|
+
|
|
3
|
+
[README](../README.md)
|
|
4
|
+
|
|
5
|
+
ACN 让不同 Agent 的工作经验在团队中流动:分享有依据的结论、查找已有经验、处理知识分歧,并接收团队建议。你也可以个人使用,在自己的会话之间积累与复用知识;接入团队能更充分地发挥 ACN 的作用。
|
|
6
|
+
|
|
7
|
+
本文介绍 DSH 插件中的日常操作。截图来自隔离的 DSH 演示环境,使用示例身份、地址和知识,不包含真实成员信息;请按自己的配置填写。
|
|
8
|
+
|
|
9
|
+
- [首次使用](#首次使用)
|
|
10
|
+
- [在会话中使用知识](#在会话中使用知识)
|
|
11
|
+
- [查看知识与活动](#查看知识与活动)
|
|
12
|
+
- [接入团队](#接入团队)
|
|
13
|
+
- [记忆与知识整理](#知识整理)
|
|
14
|
+
- [遇到问题时](#遇到问题时)
|
|
15
|
+
|
|
16
|
+
## 首次使用
|
|
17
|
+
|
|
18
|
+
### 安装插件
|
|
19
|
+
|
|
20
|
+
在 DSH 打开「插件 → 添加插件」,填写:
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
@ftai/dsh-plugin-acn
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
完成安装并启用 **ACN记忆框架**。
|
|
27
|
+
|
|
28
|
+
不写版本号时,安装 npm 上 `latest` 标签对应的版本。需要特定版本时,在包名后加 `@版本号`,例如 `@ftai/dsh-plugin-acn@0.1.1`。
|
|
29
|
+
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
如果已安装旧包名的版本,先在插件页卸载旧插件,再安装新包,避免同时启用两份 ACN。卸载插件不会删除知识目录中的数据。
|
|
33
|
+
|
|
34
|
+
### 更新插件
|
|
35
|
+
|
|
36
|
+
当前 DSH 不会自动检查和提醒本插件的新版本。可以在 [GitHub 仓库](https://github.com/FTShare-Lab/dsh-plugin-acn)点击「Watch → Custom」,勾选「Releases」并保存,订阅后续发版通知;通知方式取决于你的 GitHub 通知设置。
|
|
37
|
+
|
|
38
|
+
收到新版本通知后:
|
|
39
|
+
|
|
40
|
+
1. 暂停发起新对话和知识操作,打开正在使用的工作配置的「知识与活动 → 处理活动」。查看最近任务,等「等待处理」「正在处理」的任务结束;「本地处理完成」「已按额度收尾」等表示本轮已结束,历史的失败或暂停记录无需全部变成成功。然后在 DSH「插件」中打开 ACN,查看当前版本。
|
|
41
|
+
2. 点击「卸载」。知识目录中的数据会保留,不要删除该目录。
|
|
42
|
+
3. 再次点击「添加插件」,填写 `@ftai/dsh-plugin-acn` 安装新版;需要固定版本时,在包名后加 `@版本号`。
|
|
43
|
+
4. 确认插件显示的版本,检查工作配置与知识目录,再新建会话使用。
|
|
44
|
+
|
|
45
|
+
直接重复添加同名包,即使指定不同版本,当前 DSH 桌面界面也会提示已安装,不会自动覆盖或生成两份插件。不写版本号不代表启用自动更新。
|
|
46
|
+
|
|
47
|
+
### 建立自己的工作配置
|
|
48
|
+
|
|
49
|
+
打开插件详情中的「工作配置」,点击「新建工作配置」。也可以从 DSH 设置中的「ACN 插件设置」进入。
|
|
50
|
+
|
|
51
|
+
1. 填一个便于识别的显示名称,例如“研究团队”。
|
|
52
|
+
2. 填写管理员提供的 **Agent ID**。新建配置默认开启并展开「连接团队服务」。
|
|
53
|
+
3. 填写 Maintainer、Router 地址,以及启用鉴权时的团队 Key(可选),点击「检查连接」。两项均通过后,确认并保存。服务部署与字段说明见[接入团队](#接入团队)。
|
|
54
|
+
|
|
55
|
+

|
|
56
|
+
|
|
57
|
+
个人使用时,填写固定的 Agent ID,例如 `agent-a`,保持「连接团队服务」关闭后保存即可。单人配置只使用本地知识,不连接团队服务。
|
|
58
|
+
|
|
59
|
+
工作配置可以理解为一份独立的知识空间。同一配置下的不同项目可以复用知识;如果希望两份工作的知识分开,就新建两份配置。
|
|
60
|
+
|
|
61
|
+
列表中点击「配置」可以启停或设为默认。更换默认配置时会要求确认;默认值用于没有可用项目历史的新会话,不会替换旧会话的归属。
|
|
62
|
+
|
|
63
|
+

|
|
64
|
+
|
|
65
|
+
### 选择知识处理模型
|
|
66
|
+
|
|
67
|
+
切到「知识与模型」,选择可用的知识处理模型并保存。它负责会话复盘、团队消息处理和 Claim 整理,与输入框旁的聊天模型分别设置。
|
|
68
|
+
|
|
69
|
+
如果列表没有可用模型,先完成 DSH 的模型配置。知识目录通常保留默认值即可;需要调整时,可以点击文件夹图标选择,或用「打开目录」查看当前位置。修改目录不会自动搬移原数据。
|
|
70
|
+
|
|
71
|
+
已有 ACN 知识时,可以选择直接包含 `settings.json` 和 `upstreams/` 的账号目录。保存后,原来的工作配置和知识会一起出现,无需逐份寻找配置子目录。先结束原程序的知识任务并退出,再切换目录;随后确认当前宿主中的知识处理模型和团队 Key,即可新建会话继续使用。
|
|
72
|
+
|
|
73
|
+

|
|
74
|
+
|
|
75
|
+
## 在会话中使用知识
|
|
76
|
+
|
|
77
|
+
新建会话后,点击输入框旁的 **ACN**,确认本次使用的工作配置。新会话优先沿用同项目最近新建会话的有效配置,没有可用记录时使用默认配置;发送第一条消息前可以改选。
|
|
78
|
+
|
|
79
|
+

|
|
80
|
+
|
|
81
|
+
之后正常开展工作即可,例如查阅项目、排查问题或讨论方案。助手会按需查阅已有知识,并结合当前任务判断是否适用。
|
|
82
|
+
|
|
83
|
+
完成一段有价值的工作后,可在 ACN 菜单选择「复盘本次会话」,或输入 `/recap`。任务会在后台处理,可到「知识与活动 → 处理活动」查看结果。
|
|
84
|
+
|
|
85
|
+
有依据、带适用范围、值得以后复用的结论才可能保存。任务完成也可能没有新增知识,或只是修订已有记录。
|
|
86
|
+
|
|
87
|
+
日常不必每次手动复盘:默认会在达到一定对话量并空闲 5 分钟后整理;有少量新增内容时,空闲 1 小时也会整理。上下文压缩和归档会安排相应处理。详细条件见[命令与行为参考](command-reference.md#知识形成与失败重试)。
|
|
88
|
+
|
|
89
|
+
会话开始后,工作配置固定。想换知识空间或团队,请新建会话。安装前已开始的旧会话可以继续普通聊天,使用 ACN 时请另建会话。
|
|
90
|
+
|
|
91
|
+
## 查看知识与活动
|
|
92
|
+
|
|
93
|
+
从 ACN 菜单,或工作配置右侧的「知识与活动」进入。先确认页面上方选中的是你要查看的配置。
|
|
94
|
+
|
|
95
|
+
### 本地知识
|
|
96
|
+
|
|
97
|
+
| 类型 | 记录什么 | 阅读重点 |
|
|
98
|
+
| --- | --- | --- |
|
|
99
|
+
| Claim | 一条有适用范围的知识判断 | 正文、适用范围、证据、置信度 |
|
|
100
|
+
| Dispute | 多条知识之间尚待处理的分歧 | 相关知识、分歧内容和同步状态 |
|
|
101
|
+
| Trace | 一次知识处理的来源与产物 | 输入引用、输出知识、来源会话 |
|
|
102
|
+
|
|
103
|
+
点击一条记录展开详情。来源会话可以返回原聊天;Claim、Trace 引用可以继续展开,点击返回即可回到上一条详情。本地没有保存的来源会显示提示,不能仅凭这一点判断来源已经失效。
|
|
104
|
+
|
|
105
|
+
Claim 先显示活跃知识,再显示陈旧、弃用知识,各组内最近更新的在前;Dispute 先显示未解决的分歧,各组内最近创建或解决的在前;Trace 按创建时间倒序排列。
|
|
106
|
+
|
|
107
|
+

|
|
108
|
+
|
|
109
|
+
团队配置中的「已同步」表示当前版本已得到当前团队的上传确认;「等待投递」表示仍在本地队列中。没有上传回执的旧记录会显示为本地知识。
|
|
110
|
+
|
|
111
|
+
### 处理活动
|
|
112
|
+
|
|
113
|
+
这里显示复盘、会话收尾、团队收件、知识内化、整理与投递的进度。可按类型、来源会话或需要处理的项目筛选;展开记录查看结果和错误原因。
|
|
114
|
+
|
|
115
|
+

|
|
116
|
+
|
|
117
|
+
“本地处理完成”表示本轮处理已结束;是否有知识产出、是否成功投递给团队,需要查看各自的结果。失败时先解决页面提示的问题,再使用记录上的「重试任务」「继续任务」或「重试团队投递」。
|
|
118
|
+
|
|
119
|
+
## 接入团队
|
|
120
|
+
|
|
121
|
+
### 先由团队部署服务
|
|
122
|
+
|
|
123
|
+
本插件提供 Agent 侧功能。**Maintainer(M)和 Router(R)需要由用户团队从 [ACN 官方仓库](https://github.com/FTShare-Lab/agent-claim-network) 自行安装部署**;部署、鉴权和服务参数以该仓库说明为准。
|
|
124
|
+
|
|
125
|
+
| 角色 | 在协作中负责什么 |
|
|
126
|
+
| --- | --- |
|
|
127
|
+
| Agent(A,本插件) | 执行任务,维护个人知识,分享结论并处理团队建议 |
|
|
128
|
+
| Maintainer(M) | 保存共享记录,发布团队规则,处理知识争议并发送建议 |
|
|
129
|
+
| Router(R) | 检索团队知识,返回相关候选和来源 |
|
|
130
|
+
|
|
131
|
+
部署完成后,管理员提供 **Agent ID、Maintainer 地址、Router 地址**,以及启用鉴权时的 **团队 Key(可选)**。普通成员取得这些信息后,在 DSH 中配置即可,无需照搬独立 ACN Agent 的终端配置步骤。
|
|
132
|
+
|
|
133
|
+
### 填写并检查连接
|
|
134
|
+
|
|
135
|
+
在「工作配置」打开已有配置,或新建一份团队配置,开启「连接团队服务」。
|
|
136
|
+
|
|
137
|
+
| 字段 | 如何填写 |
|
|
138
|
+
| --- | --- |
|
|
139
|
+
| 显示名称 | 自己容易识别的名称,例如“研究团队” |
|
|
140
|
+
| Agent ID | 管理员确认的成员身份 |
|
|
141
|
+
| Maintainer 地址 | 管理员提供的服务地址,保留协议、端口和部署路径 |
|
|
142
|
+
| Router 地址 | 同一套团队的检索地址,端口可能不同 |
|
|
143
|
+
| 团队鉴权密钥 | 管理员提供的 Key;免鉴权团队留空 |
|
|
144
|
+
|
|
145
|
+
填写服务地址、点击「检查连接」,弹窗中两项均通过后确认保存。
|
|
146
|
+
|
|
147
|
+

|
|
148
|
+
|
|
149
|
+
已有密钥的输入框留空会保留原值;输入新 Key 后保存会替换。需要移除时,使用页面的「移除密钥绑定」。
|
|
150
|
+
|
|
151
|
+
### 同步与复用团队知识
|
|
152
|
+
|
|
153
|
+
新会话选择团队配置后,先等待收件准备完成,再开始聊天。管理员刚发布规则或处理了争议,需要立即查看时,在 ACN 菜单点击「同步收件」,或输入 `/inbox`。
|
|
154
|
+
|
|
155
|
+
ACN Agent 侧的收件与处理分两步:先接收团队消息,再由知识模型结合本地情况处理。结果可能是新增、修改或保持现状。请在「处理活动」核对收到与处理的数量,再查看知识变化。
|
|
156
|
+
|
|
157
|
+
需要查找团队经验时,可以直接告诉助手:“查询团队关于这个问题的知识,并说明哪些结论适用于当前任务。” Router 返回候选知识,助手会判断如何采用;团队知识不会全部复制到每个成员的本地库。
|
|
158
|
+
|
|
159
|
+
团队模式下,整理出的知识和争议可能共享给团队。只想留在个人空间的工作,请使用单人配置。单人使用期间的历史知识仍可保留,后来接入团队不会将整库历史自动补传。
|
|
160
|
+
|
|
161
|
+
## 知识整理
|
|
162
|
+
|
|
163
|
+
本插件管理以 Claim 为主体的可复用经验,在接入团队时形成经验分享与流动;不维护私有 Memory 及其管理。知识提炼时会过滤工具名包含 `memory` 的工具调用及其结果(不区分大小写)。
|
|
164
|
+
|
|
165
|
+
**Dream**用于回顾和整理已经积累的知识。**默认开启自动整理,一般无需手动操作。** 使用该工作配置时,插件会在启动、创建会话时检查,DSH 运行期间每 4 小时再检查一次。自上次整理以来,至少 5 条不同的自有知识(Claim)新增或更新,且距离上次成功整理已满 24 小时,就会自动安排后台整理;首次整理无需等待 24 小时。
|
|
166
|
+
|
|
167
|
+
想提前整理时,可以输入 `/dream`;需要暂停时使用 `/dream stop`。进度和报告可在「处理活动」查看。整理会调用知识处理模型,正常结束也可能保留原样。
|
|
168
|
+
|
|
169
|
+
「偏好 → 显示知识处理结果」只控制来源会话中的短暂提示。关闭后,后台任务仍继续执行,完整结果仍可在「知识与活动」查看。高级参数通常保持默认,需要调整时再查[配置参考](config.md)。
|
|
170
|
+
|
|
171
|
+
## 遇到问题时
|
|
172
|
+
|
|
173
|
+
| 遇到的情况 | 先做什么 |
|
|
174
|
+
| --- | --- |
|
|
175
|
+
| ACN 菜单没有可用配置 | 确认插件已启用,创建并保存工作配置,再新建会话 |
|
|
176
|
+
| 连接检查失败 | 按弹窗提示核对对应服务的地址、网络、Agent ID 和 Key;请管理员确认服务正常 |
|
|
177
|
+
| 检查连接通过,但同步失败 | 回来源会话重试同步,在处理活动中查看本次失败原因 |
|
|
178
|
+
| 聊天正常,知识任务失败 | 检查知识处理模型是否可用,再重试失败任务 |
|
|
179
|
+
| 聊了很多,没有新 Claim | 先看活动是否完成;可手动 /recap 复盘。完成且产出为 0,表示本轮没有需要新增的知识 |
|
|
180
|
+
| 刷新知识页后看不到新团队规则 | 先同步收件,再查看处理结果;知识页刷新只更新本地列表 |
|
|
181
|
+
| 管理台与本地数量不同 | 管理台汇集团队记录,本地页面只显示当前工作配置下的知识 |
|
|
182
|
+
|
|
183
|
+
反馈问题时,提供 DSH 与插件版本、失败时间、错误提示和相关记录 ID 即可。截图中的 Key、账号、个人目录和团队内网地址应遮挡后再分享。
|
|
184
|
+
|
|
185
|
+
更多操作见[命令与行为参考](command-reference.md),服务部署见 [ACN 官方仓库](https://github.com/FTShare-Lab/agent-claim-network),兼容范围见[DSH 兼容说明](dsh-compat.md)。
|
package/icon.svg
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128" fill="none">
|
|
2
|
+
<rect x="4" y="4" width="120" height="120" rx="28" fill="#15343B"/>
|
|
3
|
+
<path d="M36 35 91 40 63 91 36 35Z" stroke="#70D6BD" stroke-width="6" stroke-linejoin="round"/>
|
|
4
|
+
<circle cx="36" cy="35" r="13" fill="#E6F8ED"/>
|
|
5
|
+
<circle cx="91" cy="40" r="13" fill="#70D6BD"/>
|
|
6
|
+
<circle cx="63" cy="91" r="15" fill="#F4C97A"/>
|
|
7
|
+
<path d="m57 91 4 4 8-9" stroke="#15343B" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
|
|
8
|
+
</svg>
|
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
import { h as TraceIdSchema, l as ClaimIdSchema, u as DisputeIdSchema } from "./claim-DOAGe8ZK.js";
|
|
2
|
+
import { w as hasCode } from "./lock-DbmlKOoX.js";
|
|
3
|
+
import { i as RejectedDisputeStore, r as UploadStore } from "./uploads-BCA2p92b.js";
|
|
4
|
+
import { n as deliveryTarget, t as DeliveryStatusStore } from "./delivery-status-M7-Rwoyj.js";
|
|
5
|
+
import { t as JobQueue } from "./queue-M917xHPS.js";
|
|
6
|
+
import { n as PresentationStore, t as historicalKnowledge } from "./history-DPMHX3ZE.js";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import fs from "node:fs/promises";
|
|
9
|
+
import { join } from "node:path";
|
|
10
|
+
//#region src/interaction-messages.ts
|
|
11
|
+
const MessageInfoSchema = z.object({
|
|
12
|
+
code: z.string(),
|
|
13
|
+
count: z.number().optional(),
|
|
14
|
+
entityId: z.string().optional(),
|
|
15
|
+
status: z.number().optional()
|
|
16
|
+
});
|
|
17
|
+
const messages = {
|
|
18
|
+
check_auth: ["认证未通过,请检查 Agent ID 和团队鉴权密钥。", "Authentication failed. Check the Agent ID and team authentication key."],
|
|
19
|
+
check_timeout: ["连接超时,请检查服务状态和网络后重试。", "The connection timed out. Check the service and network, then retry."],
|
|
20
|
+
check_dns: ["无法解析服务域名,请检查地址和网络。", "The service hostname could not be resolved. Check the URL and network."],
|
|
21
|
+
check_unreachable: ["无法连接服务,请检查地址、端口和服务是否已启动。", "The service could not be reached. Check its address, port and whether it is running."],
|
|
22
|
+
check_network: ["网络连接失败,请检查网络或代理后重试。", "The network connection failed. Check the network or proxy and retry."],
|
|
23
|
+
check_service: ["服务暂时不可用,请检查服务状态后重试。", "The service is temporarily unavailable. Check its status and retry."],
|
|
24
|
+
check_protocol: ["服务响应不符合 ACN 协议,请联系团队管理员检查服务版本。", "The response does not match the ACN protocol. Ask your team administrator to check the service version."],
|
|
25
|
+
check_client: ["服务拒绝了请求,请检查服务地址和访问权限。", "The service rejected the request. Check its URL and access permissions."],
|
|
26
|
+
check_offline: ["部分团队服务不可用;可保存配置并继续本地工作,团队同步前需恢复连接。", "Some team services are unavailable. You can save and continue local work; restore the connection before team sync."],
|
|
27
|
+
team_check_ok: ["连接与认证通过", "Connection and authentication passed"],
|
|
28
|
+
team_check_failed: ["未通过,请检查地址、服务状态和团队鉴权密钥。", "Check the service URL, availability and team authentication key."],
|
|
29
|
+
delivery_ack: ["已标记知悉;该争议仍未成功投递。", "Acknowledged. This dispute was not successfully delivered."],
|
|
30
|
+
delivery_complete: ["本轮团队投递已完成。", "This delivery attempt completed."],
|
|
31
|
+
delivery_incomplete: ["团队投递未全部完成,请查看活动中的具体原因。", "Team delivery did not fully complete. Review the reasons in Activity."],
|
|
32
|
+
delivery_wait: ["仍有投递正在进行或等待依赖,待投记录已保留。", "Delivery is still in progress or waiting for dependencies. Pending records are retained."],
|
|
33
|
+
dream_new: ["已创建新的 Dream 请求,将重新读取当前知识。", "A new Dream request was created and will read current knowledge."],
|
|
34
|
+
service_inactive: ["知识组件尚未启用,聊天仍可继续。请在插件管理中启用 ACN 知识组件。", "The knowledge component is inactive. Chat remains available. Enable the ACN knowledge component in the plugin manager."],
|
|
35
|
+
invalid_request: ["请求字段不合法,请重新加载页面。", "The request is invalid. Reopen the ACN page and retry."],
|
|
36
|
+
select_identity: ["请选择可用的知识身份。", "Select an available work configuration."],
|
|
37
|
+
identity_unavailable: ["知识身份不可用。", "This knowledge identity is unavailable. Restore its work configuration first."],
|
|
38
|
+
retry_disabled: ["连接已停用或删除,不能重试。", "This configuration is disabled or missing. Restore it in ACN settings before retrying."],
|
|
39
|
+
retry_queued: ["任务已重新入队。", "The task has been queued again."],
|
|
40
|
+
session_unavailable: ["会话不可用,请重新打开或新建会话。", "The session is unavailable. Reopen it or start a new session."],
|
|
41
|
+
session_unbound: ["本会话未启用 ACN,聊天仍可继续。只有安装插件后新建且尚未发送消息的会话可选择工作配置;如需使用 ACN,请新建会话。", "ACN is not enabled for this session; ordinary chat remains available. Only blank sessions created after installation can choose a work configuration. Start a new session to use ACN."],
|
|
42
|
+
session_optional: ["本会话尚未启用 ACN,可直接聊天,或在首条消息前选择工作配置。", "ACN is not enabled for this session. You can chat normally, or choose a work configuration before the first message."],
|
|
43
|
+
recap_disabled: ["知识形成组件未启用。", "Knowledge formation is inactive. Enable the formation component in the plugin manager."],
|
|
44
|
+
recap_empty: ["没有可复盘的新增内容。", "There is no new completed content to recap."],
|
|
45
|
+
recap_queued: ["复盘已入队,可在处理活动中查看。", "The recap is queued. View it in Activity."],
|
|
46
|
+
solo_check: ["单人配置不需要连接检查;请先填写两个团队地址。", "Solo configurations need no team check. Enter both team service URLs first."],
|
|
47
|
+
agent_required: ["请先填写 Agent ID。", "Enter an Agent ID first."],
|
|
48
|
+
check_cancelled: ["检查已取消。", "The check was cancelled."],
|
|
49
|
+
team_checked: ["团队连接检查通过。", "Team connection and authentication checks passed."],
|
|
50
|
+
team_unavailable: ["部分服务不可用;可离线保存,使用前需恢复连接。", "Some team services are unavailable. You can save offline; restore connectivity before using them."],
|
|
51
|
+
model_automatic: ["沿用会话模型;首次同步前请先选择聊天模型。", "Following the session model. Select a chat model before the first sync."],
|
|
52
|
+
model_checked: ["知识模型检查通过。", "The knowledge model check passed."],
|
|
53
|
+
model_check_failed: ["模型未正常完成检查,保留原模型。请检查模型配置或重试。", "The model did not complete the check. The previous model is retained. Check its configuration and retry."],
|
|
54
|
+
operation_failed: ["操作未完成。请检查连接、知识模型和本地存储后重试。", "The operation did not complete. Check the team connection, knowledge model and local storage, then retry."],
|
|
55
|
+
configuration_busy: ["ACN 配置正在应用,请稍后重试。", "ACN configuration is being applied. Retry shortly."],
|
|
56
|
+
key_invalid: ["请检查团队配置,并填写有效的鉴权密钥。", "Check the team configuration and enter a valid authentication key."],
|
|
57
|
+
key_check_failed: ["检查未完成,请核对团队配置后重试。", "The check did not complete. Review the team settings and retry."],
|
|
58
|
+
key_unmanaged: ["当前 DSH 未提供凭据托管,无法在此页保存新密钥。仍可输入临时密钥检查连接;保存新密钥需使用支持凭据托管的 DSH。已有环境变量引用可继续沿用,高级配置方法见插件配置文档。", "This DSH has no credential storage, so this page cannot save a new key. You can check a temporary key or retain an existing environment reference. Saving a key requires DSH credential storage; see the plugin configuration guide for advanced setup."],
|
|
59
|
+
key_readonly: ["当前密钥存储只读,无法保存新密钥;仍可检查连接,或留空保留现有密钥。", "Credential storage is read-only. You can check a draft key or keep the current key, but cannot save a replacement."],
|
|
60
|
+
key_immutable: ["已有密钥引用不能覆盖,请重新输入并保存为新引用。", "An existing credential reference cannot be overwritten. Enter the key again and save a new reference."],
|
|
61
|
+
key_in_use: ["密钥已被配置或会话使用,保留现有凭据。", "The key is in use by a configuration or session and has been retained."],
|
|
62
|
+
key_stored: ["凭据已保存到 DSH 托管存储,完成配置保存后,新启动的会话才会采用;已有会话保留原连接。", "The new credential is stored. New sessions adopt it after the configuration saves; existing sessions retain their connection."],
|
|
63
|
+
key_failed: ["凭据操作未完成,请检查宿主凭据服务后重试。", "The credential operation failed. Check the host credential service and retry."],
|
|
64
|
+
blank_identity: ["请从 ACN 菜单选择可用的工作配置,初始化当前空白会话。", "Choose a work configuration from the ACN menu to initialize this blank session."],
|
|
65
|
+
bound_identity: ["工作配置已停用、缺失或 Agent ID 已改变;请在设置中恢复同一配置及原 Agent ID,或使用新会话。", "The work configuration is disabled, missing, or its Agent ID changed. Restore the same configuration and original Agent ID, or start a new session."],
|
|
66
|
+
connection_changed: ["已保存新连接,当前会话仍使用启动时的配置。", "The new connection is saved. This session retains its startup configuration."],
|
|
67
|
+
sync_retry: ["上次同步未完成,可继续本地工作或重试同步。", "The last sync did not finish. Continue with local knowledge or retry sync."],
|
|
68
|
+
sync_cancelled: ["已取消同步等待,已持久化的收件保留,可继续使用本地知识。", "Sync waiting was cancelled. Received items are retained; continue with local knowledge."],
|
|
69
|
+
sync_wait: ["正在同步团队收件并准备本地知识…", "Synchronizing the team Inbox and preparing local knowledge…"],
|
|
70
|
+
sync_cancelling: ["正在结束同步并准备本地知识,已持久化的收件保留。", "Ending sync waiting and preparing local knowledge. Received items are retained."],
|
|
71
|
+
solo_ready: ["单人模式已就绪,不连接团队服务。", "Solo mode is ready. No team services are contacted."]
|
|
72
|
+
};
|
|
73
|
+
const messageInfo = (message, kind) => {
|
|
74
|
+
const known = Object.entries(messages).find(([, value]) => value[0] === message);
|
|
75
|
+
if (known !== void 0) return { code: known[0] };
|
|
76
|
+
const entityId = message.match(/\b(?:claim|dispute)_[0-9a-f]{8}\b/)?.[0];
|
|
77
|
+
const statusText = message.match(/status=(\d{3})/)?.[1];
|
|
78
|
+
const status = statusText === void 0 ? void 0 : Number(statusText);
|
|
79
|
+
let code = kind === void 0 ? "" : `task.${kind}`;
|
|
80
|
+
if (!code && /Router 概览暂不可用|Maintainer 收件或确认未完成|同步失败/.test(message)) code = "sync_partial";
|
|
81
|
+
if (!code && /收件同步完成:拉取 (\d+) 条/.test(message)) return {
|
|
82
|
+
code: "sync_complete",
|
|
83
|
+
count: Number(message.match(/拉取 (\d+) 条/)?.[1] ?? 0)
|
|
84
|
+
};
|
|
85
|
+
if (!code && /Router 概览暂不可用|Maintainer 收件或确认未完成|同步失败/.test(message)) code = "sync_partial";
|
|
86
|
+
if (!code && /会话.*身份|知识归属|原连接|原 Agent ID/.test(message)) code = "bound_identity";
|
|
87
|
+
if (!code && /只能重试已失败/.test(message)) code = "retry_state";
|
|
88
|
+
if (!code && /^(router|maintainer) POST/u.test(message)) code = /鉴权|认证/.test(message) ? "delivery.auth" : "delivery.retryable";
|
|
89
|
+
if (!code && /鉴权|认证/.test(message)) code = "task.model_auth";
|
|
90
|
+
if (!code && /409/.test(message)) code = "delivery.rejected";
|
|
91
|
+
if (!code && /待上传版本/.test(message)) code = "delivery.version";
|
|
92
|
+
if (!code && /收件|同步/.test(message)) code = "sync_partial";
|
|
93
|
+
return {
|
|
94
|
+
code: code || "legacy",
|
|
95
|
+
...entityId === void 0 ? {} : { entityId },
|
|
96
|
+
...status === void 0 ? {} : { status }
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
const recovery = {
|
|
100
|
+
transcript_occupied: "Session projection files are not writable or a lock timed out after bounded retries. Check file usage and directory permissions, then retry the original task. No knowledge model call was made.",
|
|
101
|
+
transcript_space: "Local storage space or quota is exhausted. Restore capacity, then retry the original task; incomplete input was not sent to the knowledge model.",
|
|
102
|
+
transcript_corrupt: "Session projections conflict or are corrupt. Keep the original data and contact the maintainer; missing input was not skipped.",
|
|
103
|
+
transcript_source: "The original session log could not be replayed. Restore the original session and work configuration, then retry.",
|
|
104
|
+
transcript_io: "Session projection I/O failed. Check local storage, then retry the task or recap again; no knowledge model call was made.",
|
|
105
|
+
transcript_limit: "A single session projection exceeds the size limit. Keep the original session and contact the maintainer; oversized input cannot be silently skipped.",
|
|
106
|
+
formation_enqueue: "The formation task could not be queued. Projections are retained. Check local storage and recap again.",
|
|
107
|
+
handler_inactive: "The required background component is inactive. Enable it in the DSH plugin manager, then retry.",
|
|
108
|
+
context_limit: "The model context limit was reached. Select a knowledge model with enough context and retry.",
|
|
109
|
+
structured_output: "The model repeatedly returned invalid JSON. Retry or choose another knowledge model.",
|
|
110
|
+
structured_output_limit: "The model output was truncated. Increase the output limit or choose another knowledge model, then retry.",
|
|
111
|
+
structured_output_content: "The model returned unsupported response content. Retry or choose another knowledge model.",
|
|
112
|
+
model_response: "The model response format was invalid. Retry or choose another knowledge model.",
|
|
113
|
+
identity: "Restore the original work configuration and Agent ID, or start a new session.",
|
|
114
|
+
bound: "This session identity is fixed. Start a new session to choose a different configuration.",
|
|
115
|
+
connection: "Restore this work configuration and its team connection in ACN settings before retrying.",
|
|
116
|
+
empty: "There are no owned active or stale claims to organize. Form reusable knowledge first.",
|
|
117
|
+
disabled: "Dream is disabled. Enable the Dream component and dream.enabled in plugin configuration before retrying.",
|
|
118
|
+
validation: "This operation does not match the current task state. Refresh Activity and select the current failed or paused task.",
|
|
119
|
+
inbox: "Inbox processing did not finish. Review the failed task in Activity and check the knowledge model or team connection.",
|
|
120
|
+
model_auth: "Model authentication failed. Check the model provider credentials in DSH settings, then retry.",
|
|
121
|
+
model_quota: "The model quota is exhausted. Restore provider quota or select another knowledge model, then retry.",
|
|
122
|
+
model_context: "The model context limit was reached. Select a model with enough context, then retry.",
|
|
123
|
+
model_request: "The model rejected the request. Check the model parameters and output limits, then retry.",
|
|
124
|
+
model_rate_limit: "The model rate limit was reached. Wait or reduce provider concurrency, then retry.",
|
|
125
|
+
model_server: "The model service is unavailable. Wait or choose another knowledge model, then retry.",
|
|
126
|
+
model_empty: "The model returned an empty response. Retry or choose another knowledge model.",
|
|
127
|
+
timeout: "The model request timed out. Check connectivity or timeout settings, then retry.",
|
|
128
|
+
transport: "The model connection failed. Restore connectivity to the provider, then retry.",
|
|
129
|
+
route: "No usable knowledge model route is available. Choose a knowledge model in ACN settings, then retry.",
|
|
130
|
+
dream_tool_json: "The model returned invalid tool-argument JSON after two retries. Progress and used budget are retained. Retry later or change the knowledge model.",
|
|
131
|
+
dream_timeout: "A Dream model request timed out. Progress and used budget are retained. Restore model connectivity and retry.",
|
|
132
|
+
dream_output_limit: "Dream reached the model output limit. Progress and used budget are retained. Adjust the output limit or choose another knowledge model, then retry.",
|
|
133
|
+
dream_incomplete: "Dream did not finish normally. Progress and used budget are retained. Review activity and retry.",
|
|
134
|
+
model_malformed: "The model response format is invalid. Progress is retained. Retry or choose another knowledge model.",
|
|
135
|
+
structured_invalid: "The model repeatedly returned invalid structured output. Retry or choose another knowledge model.",
|
|
136
|
+
knowledge_busy: "The knowledge store is busy. Wait for the current commit to finish, then retry.",
|
|
137
|
+
storage: "Local storage could not be read or committed. Check directory permissions and available disk space, then retry."
|
|
138
|
+
};
|
|
139
|
+
function displayMessage(message, copy, info) {
|
|
140
|
+
if (message === "" || copy("中文", "English") === "中文") return message;
|
|
141
|
+
const descriptor = info ?? messageInfo(message);
|
|
142
|
+
const key = descriptor.code;
|
|
143
|
+
const fixed = messages[key];
|
|
144
|
+
let text;
|
|
145
|
+
if (fixed !== void 0) text = fixed[1];
|
|
146
|
+
else if (key.startsWith("task.")) text = recovery[key.slice(5)] ?? "The background task failed. Check the knowledge model and local storage, then retry.";
|
|
147
|
+
else if (key === "sync_complete") text = `Inbox sync completed: ${descriptor.count ?? 0} received. Local knowledge is ready.`;
|
|
148
|
+
else if (key === "sync_partial") text = "Team sync did not fully complete. Check the Router and Maintainer URLs, team authentication key, knowledge model and local storage; local work can continue.";
|
|
149
|
+
else if (key === "retry_state") text = "Only failed tasks can be retried. Refresh Activity and choose the current failed task.";
|
|
150
|
+
else if (key === "delivery.rejected") text = "The team service rejected this dispute (409). Automatic retries stopped. Review the related claims before forming a new dispute.";
|
|
151
|
+
else if (key === "delivery.auth") text = "Team delivery authentication failed. Check the member ID and team key in ACN settings, then retry delivery.";
|
|
152
|
+
else if (key === "delivery.dependency") text = "Waiting for consolidation carrier acknowledgement. Delivery resumes when dependencies are ready.";
|
|
153
|
+
else if ([
|
|
154
|
+
"delivery.retryable",
|
|
155
|
+
"delivery.client",
|
|
156
|
+
"delivery.protocol"
|
|
157
|
+
].includes(key)) text = "Team delivery failed. Check the team URLs, connectivity, permissions and service version, then retry delivery.";
|
|
158
|
+
else if (key === "delivery.version") text = "The queued claim differs from the current local version. Review the current claim in a team session before sharing it again.";
|
|
159
|
+
else text = /^[^\u0080-\uFFFF]*$/u.test(message) ? message : "The operation could not complete. Review the work configuration, team connection and knowledge model, then retry.";
|
|
160
|
+
return text + (descriptor.entityId === void 0 ? "" : ` ${descriptor.entityId}`) + (descriptor.status === void 0 ? "" : ` [${descriptor.status}]`);
|
|
161
|
+
}
|
|
162
|
+
function commandMessage(message, kind) {
|
|
163
|
+
if (/^[^\u0080-\uFFFF]*$/u.test(message)) return message;
|
|
164
|
+
return `${message}\n${displayMessage(message, (_zh, en) => en, messageInfo(message, kind))}`;
|
|
165
|
+
}
|
|
166
|
+
//#endregion
|
|
167
|
+
//#region src/activities.ts
|
|
168
|
+
const Incomplete = z.object({
|
|
169
|
+
groupId: z.string(),
|
|
170
|
+
claimIds: z.array(ClaimIdSchema),
|
|
171
|
+
reason: z.string()
|
|
172
|
+
});
|
|
173
|
+
const labels = {
|
|
174
|
+
claimCount: "更新 Claim",
|
|
175
|
+
disputeCount: "形成争议",
|
|
176
|
+
traceCount: "形成来源",
|
|
177
|
+
applied: "更新 Claim",
|
|
178
|
+
handled: "处理收件",
|
|
179
|
+
uploadedClaims: "已投递 Claim",
|
|
180
|
+
reportedDisputes: "已上报争议",
|
|
181
|
+
modelSteps: "探索请求",
|
|
182
|
+
wrapUpSteps: "收尾请求"
|
|
183
|
+
};
|
|
184
|
+
const publicResult = (result) => result !== null && typeof result === "object" ? result : {};
|
|
185
|
+
function activityDetails(result) {
|
|
186
|
+
const value = publicResult(result);
|
|
187
|
+
const counts = Object.fromEntries(Object.keys(labels).flatMap((key) => typeof value[key] === "number" ? [[key, value[key]]] : []));
|
|
188
|
+
if (Array.isArray(value["updatedClaimIds"])) counts["claimCount"] = value["updatedClaimIds"].length;
|
|
189
|
+
const ids = z.array(z.union([
|
|
190
|
+
ClaimIdSchema,
|
|
191
|
+
DisputeIdSchema,
|
|
192
|
+
TraceIdSchema
|
|
193
|
+
]));
|
|
194
|
+
const entityIds = [...new Set(["entityIds", "updatedClaimIds"].flatMap((key) => {
|
|
195
|
+
const parsed = ids.safeParse(value[key]);
|
|
196
|
+
return parsed.success ? parsed.data : [];
|
|
197
|
+
}))];
|
|
198
|
+
const incomplete = z.array(Incomplete).safeParse(value["incompleteCandidates"]);
|
|
199
|
+
const warnings = z.array(z.string()).safeParse(value["warnings"]);
|
|
200
|
+
const texts = Object.entries(counts).map(([key, count]) => `${labels[key]}: ${count}`);
|
|
201
|
+
if (value["skipped"] === true || typeof value["skipped"] === "string") texts.push("没有需要新增处理的内容");
|
|
202
|
+
if (value["changed"] === false) texts.push("没有知识变更");
|
|
203
|
+
if (value["applied"] === true) texts.push("本地处理完成");
|
|
204
|
+
if (value["budgetLimited"] === true) texts.push("本次已按额度收尾;未完成项未执行,再次整理将读取当前知识");
|
|
205
|
+
const skipped = Array.isArray(value["skipped"]) ? value["skipped"].filter((id) => typeof id === "string") : [];
|
|
206
|
+
if (skipped.length > 0) texts.push(`跳过 ${skipped.length} 组`);
|
|
207
|
+
return {
|
|
208
|
+
counts,
|
|
209
|
+
entityIds,
|
|
210
|
+
summary: texts.join(";") || (result == null ? "尚无处理结果" : "处理完成,可能未产生新知识"),
|
|
211
|
+
warnings: warnings.success ? warnings.data : [],
|
|
212
|
+
incompleteCandidates: incomplete.success ? incomplete.data : [],
|
|
213
|
+
budgetLimited: value["budgetLimited"] === true
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
function emptyInbox(result) {
|
|
217
|
+
const value = publicResult(result);
|
|
218
|
+
return [
|
|
219
|
+
"pulled",
|
|
220
|
+
"accepted",
|
|
221
|
+
"acknowledged",
|
|
222
|
+
"applied",
|
|
223
|
+
"handled",
|
|
224
|
+
"uploadedClaims",
|
|
225
|
+
"reportedDisputes"
|
|
226
|
+
].every((key) => value[key] === 0) && Array.isArray(value["warnings"]) && value["warnings"].length === 0;
|
|
227
|
+
}
|
|
228
|
+
async function allActivities(knowledge, supports = (kind) => knowledge.jobs?.supports(kind) ?? true) {
|
|
229
|
+
const context = knowledge.context();
|
|
230
|
+
const presentation = await new PresentationStore(context).read();
|
|
231
|
+
const jobs = await new JobQueue(context).list();
|
|
232
|
+
const rows = await Promise.all(jobs.map(async (job) => {
|
|
233
|
+
const details = activityDetails(job.result);
|
|
234
|
+
let reportPath;
|
|
235
|
+
let phase;
|
|
236
|
+
if (job.kind === "dream") {
|
|
237
|
+
const progress = await knowledge.dreamStore().progress(job.id);
|
|
238
|
+
if (progress !== null) {
|
|
239
|
+
phase = progress.finished ? "finished" : progress.autonomy?.wrap_up === void 0 ? "exploration" : "wrap_up";
|
|
240
|
+
if (progress.autonomy !== void 0) {
|
|
241
|
+
details.counts["modelSteps"] = progress.autonomy.steps;
|
|
242
|
+
details.counts["wrapUpSteps"] = progress.autonomy.wrap_up?.steps ?? 0;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
const path = join(context.paths.dreamJob(job.id), "report.md");
|
|
246
|
+
try {
|
|
247
|
+
if ((await fs.lstat(path)).isFile()) reportPath = path;
|
|
248
|
+
} catch (error) {
|
|
249
|
+
if (!hasCode(error, "ENOENT")) throw error;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
const inactive = job.state === "queued" && !supports(job.kind);
|
|
253
|
+
if (job.kind === "dream" && job.state === "succeeded" && details.incompleteCandidates.length === 0) details.incompleteCandidates = (await knowledge.dreamStore().progress(job.id))?.entries.filter((entry) => entry.status === "skipped").map((entry) => ({
|
|
254
|
+
groupId: entry.candidate.group_id,
|
|
255
|
+
claimIds: entry.candidate.claim_ids,
|
|
256
|
+
reason: entry.reason ?? ""
|
|
257
|
+
})) ?? [];
|
|
258
|
+
return {
|
|
259
|
+
id: job.id,
|
|
260
|
+
kind: job.kind,
|
|
261
|
+
state: inactive || job.payload["paused"] === true ? "paused" : job.state,
|
|
262
|
+
attempts: job.attempts,
|
|
263
|
+
updatedAt: job.updatedAt,
|
|
264
|
+
unseen: !(job.kind === "inbox" && job.state === "succeeded" && emptyInbox(job.result)) && presentation !== null && job.updatedAt >= presentation.baselineAt && presentation.seen[job.id] !== job.updatedAt,
|
|
265
|
+
...job.sessionId === void 0 ? {} : { sessionId: job.sessionId },
|
|
266
|
+
...details,
|
|
267
|
+
...reportPath === void 0 ? {} : { reportPath },
|
|
268
|
+
...phase === void 0 ? {} : { phase },
|
|
269
|
+
requiresAttention: inactive || job.state === "failed" || job.payload["paused"] === true || details.warnings.length > 0 || details.incompleteCandidates.length > 0,
|
|
270
|
+
...inactive ? {
|
|
271
|
+
error: "对应后台组件未启用,请在插件管理中启用后等待任务继续。",
|
|
272
|
+
errorInfo: { code: "task.handler_inactive" }
|
|
273
|
+
} : job.lastError === void 0 ? {} : {
|
|
274
|
+
error: job.lastError,
|
|
275
|
+
errorInfo: messageInfo(job.lastError, job.lastErrorKind)
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
}));
|
|
279
|
+
const pending = await new UploadStore(context).read();
|
|
280
|
+
const status = await new DeliveryStatusStore(context).read();
|
|
281
|
+
for (const issue of Object.values(status.issues)) {
|
|
282
|
+
if (issue.reason === "rejected" || !(issue.kind === "claim" ? pending.claims : pending.disputes).some((item) => item.id === issue.id)) continue;
|
|
283
|
+
const waiting = issue.reason === "dependency";
|
|
284
|
+
const message = issue.reason === "version" ? "待投版本与本地不同。请查看当前知识,在团队会话中让 Agent 核对后通过正常修订或 Dream 同步复核重新共享。" : waiting ? "等待整合承接确认,依赖就绪后自动投递。" : issue.reason === "auth" ? "团队投递鉴权失败,请在 ACN 设置检查成员 ID 和团队鉴权密钥,再重试投递。" : "团队投递未完成。请检查团队地址、连接、权限和服务版本,再重试投递。";
|
|
285
|
+
rows.push({
|
|
286
|
+
id: `delivery-${issue.kind}-${issue.id}`,
|
|
287
|
+
kind: "delivery",
|
|
288
|
+
state: waiting ? "queued" : issue.reason === "version" ? "paused" : "failed",
|
|
289
|
+
attempts: issue.attempts,
|
|
290
|
+
updatedAt: issue.updatedAt,
|
|
291
|
+
entityId: issue.id,
|
|
292
|
+
summary: message,
|
|
293
|
+
summaryInfo: {
|
|
294
|
+
code: `delivery.${issue.reason}`,
|
|
295
|
+
entityId: issue.id,
|
|
296
|
+
...issue.status === void 0 ? {} : { status: issue.status }
|
|
297
|
+
},
|
|
298
|
+
requiresAttention: !waiting,
|
|
299
|
+
retryable: !waiting && issue.reason !== "version",
|
|
300
|
+
unseen: false
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
for (const [kind, items] of [["claim", pending.claims], ["dispute", pending.disputes]]) for (const item of items) {
|
|
304
|
+
if (status.issues[`${kind}-${item.id}`] !== void 0) continue;
|
|
305
|
+
rows.push({
|
|
306
|
+
id: `delivery-${kind}-${item.id}`,
|
|
307
|
+
kind: "delivery",
|
|
308
|
+
state: "queued",
|
|
309
|
+
entityId: item.id,
|
|
310
|
+
attempts: 0,
|
|
311
|
+
updatedAt: Date.parse("updated_at" in item ? item.updated_at ?? item.created_at : item.created_at),
|
|
312
|
+
unseen: false,
|
|
313
|
+
retryable: true,
|
|
314
|
+
summary: "等待后台团队投递。"
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
const target = knowledge.team === null ? "" : deliveryTarget(knowledge.config.team.maintainerEndpoint);
|
|
318
|
+
for (const [key, receipt] of Object.entries(status.delivered)) {
|
|
319
|
+
const id = key.replace(/^(claim|dispute)-/, "");
|
|
320
|
+
if (receipt.target !== target || !z.union([ClaimIdSchema, DisputeIdSchema]).safeParse(id).success) continue;
|
|
321
|
+
const source = rows.filter((row) => row.entityIds?.some((entityId) => entityId === id) && row.updatedAt <= (receipt.updatedAt ?? 0)).sort((a, b) => b.updatedAt - a.updatedAt)[0]?.sessionId;
|
|
322
|
+
rows.push({
|
|
323
|
+
id: `delivery-confirmed-${key}`,
|
|
324
|
+
kind: "delivery",
|
|
325
|
+
state: "succeeded",
|
|
326
|
+
entityId: id,
|
|
327
|
+
attempts: 0,
|
|
328
|
+
updatedAt: receipt.updatedAt ?? 0,
|
|
329
|
+
unseen: false,
|
|
330
|
+
retryable: false,
|
|
331
|
+
...source === void 0 ? {} : { sessionId: source },
|
|
332
|
+
summary: "此版本已收到团队投递确认。"
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
for (const [version, rejection] of Object.entries(await new RejectedDisputeStore(context).read(true))) {
|
|
336
|
+
const id = `delivery-rejected-${version}`;
|
|
337
|
+
const updatedAt = Date.parse(rejection.rejected_at);
|
|
338
|
+
const acknowledged = presentation?.seen[id] === updatedAt;
|
|
339
|
+
rows.push({
|
|
340
|
+
id,
|
|
341
|
+
kind: "delivery",
|
|
342
|
+
state: "rejected",
|
|
343
|
+
entityId: rejection.dispute_id,
|
|
344
|
+
attempts: rejection.attempts,
|
|
345
|
+
updatedAt,
|
|
346
|
+
unseen: false,
|
|
347
|
+
acknowledged,
|
|
348
|
+
requiresAttention: !acknowledged,
|
|
349
|
+
retryable: false,
|
|
350
|
+
summary: "团队拒绝此版本的争议(409),已停止自动重试,并未成功投递。请核对关联知识,由 Agent 根据当前版本形成新的争议。",
|
|
351
|
+
summaryInfo: {
|
|
352
|
+
code: "delivery.rejected",
|
|
353
|
+
entityId: rejection.dispute_id,
|
|
354
|
+
status: 409
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
const history = await historicalKnowledge(context);
|
|
359
|
+
for (const record of history.applications) rows.push({
|
|
360
|
+
id: `history-application-${record.id}`,
|
|
361
|
+
kind: record.kind,
|
|
362
|
+
state: record.state === "applied" ? "succeeded" : record.state === "prepared" ? "paused" : "cancelled",
|
|
363
|
+
attempts: record.attempts,
|
|
364
|
+
updatedAt: record.updatedAt,
|
|
365
|
+
unseen: false,
|
|
366
|
+
retryable: false,
|
|
367
|
+
requiresAttention: record.state === "prepared",
|
|
368
|
+
...record.sessionId === void 0 ? {} : { sessionId: record.sessionId },
|
|
369
|
+
entityIds: record.entityIds.flatMap((id) => {
|
|
370
|
+
const parsed = z.union([
|
|
371
|
+
ClaimIdSchema,
|
|
372
|
+
DisputeIdSchema,
|
|
373
|
+
TraceIdSchema
|
|
374
|
+
]).safeParse(id);
|
|
375
|
+
return parsed.success ? [parsed.data] : [];
|
|
376
|
+
}),
|
|
377
|
+
counts: {
|
|
378
|
+
claimCount: record.claimCount,
|
|
379
|
+
disputeCount: record.disputeCount,
|
|
380
|
+
traceCount: record.traceCount
|
|
381
|
+
},
|
|
382
|
+
summary: record.state === "applied" ? `更新 Claim: ${record.claimCount};形成争议: ${record.disputeCount};形成来源: ${record.traceCount}` : record.state === "prepared" ? "历史记录:原程序尚未完成本地提交,请先在原程序中完成处理。" : "历史记录:处理已取消。"
|
|
383
|
+
});
|
|
384
|
+
for (const record of history.deliveries) rows.push({
|
|
385
|
+
id: `history-delivery-${record.entity.kind}-${record.entity.value.id}-${record.updatedAt}`,
|
|
386
|
+
kind: "delivery",
|
|
387
|
+
state: "succeeded",
|
|
388
|
+
entityId: record.entity.value.id,
|
|
389
|
+
attempts: 0,
|
|
390
|
+
updatedAt: record.updatedAt,
|
|
391
|
+
sessionId: record.sessionId,
|
|
392
|
+
unseen: false,
|
|
393
|
+
retryable: false,
|
|
394
|
+
summary: "此版本已收到团队投递确认。"
|
|
395
|
+
});
|
|
396
|
+
return rows.sort((left, right) => right.updatedAt - left.updatedAt || left.id.localeCompare(right.id));
|
|
397
|
+
}
|
|
398
|
+
function activityPage(rows, options = {}) {
|
|
399
|
+
const matching = rows.filter((row) => (!options.attentionOnly || (row.requiresAttention ?? (row.state === "failed" || row.state === "paused"))) && (!options.sourceSession || row.sessionId === options.sourceSession) && (!options.kind || row.kind === options.kind) && (!options.state || row.state === options.state));
|
|
400
|
+
const offset = options.offset ?? 0;
|
|
401
|
+
return {
|
|
402
|
+
activities: matching.slice(offset, offset + 30),
|
|
403
|
+
activitiesOmitted: Math.max(0, matching.length - offset - 30)
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
//#endregion
|
|
407
|
+
export { messageInfo as a, commandMessage as i, allActivities as n, MessageInfoSchema as r, activityPage as t };
|