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.
- package/README.md +394 -7
- package/bin/scoutline.js +36 -15
- package/dist/capabilities/diagnostics.d.ts +135 -0
- package/dist/capabilities/diagnostics.d.ts.map +1 -0
- package/dist/capabilities/diagnostics.js +139 -0
- package/dist/capabilities/diagnostics.js.map +1 -0
- package/dist/capabilities/quota.d.ts +99 -0
- package/dist/capabilities/quota.d.ts.map +1 -0
- package/dist/capabilities/quota.js +129 -0
- package/dist/capabilities/quota.js.map +1 -0
- package/dist/capabilities/reader.d.ts +227 -0
- package/dist/capabilities/reader.d.ts.map +1 -0
- package/dist/capabilities/reader.js +100 -0
- package/dist/capabilities/reader.js.map +1 -0
- package/dist/capabilities/repository.d.ts +221 -0
- package/dist/capabilities/repository.d.ts.map +1 -0
- package/dist/capabilities/repository.js +172 -0
- package/dist/capabilities/repository.js.map +1 -0
- package/dist/capabilities/search.d.ts +110 -0
- package/dist/capabilities/search.d.ts.map +1 -0
- package/dist/capabilities/search.js +21 -0
- package/dist/capabilities/search.js.map +1 -0
- package/dist/capabilities/vision.d.ts +156 -0
- package/dist/capabilities/vision.d.ts.map +1 -0
- package/dist/capabilities/vision.js +111 -0
- package/dist/capabilities/vision.js.map +1 -0
- package/dist/command-invocation.d.ts +58 -0
- package/dist/command-invocation.d.ts.map +1 -0
- package/dist/command-invocation.js +95 -0
- package/dist/command-invocation.js.map +1 -0
- package/dist/commands/cache.d.ts +106 -0
- package/dist/commands/cache.d.ts.map +1 -0
- package/dist/commands/cache.js +203 -0
- package/dist/commands/cache.js.map +1 -0
- package/dist/commands/code.d.ts +11 -4
- package/dist/commands/code.d.ts.map +1 -1
- package/dist/commands/code.js +16 -42
- package/dist/commands/code.js.map +1 -1
- package/dist/commands/doctor.d.ts +69 -3
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +179 -52
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/quota.d.ts +45 -3
- package/dist/commands/quota.d.ts.map +1 -1
- package/dist/commands/quota.js +116 -60
- package/dist/commands/quota.js.map +1 -1
- package/dist/commands/read.d.ts +76 -2
- package/dist/commands/read.d.ts.map +1 -1
- package/dist/commands/read.js +260 -121
- package/dist/commands/read.js.map +1 -1
- package/dist/commands/repo.d.ts +55 -4
- package/dist/commands/repo.d.ts.map +1 -1
- package/dist/commands/repo.js +115 -172
- package/dist/commands/repo.js.map +1 -1
- package/dist/commands/repository-explorer.d.ts +147 -0
- package/dist/commands/repository-explorer.d.ts.map +1 -0
- package/dist/commands/repository-explorer.js +550 -0
- package/dist/commands/repository-explorer.js.map +1 -0
- package/dist/commands/search.d.ts +27 -2
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +95 -103
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/tools.d.ts +9 -3
- package/dist/commands/tools.d.ts.map +1 -1
- package/dist/commands/tools.js +29 -59
- package/dist/commands/tools.js.map +1 -1
- package/dist/commands/vision.d.ts +35 -9
- package/dist/commands/vision.d.ts.map +1 -1
- package/dist/commands/vision.js +184 -131
- package/dist/commands/vision.js.map +1 -1
- package/dist/index.d.ts +62 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +580 -223
- package/dist/index.js.map +1 -1
- package/dist/lib/cache.d.ts +178 -12
- package/dist/lib/cache.d.ts.map +1 -1
- package/dist/lib/cache.js +377 -39
- package/dist/lib/cache.js.map +1 -1
- package/dist/lib/code-mode.d.ts +13 -0
- package/dist/lib/code-mode.d.ts.map +1 -1
- package/dist/lib/code-mode.js +26 -6
- package/dist/lib/code-mode.js.map +1 -1
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +15 -18
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/errors.d.ts +89 -11
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +168 -21
- package/dist/lib/errors.js.map +1 -1
- package/dist/lib/execution.d.ts +190 -0
- package/dist/lib/execution.d.ts.map +1 -0
- package/dist/lib/execution.js +383 -0
- package/dist/lib/execution.js.map +1 -0
- package/dist/lib/index.d.ts +10 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +10 -2
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/mcp-client.d.ts +75 -16
- package/dist/lib/mcp-client.d.ts.map +1 -1
- package/dist/lib/mcp-client.js +173 -108
- package/dist/lib/mcp-client.js.map +1 -1
- package/dist/lib/mcp-config.d.ts +17 -0
- package/dist/lib/mcp-config.d.ts.map +1 -1
- package/dist/lib/mcp-config.js +29 -0
- package/dist/lib/mcp-config.js.map +1 -1
- package/dist/lib/monitor-client.d.ts +17 -3
- package/dist/lib/monitor-client.d.ts.map +1 -1
- package/dist/lib/monitor-client.js +23 -69
- package/dist/lib/monitor-client.js.map +1 -1
- package/dist/lib/output.d.ts +53 -7
- package/dist/lib/output.d.ts.map +1 -1
- package/dist/lib/output.js +126 -39
- package/dist/lib/output.js.map +1 -1
- package/dist/lib/redact.d.ts +62 -3
- package/dist/lib/redact.d.ts.map +1 -1
- package/dist/lib/redact.js +165 -31
- package/dist/lib/redact.js.map +1 -1
- package/dist/lib/tool-cache.d.ts +86 -0
- package/dist/lib/tool-cache.d.ts.map +1 -0
- package/dist/lib/tool-cache.js +123 -0
- package/dist/lib/tool-cache.js.map +1 -0
- package/dist/lib/tty.d.ts +7 -20
- package/dist/lib/tty.d.ts.map +1 -1
- package/dist/lib/tty.js +51 -30
- package/dist/lib/tty.js.map +1 -1
- package/dist/node-command-invocation-adapter.d.ts +28 -0
- package/dist/node-command-invocation-adapter.d.ts.map +1 -0
- package/dist/node-command-invocation-adapter.js +88 -0
- package/dist/node-command-invocation-adapter.js.map +1 -0
- package/dist/providers/minimax/adapter.d.ts +49 -0
- package/dist/providers/minimax/adapter.d.ts.map +1 -0
- package/dist/providers/minimax/adapter.js +450 -0
- package/dist/providers/minimax/adapter.js.map +1 -0
- package/dist/providers/minimax/coding-plan-client.d.ts +60 -0
- package/dist/providers/minimax/coding-plan-client.d.ts.map +1 -0
- package/dist/providers/minimax/coding-plan-client.js +204 -0
- package/dist/providers/minimax/coding-plan-client.js.map +1 -0
- package/dist/providers/minimax/config.d.ts +32 -0
- package/dist/providers/minimax/config.d.ts.map +1 -0
- package/dist/providers/minimax/config.js +84 -0
- package/dist/providers/minimax/config.js.map +1 -0
- package/dist/providers/minimax/media.d.ts +88 -0
- package/dist/providers/minimax/media.d.ts.map +1 -0
- package/dist/providers/minimax/media.js +232 -0
- package/dist/providers/minimax/media.js.map +1 -0
- package/dist/providers/minimax/quota-client.d.ts +44 -0
- package/dist/providers/minimax/quota-client.d.ts.map +1 -0
- package/dist/providers/minimax/quota-client.js +83 -0
- package/dist/providers/minimax/quota-client.js.map +1 -0
- package/dist/providers/minimax/quota.d.ts +48 -0
- package/dist/providers/minimax/quota.d.ts.map +1 -0
- package/dist/providers/minimax/quota.js +120 -0
- package/dist/providers/minimax/quota.js.map +1 -0
- package/dist/providers/minimax/sdk-client.d.ts +29 -0
- package/dist/providers/minimax/sdk-client.d.ts.map +1 -0
- package/dist/providers/minimax/sdk-client.js +50 -0
- package/dist/providers/minimax/sdk-client.js.map +1 -0
- package/dist/providers/minimax/vision-attestations.d.ts +52 -0
- package/dist/providers/minimax/vision-attestations.d.ts.map +1 -0
- package/dist/providers/minimax/vision-attestations.js +79 -0
- package/dist/providers/minimax/vision-attestations.js.map +1 -0
- package/dist/providers/minimax/vision-conformance.d.ts +186 -0
- package/dist/providers/minimax/vision-conformance.d.ts.map +1 -0
- package/dist/providers/minimax/vision-conformance.js +371 -0
- package/dist/providers/minimax/vision-conformance.js.map +1 -0
- package/dist/providers/minimax/vision-mappings/chart.d.ts +35 -0
- package/dist/providers/minimax/vision-mappings/chart.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings/chart.js +55 -0
- package/dist/providers/minimax/vision-mappings/chart.js.map +1 -0
- package/dist/providers/minimax/vision-mappings/common.d.ts +60 -0
- package/dist/providers/minimax/vision-mappings/common.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings/common.js +75 -0
- package/dist/providers/minimax/vision-mappings/common.js.map +1 -0
- package/dist/providers/minimax/vision-mappings/diagnose-error.d.ts +35 -0
- package/dist/providers/minimax/vision-mappings/diagnose-error.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings/diagnose-error.js +55 -0
- package/dist/providers/minimax/vision-mappings/diagnose-error.js.map +1 -0
- package/dist/providers/minimax/vision-mappings/diagram.d.ts +35 -0
- package/dist/providers/minimax/vision-mappings/diagram.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings/diagram.js +55 -0
- package/dist/providers/minimax/vision-mappings/diagram.js.map +1 -0
- package/dist/providers/minimax/vision-mappings/extract-text.d.ts +35 -0
- package/dist/providers/minimax/vision-mappings/extract-text.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings/extract-text.js +55 -0
- package/dist/providers/minimax/vision-mappings/extract-text.js.map +1 -0
- package/dist/providers/minimax/vision-mappings/ui-artifact.d.ts +35 -0
- package/dist/providers/minimax/vision-mappings/ui-artifact.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings/ui-artifact.js +69 -0
- package/dist/providers/minimax/vision-mappings/ui-artifact.js.map +1 -0
- package/dist/providers/minimax/vision-mappings.generated.d.ts +29 -0
- package/dist/providers/minimax/vision-mappings.generated.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings.generated.js +29 -0
- package/dist/providers/minimax/vision-mappings.generated.js.map +1 -0
- package/dist/providers/minimax/vision-revisions.d.ts +29 -0
- package/dist/providers/minimax/vision-revisions.d.ts.map +1 -0
- package/dist/providers/minimax/vision-revisions.js +34 -0
- package/dist/providers/minimax/vision-revisions.js.map +1 -0
- package/dist/providers/registry.d.ts +36 -0
- package/dist/providers/registry.d.ts.map +1 -0
- package/dist/providers/registry.js +45 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/providers/selection.d.ts +44 -0
- package/dist/providers/selection.d.ts.map +1 -0
- package/dist/providers/selection.js +85 -0
- package/dist/providers/selection.js.map +1 -0
- package/dist/providers/types.d.ts +281 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +127 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/providers/zai/adapter.d.ts +35 -0
- package/dist/providers/zai/adapter.d.ts.map +1 -0
- package/dist/providers/zai/adapter.js +685 -0
- package/dist/providers/zai/adapter.js.map +1 -0
- package/dist/providers/zai/credentials.d.ts +38 -0
- package/dist/providers/zai/credentials.d.ts.map +1 -0
- package/dist/providers/zai/credentials.js +60 -0
- package/dist/providers/zai/credentials.js.map +1 -0
- package/dist/providers/zai/encoded-error.d.ts +90 -0
- package/dist/providers/zai/encoded-error.d.ts.map +1 -0
- package/dist/providers/zai/encoded-error.js +169 -0
- package/dist/providers/zai/encoded-error.js.map +1 -0
- package/dist/providers/zai/media.d.ts +38 -0
- package/dist/providers/zai/media.d.ts.map +1 -0
- package/dist/providers/zai/media.js +107 -0
- package/dist/providers/zai/media.js.map +1 -0
- package/dist/providers/zai/monitor-client.d.ts +53 -0
- package/dist/providers/zai/monitor-client.d.ts.map +1 -0
- package/dist/providers/zai/monitor-client.js +117 -0
- package/dist/providers/zai/monitor-client.js.map +1 -0
- package/dist/providers/zai/quota.d.ts +47 -0
- package/dist/providers/zai/quota.d.ts.map +1 -0
- package/dist/providers/zai/quota.js +127 -0
- package/dist/providers/zai/quota.js.map +1 -0
- package/dist/providers/zai/reader.d.ts +82 -0
- package/dist/providers/zai/reader.d.ts.map +1 -0
- package/dist/providers/zai/reader.js +490 -0
- package/dist/providers/zai/reader.js.map +1 -0
- package/dist/providers/zai/repository.d.ts +76 -0
- package/dist/providers/zai/repository.d.ts.map +1 -0
- package/dist/providers/zai/repository.js +715 -0
- package/dist/providers/zai/repository.js.map +1 -0
- package/package.json +11 -6
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node Command Invocation Adapter (DESIGN.md §2).
|
|
3
|
+
*
|
|
4
|
+
* This is the ONLY Module that reads process streams (`process.stdin`,
|
|
5
|
+
* `process.stdout`, `process.stderr`), detects TTY state, or sets
|
|
6
|
+
* `process.exitCode`. The executable imports `main` and this factory,
|
|
7
|
+
* invokes `main`, and calls `adapter.setExitCode(status)`.
|
|
8
|
+
*
|
|
9
|
+
* `runQuietly` is reentrant and invocation-scoped: it owns
|
|
10
|
+
* dependency-noise suppression (library console output) for the
|
|
11
|
+
* complete command call and restores logging before returning so
|
|
12
|
+
* notices and output are written with logging restored.
|
|
13
|
+
*
|
|
14
|
+
* Requirements: NFR-002, NFR-003, NFR-007.
|
|
15
|
+
*/
|
|
16
|
+
import type { CommandInvocationAdapter } from "./command-invocation.js";
|
|
17
|
+
/**
|
|
18
|
+
* Format a fatal load-failure message for the executable entrypoint.
|
|
19
|
+
*
|
|
20
|
+
* `bin/scoutline.js` calls this from its dynamic-import `.catch` handler
|
|
21
|
+
* to produce the structured `LOAD_ERROR` envelope that reaches stderr.
|
|
22
|
+
* P4-01 ensures the embedded message is run through the shared
|
|
23
|
+
* `redactCredentialString` so any credential material in the import
|
|
24
|
+
* error text is replaced before the value is emitted.
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatLoadFailure(error: unknown): string;
|
|
27
|
+
export declare function createNodeCommandInvocationAdapter(): CommandInvocationAdapter;
|
|
28
|
+
//# sourceMappingURL=node-command-invocation-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-command-invocation-adapter.d.ts","sourceRoot":"","sources":["../src/node-command-invocation-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAGxE;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAUxD;AAED,wBAAgB,kCAAkC,IAAI,wBAAwB,CAwD7E"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node Command Invocation Adapter (DESIGN.md §2).
|
|
3
|
+
*
|
|
4
|
+
* This is the ONLY Module that reads process streams (`process.stdin`,
|
|
5
|
+
* `process.stdout`, `process.stderr`), detects TTY state, or sets
|
|
6
|
+
* `process.exitCode`. The executable imports `main` and this factory,
|
|
7
|
+
* invokes `main`, and calls `adapter.setExitCode(status)`.
|
|
8
|
+
*
|
|
9
|
+
* `runQuietly` is reentrant and invocation-scoped: it owns
|
|
10
|
+
* dependency-noise suppression (library console output) for the
|
|
11
|
+
* complete command call and restores logging before returning so
|
|
12
|
+
* notices and output are written with logging restored.
|
|
13
|
+
*
|
|
14
|
+
* Requirements: NFR-002, NFR-003, NFR-007.
|
|
15
|
+
*/
|
|
16
|
+
import { redactCredentialString, configuredSecrets } from "./lib/redact.js";
|
|
17
|
+
/**
|
|
18
|
+
* Format a fatal load-failure message for the executable entrypoint.
|
|
19
|
+
*
|
|
20
|
+
* `bin/scoutline.js` calls this from its dynamic-import `.catch` handler
|
|
21
|
+
* to produce the structured `LOAD_ERROR` envelope that reaches stderr.
|
|
22
|
+
* P4-01 ensures the embedded message is run through the shared
|
|
23
|
+
* `redactCredentialString` so any credential material in the import
|
|
24
|
+
* error text is replaced before the value is emitted.
|
|
25
|
+
*/
|
|
26
|
+
export function formatLoadFailure(error) {
|
|
27
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
28
|
+
const redacted = redactCredentialString(message, configuredSecrets());
|
|
29
|
+
const payload = {
|
|
30
|
+
success: false,
|
|
31
|
+
error: redacted,
|
|
32
|
+
code: "LOAD_ERROR",
|
|
33
|
+
help: 'Make sure to run "npm run build" before running scoutline',
|
|
34
|
+
};
|
|
35
|
+
return JSON.stringify(payload, null, 2);
|
|
36
|
+
}
|
|
37
|
+
export function createNodeCommandInvocationAdapter() {
|
|
38
|
+
return {
|
|
39
|
+
get stdoutIsTTY() {
|
|
40
|
+
return process.stdout.isTTY === true;
|
|
41
|
+
},
|
|
42
|
+
get stdinIsTTY() {
|
|
43
|
+
return process.stdin.isTTY === true;
|
|
44
|
+
},
|
|
45
|
+
get environmentOutputMode() {
|
|
46
|
+
const value = process.env.ZAI_OUTPUT_MODE;
|
|
47
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
48
|
+
},
|
|
49
|
+
async readStdin() {
|
|
50
|
+
const chunks = [];
|
|
51
|
+
for await (const chunk of process.stdin) {
|
|
52
|
+
chunks.push(chunk instanceof Buffer ? chunk : Buffer.from(chunk));
|
|
53
|
+
}
|
|
54
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
55
|
+
},
|
|
56
|
+
writeStdout(value) {
|
|
57
|
+
process.stdout.write(value + "\n");
|
|
58
|
+
},
|
|
59
|
+
writeStderr(value) {
|
|
60
|
+
process.stderr.write(value + "\n");
|
|
61
|
+
},
|
|
62
|
+
async runQuietly(operation) {
|
|
63
|
+
const originals = {
|
|
64
|
+
log: console.log,
|
|
65
|
+
warn: console.warn,
|
|
66
|
+
info: console.info,
|
|
67
|
+
debug: console.debug,
|
|
68
|
+
};
|
|
69
|
+
console.log = () => { };
|
|
70
|
+
console.warn = () => { };
|
|
71
|
+
console.info = () => { };
|
|
72
|
+
console.debug = () => { };
|
|
73
|
+
try {
|
|
74
|
+
return await operation();
|
|
75
|
+
}
|
|
76
|
+
finally {
|
|
77
|
+
console.log = originals.log;
|
|
78
|
+
console.warn = originals.warn;
|
|
79
|
+
console.info = originals.info;
|
|
80
|
+
console.debug = originals.debug;
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
setExitCode(value) {
|
|
84
|
+
process.exitCode = value;
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=node-command-invocation-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-command-invocation-adapter.js","sourceRoot":"","sources":["../src/node-command-invocation-ad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,QAAQ,GAAG,KAAK,CAAC;QAC3B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
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 type { MiniMaxAdapterDependencies, ProviderDescriptor } from "../types.js";
|
|
28
|
+
import { type MiniMaxQuotaClientDeps } from "./quota-client.js";
|
|
29
|
+
/**
|
|
30
|
+
* Options for the MiniMax DiagnosticsCapability. Configuration is
|
|
31
|
+
* loaded from `env`; transport dependencies (`fetch`, timer) are the
|
|
32
|
+
* same Adapter-local quota transport used by the quota Capability so
|
|
33
|
+
* tests inject a single fake for both.
|
|
34
|
+
*/
|
|
35
|
+
export interface MiniMaxDiagnosticsCapabilityOptions extends MiniMaxQuotaClientDeps {
|
|
36
|
+
readonly env: NodeJS.ProcessEnv;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Build the MiniMax Provider Descriptor. The descriptor advertises the
|
|
40
|
+
* Search Capability and constructs an Adapter whose `search` Capability
|
|
41
|
+
* owns credentials, transport, Provider field mapping, and failure
|
|
42
|
+
* normalization. Construction is side-effect-free; the transport is
|
|
43
|
+
* invoked per Capability call. Tests pass `transport` (typically a
|
|
44
|
+
* fake-fetch wrapper); production uses the no-argument factory which
|
|
45
|
+
* resolves to the global `fetch` and timers inside each transport
|
|
46
|
+
* Module.
|
|
47
|
+
*/
|
|
48
|
+
export declare function createMiniMaxDescriptor(dependencies?: MiniMaxAdapterDependencies): ProviderDescriptor;
|
|
49
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/providers/minimax/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,KAAK,EACV,0BAA0B,EAI1B,kBAAkB,EACnB,MAAM,aAAa,CAAC;AA4BrB,OAAO,EAAqB,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AA+ZnF;;;;;GAKG;AACH,MAAM,WAAW,mCAAoC,SAAQ,sBAAsB;IACjF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;CACjC;AA+BD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,YAAY,CAAC,EAAE,0BAA0B,GACxC,kBAAkB,CAoDpB"}
|
|
@@ -0,0 +1,450 @@
|
|
|
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, QuotaError, TimeoutError, UnsupportedCapabilityError, ValidationError, UnsupportedOptionError, } from "../../lib/errors.js";
|
|
30
|
+
import { loadMiniMaxConfig } from "./config.js";
|
|
31
|
+
import { resolveImageSource, convertToDataUri } from "./media.js";
|
|
32
|
+
import { createMiniMaxQuotaCapability } from "./quota.js";
|
|
33
|
+
import { fetchMiniMaxQuota } from "./quota-client.js";
|
|
34
|
+
import { fetchMiniMaxSearch, fetchMiniMaxVlm, } from "./coding-plan-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; transient failures map to a representative status in
|
|
105
|
+
* the retryable set (429 or any 5xx 500..599 inclusive, per DESIGN.md
|
|
106
|
+
* §18 / FR-090). Unknown failures default to 500 (transient). When
|
|
107
|
+
* the caller already carries a numeric status (a typed ApiError), that
|
|
108
|
+
* status is honoured directly.
|
|
109
|
+
*/
|
|
110
|
+
function inferStatusCode(lower, known) {
|
|
111
|
+
if (typeof known === "number" && Number.isFinite(known))
|
|
112
|
+
return known;
|
|
113
|
+
if (lower.includes("404") || lower.includes("not found"))
|
|
114
|
+
return 404;
|
|
115
|
+
if (lower.includes("400") || lower.includes("bad request"))
|
|
116
|
+
return 400;
|
|
117
|
+
if (lower.includes("410") || lower.includes("gone"))
|
|
118
|
+
return 410;
|
|
119
|
+
if (lower.includes("422") || lower.includes("unprocessable"))
|
|
120
|
+
return 422;
|
|
121
|
+
if (lower.includes("500") || lower.includes("internal"))
|
|
122
|
+
return 500;
|
|
123
|
+
if (lower.includes("502") || lower.includes("bad gateway"))
|
|
124
|
+
return 502;
|
|
125
|
+
if (lower.includes("503") || lower.includes("service unavailable"))
|
|
126
|
+
return 503;
|
|
127
|
+
if (lower.includes("504") || lower.includes("gateway timeout"))
|
|
128
|
+
return 504;
|
|
129
|
+
return 500;
|
|
130
|
+
}
|
|
131
|
+
function normalizeMiniMaxError(error) {
|
|
132
|
+
// C1: QuotaError pass-through — terminal retry guarantee preserved.
|
|
133
|
+
if (error instanceof QuotaError)
|
|
134
|
+
return error;
|
|
135
|
+
// Configuration/option/validation errors carry clean, human-authored
|
|
136
|
+
// messages and are safe to surface verbatim.
|
|
137
|
+
if (error instanceof ValidationError ||
|
|
138
|
+
error instanceof UnsupportedOptionError ||
|
|
139
|
+
error instanceof ConfigurationError) {
|
|
140
|
+
return error;
|
|
141
|
+
}
|
|
142
|
+
// Re-wrap typed transport errors with sanitized messages so a raw
|
|
143
|
+
// Provider response body embedded upstream never survives. Code +
|
|
144
|
+
// statusCode (retry signal) are preserved.
|
|
145
|
+
if (error instanceof AuthError) {
|
|
146
|
+
// C2: 2-arg form keeps MINIMAX_API_KEY in the rendered help text.
|
|
147
|
+
return new AuthError("MiniMax authentication failed", "MINIMAX_API_KEY");
|
|
148
|
+
}
|
|
149
|
+
if (error instanceof NetworkError) {
|
|
150
|
+
return new NetworkError("MiniMax network error");
|
|
151
|
+
}
|
|
152
|
+
if (error instanceof TimeoutError) {
|
|
153
|
+
// Fixup D: preserve the original error's duration instead of
|
|
154
|
+
// reconstructing it from an ambient process.env that may differ from
|
|
155
|
+
// the injected env. The rewrapped error carries the same duration.
|
|
156
|
+
// G4: MINIMAX_TIMEOUT help text surfaces the right env var name.
|
|
157
|
+
return new TimeoutError(error.durationMs, "Try again or increase timeout with MINIMAX_TIMEOUT env var");
|
|
158
|
+
}
|
|
159
|
+
if (error instanceof ApiError) {
|
|
160
|
+
// C2: preserve the original message so embedded hints (e.g. the 2038
|
|
161
|
+
// verification URL) survive the rewrap.
|
|
162
|
+
const statusCode = inferStatusCode("", error.statusCode);
|
|
163
|
+
return new ApiError(error.message, statusCode);
|
|
164
|
+
}
|
|
165
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
166
|
+
const lower = message.toLowerCase();
|
|
167
|
+
if (lower.includes("401") ||
|
|
168
|
+
lower.includes("403") ||
|
|
169
|
+
lower.includes("unauthorized") ||
|
|
170
|
+
lower.includes("forbidden")) {
|
|
171
|
+
return new AuthError("MiniMax authentication failed");
|
|
172
|
+
}
|
|
173
|
+
if (lower.includes("timeout") || lower.includes("timed out") || lower.includes("etimedout")) {
|
|
174
|
+
return new TimeoutError(parseInt(process.env.MINIMAX_TIMEOUT || "30000", 10));
|
|
175
|
+
}
|
|
176
|
+
if (lower.includes("econnrefused") ||
|
|
177
|
+
lower.includes("econnreset") ||
|
|
178
|
+
lower.includes("network") ||
|
|
179
|
+
lower.includes("enotfound") ||
|
|
180
|
+
lower.includes("fetch failed")) {
|
|
181
|
+
return new NetworkError("MiniMax network error");
|
|
182
|
+
}
|
|
183
|
+
if (lower.includes("429") || lower.includes("rate limit")) {
|
|
184
|
+
return new ApiError("MiniMax rate limit exceeded", 429);
|
|
185
|
+
}
|
|
186
|
+
return new ApiError("MiniMax search request failed", inferStatusCode(lower));
|
|
187
|
+
}
|
|
188
|
+
function createMiniMaxSearchCapability(options) {
|
|
189
|
+
const { env, transport } = options;
|
|
190
|
+
const capability = {
|
|
191
|
+
validate(request) {
|
|
192
|
+
if (!request || typeof request.query !== "string" || request.query.trim() === "") {
|
|
193
|
+
throw new ValidationError("Search query must contain at least one non-whitespace character");
|
|
194
|
+
}
|
|
195
|
+
assertNoUnsupportedControls(request);
|
|
196
|
+
},
|
|
197
|
+
cacheIdentity(request) {
|
|
198
|
+
const apiKey = resolveApiKey(env);
|
|
199
|
+
const identityRequest = {
|
|
200
|
+
query: request.query,
|
|
201
|
+
};
|
|
202
|
+
if (request.controls) {
|
|
203
|
+
identityRequest.controls = request.controls;
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
provider: "minimax",
|
|
207
|
+
capability: "search",
|
|
208
|
+
credentialFingerprint: credentialFingerprint(apiKey),
|
|
209
|
+
request: identityRequest,
|
|
210
|
+
// MiniMax never probes legacy keys — no legacyCandidates.
|
|
211
|
+
};
|
|
212
|
+
},
|
|
213
|
+
async invoke(request) {
|
|
214
|
+
// Validate before any credential access or transport call.
|
|
215
|
+
capability.validate(request);
|
|
216
|
+
const config = loadMiniMaxConfig(env);
|
|
217
|
+
try {
|
|
218
|
+
const raw = await fetchMiniMaxSearch(config, request.query, transport);
|
|
219
|
+
return normalizeMiniMaxSearchResults(raw);
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
throw normalizeMiniMaxError(error);
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
return capability;
|
|
227
|
+
}
|
|
228
|
+
function resolveSpecializedSupportCheck(injected) {
|
|
229
|
+
if (injected)
|
|
230
|
+
return injected;
|
|
231
|
+
return (operation) => isMiniMaxVisionOperationSupported(operation);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Decide whether the MiniMax Adapter supports a Vision operation.
|
|
235
|
+
*
|
|
236
|
+
* `interpret-image` is supported unconditionally (the base release
|
|
237
|
+
* wires it through `sdk.vision.describe`). Specialized operations
|
|
238
|
+
* (`ui-artifact`, `extract-text`, `diagnose-error`, `diagram`,
|
|
239
|
+
* `chart`) are gated by the compiled conformance registry
|
|
240
|
+
* (DESIGN.md §15) — at P5-02 every entry is pending, so every
|
|
241
|
+
* specialized operation is unsupported here. `diff` and `video`
|
|
242
|
+
* remain Z.AI-only and are never supported by MiniMax.
|
|
243
|
+
*
|
|
244
|
+
* Pure: no Provider call, no env read, no I/O. The conformance query
|
|
245
|
+
* is a snapshot read of a frozen registry assembled at module load.
|
|
246
|
+
*
|
|
247
|
+
* `isSpecialized` is the injected support check (or the compiled
|
|
248
|
+
* registry query). Tests pass it via
|
|
249
|
+
* `dependencies.isSpecializedVisionOperationSupported`; production
|
|
250
|
+
* passes nothing and the registry query is used.
|
|
251
|
+
*/
|
|
252
|
+
function supportsMiniMaxVisionOperation(operation, isSpecialized) {
|
|
253
|
+
if (operation === "interpret-image")
|
|
254
|
+
return true;
|
|
255
|
+
if (SPECIALIZED_VISION_OPERATION_SET.has(operation)) {
|
|
256
|
+
return isSpecialized(operation);
|
|
257
|
+
}
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Build the MiniMax Vision Capability. Maps `interpret-image` to the
|
|
262
|
+
* MiniMax Coding Plan VLM endpoint. The validated image source is
|
|
263
|
+
* resolved and converted to a data URI before the transport call; the
|
|
264
|
+
* instruction maps to the optional `prompt`. Only a nonempty text
|
|
265
|
+
* result (extracted from the characterized `{ content }` envelope) is
|
|
266
|
+
* normalized.
|
|
267
|
+
*
|
|
268
|
+
* Specialized operations route through their operation-specific mapping
|
|
269
|
+
* Module when the support check returns true. The support decision is
|
|
270
|
+
* derived from the compiled conformance registry; tests may inject a
|
|
271
|
+
* forced-support function via `options.isSpecializedVisionOperationSupported`
|
|
272
|
+
* so the routing branch can be exercised without flipping a compiled
|
|
273
|
+
* attestation (DESIGN.md §15).
|
|
274
|
+
*
|
|
275
|
+
* Media is resolved after the configuration check; `convertToDataUri`
|
|
276
|
+
* performs the data-URI conversion (HTTP fetch + local read). Vision
|
|
277
|
+
* never uses the response cache (FR-022); shared execution owns the
|
|
278
|
+
* retry policy.
|
|
279
|
+
*/
|
|
280
|
+
function createMiniMaxVisionCapability(options) {
|
|
281
|
+
const { env, transport, isSpecializedVisionOperationSupported } = options;
|
|
282
|
+
const isSpecialized = resolveSpecializedSupportCheck(isSpecializedVisionOperationSupported);
|
|
283
|
+
const capability = {
|
|
284
|
+
supports(operation) {
|
|
285
|
+
return supportsMiniMaxVisionOperation(operation, isSpecialized);
|
|
286
|
+
},
|
|
287
|
+
async invoke(request) {
|
|
288
|
+
// Fail closed BEFORE any credential, media, or transport access.
|
|
289
|
+
// The support decision is the single registry-driven gate; every
|
|
290
|
+
// specialized operation stays unsupported at P5-02 because every
|
|
291
|
+
// registry entry is pending.
|
|
292
|
+
if (!supportsMiniMaxVisionOperation(request.operation, isSpecialized)) {
|
|
293
|
+
throw new UnsupportedCapabilityError("minimax", visionOperationToCapability(request.operation));
|
|
294
|
+
}
|
|
295
|
+
// Configuration check (credential) before media resolution.
|
|
296
|
+
const config = loadMiniMaxConfig(env);
|
|
297
|
+
// Specialized operations compose the prompt through their mapping
|
|
298
|
+
// Module. The mapping Module is the single source of intent,
|
|
299
|
+
// option formatting, and result normalization for that operation
|
|
300
|
+
// (DESIGN.md §15). When the support gate is open but the Module is
|
|
301
|
+
// somehow missing, surface an `API_ERROR` — the routing invariant
|
|
302
|
+
// is broken only via a coding bug, never via runtime drift.
|
|
303
|
+
if (request.operation !== "interpret-image") {
|
|
304
|
+
const specializedOp = request.operation;
|
|
305
|
+
const mapping = MINIMAX_VISION_MAPPINGS[specializedOp];
|
|
306
|
+
if (!mapping) {
|
|
307
|
+
throw new ApiError(`MiniMax vision mapping for ${specializedOp} is supported but no mapping Module is wired`, 500);
|
|
308
|
+
}
|
|
309
|
+
// Specialized requests always carry a `source`; the support gate
|
|
310
|
+
// above excludes `diff` (no `source`) and `video` (unsupported).
|
|
311
|
+
const resolved = resolveImageSource(request.source);
|
|
312
|
+
const prompt = mapping.composePrompt(request);
|
|
313
|
+
try {
|
|
314
|
+
// Cast safe: the global `fetch` (production default when
|
|
315
|
+
// `transport.fetch` is undefined) returns the full `Response`
|
|
316
|
+
// which satisfies both ProviderQuotaFetch and the wider
|
|
317
|
+
// ProviderImageFetch that `convertToDataUri` needs. Test
|
|
318
|
+
// fakes via makeResponse also provide `headers` + `arrayBuffer`
|
|
319
|
+
// by default. Widening `MiniMaxTransportDeps.fetch` instead
|
|
320
|
+
// would force quota tests' fakes to carry unused fields.
|
|
321
|
+
const dataUri = await convertToDataUri(resolved, transport);
|
|
322
|
+
const raw = await fetchMiniMaxVlm(config, dataUri, prompt, transport);
|
|
323
|
+
return mapping.normalizeResult(raw);
|
|
324
|
+
}
|
|
325
|
+
catch (error) {
|
|
326
|
+
throw normalizeMiniMaxError(error);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
const resolved = resolveImageSource(request.source);
|
|
330
|
+
const prompt = request.instruction && request.instruction.length > 0
|
|
331
|
+
? request.instruction
|
|
332
|
+
: "Describe the image.";
|
|
333
|
+
try {
|
|
334
|
+
// Cast safe — see the matching call site in the specialized
|
|
335
|
+
// branch above for the full rationale.
|
|
336
|
+
const dataUri = await convertToDataUri(resolved, transport);
|
|
337
|
+
const raw = await fetchMiniMaxVlm(config, dataUri, prompt, transport);
|
|
338
|
+
return normalizeMiniMaxVisionResult(raw);
|
|
339
|
+
}
|
|
340
|
+
catch (error) {
|
|
341
|
+
throw normalizeMiniMaxError(error);
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
};
|
|
345
|
+
return capability;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Normalize the MiniMax vision result to a nonempty text string. The
|
|
349
|
+
* characterized `VlmResponse` envelope is `{ content: string }`; any other
|
|
350
|
+
* shape, or an empty content, is a malformed result.
|
|
351
|
+
*/
|
|
352
|
+
function normalizeMiniMaxVisionResult(raw) {
|
|
353
|
+
if (raw && typeof raw === "object" && !Array.isArray(raw)) {
|
|
354
|
+
const record = raw;
|
|
355
|
+
if (typeof record.content === "string" && record.content.trim().length > 0) {
|
|
356
|
+
return record.content;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
throw new ApiError("MiniMax vision returned a malformed response", 500);
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Build the MiniMax DiagnosticsCapability. MiniMax connectivity is
|
|
363
|
+
* probed through a raw single-attempt quota inspection
|
|
364
|
+
* ({@link fetchMiniMaxQuota}), NOT `QuotaCapability.invoke()`, because
|
|
365
|
+
* the remains endpoint authenticates without a generative request.
|
|
366
|
+
* There is NO nested retry wrapper here — shared execution owns the
|
|
367
|
+
* retry policy; this transport performs exactly one attempt.
|
|
368
|
+
*/
|
|
369
|
+
function createMiniMaxDiagnosticsCapability(options) {
|
|
370
|
+
const { env, ...transportDeps } = options;
|
|
371
|
+
return {
|
|
372
|
+
async invoke(diagOptions) {
|
|
373
|
+
if (!diagOptions.probe)
|
|
374
|
+
return;
|
|
375
|
+
const config = loadMiniMaxConfig(env);
|
|
376
|
+
try {
|
|
377
|
+
await fetchMiniMaxQuota(config, transportDeps);
|
|
378
|
+
}
|
|
379
|
+
catch (error) {
|
|
380
|
+
throw normalizeMiniMaxError(error);
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
// ---------------------------------------------------------------------------
|
|
386
|
+
// Descriptor factory
|
|
387
|
+
// ---------------------------------------------------------------------------
|
|
388
|
+
/**
|
|
389
|
+
* Build the MiniMax Provider Descriptor. The descriptor advertises the
|
|
390
|
+
* Search Capability and constructs an Adapter whose `search` Capability
|
|
391
|
+
* owns credentials, transport, Provider field mapping, and failure
|
|
392
|
+
* normalization. Construction is side-effect-free; the transport is
|
|
393
|
+
* invoked per Capability call. Tests pass `transport` (typically a
|
|
394
|
+
* fake-fetch wrapper); production uses the no-argument factory which
|
|
395
|
+
* resolves to the global `fetch` and timers inside each transport
|
|
396
|
+
* Module.
|
|
397
|
+
*/
|
|
398
|
+
export function createMiniMaxDescriptor(dependencies) {
|
|
399
|
+
const transport = dependencies?.transport;
|
|
400
|
+
const isSpecializedVisionOperationSupported = dependencies?.isSpecializedVisionOperationSupported;
|
|
401
|
+
return {
|
|
402
|
+
id: "minimax",
|
|
403
|
+
isConfigured(env) {
|
|
404
|
+
const key = env.MINIMAX_API_KEY;
|
|
405
|
+
return typeof key === "string" && /\S/.test(key);
|
|
406
|
+
},
|
|
407
|
+
capabilities() {
|
|
408
|
+
// Base capabilities always advertised by MiniMax. Specialized
|
|
409
|
+
// Vision operations (`vision.ui-artifact`, etc.) are advertised
|
|
410
|
+
// only when their conformance support check returns true
|
|
411
|
+
// (DESIGN.md §15). Production derives this from the compiled
|
|
412
|
+
// registry; tests may force specific operations into the
|
|
413
|
+
// advertised set via
|
|
414
|
+
// `dependencies.isSpecializedVisionOperationSupported` so the
|
|
415
|
+
// routing branch can be exercised without flipping attestations.
|
|
416
|
+
const caps = new Set([
|
|
417
|
+
"search",
|
|
418
|
+
"vision.interpret-image",
|
|
419
|
+
"quota",
|
|
420
|
+
"diagnostics",
|
|
421
|
+
]);
|
|
422
|
+
const isSpecialized = resolveSpecializedSupportCheck(isSpecializedVisionOperationSupported);
|
|
423
|
+
for (const op of SPECIALIZED_VISION_OPERATIONS) {
|
|
424
|
+
if (isSpecialized(op)) {
|
|
425
|
+
caps.add(visionOperationToCapability(op));
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
return caps;
|
|
429
|
+
},
|
|
430
|
+
create(context) {
|
|
431
|
+
const search = createMiniMaxSearchCapability({
|
|
432
|
+
env: context.env,
|
|
433
|
+
transport,
|
|
434
|
+
});
|
|
435
|
+
const vision = createMiniMaxVisionCapability({
|
|
436
|
+
env: context.env,
|
|
437
|
+
transport,
|
|
438
|
+
isSpecializedVisionOperationSupported,
|
|
439
|
+
});
|
|
440
|
+
const quotaOptions = { env: context.env, ...transport };
|
|
441
|
+
const quota = createMiniMaxQuotaCapability(quotaOptions);
|
|
442
|
+
const diagnostics = createMiniMaxDiagnosticsCapability({
|
|
443
|
+
env: context.env,
|
|
444
|
+
...transport,
|
|
445
|
+
});
|
|
446
|
+
return { id: "minimax", search, vision, quota, diagnostics };
|
|
447
|
+
},
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
//# 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,8BAA8B,CAAC;AAE3E,OAAO,EACL,QAAQ,EACR,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,0BAA0B,EAC1B,eAAe,EACf,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAA6B,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAE,4BAA4B,EAAsC,MAAM,YAAY,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAA+B,MAAM,mBAAmB,CAAC;AACnF,OAAO,EACL,kBAAkB,EAClB,eAAe,GAEhB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,iCAAiC,EACjC,gCAAgC,EAChC,6BAA6B,GAE9B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,8EAA8E;AAC9E,wCAAwC;AACxC,8EAA8E;AAE9E,SAAS,qBAAqB,CAAC,MAAc;IAC3C,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,aAAa,CAAC,GAAsB;IAC3C,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CA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