@descryy/mcp 0.9.0 → 0.11.0

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 (206) hide show
  1. package/dist/browser/auth.d.ts +76 -0
  2. package/dist/browser/auth.d.ts.map +1 -0
  3. package/dist/browser/auth.js +223 -0
  4. package/dist/browser/auth.js.map +1 -0
  5. package/dist/browser/capability-probe.d.ts +109 -0
  6. package/dist/browser/capability-probe.d.ts.map +1 -0
  7. package/dist/browser/capability-probe.js +201 -0
  8. package/dist/browser/capability-probe.js.map +1 -0
  9. package/dist/browser/driver.d.ts +342 -4
  10. package/dist/browser/driver.d.ts.map +1 -1
  11. package/dist/browser/driver.js +79 -1
  12. package/dist/browser/driver.js.map +1 -1
  13. package/dist/browser/evidence.d.ts +3 -0
  14. package/dist/browser/evidence.d.ts.map +1 -1
  15. package/dist/browser/evidence.js +6 -1
  16. package/dist/browser/evidence.js.map +1 -1
  17. package/dist/browser/fake-driver.d.ts +65 -8
  18. package/dist/browser/fake-driver.d.ts.map +1 -1
  19. package/dist/browser/fake-driver.js +235 -8
  20. package/dist/browser/fake-driver.js.map +1 -1
  21. package/dist/browser/fault-attribution.d.ts +178 -0
  22. package/dist/browser/fault-attribution.d.ts.map +1 -0
  23. package/dist/browser/fault-attribution.js +266 -0
  24. package/dist/browser/fault-attribution.js.map +1 -0
  25. package/dist/browser/identity-graph-write.d.ts +55 -0
  26. package/dist/browser/identity-graph-write.d.ts.map +1 -0
  27. package/dist/browser/identity-graph-write.js +45 -0
  28. package/dist/browser/identity-graph-write.js.map +1 -0
  29. package/dist/browser/page-probe.d.ts +81 -0
  30. package/dist/browser/page-probe.d.ts.map +1 -0
  31. package/dist/browser/page-probe.js +202 -0
  32. package/dist/browser/page-probe.js.map +1 -0
  33. package/dist/browser/playwright-driver.d.ts +79 -0
  34. package/dist/browser/playwright-driver.d.ts.map +1 -1
  35. package/dist/browser/playwright-driver.js +1138 -180
  36. package/dist/browser/playwright-driver.js.map +1 -1
  37. package/dist/browser/reach-recording-session.d.ts +44 -0
  38. package/dist/browser/reach-recording-session.d.ts.map +1 -0
  39. package/dist/browser/reach-recording-session.js +143 -0
  40. package/dist/browser/reach-recording-session.js.map +1 -0
  41. package/dist/browser/reachability.d.ts +168 -0
  42. package/dist/browser/reachability.d.ts.map +1 -0
  43. package/dist/browser/reachability.js +294 -0
  44. package/dist/browser/reachability.js.map +1 -0
  45. package/dist/browser/registry.d.ts +24 -0
  46. package/dist/browser/registry.d.ts.map +1 -1
  47. package/dist/browser/registry.js +21 -2
  48. package/dist/browser/registry.js.map +1 -1
  49. package/dist/browser/scenario-provenance.d.ts +1 -1
  50. package/dist/browser/scenario-provenance.d.ts.map +1 -1
  51. package/dist/browser/scenario-provenance.js +15 -1
  52. package/dist/browser/scenario-provenance.js.map +1 -1
  53. package/dist/browser/scenario-runner.d.ts +10 -2
  54. package/dist/browser/scenario-runner.d.ts.map +1 -1
  55. package/dist/browser/scenario-runner.js +77 -9
  56. package/dist/browser/scenario-runner.js.map +1 -1
  57. package/dist/browser/tool-support.d.ts +5 -1
  58. package/dist/browser/tool-support.d.ts.map +1 -1
  59. package/dist/browser/tool-support.js +80 -4
  60. package/dist/browser/tool-support.js.map +1 -1
  61. package/dist/browser/wait-target.d.ts +37 -0
  62. package/dist/browser/wait-target.d.ts.map +1 -0
  63. package/dist/browser/wait-target.js +54 -0
  64. package/dist/browser/wait-target.js.map +1 -0
  65. package/dist/heap.d.ts +61 -0
  66. package/dist/heap.d.ts.map +1 -0
  67. package/dist/heap.js +82 -0
  68. package/dist/heap.js.map +1 -0
  69. package/dist/heartbeat.d.ts +46 -0
  70. package/dist/heartbeat.d.ts.map +1 -0
  71. package/dist/heartbeat.js +66 -0
  72. package/dist/heartbeat.js.map +1 -0
  73. package/dist/index.d.ts +2 -2
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +1 -1
  76. package/dist/index.js.map +1 -1
  77. package/dist/planner/predict-then-propose.d.ts +101 -0
  78. package/dist/planner/predict-then-propose.d.ts.map +1 -0
  79. package/dist/planner/predict-then-propose.js +88 -0
  80. package/dist/planner/predict-then-propose.js.map +1 -0
  81. package/dist/planner/propose-journey.d.ts +60 -0
  82. package/dist/planner/propose-journey.d.ts.map +1 -0
  83. package/dist/planner/propose-journey.js +96 -0
  84. package/dist/planner/propose-journey.js.map +1 -0
  85. package/dist/registry.d.ts +10 -1
  86. package/dist/registry.d.ts.map +1 -1
  87. package/dist/registry.js +5 -1
  88. package/dist/registry.js.map +1 -1
  89. package/dist/render.d.ts +4 -4
  90. package/dist/render.js +3 -3
  91. package/dist/scenarios/browser-run-plan-projection.d.ts +143 -0
  92. package/dist/scenarios/browser-run-plan-projection.d.ts.map +1 -0
  93. package/dist/scenarios/browser-run-plan-projection.js +228 -0
  94. package/dist/scenarios/browser-run-plan-projection.js.map +1 -0
  95. package/dist/scenarios/credential-ref.d.ts +102 -0
  96. package/dist/scenarios/credential-ref.d.ts.map +1 -0
  97. package/dist/scenarios/credential-ref.js +148 -0
  98. package/dist/scenarios/credential-ref.js.map +1 -0
  99. package/dist/scenarios/index.d.ts +4 -1
  100. package/dist/scenarios/index.d.ts.map +1 -1
  101. package/dist/scenarios/index.js +4 -1
  102. package/dist/scenarios/index.js.map +1 -1
  103. package/dist/scenarios/parse.d.ts.map +1 -1
  104. package/dist/scenarios/parse.js +42 -9
  105. package/dist/scenarios/parse.js.map +1 -1
  106. package/dist/scenarios/scenario.d.ts +39 -5
  107. package/dist/scenarios/scenario.d.ts.map +1 -1
  108. package/dist/scenarios/scenario.js +15 -2
  109. package/dist/scenarios/scenario.js.map +1 -1
  110. package/dist/scenarios/secret-ref.d.ts +86 -0
  111. package/dist/scenarios/secret-ref.d.ts.map +1 -0
  112. package/dist/scenarios/secret-ref.js +125 -0
  113. package/dist/scenarios/secret-ref.js.map +1 -0
  114. package/dist/server.d.ts +1 -1
  115. package/dist/server.d.ts.map +1 -1
  116. package/dist/server.js +8 -4
  117. package/dist/server.js.map +1 -1
  118. package/dist/session.d.ts +19 -0
  119. package/dist/session.d.ts.map +1 -1
  120. package/dist/session.js +36 -0
  121. package/dist/session.js.map +1 -1
  122. package/dist/tools/analyze-workspace.d.ts +52 -0
  123. package/dist/tools/analyze-workspace.d.ts.map +1 -0
  124. package/dist/tools/analyze-workspace.js +207 -0
  125. package/dist/tools/analyze-workspace.js.map +1 -0
  126. package/dist/tools/analyze.d.ts +50 -4
  127. package/dist/tools/analyze.d.ts.map +1 -1
  128. package/dist/tools/analyze.js +225 -5
  129. package/dist/tools/analyze.js.map +1 -1
  130. package/dist/tools/browser-close-session.d.ts +21 -1
  131. package/dist/tools/browser-close-session.d.ts.map +1 -1
  132. package/dist/tools/browser-close-session.js +71 -7
  133. package/dist/tools/browser-close-session.js.map +1 -1
  134. package/dist/tools/browser-navigate.d.ts +1 -1
  135. package/dist/tools/browser-navigate.d.ts.map +1 -1
  136. package/dist/tools/browser-navigate.js +5 -3
  137. package/dist/tools/browser-navigate.js.map +1 -1
  138. package/dist/tools/browser-run-scenario.d.ts.map +1 -1
  139. package/dist/tools/browser-run-scenario.js +6 -1
  140. package/dist/tools/browser-run-scenario.js.map +1 -1
  141. package/dist/tools/browser-save-scenario.d.ts.map +1 -1
  142. package/dist/tools/browser-save-scenario.js +84 -4
  143. package/dist/tools/browser-save-scenario.js.map +1 -1
  144. package/dist/tools/browser-select.d.ts +20 -0
  145. package/dist/tools/browser-select.d.ts.map +1 -0
  146. package/dist/tools/browser-select.js +120 -0
  147. package/dist/tools/browser-select.js.map +1 -0
  148. package/dist/tools/browser-snapshot.d.ts +17 -1
  149. package/dist/tools/browser-snapshot.d.ts.map +1 -1
  150. package/dist/tools/browser-snapshot.js +18 -5
  151. package/dist/tools/browser-snapshot.js.map +1 -1
  152. package/dist/tools/browser-start-session.d.ts.map +1 -1
  153. package/dist/tools/browser-start-session.js +161 -9
  154. package/dist/tools/browser-start-session.js.map +1 -1
  155. package/dist/tools/browser-submit.d.ts +18 -0
  156. package/dist/tools/browser-submit.d.ts.map +1 -0
  157. package/dist/tools/browser-submit.js +106 -0
  158. package/dist/tools/browser-submit.js.map +1 -0
  159. package/dist/tools/browser-wait-for.d.ts +41 -0
  160. package/dist/tools/browser-wait-for.d.ts.map +1 -0
  161. package/dist/tools/browser-wait-for.js +148 -0
  162. package/dist/tools/browser-wait-for.js.map +1 -0
  163. package/dist/tools/chain.d.ts +41 -0
  164. package/dist/tools/chain.d.ts.map +1 -0
  165. package/dist/tools/chain.js +105 -0
  166. package/dist/tools/chain.js.map +1 -0
  167. package/dist/tools/draw-conclusion.d.ts +44 -0
  168. package/dist/tools/draw-conclusion.d.ts.map +1 -0
  169. package/dist/tools/draw-conclusion.js +250 -0
  170. package/dist/tools/draw-conclusion.js.map +1 -0
  171. package/dist/tools/index.d.ts +7 -0
  172. package/dist/tools/index.d.ts.map +1 -1
  173. package/dist/tools/index.js +16 -0
  174. package/dist/tools/index.js.map +1 -1
  175. package/dist/tools/kit.d.ts +17 -0
  176. package/dist/tools/kit.d.ts.map +1 -1
  177. package/dist/tools/kit.js.map +1 -1
  178. package/dist/tools/observe-runtime.d.ts +17 -0
  179. package/dist/tools/observe-runtime.d.ts.map +1 -1
  180. package/dist/tools/observe-runtime.js +174 -10
  181. package/dist/tools/observe-runtime.js.map +1 -1
  182. package/dist/tools/predict-reach.d.ts +57 -0
  183. package/dist/tools/predict-reach.d.ts.map +1 -0
  184. package/dist/tools/predict-reach.js +159 -0
  185. package/dist/tools/predict-reach.js.map +1 -0
  186. package/dist/tools/propagation.d.ts +8 -3
  187. package/dist/tools/propagation.d.ts.map +1 -1
  188. package/dist/tools/propagation.js +16 -9
  189. package/dist/tools/propagation.js.map +1 -1
  190. package/dist/tools/propose-journey.d.ts +16 -0
  191. package/dist/tools/propose-journey.d.ts.map +1 -0
  192. package/dist/tools/propose-journey.js +121 -0
  193. package/dist/tools/propose-journey.js.map +1 -0
  194. package/dist/tools/runtime-journey-drive.d.ts +102 -0
  195. package/dist/tools/runtime-journey-drive.d.ts.map +1 -0
  196. package/dist/tools/runtime-journey-drive.js +247 -0
  197. package/dist/tools/runtime-journey-drive.js.map +1 -0
  198. package/dist/tools/scope.d.ts +3 -0
  199. package/dist/tools/scope.d.ts.map +1 -1
  200. package/dist/tools/scope.js +33 -6
  201. package/dist/tools/scope.js.map +1 -1
  202. package/dist/workspace-index.d.ts +164 -0
  203. package/dist/workspace-index.d.ts.map +1 -0
  204. package/dist/workspace-index.js +381 -0
  205. package/dist/workspace-index.js.map +1 -0
  206. package/package.json +33 -32
