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 @@
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../src/providers/zai/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AAyBjC,OAAO,EACL,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EACL,YAAY,GAEb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAkC,MAAM,YAAY,CAAC;AACtF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAA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EAAE,CAAC;YACxF,MAAM,KAAK,GAAG,wBAAwB,CAAC,YAAY,CAAC,CAAC;YACrD,MAAM,WAAW,GAAG,8BAA8B,CAAC;gBACjD,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,aAAa;aACd,CAAC,CAAC;YACH,gEAAgE;YAChE,+DAA+D;YAC/D,yCAAyC;YACzC,2DAA2D;YAC3D,gEAAgE;YAChE,iEAAiE;YACjE,+DAA+D;YAC/D,uCAAuC;YACvC,MAAM,UAAU,GAAG,6BAA6B,CAAC;gBAC/C,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,aAAa;gBACb,GAAG,CAAC,YAAY,EAAE,wBAAwB,KAAK,SAAS,IAAI;oBAC1D,cAAc,EAAE,YAAY,CAAC,wBAAwB;iBACtD,CAAC;aACH,CAAC,CAAC;YACH,kEAAkE;YAClE,iEAAiE;YACjE,gEAAgE;YAChE,iEAAiE;YACjE,gDAAgD;YAChD,2DAA2D;YAC3D,4DAA4D;YAC5D,0DAA0D;YAC1D,kDAAkD;YAClD,MAAM,MAAM,GAAG,yBAAyB,CAAC;gBACvC,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,aAAa;gBACb,GAAG,CAAC,YAAY,EAAE,oBAAoB,KAAK,SAAS,IAAI;oBACtD,cAAc,EAAE,YAAY,CAAC,oBAAoB;iBAClD,CAAC;aACH,CAAC,CAAC;YACH,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;QAC/E,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Z.AI credential resolution (DESIGN.md §6, P0-02 — Fixup A — B4, B7).
3
+ *
4
+ * Single source of truth for the Z.AI API key. The primary
5
+ * `Z_AI_API_KEY` is accepted alongside the characterized `ZAI_API_KEY`
6
+ * alias; `Z_AI_API_KEY` takes precedence when both are set. Whitespace-
7
+ * only values are treated as absent, matching the descriptor's
8
+ * `isConfigured` contract.
9
+ *
10
+ * Boundary rules (ARCHITECTURE.md §2):
11
+ * - May import the normalized-error contract only.
12
+ * - Must NOT import transport, command presentation, or another
13
+ * Provider's Adapter.
14
+ *
15
+ * Missing credentials are surfaced as {@link ConfigurationError}
16
+ * (exit 3), distinct from {@link AuthError} (exit 1) which means the
17
+ * Provider REJECTED a presented credential. This mirrors `lib/config.ts`
18
+ * (`loadConfig`/`getApiKey`) so every Z.AI entry point agrees on the
19
+ * missing-credential exit code.
20
+ */
21
+ /**
22
+ * Resolve the Z.AI API key without throwing. `Z_AI_API_KEY` takes
23
+ * precedence over the `ZAI_API_KEY` alias. Returns `undefined` when no
24
+ * non-blank value is present.
25
+ */
26
+ export declare function resolveZaiApiKey(env: NodeJS.ProcessEnv): string | undefined;
27
+ /**
28
+ * Resolve the Z.AI API key or throw {@link ConfigurationError} (exit 3)
29
+ * when it is missing. Call this at every capability invocation gate.
30
+ */
31
+ export declare function requireZaiApiKey(env: NodeJS.ProcessEnv): string;
32
+ /**
33
+ * True when a non-blank Z.AI API key (primary or alias) is configured.
34
+ * Metadata-only: performs no transport construction and reads no other
35
+ * Provider's credentials.
36
+ */
37
+ export declare function isZaiConfigured(env: NodeJS.ProcessEnv): boolean;
38
+ //# sourceMappingURL=credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../src/providers/zai/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAgBH;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,GAAG,SAAS,CAE3E;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAM/D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAE/D"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Z.AI credential resolution (DESIGN.md §6, P0-02 — Fixup A — B4, B7).
3
+ *
4
+ * Single source of truth for the Z.AI API key. The primary
5
+ * `Z_AI_API_KEY` is accepted alongside the characterized `ZAI_API_KEY`
6
+ * alias; `Z_AI_API_KEY` takes precedence when both are set. Whitespace-
7
+ * only values are treated as absent, matching the descriptor's
8
+ * `isConfigured` contract.
9
+ *
10
+ * Boundary rules (ARCHITECTURE.md §2):
11
+ * - May import the normalized-error contract only.
12
+ * - Must NOT import transport, command presentation, or another
13
+ * Provider's Adapter.
14
+ *
15
+ * Missing credentials are surfaced as {@link ConfigurationError}
16
+ * (exit 3), distinct from {@link AuthError} (exit 1) which means the
17
+ * Provider REJECTED a presented credential. This mirrors `lib/config.ts`
18
+ * (`loadConfig`/`getApiKey`) so every Z.AI entry point agrees on the
19
+ * missing-credential exit code.
20
+ */
21
+ import { ConfigurationError } from "../../lib/errors.js";
22
+ const MISSING_KEY_HELP = 'export Z_AI_API_KEY="your-api-key"';
23
+ /**
24
+ * Pick a non-blank raw value from the environment. Returns the original
25
+ * (untrimmed) string when it contains at least one non-whitespace
26
+ * character, otherwise `undefined`.
27
+ */
28
+ function pickNonBlank(raw) {
29
+ if (typeof raw !== "string")
30
+ return undefined;
31
+ return raw.trim().length > 0 ? raw : undefined;
32
+ }
33
+ /**
34
+ * Resolve the Z.AI API key without throwing. `Z_AI_API_KEY` takes
35
+ * precedence over the `ZAI_API_KEY` alias. Returns `undefined` when no
36
+ * non-blank value is present.
37
+ */
38
+ export function resolveZaiApiKey(env) {
39
+ return pickNonBlank(env.Z_AI_API_KEY) ?? pickNonBlank(env.ZAI_API_KEY);
40
+ }
41
+ /**
42
+ * Resolve the Z.AI API key or throw {@link ConfigurationError} (exit 3)
43
+ * when it is missing. Call this at every capability invocation gate.
44
+ */
45
+ export function requireZaiApiKey(env) {
46
+ const key = resolveZaiApiKey(env);
47
+ if (key === undefined) {
48
+ throw new ConfigurationError("Z_AI_API_KEY environment variable is required", MISSING_KEY_HELP);
49
+ }
50
+ return key;
51
+ }
52
+ /**
53
+ * True when a non-blank Z.AI API key (primary or alias) is configured.
54
+ * Metadata-only: performs no transport construction and reads no other
55
+ * Provider's credentials.
56
+ */
57
+ export function isZaiConfigured(env) {
58
+ return resolveZaiApiKey(env) !== undefined;
59
+ }
60
+ //# sourceMappingURL=credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../../src/providers/zai/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,gBAAgB,GAAG,oCAAoC,CAAC;AAE9D;;;;GAIG;AACH,SAAS,YAAY,CAAC,GAAY;IAChC,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAC9C,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AACjD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAsB;IACrD,OAAO,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACzE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAsB;IACrD,MAAM,GAAG,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,MAAM,IAAI,kBAAkB,CAAC,+CAA+C,EAAE,gBAAgB,CAAC,CAAC;IAClG,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,GAAsB;IACpD,OAAO,gBAAgB,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Shared encoded MCP error envelope helpers (DESIGN.md §18).
3
+ *
4
+ * The ZRead and WebReader MCP transports occasionally surface a
5
+ * bare-string error envelope of the shape:
6
+ *
7
+ * MCP error -<status>\n
8
+ * error.code: <numeric>\n
9
+ * error.message: <text>
10
+ * <optional additional lines>
11
+ *
12
+ * The Repository Adapter (P6-04) and the Reader Adapter (Ticket 03)
13
+ * both recognise this shape BEFORE attempting any success parsing.
14
+ * Classification is centralized here so the taxonomy stays consistent
15
+ * across Adapter implementations; each Adapter supplies an operation
16
+ * `label` ("repository", "reader", …) that becomes part of the
17
+ * sanitized outward message. Auth-message labels (401/403) are NOT
18
+ * operation-specific and stay stable.
19
+ *
20
+ * Boundary rules:
21
+ * - This module imports normalized errors only; it imports no
22
+ * transport, no capability contract, and no other Adapter.
23
+ * - The raw Provider body, `error.message`, `reset`, etc. are
24
+ * discarded; outward messages and help text are stable sanitized
25
+ * labels.
26
+ *
27
+ * Historical note: P6-04A corrected the original mapping (status 403
28
+ * must keep exact status 403, not collapse to 401) and P6-04B refined
29
+ * the exhausted-quota phrase matching so that the bare word "limit"
30
+ * inside "rate limited" does NOT trigger terminal QuotaError. Those
31
+ * corrections are baked in here.
32
+ */
33
+ /** Regex that captures the status of an encoded MCP error envelope. */
34
+ export declare const ENCODED_MCP_ERROR_RE: RegExp;
35
+ /**
36
+ * Test whether `raw` looks like an encoded MCP error envelope. Returning
37
+ * `true` forces the caller into the error classification path before any
38
+ * success parser runs. The presence of a numeric status on the first
39
+ * line is the only requirement; the body lines are still parsed lazily.
40
+ */
41
+ export declare function looksLikeEncodedMcpError(raw: unknown): boolean;
42
+ /**
43
+ * Extract the numeric status code from an encoded MCP error envelope.
44
+ * Returns `null` when the prefix is not present or the trailing digits
45
+ * do not parse to a finite integer.
46
+ */
47
+ export declare function extractEncodedStatus(raw: string): number | null;
48
+ /** Extract the documented `error.code:` numeric value, if present. */
49
+ export declare function extractEncodedCode(raw: string): number | null;
50
+ /** Extract the documented `error.message:` line text, if present. */
51
+ export declare function extractEncodedMessage(raw: string): string | null;
52
+ /**
53
+ * Classify an encoded MCP error into a normalized error.
54
+ *
55
+ * The caller MUST have established that the response is an encoded
56
+ * envelope (via {@link looksLikeEncodedMcpError}). This function NEVER
57
+ * embeds the raw Provider body, message, or help into the outward text;
58
+ * it uses stable sanitized labels instead.
59
+ *
60
+ * `label` is the operation name used in the outward ApiError / QuotaError
61
+ * messages (e.g. "repository", "reader"). Auth messages (401, 403) do
62
+ * not carry the label — they read "Z.AI authentication failed" regardless
63
+ * of which Adapter surfaced them.
64
+ *
65
+ * Mapping (DESIGN.md §18; corrected by P6-04A, refined by P6-04B):
66
+ * - code 1310 OR explicit exhausted/limit/quota meaning
67
+ * -> terminal QuotaError
68
+ * (REGARDLESS of the encoded
69
+ * status line; a non-429 line
70
+ * with code 1310 is still an
71
+ * exhausted-quota failure);
72
+ * - 401 -> AuthError, status 401, terminal;
73
+ * - 403 -> normalized ScoutlineError
74
+ * with code AUTH_ERROR and
75
+ * statusCode 403, terminal
76
+ * (avoids widening the
77
+ * global AuthError
78
+ * constructor);
79
+ * - 429 (without exhausted quota) -> ApiError, status 429,
80
+ * retryable through the shared
81
+ * taxonomy;
82
+ * - 5xx -> ApiError matching status,
83
+ * retryable;
84
+ * - other 4xx -> ApiError matching status,
85
+ * terminal;
86
+ * - malformed envelope (no parseable status)
87
+ * -> ApiError 502, retryable.
88
+ */
89
+ export declare function classifyEncodedMcpError(raw: string, label: string): Error;
90
+ //# sourceMappingURL=encoded-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encoded-error.d.ts","sourceRoot":"","sources":["../../../src/providers/zai/encoded-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAIH,uEAAuE;AACvE,eAAO,MAAM,oBAAoB,QAAwB,CAAC;AAE1D;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAE9D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK/D;AAED,sEAAsE;AACtE,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK7D;AAED,qEAAqE;AACrE,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGhE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,CAsEzE"}
@@ -0,0 +1,169 @@
1
+ /**
2
+ * Shared encoded MCP error envelope helpers (DESIGN.md §18).
3
+ *
4
+ * The ZRead and WebReader MCP transports occasionally surface a
5
+ * bare-string error envelope of the shape:
6
+ *
7
+ * MCP error -<status>\n
8
+ * error.code: <numeric>\n
9
+ * error.message: <text>
10
+ * <optional additional lines>
11
+ *
12
+ * The Repository Adapter (P6-04) and the Reader Adapter (Ticket 03)
13
+ * both recognise this shape BEFORE attempting any success parsing.
14
+ * Classification is centralized here so the taxonomy stays consistent
15
+ * across Adapter implementations; each Adapter supplies an operation
16
+ * `label` ("repository", "reader", …) that becomes part of the
17
+ * sanitized outward message. Auth-message labels (401/403) are NOT
18
+ * operation-specific and stay stable.
19
+ *
20
+ * Boundary rules:
21
+ * - This module imports normalized errors only; it imports no
22
+ * transport, no capability contract, and no other Adapter.
23
+ * - The raw Provider body, `error.message`, `reset`, etc. are
24
+ * discarded; outward messages and help text are stable sanitized
25
+ * labels.
26
+ *
27
+ * Historical note: P6-04A corrected the original mapping (status 403
28
+ * must keep exact status 403, not collapse to 401) and P6-04B refined
29
+ * the exhausted-quota phrase matching so that the bare word "limit"
30
+ * inside "rate limited" does NOT trigger terminal QuotaError. Those
31
+ * corrections are baked in here.
32
+ */
33
+ import { ApiError, AuthError, QuotaError, ScoutlineError } from "../../lib/errors.js";
34
+ /** Regex that captures the status of an encoded MCP error envelope. */
35
+ export const ENCODED_MCP_ERROR_RE = /^MCP error -(\d+)\b/;
36
+ /**
37
+ * Test whether `raw` looks like an encoded MCP error envelope. Returning
38
+ * `true` forces the caller into the error classification path before any
39
+ * success parser runs. The presence of a numeric status on the first
40
+ * line is the only requirement; the body lines are still parsed lazily.
41
+ */
42
+ export function looksLikeEncodedMcpError(raw) {
43
+ return typeof raw === "string" && ENCODED_MCP_ERROR_RE.test(raw);
44
+ }
45
+ /**
46
+ * Extract the numeric status code from an encoded MCP error envelope.
47
+ * Returns `null` when the prefix is not present or the trailing digits
48
+ * do not parse to a finite integer.
49
+ */
50
+ export function extractEncodedStatus(raw) {
51
+ const m = raw.match(ENCODED_MCP_ERROR_RE);
52
+ if (!m)
53
+ return null;
54
+ const n = Number.parseInt(m[1], 10);
55
+ return Number.isFinite(n) ? n : null;
56
+ }
57
+ /** Extract the documented `error.code:` numeric value, if present. */
58
+ export function extractEncodedCode(raw) {
59
+ const m = raw.match(/^error\.code:\s*(\d+)/m);
60
+ if (!m)
61
+ return null;
62
+ const n = Number.parseInt(m[1], 10);
63
+ return Number.isFinite(n) ? n : null;
64
+ }
65
+ /** Extract the documented `error.message:` line text, if present. */
66
+ export function extractEncodedMessage(raw) {
67
+ const m = raw.match(/^error\.message:\s*([^\n]+)/m);
68
+ return m ? m[1] : null;
69
+ }
70
+ /**
71
+ * Classify an encoded MCP error into a normalized error.
72
+ *
73
+ * The caller MUST have established that the response is an encoded
74
+ * envelope (via {@link looksLikeEncodedMcpError}). This function NEVER
75
+ * embeds the raw Provider body, message, or help into the outward text;
76
+ * it uses stable sanitized labels instead.
77
+ *
78
+ * `label` is the operation name used in the outward ApiError / QuotaError
79
+ * messages (e.g. "repository", "reader"). Auth messages (401, 403) do
80
+ * not carry the label — they read "Z.AI authentication failed" regardless
81
+ * of which Adapter surfaced them.
82
+ *
83
+ * Mapping (DESIGN.md §18; corrected by P6-04A, refined by P6-04B):
84
+ * - code 1310 OR explicit exhausted/limit/quota meaning
85
+ * -> terminal QuotaError
86
+ * (REGARDLESS of the encoded
87
+ * status line; a non-429 line
88
+ * with code 1310 is still an
89
+ * exhausted-quota failure);
90
+ * - 401 -> AuthError, status 401, terminal;
91
+ * - 403 -> normalized ScoutlineError
92
+ * with code AUTH_ERROR and
93
+ * statusCode 403, terminal
94
+ * (avoids widening the
95
+ * global AuthError
96
+ * constructor);
97
+ * - 429 (without exhausted quota) -> ApiError, status 429,
98
+ * retryable through the shared
99
+ * taxonomy;
100
+ * - 5xx -> ApiError matching status,
101
+ * retryable;
102
+ * - other 4xx -> ApiError matching status,
103
+ * terminal;
104
+ * - malformed envelope (no parseable status)
105
+ * -> ApiError 502, retryable.
106
+ */
107
+ export function classifyEncodedMcpError(raw, label) {
108
+ const status = extractEncodedStatus(raw);
109
+ if (status === null) {
110
+ // Malformed envelope: no parseable status. Retryable, sanitized.
111
+ return new ApiError(`Z.AI ${label} request failed`, 502);
112
+ }
113
+ const code = extractEncodedCode(raw);
114
+ const message = extractEncodedMessage(raw);
115
+ const lowerMessage = (message ?? "").toLowerCase();
116
+ // Exhausted quota: code 1310 OR explicit exhausted/quota/limit-reaching
117
+ // meaning. This branches BEFORE the status mapping so a non-429 encoded
118
+ // status line carrying code 1310 or an explicit exhausted message still
119
+ // becomes terminal `QuotaError`.
120
+ //
121
+ // The bare word "limit" is intentionally NOT matched on its own:
122
+ // "rate limited" is a transient retryable 429, not exhausted quota.
123
+ // "exhausted", "quota", and the multi-word phrases "limit reached" /
124
+ // "limit exceeded" are specific to the exhaustion context (P6-04B):
125
+ // - "Weekly/Monthly Limit Exhausted" -> "exhausted"
126
+ // - "Quota has been exhausted" -> "quota"
127
+ // - "Monthly limit reached" -> "limit reached"
128
+ // - "usage limit exceeded" -> "limit exceeded"
129
+ // Code 1310 is the authoritative numeric signal.
130
+ const isExhausted = code === 1310 ||
131
+ lowerMessage.includes("exhausted") ||
132
+ lowerMessage.includes("quota") ||
133
+ lowerMessage.includes("limit reached") ||
134
+ lowerMessage.includes("limit exceeded");
135
+ if (isExhausted) {
136
+ return new QuotaError(`Z.AI ${label} quota has been exhausted`, "Check your Z.AI quota and try again later");
137
+ }
138
+ if (status === 401) {
139
+ return new AuthError("Z.AI authentication failed");
140
+ }
141
+ if (status === 403) {
142
+ // 403 maps to AUTH_ERROR with status 403, terminal. Constructing
143
+ // a localized normalized ScoutlineError (rather than widening
144
+ // the global AuthError constructor) preserves the documented exact
145
+ // status code without affecting legacy call sites elsewhere in the
146
+ // codebase.
147
+ return new ScoutlineError("Z.AI authentication failed", "AUTH_ERROR", {
148
+ statusCode: 403,
149
+ retryable: false,
150
+ exitCode: 1,
151
+ });
152
+ }
153
+ // 5xx and other 429 -> retryable; other 4xx -> terminal. The retry
154
+ // classifier in `lib/execution.ts` reads `retryable` via the explicit
155
+ // ApiError flag, but the per-status mapping here matches DESIGN.md §10
156
+ // so the constructed errors carry the right shape regardless.
157
+ if (status === 429) {
158
+ return new ApiError(`Z.AI ${label} request failed`, 429);
159
+ }
160
+ if (status >= 500 && status <= 599) {
161
+ return new ApiError(`Z.AI ${label} request failed`, status);
162
+ }
163
+ if (status >= 400 && status <= 499) {
164
+ return new ApiError(`Z.AI ${label} request failed`, status);
165
+ }
166
+ // Unrecognized numeric status (e.g. 0, negative) -> retryable 502.
167
+ return new ApiError(`Z.AI ${label} request failed`, 502);
168
+ }
169
+ //# sourceMappingURL=encoded-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encoded-error.js","sourceRoot":"","sources":["../../../src/providers/zai/encoded-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEtF,uEAAu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ACZ,OAAO,IAAI,cAAc,CAAC,4BAA4B,EAAE,YAAY,EAAE;YACpE,UAAU,EAAE,GAAG;YACf,SAAS,EAAE,KAAK;YAChB,QAAQ,EAAE,CAAC;SACZ,CAAC,CAAC;IACL,CAAC;IAED,mEAAmE;IACnE,sEAAsE;IACtE,uEAAuE;IACvE,8DAA8D;IAC9D,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;QACnB,OAAO,IAAI,QAAQ,CAAC,QAAQ,KAAK,iBAAiB,EAAE,GAAG,CAAC,CAAC;IAC3D,CAAC;IACD,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;QACnC,OAAO,IAAI,QAAQ,CAAC,QAAQ,KAAK,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;IACD,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;QACnC,OAAO,IAAI,QAAQ,CAAC,QAAQ,KAAK,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;IAED,mEAAmE;IACnE,OAAO,IAAI,QAAQ,CAAC,QAAQ,KAAK,iBAAiB,EAAE,GAAG,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Z.AI Provider Media Module (DESIGN.md §9 — P3-02).
3
+ *
4
+ * Owns Z.AI-local media facts: accepted image and video extensions, size
5
+ * limits, existence checks, and absolute-path resolution. Commands pass
6
+ * raw path-or-URL strings; this module is the single owner of every
7
+ * Provider-specific media decision for Z.AI.
8
+ *
9
+ * Boundary rules (ARCHITECTURE.md §2):
10
+ * - May import normalized errors from `lib/errors.ts`.
11
+ * - Must NOT read file content. The Z.AI MCP receives the validated
12
+ * absolute path; it never receives a data URI or file bytes from
13
+ * this module. Only `stat` (existence + size) is performed.
14
+ *
15
+ * Media rules (DESIGN.md §9 Z.AI):
16
+ * - Local image: JPG, JPEG, PNG (case-insensitive), at most 5 MiB.
17
+ * - Local video: preserve the Phase 0 extension set and 8 MiB limit.
18
+ * - Local source becomes an absolute path after validation.
19
+ * - HTTP(S) source passes through without local filesystem access.
20
+ * - Missing local file rejects with `FILE_ERROR`.
21
+ * - Non-HTTP URL-like strings and unsupported extensions reject with
22
+ * `VALIDATION_ERROR` and Provider-specific supported-format help.
23
+ */
24
+ /**
25
+ * Resolve a Z.AI image source into the value the Z.AI MCP consumes. For a
26
+ * local file, validates existence, size (≤ 5 MiB), and extension
27
+ * (JPG/JPEG/PNG) and returns the absolute path. For an HTTP(S) URL,
28
+ * returns the URL unchanged without touching the local filesystem.
29
+ */
30
+ export declare function resolveImageSource(source: string): string;
31
+ /**
32
+ * Resolve a Z.AI video source into the value the Z.AI MCP consumes. For a
33
+ * local file, validates existence, size (≤ 8 MiB), and extension (the
34
+ * Phase 0 set) and returns the absolute path. For an HTTP(S) URL, returns
35
+ * the URL unchanged.
36
+ */
37
+ export declare function resolveVideoSource(source: string): string;
38
+ //# sourceMappingURL=media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/providers/zai/media.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AA8EH;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAezD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAezD"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Z.AI Provider Media Module (DESIGN.md §9 — P3-02).
3
+ *
4
+ * Owns Z.AI-local media facts: accepted image and video extensions, size
5
+ * limits, existence checks, and absolute-path resolution. Commands pass
6
+ * raw path-or-URL strings; this module is the single owner of every
7
+ * Provider-specific media decision for Z.AI.
8
+ *
9
+ * Boundary rules (ARCHITECTURE.md §2):
10
+ * - May import normalized errors from `lib/errors.ts`.
11
+ * - Must NOT read file content. The Z.AI MCP receives the validated
12
+ * absolute path; it never receives a data URI or file bytes from
13
+ * this module. Only `stat` (existence + size) is performed.
14
+ *
15
+ * Media rules (DESIGN.md §9 Z.AI):
16
+ * - Local image: JPG, JPEG, PNG (case-insensitive), at most 5 MiB.
17
+ * - Local video: preserve the Phase 0 extension set and 8 MiB limit.
18
+ * - Local source becomes an absolute path after validation.
19
+ * - HTTP(S) source passes through without local filesystem access.
20
+ * - Missing local file rejects with `FILE_ERROR`.
21
+ * - Non-HTTP URL-like strings and unsupported extensions reject with
22
+ * `VALIDATION_ERROR` and Provider-specific supported-format help.
23
+ */
24
+ import * as fs from "node:fs";
25
+ import * as path from "node:path";
26
+ import { FileError, ValidationError } from "../../lib/errors.js";
27
+ // ---------------------------------------------------------------------------
28
+ // Z.AI media limits (DESIGN.md §9)
29
+ // ---------------------------------------------------------------------------
30
+ const ZAI_IMAGE_EXTENSIONS = [".jpg", ".jpeg", ".png"];
31
+ const ZAI_VIDEO_EXTENSIONS = [".mp4", ".mov", ".m4v", ".avi", ".webm", ".wmv"];
32
+ const ZAI_MAX_IMAGE_BYTES = 5 * 1024 * 1024; // 5 MiB
33
+ const ZAI_MAX_VIDEO_BYTES = 8 * 1024 * 1024; // 8 MiB
34
+ const ZAI_IMAGE_FORMAT_HELP = "Supported Z.AI image formats: JPG, JPEG, PNG (max 5 MiB)";
35
+ const ZAI_VIDEO_FORMAT_HELP = "Supported Z.AI video formats: MP4, MOV, M4V, AVI, WebM, WMV (max 8 MiB)";
36
+ // ---------------------------------------------------------------------------
37
+ // Source classification
38
+ // ---------------------------------------------------------------------------
39
+ /**
40
+ * A leading `<scheme>://` that is NOT `http(s)://` (e.g. `ftp://`, `file://`)
41
+ * is a URL-like string Z.AI cannot consume. It is rejected up front with
42
+ * `VALIDATION_ERROR` rather than falling through to a misleading local-file
43
+ * `FILE_ERROR`.
44
+ */
45
+ const URL_SCHEME_PATTERN = /^[a-z][a-z0-9+.-]*:\/\//i;
46
+ function classifySource(source) {
47
+ if (source.startsWith("http://") || source.startsWith("https://")) {
48
+ return "http";
49
+ }
50
+ if (URL_SCHEME_PATTERN.test(source)) {
51
+ return "unsupported-url";
52
+ }
53
+ return "local";
54
+ }
55
+ // ---------------------------------------------------------------------------
56
+ // Local media validation (existence + size + extension; never reads content)
57
+ // ---------------------------------------------------------------------------
58
+ function validateLocalMedia(source, allowedExtensions, maxBytes, formatHelp) {
59
+ const resolved = path.resolve(source);
60
+ if (!fs.existsSync(resolved)) {
61
+ throw new FileError(`File not found: ${source}`, "Check the file path is correct");
62
+ }
63
+ const stats = fs.statSync(resolved);
64
+ if (stats.size > maxBytes) {
65
+ throw new ValidationError(`File exceeds the ${(maxBytes / 1024 / 1024).toFixed(0)} MiB limit ` +
66
+ `(${(stats.size / 1024 / 1024).toFixed(2)} MiB)`, formatHelp);
67
+ }
68
+ const ext = path.extname(resolved).toLowerCase();
69
+ if (!allowedExtensions.includes(ext)) {
70
+ throw new ValidationError(`Unsupported media format: ${ext || "(no extension)"}`, formatHelp);
71
+ }
72
+ return resolved;
73
+ }
74
+ // ---------------------------------------------------------------------------
75
+ // Public resolvers
76
+ // ---------------------------------------------------------------------------
77
+ /**
78
+ * Resolve a Z.AI image source into the value the Z.AI MCP consumes. For a
79
+ * local file, validates existence, size (≤ 5 MiB), and extension
80
+ * (JPG/JPEG/PNG) and returns the absolute path. For an HTTP(S) URL,
81
+ * returns the URL unchanged without touching the local filesystem.
82
+ */
83
+ export function resolveImageSource(source) {
84
+ const kind = classifySource(source);
85
+ if (kind === "http")
86
+ return source;
87
+ if (kind === "unsupported-url") {
88
+ throw new ValidationError(`Unsupported source scheme for Z.AI vision`, "Use an HTTP(S) URL or a local file path");
89
+ }
90
+ return validateLocalMedia(source, ZAI_IMAGE_EXTENSIONS, ZAI_MAX_IMAGE_BYTES, ZAI_IMAGE_FORMAT_HELP);
91
+ }
92
+ /**
93
+ * Resolve a Z.AI video source into the value the Z.AI MCP consumes. For a
94
+ * local file, validates existence, size (≤ 8 MiB), and extension (the
95
+ * Phase 0 set) and returns the absolute path. For an HTTP(S) URL, returns
96
+ * the URL unchanged.
97
+ */
98
+ export function resolveVideoSource(source) {
99
+ const kind = classifySource(source);
100
+ if (kind === "http")
101
+ return source;
102
+ if (kind === "unsupported-url") {
103
+ throw new ValidationError(`Unsupported source scheme for Z.AI vision`, "Use an HTTP(S) URL or a local file path");
104
+ }
105
+ return validateLocalMedia(source, ZAI_VIDEO_EXTENSIONS, ZAI_MAX_VIDEO_BYTES, ZAI_VIDEO_FORMAT_HELP);
106
+ }
107
+ //# sourceMappingURL=media.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.js","sourceRoot":"","sources":["../../../src/providers/zai/media.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEjE,8EAA8E;AAC9E,mCAAmC;AACnC,8EAA8E;AAE9E,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AACvD,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAE/E,MAAM,mBAAmB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,QAAQ;AACrD,MAAM,mBAAmB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,QAAQ;AAErD,MAAM,qBAAqB,GAAG,0DAA0D,CAAC;AACzF,MAAM,qBAAqB,GACzB,yEAAyE,CAAC;AAE5E,8EAA8E;AAC9E,wBAAwB;AACxB,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,kBAAkB,GAAG,0BAA0B,CAAC;AAItD,SAAS,cAAc,CAAC,MAAc;IACpC,I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IAChG,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,MAAM,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC;IACnC,IAAI,IAAI,KAAK,iBAAiB,EAAE,CAAC;QAC/B,MAAM,IAAI,eAAe,CACvB,2CAA2C,EAC3C,yCAAyC,CAC1C,CAAC;IACJ,CAAC;IACD,OAAO,kBAAkB,CACvB,MAAM,EACN,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,CACtB,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,MAAM,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC;IACnC,IAAI,IAAI,KAAK,iBAAiB,EAAE,CAAC;QAC/B,MAAM,IAAI,eAAe,CACvB,2CAA2C,EAC3C,yCAAyC,CAC1C,CAAC;IACJ,CAAC;IACD,OAAO,kBAAkB,CACvB,MAAM,EACN,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,CACtB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Z.AI Monitor API client — Provider-local transport (DESIGN.md §13, P4-02).
3
+ *
4
+ * This Module owns the Z.AI monitor endpoint fetch mechanics moved here
5
+ * from `lib/monitor-client.ts`. It performs direct HTTP against
6
+ * `https://api.z.ai` (overridable via `ZAI_MONITOR_BASE_URL`) with an
7
+ * auth quirk: try the raw key first, and on 401 retry the same request
8
+ * with a `Bearer` prefix. Every transport dependency (fetch, timer,
9
+ * environment) is injectable so tests drive auth fallback and timeout
10
+ * deterministically without touching globals.
11
+ *
12
+ * Boundary rules (ARCHITECTURE.md §2):
13
+ * - May import Provider identity types, normalized errors.
14
+ * - Must NOT import command presentation or another Provider's Adapter.
15
+ *
16
+ * Raw response text NEVER enters public errors. A non-2xx response is
17
+ * mapped to a stable normalized error (`AuthError` for 401/403, `ApiError`
18
+ * otherwise) whose message carries no response body. Transport failures
19
+ * map to `TimeoutError`/`NetworkError`.
20
+ *
21
+ * This transport performs ONE logical attempt (including the auth-scheme
22
+ * fallback). Shared execution owns retry policy.
23
+ */
24
+ import type { ProviderQuotaFetch } from "../types.js";
25
+ /** Injectable fetch signature (shared duck-typed port). */
26
+ export type ZaiMonitorFetch = ProviderQuotaFetch;
27
+ /** Fetch response shape this transport consumes. */
28
+ export type ZaiMonitorFetchResponse = Awaited<ReturnType<ZaiMonitorFetch>>;
29
+ /** Injectable transport dependencies. */
30
+ export interface ZaiMonitorDeps {
31
+ readonly fetch?: ZaiMonitorFetch;
32
+ readonly setTimeout?: typeof setTimeout;
33
+ readonly clearTimeout?: typeof clearTimeout;
34
+ readonly env?: NodeJS.ProcessEnv;
35
+ }
36
+ /** Raw Z.AI quota-limit response shape (monitor endpoint). */
37
+ export interface ZaiRawQuotaLimit {
38
+ level?: string;
39
+ limits?: unknown[];
40
+ }
41
+ /**
42
+ * Perform one authenticated GET against the monitor API with the raw-key
43
+ * then Bearer auth fallback. Returns the unwrapped `data` payload (or the
44
+ * whole body when no `data` envelope is present).
45
+ *
46
+ * `path` is appended to the monitor base; `params` become query params.
47
+ */
48
+ export declare function fetchZaiMonitorPath(apiKey: string, path: string, params: Record<string, string> | undefined, deps?: ZaiMonitorDeps): Promise<unknown>;
49
+ /**
50
+ * Fetch the Z.AI quota-limit payload (one attempt, auth-scheme fallback).
51
+ */
52
+ export declare function fetchZaiQuotaLimit(apiKey: string, deps?: ZaiMonitorDeps): Promise<ZaiRawQuotaLimit>;
53
+ //# sourceMappingURL=monitor-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monitor-client.d.ts","sourceRoot":"","sources":["../../../src/providers/zai/monitor-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAKtD,2DAA2D;AAC3D,MAAM,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAEjD,oDAAoD;AACpD,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC;AAE3E,yCAAyC;AACzC,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,UAAU,CAAC;IACxC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,YAAY,CAAC;IAC5C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CAClC;AAED,8DAA8D;AAC9D,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC;CACpB;AAsCD;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC1C,IAAI,GAAE,cAAmB,GACxB,OAAO,CAAC,OAAO,CAAC,CAgDlB;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,cAAmB,GACxB,OAAO,CAAC,gBAAgB,CAAC,CAO3B"}