scoutline 0.1.0 → 0.2.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/README.md +170 -5
  2. package/bin/scoutline.js +36 -15
  3. package/dist/capabilities/diagnostics.d.ts +97 -0
  4. package/dist/capabilities/diagnostics.d.ts.map +1 -0
  5. package/dist/capabilities/diagnostics.js +88 -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/search.d.ts +110 -0
  12. package/dist/capabilities/search.d.ts.map +1 -0
  13. package/dist/capabilities/search.js +21 -0
  14. package/dist/capabilities/search.js.map +1 -0
  15. package/dist/capabilities/vision.d.ts +156 -0
  16. package/dist/capabilities/vision.d.ts.map +1 -0
  17. package/dist/capabilities/vision.js +111 -0
  18. package/dist/capabilities/vision.js.map +1 -0
  19. package/dist/command-invocation.d.ts +58 -0
  20. package/dist/command-invocation.d.ts.map +1 -0
  21. package/dist/command-invocation.js +95 -0
  22. package/dist/command-invocation.js.map +1 -0
  23. package/dist/commands/code.d.ts +11 -4
  24. package/dist/commands/code.d.ts.map +1 -1
  25. package/dist/commands/code.js +16 -42
  26. package/dist/commands/code.js.map +1 -1
  27. package/dist/commands/doctor.d.ts +58 -3
  28. package/dist/commands/doctor.d.ts.map +1 -1
  29. package/dist/commands/doctor.js +154 -52
  30. package/dist/commands/doctor.js.map +1 -1
  31. package/dist/commands/quota.d.ts +45 -3
  32. package/dist/commands/quota.d.ts.map +1 -1
  33. package/dist/commands/quota.js +116 -60
  34. package/dist/commands/quota.js.map +1 -1
  35. package/dist/commands/read.d.ts +15 -1
  36. package/dist/commands/read.d.ts.map +1 -1
  37. package/dist/commands/read.js +53 -54
  38. package/dist/commands/read.js.map +1 -1
  39. package/dist/commands/repo.d.ts +8 -3
  40. package/dist/commands/repo.d.ts.map +1 -1
  41. package/dist/commands/repo.js +40 -78
  42. package/dist/commands/repo.js.map +1 -1
  43. package/dist/commands/search.d.ts +27 -2
  44. package/dist/commands/search.d.ts.map +1 -1
  45. package/dist/commands/search.js +95 -103
  46. package/dist/commands/search.js.map +1 -1
  47. package/dist/commands/tools.d.ts +9 -3
  48. package/dist/commands/tools.d.ts.map +1 -1
  49. package/dist/commands/tools.js +29 -59
  50. package/dist/commands/tools.js.map +1 -1
  51. package/dist/commands/vision.d.ts +35 -9
  52. package/dist/commands/vision.d.ts.map +1 -1
  53. package/dist/commands/vision.js +184 -131
  54. package/dist/commands/vision.js.map +1 -1
  55. package/dist/index.d.ts +42 -1
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +389 -207
  58. package/dist/index.js.map +1 -1
  59. package/dist/lib/cache.d.ts +61 -0
  60. package/dist/lib/cache.d.ts.map +1 -1
  61. package/dist/lib/cache.js +74 -11
  62. package/dist/lib/cache.js.map +1 -1
  63. package/dist/lib/code-mode.d.ts +13 -0
  64. package/dist/lib/code-mode.d.ts.map +1 -1
  65. package/dist/lib/code-mode.js +26 -6
  66. package/dist/lib/code-mode.js.map +1 -1
  67. package/dist/lib/config.d.ts.map +1 -1
  68. package/dist/lib/config.js +15 -18
  69. package/dist/lib/config.js.map +1 -1
  70. package/dist/lib/errors.d.ts +65 -10
  71. package/dist/lib/errors.d.ts.map +1 -1
  72. package/dist/lib/errors.js +135 -19
  73. package/dist/lib/errors.js.map +1 -1
  74. package/dist/lib/execution.d.ts +76 -0
  75. package/dist/lib/execution.d.ts.map +1 -0
  76. package/dist/lib/execution.js +177 -0
  77. package/dist/lib/execution.js.map +1 -0
  78. package/dist/lib/index.d.ts +10 -2
  79. package/dist/lib/index.d.ts.map +1 -1
  80. package/dist/lib/index.js +10 -2
  81. package/dist/lib/index.js.map +1 -1
  82. package/dist/lib/mcp-client.d.ts +46 -11
  83. package/dist/lib/mcp-client.d.ts.map +1 -1
  84. package/dist/lib/mcp-client.js +92 -27
  85. package/dist/lib/mcp-client.js.map +1 -1
  86. package/dist/lib/mcp-config.d.ts +17 -0
  87. package/dist/lib/mcp-config.d.ts.map +1 -1
  88. package/dist/lib/mcp-config.js +29 -0
  89. package/dist/lib/mcp-config.js.map +1 -1
  90. package/dist/lib/monitor-client.d.ts +17 -3
  91. package/dist/lib/monitor-client.d.ts.map +1 -1
  92. package/dist/lib/monitor-client.js +23 -69
  93. package/dist/lib/monitor-client.js.map +1 -1
  94. package/dist/lib/output.d.ts +53 -7
  95. package/dist/lib/output.d.ts.map +1 -1
  96. package/dist/lib/output.js +126 -39
  97. package/dist/lib/output.js.map +1 -1
  98. package/dist/lib/redact.d.ts +62 -3
  99. package/dist/lib/redact.d.ts.map +1 -1
  100. package/dist/lib/redact.js +165 -31
  101. package/dist/lib/redact.js.map +1 -1
  102. package/dist/lib/tty.d.ts +7 -20
  103. package/dist/lib/tty.d.ts.map +1 -1
  104. package/dist/lib/tty.js +51 -30
  105. package/dist/lib/tty.js.map +1 -1
  106. package/dist/node-command-invocation-adapter.d.ts +28 -0
  107. package/dist/node-command-invocation-adapter.d.ts.map +1 -0
  108. package/dist/node-command-invocation-adapter.js +88 -0
  109. package/dist/node-command-invocation-adapter.js.map +1 -0
  110. package/dist/providers/minimax/adapter.d.ts +47 -0
  111. package/dist/providers/minimax/adapter.d.ts.map +1 -0
  112. package/dist/providers/minimax/adapter.js +443 -0
  113. package/dist/providers/minimax/adapter.js.map +1 -0
  114. package/dist/providers/minimax/config.d.ts +32 -0
  115. package/dist/providers/minimax/config.d.ts.map +1 -0
  116. package/dist/providers/minimax/config.js +84 -0
  117. package/dist/providers/minimax/config.js.map +1 -0
  118. package/dist/providers/minimax/media.d.ts +34 -0
  119. package/dist/providers/minimax/media.d.ts.map +1 -0
  120. package/dist/providers/minimax/media.js +92 -0
  121. package/dist/providers/minimax/media.js.map +1 -0
  122. package/dist/providers/minimax/quota-client.d.ts +37 -0
  123. package/dist/providers/minimax/quota-client.d.ts.map +1 -0
  124. package/dist/providers/minimax/quota-client.js +78 -0
  125. package/dist/providers/minimax/quota-client.js.map +1 -0
  126. package/dist/providers/minimax/quota.d.ts +48 -0
  127. package/dist/providers/minimax/quota.d.ts.map +1 -0
  128. package/dist/providers/minimax/quota.js +120 -0
  129. package/dist/providers/minimax/quota.js.map +1 -0
  130. package/dist/providers/minimax/sdk-client.d.ts +29 -0
  131. package/dist/providers/minimax/sdk-client.d.ts.map +1 -0
  132. package/dist/providers/minimax/sdk-client.js +50 -0
  133. package/dist/providers/minimax/sdk-client.js.map +1 -0
  134. package/dist/providers/minimax/vision-attestations.d.ts +29 -0
  135. package/dist/providers/minimax/vision-attestations.d.ts.map +1 -0
  136. package/dist/providers/minimax/vision-attestations.js +54 -0
  137. package/dist/providers/minimax/vision-attestations.js.map +1 -0
  138. package/dist/providers/minimax/vision-conformance.d.ts +184 -0
  139. package/dist/providers/minimax/vision-conformance.d.ts.map +1 -0
  140. package/dist/providers/minimax/vision-conformance.js +369 -0
  141. package/dist/providers/minimax/vision-conformance.js.map +1 -0
  142. package/dist/providers/minimax/vision-mappings/chart.d.ts +35 -0
  143. package/dist/providers/minimax/vision-mappings/chart.d.ts.map +1 -0
  144. package/dist/providers/minimax/vision-mappings/chart.js +55 -0
  145. package/dist/providers/minimax/vision-mappings/chart.js.map +1 -0
  146. package/dist/providers/minimax/vision-mappings/common.d.ts +60 -0
  147. package/dist/providers/minimax/vision-mappings/common.d.ts.map +1 -0
  148. package/dist/providers/minimax/vision-mappings/common.js +75 -0
  149. package/dist/providers/minimax/vision-mappings/common.js.map +1 -0
  150. package/dist/providers/minimax/vision-mappings/diagnose-error.d.ts +35 -0
  151. package/dist/providers/minimax/vision-mappings/diagnose-error.d.ts.map +1 -0
  152. package/dist/providers/minimax/vision-mappings/diagnose-error.js +55 -0
  153. package/dist/providers/minimax/vision-mappings/diagnose-error.js.map +1 -0
  154. package/dist/providers/minimax/vision-mappings/diagram.d.ts +35 -0
  155. package/dist/providers/minimax/vision-mappings/diagram.d.ts.map +1 -0
  156. package/dist/providers/minimax/vision-mappings/diagram.js +55 -0
  157. package/dist/providers/minimax/vision-mappings/diagram.js.map +1 -0
  158. package/dist/providers/minimax/vision-mappings/extract-text.d.ts +35 -0
  159. package/dist/providers/minimax/vision-mappings/extract-text.d.ts.map +1 -0
  160. package/dist/providers/minimax/vision-mappings/extract-text.js +55 -0
  161. package/dist/providers/minimax/vision-mappings/extract-text.js.map +1 -0
  162. package/dist/providers/minimax/vision-mappings/ui-artifact.d.ts +35 -0
  163. package/dist/providers/minimax/vision-mappings/ui-artifact.d.ts.map +1 -0
  164. package/dist/providers/minimax/vision-mappings/ui-artifact.js +69 -0
  165. package/dist/providers/minimax/vision-mappings/ui-artifact.js.map +1 -0
  166. package/dist/providers/minimax/vision-mappings.generated.d.ts +29 -0
  167. package/dist/providers/minimax/vision-mappings.generated.d.ts.map +1 -0
  168. package/dist/providers/minimax/vision-mappings.generated.js +29 -0
  169. package/dist/providers/minimax/vision-mappings.generated.js.map +1 -0
  170. package/dist/providers/minimax/vision-revisions.d.ts +22 -0
  171. package/dist/providers/minimax/vision-revisions.d.ts.map +1 -0
  172. package/dist/providers/minimax/vision-revisions.js +27 -0
  173. package/dist/providers/minimax/vision-revisions.js.map +1 -0
  174. package/dist/providers/registry.d.ts +36 -0
  175. package/dist/providers/registry.d.ts.map +1 -0
  176. package/dist/providers/registry.js +45 -0
  177. package/dist/providers/registry.js.map +1 -0
  178. package/dist/providers/selection.d.ts +44 -0
  179. package/dist/providers/selection.d.ts.map +1 -0
  180. package/dist/providers/selection.js +85 -0
  181. package/dist/providers/selection.js.map +1 -0
  182. package/dist/providers/types.d.ts +247 -0
  183. package/dist/providers/types.d.ts.map +1 -0
  184. package/dist/providers/types.js +127 -0
  185. package/dist/providers/types.js.map +1 -0
  186. package/dist/providers/zai/adapter.d.ts +35 -0
  187. package/dist/providers/zai/adapter.d.ts.map +1 -0
  188. package/dist/providers/zai/adapter.js +619 -0
  189. package/dist/providers/zai/adapter.js.map +1 -0
  190. package/dist/providers/zai/credentials.d.ts +38 -0
  191. package/dist/providers/zai/credentials.d.ts.map +1 -0
  192. package/dist/providers/zai/credentials.js +60 -0
  193. package/dist/providers/zai/credentials.js.map +1 -0
  194. package/dist/providers/zai/media.d.ts +38 -0
  195. package/dist/providers/zai/media.d.ts.map +1 -0
  196. package/dist/providers/zai/media.js +107 -0
  197. package/dist/providers/zai/media.js.map +1 -0
  198. package/dist/providers/zai/monitor-client.d.ts +53 -0
  199. package/dist/providers/zai/monitor-client.d.ts.map +1 -0
  200. package/dist/providers/zai/monitor-client.js +117 -0
  201. package/dist/providers/zai/monitor-client.js.map +1 -0
  202. package/dist/providers/zai/quota.d.ts +47 -0
  203. package/dist/providers/zai/quota.d.ts.map +1 -0
  204. package/dist/providers/zai/quota.js +127 -0
  205. package/dist/providers/zai/quota.js.map +1 -0
  206. package/package.json +10 -5
