wicked-crew 0.7.46 → 0.7.48

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 (263) hide show
  1. package/dist/api/capture.d.ts +2 -2
  2. package/dist/api/chat-citations.d.ts +10 -1
  3. package/dist/api/chat-citations.d.ts.map +1 -1
  4. package/dist/api/chat-citations.js +28 -0
  5. package/dist/api/chat-citations.js.map +1 -1
  6. package/dist/api/chat-scope.d.ts +4 -2
  7. package/dist/api/chat-scope.d.ts.map +1 -1
  8. package/dist/api/chat-scope.js +35 -3
  9. package/dist/api/chat-scope.js.map +1 -1
  10. package/dist/api/chat-transcripts.d.ts +23 -1
  11. package/dist/api/chat-transcripts.d.ts.map +1 -1
  12. package/dist/api/chat-transcripts.js +61 -6
  13. package/dist/api/chat-transcripts.js.map +1 -1
  14. package/dist/api/delivery-index.d.ts +21 -0
  15. package/dist/api/delivery-index.d.ts.map +1 -1
  16. package/dist/api/delivery-index.js +36 -0
  17. package/dist/api/delivery-index.js.map +1 -1
  18. package/dist/api/elicitation-cache.d.ts +12 -0
  19. package/dist/api/elicitation-cache.d.ts.map +1 -1
  20. package/dist/api/elicitation-cache.js +17 -1
  21. package/dist/api/elicitation-cache.js.map +1 -1
  22. package/dist/api/eval-sample.d.ts +12 -12
  23. package/dist/api/governance-steering.d.ts.map +1 -1
  24. package/dist/api/governance-steering.js +1 -0
  25. package/dist/api/governance-steering.js.map +1 -1
  26. package/dist/api/mcp.d.ts +4 -4
  27. package/dist/api/policy-landing.d.ts +55 -0
  28. package/dist/api/policy-landing.d.ts.map +1 -0
  29. package/dist/api/policy-landing.js +174 -0
  30. package/dist/api/policy-landing.js.map +1 -0
  31. package/dist/api/recording.d.ts +228 -0
  32. package/dist/api/recording.d.ts.map +1 -0
  33. package/dist/api/recording.js +1140 -0
  34. package/dist/api/recording.js.map +1 -0
  35. package/dist/api/routes.d.ts +42 -39
  36. package/dist/api/routes.d.ts.map +1 -1
  37. package/dist/api/routes.js +362 -107
  38. package/dist/api/routes.js.map +1 -1
  39. package/dist/api/run-timing-index.d.ts +17 -0
  40. package/dist/api/run-timing-index.d.ts.map +1 -1
  41. package/dist/api/run-timing-index.js +43 -1
  42. package/dist/api/run-timing-index.js.map +1 -1
  43. package/dist/api/server.d.ts +27 -0
  44. package/dist/api/server.d.ts.map +1 -1
  45. package/dist/api/server.js +168 -4
  46. package/dist/api/server.js.map +1 -1
  47. package/dist/api/testing.d.ts +4 -4
  48. package/dist/api/testing.d.ts.map +1 -1
  49. package/dist/api/testing.js +3 -0
  50. package/dist/api/testing.js.map +1 -1
  51. package/dist/api/watch-routes.d.ts +30 -0
  52. package/dist/api/watch-routes.d.ts.map +1 -0
  53. package/dist/api/watch-routes.js +104 -0
  54. package/dist/api/watch-routes.js.map +1 -0
  55. package/dist/campaigns/routes.d.ts +2 -2
  56. package/dist/cli/index.d.ts.map +1 -1
  57. package/dist/cli/index.js +20 -2
  58. package/dist/cli/index.js.map +1 -1
  59. package/dist/core/adapter.d.ts +52 -1
  60. package/dist/core/adapter.d.ts.map +1 -1
  61. package/dist/core/adapter.js +193 -5
  62. package/dist/core/adapter.js.map +1 -1
  63. package/dist/core/run-identity.js +1 -1
  64. package/dist/core/run-identity.js.map +1 -1
  65. package/dist/core/walkthrough-root.d.ts +21 -0
  66. package/dist/core/walkthrough-root.d.ts.map +1 -0
  67. package/dist/core/walkthrough-root.js +66 -0
  68. package/dist/core/walkthrough-root.js.map +1 -0
  69. package/dist/decisions/chat-recorder.d.ts +129 -0
  70. package/dist/decisions/chat-recorder.d.ts.map +1 -0
  71. package/dist/decisions/chat-recorder.js +367 -0
  72. package/dist/decisions/chat-recorder.js.map +1 -0
  73. package/dist/decisions/consider.d.ts +102 -0
  74. package/dist/decisions/consider.d.ts.map +1 -0
  75. package/dist/decisions/consider.js +207 -0
  76. package/dist/decisions/consider.js.map +1 -0
  77. package/dist/decisions/derive.d.ts +79 -0
  78. package/dist/decisions/derive.d.ts.map +1 -0
  79. package/dist/decisions/derive.js +282 -0
  80. package/dist/decisions/derive.js.map +1 -0
  81. package/dist/decisions/events.d.ts +25 -0
  82. package/dist/decisions/events.d.ts.map +1 -0
  83. package/dist/decisions/events.js +24 -0
  84. package/dist/decisions/events.js.map +1 -0
  85. package/dist/decisions/ingest.d.ts +51 -0
  86. package/dist/decisions/ingest.d.ts.map +1 -0
  87. package/dist/decisions/ingest.js +100 -0
  88. package/dist/decisions/ingest.js.map +1 -0
  89. package/dist/decisions/land.d.ts +100 -0
  90. package/dist/decisions/land.d.ts.map +1 -0
  91. package/dist/decisions/land.js +466 -0
  92. package/dist/decisions/land.js.map +1 -0
  93. package/dist/decisions/ledger.d.ts +60 -0
  94. package/dist/decisions/ledger.d.ts.map +1 -0
  95. package/dist/decisions/ledger.js +246 -0
  96. package/dist/decisions/ledger.js.map +1 -0
  97. package/dist/decisions/routes.d.ts +10 -0
  98. package/dist/decisions/routes.d.ts.map +1 -0
  99. package/dist/decisions/routes.js +141 -0
  100. package/dist/decisions/routes.js.map +1 -0
  101. package/dist/decisions/rules-text.d.ts +21 -0
  102. package/dist/decisions/rules-text.d.ts.map +1 -0
  103. package/dist/decisions/rules-text.js +50 -0
  104. package/dist/decisions/rules-text.js.map +1 -0
  105. package/dist/decisions/types.d.ts +120 -0
  106. package/dist/decisions/types.d.ts.map +1 -0
  107. package/dist/decisions/types.js +19 -0
  108. package/dist/decisions/types.js.map +1 -0
  109. package/dist/editors/csp.d.ts +31 -0
  110. package/dist/editors/csp.d.ts.map +1 -0
  111. package/dist/editors/csp.js +46 -0
  112. package/dist/editors/csp.js.map +1 -0
  113. package/dist/editors/pack-install.d.ts +28 -0
  114. package/dist/editors/pack-install.d.ts.map +1 -0
  115. package/dist/editors/pack-install.js +153 -0
  116. package/dist/editors/pack-install.js.map +1 -0
  117. package/dist/editors/registry.d.ts +142 -0
  118. package/dist/editors/registry.d.ts.map +1 -0
  119. package/dist/editors/registry.js +255 -0
  120. package/dist/editors/registry.js.map +1 -0
  121. package/dist/editors/routes.d.ts +46 -0
  122. package/dist/editors/routes.d.ts.map +1 -0
  123. package/dist/editors/routes.js +166 -0
  124. package/dist/editors/routes.js.map +1 -0
  125. package/dist/interactive/bridge-pool.d.ts +7 -2
  126. package/dist/interactive/bridge-pool.d.ts.map +1 -1
  127. package/dist/interactive/bridge-pool.js +6 -1
  128. package/dist/interactive/bridge-pool.js.map +1 -1
  129. package/dist/interactive/draft-events.d.ts.map +1 -1
  130. package/dist/interactive/draft-events.js +1 -0
  131. package/dist/interactive/draft-events.js.map +1 -1
  132. package/dist/interactive/theme-events.d.ts +119 -0
  133. package/dist/interactive/theme-events.d.ts.map +1 -0
  134. package/dist/interactive/theme-events.js +606 -0
  135. package/dist/interactive/theme-events.js.map +1 -0
  136. package/dist/projects/events.d.ts.map +1 -1
  137. package/dist/projects/events.js +2 -1
  138. package/dist/projects/events.js.map +1 -1
  139. package/dist/projects/routes.d.ts +2 -2
  140. package/dist/projects/state-home-preflight.d.ts.map +1 -1
  141. package/dist/projects/state-home-preflight.js +3 -0
  142. package/dist/projects/state-home-preflight.js.map +1 -1
  143. package/dist/projects/state-home-registry.d.ts.map +1 -1
  144. package/dist/projects/state-home-registry.js +2 -0
  145. package/dist/projects/state-home-registry.js.map +1 -1
  146. package/dist/projects/state-home.d.ts +6 -0
  147. package/dist/projects/state-home.d.ts.map +1 -1
  148. package/dist/projects/state-home.js +28 -1
  149. package/dist/projects/state-home.js.map +1 -1
  150. package/dist/qe/acceptance.d.ts +45 -4
  151. package/dist/qe/acceptance.d.ts.map +1 -1
  152. package/dist/qe/acceptance.js +93 -4
  153. package/dist/qe/acceptance.js.map +1 -1
  154. package/dist/qe/ledger.d.ts +20 -0
  155. package/dist/qe/ledger.d.ts.map +1 -1
  156. package/dist/qe/ledger.js +34 -0
  157. package/dist/qe/ledger.js.map +1 -1
  158. package/dist/qe/walkthrough-acceptance.d.ts +82 -0
  159. package/dist/qe/walkthrough-acceptance.d.ts.map +1 -0
  160. package/dist/qe/walkthrough-acceptance.js +248 -0
  161. package/dist/qe/walkthrough-acceptance.js.map +1 -0
  162. package/dist/skills/base-skill.d.ts.map +1 -1
  163. package/dist/skills/base-skill.js +3 -2
  164. package/dist/skills/base-skill.js.map +1 -1
  165. package/dist/skills/plugin-source.d.ts +19 -1
  166. package/dist/skills/plugin-source.d.ts.map +1 -1
  167. package/dist/skills/plugin-source.js +31 -2
  168. package/dist/skills/plugin-source.js.map +1 -1
  169. package/dist/skills/runtime.d.ts +11 -2
  170. package/dist/skills/runtime.d.ts.map +1 -1
  171. package/dist/skills/runtime.js +29 -1
  172. package/dist/skills/runtime.js.map +1 -1
  173. package/dist/skills/store.d.ts +14 -1
  174. package/dist/skills/store.d.ts.map +1 -1
  175. package/dist/skills/store.js +19 -5
  176. package/dist/skills/store.js.map +1 -1
  177. package/dist/standing-orders/routes.d.ts +22 -22
  178. package/dist/standing-orders/store.d.ts +10 -10
  179. package/dist/watch/checks/check-failed.d.ts +24 -0
  180. package/dist/watch/checks/check-failed.d.ts.map +1 -0
  181. package/dist/watch/checks/check-failed.js +56 -0
  182. package/dist/watch/checks/check-failed.js.map +1 -0
  183. package/dist/watch/checks/claim-vs-evidence.d.ts +30 -0
  184. package/dist/watch/checks/claim-vs-evidence.d.ts.map +1 -0
  185. package/dist/watch/checks/claim-vs-evidence.js +152 -0
  186. package/dist/watch/checks/claim-vs-evidence.js.map +1 -0
  187. package/dist/watch/checks/deliver-audit.d.ts +19 -0
  188. package/dist/watch/checks/deliver-audit.d.ts.map +1 -0
  189. package/dist/watch/checks/deliver-audit.js +129 -0
  190. package/dist/watch/checks/deliver-audit.js.map +1 -0
  191. package/dist/watch/checks/index.d.ts +8 -0
  192. package/dist/watch/checks/index.d.ts.map +1 -0
  193. package/dist/watch/checks/index.js +24 -0
  194. package/dist/watch/checks/index.js.map +1 -0
  195. package/dist/watch/checks/lag.d.ts +24 -0
  196. package/dist/watch/checks/lag.d.ts.map +1 -0
  197. package/dist/watch/checks/lag.js +55 -0
  198. package/dist/watch/checks/lag.js.map +1 -0
  199. package/dist/watch/checks/quiet-after-claim.d.ts +17 -0
  200. package/dist/watch/checks/quiet-after-claim.d.ts.map +1 -0
  201. package/dist/watch/checks/quiet-after-claim.js +89 -0
  202. package/dist/watch/checks/quiet-after-claim.js.map +1 -0
  203. package/dist/watch/checks/ungated.d.ts +12 -0
  204. package/dist/watch/checks/ungated.d.ts.map +1 -0
  205. package/dist/watch/checks/ungated.js +64 -0
  206. package/dist/watch/checks/ungated.js.map +1 -0
  207. package/dist/watch/checks/warned-rule.d.ts +26 -0
  208. package/dist/watch/checks/warned-rule.d.ts.map +1 -0
  209. package/dist/watch/checks/warned-rule.js +126 -0
  210. package/dist/watch/checks/warned-rule.js.map +1 -0
  211. package/dist/watch/emit.d.ts +122 -0
  212. package/dist/watch/emit.d.ts.map +1 -0
  213. package/dist/watch/emit.js +443 -0
  214. package/dist/watch/emit.js.map +1 -0
  215. package/dist/watch/events.d.ts +21 -0
  216. package/dist/watch/events.d.ts.map +1 -0
  217. package/dist/watch/events.js +21 -0
  218. package/dist/watch/events.js.map +1 -0
  219. package/dist/watch/keys.d.ts +15 -0
  220. package/dist/watch/keys.d.ts.map +1 -0
  221. package/dist/watch/keys.js +23 -0
  222. package/dist/watch/keys.js.map +1 -0
  223. package/dist/watch/lanes.d.ts +41 -0
  224. package/dist/watch/lanes.d.ts.map +1 -0
  225. package/dist/watch/lanes.js +73 -0
  226. package/dist/watch/lanes.js.map +1 -0
  227. package/dist/watch/loader.d.ts +47 -0
  228. package/dist/watch/loader.d.ts.map +1 -0
  229. package/dist/watch/loader.js +178 -0
  230. package/dist/watch/loader.js.map +1 -0
  231. package/dist/watch/registry.d.ts +166 -0
  232. package/dist/watch/registry.d.ts.map +1 -0
  233. package/dist/watch/registry.js +589 -0
  234. package/dist/watch/registry.js.map +1 -0
  235. package/dist/watch/ring.d.ts +32 -0
  236. package/dist/watch/ring.d.ts.map +1 -0
  237. package/dist/watch/ring.js +90 -0
  238. package/dist/watch/ring.js.map +1 -0
  239. package/dist/watch/router.d.ts +25 -0
  240. package/dist/watch/router.d.ts.map +1 -0
  241. package/dist/watch/router.js +87 -0
  242. package/dist/watch/router.js.map +1 -0
  243. package/dist/watch/sources.d.ts +42 -0
  244. package/dist/watch/sources.d.ts.map +1 -0
  245. package/dist/watch/sources.js +104 -0
  246. package/dist/watch/sources.js.map +1 -0
  247. package/dist/watch/types.d.ts +129 -0
  248. package/dist/watch/types.d.ts.map +1 -0
  249. package/dist/watch/types.js +6 -0
  250. package/dist/watch/types.js.map +1 -0
  251. package/endpoint-manifest.json +272 -1
  252. package/package.json +3 -2
  253. package/watch/entries/claim-vs-evidence.json +13 -0
  254. package/watch/entries/deliver-audit.json +17 -0
  255. package/watch/entries/quiet-after-claim.json +16 -0
  256. package/watch/entries/registry-check-failed.json +12 -0
  257. package/watch/entries/registry-lagging.json +12 -0
  258. package/watch/entries/risky-call.json +12 -0
  259. package/watch/entries/ungated.json +13 -0
  260. package/dist/api/demo.d.ts +0 -90
  261. package/dist/api/demo.d.ts.map +0 -1
  262. package/dist/api/demo.js +0 -492
  263. package/dist/api/demo.js.map +0 -1
