strands-darwin 0.0.35 → 0.0.37
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 +23 -6
- package/README.zh-CN.md +23 -6
- package/dist/patches/{@strands-agents+sdk+1.16.0.patch → @strands-agents+sdk+1.18.0.patch} +320 -9
- package/dist/src/agent/compact.js +1 -1
- package/dist/src/agent/prompt-cache.js +15 -2
- package/dist/src/agent/prompt-cache.js.map +1 -1
- package/dist/src/agent/rewind.d.ts +2 -0
- package/dist/src/agent/rewind.js +4 -1
- package/dist/src/agent/rewind.js.map +1 -1
- package/dist/src/agent/runtime.d.ts +81 -20
- package/dist/src/agent/runtime.js +227 -43
- package/dist/src/agent/runtime.js.map +1 -1
- package/dist/src/agent/session.d.ts +96 -4
- package/dist/src/agent/session.js +249 -9
- package/dist/src/agent/session.js.map +1 -1
- package/dist/src/agent/stream-idle.d.ts +16 -0
- package/dist/src/agent/stream-idle.js +127 -0
- package/dist/src/agent/stream-idle.js.map +1 -0
- package/dist/src/agent/system-prompt.d.ts +1 -1
- package/dist/src/agent/system-prompt.js +12 -0
- package/dist/src/agent/system-prompt.js.map +1 -1
- package/dist/src/agent/task-terminal-delivery.d.ts +25 -2
- package/dist/src/agent/task-terminal-delivery.js +80 -7
- package/dist/src/agent/task-terminal-delivery.js.map +1 -1
- package/dist/src/agent/working-context.d.ts +21 -1
- package/dist/src/agent/working-context.js +28 -1
- package/dist/src/agent/working-context.js.map +1 -1
- package/dist/src/agent/workspace-trust.d.ts +112 -0
- package/dist/src/agent/workspace-trust.js +207 -0
- package/dist/src/agent/workspace-trust.js.map +1 -0
- package/dist/src/agentcore/auto-policy.d.ts +7 -0
- package/dist/src/agentcore/auto-policy.js +50 -0
- package/dist/src/agentcore/auto-policy.js.map +1 -0
- package/dist/src/agentcore/auto-state.d.ts +43 -0
- package/dist/src/agentcore/auto-state.js +73 -0
- package/dist/src/agentcore/auto-state.js.map +1 -0
- package/dist/src/agentcore/cli.d.ts +2 -0
- package/dist/src/agentcore/cli.js +38 -0
- package/dist/src/agentcore/cli.js.map +1 -0
- package/dist/src/agentcore/config.d.ts +48 -0
- package/dist/src/agentcore/config.js +44 -0
- package/dist/src/agentcore/config.js.map +1 -0
- package/dist/src/agentcore/controller.d.ts +105 -0
- package/dist/src/agentcore/controller.js +979 -0
- package/dist/src/agentcore/controller.js.map +1 -0
- package/dist/src/agentcore/projection.d.ts +2 -0
- package/dist/src/agentcore/projection.js +8 -0
- package/dist/src/agentcore/projection.js.map +1 -0
- package/dist/src/agentcore/records.d.ts +41 -0
- package/dist/src/agentcore/records.js +149 -0
- package/dist/src/agentcore/records.js.map +1 -0
- package/dist/src/agentcore/state.d.ts +16 -0
- package/dist/src/agentcore/state.js +149 -0
- package/dist/src/agentcore/state.js.map +1 -0
- package/dist/src/agentcore/tools.d.ts +3 -0
- package/dist/src/agentcore/tools.js +11 -0
- package/dist/src/agentcore/tools.js.map +1 -0
- package/dist/src/agentcore/transport.d.ts +37 -0
- package/dist/src/agentcore/transport.js +242 -0
- package/dist/src/agentcore/transport.js.map +1 -0
- package/dist/src/agentcore/upload-projection.d.ts +208 -0
- package/dist/src/agentcore/upload-projection.js +823 -0
- package/dist/src/agentcore/upload-projection.js.map +1 -0
- package/dist/src/agents/child-recipe.js +4 -1
- package/dist/src/agents/child-recipe.js.map +1 -1
- package/dist/src/agents/loader.d.ts +12 -0
- package/dist/src/agents/loader.js +15 -1
- package/dist/src/agents/loader.js.map +1 -1
- package/dist/src/agents/subagent-tool.js +2 -4
- package/dist/src/agents/subagent-tool.js.map +1 -1
- package/dist/src/agents/workflow-tool.js +2 -4
- package/dist/src/agents/workflow-tool.js.map +1 -1
- package/dist/src/cli-doctor.js +7 -0
- package/dist/src/cli-doctor.js.map +1 -1
- package/dist/src/cli-import.d.ts +1 -0
- package/dist/src/cli-import.js +26 -0
- package/dist/src/cli-import.js.map +1 -0
- package/dist/src/cli-main.js +60 -10
- package/dist/src/cli-main.js.map +1 -1
- package/dist/src/cli-permissions.d.ts +2 -0
- package/dist/src/cli-permissions.js +20 -0
- package/dist/src/cli-permissions.js.map +1 -0
- package/dist/src/cli-sessions.js +6 -2
- package/dist/src/cli-sessions.js.map +1 -1
- package/dist/src/cli-usage.d.ts +9 -1
- package/dist/src/cli-usage.js +13 -0
- package/dist/src/cli-usage.js.map +1 -1
- package/dist/src/cli.js +19 -2
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/custom-commands.d.ts +1 -1
- package/dist/src/commands/custom-commands.js +14 -6
- package/dist/src/commands/custom-commands.js.map +1 -1
- package/dist/src/commands/review-command.d.ts +10 -0
- package/dist/src/commands/review-command.js +28 -0
- package/dist/src/commands/review-command.js.map +1 -0
- package/dist/src/config-file.d.ts +9 -0
- package/dist/src/config-file.js +82 -0
- package/dist/src/config-file.js.map +1 -0
- package/dist/src/config.d.ts +66 -5
- package/dist/src/config.js +126 -42
- package/dist/src/config.js.map +1 -1
- package/dist/src/dev-repl.js +17 -1
- package/dist/src/dev-repl.js.map +1 -1
- package/dist/src/headless-protocol.d.ts +24 -1
- package/dist/src/headless-protocol.js +18 -0
- package/dist/src/headless-protocol.js.map +1 -1
- package/dist/src/headless-runner.d.ts +8 -0
- package/dist/src/headless-runner.js +37 -1
- package/dist/src/headless-runner.js.map +1 -1
- package/dist/src/hooks/hook-process.js +7 -2
- package/dist/src/hooks/hook-process.js.map +1 -1
- package/dist/src/hooks/lifecycle-hooks.js +3 -1
- package/dist/src/hooks/lifecycle-hooks.js.map +1 -1
- package/dist/src/hooks/tool-hooks.js +3 -1
- package/dist/src/hooks/tool-hooks.js.map +1 -1
- package/dist/src/import-claude-files.d.ts +28 -0
- package/dist/src/import-claude-files.js +227 -0
- package/dist/src/import-claude-files.js.map +1 -0
- package/dist/src/import-claude-snippets.d.ts +2 -0
- package/dist/src/import-claude-snippets.js +105 -0
- package/dist/src/import-claude-snippets.js.map +1 -0
- package/dist/src/import-claude.d.ts +13 -0
- package/dist/src/import-claude.js +287 -0
- package/dist/src/import-claude.js.map +1 -0
- package/dist/src/mcp/registry.d.ts +57 -1
- package/dist/src/mcp/registry.js +78 -6
- package/dist/src/mcp/registry.js.map +1 -1
- package/dist/src/memory/command.d.ts +1 -1
- package/dist/src/memory/command.js +89 -4
- package/dist/src/memory/command.js.map +1 -1
- package/dist/src/memory/controller.d.ts +32 -0
- package/dist/src/memory/controller.js +39 -3
- package/dist/src/memory/controller.js.map +1 -1
- package/dist/src/memory/state.d.ts +6 -0
- package/dist/src/memory/state.js +6 -1
- package/dist/src/memory/state.js.map +1 -1
- package/dist/src/memory/store.d.ts +13 -0
- package/dist/src/memory/store.js +38 -2
- package/dist/src/memory/store.js.map +1 -1
- package/dist/src/memory/tools.d.ts +7 -0
- package/dist/src/memory/tools.js +12 -1
- package/dist/src/memory/tools.js.map +1 -1
- 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/paths.js +3 -0
- package/dist/src/paths.js.map +1 -1
- package/dist/src/permissions-test.d.ts +18 -0
- package/dist/src/permissions-test.js +207 -0
- package/dist/src/permissions-test.js.map +1 -0
- package/dist/src/pricing/model-prices.d.ts +8 -5
- package/dist/src/pricing/model-prices.js +30 -15
- package/dist/src/pricing/model-prices.js.map +1 -1
- package/dist/src/project-identity.d.ts +3 -0
- package/dist/src/project-identity.js +8 -0
- package/dist/src/project-identity.js.map +1 -0
- package/dist/src/project-overrides.d.ts +57 -0
- package/dist/src/project-overrides.js +79 -0
- package/dist/src/project-overrides.js.map +1 -0
- package/dist/src/sdk-patch-preflight.js +1 -1
- package/dist/src/skills/builtin/developer/SKILL.md +2 -0
- package/dist/src/skills/builtin/self-reflection/references/reflection-template.md +2 -1
- package/dist/src/skills/builtin/setup-agentcore-memory/SKILL.md +158 -0
- package/dist/src/skills/loader.d.ts +1 -1
- package/dist/src/skills/loader.js +4 -1
- package/dist/src/skills/loader.js.map +1 -1
- package/dist/src/tools/background-bash.d.ts +13 -1
- package/dist/src/tools/background-bash.js +36 -8
- package/dist/src/tools/background-bash.js.map +1 -1
- package/dist/src/tools/shell-env.d.ts +24 -0
- package/dist/src/tools/shell-env.js +34 -0
- package/dist/src/tools/shell-env.js.map +1 -1
- package/dist/src/trajectory/reader.d.ts +1 -1
- package/dist/src/trajectory/reader.js +23 -3
- package/dist/src/trajectory/reader.js.map +1 -1
- package/dist/src/trajectory/record.d.ts +50 -2
- package/dist/src/trajectory/record.js +32 -0
- package/dist/src/trajectory/record.js.map +1 -1
- package/dist/src/trajectory/replay.d.ts +12 -1
- package/dist/src/trajectory/replay.js +31 -2
- package/dist/src/trajectory/replay.js.map +1 -1
- package/dist/src/trajectory/resume-recap.d.ts +11 -1
- package/dist/src/trajectory/resume-recap.js +10 -1
- package/dist/src/trajectory/resume-recap.js.map +1 -1
- package/dist/src/trajectory/rewind-history.d.ts +8 -0
- package/dist/src/trajectory/rewind-history.js +81 -0
- package/dist/src/trajectory/rewind-history.js.map +1 -0
- package/dist/src/trajectory/writer.d.ts +14 -1
- package/dist/src/trajectory/writer.js +38 -0
- package/dist/src/trajectory/writer.js.map +1 -1
- package/dist/src/tui/App.d.ts +5 -1
- package/dist/src/tui/App.js +284 -51
- package/dist/src/tui/App.js.map +1 -1
- package/dist/src/tui/InputBox.d.ts +1 -1
- package/dist/src/tui/InputBox.js +3 -2
- package/dist/src/tui/InputBox.js.map +1 -1
- package/dist/src/tui/MessageList.js +1 -1
- package/dist/src/tui/MessageList.js.map +1 -1
- package/dist/src/tui/PermissionPrompt.js +5 -3
- package/dist/src/tui/PermissionPrompt.js.map +1 -1
- package/dist/src/tui/QueuedMessages.js +14 -8
- package/dist/src/tui/QueuedMessages.js.map +1 -1
- package/dist/src/tui/ToolCallPanel.js +2 -2
- package/dist/src/tui/ToolCallPanel.js.map +1 -1
- package/dist/src/tui/WorkspaceTrustPrompt.d.ts +8 -0
- package/dist/src/tui/WorkspaceTrustPrompt.js +37 -0
- package/dist/src/tui/WorkspaceTrustPrompt.js.map +1 -0
- package/dist/src/tui/draft-stash.d.ts +25 -0
- package/dist/src/tui/draft-stash.js +49 -0
- package/dist/src/tui/draft-stash.js.map +1 -0
- package/dist/src/tui/frame-budget.d.ts +2 -2
- package/dist/src/tui/frame-budget.js +3 -3
- package/dist/src/tui/frame-budget.js.map +1 -1
- package/dist/src/tui/help-format.d.ts +2 -2
- package/dist/src/tui/help-format.js +3 -3
- package/dist/src/tui/help-format.js.map +1 -1
- package/dist/src/tui/mcp-format.d.ts +9 -0
- package/dist/src/tui/mcp-format.js +5 -3
- package/dist/src/tui/mcp-format.js.map +1 -1
- package/dist/src/tui/permission-rule-preview.d.ts +23 -0
- package/dist/src/tui/permission-rule-preview.js +38 -0
- package/dist/src/tui/permission-rule-preview.js.map +1 -0
- package/dist/src/tui/prompt-editor.d.ts +12 -0
- package/dist/src/tui/prompt-editor.js +57 -37
- package/dist/src/tui/prompt-editor.js.map +1 -1
- package/dist/src/tui/prompt-history-search.js +3 -2
- package/dist/src/tui/prompt-history-search.js.map +1 -1
- package/dist/src/tui/prompt-queue.d.ts +4 -2
- package/dist/src/tui/prompt-queue.js +18 -3
- package/dist/src/tui/prompt-queue.js.map +1 -1
- package/dist/src/tui/rewind-search.js +4 -3
- package/dist/src/tui/rewind-search.js.map +1 -1
- package/dist/src/tui/search-preview.d.ts +2 -0
- package/dist/src/tui/search-preview.js +9 -0
- package/dist/src/tui/search-preview.js.map +1 -0
- package/dist/src/tui/shell-command.js +4 -1
- package/dist/src/tui/shell-command.js.map +1 -1
- package/dist/src/tui/spinner.d.ts +1 -0
- package/dist/src/tui/spinner.js +6 -0
- package/dist/src/tui/spinner.js.map +1 -0
- package/dist/src/tui/status-format.d.ts +9 -0
- package/dist/src/tui/status-format.js +37 -2
- package/dist/src/tui/status-format.js.map +1 -1
- package/dist/src/tui/subagent-format.js +6 -0
- package/dist/src/tui/subagent-format.js.map +1 -1
- package/dist/src/tui/task-format.d.ts +5 -0
- package/dist/src/tui/task-format.js +15 -0
- package/dist/src/tui/task-format.js.map +1 -1
- package/dist/src/tui/trust-format.d.ts +31 -0
- package/dist/src/tui/trust-format.js +102 -0
- package/dist/src/tui/trust-format.js.map +1 -0
- package/dist/src/tui/turn-state.d.ts +1 -0
- package/dist/src/tui/turn-state.js +2 -0
- package/dist/src/tui/turn-state.js.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
<p>A terminal coding agent that improves by using each accepted revision to build the next one.</p>
|
|
4
4
|
<p><strong>English</strong> · <a href="README.zh-CN.md">简体中文</a></p>
|
|
5
5
|
<p>
|
|
6
|
-
<a href="https://nodejs.org/"><img alt="Node.js >=
|
|
6
|
+
<a href="https://nodejs.org/"><img alt="Node.js >=22.0.0" src="https://img.shields.io/badge/Node.js-%3E%3D22.0.0-339933?logo=nodedotjs&logoColor=white"></a>
|
|
7
7
|
<a href="https://www.typescriptlang.org/"><img alt="TypeScript 7.0.2" src="https://img.shields.io/badge/TypeScript-7.0.2-3178C6?logo=typescript&logoColor=white"></a>
|
|
8
|
-
<a href="https://www.npmjs.com/package/@strands-agents/sdk"><img alt="Strands Agents SDK 1.
|
|
8
|
+
<a href="https://www.npmjs.com/package/@strands-agents/sdk"><img alt="Strands Agents SDK 1.18.0" src="https://img.shields.io/badge/Strands_Agents_SDK-1.18.0-5E4AE3"></a>
|
|
9
9
|
<a href="https://spdx.org/licenses/ISC.html"><img alt="ISC License" src="https://img.shields.io/badge/License-ISC-blue.svg"></a>
|
|
10
10
|
</p>
|
|
11
11
|
<img src="docs/images/welcome.png" alt="darwin terminal welcome screen" width="100%">
|
|
@@ -34,12 +34,16 @@ unfinished backlog, or one weighted research-path draw
|
|
|
34
34
|
|
|
35
35
|
This is a bounded workflow, not autonomous product authority. A dirty or unverifiable starting point, repeated acceptance failure, a falsified premise, or a product/safety decision only a person can make stops the batch and records the reason. See the [dated research reports](docs/research/) and [self-reflections](docs/reflections/) for the evidence trail.
|
|
36
36
|
|
|
37
|
+
## Bringing an existing setup
|
|
38
|
+
|
|
39
|
+
Run `darwin import --from claude-code` inside the target project to preview a bounded, read-only migration plan. On Linux, add `--apply` to copy supported prompt-only skills, agents and marked `CLAUDE.md` sections; existing content is never silently overwritten. Hooks, MCP, permission policy and trust are never enabled or written. Review the [supported mappings and manual steps](docs/user-guide/extensions.md#import-a-claude-code-setup) before applying; this does not import chats or switch providers.
|
|
40
|
+
|
|
37
41
|
## What it gives you
|
|
38
42
|
|
|
39
43
|
- **A readable Ink TUI:** streaming Markdown answers, proposed file-edit diffs, elapsed time and token spend, slash/path completion, prompt recall and queueing, local `!` commands, and bounded reports.
|
|
40
|
-
- **Safe approval modes:** `default`, classifier-assisted `auto`, read-only `plan`, and explicit `yolo`, with
|
|
44
|
+
- **Safe approval modes:** `default`, classifier-assisted `auto`, read-only `plan`, and explicit `yolo`, with project-scoped allow rules reviewed in full before saving and revocable in-session, plus deny rules that hold in every mode, `yolo` included. A checkout's own hook commands, MCP servers and legacy allow rules stay held until you accept one [workspace-trust](docs/user-guide/permissions.md#workspace-trust) modal listing exactly what they would run; the answer lives outside the repository, and headless runs never ask.
|
|
41
45
|
- **Durable work:** resumable project-scoped sessions, append-only trajectories, replay/search/fork/export, cost records, optional diagnostics, background jobs, and parent-managed on-demand project memory with exact evidence and durable-turn commit.
|
|
42
|
-
- **Extension layers:** built-in and project/global skills, custom commands, child agents with workflow-DAG delegation, tool hooks, and stdio/HTTP MCP servers, with portable `.agents/` discovery.
|
|
46
|
+
- **Extension layers:** built-in and project/global skills, custom commands, child agents with workflow-DAG delegation, tool hooks, and stdio/HTTP MCP servers, with portable `.agents/` discovery. Custom commands replace `$ARGUMENTS`; without it, nonempty trimmed arguments follow the untouched template and two newline characters. See [custom commands](docs/user-guide/extensions.md#custom-commands).
|
|
43
47
|
- **Automation:** one-shot text output or versioned JSON/JSONL, strict session selection, bounded model-call and context-offload controls, and nonzero cancellation/failure exits.
|
|
44
48
|
- **Model choice:** Amazon Bedrock, direct Anthropic, direct OpenAI, and OpenAI-compatible models through Bedrock Mantle; live model and thinking-effort switching.
|
|
45
49
|
|
|
@@ -47,7 +51,7 @@ The agent loop remains the Strands SDK loop. darwin assembles SDK models, interv
|
|
|
47
51
|
|
|
48
52
|
## Install and start
|
|
49
53
|
|
|
50
|
-
Requirements: Node.js
|
|
54
|
+
Requirements: Node.js 22.0+, npm, and credentials for your configured provider (AWS by default).
|
|
51
55
|
|
|
52
56
|
```bash
|
|
53
57
|
npm install -g strands-darwin
|
|
@@ -64,6 +68,8 @@ darwin --resume
|
|
|
64
68
|
darwin --resume <id> # ids: darwin sessions
|
|
65
69
|
darwin --session <id>
|
|
66
70
|
darwin doctor # offline read-only diagnostics: config, MCP, skills, hooks; exit 1 on problems
|
|
71
|
+
darwin permissions test 'bash:pnpm *' # recorded project pairs; no policy changes
|
|
72
|
+
# In the TUI: /permissions test bash:pnpm * (current session only, works while busy)
|
|
67
73
|
darwin --help # usage grammar; darwin --version prints the version
|
|
68
74
|
```
|
|
69
75
|
|
|
@@ -108,15 +114,18 @@ For multiple switchable models, provider-specific fields, Bedrock Mantle, cachin
|
|
|
108
114
|
/self-evolution-research
|
|
109
115
|
/help local command, prompt, and key reference
|
|
110
116
|
/init ask the model to create or improve this project's AGENTS.md
|
|
117
|
+
/review [focus] review current changes for bugs and test gaps
|
|
111
118
|
/copy copy the last completed answer to the clipboard (OSC 52, works over SSH)
|
|
112
119
|
/rewind branch conversation from a completed prompt (workspace unchanged)
|
|
113
120
|
/tangent bookmark the conversation for a side question; /tangent again returns
|
|
114
121
|
```
|
|
115
122
|
|
|
116
|
-
Use `Ctrl+R` to search this project's prompt history (type to filter, `Ctrl+R`/`Up`/`Down` to navigate, `Enter`/`Tab` to accept, `Escape` to cancel), `Ctrl+C` to cancel busy work, `Ctrl+B` to expand or compact tool details, and `/exit` or `Ctrl+D` to quit. In the composer, `Alt/Ctrl+Left/Right` or `Alt+B`/`Alt+F` moves by word, `Alt+Backspace`/`Alt+D` deletes the word before/after the cursor, and `Ctrl+_` (or `Ctrl+-`) undoes the last `Ctrl+K`/`Ctrl+U`, `Ctrl+W` or `Alt` word deletion. On an empty idle composer, `Esc` `Esc` (the second within 500 ms) opens the `/rewind` chooser — the same thing typing `/rewind` does; a single `Esc` there does nothing. Model tool calls still pass through the active permission mode; `!` commands are commands you authorize by typing them yourself.
|
|
123
|
+
Use `Ctrl+R` to search this project's prompt history (type to filter, `Ctrl+R`/`Up`/`Down` to navigate, `Enter`/`Tab` to accept, `Escape` to cancel), `Ctrl+C` to cancel busy work, `Ctrl+B` to expand or compact tool details, and `/exit` or `Ctrl+D` to quit. In the composer, `Alt/Ctrl+Left/Right` or `Alt+B`/`Alt+F` moves by word, `Alt+Backspace`/`Alt+D` deletes the word before/after the cursor, and `Ctrl+_` (or `Ctrl+-`) undoes the last `Ctrl+K`/`Ctrl+U`, `Ctrl+W` or `Alt` word deletion. `Ctrl+Y` inserts the last cut at the current cursor, repeatably within the same draft, without using the clipboard; [cut/yank limits and reset rules](docs/user-guide/using-darwin.md#prompt-editing-and-completion) apply. `Ctrl+S` parks one unsent draft with its exact cursor and optional image; press it on an empty composer to restore. It never overwrites or sends, survives intervening prompts, and is dropped on session replacement or exit ([stash limits](docs/user-guide/using-darwin.md#draft-stash)). On an empty idle composer, `Esc` `Esc` (the second within 500 ms) opens the `/rewind` chooser — the same thing typing `/rewind` does; a single `Esc` there does nothing. Model tool calls still pass through the active permission mode; `!` commands are commands you authorize by typing them yourself. Every process darwin spawns — the model's `bash` shells and background jobs, your `!` commands, hook commands and stdio MCP servers — sees `DARWIN=1` in its environment (a `DARWIN` you already exported is left as is), so scripts and hooks can tell they run under an agent.
|
|
117
124
|
|
|
118
125
|
To be called back when you have switched away, set `"terminalBell": true` (one BEL) and/or `"terminalNotify": true` (one OSC 9 desktop-notification sequence, shown by iTerm2, kitty, Ghostty, WezTerm and foot, silently ignored elsewhere) in `~/.darwin/config.json`; both fire when a permission prompt waits and when a turn completes, and both are off by default. iTerm2 needs "Send escape sequence-generated alerts" enabled; tmux needs `set -g allow-passthrough on`. Details in [Configuration and context](docs/user-guide/configuration.md).
|
|
119
126
|
|
|
127
|
+
`/review` asks for prioritized, evidence-backed bugs and separate test gaps in staged/unstaged changes and relevant untracked files. An optional focus stays literal text. It asks for no edits or commits unless separately requested, but **does not enforce read-only mode** or change permissions. The built-in now owns `/review`; rename a custom command or skill using that slash name (for example, to `audit`). See [reviewing changes](docs/user-guide/using-darwin.md#reviewing-changes).
|
|
128
|
+
|
|
120
129
|
For non-interactive use:
|
|
121
130
|
|
|
122
131
|
```bash
|
|
@@ -127,6 +136,14 @@ darwin -p "inspect this project" --output-format stream-json
|
|
|
127
136
|
|
|
128
137
|
Read [Using darwin](docs/user-guide/using-darwin.md) for TUI, headless, structured-output, queue, shell, and background-job contracts.
|
|
129
138
|
|
|
139
|
+
Silent parent model streams fail visibly after 120 seconds without an event, with no automatic retry; thinking events reset the allowance. Permission, tool and retry waits are excluded. Root config `streamIdleTimeoutSeconds` changes it (`0` disables); see [scope and cancellation](docs/user-guide/configuration.md#stream-idle-watchdog).
|
|
140
|
+
|
|
141
|
+
## Optional cloud memory
|
|
142
|
+
|
|
143
|
+
AgentCore Memory is default-off and independent of the model provider; existing local project memory is unchanged. It adds gated, parent-only episode/reflection recall, user-confirmed cross-project preferences, and separately enabled **manual preview/send or project-authorized auto upload** of bounded original new-turn tool content, including arbitrary tools/MCP, textual arguments and results. This can include secrets and is **not a confidentiality guarantee**. Memory adoption/upload/deletion controls are user-submitted TUI-only; the standalone cloud-memory CLI is read-only. All assistant prose is omitted from uploads. `/cloud-memory auto` persists consent for this project's new turns only; `/cloud-memory manual` stops unsent automatic work. Defaults: 500 attempts/100 MiB per UTC day, seven-day retention for auto-accepted local bodies, permanent bounded-partition receipts. Root `upload: auto` is not authorization. User-only `discard-legacy` previews a local legacy batch and requires its manifest hash; it never deletes cloud records.
|
|
144
|
+
|
|
145
|
+
Run **`/setup-agentcore-memory`** in the TUI for guided setup. Darwin reads its bundled guide and first checks existing `~/.darwin/config.json` through the permission gate, then uses offline `darwin doctor`, local `darwin cloud-memory status`, and a bounded SDK read via `darwin cloud-memory preferences`. Healthy existing memory needs no repeat setup, actor question or restart; empty records count as a successful read, not proof of extraction/write access. Only missing/disabled setup needs actor/default questions; failed or blocked checks need targeted repair confirmation, never an automatic reset. Arguments do not authorize changes. Prefer a compatible existing Memory; no uploads or preference adoption are authorized by setup. Runtime reads/writes use the pinned official `@aws-sdk/client-bedrock-agentcore` client, not an AWS CLI executable. Legacy `cliPath` is validated but ignored with a migration notice. The optional `agentcore` infrastructure CLI is separate; importing the existing resource remains deferred because its schema/import mapping cannot preserve custom namespace keys/templates. See the [English guide](docs/user-guide/agentcore-memory.md) for exact templates, config, IAM, `/cloud-memory` commands, privacy limits and opt-in synthetic verification. No live Memory service test was run for this implementation.
|
|
146
|
+
|
|
130
147
|
## Documentation
|
|
131
148
|
|
|
132
149
|
- **[User guide](docs/user-guide/README.md):** installation, providers, daily use, configuration, state, safety, extensions, command reference, limitations, and development.
|
package/README.zh-CN.md
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
<p>一款在终端中运行的编程代理:每次通过验收的版本,都会成为开发下一版的工具。</p>
|
|
4
4
|
<p><a href="README.md">English</a> · <strong>简体中文</strong></p>
|
|
5
5
|
<p>
|
|
6
|
-
<a href="https://nodejs.org/"><img alt="Node.js >=
|
|
6
|
+
<a href="https://nodejs.org/"><img alt="Node.js >=22.0.0" src="https://img.shields.io/badge/Node.js-%3E%3D22.0.0-339933?logo=nodedotjs&logoColor=white"></a>
|
|
7
7
|
<a href="https://www.typescriptlang.org/"><img alt="TypeScript 7.0.2" src="https://img.shields.io/badge/TypeScript-7.0.2-3178C6?logo=typescript&logoColor=white"></a>
|
|
8
|
-
<a href="https://www.npmjs.com/package/@strands-agents/sdk"><img alt="Strands Agents SDK 1.
|
|
8
|
+
<a href="https://www.npmjs.com/package/@strands-agents/sdk"><img alt="Strands Agents SDK 1.18.0" src="https://img.shields.io/badge/Strands_Agents_SDK-1.18.0-5E4AE3"></a>
|
|
9
9
|
<a href="https://spdx.org/licenses/ISC.html"><img alt="ISC License" src="https://img.shields.io/badge/License-ISC-blue.svg"></a>
|
|
10
10
|
</p>
|
|
11
11
|
<img src="docs/images/welcome.png" alt="darwin 终端欢迎界面" width="100%">
|
|
@@ -34,12 +34,16 @@ darwin 是一项自托管 AI 开发实验。[v0.0.1 基线版本](https://github
|
|
|
34
34
|
|
|
35
35
|
这套流程有明确边界,不代表 darwin 拥有产品决策权。工作树不干净、起点无法验证、验收反复失败、前提被证伪,或遇到只能由人决定的产品/安全问题时,整批工作会停止,并把原因写入记录。证据可查阅[按日期归档的研究报告](docs/research/)和[自省报告](docs/reflections/)。
|
|
36
36
|
|
|
37
|
+
## 迁移已有设置
|
|
38
|
+
|
|
39
|
+
在目标项目内运行 `darwin import --from claude-code`,可只读预览有上限的迁移计划。Linux 上加 `--apply` 后,只复制支持的提示词型 skills、agents,以及带来源标记的 `CLAUDE.md` 段落,不会静默覆盖已有内容,也不会写入或启用 hook、MCP、权限策略或信任记录。执行前请查看[支持的映射与手动步骤](docs/user-guide/extensions.zh-CN.md#迁移-claude-code-设置);此命令不导入聊天,也不切换模型供应商。
|
|
40
|
+
|
|
37
41
|
## 主要能力
|
|
38
42
|
|
|
39
43
|
- **清晰的 Ink TUI:**流式 Markdown 回复、文件修改 diff、耗时与 token 消耗、斜杠命令与路径补全、提示词回看和排队、本地 `!` 命令,以及有长度上限的状态报告。
|
|
40
|
-
- **安全审批模式:**`default`、带分类器的 `auto`、只读 `plan` 和显式开启的 `yolo
|
|
44
|
+
- **安全审批模式:**`default`、带分类器的 `auto`、只读 `plan` 和显式开启的 `yolo`;项目级放行规则保存前须完整预览,并可在会话内撤销;拒绝规则在所有模式下生效,包括 `yolo`。checkout 自带的钩子命令、MCP 服务器和旧式放行规则会一直保留不用,直到你在一个列出它们究竟会运行什么的[工作区信任](docs/user-guide/permissions.zh-CN.md#工作区信任)模态框中接受;答案保存在仓库之外,无头运行从不询问。
|
|
41
45
|
- **可持续的工作状态:**按项目保存的可恢复会话、只追加轨迹、回放/搜索/分叉/导出、费用记录、可选诊断日志、后台任务,以及由父 agent 按需管理、带精确证据并在回合持久化后提交的项目记忆。
|
|
42
|
-
- **扩展机制:**内置及项目/全局 skills、自定义命令、子代理与 workflow DAG 委派、工具 hooks、stdio/HTTP MCP 服务器,并兼容 `.agents/`
|
|
46
|
+
- **扩展机制:**内置及项目/全局 skills、自定义命令、子代理与 workflow DAG 委派、工具 hooks、stdio/HTTP MCP 服务器,并兼容 `.agents/` 目录。自定义命令会替换 `$ARGUMENTS`;若模板没有该占位符,且参数去除首尾空白后非空,则在完整模板后追加两个换行符和参数。详见[自定义命令](docs/user-guide/extensions.zh-CN.md#自定义命令)。
|
|
43
47
|
- **自动化接口:**单次文本输出或带版本的 JSON/JSONL;严格选择会话;可限制模型调用次数和上下文卸载;取消或失败时返回非零状态码。
|
|
44
48
|
- **多模型支持:**Amazon Bedrock、Anthropic 直连、OpenAI 直连,以及通过 Bedrock Mantle 使用 OpenAI 兼容模型;会话中可切换模型和思考强度。
|
|
45
49
|
|
|
@@ -47,7 +51,7 @@ darwin 不会另写一套代理循环。它沿用 Strands SDK 的循环,只负
|
|
|
47
51
|
|
|
48
52
|
## 安装与启动
|
|
49
53
|
|
|
50
|
-
需要 Node.js
|
|
54
|
+
需要 Node.js 22.0+、npm,以及所选模型供应商的凭证(默认使用 AWS)。
|
|
51
55
|
|
|
52
56
|
```bash
|
|
53
57
|
npm install -g strands-darwin
|
|
@@ -64,6 +68,8 @@ darwin --resume
|
|
|
64
68
|
darwin --resume <id> # 查看 id:darwin sessions
|
|
65
69
|
darwin --session <id>
|
|
66
70
|
darwin doctor # 离线只读诊断:配置、MCP、技能、hook;发现问题时退出码 1
|
|
71
|
+
darwin permissions test 'bash:pnpm *' # 检查项目已记录调用,不改权限
|
|
72
|
+
# TUI:/permissions test bash:pnpm *(仅当前会话,忙碌时也可用)
|
|
67
73
|
darwin --help # 用法语法;darwin --version 打印版本
|
|
68
74
|
```
|
|
69
75
|
|
|
@@ -108,15 +114,18 @@ Bedrock 使用标准 AWS 凭证链。模型 ID 必须是 `us.`、`eu.`、`apac.`
|
|
|
108
114
|
/self-evolution-research
|
|
109
115
|
/help 查看本地命令、输入语法和按键说明
|
|
110
116
|
/init 请模型为当前项目创建或改进 AGENTS.md
|
|
117
|
+
/review [focus] 审查当前改动中的缺陷和测试缺口
|
|
111
118
|
/copy 把最近一条已完成回答复制到剪贴板(OSC 52,SSH 下可用)
|
|
112
119
|
/rewind 从已完成提示词分支对话(工作区不变)
|
|
113
120
|
/tangent 为一次旁支提问给对话加书签;再输入 /tangent 即返回
|
|
114
121
|
```
|
|
115
122
|
|
|
116
|
-
按 `Ctrl+R` 可搜索当前项目的提示历史(输入文字筛选,按 `Ctrl+R`/`Up`/`Down` 切换结果,按 `Enter`/`Tab` 接受,按 `Escape` 取消);忙碌时按 `Ctrl+C` 取消,按 `Ctrl+B` 展开或收起工具详情,使用 `/exit` 或 `Ctrl+D` 退出。编辑输入时,`Alt/Ctrl+Left/Right` 或 `Alt+B`/`Alt+F` 按词移动光标,`Alt+Backspace`/`Alt+D` 删除光标前/后的一个词,`Ctrl+_`(或 `Ctrl+-`)可撤销最近一次 `Ctrl+K`/`Ctrl+U`、`Ctrl+W` 或 `Alt`
|
|
123
|
+
按 `Ctrl+R` 可搜索当前项目的提示历史(输入文字筛选,按 `Ctrl+R`/`Up`/`Down` 切换结果,按 `Enter`/`Tab` 接受,按 `Escape` 取消);忙碌时按 `Ctrl+C` 取消,按 `Ctrl+B` 展开或收起工具详情,使用 `/exit` 或 `Ctrl+D` 退出。编辑输入时,`Alt/Ctrl+Left/Right` 或 `Alt+B`/`Alt+F` 按词移动光标,`Alt+Backspace`/`Alt+D` 删除光标前/后的一个词,`Ctrl+_`(或 `Ctrl+-`)可撤销最近一次 `Ctrl+K`/`Ctrl+U`、`Ctrl+W` 或 `Alt` 系列的删词操作。`Ctrl+Y` 会在当前光标处插入最近剪下的文本,同一草稿内可重复使用,不经过剪贴板;[剪切恢复的上限与清空规则](docs/user-guide/using-darwin.zh-CN.md#输入编辑与补全)见使用指南。`Ctrl+S` 可暂存一份未提交草稿,保留光标位置和附图;输入框为空时再按一次即可取回。不会覆盖或自动发送,期间可以提交其他问题;切换到新会话或退出时丢弃([草稿暂存规则](docs/user-guide/using-darwin.zh-CN.md#草稿暂存))。输入框为空且空闲时,连按两次 `Esc`(第二次在 500 ms 内)会打开 `/rewind` 选择器,效果与输入 `/rewind` 完全相同;此时单按一次 `Esc` 不做任何事。模型发起的工具调用仍会经过当前审批模式;`!` 命令由你亲自输入,因此不走模型工具审批。darwin 启动的每个进程——模型的 `bash` shell 与后台任务、你的 `!` 命令、hook 命令和 stdio MCP 服务器——环境中都带有 `DARWIN=1`(你已导出的 `DARWIN` 原样保留),脚本和 hook 由此可以判断自己运行在代理之下。
|
|
117
124
|
|
|
118
125
|
想在切到别处时被叫回来,可在 `~/.darwin/config.json` 中设置 `"terminalBell": true`(响一次终端铃)和/或 `"terminalNotify": true`(写一条 OSC 9 桌面通知序列,iTerm2、kitty、Ghostty、WezTerm 和 foot 会弹出通知,其他终端静默忽略);二者都在权限提示等待时和回合结束时触发,默认均为关闭。iTerm2 需开启 "Send escape sequence-generated alerts";tmux 需要 `set -g allow-passthrough on`。详见[配置与上下文](docs/user-guide/configuration.zh-CN.md)。
|
|
119
126
|
|
|
127
|
+
`/review` 请模型检查暂存、未暂存的改动及相关未跟踪文件,按优先级报告有证据的缺陷,并单列测试缺口。可选 focus 保持为字面文本。提示要求未经另行请求不要修改文件或提交,但**不会强制只读,也不改变权限模式**。内置命令现在占用 `/review`;原来使用该斜杠名称的自定义命令或 skill 需要改名,例如 `audit`。详见[审查改动](docs/user-guide/using-darwin.zh-CN.md#审查改动)。
|
|
128
|
+
|
|
120
129
|
无交互运行方式如下:
|
|
121
130
|
|
|
122
131
|
```bash
|
|
@@ -127,6 +136,14 @@ darwin -p "inspect this project" --output-format stream-json
|
|
|
127
136
|
|
|
128
137
|
TUI、无头模式、结构化输出、消息队列、shell 命令和后台任务的完整约定,见[使用 darwin](docs/user-guide/using-darwin.zh-CN.md)。
|
|
129
138
|
|
|
139
|
+
主代理模型流连续 120 秒没有事件时会明确报错,不自动重试;思考事件也会重新计时,权限、工具和重试等待不计入。根级 `streamIdleTimeoutSeconds` 可调整秒数(`0` 关闭);详见[范围与取消语义](docs/user-guide/configuration.zh-CN.md#模型流空闲检测)。
|
|
140
|
+
|
|
141
|
+
## 可选云记忆
|
|
142
|
+
|
|
143
|
+
AgentCore Memory 默认关闭,与模型供应商独立,原有本地项目记忆不变。它提供受权限控制、仅主代理可用的 episode/reflection 检索、用户明确确认的跨项目偏好,以及单独启用的**手动预览、发送或项目授权自动上传**新回合的有界原始工具内容,涵盖任意工具/MCP 的文本参数与结果;其中可能含有秘密,**不保证保密**。偏好采纳、上传和删除控制仅限用户亲自提交的 TUI 命令,独立 cloud-memory CLI 只读。上传省略全部助手文本。`/cloud-memory auto` 仅为当前项目的新回合持久化授权;`/cloud-memory manual` 停止尚未发送的自动任务。默认每 UTC 日 500 次尝试/100 MiB,自动接受的本地请求体保留七天,分区幂等回执长期保留。根级 `upload: auto` 不构成授权。用户命令 `discard-legacy` 先预览本地旧格式批次,再以清单哈希确认,不删除云记录。
|
|
144
|
+
|
|
145
|
+
在 TUI 输入 **`/setup-agentcore-memory`** 开始引导配置。Darwin 会先读取完整指南,通过权限检查只读查看现有 `~/.darwin/config.json`,再运行离线 `darwin doctor`、本地 `darwin cloud-memory status` 和通过 SDK 有界只读检索的 `darwin cloud-memory preferences`。已配置且基本检查通过就无需重复设置、询问 actor 或重启;空记录也算读取成功,但不证明提取或写入权限。只有缺失/禁用后的配置分支才询问 actor 和默认值;检查失败或受阻时请求针对性修复确认,不自动重置。参数不代表修改授权。优先复用兼容资源;启动配置不代表授权上传或采纳偏好。运行时通过固定版本的官方 `@aws-sdk/client-bedrock-agentcore` 读写,不再依赖 AWS CLI 可执行文件。旧 `cliPath` 仍校验格式,但会忽略并提示移除。可选的 `agentcore` CLI 只用于独立的基础设施管理;其 schema/import 尚不能完整保留自定义命名空间键和模板,因此暂不导入现有资源。[中文指南](docs/user-guide/agentcore-memory.zh-CN.md)列出了准确模板、配置、IAM、`/cloud-memory` 命令、隐私边界和可选合成数据验证。本次实现未运行真实 Memory 服务测试。
|
|
146
|
+
|
|
130
147
|
## 文档
|
|
131
148
|
|
|
132
149
|
- **[用户指南](docs/user-guide/README.zh-CN.md):**安装、供应商、日常操作、配置、状态、安全、扩展、命令参考、限制和开发说明。
|
|
@@ -21,22 +21,22 @@ index 84e3d1bb0bcd499d3dd2cd07c08baa79807ca79c..7e1c407bb04714309226c40b5daa0082
|
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
diff --git a/node_modules/@strands-agents/sdk/dist/src/index.d.ts b/node_modules/@strands-agents/sdk/dist/src/index.d.ts
|
|
24
|
-
index
|
|
24
|
+
index 416fa4a6d2a29417506588e05f95562bc7f3aa79..62e02b408b78ef5ade04ecd24478031331b6b1e4 100644
|
|
25
25
|
--- a/node_modules/@strands-agents/sdk/dist/src/index.d.ts
|
|
26
26
|
+++ b/node_modules/@strands-agents/sdk/dist/src/index.d.ts
|
|
27
|
-
@@ -
|
|
27
|
+
@@ -64,6 +64,7 @@ export { ConversationManager, type ProactiveCompressionConfig, type Conversation
|
|
28
28
|
export { NullConversationManager } from './conversation-manager/null-conversation-manager.js';
|
|
29
29
|
export { SlidingWindowConversationManager, type SlidingWindowConversationManagerConfig, } from './conversation-manager/sliding-window-conversation-manager.js';
|
|
30
30
|
export { SummarizingConversationManager, type SummarizingConversationManagerConfig, } from './conversation-manager/summarizing-conversation-manager.js';
|
|
31
31
|
+export { DEFAULT_SUMMARIZATION_PROMPT } from './conversation-manager/compression/context-compression.js';
|
|
32
32
|
export { configureLogging } from './logging/logger.js';
|
|
33
33
|
export type { Logger } from './logging/types.js';
|
|
34
|
-
export { type McpClientOptions, type McpListToolsOptions, type McpToolFilterCallback, type McpToolFilters, type McpToolMatcher, type McpClientConfig, type McpClientCredentials, type McpTransport, type McpCallToolOptions, type TasksConfig, type McpConnectionState, type McpServerConfig, type SerializableMcpToolFilters, McpClient, } from './mcp/index.js';
|
|
34
|
+
export { type McpClientOptions, type McpListToolsOptions, type McpToolFilterCallback, type McpToolFilters, type McpToolMatcher, type McpClientConfig, type McpClientCredentials, type McpTransport, type McpCallToolOptions, type TasksConfig, type McpConnectionState, type McpLoadServersOptions, type McpServerConfig, type SerializableMcpToolFilters, McpClient, } from './mcp/index.js';
|
|
35
35
|
diff --git a/node_modules/@strands-agents/sdk/dist/src/index.js b/node_modules/@strands-agents/sdk/dist/src/index.js
|
|
36
|
-
index
|
|
36
|
+
index 1ffe683b6944318f8524c231674eabcf8428f89f..ea8dfa7ae5d5cfb3166a6e23afe3042d59b8973f 100644
|
|
37
37
|
--- a/node_modules/@strands-agents/sdk/dist/src/index.js
|
|
38
38
|
+++ b/node_modules/@strands-agents/sdk/dist/src/index.js
|
|
39
|
-
@@ -
|
|
39
|
+
@@ -53,6 +53,7 @@ export { ConversationManager, } from './conversation-manager/conversation-manage
|
|
40
40
|
export { NullConversationManager } from './conversation-manager/null-conversation-manager.js';
|
|
41
41
|
export { SlidingWindowConversationManager, } from './conversation-manager/sliding-window-conversation-manager.js';
|
|
42
42
|
export { SummarizingConversationManager, } from './conversation-manager/summarizing-conversation-manager.js';
|
|
@@ -44,6 +44,63 @@ index 3cb62b859eba690822bbd8fb1c2c9388cd151394..4a1febbd5752dc4bb0cbba24b0695c5c
|
|
|
44
44
|
// Logging
|
|
45
45
|
export { configureLogging } from './logging/logger.js';
|
|
46
46
|
// MCP Client types and implementations
|
|
47
|
+
diff --git a/node_modules/@strands-agents/sdk/dist/src/models/anthropic.js b/node_modules/@strands-agents/sdk/dist/src/models/anthropic.js
|
|
48
|
+
index ffbbb3d5d8a29ac0e21ffd2409658e1f69850492..ff1f3cac332a260fef809d318c11062de78ce3d8 100644
|
|
49
|
+
--- a/node_modules/@strands-agents/sdk/dist/src/models/anthropic.js
|
|
50
|
+
+++ b/node_modules/@strands-agents/sdk/dist/src/models/anthropic.js
|
|
51
|
+
@@ -560,6 +560,11 @@ export class AnthropicModel extends Model {
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
case 'reasoningBlock':
|
|
55
|
+
+ // darwin patch (SER-101): Responses-origin reasoning carries a
|
|
56
|
+
+ // provenance tag, not an Anthropic signature; never send it.
|
|
57
|
+
+ if (typeof block.signature === 'string' && block.signature.startsWith('darwin-responses:')) {
|
|
58
|
+
+ return undefined;
|
|
59
|
+
+ }
|
|
60
|
+
if (block.signature) {
|
|
61
|
+
return {
|
|
62
|
+
type: 'thinking',
|
|
63
|
+
diff --git a/node_modules/@strands-agents/sdk/dist/src/models/bedrock.js b/node_modules/@strands-agents/sdk/dist/src/models/bedrock.js
|
|
64
|
+
index e9efcc8ba832b878ec4b1ec0350e8ce6bf5b0e5b..0ff2da8f0256a9a6fa0a1153e868cfa53c9104a8 100644
|
|
65
|
+
--- a/node_modules/@strands-agents/sdk/dist/src/models/bedrock.js
|
|
66
|
+
+++ b/node_modules/@strands-agents/sdk/dist/src/models/bedrock.js
|
|
67
|
+
@@ -944,6 +944,19 @@ export class BedrockModel extends Model {
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
case 'reasoningBlock': {
|
|
71
|
+
+ // darwin patch (SER-101): Responses-origin reasoning (provenance tag in
|
|
72
|
+
+ // `signature`) is never sent to Converse, and a Claude model rejects a
|
|
73
|
+
+ // signature-less thinking block (`thinking.signature: Field required`),
|
|
74
|
+
+ // which is what another Converse model's reasoning (Kimi) carries.
|
|
75
|
+
+ if (typeof block.signature === 'string' && block.signature.startsWith('darwin-responses:')) {
|
|
76
|
+
+ return undefined;
|
|
77
|
+
+ }
|
|
78
|
+
+ if (block.signature === undefined &&
|
|
79
|
+
+ !block.redactedContent &&
|
|
80
|
+
+ /anthropic|claude/i.test(this._config.modelId ?? '')) {
|
|
81
|
+
+ logger.debug(`model_id=<${this._config.modelId}> | signature-less reasoning | dropping`);
|
|
82
|
+
+ return undefined;
|
|
83
|
+
+ }
|
|
84
|
+
if (block.text !== undefined || block.signature !== undefined) {
|
|
85
|
+
return {
|
|
86
|
+
reasoningContent: {
|
|
87
|
+
diff --git a/node_modules/@strands-agents/sdk/dist/src/models/openai/chat-adapter.js b/node_modules/@strands-agents/sdk/dist/src/models/openai/chat-adapter.js
|
|
88
|
+
index fb16b465262638c7d97e874156058a856174752c..0ff778d68eaea576279c6850cf6a708386496261 100644
|
|
89
|
+
--- a/node_modules/@strands-agents/sdk/dist/src/models/openai/chat-adapter.js
|
|
90
|
+
+++ b/node_modules/@strands-agents/sdk/dist/src/models/openai/chat-adapter.js
|
|
91
|
+
@@ -242,6 +242,12 @@ function formatChatMessages(messages) {
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
case 'reasoningBlock': {
|
|
95
|
+
+ // darwin patch (SER-101): Responses-origin reasoning is never
|
|
96
|
+
+ // sent to another model, not even as text.
|
|
97
|
+
+ if (typeof block.signature === 'string' && block.signature.startsWith('darwin-responses:')) {
|
|
98
|
+
+ logger.debug('block_type=<reasoningBlock> | responses-origin reasoning | dropping');
|
|
99
|
+
+ break;
|
|
100
|
+
+ }
|
|
101
|
+
if (block.text) {
|
|
102
|
+
logger.warn('block_type=<reasoningBlock> | reasoning blocks not supported by openai | converting to text');
|
|
103
|
+
textParts.push(block.text);
|
|
47
104
|
diff --git a/node_modules/@strands-agents/sdk/dist/src/models/openai/errors.js b/node_modules/@strands-agents/sdk/dist/src/models/openai/errors.js
|
|
48
105
|
index 17a473fe3bcdcc02e17cd95283c832d9021634c1..6e5cda23f672684b3926450322459279e2355066 100644
|
|
49
106
|
--- a/node_modules/@strands-agents/sdk/dist/src/models/openai/errors.js
|
|
@@ -56,23 +113,202 @@ index 17a473fe3bcdcc02e17cd95283c832d9021634c1..6e5cda23f672684b3926450322459279
|
|
|
56
113
|
];
|
|
57
114
|
/**
|
|
58
115
|
* Error patterns that indicate rate limiting.
|
|
116
|
+
diff --git a/node_modules/@strands-agents/sdk/dist/src/models/openai/model.js b/node_modules/@strands-agents/sdk/dist/src/models/openai/model.js
|
|
117
|
+
index e7db2ccc3d5d8cff7b27dbb5b5f46cdaf9a4de1b..d9881fb1d81a3cbd9e092591d8757023817ef6c7 100644
|
|
118
|
+
--- a/node_modules/@strands-agents/sdk/dist/src/models/openai/model.js
|
|
119
|
+
+++ b/node_modules/@strands-agents/sdk/dist/src/models/openai/model.js
|
|
120
|
+
@@ -196,7 +196,7 @@ export class OpenAIModel extends Model {
|
|
121
|
+
try {
|
|
122
|
+
const request = formatResponsesRequest(this._config, messages, options, this.stateful);
|
|
123
|
+
const stream = await this._client.responses.create(request, { signal: options?.cancelSignal });
|
|
124
|
+
- const state = createResponsesStreamState();
|
|
125
|
+
+ const state = createResponsesStreamState(request.model);
|
|
126
|
+
for await (const event of stream) {
|
|
127
|
+
for (const sdkEvent of mapResponsesEventToSDK(event, state, this.stateful, options?.modelState)) {
|
|
128
|
+
yield sdkEvent;
|
|
59
129
|
diff --git a/node_modules/@strands-agents/sdk/dist/src/models/openai/responses-adapter.d.ts b/node_modules/@strands-agents/sdk/dist/src/models/openai/responses-adapter.d.ts
|
|
60
|
-
index e17f00ac284c1e3357d55205c57b431061141b55..
|
|
130
|
+
index e17f00ac284c1e3357d55205c57b431061141b55..655e065df9823e8897759978a46cac8b2bee9d79 100644
|
|
61
131
|
--- a/node_modules/@strands-agents/sdk/dist/src/models/openai/responses-adapter.d.ts
|
|
62
132
|
+++ b/node_modules/@strands-agents/sdk/dist/src/models/openai/responses-adapter.d.ts
|
|
63
|
-
@@ -52,
|
|
133
|
+
@@ -52,15 +52,35 @@ export interface ResponsesStreamState {
|
|
64
134
|
outputTokens: number;
|
|
65
135
|
totalTokens: number;
|
|
66
136
|
cacheReadInputTokens?: number;
|
|
67
137
|
+ cacheWriteInputTokens?: number;
|
|
68
138
|
} | null;
|
|
69
139
|
stopReason: StopReason;
|
|
140
|
+
+ /** darwin patch (SER-101): request model id that tags captured reasoning. */
|
|
141
|
+
+ modelId?: string | undefined;
|
|
142
|
+
+ /** darwin patch (SER-101): what the open reasoning block streamed. */
|
|
143
|
+
+ reasoningKind?: 'text' | 'sum' | undefined;
|
|
70
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Creates fresh stream state for a new Responses API stream.
|
|
147
|
+
*
|
|
148
|
+
* @internal
|
|
149
|
+
*/
|
|
150
|
+
-export declare function createResponsesStreamState(): ResponsesStreamState;
|
|
151
|
+
+export declare function createResponsesStreamState(modelId?: string): ResponsesStreamState;
|
|
152
|
+
+/** darwin patch (SER-101): the provenance tag prefix carried in `ReasoningBlock.signature`. */
|
|
153
|
+
+export declare const RESPONSES_REASONING_TAG = "darwin-responses:v1:";
|
|
154
|
+
+/** darwin patch (SER-101): one tagged kind; `enc` carries the opaque `encrypted_content`. */
|
|
155
|
+
+export type ResponsesReasoningTag = {
|
|
156
|
+
+ modelId: string;
|
|
157
|
+
+ kind: 'text' | 'sum';
|
|
158
|
+
+} | {
|
|
159
|
+
+ modelId: string;
|
|
160
|
+
+ kind: 'enc';
|
|
161
|
+
+ encryptedContent: string;
|
|
162
|
+
+};
|
|
163
|
+
+/** @internal */
|
|
164
|
+
+export declare function encodeResponsesReasoningSignature(modelId: string, kind: 'text' | 'sum' | 'enc', encryptedContent?: string): string;
|
|
165
|
+
+/** @internal */
|
|
166
|
+
+export declare function parseResponsesReasoningSignature(signature: unknown): ResponsesReasoningTag | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* Maps a single Responses API stream event to zero or more SDK events. Mutates
|
|
169
|
+
* `state` and, when `stateful` is `true`, writes `responseId` into `modelState`.
|
|
71
170
|
diff --git a/node_modules/@strands-agents/sdk/dist/src/models/openai/responses-adapter.js b/node_modules/@strands-agents/sdk/dist/src/models/openai/responses-adapter.js
|
|
72
|
-
index
|
|
171
|
+
index 9605eb256daa6aebf7dddea2f745d44bdf6f6970..76fb886e50ccbe1faa4bfb5208b82d64cbe84510 100644
|
|
73
172
|
--- a/node_modules/@strands-agents/sdk/dist/src/models/openai/responses-adapter.js
|
|
74
173
|
+++ b/node_modules/@strands-agents/sdk/dist/src/models/openai/responses-adapter.js
|
|
75
|
-
@@ -
|
|
174
|
+
@@ -21,6 +21,72 @@ import { formatImageDataUrl, warnManagedParams as warnManagedParamsShared } from
|
|
175
|
+
import { applyCacheConfig } from './cache.js';
|
|
176
|
+
export const DEFAULT_RESPONSES_MODEL_ID = MODEL_DEFAULTS.openai.modelId;
|
|
177
|
+
const MANAGED_PARAMS = new Set(['model', 'input', 'stream', 'store']);
|
|
178
|
+
+/**
|
|
179
|
+
+ * darwin patch (SER-101): provenance of reasoning captured on the Responses path.
|
|
180
|
+
+ *
|
|
181
|
+
+ * `ReasoningBlock` has no provider-metadata field (harness-sdk#2014) and its
|
|
182
|
+
+ * `toJSON` persists only `text`/`signature`/`redactedContent`, so provenance
|
|
183
|
+
+ * rides inside `signature`:
|
|
184
|
+
+ * `darwin-responses:v1:<encodeURIComponent(modelId)>:<kind>[:<encrypted_content>]`.
|
|
185
|
+
+ * Kinds: `text` = raw reasoning text (replayed as `reasoning_text`), `enc` = one
|
|
186
|
+
+ * opaque `encrypted_content` item (replayed verbatim), `sum` = a summary kept for
|
|
187
|
+
+ * display only (never replayed). Replay is same-model and stateless only; every
|
|
188
|
+
+ * other formatter (Converse, Anthropic, Chat Completions) drops a tagged block.
|
|
189
|
+
+ * Drop these hunks on upgrade if upstream (harness-sdk#4598 / #3389) ships a
|
|
190
|
+
+ * provenance-aware round-trip.
|
|
191
|
+
+ */
|
|
192
|
+
+export const RESPONSES_REASONING_TAG = 'darwin-responses:v1:';
|
|
193
|
+
+const RESPONSES_REASONING_KINDS = new Set(['text', 'enc', 'sum']);
|
|
194
|
+
+/** @internal */
|
|
195
|
+
+export function encodeResponsesReasoningSignature(modelId, kind, encryptedContent) {
|
|
196
|
+
+ const tag = `${RESPONSES_REASONING_TAG}${encodeURIComponent(modelId)}:${kind}`;
|
|
197
|
+
+ return kind === 'enc' ? `${tag}:${encryptedContent}` : tag;
|
|
198
|
+
+}
|
|
199
|
+
+/** @internal Returns `undefined` for anything that is not a well-formed tag. */
|
|
200
|
+
+export function parseResponsesReasoningSignature(signature) {
|
|
201
|
+
+ if (typeof signature !== 'string' || !signature.startsWith(RESPONSES_REASONING_TAG))
|
|
202
|
+
+ return undefined;
|
|
203
|
+
+ const rest = signature.slice(RESPONSES_REASONING_TAG.length);
|
|
204
|
+
+ const modelEnd = rest.indexOf(':');
|
|
205
|
+
+ if (modelEnd <= 0)
|
|
206
|
+
+ return undefined;
|
|
207
|
+
+ let modelId;
|
|
208
|
+
+ try {
|
|
209
|
+
+ modelId = decodeURIComponent(rest.slice(0, modelEnd));
|
|
210
|
+
+ }
|
|
211
|
+
+ catch {
|
|
212
|
+
+ return undefined;
|
|
213
|
+
+ }
|
|
214
|
+
+ const tail = rest.slice(modelEnd + 1);
|
|
215
|
+
+ const kindEnd = tail.indexOf(':');
|
|
216
|
+
+ const kind = kindEnd < 0 ? tail : tail.slice(0, kindEnd);
|
|
217
|
+
+ if (!RESPONSES_REASONING_KINDS.has(kind))
|
|
218
|
+
+ return undefined;
|
|
219
|
+
+ if (kind === 'enc') {
|
|
220
|
+
+ const encryptedContent = kindEnd < 0 ? '' : tail.slice(kindEnd + 1);
|
|
221
|
+
+ return encryptedContent === '' ? undefined : { modelId, kind, encryptedContent };
|
|
222
|
+
+ }
|
|
223
|
+
+ return kindEnd < 0 ? { modelId, kind } : undefined;
|
|
224
|
+
+}
|
|
225
|
+
+/**
|
|
226
|
+
+ * The stateless `reasoning` input item for one assistant reasoning block, or
|
|
227
|
+
+ * `undefined` when it must be dropped: untagged, foreign model, display-only, or
|
|
228
|
+
+ * no replay model (stateful requests keep reasoning server-side).
|
|
229
|
+
+ */
|
|
230
|
+
+function formatResponsesReasoningInput(block, replayModelId) {
|
|
231
|
+
+ if (replayModelId === undefined)
|
|
232
|
+
+ return undefined;
|
|
233
|
+
+ const tag = parseResponsesReasoningSignature(block.signature);
|
|
234
|
+
+ if (tag === undefined || tag.modelId !== replayModelId)
|
|
235
|
+
+ return undefined;
|
|
236
|
+
+ if (tag.kind === 'enc') {
|
|
237
|
+
+ return { type: 'reasoning', summary: [], encrypted_content: tag.encryptedContent };
|
|
238
|
+
+ }
|
|
239
|
+
+ if (tag.kind === 'text' && typeof block.text === 'string' && block.text !== '') {
|
|
240
|
+
+ return { type: 'reasoning', summary: [], content: [{ type: 'reasoning_text', text: block.text }] };
|
|
241
|
+
+ }
|
|
242
|
+
+ return undefined;
|
|
243
|
+
+}
|
|
244
|
+
/**
|
|
245
|
+
* Logs a warning for each responses-managed key present in `params`.
|
|
246
|
+
*
|
|
247
|
+
@@ -35,7 +101,7 @@ export function warnManagedParams(params) {
|
|
248
|
+
* @internal
|
|
249
|
+
*/
|
|
250
|
+
export function formatResponsesRequest(config, messages, options, stateful) {
|
|
251
|
+
- const input = formatResponsesMessages(messages);
|
|
252
|
+
+ const input = formatResponsesMessages(messages, stateful ? undefined : (config.modelId ?? DEFAULT_RESPONSES_MODEL_ID));
|
|
253
|
+
// User `params` are spread first so provider-managed fields (asserted
|
|
254
|
+
// required by `ResponseCreateParamsStreaming` below) always win. The
|
|
255
|
+
// managed-params warning fires at config time to surface the collision.
|
|
256
|
+
@@ -111,11 +177,15 @@ export function formatResponsesRequest(config, messages, options, stateful) {
|
|
257
|
+
* - Text/media → grouped in `{ role, content: [...] }`
|
|
258
|
+
* - Tool calls → separate `{ type: 'function_call', ... }` items
|
|
259
|
+
* - Tool results → separate `{ type: 'function_call_output', ... }` items
|
|
260
|
+
+ * - Same-model tagged reasoning (darwin patch, SER-101) → stateless
|
|
261
|
+
+ * `{ type: 'reasoning', ... }` items with no `id`, before that message's
|
|
262
|
+
+ * text and `function_call` items
|
|
263
|
+
*/
|
|
264
|
+
-function formatResponsesMessages(messages) {
|
|
265
|
+
+function formatResponsesMessages(messages, replayModelId) {
|
|
266
|
+
const input = [];
|
|
267
|
+
for (const message of messages) {
|
|
268
|
+
const role = message.role === 'assistant' ? 'assistant' : 'user';
|
|
269
|
+
+ const reasoningItems = [];
|
|
270
|
+
const contentItems = [];
|
|
271
|
+
const toolCallItems = [];
|
|
272
|
+
const toolResultItems = [];
|
|
273
|
+
@@ -171,6 +241,11 @@ function formatResponsesMessages(messages) {
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
case 'reasoningBlock': {
|
|
277
|
+
+ const reasoning = role === 'assistant' ? formatResponsesReasoningInput(block, replayModelId) : undefined;
|
|
278
|
+
+ if (reasoning !== undefined) {
|
|
279
|
+
+ reasoningItems.push(reasoning);
|
|
280
|
+
+ break;
|
|
281
|
+
+ }
|
|
282
|
+
logger.warn('block_type=<reasoningBlock> | reasoning content is not yet supported in multi-turn conversations with the responses api');
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
@@ -179,6 +254,7 @@ function formatResponsesMessages(messages) {
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
+ input.push(...reasoningItems);
|
|
290
|
+
if (contentItems.length > 0) {
|
|
291
|
+
if (role === 'assistant') {
|
|
292
|
+
// Only the string EasyInputMessage form is a valid assistant *input* shape
|
|
293
|
+
@@ -303,12 +379,16 @@ function formatDocumentInput(docBlock) {
|
|
294
|
+
*
|
|
295
|
+
* @internal
|
|
296
|
+
*/
|
|
297
|
+
-export function createResponsesStreamState() {
|
|
298
|
+
+export function createResponsesStreamState(modelId) {
|
|
299
|
+
return {
|
|
300
|
+
dataType: null,
|
|
301
|
+
toolCalls: new Map(),
|
|
302
|
+
finalUsage: null,
|
|
303
|
+
stopReason: 'endTurn',
|
|
304
|
+
+ // darwin patch (SER-101): the request's model id tags captured reasoning;
|
|
305
|
+
+ // `reasoningKind` is what the open reasoning block streamed (`text`/`sum`).
|
|
306
|
+
+ modelId,
|
|
307
|
+
+ reasoningKind: undefined,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
@@ -328,9 +408,13 @@ function mapResponsesUsage(usage) {
|
|
76
312
|
totalTokens: usage.total_tokens,
|
|
77
313
|
};
|
|
78
314
|
const cached = usage.input_tokens_details?.cached_tokens;
|
|
@@ -87,6 +323,81 @@ index 25091ff4351eaa61dc370382a251285ed6f3a629..8d342dc7be28c63b7f609bd3c9cca00f
|
|
|
87
323
|
return mapped;
|
|
88
324
|
}
|
|
89
325
|
function createResponsesStreamError(message, code) {
|
|
326
|
+
@@ -359,22 +443,66 @@ export function mapResponsesEventToSDK(event, state, stateful, modelState) {
|
|
327
|
+
case 'response.output_text.delta': {
|
|
328
|
+
events.push(...switchContent('text', state.dataType));
|
|
329
|
+
state.dataType = 'text';
|
|
330
|
+
+ state.reasoningKind = undefined;
|
|
331
|
+
events.push({
|
|
332
|
+
type: 'modelContentBlockDeltaEvent',
|
|
333
|
+
delta: { type: 'textDelta', text: event.delta },
|
|
334
|
+
});
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
+ // darwin patch (SER-101): `response.reasoning.delta` is the Bedrock runtime
|
|
338
|
+
+ // endpoint's name for raw reasoning text (Kimi K3); same meaning as
|
|
339
|
+
+ // `response.reasoning_text.delta`. A block with any summary delta is `sum`.
|
|
340
|
+
+ case 'response.reasoning.delta':
|
|
341
|
+
case 'response.reasoning_text.delta':
|
|
342
|
+
case 'response.reasoning_summary_text.delta': {
|
|
343
|
+
+ if (state.dataType !== 'reasoning')
|
|
344
|
+
+ state.reasoningKind = undefined;
|
|
345
|
+
events.push(...switchContent('reasoning', state.dataType));
|
|
346
|
+
state.dataType = 'reasoning';
|
|
347
|
+
+ state.reasoningKind =
|
|
348
|
+
+ event.type === 'response.reasoning_summary_text.delta' || state.reasoningKind === 'sum' ? 'sum' : 'text';
|
|
349
|
+
events.push({
|
|
350
|
+
type: 'modelContentBlockDeltaEvent',
|
|
351
|
+
delta: { type: 'reasoningContentDelta', text: event.delta },
|
|
352
|
+
});
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
+ // darwin patch (SER-101): a finished reasoning item closes the open reasoning
|
|
356
|
+
+ // block with its provenance tag, and its `encrypted_content` (if any) becomes a
|
|
357
|
+
+ // block of its own, so several opaque items never collapse into one.
|
|
358
|
+
+ case 'response.output_item.done': {
|
|
359
|
+
+ const item = event.item;
|
|
360
|
+
+ if (item?.type !== 'reasoning')
|
|
361
|
+
+ break;
|
|
362
|
+
+ const encrypted = typeof item.encrypted_content === 'string' && item.encrypted_content !== '' ? item.encrypted_content : undefined;
|
|
363
|
+
+ if (state.dataType === 'reasoning') {
|
|
364
|
+
+ if (state.modelId !== undefined) {
|
|
365
|
+
+ const kind = encrypted !== undefined ? 'sum' : (state.reasoningKind ?? 'text');
|
|
366
|
+
+ events.push({
|
|
367
|
+
+ type: 'modelContentBlockDeltaEvent',
|
|
368
|
+
+ delta: { type: 'reasoningContentDelta', signature: encodeResponsesReasoningSignature(state.modelId, kind) },
|
|
369
|
+
+ });
|
|
370
|
+
+ }
|
|
371
|
+
+ events.push({ type: 'modelContentBlockStopEvent' });
|
|
372
|
+
+ state.dataType = null;
|
|
373
|
+
+ state.reasoningKind = undefined;
|
|
374
|
+
+ }
|
|
375
|
+
+ if (encrypted !== undefined && state.modelId !== undefined) {
|
|
376
|
+
+ events.push(...switchContent('reasoning', state.dataType));
|
|
377
|
+
+ events.push({
|
|
378
|
+
+ type: 'modelContentBlockDeltaEvent',
|
|
379
|
+
+ delta: {
|
|
380
|
+
+ type: 'reasoningContentDelta',
|
|
381
|
+
+ signature: encodeResponsesReasoningSignature(state.modelId, 'enc', encrypted),
|
|
382
|
+
+ },
|
|
383
|
+
+ });
|
|
384
|
+
+ events.push({ type: 'modelContentBlockStopEvent' });
|
|
385
|
+
+ state.dataType = null;
|
|
386
|
+
+ state.reasoningKind = undefined;
|
|
387
|
+
+ }
|
|
388
|
+
+ break;
|
|
389
|
+
+ }
|
|
390
|
+
case 'response.output_text.annotation.added': {
|
|
391
|
+
// The SDK types `event.annotation` as `unknown` and doesn't export a
|
|
392
|
+
// named annotation union, so we narrow structurally on the fields we use.
|
|
393
|
+
@@ -388,6 +516,7 @@ export function mapResponsesEventToSDK(event, state, stateful, modelState) {
|
|
394
|
+
// a fresh TextBlock.
|
|
395
|
+
events.push(...switchContent('citations', state.dataType));
|
|
396
|
+
state.dataType = 'citations';
|
|
397
|
+
+ state.reasoningKind = undefined;
|
|
398
|
+
events.push({
|
|
399
|
+
type: 'modelContentBlockDeltaEvent',
|
|
400
|
+
delta: {
|
|
90
401
|
diff --git a/node_modules/@strands-agents/sdk/dist/src/vended-plugins/context-offloader/plugin.d.ts b/node_modules/@strands-agents/sdk/dist/src/vended-plugins/context-offloader/plugin.d.ts
|
|
91
402
|
index b0223555c1f0410441546be860dbae824ac9857c..92ab47f4c8c1f5225c13dfd8a5e37324846bdfc2 100644
|
|
92
403
|
--- a/node_modules/@strands-agents/sdk/dist/src/vended-plugins/context-offloader/plugin.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// `DEFAULT_SUMMARIZATION_PROMPT` reaches the package root only through the pinned
|
|
2
|
-
// SDK patch (`patches/@strands-agents__sdk@1.
|
|
2
|
+
// SDK patch (`patches/@strands-agents__sdk@1.18.0.patch`, `dist/src/index.*`
|
|
3
3
|
// hunks): the SDK declares it in a module its `exports` map does not expose.
|
|
4
4
|
// Never copy the string here — a copy would drift from what the SDK sends when
|
|
5
5
|
// no focus is given.
|
|
@@ -107,8 +107,21 @@ export function bedrockCacheConfig(plan) {
|
|
|
107
107
|
return {
|
|
108
108
|
strategy: 'auto',
|
|
109
109
|
// One TTL everywhere: Bedrock requires TTLs to be non-increasing across
|
|
110
|
-
// tools → system → messages, and equal values satisfy that trivially.
|
|
111
|
-
|
|
110
|
+
// tools → system → messages, and equal values satisfy that trivially. The
|
|
111
|
+
// shared `ttl` matters as much as the per-section values: whenever a request
|
|
112
|
+
// carries a *string* system prompt — the SDK summarizer behind `/compact`,
|
|
113
|
+
// recipe children — the SDK auto-injects a system cache point of its own and
|
|
114
|
+
// fills its TTL from `systemPromptTTL`/`ttl`. Without these, that point stays
|
|
115
|
+
// at Bedrock's `5m` default between a `1h` tools point and a `1h` messages
|
|
116
|
+
// point, and Bedrock rejects the request (`a ttl='1h' cache_control block
|
|
117
|
+
// must not come after a ttl='5m' cache_control block`). Darwin's hand-placed
|
|
118
|
+
// system point already carries the TTL, so it is left as written.
|
|
119
|
+
...(plan.ttl !== undefined && {
|
|
120
|
+
ttl: plan.ttl,
|
|
121
|
+
toolsTTL: plan.ttl,
|
|
122
|
+
systemPromptTTL: plan.ttl,
|
|
123
|
+
messagesTTL: plan.ttl,
|
|
124
|
+
}),
|
|
112
125
|
};
|
|
113
126
|
}
|
|
114
127
|
/**
|