@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.
Files changed (276) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/LICENSE-APACHE +201 -0
  3. package/LICENSE-MIT +19 -0
  4. package/README.md +82 -2
  5. package/README_EN.md +83 -0
  6. package/cordis.patch.yml +29 -0
  7. package/docs/acn-compat.md +33 -0
  8. package/docs/architecture.md +130 -0
  9. package/docs/assets/acn-claim-reuse.png +0 -0
  10. package/docs/assets/activity-view.png +0 -0
  11. package/docs/assets/install-package.png +0 -0
  12. package/docs/assets/knowledge-model.png +0 -0
  13. package/docs/assets/knowledge-view.png +0 -0
  14. package/docs/assets/personal-configuration.png +0 -0
  15. package/docs/assets/session-upstream.png +0 -0
  16. package/docs/assets/upstream-settings.png +0 -0
  17. package/docs/assets/upstream-team.png +0 -0
  18. package/docs/command-reference.md +201 -0
  19. package/docs/config.md +253 -0
  20. package/docs/development.md +197 -0
  21. package/docs/dsh-compat.md +59 -0
  22. package/docs/index.md +16 -0
  23. package/docs/outstanding-issues.md +61 -0
  24. package/docs/user_guide.md +185 -0
  25. package/icon.svg +8 -0
  26. package/lib/activities-B8U-iW4-.js +407 -0
  27. package/lib/alignment-CwH0nBf-.js +80 -0
  28. package/lib/auth-DFI9yowX.js +71 -0
  29. package/lib/checkpoint-CPFPOxBM.js +188 -0
  30. package/lib/checkpoint-c7aI4D-X.js +318 -0
  31. package/lib/claim-DOAGe8ZK.js +168 -0
  32. package/lib/client.js +18417 -0
  33. package/lib/deliver-C-dmhkfm.js +168 -0
  34. package/lib/delivery-status-M7-Rwoyj.js +89 -0
  35. package/lib/dispute-CtrInHzf.js +20 -0
  36. package/lib/disputes-ByEmi43j.js +51 -0
  37. package/lib/dream-agent-BVqxbKFc.js +249 -0
  38. package/lib/dream.js +4 -0
  39. package/lib/effects-DX1iy6FM.js +268 -0
  40. package/lib/errors-Bp_2WXBr.js +19 -0
  41. package/lib/errors-pPumDOGD.js +18 -0
  42. package/lib/evidence-store-DW7kj20i.js +1030 -0
  43. package/lib/formation-D4LO31WW.js +187 -0
  44. package/lib/formation-replay-Bf4TSBiz.js +87 -0
  45. package/lib/formation.js +9 -0
  46. package/lib/history-DPMHX3ZE.js +214 -0
  47. package/lib/inbox-2CugZZQm.js +188 -0
  48. package/lib/inbox-DFtE2fOp.js +71 -0
  49. package/lib/inbox.js +3 -0
  50. package/lib/index.js +1373 -0
  51. package/lib/lock-DbmlKOoX.js +332 -0
  52. package/lib/pages-BEWC3kmZ.js +51 -0
  53. package/lib/paths-B7NI9Ano.js +157 -0
  54. package/lib/plugins/commands.js +590 -0
  55. package/lib/plugins/dream.js +66 -0
  56. package/lib/plugins/formation.js +66 -0
  57. package/lib/plugins/inbox.js +53 -0
  58. package/lib/plugins/knowledge.js +1109 -0
  59. package/lib/plugins/prompt.js +102 -0
  60. package/lib/plugins/tools.js +280 -0
  61. package/lib/policy-DnyHh7Bl.js +16 -0
  62. package/lib/prepare-CGXwBEcu.js +134 -0
  63. package/lib/protocol.js +8 -0
  64. package/lib/queue-M917xHPS.js +153 -0
  65. package/lib/regular-file-BFpqMoub.js +136 -0
  66. package/lib/render-CJaVcKKC.js +48 -0
  67. package/lib/reported-sets-DdEKdeVb.js +122 -0
  68. package/lib/revision-DeoL_IUN.js +11 -0
  69. package/lib/scheduler-BfJSY1eq.js +64 -0
  70. package/lib/service-BPwaZzFF.js +1106 -0
  71. package/lib/service-BQaszW_v.js +344 -0
  72. package/lib/service-BhniAHLo.js +305 -0
  73. package/lib/service-C2lXoygJ.js +505 -0
  74. package/lib/session-binding-zCSuizHs.js +342 -0
  75. package/lib/session-state-CYqUhC95.js +38 -0
  76. package/lib/sessions-C2xuPFQv.js +218 -0
  77. package/lib/store.js +16 -0
  78. package/lib/structured-C9byFuzm.js +453 -0
  79. package/lib/subagent-yJsFxHmH.js +9 -0
  80. package/lib/team.js +3 -0
  81. package/lib/tool-schema-3b4gH1zf.js +28 -0
  82. package/lib/trace-Da0RnL5R.js +14 -0
  83. package/lib/traces-CHBo8y1z.js +11 -0
  84. package/lib/types/activities.d.ts +73 -0
  85. package/lib/types/advanced-configuration.d.ts +11 -0
  86. package/lib/types/client/ActivityCard.d.ts +14 -0
  87. package/lib/types/client/ActivityDetails.d.ts +18 -0
  88. package/lib/types/client/AdvancedPreferences.d.ts +8 -0
  89. package/lib/types/client/BlankCommandFeedback.d.ts +10 -0
  90. package/lib/types/client/ComposerMenu.d.ts +24 -0
  91. package/lib/types/client/ConfigurationPage.d.ts +11 -0
  92. package/lib/types/client/ConnectionCheckDialog.d.ts +12 -0
  93. package/lib/types/client/KnowledgeDetail.d.ts +6 -0
  94. package/lib/types/client/KnowledgeDirectoryField.d.ts +11 -0
  95. package/lib/types/client/KnowledgePanel.d.ts +12 -0
  96. package/lib/types/client/KnowledgeReference.d.ts +13 -0
  97. package/lib/types/client/SessionToolbar.d.ts +16 -0
  98. package/lib/types/client/SettingsToast.d.ts +3 -0
  99. package/lib/types/client/SourceSessionLink.d.ts +16 -0
  100. package/lib/types/client/TeamCredentialField.d.ts +16 -0
  101. package/lib/types/client/TeamSettingsPage.d.ts +28 -0
  102. package/lib/types/client/configuration-errors.d.ts +2 -0
  103. package/lib/types/client/interaction-styles.d.ts +1 -0
  104. package/lib/types/client/interaction-ui.d.ts +30 -0
  105. package/lib/types/client/knowledge-labels.d.ts +5 -0
  106. package/lib/types/client/locales.d.ts +51 -0
  107. package/lib/types/commands/claim.d.ts +4 -0
  108. package/lib/types/commands/import.d.ts +10 -0
  109. package/lib/types/commands/status.d.ts +5 -0
  110. package/lib/types/config.d.ts +111 -0
  111. package/lib/types/configuration.d.ts +235 -0
  112. package/lib/types/credentials.d.ts +59 -0
  113. package/lib/types/dream/audit.d.ts +4 -0
  114. package/lib/types/dream/autonomous.d.ts +185 -0
  115. package/lib/types/dream/candidates.d.ts +34 -0
  116. package/lib/types/dream/checkpoint.d.ts +35 -0
  117. package/lib/types/dream/evidence-files.d.ts +10 -0
  118. package/lib/types/dream/evidence-store.d.ts +103 -0
  119. package/lib/types/dream/evidence.d.ts +30 -0
  120. package/lib/types/dream/index.d.ts +10 -0
  121. package/lib/types/dream/plan.d.ts +18 -0
  122. package/lib/types/dream/preservation.d.ts +6 -0
  123. package/lib/types/dream/review.d.ts +10 -0
  124. package/lib/types/dream/schema.d.ts +1475 -0
  125. package/lib/types/dream/service.d.ts +56 -0
  126. package/lib/types/dream/sync.d.ts +147 -0
  127. package/lib/types/dsh-adapter/configuration-remote.d.ts +1 -0
  128. package/lib/types/dsh-adapter/configuration-service.d.ts +28 -0
  129. package/lib/types/dsh-adapter/dream-agent.d.ts +4 -0
  130. package/lib/types/dsh-adapter/dream-evidence.d.ts +3 -0
  131. package/lib/types/dsh-adapter/formation-archive.d.ts +3 -0
  132. package/lib/types/dsh-adapter/formation-replay.d.ts +5 -0
  133. package/lib/types/dsh-adapter/formation.d.ts +4 -0
  134. package/lib/types/dsh-adapter/interaction-service.d.ts +13 -0
  135. package/lib/types/dsh-adapter/knowledge-paths.d.ts +3 -0
  136. package/lib/types/dsh-adapter/llm.d.ts +10 -0
  137. package/lib/types/dsh-adapter/project-upstream.d.ts +4 -0
  138. package/lib/types/dsh-adapter/runtime-pool.d.ts +110 -0
  139. package/lib/types/dsh-adapter/session-binding.d.ts +43 -0
  140. package/lib/types/dsh-adapter/source-sessions.d.ts +3 -0
  141. package/lib/types/dsh-adapter/team-credentials.d.ts +5 -0
  142. package/lib/types/dsh-adapter/tool-schema.d.ts +4 -0
  143. package/lib/types/dsh-adapter/tools.d.ts +5 -0
  144. package/lib/types/formation/capture.d.ts +19 -0
  145. package/lib/types/formation/checkpoint.d.ts +136 -0
  146. package/lib/types/formation/index.d.ts +10 -0
  147. package/lib/types/formation/prepare.d.ts +16 -0
  148. package/lib/types/formation/schema.d.ts +45 -0
  149. package/lib/types/formation/service.d.ts +58 -0
  150. package/lib/types/formation/transcript.d.ts +75 -0
  151. package/lib/types/formation/triggers.d.ts +3 -0
  152. package/lib/types/inbox/cascade.d.ts +3 -0
  153. package/lib/types/inbox/effects.d.ts +275 -0
  154. package/lib/types/inbox/index.d.ts +5 -0
  155. package/lib/types/inbox/prepare.d.ts +380 -0
  156. package/lib/types/inbox/service.d.ts +26 -0
  157. package/lib/types/inbox/sync.d.ts +9 -0
  158. package/lib/types/index.d.ts +1 -0
  159. package/lib/types/interaction-messages.d.ts +69 -0
  160. package/lib/types/interaction.d.ts +541 -0
  161. package/lib/types/knowledge/alignment.d.ts +49 -0
  162. package/lib/types/knowledge/catalog.d.ts +5 -0
  163. package/lib/types/knowledge/changes.d.ts +32 -0
  164. package/lib/types/knowledge/disputes.d.ts +3 -0
  165. package/lib/types/knowledge/errors.d.ts +9 -0
  166. package/lib/types/knowledge/ordering.d.ts +7 -0
  167. package/lib/types/knowledge/pages.d.ts +7 -0
  168. package/lib/types/knowledge/safety.d.ts +2 -0
  169. package/lib/types/knowledge/service.d.ts +52 -0
  170. package/lib/types/knowledge/sessions.d.ts +59 -0
  171. package/lib/types/knowledge/sources.d.ts +2 -0
  172. package/lib/types/knowledge/timestamps.d.ts +1 -0
  173. package/lib/types/knowledge/types.d.ts +84 -0
  174. package/lib/types/llm/response.d.ts +1 -0
  175. package/lib/types/llm/structured.d.ts +27 -0
  176. package/lib/types/local-name.d.ts +1 -0
  177. package/lib/types/plugins/client.d.ts +9 -0
  178. package/lib/types/plugins/commands.d.ts +11 -0
  179. package/lib/types/plugins/configuration.d.ts +8 -0
  180. package/lib/types/plugins/dream.d.ts +16 -0
  181. package/lib/types/plugins/formation.d.ts +16 -0
  182. package/lib/types/plugins/inbox.d.ts +16 -0
  183. package/lib/types/plugins/knowledge.d.ts +19 -0
  184. package/lib/types/plugins/prompt.d.ts +17 -0
  185. package/lib/types/plugins/tools.d.ts +10 -0
  186. package/lib/types/prompt/render.d.ts +2 -0
  187. package/lib/types/protocol/arbitration.d.ts +154 -0
  188. package/lib/types/protocol/auth.d.ts +31 -0
  189. package/lib/types/protocol/claim.d.ts +36 -0
  190. package/lib/types/protocol/dispute.d.ts +17 -0
  191. package/lib/types/protocol/ids.d.ts +20 -0
  192. package/lib/types/protocol/inbox.d.ts +141 -0
  193. package/lib/types/protocol/index.d.ts +11 -0
  194. package/lib/types/protocol/policy.d.ts +21 -0
  195. package/lib/types/protocol/revision.d.ts +2 -0
  196. package/lib/types/protocol/router.d.ts +114 -0
  197. package/lib/types/protocol/schema.d.ts +4 -0
  198. package/lib/types/protocol/time.d.ts +5 -0
  199. package/lib/types/protocol/trace.d.ts +11 -0
  200. package/lib/types/store/atomic.d.ts +8 -0
  201. package/lib/types/store/claim-edits.d.ts +33 -0
  202. package/lib/types/store/claims.d.ts +7 -0
  203. package/lib/types/store/context.d.ts +13 -0
  204. package/lib/types/store/delivery-status.d.ts +48 -0
  205. package/lib/types/store/disputes.d.ts +6 -0
  206. package/lib/types/store/entities.d.ts +16 -0
  207. package/lib/types/store/errors.d.ts +8 -0
  208. package/lib/types/store/history.d.ts +65 -0
  209. package/lib/types/store/inbox.d.ts +27 -0
  210. package/lib/types/store/index.d.ts +16 -0
  211. package/lib/types/store/jobs.d.ts +5 -0
  212. package/lib/types/store/library-directory.d.ts +4 -0
  213. package/lib/types/store/lock.d.ts +11 -0
  214. package/lib/types/store/path-names.d.ts +2 -0
  215. package/lib/types/store/paths.d.ts +45 -0
  216. package/lib/types/store/presentation.d.ts +13 -0
  217. package/lib/types/store/regular-file.d.ts +2 -0
  218. package/lib/types/store/rejected-disputes.d.ts +18 -0
  219. package/lib/types/store/rename.d.ts +1 -0
  220. package/lib/types/store/reported-sets.d.ts +24 -0
  221. package/lib/types/store/session-state.d.ts +17 -0
  222. package/lib/types/store/traces.d.ts +6 -0
  223. package/lib/types/store/uploads.d.ts +312 -0
  224. package/lib/types/store/yaml.d.ts +8 -0
  225. package/lib/types/team/errors.d.ts +10 -0
  226. package/lib/types/team/http.d.ts +20 -0
  227. package/lib/types/team/index.d.ts +5 -0
  228. package/lib/types/team/maintainer-client.d.ts +18 -0
  229. package/lib/types/team/router-client.d.ts +14 -0
  230. package/lib/types/team/service.d.ts +28 -0
  231. package/lib/types/team/system-proxy.d.ts +9 -0
  232. package/lib/types/tools/claim.d.ts +63 -0
  233. package/lib/types/tools/consult-router.d.ts +11 -0
  234. package/lib/types/tools/subagent.d.ts +8 -0
  235. package/lib/types/tools/validation.d.ts +2 -0
  236. package/lib/types/upload/consolidation.d.ts +63 -0
  237. package/lib/types/upload/deliver.d.ts +15 -0
  238. package/lib/types/upload/index.d.ts +2 -0
  239. package/lib/types/upload/scheduler.d.ts +19 -0
  240. package/lib/types/upstreams.d.ts +5 -0
  241. package/lib/types/worker/queue.d.ts +17 -0
  242. package/lib/types/worker/types.d.ts +51 -0
  243. package/lib/types/worker/worker.d.ts +39 -0
  244. package/lib/types-C2ST2Zdg.js +17 -0
  245. package/lib/upload.js +3 -0
  246. package/lib/uploads-BCA2p92b.js +210 -0
  247. package/lib/upstreams-DEi-56tD.js +495 -0
  248. package/lib/worker-HMGzJFWd.js +185 -0
  249. package/locale/commands/en.json +1 -0
  250. package/locale/commands/zh.json +1 -0
  251. package/locale/dream/en.json +1 -0
  252. package/locale/dream/zh.json +1 -0
  253. package/locale/en.json +7 -0
  254. package/locale/formation/en.json +1 -0
  255. package/locale/formation/zh.json +1 -0
  256. package/locale/inbox/en.json +1 -0
  257. package/locale/inbox/zh.json +1 -0
  258. package/locale/knowledge/en.json +1 -0
  259. package/locale/knowledge/zh.json +1 -0
  260. package/locale/prompt/en.json +1 -0
  261. package/locale/prompt/zh.json +1 -0
  262. package/locale/tools/en.json +1 -0
  263. package/locale/tools/zh.json +1 -0
  264. package/locale/zh.json +7 -0
  265. package/package.json +262 -3
  266. package/prompts/claim_dream.j2 +77 -0
  267. package/prompts/claim_dream_legacy.j2 +63 -0
  268. package/prompts/dream_compaction.j2 +11 -0
  269. package/prompts/dream_evidence.j2 +5 -0
  270. package/prompts/inbox_claim_attribute_update_internalize.j2 +112 -0
  271. package/prompts/inbox_policy_update_internalize.j2 +87 -0
  272. package/prompts/knowledge.j2 +38 -0
  273. package/prompts/session_recap.j2 +113 -0
  274. package/prompts/what_is_claim.j2 +51 -0
  275. package/prompts/what_is_dispute.j2 +21 -0
  276. package/prompts/what_is_policy.j2 +22 -0
