maka-agent 0.2.2-dev.92.20261019 → 0.2.2-dev.97.20261024

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 (364) hide show
  1. package/LICENSE +7 -7
  2. package/README.md +78 -18
  3. package/README.zh-CN.md +73 -15
  4. package/THIRD_PARTY_NOTICES.txt +12 -12
  5. package/dist/pi-goal.js +13 -0
  6. package/dist/pi-tui-runner.js +44 -1
  7. package/dist/run-command-core.js +111 -70
  8. package/dist/run-session-command.js +91 -15
  9. package/dist/run-turn-outcome.js +2 -33
  10. package/dist/runtime-host-session-channel.js +3 -1
  11. package/dist/runtime-host-session-driver.js +5 -0
  12. package/dist/tui-copy-catalog.js +24 -0
  13. package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
  14. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/docs/docs/api/Client.md +2 -0
  15. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/core/connect.js +10 -4
  16. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/core/symbols.js +1 -0
  17. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/agent.js +6 -2
  18. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/client-h1.js +0 -2
  19. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/client-h2.js +0 -4
  20. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/client.js +3 -2
  21. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/dispatcher-base.js +12 -0
  22. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/handler/cache-handler.js +48 -0
  23. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/handler/deduplication-handler.js +57 -13
  24. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/handler/redirect-handler.js +8 -1
  25. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/interceptor/decompress.js +15 -5
  26. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/cookies/index.js +3 -1
  27. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/cookies/parse.js +138 -137
  28. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/cookies/util.js +21 -2
  29. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/eventsource/eventsource-stream.js +90 -9
  30. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/eventsource/eventsource.js +4 -1
  31. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/fetch/index.js +3 -3
  32. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/infra/index.js +14 -0
  33. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
  34. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/websocket/receiver.js +13 -0
  35. package/node_modules/@ai-sdk/provider-utils/node_modules/undici/package.json +1 -1
  36. package/node_modules/@maka/acp-executor-plugin/dist/acp-catalog-store.js +87 -0
  37. package/node_modules/@maka/acp-executor-plugin/dist/acp-catalog.js +98 -21
  38. package/node_modules/@maka/acp-executor-plugin/dist/index.js +90 -14
  39. package/node_modules/@maka/acp-executor-plugin/dist/plugin.mjs +3997 -56
  40. package/node_modules/@maka/core/dist/assistant-turn-ids.js +34 -0
  41. package/node_modules/@maka/core/dist/event-wait.js +28 -10
  42. package/node_modules/@maka/core/dist/executor-catalog.js +3 -1
  43. package/node_modules/@maka/core/dist/model-catalog.js +19 -1
  44. package/node_modules/@maka/core/dist/model-metadata.generated.js +4 -14
  45. package/node_modules/@maka/core/dist/model-metadata.js +42 -1
  46. package/node_modules/@maka/core/dist/models-dev-projection.js +32 -1
  47. package/node_modules/@maka/core/dist/provider-registry.js +16 -2
  48. package/node_modules/@maka/core/dist/runtime-event.js +8 -0
  49. package/node_modules/@maka/core/dist/session-checkin.js +31 -0
  50. package/node_modules/@maka/core/dist/usage-stats/types.js +1 -0
  51. package/node_modules/@maka/core/package.json +2 -0
  52. package/node_modules/@maka/eval/node_modules/undici/README.md +25 -3
  53. package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/CacheStore.md +24 -9
  54. package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Client.md +11 -6
  55. package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Dispatcher.md +3 -0
  56. package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Errors.md +76 -1
  57. package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/H2CClient.md +3 -2
  58. package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Interceptors.md +28 -8
  59. package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/RedirectHandler.md +13 -10
  60. package/node_modules/@maka/eval/node_modules/undici/docs/docs/index.md +12 -12
  61. package/node_modules/@maka/eval/node_modules/undici/docs/docs/type-map.json +66 -66
  62. package/node_modules/@maka/eval/node_modules/undici/lib/cache/memory-cache-store.js +48 -13
  63. package/node_modules/@maka/eval/node_modules/undici/lib/cache/sqlite-cache-store.js +83 -5
  64. package/node_modules/@maka/eval/node_modules/undici/lib/core/connect.js +10 -4
  65. package/node_modules/@maka/eval/node_modules/undici/lib/core/constants.js +12 -1
  66. package/node_modules/@maka/eval/node_modules/undici/lib/core/errors.js +38 -1
  67. package/node_modules/@maka/eval/node_modules/undici/lib/core/request.js +16 -1
  68. package/node_modules/@maka/eval/node_modules/undici/lib/core/symbols.js +2 -0
  69. package/node_modules/@maka/eval/node_modules/undici/lib/core/util.js +26 -1
  70. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/agent.js +6 -2
  71. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client-h1.js +116 -80
  72. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client-h2.js +124 -17
  73. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client.js +4 -1
  74. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/dispatcher-base.js +3 -2
  75. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +20 -3
  76. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/parser-h1.js +1064 -0
  77. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/pool-base.js +85 -31
  78. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/pool.js +11 -8
  79. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -8
  80. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/retry-agent.js +10 -0
  81. package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -5
  82. package/node_modules/@maka/eval/node_modules/undici/lib/handler/cache-handler.js +153 -15
  83. package/node_modules/@maka/eval/node_modules/undici/lib/handler/deduplication-handler.js +112 -51
  84. package/node_modules/@maka/eval/node_modules/undici/lib/handler/redirect-handler.js +28 -8
  85. package/node_modules/@maka/eval/node_modules/undici/lib/handler/retry-handler.js +44 -11
  86. package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/cache.js +11 -3
  87. package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/decompress.js +22 -9
  88. package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/dns.js +11 -0
  89. package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/response-error.js +72 -28
  90. package/node_modules/@maka/eval/node_modules/undici/lib/milo/LICENSE.md +7 -0
  91. package/node_modules/@maka/eval/node_modules/undici/lib/milo/no-simd.js +1002 -0
  92. package/node_modules/@maka/eval/node_modules/undici/lib/milo/simd.js +1002 -0
  93. package/node_modules/@maka/eval/node_modules/undici/lib/mock/mock-agent.js +11 -0
  94. package/node_modules/@maka/eval/node_modules/undici/lib/mock/snapshot-recorder.js +3 -2
  95. package/node_modules/@maka/eval/node_modules/undici/lib/mock/snapshot-utils.js +3 -2
  96. package/node_modules/@maka/eval/node_modules/undici/lib/util/cache.js +11 -5
  97. package/node_modules/@maka/eval/node_modules/undici/lib/web/cookies/util.js +19 -2
  98. package/node_modules/@maka/eval/node_modules/undici/lib/web/eventsource/eventsource-stream.js +69 -15
  99. package/node_modules/@maka/eval/node_modules/undici/lib/web/eventsource/eventsource.js +25 -2
  100. package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/body.js +47 -38
  101. package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/formdata-parser.js +12 -4
  102. package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/headers.js +2 -2
  103. package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/index.js +8 -4
  104. package/node_modules/@maka/eval/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
  105. package/node_modules/@maka/eval/node_modules/undici/lib/web/websocket/receiver.js +25 -4
  106. package/node_modules/@maka/eval/node_modules/undici/package.json +9 -7
  107. package/node_modules/@maka/mcp/package.json +1 -1
  108. package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +22 -9
  109. package/node_modules/@maka/runtime/dist/ai-sdk-message-projection.js +10 -1
  110. package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +101 -127
  111. package/node_modules/@maka/runtime/dist/event-wait-tool.js +2 -2
  112. package/node_modules/@maka/runtime/dist/history-compact-checkpoint.js +32 -1
  113. package/node_modules/@maka/runtime/dist/history-compaction.js +7 -0
  114. package/node_modules/@maka/runtime/dist/model-factory.js +26 -6
  115. package/node_modules/@maka/runtime/dist/model-fetcher.js +8 -1
  116. package/node_modules/@maka/runtime/dist/model-history.js +16 -3
  117. package/node_modules/@maka/runtime/dist/openai-codex-history-compactor.js +7 -2
  118. package/node_modules/@maka/runtime/dist/plugin-executor-backend.js +49 -2
  119. package/node_modules/@maka/runtime/dist/plugin-executor-service.js +12 -3
  120. package/node_modules/@maka/runtime/dist/runtime-context.js +53 -0
  121. package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +3 -0
  122. package/node_modules/@maka/runtime/dist/session-checkin.js +331 -0
  123. package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +7 -0
  124. package/node_modules/@maka/runtime/dist/shell-run-manager.js +34 -0
  125. package/node_modules/@maka/runtime/dist/telemetry/builtin-pricing.js +21 -2
  126. package/node_modules/@maka/runtime/dist/tool-runtime.js +8 -0
  127. package/node_modules/@maka/runtime/dist/workers/filesystem-worker.mjs +50 -1
  128. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/docs/docs/api/Client.md +2 -0
  129. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/core/connect.js +10 -4
  130. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/core/symbols.js +1 -0
  131. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/agent.js +6 -2
  132. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/client-h1.js +0 -2
  133. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/client-h2.js +0 -4
  134. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/client.js +3 -2
  135. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/dispatcher-base.js +12 -0
  136. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/handler/cache-handler.js +48 -0
  137. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/handler/deduplication-handler.js +57 -13
  138. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/handler/redirect-handler.js +8 -1
  139. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/interceptor/decompress.js +15 -5
  140. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/cookies/index.js +3 -1
  141. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/cookies/parse.js +138 -137
  142. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/cookies/util.js +21 -2
  143. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/eventsource/eventsource-stream.js +90 -9
  144. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/eventsource/eventsource.js +4 -1
  145. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/fetch/index.js +3 -3
  146. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/infra/index.js +14 -0
  147. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
  148. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/websocket/receiver.js +13 -0
  149. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/package.json +1 -1
  150. package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/package.json +1 -1
  151. package/node_modules/@maka/runtime/node_modules/undici/README.md +25 -3
  152. package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/CacheStore.md +24 -9
  153. package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Client.md +11 -6
  154. package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Dispatcher.md +3 -0
  155. package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Errors.md +76 -1
  156. package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/H2CClient.md +3 -2
  157. package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Interceptors.md +28 -8
  158. package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/RedirectHandler.md +13 -10
  159. package/node_modules/@maka/runtime/node_modules/undici/docs/docs/index.md +12 -12
  160. package/node_modules/@maka/runtime/node_modules/undici/docs/docs/type-map.json +66 -66
  161. package/node_modules/@maka/runtime/node_modules/undici/lib/cache/memory-cache-store.js +48 -13
  162. package/node_modules/@maka/runtime/node_modules/undici/lib/cache/sqlite-cache-store.js +83 -5
  163. package/node_modules/@maka/runtime/node_modules/undici/lib/core/connect.js +10 -4
  164. package/node_modules/@maka/runtime/node_modules/undici/lib/core/constants.js +12 -1
  165. package/node_modules/@maka/runtime/node_modules/undici/lib/core/errors.js +38 -1
  166. package/node_modules/@maka/runtime/node_modules/undici/lib/core/request.js +16 -1
  167. package/node_modules/@maka/runtime/node_modules/undici/lib/core/symbols.js +2 -0
  168. package/node_modules/@maka/runtime/node_modules/undici/lib/core/util.js +26 -1
  169. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/agent.js +6 -2
  170. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client-h1.js +116 -80
  171. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client-h2.js +124 -17
  172. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client.js +4 -1
  173. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/dispatcher-base.js +3 -2
  174. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +20 -3
  175. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/parser-h1.js +1064 -0
  176. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/pool-base.js +85 -31
  177. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/pool.js +11 -8
  178. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -8
  179. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/retry-agent.js +10 -0
  180. package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -5
  181. package/node_modules/@maka/runtime/node_modules/undici/lib/handler/cache-handler.js +153 -15
  182. package/node_modules/@maka/runtime/node_modules/undici/lib/handler/deduplication-handler.js +112 -51
  183. package/node_modules/@maka/runtime/node_modules/undici/lib/handler/redirect-handler.js +28 -8
  184. package/node_modules/@maka/runtime/node_modules/undici/lib/handler/retry-handler.js +44 -11
  185. package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/cache.js +11 -3
  186. package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/decompress.js +22 -9
  187. package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/dns.js +11 -0
  188. package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/response-error.js +72 -28
  189. package/node_modules/@maka/runtime/node_modules/undici/lib/milo/LICENSE.md +7 -0
  190. package/node_modules/@maka/runtime/node_modules/undici/lib/milo/no-simd.js +1002 -0
  191. package/node_modules/@maka/runtime/node_modules/undici/lib/milo/simd.js +1002 -0
  192. package/node_modules/@maka/runtime/node_modules/undici/lib/mock/mock-agent.js +11 -0
  193. package/node_modules/@maka/runtime/node_modules/undici/lib/mock/snapshot-recorder.js +3 -2
  194. package/node_modules/@maka/runtime/node_modules/undici/lib/mock/snapshot-utils.js +3 -2
  195. package/node_modules/@maka/runtime/node_modules/undici/lib/util/cache.js +11 -5
  196. package/node_modules/@maka/runtime/node_modules/undici/lib/web/cookies/util.js +19 -2
  197. package/node_modules/@maka/runtime/node_modules/undici/lib/web/eventsource/eventsource-stream.js +69 -15
  198. package/node_modules/@maka/runtime/node_modules/undici/lib/web/eventsource/eventsource.js +25 -2
  199. package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/body.js +47 -38
  200. package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/formdata-parser.js +12 -4
  201. package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/headers.js +2 -2
  202. package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/index.js +8 -4
  203. package/node_modules/@maka/runtime/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
  204. package/node_modules/@maka/runtime/node_modules/undici/lib/web/websocket/receiver.js +25 -4
  205. package/node_modules/@maka/runtime/node_modules/undici/package.json +9 -7
  206. package/node_modules/@maka/runtime/package.json +2 -0
  207. package/node_modules/@maka/runtime-host/dist/assistant/bot/bridge.js +8 -0
  208. package/node_modules/@maka/runtime-host/dist/assistant/bot/capabilities.js +1 -0
  209. package/node_modules/@maka/runtime-host/dist/assistant/bot/controller.js +64 -13
  210. package/node_modules/@maka/runtime-host/dist/assistant/bot/host.js +11 -2
  211. package/node_modules/@maka/runtime-host/dist/assistant/bot/store.js +71 -2
  212. package/node_modules/@maka/runtime-host/dist/assistant/bot/turn-ids.js +38 -0
  213. package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/assistant.js +7 -0
  214. package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/controller.js +193 -32
  215. package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/discovery-capabilities.js +69 -0
  216. package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/host.js +15 -28
  217. package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/notebook.js +286 -0
  218. package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/prompt.js +31 -6
  219. package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/store.js +18 -1
  220. package/node_modules/@maka/runtime-host/dist/assistant/memory-network/controller.js +1 -1
  221. package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/condition-observer.js +94 -0
  222. package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/condition-store.js +253 -0
  223. package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/condition.js +133 -0
  224. package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/controller.js +27 -14
  225. package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/delegation.js +35 -5
  226. package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/delivery.js +1 -1
  227. package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/host.js +16 -2
  228. package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/matter.js +13 -0
  229. package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/prompt.js +7 -5
  230. package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/review.js +1 -1
  231. package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/settlement-context.js +126 -0
  232. package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/store.js +92 -6
  233. package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/tools.js +87 -23
  234. package/node_modules/@maka/runtime-host/dist/assistant/service.js +49 -5
  235. package/node_modules/@maka/runtime-host/dist/protocol/goal.js +119 -1
  236. package/node_modules/@maka/runtime-host/dist/protocol/index.js +7 -1
  237. package/node_modules/@maka/runtime-host/dist/protocol/operations.js +8 -1
  238. package/node_modules/@maka/runtime-host/dist/protocol/personal-assistant.js +1 -0
  239. package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +7 -1
  240. package/node_modules/@maka/runtime-host/dist/protocol/session-checkin.js +133 -0
  241. package/node_modules/@maka/runtime-host/dist/server/canonical-session-projection.js +3 -2
  242. package/node_modules/@maka/runtime-host/dist/server/event-wait-manager.js +63 -12
  243. package/node_modules/@maka/runtime-host/dist/server/event-wait-observation-store.js +19 -0
  244. package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +123 -11
  245. package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +47 -3
  246. package/node_modules/@maka/runtime-host/dist/server/goal-coordinator.js +126 -4
  247. package/node_modules/@maka/runtime-host/dist/server/goal-event-waits.js +58 -19
  248. package/node_modules/@maka/runtime-host/dist/server/goal-projection.js +24 -3
  249. package/node_modules/@maka/runtime-host/dist/server/index.js +2 -0
  250. package/node_modules/@maka/runtime-host/dist/server/interactive-run-composer.js +44 -2
  251. package/node_modules/@maka/runtime-host/dist/server/personal-assistant-workspace.js +78 -0
  252. package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +73 -3
  253. package/node_modules/@maka/runtime-host/dist/server/session-checkin.js +257 -0
  254. package/node_modules/@maka/runtime-host/dist/server/session-checkpoint-coordinator.js +282 -0
  255. package/node_modules/@maka/runtime-host/dist/server/session-checkpoint-publication.js +250 -0
  256. package/node_modules/@maka/runtime-host/dist/server/shell-run-event-wait-access.js +166 -0
  257. package/node_modules/@maka/runtime-host/dist/server/shell-run-event-wait-adapter.js +59 -0
  258. package/node_modules/@maka/runtime-host/dist/server/skill-catalog-repository.js +4 -2
  259. package/node_modules/@maka/storage/dist/context-offload-snapshot.js +2 -1
  260. package/node_modules/@maka/storage/dist/execution-stores.js +36 -1
  261. package/node_modules/@maka/storage/dist/local-execution-persistence.js +26 -0
  262. package/node_modules/@maka/storage/dist/production-session-snapshot.js +14 -6
  263. package/node_modules/@maka/storage/dist/runtime-event-persistence.js +1 -0
  264. package/node_modules/@maka/storage/dist/session-bundle-policy.js +86 -16
  265. package/node_modules/@maka/storage/dist/session-checkpoint-publication-store.js +204 -0
  266. package/node_modules/@maka/storage/dist/snapshot-operation-gate.js +65 -0
  267. package/node_modules/@maka/storage/dist/sqlite-context-offload-schema.js +3 -3
  268. package/node_modules/@maka/storage/dist/sqlite-context-offload-store.js +4 -2
  269. package/node_modules/@maka/storage/dist/sqlite-reclamation-checkpoint.js +37 -0
  270. package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +31 -0
  271. package/node_modules/@maka/storage/package.json +3 -0
  272. package/node_modules/@modelcontextprotocol/client/dist/index-B-4n9P0J.d.mts.map +1 -0
  273. package/node_modules/@modelcontextprotocol/client/dist/index-J2FaQ-KY.d.cts.map +1 -0
  274. package/node_modules/@modelcontextprotocol/client/dist/index.cjs +76 -22
  275. package/node_modules/@modelcontextprotocol/client/dist/index.d.cts.map +1 -1
  276. package/node_modules/@modelcontextprotocol/client/dist/index.d.mts.map +1 -1
  277. package/node_modules/@modelcontextprotocol/client/dist/index.mjs +76 -22
  278. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.cjs +1 -1
  279. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.mjs +1 -1
  280. package/node_modules/@modelcontextprotocol/client/dist/{src-oZBjf3U1.cjs → src-DpAS0jfg.cjs} +105 -8
  281. package/node_modules/@modelcontextprotocol/client/dist/{src-xKF0PJN-.mjs → src-WCy6ifGf.mjs} +88 -9
  282. package/node_modules/@modelcontextprotocol/client/dist/stdio.cjs +1 -1
  283. package/node_modules/@modelcontextprotocol/client/dist/stdio.mjs +1 -1
  284. package/node_modules/@modelcontextprotocol/client/node_modules/@modelcontextprotocol/core/package.json +2 -2
  285. package/node_modules/@modelcontextprotocol/client/package.json +5 -5
  286. package/node_modules/fast-uri/.github/workflows/release.yml +35 -0
  287. package/node_modules/fast-uri/README.md +8 -0
  288. package/node_modules/fast-uri/index.js +98 -18
  289. package/node_modules/fast-uri/lib/utils.js +52 -0
  290. package/node_modules/fast-uri/package.json +1 -1
  291. package/node_modules/follow-redirects/index.js +10 -1
  292. package/node_modules/follow-redirects/package.json +1 -1
  293. package/node_modules/ip-address/README.md +104 -104
  294. package/node_modules/ip-address/dist/ipv4.js +7 -0
  295. package/node_modules/ip-address/dist/ipv6.js +7 -4
  296. package/node_modules/ip-address/dist/v6/constants.js +3 -0
  297. package/node_modules/ip-address/package.json +2 -1
  298. package/node_modules/undici/README.md +25 -3
  299. package/node_modules/undici/docs/docs/api/CacheStore.md +24 -9
  300. package/node_modules/undici/docs/docs/api/Client.md +11 -6
  301. package/node_modules/undici/docs/docs/api/Dispatcher.md +3 -0
  302. package/node_modules/undici/docs/docs/api/Errors.md +76 -1
  303. package/node_modules/undici/docs/docs/api/H2CClient.md +3 -2
  304. package/node_modules/undici/docs/docs/api/Interceptors.md +28 -8
  305. package/node_modules/undici/docs/docs/api/RedirectHandler.md +13 -10
  306. package/node_modules/undici/docs/docs/index.md +12 -12
  307. package/node_modules/undici/docs/docs/type-map.json +66 -66
  308. package/node_modules/undici/lib/cache/memory-cache-store.js +48 -13
  309. package/node_modules/undici/lib/cache/sqlite-cache-store.js +83 -5
  310. package/node_modules/undici/lib/core/connect.js +10 -4
  311. package/node_modules/undici/lib/core/constants.js +12 -1
  312. package/node_modules/undici/lib/core/errors.js +38 -1
  313. package/node_modules/undici/lib/core/request.js +16 -1
  314. package/node_modules/undici/lib/core/symbols.js +2 -0
  315. package/node_modules/undici/lib/core/util.js +26 -1
  316. package/node_modules/undici/lib/dispatcher/agent.js +6 -2
  317. package/node_modules/undici/lib/dispatcher/client-h1.js +116 -80
  318. package/node_modules/undici/lib/dispatcher/client-h2.js +124 -17
  319. package/node_modules/undici/lib/dispatcher/client.js +4 -1
  320. package/node_modules/undici/lib/dispatcher/dispatcher-base.js +3 -2
  321. package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +20 -3
  322. package/node_modules/undici/lib/dispatcher/parser-h1.js +1064 -0
  323. package/node_modules/undici/lib/dispatcher/pool-base.js +85 -31
  324. package/node_modules/undici/lib/dispatcher/pool.js +11 -8
  325. package/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -8
  326. package/node_modules/undici/lib/dispatcher/retry-agent.js +10 -0
  327. package/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -5
  328. package/node_modules/undici/lib/handler/cache-handler.js +153 -15
  329. package/node_modules/undici/lib/handler/deduplication-handler.js +112 -51
  330. package/node_modules/undici/lib/handler/redirect-handler.js +28 -8
  331. package/node_modules/undici/lib/handler/retry-handler.js +44 -11
  332. package/node_modules/undici/lib/interceptor/cache.js +11 -3
  333. package/node_modules/undici/lib/interceptor/decompress.js +22 -9
  334. package/node_modules/undici/lib/interceptor/dns.js +11 -0
  335. package/node_modules/undici/lib/interceptor/response-error.js +72 -28
  336. package/node_modules/undici/lib/milo/LICENSE.md +7 -0
  337. package/node_modules/undici/lib/milo/no-simd.js +1002 -0
  338. package/node_modules/undici/lib/milo/simd.js +1002 -0
  339. package/node_modules/undici/lib/mock/mock-agent.js +11 -0
  340. package/node_modules/undici/lib/mock/snapshot-recorder.js +3 -2
  341. package/node_modules/undici/lib/mock/snapshot-utils.js +3 -2
  342. package/node_modules/undici/lib/util/cache.js +11 -5
  343. package/node_modules/undici/lib/web/cookies/util.js +19 -2
  344. package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +69 -15
  345. package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -2
  346. package/node_modules/undici/lib/web/fetch/body.js +47 -38
  347. package/node_modules/undici/lib/web/fetch/formdata-parser.js +12 -4
  348. package/node_modules/undici/lib/web/fetch/headers.js +2 -2
  349. package/node_modules/undici/lib/web/fetch/index.js +8 -4
  350. package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
  351. package/node_modules/undici/lib/web/websocket/receiver.js +25 -4
  352. package/node_modules/undici/package.json +9 -7
  353. package/node_modules/zod/package.json +1 -1
  354. package/node_modules/zod/v4/core/compile.cjs +8 -0
  355. package/node_modules/zod/v4/core/compile.js +8 -0
  356. package/node_modules/zod/v4/core/schemas.cjs +30 -0
  357. package/node_modules/zod/v4/core/schemas.js +30 -0
  358. package/node_modules/zod/v4/core/util.cjs +15 -0
  359. package/node_modules/zod/v4/core/util.js +14 -0
  360. package/node_modules/zod/v4/core/versions.cjs +1 -1
  361. package/node_modules/zod/v4/core/versions.js +1 -1
  362. package/package.json +2 -2
  363. package/node_modules/@modelcontextprotocol/client/dist/index-D_CiY-T3.d.cts.map +0 -1
  364. package/node_modules/@modelcontextprotocol/client/dist/index-D_QDtbiv.d.mts.map +0 -1
