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
@@ -0,0 +1,443 @@
1
+ /**
2
+ * MiniMax Search Adapter (DESIGN.md §5, §7, §12 — P2-04).
3
+ *
4
+ * Implements the real MiniMax Provider Descriptor with Search support
5
+ * on top of the transitional `mmx-cli/sdk`. The Adapter owns
6
+ * credentials, SDK lifecycle, Provider field mapping, and failure
7
+ * normalization; shared execution owns cache and retry policy.
8
+ *
9
+ * Boundary rules (ARCHITECTURE.md §2):
10
+ * - May import capability types, normalized errors, Provider identity
11
+ * types, and the Adapter-local SDK client factory.
12
+ * - Must NOT import `mmx-cli/sdk` directly (only sdk-client.ts does),
13
+ * command presentation, output mode, or another Provider's Adapter.
14
+ *
15
+ * Field mapping (DESIGN.md §7 MiniMax mapping):
16
+ * organic[].title -> title
17
+ * organic[].link -> url
18
+ * organic[].snippet -> summary
19
+ * organic[].date -> date (optional)
20
+ *
21
+ * The Adapter sends ONLY the query string to `sdk.search.query`. It
22
+ * NEVER sends count or unsupported controls. MiniMax rejects domain,
23
+ * recency, contentSize, and location controls with
24
+ * `UNSUPPORTED_OPTION` before SDK construction or credential access
25
+ * (FR-012).
26
+ */
27
+ import crypto from "node:crypto";
28
+ import { visionOperationToCapability } from "../../capabilities/vision.js";
29
+ import { ApiError, AuthError, ConfigurationError, NetworkError, TimeoutError, UnsupportedCapabilityError, ValidationError, UnsupportedOptionError, } from "../../lib/errors.js";
30
+ import { loadMiniMaxConfig } from "./config.js";
31
+ import { createMiniMaxSdk } from "./sdk-client.js";
32
+ import { resolveImageSource } from "./media.js";
33
+ import { createMiniMaxQuotaCapability } from "./quota.js";
34
+ import { fetchMiniMaxQuota, } from "./quota-client.js";
35
+ import { isMiniMaxVisionOperationSupported, SPECIALIZED_VISION_OPERATION_SET, SPECIALIZED_VISION_OPERATIONS, } from "./vision-conformance.js";
36
+ import { MINIMAX_VISION_MAPPINGS } from "./vision-mappings.generated.js";
37
+ // ---------------------------------------------------------------------------
38
+ // Provider-owned credential fingerprint
39
+ // ---------------------------------------------------------------------------
40
+ function credentialFingerprint(apiKey) {
41
+ return crypto.createHash("sha256").update(apiKey).digest("hex");
42
+ }
43
+ function resolveApiKey(env) {
44
+ const key = env.MINIMAX_API_KEY;
45
+ if (typeof key !== "string" || key.trim().length === 0) {
46
+ // Missing credentials are a configuration failure (exit 3), not an
47
+ // auth failure. AuthError (exit 1) is reserved for a credential the
48
+ // Provider REJECTED (Fixup A — B7). This mirrors loadMiniMaxConfig.
49
+ throw new ConfigurationError("MINIMAX_API_KEY environment variable is required", 'export MINIMAX_API_KEY="your-api-key"');
50
+ }
51
+ return key;
52
+ }
53
+ // ---------------------------------------------------------------------------
54
+ // Validation (FR-012): reject unsupported controls before any SDK access
55
+ // ---------------------------------------------------------------------------
56
+ const UNSUPPORTED_CONTROLS = ["domain", "recency", "contentSize", "location"];
57
+ function assertNoUnsupportedControls(request) {
58
+ const controls = request.controls;
59
+ if (!controls)
60
+ return;
61
+ for (const key of UNSUPPORTED_CONTROLS) {
62
+ if (controls[key] !== undefined) {
63
+ throw new UnsupportedOptionError("minimax", "search", key);
64
+ }
65
+ }
66
+ }
67
+ // ---------------------------------------------------------------------------
68
+ // Response normalization (DESIGN.md §7 MiniMax mapping)
69
+ // ---------------------------------------------------------------------------
70
+ function normalizeMiniMaxSearchResults(raw) {
71
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
72
+ throw new ApiError("MiniMax search returned a malformed response", 500);
73
+ }
74
+ const envelope = raw;
75
+ if (!Array.isArray(envelope.organic)) {
76
+ throw new ApiError("MiniMax search returned a malformed response", 500);
77
+ }
78
+ const out = [];
79
+ for (const entry of envelope.organic) {
80
+ if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
81
+ throw new ApiError("MiniMax search returned a malformed response", 500);
82
+ }
83
+ const record = entry;
84
+ const title = record.title;
85
+ const link = record.link;
86
+ const snippet = record.snippet;
87
+ if (typeof title !== "string" || typeof link !== "string" || typeof snippet !== "string") {
88
+ throw new ApiError("MiniMax search returned a malformed response", 500);
89
+ }
90
+ const source = { title, url: link, summary: snippet };
91
+ if (typeof record.date === "string") {
92
+ source.date = record.date;
93
+ }
94
+ out.push(source);
95
+ }
96
+ return out;
97
+ }
98
+ // ---------------------------------------------------------------------------
99
+ // Failure normalization: stable public codes, no raw payloads (NFR-006)
100
+ // ---------------------------------------------------------------------------
101
+ /**
102
+ * Resolve a stable HTTP-style status code for retry classification.
103
+ * Explicit terminal client errors (404, 400, 410, 422) map to their
104
+ * real codes; retryable server errors (500, 502, 503, 504) map to
105
+ * themselves. Unknown failures default to 500 (transient). When the
106
+ * caller already carries a numeric status (a typed ApiError), that
107
+ * status is honoured directly (DESIGN.md §10).
108
+ */
109
+ function inferStatusCode(lower, known) {
110
+ if (typeof known === "number" && Number.isFinite(known))
111
+ return known;
112
+ if (lower.includes("404") || lower.includes("not found"))
113
+ return 404;
114
+ if (lower.includes("400") || lower.includes("bad request"))
115
+ return 400;
116
+ if (lower.includes("410") || lower.includes("gone"))
117
+ return 410;
118
+ if (lower.includes("422") || lower.includes("unprocessable"))
119
+ return 422;
120
+ if (lower.includes("500") || lower.includes("internal"))
121
+ return 500;
122
+ if (lower.includes("502") || lower.includes("bad gateway"))
123
+ return 502;
124
+ if (lower.includes("503") || lower.includes("service unavailable"))
125
+ return 503;
126
+ if (lower.includes("504") || lower.includes("gateway timeout"))
127
+ return 504;
128
+ return 500;
129
+ }
130
+ function normalizeMiniMaxError(error) {
131
+ // Configuration/option/validation errors carry clean, human-authored
132
+ // messages and are safe to surface verbatim.
133
+ if (error instanceof ValidationError ||
134
+ error instanceof UnsupportedOptionError ||
135
+ error instanceof ConfigurationError) {
136
+ return error;
137
+ }
138
+ // Re-wrap typed transport errors with sanitized messages so a raw
139
+ // Provider response body embedded upstream never survives. Code +
140
+ // statusCode (retry signal) are preserved.
141
+ if (error instanceof AuthError) {
142
+ return new AuthError("MiniMax authentication failed");
143
+ }
144
+ if (error instanceof NetworkError) {
145
+ return new NetworkError("MiniMax network error");
146
+ }
147
+ if (error instanceof TimeoutError) {
148
+ // Fixup D: preserve the original error's duration instead of
149
+ // reconstructing it from an ambient process.env that may differ from
150
+ // the injected env. The rewrapped error carries the same duration.
151
+ return new TimeoutError(error.durationMs);
152
+ }
153
+ if (error instanceof ApiError) {
154
+ const statusCode = inferStatusCode("", error.statusCode);
155
+ return new ApiError("MiniMax request failed", statusCode);
156
+ }
157
+ const message = error instanceof Error ? error.message : String(error);
158
+ const lower = message.toLowerCase();
159
+ if (lower.includes("401") ||
160
+ lower.includes("403") ||
161
+ lower.includes("unauthorized") ||
162
+ lower.includes("forbidden")) {
163
+ return new AuthError("MiniMax authentication failed");
164
+ }
165
+ if (lower.includes("timeout") || lower.includes("timed out") || lower.includes("etimedout")) {
166
+ return new TimeoutError(parseInt(process.env.MINIMAX_TIMEOUT || "30000", 10));
167
+ }
168
+ if (lower.includes("econnrefused") ||
169
+ lower.includes("econnreset") ||
170
+ lower.includes("network") ||
171
+ lower.includes("enotfound") ||
172
+ lower.includes("fetch failed")) {
173
+ return new NetworkError("MiniMax network error");
174
+ }
175
+ if (lower.includes("429") || lower.includes("rate limit")) {
176
+ return new ApiError("MiniMax rate limit exceeded", 429);
177
+ }
178
+ return new ApiError("MiniMax search request failed", inferStatusCode(lower));
179
+ }
180
+ function createMiniMaxSearchCapability(options) {
181
+ const { env, sdkConstructor } = options;
182
+ const capability = {
183
+ validate(request) {
184
+ if (!request || typeof request.query !== "string" || request.query.trim() === "") {
185
+ throw new ValidationError("Search query must contain at least one non-whitespace character");
186
+ }
187
+ assertNoUnsupportedControls(request);
188
+ },
189
+ cacheIdentity(request) {
190
+ const apiKey = resolveApiKey(env);
191
+ const identityRequest = {
192
+ query: request.query,
193
+ };
194
+ if (request.controls) {
195
+ identityRequest.controls = request.controls;
196
+ }
197
+ return {
198
+ provider: "minimax",
199
+ capability: "search",
200
+ credentialFingerprint: credentialFingerprint(apiKey),
201
+ request: identityRequest,
202
+ // MiniMax never probes legacy keys — no legacyCandidates.
203
+ };
204
+ },
205
+ async invoke(request) {
206
+ // Validate before any credential access or SDK construction.
207
+ capability.validate(request);
208
+ const config = loadMiniMaxConfig(env);
209
+ try {
210
+ const sdk = createMiniMaxSdk(config, sdkConstructor);
211
+ const raw = await sdk.search.query(request.query);
212
+ return normalizeMiniMaxSearchResults(raw);
213
+ }
214
+ catch (error) {
215
+ throw normalizeMiniMaxError(error);
216
+ }
217
+ },
218
+ };
219
+ return capability;
220
+ }
221
+ function resolveSpecializedSupportCheck(injected) {
222
+ if (injected)
223
+ return injected;
224
+ return (operation) => isMiniMaxVisionOperationSupported(operation);
225
+ }
226
+ /**
227
+ * Decide whether the MiniMax Adapter supports a Vision operation.
228
+ *
229
+ * `interpret-image` is supported unconditionally (the base release
230
+ * wires it through `sdk.vision.describe`). Specialized operations
231
+ * (`ui-artifact`, `extract-text`, `diagnose-error`, `diagram`,
232
+ * `chart`) are gated by the compiled conformance registry
233
+ * (DESIGN.md §15) — at P5-02 every entry is pending, so every
234
+ * specialized operation is unsupported here. `diff` and `video`
235
+ * remain Z.AI-only and are never supported by MiniMax.
236
+ *
237
+ * Pure: no Provider call, no env read, no I/O. The conformance query
238
+ * is a snapshot read of a frozen registry assembled at module load.
239
+ *
240
+ * `isSpecialized` is the injected support check (or the compiled
241
+ * registry query). Tests pass it via
242
+ * `dependencies.isSpecializedVisionOperationSupported`; production
243
+ * passes nothing and the registry query is used.
244
+ */
245
+ function supportsMiniMaxVisionOperation(operation, isSpecialized) {
246
+ if (operation === "interpret-image")
247
+ return true;
248
+ if (SPECIALIZED_VISION_OPERATION_SET.has(operation)) {
249
+ return isSpecialized(operation);
250
+ }
251
+ return false;
252
+ }
253
+ /**
254
+ * Build the MiniMax Vision Capability. Maps `interpret-image` to
255
+ * `sdk.vision.describe`. The validated image source maps to `image`; the
256
+ * instruction maps to the optional `prompt`. Only a nonempty text result
257
+ * (extracted from the characterized `{ content }` envelope) is normalized.
258
+ *
259
+ * Specialized operations route through their operation-specific mapping
260
+ * Module when the support check returns true. The support decision is
261
+ * derived from the compiled conformance registry; tests may inject a
262
+ * forced-support function via `options.isSpecializedVisionOperationSupported`
263
+ * so the routing branch can be exercised without flipping a compiled
264
+ * attestation (DESIGN.md §15).
265
+ *
266
+ * Media is resolved after the configuration check; the SDK performs
267
+ * data-URI conversion, so the media module never reads file content.
268
+ * Vision never uses the response cache (FR-022); shared execution owns
269
+ * the retry policy.
270
+ */
271
+ function createMiniMaxVisionCapability(options) {
272
+ const { env, sdkConstructor, isSpecializedVisionOperationSupported } = options;
273
+ const isSpecialized = resolveSpecializedSupportCheck(isSpecializedVisionOperationSupported);
274
+ const capability = {
275
+ supports(operation) {
276
+ return supportsMiniMaxVisionOperation(operation, isSpecialized);
277
+ },
278
+ async invoke(request) {
279
+ // Fail closed BEFORE any credential, media, or SDK access. The
280
+ // support decision is the single registry-driven gate; every
281
+ // specialized operation stays unsupported at P5-02 because every
282
+ // registry entry is pending.
283
+ if (!supportsMiniMaxVisionOperation(request.operation, isSpecialized)) {
284
+ throw new UnsupportedCapabilityError("minimax", visionOperationToCapability(request.operation));
285
+ }
286
+ // Configuration check (credential) before media resolution.
287
+ const config = loadMiniMaxConfig(env);
288
+ // Specialized operations compose the prompt through their mapping
289
+ // Module. The mapping Module is the single source of intent,
290
+ // option formatting, and result normalization for that operation
291
+ // (DESIGN.md §15). When the support gate is open but the Module is
292
+ // somehow missing, surface an `API_ERROR` — the routing invariant
293
+ // is broken only via a coding bug, never via runtime drift.
294
+ if (request.operation !== "interpret-image") {
295
+ const specializedOp = request.operation;
296
+ const mapping = MINIMAX_VISION_MAPPINGS[specializedOp];
297
+ if (!mapping) {
298
+ throw new ApiError(`MiniMax vision mapping for ${specializedOp} is supported but no mapping Module is wired`, 500);
299
+ }
300
+ // Specialized requests always carry a `source`; the support gate
301
+ // above excludes `diff` (no `source`) and `video` (unsupported).
302
+ const image = resolveImageSource(request.source);
303
+ const prompt = mapping.composePrompt(request);
304
+ try {
305
+ const sdk = createMiniMaxSdk(config, sdkConstructor);
306
+ const raw = await sdk.vision.describe({ image, prompt });
307
+ return mapping.normalizeResult(raw);
308
+ }
309
+ catch (error) {
310
+ throw normalizeMiniMaxError(error);
311
+ }
312
+ }
313
+ const image = resolveImageSource(request.source);
314
+ try {
315
+ const sdk = createMiniMaxSdk(config, sdkConstructor);
316
+ const describeRequest = { image };
317
+ if (request.instruction && request.instruction.length > 0) {
318
+ describeRequest.prompt = request.instruction;
319
+ }
320
+ const raw = await sdk.vision.describe(describeRequest);
321
+ return normalizeMiniMaxVisionResult(raw);
322
+ }
323
+ catch (error) {
324
+ throw normalizeMiniMaxError(error);
325
+ }
326
+ },
327
+ };
328
+ return capability;
329
+ }
330
+ /**
331
+ * Normalize the MiniMax vision result to a nonempty text string. The
332
+ * characterized `VlmResponse` envelope is `{ content: string }`; any other
333
+ * shape, or an empty content, is a malformed result.
334
+ */
335
+ function normalizeMiniMaxVisionResult(raw) {
336
+ if (raw && typeof raw === "object" && !Array.isArray(raw)) {
337
+ const record = raw;
338
+ if (typeof record.content === "string" && record.content.trim().length > 0) {
339
+ return record.content;
340
+ }
341
+ }
342
+ throw new ApiError("MiniMax vision returned a malformed response", 500);
343
+ }
344
+ /**
345
+ * Build the MiniMax DiagnosticsCapability. MiniMax connectivity is
346
+ * probed through a raw single-attempt quota inspection
347
+ * ({@link fetchMiniMaxQuota}), NOT `QuotaCapability.invoke()`, because
348
+ * the remains endpoint authenticates without a generative request.
349
+ * There is NO nested retry wrapper here — shared execution owns the
350
+ * retry policy; this transport performs exactly one attempt.
351
+ */
352
+ function createMiniMaxDiagnosticsCapability(options) {
353
+ const { env, ...transportDeps } = options;
354
+ return {
355
+ async invoke(diagOptions) {
356
+ if (!diagOptions.probe)
357
+ return;
358
+ const config = loadMiniMaxConfig(env);
359
+ try {
360
+ await fetchMiniMaxQuota(config, transportDeps);
361
+ }
362
+ catch (error) {
363
+ throw normalizeMiniMaxError(error);
364
+ }
365
+ },
366
+ };
367
+ }
368
+ // ---------------------------------------------------------------------------
369
+ // Descriptor factory
370
+ // ---------------------------------------------------------------------------
371
+ /**
372
+ * Build the MiniMax Provider Descriptor. The descriptor advertises the
373
+ * Search Capability and constructs an Adapter whose `search` Capability
374
+ * owns credentials, SDK lifecycle, Provider field mapping, and failure
375
+ * normalization. Construction is side-effect-free; the SDK is built and
376
+ * torn down per invocation. Tests pass `sdkConstructor`; production uses
377
+ * the no-argument factory which binds the pinned `mmx-cli/sdk`.
378
+ */
379
+ export function createMiniMaxDescriptor(dependencies) {
380
+ const sdkConstructor = dependencies?.sdkConstructor;
381
+ const isSpecializedVisionOperationSupported = dependencies?.isSpecializedVisionOperationSupported;
382
+ // Direct quota transport injection (tests). Production uses the
383
+ // global fetch and timers resolved inside the quota client.
384
+ const quotaTransport = {};
385
+ if (dependencies?.quotaFetch) {
386
+ quotaTransport.fetch = dependencies.quotaFetch;
387
+ }
388
+ if (dependencies?.quotaSetTimeout) {
389
+ quotaTransport.setTimeout = dependencies.quotaSetTimeout;
390
+ }
391
+ if (dependencies?.quotaClearTimeout) {
392
+ quotaTransport.clearTimeout = dependencies.quotaClearTimeout;
393
+ }
394
+ return {
395
+ id: "minimax",
396
+ isConfigured(env) {
397
+ const key = env.MINIMAX_API_KEY;
398
+ return typeof key === "string" && /\S/.test(key);
399
+ },
400
+ capabilities() {
401
+ // Base capabilities always advertised by MiniMax. Specialized
402
+ // Vision operations (`vision.ui-artifact`, etc.) are advertised
403
+ // only when their conformance support check returns true
404
+ // (DESIGN.md §15). Production derives this from the compiled
405
+ // registry; tests may force specific operations into the
406
+ // advertised set via
407
+ // `dependencies.isSpecializedVisionOperationSupported` so the
408
+ // routing branch can be exercised without flipping attestations.
409
+ const caps = new Set([
410
+ "search",
411
+ "vision.interpret-image",
412
+ "quota",
413
+ "diagnostics",
414
+ ]);
415
+ const isSpecialized = resolveSpecializedSupportCheck(isSpecializedVisionOperationSupported);
416
+ for (const op of SPECIALIZED_VISION_OPERATIONS) {
417
+ if (isSpecialized(op)) {
418
+ caps.add(visionOperationToCapability(op));
419
+ }
420
+ }
421
+ return caps;
422
+ },
423
+ create(context) {
424
+ const search = createMiniMaxSearchCapability({
425
+ env: context.env,
426
+ sdkConstructor,
427
+ });
428
+ const vision = createMiniMaxVisionCapability({
429
+ env: context.env,
430
+ sdkConstructor,
431
+ isSpecializedVisionOperationSupported,
432
+ });
433
+ const quotaOptions = { env: context.env, ...quotaTransport };
434
+ const quota = createMiniMaxQuotaCapability(quotaOptions);
435
+ const diagnostics = createMiniMaxDiagnosticsCapability({
436
+ env: context.env,
437
+ ...quotaTransport,
438
+ });
439
+ return { id: "minimax", search, vision, quota, diagnostics };
440
+ },
441
+ };
442
+ }
443
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../src/providers/minimax/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AAoBjC,OAAO,EAAE,2BAA2B,EAAE,MAAM,8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R,wBAAwB;gBACxB,OAAO;gBACP,aAAa;aACd,CAAC,CAAC;YACH,MAAM,aAAa,GAAG,8BAA8B,CAClD,qCAAqC,CACtC,CAAC;YACF,KAAK,MAAM,EAAE,IAAI,6BAA6B,EAAE,CAAC;gBAC/C,IAAI,aAAa,CAAC,EAAE,CAAC,EAAE,CAAC;oBACtB,IAAI,CAAC,GAAG,CAAC,2BAA2B,CAAC,EAAE,CAAuB,CAAC,CAAC;gBAClE,CAAC;YACH,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,CAAC,OAAwB;YAC7B,MAAM,MAAM,GAAG,6BAA6B,CAAC;gBAC3C,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,cAAc;aACf,CAAC,CAAC;YACH,MAAM,MAAM,GAAG,6BAA6B,CAAC;gBAC3C,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,cAAc;gBACd,qCAAqC;aACtC,CAAC,CAAC;YACH,MAAM,YAAY,GAAkC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,GAAG,cAAc,EAAE,CAAC;YAC5F,MAAM,KAAK,GAAG,4BAA4B,CAAC,YAAY,CAAC,CAAC;YACzD,MAAM,WAAW,GAAG,kCAAkC,CAAC;gBACrD,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,GAAG,cAAc;aAClB,CAAC,CAAC;YACH,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;QAC/D,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * MiniMax Adapter-local configuration (DESIGN.md §12 — P2-04).
3
+ *
4
+ * Reads MiniMax credentials and endpoints from the injected environment.
5
+ * This module is the Adapter-local companion to the SDK client; MiniMax
6
+ * environment names intentionally do NOT appear in shared `lib/config.ts`
7
+ * (that module remains Z.AI-only). No credential is persisted or read
8
+ * from shared configuration.
9
+ *
10
+ * Resolution rules:
11
+ * - `MINIMAX_API_KEY`: required, non-empty after trim. Whitespace-only
12
+ * is invalid, not absent.
13
+ * - `MINIMAX_REGION`: optional; undefined defaults to `global`. An
14
+ * empty value is invalid, not absent. Must be exactly `global` or
15
+ * `cn`.
16
+ * - Region URLs: `global` -> `https://api.minimax.io`,
17
+ * `cn` -> `https://api.minimaxi.com`.
18
+ * - `MINIMAX_BASE_URL`: optional override; must be an absolute HTTPS
19
+ * URL. An empty value is invalid. Exactly one trailing slash is
20
+ * removed. Overrides the region URL for every SDK operation.
21
+ */
22
+ export interface MiniMaxConfig {
23
+ readonly apiKey: string;
24
+ readonly region: "global" | "cn";
25
+ readonly baseUrl: string;
26
+ }
27
+ /**
28
+ * Load and validate MiniMax configuration from the injected environment.
29
+ * Throws a normalized {@link ConfigurationError} for any invalid value.
30
+ */
31
+ export declare function loadMiniMaxConfig(env: NodeJS.ProcessEnv): MiniMaxConfig;
32
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/providers/minimax/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAYD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,aAAa,CAyDvE"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * MiniMax Adapter-local configuration (DESIGN.md §12 — P2-04).
3
+ *
4
+ * Reads MiniMax credentials and endpoints from the injected environment.
5
+ * This module is the Adapter-local companion to the SDK client; MiniMax
6
+ * environment names intentionally do NOT appear in shared `lib/config.ts`
7
+ * (that module remains Z.AI-only). No credential is persisted or read
8
+ * from shared configuration.
9
+ *
10
+ * Resolution rules:
11
+ * - `MINIMAX_API_KEY`: required, non-empty after trim. Whitespace-only
12
+ * is invalid, not absent.
13
+ * - `MINIMAX_REGION`: optional; undefined defaults to `global`. An
14
+ * empty value is invalid, not absent. Must be exactly `global` or
15
+ * `cn`.
16
+ * - Region URLs: `global` -> `https://api.minimax.io`,
17
+ * `cn` -> `https://api.minimaxi.com`.
18
+ * - `MINIMAX_BASE_URL`: optional override; must be an absolute HTTPS
19
+ * URL. An empty value is invalid. Exactly one trailing slash is
20
+ * removed. Overrides the region URL for every SDK operation.
21
+ */
22
+ import { ConfigurationError } from "../../lib/errors.js";
23
+ const REGION_BASE_URLS = {
24
+ global: "https://api.minimax.io",
25
+ cn: "https://api.minimaxi.com",
26
+ };
27
+ const MISSING_KEY_HELP = 'export MINIMAX_API_KEY="your-api-key"';
28
+ const REGION_HELP = "Accepted MINIMAX_REGION values: global, cn";
29
+ const BASE_URL_HELP = "MINIMAX_BASE_URL must be an absolute HTTPS URL (e.g. https://api.minimax.io)";
30
+ /**
31
+ * Load and validate MiniMax configuration from the injected environment.
32
+ * Throws a normalized {@link ConfigurationError} for any invalid value.
33
+ */
34
+ export function loadMiniMaxConfig(env) {
35
+ const apiKey = env.MINIMAX_API_KEY;
36
+ if (typeof apiKey !== "string" || apiKey.trim().length === 0) {
37
+ throw new ConfigurationError("MINIMAX_API_KEY environment variable is required", MISSING_KEY_HELP);
38
+ }
39
+ const regionRaw = env.MINIMAX_REGION;
40
+ let region;
41
+ if (regionRaw === undefined) {
42
+ region = "global";
43
+ }
44
+ else if (regionRaw.trim() === "") {
45
+ throw new ConfigurationError('MINIMAX_REGION must be "global" or "cn"', REGION_HELP);
46
+ }
47
+ else if (regionRaw !== "global" && regionRaw !== "cn") {
48
+ throw new ConfigurationError(`Unknown MINIMAX_REGION "${regionRaw}"`, REGION_HELP);
49
+ }
50
+ else {
51
+ region = regionRaw;
52
+ }
53
+ const baseUrlRaw = env.MINIMAX_BASE_URL;
54
+ let baseUrl;
55
+ if (baseUrlRaw === undefined) {
56
+ baseUrl = REGION_BASE_URLS[region];
57
+ }
58
+ else if (baseUrlRaw.trim() === "") {
59
+ throw new ConfigurationError("MINIMAX_BASE_URL must not be empty", BASE_URL_HELP);
60
+ }
61
+ else if (!/^https:\/\//i.test(baseUrlRaw)) {
62
+ throw new ConfigurationError(`MINIMAX_BASE_URL must be an absolute HTTPS URL (got "${baseUrlRaw}")`, BASE_URL_HELP);
63
+ }
64
+ else {
65
+ // Fixup C — W1: reject scheme-only URLs (no host). The previous
66
+ // accept-and-normalize path turned `https://` into `https:/`, which
67
+ // is not a valid URL and breaks SDK construction. Parse the URL and
68
+ // require a non-empty host.
69
+ let parsed;
70
+ try {
71
+ parsed = new URL(baseUrlRaw);
72
+ }
73
+ catch {
74
+ throw new ConfigurationError(`MINIMAX_BASE_URL must be an absolute HTTPS URL with a host (got "${baseUrlRaw}")`, BASE_URL_HELP);
75
+ }
76
+ if (parsed.host.length === 0) {
77
+ throw new ConfigurationError(`MINIMAX_BASE_URL must include a host (got "${baseUrlRaw}")`, BASE_URL_HELP);
78
+ }
79
+ // Remove exactly one trailing slash so the SDK receives a clean base.
80
+ baseUrl = baseUrlRaw.replace(/\/$/, "");
81
+ }
82
+ return { apiKey, region, baseUrl };
83
+ }
84
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/providers/minimax/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAQzD,MAAM,gBAAgB,GAAG;IACvB,MAAM,EAAE,wBAAwB;IAChC,EAAE,EAAE,0BAA0B;CACtB,CAAC;AAEX,MAAM,gBAAgB,GAAG,uCAAuC,CAAC;AACjE,MAAM,WAAW,GAAG,4CAA4C,CAAC;AACjE,MAAM,aAAa,GACjB,8EAA8E,CAAC;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EACtE,aAAa,CACd,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,gEAAgE;QAChE,oEAAoE;QACpE,oEAAoE;QACpE,4BAA4B;QAC5B,IAAI,MAAW,CAAC;QAChB,IAAI,CAAC;YACH,MAAM,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,kBAAkB,CAC1B,oEAAoE,UAAU,IAAI,EAClF,aAAa,CACd,CAAC;QACJ,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,kBAAkB,CAC1B,8CAA8C,UAAU,IAAI,EAC5D,aAAa,CACd,CAAC;QACJ,CAAC;QACD,sEAAsE;QACtE,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AACrC,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * MiniMax Provider Media Module (DESIGN.md §9 — P3-02).
3
+ *
4
+ * Owns MiniMax-local image media facts: accepted extensions, size limit,
5
+ * existence check, and absolute-path resolution. Commands pass raw
6
+ * path-or-URL strings; this module is the single owner of every
7
+ * Provider-specific media decision for MiniMax images.
8
+ *
9
+ * Boundary rules (ARCHITECTURE.md §2):
10
+ * - May import normalized errors from `lib/errors.ts`.
11
+ * - Must NOT read file content. The transitional MiniMax SDK performs
12
+ * data-URI conversion; this module only `stat`s for existence and size
13
+ * and returns the validated absolute path.
14
+ *
15
+ * Media rules (DESIGN.md §9 MiniMax Transitional SDK):
16
+ * - Local image: JPG, JPEG, PNG, WebP (case-insensitive), at most 50 MiB.
17
+ * - HTTP(S) source is accepted.
18
+ * - Local source becomes an absolute path after validation.
19
+ * - The SDK performs data-URI conversion; this module does NOT read
20
+ * file content.
21
+ * - No MiniMax video media module exists in this scope.
22
+ * - Missing local file rejects with `FILE_ERROR`.
23
+ * - Non-HTTP URL-like strings and unsupported extensions reject with
24
+ * `VALIDATION_ERROR` and Provider-specific supported-format help.
25
+ */
26
+ /**
27
+ * Resolve a MiniMax image source into the value the MiniMax SDK consumes.
28
+ * For a local file, validates existence, size (≤ 50 MiB), and extension
29
+ * (JPG/JPEG/PNG/WebP) and returns the absolute path (the SDK performs
30
+ * data-URI conversion from this path). For an HTTP(S) URL, returns the URL
31
+ * unchanged without touching the local filesystem.
32
+ */
33
+ export declare function resolveImageSource(source: string): string;
34
+ //# sourceMappingURL=media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/providers/minimax/media.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAyEH;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAUzD"}