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,371 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compiled MiniMax specialized-vision conformance registry (DESIGN.md §15,
|
|
3
|
+
* phases/05-specialized-vision.md P5-02).
|
|
4
|
+
*
|
|
5
|
+
* This module is the single source of truth for which specialized
|
|
6
|
+
* MiniMax Vision operations are supported at runtime. Help text, doctor
|
|
7
|
+
* `sharedCapabilities`, MiniMax descriptor capability metadata, and the
|
|
8
|
+
* Adapter support check all derive from this registry through the two
|
|
9
|
+
* pure queries below. There is no environment override and no runtime
|
|
10
|
+
* filesystem lookup.
|
|
11
|
+
*
|
|
12
|
+
* Boundary rules:
|
|
13
|
+
* - Pure module: no `process.env`, no I/O, no Provider calls.
|
|
14
|
+
* - Imports only the compiled revisions map, the compiled attestation
|
|
15
|
+
* manifest, and the shared capability type. It does not import the
|
|
16
|
+
* MiniMax Adapter, the Vision command, the doctor command, or any
|
|
17
|
+
* Provider transport.
|
|
18
|
+
* - The registry is built once at module load from immutable sources
|
|
19
|
+
* and frozen; support queries are pure functions over that snapshot.
|
|
20
|
+
*
|
|
21
|
+
* Support contract (DESIGN.md §15):
|
|
22
|
+
* `isMiniMaxVisionOperationSupported(op)` is true iff every condition
|
|
23
|
+
* holds:
|
|
24
|
+
* 1. `op` is one of the five specialized operations
|
|
25
|
+
* (`ui-artifact`, `extract-text`, `diagnose-error`, `diagram`,
|
|
26
|
+
* `chart`); `interpret-image`, `diff`, and `video` are not
|
|
27
|
+
* registry entries.
|
|
28
|
+
* 2. The entry's `offline` state is `"pass"`.
|
|
29
|
+
* 3. The entry's `live` state is `"pass"`.
|
|
30
|
+
* 4. A compiled attestation exists whose `operation` matches.
|
|
31
|
+
* 5. The attestation's `fixtureVersion` equals the entry's
|
|
32
|
+
* `fixtureVersion`.
|
|
33
|
+
* 6. The attestation's `implementationId` equals the entry's
|
|
34
|
+
* `implementationId` (which equals
|
|
35
|
+
* {@link MINIMAX_VISION_IMPLEMENTATION_ID}).
|
|
36
|
+
* 7. The attestation's `mappingRevision` equals the entry's
|
|
37
|
+
* `mappingRevision` (sourced from `vision-revisions.ts`).
|
|
38
|
+
* 8. Every entry in `attestation.assertions` has `passed: true`.
|
|
39
|
+
*
|
|
40
|
+
* At P5-02 every entry begins `pending/pending` with no attestation,
|
|
41
|
+
* so every specialized operation is unsupported. P5-03 flips entries
|
|
42
|
+
* to `pass/pass` and appends sanitized attestations one at a time.
|
|
43
|
+
*/
|
|
44
|
+
import { MINIMAX_VISION_MAPPING_REVISIONS } from "./vision-revisions.js";
|
|
45
|
+
import { MINIMAX_VISION_ATTESTATIONS } from "./vision-attestations.js";
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
// Constants
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
/**
|
|
50
|
+
* The Implementation identity for the direct MiniMax Vision transport
|
|
51
|
+
* maintained by Scoutline itself (Phase B — critique C3). The previous
|
|
52
|
+
* SDK-backed identity (`mmx-cli-sdk@1.0.16`) pinned the bundled
|
|
53
|
+
* `mmx-cli` runtime; this release replaces it with Scoutline's
|
|
54
|
+
* maintained direct transport. Changing this value (e.g. swapping
|
|
55
|
+
* transports again) invalidates every attestation until each mapping is
|
|
56
|
+
* re-attested (DESIGN.md §17).
|
|
57
|
+
*/
|
|
58
|
+
export const MINIMAX_VISION_IMPLEMENTATION_ID = "scoutline-direct@0.5.0";
|
|
59
|
+
/**
|
|
60
|
+
* The five specialized MiniMax Vision operations governed by this
|
|
61
|
+
* registry, in stable canonical order. `interpret-image`, `diff`, and
|
|
62
|
+
* `video` are deliberately absent.
|
|
63
|
+
*/
|
|
64
|
+
export const SPECIALIZED_VISION_OPERATIONS = [
|
|
65
|
+
"ui-artifact",
|
|
66
|
+
"extract-text",
|
|
67
|
+
"diagnose-error",
|
|
68
|
+
"diagram",
|
|
69
|
+
"chart",
|
|
70
|
+
];
|
|
71
|
+
/**
|
|
72
|
+
* Readonly set form of {@link SPECIALIZED_VISION_OPERATIONS} for fast
|
|
73
|
+
* membership checks. Used by the Adapter and by the support query.
|
|
74
|
+
*/
|
|
75
|
+
export const SPECIALIZED_VISION_OPERATION_SET = new Set(SPECIALIZED_VISION_OPERATIONS);
|
|
76
|
+
/**
|
|
77
|
+
* States considered valid for an entry's offline or live leg. Any
|
|
78
|
+
* other string makes the entry invalid.
|
|
79
|
+
*/
|
|
80
|
+
const VALID_CONFORMANCE_STATES = new Set(["pending", "pass", "fail"]);
|
|
81
|
+
const MINIMAX_VISION_CONFORMANCE_SOURCE = Object.freeze({
|
|
82
|
+
// P5-03a: ui-artifact offline conformance proven; live remains pending
|
|
83
|
+
// until the opt-in live attestation script runs with credentials.
|
|
84
|
+
"ui-artifact": { fixtureVersion: 1, offline: "pass", live: "pass" },
|
|
85
|
+
// P5-03b: extract-text offline conformance proven; live pending.
|
|
86
|
+
"extract-text": { fixtureVersion: 1, offline: "pass", live: "pending" },
|
|
87
|
+
// P5-03c: diagnose-error offline conformance proven; live pending.
|
|
88
|
+
"diagnose-error": { fixtureVersion: 1, offline: "pass", live: "pass" },
|
|
89
|
+
// P5-03d: diagram offline conformance proven; live pending.
|
|
90
|
+
diagram: { fixtureVersion: 1, offline: "pass", live: "pending" },
|
|
91
|
+
// P5-03e: chart offline conformance proven; live pending.
|
|
92
|
+
chart: { fixtureVersion: 1, offline: "pass", live: "pending" },
|
|
93
|
+
});
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
// Registry assembly (module load; pure; frozen)
|
|
96
|
+
// ---------------------------------------------------------------------------
|
|
97
|
+
/**
|
|
98
|
+
* Build the immutable registry by joining the hand-authored source
|
|
99
|
+
* with the generated mapping revisions and the compiled attestation
|
|
100
|
+
* manifest. Exactly one entry per specialized operation. The result
|
|
101
|
+
* is deeply frozen and indexed by operation.
|
|
102
|
+
*
|
|
103
|
+
* Attestations are matched by `operation`; if multiple attestations
|
|
104
|
+
* share an operation (a malformed manifest), the first wins and later
|
|
105
|
+
* duplicates are ignored. The support query performs the strict
|
|
106
|
+
* validation, so a mismatched attestation (wrong version, wrong
|
|
107
|
+
* implementation, etc.) is harmless to the registry shape — it simply
|
|
108
|
+
* fails the support contract.
|
|
109
|
+
*/
|
|
110
|
+
function buildRegistry() {
|
|
111
|
+
const attestationByOp = new Map();
|
|
112
|
+
for (const att of MINIMAX_VISION_ATTESTATIONS) {
|
|
113
|
+
if (typeof att === "object" &&
|
|
114
|
+
att !== null &&
|
|
115
|
+
typeof att.operation === "string" &&
|
|
116
|
+
SPECIALIZED_VISION_OPERATION_SET.has(att.operation) &&
|
|
117
|
+
!attestationByOp.has(att.operation)) {
|
|
118
|
+
attestationByOp.set(att.operation, att);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const registry = {};
|
|
122
|
+
for (const op of SPECIALIZED_VISION_OPERATIONS) {
|
|
123
|
+
const source = MINIMAX_VISION_CONFORMANCE_SOURCE[op];
|
|
124
|
+
const mappingRevision = MINIMAX_VISION_MAPPING_REVISIONS[op];
|
|
125
|
+
const entry = {
|
|
126
|
+
fixtureVersion: source.fixtureVersion,
|
|
127
|
+
implementationId: MINIMAX_VISION_IMPLEMENTATION_ID,
|
|
128
|
+
mappingRevision,
|
|
129
|
+
offline: source.offline,
|
|
130
|
+
live: source.live,
|
|
131
|
+
};
|
|
132
|
+
const attestation = attestationByOp.get(op);
|
|
133
|
+
if (attestation !== undefined) {
|
|
134
|
+
entry.attestation = attestation;
|
|
135
|
+
}
|
|
136
|
+
Object.freeze(entry);
|
|
137
|
+
registry[op] = entry;
|
|
138
|
+
}
|
|
139
|
+
return Object.freeze(registry);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The immutable MiniMax specialized-vision conformance registry. Pure
|
|
143
|
+
* snapshot; reading it performs no Provider call and inspects no
|
|
144
|
+
* environment value.
|
|
145
|
+
*/
|
|
146
|
+
export const MINIMAX_VISION_CONFORMANCE_REGISTRY = buildRegistry();
|
|
147
|
+
// ---------------------------------------------------------------------------
|
|
148
|
+
// Pure validation helpers
|
|
149
|
+
// ---------------------------------------------------------------------------
|
|
150
|
+
/**
|
|
151
|
+
* Validate a candidate registry against the structural contract. Used
|
|
152
|
+
* by tests to prove invariants: the production registry is built from
|
|
153
|
+
* frozen sources and is always valid. Returns a list of human-readable
|
|
154
|
+
* errors; an empty list means the candidate is structurally valid.
|
|
155
|
+
*
|
|
156
|
+
* Validation rules:
|
|
157
|
+
* - Exactly the five specialized operation keys are present.
|
|
158
|
+
* - `diff`, `video`, and `interpret-image` never appear.
|
|
159
|
+
* - `offline` and `live` are each one of `pending|pass|fail`.
|
|
160
|
+
* - `fixtureVersion` is a positive integer.
|
|
161
|
+
* - `implementationId` equals {@link MINIMAX_VISION_IMPLEMENTATION_ID}.
|
|
162
|
+
* - `mappingRevision` is a non-empty string.
|
|
163
|
+
* - If an attestation is present, it may NOT be attached to an entry
|
|
164
|
+
* whose `live` state is not `pass` (an attestation is the proof of
|
|
165
|
+
* a passing live run).
|
|
166
|
+
*
|
|
167
|
+
* NOTE: this function intentionally does NOT cross-check the
|
|
168
|
+
* attestation's `mappingRevision` against the generated revisions map
|
|
169
|
+
* or its `implementationId` against the constant; those checks are the
|
|
170
|
+
* `isMiniMaxVisionOperationSupported` query's job. The validator only
|
|
171
|
+
* checks structural integrity of a candidate registry. Tests that need
|
|
172
|
+
* to assert the attestation/revision match semantics use the support
|
|
173
|
+
* query directly.
|
|
174
|
+
*/
|
|
175
|
+
export function validateConformanceRegistry(candidate) {
|
|
176
|
+
const errors = [];
|
|
177
|
+
if (!candidate || typeof candidate !== "object") {
|
|
178
|
+
return ["registry must be an object"];
|
|
179
|
+
}
|
|
180
|
+
const seen = new Set();
|
|
181
|
+
for (const key of Object.keys(candidate)) {
|
|
182
|
+
seen.add(key);
|
|
183
|
+
if (key === "diff" || key === "video") {
|
|
184
|
+
errors.push(`forbidden key: ${key} never enters the specialized registry`);
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (key === "interpret-image") {
|
|
188
|
+
errors.push("forbidden key: interpret-image is supported unconditionally and is not a registry entry");
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
if (!SPECIALIZED_VISION_OPERATION_SET.has(key)) {
|
|
192
|
+
errors.push(`unknown key: ${key}`);
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
const entry = candidate[key];
|
|
196
|
+
if (!entry || typeof entry !== "object") {
|
|
197
|
+
errors.push(`entry ${key} must be an object`);
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
const e = entry;
|
|
201
|
+
if (typeof e.fixtureVersion !== "number" || !Number.isInteger(e.fixtureVersion)) {
|
|
202
|
+
errors.push(`entry ${key} fixtureVersion must be an integer`);
|
|
203
|
+
}
|
|
204
|
+
else if (e.fixtureVersion <= 0) {
|
|
205
|
+
errors.push(`entry ${key} fixtureVersion must be positive, got ${e.fixtureVersion}`);
|
|
206
|
+
}
|
|
207
|
+
if (typeof e.implementationId !== "string" || e.implementationId.length === 0) {
|
|
208
|
+
errors.push(`entry ${key} implementationId must be a non-empty string`);
|
|
209
|
+
}
|
|
210
|
+
else if (e.implementationId !== MINIMAX_VISION_IMPLEMENTATION_ID) {
|
|
211
|
+
errors.push(`entry ${key} implementationId must equal ${MINIMAX_VISION_IMPLEMENTATION_ID}, got ${e.implementationId}`);
|
|
212
|
+
}
|
|
213
|
+
if (typeof e.mappingRevision !== "string" || e.mappingRevision.length === 0) {
|
|
214
|
+
errors.push(`entry ${key} mappingRevision must be a non-empty string`);
|
|
215
|
+
}
|
|
216
|
+
if (typeof e.offline !== "string" || !VALID_CONFORMANCE_STATES.has(e.offline)) {
|
|
217
|
+
errors.push(`entry ${key} offline state invalid: ${String(e.offline)}`);
|
|
218
|
+
}
|
|
219
|
+
if (typeof e.live !== "string" || !VALID_CONFORMANCE_STATES.has(e.live)) {
|
|
220
|
+
errors.push(`entry ${key} live state invalid: ${String(e.live)}`);
|
|
221
|
+
}
|
|
222
|
+
if (e.attestation !== undefined) {
|
|
223
|
+
if (e.live !== "pass") {
|
|
224
|
+
errors.push(`entry ${key} carries an attestation but live state is ${String(e.live)} (must be pass)`);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
for (const op of SPECIALIZED_VISION_OPERATIONS) {
|
|
229
|
+
if (!seen.has(op)) {
|
|
230
|
+
errors.push(`missing key: ${op}`);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return errors;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Validate a candidate attestation against the schema contract.
|
|
237
|
+
* Returns a list of human-readable errors; an empty list means the
|
|
238
|
+
* attestation is structurally valid. Used by tests to prove the
|
|
239
|
+
* support contract fails closed on malformed attestations.
|
|
240
|
+
*/
|
|
241
|
+
export function validateAttestation(candidate) {
|
|
242
|
+
const errors = [];
|
|
243
|
+
if (!candidate || typeof candidate !== "object") {
|
|
244
|
+
return ["attestation must be an object"];
|
|
245
|
+
}
|
|
246
|
+
const a = candidate;
|
|
247
|
+
if (a.schemaVersion !== 1) {
|
|
248
|
+
errors.push(`attestation schemaVersion must be 1, got ${String(a.schemaVersion)}`);
|
|
249
|
+
}
|
|
250
|
+
if (a.provider !== "minimax") {
|
|
251
|
+
errors.push(`attestation provider must be minimax, got ${String(a.provider)}`);
|
|
252
|
+
}
|
|
253
|
+
if (typeof a.operation !== "string") {
|
|
254
|
+
errors.push("attestation operation must be a string");
|
|
255
|
+
}
|
|
256
|
+
else if (!SPECIALIZED_VISION_OPERATION_SET.has(a.operation)) {
|
|
257
|
+
errors.push(`attestation operation must be a specialized op, got ${a.operation}`);
|
|
258
|
+
}
|
|
259
|
+
if (typeof a.fixtureVersion !== "number" ||
|
|
260
|
+
!Number.isInteger(a.fixtureVersion) ||
|
|
261
|
+
a.fixtureVersion <= 0) {
|
|
262
|
+
errors.push(`attestation fixtureVersion must be a positive integer, got ${String(a.fixtureVersion)}`);
|
|
263
|
+
}
|
|
264
|
+
if (typeof a.implementationId !== "string" || a.implementationId.length === 0) {
|
|
265
|
+
errors.push("attestation implementationId must be a non-empty string");
|
|
266
|
+
}
|
|
267
|
+
if (typeof a.mappingRevision !== "string" || a.mappingRevision.length === 0) {
|
|
268
|
+
errors.push("attestation mappingRevision must be a non-empty string");
|
|
269
|
+
}
|
|
270
|
+
if (typeof a.testedAt !== "string" || a.testedAt.length === 0) {
|
|
271
|
+
errors.push("attestation testedAt must be a non-empty string");
|
|
272
|
+
}
|
|
273
|
+
if (typeof a.resultDigest !== "string" || a.resultDigest.length === 0) {
|
|
274
|
+
errors.push("attestation resultDigest must be a non-empty string");
|
|
275
|
+
}
|
|
276
|
+
if (!Array.isArray(a.assertions) || a.assertions.length === 0) {
|
|
277
|
+
errors.push("attestation assertions must be a non-empty array");
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
const ids = new Set();
|
|
281
|
+
for (const item of a.assertions) {
|
|
282
|
+
if (!item || typeof item !== "object") {
|
|
283
|
+
errors.push("attestation assertion must be an object");
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
const r = item;
|
|
287
|
+
if (typeof r.id !== "string" || r.id.length === 0) {
|
|
288
|
+
errors.push("attestation assertion id must be a non-empty string");
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
if (ids.has(r.id)) {
|
|
292
|
+
errors.push(`attestation assertion duplicate id: ${r.id}`);
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
ids.add(r.id);
|
|
296
|
+
if (r.passed !== true) {
|
|
297
|
+
errors.push(`attestation assertion ${r.id} must have passed: true`);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return errors;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Return true iff `operation` is currently a supported MiniMax
|
|
305
|
+
* specialized Vision operation, per DESIGN.md §15. Pure: no Provider
|
|
306
|
+
* call, no env read, no I/O. `interpret-image`, `diff`, and `video`
|
|
307
|
+
* always return false (they are not registry entries).
|
|
308
|
+
*/
|
|
309
|
+
export function isMiniMaxVisionOperationSupported(operation, options = {}) {
|
|
310
|
+
if (!SPECIALIZED_VISION_OPERATION_SET.has(operation)) {
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
const op = operation;
|
|
314
|
+
const registry = options.registry ?? MINIMAX_VISION_CONFORMANCE_REGISTRY;
|
|
315
|
+
const revisions = options.revisions ?? MINIMAX_VISION_MAPPING_REVISIONS;
|
|
316
|
+
const implementationId = options.implementationId ?? MINIMAX_VISION_IMPLEMENTATION_ID;
|
|
317
|
+
const entry = registry[op];
|
|
318
|
+
if (!entry)
|
|
319
|
+
return false;
|
|
320
|
+
if (entry.offline !== "pass" || entry.live !== "pass")
|
|
321
|
+
return false;
|
|
322
|
+
const attestation = entry.attestation;
|
|
323
|
+
if (!attestation)
|
|
324
|
+
return false;
|
|
325
|
+
// Strict attestation match. Every field that the registry records
|
|
326
|
+
// for this operation must agree with the attestation.
|
|
327
|
+
if (attestation.operation !== op)
|
|
328
|
+
return false;
|
|
329
|
+
if (attestation.fixtureVersion !== entry.fixtureVersion)
|
|
330
|
+
return false;
|
|
331
|
+
if (attestation.implementationId !== entry.implementationId)
|
|
332
|
+
return false;
|
|
333
|
+
if (attestation.implementationId !== implementationId)
|
|
334
|
+
return false;
|
|
335
|
+
if (attestation.mappingRevision !== entry.mappingRevision)
|
|
336
|
+
return false;
|
|
337
|
+
if (attestation.mappingRevision !== revisions[op])
|
|
338
|
+
return false;
|
|
339
|
+
if (attestation.schemaVersion !== 1)
|
|
340
|
+
return false;
|
|
341
|
+
if (attestation.provider !== "minimax")
|
|
342
|
+
return false;
|
|
343
|
+
const assertions = attestation.assertions;
|
|
344
|
+
if (!Array.isArray(assertions) || assertions.length === 0)
|
|
345
|
+
return false;
|
|
346
|
+
for (const a of assertions) {
|
|
347
|
+
if (!a || a.passed !== true)
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
return true;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Return a snapshot of every specialized operation's registry entry.
|
|
354
|
+
* The returned record is the same frozen object as the compiled
|
|
355
|
+
* registry; callers MUST NOT mutate it. Use this for help text,
|
|
356
|
+
* diagnostics, and packaging tests so there is a single source of
|
|
357
|
+
* truth for registry metadata.
|
|
358
|
+
*/
|
|
359
|
+
export function getMiniMaxVisionConformanceMetadata() {
|
|
360
|
+
return MINIMAX_VISION_CONFORMANCE_REGISTRY;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Return the subset of specialized operations currently supported by
|
|
364
|
+
* the MiniMax Vision conformance registry, in canonical order. Used by
|
|
365
|
+
* the Adapter descriptor, Vision help, and doctor `sharedCapabilities`
|
|
366
|
+
* so they all derive from a single query.
|
|
367
|
+
*/
|
|
368
|
+
export function listSupportedMiniMaxVisionOperations() {
|
|
369
|
+
return SPECIALIZED_VISION_OPERATIONS.filter((op) => isMiniMaxVisionOperationSupported(op));
|
|
370
|
+
}
|
|
371
|
+
//# sourceMappingURL=vision-conformance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vision-conformance.js","sourceRoot":"","sources":["../../../src/providers/minimax/vision-conformance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAGH,OAAO,EAAE,gCAAgC,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AA0DvE,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,wBAAwB,CAAC;AAEzE;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,aAAa;IACb,cAAc;IACd,gBAAgB;IAChB,SAAS;IACT,OAAO;CACC,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAA4C,IAAI,GAAG,CAC9F,6BAA6B,CAC9B,CAAC;AAEF;;;GAGG;AACH,MAAM,wBAAwB,G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AC,EAAE,CAAC,CAAC,CAAC;AAC7F,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* chart specialized Vision mapping (DESIGN.md §15, P5-03e).
|
|
3
|
+
*
|
|
4
|
+
* Composes the user instruction, an optional focus hint, and the
|
|
5
|
+
* chart-analysis intent into a single prompt for
|
|
6
|
+
* `sdk.vision.describe`. The user instruction is preserved verbatim;
|
|
7
|
+
* the optional focus hint is rendered exactly once. The mapping routes
|
|
8
|
+
* ONLY through `sdk.vision.describe` with one image — it never claims a
|
|
9
|
+
* dedicated MiniMax operation.
|
|
10
|
+
*
|
|
11
|
+
* This Module is wired into the generated operation map
|
|
12
|
+
* (`vision-mappings.generated.ts`) by the prebuild generator and
|
|
13
|
+
* contributes the chart input to the conformance registry's SHA-256
|
|
14
|
+
* mapping revision. It stays unsupported at runtime until a separate
|
|
15
|
+
* opt-in live attestation flips the registry's live state to "pass"
|
|
16
|
+
* (DESIGN.md §15).
|
|
17
|
+
*
|
|
18
|
+
* Boundary rules:
|
|
19
|
+
* - Pure prompt composition + result normalization only. No
|
|
20
|
+
* `process.env`, no filesystem, no network, no Provider imports.
|
|
21
|
+
* - Imports only the shared common runtime helpers; any change to
|
|
22
|
+
* `common.ts` intentionally invalidates this mapping's revision.
|
|
23
|
+
*/
|
|
24
|
+
import type { SpecializedVisionOperation } from "../vision-conformance.js";
|
|
25
|
+
/**
|
|
26
|
+
* The chart mapping Module. Satisfies the
|
|
27
|
+
* {@link MiniMaxVisionMappingModule} interface declared in the generated
|
|
28
|
+
* operation map.
|
|
29
|
+
*/
|
|
30
|
+
export declare const chartMapping: {
|
|
31
|
+
readonly operation: SpecializedVisionOperation;
|
|
32
|
+
composePrompt(request: unknown): string;
|
|
33
|
+
normalizeResult(raw: unknown): string;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../../../src/providers/minimax/vision-mappings/chart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AA0B3E;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE;IACzB,QAAQ,CAAC,SAAS,EAAE,0BAA0B,CAAC;IAC/C,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC;IACxC,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC;CAmBvC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* chart specialized Vision mapping (DESIGN.md §15, P5-03e).
|
|
3
|
+
*
|
|
4
|
+
* Composes the user instruction, an optional focus hint, and the
|
|
5
|
+
* chart-analysis intent into a single prompt for
|
|
6
|
+
* `sdk.vision.describe`. The user instruction is preserved verbatim;
|
|
7
|
+
* the optional focus hint is rendered exactly once. The mapping routes
|
|
8
|
+
* ONLY through `sdk.vision.describe` with one image — it never claims a
|
|
9
|
+
* dedicated MiniMax operation.
|
|
10
|
+
*
|
|
11
|
+
* This Module is wired into the generated operation map
|
|
12
|
+
* (`vision-mappings.generated.ts`) by the prebuild generator and
|
|
13
|
+
* contributes the chart input to the conformance registry's SHA-256
|
|
14
|
+
* mapping revision. It stays unsupported at runtime until a separate
|
|
15
|
+
* opt-in live attestation flips the registry's live state to "pass"
|
|
16
|
+
* (DESIGN.md §15).
|
|
17
|
+
*
|
|
18
|
+
* Boundary rules:
|
|
19
|
+
* - Pure prompt composition + result normalization only. No
|
|
20
|
+
* `process.env`, no filesystem, no network, no Provider imports.
|
|
21
|
+
* - Imports only the shared common runtime helpers; any change to
|
|
22
|
+
* `common.ts` intentionally invalidates this mapping's revision.
|
|
23
|
+
*/
|
|
24
|
+
import { composeMappingPrompt, normalizeMappingResult, formatOptionalOption, } from "./common.js";
|
|
25
|
+
/**
|
|
26
|
+
* Chart-analysis intent. Rendered once per prompt as the opening intent
|
|
27
|
+
* segment. Deliberately distinct from the user instruction's phrasing
|
|
28
|
+
* so the instruction remains intact.
|
|
29
|
+
*/
|
|
30
|
+
const CHART_INTENT = "Analyze the chart shown in the image. Report its title or subject, what each axis measures, and the overall direction of the data.";
|
|
31
|
+
/**
|
|
32
|
+
* The chart mapping Module. Satisfies the
|
|
33
|
+
* {@link MiniMaxVisionMappingModule} interface declared in the generated
|
|
34
|
+
* operation map.
|
|
35
|
+
*/
|
|
36
|
+
export const chartMapping = {
|
|
37
|
+
operation: "chart",
|
|
38
|
+
composePrompt(request) {
|
|
39
|
+
const req = request;
|
|
40
|
+
const segments = [
|
|
41
|
+
{ kind: "intent", text: CHART_INTENT },
|
|
42
|
+
{ kind: "instruction", text: req.instruction },
|
|
43
|
+
];
|
|
44
|
+
// Optional focus hint, rendered at most once.
|
|
45
|
+
const focus = formatOptionalOption("Focus", req.focus);
|
|
46
|
+
if (focus.length > 0) {
|
|
47
|
+
segments.push({ kind: "option", text: focus });
|
|
48
|
+
}
|
|
49
|
+
return composeMappingPrompt(segments);
|
|
50
|
+
},
|
|
51
|
+
normalizeResult(raw) {
|
|
52
|
+
return normalizeMappingResult(raw);
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart.js","sourceRoot":"","sources":["../../../../src/providers/minimax/vision-mappings/chart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,GAErB,MAAM,aAAa,CAAC;AAYrB;;;;GAIG;AACH,MAAM,YAAY,GAChB,oIAAoI,CAAC;AAEvI;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAIrB;IACF,SAAS,EAAE,OAAO;IAClB,aAAa,CAAC,OAAgB;QAC5B,MAAM,GAAG,GAAG,OAAuB,CAAC;QACpC,MAAM,QAAQ,GAA2B;YACvC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE;YACtC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,CAAC,WAAW,EAAE;SAC/C,CAAC;QACF,8CAA8C;QAC9C,MAAM,KAAK,GAAG,oBAAoB,CAAC,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;QACvD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IACD,eAAe,CAAC,GAAY;QAC1B,OAAO,sBAAsB,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable common mapping runtime for MiniMax specialized Vision mappings
|
|
3
|
+
* (DESIGN.md §15, phases/05-specialized-vision.md P5-02).
|
|
4
|
+
*
|
|
5
|
+
* P5-03's operation-specific Modules (`vision-mappings/{op}.ts`) import
|
|
6
|
+
* shared helpers from this file. Keeping the shared prompt-composition
|
|
7
|
+
* and result-normalization logic here means a single intentional edit
|
|
8
|
+
* invalidates every mapping revision at once — exactly the contract
|
|
9
|
+
* the conformance registry enforces.
|
|
10
|
+
*
|
|
11
|
+
* Boundary rules:
|
|
12
|
+
* - Pure helpers only. No `process.env`, no filesystem, no network,
|
|
13
|
+
* no Provider imports.
|
|
14
|
+
* - No operation-specific knowledge lives here; per-operation
|
|
15
|
+
* prompts belong in each Module.
|
|
16
|
+
* - The byte-content of this file is one of the inputs to every
|
|
17
|
+
* generated mapping revision, so changing it intentionally
|
|
18
|
+
* invalidates every mapping's attestation.
|
|
19
|
+
*
|
|
20
|
+
* At P5-02 the helpers below are foundational; no operation Module
|
|
21
|
+
* imports them yet. P5-03a–P5-03e will compose prompts through
|
|
22
|
+
* `composeMappingPrompt` and normalize results through
|
|
23
|
+
* `normalizeMappingResult`.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* A single composed prompt segment. Segments are joined with blank-line
|
|
27
|
+
* separators so each segment (intent, instruction, options) forms a
|
|
28
|
+
* distinct paragraph in the rendered prompt.
|
|
29
|
+
*/
|
|
30
|
+
export interface MappingPromptSegment {
|
|
31
|
+
readonly kind: "intent" | "instruction" | "option" | "constraint";
|
|
32
|
+
readonly text: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Compose a deterministic multi-paragraph prompt from segments.
|
|
36
|
+
* Trims each segment, drops empties, and joins with exactly one blank
|
|
37
|
+
* line between segments. The composed prompt is stable: identical
|
|
38
|
+
* inputs always produce byte-identical output, which makes the
|
|
39
|
+
* operation Module's revision reproducible.
|
|
40
|
+
*/
|
|
41
|
+
export declare function composeMappingPrompt(segments: readonly MappingPromptSegment[]): string;
|
|
42
|
+
/**
|
|
43
|
+
* Normalize the MiniMax Vision `sdk.vision.describe` envelope to a
|
|
44
|
+
* nonempty text string. The characterized envelope is
|
|
45
|
+
* `{ content: string }`; any other shape, or empty content, is a
|
|
46
|
+
* malformed result.
|
|
47
|
+
*
|
|
48
|
+
* Operation Modules in P5-03 will route through this helper so that
|
|
49
|
+
* every specialized mapping applies the same result-shape contract.
|
|
50
|
+
*/
|
|
51
|
+
export declare function normalizeMappingResult(raw: unknown): string;
|
|
52
|
+
/**
|
|
53
|
+
* Format an optional string option as a labelled prompt line, or
|
|
54
|
+
* return the empty string when the value is absent or whitespace-only.
|
|
55
|
+
* Used by operation Modules to render optional fields (programming
|
|
56
|
+
* language, diagram type, focus, context) into the prompt without
|
|
57
|
+
* duplicating the guard logic.
|
|
58
|
+
*/
|
|
59
|
+
export declare function formatOptionalOption(label: string, value: string | undefined): string;
|
|
60
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/providers/minimax/vision-mappings/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAQH;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,aAAa,GAAG,QAAQ,GAAG,YAAY,CAAC;IAClE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,SAAS,oBAAoB,EAAE,GAAG,MAAM,CAKtF;AAMD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAQ3D;AAMD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAGrF"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable common mapping runtime for MiniMax specialized Vision mappings
|
|
3
|
+
* (DESIGN.md §15, phases/05-specialized-vision.md P5-02).
|
|
4
|
+
*
|
|
5
|
+
* P5-03's operation-specific Modules (`vision-mappings/{op}.ts`) import
|
|
6
|
+
* shared helpers from this file. Keeping the shared prompt-composition
|
|
7
|
+
* and result-normalization logic here means a single intentional edit
|
|
8
|
+
* invalidates every mapping revision at once — exactly the contract
|
|
9
|
+
* the conformance registry enforces.
|
|
10
|
+
*
|
|
11
|
+
* Boundary rules:
|
|
12
|
+
* - Pure helpers only. No `process.env`, no filesystem, no network,
|
|
13
|
+
* no Provider imports.
|
|
14
|
+
* - No operation-specific knowledge lives here; per-operation
|
|
15
|
+
* prompts belong in each Module.
|
|
16
|
+
* - The byte-content of this file is one of the inputs to every
|
|
17
|
+
* generated mapping revision, so changing it intentionally
|
|
18
|
+
* invalidates every mapping's attestation.
|
|
19
|
+
*
|
|
20
|
+
* At P5-02 the helpers below are foundational; no operation Module
|
|
21
|
+
* imports them yet. P5-03a–P5-03e will compose prompts through
|
|
22
|
+
* `composeMappingPrompt` and normalize results through
|
|
23
|
+
* `normalizeMappingResult`.
|
|
24
|
+
*/
|
|
25
|
+
import { ApiError } from "../../../lib/errors.js";
|
|
26
|
+
/**
|
|
27
|
+
* Compose a deterministic multi-paragraph prompt from segments.
|
|
28
|
+
* Trims each segment, drops empties, and joins with exactly one blank
|
|
29
|
+
* line between segments. The composed prompt is stable: identical
|
|
30
|
+
* inputs always produce byte-identical output, which makes the
|
|
31
|
+
* operation Module's revision reproducible.
|
|
32
|
+
*/
|
|
33
|
+
export function composeMappingPrompt(segments) {
|
|
34
|
+
const cleaned = segments
|
|
35
|
+
.map((s) => (typeof s?.text === "string" ? s.text.trim() : ""))
|
|
36
|
+
.filter((text) => text.length > 0);
|
|
37
|
+
return cleaned.join("\n\n");
|
|
38
|
+
}
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
// Result normalization
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
/**
|
|
43
|
+
* Normalize the MiniMax Vision `sdk.vision.describe` envelope to a
|
|
44
|
+
* nonempty text string. The characterized envelope is
|
|
45
|
+
* `{ content: string }`; any other shape, or empty content, is a
|
|
46
|
+
* malformed result.
|
|
47
|
+
*
|
|
48
|
+
* Operation Modules in P5-03 will route through this helper so that
|
|
49
|
+
* every specialized mapping applies the same result-shape contract.
|
|
50
|
+
*/
|
|
51
|
+
export function normalizeMappingResult(raw) {
|
|
52
|
+
if (raw && typeof raw === "object" && !Array.isArray(raw)) {
|
|
53
|
+
const record = raw;
|
|
54
|
+
if (typeof record.content === "string" && record.content.trim().length > 0) {
|
|
55
|
+
return record.content;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
throw new ApiError("MiniMax vision returned a malformed response", 500);
|
|
59
|
+
}
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
// Option formatting
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
/**
|
|
64
|
+
* Format an optional string option as a labelled prompt line, or
|
|
65
|
+
* return the empty string when the value is absent or whitespace-only.
|
|
66
|
+
* Used by operation Modules to render optional fields (programming
|
|
67
|
+
* language, diagram type, focus, context) into the prompt without
|
|
68
|
+
* duplicating the guard logic.
|
|
69
|
+
*/
|
|
70
|
+
export function formatOptionalOption(label, value) {
|
|
71
|
+
if (typeof value !== "string" || value.trim().length === 0)
|
|
72
|
+
return "";
|
|
73
|
+
return `${label}: ${value.trim()}`;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/providers/minimax/vision-mappings/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAgBlD;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAyC;IAC5E,MAAM,OAAO,GAAG,QAAQ;SACrB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SAC9D,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC;AAED,8EAA8E;AAC9E,uBAAuB;AACvB,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAY;IACjD,IAAI,GAAG,IAAI,O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