@@ -209,6 +209,9 @@ added: v4.0.0
209
209
  * `path` {string} The request path.
210
210
  * `method` {string} The HTTP method, e.g. `'GET'` or `'POST'`.
211
211
  * `body` {string|Buffer|Uint8Array|Readable|FormData|null} The request body.
212
+ Undici's network clients require a `FormData` body created by the same
213
+ undici package instance. A body from another source, including Node.js's
214
+ built-in `FormData`, is rejected with an `InvalidArgumentError`.
212
215
  **Default:** `null`.
213
216
  * `headers` {UndiciHeaders} Request headers. **Default:** `null`.
214
217
  * `query` {Object} Query string parameters embedded into the request URL. Both
@@ -18,7 +18,7 @@ if (err instanceof errors.ConnectTimeoutError) {
18
18
  }
19
19
  ```
20
20
 
21
- All errors, except [`HTTPParserError`][], extend [`UndiciError`][]. Each error
21
+ All errors, except [`HTTPParserError`][] and `WebAssemblyNotSupportedError`, extend [`UndiciError`][]. Each error
22
22
  carries a stable `code` string (for example `UND_ERR_CONNECT_TIMEOUT`) and a
23
23
  `name`.
24
24
 
@@ -32,6 +32,37 @@ if (err.code === 'UND_ERR_CONNECT_TIMEOUT') {
32
32
  }
33
33
  ```
