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
@@ -15,7 +15,19 @@
15
15
  * (`endTurn`) commits them, because a cancelled turn's tool result may never have
16
16
  * been reasoned about. `observe` cannot throw — observer discipline: a ledger
17
17
  * failure costs a possible duplicate wake, never a turn.
18
+ *
19
+ * SRF-036: the SDK `ContextOffloader` replaces an oversized result at default hook
20
+ * order with an `[Offloaded: …]` text preview, so the stream carries only the
21
+ * preview. {@link TerminalDeliveryLedger.install} therefore registers one
22
+ * `HookOrder.SDK_FIRST` `AfterToolCallEvent` hook that reads the *original* result
23
+ * and keeps its terminal ids as candidates keyed by `toolUseId`; `observe` resolves
24
+ * them against the result the stream actually carries. Unchanged, it counts exactly
25
+ * as before. Replaced, a candidate id counts only when the model-visible
26
+ * replacement text contains that exact id, so snapshots cut off by the preview stay
27
+ * undelivered. The preview is only searched for the literal id, never parsed for
28
+ * state: the state comes from the original.
18
29
  */
30
+ import { AfterToolCallEvent, HookOrder } from '@strands-agents/sdk';
19
31
  const TERMINAL_STATES = new Set(['succeeded', 'failed', 'stopped']);
20
32
  const TASK_ID = /^bg-[0-9a-f-]{36}$/;
21
33
  function isRecord(value) {
@@ -47,10 +59,29 @@ function resultPayload(content) {
47
59
  }
48
60
  return undefined;
49
61
  }
62
+ /**
63
+ * The array inside the SDK's ordinary-array envelope, or undefined. The SDK's
64
+ * `FunctionTool` cannot hand a plain array to Bedrock as JSON content, so it returns
65
+ * one as `new JsonBlock({ json: { $value: array } })` — which is how `list`'s
66
+ * `manager.list()` reaches the model (SRF-033). Exactly that shape is unwrapped, one
67
+ * level: an object whose only own key is `$value`, holding an array. Extra keys, a
68
+ * non-array `$value` and envelopes nested inside the array are not the SDK's shape
69
+ * and are not unwrapped.
70
+ */
71
+ function sdkArrayEnvelope(payload) {
72
+ if (!isRecord(payload))
73
+ return undefined;
74
+ const keys = Object.keys(payload);
75
+ if (keys.length !== 1 || keys[0] !== '$value')
76
+ return undefined;
77
+ const value = payload.$value;
78
+ return Array.isArray(value) ? value : undefined;
79
+ }
50
80
  /**
51
81
  * Task ids whose terminal state a successful `bash` result carried to the model.
52
82
  * Recognizes the manager's own shapes only — `wait` (`status.state`), `status`/`stop`
53
- * (a snapshot) and `list` (snapshots) — by the result, never by the input, because
83
+ * (a snapshot) and `list` (snapshots: a bare array, or the SDK's `{ $value: [...] }`
84
+ * envelope the real tool path produces) — by the result, never by the input, because
54
85
  * some SDK after-events omit the original input. Foreground `execute` results and
55
86
  * `output` results carry no state and contribute nothing.
56
87
  */
