strands-darwin 0.0.48 → 0.0.51

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.
Files changed (76) hide show
  1. package/README.md +7 -2
  2. package/README.zh-CN.md +7 -2
  3. package/dist/patches/{@strands-agents+sdk+1.18.0.patch → @strands-agents+sdk+1.20.0.patch} +28 -52
  4. package/dist/src/agent/background-delegation.d.ts +1 -1
  5. package/dist/src/agent/background-delegation.js +3 -3
  6. package/dist/src/agent/cache-miss.d.ts +3 -3
  7. package/dist/src/agent/cache-miss.js +6 -3
  8. package/dist/src/agent/cache-miss.js.map +1 -1
  9. package/dist/src/agent/compact.js +1 -1
  10. package/dist/src/agent/cost.d.ts +1 -1
  11. package/dist/src/agent/instructions.d.ts +9 -4
  12. package/dist/src/agent/instructions.js +18 -8
  13. package/dist/src/agent/instructions.js.map +1 -1
  14. package/dist/src/agent/runtime.d.ts +22 -5
  15. package/dist/src/agent/runtime.js +127 -8
  16. package/dist/src/agent/runtime.js.map +1 -1
  17. package/dist/src/agent/usage-state.d.ts +29 -0
  18. package/dist/src/agent/usage-state.js +131 -0
  19. package/dist/src/agent/usage-state.js.map +1 -0
  20. package/dist/src/agent/usage.d.ts +1 -1
  21. package/dist/src/cli-doctor.js +12 -8
  22. package/dist/src/cli-doctor.js.map +1 -1
  23. package/dist/src/commands/custom-commands.d.ts +1 -1
  24. package/dist/src/commands/custom-commands.js +2 -1
  25. package/dist/src/commands/custom-commands.js.map +1 -1
  26. package/dist/src/commands/init-command.d.ts +3 -1
  27. package/dist/src/commands/init-command.js +6 -6
  28. package/dist/src/commands/init-command.js.map +1 -1
  29. package/dist/src/config.d.ts +3 -1
  30. package/dist/src/config.js +5 -0
  31. package/dist/src/config.js.map +1 -1
  32. package/dist/src/headless-runner.js +10 -7
  33. package/dist/src/headless-runner.js.map +1 -1
  34. package/dist/src/headless.d.ts +1 -1
  35. package/dist/src/headless.js +1 -1
  36. package/dist/src/import-claude.js +18 -3
  37. package/dist/src/import-claude.js.map +1 -1
  38. package/dist/src/mcp/codegraph-preflight.js +8 -4
  39. package/dist/src/mcp/codegraph-preflight.js.map +1 -1
  40. package/dist/src/mcp/oauth-login.js +1 -1
  41. package/dist/src/mcp/oauth-login.js.map +1 -1
  42. package/dist/src/mcp/oauth-provider.d.ts +1 -2
  43. package/dist/src/mcp/oauth-provider.js +9 -0
  44. package/dist/src/mcp/oauth-provider.js.map +1 -1
  45. package/dist/src/mcp/oauth-store.d.ts +1 -2
  46. package/dist/src/mcp/oauth-store.js +9 -2
  47. package/dist/src/mcp/oauth-store.js.map +1 -1
  48. package/dist/src/mcp/prompts.d.ts +0 -18
  49. package/dist/src/mcp/prompts.js +25 -4
  50. package/dist/src/mcp/prompts.js.map +1 -1
  51. package/dist/src/mcp/web-search-empty-results.js +8 -4
  52. package/dist/src/mcp/web-search-empty-results.js.map +1 -1
  53. package/dist/src/npm-package/patch-package-format.d.ts +5 -5
  54. package/dist/src/npm-package/patch-package-format.js +4 -4
  55. package/dist/src/sdk-patch-preflight.js +1 -1
  56. package/dist/src/skills/builtin/developer/SKILL.md +1 -1
  57. package/dist/src/trajectory/record.d.ts +1 -1
  58. package/dist/src/tui/App.d.ts +1 -1
  59. package/dist/src/tui/App.js +118 -20
  60. package/dist/src/tui/App.js.map +1 -1
  61. package/dist/src/tui/InputBox.d.ts +1 -1
  62. package/dist/src/tui/InputBox.js +1 -1
  63. package/dist/src/tui/git-diff.d.ts +19 -0
  64. package/dist/src/tui/git-diff.js +147 -0
  65. package/dist/src/tui/git-diff.js.map +1 -0
  66. package/dist/src/tui/help-format.d.ts +1 -1
  67. package/dist/src/tui/help-format.js +2 -2
  68. package/dist/src/tui/help-format.js.map +1 -1
  69. package/dist/src/tui/instructions-format.js +2 -2
  70. package/dist/src/tui/instructions-format.js.map +1 -1
  71. package/dist/src/tui/task-wake.d.ts +1 -1
  72. package/dist/src/tui/task-wake.js +1 -1
  73. package/dist/src/tui/turn-state.d.ts +1 -1
  74. package/dist/src/tui/turn-state.js +10 -2
  75. package/dist/src/tui/turn-state.js.map +1 -1
  76. package/package.json +3 -2
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  <p>
6
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&amp;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&amp;logoColor=white"></a>
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>
8
+ <a href="https://www.npmjs.com/package/@strands-agents/sdk"><img alt="Strands Agents SDK 1.20.0" src="https://img.shields.io/badge/Strands_Agents_SDK-1.20.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%">
@@ -108,6 +108,8 @@ Bedrock uses the standard AWS credential chain and requires an inference-profile
108
108
 
109
109
  For multiple switchable models, provider-specific fields, Bedrock Mantle, caching, thinking effort, context limits, and all session settings, read [Getting started and providers](docs/user-guide/getting-started.md) and [Configuration and context](docs/user-guide/configuration.md).
110
110
 
