scoutline 0.1.0 → 0.6.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 (242) hide show
  1. package/README.md +394 -7
  2. package/bin/scoutline.js +36 -15
  3. package/dist/capabilities/diagnostics.d.ts +135 -0
  4. package/dist/capabilities/diagnostics.d.ts.map +1 -0
  5. package/dist/capabilities/diagnostics.js +139 -0
  6. package/dist/capabilities/diagnostics.js.map +1 -0
  7. package/dist/capabilities/quota.d.ts +99 -0
  8. package/dist/capabilities/quota.d.ts.map +1 -0
  9. package/dist/capabilities/quota.js +129 -0
  10. package/dist/capabilities/quota.js.map +1 -0
  11. package/dist/capabilities/reader.d.ts +227 -0
  12. package/dist/capabilities/reader.d.ts.map +1 -0
  13. package/dist/capabilities/reader.js +100 -0
  14. package/dist/capabilities/reader.js.map +1 -0
  15. package/dist/capabilities/repository.d.ts +221 -0
  16. package/dist/capabilities/repository.d.ts.map +1 -0
  17. package/dist/capabilities/repository.js +172 -0
  18. package/dist/capabilities/repository.js.map +1 -0
  19. package/dist/capabilities/search.d.ts +110 -0
  20. package/dist/capabilities/search.d.ts.map +1 -0
  21. package/dist/capabilities/search.js +21 -0
  22. package/dist/capabilities/search.js.map +1 -0
  23. package/dist/capabilities/vision.d.ts +156 -0
  24. package/dist/capabilities/vision.d.ts.map +1 -0
  25. package/dist/capabilities/vision.js +111 -0
  26. package/dist/capabilities/vision.js.map +1 -0
  27. package/dist/command-invocation.d.ts +58 -0
  28. package/dist/command-invocation.d.ts.map +1 -0
  29. package/dist/command-invocation.js +95 -0
  30. package/dist/command-invocation.js.map +1 -0
  31. package/dist/commands/cache.d.ts +106 -0
  32. package/dist/commands/cache.d.ts.map +1 -0
  33. package/dist/commands/cache.js +203 -0
  34. package/dist/commands/cache.js.map +1 -0
  35. package/dist/commands/code.d.ts +11 -4
  36. package/dist/commands/code.d.ts.map +1 -1
  37. package/dist/commands/code.js +16 -42
  38. package/dist/commands/code.js.map +1 -1
  39. package/dist/commands/doctor.d.ts +69 -3
  40. package/dist/commands/doctor.d.ts.map +1 -1
  41. package/dist/commands/doctor.js +179 -52
  42. package/dist/commands/doctor.js.map +1 -1
  43. package/dist/commands/quota.d.ts +45 -3
  44. package/dist/commands/quota.d.ts.map +1 -1
  45. package/dist/commands/quota.js +116 -60
  46. package/dist/commands/quota.js.map +1 -1
  47. package/dist/commands/read.d.ts +76 -2
  48. package/dist/commands/read.d.ts.map +1 -1
  49. package/dist/commands/read.js +260 -121
  50. package/dist/commands/read.js.map +1 -1
  51. package/dist/commands/repo.d.ts +55 -4
  52. package/dist/commands/repo.d.ts.map +1 -1
  53. package/dist/commands/repo.js +115 -172
  54. package/dist/commands/repo.js.map +1 -1
  55. package/dist/commands/repository-explorer.d.ts +147 -0
  56. package/dist/commands/repository-explorer.d.ts.map +1 -0
  57. package/dist/commands/repository-explorer.js +550 -0
  58. package/dist/commands/repository-explorer.js.map +1 -0
  59. package/dist/commands/search.d.ts +27 -2
  60. package/dist/commands/search.d.ts.map +1 -1
  61. package/dist/commands/search.js +95 -103
  62. package/dist/commands/search.js.map +1 -1
  63. package/dist/commands/tools.d.ts +9 -3
  64. package/dist/commands/tools.d.ts.map +1 -1
  65. package/dist/commands/tools.js +29 -59
  66. package/dist/commands/tools.js.map +1 -1
  67. package/dist/commands/vision.d.ts +35 -9
  68. package/dist/commands/vision.d.ts.map +1 -1
  69. package/dist/commands/vision.js +184 -131
  70. package/dist/commands/vision.js.map +1 -1
  71. package/dist/index.d.ts +62 -1
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +580 -223
  74. package/dist/index.js.map +1 -1
  75. package/dist/lib/cache.d.ts +178 -12
  76. package/dist/lib/cache.d.ts.map +1 -1
  77. package/dist/lib/cache.js +377 -39
  78. package/dist/lib/cache.js.map +1 -1
  79. package/dist/lib/code-mode.d.ts +13 -0
  80. package/dist/lib/code-mode.d.ts.map +1 -1
  81. package/dist/lib/code-mode.js +26 -6
  82. package/dist/lib/code-mode.js.map +1 -1
  83. package/dist/lib/config.d.ts.map +1 -1
  84. package/dist/lib/config.js +15 -18
  85. package/dist/lib/config.js.map +1 -1
  86. package/dist/lib/errors.d.ts +89 -11
  87. package/dist/lib/errors.d.ts.map +1 -1
  88. package/dist/lib/errors.js +168 -21
  89. package/dist/lib/errors.js.map +1 -1
  90. package/dist/lib/execution.d.ts +190 -0
  91. package/dist/lib/execution.d.ts.map +1 -0
  92. package/dist/lib/execution.js +383 -0
  93. package/dist/lib/execution.js.map +1 -0
  94. package/dist/lib/index.d.ts +10 -2
  95. package/dist/lib/index.d.ts.map +1 -1
  96. package/dist/lib/index.js +10 -2
  97. package/dist/lib/index.js.map +1 -1
  98. package/dist/lib/mcp-client.d.ts +75 -16
  99. package/dist/lib/mcp-client.d.ts.map +1 -1
  100. package/dist/lib/mcp-client.js +173 -108
  101. package/dist/lib/mcp-client.js.map +1 -1
  102. package/dist/lib/mcp-config.d.ts +17 -0
  103. package/dist/lib/mcp-config.d.ts.map +1 -1
  104. package/dist/lib/mcp-config.js +29 -0
  105. package/dist/lib/mcp-config.js.map +1 -1
  106. package/dist/lib/monitor-client.d.ts +17 -3
  107. package/dist/lib/monitor-client.d.ts.map +1 -1
  108. package/dist/lib/monitor-client.js +23 -69
  109. package/dist/lib/monitor-client.js.map +1 -1
  110. package/dist/lib/output.d.ts +53 -7
  111. package/dist/lib/output.d.ts.map +1 -1
  112. package/dist/lib/output.js +126 -39
  113. package/dist/lib/output.js.map +1 -1
  114. package/dist/lib/redact.d.ts +62 -3
  115. package/dist/lib/redact.d.ts.map +1 -1
  116. package/dist/lib/redact.js +165 -31
  117. package/dist/lib/redact.js.map +1 -1
  118. package/dist/lib/tool-cache.d.ts +86 -0
  119. package/dist/lib/tool-cache.d.ts.map +1 -0
  120. package/dist/lib/tool-cache.js +123 -0
  121. package/dist/lib/tool-cache.js.map +1 -0
  122. package/dist/lib/tty.d.ts +7 -20
  123. package/dist/lib/tty.d.ts.map +1 -1
  124. package/dist/lib/tty.js +51 -30
  125. package/dist/lib/tty.js.map +1 -1
  126. package/dist/node-command-invocation-adapter.d.ts +28 -0
  127. package/dist/node-command-invocation-adapter.d.ts.map +1 -0
  128. package/dist/node-command-invocation-adapter.js +88 -0
  129. package/dist/node-command-invocation-adapter.js.map +1 -0
  130. package/dist/providers/minimax/adapter.d.ts +49 -0
  131. package/dist/providers/minimax/adapter.d.ts.map +1 -0
  132. package/dist/providers/minimax/adapter.js +450 -0
  133. package/dist/providers/minimax/adapter.js.map +1 -0
  134. package/dist/providers/minimax/coding-plan-client.d.ts +60 -0
  135. package/dist/providers/minimax/coding-plan-client.d.ts.map +1 -0
  136. package/dist/providers/minimax/coding-plan-client.js +204 -0
  137. package/dist/providers/minimax/coding-plan-client.js.map +1 -0
  138. package/dist/providers/minimax/config.d.ts +32 -0
  139. package/dist/providers/minimax/config.d.ts.map +1 -0
  140. package/dist/providers/minimax/config.js +84 -0
  141. package/dist/providers/minimax/config.js.map +1 -0
  142. package/dist/providers/minimax/media.d.ts +88 -0
  143. package/dist/providers/minimax/media.d.ts.map +1 -0
  144. package/dist/providers/minimax/media.js +232 -0
  145. package/dist/providers/minimax/media.js.map +1 -0
  146. package/dist/providers/minimax/quota-client.d.ts +44 -0
  147. package/dist/providers/minimax/quota-client.d.ts.map +1 -0
  148. package/dist/providers/minimax/quota-client.js +83 -0
  149. package/dist/providers/minimax/quota-client.js.map +1 -0
  150. package/dist/providers/minimax/quota.d.ts +48 -0
  151. package/dist/providers/minimax/quota.d.ts.map +1 -0
  152. package/dist/providers/minimax/quota.js +120 -0
  153. package/dist/providers/minimax/quota.js.map +1 -0
  154. package/dist/providers/minimax/sdk-client.d.ts +29 -0
  155. package/dist/providers/minimax/sdk-client.d.ts.map +1 -0
  156. package/dist/providers/minimax/sdk-client.js +50 -0
  157. package/dist/providers/minimax/sdk-client.js.map +1 -0
  158. package/dist/providers/minimax/vision-attestations.d.ts +52 -0
  159. package/dist/providers/minimax/vision-attestations.d.ts.map +1 -0
  160. package/dist/providers/minimax/vision-attestations.js +79 -0
  161. package/dist/providers/minimax/vision-attestations.js.map +1 -0
  162. package/dist/providers/minimax/vision-conformance.d.ts +186 -0
  163. package/dist/providers/minimax/vision-conformance.d.ts.map +1 -0
  164. package/dist/providers/minimax/vision-conformance.js +371 -0
  165. package/dist/providers/minimax/vision-conformance.js.map +1 -0
  166. package/dist/providers/minimax/vision-mappings/chart.d.ts +35 -0
  167. package/dist/providers/minimax/vision-mappings/chart.d.ts.map +1 -0
  168. package/dist/providers/minimax/vision-mappings/chart.js +55 -0
  169. package/dist/providers/minimax/vision-mappings/chart.js.map +1 -0
  170. package/dist/providers/minimax/vision-mappings/common.d.ts +60 -0
  171. package/dist/providers/minimax/vision-mappings/common.d.ts.map +1 -0
  172. package/dist/providers/minimax/vision-mappings/common.js +75 -0
  173. package/dist/providers/minimax/vision-mappings/common.js.map +1 -0
  174. package/dist/providers/minimax/vision-mappings/diagnose-error.d.ts +35 -0
  175. package/dist/providers/minimax/vision-mappings/diagnose-error.d.ts.map +1 -0
  176. package/dist/providers/minimax/vision-mappings/diagnose-error.js +55 -0
  177. package/dist/providers/minimax/vision-mappings/diagnose-error.js.map +1 -0
  178. package/dist/providers/minimax/vision-mappings/diagram.d.ts +35 -0
  179. package/dist/providers/minimax/vision-mappings/diagram.d.ts.map +1 -0
  180. package/dist/providers/minimax/vision-mappings/diagram.js +55 -0
  181. package/dist/providers/minimax/vision-mappings/diagram.js.map +1 -0
  182. package/dist/providers/minimax/vision-mappings/extract-text.d.ts +35 -0
  183. package/dist/providers/minimax/vision-mappings/extract-text.d.ts.map +1 -0
  184. package/dist/providers/minimax/vision-mappings/extract-text.js +55 -0
  185. package/dist/providers/minimax/vision-mappings/extract-text.js.map +1 -0
  186. package/dist/providers/minimax/vision-mappings/ui-artifact.d.ts +35 -0
  187. package/dist/providers/minimax/vision-mappings/ui-artifact.d.ts.map +1 -0
  188. package/dist/providers/minimax/vision-mappings/ui-artifact.js +69 -0
  189. package/dist/providers/minimax/vision-mappings/ui-artifact.js.map +1 -0
  190. package/dist/providers/minimax/vision-mappings.generated.d.ts +29 -0
  191. package/dist/providers/minimax/vision-mappings.generated.d.ts.map +1 -0
  192. package/dist/providers/minimax/vision-mappings.generated.js +29 -0
  193. package/dist/providers/minimax/vision-mappings.generated.js.map +1 -0
  194. package/dist/providers/minimax/vision-revisions.d.ts +29 -0
  195. package/dist/providers/minimax/vision-revisions.d.ts.map +1 -0
  196. package/dist/providers/minimax/vision-revisions.js +34 -0
  197. package/dist/providers/minimax/vision-revisions.js.map +1 -0
  198. package/dist/providers/registry.d.ts +36 -0
  199. package/dist/providers/registry.d.ts.map +1 -0
  200. package/dist/providers/registry.js +45 -0
  201. package/dist/providers/registry.js.map +1 -0
  202. package/dist/providers/selection.d.ts +44 -0
  203. package/dist/providers/selection.d.ts.map +1 -0
  204. package/dist/providers/selection.js +85 -0
  205. package/dist/providers/selection.js.map +1 -0
  206. package/dist/providers/types.d.ts +281 -0
  207. package/dist/providers/types.d.ts.map +1 -0
  208. package/dist/providers/types.js +127 -0
  209. package/dist/providers/types.js.map +1 -0
  210. package/dist/providers/zai/adapter.d.ts +35 -0
  211. package/dist/providers/zai/adapter.d.ts.map +1 -0
  212. package/dist/providers/zai/adapter.js +685 -0
  213. package/dist/providers/zai/adapter.js.map +1 -0
  214. package/dist/providers/zai/credentials.d.ts +38 -0
  215. package/dist/providers/zai/credentials.d.ts.map +1 -0
  216. package/dist/providers/zai/credentials.js +60 -0
  217. package/dist/providers/zai/credentials.js.map +1 -0
  218. package/dist/providers/zai/encoded-error.d.ts +90 -0
  219. package/dist/providers/zai/encoded-error.d.ts.map +1 -0
  220. package/dist/providers/zai/encoded-error.js +169 -0
  221. package/dist/providers/zai/encoded-error.js.map +1 -0
  222. package/dist/providers/zai/media.d.ts +38 -0
  223. package/dist/providers/zai/media.d.ts.map +1 -0
  224. package/dist/providers/zai/media.js +107 -0
  225. package/dist/providers/zai/media.js.map +1 -0
  226. package/dist/providers/zai/monitor-client.d.ts +53 -0
  227. package/dist/providers/zai/monitor-client.d.ts.map +1 -0
  228. package/dist/providers/zai/monitor-client.js +117 -0
  229. package/dist/providers/zai/monitor-client.js.map +1 -0
  230. package/dist/providers/zai/quota.d.ts +47 -0
  231. package/dist/providers/zai/quota.d.ts.map +1 -0
  232. package/dist/providers/zai/quota.js +127 -0
  233. package/dist/providers/zai/quota.js.map +1 -0
  234. package/dist/providers/zai/reader.d.ts +82 -0
  235. package/dist/providers/zai/reader.d.ts.map +1 -0
  236. package/dist/providers/zai/reader.js +490 -0
  237. package/dist/providers/zai/reader.js.map +1 -0
  238. package/dist/providers/zai/repository.d.ts +76 -0
  239. package/dist/providers/zai/repository.d.ts.map +1 -0
  240. package/dist/providers/zai/repository.js +715 -0
  241. package/dist/providers/zai/repository.js.map +1 -0
  242. package/package.json +11 -6
