experimental-ash 0.37.0 → 0.38.0

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 (173) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/docs/internals/README.md +1 -1
  3. package/dist/docs/internals/context.md +3 -3
  4. package/dist/docs/internals/core-beliefs.md +2 -2
  5. package/dist/docs/internals/hooks.md +4 -4
  6. package/dist/docs/internals/mechanical-invariants.md +1 -1
  7. package/dist/docs/public/advanced/session-context.md +14 -16
  8. package/dist/src/channel/compiled-channel.d.ts +2 -2
  9. package/dist/src/channel/types.d.ts +1 -1
  10. package/dist/src/compiled/.vendor-stamp.json +2 -1
  11. package/dist/src/compiled/experimental-ai-sdk-code-mode/LICENSE +21 -0
  12. package/dist/src/compiled/experimental-ai-sdk-code-mode/index.d.ts +144 -0
  13. package/dist/src/compiled/experimental-ai-sdk-code-mode/index.js +482 -0
  14. package/dist/src/compiled/experimental-ai-sdk-code-mode/package.json +7 -0
  15. package/dist/src/context/build-callback-context.d.ts +3 -3
  16. package/dist/src/context/container.d.ts +5 -5
  17. package/dist/src/context/key.d.ts +1 -1
  18. package/dist/src/context/serialize.d.ts +2 -2
  19. package/dist/src/execution/tool-compaction.d.ts +1 -1
  20. package/dist/src/execution/workflow-entry.js +1 -1
  21. package/dist/src/harness/code-mode-approval.d.ts +1 -1
  22. package/dist/src/harness/code-mode-approval.js +1 -1
  23. package/dist/src/harness/code-mode-connection-auth-state.d.ts +1 -1
  24. package/dist/src/harness/code-mode-lifecycle.d.ts +1 -1
  25. package/dist/src/harness/code-mode.d.ts +3 -6
  26. package/dist/src/harness/code-mode.js +1 -1
  27. package/dist/src/harness/tool-loop.js +1 -1
  28. package/dist/src/internal/application/package.js +1 -1
  29. package/dist/src/internal/nitro/host/code-mode-runtime-dependency-plugin.js +1 -1
  30. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  31. package/dist/src/internal/workflow-bundle/builder.js +2 -2
  32. package/dist/src/packages/ash-scaffold/src/channels.js +1 -1
  33. package/dist/src/public/channels/discord/discordChannel.d.ts +3 -4
  34. package/dist/src/public/channels/slack/slackChannel.d.ts +3 -4
  35. package/dist/src/public/channels/teams/teamsChannel.d.ts +3 -4
  36. package/dist/src/public/channels/telegram/telegramChannel.d.ts +3 -4
  37. package/dist/src/public/channels/twilio/twilioChannel.d.ts +3 -4
  38. package/dist/src/public/context/index.d.ts +1 -1
  39. package/dist/src/public/definitions/callback-context.d.ts +1 -1
  40. package/dist/src/public/definitions/defineChannel.d.ts +23 -16
  41. package/dist/src/public/definitions/hook.d.ts +3 -3
  42. package/dist/src/public/definitions/tool.d.ts +8 -6
  43. package/dist/src/public/tools/approval/approval-helpers.d.ts +3 -3
  44. package/dist/src/public/tools/index.d.ts +1 -1
  45. package/dist/src/runtime/connections/authorization-tokens.d.ts +3 -3
  46. package/dist/src/runtime/connections/principal.d.ts +3 -3
  47. package/dist/src/runtime/framework-tools/code-mode-connection-auth.d.ts +1 -1
  48. package/dist/src/runtime/framework-tools/connection-search.js +1 -1
  49. package/dist/src/runtime/framework-tools/connection-tools.js +1 -1
  50. package/dist/src/runtime/framework-tools/file-state.d.ts +2 -2
  51. package/dist/src/runtime/resolve-connection.d.ts +1 -1
  52. package/dist/src/sandbox/state.d.ts +1 -1
  53. package/dist/src/shared/code-mode.d.ts +8 -0
  54. package/dist/src/shared/code-mode.js +1 -1
  55. package/package.json +3 -4
  56. package/dist/src/node_modules/.pnpm/@jitl_quickjs-ffi-types@0.32.0/node_modules/@jitl/quickjs-ffi-types/dist/index.js +0 -1
  57. package/dist/src/node_modules/.pnpm/@jitl_quickjs-wasmfile-debug-asyncify@0.32.0/node_modules/@jitl/quickjs-wasmfile-debug-asyncify/dist/emscripten-module.js +0 -1
  58. package/dist/src/node_modules/.pnpm/@jitl_quickjs-wasmfile-debug-asyncify@0.32.0/node_modules/@jitl/quickjs-wasmfile-debug-asyncify/dist/ffi.js +0 -1
  59. package/dist/src/node_modules/.pnpm/@jitl_quickjs-wasmfile-debug-asyncify@0.32.0/node_modules/@jitl/quickjs-wasmfile-debug-asyncify/dist/index.js +0 -1
  60. package/dist/src/node_modules/.pnpm/@jitl_quickjs-wasmfile-debug-sync@0.32.0/node_modules/@jitl/quickjs-wasmfile-debug-sync/dist/emscripten-module.js +0 -4
  61. package/dist/src/node_modules/.pnpm/@jitl_quickjs-wasmfile-debug-sync@0.32.0/node_modules/@jitl/quickjs-wasmfile-debug-sync/dist/ffi.js +0 -1
  62. package/dist/src/node_modules/.pnpm/@jitl_quickjs-wasmfile-debug-sync@0.32.0/node_modules/@jitl/quickjs-wasmfile-debug-sync/dist/index.js +0 -1
  63. package/dist/src/node_modules/.pnpm/@jitl_quickjs-wasmfile-release-asyncify@0.32.0/node_modules/@jitl/quickjs-wasmfile-release-asyncify/dist/emscripten-module.js +0 -1
  64. package/dist/src/node_modules/.pnpm/@jitl_quickjs-wasmfile-release-asyncify@0.32.0/node_modules/@jitl/quickjs-wasmfile-release-asyncify/dist/ffi.js +0 -1
  65. package/dist/src/node_modules/.pnpm/@jitl_quickjs-wasmfile-release-asyncify@0.32.0/node_modules/@jitl/quickjs-wasmfile-release-asyncify/dist/index.js +0 -1
  66. package/dist/src/node_modules/.pnpm/@jitl_quickjs-wasmfile-release-sync@0.32.0/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.js +0 -1
  67. package/dist/src/node_modules/.pnpm/@jitl_quickjs-wasmfile-release-sync@0.32.0/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/ffi.js +0 -1
  68. package/dist/src/node_modules/.pnpm/@jitl_quickjs-wasmfile-release-sync@0.32.0/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/index.js +0 -1
  69. package/dist/src/node_modules/.pnpm/experimental-ai-sdk-code-mode@1.0.10_ai@7.0.0-canary.154_zod@4.4.3_/node_modules/experimental-ai-sdk-code-mode/dist/approval-continuation.js +0 -1
  70. package/dist/src/node_modules/.pnpm/experimental-ai-sdk-code-mode@1.0.10_ai@7.0.0-canary.154_zod@4.4.3_/node_modules/experimental-ai-sdk-code-mode/dist/approval-response.js +0 -1
  71. package/dist/src/node_modules/.pnpm/experimental-ai-sdk-code-mode@1.0.10_ai@7.0.0-canary.154_zod@4.4.3_/node_modules/experimental-ai-sdk-code-mode/dist/code-mode-tool.js +0 -1
  72. package/dist/src/node_modules/.pnpm/experimental-ai-sdk-code-mode@1.0.10_ai@7.0.0-canary.154_zod@4.4.3_/node_modules/experimental-ai-sdk-code-mode/dist/continuation-capability.js +0 -1
  73. package/dist/src/node_modules/.pnpm/experimental-ai-sdk-code-mode@1.0.10_ai@7.0.0-canary.154_zod@4.4.3_/node_modules/experimental-ai-sdk-code-mode/dist/errors.js +0 -1
  74. package/dist/src/node_modules/.pnpm/experimental-ai-sdk-code-mode@1.0.10_ai@7.0.0-canary.154_zod@4.4.3_/node_modules/experimental-ai-sdk-code-mode/dist/fetch-policy.js +0 -1
  75. package/dist/src/node_modules/.pnpm/experimental-ai-sdk-code-mode@1.0.10_ai@7.0.0-canary.154_zod@4.4.3_/node_modules/experimental-ai-sdk-code-mode/dist/host-interrupt.js +0 -1
  76. package/dist/src/node_modules/.pnpm/experimental-ai-sdk-code-mode@1.0.10_ai@7.0.0-canary.154_zod@4.4.3_/node_modules/experimental-ai-sdk-code-mode/dist/index.js +0 -1
  77. package/dist/src/node_modules/.pnpm/experimental-ai-sdk-code-mode@1.0.10_ai@7.0.0-canary.154_zod@4.4.3_/node_modules/experimental-ai-sdk-code-mode/dist/interrupt-continuation.js +0 -1
  78. package/dist/src/node_modules/.pnpm/experimental-ai-sdk-code-mode@1.0.10_ai@7.0.0-canary.154_zod@4.4.3_/node_modules/experimental-ai-sdk-code-mode/dist/options.js +0 -1
  79. package/dist/src/node_modules/.pnpm/experimental-ai-sdk-code-mode@1.0.10_ai@7.0.0-canary.154_zod@4.4.3_/node_modules/experimental-ai-sdk-code-mode/dist/run-code-mode.js +0 -1
  80. package/dist/src/node_modules/.pnpm/experimental-ai-sdk-code-mode@1.0.10_ai@7.0.0-canary.154_zod@4.4.3_/node_modules/experimental-ai-sdk-code-mode/dist/runtime/manager.js +0 -1
  81. package/dist/src/node_modules/.pnpm/experimental-ai-sdk-code-mode@1.0.10_ai@7.0.0-canary.154_zod@4.4.3_/node_modules/experimental-ai-sdk-code-mode/dist/runtime/max-workers.js +0 -1
  82. package/dist/src/node_modules/.pnpm/experimental-ai-sdk-code-mode@1.0.10_ai@7.0.0-canary.154_zod@4.4.3_/node_modules/experimental-ai-sdk-code-mode/dist/runtime/worker-source.js +0 -408
  83. package/dist/src/node_modules/.pnpm/experimental-ai-sdk-code-mode@1.0.10_ai@7.0.0-canary.154_zod@4.4.3_/node_modules/experimental-ai-sdk-code-mode/dist/serialization.js +0 -1
  84. package/dist/src/node_modules/.pnpm/experimental-ai-sdk-code-mode@1.0.10_ai@7.0.0-canary.154_zod@4.4.3_/node_modules/experimental-ai-sdk-code-mode/dist/source-cache.js +0 -4
  85. package/dist/src/node_modules/.pnpm/experimental-ai-sdk-code-mode@1.0.10_ai@7.0.0-canary.154_zod@4.4.3_/node_modules/experimental-ai-sdk-code-mode/dist/telemetry.js +0 -1
  86. package/dist/src/node_modules/.pnpm/experimental-ai-sdk-code-mode@1.0.10_ai@7.0.0-canary.154_zod@4.4.3_/node_modules/experimental-ai-sdk-code-mode/dist/tool-invocation.js +0 -1
  87. package/dist/src/node_modules/.pnpm/experimental-ai-sdk-code-mode@1.0.10_ai@7.0.0-canary.154_zod@4.4.3_/node_modules/experimental-ai-sdk-code-mode/dist/tool-prompt.js +0 -9
  88. package/dist/src/node_modules/.pnpm/quickjs-emscripten-core@0.32.0/node_modules/quickjs-emscripten-core/dist/chunk-TAV5CUKK.js +0 -1
  89. package/dist/src/node_modules/.pnpm/quickjs-emscripten-core@0.32.0/node_modules/quickjs-emscripten-core/dist/chunk-V2S4ZYJR.js +0 -6
  90. package/dist/src/node_modules/.pnpm/quickjs-emscripten-core@0.32.0/node_modules/quickjs-emscripten-core/dist/index.js +0 -1
  91. package/dist/src/node_modules/.pnpm/quickjs-emscripten-core@0.32.0/node_modules/quickjs-emscripten-core/dist/module-ES6BEMUI.js +0 -1
  92. package/dist/src/node_modules/.pnpm/quickjs-emscripten-core@0.32.0/node_modules/quickjs-emscripten-core/dist/module-asyncify-2EFITU5U.js +0 -1
  93. package/dist/src/node_modules/.pnpm/quickjs-emscripten@0.32.0/node_modules/quickjs-emscripten/dist/chunk-OHAYRCBA.js +0 -1
  94. package/dist/src/node_modules/.pnpm/quickjs-emscripten@0.32.0/node_modules/quickjs-emscripten/dist/index.js +0 -1
  95. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/index.js +0 -1
  96. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/checks.js +0 -1
  97. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/coerce.js +0 -1
  98. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/compat.js +0 -1
  99. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js +0 -1
  100. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js +0 -1
  101. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/from-json-schema.js +0 -1
  102. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.js +0 -1
  103. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js +0 -1
  104. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js +0 -1
  105. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js +0 -1
  106. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.js +0 -1
  107. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js +0 -1
  108. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/doc.js +0 -3
  109. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js +0 -2
  110. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/index.js +0 -1
  111. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-generator.js +0 -1
  112. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js +0 -1
  113. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema.js +0 -1
  114. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js +0 -1
  115. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.js +0 -1
  116. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.js +0 -1
  117. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.js +0 -60
  118. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js +0 -3
  119. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js +0 -1
  120. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js +0 -1
  121. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ar.js +0 -1
  122. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/az.js +0 -1
  123. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/be.js +0 -1
  124. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/bg.js +0 -1
  125. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ca.js +0 -1
  126. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/cs.js +0 -1
  127. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/da.js +0 -1
  128. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/de.js +0 -1
  129. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/el.js +0 -1
  130. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/en.js +0 -1
  131. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/eo.js +0 -1
  132. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/es.js +0 -1
  133. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/fa.js +0 -1
  134. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/fi.js +0 -1
  135. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/fr-CA.js +0 -1
  136. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/fr.js +0 -1
  137. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/he.js +0 -1
  138. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/hr.js +0 -1
  139. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/hu.js +0 -1
  140. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/hy.js +0 -1
  141. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/id.js +0 -1
  142. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/index.js +0 -1
  143. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/is.js +0 -1
  144. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/it.js +0 -1
  145. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ja.js +0 -1
  146. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ka.js +0 -1
  147. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/kh.js +0 -1
  148. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/km.js +0 -1
  149. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ko.js +0 -1
  150. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/lt.js +0 -1
  151. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/mk.js +0 -1
  152. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ms.js +0 -1
  153. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/nl.js +0 -1
  154. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/no.js +0 -1
  155. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ota.js +0 -1
  156. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/pl.js +0 -1
  157. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ps.js +0 -1
  158. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/pt.js +0 -1
  159. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ro.js +0 -1
  160. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ru.js +0 -1
  161. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/sl.js +0 -1
  162. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/sv.js +0 -1
  163. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ta.js +0 -1
  164. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/th.js +0 -1
  165. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/tr.js +0 -1
  166. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ua.js +0 -1
  167. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/uk.js +0 -1
  168. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ur.js +0 -1
  169. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/uz.js +0 -1
  170. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/vi.js +0 -1
  171. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/yo.js +0 -1
  172. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/zh-CN.js +0 -1
  173. package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/zh-TW.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # experimental-ash