@@ -58,8 +89,9 @@ export function terminalTaskIdsInToolResult(toolName, result) {
58
89
  if (toolName !== 'bash' || result.status !== 'success')
59
90
  return [];
60
91
  const payload = resultPayload(result.content);
61
- if (Array.isArray(payload)) {
62
- return payload.map(terminalSnapshotId).filter((id) => id !== undefined);
92
+ const listed = Array.isArray(payload) ? payload : sdkArrayEnvelope(payload);
93
+ if (listed !== undefined) {
94
+ return listed.map(terminalSnapshotId).filter((id) => id !== undefined);
63
95
  }
64
96
  if (!isRecord(payload))
65
97
  return [];
@@ -75,23 +107,63 @@ export function terminalTaskIdsInToolResult(toolName, result) {
75
107
  }
76
108
  return [];
77
109
  }
110
+ /** Whether any text block of a model-visible result contains `id` verbatim. */
111
+ function textContains(content, id) {
112
+ return content.some((block) => isRecord(block) && block.type === 'textBlock' && typeof block.text === 'string' && block.text.includes(id));
113
+ }
78
114
  export class TerminalDeliveryLedger {
79
115
  delivered = new Set();
80
116
  pending = new Set();
117
+ /** Pre-replacement terminal ids per `toolUseId`, resolved by `observe`, dropped by `closeTurn`. */
118
+ candidates = new Map();
119
+ /**
120
+ * Registers the pre-offload hook on the parent Agent: `SDK_FIRST`, so it runs
121
+ * before the `ContextOffloader`'s default-order hook can replace the result.
122
+ * It only reads; it never changes the event.
123
+ */
124
+ install(agent) {
125
+ agent.addHook(AfterToolCallEvent, (event) => this.candidate(event), { order: HookOrder.SDK_FIRST });
126
+ }
127
+ /** Records the original result's terminal ids for `observe`. Synchronous, non-throwing. */
128
+ candidate(event) {
129
+ try {
130
+ const { toolUse, result } = event;
131
+ if (typeof toolUse?.name !== 'string' || typeof toolUse.toolUseId !== 'string')
132
+ return;
133
+ if (!isRecord(result) || !Array.isArray(result.content))
134
+ return;
135
+ const ids = terminalTaskIdsInToolResult(toolUse.name, { status: String(result.status), content: result.content });
136
+ if (ids.length > 0)
137
+ this.candidates.set(toolUse.toolUseId, { result, ids });
138
+ else
139
+ this.candidates.delete(toolUse.toolUseId);
140
+ }
141
+ catch {
142
+ // Observer discipline: a lost candidate costs a possible duplicate wake, never a turn.
143
+ }
144
+ }
81
145
  /** Observes one stream event of the current turn. Synchronous, non-throwing. */
82
146
  observe(event) {
83
147
  try {
84
148
  if (event.type !== 'afterToolCallEvent')
85
149
  return;
86
150
  const { toolUse, result } = event;
151
+ const candidate = typeof toolUse?.toolUseId === 'string' ? this.candidates.get(toolUse.toolUseId) : undefined;
152
+ if (candidate !== undefined)
153
+ this.candidates.delete(toolUse?.toolUseId);
87
154
  if (typeof toolUse?.name !== 'string' || !isRecord(result) || !Array.isArray(result.content))
88
155
  return;
89
- for (const id of terminalTaskIdsInToolResult(toolUse.name, {
90
- status: String(result.status),
91
- content: result.content,
92
- })) {
156
+ const status = String(result.status);
157
+ for (const id of terminalTaskIdsInToolResult(toolUse.name, { status, content: result.content })) {
93
158
  this.pending.add(id);
94
159
  }
160
+ // A replaced result (the offloader's preview): the original's ids count only
161
+ // where the model-visible text still names them exactly.
162
+ if (candidate !== undefined && candidate.result !== result && status === 'success') {
163
+ for (const id of candidate.ids)
164
+ if (textContains(result.content, id))
165
+ this.pending.add(id);
166
+ }
95
167
  }
96
168
  catch {
97
169
  // Observer discipline: never a second reason a turn dies.
@@ -106,6 +178,7 @@ export class TerminalDeliveryLedger {
106
178
  for (const id of this.pending)
107
179
  this.delivered.add(id);
108
180
  this.pending = new Set();
181
+ this.candidates = new Map();
109
182
  }
110
183
  /** True once a completed turn carried this task's terminal state to the model. */
111
184
  has(taskId) {
@@ -1 +1 @@
1
- {"version":3,"file":"task-terminal-delivery.js","sourceRoot":"","sources":["../../../src/agent/task-terminal-delivery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,MAAM,eAAe,GAAwB,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AACzF,MAAM,OAAO,GAAG,oBAAoB,CAAC;AAErC,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9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BAAE,IAAI,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;wBAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAC7F,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,0DAA0D;QAC5D,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,SAAkB;QAC1B,IAAI,SAAS;YAAE,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,OAAO;gBAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACrE,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,EAAE,CAAC;IAC9B,CAAC;IAED,kFAAkF;IAClF,GAAG,CAAC,MAAc;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;CACF"}
@@ -8,6 +8,26 @@ export declare const WORKING_CONTEXT_TAG = "working-context";
8
8
  * tell "these are all of them" from "here are the first two hundred".
9
9
  */
10
10
  export declare const MAX_LISTED_ENTRIES = 200;
11
+ /**
12
+ * How many registered tool names the block may list.
13
+ *
14
+ * The built-ins are a dozen; MCP servers are what make this unbounded, and one
15
+ * catalogue-happy server can register fifty tools. Names only — the description a
16
+ * tool carries is still its contract (`279f864` retired the hand-written catalogue
17
+ * because it drifted from the registry; this list is *read from* the registry, so it
18
+ * cannot). What is dropped is reported, as with the directory entries.
19
+ */
20
+ export declare const MAX_LISTED_TOOLS = 64;
21
+ export interface WorkingContextOptions {
22
+ /**
23
+ * The names the agent's tool registry holds for this run, read after
24
+ * `initialize()` so MCP discovery and the conditional parent-only tools (memory,
25
+ * cloud recall, delegation) are all in. Omitted means "do not mention tools":
26
+ * a caller that has no registry, like the offline suites, states nothing rather
27
+ * than an empty list.
28
+ */
29
+ readonly toolNames?: readonly string[];
30
+ }
11
31
  export interface WorkingContextLoad {
12
32
  /** The system-prompt fragment, delimited and ready to append. Never empty. */
13
33
  fragment: string;
@@ -26,7 +46,7 @@ export interface WorkingContextLoad {
26
46
  * listing: the working directory, platform and date are still worth sending, and
27
47
  * refusing to start over an unreadable folder would be absurd.
28
48
  */
29
- export declare function buildWorkingContext(projectRoot: string, now?: Date): Promise<WorkingContextLoad>;
49
+ export declare function buildWorkingContext(projectRoot: string, now?: Date, options?: WorkingContextOptions): Promise<WorkingContextLoad>;
30
50
  /**
31
51
  * Replaces any working context already in `prompt` with `fragment`, appending it
32
52
  * last.
@@ -10,6 +10,16 @@ export const WORKING_CONTEXT_TAG = 'working-context';
10
10
  * tell "these are all of them" from "here are the first two hundred".
11
11
  */
12
12
  export const MAX_LISTED_ENTRIES = 200;
13
+ /**
14
+ * How many registered tool names the block may list.
15
+ *
16
+ * The built-ins are a dozen; MCP servers are what make this unbounded, and one
17
+ * catalogue-happy server can register fifty tools. Names only — the description a
18
+ * tool carries is still its contract (`279f864` retired the hand-written catalogue
19
+ * because it drifted from the registry; this list is *read from* the registry, so it
20
+ * cannot). What is dropped is reported, as with the directory entries.
21
+ */
22
+ export const MAX_LISTED_TOOLS = 64;
13
23
  /** How wide the entry list wraps. Matches the prose width of the base prompt. */
14
24
  const WRAP_COLUMNS = 88;
15
25
  /**
@@ -20,7 +30,7 @@ const WRAP_COLUMNS = 88;
20
30
  * listing: the working directory, platform and date are still worth sending, and
21
31
  * refusing to start over an unreadable folder would be absurd.
22
32
  */
23
- export async function buildWorkingContext(projectRoot, now = new Date()) {
33
+ export async function buildWorkingContext(projectRoot, now = new Date(), options = {}) {
24
34
  const listing = await listEntries(projectRoot);
25
35
  const lines = [
26
36
  `- working directory: ${projectRoot}`,
@@ -29,6 +39,23 @@ export async function buildWorkingContext(projectRoot, now = new Date()) {
29
39
  `- node: ${process.version}`,
30
40
  `- date: ${now.toISOString().slice(0, 10)} (UTC), local time zone ${timeZone()}`,
31
41
  ];
42
+ // Registered tools are a fact about this run, not a rule: which of the
43
+ // conditional tools (memory, cloud recall, MCP) exist depends on config and on
44
+ // what the servers answered at startup. Naming them here tells the model what it
45
+ // can reach without re-introducing a catalogue that could disagree with the
46
+ // registry — this *is* the registry, sorted, deduplicated and capped.
47
+ if (options.toolNames !== undefined) {
48
+ const names = [...new Set(options.toolNames)].sort((a, b) => a.localeCompare(b));
49
+ if (names.length === 0)
50
+ lines.push('- tools registered for this session: none');
51
+ else {
52
+ const shown = names.slice(0, MAX_LISTED_TOOLS);
53
+ lines.push(`- tools registered for this session (${names.length}; names only — each tool's description is its contract):`, ...wrap(shown).map((line) => ` ${line}`));
54
+ if (names.length > shown.length) {
55
+ lines.push(` (${names.length - shown.length} more tool${names.length - shown.length === 1 ? '' : 's'} not listed)`);
56
+ }
57
+ }
58
+ }
32
59
  if (listing.problem === undefined) {
33
60
  lines.push(`- ${describeCounts(listing)}`, ...wrap(listing.names).map((line) => ` ${line}`));
34
61
  if (listing.omitted > 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"working-context.js","sourceRoot":"","sources":["../../../src/agent/working-context.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,MAAM,SAAS,CAAC;AAGzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC,iFAAiF;AACjF,MAAM,YAAY,GAAG,EAAE,CAAC;AAaxB;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,WAAmB,EACnB,GAAG,GAAS,IAAI,IAAI,EAAE;IAEtB,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,WAAW,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAG;QACZ,wBAAwB,WAAW,EAAE;QACrC,eA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C,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
@@ -0,0 +1,112 @@
1
+ import { type ProjectHookSourceInventory } from '../config.js';
2
+ import { type ProjectMcpServerInventory } from '../mcp/registry.js';
3
+ export declare const TRUST_FILENAME = "trust.json";
4
+ /** `~/.darwin/projects/<key>/trust.json` — user-owned, outside the repository. */
5
+ export declare function trustDecisionPath(projectRoot: string): string;
6
+ /** The stored decision, exactly the file's shape. */
7
+ export interface TrustDecision {
8
+ readonly trusted: boolean;
9
+ /** ISO 8601 instant of the decision, as written by darwin. */
10
+ readonly decidedAt: string;
11
+ }
12
+ /** Everything the checkout would arm, listed without arming any of it. */
13
+ export interface WorkspaceTrustInventory {
14
+ readonly hookSources: readonly ProjectHookSourceInventory[];
15
+ readonly mcpServers: readonly ProjectMcpServerInventory[];
16
+ readonly legacyRules: {
17
+ readonly file: string;
18
+ readonly allow: number;
19
+ readonly deny: number;
20
+ } | undefined;
21
+ /**
22
+ * Repository-supplied files the loaders could not parse, with their own message.
23
+ * Still executable configuration the user should see: a trusted project fails
24
+ * startup on them exactly as before (the loaders' `ConfigError`), an untrusted one
25
+ * never reads them.
26
+ */
27
+ readonly problems: readonly {
28
+ readonly file: string;
29
+ readonly problem: string;
30
+ }[];
31
+ }
32
+ export type WorkspaceTrustState = 'trusted' | 'untrusted' | 'undecided';
33
+ /** The resolved gate input for one project, as the drivers hand it to the runtime. */
34
+ export interface WorkspaceTrust {
35
+ readonly state: WorkspaceTrustState;
36
+ readonly inventory: WorkspaceTrustInventory;
37
+ /** Set when the stored decision file exists but could not be read as one (bounded). */
38
+ readonly problem?: string;
39
+ }
40
+ /** Nothing to consent to: the ordinary project, which sees nothing new. */
41
+ export declare function inventoryIsEmpty(inventory: WorkspaceTrustInventory): boolean;
42
+ /**
43
+ * Whether the interactive driver must ask before creating the runtime: no stored
44
+ * decision and something to decide about. A stored answer — either one — is never
45
+ * asked again; an empty inventory is never asked at all.
46
+ */
47
+ export declare function needsTrustPrompt(trust: WorkspaceTrust): boolean;
48
+ /**
49
+ * Whether the runtime arms the repository-supplied layers. Only an explicit
50
+ * `trusted` answer does; `undecided` (headless, or the interactive Escape) holds them
51
+ * exactly like a stored refusal — the layers are the risk, and "no answer yet" is not
52
+ * consent.
53
+ */
54
+ export declare function projectLayersArmed(trust: WorkspaceTrust): boolean;
55
+ /** Lists what the checkout would arm. Spawns nothing; a loader refusal becomes a `problems` row. */
56
+ export declare function inventoryWorkspace(projectRoot: string): Promise<WorkspaceTrustInventory>;
57
+ /**
58
+ * Reads the stored decision. Absent → `undefined`; present but not `{ trusted:
59
+ * boolean, decidedAt: string }` → `undefined` plus a bounded `problem`. Never throws:
60
+ * a decision file that cannot be read is "no decision", which holds the layers back
61
+ * and asks again — the safe direction.
62
+ */
63
+ export declare function readTrustDecision(projectRoot: string): Promise<{
64
+ decision: TrustDecision | undefined;
65
+ problem?: string;
66
+ }>;
67
+ /** Stores the user's answer. Creates the user-owned project directory; never touches the repository. */
68
+ export declare function writeTrustDecision(projectRoot: string, trusted: boolean, now?: () => Date): Promise<TrustDecision>;
69
+ /** The inventory and the stored decision together — what every driver starts from. */
70
+ export declare function resolveWorkspaceTrust(projectRoot: string): Promise<WorkspaceTrust>;
71
+ /** A trust value with a different state and the same inventory — the interactive answer. */
72
+ export declare function withTrustState(trust: WorkspaceTrust, state: WorkspaceTrustState): WorkspaceTrust;
73
+ /**
74
+ * What the runtime reports about the decision it applied: the state and, when the
75
+ * layers were held, exactly which ones. Plain data for `runtime.info`, `/status`,
76
+ * `/mcp`, the transcript notice and the headless `trust:` line / `run.started.trust`.
77
+ * Empty `held` lists for a trusted project or an empty inventory.
78
+ */
79
+ export interface WorkspaceTrustReport {
80
+ readonly state: WorkspaceTrustState;
81
+ readonly heldHookFiles: readonly string[];
82
+ readonly heldMcpServers: readonly {
83
+ readonly name: string;
84
+ readonly file: string;
85
+ }[];
86
+ readonly heldLegacyRules: {
87
+ readonly file: string;
88
+ readonly allow: number;
89
+ readonly deny: number;
90
+ } | undefined;
91
+ /** Repository-supplied files that were unreadable and therefore also held. */
92
+ readonly heldProblems: readonly {
93
+ readonly file: string;
94
+ readonly problem: string;
95
+ }[];
96
+ readonly problem?: string;
97
+ }
98
+ /** Projects the decision the runtime applied; a caller that passed no decision vouches for the checkout. */
99
+ export declare function workspaceTrustReport(trust: WorkspaceTrust | undefined): WorkspaceTrustReport;
100
+ /** Anything at all held back — the condition for the transcript notice and the headless line. */
101
+ export declare function holdsAnything(report: WorkspaceTrustReport): boolean;
102
+ /** Held items named per list before `… N more` — the `MAX_STATUS_NAMES` rule. */
103
+ export declare const MAX_HELD_NAMES = 6;
104
+ /**
105
+ * The held layers as bounded labels, project-relative: `hooks: .darwin/hooks.json`,
106
+ * `mcp: probe (.mcp.json)`, `rules: .darwin/config.json (2 allow, 1 deny)`,
107
+ * `unreadable: .agents/hooks.json`. One vocabulary for the transcript notice, the
108
+ * headless `trust:` line and `run.started.trust.held`, so the three cannot disagree.
109
+ */
110
+ export declare function heldLabels(report: WorkspaceTrustReport, projectRoot: string): string[];
111
+ /** One sentence for the drivers: what was held and why, or nothing when nothing was. */
112
+ export declare function describeHeld(report: WorkspaceTrustReport, projectRoot: string): string | undefined;
@@ -0,0 +1,207 @@
1
+ /**
2
+ * Workspace trust for repository-supplied executable configuration (SER-090).
3
+ *
4
+ * A checkout can carry three things darwin would otherwise *arm at launch* with no
5
+ * consent step: hook command files (`.darwin/hooks.json`, `.darwin/hooks/*.json`,
6
+ * `.agents/hooks.json`, `.agents/hooks/*.json`, the `hooks` key of a committed
7
+ * `.darwin/config.json`), MCP server definitions (`.darwin/mcp.json` or the root
8
+ * `.mcp.json`, every stdio entry a process spawned before the first prompt) and the
9
+ * legacy `permissionRules` fallback of a committed `.darwin/config.json`. This module
10
+ * is the pure half of the gate: it *inventories* what the checkout would arm without
11
+ * activating any of it, reads and writes the user-owned decision, and projects the
12
+ * result for every driver. It spawns nothing, registers nothing and never imports the
13
+ * runtime; the drivers (`cli-main.ts` interactive, `headless-runner.ts`, the dev REPL)
14
+ * resolve trust here first and hand the decision to `AgentRuntime.create`, which
15
+ * skips the held layers through `loadProjectPolicy`/`loadMcpClients` options.
16
+ *
17
+ * Two boundaries are load-bearing. The inventory shares one parse with activation:
18
+ * `inventoryProjectPolicy` runs the same `loadHookLayer` the policy loads from and
19
+ * `inventoryProjectMcpServers` the same declarative MCP reader, so a file listed here
20
+ * is exactly a file startup would arm and there is no second grammar to drift. And
21
+ * the decision lives in `~/.darwin/projects/<key>/trust.json` — `userProjectDir`, the
22
+ * store every other user-owned project fact uses — so a committed file inside the
23
+ * repository can never grant trust to itself: nothing under the project root is ever
24
+ * read as a decision. A malformed decision file reads as "no decision" with a bounded
25
+ * notice, never a crash and never a grant.
26
+ *
27
+ * User-global layers (`~/.darwin`, `~/.agents`), skills, custom commands and
28
+ * instruction files are prompt content or user-owned and are deliberately not part
29
+ * of the inventory: the gate is about what the *checkout* can execute or
30
+ * pre-authorize, not about what it can say.
31
+ */
32
+ import { mkdir, readFile, writeFile } from 'node:fs/promises';
33
+ import path from 'node:path';
34
+ import { inventoryProjectPolicy, } from '../config.js';
35
+ import { inventoryProjectMcpServers } from '../mcp/registry.js';
36
+ import { userProjectDir } from '../paths.js';
37
+ export const TRUST_FILENAME = 'trust.json';
38
+ /** `~/.darwin/projects/<key>/trust.json` — user-owned, outside the repository. */
39
+ export function trustDecisionPath(projectRoot) {
40
+ return path.join(userProjectDir(projectRoot), TRUST_FILENAME);
41
+ }
42
+ /** Nothing to consent to: the ordinary project, which sees nothing new. */
43
+ export function inventoryIsEmpty(inventory) {
44
+ return (inventory.hookSources.length === 0 &&
45
+ inventory.mcpServers.length === 0 &&
46
+ inventory.legacyRules === undefined &&
47
+ inventory.problems.length === 0);
48
+ }
49
+ /**
50
+ * Whether the interactive driver must ask before creating the runtime: no stored
51
+ * decision and something to decide about. A stored answer — either one — is never
52
+ * asked again; an empty inventory is never asked at all.
53
+ */
54
+ export function needsTrustPrompt(trust) {
55
+ return trust.state === 'undecided' && !inventoryIsEmpty(trust.inventory);
56
+ }
57
+ /**
58
+ * Whether the runtime arms the repository-supplied layers. Only an explicit
59
+ * `trusted` answer does; `undecided` (headless, or the interactive Escape) holds them
60
+ * exactly like a stored refusal — the layers are the risk, and "no answer yet" is not
61
+ * consent.
62
+ */
63
+ export function projectLayersArmed(trust) {
64
+ return trust.state === 'trusted';
65
+ }
66
+ /** Lists what the checkout would arm. Spawns nothing; a loader refusal becomes a `problems` row. */
67
+ export async function inventoryWorkspace(projectRoot) {
68
+ const [policy, mcp] = await Promise.all([
69
+ inventoryProjectPolicy(projectRoot),
70
+ inventoryProjectMcpServers(projectRoot),
71
+ ]);
72
+ return {
73
+ hookSources: policy.hookSources,
74
+ mcpServers: mcp.servers,
75
+ legacyRules: policy.legacyRules,
76
+ problems: [...policy.problems, ...(mcp.problem === undefined ? [] : [mcp.problem])],
77
+ };
78
+ }
79
+ /** Longest decision-file problem the notice carries; the rest is the file's own business. */
80
+ const MAX_PROBLEM_CODE_POINTS = 200;
81
+ /**
82
+ * Reads the stored decision. Absent → `undefined`; present but not `{ trusted:
83
+ * boolean, decidedAt: string }` → `undefined` plus a bounded `problem`. Never throws:
84
+ * a decision file that cannot be read is "no decision", which holds the layers back
85
+ * and asks again — the safe direction.
86
+ */
87
+ export async function readTrustDecision(projectRoot) {
88
+ const file = trustDecisionPath(projectRoot);
89
+ let text;
90
+ try {
91
+ text = await readFile(file, 'utf8');
92
+ }
93
+ catch (error) {
94
+ if (error?.code === 'ENOENT')
95
+ return { decision: undefined };
96
+ return { decision: undefined, problem: `${file} could not be read: ${bounded(describe(error))}` };
97
+ }
98
+ let parsed;
99
+ try {
100
+ parsed = JSON.parse(text);
101
+ }
102
+ catch (error) {
103
+ return { decision: undefined, problem: `${file} is not valid JSON: ${bounded(describe(error))}` };
104
+ }
105
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed) ||
106
+ typeof parsed['trusted'] !== 'boolean' ||
107
+ typeof parsed['decidedAt'] !== 'string') {
108
+ return {
109
+ decision: undefined,
110
+ problem: `${file} is not a trust decision (expected { "trusted": boolean, "decidedAt": string }); treated as undecided`,
111
+ };
112
+ }
113
+ const record = parsed;
114
+ return { decision: { trusted: record['trusted'], decidedAt: record['decidedAt'] } };
115
+ }
116
+ /** Stores the user's answer. Creates the user-owned project directory; never touches the repository. */
117
+ export async function writeTrustDecision(projectRoot, trusted, now = () => new Date()) {
118
+ const decision = { trusted, decidedAt: now().toISOString() };
119
+ const file = trustDecisionPath(projectRoot);
120
+ await mkdir(path.dirname(file), { recursive: true });
121
+ await writeFile(file, `${JSON.stringify(decision, null, 2)}\n`, 'utf8');
122
+ return decision;
123
+ }
124
+ /** The inventory and the stored decision together — what every driver starts from. */
125
+ export async function resolveWorkspaceTrust(projectRoot) {
126
+ const [inventory, stored] = await Promise.all([inventoryWorkspace(projectRoot), readTrustDecision(projectRoot)]);
127
+ const state = stored.decision === undefined ? 'undecided' : stored.decision.trusted ? 'trusted' : 'untrusted';
128
+ return { state, inventory, ...(stored.problem === undefined ? {} : { problem: stored.problem }) };
129
+ }
130
+ /** A trust value with a different state and the same inventory — the interactive answer. */
131
+ export function withTrustState(trust, state) {
132
+ return { ...trust, state };
133
+ }
134
+ /** Projects the decision the runtime applied; a caller that passed no decision vouches for the checkout. */
135
+ export function workspaceTrustReport(trust) {
136
+ if (trust === undefined || projectLayersArmed(trust)) {
137
+ return {
138
+ state: 'trusted',
139
+ heldHookFiles: [],
140
+ heldMcpServers: [],
141
+ heldLegacyRules: undefined,
142
+ heldProblems: [],
143
+ ...(trust?.problem === undefined ? {} : { problem: trust.problem }),
144
+ };
145
+ }
146
+ const { inventory } = trust;
147
+ return {
148
+ state: trust.state,
149
+ heldHookFiles: inventory.hookSources.map((source) => source.file),
150
+ heldMcpServers: inventory.mcpServers.map((server) => ({ name: server.name, file: server.file })),
151
+ heldLegacyRules: inventory.legacyRules,
152
+ heldProblems: inventory.problems,
153
+ ...(trust.problem === undefined ? {} : { problem: trust.problem }),
154
+ };
155
+ }
156
+ /** Anything at all held back — the condition for the transcript notice and the headless line. */
157
+ export function holdsAnything(report) {
158
+ return (report.heldHookFiles.length > 0 ||
159
+ report.heldMcpServers.length > 0 ||
160
+ report.heldLegacyRules !== undefined ||
161
+ report.heldProblems.length > 0);
162
+ }
163
+ /** Held items named per list before `… N more` — the `MAX_STATUS_NAMES` rule. */
164
+ export const MAX_HELD_NAMES = 6;
165
+ /**
166
+ * The held layers as bounded labels, project-relative: `hooks: .darwin/hooks.json`,
167
+ * `mcp: probe (.mcp.json)`, `rules: .darwin/config.json (2 allow, 1 deny)`,
168
+ * `unreadable: .agents/hooks.json`. One vocabulary for the transcript notice, the
169
+ * headless `trust:` line and `run.started.trust.held`, so the three cannot disagree.
170
+ */
171
+ export function heldLabels(report, projectRoot) {
172
+ const relative = (file) => {
173
+ const rel = path.relative(projectRoot, file);
174
+ return rel === '' || rel.startsWith('..') || path.isAbsolute(rel) ? file : rel;
175
+ };
176
+ const labels = [];
177
+ labels.push(...bound(report.heldHookFiles.map((file) => `hooks: ${relative(file)}`)));
178
+ labels.push(...bound(report.heldMcpServers.map((server) => `mcp: ${server.name} (${relative(server.file)})`)));
179
+ if (report.heldLegacyRules !== undefined) {
180
+ const { file, allow, deny } = report.heldLegacyRules;
181
+ labels.push(`rules: ${relative(file)} (${allow} allow, ${deny} deny)`);
182
+ }
183
+ labels.push(...bound(report.heldProblems.map((problem) => `unreadable: ${relative(problem.file)}`)));
184
+ return labels;
185
+ }
186
+ /** One sentence for the drivers: what was held and why, or nothing when nothing was. */
187
+ export function describeHeld(report, projectRoot) {
188
+ if (!holdsAnything(report))
189
+ return undefined;
190
+ const why = report.state === 'untrusted'
191
+ ? 'project not trusted'
192
+ : 'project trust undecided';
193
+ return `${why} — held back: ${heldLabels(report, projectRoot).join(', ')}`;
194
+ }
195
+ function bound(items) {
196
+ if (items.length <= MAX_HELD_NAMES)
197
+ return [...items];
198
+ return [...items.slice(0, MAX_HELD_NAMES), `… ${items.length - MAX_HELD_NAMES} more`];
199
+ }
200
+ function bounded(text) {
201
+ const points = [...text];
202
+ return points.length <= MAX_PROBLEM_CODE_POINTS ? text : `${points.slice(0, MAX_PROBLEM_CODE_POINTS).join('')}…`;
203
+ }
204
+ function describe(error) {
205
+ return error instanceof Error ? error.message : String(error);
206
+ }
207
+ //# sourceMappingURL=workspace-trust.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-trust.js","sourceRoot":"","sources":["../../../src/agent/workspace-trust.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EACL,sBAAsB,GAEvB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,0BAA0B,EAAkC,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC;AAE3C,kFAAkF;AAClF,MAAM,UAAU,iBAAiB,CAAC,WAAmB;IACnD,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,cAAc,CAAC,CAAC;AAChE,CAAC;AAiCD,2EAA2E;AAC3E,MAAM,UAAU,gBAAgB,CAAC,SAAkC;IACjE,OAAO,CACL,SAAS,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC;QAClC,SAAS,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;QACjC,SAAS,CAAC,WAAW,KAAK,SAAS;QACnC,SAAS,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAChC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAqB;IACpD,OAAO,KAAK,CAAC,K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IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAC;IAC7C,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,KAAK,WAAW;QACtC,CAAC,CAAC,qBAAqB;QACvB,CAAC,CAAC,yBAAyB,CAAC;IAC9B,OAAO,GAAG,GAAG,iBAAiB,UAAU,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC7E,CAAC;AAED,SAAS,KAAK,CAAC,KAAwB;IACrC,IAAI,KAAK,CAAC,MAAM,IAAI,cAAc;QAAE,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;IACtD,OAAO,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,EAAE,KAAK,KAAK,CAAC,MAAM,GAAG,cAAc,OAAO,CAAC,CAAC;AACxF,CAAC;AAED,SAAS,OAAO,CAAC,IAAY;IAC3B,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IACzB,OAAO,MAAM,CAAC,MAAM,IAAI,uBAAuB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,uBAAuB,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC;AACnH,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type AgentCoreConfig } from './config.js';
2
+ import type { UploadTurn } from './upload-projection.js';
3
+ import type { TurnSettlement } from '../trajectory/writer.js';
4
+ /** Called only from the existing user TUI management authority. No model tool. */
5
+ export declare function persistUploadMode(root: string, expected: AgentCoreConfig, mode: 'auto' | 'manual', signal: AbortSignal): Promise<AgentCoreConfig>;
6
+ /** No success classifier, sensitivity filter, whitelist or omitted-percent veto. */
7
+ export declare function autoHoldReason(turn: UploadTurn, settlement: TurnSettlement): string | undefined;