crosscheck-mcp 0.2.29 → 0.2.30
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/dist/browser-ext.cjs +30 -13
- package/dist/browser-ext.cjs.map +1 -1
- package/dist/browser-ext.js +30 -13
- package/dist/browser-ext.js.map +1 -1
- package/dist/embed.cjs +83 -20
- package/dist/embed.cjs.map +1 -1
- package/dist/embed.d.cts +42 -2
- package/dist/embed.d.ts +42 -2
- package/dist/embed.js +77 -19
- package/dist/embed.js.map +1 -1
- package/dist/node-stdio.cjs +33 -16
- package/dist/node-stdio.cjs.map +1 -1
- package/dist/node-stdio.d.cts +1 -1
- package/dist/node-stdio.d.ts +1 -1
- package/dist/node-stdio.js +30 -13
- package/dist/node-stdio.js.map +1 -1
- package/dist/{types-BcprisDl.d.cts → types-HA3W47O4.d.cts} +13 -2
- package/dist/{types-BcprisDl.d.ts → types-HA3W47O4.d.ts} +13 -2
- package/package.json +3 -2
package/dist/embed.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { C as ChatMessage } from './types-
|
|
1
|
+
import { C as ChatMessage, I as ImagePart, S as SendArgs } from './types-HA3W47O4.cjs';
|
|
2
|
+
export { a as IMAGE_MEDIA_TYPES } from './types-HA3W47O4.cjs';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* A record of which engine processes are alive, and what they are RUNNING.
|
|
@@ -98,6 +99,30 @@ declare const DEFAULT_FALLBACKS: Readonly<Record<string, readonly string[]>>;
|
|
|
98
99
|
*/
|
|
99
100
|
declare const DEFAULT_EXCLUDED_PROVIDERS: readonly string[];
|
|
100
101
|
|
|
102
|
+
/**
|
|
103
|
+
* The super lineup, as ORDERED CHAINS: index 0 is the model we want, the rest
|
|
104
|
+
* are fallbacks tried only on a model-access failure (never on auth, rate
|
|
105
|
+
* limit, or a 500 — a different model doesn't fix a bad key).
|
|
106
|
+
*
|
|
107
|
+
* Chains rather than single ids for one specific reason: it lets us name a
|
|
108
|
+
* model that hasn't shipped yet. `gpt-6-astra` is not in OpenAI's model list
|
|
109
|
+
* as of 2026-09-04 — verified against the live endpoint, no `gpt-6*` exists —
|
|
110
|
+
* so it 404s today and the chain silently serves gpt-5.6 instead. The day
|
|
111
|
+
* Astra becomes available it starts being used with no release on our side.
|
|
112
|
+
*
|
|
113
|
+
* The cost of that convenience, stated plainly: until Astra ships, an OpenAI
|
|
114
|
+
* seat in super mode pays one extra failed round trip per process per 5
|
|
115
|
+
* minutes (dead-models.ts caches the 404 for that long). A model-not-found is
|
|
116
|
+
* an immediate error rather than a timeout, so it's a few hundred ms, not a
|
|
117
|
+
* hang. If that ever becomes annoying, drop "gpt-6-astra" from the chain —
|
|
118
|
+
* nothing else depends on it.
|
|
119
|
+
*
|
|
120
|
+
* anthropic stays FIRST: resolveProviders preserves key order into `selected`,
|
|
121
|
+
* and debate's moderator / coordinate's proposer default to `selected[0]`.
|
|
122
|
+
* Reordering this object silently moves those seats to another provider.
|
|
123
|
+
*/
|
|
124
|
+
declare const SUPER_MODELS: Readonly<Record<string, readonly string[]>>;
|
|
125
|
+
|
|
101
126
|
/**
|
|
102
127
|
* Embedded host entrypoint — the API Crosscheck Desktop runs panels through.
|
|
103
128
|
*
|
|
@@ -259,6 +284,14 @@ type EngineEvent =
|
|
|
259
284
|
/** How much of each model reply an activity event carries. Enough to read
|
|
260
285
|
* the back-and-forth; the full text is in the envelope. */
|
|
261
286
|
declare const ACTIVITY_TEXT_CAP = 8000;
|
|
287
|
+
/** Providers whose models can see images (vault ids). Everyone else is told
|
|
288
|
+
* an image exists that it can't see, rather than being sent one it would
|
|
289
|
+
* reject — or silently answering as if there were none. */
|
|
290
|
+
declare const VISION_PROVIDERS: readonly string[];
|
|
291
|
+
declare const MAX_RUN_IMAGES = 8;
|
|
292
|
+
/** Put the run's images on the newest user message — or, for a provider
|
|
293
|
+
* that can't see images, a plain note saying they exist. */
|
|
294
|
+
declare function withRunImages(args: SendArgs, provider: string, images: readonly ImagePart[] | undefined): SendArgs;
|
|
262
295
|
type EngineEventSink = (event: EngineEvent) => void;
|
|
263
296
|
interface EmbeddedEngineOptions {
|
|
264
297
|
/** Vault provider id → raw API key. Only providers present here are built.
|
|
@@ -267,6 +300,9 @@ interface EmbeddedEngineOptions {
|
|
|
267
300
|
/** Vault provider id → pinned model. Omit a provider to take the engine
|
|
268
301
|
* default. Mirrors what `/account/models` and `crosscheck models set` do. */
|
|
269
302
|
models?: Readonly<Record<string, string>>;
|
|
303
|
+
/** Vault provider id → pinned SUPER-tier model (what `confer super` uses).
|
|
304
|
+
* Omit a provider to take the engine's super lineup (SUPER_MODELS). */
|
|
305
|
+
superModels?: Readonly<Record<string, string>>;
|
|
270
306
|
/** Default moderator/synthesis provider. */
|
|
271
307
|
moderator?: string;
|
|
272
308
|
/** Explicit pricing.json path. Defaults to the copy bundled in `dist/`. */
|
|
@@ -278,6 +314,10 @@ interface RunOptions {
|
|
|
278
314
|
/** Stop waiting on any single model call after this long (ms). The run
|
|
279
315
|
* continues with the answers already in. Off when 0/undefined. */
|
|
280
316
|
callTimeoutMs?: number;
|
|
317
|
+
/** Images for this run (base64, png/jpeg/webp/gif; at most 8). Sent with
|
|
318
|
+
* the question to every provider that can see images; the others are
|
|
319
|
+
* told they exist. Embed-only — the MCP tools don't take images. */
|
|
320
|
+
images?: ImagePart[];
|
|
281
321
|
}
|
|
282
322
|
interface AskOptions {
|
|
283
323
|
/** Vault id ("grok", not "xai"). Must be a provider this engine built. */
|
|
@@ -351,4 +391,4 @@ declare const __test_internals: {
|
|
|
351
391
|
vaultId: typeof vaultId;
|
|
352
392
|
};
|
|
353
393
|
|
|
354
|
-
export { ACTIVITY_TEXT_CAP, type AskOptions, type AskResult, DEFAULT_EXCLUDED_PROVIDERS, DEFAULT_FALLBACKS, DEFAULT_MODELS, type EmbeddedEngine, type EmbeddedEngineOptions, type EngineEvent, type EngineEventSink, type EventUsage, type ProcRecord, type ProcStatus, type RunOptions, KEY_ENV as __KEY_ENV, MODEL_ENV as __MODEL_ENV, __test_internals, createEmbeddedEngine, isAlive, listProcesses, processRegistryPath };
|
|
394
|
+
export { ACTIVITY_TEXT_CAP, type AskOptions, type AskResult, DEFAULT_EXCLUDED_PROVIDERS, DEFAULT_FALLBACKS, DEFAULT_MODELS, type EmbeddedEngine, type EmbeddedEngineOptions, type EngineEvent, type EngineEventSink, type EventUsage, ImagePart, MAX_RUN_IMAGES, type ProcRecord, type ProcStatus, type RunOptions, SUPER_MODELS, VISION_PROVIDERS, KEY_ENV as __KEY_ENV, MODEL_ENV as __MODEL_ENV, __test_internals, createEmbeddedEngine, isAlive, listProcesses, processRegistryPath, withRunImages };
|
package/dist/embed.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { C as ChatMessage } from './types-
|
|
1
|
+
import { C as ChatMessage, I as ImagePart, S as SendArgs } from './types-HA3W47O4.js';
|
|
2
|
+
export { a as IMAGE_MEDIA_TYPES } from './types-HA3W47O4.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* A record of which engine processes are alive, and what they are RUNNING.
|
|
@@ -98,6 +99,30 @@ declare const DEFAULT_FALLBACKS: Readonly<Record<string, readonly string[]>>;
|
|
|
98
99
|
*/
|
|
99
100
|
declare const DEFAULT_EXCLUDED_PROVIDERS: readonly string[];
|
|
100
101
|
|
|
102
|
+
/**
|
|
103
|
+
* The super lineup, as ORDERED CHAINS: index 0 is the model we want, the rest
|
|
104
|
+
* are fallbacks tried only on a model-access failure (never on auth, rate
|
|
105
|
+
* limit, or a 500 — a different model doesn't fix a bad key).
|
|
106
|
+
*
|
|
107
|
+
* Chains rather than single ids for one specific reason: it lets us name a
|
|
108
|
+
* model that hasn't shipped yet. `gpt-6-astra` is not in OpenAI's model list
|
|
109
|
+
* as of 2026-09-04 — verified against the live endpoint, no `gpt-6*` exists —
|
|
110
|
+
* so it 404s today and the chain silently serves gpt-5.6 instead. The day
|
|
111
|
+
* Astra becomes available it starts being used with no release on our side.
|
|
112
|
+
*
|
|
113
|
+
* The cost of that convenience, stated plainly: until Astra ships, an OpenAI
|
|
114
|
+
* seat in super mode pays one extra failed round trip per process per 5
|
|
115
|
+
* minutes (dead-models.ts caches the 404 for that long). A model-not-found is
|
|
116
|
+
* an immediate error rather than a timeout, so it's a few hundred ms, not a
|
|
117
|
+
* hang. If that ever becomes annoying, drop "gpt-6-astra" from the chain —
|
|
118
|
+
* nothing else depends on it.
|
|
119
|
+
*
|
|
120
|
+
* anthropic stays FIRST: resolveProviders preserves key order into `selected`,
|
|
121
|
+
* and debate's moderator / coordinate's proposer default to `selected[0]`.
|
|
122
|
+
* Reordering this object silently moves those seats to another provider.
|
|
123
|
+
*/
|
|
124
|
+
declare const SUPER_MODELS: Readonly<Record<string, readonly string[]>>;
|
|
125
|
+
|
|
101
126
|
/**
|
|
102
127
|
* Embedded host entrypoint — the API Crosscheck Desktop runs panels through.
|
|
103
128
|
*
|
|
@@ -259,6 +284,14 @@ type EngineEvent =
|
|
|
259
284
|
/** How much of each model reply an activity event carries. Enough to read
|
|
260
285
|
* the back-and-forth; the full text is in the envelope. */
|
|
261
286
|
declare const ACTIVITY_TEXT_CAP = 8000;
|
|
287
|
+
/** Providers whose models can see images (vault ids). Everyone else is told
|
|
288
|
+
* an image exists that it can't see, rather than being sent one it would
|
|
289
|
+
* reject — or silently answering as if there were none. */
|
|
290
|
+
declare const VISION_PROVIDERS: readonly string[];
|
|
291
|
+
declare const MAX_RUN_IMAGES = 8;
|
|
292
|
+
/** Put the run's images on the newest user message — or, for a provider
|
|
293
|
+
* that can't see images, a plain note saying they exist. */
|
|
294
|
+
declare function withRunImages(args: SendArgs, provider: string, images: readonly ImagePart[] | undefined): SendArgs;
|
|
262
295
|
type EngineEventSink = (event: EngineEvent) => void;
|
|
263
296
|
interface EmbeddedEngineOptions {
|
|
264
297
|
/** Vault provider id → raw API key. Only providers present here are built.
|
|
@@ -267,6 +300,9 @@ interface EmbeddedEngineOptions {
|
|
|
267
300
|
/** Vault provider id → pinned model. Omit a provider to take the engine
|
|
268
301
|
* default. Mirrors what `/account/models` and `crosscheck models set` do. */
|
|
269
302
|
models?: Readonly<Record<string, string>>;
|
|
303
|
+
/** Vault provider id → pinned SUPER-tier model (what `confer super` uses).
|
|
304
|
+
* Omit a provider to take the engine's super lineup (SUPER_MODELS). */
|
|
305
|
+
superModels?: Readonly<Record<string, string>>;
|
|
270
306
|
/** Default moderator/synthesis provider. */
|
|
271
307
|
moderator?: string;
|
|
272
308
|
/** Explicit pricing.json path. Defaults to the copy bundled in `dist/`. */
|
|
@@ -278,6 +314,10 @@ interface RunOptions {
|
|
|
278
314
|
/** Stop waiting on any single model call after this long (ms). The run
|
|
279
315
|
* continues with the answers already in. Off when 0/undefined. */
|
|
280
316
|
callTimeoutMs?: number;
|
|
317
|
+
/** Images for this run (base64, png/jpeg/webp/gif; at most 8). Sent with
|
|
318
|
+
* the question to every provider that can see images; the others are
|
|
319
|
+
* told they exist. Embed-only — the MCP tools don't take images. */
|
|
320
|
+
images?: ImagePart[];
|
|
281
321
|
}
|
|
282
322
|
interface AskOptions {
|
|
283
323
|
/** Vault id ("grok", not "xai"). Must be a provider this engine built. */
|
|
@@ -351,4 +391,4 @@ declare const __test_internals: {
|
|
|
351
391
|
vaultId: typeof vaultId;
|
|
352
392
|
};
|
|
353
393
|
|
|
354
|
-
export { ACTIVITY_TEXT_CAP, type AskOptions, type AskResult, DEFAULT_EXCLUDED_PROVIDERS, DEFAULT_FALLBACKS, DEFAULT_MODELS, type EmbeddedEngine, type EmbeddedEngineOptions, type EngineEvent, type EngineEventSink, type EventUsage, type ProcRecord, type ProcStatus, type RunOptions, KEY_ENV as __KEY_ENV, MODEL_ENV as __MODEL_ENV, __test_internals, createEmbeddedEngine, isAlive, listProcesses, processRegistryPath };
|
|
394
|
+
export { ACTIVITY_TEXT_CAP, type AskOptions, type AskResult, DEFAULT_EXCLUDED_PROVIDERS, DEFAULT_FALLBACKS, DEFAULT_MODELS, type EmbeddedEngine, type EmbeddedEngineOptions, type EngineEvent, type EngineEventSink, type EventUsage, ImagePart, MAX_RUN_IMAGES, type ProcRecord, type ProcStatus, type RunOptions, SUPER_MODELS, VISION_PROVIDERS, KEY_ENV as __KEY_ENV, MODEL_ENV as __MODEL_ENV, __test_internals, createEmbeddedEngine, isAlive, listProcesses, processRegistryPath, withRunImages };
|
package/dist/embed.js
CHANGED
|
@@ -7,7 +7,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
// src/entrypoints/embed.ts
|
|
10
|
-
import { AsyncLocalStorage as
|
|
10
|
+
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
11
11
|
import { existsSync as existsSync11 } from "fs";
|
|
12
12
|
import path12 from "path";
|
|
13
13
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
@@ -179,6 +179,11 @@ function reasoningSharesOutputBudget(provider) {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
// src/providers/types.ts
|
|
182
|
+
var IMAGE_MEDIA_TYPES = ["image/png", "image/jpeg", "image/webp", "image/gif"];
|
|
183
|
+
function imagesOf(m) {
|
|
184
|
+
if (m.role !== "user" || !Array.isArray(m.images)) return [];
|
|
185
|
+
return m.images.filter((i) => Boolean(i) && typeof i.data === "string" && i.data.length > 0 && IMAGE_MEDIA_TYPES.includes(i.mediaType));
|
|
186
|
+
}
|
|
182
187
|
var ProviderError = class extends Error {
|
|
183
188
|
name = "ProviderError";
|
|
184
189
|
kind;
|
|
@@ -567,7 +572,12 @@ function buildAnthropicRequest(opts) {
|
|
|
567
572
|
}
|
|
568
573
|
continue;
|
|
569
574
|
}
|
|
570
|
-
|
|
575
|
+
const text = typeof m.content === "string" ? m.content : "";
|
|
576
|
+
const images = imagesOf(m);
|
|
577
|
+
convo.push(images.length ? { role: m.role, content: [
|
|
578
|
+
...images.map((i) => ({ type: "image", source: { type: "base64", media_type: i.mediaType, data: i.data } })),
|
|
579
|
+
{ type: "text", text }
|
|
580
|
+
] } : { role: m.role, content: text });
|
|
571
581
|
}
|
|
572
582
|
const body = {
|
|
573
583
|
model: opts.model,
|
|
@@ -807,7 +817,10 @@ function buildGeminiRequest(opts) {
|
|
|
807
817
|
const role = m.role === "user" ? "user" : "model";
|
|
808
818
|
contents.push({
|
|
809
819
|
role,
|
|
810
|
-
parts: [
|
|
820
|
+
parts: [
|
|
821
|
+
...imagesOf(m).map((i) => ({ inline_data: { mime_type: i.mediaType, data: i.data } })),
|
|
822
|
+
{ text: typeof m.content === "string" ? m.content : "" }
|
|
823
|
+
]
|
|
811
824
|
});
|
|
812
825
|
}
|
|
813
826
|
const body = {
|
|
@@ -975,10 +988,11 @@ function supportsNativeJsonSchema(provider, model) {
|
|
|
975
988
|
return true;
|
|
976
989
|
}
|
|
977
990
|
function buildOpenAICompatibleRequest(opts) {
|
|
978
|
-
const msgs = opts.messages.map((m) =>
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
991
|
+
const msgs = opts.messages.map((m) => {
|
|
992
|
+
const text = typeof m.content === "string" ? m.content : "";
|
|
993
|
+
const images = imagesOf(m);
|
|
994
|
+
return images.length ? { role: m.role, content: [{ type: "text", text }, ...images.map((i) => ({ type: "image_url", image_url: { url: `data:${i.mediaType};base64,${i.data}` } }))] } : { role: m.role, content: text };
|
|
995
|
+
});
|
|
982
996
|
const body = {
|
|
983
997
|
model: opts.model,
|
|
984
998
|
messages: msgs
|
|
@@ -1291,7 +1305,7 @@ import { z } from "zod";
|
|
|
1291
1305
|
|
|
1292
1306
|
// src/server-meta.ts
|
|
1293
1307
|
var SERVER_NAME = "crosscheck-agent";
|
|
1294
|
-
var SERVER_VERSION = true ? "0.2.
|
|
1308
|
+
var SERVER_VERSION = true ? "0.2.30" : "0.0.0-dev";
|
|
1295
1309
|
|
|
1296
1310
|
// src/tools/audit.ts
|
|
1297
1311
|
import { readdirSync, readFileSync as readFileSync3, statSync } from "fs";
|
|
@@ -4255,6 +4269,7 @@ async function pickAutoPanel(storage, purpose, n, providers, allowlist) {
|
|
|
4255
4269
|
}
|
|
4256
4270
|
|
|
4257
4271
|
// src/core/super-mode.ts
|
|
4272
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
4258
4273
|
var SUPER_MODELS = {
|
|
4259
4274
|
// Fable 5.1 verified present on the account; 5 as the fallback for accounts
|
|
4260
4275
|
// that haven't been granted 5.1 yet.
|
|
@@ -4297,7 +4312,12 @@ function parseChain(v) {
|
|
|
4297
4312
|
}
|
|
4298
4313
|
return out;
|
|
4299
4314
|
}
|
|
4300
|
-
|
|
4315
|
+
var superEnvStore = new AsyncLocalStorage();
|
|
4316
|
+
function withSuperEnv(env, fn) {
|
|
4317
|
+
return superEnvStore.run(env, fn);
|
|
4318
|
+
}
|
|
4319
|
+
var currentEnv = () => superEnvStore.getStore() ?? process.env;
|
|
4320
|
+
function superChainFor(provider, env = currentEnv()) {
|
|
4301
4321
|
const varName = SUPER_ENV_VARS[provider];
|
|
4302
4322
|
const user = varName ? parseChain(env[varName]) : [];
|
|
4303
4323
|
if (user.length > 0) {
|
|
@@ -4306,14 +4326,14 @@ function superChainFor(provider, env = process.env) {
|
|
|
4306
4326
|
}
|
|
4307
4327
|
return SUPER_MODELS[provider] ?? [];
|
|
4308
4328
|
}
|
|
4309
|
-
function superPrimary(provider, env =
|
|
4329
|
+
function superPrimary(provider, env = currentEnv()) {
|
|
4310
4330
|
return superChainFor(provider, env)[0];
|
|
4311
4331
|
}
|
|
4312
4332
|
var SUPER_PROVIDER_NAMES = Object.keys(SUPER_MODELS);
|
|
4313
4333
|
function isSuperRequested(args) {
|
|
4314
4334
|
return args["super"] === true;
|
|
4315
4335
|
}
|
|
4316
|
-
function retargetForSuper(p, env =
|
|
4336
|
+
function retargetForSuper(p, env = currentEnv()) {
|
|
4317
4337
|
const chain = superChainFor(p.name, env);
|
|
4318
4338
|
if (chain.length === 0) return p;
|
|
4319
4339
|
const [primary, ...fallbacks] = chain;
|
|
@@ -6391,9 +6411,9 @@ import path6 from "path";
|
|
|
6391
6411
|
import { performance as performance7 } from "perf_hooks";
|
|
6392
6412
|
|
|
6393
6413
|
// src/core/progress.ts
|
|
6394
|
-
import { AsyncLocalStorage } from "async_hooks";
|
|
6414
|
+
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
6395
6415
|
import { performance as performance6 } from "perf_hooks";
|
|
6396
|
-
var progressStorage = new
|
|
6416
|
+
var progressStorage = new AsyncLocalStorage2();
|
|
6397
6417
|
async function withProgress(token, sendNotification, fn) {
|
|
6398
6418
|
if (token === void 0 || token === null) {
|
|
6399
6419
|
return fn();
|
|
@@ -11674,7 +11694,7 @@ var CHECK_INTERVAL_SECONDS = 3 * 24 * 60 * 60;
|
|
|
11674
11694
|
var DEFAULT_PACKAGE = "crosscheck-cli";
|
|
11675
11695
|
var FETCH_TIMEOUT_MS = 3e3;
|
|
11676
11696
|
function engineVersion() {
|
|
11677
|
-
return true ? "0.2.
|
|
11697
|
+
return true ? "0.2.30" : "0.0.0-dev";
|
|
11678
11698
|
}
|
|
11679
11699
|
function defaultUpdateCachePath() {
|
|
11680
11700
|
const base = process.env["CROSSCHECK_DATA_DIR"] || path9.join(os.homedir() || os.tmpdir(), ".crosscheck");
|
|
@@ -13467,7 +13487,33 @@ function vaultId(engineName) {
|
|
|
13467
13487
|
}
|
|
13468
13488
|
var ACTIVITY_TEXT_CAP = 8e3;
|
|
13469
13489
|
var ASKED_CAP = 280;
|
|
13470
|
-
var
|
|
13490
|
+
var VISION_PROVIDERS = ["anthropic", "openai", "gemini", "grok"];
|
|
13491
|
+
var NO_IMAGE_PURPOSES = /* @__PURE__ */ new Set(["early_stop", "extract", "canary", "classify"]);
|
|
13492
|
+
var MAX_RUN_IMAGES = 8;
|
|
13493
|
+
function withRunImages(args, provider, images) {
|
|
13494
|
+
if (!images?.length || NO_IMAGE_PURPOSES.has(args.purpose ?? "")) return args;
|
|
13495
|
+
const msgs = [...args.messages];
|
|
13496
|
+
let idx = -1;
|
|
13497
|
+
for (let i = msgs.length - 1; i >= 0; i--) if (msgs[i]?.role === "user") {
|
|
13498
|
+
idx = i;
|
|
13499
|
+
break;
|
|
13500
|
+
}
|
|
13501
|
+
if (idx < 0) return args;
|
|
13502
|
+
const m = msgs[idx];
|
|
13503
|
+
if (VISION_PROVIDERS.includes(provider)) {
|
|
13504
|
+
msgs[idx] = { ...m, images: [...m.images ?? [], ...images] };
|
|
13505
|
+
} else {
|
|
13506
|
+
const n = images.length;
|
|
13507
|
+
msgs[idx] = {
|
|
13508
|
+
...m,
|
|
13509
|
+
content: `${m.content}
|
|
13510
|
+
|
|
13511
|
+
[The user also attached ${n} image${n === 1 ? "" : "s"} that this model can't see. Don't guess at ${n === 1 ? "its" : "their"} contents \u2014 work from the text, and say so if the answer depends on ${n === 1 ? "it" : "them"}.]`
|
|
13512
|
+
};
|
|
13513
|
+
}
|
|
13514
|
+
return { ...args, messages: msgs };
|
|
13515
|
+
}
|
|
13516
|
+
var runContext = new AsyncLocalStorage3();
|
|
13471
13517
|
var SYNTHESIS_PURPOSES = /* @__PURE__ */ new Set(["synth", "moderator", "recombine", "judge", "unify"]);
|
|
13472
13518
|
function exemptFromSkip(ctx, provider, purpose) {
|
|
13473
13519
|
return provider === ctx.moderator && SYNTHESIS_PURPOSES.has(purpose);
|
|
@@ -13522,7 +13568,7 @@ function withActivity(p) {
|
|
|
13522
13568
|
if (!stopped && controller.signal.reason === "skip") stopped = "user";
|
|
13523
13569
|
}, { once: true });
|
|
13524
13570
|
try {
|
|
13525
|
-
const res = await send({ ...args, signal: controller.signal });
|
|
13571
|
+
const res = await send({ ...withRunImages(args, provider, ctx.images), signal: controller.signal });
|
|
13526
13572
|
const text = typeof res.text === "string" ? res.text : "";
|
|
13527
13573
|
ctx.emit({
|
|
13528
13574
|
type: "call.done",
|
|
@@ -13617,6 +13663,12 @@ function createEmbeddedEngine(opts) {
|
|
|
13617
13663
|
const varName = MODEL_ENV[provider.trim().toLowerCase()];
|
|
13618
13664
|
if (varName && model) env[varName] = model;
|
|
13619
13665
|
}
|
|
13666
|
+
const superEnv = {};
|
|
13667
|
+
for (const [provider, model] of Object.entries(opts.superModels ?? {})) {
|
|
13668
|
+
const p = provider.trim().toLowerCase();
|
|
13669
|
+
const varName = SUPER_ENV_VARS[p === "grok" ? "xai" : p];
|
|
13670
|
+
if (varName && model) superEnv[varName] = model;
|
|
13671
|
+
}
|
|
13620
13672
|
const pricingPath = [opts.pricingPath, bundledPricingPath()].find(
|
|
13621
13673
|
(p) => Boolean(p) && existsSync11(p)
|
|
13622
13674
|
);
|
|
@@ -13657,13 +13709,14 @@ function createEmbeddedEngine(opts) {
|
|
|
13657
13709
|
skipped: /* @__PURE__ */ new Set(),
|
|
13658
13710
|
inflight: /* @__PURE__ */ new Map(),
|
|
13659
13711
|
moderator: vaultId(moderator),
|
|
13660
|
-
...runOpts.callTimeoutMs && runOpts.callTimeoutMs > 0 ? { callTimeoutMs: runOpts.callTimeoutMs } : {}
|
|
13712
|
+
...runOpts.callTimeoutMs && runOpts.callTimeoutMs > 0 ? { callTimeoutMs: runOpts.callTimeoutMs } : {},
|
|
13713
|
+
...runOpts.images?.length ? { images: runOpts.images.filter((i) => IMAGE_MEDIA_TYPES.includes(i.mediaType) && typeof i.data === "string" && i.data.length > 0).slice(0, MAX_RUN_IMAGES) } : {}
|
|
13661
13714
|
};
|
|
13662
13715
|
liveRuns.set(runId, ctx);
|
|
13663
13716
|
try {
|
|
13664
13717
|
return await runContext.run(ctx, () => withProgress(runId, (n) => {
|
|
13665
13718
|
if (n.params.message) emit({ type: "progress", runId, at: Date.now(), message: n.params.message });
|
|
13666
|
-
}, () => runInner(name, args, runId, started, emit)));
|
|
13719
|
+
}, () => withSuperEnv(superEnv, () => runInner(name, args, runId, started, emit))));
|
|
13667
13720
|
} finally {
|
|
13668
13721
|
liveRuns.delete(runId);
|
|
13669
13722
|
}
|
|
@@ -13821,12 +13874,17 @@ export {
|
|
|
13821
13874
|
DEFAULT_EXCLUDED_PROVIDERS,
|
|
13822
13875
|
DEFAULT_FALLBACKS,
|
|
13823
13876
|
DEFAULT_MODELS,
|
|
13877
|
+
IMAGE_MEDIA_TYPES,
|
|
13878
|
+
MAX_RUN_IMAGES,
|
|
13879
|
+
SUPER_MODELS,
|
|
13880
|
+
VISION_PROVIDERS,
|
|
13824
13881
|
KEY_ENV as __KEY_ENV,
|
|
13825
13882
|
MODEL_ENV as __MODEL_ENV,
|
|
13826
13883
|
__test_internals,
|
|
13827
13884
|
createEmbeddedEngine,
|
|
13828
13885
|
isAlive,
|
|
13829
13886
|
listProcesses,
|
|
13830
|
-
processRegistryPath
|
|
13887
|
+
processRegistryPath,
|
|
13888
|
+
withRunImages
|
|
13831
13889
|
};
|
|
13832
13890
|
//# sourceMappingURL=embed.js.map
|