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.
- package/CHANGELOG.md +13 -0
- package/dist/docs/internals/README.md +1 -1
- package/dist/docs/internals/context.md +3 -3
- package/dist/docs/internals/core-beliefs.md +2 -2
- package/dist/docs/internals/hooks.md +4 -4
- package/dist/docs/internals/mechanical-invariants.md +1 -1
- package/dist/docs/public/advanced/session-context.md +14 -16
- package/dist/src/channel/compiled-channel.d.ts +2 -2
- package/dist/src/channel/types.d.ts +1 -1
- package/dist/src/compiled/.vendor-stamp.json +2 -1
- package/dist/src/compiled/experimental-ai-sdk-code-mode/LICENSE +21 -0
- package/dist/src/compiled/experimental-ai-sdk-code-mode/index.d.ts +144 -0
- package/dist/src/compiled/experimental-ai-sdk-code-mode/index.js +482 -0
- package/dist/src/compiled/experimental-ai-sdk-code-mode/package.json +7 -0
- package/dist/src/context/build-callback-context.d.ts +3 -3
- package/dist/src/context/container.d.ts +5 -5
- package/dist/src/context/key.d.ts +1 -1
- package/dist/src/context/serialize.d.ts +2 -2
- package/dist/src/execution/tool-compaction.d.ts +1 -1
- package/dist/src/execution/workflow-entry.js +1 -1
- package/dist/src/harness/code-mode-approval.d.ts +1 -1
- package/dist/src/harness/code-mode-approval.js +1 -1
- package/dist/src/harness/code-mode-connection-auth-state.d.ts +1 -1
- package/dist/src/harness/code-mode-lifecycle.d.ts +1 -1
- package/dist/src/harness/code-mode.d.ts +3 -6
- package/dist/src/harness/code-mode.js +1 -1
- package/dist/src/harness/tool-loop.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/nitro/host/code-mode-runtime-dependency-plugin.js +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/workflow-bundle/builder.js +2 -2
- package/dist/src/packages/ash-scaffold/src/channels.js +1 -1
- package/dist/src/public/channels/discord/discordChannel.d.ts +3 -4
- package/dist/src/public/channels/slack/slackChannel.d.ts +3 -4
- package/dist/src/public/channels/teams/teamsChannel.d.ts +3 -4
- package/dist/src/public/channels/telegram/telegramChannel.d.ts +3 -4
- package/dist/src/public/channels/twilio/twilioChannel.d.ts +3 -4
- package/dist/src/public/context/index.d.ts +1 -1
- package/dist/src/public/definitions/callback-context.d.ts +1 -1
- package/dist/src/public/definitions/defineChannel.d.ts +23 -16
- package/dist/src/public/definitions/hook.d.ts +3 -3
- package/dist/src/public/definitions/tool.d.ts +8 -6
- package/dist/src/public/tools/approval/approval-helpers.d.ts +3 -3
- package/dist/src/public/tools/index.d.ts +1 -1
- package/dist/src/runtime/connections/authorization-tokens.d.ts +3 -3
- package/dist/src/runtime/connections/principal.d.ts +3 -3
- package/dist/src/runtime/framework-tools/code-mode-connection-auth.d.ts +1 -1
- package/dist/src/runtime/framework-tools/connection-search.js +1 -1
- package/dist/src/runtime/framework-tools/connection-tools.js +1 -1
- package/dist/src/runtime/framework-tools/file-state.d.ts +2 -2
- package/dist/src/runtime/resolve-connection.d.ts +1 -1
- package/dist/src/sandbox/state.d.ts +1 -1
- package/dist/src/shared/code-mode.d.ts +8 -0
- package/dist/src/shared/code-mode.js +1 -1
- package/package.json +3 -4
- package/dist/src/node_modules/.pnpm/@jitl_quickjs-ffi-types@0.32.0/node_modules/@jitl/quickjs-ffi-types/dist/index.js +0 -1
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/dist/src/node_modules/.pnpm/quickjs-emscripten-core@0.32.0/node_modules/quickjs-emscripten-core/dist/chunk-TAV5CUKK.js +0 -1
- package/dist/src/node_modules/.pnpm/quickjs-emscripten-core@0.32.0/node_modules/quickjs-emscripten-core/dist/chunk-V2S4ZYJR.js +0 -6
- package/dist/src/node_modules/.pnpm/quickjs-emscripten-core@0.32.0/node_modules/quickjs-emscripten-core/dist/index.js +0 -1
- package/dist/src/node_modules/.pnpm/quickjs-emscripten-core@0.32.0/node_modules/quickjs-emscripten-core/dist/module-ES6BEMUI.js +0 -1
- package/dist/src/node_modules/.pnpm/quickjs-emscripten-core@0.32.0/node_modules/quickjs-emscripten-core/dist/module-asyncify-2EFITU5U.js +0 -1
- package/dist/src/node_modules/.pnpm/quickjs-emscripten@0.32.0/node_modules/quickjs-emscripten/dist/chunk-OHAYRCBA.js +0 -1
- package/dist/src/node_modules/.pnpm/quickjs-emscripten@0.32.0/node_modules/quickjs-emscripten/dist/index.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/index.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/checks.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/coerce.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/compat.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/from-json-schema.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/doc.js +0 -3
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js +0 -2
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/index.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-generator.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.js +0 -60
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js +0 -3
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ar.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/az.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/be.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/bg.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ca.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/cs.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/da.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/de.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/el.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/en.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/eo.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/es.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/fa.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/fi.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/fr-CA.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/fr.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/he.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/hr.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/hu.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/hy.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/id.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/index.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/is.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/it.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ja.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ka.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/kh.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/km.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ko.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/lt.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/mk.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ms.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/nl.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/no.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ota.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/pl.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ps.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/pt.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ro.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ru.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/sl.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/sv.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ta.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/th.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/tr.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ua.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/uk.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ur.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/uz.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/vi.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/yo.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/zh-CN.js +0 -1
- 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 `
|
|
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 `
|
|
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
|
|
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
|
-
|
|
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
|
-
`
|
|
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 `
|
|
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 `
|
|
21
|
-
`HookContext` extends `
|
|
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 `
|
|
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) — `
|
|
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 `
|
|
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
|
|
171
|
-
| `update(fn)` | Apply a function to the current value. Throws outside
|
|
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
|
-
|
|
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
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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
|
|
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<
|
|
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
|
|
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": "
|
|
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;
|