strands-darwin 0.0.52 → 0.0.54
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 +10 -3
- package/README.zh-CN.md +10 -3
- package/dist/patches/{@strands-agents+sdk+1.20.0.patch → @strands-agents+sdk+1.25.0.patch} +75 -50
- package/dist/src/agent/compact.js +1 -1
- package/dist/src/agent/prompt-steering.d.ts +21 -0
- package/dist/src/agent/prompt-steering.js +58 -0
- package/dist/src/agent/prompt-steering.js.map +1 -0
- package/dist/src/agent/prompt-suggestion.d.ts +22 -0
- package/dist/src/agent/prompt-suggestion.js +120 -0
- package/dist/src/agent/prompt-suggestion.js.map +1 -0
- package/dist/src/agent/runtime.d.ts +10 -1
- package/dist/src/agent/runtime.js +68 -3
- package/dist/src/agent/runtime.js.map +1 -1
- package/dist/src/agent/sdk-logging.js +7 -6
- package/dist/src/agent/sdk-logging.js.map +1 -1
- package/dist/src/agent/session-recap.d.ts +30 -0
- package/dist/src/agent/session-recap.js +98 -0
- package/dist/src/agent/session-recap.js.map +1 -0
- package/dist/src/cli-main.js +5 -1
- package/dist/src/cli-main.js.map +1 -1
- package/dist/src/commands/custom-commands.d.ts +1 -1
- package/dist/src/commands/custom-commands.js +2 -1
- package/dist/src/commands/custom-commands.js.map +1 -1
- package/dist/src/commands/recap-command.d.ts +4 -0
- package/dist/src/commands/recap-command.js +10 -0
- package/dist/src/commands/recap-command.js.map +1 -0
- package/dist/src/commands/review-command.d.ts +3 -1
- package/dist/src/commands/review-command.js +21 -2
- package/dist/src/commands/review-command.js.map +1 -1
- package/dist/src/config.d.ts +18 -7
- package/dist/src/config.js +55 -22
- package/dist/src/config.js.map +1 -1
- package/dist/src/dev-repl.js +7 -4
- package/dist/src/dev-repl.js.map +1 -1
- package/dist/src/headless-runner.js +4 -3
- package/dist/src/headless-runner.js.map +1 -1
- package/dist/src/mcp/codegraph-preflight.js +23 -16
- package/dist/src/mcp/codegraph-preflight.js.map +1 -1
- package/dist/src/mcp/web-search-empty-results.js +23 -15
- package/dist/src/mcp/web-search-empty-results.js.map +1 -1
- package/dist/src/model-headers-command.d.ts +30 -0
- package/dist/src/model-headers-command.js +354 -0
- package/dist/src/model-headers-command.js.map +1 -0
- package/dist/src/npm-package/patch-package-format.d.ts +5 -5
- package/dist/src/npm-package/patch-package-format.js +4 -4
- package/dist/src/sdk-patch-preflight.js +1 -1
- package/dist/src/trajectory/record.d.ts +3 -1
- package/dist/src/trajectory/record.js.map +1 -1
- package/dist/src/trajectory/rewind-history.js +2 -2
- package/dist/src/trajectory/rewind-history.js.map +1 -1
- package/dist/src/trajectory/writer.d.ts +4 -2
- package/dist/src/trajectory/writer.js +14 -2
- package/dist/src/trajectory/writer.js.map +1 -1
- package/dist/src/tui/App.d.ts +3 -1
- package/dist/src/tui/App.js +234 -17
- package/dist/src/tui/App.js.map +1 -1
- package/dist/src/tui/InputBox.d.ts +4 -2
- package/dist/src/tui/InputBox.js +3 -3
- package/dist/src/tui/InputBox.js.map +1 -1
- package/dist/src/tui/help-format.d.ts +1 -1
- package/dist/src/tui/help-format.js +1 -1
- package/dist/src/tui/prompt-queue.d.ts +7 -4
- package/dist/src/tui/prompt-queue.js +17 -4
- package/dist/src/tui/prompt-queue.js.map +1 -1
- package/dist/src/tui/prompt-suggestion.d.ts +31 -0
- package/dist/src/tui/prompt-suggestion.js +65 -0
- package/dist/src/tui/prompt-suggestion.js.map +1 -0
- package/dist/src/tui/session-recap.d.ts +36 -0
- package/dist/src/tui/session-recap.js +109 -0
- package/dist/src/tui/session-recap.js.map +1 -0
- package/dist/src/tui/terminal-focus.d.ts +29 -0
- package/dist/src/tui/terminal-focus.js +128 -0
- package/dist/src/tui/terminal-focus.js.map +1 -0
- package/package.json +3 -3
|
@@ -4,7 +4,7 @@ import { extensionRoots } from '../paths.js';
|
|
|
4
4
|
export const COMMANDS_DIRNAME = 'commands';
|
|
5
5
|
export const ARGUMENTS_PLACEHOLDER = '$ARGUMENTS';
|
|
6
6
|
/** Commands shown in completion, in their stable display order. */
|
|
7
|
-
export const BUILTIN_COMMAND_NAMES = ['agents', 'clear', 'cloud-memory', 'collaborate', 'compact', 'context', 'copy', 'diff', 'effort', 'exit', 'export', 'goal', 'help', 'init', 'list-agents', 'mcp', 'memory', 'mode', 'model', 'permissions', 'rename', 'review', 'rewind', 'sessions', 'setup-agentcore-memory', 'status', 'tangent', 'tasks', 'trajectory', 'usage', 'workflow'];
|
|
7
|
+
export const BUILTIN_COMMAND_NAMES = ['agents', 'clear', 'cloud-memory', 'collaborate', 'compact', 'context', 'copy', 'diff', 'effort', 'exit', 'export', 'goal', 'help', 'init', 'list-agents', 'mcp', 'memory', 'mode', 'model', 'permissions', 'recap', 'rename', 'review', 'rewind', 'sessions', 'setup-agentcore-memory', 'status', 'tangent', 'tasks', 'trajectory', 'usage', 'workflow'];
|
|
8
8
|
/**
|
|
9
9
|
* One-phrase completion-row descriptions, total over {@link BUILTIN_COMMAND_NAMES}
|
|
10
10
|
* by construction: the `Record` over the name union makes a missing or extra
|
|
@@ -49,6 +49,7 @@ export const BUILTIN_COMMAND_DESCRIPTIONS = {
|
|
|
49
49
|
// Rules, not the mode: /permissions lists allow- and deny-rules and revokes
|
|
50
50
|
// allow-rules (what runs silently); /mode moves how much everything else asks.
|
|
51
51
|
permissions: 'list/test allow/deny rules, revoke allow-rules',
|
|
52
|
+
recap: 'generate a short session recap (local human, idle TUI only)',
|
|
52
53
|
rename: 'set this session’s display label: /rename <label>',
|
|
53
54
|
// Prompt guidance only; the active permission mode still governs tool calls.
|
|
54
55
|
review: 'review current changes for bugs and test gaps',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-commands.js","sourceRoot":"","sources":["../../../src/commands/custom-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,IAAI,MAAM,WAAW,CAAC;A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;IAE1C,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAChF,MAAM,IAAI,GAAG,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1E,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAC3G,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAEvC,OAAO;QACL,OAAO;QACP,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC;YACtD,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,qBAAqB,EAAE,IAAI,CAAC;YACzD,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,OAAO,IAAI,EAAE;KACpE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Only the interactive local-human submit path may generate a recap. */
|
|
2
|
+
export declare const RECAP_USAGE = "Usage: /recap (no arguments)";
|
|
3
|
+
export declare const RECAP_UNSUPPORTED = "/recap requires an explicit local human request in the interactive TUI; no recap generated";
|
|
4
|
+
export declare function parseRecapCommand(input: string): 'recap' | 'usage' | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Only the interactive local-human submit path may generate a recap. */
|
|
2
|
+
export const RECAP_USAGE = 'Usage: /recap (no arguments)';
|
|
3
|
+
export const RECAP_UNSUPPORTED = '/recap requires an explicit local human request in the interactive TUI; no recap generated';
|
|
4
|
+
export function parseRecapCommand(input) {
|
|
5
|
+
const text = input.trim();
|
|
6
|
+
if (!/^\/recap(?:\s|$)/iu.test(text))
|
|
7
|
+
return undefined;
|
|
8
|
+
return /^\/recap$/iu.test(text) ? 'recap' : 'usage';
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=recap-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recap-command.js","sourceRoot":"","sources":["../../../src/commands/recap-command.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,MAAM,CAAC,MAAM,WAAW,GAAG,8BAA8B,CAAC;AAC1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,4FAA4F,CAAC;AAC9H,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC1B,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IACvD,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;AACtD,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `/review [focus]
|
|
2
|
+
* `/review [focus]`, `/review --commit <SHA>` and `/review --base <SHA>` are ordinary user prompts,
|
|
3
3
|
* not a review executor or a read-only mode. Keep expansion pure; the existing
|
|
4
4
|
* permission gate remains authoritative over any tools the model subsequently requests.
|
|
5
5
|
*/
|
|
6
6
|
export declare const REVIEW_COMMAND_NAME = "review";
|
|
7
7
|
export declare const REVIEW_COMMIT_USAGE = "Usage: /review --commit <40-hex-SHA>";
|
|
8
|
+
export declare const REVIEW_BASE_USAGE = "Usage: /review --base <40-hex-SHA>";
|
|
8
9
|
/** Exact, case-insensitive name grammar shared with the other prompt built-ins. */
|
|
9
10
|
export declare function parseReviewCommand(input: string): {
|
|
10
11
|
message: string;
|
|
@@ -12,4 +13,5 @@ export declare function parseReviewCommand(input: string): {
|
|
|
12
13
|
} | {
|
|
13
14
|
message?: undefined;
|
|
14
15
|
invalid: true;
|
|
16
|
+
usage: string;
|
|
15
17
|
} | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `/review [focus]
|
|
2
|
+
* `/review [focus]`, `/review --commit <SHA>` and `/review --base <SHA>` are ordinary user prompts,
|
|
3
3
|
* not a review executor or a read-only mode. Keep expansion pure; the existing
|
|
4
4
|
* permission gate remains authoritative over any tools the model subsequently requests.
|
|
5
5
|
*/
|
|
@@ -22,6 +22,21 @@ const COMMIT_PROMPT = 'Review commit %SHA% only. Inspect the repository instruct
|
|
|
22
22
|
'state the limitation honestly and do not invent a diff or findings. State any other unverified ' +
|
|
23
23
|
'limits, including tests not run. Do not edit files or make commits. This is review guidance, ' +
|
|
24
24
|
'not an enforced read-only mode; the existing permission gate remains authoritative.';
|
|
25
|
+
export const REVIEW_BASE_USAGE = 'Usage: /review --base <40-hex-SHA>';
|
|
26
|
+
const BASE_PROMPT = 'Review committed changes from the unique merge base of %SHA% and HEAD to HEAD only. ' +
|
|
27
|
+
'Inspect the repository instructions. Resolve the supplied exact commit and HEAD as commit objects ' +
|
|
28
|
+
'at inspection time; report their actual SHAs and the unique merge base SHA. HEAD is not pinned by ' +
|
|
29
|
+
'the slash parser. If either object is missing or cannot be inspected, HEAD is unborn, histories ' +
|
|
30
|
+
'are unrelated, or multiple merge bases exist, report the limitation and stop. Do not guess or ' +
|
|
31
|
+
'choose a base, fetch objects, or invent a diff or findings. Review only the committed diff from ' +
|
|
32
|
+
'that unique merge base to the resolved HEAD, with surrounding code and relevant tests from that ' +
|
|
33
|
+
'committed scope. Explicitly exclude staged, unstaged and untracked changes. If the diff is empty, ' +
|
|
34
|
+
'state that the selected scope has no committed changes; do not claim the working tree is clean. ' +
|
|
35
|
+
'Report actionable bugs in priority order, with file/line evidence and impact. List test gaps ' +
|
|
36
|
+
'separately; avoid speculative or style-only findings. If no actionable bugs are found, say so. ' +
|
|
37
|
+
'Honestly state anything not inspected or verified, including tests not run. Do not checkout, ' +
|
|
38
|
+
'fetch, edit files or make commits. This is review guidance, not an enforced read-only mode or ' +
|
|
39
|
+
'a guarantee of review correctness; the existing permission gate remains authoritative.';
|
|
25
40
|
/** Exact, case-insensitive name grammar shared with the other prompt built-ins. */
|
|
26
41
|
export function parseReviewCommand(input) {
|
|
27
42
|
const trimmed = input.trim();
|
|
@@ -35,7 +50,11 @@ export function parseReviewCommand(input) {
|
|
|
35
50
|
const focus = separator === -1 ? '' : withoutSlash.slice(separator).trim();
|
|
36
51
|
if (/^--commit(?:\s|$|=)/.test(focus)) {
|
|
37
52
|
const match = focus.match(/^--commit\s+([0-9a-fA-F]{40})$/);
|
|
38
|
-
return match === null ? { invalid: true } : { message: COMMIT_PROMPT.replace('%SHA%', match[1]) };
|
|
53
|
+
return match === null ? { invalid: true, usage: REVIEW_COMMIT_USAGE } : { message: COMMIT_PROMPT.replace('%SHA%', match[1]) };
|
|
54
|
+
}
|
|
55
|
+
if (/^--base(?:\s|$|=)/.test(focus)) {
|
|
56
|
+
const match = focus.match(/^--base\s+([0-9a-fA-F]{40})$/);
|
|
57
|
+
return match === null ? { invalid: true, usage: REVIEW_BASE_USAGE } : { message: BASE_PROMPT.replace('%SHA%', match[1]) };
|
|
39
58
|
}
|
|
40
59
|
return { message: REVIEW_PROMPT + (focus === '' ? '' : `\n\nFocus: ${focus}`) };
|
|
41
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-command.js","sourceRoot":"","sources":["../../../src/commands/review-command.ts"],"names":[],"mappings":"AAAA;;;;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KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,KAAK,EAAE,CAAC,EAAE,CAAC;AAClF,CAAC"}
|
package/dist/src/config.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { type CodexHooksConfig } from './hooks/codex-hooks.js';
|
|
|
6
6
|
import type { ToolHooksConfig } from './hooks/tool-hooks.js';
|
|
7
7
|
import { type AgentCoreConfig } from './agentcore/config.js';
|
|
8
8
|
import { type ProjectOverrides } from './project-overrides.js';
|
|
9
|
+
import { type HeadersCommandConfig } from './model-headers-command.js';
|
|
9
10
|
/** Raised for malformed or unusable configuration. Always carries a fix hint. */
|
|
10
11
|
export declare class ConfigError extends Error {
|
|
11
12
|
constructor(message: string);
|
|
@@ -68,12 +69,13 @@ export interface ModelFields {
|
|
|
68
69
|
/** Env var holding the API key, for providers that need one. */
|
|
69
70
|
apiKeyEnv?: string;
|
|
70
71
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* {@link resolveAnthropicBaseUrl}. Must be an `http:` or `https:` URL.
|
|
72
|
+
* Direct Anthropic or OpenAI compatible endpoint. Falls back to the provider's
|
|
73
|
+
* base-URL environment variable, then its client default. Must be an http(s) URL;
|
|
74
|
+
* mutually exclusive with OpenAI's AWS endpoint switches.
|
|
75
75
|
*/
|
|
76
76
|
baseUrl?: string;
|
|
77
|
+
/** OpenAI only: bounded user-configured auth-header helper; requires explicit baseUrl. */
|
|
78
|
+
headersCommand?: HeadersCommandConfig;
|
|
77
79
|
/**
|
|
78
80
|
* `openai` provider only: route requests through Amazon Bedrock's
|
|
79
81
|
* OpenAI-compatible "Mantle" endpoint instead of `api.openai.com`, reaching
|
|
@@ -249,6 +251,10 @@ export interface SessionFields {
|
|
|
249
251
|
* the resolved boolean.
|
|
250
252
|
*/
|
|
251
253
|
backgroundTaskWake?: boolean;
|
|
254
|
+
/** Interactive next-prompt side call; default on, false makes no calls or timers. */
|
|
255
|
+
promptSuggestions?: boolean;
|
|
256
|
+
/** Away/return recap; independent default-on automatic control. /recap stays manual. */
|
|
257
|
+
sessionRecap?: boolean;
|
|
252
258
|
/**
|
|
253
259
|
* Check npm for a newer `strands-darwin` when the interactive TUI starts (at most
|
|
254
260
|
* once per 24h, cached in `~/.darwin/update-check.json`, see `update-check.ts`) and
|
|
@@ -367,14 +373,14 @@ export declare const CONFIG_FILENAME = "config.json";
|
|
|
367
373
|
* tables against the schema: with unknown keys refused, a key the docs promise
|
|
368
374
|
* but this list lacks would be a documented setting nobody can write.
|
|
369
375
|
*/
|
|
370
|
-
export declare const MODEL_KEYS: readonly ['provider', 'name', 'model', 'region', 'apiKeyEnv', 'baseUrl', 'bedrockMantle', 'bedrockRuntime', 'openaiApi', 'maxTokens', 'contextWindowLimit', 'thinkingEffort', 'promptCache', 'promptCacheTtl', 'classifierModel', 'requestTimeoutMs'];
|
|
376
|
+
export declare const MODEL_KEYS: readonly ['provider', 'name', 'model', 'region', 'apiKeyEnv', 'baseUrl', 'headersCommand', 'bedrockMantle', 'bedrockRuntime', 'openaiApi', 'maxTokens', 'contextWindowLimit', 'thinkingEffort', 'promptCache', 'promptCacheTtl', 'classifierModel', 'requestTimeoutMs'];
|
|
371
377
|
/**
|
|
372
378
|
* Keys that describe *the session*, not the model: they outlive a model switch
|
|
373
379
|
* and so always live at the root, never in a `models` entry. A permission mode
|
|
374
380
|
* that silently applied to one model and not another would be a security
|
|
375
381
|
* surprise, which is why an entry carrying one is rejected rather than ignored.
|
|
376
382
|
*/
|
|
377
|
-
export declare const SESSION_KEYS: readonly ['permissionMode', 'hooks', 'summaryRatio', 'preserveRecentMessages', 'contextWarnRatio', 'streamIdleTimeoutSeconds', 'contextOffload', 'maxResultTokens', 'terminalBell', 'terminalNotify', 'terminalTitle', 'backgroundTaskWake', 'updateCheck', 'trustPeers', 'shellEnv', 'trajectory', 'diagnostics', 'memory', 'memoryHorizonDays', 'agentCoreMemory', 'projectOverrides', 'maxConcurrentSubagents', 'systemPrompt', 'maxInstructionsBytes'];
|
|
383
|
+
export declare const SESSION_KEYS: readonly ['permissionMode', 'hooks', 'summaryRatio', 'preserveRecentMessages', 'contextWarnRatio', 'streamIdleTimeoutSeconds', 'contextOffload', 'maxResultTokens', 'terminalBell', 'terminalNotify', 'terminalTitle', 'backgroundTaskWake', 'promptSuggestions', 'sessionRecap', 'updateCheck', 'trustPeers', 'shellEnv', 'trajectory', 'diagnostics', 'memory', 'memoryHorizonDays', 'agentCoreMemory', 'projectOverrides', 'maxConcurrentSubagents', 'systemPrompt', 'maxInstructionsBytes'];
|
|
378
384
|
/**
|
|
379
385
|
* `~/.darwin/config.json`, derived and nothing else: no directory is created.
|
|
380
386
|
*
|
|
@@ -612,7 +618,12 @@ export declare function saveEnabledModel(projectRoot: string, index: number): Pr
|
|
|
612
618
|
* require peer dependencies (`@anthropic-ai/sdk`, `openai`) that a Bedrock-only
|
|
613
619
|
* install does not have. A static import would break the default setup.
|
|
614
620
|
*/
|
|
615
|
-
|
|
621
|
+
/** Internal side-call transport policy, never a user config or an Agent retry policy. */
|
|
622
|
+
export interface ModelCallOptions {
|
|
623
|
+
readonly singleAttempt?: boolean;
|
|
624
|
+
readonly cancelSignal?: AbortSignal;
|
|
625
|
+
}
|
|
626
|
+
export declare function createModelFromConfig(config: AppConfig, call?: ModelCallOptions): Promise<Model>;
|
|
616
627
|
/** The OpenAI-compatible surface of the Bedrock runtime endpoint in `region`. */
|
|
617
628
|
export declare function bedrockRuntimeOpenAIBaseUrl(region: string): string;
|
|
618
629
|
/**
|
package/dist/src/config.js
CHANGED
|
@@ -20,6 +20,7 @@ import { passthroughEntryProblem } from './tools/shell-env.js';
|
|
|
20
20
|
import { parseAgentCoreConfig } from './agentcore/config.js';
|
|
21
21
|
import { readConfigBytes, updateConfigFile } from './config-file.js';
|
|
22
22
|
import { effectiveCloudPolicy, parseProjectOverrides } from './project-overrides.js';
|
|
23
|
+
import { createHeadersCommandClient, protectHeadersCommandModel, parseHeadersCommand, headersCommandBaseUrlProblem } from './model-headers-command.js';
|
|
23
24
|
/** Raised for malformed or unusable configuration. Always carries a fix hint. */
|
|
24
25
|
export class ConfigError extends Error {
|
|
25
26
|
constructor(message) {
|
|
@@ -52,6 +53,7 @@ export const MODEL_KEYS = [
|
|
|
52
53
|
'region',
|
|
53
54
|
'apiKeyEnv',
|
|
54
55
|
'baseUrl',
|
|
56
|
+
'headersCommand',
|
|
55
57
|
'bedrockMantle',
|
|
56
58
|
'bedrockRuntime',
|
|
57
59
|
'openaiApi',
|
|
@@ -82,6 +84,8 @@ export const SESSION_KEYS = [
|
|
|
82
84
|
'terminalNotify',
|
|
83
85
|
'terminalTitle',
|
|
84
86
|
'backgroundTaskWake',
|
|
87
|
+
'promptSuggestions',
|
|
88
|
+
'sessionRecap',
|
|
85
89
|
'updateCheck',
|
|
86
90
|
'trustPeers',
|
|
87
91
|
'shellEnv',
|
|
@@ -137,6 +141,8 @@ const DEFAULTS = {
|
|
|
137
141
|
terminalNotify: false,
|
|
138
142
|
terminalTitle: true,
|
|
139
143
|
backgroundTaskWake: true,
|
|
144
|
+
promptSuggestions: true,
|
|
145
|
+
sessionRecap: true,
|
|
140
146
|
updateCheck: true,
|
|
141
147
|
trustPeers: false,
|
|
142
148
|
memory: true,
|
|
@@ -696,19 +702,37 @@ function validateModelFields(input, where) {
|
|
|
696
702
|
const apiKeyEnv = stringField(input, 'apiKeyEnv', where);
|
|
697
703
|
if (apiKeyEnv !== undefined)
|
|
698
704
|
fields.apiKeyEnv = apiKeyEnv;
|
|
699
|
-
//
|
|
700
|
-
// and fail on the first request with a fetch error that names neither the file
|
|
701
|
-
// nor the key.
|
|
705
|
+
// Direct-provider endpoint, validated before constructing the client.
|
|
702
706
|
const baseUrl = stringField(input, 'baseUrl', where);
|
|
703
707
|
if (baseUrl !== undefined) {
|
|
704
|
-
if (provider !== 'anthropic') {
|
|
705
|
-
throw new ConfigError(`${where}: "baseUrl" only applies to provider "anthropic"
|
|
708
|
+
if (provider !== 'anthropic' && provider !== 'openai') {
|
|
709
|
+
throw new ConfigError(`${where}: "baseUrl" only applies to provider "anthropic" or "openai".`);
|
|
706
710
|
}
|
|
707
711
|
if (!isHttpUrl(baseUrl)) {
|
|
708
712
|
throw new ConfigError(`${where}: "baseUrl" must be an http: or https: URL, got ${JSON.stringify(baseUrl)}.`);
|
|
709
713
|
}
|
|
710
714
|
fields.baseUrl = baseUrl;
|
|
711
715
|
}
|
|
716
|
+
if (input['headersCommand'] !== undefined) {
|
|
717
|
+
if (provider !== 'openai' || baseUrl === undefined) {
|
|
718
|
+
throw new ConfigError(`${where}: "headersCommand" requires provider "openai" and an explicit "baseUrl".`);
|
|
719
|
+
}
|
|
720
|
+
const problem = headersCommandBaseUrlProblem(baseUrl);
|
|
721
|
+
if (problem !== undefined)
|
|
722
|
+
throw new ConfigError(`${where}: "headersCommand" baseUrl ${problem}.`);
|
|
723
|
+
if (apiKeyEnv !== undefined || input['bedrockMantle'] === true || input['bedrockRuntime'] === true) {
|
|
724
|
+
throw new ConfigError(`${where}: "headersCommand" is mutually exclusive with "apiKeyEnv", "bedrockMantle" and "bedrockRuntime".`);
|
|
725
|
+
}
|
|
726
|
+
try {
|
|
727
|
+
fields.headersCommand = parseHeadersCommand(input['headersCommand']);
|
|
728
|
+
}
|
|
729
|
+
catch (error) {
|
|
730
|
+
throw new ConfigError(`${where}: ${error instanceof Error ? error.message : 'invalid headersCommand'}`);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
if (baseUrl !== undefined && (input['bedrockMantle'] === true || input['bedrockRuntime'] === true)) {
|
|
734
|
+
throw new ConfigError(`${where}: "baseUrl" is mutually exclusive with "bedrockMantle" and "bedrockRuntime".`);
|
|
735
|
+
}
|
|
712
736
|
// Rejected here rather than left to the SDK, which throws the same conflict as
|
|
713
737
|
// a bare Error naming neither the file nor the two keys the user wrote.
|
|
714
738
|
const bedrockMantle = booleanField(input, 'bedrockMantle', where);
|
|
@@ -787,6 +811,8 @@ function validateSessionFields(input, configPath, validateEmbeddedHooks) {
|
|
|
787
811
|
terminalNotify: booleanField(input, 'terminalNotify', configPath) ?? DEFAULTS.terminalNotify,
|
|
788
812
|
terminalTitle: booleanField(input, 'terminalTitle', configPath) ?? DEFAULTS.terminalTitle,
|
|
789
813
|
backgroundTaskWake: booleanField(input, 'backgroundTaskWake', configPath) ?? DEFAULTS.backgroundTaskWake,
|
|
814
|
+
promptSuggestions: booleanField(input, 'promptSuggestions', configPath) ?? DEFAULTS.promptSuggestions,
|
|
815
|
+
sessionRecap: booleanField(input, 'sessionRecap', configPath) ?? DEFAULTS.sessionRecap,
|
|
790
816
|
updateCheck: booleanField(input, 'updateCheck', configPath) ?? DEFAULTS.updateCheck,
|
|
791
817
|
trustPeers: booleanField(input, 'trustPeers', configPath) ?? DEFAULTS.trustPeers,
|
|
792
818
|
memoryHorizonDays: integerField(input, 'memoryHorizonDays', configPath, { min: 0, max: 365 }) ??
|
|
@@ -1411,24 +1437,17 @@ async function readConfigRecord(file) {
|
|
|
1411
1437
|
}
|
|
1412
1438
|
return { record: parsed, existed: true };
|
|
1413
1439
|
}
|
|
1414
|
-
|
|
1415
|
-
* Builds the SDK model for the configured provider.
|
|
1416
|
-
*
|
|
1417
|
-
* Anthropic and OpenAI live behind dynamic imports because their model modules
|
|
1418
|
-
* require peer dependencies (`@anthropic-ai/sdk`, `openai`) that a Bedrock-only
|
|
1419
|
-
* install does not have. A static import would break the default setup.
|
|
1420
|
-
*/
|
|
1421
|
-
export async function createModelFromConfig(config) {
|
|
1440
|
+
export async function createModelFromConfig(config, call = {}) {
|
|
1422
1441
|
switch (config.provider) {
|
|
1423
1442
|
case 'bedrock':
|
|
1424
|
-
return createBedrockModel(config);
|
|
1443
|
+
return createBedrockModel(config, call);
|
|
1425
1444
|
case 'anthropic':
|
|
1426
|
-
return createAnthropicModel(config);
|
|
1445
|
+
return createAnthropicModel(config, call);
|
|
1427
1446
|
case 'openai':
|
|
1428
|
-
return createOpenAIModel(config);
|
|
1447
|
+
return createOpenAIModel(config, call);
|
|
1429
1448
|
}
|
|
1430
1449
|
}
|
|
1431
|
-
function createBedrockModel(config) {
|
|
1450
|
+
function createBedrockModel(config, call) {
|
|
1432
1451
|
if (!BEDROCK_PROFILE_PREFIXES.some((prefix) => config.model.startsWith(prefix))) {
|
|
1433
1452
|
throw new ConfigError(`Bedrock model ${JSON.stringify(config.model)} is not a cross-region inference profile. ` +
|
|
1434
1453
|
`Prefix it with one of ${BEDROCK_PROFILE_PREFIXES.join(', ')} ` +
|
|
@@ -1451,6 +1470,7 @@ function createBedrockModel(config) {
|
|
|
1451
1470
|
// default has been outlived by real turns, so darwin owns the number.
|
|
1452
1471
|
clientConfig: {
|
|
1453
1472
|
requestHandler: { requestTimeout: config.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS },
|
|
1473
|
+
...(call.singleAttempt && { maxAttempts: 1 }),
|
|
1454
1474
|
},
|
|
1455
1475
|
// Appends a cache point after the tool schemas and to the last user message on
|
|
1456
1476
|
// every request. Omitted entirely when caching is off, since `strategy: 'auto'`
|
|
@@ -1462,7 +1482,7 @@ function createBedrockModel(config) {
|
|
|
1462
1482
|
...(thinking !== undefined && { additionalRequestFields: thinking }),
|
|
1463
1483
|
});
|
|
1464
1484
|
}
|
|
1465
|
-
async function createAnthropicModel(config) {
|
|
1485
|
+
async function createAnthropicModel(config, call) {
|
|
1466
1486
|
// Config is validated before the import: a mistake in the user's own file is
|
|
1467
1487
|
// reported whether or not the optional peer dependency happens to be installed.
|
|
1468
1488
|
const apiKey = readApiKey(config);
|
|
@@ -1492,11 +1512,20 @@ async function createAnthropicModel(config) {
|
|
|
1492
1512
|
// The pinned provider does not forward StreamOptions.cancelSignal. The
|
|
1493
1513
|
// client's supported middleware carries only the scoped parent stream
|
|
1494
1514
|
// signal; outside that scope (children/counting) it delegates unchanged.
|
|
1495
|
-
clientConfig: {
|
|
1515
|
+
clientConfig: {
|
|
1516
|
+
...(baseURL !== undefined && { baseURL }),
|
|
1517
|
+
...(call.singleAttempt && { maxRetries: 0 }),
|
|
1518
|
+
middleware: [call.cancelSignal === undefined ? modelStreamMiddleware : (request, next, context) => {
|
|
1519
|
+
const signal = AbortSignal.any([call.cancelSignal, ...(request.signal ? [request.signal] : [])]);
|
|
1520
|
+
if (context.options !== undefined)
|
|
1521
|
+
context.options.signal = signal;
|
|
1522
|
+
return next({ ...request, signal });
|
|
1523
|
+
}],
|
|
1524
|
+
},
|
|
1496
1525
|
...(thinking !== undefined && { params: thinking }),
|
|
1497
1526
|
});
|
|
1498
1527
|
}
|
|
1499
|
-
async function createOpenAIModel(config) {
|
|
1528
|
+
async function createOpenAIModel(config, call) {
|
|
1500
1529
|
const { OpenAIModel } = await importProviderModule('@strands-agents/sdk/models/openai', 'openai', 'openai');
|
|
1501
1530
|
const api = openaiApiMode(config);
|
|
1502
1531
|
const params = openaiThinkingParams(planThinking(config), api);
|
|
@@ -1512,7 +1541,9 @@ async function createOpenAIModel(config) {
|
|
|
1512
1541
|
? { bedrockMantleConfig: { region: resolveRegion(config.region) } }
|
|
1513
1542
|
: config.bedrockRuntime === true
|
|
1514
1543
|
? await bedrockRuntimeClient(resolveRegion(config.region))
|
|
1515
|
-
:
|
|
1544
|
+
: config.headersCommand !== undefined
|
|
1545
|
+
? createHeadersCommandClient(config.headersCommand, config.baseUrl, call.cancelSignal)
|
|
1546
|
+
: { ...optionalApiKey(readApiKey(config)), ...(config.baseUrl === undefined ? {} : { clientConfig: { baseURL: config.baseUrl } }) };
|
|
1516
1547
|
// The user's window beats darwin's Mantle table, which beats the SDK's own.
|
|
1517
1548
|
const contextWindowLimit = config.contextWindowLimit ?? openAIContextWindowLimit(config.model);
|
|
1518
1549
|
const options = {
|
|
@@ -1520,12 +1551,14 @@ async function createOpenAIModel(config) {
|
|
|
1520
1551
|
maxTokens: config.maxTokens,
|
|
1521
1552
|
...(contextWindowLimit === undefined ? {} : { contextWindowLimit }),
|
|
1522
1553
|
...client,
|
|
1554
|
+
...(call.singleAttempt && { clientConfig: { ...('clientConfig' in client ? client.clientConfig : {}), maxRetries: 0 } }),
|
|
1523
1555
|
...(params !== undefined && { params }),
|
|
1524
1556
|
};
|
|
1525
1557
|
// Branched on the literal rather than passing `api` through: `OpenAIModelOptions`
|
|
1526
1558
|
// is discriminated on it, and a union-typed `api` would widen the options to the
|
|
1527
1559
|
// point where a chat-only field on a responses config no longer fails to compile.
|
|
1528
|
-
|
|
1560
|
+
const model = api === 'responses' ? new OpenAIModel({ api: 'responses', ...options }) : new OpenAIModel({ api: 'chat', ...options });
|
|
1561
|
+
return config.headersCommand === undefined ? model : protectHeadersCommandModel(model);
|
|
1529
1562
|
}
|
|
1530
1563
|
/** Which OpenAI API this config speaks. Chat Completions unless asked otherwise. */
|
|
1531
1564
|
function openaiApiMode(config) {
|