34
34
 
35
+ ## Timeout-related errors
36
+
37
+ The timeout errors below are controlled by dispatcher/client options:
38
+
39
+ | Error code | When it is thrown | Related option |
40
+ | ---------- | ----------------- | -------------- |
41
+ | `UND_ERR_CONNECT_TIMEOUT` | A connection could not be established before the connection timeout elapsed. | [`connect.timeout`](Client.md) |
42
+ | `UND_ERR_HEADERS_TIMEOUT` | The full response headers were not received before the headers timeout elapsed. | [`headersTimeout`](Client.md) |
43
+ | `UND_ERR_BODY_TIMEOUT` | While reading the response body, no new data arrived before the body timeout elapsed. | [`bodyTimeout`](Client.md) |
44
+ | `UND_ERR_SOCKET` | A generic socket-level failure happened. | Inspect `error.socket` for connection details. |
45
+
46
+ ### Configuring timeouts for `fetch`
47
+
48
+ If you are using `fetch` (including Node.js built-in `fetch`), configure timeouts
49
+ through the global dispatcher:
50
+
51
+ ```js
52
+ import { Agent, setGlobalDispatcher, fetch } from 'undici'
53
+
54
+ setGlobalDispatcher(new Agent({
55
+ connect: { timeout: 10_000 }, // connection phase
56
+ headersTimeout: 15_000, // wait for response headers
57
+ bodyTimeout: 30_000 // wait between response body chunks
58
+ }))
59
+
60
+ await fetch('https://example.com/data')
61
+ ```
62
+
63
+ You can inspect timeout error codes from `error.code` or (for wrapped fetch
64
+ errors) from `error.cause?.code`.
65
+
35
66
  ## Class: `UndiciError`
