mindweave 2.5.0 → 2.5.1
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 +145 -145
- package/dist/cli/App.js +1 -1
- package/dist/cli/App.js.map +1 -1
- package/dist/core/turnRunner.js +366 -0
- package/dist/core/turnRunner.js.map +1 -0
- package/dist/drivers/anthropic/client.js +77 -21
- package/dist/drivers/anthropic/client.js.map +1 -1
- package/dist/drivers/anthropic/manifest.js +28 -11
- package/dist/drivers/anthropic/manifest.js.map +1 -1
- package/dist/drivers/cerebras/manifest.js +7 -1
- package/dist/drivers/cerebras/manifest.js.map +1 -1
- package/dist/drivers/deepseek/manifest.js +12 -31
- package/dist/drivers/deepseek/manifest.js.map +1 -1
- package/dist/drivers/glm/manifest.js +18 -5
- package/dist/drivers/glm/manifest.js.map +1 -1
- package/dist/drivers/kimi/manifest.js +13 -10
- package/dist/drivers/kimi/manifest.js.map +1 -1
- package/dist/drivers/meta/manifest.js +21 -16
- package/dist/drivers/meta/manifest.js.map +1 -1
- package/dist/drivers/minimax/manifest.js +15 -12
- package/dist/drivers/minimax/manifest.js.map +1 -1
- package/dist/drivers/openai/manifest.js +24 -7
- package/dist/drivers/openai/manifest.js.map +1 -1
- package/dist/drivers/qwen/manifest.js +19 -6
- package/dist/drivers/qwen/manifest.js.map +1 -1
- package/dist/drivers/xai/client.js +12 -10
- package/dist/drivers/xai/client.js.map +1 -1
- package/dist/drivers/xai/manifest.js +62 -25
- package/dist/drivers/xai/manifest.js.map +1 -1
- package/dist/dynamo/engine.js +27 -0
- package/dist/dynamo/engine.js.map +1 -1
- package/dist/memory/compaction.js +1 -1
- package/dist/memory/compaction.js.map +1 -1
- package/dist/tools/detail.js +9 -6
- package/dist/tools/detail.js.map +1 -1
- package/dist/tools/edit.js +2 -1
- package/dist/tools/edit.js.map +1 -1
- package/dist/tools/replaceSymbol.js +2 -1
- package/dist/tools/replaceSymbol.js.map +1 -1
- package/dist/tools/runCommand.js +6 -3
- package/dist/tools/runCommand.js.map +1 -1
- package/dist/tools/writeFile.js +2 -1
- package/dist/tools/writeFile.js.map +1 -1
- package/package.json +5 -2
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export const ASTRA = "gpt-6-astra";
|
|
2
|
+
export const SOL_6 = "gpt-6-sol";
|
|
3
|
+
export const LUNA_6 = "gpt-6-luna";
|
|
2
4
|
export const SOL = "gpt-5.6-sol";
|
|
3
5
|
export const TERRA = "gpt-5.6-terra";
|
|
4
6
|
export const LUNA = "gpt-5.6-luna";
|
|
@@ -13,7 +15,9 @@ export const DEFAULT_MODEL = TERRA;
|
|
|
13
15
|
*/
|
|
14
16
|
export const MODELS = [
|
|
15
17
|
{ id: TERRA, label: "GPT-5.6 Terra", description: "balanced intelligence and cost — the default" },
|
|
16
|
-
{ id: ASTRA, label: "GPT-6 Astra", description: "the
|
|
18
|
+
{ id: ASTRA, label: "GPT-6 Astra", description: "the GPT-6 flagship — the most capable, and the priciest" },
|
|
19
|
+
{ id: SOL_6, label: "GPT-6 Sol", description: "GPT-6 at Terra's input rate, with cheaper output" },
|
|
20
|
+
{ id: LUNA_6, label: "GPT-6 Luna", description: "the cheapest GPT-6, for high-volume work" },
|
|
17
21
|
{ id: SOL, label: "GPT-5.6 Sol", description: "the GPT-5.6 frontier tier" },
|
|
18
22
|
{ id: LUNA, label: "GPT-5.6 Luna", description: "cheap and quick, for high-volume work" },
|
|
19
23
|
];
|
|
@@ -23,7 +27,7 @@ export const MODELS = [
|
|
|
23
27
|
* OpenAI expresses reasoning as a single `effort` rung with `none` as its off
|
|
24
28
|
* switch, rather than a separate on/off flag plus a budget. That maps onto the
|
|
25
29
|
* shared shape cleanly: `thinking: false` becomes `none` on the wire, and the four
|
|
26
|
-
* thinking rungs are sent as themselves.
|
|
30
|
+
* thinking rungs are sent as themselves. Every model here takes the same ladder.
|
|
27
31
|
*
|
|
28
32
|
* The provider also accepts `minimal` between `none` and `low`. It is not offered:
|
|
29
33
|
* it would be a fifth rung whose difference from `low` no user could predict, and
|
|
@@ -38,12 +42,25 @@ export function thinkLevels(_model) {
|
|
|
38
42
|
];
|
|
39
43
|
}
|
|
40
44
|
/**
|
|
41
|
-
* List prices (USD / 1M tokens)
|
|
42
|
-
*
|
|
45
|
+
* List prices (USD / 1M tokens), short-context tier (this manifest does not model
|
|
46
|
+
* OpenAI's separate long-context pricing above ~200K input — see `contextWindow`,
|
|
47
|
+
* which caps the usable window below that tier anyway). Cached input bills at a
|
|
48
|
+
* tenth of fresh input, which is what keeps a re-sent conversation cheap.
|
|
49
|
+
*
|
|
50
|
+
* Sol is running promotional pricing — $4 / $20 rather than its $5 / $30 (2.5x
|
|
51
|
+
* Terra) list price — "available at least through November 21, 2026"
|
|
52
|
+
* (developers.openai.com/api/docs/pricing, checked 2026-09-20). Recorded as the
|
|
53
|
+
* plain current price rather than branched on the date, same call the Gemini
|
|
54
|
+
* manifest makes for its own promo: a fixed expiry with no announced successor
|
|
55
|
+
* price belongs in a review before that date, not a guess baked in now.
|
|
43
56
|
*/
|
|
44
57
|
const PRICES = {
|
|
45
58
|
[ASTRA]: { cacheHit: 1, cacheMiss: 10, output: 50 },
|
|
46
|
-
|
|
59
|
+
// GPT-6 Sol and Luna: list prices, no promotion (developers.openai.com/api/docs/pricing,
|
|
60
|
+
// checked 2026-09-23).
|
|
61
|
+
[SOL_6]: { cacheHit: 0.2, cacheMiss: 2, output: 10 },
|
|
62
|
+
[LUNA_6]: { cacheHit: 0.01, cacheMiss: 0.1, output: 0.5 },
|
|
63
|
+
[SOL]: { cacheHit: 0.4, cacheMiss: 4, output: 20 },
|
|
47
64
|
[TERRA]: { cacheHit: 0.2, cacheMiss: 2, output: 12 },
|
|
48
65
|
[LUNA]: { cacheHit: 0.02, cacheMiss: 0.2, output: 1.2 },
|
|
49
66
|
};
|
|
@@ -52,7 +69,7 @@ export function price(model) {
|
|
|
52
69
|
return PRICES[model] ?? PRICES[DEFAULT_MODEL];
|
|
53
70
|
}
|
|
54
71
|
/**
|
|
55
|
-
* The model's USABLE context window.
|
|
72
|
+
* The model's USABLE context window. Every model here STORES 1.05M tokens (922K of it
|
|
56
73
|
* input), but this is deliberately the sharp window rather than the storage cap:
|
|
57
74
|
* on BYOK every token in the window is the user's money on every turn, so
|
|
58
75
|
* anchoring compaction at 1M would mean carrying an enormous prompt long after it
|
|
@@ -64,7 +81,7 @@ export function contextWindow(_model) {
|
|
|
64
81
|
/**
|
|
65
82
|
* The ceiling this driver puts on a single BUFFERED (non-streaming) call.
|
|
66
83
|
*
|
|
67
|
-
*
|
|
84
|
+
* Every model here accepts 128K output, but a non-streaming request that runs that
|
|
68
85
|
* long risks an HTTP timeout, so the buffered path — core's small internal calls,
|
|
69
86
|
* like a compaction summary — is capped far lower. `client.ts` sends this value and
|
|
70
87
|
* `dynamo/contextWindow.ts` reserves it; one exported constant means the request
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/drivers/openai/manifest.ts"],"names":[],"mappings":"AAqBA,MAAM,CAAC,MAAM,KAAK,GAAG,aAAa,CAAC;AACnC,MAAM,CAAC,MAAM,GAAG,GAAG,aAAa,CAAC;AACjC,MAAM,CAAC,MAAM,KAAK,GAAG,eAAe,CAAC;AACrC,MAAM,CAAC,MAAM,IAAI,GAAG,cAAc,CAAC;AAEnC,uEAAuE;AACvE,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAkB;IACnC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,8CAA8C,EAAE;IAClG,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/drivers/openai/manifest.ts"],"names":[],"mappings":"AAqBA,MAAM,CAAC,MAAM,KAAK,G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CAAC;IAE5D,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,IAAI,IAAI,GAAG,OAAO,CAAC,CAAC,CAAE,CAAC;IACvB,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;QACzD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;QAC5D,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,KAAK,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;YAC/F,IAAI,GAAG,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC;AACrB,CAAC;AAED,iFAAiF;AACjF,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,EAAE,EAAE,QAAQ;IACZ,KAAK,EAAE,QAAQ;IACf,SAAS,EAAE,gBAAgB;IAC3B,OAAO,EAAE,sCAAsC;IAC/C,MAAM,EAAE,MAAM;IACd,WAAW;IACX,KAAK;IACL,aAAa;IACb,oBAAoB;IACpB,aAAa;IACb,SAAS;CACV,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const MAX_38 = "qwen3.8-max";
|
|
2
2
|
export const MAX_37 = "qwen3.7-max";
|
|
3
3
|
export const PLUS = "qwen3.7-plus";
|
|
4
|
+
export const FLASH_38 = "qwen3.8-flash";
|
|
4
5
|
export const FLASH = "qwen3.5-flash";
|
|
5
6
|
/** The model used when nothing is saved and no env override is set. */
|
|
6
7
|
export const DEFAULT_MODEL = PLUS;
|
|
@@ -10,14 +11,15 @@ export const DEFAULT_MODEL = PLUS;
|
|
|
10
11
|
*
|
|
11
12
|
* Plus leads rather than Max: it is roughly a sixth of Max's rate and carries the
|
|
12
13
|
* same 1M window, so it is the one that is rarely the wrong answer for ordinary
|
|
13
|
-
* work.
|
|
14
|
-
*
|
|
14
|
+
* work. The older Max stays listed because it has not been withdrawn, but it now
|
|
15
|
+
* costs MORE than 3.8 Max, and its description says so rather than implying a saving.
|
|
15
16
|
*/
|
|
16
17
|
export const MODELS = [
|
|
17
18
|
{ id: PLUS, label: "Qwen3.7 Plus", description: "balanced and cheap to run — the default" },
|
|
18
19
|
{ id: MAX_38, label: "Qwen3.8 Max", description: "the flagship, for the hardest work" },
|
|
19
|
-
{ id: MAX_37, label: "Qwen3.7 Max", description: "the previous flagship
|
|
20
|
-
{ id:
|
|
20
|
+
{ id: MAX_37, label: "Qwen3.7 Max", description: "the previous flagship — pricier than 3.8 Max" },
|
|
21
|
+
{ id: FLASH_38, label: "Qwen3.8 Flash", description: "the newest Flash — fast and cheap" },
|
|
22
|
+
{ id: FLASH, label: "Qwen3.5 Flash", description: "the previous Flash, cheaper still" },
|
|
21
23
|
];
|
|
22
24
|
/**
|
|
23
25
|
* The reasoning levels offered by `/think`.
|
|
@@ -50,11 +52,22 @@ export function thinkLevels(_model) {
|
|
|
50
52
|
* one these figures come from. This driver targets international, so these are
|
|
51
53
|
* the rates that apply to it.
|
|
52
54
|
*/
|
|
55
|
+
/*
|
|
56
|
+
* Checked against Alibaba's International price table 2026-09-23 (alibabacloud.com,
|
|
57
|
+
* model-studio/model-pricing). Implicit cache hits bill at 20% of input EXCEPT on the
|
|
58
|
+
* Qwen3.8 models, which Alibaba lists as exceptions priced in its console; their cache
|
|
59
|
+
* figures are the rates OpenRouter's live listing carries for the same models.
|
|
60
|
+
*
|
|
61
|
+
* 3.7 Max and 3.5 Flash used to sit at half and about two thirds of their real price
|
|
62
|
+
* here, so every session on them reported well under what it cost.
|
|
63
|
+
*/
|
|
53
64
|
const PRICES = {
|
|
54
65
|
[MAX_38]: { cacheHit: 0.25, cacheMiss: 2, output: 6 },
|
|
55
|
-
[MAX_37]: { cacheHit: 0.
|
|
66
|
+
[MAX_37]: { cacheHit: 0.5, cacheMiss: 2.5, output: 7.5 },
|
|
67
|
+
// Limited-time 20% off the $0.40 / $1.60 list price.
|
|
56
68
|
[PLUS]: { cacheHit: 0.064, cacheMiss: 0.32, output: 1.28 },
|
|
57
|
-
[
|
|
69
|
+
[FLASH_38]: { cacheHit: 0.016, cacheMiss: 0.15, output: 0.47 },
|
|
70
|
+
[FLASH]: { cacheHit: 0.02, cacheMiss: 0.1, output: 0.4 },
|
|
58
71
|
};
|
|
59
72
|
/** Cache-aware list price for a model, falling back to the default model's. */
|
|
60
73
|
export function price(model) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/drivers/qwen/manifest.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,MAAM,MAAM,GAAG,aAAa,CAAC;AACpC,MAAM,CAAC,MAAM,MAAM,GAAG,aAAa,CAAC;AACpC,MAAM,CAAC,MAAM,IAAI,GAAG,cAAc,CAAC;AACnC,MAAM,CAAC,MAAM,KAAK,GAAG,eAAe,CAAC;AAErC,uEAAuE;AACvE,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC;AAElC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,MAAM,GAAkB;IACnC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,yCAAyC,EAAE;IAC3F,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,oCAAoC,EAAE;IACvF,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/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CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;QACzD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;QAC5D,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,KAAK,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;YAC/F,IAAI,GAAG,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC;AACrB,CAAC;AAED,iFAAiF;AACjF,MAAM,CAAC,MAAM,YAAY,GAAmB;IAC1C,EAAE,EAAE,MAAM;IACV,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,mBAAmB;IAC9B,OAAO,EAAE,uEAAuE;IAChF,MAAM,EAAE,MAAM;IACd,WAAW;IACX,KAAK;IACL,aAAa;IACb,oBAAoB;IACpB,SAAS;CACV,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { compatStreamTurn, compatToolTurn } from "../openaiCompat/wire.js";
|
|
2
|
-
import { BUFFERED_OUTPUT_TOKENS, DEFAULT_MODEL, takesEffort } from "./manifest.js";
|
|
2
|
+
import { ALWAYS_ON_DEFAULT, BUFFERED_OUTPUT_TOKENS, DEFAULT_MODEL, canDisableReasoning, takesEffort } from "./manifest.js";
|
|
3
3
|
const BASE_URL = process.env.MINDWEAVE_XAI_URL ?? "https://api.x.ai/v1";
|
|
4
4
|
/** The model a request runs on, matching the shared layer's own fallback so the
|
|
5
5
|
* reasoning fields can never be built for a different model than is being called. */
|
|
@@ -9,18 +9,20 @@ function modelOf(config) {
|
|
|
9
9
|
/**
|
|
10
10
|
* xAI's reasoning fields.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* absent field is genuinely absent rather than a hidden bill. Stated because the
|
|
18
|
-
* opposite is true of three other drivers here, and the reflex by now is to send it.
|
|
12
|
+
* Two shapes, one per kind of model (see the manifest). Grok 4.3 can be switched
|
|
13
|
+
* off, so it is sent `none` when thinking is off. Grok 4.5-4.7 always reason and do
|
|
14
|
+
* not accept `none`: they are sent the depth, and never an off switch. `normalize`
|
|
15
|
+
* has already put a legal rung in the config; the fallback here is xAI's own default,
|
|
16
|
+
* so an unnormalized config cannot send anything the model would not have run anyway.
|
|
19
17
|
*/
|
|
20
18
|
export function reasoningFields(config) {
|
|
21
|
-
|
|
19
|
+
const model = modelOf(config);
|
|
20
|
+
if (!takesEffort(model))
|
|
22
21
|
return {};
|
|
23
|
-
|
|
22
|
+
if (canDisableReasoning(model)) {
|
|
23
|
+
return { reasoning_effort: config?.thinking ? (config.effort ?? "low") : "none" };
|
|
24
|
+
}
|
|
25
|
+
return { reasoning_effort: config?.thinking ? (config.effort ?? ALWAYS_ON_DEFAULT) : ALWAYS_ON_DEFAULT };
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
26
28
|
* `end_turn` is xAI's own spelling of a normal finish, alongside the standard
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/drivers/xai/client.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAuB,MAAM,yBAAyB,CAAC;AAChG,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/drivers/xai/client.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAuB,MAAM,yBAAyB,CAAC;AAChG,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,aAAa,EAAE,mBA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,SAAS,CAAC;IAChC,MAAM,MAAM,GAAG,OAAO,KAAK,CAAC,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IACjF,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,EAAE,CAAC;AAClD,CAAC;AAED,6DAA6D;AAC7D,MAAM,CAAC,MAAM,WAAW,GAAmB;IACzC,KAAK,EAAE,KAAK;IACZ,OAAO,EAAE,QAAQ;IACjB,SAAS,EAAE,aAAa;IACxB,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,aAAa;IAC1D,eAAe;IACf,SAAS;IACT,UAAU;IACV,iBAAiB,EAAE,sBAAsB;CAC1C,CAAC;AAEF,kCAAkC;AAClC,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,GAAiB,EAAE,UAAuB,EAAE;IACzE,OAAO,cAAc,CAAC,WAAW,EAAE,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AAC1D,CAAC;AAED,yEAAyE;AACzE,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAiB,EAAE,UAAyB,EAAE;IAC7E,OAAO,gBAAgB,CAAC,WAAW,EAAE,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export const GROK_47 = "grok-4.7";
|
|
1
2
|
export const GROK_46 = "grok-4.6";
|
|
2
3
|
export const GROK_45 = "grok-4.5";
|
|
3
4
|
export const GROK_43 = "grok-4.3";
|
|
@@ -5,27 +6,35 @@ export const GROK_43 = "grok-4.3";
|
|
|
5
6
|
export const DEFAULT_MODEL = GROK_46;
|
|
6
7
|
/** The models offered by `/model`. First entry is this provider's default. */
|
|
7
8
|
export const MODELS = [
|
|
8
|
-
{ id: GROK_46, label: "Grok 4.6", description: "
|
|
9
|
+
{ id: GROK_46, label: "Grok 4.6", description: "strong at code — the default" },
|
|
10
|
+
{ id: GROK_47, label: "Grok 4.7", description: "the newest model, at the same rate as 4.6" },
|
|
9
11
|
{ id: GROK_45, label: "Grok 4.5", description: "the previous generation" },
|
|
10
12
|
{ id: GROK_43, label: "Grok 4.3", description: "the reasoning tier, with a 1M window" },
|
|
11
13
|
];
|
|
12
|
-
/** Whether a model takes the `reasoning_effort` dial.
|
|
14
|
+
/** Whether a model takes the `reasoning_effort` dial. Every model here does. */
|
|
13
15
|
export function takesEffort(model) {
|
|
16
|
+
return model === GROK_43 || model === GROK_45 || model === GROK_46 || model === GROK_47;
|
|
17
|
+
}
|
|
18
|
+
/** Whether reasoning can be switched off (`none`). Only Grok 4.3's can. */
|
|
19
|
+
export function canDisableReasoning(model) {
|
|
14
20
|
return model === GROK_43;
|
|
15
21
|
}
|
|
22
|
+
/** The depth xAI uses when none is sent, on the always-reasoning models. A saved config
|
|
23
|
+
* that never chose a depth lands here, so it keeps running exactly as it always has. */
|
|
24
|
+
export const ALWAYS_ON_DEFAULT = "high";
|
|
16
25
|
/**
|
|
17
26
|
* The reasoning levels offered by `/think`.
|
|
18
27
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* than a separate flag, the same shape OpenAI uses.
|
|
28
|
+
* Grok 4.3: `none` is the off switch rather than a separate flag, the same shape
|
|
29
|
+
* OpenAI uses, and the ladder above it stops at `high` here.
|
|
22
30
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
31
|
+
* Grok 4.5-4.7 always reason, so there is no "answer directly" level to offer — the
|
|
32
|
+
* choice is only how deep. Standard is xAI's own default depth, so picking nothing
|
|
33
|
+
* changes nothing. `xhigh` is offered on 4.6 and later only: 4.5 quietly treats it as
|
|
34
|
+
* `high`, and a level that does the same as another is not a choice.
|
|
26
35
|
*/
|
|
27
36
|
export function thinkLevels(model) {
|
|
28
|
-
if (
|
|
37
|
+
if (canDisableReasoning(model)) {
|
|
29
38
|
return [
|
|
30
39
|
{ label: "Standard", description: "answer directly — fastest", thinking: false, effort: "low" },
|
|
31
40
|
{ label: "Thinking", description: "think first, then answer", thinking: true, effort: "low" },
|
|
@@ -33,7 +42,15 @@ export function thinkLevels(model) {
|
|
|
33
42
|
{ label: "Maximum", description: "maximum reasoning budget", thinking: true, effort: "high" },
|
|
34
43
|
];
|
|
35
44
|
}
|
|
36
|
-
|
|
45
|
+
const levels = [
|
|
46
|
+
{ label: "Minimal", description: "always reasons — least, and quickest", thinking: true, effort: "low" },
|
|
47
|
+
{ label: "Light", description: "always reasons — lighter than the default", thinking: true, effort: "medium" },
|
|
48
|
+
{ label: "Standard", description: "always reasons — xAI's default depth", thinking: true, effort: ALWAYS_ON_DEFAULT },
|
|
49
|
+
];
|
|
50
|
+
if (model !== GROK_45) {
|
|
51
|
+
levels.push({ label: "Deep", description: "more reasoning, more tool work", thinking: true, effort: "xhigh" });
|
|
52
|
+
}
|
|
53
|
+
return levels;
|
|
37
54
|
}
|
|
38
55
|
/**
|
|
39
56
|
* List prices (USD / 1M tokens).
|
|
@@ -44,17 +61,17 @@ export function thinkLevels(model) {
|
|
|
44
61
|
* sessions, low for very long ones, which is also why `contextWindow` below sits
|
|
45
62
|
* where it does.
|
|
46
63
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
64
|
+
* Grok 4.6, 4.5 and 4.3 are confirmed against xAI's own pricing table (docs.x.ai/developers/pricing,
|
|
65
|
+
* checked 2026-09-20). Grok 4.5 and 4.3 had been carrying estimated figures that were
|
|
66
|
+
* both too high — 4.3's especially so, at roughly 2.4x its real input rate and 6x its
|
|
67
|
+
* real output rate.
|
|
51
68
|
*/
|
|
52
69
|
const PRICES = {
|
|
70
|
+
// Same rates as Grok 4.6 (docs.x.ai/developers/models, checked 2026-09-23).
|
|
71
|
+
[GROK_47]: { cacheHit: 0.5, cacheMiss: 2, output: 6 },
|
|
53
72
|
[GROK_46]: { cacheHit: 0.5, cacheMiss: 2, output: 6 },
|
|
54
|
-
|
|
55
|
-
[
|
|
56
|
-
// Estimated.
|
|
57
|
-
[GROK_43]: { cacheHit: 0.75, cacheMiss: 3, output: 15 },
|
|
73
|
+
[GROK_45]: { cacheHit: 0.3, cacheMiss: 2, output: 6 },
|
|
74
|
+
[GROK_43]: { cacheHit: 0.2, cacheMiss: 1.25, output: 2.5 },
|
|
58
75
|
};
|
|
59
76
|
/** Cache-aware list price for a model, falling back to the default model's. */
|
|
60
77
|
export function price(model) {
|
|
@@ -80,21 +97,39 @@ export function bufferedOutputTokens(_model) {
|
|
|
80
97
|
return BUFFERED_OUTPUT_TOKENS;
|
|
81
98
|
}
|
|
82
99
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
100
|
+
* Every Grok here reads images, on the Chat Completions endpoint this driver uses, as
|
|
101
|
+
* an `image_url` with a base64 data URL — the shape the shared wire already sends
|
|
102
|
+
* (docs.x.ai model pages and legacy/chat-completions, checked 2026-09-23).
|
|
85
103
|
*/
|
|
86
|
-
|
|
87
|
-
|
|
104
|
+
export function acceptsImages(_model) {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
/** JPG and PNG only (max 20 MiB) — narrower than the GIF and WebP core can also attach,
|
|
108
|
+
* so those are held back with a note the agent can pass on, not sent to fail. */
|
|
109
|
+
export function imageTypes(_model) {
|
|
110
|
+
return ["image/png", "image/jpeg"];
|
|
111
|
+
}
|
|
112
|
+
/** The effort rungs this provider accepts, weakest first. There is no `max`. */
|
|
113
|
+
const EFFORTS = ["low", "medium", "high", "xhigh"];
|
|
88
114
|
/**
|
|
89
115
|
* Coerce a stored or unknown config onto a model this provider actually serves.
|
|
90
116
|
*
|
|
91
117
|
* The result is snapped onto a rung `/think` lists, which is what keeps the request
|
|
92
|
-
* legal:
|
|
93
|
-
*
|
|
118
|
+
* legal: no model here takes `max`, and only 4.6 and later take `xhigh`, so a config
|
|
119
|
+
* carried in from another provider must not reach the wire as it came.
|
|
120
|
+
*
|
|
121
|
+
* On an always-reasoning model, a config with thinking OFF never chose a depth: it is
|
|
122
|
+
* either a pre-2.5.1 config from when these models had no dial, or one carried in from
|
|
123
|
+
* a provider's "answer directly" level. It maps to xAI's own default, so those sessions
|
|
124
|
+
* keep the depth they have always had, rather than quietly dropping to the lowest.
|
|
94
125
|
*/
|
|
95
126
|
export function normalize(config) {
|
|
96
127
|
const model = PRICES[config.model] ? config.model : DEFAULT_MODEL;
|
|
97
|
-
|
|
128
|
+
if (!canDisableReasoning(model)) {
|
|
129
|
+
const effort = config.thinking === true && EFFORTS.includes(config.effort) ? config.effort : ALWAYS_ON_DEFAULT;
|
|
130
|
+
return { model, thinking: true, effort: snapToOfferedRung(model, true, effort) };
|
|
131
|
+
}
|
|
132
|
+
const thinking = config.thinking === true;
|
|
98
133
|
const effort = EFFORTS.includes(config.effort) ? config.effort : "low";
|
|
99
134
|
return { model, thinking, effort: snapToOfferedRung(model, thinking, effort) };
|
|
100
135
|
}
|
|
@@ -132,6 +167,8 @@ export const xaiManifest = {
|
|
|
132
167
|
price,
|
|
133
168
|
contextWindow,
|
|
134
169
|
bufferedOutputTokens,
|
|
170
|
+
acceptsImages,
|
|
171
|
+
imageTypes,
|
|
135
172
|
normalize,
|
|
136
173
|
};
|
|
137
174
|
//# sourceMappingURL=manifest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/drivers/xai/manifest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/drivers/xai/manifest.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;AAClC,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;AAClC,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;AAClC,MAAM,CAAC,MA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AAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;QACxD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;QAC3D,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,KAAK,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;YAC7F,IAAI,GAAG,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC;AACrB,CAAC;AAED,iFAAiF;AACjF,MAAM,CAAC,MAAM,WAAW,GAAmB;IACzC,EAAE,EAAE,KAAK;IACT,KAAK,EAAE,KAAK;IACZ,SAAS,EAAE,aAAa;IACxB,OAAO,EAAE,uBAAuB;IAChC,MAAM,EAAE,MAAM;IACd,WAAW;IACX,KAAK;IACL,aAAa;IACb,oBAAoB;IACpB,aAAa;IACb,UAAU;IACV,SAAS;CACV,CAAC"}
|
package/dist/dynamo/engine.js
CHANGED
|
@@ -451,6 +451,12 @@ function workspaceText(session) {
|
|
|
451
451
|
function modelSeesImages(session) {
|
|
452
452
|
return manifestForModel(session.modelConfig.model).acceptsImages?.(session.modelConfig.model) ?? false;
|
|
453
453
|
}
|
|
454
|
+
/** "JPG and PNG" from `["image/png", "image/jpeg"]` — the names a user knows the files by. */
|
|
455
|
+
export function imageTypeNames(types) {
|
|
456
|
+
const names = types.map((t) => ({ "image/jpeg": "JPG", "image/png": "PNG", "image/gif": "GIF", "image/webp": "WebP" })[t] ?? t);
|
|
457
|
+
const sorted = [...new Set(names)].sort();
|
|
458
|
+
return sorted.length <= 1 ? (sorted[0] ?? "") : `${sorted.slice(0, -1).join(", ")} and ${sorted[sorted.length - 1]}`;
|
|
459
|
+
}
|
|
454
460
|
async function loadImagePayloads(session) {
|
|
455
461
|
// Nothing to load for a model that cannot look at one. This is the /provider switch
|
|
456
462
|
// case: a picture attached while a vision model was running stays in the transcript,
|
|
@@ -480,6 +486,11 @@ function buildRequest(session, tools, imagePayloads = new Map(),
|
|
|
480
486
|
/** Notes for the folders in play, resolved by the caller (it has to read disk). */
|
|
481
487
|
directoryNotes = []) {
|
|
482
488
|
const canSeeImages = modelSeesImages(session);
|
|
489
|
+
// The formats it takes, when narrower than everything core attaches. A manifest fact,
|
|
490
|
+
// like vision itself; absent means every type.
|
|
491
|
+
const imageTypes = canSeeImages
|
|
492
|
+
? manifestForModel(session.modelConfig.model).imageTypes?.(session.modelConfig.model)
|
|
493
|
+
: undefined;
|
|
483
494
|
const messages = [];
|
|
484
495
|
for (const e of session.transcript) {
|
|
485
496
|
if (e.role === "user" || e.role === "summary") {
|
|
@@ -496,6 +507,7 @@ directoryNotes = []) {
|
|
|
496
507
|
const images = [];
|
|
497
508
|
const missing = [];
|
|
498
509
|
const unseen = [];
|
|
510
|
+
const wrongType = [];
|
|
499
511
|
for (const ref of refs) {
|
|
500
512
|
// Told, never silently dropped. A message that mentions a screenshot and
|
|
501
513
|
// carries nothing reads to the model as a picture it failed to notice; the
|
|
@@ -504,6 +516,12 @@ directoryNotes = []) {
|
|
|
504
516
|
unseen.push(basename(ref.path));
|
|
505
517
|
continue;
|
|
506
518
|
}
|
|
519
|
+
// A format the provider would reject: held back the same way, so the model
|
|
520
|
+
// can tell the user which formats work instead of the whole request failing.
|
|
521
|
+
if (imageTypes && !imageTypes.includes(ref.mediaType)) {
|
|
522
|
+
wrongType.push(basename(ref.path));
|
|
523
|
+
continue;
|
|
524
|
+
}
|
|
507
525
|
const data = imagePayloads.get(ref.path);
|
|
508
526
|
if (data)
|
|
509
527
|
images.push({ path: ref.path, mediaType: ref.mediaType, data });
|
|
@@ -514,6 +532,13 @@ directoryNotes = []) {
|
|
|
514
532
|
...(unseen.length > 0
|
|
515
533
|
? [`${unseen.join(", ")} was attached, but the model now running cannot see images`]
|
|
516
534
|
: []),
|
|
535
|
+
...(wrongType.length > 0 && imageTypes
|
|
536
|
+
? [
|
|
537
|
+
`${wrongType.join(", ")} was attached but not sent: the model now running ` +
|
|
538
|
+
`accepts only ${imageTypeNames(imageTypes)} images, so tell the user to ` +
|
|
539
|
+
`convert it or switch models`,
|
|
540
|
+
]
|
|
541
|
+
: []),
|
|
517
542
|
...(missing.length > 0 ? [`${missing.join(", ")} could not be read from disk`] : []),
|
|
518
543
|
];
|
|
519
544
|
const content = notes.length > 0 ? `${said}
|
|
@@ -1388,6 +1413,7 @@ async function respondTurn(session, options = {}) {
|
|
|
1388
1413
|
summary: result.summary,
|
|
1389
1414
|
isError: result.isError,
|
|
1390
1415
|
detail: result.detail,
|
|
1416
|
+
detailFull: result.detailFull,
|
|
1391
1417
|
detailKind: result.detailKind,
|
|
1392
1418
|
quiet: result.quiet,
|
|
1393
1419
|
fullContentOf: result.fullContentOf,
|
|
@@ -1411,6 +1437,7 @@ async function respondTurn(session, options = {}) {
|
|
|
1411
1437
|
summary: r.summary ?? r.call.name,
|
|
1412
1438
|
error: r.isError ?? false,
|
|
1413
1439
|
detail: r.detail,
|
|
1440
|
+
...("detailFull" in r && r.detailFull ? { detailFull: r.detailFull } : {}),
|
|
1414
1441
|
...(r.detailKind ? { detailKind: r.detailKind } : {}),
|
|
1415
1442
|
...(r.quiet ? { quiet: true } : {}),
|
|
1416
1443
|
...(r.displayKind ? { displayKind: r.displayKind } : {}),
|