2
2
 
3
+ ## 0.38.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e157d85: Tool approval callbacks now receive schema-typed `toolInput`, and raw
8
+ `defineChannel` calls can advertise typed cross-channel receive args.
9
+
10
+ ### Patch Changes
11
+
12
+ - 6563a08: Fix flaky `HookConflictError` in the driver loop by using SDK-generated hook tokens for turn completion instead of explicit deterministic tokens that could collide during handler re-entry.
13
+ - 1a962b8: Rename `AshCallbackContext` to `SessionContext` and export a new `ChannelContext<TCtx>` type from `defineChannel`. `ToolContext` and `HookContext` are unchanged aliases that now extend `SessionContext`.
14
+ - f243a3e: Vendor the code-mode runtime and only include its inline worker assets in hosted function bundles when `CODE_MODE=1`.
15
+
3
16
  ## 0.37.0
4
17
 
5
18
  ### Minor Changes
@@ -6,7 +6,7 @@ The architecture is a three-layer split:
6
6
  - **The harness** does one unit of AI work and returns `{ session, next }`.
7
7
  - **The runtime** persists state, follows `next`, streams events, and owns workflow primitives.
8
8
 
9
- All runtime state flows through a single `AshContext` bound by one `AsyncLocalStorage`. Authored code should not know anything about workflow orchestration.
9
+ All runtime state flows through a single `AlsContext` bound by one `AsyncLocalStorage`. Authored code should not know anything about workflow orchestration.
10
10
 