@@ -0,0 +1,383 @@
1
+ /**
2
+ * Shared Execution Contract (DESIGN.md §10).
3
+ *
4
+ * Owns cache lookup, legacy read-through, retry policy, and local count
5
+ * truncation for every Provider Capability. Capability Modules define
6
+ * shared meaning; Adapters perform a single transport attempt; this
7
+ * module is the single retry and cache-policy owner.
8
+ *
9
+ * Boundary rules (ARCHITECTURE.md §2):
10
+ * - May import capability types, Provider identity types, cache, and
11
+ * normalized errors.
12
+ * - Must NOT import a concrete Provider Adapter, UTCP, or `mmx-cli`.
13
+ * - Must NOT import command presentation or output mode modules.
14
+ *
15
+ * Order of operations for `executeSearch`:
16
+ * 1. `capability.validate(request)`
17
+ * 2. `capability.cacheIdentity(request, { legacyCount: options.count })`
18
+ * 3. Read the provider-partitioned cache key
19
+ * 4. Try and decode Adapter-supplied legacy candidates when applicable
20
+ * 5. Invoke through `executeProviderOperation`
21
+ * 6. Retry only normalized retryable failures
22
+ * 7. Cache the full normalized result
23
+ * 8. Apply local count truncation
24
+ */
25
+ import { ScoutlineError } from "./errors.js";
26
+ import { buildProviderCacheKey } from "./cache.js";
27
+ const DEFAULT_BASE_DELAY_MS = 500;
28
+ const DEFAULT_MAX_DELAY_MS = 8000;
29
+ const DEFAULT_JITTER_MS = 250;
30
+ /**
31
+ * Default retry policy per operation. Search, quota, diagnostics, the
32
+ * three repository operations, and the reader operation allow one
33
+ * retry; Vision allows two to preserve shipped Z.AI behaviour. Base
34
+ * delay 500 ms, max delay 8000 ms, jitter up to 250 ms.
35
+ *
36
+ * The repository and reader operations inherit the existing single-
37
+ * retry non-Vision policy (DESIGN.md §18) without altering the
38
+ * behaviour of Search/Vision/Quota/Diagnostics; the new values are
39
+ * routed through the same default branch as Search/Quota/Diagnostics.
40
+ */
41
+ export function defaultRetryPolicy(operation) {
42
+ const base = {
43
+ baseDelayMs: DEFAULT_BASE_DELAY_MS,
44
+ maxDelayMs: DEFAULT_MAX_DELAY_MS,
45
+ jitterMs: DEFAULT_JITTER_MS,
46
+ };
47
+ switch (operation) {
48
+ case "vision":
49
+ return { ...base, maxRetries: 2 };
50
+ case "search":
51
+ case "quota":
52
+ case "diagnostics":
53
+ case "repository-search":
54
+ case "repository-read-file":
55
+ case "repository-list-directory":
56
+ case "reader-fetch":
57
+ default:
58
+ return { ...base, maxRetries: 1 };
59
+ }
60
+ }
61
+ /**
62
+ * Classify whether a normalized error is retryable for a Provider
63
+ * operation. Authentication, validation, unsupported, content-policy,
64
+ * and exhausted-quota failures are terminal. Normalized timeout,
65
+ * network, HTTP 429, and any 5xx (statusCode 500..599, inclusive)
66
+ * equivalents are retryable.
67
+ *
68
+ * The 5xx range is matched as a closed interval so Provider-encoded
69
+ * statuses that the upstream gateway passes through verbatim (501,
70
+ * 505, 599, etc.) retry exactly once, matching Design §18 and
71
+ * FR-090. Other 4xx codes remain terminal.
72
+ *
73
+ * An explicit `retryable: true` on a `ScoutlineError` wins; an explicit
74
+ * `retryable: false` overrides a code-based default. Non-Scoutline
75
+ * errors never retry — Adapters must normalize failures before they
76
+ * leave the Adapter boundary.
77
+ */
78
+ function isOperationRetryableError(error) {
79
+ if (!(error instanceof ScoutlineError))
80
+ return false;
81
+ // Explicit retryable flag wins over code-based defaults.
82
+ if (error.retryable)
83
+ return true;
84
+ switch (error.code) {
85
+ case "TIMEOUT_ERROR":
86
+ case "NETWORK_ERROR":
87
+ return true;
88
+ case "API_ERROR": {
89
+ // Design §18 / FR-090: 429 and any 5xx (500..599 inclusive) retry
90
+ // once. The interval is closed so encoded Provider statuses that
91
+ // pass through verbatim (501, 505, 599, ...) match the contract.
92
+ const status = error.statusCode;
93
+ return status !== undefined && (status === 429 || (status >= 500 && status <= 599));
94
+ }
95
+ default:
96
+ return false;
97
+ }
98
+ }
99
+ /**
100
+ * Generic uncached retry wrapper. Performs no I/O of its own; the
101
+ * caller supplies the invoke thunk and the cache strategy. Each
102
+ * outward Provider operation has exactly one retry wrapper; Adapter
103
+ * transport methods perform one attempt and never retry internally.
104
+ */
105
+ export async function executeProviderOperation(operation, invoke, dependencies, retryPolicy) {
106
+ const policy = retryPolicy ?? defaultRetryPolicy(operation);
107
+ let attempt = 0;
108
+ for (;;) {
109
+ try {
110
+ return await invoke();
111
+ }
112
+ catch (error) {
113
+ if (attempt >= policy.maxRetries)
114
+ throw error;
115
+ if (!isOperationRetryableError(error))
116
+ throw error;
117
+ const backoff = Math.min(policy.maxDelayMs, policy.baseDelayMs * Math.pow(2, attempt));
118
+ const jitter = Math.floor(dependencies.random() * policy.jitterMs);
119
+ await dependencies.sleep(backoff + jitter);
120
+ attempt += 1;
121
+ }
122
+ }
123
+ }
124
+ // ---------------------------------------------------------------------------
125
+ // Search execution
126
+ // ---------------------------------------------------------------------------
127
+ /**
128
+ * Apply command-level count truncation to a normalized result. Count
129
+ * is meaning local to the command Module: zero returns an empty list,
130
+ * a positive count slices, and an absent count returns everything.
131
+ */
132
+ function applyCount(result, count) {
133
+ if (count === undefined)
134
+ return result;
135
+ if (count <= 0)
136
+ return [];
137
+ return result.slice(0, count);
138
+ }
139
+ /**
140
+ * Execute a normalized Search through the shared pipeline:
141
+ * validate → cache identity → new-key read → optional legacy
142
+ * read-through → invoke with retry → cache the full result → apply
143
+ * count truncation.
144
+ *
145
+ * Count never enters the cache identity request or the Provider
146
+ * request; it is supplied only as `legacyCount` so the Z.AI Adapter
147
+ * can reconstruct old keys.
148
+ */
149
+ export async function executeSearch(capability, request, options, dependencies) {
150
+ // 1. Validate Capability request.
151
+ capability.validate(request);
152
+ // 2. Adapter-owned cache identity (after validation).
153
+ const identity = capability.cacheIdentity(request, {
154
+ legacyCount: options.count,
155
+ });
156
+ // 3. Read the provider-partitioned cache key.
157
+ const newKey = buildProviderCacheKey({
158
+ provider: identity.provider,
159
+ capability: identity.capability,
160
+ credentialFingerprint: identity.credentialFingerprint,
161
+ request: identity.request,
162
+ });
163
+ if (!options.noCache) {
164
+ const cached = await dependencies.cache.get(newKey);
165
+ if (cached !== null) {
166
+ return applyCount(cached, options.count);
167
+ }
168
+ // 4. Adapter-owned legacy candidates (Z.AI only). Invalid raw data
169
+ // is a miss; a valid hit populates the new key but the legacy
170
+ // file is never changed or deleted.
171
+ if (identity.legacyCandidates) {
172
+ for (const candidate of identity.legacyCandidates) {
173
+ const raw = await dependencies.cache.get(candidate.key);
174
+ if (raw === null)
175
+ continue;
176
+ const decoded = candidate.decode(raw);
177
+ if (decoded !== null) {
178
+ await dependencies.cache.set(newKey, decoded);
179
+ return applyCount(decoded, options.count);
180
+ }
181
+ }
182
+ }
183
+ }
184
+ // 5 + 6. Invoke through executeProviderOperation; retryable failures
185
+ // are retried with backoff driven by the injected sleep+random.
186
+ const result = await executeProviderOperation("search", () => capability.invoke(request), dependencies, options.retryPolicy);
187
+ // 7. Cache the full normalized result before count is applied.
188
+ if (!options.noCache) {
189
+ await dependencies.cache.set(newKey, result);
190
+ }
191
+ // 8. Local count truncation.
192
+ return applyCount(result, options.count);
193
+ }
194
+ /**
195
+ * Generic cache + retry executor for every cacheable Repository
196
+ * Capability operation (Search, Read File, Directory Listing).
197
+ *
198
+ * The observable order is fixed and exhaustively enumerated in
199
+ * DESIGN.md §18:
200
+ *
201
+ * 1. `operation.validate(request)` — throws `ValidationError`
202
+ * synchronously before any cache or Adapter work.
203
+ * 2. `operation.cacheIdentity(request)` — Adapter computes the
204
+ * provider-partitioned cache key and ordered legacy candidates
205
+ * from the validated request and a single resolved credential.
206
+ * 3. Read the provider-partitioned cache key and pass the raw value
207
+ * through `operation.decodeCached`. A valid decode returns
208
+ * immediately; `null` is a miss; malformed values never propagate
209
+ * through a generic cast.
210
+ * 4. For each legacy candidate, in declaration order, read the
211
+ * legacy key and pass it through the candidate's `decode`. A
212
+ * valid legacy hit is written through to the normalized key
213
+ * (the legacy file is never changed or deleted) and returned.
214
+ * A malformed legacy value is a miss.
215
+ * 5. `operation.invoke(request)` is wrapped through
216
+ * `executeProviderOperation` with the existing single-retry
217
+ * non-Vision policy. Each retry creates a fresh Adapter
218
+ * transport attempt; cache hits create no transport.
219
+ * 6. The normalized result is written to the provider-partitioned
220
+ * cache key.
221
+ *
222
+ * `--no-cache` skips steps 3, 4, and 6. It never skips validation
223
+ * (1), identity (2), invoke (5), or retry semantics.
224
+ *
225
+ * `executeRepositoryOperation` imports no Z.AI, MiniMax, MCP, UTCP,
226
+ * command-output, BFS, selection, or presentation module.
227
+ */
228
+ export async function executeRepositoryOperation(operation, request, options, dependencies) {
229
+ // 1. Validate Capability request.
230
+ operation.validate(request);
231
+ // 2. Adapter-owned cache identity (after validation). The Adapter
232
+ // resolves its credential exactly once and returns legacy
233
+ // candidates alongside the full fingerprint and canonical
234
+ // request. Candidate construction performs no ambient
235
+ // environment read.
236
+ const identity = operation.cacheIdentity(request);
237
+ // 3. Provider-partitioned cache key.
238
+ //
239
+ // The key namespace is `<capability>-<operation>` rather than the
240
+ // umbrella Capability alone, so File and Directory operations —
241
+ // which share the `{ repository, path }` request shape — cannot
242
+ // collide. This composes the existing `buildProviderCacheKey` slot
243
+ // without mutating `buildProviderCacheKey` or its existing callers
244
+ // (Search, Vision, Quota, Diagnostics still pass a single Capability
245
+ // name). The canonical request object is unchanged; only the
246
+ // capability argument gains the operation suffix.
247
+ const newKey = buildProviderCacheKey({
248
+ provider: identity.provider,
249
+ capability: `${identity.capability}-${identity.operation}`,
250
+ credentialFingerprint: identity.credentialFingerprint,
251
+ request: identity.request,
252
+ });
253
+ if (!options.noCache) {
254
+ const raw = await dependencies.cache.get(newKey);
255
+ if (raw !== null) {
256
+ const decoded = operation.decodeCached(raw);
257
+ if (decoded !== null) {
258
+ return decoded;
259
+ }
260
+ // Malformed normalized value: treat as a miss and fall through.
261
+ }
262
+ // 4. Ordered legacy candidates. Each candidate's decode is
263
+ // total — invalid raw data is a miss. A valid legacy hit
264
+ // populates the new key but the legacy file is never
265
+ // changed or deleted.
266
+ for (const candidate of identity.legacyCandidates) {
267
+ const legacyRaw = await dependencies.cache.get(candidate.key);
268
+ if (legacyRaw === null)
269
+ continue;
270
+ const decoded = candidate.decode(legacyRaw);
271
+ if (decoded !== null) {
272
+ await dependencies.cache.set(newKey, decoded);
273
+ return decoded;
274
+ }
275
+ }
276
+ }
277
+ // 5. Retry-wrapped invoke. Auth, Validation, Unsupported, and
278
+ // exhausted Quota failures are terminal; transient timeout,
279
+ // network, and 5xx/429-equivalent failures get one retry.
280
+ const result = await executeProviderOperation(
281
+ // `operation.kind` is `RepositoryOperationKind`, which is
282
+ // composed into `ProviderOperation` directly — no cast needed
283
+ // and a future kind union change propagates automatically.
284
+ operation.kind, () => operation.invoke(request), dependencies, options.retryPolicy);
285
+ // 6. Cache the full normalized result before returning.
286
+ if (!options.noCache) {
287
+ await dependencies.cache.set(newKey, result);
288
+ }
289
+ return result;
290
+ }
291
+ /**
292
+ * Generic cache + retry executor for the Reader Capability's
293
+ * `reader-fetch` operation. Structurally identical to
294
+ * {@link executeRepositoryOperation}; the two are duplicated rather
295
+ * than shared because factoring them would widen this ticket's
296
+ * scope (modifying repository.ts further). Future consolidation is
297
+ * a separate refactor.
298
+ *
299
+ * The observable order is fixed:
300
+ *
301
+ * 1. `operation.validate(request)` — throws `ValidationError`
302
+ * synchronously before any cache or Adapter work.
303
+ * 2. `operation.cacheIdentity(request)` — Adapter computes the
304
+ * provider-partitioned cache key and ordered legacy candidates
305
+ * from the validated request and a single resolved credential.
306
+ * 3. Read the provider-partitioned cache key and pass the raw
307
+ * value through `operation.decodeCached`. A valid decode
308
+ * returns immediately; `null` is a miss; malformed values
309
+ * never propagate through a generic cast.
310
+ * 4. For each legacy candidate, in declaration order, read the
311
+ * legacy key and pass it through the candidate's `decode`. A
312
+ * valid legacy hit is written through to the normalized key
313
+ * (the legacy file is never changed or deleted) and returned.
314
+ * A malformed legacy value is a miss.
315
+ * 5. `operation.invoke(request)` is wrapped through
316
+ * `executeProviderOperation` with the single-retry non-Vision
317
+ * policy. Each retry creates a fresh Adapter transport attempt;
318
+ * cache hits create no transport.
319
+ * 6. The normalized result is written to the provider-partitioned
320
+ * cache key.
321
+ *
322
+ * `--no-cache` skips steps 3, 4, and 6. It never skips validation
323
+ * (1), identity (2), invoke (5), or retry semantics.
324
+ *
325
+ * `executeReaderOperation` imports no Z.AI, MiniMax, MCP, UTCP,
326
+ * command-output, selection, or presentation module.
327
+ */
328
+ export async function executeReaderOperation(operation, request, options, dependencies) {
329
+ // 1. Validate Capability request.
330
+ operation.validate(request);
331
+ // 2. Adapter-owned cache identity (after validation). The Adapter
332
+ // resolves its credential exactly once and returns legacy
333
+ // candidates alongside the full fingerprint and canonical
334
+ // request. Candidate construction performs no ambient
335
+ // environment read.
336
+ const identity = operation.cacheIdentity(request);
337
+ // 3. Provider-partitioned cache key.
338
+ //
339
+ // The key namespace is `${capability}-${operation}` rather than the
340
+ // umbrella Capability alone, mirroring the repository convention so
341
+ // future Reader operations cannot collide. The capability argument
342
+ // gains the operation suffix.
343
+ const newKey = buildProviderCacheKey({
344
+ provider: identity.provider,
345
+ capability: `${identity.capability}-${identity.operation}`,
346
+ credentialFingerprint: identity.credentialFingerprint,
347
+ request: identity.request,
348
+ });
349
+ if (!options.noCache) {
350
+ const raw = await dependencies.cache.get(newKey);
351
+ if (raw !== null) {
352
+ const decoded = operation.decodeCached(raw);
353
+ if (decoded !== null) {
354
+ return decoded;
355
+ }
356
+ // Malformed normalized value: treat as a miss and fall through.
357
+ }
358
+ // 4. Ordered legacy candidates. Each candidate's decode is
359
+ // total — invalid raw data is a miss. A valid legacy hit
360
+ // populates the new key but the legacy file is never
361
+ // changed or deleted.
362
+ for (const candidate of identity.legacyCandidates) {
363
+ const legacyRaw = await dependencies.cache.get(candidate.key);
364
+ if (legacyRaw === null)
365
+ continue;
366
+ const decoded = candidate.decode(legacyRaw);
367
+ if (decoded !== null) {
368
+ await dependencies.cache.set(newKey, decoded);
369
+ return decoded;
370
+ }
371
+ }
372
+ }
373
+ // 5. Retry-wrapped invoke. Auth, Validation, Unsupported, and
374
+ // exhausted Quota failures are terminal; transient timeout,
375
+ // network, and 5xx/429-equivalent failures get one retry.
376
+ const result = await executeProviderOperation(operation.kind, () => operation.invoke(request), dependencies, options.retryPolicy);
377
+ // 6. Cache the full normalized result before returning.
378
+ if (!options.noCache) {
379
+ await dependencies.cache.set(newKey, result);
380
+ }
381
+ return result;
382
+ }
383
+ //# sourceMappingURL=execution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution.js","sourceRoot":"","sources":["../../src/lib/execution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAWH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAsB,MAAM,YAAY,CAAC;AA+CvE,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAClC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAA4B;IAC7D,MAAM,IAAI,GAAG;QACX,WAAW,EAAE,qBAAqB;QAClC,UAAU,EAAE,oBAAoB;QAChC,QAAQ,EAAE,iBAAiB;KAC5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AO,GAAG,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAC5C,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;gBACrB,MAAM,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAC9C,OAAO,OAAO,CAAC;YACjB,CAAC;QACH,CAAC;IACH,CAAC;IAED,8DAA8D;IAC9D,+DAA+D;IAC/D,6DAA6D;IAC7D,MAAM,MAAM,GAAG,MAAM,wBAAwB,CAC3C,SAAS,CAAC,IAAI,EACd,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,EAC/B,YAAY,EACZ,OAAO,CAAC,WAAW,CACpB,CAAC;IAEF,wDAAwD;IACxD,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACrB,MAAM,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,8 +1,16 @@
1
1
  /**
2
- * Library exports for programmatic usage
2
+ * Library exports for programmatic usage.
3
+ *
4
+ * `formatErrorOutput` lives in `./output.js` (DESIGN.md §3, canonical
5
+ * invocation-local 2-arg form). `./errors.js` keeps a legacy 1-arg
6
+ * compat version that Phase 1 command handlers import directly until
7
+ * P1-10 migrates them. To avoid a duplicate-export error in this
8
+ * aggregator, the errors-module re-export below is explicit and omits
9
+ * `formatErrorOutput`; the canonical 2-arg version from `./output.js`
10
+ * wins through `export *` below.
3
11
  */
