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.
Files changed (254) hide show
  1. package/README.md +23 -6
  2. package/README.zh-CN.md +23 -6
  3. package/dist/patches/{@strands-agents+sdk+1.16.0.patch → @strands-agents+sdk+1.18.0.patch} +320 -9
  4. package/dist/src/agent/compact.js +1 -1
  5. package/dist/src/agent/prompt-cache.js +15 -2
  6. package/dist/src/agent/prompt-cache.js.map +1 -1
  7. package/dist/src/agent/rewind.d.ts +2 -0
  8. package/dist/src/agent/rewind.js +4 -1
  9. package/dist/src/agent/rewind.js.map +1 -1
  10. package/dist/src/agent/runtime.d.ts +81 -20
  11. package/dist/src/agent/runtime.js +227 -43
  12. package/dist/src/agent/runtime.js.map +1 -1
  13. package/dist/src/agent/session.d.ts +96 -4
  14. package/dist/src/agent/session.js +249 -9
  15. package/dist/src/agent/session.js.map +1 -1
  16. package/dist/src/agent/stream-idle.d.ts +16 -0
  17. package/dist/src/agent/stream-idle.js +127 -0
  18. package/dist/src/agent/stream-idle.js.map +1 -0
  19. package/dist/src/agent/system-prompt.d.ts +1 -1
  20. package/dist/src/agent/system-prompt.js +12 -0
  21. package/dist/src/agent/system-prompt.js.map +1 -1
  22. package/dist/src/agent/task-terminal-delivery.d.ts +25 -2
  23. package/dist/src/agent/task-terminal-delivery.js +80 -7
  24. package/dist/src/agent/task-terminal-delivery.js.map +1 -1
  25. package/dist/src/agent/working-context.d.ts +21 -1
  26. package/dist/src/agent/working-context.js +28 -1
  27. package/dist/src/agent/working-context.js.map +1 -1
  28. package/dist/src/agent/workspace-trust.d.ts +112 -0
  29. package/dist/src/agent/workspace-trust.js +207 -0
  30. package/dist/src/agent/workspace-trust.js.map +1 -0
  31. package/dist/src/agentcore/auto-policy.d.ts +7 -0
  32. package/dist/src/agentcore/auto-policy.js +50 -0
  33. package/dist/src/agentcore/auto-policy.js.map +1 -0
  34. package/dist/src/agentcore/auto-state.d.ts +43 -0
  35. package/dist/src/agentcore/auto-state.js +73 -0
  36. package/dist/src/agentcore/auto-state.js.map +1 -0
  37. package/dist/src/agentcore/cli.d.ts +2 -0
  38. package/dist/src/agentcore/cli.js +38 -0
  39. package/dist/src/agentcore/cli.js.map +1 -0
  40. package/dist/src/agentcore/config.d.ts +48 -0
  41. package/dist/src/agentcore/config.js +44 -0
  42. package/dist/src/agentcore/config.js.map +1 -0
  43. package/dist/src/agentcore/controller.d.ts +105 -0
  44. package/dist/src/agentcore/controller.js +979 -0
  45. package/dist/src/agentcore/controller.js.map +1 -0
  46. package/dist/src/agentcore/projection.d.ts +2 -0
  47. package/dist/src/agentcore/projection.js +8 -0
  48. package/dist/src/agentcore/projection.js.map +1 -0
  49. package/dist/src/agentcore/records.d.ts +41 -0
  50. package/dist/src/agentcore/records.js +149 -0
  51. package/dist/src/agentcore/records.js.map +1 -0
  52. package/dist/src/agentcore/state.d.ts +16 -0
  53. package/dist/src/agentcore/state.js +149 -0
  54. package/dist/src/agentcore/state.js.map +1 -0
  55. package/dist/src/agentcore/tools.d.ts +3 -0
  56. package/dist/src/agentcore/tools.js +11 -0
  57. package/dist/src/agentcore/tools.js.map +1 -0
  58. package/dist/src/agentcore/transport.d.ts +37 -0
  59. package/dist/src/agentcore/transport.js +242 -0
  60. package/dist/src/agentcore/transport.js.map +1 -0
  61. package/dist/src/agentcore/upload-projection.d.ts +208 -0
  62. package/dist/src/agentcore/upload-projection.js +823 -0
  63. package/dist/src/agentcore/upload-projection.js.map +1 -0
  64. package/dist/src/agents/child-recipe.js +4 -1
  65. package/dist/src/agents/child-recipe.js.map +1 -1
  66. package/dist/src/agents/loader.d.ts +12 -0
  67. package/dist/src/agents/loader.js +15 -1
  68. package/dist/src/agents/loader.js.map +1 -1
  69. package/dist/src/agents/subagent-tool.js +2 -4
  70. package/dist/src/agents/subagent-tool.js.map +1 -1
  71. package/dist/src/agents/workflow-tool.js +2 -4
  72. package/dist/src/agents/workflow-tool.js.map +1 -1
  73. package/dist/src/cli-doctor.js +7 -0
  74. package/dist/src/cli-doctor.js.map +1 -1
  75. package/dist/src/cli-import.d.ts +1 -0
  76. package/dist/src/cli-import.js +26 -0
  77. package/dist/src/cli-import.js.map +1 -0
  78. package/dist/src/cli-main.js +60 -10
  79. package/dist/src/cli-main.js.map +1 -1
  80. package/dist/src/cli-permissions.d.ts +2 -0
  81. package/dist/src/cli-permissions.js +20 -0
  82. package/dist/src/cli-permissions.js.map +1 -0
  83. package/dist/src/cli-sessions.js +6 -2
  84. package/dist/src/cli-sessions.js.map +1 -1
  85. package/dist/src/cli-usage.d.ts +9 -1
  86. package/dist/src/cli-usage.js +13 -0
  87. package/dist/src/cli-usage.js.map +1 -1
  88. package/dist/src/cli.js +19 -2
  89. package/dist/src/cli.js.map +1 -1
  90. package/dist/src/commands/custom-commands.d.ts +1 -1
  91. package/dist/src/commands/custom-commands.js +14 -6
  92. package/dist/src/commands/custom-commands.js.map +1 -1
  93. package/dist/src/commands/review-command.d.ts +10 -0
  94. package/dist/src/commands/review-command.js +28 -0
  95. package/dist/src/commands/review-command.js.map +1 -0
  96. package/dist/src/config-file.d.ts +9 -0
  97. package/dist/src/config-file.js +82 -0
  98. package/dist/src/config-file.js.map +1 -0
  99. package/dist/src/config.d.ts +66 -5
  100. package/dist/src/config.js +126 -42
  101. package/dist/src/config.js.map +1 -1
  102. package/dist/src/dev-repl.js +17 -1
  103. package/dist/src/dev-repl.js.map +1 -1
  104. package/dist/src/headless-protocol.d.ts +24 -1
  105. package/dist/src/headless-protocol.js +18 -0
  106. package/dist/src/headless-protocol.js.map +1 -1
  107. package/dist/src/headless-runner.d.ts +8 -0
  108. package/dist/src/headless-runner.js +37 -1
  109. package/dist/src/headless-runner.js.map +1 -1
  110. package/dist/src/hooks/hook-process.js +7 -2
  111. package/dist/src/hooks/hook-process.js.map +1 -1
  112. package/dist/src/hooks/lifecycle-hooks.js +3 -1
  113. package/dist/src/hooks/lifecycle-hooks.js.map +1 -1
  114. package/dist/src/hooks/tool-hooks.js +3 -1
  115. package/dist/src/hooks/tool-hooks.js.map +1 -1
  116. package/dist/src/import-claude-files.d.ts +28 -0
  117. package/dist/src/import-claude-files.js +227 -0
  118. package/dist/src/import-claude-files.js.map +1 -0
  119. package/dist/src/import-claude-snippets.d.ts +2 -0
  120. package/dist/src/import-claude-snippets.js +105 -0
  121. package/dist/src/import-claude-snippets.js.map +1 -0
  122. package/dist/src/import-claude.d.ts +13 -0
  123. package/dist/src/import-claude.js +287 -0
  124. package/dist/src/import-claude.js.map +1 -0
  125. package/dist/src/mcp/registry.d.ts +57 -1
  126. package/dist/src/mcp/registry.js +78 -6
  127. package/dist/src/mcp/registry.js.map +1 -1
  128. package/dist/src/memory/command.d.ts +1 -1
  129. package/dist/src/memory/command.js +89 -4
  130. package/dist/src/memory/command.js.map +1 -1
  131. package/dist/src/memory/controller.d.ts +32 -0
  132. package/dist/src/memory/controller.js +39 -3
  133. package/dist/src/memory/controller.js.map +1 -1
  134. package/dist/src/memory/state.d.ts +6 -0
  135. package/dist/src/memory/state.js +6 -1
  136. package/dist/src/memory/state.js.map +1 -1
  137. package/dist/src/memory/store.d.ts +13 -0
  138. package/dist/src/memory/store.js +38 -2
  139. package/dist/src/memory/store.js.map +1 -1
  140. package/dist/src/memory/tools.d.ts +7 -0
  141. package/dist/src/memory/tools.js +12 -1
  142. package/dist/src/memory/tools.js.map +1 -1
  143. package/dist/src/npm-package/patch-package-format.d.ts +5 -5
  144. package/dist/src/npm-package/patch-package-format.js +4 -4
  145. package/dist/src/paths.js +3 -0
  146. package/dist/src/paths.js.map +1 -1
  147. package/dist/src/permissions-test.d.ts +18 -0
  148. package/dist/src/permissions-test.js +207 -0
  149. package/dist/src/permissions-test.js.map +1 -0
  150. package/dist/src/pricing/model-prices.d.ts +8 -5
  151. package/dist/src/pricing/model-prices.js +30 -15
  152. package/dist/src/pricing/model-prices.js.map +1 -1
  153. package/dist/src/project-identity.d.ts +3 -0
  154. package/dist/src/project-identity.js +8 -0
  155. package/dist/src/project-identity.js.map +1 -0
  156. package/dist/src/project-overrides.d.ts +57 -0
  157. package/dist/src/project-overrides.js +79 -0
  158. package/dist/src/project-overrides.js.map +1 -0
  159. package/dist/src/sdk-patch-preflight.js +1 -1
  160. package/dist/src/skills/builtin/developer/SKILL.md +2 -0
  161. package/dist/src/skills/builtin/self-reflection/references/reflection-template.md +2 -1
  162. package/dist/src/skills/builtin/setup-agentcore-memory/SKILL.md +158 -0
  163. package/dist/src/skills/loader.d.ts +1 -1
  164. package/dist/src/skills/loader.js +4 -1
  165. package/dist/src/skills/loader.js.map +1 -1
  166. package/dist/src/tools/background-bash.d.ts +13 -1
  167. package/dist/src/tools/background-bash.js +36 -8
  168. package/dist/src/tools/background-bash.js.map +1 -1
  169. package/dist/src/tools/shell-env.d.ts +24 -0
  170. package/dist/src/tools/shell-env.js +34 -0
  171. package/dist/src/tools/shell-env.js.map +1 -1
  172. package/dist/src/trajectory/reader.d.ts +1 -1
  173. package/dist/src/trajectory/reader.js +23 -3
  174. package/dist/src/trajectory/reader.js.map +1 -1
  175. package/dist/src/trajectory/record.d.ts +50 -2
  176. package/dist/src/trajectory/record.js +32 -0
  177. package/dist/src/trajectory/record.js.map +1 -1
  178. package/dist/src/trajectory/replay.d.ts +12 -1
  179. package/dist/src/trajectory/replay.js +31 -2
  180. package/dist/src/trajectory/replay.js.map +1 -1
  181. package/dist/src/trajectory/resume-recap.d.ts +11 -1
  182. package/dist/src/trajectory/resume-recap.js +10 -1
  183. package/dist/src/trajectory/resume-recap.js.map +1 -1
  184. package/dist/src/trajectory/rewind-history.d.ts +8 -0
  185. package/dist/src/trajectory/rewind-history.js +81 -0
  186. package/dist/src/trajectory/rewind-history.js.map +1 -0
  187. package/dist/src/trajectory/writer.d.ts +14 -1
  188. package/dist/src/trajectory/writer.js +38 -0
  189. package/dist/src/trajectory/writer.js.map +1 -1
  190. package/dist/src/tui/App.d.ts +5 -1
  191. package/dist/src/tui/App.js +284 -51
  192. package/dist/src/tui/App.js.map +1 -1
  193. package/dist/src/tui/InputBox.d.ts +1 -1
  194. package/dist/src/tui/InputBox.js +3 -2
  195. package/dist/src/tui/InputBox.js.map +1 -1
  196. package/dist/src/tui/MessageList.js +1 -1
  197. package/dist/src/tui/MessageList.js.map +1 -1
  198. package/dist/src/tui/PermissionPrompt.js +5 -3
  199. package/dist/src/tui/PermissionPrompt.js.map +1 -1
  200. package/dist/src/tui/QueuedMessages.js +14 -8
  201. package/dist/src/tui/QueuedMessages.js.map +1 -1
  202. package/dist/src/tui/ToolCallPanel.js +2 -2
  203. package/dist/src/tui/ToolCallPanel.js.map +1 -1
  204. package/dist/src/tui/WorkspaceTrustPrompt.d.ts +8 -0
  205. package/dist/src/tui/WorkspaceTrustPrompt.js +37 -0
  206. package/dist/src/tui/WorkspaceTrustPrompt.js.map +1 -0
  207. package/dist/src/tui/draft-stash.d.ts +25 -0
  208. package/dist/src/tui/draft-stash.js +49 -0
  209. package/dist/src/tui/draft-stash.js.map +1 -0
  210. package/dist/src/tui/frame-budget.d.ts +2 -2
  211. package/dist/src/tui/frame-budget.js +3 -3
  212. package/dist/src/tui/frame-budget.js.map +1 -1
  213. package/dist/src/tui/help-format.d.ts +2 -2
  214. package/dist/src/tui/help-format.js +3 -3
  215. package/dist/src/tui/help-format.js.map +1 -1
  216. package/dist/src/tui/mcp-format.d.ts +9 -0
  217. package/dist/src/tui/mcp-format.js +5 -3
  218. package/dist/src/tui/mcp-format.js.map +1 -1
  219. package/dist/src/tui/permission-rule-preview.d.ts +23 -0
  220. package/dist/src/tui/permission-rule-preview.js +38 -0
  221. package/dist/src/tui/permission-rule-preview.js.map +1 -0
  222. package/dist/src/tui/prompt-editor.d.ts +12 -0
  223. package/dist/src/tui/prompt-editor.js +57 -37
  224. package/dist/src/tui/prompt-editor.js.map +1 -1
  225. package/dist/src/tui/prompt-history-search.js +3 -2
  226. package/dist/src/tui/prompt-history-search.js.map +1 -1
  227. package/dist/src/tui/prompt-queue.d.ts +4 -2
  228. package/dist/src/tui/prompt-queue.js +18 -3
  229. package/dist/src/tui/prompt-queue.js.map +1 -1
  230. package/dist/src/tui/rewind-search.js +4 -3
  231. package/dist/src/tui/rewind-search.js.map +1 -1
  232. package/dist/src/tui/search-preview.d.ts +2 -0
  233. package/dist/src/tui/search-preview.js +9 -0
  234. package/dist/src/tui/search-preview.js.map +1 -0
  235. package/dist/src/tui/shell-command.js +4 -1
  236. package/dist/src/tui/shell-command.js.map +1 -1
  237. package/dist/src/tui/spinner.d.ts +1 -0
  238. package/dist/src/tui/spinner.js +6 -0
  239. package/dist/src/tui/spinner.js.map +1 -0
  240. package/dist/src/tui/status-format.d.ts +9 -0
  241. package/dist/src/tui/status-format.js +37 -2
  242. package/dist/src/tui/status-format.js.map +1 -1
  243. package/dist/src/tui/subagent-format.js +6 -0
  244. package/dist/src/tui/subagent-format.js.map +1 -1
  245. package/dist/src/tui/task-format.d.ts +5 -0
  246. package/dist/src/tui/task-format.js +15 -0
  247. package/dist/src/tui/task-format.js.map +1 -1
  248. package/dist/src/tui/trust-format.d.ts +31 -0
  249. package/dist/src/tui/trust-format.js +102 -0
  250. package/dist/src/tui/trust-format.js.map +1 -0
  251. package/dist/src/tui/turn-state.d.ts +1 -0
  252. package/dist/src/tui/turn-state.js +2 -0
  253. package/dist/src/tui/turn-state.js.map +1 -1
  254. package/package.json +4 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissions-test.js","sourceRoot":"","sources":["../../src/permissions-test.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpE,O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QAAE,KAAK,CAAC,IAAI,CAAC,aAAa,OAAO,CAAC,IAAI,GAAG,CAAC,yCAAyC,CAAC,CAAC;IACzG,KAAK,CAAC,IAAI,CAAC,WAAW,iBAAiB,uCAAuC,aAAa,eAAe,mBAAmB,+CAA+C,CAAC,CAAC;IAC9K,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -5,6 +5,8 @@ export declare const MODEL_PRICES_SCHEMA_VERSION = 1;