11
11
  ## Start Here
12
12
 
@@ -1,13 +1,13 @@
1
1
  # Unified Context
2
2
 
3
- Ash uses a single `AshContext` container bound by one `AsyncLocalStorage` instance. No secondary storage, no custom dehydration, no out-of-band parameter passing.
3
+ Ash uses a single `AlsContext` container bound by one `AsyncLocalStorage` instance. No secondary storage, no custom dehydration, no out-of-band parameter passing.
4
4
 
5
5
  ## Core Model
6
6
 
7
7
  `ContextContainer` holds a durable map and a virtual overlay. Reads check the virtual overlay first, then the durable map. Writes always target the durable map.
8
8
 
9
9
  ```ts
10
- interface AshContext {
10
+ interface AlsContext {
11
11
  get<T>(key: ContextKey<T>): T | undefined;
12
12
  require<T>(key: ContextKey<T>): T;
13
13
  has<T>(key: ContextKey<T>): boolean;
@@ -26,7 +26,7 @@ ContextReader { get, require, has }
26
26
  ↑ extends
27
27
  ContextAccessor { set, ensure }
28
28
  ↑ extends
29
- AshContext { entries() }
29
+ AlsContext { entries() }
30
30
  ```
31
31
 
32
32
  ## Seed Keys
@@ -14,7 +14,7 @@ That is why authored identifiers are derived from paths. A file path is a single
14
14
  source of truth; a repeated `name` field is a second source that can drift.