111
+ Project instructions (`AGENTS.md`, or fallback `CLAUDE.md`) preload up to **64 KiB** by default. Set the optional root `maxInstructionsBytes` field in the same config to a positive integer byte count, for example `131072` for 128 KiB. See [instruction limits and session behavior](docs/user-guide/configuration.md#agentsmd-or-claudemd).
112
+
111
113
  ## Use it
112
114
 
113
115
  To see live local session lease holders across this HOME's projects, use `/list-agents`
@@ -131,6 +133,7 @@ reply automatically at idle. Different projects require one human
131
133
  /developer <requirement>
132
134
  /self-evolution-research
133
135
  /help local command, prompt, and key reference
136
+ /diff [--staged] inspect tracked Git changes locally, without a model turn (idle TUI only)
134
137
  /init ask the model to create or improve this project's AGENTS.md
135
138
  /review [focus] review current changes for bugs and test gaps
136
139
  /review --commit <SHA> review an exact 40-hex commit
@@ -140,12 +143,14 @@ reply automatically at idle. Different projects require one human
140
143
  /goal <condition> keep going until a condition holds: a small model checks after each completed turn, at most 5 automatic continuations; /goal shows it, /goal off clears it
141
144
  ```
142
145
 
143
- 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, `Ctrl+Home`/`Ctrl+End` jump to the start/end of the whole draft; plain `Home`/`End` and `Ctrl+A`/`Ctrl+E` stay on the current visual row. `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)). `Ctrl+G` opens the unsent draft in your `$VISUAL` (else `$EDITOR`) while darwin is idle, run without a shell; the saved result replaces the draft but is not sent until you press `Enter`, and a failed or unchanged edit keeps the draft as it was ([external editor rules](docs/user-guide/using-darwin.md#external-editor-ctrlg)). 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.
146
+ 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, `Ctrl+Home`/`Ctrl+End` jump to the start/end of the whole draft; plain `Home`/`End` and `Ctrl+A`/`Ctrl+E` stay on the current visual row. `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)). `Ctrl+G` or `Ctrl+X` then `Ctrl+E` opens the unsent draft in your `$VISUAL` (else `$EDITOR`) while darwin is idle, run without a shell; the saved result replaces the draft but is not sent until you press `Enter`, and a failed or unchanged edit keeps the draft as it was ([external editor rules](docs/user-guide/using-darwin.md#external-editor-ctrlg)). 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.
144
147
 
145
148
  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).
146
149
 
147
150
  `/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. `/review --commit <40-hex-SHA>` instead asks for the exact commit's parent diff (or the empty tree for a root commit), surrounding code and tests; malformed explicit scopes show local usage, and missing objects must be reported honestly. 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).
148
151
 
152
+ `/diff` shows tracked unstaged changes (worktree versus index); `/diff --staged` shows the index versus HEAD, including unborn repositories. Untracked and submodule contents are excluded. This idle-only TUI viewer prints one bounded, terminal-safe local notice, never sends a model prompt or shell report, and does not change files or the index. Other arguments show usage; busy invocations refuse instead of queueing. Empty scope is not a clean-tree claim; errors and truncation are explicit. [Bounds and helper-safety limitations](docs/user-guide/using-darwin.md#local-git-diff) differ from the model-driven `/review` and `!git diff`.
153
+
149
154
  For non-interactive use:
150
155
 
151
156
  ```bash
package/README.zh-CN.md CHANGED
@@ -5,7 +5,7 @@
5
5
  <p>
6
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&amp;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&amp;logoColor=white"></a>
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>
8
+ <a href="https://www.npmjs.com/package/@strands-agents/sdk"><img alt="Strands Agents SDK 1.20.0" src="https://img.shields.io/badge/Strands_Agents_SDK-1.20.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%">
@@ -108,6 +108,8 @@ Bedrock 使用标准 AWS 凭证链。模型 ID 必须是 `us.`、`eu.`、`apac.`
108
108
 
109
109
  多模型切换、各供应商字段、Bedrock Mantle、缓存、思考强度、上下文限制和全部会话设置,见[入门与模型供应商](docs/user-guide/getting-started.zh-CN.md)和[配置与上下文](docs/user-guide/configuration.zh-CN.md)。
110
110
 
111
+ 项目指令(`AGENTS.md`,或回退的 `CLAUDE.md`)默认预加载上限为 **64 KiB**。可在同一配置根级设置 `maxInstructionsBytes`,值为正整数字节数,例如 `131072` 表示 128 KiB;省略即可使用默认值。生效时机与历史会话规则见[配置与上下文](docs/user-guide/configuration.zh-CN.md)。
112
+
111
113
  ## 日常使用
112
114
 
113
115
  用 `/list-agents` 或离线 CLI `darwin list-agents`,可以跨项目查看当前 HOME 中本机仍存活的会话租约持有者;CLI 不需要配置模型供应商。这只是只读查看,**不提供通信能力**;`/agents` 仍然列出本进程的子代理派发。详见[范围与限制](docs/user-guide/sessions-and-state.zh-CN.md#查看本机会话进程)。
@@ -126,6 +128,7 @@ Bedrock 使用标准 AWS 凭证链。模型 ID 必须是 `us.`、`eu.`、`apac.`
126
128
  /developer <requirement>
127
129
  /self-evolution-research
128
130
  /help 查看本地命令、输入语法和按键说明
131
+ /diff [--staged] 本地查看已跟踪的 Git 改动,不调用模型(仅限空闲 TUI)
129
132
  /init 请模型为当前项目创建或改进 AGENTS.md
130
133
  /review [focus] 审查当前改动中的缺陷和测试缺口
131
134
  /review --commit <SHA> 审查指定的 40 位十六进制提交
@@ -135,12 +138,14 @@ Bedrock 使用标准 AWS 凭证链。模型 ID 必须是 `us.`、`eu.`、`apac.`
135
138
  /goal <条件> 持续工作直到条件成立:每个完成的回合后由小模型检查一次,最多自动续跑 5 次;/goal 查看,/goal off 清除
136
139
  ```
137
140
 
138
- 按 `Ctrl+R` 可搜索当前项目的提示历史(输入文字筛选,按 `Ctrl+R`/`Up`/`Down` 切换结果,按 `Enter`/`Tab` 接受,按 `Escape` 取消);忙碌时按 `Ctrl+C` 取消,按 `Ctrl+B` 展开或收起工具详情,使用 `/exit` 或 `Ctrl+D` 退出。编辑输入时,`Ctrl+Home`/`Ctrl+End` 跳到整份草稿的开头/结尾;普通 `Home`/`End` 和 `Ctrl+A`/`Ctrl+E` 仍只移动到当前显示行的开头/结尾。`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#草稿暂存))。darwin 空闲时按 `Ctrl+G` 可用 `$VISUAL`(未设置时用 `$EDITOR`)编辑未发送的草稿,编辑器不经 shell 直接运行;保存后的结果替换草稿,但要按 `Enter` 才会发送,编辑失败或未改动时草稿保持原样([外部编辑器规则](docs/user-guide/using-darwin.zh-CN.md#外部编辑器))。输入框为空且空闲时,连按两次 `Esc`(第二次在 500 ms 内)会打开 `/rewind` 选择器,效果与输入 `/rewind` 完全相同;此时单按一次 `Esc` 不做任何事。模型发起的工具调用仍会经过当前审批模式;`!` 命令由你亲自输入,因此不走模型工具审批。darwin 启动的每个进程——模型的 `bash` shell 与后台任务、你的 `!` 命令、hook 命令和 stdio MCP 服务器——环境中都带有 `DARWIN=1`(你已导出的 `DARWIN` 原样保留),脚本和 hook 由此可以判断自己运行在代理之下。
141
+ 按 `Ctrl+R` 可搜索当前项目的提示历史(输入文字筛选,按 `Ctrl+R`/`Up`/`Down` 切换结果,按 `Enter`/`Tab` 接受,按 `Escape` 取消);忙碌时按 `Ctrl+C` 取消,按 `Ctrl+B` 展开或收起工具详情,使用 `/exit` 或 `Ctrl+D` 退出。编辑输入时,`Ctrl+Home`/`Ctrl+End` 跳到整份草稿的开头/结尾;普通 `Home`/`End` 和 `Ctrl+A`/`Ctrl+E` 仍只移动到当前显示行的开头/结尾。`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#草稿暂存))。darwin 空闲时按 `Ctrl+G`,或先按 `Ctrl+X` 再按 `Ctrl+E`,可用 `$VISUAL`(未设置时用 `$EDITOR`)编辑未发送的草稿,编辑器不经 shell 直接运行;保存后的结果替换草稿,但要按 `Enter` 才会发送,编辑失败或未改动时草稿保持原样([外部编辑器规则](docs/user-guide/using-darwin.zh-CN.md#外部编辑器))。输入框为空且空闲时,连按两次 `Esc`(第二次在 500 ms 内)会打开 `/rewind` 选择器,效果与输入 `/rewind` 完全相同;此时单按一次 `Esc` 不做任何事。模型发起的工具调用仍会经过当前审批模式;`!` 命令由你亲自输入,因此不走模型工具审批。darwin 启动的每个进程——模型的 `bash` shell 与后台任务、你的 `!` 命令、hook 命令和 stdio MCP 服务器——环境中都带有 `DARWIN=1`(你已导出的 `DARWIN` 原样保留),脚本和 hook 由此可以判断自己运行在代理之下。
139
142
 
140
143
  想在切到别处时被叫回来,可在 `~/.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)。
141
144
 
142
145
  `/review` 请模型检查暂存、未暂存的改动及相关未跟踪文件,按优先级报告有证据的缺陷,并单列测试缺口。可选 focus 保持为字面文本。`/review --commit <40-hex-SHA>` 则要求审查指定提交与父提交的差异(根提交与空树比较)及周围代码/测试;无效参数在本地提示用法,缺失的对象须如实说明。提示要求未经另行请求不要修改文件或提交,但**不会强制只读,也不改变权限模式**。内置命令现在占用 `/review`;原来使用该斜杠名称的自定义命令或 skill 需要改名,例如 `audit`。详见[审查改动](docs/user-guide/using-darwin.zh-CN.md#审查改动)。
143
146
 
147
+ `/diff` 查看已跟踪文件的未暂存改动(工作区与索引比较);`/diff --staged` 查看索引与 HEAD 的差异,也支持尚无提交的仓库。未跟踪文件和子模块内容不在范围内。此命令仅供空闲 TUI 使用,以一条有界、转义终端控制字符的本地通知展示结果,不发送模型提示或 shell 报告,也不修改文件或索引。其他参数只显示用法,忙碌时拒绝而不排队。所选范围为空不代表整个工作区干净;错误和截断均会注明。它与调用模型的 `/review` 及 `!git diff` 不同,详见[上限与 Git 辅助程序限制](docs/user-guide/using-darwin.zh-CN.md#本地-git-差异)。
148
+
144
149
  无交互运行方式如下:
145
150
 
146
151
  ```bash
@@ -1,42 +1,20 @@
1
- diff --git a/node_modules/@strands-agents/sdk/dist/src/conversation-manager/compression/context-compression.js b/node_modules/@strands-agents/sdk/dist/src/conversation-manager/compression/context-compression.js
2
- index 84e3d1bb0bcd499d3dd2cd07c08baa79807ca79c..7e1c407bb04714309226c40b5daa00827799f477 100644
3
- --- a/node_modules/@strands-agents/sdk/dist/src/conversation-manager/compression/context-compression.js
4
- +++ b/node_modules/@strands-agents/sdk/dist/src/conversation-manager/compression/context-compression.js
5
- @@ -126,9 +126,16 @@ export async function generateSummary(messagesToSummarize, model, systemPrompt)
6
- if (!result?.done || !result.value) {
7
- throw new Error('Failed to generate summary: no response from model');
8
- }
9
- + // Thinking models include reasoning blocks in the summary response; a
10
- + // user-role message must never carry reasoning content (providers reject
11
- + // the request), so keep only the non-reasoning blocks.
12
- + const summaryContent = result.value.message.content.filter((block) => block.type !== 'reasoningBlock');
13
- + if (summaryContent.length === 0) {
14
- + throw new Error('Failed to generate summary: response contained no non-reasoning content');
15
- + }
16
- return new Message({
17
- role: 'user',
18
- - content: result.value.message.content,
19
- + content: summaryContent,
20
- });
21
- }
22
- /**
23
1
  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 416fa4a6d2a29417506588e05f95562bc7f3aa79..62e02b408b78ef5ade04ecd24478031331b6b1e4 100644
2
+ index 7595798e7151f873e43eddd9ccfdba0dd383b28e..23b5c61f9836ae4bb9af2716ad533b3000e18af7 100644
25
3
  --- a/node_modules/@strands-agents/sdk/dist/src/index.d.ts
26
4
  +++ b/node_modules/@strands-agents/sdk/dist/src/index.d.ts
27
- @@ -64,6 +64,7 @@ export { ConversationManager, type ProactiveCompressionConfig, type Conversation
5
+ @@ -65,6 +65,7 @@ export { ConversationManager, type ProactiveCompressionConfig, type Conversation
28
6
  export { NullConversationManager } from './conversation-manager/null-conversation-manager.js';
29
7
  export { SlidingWindowConversationManager, type SlidingWindowConversationManagerConfig, } from './conversation-manager/sliding-window-conversation-manager.js';
30
8
  export { SummarizingConversationManager, type SummarizingConversationManagerConfig, } from './conversation-manager/summarizing-conversation-manager.js';
31
9
  +export { DEFAULT_SUMMARIZATION_PROMPT } from './conversation-manager/compression/context-compression.js';
32
10
  export { configureLogging } from './logging/logger.js';
33
11
  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 McpLoadServersOptions, type McpServerConfig, type SerializableMcpToolFilters, McpClient, } from './mcp/index.js';
12
+ 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, McpTaskCancelledError, McpTaskFailedError, } from './mcp/index.js';
35
13
  diff --git a/node_modules/@strands-agents/sdk/dist/src/index.js b/node_modules/@strands-agents/sdk/dist/src/index.js
36
- index 1ffe683b6944318f8524c231674eabcf8428f89f..ea8dfa7ae5d5cfb3166a6e23afe3042d59b8973f 100644
14
+ index 29310747d3224a66b2f09607ce8f84122aebda70..05e66c2edd18e8c763d0885538bbfbe705a83be2 100644
37
15
  --- a/node_modules/@strands-agents/sdk/dist/src/index.js
38
16
  +++ b/node_modules/@strands-agents/sdk/dist/src/index.js
39
- @@ -53,6 +53,7 @@ export { ConversationManager, } from './conversation-manager/conversation-manage
17
+ @@ -55,6 +55,7 @@ export { ConversationManager, } from './conversation-manager/conversation-manage
40
18
  export { NullConversationManager } from './conversation-manager/null-conversation-manager.js';
41
19
  export { SlidingWindowConversationManager, } from './conversation-manager/sliding-window-conversation-manager.js';
42
20
  export { SummarizingConversationManager, } from './conversation-manager/summarizing-conversation-manager.js';
@@ -45,10 +23,10 @@ index 1ffe683b6944318f8524c231674eabcf8428f89f..ea8dfa7ae5d5cfb3166a6e23afe3042d
45
23
  export { configureLogging } from './logging/logger.js';
46
24
  // MCP Client types and implementations
47
25
  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
26
+ index d3b97dfe1f49f9c8251f4d74a2640b7684691f98..e747a7ac319ba38ce340aec08800dc751f10c4ee 100644
49
27
  --- a/node_modules/@strands-agents/sdk/dist/src/models/anthropic.js
50
28
  +++ b/node_modules/@strands-agents/sdk/dist/src/models/anthropic.js
51
- @@ -560,6 +560,11 @@ export class AnthropicModel extends Model {
29
+ @@ -682,6 +682,11 @@ export class AnthropicModel extends Model {
52
30
  };
53
31
  }
54
32
  case 'reasoningBlock':
@@ -61,7 +39,7 @@ index ffbbb3d5d8a29ac0e21ffd2409658e1f69850492..ff1f3cac332a260fef809d318c11062d
61
39
  return {
62
40
  type: 'thinking',
63
41
  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
42
+ index a0077cfe424d3d67a90207b52f114162d743d2b5..ca209b98dc687402b4e13b8eef700812b3b7c63a 100644
65
43
  --- a/node_modules/@strands-agents/sdk/dist/src/models/bedrock.js
66
44
  +++ b/node_modules/@strands-agents/sdk/dist/src/models/bedrock.js
67
45
  @@ -944,6 +944,19 @@ export class BedrockModel extends Model {
@@ -114,10 +92,10 @@ index 17a473fe3bcdcc02e17cd95283c832d9021634c1..6e5cda23f672684b3926450322459279
114
92
  /**
115
93
  * Error patterns that indicate rate limiting.
116
94
  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
95
+ index 37291c025ed65317d80d5fa092621b7b678bafde..ba44c9120133ad75d1307b9684ffa82c0a0ef8cd 100644
118
96
  --- a/node_modules/@strands-agents/sdk/dist/src/models/openai/model.js
119
97
  +++ b/node_modules/@strands-agents/sdk/dist/src/models/openai/model.js
120
- @@ -196,7 +196,7 @@ export class OpenAIModel extends Model {
98
+ @@ -203,7 +203,7 @@ export class OpenAIModel extends Model {
121
99
  try {
122
100
  const request = formatResponsesRequest(this._config, messages, options, this.stateful);
123
101
  const stream = await this._client.responses.create(request, { signal: options?.cancelSignal });
@@ -127,14 +105,11 @@ index e7db2ccc3d5d8cff7b27dbb5b5f46cdaf9a4de1b..d9881fb1d81a3cbd9e092591d8757023
127
105
  for (const sdkEvent of mapResponsesEventToSDK(event, state, this.stateful, options?.modelState)) {
128
106
  yield sdkEvent;
129
107
  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
130
- index e17f00ac284c1e3357d55205c57b431061141b55..655e065df9823e8897759978a46cac8b2bee9d79 100644
108
+ index a7b4edd12a5ac33277a5ad2c4bcea4c4d8c1ea7d..655e065df9823e8897759978a46cac8b2bee9d79 100644
131
109
  --- a/node_modules/@strands-agents/sdk/dist/src/models/openai/responses-adapter.d.ts
132
110
  +++ b/node_modules/@strands-agents/sdk/dist/src/models/openai/responses-adapter.d.ts
133
- @@ -52,15 +52,35 @@ export interface ResponsesStreamState {
134
- outputTokens: number;
135
- totalTokens: number;
136
- cacheReadInputTokens?: number;
137
- + cacheWriteInputTokens?: number;
111
+ @@ -55,13 +55,32 @@ export interface ResponsesStreamState {
112
+ cacheWriteInputTokens?: number;
138
113
  } | null;
139
114
  stopReason: StopReason;
140
115
  + /** darwin patch (SER-101): request model id that tags captured reasoning. */
@@ -168,7 +143,7 @@ index e17f00ac284c1e3357d55205c57b431061141b55..655e065df9823e8897759978a46cac8b
168
143
  * Maps a single Responses API stream event to zero or more SDK events. Mutates
169
144
  * `state` and, when `stateful` is `true`, writes `responseId` into `modelState`.
170
145
  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
171
- index 9605eb256daa6aebf7dddea2f745d44bdf6f6970..76fb886e50ccbe1faa4bfb5208b82d64cbe84510 100644
146
+ index ddf156fe33b08dfb6a1dc265eb86f2fac31d9c53..c4cd19b5064de07722f88bb71874567061ed74ed 100644
172
147
  --- a/node_modules/@strands-agents/sdk/dist/src/models/openai/responses-adapter.js
173
148
  +++ b/node_modules/@strands-agents/sdk/dist/src/models/openai/responses-adapter.js
174
149
  @@ -21,6 +21,72 @@ import { formatImageDataUrl, warnManagedParams as warnManagedParamsShared } from
@@ -308,7 +283,7 @@ index 9605eb256daa6aebf7dddea2f745d44bdf6f6970..76fb886e50ccbe1faa4bfb5208b82d64
308
283
  };
309
284
  }