@@ -0,0 +1,247 @@
1
+ /**
2
+ * RG-4 — both halves in the MCP layer, and RG-6's MCP half (video).
3
+ *
4
+ * `runInstrumentedExecution`'s `onReady` fires after every declared service's
5
+ * readiness has succeeded and before the observation window's sleep — the one
6
+ * moment in a run when the application is provably up and still alive. The
7
+ * desktop already composes exactly this way (`descry-desktop/packages/session/
8
+ * src/pipeline/browser-drive.ts`, invoked from `runtime-execution.ts`'s own
9
+ * `onReady`), so that browser evidence lands in the **same `EvidenceStore`
10
+ * under the same `executionId`** as the backend's. `observe_runtime` here
11
+ * never did: it passed no `onReady` and never drove a browser, so an MCP
12
+ * client got two calls with two lifetimes and nothing to prove they were the
13
+ * same run.
14
+ *
15
+ * This module is the MCP equivalent of the desktop's `browser-drive.ts` —
16
+ * same collectors, same package, same "never fabricate a step" discipline —
17
+ * built as its own file because `packages/mcp/src/browser/driver.ts` and
18
+ * `playwright-driver.ts` are lane identity's (a session-scoped, interactive
19
+ * `BrowserDriver` port for the `browser_*` tools' own lifetime) and this is a
20
+ * different lifetime entirely: one drive, bound to one execution's readiness
21
+ * window, torn down before that execution's observation window even starts.
22
+ * Composing through the identity lane's port would mean threading a whole
23
+ * interactive session through a callback that must complete before
24
+ * `onReady` returns — the wrong shape for what is, structurally, a single
25
+ * batch replay. `@descryy/runtime-browser`'s own collectors compose directly
26
+ * instead, the same way the desktop does it.
27
+ *
28
+ * ## The journey comes from the caller, projected by the ONE shared format
29
+ *
30
+ * `DEC-NEXT-runtime-journey-is-one-declared-format` (Q1) settled this: a
31
+ * saved `Scenario` and a driveable step list are two views of one format,
32
+ * and lane journey built the single projection both directions go through —
33
+ * `../scenarios/browser-run-plan-projection.ts`'s `projectScenarioToRunPlan`.
34
+ * This module calls that function and nothing else invents a second
35
+ * translation of the same scenario. Its own header explains exactly what
36
+ * projects and what refuses (seven shared verbs; `fill`, whole-page
37
+ * assertions and anything outside those seven are refused by name, never
38
+ * silently narrowed), and secret references are resolved inside it before
39
+ * this module ever sees a step — see that module's own doc.
40
+ *
41
+ * A `Scenario` with no steps drives to `startUrl` and observes, same as an
42
+ * empty step list does anywhere else in this codebase. No step is ever
43
+ * synthesized here.
44
+ *
45
+ * `@descryy/runtime-browser`'s `BrowserActionCollector` happens to support
46
+ * more than the shared projection's seven verbs (`assertVisible`/`assertText`
47
+ * included) — this module drives every one of the seven the projection
48
+ * can produce, which is a strict superset of what the desktop's narrower
49
+ * `BrowserStep` union can act on. `fill` is not among them: the shared
50
+ * projection refuses it because `BrowserStep` (the format's other consumer)
51
+ * has no counterpart for it, a decision this module does not own and does
52
+ * not work around — see the projection's own header for why collapsing it
53
+ * into `type` would be exactly the kind of silent narrowing rule 2 forbids.
54
+ */
55
+ import { createBrowserActionCollector, createBrowserConsoleCollector, createBrowserNetworkCollector, launchBrowserSession, } from "@descryy/runtime-browser";
56
+ import { projectScenarioToRunPlan } from "../scenarios/browser-run-plan-projection.js";
57
+ export { projectScenarioToRunPlan };
58
+ const DEFAULT_SETTLE_FOR_MS = 1_000;
59
+ export function createRuntimeJourneyDrive(plan) {
60
+ const launch = plan.launchSession ?? launchBrowserSession;
61
+ const steps = plan.steps ?? [];
62
+ return async (input) => {
63
+ const harnessError = (detail) => {
64
+ input.store.write({
65
+ executionId: input.executionId,
66
+ timestamp: new Date().toISOString(),
67
+ source: "harness",
68
+ service: plan.service ?? null,
69
+ process: null,
70
+ eventType: "COLLECTOR_ERROR",
71
+ payload: { raw: detail, error: detail, collectorId: "runtime-journey-drive" },
72
+ traceId: null,
73
+ requestId: null,
74
+ correlationId: null,
75
+ graphNodeId: null,
76
+ sourceLocation: null,
77
+ stackTrace: null,
78
+ confidence: 1,
79
+ collectorVersion: RUNTIME_JOURNEY_DRIVE_VERSION,
80
+ });
81
+ };
82
+ let session;
83
+ try {
84
+ session = await launch({
85
+ headless: plan.headless ?? true,
86
+ ...(plan.recordVideo === true ? { recordVideo: true } : {}),
87
+ });
88
+ }
89
+ catch (error) {
90
+ const cause = describe(error);
91
+ const disclosure = `No browser was driven for this run: the browser session could not be launched (${cause}). ` +
92
+ `Backend evidence is unaffected — this drive runs inside the readiness window and never blocks it.`;
93
+ harnessError(disclosure);
94
+ return { ran: false, startUrl: plan.startUrl, stepsCompleted: 0, stepsRefused: [], videoBytes: null, disclosure };
95
+ }
96
+ const actions = createBrowserActionCollector({ session, ...(plan.service === undefined ? {} : { service: plan.service }) });
97
+ const consoleCollector = createBrowserConsoleCollector({
98
+ session,
99
+ ...(plan.service === undefined ? {} : { service: plan.service }),
100
+ ...(input.stackTraceParser === undefined ? {} : { stackTraceParser: input.stackTraceParser }),
101
+ });
102
+ const networkCollector = createBrowserNetworkCollector({
103
+ session,
104
+ ...(plan.service === undefined ? {} : { service: plan.service }),
105
+ ...(input.stackTraceParser === undefined ? {} : { stackTraceParser: input.stackTraceParser }),
106
+ });
107
+ const context = {
108
+ executionId: input.executionId,
109
+ configuration: input.configuration,
110
+ emit: (evidence) => {
111
+ input.store.write({ ...evidence, executionId: input.executionId });
112
+ },
113
+ ...(input.resolveSourceRoot === undefined ? {} : { resolveSourceRoot: input.resolveSourceRoot }),
114
+ };
115
+ const refusals = [];
116
+ const unavailable = [];
117
+ let completed = 0;
118
+ let videoBytes = null;
119
+ try {
120
+ for (const [name, collector] of [
121
+ ["browser-console", consoleCollector],
122
+ ["browser-network", networkCollector],
123
+ ["browser-action", actions],
124
+ ]) {
125
+ try {
126
+ const started = await collector.start(context);
127
+ if (!started.available)
128
+ unavailable.push(`${name} (${started.reason ?? "no reason given"})`);
129
+ }
130
+ catch (error) {
131
+ unavailable.push(`${name} (start() threw: ${describe(error)})`);
132
+ harnessError(`browser collector "${name}" threw during start(): ${describe(error)}`);
133
+ }
134
+ }
135
+ await actions.navigate(plan.startUrl);
136
+ for (const [index, step] of steps.entries()) {
137
+ try {
138
+ await runStep(actions, step);
139
+ completed += 1;
140
+ }
141
+ catch (error) {
142
+ const reason = describe(error);
143
+ refusals.push({ index, kind: step.kind, reason });
144
+ harnessError(`journey step ${String(index + 1)} (${step.kind}) could not be performed: ${reason}`);
145
+ }
146
+ }
147
+ await sleep(plan.settleForMs ?? DEFAULT_SETTLE_FOR_MS);
148
+ }
149
+ catch (error) {
150
+ const cause = describe(error);
151
+ harnessError(`the journey drive stopped early: ${cause}`);
152
+ refusals.push({ index: completed, kind: "navigate", reason: cause });
153
+ }
154
+ // Same ordering constraint as the desktop's browser-drive.ts: captureVideo() must run
155
+ // after session.close() (Playwright only finalizes recordVideo once the context closes)
156
+ // and before actions.stop() (which clears the emit channel it writes into).
157
+ videoBytes = await finish(consoleCollector, networkCollector, actions, session, input, harnessError);
158
+ const disclosure = describeShortfall(unavailable, refusals, plan);
159
+ return { ran: true, startUrl: plan.startUrl, stepsCompleted: completed, stepsRefused: refusals, videoBytes, disclosure };
160
+ };
161
+ }
162
+ async function finish(consoleCollector, networkCollector, actions, session, input, harnessError) {
163
+ const before = countVideoBytes(input);
164
+ for (const [name, stop] of [
165
+ ["browser-console", () => consoleCollector.stop()],
166
+ ["browser-network", () => networkCollector.stop()],
167
+ ["browser-session", () => session.close()],
168
+ ["browser-video", () => actions.captureVideo()],
169
+ ["browser-action", () => actions.stop()],
170
+ ]) {
171
+ try {
172
+ await stop();
173
+ }
174
+ catch (error) {
175
+ harnessError(`journey drive teardown step "${name}" failed: ${describe(error)}`);
176
+ }
177
+ }
178
+ const after = countVideoBytes(input);
179
+ return after === before ? null : after;
180
+ }
181
+ function countVideoBytes(input) {
182
+ for (const evidence of input.store.getByExecution(input.executionId)) {
183
+ if (evidence.eventType !== "VIDEO")
184
+ continue;
185
+ const payload = evidence.payload;
186
+ if (typeof payload?.videoBase64 !== "string")
187
+ continue;
188
+ return Buffer.from(payload.videoBase64, "base64").length;
189
+ }
190
+ return null;
191
+ }
192
+ /** Never throws on a step this module cannot resolve to an action — that would surface as a
193
+ * bare refusal with a useless reason; a `ProjectedStep` naming no target/text for a kind that
194
+ * needs one is a defect in the projection this module trusts rather than something to re-check
195
+ * here, so those are stated plainly rather than re-validated. */
196
+ async function runStep(actions, step) {
197
+ switch (step.kind) {
198
+ case "navigate":
199
+ if (step.url === null)
200
+ throw new Error(`"navigate" step carries no url`);
201
+ return actions.navigate(step.url);
202
+ case "click":
203
+ return actions.click(requireSelector(step));
204
+ case "type":
205
+ return actions.type(requireSelector(step), requireText(step));
206
+ case "select":
207
+ return actions.select(requireSelector(step), requireText(step));
208
+ case "submit":
209
+ return actions.submit(requireSelector(step));
210
+ case "assertVisible":
211
+ return actions.assertVisible(requireSelector(step));
212
+ case "assertText":
213
+ return actions.assertText(requireSelector(step), requireText(step));
214
+ }
215
+ }
216
+ function requireSelector(step) {
217
+ if (step.target === null)
218
+ throw new Error(`"${step.kind}" step carries no target`);
219
+ return step.target.selector;
220
+ }
221
+ function requireText(step) {
222
+ if (step.text === null)
223
+ throw new Error(`"${step.kind}" step carries no text`);
224
+ return step.text;
225
+ }
226
+ function describeShortfall(unavailable, refusals, plan) {
227
+ const parts = [];
228
+ if (unavailable.length > 0) {
229
+ parts.push(`These browser collectors reported themselves unavailable and observed nothing: ${unavailable.join("; ")}.`);
230
+ }
231
+ if (refusals.length > 0) {
232
+ parts.push(`${String(refusals.length)} of ${String((plan.steps ?? []).length)} declared journey step(s) could not be performed: ` +
233
+ refusals.map((r) => `step ${String(r.index + 1)} (${r.kind}): ${r.reason}`).join("; ") +
234
+ ".");
235
+ }
236
+ return parts.length === 0 ? null : parts.join(" ");
237
+ }
238
+ function describe(error) {
239
+ return error instanceof Error ? `${error.name}: ${error.message}` : String(error);
240
+ }
241
+ function sleep(ms) {
242
+ return new Promise((resolve) => setTimeout(resolve, ms));
243
+ }
244
+ /** This module's own collector version, distinct from `@descryy/runtime-browser`'s — these rows
245
+ * are the composition lane's own harness reports about driving, not the browser package's. */
246
+ export const RUNTIME_JOURNEY_DRIVE_VERSION = "descry-mcp-runtime-journey-drive@1";
247
+ //# sourceMappingURL=runtime-journey-drive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-journey-drive.js","sourceRoot":"","sources":["../../src/tools/runtime-journey-drive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,OAAO,EACL,4BAA4B,EAC5B,6BAA6B,EAC7B,6BAA6B,EAC7B,oBAAoB,GAIrB,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EAAE,wBAAwB,EAA+C,MAAM,6CAA6C,CAAC;AAGpI,OAAO,EAAE,wBAAwB,EAAE,CAAC;AA4CpC,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAEpC,MAAM,UAAU,yBAAyB,CAAC,IAAiB;IACzD,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,IAAI,oBAAoB,CAAC;IAC1D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;IAE/B,OAAO,KAAK,EAAE,KAAwB,EAAgC,EAAE;QACtE,MAAM,YAAY,GAAG,CAAC,MAAc,EAAQ,EAAE;YAC5C,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;gBAChB,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACnC,MAAM,EAAE,SAAS;gBACjB,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,IAAI;gBAC7B,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,iBAAiB;gBAC5B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TierCount {
20
20
  readonly count: number;
