maestro-agent-sdk 0.1.38 → 0.1.40
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 +30 -64
- package/dist/agents/rollout/shared.d.ts +0 -1
- package/dist/agents/rollout/shared.d.ts.map +1 -1
- package/dist/agents/rollout/shared.js +5 -3
- package/dist/agents/rollout/shared.js.map +1 -1
- package/dist/core/agent.d.ts +10 -1
- package/dist/core/agent.d.ts.map +1 -1
- package/dist/core/agent.js +1 -0
- package/dist/core/agent.js.map +1 -1
- package/dist/core/loop.d.ts.map +1 -1
- package/dist/core/loop.js +28 -43
- package/dist/core/loop.js.map +1 -1
- package/dist/index.d.ts +1 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -6
- package/dist/index.js.map +1 -1
- package/dist/memory/aux-model-map.d.ts +2 -43
- package/dist/memory/aux-model-map.d.ts.map +1 -1
- package/dist/memory/aux-model-map.js +3 -85
- package/dist/memory/aux-model-map.js.map +1 -1
- package/dist/platform/config.d.ts +0 -10
- package/dist/platform/config.d.ts.map +1 -1
- package/dist/platform/config.js +0 -21
- package/dist/platform/config.js.map +1 -1
- package/dist/platform/jsonl.d.ts +0 -3
- package/dist/platform/jsonl.d.ts.map +1 -1
- package/dist/platform/jsonl.js +1 -19
- package/dist/platform/jsonl.js.map +1 -1
- package/dist/platform/version.d.ts +1 -1
- package/dist/platform/version.js +1 -1
- package/dist/provider.d.ts +6 -57
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +87 -157
- package/dist/provider.js.map +1 -1
- package/dist/registry.d.ts +6 -39
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +9 -76
- package/dist/registry.js.map +1 -1
- package/dist/sub-agent/runner.d.ts.map +1 -1
- package/dist/sub-agent/runner.js +0 -3
- package/dist/sub-agent/runner.js.map +1 -1
- package/dist/tools/builtin/bash.d.ts +0 -36
- package/dist/tools/builtin/bash.d.ts.map +1 -1
- package/dist/tools/builtin/bash.js +0 -3
- package/dist/tools/builtin/bash.js.map +1 -1
- package/dist/types.d.ts +23 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -2
- package/dist/types.js.map +1 -1
- package/package.json +2 -24
- package/dist/providers/anthropic.d.ts +0 -328
- package/dist/providers/anthropic.d.ts.map +0 -1
- package/dist/providers/anthropic.js +0 -857
- package/dist/providers/anthropic.js.map +0 -1
- package/dist/providers/codex-auth.d.ts +0 -149
- package/dist/providers/codex-auth.d.ts.map +0 -1
- package/dist/providers/codex-auth.js +0 -332
- package/dist/providers/codex-auth.js.map +0 -1
- package/dist/providers/codex-stream.d.ts +0 -42
- package/dist/providers/codex-stream.d.ts.map +0 -1
- package/dist/providers/codex-stream.js +0 -345
- package/dist/providers/codex-stream.js.map +0 -1
- package/dist/providers/codex-translators.d.ts +0 -105
- package/dist/providers/codex-translators.d.ts.map +0 -1
- package/dist/providers/codex-translators.js +0 -244
- package/dist/providers/codex-translators.js.map +0 -1
- package/dist/providers/codex.d.ts +0 -234
- package/dist/providers/codex.d.ts.map +0 -1
- package/dist/providers/codex.js +0 -461
- package/dist/providers/codex.js.map +0 -1
- package/dist/providers/fallback.d.ts +0 -71
- package/dist/providers/fallback.d.ts.map +0 -1
- package/dist/providers/fallback.js +0 -223
- package/dist/providers/fallback.js.map +0 -1
|
@@ -1,49 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Map a main model id to the cheapest sibling on the same provider for
|
|
3
|
-
* background context compaction.
|
|
4
|
-
*
|
|
5
|
-
* Why this exists
|
|
6
|
-
* ---------------
|
|
7
|
-
* `compressIfNeeded` (memory/compressor.ts) reuses the agent's main model
|
|
8
|
-
* for its summary call by default. That's fine when the main model is
|
|
9
|
-
* already a cheap/fast tier (Haiku, deepseek-flash, gpt-5.4-mini), but
|
|
10
|
-
* pathological for the heavy tiers:
|
|
11
|
-
*
|
|
12
|
-
* - gpt-5.5: a 330K-token compaction call balloons the request body to
|
|
13
|
-
* ~1.3 MB and routinely hits undici's 5-minute headersTimeout. The
|
|
14
|
-
* v0.1.28 diagnostic logs caught this in production — both the main
|
|
15
|
-
* turn *and* the aux LLM compaction call timed out on the same
|
|
16
|
-
* response cycle, leaving the loop with a prune-only fallback.
|
|
17
|
-
* - claude-opus: each compaction costs 4-8× a Haiku call for the same
|
|
18
|
-
* summary quality.
|
|
19
|
-
* - deepseek-v4-pro: same shape as gpt-5.5 — the heavy reasoning model
|
|
20
|
-
* wasted on a structural summary pass.
|
|
21
|
-
*
|
|
22
|
-
* The fix is one indirection: pick the cheapest sibling on the *same
|
|
23
|
-
* provider* (so we don't have to swap clients) and route compaction
|
|
24
|
-
* through it. Cross-provider swaps (e.g. gpt-5.5 main + Haiku aux) would
|
|
25
|
-
* require the host to wire a second provider client, so we stay
|
|
26
|
-
* intra-provider here and let hosts override via `AIAgentConfig.auxModel`
|
|
27
|
-
* if they want something fancier.
|
|
28
|
-
*
|
|
29
|
-
* Returns the input unchanged when the main model is already the cheapest
|
|
30
|
-
* sibling on its provider, or when we don't recognize it (foreign slugs
|
|
31
|
-
* pass through so a host's custom model id doesn't get silently rewritten).
|
|
32
|
-
*/
|
|
33
1
|
/**
|
|
34
2
|
* Resolve the aux (compaction) model id for a given main model.
|
|
35
3
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* callers can still route compaction through it without a second
|
|
39
|
-
* network identity).
|
|
40
|
-
* - Unknown slug → returns the input unchanged. Lets hosts pin custom
|
|
41
|
-
* model ids (proxies, alternate gateways) without us guessing wrong.
|
|
42
|
-
*
|
|
43
|
-
* Prefix fallbacks catch model ids that look like a known family but
|
|
44
|
-
* differ in version suffix (e.g. `claude-sonnet-4-7`, `deepseek-v5-pro`).
|
|
45
|
-
* They are conservative — only match when the slug clearly belongs to
|
|
46
|
-
* one of the three supported providers.
|
|
4
|
+
* DeepSeek V4 heavy tiers → flash for compaction.
|
|
5
|
+
* Unknown slugs pass through unchanged.
|
|
47
6
|
*/
|
|
48
7
|
export declare function resolveAuxModel(mainModel: string): string;
|
|
49
8
|
//# sourceMappingURL=aux-model-map.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aux-model-map.d.ts","sourceRoot":"","sources":["../../src/memory/aux-model-map.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"aux-model-map.d.ts","sourceRoot":"","sources":["../../src/memory/aux-model-map.ts"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAYzD"}
|
|
@@ -1,104 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
* Map a main model id to the cheapest sibling on the same provider for
|
|
3
|
-
* background context compaction.
|
|
4
|
-
*
|
|
5
|
-
* Why this exists
|
|
6
|
-
* ---------------
|
|
7
|
-
* `compressIfNeeded` (memory/compressor.ts) reuses the agent's main model
|
|
8
|
-
* for its summary call by default. That's fine when the main model is
|
|
9
|
-
* already a cheap/fast tier (Haiku, deepseek-flash, gpt-5.4-mini), but
|
|
10
|
-
* pathological for the heavy tiers:
|
|
11
|
-
*
|
|
12
|
-
* - gpt-5.5: a 330K-token compaction call balloons the request body to
|
|
13
|
-
* ~1.3 MB and routinely hits undici's 5-minute headersTimeout. The
|
|
14
|
-
* v0.1.28 diagnostic logs caught this in production — both the main
|
|
15
|
-
* turn *and* the aux LLM compaction call timed out on the same
|
|
16
|
-
* response cycle, leaving the loop with a prune-only fallback.
|
|
17
|
-
* - claude-opus: each compaction costs 4-8× a Haiku call for the same
|
|
18
|
-
* summary quality.
|
|
19
|
-
* - deepseek-v4-pro: same shape as gpt-5.5 — the heavy reasoning model
|
|
20
|
-
* wasted on a structural summary pass.
|
|
21
|
-
*
|
|
22
|
-
* The fix is one indirection: pick the cheapest sibling on the *same
|
|
23
|
-
* provider* (so we don't have to swap clients) and route compaction
|
|
24
|
-
* through it. Cross-provider swaps (e.g. gpt-5.5 main + Haiku aux) would
|
|
25
|
-
* require the host to wire a second provider client, so we stay
|
|
26
|
-
* intra-provider here and let hosts override via `AIAgentConfig.auxModel`
|
|
27
|
-
* if they want something fancier.
|
|
28
|
-
*
|
|
29
|
-
* Returns the input unchanged when the main model is already the cheapest
|
|
30
|
-
* sibling on its provider, or when we don't recognize it (foreign slugs
|
|
31
|
-
* pass through so a host's custom model id doesn't get silently rewritten).
|
|
32
|
-
*/
|
|
33
|
-
import { MODEL_CODEX_GPT5_2, MODEL_CODEX_GPT5_3_CODEX, MODEL_CODEX_GPT5_4, MODEL_CODEX_GPT5_4_MINI, MODEL_CODEX_GPT5_5, MODEL_DEEPSEEK_V4_FLASH, MODEL_DEEPSEEK_V4_PRO, MODEL_OPUS, MODEL_SONNET, } from "../platform/config.js";
|
|
34
|
-
const CLAUDE_HAIKU = "claude-haiku-4-5";
|
|
35
|
-
/**
|
|
36
|
-
* Per-family aux model. Pinned by family, not cheapest-strictly: the host
|
|
37
|
-
* picks the model it considers the right balance of summary quality and
|
|
38
|
-
* latency for each provider line.
|
|
39
|
-
*
|
|
40
|
-
* - Claude family → sonnet. Haiku turned out too lossy for production
|
|
41
|
-
* summary work; sonnet is the chosen aux tier even when main is opus
|
|
42
|
-
* (compaction is bounded so the cost differential is small) or when
|
|
43
|
-
* main is haiku (the floor is sonnet either way).
|
|
44
|
-
* - DeepSeek family → flash.
|
|
45
|
-
* - Codex (gpt-5.x) family → gpt-5.4-mini.
|
|
46
|
-
*
|
|
47
|
-
* The function stays total — callers always get a usable model id back —
|
|
48
|
-
* and the same Provider client handles both main and aux, so no extra
|
|
49
|
-
* client wiring is required at the host layer.
|
|
50
|
-
*/
|
|
1
|
+
import { MODEL_DEEPSEEK_V4_FLASH, MODEL_DEEPSEEK_V4_PRO } from "../platform/config.js";
|
|
51
2
|
const AUX_MODEL_BY_MAIN = {
|
|
52
|
-
// Anthropic (Claude). Sonnet on every tier — host preference, not
|
|
53
|
-
// strictly cheapest. Haiku is intentionally avoided as an aux target
|
|
54
|
-
// because the summaries it produces dropped too much structural info
|
|
55
|
-
// for downstream resume turns.
|
|
56
|
-
[MODEL_OPUS]: MODEL_SONNET,
|
|
57
|
-
[MODEL_SONNET]: MODEL_SONNET,
|
|
58
|
-
[CLAUDE_HAIKU]: MODEL_SONNET,
|
|
59
|
-
// DeepSeek V4
|
|
60
3
|
[MODEL_DEEPSEEK_V4_PRO]: MODEL_DEEPSEEK_V4_FLASH,
|
|
61
4
|
[MODEL_DEEPSEEK_V4_FLASH]: MODEL_DEEPSEEK_V4_FLASH,
|
|
62
|
-
// Codex (gpt-5.x). gpt-5.4-mini is the cheapest tier accepted by the
|
|
63
|
-
// Responses endpoint, so every heavier slug routes to it.
|
|
64
|
-
[MODEL_CODEX_GPT5_5]: MODEL_CODEX_GPT5_4_MINI,
|
|
65
|
-
[MODEL_CODEX_GPT5_4]: MODEL_CODEX_GPT5_4_MINI,
|
|
66
|
-
[MODEL_CODEX_GPT5_4_MINI]: MODEL_CODEX_GPT5_4_MINI,
|
|
67
|
-
[MODEL_CODEX_GPT5_3_CODEX]: MODEL_CODEX_GPT5_4_MINI,
|
|
68
|
-
[MODEL_CODEX_GPT5_2]: MODEL_CODEX_GPT5_4_MINI,
|
|
69
5
|
};
|
|
70
6
|
/**
|
|
71
7
|
* Resolve the aux (compaction) model id for a given main model.
|
|
72
8
|
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* callers can still route compaction through it without a second
|
|
76
|
-
* network identity).
|
|
77
|
-
* - Unknown slug → returns the input unchanged. Lets hosts pin custom
|
|
78
|
-
* model ids (proxies, alternate gateways) without us guessing wrong.
|
|
79
|
-
*
|
|
80
|
-
* Prefix fallbacks catch model ids that look like a known family but
|
|
81
|
-
* differ in version suffix (e.g. `claude-sonnet-4-7`, `deepseek-v5-pro`).
|
|
82
|
-
* They are conservative — only match when the slug clearly belongs to
|
|
83
|
-
* one of the three supported providers.
|
|
9
|
+
* DeepSeek V4 heavy tiers → flash for compaction.
|
|
10
|
+
* Unknown slugs pass through unchanged.
|
|
84
11
|
*/
|
|
85
12
|
export function resolveAuxModel(mainModel) {
|
|
86
13
|
const exact = AUX_MODEL_BY_MAIN[mainModel];
|
|
87
14
|
if (exact !== undefined)
|
|
88
15
|
return exact;
|
|
89
|
-
// Prefix-based fallback for forward-compat with new minor versions.
|
|
90
|
-
// Any claude-* slug routes to sonnet (host preference); any heavy gpt-5.*
|
|
91
|
-
// routes to mini; any deepseek-pro variant routes to flash.
|
|
92
|
-
if (mainModel.startsWith("claude-")) {
|
|
93
|
-
return MODEL_SONNET;
|
|
94
|
-
}
|
|
95
16
|
if (mainModel === "deepseek-pro" ||
|
|
96
17
|
(mainModel.startsWith("deepseek-v") && mainModel.includes("pro"))) {
|
|
97
18
|
return MODEL_DEEPSEEK_V4_FLASH;
|
|
98
19
|
}
|
|
99
|
-
if (mainModel.startsWith("gpt-5") && !mainModel.includes("mini")) {
|
|
100
|
-
return MODEL_CODEX_GPT5_4_MINI;
|
|
101
|
-
}
|
|
102
20
|
return mainModel;
|
|
103
21
|
}
|
|
104
22
|
//# sourceMappingURL=aux-model-map.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aux-model-map.js","sourceRoot":"","sources":["../../src/memory/aux-model-map.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"aux-model-map.js","sourceRoot":"","sources":["../../src/memory/aux-model-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAEnF,MAAM,iBAAiB,GAA2B;IAChD,CAAC,qBAAqB,CAAC,EAAE,uBAAuB;IAChD,CAAC,uBAAuB,CAAC,EAAE,uBAAuB;CACnD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,SAAiB;IAC/C,MAAM,KAAK,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC3C,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAEtC,IACE,SAAS,KAAK,cAAc;QAC5B,CAAC,SAAS,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EACjE,CAAC;QACD,OAAO,uBAAuB,CAAC;IACjC,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
export declare const DATA_DIR: string;
|
|
2
|
-
export declare const MODEL_SONNET: string;
|
|
3
|
-
export declare const MODEL_OPUS: string;
|
|
4
2
|
export declare const MODEL_DEEPSEEK_V4_PRO: string;
|
|
5
3
|
export declare const MODEL_DEEPSEEK_V4_FLASH: string;
|
|
6
|
-
export declare const MODEL_CODEX_GPT5_5: string;
|
|
7
|
-
export declare const MODEL_CODEX_GPT5_4: string;
|
|
8
|
-
export declare const MODEL_CODEX_GPT5_4_MINI: string;
|
|
9
|
-
export declare const MODEL_CODEX_GPT5_3_CODEX: string;
|
|
10
|
-
export declare const MODEL_CODEX_GPT5_2: string;
|
|
11
4
|
export declare const FILE_TAG_REGEX: RegExp;
|
|
12
|
-
/** Returns `process.env` without `CLAUDECODE` so spawned subprocesses don't
|
|
13
|
-
* inherit a nested-claude-code detection flag from a parent harness. */
|
|
14
|
-
export declare function getCleanEnv(): NodeJS.ProcessEnv;
|
|
15
5
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/platform/config.ts"],"names":[],"mappings":"AAwBA,eAAO,MAAM,QAAQ,EAAE,MAEM,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/platform/config.ts"],"names":[],"mappings":"AAwBA,eAAO,MAAM,QAAQ,EAAE,MAEM,CAAC;AAG9B,eAAO,MAAM,qBAAqB,EAAE,MAA0B,CAAC;AAC/D,eAAO,MAAM,uBAAuB,EAAE,MAA4B,CAAC;AAEnE,eAAO,MAAM,cAAc,EAAE,MAAgC,CAAC"}
|
package/dist/platform/config.js
CHANGED
|
@@ -22,23 +22,9 @@ const HOME = homedir();
|
|
|
22
22
|
export const DATA_DIR = process.env.MAESTRO_DATA_DIR
|
|
23
23
|
? resolve(process.env.MAESTRO_DATA_DIR)
|
|
24
24
|
: resolve(HOME, ".maestro");
|
|
25
|
-
// Canonical model IDs used by the SDK's maestro registry. Hosts can pick a
|
|
26
|
-
// different default per-query via `AgentQueryOptions.model`, so these are
|
|
27
|
-
// just baseline references.
|
|
28
|
-
export const MODEL_SONNET = "claude-sonnet-4-6";
|
|
29
|
-
export const MODEL_OPUS = "claude-opus-4-7";
|
|
30
25
|
// DeepSeek V4 (released 2026-04-24). OpenAI-compatible chat-completions API.
|
|
31
26
|
export const MODEL_DEEPSEEK_V4_PRO = "deepseek-v4-pro";
|
|
32
27
|
export const MODEL_DEEPSEEK_V4_FLASH = "deepseek-v4-flash";
|
|
33
|
-
// Codex Responses API (ChatGPT-backed OAuth). The endpoint only accepts a
|
|
34
|
-
// codex-issued whitelist of model slugs — these are the ones surfaced by the
|
|
35
|
-
// `/codex/models` endpoint as of 2026-05-23. Adding a new one: list it here
|
|
36
|
-
// AND in `MODEL_MAX_OUTPUT_TOKENS` / `ALIAS_MAP` if it deserves a short alias.
|
|
37
|
-
export const MODEL_CODEX_GPT5_5 = "gpt-5.5";
|
|
38
|
-
export const MODEL_CODEX_GPT5_4 = "gpt-5.4";
|
|
39
|
-
export const MODEL_CODEX_GPT5_4_MINI = "gpt-5.4-mini";
|
|
40
|
-
export const MODEL_CODEX_GPT5_3_CODEX = "gpt-5.3-codex";
|
|
41
|
-
export const MODEL_CODEX_GPT5_2 = "gpt-5.2";
|
|
42
28
|
export const FILE_TAG_REGEX = /\[FILE:(\/[^\]]+)\]/gi;
|
|
43
29
|
// Make sure DATA_DIR exists before any tool/skill code tries to readdir into
|
|
44
30
|
// it. Idempotent and best-effort — hosts that point this at a read-only
|
|
@@ -49,11 +35,4 @@ try {
|
|
|
49
35
|
catch {
|
|
50
36
|
// ignore — host may have pre-created with stricter perms
|
|
51
37
|
}
|
|
52
|
-
/** Returns `process.env` without `CLAUDECODE` so spawned subprocesses don't
|
|
53
|
-
* inherit a nested-claude-code detection flag from a parent harness. */
|
|
54
|
-
export function getCleanEnv() {
|
|
55
|
-
const env = { ...process.env };
|
|
56
|
-
delete env.CLAUDECODE;
|
|
57
|
-
return env;
|
|
58
|
-
}
|
|
59
38
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/platform/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;;;;;GAWG;AAEH,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;AAEvB,6EAA6E;AAC7E,0EAA0E;AAC1E,4EAA4E;AAC5E,uEAAuE;AACvE,4CAA4C;AAC5C,MAAM,CAAC,MAAM,QAAQ,GAAW,OAAO,CAAC,GAAG,CAAC,gBAAgB;IAC1D,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;IACvC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AAE9B,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/platform/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;;;;;GAWG;AAEH,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;AAEvB,6EAA6E;AAC7E,0EAA0E;AAC1E,4EAA4E;AAC5E,uEAAuE;AACvE,4CAA4C;AAC5C,MAAM,CAAC,MAAM,QAAQ,GAAW,OAAO,CAAC,GAAG,CAAC,gBAAgB;IAC1D,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;IACvC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AAE9B,6EAA6E;AAC7E,MAAM,CAAC,MAAM,qBAAqB,GAAW,iBAAiB,CAAC;AAC/D,MAAM,CAAC,MAAM,uBAAuB,GAAW,mBAAmB,CAAC;AAEnE,MAAM,CAAC,MAAM,cAAc,GAAW,uBAAuB,CAAC;AAE9D,6EAA6E;AAC7E,wEAAwE;AACxE,wDAAwD;AACxD,IAAI,CAAC;IACH,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC3C,CAAC;AAAC,MAAM,CAAC;IACP,yDAAyD;AAC3D,CAAC"}
|
package/dist/platform/jsonl.d.ts
CHANGED
|
@@ -7,9 +7,6 @@
|
|
|
7
7
|
* layer on top is intentionally absent (also keeps the SDK free of any
|
|
8
8
|
* Bun-specific APIs).
|
|
9
9
|
*/
|
|
10
|
-
export declare function readJsonlLines(filePath: string): string[];
|
|
11
|
-
export declare function parseJsonlText<T = unknown>(raw: string): T[];
|
|
12
|
-
export declare function readJsonFile<T = unknown>(filePath: string): T | null;
|
|
13
10
|
/** Overwrite a JSONL file atomically (write to temp, fsync, rename). */
|
|
14
11
|
export declare function writeJsonlFile(filePath: string, entries: readonly unknown[]): void;
|
|
15
12
|
//# sourceMappingURL=jsonl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonl.d.ts","sourceRoot":"","sources":["../../src/platform/jsonl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jsonl.d.ts","sourceRoot":"","sources":["../../src/platform/jsonl.ts"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AAEH,wEAAwE;AACxE,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CA2BlF"}
|
package/dist/platform/jsonl.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { closeSync, fsyncSync, mkdirSync, openSync,
|
|
1
|
+
import { closeSync, fsyncSync, mkdirSync, openSync, renameSync, unlinkSync, writeFileSync, } from "node:fs";
|
|
2
2
|
import { dirname } from "node:path";
|
|
3
3
|
/**
|
|
4
4
|
* Narrowed JSONL helpers for the SDK.
|
|
@@ -9,24 +9,6 @@ import { dirname } from "node:path";
|
|
|
9
9
|
* layer on top is intentionally absent (also keeps the SDK free of any
|
|
10
10
|
* Bun-specific APIs).
|
|
11
11
|
*/
|
|
12
|
-
export function readJsonlLines(filePath) {
|
|
13
|
-
return readFileSync(filePath, "utf-8").trim().split("\n").filter(Boolean);
|
|
14
|
-
}
|
|
15
|
-
export function parseJsonlText(raw) {
|
|
16
|
-
return raw
|
|
17
|
-
.trim()
|
|
18
|
-
.split("\n")
|
|
19
|
-
.filter(Boolean)
|
|
20
|
-
.map((line) => JSON.parse(line));
|
|
21
|
-
}
|
|
22
|
-
export function readJsonFile(filePath) {
|
|
23
|
-
try {
|
|
24
|
-
return JSON.parse(readFileSync(filePath, "utf-8"));
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
12
|
/** Overwrite a JSONL file atomically (write to temp, fsync, rename). */
|
|
31
13
|
export function writeJsonlFile(filePath, entries) {
|
|
32
14
|
const dir = dirname(filePath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonl.js","sourceRoot":"","sources":["../../src/platform/jsonl.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,SAAS,EACT,SAAS,EACT,QAAQ,EACR,
|
|
1
|
+
{"version":3,"file":"jsonl.js","sourceRoot":"","sources":["../../src/platform/jsonl.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,SAAS,EACT,SAAS,EACT,QAAQ,EACR,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;;GAQG;AAEH,wEAAwE;AACxE,MAAM,UAAU,cAAc,CAAC,QAAgB,EAAE,OAA2B;IAC1E,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC9B,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACpC,MAAM,OAAO,GAAG,GAAG,QAAQ,QAAQ,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE;SAC1E,QAAQ,CAAC,EAAE,CAAC;SACZ,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACd,MAAM,OAAO,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACxE,IAAI,EAAE,GAAkB,IAAI,CAAC;IAC7B,IAAI,CAAC;QACH,EAAE,GAAG,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC5B,aAAa,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAC3B,SAAS,CAAC,EAAE,CAAC,CAAC;QACd,SAAS,CAAC,EAAE,CAAC,CAAC;QACd,EAAE,GAAG,IAAI,CAAC;QACV,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC9B,wBAAwB,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;YAChB,IAAI,CAAC;gBACH,SAAS,CAAC,EAAE,CAAC,CAAC;YAChB,CAAC;YAAC,MAAM,CAAC,CAAA,CAAC;QACZ,CAAC;QACD,IAAI,CAAC;YACH,UAAU,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;QACV,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,wBAAwB,CAAC,GAAW;IAC3C,IAAI,EAAE,GAAkB,IAAI,CAAC;IAC7B,IAAI,CAAC;QACH,EAAE,GAAG,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACxB,SAAS,CAAC,EAAE,CAAC,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,mEAAmE;IACrE,CAAC;YAAS,CAAC;QACT,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;YAChB,IAAI,CAAC;gBACH,SAAS,CAAC,EAAE,CAAC,CAAC;YAChB,CAAC;YAAC,MAAM,CAAC,CAAA,CAAC;QACZ,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/platform/version.js
CHANGED
package/dist/provider.d.ts
CHANGED
|
@@ -7,9 +7,7 @@ import type { AgentQueryOptions, UnifiedEvent } from "./types.js";
|
|
|
7
7
|
* Multi-turn resume: when `opts.sessionId` is set we hydrate prior messages
|
|
8
8
|
* from `~/.maestro/sessions/<id>.jsonl` (written by the previous turn's
|
|
9
9
|
* persistence path or by a cross-agent rollout). Otherwise we mint a fresh
|
|
10
|
-
* UUIDv4
|
|
11
|
-
* router stays agent-agnostic and `{type:"session", sessionId}` always comes
|
|
12
|
-
* back on the first iteration.
|
|
10
|
+
* UUIDv4 and start with empty history.
|
|
13
11
|
*
|
|
14
12
|
* After the loop drains we write the updated history back to disk so a
|
|
15
13
|
* subsequent call resumes correctly. Failures here are logged but never
|
|
@@ -18,17 +16,10 @@ import type { AgentQueryOptions, UnifiedEvent } from "./types.js";
|
|
|
18
16
|
*
|
|
19
17
|
* MCP integration: every server in `getMcpServersForQuery(opts)` is leased
|
|
20
18
|
* from the process-wide cache (`mcp/pool-cache.ts`) and its tools are
|
|
21
|
-
* registered under `mcp__<server>__<tool
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* Messages API via raw fetch, so we own startup + dispatch + cleanup here.
|
|
26
|
-
* Cache key includes (userId, session, groupId) so two users never share an
|
|
27
|
-
* MCP client; the cache evicts idle clients via TTL + LRU cap so stale slots
|
|
28
|
-
* don't accumulate.
|
|
29
|
-
*
|
|
30
|
-
* Snapshot pinned to upstream Maestro v0.13.0 (MIT, Nous Research). See
|
|
31
|
-
* docs/maestro-integration.md for the porting roadmap.
|
|
19
|
+
* registered under `mcp__<server>__<tool>`. Maestro owns MCP startup +
|
|
20
|
+
* dispatch + cleanup directly. Cache key includes (userId, session, groupId)
|
|
21
|
+
* so two users never share an MCP client; the cache evicts idle clients via
|
|
22
|
+
* TTL + LRU cap so stale slots don't accumulate.
|
|
32
23
|
*/
|
|
33
24
|
/**
|
|
34
25
|
* Default tool-iteration cap when the caller doesn't supply
|
|
@@ -128,31 +119,7 @@ export declare function iterationBudgetLine(remaining: number, max: number): str
|
|
|
128
119
|
* from prose.
|
|
129
120
|
*/
|
|
130
121
|
export declare function wrapUpOverlayLine(remaining: number, max: number): string | null;
|
|
131
|
-
|
|
132
|
-
* Pick the right provider adapter for a resolved model id.
|
|
133
|
-
*
|
|
134
|
-
* Dispatch table:
|
|
135
|
-
* - `gpt-5.*` / `gpt-4.*` / `o3` / `o4` → CodexResponsesProvider
|
|
136
|
-
* (ChatGPT-OAuth-backed Responses API at
|
|
137
|
-
* chatgpt.com/backend-api/codex; reads ~/.codex/auth.json).
|
|
138
|
-
* When `DEEPSEEK_API_KEY` is present, the codex provider is wrapped in a
|
|
139
|
-
* `FallbackProvider` that retries against DeepSeek (`deepseek-v4-pro`) if
|
|
140
|
-
* codex fails before producing any output (OAuth dead, HTTP 4xx/5xx,
|
|
141
|
-
* connect/TTFB timeout). Auto-on — no flag — because the only cost when
|
|
142
|
-
* codex is healthy is one cheap wrapper object; the fallback provider is
|
|
143
|
-
* lazily constructed and never touched unless codex actually fails.
|
|
144
|
-
* - `deepseek-*` → DeepseekProvider
|
|
145
|
-
* (DEEPSEEK_API_KEY env).
|
|
146
|
-
* - everything else (claude-*, custom full ids)
|
|
147
|
-
* → AnthropicProvider
|
|
148
|
-
* (ANTHROPIC_API_KEY env).
|
|
149
|
-
*
|
|
150
|
-
* Exported so tests / hosts can lock the dispatch shape independently of
|
|
151
|
-
* `maestroProvider`'s I/O. The codex match is prefix-based so hosts can ship
|
|
152
|
-
* new codex slugs (gpt-5.6, future tiers) without a dispatcher change — only
|
|
153
|
-
* the registry alias map needs updating.
|
|
154
|
-
*/
|
|
155
|
-
export declare function providerForModel(resolvedModel: string): Provider;
|
|
122
|
+
export declare function providerForModel(_resolvedModel: string): Provider;
|
|
156
123
|
/**
|
|
157
124
|
* DeepSeek cannot currently consume Maestro image blocks natively in this
|
|
158
125
|
* adapter, so when a Gemini API key is configured we expose a narrow vision
|
|
@@ -161,24 +128,6 @@ export declare function providerForModel(resolvedModel: string): Provider;
|
|
|
161
128
|
*/
|
|
162
129
|
export declare function shouldRegisterGeminiImageQATool(resolvedModel: string, env?: NodeJS.ProcessEnv): boolean;
|
|
163
130
|
export declare function deepseekImageHandlingPrompt(resolvedModel: string, geminiImageQaAvailable: boolean): string | undefined;
|
|
164
|
-
/**
|
|
165
|
-
* Combine two optional thinking budgets — keyword-derived and effort-derived
|
|
166
|
-
* — by picking the higher non-undefined value. Used by `maestroProvider` so
|
|
167
|
-
* an explicit keyword in the prompt can escalate past the caller's static
|
|
168
|
-
* effort config, but neither path silently downgrades the other.
|
|
169
|
-
*
|
|
170
|
-
* Truth table:
|
|
171
|
-
* keyword=undef, effort=undef → undef (no thinking)
|
|
172
|
-
* keyword=4096, effort=undef → 4096 (keyword only)
|
|
173
|
-
* keyword=undef, effort=10000 → 10000 (effort only)
|
|
174
|
-
* keyword=4096, effort=10000 → 10000 (effort higher)
|
|
175
|
-
* keyword=31999, effort=4096 → 31999 (keyword higher — user
|
|
176
|
-
* intent in prompt wins)
|
|
177
|
-
*
|
|
178
|
-
* Kept as a tiny helper rather than inlining so tests can exercise the
|
|
179
|
-
* priority rule without spinning up the full maestroProvider pipeline.
|
|
180
|
-
*/
|
|
181
|
-
export declare function pickHigherBudget(a: number | undefined, b: number | undefined): number | undefined;
|
|
182
131
|
/**
|
|
183
132
|
* Recognize the multiple shapes Node + WHATWG fetch use when a request is
|
|
184
133
|
* cancelled via `AbortController`:
|
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAgBrE,OAAO,KAAK,EAAE,QAAQ,EAAyC,MAAM,kBAAkB,CAAC;AAqCxF,OAAO,KAAK,EAAE,iBAAiB,EAAc,YAAY,EAAE,MAAM,SAAS,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,sBAAsB,QAA2B,CAAC;AAyD/D,wBAAuB,eAAe,CAAC,IAAI,EAAE,iBAAiB,GAAG,cAAc,CAAC,YAAY,CAAC,CAkf5F;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAa1E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI/E;AAED,wBAAgB,gBAAgB,CAAC,cAAc,EAAE,MAAM,GAAG,QAAQ,CAEjE;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC7C,aAAa,EAAE,MAAM,EACrB,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAGT;AAED,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,MAAM,EACrB,sBAAsB,EAAE,OAAO,GAC9B,MAAM,GAAG,SAAS,CAWpB;AAED;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC"}
|