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,92 @@
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
+ import * as fs from "node:fs";
27
+ import * as path from "node:path";
28
+ import { FileError, ValidationError } from "../../lib/errors.js";
29
+ // ---------------------------------------------------------------------------
30
+ // MiniMax media limits (DESIGN.md §9)
31
+ // ---------------------------------------------------------------------------
32
+ const MINIMAX_IMAGE_EXTENSIONS = [".jpg", ".jpeg", ".png", ".webp"];
33
+ const MINIMAX_MAX_IMAGE_BYTES = 50 * 1024 * 1024; // 50 MiB
34
+ const MINIMAX_IMAGE_FORMAT_HELP = "Supported MiniMax image formats: JPG, JPEG, PNG, WebP (max 50 MiB)";
35
+ // ---------------------------------------------------------------------------
36
+ // Source classification
37
+ // ---------------------------------------------------------------------------
38
+ /**
39
+ * A leading `<scheme>://` that is NOT `http(s)://` (e.g. `ftp://`, `file://`)
40
+ * is a URL-like string MiniMax cannot consume. It is rejected up front with
41
+ * `VALIDATION_ERROR` rather than falling through to a misleading local-file
42
+ * `FILE_ERROR`.
43
+ */
44
+ const URL_SCHEME_PATTERN = /^[a-z][a-z0-9+.-]*:\/\//i;
45
+ function classifySource(source) {
46
+ if (source.startsWith("http://") || source.startsWith("https://")) {
47
+ return "http";
48
+ }
49
+ if (URL_SCHEME_PATTERN.test(source)) {
50
+ return "unsupported-url";
51
+ }
52
+ return "local";
53
+ }
54
+ // ---------------------------------------------------------------------------
55
+ // Local media validation (existence + size + extension; never reads content)
56
+ // ---------------------------------------------------------------------------
57
+ function validateLocalImage(source) {
58
+ const resolved = path.resolve(source);
59
+ if (!fs.existsSync(resolved)) {
60
+ throw new FileError(`File not found: ${source}`, "Check the file path is correct");
61
+ }
62
+ const stats = fs.statSync(resolved);
63
+ if (stats.size > MINIMAX_MAX_IMAGE_BYTES) {
64
+ throw new ValidationError(`File exceeds the ${(MINIMAX_MAX_IMAGE_BYTES / 1024 / 1024).toFixed(0)} MiB limit ` +
65
+ `(${(stats.size / 1024 / 1024).toFixed(2)} MiB)`, MINIMAX_IMAGE_FORMAT_HELP);
66
+ }
67
+ const ext = path.extname(resolved).toLowerCase();
68
+ if (!MINIMAX_IMAGE_EXTENSIONS.includes(ext)) {
69
+ throw new ValidationError(`Unsupported media format: ${ext || "(no extension)"}`, MINIMAX_IMAGE_FORMAT_HELP);
70
+ }
71
+ return resolved;
72
+ }
73
+ // ---------------------------------------------------------------------------
74
+ // Public resolver
75
+ // ---------------------------------------------------------------------------
76
+ /**
77
+ * Resolve a MiniMax image source into the value the MiniMax SDK consumes.
78
+ * For a local file, validates existence, size (≤ 50 MiB), and extension
79
+ * (JPG/JPEG/PNG/WebP) and returns the absolute path (the SDK performs
80
+ * data-URI conversion from this path). For an HTTP(S) URL, returns the URL
81
+ * 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 MiniMax vision`, "Use an HTTP(S) URL or a local file path");
89
+ }
90
+ return validateLocalImage(source);
91
+ }
92
+ //# sourceMappingURL=media.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.js","sourceRoot":"","sources":["../../../src/providers/minimax/media.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;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,sCAAsC;AACtC,8EAA8E;AAE9E,MAAM,wBAAwB,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpE,MAAM,uBAAuB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,SAAS;AAE3D,MAAM,yBAAyB,GAC7B,oEAAoE,CAAC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,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,eAAe,CACvB,6BAA6B,GAAG,IAAI,gBAAgB,EAAE,EACtD,yBAAyB,CAC1B,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAE9E;;;;;;GAMG;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,8CAA8C,EAC9C,yCAAyC,CAC1C,CAAC;IACJ,CAAC;IACD,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * MiniMax Quota Client — Adapter-local direct transport (DESIGN.md §12, P4-02).
3
+ *
4
+ * The pinned `mmx-cli/sdk` 1.0.16 does not preserve an arbitrary
5
+ * configured host for quota. This Module performs ONE direct GET against
6
+ * `<baseUrl>/v1/api/openplatform/coding_plan/remains` with an
7
+ * `Authorization: Bearer <apiKey>` header so `MINIMAX_BASE_URL` is
8
+ * authoritative for quota. There is NO internal retry — shared execution
9
+ * owns retry policy. Fetch and timer are injectable for tests.
10
+ *
11
+ * Boundary rules (ARCHITECTURE.md §2):
12
+ * - May import Adapter-local config and normalized errors.
13
+ * - Must NOT import `mmx-cli/sdk`, command presentation, or another
14
+ * Provider's Adapter.
15
+ */
16
+ import type { MiniMaxConfig } from "./config.js";
17
+ import type { ProviderQuotaFetch } from "../types.js";
18
+ /** Injectable fetch signature (shared duck-typed port). */
19
+ export type MiniMaxQuotaFetch = ProviderQuotaFetch;
20
+ /** Fetch response shape this transport consumes. */
21
+ export type MiniMaxQuotaFetchResponse = Awaited<ReturnType<MiniMaxQuotaFetch>>;
22
+ export interface MiniMaxQuotaClientDeps {
23
+ readonly fetch?: MiniMaxQuotaFetch;
24
+ readonly setTimeout?: typeof setTimeout;
25
+ readonly clearTimeout?: typeof clearTimeout;
26
+ readonly env?: NodeJS.ProcessEnv;
27
+ }
28
+ /** Raw MiniMax quota response shape (remains endpoint). */
29
+ export interface MiniMaxRawQuotaResponse {
30
+ model_remains?: unknown[];
31
+ }
32
+ /**
33
+ * Perform ONE GET against the MiniMax remains endpoint. No retry; no
34
+ * response body in public errors. Returns the parsed JSON body.
35
+ */
36
+ export declare function fetchMiniMaxQuota(config: MiniMaxConfig, deps?: MiniMaxQuotaClientDeps): Promise<MiniMaxRawQuotaResponse>;
37
+ //# sourceMappingURL=quota-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quota-client.d.ts","sourceRoot":"","sources":["../../../src/providers/minimax/quota-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAKtD,2DAA2D;AAC3D,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAEnD,oDAAoD;AACpD,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC;AAE/E,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,iBAAiB,CAAC;IACnC,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,2DAA2D;AAC3D,MAAM,WAAW,uBAAuB;IACtC,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC;CAC3B;AAkCD;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,aAAa,EACrB,IAAI,GAAE,sBAA2B,GAChC,OAAO,CAAC,uBAAuB,CAAC,CA0BlC"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * MiniMax Quota Client — Adapter-local direct transport (DESIGN.md §12, P4-02).
3
+ *
4
+ * The pinned `mmx-cli/sdk` 1.0.16 does not preserve an arbitrary
5
+ * configured host for quota. This Module performs ONE direct GET against
6
+ * `<baseUrl>/v1/api/openplatform/coding_plan/remains` with an
7
+ * `Authorization: Bearer <apiKey>` header so `MINIMAX_BASE_URL` is
8
+ * authoritative for quota. There is NO internal retry — shared execution
9
+ * owns retry policy. Fetch and timer are injectable for tests.
10
+ *
11
+ * Boundary rules (ARCHITECTURE.md §2):
12
+ * - May import Adapter-local config and normalized errors.
13
+ * - Must NOT import `mmx-cli/sdk`, command presentation, or another
14
+ * Provider's Adapter.
15
+ */
16
+ import { ApiError, AuthError, NetworkError, TimeoutError } from "../../lib/errors.js";
17
+ const QUOTA_PATH = "/v1/api/openplatform/coding_plan/remains";
18
+ const DEFAULT_TIMEOUT_MS = 30000;
19
+ function resolveTimeoutMs(env) {
20
+ const raw = parseInt(env.MINIMAX_TIMEOUT || String(DEFAULT_TIMEOUT_MS), 10);
21
+ return Number.isFinite(raw) && raw > 0 ? raw : DEFAULT_TIMEOUT_MS;
22
+ }
23
+ function mapStatusError(status) {
24
+ if (status === 401 || status === 403) {
25
+ return new AuthError("MiniMax quota API authentication failed");
26
+ }
27
+ return new ApiError("MiniMax quota API request failed", status);
28
+ }
29
+ function normalizeTransportError(err, timeoutMs) {
30
+ if (err instanceof AuthError || err instanceof ApiError)
31
+ return err;
32
+ if (err instanceof Error) {
33
+ if (err.name === "AbortError") {
34
+ return new TimeoutError(timeoutMs);
35
+ }
36
+ const lower = err.message.toLowerCase();
37
+ if (lower.includes("fetch") ||
38
+ lower.includes("econnrefused") ||
39
+ lower.includes("econnreset") ||
40
+ lower.includes("enotfound") ||
41
+ lower.includes("network")) {
42
+ return new NetworkError("MiniMax quota network error");
43
+ }
44
+ }
45
+ return new ApiError("MiniMax quota request failed", 500);
46
+ }
47
+ /**
48
+ * Perform ONE GET against the MiniMax remains endpoint. No retry; no
49
+ * response body in public errors. Returns the parsed JSON body.
50
+ */
51
+ export async function fetchMiniMaxQuota(config, deps = {}) {
52
+ const f = deps.fetch ?? fetch;
53
+ const setT = deps.setTimeout ?? setTimeout;
54
+ const clearT = deps.clearTimeout ?? clearTimeout;
55
+ const env = deps.env ?? process.env;
56
+ const timeoutMs = resolveTimeoutMs(env);
57
+ const url = `${config.baseUrl}${QUOTA_PATH}`;
58
+ const controller = new AbortController();
59
+ const timeoutId = setT(() => controller.abort(), timeoutMs);
60
+ try {
61
+ const res = await f(url, {
62
+ method: "GET",
63
+ headers: { Authorization: `Bearer ${config.apiKey}` },
64
+ signal: controller.signal,
65
+ });
66
+ clearT(timeoutId);
67
+ if (!res.ok) {
68
+ await res.text().catch(() => { });
69
+ throw mapStatusError(res.status);
70
+ }
71
+ return (await res.json());
72
+ }
73
+ catch (err) {
74
+ clearT(timeoutId);
75
+ throw normalizeTransportError(err, timeoutMs);
76
+ }
77
+ }
78
+ //# sourceMappingURL=quota-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quota-client.js","sourceRoot":"","sources":["../../../src/providers/minimax/quota-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGtF,MAAM,UAAU,GAAG,0CAA0C,CAAC;AAC9D,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAoBjC,SAAS,gBAAgB,CAAC,GAAsB;IAC9C,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,eAAe,IAAI,MAAM,CAAC,kBAAkB,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5E,OAAO,MAAM,CAAC,QAAQ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+ * Maps the MiniMax remains-endpoint response into the normalized
5
+ * Provider-quota Interface. The normalizer is pure; the capability
6
+ * factory owns configuration resolution, the single direct transport
7
+ * attempt, and failure normalization. Shared execution owns retry.
8
+ *
9
+ * MiniMax mapping (DESIGN.md §13):
10
+ * - Each `model_remains` entry -> one category named by nonempty
11
+ * `model_name`, unit `requests`, sorted ascending by name.
12
+ * - Current counts + remaining percent; optional weekly counts +
13
+ * remaining percent.
14
+ * - `end_time` / `weekly_end_time` (epoch ms) -> ISO `resetsAt`.
15
+ * - Only characterized 1.0.16 fields are read: model name, counts,
16
+ * remaining percentages, reset timestamps. Status and boost fields
17
+ * are not interpreted.
18
+ *
19
+ * Boundary rules (ARCHITECTURE.md §2):
20
+ * - May import the quota capability contract, Adapter-local config,
21
+ * Adapter-local quota client, and normalized errors.
22
+ * - Must NOT import `mmx-cli/sdk`, command presentation, or another
23
+ * Provider's Adapter.
24
+ */
25
+ import type { ProviderQuotaSuccess, QuotaCapability } from "../../capabilities/quota.js";
26
+ import { type MiniMaxQuotaClientDeps } from "./quota-client.js";
27
+ /**
28
+ * Normalize a raw MiniMax remains payload into the shared Interface.
29
+ * Throws `QUOTA_ERROR` (via {@link buildQuotaWindow}) when an entry has
30
+ * neither a valid percentage nor valid counts.
31
+ */
32
+ export declare function normalizeMiniMaxQuota(raw: unknown): ProviderQuotaSuccess;
33
+ /**
34
+ * Options for the MiniMax QuotaCapability. Configuration is loaded from
35
+ * `env`; transport dependencies (`fetch`, timer) are injectable for
36
+ * deterministic tests.
37
+ */
38
+ export interface MiniMaxQuotaCapabilityOptions extends MiniMaxQuotaClientDeps {
39
+ readonly env: NodeJS.ProcessEnv;
40
+ }
41
+ /**
42
+ * Build the MiniMax QuotaCapability. `invoke` loads Adapter-local
43
+ * config, performs one direct remains-endpoint attempt, and normalizes
44
+ * the response. Shared execution wraps this in the retry policy; quota
45
+ * never uses the response cache and never routes through the SDK.
46
+ */
47
+ export declare function createMiniMaxQuotaCapability(options: MiniMaxQuotaCapabilityOptions): QuotaCapability;
48
+ //# sourceMappingURL=quota.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quota.d.ts","sourceRoot":"","sources":["../../../src/providers/minimax/quota.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EAEhB,MAAM,6BAA6B,CAAC;AAUrC,OAAO,EAEL,KAAK,sBAAsB,EAE5B,MAAM,mBAAmB,CAAC;AAiC3B;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,oBAAoB,CAkDxE;AAmBD;;;;GAIG;AACH,MAAM,WAAW,6BAA8B,SAAQ,sBAAsB;IAC3E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;CACjC;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,6BAA6B,GACrC,eAAe,CAajB"}
@@ -0,0 +1,120 @@
1
+ /**
2
+ * MiniMax Quota Capability (DESIGN.md §12, §13, P4-02).
3
+ *
4
+ * Maps the MiniMax remains-endpoint response into the normalized
5
+ * Provider-quota Interface. The normalizer is pure; the capability
6
+ * factory owns configuration resolution, the single direct transport
7
+ * attempt, and failure normalization. Shared execution owns retry.
8
+ *
9
+ * MiniMax mapping (DESIGN.md §13):
10
+ * - Each `model_remains` entry -> one category named by nonempty
11
+ * `model_name`, unit `requests`, sorted ascending by name.
12
+ * - Current counts + remaining percent; optional weekly counts +
13
+ * remaining percent.
14
+ * - `end_time` / `weekly_end_time` (epoch ms) -> ISO `resetsAt`.
15
+ * - Only characterized 1.0.16 fields are read: model name, counts,
16
+ * remaining percentages, reset timestamps. Status and boost fields
17
+ * are not interpreted.
18
+ *
19
+ * Boundary rules (ARCHITECTURE.md §2):
20
+ * - May import the quota capability contract, Adapter-local config,
21
+ * Adapter-local quota client, and normalized errors.
22
+ * - Must NOT import `mmx-cli/sdk`, command presentation, or another
23
+ * Provider's Adapter.
24
+ */
25
+ import { buildQuotaWindow } from "../../capabilities/quota.js";
26
+ import { ApiError, AuthError, ConfigurationError, NetworkError, TimeoutError, } from "../../lib/errors.js";
27
+ import { loadMiniMaxConfig } from "./config.js";
28
+ import { fetchMiniMaxQuota, } from "./quota-client.js";
29
+ function readNumber(value) {
30
+ return typeof value === "number" && Number.isFinite(value) ? value : undefined;
31
+ }
32
+ function readNonemptyString(value) {
33
+ return typeof value === "string" && value.trim().length > 0 ? value : undefined;
34
+ }
35
+ // ---------------------------------------------------------------------------
36
+ // Normalizer
37
+ // ---------------------------------------------------------------------------
38
+ /**
39
+ * Normalize a raw MiniMax remains payload into the shared Interface.
40
+ * Throws `QUOTA_ERROR` (via {@link buildQuotaWindow}) when an entry has
41
+ * neither a valid percentage nor valid counts.
42
+ */
43
+ export function normalizeMiniMaxQuota(raw) {
44
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
45
+ throw new ApiError("MiniMax quota returned a malformed response", 500);
46
+ }
47
+ const response = raw;
48
+ const entries = response.model_remains;
49
+ if (!Array.isArray(entries)) {
50
+ throw new ApiError("MiniMax quota returned a malformed response", 500);
51
+ }
52
+ const categories = [];
53
+ for (const entry of entries) {
54
+ if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
55
+ throw new ApiError("MiniMax quota returned a malformed response", 500);
56
+ }
57
+ const record = entry;
58
+ const name = readNonemptyString(record.model_name);
59
+ if (!name) {
60
+ throw new ApiError("MiniMax quota returned a malformed response", 500);
61
+ }
62
+ const current = buildQuotaWindow({
63
+ used: readNumber(record.current_interval_usage_count),
64
+ limit: readNumber(record.current_interval_total_count),
65
+ explicitRemainingPercent: readNumber(record.current_interval_remaining_percent),
66
+ resetsAtEpochMs: readNumber(record.end_time),
67
+ });
68
+ const category = { name, unit: "requests", current };
69
+ const hasWeekly = readNumber(record.current_weekly_usage_count) !== undefined ||
70
+ readNumber(record.current_weekly_total_count) !== undefined ||
71
+ readNumber(record.current_weekly_remaining_percent) !== undefined ||
72
+ readNumber(record.weekly_end_time) !== undefined;
73
+ if (hasWeekly) {
74
+ category.weekly = buildQuotaWindow({
75
+ used: readNumber(record.current_weekly_usage_count),
76
+ limit: readNumber(record.current_weekly_total_count),
77
+ explicitRemainingPercent: readNumber(record.current_weekly_remaining_percent),
78
+ resetsAtEpochMs: readNumber(record.weekly_end_time),
79
+ });
80
+ }
81
+ categories.push(category);
82
+ }
83
+ categories.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
84
+ return { provider: "minimax", status: "ok", categories };
85
+ }
86
+ // ---------------------------------------------------------------------------
87
+ // Capability factory
88
+ // ---------------------------------------------------------------------------
89
+ function normalizeMiniMaxQuotaError(error) {
90
+ if (error instanceof AuthError ||
91
+ error instanceof ApiError ||
92
+ error instanceof NetworkError ||
93
+ error instanceof TimeoutError ||
94
+ error instanceof ConfigurationError) {
95
+ return error;
96
+ }
97
+ return new ApiError("MiniMax quota request failed", 500);
98
+ }
99
+ /**
100
+ * Build the MiniMax QuotaCapability. `invoke` loads Adapter-local
101
+ * config, performs one direct remains-endpoint attempt, and normalizes
102
+ * the response. Shared execution wraps this in the retry policy; quota
103
+ * never uses the response cache and never routes through the SDK.
104
+ */
105
+ export function createMiniMaxQuotaCapability(options) {
106
+ const { env, ...transportDeps } = options;
107
+ return {
108
+ async invoke() {
109
+ const config = loadMiniMaxConfig(env);
110
+ try {
111
+ const raw = await fetchMiniMaxQuota(config, transportDeps);
112
+ return normalizeMiniMaxQuota(raw);
113
+ }
114
+ catch (error) {
115
+ throw normalizeMiniMaxQuotaError(error);
116
+ }
117
+ },
118
+ };
119
+ }
120
+ //# sourceMappingURL=quota.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quota.js","sourceRoot":"","sources":["../../../src/providers/minimax/quota.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAOH,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,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AAC;gBACf,MAAM,0BAA0B,CAAC,KAAK,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * MiniMax SDK client factory (DESIGN.md §12 — P2-04).
3
+ *
4
+ * This is the ONLY module that imports `mmx-cli/sdk`. The Adapter and
5
+ * registry consume {@link createMiniMaxSdk} plus the injectable
6
+ * {@link MiniMaxSdkConstructor} / {@link MiniMaxSdkPort} types declared
7
+ * in `providers/types.ts`, so the transitional SDK never leaks past
8
+ * this boundary.
9
+ *
10
+ * The characterized SDK reads its own config directory during
11
+ * construction (it calls `getConfigDir()`, which honours
12
+ * `MMX_CONFIG_DIR`). To prevent the SDK from touching the user's real
13
+ * `~/.mmx` state, the factory temporarily points `MMX_CONFIG_DIR` at a
14
+ * unique nonexistent path for the synchronous construction call only,
15
+ * then restores the prior value in `finally`. The temporary directory
16
+ * is NEVER created on disk.
17
+ */
18
+ import type { MiniMaxSdkConstructor, MiniMaxSdkPort } from "../types.js";
19
+ /**
20
+ * Construct a MiniMax SDK port. The optional `constructor` lets tests
21
+ * inject a fake; production omits it and uses the pinned `mmx-cli/sdk`
22
+ * implementation.
23
+ */
24
+ export declare function createMiniMaxSdk(options: {
25
+ apiKey: string;
26
+ region: "global" | "cn";
27
+ baseUrl: string;
28
+ }, constructor?: MiniMaxSdkConstructor): MiniMaxSdkPort;
29
+ //# sourceMappingURL=sdk-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk-client.d.ts","sourceRoot":"","sources":["../../../src/providers/minimax/sdk-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAOH,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIzE;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EACrE,WAAW,CAAC,EAAE,qBAAqB,GAClC,cAAc,CAoBhB"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * MiniMax SDK client factory (DESIGN.md §12 — P2-04).
3
+ *
4
+ * This is the ONLY module that imports `mmx-cli/sdk`. The Adapter and
5
+ * registry consume {@link createMiniMaxSdk} plus the injectable
6
+ * {@link MiniMaxSdkConstructor} / {@link MiniMaxSdkPort} types declared
7
+ * in `providers/types.ts`, so the transitional SDK never leaks past
8
+ * this boundary.
9
+ *
10
+ * The characterized SDK reads its own config directory during
11
+ * construction (it calls `getConfigDir()`, which honours
12
+ * `MMX_CONFIG_DIR`). To prevent the SDK from touching the user's real
13
+ * `~/.mmx` state, the factory temporarily points `MMX_CONFIG_DIR` at a
14
+ * unique nonexistent path for the synchronous construction call only,
15
+ * then restores the prior value in `finally`. The temporary directory
16
+ * is NEVER created on disk.
17
+ */
18
+ import { randomUUID } from "node:crypto";
19
+ import { tmpdir } from "node:os";
20
+ import path from "node:path";
21
+ import { MiniMaxSDK } from "mmx-cli/sdk";
22
+ const MMX_CONFIG_DIR = "MMX_CONFIG_DIR";
23
+ /**
24
+ * Construct a MiniMax SDK port. The optional `constructor` lets tests
25
+ * inject a fake; production omits it and uses the pinned `mmx-cli/sdk`
26
+ * implementation.
27
+ */
28
+ export function createMiniMaxSdk(options, constructor) {
29
+ const Ctor = constructor ?? MiniMaxSDK;
30
+ const hadPrev = Object.prototype.hasOwnProperty.call(process.env, MMX_CONFIG_DIR);
31
+ const prev = process.env[MMX_CONFIG_DIR];
32
+ // A unique nonexistent path. It is deliberately never created.
33
+ const temporaryDir = path.join(tmpdir(), `scoutline-minimax-${randomUUID()}`);
34
+ process.env[MMX_CONFIG_DIR] = temporaryDir;
35
+ try {
36
+ // Construction is synchronous and reads MMX_CONFIG_DIR via the
37
+ // SDK's getConfigDir(). The async search/vision calls happen
38
+ // after this block, with the original env already restored.
39
+ return new Ctor(options);
40
+ }
41
+ finally {
42
+ if (hadPrev) {
43
+ process.env[MMX_CONFIG_DIR] = prev;
44
+ }
45
+ else {
46
+ delete process.env[MMX_CONFIG_DIR];
47
+ }
48
+ }
49
+ }
50
+ //# sourceMappingURL=sdk-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk-client.js","sourceRoot":"","sources":["../../../src/providers/minimax/sdk-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAExC;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAqE,EACrE,WAAmC;IAEnC,MAAM,IAAI,GAAG,WAAW,IAAK,UAA+C,CAAC;IAE7E,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IAClF,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACzC,+DAA+D;IAC/D,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,qBAAqB,UAAU,EAAE,EAAE,CAAC,CAAC;IAC9E,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,YAAY,CAAC;IAC3C,IAAI,CAAC;QACH,+DAA+D;QAC/D,6DAA6D;QAC7D,4DAA4D;QAC5D,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;YAAS,CAAC;QACT,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Compiled MiniMax specialized-vision attestations (DESIGN.md §15, P5-02).
3
+ *
4
+ * Sanitized, schema-version-1 attestations written by the Phase 5
5
+ * `scripts/attest-minimax-vision.mjs` flow (P5-03). Each entry contains
6
+ * ONLY: provider id, operation id, fixture version, Implementation id,
7
+ * generated mapping revision, UTC execution timestamp, SHA-256 result
8
+ * digest, and the list of semantic assertion IDs each marked `passed:
9
+ * true`. No returned prose, key, URL with credentials, headers, raw
10
+ * response body, local path, or stack is ever present.
11
+ *
12
+ * At P5-02 the manifest is intentionally empty: no operation has been
13
+ * attested. The support query in `vision-conformance.ts` therefore
14
+ * returns false for every specialized operation until P5-03 fills this
15
+ * array. The compiled manifest is the single source of attestation
16
+ * truth; there is no runtime filesystem lookup or environment override.
17
+ *
18
+ * Boundary: this module exports a pure, immutable typed array. It
19
+ * imports only the attestation type from `vision-conformance.ts` and
20
+ * never touches the registry, environment, or filesystem.
21
+ */
22
+ import type { VisionAttestation } from "./vision-conformance.js";
23
+ /**
24
+ * The compiled sanitized attestation manifest. Each entry is keyed by
25
+ * `operation`; the registry construction indexes this list at module
26
+ * load. P5-03's attestation script appends sanitized entries here.
27
+ */
28
+ export declare const MINIMAX_VISION_ATTESTATIONS: readonly VisionAttestation[];
29
+ //# sourceMappingURL=vision-attestations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vision-attestations.d.ts","sourceRoot":"","sources":["../../../src/providers/minimax/vision-attestations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,SAAS,iBAAiB,EA0BnE,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Compiled MiniMax specialized-vision attestations (DESIGN.md §15, P5-02).
3
+ *
4
+ * Sanitized, schema-version-1 attestations written by the Phase 5
5
+ * `scripts/attest-minimax-vision.mjs` flow (P5-03). Each entry contains
6
+ * ONLY: provider id, operation id, fixture version, Implementation id,
7
+ * generated mapping revision, UTC execution timestamp, SHA-256 result
8
+ * digest, and the list of semantic assertion IDs each marked `passed:
9
+ * true`. No returned prose, key, URL with credentials, headers, raw
10
+ * response body, local path, or stack is ever present.
11
+ *
12
+ * At P5-02 the manifest is intentionally empty: no operation has been
13
+ * attested. The support query in `vision-conformance.ts` therefore
14
+ * returns false for every specialized operation until P5-03 fills this
15
+ * array. The compiled manifest is the single source of attestation
16
+ * truth; there is no runtime filesystem lookup or environment override.
17
+ *
18
+ * Boundary: this module exports a pure, immutable typed array. It
19
+ * imports only the attestation type from `vision-conformance.ts` and
20
+ * never touches the registry, environment, or filesystem.
21
+ */
22
+ /**
23
+ * The compiled sanitized attestation manifest. Each entry is keyed by
24
+ * `operation`; the registry construction indexes this list at module
25
+ * load. P5-03's attestation script appends sanitized entries here.
26
+ */
27
+ export const MINIMAX_VISION_ATTESTATIONS = [
28
+ {
29
+ schemaVersion: 1,
30
+ provider: "minimax",
31
+ operation: "ui-artifact",
32
+ fixtureVersion: 1,
33
+ implementationId: "mmx-cli-sdk@1.0.16",
34
+ mappingRevision: "f359d5cda2f0f6fc7b8b1308a8842ede7a09b8c5517c46e205a46881afeb5290",
35
+ testedAt: "2026-07-17T18:07:29.625Z",
36
+ resultDigest: "3be610d51d6e097a159890804652fd16073773bd6e01b9214d37fe093a9b31e7",
37
+ assertions: [
38
+ { id: "ui-artifact.regions", passed: true },
39
+ { id: "ui-artifact.code-form", passed: true },
40
+ ],
41
+ },
42
+ {
43
+ schemaVersion: 1,
44
+ provider: "minimax",
45
+ operation: "diagnose-error",
46
+ fixtureVersion: 1,
47
+ implementationId: "mmx-cli-sdk@1.0.16",
48
+ mappingRevision: "f83d602a6177041d131cb05b4164e0529b04154a5651e042cea66f566d94d893",
49
+ testedAt: "2026-07-17T18:07:41.170Z",
50
+ resultDigest: "0ce4a1f9518da03d78aee97e04acb6b93a56697abe258042d9af692addc441f2",
51
+ assertions: [{ id: "diagnose-error.class", passed: true }],
52
+ },
53
+ ];
54
+ //# sourceMappingURL=vision-attestations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vision-attestations.js","sourceRoot":"","sources":["../../../src/providers/minimax/vision-attestations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAiC;IACvE;QACE,aAAa,EAAE,CAAC;QAChB,QAAQ,EAAE,SAAS;QACnB,SAAS,EAAE,aAAa;QACxB,cAAc,EAAE,CAAC;QACjB,gBAAgB,EAAE,oBAAoB;QACtC,eAAe,EAAE,kEAAkE;QACnF,QAAQ,EAAE,0BAA0B;QACpC,YAAY,EAAE,kEAAkE;QAChF,UAAU,EAAE;YACV,EAAE,EAAE,EAAE,qBAAqB,EAAE,MAAM,EAAE,IAAI,EAAE;YAC3C,EAAE,EAAE,EAAE,uBAAuB,EAAE,MAAM,EAAE,IAAI,EAAE;SAC9C;KACF;IACD;QACE,aAAa,EAAE,CAAC;QAChB,QAAQ,EAAE,SAAS;QACnB,SAAS,EAAE,gBAAgB;QAC3B,cAAc,EAAE,CAAC;QACjB,gBAAgB,EAAE,oBAAoB;QACtC,eAAe,EAAE,kEAAkE;QACnF,QAAQ,EAAE,0BAA0B;QACpC,YAAY,EAAE,kEAAkE;QAChF,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,sBAAsB,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;KAC3D;CACF,CAAC"}