5
5
  /** The table is ~2.1 MB today; anything past this is not the table. */
6
6
  export declare const MODEL_PRICES_MAX_BYTES: number;
7
7
  export declare const MODEL_PRICES_FETCH_TIMEOUT_MS = 10000;
8
+ /** A missing upstream price is retried after one day, never on every launch. */
9
+ export declare const MODEL_PRICES_NEGATIVE_TTL_MS: number;
8
10
  /** One cached mapping. `litellmKey: null` records "LiteLLM has no entry for this id". */
9
11
  export interface ModelPriceEntry extends Partial<ModelRates> {
10
12
  litellmKey: string | null;
@@ -46,7 +48,7 @@ export declare function priceCandidateKeys(config: PriceConfig): readonly string
46
48
  * Resolves one model against a fetched table: the first candidate key whose entry
47
49
  * carries numeric `input_cost_per_token` and `output_cost_per_token` wins; the
48
50
  * cache rates are copied when present. No hit records `litellmKey: null` — a
49
- * resolved "no price", not an absence, so the id is not fetched again next launch.
51
+ * resolved "no price", not an absence, so launches within its TTL do not refetch.
50
52
  */
51
53
  export declare function resolveModelPrice(table: unknown, config: PriceConfig, fetchedAt: string): ModelPriceEntry;
52
54
  /** Projects one cache entry (or its absence) into the lookup the surfaces render. */
@@ -85,7 +87,7 @@ export interface ModelPriceStoreOptions {
85
87
  export declare const MODEL_PRICES_FETCH_ENV = "DARWIN_MODEL_PRICES_FETCH";
86
88
  /**
87
89
  * The per-process price store: read-only {@link lookup} for every surface, and
88
- * {@link ensure} — lookup, fetch once if absent, record — for startup and `/model`.
90
+ * {@link ensure} — fetch once if absent or negative-expired — for startup and `/model`.
89
91
  */
90
92
  export declare class ModelPriceStore {
91
93
  private readonly options;
@@ -97,9 +99,10 @@ export declare class ModelPriceStore {
97
99
  lookup(config: PriceConfig): ModelPriceLookup;
98
100
  /**
99
101
  * Makes sure the cache has an entry for this model if the network can provide one.
100
- * A mapped id returns without fetching; an unmapped id fetches at most once per
101
- * process (shared by concurrent callers) and records the result — the resolved
102
- * rates, or `litellmKey: null`. Never rejects: callers fire and forget it.
102
+ * Priced and fresh no-price entries return without fetching. Missing or expired
103
+ * no-price entries fetch at most once per process (shared by concurrent callers).
104
+ * Success records rates or renews the negative timestamp; failure writes nothing.
105
+ * Never rejects: callers fire and forget it.
103
106
  */
104
107
  ensure(config: PriceConfig): Promise<void>;
105
108
  private fetchAndRecord;
@@ -3,17 +3,18 @@
3
3
  * price table one model id at a time.
4
4
  *
5
5
  * This module is the feature's only I/O and darwin's only use of the network outside
6
- * tools and MCP. Its contract, decided by the user (2026-09-04):
6
+ * tools and MCP. Original contract: 2026-09-04; negative-cache recovery: 2026-09-13.
7
7
  *
8
8
  * - The file stores **only the resolved mapping** — darwin model id → the four base
9
9
  * rates plus the LiteLLM key they were read under and when — never the 2 MB table.
10
- * - **A mapped id is never refetched.** Only an id the file does not know triggers a
11
- * fetch, and at most one per process for that id (concurrent callers share it, a
12
- * failed attempt is not retried until the next launch). An id LiteLLM does not
13
- * list is recorded as `litellmKey: null` so it, too, is fetched once and not on
14
- * every launch.
15
- * - Every failure degrades to "price unavailable": no thrown error, no warning into
16
- * the frame, no file write. A missing or damaged cache reads as empty.
10
+ * - **A priced id is never refetched.** Missing ids and no-price entries at least
11
+ * 24 hours old may fetch at startup or `/model`, at most once per process per id
12
+ * (concurrent callers share it; failed attempts wait until the next launch).
13
+ * `litellmKey: null` is a negative cache, not a permanent price decision; invalid
14
+ * or future timestamps expire too. There is no polling or read-triggered refresh.
15
+ * - Every failure preserves the prior cache: no thrown error, no warning into the
16
+ * frame, no file write. Without a cached entry the price stays "unavailable";
17
+ * an expired no-price entry stays "none". Missing/damaged caches read as empty.
17
18
  * - Reads are synchronous and side-effect free, so `/status` and `/usage` can read
18
19
  * through {@link ModelPriceStore.lookup} without becoming a fetch or a write.
19
20
  */
@@ -26,6 +27,8 @@ export const MODEL_PRICES_SCHEMA_VERSION = 1;
26
27
  /** The table is ~2.1 MB today; anything past this is not the table. */
27
28
  export const MODEL_PRICES_MAX_BYTES = 8 * 1024 * 1024;
28
29
  export const MODEL_PRICES_FETCH_TIMEOUT_MS = 10_000;
30
+ /** A missing upstream price is retried after one day, never on every launch. */
31
+ export const MODEL_PRICES_NEGATIVE_TTL_MS = 24 * 60 * 60 * 1000;
29
32
  export function emptyModelPriceCache() {
30
33
  return { version: MODEL_PRICES_SCHEMA_VERSION, source: MODEL_PRICES_SOURCE_URL, models: {} };
31
34
  }
@@ -124,7 +127,7 @@ export function priceCandidateKeys(config) {
124
127
  * Resolves one model against a fetched table: the first candidate key whose entry
125
128
  * carries numeric `input_cost_per_token` and `output_cost_per_token` wins; the
126
129
  * cache rates are copied when present. No hit records `litellmKey: null` — a
127
- * resolved "no price", not an absence, so the id is not fetched again next launch.
130
+ * resolved "no price", not an absence, so launches within its TTL do not refetch.
128
131
  */
129
132
  export function resolveModelPrice(table, config, fetchedAt) {
130
133
  if (isRecord(table)) {
@@ -223,7 +226,7 @@ async function readBounded(response, maxBytes) {
223
226
  export const MODEL_PRICES_FETCH_ENV = 'DARWIN_MODEL_PRICES_FETCH';
224
227
  /**
225
228
  * The per-process price store: read-only {@link lookup} for every surface, and
226
- * {@link ensure} — lookup, fetch once if absent, record — for startup and `/model`.
229
+ * {@link ensure} — fetch once if absent or negative-expired — for startup and `/model`.
227
230
  */
228
231
  export class ModelPriceStore {
229
232
  options;
@@ -246,14 +249,21 @@ export class ModelPriceStore {
246
249
  }
247
250
  /**
248
251
  * Makes sure the cache has an entry for this model if the network can provide one.
249
- * A mapped id returns without fetching; an unmapped id fetches at most once per
250
- * process (shared by concurrent callers) and records the result — the resolved
251
- * rates, or `litellmKey: null`. Never rejects: callers fire and forget it.
252
+ * Priced and fresh no-price entries return without fetching. Missing or expired
253
+ * no-price entries fetch at most once per process (shared by concurrent callers).
254
+ * Success records rates or renews the negative timestamp; failure writes nothing.
255
+ * Never rejects: callers fire and forget it.
252
256
  */
253
257
  async ensure(config) {
254
258
  try {
255
- if (readModelPriceCache(this.options.file).models[config.model] !== undefined)
256
- return;
259
+ const entry = readModelPriceCache(this.options.file).models[config.model];
260
+ if (entry !== undefined) {
261
+ if (entry.litellmKey !== null)
262
+ return;
263
+ const age = (this.options.now ?? (() => new Date()))().getTime() - Date.parse(entry.fetchedAt);
264
+ if (age >= 0 && age < MODEL_PRICES_NEGATIVE_TTL_MS)
265
+ return;
266
+ }
257
267
  if (this.options.fetchEnabled === false)
258
268
  return;
259
269
  let attempt = this.attempts.get(config.model);
@@ -281,6 +291,11 @@ export class ModelPriceStore {
281
291
  // Re-read before merging so two processes filling different ids cannot erase
282
292
  // each other's work; the rename below then publishes the merged file whole.
283
293
  const cache = readModelPriceCache(this.options.file);
294
+ // A concurrent process may have priced this id while our request was in flight.
295
+ // Existing prices remain authoritative, even if our table still has no match.
296
+ const current = cache.models[config.model];
297
+ if (current !== undefined && current.litellmKey !== null)
298
+ return;
284
299
  cache.source = this.options.url ?? MODEL_PRICES_SOURCE_URL;
285
300
  cache.models[config.model] = entry;
286
301
  writeModelPriceCache(this.options.file, cache);
@@ -1 +1 @@
1
- {"version":3,"file":"model-prices.js","sourceRoot":"","sources":["../../../src/pricing/model-prices.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrF,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,CAAC,MAAM,uBAAuB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C,CAAC;AAC9E,CAAC;AAED,4HAA4H;AAC5H,SAAS,SAAS,CAChB,GAAY,EACZ,MAAgF;IAEhF,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IACrC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACxC,IAAI,KAAK,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAClE,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAC9C,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IAChD,OAAO;QACL,iBAAiB,EAAE,KAAK;QACxB,kBAAkB,EAAE,MAAM;QAC1B,GAAG,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,uBAAuB,EAAE,SAAS,EAAE,CAAC;QACtE,GAAG,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,2BAA2B,EAAE,UAAU,EAAE,CAAC;KAC7E,CAAC;AACJ,CAAC;AAED,SAAS,IAAI,CAAC,KAAc;IAC1B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/F,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Stable cloud namespace/quota identity (legacy body bindings must not change).
2
+ * Without an explicit namespace, also the canonical working-tree override key. */
3
+ export declare function projectIdentity(root: string, explicit?: string): string;
@@ -0,0 +1,8 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { projectKey } from './paths.js';
3
+ /** Stable cloud namespace/quota identity (legacy body bindings must not change).
4
+ * Without an explicit namespace, also the canonical working-tree override key. */
5
+ export function projectIdentity(root, explicit) {
6
+ return explicit ?? createHash('sha256').update(projectKey(root)).digest('hex');
7
+ }
8
+ //# sourceMappingURL=project-identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-identity.js","sourceRoot":"","sources":["../../src/project-identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC;kFACkF;AAClF,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,QAAiB;IAC7D,OAAO,QAAQ,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACjF,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { z } from 'zod';
2
+ import { type AgentCoreConfig } from './agentcore/config.js';
3
+ /** Explicit extensible registry: adding an override requires both schema and merge code.
4
+ * No model/provider/permissions or resource/actor/project identity fields are registered. */
5
+ export declare const PROJECT_OVERRIDE_REGISTRY: {
6
+ readonly agentCoreMemory: z.ZodObject<{
7
+ upload: z.ZodOptional<z.ZodEnum<{
8
+ auto: "auto";
9
+ manual: "manual";
10
+ off: "off";
11
+ }>>;
12
+ autoDailyEvents: z.ZodOptional<z.ZodNumber>;
13
+ autoDailyBytes: z.ZodOptional<z.ZodNumber>;
14
+ authorization: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
15
+ epoch: z.ZodString;
16
+ at: z.ZodString;
17
+ scope: z.ZodString;
18
+ version: z.ZodLiteral<1>;
19
+ }, z.core.$strict>, z.ZodObject<{
20
+ epoch: z.ZodString;
21
+ at: z.ZodString;
22
+ scope: z.ZodString;
23
+ version: z.ZodLiteral<2>;
24
+ project: z.ZodString;
25
+ }, z.core.$strict>], "version">>;
26
+ }, z.core.$strict>;
27
+ };
28
+ declare const overrideSchema: z.ZodObject<{
29
+ agentCoreMemory: z.ZodOptional<z.ZodObject<{
30
+ upload: z.ZodOptional<z.ZodEnum<{
31
+ auto: "auto";
32
+ manual: "manual";
33
+ off: "off";
34
+ }>>;
35
+ autoDailyEvents: z.ZodOptional<z.ZodNumber>;
36
+ autoDailyBytes: z.ZodOptional<z.ZodNumber>;
37
+ authorization: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
38
+ epoch: z.ZodString;
39
+ at: z.ZodString;
40
+ scope: z.ZodString;
41
+ version: z.ZodLiteral<1>;
42
+ }, z.core.$strict>, z.ZodObject<{
43
+ epoch: z.ZodString;
44
+ at: z.ZodString;
45
+ scope: z.ZodString;
46
+ version: z.ZodLiteral<2>;
47
+ project: z.ZodString;
48
+ }, z.core.$strict>], "version">>;
49
+ }, z.core.$strict>>;
50
+ }, z.core.$strict>;
51
+ export type ProjectOverrides = Record<string, z.infer<typeof overrideSchema>>;
52
+ export declare function parseProjectOverrides(value: unknown): ProjectOverrides | undefined;
53
+ export declare function cloudBinding(config: AgentCoreConfig, root: string): string;
54
+ export declare function effectiveCloudPolicy(global: AgentCoreConfig | undefined, overrides: ProjectOverrides | undefined, root: string): AgentCoreConfig | undefined;
55
+ /** Send-time local policy read only: no model construction/reconfiguration or writes. */
56
+ export declare function readCloudPolicy(root: string): Promise<AgentCoreConfig | undefined>;
57
+ export {};
@@ -0,0 +1,79 @@
1
+ import { z } from 'zod';
2
+ import path from 'node:path';
3
+ import { userDarwinDir } from './paths.js';
4
+ import { projectIdentity } from './project-identity.js';
5
+ import { readConfigBytes } from './config-file.js';
6
+ import { authorizationSchema, digest, parseAgentCoreConfig } from './agentcore/config.js';
7
+ /** Explicit extensible registry: adding an override requires both schema and merge code.
8
+ * No model/provider/permissions or resource/actor/project identity fields are registered. */
9
+ export const PROJECT_OVERRIDE_REGISTRY = {
10
+ agentCoreMemory: z.object({
11
+ upload: z.enum(['off', 'manual', 'auto']).optional(),
12
+ autoDailyEvents: z.number().int().min(1).max(100000).optional(),
13
+ autoDailyBytes: z.number().int().min(1).max(107374182400).optional(),
14
+ authorization: authorizationSchema.optional(),
15
+ }).strict(),
16
+ };
17
+ const overrideSchema = z.object({ agentCoreMemory: PROJECT_OVERRIDE_REGISTRY.agentCoreMemory.optional() }).strict();
18
+ export function parseProjectOverrides(value) {
19
+ if (value === undefined)
20
+ return undefined;
21
+ if (!value || typeof value !== 'object' || Array.isArray(value))
22
+ throw new Error('projectOverrides must be an object');
23
+ const entries = Object.entries(value);
24
+ if (entries.length > 1024)
25
+ throw new Error('projectOverrides exceeds 1024 projects');
26
+ const result = Object.create(null);
27
+ for (const [key, entry] of entries) {
28
+ if (!/^[a-z0-9][a-z0-9_-]{0,63}$/.test(key) || ['__proto__', 'prototype', 'constructor'].includes(key))
29
+ throw new Error('projectOverrides: invalid project identity');
30
+ const parsed = overrideSchema.safeParse(entry);
31
+ if (!parsed.success)
32
+ throw new Error(`projectOverrides.${key}: invalid fields/types; only registered upload policy fields are allowed; repair configuration then re-confirm /cloud-memory auto`);
33
+ result[key] = parsed.data;
34
+ }
35
+ return result;
36
+ }
37
+ export function cloudBinding(config, root) {
38
+ return digest([config.region, config.memoryId, config.actorId, projectIdentity(root, config.projectId), config.episodicStrategyId, config.preferenceStrategyId]);
39
+ }
40
+ export function effectiveCloudPolicy(global, overrides, root) {
41
+ if (!global)
42
+ return undefined;
43
+ const project = projectIdentity(root); // Consent is NEVER keyed by the cloud namespace.
44
+ const override = overrides?.[project]?.agentCoreMemory;
45
+ const config = { ...global,
46
+ ...(override?.upload === undefined ? {} : { upload: override.upload }),
47
+ ...(override?.autoDailyEvents === undefined ? {} : { autoDailyEvents: override.autoDailyEvents }),
48
+ ...(override?.autoDailyBytes === undefined ? {} : { autoDailyBytes: override.autoDailyBytes }),
49
+ ...(override === undefined ? {} : { projectOverride: true }),
50
+ };
51
+ delete config.authorization;
52
+ delete config.autoProblem;
53
+ if (!override && global.projectId !== project && overrides?.[global.projectId ?? '']?.agentCoreMemory?.upload === 'auto')
54
+ config.autoProblem = 'Legacy cloud-namespace consent is inactive; re-confirm this working tree with /cloud-memory auto';
55
+ if (config.upload === 'auto') {
56
+ if (override?.upload === 'auto' && override.authorization?.version === 2 && override.authorization.project === project && override.authorization.scope === cloudBinding(config, root))
57
+ config.authorization = override.authorization;
58
+ else {
59
+ config.upload = 'manual';
60
+ config.autoProblem = 'Auto authorization missing or scope changed; re-confirm this project with /cloud-memory auto';
61
+ }
62
+ }
63
+ return config;
64
+ }
65
+ /** Send-time local policy read only: no model construction/reconfiguration or writes. */
66
+ export async function readCloudPolicy(root) {
67
+ const raw = await readConfigBytes(path.join(userDarwinDir(), 'config.json'));
68
+ if (raw === undefined)
69
+ return undefined;
70
+ const record = JSON.parse(raw);
71
+ if (!record || typeof record !== 'object' || Array.isArray(record))
72
+ throw new Error('Cloud policy config invalid');
73
+ const input = record;
74
+ const config = effectiveCloudPolicy(parseAgentCoreConfig(input['agentCoreMemory']), parseProjectOverrides(input['projectOverrides']), root);
75
+ if (config && config.upload !== 'off' && input['trajectory'] === false)
76
+ throw new Error('Cloud uploads require trajectory');
77
+ return config;
78
+ }
79
+ //# sourceMappingURL=project-overrides.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-overrides.js","sourceRoot":"","sources":["../../src/project-overrides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,oBAAoB,EAAwB,MAAM,uBAAuB,CAAC;AAEhH;6FAC6F;AAC7F,MAAM,CAAC,MAAM,yBAAyB,GAAG;I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EAAE,EAAE,aAAa,CAAC,CAAC,CAAC;IAC7E,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACxC,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxC,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACnH,MAAM,KAAK,GAAG,MAAiC,CAAC;IAChD,MAAM,MAAM,GAAG,oBAAoB,CAAC,oBAAoB,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,EAAE,qBAAqB,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAC5I,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK,IAAI,KAAK,CAAC,YAAY,CAAC,KAAK,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAC5H,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Startup preflight: refuse to run on an unpatched `@strands-agents/sdk`.
3
3
  *
4
- * darwin depends on its pinned SDK patch (`patches/@strands-agents__sdk@1.16.0.patch`).
4
+ * darwin depends on its pinned SDK patch (`patches/@strands-agents__sdk@1.18.0.patch`).
5
5
  * pnpm applies it in a clone; the npm package applies it from `postinstall` with
6
6
  * `patch-package`. An install that skipped scripts (`npm install --ignore-scripts`,
7
7
  * or `pnpm add -g`, whose isolated layout patch-package cannot address) leaves the
@@ -81,6 +81,8 @@ Retry at most two times after the original attempt. Drain and record every retry
81
81
 
82
82
  After the child reports completion, independently inspect the repository diff and run the named acceptance checks from the Host. This is the one Host full-gate pass in the verification pyramid; do not duplicate a green child full gate before inspecting the diff. Do not accept the child's prose or its claimed test result as evidence. If acceptance fails, send the exact failure and a focused correction to the same child session through another managed background invocation, then rerun only affected focused checks before the final full gate. Do not patch the implementation yourself merely to conceal the failure.
83
83
 
84
+ When the child is drained, resolve its base and result commits to explicit SHAs. Before any revert/negative control or diff review, run `git log <base>..HEAD` and name any commit the child did not make; controls and diffs then use those explicit SHAs, never `HEAD~N` or bare `HEAD`, because another writer may have committed meanwhile.
85
+
84
86
  After every accepted requirement iteration in the darwin repository, run `pnpm build` from the repository root before reporting acceptance or launching the next worker. This refreshes the `dist` CLI and copied built-in skills that the next `darwin` process actually loads; typecheck and tests do not replace it. Treat a failed build as an acceptance failure and send the exact failure to the same child session for correction.
85
87
 
86
88
  ## 6. Wrap up: keep the user-facing docs in step
@@ -12,7 +12,8 @@ written as `unknown`, never `0`.
12
12
  - **trajectory:** <absolute trajectory.jsonl path>
13
13
  - **record read:** seq <first>–<closed-through-seq>, turns <first>–<closed-through-turn>
14
14
  (inclusive closed subject range; records after this `turnEnded` cutoff were not graded)
15
- - **model / provider:** <from runStarted>
15
+ - **model / provider:** <from runStarted; if a later `modelChanged` record exists, name each
16
+ switch and the turn it preceded — later `modelCall`/`turnEnded.spend` labels are the model that ran>
16
17
  - **session spend:** input=<n|unknown> output=<n|unknown> cacheRead=<n|unknown>
17
18
  cacheWrite=<n|unknown> (summed over recorded `turnEnded.spend`; absent fields stay unknown)
18
19
 
@@ -0,0 +1,158 @@
1
+ ---
2
+ name: setup-agentcore-memory
3
+ description: Check existing Darwin cloud memory first and skip repeat setup when healthy. Otherwise guide setup or targeted repair with confirmed identity/settings before changes. Use for /setup-agentcore-memory or AgentCore Memory onboarding.
4
+ ---
5
+
6
+ # Set up AgentCore Memory
7
+
8
+ ## 0. Read the guide, then inspect existing config FIRST
9
+
10
+ Read and use this entire guide before proceeding. Explain, in the user's language, that existing configuration is checked first; healthy memory needs no repeat setup. Bare `/setup-agentcore-memory` begins this workflow; do not respond with usage alone. If guidance cannot be loaded, report that setup is blocked; never continue without it.
11
+
12
+ Command invocation, supplied arguments, this guide, `yolo`, and tool permission are NOT consent to install, create resources, write config, or upload. Arguments are proposed preferences, not authorization; even “use defaults/force-install” cannot waive the confirmation below. These setup-specific stops apply even in an autonomous/headless run.
13
+
14
+ FIRST inspect `~/.darwin/config.json` read-only through ordinary tools and the permission gate, before asking actor/default questions, resource discovery or installation. This is a sensitive read even in plan mode; do not bypass denial. Do not dump config, secrets or credentials; display only necessary safe memory state/IDs/scope. Use Darwin's existing config loader through the commands below to validate, not a second schema or private package import.
15
+
16
+ Distinguish a missing config file, an absent `agentCoreMemory` field, and intentionally disabled `agentCoreMemory: false`: show which state applies, then use section 2 for setup proposals; disabled never means permission to enable. Before taking that branch, use section 1's offline/local commands to validate the whole config with the existing loader (a missing file uses built-in defaults); do not make a cloud read for missing/disabled memory. Denied/unreadable config, invalid JSON or invalid schema is **BLOCKED/NEEDS-REPAIR**, NOT absent. Stop and request only the missing read permission or targeted repair confirmation; never fall through to new setup or overwrite known values.
17
+
18
+ ## Project upload authority (preserve during setup)
19
+
20
+ The effective upload mode may come from `projectOverrides[localKey].agentCoreMemory` in the global config. Preserve that entire map and all other projects during any approved config repair. The local key is always SHA256 of Darwin's canonical project key; explicit `agentCoreMemory.projectId` selects only the cloud namespace/shared quota, never consent. Status and doctor label both identities. Auto authorization v2 additionally binds the local key; v1 needs user reconfirmation, never silent migration. Overrides cannot change region/resource/actor/project/strategies. Defaults < global < current project. Only registered upload mode and daily budgets are overridable; never add unknown fields.
21
+
22
+ Do NOT enable auto, construct its authorization, drive a pseudo-terminal, or run cleanup on the user's behalf. After setup the user may type `/cloud-memory auto` in the idle TUI: this is consent for NEW turns in this project, captures a fresh scope-bound epoch, and warns that content can include secrets. `/cloud-memory manual` persists revocation immediately without resetting conversation or deleting evidence. Root `upload: auto` alone is not authorization. Defaults are 500 attempts/104857600 bytes per UTC day; configurable project budgets are positive bounded integers. Auto only sends normally closed traceable v2 events; tool failures do not mean ineligible, and endTurn does not mean goal success. Cancelled/incomplete/seriously damaged collections stay manual. Old pending is never backfilled. Only auto-accepted local bodies expire after seven days; receipts remain, manual/pending/failure/cloud data do not expire. No automatic preference adoption or cloud deletion.
23
+
24
+ User-only `/cloud-memory discard-legacy` previews unaccepted current-project/current-binding legacy local events; the user must submit the displayed manifest hash to clean them. Never execute cleanup as part of setup. Standalone CLI remains read-only and no mutation tool is exposed.
25
+
26
+ ## 1. Check enabled existing memory, then stop when healthy
27
+
28
+ For enabled config validated by the existing loader, run these checks using only saved region, resource, actor and strategy IDs (and saved project scope), never suggested argument overrides:
29
+
30
+ 1. `darwin doctor`: offline general configuration diagnostics; no network or files written.
31
+ 2. `darwin cloud-memory status`: **local-only** memory configuration/status, also using the existing loader.
32
+ 3. `darwin cloud-memory preferences`: actual bounded SDK read-only connectivity check against Memory. Explain that it contacts AWS with a fixed nonsensitive query, up to five results, no pagination, and the saved `timeoutMs`. Empty records are success. Even with `preferences: false`, this explicit setup health read is check-only: it neither enables preferences nor applies/adopts returned content. Preserve `preferences: false`, upload `off`, explicit `projectId`, timeout and legacy `cliPath` (validated but ignored); no cleanup write.
33
+
34
+ Avoid displaying preference content: capture command output in memory, check the command's exit status and parse successful JSON, and return only success plus `records.length` (and omissions if useful). Preserve failure/nonzero status; do not turn a failed command or unparseable output into zero records. Do not echo raw output on failure or store it in a file. This is a projection of the existing command, not a new doctor subcommand. Basic health means valid local config + successful bounded live read, NOT upload/delete permission, extraction, nonempty-record handling or strategy topology verification. Neither status alone nor doctor exit zero proves cloud connectivity.
35
+
36
+ No AWS CLI installation, STS/control-plane discovery, resource listing, credentials disclosure or confirmation of the unchanged actor is required on this path. Report unrelated doctor MCP/skill warnings separately; they are not evidence that memory is absent or a reason to reset it. State precisely which memory checks passed even when general diagnostics have unrelated warnings. If a command is not runnable or validation is unclear, report verification **pending**, not success; do not reinstall or infer missing memory.
37
+
38
+ ### Healthy stop
39
+
40
+ When local validation and the read-only health check pass, respond in the user's language, for example: **AgentCore Memory 已配置且基本检查通过,无需重复设置。** State current region/actor/upload mode, local + read-only checks passed, no config/resource edits or restart needed for unchanged config, and extraction/write not tested. **STOP** the bare setup workflow: no actor question, default confirmation, install/create/IAM change, preference adoption or redundant config write. This branch may finish without a question in both text and structured headless modes.
41
+
42
+ An explicit user request to reconfigure is separate intent: preserve/report the original healthy result first, then ask targeted confirmation for the requested changes only. Supplied arguments alone never silently replace saved settings or authorize mutation.
43
+
44
+ ### Failed or pending check
45
+
46
+ Existing config with SDK failure, no credentials, timeout, AccessDenied or wrong scope failed basic verification; it is NOT absent and NOT healthy. Report only the safely available category (for example timeout, HTTP 403, scope validation, or generic SDK failure when diagnostics are redacted); never guess the hidden cause or print raw errors/secrets. Ask TARGETED repair confirmation, preserving known actor/resources rather than starting over with defaults or automatically creating a resource. A denied/unverified/pending check cannot pass. After a second equivalent failure require a new evidence-backed hypothesis; after three stop/report, no endless polling. Only if the confirmed repair needs cloud details enter section 3, with scope/namespace checks before any change.
47
+
48
+ ## 2. Only for setup or confirmed repair/reconfiguration: questions and proposals
49
+
50
+ For missing/disabled setup, ask for the user's chosen username / `actorId`. Never guess it from OS username, git, AWS ARN, email, or another person's identity; never hardcode an actor. Accept a stable opaque ID matching `[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}`. If absent, ask and STOP the current turn awaiting the user's response. For setup reuse, show a previously user-provided value and ask explicit confirmation of reuse; never silently switch actors. For targeted repair/reconfiguration, ask only about affected settings, not confirmation of an unchanged actor. Group related missing decisions and the proposed defaults in the same question when known, rather than one question per round. In headless mode, return questions and pending status without reading stdin or guessing whenever this branch needs input; do not claim unattended setup is complete.
51
+
52
+ Gather only the bounded read-only environment/resource information needed for the proposal through ordinary tools and the permission gate; do not bypass denial or print secrets or credentials. Establish actual OS/architecture and installed tool versions only if needed for installation, and AWS identity/region only if needed for resource work, never as actor input. Prefer current values; label each proposal **current**, **user-provided**, or **fallback**. If reads are unavailable, label proposals unverified rather than inventing state.
53
+
54
+ Present a proposed defaults table, adapted to the discovered state, and ask explicit confirmation BEFORE any mutation:
55
+
56
+ | Setting | Proposal when not already chosen |
57
+ | --- | --- |
58
+ | Actor | User's answer, explicitly confirm setup reuse; retain unchanged actor during targeted repair |
59
+ | Region | Existing config or explicit AWS region if unambiguous; otherwise propose `us-west-2`; resolve conflicts |
60
+ | Resource | Compatible user-owned existing Memory first; otherwise independent `DarwinMemory`, with name, region and cost implications stated |
61
+ | Raw event retention | `30` days; raw event TTL is NOT long-term record TTL |
62
+ | Project isolation | Omit `projectId` for automatic per-project isolation |
63
+ | Preferences | `true`; acknowledge one bounded startup cloud read per runtime, not automatic adoption |
64
+ | Upload | Propose `manual`; stages new turns locally, sends nothing automatically; requires trajectory |
65
+ | Timeout | `timeoutMs: 5000` |
66
+ | Encryption | Service default, unless the user requires a particular key |
67
+
68
+ Do not ask about every internal constant. Explain every proposed change to an existing value; never overwrite silently. Existing `trajectory: false` conflicts with manual upload: ask whether to retain upload off or explicitly enable trajectory, never override it. Approval covers only the named config/resource actions in this table. Uploads, deletes, IAM expansion, import and redeploy require separate authorization.
69
+
70
+ Runtime already bundles official `@aws-sdk/client-bedrock-agentcore`; do not npm-install it in each project, import private global package paths, or change runtime dependencies. **AWS CLI** `aws bedrock-agentcore-control` is the separate control-plane setup tool. Optional `aws/agentcore-cli` (the `agentcore` infrastructure CLI) is not required. Do not substitute CLI names or rely on `/dev/stdin`. Before using commands, verify installed version/options against official documentation/help or local input skeletons (no service call). If a required tool is missing, propose the official install method appropriate to actual OS/architecture and obtain confirmation before installation, global package installation or sudo. Without approval, provide instructions and report blocked; never force-install.
71
+
72
+ Official references: [AWS CLI installation](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), [control-plane create-memory](https://docs.aws.amazon.com/cli/latest/reference/bedrock-agentcore-control/create-memory.html), [AgentCore pricing](https://aws.amazon.com/bedrock/agentcore/pricing/). Verify current pricing before creation; explain storage, extraction and retrieval charges rather than promising free setup.
73
+
74
+ ## 3. Reuse or create a compatible resource
75
+
76
+ Use read-only `aws sts get-caller-identity`, then `aws bedrock-agentcore-control list-memories` in the selected region. Honor pagination; cap discovery at 10 pages/100 resources and report omissions, asking for a memory ID if necessary. Use `get-memory --memory-id <returned-id>` to inspect full resource details, not just list summaries. Capture actual IDs; verify ownership, resource and both strategy statuses, `namespaceKeys`, and exact namespace templates below. A name match is not compatibility. On mismatch, stop and propose an independent resource; do not mutate another application's resource or widen reflections.
77
+
78
+ For an explicitly authorized new resource, this bounded create-memory template shows defaults, not overrides of confirmed choices. Set the confirmed resource `name` and `eventExpiryDuration`, replace the placeholder with a stable `clientToken`, and include optional `encryptionKeyArn` when the user confirmed a required KMS key. Never reset confirmed nondefault retention to 30 days or required encryption to the service default. Keep `namespaceKeys` and all three namespace templates strictly unchanged, including their variables:
79
+
80
+ ```json
81
+ {
82
+ "name": "DarwinMemory",
83
+ "eventExpiryDuration": 30,
84
+ "clientToken": "REPLACE_WITH_STABLE_REQUEST_TOKEN",
85
+ "namespaceKeys": [{ "key": "projectid" }],
86
+ "memoryStrategies": [
87
+ {
88
+ "episodicMemoryStrategy": {
89
+ "name": "DarwinEpisodes",
90
+ "namespaceTemplates": ["/users/{actorId}/projects/{projectid}/strategy/{memoryStrategyId}/sessions/{sessionId}/"],
91
+ "reflectionConfiguration": {
92
+ "namespaceTemplates": ["/users/{actorId}/projects/{projectid}/strategy/{memoryStrategyId}/"]
93
+ }
94
+ }
95
+ },
96
+ {
97
+ "userPreferenceMemoryStrategy": {
98
+ "name": "DarwinPreferences",
99
+ "namespaceTemplates": ["/users/{actorId}/strategy/{memoryStrategyId}/preferences/"]
100
+ }
101
+ }
102
+ ]
103
+ }
104
+ ```
105
+
106
+ Before issuing create-memory, validate the exact adapted request against the confirmed settings and the verified API/installed AWS CLI: `eventExpiryDuration` is an integer from 3 to 365 days; optional `encryptionKeyArn` is the confirmed KMS key ARN, not a newly created key or IAM grant. Verify support for `namespaceKeys` and built-in `episodicMemoryStrategy.reflectionConfiguration.namespaceTemplates`; never silently substitute deprecated/wider namespaces. If a confirmed setting cannot be supported, stop and explain rather than reverting to a default. After authorization, write a private request file outside the repository and call `aws bedrock-agentcore-control create-memory --region <confirmed-region> --cli-input-json file://<absolute-request-file> --no-cli-pager`. Use one stable `clientToken` for retries and keep the exact request. After timeout, check resource state/listing before any retry; never repeatedly create with new tokens. Capture AWS-returned memory and strategy IDs rather than constructing IDs from names. Read `get-memory` until resource and both strategies are `ACTIVE`, with a bounded deadline (for example 5 minutes/10 checks). Use background bash start/wait for waits, not foreground sleeps or unbounded polling. On failed status/deadline, stop with pending/failed state.
107
+
108
+ Keep an existing compatible resource. The optional infrastructure CLI's known schema/import fidelity limitations can drop `namespaceKeys` or filter `{memoryStrategyId}` templates. Before **any** import/deploy, freshly verify lossless support for these exact keys/templates/IDs/retention AND obtain separate user authorization. Defaults cannot bypass this limitation. Ordinary setup can use the verified AWS control plane without import/redeploy.
109
+
110
+ Least privilege: read access needs resource-scoped `GetMemoryRecord` and `RetrieveMemoryRecords`; discovery separately needs `ListMemories`/`GetMemory`. `CreateMemory` is only for approved provisioning. `CreateEvent` is only for separately authorized uploads; `DeleteMemoryRecord` is separate deletion authority. Do not add administrator permissions or expand IAM automatically; report missing operations for the owner to review. Explain raw event retention versus long-term storage costs before creation. No test writes, history backfill or automatic preference adoption by default. Synthetic-event testing needs separate explicit authorization and disposable scope; Darwin's live suite tests event acceptance, not full extraction.
111
+
112
+ ## 4. Apply only the approved configuration
113
+
114
+ After explicit confirmation, merge only the approved root `agentCoreMemory` fields into private `~/.darwin/config.json`. Preserve ALL unrelated model/provider, permissions, local memory, trajectory and other settings. Never replace the entire existing config with this example. Validate JSON before/after, show only the changed nonsecret fields, and keep config mode `0600`. Store no credentials in config or committed files. New config omits `cliPath`; remove only legacy `agentCoreMemory.cliPath` after explaining and confirming, never removing other fields to “migrate”.
115
+
116
+ Config template (all capitalized placeholder values must be replaced with confirmed identity / actual AWS-returned IDs):
117
+
118
+ ```json
119
+ {
120
+ "agentCoreMemory": {
121
+ "enabled": true,
122
+ "region": "us-west-2",
123
+ "memoryId": "MEMORY_ID_FROM_AWS",
124
+ "episodicStrategyId": "EPISODIC_STRATEGY_ID_FROM_AWS",
125
+ "preferenceStrategyId": "PREFERENCE_STRATEGY_ID_FROM_AWS",
126
+ "actorId": "USER_CONFIRMED_ACTOR_ID",
127
+ "timeoutMs": 5000,
128
+ "preferences": true,
129
+ "upload": "manual"
130
+ }
131
+ }
132
+ ```
133
+
134
+ Confirmed choices override all example defaults, not only the capitalized placeholders: use the confirmed `region`, `upload` (including `off`), `preferences` (including `false`), and `timeoutMs`. Preserve those choices instead of resetting them to `manual`, `true`, or `5000`; validate the exact merged config against the confirmed settings before writing. Memory ID must be an actual returned ID; the two strategy IDs must be distinct and use the actor segment grammar above. Do not set a global `projectId` default: omission derives automatic isolation from the canonical project key. Only when deliberately sharing checkouts, confirm explicit `projectId` matching `[a-z0-9][a-z0-9_-]{0,63}` (lowercase, 1–64 characters). This config camelCase field maps to lowercase AWS namespace variable `projectid`. Timeout accepts 100–15000 ms. Setup writes support `off` or `manual`; proposal `manual` differs from the runtime's default `off`. Project auto is available only through the user's separate `/cloud-memory auto` authority, never this setup writer. Unknown config fields are rejected.
135
+
136
+ Restart the runtime after config changes. The current session's tool catalogue does not magically refresh; do not pretend newly enabled recall tools already exist.
137
+
138
+ ## 5. After approved setup/repair: verify and hand off
139
+
140
+ Repeat section 1's local and read-only checks against the approved configuration, without displaying preference content. In a new session, gated `episodic_recall` with `intent` and `reflection_recall` with `useCase`, if available, check scoped reads. Queries describe target task intent/use case, never raw logs. An empty new store is valid connectivity, NOT proof of ingestion, extraction, nonempty-record handling or IAM write permission. Command expansion itself has no cloud side effects. Report actionable bounded failures without raw API errors or secrets. After a repeated equivalent failure require a new evidence-backed hypothesis; after three stop/report, do not loop.
141
+
142
+ Hand the following controls to the **user**, not another model tool call:
143
+
144
+ ```text
145
+ /cloud-memory preferences
146
+ /cloud-memory inspect <record-id>
147
+ /cloud-memory confirm <record-id> <hash> global
148
+ /cloud-memory pending
149
+ /cloud-memory preview <token>
150
+ /cloud-memory send <token> <preview-hash>
151
+ /cloud-memory discard <token>
152
+ ```
153
+
154
+ Preferences need inspection and the user's explicit adoption of the displayed hash as an enduring cross-project preference. Never seed preferences automatically. Manual upload means preview exact bytes and confidentiality risks before the user sends; decline with discard. Hashes prove data integrity, not human consent. Mutation controls are TUI user-only; standalone CLI is read-only (`status`, `preferences`, `inspect`, `pending`, `preview`). Never fake human confirmation via bash, SDK calls, pty input, or another channel.
155
+
156
+ The manual projection contains bounded literal **USER goals**, **TOOL evidence**, and **OTHER source/outcome/omissions**. Every public textual tool argument/result is eligible, including arbitrary MCP tools, free-form logs, file/diff content, skills, memory results and public subagent reports. It excludes all assistant prose/reasoning and binary/images; it never traverses child conversations, reads tool paths or hydrates offload/archive content. Execution evidence is captured before after-tool hooks, not necessarily as finally shown to the model; observed public fallback results are labelled when no execution snapshot exists. This is not a confidentiality guarantee: tool content can include secrets. No automatic uploads, history backfill, test writes or preference adoption belong to setup.
157
+
158
+ For this setup/repair branch, finish with a checklist report: resource reused/created and resource plus both strategy ACTIVE states only if actually checked (otherwise unverified); confirmed actor and region; namespace/project isolation; exactly which config fields changed; upload mode; local check versus live read results versus **unverified extraction**; restart only if config changed, and next user commands. The unchanged healthy branch uses section 1's short stop report, not this provisioning checklist. If waiting for an answer, permission, installation, ACTIVE state or verification, report **pending**, not complete.
@@ -3,7 +3,7 @@ export declare const SKILL_FILENAME = "SKILL.md";
3
3
  export declare const SKILLS_DIRNAME = "skills";
4
4
  /** Assets live beside this module in both `src/` and copied `dist/src/` output. */
5
5
  export declare const BUILTIN_SKILLS_DIR: string;
6
- export declare const REQUIRED_BUILTIN_SKILLS: readonly ['developer', 'self-evolution-research', 'self-reflection'];
6
+ export declare const REQUIRED_BUILTIN_SKILLS: readonly ['developer', 'self-evolution-research', 'self-reflection', 'setup-agentcore-memory'];
7
7
  /** A skill directory that could not be used, kept so the UI can surface it. */
8
8
  export interface SkillProblem {
9
9
  directory: string;