maestro-agent-sdk 0.1.38 → 0.1.39
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/core/loop.d.ts.map +1 -1
- package/dist/core/loop.js +5 -43
- package/dist/core/loop.js.map +1 -1
- package/dist/index.d.ts +0 -5
- 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 -7
- package/dist/platform/config.d.ts.map +1 -1
- package/dist/platform/config.js +0 -14
- package/dist/platform/config.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 +72 -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/types.d.ts +1 -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
package/dist/registry.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { unlinkSync } from "node:fs";
|
|
2
|
-
import {
|
|
2
|
+
import { MODEL_DEEPSEEK_V4_FLASH, MODEL_DEEPSEEK_V4_PRO, } from "./platform/config.js";
|
|
3
3
|
import { logger } from "./platform/logger.js";
|
|
4
4
|
import { maestroSessionPath, writeMaestroRollout } from "./session-store.js";
|
|
5
5
|
import { readConversation } from "./storage/conversations.js";
|
|
@@ -9,99 +9,32 @@ import { MAESTRO_EFFORT_VALUES } from "./types.js";
|
|
|
9
9
|
*
|
|
10
10
|
* Default model is `deepseek-pro` → V4-Pro (heavier reasoning, default for
|
|
11
11
|
* general use). `deepseek` / `deepseek-flash` aliases land on V4-Flash for
|
|
12
|
-
* the cheap-and-fast path.
|
|
13
|
-
* surface but ships behind an explicit opt-in because Anthropic's
|
|
14
|
-
* extended-thinking blocks require strict preservation across turns.
|
|
12
|
+
* the cheap-and-fast path.
|
|
15
13
|
*
|
|
16
14
|
* Session persistence lives at `~/.maestro/sessions/<sessionId>.jsonl` —
|
|
17
|
-
* one ProviderMessage per line.
|
|
18
|
-
* persistence to their SDKs), maestro owns its own store, but the
|
|
19
|
-
* `writeRollout` / `forkSession` / `cleanupRollouts` contracts behave
|
|
20
|
-
* identically from the caller's perspective.
|
|
15
|
+
* one ProviderMessage per line.
|
|
21
16
|
*/
|
|
22
17
|
const ALIAS_MAP = {
|
|
23
|
-
sonnet: MODEL_SONNET,
|
|
24
18
|
deepseek: MODEL_DEEPSEEK_V4_FLASH,
|
|
25
19
|
"deepseek-flash": MODEL_DEEPSEEK_V4_FLASH,
|
|
26
20
|
"deepseek-pro": MODEL_DEEPSEEK_V4_PRO,
|
|
27
|
-
// Codex (ChatGPT OAuth-backed Responses API). The short alias `codex`
|
|
28
|
-
// resolves to the lightest model so default-effort calls don't burn
|
|
29
|
-
// through the ChatGPT subscription's hourly cap on the heaviest tier;
|
|
30
|
-
// hosts that want gpt-5.5 should pass the full slug or `codex-pro`.
|
|
31
|
-
codex: MODEL_CODEX_GPT5_4_MINI,
|
|
32
|
-
"codex-mini": MODEL_CODEX_GPT5_4_MINI,
|
|
33
|
-
"codex-pro": MODEL_CODEX_GPT5_5,
|
|
34
|
-
"codex-coder": MODEL_CODEX_GPT5_3_CODEX,
|
|
35
|
-
"gpt-5.5": MODEL_CODEX_GPT5_5,
|
|
36
|
-
"gpt-5.4": MODEL_CODEX_GPT5_4,
|
|
37
|
-
"gpt-5.4-mini": MODEL_CODEX_GPT5_4_MINI,
|
|
38
|
-
"gpt-5.3-codex": MODEL_CODEX_GPT5_3_CODEX,
|
|
39
|
-
"gpt-5.2": MODEL_CODEX_GPT5_2,
|
|
40
21
|
};
|
|
41
22
|
const VALID_ALIASES = new Set(Object.keys(ALIAS_MAP));
|
|
42
23
|
const VALID_FULL_IDS = new Set(Object.values(ALIAS_MAP));
|
|
43
24
|
const VALID_EFFORTS = new Set(MAESTRO_EFFORT_VALUES);
|
|
44
25
|
/**
|
|
45
|
-
* Per-model default `max_tokens` ceiling
|
|
46
|
-
* provider when the caller doesn't pin `AgentQueryOptions.maxTokens` itself.
|
|
26
|
+
* Per-model default `max_tokens` ceiling.
|
|
47
27
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* - **Claude** (Anthropic) caps native output at 64K (sonnet/haiku) or 128K
|
|
54
|
-
* (opus 4.7). These are realistic ceilings for actual long-form work, so
|
|
55
|
-
* the default IS the native cap — matches `@anthropic-ai/claude-agent-sdk`
|
|
56
|
-
* behavior where caller omitting `maxTokens` gets the per-model native
|
|
57
|
-
* max from the SDK's model catalog.
|
|
58
|
-
*
|
|
59
|
-
* - **DeepSeek V4** caps native output at 384K (both pro and flash). That's
|
|
60
|
-
* ~290k English words in one shot — far beyond any practical single-turn
|
|
61
|
-
* use case. Defaulting to native here would mean a single runaway turn
|
|
62
|
-
* could rack up serious cost and 30-minute+ wall time before the loop
|
|
63
|
-
* even notices. We pin a smaller default per variant:
|
|
64
|
-
* - `deepseek-v4-pro` → 65_536 (matches the Claude Sonnet / Haiku
|
|
65
|
-
* 64K reference point so a topic
|
|
66
|
-
* switching providers sees the same
|
|
67
|
-
* default ceiling)
|
|
68
|
-
* - `deepseek-v4-flash` → 32_768 (latency-tier — flash users prefer
|
|
69
|
-
* snappier responses; long outputs
|
|
70
|
-
* should escalate to pro)
|
|
71
|
-
* Callers that genuinely need the full 384K still get it via the
|
|
72
|
-
* `AgentQueryOptions.maxTokens` override — the catalog is a default,
|
|
73
|
-
* not a hard ceiling.
|
|
74
|
-
*
|
|
75
|
-
* - **Unknown model ids** fall back to `DEFAULT_MAX_OUTPUT_TOKENS` (32_768)
|
|
76
|
-
* via `getNativeMaxOutputTokens`. The fallback is sized to "comfortably
|
|
77
|
-
* covers most long-form outputs" — picking 4096 like v0.1.20 reintroduces
|
|
78
|
-
* the original silent-truncation bug for any new model the caller hasn't
|
|
79
|
-
* registered yet, so we err on the generous side. Callers running an
|
|
80
|
-
* unknown model who want to clamp output should set `maxTokens` explicitly.
|
|
81
|
-
*
|
|
82
|
-
* The catalog is read at exactly one site — `AIAgent`'s constructor in
|
|
83
|
-
* `src/core/agent.ts` — via the `getNativeMaxOutputTokens(model)` helper.
|
|
84
|
-
* Adding a new model: extend this table and the corresponding alias entry.
|
|
28
|
+
* DeepSeek V4 caps native output at 384K. We pin conservative defaults to
|
|
29
|
+
* avoid runaway cost/wall-time on a single turn:
|
|
30
|
+
* - `deepseek-v4-pro` → 65_536
|
|
31
|
+
* - `deepseek-v4-flash` → 32_768
|
|
32
|
+
* Unknown ids fall back to `DEFAULT_MAX_OUTPUT_TOKENS` (32_768).
|
|
85
33
|
*/
|
|
86
34
|
export const MODEL_MAX_OUTPUT_TOKENS = {
|
|
87
|
-
// Anthropic — native caps. Source: platform.claude.com/docs/en/about-claude/models/overview
|
|
88
|
-
[MODEL_SONNET]: 64_000, // claude-sonnet-4-6
|
|
89
|
-
[MODEL_OPUS]: 128_000, // claude-opus-4-7
|
|
90
|
-
"claude-haiku-4-5": 64_000,
|
|
91
35
|
// DeepSeek V4 — conservative defaults below the 384K native cap (see docstring).
|
|
92
36
|
[MODEL_DEEPSEEK_V4_PRO]: 65_536,
|
|
93
37
|
[MODEL_DEEPSEEK_V4_FLASH]: 32_768,
|
|
94
|
-
// Codex Responses API — the `/codex/models` catalog reports a 272K context
|
|
95
|
-
// window across the gpt-5.x lineup; output cap isn't surfaced separately,
|
|
96
|
-
// so we anchor against the same per-tier defaults we use for the Anthropic
|
|
97
|
-
// family (64K heavy, 32K mini). The Codex backend silently caps long
|
|
98
|
-
// outputs anyway, so picking a generous-but-finite default here just keeps
|
|
99
|
-
// a runaway turn bounded.
|
|
100
|
-
[MODEL_CODEX_GPT5_5]: 65_536,
|
|
101
|
-
[MODEL_CODEX_GPT5_4]: 65_536,
|
|
102
|
-
[MODEL_CODEX_GPT5_4_MINI]: 32_768,
|
|
103
|
-
[MODEL_CODEX_GPT5_3_CODEX]: 65_536,
|
|
104
|
-
[MODEL_CODEX_GPT5_2]: 65_536,
|
|
105
38
|
};
|
|
106
39
|
/**
|
|
107
40
|
* Default `max_tokens` for an unknown model id. Sized generously (32_768)
|
package/dist/registry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/regist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AAG,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,wCAAwC,CAAC,CAAC;oBACxE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBACnB,CAAC;YACH,CAAC;QACH,CAAC;QACD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,cAAc,CAAC,QAAQ,EAAE,gCAAgC,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/sub-agent/runner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/sub-agent/runner.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,qBAAqB,EAAE,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AASpF,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAE,qBAAqB,EAAE,KAAK,YAAY,EAAE,CAAC;AAEpD,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,YAAY,CAAC;IAC3B;mBACe;IACf,MAAM,EAAE,MAAM,CAAC;IACf;2DACuD;IACvD,eAAe,EAAE,MAAM,CAAC;IACxB;4DACwD;IACxD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iEAAiE;IACjE,WAAW,EAAE,MAAM,CAAC;IACpB;yDACqD;IACrD,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B;+CAC2C;IAC3C,iBAAiB,CAAC,EAAE,WAAW,CAAC;IAChC;;;;;;;;;;;;;;OAcG;IACH,UAAU,CAAC,EAAE,WAAW,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAChC;4CACwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,KAAK,EAAE,UAAU,CAAC;IAClB;yEACqE;IACrE,YAAY,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,OAAO,EAAE,OAAO,CAAC;CAClB;AA0DD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,iBAAS,iBAAiB,CACxB,IAAI,EAAE,YAAY,EAClB,YAAY,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,WAAW,EAAE,EAC1B,WAAW,CAAC,EAAE,WAAW,GACxB,YAAY,CAsCd;AAED,OAAO,EAAE,iBAAiB,IAAI,0BAA0B,EAAE,CAAC;AAE3D;;;;;;;;;;;GAWG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA4GtF"}
|
package/dist/sub-agent/runner.js
CHANGED
|
@@ -8,7 +8,6 @@ import { runConversation } from "../core/loop.js";
|
|
|
8
8
|
import { buildSystemReminder } from "../memory/reminder.js";
|
|
9
9
|
import { logger } from "../platform/logger.js";
|
|
10
10
|
import { providerForModel } from "../provider.js";
|
|
11
|
-
import { effortToThinkingBudget } from "../providers/anthropic.js";
|
|
12
11
|
import { getNativeMaxOutputTokens } from "../registry.js";
|
|
13
12
|
import { deleteMaestroSession } from "../session-store.js";
|
|
14
13
|
import { SUBAGENT_CAPABILITIES } from "../sub-agent/capabilities.js";
|
|
@@ -189,7 +188,6 @@ export async function runSubAgent(opts) {
|
|
|
189
188
|
const overlay = loadOverlay(opts.subagentType);
|
|
190
189
|
const systemPrompt = `${opts.parentSystemPrompt}\n\n${overlay}`;
|
|
191
190
|
const maxTokens = resolveMaxTokens(opts.parentModel);
|
|
192
|
-
const thinkingBudget = opts.parentEffort ? effortToThinkingBudget(opts.parentEffort) : undefined;
|
|
193
191
|
// Sub-agent's user message follows the parent contract: prompt + own
|
|
194
192
|
// system reminder. The reminder reflects the SUB-SESSION's state
|
|
195
193
|
// (its own session id), not the parent's.
|
|
@@ -203,7 +201,6 @@ export async function runSubAgent(opts) {
|
|
|
203
201
|
model: opts.parentModel,
|
|
204
202
|
systemPrompt,
|
|
205
203
|
maxTokens,
|
|
206
|
-
...(thinkingBudget ? { thinkingBudget } : {}),
|
|
207
204
|
...(opts.parentEffort ? { effort: opts.parentEffort } : {}),
|
|
208
205
|
...(opts.parentAbortSignal ? { abortSignal: opts.parentAbortSignal } : {}),
|
|
209
206
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/sub-agent/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/sub-agent/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,M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AAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;AAC3D,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -80,7 +80,7 @@ export type EffortLevel = "minimal" | "low" | "medium" | "high" | "xhigh" | "max
|
|
|
80
80
|
* Identifier returned by the SDK's session-store. Hosts may map their own
|
|
81
81
|
* notion of "session" (e.g. a topic, a thread, a user) onto this.
|
|
82
82
|
*/
|
|
83
|
-
export type AgentKind = "
|
|
83
|
+
export type AgentKind = "maestro";
|
|
84
84
|
export declare const SUPPORTED_AGENTS: readonly AgentKind[];
|
|
85
85
|
export declare const FALLBACK_AGENT: AgentKind;
|
|
86
86
|
export declare function isAgentKind(value: unknown): value is AgentKind;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,gBAAgB,GAAG,UAAU,CAAC;AAExE,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,GAAG,CACvB,QAAQ,EAAE,eAAe,EAAE,EAC3B,GAAG,EAAE;IAAE,WAAW,CAAC,EAAE,WAAW,CAAA;CAAE,KAC/B,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,WAAW,GAAG,CACxB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE;IACH,sFAAsF;IACtF,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,KACE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AA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,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;;;OAQG;IACH,oBAAoB,CAAC,EAAE,OAAO,+BAA+B,EAAE,0BAA0B,CAAC;IAC1F;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B;;;;OAIG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B"}
|
package/dist/types.js
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* `reasoning_effort` directly. Hosts can pass either string form.
|
|
14
14
|
*/
|
|
15
15
|
export const MAESTRO_EFFORT_VALUES = ["low", "medium", "high", "xhigh", "max"];
|
|
16
|
-
export const SUPPORTED_AGENTS = ["
|
|
17
|
-
export const FALLBACK_AGENT = "
|
|
16
|
+
export const SUPPORTED_AGENTS = ["maestro"];
|
|
17
|
+
export const FALLBACK_AGENT = "maestro";
|
|
18
18
|
export function isAgentKind(value) {
|
|
19
19
|
return typeof value === "string" && SUPPORTED_AGENTS.includes(value);
|
|
20
20
|
}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA4EH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAU,CAAC;AAQxF,MAAM,CAAC,MAAM,gBAAgB,GAAyB,CAAC,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA4EH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAU,CAAC;AAQxF,MAAM,CAAC,MAAM,gBAAgB,GAAyB,CAAC,SAAS,CAAU,CAAC;AAC3E,MAAM,CAAC,MAAM,cAAc,GAAc,SAAS,CAAC;AAEnD,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,gBAAsC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC9F,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "maestro-agent-sdk",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Embeddable
|
|
3
|
+
"version": "0.1.39",
|
|
4
|
+
"description": "Embeddable TypeScript agent SDK for DeepSeek — built-in tools, skills, memory, and MCP.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Yeonwoo Jeong <aadd4020@gmail.com>",
|
|
7
7
|
"repository": {
|
|
@@ -16,30 +16,10 @@
|
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
17
|
"import": "./dist/index.js"
|
|
18
18
|
},
|
|
19
|
-
"./providers/anthropic": {
|
|
20
|
-
"types": "./dist/providers/anthropic.d.ts",
|
|
21
|
-
"import": "./dist/providers/anthropic.js"
|
|
22
|
-
},
|
|
23
19
|
"./providers/deepseek": {
|
|
24
20
|
"types": "./dist/providers/deepseek.d.ts",
|
|
25
21
|
"import": "./dist/providers/deepseek.js"
|
|
26
22
|
},
|
|
27
|
-
"./providers/codex": {
|
|
28
|
-
"types": "./dist/providers/codex.d.ts",
|
|
29
|
-
"import": "./dist/providers/codex.js"
|
|
30
|
-
},
|
|
31
|
-
"./providers/codex-auth": {
|
|
32
|
-
"types": "./dist/providers/codex-auth.d.ts",
|
|
33
|
-
"import": "./dist/providers/codex-auth.js"
|
|
34
|
-
},
|
|
35
|
-
"./providers/codex-stream": {
|
|
36
|
-
"types": "./dist/providers/codex-stream.d.ts",
|
|
37
|
-
"import": "./dist/providers/codex-stream.js"
|
|
38
|
-
},
|
|
39
|
-
"./providers/codex-translators": {
|
|
40
|
-
"types": "./dist/providers/codex-translators.d.ts",
|
|
41
|
-
"import": "./dist/providers/codex-translators.js"
|
|
42
|
-
},
|
|
43
23
|
"./tools": {
|
|
44
24
|
"types": "./dist/tools/index.d.ts",
|
|
45
25
|
"import": "./dist/tools/index.js"
|
|
@@ -66,8 +46,6 @@
|
|
|
66
46
|
"agent",
|
|
67
47
|
"ai-agent",
|
|
68
48
|
"llm",
|
|
69
|
-
"anthropic",
|
|
70
|
-
"claude",
|
|
71
49
|
"deepseek",
|
|
72
50
|
"mcp",
|
|
73
51
|
"tool-use",
|
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
import type { Provider, ProviderCompleteOptions, ProviderMessage, ProviderResponse, ProviderStreamChunk, ProviderToolSchema } from "../providers/base.js";
|
|
2
|
-
/** Anthropic cache-control marker. Wire-only — the rest of the Maestro
|
|
3
|
-
* pipeline uses pure `ProviderContentBlock` without this field. */
|
|
4
|
-
type CacheControl = {
|
|
5
|
-
type: "ephemeral";
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Raw Anthropic Messages API adapter.
|
|
9
|
-
*
|
|
10
|
-
* Uses fetch directly (no `@anthropic-ai/sdk` dependency) — keeps the dep
|
|
11
|
-
* surface minimal and lets hosts that already pull in the official SDK (or
|
|
12
|
-
* the higher-level `@anthropic-ai/claude-agent-sdk` Claude-CLI wrapper) use
|
|
13
|
-
* either side-by-side without version conflicts.
|
|
14
|
-
*
|
|
15
|
-
* Auth: `ANTHROPIC_API_KEY` env var. Independent from any OAuth-based
|
|
16
|
-
* Claude Code session the host process may have — passing an explicit key
|
|
17
|
-
* to the constructor takes precedence.
|
|
18
|
-
*/
|
|
19
|
-
export declare class AnthropicProvider implements Provider {
|
|
20
|
-
private readonly apiKey;
|
|
21
|
-
private readonly idleTimeoutMs;
|
|
22
|
-
private readonly totalTimeoutMs;
|
|
23
|
-
/**
|
|
24
|
-
* @param idleTimeoutMs Socket inactivity timeout for the request/stream
|
|
25
|
-
* (default 600_000, matching Hermes' large-context stale floor). Routed
|
|
26
|
-
* through `node:http` so it actually applies — Bun's global `fetch` caps
|
|
27
|
-
* every request at a hard ~300 s that no signal can raise (see
|
|
28
|
-
* `node-fetch.ts`). Resets on every byte, so long streams are never cut; it
|
|
29
|
-
* only bounds time-to-first-byte and mid-stream stalls.
|
|
30
|
-
* @param totalTimeoutMs Absolute wall-clock ceiling (default 1_800_000).
|
|
31
|
-
*/
|
|
32
|
-
constructor(apiKey: string, idleTimeoutMs?: number, totalTimeoutMs?: number);
|
|
33
|
-
static fromEnv(): AnthropicProvider;
|
|
34
|
-
complete(opts: ProviderCompleteOptions): Promise<ProviderResponse>;
|
|
35
|
-
/**
|
|
36
|
-
* Streaming variant of `complete()`. Sends the same request body with
|
|
37
|
-
* `stream: true`, parses the resulting SSE event stream into the small
|
|
38
|
-
* set of chunks the agent loop consumes (text_delta, tool_use_start /
|
|
39
|
-
* input_delta / complete, message_complete).
|
|
40
|
-
*
|
|
41
|
-
* The model's network shape is Anthropic SSE — events like
|
|
42
|
-
* `message_start`, `content_block_start`, `content_block_delta`,
|
|
43
|
-
* `content_block_stop`, `message_delta`, `message_stop`, plus periodic
|
|
44
|
-
* `ping` keepalives. Most are housekeeping; the loop only needs the
|
|
45
|
-
* deltas + tool_use lifecycle + terminal stop_reason / usage. Everything
|
|
46
|
-
* else is consumed and dropped by this adapter.
|
|
47
|
-
*/
|
|
48
|
-
stream(opts: ProviderCompleteOptions): AsyncGenerator<ProviderStreamChunk>;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Defensive scrub for thinking blocks that arrive at the wire builder without
|
|
52
|
-
* a usable `signature`. Anthropic's API requires every replayed `thinking`
|
|
53
|
-
* block to carry the original signature it produced; sending one without it
|
|
54
|
-
* trips a 400 `messages.N.content.M.thinking.signature: Field required`.
|
|
55
|
-
*
|
|
56
|
-
* In normal operation the streaming code already refuses to emit
|
|
57
|
-
* thinking blocks lacking a signature (see `content_block_stop` in the SSE
|
|
58
|
-
* handler), so this filter is belt-and-suspenders for two recovery cases:
|
|
59
|
-
*
|
|
60
|
-
* 1. A session persisted by an older SDK build (pre-v0.1.20) that DID
|
|
61
|
-
* emit signatureless thinking blocks now loads from disk. Without this
|
|
62
|
-
* filter, the first wire call after upgrading would 400 on the bad
|
|
63
|
-
* block.
|
|
64
|
-
*
|
|
65
|
-
* 2. A future provider-side transformation (compaction, dedup) accidentally
|
|
66
|
-
* drops the field. Filtering here gives us a single chokepoint to lock.
|
|
67
|
-
*
|
|
68
|
-
* Two complications the filter has to handle:
|
|
69
|
-
*
|
|
70
|
-
* - **Anthropic forbids mixing `thinking` and `text` after `tool_use` /
|
|
71
|
-
* `tool_result` in the same message.** Simply removing the bad thinking
|
|
72
|
-
* block can leave a message starting with `text` + `tool_use`, which is
|
|
73
|
-
* still valid. So we only drop the thinking block itself, not surrounding
|
|
74
|
-
* blocks.
|
|
75
|
-
*
|
|
76
|
-
* - **An assistant message can become content-empty after the filter.** A
|
|
77
|
-
* turn like `[thinking(broken)]` reduces to `[]`. Anthropic rejects empty
|
|
78
|
-
* content arrays, so we substitute a single empty text block as a
|
|
79
|
-
* placeholder — same trick `loop.ts` already uses for the scrubber-drops-
|
|
80
|
-
* everything case.
|
|
81
|
-
*/
|
|
82
|
-
export declare function sanitizeThinkingBlocksForWire(messages: readonly ProviderMessage[]): ProviderMessage[];
|
|
83
|
-
/**
|
|
84
|
-
* Convert the user-supplied `system` (plain string) into the array shape
|
|
85
|
-
* Anthropic accepts when you need a cache_control marker. A string slot
|
|
86
|
-
* has no cache field, so we lift it into a single text block and tag it
|
|
87
|
-
* ephemeral. Returning the original string unchanged when it's empty keeps
|
|
88
|
-
* the request shape minimal for prompt-less calls.
|
|
89
|
-
*/
|
|
90
|
-
export declare function buildCacheableSystem(system: string): string | Array<{
|
|
91
|
-
type: "text";
|
|
92
|
-
text: string;
|
|
93
|
-
cache_control: CacheControl;
|
|
94
|
-
}>;
|
|
95
|
-
/**
|
|
96
|
-
* Tag the last tool with cache_control so the (usually large) tool schema
|
|
97
|
-
* block lands in the cache after the first turn. Other tools are passed
|
|
98
|
-
* through verbatim — Anthropic caches the entire tools array prefix up to
|
|
99
|
-
* the last marker, so one breakpoint covers every preceding entry.
|
|
100
|
-
*
|
|
101
|
-
* Returns a new array; the caller's `opts.tools` reference is untouched so
|
|
102
|
-
* subsequent calls don't accumulate markers.
|
|
103
|
-
*/
|
|
104
|
-
export declare function buildCacheableTools(tools: readonly ProviderToolSchema[]): Array<ProviderToolSchema & {
|
|
105
|
-
cache_control?: CacheControl;
|
|
106
|
-
}>;
|
|
107
|
-
/**
|
|
108
|
-
* Tag the last block of the last message with cache_control. This is the
|
|
109
|
-
* rolling breakpoint that moves forward each turn — the second-to-last
|
|
110
|
-
* marker (set on the previous call) ages out into a regular cache prefix,
|
|
111
|
-
* which Anthropic will hit on the new call's read.
|
|
112
|
-
*
|
|
113
|
-
* Three message-shape cases:
|
|
114
|
-
* - last message is `{role, content: string}` → lift to a single text
|
|
115
|
-
* block with cache_control.
|
|
116
|
-
* - last message has a block array → shallow-clone the array and replace
|
|
117
|
-
* just the final block with a copy carrying cache_control.
|
|
118
|
-
* - empty content (defensive) → leave unchanged, no marker.
|
|
119
|
-
*
|
|
120
|
-
* Anthropic allows max 4 cache_control markers per request. With system
|
|
121
|
-
* + tools + this rolling one we sit at 3, leaving headroom; we still cap
|
|
122
|
-
* defensively in case a future change adds another slot.
|
|
123
|
-
*/
|
|
124
|
-
export declare function buildCacheableMessages(messages: readonly ProviderMessage[]): ProviderMessage[];
|
|
125
|
-
export declare const __cacheBreakpointCap = 4;
|
|
126
|
-
/**
|
|
127
|
-
* Patch `body` with the Anthropic extended-thinking payload when a budget is
|
|
128
|
-
* supplied. No-op when `budget` is undefined / 0 — the model emits no
|
|
129
|
-
* reasoning chain, same as claude/codex with effort omitted.
|
|
130
|
-
*
|
|
131
|
-
* Anthropic requires `max_tokens > thinking.budget_tokens`; if the caller's
|
|
132
|
-
* max_tokens is too small we lift it past `budget + 1024` so the API doesn't
|
|
133
|
-
* reject the request. Caller's explicit ceiling wins when it's already
|
|
134
|
-
* larger — we never SHRINK max_tokens.
|
|
135
|
-
*
|
|
136
|
-
* Thinking is only valid on Claude Sonnet 4 / Opus 4 / Haiku 4.5 (and later).
|
|
137
|
-
* maestroRegistry currently only ships sonnet, so we don't gate on model id
|
|
138
|
-
* here; if Phase 5 multi-provider lands an older model, the provider for
|
|
139
|
-
* that model just ignores `thinkingBudget` (this helper is Anthropic-only).
|
|
140
|
-
*/
|
|
141
|
-
export declare function applyThinkingBudget(body: Record<string, unknown>, budget: number | undefined): void;
|
|
142
|
-
/**
|
|
143
|
-
* Map the SDK's shared `EffortLevel` to an Anthropic thinking budget in
|
|
144
|
-
* tokens. Maestro accepts `low|medium|high|xhigh|max` (see
|
|
145
|
-
* `MAESTRO_EFFORT_VALUES`); other values return undefined so the caller skips
|
|
146
|
-
* thinking entirely.
|
|
147
|
-
*
|
|
148
|
-
* Scale (v0.1.19+ — aligned with the prompt-keyword tier ladder):
|
|
149
|
-
* - low → undefined (thinking off — latency-priority working mode)
|
|
150
|
-
* - medium → undefined (thinking off — default; matches Claude Code's
|
|
151
|
-
* "off unless asked" behavior. Persona text still
|
|
152
|
-
* shapes the model's working style, but the API
|
|
153
|
-
* ships without a `thinking` payload.)
|
|
154
|
-
* - high → 4 096 (T1 — same as the `think` / `생각해줘` keyword)
|
|
155
|
-
* - xhigh → 10 000 (T2 — same as `think hard` / `깊이 생각`)
|
|
156
|
-
* - max → 31 999 (T3 — same as `ultrathink` / `끝까지 생각`)
|
|
157
|
-
*
|
|
158
|
-
* Why only high/xhigh/max grant thinking: the lower three rungs are the
|
|
159
|
-
* conversational defaults where fast tool dispatch beats deeper reasoning
|
|
160
|
-
* (Telegram bot, chat UI, simple file ops). Users who want extended
|
|
161
|
-
* thinking either escalate via the effort knob explicitly or type the
|
|
162
|
-
* keyword in the prompt — both routes land on the same three tier budgets,
|
|
163
|
-
* so behavior is predictable across surfaces.
|
|
164
|
-
*
|
|
165
|
-
* Symmetry with `detectThinkingKeyword`: the three "on" tiers here mirror
|
|
166
|
-
* the three keyword tiers exactly. Whichever path activates thinking, the
|
|
167
|
-
* model sees one of {4096, 10000, 31999} — no fourth budget exists.
|
|
168
|
-
* `resolveThinkingBudget` (provider.ts) picks the higher of the two if
|
|
169
|
-
* both fire, so an `effort: "high"` call that happens to contain
|
|
170
|
-
* "ultrathink" in the prompt still gets T3, not T1.
|
|
171
|
-
*
|
|
172
|
-
* Budgets are *ceilings*, not enforced spending: the model decides how
|
|
173
|
-
* much to actually emit inside the budget. A 31999 ceiling on a simple
|
|
174
|
-
* task still costs almost nothing — the savings come from latency
|
|
175
|
-
* (model returns sooner when it knows the budget is smaller).
|
|
176
|
-
*/
|
|
177
|
-
export declare function effortToThinkingBudget(e: string | undefined): number | undefined;
|
|
178
|
-
/**
|
|
179
|
-
* Claude Code-style think-keyword detection.
|
|
180
|
-
*
|
|
181
|
-
* Scans the caller's user prompt for an explicit "think harder" cue. When
|
|
182
|
-
* present, returns the matching thinking-budget tier; otherwise returns
|
|
183
|
-
* undefined (the loop then ships the call with thinking disabled — same
|
|
184
|
-
* default Claude Code uses).
|
|
185
|
-
*
|
|
186
|
-
* Why this exists alongside `effortToThinkingBudget`:
|
|
187
|
-
* - `effort` is a *programmatic* knob set by the SDK consumer (CLI flag,
|
|
188
|
-
* config file, server-side default). It's awkward to plumb through
|
|
189
|
-
* conversational surfaces like a Telegram bot or chat UI where the user
|
|
190
|
-
* just types text.
|
|
191
|
-
* - The keyword path lets end-users toggle thinking via the prompt itself
|
|
192
|
-
* ("think harder", "끝까지 생각해줘") without the host having to wire
|
|
193
|
-
* UI for an effort selector. This matches Claude Code's behavior and
|
|
194
|
-
* is what users coming from CC instinctively try.
|
|
195
|
-
*
|
|
196
|
-
* Tier mapping mirrors Claude Code's documented set:
|
|
197
|
-
* tier 3 (max) → 31999 tokens — "ultrathink", "think harder",
|
|
198
|
-
* "끝까지 생각", "심층 생각"
|
|
199
|
-
* tier 2 (deep) → 10000 tokens — "think hard", "think a lot",
|
|
200
|
-
* "깊이 생각", "깊게 생각"
|
|
201
|
-
* tier 1 (basic) → 4096 tokens — "think" (English), "생각해줘" /
|
|
202
|
-
* "생각해봐" / "잘 생각" (Korean)
|
|
203
|
-
*
|
|
204
|
-
* Why 31999 (not 32768): Anthropic requires `max_tokens > budget`, and
|
|
205
|
-
* 31999 + 1024 = 33023 stays under the 64K max_tokens ceiling on sonnet-4-6
|
|
206
|
-
* while leaving room for the final text response. Picking 32768 would force
|
|
207
|
-
* max_tokens to ≥ 33792 which loses headroom for long answers.
|
|
208
|
-
*
|
|
209
|
-
* Why "think" word-boundary on English but substring on Korean:
|
|
210
|
-
* English splits with whitespace so `\bthink\b` cleanly avoids false hits
|
|
211
|
-
* on "thinking" / "rethink". Korean morphology glues particles to verbs
|
|
212
|
-
* ("생각해줘" / "생각해봐"), so we substring-match the verb stem and accept
|
|
213
|
-
* the false-positive rate (a Korean user saying "그는 잘 생각해" in a code
|
|
214
|
-
* snippet would unintentionally trigger — same trade-off CC made in
|
|
215
|
-
* English).
|
|
216
|
-
*
|
|
217
|
-
* Highest tier wins: if both "think" and "ultrathink" appear (e.g. "think
|
|
218
|
-
* about this — actually ultrathink"), we honor the higher budget. Tier
|
|
219
|
-
* ordering matters because tier-3 substrings contain tier-1's pattern.
|
|
220
|
-
*
|
|
221
|
-
* Pure helper — no side effects, safe to call on every turn. Exposed for
|
|
222
|
-
* tests and for hosts that want to compose their own keyword surfaces
|
|
223
|
-
* (e.g. add Japanese keywords without forking).
|
|
224
|
-
*/
|
|
225
|
-
export declare function detectThinkingKeyword(prompt: string | undefined): number | undefined;
|
|
226
|
-
/**
|
|
227
|
-
* Resolve the actual thinking budget the loop should send on *this turn*,
|
|
228
|
-
* given the base budget (already derived from effort) and the turn's
|
|
229
|
-
* position within the iteration cap.
|
|
230
|
-
*
|
|
231
|
-
* Why turn-adaptive:
|
|
232
|
-
* - Turn 0 (first call) is where the model parses the prompt and lays
|
|
233
|
-
* out its plan. Thinking here is the highest-ROI use of budget —
|
|
234
|
-
* a careful plan saves tool calls later. We send the full base.
|
|
235
|
-
* - Mid turns are tool-dispatch territory: "this grep returned X,
|
|
236
|
-
* now read Y." Interleaved thinking still has value (short
|
|
237
|
-
* reasoning between tool calls is what Anthropic's interleaved
|
|
238
|
-
* beta is for), so we keep the full base here too. Cutting it
|
|
239
|
-
* mid-flow defeats the beta.
|
|
240
|
-
* - The last 3 turns are the *wrap-up zone*. The iteration reminder
|
|
241
|
-
* has already flipped to "finalize NOW, stop tooling and write the
|
|
242
|
-
* final answer." At that point spending another 16K thinking on a
|
|
243
|
-
* turn that mostly emits final text is pure latency waste. We trim
|
|
244
|
-
* to 1/4 of base — enough room for a short "what should this
|
|
245
|
-
* summary include" pass, no room for fresh exploration.
|
|
246
|
-
*
|
|
247
|
-
* Floor: the trimmed budget is clamped to >= 1024 because Anthropic
|
|
248
|
-
* requires `thinking.budget_tokens >= 1024` when thinking is enabled.
|
|
249
|
-
* Returning a value below that would 400 the API. If the caller passed
|
|
250
|
-
* a base smaller than 1024 (shouldn't happen with our effort map, but
|
|
251
|
-
* a host could override), we just return the base as-is — the original
|
|
252
|
-
* `applyThinkingBudget` no-ops zero / undefined, and the user explicitly
|
|
253
|
-
* asked for less.
|
|
254
|
-
*
|
|
255
|
-
* Pure helper — no allocation, no closure — so loop.ts can call it
|
|
256
|
-
* cheaply inside the hot iteration loop. Exported for tests and for
|
|
257
|
-
* hosts that want to compose their own per-turn budgeting.
|
|
258
|
-
*/
|
|
259
|
-
export declare function thinkingBudgetForTurn(base: number | undefined, iter: number, maxIter: number): number | undefined;
|
|
260
|
-
/**
|
|
261
|
-
* Single source of truth for "is this turn in the wrap-up zone?" Used by
|
|
262
|
-
* three call sites that must all fire on the same boundary:
|
|
263
|
-
* 1. `thinkingBudgetForTurn` — trims the per-turn thinking budget.
|
|
264
|
-
* 2. `loop.ts` callOpts assembly — empties the tools schema (v0.1.17+).
|
|
265
|
-
* 3. `wrapUpOverlayLine` (provider.ts) — emits the reminder cue.
|
|
266
|
-
*
|
|
267
|
-
* Threshold logic:
|
|
268
|
-
* - Tiny caps (`maxIter <= 3`) — return false unconditionally.
|
|
269
|
-
* At maxIter=3 every turn is already a wrap-up turn; gating tools
|
|
270
|
-
* would mean the model can't call any tools from turn 1, which
|
|
271
|
-
* defeats the cap's purpose. Tiny caps trust the model + the
|
|
272
|
-
* iter-line tone to wind things down on their own.
|
|
273
|
-
* - Turn 0 — never wrap-up. The first turn is planning and must
|
|
274
|
-
* keep full capability even when `maxIter` is small (e.g. maxIter=4
|
|
275
|
-
* would otherwise gate the planning turn, which is exactly when
|
|
276
|
-
* the model needs tools most).
|
|
277
|
-
* - Last 3 turns (`maxIter - iter <= 3`) — wrap-up active.
|
|
278
|
-
*
|
|
279
|
-
* Why "last 3" and not "last 1": the model needs at least one full
|
|
280
|
-
* turn after entering wrap-up to actually synthesize and emit the
|
|
281
|
-
* final answer. With a 3-turn lead-in: turn N-3 enters wrap-up (no
|
|
282
|
-
* more tools), turns N-2 / N-1 can iterate on the final text if the
|
|
283
|
-
* first attempt was incomplete, turn N-0 is the hard ceiling.
|
|
284
|
-
*/
|
|
285
|
-
export declare function isWrapUpZone(iter: number, maxIter: number): boolean;
|
|
286
|
-
/**
|
|
287
|
-
* Build a system-prompt persona block that names the active effort level
|
|
288
|
-
* AND prescribes concrete behavior the model should adopt this turn.
|
|
289
|
-
*
|
|
290
|
-
* Why a system-prompt block (not a system-reminder line):
|
|
291
|
-
* - First-turn visibility. The per-iteration reminder lives in the user
|
|
292
|
-
* message and is reread each turn, but its `Tool iterations remaining`
|
|
293
|
-
* tone only shifts as the budget drains — at the start of an `xhigh`
|
|
294
|
-
* vs `low` run the model sees nearly identical text. A system-prompt
|
|
295
|
-
* persona lets the model condition every token from turn 1 on the
|
|
296
|
-
* working mode, instead of inferring it indirectly from `maxIter`.
|
|
297
|
-
* - Cache stability. The block is a pure function of `effort`, so the
|
|
298
|
-
* same five strings cycle through every call at a given level. They
|
|
299
|
-
* sit between caller `systemPrompt` and the skills catalog, riding
|
|
300
|
-
* the same prefix-cache boundary that already covers both — no extra
|
|
301
|
-
* invalidations.
|
|
302
|
-
*
|
|
303
|
-
* Effort-shape rationale (terse imperatives win over hedged paragraphs —
|
|
304
|
-
* the model conditions hardest on action verbs, not adjectives):
|
|
305
|
-
* - `low` — answer fast, one Read max, no verification
|
|
306
|
-
* - `medium` — one focused exploration, light cross-check
|
|
307
|
-
* - `high` — multi-file exploration, verify on doubt
|
|
308
|
-
* - `xhigh` — broad survey, hold multiple hypotheses, name edge cases
|
|
309
|
-
* - `max` — exhaustive: every relevant file, tests, all failure modes
|
|
310
|
-
*
|
|
311
|
-
* All five levels emit exactly four bullets (v0.1.16+). Uniform shape
|
|
312
|
-
* keeps the prefix-cache boundary identical-length across levels and
|
|
313
|
-
* makes A/B telemetry honest — a longer level can't outperform a shorter
|
|
314
|
-
* one just because the model had more text to condition on.
|
|
315
|
-
*
|
|
316
|
-
* Returns `undefined` for an unknown / absent effort so callers can skip
|
|
317
|
-
* concatenation entirely; the model then sees only the caller's system
|
|
318
|
-
* prompt, preserving the historical no-effort baseline.
|
|
319
|
-
*
|
|
320
|
-
* Lives in anthropic.ts next to `effortToThinkingBudget` for grep affinity,
|
|
321
|
-
* but the string itself is provider-agnostic — DeepSeek receives the same
|
|
322
|
-
* block via the same caller (provider.ts), so the persona cue is consistent
|
|
323
|
-
* across providers even when `reasoning_effort` is the only native handle
|
|
324
|
-
* the API exposes.
|
|
325
|
-
*/
|
|
326
|
-
export declare function effortToPersonaPrompt(e: string | undefined): string | undefined;
|
|
327
|
-
export {};
|
|
328
|
-
//# sourceMappingURL=anthropic.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,uBAAuB,EAEvB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAQ1B;oEACoE;AACpE,KAAK,YAAY,GAAG;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC;AAwB1C;;;;;;;;;;;GAWG;AACH,qBAAa,iBAAkB,YAAW,QAAQ;IAW9C,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAZjC;;;;;;;;OAQG;gBAEgB,MAAM,EAAE,MAAM,EACd,aAAa,GAAE,MAAgB,EAC/B,cAAc,GAAE,MAAkB;IAGrD,MAAM,CAAC,OAAO,IAAI,iBAAiB;IAQ7B,QAAQ,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAqDxE;;;;;;;;;;;;OAYG;IACI,MAAM,CAAC,IAAI,EAAE,uBAAuB,GAAG,cAAc,CAAC,mBAAmB,CAAC;CAmNlF;AA6ED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,SAAS,eAAe,EAAE,GACnC,eAAe,EAAE,CAuBnB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB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