36
67
 
37
68
  <!-- YAML
@@ -52,6 +83,35 @@ on a well-known symbol rather than the prototype chain.
52
83
  * `name` {string} Always `'UndiciError'`.
53
84
  * `code` {string} Always `'UND_ERR'`.
54
85
 
86
+ ## Class: `WebAssemblyNotSupportedError`
87
+
88
+ * Extends: {Error}
89
+
90
+ WebAssembly is unavailable when Undici initializes its HTTP/1 parser. Undici does
91
+ not provide an alternative parser for environments without WebAssembly, including
92
+ Node.js configurations where `--jitless` disables it. The check is performed when
93
+ the parser is needed, not when importing Undici or accessing `fetch`.
94
+
95
+ * `name` {string} Always `'Error'`.
96
+ * `code` {string} Always `'ERR_WEBASSEMBLY_NOT_SUPPORTED'`.
97
+ * `message` {string} By default `'WebAssembly is not supported in this environment, but is required for HTTP/1 parsing'`.
98
+
99
+ Client and dispatcher requests report this error directly. `fetch` rejects with
100
+ a `TypeError` whose `cause` is this error:
101
+
102
+ ```js
103
+ try {
104
+ await fetch('http://localhost:3000')
105
+ } catch (error) {
106
+ if (error.cause?.code === 'ERR_WEBASSEMBLY_NOT_SUPPORTED') {
107
+ // HTTP/1 parsing requires WebAssembly in this environment.
108
+ }
109
+ }
110
+ ```
111
+
112
+ `Headers`, `FormData`, `Request`, `Response`, and other operations that do not need
113
+ the HTTP/1 parser remain usable without WebAssembly.
114
+
55
115
  ## Class: `ConnectTimeoutError`
56
116
 
57
117
  <!-- YAML
@@ -436,6 +496,7 @@ The response returned an error status code. This is raised, for example, when th
436
496
  * `code` {string} Always `'UND_ERR_RESPONSE'`.
437
497
  * `statusCode` {number} The HTTP status code of the response.
438
498
  * `body` {Object|string|null} The response body.
499
+ * `bodyTruncated` {boolean} Whether `body` was truncated by a configured limit.
439
500
  * `headers` {Object|string[]|null} The response headers.
440
501
 
441
502
  ### `new ResponseError(message, code, options)`
@@ -445,6 +506,7 @@ The response returned an error status code. This is raised, for example, when th
445
506
  * `options` {Object}
446
507
  * `headers` {Object|string[]|null} The response headers. (optional)