15
15
 
16
16
  The hooks surface (`agent/hooks/`) deliberately reuses the unified
17
- `AshContext` rather than introducing a parallel state-patch channel:
17
+ `AlsContext` rather than introducing a parallel state-patch channel:
18
18
  hooks read and write through `ctx` like every other authored function.
19
19
  One context, one set of keys, one place to look when debugging.
20
20
 
@@ -36,7 +36,7 @@ and easier to fork accidentally.
36
36
 
37
37
  ## Context Is A Single Ambient Contract
38
38
 
39
- Ash uses one `AshContext` container for runtime state. Seed keys carry
39
+ Ash uses one `AlsContext` container for runtime state. Seed keys carry
40
40
  serializable values across step boundaries; providers derive values for the
41
41
  current step. Additional `AsyncLocalStorage` instances or hidden dehydration
42
42
  protocols create parallel contracts that agents and humans must rediscover.
@@ -17,10 +17,10 @@ inside the agent" and "extension contributed by a plugin": both flow
17
17
  through one runtime registry, one `HookContext`, one set of ordering
18
18
  rules.
19
19
 
20
- The hooks surface deliberately reuses the unified `AshContext`:
21
- `HookContext` extends `AshCallbackContext`, giving hooks the same
20
+ The hooks surface deliberately reuses the unified `AlsContext`:
21
+ `HookContext` extends `SessionContext`, giving hooks the same
22
22
  context surface tools, providers, and channels get. There is no