@@ -0,0 +1,590 @@
1
+ import { h as TraceIdSchema, l as ClaimIdSchema, t as ClaimSchema } from "../claim-DOAGe8ZK.js";
2
+ import { n as RevisionConflict, t as KnowledgeError } from "../errors-Bp_2WXBr.js";
3
+ import { n as validateClaimText, t as openSingleFile } from "../regular-file-BFpqMoub.js";
4
+ import { _ as JobError, i as decodeYaml, n as withFileLock, p as writeTextAtomicIfAbsent, w as hasCode } from "../lock-DbmlKOoX.js";
5
+ import { t as TraceSchema } from "../trace-Da0RnL5R.js";
6
+ import { r as UploadStore } from "../uploads-BCA2p92b.js";
7
+ import { _ as unboundSession, f as sessionChanged, r as configurationBusy } from "../session-binding-zCSuizHs.js";
8
+ import { r as expandHomePath } from "../paths-B7NI9Ano.js";
9
+ import { n as isSubagent } from "../subagent-yJsFxHmH.js";
10
+ import { t as JobQueue } from "../queue-M917xHPS.js";
11
+ import { i as commandMessage, n as allActivities } from "../activities-B8U-iW4-.js";
12
+ import { z } from "zod";
13
+ import fs from "node:fs/promises";
14
+ import { basename, isAbsolute, join, relative, resolve, sep } from "node:path";
15
+ //#region src/commands/claim.ts
16
+ function commandWords(input, literalBackslashes = false) {
17
+ const words = [];
18
+ let current = "";
19
+ let quote;
20
+ let escaped = false;
21
+ let started = false;
22
+ for (const char of input) if (escaped) {
23
+ current += char;
24
+ escaped = false;
25
+ started = true;
26
+ } else if (char === "\\" && !literalBackslashes) {
27
+ escaped = true;
28
+ started = true;
29
+ } else if (quote !== void 0) if (char === quote) quote = void 0;
30
+ else current += char;
31
+ else if (char === "\"" || char === "'") {
32
+ quote = char;
33
+ started = true;
34
+ } else if (/\s/u.test(char)) {
35
+ if (started) words.push(current);
36
+ current = "";
37
+ started = false;
38
+ } else {
39
+ current += char;
40
+ started = true;
41
+ }
42
+ if (quote !== void 0 || escaped) throw new KnowledgeError("validation", "Unclosed command quote or escape.");
43
+ if (started) words.push(current);
44
+ return words;
45
+ }
46
+ async function claimCommand(knowledge, input, readOnly, signal) {
47
+ const words = commandWords(input.trim());
48
+ const action = words[0];
49
+ if (action === "show") {
50
+ if (words.length !== 2) throw new KnowledgeError("validation", "Usage: /claim show <id>");
51
+ return JSON.stringify(await knowledge.readClaim(ClaimIdSchema.parse(words[1])), null, 2);
52
+ }
53
+ if (action === "set") {
54
+ if (readOnly) throw new KnowledgeError("ownership", "Subagents cannot modify ACN knowledge.");
55
+ if (words.length < 3) throw new KnowledgeError("validation", "Usage: /claim set <id> <field>=<value> ...");
56
+ const id = ClaimIdSchema.parse(words[1]);
57
+ const fields = {};
58
+ for (const word of words.slice(2)) {
59
+ const separator = word.indexOf("=");
60
+ const field = word.slice(0, separator);
61
+ if (separator < 1 || ![
62
+ "name",
63
+ "statement",
64
+ "scope",
65
+ "evidence_summary",
66
+ "confidence",
67
+ "status"
68
+ ].includes(field) || field in fields) throw new KnowledgeError("validation", "Use each editable Claim field at most once.");
69
+ fields[field] = word.slice(separator + 1);
70
+ }
71
+ const detail = await knowledge.readClaim(id);
72
+ return JSON.stringify(await knowledge.updateClaim({
73
+ ...fields,
74
+ id,
75
+ expected_revision: detail.revision
76
+ }, signal), null, 2);
77
+ }
78
+ const query = [];
79
+ let offset = 0;
80
+ let limit = 20;
81
+ let includeDeprecated = false;
82
+ const listWords = action === "list" ? words.slice(1) : words;
83
+ for (let index = 0; index < listWords.length; index += 1) {
84
+ const word = listWords[index];
85
+ if (word === "--include-deprecated") includeDeprecated = true;
86
+ else if (word === "--offset" || word === "--limit") {
87
+ const number = Number(listWords[index + 1]);
88
+ if (word === "--offset") offset = number;
89
+ else limit = number;
90
+ index += 1;
91
+ } else if (word !== void 0 && word.startsWith("--")) throw new KnowledgeError("validation", "Unknown Claim list option.");
92
+ else if (word !== void 0) query.push(word);
93
+ }
94
+ const result = await knowledge.listClaims({
95
+ query: query.join(" "),
96
+ offset,
97
+ limit,
98
+ includeDeprecated
99
+ });
100
+ const rows = result.items.map((item) => `${item.id} | ${JSON.stringify(item.name.text)} | ${JSON.stringify(item.scope.text)} | ${item.confidence} | ${item.status}`);
101
+ if (rows.length === 0) rows.push("没有匹配的 Claim。");
102
+ if (result.next_offset !== null) rows.push(`另有 ${result.omitted} 条;下一页:/claim list ${JSON.stringify(query.join(" "))} --offset ${result.next_offset} --limit ${result.limit}${includeDeprecated ? " --include-deprecated" : ""}`);
103
+ return rows.join("\n");
104
+ }
105
+ function commandDomainError(error) {
106
+ if (error instanceof RevisionConflict) return `Claim 已改变,请重新读取。当前 revision: ${error.currentRevision}`;
107
+ if (error instanceof KnowledgeError) return error.message;
108
+ }
109
+ //#endregion
110
+ //#region src/commands/status.ts
111
+ async function statusCommand(knowledge, options = {}) {
112
+ if (!knowledge.configured) return "ACN 未配置。打开 DSH「设置 → ACN 插件设置 → 工作配置」,新建配置并填写 Agent ID;保存后生效,无需手改 YAML 或重启。\nACN is not configured. Open DSH Settings → ACN settings → Work configurations, create a work configuration, enter an Agent ID, and save it. Advanced/headless setup: see docs/config.md.";
113
+ const claims = await knowledge.listClaims({
114
+ includeDeprecated: true,
115
+ limit: 100
116
+ });
117
+ const traces = await knowledge.listTraces({ limit: 100 });
118
+ const queue = await new UploadStore(knowledge.context()).read();
119
+ const jobs = await new JobQueue(knowledge.context()).list();
120
+ const activities = await allActivities(knowledge);
121
+ const paused = new Set(activities.filter((item) => item.state === "paused").map((item) => item.id));
122
+ const outstanding = (job) => job.state === "failed" || job.payload["paused"] === true || paused.has(job.id);
123
+ const sorted = jobs.filter((job) => !options.failed || outstanding(job)).sort((a, b) => Number(outstanding(b)) - Number(outstanding(a)) || b.updatedAt - a.updatedAt || a.id.localeCompare(b.id));
124
+ const page = options.page ?? 1;
125
+ const shown = sorted.slice((page - 1) * 10, page * 10);
126
+ const team = knowledge.teamStatus();
127
+ const deliveries = activities.filter((item) => item.kind === "delivery" && item.requiresAttention);
128
+ return [
129
+ `ACN: ${knowledge.mode}`,
130
+ `agentId: ${knowledge.agentId}`,
131
+ `数据目录 / Data directory: ${knowledge.context().paths.root}`,
132
+ `Claim: ${claims.items.length + claims.omitted}`,
133
+ `Trace: ${traces.items.length + traces.omitted}`,
134
+ `待上传 / Pending Claim: ${queue.claims.length}; Dispute: ${queue.disputes.length}`,
135
+ knowledge.mode === "solo" ? "团队连接: 单人模式,不请求团队服务。 / Solo: no team requests." : `团队连接 / Team: Router=${team.router.state}; Maintainer=${team.maintainer.state}`,
136
+ ...[team.router.error, team.maintainer.error].filter((error) => error !== void 0),
137
+ `后台任务 / Tasks: queued=${jobs.filter((job) => job.state === "queued").length} running=${jobs.filter((job) => job.state === "running").length} failed=${jobs.filter((job) => job.state === "failed").length}`,
138
+ `页 / Page ${page}/${Math.max(1, Math.ceil(sorted.length / 10))}; ${options.failed ? "失败与暂停 / Failed and paused" : "未解决任务优先 / Unresolved tasks first"}`,
139
+ ...shown.map((job) => `${job.id} ${job.kind} ${job.state} attempts=${job.attempts}${job.payload["paused"] === true || paused.has(job.id) ? " — 已暂停 / paused" : ""}${job.lastError === void 0 ? "" : ` — ${job.lastError}`}`),
140
+ ...sorted.length > page * 10 ? [`下一页 / Next: /acn-status ${options.failed ? "failed" : "all"} ${page + 1}`] : [],
141
+ ...jobs.some(outstanding) ? ["查看全部失败与暂停 / List failures: /acn-status failed [page]", "重试任务 / Retry: /acn-status retry <job_id>"] : [],
142
+ ...deliveries.length === 0 ? [] : [`团队投递异常 / Delivery issues: ${deliveries.length}. 打开 ACN「知识与活动」查看实体 ID、原因和恢复操作。 / Open ACN Knowledge and activity for entity IDs and recovery actions.`]
143
+ ].join("\n");
144
+ }
145
+ //#endregion
146
+ //#region src/commands/import.ts
147
+ const MAX_FILE_BYTES = 16 * 1024 * 1024;
148
+ function invalid(message) {
149
+ throw new KnowledgeError("validation", message);
150
+ }
151
+ function stamp(info) {
152
+ return `${info.dev}:${info.ino}:${info.size}:${info.mtimeMs}:${info.ctimeMs}`;
153
+ }
154
+ async function directory(path, required = false) {
155
+ try {
156
+ const info = await fs.lstat(path);
157
+ if (!info.isDirectory() || info.isSymbolicLink()) invalid("Import directories must be regular directories, without symbolic links.");
158
+ return true;
159
+ } catch (error) {
160
+ if (!required && hasCode(error, "ENOENT")) return false;
161
+ throw error;
162
+ }
163
+ }
164
+ async function readSource(path) {
165
+ const file = await openSingleFile(path, () => new KnowledgeError("validation", "Import accepts single-link regular UTF-8 files without symbolic links."));
166
+ try {
167
+ const before = await file.stat();
168
+ if (!before.isFile() || before.nlink !== 1 || before.size > MAX_FILE_BYTES) invalid("Import accepts single-link regular UTF-8 files up to 16 MiB.");
169
+ let text;
170
+ try {
171
+ text = new TextDecoder("utf-8", {
172
+ fatal: true,
173
+ ignoreBOM: true
174
+ }).decode(await file.readFile());
175
+ } catch (error) {
176
+ if (error instanceof TypeError) invalid("Import source is not valid UTF-8.");
177
+ throw error;
178
+ }
179
+ const snapshot = stamp(before);
180
+ if (snapshot !== stamp(await file.stat())) invalid("Import source changed while reading; stop source writers and retry.");
181
+ return {
182
+ path,
183
+ text,
184
+ stamp: snapshot
185
+ };
186
+ } finally {
187
+ await file.close();
188
+ }
189
+ }
190
+ async function entities(root, name, schema, idSchema) {
191
+ const path = join(root, name);
192
+ if (!await directory(path)) return [];
193
+ const values = [];
194
+ for (const entry of (await fs.readdir(path)).sort()) {
195
+ if (!entry.endsWith(".yaml") || entry.includes(".tmp.")) continue;
196
+ const id = entry.slice(0, -5);
197
+ if (!idSchema.safeParse(id).success) invalid(`Invalid ${name} filename in import source.`);
198
+ const file = await readSource(join(path, entry));
199
+ let value;
200
+ try {
201
+ value = decodeYaml(schema, file.text);
202
+ } catch {
203
+ invalid(`Invalid ${name} document in import source.`);
204
+ }
205
+ if (value.id !== id) invalid(`Import ${name} ID differs from its filename.`);
206
+ values.push({
207
+ file,
208
+ value
209
+ });
210
+ }
211
+ return values;
212
+ }
213
+ function inside(parent, child) {
214
+ const path = relative(parent, child);
215
+ return path === "" || !path.startsWith(`..${sep}`) && path !== ".." && !isAbsolute(path);
216
+ }
217
+ function importWords(input, platform = process.platform) {
218
+ if (platform !== "win32") return commandWords(input);
219
+ const words = [];
220
+ let offset = 0;
221
+ while (offset < input.length) {
222
+ if (/\s/u.test(input[offset] ?? "")) {
223
+ offset += 1;
224
+ continue;
225
+ }
226
+ const quote = input[offset];
227
+ if (quote === "\"" || quote === "'") {
228
+ const end = input.indexOf(quote, offset + 1);
229
+ if (end === -1 || end + 1 < input.length && !/\s/u.test(input[end + 1] ?? "")) invalid("Unclosed or invalid import path quote.");
230
+ let word = input.slice(offset + 1, end);
231
+ if (quote === "\"" && /^(?:[^\\]|\\\\)*$/.test(word) && (!word.startsWith("\\\\") || word.startsWith("\\\\\\\\"))) try {
232
+ const decoded = JSON.parse(input.slice(offset, end + 1));
233
+ if (typeof decoded === "string") word = decoded;
234
+ } catch {}
235
+ words.push(word);
236
+ offset = end + 1;
237
+ } else {
238
+ const end = input.slice(offset).search(/\s/u);
239
+ const length = end === -1 ? input.length - offset : end;
240
+ words.push(input.slice(offset, offset + length));
241
+ offset += length;
242
+ }
243
+ }
244
+ return words;
245
+ }
246
+ async function importCommand(knowledge, input, readOnly, signal) {
247
+ if (readOnly) throw new KnowledgeError("ownership", "Subagents cannot import private knowledge.");
248
+ const words = importWords(input);
249
+ const options = new Set(words.filter((word) => word.startsWith("--")));
250
+ const paths = words.filter((word) => !word.startsWith("--"));
251
+ if (paths.length !== 1 || paths[0] === "" || [...options].some((option) => !["--dry-run"].includes(option))) invalid("Usage: /acn-import [--dry-run] <acn_agent_home>");
252
+ const source = resolve(expandHomePath(paths[0] ?? ""));
253
+ await directory(source, true);
254
+ const context = knowledge.context();
255
+ const canonical = await fs.realpath(source);
256
+ async function actual(path) {
257
+ try {
258
+ return await fs.realpath(path);
259
+ } catch (error) {
260
+ if (!hasCode(error, "ENOENT")) throw error;
261
+ const parent = resolve(path, "..");
262
+ if (parent === path) throw error;
263
+ return join(await actual(parent), basename(path));
264
+ }
265
+ }
266
+ const target = await actual(context.paths.root);
267
+ if (inside(canonical, target) || inside(target, canonical)) invalid("Import source and target must be separate directories.");
268
+ const claims = await entities(source, "claims", ClaimSchema, ClaimIdSchema);
269
+ const traces = await entities(source, "traces", TraceSchema, TraceIdSchema);
270
+ for (const { value } of claims) {
271
+ if (value.holder !== context.agentId) throw new KnowledgeError("ownership", "Import contains a Claim held by another agent.");
272
+ validateClaimText({
273
+ name: value.name,
274
+ statement: value.statement,
275
+ scope: value.scope,
276
+ evidence_summary: value.evidence_summary
277
+ });
278
+ }
279
+ for (const { value } of traces) if (value.agent !== context.agentId) throw new KnowledgeError("ownership", "Import contains a Trace owned by another agent.");
280
+ const allFiles = [...claims.map((item) => item.file), ...traces.map((item) => item.file)];
281
+ if (allFiles.length === 0) invalid("No importable data found. Pass the agent directory containing claims/ or traces/.");
282
+ for (const file of allFiles) if (file.stamp !== stamp(await fs.lstat(file.path))) invalid("Import source changed; stop source writers and retry.");
283
+ const report = {
284
+ dryRun: options.has("--dry-run"),
285
+ claims: [],
286
+ traces: [],
287
+ skipped: []
288
+ };
289
+ const publish = async (path, text) => {
290
+ if (!report.dryRun) return writeTextAtomicIfAbsent(path, text, context.logger);
291
+ try {
292
+ await fs.lstat(path);
293
+ return false;
294
+ } catch (error) {
295
+ if (hasCode(error, "ENOENT")) return true;
296
+ throw error;
297
+ }
298
+ };
299
+ const apply = async () => {
300
+ for (const name of ["claims", "traces"]) await directory(join(context.paths.root, name));
301
+ for (const [items, category] of [[claims, "claims"], [traces, "traces"]]) for (const { file, value } of items) {
302
+ signal?.throwIfAborted();
303
+ const created = await publish(join(context.paths[category], `${value.id}.yaml`), file.text);
304
+ (created ? report[category] : report.skipped).push(created ? value.id : `${category}/${value.id}`);
305
+ }
306
+ };
307
+ if (report.dryRun) await apply();
308
+ else {
309
+ await knowledge.initialize();
310
+ await withFileLock(context.paths.knowledgeLock, apply, {
311
+ signal,
312
+ timeoutMs: context.lockTimeoutMs
313
+ });
314
+ }
315
+ return report;
316
+ }
317
+ function renderImportReport(report) {
318
+ return `${report.dryRun ? "导入预览(未写入)" : "导入完成"}:Claim ${report.claims.length};Trace ${report.traces.length}。\n${report.skipped.length === 0 ? "没有冲突。" : `已跳过 ${report.skipped.length} 个已有目标:${report.skipped.join(", ")}`}\n源目录保持只读;导入不会加入团队上传队列。`;
319
+ }
320
+ //#endregion
321
+ //#region src/plugins/commands.ts
322
+ const name = "acn-commands";
323
+ const inject = [
324
+ "acnKnowledge",
325
+ "acnRuntime",
326
+ "commands",
327
+ "sessions"
328
+ ];
329
+ function apply(ctx) {
330
+ const knowledge = ctx.acnKnowledge;
331
+ const pool = ctx.acnRuntime;
332
+ let applying = () => false;
333
+ ctx.inject(["acnConfiguration"], (child) => {
334
+ const service = child.acnConfiguration;
335
+ applying = () => service.pending > 0;
336
+ child.effect(() => () => {
337
+ applying = () => false;
338
+ });
339
+ });
340
+ const denied = (agent) => {
341
+ if (applying()) return configurationBusy;
342
+ return pool.allowed(agent.session.header) ? void 0 : pool.unbound(agent.session.header) ? unboundSession : sessionChanged;
343
+ };
344
+ ctx.commands.register({
345
+ name: "acn-status",
346
+ description: "Show ACN status or retry a failed job.",
347
+ input: { hint: "[failed [page] | all [page] | retry <job_id>]" },
348
+ handler: async ({ agent, rawInput }) => {
349
+ const reason = denied(agent);
350
+ if (reason !== void 0) return {
351
+ kind: "error",
352
+ text: commandMessage(reason)
353
+ };
354
+ const knowledge = await pool.knowledge(agent.session.header);
355
+ const parts = rawInput.trim().split(/\s+/);
356
+ if (rawInput.trim() === "") return {
357
+ kind: "success",
358
+ text: await statusCommand(knowledge)
359
+ };
360
+ if (["failed", "all"].includes(parts[0] ?? "") && parts.length <= 2 && (parts[1] === void 0 || /^[1-9][0-9]*$/.test(parts[1]))) {
361
+ const page = Number(parts[1] ?? 1);
362
+ if (Number.isSafeInteger(page)) return {
363
+ kind: "success",
364
+ text: await statusCommand(knowledge, {
365
+ failed: parts[0] === "failed",
366
+ page
367
+ })
368
+ };
369
+ }
370
+ if (parts.length !== 2 || parts[0] !== "retry" || !/^[a-zA-Z0-9_-]+$/.test(parts[1] ?? "")) return {
371
+ kind: "error",
372
+ text: "用法 / Usage: /acn-status [failed [page] | all [page] | retry <job_id>]"
373
+ };
374
+ if (isSubagent(agent.session.header)) return {
375
+ kind: "error",
376
+ text: "子 agent 不能重试知识形成任务。"
377
+ };
378
+ const worker = knowledge.jobs;
379
+ if (worker === null) return {
380
+ kind: "error",
381
+ text: "请先配置 agentId。"
382
+ };
383
+ try {
384
+ const current = await worker.queue.read(parts[1] ?? "");
385
+ if (current !== null && !worker.supports(current.kind)) throw new JobError("handler_inactive", "对应后台组件未启用,请在插件管理中启用后重试。");
386
+ if (current?.kind === "dream" && current.payload["paused"] === true && current.state !== "failed") {
387
+ await worker.queue.pauseDream(false);
388
+ worker.wake(true);
389
+ return {
390
+ kind: "success",
391
+ text: commandMessage(`Dream 已恢复:${current.id}`)
392
+ };
393
+ }
394
+ return {
395
+ kind: "success",
396
+ text: `任务已重新入队:${(await worker.retry(parts[1] ?? "")).id}`
397
+ };
398
+ } catch (error) {
399
+ if (error instanceof JobError) return {
400
+ kind: "error",
401
+ text: commandMessage(error.message, error.kind)
402
+ };
403
+ throw error;
404
+ }
405
+ }
406
+ });
407
+ if (!knowledge.configured && knowledge.config.upstreams === void 0) return;
408
+ ctx.commands.register({
409
+ name: "acn-import",
410
+ description: "Import owned knowledge from a separate read-only agent directory.",
411
+ input: { hint: "[--dry-run] <acn_agent_home>" },
412
+ handler: async ({ agent, rawInput, signal }) => {
413
+ const reason = denied(agent);
414
+ if (reason !== void 0) return {
415
+ kind: "error",
416
+ text: commandMessage(reason)
417
+ };
418
+ const knowledge = await pool.knowledge(agent.session.header);
419
+ try {
420
+ return {
421
+ kind: "success",
422
+ text: renderImportReport(await importCommand(knowledge, rawInput, isSubagent(agent.session.header), signal))
423
+ };
424
+ } catch (error) {
425
+ const message = commandDomainError(error);
426
+ if (message !== void 0) return {
427
+ kind: "error",
428
+ text: message
429
+ };
430
+ throw error;
431
+ }
432
+ }
433
+ });
434
+ ctx.inject(knowledge.config.upstreams === void 0 ? ["acnDream", "commands"] : ["commands"], (child) => {
435
+ child.commands.register({
436
+ name: "dream",
437
+ description: "Organize owned knowledge or stop at a recoverable boundary.",
438
+ input: { hint: "[stop]" },
439
+ handler: async ({ agent, rawInput }) => {
440
+ const reason = denied(agent);
441
+ if (reason !== void 0) return {
442
+ kind: "error",
443
+ text: commandMessage(reason)
444
+ };
445
+ if (isSubagent(agent.session.header)) return {
446
+ kind: "error",
447
+ text: "子 agent 不能触发或停止 Dream。"
448
+ };
449
+ const service = (await pool.service(agent.session.header)).dream;
450
+ if (service === void 0) return {
451
+ kind: "error",
452
+ text: "Dream 组件未启用。"
453
+ };
454
+ if (rawInput.trim() === "stop") return {
455
+ kind: "success",
456
+ text: `已请求停止 ${await service.stop()} 个 Dream 任务;正在提交的组会完成,草稿和进度保留。再次 /dream 或重启可继续。`
457
+ };
458
+ if (rawInput.trim() !== "") return {
459
+ kind: "error",
460
+ text: "用法:/dream [stop]"
461
+ };
462
+ try {
463
+ const job = await service.request(agent.session.header.cwd, agent.session.id);
464
+ return {
465
+ kind: "success",
466
+ text: `Dream 任务 ${job.id};使用 /acn-status 查看状态,报告路径:${join((await pool.knowledge(agent.session.header)).context().paths.dreamJob(job.id), "report.md")}`
467
+ };
468
+ } catch (error) {
469
+ if (error instanceof JobError) return {
470
+ kind: "error",
471
+ text: commandMessage(error.message, error.kind)
472
+ };
473
+ throw error;
474
+ }
475
+ }
476
+ });
477
+ });
478
+ ctx.inject(knowledge.config.upstreams === void 0 ? ["acnInbox", "commands"] : ["commands"], (child) => {
479
+ child.commands.register({
480
+ name: "inbox",
481
+ description: "Sync team Inbox and queue local internalization.",
482
+ handler: async ({ agent, signal }) => {
483
+ const reason = denied(agent);
484
+ if (reason !== void 0) return {
485
+ kind: "error",
486
+ text: commandMessage(reason)
487
+ };
488
+ const knowledge = await pool.knowledge(agent.session.header);
489
+ if (isSubagent(agent.session.header)) return {
490
+ kind: "error",
491
+ text: "子 agent 不能触发 Inbox 内化。"
492
+ };
493
+ const service = (await pool.service(agent.session.header)).inbox;
494
+ if (service === void 0) return {
495
+ kind: "error",
496
+ text: "Inbox 组件未启用。"
497
+ };
498
+ const report = await service.request(signal, agent.session.id);
499
+ return {
500
+ kind: "success",
501
+ text: `${knowledge.mode === "solo" ? "单人模式没有团队 inbox;处理本地 pending。\n" : ""}拉取 ${report.pulled};持久化 ${report.accepted};确认 ${report.acknowledged};待内化 ${report.pending}。任务 ${report.jobId} 已入队。${report.warnings.length === 0 ? "" : `\n${report.warnings.join("\n")}`}`
502
+ };
503
+ }
504
+ });
505
+ });
506
+ ctx.inject(knowledge.config.upstreams === void 0 ? ["acnFormation", "commands"] : ["commands"], (child) => {
507
+ child.commands.register({
508
+ name: "recap",
509
+ description: "Review this session’s unprocessed knowledge without closing it.",
510
+ handler: async ({ agent }) => {
511
+ const reason = denied(agent);
512
+ if (reason !== void 0) return {
513
+ kind: "error",
514
+ text: commandMessage(reason)
515
+ };
516
+ if (isSubagent(agent.session.header)) return {
517
+ kind: "error",
518
+ text: "子 agent 不能触发知识形成。"
519
+ };
520
+ const service = (await pool.service(agent.session.header)).formation;
521
+ if (service === void 0) return {
522
+ kind: "error",
523
+ text: "知识形成组件未启用。"
524
+ };
525
+ const job = await service.recap(agent.session.id);
526
+ return {
527
+ kind: "success",
528
+ text: job === null ? "没有可复盘的新增内容,未创建任务。" : `Recap 任务:${job.id};使用 /acn-status 查看结果。`
529
+ };
530
+ }
531
+ });
532
+ child.commands.register({
533
+ name: "acn-finalize",
534
+ description: "Form knowledge from this session’s unprocessed transcript.",
535
+ handler: async ({ agent }) => {
536
+ const reason = denied(agent);
537
+ if (reason !== void 0) return {
538
+ kind: "error",
539
+ text: commandMessage(reason)
540
+ };
541
+ if (isSubagent(agent.session.header)) return {
542
+ kind: "error",
543
+ text: "子 agent 不能触发知识形成。"
544
+ };
545
+ const service = (await pool.service(agent.session.header)).formation;
546
+ if (service === void 0) return {
547
+ kind: "error",
548
+ text: "知识形成组件未启用。"
549
+ };
550
+ return {
551
+ kind: "success",
552
+ text: `Finalize 已入队:${(await service.finalize(agent.session.id)).id};使用 /acn-status 查看结果。`
553
+ };
554
+ }
555
+ });
556
+ });
557
+ ctx.commands.register({
558
+ name: "claim",
559
+ description: "Browse, read or revise local Claims.",
560
+ input: { hint: "[query] | show <id> | set <id> <field>=<value> ..." },
561
+ handler: async ({ agent, rawInput, signal }) => {
562
+ const reason = denied(agent);
563
+ if (reason !== void 0) return {
564
+ kind: "error",
565
+ text: commandMessage(reason)
566
+ };
567
+ const knowledge = await pool.knowledge(agent.session.header);
568
+ try {
569
+ return {
570
+ kind: "success",
571
+ text: await claimCommand(knowledge, rawInput, isSubagent(agent.session.header), signal)
572
+ };
573
+ } catch (error) {
574
+ const message = commandDomainError(error) ?? (error instanceof z.ZodError ? "Invalid Claim identifier or editable fields." : void 0);
575
+ if (message === void 0) throw error;
576
+ return {
577
+ kind: "error",
578
+ text: message
579
+ };
580
+ }
581
+ }
582
+ });
583
+ }
584
+ var commands_default = {
585
+ name,
586
+ inject,
587
+ apply
588
+ };
589
+ //#endregion
590
+ export { apply, commands_default as default, importCommand, inject, name };
@@ -0,0 +1,66 @@
1
+ import { o as RouteSchema } from "../structured-C9byFuzm.js";
2
+ import { c as readYamlOr, l as writeYamlAtomic, n as withFileLock } from "../lock-DbmlKOoX.js";
3
+ import { t as AcnDream } from "../service-BPwaZzFF.js";
4
+ import { d as sessionAllowed } from "../session-binding-zCSuizHs.js";
5
+ import { n as projectEvent, r as structuredBackend } from "../formation-D4LO31WW.js";
6
+ import { t as autonomousDreamRunner } from "../dream-agent-BVqxbKFc.js";
7
+ import { t as loadPromptRenderer } from "../render-CJaVcKKC.js";
8
+ import { n as isSubagent } from "../subagent-yJsFxHmH.js";
9
+ import { z } from "zod";
10
+ //#region src/plugins/dream.ts
11
+ const name = "acn-dream";
12
+ const inject = [
13
+ "acnKnowledge",
14
+ "acnRuntime",
15
+ "agents",
16
+ "sessions",
17
+ "llm",
18
+ "tools",
19
+ "systemPrompt"
20
+ ];
21
+ async function apply(ctx) {
22
+ const knowledge = ctx.acnKnowledge;
23
+ ctx.effect(() => ctx.acnRuntime.component("dream"));
24
+ if (!knowledge.configured || knowledge.config.upstreams !== void 0) return;
25
+ let pending = Promise.resolve();
26
+ const render = await loadPromptRenderer();
27
+ const service = new AcnDream(knowledge, structuredBackend(ctx), render, () => pending, {
28
+ workspace: async () => {
29
+ await pending;
30
+ return readYamlOr(knowledge.context().paths.dreamWorkspace, z.string(), () => process.cwd());
31
+ },
32
+ run: autonomousDreamRunner(ctx)
33
+ });
34
+ ctx.provide("acnDream", service);
35
+ if (!knowledge.active) {
36
+ ctx.effect(() => () => service.close());
37
+ return;
38
+ }
39
+ ctx.on("session/event", (session, event) => {
40
+ if (!sessionAllowed(ctx, knowledge.config, session.header) || isSubagent(session.header)) return;
41
+ const route = projectEvent(event).route;
42
+ if (route !== void 0) pending = pending.then(() => withFileLock(`${knowledge.context().paths.lastRoute}.lock`, () => writeYamlAtomic(knowledge.context().paths.lastRoute, route, RouteSchema, knowledge.logger))).catch(() => {
43
+ ctx.logger.warn("Could not persist the background Dream route.");
44
+ });
45
+ });
46
+ ctx.on("agent/created", ({ agent }) => {
47
+ if (!sessionAllowed(ctx, knowledge.config, agent.session.header) || isSubagent(agent.session.header)) return;
48
+ const cwd = agent.session.header.cwd;
49
+ if (cwd !== void 0) pending = pending.then(() => withFileLock(`${knowledge.context().paths.dreamWorkspace}.lock`, () => writeYamlAtomic(knowledge.context().paths.dreamWorkspace, cwd, z.string(), knowledge.logger))).catch(() => {
50
+ ctx.logger.warn("Could not persist the background Dream workspace.");
51
+ });
52
+ service.trigger();
53
+ });
54
+ ctx.effect(() => async () => {
55
+ await service.close();
56
+ await pending;
57
+ });
58
+ await service.start();
59
+ }
60
+ var dream_default = {
61
+ name,
62
+ inject,
63
+ apply
64
+ };
65
+ //#endregion
66
+ export { apply, dream_default as default, inject, name };