4
12
  export * from "./config.js";
5
- export * from "./errors.js";
13
+ export { type ScoutlineErrorCode, type ScoutlineErrorOptions, ScoutlineError, ZaiError, ValidationError, ConfigurationError, UnsupportedCapabilityError, UnsupportedOptionError, AuthError, ApiError, NetworkError, TimeoutError, FileError, QuotaError, isRetryableError, getErrorExitCode, } from "./errors.js";
6
14
  export * from "./output.js";
7
15
  export * from "./image.js";
8
16
  export * from "./api-client.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,aAAa,CAAC;AAC5B,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,cAAc,EACd,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,0BAA0B,EAC1B,sBAAsB,EACtB,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
package/dist/lib/index.js CHANGED
@@ -1,8 +1,16 @@
1
1
  /**
2
- * Library exports for programmatic usage
2
+ * Library exports for programmatic usage.
3
+ *
4
+ * `formatErrorOutput` lives in `./output.js` (DESIGN.md §3, canonical
5
+ * invocation-local 2-arg form). `./errors.js` keeps a legacy 1-arg
6
+ * compat version that Phase 1 command handlers import directly until
7
+ * P1-10 migrates them. To avoid a duplicate-export error in this
8
+ * aggregator, the errors-module re-export below is explicit and omits
9
+ * `formatErrorOutput`; the canonical 2-arg version from `./output.js`
10
+ * wins through `export *` below.
3
11
  */