23
- parallel state-patch channel — one `AshContext`, one set of keys, one
23
+ parallel state-patch channel — one `AlsContext`, one set of keys, one
24
24
  place to look when debugging.
25
25
 
26
26
  `HookContext` carries `agent`, `channel`, and `session` (which includes
@@ -200,5 +200,5 @@ documented expectations:
200
200
 
201
201
  - [Hooks](../public/hooks.md) — author-facing reference
202
202
  - [Discovery](./discovery.md) — discovery layout and the unified slot walker
203
- - [Unified Context](./context.md) — `AshContext` surface shared by hooks
203
+ - [Unified Context](./context.md) — `AlsContext` surface shared by hooks
204
204
  - [Message Runtime](./message-runtime.md) — runtime stream events
@@ -88,7 +88,7 @@ invariant is enforced structurally by the `runStep` ALS-scope split
88
88
  ### One Ambient Context Contract
89
89
 
90
90
  Do not introduce additional `new AsyncLocalStorage()` instances for Ash runtime
91
- state. Ambient state should flow through the single `AshContext` container and
91
+ state. Ambient state should flow through the single `AlsContext` container and
92
92
  its provider/seed model.
93
93
 
94
94
  Enforcement target: a source-shape test that allowlists the context storage
@@ -165,10 +165,10 @@ export default defineHook({
165
165
 
166
166
  ### API
167
167
 
168
- | Method | Description |
169
- | ------------ | -------------------------------------------------------------------------------- |
170
- | `get()` | Read the current value. Returns `initial()` on first access. Throws outside ALS. |
171
- | `update(fn)` | Apply a function to the current value. Throws outside ALS. |
168
+ | Method | Description |
169
+ | ------------ | ------------------------------------------------------------------------------------------ |
170
+ | `get()` | Read the current value. Returns `initial()` on first access. Throws outside managed scope. |
171
+ | `update(fn)` | Apply a function to the current value. Throws outside managed scope. |
172
172
 
173
173
  ## Where These APIs Work
174
174
 
@@ -189,20 +189,18 @@ explaining the required scope.
189
189
 
190
190
  ## How It Works
191
191
 
192
- All runtime accessors read from the same `AshContext` container bound by a single `AsyncLocalStorage`.
193
- The framework sets up this context before invoking authored code:
192
+ The framework sets up a context container before invoking authored code:
194
193
 
195
- 1. The runtime entry point creates an `AshContext` and populates durable seed keys (auth, session
196
- ID, compiled bundle).
197
- 2. Before each step, providers create virtual step-local values (session metadata, sandbox access,
198
- skill access) from the current context.
199
- 3. The step callback runs inside the `AsyncLocalStorage` scope, making the context available to
200
- all authored code in the call chain.
201
- 4. After the step, framework providers with provider-owned mutable state (for example the sandbox)
202
- commit those changes back onto the harness session.
194
+ 1. The runtime populates durable seed values (auth, session ID, compiled bundle).
195
+ 2. Before each step, the framework derives step-local values (session metadata, sandbox access,
196
+ skill access) from the durable state.
197
+ 3. Authored code runs inside the managed scope, so `ctx` and `defineState` accessors resolve
198
+ automatically.
199
+ 4. After the step, the framework commits mutable state (for example sandbox changes) back to
200
+ the durable session.
203
201
 
204
- This lifecycle is fully managed by the framework. Authored code only needs to call the public
205
- accessors.
202
+ This lifecycle is fully managed by the framework. Authored code only needs to use `ctx` and
203
+ the public accessors.
206
204
 
207
205
  ## What To Read Next
208
206
 
@@ -3,7 +3,7 @@ import type { RouteHandler, SendFn } from "#channel/routes.js";
3
3
  import type { Session } from "#channel/session.js";
4
4
  import type { SessionAuthContext } from "#channel/types.js";
5
5
  export declare const CHANNEL_SENTINEL: "ash:channel";
6
- export interface CompiledChannel<TState = undefined> {
6
+ export interface CompiledChannel<TState = undefined, TReceiveArgs = Record<string, unknown>> {
7
7
  readonly __kind: typeof CHANNEL_SENTINEL;
8
8
  readonly routes: readonly {
9
9
  method: string;
@@ -13,7 +13,7 @@ export interface CompiledChannel<TState = undefined> {
13
13
  readonly adapter: ChannelAdapter<any>;
14
14
  readonly receive?: (input: {
15
15
  readonly message: string;
16
- readonly args: Readonly<Record<string, unknown>>;
16
+ readonly args: Readonly<TReceiveArgs>;
17
17
  readonly auth: SessionAuthContext | null;
18
18
  }, args: {
19
19
  send: SendFn<TState>;
@@ -248,7 +248,7 @@ export interface Runtime {
248
248
  * Starts a new run from a flat platform-shape input.
249
249
  *
250
250
  * The runtime loads the compiled bundle (using the node id
251
- * baked in at construction time), builds the seeded {@link AshContext},
251
+ * baked in at construction time), builds the seeded {@link AlsContext},
252
252
  * and drives the step loop to completion.
253
253
  */
254
254
  run(input: RunInput): Promise<RunHandle>;
@@ -6,6 +6,7 @@
6
6
  "@chat-adapter/state-memory": "4.29.0",
7
7
  "chokidar": "5.0.0",
8
8
  "commander": "14.0.3",
9
+ "experimental-ai-sdk-code-mode": "1.0.10",
9
10
  "@ai-sdk/google": "4.0.0-canary.73",
10
11
  "gray-matter": "4.0.3",
11
12
  "jose": "6.2.3",
@@ -26,5 +27,5 @@
26
27
  "zod": "4.4.3",
27
28
  "zod-validation-error": "5.0.0"
28
29
  },
29
- "scriptHash": "de60e990328c8664beec98bc5e81625ecdc0cdace1ba8bd8aa267bf9bea29af4"
30
+ "scriptHash": "6a2fa642d99a77617cbfb4e0dc7bbbd774c22d880ea5726a09069c812896bfdd"
30
31
  }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vercel Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,144 @@
1
+ import type { ModelMessage, ToolSet } from "ai";
2
+
3
+ export interface CodeModeInterruptPayload {
4
+ readonly kind?: string;
5
+ readonly [key: string]: unknown;
6
+ }
7
+
8
+ export interface CodeModeContinuation {
9
+ readonly outerToolCallId: string;
10
+ readonly [key: string]: unknown;
11
+ }
12
+
13
+ export interface CodeModePendingContinuation<
14
+ Payload extends CodeModeInterruptPayload = CodeModeInterruptPayload,
15
+ > {
16
+ readonly continuation: CodeModeContinuation;
17
+ readonly interrupt: CodeModeInterruptCore<Payload>;
18
+ readonly type: "code-mode-pending-continuation";
19
+ readonly [key: string]: unknown;
20
+ }
21
+
22
+ export interface CodeModeInterruptCore<
23
+ Payload extends CodeModeInterruptPayload = CodeModeInterruptPayload,
24
+ > {
25
+ readonly continuation: CodeModeContinuation;
26
+ readonly interruptId: string;
27
+ readonly payload: Payload;
28
+ readonly type: "code-mode-interrupt";
29
+ }
30
+
31
+ export interface CodeModeInterrupt<
32
+ Payload extends CodeModeInterruptPayload = CodeModeInterruptPayload,
33
+ > extends CodeModeInterruptCore<Payload> {
34
+ readonly pendingContinuation: CodeModePendingContinuation<Payload>;
35
+ }
36
+
37
+ export interface CodeModeApprovalInterrupt {
38
+ readonly approvalId: string;
39
+ readonly continuation: CodeModeContinuation;
40
+ readonly toolCallId: string;
41
+ readonly toolName: string;
42
+ readonly type: "code-mode-approval-required";
43
+ }
44
+
45
+ export interface CodeModeInterruptExecutionContext<
46
+ Payload extends CodeModeInterruptPayload = CodeModeInterruptPayload,
47
+ Resolution = unknown,
48
+ > {
49
+ readonly interruptId: string;
50
+ readonly payload: Payload;
51
+ readonly resolution: Resolution;
52
+ }
53
+
54
+ export interface CodeModeNestedToolCallEvent {
55
+ readonly bridgeIndex: number;
56
+ readonly input: unknown;
57
+ readonly inputBytes: number;
58
+ readonly invocationId: string;
59
+ readonly outerToolCallId: string;
60
+ readonly replayed?: boolean;
61
+ readonly startedAtMs: number;
62
+ readonly toolCallId: string;
63
+ readonly toolName: string;
64
+ }
65
+
66
+ export interface CodeModeNestedToolResultEvent {
67
+ readonly bridgeIndex: number;
68
+ readonly completedAtMs: number;
69
+ readonly durationMs: number;
70
+ readonly error?: unknown;
71
+ readonly input: unknown;
72
+ readonly inputBytes: number;
73
+ readonly invocationId: string;
74
+ readonly outerToolCallId: string;
75
+ readonly output?: unknown;
76
+ readonly outputBytes?: number;
77
+ readonly replayed?: boolean;
78
+ readonly startedAtMs: number;
79
+ readonly status: "fulfilled" | "rejected" | "interrupted" | "approval-required";
80
+ readonly toolCallId: string;
81
+ readonly toolName: string;
82
+ }
83
+
84
+ export interface CodeModeLifecycleHookErrorEvent {
85
+ readonly event: unknown;
86
+ readonly hook: string;
87
+ }
88
+
89
+ export interface CodeModeOptions {
90
+ readonly approval?: {
91
+ readonly mode: "interrupt";
92
+ };
93
+ readonly lifecycle?: {
94
+ readonly onHookError?: (
95
+ error: unknown,
96
+ event: CodeModeLifecycleHookErrorEvent,
97
+ ) => void | Promise<void>;
98
+ readonly onInterrupt?: (event: unknown) => void | Promise<void>;
99
+ readonly onNestedToolCall?: (event: CodeModeNestedToolCallEvent) => void | Promise<void>;
100
+ readonly onNestedToolResult?: (event: CodeModeNestedToolResultEvent) => void | Promise<void>;
101
+ };
102
+ }
103
+
104
+ export interface CodeModeUnwrappedResult {
105
+ readonly interrupt?: CodeModeInterrupt | CodeModeApprovalInterrupt;
106
+ readonly output?: unknown;
107
+ readonly status: "completed" | "interrupted";
108
+ }
109
+
110
+ export class CodeModeProtocolError extends Error {
111
+ readonly code: "CODE_MODE_PROTOCOL_ERROR";
112
+ readonly details?: unknown;
113
+ constructor(message: string, details?: unknown);
114
+ }
115
+
116
+ export function createCodeModeTool(tools: ToolSet, options?: CodeModeOptions): unknown;
117
+ export function continueCodeModeApproval(input: {
118
+ readonly approvalResponse: unknown;
119
+ readonly interrupt: CodeModeApprovalInterrupt;
120
+ readonly options?: CodeModeOptions;
121
+ readonly tools: ToolSet;
122
+ }): Promise<unknown>;
123
+ export function continueCodeModeInterrupt(input: {
124
+ readonly interrupt: CodeModeInterrupt;
125
+ readonly resolution: unknown;
126
+ readonly options?: CodeModeOptions;
127
+ readonly tools: ToolSet;
128
+ }): Promise<unknown>;
129
+ export function getCodeModeApprovalResponse(
130
+ messages: readonly ModelMessage[],
131
+ interrupt: CodeModeApprovalInterrupt,
132
+ ): unknown | undefined;
133
+ export function getCodeModeInterrupt(value: unknown): CodeModeInterrupt | undefined;
134
+ export function isCodeModeApprovalInterrupt(value: unknown): value is CodeModeApprovalInterrupt;
135
+ export function replaceCodeModeInterruptResult(
136
+ messages: readonly ModelMessage[],
137
+ pending: CodeModePendingContinuation,
138
+ finalOutput: unknown,
139
+ ): ModelMessage[];
140
+ export function requestCodeModeInterrupt(payload: CodeModeInterruptPayload): never;
141
+ export function toCodeModeApprovalMessages(
142
+ interrupt: CodeModeApprovalInterrupt,
143
+ ): readonly ModelMessage[];
144
+ export function unwrapCodeModeResult(value: unknown): CodeModeUnwrappedResult;