310
285
  /**
311
- @@ -328,9 +408,13 @@ function mapResponsesUsage(usage) {
286
+ @@ -329,13 +409,13 @@ function mapResponsesUsage(usage) {
312
287
  totalTokens: usage.total_tokens,
313
288
  };
314
289
  const cached = usage.input_tokens_details?.cached_tokens;
@@ -316,14 +291,15 @@ index 9605eb256daa6aebf7dddea2f745d44bdf6f6970..76fb886e50ccbe1faa4bfb5208b82d64
316
291
  + if (typeof cached === 'number' && cached >= 0) {
317
292
  mapped.cacheReadInputTokens = cached;
318
293
  }
319
- + const cacheWrite = usage.input_tokens_details?.cache_write_tokens;
294
+ // GPT-5.6 reports cache writes here; the openai package's InputTokensDetails
295
+ // does not type the field yet, so read it through a narrow cast.
296
+ const cacheWrite = usage.input_tokens_details?.cache_write_tokens;
297
+ - if (typeof cacheWrite === 'number' && cacheWrite > 0) {
320
298
  + if (typeof cacheWrite === 'number' && cacheWrite >= 0) {
321
- + mapped.cacheWriteInputTokens = cacheWrite;
322
- + }
299
+ mapped.cacheWriteInputTokens = cacheWrite;
300
+ }
323
301
  return mapped;
324
- }
325
- function createResponsesStreamError(message, code) {
326
- @@ -359,22 +443,66 @@ export function mapResponsesEventToSDK(event, state, stateful, modelState) {
302
+ @@ -366,22 +446,66 @@ export function mapResponsesEventToSDK(event, state, stateful, modelState) {
327
303
  case 'response.output_text.delta': {
328
304
  events.push(...switchContent('text', state.dataType));
329
305
  state.dataType = 'text';
@@ -390,7 +366,7 @@ index 9605eb256daa6aebf7dddea2f745d44bdf6f6970..76fb886e50ccbe1faa4bfb5208b82d64
390
366
  case 'response.output_text.annotation.added': {
391
367
  // The SDK types `event.annotation` as `unknown` and doesn't export a
392
368
  // named annotation union, so we narrow structurally on the fields we use.
393
- @@ -388,6 +516,7 @@ export function mapResponsesEventToSDK(event, state, stateful, modelState) {
369
+ @@ -395,6 +519,7 @@ export function mapResponsesEventToSDK(event, state, stateful, modelState) {
394
370
  // a fresh TextBlock.
395
371
  events.push(...switchContent('citations', state.dataType));
396
372
  state.dataType = 'citations';
@@ -433,7 +409,7 @@ index b0223555c1f0410441546be860dbae824ac9857c..92ab47f4c8c1f5225c13dfd8a5e37324
433
409
  //# sourceMappingURL=plugin.d.ts.map
434
410
 
435
411
  diff --git a/node_modules/@strands-agents/sdk/dist/src/vended-plugins/context-offloader/plugin.js b/node_modules/@strands-agents/sdk/dist/src/vended-plugins/context-offloader/plugin.js
436
- index 69b6549df8bf55b39e34aaf2940cac2a7fbf0714..440965bdc2879f7c2755ace3cda9ab70b17c53e6 100644
412
+ index f1f7304b55d39dafb79b4e0a6796d29b9e795842..3170931a27b37d683e2c4f86c20c135a88df8447 100644
437
413
  --- a/node_modules/@strands-agents/sdk/dist/src/vended-plugins/context-offloader/plugin.js
438
414
  +++ b/node_modules/@strands-agents/sdk/dist/src/vended-plugins/context-offloader/plugin.js
439
415
  @@ -1,5 +1,5 @@
@@ -597,7 +573,7 @@ index 69b6549df8bf55b39e34aaf2940cac2a7fbf0714..440965bdc2879f7c2755ace3cda9ab70
597
573
  const contextLines = input.context_lines ?? 5;
598
574
  const lineRange = input.line_range ?? (!input.pattern ? { start: 1, end: Math.max(1, contextLines) } : undefined);
599
575
  return searchContent(text, { pattern: input.pattern, line_range: lineRange, context_lines: contextLines }, maxChars);
600
- @@ -339,40 +432,135 @@ export class ContextOffloader {
576
+ @@ -343,40 +436,135 @@ export class ContextOffloader {
601
577
  .filter((r) => r.ref)
602
578
  .map((r) => ` ${r.ref} (${r.description})`)
603
579
  .join('\n');
@@ -614,7 +590,7 @@ index 69b6549df8bf55b39e34aaf2940cac2a7fbf0714..440965bdc2879f7c2755ace3cda9ab70
614
590
  - guidance += 'If you need more detail, use your available tools to access specific data.';
615
591
  - }
616
592
  + const guidance = offloadGuidance(this._includeRetrievalTool);
617
- return (`[Offloaded: ${content.length} blocks, ~${tokenCount.toLocaleString()} tokens]\n` +
593
+ return (`[Offloaded: ${content.length} blocks, ~${tokenCount.toLocaleString('en-US')} tokens]\n` +
618
594
  `${guidance}\n\n` +
619
595
  `${preview}\n\n` +
620
596
  `[Stored references:]\n${refLines}`);
@@ -760,7 +736,7 @@ index 69b6549df8bf55b39e34aaf2940cac2a7fbf0714..440965bdc2879f7c2755ace3cda9ab70
760
736
  // Extract text preview from text/JSON blocks
761
737
  const textParts = [];
762
738
  for (const block of content) {
763
- @@ -382,22 +570,28 @@ export class ContextOffloader {
739
+ @@ -386,22 +574,28 @@ export class ContextOffloader {
764
740
  textParts.push(JSON.stringify(block.json, null, 2));
765
741
  }
766
742
  const fullText = textParts.join('\n');
@@ -801,7 +777,7 @@ index 69b6549df8bf55b39e34aaf2940cac2a7fbf0714..440965bdc2879f7c2755ace3cda9ab70
801
777
  }
802
778
  logger.debug(`tool_use_id=<${toolUseId}>, blocks=<${references.length}>, tokens=<${tokenCount}> | tool result offloaded`);
803
779
  // Build replacement content: preview text + media placeholders
804
- @@ -422,11 +616,32 @@ export class ContextOffloader {
780
+ @@ -426,11 +620,32 @@ export class ContextOffloader {
805
781
  newContent.push(new TextBlock(`[${label}, ${size} bytes${ref ? ` | ref: ${ref}` : ''}]`));
806
782
  }
807
783
  }
@@ -4,7 +4,7 @@ export declare const BACKGROUND_EXECUTION_FLAG = "_background_execution";
4
4
  /** The SDK's own management tool; parent-only, classified in `permission.ts`. */