4
12
  export * from "./config.js";
5
- export * from "./errors.js";
13
+ export { ScoutlineError, ZaiError, ValidationError, ConfigurationError, UnsupportedCapabilityError, UnsupportedOptionError, AuthError, ApiError, NetworkError, TimeoutError, FileError, QuotaError, isRetryableError, getErrorExitCode, } from "./errors.js";
6
14
  export * from "./output.js";
7
15
  export * from "./image.js";
8
16
  export * from "./api-client.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,aAAa,CAAC;AAC5B,OAAO,EAGL,cAAc,EACd,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,0BAA0B,EAC1B,sBAAsB,EACtB,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
@@ -7,8 +7,9 @@
7
7
  * - Web Search: Real-time web search
8
8
  * - Web Reader: Web page content extraction
9
9
  */
10
- import { type Tool } from "@utcp/sdk";
10
+ import { UtcpClient, type Tool } from "@utcp/sdk";
11
11
  import "@utcp/mcp";
12
+ import type { ReaderRawResponse } from "../capabilities/reader.js";
12
13
  export interface ZReadSearchResult {
13
14
  title: string;
14
15
  content: string;
@@ -24,6 +25,23 @@ export interface WebSearchResult {
24
25
  icon: string;
25
26
  publish_date?: string;
26
27
  }
28
+ /**
29
+ * Constructor options for {@link ZaiMcpClient}.
30
+ *
31
+ * `utcpFactory` is a behaviour-preserving injection seam: when omitted the
32
+ * production path uses `UtcpClient.create()`. Tests inject a fake to avoid
33
+ * touching process globals.
34
+ *
35
+ * `disableRetry` (P2-03) lets the Z.AI Search Adapter hand retry policy
36
+ * to shared execution. When omitted, the client retains its existing
37
+ * direct-client retry behaviour.
38
+ */
39
+ export interface ZaiMcpClientOptions {
40
+ enableVision?: boolean;
41
+ noCache?: boolean;
42
+ disableRetry?: boolean;
43
+ utcpFactory?: () => Promise<UtcpClient>;
44
+ }
27
45
  /**
28
46
  * Unified MCP client for all Z.AI MCP services
29
47
  */
@@ -32,10 +50,7 @@ export declare class ZaiMcpClient {
32
50
  private initPromise;
33
51
  private isInitialized;
34
52
  private options;
35
- constructor(options?: {
36
- enableVision?: boolean;
37
- noCache?: boolean;
38
- });
53
+ constructor(options?: ZaiMcpClientOptions);
39
54
  /**
40
55
  * Initialize the UTCP client and register all MCP servers
41
56
  */
@@ -49,18 +64,49 @@ export declare class ZaiMcpClient {
49
64
  private getRetryCount;
50
65
  private isRetriableError;
51
66
  private resolveEnableVision;
52
- private getToolCacheKey;
53
- private getToolCachePath;
54
- private readToolsCache;
55
- private writeToolsCache;
56
67
  /**
57
- * List all discovered tools from registered MCP servers
68
+ * Build the tool-cache config (D4 — adapter encapsulates the
69
+ * config + endpoints + vision-resolution inputs that the extracted
70
+ * `tool-cache.ts` needs to compute a stable key). Owned here because
71
+ * the inputs come from this class's options and the shared config
72
+ * module; the extracted module stays pure of `loadConfig` / `getMcpEndpoints`.
73
+ */
74
+ private getToolCacheConfig;
75
+ /**
76
+ * List all discovered tools from registered MCP servers.
77
+ *
78
+ * Returns the PUBLIC projected view: internal UTCP names (e.g.
79
+ * `scoutline_zai.search.web_search_prime`) are rewritten to the
80
+ * stable dotted form (e.g. `scoutline.zai.search.web_search_prime`).
81
+ * The private unprojected discovery list is retained for invocation
82
+ * through {@link getTool} / {@link resolveToolName}.
58
83
  */
59
84
  listTools(refresh?: boolean): Promise<Tool[]>;
60
85
  /**
61
- * Find a tool by exact name or by suffix match
86
+ * Private unprojected discovery list. Tools keep their exact UTCP
87
+ * names so {@link getTool} can resolve public aliases back to the
88
+ * internal invocation identity.
89
+ *
90
+ * Tool-cache I/O is delegated to the extracted {@link tool-cache.ts}
91
+ * module (D1 — owns its I/O directly against the `tools/` subdir).
92
+ */
93
+ private discoverTools;
94
+ /**
95
+ * Find a tool by exact internal name, public dotted name, or leaf
96
+ * suffix. Resolution order:
97
+ * 1. Exact discovered name (e.g. `scoutline_zai.search.web_search_prime`).
98
+ * 2. Public dotted name (e.g. `scoutline.zai.search.web_search_prime`):
99
+ * derive the provider-relative suffix after the public prefix and
100
+ * match exactly one discovered name ending in `.<suffix>`. Zero or
101
+ * multiple matches fail.
102
+ * 3. Legacy short-suffix fallback: a single discovered name ending in
103
+ * `.<name>` (e.g. for callers that pass only `web_search_prime`).
104
+ *
105
+ * Public names never replace the private discovered-name record — the
106
+ * returned {@link Tool} always carries its internal UTCP name.
62
107
  */
63
108
  getTool(toolName: string): Promise<Tool | undefined>;
109
+ private findToolByResolvedName;
64
110
  /**
65
111
  * Resolve a tool name, accepting full names or suffixes
66
112
  */
@@ -69,6 +115,22 @@ export declare class ZaiMcpClient {
69
115
  * Call a tool by full name or suffix
70
116
  */
71
117
  callToolRaw<T>(toolName: string, args: Record<string, unknown>): Promise<T>;
118
+ /**
119
+ * P6-01A: invoke a tool while preserving the public dotted tool name as
120
+ * the cache identity, then resolve to the internal sanitized identity
121
+ * only on a cache miss.
122
+ *
123
+ * The legacy v0.2 repository cache contract (P0–P2) keyed entries under
124
+ * the public dotted name and returned them before any transport work.
125
+ * A naive `callToolRaw` migration routes through `resolveToolName` first,
126
+ * which forces discovery, registration, and `init()` even when a v0.2
127
+ * hit is present. This helper restores the legacy cache identity and
128
+ * skips discovery on hits while keeping the translation fix for misses.
129
+ *
130
+ * Other callers (`callTool`, `callToolRaw`, Vision, Search, Reader, raw
131
+ * tools) are unchanged.
132
+ */
133
+ private callToolWithPublicCacheIdentity;
72
134
  /**
73
135
  * Search documentation and code in a GitHub repository
74
136
  */
@@ -105,7 +167,7 @@ export declare class ZaiMcpClient {
105
167
  noGfm?: boolean;
106
168
  keepImgDataUrl?: boolean;
107
169
  withImagesSummary?: boolean;
108
- }): Promise<string>;
170
+ }): Promise<ReaderRawResponse>;
109
171
  visionAnalyze(params: {
110
172
  imageSource: string;
111
173
  prompt: string;
@@ -150,10 +212,7 @@ export declare class ZaiMcpClient {
150
212
  close(timeoutMs?: number): Promise<void>;
151
213
  }
152
214
  export declare class ZReadMcpClient extends ZaiMcpClient {
153
- constructor(options?: {
154
- enableVision?: boolean;
155
- noCache?: boolean;
156
- });
215
+ constructor(options?: ZaiMcpClientOptions);
157
216
  searchDoc(repo: string, query: string, language?: "zh" | "en"): Promise<string>;
158
217
  getRepoStructure(repo: string, dirPath?: string): Promise<string>;
159
218
  readFile(repo: string, path: string): Promise<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-client.d.ts","sourceRoot":"","sources":["../../src/lib/mcp-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,WAAW,CAAC;AAyCnB,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAGD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,WAAW,CAA8B;IACjD,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,OAAO,CAA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