447
508
  * `body` {Object|string|null} The response body. (optional)
509
+ * `bodyTruncated` {boolean} Whether `body` was truncated. **Default:** `false`.
448
510
 
449
511
  ## Class: `ProxyConnectionError`
450
512
 
@@ -512,6 +574,19 @@ The maximum number of allowed origins has been reached.
512
574
  * `name` {string} Always `'MaxOriginsReachedError'`.
513
575
  * `code` {string} Always `'UND_ERR_MAX_ORIGINS_REACHED'`.
514
576
 
577
+ ## Class: `MaxRedirectsError`
578
+
579
+ <!-- YAML
580
+ added: v8.12.0
581
+ -->
582
+
583
+ * Extends: {UndiciError}
584
+
585
+ The maximum number of redirects has been reached.
586
+
587
+ * `name` {string} Always `'MaxRedirectsError'`.
588
+ * `code` {string} Always `'UND_ERR_REDIRECT_MAX'`.
589
+
515
590
  ## Class: `Socks5ProxyError`
516
591
 
517
592
  <!-- YAML
@@ -55,8 +55,9 @@ added: v7.7.0
55
55
  hostname, and port. Only the `http:` protocol is supported.
56
56
  * `options` {H2CClientOptions} (optional)
57
57
  * `maxConcurrentStreams` {number} The maximum number of concurrent HTTP/2
58
- streams for the session. It is advertised to the server and may be overridden
59
- by a remote `SETTINGS` frame. Must be a positive integer. **Default:** `100`.
58
+ streams for the session. The server's `SETTINGS_MAX_CONCURRENT_STREAMS` can
59
+ lower this limit, but not raise it. Must be a positive integer.
60
+ **Default:** `100`.
60
61
  * `pipelining` {number} The number of concurrent requests multiplexed over the
61
62
  single connection. For an `H2CClient` this is aliased to
62
63
  `maxConcurrentStreams` and may not exceed it. Must be a positive integer.
@@ -163,9 +163,10 @@ Follows HTTP redirects (3xx responses) automatically.
163
163
  * `maxRedirections` {number} Maximum number of redirects to follow. Passing
164
164
  `0` disables redirect following entirely. **Default:** `undefined`
165
165
  (inherits from the per-request `maxRedirections` option).
166
- * `throwOnMaxRedirect` {boolean} When `true`, throws an error once the
167
- redirect limit is reached instead of returning the final redirect response.
168
- **Default:** `false`.
166
+ * `throwOnMaxRedirect` {boolean} When `true`, throws an error when a
167
+ redirect would be followed but the redirect limit has been reached, instead
168
+ of returning that redirect response. A non-redirect response after exactly
169
+ `maxRedirections` redirects is returned normally. **Default:** `false`.
169
170
  * `stripHeadersOnRedirect` {string[]} List of header names to remove from
170
171
  the request when following any redirect. **Default:** `[]`.
171
172
  * `stripHeadersOnCrossOriginRedirect` {string[]} List of header names to