@@ -1,6 +1,19 @@
1
1
  /**
2
- * Output formatting for Scoutline
2
+ * Output formatting for Scoutline.
3
+ *
4
+ * This Module exposes the pure, invocation-local output contract from
5
+ * DESIGN.md §3: OUTPUT_MODES, OutputMode, isOutputMode,
6
+ * formatSuccessOutput, and formatErrorOutput. The pure `success` and
7
+ * `error` response builders are retained as utility constructors.
8
+ *
9
+ * P1-10 removed the mutable output surface: there is no module-level output
10
+ * mode, no mode setter/getter, no side-effecting success/error writers, no
11
+ * output-mode environment mutation, and no console writes or process
12
+ * termination here. Command presentation and process writes flow through
13
+ * `invokeCommand` and the Node Adapter.
3
14
  */
15
+ export declare const OUTPUT_MODES: readonly ["data", "json", "pretty", "compact", "markdown", "refs", "tty"];
16
+ export type OutputMode = (typeof OUTPUT_MODES)[number];
4
17
  export interface SuccessResponse<T = unknown> {
5
18
  success: true;
6
19
  data: T;
@@ -13,12 +26,45 @@ export interface ErrorResponse {
13
26
  help?: string;
14
27
  }
15
28
  export type Response<T = unknown> = SuccessResponse<T> | ErrorResponse;
16
- export type OutputMode = "data" | "json" | "pretty" | "compact" | "markdown" | "refs" | "tty";
17
- export declare function setOutputMode(mode: OutputMode): void;
18
- export declare function getOutputMode(): OutputMode;
29
+ export declare function isOutputMode(value: unknown): value is OutputMode;
30
+ /**
31
+ * Pure success formatter.
32
+ *
33
+ * - `data` mode emits the raw JSON-encoded data (no success envelope).
34
+ * - `json` / `pretty` modes emit the success envelope with the timestamp
35
+ * taken from the injected `now` (defaults to `Date.now`). `pretty` uses
36
+ * 2-space indentation.
37
+ * - Text-oriented modes (`compact`, `markdown`, `refs`, `tty`) return the
38
+ * explicitly selected command presentation override when `data` carries
39
+ * one (i.e. `data.presentations[mode]` is a string). Otherwise they
40
+ * fall back to the JSON-encoded data.
41
+ *
42
+ * The function performs no I/O and mutates no shared state.
43
+ */
44
+ export declare function formatSuccessOutput<T>(data: T, mode: OutputMode, now?: () => number): string;
45
+ /**
46
+ * Pure error formatter. Inspects the value through duck typing so this
47
+ * Module does not have to import from `./errors.js` (avoids a circular
48
+ * dependency with the error hierarchy).
49
+ *
50
+ * Recognises a ScoutlineError-shaped object (one carrying `message` and
51
+ * `code`) and surfaces `help` and `statusCode` when present. Plain
52
+ * `Error` instances and unknown values fall through to `UNKNOWN_ERROR`.
53
+ * `pretty` mode indents; all other modes emit compact JSON.
54
+ *
55
+ * The public envelope contains only the documented fields — `success`,
56
+ * `error`, `code`, optional `help`, optional `statusCode` — so stack,
57
+ * cause, raw response body, and any non-envelope property of the input
58
+ * are never serialised. Credential-shaped substrings inside `help` and
59
+ * `error` are redacted.
60
+ *
61
+ * The optional `secrets` argument lets a caller thread the credentials
62
+ * resolved from an injected environment (e.g. `MainDependencies.env`)
63
+ * into redaction, so a secret that exists only in the injected env —
64
+ * and not in ambient `process.env` — is still redacted (Fixup B — B3).
65
+ * When omitted, configured secrets are read from `process.env`.
66
+ */
67
+ export declare function formatErrorOutput(value: unknown, mode: OutputMode, secrets?: string[]): string;
19
68
  export declare function success<T>(data: T): SuccessResponse<T>;
20
69
  export declare function error(message: string, code?: string, help?: string): ErrorResponse;
21
- export declare function output<T>(response: Response<T>): void;
22
- export declare function outputSuccess<T>(data: T): void;
23
- export declare function outputError(message: string, code?: string, help?: string): void;
24
70
  //# sourceMappingURL=output.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/lib/output.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,OAAO;IAC1C,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,CAAC,CAAC;IACR,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,OAAO,IAAI,eAAe,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC;AAEvE,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,KAAK,CAAC;AAI9F,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAGpD;AAED,wBAAgB,aAAa,IAAI,UAAU,CAE1C;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAMtD;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAOlF;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAGrD;AAED,wBAAgB,aAAa,CAAC,CAAC,EA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AG,MAAM,CA2C9F;AAWD,wBAAgB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAMtD;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAOlF"}
@@ -1,14 +1,133 @@
1
1
  /**
2
- * Output formatting for Scoutline
2
+ * Output formatting for Scoutline.
3
+ *
4
+ * This Module exposes the pure, invocation-local output contract from
5
+ * DESIGN.md §3: OUTPUT_MODES, OutputMode, isOutputMode,
6
+ * formatSuccessOutput, and formatErrorOutput. The pure `success` and
7
+ * `error` response builders are retained as utility constructors.
8
+ *
9
+ * P1-10 removed the mutable output surface: there is no module-level output
10
+ * mode, no mode setter/getter, no side-effecting success/error writers, no
11
+ * output-mode environment mutation, and no console writes or process
12
+ * termination here. Command presentation and process writes flow through
13
+ * `invokeCommand` and the Node Adapter.
3
14
  */
4
- let outputMode = process.env.ZAI_OUTPUT_MODE || "data";
5
- export function setOutputMode(mode) {
6
- outputMode = mode;
7
- process.env.ZAI_OUTPUT_MODE = mode;
15
+ import { redactCredentialString, configuredSecrets } from "./redact.js";
16
+ export const OUTPUT_MODES = [
17
+ "data",
18
+ "json",
19
+ "pretty",
20
+ "compact",
21
+ "markdown",
22
+ "refs",
23
+ "tty",
24
+ ];
25
+ export function isOutputMode(value) {
26
+ return typeof value === "string" && OUTPUT_MODES.includes(value);
8
27
  }
9
- export function getOutputMode() {
10
- return outputMode;
28
+ /**
29
+ * Pure success formatter.
30
+ *
31
+ * - `data` mode emits the raw JSON-encoded data (no success envelope).
32
+ * - `json` / `pretty` modes emit the success envelope with the timestamp
33
+ * taken from the injected `now` (defaults to `Date.now`). `pretty` uses
34
+ * 2-space indentation.
35
+ * - Text-oriented modes (`compact`, `markdown`, `refs`, `tty`) return the
36
+ * explicitly selected command presentation override when `data` carries
37
+ * one (i.e. `data.presentations[mode]` is a string). Otherwise they
38
+ * fall back to the JSON-encoded data.
39
+ *
40
+ * The function performs no I/O and mutates no shared state.
41
+ */
42
+ export function formatSuccessOutput(data, mode, now = Date.now) {
43
+ if (mode === "data") {
44
+ return JSON.stringify(data);
45
+ }
46
+ if (mode === "json" || mode === "pretty") {
47
+ const indent = mode === "pretty" ? 2 : 0;
48
+ return JSON.stringify({ success: true, data, timestamp: now() }, null, indent);
49
+ }
50
+ // Text-oriented modes: prefer an explicitly selected command
51
+ // presentation override carried on `data.presentations`.
52
+ if (data !== null &&
53
+ typeof data === "object" &&
54
+ "presentations" in data &&
55
+ data.presentations !== null &&
56
+ typeof data.presentations === "object") {
57
+ const presentations = data.presentations;
58
+ const override = presentations[mode];
59
+ if (typeof override === "string") {
60
+ return override;
61
+ }
62
+ }
63
+ return JSON.stringify(data);
11
64
  }
65
+ /**
66
+ * Pure error formatter. Inspects the value through duck typing so this
67
+ * Module does not have to import from `./errors.js` (avoids a circular
68
+ * dependency with the error hierarchy).
69
+ *
70
+ * Recognises a ScoutlineError-shaped object (one carrying `message` and
71
+ * `code`) and surfaces `help` and `statusCode` when present. Plain
72
+ * `Error` instances and unknown values fall through to `UNKNOWN_ERROR`.
73
+ * `pretty` mode indents; all other modes emit compact JSON.
74
+ *
75
+ * The public envelope contains only the documented fields — `success`,
76
+ * `error`, `code`, optional `help`, optional `statusCode` — so stack,
77
+ * cause, raw response body, and any non-envelope property of the input
78
+ * are never serialised. Credential-shaped substrings inside `help` and
79
+ * `error` are redacted.
80
+ *
81
+ * The optional `secrets` argument lets a caller thread the credentials
82
+ * resolved from an injected environment (e.g. `MainDependencies.env`)
83
+ * into redaction, so a secret that exists only in the injected env —
84
+ * and not in ambient `process.env` — is still redacted (Fixup B — B3).
85
+ * When omitted, configured secrets are read from `process.env`.
86
+ */
87
+ export function formatErrorOutput(value, mode, secrets) {
88
+ const indent = mode === "pretty" ? 2 : 0;
89
+ const resolvedSecrets = secrets ?? configuredSecrets();
90
+ let payload;
91
+ const isShapedError = value !== null && typeof value === "object" && "message" in value && "code" in value;
92
+ if (isShapedError) {
93
+ const err = value;
94
+ const rawError = typeof err.message === "string" ? err.message : String(err.message);
95
+ payload = {
96
+ success: false,
97
+ error: redactCredentialString(rawError, resolvedSecrets),
98
+ code: typeof err.code === "string" ? err.code : "UNKNOWN_ERROR",
99
+ };
100
+ if (typeof err.help === "string" && err.help.length > 0) {
101
+ payload.help = redactCredentialString(err.help, resolvedSecrets);
102
+ }
103
+ if (typeof err.statusCode === "number") {
104
+ payload.statusCode = err.statusCode;
105
+ }
106
+ }
107
+ else if (value instanceof Error) {
108
+ payload = {
109
+ success: false,
110
+ error: redactCredentialString(value.message, resolvedSecrets),
111
+ code: "UNKNOWN_ERROR",
112
+ };
113
+ }
114
+ else {
115
+ payload = {
116
+ success: false,
117
+ error: redactCredentialString(String(value), resolvedSecrets),
118
+ code: "UNKNOWN_ERROR",
119
+ };
120
+ }
121
+ return JSON.stringify(payload, null, indent);
122
+ }
123
+ // ---------------------------------------------------------------------------
124
+ // Pure response builders. These construct plain response objects and perform
125
+ // no I/O. They are retained as utility constructors; the side-effecting
126
+ // mutable output surface (mode setter/getter, the success/error writers, the
127
+ // module-level mode variable, output-mode env mutation, and process
128
+ // termination) was removed in P1-10. Command presentation and process writes
129
+ // now flow exclusively through `invokeCommand` and the Node Adapter.
130
+ // ---------------------------------------------------------------------------
12
131
  export function success(data) {
13
132
  return {
14
133
  success: true,
@@ -24,36 +143,4 @@ export function error(message, code, help) {
24
143
  ...(help && { help }),
25
144
  };
26
145
  }
27
- export function output(response) {
28
- const pretty = outputMode === "pretty";
29
- console.log(JSON.stringify(response, null, pretty ? 2 : 0));
30
- }
31
- export function outputSuccess(data) {
32
- // Search-specific text formats; data is expected to be a pre-formatted string.
33
- if (outputMode === "compact" ||
34
- outputMode === "markdown" ||
35
- outputMode === "refs" ||
36
- outputMode === "tty") {
37
- if (typeof data === "string") {
38
- console.log(data);
39
- return;
40
- }
41
- console.log(JSON.stringify(data, null, 0));
42
- return;
43
- }
44
- if (outputMode === "data") {
45
- if (typeof data === "string") {
46
- console.log(data);
47
- return;
48
- }
49
- console.log(JSON.stringify(data, null, 0));
50
- return;
51
- }
52
- output(success(data));
53
- }
54
- export function outputError(message, code, help) {
55
- const pretty = outputMode === "pretty";
56
- console.error(JSON.stringify(error(message, code, help), null, pretty ? 2 : 0));
57
- process.exit(1);
58
- }
59
146
  //# sourceMappingURL=output.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/lib/output.ts"],"names":[],"mappings":"AAAA;;GAEG;AAmBH,IAAI,UAAU,GAAgB,OAAO,CAAC,GAAG,CAAC,eAA8B,IAAI,MAAM,CAAC;AAEnF,MAAM,UAAU,aAAa,CAAC,IAAgB;IAC5C,UAAU,GAAG,IAAI,CAAC;IAClB,OAAO,CAAC,GAAG,CAAC,eAAe,GAAG,IAAI,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,OAAO,CAAI,IAAO;IAChC,OAAO;QACL,OAAO,EAAE,IAAI;QACb,IAAI;QACJ,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;KACtB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,OAAe,EAAE,IAAa,EAAE,IAAa;IACjE,OAAO;QACL,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,OAAO;QACd,GAAG,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,CAAC;QACrB,GAAG,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,CAAC;KACtB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,MAAM,CAAI,QAAqB;IAC7C,MAAM,MAAM,GAAG,UAAU,KAAK,QAAQ,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CA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;QACD,IAAI,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;YACvC,OAAO,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC;QACtC,CAAC;IACH,CAAC;SAAM,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAClC,OAAO,GAAG;YACR,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,OAAO,EAAE,eAAe,CAAC;YAC7D,IAAI,EAAE,eAAe;SACtB,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,GAAG;YACR,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,sBAAsB,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC;YAC7D,IAAI,EAAE,eAAe;SACtB,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAC/C,CAAC;AAED,8EAA8E;AAC9E,6EAA6E;AAC7E,wEAAwE;AACxE,6EAA6E;AAC7E,oEAAoE;AACpE,6EAA6E;AAC7E,qEAAqE;AACrE,8EAA8E;AAE9E,MAAM,UAAU,OAAO,CAAI,IAAO;IAChC,OAAO;QACL,OAAO,EAAE,IAAI;QACb,IAAI;QACJ,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;KACtB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,OAAe,EAAE,IAAa,EAAE,IAAa;IACjE,OAAO;QACL,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,OAAO;QACd,GAAG,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,CAAC;QACrB,GAAG,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,CAAC;KACtB,CAAC;AACJ,CAAC"}
@@ -1,7 +1,66 @@
1
1
  /**
2
- * Redact sensitive values from tool metadata (for output + caching).
2
+ * Recursive Provider credential redaction (DESIGN.md §16).
3
+ *
4
+ * This Module is the single source of truth for stripping Provider
5
+ * credentials before any value leaves Scoutline's outward boundaries:
6
+ * formatted errors, cached metadata, quota failures, diagnostics output,
7
+ * and fatal shell errors.
8
+ *
9
+ * Redaction properties (Phase 4 P4-01):
10
+ * - Case-insensitive for the canonical credential-shaped keys.
11
+ * - Recursive through nested arrays and plain objects.
12
+ * - Non-mutating — the original input is never modified.
13
+ * - Secret-aware — every configured secret value is replaced inside
14
+ * any string the value tree reaches, not just the configured key.
15
+ * - Empty-safe — empty strings are never treated as a replacement token.
16
+ *
17
+ * The Module retains the legacy `redactSecrets(value, apiKey?)` and
18
+ * `redactTool(tool)` exports so existing call sites keep compiling.
19
+ * New code should pass an explicit array of secrets so every Provider's
20
+ * credential is covered in one pass.
3
21
  */
4
22
  import type { Tool } from "@utcp/sdk";
5
- export declare function redactSecrets(value: unknown, apiKey?: string): unknown;
6
- export declare function redactTool(tool: Tool): Tool;
23
+ /**
24
+ * Replace credential-shaped substrings inside a single string. Useful
25
+ * for error messages and load-failure texts where the value is a flat
26
+ * string rather than a structured object.
27
+ *
28
+ * Replaces:
29
+ * - Bearer authorization values (any case).
30
+ * - x-api-key assignments (any case; `=`, `:`, or whitespace as the
31
+ * key/value separator — covers both `x-api-key=value` and
32
+ * `x-api-key value`).
33
+ * - Z_AI_API_KEY, ZAI_API_KEY, MINIMAX_API_KEY assignments.
34
+ * - The literal credentials passed in `extraSecrets` (each value is
35
+ * replaced wherever it appears; empty strings are skipped).
36
+ */
37
+ export declare function redactCredentialString(input: string, extraSecrets?: string | string[]): string;
38
+ /**
39
+ * Resolve the configured Provider credential values from the current
40
+ * process environment. Returned values are deduplicated and empty
41
+ * entries skipped, so callers can pass the result directly to
42
+ * {@link redactSecrets}.
43
+ */
44
+ export declare function configuredSecrets(env?: NodeJS.ProcessEnv): string[];
45
+ /**
46
+ * Recursively redact credential values from an arbitrary tree.
47
+ *
48
+ * Accepts either a single string (back-compat overload) or an array of
49
+ * secret values. Returns a NEW value tree; the input is never mutated.
50
+ *
51
+ * Key matching is case-insensitive over {@link CREDENTIAL_KEYS}. Plain
52
+ * objects and arrays are descended into. Other object kinds (Date,
53
+ * typed arrays, class instances) are returned as-is so their internal
54
+ * state is not reflected.
55
+ */
56
+ export declare function redactSecrets(value: unknown, secrets?: string | string[]): unknown;
57
+ /**
58
+ * Redact credential-shaped fields from a Tool's metadata tree.
59
+ *
60
+ * Back-compat: when called with a single argument the function reads
61
+ * the configured Provider credentials from the current process
62
+ * environment. When called with an explicit secrets argument, the
63
+ * caller's value is used instead.
64
+ */
65
+ export declare function redactTool(tool: Tool, secrets?: string | string[]): Tool;
7
66
  //# sourceMappingURL=redact.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../../src/lib/redact.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAwBtC,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAoBtE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAI3C"}
1
+ {"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../../src/lib/redact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAqBtC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,CA0B9F;AAuBD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,EAAE,CAOhF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAiClF;AAQD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAMxE"}
@@ -1,50 +1,184 @@
1
1
  /**
2
- * Redact sensitive values from tool metadata (for output + caching).
2
+ * Recursive Provider credential redaction (DESIGN.md §16).
3
+ *
4
+ * This Module is the single source of truth for stripping Provider
5
+ * credentials before any value leaves Scoutline's outward boundaries:
6
+ * formatted errors, cached metadata, quota failures, diagnostics output,
7
+ * and fatal shell errors.
8
+ *
9
+ * Redaction properties (Phase 4 P4-01):
10
+ * - Case-insensitive for the canonical credential-shaped keys.
11
+ * - Recursive through nested arrays and plain objects.
12
+ * - Non-mutating — the original input is never modified.
13
+ * - Secret-aware — every configured secret value is replaced inside
14
+ * any string the value tree reaches, not just the configured key.
15
+ * - Empty-safe — empty strings are never treated as a replacement token.
16
+ *
17
+ * The Module retains the legacy `redactSecrets(value, apiKey?)` and
18
+ * `redactTool(tool)` exports so existing call sites keep compiling.
19
+ * New code should pass an explicit array of secrets so every Provider's
20
+ * credential is covered in one pass.
3
21
  */
4
- const REDACT_KEYS = new Set([
22
+ /**
23
+ * Canonical credential-shaped key names. Lowercased so case-insensitive
24
+ * matching is a one-step compare. Covers every name DESIGN.md §16
25
+ * enumerates plus the common HTTP header aliases.
26
+ */
27
+ const CREDENTIAL_KEYS = new Set([
5
28
  "authorization",
6
- "Authorization",
29
+ "x-api-key",
7
30
  "api_key",
8
- "apiKey",
31
+ "apikey",
9
32
  "access_token",
10
33
  "token",
11
- "Z_AI_API_KEY",
12
- "ZAI_API_KEY",
34
+ "z_ai_api_key",
35
+ "zai_api_key",
36
+ "minimax_api_key",
13
37
  ]);
14
- function redactString(value, apiKey) {
15
- let result = value;
16
- if (apiKey && result.includes(apiKey)) {
17
- result = result.replaceAll(apiKey, "[REDACTED]");
18
- }
19
- if (/^Bearer\s+\S+/.test(result)) {
20
- result = result.replace(/Bearer\s+\S+/, "Bearer [REDACTED]");
38
+ const REDACTED = "[REDACTED]";
39
+ /**
40
+ * Replace credential-shaped substrings inside a single string. Useful
41
+ * for error messages and load-failure texts where the value is a flat
42
+ * string rather than a structured object.
43
+ *
44
+ * Replaces:
45
+ * - Bearer authorization values (any case).
46
+ * - x-api-key assignments (any case; `=`, `:`, or whitespace as the
47
+ * key/value separator — covers both `x-api-key=value` and
48
+ * `x-api-key value`).
49
+ * - Z_AI_API_KEY, ZAI_API_KEY, MINIMAX_API_KEY assignments.
50
+ * - The literal credentials passed in `extraSecrets` (each value is
51
+ * replaced wherever it appears; empty strings are skipped).
52
+ */
53
+ export function redactCredentialString(input, extraSecrets) {
54
+ if (typeof input !== "string")
55
+ return input;
56
+ let result = input;
57
+ result = result.replace(/Bearer\s+\S+/gi, REDACTED);
58
+ // Fixup C — W3: the class accepts either `=`, `:`, or any whitespace
59
+ // as the key/value separator. The trailing `\S+` consumes the secret
60
+ // value; the entire `key + separator + value` span is replaced with
61
+ // the redaction marker.
62
+ result = result.replace(/x-api-key[\s=:]+[^\s,;"'`]+/gi, REDACTED);
63
+ result = result.replace(/Z_AI_API_KEY\s*=\s*\S+/gi, REDACTED);
64
+ result = result.replace(/ZAI_API_KEY\s*=\s*\S+/gi, REDACTED);
65
+ result = result.replace(/MINIMAX_API_KEY\s*=\s*\S+/gi, REDACTED);
66
+ // Embedded credential substrings inside URLs, e.g.
67
+ // `https://user:secret@host/path`. Catches both `https://` and
68
+ // `http://` schemes and replaces the entire URL with the marker so
69
+ // the user info does not leak.
70
+ result = result.replace(/https?:\/\/[^\s/:]+:[^\s@\/]+@[^\s/]+/gi, REDACTED);
71
+ const secrets = normalizeSecrets(extraSecrets);
72
+ for (const secret of secrets) {
73
+ if (secret.length === 0)
74
+ continue;
75
+ // Escape regex meta characters so a secret containing characters
76
+ // like `.` or `+` does not accidentally broaden the replacement.
77
+ const escaped = secret.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
78
+ result = result.replace(new RegExp(escaped, "g"), REDACTED);
21
79
  }
22
80
  return result;
23
81
  }
24
- export function redactSecrets(value, apiKey) {
25
- if (typeof value === "string") {
26
- return redactString(value, apiKey);
82
+ /**
83
+ * Normalise the `secrets` argument to a deduplicated array of
84
+ * non-empty strings. A `undefined` argument yields an empty list;
85
+ * a single string yields `[string]`; an array yields the filtered
86
+ * list.
87
+ */
88
+ function normalizeSecrets(secrets) {
89
+ if (secrets === undefined)
90
+ return [];
91
+ const list = Array.isArray(secrets) ? secrets : [secrets];
92
+ const out = [];
93
+ const seen = new Set();
94
+ for (const item of list) {
95
+ if (typeof item !== "string")
96
+ continue;
97
+ if (item.length === 0)
98
+ continue;
99
+ if (seen.has(item))
100
+ continue;
101
+ seen.add(item);
102
+ out.push(item);
103
+ }
104
+ return out;
105
+ }
106
+ /**
107
+ * Resolve the configured Provider credential values from the current
108
+ * process environment. Returned values are deduplicated and empty
109
+ * entries skipped, so callers can pass the result directly to
110
+ * {@link redactSecrets}.
111
+ */
112
+ export function configuredSecrets(env = process.env) {
113
+ const candidates = [
114
+ env.Z_AI_API_KEY,
115
+ env.ZAI_API_KEY,
116
+ env.MINIMAX_API_KEY,
117
+ ];
118
+ return normalizeSecrets(candidates.filter((c) => typeof c === "string"));
119
+ }
120
+ /**
121
+ * Recursively redact credential values from an arbitrary tree.
122
+ *
123
+ * Accepts either a single string (back-compat overload) or an array of
124
+ * secret values. Returns a NEW value tree; the input is never mutated.
125
+ *
126
+ * Key matching is case-insensitive over {@link CREDENTIAL_KEYS}. Plain
127
+ * objects and arrays are descended into. Other object kinds (Date,
128
+ * typed arrays, class instances) are returned as-is so their internal
129
+ * state is not reflected.
130
+ */
131
+ export function redactSecrets(value, secrets) {
132
+ const normalized = normalizeSecrets(secrets);
133
+ // Fast path: primitive value or null/undefined.
134
+ if (value === null || value === undefined)
135
+ return value;
136
+ const t = typeof value;
137
+ if (t === "string") {
138
+ return redactCredentialString(value, normalized);
27
139
  }
140
+ if (t !== "object")
141
+ return value;
142
+ // Recurse through arrays.
28
143
  if (Array.isArray(value)) {
29
- return value.map((item) => redactSecrets(item, apiKey));
144
+ return value.map((item) => redactSecrets(item, normalized));
30
145
  }
31
- if (value && typeof value === "object") {
32
- const obj = value;
33
- const output = {};
34
- for (const [key, child] of Object.entries(obj)) {
35
- if (REDACT_KEYS.has(key)) {
36
- output[key] = "[REDACTED]";
37
- continue;
38
- }
39
- output[key] = redactSecrets(child, apiKey);
146
+ // Skip exotic non-plain objects: Date, TypedArrays, Map, Set,
147
+ // class instances. Plain objects descend; everything else is left
148
+ // untouched to avoid reflecting internal state.
149
+ if (!isPlainObject(value)) {
150
+ return value;
151
+ }
152
+ const input = value;
153
+ const output = {};
154
+ for (const key of Object.keys(input)) {
155
+ if (CREDENTIAL_KEYS.has(key.toLowerCase())) {
156
+ output[key] = REDACTED;
157
+ continue;
40
158
  }
41
- return output;
159
+ output[key] = redactSecrets(input[key], normalized);
42
160
  }
43
- return value;
161
+ return output;
162
+ }
163
+ function isPlainObject(value) {
164
+ if (value === null || typeof value !== "object")
165
+ return false;
166
+ const proto = Object.getPrototypeOf(value);
167
+ return proto === Object.prototype || proto === null;
44
168
  }
45
- export function redactTool(tool) {
46
- const apiKey = process.env.Z_AI_API_KEY || process.env.ZAI_API_KEY;
169
+ /**
170
+ * Redact credential-shaped fields from a Tool's metadata tree.
171
+ *
172
+ * Back-compat: when called with a single argument the function reads
173
+ * the configured Provider credentials from the current process
174
+ * environment. When called with an explicit secrets argument, the
175
+ * caller's value is used instead.
176
+ */
177
+ export function redactTool(tool, secrets) {
178
+ const resolved = secrets === undefined
179
+ ? configuredSecrets()
180
+ : normalizeSecrets(secrets);
47
181
  const clone = JSON.parse(JSON.stringify(tool));
48
- return redactSecrets(clone, apiKey);
182
+ return redactSecrets(clone, resolved);
49
183
  }
50
184
  //# sourceMappingURL=redact.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"redact.js","sourceRoot":"","sources":["../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25 +36,12 @@ interface SearchResultLike {
36
36
  occurrences?: number;
37
37
  }
38
38
  export declare function formatSearchResultsPretty(results: SearchResultLike[]): string;
39
- interface QuotaLike {
40
- plan?: string;
41
- timeWindow?: {
42
- used?: number;
43
- limit?: number;
44
- remaining?: number;
45
- percentage?: number;
46
- windowHours?: number;
47
- resetsIn?: string | null;
48
- byTool?: Array<{
49
- modelCode?: string;
50
- usage?: number;
51
- }>;
52
- } | null;
53
- tokens?: {
54
- percentage?: number;
55
- resetsIn?: string | null;
56
- } | null;
57
- }
58
- export declare function formatQuotaPretty(q: QuotaLike): string;
39
+ import type { QuotaDashboard } from "../capabilities/quota.js";
40
+ /**
41
+ * Provider-neutral TTY rendering of a {@link QuotaDashboard}. Each
42
+ * Provider entry is labelled with its Provider id and each category by
43
+ * its normalized name; progress bars represent the REMAINING percentage.
44
+ */
45
+ export declare function formatQuotaDashboard(dashboard: QuotaDashboard): string;
59
46
  export {};
60
47
  //# sourceMappingURL=tty.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tty.d.ts","sourceRoot":"","sources":["../../src/lib/tty.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,KAAK,OAAO,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;AAUrC,eAAO,MAAM,KAAK;IAChB,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,KAAK;IACL,MAAM;IACN,GAAG;IACH,OAAO;IACP,IAAI;CACL,CAAC;AAEF,wBAAgB,KAAK,IAAI,OAAO,CAE/B;AAED,uFAAuF;AACvF,wBAAgB,cAAc,CAC5B,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,IAAI,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAClD,KAAK,GAAG,SAAS,CAKnB;AAED,UAAU,gBAAgB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAA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