5
5
  export declare const MANAGE_BACKGROUND_TASK_TOOL_NAME = "strands_manage_background_task";
6
6
  /** The synthetic tool-use name the SDK uses when it delivers a finished task. */
7
- export declare const BACKGROUND_TASK_RESULT_TOOL_NAME = "strands_background_task_result";
7
+ export declare const BACKGROUND_TASK_RESULT_TOOL_NAME = "strands_manage_background_task";
8
8
  export interface BackgroundDelegationConfigInput {
9
9
  /** The delegation tools the model may route to the background. */
10
10
  readonly delegationTools: readonly string[];
@@ -12,7 +12,7 @@
12
12
  * permission gate, plan-mode denial and the retry guard have already run —
13
13
  * `routeToolCall` strips the flag and `submitToolCall` returns an ack tool result
14
14
  * carrying a task id (`executor.js`, the `route === true` branch);
15
- * - delivers a finished task as one synthetic `strands_background_task_result`
15
+ * - delivers a finished task as one synthetic `strands_manage_background_task`
16
16
  * tool-use/tool-result pair through `continuations.addInput`, from two hooks: at
17
17
  * every `BeforeModelCallEvent` (`_deliverReady`, so a task that settled since the
18
18
  * last call rides the next request) and at `AfterInvocationEvent` — where, with
@@ -55,7 +55,7 @@ export const BACKGROUND_EXECUTION_FLAG = '_background_execution';
55
55
  /** The SDK's own management tool; parent-only, classified in `permission.ts`. */
56
56
  export const MANAGE_BACKGROUND_TASK_TOOL_NAME = 'strands_manage_background_task';
57
57
  /** The synthetic tool-use name the SDK uses when it delivers a finished task. */
58
- export const BACKGROUND_TASK_RESULT_TOOL_NAME = 'strands_background_task_result';
58
+ export const BACKGROUND_TASK_RESULT_TOOL_NAME = MANAGE_BACKGROUND_TASK_TOOL_NAME;
59
59
  /** First line of the SDK's dispatch acknowledgement (`submitToolCall`). */
60
60
  const ACK_FIRST_LINE = 'Background task dispatched.';
61
61
  const ACK_TASK_ID = /^Task ID: (\S+)$/mu;
@@ -100,7 +100,7 @@ export function backgroundDelegationDescriptionClause(completionWakes = false) {
100
100
  'need its result immediately (reads only): you get an acknowledgement at once and the ';
101
101
  return completionWakes
102
102
  ? lead +
103
- 'final report arrives as a strands_background_task_result tool result in the next turn ' +
103
+ 'final report arrives as a strands_manage_background_task tool result in the next turn ' +
104
104
  'that runs — you may end this turn; once the session is idle, one <task-notification> ' +
105
105
  'turn starts with the report attached.'
106
106
  : lead + 'final report is delivered before your next model call in this same turn.';
@@ -16,8 +16,8 @@
16
16
  * Advisory only, on the context-pressure row's terms: the verdict is printed on
17
17
  * existing reports (`/usage`, `/status`) and as one transcript notice before a
18
18
  * `/model` or `/effort` switch on a warm cache. Nothing is compacted, no second
19
- * threshold exists, no frame row, tick or channel is added, nothing is persisted or
20
- * recorded in the trajectory.
19
+ * threshold exists, no frame row, tick or channel is added. Historical verdicts
20
+ * are saved with session usage; cache warmth stays process-local, never in the trajectory.
21
21
  *
22
22
  * Invalidators, and one deliberate non-invalidator. A model switch, an effective
23
23
  * effort change and a compaction each change the request prefix (a different model
@@ -132,7 +132,7 @@ export declare class CacheMissTracker {
132
132
  * @param ttlMs the live TTL, read per call because `promptCacheTtl` is a model
133
133
  * field and `/model` can change it mid-session.
134
134
  */
135
- constructor(ttlMs: () => number, resumed: boolean);
135
+ constructor(ttlMs: () => number, resumed: boolean, restored?: CacheMissReport);
136
136
  /** Records that the session performed one invalidating event since the last call. */
137
137
  mark(event: CacheInvalidatingEvent): void;
138
138
  /** Folds one completed call in; returns the verdict for that call, if any. */
@@ -16,8 +16,8 @@
16
16
  * Advisory only, on the context-pressure row's terms: the verdict is printed on
17
17
  * existing reports (`/usage`, `/status`) and as one transcript notice before a
18
18
  * `/model` or `/effort` switch on a warm cache. Nothing is compacted, no second
19
- * threshold exists, no frame row, tick or channel is added, nothing is persisted or
20
- * recorded in the trajectory.
19
+ * threshold exists, no frame row, tick or channel is added. Historical verdicts
20
+ * are saved with session usage; cache warmth stays process-local, never in the trajectory.
21
21
  *
22
22
  * Invalidators, and one deliberate non-invalidator. A model switch, an effective
23
23
  * effort change and a compaction each change the request prefix (a different model
@@ -138,9 +138,12 @@ export class CacheMissTracker {
138
138
  * @param ttlMs the live TTL, read per call because `promptCacheTtl` is a model
139
139
  * field and `/model` can change it mid-session.
140
140
  */
141
- constructor(ttlMs, resumed) {
141
+ constructor(ttlMs, resumed, restored) {
142
142
  this.ttlMs = ttlMs;
143
143
  this.firstCallAfterResume = resumed;
144
+ // Keep historical verdicts, not a stale cache-warmth claim across processes.
145
+ this.misses = restored?.misses ?? 0;
146
+ this.lastMiss = restored?.lastMiss;
144
147
  }
145
148
  /** Records that the session performed one invalidating event since the last call. */
146
149
  mark(event) {
@@ -1 +1 @@
1
- {"version":3,"file":"cache-miss.js","sourceRoot":"","sources":["../../../src/agent/cache-miss.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EAAE,wBAAwB,EAAuB,MAAM,mBAAmB,CAAC;AAclF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAuB5C,0FAA0F;AAC1F,MAAM,UAAU,gBAAgB,CAAC,GAA+B;IAC9D,OAAO,CAAC,GAAG,IAAI,wBAAwB,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;AAC1E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,IAAoB;IAC9C,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAClF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,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,EAAE,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAClD,OAAO,EAAE,IAAI,EAAE,aAAa,GAAG,CAAC,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;IACnF,CAAC;CACF"}
@@ -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.18.0.patch`, `dist/src/index.*`
2
+ // SDK patch (`patches/@strands-agents__sdk@1.20.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.
@@ -20,7 +20,7 @@ import { type CostBucket, type CostShare, type ModelPriceLookup } from '../prici
20
20
  import { type UsageTotals } from './usage.js';
21
21
  export { COST_BASIS_LABEL, describePricingSource, describeSessionCost, estimateCost, formatModelList, formatUsd, formatUsdNumber, MAX_COST_MODEL_CHARS, sessionCost, sessionCostFields, type CostBucket, type CostBuckets, type CostEstimate, type CostShare, type MissingCostBucket, type MissingModelBucket, type ModelPriceLookup, type ModelRates, type SessionCost, type UnpricedModel, } from '../pricing/cost.js';
22
22
  /**
23
- * One model's share of this process's meter: the counters it incurred, the config
23
+ * One model's share of the session's meter: the counters it incurred, the config
24
24
  * that projects them into buckets (provider/API decide the split), and what the
25
25
  * price cache says about it. `runtime.modelShares` is a list of these.
26
26
  */
@@ -9,13 +9,16 @@ export type InstructionsFilename = typeof AGENTS_FILENAME | typeof CLAUDE_FILENA
9
9
  */
10
10
  export declare const CLAUDE_IMPORT_NOTICE: string;
11
11
  /**
12
- * Instructions past this size are truncated rather than sent whole.
12
+ * Default preload byte limit; config.maxInstructionsBytes may override it.
13
+ * Instructions past the effective limit are truncated rather than sent whole.
13
14
  *
14
15
  * AGENTS.md goes into the system prompt, so it is re-sent with every request of
15
16
  * the session; an oversized file would silently spend the context budget the
16
17
  * conversation itself needs.
17
18
  */
18
- export declare const MAX_INSTRUCTIONS_BYTES: number;
19
+ export declare const DEFAULT_MAX_INSTRUCTIONS_BYTES: number;
20
+ /** Shared by preload and the offline importer; omission is the only default form. */
21
+ export declare function resolveInstructionsByteLimit(value?: unknown): number;
19
22
  export interface ProjectInstructions {
20
23
  /** Which of the two names was actually loaded. */
21
24
  filename: InstructionsFilename;
@@ -23,7 +26,9 @@ export interface ProjectInstructions {
23
26
  path: string;
24
27
  /** Size on disk, in bytes, before any truncation. */
25
28
  bytes: number;
26
- /** True when only the first {@link MAX_INSTRUCTIONS_BYTES} were kept. */
29
+ /** Effective byte limit used for this load, including an explicit override. */
30
+ maxBytes: number;
31
+ /** True when the file exceeded maxBytes; only the bounded prefix was kept. */
27
32
  truncated: boolean;
28
33
  /** The system-prompt fragment, delimited and labelled with its source. */
29
34
  fragment: string;
@@ -60,7 +65,7 @@ export interface ProjectInstructionsLoad {
60
65
  * An empty or whitespace-only file is silently skipped: injecting the delimiters
61
66
  * with nothing between them would only point the model at emptiness.
62
67
  */
63
- export declare function loadProjectInstructions(projectRoot: string): Promise<ProjectInstructionsLoad>;
68
+ export declare function loadProjectInstructions(projectRoot: string, maxInstructionsBytes?: number): Promise<ProjectInstructionsLoad>;
64
69
  /**
65
70
  * Places project instructions directly after the base prompt.
66
71
  *
@@ -25,13 +25,21 @@ const INSTRUCTIONS_FILENAMES = [AGENTS_FILENAME, CLAUDE_FILENAME];
25
25
  export const CLAUDE_IMPORT_NOTICE = `(Loaded from ${CLAUDE_FILENAME} because there is no ${AGENTS_FILENAME}. ` +
26
26
  '`@path` import lines are not expanded by darwin: they are literal text here, not loaded content.)';
27
27
  /**
28
- * Instructions past this size are truncated rather than sent whole.
28
+ * Default preload byte limit; config.maxInstructionsBytes may override it.
29
+ * Instructions past the effective limit are truncated rather than sent whole.
29
30
  *
30
31
  * AGENTS.md goes into the system prompt, so it is re-sent with every request of
31
32
  * the session; an oversized file would silently spend the context budget the
32
33
  * conversation itself needs.
33
34
  */
34
- export const MAX_INSTRUCTIONS_BYTES = 32 * 1024;
35
+ export const DEFAULT_MAX_INSTRUCTIONS_BYTES = 64 * 1024;
36
+ /** Shared by preload and the offline importer; omission is the only default form. */
37
+ export function resolveInstructionsByteLimit(value = DEFAULT_MAX_INSTRUCTIONS_BYTES) {
38
+ if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 1) {
39
+ throw new Error('maxInstructionsBytes must be a positive safe integer (bytes).');
40
+ }
41
+ return value;
42
+ }
35
43
  /**
36
44
  * Reads `<projectRoot>/AGENTS.md`, or `<projectRoot>/CLAUDE.md` when the former
37
45
  * does not exist.
@@ -51,7 +59,8 @@ export const MAX_INSTRUCTIONS_BYTES = 32 * 1024;
51
59
  * An empty or whitespace-only file is silently skipped: injecting the delimiters
52
60
  * with nothing between them would only point the model at emptiness.
53
61
  */
54
- export async function loadProjectInstructions(projectRoot) {
62
+ export async function loadProjectInstructions(projectRoot, maxInstructionsBytes) {
63
+ const maxBytes = resolveInstructionsByteLimit(maxInstructionsBytes);
55
64
  for (const filename of INSTRUCTIONS_FILENAMES) {
56
65
  const filePath = path.join(projectRoot, filename);
57
66
  let raw;
@@ -64,9 +73,9 @@ export async function loadProjectInstructions(projectRoot) {
64
73
  return { instructions: undefined, problem: describe(error), problemFile: filename };
65
74
  }
66
75
  const bytes = raw.byteLength;
67
- const truncated = bytes > MAX_INSTRUCTIONS_BYTES;
76
+ const truncated = bytes > maxBytes;
68
77
  const text = truncated
69
- ? clipToLastLine(raw.subarray(0, MAX_INSTRUCTIONS_BYTES))
78
+ ? clipToLastLine(raw.subarray(0, maxBytes))
70
79
  : raw.toString('utf8');
71
80
  if (text.trim() === '')
72
81
  return { instructions: undefined, problem: undefined, problemFile: undefined };
@@ -75,8 +84,9 @@ export async function loadProjectInstructions(projectRoot) {
75
84
  filename,
76
85
  path: filePath,
77
86
  bytes,
87
+ maxBytes,
78
88
  truncated,
79
- fragment: renderFragment(text.trimEnd(), truncated, filename),
89
+ fragment: renderFragment(text.trimEnd(), truncated, filename, maxBytes),
80
90
  },
81
91
  problem: undefined,
82
92
  problemFile: undefined,
@@ -134,7 +144,7 @@ function clipToLastLine(slice) {
134
144
  * `@path` imports) that darwin does not provide; {@link CLAUDE_IMPORT_NOTICE} says
135
145
  * so once, in that case only.
136
146
  */
137
- function renderFragment(text, truncated, filename) {
147
+ function renderFragment(text, truncated, filename, maxBytes) {
138
148
  const attributes = truncated
139
149
  ? `source="${filename}" truncated="true"`
140
150
  : `source="${filename}"`;
@@ -143,7 +153,7 @@ function renderFragment(text, truncated, filename) {
143
153
  ...(filename === CLAUDE_FILENAME ? [CLAUDE_IMPORT_NOTICE] : []),
144
154
  text,
145
155
  ...(truncated
146
- ? [`(This file is larger than ${MAX_INSTRUCTIONS_BYTES / 1024} KB and was cut off here.)`]
156
+ ? [`(This file is larger than ${maxBytes / 1024} KiB (${maxBytes} bytes) and was cut off here.)`]
147
157
  : []),
148
158
  '</project-instructions>',
149
159
  ].join('\n');
@@ -1 +1 @@
1
- {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../../src/agent/instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC;AAC3C,6DAA6D;AAC7D,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC;AAI3C,wFAAwF;AACxF,MAAM,sBAAsB,GAAoC,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;AAEnG;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAC/B,gBAAgB,eAAe,wBAAwB,eAAe,IAAI;IAC1E,mGAAmG,CAAC;AAEtG;;;;;;GAMG;AACH,MAAM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