@@ -0,0 +1,73 @@
1
+ /**
2
+ * The check lanes (DES-TRIGGER-REGISTRY-001 §4.6).
3
+ *
4
+ * DETERMINISTIC. In-process and sequential (the registry drains one input at a time, so a run's
5
+ * inputs are evaluated in order). Each check has a 5 ms budget: a breach is counted, not cut. A
6
+ * check that throws or does not settle within its timeout yields NO output (a failed check never
7
+ * emits "fine") and is reported to the registry, which raises `registry-check-failed` past its
8
+ * threshold.
9
+ *
10
+ * LLM. Not in this slice: the `llm:*` lane, its seat port and `Core.checkOnce` land with TR-W9a/W9.
11
+ * No shipped check is `lane: "llm"`, and the registry refuses to run one (health `llm.enabled:false`).
12
+ */
13
+ const TIMED_OUT = Symbol('timed-out');
14
+ export class DeterministicLane {
15
+ opts;
16
+ /** The failure report, guarded: a throwing reporter never makes `run` reject. */
17
+ report(entryId, reason, err) {
18
+ try {
19
+ this.opts.onFailure?.(entryId, reason, err);
20
+ }
21
+ catch {
22
+ /* counted above; the report itself is best-effort */
23
+ }
24
+ }
25
+ stats = { runs: 0, budgetBreaches: 0, failures: 0, timeouts: 0 };
26
+ budgetMs;
27
+ timeoutMs;
28
+ clock;
29
+ constructor(opts = {}) {
30
+ this.opts = opts;
31
+ this.budgetMs = opts.budgetMs ?? 5;
32
+ this.timeoutMs = opts.timeoutMs ?? 1_000;
33
+ this.clock = opts.clock ?? (() => performance.now());
34
+ }
35
+ /** Never throws. */
36
+ async run(check, entry, input, state, ctx) {
37
+ if (check.lane !== 'deterministic')
38
+ return [];
39
+ this.stats.runs++;
40
+ const t0 = this.clock();
41
+ let timer;
42
+ try {
43
+ const result = check.evaluate(input, state, entry.params, entry.threshold, ctx);
44
+ const settled = Array.isArray(result)
45
+ ? result
46
+ : await Promise.race([
47
+ result,
48
+ new Promise((resolve) => {
49
+ timer = setTimeout(() => resolve(TIMED_OUT), this.timeoutMs);
50
+ timer.unref();
51
+ }),
52
+ ]);
53
+ if (settled === TIMED_OUT) {
54
+ this.stats.timeouts++;
55
+ this.report(entry.id, 'timeout', null);
56
+ return [];
57
+ }
58
+ return Array.isArray(settled) ? settled : [];
59
+ }
60
+ catch (err) {
61
+ this.stats.failures++;
62
+ this.report(entry.id, 'threw', err);
63
+ return [];
64
+ }
65
+ finally {
66
+ if (timer !== undefined)
67
+ clearTimeout(timer);
68
+ if (this.clock() - t0 > this.budgetMs)
69
+ this.stats.budgetBreaches++;
70
+ }
71
+ }
72
+ }
73
+ //# sourceMappingURL=lanes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lanes.js","sourceRoot":"","sources":["../../src/watch/lanes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAqBH,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAEtC,MAAM,OAAO,iBAAiB;IAeC;IAd7B,iFAAiF;IACzE,MAAM,CAAC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nC,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC;oBACjB,MAAM;oBACN,IAAI,OAAO,CAAmB,CAAC,OAAO,EAAE,EAAE;wBACxC,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;wBAC7D,KAAK,CAAC,KAAK,EAAE,CAAC;oBAChB,CAAC,CAAC;iBACH,CAAC,CAAC;YACP,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC1B,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;gBACtB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;gBACvC,OAAO,EAAE,CAAC;YACZ,CAAC;YACD,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACtB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;YACpC,OAAO,EAAE,CAAC;QACZ,CAAC;gBAAS,CAAC;YACT,IAAI,KAAK,KAAK,SAAS;gBAAE,YAAY,CAAC,KAAK,CAAC,CAAC;YAC7C,IAAI,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,QAAQ;gBAAE,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;QACrE,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The entry loader (DES-TRIGGER-REGISTRY-001 §4.2).
3
+ *
4
+ * One file per entry, `packages/crew/watch/entries/<id>.json`, versioned with crew. A violating
5
+ * entry is REFUSED with a reason (listed in `GET /watch/health`) and every other entry still loads:
6
+ * one bad file cannot turn watching off. Refused when:
7
+ * - the JSON does not parse, or its id is not `[a-z0-9-]{3,48}` or differs from the file name;
8
+ * - it names a check the check map does not have, or its params / threshold fail the check's schema;
9
+ * - `emit.as` is anything but finding | flag | proposal (no allow-like value exists in the schema);
10
+ * - a bus source names a type that is not a 4-segment `wicked.<domain>.<noun>.<verb>`.
11
+ *
12
+ * The operator may change only `enabled` and `threshold` of a shipped entry (settings `watch.entries`),
13
+ * applied by {@link applyOverrides}; an override whose threshold fails the check's schema is ignored
14
+ * and reported, never half-applied.
15
+ */
16
+ import type { WatchSettings } from 'wicked-crew-api-types';
17
+ import type { LoadedEntry, WatchCheck } from './types.js';
18
+ /** The shipped entries directory: `packages/crew/watch/entries` (same depth from `src/` and `dist/`). */
19
+ export declare const SHIPPED_ENTRIES_DIR: string;
20
+ export interface Refusal {
21
+ id: string;
22
+ reason: string;
23
+ }
24
+ export interface LoadResult {
25
+ entries: LoadedEntry[];
26
+ refused: Refusal[];
27
+ }
28
+ /** Validate one parsed entry against the schema and the check map. */
29
+ export declare function validateEntry(raw: unknown, fileId: string, checks: ReadonlyMap<string, WatchCheck>): LoadedEntry | Refusal;
30
+ /** Load every `<id>.json` in `dir`. A missing directory loads nothing and says so. */
31
+ export declare function loadEntries(dir: string, checks: ReadonlyMap<string, WatchCheck>): LoadResult;
32
+ /** Why a settings override was not applied (reported in health, never half-applied). */
33
+ export interface OverrideProblem {
34
+ id: string;
35
+ reason: string;
36
+ }
37
+ /** The effective entries: the operator's `enabled` / `threshold` overrides on the shipped ones. */
38
+ export declare function applyOverrides(entries: readonly LoadedEntry[], settings: WatchSettings | undefined, checks: ReadonlyMap<string, WatchCheck>): {
39
+ entries: LoadedEntry[];
40
+ problems: OverrideProblem[];
41
+ };
42
+ /**
43
+ * Validate a `PUT /settings` `watch` patch against the loaded entries. Returns the error text for a
44
+ * 400, or `null`. Only `enabled` and `threshold` of a KNOWN entry, and the boolean `llm`.
45
+ */
46
+ export declare function validateWatchPatch(patch: unknown, entries: readonly LoadedEntry[], checks: ReadonlyMap<string, WatchCheck>): string | null;
47
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/watch/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE1D,yGAAyG;AACzG,eAAO,MAAM,mBAAmB,QAAiE,CAAC;AAgClG,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB;AAMD,sEAAsE;AACtE,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,WAAW,GAAG,OAAO,CAuB1H;AAED,sFAAsF;AACtF,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,UAAU,CAuB5F;AAED,wFAAwF;AACxF,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,mGAAmG;AACnG,wBAAgB,cAAc,CAC5B,OAAO,EAAE,SAAS,WAAW,EAAE,EAC/B,QAAQ,EAAE,aAAa,GAAG,SAAS,EACnC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,GACtC;IAAE,OAAO,EAAE,WAAW,EAAE,CAAC;IAAC,QAAQ,EAAE,eAAe,EAAE,CAAA;CAAE,CAmBzD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,SAAS,WAAW,EAAE,EAC/B,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,GACtC,MAAM,GAAG,IAAI,CA6Bf"}
@@ -0,0 +1,178 @@
1
+ /**
2
+ * The entry loader (DES-TRIGGER-REGISTRY-001 §4.2).
3
+ *
4
+ * One file per entry, `packages/crew/watch/entries/<id>.json`, versioned with crew. A violating
5
+ * entry is REFUSED with a reason (listed in `GET /watch/health`) and every other entry still loads:
6
+ * one bad file cannot turn watching off. Refused when:
7
+ * - the JSON does not parse, or its id is not `[a-z0-9-]{3,48}` or differs from the file name;
8
+ * - it names a check the check map does not have, or its params / threshold fail the check's schema;
9
+ * - `emit.as` is anything but finding | flag | proposal (no allow-like value exists in the schema);
10
+ * - a bus source names a type that is not a 4-segment `wicked.<domain>.<noun>.<verb>`.
11
+ *
12
+ * The operator may change only `enabled` and `threshold` of a shipped entry (settings `watch.entries`),
13
+ * applied by {@link applyOverrides}; an override whose threshold fails the check's schema is ignored
14
+ * and reported, never half-applied.
15
+ */
16
+ import { readdirSync, readFileSync } from 'node:fs';
17
+ import { basename, join } from 'node:path';
18
+ import { fileURLToPath } from 'node:url';
19
+ import { z } from 'zod';
20
+ /** The shipped entries directory: `packages/crew/watch/entries` (same depth from `src/` and `dist/`). */
21
+ export const SHIPPED_ENTRIES_DIR = fileURLToPath(new URL('../../watch/entries', import.meta.url));
22
+ const ID = /^[a-z0-9-]{3,48}$/;
23
+ const BUS_TYPE = /^wicked\.[a-z0-9_]+\.[a-z0-9_]+\.[a-z0-9_]+$/;
24
+ const EntrySchema = z
25
+ .object({
26
+ id: z.string().regex(ID, 'id must be [a-z0-9-]{3,48}'),
27
+ version: z.number().int().min(1),
28
+ on: z.object({ source: z.enum(['core', 'bus', 'watchdog', 'internal']), type: z.string().min(1).max(128) }).strict(),
29
+ join: z
30
+ .array(z.object({ source: z.enum(['core', 'bus', 'watchdog']), type: z.string().min(1).max(128) }).strict())
31
+ .max(4)
32
+ .optional(),
33
+ filter: z.record(z.unknown()).default({}),
34
+ check: z.string().min(1),
35
+ params: z.record(z.unknown()).default({}),
36
+ threshold: z.record(z.unknown()).default({}),
37
+ emit: z
38
+ .object({
39
+ as: z.enum(['finding', 'flag', 'proposal']),
40
+ severity: z.enum(['high', 'medium', 'info']),
41
+ watch_kind: z.enum(['problem', 'decision', 'done', 'quiet', 'delivery']),
42
+ attach: z.enum(['gate']).nullable().default(null),
43
+ rate: z.object({ per_run: z.number().int().min(1).max(1_000) }).strict(),
44
+ })
45
+ .strict(),
46
+ priority: z.enum(['p0', 'p1', 'p2']),
47
+ enabled: z.boolean(),
48
+ })
49
+ .strict();
50
+ function zodReason(err) {
51
+ return err.issues.map((i) => `${i.path.join('.') || '(entry)'}: ${i.message}`).join('; ');
52
+ }
53
+ /** Validate one parsed entry against the schema and the check map. */
54
+ export function validateEntry(raw, fileId, checks) {
55
+ const parsed = EntrySchema.safeParse(raw);
56
+ if (!parsed.success)
57
+ return { id: fileId, reason: zodReason(parsed.error) };
58
+ const e = parsed.data;
59
+ if (e.id !== fileId)
60
+ return { id: fileId, reason: `id "${e.id}" differs from the file name "${fileId}.json"` };
61
+ for (const point of [e.on, ...(e.join ?? [])]) {
62
+ if (point.source === 'bus' && !BUS_TYPE.test(point.type)) {
63
+ return { id: e.id, reason: `bus type "${point.type}" is not a 4-segment wicked.<domain>.<noun>.<verb> type` };
64
+ }
65
+ }
66
+ const check = checks.get(e.check);
67
+ if (check === undefined)
68
+ return { id: e.id, reason: `unknown check "${e.check}"` };
69
+ const params = check.paramsSchema.safeParse(e.params);
70
+ if (!params.success)
71
+ return { id: e.id, reason: `params: ${zodReason(params.error)}` };
72
+ const threshold = check.thresholdSchema.safeParse(e.threshold);
73
+ if (!threshold.success)
74
+ return { id: e.id, reason: `threshold: ${zodReason(threshold.error)}` };
75
+ const { join, ...rest } = e;
76
+ return {
77
+ ...rest,
78
+ ...(join !== undefined && join.length > 0 ? { join } : {}),
79
+ params: params.data,
80
+ threshold: threshold.data,
81
+ };
82
+ }
83
+ /** Load every `<id>.json` in `dir`. A missing directory loads nothing and says so. */
84
+ export function loadEntries(dir, checks) {
85
+ const entries = [];
86
+ const refused = [];
87
+ let names;
88
+ try {
89
+ names = readdirSync(dir).filter((n) => n.endsWith('.json')).sort();
90
+ }
91
+ catch (err) {
92
+ return { entries, refused: [{ id: '(entries)', reason: `cannot read ${basename(dir)}: ${err.message}` }] };
93
+ }
94
+ for (const name of names) {
95
+ const fileId = name.slice(0, -'.json'.length);
96
+ let raw;
97
+ try {
98
+ raw = JSON.parse(readFileSync(join(dir, name), 'utf8'));
99
+ }
100
+ catch (err) {
101
+ refused.push({ id: fileId, reason: `not JSON: ${err.message}` });
102
+ continue;
103
+ }
104
+ const out = validateEntry(raw, fileId, checks);
105
+ if ('reason' in out)
106
+ refused.push(out);
107
+ else
108
+ entries.push(out);
109
+ }
110
+ return { entries, refused };
111
+ }
112
+ /** The effective entries: the operator's `enabled` / `threshold` overrides on the shipped ones. */
113
+ export function applyOverrides(entries, settings, checks) {
114
+ const problems = [];
115
+ const out = entries.map((e) => {
116
+ const o = settings?.entries?.[e.id];
117
+ if (o === undefined)
118
+ return e;
119
+ let next = e;
120
+ // Validated FIRST: a bad threshold leaves the whole override unapplied (enabled included).
121
+ if (o.threshold !== undefined) {
122
+ const parsed = checks.get(e.check)?.thresholdSchema.safeParse({ ...e.threshold, ...o.threshold });
123
+ if (parsed?.success !== true) {
124
+ problems.push({ id: e.id, reason: `threshold override ignored: ${parsed ? zodReason(parsed.error) : 'no check'}` });
125
+ return e;
126
+ }
127
+ next = { ...next, threshold: parsed.data };
128
+ }
129
+ if (typeof o.enabled === 'boolean')
130
+ next = { ...next, enabled: o.enabled };
131
+ return next;
132
+ });
133
+ return { entries: out, problems };
134
+ }
135
+ /**
136
+ * Validate a `PUT /settings` `watch` patch against the loaded entries. Returns the error text for a
137
+ * 400, or `null`. Only `enabled` and `threshold` of a KNOWN entry, and the boolean `llm`.
138
+ */
139
+ export function validateWatchPatch(patch, entries, checks) {
140
+ if (typeof patch !== 'object' || patch === null || Array.isArray(patch))
141
+ return 'watch must be an object';
142
+ for (const key of Object.keys(patch)) {
143
+ if (key !== 'entries' && key !== 'llm')
144
+ return `watch.${key} is not a setting (only watch.entries and watch.llm)`;
145
+ }
146
+ const p = patch;
147
+ if (p.llm !== undefined && typeof p.llm !== 'boolean')
148
+ return 'watch.llm must be a boolean';
149
+ if (p.entries === undefined)
150
+ return null;
151
+ if (typeof p.entries !== 'object' || p.entries === null || Array.isArray(p.entries))
152
+ return 'watch.entries must be an object keyed by entry id';
153
+ for (const [id, raw] of Object.entries(p.entries)) {
154
+ const entry = entries.find((e) => e.id === id);
155
+ if (entry === undefined)
156
+ return `watch.entries.${id}: no such entry`;
157
+ if (typeof raw !== 'object' || raw === null || Array.isArray(raw))
158
+ return `watch.entries.${id} must be an object`;
159
+ for (const k of Object.keys(raw)) {
160
+ if (k !== 'enabled' && k !== 'threshold')
161
+ return `watch.entries.${id}.${k} cannot be changed (only enabled and threshold)`;
162
+ }
163
+ const o = raw;
164
+ if (o.enabled !== undefined && typeof o.enabled !== 'boolean')
165
+ return `watch.entries.${id}.enabled must be a boolean`;
166
+ if (o.threshold !== undefined) {
167
+ if (typeof o.threshold !== 'object' || o.threshold === null || Array.isArray(o.threshold)) {
168
+ return `watch.entries.${id}.threshold must be an object`;
169
+ }
170
+ const parsed = checks.get(entry.check)?.thresholdSchema.safeParse({ ...entry.threshold, ...o.threshold });
171
+ if (parsed === undefined || !parsed.success) {
172
+ return `watch.entries.${id}.threshold: ${parsed ? zodReason(parsed.error) : 'no check'}`;
173
+ }
174
+ }
175
+ }
176
+ return null;
177
+ }
178
+ //# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/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,CAAC,GAAG,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,WAAW;gBAAE,OAAO,iBAAiB,EAAE,IAAI,CAAC,iDAAiD,CAAC;QAC7H,CAAC;QACD,MAAM,CAAC,GAAG,GAAiD,CAAC;QAC5D,IAAI,CAAC,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,SAAS;YAAE,OAAO,iBAAiB,EAAE,4BAA4B,CAAC;QACtH,IAAI,CAAC,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YAC9B,IAAI,OAAO,CAAC,CAAC,SAAS,KAAK,QAAQ,IAAI,CAAC,CAAC,SAAS,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC1F,OAAO,iBAAiB,EAAE,8BAA8B,CAAC;YAC3D,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,EAAE,GAAG,KAAK,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;YAC1G,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBAC5C,OAAO,iBAAiB,EAAE,eAAe,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;YAC3F,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,166 @@
1
+ /**
2
+ * The key-point trigger registry (DES-TRIGGER-REGISTRY-001, TR-W5a): the runtime.
3
+ *
4
+ * ```
5
+ * daemon fan-in ──offer() O(1)──▶ ring[512] ─┐
6
+ * watchdog onFrame ──offerWatchdog() O(1)──▶ ├─▶ router ─▶ deterministic lane ─▶ emitter ─▶ bus ─▶ relay ─▶ /ws
7
+ * bus (pulled, only types an entry wants) ───┘
8
+ * ```
9
+ *
10
+ * - OFF THE HOT PATH (G3). `offer` is synchronous, allocation-light, never awaited and never throws;
11
+ * an input no enabled entry listens for is dropped by one `Set.has`.
12
+ * - ADVISORY BY CONSTRUCTION (G6). The registry is built with no gate, reassign or policy
13
+ * dependency (`tests/watch-no-authority.test.ts` fails the build if `src/watch/**` names one). It
14
+ * emits findings, flags and proposals; it never adds a needs-you row.
15
+ * - ONE RECORD (§4.8). The bus. The feed is hydrated from it once at arm; each live run's persisted
16
+ * events (and its wanted bus rows) are replayed through the entries at boot; every key is built
17
+ * from producer-assigned identity, so a replay resolves to the rows already there.
18
+ * - NO BUS, NO WATCHING (§6). Without an engine bus the registry does not arm, and health says why.
19
+ */
20
+ import type { RecordedEvent, WatchCoverage, WatchEntry, WatchEntrySource, WatchFeedResponse, WatchFinding, WatchHealth, WatchKind, WatchSettings } from 'wicked-crew-api-types';
21
+ import type { CoreEvent } from '../core/types.js';
22
+ import type { WatchCheck } from './types.js';
23
+ export interface WatchRegistryOptions {
24
+ /**
25
+ * TR-W6: the daemon's steering rules, read for `warned_rule` and cached for {@link RULES_SNAPSHOT_TTL_MS}.
26
+ * Absent = checks see no `ctx.rules` (coverage says the store is not readable once a rule fires).
27
+ */
28
+ rules?: () => Promise<ReadonlyArray<{
29
+ id: string;
30
+ effect?: string | undefined;
31
+ severity: string;
32
+ retired?: boolean | undefined;
33
+ }>>;
34
+ /** Test seam: the per-ask deadline on that read (default {@link RULES_READ_DEADLINE_MS}). */
35
+ rulesDeadlineMs?: number;
36
+ /** The bus the daemon handed its engine; `undefined` = no bus, no watching. */
37
+ dbPath: string | undefined;
38
+ entriesDir?: string;
39
+ checks?: ReadonlyMap<string, WatchCheck>;
40
+ /** The `watch` key of crew's settings (the operator's on/off and thresholds). */
41
+ settings: () => Promise<WatchSettings | undefined>;
42
+ projectOf: (runId: string) => string | undefined;
43
+ /** Runs live at boot (their persisted events are replayed, §4.8 step 2). */
44
+ liveRuns?: () => Promise<string[]>;
45
+ /** A run's persisted events (`Core.runEvents`); `null` = this engine cannot say. */
46
+ runEvents?: (runId: string) => Promise<RecordedEvent[] | null>;
47
+ /** Where `watchEvent` frames go (the relay); omitted = no relay. */
48
+ broadcast?: (frame: CoreEvent) => void;
49
+ auditEmitFailed?: (detail: Record<string, unknown>) => void;
50
+ submitProposal?: (finding: WatchFinding) => Promise<void>;
51
+ log?: (msg: string) => void;
52
+ now?: () => number;
53
+ sleep?: (ms: number) => Promise<void>;
54
+ /** Emitter flush cadence (ms); 0 = flush only on demand (tests). */
55
+ flushMs?: number;
56
+ /** Internal tick cadence (ms) for `registry-lagging`; 0 = no timer (tests tick by hand). */
57
+ tickMs?: number;
58
+ /** Bus poll cadence for the relay and the pull (ms). */
59
+ pollIntervalMs?: number;
60
+ ringCapacity?: number;
61
+ /** Per-check budget and timeout (ms). */
62
+ checkBudgetMs?: number;
63
+ checkTimeoutMs?: number;
64
+ }
65
+ export type DismissResult = 'dismissed' | 'not_found' | 'already_cleared' | 'emit_failed';
66
+ /** TR-W6: how long one `listConformanceRules` read serves the warned-rule check. */
67
+ export declare const RULES_SNAPSHOT_TTL_MS = 30000;
68
+ /** TR-W6: how long a check waits on that read — well below the deterministic lane's 1 s timeout. */
69
+ export declare const RULES_READ_DEADLINE_MS = 400;
70
+ export declare class WatchRegistry {
71
+ private readonly opts;
72
+ private armedFlag;
73
+ private reasonText;
74
+ private accepting;
75
+ private live;
76
+ private readonly checks;
77
+ private shipped;
78
+ private refused;
79
+ private overrideProblems;
80
+ private effective;
81
+ private settingsNow;
82
+ private router;
83
+ private readonly ring;
84
+ private readonly lane;
85
+ private emitter;
86
+ private relay;
87
+ private pull;
88
+ private tickTimer;
89
+ private draining;
90
+ private drainScheduled;
91
+ private shedTickQueued;
92
+ private dbPath;
93
+ private readonly runStates;
94
+ /** Live runs whose persisted events could not be read at boot (their coverage says so). */
95
+ private readonly gapRuns;
96
+ /** The live runs could not even be listed at boot: every unseen run's coverage says so. */
97
+ private listGap;
98
+ /** While the boot replay runs, live bus rows wait here (the pull is armed BEFORE the replay). */
99
+ private busHold;
100
+ private readonly now;
101
+ private readonly sourceState;
102
+ constructor(opts: WatchRegistryOptions);
103
+ get armed(): boolean;
104
+ /** Arm: load entries, hydrate the feed from the bus, replay live runs, then go live. Never throws. */
105
+ arm(): Promise<void>;
106
+ private armBusPull;
107
+ /** §4.8 step 2: every run live at boot is re-read from its own record and evaluated. */
108
+ private replay;
109
+ /** THE HOT PATH (daemon fan-in): synchronous, O(1), never throws, never awaited. */
110
+ offer(event: CoreEvent): void;
111
+ /** The watchdog's frames (the `onFrame` tee): same contract as {@link offer}. */
112
+ offerWatchdog(frame: {
113
+ type: string;
114
+ session?: string;
115
+ } & Record<string, unknown>): void;
116
+ private offerInternal;
117
+ private schedule;
118
+ private drain;
119
+ private stateOf;
120
+ private rulesSnapshot;
121
+ private rulesInFlight;
122
+ /**
123
+ * TR-W6: one store read per TTL, shared by every check that asks in the window.
124
+ *
125
+ * The ask has a DEADLINE below the deterministic lane's timeout (codex r1): a slow read must not
126
+ * get the evaluation abandoned mid-way (its dedupe state would move while its output is dropped).
127
+ * Past the deadline the ask is refused — the check keeps the frame and classifies it on a later
128
+ * one — while the read itself goes on and fills the snapshot when it lands. A read that has not
129
+ * settled within one TTL is abandoned: the next ask starts a new one (a hung store never pins the
130
+ * slot), and a late answer from an abandoned read never overwrites a newer snapshot.
131
+ */
132
+ private readRules;
133
+ private ctx;
134
+ /** Route one input through every matching entry and hand the outputs to the emitter. */
135
+ private process;
136
+ /** Drain the ring and flush the emitter (tests, and shutdown). */
137
+ flush(): Promise<void>;
138
+ /** Stop taking inputs, finish what was accepted, then close the emitter and the taps. */
139
+ stop(): Promise<void>;
140
+ /** Tick the internal clock by hand (tests; the timer does this every 30 s). */
141
+ tick(): void;
142
+ /** Apply the operator's `watch` settings: the effective entries and the router are rebuilt. */
143
+ applySettings(watch: WatchSettings | undefined): void;
144
+ /** The 400 text for a bad `watch` patch, or `null`. */
145
+ validateSettingsPatch(patch: unknown): string | null;
146
+ /** Merge a validated patch into the current `watch` settings, stamping who changed what and when. */
147
+ mergeSettings(current: WatchSettings | undefined, patch: WatchSettings, actorId: string, at: number): WatchSettings;
148
+ health(): WatchHealth;
149
+ /** `GET /watch/entries`: the effective entries, each threshold in plain words. */
150
+ entries(): WatchEntry[];
151
+ /** `GET /watch`: the feed, newest first; with `run`, the run's coverage too. */
152
+ feed(q: {
153
+ project?: string;
154
+ kind?: WatchKind;
155
+ run?: string;
156
+ since?: number;
157
+ limit?: number;
158
+ }): WatchFeedResponse;
159
+ /** G7: per run, which entries checked and which did not (and why). Run-less entries have none. */
160
+ coverage(runId: string): WatchCoverage[];
161
+ /** "Seen, not a problem": publishes `cleared{reason:"dismissed"}` for the row. */
162
+ dismiss(watchId: string, actorId: string): Promise<DismissResult>;
163
+ /** The sources an entry can name (for the routes' validation and the docs). */
164
+ static readonly SOURCES: readonly WatchEntrySource[];
165
+ }
166
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/watch/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,UAAU,EAEV,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EAEZ,WAAW,EACX,SAAS,EACT,aAAa,EACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAQlD,OAAO,KAAK,EAAuD,UAAU,EAAkB,MAAM,YAAY,CAAC;AAQlH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,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