21
21
  }
22
22
  export interface ScopeReport {
23
+ /** Capped by `limit`; `changedTotal` is the uncapped count. Every seed is
24
+ * traversed either way — the cap shortens the listing, not the analysis. */
23
25
  readonly changed: readonly ScopedNodeReport[];
26
+ readonly changedTotal: number;
24
27
  /** Capped by `limit`; `affectedTotal` is the uncapped count. */
25
28
  readonly affected: readonly ScopedNodeReport[];
26
29
  readonly affectedTotal: number;
@@ -1 +1 @@
1
- {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/tools/scope.ts"],"names":[],"mappings":"AAAA;;;;0FAI0F;AAE1F,OAAO,EAA8C,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAC3F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAOL,KAAK,SAAS,EAEd,KAAK,cAAc,EACpB,MAAM,UAAU,CAAC;AAIlB,iDAAiD;AACjD,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,sEAAsE;IACtE,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC;CACzB;AAED,8EAA8E;AAC9E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC/C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,M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;IAC9B,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC/C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,CAAC;CAC5C;AAED;;mCAEmC;AACnC,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,cAAc,CAAC;AAoMrD,eAAO,MAAM,SAAS,EAAE,cAavB,CAAC"}
@@ -34,9 +34,11 @@ const SCHEMA = {
34
34
  limit: {
35
35
  type: "integer",
36
36
  minimum: 1,
37
- description: "Cap how many affected nodes come back in the reply. Default 25 (MK-9 — the same walk-cost " +
38
- "reduction impact.ts applies, for the same reason). A capped reply always discloses " +
39
- "shown/total; raise this explicitly when the full set is needed.",
37
+ description: "Cap how many nodes come back in the reply — applied to the changed list and the affected " +
38
+ "list alike. Default 25 (MK-9 — the same walk-cost reduction impact.ts applies, for the " +
39
+ "same reason). Capping the changed list shortens only the listing: every changed symbol " +
40
+ "still seeds the traversal, and changedTotal reports how many there were. A capped reply " +
41
+ "always discloses shown/total; raise this explicitly when the full set is needed.",
40
42
  },
41
43
  },
42
44
  additionalProperties: false,
@@ -112,17 +114,42 @@ async function run(args, ctx) {
112
114
  `listed here — the reply is capped at ${limit}. Raise "limit" to see them; they were ` +
113
115
  "analysed either way.");
114
116
  }
117
+ // P6-B5. `limit` used to bound `affected` alone, and `changed` — one entry per
118
+ // symbol declared in the named files — went out whole. That is unbounded by
119
+ // anything the caller controls: it is the size of the files they named, not of
120
+ // the answer they asked for. One generated file produced 638 entries and 162k
121
+ // characters, past the client's token limit, and the invariant sweep in
122
+ // `truncation-invariant.test.ts` could not catch it because an uncapped list
123
+ // emits no capping prose to scan for. The seeds are still all *analysed* — the
124
+ // traversal runs over every one of them, and `changedTotal` reports how many
125
+ // there were, so a capped list can never read as a smaller change than it was.
126
+ const changedCap = capped(scoped.data.changed, limit);
127
+ if (changedCap.detail !== null) {
128
+ notes.push(`${changedCap.detail.total - changedCap.detail.shown} of ${changedCap.detail.total} changed ` +
129
+ `symbol(s) are not listed here — the reply is capped at ${limit}. All ${changedCap.detail.total} ` +
130
+ 'seeded the traversal; only the listing is shortened. Raise "limit" to see them.');
131
+ }
115
132
  const byTier = [1, 2, 3, 4].map((tier) => ({
116
133
  tier,
117
134
  count: tier === 1
118
135
  ? scoped.data.changed.length
119
136
  : affected.filter((node) => node.tier === tier).length,
120
137
  }));
138
+ // One `truncatedDetail` for a reply that now caps two lists: the rows carried
139
+ // versus the rows there were. Summing is the only reading of "the primary
140
+ // collection" that stays true when either list is cut — reporting `affected`'s
141
+ // pair alone would say nothing was withheld on a reply that withheld 290 seeds.
142
+ const shownRows = changedCap.shown.length + cap.shown.length;
143
+ const totalRows = scoped.data.changed.length + affected.length;
144
+ const truncatedDetail = changedCap.detail === null && cap.detail === null
145
+ ? null
146
+ : { shown: shownRows, total: totalRows, more: null };
121
147
  return {
122
148
  result: {
123
149
  ...scoped,
124
150
  data: {
125
- changed: scoped.data.changed.map(shape),
151
+ changed: changedCap.shown.map(shape),
152
+ changedTotal: scoped.data.changed.length,
126
153
  affected: cap.shown.map(shape),
127
154
  affectedTotal: affected.length,
128
155
  droppedForBudget: scoped.data.dropped.length,
@@ -133,10 +160,10 @@ async function run(args, ctx) {
133
160
  // Deliberately not `scoped.truncated` (the node *budget*'s own drop flag,
134
161
  // disclosed separately via `droppedForBudget`) — this `truncated` means "this
135
162
  // reply is shorter than the scope computed," a different fact from that.
136
- truncated: cap.detail !== null,
163
+ truncated: truncatedDetail !== null,
137
164
  notes: [...scoped.notes, ...notes],
138
165
  },
139
- ...(cap.detail === null ? {} : { truncatedDetail: cap.detail }),
166
+ ...(truncatedDetail === null ? {} : { truncatedDetail }),
140
167
  ...(affected.length === 0 ? { state: "empty" } : {}),
141
168
  nameLevel: true,
142
169
  headline: `${scoped.data.changed.length} changed symbol(s) reach ${affected.length} other node(s) ` +
@@ -1 +1 @@
1
- {"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/tools/scope.ts"],"names":[],"mappings":"AAAA;;;;0FAI0F;AAE1F,OAAO,EAAE,YAAY,EAAE,WAAW,EAAmC,MAAM,eAAe,CAAC;AAG3F,OAAO,EACL,MAAM,EACN,SAAS,EACT,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,cAAc,GAIf,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAwCtC,MAAM,QAAQ,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,CAAU,CAAC;AAExD,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,KAAK,EAAE;YACL,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACzB,WAAW,EACT,uFAAuF;gBACvF,eAAe;SAClB;QACD,OAAO,EAAE;YACP,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACzB,WAAW,EAAE,uEAAuE;SACrF;QACD,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC;YACnB,WAAW,EACT,4EAA4E;SAC/E;QACD,MAAM,EAAE;YACN,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,qCAAqC;SACnD;QACD,KAA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AgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7D,SAAS,EAAE,IAAI;QACf,QAAQ,EACN,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,4BAA4B,QAAQ,CAAC,MAAM,iBAAiB;YACzF,yCAAyC,OAAO,cAAc,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG;KACtF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAmB;IACvC,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,0BAA0B;IACjC,WAAW,EACT,8FAA8F;QAC9F,yFAAyF;QACzF,8FAA8F;QAC9F,0EAA0E;IAC5E,WAAW,EAAE,MAA4C;IACzD,GAAG;CACJ,CAAC"}
@@ -0,0 +1,164 @@
1
+ /**
2
+ * `indexWorkspace` — the cross-repo counterpart of `analyze`'s single-repo run.
3
+ *
4
+ * Gap 1 of `documents/plans/site-claims-closure-production-plan.md`. A
5
+ * standalone function, **not** a second constructor on `Session` — see that
6
+ * plan section for why: `session.ts`'s own header states "one repo, one
7
+ * graph, one process", `DescryConfig` is singular throughout, and well over a
8
+ * dozen other tool files read `session.config`/`session.repoPath` as singular
9
+ * values. Widening `Session` itself would mean widening all of them. This
10
+ * function instead does, once per repository in a loop, exactly what
11
+ * `analyze.ts`'s `run()` already does once per source — load a repository's
12
+ * own configured sources, detect, emit, read its git history — and then
13
+ * merges and persists every repository's batches together in **one**
14
+ * `buildGraph`/`persistGraph` pass, into one shared store.
15
+ *
16
+ * Ported in spirit from `descry-desktop`'s `packages/session/src/indexing
17
+ * /index.ts` (`indexRepository`), which solved the same "index N
18
+ * repositories into one store" problem for the desktop app's engine. The
19
+ * adaptation reuses `descry-core`'s own existing per-repo pieces —
20
+ * `loadConfig`, `registry.ts`'s `loadSources`/`detectSources`, `analyze.ts`'s
21
+ * `optionalBatchLists`/`sourceFailureNote`/`sourceProvenanceNote` — instead of
22
+ * re-discovering adapters or re-deriving batch handling, because those
23
+ * already live in this package (`@descryy/mcp`) beside `analyze.ts`; there
24
+ * was nothing to extract into `@descryy/core`.
25
+ *
26
+ * ## Why every repository's batches are merged in one `buildGraph` call,
27
+ * ## not one call per repository
28
+ *
29
+ * `buildGraph`'s `JoinMetric`/`crossRepoJoins` (`packages/core/src/graph
30
+ * /build.ts`) is computed from the batches handed to *that one call*: it
31
+ * counts, per workspace-scoped node type, how many of the repositories
32
+ * represented **in that call** supplied a node with the same id. A
33
+ * `buildGraph` call given only one repository's batches at a time can never
34
+ * see two repositories agreeing on an id — `crossRepoJoinPossible` would be
35
+ * false for every type on every call, and the workspace join `analyze_workspace`
36
+ * exists to prove would be invisible in its own reply. So every repository in
37
+ * this call is read first, and their batches are combined into one list
38
+ * before `buildGraph` runs once — the same shape `analyze.ts` already uses
39
+ * for merging one repository's several *sources*, extended one level up to
40
+ * merging several *repositories*. `persistGraph` still writes each batch's
41
+ * rows under its own `producedBy` (DEC-014's per-adapter invalidation rule is
42
+ * unaffected — a batch is still a batch, whichever repository it came from).
43
+ *
44
+ * ## What this deliberately does not do
45
+ *
46
+ * Unlike `analyze.ts`'s `run()`, this does not mint edges from confirmed
47
+ * facts or re-project confirmed incidents — both are per-repository testimony
48
+ * recorded in that repository's own `.descry/config.json`, and folding them
49
+ * into a cross-repo indexing pass is a separate, unscoped question. A
50
+ * repository indexed through `indexWorkspace` gets the code-reading half of
51
+ * what `analyze` gives it; the two are not currently unified, and that is
52
+ * disclosed by the caller (`analyze_workspace`), not silently assumed away
53
+ * here.
54
+ */
55
+ import { type AmbiguousApiJoin, type AmbiguousTableJoin, type BuildResult, type GraphStamp, type ResolvedApiJoin, type ResolvedTableJoin, type StoreCounts } from "@descryy/core";
56
+ import { type SourceRun } from "./tools/analyze.ts";
57
+ export interface IndexWorkspaceRepoInput {
58
+ /** Absolute path to the repository on disk. */
59
+ readonly repoPath: string;
60
+ /**
61
+ * The repository's identity as `link_workspace` recorded it
62
+ * (`WorkspaceRepo.repo`). Used only when the repository's own
63
+ * `.descry/config.json` cannot be read at all — whenever it can, its own
64
+ * `repo` field wins instead, because that is the value its adapters
65
+ * actually hash node ids under; a mismatch between the two is disclosed,
66
+ * never silently resolved one way (`repoIdentityNote`).
67
+ */
68
+ readonly repo: string;
69
+ }
70
+ export interface IndexWorkspaceRepoResult {
71
+ readonly repo: string;
72
+ readonly repoPath: string;
73
+ /** `null` when this repository could not be read at all — not a git repository, or its config would not load. */
74
+ readonly commitSha: string | null;
75
+ readonly sources: readonly SourceRun[];
76
+ readonly sourcesFailed: readonly {
77
+ readonly module: string;
78
+ readonly reason: string;
79
+ }[];
80
+ readonly sourcesSkipped: readonly {
81
+ readonly source: string;
82
+ readonly reason: string;
83
+ }[];
84
+ readonly notes: readonly string[];
85
+ /** This repository's share of the one shared-store write this call made. */
86
+ readonly written: {
87
+ readonly nodes: number;
88
+ readonly edges: number;
89
+ readonly unresolved: number;
90
+ readonly evictedFiles: number;
91
+ };
92
+ /** Lowest resolution reached by a code-reading source in this repository, or 0 if none ran. */
93
+ readonly reachedResolution: number;
94
+ }
95
+ export interface IndexWorkspaceProgress {
96
+ readonly repo: string;
97
+ readonly phase: "detecting" | "emitting" | "history" | "merging" | "writing" | "done";
98
+ readonly completed: number;
99
+ readonly total: number;
100
+ }
101
+ export interface IndexWorkspaceOptions {
102
+ readonly workspaceId: string;
103
+ readonly repos: readonly IndexWorkspaceRepoInput[];
104
+ /** Where to open/create the shared store. Passed straight to `openStore`. */
105
+ readonly graphDbPath: string;
106
+ /** Default true, matching `analyze`'s own default. */
107
+ readonly includeHistory?: boolean;
108
+ readonly maxCommits?: number;
109
+ readonly onProgress?: (progress: IndexWorkspaceProgress) => void;
110
+ readonly signal?: AbortSignal;
111
+ }
112
+ export interface IndexWorkspaceResult {
113
+ readonly workspaceId: string;
114
+ readonly graphDbPath: string;
115
+ /** One entry per repository requested, in the order given — including one for a repository that could not be read at all. */
116
+ readonly repos: readonly IndexWorkspaceRepoResult[];
117
+ /** Row counts in the shared store after every repository has been indexed. */
118
+ readonly stored: StoreCounts;
119
+ /** The shared store's own stamp — `repoCount` here is the fact that this graph now spans more than one repository, not a staleness signal (`GraphStamp`'s own doc). `resolutionFloor` is this call's own, mirroring `analyze`'s (the minimum across every repository's code-reading sources; 0 if none ran anywhere). */
120
+ readonly stamp: GraphStamp;
121
+ readonly merge: {
122
+ readonly mergedNodes: number;
123
+ readonly mergedEdges: number;
124
+ readonly collisions: number;
125
+ readonly droppedEdges: number;
126
+ readonly rejections: number;
127
+ };
128
+ /** Per workspace-scoped node type: whether this call actually saw the join happen (DEC-054).
129
+ * API_ENDPOINT is no longer one of these types (DEC-NEXT-endpoint-identity-repo-scoping) —
130
+ * see `apiJoins` for its own, separate join accounting. */
131
+ readonly crossRepoJoins: BuildResult["crossRepoJoins"];
132
+ /** The staged frontend-to-backend API_ENDPOINT join (Gap 10,
133
+ * `packages/core/src/contracts/workspace-join.ts`) — run once, after `buildGraph`, over the
134
+ * whole merged workspace graph. */
135
+ readonly apiJoins: {
136
+ readonly resolved: readonly ResolvedApiJoin[];
137
+ readonly ambiguous: readonly AmbiguousApiJoin[];
138
+ readonly unmatched: number;
139
+ readonly unkeyed: number;
140
+ };
141
+ /** The staged cross-repo DATABASE_TABLE/DATABASE_COLUMN join (Gap 10's table
142
+ * half, `packages/core/src/contracts/workspace-table-join.ts`) — run once,
143
+ * after `buildGraph` and the API_ENDPOINT join, over the whole merged
144
+ * workspace graph. */
145
+ readonly tableJoins: {
146
+ readonly resolved: readonly ResolvedTableJoin[];
147
+ readonly ambiguous: readonly AmbiguousTableJoin[];
148
+ readonly unkeyed: number;
149
+ readonly singletons: number;
150
+ };
151
+ readonly notes: readonly string[];
152
+ }
153
+ /**
154
+ * Index every repository in `options.repos` into one shared graph store at
155
+ * `options.graphDbPath`, creating it if absent.
156
+ *
157
+ * One repository failing to read — not a git repository, an unreadable
158
+ * config, every adapter refusing it — costs only its own rows; the others
159
+ * are still read, merged and persisted, the same "one adapter's failure
160
+ * costs its own rows and nothing else" posture `analyze.ts` already takes one
161
+ * level down.
162
+ */
163
+ export declare function indexWorkspace(options: IndexWorkspaceOptions): Promise<IndexWorkspaceResult>;
164
+ //# sourceMappingURL=workspace-index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-index.d.ts","sourceRoot":"","sources":["../src/workspace-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAMH,OAAO,EAgBL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AAIvB,OAAO,EAA+D,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEjH,MAAM,WAAW,uBAAuB;IACtC,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,iHAAiH;IACjH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,CAAC;IACvC,QAAQ,CAAC,aAAa,EAAE,SAAS;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxF,QAAQ,CAAC,cAAc,EAAE,SAAS;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAA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