maka-agent 0.2.0-dev.3.20260830 → 0.2.0-dev.31.20260913

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 (2277) hide show
  1. package/LICENSE +242 -5
  2. package/README.md +38 -19
  3. package/README.zh-CN.md +34 -19
  4. package/RUNTIME_HOST_PEER_DEPENDENCIES.rust.tsv +70 -0
  5. package/RUNTIME_HOST_PEER_THIRD_PARTY_NOTICES.txt +1839 -140
  6. package/THIRD_PARTY_NOTICES.txt +477 -258
  7. package/dist/acp/maka-acp-agent.js +13 -3
  8. package/dist/acp/prompt-content.js +225 -0
  9. package/dist/acp/session-configuration.js +143 -0
  10. package/dist/acp/session-event-mapper.js +103 -0
  11. package/dist/acp/session-registry.js +1030 -0
  12. package/dist/acp/stdio-server.js +29 -1
  13. package/dist/activation-command.js +1 -2
  14. package/dist/cli-core.js +99 -102
  15. package/dist/cli-ui-locale.js +7 -2
  16. package/dist/eval-bundle-path.js +1 -1
  17. package/dist/mcp-capability-provider.js +8 -11
  18. package/dist/onboarding-catalog.js +4 -5
  19. package/dist/pi-transcript-tools.js +9 -2
  20. package/dist/pi-transcript.js +86 -31
  21. package/dist/pi-tui-form-interaction.js +497 -0
  22. package/dist/pi-tui-layout.js +60 -12
  23. package/dist/pi-tui-mcp-status.js +122 -124
  24. package/dist/pi-tui-pickers.js +562 -102
  25. package/dist/pi-tui-runner.js +722 -170
  26. package/dist/pi-tui-todo.js +221 -0
  27. package/dist/pi-tui-transcript-viewer.js +134 -7
  28. package/dist/run-command-core.js +6 -14
  29. package/dist/runtime-host-access-command.js +37 -4
  30. package/dist/runtime-host-capability-provider-command.js +16 -2
  31. package/dist/runtime-host-cli-context.js +300 -80
  32. package/dist/runtime-host-cli-installation.js +8 -2
  33. package/dist/runtime-host-cli.js +397 -67
  34. package/dist/runtime-host-handoff-surface.js +108 -0
  35. package/dist/runtime-host-help.js +244 -0
  36. package/dist/runtime-host-installed-update-activator.js +70 -33
  37. package/dist/runtime-host-installed-update-bootstrap.js +13 -0
  38. package/dist/runtime-host-installed-update-coordinator.js +44 -96
  39. package/dist/runtime-host-lifecycle-transaction.js +101 -28
  40. package/dist/runtime-host-local-handoff.js +215 -41
  41. package/dist/runtime-host-local-managed-activation.js +84 -0
  42. package/dist/runtime-host-local-source-retirement.js +119 -0
  43. package/dist/runtime-host-local-target-activation.js +141 -0
  44. package/dist/runtime-host-managed-deployment.js +158 -51
  45. package/dist/runtime-host-managed-lifecycle-manager.js +5 -6
  46. package/dist/runtime-host-onboarding.js +368 -21
  47. package/dist/runtime-host-openrc-service.js +469 -0
  48. package/dist/runtime-host-operator-retirement.js +50 -0
  49. package/dist/runtime-host-package-deployment.js +36 -2
  50. package/dist/runtime-host-peer-artifact.js +3 -3
  51. package/dist/runtime-host-peer-management-command.js +30 -12
  52. package/dist/runtime-host-peer-mesh-management-command.js +18 -1
  53. package/dist/runtime-host-plugin-command.js +101 -0
  54. package/dist/runtime-host-profile-command.js +1 -1
  55. package/dist/runtime-host-run-command.js +32 -57
  56. package/dist/runtime-host-service-command.js +3 -3
  57. package/dist/runtime-host-service-management-command.js +67 -17
  58. package/dist/runtime-host-service-manager.js +3 -3
  59. package/dist/runtime-host-session-channel.js +79 -9
  60. package/dist/runtime-host-session-driver.js +85 -32
  61. package/dist/runtime-host-session-update.js +62 -0
  62. package/dist/runtime-host-setup-command.js +103 -65
  63. package/dist/runtime-host-systemd-service.js +9 -3
  64. package/dist/runtime-host-task-readiness.js +2 -3
  65. package/dist/runtime-host-tui-command.js +58 -77
  66. package/dist/runtime-host-tui-context.js +56 -17
  67. package/dist/runtime-host-tui-owner.js +226 -0
  68. package/dist/runtime-host-update-command.js +131 -48
  69. package/dist/runtime-host-update-discovery.js +1 -0
  70. package/dist/runtime-host-update-reconciliation.js +7 -7
  71. package/dist/runtime-host-windows-service.js +166 -0
  72. package/dist/runtime-host-windows-task-launcher-artifact.js +75 -0
  73. package/dist/session-export-command.js +72 -0
  74. package/dist/session-import-command.js +69 -0
  75. package/dist/tui-autocomplete-layout.js +3 -1
  76. package/dist/tui-clipboard.js +86 -0
  77. package/dist/tui-context-refresh.js +103 -0
  78. package/dist/tui-copy-catalog.js +976 -14
  79. package/dist/tui-copy-command.js +103 -0
  80. package/dist/tui-editor-render.js +36 -0
  81. package/dist/tui-host-owner-copy.js +24 -0
  82. package/dist/tui-mcp-control.js +87 -10
  83. package/dist/tui-mcp-remote-publication.js +395 -0
  84. package/native/runtime-host-peer/prebuilds/darwin-arm64/maka_runtime_host_peer.node +0 -0
  85. package/native/runtime-host-peer/prebuilds/linux-arm64/maka_runtime_host_peer.node +0 -0
  86. package/native/runtime-host-peer/prebuilds/linux-x64/maka_runtime_host_peer.node +0 -0
  87. package/native/runtime-host-peer/prebuilds/win32-x64/maka_runtime_host_peer.node +0 -0
  88. package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
  89. package/node_modules/@ai-sdk/anthropic/CHANGELOG.md +117 -0
  90. package/node_modules/@ai-sdk/anthropic/dist/index.js +937 -411
  91. package/node_modules/@ai-sdk/anthropic/dist/internal/index.js +335 -160
  92. package/node_modules/@ai-sdk/anthropic/docs/05-anthropic.mdx +132 -43
  93. package/node_modules/@ai-sdk/anthropic/node_modules/@ai-sdk/provider/CHANGELOG.md +1262 -0
  94. package/node_modules/@ai-sdk/anthropic/node_modules/@ai-sdk/provider/package.json +63 -0
  95. package/node_modules/@ai-sdk/anthropic/package.json +6 -6
  96. package/node_modules/@ai-sdk/cohere/CHANGELOG.md +105 -0
  97. package/node_modules/@ai-sdk/cohere/dist/index.js +20 -22
  98. package/node_modules/@ai-sdk/cohere/node_modules/@ai-sdk/provider/CHANGELOG.md +1262 -0
  99. package/node_modules/@ai-sdk/cohere/node_modules/@ai-sdk/provider/README.md +1 -0
  100. package/node_modules/@ai-sdk/cohere/node_modules/@ai-sdk/provider/dist/index.js +426 -0
  101. package/node_modules/@ai-sdk/cohere/node_modules/@ai-sdk/provider/package.json +63 -0
  102. package/node_modules/@ai-sdk/cohere/package.json +6 -6
  103. package/node_modules/@ai-sdk/google/CHANGELOG.md +176 -0
  104. package/node_modules/@ai-sdk/google/dist/index.js +4441 -2801
  105. package/node_modules/@ai-sdk/google/dist/internal/index.js +640 -177
  106. package/node_modules/@ai-sdk/google/docs/15-google.mdx +225 -97
  107. package/node_modules/@ai-sdk/google/node_modules/@ai-sdk/provider/CHANGELOG.md +1262 -0
  108. package/node_modules/@ai-sdk/google/node_modules/@ai-sdk/provider/README.md +1 -0
  109. package/node_modules/@ai-sdk/google/node_modules/@ai-sdk/provider/dist/index.js +426 -0
  110. package/node_modules/@ai-sdk/google/node_modules/@ai-sdk/provider/package.json +63 -0
  111. package/node_modules/@ai-sdk/google/package.json +6 -6
  112. package/node_modules/@ai-sdk/open-responses/CHANGELOG.md +81 -0
  113. package/node_modules/@ai-sdk/open-responses/dist/index.js +570 -22
  114. package/node_modules/@ai-sdk/open-responses/docs/06-open-responses.mdx +123 -2
  115. package/node_modules/@ai-sdk/open-responses/node_modules/@ai-sdk/provider/CHANGELOG.md +38 -0
  116. package/node_modules/@ai-sdk/open-responses/node_modules/@ai-sdk/provider/package.json +1 -1
  117. package/node_modules/@ai-sdk/open-responses/package.json +3 -3
  118. package/node_modules/@ai-sdk/openai/CHANGELOG.md +184 -0
  119. package/node_modules/@ai-sdk/openai/dist/index.js +2013 -736
  120. package/node_modules/@ai-sdk/openai/dist/internal/index.js +1377 -478
  121. package/node_modules/@ai-sdk/openai/docs/03-openai.mdx +208 -52
  122. package/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider/CHANGELOG.md +1262 -0
  123. package/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider/LICENSE +13 -0
  124. package/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider/README.md +1 -0
  125. package/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider/dist/index.js +426 -0
  126. package/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider/package.json +63 -0
  127. package/node_modules/@ai-sdk/openai/package.json +6 -6
  128. package/node_modules/@ai-sdk/openai-compatible/CHANGELOG.md +126 -0
  129. package/node_modules/@ai-sdk/openai-compatible/dist/index.js +105 -20
  130. package/node_modules/@ai-sdk/openai-compatible/dist/internal/index.js +9 -0
  131. package/node_modules/@ai-sdk/openai-compatible/docs/index.mdx +78 -0
  132. package/node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider/CHANGELOG.md +1262 -0
  133. package/node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider/README.md +1 -0
  134. package/node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider/dist/index.js +426 -0
  135. package/node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider/package.json +63 -0
  136. package/node_modules/@ai-sdk/openai-compatible/package.json +6 -6
  137. package/node_modules/@ai-sdk/provider-utils/CHANGELOG.md +92 -0
  138. package/node_modules/@ai-sdk/provider-utils/dist/index.js +664 -168
  139. package/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/CHANGELOG.md +1262 -0
  140. package/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/LICENSE +13 -0
  141. package/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/README.md +1 -0
  142. package/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/dist/index.js +426 -0
  143. package/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/package.json +63 -0
  144. package/node_modules/@ai-sdk/provider-utils/package.json +5 -5
  145. package/node_modules/@earendil-works/pi-tui/README.md +1 -1
  146. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +36 -3
  147. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +9 -4
  148. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +9 -4
  149. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +24 -4
  150. package/node_modules/@earendil-works/pi-tui/dist/components/text.js +5 -4
  151. package/node_modules/@earendil-works/pi-tui/dist/index.js +1 -1
  152. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +2 -2
  153. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js +2 -8
  154. package/node_modules/@earendil-works/pi-tui/dist/native-module-path.js +19 -0
  155. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +37 -2
  156. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +4 -10
  157. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +63 -16
  158. package/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.js +105 -45
  159. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  160. package/node_modules/@maka/core/dist/agent-run.js +25 -336
  161. package/node_modules/@maka/core/dist/artifacts.js +32 -23
  162. package/node_modules/@maka/core/dist/attachments.js +100 -1
  163. package/node_modules/@maka/core/dist/bot-events.js +18 -63
  164. package/node_modules/@maka/core/dist/bounded-response.js +71 -0
  165. package/node_modules/@maka/core/dist/canonical-json.js +27 -0
  166. package/node_modules/@maka/core/dist/canonical-runtime-event.js +3 -1
  167. package/node_modules/@maka/core/dist/capabilities.js +35 -0
  168. package/node_modules/@maka/core/dist/chat-model-choice.js +11 -31
  169. package/node_modules/@maka/core/dist/client-capability-grant.js +149 -0
  170. package/node_modules/@maka/core/dist/collaboration.js +12 -0
  171. package/node_modules/@maka/core/dist/computer-use.js +27 -93
  172. package/node_modules/@maka/core/dist/connection-error-copy.js +17 -34
  173. package/node_modules/@maka/core/dist/connection-readiness.js +3 -31
  174. package/node_modules/@maka/core/dist/deep-research.js +1 -20
  175. package/node_modules/@maka/core/dist/diagnostic-log.js +18 -7
  176. package/node_modules/@maka/core/dist/display-redaction.js +18 -0
  177. package/node_modules/@maka/core/dist/durable-tool-result-projection.js +126 -0
  178. package/node_modules/@maka/core/dist/events.js +43 -14
  179. package/node_modules/@maka/core/dist/execution-inspect.js +12 -21
  180. package/node_modules/@maka/core/dist/foreign-session.js +3 -3
  181. package/node_modules/@maka/core/dist/goal.js +44 -2
  182. package/node_modules/@maka/core/dist/health.js +50 -45
  183. package/node_modules/@maka/core/dist/interaction.js +623 -2
  184. package/node_modules/@maka/core/dist/llm-connections.js +115 -87
  185. package/node_modules/@maka/core/dist/local-memory.js +2 -2
  186. package/node_modules/@maka/core/dist/maka-wordmark.js +23 -0
  187. package/node_modules/@maka/core/dist/model-call-attempt.js +134 -82
  188. package/node_modules/@maka/core/dist/model-call-usage-projection.js +0 -183
  189. package/node_modules/@maka/core/dist/model-catalog.js +191 -322
  190. package/node_modules/@maka/core/dist/model-facts.js +206 -0
  191. package/node_modules/@maka/core/dist/model-failure.js +40 -0
  192. package/node_modules/@maka/core/dist/model-metadata.generated.js +1910 -1875
  193. package/node_modules/@maka/core/dist/model-metadata.js +217 -209
  194. package/node_modules/@maka/core/dist/model-projection-transition.js +145 -0
  195. package/node_modules/@maka/core/dist/model-thinking.js +73 -24
  196. package/node_modules/@maka/core/dist/model-web-search.js +5 -4
  197. package/node_modules/@maka/core/dist/models-dev-projection.js +302 -0
  198. package/node_modules/@maka/core/dist/models-dev-refresh.js +55 -0
  199. package/node_modules/@maka/core/dist/onboarding.js +2 -1
  200. package/node_modules/@maka/core/dist/permission-profile.js +17 -0
  201. package/node_modules/@maka/core/dist/permission.js +0 -1
  202. package/node_modules/@maka/core/dist/provider-auth.js +47 -291
  203. package/node_modules/@maka/core/dist/provider-registry.js +115 -373
  204. package/node_modules/@maka/core/dist/record-schema.js +22 -2
  205. package/node_modules/@maka/core/dist/redaction.js +78 -40
  206. package/node_modules/@maka/core/dist/relative-time.js +6 -5
  207. package/node_modules/@maka/core/dist/run-composition.js +77 -2
  208. package/node_modules/@maka/core/dist/runtime-boundary.js +182 -66
  209. package/node_modules/@maka/core/dist/runtime-event-store.js +6 -0
  210. package/node_modules/@maka/core/dist/runtime-event.js +254 -12
  211. package/node_modules/@maka/core/dist/runtime-handoff.js +106 -0
  212. package/node_modules/@maka/core/dist/runtime-invocation.js +223 -0
  213. package/node_modules/@maka/core/dist/runtime-logical-execution.js +137 -0
  214. package/node_modules/@maka/core/dist/runtime-policy/connection-catalog-codec.js +198 -44
  215. package/node_modules/@maka/core/dist/runtime-policy/credential-vault-codec.js +9 -1
  216. package/node_modules/@maka/core/dist/runtime-policy/model-catalog-entry-codec.js +93 -0
  217. package/node_modules/@maka/core/dist/runtime-policy/policy-codec.js +118 -4
  218. package/node_modules/@maka/core/dist/runtime-policy.js +6 -2
  219. package/node_modules/@maka/core/dist/scheduled-task.js +12 -2
  220. package/node_modules/@maka/core/dist/session-name.js +0 -1
  221. package/node_modules/@maka/core/dist/session-send-projection.js +2 -1
  222. package/node_modules/@maka/core/dist/session-start-mode.js +42 -0
  223. package/node_modules/@maka/core/dist/session-todo.js +101 -0
  224. package/node_modules/@maka/core/dist/session-trace.js +5 -1
  225. package/node_modules/@maka/core/dist/session.js +313 -52
  226. package/node_modules/@maka/core/dist/settings.js +27 -8
  227. package/node_modules/@maka/core/dist/slash-command-catalog.js +4 -0
  228. package/node_modules/@maka/core/dist/task-submission-readiness.js +2 -1
  229. package/node_modules/@maka/core/dist/text-sanitize.js +27 -2
  230. package/node_modules/@maka/core/dist/tool-activity-args.js +4 -0
  231. package/node_modules/@maka/core/dist/tool-quiet-preview.js +20 -10
  232. package/node_modules/@maka/core/dist/tool-result-archive-evidence.js +22 -0
  233. package/node_modules/@maka/core/dist/tool-result-record-schema.js +5 -2
  234. package/node_modules/@maka/core/dist/ui-locale.js +23 -10
  235. package/node_modules/@maka/core/dist/unified-diff.js +33 -26
  236. package/node_modules/@maka/core/dist/usage-ledger-merge.js +10 -9
  237. package/node_modules/@maka/core/dist/usage-record-schema.js +38 -30
  238. package/node_modules/@maka/core/dist/usage-stats/types.js +2 -0
  239. package/node_modules/@maka/core/dist/workhub-action-result.js +68 -0
  240. package/node_modules/@maka/core/dist/workhub-routing.js +126 -0
  241. package/node_modules/@maka/core/node_modules/@formatjs/icu-messageformat-parser/index.js +2175 -0
  242. package/node_modules/@maka/core/node_modules/@formatjs/icu-messageformat-parser/manipulator.js +209 -0
  243. package/node_modules/@maka/core/node_modules/@formatjs/icu-messageformat-parser/no-parser.js +162 -0
  244. package/node_modules/@maka/core/node_modules/@formatjs/icu-messageformat-parser/package.json +21 -0
  245. package/node_modules/@maka/core/node_modules/@formatjs/icu-messageformat-parser/printer.js +224 -0
  246. package/node_modules/@maka/core/node_modules/intl-messageformat/intl-messageformat.iife.js +2807 -0
  247. package/node_modules/@maka/core/node_modules/intl-messageformat/package.json +40 -0
  248. package/node_modules/@maka/core/package.json +22 -3
  249. package/node_modules/@maka/eval/dist/experiment-directory.js +4 -13
  250. package/node_modules/@maka/eval/dist/external-subject.js +1 -1
  251. package/node_modules/@maka/eval/dist/harbor-external-subject.js +4 -3
  252. package/node_modules/@maka/eval/dist/harness-executor.js +3 -2
  253. package/node_modules/@maka/eval/dist/install-preflight.js +39 -10
  254. package/node_modules/@maka/eval/dist/process-termination.js +83 -0
  255. package/node_modules/@maka/eval/dist/toolchain-verification.js +1 -1
  256. package/node_modules/@maka/eval/harbor/egress-proxy/entrypoint.sh +2 -1
  257. package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Client.md +4 -0
  258. package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +3 -2
  259. package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/EventSource.md +4 -0
  260. package/node_modules/@maka/eval/node_modules/undici/lib/cache/memory-cache-store.js +1 -1
  261. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/agent.js +7 -2
  262. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/balanced-pool.js +1 -1
  263. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client-h1.js +12 -4
  264. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client-h2.js +43 -3
  265. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client.js +3 -2
  266. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/dispatcher-base.js +13 -1
  267. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/dispatcher.js +10 -0
  268. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +10 -3
  269. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/proxy-agent.js +1 -1
  270. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/round-robin-pool.js +1 -1
  271. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +3 -1
  272. package/node_modules/@maka/eval/node_modules/undici/lib/handler/cache-handler.js +8 -0
  273. package/node_modules/@maka/eval/node_modules/undici/lib/handler/decorator-handler.js +7 -1
  274. package/node_modules/@maka/eval/node_modules/undici/lib/handler/deduplication-handler.js +12 -6
  275. package/node_modules/@maka/eval/node_modules/undici/lib/handler/redirect-handler.js +8 -0
  276. package/node_modules/@maka/eval/node_modules/undici/lib/handler/retry-handler.js +83 -11
  277. package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/dump.js +1 -1
  278. package/node_modules/@maka/eval/node_modules/undici/lib/mock/mock-agent.js +13 -1
  279. package/node_modules/@maka/eval/node_modules/undici/lib/mock/mock-utils.js +11 -10
  280. package/node_modules/@maka/eval/node_modules/undici/lib/web/cookies/parse.js +4 -2
  281. package/node_modules/@maka/eval/node_modules/undici/lib/web/eventsource/eventsource-stream.js +28 -1
  282. package/node_modules/@maka/eval/node_modules/undici/lib/web/eventsource/eventsource.js +4 -1
  283. package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/request.js +2 -3
  284. package/node_modules/@maka/eval/node_modules/undici/package.json +3 -3
  285. package/node_modules/@maka/eval/package.json +1 -1
  286. package/node_modules/@maka/mcp/dist/form-elicitation.js +213 -0
  287. package/node_modules/@maka/mcp/dist/index.js +465 -68
  288. package/node_modules/@maka/mcp/dist/sep-2243.js +3 -3
  289. package/node_modules/@maka/runtime/dist/agent-graph-timeline.js +12 -11
  290. package/node_modules/@maka/runtime/dist/agent-run-inspect.js +37 -85
  291. package/node_modules/@maka/runtime/dist/agent-run-recovery.js +36 -46
  292. package/node_modules/@maka/runtime/dist/agent-run.js +616 -468
  293. package/node_modules/@maka/runtime/dist/agent-swarm-status-tool.js +0 -1
  294. package/node_modules/@maka/runtime/dist/ai-sdk-backend.js +125 -3751
  295. package/node_modules/@maka/runtime/dist/ai-sdk-compaction-contract.js +6 -1
  296. package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +494 -521
  297. package/node_modules/@maka/runtime/dist/ai-sdk-message-projection.js +637 -0
  298. package/node_modules/@maka/runtime/dist/ai-sdk-tool-repair.js +115 -0
  299. package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +2678 -0
  300. package/node_modules/@maka/runtime/dist/ask-user-question-tool.js +0 -1
  301. package/node_modules/@maka/runtime/dist/bash-model-output.js +7 -1
  302. package/node_modules/@maka/runtime/dist/bash-tail-buffer.js +13 -52
  303. package/node_modules/@maka/runtime/dist/bots/base-adapter.js +17 -0
  304. package/node_modules/@maka/runtime/dist/bots/bot-test.js +40 -23
  305. package/node_modules/@maka/runtime/dist/bots/dingtalk-bridge.js +93 -24
  306. package/node_modules/@maka/runtime/dist/bots/discord-bridge.js +4 -4
  307. package/node_modules/@maka/runtime/dist/bots/feishu-bridge.js +28 -25
  308. package/node_modules/@maka/runtime/dist/bots/qq-bridge.js +6 -4
  309. package/node_modules/@maka/runtime/dist/bots/slack-bridge.js +8 -7
  310. package/node_modules/@maka/runtime/dist/bots/telegram-bridge.js +7 -31
  311. package/node_modules/@maka/runtime/dist/bots/wechat-bridge.js +104 -48
  312. package/node_modules/@maka/runtime/dist/bots/wecom-bridge.js +45 -42
  313. package/node_modules/@maka/runtime/dist/bots/ws-bridge-base.js +2 -3
  314. package/node_modules/@maka/runtime/dist/builtin-tools.js +107 -115
  315. package/node_modules/@maka/runtime/dist/bundled-skill-catalog.generated.js +1 -1
  316. package/node_modules/@maka/runtime/dist/child-fd-input.js +3 -2
  317. package/node_modules/@maka/runtime/dist/code-mode.js +7 -4
  318. package/node_modules/@maka/runtime/dist/computer-use-codec.js +1 -141
  319. package/node_modules/@maka/runtime/dist/computer-use-tools.js +27 -106
  320. package/node_modules/@maka/runtime/dist/context-budget-helpers.js +4 -57
  321. package/node_modules/@maka/runtime/dist/context-budget-policy.js +26 -65
  322. package/node_modules/@maka/runtime/dist/context-budget.js +44 -103
  323. package/node_modules/@maka/runtime/dist/context-diagnostics.js +72 -33
  324. package/node_modules/@maka/runtime/dist/continuation-replay.js +22 -11
  325. package/node_modules/@maka/runtime/dist/conversation-copy.js +656 -188
  326. package/node_modules/@maka/runtime/dist/cua-frame-state.js +1 -69
  327. package/node_modules/@maka/runtime/dist/deep-research-tools.js +15 -24
  328. package/node_modules/@maka/runtime/dist/durable-tool-result-projection.js +436 -0
  329. package/node_modules/@maka/runtime/dist/edit-replace.js +2 -2
  330. package/node_modules/@maka/runtime/dist/execution-inspect.js +56 -41
  331. package/node_modules/@maka/runtime/dist/filesystem-executor.js +10 -6
  332. package/node_modules/@maka/runtime/dist/filesystem-worker/client.js +77 -19
  333. package/node_modules/@maka/runtime/dist/filesystem-worker/launch-spec.js +66 -55
  334. package/node_modules/@maka/runtime/dist/filesystem-worker/operations.js +34 -98
  335. package/node_modules/@maka/runtime/dist/filesystem-worker/protocol.js +25 -10
  336. package/node_modules/@maka/runtime/dist/filesystem-worker/worker-entry.js +2 -0
  337. package/node_modules/@maka/runtime/dist/github-copilot-oauth-enrollment.js +267 -0
  338. package/node_modules/@maka/runtime/dist/glob-search.js +74 -0
  339. package/node_modules/@maka/runtime/dist/goal-continuation.js +119 -13
  340. package/node_modules/@maka/runtime/dist/goal-evaluator.js +10 -4
  341. package/node_modules/@maka/runtime/dist/goal-state.js +7 -0
  342. package/node_modules/@maka/runtime/dist/grep-search.js +155 -0
  343. package/node_modules/@maka/runtime/dist/history-compact-checkpoint-coordinator.js +16 -6
  344. package/node_modules/@maka/runtime/dist/history-compact-checkpoint.js +79 -29
  345. package/node_modules/@maka/runtime/dist/history-compact-error.js +10 -2
  346. package/node_modules/@maka/runtime/dist/history-compact-input-fit.js +7 -1
  347. package/node_modules/@maka/runtime/dist/history-compact-ledger.js +18 -18
  348. package/node_modules/@maka/runtime/dist/history-compact-summarizer.js +132 -110
  349. package/node_modules/@maka/runtime/dist/history-compact-summary-validation.js +14 -30
  350. package/node_modules/@maka/runtime/dist/history-compaction.js +101 -89
  351. package/node_modules/@maka/runtime/dist/image-file.js +5 -20
  352. package/node_modules/@maka/runtime/dist/interaction-authority.js +85 -0
  353. package/node_modules/@maka/runtime/dist/latest-context-snapshot.js +112 -23
  354. package/node_modules/@maka/runtime/dist/ledger-tool-result-archive-reader.js +164 -0
  355. package/node_modules/@maka/runtime/dist/local-web-fetch.js +2 -43
  356. package/node_modules/@maka/runtime/dist/mcp-tools.js +93 -35
  357. package/node_modules/@maka/runtime/dist/memory-extraction-evidence.js +7 -1
  358. package/node_modules/@maka/runtime/dist/memory-extraction.js +23 -18
  359. package/node_modules/@maka/runtime/dist/message-authority.js +9 -0
  360. package/node_modules/@maka/runtime/dist/model-adapter.js +103 -122
  361. package/node_modules/@maka/runtime/dist/model-factory.js +34 -81
  362. package/node_modules/@maka/runtime/dist/model-fetcher.js +64 -10
  363. package/node_modules/@maka/runtime/dist/model-history.js +291 -159
  364. package/node_modules/@maka/runtime/dist/model-projection-transition-ledger.js +207 -0
  365. package/node_modules/@maka/runtime/dist/model-runtime.js +87 -110
  366. package/node_modules/@maka/runtime/dist/native-web-search-tool.js +2 -1
  367. package/node_modules/@maka/runtime/dist/oauth-provider-contracts.js +28 -1
  368. package/node_modules/@maka/runtime/dist/openai-codex-history-compactor.js +28 -73
  369. package/node_modules/@maka/runtime/dist/openai-responses-websocket.js +2 -5
  370. package/node_modules/@maka/runtime/dist/opencode-session-header.js +31 -0
  371. package/node_modules/@maka/runtime/dist/pipe-tail-collector.js +6 -9
  372. package/node_modules/@maka/runtime/dist/plan-mode.js +0 -65
  373. package/node_modules/@maka/runtime/dist/plan-tools.js +0 -3
  374. package/node_modules/@maka/runtime/dist/plugin-agent-service.js +131 -0
  375. package/node_modules/@maka/runtime/dist/plugin-approval-service.js +33 -0
  376. package/node_modules/@maka/runtime/dist/plugin-attachment-service.js +53 -0
  377. package/node_modules/@maka/runtime/dist/plugin-command-service.js +100 -0
  378. package/node_modules/@maka/runtime/dist/plugin-composition-loader.js +184 -22
  379. package/node_modules/@maka/runtime/dist/plugin-data-services.js +332 -0
  380. package/node_modules/@maka/runtime/dist/plugin-fs-service.js +62 -0
  381. package/node_modules/@maka/runtime/dist/plugin-goal-service.js +61 -0
  382. package/node_modules/@maka/runtime/dist/plugin-invocation-signal.js +24 -0
  383. package/node_modules/@maka/runtime/dist/plugin-llm-service.js +85 -0
  384. package/node_modules/@maka/runtime/dist/plugin-lsp-service.js +94 -0
  385. package/node_modules/@maka/runtime/dist/plugin-runtime.js +239 -10
  386. package/node_modules/@maka/runtime/dist/plugin-scope-registry.js +91 -0
  387. package/node_modules/@maka/runtime/dist/plugin-session-query-service.js +71 -0
  388. package/node_modules/@maka/runtime/dist/plugin-shell-env-service.js +87 -0
  389. package/node_modules/@maka/runtime/dist/plugin-shell-service.js +74 -0
  390. package/node_modules/@maka/runtime/dist/plugin-skill-service.js +93 -0
  391. package/node_modules/@maka/runtime/dist/plugin-system-prompt-service.js +346 -0
  392. package/node_modules/@maka/runtime/dist/plugin-tool-service.js +171 -0
  393. package/node_modules/@maka/runtime/dist/plugin-user-question-service.js +43 -0
  394. package/node_modules/@maka/runtime/dist/plugin-web-service.js +69 -0
  395. package/node_modules/@maka/runtime/dist/prior-run-context.js +24 -94
  396. package/node_modules/@maka/runtime/dist/process-tree-terminator.js +2 -2
  397. package/node_modules/@maka/runtime/dist/prompt-composition.js +36 -31
  398. package/node_modules/@maka/runtime/dist/provider-error-classification.js +84 -123
  399. package/node_modules/@maka/runtime/dist/provider-image-overflow-recovery.js +12 -31
  400. package/node_modules/@maka/runtime/dist/provider-request-telemetry.js +172 -196
  401. package/node_modules/@maka/runtime/dist/quiescent-session-snapshot.js +78 -0
  402. package/node_modules/@maka/runtime/dist/read-page.js +231 -0
  403. package/node_modules/@maka/runtime/dist/recovery-resolver.js +18 -14
  404. package/node_modules/@maka/runtime/dist/request-customization-fetch.js +14 -7
  405. package/node_modules/@maka/runtime/dist/request-projection.js +2 -15
  406. package/node_modules/@maka/runtime/dist/request-shape.js +187 -365
  407. package/node_modules/@maka/runtime/dist/ripgrep-executable.js +62 -0
  408. package/node_modules/@maka/runtime/dist/ripgrep-guidance.js +81 -0
  409. package/node_modules/@maka/runtime/dist/run-handoff-gate.js +97 -0
  410. package/node_modules/@maka/runtime/dist/run-trace.js +2 -34
  411. package/node_modules/@maka/runtime/dist/runtime-continuation-admission.js +1 -1
  412. package/node_modules/@maka/runtime/dist/runtime-event-backfill.js +107 -65
  413. package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +415 -234
  414. package/node_modules/@maka/runtime/dist/runtime-kernel.js +518 -225
  415. package/node_modules/@maka/runtime/dist/runtime-ledger-repair.js +221 -448
  416. package/node_modules/@maka/runtime/dist/runtime-read-model.js +95 -198
  417. package/node_modules/@maka/runtime/dist/runtime-resume.js +162 -126
  418. package/node_modules/@maka/runtime/dist/sandbox/index.js +0 -1
  419. package/node_modules/@maka/runtime/dist/sandbox/linux-profile-path.js +7 -1
  420. package/node_modules/@maka/runtime/dist/sandbox/linux-sandbox.js +20 -17
  421. package/node_modules/@maka/runtime/dist/sandbox/macos-seatbelt.js +68 -21
  422. package/node_modules/@maka/runtime/dist/sandbox/sandbox-manager.js +0 -35
  423. package/node_modules/@maka/runtime/dist/sandbox/windows-sandbox.js +0 -12
  424. package/node_modules/@maka/runtime/dist/scheduled-task-tools.js +3 -0
  425. package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +62 -21
  426. package/node_modules/@maka/runtime/dist/session-export.js +178 -0
  427. package/node_modules/@maka/runtime/dist/session-import.js +100 -0
  428. package/node_modules/@maka/runtime/dist/session-manager.js +672 -861
  429. package/node_modules/@maka/runtime/dist/session-projection-helpers.js +16 -28
  430. package/node_modules/@maka/runtime/dist/session-recap.js +87 -15
  431. package/node_modules/@maka/runtime/dist/session-todo-tools.js +67 -0
  432. package/node_modules/@maka/runtime/dist/session-trace-projection.js +25 -30
  433. package/node_modules/@maka/runtime/dist/shell-detect.js +3 -7
  434. package/node_modules/@maka/runtime/dist/shell-exec.js +7 -25
  435. package/node_modules/@maka/runtime/dist/shell-run-contract.js +0 -1
  436. package/node_modules/@maka/runtime/dist/shell-run-manager.js +11 -46
  437. package/node_modules/@maka/runtime/dist/shell-run-tool-result.js +14 -7
  438. package/node_modules/@maka/runtime/dist/shell-tools.js +84 -14
  439. package/node_modules/@maka/runtime/dist/stream-graph-coordinator.js +64 -13
  440. package/node_modules/@maka/runtime/dist/stream-graph-handoff.js +6 -1
  441. package/node_modules/@maka/runtime/dist/stream-graph-projection.js +18 -15
  442. package/node_modules/@maka/runtime/dist/stream-graph-read-model.js +5 -0
  443. package/node_modules/@maka/runtime/dist/stream-graph-supervisor-tools.js +0 -8
  444. package/node_modules/@maka/runtime/dist/stream-usage-fallback-fetch.js +74 -0
  445. package/node_modules/@maka/runtime/dist/subagent-tools.js +2 -80
  446. package/node_modules/@maka/runtime/dist/subscription-credentials.js +51 -4
  447. package/node_modules/@maka/runtime/dist/subscription-model-fetch.js +51 -11
  448. package/node_modules/@maka/runtime/dist/system-prompt/main-session-prompt.js +21 -2
  449. package/node_modules/@maka/runtime/dist/system-prompt/workspace-instructions.js +11 -6
  450. package/node_modules/@maka/runtime/dist/tavily-search.js +8 -2
  451. package/node_modules/@maka/runtime/dist/telemetry/model-pricing.generated.js +93 -83
  452. package/node_modules/@maka/runtime/dist/terminal-run-commit.js +37 -172
  453. package/node_modules/@maka/runtime/dist/test-connection.js +36 -30
  454. package/node_modules/@maka/runtime/dist/text-line-window.js +49 -0
  455. package/node_modules/@maka/runtime/dist/tool-activation-identity.js +41 -0
  456. package/node_modules/@maka/runtime/dist/tool-availability.js +85 -8
  457. package/node_modules/@maka/runtime/dist/tool-output.js +36 -13
  458. package/node_modules/@maka/runtime/dist/tool-result-archive-capability.js +24 -36
  459. package/node_modules/@maka/runtime/dist/tool-result-archive-encoding.js +38 -0
  460. package/node_modules/@maka/runtime/dist/tool-result-archive-resource.js +93 -245
  461. package/node_modules/@maka/runtime/dist/tool-result-archive-transition.js +186 -0
  462. package/node_modules/@maka/runtime/dist/tool-result-archive.js +50 -173
  463. package/node_modules/@maka/runtime/dist/tool-runtime.js +380 -126
  464. package/node_modules/@maka/runtime/dist/unified-diff.js +40 -10
  465. package/node_modules/@maka/runtime/dist/web-fetch-tool.js +4 -2
  466. package/node_modules/@maka/runtime/dist/workers/filesystem-worker.js +12332 -4656
  467. package/node_modules/@maka/runtime/dist/workspace-executor.js +22 -30
  468. package/node_modules/@maka/runtime/node_modules/@ai-sdk/code-mode/LICENSE +13 -0
  469. package/node_modules/@maka/runtime/node_modules/@ai-sdk/code-mode/dist/run-code-mode.js +551 -0
  470. package/node_modules/@maka/runtime/node_modules/@ai-sdk/code-mode/package.json +78 -0
  471. package/node_modules/@maka/runtime/node_modules/@ai-sdk/gateway/CHANGELOG.md +3269 -0
  472. package/node_modules/@maka/runtime/node_modules/@ai-sdk/gateway/LICENSE +13 -0
  473. package/node_modules/@maka/runtime/node_modules/@ai-sdk/gateway/dist/index.js +3835 -0
  474. package/node_modules/@maka/runtime/node_modules/@ai-sdk/gateway/docs/00-ai-gateway.mdx +1610 -0
  475. package/node_modules/@maka/runtime/node_modules/@ai-sdk/gateway/package.json +80 -0
  476. package/node_modules/@maka/runtime/node_modules/@ai-sdk/provider/CHANGELOG.md +1262 -0
  477. package/node_modules/@maka/runtime/node_modules/@ai-sdk/provider/LICENSE +13 -0
  478. package/node_modules/@maka/runtime/node_modules/@ai-sdk/provider/README.md +1 -0
  479. package/node_modules/@maka/runtime/node_modules/@ai-sdk/provider/dist/index.js +426 -0
  480. package/node_modules/@maka/runtime/node_modules/@ai-sdk/provider/package.json +63 -0
  481. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/README.md +44 -8
  482. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/dist/package.json +4 -4
  483. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.js +39 -3
  484. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/dist/src/SocketModeClient.js +4 -0
  485. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/package.json +4 -4
  486. package/node_modules/@maka/runtime/node_modules/ai/CHANGELOG.md +10271 -0
  487. package/node_modules/@maka/runtime/node_modules/ai/LICENSE +13 -0
  488. package/node_modules/@maka/runtime/node_modules/ai/dist/index.js +20146 -0
  489. package/node_modules/@maka/runtime/node_modules/ai/dist/internal/index.js +3690 -0
  490. package/node_modules/@maka/runtime/node_modules/ai/docs/02-foundations/02-providers-and-models.mdx +185 -0
  491. package/node_modules/@maka/runtime/node_modules/ai/docs/03-agents/04-loop-control.mdx +517 -0
  492. package/node_modules/@maka/runtime/node_modules/ai/docs/03-agents/06-policy-tool-approvals.mdx +413 -0
  493. package/node_modules/@maka/runtime/node_modules/ai/docs/03-agents/06-tool-approvals.mdx +338 -0
  494. package/node_modules/@maka/runtime/node_modules/ai/docs/03-agents/07-workflow-agent.mdx +815 -0
  495. package/node_modules/@maka/runtime/node_modules/ai/docs/03-ai-sdk-core/10-generating-structured-data.mdx +525 -0
  496. package/node_modules/@maka/runtime/node_modules/ai/docs/03-ai-sdk-core/15-tools-and-tool-calling.mdx +1512 -0
  497. package/node_modules/@maka/runtime/node_modules/ai/docs/03-ai-sdk-core/16-mcp-tools.mdx +680 -0
  498. package/node_modules/@maka/runtime/node_modules/ai/docs/03-ai-sdk-core/35-image-generation.mdx +371 -0
  499. package/node_modules/@maka/runtime/node_modules/ai/docs/03-ai-sdk-core/36-transcription.mdx +333 -0
  500. package/node_modules/@maka/runtime/node_modules/ai/docs/03-ai-sdk-core/37-speech.mdx +163 -0
  501. package/node_modules/@maka/runtime/node_modules/ai/docs/03-ai-sdk-core/39-file-uploads.mdx +180 -0
  502. package/node_modules/@maka/runtime/node_modules/ai/docs/03-ai-sdk-core/42-batch.mdx +372 -0
  503. package/node_modules/@maka/runtime/node_modules/ai/docs/03-ai-sdk-core/50-error-handling.mdx +241 -0
  504. package/node_modules/@maka/runtime/node_modules/ai/docs/03-ai-sdk-core/60-telemetry.mdx +855 -0
  505. package/node_modules/@maka/runtime/node_modules/ai/docs/03-ai-sdk-core/index.mdx +137 -0
  506. package/node_modules/@maka/runtime/node_modules/ai/docs/03-ai-sdk-harnesses/02-harness-agent.mdx +683 -0
  507. package/node_modules/@maka/runtime/node_modules/ai/docs/03-ai-sdk-harnesses/04-skills.mdx +69 -0
  508. package/node_modules/@maka/runtime/node_modules/ai/docs/03-ai-sdk-harnesses/05-harness-adapters.mdx +47 -0
  509. package/node_modules/@maka/runtime/node_modules/ai/docs/04-ai-sdk-ui/03-chatbot-tool-usage.mdx +826 -0
  510. package/node_modules/@maka/runtime/node_modules/ai/docs/04-ai-sdk-ui/20-streaming-data.mdx +406 -0
  511. package/node_modules/@maka/runtime/node_modules/ai/docs/04-ai-sdk-ui/21-transport.mdx +216 -0
  512. package/node_modules/@maka/runtime/node_modules/ai/docs/04-ai-sdk-ui/50-stream-protocol.mdx +582 -0
  513. package/node_modules/@maka/runtime/node_modules/ai/docs/06-advanced/04-caching.mdx +182 -0
  514. package/node_modules/@maka/runtime/node_modules/ai/docs/06-advanced/11-secure-url-fetching.mdx +117 -0
  515. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/01-ai-sdk-core/01-generate-text.mdx +3267 -0
  516. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx +4303 -0
  517. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/01-ai-sdk-core/05-embed.mdx +330 -0
  518. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/01-ai-sdk-core/06-embed-many.mdx +332 -0
  519. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/01-ai-sdk-core/06-rerank.mdx +331 -0
  520. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/01-ai-sdk-core/10-generate-image.mdx +253 -0
  521. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/01-ai-sdk-core/14-upload-file.mdx +125 -0
  522. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/01-ai-sdk-core/16-tool-loop-agent.mdx +1102 -0
  523. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/01-ai-sdk-core/20-start-batch.mdx +154 -0
  524. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/01-ai-sdk-core/21-get-batch-status.mdx +133 -0
  525. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/01-ai-sdk-core/22-get-batch-results.mdx +109 -0
  526. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/01-ai-sdk-core/23-cancel-batch.mdx +96 -0
  527. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/01-ai-sdk-core/24-list-batches.mdx +121 -0
  528. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/01-ai-sdk-core/28-output.mdx +368 -0
  529. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/01-ai-sdk-core/31-ui-message.mdx +331 -0
  530. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/01-ai-sdk-core/80-smooth-stream.mdx +147 -0
  531. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/01-ai-sdk-core/index.mdx +250 -0
  532. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/02-ai-sdk-ui/01-use-chat.mdx +493 -0
  533. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/02-ai-sdk-ui/31-convert-to-model-messages.mdx +256 -0
  534. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/02-ai-sdk-ui/40-create-ui-message-stream.mdx +199 -0
  535. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/02-ai-sdk-ui/41-create-ui-message-stream-response.mdx +125 -0
  536. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/04-ai-sdk-workflow/01-workflow-agent.mdx +1035 -0
  537. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/04-ai-sdk-workflow/02-workflow-chat-transport.mdx +361 -0
  538. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/04-ai-sdk-workflow/03-generate-video.mdx +157 -0
  539. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/04-ai-sdk-workflow/index.mdx +32 -0
  540. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/05-ai-sdk-errors/ai-invalid-argument-error.mdx +31 -0
  541. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/05-ai-sdk-errors/ai-no-image-generated-error.mdx +43 -0
  542. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/05-ai-sdk-errors/ai-stream-provider-error.mdx +52 -0
  543. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/05-ai-sdk-errors/ai-tool-choice-violation-error.mdx +38 -0
  544. package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/05-ai-sdk-errors/index.mdx +43 -0
  545. package/node_modules/@maka/runtime/node_modules/ai/package.json +127 -0
  546. package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Client.md +4 -0
  547. package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +3 -2
  548. package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/EventSource.md +4 -0
  549. package/node_modules/@maka/runtime/node_modules/undici/lib/cache/memory-cache-store.js +1 -1
  550. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/agent.js +7 -2
  551. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/balanced-pool.js +1 -1
  552. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client-h1.js +12 -4
  553. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client-h2.js +43 -3
  554. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client.js +3 -2
  555. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/dispatcher-base.js +13 -1
  556. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/dispatcher.js +10 -0
  557. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +10 -3
  558. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/proxy-agent.js +1 -1
  559. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/round-robin-pool.js +1 -1
  560. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +3 -1
  561. package/node_modules/@maka/runtime/node_modules/undici/lib/handler/cache-handler.js +8 -0
  562. package/node_modules/@maka/runtime/node_modules/undici/lib/handler/decorator-handler.js +7 -1
  563. package/node_modules/@maka/runtime/node_modules/undici/lib/handler/deduplication-handler.js +12 -6
  564. package/node_modules/@maka/runtime/node_modules/undici/lib/handler/redirect-handler.js +8 -0
  565. package/node_modules/@maka/runtime/node_modules/undici/lib/handler/retry-handler.js +83 -11
  566. package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/dump.js +1 -1
  567. package/node_modules/@maka/runtime/node_modules/undici/lib/mock/mock-agent.js +13 -1
  568. package/node_modules/@maka/runtime/node_modules/undici/lib/mock/mock-utils.js +11 -10
  569. package/node_modules/@maka/runtime/node_modules/undici/lib/web/cookies/parse.js +4 -2
  570. package/node_modules/@maka/runtime/node_modules/undici/lib/web/eventsource/eventsource-stream.js +28 -1
  571. package/node_modules/@maka/runtime/node_modules/undici/lib/web/eventsource/eventsource.js +4 -1
  572. package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/request.js +2 -3
  573. package/node_modules/@maka/runtime/node_modules/undici/package.json +3 -3
  574. package/node_modules/@maka/runtime/package.json +41 -15
  575. package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +75 -38
  576. package/node_modules/@maka/runtime-host/dist/candidate-entry.js +10 -2
  577. package/node_modules/@maka/runtime-host/dist/candidate-launch-owner-guard.js +13 -0
  578. package/node_modules/@maka/runtime-host/dist/client/catalog-reader.js +64 -25
  579. package/node_modules/@maka/runtime-host/dist/client/client-capability-channel.js +87 -3
  580. package/node_modules/@maka/runtime-host/dist/client/connect-or-spawn.js +13 -2
  581. package/node_modules/@maka/runtime-host/dist/client/connection.js +144 -51
  582. package/node_modules/@maka/runtime-host/dist/client/host-handoff-copy.js +238 -0
  583. package/node_modules/@maka/runtime-host/dist/client/host-handoff.js +309 -0
  584. package/node_modules/@maka/runtime-host/dist/client/host-profile.js +483 -94
  585. package/node_modules/@maka/runtime-host/dist/client/host-retirement.js +28 -5
  586. package/node_modules/@maka/runtime-host/dist/client/index.js +12 -8
  587. package/node_modules/@maka/runtime-host/dist/client/launcher.js +12 -3
  588. package/node_modules/@maka/runtime-host/dist/client/oauth-presentation.js +1 -1
  589. package/node_modules/@maka/runtime-host/dist/client/owner-connection-code.js +38 -4
  590. package/node_modules/@maka/runtime-host/dist/client/peer-client.js +408 -25
  591. package/node_modules/@maka/runtime-host/dist/client/process-identity.js +73 -0
  592. package/node_modules/@maka/runtime-host/dist/client/reconnect-lifecycle.js +72 -7
  593. package/node_modules/@maka/runtime-host/dist/client/reconnecting-connection.js +11 -0
  594. package/node_modules/@maka/runtime-host/dist/client/registered-host-termination.js +107 -0
  595. package/node_modules/@maka/runtime-host/dist/client/remote-compatibility-error.js +2 -0
  596. package/node_modules/@maka/runtime-host/dist/client/session-subscription.js +46 -5
  597. package/node_modules/@maka/runtime-host/dist/client/ssh-operator-activation.js +48 -11
  598. package/node_modules/@maka/runtime-host/dist/client/wsl-control.js +0 -8
  599. package/node_modules/@maka/runtime-host/dist/client/wsl-environment.js +12 -8
  600. package/node_modules/@maka/runtime-host/dist/client-capability-entity-id.js +27 -0
  601. package/node_modules/@maka/runtime-host/dist/control/endpoint.js +1 -3
  602. package/node_modules/@maka/runtime-host/dist/node-error.js +22 -0
  603. package/node_modules/@maka/runtime-host/dist/operator/access-management-frame.js +10 -1
  604. package/node_modules/@maka/runtime-host/dist/operator/index.js +5 -2
  605. package/node_modules/@maka/runtime-host/dist/operator/managed-deployment.js +17 -8
  606. package/node_modules/@maka/runtime-host/dist/operator/operator-command.js +110 -0
  607. package/node_modules/@maka/runtime-host/dist/operator/peer-management-frame.js +2 -0
  608. package/node_modules/@maka/runtime-host/dist/operator/peer-mesh-management-frame.js +14 -0
  609. package/node_modules/@maka/runtime-host/dist/operator/retirement-cancellation.js +20 -0
  610. package/node_modules/@maka/runtime-host/dist/operator/service-management-frame.js +5 -6
  611. package/node_modules/@maka/runtime-host/dist/operator/setup-frame.js +32 -6
  612. package/node_modules/@maka/runtime-host/dist/peer-mesh/display-name.js +30 -0
  613. package/node_modules/@maka/runtime-host/dist/peer-mesh/index.js +3 -3
  614. package/node_modules/@maka/runtime-host/dist/peer-mesh/limits.js +1 -2
  615. package/node_modules/@maka/runtime-host/dist/peer-mesh/model.js +72 -73
  616. package/node_modules/@maka/runtime-host/dist/peer-mesh/node.js +1334 -418
  617. package/node_modules/@maka/runtime-host/dist/peer-mesh/owner.js +33 -68
  618. package/node_modules/@maka/runtime-host/dist/peer-mesh/store.js +147 -52
  619. package/node_modules/@maka/runtime-host/dist/peer-reachability/index.js +21 -0
  620. package/node_modules/@maka/runtime-host/dist/peer-reachability/model.js +202 -0
  621. package/node_modules/@maka/runtime-host/dist/peer-reachability/owner.js +118 -0
  622. package/node_modules/@maka/runtime-host/dist/peer-reachability/publisher.js +243 -0
  623. package/node_modules/@maka/runtime-host/dist/protocol/agent-graph.js +4 -1
  624. package/node_modules/@maka/runtime-host/dist/protocol/artifact.js +11 -20
  625. package/node_modules/@maka/runtime-host/dist/protocol/client-capability.js +233 -41
  626. package/node_modules/@maka/runtime-host/dist/protocol/configuration.js +55 -9
  627. package/node_modules/@maka/runtime-host/dist/protocol/connection-catalog-change.js +26 -0
  628. package/node_modules/@maka/runtime-host/dist/protocol/connection-effects.js +15 -8
  629. package/node_modules/@maka/runtime-host/dist/protocol/external-agent-setup.js +149 -0
  630. package/node_modules/@maka/runtime-host/dist/protocol/external-session.js +4 -0
  631. package/node_modules/@maka/runtime-host/dist/protocol/host-resources.js +253 -0
  632. package/node_modules/@maka/runtime-host/dist/protocol/host-status.js +49 -11
  633. package/node_modules/@maka/runtime-host/dist/protocol/index.js +206 -2
  634. package/node_modules/@maka/runtime-host/dist/protocol/message.js +14 -9
  635. package/node_modules/@maka/runtime-host/dist/protocol/network-proxy.js +1 -7
  636. package/node_modules/@maka/runtime-host/dist/protocol/oauth.js +104 -8
  637. package/node_modules/@maka/runtime-host/dist/protocol/operations.js +22 -5
  638. package/node_modules/@maka/runtime-host/dist/protocol/peer-mesh.js +72 -32
  639. package/node_modules/@maka/runtime-host/dist/protocol/plan.js +1 -0
  640. package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +559 -0
  641. package/node_modules/@maka/runtime-host/dist/protocol/project-catalog.js +2 -2
  642. package/node_modules/@maka/runtime-host/dist/protocol/runtime-policy.js +81 -26
  643. package/node_modules/@maka/runtime-host/dist/protocol/scheduled-task.js +19 -6
  644. package/node_modules/@maka/runtime-host/dist/protocol/session-bundle.js +100 -0
  645. package/node_modules/@maka/runtime-host/dist/protocol/session-catalog.js +1 -1
  646. package/node_modules/@maka/runtime-host/dist/protocol/session-collaboration.js +68 -4
  647. package/node_modules/@maka/runtime-host/dist/protocol/session-continuity.js +44 -23
  648. package/node_modules/@maka/runtime-host/dist/protocol/session-retirement.js +30 -3
  649. package/node_modules/@maka/runtime-host/dist/protocol/session-revision.js +11 -2
  650. package/node_modules/@maka/runtime-host/dist/protocol/session-todo.js +53 -0
  651. package/node_modules/@maka/runtime-host/dist/protocol/session-transcript.js +3 -7
  652. package/node_modules/@maka/runtime-host/dist/protocol/session-turns.js +29 -58
  653. package/node_modules/@maka/runtime-host/dist/protocol/skill-catalog.js +2 -1
  654. package/node_modules/@maka/runtime-host/dist/protocol/turn.js +25 -14
  655. package/node_modules/@maka/runtime-host/dist/protocol/usage-pricing.js +20 -2
  656. package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +212 -75
  657. package/node_modules/@maka/runtime-host/dist/server/access-authority.js +87 -22
  658. package/node_modules/@maka/runtime-host/dist/server/access-credential-metadata.js +4 -2
  659. package/node_modules/@maka/runtime-host/dist/server/access-credential-store.js +135 -48
  660. package/node_modules/@maka/runtime-host/dist/server/acp/antigravity-install.js +242 -0
  661. package/node_modules/@maka/runtime-host/dist/server/acp/antigravity.js +154 -0
  662. package/node_modules/@maka/runtime-host/dist/server/acp/connection.js +116 -0
  663. package/node_modules/@maka/runtime-host/dist/server/agent-graph-coordinator.js +0 -3
  664. package/node_modules/@maka/runtime-host/dist/server/agent-graph-execution-coordinator.js +1 -2
  665. package/node_modules/@maka/runtime-host/dist/server/artifact-coordinator.js +19 -22
  666. package/node_modules/@maka/runtime-host/dist/server/bootstrap-runtime-policy.js +10 -4
  667. package/node_modules/@maka/runtime-host/dist/server/candidate.js +3 -0
  668. package/node_modules/@maka/runtime-host/dist/server/canonical-session-projection.js +2 -1
  669. package/node_modules/@maka/runtime-host/dist/server/canonical-turn-snapshot.js +34 -24
  670. package/node_modules/@maka/runtime-host/dist/server/canonical-usage-reader.js +24 -11
  671. package/node_modules/@maka/runtime-host/dist/server/child-agent-composition.js +1 -1
  672. package/node_modules/@maka/runtime-host/dist/server/client-capability-coordinator.js +282 -30
  673. package/node_modules/@maka/runtime-host/dist/server/client-capability-invocation-broker.js +258 -51
  674. package/node_modules/@maka/runtime-host/dist/server/client-capability-provider-id.js +31 -0
  675. package/node_modules/@maka/runtime-host/dist/server/client-capability-recovery.js +10 -7
  676. package/node_modules/@maka/runtime-host/dist/server/configuration-coordinator.js +20 -1
  677. package/node_modules/@maka/runtime-host/dist/server/connection-effect-coordinator.js +43 -18
  678. package/node_modules/@maka/runtime-host/dist/server/connection-session.js +45 -14
  679. package/node_modules/@maka/runtime-host/dist/server/daily-review-coordinator.js +164 -82
  680. package/node_modules/@maka/runtime-host/dist/server/deep-research-coordinator.js +1 -1
  681. package/node_modules/@maka/runtime-host/dist/server/execution-artifacts.js +59 -36
  682. package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +1076 -176
  683. package/node_modules/@maka/runtime-host/dist/server/execution-inspect-coordinator.js +35 -29
  684. package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +112 -18
  685. package/node_modules/@maka/runtime-host/dist/server/execution-model-composition.js +85 -73
  686. package/node_modules/@maka/runtime-host/dist/server/execution-service.js +49 -24
  687. package/node_modules/@maka/runtime-host/dist/server/extension-bundle.js +249 -0
  688. package/node_modules/@maka/runtime-host/dist/server/extension-package-manifest.js +262 -0
  689. package/node_modules/@maka/runtime-host/dist/server/external-agent-setup-coordinator.js +190 -0
  690. package/node_modules/@maka/runtime-host/dist/server/external-session-coordinator.js +13 -10
  691. package/node_modules/@maka/runtime-host/dist/server/failure-diagnostic.js +24 -0
  692. package/node_modules/@maka/runtime-host/dist/server/goal-coordinator.js +134 -35
  693. package/node_modules/@maka/runtime-host/dist/server/host-change-feed.js +11 -0
  694. package/node_modules/@maka/runtime-host/dist/server/host-kernel.js +163 -27
  695. package/node_modules/@maka/runtime-host/dist/server/host-residency-registry.js +41 -20
  696. package/node_modules/@maka/runtime-host/dist/server/host-resource-collector.js +223 -0
  697. package/node_modules/@maka/runtime-host/dist/server/host-resource-probe-main.js +44 -0
  698. package/node_modules/@maka/runtime-host/dist/server/host-resource-probe.js +83 -0
  699. package/node_modules/@maka/runtime-host/dist/server/host-session-availability.js +5 -2
  700. package/node_modules/@maka/runtime-host/dist/server/hosted-execution-admission-registry.js +3 -1
  701. package/node_modules/@maka/runtime-host/dist/server/hosted-execution-projection.js +12 -7
  702. package/node_modules/@maka/runtime-host/dist/server/hosted-execution-recovery.js +131 -69
  703. package/node_modules/@maka/runtime-host/dist/server/hosted-execution-tool-profile.js +64 -4
  704. package/node_modules/@maka/runtime-host/dist/server/index.js +5 -0
  705. package/node_modules/@maka/runtime-host/dist/server/interaction-coordinator.js +370 -34
  706. package/node_modules/@maka/runtime-host/dist/server/interaction-projection.js +36 -1
  707. package/node_modules/@maka/runtime-host/dist/server/interactive-run-composer.js +173 -109
  708. package/node_modules/@maka/runtime-host/dist/server/json-array-page-budget.js +48 -0
  709. package/node_modules/@maka/runtime-host/dist/server/listener-set.js +6 -4
  710. package/node_modules/@maka/runtime-host/dist/server/memory-projection.js +14 -15
  711. package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +339 -66
  712. package/node_modules/@maka/runtime-host/dist/server/model-metadata-refresh.js +96 -0
  713. package/node_modules/@maka/runtime-host/dist/server/network-proxy-coordinator.js +0 -1
  714. package/node_modules/@maka/runtime-host/dist/server/oauth-coordinator.js +169 -45
  715. package/node_modules/@maka/runtime-host/dist/server/oauth-execution-authority.js +20 -3
  716. package/node_modules/@maka/runtime-host/dist/server/operation-dispatcher.js +47 -125
  717. package/node_modules/@maka/runtime-host/dist/server/peer-listener.js +131 -48
  718. package/node_modules/@maka/runtime-host/dist/server/peer-mesh-authority.js +20 -1
  719. package/node_modules/@maka/runtime-host/dist/server/plan-coordinator.js +11 -5
  720. package/node_modules/@maka/runtime-host/dist/server/plugin-composition-patch.js +58 -0
  721. package/node_modules/@maka/runtime-host/dist/server/plugin-composition-store.js +141 -0
  722. package/node_modules/@maka/runtime-host/dist/server/plugin-data-runtime.js +234 -0
  723. package/node_modules/@maka/runtime-host/dist/server/plugin-package-loader.js +130 -0
  724. package/node_modules/@maka/runtime-host/dist/server/plugin-package-store.js +528 -0
  725. package/node_modules/@maka/runtime-host/dist/server/plugin-platform-coordinator.js +263 -0
  726. package/node_modules/@maka/runtime-host/dist/server/plugin-platform.js +1148 -0
  727. package/node_modules/@maka/runtime-host/dist/server/project-catalog-coordinator.js +10 -12
  728. package/node_modules/@maka/runtime-host/dist/server/project-directory-authority.js +4 -3
  729. package/node_modules/@maka/runtime-host/dist/server/root-admission-owner.js +32 -7
  730. package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +690 -188
  731. package/node_modules/@maka/runtime-host/dist/server/runtime-policy-coordinator.js +72 -18
  732. package/node_modules/@maka/runtime-host/dist/server/runtime-resource-coordinator.js +11 -8
  733. package/node_modules/@maka/runtime-host/dist/server/runtime-resource-projection.js +12 -18
  734. package/node_modules/@maka/runtime-host/dist/server/scheduled-task-coordinator.js +150 -41
  735. package/node_modules/@maka/runtime-host/dist/server/serial-outbound-writer.js +46 -4
  736. package/node_modules/@maka/runtime-host/dist/server/session-admission-gate.js +21 -1
  737. package/node_modules/@maka/runtime-host/dist/server/session-bundle-coordinator.js +163 -0
  738. package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +247 -33
  739. package/node_modules/@maka/runtime-host/dist/server/session-continuity-coordinator.js +112 -48
  740. package/node_modules/@maka/runtime-host/dist/server/session-effect-coordinator.js +1 -1
  741. package/node_modules/@maka/runtime-host/dist/server/session-retirement-coordinator.js +66 -14
  742. package/node_modules/@maka/runtime-host/dist/server/session-revision-coordinator.js +113 -67
  743. package/node_modules/@maka/runtime-host/dist/server/session-revision-graph-references.js +18 -10
  744. package/node_modules/@maka/runtime-host/dist/server/session-sidecar-purge.js +2 -1
  745. package/node_modules/@maka/runtime-host/dist/server/session-todo-coordinator.js +77 -0
  746. package/node_modules/@maka/runtime-host/dist/server/session-transcript-pager.js +34 -5
  747. package/node_modules/@maka/runtime-host/dist/server/session-transcript-reader.js +404 -87
  748. package/node_modules/@maka/runtime-host/dist/server/session-turn-access-request-coordinator.js +43 -26
  749. package/node_modules/@maka/runtime-host/dist/server/shared-session-transcript.js +4 -1
  750. package/node_modules/@maka/runtime-host/dist/server/skill-catalog-coordinator.js +18 -2
  751. package/node_modules/@maka/runtime-host/dist/server/skill-catalog-repository.js +16 -17
  752. package/node_modules/@maka/runtime-host/dist/server/storage-maintenance.js +109 -0
  753. package/node_modules/@maka/runtime-host/dist/server/usage-pricing-coordinator.js +79 -35
  754. package/node_modules/@maka/runtime-host/dist/server/web-fetch-tool.js +1 -1
  755. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-action-gate.js +566 -37
  756. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +590 -131
  757. package/node_modules/@maka/runtime-host/dist/server/workhub-message-attachments.js +46 -0
  758. package/node_modules/@maka/runtime-host/dist/transport/framed-byte-stream-transport.js +4 -1
  759. package/node_modules/@maka/runtime-host/dist/transport/local-ipc-framing.js +4 -2
  760. package/node_modules/@maka/runtime-host/dist/transport/peer-native.js +112 -24
  761. package/node_modules/@maka/runtime-host/dist/transport/resumable-peer-stream.js +469 -0
  762. package/node_modules/@maka/runtime-host/dist/webrtc-stun-policy.js +114 -0
  763. package/node_modules/@maka/runtime-host/package.json +7 -1
  764. package/node_modules/@maka/storage/dist/agent-run-store.js +355 -238
  765. package/node_modules/@maka/storage/dist/artifact-attachments.js +66 -18
  766. package/node_modules/@maka/storage/dist/artifact-metadata-codec.js +24 -28
  767. package/node_modules/@maka/storage/dist/artifact-store.js +203 -767
  768. package/node_modules/@maka/storage/dist/artifact-stores.js +6 -10
  769. package/node_modules/@maka/storage/dist/artifact-writer-lock.js +1 -1
  770. package/node_modules/@maka/storage/dist/atomic-file-write.js +74 -0
  771. package/node_modules/@maka/storage/dist/claude-code-session-adapter.js +0 -5
  772. package/node_modules/@maka/storage/dist/codex-session-adapter.js +298 -198
  773. package/node_modules/@maka/storage/dist/context-offload-snapshot.js +397 -0
  774. package/node_modules/@maka/storage/dist/context-value-mutation-gate.js +59 -0
  775. package/node_modules/@maka/storage/dist/conversation-operational-state.js +7 -0
  776. package/node_modules/@maka/storage/dist/credential-store.js +15 -63
  777. package/node_modules/@maka/storage/dist/execution-record-codec.js +1 -22
  778. package/node_modules/@maka/storage/dist/execution-stores.js +38 -21
  779. package/node_modules/@maka/storage/dist/file-lifetime-owner.js +30 -2
  780. package/node_modules/@maka/storage/dist/file-session-repository.js +1012 -0
  781. package/node_modules/@maka/storage/dist/git-exec.js +61 -0
  782. package/node_modules/@maka/storage/dist/git-worktree-child-executor.js +8 -35
  783. package/node_modules/@maka/storage/dist/goal-authority.js +2 -2
  784. package/node_modules/@maka/storage/dist/interaction-store-public.js +1 -1
  785. package/node_modules/@maka/storage/dist/interaction-store.js +188 -3
  786. package/node_modules/@maka/storage/dist/legacy-run-header.js +327 -0
  787. package/node_modules/@maka/storage/dist/mcp-config-store.js +10 -25
  788. package/node_modules/@maka/storage/dist/message-admission-store.js +3 -0
  789. package/node_modules/@maka/storage/dist/model-call-ledger.js +199 -32
  790. package/node_modules/@maka/storage/dist/model-call-usage-sql.js +136 -0
  791. package/node_modules/@maka/storage/dist/model-facts-store.js +56 -0
  792. package/node_modules/@maka/storage/dist/opencode-session-adapter.js +0 -4
  793. package/node_modules/@maka/storage/dist/operational-state-backup.js +15 -11
  794. package/node_modules/@maka/storage/dist/operational-state-store-public.js +1 -1
  795. package/node_modules/@maka/storage/dist/operational-state-store.js +27 -2
  796. package/node_modules/@maka/storage/dist/production-session-snapshot.js +761 -0
  797. package/node_modules/@maka/storage/dist/project-catalog.js +8 -23
  798. package/node_modules/@maka/storage/dist/quiescent-session-snapshot.js +1154 -0
  799. package/node_modules/@maka/storage/dist/runtime-event-invariants.js +2 -2
  800. package/node_modules/@maka/storage/dist/runtime-event-persistence.js +6 -0
  801. package/node_modules/@maka/storage/dist/runtime-policy/connection-catalog-document.js +182 -62
  802. package/node_modules/@maka/storage/dist/runtime-policy/coordinator.js +540 -117
  803. package/node_modules/@maka/storage/dist/runtime-policy/document-io.js +22 -16
  804. package/node_modules/@maka/storage/dist/runtime-policy/oauth-login-receipt-document.js +207 -0
  805. package/node_modules/@maka/storage/dist/runtime-policy/onboarding-transaction.js +148 -5
  806. package/node_modules/@maka/storage/dist/runtime-policy/policy-document.js +10 -4
  807. package/node_modules/@maka/storage/dist/runtime-policy-stores.js +7 -3
  808. package/node_modules/@maka/storage/dist/runtime-transcript-query.js +321 -0
  809. package/node_modules/@maka/storage/dist/scheduled-task-store.js +256 -283
  810. package/node_modules/@maka/storage/dist/session-bundle-manifest.js +5 -17
  811. package/node_modules/@maka/storage/dist/session-bundle-policy.js +1031 -34
  812. package/node_modules/@maka/storage/dist/session-bundle-ustar.js +12 -0
  813. package/node_modules/@maka/storage/dist/session-copy-cleanup.js +12 -7
  814. package/node_modules/@maka/storage/dist/session-message-projection.js +24 -5
  815. package/node_modules/@maka/storage/dist/session-repository.js +767 -0
  816. package/node_modules/@maka/storage/dist/session-store.js +110 -115
  817. package/node_modules/@maka/storage/dist/session-todo-authority.js +106 -0
  818. package/node_modules/@maka/storage/dist/session-todo-store.js +169 -0
  819. package/node_modules/@maka/storage/dist/settings-store.js +24 -29
  820. package/node_modules/@maka/storage/dist/sqlite-artifact-metadata.js +51 -17
  821. package/node_modules/@maka/storage/dist/sqlite-artifact-schema.js +55 -5
  822. package/node_modules/@maka/storage/dist/sqlite-context-offload-store.js +42 -12
  823. package/node_modules/@maka/storage/dist/sqlite-core-execution-schema.js +45 -2
  824. package/node_modules/@maka/storage/dist/sqlite-runtime-schema.js +367 -1
  825. package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +439 -82
  826. package/node_modules/@maka/storage/dist/sqlite-session-metadata-schema.js +63 -5
  827. package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +493 -914
  828. package/node_modules/@maka/storage/dist/sqlite-usage-schema.js +200 -20
  829. package/node_modules/@maka/storage/dist/sqlite-usage-store.js +29 -6
  830. package/node_modules/@maka/storage/dist/sqlite-workflow-schema.js +5 -8
  831. package/node_modules/@maka/storage/dist/stable-storage.js +16 -2
  832. package/node_modules/@maka/storage/dist/storage-id.js +28 -0
  833. package/node_modules/@maka/storage/dist/storage-writer-composition.js +3 -3
  834. package/node_modules/@maka/storage/dist/tool-result-archive-evidence.js +138 -0
  835. package/node_modules/@maka/storage/dist/usage-stores.js +9 -3
  836. package/node_modules/@maka/storage/dist/work-board-store.js +4 -4
  837. package/node_modules/@maka/storage/dist/workspace-identity.js +2 -15
  838. package/node_modules/@maka/storage/dist/workspace-version-authority-internal.js +1 -8
  839. package/node_modules/@maka/storage/package.json +8 -2
  840. package/node_modules/@modelcontextprotocol/client/dist/src-D_zzAWoS.mjs +22 -5
  841. package/node_modules/@modelcontextprotocol/client/dist/src-NAgB4Mp8.cjs +22 -5
  842. package/node_modules/@slack/types/dist/events/agent.js +3 -0
  843. package/node_modules/@slack/types/dist/events/index.js +44 -0
  844. package/node_modules/@slack/types/package.json +47 -0
  845. package/node_modules/@slack/web-api/README.md +382 -0
  846. package/node_modules/@slack/web-api/dist/methods.js +1636 -0
  847. package/node_modules/@slack/web-api/dist/types/request/agents.js +3 -0
  848. package/node_modules/@slack/web-api/dist/types/request/blocks.js +3 -0
  849. package/node_modules/@slack/web-api/dist/types/response/AdminUsersGetExpirationResponse.js +11 -0
  850. package/node_modules/@slack/web-api/dist/types/response/AgentsSessionsRenameResponse.js +11 -0
  851. package/node_modules/@slack/web-api/dist/types/response/AgentsSessionsSetStatusResponse.js +11 -0
  852. package/node_modules/@slack/web-api/dist/types/response/BlocksValidateResponse.js +11 -0
  853. package/node_modules/@slack/web-api/dist/types/response/ChatAppendStreamResponse.js +11 -0
  854. package/node_modules/@slack/web-api/dist/types/response/ChatStartStreamResponse.js +11 -0
  855. package/node_modules/@slack/web-api/dist/types/response/ChatStopStreamResponse.js +48 -0
  856. package/node_modules/@slack/web-api/dist/types/response/PinsListResponse.js +67 -0
  857. package/node_modules/@slack/web-api/dist/types/response/SearchAllResponse.js +72 -0
  858. package/node_modules/@slack/web-api/dist/types/response/SearchFilesResponse.js +48 -0
  859. package/node_modules/@slack/web-api/dist/types/response/SlackListsAccessDeleteResponse.js +11 -0
  860. package/node_modules/@slack/web-api/dist/types/response/SlackListsAccessSetResponse.js +11 -0
  861. package/node_modules/@slack/web-api/dist/types/response/SlackListsCreateResponse.js +11 -0
  862. package/node_modules/@slack/web-api/dist/types/response/SlackListsDownloadGetResponse.js +11 -0
  863. package/node_modules/@slack/web-api/dist/types/response/SlackListsDownloadStartResponse.js +11 -0
  864. package/node_modules/@slack/web-api/dist/types/response/SlackListsItemsCreateResponse.js +11 -0
  865. package/node_modules/@slack/web-api/dist/types/response/SlackListsItemsDeleteMultipleResponse.js +11 -0
  866. package/node_modules/@slack/web-api/dist/types/response/SlackListsItemsDeleteResponse.js +11 -0
  867. package/node_modules/@slack/web-api/dist/types/response/SlackListsItemsInfoResponse.js +11 -0
  868. package/node_modules/@slack/web-api/dist/types/response/SlackListsItemsListResponse.js +11 -0
  869. package/node_modules/@slack/web-api/dist/types/response/SlackListsItemsUpdateResponse.js +11 -0
  870. package/node_modules/@slack/web-api/dist/types/response/SlackListsUpdateResponse.js +11 -0
  871. package/node_modules/@slack/web-api/dist/types/response/WorkflowsFeaturedAddResponse.js +11 -0
  872. package/node_modules/@slack/web-api/dist/types/response/WorkflowsFeaturedListResponse.js +11 -0
  873. package/node_modules/@slack/web-api/dist/types/response/WorkflowsFeaturedRemoveResponse.js +11 -0
  874. package/node_modules/@slack/web-api/dist/types/response/WorkflowsFeaturedSetResponse.js +11 -0
  875. package/node_modules/@slack/web-api/node_modules/@types/retry/LICENSE +21 -0
  876. package/node_modules/@slack/web-api/node_modules/@types/retry/README.md +15 -0
  877. package/node_modules/@slack/web-api/node_modules/@types/retry/package.json +30 -0
  878. package/node_modules/@slack/web-api/package.json +71 -0
  879. package/node_modules/@types/node/README.md +1 -1
  880. package/node_modules/@types/node/package.json +2 -2
  881. package/node_modules/balanced-match/LICENSE.md +23 -0
  882. package/node_modules/balanced-match/README.md +57 -0
  883. package/node_modules/balanced-match/dist/commonjs/index.js +59 -0
  884. package/node_modules/balanced-match/dist/commonjs/package.json +3 -0
  885. package/node_modules/balanced-match/dist/esm/index.js +54 -0
  886. package/node_modules/balanced-match/dist/esm/package.json +3 -0
  887. package/node_modules/balanced-match/package.json +68 -0
  888. package/node_modules/brace-expansion/LICENSE +23 -0
  889. package/node_modules/brace-expansion/README.md +105 -0
  890. package/node_modules/brace-expansion/dist/commonjs/index.js +289 -0
  891. package/node_modules/brace-expansion/dist/commonjs/package.json +3 -0
  892. package/node_modules/brace-expansion/dist/esm/index.js +285 -0
  893. package/node_modules/brace-expansion/dist/esm/package.json +3 -0
  894. package/node_modules/brace-expansion/package.json +64 -0
  895. package/node_modules/fast-uri/index.js +215 -47
  896. package/node_modules/fast-uri/lib/schemes.js +9 -4
  897. package/node_modules/fast-uri/lib/utils.js +396 -92
  898. package/node_modules/fast-uri/package.json +1 -1
  899. package/node_modules/fs-native-extensions/package.json +1 -1
  900. package/node_modules/fs-native-extensions/prebuilds/android-arm/fs-native-extensions.bare +0 -0
  901. package/node_modules/fs-native-extensions/prebuilds/android-arm64/fs-native-extensions.bare +0 -0
  902. package/node_modules/fs-native-extensions/prebuilds/android-ia32/fs-native-extensions.bare +0 -0
  903. package/node_modules/fs-native-extensions/prebuilds/android-x64/fs-native-extensions.bare +0 -0
  904. package/node_modules/fs-native-extensions/prebuilds/darwin-arm64/fs-native-extensions.bare +0 -0
  905. package/node_modules/fs-native-extensions/prebuilds/darwin-arm64/fs-native-extensions.node +0 -0
  906. package/node_modules/fs-native-extensions/prebuilds/darwin-x64/fs-native-extensions.bare +0 -0
  907. package/node_modules/fs-native-extensions/prebuilds/darwin-x64/fs-native-extensions.node +0 -0
  908. package/node_modules/fs-native-extensions/prebuilds/ios-arm64/fs-native-extensions.bare +0 -0
  909. package/node_modules/fs-native-extensions/prebuilds/ios-arm64-simulator/fs-native-extensions.bare +0 -0
  910. package/node_modules/fs-native-extensions/prebuilds/ios-x64-simulator/fs-native-extensions.bare +0 -0
  911. package/node_modules/fs-native-extensions/prebuilds/linux-arm64/fs-native-extensions.bare +0 -0
  912. package/node_modules/fs-native-extensions/prebuilds/linux-x64/fs-native-extensions.bare +0 -0
  913. package/node_modules/fs-native-extensions/prebuilds/win32-arm64/fs-native-extensions.bare +0 -0
  914. package/node_modules/fs-native-extensions/prebuilds/win32-arm64/fs-native-extensions.node +0 -0
  915. package/node_modules/fs-native-extensions/prebuilds/win32-x64/fs-native-extensions.bare +0 -0
  916. package/node_modules/fs-native-extensions/prebuilds/win32-x64/fs-native-extensions.node +0 -0
  917. package/node_modules/fs-native-extensions/src/win32.c +50 -11
  918. package/node_modules/glob/LICENSE.md +63 -0
  919. package/node_modules/glob/README.md +1203 -0
  920. package/node_modules/glob/dist/commonjs/glob.js +248 -0
  921. package/node_modules/glob/dist/commonjs/has-magic.js +27 -0
  922. package/node_modules/glob/dist/commonjs/ignore.js +119 -0
  923. package/node_modules/glob/dist/commonjs/index.js +68 -0
  924. package/node_modules/glob/dist/commonjs/index.min.js +4 -0
  925. package/node_modules/glob/dist/commonjs/package.json +3 -0
  926. package/node_modules/glob/dist/commonjs/pattern.js +223 -0
  927. package/node_modules/glob/dist/commonjs/processor.js +301 -0
  928. package/node_modules/glob/dist/commonjs/walker.js +387 -0
  929. package/node_modules/glob/dist/esm/glob.js +244 -0
  930. package/node_modules/glob/dist/esm/has-magic.js +23 -0
  931. package/node_modules/glob/dist/esm/ignore.js +115 -0
  932. package/node_modules/glob/dist/esm/index.js +55 -0
  933. package/node_modules/glob/dist/esm/index.min.js +4 -0
  934. package/node_modules/glob/dist/esm/package.json +3 -0
  935. package/node_modules/glob/dist/esm/pattern.js +219 -0
  936. package/node_modules/glob/dist/esm/processor.js +294 -0
  937. package/node_modules/glob/dist/esm/walker.js +381 -0
  938. package/node_modules/glob/package.json +98 -0
  939. package/node_modules/minimatch/LICENSE.md +55 -0
  940. package/node_modules/minimatch/README.md +528 -0
  941. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
  942. package/node_modules/minimatch/dist/commonjs/ast.js +845 -0
  943. package/node_modules/minimatch/dist/commonjs/brace-expressions.js +150 -0
  944. package/node_modules/minimatch/dist/commonjs/escape.js +30 -0
  945. package/node_modules/minimatch/dist/commonjs/index.js +1127 -0
  946. package/node_modules/minimatch/dist/commonjs/package.json +3 -0
  947. package/node_modules/minimatch/dist/commonjs/unescape.js +38 -0
  948. package/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
  949. package/node_modules/minimatch/dist/esm/ast.js +841 -0
  950. package/node_modules/minimatch/dist/esm/brace-expressions.js +146 -0
  951. package/node_modules/minimatch/dist/esm/escape.js +26 -0
  952. package/node_modules/minimatch/dist/esm/index.js +1114 -0
  953. package/node_modules/minimatch/dist/esm/package.json +3 -0
  954. package/node_modules/minimatch/dist/esm/unescape.js +34 -0
  955. package/node_modules/minimatch/package.json +73 -0
  956. package/node_modules/minipass/LICENSE.md +55 -0
  957. package/node_modules/minipass/README.md +825 -0
  958. package/node_modules/minipass/dist/commonjs/index.js +1038 -0
  959. package/node_modules/minipass/dist/commonjs/package.json +3 -0
  960. package/node_modules/minipass/dist/esm/index.js +1020 -0
  961. package/node_modules/minipass/dist/esm/package.json +3 -0
  962. package/node_modules/minipass/package.json +77 -0
  963. package/node_modules/path-scurry/LICENSE.md +55 -0
  964. package/node_modules/path-scurry/README.md +636 -0
  965. package/node_modules/path-scurry/dist/commonjs/index.js +2018 -0
  966. package/node_modules/path-scurry/dist/commonjs/package.json +3 -0
  967. package/node_modules/path-scurry/dist/esm/index.js +1983 -0
  968. package/node_modules/path-scurry/dist/esm/package.json +3 -0
  969. package/node_modules/path-scurry/node_modules/lru-cache/LICENSE.md +55 -0
  970. package/node_modules/path-scurry/node_modules/lru-cache/README.md +469 -0
  971. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel.js +7 -0
  972. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.js +1726 -0
  973. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.min.js +2 -0
  974. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/perf.js +10 -0
  975. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/diagnostics-channel-cjs.d.cts.map +1 -0
  976. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/diagnostics-channel.js +7 -0
  977. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +1726 -0
  978. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.min.js +2 -0
  979. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel.js +9 -0
  980. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.js +1726 -0
  981. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.min.js +2 -0
  982. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/perf.js +10 -0
  983. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/package.json +3 -0
  984. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/perf.js +10 -0
  985. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js +4 -0
  986. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.js +1722 -0
  987. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.min.js +2 -0
  988. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/perf.js +7 -0
  989. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.d.mts.map +1 -0
  990. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/diagnostics-channel.js +19 -0
  991. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js +1722 -0
  992. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.min.js +2 -0
  993. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/diagnostics-channel.js +6 -0
  994. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.js +1722 -0
  995. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.min.js +2 -0
  996. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/perf.js +7 -0
  997. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/package.json +3 -0
  998. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/perf.js +7 -0
  999. package/node_modules/path-scurry/node_modules/lru-cache/package.json +154 -0
  1000. package/node_modules/path-scurry/package.json +72 -0
  1001. package/node_modules/qs/.github/THREAT_MODEL.md +3 -3
  1002. package/node_modules/qs/CHANGELOG.md +15 -0
  1003. package/node_modules/qs/README.md +19 -1
  1004. package/node_modules/qs/dist/qs.js +21 -21
  1005. package/node_modules/qs/eslint.config.mjs +1 -1
  1006. package/node_modules/qs/lib/parse.js +3 -4
  1007. package/node_modules/qs/lib/stringify.js +23 -8
  1008. package/node_modules/qs/lib/utils.js +10 -3
  1009. package/node_modules/qs/package.json +4 -4
  1010. package/node_modules/run/README.md +109 -18
  1011. package/node_modules/run/THIRD_PARTY_NOTICES.md +11 -11
  1012. package/node_modules/run/dist/continuation-validation.js +116 -1
  1013. package/node_modules/run/dist/errors.js +12 -2
  1014. package/node_modules/run/dist/host-function-invocation.js +2 -1
  1015. package/node_modules/run/dist/run.js +30 -4
  1016. package/node_modules/run/dist/runtime/guest-serde-source.js +1 -1
  1017. package/node_modules/run/dist/runtime/guest-sources.js +214 -56
  1018. package/node_modules/run/dist/runtime/manager.js +575 -116
  1019. package/node_modules/run/dist/runtime/max-workers.js +8 -4
  1020. package/node_modules/run/dist/runtime/protocol-validation.js +20 -7
  1021. package/node_modules/run/dist/runtime/sync-bridge-protocol.js +135 -0
  1022. package/node_modules/run/dist/runtime/worker-source.js +1 -1
  1023. package/node_modules/run/dist/utils/options.js +7 -0
  1024. package/node_modules/run/dist/utils/promise-with-resolvers.js +13 -1
  1025. package/node_modules/run/dist/utils/serde.js +1 -7
  1026. package/node_modules/run/dist/utils/source-cache.js +83 -13
  1027. package/node_modules/run/package.json +6 -4
  1028. package/node_modules/systeminformation/LICENSE +20 -0
  1029. package/node_modules/systeminformation/README.md +1251 -0
  1030. package/node_modules/systeminformation/lib/audio.js +335 -0
  1031. package/node_modules/systeminformation/lib/battery.js +334 -0
  1032. package/node_modules/systeminformation/lib/bluetooth.js +315 -0
  1033. package/node_modules/systeminformation/lib/bluetoothVendors.js +1138 -0
  1034. package/node_modules/systeminformation/lib/cli.js +100 -0
  1035. package/node_modules/systeminformation/lib/cpu.js +2285 -0
  1036. package/node_modules/systeminformation/lib/docker.js +791 -0
  1037. package/node_modules/systeminformation/lib/dockerSocket.js +117 -0
  1038. package/node_modules/systeminformation/lib/filesystem.js +1853 -0
  1039. package/node_modules/systeminformation/lib/graphics.js +1317 -0
  1040. package/node_modules/systeminformation/lib/index.js +520 -0
  1041. package/node_modules/systeminformation/lib/internet.js +265 -0
  1042. package/node_modules/systeminformation/lib/memory.js +622 -0
  1043. package/node_modules/systeminformation/lib/network.js +2008 -0
  1044. package/node_modules/systeminformation/lib/osinfo.js +1290 -0
  1045. package/node_modules/systeminformation/lib/printer.js +209 -0
  1046. package/node_modules/systeminformation/lib/processes.js +1459 -0
  1047. package/node_modules/systeminformation/lib/system.js +855 -0
  1048. package/node_modules/systeminformation/lib/usb.js +309 -0
  1049. package/node_modules/systeminformation/lib/users.js +412 -0
  1050. package/node_modules/systeminformation/lib/util.js +2833 -0
  1051. package/node_modules/systeminformation/lib/virtualbox.js +116 -0
  1052. package/node_modules/systeminformation/lib/wifi.js +839 -0
  1053. package/node_modules/systeminformation/package.json +102 -0
  1054. package/node_modules/undici/docs/docs/api/Client.md +4 -0
  1055. package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +3 -2
  1056. package/node_modules/undici/docs/docs/api/EventSource.md +4 -0
  1057. package/node_modules/undici/lib/cache/memory-cache-store.js +1 -1
  1058. package/node_modules/undici/lib/dispatcher/agent.js +7 -2
  1059. package/node_modules/undici/lib/dispatcher/balanced-pool.js +1 -1
  1060. package/node_modules/undici/lib/dispatcher/client-h1.js +12 -4
  1061. package/node_modules/undici/lib/dispatcher/client-h2.js +43 -3
  1062. package/node_modules/undici/lib/dispatcher/client.js +3 -2
  1063. package/node_modules/undici/lib/dispatcher/dispatcher-base.js +13 -1
  1064. package/node_modules/undici/lib/dispatcher/dispatcher.js +10 -0
  1065. package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +10 -3
  1066. package/node_modules/undici/lib/dispatcher/proxy-agent.js +1 -1
  1067. package/node_modules/undici/lib/dispatcher/round-robin-pool.js +1 -1
  1068. package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +3 -1
  1069. package/node_modules/undici/lib/handler/cache-handler.js +8 -0
  1070. package/node_modules/undici/lib/handler/decorator-handler.js +7 -1
  1071. package/node_modules/undici/lib/handler/deduplication-handler.js +12 -6
  1072. package/node_modules/undici/lib/handler/redirect-handler.js +8 -0
  1073. package/node_modules/undici/lib/handler/retry-handler.js +83 -11
  1074. package/node_modules/undici/lib/interceptor/dump.js +1 -1
  1075. package/node_modules/undici/lib/mock/mock-agent.js +13 -1
  1076. package/node_modules/undici/lib/mock/mock-utils.js +11 -10
  1077. package/node_modules/undici/lib/web/cookies/parse.js +4 -2
  1078. package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +28 -1
  1079. package/node_modules/undici/lib/web/eventsource/eventsource.js +4 -1
  1080. package/node_modules/undici/lib/web/fetch/request.js +2 -3
  1081. package/node_modules/undici/package.json +3 -3
  1082. package/node_modules/zod/README.md +27 -0
  1083. package/node_modules/zod/compile.cjs +77 -0
  1084. package/node_modules/zod/compile.js +52 -0
  1085. package/node_modules/zod/index.cjs +2 -2
  1086. package/node_modules/zod/index.js +5 -2
  1087. package/node_modules/zod/package.json +13 -2
  1088. package/node_modules/zod/v3/ZodError.cjs +22 -12
  1089. package/node_modules/zod/v3/ZodError.js +22 -12
  1090. package/node_modules/zod/v3/types.cjs +7 -5
  1091. package/node_modules/zod/v3/types.js +7 -5
  1092. package/node_modules/zod/v4/classic/checks.cjs +2 -1
  1093. package/node_modules/zod/v4/classic/checks.js +1 -1
  1094. package/node_modules/zod/v4/classic/deep-partial.cjs +39 -0
  1095. package/node_modules/zod/v4/classic/deep-partial.js +13 -0
  1096. package/node_modules/zod/v4/classic/errors.cjs +43 -34
  1097. package/node_modules/zod/v4/classic/errors.js +43 -34
  1098. package/node_modules/zod/v4/classic/external.cjs +30 -27
  1099. package/node_modules/zod/v4/classic/external.js +5 -8
  1100. package/node_modules/zod/v4/classic/from-json-schema.cjs +136 -75
  1101. package/node_modules/zod/v4/classic/from-json-schema.js +136 -75
  1102. package/node_modules/zod/v4/classic/in-out.cjs +63 -0
  1103. package/node_modules/zod/v4/classic/in-out.js +36 -0
  1104. package/node_modules/zod/v4/classic/index.cjs +2 -2
  1105. package/node_modules/zod/v4/classic/index.js +2 -2
  1106. package/node_modules/zod/v4/classic/iso.cjs +11 -22
  1107. package/node_modules/zod/v4/classic/iso.js +2 -17
  1108. package/node_modules/zod/v4/classic/parse.cjs +4 -1
  1109. package/node_modules/zod/v4/classic/parse.js +1 -0
  1110. package/node_modules/zod/v4/classic/schemas.cjs +498 -398
  1111. package/node_modules/zod/v4/classic/schemas.js +492 -396
  1112. package/node_modules/zod/v4/core/api.cjs +23 -4
  1113. package/node_modules/zod/v4/core/api.js +21 -4
  1114. package/node_modules/zod/v4/core/checks.cjs +37 -31
  1115. package/node_modules/zod/v4/core/checks.js +37 -31
  1116. package/node_modules/zod/v4/core/compile.cjs +1813 -0
  1117. package/node_modules/zod/v4/core/compile.js +1783 -0
  1118. package/node_modules/zod/v4/core/core.cjs +81 -18
  1119. package/node_modules/zod/v4/core/core.js +82 -19
  1120. package/node_modules/zod/v4/core/doc.cjs +5 -7
  1121. package/node_modules/zod/v4/core/doc.js +5 -7
  1122. package/node_modules/zod/v4/core/errors.cjs +110 -25
  1123. package/node_modules/zod/v4/core/errors.js +110 -25
  1124. package/node_modules/zod/v4/core/index.cjs +5 -1
  1125. package/node_modules/zod/v4/core/index.js +3 -0
  1126. package/node_modules/zod/v4/core/json-schema-generator.cjs +4 -0
  1127. package/node_modules/zod/v4/core/json-schema-generator.js +4 -0
  1128. package/node_modules/zod/v4/core/json-schema-processors.cjs +264 -95
  1129. package/node_modules/zod/v4/core/json-schema-processors.js +243 -97
  1130. package/node_modules/zod/v4/core/memoizer.cjs +268 -0
  1131. package/node_modules/zod/v4/core/memoizer.js +261 -0
  1132. package/node_modules/zod/v4/core/parse.cjs +96 -34
  1133. package/node_modules/zod/v4/core/parse.js +94 -33
  1134. package/node_modules/zod/v4/core/regexes.cjs +27 -15
  1135. package/node_modules/zod/v4/core/regexes.js +24 -13
  1136. package/node_modules/zod/v4/core/registries.js +2 -2
  1137. package/node_modules/zod/v4/core/schemas.cjs +537 -326
  1138. package/node_modules/zod/v4/core/schemas.js +526 -325
  1139. package/node_modules/zod/v4/core/to-json-schema.cjs +242 -39
  1140. package/node_modules/zod/v4/core/to-json-schema.js +241 -39
  1141. package/node_modules/zod/v4/core/util.cjs +212 -31
  1142. package/node_modules/zod/v4/core/util.js +202 -30
  1143. package/node_modules/zod/v4/core/versions.cjs +2 -2
  1144. package/node_modules/zod/v4/core/versions.js +2 -2
  1145. package/node_modules/zod/v4/core/visit.cjs +195 -0
  1146. package/node_modules/zod/v4/core/visit.js +169 -0
  1147. package/node_modules/zod/v4/index.cjs +15 -5
  1148. package/node_modules/zod/v4/index.js +3 -2
  1149. package/node_modules/zod/v4/locales/ar.cjs +3 -0
  1150. package/node_modules/zod/v4/locales/ar.js +3 -0
  1151. package/node_modules/zod/v4/locales/az.cjs +3 -0
  1152. package/node_modules/zod/v4/locales/az.js +3 -0
  1153. package/node_modules/zod/v4/locales/be.cjs +10 -0
  1154. package/node_modules/zod/v4/locales/be.js +10 -0
  1155. package/node_modules/zod/v4/locales/bg.cjs +3 -0
  1156. package/node_modules/zod/v4/locales/bg.js +3 -0
  1157. package/node_modules/zod/v4/locales/bn.cjs +138 -0
  1158. package/node_modules/zod/v4/locales/bn.js +111 -0
  1159. package/node_modules/zod/v4/locales/ca.cjs +3 -0
  1160. package/node_modules/zod/v4/locales/ca.js +3 -0
  1161. package/node_modules/zod/v4/locales/ckb.cjs +158 -0
  1162. package/node_modules/zod/v4/locales/ckb.js +131 -0
  1163. package/node_modules/zod/v4/locales/cs.cjs +3 -0
  1164. package/node_modules/zod/v4/locales/cs.js +3 -0
  1165. package/node_modules/zod/v4/locales/da.cjs +5 -2
  1166. package/node_modules/zod/v4/locales/da.js +5 -2
  1167. package/node_modules/zod/v4/locales/de.cjs +3 -0
  1168. package/node_modules/zod/v4/locales/de.js +3 -0
  1169. package/node_modules/zod/v4/locales/el.cjs +1 -0
  1170. package/node_modules/zod/v4/locales/el.js +1 -0
  1171. package/node_modules/zod/v4/locales/en.cjs +14 -4
  1172. package/node_modules/zod/v4/locales/en.js +14 -4
  1173. package/node_modules/zod/v4/locales/eo.cjs +3 -0
  1174. package/node_modules/zod/v4/locales/eo.js +3 -0
  1175. package/node_modules/zod/v4/locales/es.cjs +2 -0
  1176. package/node_modules/zod/v4/locales/es.js +2 -0
  1177. package/node_modules/zod/v4/locales/fa.cjs +3 -0
  1178. package/node_modules/zod/v4/locales/fa.js +3 -0
  1179. package/node_modules/zod/v4/locales/fi.cjs +3 -0
  1180. package/node_modules/zod/v4/locales/fi.js +3 -0
  1181. package/node_modules/zod/v4/locales/fr-CA.cjs +3 -0
  1182. package/node_modules/zod/v4/locales/fr-CA.js +3 -0
  1183. package/node_modules/zod/v4/locales/fr.cjs +16 -14
  1184. package/node_modules/zod/v4/locales/fr.js +16 -14
  1185. package/node_modules/zod/v4/locales/gu.cjs +138 -0
  1186. package/node_modules/zod/v4/locales/gu.js +111 -0
  1187. package/node_modules/zod/v4/locales/he.cjs +5 -0
  1188. package/node_modules/zod/v4/locales/he.js +5 -0
  1189. package/node_modules/zod/v4/locales/hi.cjs +136 -0
  1190. package/node_modules/zod/v4/locales/hi.js +109 -0
  1191. package/node_modules/zod/v4/locales/hr.cjs +2 -0
  1192. package/node_modules/zod/v4/locales/hr.js +2 -0
  1193. package/node_modules/zod/v4/locales/hu.cjs +3 -0
  1194. package/node_modules/zod/v4/locales/hu.js +3 -0
  1195. package/node_modules/zod/v4/locales/hy.cjs +9 -0
  1196. package/node_modules/zod/v4/locales/hy.js +9 -0
  1197. package/node_modules/zod/v4/locales/id.cjs +3 -0
  1198. package/node_modules/zod/v4/locales/id.js +3 -0
  1199. package/node_modules/zod/v4/locales/index.cjs +22 -2
  1200. package/node_modules/zod/v4/locales/index.js +10 -0
  1201. package/node_modules/zod/v4/locales/is.cjs +3 -0
  1202. package/node_modules/zod/v4/locales/is.js +3 -0
  1203. package/node_modules/zod/v4/locales/it.cjs +3 -0
  1204. package/node_modules/zod/v4/locales/it.js +3 -0
  1205. package/node_modules/zod/v4/locales/ja.cjs +3 -0
  1206. package/node_modules/zod/v4/locales/ja.js +3 -0
  1207. package/node_modules/zod/v4/locales/ka.cjs +3 -0
  1208. package/node_modules/zod/v4/locales/ka.js +3 -0
  1209. package/node_modules/zod/v4/locales/km.cjs +3 -0
  1210. package/node_modules/zod/v4/locales/km.js +3 -0
  1211. package/node_modules/zod/v4/locales/kn.cjs +141 -0
  1212. package/node_modules/zod/v4/locales/kn.js +114 -0
  1213. package/node_modules/zod/v4/locales/ko.cjs +3 -0
  1214. package/node_modules/zod/v4/locales/ko.js +3 -0
  1215. package/node_modules/zod/v4/locales/lt.cjs +2 -0
  1216. package/node_modules/zod/v4/locales/lt.js +2 -0
  1217. package/node_modules/zod/v4/locales/mk.cjs +3 -0
  1218. package/node_modules/zod/v4/locales/mk.js +3 -0
  1219. package/node_modules/zod/v4/locales/ms.cjs +3 -0
  1220. package/node_modules/zod/v4/locales/ms.js +3 -0
  1221. package/node_modules/zod/v4/locales/ne.cjs +136 -0
  1222. package/node_modules/zod/v4/locales/ne.js +109 -0
  1223. package/node_modules/zod/v4/locales/nl.cjs +3 -0
  1224. package/node_modules/zod/v4/locales/nl.js +3 -0
  1225. package/node_modules/zod/v4/locales/nn.cjs +138 -0
  1226. package/node_modules/zod/v4/locales/nn.js +111 -0
  1227. package/node_modules/zod/v4/locales/no.cjs +5 -2
  1228. package/node_modules/zod/v4/locales/no.js +5 -2
  1229. package/node_modules/zod/v4/locales/ota.cjs +3 -0
  1230. package/node_modules/zod/v4/locales/ota.js +3 -0
  1231. package/node_modules/zod/v4/locales/pl.cjs +3 -0
  1232. package/node_modules/zod/v4/locales/pl.js +3 -0
  1233. package/node_modules/zod/v4/locales/ps.cjs +3 -0
  1234. package/node_modules/zod/v4/locales/ps.js +3 -0
  1235. package/node_modules/zod/v4/locales/pt-BR.cjs +168 -0
  1236. package/node_modules/zod/v4/locales/pt-BR.js +141 -0
  1237. package/node_modules/zod/v4/locales/pt.cjs +87 -55
  1238. package/node_modules/zod/v4/locales/pt.js +87 -55
  1239. package/node_modules/zod/v4/locales/ro.cjs +1 -0
  1240. package/node_modules/zod/v4/locales/ro.js +1 -0
  1241. package/node_modules/zod/v4/locales/ru.cjs +10 -0
  1242. package/node_modules/zod/v4/locales/ru.js +10 -0
  1243. package/node_modules/zod/v4/locales/sk.cjs +141 -0
  1244. package/node_modules/zod/v4/locales/sk.js +114 -0
  1245. package/node_modules/zod/v4/locales/sl.cjs +3 -0
  1246. package/node_modules/zod/v4/locales/sl.js +3 -0
  1247. package/node_modules/zod/v4/locales/sv.cjs +5 -2
  1248. package/node_modules/zod/v4/locales/sv.js +5 -2
  1249. package/node_modules/zod/v4/locales/ta.cjs +3 -0
  1250. package/node_modules/zod/v4/locales/ta.js +3 -0
  1251. package/node_modules/zod/v4/locales/th.cjs +3 -0
  1252. package/node_modules/zod/v4/locales/th.js +3 -0
  1253. package/node_modules/zod/v4/locales/tk.cjs +132 -0
  1254. package/node_modules/zod/v4/locales/tk.js +105 -0
  1255. package/node_modules/zod/v4/locales/tr.cjs +3 -0
  1256. package/node_modules/zod/v4/locales/tr.js +3 -0
  1257. package/node_modules/zod/v4/locales/uk.cjs +3 -0
  1258. package/node_modules/zod/v4/locales/uk.js +3 -0
  1259. package/node_modules/zod/v4/locales/ur.cjs +3 -0
  1260. package/node_modules/zod/v4/locales/ur.js +3 -0
  1261. package/node_modules/zod/v4/locales/uz.cjs +1 -0
  1262. package/node_modules/zod/v4/locales/uz.js +1 -0
  1263. package/node_modules/zod/v4/locales/vi.cjs +3 -0
  1264. package/node_modules/zod/v4/locales/vi.js +3 -0
  1265. package/node_modules/zod/v4/locales/yo.cjs +3 -0
  1266. package/node_modules/zod/v4/locales/yo.js +3 -0
  1267. package/node_modules/zod/v4/locales/zh-CN.cjs +3 -0
  1268. package/node_modules/zod/v4/locales/zh-CN.js +3 -0
  1269. package/node_modules/zod/v4/locales/zh-TW.cjs +3 -0
  1270. package/node_modules/zod/v4/locales/zh-TW.js +3 -0
  1271. package/node_modules/zod/v4/mini/checks.cjs +2 -1
  1272. package/node_modules/zod/v4/mini/checks.js +1 -1
  1273. package/node_modules/zod/v4/mini/deep-partial.cjs +39 -0
  1274. package/node_modules/zod/v4/mini/deep-partial.js +13 -0
  1275. package/node_modules/zod/v4/mini/external.cjs +12 -1
  1276. package/node_modules/zod/v4/mini/external.js +3 -1
  1277. package/node_modules/zod/v4/mini/in-out.cjs +63 -0
  1278. package/node_modules/zod/v4/mini/in-out.js +36 -0
  1279. package/node_modules/zod/v4/mini/parse.cjs +3 -1
  1280. package/node_modules/zod/v4/mini/parse.js +1 -1
  1281. package/node_modules/zod/v4/mini/schemas.cjs +75 -47
  1282. package/node_modules/zod/v4/mini/schemas.js +71 -45
  1283. package/package.json +3 -4
  1284. package/node_modules/@ai-sdk/code-mode/dist/run-code-mode.js +0 -549
  1285. package/node_modules/@ai-sdk/code-mode/package.json +0 -78
  1286. package/node_modules/@ai-sdk/gateway/CHANGELOG.md +0 -3067
  1287. package/node_modules/@ai-sdk/gateway/dist/index.js +0 -3208
  1288. package/node_modules/@ai-sdk/gateway/docs/00-ai-gateway.mdx +0 -1297
  1289. package/node_modules/@ai-sdk/gateway/package.json +0 -80
  1290. package/node_modules/@ai-sdk/open-responses/node_modules/@ai-sdk/provider-utils/CHANGELOG.md +0 -2444
  1291. package/node_modules/@ai-sdk/open-responses/node_modules/@ai-sdk/provider-utils/README.md +0 -1
  1292. package/node_modules/@ai-sdk/open-responses/node_modules/@ai-sdk/provider-utils/dist/index.js +0 -4295
  1293. package/node_modules/@ai-sdk/open-responses/node_modules/@ai-sdk/provider-utils/package.json +0 -82
  1294. package/node_modules/@ai-sdk/open-responses/node_modules/@ai-sdk/provider-utils/src/to-json-schema/zod3-to-json-schema/LICENSE +0 -16
  1295. package/node_modules/@ai-sdk/open-responses/node_modules/@ai-sdk/provider-utils/src/to-json-schema/zod3-to-json-schema/README.md +0 -24
  1296. package/node_modules/@ai-sdk/open-responses/node_modules/undici/LICENSE +0 -21
  1297. package/node_modules/@ai-sdk/open-responses/node_modules/undici/README.md +0 -741
  1298. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/Agent.md +0 -84
  1299. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/BalancedPool.md +0 -99
  1300. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/CacheStorage.md +0 -30
  1301. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/CacheStore.md +0 -164
  1302. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/Client.md +0 -288
  1303. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/ClientStats.md +0 -27
  1304. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/Connector.md +0 -115
  1305. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/ContentType.md +0 -57
  1306. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/Cookies.md +0 -128
  1307. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/Debug.md +0 -62
  1308. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +0 -315
  1309. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/Dispatcher.md +0 -1392
  1310. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +0 -159
  1311. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/Errors.md +0 -49
  1312. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/EventSource.md +0 -45
  1313. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/Fetch.md +0 -60
  1314. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/GlobalInstallation.md +0 -139
  1315. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/H2CClient.md +0 -263
  1316. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/MockAgent.md +0 -603
  1317. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/MockCallHistory.md +0 -197
  1318. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +0 -43
  1319. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/MockClient.md +0 -81
  1320. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/MockErrors.md +0 -12
  1321. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/MockPool.md +0 -555
  1322. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/Pool.md +0 -84
  1323. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/PoolStats.md +0 -35
  1324. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/ProxyAgent.md +0 -229
  1325. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/RedirectHandler.md +0 -93
  1326. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/RetryAgent.md +0 -50
  1327. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/RetryHandler.md +0 -118
  1328. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/RoundRobinPool.md +0 -145
  1329. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/SnapshotAgent.md +0 -616
  1330. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +0 -275
  1331. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/Util.md +0 -25
  1332. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/WebSocket.md +0 -141
  1333. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/api/api-lifecycle.md +0 -91
  1334. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/best-practices/client-certificate.md +0 -64
  1335. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/best-practices/crawling.md +0 -58
  1336. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/best-practices/mocking-request.md +0 -190
  1337. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/best-practices/proxy.md +0 -127
  1338. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +0 -224
  1339. package/node_modules/@ai-sdk/open-responses/node_modules/undici/docs/docs/best-practices/writing-tests.md +0 -63
  1340. package/node_modules/@ai-sdk/open-responses/node_modules/undici/index-fetch.js +0 -65
  1341. package/node_modules/@ai-sdk/open-responses/node_modules/undici/index.js +0 -234
  1342. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/api/abort-signal.js +0 -59
  1343. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/api/api-connect.js +0 -110
  1344. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/api/api-pipeline.js +0 -252
  1345. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/api/api-request.js +0 -214
  1346. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/api/api-stream.js +0 -209
  1347. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/api/api-upgrade.js +0 -111
  1348. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/api/index.js +0 -7
  1349. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/api/readable.js +0 -580
  1350. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/cache/memory-cache-store.js +0 -279
  1351. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/cache/sqlite-cache-store.js +0 -467
  1352. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/core/connect.js +0 -153
  1353. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/core/constants.js +0 -143
  1354. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/core/diagnostics.js +0 -227
  1355. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/core/errors.js +0 -477
  1356. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/core/request.js +0 -464
  1357. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/core/socks5-client.js +0 -422
  1358. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/core/socks5-utils.js +0 -212
  1359. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/core/symbols.js +0 -75
  1360. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/core/tree.js +0 -160
  1361. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/core/util.js +0 -992
  1362. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/dispatcher/agent.js +0 -158
  1363. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/dispatcher/balanced-pool.js +0 -219
  1364. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/dispatcher/client-h1.js +0 -1731
  1365. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/dispatcher/client-h2.js +0 -995
  1366. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/dispatcher/client.js +0 -664
  1367. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/dispatcher/dispatcher-base.js +0 -184
  1368. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/dispatcher/dispatcher.js +0 -48
  1369. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +0 -146
  1370. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/dispatcher/fixed-queue.js +0 -135
  1371. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/dispatcher/h2c-client.js +0 -51
  1372. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/dispatcher/pool-base.js +0 -214
  1373. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/dispatcher/pool.js +0 -118
  1374. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/dispatcher/proxy-agent.js +0 -319
  1375. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/dispatcher/retry-agent.js +0 -35
  1376. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/dispatcher/round-robin-pool.js +0 -137
  1377. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +0 -260
  1378. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/encoding/index.js +0 -33
  1379. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/global.js +0 -59
  1380. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/handler/cache-handler.js +0 -760
  1381. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/handler/cache-revalidation-handler.js +0 -124
  1382. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/handler/decorator-handler.js +0 -67
  1383. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/handler/deduplication-handler.js +0 -460
  1384. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/handler/redirect-handler.js +0 -238
  1385. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/handler/retry-handler.js +0 -418
  1386. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/handler/unwrap-handler.js +0 -106
  1387. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/handler/wrap-handler.js +0 -105
  1388. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/interceptor/cache.js +0 -602
  1389. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/interceptor/decompress.js +0 -259
  1390. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/interceptor/deduplicate.js +0 -117
  1391. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/interceptor/dns.js +0 -571
  1392. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/interceptor/dump.js +0 -112
  1393. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/interceptor/redirect.js +0 -21
  1394. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/interceptor/response-error.js +0 -95
  1395. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/interceptor/retry.js +0 -19
  1396. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/llhttp/.gitkeep +0 -0
  1397. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/llhttp/constants.js +0 -531
  1398. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/llhttp/llhttp-wasm.js +0 -15
  1399. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +0 -15
  1400. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/llhttp/utils.js +0 -12
  1401. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/mock/mock-agent.js +0 -232
  1402. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/mock/mock-call-history.js +0 -248
  1403. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/mock/mock-client.js +0 -68
  1404. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/mock/mock-errors.js +0 -29
  1405. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/mock/mock-interceptor.js +0 -209
  1406. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/mock/mock-pool.js +0 -68
  1407. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/mock/mock-symbols.js +0 -32
  1408. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/mock/mock-utils.js +0 -486
  1409. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/mock/pending-interceptors-formatter.js +0 -43
  1410. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/mock/snapshot-agent.js +0 -353
  1411. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/mock/snapshot-recorder.js +0 -588
  1412. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/mock/snapshot-utils.js +0 -158
  1413. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/util/cache.js +0 -676
  1414. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/util/date.js +0 -670
  1415. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/util/promise.js +0 -28
  1416. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/util/runtime-features.js +0 -124
  1417. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/util/stats.js +0 -32
  1418. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/util/timers.js +0 -425
  1419. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/cache/cache.js +0 -864
  1420. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/cache/cachestorage.js +0 -152
  1421. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/cache/util.js +0 -45
  1422. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/cookies/constants.js +0 -12
  1423. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/cookies/index.js +0 -199
  1424. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/cookies/parse.js +0 -314
  1425. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/cookies/util.js +0 -352
  1426. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/eventsource/eventsource-stream.js +0 -399
  1427. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/eventsource/eventsource.js +0 -501
  1428. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/eventsource/util.js +0 -29
  1429. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/fetch/LICENSE +0 -21
  1430. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/fetch/body.js +0 -509
  1431. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/fetch/constants.js +0 -131
  1432. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/fetch/data-url.js +0 -596
  1433. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/fetch/formdata-parser.js +0 -586
  1434. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/fetch/formdata.js +0 -259
  1435. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/fetch/global.js +0 -40
  1436. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/fetch/headers.js +0 -719
  1437. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/fetch/index.js +0 -2413
  1438. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/fetch/request.js +0 -1115
  1439. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/fetch/response.js +0 -641
  1440. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/fetch/util.js +0 -1522
  1441. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/infra/index.js +0 -229
  1442. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/subresource-integrity/Readme.md +0 -9
  1443. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +0 -307
  1444. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/webidl/index.js +0 -1006
  1445. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/websocket/connection.js +0 -329
  1446. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/websocket/constants.js +0 -126
  1447. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/websocket/events.js +0 -331
  1448. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/websocket/frame.js +0 -133
  1449. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/websocket/permessage-deflate.js +0 -100
  1450. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/websocket/receiver.js +0 -507
  1451. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/websocket/sender.js +0 -109
  1452. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/websocket/stream/websocketerror.js +0 -104
  1453. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/websocket/stream/websocketstream.js +0 -498
  1454. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/websocket/util.js +0 -347
  1455. package/node_modules/@ai-sdk/open-responses/node_modules/undici/lib/web/websocket/websocket.js +0 -758
  1456. package/node_modules/@ai-sdk/open-responses/node_modules/undici/package.json +0 -152
  1457. package/node_modules/@ai-sdk/open-responses/node_modules/undici/scripts/strip-comments.js +0 -10
  1458. package/node_modules/@ai-sdk/open-responses/node_modules/undici/types/README.md +0 -6
  1459. package/node_modules/@ai-sdk/provider/CHANGELOG.md +0 -1218
  1460. package/node_modules/@ai-sdk/provider/package.json +0 -63
  1461. package/node_modules/@formatjs/icu-messageformat-parser/index.js +0 -2173
  1462. package/node_modules/@formatjs/icu-messageformat-parser/manipulator.js +0 -207
  1463. package/node_modules/@formatjs/icu-messageformat-parser/no-parser.js +0 -160
  1464. package/node_modules/@formatjs/icu-messageformat-parser/package.json +0 -21
  1465. package/node_modules/@formatjs/icu-messageformat-parser/printer.js +0 -224
  1466. package/node_modules/@maka/core/dist/task-ledger.js +0 -797
  1467. package/node_modules/@maka/runtime/dist/active-tool-result-prune.js +0 -334
  1468. package/node_modules/@maka/runtime/dist/active-tool-result-working-set.js +0 -218
  1469. package/node_modules/@maka/runtime/dist/archive-read-tool.js +0 -92
  1470. package/node_modules/@maka/runtime/dist/sandbox/diagnostics.js +0 -285
  1471. package/node_modules/@maka/runtime/dist/system-prompt/sandbox-context-prompt.js +0 -77
  1472. package/node_modules/@maka/runtime/dist/system-prompt/session-environment-prompt.js +0 -47
  1473. package/node_modules/@maka/runtime/dist/task-ledger-tools.js +0 -244
  1474. package/node_modules/@maka/runtime/dist/test-helpers.js +0 -61
  1475. package/node_modules/@maka/runtime/node_modules/@slack/types/dist/events/index.js +0 -43
  1476. package/node_modules/@maka/runtime/node_modules/@slack/types/package.json +0 -47
  1477. package/node_modules/@maka/runtime/node_modules/@slack/web-api/README.md +0 -390
  1478. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/methods.js +0 -1610
  1479. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/ChatAppendStreamResponse.js +0 -3
  1480. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/ChatStartStreamResponse.js +0 -3
  1481. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/ChatStopStreamResponse.js +0 -3
  1482. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/PinsListResponse.js +0 -37
  1483. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/SearchAllResponse.js +0 -82
  1484. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/SearchFilesResponse.js +0 -63
  1485. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/SlackListsAccessDeleteResponse.js +0 -3
  1486. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/SlackListsAccessSetResponse.js +0 -3
  1487. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/SlackListsCreateResponse.js +0 -3
  1488. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/SlackListsDownloadGetResponse.js +0 -3
  1489. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/SlackListsDownloadStartResponse.js +0 -3
  1490. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/SlackListsItemsCreateResponse.js +0 -3
  1491. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/SlackListsItemsDeleteMultipleResponse.js +0 -3
  1492. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/SlackListsItemsDeleteResponse.js +0 -3
  1493. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/SlackListsItemsInfoResponse.js +0 -3
  1494. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/SlackListsItemsListResponse.js +0 -3
  1495. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/SlackListsItemsUpdateResponse.js +0 -3
  1496. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/SlackListsUpdateResponse.js +0 -3
  1497. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/WorkflowsFeaturedAddResponse.js +0 -3
  1498. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/WorkflowsFeaturedListResponse.js +0 -3
  1499. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/WorkflowsFeaturedRemoveResponse.js +0 -3
  1500. package/node_modules/@maka/runtime/node_modules/@slack/web-api/dist/types/response/WorkflowsFeaturedSetResponse.js +0 -3
  1501. package/node_modules/@maka/runtime/node_modules/@slack/web-api/package.json +0 -71
  1502. package/node_modules/@maka/runtime-host/dist/protocol/task-ledger.js +0 -321
  1503. package/node_modules/@maka/runtime-host/dist/server/task-ledger-coordinator.js +0 -154
  1504. package/node_modules/@maka/storage/dist/artifact-metadata-repository.js +0 -19
  1505. package/node_modules/@maka/storage/dist/artifact-storage-layout.js +0 -26
  1506. package/node_modules/@maka/storage/dist/provider-request-capture-artifact.js +0 -31
  1507. package/node_modules/@maka/storage/dist/task-ledger-authority.js +0 -121
  1508. package/node_modules/@maka/storage/dist/task-ledger-store-internal.js +0 -32
  1509. package/node_modules/@maka/storage/dist/task-ledger-store.js +0 -663
  1510. package/node_modules/ai/CHANGELOG.md +0 -9971
  1511. package/node_modules/ai/dist/index.js +0 -18513
  1512. package/node_modules/ai/dist/internal/index.js +0 -3680
  1513. package/node_modules/ai/docs/02-foundations/02-providers-and-models.mdx +0 -179
  1514. package/node_modules/ai/docs/03-agents/04-loop-control.mdx +0 -515
  1515. package/node_modules/ai/docs/03-agents/06-policy-tool-approvals.mdx +0 -412
  1516. package/node_modules/ai/docs/03-agents/06-tool-approvals.mdx +0 -326
  1517. package/node_modules/ai/docs/03-agents/07-workflow-agent.mdx +0 -718
  1518. package/node_modules/ai/docs/03-ai-sdk-core/10-generating-structured-data.mdx +0 -513
  1519. package/node_modules/ai/docs/03-ai-sdk-core/15-tools-and-tool-calling.mdx +0 -1509
  1520. package/node_modules/ai/docs/03-ai-sdk-core/16-mcp-tools.mdx +0 -617
  1521. package/node_modules/ai/docs/03-ai-sdk-core/35-image-generation.mdx +0 -344
  1522. package/node_modules/ai/docs/03-ai-sdk-core/36-transcription.mdx +0 -332
  1523. package/node_modules/ai/docs/03-ai-sdk-core/37-speech.mdx +0 -180
  1524. package/node_modules/ai/docs/03-ai-sdk-core/39-file-uploads.mdx +0 -155
  1525. package/node_modules/ai/docs/03-ai-sdk-core/50-error-handling.mdx +0 -149
  1526. package/node_modules/ai/docs/03-ai-sdk-core/60-telemetry.mdx +0 -830
  1527. package/node_modules/ai/docs/03-ai-sdk-core/index.mdx +0 -132
  1528. package/node_modules/ai/docs/03-ai-sdk-harnesses/02-harness-agent.mdx +0 -495
  1529. package/node_modules/ai/docs/03-ai-sdk-harnesses/04-skills.mdx +0 -65
  1530. package/node_modules/ai/docs/03-ai-sdk-harnesses/05-harness-adapters.mdx +0 -45
  1531. package/node_modules/ai/docs/04-ai-sdk-ui/03-chatbot-tool-usage.mdx +0 -798
  1532. package/node_modules/ai/docs/04-ai-sdk-ui/20-streaming-data.mdx +0 -401
  1533. package/node_modules/ai/docs/04-ai-sdk-ui/21-transport.mdx +0 -212
  1534. package/node_modules/ai/docs/04-ai-sdk-ui/50-stream-protocol.mdx +0 -578
  1535. package/node_modules/ai/docs/06-advanced/04-caching.mdx +0 -175
  1536. package/node_modules/ai/docs/06-advanced/11-secure-url-fetching.mdx +0 -111
  1537. package/node_modules/ai/docs/07-reference/01-ai-sdk-core/01-generate-text.mdx +0 -3253
  1538. package/node_modules/ai/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx +0 -4261
  1539. package/node_modules/ai/docs/07-reference/01-ai-sdk-core/05-embed.mdx +0 -304
  1540. package/node_modules/ai/docs/07-reference/01-ai-sdk-core/06-embed-many.mdx +0 -302
  1541. package/node_modules/ai/docs/07-reference/01-ai-sdk-core/06-rerank.mdx +0 -317
  1542. package/node_modules/ai/docs/07-reference/01-ai-sdk-core/10-generate-image.mdx +0 -252
  1543. package/node_modules/ai/docs/07-reference/01-ai-sdk-core/14-upload-file.mdx +0 -92
  1544. package/node_modules/ai/docs/07-reference/01-ai-sdk-core/16-tool-loop-agent.mdx +0 -1102
  1545. package/node_modules/ai/docs/07-reference/01-ai-sdk-core/28-output.mdx +0 -342
  1546. package/node_modules/ai/docs/07-reference/01-ai-sdk-core/31-ui-message.mdx +0 -268
  1547. package/node_modules/ai/docs/07-reference/01-ai-sdk-core/80-smooth-stream.mdx +0 -145
  1548. package/node_modules/ai/docs/07-reference/01-ai-sdk-core/index.mdx +0 -225
  1549. package/node_modules/ai/docs/07-reference/02-ai-sdk-ui/01-use-chat.mdx +0 -493
  1550. package/node_modules/ai/docs/07-reference/02-ai-sdk-ui/31-convert-to-model-messages.mdx +0 -256
  1551. package/node_modules/ai/docs/07-reference/02-ai-sdk-ui/40-create-ui-message-stream.mdx +0 -166
  1552. package/node_modules/ai/docs/07-reference/02-ai-sdk-ui/41-create-ui-message-stream-response.mdx +0 -120
  1553. package/node_modules/ai/docs/07-reference/04-ai-sdk-workflow/01-workflow-agent.mdx +0 -954
  1554. package/node_modules/ai/docs/07-reference/04-ai-sdk-workflow/02-workflow-chat-transport.mdx +0 -347
  1555. package/node_modules/ai/docs/07-reference/04-ai-sdk-workflow/index.mdx +0 -26
  1556. package/node_modules/ai/docs/07-reference/05-ai-sdk-errors/ai-invalid-argument-error.mdx +0 -26
  1557. package/node_modules/ai/docs/07-reference/05-ai-sdk-errors/ai-no-image-generated-error.mdx +0 -36
  1558. package/node_modules/ai/docs/07-reference/05-ai-sdk-errors/index.mdx +0 -41
  1559. package/node_modules/ai/package.json +0 -117
  1560. package/node_modules/intl-messageformat/intl-messageformat.iife.js +0 -2807
  1561. package/node_modules/intl-messageformat/package.json +0 -40
  1562. package/packages/eval/dist/attempt-store.js +0 -138
  1563. package/packages/eval/dist/cli.js +0 -119
  1564. package/packages/eval/dist/experiment-directory.js +0 -59
  1565. package/packages/eval/dist/experiment.js +0 -49
  1566. package/packages/eval/dist/external-subject.js +0 -488
  1567. package/packages/eval/dist/harbor-external-subject.js +0 -929
  1568. package/packages/eval/dist/harbor-maka-subject.js +0 -83
  1569. package/packages/eval/dist/harness-environment.js +0 -80
  1570. package/packages/eval/dist/harness-executor.js +0 -1013
  1571. package/packages/eval/dist/index.js +0 -28
  1572. package/packages/eval/dist/install-preflight.js +0 -201
  1573. package/packages/eval/dist/maka-artifacts.js +0 -126
  1574. package/packages/eval/dist/maka-runtime-policy.js +0 -42
  1575. package/packages/eval/dist/maka-subject.js +0 -268
  1576. package/packages/eval/dist/metering-checkpoint.js +0 -80
  1577. package/packages/eval/dist/provider-admission.js +0 -39
  1578. package/packages/eval/dist/provider-metering.js +0 -67
  1579. package/packages/eval/dist/provider-web-tool-surface.js +0 -74
  1580. package/packages/eval/dist/relay-result-frame.js +0 -38
  1581. package/packages/eval/dist/result.js +0 -94
  1582. package/packages/eval/dist/runner.js +0 -290
  1583. package/packages/eval/dist/spec.js +0 -135
  1584. package/packages/eval/dist/toolchain-verification.js +0 -130
  1585. package/packages/eval/harbor/deepseek-codex-models.json +0 -69
  1586. package/packages/eval/harbor/deepseek-harness-profile/cordis.patch.yml +0 -140
  1587. package/packages/eval/harbor/deepseek-harness-profile/cordis.yml +0 -18
  1588. package/packages/eval/harbor/deepseek-harness-profile/package.json +0 -10
  1589. package/packages/eval/harbor/docker-compose-egress-proxy.yaml +0 -57
  1590. package/packages/eval/harbor/egress-proxy/Dockerfile +0 -25
  1591. package/packages/eval/harbor/egress-proxy/entrypoint.sh +0 -62
  1592. package/packages/eval/harbor/egress-proxy/network-policy +0 -148
  1593. package/packages/eval/harbor/egress_filter.py +0 -435
  1594. package/packages/eval/harbor/eval_framework.py +0 -40
  1595. package/packages/eval/harbor/relay_agent.py +0 -686
  1596. package/packages/eval/harbor/run_trial.py +0 -223
  1597. package/packages/eval/package.json +0 -20
  1598. /package/node_modules/@ai-sdk/{code-mode → anthropic/node_modules/@ai-sdk/provider}/LICENSE +0 -0
  1599. /package/node_modules/@ai-sdk/{provider → anthropic/node_modules/@ai-sdk/provider}/README.md +0 -0
  1600. /package/node_modules/@ai-sdk/{provider → anthropic/node_modules/@ai-sdk/provider}/dist/index.js +0 -0
  1601. /package/node_modules/@ai-sdk/{gateway → cohere/node_modules/@ai-sdk/provider}/LICENSE +0 -0
  1602. /package/node_modules/@ai-sdk/{provider → google/node_modules/@ai-sdk/provider}/LICENSE +0 -0
  1603. /package/node_modules/{ai → @ai-sdk/openai-compatible/node_modules/@ai-sdk/provider}/LICENSE +0 -0
  1604. /package/node_modules/{@formatjs → @maka/core/node_modules/@formatjs}/icu-messageformat-parser/LICENSE.md +0 -0
  1605. /package/node_modules/{@formatjs → @maka/core/node_modules/@formatjs}/icu-messageformat-parser/README.md +0 -0
  1606. /package/node_modules/{intl-messageformat → @maka/core/node_modules/intl-messageformat}/LICENSE.md +0 -0
  1607. /package/node_modules/{intl-messageformat → @maka/core/node_modules/intl-messageformat}/README.md +0 -0
  1608. /package/node_modules/{intl-messageformat → @maka/core/node_modules/intl-messageformat}/index.js +0 -0
  1609. /package/node_modules/{@ai-sdk → @maka/runtime/node_modules/@ai-sdk}/code-mode/README.md +0 -0
  1610. /package/node_modules/{@ai-sdk → @maka/runtime/node_modules/@ai-sdk}/code-mode/dist/approval-continuation.js +0 -0
  1611. /package/node_modules/{@ai-sdk → @maka/runtime/node_modules/@ai-sdk}/code-mode/dist/approval.js +0 -0
  1612. /package/node_modules/{@ai-sdk → @maka/runtime/node_modules/@ai-sdk}/code-mode/dist/code-mode-tool.js +0 -0
  1613. /package/node_modules/{@ai-sdk → @maka/runtime/node_modules/@ai-sdk}/code-mode/dist/continuation-capability.js +0 -0
  1614. /package/node_modules/{@ai-sdk → @maka/runtime/node_modules/@ai-sdk}/code-mode/dist/direct-tool-call.js +0 -0
  1615. /package/node_modules/{@ai-sdk → @maka/runtime/node_modules/@ai-sdk}/code-mode/dist/errors.js +0 -0
  1616. /package/node_modules/{@ai-sdk → @maka/runtime/node_modules/@ai-sdk}/code-mode/dist/host-interrupt.js +0 -0
  1617. /package/node_modules/{@ai-sdk → @maka/runtime/node_modules/@ai-sdk}/code-mode/dist/index.js +0 -0
  1618. /package/node_modules/{@ai-sdk → @maka/runtime/node_modules/@ai-sdk}/code-mode/dist/interrupt-continuation.js +0 -0
  1619. /package/node_modules/{@ai-sdk → @maka/runtime/node_modules/@ai-sdk}/code-mode/dist/tool-invocation.js +0 -0
  1620. /package/node_modules/{@ai-sdk → @maka/runtime/node_modules/@ai-sdk}/code-mode/dist/tool-prompt.js +0 -0
  1621. /package/node_modules/{@ai-sdk → @maka/runtime/node_modules/@ai-sdk}/code-mode/dist/types.js +0 -0
  1622. /package/node_modules/{@ai-sdk → @maka/runtime/node_modules/@ai-sdk}/code-mode/dist/utils/serialization.js +0 -0
  1623. /package/node_modules/{@ai-sdk → @maka/runtime/node_modules/@ai-sdk}/code-mode/src/tsconfig.json +0 -0
  1624. /package/node_modules/{@ai-sdk → @maka/runtime/node_modules/@ai-sdk}/gateway/README.md +0 -0
  1625. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/README.md +0 -0
  1626. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/00-introduction/index.mdx +0 -0
  1627. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/02-foundations/01-overview.mdx +0 -0
  1628. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/02-foundations/03-prompts.mdx +0 -0
  1629. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/02-foundations/04-tools.mdx +0 -0
  1630. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/02-foundations/05-streaming.mdx +0 -0
  1631. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/02-foundations/06-provider-options.mdx +0 -0
  1632. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/02-foundations/index.mdx +0 -0
  1633. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/02-getting-started/00-choosing-a-provider.mdx +0 -0
  1634. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/02-getting-started/01-navigating-the-library.mdx +0 -0
  1635. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/02-getting-started/02-nextjs-app-router.mdx +0 -0
  1636. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/02-getting-started/03-nextjs-pages-router.mdx +0 -0
  1637. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/02-getting-started/04-svelte.mdx +0 -0
  1638. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/02-getting-started/05-nuxt.mdx +0 -0
  1639. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/02-getting-started/06-nodejs.mdx +0 -0
  1640. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/02-getting-started/07-expo.mdx +0 -0
  1641. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/02-getting-started/08-tanstack-start.mdx +0 -0
  1642. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/02-getting-started/09-coding-agents.mdx +0 -0
  1643. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/02-getting-started/index.mdx +0 -0
  1644. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-agents/01-overview.mdx +0 -0
  1645. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-agents/02-building-agents.mdx +0 -0
  1646. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-agents/03-workflows.mdx +0 -0
  1647. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-agents/05-configuring-call-options.mdx +0 -0
  1648. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-agents/06-memory.mdx +0 -0
  1649. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-agents/06-subagents.mdx +0 -0
  1650. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-agents/08-terminal-ui.mdx +0 -0
  1651. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-agents/index.mdx +0 -0
  1652. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-core/01-overview.mdx +0 -0
  1653. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-core/05-generating-text.mdx +0 -0
  1654. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-core/17-mcp-apps.mdx +0 -0
  1655. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-core/17-runtime-and-tool-context.mdx +0 -0
  1656. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-core/18-code-mode.mdx +0 -0
  1657. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-core/20-prompt-engineering.mdx +0 -0
  1658. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-core/25-settings.mdx +0 -0
  1659. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-core/26-reasoning.mdx +0 -0
  1660. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-core/30-embeddings.mdx +0 -0
  1661. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-core/31-reranking.mdx +0 -0
  1662. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-core/36-realtime.mdx +0 -0
  1663. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-core/36-translation.mdx +0 -0
  1664. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-core/38-video-generation.mdx +0 -0
  1665. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-core/40-middleware.mdx +0 -0
  1666. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-core/41-skill-uploads.mdx +0 -0
  1667. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-core/45-provider-management.mdx +0 -0
  1668. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-core/55-testing.mdx +0 -0
  1669. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-core/65-devtools.mdx +0 -0
  1670. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-core/65-lifecycle-callbacks.mdx +0 -0
  1671. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-harnesses/01-overview.mdx +0 -0
  1672. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-harnesses/03-tools.mdx +0 -0
  1673. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-harnesses/06-workflow-utilities.mdx +0 -0
  1674. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-harnesses/07-ui.mdx +0 -0
  1675. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-harnesses/08-terminal-ui.mdx +0 -0
  1676. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/03-ai-sdk-harnesses/index.mdx +0 -0
  1677. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/04-ai-sdk-ui/01-overview.mdx +0 -0
  1678. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/04-ai-sdk-ui/02-chatbot.mdx +0 -0
  1679. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/04-ai-sdk-ui/03-chatbot-message-persistence.mdx +0 -0
  1680. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/04-ai-sdk-ui/03-chatbot-resume-streams.mdx +0 -0
  1681. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/04-ai-sdk-ui/04-generative-user-interfaces.mdx +0 -0
  1682. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/04-ai-sdk-ui/05-completion.mdx +0 -0
  1683. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/04-ai-sdk-ui/08-object-generation.mdx +0 -0
  1684. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/04-ai-sdk-ui/21-error-handling.mdx +0 -0
  1685. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/04-ai-sdk-ui/24-reading-ui-message-streams.mdx +0 -0
  1686. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/04-ai-sdk-ui/25-message-metadata.mdx +0 -0
  1687. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/04-ai-sdk-ui/index.mdx +0 -0
  1688. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/05-ai-sdk-rsc/01-overview.mdx +0 -0
  1689. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/05-ai-sdk-rsc/02-streaming-react-components.mdx +0 -0
  1690. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/05-ai-sdk-rsc/03-generative-ui-state.mdx +0 -0
  1691. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/05-ai-sdk-rsc/03-saving-and-restoring-states.mdx +0 -0
  1692. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/05-ai-sdk-rsc/04-multistep-interfaces.mdx +0 -0
  1693. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/05-ai-sdk-rsc/05-streaming-values.mdx +0 -0
  1694. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/05-ai-sdk-rsc/06-loading-state.mdx +0 -0
  1695. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/05-ai-sdk-rsc/08-error-handling.mdx +0 -0
  1696. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/05-ai-sdk-rsc/09-authentication.mdx +0 -0
  1697. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/05-ai-sdk-rsc/10-migrating-to-ui.mdx +0 -0
  1698. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/05-ai-sdk-rsc/index.mdx +0 -0
  1699. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/06-advanced/01-prompt-engineering.mdx +0 -0
  1700. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/06-advanced/02-stopping-streams.mdx +0 -0
  1701. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/06-advanced/03-backpressure.mdx +0 -0
  1702. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/06-advanced/05-multiple-streamables.mdx +0 -0
  1703. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/06-advanced/06-rate-limiting.mdx +0 -0
  1704. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/06-advanced/07-rendering-ui-with-language-models.mdx +0 -0
  1705. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/06-advanced/08-model-as-router.mdx +0 -0
  1706. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/06-advanced/09-multistep-interfaces.mdx +0 -0
  1707. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/06-advanced/09-sequential-generations.mdx +0 -0
  1708. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/06-advanced/10-vercel-deployment-guide.mdx +0 -0
  1709. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/06-advanced/index.mdx +0 -0
  1710. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/11-stream-transcribe.mdx +0 -0
  1711. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/11-stream-translate.mdx +0 -0
  1712. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/11-transcribe.mdx +0 -0
  1713. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/12-generate-speech.mdx +0 -0
  1714. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/13-generate-video.mdx +0 -0
  1715. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/14-upload-skill.mdx +0 -0
  1716. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/15-agent.mdx +0 -0
  1717. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/17-create-agent-ui-stream.mdx +0 -0
  1718. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/18-create-agent-ui-stream-response.mdx +0 -0
  1719. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/18-pipe-agent-ui-stream-to-response.mdx +0 -0
  1720. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/20-tool.mdx +0 -0
  1721. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/22-dynamic-tool.mdx +0 -0
  1722. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/23-create-mcp-client.mdx +0 -0
  1723. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/23-get-realtime-tool-definitions.mdx +0 -0
  1724. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/24-mcp-apps.mdx +0 -0
  1725. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/24-mcp-stdio-transport.mdx +0 -0
  1726. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/25-json-schema.mdx +0 -0
  1727. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/26-zod-schema.mdx +0 -0
  1728. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/27-valibot-schema.mdx +0 -0
  1729. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/29-filter-active-tools.mdx +0 -0
  1730. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/30-model-message.mdx +0 -0
  1731. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/32-validate-ui-messages.mdx +0 -0
  1732. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/33-safe-validate-ui-messages.mdx +0 -0
  1733. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/34-sandbox.mdx +0 -0
  1734. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/40-provider-registry.mdx +0 -0
  1735. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/42-custom-provider.mdx +0 -0
  1736. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/50-cosine-similarity.mdx +0 -0
  1737. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/60-wrap-language-model.mdx +0 -0
  1738. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/61-wrap-image-model.mdx +0 -0
  1739. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/65-language-model-v2-middleware.mdx +0 -0
  1740. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/66-extract-reasoning-middleware.mdx +0 -0
  1741. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/67-simulate-streaming-middleware.mdx +0 -0
  1742. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/68-default-instructions-middleware.mdx +0 -0
  1743. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/68-default-settings-middleware.mdx +0 -0
  1744. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/69-add-tool-input-examples-middleware.mdx +0 -0
  1745. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/70-extract-json-middleware.mdx +0 -0
  1746. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/70-is-step-count.mdx +0 -0
  1747. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/71-has-tool-call.mdx +0 -0
  1748. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/72-loop-finished.mdx +0 -0
  1749. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/75-simulate-readable-stream.mdx +0 -0
  1750. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/90-generate-id.mdx +0 -0
  1751. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/91-create-id-generator.mdx +0 -0
  1752. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/01-ai-sdk-core/92-default-generated-file.mdx +0 -0
  1753. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/02-ai-sdk-ui/02-use-completion.mdx +0 -0
  1754. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/02-ai-sdk-ui/03-use-object.mdx +0 -0
  1755. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/02-ai-sdk-ui/05-use-realtime.mdx +0 -0
  1756. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/02-ai-sdk-ui/32-prune-messages.mdx +0 -0
  1757. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/02-ai-sdk-ui/42-pipe-ui-message-stream-to-response.mdx +0 -0
  1758. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/02-ai-sdk-ui/43-read-ui-message-stream.mdx +0 -0
  1759. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/02-ai-sdk-ui/46-infer-ui-tools.mdx +0 -0
  1760. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/02-ai-sdk-ui/47-infer-ui-tool.mdx +0 -0
  1761. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/02-ai-sdk-ui/48-mcp-app-renderer.mdx +0 -0
  1762. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/02-ai-sdk-ui/50-direct-chat-transport.mdx +0 -0
  1763. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/02-ai-sdk-ui/index.mdx +0 -0
  1764. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/03-ai-sdk-rsc/01-stream-ui.mdx +0 -0
  1765. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/03-ai-sdk-rsc/02-create-ai.mdx +0 -0
  1766. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/03-ai-sdk-rsc/03-create-streamable-ui.mdx +0 -0
  1767. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/03-ai-sdk-rsc/04-create-streamable-value.mdx +0 -0
  1768. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/03-ai-sdk-rsc/05-read-streamable-value.mdx +0 -0
  1769. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/03-ai-sdk-rsc/06-get-ai-state.mdx +0 -0
  1770. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/03-ai-sdk-rsc/07-get-mutable-ai-state.mdx +0 -0
  1771. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/03-ai-sdk-rsc/08-use-ai-state.mdx +0 -0
  1772. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/03-ai-sdk-rsc/09-use-actions.mdx +0 -0
  1773. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/03-ai-sdk-rsc/10-use-ui-state.mdx +0 -0
  1774. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/03-ai-sdk-rsc/11-use-streamable-value.mdx +0 -0
  1775. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/03-ai-sdk-rsc/20-render.mdx +0 -0
  1776. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/03-ai-sdk-rsc/index.mdx +0 -0
  1777. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-api-call-error.mdx +0 -0
  1778. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-download-error.mdx +0 -0
  1779. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-empty-response-body-error.mdx +0 -0
  1780. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-data-content-error.mdx +0 -0
  1781. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-message-role-error.mdx +0 -0
  1782. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-prompt-error.mdx +0 -0
  1783. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-response-data-error.mdx +0 -0
  1784. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-tool-approval-error.mdx +0 -0
  1785. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-tool-approval-signature-error.mdx +0 -0
  1786. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-tool-input-error.mdx +0 -0
  1787. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-json-parse-error.mdx +0 -0
  1788. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-load-api-key-error.mdx +0 -0
  1789. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-load-setting-error.mdx +0 -0
  1790. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-message-conversion-error.mdx +0 -0
  1791. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-no-content-generated-error.mdx +0 -0
  1792. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-no-object-generated-error.mdx +0 -0
  1793. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-no-output-generated-error.mdx +0 -0
  1794. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-no-speech-generated-error.mdx +0 -0
  1795. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-no-such-model-error.mdx +0 -0
  1796. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-no-such-provider-error.mdx +0 -0
  1797. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-no-such-provider-reference-error.mdx +0 -0
  1798. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-no-such-tool-error.mdx +0 -0
  1799. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-no-transcript-generated-error.mdx +0 -0
  1800. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-no-translation-generated-error.mdx +0 -0
  1801. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-no-video-generated-error.mdx +0 -0
  1802. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-retry-error.mdx +0 -0
  1803. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-too-many-embedding-values-for-call-error.mdx +0 -0
  1804. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-tool-call-not-found-for-approval-error.mdx +0 -0
  1805. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-tool-call-repair-error.mdx +0 -0
  1806. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-type-validation-error.mdx +0 -0
  1807. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-ui-message-stream-error.mdx +0 -0
  1808. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/05-ai-sdk-errors/ai-unsupported-functionality-error.mdx +0 -0
  1809. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/06-ai-sdk-tui/01-run-agent-tui.mdx +0 -0
  1810. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/06-ai-sdk-tui/index.mdx +0 -0
  1811. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/07-reference/index.mdx +0 -0
  1812. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/08-migration-guides/00-versioning.mdx +0 -0
  1813. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/08-migration-guides/23-migration-guide-7-0.mdx +0 -0
  1814. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/08-migration-guides/24-migration-guide-6-0.mdx +0 -0
  1815. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/08-migration-guides/25-migration-guide-5-0-data.mdx +0 -0
  1816. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/08-migration-guides/26-migration-guide-5-0.mdx +0 -0
  1817. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/08-migration-guides/27-migration-guide-4-2.mdx +0 -0
  1818. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/08-migration-guides/28-migration-guide-4-1.mdx +0 -0
  1819. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/08-migration-guides/29-migration-guide-4-0.mdx +0 -0
  1820. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/08-migration-guides/36-migration-guide-3-4.mdx +0 -0
  1821. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/08-migration-guides/37-migration-guide-3-3.mdx +0 -0
  1822. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/08-migration-guides/38-migration-guide-3-2.mdx +0 -0
  1823. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/08-migration-guides/39-migration-guide-3-1.mdx +0 -0
  1824. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/08-migration-guides/index.mdx +0 -0
  1825. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/01-azure-stream-slow.mdx +0 -0
  1826. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/03-server-actions-in-client-components.mdx +0 -0
  1827. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/04-strange-stream-output.mdx +0 -0
  1828. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/05-streamable-ui-errors.mdx +0 -0
  1829. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/05-tool-invocation-missing-result.mdx +0 -0
  1830. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/06-streaming-not-working-when-deployed.mdx +0 -0
  1831. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/06-streaming-not-working-when-proxied.mdx +0 -0
  1832. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/06-timeout-on-vercel.mdx +0 -0
  1833. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/07-unclosed-streams.mdx +0 -0
  1834. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/08-use-chat-failed-to-parse-stream.mdx +0 -0
  1835. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/09-client-stream-error.mdx +0 -0
  1836. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/10-use-chat-tools-no-response.mdx +0 -0
  1837. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/11-use-chat-custom-request-options.mdx +0 -0
  1838. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/12-typescript-performance-zod.mdx +0 -0
  1839. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/12-use-chat-an-error-occurred.mdx +0 -0
  1840. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/13-repeated-assistant-messages.mdx +0 -0
  1841. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/14-stream-abort-handling.mdx +0 -0
  1842. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/14-tool-calling-with-structured-outputs.mdx +0 -0
  1843. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/15-abort-breaks-resumable-streams.mdx +0 -0
  1844. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/15-stream-text-not-working.mdx +0 -0
  1845. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/16-streaming-status-delay.mdx +0 -0
  1846. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/17-use-chat-stale-body-data.mdx +0 -0
  1847. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/18-ontoolcall-type-narrowing.mdx +0 -0
  1848. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/19-unsupported-model-version.mdx +0 -0
  1849. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/20-no-object-generated-content-filter.mdx +0 -0
  1850. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/21-missing-tool-results-error.mdx +0 -0
  1851. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/30-model-is-not-assignable-to-type.mdx +0 -0
  1852. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/40-typescript-cannot-find-namespace-jsx.mdx +0 -0
  1853. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/50-react-maximum-update-depth-exceeded.mdx +0 -0
  1854. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/60-jest-cannot-find-module-ai-rsc.mdx +0 -0
  1855. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/70-high-memory-usage-with-images.mdx +0 -0
  1856. /package/node_modules/{ai → @maka/runtime/node_modules/ai}/docs/09-troubleshooting/index.mdx +0 -0
  1857. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/logger/LICENSE +0 -0
  1858. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/logger/README.md +0 -0
  1859. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/logger/dist/index.js +0 -0
  1860. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/logger/package.json +0 -0
  1861. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/LICENSE +0 -0
  1862. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/README.md +0 -0
  1863. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/block-kit/block-elements.js +0 -0
  1864. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/block-kit/blocks.js +0 -0
  1865. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/block-kit/composition-objects.js +0 -0
  1866. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/block-kit/extensions.js +0 -0
  1867. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/calls.js +0 -0
  1868. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/chunk.js +0 -0
  1869. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/common/bot-profile.js +0 -0
  1870. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/common/status-emoji-display-info.js +0 -0
  1871. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/dialog.js +0 -0
  1872. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/app.js +0 -0
  1873. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/assistant.js +0 -0
  1874. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/call.js +0 -0
  1875. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/channel.js +0 -0
  1876. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/dnd.js +0 -0
  1877. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/email.js +0 -0
  1878. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/emoji.js +0 -0
  1879. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/entity-details-requested.js +0 -0
  1880. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/file.js +0 -0
  1881. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/function.js +0 -0
  1882. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/grid-migration.js +0 -0
  1883. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/group.js +0 -0
  1884. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/im.js +0 -0
  1885. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/invite.js +0 -0
  1886. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/link-shared.js +0 -0
  1887. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/member.js +0 -0
  1888. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/message-metadata.js +0 -0
  1889. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/message.js +0 -0
  1890. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/pin.js +0 -0
  1891. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/reaction.js +0 -0
  1892. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/shared-channel.js +0 -0
  1893. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/star.js +0 -0
  1894. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/steps-from-apps.js +0 -0
  1895. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/subteam.js +0 -0
  1896. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/team.js +0 -0
  1897. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/token.js +0 -0
  1898. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/events/user.js +0 -0
  1899. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/index.js +0 -0
  1900. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/message-attachments.js +0 -0
  1901. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/message-metadata.js +0 -0
  1902. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/types/dist/views.js +0 -0
  1903. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/LICENSE +0 -0
  1904. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/WebClient.js +0 -0
  1905. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/chat-stream.js +0 -0
  1906. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/errors.js +0 -0
  1907. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/file-upload.js +0 -0
  1908. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/helpers.js +0 -0
  1909. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/index.js +0 -0
  1910. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/instrument.js +0 -0
  1911. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/logger.js +0 -0
  1912. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/retry-policies.js +0 -0
  1913. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/helpers.js +0 -0
  1914. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/admin/analytics.js +0 -0
  1915. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/admin/apps.js +0 -0
  1916. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/admin/auth.js +0 -0
  1917. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/admin/barriers.js +0 -0
  1918. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/admin/conversations.js +0 -0
  1919. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/admin/emoji.js +0 -0
  1920. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/admin/functions.js +0 -0
  1921. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/admin/inviteRequests.js +0 -0
  1922. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/admin/roles.js +0 -0
  1923. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/admin/teams.js +0 -0
  1924. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/admin/usergroups.js +0 -0
  1925. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/admin/users.js +0 -0
  1926. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/admin/workflows.js +0 -0
  1927. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/api.js +0 -0
  1928. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/apps.js +0 -0
  1929. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/assistant.js +0 -0
  1930. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/auth.js +0 -0
  1931. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/bookmarks.js +0 -0
  1932. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/bots.js +0 -0
  1933. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/calls.js +0 -0
  1934. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/canvas.js +0 -0
  1935. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/chat.js +0 -0
  1936. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/common.js +0 -0
  1937. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/conversations.js +0 -0
  1938. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/dialog.js +0 -0
  1939. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/dnd.js +0 -0
  1940. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/emoji.js +0 -0
  1941. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/entity.js +0 -0
  1942. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/files.js +0 -0
  1943. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/functions.js +0 -0
  1944. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/index.js +0 -0
  1945. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/manifest.js +0 -0
  1946. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/migration.js +0 -0
  1947. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/oauth.js +0 -0
  1948. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/openid.js +0 -0
  1949. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/pins.js +0 -0
  1950. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/reactions.js +0 -0
  1951. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/reminders.js +0 -0
  1952. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/rtm.js +0 -0
  1953. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/search.js +0 -0
  1954. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/slackLists.js +0 -0
  1955. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/stars.js +0 -0
  1956. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/team.js +0 -0
  1957. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/tooling.js +0 -0
  1958. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/usergroups.js +0 -0
  1959. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/users.js +0 -0
  1960. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/views.js +0 -0
  1961. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/request/workflows.js +0 -0
  1962. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminAnalyticsGetFileResponse.js +0 -0
  1963. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminAppsActivitiesListResponse.js +0 -0
  1964. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminAppsApproveResponse.js +0 -0
  1965. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminAppsApprovedListResponse.js +0 -0
  1966. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminAppsClearResolutionResponse.js +0 -0
  1967. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminAppsConfigLookupResponse.js +0 -0
  1968. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminAppsConfigSetResponse.js +0 -0
  1969. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminAppsRequestsCancelResponse.js +0 -0
  1970. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminAppsRequestsListResponse.js +0 -0
  1971. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminAppsRestrictResponse.js +0 -0
  1972. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminAppsRestrictedListResponse.js +0 -0
  1973. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminAppsUninstallResponse.js +0 -0
  1974. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminAuthPolicyAssignEntitiesResponse.js +0 -0
  1975. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminAuthPolicyGetEntitiesResponse.js +0 -0
  1976. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminAuthPolicyRemoveEntitiesResponse.js +0 -0
  1977. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminBarriersCreateResponse.js +0 -0
  1978. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminBarriersDeleteResponse.js +0 -0
  1979. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminBarriersListResponse.js +0 -0
  1980. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminBarriersUpdateResponse.js +0 -0
  1981. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsArchiveResponse.js +0 -0
  1982. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsBulkArchiveResponse.js +0 -0
  1983. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsBulkDeleteResponse.js +0 -0
  1984. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsBulkMoveResponse.js +0 -0
  1985. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsConvertToPrivateResponse.js +0 -0
  1986. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsConvertToPublicResponse.js +0 -0
  1987. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsCreateResponse.js +0 -0
  1988. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsDeleteResponse.js +0 -0
  1989. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsDisconnectSharedResponse.js +0 -0
  1990. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsEkmListOriginalConnectedChannelInfoResponse.js +0 -0
  1991. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsGetConversationPrefsResponse.js +0 -0
  1992. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsGetCustomRetentionResponse.js +0 -0
  1993. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsGetTeamsResponse.js +0 -0
  1994. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsInviteResponse.js +0 -0
  1995. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsLookupResponse.js +0 -0
  1996. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsRemoveCustomRetentionResponse.js +0 -0
  1997. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsRenameResponse.js +0 -0
  1998. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsRestrictAccessAddGroupResponse.js +0 -0
  1999. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsRestrictAccessListGroupsResponse.js +0 -0
  2000. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsRestrictAccessRemoveGroupResponse.js +0 -0
  2001. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsSearchResponse.js +0 -0
  2002. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsSetConversationPrefsResponse.js +0 -0
  2003. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsSetCustomRetentionResponse.js +0 -0
  2004. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsSetTeamsResponse.js +0 -0
  2005. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsUnarchiveResponse.js +0 -0
  2006. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsWhitelistAddResponse.js +0 -0
  2007. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsWhitelistListGroupsLinkedToChannelResponse.js +0 -0
  2008. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminConversationsWhitelistRemoveResponse.js +0 -0
  2009. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminEmojiAddAliasResponse.js +0 -0
  2010. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminEmojiAddResponse.js +0 -0
  2011. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminEmojiListResponse.js +0 -0
  2012. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminEmojiRemoveResponse.js +0 -0
  2013. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminEmojiRenameResponse.js +0 -0
  2014. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminFunctionsListResponse.js +0 -0
  2015. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminFunctionsPermissionsLookupResponse.js +0 -0
  2016. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminFunctionsPermissionsSetResponse.js +0 -0
  2017. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminInviteRequestsApproveResponse.js +0 -0
  2018. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminInviteRequestsApprovedListResponse.js +0 -0
  2019. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminInviteRequestsDeniedListResponse.js +0 -0
  2020. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminInviteRequestsDenyResponse.js +0 -0
  2021. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminInviteRequestsListResponse.js +0 -0
  2022. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminRolesAddAssignmentsResponse.js +0 -0
  2023. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminRolesListAssignmentsResponse.js +0 -0
  2024. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminRolesRemoveAssignmentsResponse.js +0 -0
  2025. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminTeamsAdminsListResponse.js +0 -0
  2026. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminTeamsCreateResponse.js +0 -0
  2027. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminTeamsListResponse.js +0 -0
  2028. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminTeamsOwnersListResponse.js +0 -0
  2029. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminTeamsSettingsInfoResponse.js +0 -0
  2030. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminTeamsSettingsSetDefaultChannelsResponse.js +0 -0
  2031. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminTeamsSettingsSetDescriptionResponse.js +0 -0
  2032. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminTeamsSettingsSetDiscoverabilityResponse.js +0 -0
  2033. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminTeamsSettingsSetIconResponse.js +0 -0
  2034. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminTeamsSettingsSetNameResponse.js +0 -0
  2035. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminUsergroupsAddChannelsResponse.js +0 -0
  2036. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminUsergroupsAddTeamsResponse.js +0 -0
  2037. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminUsergroupsListChannelsResponse.js +0 -0
  2038. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminUsergroupsRemoveChannelsResponse.js +0 -0
  2039. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminUsersAssignResponse.js +0 -0
  2040. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminUsersInviteResponse.js +0 -0
  2041. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminUsersListResponse.js +0 -0
  2042. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminUsersRemoveResponse.js +0 -0
  2043. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminUsersSessionClearSettingsResponse.js +0 -0
  2044. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminUsersSessionGetSettingsResponse.js +0 -0
  2045. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminUsersSessionInvalidateResponse.js +0 -0
  2046. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminUsersSessionListResponse.js +0 -0
  2047. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminUsersSessionResetBulkResponse.js +0 -0
  2048. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminUsersSessionResetResponse.js +0 -0
  2049. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminUsersSessionSetSettingsResponse.js +0 -0
  2050. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminUsersSetAdminResponse.js +0 -0
  2051. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminUsersSetExpirationResponse.js +0 -0
  2052. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminUsersSetOwnerResponse.js +0 -0
  2053. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminUsersSetRegularResponse.js +0 -0
  2054. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminUsersUnsupportedVersionsExportResponse.js +0 -0
  2055. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminWorkflowsCollaboratorsAddResponse.js +0 -0
  2056. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminWorkflowsCollaboratorsRemoveResponse.js +0 -0
  2057. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminWorkflowsPermissionsLookupResponse.js +0 -0
  2058. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminWorkflowsSearchResponse.js +0 -0
  2059. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AdminWorkflowsUnpublishResponse.js +0 -0
  2060. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ApiTestResponse.js +0 -0
  2061. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AppsConnectionsOpenResponse.js +0 -0
  2062. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AppsEventAuthorizationsListResponse.js +0 -0
  2063. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AppsManifestCreateResponse.js +0 -0
  2064. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AppsManifestDeleteResponse.js +0 -0
  2065. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AppsManifestExportResponse.js +0 -0
  2066. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AppsManifestUpdateResponse.js +0 -0
  2067. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AppsManifestValidateResponse.js +0 -0
  2068. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AppsPermissionsInfoResponse.js +0 -0
  2069. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AppsPermissionsRequestResponse.js +0 -0
  2070. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AppsPermissionsResourcesListResponse.js +0 -0
  2071. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AppsPermissionsScopesListResponse.js +0 -0
  2072. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AppsPermissionsUsersListResponse.js +0 -0
  2073. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AppsPermissionsUsersRequestResponse.js +0 -0
  2074. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AppsUninstallResponse.js +0 -0
  2075. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AppsUserConnectionUpdateResponse.js +0 -0
  2076. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AssistantThreadsSetStatusResponse.js +0 -0
  2077. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AssistantThreadsSetSuggestedPromptsResponse.js +0 -0
  2078. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AssistantThreadsSetTitleResponse.js +0 -0
  2079. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AuthRevokeResponse.js +0 -0
  2080. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AuthTeamsListResponse.js +0 -0
  2081. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/AuthTestResponse.js +0 -0
  2082. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/BookmarksAddResponse.js +0 -0
  2083. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/BookmarksEditResponse.js +0 -0
  2084. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/BookmarksListResponse.js +0 -0
  2085. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/BookmarksRemoveResponse.js +0 -0
  2086. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/BotsInfoResponse.js +0 -0
  2087. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/CallsAddResponse.js +0 -0
  2088. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/CallsEndResponse.js +0 -0
  2089. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/CallsInfoResponse.js +0 -0
  2090. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/CallsParticipantsAddResponse.js +0 -0
  2091. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/CallsParticipantsRemoveResponse.js +0 -0
  2092. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/CallsUpdateResponse.js +0 -0
  2093. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/CanvasesAccessDeleteResponse.js +0 -0
  2094. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/CanvasesAccessSetResponse.js +0 -0
  2095. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/CanvasesCreateResponse.js +0 -0
  2096. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/CanvasesDeleteResponse.js +0 -0
  2097. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/CanvasesEditResponse.js +0 -0
  2098. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/CanvasesSectionsLookupResponse.js +0 -0
  2099. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChannelsArchiveResponse.js +0 -0
  2100. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChannelsCreateResponse.js +0 -0
  2101. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChannelsHistoryResponse.js +0 -0
  2102. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChannelsInfoResponse.js +0 -0
  2103. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChannelsInviteResponse.js +0 -0
  2104. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChannelsJoinResponse.js +0 -0
  2105. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChannelsKickResponse.js +0 -0
  2106. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChannelsLeaveResponse.js +0 -0
  2107. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChannelsListResponse.js +0 -0
  2108. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChannelsMarkResponse.js +0 -0
  2109. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChannelsRenameResponse.js +0 -0
  2110. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChannelsRepliesResponse.js +0 -0
  2111. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChannelsSetPurposeResponse.js +0 -0
  2112. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChannelsSetTopicResponse.js +0 -0
  2113. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChannelsUnarchiveResponse.js +0 -0
  2114. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChatDeleteResponse.js +0 -0
  2115. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChatDeleteScheduledMessageResponse.js +0 -0
  2116. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChatGetPermalinkResponse.js +0 -0
  2117. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChatMeMessageResponse.js +0 -0
  2118. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChatPostEphemeralResponse.js +0 -0
  2119. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChatPostMessageResponse.js +0 -0
  2120. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChatScheduleMessageResponse.js +0 -0
  2121. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChatScheduledMessagesListResponse.js +0 -0
  2122. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChatUnfurlResponse.js +0 -0
  2123. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ChatUpdateResponse.js +0 -0
  2124. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsAcceptSharedInviteResponse.js +0 -0
  2125. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsApproveSharedInviteResponse.js +0 -0
  2126. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsArchiveResponse.js +0 -0
  2127. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsCanvasesCreateResponse.js +0 -0
  2128. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsCloseResponse.js +0 -0
  2129. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsCreateResponse.js +0 -0
  2130. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsDeclineSharedInviteResponse.js +0 -0
  2131. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsExternalInvitePermissionsSetResponse.js +0 -0
  2132. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsHistoryResponse.js +0 -0
  2133. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsInfoResponse.js +0 -0
  2134. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsInviteResponse.js +0 -0
  2135. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsInviteSharedResponse.js +0 -0
  2136. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsJoinResponse.js +0 -0
  2137. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsKickResponse.js +0 -0
  2138. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsLeaveResponse.js +0 -0
  2139. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsListConnectInvitesResponse.js +0 -0
  2140. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsListResponse.js +0 -0
  2141. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsMarkResponse.js +0 -0
  2142. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsMembersResponse.js +0 -0
  2143. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsOpenResponse.js +0 -0
  2144. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsRenameResponse.js +0 -0
  2145. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsRepliesResponse.js +0 -0
  2146. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsRequestSharedInviteApproveResponse.js +0 -0
  2147. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsRequestSharedInviteDenyResponse.js +0 -0
  2148. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsRequestSharedInviteListResponse.js +0 -0
  2149. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsSetPurposeResponse.js +0 -0
  2150. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsSetTopicResponse.js +0 -0
  2151. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ConversationsUnarchiveResponse.js +0 -0
  2152. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/DialogOpenResponse.js +0 -0
  2153. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/DndEndDndResponse.js +0 -0
  2154. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/DndEndSnoozeResponse.js +0 -0
  2155. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/DndInfoResponse.js +0 -0
  2156. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/DndSetSnoozeResponse.js +0 -0
  2157. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/DndTeamInfoResponse.js +0 -0
  2158. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/EmojiListResponse.js +0 -0
  2159. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/EntityPresentDetailsResponse.js +0 -0
  2160. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/FilesCommentsAddResponse.js +0 -0
  2161. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/FilesCommentsDeleteResponse.js +0 -0
  2162. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/FilesCommentsEditResponse.js +0 -0
  2163. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/FilesCompleteUploadExternalResponse.js +0 -0
  2164. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/FilesDeleteResponse.js +0 -0
  2165. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/FilesGetUploadURLExternalResponse.js +0 -0
  2166. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/FilesInfoResponse.js +0 -0
  2167. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/FilesListResponse.js +0 -0
  2168. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/FilesRemoteAddResponse.js +0 -0
  2169. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/FilesRemoteInfoResponse.js +0 -0
  2170. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/FilesRemoteListResponse.js +0 -0
  2171. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/FilesRemoteRemoveResponse.js +0 -0
  2172. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/FilesRemoteShareResponse.js +0 -0
  2173. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/FilesRemoteUpdateResponse.js +0 -0
  2174. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/FilesRevokePublicURLResponse.js +0 -0
  2175. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/FilesSharedPublicURLResponse.js +0 -0
  2176. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/FilesUploadResponse.js +0 -0
  2177. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/FunctionsCompleteErrorResponse.js +0 -0
  2178. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/FunctionsCompleteSuccessResponse.js +0 -0
  2179. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/GroupsArchiveResponse.js +0 -0
  2180. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/GroupsCloseResponse.js +0 -0
  2181. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/GroupsCreateChildResponse.js +0 -0
  2182. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/GroupsCreateResponse.js +0 -0
  2183. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/GroupsHistoryResponse.js +0 -0
  2184. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/GroupsInfoResponse.js +0 -0
  2185. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/GroupsInviteResponse.js +0 -0
  2186. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/GroupsKickResponse.js +0 -0
  2187. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/GroupsLeaveResponse.js +0 -0
  2188. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/GroupsListResponse.js +0 -0
  2189. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/GroupsMarkResponse.js +0 -0
  2190. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/GroupsOpenResponse.js +0 -0
  2191. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/GroupsRenameResponse.js +0 -0
  2192. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/GroupsRepliesResponse.js +0 -0
  2193. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/GroupsSetPurposeResponse.js +0 -0
  2194. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/GroupsSetTopicResponse.js +0 -0
  2195. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/GroupsUnarchiveResponse.js +0 -0
  2196. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ImCloseResponse.js +0 -0
  2197. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ImHistoryResponse.js +0 -0
  2198. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ImListResponse.js +0 -0
  2199. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ImMarkResponse.js +0 -0
  2200. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ImOpenResponse.js +0 -0
  2201. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ImRepliesResponse.js +0 -0
  2202. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/MigrationExchangeResponse.js +0 -0
  2203. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/MpimCloseResponse.js +0 -0
  2204. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/MpimHistoryResponse.js +0 -0
  2205. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/MpimListResponse.js +0 -0
  2206. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/MpimMarkResponse.js +0 -0
  2207. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/MpimOpenResponse.js +0 -0
  2208. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/MpimRepliesResponse.js +0 -0
  2209. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/OauthAccessResponse.js +0 -0
  2210. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/OauthTokenResponse.js +0 -0
  2211. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/OauthV2AccessResponse.js +0 -0
  2212. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/OauthV2ExchangeResponse.js +0 -0
  2213. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/OpenIDConnectTokenResponse.js +0 -0
  2214. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/OpenIDConnectUserInfoResponse.js +0 -0
  2215. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/PinsAddResponse.js +0 -0
  2216. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/PinsRemoveResponse.js +0 -0
  2217. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ReactionsAddResponse.js +0 -0
  2218. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ReactionsGetResponse.js +0 -0
  2219. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ReactionsListResponse.js +0 -0
  2220. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ReactionsRemoveResponse.js +0 -0
  2221. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/RemindersAddResponse.js +0 -0
  2222. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/RemindersCompleteResponse.js +0 -0
  2223. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/RemindersDeleteResponse.js +0 -0
  2224. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/RemindersInfoResponse.js +0 -0
  2225. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/RemindersListResponse.js +0 -0
  2226. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/RtmConnectResponse.js +0 -0
  2227. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/RtmStartResponse.js +0 -0
  2228. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/SearchMessagesResponse.js +0 -0
  2229. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/StarsAddResponse.js +0 -0
  2230. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/StarsListResponse.js +0 -0
  2231. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/StarsRemoveResponse.js +0 -0
  2232. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/TeamAccessLogsResponse.js +0 -0
  2233. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/TeamBillableInfoResponse.js +0 -0
  2234. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/TeamBillingInfoResponse.js +0 -0
  2235. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/TeamExternalTeamsDisconnectResponse.js +0 -0
  2236. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/TeamExternalTeamsListResponse.js +0 -0
  2237. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/TeamInfoResponse.js +0 -0
  2238. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/TeamIntegrationLogsResponse.js +0 -0
  2239. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/TeamPreferencesListResponse.js +0 -0
  2240. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/TeamProfileGetResponse.js +0 -0
  2241. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ToolingTokensRotateResponse.js +0 -0
  2242. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/UsergroupsCreateResponse.js +0 -0
  2243. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/UsergroupsDisableResponse.js +0 -0
  2244. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/UsergroupsEnableResponse.js +0 -0
  2245. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/UsergroupsListResponse.js +0 -0
  2246. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/UsergroupsUpdateResponse.js +0 -0
  2247. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/UsergroupsUsersListResponse.js +0 -0
  2248. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/UsergroupsUsersUpdateResponse.js +0 -0
  2249. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/UsersConversationsResponse.js +0 -0
  2250. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/UsersDeletePhotoResponse.js +0 -0
  2251. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/UsersDiscoverableContactsLookupResponse.js +0 -0
  2252. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/UsersGetPresenceResponse.js +0 -0
  2253. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/UsersIdentityResponse.js +0 -0
  2254. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/UsersInfoResponse.js +0 -0
  2255. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/UsersListResponse.js +0 -0
  2256. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/UsersLookupByEmailResponse.js +0 -0
  2257. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/UsersProfileGetResponse.js +0 -0
  2258. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/UsersProfileSetResponse.js +0 -0
  2259. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/UsersSetActiveResponse.js +0 -0
  2260. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/UsersSetPhotoResponse.js +0 -0
  2261. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/UsersSetPresenceResponse.js +0 -0
  2262. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ViewsOpenResponse.js +0 -0
  2263. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ViewsPublishResponse.js +0 -0
  2264. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ViewsPushResponse.js +0 -0
  2265. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/ViewsUpdateResponse.js +0 -0
  2266. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/WorkflowsStepCompletedResponse.js +0 -0
  2267. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/WorkflowsStepFailedResponse.js +0 -0
  2268. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/WorkflowsUpdateStepResponse.js +0 -0
  2269. /package/node_modules/{@maka/runtime/node_modules/@slack → @slack}/web-api/dist/types/response/index.js +0 -0
  2270. /package/node_modules/{@maka/runtime → @slack/web-api}/node_modules/retry/License +0 -0
  2271. /package/node_modules/{@maka/runtime → @slack/web-api}/node_modules/retry/README.md +0 -0
  2272. /package/node_modules/{@maka/runtime → @slack/web-api}/node_modules/retry/example/dns.js +0 -0
  2273. /package/node_modules/{@maka/runtime → @slack/web-api}/node_modules/retry/example/stop.js +0 -0
  2274. /package/node_modules/{@maka/runtime → @slack/web-api}/node_modules/retry/index.js +0 -0
  2275. /package/node_modules/{@maka/runtime → @slack/web-api}/node_modules/retry/lib/retry.js +0 -0
  2276. /package/node_modules/{@maka/runtime → @slack/web-api}/node_modules/retry/lib/retry_operation.js +0 -0
  2277. /package/node_modules/{@maka/runtime → @slack/web-api}/node_modules/retry/package.json +0 -0
@@ -16,431 +16,28 @@
16
16
  * specific language governing permissions and limitations
17
17
  * under the License.
18
18
  */
19
- import { DEFAULT_TOOL_MODE, isToolMode } from '@maka/core/tool-mode';
20
- import { resolveEffectiveOrchestration, } from '@maka/core/orchestration';
21
- import { bindToolResultArchiveDecoder, } from './tool-result-archive-capability.js';
22
- import { YIELD_AGENT_GRAPH_TOOL_NAME, } from './stream-graph-supervisor-tools.js';
23
- import { MAX_PROVIDER_IMAGE_REQUEST_BYTES, PROVIDER_IMAGE_BUDGET_EXCEEDED_MESSAGE, } from '@maka/core/attachments';
24
- import { stripUndefinedDeep } from '@maka/core/tool-args-identity';
25
19
  import { pricingModelKey } from '@maka/core/usage-stats/pricing';
26
- import Ajv from 'ajv';
27
- import Ajv2019 from 'ajv/dist/2019.js';
28
- import Ajv2020 from 'ajv/dist/2020.js';
29
- import { z } from 'zod';
30
- import { AsyncEventQueue } from './async-queue.js';
31
20
  import { AdmissionLimiter } from './admission-limiter.js';
32
- import { DEFAULT_CODE_MODE_EXECUTION_POLICY, executeCodeCell, } from './code-mode.js';
33
- import { StreamWatchdog, formatStreamWatchdogError, } from './stream-watchdog.js';
34
- import { ToolRuntime, formatSyntheticToolErrorText, formatToolArgsViolationText, isRuntimeCommitBoundaryError, } from './tool-runtime.js';
35
- import { ModelAdapter, } from './model-adapter.js';
21
+ import { ToolRuntime, } from './tool-runtime.js';
22
+ import { ModelAdapter } from './model-adapter.js';
36
23
  import { buildProviderOptions } from './model-factory.js';
37
- import { persistedOpenAiResponsesStepMessages } from './openai-responses-continuation.js';
38
- import { composeRequestProjection, } from './request-projection.js';
39
- import { decodePlaintextResponsesReasoningState, replayPlaintextResponsesProviderOptions, responsesReasoningItemId, } from './responses-reasoning-state.js';
40
- import { toolResultOutput } from './tool-result-output.js';
41
- import { contextDiagnosticsCompactionOf, } from './context-diagnostics.js';
42
- import { AiSdkCompaction, hasActiveToolResultPruneDiagnosticPatch, hasBlockingReplayDiagnostics, } from './ai-sdk-compaction.js';
43
- import { openAiChatReasoningFieldFromProviderOptions } from './openai-chat-reasoning-transport.js';
44
- import { RunTrace } from './run-trace.js';
45
- import { toSandboxRunTraceProjection, } from './sandbox/diagnostics.js';
46
- import { SandboxCommandError } from './sandbox/errors.js';
47
- import { REQUEST_SANDBOX_BOUNDARY_TOOL_NAME, SANDBOX_BOUNDARY_DENIED_FOR_TURN, SANDBOX_BOUNDARY_FINALIZATION_PROMPT, } from './sandbox-boundary-tool.js';
48
- import { renderSandboxTurnTailPrompt } from './system-prompt/sandbox-context-prompt.js';
49
- import { computeCost } from './telemetry/cost.js';
24
+ import { AiSdkCompaction } from './ai-sdk-compaction.js';
50
25
  import { getBuiltinPricing } from './telemetry/builtin-pricing.js';
51
- import { buildRuntimeEventModelReplayPlan, buildSteeringEnvelope, collectToolActivityTurnIds, formatTextWithInlineRefs, steeringMessagesMissingFromBase, steeringModelMessage, steeringProviderOptions, } from './model-history.js';
52
- import { computeRequestShapeDiagnostic, toolSchemaCharsForDiagnostics, } from './request-shape.js';
53
- import { ProviderRequestTracker, } from './provider-request-telemetry.js';
54
- import { ToolAvailabilityRuntime, } from './tool-availability.js';
55
- import { renderSwarmModePrompt } from './swarm-mode.js';
56
- import { renderGraphModePrompt } from './graph-mode.js';
26
+ import { ProviderRequestTelemetry } from './provider-request-telemetry.js';
27
+ import { AiSdkMessageProjection } from './ai-sdk-message-projection.js';
28
+ import { AiSdkTurn } from './ai-sdk-turn.js';
29
+ import { buildInvalidMakaTool } from './ai-sdk-tool-repair.js';
30
+ import { ToolAvailabilityRuntime } from './tool-availability.js';
57
31
  import { MEMORY_EXTRACT_TOOL_NAME, MEMORY_REMEMBER_TOOL_NAME, buildMemoryExtractionTriggerTools, } from './memory-extraction.js';
58
- import { modelUsesNativeOpenAiResponses, resolveModelRuntime } from './model-runtime.js';
59
- import { applyPatchReplayFactText, normalizeApplyPatchReplayInput, routeApplyPatchTools, } from './apply-patch-profile.js';
60
- import { applyRuntimeEventContextBudget, buildContextBudgetDiagnosticShell, buildPromptSegmentEstimates, estimateRuntimeEventsTokens, mergeContextBudgetDiagnostic, mergeContextBudgetDiagnosticPatches, minimalContextBudgetDiagnostic, shouldAppendContextCompactedNote, shouldAppendContextCompactionFailedOpenNote, } from './context-budget.js';
61
- import { evaluateHistoryCompactCheckpointReplay, isHistoryCompactContentEvent, } from './history-compaction.js';
62
- import { canContinueHistoryCompactCheckpointForModel, historyCompactCheckpointToModelMessage, isProviderHistoryCompactCheckpoint, matchHistoryCompactCheckpointPrefix, projectHistoryCompactCheckpointReplay, } from './history-compact-checkpoint.js';
63
- import { isMalformedHistoryCompactSummaryReason } from './history-compact-error.js';
32
+ import { resolveModelRuntime } from './model-runtime.js';
33
+ import { routeApplyPatchTools } from './apply-patch-profile.js';
34
+ import { bindToolResultArchiveDecoder } from './tool-result-archive-capability.js';
64
35
  import { resolveSelectedModelContextWindow } from './context-budget-policy.js';
65
36
  export { DEFAULT_PERMISSION_TIMEOUT_MS, MAX_ACTIVE_CHILD_AGENT_RUNS_PER_TURN, MAX_ACTIVE_SUBAGENT_TOOLS_PER_TURN, TOOL_ERROR_RESULT_MAX_CHARS, formatSyntheticToolErrorText, } from './tool-runtime.js';
66
37
  export { normalizeAiSdkUsage } from './model-adapter.js';
67
- const CHILD_STEP_BUDGET_FINALIZATION_PROMPT = [
68
- '<step_budget_finalization>',
69
- 'This is the final budgeted step for this child-agent turn.',
70
- 'Do not call tools. Return the best concise final answer now using evidence already gathered.',
71
- 'Clearly separate verified findings from inference and explicitly name any remaining gaps.',
72
- '</step_budget_finalization>',
73
- ].join('\n');
74
- function providerToolResultContent(toolName, output, input) {
75
- if (output === undefined) {
76
- return {
77
- kind: 'text',
78
- text: `${toolName} completed without a structured result.`,
79
- };
80
- }
81
- if (toolName !== 'WebSearch') {
82
- return { kind: 'json', value: output };
83
- }
84
- const queryFromInput = providerWebSearchQuery(input);
85
- if (Array.isArray(output)) {
86
- const rows = [];
87
- for (const result of output) {
88
- if (!result ||
89
- typeof result !== 'object' ||
90
- result.type !== 'web_search_result' ||
91
- typeof result.url !== 'string') {
92
- continue;
93
- }
94
- const item = result;
95
- try {
96
- const parsed = new URL(item.url);
97
- if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:')
98
- continue;
99
- rows.push({
100
- title: typeof item.title === 'string' && item.title.trim() ? item.title : parsed.hostname,
101
- url: parsed.toString(),
102
- snippet: typeof item.pageAge === 'string' ? item.pageAge : '',
103
- source: parsed.hostname,
104
- });
105
- }
106
- catch {
107
- // Provider source rows are untrusted; malformed URLs are dropped.
108
- }
109
- }
110
- return {
111
- kind: 'web_search',
112
- provider: 'model',
113
- query: queryFromInput,
114
- rows,
115
- };
116
- }
117
- if (!output || typeof output !== 'object')
118
- return { kind: 'json', value: output };
119
- const providerError = output;
120
- if (providerError.type === 'web_search_tool_result_error' ||
121
- typeof providerError.errorCode === 'string') {
122
- return {
123
- kind: 'web_search_error',
124
- ok: false,
125
- provider: 'model',
126
- ...(queryFromInput ? { query: queryFromInput } : {}),
127
- reason: 'provider_error',
128
- message: typeof providerError.errorCode === 'string'
129
- ? `Provider web search failed: ${providerError.errorCode}`
130
- : 'Provider web search failed.',
131
- };
132
- }
133
- const action = output.action;
134
- const sources = output.sources;
135
- let query = queryFromInput;
136
- if (action && typeof action === 'object') {
137
- const value = action;
138
- if (Array.isArray(value.queries)) {
139
- query = value.queries.filter((item) => typeof item === 'string').join(' | ');
140
- }
141
- else if (typeof value.query === 'string') {
142
- query = value.query;
143
- }
144
- }
145
- const rows = [];
146
- if (Array.isArray(sources)) {
147
- for (const source of sources) {
148
- if (!source ||
149
- typeof source !== 'object' ||
150
- source.type !== 'url' ||
151
- typeof source.url !== 'string') {
152
- continue;
153
- }
154
- const url = source.url;
155
- try {
156
- const parsed = new URL(url);
157
- if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:')
158
- continue;
159
- rows.push({
160
- title: parsed.hostname,
161
- url: parsed.toString(),
162
- snippet: '',
163
- source: parsed.hostname,
164
- });
165
- }
166
- catch {
167
- // Provider source rows are untrusted; malformed URLs are dropped.
168
- }
169
- }
170
- }
171
- return { kind: 'web_search', provider: 'model', query, rows };
172
- }
173
- function providerWebSearchQuery(input) {
174
- let value = input;
175
- if (typeof input === 'string') {
176
- try {
177
- value = JSON.parse(input);
178
- }
179
- catch {
180
- return '';
181
- }
182
- }
183
- if (!value || typeof value !== 'object')
184
- return '';
185
- const query = value.query;
186
- return typeof query === 'string' ? query : '';
187
- }
188
- function mergeTextProviderOptions(current, next, textOffset) {
189
- const shifted = structuredClone(next);
190
- const shiftedOpenAi = shifted.openai;
191
- if (shiftedOpenAi && typeof shiftedOpenAi === 'object' && !Array.isArray(shiftedOpenAi)) {
192
- const annotations = shiftedOpenAi.annotations;
193
- if (Array.isArray(annotations) && textOffset > 0) {
194
- shiftedOpenAi.annotations = annotations.map((annotation) => {
195
- if (!annotation || typeof annotation !== 'object' || Array.isArray(annotation)) {
196
- return annotation;
197
- }
198
- const value = { ...annotation };
199
- if (typeof value.startIndex === 'number')
200
- value.startIndex += textOffset;
201
- if (typeof value.endIndex === 'number')
202
- value.endIndex += textOffset;
203
- if (typeof value.start_index === 'number')
204
- value.start_index += textOffset;
205
- if (typeof value.end_index === 'number')
206
- value.end_index += textOffset;
207
- return value;
208
- });
209
- }
210
- }
211
- if (!current)
212
- return shifted;
213
- const merged = { ...structuredClone(current), ...shifted };
214
- const currentOpenAi = current.openai;
215
- if (currentOpenAi &&
216
- typeof currentOpenAi === 'object' &&
217
- !Array.isArray(currentOpenAi) &&
218
- shiftedOpenAi &&
219
- typeof shiftedOpenAi === 'object' &&
220
- !Array.isArray(shiftedOpenAi)) {
221
- const left = currentOpenAi;
222
- const right = shiftedOpenAi;
223
- const openai = { ...left, ...right };
224
- const leftAnnotations = Array.isArray(left.annotations) ? left.annotations : [];
225
- const rightAnnotations = Array.isArray(right.annotations) ? right.annotations : [];
226
- if (leftAnnotations.length > 0 || rightAnnotations.length > 0) {
227
- openai.annotations = [...leftAnnotations, ...rightAnnotations];
228
- }
229
- if (typeof left.itemId === 'string' &&
230
- typeof right.itemId === 'string' &&
231
- left.itemId !== right.itemId) {
232
- delete openai.itemId;
233
- }
234
- merged.openai = openai;
235
- }
236
- return merged;
237
- }
238
- export const INVALID_TOOL_NAME = 'invalid';
239
- function projectToolModePlan(plan, toolMode, execTool) {
240
- if (toolMode === 'direct')
241
- return plan;
242
- const withExec = (names) => [...new Set([...names, execTool.name])].sort((a, b) => a.localeCompare(b));
243
- const invalid = plan.providerTools.filter((tool) => tool.name === INVALID_TOOL_NAME);
244
- const visible = [
245
- ...plan.providerTools.filter((tool) => tool.name !== INVALID_TOOL_NAME),
246
- execTool,
247
- ].sort((a, b) => a.name.localeCompare(b.name));
248
- return {
249
- ...plan,
250
- providerTools: [...visible, ...invalid],
251
- activeTools: withExec(plan.activeTools),
252
- ...(plan.projectActiveTools
253
- ? {
254
- projectActiveTools: (options) => ({
255
- activeTools: withExec(plan.projectActiveTools?.(options).activeTools ?? []),
256
- }),
257
- }
258
- : {}),
259
- currentRepairToolNames: () => withExec(plan.currentRepairToolNames()),
260
- diagnostics: (activeTools, visibleToolSchemaChars) => {
261
- const baseActive = activeTools.filter((name) => name !== execTool.name);
262
- const baseChars = toolSchemaCharsForDiagnostics(plan.providerTools, baseActive);
263
- const diagnostic = plan.diagnostics(baseActive, baseChars);
264
- if (!diagnostic)
265
- return undefined;
266
- const execSchemaChars = Math.max(0, visibleToolSchemaChars - baseChars);
267
- return {
268
- ...diagnostic,
269
- visibleToolCount: (diagnostic.visibleToolCount ?? baseActive.length) + 1,
270
- fullToolCount: (diagnostic.fullToolCount ?? baseActive.length + (diagnostic.hiddenToolCount ?? 0)) + 1,
271
- visibleToolSchemaChars,
272
- fullToolSchemaChars: (diagnostic.fullToolSchemaChars ??
273
- baseChars + (diagnostic.toolSchemaCharReduction ?? 0)) + execSchemaChars,
274
- };
275
- },
276
- };
277
- }
278
- function nestableToolSnapshot(providerTools, activeToolNames) {
279
- const active = new Set(activeToolNames);
280
- return new Map(providerTools
281
- .filter((tool) => active.has(tool.name) &&
282
- tool.name !== INVALID_TOOL_NAME &&
283
- tool.name !== 'exec' &&
284
- tool.providerTool === undefined &&
285
- tool.nesting !== 'direct_only')
286
- .map((tool) => [tool.name, tool]));
287
- }
288
- const codeModeJsonSchemaOptions = {
289
- allErrors: true,
290
- strict: false,
291
- validateFormats: false,
292
- };
293
- const codeModeDraft7Validator = new Ajv(codeModeJsonSchemaOptions);
294
- const codeModeDraft2019Validator = new Ajv2019(codeModeJsonSchemaOptions);
295
- const codeModeDraft2020Validator = new Ajv2020(codeModeJsonSchemaOptions);
296
- const codeModeCompiledSchemas = new WeakMap();
297
- async function validateCodeModeToolInput(tool, input) {
298
- const parameters = tool.parameters;
299
- const parserResult = parameters.safeParseAsync
300
- ? await parameters.safeParseAsync(input)
301
- : parameters.safeParse?.(input);
302
- if (parserResult) {
303
- if (parserResult.success)
304
- return parserResult.data;
305
- throw invalidCodeModeToolArguments(tool.name, parserResult.error);
306
- }
307
- if (parameters.validate) {
308
- const validationResult = await parameters.validate(input);
309
- if (validationResult.success)
310
- return validationResult.value;
311
- throw invalidCodeModeToolArguments(tool.name, validationResult.error);
312
- }
313
- const schema = await parameters.jsonSchema;
314
- const validator = compileCodeModeJsonSchema(schema ?? tool.parameters);
315
- if (!validator || validator(input))
316
- return input;
317
- throw invalidCodeModeToolArguments(tool.name, validator.errors);
318
- }
319
- function compileCodeModeJsonSchema(schema) {
320
- if (typeof schema === 'boolean')
321
- return codeModeDraft2020Validator.compile(schema);
322
- if (typeof schema !== 'object' || schema === null || Array.isArray(schema))
323
- return undefined;
324
- const cached = codeModeCompiledSchemas.get(schema);
325
- if (cached)
326
- return cached;
327
- const declaredDialect = schema.$schema;
328
- const dialect = typeof declaredDialect === 'string' ? declaredDialect : '';
329
- const validator = dialect.includes('draft-07')
330
- ? codeModeDraft7Validator
331
- : dialect.includes('2019-09')
332
- ? codeModeDraft2019Validator
333
- : codeModeDraft2020Validator;
334
- const schemaForCompile = dialect.startsWith('https://json-schema.org/draft-07/schema')
335
- ? { ...schema, $schema: dialect.replace('https://', 'http://') }
336
- : schema;
337
- const compiled = validator.compile(schemaForCompile);
338
- codeModeCompiledSchemas.set(schema, compiled);
339
- return compiled;
340
- }
341
- function invalidCodeModeToolArguments(toolName, error) {
342
- return new Error(`Invalid arguments for tool "${toolName}": ${schemaErrorSummary(error)}`);
343
- }
344
- function schemaErrorSummary(error) {
345
- if (error && typeof error === 'object' && Array.isArray(error.issues)) {
346
- const issues = error.issues;
347
- return issues
348
- .slice(0, 5)
349
- .map((issue) => {
350
- const path = Array.isArray(issue.path) ? issue.path.join('.') : '';
351
- const message = typeof issue.message === 'string' ? issue.message : 'invalid value';
352
- return path ? `${path}: ${message}` : message;
353
- })
354
- .join('; ')
355
- .slice(0, 1000);
356
- }
357
- if (Array.isArray(error)) {
358
- return error
359
- .slice(0, 5)
360
- .map((issue) => {
361
- const path = issue.instancePath || issue.schemaPath;
362
- return `${path || 'input'} ${issue.message ?? 'is invalid'}`;
363
- })
364
- .join('; ')
365
- .slice(0, 1000);
366
- }
367
- return 'input does not match the declared schema';
368
- }
369
- function joinPromptFragments(fragments) {
370
- const joined = fragments
371
- .map((fragment) => fragment?.trim())
372
- .filter((fragment) => Boolean(fragment))
373
- .join('\n\n');
374
- return joined.length > 0 ? joined : undefined;
375
- }
376
- function appendNonVisionImageFallbackNotice(textContent) {
377
- return `${textContent}\n\n[image attachments omitted: the selected model does not support image input. Tell the user you cannot view the attached image(s) and ask them to describe the image or switch to a vision-capable model.]`;
378
- }
379
- function isImageToolResult(value) {
380
- if (!value || typeof value !== 'object')
381
- return false;
382
- const image = value;
383
- return (image.kind === 'image' &&
384
- typeof image.mimeType === 'string' &&
385
- image.ref !== null &&
386
- typeof image.ref === 'object');
387
- }
388
- function toolResultText(text) {
389
- return { type: 'content', value: [{ type: 'text', text }] };
390
- }
391
- function nativeApplyPatchFailureOutput(output) {
392
- const value = output.type === 'json' || output.type === 'error-json' ? output.value : undefined;
393
- const record = value && typeof value === 'object' && !Array.isArray(value) ? value : undefined;
394
- const message = output.type === 'text' || output.type === 'error-text'
395
- ? output.value
396
- : typeof record?.output === 'string'
397
- ? record.output
398
- : typeof record?.text === 'string'
399
- ? record.text
400
- : typeof record?.error === 'string'
401
- ? record.error
402
- : undefined;
403
- return {
404
- type: 'json',
405
- value: { status: 'failed', ...(message ? { output: message } : {}) },
406
- };
407
- }
408
- /**
409
- * One Code Mode cell runs at a time on a backend, with one allowed to wait.
410
- * Widening either needs evidence that concurrent cells are wanted; none exists
411
- * today, and this is the bound the Code Mode adapter enforced before execution
412
- * admission moved to the side that owns it.
413
- */
38
+ export { INVALID_TOOL_NAME, repairMakaToolCall } from './ai-sdk-tool-repair.js';
39
+ /** Bounds Code Mode execution across turns on this backend. */
414
40
  const MAX_ACTIVE_CODE_MODE_CELLS = 1;
415
- const MAX_WAITING_CODE_MODE_CELLS = 1;
416
- const MAX_PROVIDER_ATTEMPTS_PER_STEP = 10;
417
- const MAX_IDLE_WATCHDOG_RETRIES_PER_STEP = 1;
418
- const MAX_INCOMPLETE_STREAM_RETRIES_PER_STEP = 1;
419
- const PROVIDER_RETRY_BASE_DELAY_MS = 1_000;
420
- const PROVIDER_RETRY_MAX_DELAY_MS = 32_000;
421
- const PROVIDER_RETRY_JITTER_FACTOR = 0.25;
422
- function providerRetryDelayMs(failedAttempt, retryAfterMs) {
423
- if (retryAfterMs !== undefined)
424
- return retryAfterMs;
425
- const base = Math.min(PROVIDER_RETRY_BASE_DELAY_MS * 2 ** Math.max(0, failedAttempt - 1), PROVIDER_RETRY_MAX_DELAY_MS);
426
- return Math.ceil(base + Math.random() * PROVIDER_RETRY_JITTER_FACTOR * base);
427
- }
428
- function providerRetryReason(kind) {
429
- switch (kind) {
430
- case 'network':
431
- case 'provider_unavailable':
432
- case 'rate_limit':
433
- case 'timeout':
434
- return kind;
435
- case 'provider_capacity':
436
- return 'provider_capacity';
437
- default:
438
- return 'unknown';
439
- }
440
- }
441
- function isIncompleteProviderFinishReason(reason) {
442
- return reason === undefined || reason === 'other' || reason === 'unknown';
443
- }
444
41
  function sleepForProviderRetry(delayMs, signal) {
445
42
  if (signal.aborted) {
446
43
  return Promise.reject(Object.assign(new Error('aborted'), { name: 'AbortError' }));
@@ -458,91 +55,9 @@ function sleepForProviderRetry(delayMs, signal) {
458
55
  }
459
56
  });
460
57
  }
461
- function raceWithTurnAbort(promise, signal) {
462
- return new Promise((resolve, reject) => {
463
- const cleanup = () => signal.removeEventListener('abort', onAbort);
464
- const onAbort = () => {
465
- cleanup();
466
- reject(turnAbortError());
467
- };
468
- promise.then((value) => {
469
- cleanup();
470
- resolve(value);
471
- }, (error) => {
472
- cleanup();
473
- reject(error);
474
- });
475
- if (signal.aborted)
476
- onAbort();
477
- else
478
- signal.addEventListener('abort', onAbort, { once: true });
479
- });
480
- }
481
- function turnAbortError() {
482
- return Object.assign(new Error('aborted'), { name: 'AbortError' });
483
- }
484
58
  // ============================================================================
485
59
  // Implementation
486
60
  // ============================================================================
487
- /**
488
- * The mutable state of ONE `send()`.
489
- *
490
- * Identity is readonly and captured at dispatch: a tool that executes minutes
491
- * later commits against the run that actually issued it, never against whatever
492
- * run happens to be current when it finishes. The remaining fields are the
493
- * turn's own stream/abort bookkeeping, isolated so an overlapping turn on the
494
- * same backend cannot observe or clear them.
495
- *
496
- * Each scope owns its ToolRuntime for the same reason: gating, the loop gate,
497
- * the subagent and child-run limiters, durable attempts, and step admission are
498
- * all per-turn facts.
499
- */
500
- class TurnScope {
501
- turnId;
502
- runId;
503
- orchestration;
504
- toolRuntime;
505
- abortController = new AbortController();
506
- /** Monotonic provider-visible activations owned by this one send(). */
507
- activeTools = new Map();
508
- aborted = false;
509
- loopStopRequested = false;
510
- loopStopReason;
511
- /** Paused while this turn waits on a user permission decision. */
512
- watchdog = null;
513
- runTrace = null;
514
- /**
515
- * Image allowance for this turn, accumulated across its provider steps. Owned
516
- * by the scope so an overlapping turn cannot spend it, and non-null for the
517
- * scope's whole life so no path has to decide what "no budget" means.
518
- */
519
- imageBudget = { used: 0, decisions: new Map() };
520
- /**
521
- * User messages steered into this turn, drained from the caller's queue at
522
- * step boundaries. Each entry is the canonical envelope-wrapped user
523
- * ModelMessage — the SAME form the replay plan projects the persisted
524
- * steering event as, so the envelope text is the message's identity when
525
- * deduping against ledger-derived request bases (bare text is not an
526
- * identity: a steer can equal the current prompt verbatim). Entries are added
527
- * only AFTER the echoed steering_message event is durably consumed (seq-ack),
528
- * so a provider request never carries an unpersisted steering directive.
529
- */
530
- injectedSteeringMessages = [];
531
- memoryExtractRequested = false;
532
- memorySourceMessages;
533
- memorySourceEventMessagePositions;
534
- memorySourceSystemPrompt;
535
- memorySourceTools;
536
- memorySourceActiveTools;
537
- finalAssistantText;
538
- codeModeTools;
539
- constructor(turnId, runId, orchestration, toolRuntime) {
540
- this.turnId = turnId;
541
- this.runId = runId;
542
- this.orchestration = orchestration;
543
- this.toolRuntime = toolRuntime;
544
- }
545
- }
546
61
  export class AiSdkBackend {
547
62
  kind = 'ai-sdk';
548
63
  sessionId;
@@ -553,8 +68,10 @@ export class AiSdkBackend {
553
68
  maxSteps;
554
69
  providerRetrySleep;
555
70
  modelAdapter;
71
+ messageProjection;
72
+ providerTelemetry;
556
73
  resolvedProviderOptions;
557
- toolAvailabilityRuntime;
74
+ memoryTools;
558
75
  applyPatchProfile;
559
76
  /** Bounds outstanding Code Mode cells on this backend. */
560
77
  codeCellAdmission = new AdmissionLimiter(MAX_ACTIVE_CODE_MODE_CELLS);
@@ -573,16 +90,18 @@ export class AiSdkBackend {
573
90
  * read back as absent.
574
91
  */
575
92
  activeTurns = new Set();
93
+ compaction;
576
94
  /**
577
- * Request-shape baseline for change attribution. Session-scoped on purpose:
578
- * it compares each provider request against whatever this backend sent last,
579
- * across turns.
95
+ * The provider has been reported dropping context, for this backend.
96
+ *
97
+ * Not per send: the condition persists once a provider starts truncating, so
98
+ * a note on every later turn would repeat one fact the user has already been
99
+ * told. The scope is this backend's lifetime rather than the Session's, so a
100
+ * backend that is disposed and rebuilt may say it once more.
580
101
  */
581
- priorRequestShape;
582
- compaction;
583
- /** Session-scoped running total, deliberately accumulated across turns. */
584
- cumulativeUsageCheckpoint;
585
- memoryReplayMessageEvents = new WeakMap();
102
+ turnSessionState = {
103
+ contextProviderDroppingReported: false,
104
+ };
586
105
  constructor(input) {
587
106
  this.input = input;
588
107
  this.sessionId = input.sessionId;
@@ -591,17 +110,19 @@ export class AiSdkBackend {
591
110
  this.maxSteps = input.maxSteps;
592
111
  this.providerRetrySleep = input.providerRetrySleep ?? sleepForProviderRetry;
593
112
  // One resolved options value for every reader: the main call, the
594
- // auxiliary memory-extraction call, and the request-shape diagnostics all
595
- // describe the same request, so they must not disagree on what was sent.
113
+ // auxiliary memory-extraction call, and the provider request all use the
114
+ // same options value, so they cannot disagree on what was sent.
115
+ const runtime = resolveModelRuntime(input.connection, input.modelId);
596
116
  this.resolvedProviderOptions =
597
117
  input.providerOptions ??
598
- buildProviderOptions(input.connection, input.modelId, input.header.thinkingLevel);
118
+ buildProviderOptions(input.connection, input.modelId, input.header.thinkingLevel, runtime);
599
119
  this.modelAdapter = new ModelAdapter({
600
120
  sessionId: input.sessionId,
601
121
  connection: input.connection,
602
122
  apiKey: input.apiKey,
603
123
  modelId: input.modelId,
604
124
  modelFactory: input.modelFactory,
125
+ resolvedRuntime: runtime,
605
126
  // `input.providerOptions` is an override escape hatch: when set it owns
606
127
  // the whole provider-options namespace (including reasoning effort), and
607
128
  // the computed defaults are dropped entirely. Keep providerOptions the
@@ -613,159 +134,79 @@ export class AiSdkBackend {
613
134
  ? { openAiResponsesTransportState: input.openAiResponsesTransportState }
614
135
  : {}),
615
136
  });
137
+ this.providerTelemetry = new ProviderRequestTelemetry({
138
+ sessionId: this.sessionId,
139
+ connectionSlug: input.connection.slug,
140
+ providerId: input.connection.providerType,
141
+ defaultModelId: input.modelId,
142
+ now: this.now,
143
+ newId: this.newId,
144
+ resolveContextWindow: (modelId) => resolveSelectedModelContextWindow(input.connection, modelId),
145
+ resolvePricing: (modelId) => (input.lookupPricing ?? getBuiltinPricing)(pricingModelKey(input.connection.providerType, modelId)),
146
+ recordModelCallAttempt: input.recordModelCallAttempt,
147
+ assertModelCallAccountingReady: input.assertModelCallAccountingReady,
148
+ beforeRunProviderDispatch: input.beforeRunProviderDispatch,
149
+ });
150
+ const applyPatchProfile = runtime.applyPatchProfile;
151
+ this.applyPatchProfile = applyPatchProfile;
152
+ this.messageProjection = new AiSdkMessageProjection({
153
+ modelAdapter: this.modelAdapter,
154
+ applyPatchProfile,
155
+ supportsVision: input.supportsVision,
156
+ readAttachmentBytes: input.readAttachmentBytes,
157
+ maxProviderImageRequestBytes: input.maxProviderImageRequestBytes,
158
+ });
616
159
  this.compaction = new AiSdkCompaction({
617
160
  input,
618
161
  sessionId: this.sessionId,
162
+ targetConnectionId: input.header.llmConnectionId,
163
+ targetProviderStateIdentity: input.providerStateIdentity,
619
164
  now: this.now,
620
165
  modelAdapter: this.modelAdapter,
621
- createProviderRequestTracker: (trackerInput) => this.createProviderRequestTracker(trackerInput),
622
- materializeRuntimeReplayPlan: (plan, imageBudget, checkpoint) => this.materializeRuntimeReplayPlan(plan, imageBudget, undefined, checkpoint),
623
- canReplayProviderNative: (plan) => this.canReplayProviderNative(plan),
624
- appendTurnTailPrompt: (content, turnTailPrompt) => this.appendTurnTailPrompt(content, turnTailPrompt),
166
+ createProviderRequestTracker: (trackerInput) => this.providerTelemetry.createTracker(trackerInput),
167
+ materializeRuntimeReplayPlan: (plan, imageBudget, checkpoint, providerReasoningReplayEventIds) => this.messageProjection.materializeRuntimeReplayPlan(plan, imageBudget, checkpoint, providerReasoningReplayEventIds),
168
+ canReplayProviderNative: (plan) => this.messageProjection.canReplayProviderNative(plan),
625
169
  });
626
170
  if (input.tools.some((tool) => tool.name === MEMORY_REMEMBER_TOOL_NAME || tool.name === MEMORY_EXTRACT_TOOL_NAME)) {
627
171
  throw new Error('Long-term Memory trigger tool names are reserved by Runtime');
628
172
  }
629
- const memoryTools = input.memoryExtraction
173
+ this.memoryTools = input.memoryExtraction
630
174
  ? buildMemoryExtractionTriggerTools({
631
175
  capabilities: input.memoryExtraction,
632
176
  snapshot: (trigger, context) => this.memorySourceSnapshot(trigger, context),
633
177
  markExtractRequested: (context) => {
634
- const scope = [...this.activeTurns].find((candidate) => candidate.turnId === context.turnId && candidate.runId === context.runId);
635
- if (scope)
636
- scope.memoryExtractRequested = true;
178
+ const turn = [...this.activeTurns].find((candidate) => candidate.turnId === context.turnId && candidate.runId === context.runId);
179
+ if (turn)
180
+ turn.memoryExtractRequested = true;
637
181
  },
638
- ...(modelUsesNativeOpenAiResponses(input.connection, input.modelId)
182
+ ...(input.connection.providerType === 'openai' && runtime.wire === 'openai-responses'
639
183
  ? { unsupportedReason: 'provider_unsupported' }
640
184
  : {}),
641
185
  })
642
186
  : [];
643
- const runtime = resolveModelRuntime(input.connection, input.modelId);
644
- this.applyPatchProfile = runtime.applyPatchProfile;
645
- const modelTools = routeApplyPatchTools(input.tools, this.applyPatchProfile);
646
- this.toolAvailabilityRuntime = new ToolAvailabilityRuntime(
647
- // The archive decoder is a runtime protocol tool, not a host binding:
648
- // this session's placeholders name it, so this session advertises it.
649
- bindToolResultArchiveDecoder([...modelTools, ...memoryTools], input.toolResultArchive), input.toolAvailability, buildInvalidMakaTool());
187
+ }
188
+ snapshotToolAvailability() {
189
+ const hostTools = Object.freeze([...(this.input.resolveTools?.() ?? this.input.tools)]);
190
+ if (hostTools.some((tool) => tool.name === MEMORY_REMEMBER_TOOL_NAME || tool.name === MEMORY_EXTRACT_TOOL_NAME)) {
191
+ throw new Error('Long-term Memory trigger tool names are reserved by Runtime');
192
+ }
193
+ const modelTools = routeApplyPatchTools(hostTools, this.applyPatchProfile);
194
+ return {
195
+ hostTools,
196
+ runtime: new ToolAvailabilityRuntime(bindToolResultArchiveDecoder([...modelTools, ...this.memoryTools], this.input.toolResultArchive), this.input.toolAvailability, buildInvalidMakaTool()),
197
+ };
650
198
  }
651
199
  memorySourceSnapshot(trigger, context) {
652
200
  if (trigger !== 'remember')
653
201
  return undefined;
654
- const scope = [...this.activeTurns].find((candidate) => candidate.turnId === context.turnId && candidate.runId === context.runId);
655
- return scope
656
- ? this.memorySourceSnapshotFromScope(scope, {
202
+ const turn = [...this.activeTurns].find((candidate) => candidate.turnId === context.turnId && candidate.runId === context.runId);
203
+ return turn
204
+ ? turn.memorySourceSnapshot({
657
205
  trigger: 'remember',
658
206
  toolCallId: context.toolCallId,
659
207
  })
660
208
  : undefined;
661
209
  }
662
- memorySourceSnapshotFromScope(scope, boundary) {
663
- if (!scope.runId ||
664
- !scope.memorySourceMessages ||
665
- !scope.memorySourceTools ||
666
- !scope.memorySourceActiveTools) {
667
- return undefined;
668
- }
669
- const sourceMessages = boundary.trigger === 'extract' && scope.finalAssistantText
670
- ? [
671
- ...scope.memorySourceMessages,
672
- {
673
- role: 'assistant',
674
- content: [{ type: 'text', text: scope.finalAssistantText }],
675
- },
676
- ]
677
- : scope.memorySourceMessages;
678
- const memoryProjection = projectMemoryConversationPrefix(sourceMessages, scope.memorySourceEventMessagePositions);
679
- return {
680
- ...boundary,
681
- sourceHeader: memoryExtractionModelHeader(this.input.header),
682
- ...(scope.memorySourceSystemPrompt
683
- ? { sourceSystemPrompt: scope.memorySourceSystemPrompt }
684
- : {}),
685
- sourceMessages: structuredClone(memoryProjection.messages),
686
- ...(memoryProjection.eventMessagePositions
687
- ? {
688
- sourceEventMessagePositions: structuredClone(memoryProjection.eventMessagePositions),
689
- }
690
- : {}),
691
- sourceTools: { ...scope.memorySourceTools },
692
- sourceActiveTools: [...scope.memorySourceActiveTools],
693
- sourceProviderOptions: structuredClone(this.resolvedProviderOptions),
694
- ...(this.modelAdapter.maxOutputTokens() !== undefined
695
- ? { sourceMaxOutputTokens: this.modelAdapter.maxOutputTokens() }
696
- : {}),
697
- ...(resolveSelectedModelContextWindow(this.input.connection, this.input.modelId) !== undefined
698
- ? {
699
- sourceContextWindowTokens: resolveSelectedModelContextWindow(this.input.connection, this.input.modelId),
700
- }
701
- : {}),
702
- sessionId: this.sessionId,
703
- runId: scope.runId,
704
- turnId: scope.turnId,
705
- workspaceKey: this.input.header.workspaceRoot,
706
- };
707
- }
708
- dispatchAutomaticMemoryCompaction(scope, dispatch) {
709
- const capabilities = this.input.memoryExtraction;
710
- const boundary = dispatch.checkpoint.memoryExtractionBoundary;
711
- if (!capabilities ||
712
- !scope.runId ||
713
- !boundary ||
714
- modelUsesNativeOpenAiResponses(this.input.connection, this.input.modelId)) {
715
- return;
716
- }
717
- try {
718
- capabilities.extract({
719
- trigger: 'compaction',
720
- sourceHeader: memoryExtractionModelHeader(this.input.header),
721
- // Compaction messages are rebuilt from the durable RuntimeEvent prefix
722
- // inside the background lane, avoiding a full Memory projection here.
723
- sourceMessages: [],
724
- rebuildSourceContextFromCompactionCheckpoint: true,
725
- sourceTools: {},
726
- sourceActiveTools: [],
727
- ...(this.modelAdapter.maxOutputTokens() !== undefined
728
- ? { sourceMaxOutputTokens: this.modelAdapter.maxOutputTokens() }
729
- : {}),
730
- ...(resolveSelectedModelContextWindow(this.input.connection, this.input.modelId) !==
731
- undefined
732
- ? {
733
- sourceContextWindowTokens: resolveSelectedModelContextWindow(this.input.connection, this.input.modelId),
734
- }
735
- : {}),
736
- sessionId: this.sessionId,
737
- runId: scope.runId,
738
- turnId: scope.turnId,
739
- workspaceKey: this.input.header.workspaceRoot,
740
- compactionCheckpointId: dispatch.checkpoint.checkpointId,
741
- compactionBoundaryEventId: boundary.runtimeEventId,
742
- });
743
- }
744
- catch {
745
- // Automatic memory extraction is fail-open and must never perturb the caller.
746
- }
747
- }
748
- automaticMemoryCompactionSupported() {
749
- return (this.input.memoryExtraction !== undefined &&
750
- !modelUsesNativeOpenAiResponses(this.input.connection, this.input.modelId));
751
- }
752
- automaticMemoryCompactionDecision() {
753
- const capabilities = this.input.memoryExtraction;
754
- if (!capabilities)
755
- return { disposition: 'eligible', dispatch: false };
756
- if (this.input.header.subagentParent || this.input.header.isArchived) {
757
- return { disposition: 'policy_denied', dispatch: false };
758
- }
759
- const gate = capabilities.automaticGate?.() ?? {
760
- allowed: false,
761
- reason: 'unavailable',
762
- };
763
- if (gate.allowed)
764
- return { disposition: 'eligible', dispatch: true };
765
- return gate.reason === 'unavailable'
766
- ? { disposition: 'eligible', dispatch: false }
767
- : { disposition: 'policy_denied', dispatch: false };
768
- }
769
210
  /**
770
211
  * One ToolRuntime per `send()`, bound to that turn's identity for its whole
771
212
  * lifetime. The scope is passed in rather than read back so a tool settling
@@ -774,12 +215,13 @@ export class AiSdkBackend {
774
215
  createToolRuntime(identity) {
775
216
  const input = this.input;
776
217
  return new ToolRuntime({
218
+ inheritedSandboxBoundaryDenied: identity.inheritedSandboxBoundaryDenied,
777
219
  sessionId: input.sessionId,
778
220
  header: input.header,
779
221
  connection: input.connection,
780
222
  modelId: input.modelId,
781
- appendMessage: input.appendMessage,
782
223
  readExecutionBoundary: input.readExecutionBoundary,
224
+ readPermissionMode: input.readPermissionMode,
783
225
  createSandboxBoundaryRequest: input.createSandboxBoundaryRequest,
784
226
  settleSandboxBoundaryRequest: input.settleSandboxBoundaryRequest,
785
227
  newId: this.newId,
@@ -790,7 +232,7 @@ export class AiSdkBackend {
790
232
  ...(identity.runId ? { runId: identity.runId } : {}),
791
233
  orchestrationMode: identity.orchestrationMode,
792
234
  ...(identity.invocationId ? { invocationId: identity.invocationId } : {}),
793
- materializeDefaultToolResultOutput: ({ toolCallId, output }) => this.materializeToolResultOutput(identity.scope().imageBudget, output, false, toolCallId),
235
+ prepareDurableProjectionArtifact: input.prepareDurableProjectionArtifact,
794
236
  spawnChildSession: input.spawnChildSession,
795
237
  listChildAgents: input.listChildAgents,
796
238
  readChildAgentOutput: input.readChildAgentOutput,
@@ -800,1737 +242,59 @@ export class AiSdkBackend {
800
242
  recordToolArtifacts: input.recordToolArtifacts,
801
243
  });
802
244
  }
803
- createCodeModeExecTool(scope, eventSink) {
804
- return {
805
- name: 'exec',
806
- description: [
807
- 'Execute a bounded orchestration cell over the active tools.',
808
- 'Use tools.<name>(args), await dependent calls, and Promise.all for independent calls.',
809
- 'The sandbox has no process, filesystem, network, timer, eval, import, or cross-cell state.',
810
- 'Terminate by returning a JSON-serializable value. Failures return a structured diagnostic.',
811
- ].join(' '),
812
- parameters: z.object({ code: z.string() }),
813
- executionSemantics: 'exclusive_step',
814
- nesting: 'direct_only',
815
- recoveryMode: 'never_auto_retry',
816
- impl: (args, context) => this.executeCodeModeCell(scope, eventSink, args.code, context),
817
- };
818
- }
819
245
  // --------------------------------------------------------------------------
820
246
  // manual history compaction
821
247
  // --------------------------------------------------------------------------
822
248
  async compactHistory(input) {
823
- return this.compaction.compactHistory(input, this.priorRequestShape?.requestShapeHash);
249
+ return this.compaction.compactHistory(input);
824
250
  }
825
251
  // --------------------------------------------------------------------------
826
252
  // send()
827
253
  // --------------------------------------------------------------------------
828
- /**
829
- * Register one turn's execution scope, with its own ToolRuntime and identity.
830
- *
831
- * The ToolRuntime holds the scope by reference, so a tool settling long after
832
- * its step still reaches this turn's watchdog, trace, and budget — never a
833
- * successor's. The accessor exists only because the ToolRuntime is built while
834
- * the scope it belongs to is still being constructed.
835
- */
836
- openTurnScope(input) {
837
- const orchestration = input.orchestration ??
838
- resolveEffectiveOrchestration(this.input.header.orchestrationMode, undefined);
839
- let scope;
840
- scope = new TurnScope(input.turnId, input.runId, orchestration, this.createToolRuntime({
841
- turnId: input.turnId,
842
- runId: input.runId,
843
- invocationId: input.invocationId ?? input.runId,
844
- hostedInteraction: input.hostedInteraction,
845
- orchestrationMode: orchestration.mode,
846
- scope: () => scope,
847
- }));
848
- this.activeTurns.add(scope);
849
- return scope;
850
- }
851
- async *send(input) {
852
- // Registration and deregistration live in ONE frame, so a scope that made it
853
- // into activeTurns is always removed exactly once — including when setup
854
- // throws before the provider pump exists (a mismatched hosted Interaction
855
- // Run, an unreadable attachment). A leaked scope would be permanent: nothing
856
- // overwrites a Set entry, and stop()/dispose() only iterate it.
857
- const scope = this.openTurnScope(input);
858
- try {
859
- yield* this.sendWithinScope(scope, input);
860
- }
861
- finally {
862
- await this.cleanupAfterTurn(scope);
254
+ async prepareRunComposition(input) {
255
+ if (!this.input.beforeRunProviderDispatch) {
256
+ throw new Error('Backend has no durable Run Composition preparation authority');
863
257
  }
258
+ await this.input.beforeRunProviderDispatch({ sessionId: this.sessionId, ...input });
864
259
  }
865
- async *sendWithinScope(scope, input) {
866
- const turnId = input.turnId;
867
- const maxSteps = input.maxSteps ?? this.maxSteps;
868
- const toolRuntime = scope.toolRuntime;
869
- const turnAbortController = scope.abortController;
870
- const midTurnState = this.compaction.buildMidTurnCapacityCompactState(input);
871
- const queue = new AsyncEventQueue();
872
- const codeModeExecTool = this.createCodeModeExecTool(scope, queue);
873
- // One AssistantMessage is flushed per provider step (not per turn), so the
874
- // ledger records the text↔tool timeline at step granularity and each step's
875
- // Anthropic thinking signature stays paired with its own thinking text. The
876
- // turn's first step reuses this id; every later step rotates to a fresh one
877
- // at its step boundary (see the stream loop below).
878
- let currentStepMessageId = this.newId();
879
- let stepText = '';
880
- let stepTextProviderOptions;
881
- let stepTextPartStartOffset = 0;
882
- let stepThinking = '';
883
- let sawStepThinking = false;
884
- let stepThinkingProviderOptions;
885
- let stepResponsesThinkingParts = [];
886
- let stepResponsesThinkingPartsByItemId = new Map();
887
- let stepSignature;
888
- const startedAt = this.now();
889
- // Flush the current step's AssistantMessage (text + thinking) and the paired
890
- // terminal thinking/text events, then clear the per-step accumulators.
891
- // Persist when the step produced text OR reasoning — a thinking-only step
892
- // (Anthropic's signed/omitted reasoning has empty text) still round-trips its
893
- // signed block; a pure-tool step (no text, no thinking) writes nothing, so
894
- // tool-only steps leave no placeholder assistant row. thinking_complete
895
- // precedes text_complete so the read-model attaches this step's reasoning to
896
- // this step's assistant row. Hoisted to send() scope so both the streaming
897
- // path and the abort/error handler can flush a partial step.
898
- const flushStep = async () => {
899
- const hasThinking = sawStepThinking || stepSignature !== undefined;
900
- if (stepText.length === 0 && !hasThinking)
901
- return;
902
- const stepId = currentStepMessageId;
903
- const thinkingParts = stepResponsesThinkingParts.length > 0
904
- ? stepResponsesThinkingParts
905
- : [
906
- {
907
- text: stepThinking,
908
- ...(stepSignature !== undefined ? { signature: stepSignature } : {}),
909
- ...(stepThinkingProviderOptions !== undefined
910
- ? { providerOptions: stepThinkingProviderOptions }
911
- : {}),
912
- },
913
- ];
914
- const msg = {
915
- type: 'assistant',
916
- id: stepId,
917
- turnId,
918
- ts: this.now(),
919
- text: stepText,
920
- ...(stepTextProviderOptions !== undefined
921
- ? { providerOptions: stepTextProviderOptions }
922
- : {}),
923
- modelId: this.input.modelId,
924
- ...(hasThinking
925
- ? {
926
- thinking: {
927
- text: stepThinking,
928
- ...(thinkingParts.length === 1 && thinkingParts[0].signature !== undefined
929
- ? { signature: thinkingParts[0].signature }
930
- : {}),
931
- ...(thinkingParts.length === 1 && thinkingParts[0].providerOptions !== undefined
932
- ? { providerOptions: thinkingParts[0].providerOptions }
933
- : {}),
934
- ...(thinkingParts.length > 1 ? { parts: thinkingParts } : {}),
935
- },
936
- }
937
- : {}),
938
- };
939
- await this.input.appendMessage(msg);
940
- if (hasThinking) {
941
- for (const part of thinkingParts) {
942
- queue.push({
943
- type: 'thinking_complete',
944
- id: this.newId(),
945
- turnId,
946
- ts: this.now(),
947
- messageId: stepId,
948
- text: part.text,
949
- ...(part.signature !== undefined ? { signature: part.signature } : {}),
950
- // No sanitiser here, unlike the tool call below: these options are
951
- // not the provider's object. `translateChunk` rebuilds reasoning
952
- // metadata from two named string fields, so an omitted provider
953
- // field cannot arrive as an explicit `undefined` and break the
954
- // canonical encoding. Passing the provider's object through
955
- // instead would need the same `stripUndefinedDeep` a tool call has.
956
- ...(part.providerOptions !== undefined
957
- ? { providerOptions: part.providerOptions }
958
- : {}),
959
- });
960
- }
961
- }
962
- queue.push({
963
- type: 'text_complete',
964
- id: this.newId(),
965
- turnId,
966
- ts: this.now(),
967
- messageId: stepId,
968
- text: stepText,
969
- ...(stepTextProviderOptions !== undefined
970
- ? { providerOptions: stepTextProviderOptions }
971
- : {}),
972
- });
973
- scope.finalAssistantText = stepText.length > 0 ? stepText : undefined;
974
- stepText = '';
975
- stepTextProviderOptions = undefined;
976
- stepTextPartStartOffset = 0;
977
- stepThinking = '';
978
- sawStepThinking = false;
979
- stepThinkingProviderOptions = undefined;
980
- stepResponsesThinkingParts = [];
981
- stepResponsesThinkingPartsByItemId = new Map();
982
- stepSignature = undefined;
983
- };
984
- let tokenUsage;
985
- let tokenUsageCostUsd;
986
- // Per-send sum of every COMPLETED step's usage, merged at each finish-step
987
- // boundary. When the send aborts (mid-turn exhaust, user stop, stream
988
- // error) the SDK's cumulative `usage` promise may not resolve, but this sum is
989
- // real provider-reported evidence for the steps that did finish — IF every
990
- // completed step produced a usable sample. One unusable sample makes the
991
- // sum a partial cost, and LlmCallRecord has no partial marker, so the flag
992
- // fails the whole fallback closed (#972: incomplete usage is no usage).
993
- let completedStepUsage;
994
- let sawUnusableStepUsage = false;
995
- // Input tokens from the last completed step — the actual prompt token count
996
- // of the final API request. Used to compute contextRemaining for the TUI
997
- // statusline ctx segment (#1067): contextRemaining = contextWindow - this.
998
- // result.usage.inputTokens is cumulative across steps and would produce
999
- // misleading >100% percentages, so the per-step value is captured here.
1000
- let lastStepInputTokens;
1001
- let streamStatus = 'success';
1002
- let streamErrorClass;
1003
- let runtimeSteps = 0;
1004
- let requestShapeForTelemetry;
1005
- let promptSegmentsForTelemetry = [];
1006
- let contextBudgetForTelemetry;
1007
- let contextCompactedNoteWritten = false;
1008
- let contextCompactionFailedOpenNoteWritten = false;
1009
- const trace = new RunTrace({
1010
- sessionId: this.sessionId,
1011
- turnId,
1012
- connectionSlug: this.input.connection.slug,
1013
- providerId: this.input.connection.providerType,
1014
- modelId: this.input.modelId,
260
+ openTurnScope(input) {
261
+ const turn = new AiSdkTurn({
262
+ backend: this.input,
263
+ modelAdapter: this.modelAdapter,
264
+ messageProjection: this.messageProjection,
265
+ providerTelemetry: this.providerTelemetry,
266
+ compaction: this.compaction,
267
+ snapshotToolAvailability: () => this.snapshotToolAvailability(),
268
+ codeCellAdmission: this.codeCellAdmission,
269
+ resolvedProviderOptions: this.resolvedProviderOptions,
270
+ session: this.turnSessionState,
1015
271
  newId: this.newId,
1016
272
  now: this.now,
1017
- record: this.input.recordRunTrace,
1018
- });
1019
- scope.runTrace = trace;
1020
- trace.turnStarted({
1021
- orchestrationMode: scope.orchestration.mode,
1022
- orchestrationSource: scope.orchestration.source,
1023
- agentSwarmAuthorization: scope.orchestration.agentSwarmAuthorization,
1024
- });
1025
- if (this.input.planTraceContext) {
1026
- trace.emit('plan', 'plan_context_resolved', 'Plan context resolved', {
1027
- ...this.input.planTraceContext,
1028
- });
1029
- if (this.input.planTraceContext.executionId) {
1030
- trace.emit('plan', 'plan_execution_started', 'Plan execution turn started', {
1031
- ...this.input.planTraceContext,
1032
- });
1033
- }
1034
- }
1035
- let sandboxDiagnosticsSnapshot;
1036
- let sandboxPrompt;
1037
- let sandboxContextStage = 'resolve';
1038
- try {
1039
- sandboxDiagnosticsSnapshot = this.input.sandboxDiagnostics
1040
- ? await raceWithTurnAbort(this.resolveTurnSandboxDiagnostics(), turnAbortController.signal)
1041
- : undefined;
1042
- sandboxContextStage = 'render';
1043
- sandboxPrompt = sandboxDiagnosticsSnapshot
1044
- ? renderSandboxTurnTailPrompt(sandboxDiagnosticsSnapshot)
1045
- : undefined;
1046
- }
1047
- catch (err) {
1048
- if (scope.aborted || turnAbortController.signal.aborted) {
1049
- queue.push({
1050
- type: 'abort',
1051
- id: this.newId(),
1052
- turnId,
1053
- ts: this.now(),
1054
- reason: 'user_stop',
1055
- });
1056
- queue.push({
1057
- type: 'complete',
1058
- id: this.newId(),
1059
- turnId,
1060
- ts: this.now(),
1061
- stopReason: 'user_stop',
1062
- });
1063
- queue.close();
1064
- yield* this.drain(queue);
1065
- return;
1066
- }
1067
- trace.sandboxContextFailed(sandboxContextStage, err);
1068
- // This context is model guidance, not execution authority. Never fall
1069
- // back to a stale snapshot; continue without the prompt while the live
1070
- // ExecutionBoundary remains authoritative for every tool invocation.
1071
- sandboxDiagnosticsSnapshot = undefined;
1072
- sandboxPrompt = undefined;
1073
- }
1074
- if (sandboxDiagnosticsSnapshot) {
1075
- trace.sandboxContextResolved(toSandboxRunTraceProjection(sandboxDiagnosticsSnapshot));
1076
- }
1077
- const providerRequestTracker = this.createProviderRequestTracker({
1078
- turnId,
1079
- callKind: 'main',
1080
- modelId: this.input.modelId,
1081
- runId: scope.runId,
1082
- });
1083
- const providerRequestTraceId = providerRequestTracker?.traceId;
1084
- // --- Resolve model (API key already attached at construct time) ---
1085
- let model;
1086
- try {
1087
- model = this.modelAdapter.resolveModel();
1088
- trace.modelResolved();
1089
- }
1090
- catch (err) {
1091
- trace.modelResolveFailed(err);
1092
- queue.push(this.makeErrorEvent(turnId, err));
1093
- queue.push({
1094
- type: 'complete',
1095
- id: this.newId(),
1096
- turnId,
1097
- ts: this.now(),
1098
- stopReason: 'error',
1099
- });
1100
- queue.close();
1101
- yield* this.drain(queue);
1102
- return;
1103
- }
1104
- // --- Build the provider-visible schema set. Tool execution stays in Runtime. ---
1105
- // One immutable runtime owns the bound search catalog and cached index.
1106
- // Mutable activation belongs to this send's TurnScope.
1107
- const requiredOrchestrationTools = scope.orchestration.mode === 'swarm'
1108
- ? new Set([
1109
- 'agent_list',
1110
- 'update_agent_graph',
1111
- 'yield_agent_graph',
1112
- 'agent_swarm_status',
1113
- 'agent_output',
1114
- ])
1115
- : scope.orchestration.mode === 'graph'
1116
- ? new Set([
1117
- 'agent_list',
1118
- 'view_agent_graph',
1119
- 'update_agent_graph',
1120
- 'yield_agent_graph',
1121
- 'agent_swarm_status',
1122
- 'agent_output',
1123
- ])
1124
- : new Set();
1125
- const requestedToolMode = input.toolMode === undefined ? DEFAULT_TOOL_MODE : input.toolMode;
1126
- if (!isToolMode(requestedToolMode)) {
1127
- throw new Error(`Invalid tool mode: ${String(requestedToolMode)}`);
1128
- }
1129
- const toolMode = requestedToolMode;
1130
- if (toolMode === 'code_mode' && this.input.tools.some((tool) => tool.name === 'exec')) {
1131
- throw new Error('Tool name "exec" is reserved for Code Mode.');
1132
- }
1133
- const plan = projectToolModePlan(this.toolAvailabilityRuntime.prepare(scope.activeTools, requiredOrchestrationTools), toolMode, codeModeExecTool);
1134
- const providerTools = plan.providerTools;
1135
- let activeToolResultPruneDiagnosticPatch = {};
1136
- let midTurnCompactDiagnosticPatch;
1137
- // Tool names the repair path matches a mis-cased call against — follows the
1138
- // current step's snapshot so a tool activated mid-turn is repairable on the
1139
- // step it becomes active, not routed to `invalid`.
1140
- const boundaryAwareToolNames = (names) => {
1141
- if (toolRuntime.shouldFinalizeSandboxBoundary())
1142
- return [];
1143
- return toolRuntime.hasSandboxBoundaryDenial()
1144
- ? names.filter((name) => name !== REQUEST_SANDBOX_BOUNDARY_TOOL_NAME)
1145
- : [...names];
1146
- };
1147
- const currentRepairToolNames = () => boundaryAwareToolNames(plan.currentRepairToolNames());
1148
- if (plan.gating) {
1149
- toolRuntime.setGating(plan.gating);
1150
- }
1151
- const modelTools = {};
1152
- for (const t of providerTools) {
1153
- modelTools[t.name] = t.providerTool
1154
- ? { kind: 'provider', providerTool: t.providerTool }
1155
- : {
1156
- kind: 'function',
1157
- description: t.description,
1158
- inputSchema: t.parameters,
1159
- };
1160
- }
1161
- // Resolve the stable Provider envelope before automatic Compaction freezes
1162
- // its source. The same value is reused by the primary request; Memory does
1163
- // not resolve or mutate Agent configuration after the checkpoint commits.
1164
- let systemPrompt;
1165
- try {
1166
- systemPrompt = joinPromptFragments([
1167
- await this.resolveSystemPrompt(scope),
1168
- scope.orchestration?.mode === 'swarm' ? renderSwarmModePrompt() : undefined,
1169
- scope.orchestration?.mode === 'graph' ? renderGraphModePrompt() : undefined,
1170
- // A safe continuation deliberately has no new user message. Keep its
1171
- // replay byte-for-byte intact and carry only the current authority fact
1172
- // in the effective system envelope; ordinary volatile turn-tail facts
1173
- // remain excluded from continuation.
1174
- input.continuation ? sandboxPrompt : undefined,
1175
- ]);
1176
- }
1177
- catch (err) {
1178
- trace.modelStreamFailed(this.modelAdapter.classifyError(err), err);
1179
- queue.push(this.makeErrorEvent(turnId, err));
1180
- queue.push({
1181
- type: 'complete',
1182
- id: this.newId(),
1183
- turnId,
1184
- ts: this.now(),
1185
- stopReason: 'error',
1186
- });
1187
- queue.close();
1188
- yield* this.drain(queue);
1189
- return;
1190
- }
1191
- // --- Build messages from RuntimeEvent history and its compatibility projection. ---
1192
- const priorReplayResult = await this.buildPriorMessages(scope, input, this.automaticMemoryCompactionSupported() ? true : undefined);
1193
- if (scope.aborted) {
1194
- queue.push({
1195
- type: 'abort',
1196
- id: this.newId(),
1197
- turnId,
1198
- ts: this.now(),
1199
- reason: 'user_stop',
1200
- });
1201
- queue.push({
1202
- type: 'complete',
1203
- id: this.newId(),
1204
- turnId,
1205
- ts: this.now(),
1206
- stopReason: 'user_stop',
1207
- });
1208
- queue.close();
1209
- yield* this.drain(queue);
1210
- return;
1211
- }
1212
- if (priorReplayResult.status === 'context_budget_exhausted') {
1213
- trace.modelStreamCompleted('context_budget_exhausted');
1214
- queue.push({
1215
- type: 'complete',
1216
- id: this.newId(),
1217
- turnId,
1218
- ts: this.now(),
1219
- stopReason: 'context_budget_exhausted',
1220
- contextBudgetExhaustedDetail: priorReplayResult.detail,
1221
- });
1222
- queue.close();
1223
- yield* this.drain(queue);
1224
- return;
1225
- }
1226
- const priorReplay = priorReplayResult;
1227
- if (input.continuation && priorReplay.messages.length === 0) {
1228
- const replay = priorReplayFailureTrace(priorReplay);
1229
- const error = new ContinuationReplayEmptyError(replay.gate, replay.diagnosticCodes);
1230
- trace.modelStreamFailed(error.code, error, replay);
1231
- queue.push(this.makeErrorEvent(turnId, error));
1232
- queue.push({
1233
- type: 'complete',
1234
- id: this.newId(),
1235
- turnId,
1236
- ts: this.now(),
1237
- stopReason: 'error',
1238
- });
1239
- queue.close();
1240
- yield* this.drain(queue);
1241
- return;
1242
- }
1243
- if (midTurnState) {
1244
- // Roll-forward seed: the latest durable checkpoint (loaded or written at
1245
- // turn start) so a mid-turn summary only re-reads the newly folded span.
1246
- const checkpoint = priorReplay.latestHistoryCompactCheckpoint;
1247
- midTurnState.previousCheckpoint =
1248
- checkpoint &&
1249
- canContinueHistoryCompactCheckpointForModel(checkpoint, this.input.connection, this.input.modelId)
1250
- ? checkpoint
1251
- : undefined;
1252
- }
1253
- /**
1254
- * The fold THIS request's prompt was built under (#2323).
1255
- *
1256
- * Called once per physical dispatch rather than once per send, because the
1257
- * boundary moves between dispatches of the same send: mid-turn capacity
1258
- * compaction advances it before a later step, and overflow recovery
1259
- * advances it before it resends the request the provider just rejected.
1260
- * Sealed from session state at settlement it would be whichever fold
1261
- * arrived last — not the one the sealed prompt was actually made of.
1262
- *
1263
- * Mid-turn state is the single rolling authority whenever the turn has one:
1264
- * it is seeded just above from the pre-turn checkpoint and is what both of
1265
- * those folds write to. A turn without that seam can only have been built
1266
- * under the pre-turn checkpoint.
1267
- */
1268
- const requestHistoryCompactBoundary = () => {
1269
- const checkpoint = midTurnState
1270
- ? midTurnState.previousCheckpoint
1271
- : priorReplay.latestHistoryCompactCheckpoint;
1272
- return checkpoint ? contextDiagnosticsCompactionOf(checkpoint) : undefined;
1273
- };
1274
- // --- Background pump: streamText → stream → normalize → queue ---
1275
- const pumpDone = (async () => {
1276
- const watchdogState = {
1277
- current: null,
1278
- };
1279
- let providerRequestAbortController = new AbortController();
1280
- const watchdogTimeoutState = { current: null };
1281
- const currentWatchdogTimeout = () => watchdogTimeoutState.current;
1282
- const consumeWatchdogTimeout = () => {
1283
- const timeout = watchdogTimeoutState.current;
1284
- watchdogTimeoutState.current = null;
1285
- return timeout;
1286
- };
1287
- let lastCompletedStepHadToolResult = false;
1288
- let terminalProviderErrorReason;
1289
- try {
1290
- const startWatchdog = () => {
1291
- watchdogState.current?.stop();
1292
- const next = new StreamWatchdog({
1293
- now: this.now,
1294
- connectTimeoutMs: this.input.streamConnectTimeoutMs,
1295
- idleTimeoutMs: this.input.streamIdleTimeoutMs,
1296
- ...this.input.streamWatchdogTimer,
1297
- onTimeout: (timeout) => {
1298
- const error = new Error(formatStreamWatchdogError(timeout));
1299
- watchdogTimeoutState.current = { phase: timeout.phase, error };
1300
- providerRequestAbortController.abort(error);
1301
- },
1302
- });
1303
- watchdogState.current = next;
1304
- scope.watchdog = next;
1305
- next.start();
1306
- };
1307
- const activeTools = plan.activeTools;
1308
- const turnTailPrompt = input.continuation
1309
- ? undefined
1310
- : joinPromptFragments([
1311
- await this.resolveTurnTailPrompt(turnId),
1312
- await this.resolveShellRunContextSummary(),
1313
- sandboxPrompt,
1314
- ]);
1315
- const currentUserContent = input.continuation
1316
- ? undefined
1317
- : await this.buildCurrentUserContent(scope.imageBudget, input.text, input.attachments, input.quotes, input.headAnchorRuntimeEvent?.id);
1318
- const messages = currentUserContent === undefined
1319
- ? [...priorReplay.messages]
1320
- : [
1321
- ...priorReplay.messages,
1322
- {
1323
- role: 'user',
1324
- content: this.appendTurnTailPrompt(currentUserContent, turnTailPrompt),
1325
- },
1326
- ];
1327
- const settledModelOutputs = new Map();
1328
- const loadDurableTurnEvents = async () => {
1329
- const loadTurnRuntimeEvents = this.input.loadTurnRuntimeEvents;
1330
- if (!loadTurnRuntimeEvents) {
1331
- throw new Error('durable current-run reader is required for tool continuation');
1332
- }
1333
- await queue.waitUntilConsumedThroughCurrent();
1334
- return (await loadTurnRuntimeEvents(turnId)).filter((event) => event.turnId === turnId);
1335
- };
1336
- const loadDurableTurnProjection = async () => {
1337
- const turnEvents = await loadDurableTurnEvents();
1338
- const projectionCheckpoint = midTurnState?.projectionCheckpoint;
1339
- const rawProjectionEvents = projectionCheckpoint
1340
- ? [
1341
- ...midTurnState.priorContentEvents,
1342
- ...turnEvents.filter(isHistoryCompactContentEvent),
1343
- ]
1344
- : turnEvents;
1345
- let replayEvents = rawProjectionEvents;
1346
- if (projectionCheckpoint) {
1347
- const checkpointMatch = matchHistoryCompactCheckpointPrefix(projectionCheckpoint, rawProjectionEvents);
1348
- if (checkpointMatch.reason) {
1349
- throw new Error(`durable checkpoint projection mismatch: ${checkpointMatch.reason}`);
1350
- }
1351
- replayEvents = projectHistoryCompactCheckpointReplay(projectionCheckpoint, checkpointMatch.coveredRuntimeEvents, checkpointMatch.successorRuntimeEvents);
1352
- // The checkpoint was capacity-validated before it was persisted.
1353
- // Do not re-run that gate against a later, larger successor tail:
1354
- // the active-step shaper must see that growth so it can roll the
1355
- // checkpoint forward instead of resurrecting raw history.
1356
- }
1357
- const replayPlan = buildRuntimeEventModelReplayPlan(replayEvents, {
1358
- toolActivityTurnIds: collectToolActivityTurnIds([
1359
- ...(input.runtimeContext ?? []),
1360
- ...turnEvents,
1361
- ]),
1362
- });
1363
- if (hasBlockingReplayDiagnostics(replayPlan) ||
1364
- (replayPlan.hasProviderNativeSemantics && !this.canReplayProviderNative(replayPlan))) {
1365
- throw new Error('durable current-run projection is not replayable');
1366
- }
1367
- const anchorEventId = input.headAnchorRuntimeEvent?.id;
1368
- let decoratedCurrentUser = false;
1369
- const replayItems = replayPlan.items.map((item) => {
1370
- if (item.kind !== 'text' || item.role !== 'user') {
1371
- return item;
1372
- }
1373
- if (anchorEventId !== undefined ? item.eventId !== anchorEventId : decoratedCurrentUser) {
1374
- return item;
1375
- }
1376
- decoratedCurrentUser = true;
1377
- return {
1378
- ...item,
1379
- content: this.appendTurnTailPrompt(item.content, turnTailPrompt),
1380
- };
1381
- });
1382
- const currentTurnMessages = await this.materializeRuntimeReplayPlan({ ...replayPlan, items: replayItems }, scope.imageBudget, settledModelOutputs, projectionCheckpoint);
1383
- return projectionCheckpoint
1384
- ? currentTurnMessages
1385
- : [...priorReplay.messages, ...currentTurnMessages];
1386
- };
1387
- // Diagnostics describe the provider-visible (active) tool subset. A group
1388
- // loaded *this* turn expands that subset on later provider requests,
1389
- // so the durable cost record is refined against the final active set once
1390
- // the stream is consumed (see below). Both computations classify against
1391
- // the same pre-turn baseline. The availability runtime builds the tool
1392
- // diagnostic from the same per-step active set + schema-char measurement.
1393
- contextBudgetForTelemetry = priorReplay.contextBudget;
1394
- const priorShapeBaseline = this.priorRequestShape;
1395
- const computeTurnDiagnostics = (active) => {
1396
- const toolSchemaChars = toolSchemaCharsForDiagnostics(providerTools, active);
1397
- const toolAvailabilityDiagnostic = plan.diagnostics(active, toolSchemaChars);
1398
- return {
1399
- promptSegments: buildPromptSegmentEstimates({
1400
- systemPrompt,
1401
- toolSchemaChars,
1402
- toolCount: active.length,
1403
- priorMessages: priorReplay.messages,
1404
- priorRuntimeEventCount: priorReplay.runtimeEventCount,
1405
- currentUserContent: input.continuation
1406
- ? ''
1407
- : formatTextWithInlineRefs(input.text, {
1408
- ...(input.attachments !== undefined ? { attachments: input.attachments } : {}),
1409
- ...(input.quotes !== undefined ? { quotes: input.quotes } : {}),
1410
- }),
1411
- turnTailPrompt,
1412
- }),
1413
- requestShape: computeRequestShapeDiagnostic({
1414
- connection: this.input.connection,
1415
- modelId: this.input.modelId,
1416
- systemPrompt,
1417
- providerOptions: this.resolvedProviderOptions,
1418
- providerTools,
1419
- activeTools: active,
1420
- priorMessages: priorReplay.messages,
1421
- ...(toolAvailabilityDiagnostic !== undefined
1422
- ? { toolAvailability: toolAvailabilityDiagnostic }
1423
- : {}),
1424
- }, priorShapeBaseline),
1425
- };
1426
- };
1427
- // Publish a diagnostics snapshot to every telemetry sink at once so the
1428
- // cost record and prefix baseline describe the same active tool set. A
1429
- // same-turn deferred load re-publishes the final snapshot below.
1430
- let turnDiagnostics = computeTurnDiagnostics(activeTools);
1431
- const publishTurnDiagnostics = (diag) => {
1432
- turnDiagnostics = diag;
1433
- promptSegmentsForTelemetry = diag.promptSegments;
1434
- requestShapeForTelemetry = diag.requestShape;
1435
- this.priorRequestShape = diag.requestShape;
1436
- };
1437
- // Step-0 (turn-start) view: literally what the first request carries, so
1438
- // the stream-start trace reports it as the prefix actually sent.
1439
- publishTurnDiagnostics(turnDiagnostics);
1440
- trace.modelStreamStarted(activeTools, {
1441
- systemPromptHash: turnDiagnostics.requestShape.componentHashes.systemPromptHash,
1442
- prefixHash: turnDiagnostics.requestShape.prefixHash,
1443
- prefixChangeReason: turnDiagnostics.requestShape.prefixChangeReason,
1444
- requestShapeHash: turnDiagnostics.requestShape.requestShapeHash,
1445
- requestShapeChangeReason: turnDiagnostics.requestShape.requestShapeChangeReason,
1446
- ...(turnDiagnostics.requestShape.toolSchemaChangeReason !== undefined
1447
- ? {
1448
- toolSchemaChangeReason: turnDiagnostics.requestShape.toolSchemaChangeReason,
1449
- }
1450
- : {}),
1451
- ...(turnDiagnostics.requestShape.toolAvailability !== undefined
1452
- ? {
1453
- toolAvailability: turnDiagnostics.requestShape.toolAvailability,
1454
- }
1455
- : {}),
1456
- promptSegments: turnDiagnostics.promptSegments,
1457
- ...(priorReplay.contextBudget ? { contextBudget: priorReplay.contextBudget } : {}),
1458
- });
1459
- const onMidTurnDiagnosticPatch = (patch) => {
1460
- midTurnCompactDiagnosticPatch = mergeContextBudgetDiagnosticPatches(midTurnCompactDiagnosticPatch, patch);
1461
- };
1462
- const midTurnSystemPromptChars = systemPrompt?.length ?? 0;
1463
- const midTurnCapacityHook = this.compaction.buildMidTurnCapacityCompactProjection(turnId, midTurnState, queue, providerTools, () => currentRepairToolNames(), turnTailPrompt, midTurnSystemPromptChars, onMidTurnDiagnosticPatch, scope, this.automaticMemoryCompactionSupported()
1464
- ? () => this.automaticMemoryCompactionDecision()
1465
- : undefined, this.automaticMemoryCompactionSupported()
1466
- ? (dispatch) => this.dispatchAutomaticMemoryCompaction(scope, dispatch)
1467
- : undefined, turnAbortController.signal);
1468
- // When mid-turn capacity compaction is active, the prune must also cover
1469
- // the newest completed step; see collectPrunableCompletedStepToolCallIds.
1470
- const activeToolResultPruneIncludesNewestStep = midTurnState !== undefined;
1471
- const activeToolResultPruneHook = this.compaction.buildActiveToolResultPruneProjection(turnId, activeToolResultPruneIncludesNewestStep, (patch) => {
1472
- activeToolResultPruneDiagnosticPatch = mergeActiveToolResultPruneDiagnosticPatches(activeToolResultPruneDiagnosticPatch, patch);
1473
- });
1474
- const shapedProjection = composeRequestProjection(plan.projectActiveTools, midTurnCapacityHook, activeToolResultPruneHook);
1475
- // The verdict owner wraps the WHOLE shaping pipeline: hooks shape, one
1476
- // owner measures the final payload and decides pass/terminate.
1477
- const requestProjection = midTurnState && midTurnCapacityHook && shapedProjection
1478
- ? this.compaction.buildMidTurnFinalRequestVerdict({
1479
- shaped: shapedProjection,
1480
- reentry: composeRequestProjection(undefined, midTurnCapacityHook, activeToolResultPruneHook),
1481
- state: midTurnState,
1482
- providerTools,
1483
- fallbackActiveTools: () => currentRepairToolNames(),
1484
- charsPerToken: this.input.contextBudget?.charsPerToken ?? 4,
1485
- systemPromptChars: midTurnSystemPromptChars,
1486
- onDiagnosticPatch: onMidTurnDiagnosticPatch,
1487
- abortController: turnAbortController,
1488
- })
1489
- : shapedProjection;
1490
- const completedProviderSteps = [];
1491
- let requestMessages = messages;
1492
- let overflowRetryUsed = false;
1493
- let result;
1494
- let providerOutcome;
1495
- let finishReason = 'stop';
1496
- let terminalProviderError;
1497
- agentLoop: for (;;) {
1498
- await this.drainSteeringInto(scope, input, queue);
1499
- if (this.input.loadTurnRuntimeEvents) {
1500
- requestMessages = await loadDurableTurnProjection();
1501
- }
1502
- else {
1503
- const missingSteering = steeringMessagesMissingFromBase(scope.injectedSteeringMessages, requestMessages);
1504
- if (missingSteering.length > 0)
1505
- requestMessages = [...requestMessages, ...missingSteering];
1506
- }
1507
- const shaped = requestProjection
1508
- ? await requestProjection({
1509
- completedSteps: completedProviderSteps,
1510
- stepNumber: runtimeSteps,
1511
- model,
1512
- messages: requestMessages,
1513
- })
1514
- : undefined;
1515
- if (midTurnState?.exhaustedDetail) {
1516
- throw new Error(`context budget exhausted before provider dispatch: ${midTurnState.exhaustedDetail}`);
1517
- }
1518
- const projectedMessages = shaped?.messages ?? requestMessages;
1519
- const finalChildSummaryStep = this.input.header.collaborationMode === 'agent' &&
1520
- maxSteps !== undefined &&
1521
- maxSteps > 1 &&
1522
- runtimeSteps === maxSteps - 1 &&
1523
- completedProviderSteps.length > 0;
1524
- const sandboxBoundaryFinalizationStep = toolRuntime.shouldFinalizeSandboxBoundary() ||
1525
- (toolRuntime.hasSandboxBoundaryDenial() &&
1526
- maxSteps !== undefined &&
1527
- runtimeSteps === maxSteps - 1);
1528
- if (sandboxBoundaryFinalizationStep) {
1529
- toolRuntime.forceSandboxBoundaryFinalization();
1530
- }
1531
- const activeToolsForRequest = finalChildSummaryStep || sandboxBoundaryFinalizationStep
1532
- ? []
1533
- : boundaryAwareToolNames(shaped?.activeTools ?? plan.currentRepairToolNames());
1534
- const requestSystemPrompt = joinPromptFragments([
1535
- systemPrompt,
1536
- finalChildSummaryStep ? CHILD_STEP_BUDGET_FINALIZATION_PROMPT : undefined,
1537
- toolRuntime.hasSandboxBoundaryDenial() ? SANDBOX_BOUNDARY_DENIED_FOR_TURN : undefined,
1538
- sandboxBoundaryFinalizationStep ? SANDBOX_BOUNDARY_FINALIZATION_PROMPT : undefined,
1539
- ]);
1540
- providerRequestTracker?.setStep(runtimeSteps);
1541
- let attemptMessages = projectedMessages;
1542
- let providerAttempt = 1;
1543
- let idleWatchdogRetryCount = 0;
1544
- let incompleteStreamRetryCount = 0;
1545
- const returnedToolCalls = [];
1546
- let providerToolActivityCount = 0;
1547
- const providerToolInputs = new Map();
1548
- let providerStepUsage;
1549
- for (;;) {
1550
- providerRequestAbortController = new AbortController();
1551
- watchdogTimeoutState.current = null;
1552
- startWatchdog();
1553
- // Monotonic facts for this physical request. The step accumulators
1554
- // are cleared after flushStep(), so they cannot decide whether a
1555
- // later stream failure is safe to retry.
1556
- let attemptSawText = false;
1557
- let attemptSawThinking = false;
1558
- let attemptSawToolActivity = false;
1559
- let attemptSawContinuationMetadata = false;
1560
- let attemptReachedStepBoundary = false;
1561
- const attemptHasNoObservableOutput = () => !attemptSawText &&
1562
- !attemptSawThinking &&
1563
- !attemptSawToolActivity &&
1564
- !attemptSawContinuationMetadata &&
1565
- !attemptReachedStepBoundary;
1566
- const attemptCanRecoverFromIdleTimeout = () => !attemptSawText &&
1567
- !attemptSawToolActivity &&
1568
- !attemptSawContinuationMetadata &&
1569
- !attemptReachedStepBoundary;
1570
- scope.memorySourceMessages = [...attemptMessages];
1571
- scope.memorySourceEventMessagePositions =
1572
- this.memoryEventMessagePositions(attemptMessages);
1573
- scope.memorySourceSystemPrompt = requestSystemPrompt;
1574
- scope.memorySourceTools = modelTools;
1575
- scope.memorySourceActiveTools = [...activeToolsForRequest];
1576
- scope.finalAssistantText = undefined;
1577
- // Keep a denied boundary request as a Code Mode trap: the provider
1578
- // no longer sees it as a direct tool, but a nested retry must still
1579
- // reach ToolRuntime's denial latch instead of becoming an endlessly
1580
- // variable unknown-tool error inside `exec`.
1581
- const codeModeActiveTools = toolRuntime.hasSandboxBoundaryDenial() && activeToolsForRequest.includes('exec')
1582
- ? [...activeToolsForRequest, REQUEST_SANDBOX_BOUNDARY_TOOL_NAME]
1583
- : activeToolsForRequest;
1584
- scope.codeModeTools =
1585
- toolMode === 'code_mode'
1586
- ? nestableToolSnapshot(providerTools, codeModeActiveTools)
1587
- : undefined;
1588
- const requestWatchdog = watchdogState.current;
1589
- // Read here, beside the messages it describes: `attemptMessages` is
1590
- // rebuilt in place by overflow recovery, and the boundary it folded
1591
- // under must travel with that rebuild, not with the step.
1592
- const historyCompactBoundary = requestHistoryCompactBoundary();
1593
- result = await this.modelAdapter.startStream({
1594
- model,
1595
- messages: attemptMessages,
1596
- tools: modelTools,
1597
- activeTools: activeToolsForRequest,
1598
- onStreamActivity: () => requestWatchdog?.markActivity(),
1599
- repairToolCall: async ({ toolCall, error, }) => {
1600
- return repairMakaToolCall({
1601
- toolCall,
1602
- availableToolNames: currentRepairToolNames(),
1603
- toolParameters: (name) => providerTools.find((candidate) => candidate.name === name)?.parameters,
1604
- toolCategoryHint: (name) => providerTools.find((candidate) => candidate.name === name)?.categoryHint,
1605
- error,
1606
- });
1607
- },
1608
- system: requestSystemPrompt,
1609
- abortSignal: AbortSignal.any([
1610
- turnAbortController.signal,
1611
- providerRequestAbortController.signal,
1612
- ]),
1613
- ...(providerRequestTracker ? { providerRequestTracker } : {}),
1614
- ...(historyCompactBoundary ? { historyCompactBoundary } : {}),
1615
- continuationKey: scope.turnId,
1616
- });
1617
- for await (const event of result.events) {
1618
- if (scope.aborted)
1619
- break;
1620
- if (event.kind === 'error') {
1621
- // Settlement owns the failure; stop before any synthesized
1622
- // trailer and consume the one authoritative outcome below.
1623
- break;
1624
- }
1625
- const incompleteFinish = (event.kind === 'finish' || event.kind === 'step-finish') &&
1626
- isIncompleteProviderFinishReason(event.finishReason);
1627
- if ((event.kind === 'finish' || event.kind === 'step-finish') && !incompleteFinish) {
1628
- attemptReachedStepBoundary = true;
1629
- }
1630
- if (event.kind === 'step-finish') {
1631
- // AI SDK can synthesize `finish-step(other)` when the provider
1632
- // stream reaches EOF without a terminal frame. That is not a
1633
- // completed model step and must not consume the step budget or
1634
- // checkpoint imaginary usage before the safe retry below.
1635
- if (!incompleteFinish) {
1636
- // Step boundary: AI SDK 7 delimits steps with `finish-step`
1637
- // (and `step-finish` for legacy replay fixtures); the adapter
1638
- // reduces both to this event. A duplicate boundary is harmless:
1639
- // the second flush no-ops (accumulators already cleared) and one
1640
- // extra id rotation just discards an unused id.
1641
- runtimeSteps += 1;
1642
- const stepUsage = event.usage;
1643
- providerStepUsage = stepUsage;
1644
- if (!stepUsage)
1645
- sawUnusableStepUsage = true;
1646
- // Fail closed: reset on every step boundary so a missing final
1647
- // step's usage does not leave a stale value from an earlier step.
1648
- lastStepInputTokens = stepUsage?.inputTokens;
1649
- if (stepUsage) {
1650
- completedStepUsage = mergeNormalizedUsage(completedStepUsage, stepUsage);
1651
- this.cumulativeUsageCheckpoint = mergeNormalizedUsage(this.cumulativeUsageCheckpoint, stepUsage);
1652
- await this.input.recordUsageCheckpoint?.({
1653
- ...this.cumulativeUsageCheckpoint,
1654
- costUsd: this.computeTokenUsageCostUsd(this.cumulativeUsageCheckpoint),
1655
- });
1656
- }
1657
- }
1658
- }
1659
- if (event.kind === 'text-start') {
1660
- stepTextPartStartOffset = stepText.length;
1661
- }
1662
- else if (event.kind === 'text') {
1663
- stepText += event.text;
1664
- if (event.text.length > 0)
1665
- attemptSawText = true;
1666
- queue.push({
1667
- type: 'text_delta',
1668
- id: this.newId(),
1669
- turnId,
1670
- ts: this.now(),
1671
- messageId: currentStepMessageId,
1672
- text: event.text,
1673
- });
1674
- }
1675
- else if (event.kind === 'text-metadata') {
1676
- attemptSawContinuationMetadata = true;
1677
- stepTextProviderOptions = mergeTextProviderOptions(stepTextProviderOptions, stripUndefinedDeep(event.providerOptions), stepTextPartStartOffset);
1678
- }
1679
- else if (event.kind === 'thinking') {
1680
- sawStepThinking = true;
1681
- stepThinking += event.text;
1682
- if (event.text.length > 0)
1683
- attemptSawThinking = true;
1684
- if (event.providerOptions !== undefined) {
1685
- if (event.providerOptionsOrigin !== 'maka_transport') {
1686
- attemptSawContinuationMetadata = true;
1687
- }
1688
- stepThinkingProviderOptions = event.providerOptions;
1689
- }
1690
- const itemId = event.reasoningItemId ?? responsesReasoningItemId(event.providerOptions);
1691
- if (typeof itemId === 'string' && itemId.length > 0) {
1692
- let part = stepResponsesThinkingPartsByItemId.get(itemId);
1693
- if (part &&
1694
- event.providerOptions === undefined &&
1695
- decodePlaintextResponsesReasoningState(part.providerOptions).kind === 'valid') {
1696
- // The SDK does not suppress a stray delta after
1697
- // output_item.done. Keep it out of the finalized item or
1698
- // its durable summary boundaries will no longer match.
1699
- part = { text: '' };
1700
- stepResponsesThinkingParts.push(part);
1701
- stepResponsesThinkingPartsByItemId.set(itemId, part);
1702
- }
1703
- if (!part) {
1704
- part = {
1705
- text: stepResponsesThinkingParts.length === 0 && event.text.length === 0
1706
- ? stepThinking
1707
- : '',
1708
- };
1709
- stepResponsesThinkingParts.push(part);
1710
- stepResponsesThinkingPartsByItemId.set(itemId, part);
1711
- }
1712
- const nextPartText = part.text + event.text;
1713
- if (event.reasoningSummaryText !== undefined &&
1714
- event.reasoningSummaryText !== nextPartText) {
1715
- throw new Error('Streamed plaintext Responses reasoning does not match final provider summary');
1716
- }
1717
- part.text = nextPartText;
1718
- if (event.providerOptions !== undefined) {
1719
- part.providerOptions = event.providerOptions;
1720
- }
1721
- }
1722
- else if (stepResponsesThinkingParts.length > 0) {
1723
- const lastPart = stepResponsesThinkingParts.at(-1);
1724
- const lastState = decodePlaintextResponsesReasoningState(lastPart.providerOptions);
1725
- if (lastState.kind === 'valid') {
1726
- // An invalid next item has no usable stream id. Do not
1727
- // append its deltas to the finalized item: partial-error
1728
- // flush must keep that item's durable boundaries valid.
1729
- stepResponsesThinkingParts.push({ text: event.text });
1730
- }
1731
- else {
1732
- lastPart.text += event.text;
1733
- }
1734
- }
1735
- queue.push({
1736
- type: 'thinking_delta',
1737
- id: this.newId(),
1738
- turnId,
1739
- ts: this.now(),
1740
- messageId: currentStepMessageId,
1741
- text: event.text,
1742
- });
1743
- }
1744
- else if (event.kind === 'thinking-signature') {
1745
- attemptSawContinuationMetadata = true;
1746
- stepSignature = event.signature;
1747
- }
1748
- else if (event.kind === 'provider-tool-input') {
1749
- // The provider has started its own tool. Even without a
1750
- // final tool-call/result event, retrying can repeat external
1751
- // work that the Runtime cannot observe or reconcile.
1752
- attemptSawToolActivity = true;
1753
- }
1754
- else if (event.kind === 'tool-call') {
1755
- attemptSawToolActivity = true;
1756
- if (event.toolCall.providerExecuted) {
1757
- providerToolActivityCount += 1;
1758
- providerToolInputs.set(event.toolCall.toolCallId, event.toolCall.input);
1759
- queue.push({
1760
- type: 'tool_start',
1761
- id: this.newId(),
1762
- turnId,
1763
- ts: this.now(),
1764
- toolUseId: event.toolCall.toolCallId,
1765
- toolName: event.toolCall.toolName,
1766
- args: event.toolCall.input,
1767
- providerExecuted: true,
1768
- activityKind: 'websearch',
1769
- displayName: 'Web search',
1770
- stepId: currentStepMessageId,
1771
- ...(event.toolCall.providerOptions !== undefined
1772
- ? {
1773
- providerOptions: stripUndefinedDeep(event.toolCall.providerOptions),
1774
- }
1775
- : {}),
1776
- });
1777
- }
1778
- else {
1779
- returnedToolCalls.push(event.toolCall);
1780
- }
1781
- }
1782
- else if (event.kind === 'provider-tool-result') {
1783
- attemptSawToolActivity = true;
1784
- providerToolActivityCount += 1;
1785
- const providerOutput = stripUndefinedDeep(event.output);
1786
- queue.push({
1787
- type: 'tool_result',
1788
- id: this.newId(),
1789
- turnId,
1790
- ts: this.now(),
1791
- toolUseId: event.toolCallId,
1792
- providerExecuted: true,
1793
- ...(providerOutput !== undefined ? { providerOutput } : {}),
1794
- isError: event.isError === true,
1795
- content: providerToolResultContent(event.toolName, providerOutput, providerToolInputs.get(event.toolCallId)),
1796
- });
1797
- providerToolInputs.delete(event.toolCallId);
1798
- }
1799
- else if (event.kind === 'step-finish' && !incompleteFinish) {
1800
- // The step's text/thinking deltas are all in (the stream is
1801
- // drained in order), so flush this step's AssistantMessage and
1802
- // rotate to a fresh id for the next step. Tool settlement
1803
- // below receives this step's pre-rotation id, so durable replay
1804
- // can regroup calls with this reasoning/text.
1805
- await flushStep();
1806
- if (midTurnState) {
1807
- // Durability clock: step N's thinking/text completion events
1808
- // are enqueued by flushStep just above, so only after this
1809
- // boundary can a seq-ack wait for step N mean anything. Wake
1810
- // waiters AFTER the increment or they would re-check a stale
1811
- // count and sleep.
1812
- midTurnState.flushedSteps += 1;
1813
- queue.wake();
1814
- }
1815
- }
1816
- }
1817
- watchdogState.current?.stop();
1818
- // This timeout belongs to the physical request that just settled.
1819
- // Consume it before recovery/flush work: a later persistence error
1820
- // must not be reported as the already-handled watchdog timeout.
1821
- const settledWatchdogTimeout = consumeWatchdogTimeout();
1822
- providerOutcome = await result.outcome;
1823
- const incompleteStreamTerminal = providerOutcome.kind === 'truncated';
1824
- const incompleteStreamHasNoObservableOutput = incompleteStreamTerminal &&
1825
- !attemptSawText &&
1826
- !attemptSawThinking &&
1827
- !attemptSawToolActivity &&
1828
- !attemptSawContinuationMetadata;
1829
- const attemptFailure = settledWatchdogTimeout?.error ??
1830
- (providerOutcome.kind === 'completed' ? undefined : providerOutcome.failure);
1831
- if (attemptFailure && !scope.aborted && !midTurnState?.exhaustedDetail) {
1832
- const failure = settledWatchdogTimeout || providerOutcome.kind === 'completed'
1833
- ? this.modelAdapter.normalizeFailure(attemptFailure)
1834
- : providerOutcome.failure;
1835
- if (scope.loopStopRequested) {
1836
- terminalProviderError = settledWatchdogTimeout?.error ?? failure;
1837
- terminalProviderErrorReason =
1838
- lastCompletedStepHadToolResult && failure.kind === 'timeout'
1839
- ? 'model_after_tool_timeout'
1840
- : undefined;
1841
- break agentLoop;
1842
- }
1843
- // A retry is a fresh provider request that would run at least one
1844
- // more step; with the send-level budget already spent there is
1845
- // nothing left to grant it, so the error is terminal.
1846
- const stepBudgetRemains = maxSteps === undefined || runtimeSteps < maxSteps;
1847
- const recovered = stepBudgetRemains && attemptHasNoObservableOutput()
1848
- ? await this.compaction.recoverFromOverflowError({
1849
- error: attemptFailure,
1850
- retryAlreadyUsed: overflowRetryUsed,
1851
- midTurnState,
1852
- turnId,
1853
- stepNumber: runtimeSteps,
1854
- currentMessages: attemptMessages,
1855
- providerTools,
1856
- activeTools: activeToolsForRequest,
1857
- systemPromptChars: midTurnSystemPromptChars,
1858
- turnTailPrompt,
1859
- queue,
1860
- onDiagnosticPatch: onMidTurnDiagnosticPatch,
1861
- origin: scope,
1862
- ...(this.automaticMemoryCompactionSupported()
1863
- ? {
1864
- memoryCompactionDecision: () => this.automaticMemoryCompactionDecision(),
1865
- onMemoryCompaction: (dispatch) => this.dispatchAutomaticMemoryCompaction(scope, dispatch),
1866
- }
1867
- : {}),
1868
- abortSignal: turnAbortController.signal,
1869
- })
1870
- : undefined;
1871
- if (recovered) {
1872
- overflowRetryUsed = true;
1873
- // Recovery rebuilds the request from the durable ledger, whose
1874
- // tool results intentionally retain their full bodies. Re-enter
1875
- // the active-result projection before dispatch so an archived
1876
- // result cannot reappear in provider context on the retry.
1877
- const recoveredProjection = activeToolResultPruneHook
1878
- ? await activeToolResultPruneHook({
1879
- completedSteps: completedProviderSteps,
1880
- stepNumber: runtimeSteps,
1881
- model,
1882
- messages: recovered.messages,
1883
- activeTools: activeToolsForRequest,
1884
- })
1885
- : undefined;
1886
- attemptMessages = recoveredProjection?.messages ?? recovered.messages;
1887
- continue;
1888
- }
1889
- const idleWatchdogRecovery = settledWatchdogTimeout?.phase === 'idle' &&
1890
- idleWatchdogRetryCount < MAX_IDLE_WATCHDOG_RETRIES_PER_STEP &&
1891
- attemptCanRecoverFromIdleTimeout();
1892
- const incompleteStreamRecovery = incompleteStreamTerminal &&
1893
- incompleteStreamRetryCount < MAX_INCOMPLETE_STREAM_RETRIES_PER_STEP &&
1894
- incompleteStreamHasNoObservableOutput;
1895
- if ((failure.retryable || idleWatchdogRecovery || incompleteStreamRecovery) &&
1896
- failure.kind !== 'context_overflow' &&
1897
- providerAttempt < MAX_PROVIDER_ATTEMPTS_PER_STEP &&
1898
- stepBudgetRemains &&
1899
- (attemptHasNoObservableOutput() || idleWatchdogRecovery || incompleteStreamRecovery)) {
1900
- if (idleWatchdogRecovery) {
1901
- idleWatchdogRetryCount += 1;
1902
- if (stepThinking.length > 0) {
1903
- await flushStep();
1904
- currentStepMessageId = this.newId();
1905
- }
1906
- }
1907
- if (incompleteStreamRecovery)
1908
- incompleteStreamRetryCount += 1;
1909
- // The failed request did not return authoritative usage. Keep
1910
- // effectiveness recoverable, but fail final metering closed.
1911
- sawUnusableStepUsage = true;
1912
- const delayMs = providerRetryDelayMs(providerAttempt, failure.retryAfterMs);
1913
- const nextAttempt = providerAttempt + 1;
1914
- const maxAttempts = idleWatchdogRecovery || incompleteStreamRecovery
1915
- ? nextAttempt
1916
- : MAX_PROVIDER_ATTEMPTS_PER_STEP;
1917
- const reason = providerRetryReason(failure.kind);
1918
- queue.push({
1919
- type: 'provider_retry',
1920
- id: this.newId(),
1921
- turnId,
1922
- ts: this.now(),
1923
- phase: 'scheduled',
1924
- attempt: nextAttempt,
1925
- maxAttempts,
1926
- delayMs,
1927
- remainingMs: delayMs,
1928
- reason,
1929
- });
1930
- await this.providerRetrySleep(delayMs, turnAbortController.signal);
1931
- providerAttempt = nextAttempt;
1932
- queue.push({
1933
- type: 'provider_retry',
1934
- id: this.newId(),
1935
- turnId,
1936
- ts: this.now(),
1937
- phase: 'started',
1938
- attempt: providerAttempt,
1939
- maxAttempts,
1940
- reason,
1941
- });
1942
- continue;
1943
- }
1944
- // Unrecoverable (not context-length, latch spent, no seam, or no
1945
- // safe fold): surface the real provider error via the terminal
1946
- // handler after settling any authoritative usage — never a
1947
- // fabricated success.
1948
- terminalProviderError = settledWatchdogTimeout?.error ?? failure;
1949
- terminalProviderErrorReason =
1950
- lastCompletedStepHadToolResult && failure.kind === 'timeout'
1951
- ? 'model_after_tool_timeout'
1952
- : undefined;
1953
- break agentLoop;
1954
- }
1955
- break;
1956
- }
1957
- // If the stream loop exited because stop() flipped scope.aborted while a
1958
- // provider kept yielding after abort instead of throwing, route to the
1959
- // abort handling below. Without this, the post-stream success path would
1960
- // persist a partial assistant turn and emit a false end_turn completion.
1961
- if (scope.aborted) {
1962
- throw Object.assign(new Error('aborted'), { name: 'AbortError' });
1963
- }
1964
- // Mid-turn exhaustion aborts the SDK stream, but streamText ends
1965
- // gracefully on abort instead of throwing; route to the explicit
1966
- // outcome regardless of how the stream wound down.
1967
- if (midTurnState?.exhaustedDetail) {
1968
- throw Object.assign(new Error(`mid-turn context budget exhausted: ${midTurnState.exhaustedDetail}`), { name: 'MidTurnContextBudgetExhaustedError' });
1969
- }
1970
- // Catch-all: flush any residual step content if the provider closed the
1971
- // stream without a trailing `finish-step` for the last step.
1972
- const providerStepId = currentStepMessageId;
1973
- await flushStep();
1974
- if (providerOutcome.kind !== 'completed')
1975
- throw providerOutcome.failure;
1976
- finishReason = providerOutcome.finishReason;
1977
- await queue.waitUntilConsumedThroughCurrent();
1978
- if (returnedToolCalls.length > 0) {
1979
- const continuationBudgetRemains = maxSteps === undefined || runtimeSteps < maxSteps;
1980
- if (continuationBudgetRemains && !this.input.loadTurnRuntimeEvents) {
1981
- throw new Error('durable current-run reader is required for tool continuation');
1982
- }
1983
- if (this.input.loadTurnRuntimeEvents) {
1984
- // Queue consumption alone does not prove that the latest assistant
1985
- // facts remain readable. Fail before any external tool side effect
1986
- // when the authoritative ledger became unavailable after the step.
1987
- await loadDurableTurnEvents();
1988
- }
1989
- const toolsByName = new Map(providerTools.map((tool) => [tool.name, tool]));
1990
- const settlementOutcomes = await Promise.allSettled(returnedToolCalls.map(async (toolCall) => {
1991
- if (toolCall.providerExecuted) {
1992
- throw new Error(`Provider-executed tool call "${toolCall.toolName}" is outside the main-agent tool loop`);
1993
- }
1994
- const sandboxBoundaryAttempt = isProviderSandboxBoundaryAttempt(toolCall);
1995
- const deniedBoundaryRequest = toolRuntime.hasSandboxBoundaryDenial() &&
1996
- toolCall.toolName.toLowerCase() === REQUEST_SANDBOX_BOUNDARY_TOOL_NAME;
1997
- if (deniedBoundaryRequest) {
1998
- toolRuntime.forceSandboxBoundaryFinalization();
1999
- }
2000
- const blockedToolCall = sandboxBoundaryFinalizationStep || deniedBoundaryRequest;
2001
- const requestedTool = blockedToolCall
2002
- ? undefined
2003
- : toolsByName.get(toolCall.toolName);
2004
- const tool = requestedTool ?? toolsByName.get(INVALID_TOOL_NAME);
2005
- if (!tool)
2006
- throw new Error('Runtime invalid-tool fallback is unavailable');
2007
- const unavailableError = sandboxBoundaryFinalizationStep
2008
- ? 'Sandbox boundary finalization does not permit tool execution.'
2009
- : deniedBoundaryRequest
2010
- ? SANDBOX_BOUNDARY_DENIED_FOR_TURN
2011
- : 'returned tool is unavailable';
2012
- return await toolRuntime.settleToolCall({
2013
- tool,
2014
- turnId,
2015
- stepId: providerStepId,
2016
- toolCallId: toolCall.toolCallId,
2017
- // Provider metadata is persisted verbatim into an immutable
2018
- // RuntimeEvent, and a field the response did not carry
2019
- // arrives as an explicit `undefined` — which JSON drops, so
2020
- // the event no longer reads back as it was written and the
2021
- // store refuses it. One refusal took every tool-calling turn
2022
- // with it.
2023
- ...(toolCall.providerOptions !== undefined
2024
- ? {
2025
- providerOptions: stripUndefinedDeep(toolCall.providerOptions),
2026
- }
2027
- : {}),
2028
- input: requestedTool !== undefined
2029
- ? toolCall.input
2030
- : {
2031
- tool: toolCall.toolName,
2032
- error: unavailableError,
2033
- ...(sandboxBoundaryAttempt ? { sandboxBoundaryAttempt: true } : {}),
2034
- },
2035
- abortSignal: turnAbortController.signal,
2036
- eventSink: queue,
2037
- });
2038
- }));
2039
- const rejectedSettlement = settlementOutcomes.find((outcome) => outcome.status === 'rejected');
2040
- if (rejectedSettlement)
2041
- throw rejectedSettlement.reason;
2042
- const settlements = settlementOutcomes.map((outcome) => {
2043
- // A rejected settlement was handled above, so preserving the
2044
- // original array shape also preserves tool-call identity by index.
2045
- if (outcome.status === 'rejected')
2046
- throw outcome.reason;
2047
- return outcome.value;
2048
- });
2049
- for (let index = 0; index < settlements.length; index += 1) {
2050
- const settlement = settlements[index];
2051
- const toolCall = returnedToolCalls[index];
2052
- if (isPlanToolResult(settlement.result)) {
2053
- this.handlePlanToolResult(scope, settlement.result, queue);
2054
- }
2055
- if (returnedToolCalls.length === 1 &&
2056
- toolCall?.toolName === YIELD_AGENT_GRAPH_TOOL_NAME &&
2057
- isAgentGraphYieldToolResult(settlement.result)) {
2058
- this.handleAgentGraphYieldToolResult(scope, settlement.result);
2059
- }
2060
- }
2061
- await queue.waitUntilConsumedThroughCurrent();
2062
- for (let index = 0; index < returnedToolCalls.length; index += 1) {
2063
- const toolCall = returnedToolCalls[index];
2064
- const settlement = settlements[index];
2065
- if (toolCall && settlement) {
2066
- settledModelOutputs.set(toolCall.toolCallId, settlement.modelOutput);
2067
- }
2068
- }
2069
- const continuationWillRun = (maxSteps === undefined || runtimeSteps < maxSteps) &&
2070
- !scope.loopStopRequested &&
2071
- !scope.aborted;
2072
- if (continuationWillRun && providerOutcome.continuation === 'pending') {
2073
- const persistedProjection = await loadDurableTurnProjection();
2074
- const responseMessages = persistedOpenAiResponsesStepMessages(attemptMessages, persistedProjection, returnedToolCalls.map((toolCall) => toolCall.toolCallId));
2075
- if (responseMessages) {
2076
- this.modelAdapter.recordContinuationResponse(scope.turnId, responseMessages);
2077
- }
2078
- else {
2079
- this.modelAdapter.clearContinuation(scope.turnId);
2080
- }
2081
- }
2082
- }
2083
- completedProviderSteps.push({
2084
- toolCalls: returnedToolCalls,
2085
- ...(providerStepUsage ? { usage: providerStepUsage } : {}),
2086
- });
2087
- lastCompletedStepHadToolResult = returnedToolCalls.length > 0;
2088
- const stepLimitReached = maxSteps !== undefined && runtimeSteps >= maxSteps;
2089
- if (sandboxBoundaryFinalizationStep ||
2090
- (stepLimitReached &&
2091
- (toolRuntime.shouldFinalizeSandboxBoundary() ||
2092
- toolRuntime.hasSandboxBoundaryDenial()))) {
2093
- scope.loopStopReason = 'permission_handoff';
2094
- scope.loopStopRequested = true;
2095
- }
2096
- const mayTakeAnotherStep = !stepLimitReached && !scope.loopStopRequested && !scope.aborted;
2097
- if (returnedToolCalls.length > 0 && mayTakeAnotherStep) {
2098
- currentStepMessageId = this.newId();
2099
- continue agentLoop;
2100
- }
2101
- // Continuing the turn needs the durable current-run reader, for the
2102
- // same reason the tool-call edge above demands it: the next request
2103
- // has to carry the assistant output this step just produced, and only
2104
- // the ledger projection has it. The no-reader fallback at the top of
2105
- // the loop appends steering alone, which would ask the model to
2106
- // redirect work it cannot see. Without a reader this edge is skipped
2107
- // rather than throwing — the turn still completes and the Host folds
2108
- // the message into the next Turn, which is today's behaviour.
2109
- if (mayTakeAnotherStep && this.input.loadTurnRuntimeEvents) {
2110
- // Last chance for a steer that landed after this turn's final
2111
- // tool-call boundary — including the only boundary a tool-free
2112
- // turn has, which precedes the model's first token. Without it the
2113
- // message is never pulled at all, and whether Steer works would
2114
- // depend on the model happening to call a tool afterwards (#3529).
2115
- // A step-limited turn deliberately skips this: its budget is spent,
2116
- // and the Host folds the message into the next Turn instead.
2117
- const injectedBefore = scope.injectedSteeringMessages.length;
2118
- await this.drainSteeringInto(scope, input, queue);
2119
- // Re-read the stop flags: the drain awaits a durable push, so an
2120
- // `after_step` stop or an abort can land while it is in flight, and
2121
- // `mayTakeAnotherStep` is stale by now. Stop wins — the message is
2122
- // already durable, so the Host folds it into the next Turn.
2123
- if (scope.injectedSteeringMessages.length > injectedBefore &&
2124
- !scope.loopStopRequested &&
2125
- !scope.aborted) {
2126
- currentStepMessageId = this.newId();
2127
- continue agentLoop;
2128
- }
2129
- }
2130
- break agentLoop;
2131
- }
2132
- // Refine the durable cost record + prefix baseline against the final
2133
- // active set. Deferred loading may add tools, while boundary convergence
2134
- // may remove them; comparing membership avoids missing a same-size swap.
2135
- const finalActiveTools = currentRepairToolNames();
2136
- if (finalActiveTools.length !== activeTools.length ||
2137
- finalActiveTools.some((name, index) => name !== activeTools[index])) {
2138
- publishTurnDiagnostics(computeTurnDiagnostics(finalActiveTools));
2139
- }
2140
- // Final usage event. Each adapter result covers one provider request.
2141
- // The send-level owner is `completedStepUsage`, which spans every
2142
- // Runtime loop step and retry. Recording only the final result would
2143
- // silently drop prior requests. An unusable sample in ANY request fails
2144
- // the whole record closed (#972).
2145
- try {
2146
- const attemptTotalUsage = providerOutcome.usage;
2147
- tokenUsage = sawUnusableStepUsage ? undefined : (completedStepUsage ?? attemptTotalUsage);
2148
- if (tokenUsage) {
2149
- const systemPromptHash = turnDiagnostics.requestShape.componentHashes.systemPromptHash;
2150
- tokenUsageCostUsd = this.computeTokenUsageCostUsd(tokenUsage);
2151
- const contextBudgetForUsage = contextBudgetWithRequestProjectionDiagnostics(contextBudgetForTelemetry, activeToolResultPruneDiagnosticPatch, midTurnCompactDiagnosticPatch);
2152
- // Persisted alongside the live event so transcript rebuilds from
2153
- // stored messages keep the TUI ctx segment instead of degrading to
2154
- // `?/<window>` (#4019). Computed once; both writers share it.
2155
- const contextRemainingForUsage = (() => {
2156
- const contextWindow = resolveSelectedModelContextWindow(this.input.connection, this.input.modelId);
2157
- if (lastStepInputTokens !== undefined && contextWindow !== undefined) {
2158
- return Math.max(0, contextWindow - lastStepInputTokens);
2159
- }
2160
- return undefined;
2161
- })();
2162
- // One shared usage payload for the durable message and the live
2163
- // event: twin per-field literals drifted before (#4019), so a field
2164
- // now has exactly one definition site.
2165
- const usageFields = {
2166
- input: tokenUsage.inputTokens,
2167
- output: tokenUsage.outputTokens,
2168
- cacheHitInput: tokenUsage.cacheHitInputTokens,
2169
- cacheMissInput: tokenUsage.cacheMissInputTokens,
2170
- cacheMissInputSource: tokenUsage.cacheMissInputSource,
2171
- cacheWriteInput: tokenUsage.cacheWriteInputTokens,
2172
- reasoning: tokenUsage.reasoningTokens,
2173
- total: tokenUsage.totalTokens,
2174
- ...(tokenUsage.rawFinishReason !== undefined
2175
- ? { rawFinishReason: tokenUsage.rawFinishReason }
2176
- : {}),
2177
- ...(runtimeSteps > 0 ? { runtimeSteps } : {}),
2178
- ...(tokenUsage.cachedInputTokens > 0
2179
- ? { cacheRead: tokenUsage.cachedInputTokens }
2180
- : {}),
2181
- ...(tokenUsage.cacheWriteInputTokens > 0
2182
- ? { cacheCreation: tokenUsage.cacheWriteInputTokens }
2183
- : {}),
2184
- ...(tokenUsageCostUsd !== undefined ? { costUsd: tokenUsageCostUsd } : {}),
2185
- systemPromptHash,
2186
- prefixHash: turnDiagnostics.requestShape.prefixHash,
2187
- prefixChangeReason: turnDiagnostics.requestShape.prefixChangeReason,
2188
- requestShapeHash: turnDiagnostics.requestShape.requestShapeHash,
2189
- requestShapeChangeReason: turnDiagnostics.requestShape.requestShapeChangeReason,
2190
- promptSegments: turnDiagnostics.promptSegments,
2191
- ...(contextBudgetForUsage ? { contextBudget: contextBudgetForUsage } : {}),
2192
- ...(contextRemainingForUsage !== undefined
2193
- ? { contextRemaining: contextRemainingForUsage }
2194
- : {}),
2195
- ...(providerRequestTraceId ? { providerRequestTraceId } : {}),
2196
- };
2197
- const tu = {
2198
- type: 'token_usage',
2199
- id: this.newId(),
2200
- turnId,
2201
- ts: this.now(),
2202
- ...usageFields,
2203
- };
2204
- await this.input.appendMessage(tu).catch(() => { });
2205
- if (!contextCompactionFailedOpenNoteWritten &&
2206
- shouldAppendContextCompactionFailedOpenNote(contextBudgetForUsage)) {
2207
- contextCompactionFailedOpenNoteWritten = true;
2208
- const note = {
2209
- type: 'system_note',
2210
- id: this.newId(),
2211
- turnId,
2212
- ts: this.now(),
2213
- kind: 'context_compaction_failed_open',
2214
- };
2215
- await this.input.appendMessage(note).catch(() => { });
2216
- }
2217
- if (!contextCompactedNoteWritten &&
2218
- shouldAppendContextCompactedNote(contextBudgetForUsage)) {
2219
- contextCompactedNoteWritten = true;
2220
- const note = {
2221
- type: 'system_note',
2222
- id: this.newId(),
2223
- turnId,
2224
- ts: this.now(),
2225
- kind: 'context_compacted',
2226
- };
2227
- await this.input.appendMessage(note).catch(() => { });
2228
- }
2229
- queue.push({
2230
- type: 'token_usage',
2231
- id: this.newId(),
2232
- turnId,
2233
- ts: this.now(),
2234
- ...usageFields,
2235
- });
2236
- }
2237
- }
2238
- catch {
2239
- // best-effort; ai-sdk usage promise may reject on abort
2240
- }
2241
- // Nothing may await between this check and terminal emission: Stop must
2242
- // win even when it arrives during post-stream usage persistence.
2243
- if (scope.aborted)
2244
- throw Object.assign(new Error('aborted'), { name: 'AbortError' });
2245
- if (terminalProviderError)
2246
- throw terminalProviderError;
2247
- const stopReason = scope.loopStopReason ??
2248
- (maxSteps !== undefined && finishReason === 'tool-calls'
2249
- ? 'step_limit'
2250
- : this.mapFinishReason(finishReason));
2251
- trace.modelStreamCompleted(stopReason);
2252
- const completeEvent = {
2253
- type: 'complete',
2254
- id: this.newId(),
2255
- turnId,
2256
- ts: this.now(),
2257
- stopReason,
2258
- };
2259
- queue.push(completeEvent);
2260
- if (scope.memoryExtractRequested && this.input.memoryExtraction) {
2261
- const snapshot = this.memorySourceSnapshotFromScope(scope, {
2262
- trigger: 'extract',
2263
- terminalEventId: completeEvent.id,
2264
- });
2265
- if (snapshot) {
2266
- void queue
2267
- .waitUntilConsumedThroughCurrent()
2268
- .then(() => this.input.memoryExtraction?.extract(snapshot))
2269
- .catch(() => undefined);
2270
- }
2271
- }
2272
- }
2273
- catch (err) {
2274
- streamStatus = scope.aborted ? 'aborted' : 'error';
2275
- streamErrorClass = this.modelAdapter.classifyError(currentWatchdogTimeout()?.error ?? err);
2276
- // Flush the in-flight step's partial text/thinking before the terminal
2277
- // abort/error events. Earlier steps already flushed at their
2278
- // `finish-step`; this keeps their and this step's streamed-out output on
2279
- // BOTH exits — user stop and provider error / watchdog timeout — so
2280
- // partialOutputRetained reflects what the user actually saw.
2281
- await flushStep().catch(() => { });
2282
- if (!scope.aborted && midTurnState?.exhaustedDetail) {
2283
- // Mid-turn compaction could not produce a provider-safe request: end
2284
- // the turn with the explicit first-class outcome, not a raw error.
2285
- streamErrorClass = 'ContextBudgetExhausted';
2286
- trace.modelStreamCompleted('context_budget_exhausted');
2287
- queue.push({
2288
- type: 'complete',
2289
- id: this.newId(),
2290
- turnId,
2291
- ts: this.now(),
2292
- stopReason: 'context_budget_exhausted',
2293
- contextBudgetExhaustedDetail: midTurnState.exhaustedDetail,
2294
- });
2295
- }
2296
- else if (scope.aborted) {
2297
- queue.push({
2298
- type: 'abort',
2299
- id: this.newId(),
2300
- turnId,
2301
- ts: this.now(),
2302
- reason: 'user_stop',
2303
- });
2304
- queue.push({
2305
- type: 'complete',
2306
- id: this.newId(),
2307
- turnId,
2308
- ts: this.now(),
2309
- stopReason: 'user_stop',
2310
- });
2311
- }
2312
- else {
2313
- const terminalError = currentWatchdogTimeout()?.error ?? err;
2314
- queue.push(this.makeErrorEvent(turnId, terminalError, terminalProviderErrorReason));
2315
- trace.modelStreamFailed(streamErrorClass, terminalError, priorReplayFailureTrace(priorReplay));
2316
- queue.push({
2317
- type: 'complete',
2318
- id: this.newId(),
2319
- turnId,
2320
- ts: this.now(),
2321
- stopReason: 'error',
2322
- });
2323
- }
2324
- }
2325
- finally {
2326
- watchdogState.current?.stop();
2327
- if (scope.watchdog === watchdogState.current)
2328
- scope.watchdog = null;
2329
- contextBudgetForTelemetry = contextBudgetWithRequestProjectionDiagnostics(contextBudgetForTelemetry, activeToolResultPruneDiagnosticPatch, midTurnCompactDiagnosticPatch);
2330
- // `tokenUsage` still backfills from the completed steps when the send
2331
- // ended without a final `usage`: the terminal outcome and the
2332
- // `token_usage` SessionEvent below both read it. An unusable sample in
2333
- // any step fails it closed rather than posing a partial sum as the
2334
- // whole call (#972).
2335
- //
2336
- // The send-level `recordLlmCall` that used to sit here is gone (#1679).
2337
- // It measured the same provider requests the canonical seam now settles
2338
- // into `ModelCallAttempt`, one record per physical request instead of
2339
- // one aggregate per send, and keeping both would have been two
2340
- // independent meters free to disagree.
2341
- //
2342
- // What does NOT follow it out is the diagnostics that rode on it. The
2343
- // exhausted and aborted paths emit no `token_usage` SessionEvent, so
2344
- // their compaction decisions and the accumulated usage of the steps that
2345
- // did complete had that record as their only durable home. They move to
2346
- // the run trace, which carries no cost and meters nothing.
2347
- if (!tokenUsage && completedStepUsage && !sawUnusableStepUsage) {
2348
- tokenUsage = completedStepUsage;
2349
- tokenUsageCostUsd = this.computeTokenUsageCostUsd(tokenUsage);
2350
- }
2351
- trace.sendDiagnostics({
2352
- status: streamStatus,
2353
- ...(streamErrorClass ? { errorClass: streamErrorClass } : {}),
2354
- ...(tokenUsage
2355
- ? {
2356
- inputTokens: tokenUsage.inputTokens,
2357
- outputTokens: tokenUsage.outputTokens,
2358
- totalTokens: tokenUsage.totalTokens,
2359
- }
2360
- : {}),
2361
- ...(contextBudgetForTelemetry !== undefined
2362
- ? { contextBudget: contextBudgetForTelemetry }
2363
- : {}),
2364
- ...(promptSegmentsForTelemetry.length > 0
2365
- ? { promptSegments: promptSegmentsForTelemetry }
2366
- : {}),
2367
- ...(requestShapeForTelemetry !== undefined
2368
- ? {
2369
- systemPromptHash: requestShapeForTelemetry.componentHashes.systemPromptHash,
2370
- prefixHash: requestShapeForTelemetry.prefixHash,
2371
- prefixChangeReason: requestShapeForTelemetry.prefixChangeReason,
2372
- requestShapeHash: requestShapeForTelemetry.requestShapeHash,
2373
- requestShapeChangeReason: requestShapeForTelemetry.requestShapeChangeReason,
2374
- ...(requestShapeForTelemetry.toolSchemaChangeReason !== undefined
2375
- ? {
2376
- toolSchemaChangeReason: requestShapeForTelemetry.toolSchemaChangeReason,
2377
- }
2378
- : {}),
2379
- ...(requestShapeForTelemetry.toolAvailability !== undefined
2380
- ? {
2381
- toolAvailability: requestShapeForTelemetry.toolAvailability,
2382
- }
2383
- : {}),
2384
- }
2385
- : {}),
2386
- });
2387
- queue.close();
2388
- }
2389
- })();
2390
- let drainedNormally = false;
2391
- try {
2392
- // drain() carries the seq-ack semantics (consumer pull = processed ack);
2393
- // every consumer-facing path must go through it.
2394
- yield* this.drain(queue);
2395
- drainedNormally = true;
2396
- }
2397
- finally {
2398
- if (!drainedNormally)
2399
- turnAbortController.abort();
2400
- await pumpDone.catch(() => { });
2401
- }
273
+ maxSteps: this.maxSteps,
274
+ providerRetrySleep: this.providerRetrySleep,
275
+ createToolRuntime: (owner) => this.createToolRuntime({
276
+ inheritedSandboxBoundaryDenied: input.continuation?.sandboxBoundaryDenied === true,
277
+ turnId: owner.turnId,
278
+ runId: owner.runId,
279
+ invocationId: input.invocationId ?? input.runId,
280
+ hostedInteraction: input.hostedInteraction,
281
+ orchestrationMode: owner.orchestration.mode,
282
+ scope: () => owner,
283
+ }),
284
+ }, input);
285
+ this.activeTurns.add(turn);
286
+ return turn;
2402
287
  }
2403
- async executeCodeModeCell(scope, eventSink, code, context) {
2404
- const snapshot = new Map(scope.codeModeTools);
2405
- let nestedOutputBytes = 0;
2406
- let nestedOutputLimitExceeded = false;
2407
- const nestedEventSink = {
2408
- push: (event) => {
2409
- if (event.type === 'tool_output_delta') {
2410
- const nextBytes = new TextEncoder().encode(event.chunk).byteLength;
2411
- if (nestedOutputLimitExceeded ||
2412
- nestedOutputBytes + nextBytes > DEFAULT_CODE_MODE_EXECUTION_POLICY.maxToolOutputBytes) {
2413
- nestedOutputLimitExceeded = true;
2414
- return;
2415
- }
2416
- nestedOutputBytes += nextBytes;
2417
- }
2418
- eventSink.push(event);
2419
- },
2420
- pushAndWaitUntilConsumed: (event) => eventSink.pushAndWaitUntilConsumed(event),
2421
- };
2422
- // A permit is held across the cell's complete lifecycle, not just its
2423
- // sandbox run: `executeCodeCell` settles only once the cell's host
2424
- // operations have drained, so releasing on settlement covers the drain.
2425
- // The sandbox worker cap cannot serve this purpose — on cancellation
2426
- // `runCodeMode` releases its worker and rejects at once, by design, while
2427
- // host operations started by the cell may still be running with durable
2428
- // side effects. Only the Runtime waits for those, so only the Runtime can
2429
- // bound them; releasing when the worker is released would let repeated
2430
- // cancellation accumulate host work without bound.
2431
- //
2432
- // One cell may wait; the next is turned away rather than queued, which is
2433
- // what the Code Mode adapter did before this moved to the side that owns
2434
- // execution. Nothing awaits between reading `waitingCount` and the enqueue
2435
- // inside `acquire`, so the pair is atomic.
2436
- if (this.codeCellAdmission.waitingCount >= MAX_WAITING_CODE_MODE_CELLS) {
2437
- return {
2438
- ok: false,
2439
- error: { kind: 'limit_exceeded', message: 'Code Mode execution queue is full' },
2440
- toolCalls: [],
2441
- };
2442
- }
2443
- const permit = await this.codeCellAdmission.acquire(context.abortSignal);
288
+ async *send(input) {
289
+ const turn = this.openTurnScope(input);
2444
290
  try {
2445
- return await executeCodeCell({
2446
- code,
2447
- signal: context.abortSignal,
2448
- tools: [...snapshot.values()].map((tool) => ({
2449
- name: tool.name,
2450
- })),
2451
- isFatalToolError: isRuntimeCommitBoundaryError,
2452
- callTool: async (name, input, signal) => {
2453
- const tool = snapshot.get(name);
2454
- if (!tool)
2455
- throw new Error(`Tool "${name}" is not active or nestable in this cell`);
2456
- const parsedInput = await validateCodeModeToolInput(tool, input);
2457
- const settlement = await scope.toolRuntime.settleToolCallRaw({
2458
- tool,
2459
- turnId: context.turnId,
2460
- toolCallId: `${context.toolCallId}:nested:${this.newId()}`,
2461
- input: parsedInput,
2462
- abortSignal: signal,
2463
- eventSink: nestedEventSink,
2464
- origin: 'code_mode',
2465
- parentToolCallId: context.toolCallId,
2466
- ...(context.operationId ? { parentOperationId: context.operationId } : {}),
2467
- maxResultBytes: DEFAULT_CODE_MODE_EXECUTION_POLICY.maxToolOutputBytes,
2468
- });
2469
- if (settlement.providerError !== undefined) {
2470
- throw new Error(settlement.providerError);
2471
- }
2472
- if (nestedOutputLimitExceeded) {
2473
- throw new Error('Code Mode nested output byte limit exceeded');
2474
- }
2475
- return settlement.result;
2476
- },
2477
- });
291
+ yield* turn.run();
2478
292
  }
2479
293
  finally {
2480
- permit.release();
294
+ this.activeTurns.delete(turn);
295
+ await turn.close();
2481
296
  }
2482
297
  }
2483
- handlePlanToolResult(scope, result, queue) {
2484
- const turnId = scope.turnId;
2485
- if (result.kind === 'plan_submitted') {
2486
- const proposal = result.proposal;
2487
- queue.push({
2488
- type: 'plan_submitted',
2489
- id: this.newId(),
2490
- turnId,
2491
- ts: this.now(),
2492
- planId: proposal.planId,
2493
- proposalId: proposal.proposalId,
2494
- revision: proposal.revision,
2495
- title: proposal.title,
2496
- ...(proposal.overview ? { overview: proposal.overview } : {}),
2497
- ...(proposal.risks ? { risks: proposal.risks } : {}),
2498
- steps: proposal.steps.map((step) => ({ ...step, status: 'pending' })),
2499
- });
2500
- scope.runTrace?.emit('plan', 'plan_submitted', 'Plan submitted', {
2501
- planId: proposal.planId,
2502
- proposalId: proposal.proposalId,
2503
- revision: proposal.revision,
2504
- storeVersion: result.storeVersion,
2505
- });
2506
- scope.loopStopReason = 'plan_handoff';
2507
- scope.loopStopRequested = true;
2508
- return;
2509
- }
2510
- const traceType = result.kind;
2511
- scope.runTrace?.emit('plan', traceType, 'Plan execution state changed', {
2512
- planId: result.execution.planId,
2513
- proposalId: result.execution.proposalId,
2514
- executionId: result.execution.executionId,
2515
- storeVersion: result.storeVersion,
2516
- });
2517
- // Completing or cancelling the execution is a tool boundary, not the end of
2518
- // the conversational Turn. The execution prompt tells the model to persist
2519
- // final progress before its final response, so let it consume this result
2520
- // and produce that response on the next provider step.
2521
- }
2522
- handleAgentGraphYieldToolResult(scope, result) {
2523
- scope.runTrace?.emit('agent_graph', 'graph_supervisor_yielded', 'Graph supervisor yielded', {
2524
- pendingWorkCount: result.pendingWorkCount,
2525
- liveOperatorCount: result.liveOperatorCount,
2526
- reason: result.reason,
2527
- });
2528
- scope.loopStopReason = 'graph_yield';
2529
- scope.loopStopRequested = true;
2530
- }
2531
- // --------------------------------------------------------------------------
2532
- // Helpers
2533
- // --------------------------------------------------------------------------
2534
298
  /**
2535
299
  * Stop every turn this backend is currently running.
2536
300
  *
@@ -2550,21 +314,16 @@ export class AiSdkBackend {
2550
314
  * skipped `endTurn` was supposed to reject.
2551
315
  */
2552
316
  async stop(_reason, mode = 'immediate') {
2553
- const scopes = [...this.activeTurns];
317
+ const turns = [...this.activeTurns];
2554
318
  if (mode === 'after_step') {
2555
- for (const scope of scopes) {
2556
- scope.loopStopRequested = true;
2557
- scope.runTrace?.abortRequested(_reason);
2558
- }
319
+ for (const turn of turns)
320
+ turn.requestStop(_reason, mode);
2559
321
  return;
2560
322
  }
2561
323
  this.compaction.abortHistoryCompact();
2562
- for (const scope of scopes) {
2563
- scope.aborted = true;
2564
- scope.abortController.abort();
2565
- scope.runTrace?.abortRequested(_reason);
2566
- }
2567
- const settled = await Promise.allSettled(scopes.map((scope) => scope.toolRuntime.endTurn('aborted')));
324
+ for (const turn of turns)
325
+ turn.requestStop(_reason, mode);
326
+ const settled = await Promise.allSettled(turns.map((turn) => turn.endAbortedTools()));
2568
327
  const failures = settled.flatMap((result) => result.status === 'rejected' ? [result.reason] : []);
2569
328
  if (failures.length === 1)
2570
329
  throw failures[0];
@@ -2574,15 +333,15 @@ export class AiSdkBackend {
2574
333
  async respondToSandboxBoundary(decision) {
2575
334
  // Routed by request id, which is already the identity the registry matches
2576
335
  // on: at most one turn parked this request.
2577
- for (const scope of this.activeTurns) {
2578
- if (await scope.toolRuntime.respondToSandboxBoundaryResponse(decision))
336
+ for (const turn of this.activeTurns) {
337
+ if (await turn.respondToSandboxBoundary(decision))
2579
338
  return;
2580
339
  }
2581
340
  throw new Error(`No pending sandbox boundary request ${decision.requestId}`);
2582
341
  }
2583
342
  async respondToUserQuestion(response) {
2584
- for (const scope of this.activeTurns) {
2585
- if (scope.toolRuntime.respondToUserQuestion(response))
343
+ for (const turn of this.activeTurns) {
344
+ if (turn.respondToUserQuestion(response))
2586
345
  return;
2587
346
  }
2588
347
  }
@@ -2593,1389 +352,4 @@ export class AiSdkBackend {
2593
352
  this.compaction.abortHistoryCompact();
2594
353
  this.modelAdapter.dispose();
2595
354
  }
2596
- /** Map a completed provider finish reason → our CompleteEvent.stopReason. */
2597
- mapFinishReason(reason) {
2598
- return this.modelAdapter.mapFinishReason(reason);
2599
- }
2600
- makeErrorEvent(turnId, err, reasonOverride) {
2601
- return this.modelAdapter.makeErrorEvent(turnId, err, reasonOverride);
2602
- }
2603
- computeTokenUsageCostUsd(usage) {
2604
- try {
2605
- const pricing = (this.input.lookupPricing ?? getBuiltinPricing)(pricingModelKey(this.input.connection.providerType, this.input.modelId));
2606
- if (pricing === null)
2607
- return undefined;
2608
- return computeCost({
2609
- inputTokens: usage.inputTokens,
2610
- outputTokens: usage.outputTokens,
2611
- cacheHitInputTokens: usage.cacheHitInputTokens,
2612
- cacheMissInputTokens: usage.cacheMissInputTokens,
2613
- cacheWriteInputTokens: usage.cacheWriteInputTokens,
2614
- }, pricing).totalCost;
2615
- }
2616
- catch {
2617
- return undefined;
2618
- }
2619
- }
2620
- /**
2621
- * One tracker for one physical provider call kind (#1679).
2622
- *
2623
- * Auxiliary calls get the same capture, attempt, and accounting plumbing the
2624
- * main send uses, built here because the sinks and the current run live on
2625
- * this backend. Callers receive a ready tracker rather than the ingredients:
2626
- * a half-wired tracker is what produces records nothing can attribute.
2627
- *
2628
- * Absent only when there is nothing to feed: no capture sink *and* no
2629
- * canonical sink. Metering deliberately does not depend on capture — capture
2630
- * is a diagnostic, and a deployment that turns it off must still be billed.
2631
- */
2632
- createProviderRequestTracker(input) {
2633
- const persistCapture = this.input.recordProviderRequestCapture;
2634
- const accounting = this.modelCallAccounting(input.callKind, {
2635
- modelId: input.modelId,
2636
- ...(input.runId ? { runId: input.runId } : {}),
2637
- ...(input.historyCompactRoute ? { historyCompactRoute: input.historyCompactRoute } : {}),
2638
- });
2639
- const runId = input.runId;
2640
- const beforeRunProviderDispatch = this.input.beforeRunProviderDispatch;
2641
- const beforeDispatch = runId && beforeRunProviderDispatch
2642
- ? () => beforeRunProviderDispatch({
2643
- sessionId: this.sessionId,
2644
- turnId: input.turnId,
2645
- runId,
2646
- })
2647
- : undefined;
2648
- if (!persistCapture && !accounting && !beforeDispatch)
2649
- return undefined;
2650
- return new ProviderRequestTracker({
2651
- traceId: this.newId(),
2652
- turnId: input.turnId,
2653
- contextWindow: resolveSelectedModelContextWindow(this.input.connection, input.modelId),
2654
- now: this.now,
2655
- newId: this.newId,
2656
- ...(persistCapture ? { persistCapture } : {}),
2657
- recordAttempt: this.input.recordProviderRequestAttempt ?? (() => { }),
2658
- ...(beforeDispatch ? { beforeDispatch } : {}),
2659
- ...(accounting ? { accounting } : {}),
2660
- });
2661
- }
2662
- /**
2663
- * Accounting identity for one call kind (#1679).
2664
- *
2665
- * The run is always supplied by the caller. It cannot be read back off this
2666
- * backend: one instance serves several concurrent runs, so whichever turn
2667
- * touched it last would speak for all of them (#1990).
2668
- *
2669
- * Absent when there is no canonical sink, which leaves the corresponding
2670
- * tracker purely diagnostic.
2671
- */
2672
- modelCallAccounting(callKind, identity) {
2673
- const record = this.input.recordModelCallAttempt;
2674
- if (!record)
2675
- return undefined;
2676
- const modelId = identity?.modelId ?? this.input.modelId;
2677
- return {
2678
- sessionId: this.sessionId,
2679
- resolveRunId: () => identity?.runId,
2680
- connectionSlug: this.input.connection.slug,
2681
- providerId: this.input.connection.providerType,
2682
- callKind,
2683
- ...(identity?.historyCompactRoute
2684
- ? { historyCompactRoute: identity.historyCompactRoute }
2685
- : {}),
2686
- record,
2687
- resolveCost: (usage) => this.resolveModelCallCost(usage, modelId),
2688
- ...(this.input.assertModelCallAccountingReady
2689
- ? { assertReady: this.input.assertModelCallAccountingReady }
2690
- : {}),
2691
- };
2692
- }
2693
- /**
2694
- * Resolves cost for a canonical accounting record at settlement time, together
2695
- * with the rates it was computed against.
2696
- *
2697
- * The basis travels with the amount because a figure recomputed later from
2698
- * whatever pricing is current would silently drift from what the call actually
2699
- * cost. An unresolvable price returns `undefined` rather than zero — the
2700
- * record then carries `costBasis: 'unpriced'`, which is not the same claim as
2701
- * a call that was free.
2702
- *
2703
- * Priced against the model that actually served the request. Recording one
2704
- * model's id beside another model's rates would make the stored amount
2705
- * unauditable in exactly the way `pricingRates` exists to prevent.
2706
- */
2707
- resolveModelCallCost(usage, modelId) {
2708
- try {
2709
- const pricing = (this.input.lookupPricing ?? getBuiltinPricing)(pricingModelKey(this.input.connection.providerType, modelId));
2710
- if (pricing === null)
2711
- return undefined;
2712
- const costUsd = computeCost({
2713
- inputTokens: usage.inputTokens ?? 0,
2714
- outputTokens: usage.outputTokens ?? 0,
2715
- cacheHitInputTokens: usage.cacheReadInputTokens ?? 0,
2716
- cacheMissInputTokens: usage.cacheMissInputTokens ?? 0,
2717
- cacheWriteInputTokens: usage.cacheWriteInputTokens ?? 0,
2718
- }, pricing).totalCost;
2719
- if (costUsd === undefined || !Number.isFinite(costUsd))
2720
- return undefined;
2721
- return { costUsd, pricingRates: pricing };
2722
- }
2723
- catch {
2724
- return undefined;
2725
- }
2726
- }
2727
- /** Materialize RuntimeEvent-derived projections into ai-sdk's message format.
2728
- * V0.1: text-only round-tripping. Tool calls / results within projected
2729
- * history are deliberately NOT replayed unless RuntimeEvent native replay
2730
- * is available for the provider. */
2731
- async buildPriorMessages(scope, input, automaticMemory) {
2732
- const priorStored = input.context.filter((message) => message.turnId !== input.turnId);
2733
- if (!input.runtimeContext) {
2734
- return {
2735
- status: 'ready',
2736
- messages: await this.materializePriorMessages(scope.imageBudget, priorStored),
2737
- gate: 'stored_message_projection',
2738
- diagnostics: [],
2739
- };
2740
- }
2741
- const priorRuntimeContext = input.runtimeContext.filter((event) => event.turnId !== input.turnId);
2742
- const projectedMessages = await this.materializePriorMessages(scope.imageBudget, priorStored, buildSteeringSidecar(priorRuntimeContext));
2743
- const preparedContextBudget = await this.compaction.prepareContextBudgetPolicy(priorRuntimeContext);
2744
- let contextBudget = preparedContextBudget.policy;
2745
- const budgeted = applyRuntimeEventContextBudget(priorRuntimeContext, contextBudget);
2746
- let runtimeContext = budgeted?.events ?? priorRuntimeContext;
2747
- let contextBudgetDiagnostic = budgeted?.diagnostic;
2748
- let projectedHistoryCompactCheckpoint = budgeted?.historyCompactCheckpoint;
2749
- if (preparedContextBudget.diagnosticPatch) {
2750
- contextBudgetDiagnostic = mergeContextBudgetDiagnostic(contextBudgetDiagnostic ??
2751
- buildContextBudgetDiagnosticShell(priorRuntimeContext, runtimeContext, contextBudget), preparedContextBudget.diagnosticPatch);
2752
- }
2753
- const maxHistoryTokens = contextBudget?.maxHistoryEstimatedTokens;
2754
- const needsCompaction = maxHistoryTokens !== undefined &&
2755
- estimateRuntimeEventsTokens(runtimeContext, contextBudget?.charsPerToken) > maxHistoryTokens;
2756
- let compactionFailure;
2757
- if (needsCompaction &&
2758
- contextBudget?.historyCompact?.enabled === true &&
2759
- this.compaction.hasHistoryCompactCheckpointWriter()) {
2760
- const automaticMemoryDecision = automaticMemory
2761
- ? this.automaticMemoryCompactionDecision()
2762
- : undefined;
2763
- const automaticMemorySource = automaticMemoryDecision
2764
- ? lastNonCompactRuntimeEvent(priorRuntimeContext)
2765
- : undefined;
2766
- const compactResult = await this.compaction.compactHistory({
2767
- turnId: input.turnId,
2768
- runId: scope.runId,
2769
- runtimeContext: priorRuntimeContext,
2770
- }, this.priorRequestShape?.requestShapeHash, automaticMemorySource
2771
- ? {
2772
- runId: automaticMemorySource.runId,
2773
- turnId: automaticMemorySource.turnId,
2774
- runtimeEventId: automaticMemorySource.id,
2775
- disposition: automaticMemoryDecision.disposition,
2776
- }
2777
- : undefined);
2778
- let durableCheckpoint = compactResult.checkpoint;
2779
- if (!durableCheckpoint && compactResult.outcome.kind === 'unchanged') {
2780
- try {
2781
- durableCheckpoint = await Promise.resolve(this.input.loadHistoryCompactCheckpoint?.());
2782
- }
2783
- catch {
2784
- durableCheckpoint = undefined;
2785
- }
2786
- }
2787
- if (durableCheckpoint) {
2788
- const replay = buildHistoryCompactCheckpointFailOpenContext(durableCheckpoint, priorRuntimeContext, contextBudget, priorRuntimeContext);
2789
- runtimeContext = replay.events;
2790
- projectedHistoryCompactCheckpoint = replay.checkpoint;
2791
- if (replay.checkpoint &&
2792
- compactResult.outcome.kind === 'compacted' &&
2793
- automaticMemoryDecision?.dispatch &&
2794
- automaticMemory) {
2795
- this.dispatchAutomaticMemoryCompaction(scope, {
2796
- checkpoint: replay.checkpoint,
2797
- activeTools: [],
2798
- });
2799
- }
2800
- }
2801
- if (compactResult.outcome.kind === 'failed') {
2802
- compactionFailure =
2803
- compactResult.outcome.reason === 'no_safe_completed_span'
2804
- ? 'no_safe_completed_span'
2805
- : isMalformedHistoryCompactSummaryReason(compactResult.outcome.reason)
2806
- ? compactResult.outcome.reason
2807
- : 'summarizer_failed';
2808
- }
2809
- contextBudgetDiagnostic = mergeContextBudgetDiagnostic(contextBudgetDiagnostic ??
2810
- buildContextBudgetDiagnosticShell(priorRuntimeContext, runtimeContext, contextBudget), compactResult.contextBudget ?? {});
2811
- }
2812
- if (maxHistoryTokens !== undefined &&
2813
- estimateRuntimeEventsTokens(runtimeContext, contextBudget?.charsPerToken) > maxHistoryTokens) {
2814
- return {
2815
- status: 'context_budget_exhausted',
2816
- detail: compactionFailure ?? 'no_safe_completed_span',
2817
- ...(contextBudgetDiagnostic ? { contextBudget: contextBudgetDiagnostic } : {}),
2818
- };
2819
- }
2820
- // The boundary belongs to the runtime-event projection above. A gate that
2821
- // falls back to the stored-message projection returns a prompt no
2822
- // checkpoint shaped, so it reports none rather than one the request never
2823
- // stood on (#2323).
2824
- const replayBoundary = (fromRuntimeReplay) => fromRuntimeReplay && projectedHistoryCompactCheckpoint
2825
- ? { latestHistoryCompactCheckpoint: projectedHistoryCompactCheckpoint }
2826
- : {};
2827
- const plan = buildRuntimeEventModelReplayPlan(runtimeContext,
2828
- // `runtimeContext` may be a budget/history-search slice; the tool-turn
2829
- // thinking skip is a whole-history invariant, so seed it from the full
2830
- // prior ledger so a sliced-in tool-turn thinking still gets skipped.
2831
- { toolActivityTurnIds: collectToolActivityTurnIds(priorRuntimeContext) });
2832
- const hasProviderHistoryCompactCheckpoint = projectedHistoryCompactCheckpoint !== undefined &&
2833
- isProviderHistoryCompactCheckpoint(projectedHistoryCompactCheckpoint);
2834
- const fallbackUsesRuntimeReplay = Boolean(input.continuation) || hasProviderHistoryCompactCheckpoint;
2835
- // StoredMessage projection cannot represent an opaque provider checkpoint.
2836
- // Once one is selected, every degraded replay path must remain in the
2837
- // RuntimeEvent materializer so the checkpoint boundary is not bypassed.
2838
- const materializeReplayFallback = () => fallbackUsesRuntimeReplay
2839
- ? this.materializeRuntimeReplayTextOnly(scope.imageBudget, plan, projectedHistoryCompactCheckpoint)
2840
- : Promise.resolve(projectedMessages);
2841
- if (plan.items.length === 0 && !hasProviderHistoryCompactCheckpoint) {
2842
- return {
2843
- status: 'ready',
2844
- messages: await materializeReplayFallback(),
2845
- gate: input.continuation ? 'runtime_replay_text_only' : 'stored_message_projection',
2846
- diagnostics: plan.diagnostics,
2847
- runtimeEventCount: runtimeContext.length,
2848
- ...(contextBudgetDiagnostic ? { contextBudget: contextBudgetDiagnostic } : {}),
2849
- ...replayBoundary(fallbackUsesRuntimeReplay),
2850
- };
2851
- }
2852
- if (hasBlockingReplayDiagnostics(plan)) {
2853
- return {
2854
- status: 'ready',
2855
- messages: await materializeReplayFallback(),
2856
- gate: input.continuation
2857
- ? 'runtime_replay_text_only'
2858
- : 'runtime_replay_unsupported_semantics',
2859
- diagnostics: plan.diagnostics,
2860
- runtimeEventCount: runtimeContext.length,
2861
- ...(contextBudgetDiagnostic ? { contextBudget: contextBudgetDiagnostic } : {}),
2862
- ...replayBoundary(fallbackUsesRuntimeReplay),
2863
- };
2864
- }
2865
- if (!plan.hasProviderNativeSemantics) {
2866
- return {
2867
- status: 'ready',
2868
- messages: await this.materializeRuntimeReplayPlan(plan, scope.imageBudget, undefined, projectedHistoryCompactCheckpoint),
2869
- gate: 'runtime_replay_text_only',
2870
- diagnostics: plan.diagnostics,
2871
- runtimeEventCount: runtimeContext.length,
2872
- ...(contextBudgetDiagnostic ? { contextBudget: contextBudgetDiagnostic } : {}),
2873
- ...replayBoundary(true),
2874
- };
2875
- }
2876
- if (!this.canReplayProviderNative(plan)) {
2877
- // Degrade per item, not per plan: an unsupported provider-executed pair
2878
- // must not cost unrelated client tool history (#2972). Thinking items
2879
- // stay in the plan; materializeRuntimeReplayPlan degrades unsupported
2880
- // reasoning per item via reasoningReplay.
2881
- const degradedPlan = this.dropUnsupportedReplayItems(plan);
2882
- return {
2883
- status: 'ready',
2884
- messages: degradedPlan.items.length > 0 || hasProviderHistoryCompactCheckpoint
2885
- ? await this.materializeRuntimeReplayPlan(degradedPlan, scope.imageBudget, undefined, projectedHistoryCompactCheckpoint)
2886
- : await materializeReplayFallback(),
2887
- gate: input.continuation
2888
- ? 'runtime_replay_text_only'
2889
- : 'runtime_replay_unsupported_semantics',
2890
- diagnostics: plan.diagnostics,
2891
- runtimeEventCount: runtimeContext.length,
2892
- ...(contextBudgetDiagnostic ? { contextBudget: contextBudgetDiagnostic } : {}),
2893
- ...replayBoundary(fallbackUsesRuntimeReplay),
2894
- };
2895
- }
2896
- return {
2897
- status: 'ready',
2898
- messages: await this.materializeRuntimeReplayPlan(plan, scope.imageBudget, undefined, projectedHistoryCompactCheckpoint),
2899
- gate: 'runtime_replay_provider_native',
2900
- diagnostics: plan.diagnostics,
2901
- runtimeEventCount: runtimeContext.length,
2902
- ...(contextBudgetDiagnostic ? { contextBudget: contextBudgetDiagnostic } : {}),
2903
- ...replayBoundary(true),
2904
- };
2905
- }
2906
- canReplayProviderNative(plan) {
2907
- const support = this.modelAdapter.runtimeEventReplaySupport();
2908
- for (const item of plan.items) {
2909
- if (item.kind === 'tool_call' && !support.toolCalls)
2910
- return false;
2911
- if (item.kind === 'tool_result' && !support.toolResults)
2912
- return false;
2913
- if ((item.kind === 'tool_call' || item.kind === 'tool_result') &&
2914
- item.providerExecuted === true &&
2915
- !support.providerExecutedTools) {
2916
- return false;
2917
- }
2918
- if (item.kind === 'thinking' && item.signature && !support.signedThinking)
2919
- return false;
2920
- }
2921
- return true;
2922
- }
2923
- /**
2924
- * Per-item counterpart to {@link canReplayProviderNative}: drop only the
2925
- * items the adapter cannot represent so one unsupported provider-executed
2926
- * pair does not cost unrelated client tool history (#2972). Call and result
2927
- * items fall together — a call without its result is a dangling wire item,
2928
- * and provider-executed pairs are flagged on both items by the plan.
2929
- */
2930
- dropUnsupportedReplayItems(plan) {
2931
- const support = this.modelAdapter.runtimeEventReplaySupport();
2932
- return {
2933
- ...plan,
2934
- items: plan.items.filter((item) => {
2935
- if (item.kind === 'tool_call' || item.kind === 'tool_result') {
2936
- if (!support.toolCalls || !support.toolResults)
2937
- return false;
2938
- if (item.providerExecuted === true && !support.providerExecutedTools)
2939
- return false;
2940
- }
2941
- return true;
2942
- }),
2943
- };
2944
- }
2945
- /**
2946
- * Materialize a replay plan into provider messages, grouping each assistant
2947
- * step's reasoning + text + tool calls into ONE assistant message (Anthropic
2948
- * requires the signed thinking block to lead the tool-use assistant message).
2949
- *
2950
- * The ledger lands a step's parts as: tool_call(s), tool_result(s), thinking,
2951
- * text (the per-step AssistantMessage flushes at `finish-step`, after the
2952
- * step's tool events). Model text carries the step id and closes the step.
2953
- * Client tools replay as `[reasoning, text, tool-call…]` followed by tool
2954
- * messages; provider-executed tools replay as
2955
- * `[reasoning, tool-call, tool-result, text]`, preserving provider chronology
2956
- * for item references and grounded text. Steps with no text closer — a
2957
- * thinking + tool step (its empty text closer is skipped from the plan as
2958
- * `empty_text_skipped`) or a pure-tool step — flush grouped by stepId,
2959
- * claiming any parked reasoning for that step. Legacy per-turn items (no step
2960
- * id) keep the older shape: tool calls form a tool-only assistant,
2961
- * text/thinking become standalone messages.
2962
- */
2963
- async materializeRuntimeReplayPlan(plan, budget, settledModelOutputs, historyCompactCheckpoint) {
2964
- const out = [];
2965
- const push = (message, eventIds) => {
2966
- out.push(message);
2967
- this.memoryReplayMessageEvents.set(message, [...new Set(eventIds)]);
2968
- };
2969
- let bufferedCalls = [];
2970
- const results = new Map();
2971
- const downgradedApplyPatchCalls = new Map();
2972
- const replayFactsByStep = new Map();
2973
- const reasoningByStep = new Map();
2974
- const textByStep = new Map();
2975
- const replaySupport = this.modelAdapter.runtimeEventReplaySupport();
2976
- const reasoningReplay = (item) => {
2977
- if (item.signature) {
2978
- return replaySupport.signedThinking
2979
- ? {
2980
- part: {
2981
- type: 'reasoning',
2982
- text: item.text,
2983
- providerOptions: { anthropic: { signature: item.signature } },
2984
- },
2985
- }
2986
- : undefined;
2987
- }
2988
- if (typeof replaySupport.responsesReasoning === 'object' &&
2989
- replaySupport.responsesReasoning.kind === 'plaintext-item') {
2990
- const decoded = decodePlaintextResponsesReasoningState(item.providerOptions);
2991
- if (decoded.kind === 'missing')
2992
- return undefined;
2993
- if (decoded.kind === 'unsupported-version')
2994
- return undefined;
2995
- if (decoded.kind === 'malformed') {
2996
- if (decoded.profile !== undefined &&
2997
- decoded.profile !== replaySupport.responsesReasoning.profile) {
2998
- return undefined;
2999
- }
3000
- throw new Error('Malformed durable plaintext Responses reasoning state');
3001
- }
3002
- const state = decoded.state;
3003
- if (state.profile !== replaySupport.responsesReasoning.profile) {
3004
- return undefined;
3005
- }
3006
- return {
3007
- part: {
3008
- type: 'reasoning',
3009
- text: item.text,
3010
- providerOptions: replayPlaintextResponsesProviderOptions({
3011
- providerOptionsKey: replaySupport.responsesReasoning.providerOptionsKey,
3012
- state,
3013
- text: item.text,
3014
- }),
3015
- },
3016
- };
3017
- }
3018
- if (replaySupport.responsesReasoning === 'plaintext-content') {
3019
- if (item.text.length === 0)
3020
- return undefined;
3021
- return { part: { type: 'reasoning', text: item.text } };
3022
- }
3023
- if (replaySupport.responsesReasoning === 'encrypted-content') {
3024
- const openai = item.providerOptions?.openai;
3025
- if (openai && typeof openai === 'object' && !Array.isArray(openai)) {
3026
- const { itemId, reasoningEncryptedContent } = openai;
3027
- if (typeof itemId === 'string' &&
3028
- itemId.length > 0 &&
3029
- typeof reasoningEncryptedContent === 'string' &&
3030
- reasoningEncryptedContent.length > 0) {
3031
- return {
3032
- part: {
3033
- type: 'reasoning',
3034
- text: item.text,
3035
- providerOptions: {
3036
- openai: {
3037
- itemId,
3038
- reasoningEncryptedContent,
3039
- },
3040
- },
3041
- },
3042
- };
3043
- }
3044
- }
3045
- }
3046
- if (!replaySupport.unsignedThinking)
3047
- return undefined;
3048
- const reasoningField = openAiChatReasoningFieldFromProviderOptions(item.providerOptions);
3049
- if (!reasoningField)
3050
- return undefined;
3051
- return {
3052
- providerOptions: {
3053
- openaiCompatible: { [reasoningField]: item.text },
3054
- },
3055
- };
3056
- };
3057
- // Tool results are emitted only when their tool_call claims them here. A
3058
- // result whose call never appears in the plan (sliced-away call, corrupt
3059
- // ledger) is INTENTIONALLY dropped at the end: a standalone tool message
3060
- // with no preceding tool_use in an assistant message is an Anthropic 400.
3061
- // The old item-by-item materializer emitted such orphans; do not "fix" this
3062
- // back — the plan flags them as `unmatched_tool_result` (a non-blocking
3063
- // diagnostic precisely so this drop path is reachable; see
3064
- // hasBlockingReplayDiagnostics).
3065
- const materializeReplayToolResult = async (result, toolName) => {
3066
- const output = settledModelOutputs?.get(result.toolCallId) ??
3067
- (await this.materializeToolResultOutput(budget, result.output, result.isError, `runtime-event:${result.eventId}:tool-result`));
3068
- if (toolName !== 'apply_patch')
3069
- return output;
3070
- return result.isError ? nativeApplyPatchFailureOutput(output) : output;
3071
- };
3072
- const pushClientToolResults = async (calls) => {
3073
- for (const call of calls) {
3074
- const result = results.get(call.toolCallId);
3075
- if (!result || result.providerExecuted === true)
3076
- continue;
3077
- results.delete(call.toolCallId);
3078
- push({
3079
- role: 'tool',
3080
- content: [
3081
- {
3082
- type: 'tool-result',
3083
- toolCallId: result.toolCallId,
3084
- toolName: result.toolName,
3085
- output: await materializeReplayToolResult(result, call.toolName),
3086
- },
3087
- ],
3088
- }, [result.eventId]);
3089
- }
3090
- };
3091
- // Emit one assistant message for a step, preserving the distinct client-
3092
- // and provider-executed tool chronologies described above.
3093
- const emitStep = async (reasoning, text, calls) => {
3094
- const content = [];
3095
- const eventIds = [
3096
- ...(reasoning ?? []).map((item) => item.eventId),
3097
- ...(text ? [text.eventId] : []),
3098
- ...calls.map((call) => call.eventId),
3099
- ...(text?.stepId
3100
- ? (replayFactsByStep.get(text.stepId)?.flatMap((fact) => fact.eventIds) ?? [])
3101
- : []),
3102
- ];
3103
- const replayReasoning = reasoning
3104
- ?.map(reasoningReplay)
3105
- .filter((item) => item !== undefined);
3106
- for (const item of replayReasoning ?? []) {
3107
- if (item.part)
3108
- content.push(item.part);
3109
- }
3110
- // Provider-owned tools execute before the grounded assistant text in the
3111
- // same provider step. Preserve that chronology for Responses item
3112
- // references and Anthropic server_tool_use/result replay. Client tools
3113
- // stay after text because their execution begins only after this step.
3114
- for (const call of calls) {
3115
- if (call.providerExecuted !== true)
3116
- continue;
3117
- content.push({
3118
- type: 'tool-call',
3119
- toolCallId: call.toolCallId,
3120
- toolName: call.toolName,
3121
- input: call.input,
3122
- ...(call.providerOptions !== undefined ? { providerOptions: call.providerOptions } : {}),
3123
- providerExecuted: true,
3124
- });
3125
- const result = results.get(call.toolCallId);
3126
- if (!result || result.providerExecuted !== true)
3127
- continue;
3128
- results.delete(call.toolCallId);
3129
- eventIds.push(result.eventId);
3130
- content.push({
3131
- type: 'tool-result',
3132
- toolCallId: result.toolCallId,
3133
- toolName: result.toolName,
3134
- output: await materializeReplayToolResult(result, call.toolName),
3135
- });
3136
- }
3137
- if (text && text.content.length > 0) {
3138
- content.push({
3139
- type: 'text',
3140
- text: text.content,
3141
- ...(text.providerOptions !== undefined ? { providerOptions: text.providerOptions } : {}),
3142
- });
3143
- }
3144
- const replayFacts = text?.stepId ? replayFactsByStep.get(text.stepId) : undefined;
3145
- if (replayFacts) {
3146
- for (const replayFact of replayFacts) {
3147
- content.push({ type: 'text', text: replayFact.text });
3148
- }
3149
- replayFactsByStep.delete(text.stepId);
3150
- }
3151
- for (const call of calls) {
3152
- if (call.providerExecuted === true)
3153
- continue;
3154
- content.push({
3155
- type: 'tool-call',
3156
- toolCallId: call.toolCallId,
3157
- toolName: call.toolName,
3158
- input: call.input,
3159
- ...(call.providerOptions !== undefined ? { providerOptions: call.providerOptions } : {}),
3160
- ...(call.providerExecuted !== undefined
3161
- ? { providerExecuted: call.providerExecuted }
3162
- : {}),
3163
- });
3164
- }
3165
- const replayProviderOptions = replayReasoning?.find((item) => item.providerOptions !== undefined)?.providerOptions;
3166
- if (content.length > 0 || replayProviderOptions) {
3167
- push({
3168
- role: 'assistant',
3169
- content,
3170
- ...(replayProviderOptions ? { providerOptions: replayProviderOptions } : {}),
3171
- }, eventIds);
3172
- }
3173
- await pushClientToolResults(calls);
3174
- };
3175
- // Emit tool calls no assistant text closed: a thinking + tool step with no
3176
- // text (its empty closer is skipped from the plan), a pure-tool step, or a
3177
- // legacy per-turn tool block. Group consecutive calls by stepId so each step
3178
- // stays one assistant message, and claim the step's parked reasoning by
3179
- // stepId — this is how the common Anthropic interleaved-thinking step shape
3180
- // (reasoning + tool call, no text) gets its reasoning merged ahead of its
3181
- // calls. Calls without a stepId group together (legacy shape, no reasoning).
3182
- const emitGroupedCalls = async (calls) => {
3183
- let group = [];
3184
- const emitGroup = async () => {
3185
- if (group.length === 0)
3186
- return;
3187
- const stepId = group[0].stepId;
3188
- const reasoning = stepId !== undefined ? reasoningByStep.get(stepId) : undefined;
3189
- const text = stepId !== undefined ? textByStep.get(stepId) : undefined;
3190
- if (stepId !== undefined) {
3191
- reasoningByStep.delete(stepId);
3192
- textByStep.delete(stepId);
3193
- }
3194
- await emitStep(reasoning, text, group);
3195
- group = [];
3196
- };
3197
- for (const call of calls) {
3198
- if (group.length > 0 && group[0].stepId !== call.stepId)
3199
- await emitGroup();
3200
- group.push(call);
3201
- }
3202
- await emitGroup();
3203
- };
3204
- const flushLooseCalls = async () => {
3205
- if (bufferedCalls.length === 0)
3206
- return;
3207
- const calls = bufferedCalls;
3208
- bufferedCalls = [];
3209
- await emitGroupedCalls(calls);
3210
- };
3211
- const flushPendingSteps = async () => {
3212
- await flushLooseCalls();
3213
- for (const [stepId, text] of textByStep) {
3214
- textByStep.delete(stepId);
3215
- const reasoning = reasoningByStep.get(stepId);
3216
- reasoningByStep.delete(stepId);
3217
- await emitStep(reasoning, text, []);
3218
- }
3219
- for (const [stepId, reasoning] of reasoningByStep) {
3220
- reasoningByStep.delete(stepId);
3221
- await emitStep(reasoning, undefined, []);
3222
- }
3223
- };
3224
- for (const item of plan.items) {
3225
- switch (item.kind) {
3226
- case 'tool_call':
3227
- if (item.toolName !== 'apply_patch') {
3228
- bufferedCalls.push(item);
3229
- break;
3230
- }
3231
- {
3232
- const replayInput = normalizeApplyPatchReplayInput(this.applyPatchProfile, item.toolCallId, item.input);
3233
- if (replayInput !== null) {
3234
- bufferedCalls.push({
3235
- ...item,
3236
- input: replayInput,
3237
- ...(replayInput !== item.input ? { providerOptions: undefined } : {}),
3238
- });
3239
- }
3240
- else {
3241
- downgradedApplyPatchCalls.set(item.toolCallId, item);
3242
- }
3243
- }
3244
- break;
3245
- case 'tool_result': {
3246
- const downgradedCall = downgradedApplyPatchCalls.get(item.toolCallId);
3247
- if (!downgradedCall) {
3248
- results.set(item.toolCallId, item);
3249
- break;
3250
- }
3251
- downgradedApplyPatchCalls.delete(item.toolCallId);
3252
- const replayFact = applyPatchReplayFactText(downgradedCall.input, item.output, item.isError);
3253
- if (!replayFact)
3254
- break;
3255
- if (downgradedCall.stepId) {
3256
- const stepFacts = replayFactsByStep.get(downgradedCall.stepId) ?? [];
3257
- replayFactsByStep.set(downgradedCall.stepId, [
3258
- ...stepFacts,
3259
- {
3260
- text: replayFact,
3261
- eventIds: [downgradedCall.eventId, item.eventId],
3262
- },
3263
- ]);
3264
- if (!textByStep.has(downgradedCall.stepId)) {
3265
- textByStep.set(downgradedCall.stepId, {
3266
- kind: 'text',
3267
- role: 'assistant',
3268
- content: '',
3269
- stepId: downgradedCall.stepId,
3270
- eventId: downgradedCall.eventId,
3271
- ts: downgradedCall.ts,
3272
- });
3273
- }
3274
- }
3275
- else {
3276
- await flushPendingSteps();
3277
- push({ role: 'assistant', content: [{ type: 'text', text: replayFact }] }, [
3278
- downgradedCall.eventId,
3279
- item.eventId,
3280
- ]);
3281
- }
3282
- break;
3283
- }
3284
- case 'thinking':
3285
- if (item.stepId !== undefined) {
3286
- const stepReasoning = reasoningByStep.get(item.stepId) ?? [];
3287
- stepReasoning.push(item);
3288
- reasoningByStep.set(item.stepId, stepReasoning);
3289
- }
3290
- else {
3291
- // Legacy standalone reasoning (pure-reasoning turn): emit on its own.
3292
- await flushPendingSteps();
3293
- const replayReasoning = reasoningReplay(item);
3294
- if (replayReasoning) {
3295
- push({
3296
- role: 'assistant',
3297
- content: replayReasoning.part ? [replayReasoning.part] : [],
3298
- ...(replayReasoning.providerOptions
3299
- ? { providerOptions: replayReasoning.providerOptions }
3300
- : {}),
3301
- }, [item.eventId]);
3302
- }
3303
- }
3304
- break;
3305
- case 'text':
3306
- if (item.role !== 'assistant') {
3307
- await flushPendingSteps();
3308
- push(await this.materializeRuntimeReplayItem(budget, item), [item.eventId]);
3309
- break;
3310
- }
3311
- if (item.stepId !== undefined) {
3312
- const stepId = item.stepId;
3313
- const thisCalls = bufferedCalls.filter((call) => call.stepId === stepId);
3314
- const otherCalls = bufferedCalls.filter((call) => call.stepId !== stepId);
3315
- bufferedCalls = [];
3316
- // Earlier steps' unclosed calls flush first (with their own parked
3317
- // reasoning, if any) so step order is preserved.
3318
- if (otherCalls.length > 0)
3319
- await emitGroupedCalls(otherCalls);
3320
- if (thisCalls.length > 0) {
3321
- await emitStep(reasoningByStep.get(stepId), item, thisCalls);
3322
- reasoningByStep.delete(stepId);
3323
- }
3324
- else {
3325
- // Runtime-owned settlement persists assistant facts before the
3326
- // matching tool calls. Hold the step closer until those calls
3327
- // arrive; a terminal text-only step flushes below.
3328
- textByStep.set(stepId, item);
3329
- }
3330
- }
3331
- else {
3332
- // Legacy per-turn assistant text: standalone after any tool block.
3333
- await flushPendingSteps();
3334
- push({
3335
- role: 'assistant',
3336
- content: item.content,
3337
- ...(item.providerOptions !== undefined
3338
- ? { providerOptions: item.providerOptions }
3339
- : {}),
3340
- }, [item.eventId]);
3341
- }
3342
- break;
3343
- }
3344
- }
3345
- await flushPendingSteps();
3346
- return this.prependProviderHistoryCompactMessage(out, historyCompactCheckpoint);
3347
- }
3348
- async materializeRuntimeReplayTextOnly(budget, plan, historyCompactCheckpoint) {
3349
- const messages = [];
3350
- for (const item of plan.items) {
3351
- if (item.kind === 'text')
3352
- this.pushMemoryIndexedMessage(messages, await this.materializeRuntimeReplayItem(budget, item), [item.eventId]);
3353
- }
3354
- return this.prependProviderHistoryCompactMessage(messages, historyCompactCheckpoint);
3355
- }
3356
- prependProviderHistoryCompactMessage(messages, checkpoint) {
3357
- if (!checkpoint || !isProviderHistoryCompactCheckpoint(checkpoint))
3358
- return messages;
3359
- const providerMessage = historyCompactCheckpointToModelMessage(checkpoint);
3360
- this.memoryReplayMessageEvents.set(providerMessage, [
3361
- `history-compact:${checkpoint.checkpointId}`,
3362
- ]);
3363
- return [providerMessage, ...messages];
3364
- }
3365
- pushMemoryIndexedMessage(messages, message, eventIds) {
3366
- messages.push(message);
3367
- this.memoryReplayMessageEvents.set(message, [...new Set(eventIds)]);
3368
- }
3369
- memoryEventMessagePositions(messages) {
3370
- const positions = {};
3371
- for (const [position, message] of messages.entries()) {
3372
- for (const eventId of this.memoryReplayMessageEvents.get(message) ?? []) {
3373
- (positions[eventId] ??= []).push(position);
3374
- }
3375
- }
3376
- return Object.keys(positions).length > 0 ? positions : undefined;
3377
- }
3378
- async materializeRuntimeReplayItem(budget, item) {
3379
- if (item.role === 'user') {
3380
- if (item.steering) {
3381
- // Already envelope-wrapped by the plan; carry the structured identity
3382
- // so injection dedupe recognizes the replayed message.
3383
- return {
3384
- role: 'user',
3385
- content: item.content,
3386
- providerOptions: steeringProviderOptions(item.steering.eventId),
3387
- };
3388
- }
3389
- return {
3390
- role: 'user',
3391
- content: await this.appendImageParts(budget, item.content, item.attachments, `runtime-event:${item.eventId}`),
3392
- };
3393
- }
3394
- return {
3395
- role: item.role,
3396
- content: item.content,
3397
- ...(item.providerOptions !== undefined ? { providerOptions: item.providerOptions } : {}),
3398
- };
3399
- }
3400
- async materializePriorMessages(budget, stored, steeringSidecar) {
3401
- const out = [];
3402
- for (const m of stored) {
3403
- if (m.type === 'user') {
3404
- // Degraded projections lose the RuntimeEvent steering marker; the
3405
- // sidecar (keyed by the projection's stable message ids) restores the
3406
- // canonical envelope + structured identity so a fallback-gated turn
3407
- // still presents steering exactly once, in its one provider form.
3408
- const sidecar = steeringSidecar?.get(m.id);
3409
- if (sidecar) {
3410
- out.push(steeringModelMessage(sidecar.eventId, await this.appendImageParts(budget, buildSteeringEnvelope(formatTextWithInlineRefs(m.text, m)), m.attachments, `steering:${sidecar.eventId}`)));
3411
- continue;
3412
- }
3413
- out.push({
3414
- role: 'user',
3415
- content: await this.appendImageParts(budget, formatTextWithInlineRefs(m.text, m), m.attachments),
3416
- });
3417
- }
3418
- // A thinking/tool-only step projects an assistant row with empty text;
3419
- // replaying it as an empty text block is a hard 400 on Anthropic-protocol
3420
- // providers.
3421
- else if (m.type === 'assistant' && m.text.length > 0)
3422
- out.push({
3423
- role: 'assistant',
3424
- content: m.text,
3425
- ...(m.providerOptions !== undefined
3426
- ? {
3427
- providerOptions: m.providerOptions,
3428
- }
3429
- : {}),
3430
- });
3431
- // empty assistant / tool_call / tool_result / permission_decision / token_usage / system_note skipped
3432
- }
3433
- return out;
3434
- }
3435
- /** Append provider-visible volatile turn facts after the durable user content. */
3436
- appendTurnTailPrompt(content, turnTailPrompt) {
3437
- if (!turnTailPrompt)
3438
- return content;
3439
- if (typeof content === 'string')
3440
- return `${content}\n\n${turnTailPrompt}`;
3441
- return [
3442
- ...content,
3443
- { type: 'text', text: turnTailPrompt },
3444
- ];
3445
- }
3446
- /** A decision key deduplicates re-materialization; no key charges each occurrence. */
3447
- chargeImageBudget(budget, bytes, decisionKey) {
3448
- if (decisionKey !== undefined) {
3449
- const cached = budget.decisions.get(decisionKey);
3450
- if (cached !== undefined)
3451
- return cached;
3452
- }
3453
- const keep = budget.used + bytes <=
3454
- (this.input.maxProviderImageRequestBytes ?? MAX_PROVIDER_IMAGE_REQUEST_BYTES);
3455
- if (keep)
3456
- budget.used += bytes;
3457
- if (decisionKey !== undefined)
3458
- budget.decisions.set(decisionKey, keep);
3459
- return keep;
3460
- }
3461
- /**
3462
- * Render provider-visible content for a user message: keep the given
3463
- * (already-formatted) text, and append image attachments as provider image
3464
- * parts only for explicitly vision-capable models. Non-image attachments stay
3465
- * as placeholder refs in the text. Shared by the current turn, RuntimeEvent
3466
- * replay, and the stored-message fallback so all paths present images identically.
3467
- */
3468
- async appendImageParts(budget, textContent, attachments, decisionKeyPrefix) {
3469
- const images = attachments?.filter((a) => a.kind === 'image') ?? [];
3470
- if (images.length === 0) {
3471
- return textContent;
3472
- }
3473
- if (this.input.supportsVision !== true) {
3474
- return appendNonVisionImageFallbackNotice(textContent);
3475
- }
3476
- if (!this.input.readAttachmentBytes) {
3477
- return textContent;
3478
- }
3479
- const parts = [{ type: 'text', text: textContent }];
3480
- let omittedByBudget = 0;
3481
- for (const [index, image] of images.entries()) {
3482
- const read = await this.input.readAttachmentBytes(image.ref);
3483
- if (!read.ok) {
3484
- parts.push({
3485
- type: 'text',
3486
- text: `Image attachment "${image.name}" could not be loaded: ${read.reason}.`,
3487
- });
3488
- continue;
3489
- }
3490
- const decisionKey = decisionKeyPrefix === undefined ? undefined : `${decisionKeyPrefix}:image:${index}`;
3491
- if (!this.chargeImageBudget(budget, read.bytes.length, decisionKey)) {
3492
- omittedByBudget += 1;
3493
- continue;
3494
- }
3495
- parts.push({
3496
- type: 'file',
3497
- data: { type: 'data', data: read.bytes },
3498
- mediaType: image.mimeType,
3499
- });
3500
- }
3501
- if (omittedByBudget > 0) {
3502
- parts.push({
3503
- type: 'text',
3504
- text: `[${omittedByBudget} image attachment(s) omitted: the per-request image budget was exceeded. Earlier images were sent; ask the user to send fewer or smaller images.]`,
3505
- });
3506
- }
3507
- return parts;
3508
- }
3509
- async materializeToolResultOutput(budget, output, isError, decisionKey) {
3510
- if (isError || !isImageToolResult(output))
3511
- return toolResultOutput(output, isError);
3512
- if (this.input.supportsVision !== true) {
3513
- return toolResultText('Image was read, but the selected model does not support image input.');
3514
- }
3515
- if (!this.input.readAttachmentBytes) {
3516
- return toolResultText('Image was read, but its stored bytes are unavailable.');
3517
- }
3518
- if (budget && budget.decisions.get(decisionKey) === false) {
3519
- return toolResultText(PROVIDER_IMAGE_BUDGET_EXCEEDED_MESSAGE);
3520
- }
3521
- let read;
3522
- try {
3523
- read = await this.input.readAttachmentBytes(output.ref);
3524
- }
3525
- catch {
3526
- return toolResultText('Image could not be loaded from artifact storage: read_failed.');
3527
- }
3528
- if (!read.ok) {
3529
- return toolResultText(`Image could not be loaded from artifact storage: ${read.reason}.`);
3530
- }
3531
- if (!this.chargeImageBudget(budget, read.bytes.length, decisionKey)) {
3532
- return toolResultText(PROVIDER_IMAGE_BUDGET_EXCEEDED_MESSAGE);
3533
- }
3534
- return {
3535
- type: 'content',
3536
- value: [
3537
- { type: 'text', text: 'Image read successfully.' },
3538
- {
3539
- type: 'file',
3540
- data: {
3541
- type: 'data',
3542
- data: Buffer.from(read.bytes).toString('base64'),
3543
- },
3544
- mediaType: output.mimeType,
3545
- },
3546
- ],
3547
- };
3548
- }
3549
- async buildCurrentUserContent(budget, text, attachments, quotes, runtimeEventId) {
3550
- return await this.appendImageParts(budget, formatTextWithInlineRefs(text, {
3551
- ...(attachments !== undefined ? { attachments } : {}),
3552
- ...(quotes !== undefined ? { quotes } : {}),
3553
- }), attachments, runtimeEventId === undefined ? undefined : `runtime-event:${runtimeEventId}`);
3554
- }
3555
- async resolveSystemPrompt(scope) {
3556
- const turnId = scope.turnId;
3557
- if (typeof this.input.systemPrompt === 'function') {
3558
- return await this.input.systemPrompt({
3559
- sessionId: this.sessionId,
3560
- turnId,
3561
- ...(scope.runId ? { runId: scope.runId } : {}),
3562
- cwd: this.input.header.cwd,
3563
- workspaceRoot: this.input.header.workspaceRoot,
3564
- emitSkillCatalogTrace: (message, data) => scope.runTrace?.emit('skill', 'skill_catalog_built', message, data),
3565
- });
3566
- }
3567
- return this.input.systemPrompt;
3568
- }
3569
- async resolveTurnSandboxDiagnostics() {
3570
- const provider = this.input.sandboxDiagnostics;
3571
- if (!provider)
3572
- return undefined;
3573
- const boundary = await this.input.readExecutionBoundary();
3574
- if (boundary.kind === 'external')
3575
- return undefined;
3576
- return await provider.resolve(boundary.kind === 'managed'
3577
- ? { cwd: this.input.header.cwd, permissionProfile: boundary.profile }
3578
- : { cwd: this.input.header.cwd, mode: 'bypass' });
3579
- }
3580
- async resolveTurnTailPrompt(turnId) {
3581
- if (typeof this.input.turnTailPrompt === 'function') {
3582
- return await this.input.turnTailPrompt({
3583
- sessionId: this.sessionId,
3584
- turnId,
3585
- cwd: this.input.header.cwd,
3586
- workspaceRoot: this.input.header.workspaceRoot,
3587
- });
3588
- }
3589
- return this.input.turnTailPrompt;
3590
- }
3591
- async resolveShellRunContextSummary() {
3592
- return await this.input.shellRunContextSummary?.();
3593
- }
3594
- async *drain(queue) {
3595
- try {
3596
- for await (const ev of queue) {
3597
- yield ev;
3598
- // Generator backpressure IS the consumer's ack: this line runs only
3599
- // when the consumer's loop body finished for `ev` and pulled the next
3600
- // event, so `consumedCount` counts fully PROCESSED events. AgentRun
3601
- // persists each mapped event before continuing, so an acked event is
3602
- // either durable or deliberately skipped (partials, non-terminal
3603
- // errors) — exactly the set a durable read can ever return.
3604
- queue.ackConsumed();
3605
- }
3606
- }
3607
- finally {
3608
- // The consumer abandoned or finished the stream; wake any seq-ack waiter
3609
- // so it observes `consumerDetached` instead of blocking forever.
3610
- queue.noteConsumerDetached();
3611
- }
3612
- }
3613
- /**
3614
- * Retire one turn's scope. Nothing is reset for reuse — the scope is dropped,
3615
- * so a sibling turn still running on this backend is untouched. Deregistering
3616
- * before `endTurn` also makes a late tool settlement resolve to "gone" rather
3617
- * than to whichever turn started next.
3618
- */
3619
- async cleanupAfterTurn(scope) {
3620
- this.activeTurns.delete(scope);
3621
- this.modelAdapter.endContinuation(scope.turnId);
3622
- await scope.toolRuntime.endTurn(scope.aborted ? 'aborted' : 'completed');
3623
- }
3624
- /**
3625
- * Drain the caller's pending steering at a step boundary. Each message is
3626
- * echoed as a `steering_message` event (so the ledger + transcript render the
3627
- * interjection in place) and accumulated as an envelope-wrapped user message
3628
- * for injection into subsequent provider requests.
3629
- *
3630
- * Persist-before-include invariant: the initial user message is durable
3631
- * before the backend is invoked, and a steered message must hold the same
3632
- * line — the provider must never start executing a directive the ledger does
3633
- * not carry. The seq-ack boundary provides that without a second write path:
3634
- * the consumer's pull is the ack, and AgentRun persists each mapped event
3635
- * before continuing (see drain()), so once everything enqueued up to the
3636
- * steering event is consumed, the event is durable. If the consumer detaches
3637
- * (the persist path failed or the turn is being torn down) before that, the
3638
- * message is nacked and NOT included in any request; an abort after the push
3639
- * waits for that same convergence — durable ⇒ ack (history owns it), detach
3640
- * ⇒ nack — and only then throws so the dying request is never sent.
3641
- */
3642
- async drainSteeringInto(scope, input, queue) {
3643
- const turnId = scope.turnId;
3644
- const abortSignal = scope.abortController.signal;
3645
- const pull = input.pullSteering;
3646
- if (!pull)
3647
- return;
3648
- const leases = pull();
3649
- if (leases.length === 0)
3650
- return;
3651
- // Binary settlement: every pulled lease settles exactly once, decided
3652
- // ONLY by the persistence fact — durably consumed ⇒ ack + injection set;
3653
- // provably never persisted (never pushed, or the consumer detached
3654
- // without consuming it) ⇒ nack. An abort does NOT settle a pushed lease:
3655
- // it only stops new pushes and the dying request; the wait continues
3656
- // until the teardown converges it (the flow drains after terminal events
3657
- // or detaches on failure), because nacking a durably appended event
3658
- // would put the same directive in the account twice — once via history
3659
- // replay, once via the reclaimed queue.
3660
- const undelivered = [...leases];
3661
- try {
3662
- for (const lease of leases) {
3663
- if (scope.aborted || abortSignal?.aborted) {
3664
- // Never pushed: settles as undelivered.
3665
- throw Object.assign(new Error('aborted before steering was pushed'), {
3666
- name: 'AbortError',
3667
- });
3668
- }
3669
- if (queue.consumerDetached) {
3670
- throw new Error('steering message was not durably consumed: event consumer detached');
3671
- }
3672
- // Materialize provider content before publishing the durable event.
3673
- // After consumption there must be no fallible gap before ack/injection.
3674
- const eventId = this.newId();
3675
- const providerContent = await this.appendImageParts(scope.imageBudget, buildSteeringEnvelope(formatTextWithInlineRefs(lease.content.text, lease.content)), lease.content.attachments, `steering:${eventId}`);
3676
- if (scope.aborted || abortSignal?.aborted) {
3677
- throw Object.assign(new Error('aborted before steering was pushed'), {
3678
- name: 'AbortError',
3679
- });
3680
- }
3681
- if (queue.consumerDetached) {
3682
- throw new Error('steering message was not durably consumed: event consumer detached');
3683
- }
3684
- await queue.pushAndWaitUntilConsumed({
3685
- type: 'steering_message',
3686
- id: eventId,
3687
- turnId,
3688
- ts: this.now(),
3689
- messageId: lease.messageId,
3690
- content: lease.content,
3691
- ...(lease.submittedContentDigest
3692
- ? { submittedContentDigest: lease.submittedContentDigest }
3693
- : {}),
3694
- });
3695
- // The mapped RuntimeEvent inherits this session event's id, so the
3696
- // injected message and its future ledger replay share one identity.
3697
- scope.injectedSteeringMessages.push(steeringModelMessage(eventId, providerContent));
3698
- input.ackSteering?.([lease.id]);
3699
- undelivered.shift();
3700
- if (scope.aborted || abortSignal?.aborted) {
3701
- // Settled (the ledger owns the message; the next turn replays it),
3702
- // but the send is dying: stop before any request is built with it.
3703
- throw Object.assign(new Error('aborted after steering was durable'), {
3704
- name: 'AbortError',
3705
- });
3706
- }
3707
- }
3708
- }
3709
- catch (error) {
3710
- if (undelivered.length > 0) {
3711
- input.nackSteering?.(undelivered.map((lease) => lease.id));
3712
- }
3713
- throw error;
3714
- }
3715
- }
3716
- }
3717
- /**
3718
- * Steering identities for degraded StoredMessage projections, keyed by every
3719
- * stable id the projection may have used for the message (event id,
3720
- * providerEventId, storedMessageId), so the sidecar restore is exact.
3721
- */
3722
- function buildSteeringSidecar(events) {
3723
- const sidecar = new Map();
3724
- for (const event of events) {
3725
- if (event.partial === true)
3726
- continue;
3727
- if (event.content?.kind !== 'text' || event.content.steering !== true)
3728
- continue;
3729
- const identity = { eventId: event.id };
3730
- sidecar.set(event.id, identity);
3731
- if (event.refs?.providerEventId)
3732
- sidecar.set(event.refs.providerEventId, identity);
3733
- if (event.refs?.storedMessageId)
3734
- sidecar.set(event.refs.storedMessageId, identity);
3735
- }
3736
- return sidecar;
3737
- }
3738
- function isPlanToolResult(output) {
3739
- if (!output || typeof output !== 'object')
3740
- return false;
3741
- return [
3742
- 'plan_submitted',
3743
- 'plan_progress_updated',
3744
- 'plan_execution_completed',
3745
- 'plan_execution_cancelled',
3746
- ].includes(String(output.kind));
3747
- }
3748
- function isAgentGraphYieldToolResult(output) {
3749
- if (output === null || typeof output !== 'object' || Array.isArray(output))
3750
- return false;
3751
- const result = output;
3752
- return (Object.keys(result).length === 4 &&
3753
- result.kind === 'agent_graph_yielded' &&
3754
- typeof result.pendingWorkCount === 'number' &&
3755
- Number.isSafeInteger(result.pendingWorkCount) &&
3756
- result.pendingWorkCount > 0 &&
3757
- typeof result.liveOperatorCount === 'number' &&
3758
- Number.isSafeInteger(result.liveOperatorCount) &&
3759
- result.liveOperatorCount >= 0 &&
3760
- typeof result.reason === 'string' &&
3761
- result.reason.length > 0 &&
3762
- result.reason.length <= 4_000 &&
3763
- result.reason.trim() === result.reason);
3764
- }
3765
- export function repairMakaToolCall(input) {
3766
- const requestedName = input.toolCall.toolName;
3767
- if (requestedName === INVALID_TOOL_NAME)
3768
- return null;
3769
- const lowerRequestedName = requestedName.toLowerCase();
3770
- const exactLowercaseMatch = input.availableToolNames.find((name) => name.toLowerCase() === lowerRequestedName);
3771
- if (exactLowercaseMatch && exactLowercaseMatch !== requestedName) {
3772
- return { ...input.toolCall, toolName: exactLowercaseMatch };
3773
- }
3774
- return {
3775
- ...input.toolCall,
3776
- toolName: INVALID_TOOL_NAME,
3777
- input: JSON.stringify({
3778
- tool: requestedName,
3779
- error: describeUnrepairableToolCall(input),
3780
- ...(isProviderSandboxBoundaryAttempt(input.toolCall) ? { sandboxBoundaryAttempt: true } : {}),
3781
- }),
3782
- };
3783
- }
3784
- /**
3785
- * What the model is told about a call that could not be repaired.
3786
- *
3787
- * Two different failures arrive here. A name that matches nothing: the caller
3788
- * is holding the list of names that would have worked and used to drop it,
3789
- * leaving the model with its own wrong name and a validator's complaint — the
3790
- * same dead end `tool-availability` avoids by naming what is available.
3791
- * Arguments the tool's schema rejected: the schema knows which fields the call
3792
- * takes, so say them rather than let the model re-send the shape just refused.
3793
- */
3794
- function describeUnrepairableToolCall(input) {
3795
- const requestedName = input.toolCall.toolName;
3796
- const known = input.availableToolNames.includes(requestedName);
3797
- if (!known) {
3798
- const available = input.availableToolNames.join(', ');
3799
- const detail = formatSyntheticToolErrorText(input.error);
3800
- return available ? `${detail} Available tools: ${available}.` : detail;
3801
- }
3802
- return formatToolArgsViolationText({
3803
- toolName: requestedName,
3804
- parameters: input.toolParameters?.(requestedName),
3805
- categoryHint: input.toolCategoryHint?.(requestedName),
3806
- args: parseToolCallInput(input.toolCall.input),
3807
- error: input.error,
3808
- });
3809
- }
3810
- function parseToolCallInput(raw) {
3811
- if (typeof raw !== 'string')
3812
- return raw;
3813
- try {
3814
- return JSON.parse(raw);
3815
- }
3816
- catch {
3817
- return undefined;
3818
- }
3819
- }
3820
- function isProviderSandboxBoundaryAttempt(toolCall) {
3821
- const toolName = toolCall.toolName.toLowerCase();
3822
- if (toolName === REQUEST_SANDBOX_BOUNDARY_TOOL_NAME)
3823
- return true;
3824
- if (toolName !== 'bash')
3825
- return false;
3826
- const parsed = parseToolCallInput(toolCall.input);
3827
- if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
3828
- return false;
3829
- const boundaryIntent = parsed.boundary_intent;
3830
- return boundaryIntent !== undefined && boundaryIntent !== 'current';
3831
- }
3832
- function buildInvalidMakaTool() {
3833
- return {
3834
- name: INVALID_TOOL_NAME,
3835
- description: 'Internal repair target for malformed or unknown tool calls. Do not call directly.',
3836
- parameters: z.object({
3837
- tool: z.string().optional(),
3838
- error: z.string().optional(),
3839
- sandboxBoundaryAttempt: z.literal(true).optional(),
3840
- }),
3841
- impl: ({ tool, error, sandboxBoundaryAttempt }) => {
3842
- const requested = tool ? ` "${tool}"` : '';
3843
- const message = `模型请求了不可用或格式错误的工具${requested}:${error || 'tool call could not be parsed'}`;
3844
- if (sandboxBoundaryAttempt) {
3845
- throw new SandboxCommandError({
3846
- domain: 'command',
3847
- stage: 'validation',
3848
- reason: 'invalid_boundary_declaration',
3849
- recoverable: true,
3850
- message,
3851
- });
3852
- }
3853
- throw new Error(message);
3854
- },
3855
- };
3856
- }
3857
- function priorReplayFailureTrace(replay) {
3858
- return {
3859
- gate: replay.gate,
3860
- diagnosticCodes: [...new Set(replay.diagnostics.map((diagnostic) => diagnostic.code))],
3861
- };
3862
- }
3863
- class ContinuationReplayEmptyError extends Error {
3864
- replayGate;
3865
- diagnosticCodes;
3866
- code = 'continuation_replay_empty';
3867
- constructor(replayGate, diagnosticCodes) {
3868
- super(`Continuation replay is empty after ${replayGate}`);
3869
- this.replayGate = replayGate;
3870
- this.diagnosticCodes = diagnosticCodes;
3871
- this.name = 'ContinuationReplayEmptyError';
3872
- }
3873
- }
3874
- function mergeActiveToolResultPruneDiagnosticPatches(left, right) {
3875
- return {
3876
- ...sumOptionalCounts('activePrunedToolResults', left, right),
3877
- ...sumOptionalCounts('activeSupersededToolResults', left, right),
3878
- ...sumOptionalCounts('activeDuplicateToolResults', left, right),
3879
- ...sumOptionalCounts('activeArchiveFailures', left, right),
3880
- ...sumOptionalCounts('activeEstimatedTokensSaved', left, right),
3881
- };
3882
- }
3883
- function mergeNormalizedUsage(current, next) {
3884
- if (!current)
3885
- return next;
3886
- const cacheMissInputSource = current.cacheMissInputSource === 'explicit' || next.cacheMissInputSource === 'explicit'
3887
- ? 'explicit'
3888
- : 'derived';
3889
- const cacheHitInputTokens = current.cacheHitInputTokens + next.cacheHitInputTokens;
3890
- return {
3891
- inputTokens: current.inputTokens + next.inputTokens,
3892
- outputTokens: current.outputTokens + next.outputTokens,
3893
- cacheHitInputTokens,
3894
- cacheMissInputTokens: current.cacheMissInputTokens + next.cacheMissInputTokens,
3895
- cacheMissInputSource,
3896
- cacheWriteInputTokens: current.cacheWriteInputTokens + next.cacheWriteInputTokens,
3897
- reasoningTokens: current.reasoningTokens + next.reasoningTokens,
3898
- totalTokens: current.totalTokens + next.totalTokens,
3899
- ...(next.rawFinishReason !== undefined ? { rawFinishReason: next.rawFinishReason } : {}),
3900
- cachedInputTokens: cacheHitInputTokens,
3901
- };
3902
- }
3903
- function sumOptionalCounts(key, left, right) {
3904
- const total = (left[key] ?? 0) + (right[key] ?? 0);
3905
- return total > 0 ? { [key]: total } : {};
3906
- }
3907
- function contextBudgetWithRequestProjectionDiagnostics(base, patch, compactionPatch) {
3908
- const prunePatch = hasActiveToolResultPruneDiagnosticPatch(patch) ? patch : undefined;
3909
- const mergedPatch = mergeContextBudgetDiagnosticPatches(prunePatch, compactionPatch);
3910
- if (!mergedPatch)
3911
- return base;
3912
- return mergeContextBudgetDiagnostic(base ?? minimalContextBudgetDiagnostic(), mergedPatch);
3913
- }
3914
- function buildHistoryCompactCheckpointFailOpenContext(checkpoint, priorRuntimeContext, policy, retainedCandidates) {
3915
- const charsPerToken = policy.charsPerToken ?? 4;
3916
- const compactableEvents = priorRuntimeContext.filter((event) => estimateRuntimeEventsTokens([event], charsPerToken) > 0);
3917
- const match = matchHistoryCompactCheckpointPrefix(checkpoint, compactableEvents);
3918
- if (match.reason)
3919
- return { events: [...retainedCandidates] };
3920
- const coveredIds = new Set(match.coveredRuntimeEvents.map((event) => event.id));
3921
- const candidates = retainedCandidates.filter((event) => !coveredIds.has(event.id));
3922
- const turnOrder = [];
3923
- const byTurn = new Map();
3924
- for (const event of candidates) {
3925
- const group = byTurn.get(event.turnId);
3926
- if (group)
3927
- group.push(event);
3928
- else {
3929
- turnOrder.push(event.turnId);
3930
- byTurn.set(event.turnId, [event]);
3931
- }
3932
- }
3933
- const maxTokens = policy.maxHistoryEstimatedTokens ?? Number.POSITIVE_INFINITY;
3934
- const replayPrefix = projectHistoryCompactCheckpointReplay(checkpoint, match.coveredRuntimeEvents, []);
3935
- let selectedTokens = checkpoint.version === 3
3936
- ? checkpoint.estimatedTokens
3937
- : estimateRuntimeEventsTokens(replayPrefix, charsPerToken);
3938
- const selectedGroups = [];
3939
- for (let index = turnOrder.length - 1; index >= 0; index -= 1) {
3940
- const group = byTurn.get(turnOrder[index]) ?? [];
3941
- const groupTokens = estimateRuntimeEventsTokens(group, charsPerToken);
3942
- if (selectedTokens + groupTokens > maxTokens)
3943
- break;
3944
- selectedGroups.unshift(group);
3945
- selectedTokens += groupTokens;
3946
- }
3947
- const replayTail = selectedGroups.flat();
3948
- const replayEvents = projectHistoryCompactCheckpointReplay(checkpoint, match.coveredRuntimeEvents, replayTail);
3949
- const replayTailForFit = checkpoint.version === 3 ? replayEvents : replayEvents.slice(1);
3950
- return evaluateHistoryCompactCheckpointReplay(checkpoint, replayTailForFit, policy?.charsPerToken, policy?.maxHistoryEstimatedTokens, {
3951
- sourceReplayEvents: [...match.coveredRuntimeEvents, ...replayTail],
3952
- }).fits
3953
- ? { events: replayEvents, checkpoint }
3954
- : { events: [...retainedCandidates] };
3955
- }
3956
- function projectMemoryConversationPrefix(messages, eventMessagePositions) {
3957
- // Context visibility and durable evidence authority are separate boundaries.
3958
- // Keep the exact source prefix so the auxiliary request preserves referents
3959
- // and provider-cache shape. The Evidence Index and trusted admission layer
3960
- // independently restrict durable citations to user-authored RuntimeEvents.
3961
- return {
3962
- messages: [...messages],
3963
- ...(eventMessagePositions ? { eventMessagePositions } : {}),
3964
- };
3965
- }
3966
- function lastNonCompactRuntimeEvent(events) {
3967
- for (let index = events.length - 1; index >= 0; index -= 1) {
3968
- const event = events[index];
3969
- if (!event.id.startsWith('history-compact:'))
3970
- return event;
3971
- }
3972
- return undefined;
3973
- }
3974
- function memoryExtractionModelHeader(header) {
3975
- return {
3976
- ...(header.llmConnectionId === undefined ? {} : { llmConnectionId: header.llmConnectionId }),
3977
- llmConnectionSlug: header.llmConnectionSlug,
3978
- model: header.model,
3979
- ...(header.thinkingLevel !== undefined ? { thinkingLevel: header.thinkingLevel } : {}),
3980
- };
3981
355
  }