@@ -198,7 +199,10 @@ const agent = new Agent().compose(
198
199
  ## `interceptors.decompress([opts])`
199
200
 
200
201
  Automatically decompresses response bodies encoded with `gzip`, `x-gzip`,
201
- `br` (Brotli), `deflate`, `compress`, `x-compress`, or `zstd`.
202
+ `br` (Brotli), `deflate`, or `zstd`. Any other coding, including `compress`
203
+ and `x-compress`, is left untouched, matching `fetch()`. As required by
204
+ [RFC 9659](https://www.rfc-editor.org/rfc/rfc9659.html), a `zstd` frame that
205
+ requires a window size larger than 8 MB fails to decode.
202
206
 
203
207
  > **Experimental:** This interceptor is experimental and subject to change.
204
208
  > A one-time `ExperimentalWarning` is emitted on first use.
@@ -244,8 +248,11 @@ The error body is automatically decoded for `application/json` and
244
248
 
245
249
  **Parameters**
246
250
 
247
- * `opts` {Object} (optional) — currently reserved for future use; may be
248
- omitted.
251
+ * `opts` {Object} (optional)
252
+ * `maxSize` {number} Maximum number of response body bytes to include in the
253
+ error. If the body exceeds this limit, the resulting `ResponseError`
254
+ contains the retained prefix with `bodyTruncated` set to `true`. Set to `0`
255
+ to disable the limit. **Default:** `1048576` (1 MiB).
249
256
 
250
257
  **Returns:** {Dispatcher.DispatcherComposeInterceptor}
251
258
 
@@ -334,8 +341,21 @@ backing store.
334
341
 
335
342
  **Parameters**
336
343
 
337
- * `opts` {CacheHandler.CacheOptions} (optional) See the
338
- [`CacheStore`](./CacheStore.md) documentation for accepted fields.
344
+ * `opts` {Object} (optional)
345
+ * `store` {CacheStore} The store that cached responses are kept in. See
346
+ [`CacheStore`](./CacheStore.md). **Default:** a new `MemoryCacheStore`.
347
+ * `methods` {string[]} The HTTP methods to cache. Only safe methods are
348
+ allowed (`GET`, `HEAD`, `OPTIONS`, `TRACE`) and at least one is required.
349
+ **Default:** `['GET']`.
350
+ * `cacheByDefault` {number} RFC 9111 allows caching responses that are not
351
+ explicitly marked as cacheable or not cacheable. Set this to cache such
352
+ responses. **Default:** `undefined`.
353
+ * `type` {string} Whether the cache is `'shared'` or `'private'`, which
354
+ decides how directives such as `s-maxage` and `private` are applied.
355
+ **Default:** `'shared'`.
356
+ * `origins` {(string|RegExp)[]} Only requests to these origins are cached.
357
+ Strings are compared case-insensitively. **Default:** `undefined` (all
358
+ origins are cached).
339
359
 
340
360
  **Returns:** {Dispatcher.DispatcherComposeInterceptor}
341
361
 
@@ -57,9 +57,10 @@ added: v4.0.0
57
57
  * `opts` {DispatchOptions} The dispatch options for the request. In addition to
58
58
  the standard dispatch options, the following redirect-specific fields are
59
59
  recognized:
60
- * `throwOnMaxRedirect` {boolean} When `true`, an error is thrown once
61
- `maxRedirections` is reached instead of returning the last redirect response.
62
- **Default:** `false`.
60
+ * `throwOnMaxRedirect` {boolean} When `true`, an error is thrown when a
61
+ redirect would be followed but `maxRedirections` has been reached, instead of
62
+ returning that redirect response. A non-redirect response after exactly
63
+ `maxRedirections` redirects is returned normally. **Default:** `false`.
63
64
  * `stripHeadersOnRedirect` {string[]} Header names to remove from the request on
64
65
  every redirect hop. **Default:** `null`.
65
66
  * `stripHeadersOnCrossOriginRedirect` {string[]} Additional header names to
@@ -165,13 +166,15 @@ added: v7.0.0
165
166
  * `statusMessage` {string} The HTTP status message.
166
167
 
167
168
  Inspects the response headers to decide whether to follow a redirect. When the
168
- status code is redirectable, the `maxRedirections` limit has not been reached, and
169
- the request body has not been consumed, the `location` property is set, the method
170
- and headers are adjusted for the next hop, and the response is not forwarded.
171
- Otherwise the event is forwarded to the wrapped `handler`.
172
-
173
- Throws when `throwOnMaxRedirect` is `true` and the number of recorded redirects
174
- has reached `maxRedirections`, and throws an [`InvalidArgumentError`][] if a
169
+ status code is redirectable, the response has a `Location` header, the
170
+ `maxRedirections` limit has not been reached, and the request body has not been
171
+ consumed, the `location` property is set, the method and headers are adjusted
172
+ for the next hop, and the response is not forwarded. Otherwise the event is
173
+ forwarded to the wrapped `handler`.
174
+
175
+ Throws when `throwOnMaxRedirect` is `true` and a redirect that would otherwise be
176
+ followed arrives after `maxRedirections` redirects have already been followed,
177
+ and throws an [`InvalidArgumentError`][] if a
175
178
  redirect loop is detected (for example when a [`Client`][] or [`Pool`][] is used
176
179
  for a cross-origin redirect; use an [`Agent`][] instead).
177
180
 
@@ -13,7 +13,7 @@ It is also a Stranger Things reference.
13
13
 
14
14
  Have a question about using Undici? Open a [Q&A Discussion](https://github.com/nodejs/undici/discussions/new) or join our official OpenJS [Slack](https://openjs-foundation.slack.com/archives/C01QF9Q31QD) channel.
15
15
 
16
- Looking to contribute? Start by reading the [contributing guide](./CONTRIBUTING.md)
16
+ Looking to contribute? Start by reading the [contributing guide](https://github.com/nodejs/undici/blob/main/CONTRIBUTING.md)
17
17
 
18
18
  ## Install
19
19
 
@@ -417,7 +417,7 @@ For more information about their behavior, please reference the body mixin from
417
417
 
418
418
  ## Common API Methods
419
419
 
420
- This section documents our most commonly used API methods. Additional APIs are documented in their own files within the [docs](./docs/) folder and are accessible via the navigation list on the left side of the docs site.
420
+ This section documents our most commonly used API methods. Additional APIs are documented in their own files within the [`api`](./api/) folder and are accessible via the navigation list on the left side of the docs site.
421
421
 
422
422
  For the top-level APIs below, the `url` argument supplies the request origin and
423
423
  path. Do not pass `origin` or `path` in the second `options` argument. The linked
@@ -427,19 +427,19 @@ lower-level APIs that do not receive a separate `url` argument.
427
427
  ### `undici.request([url, options])`
428
428
 
429
429
  * `url` {string|URL|UrlObject}
430
- * `options` {RequestOptions} See [`RequestOptions`](./docs/docs/api/Dispatcher.md#parameter-requestoptions).
430
+ * `options` {RequestOptions} See [`RequestOptions`](./api/Dispatcher.md#parameter-requestoptions).
431
431
  * `dispatcher` {Dispatcher} **Default:** [getGlobalDispatcher](#undicigetglobaldispatcher).
432
432
  * `method` {string} **Default:** `PUT` if `options.body`, otherwise `GET`.
433
433
  * Returns: {Promise} A promise with the result of the `Dispatcher.request` method.
434
434
 
435
435
  Calls `options.dispatcher.request(options)`.
436
436
 
437
- See [Dispatcher.request](./docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback) for more details, and [request examples](./docs/examples/README.md) for examples.
437
+ See [Dispatcher.request](./api/Dispatcher.md#dispatcherrequestoptions-callback) for more details, and [request examples](https://github.com/nodejs/undici/blob/main/docs/examples/README.md) for examples.
438
438
 
439
439
  ### `undici.stream([url, options, ]factory)`
440
440
 
441
441
  * `url` {string|URL|UrlObject}
442
- * `options` {StreamOptions} See [`StreamOptions`](./docs/docs/api/Dispatcher.md#parameter-streamoptions).
442
+ * `options` {StreamOptions} See [`StreamOptions`](./api/Dispatcher.md#parameter-streamoptions).
443
443
  * `dispatcher` {Dispatcher} **Default:** [getGlobalDispatcher](#undicigetglobaldispatcher).
444
444
  * `method` {string} **Default:** `PUT` if `options.body`, otherwise `GET`.
445
445
  * `factory` {Function} `Dispatcher.stream.factory`.
@@ -447,12 +447,12 @@ See [Dispatcher.request](./docs/docs/api/Dispatcher.md#dispatcherrequestoptions-
447
447
 
448
448
  Calls `options.dispatcher.stream(options, factory)`.
449
449
 
450
- See [Dispatcher.stream](./docs/docs/api/Dispatcher.md#dispatcherstreamoptions-factory-callback) for more details.
450
+ See [Dispatcher.stream](./api/Dispatcher.md#dispatcherstreamoptions-factory-callback) for more details.
451
451
 
452
452
  ### `undici.pipeline([url, options, ]handler)`
453
453
 
454
454
  * `url` {string|URL|UrlObject}
455
- * `options` {PipelineOptions} See [`PipelineOptions`](./docs/docs/api/Dispatcher.md#parameter-pipelineoptions).
455
+ * `options` {PipelineOptions} See [`PipelineOptions`](./api/Dispatcher.md#parameter-pipelineoptions).
456
456
  * `dispatcher` {Dispatcher} **Default:** [getGlobalDispatcher](#undicigetglobaldispatcher).
457
457
  * `method` {string} **Default:** `PUT` if `options.body`, otherwise `GET`.
458
458
  * `handler` {Function} `Dispatcher.pipeline.handler`.
@@ -460,21 +460,21 @@ See [Dispatcher.stream](./docs/docs/api/Dispatcher.md#dispatcherstreamoptions-fa
460
460
 
461
461
  Calls `options.dispatch.pipeline(options, handler)`.
462
462
 
463
- See [Dispatcher.pipeline](./docs/docs/api/Dispatcher.md#dispatcherpipelineoptions-handler) for more details.
463
+ See [Dispatcher.pipeline](./api/Dispatcher.md#dispatcherpipelineoptions-handler) for more details.
464
464
 
465
465
  ### `undici.connect([url, options])`
466
466
 
467
467
  Starts two-way communications with the requested resource using [HTTP CONNECT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/CONNECT).
468
468
 
469
469
  * `url` {string|URL|UrlObject}
470
- * `options` {ConnectOptions} See [`ConnectOptions`](./docs/docs/api/Dispatcher.md#parameter-connectoptions).
470
+ * `options` {ConnectOptions} See [`ConnectOptions`](./api/Dispatcher.md#parameter-connectoptions).
471
471
  * `dispatcher` {Dispatcher} **Default:** [getGlobalDispatcher](#undicigetglobaldispatcher).
472
472
  * `callback` {Function} (optional) — `(err, data) => void`.
473
473
  * Returns: {Promise} A promise with the result of the `Dispatcher.connect` method.
474
474
 
475
475
  Calls `options.dispatch.connect(options)`.
476
476
 
477
- See [Dispatcher.connect](./docs/docs/api/Dispatcher.md#dispatcherconnectoptions-callback) for more details.
477
+ See [Dispatcher.connect](./api/Dispatcher.md#dispatcherconnectoptions-callback) for more details.
478
478
 
479
479
  ### `undici.fetch(input[, init])`
480
480
 
@@ -647,14 +647,14 @@ Undici limits the number of `Content-Encoding` layers in a response to **5** to
647
647
  Upgrade to a different protocol. See [MDN - HTTP - Protocol upgrade mechanism](https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism) for more details.
648
648
 
649
649
  * `url` {string|URL|UrlObject}
650
- * `options` {UpgradeOptions} See [`UpgradeOptions`](./docs/docs/api/Dispatcher.md#parameter-upgradeoptions).
650
+ * `options` {UpgradeOptions} See [`UpgradeOptions`](./api/Dispatcher.md#parameter-upgradeoptions).
651
651
  * `dispatcher` {Dispatcher} **Default:** [getGlobalDispatcher](#undicigetglobaldispatcher).
652
652
  * `callback` {Function} (optional) — `(error, data) => void`.
653
653
  * Returns: {Promise} A promise with the result of the `Dispatcher.upgrade` method.
654
654
 
655
655
  Calls `options.dispatcher.upgrade(options)`.
656
656
 
657
- See [Dispatcher.upgrade](./docs/docs/api/Dispatcher.md#dispatcherupgradeoptions-callback) for more details.
657
+ See [Dispatcher.upgrade](./api/Dispatcher.md#dispatcherupgradeoptions-callback) for more details.
658
658
 
659
659
  ### `undici.setGlobalDispatcher(dispatcher)`
660
660
 
@@ -1,79 +1,79 @@
1
1
  {
2
- "AbortError": "/api/Errors.md#class-aborterror",
3
- "Agent": "/api/Agent.md#class-agent",
4
- "AgentDispatchOptions": "/api/Agent.md#agentdispatchoptions-handler",
5
- "AgentOptions": "/api/Agent.md#new-agentoptions",
6
- "BalancedPool": "/api/BalancedPool.md#class-balancedpool",
7
- "BalancedPoolOptions": "/api/BalancedPool.md#parameter-balancedpooloptions",
8
- "BodyMixin": "/api/Fetch.md#new-formdata",
2
+ "AbortError": "/api/Errors.html#class-aborterror",
3
+ "Agent": "/api/Agent.html#class-agent",
4
+ "AgentDispatchOptions": "/api/Agent.html#agentdispatchoptions-handler",
5
+ "AgentOptions": "/api/Agent.html#new-agentoptions",
6
+ "BalancedPool": "/api/BalancedPool.html#class-balancedpool",
7
+ "BalancedPoolOptions": "/api/BalancedPool.html#parameter-balancedpooloptions",
8
+ "BodyMixin": "/api/Fetch.html#new-formdata",
9
9
  "Buffer": "https://nodejs.org/api/buffer.html#class-buffer",
10
- "BuildOptions": "/api/Connector.md#buildconnectoroptions",
11
- "CacheKey": "/api/CacheStore.md#cachekey",
12
- "CacheStore": "/api/CacheStore.md#new-memorycachestoreoptions",
13
- "CacheValue": "/api/CacheStore.md#cachevalue",
14
- "ClientDestroyedError": "/api/Errors.md#class-clientdestroyederror",
15
- "ClientOptions": "/api/Client.md#new-clienturl-options",
16
- "ClientStats": "/api/ClientStats.md#class-clientstats",
17
- "ConnectOptions": "/api/Dispatcher.md#class-dispatcher",
18
- "Cookie": "/api/Cookies.md#cookie",
19
- "DispatchController": "/api/Dispatcher.md#class-dispatcher",
20
- "DispatchHandler": "/api/Dispatcher.md#class-dispatcher",
21
- "DispatchOptions": "/api/Dispatcher.md#class-dispatcher",
22
- "Dispatcher": "/api/Dispatcher.md#class-dispatcher",
10
+ "BuildOptions": "/api/Connector.html#buildconnectoroptions",
11
+ "CacheKey": "/api/CacheStore.html#cachekey",
12
+ "CacheStore": "/api/CacheStore.html#new-memorycachestoreoptions",
13
+ "CacheValue": "/api/CacheStore.html#cachevalue",
14
+ "ClientDestroyedError": "/api/Errors.html#class-clientdestroyederror",
15
+ "ClientOptions": "/api/Client.html#new-clienturl-options",
16
+ "ClientStats": "/api/ClientStats.html#class-clientstats",
17
+ "ConnectOptions": "/api/Dispatcher.html#class-dispatcher",
18
+ "Cookie": "/api/Cookies.html#cookie",
19
+ "DispatchController": "/api/Dispatcher.html#class-dispatcher",
20
+ "DispatchHandler": "/api/Dispatcher.html#class-dispatcher",
21
+ "DispatchOptions": "/api/Dispatcher.html#class-dispatcher",
22
+ "Dispatcher": "/api/Dispatcher.html#class-dispatcher",
23
23
  "Duplex": "https://nodejs.org/api/stream.html#class-streamduplex",
24
- "EnvHttpProxyAgent": "/api/EnvHttpProxyAgent.md#class-envhttpproxyagent",
25
- "EnvHttpProxyAgentOptions": "/api/EnvHttpProxyAgent.md#new-envhttpproxyagentoptions",
24
+ "EnvHttpProxyAgent": "/api/EnvHttpProxyAgent.html#class-envhttpproxyagent",
25
+ "EnvHttpProxyAgentOptions": "/api/EnvHttpProxyAgent.html#new-envhttpproxyagentoptions",
26
26
  "EventEmitter": "https://nodejs.org/api/events.html#class-eventemitter",
27
- "GetResult": "/api/CacheStore.md#getresult",
28
- "H2CClientOptions": "/api/H2CClient.md#new-h2cclienturl-options",
27
+ "GetResult": "/api/CacheStore.html#getresult",
28
+ "H2CClientOptions": "/api/H2CClient.html#new-h2cclienturl-options",
29
29
  "HeadersInit": "https://developer.mozilla.org/docs/Web/API/Headers/Headers",
30
- "InvalidArgumentError": "/api/Errors.md#class-invalidargumenterror",
30
+ "InvalidArgumentError": "/api/Errors.html#class-invalidargumenterror",
31
31
  "Iterable": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Iteration_protocols",
32
- "MaxOriginsReachedError": "/api/Errors.md#class-maxoriginsreachederror",
33
- "MockAgent": "/api/MockAgent.md#class-mockagent",
34
- "MockAgentOptions": "/api/MockAgent.md#parameter-mockagentoptions",
35
- "MockCallHistory": "/api/MockCallHistory.md#class-mockcallhistory",
36
- "MockCallHistoryLog": "/api/MockCallHistoryLog.md#class-mockcallhistorylog",
37
- "MockClient": "/api/MockClient.md#class-mockclient",
38
- "MockClientOptions": "/api/MockClient.md#parameter-mockclientoptions",
39
- "MockInterceptor": "/api/MockPool.md#return-mockinterceptor",
40
- "MockInterceptor.Options": "/api/MockPool.md#parameter-mockpoolinterceptoptions",
41
- "MockPool": "/api/MockPool.md#class-mockpool",
42
- "MockPoolInterceptOptions": "/api/MockPool.md#parameter-mockpoolinterceptoptions",
43
- "MockPoolOptions": "/api/MockPool.md#parameter-mockpooloptions",
44
- "MockResponseOptions": "/api/MockPool.md#parameter-mockresponseoptions",
45
- "MockScope": "/api/MockPool.md#return-mockscope",
46
- "PendingInterceptor": "/api/MockAgent.md#new-mockagentoptions",
47
- "PipelineOptions": "/api/Dispatcher.md#class-dispatcher",
48
- "Pool": "/api/Pool.md#class-pool",
49
- "PoolOptions": "/api/Pool.md#new-poolurl-options",
50
- "PoolStats": "/api/PoolStats.md#class-poolstats",
51
- "ProxyAgent": "/api/ProxyAgent.md#class-proxyagent",
52
- "ProxyAgentOptions": "/api/ProxyAgent.md#new-proxyagentoptions",
32
+ "MaxOriginsReachedError": "/api/Errors.html#class-maxoriginsreachederror",
33
+ "MockAgent": "/api/MockAgent.html#class-mockagent",
34
+ "MockAgentOptions": "/api/MockAgent.html#parameter-mockagentoptions",
35
+ "MockCallHistory": "/api/MockCallHistory.html#class-mockcallhistory",
36
+ "MockCallHistoryLog": "/api/MockCallHistoryLog.html#class-mockcallhistorylog",
37
+ "MockClient": "/api/MockClient.html#class-mockclient",
38
+ "MockClientOptions": "/api/MockClient.html#parameter-mockclientoptions",
39
+ "MockInterceptor": "/api/MockPool.html#return-mockinterceptor",
40
+ "MockInterceptor.Options": "/api/MockPool.html#parameter-mockpoolinterceptoptions",
41
+ "MockPool": "/api/MockPool.html#class-mockpool",
42
+ "MockPoolInterceptOptions": "/api/MockPool.html#parameter-mockpoolinterceptoptions",
43
+ "MockPoolOptions": "/api/MockPool.html#parameter-mockpooloptions",
44
+ "MockResponseOptions": "/api/MockPool.html#parameter-mockresponseoptions",
45
+ "MockScope": "/api/MockPool.html#return-mockscope",
46
+ "PendingInterceptor": "/api/MockAgent.html#new-mockagentoptions",
47
+ "PipelineOptions": "/api/Dispatcher.html#class-dispatcher",
48
+ "Pool": "/api/Pool.html#class-pool",
49
+ "PoolOptions": "/api/Pool.html#new-poolurl-options",
50
+ "PoolStats": "/api/PoolStats.html#class-poolstats",
51
+ "ProxyAgent": "/api/ProxyAgent.html#class-proxyagent",
52
+ "ProxyAgentOptions": "/api/ProxyAgent.html#new-proxyagentoptions",
53
53
  "Readable": "https://nodejs.org/api/stream.html#class-streamreadable",
54
54
  "Record": "https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type",
55
- "RequestInit": "/api/Fetch.md#new-formdata",
56
- "RequestOptions": "/api/Dispatcher.md#class-dispatcher",
57
- "ResponseInit": "/api/Fetch.md#new-formdata",
58
- "RetryContext": "/api/RetryHandler.md#retrycontext",
59
- "RetryHandler": "/api/RetryHandler.md#class-retryhandler",
60
- "RetryHandlers": "/api/RetryHandler.md#parameter-retryhandlers",
61
- "RetryOptions": "/api/RetryHandler.md#retryoptions",
62
- "RetryState": "/api/RetryHandler.md#retrystate",
63
- "RoundRobinPoolOptions": "/api/RoundRobinPool.md#parameter-roundrobinpooloptions",
64
- "SnapshotRecorder": "/api/SnapshotAgent.md#new-snapshotagentoptions",
55
+ "RequestInit": "/api/Fetch.html#new-formdata",
56
+ "RequestOptions": "/api/Dispatcher.html#class-dispatcher",
57
+ "ResponseInit": "/api/Fetch.html#new-formdata",
58
+ "RetryContext": "/api/RetryHandler.html#retrycontext",
59
+ "RetryHandler": "/api/RetryHandler.html#class-retryhandler",
60
+ "RetryHandlers": "/api/RetryHandler.html#parameter-retryhandlers",
61
+ "RetryOptions": "/api/RetryHandler.html#retryoptions",
62
+ "RetryState": "/api/RetryHandler.html#retrystate",
63
+ "RoundRobinPoolOptions": "/api/RoundRobinPool.html#parameter-roundrobinpooloptions",
64
+ "SnapshotRecorder": "/api/SnapshotAgent.html#new-snapshotagentoptions",
65
65
  "Socket": "https://nodejs.org/api/net.html#class-netsocket",
66
- "SocketInfo": "/api/Errors.md#new-requestretryerrormessage-code-options",
67
- "StreamOptions": "/api/Dispatcher.md#class-dispatcher",
66
+ "SocketInfo": "/api/Errors.html#new-requestretryerrormessage-code-options",
67
+ "StreamOptions": "/api/Dispatcher.html#class-dispatcher",
68
68
  "TLSSocket": "https://nodejs.org/api/tls.html#class-tlstlssocket",
69
- "UndiciError": "/api/Errors.md#class-undicierror",
70
- "UndiciHeaders": "/api/Dispatcher.md#class-dispatcher",
71
- "UpgradeOptions": "/api/Dispatcher.md#class-dispatcher",
72
- "UrlObject": "/index.md#urlobject",
73
- "WebSocketInit": "/api/WebSocket.md#new-websocketurl-protocols",
74
- "WebSocketStreamOptions": "/api/WebSocket.md#new-websocketurl-protocols",
69
+ "UndiciError": "/api/Errors.html#class-undicierror",
70
+ "UndiciHeaders": "/api/Dispatcher.html#class-dispatcher",
71
+ "UpgradeOptions": "/api/Dispatcher.html#class-dispatcher",
72
+ "UrlObject": "/index.html#urlobject",
73
+ "WebSocketInit": "/api/WebSocket.html#new-websocketurl-protocols",
74
+ "WebSocketStreamOptions": "/api/WebSocket.html#new-websocketurl-protocols",
75
75
  "Writable": "https://nodejs.org/api/stream.html#class-streamwritable",
76
- "buildConnector.BuildOptions": "/api/Connector.md#buildconnectoroptions",
76
+ "buildConnector.BuildOptions": "/api/Connector.html#buildconnectoroptions",
77
77
  "net.Socket": "https://nodejs.org/api/net.html#class-netsocket",
78
78
  "stream.Readable": "https://nodejs.org/api/stream.html#class-streamreadable"
79
- }
79
+ }
@@ -100,6 +100,11 @@ class MemoryCacheStore extends EventEmitter {
100
100
 
101
101
  const entry = entries ? findEntry(key, entries, now) : null
102
102
 
103
+ if (entry != null) {
104
+ this.#entries.delete(topLevelKey)
105
+ this.#entries.set(topLevelKey, entries)
106
+ }
107
+
103
108
  return entry == null
104
109
  ? undefined
105
110
  : {
@@ -148,11 +153,13 @@ class MemoryCacheStore extends EventEmitter {
148
153
  },
149
154
  final (callback) {
150
155
  let entries = store.#entries.get(topLevelKey)
151
- if (!entries) {
156
+ if (entries) {
157
+ store.#entries.delete(topLevelKey)
158
+ } else {
152
159
  entries = []
153
- store.#entries.set(topLevelKey, entries)
154
160
  }
155
- const previousEntry = findEntry(key, entries, Date.now())
161
+ store.#entries.set(topLevelKey, entries)
162
+ const previousEntry = findEntry(key, entries, -Infinity)
156
163
  if (previousEntry) {
157
164
  const index = entries.indexOf(previousEntry)
158
165
  entries.splice(index, 1, entry)
@@ -177,16 +184,7 @@ class MemoryCacheStore extends EventEmitter {
177
184
  store.#hasEmittedMaxSizeEvent = true
178
185
  }
179
186
 
180
- // Perform eviction
181
- for (const [key, entries] of store.#entries) {
182
- for (const entry of entries.splice(0, Math.ceil(entries.length / 2))) {
183
- store.#size -= entry.size
184
- store.#count -= 1
185
- }
186
- if (entries.length === 0) {
187
- store.#entries.delete(key)
188
- }
189
- }
187
+ store.#evict(entry)
190
188
 
191
189
  // Reset the event flag after eviction
192
190
  if (store.#size < store.#maxSize && store.#count < store.#maxCount) {
@@ -199,6 +197,43 @@ class MemoryCacheStore extends EventEmitter {
199
197
  })
200
198
  }
201
199
 
200
+ #evict (keep) {
201
+ const targetSize = this.#maxSize / 2
202
+ const targetCount = this.#maxCount / 2
203
+
204
+ for (const [key, entries] of this.#entries) {
205
+ for (let i = 0; i < entries.length && (this.#size > targetSize || this.#count > targetCount);) {
206
+ const entry = entries[i]
207
+ if (entry === keep) {
208
+ i++
209
+ continue
210
+ }
211
+ entries.splice(i, 1)
212
+ this.#size -= entry.size
213
+ this.#count -= 1
214
+ }
215
+
216
+ if (entries.length === 0) {
217
+ this.#entries.delete(key)
218
+ }
219
+
220
+ if (this.#size <= targetSize && this.#count <= targetCount) {
221
+ return
222
+ }
223
+ }
224
+
225
+ if (this.#size > this.#maxSize || this.#count > this.#maxCount) {
226
+ const topLevelKey = `${keep.origin}:${keep.path}`
227
+ const entries = this.#entries.get(topLevelKey)
228
+ entries.splice(entries.indexOf(keep), 1)
229
+ this.#size -= keep.size
230
+ this.#count -= 1
231
+ if (entries.length === 0) {
232
+ this.#entries.delete(topLevelKey)
233
+ }
234
+ }
235
+ }
236
+
202
237
  /**
203
238
  * @param {CacheKey} key
204
239
  */