experimental-ash 0.28.0 → 0.29.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 (345) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +1 -0
  3. package/dist/docs/internals/hooks.md +1 -1
  4. package/dist/docs/public/cli-build-and-debugging.md +2 -0
  5. package/dist/docs/public/getting-started.md +1 -0
  6. package/dist/src/channel/adapter.js +1 -1
  7. package/dist/src/channel/compiled-channel.js +1 -1
  8. package/dist/src/channel/http.js +1 -1
  9. package/dist/src/channel/schedule.js +1 -1
  10. package/dist/src/channel/send.js +1 -1
  11. package/dist/src/channel/session-callback.js +1 -1
  12. package/dist/src/channel/session.js +1 -1
  13. package/dist/src/cli/commands/channels.js +1 -1
  14. package/dist/src/cli/dev/environment.js +1 -1
  15. package/dist/src/cli/dev/input-requests.js +1 -1
  16. package/dist/src/cli/dev/repl.js +1 -1
  17. package/dist/src/cli/dev/terminal.js +1 -1
  18. package/dist/src/cli/dev/url.js +1 -1
  19. package/dist/src/cli/run.d.ts +9 -0
  20. package/dist/src/cli/run.js +1 -1
  21. package/dist/src/compiler/artifacts.js +1 -1
  22. package/dist/src/compiler/manifest.js +1 -1
  23. package/dist/src/compiler/model-catalog.js +1 -1
  24. package/dist/src/compiler/module-map.js +1 -1
  25. package/dist/src/compiler/normalize-subagent.js +1 -1
  26. package/dist/src/compiler/remote-agent-node.js +1 -1
  27. package/dist/src/compiler/workspace-resources.js +1 -1
  28. package/dist/src/context/accessors.js +1 -1
  29. package/dist/src/context/container.js +1 -1
  30. package/dist/src/context/hook-lifecycle.d.ts +3 -3
  31. package/dist/src/context/hook-lifecycle.js +1 -1
  32. package/dist/src/context/key.js +1 -1
  33. package/dist/src/context/keys.d.ts +31 -10
  34. package/dist/src/context/keys.js +1 -1
  35. package/dist/src/context/node.js +1 -1
  36. package/dist/src/context/providers/connection.js +1 -1
  37. package/dist/src/context/providers/sandbox.js +1 -1
  38. package/dist/src/context/providers/session.js +1 -1
  39. package/dist/src/context/run-step.js +1 -1
  40. package/dist/src/context/serialize.js +1 -1
  41. package/dist/src/discover/connections.js +1 -1
  42. package/dist/src/discover/diagnostics.js +1 -1
  43. package/dist/src/discover/discover-subagent.js +1 -1
  44. package/dist/src/discover/filesystem.js +1 -1
  45. package/dist/src/discover/grammar.js +1 -1
  46. package/dist/src/discover/lib.js +1 -1
  47. package/dist/src/discover/manifest.js +1 -1
  48. package/dist/src/discover/sandbox.js +1 -1
  49. package/dist/src/discover/schedules.js +1 -1
  50. package/dist/src/discover/skills.js +1 -1
  51. package/dist/src/evals/runner/discover.js +1 -1
  52. package/dist/src/evals/runner/execute-suite.js +1 -1
  53. package/dist/src/evals/runner/reporters/braintrust.js +1 -1
  54. package/dist/src/evals/scores/index.js +1 -1
  55. package/dist/src/execution/await-authorization-orchestrator.js +1 -1
  56. package/dist/src/execution/connection-auth-steps.js +1 -1
  57. package/dist/src/execution/runtime-context.d.ts +1 -1
  58. package/dist/src/execution/runtime-context.js +1 -1
  59. package/dist/src/execution/sandbox/bindings/local.js +1 -1
  60. package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
  61. package/dist/src/execution/sandbox/glob-tool.js +1 -1
  62. package/dist/src/execution/sandbox/grep-tool.js +1 -1
  63. package/dist/src/execution/sandbox/prewarm.d.ts +12 -2
  64. package/dist/src/execution/sandbox/prewarm.js +1 -1
  65. package/dist/src/execution/sandbox/read-file-tool.js +1 -1
  66. package/dist/src/execution/sandbox/require-sandbox.js +1 -1
  67. package/dist/src/execution/sandbox/ripgrep-probe.js +1 -1
  68. package/dist/src/execution/sandbox/truncate-output.js +1 -1
  69. package/dist/src/execution/session-callback-step.js +1 -1
  70. package/dist/src/execution/session.js +1 -1
  71. package/dist/src/execution/subagent-adapter.js +1 -1
  72. package/dist/src/execution/tool-compaction.js +1 -1
  73. package/dist/src/execution/turn-workflow.js +1 -1
  74. package/dist/src/execution/web-fetch/html.js +1 -1
  75. package/dist/src/execution/web-fetch/tool.js +1 -1
  76. package/dist/src/execution/workflow-entry.js +1 -1
  77. package/dist/src/execution/workflow-runtime.js +1 -1
  78. package/dist/src/execution/workflow-steps.js +1 -1
  79. package/dist/src/harness/attachment-staging.js +1 -1
  80. package/dist/src/harness/compaction.js +2 -2
  81. package/dist/src/harness/emission.js +1 -1
  82. package/dist/src/harness/input-requests.js +1 -1
  83. package/dist/src/harness/instrumentation-config.js +1 -1
  84. package/dist/src/harness/model-call-error.js +1 -1
  85. package/dist/src/harness/otel-integration.js +1 -1
  86. package/dist/src/harness/prompt-cache.js +1 -1
  87. package/dist/src/harness/provider-tools.js +1 -1
  88. package/dist/src/harness/proxy-input-requests.js +1 -1
  89. package/dist/src/harness/runtime-actions.js +1 -1
  90. package/dist/src/harness/step-hooks.js +1 -1
  91. package/dist/src/harness/tool-loop.js +1 -1
  92. package/dist/src/harness/tool-result-pruning.js +1 -1
  93. package/dist/src/internal/application/cache-metadata.js +1 -1
  94. package/dist/src/internal/application/compiled-artifacts.js +1 -1
  95. package/dist/src/internal/application/import-specifier.js +1 -1
  96. package/dist/src/internal/application/package.js +1 -1
  97. package/dist/src/internal/attachments/refs.js +1 -1
  98. package/dist/src/internal/attachments/sandbox-refs.js +1 -1
  99. package/dist/src/internal/attachments/url-refs.js +1 -1
  100. package/dist/src/internal/authored-asset-import-plugin.js +1 -1
  101. package/dist/src/internal/authored-definition/connection.js +1 -1
  102. package/dist/src/internal/authored-module-loader.js +1 -1
  103. package/dist/src/internal/authored-package-tsconfig-paths.js +1 -1
  104. package/dist/src/internal/bundler/nitro-rolldown.js +1 -1
  105. package/dist/src/internal/helpers/markdown.js +2 -2
  106. package/dist/src/internal/json-schema.js +1 -1
  107. package/dist/src/internal/logging.js +1 -1
  108. package/dist/src/internal/nitro/host/channel-routes.js +1 -1
  109. package/dist/src/internal/nitro/host/compiled-sandbox-backend-prune-plugin.js +1 -1
  110. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  111. package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
  112. package/dist/src/internal/nitro/host/schedule-task-routes.js +1 -1
  113. package/dist/src/internal/nitro/host/server-external-packages.js +1 -1
  114. package/dist/src/internal/nitro/host/start-development-server.js +1 -1
  115. package/dist/src/internal/nitro/host/start-production-server.d.ts +8 -0
  116. package/dist/src/internal/nitro/host/start-production-server.js +3 -0
  117. package/dist/src/internal/nitro/host/types.d.ts +8 -0
  118. package/dist/src/internal/nitro/host.d.ts +2 -1
  119. package/dist/src/internal/nitro/host.js +1 -1
  120. package/dist/src/internal/nitro/routes/agent-info/load-agent-info-data.js +1 -1
  121. package/dist/src/internal/nitro/routes/index.js +3 -3
  122. package/dist/src/internal/nitro/routes/workflow-route-helpers.js +1 -1
  123. package/dist/src/internal/node-esm-compat-banner.js +1 -1
  124. package/dist/src/internal/package-name.js +1 -1
  125. package/dist/src/internal/vercel-agent-summary.js +1 -1
  126. package/dist/src/internal/workflow-bundle/ash-service-route-output.js +1 -1
  127. package/dist/src/internal/workflow-bundle/builder-support.js +1 -1
  128. package/dist/src/internal/workflow-bundle/builder.js +2 -2
  129. package/dist/src/internal/workflow-bundle/vercel-workflow-output.js +1 -1
  130. package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
  131. package/dist/src/internal/workflow-bundle/workflow-core-shim.js +1 -1
  132. package/dist/src/internal/workflow-bundle/workflow-transformer.js +1 -1
  133. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/ajv.js +1 -1
  134. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/code.js +1 -1
  135. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/index.js +2 -2
  136. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/scope.js +1 -1
  137. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/errors.js +1 -1
  138. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/index.js +1 -1
  139. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/names.js +1 -1
  140. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/ref_error.js +1 -1
  141. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js +1 -1
  142. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js +1 -1
  143. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/util.js +1 -1
  144. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js +1 -1
  145. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js +2 -2
  146. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/defaults.js +1 -1
  147. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/index.js +1 -1
  148. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/keyword.js +1 -1
  149. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/subschema.js +1 -1
  150. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/core.js +1 -1
  151. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/equal.js +1 -1
  152. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/uri.js +1 -1
  153. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +1 -1
  154. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +1 -1
  155. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js +1 -1
  156. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/contains.js +1 -1
  157. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +2 -2
  158. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/if.js +1 -1
  159. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/index.js +1 -1
  160. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items.js +1 -1
  161. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js +1 -1
  162. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/not.js +1 -1
  163. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +1 -1
  164. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +1 -1
  165. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +1 -1
  166. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/properties.js +1 -1
  167. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +1 -1
  168. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +1 -1
  169. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/code.js +1 -1
  170. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/index.js +1 -1
  171. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js +1 -1
  172. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/index.js +1 -1
  173. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/draft7.js +1 -1
  174. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/format.js +1 -1
  175. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/const.js +1 -1
  176. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/enum.js +1 -1
  177. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/index.js +1 -1
  178. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js +1 -1
  179. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js +1 -1
  180. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +1 -1
  181. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +1 -1
  182. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +1 -1
  183. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/pattern.js +1 -1
  184. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js +1 -1
  185. package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +1 -1
  186. package/dist/src/node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/index.js +1 -1
  187. package/dist/src/node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/lib/schemes.js +1 -1
  188. package/dist/src/node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/lib/utils.js +1 -1
  189. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/_vendor/partial-json-parser/parser.js +2 -2
  190. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/auth/workload-identity-auth.js +1 -1
  191. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/azure.js +1 -1
  192. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/client.js +2 -2
  193. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/detect-platform.js +1 -1
  194. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/errors.js +1 -1
  195. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/headers.js +1 -1
  196. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/qs/formats.js +1 -1
  197. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/qs/stringify.js +1 -1
  198. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/qs/utils.js +1 -1
  199. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/request-options.js +1 -1
  200. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/to-file.js +1 -1
  201. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/uploads.js +1 -1
  202. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/utils/base64.js +1 -1
  203. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/utils/bytes.js +1 -1
  204. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/utils/env.js +1 -1
  205. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/utils/log.js +1 -1
  206. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/utils/path.js +1 -1
  207. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/utils/sleep.js +1 -1
  208. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/utils/uuid.js +1 -1
  209. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/utils/values.js +1 -1
  210. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/AbstractChatCompletionRunner.js +1 -1
  211. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/Util.js +1 -1
  212. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/chatCompletionUtils.js +1 -1
  213. package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/version.js +1 -1
  214. package/dist/src/node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Options.js +1 -1
  215. package/dist/src/node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Refs.js +1 -1
  216. package/dist/src/node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js +1 -1
  217. package/dist/src/node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parseDef.js +1 -1
  218. package/dist/src/node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js +1 -1
  219. package/dist/src/node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/date.js +1 -1
  220. package/dist/src/node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js +1 -1
  221. package/dist/src/node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js +1 -1
  222. package/dist/src/node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js +1 -1
  223. package/dist/src/node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js +1 -1
  224. package/dist/src/node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +1 -1
  225. package/dist/src/node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/union.js +1 -1
  226. package/dist/src/node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/selectParser.js +1 -1
  227. package/dist/src/node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js +1 -1
  228. package/dist/src/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js +1 -1
  229. package/dist/src/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js +1 -1
  230. package/dist/src/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js +1 -1
  231. package/dist/src/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js +1 -1
  232. package/dist/src/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js +1 -1
  233. package/dist/src/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js +1 -1
  234. package/dist/src/packages/ash-scaffold/src/channels.js +2 -2
  235. package/dist/src/packages/ash-scaffold/src/module-files.js +1 -1
  236. package/dist/src/protocol/message.js +1 -1
  237. package/dist/src/protocol/routes.js +1 -1
  238. package/dist/src/public/channels/ash.js +2 -2
  239. package/dist/src/public/channels/auth.js +1 -1
  240. package/dist/src/public/channels/discord/api.js +1 -1
  241. package/dist/src/public/channels/discord/defaults.js +1 -1
  242. package/dist/src/public/channels/discord/discordChannel.js +1 -1
  243. package/dist/src/public/channels/discord/hitl.js +1 -1
  244. package/dist/src/public/channels/discord/inbound.js +1 -1
  245. package/dist/src/public/channels/discord/verify.js +1 -1
  246. package/dist/src/public/channels/discord/verifyInbound.js +1 -1
  247. package/dist/src/public/channels/slack/api.js +1 -1
  248. package/dist/src/public/channels/slack/attachments.js +1 -1
  249. package/dist/src/public/channels/slack/constants.js +1 -1
  250. package/dist/src/public/channels/slack/defaults.js +2 -2
  251. package/dist/src/public/channels/slack/hitl.js +1 -1
  252. package/dist/src/public/channels/slack/interactions.js +1 -1
  253. package/dist/src/public/channels/slack/limits.js +1 -1
  254. package/dist/src/public/channels/slack/mrkdwn.js +1 -1
  255. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  256. package/dist/src/public/channels/slack/verify.js +1 -1
  257. package/dist/src/public/channels/teams/api.js +1 -1
  258. package/dist/src/public/channels/teams/attachments.js +1 -1
  259. package/dist/src/public/channels/teams/defaults.js +1 -1
  260. package/dist/src/public/channels/teams/hitl.js +1 -1
  261. package/dist/src/public/channels/teams/inbound.js +1 -1
  262. package/dist/src/public/channels/teams/limits.js +1 -1
  263. package/dist/src/public/channels/teams/teamsChannel.js +1 -1
  264. package/dist/src/public/channels/teams/verify.js +1 -1
  265. package/dist/src/public/channels/telegram/api.js +1 -1
  266. package/dist/src/public/channels/telegram/attachments.js +1 -1
  267. package/dist/src/public/channels/telegram/defaults.js +1 -1
  268. package/dist/src/public/channels/telegram/hitl.js +1 -1
  269. package/dist/src/public/channels/telegram/inbound.js +1 -1
  270. package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
  271. package/dist/src/public/channels/telegram/verify.js +1 -1
  272. package/dist/src/public/channels/twilio/defaults.js +1 -1
  273. package/dist/src/public/channels/twilio/inbound.js +1 -1
  274. package/dist/src/public/channels/twilio/twilioChannel.js +1 -1
  275. package/dist/src/public/channels/twilio/verify.js +1 -1
  276. package/dist/src/public/channels/upload-policy.js +1 -1
  277. package/dist/src/public/definitions/channel.js +1 -1
  278. package/dist/src/public/definitions/tool.js +1 -1
  279. package/dist/src/public/next/index.js +1 -1
  280. package/dist/src/public/next/server.js +1 -1
  281. package/dist/src/public/next/vercel-json.js +1 -1
  282. package/dist/src/public/tool-result-narrowing.js +1 -1
  283. package/dist/src/public/tools/defaults.js +1 -1
  284. package/dist/src/react/use-ash-agent.js +1 -1
  285. package/dist/src/runtime/actions/types.js +1 -1
  286. package/dist/src/runtime/agent/bootstrap-model-utils.js +1 -1
  287. package/dist/src/runtime/agent/bootstrap-model.js +1 -1
  288. package/dist/src/runtime/agent/bootstrap.js +1 -1
  289. package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
  290. package/dist/src/runtime/cache-key.js +1 -1
  291. package/dist/src/runtime/channels/registry.js +1 -1
  292. package/dist/src/runtime/connections/authorization-tokens.js +1 -1
  293. package/dist/src/runtime/connections/callback-route.js +1 -1
  294. package/dist/src/runtime/connections/principal-context.js +1 -1
  295. package/dist/src/runtime/connections/principal.js +1 -1
  296. package/dist/src/runtime/framework-channels/index.js +1 -1
  297. package/dist/src/runtime/framework-tools/ask-question.js +1 -1
  298. package/dist/src/runtime/framework-tools/bash.js +1 -1
  299. package/dist/src/runtime/framework-tools/connection-search.js +1 -1
  300. package/dist/src/runtime/framework-tools/file-state.js +1 -1
  301. package/dist/src/runtime/framework-tools/glob.js +1 -1
  302. package/dist/src/runtime/framework-tools/grep.js +1 -1
  303. package/dist/src/runtime/framework-tools/index.js +1 -1
  304. package/dist/src/runtime/framework-tools/pending-connection-tool-calls.js +1 -1
  305. package/dist/src/runtime/framework-tools/read-file.js +1 -1
  306. package/dist/src/runtime/framework-tools/skill.js +1 -1
  307. package/dist/src/runtime/framework-tools/todo.js +2 -2
  308. package/dist/src/runtime/framework-tools/web-fetch.js +1 -1
  309. package/dist/src/runtime/framework-tools/web-search.js +1 -1
  310. package/dist/src/runtime/framework-tools/write-file.js +1 -1
  311. package/dist/src/runtime/governance/auth/jwt-ecdsa.js +1 -1
  312. package/dist/src/runtime/governance/auth/oidc.js +1 -1
  313. package/dist/src/runtime/governance/auth/token-claims.js +1 -1
  314. package/dist/src/runtime/graph.js +1 -1
  315. package/dist/src/runtime/input/types.js +1 -1
  316. package/dist/src/runtime/loaders/bundled-artifacts.d.ts +12 -0
  317. package/dist/src/runtime/loaders/bundled-artifacts.js +1 -1
  318. package/dist/src/runtime/loaders/compile-metadata.js +1 -1
  319. package/dist/src/runtime/loaders/manifest.js +1 -1
  320. package/dist/src/runtime/loaders/module-map.js +1 -1
  321. package/dist/src/runtime/prompt/compose.js +2 -2
  322. package/dist/src/runtime/prompt/connections.js +1 -1
  323. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  324. package/dist/src/runtime/resolve-hook.js +1 -1
  325. package/dist/src/runtime/sandbox/keys.js +1 -1
  326. package/dist/src/runtime/sandbox/registry.js +1 -1
  327. package/dist/src/runtime/schedules/register.js +1 -1
  328. package/dist/src/runtime/session-callback-route.js +1 -1
  329. package/dist/src/runtime/sessions/auth.js +1 -1
  330. package/dist/src/runtime/sessions/compiled-agent-cache.js +1 -1
  331. package/dist/src/runtime/sessions/runtime-context-keys.d.ts +11 -0
  332. package/dist/src/runtime/sessions/runtime-context-keys.js +1 -0
  333. package/dist/src/runtime/sessions/runtime-session.js +1 -1
  334. package/dist/src/runtime/skills/fragment-context.js +1 -1
  335. package/dist/src/runtime/skills/sandbox-access.js +1 -1
  336. package/dist/src/runtime/subagents/registry.js +1 -1
  337. package/dist/src/runtime/workspace/types.js +1 -1
  338. package/dist/src/services/dev-client/request-headers.js +1 -1
  339. package/dist/src/services/dev-client/vercel-auth-error.js +1 -1
  340. package/dist/src/shared/json-schemas.js +1 -1
  341. package/dist/src/shared/json.js +1 -1
  342. package/dist/src/shared/skill-package.js +1 -1
  343. package/package.json +1 -1
  344. package/dist/src/context/seed-keys.d.ts +0 -39
  345. package/dist/src/context/seed-keys.js +0 -1
@@ -1 +1 @@
1
- import{getKnownByteLength}from"#internal/attachments/data.js";var DEFAULT_UPLOAD_POLICY=Object.freeze({allowedMediaTypes:`*`,maxBytes:25*1024*1024});function mergeUploadPolicy(e,n=DEFAULT_UPLOAD_POLICY){if(e===`disabled`)return`disabled`;if(e===void 0)return n;let r=e.maxBytes??n.maxBytes,i=e.allowedMediaTypes??n.allowedMediaTypes;if(r<0||!Number.isFinite(r))throw RangeError(`UploadPolicy.maxBytes must be a non-negative finite number. Received: ${String(r)}.`);return{allowedMediaTypes:i,maxBytes:r}}function isUploadsDisabled(e){return!!(e===`disabled`||e.maxBytes===0||Array.isArray(e.allowedMediaTypes)&&e.allowedMediaTypes.length===0)}function isMediaTypeAllowed(e,t){if(t===`disabled`)return!1;if(t.allowedMediaTypes===`*`)return!0;let n=e.toLowerCase();for(let e of t.allowedMediaTypes){let t=e.toLowerCase();if(t===n)return!0;if(t.endsWith(`/*`)){let e=t.slice(0,-1);if(n.startsWith(e))return!0}}return!1}function evaluateFilePart(t,n){if(n===`disabled`||!isMediaTypeAllowed(t.mediaType,n)){let e={allowedMediaTypes:n===`disabled`||n.allowedMediaTypes===`*`?[]:[...n.allowedMediaTypes],kind:`disallowed-media-type`,mediaType:t.mediaType};return t.filename===void 0?e:{...e,filename:t.filename}}let r=getKnownByteLength(t.data);if(r!==null&&r>n.maxBytes){let e={byteLength:r,kind:`too-large`,limit:n.maxBytes,mediaType:t.mediaType};return t.filename===void 0?e:{...e,filename:t.filename}}return null}function collectUploadPolicyViolations(e,t){if(typeof e==`string`)return[];let n=[];for(let r of e){if(r.type!==`file`)continue;let e=evaluateFilePart(r,t);e!==null&&n.push(e)}return n}function stripDisallowedFileParts(e,t){return typeof e==`string`?e:e.filter(e=>e.type===`file`?evaluateFilePart(e,t)===null:!0)}function formatUploadPolicyViolation(e){let t=e.filename??e.mediaType;if(e.kind===`too-large`)return`${t} (${e.byteLength} bytes) exceeds the ${e.limit}-byte upload limit.`;let n=e.allowedMediaTypes.length>0?` Allowed: ${e.allowedMediaTypes.join(`, `)}.`:``;return`${t} has media type "${e.mediaType}" which is not allowed by this route.${n}`}export{DEFAULT_UPLOAD_POLICY,collectUploadPolicyViolations,evaluateFilePart,formatUploadPolicyViolation,isMediaTypeAllowed,isUploadsDisabled,mergeUploadPolicy,stripDisallowedFileParts};
1
+ import{getKnownByteLength}from"#internal/attachments/data.js";const DEFAULT_UPLOAD_POLICY=Object.freeze({allowedMediaTypes:`*`,maxBytes:25*1024*1024});function mergeUploadPolicy(e,n=DEFAULT_UPLOAD_POLICY){if(e===`disabled`)return`disabled`;if(e===void 0)return n;let r=e.maxBytes??n.maxBytes,i=e.allowedMediaTypes??n.allowedMediaTypes;if(r<0||!Number.isFinite(r))throw RangeError(`UploadPolicy.maxBytes must be a non-negative finite number. Received: ${String(r)}.`);return{allowedMediaTypes:i,maxBytes:r}}function isUploadsDisabled(e){return!!(e===`disabled`||e.maxBytes===0||Array.isArray(e.allowedMediaTypes)&&e.allowedMediaTypes.length===0)}function isMediaTypeAllowed(e,t){if(t===`disabled`)return!1;if(t.allowedMediaTypes===`*`)return!0;let n=e.toLowerCase();for(let e of t.allowedMediaTypes){let t=e.toLowerCase();if(t===n)return!0;if(t.endsWith(`/*`)){let e=t.slice(0,-1);if(n.startsWith(e))return!0}}return!1}function evaluateFilePart(t,n){if(n===`disabled`||!isMediaTypeAllowed(t.mediaType,n)){let e={allowedMediaTypes:n===`disabled`||n.allowedMediaTypes===`*`?[]:[...n.allowedMediaTypes],kind:`disallowed-media-type`,mediaType:t.mediaType};return t.filename===void 0?e:{...e,filename:t.filename}}let r=getKnownByteLength(t.data);if(r!==null&&r>n.maxBytes){let e={byteLength:r,kind:`too-large`,limit:n.maxBytes,mediaType:t.mediaType};return t.filename===void 0?e:{...e,filename:t.filename}}return null}function collectUploadPolicyViolations(e,t){if(typeof e==`string`)return[];let n=[];for(let r of e){if(r.type!==`file`)continue;let e=evaluateFilePart(r,t);e!==null&&n.push(e)}return n}function stripDisallowedFileParts(e,t){return typeof e==`string`?e:e.filter(e=>e.type===`file`?evaluateFilePart(e,t)===null:!0)}function formatUploadPolicyViolation(e){let t=e.filename??e.mediaType;if(e.kind===`too-large`)return`${t} (${e.byteLength} bytes) exceeds the ${e.limit}-byte upload limit.`;let n=e.allowedMediaTypes.length>0?` Allowed: ${e.allowedMediaTypes.join(`, `)}.`:``;return`${t} has media type "${e.mediaType}" which is not allowed by this route.${n}`}export{DEFAULT_UPLOAD_POLICY,collectUploadPolicyViolations,evaluateFilePart,formatUploadPolicyViolation,isMediaTypeAllowed,isUploadsDisabled,mergeUploadPolicy,stripDisallowedFileParts};
@@ -1 +1 @@
1
- var DISABLED_ROUTE_SENTINEL_KIND=`ash:disabled-channel`;function disableRoute(){return{kind:DISABLED_ROUTE_SENTINEL_KIND}}function isDisabledRouteSentinel(e){return typeof e==`object`&&!!e&&e.kind===DISABLED_ROUTE_SENTINEL_KIND}export{disableRoute,isDisabledRouteSentinel};
1
+ const DISABLED_ROUTE_SENTINEL_KIND=`ash:disabled-channel`;function disableRoute(){return{kind:DISABLED_ROUTE_SENTINEL_KIND}}function isDisabledRouteSentinel(e){return typeof e==`object`&&!!e&&e.kind===DISABLED_ROUTE_SENTINEL_KIND}export{disableRoute,isDisabledRouteSentinel};
@@ -1 +1 @@
1
- import{stampDefinitionKey}from"#public/tool-result-narrowing.js";function defineTool(t){return stampDefinitionKey(t,`tool:${t.description}`),t}var DISABLED_TOOL_SENTINEL_KIND=`ash:disabled-tool`;function disableTool(){return{kind:DISABLED_TOOL_SENTINEL_KIND}}function isDisabledToolSentinel(e){return typeof e==`object`&&!!e&&e.kind===DISABLED_TOOL_SENTINEL_KIND}export{defineTool,disableTool,isDisabledToolSentinel};
1
+ import{stampDefinitionKey}from"#public/tool-result-narrowing.js";function defineTool(t){return stampDefinitionKey(t,`tool:${t.description}`),t}const DISABLED_TOOL_SENTINEL_KIND=`ash:disabled-tool`;function disableTool(){return{kind:DISABLED_TOOL_SENTINEL_KIND}}function isDisabledToolSentinel(e){return typeof e==`object`&&!!e&&e.kind===DISABLED_TOOL_SENTINEL_KIND}export{defineTool,disableTool,isDisabledToolSentinel};
@@ -1 +1 @@
1
- import{resolveAshDestinationPrefix}from"./server.js";import{ensureAshVercelJson}from"./vercel-json.js";import{ASH_ROUTE_PREFIX}from"#protocol/routes.js";import{isAbsolute,resolve}from"node:path";var ASH_NEXT_SERVICE_PREFIX=`/_ash_internal/ash`,ASH_NEXT_PRODUCTION_ORIGIN_ENV=`ASH_NEXT_PRODUCTION_ORIGIN`,ASH_NEXT_PRODUCTION_PORT_ENV=`ASH_NEXT_PRODUCTION_PORT`,DEFAULT_ASH_BUILD_COMMAND=`ash build`,DEFAULT_ASH_NEXT_PRODUCTION_PORT=4274,ASH_PROXY_REWRITE_SOURCES=[`${ASH_ROUTE_PREFIX}/:path+`];function resolveApplicationRoot(e){return e===void 0||e.length===0?process.cwd():isAbsolute(e)?e:resolve(process.cwd(),e)}function normalizeRoutePrefix(e){let t=(e.startsWith(`/`)?e:`/${e}`).replace(/\/+$/,``);if(t.length===0)throw Error(`Ash Next.js service prefix cannot resolve to the root route.`);return t}function joinRoutePrefix(e,t){return`${e.replace(/\/+$/,``)}/${t.replace(/^\/+/,``)}`}function normalizeOrigin(e){return new URL(e.trim()).origin}function readLocalProductionPort(){let e=process.env[ASH_NEXT_PRODUCTION_PORT_ENV];if(e===void 0||e.trim().length===0)return DEFAULT_ASH_NEXT_PRODUCTION_PORT;let t=Number.parseInt(e,10);if(String(t)!==e.trim()||t<1||t>65535)throw Error(`${ASH_NEXT_PRODUCTION_PORT_ENV} must be an integer between 1 and 65535.`);return t}function resolveProductionDestination(e){if(process.env.VERCEL)return{destinationPrefix:e};let t=process.env[ASH_NEXT_PRODUCTION_ORIGIN_ENV];if(t!==void 0&&t.trim().length>0)return{destinationPrefix:joinRoutePrefix(normalizeOrigin(t),e)};let n=`http://127.0.0.1:${String(readLocalProductionPort())}`;return{destinationPrefix:n,localServerOrigin:n}}function createAshRewriteRules(e){return ASH_PROXY_REWRITE_SOURCES.map(t=>({destination:joinRoutePrefix(e,t),source:t}))}async function resolveExistingRewrites(e){return await e?.()}function mergeRewriteRules(e,t){return e===void 0?{beforeFiles:t}:isRewriteSections(e)?{...e,beforeFiles:[...t,...e.beforeFiles??[]]}:{afterFiles:e,beforeFiles:t}}function isRewriteSections(e){return!Array.isArray(e)}async function resolveNextConfig(e,t,n){return typeof e==`function`?await e(t,n):e}function withAsh(n,r={}){let i=process.cwd(),a=resolveApplicationRoot(r.ashRoot),o=normalizeRoutePrefix(r.servicePrefix??`/_ash_internal/ash`),s=r.configureVercelJson!==!1;return async function(c,l){let u=await resolveNextConfig(n,c,l),d=u.rewrites,f=resolveProductionDestination((s?await ensureAshVercelJson({appRoot:a,ashBuildCommand:r.ashBuildCommand??DEFAULT_ASH_BUILD_COMMAND,nextRoot:i,servicePrefix:o}):{servicePrefix:o}).servicePrefix);return{...u,async rewrites(){let[t,n]=await Promise.all([resolveExistingRewrites(d),resolveAshDestinationPrefix({appRoot:a,phase:c,productionDestinationPrefix:f.destinationPrefix,productionServerOrigin:f.localServerOrigin})]);return mergeRewriteRules(t,createAshRewriteRules(n))}}}}export{ASH_NEXT_SERVICE_PREFIX,withAsh};
1
+ import{resolveAshDestinationPrefix}from"./server.js";import{ensureAshVercelJson}from"./vercel-json.js";import{ASH_ROUTE_PREFIX}from"#protocol/routes.js";import{isAbsolute,resolve}from"node:path";const ASH_NEXT_SERVICE_PREFIX=`/_ash_internal/ash`,ASH_NEXT_PRODUCTION_PORT_ENV=`ASH_NEXT_PRODUCTION_PORT`,ASH_PROXY_REWRITE_SOURCES=[`${ASH_ROUTE_PREFIX}/:path+`];function resolveApplicationRoot(e){return e===void 0||e.length===0?process.cwd():isAbsolute(e)?e:resolve(process.cwd(),e)}function normalizeRoutePrefix(e){let t=(e.startsWith(`/`)?e:`/${e}`).replace(/\/+$/,``);if(t.length===0)throw Error(`Ash Next.js service prefix cannot resolve to the root route.`);return t}function joinRoutePrefix(e,t){return`${e.replace(/\/+$/,``)}/${t.replace(/^\/+/,``)}`}function normalizeOrigin(e){return new URL(e.trim()).origin}function readLocalProductionPort(){let e=process.env[ASH_NEXT_PRODUCTION_PORT_ENV];if(e===void 0||e.trim().length===0)return 4274;let t=Number.parseInt(e,10);if(String(t)!==e.trim()||t<1||t>65535)throw Error(`${ASH_NEXT_PRODUCTION_PORT_ENV} must be an integer between 1 and 65535.`);return t}function resolveProductionDestination(e){if(process.env.VERCEL)return{destinationPrefix:e};let t=process.env.ASH_NEXT_PRODUCTION_ORIGIN;if(t!==void 0&&t.trim().length>0)return{destinationPrefix:joinRoutePrefix(normalizeOrigin(t),e)};let n=`http://127.0.0.1:${String(readLocalProductionPort())}`;return{destinationPrefix:n,localServerOrigin:n}}function createAshRewriteRules(e){return ASH_PROXY_REWRITE_SOURCES.map(t=>({destination:joinRoutePrefix(e,t),source:t}))}async function resolveExistingRewrites(e){return await e?.()}function mergeRewriteRules(e,t){return e===void 0?{beforeFiles:t}:isRewriteSections(e)?{...e,beforeFiles:[...t,...e.beforeFiles??[]]}:{afterFiles:e,beforeFiles:t}}function isRewriteSections(e){return!Array.isArray(e)}async function resolveNextConfig(e,t,n){return typeof e==`function`?await e(t,n):e}function withAsh(n,r={}){let i=process.cwd(),a=resolveApplicationRoot(r.ashRoot),o=normalizeRoutePrefix(r.servicePrefix??`/_ash_internal/ash`),s=r.configureVercelJson!==!1;return async function(c,l){let u=await resolveNextConfig(n,c,l),d=u.rewrites,f=resolveProductionDestination((s?await ensureAshVercelJson({appRoot:a,ashBuildCommand:r.ashBuildCommand??`ash build`,nextRoot:i,servicePrefix:o}):{servicePrefix:o}).servicePrefix);return{...u,async rewrites(){let[t,n]=await Promise.all([resolveExistingRewrites(d),resolveAshDestinationPrefix({appRoot:a,phase:c,productionDestinationPrefix:f.destinationPrefix,productionServerOrigin:f.localServerOrigin})]);return mergeRewriteRules(t,createAshRewriteRules(n))}}}}export{ASH_NEXT_SERVICE_PREFIX,withAsh};
@@ -1 +1 @@
1
- import{ASH_ROUTE_PREFIX}from"#protocol/routes.js";import{join}from"node:path";import{mkdir,open,readFile,rm,stat,writeFile}from"node:fs/promises";import{existsSync}from"node:fs";import{resolvePackageRoot}from"#internal/application/package.js";import{spawn}from"node:child_process";var ASH_BASE_URL_ENV=`ASH_BASE_URL`,DEFAULT_SERVER_READY_TIMEOUT_MS=3e4,DEV_SERVER_REGISTRY_TIMEOUT_MS=3e4,DEV_SERVER_REGISTRY_POLL_MS=100,DEV_SERVER_STALE_LOCK_MS=3e4,ASH_CACHE_DIRECTORY_NAME=`.ash`,ASH_NEXT_DEV_SERVER_FILE_NAME=`next-dev-server.json`,ASH_NEXT_DEV_SERVER_LOCK_FILE_NAME=`next-dev-server.lock`,LOCAL_SERVER_URL_PATTERN=/https?:\/\/(?:\[[^\]\s]+\]|[^\s/:[\]]+)(?::\d+)?/,NEXT_PHASE_PRODUCTION_BUILD=`phase-production-build`,globalStateSymbol=Symbol.for(`experimental-ash.next.state`);function getGlobalState(){let e=globalThis;return e[globalStateSymbol]??={servers:new Map},e[globalStateSymbol]}function joinRoutePrefix(e,t){return`${e.replace(/\/+$/,``)}/${t.replace(/^\/+/,``)}`}function normalizeOrigin(e){return new URL(e).origin}function readAshBaseUrlEnvironment(){let e=process.env[ASH_BASE_URL_ENV];if(!(e===void 0||e.trim().length===0))return normalizeOrigin(e)}function isNodeErrorWithCode(e,t){return e instanceof Error&&`code`in e&&e.code===t}function delay(e){return new Promise(t=>setTimeout(t,e))}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function resolveAshCacheDirectory(e){return join(e,ASH_CACHE_DIRECTORY_NAME)}function resolveAshDevServerRegistryPath(e){return join(resolveAshCacheDirectory(e),ASH_NEXT_DEV_SERVER_FILE_NAME)}function resolveAshDevServerLockPath(e){return join(resolveAshCacheDirectory(e),ASH_NEXT_DEV_SERVER_LOCK_FILE_NAME)}function normalizeDevServerRegistry(e){if(isRecord(e)&&!(typeof e.appRoot!=`string`||typeof e.origin!=`string`||typeof e.updatedAt!=`string`)&&!(e.pid!==null&&typeof e.pid!=`number`))try{return{appRoot:e.appRoot,origin:normalizeOrigin(e.origin),pid:e.pid,updatedAt:e.updatedAt}}catch{return}}async function isAshServerHealthy(t){let n=new AbortController,r=setTimeout(()=>{n.abort()},1e3);try{return(await fetch(joinRoutePrefix(t,`${ASH_ROUTE_PREFIX}/health`),{signal:n.signal})).ok}catch{return!1}finally{clearTimeout(r)}}async function readUsableAshDevServerRegistry(e){try{let t=normalizeDevServerRegistry(JSON.parse(await readFile(resolveAshDevServerRegistryPath(e),`utf8`)));return t===void 0||t.appRoot!==e||!await isAshServerHealthy(t.origin)?void 0:(process.env[ASH_BASE_URL_ENV]=t.origin,t.origin)}catch(e){if(isNodeErrorWithCode(e,`ENOENT`))return;throw e}}async function writeAshDevServerRegistry(e,t){await mkdir(resolveAshCacheDirectory(e),{recursive:!0}),await writeFile(resolveAshDevServerRegistryPath(e),`${JSON.stringify({appRoot:e,origin:t.origin,pid:t.process?.pid??null,updatedAt:new Date().toISOString()},null,2)}\n`)}async function removeStaleAshDevServerLock(e){try{let t=await stat(e);Date.now()-t.mtimeMs>DEV_SERVER_STALE_LOCK_MS&&await rm(e,{force:!0})}catch(e){if(!isNodeErrorWithCode(e,`ENOENT`))throw e}}async function acquireAshDevServerLock(e){let t=resolveAshCacheDirectory(e),i=resolveAshDevServerLockPath(e),a=Date.now()+DEV_SERVER_REGISTRY_TIMEOUT_MS;for(await mkdir(t,{recursive:!0});;)try{let e=await open(i,`wx`);return await e.writeFile(`${String(process.pid)}\n`),await e.close(),async()=>{await rm(i,{force:!0})}}catch(t){if(!isNodeErrorWithCode(t,`EEXIST`))throw t;if(await readUsableAshDevServerRegistry(e)!==void 0)return async()=>{};if(await removeStaleAshDevServerLock(i),Date.now()>a)throw Error(`Timed out after ${DEV_SERVER_REGISTRY_TIMEOUT_MS}ms waiting for another Next.js process to start Ash.`);await delay(DEV_SERVER_REGISTRY_POLL_MS)}}function createAshBinaryPath(){return join(resolvePackageRoot(),`bin`,`ash.js`)}function normalizeParsedOrigin(e){return new URL(e).origin}function startServerProcess(e){return new Promise((t,n)=>{let r=spawn(e.command,e.args,{cwd:e.cwd,env:{...process.env,...e.env},stdio:[`ignore`,`pipe`,`pipe`]}),i=setTimeout(()=>{r.kill(),n(Error(`Timed out after ${e.timeoutMs??DEFAULT_SERVER_READY_TIMEOUT_MS}ms waiting for Ash to print its server URL.`))},e.timeoutMs??DEFAULT_SERVER_READY_TIMEOUT_MS),cleanup=()=>{clearTimeout(i),r.off(`error`,handleError),r.off(`exit`,handleEarlyExit)},handleError=e=>{cleanup(),n(e)},handleEarlyExit=(e,t)=>{cleanup(),n(Error(`Ash server process exited before printing its server URL (code ${String(e)}, signal ${String(t)}).`))},handleOutput=e=>{let n=LOCAL_SERVER_URL_PATTERN.exec(e.toString(`utf8`));n!==null&&(cleanup(),t({origin:normalizeParsedOrigin(n[0]),process:r}))};r.once(`error`,handleError),r.once(`exit`,handleEarlyExit),r.stdout.on(`data`,e=>{process.stdout.write(e),handleOutput(e)}),r.stderr.on(`data`,e=>{process.stderr.write(e),handleOutput(e)})})}function installProcessShutdown(e){let t=e.process;if(t===void 0)return e;let close=()=>{t.killed||t.kill()};return process.once(`beforeExit`,close),process.once(`exit`,close),e}function startAshDevServer(e){return startServerProcess({args:[createAshBinaryPath(),`dev`,`--no-repl`,`--port`,`0`],command:process.execPath,cwd:e}).then(e=>(process.env[ASH_BASE_URL_ENV]=e.origin,installProcessShutdown(e)))}function startAshProductionServer(e){let n=new URL(e.origin),r=n.port,i=join(e.appRoot,`.output`,`server`,`index.mjs`);if(existsSync(i))return startServerProcess({args:[i],command:process.execPath,cwd:e.appRoot,env:{HOST:n.hostname,NITRO_HOST:n.hostname,NITRO_PORT:r,PORT:r}}).then(installProcessShutdown)}async function resolveSharedAshDevServer(e){let t=await readUsableAshDevServerRegistry(e);if(t!==void 0)return{origin:t};let n=await acquireAshDevServerLock(e);try{let t=await readUsableAshDevServerRegistry(e);if(t!==void 0)return{origin:t};let n=await startAshDevServer(e);return await writeAshDevServerRegistry(e,n),n}finally{await n()}}async function resolveAshDestinationPrefix(e){let t=getGlobalState();if(process.env.NODE_ENV===`production`){if(e.phase===NEXT_PHASE_PRODUCTION_BUILD)return e.productionDestinationPrefix;let n=`production:${e.appRoot}`,r=t.servers.get(n);return r===void 0&&(r=process.env.VERCEL||e.productionServerOrigin===void 0?void 0:startAshProductionServer({appRoot:e.appRoot,origin:e.productionServerOrigin}),r!==void 0&&(r=r.catch(e=>{throw t.servers.delete(n),e}),t.servers.set(n,r))),r===void 0?e.productionDestinationPrefix:(await r).origin}let n=readAshBaseUrlEnvironment();if(n!==void 0)return n;if(process.env.NODE_ENV!==`development`)return e.productionDestinationPrefix;let r=`dev:${e.appRoot}`,i=t.servers.get(r);return i===void 0&&(i=resolveSharedAshDevServer(e.appRoot).catch(e=>{throw t.servers.delete(r),e}),t.servers.set(r,i)),(await i).origin}export{resolveAshDestinationPrefix};
1
+ import{ASH_ROUTE_PREFIX}from"#protocol/routes.js";import{join}from"node:path";import{mkdir,open,readFile,rm,stat,writeFile}from"node:fs/promises";import{existsSync}from"node:fs";import{resolvePackageRoot}from"#internal/application/package.js";import{spawn}from"node:child_process";const ASH_BASE_URL_ENV=`ASH_BASE_URL`,DEFAULT_SERVER_READY_TIMEOUT_MS=3e4,DEV_SERVER_REGISTRY_TIMEOUT_MS=3e4,LOCAL_SERVER_URL_PATTERN=/https?:\/\/(?:\[[^\]\s]+\]|[^\s/:[\]]+)(?::\d+)?/,globalStateSymbol=Symbol.for(`experimental-ash.next.state`);function getGlobalState(){let e=globalThis;return e[globalStateSymbol]??={servers:new Map},e[globalStateSymbol]}function joinRoutePrefix(e,t){return`${e.replace(/\/+$/,``)}/${t.replace(/^\/+/,``)}`}function normalizeOrigin(e){return new URL(e).origin}function readAshBaseUrlEnvironment(){let e=process.env[ASH_BASE_URL_ENV];if(!(e===void 0||e.trim().length===0))return normalizeOrigin(e)}function isNodeErrorWithCode(e,t){return e instanceof Error&&`code`in e&&e.code===t}function delay(e){return new Promise(t=>setTimeout(t,e))}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function resolveAshCacheDirectory(e){return join(e,`.ash`)}function resolveAshDevServerRegistryPath(e){return join(resolveAshCacheDirectory(e),`next-dev-server.json`)}function resolveAshDevServerLockPath(e){return join(resolveAshCacheDirectory(e),`next-dev-server.lock`)}function normalizeDevServerRegistry(e){if(isRecord(e)&&!(typeof e.appRoot!=`string`||typeof e.origin!=`string`||typeof e.updatedAt!=`string`)&&!(e.pid!==null&&typeof e.pid!=`number`))try{return{appRoot:e.appRoot,origin:normalizeOrigin(e.origin),pid:e.pid,updatedAt:e.updatedAt}}catch{return}}async function isAshServerHealthy(t){let n=new AbortController,r=setTimeout(()=>{n.abort()},1e3);try{return(await fetch(joinRoutePrefix(t,`${ASH_ROUTE_PREFIX}/health`),{signal:n.signal})).ok}catch{return!1}finally{clearTimeout(r)}}async function readUsableAshDevServerRegistry(e){try{let t=normalizeDevServerRegistry(JSON.parse(await readFile(resolveAshDevServerRegistryPath(e),`utf8`)));return t===void 0||t.appRoot!==e||!await isAshServerHealthy(t.origin)?void 0:(process.env[ASH_BASE_URL_ENV]=t.origin,t.origin)}catch(e){if(isNodeErrorWithCode(e,`ENOENT`))return;throw e}}async function writeAshDevServerRegistry(e,t){await mkdir(resolveAshCacheDirectory(e),{recursive:!0}),await writeFile(resolveAshDevServerRegistryPath(e),`${JSON.stringify({appRoot:e,origin:t.origin,pid:t.process?.pid??null,updatedAt:new Date().toISOString()},null,2)}\n`)}async function removeStaleAshDevServerLock(e){try{let t=await stat(e);Date.now()-t.mtimeMs>3e4&&await rm(e,{force:!0})}catch(e){if(!isNodeErrorWithCode(e,`ENOENT`))throw e}}async function acquireAshDevServerLock(e){let t=resolveAshCacheDirectory(e),i=resolveAshDevServerLockPath(e),a=Date.now()+DEV_SERVER_REGISTRY_TIMEOUT_MS;for(await mkdir(t,{recursive:!0});;)try{let e=await open(i,`wx`);return await e.writeFile(`${String(process.pid)}\n`),await e.close(),async()=>{await rm(i,{force:!0})}}catch(t){if(!isNodeErrorWithCode(t,`EEXIST`))throw t;if(await readUsableAshDevServerRegistry(e)!==void 0)return async()=>{};if(await removeStaleAshDevServerLock(i),Date.now()>a)throw Error(`Timed out after ${DEV_SERVER_REGISTRY_TIMEOUT_MS}ms waiting for another Next.js process to start Ash.`);await delay(100)}}function createAshBinaryPath(){return join(resolvePackageRoot(),`bin`,`ash.js`)}function normalizeParsedOrigin(e){return new URL(e).origin}function startServerProcess(e){return new Promise((t,n)=>{let r=spawn(e.command,e.args,{cwd:e.cwd,env:{...process.env,...e.env},stdio:[`ignore`,`pipe`,`pipe`]}),i=setTimeout(()=>{r.kill(),n(Error(`Timed out after ${e.timeoutMs??DEFAULT_SERVER_READY_TIMEOUT_MS}ms waiting for Ash to print its server URL.`))},e.timeoutMs??DEFAULT_SERVER_READY_TIMEOUT_MS),cleanup=()=>{clearTimeout(i),r.off(`error`,handleError),r.off(`exit`,handleEarlyExit)},handleError=e=>{cleanup(),n(e)},handleEarlyExit=(e,t)=>{cleanup(),n(Error(`Ash server process exited before printing its server URL (code ${String(e)}, signal ${String(t)}).`))},handleOutput=e=>{let n=LOCAL_SERVER_URL_PATTERN.exec(e.toString(`utf8`));n!==null&&(cleanup(),t({origin:normalizeParsedOrigin(n[0]),process:r}))};r.once(`error`,handleError),r.once(`exit`,handleEarlyExit),r.stdout.on(`data`,e=>{process.stdout.write(e),handleOutput(e)}),r.stderr.on(`data`,e=>{process.stderr.write(e),handleOutput(e)})})}function installProcessShutdown(e){let t=e.process;if(t===void 0)return e;let close=()=>{t.killed||t.kill()};return process.once(`beforeExit`,close),process.once(`exit`,close),e}function startAshDevServer(e){return startServerProcess({args:[createAshBinaryPath(),`dev`,`--no-repl`,`--port`,`0`],command:process.execPath,cwd:e}).then(e=>(process.env[ASH_BASE_URL_ENV]=e.origin,installProcessShutdown(e)))}function startAshProductionServer(e){let n=new URL(e.origin),r=n.port,i=join(e.appRoot,`.output`,`server`,`index.mjs`);if(existsSync(i))return startServerProcess({args:[i],command:process.execPath,cwd:e.appRoot,env:{HOST:n.hostname,NITRO_HOST:n.hostname,NITRO_PORT:r,PORT:r}}).then(installProcessShutdown)}async function resolveSharedAshDevServer(e){let t=await readUsableAshDevServerRegistry(e);if(t!==void 0)return{origin:t};let n=await acquireAshDevServerLock(e);try{let t=await readUsableAshDevServerRegistry(e);if(t!==void 0)return{origin:t};let n=await startAshDevServer(e);return await writeAshDevServerRegistry(e,n),n}finally{await n()}}async function resolveAshDestinationPrefix(e){let t=getGlobalState();if(process.env.NODE_ENV===`production`){if(e.phase===`phase-production-build`)return e.productionDestinationPrefix;let n=`production:${e.appRoot}`,r=t.servers.get(n);return r===void 0&&(r=process.env.VERCEL||e.productionServerOrigin===void 0?void 0:startAshProductionServer({appRoot:e.appRoot,origin:e.productionServerOrigin}),r!==void 0&&(r=r.catch(e=>{throw t.servers.delete(n),e}),t.servers.set(n,r))),r===void 0?e.productionDestinationPrefix:(await r).origin}let n=readAshBaseUrlEnvironment();if(n!==void 0)return n;if(process.env.NODE_ENV!==`development`)return e.productionDestinationPrefix;let r=`dev:${e.appRoot}`,i=t.servers.get(r);return i===void 0&&(i=resolveSharedAshDevServer(e.appRoot).catch(e=>{throw t.servers.delete(r),e}),t.servers.set(r,i)),(await i).origin}export{resolveAshDestinationPrefix};
@@ -1 +1 @@
1
- import{join,relative}from"node:path";import{readFile,writeFile}from"node:fs/promises";var VERCEL_JSON_FILE_NAME=`vercel.json`,VERCEL_JSON_SCHEMA=`https://openapi.vercel.sh/vercel.json`;function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function resolveRelativeEntrypoint(e,n){let r=relative(e,n);return r.length===0?`.`:r.replaceAll(`\\`,`/`)}function normalizeVercelJsonConfig(e){if(!isRecord(e))throw Error(`${VERCEL_JSON_FILE_NAME} must contain a JSON object.`);let t=e.experimentalServices;if(t!==void 0&&!isRecord(t))throw Error(`${VERCEL_JSON_FILE_NAME} experimentalServices must be a JSON object.`);return e}async function readVercelJsonConfig(e){try{return normalizeVercelJsonConfig(JSON.parse(await readFile(e,`utf8`)))}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return{};throw e}}function findServiceByFramework(e,t){return Object.values(e).find(e=>e.framework===t)}async function ensureAshVercelJson(t){let n=join(t.nextRoot,VERCEL_JSON_FILE_NAME),i=await readVercelJsonConfig(n),a=resolveRelativeEntrypoint(t.nextRoot,t.appRoot),o=i.experimentalServices??{},s=findServiceByFramework(o,`ash`),c=findServiceByFramework(o,`nextjs`),l=s?.routePrefix??t.servicePrefix,u={...o};c===void 0&&(u.web={entrypoint:`.`,framework:`nextjs`,routePrefix:`/`}),s===void 0&&(u.ash={buildCommand:t.ashBuildCommand,entrypoint:a,framework:`ash`,routePrefix:l});let d={...i,$schema:i.$schema??VERCEL_JSON_SCHEMA,experimentalServices:u};return JSON.stringify(i)!==JSON.stringify(d)&&await writeFile(n,`${JSON.stringify(d,null,2)}\n`),{servicePrefix:l}}export{ensureAshVercelJson};
1
+ import{join,relative}from"node:path";import{readFile,writeFile}from"node:fs/promises";const VERCEL_JSON_FILE_NAME=`vercel.json`;function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function resolveRelativeEntrypoint(e,n){let r=relative(e,n);return r.length===0?`.`:r.replaceAll(`\\`,`/`)}function normalizeVercelJsonConfig(e){if(!isRecord(e))throw Error(`${VERCEL_JSON_FILE_NAME} must contain a JSON object.`);let t=e.experimentalServices;if(t!==void 0&&!isRecord(t))throw Error(`${VERCEL_JSON_FILE_NAME} experimentalServices must be a JSON object.`);return e}async function readVercelJsonConfig(e){try{return normalizeVercelJsonConfig(JSON.parse(await readFile(e,`utf8`)))}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return{};throw e}}function findServiceByFramework(e,t){return Object.values(e).find(e=>e.framework===t)}async function ensureAshVercelJson(t){let n=join(t.nextRoot,VERCEL_JSON_FILE_NAME),i=await readVercelJsonConfig(n),a=resolveRelativeEntrypoint(t.nextRoot,t.appRoot),o=i.experimentalServices??{},s=findServiceByFramework(o,`ash`),c=findServiceByFramework(o,`nextjs`),l=s?.routePrefix??t.servicePrefix,u={...o};c===void 0&&(u.web={entrypoint:`.`,framework:`nextjs`,routePrefix:`/`}),s===void 0&&(u.ash={buildCommand:t.ashBuildCommand,entrypoint:a,framework:`ash`,routePrefix:l});let d={...i,$schema:i.$schema??`https://openapi.vercel.sh/vercel.json`,experimentalServices:u};return JSON.stringify(i)!==JSON.stringify(d)&&await writeFile(n,`${JSON.stringify(d,null,2)}\n`),{servicePrefix:l}}export{ensureAshVercelJson};
@@ -1 +1 @@
1
- var DEFINITION_KEY=Symbol.for(`experimental-ash.definition-source-key`),REGISTRY_SYMBOL=Symbol.for(`experimental-ash.definition-source-registry`),registryContainer=globalThis;registryContainer[REGISTRY_SYMBOL]===void 0&&(registryContainer[REGISTRY_SYMBOL]=new Map);var definitionSourceRegistry=registryContainer[REGISTRY_SYMBOL];function stampDefinitionKey(t,n){Object.defineProperty(t,DEFINITION_KEY,{value:n})}function readDefinitionKey(t){if(DEFINITION_KEY in t)return t[DEFINITION_KEY]}function registerDefinitionSource(e,t){definitionSourceRegistry.set(e,t)}var CONNECTION_TOOL_SEPARATOR=`__`,toolResultFrom=toolResultFromImpl;function toolResultFromImpl(e,t){if(e.kind!==`tool-result`||e.isError===!0)return;let n=readDefinitionKey(t);if(n===void 0)return;let r=definitionSourceRegistry.get(n);if(r===void 0)return;if(r.kind===`tool`)return e.toolName===r.name?{callId:e.callId,output:e.output,toolName:e.toolName}:void 0;let i=r.name+CONNECTION_TOOL_SEPARATOR;if(e.toolName.startsWith(i))return{callId:e.callId,connectionToolName:e.toolName.slice(i.length),output:e.output,toolName:e.toolName}}export{registerDefinitionSource,stampDefinitionKey,toolResultFrom};
1
+ const DEFINITION_KEY=Symbol.for(`experimental-ash.definition-source-key`),REGISTRY_SYMBOL=Symbol.for(`experimental-ash.definition-source-registry`),registryContainer=globalThis;registryContainer[REGISTRY_SYMBOL]===void 0&&(registryContainer[REGISTRY_SYMBOL]=new Map);const definitionSourceRegistry=registryContainer[REGISTRY_SYMBOL];function stampDefinitionKey(t,n){Object.defineProperty(t,DEFINITION_KEY,{value:n})}function readDefinitionKey(t){if(DEFINITION_KEY in t)return t[DEFINITION_KEY]}function registerDefinitionSource(e,t){definitionSourceRegistry.set(e,t)}const toolResultFrom=toolResultFromImpl;function toolResultFromImpl(e,t){if(e.kind!==`tool-result`||e.isError===!0)return;let n=readDefinitionKey(t);if(n===void 0)return;let r=definitionSourceRegistry.get(n);if(r===void 0)return;if(r.kind===`tool`)return e.toolName===r.name?{callId:e.callId,output:e.output,toolName:e.toolName}:void 0;let i=r.name+`__`;if(e.toolName.startsWith(i))return{callId:e.callId,connectionToolName:e.toolName.slice(i.length),output:e.output,toolName:e.toolName}}export{registerDefinitionSource,stampDefinitionKey,toolResultFrom};
@@ -1 +1 @@
1
- import{WEB_SEARCH_TOOL_DEFINITION}from"#runtime/framework-tools/web-search.js";import{BASH_TOOL_DEFINITION}from"#runtime/framework-tools/bash.js";import{GLOB_TOOL_DEFINITION}from"#runtime/framework-tools/glob.js";import{GREP_TOOL_DEFINITION}from"#runtime/framework-tools/grep.js";import{READ_FILE_TOOL_DEFINITION}from"#runtime/framework-tools/read-file.js";import{SKILL_TOOL_DEFINITION}from"#runtime/framework-tools/skill.js";import{TODO_TOOL_DEFINITION}from"#runtime/framework-tools/todo.js";import{WEB_FETCH_TOOL_DEFINITION}from"#runtime/framework-tools/web-fetch.js";import{WRITE_FILE_TOOL_DEFINITION}from"#runtime/framework-tools/write-file.js";import{toPublicToolDefinition}from"#public/tools/internal.js";var bash=toPublicToolDefinition(BASH_TOOL_DEFINITION),glob=toPublicToolDefinition(GLOB_TOOL_DEFINITION),grep=toPublicToolDefinition(GREP_TOOL_DEFINITION),readFile=toPublicToolDefinition(READ_FILE_TOOL_DEFINITION),writeFile=toPublicToolDefinition(WRITE_FILE_TOOL_DEFINITION),webFetch=toPublicToolDefinition(WEB_FETCH_TOOL_DEFINITION),todo=toPublicToolDefinition(TODO_TOOL_DEFINITION),loadSkill=toPublicToolDefinition(SKILL_TOOL_DEFINITION),webSearch={description:WEB_SEARCH_TOOL_DEFINITION.description,inputSchema:{},execute(){throw Error(`web_search is provider-managed and has no local execute. Override with defineTool() to provide a custom implementation.`)}};export{bash,glob,grep,loadSkill,readFile,todo,webFetch,webSearch,writeFile};
1
+ import{WEB_SEARCH_TOOL_DEFINITION}from"#runtime/framework-tools/web-search.js";import{BASH_TOOL_DEFINITION}from"#runtime/framework-tools/bash.js";import{GLOB_TOOL_DEFINITION}from"#runtime/framework-tools/glob.js";import{GREP_TOOL_DEFINITION}from"#runtime/framework-tools/grep.js";import{READ_FILE_TOOL_DEFINITION}from"#runtime/framework-tools/read-file.js";import{SKILL_TOOL_DEFINITION}from"#runtime/framework-tools/skill.js";import{TODO_TOOL_DEFINITION}from"#runtime/framework-tools/todo.js";import{WEB_FETCH_TOOL_DEFINITION}from"#runtime/framework-tools/web-fetch.js";import{WRITE_FILE_TOOL_DEFINITION}from"#runtime/framework-tools/write-file.js";import{toPublicToolDefinition}from"#public/tools/internal.js";const bash=toPublicToolDefinition(BASH_TOOL_DEFINITION),glob=toPublicToolDefinition(GLOB_TOOL_DEFINITION),grep=toPublicToolDefinition(GREP_TOOL_DEFINITION),readFile=toPublicToolDefinition(READ_FILE_TOOL_DEFINITION),writeFile=toPublicToolDefinition(WRITE_FILE_TOOL_DEFINITION),webFetch=toPublicToolDefinition(WEB_FETCH_TOOL_DEFINITION),todo=toPublicToolDefinition(TODO_TOOL_DEFINITION),loadSkill=toPublicToolDefinition(SKILL_TOOL_DEFINITION),webSearch={description:WEB_SEARCH_TOOL_DEFINITION.description,inputSchema:{},execute(){throw Error(`web_search is provider-managed and has no local execute. Override with defineTool() to provide a custom implementation.`)}};export{bash,glob,grep,loadSkill,readFile,todo,webFetch,webSearch,writeFile};
@@ -1,2 +1,2 @@
1
- import{toError}from"#shared/errors.js";import{Client}from"#client/client.js";import{defaultMessageReducer}from"#client/message-reducer.js";import{useCallback,useMemo,useRef,useSyncExternalStore}from"react";function useAshAgent(e={}){let t=useRef(void 0);if(!t.current){let r=e.reducer??defaultMessageReducer();t.current=new UseAshAgentStore({auth:e.auth,headers:e.headers,host:e.host,initialEvents:e.initialEvents,initialSession:e.initialSession,maxReconnectAttempts:e.maxReconnectAttempts,optimistic:e.optimistic,reducer:r,session:e.session})}let s=t.current;s.setCallbacks({onError:e.onError,onEvent:e.onEvent,onFinish:e.onFinish,onSessionChange:e.onSessionChange,prepareSend:e.prepareSend});let c=useSyncExternalStore(useCallback(e=>s.subscribe(e),[s]),()=>s.snapshot,()=>s.snapshot),l=useCallback(()=>s.reset(),[s]),u=useCallback((e,t)=>s.send(e,t),[s]),d=useCallback((e,t)=>s.sendMessage(e,t),[s]),f=useCallback(()=>s.stop(),[s]);return useMemo(()=>({...c,reset:l,send:u,sendMessage:d,stop:f}),[l,u,d,c,f])}var UseAshAgentStore=class{#e;#t;#n;#r=new Set;#i;#a={};#o;#s;#c;#l=0;#u;#d;#f;#p;#m=`ready`;constructor(e){this.#e=e.session?void 0:()=>new Client({auth:e.auth,headers:e.headers,host:e.host??``,maxReconnectAttempts:e.maxReconnectAttempts}).session(e.initialSession),this.#c=[...e.initialEvents??[]],this.#d=[...this.#c],this.#t=e.optimistic??!0,this.#n=e.reducer,this.#f=e.session??this.#h(),this.#o=this.#E(this.#d),this.#p=this.#D()}get snapshot(){return this.#p}setCallbacks(e){this.#a=e}subscribe(e){return this.#r.add(e),()=>{this.#r.delete(e)}}async sendMessage(e,t){await this.send({message:e},t)}async send(t,n){if(this.#m===`streaming`||this.#m===`submitted`)throw Error(`Ash session is already processing a turn.`);let r=this.#g(),i=new AbortController;this.#i=i,this.#s=void 0,this.#m=`submitted`,this.#O();try{let e=await this.#a.prepareSend?.(t)??t;if(!this.#v(r))return;this.#y(e),this.#b(e),this.#O();let a=await this.#f.send(e,{...n,signal:createAbortSignal(n?.signal,i.signal)}),o=!1;for await(let e of a){if(!this.#v(r))return;o||(o=!0,this.#m=`streaming`),this.#c=[...this.#c,e],this.#x(e),this.#a.onEvent?.(e),this.#S(e),this.#O()}if(!this.#v(r))return;this.#m=this.#s===void 0?`ready`:`error`}catch(t){if(!this.#v(r))return;isAbortError(t)?(this.#m=`ready`,this.#C(toError(t))):(this.#s=toError(t),this.#m=`error`,this.#C(this.#s),this.#a.onError?.(this.#s))}finally{this.#v(r)&&(this.#i=void 0,this.#a.onSessionChange?.(this.#f.state),this.#O(),this.#a.onFinish?.(this.#p))}}stop(){this.#i?.abort()}reset(){this.#_(),this.stop(),this.#i=void 0,this.#f=this.#e?.()??this.#f,this.#c=[],this.#u=void 0,this.#d=[],this.#o=this.#n.initial(),this.#s=void 0,this.#m=`ready`,this.#a.onSessionChange?.(this.#f.state),this.#O()}#h(){if(!this.#e)throw Error(`Cannot create an owned Ash session from an external session.`);return this.#e()}#g(){return this.#l+=1,this.#l}#_(){this.#l+=1}#v(e){return this.#l===e}#y(e){if(!this.#t||e.message===void 0)return;let t=createSubmissionId(),n={createdAt:Date.now(),id:t,message:summarizeUserContent(e.message)};this.#u=n,this.#w({data:{createdAt:n.createdAt,message:n.message,submissionId:n.id},type:`client.message.submitted`})}#b(e){e.inputResponses===void 0||e.inputResponses.length===0||this.#w({data:{createdAt:Date.now(),responses:e.inputResponses},type:`client.input.responded`})}#x(e){if(e.type===`message.received`&&this.#u!==void 0){let t=this.#u.id;this.#u=void 0,this.#T(e=>e.type===`client.message.submitted`&&e.data.submissionId===t,e);return}this.#w(e)}#S(e){let t=toTerminalStreamFailureError(e);t!==void 0&&(this.#m=`error`,this.#C(t),this.#s===void 0&&(this.#s=t,this.#a.onError?.(t)))}#C(e){let t=this.#u;t!==void 0&&(this.#u=void 0,this.#T(e=>e.type===`client.message.submitted`&&e.data.submissionId===t.id,{data:{createdAt:t.createdAt,error:{message:e.message},message:t.message,submissionId:t.id},type:`client.message.failed`}))}#w(e){this.#d=[...this.#d,e],this.#o=this.#n.reduce(this.#o,e)}#T(e,t){let n=!1;this.#d=this.#d.map(r=>!n&&e(r)?(n=!0,t):r),n||(this.#d=[...this.#d,t]),this.#o=this.#E(this.#d)}#E(e){let t=this.#n.initial();for(let n of e)t=this.#n.reduce(t,n);return t}#D(){return{data:this.#o,error:this.#s,events:this.#c,session:this.#f.state,status:this.#m}}#O(){this.#p=this.#D();for(let e of this.#r)e()}},submissionSequence=0;function createSubmissionId(){let e=globalThis.crypto?.randomUUID;return e===void 0?(submissionSequence+=1,`submission_${submissionSequence.toString()}`):e.call(globalThis.crypto)}function createAbortSignal(e,t){return e?AbortSignal.any([e,t]):t}function summarizeUserContent(e){if(typeof e==`string`)return e;let t=[];for(let n of e){if(n.type===`text`){t.push(n.text);continue}n.type===`file`&&t.push(n.filename?`[file: ${n.filename}]`:`[file]`)}return t.join(`
1
+ import{toError}from"#shared/errors.js";import{Client}from"#client/client.js";import{defaultMessageReducer}from"#client/message-reducer.js";import{useCallback,useMemo,useRef,useSyncExternalStore}from"react";function useAshAgent(e={}){let t=useRef(void 0);if(!t.current){let r=e.reducer??defaultMessageReducer();t.current=new UseAshAgentStore({auth:e.auth,headers:e.headers,host:e.host,initialEvents:e.initialEvents,initialSession:e.initialSession,maxReconnectAttempts:e.maxReconnectAttempts,optimistic:e.optimistic,reducer:r,session:e.session})}let s=t.current;s.setCallbacks({onError:e.onError,onEvent:e.onEvent,onFinish:e.onFinish,onSessionChange:e.onSessionChange,prepareSend:e.prepareSend});let c=useSyncExternalStore(useCallback(e=>s.subscribe(e),[s]),()=>s.snapshot,()=>s.snapshot),l=useCallback(()=>s.reset(),[s]),u=useCallback((e,t)=>s.send(e,t),[s]),d=useCallback((e,t)=>s.sendMessage(e,t),[s]),f=useCallback(()=>s.stop(),[s]);return useMemo(()=>({...c,reset:l,send:u,sendMessage:d,stop:f}),[l,u,d,c,f])}var UseAshAgentStore=class{#e;#t;#n;#r=new Set;#i;#a={};#o;#s;#c;#l=0;#u;#d;#f;#p;#m=`ready`;constructor(e){this.#e=e.session?void 0:()=>new Client({auth:e.auth,headers:e.headers,host:e.host??``,maxReconnectAttempts:e.maxReconnectAttempts}).session(e.initialSession),this.#c=[...e.initialEvents??[]],this.#d=[...this.#c],this.#t=e.optimistic??!0,this.#n=e.reducer,this.#f=e.session??this.#h(),this.#o=this.#E(this.#d),this.#p=this.#D()}get snapshot(){return this.#p}setCallbacks(e){this.#a=e}subscribe(e){return this.#r.add(e),()=>{this.#r.delete(e)}}async sendMessage(e,t){await this.send({message:e},t)}async send(t,n){if(this.#m===`streaming`||this.#m===`submitted`)throw Error(`Ash session is already processing a turn.`);let r=this.#g(),i=new AbortController;this.#i=i,this.#s=void 0,this.#m=`submitted`,this.#O();try{let e=await this.#a.prepareSend?.(t)??t;if(!this.#v(r))return;this.#y(e),this.#b(e),this.#O();let a=await this.#f.send(e,{...n,signal:createAbortSignal(n?.signal,i.signal)}),o=!1;for await(let e of a){if(!this.#v(r))return;o||(o=!0,this.#m=`streaming`),this.#c=[...this.#c,e],this.#x(e),this.#a.onEvent?.(e),this.#S(e),this.#O()}if(!this.#v(r))return;this.#m=this.#s===void 0?`ready`:`error`}catch(t){if(!this.#v(r))return;isAbortError(t)?(this.#m=`ready`,this.#C(toError(t))):(this.#s=toError(t),this.#m=`error`,this.#C(this.#s),this.#a.onError?.(this.#s))}finally{this.#v(r)&&(this.#i=void 0,this.#a.onSessionChange?.(this.#f.state),this.#O(),this.#a.onFinish?.(this.#p))}}stop(){this.#i?.abort()}reset(){this.#_(),this.stop(),this.#i=void 0,this.#f=this.#e?.()??this.#f,this.#c=[],this.#u=void 0,this.#d=[],this.#o=this.#n.initial(),this.#s=void 0,this.#m=`ready`,this.#a.onSessionChange?.(this.#f.state),this.#O()}#h(){if(!this.#e)throw Error(`Cannot create an owned Ash session from an external session.`);return this.#e()}#g(){return this.#l+=1,this.#l}#_(){this.#l+=1}#v(e){return this.#l===e}#y(e){if(!this.#t||e.message===void 0)return;let t=createSubmissionId(),n={createdAt:Date.now(),id:t,message:summarizeUserContent(e.message)};this.#u=n,this.#w({data:{createdAt:n.createdAt,message:n.message,submissionId:n.id},type:`client.message.submitted`})}#b(e){e.inputResponses===void 0||e.inputResponses.length===0||this.#w({data:{createdAt:Date.now(),responses:e.inputResponses},type:`client.input.responded`})}#x(e){if(e.type===`message.received`&&this.#u!==void 0){let t=this.#u.id;this.#u=void 0,this.#T(e=>e.type===`client.message.submitted`&&e.data.submissionId===t,e);return}this.#w(e)}#S(e){let t=toTerminalStreamFailureError(e);t!==void 0&&(this.#m=`error`,this.#C(t),this.#s===void 0&&(this.#s=t,this.#a.onError?.(t)))}#C(e){let t=this.#u;t!==void 0&&(this.#u=void 0,this.#T(e=>e.type===`client.message.submitted`&&e.data.submissionId===t.id,{data:{createdAt:t.createdAt,error:{message:e.message},message:t.message,submissionId:t.id},type:`client.message.failed`}))}#w(e){this.#d=[...this.#d,e],this.#o=this.#n.reduce(this.#o,e)}#T(e,t){let n=!1;this.#d=this.#d.map(r=>!n&&e(r)?(n=!0,t):r),n||(this.#d=[...this.#d,t]),this.#o=this.#E(this.#d)}#E(e){let t=this.#n.initial();for(let n of e)t=this.#n.reduce(t,n);return t}#D(){return{data:this.#o,error:this.#s,events:this.#c,session:this.#f.state,status:this.#m}}#O(){this.#p=this.#D();for(let e of this.#r)e()}};let submissionSequence=0;function createSubmissionId(){let e=globalThis.crypto?.randomUUID;return e===void 0?(submissionSequence+=1,`submission_${submissionSequence.toString()}`):e.call(globalThis.crypto)}function createAbortSignal(e,t){return e?AbortSignal.any([e,t]):t}function summarizeUserContent(e){if(typeof e==`string`)return e;let t=[];for(let n of e){if(n.type===`text`){t.push(n.text);continue}n.type===`file`&&t.push(n.filename?`[file: ${n.filename}]`:`[file]`)}return t.join(`
2
2
  `)}function isAbortError(e){return e instanceof Error&&e.name===`AbortError`}function toTerminalStreamFailureError(e){if(e.type!==`session.failed`)return;let t=Error(e.data.message);return t.name=e.data.code,t}export{useAshAgent};
@@ -1 +1 @@
1
- import{z}from"#compiled/zod/index.js";import{jsonObjectSchema,jsonValueSchema}from"#shared/json-schemas.js";var runtimeToolCallActionRequestSchema=z.object({callId:z.string(),input:jsonObjectSchema,kind:z.literal(`tool-call`),toolName:z.string()}).strict(),runtimeSubagentCallActionRequestSchema=z.object({callId:z.string(),description:z.string(),input:jsonObjectSchema,kind:z.literal(`subagent-call`),name:z.string(),nodeId:z.string(),subagentName:z.string()}).strict(),runtimeRemoteAgentCallActionRequestSchema=z.object({callId:z.string(),description:z.string(),input:jsonObjectSchema,kind:z.literal(`remote-agent-call`),name:z.string(),nodeId:z.string(),remoteAgentName:z.string()}).strict(),runtimeLoadSkillActionRequestSchema=z.object({callId:z.string(),input:jsonObjectSchema,kind:z.literal(`load-skill`)}).strict(),runtimeActionRequestSchema=z.discriminatedUnion(`kind`,[runtimeLoadSkillActionRequestSchema,runtimeRemoteAgentCallActionRequestSchema,runtimeSubagentCallActionRequestSchema,runtimeToolCallActionRequestSchema]);z.object({callId:z.string(),isError:z.boolean().optional(),kind:z.literal(`tool-result`),output:jsonValueSchema,toolName:z.string()}).strict(),z.object({callId:z.string(),isError:z.boolean().optional(),kind:z.literal(`subagent-result`),output:jsonValueSchema,subagentName:z.string()}).strict(),z.object({callId:z.string(),isError:z.boolean().optional(),kind:z.literal(`load-skill-result`),output:jsonValueSchema,name:z.string().optional()}).strict();export{runtimeActionRequestSchema,runtimeRemoteAgentCallActionRequestSchema,runtimeToolCallActionRequestSchema};
1
+ import{z}from"#compiled/zod/index.js";import{jsonObjectSchema,jsonValueSchema}from"#shared/json-schemas.js";const runtimeToolCallActionRequestSchema=z.object({callId:z.string(),input:jsonObjectSchema,kind:z.literal(`tool-call`),toolName:z.string()}).strict(),runtimeSubagentCallActionRequestSchema=z.object({callId:z.string(),description:z.string(),input:jsonObjectSchema,kind:z.literal(`subagent-call`),name:z.string(),nodeId:z.string(),subagentName:z.string()}).strict(),runtimeRemoteAgentCallActionRequestSchema=z.object({callId:z.string(),description:z.string(),input:jsonObjectSchema,kind:z.literal(`remote-agent-call`),name:z.string(),nodeId:z.string(),remoteAgentName:z.string()}).strict(),runtimeLoadSkillActionRequestSchema=z.object({callId:z.string(),input:jsonObjectSchema,kind:z.literal(`load-skill`)}).strict(),runtimeActionRequestSchema=z.discriminatedUnion(`kind`,[runtimeLoadSkillActionRequestSchema,runtimeRemoteAgentCallActionRequestSchema,runtimeSubagentCallActionRequestSchema,runtimeToolCallActionRequestSchema]);z.object({callId:z.string(),isError:z.boolean().optional(),kind:z.literal(`tool-result`),output:jsonValueSchema,toolName:z.string()}).strict(),z.object({callId:z.string(),isError:z.boolean().optional(),kind:z.literal(`subagent-result`),output:jsonValueSchema,subagentName:z.string()}).strict(),z.object({callId:z.string(),isError:z.boolean().optional(),kind:z.literal(`load-skill-result`),output:jsonValueSchema,name:z.string().optional()}).strict();export{runtimeActionRequestSchema,runtimeRemoteAgentCallActionRequestSchema,runtimeToolCallActionRequestSchema};
@@ -1 +1 @@
1
- var BOOTSTRAP_RESPONSE_TIMESTAMP=new Date(`2026-03-16T00:00:00.000Z`);function createBootstrapGenerateResult(t){return{content:[{text:t.text,type:`text`}],finishReason:`stop`,response:{id:`bootstrap-response`,modelId:t.modelId,timestamp:BOOTSTRAP_RESPONSE_TIMESTAMP},usage:{inputTokens:{cacheRead:0,cacheWrite:0,noCache:t.inputTokens,total:t.inputTokens},outputTokens:{reasoning:0,text:t.outputTokens,total:t.outputTokens}},warnings:[]}}function createBootstrapStreamResult(e){let t=[{type:`stream-start`,warnings:e.warnings}];e.response!==void 0&&t.push({...e.response,type:`response-metadata`});let n=0;for(let r of e.content)switch(r.type){case`text`:{let e=`text_${n}`;n+=1,t.push({id:e,type:`text-start`}),r.text.length>0&&t.push({delta:r.text,id:e,type:`text-delta`}),t.push({id:e,type:`text-end`});break}case`tool-call`:t.push(r);break;default:break}return t.push({finishReason:e.finishReason,type:`finish`,usage:e.usage}),{stream:new ReadableStream({start(e){for(let n of t)e.enqueue(n);e.close()}})}}function estimateTokenCount(e){return Math.max(1,Math.ceil(e.trim().length/4))}function getPromptContentText(e){return typeof e==`string`?e:e.flatMap(e=>{if(typeof e==`string`)return[e];switch(e.type){case`text`:return[e.text];default:return[]}}).join(``)}function getLastUserPromptText(e){for(let t of[...e].reverse()){if(t.role!==`user`)continue;let e=getPromptContentText(t.content).trim();if(e.length>0)return e}return null}function getPromptText(e){return e.map(e=>getPromptContentText(e.content)).join(` `)}export{createBootstrapGenerateResult,createBootstrapStreamResult,estimateTokenCount,getLastUserPromptText,getPromptContentText,getPromptText};
1
+ const BOOTSTRAP_RESPONSE_TIMESTAMP=new Date(`2026-03-16T00:00:00.000Z`);function createBootstrapGenerateResult(t){return{content:[{text:t.text,type:`text`}],finishReason:`stop`,response:{id:`bootstrap-response`,modelId:t.modelId,timestamp:BOOTSTRAP_RESPONSE_TIMESTAMP},usage:{inputTokens:{cacheRead:0,cacheWrite:0,noCache:t.inputTokens,total:t.inputTokens},outputTokens:{reasoning:0,text:t.outputTokens,total:t.outputTokens}},warnings:[]}}function createBootstrapStreamResult(e){let t=[{type:`stream-start`,warnings:e.warnings}];e.response!==void 0&&t.push({...e.response,type:`response-metadata`});let n=0;for(let r of e.content)switch(r.type){case`text`:{let e=`text_${n}`;n+=1,t.push({id:e,type:`text-start`}),r.text.length>0&&t.push({delta:r.text,id:e,type:`text-delta`}),t.push({id:e,type:`text-end`});break}case`tool-call`:t.push(r);break;default:break}return t.push({finishReason:e.finishReason,type:`finish`,usage:e.usage}),{stream:new ReadableStream({start(e){for(let n of t)e.enqueue(n);e.close()}})}}function estimateTokenCount(e){return Math.max(1,Math.ceil(e.trim().length/4))}function getPromptContentText(e){return typeof e==`string`?e:e.flatMap(e=>{if(typeof e==`string`)return[e];switch(e.type){case`text`:return[e.text];default:return[]}}).join(``)}function getLastUserPromptText(e){for(let t of[...e].reverse()){if(t.role!==`user`)continue;let e=getPromptContentText(t.content).trim();if(e.length>0)return e}return null}function getPromptText(e){return e.map(e=>getPromptContentText(e.content)).join(` `)}export{createBootstrapGenerateResult,createBootstrapStreamResult,estimateTokenCount,getLastUserPromptText,getPromptContentText,getPromptText};
@@ -1 +1 @@
1
- import{MockLanguageModelV3}from"ai/test";import{BOOTSTRAP_RUNTIME_MODEL_ID}from"#runtime/agent/bootstrap.js";import{createBootstrapGenerateResult,createBootstrapStreamResult,estimateTokenCount,getLastUserPromptText,getPromptText}from"#runtime/agent/bootstrap-model-utils.js";var BOOTSTRAP_MODEL_PROVIDER=`ash-bootstrap`,bootstrapRuntimeModels=new Map;function resolveBootstrapRuntimeModel(n){if(n.id!==BOOTSTRAP_RUNTIME_MODEL_ID)return null;let i=bootstrapRuntimeModels.get(n.id);if(i!==void 0)return i;let a=new MockLanguageModelV3({doGenerate:async e=>createBootstrapModelResult(e.prompt,n.id),doStream:async e=>createBootstrapStreamResult(createBootstrapModelResult(e.prompt,n.id)),modelId:n.id,provider:BOOTSTRAP_MODEL_PROVIDER});return bootstrapRuntimeModels.set(n.id,a),a}function createBootstrapModelResult(e,t){let r=`Bootstrap reply: ${getLastUserPromptText(e)??`Hello from Ash`}`;return createBootstrapGenerateResult({inputTokens:estimateTokenCount(getPromptText(e)),modelId:t,outputTokens:estimateTokenCount(r),text:r})}export{resolveBootstrapRuntimeModel};
1
+ import{MockLanguageModelV3}from"ai/test";import{BOOTSTRAP_RUNTIME_MODEL_ID}from"#runtime/agent/bootstrap.js";import{createBootstrapGenerateResult,createBootstrapStreamResult,estimateTokenCount,getLastUserPromptText,getPromptText}from"#runtime/agent/bootstrap-model-utils.js";const bootstrapRuntimeModels=new Map;function resolveBootstrapRuntimeModel(n){if(n.id!==BOOTSTRAP_RUNTIME_MODEL_ID)return null;let i=bootstrapRuntimeModels.get(n.id);if(i!==void 0)return i;let a=new MockLanguageModelV3({doGenerate:async e=>createBootstrapModelResult(e.prompt,n.id),doStream:async e=>createBootstrapStreamResult(createBootstrapModelResult(e.prompt,n.id)),modelId:n.id,provider:`ash-bootstrap`});return bootstrapRuntimeModels.set(n.id,a),a}function createBootstrapModelResult(e,t){let r=`Bootstrap reply: ${getLastUserPromptText(e)??`Hello from Ash`}`;return createBootstrapGenerateResult({inputTokens:estimateTokenCount(getPromptText(e)),modelId:t,outputTokens:estimateTokenCount(r),text:r})}export{resolveBootstrapRuntimeModel};
@@ -1 +1 @@
1
- import{composeRuntimeBasePrompt}from"#runtime/prompt/compose.js";var BOOTSTRAP_RUNTIME_MODEL_ID=`ash-bootstrap-model`,BOOTSTRAP_RUNTIME_SYSTEM_PROMPT=`You are the Ash bootstrap agent. Be concise, stay grounded in the current conversation, and do not assume tools are available unless the runtime provides them.`;function createResolvedRuntimeTurnAgent(t){let n=t.agent,r=createResolvedTurnMetadata(n);return{id:n.config.name,instructions:composeRuntimeBasePrompt({connections:n.connections,instructions:n.instructions,skills:n.skills,toolsAvailable:t.tools.length>0,workspaceSpec:n.workspaceSpec}),compactionModel:n.config.compaction?.model,model:n.config.model,nodeId:t.nodeId,turnMetadata:r,tools:[...t.tools],workspaceSpec:n.workspaceSpec}}function createResolvedTurnMetadata(e){let t={};return Object.keys(e.config.metadata).length>0&&(t.configMetadata={...e.config.metadata}),e.instructions!==void 0&&(t.instructionsName=e.instructions.name),e.skills.length>0&&(t.skillNames=e.skills.map(e=>e.name)),Object.keys(t).length>0?t:void 0}export{BOOTSTRAP_RUNTIME_MODEL_ID,BOOTSTRAP_RUNTIME_SYSTEM_PROMPT,createResolvedRuntimeTurnAgent};
1
+ import{composeRuntimeBasePrompt}from"#runtime/prompt/compose.js";const BOOTSTRAP_RUNTIME_MODEL_ID=`ash-bootstrap-model`,BOOTSTRAP_RUNTIME_SYSTEM_PROMPT=`You are the Ash bootstrap agent. Be concise, stay grounded in the current conversation, and do not assume tools are available unless the runtime provides them.`;function createResolvedRuntimeTurnAgent(t){let n=t.agent,r=createResolvedTurnMetadata(n);return{id:n.config.name,instructions:composeRuntimeBasePrompt({connections:n.connections,instructions:n.instructions,skills:n.skills,toolsAvailable:t.tools.length>0,workspaceSpec:n.workspaceSpec}),compactionModel:n.config.compaction?.model,model:n.config.model,nodeId:t.nodeId,turnMetadata:r,tools:[...t.tools],workspaceSpec:n.workspaceSpec}}function createResolvedTurnMetadata(e){let t={};return Object.keys(e.config.metadata).length>0&&(t.configMetadata={...e.config.metadata}),e.instructions!==void 0&&(t.instructionsName=e.instructions.name),e.skills.length>0&&(t.skillNames=e.skills.map(e=>e.name)),Object.keys(t).length>0?t:void 0}export{BOOTSTRAP_RUNTIME_MODEL_ID,BOOTSTRAP_RUNTIME_SYSTEM_PROMPT,createResolvedRuntimeTurnAgent};
@@ -1,4 +1,4 @@
1
- import{z}from"#compiled/zod/index.js";import{MockLanguageModelV3}from"ai/test";import{BOOTSTRAP_RUNTIME_MODEL_ID,BOOTSTRAP_RUNTIME_SYSTEM_PROMPT}from"#runtime/agent/bootstrap.js";import{createBootstrapGenerateResult,createBootstrapStreamResult,estimateTokenCount,getLastUserPromptText,getPromptContentText,getPromptText}from"#runtime/agent/bootstrap-model-utils.js";import{LOAD_SKILL_TOOL_NAME}from"#runtime/skills/fragment-context.js";var MOCK_RUNTIME_MODEL_PROVIDER=`ash-runtime-mock`,LOAD_SKILL_TOOL_CALL_ID=`call_load_skill`,GET_WEATHER_TOOL_CALL_ID=`call_get_weather`,authoredRuntimeModelMocks=new Map,bootstrapWeatherPayloadSchema=z.object({city:z.string(),condition:z.string(),summary:z.string(),temperatureF:z.number().finite()}).strict(),ASH_MOCK_AUTHORED_MODELS_ENV=`ASH_MOCK_AUTHORED_MODELS`;function shouldMockAuthoredRuntimeModels(){return process.env.ASH_MOCK_AUTHORED_MODELS===`1`||process.env.NODE_ENV===`test`}function createMockAuthoredRuntimeModel(e){let n=authoredRuntimeModelMocks.get(e.id);if(n!==void 0)return n;let r=new MockLanguageModelV3({modelId:e.id,provider:MOCK_RUNTIME_MODEL_PROVIDER,doGenerate:async t=>createMockModelResult(t,e.id),doStream:async t=>createBootstrapStreamResult(createMockModelResult(t,e.id))});return authoredRuntimeModelMocks.set(e.id,r),r}function createMockModelResult(e,t){let n=getLastAuthoredToolResult(e.prompt);if(n!==null){let r=formatToolResultReply(n,e.prompt);return createBootstrapGenerateResult({inputTokens:estimateTokenCount(getPromptText(e.prompt)),modelId:t,outputTokens:estimateTokenCount(r),text:r})}let r=createSkillLoadResult(e.prompt,t);if(r!==null)return r;let a=createAuthoredToolCallResult(e,t);if(a!==null)return a;let o=createAssistantMessage(e.prompt);return createBootstrapGenerateResult({inputTokens:estimateTokenCount(getPromptText(e.prompt)),modelId:t,outputTokens:estimateTokenCount(o),text:o})}function resolveMockAuthoredRuntimeModel(e){return!shouldMockAuthoredRuntimeModels()||e.id===BOOTSTRAP_RUNTIME_MODEL_ID?null:createMockAuthoredRuntimeModel(e)}function createSkillLoadResult(e,t){let n=getLastUserPromptText(e);if(n===null||getActivatedSkillIds(e).length>0)return null;let r=findRelevantSkill(getAvailableSkills(e),n);return r===null?null:createToolCallGenerateResult({input:{skill:r.name},inputTokens:estimateTokenCount(getPromptText(e)),modelId:t,outputTokens:estimateTokenCount(r.name),toolCallId:LOAD_SKILL_TOOL_CALL_ID,toolName:LOAD_SKILL_TOOL_NAME})}function createAuthoredToolCallResult(e,t){let n=getLastUserPromptText(e.prompt);if(n===null)return null;let r=findRelevantTool(getAvailableTools(e),n);if(r===null)return null;let i=resolveWeatherCity(n);return createToolCallGenerateResult({input:{city:i},inputTokens:estimateTokenCount(getPromptText(e.prompt)),modelId:t,outputTokens:estimateTokenCount(i),toolCallId:GET_WEATHER_TOOL_CALL_ID,toolName:r.name})}function createAssistantMessage(e){let t=getLastUserPromptText(e)??`Hello from Ash`,n=getSystemPromptLabels(e),r=resolveSystemProbe(e);return n.length>0?r===null?`Bootstrap reply [${n.join(`, `)}]: ${t}`:`Bootstrap reply [${n.join(`, `)}; probe=${r}]: ${t}`:r===null?`Bootstrap reply: ${t}`:`Bootstrap reply [probe=${r}]: ${t}`}function formatToolResultReply(e,t){if(e.isError)return`Local weather tool failed: ${formatToolOutput(e.output)}`;if(isWeatherPayload(e.output))return`Used local weather tool for ${e.output.city}: ${e.output.condition}, ${e.output.temperatureF}F. ${e.output.summary}`;let n=getLastUserPromptText(t)??`Hello from Ash`;return`Used ${e.toolName} for "${n}": ${formatToolOutput(e.output)}`}function createToolCallGenerateResult(e){return{content:[{input:JSON.stringify(e.input),toolCallId:e.toolCallId,toolName:e.toolName,type:`tool-call`}],finishReason:`tool-calls`,response:{id:`bootstrap-response`,modelId:e.modelId,timestamp:new Date(`2026-03-16T00:00:00.000Z`)},usage:{inputTokens:{cacheRead:0,cacheWrite:0,noCache:e.inputTokens,total:e.inputTokens},outputTokens:{reasoning:0,text:e.outputTokens,total:e.outputTokens}},warnings:[]}}function getAvailableTools(e){return(e.tools??[]).flatMap(e=>e.type===`function`?[{description:e.description,name:e.name}]:[])}function getLastAuthoredToolResult(e){for(let t of[...e].reverse())if(!(t.role!==`tool`&&t.role!==`assistant`)){for(let e of[...t.content].reverse())if(!(typeof e==`string`||e.type!==`tool-result`)&&e.toolName!==LOAD_SKILL_TOOL_NAME)return{isError:e.output.type===`error-json`||e.output.type===`error-text`||e.output.type===`execution-denied`,output:e.output.type===`execution-denied`?{reason:e.output.reason??null,type:e.output.type}:e.output.value,toolCallId:e.toolCallId,toolName:e.toolName}}return null}function getSystemPromptLabels(e){let t=e.filter(e=>e.role===`system`);if(t.length===0)return[];let n=t.flatMap(e=>{let t=getPromptContentText(e.content);if(t.startsWith(`Available skills
1
+ import{z}from"#compiled/zod/index.js";import{MockLanguageModelV3}from"ai/test";import{BOOTSTRAP_RUNTIME_MODEL_ID,BOOTSTRAP_RUNTIME_SYSTEM_PROMPT}from"#runtime/agent/bootstrap.js";import{createBootstrapGenerateResult,createBootstrapStreamResult,estimateTokenCount,getLastUserPromptText,getPromptContentText,getPromptText}from"#runtime/agent/bootstrap-model-utils.js";import{LOAD_SKILL_TOOL_NAME}from"#runtime/skills/fragment-context.js";const authoredRuntimeModelMocks=new Map,bootstrapWeatherPayloadSchema=z.object({city:z.string(),condition:z.string(),summary:z.string(),temperatureF:z.number().finite()}).strict(),ASH_MOCK_AUTHORED_MODELS_ENV=`ASH_MOCK_AUTHORED_MODELS`;function shouldMockAuthoredRuntimeModels(){return process.env.ASH_MOCK_AUTHORED_MODELS===`1`||process.env.NODE_ENV===`test`}function createMockAuthoredRuntimeModel(e){let n=authoredRuntimeModelMocks.get(e.id);if(n!==void 0)return n;let r=new MockLanguageModelV3({modelId:e.id,provider:`ash-runtime-mock`,doGenerate:async t=>createMockModelResult(t,e.id),doStream:async t=>createBootstrapStreamResult(createMockModelResult(t,e.id))});return authoredRuntimeModelMocks.set(e.id,r),r}function createMockModelResult(e,t){let n=getLastAuthoredToolResult(e.prompt);if(n!==null){let r=formatToolResultReply(n,e.prompt);return createBootstrapGenerateResult({inputTokens:estimateTokenCount(getPromptText(e.prompt)),modelId:t,outputTokens:estimateTokenCount(r),text:r})}let r=createSkillLoadResult(e.prompt,t);if(r!==null)return r;let a=createAuthoredToolCallResult(e,t);if(a!==null)return a;let o=createAssistantMessage(e.prompt);return createBootstrapGenerateResult({inputTokens:estimateTokenCount(getPromptText(e.prompt)),modelId:t,outputTokens:estimateTokenCount(o),text:o})}function resolveMockAuthoredRuntimeModel(e){return!shouldMockAuthoredRuntimeModels()||e.id===BOOTSTRAP_RUNTIME_MODEL_ID?null:createMockAuthoredRuntimeModel(e)}function createSkillLoadResult(e,t){let n=getLastUserPromptText(e);if(n===null||getActivatedSkillIds(e).length>0)return null;let r=findRelevantSkill(getAvailableSkills(e),n);return r===null?null:createToolCallGenerateResult({input:{skill:r.name},inputTokens:estimateTokenCount(getPromptText(e)),modelId:t,outputTokens:estimateTokenCount(r.name),toolCallId:`call_load_skill`,toolName:LOAD_SKILL_TOOL_NAME})}function createAuthoredToolCallResult(e,t){let n=getLastUserPromptText(e.prompt);if(n===null)return null;let r=findRelevantTool(getAvailableTools(e),n);if(r===null)return null;let i=resolveWeatherCity(n);return createToolCallGenerateResult({input:{city:i},inputTokens:estimateTokenCount(getPromptText(e.prompt)),modelId:t,outputTokens:estimateTokenCount(i),toolCallId:`call_get_weather`,toolName:r.name})}function createAssistantMessage(e){let t=getLastUserPromptText(e)??`Hello from Ash`,n=getSystemPromptLabels(e),r=resolveSystemProbe(e);return n.length>0?r===null?`Bootstrap reply [${n.join(`, `)}]: ${t}`:`Bootstrap reply [${n.join(`, `)}; probe=${r}]: ${t}`:r===null?`Bootstrap reply: ${t}`:`Bootstrap reply [probe=${r}]: ${t}`}function formatToolResultReply(e,t){if(e.isError)return`Local weather tool failed: ${formatToolOutput(e.output)}`;if(isWeatherPayload(e.output))return`Used local weather tool for ${e.output.city}: ${e.output.condition}, ${e.output.temperatureF}F. ${e.output.summary}`;let n=getLastUserPromptText(t)??`Hello from Ash`;return`Used ${e.toolName} for "${n}": ${formatToolOutput(e.output)}`}function createToolCallGenerateResult(e){return{content:[{input:JSON.stringify(e.input),toolCallId:e.toolCallId,toolName:e.toolName,type:`tool-call`}],finishReason:`tool-calls`,response:{id:`bootstrap-response`,modelId:e.modelId,timestamp:new Date(`2026-03-16T00:00:00.000Z`)},usage:{inputTokens:{cacheRead:0,cacheWrite:0,noCache:e.inputTokens,total:e.inputTokens},outputTokens:{reasoning:0,text:e.outputTokens,total:e.outputTokens}},warnings:[]}}function getAvailableTools(e){return(e.tools??[]).flatMap(e=>e.type===`function`?[{description:e.description,name:e.name}]:[])}function getLastAuthoredToolResult(e){for(let t of[...e].reverse())if(!(t.role!==`tool`&&t.role!==`assistant`)){for(let e of[...t.content].reverse())if(!(typeof e==`string`||e.type!==`tool-result`)&&e.toolName!==LOAD_SKILL_TOOL_NAME)return{isError:e.output.type===`error-json`||e.output.type===`error-text`||e.output.type===`execution-denied`,output:e.output.type===`execution-denied`?{reason:e.output.reason??null,type:e.output.type}:e.output.value,toolCallId:e.toolCallId,toolName:e.toolName}}return null}function getSystemPromptLabels(e){let t=e.filter(e=>e.role===`system`);if(t.length===0)return[];let n=t.flatMap(e=>{let t=getPromptContentText(e.content);if(t.startsWith(`Available skills
2
2
  `))return[];let n=t.split(`
3
3
  `).map(e=>e.trim()).filter(e=>e.length>0),i=[];for(let e of n){if(e===BOOTSTRAP_RUNTIME_SYSTEM_PROMPT||e===`Available skills`)continue;let t=/^System \((.+)\)$/.exec(e);if(t?.[1]){i.push(t[1]);continue}let n=/^Skill \((.+)\)$/.exec(e);n?.[1]&&i.push(n[1])}if(i.length>0)return i;let a=n.find(e=>e!==BOOTSTRAP_RUNTIME_SYSTEM_PROMPT&&e!==`Available skills`);return a===void 0?[]:[a]});return[...new Set(n)]}function getActivatedSkillIds(e){return e.filter(e=>e.role===`system`).flatMap(e=>getPromptContentText(e.content).split(`
4
4
  `).map(e=>e.trim()).flatMap(e=>{let t=/^Skill \((.+)\)$/.exec(e);return t?.[1]===void 0?[]:[t[1]]}))}function getAvailableSkills(e){let t=new Map;for(let n of e){if(n.role!==`system`)continue;let e=getPromptContentText(n.content);if(e.startsWith(`Available skills
@@ -1 +1 @@
1
- import{getRuntimeCompiledArtifactsCacheKey}from"#runtime/compiled-artifacts-source.js";import{resolveRuntimeCompilerArtifactPaths}from"#runtime/loaders/artifact-paths.js";import{loadCompileMetadata}from"#runtime/loaders/compile-metadata.js";async function resolveRuntimeCompiledArtifactsVersionedCacheKey(t){let r=getRuntimeCompiledArtifactsCacheKey(t),i=await resolveCompileMetadataMtimeMs(t);try{let e=(await loadCompileMetadata({compiledArtifactsSource:t}))?.discovery.sourceGraphHash;return e===void 0||e.length===0?i===void 0?r:`${r}:mtime-${formatMtimeMsForCacheKey(i)}`:i===void 0?`${r}:${e}`:`${r}:${e}:mtime-${formatMtimeMsForCacheKey(i)}`}catch{return i===void 0?r:`${r}:mtime-${formatMtimeMsForCacheKey(i)}`}}async function resolveCompileMetadataMtimeMs(e){if(e.kind!==`disk`)return;let{stat:n}=await import(`node:fs/promises`),{compileMetadataPath:r}=resolveRuntimeCompilerArtifactPaths(e.appRoot);try{return(await n(r)).mtimeMs}catch{return}}function formatMtimeMsForCacheKey(e){return Math.floor(e).toString(36)}export{resolveRuntimeCompiledArtifactsVersionedCacheKey};
1
+ import{getRuntimeCompiledArtifactsCacheKey}from"#runtime/compiled-artifacts-source.js";import{loadCompileMetadata}from"#runtime/loaders/compile-metadata.js";import{resolveRuntimeCompilerArtifactPaths}from"#runtime/loaders/artifact-paths.js";async function resolveRuntimeCompiledArtifactsVersionedCacheKey(n){let r=getRuntimeCompiledArtifactsCacheKey(n),i=await resolveCompileMetadataMtimeMs(n);try{let e=(await loadCompileMetadata({compiledArtifactsSource:n}))?.discovery.sourceGraphHash;return e===void 0||e.length===0?i===void 0?r:`${r}:mtime-${formatMtimeMsForCacheKey(i)}`:i===void 0?`${r}:${e}`:`${r}:${e}:mtime-${formatMtimeMsForCacheKey(i)}`}catch{return i===void 0?r:`${r}:mtime-${formatMtimeMsForCacheKey(i)}`}}async function resolveCompileMetadataMtimeMs(e){if(e.kind!==`disk`)return;let{stat:t}=await import(`node:fs/promises`),{compileMetadataPath:r}=resolveRuntimeCompilerArtifactPaths(e.appRoot);try{return(await t(r)).mtimeMs}catch{return}}function formatMtimeMsForCacheKey(e){return Math.floor(e).toString(36)}export{resolveRuntimeCompiledArtifactsVersionedCacheKey};
@@ -1 +1 @@
1
- import{getAdapterKind}from"#channel/adapter.js";import{SUBAGENT_ADAPTER}from"#execution/subagent-adapter.js";import{SCHEDULE_ADAPTER}from"#channel/schedule.js";import{HTTP_ADAPTER}from"#channel/http.js";import{RuntimeRegistryError}from"#internal/runtime-registry.js";var FRAMEWORK_ADAPTERS=[HTTP_ADAPTER,SUBAGENT_ADAPTER,SCHEDULE_ADAPTER],ADAPTER_NON_EVENT_FIELDS=new Set([`kind`,`state`,`deliver`,`createAdapterContext`,`fetchFile`]);function createRuntimeAdapterRegistry(e){let t=new Map,n=new Set;for(let e of FRAMEWORK_ADAPTERS){let r=requireAdapterKind(e);n.add(r),t.set(r,e)}for(let r of e.channels){if(r.adapter===void 0)continue;let e={logicalPath:r.logicalPath,sourceId:r.sourceId},i=r.adapter,a=requireAdapterKind(i,e);if(n.has(a)){if(carriesAdapterBehavior(i))throw new RuntimeRegistryError(`adapter`,`Channel adapter kind "${a}" is reserved by the framework. A route-declared adapter may share a framework kind only as a pass-through with no \`deliver\` hook, event handlers, \`attachments\` resolver, or \`createAdapterContext\` factory. Use a custom \`kind\` to add channel-specific behavior.`,{...e,entryName:a});continue}t.set(a,i)}return{adaptersByKind:t}}function deserializeRuntimeAdapter(e,t){let n=t,r=e.adaptersByKind.get(n.kind);if(r===void 0)throw Error(`Unknown adapter kind: "${n.kind}". Declare the adapter on the route that starts this session so the runtime can rehydrate it.`);return{...r,state:n.state}}function requireAdapterKind(t,n){let r=getAdapterKind(t);if(typeof r!=`string`||r.length===0)throw new RuntimeRegistryError(`adapter`,"Adapters must declare a non-empty `kind` field.",{entryName:`unknown`,logicalPath:n?.logicalPath,sourceId:n?.sourceId});return r}function carriesAdapterBehavior(e){if(e.deliver!==void 0||e.fetchFile!==void 0||e.createAdapterContext!==void 0)return!0;for(let[t,n]of Object.entries(e))if(!ADAPTER_NON_EVENT_FIELDS.has(t)&&typeof n==`function`)return!0;return!1}export{createRuntimeAdapterRegistry,deserializeRuntimeAdapter};
1
+ import{getAdapterKind}from"#channel/adapter.js";import{SUBAGENT_ADAPTER}from"#execution/subagent-adapter.js";import{SCHEDULE_ADAPTER}from"#channel/schedule.js";import{HTTP_ADAPTER}from"#channel/http.js";import{RuntimeRegistryError}from"#internal/runtime-registry.js";const FRAMEWORK_ADAPTERS=[HTTP_ADAPTER,SUBAGENT_ADAPTER,SCHEDULE_ADAPTER],ADAPTER_NON_EVENT_FIELDS=new Set([`kind`,`state`,`deliver`,`createAdapterContext`,`fetchFile`]);function createRuntimeAdapterRegistry(e){let t=new Map,n=new Set;for(let e of FRAMEWORK_ADAPTERS){let r=requireAdapterKind(e);n.add(r),t.set(r,e)}for(let r of e.channels){if(r.adapter===void 0)continue;let e={logicalPath:r.logicalPath,sourceId:r.sourceId},i=r.adapter,a=requireAdapterKind(i,e);if(n.has(a)){if(carriesAdapterBehavior(i))throw new RuntimeRegistryError(`adapter`,`Channel adapter kind "${a}" is reserved by the framework. A route-declared adapter may share a framework kind only as a pass-through with no \`deliver\` hook, event handlers, \`attachments\` resolver, or \`createAdapterContext\` factory. Use a custom \`kind\` to add channel-specific behavior.`,{...e,entryName:a});continue}t.set(a,i)}return{adaptersByKind:t}}function deserializeRuntimeAdapter(e,t){let n=t,r=e.adaptersByKind.get(n.kind);if(r===void 0)throw Error(`Unknown adapter kind: "${n.kind}". Declare the adapter on the route that starts this session so the runtime can rehydrate it.`);return{...r,state:n.state}}function requireAdapterKind(t,n){let r=getAdapterKind(t);if(typeof r!=`string`||r.length===0)throw new RuntimeRegistryError(`adapter`,"Adapters must declare a non-empty `kind` field.",{entryName:`unknown`,logicalPath:n?.logicalPath,sourceId:n?.sourceId});return r}function carriesAdapterBehavior(e){if(e.deliver!==void 0||e.fetchFile!==void 0||e.createAdapterContext!==void 0)return!0;for(let[t,n]of Object.entries(e))if(!ADAPTER_NON_EVENT_FIELDS.has(t)&&typeof n==`function`)return!0;return!1}export{createRuntimeAdapterRegistry,deserializeRuntimeAdapter};
@@ -1 +1 @@
1
- import{ContextKey}from"#context/key.js";var ConnectionAuthorizationTokensKey=new ContextKey(`ash.connectionAuthorizationTokens`);function readCachedToken(e,t,n){let r=e.get(ConnectionAuthorizationTokensKey)?.[t]?.[n];if(r!==void 0&&!(r.expiresAt!==void 0&&r.expiresAt<=Date.now()))return r}function writeCachedToken(e,t,n,r){let i=e.get(ConnectionAuthorizationTokensKey)??{},a=i[t]??{};asContainer(e).setVirtualContext(ConnectionAuthorizationTokensKey,{...i,[t]:{...a,[n]:r}})}function asContainer(e){return e}export{ConnectionAuthorizationTokensKey,readCachedToken,writeCachedToken};
1
+ import{ContextKey}from"#context/key.js";const ConnectionAuthorizationTokensKey=new ContextKey(`ash.connectionAuthorizationTokens`);function readCachedToken(e,t,n){let r=e.get(ConnectionAuthorizationTokensKey)?.[t]?.[n];if(r!==void 0&&!(r.expiresAt!==void 0&&r.expiresAt<=Date.now()))return r}function writeCachedToken(e,t,n,r){let i=e.get(ConnectionAuthorizationTokensKey)??{},a=i[t]??{};asContainer(e).setVirtualContext(ConnectionAuthorizationTokensKey,{...i,[t]:{...a,[n]:r}})}function asContainer(e){return e}export{ConnectionAuthorizationTokensKey,readCachedToken,writeCachedToken};
@@ -1 +1 @@
1
- import{ASH_CONNECTION_CALLBACK_ROUTE_PATTERN}from"#protocol/routes.js";import{resumeHook}from"#compiled/@workflow/core/runtime.js";import{buildAuthorizationCompletePage}from"#runtime/connections/authorization-complete-page.js";var HTTP_CONNECTION_CALLBACK_CHANNEL_NAME_PREFIX=`ash/v1/connections/callback`,HANDLED_METHODS=[`GET`,`POST`];function getConnectionCallbackChannelDefinitions(){return HANDLED_METHODS.map(e=>buildCallbackChannelDefinition(e))}function getConnectionCallbackChannelNames(){return new Set(HANDLED_METHODS.map(channelNameForMethod))}function buildCallbackChannelDefinition(t){let n=channelNameForMethod(t);return{name:n,method:t,urlPath:ASH_CONNECTION_CALLBACK_ROUTE_PATTERN,fetch:handleConnectionCallbackRequest,logicalPath:`framework://channels/${n}`,sourceId:`ash:framework:connection-callback-${t.toLowerCase()}`,sourceKind:`module`}}function channelNameForMethod(e){return`${HTTP_CONNECTION_CALLBACK_CHANNEL_NAME_PREFIX}/${e.toLowerCase()}`}async function handleConnectionCallbackRequest(e,r){let i=r.params.name,a=r.params.token;if(typeof i!=`string`||i.length===0)return Response.json({error:`Missing connection name.`,ok:!1},{status:400});if(typeof a!=`string`||a.length===0)return Response.json({error:`Missing callback token.`,ok:!1},{status:400});let o=await projectAuthorizationCallback(e);try{await resumeHook(a,o)}catch{return Response.json({error:`Connection callback not pending.`,ok:!1},{status:404})}return buildAuthorizationCompletePage()}async function projectAuthorizationCallback(e){let t={};e.headers.forEach((e,n)=>{t[n]=e});let n=``;if(e.method!==`GET`&&e.method!==`HEAD`)try{n=await e.text()}catch{n=``}return{body:n,headers:t,method:e.method,url:e.url}}export{HTTP_CONNECTION_CALLBACK_CHANNEL_NAME_PREFIX,getConnectionCallbackChannelDefinitions,getConnectionCallbackChannelNames,handleConnectionCallbackRequest};
1
+ import{ASH_CONNECTION_CALLBACK_ROUTE_PATTERN}from"#protocol/routes.js";import{resumeHook}from"#compiled/@workflow/core/runtime.js";import{buildAuthorizationCompletePage}from"#runtime/connections/authorization-complete-page.js";const HTTP_CONNECTION_CALLBACK_CHANNEL_NAME_PREFIX=`ash/v1/connections/callback`,HANDLED_METHODS=[`GET`,`POST`];function getConnectionCallbackChannelDefinitions(){return HANDLED_METHODS.map(e=>buildCallbackChannelDefinition(e))}function getConnectionCallbackChannelNames(){return new Set(HANDLED_METHODS.map(channelNameForMethod))}function buildCallbackChannelDefinition(t){let n=channelNameForMethod(t);return{name:n,method:t,urlPath:ASH_CONNECTION_CALLBACK_ROUTE_PATTERN,fetch:handleConnectionCallbackRequest,logicalPath:`framework://channels/${n}`,sourceId:`ash:framework:connection-callback-${t.toLowerCase()}`,sourceKind:`module`}}function channelNameForMethod(e){return`${HTTP_CONNECTION_CALLBACK_CHANNEL_NAME_PREFIX}/${e.toLowerCase()}`}async function handleConnectionCallbackRequest(e,r){let i=r.params.name,a=r.params.token;if(typeof i!=`string`||i.length===0)return Response.json({error:`Missing connection name.`,ok:!1},{status:400});if(typeof a!=`string`||a.length===0)return Response.json({error:`Missing callback token.`,ok:!1},{status:400});let o=await projectAuthorizationCallback(e);try{await resumeHook(a,o)}catch{return Response.json({error:`Connection callback not pending.`,ok:!1},{status:404})}return buildAuthorizationCompletePage()}async function projectAuthorizationCallback(e){let t={};e.headers.forEach((e,n)=>{t[n]=e});let n=``;if(e.method!==`GET`&&e.method!==`HEAD`)try{n=await e.text()}catch{n=``}return{body:n,headers:t,method:e.method,url:e.url}}export{HTTP_CONNECTION_CALLBACK_CHANNEL_NAME_PREFIX,getConnectionCallbackChannelDefinitions,getConnectionCallbackChannelNames,handleConnectionCallbackRequest};
@@ -1 +1 @@
1
- import{ContextKey}from"#context/key.js";var ConnectionPrincipalOverrideStackKey=new ContextKey(`ash.connection-principal-override-stack`);function lookupConnectionPrincipalOverride(e,n){let r=e?.get(ConnectionPrincipalOverrideStackKey);if(r!==void 0)for(let e=r.length-1;e>=0;e--){let t=r[e];if(t===void 0)continue;let i=t.overrides[n];if(i!==void 0)return i}}async function withConnectionPrincipalOverride(e,n,r){let i={overrides:n},a=e.get(ConnectionPrincipalOverrideStackKey)??[];e.setVirtualContext(ConnectionPrincipalOverrideStackKey,[...a,i]);try{return await r()}finally{let n=e.get(ConnectionPrincipalOverrideStackKey)??[];e.setVirtualContext(ConnectionPrincipalOverrideStackKey,n.filter(e=>e!==i))}}export{ConnectionPrincipalOverrideStackKey,lookupConnectionPrincipalOverride,withConnectionPrincipalOverride};
1
+ import{ContextKey}from"#context/key.js";const ConnectionPrincipalOverrideStackKey=new ContextKey(`ash.connection-principal-override-stack`);function lookupConnectionPrincipalOverride(e,n){let r=e?.get(ConnectionPrincipalOverrideStackKey);if(r!==void 0)for(let e=r.length-1;e>=0;e--){let t=r[e];if(t===void 0)continue;let i=t.overrides[n];if(i!==void 0)return i}}async function withConnectionPrincipalOverride(e,n,r){let i={overrides:n},a=e.get(ConnectionPrincipalOverrideStackKey)??[];e.setVirtualContext(ConnectionPrincipalOverrideStackKey,[...a,i]);try{return await r()}finally{let n=e.get(ConnectionPrincipalOverrideStackKey)??[];e.setVirtualContext(ConnectionPrincipalOverrideStackKey,n.filter(e=>e!==i))}}export{ConnectionPrincipalOverrideStackKey,lookupConnectionPrincipalOverride,withConnectionPrincipalOverride};
@@ -1 +1 @@
1
- import{contextStorage}from"#context/container.js";import{AuthKey}from"#context/keys.js";import{ConnectionAuthorizationFailedError}from"#public/connections/errors.js";import{lookupConnectionPrincipalOverride}from"#runtime/connections/principal-context.js";function principalKey(e){return e.type===`app`?`app`:`user:${e.issuer}:${e.id}`}function resolveConnectionPrincipal(t,n,r=contextStorage.getStore()){let i=lookupConnectionPrincipalOverride(r,t);if(i!==void 0)return i;if(n.principalType===`app`)return{type:`app`};let a=r?.get(AuthKey);if(a==null||a.principalType!==`user`)throw new ConnectionAuthorizationFailedError(t,{message:r===void 0?`Connection "${t}" declares principalType "user" but was invoked outside an Ash context, so no user principal can be resolved.`:`Connection "${t}" declares principalType "user" but the active session has no authenticated user principal.`,reason:`principal_required`,retryable:!1});return{attributes:a.attributes,id:a.principalId,issuer:a.issuer??a.authenticator,type:`user`}}export{principalKey,resolveConnectionPrincipal};
1
+ import{AuthKey}from"#context/keys.js";import{contextStorage}from"#context/container.js";import{ConnectionAuthorizationFailedError}from"#public/connections/errors.js";import{lookupConnectionPrincipalOverride}from"#runtime/connections/principal-context.js";function principalKey(e){return e.type===`app`?`app`:`user:${e.issuer}:${e.id}`}function resolveConnectionPrincipal(t,n,r=contextStorage.getStore()){let i=lookupConnectionPrincipalOverride(r,t);if(i!==void 0)return i;if(n.principalType===`app`)return{type:`app`};let a=r?.get(AuthKey);if(a==null||a.principalType!==`user`)throw new ConnectionAuthorizationFailedError(t,{message:r===void 0?`Connection "${t}" declares principalType "user" but was invoked outside an Ash context, so no user principal can be resolved.`:`Connection "${t}" declares principalType "user" but the active session has no authenticated user principal.`,reason:`principal_required`,retryable:!1});return{attributes:a.attributes,id:a.principalId,issuer:a.issuer??a.authenticator,type:`user`}}export{principalKey,resolveConnectionPrincipal};
@@ -1 +1 @@
1
- import{none,vercelOidc}from"#public/channels/auth.js";import{ashChannel}from"#public/channels/ash.js";import{getConnectionCallbackChannelDefinitions,getConnectionCallbackChannelNames}from"#runtime/connections/callback-route.js";import{getSessionCallbackChannelDefinitions,getSessionCallbackChannelNames}from"#runtime/session-callback-route.js";var ASH_CHANNEL_NAME=`ash`;function getFrameworkChannelDefinitions(){let e=ashChannel({auth:resolveFrameworkAshAuth()}),t=[];for(let n of e.routes)t.push({name:ASH_CHANNEL_NAME,method:n.method.toUpperCase(),urlPath:n.path,fetch:async(e,t)=>n.handler(e,t),handler:n.handler,adapter:e.adapter,logicalPath:`framework://channels/${n.path}`,sourceId:`ash:framework:${n.method.toLowerCase()}-${n.path}`,sourceKind:`module`});return t.push(...getConnectionCallbackChannelDefinitions(),...getSessionCallbackChannelDefinitions()),t}function getAllFrameworkChannelNames(){return new Set([ASH_CHANNEL_NAME,...getConnectionCallbackChannelNames(),...getSessionCallbackChannelNames()])}function resolveFrameworkAshAuth(){return process.env.VERCEL?vercelOidc():none()}export{getAllFrameworkChannelNames,getFrameworkChannelDefinitions};
1
+ import{none,vercelOidc}from"#public/channels/auth.js";import{ashChannel}from"#public/channels/ash.js";import{getConnectionCallbackChannelDefinitions,getConnectionCallbackChannelNames}from"#runtime/connections/callback-route.js";import{getSessionCallbackChannelDefinitions,getSessionCallbackChannelNames}from"#runtime/session-callback-route.js";function getFrameworkChannelDefinitions(){let e=ashChannel({auth:resolveFrameworkAshAuth()}),t=[];for(let n of e.routes)t.push({name:`ash`,method:n.method.toUpperCase(),urlPath:n.path,fetch:async(e,t)=>n.handler(e,t),handler:n.handler,adapter:e.adapter,logicalPath:`framework://channels/${n.path}`,sourceId:`ash:framework:${n.method.toLowerCase()}-${n.path}`,sourceKind:`module`});return t.push(...getConnectionCallbackChannelDefinitions(),...getSessionCallbackChannelDefinitions()),t}function getAllFrameworkChannelNames(){return new Set([`ash`,...getConnectionCallbackChannelNames(),...getSessionCallbackChannelNames()])}function resolveFrameworkAshAuth(){return process.env.VERCEL?vercelOidc():none()}export{getAllFrameworkChannelNames,getFrameworkChannelDefinitions};
@@ -1 +1 @@
1
- import{z}from"#compiled/zod/index.js";import{inputRequestSchema}from"#runtime/input/types.js";var ASK_QUESTION_TOOL_NAME=`ask_question`,askQuestionToolInputSchema=inputRequestSchema.omit({action:!0,display:!0,requestId:!0}),{$schema:_jsonSchemaVersion,...askQuestionInputSchema}=z.toJSONSchema(askQuestionToolInputSchema),ASK_QUESTION_INPUT_SCHEMA=askQuestionInputSchema,ASK_QUESTION_TOOL_DEFINITION={description:`Ask the user a question and wait for their response before continuing. Use this when you need clarification or a choice from the user.`,inputSchema:ASK_QUESTION_INPUT_SCHEMA,logicalPath:`ash:framework/ask-question`,name:ASK_QUESTION_TOOL_NAME,sourceId:`ash:ask-question-tool`,sourceKind:`module`};export{ASK_QUESTION_INPUT_SCHEMA,ASK_QUESTION_TOOL_DEFINITION,ASK_QUESTION_TOOL_NAME};
1
+ import{z}from"#compiled/zod/index.js";import{inputRequestSchema}from"#runtime/input/types.js";const ASK_QUESTION_TOOL_NAME=`ask_question`,askQuestionToolInputSchema=inputRequestSchema.omit({action:!0,display:!0,requestId:!0}),{$schema:_jsonSchemaVersion,...askQuestionInputSchema}=z.toJSONSchema(askQuestionToolInputSchema),ASK_QUESTION_INPUT_SCHEMA=askQuestionInputSchema,ASK_QUESTION_TOOL_DEFINITION={description:`Ask the user a question and wait for their response before continuing. Use this when you need clarification or a choice from the user.`,inputSchema:ASK_QUESTION_INPUT_SCHEMA,logicalPath:`ash:framework/ask-question`,name:ASK_QUESTION_TOOL_NAME,sourceId:`ash:ask-question-tool`,sourceKind:`module`};export{ASK_QUESTION_INPUT_SCHEMA,ASK_QUESTION_TOOL_DEFINITION,ASK_QUESTION_TOOL_NAME};
@@ -1 +1 @@
1
- import{executeBashOnSandbox}from"#execution/sandbox/bash-tool.js";var BASH_INPUT_SCHEMA={additionalProperties:!1,properties:{command:{description:`The shell command to execute.`,type:`string`}},required:[`command`],type:`object`};async function executeBash(e){return executeBashOnSandbox(e)}var BASH_TOOL_DEFINITION={description:`Execute a shell command in the shared workspace environment.`,execute:executeBash,inputSchema:BASH_INPUT_SCHEMA,logicalPath:`ash:framework/bash`,name:`bash`,sourceId:`ash:bash-tool`,sourceKind:`module`};export{BASH_INPUT_SCHEMA,BASH_TOOL_DEFINITION};
1
+ import{executeBashOnSandbox}from"#execution/sandbox/bash-tool.js";const BASH_INPUT_SCHEMA={additionalProperties:!1,properties:{command:{description:`The shell command to execute.`,type:`string`}},required:[`command`],type:`object`};async function executeBash(e){return executeBashOnSandbox(e)}const BASH_TOOL_DEFINITION={description:`Execute a shell command in the shared workspace environment.`,execute:executeBash,inputSchema:BASH_INPUT_SCHEMA,logicalPath:`ash:framework/bash`,name:`bash`,sourceId:`ash:bash-tool`,sourceKind:`module`};export{BASH_INPUT_SCHEMA,BASH_TOOL_DEFINITION};
@@ -1 +1 @@
1
- import{createLogger}from"#internal/logging.js";import{loadContext}from"#context/container.js";import{ContextKey}from"#context/key.js";import{CONNECTION_AUTHORIZATION_PLACEHOLDER,PendingConnectionToolCallsKey,appendPendingConnectionToolCalls}from"#runtime/framework-tools/pending-connection-tool-calls.js";import{isConnectionAuthorizationFailedError,isConnectionAuthorizationRequiredError}from"#public/connections/errors.js";import{qualifiedConnectionToolName}from"#runtime/framework-tools/connection-tools.js";import{supportsInteractiveAuthorization}from"#runtime/connections/types.js";var logger=createLogger(`framework.connection-search`),ConnectionRegistryKey=new ContextKey(`ash.connectionRegistry`),DiscoveredConnectionToolsKey=new ContextKey(`ash.discoveredConnectionTools`),CONNECTION_SEARCH_TOOL_DEFINITION={description:`Search for tools across your connections. Discovered tools become directly callable by their qualified name (e.g. linear__list_issues) in your next response.`,execute:async(e,t)=>{let n=typeof t==`object`&&t&&`toolCallId`in t?t.toolCallId:void 0;return executeConnectionSearch(e,{toolCallId:typeof n==`string`?n:void 0})},inputSchema:{additionalProperties:!1,properties:{connection:{description:`Optional: limit search to a specific connection name.`,type:`string`},limit:{description:`Max results to return. Default 10.`,type:`number`},keywords:{description:`Search keywords and expanded aliases. Distill intent into keywords; avoid stop words like 'a', 'the', 'in'.`,type:`string`}},required:[`keywords`],type:`object`},logicalPath:`ash:framework/connection-search`,name:`connection_search`,onCompact({ctx:e}){return e.set(DiscoveredConnectionToolsKey,{byConnection:{}}),e.set(PendingConnectionToolCallsKey,[]),{}},sourceId:`ash:connection-search-tool`,sourceKind:`module`};async function executeConnectionSearch(e,n){let a=loadContext(),o=a.get(ConnectionRegistryKey);if(o===void 0)return[];let s=e.limit??10,c=tokenize(e.keywords),l=[],u=[],d=e.connection!==void 0&&e.connection!==``?o.getConnections().filter(t=>t.connectionName===e.connection):o.getConnections(),f={...a.get(DiscoveredConnectionToolsKey)?.byConnection},p=[];for(let e of d){let t;try{t=await o.getClient(e.connectionName).getToolMetadata()}catch(t){if(isConnectionAuthorizationRequiredError(t)){p.push(e.connectionName),u.push({connection:e.connectionName,description:e.description,needsAuthorization:!0});continue}if(isConnectionAuthorizationFailedError(t)){logger.warn(`connection authorization failed`,{connection:e.connectionName,reason:t.reason,retryable:t.retryable,error:t}),u.push({connection:e.connectionName,description:e.description,error:`Authorization failed for ${e.connectionName}: ${t.message}`});continue}let n=t instanceof Error?t.message:`unknown error`;logger.warn(`failed to load connection tools`,{connection:e.connectionName,error:t instanceof Error?t:Error(n)}),u.push({connection:e.connectionName,description:e.description,error:`Failed to load tools for "${e.connectionName}": ${n}`});continue}f[e.connectionName]=t;for(let n of t){let t=scoreMatch(c,n);t>0&&l.push({item:{connection:e.connectionName,description:n.description,inputSchema:n.inputSchema,qualifiedName:qualifiedConnectionToolName(e.connectionName,n.name),tool:n.name},score:t})}}a.set(DiscoveredConnectionToolsKey,{byConnection:f});let m=p.filter(e=>isInteractive(o,e));if(m.length>0&&n?.toolCallId!==void 0){let t=a.get(PendingConnectionToolCallsKey);return a.set(PendingConnectionToolCallsKey,appendPendingConnectionToolCalls(t,[{args:e,connectionNames:m,kind:`connection-discover`,toolCallId:n.toolCallId,toolName:`connection_search`}])),CONNECTION_AUTHORIZATION_PLACEHOLDER}l.sort((e,t)=>t.score-e.score);let h=l.slice(0,s).map(e=>e.item);return h.length>0?[...h,...u]:d.map(e=>u.find(t=>t.connection===e.connectionName)||{connection:e.connectionName,description:e.description})}function tokenize(e){return e.toLowerCase().split(/[\s_\-./]+/).filter(e=>e.length>1)}function scoreMatch(e,t){let n=tokenize(t.name),r=tokenize(t.description),i=0;for(let t of e){for(let e of n)(e.includes(t)||t.includes(e))&&(i+=3);for(let e of r)(e.includes(t)||t.includes(e))&&(i+=1)}return i}function isInteractive(e,t){return e===void 0?!1:supportsInteractiveAuthorization(e.getConnections().find(e=>e.connectionName===t)?.authorization)}export{CONNECTION_SEARCH_TOOL_DEFINITION,ConnectionRegistryKey,DiscoveredConnectionToolsKey,executeConnectionSearch,scoreMatch,tokenize};
1
+ import{createLogger}from"#internal/logging.js";import{loadContext}from"#context/container.js";import{ContextKey}from"#context/key.js";import{CONNECTION_AUTHORIZATION_PLACEHOLDER,PendingConnectionToolCallsKey,appendPendingConnectionToolCalls}from"#runtime/framework-tools/pending-connection-tool-calls.js";import{isConnectionAuthorizationFailedError,isConnectionAuthorizationRequiredError}from"#public/connections/errors.js";import{qualifiedConnectionToolName}from"#runtime/framework-tools/connection-tools.js";import{supportsInteractiveAuthorization}from"#runtime/connections/types.js";const logger=createLogger(`framework.connection-search`),ConnectionRegistryKey=new ContextKey(`ash.connectionRegistry`),DiscoveredConnectionToolsKey=new ContextKey(`ash.discoveredConnectionTools`),CONNECTION_SEARCH_TOOL_DEFINITION={description:`Search for tools across your connections. Discovered tools become directly callable by their qualified name (e.g. linear__list_issues) in your next response.`,execute:async(e,t)=>{let n=typeof t==`object`&&t&&`toolCallId`in t?t.toolCallId:void 0;return executeConnectionSearch(e,{toolCallId:typeof n==`string`?n:void 0})},inputSchema:{additionalProperties:!1,properties:{connection:{description:`Optional: limit search to a specific connection name.`,type:`string`},limit:{description:`Max results to return. Default 10.`,type:`number`},keywords:{description:`Search keywords and expanded aliases. Distill intent into keywords; avoid stop words like 'a', 'the', 'in'.`,type:`string`}},required:[`keywords`],type:`object`},logicalPath:`ash:framework/connection-search`,name:`connection_search`,onCompact({ctx:e}){return e.set(DiscoveredConnectionToolsKey,{byConnection:{}}),e.set(PendingConnectionToolCallsKey,[]),{}},sourceId:`ash:connection-search-tool`,sourceKind:`module`};async function executeConnectionSearch(e,n){let a=loadContext(),o=a.get(ConnectionRegistryKey);if(o===void 0)return[];let s=e.limit??10,c=tokenize(e.keywords),l=[],u=[],d=e.connection!==void 0&&e.connection!==``?o.getConnections().filter(t=>t.connectionName===e.connection):o.getConnections(),f={...a.get(DiscoveredConnectionToolsKey)?.byConnection},p=[];for(let e of d){let t;try{t=await o.getClient(e.connectionName).getToolMetadata()}catch(t){if(isConnectionAuthorizationRequiredError(t)){p.push(e.connectionName),u.push({connection:e.connectionName,description:e.description,needsAuthorization:!0});continue}if(isConnectionAuthorizationFailedError(t)){logger.warn(`connection authorization failed`,{connection:e.connectionName,reason:t.reason,retryable:t.retryable,error:t}),u.push({connection:e.connectionName,description:e.description,error:`Authorization failed for ${e.connectionName}: ${t.message}`});continue}let n=t instanceof Error?t.message:`unknown error`;logger.warn(`failed to load connection tools`,{connection:e.connectionName,error:t instanceof Error?t:Error(n)}),u.push({connection:e.connectionName,description:e.description,error:`Failed to load tools for "${e.connectionName}": ${n}`});continue}f[e.connectionName]=t;for(let n of t){let t=scoreMatch(c,n);t>0&&l.push({item:{connection:e.connectionName,description:n.description,inputSchema:n.inputSchema,qualifiedName:qualifiedConnectionToolName(e.connectionName,n.name),tool:n.name},score:t})}}a.set(DiscoveredConnectionToolsKey,{byConnection:f});let m=p.filter(e=>isInteractive(o,e));if(m.length>0&&n?.toolCallId!==void 0){let t=a.get(PendingConnectionToolCallsKey);return a.set(PendingConnectionToolCallsKey,appendPendingConnectionToolCalls(t,[{args:e,connectionNames:m,kind:`connection-discover`,toolCallId:n.toolCallId,toolName:`connection_search`}])),CONNECTION_AUTHORIZATION_PLACEHOLDER}l.sort((e,t)=>t.score-e.score);let h=l.slice(0,s).map(e=>e.item);return h.length>0?[...h,...u]:d.map(e=>u.find(t=>t.connection===e.connectionName)||{connection:e.connectionName,description:e.description})}function tokenize(e){return e.toLowerCase().split(/[\s_\-./]+/).filter(e=>e.length>1)}function scoreMatch(e,t){let n=tokenize(t.name),r=tokenize(t.description),i=0;for(let t of e){for(let e of n)(e.includes(t)||t.includes(e))&&(i+=3);for(let e of r)(e.includes(t)||t.includes(e))&&(i+=1)}return i}function isInteractive(e,t){return e===void 0?!1:supportsInteractiveAuthorization(e.getConnections().find(e=>e.connectionName===t)?.authorization)}export{CONNECTION_SEARCH_TOOL_DEFINITION,ConnectionRegistryKey,DiscoveredConnectionToolsKey,executeConnectionSearch,scoreMatch,tokenize};
@@ -1 +1 @@
1
- import{posix}from"node:path";import{createHash}from"node:crypto";import{ContextKey}from"#context/key.js";var ReadFileStateKey=new ContextKey(`ash.readFile`);function normalizeModelPath(t){return posix.normalize(t)}function buildReadFileTargetKey(e){return e}function createReadFileStamp(e){let n=createHash(`sha256`).update(e.content,`utf8`).digest(`hex`);return{byteLength:Buffer.byteLength(e.content,`utf8`),contentHash:n,filePath:e.filePath}}function setReadFileStamp(e,t,n){let r=e.ensure(ReadFileStateKey,()=>({byTarget:{}}));e.set(ReadFileStateKey,{byTarget:{...r.byTarget,[t]:n}})}function clearReadFileState(e){e.set(ReadFileStateKey,{byTarget:{}})}export{ReadFileStateKey,buildReadFileTargetKey,clearReadFileState,createReadFileStamp,normalizeModelPath,setReadFileStamp};
1
+ import{posix}from"node:path";import{createHash}from"node:crypto";import{ContextKey}from"#context/key.js";const ReadFileStateKey=new ContextKey(`ash.readFile`);function normalizeModelPath(t){return posix.normalize(t)}function buildReadFileTargetKey(e){return e}function createReadFileStamp(e){let n=createHash(`sha256`).update(e.content,`utf8`).digest(`hex`);return{byteLength:Buffer.byteLength(e.content,`utf8`),contentHash:n,filePath:e.filePath}}function setReadFileStamp(e,t,n){let r=e.ensure(ReadFileStateKey,()=>({byTarget:{}}));e.set(ReadFileStateKey,{byTarget:{...r.byTarget,[t]:n}})}function clearReadFileState(e){e.set(ReadFileStateKey,{byTarget:{}})}export{ReadFileStateKey,buildReadFileTargetKey,clearReadFileState,createReadFileStamp,normalizeModelPath,setReadFileStamp};
@@ -1,2 +1,2 @@
1
- import{executeGlobOnSandbox}from"#execution/sandbox/glob-tool.js";var GLOB_INPUT_SCHEMA={additionalProperties:!1,properties:{limit:{description:`Maximum number of results to return. Defaults to 100.`,maximum:1e3,minimum:1,type:`integer`},path:{description:`The directory to search in. Defaults to /workspace. Must be an absolute path. Omit to use the default.`,type:`string`},pattern:{description:`The glob pattern to match files against (e.g. "**/*.ts", "src/**/*.js").`,type:`string`}},required:[`pattern`],type:`object`};async function executeGlob(e){return executeGlobOnSandbox(e)}var GLOB_TOOL_DEFINITION={description:[`Fast file pattern matching tool that works with any codebase size.`,``,`Usage:`,`- Supports glob patterns like "**/*.js" or "src/**/*.ts".`,`- Returns matching file paths.`,`- Use this tool when you need to find files by name patterns.`,`- If you are unsure of the correct file path, use the glob tool to look up filenames by glob pattern.`,`- Use the grep tool instead if you need to search file contents.`,`- Call this tool in parallel when you know there are multiple patterns to search for.`].join(`
1
+ import{executeGlobOnSandbox}from"#execution/sandbox/glob-tool.js";const GLOB_INPUT_SCHEMA={additionalProperties:!1,properties:{limit:{description:`Maximum number of results to return. Defaults to 100.`,maximum:1e3,minimum:1,type:`integer`},path:{description:`The directory to search in. Defaults to /workspace. Must be an absolute path. Omit to use the default.`,type:`string`},pattern:{description:`The glob pattern to match files against (e.g. "**/*.ts", "src/**/*.js").`,type:`string`}},required:[`pattern`],type:`object`};async function executeGlob(e){return executeGlobOnSandbox(e)}const GLOB_TOOL_DEFINITION={description:[`Fast file pattern matching tool that works with any codebase size.`,``,`Usage:`,`- Supports glob patterns like "**/*.js" or "src/**/*.ts".`,`- Returns matching file paths.`,`- Use this tool when you need to find files by name patterns.`,`- If you are unsure of the correct file path, use the glob tool to look up filenames by glob pattern.`,`- Use the grep tool instead if you need to search file contents.`,`- Call this tool in parallel when you know there are multiple patterns to search for.`].join(`
2
2
  `),execute:executeGlob,inputSchema:GLOB_INPUT_SCHEMA,logicalPath:`ash:framework/glob`,name:`glob`,sourceId:`ash:glob-tool`,sourceKind:`module`};export{GLOB_INPUT_SCHEMA,GLOB_TOOL_DEFINITION};
@@ -1,2 +1,2 @@
1
- import{executeGrepOnSandbox}from"#execution/sandbox/grep-tool.js";var GREP_INPUT_SCHEMA={additionalProperties:!1,properties:{context:{description:`Number of surrounding context lines to include before and after each match. Defaults to 0.`,minimum:0,type:`integer`},glob:{description:`Filter files by glob pattern (e.g. "*.ts", "*.{ts,tsx}").`,type:`string`},ignoreCase:{description:`Perform case-insensitive search. Defaults to false.`,type:`boolean`},limit:{description:`Maximum number of matches to return per file. Defaults to 100.`,maximum:1e3,minimum:1,type:`integer`},literal:{description:`Treat the pattern as a literal string instead of a regular expression. Defaults to false.`,type:`boolean`},path:{description:`The directory or file to search in. Defaults to /workspace. Must be an absolute path. Omit to use the default.`,type:`string`},pattern:{description:`The regex pattern to search for in file contents (e.g. "log.*Error", "function\\s+\\w+").`,type:`string`}},required:[`pattern`],type:`object`};async function executeGrep(e){return executeGrepOnSandbox(e)}var GREP_TOOL_DEFINITION={description:[`Fast content search tool that works with any codebase size.`,``,`Usage:`,`- Searches file contents using regular expressions.`,`- Supports full regex syntax (e.g. "log.*Error", "function\\s+\\w+").`,`- Filter files by pattern with the glob parameter (e.g. "*.js", "*.{ts,tsx}").`,`- Returns matching lines with file paths and line numbers.`,`- Use this tool when you need to find files containing specific patterns.`,`- Use the glob tool instead if you only need to find files by name.`,`- Call this tool in parallel when you have multiple independent searches.`,`- Any line longer than 2000 characters is truncated.`].join(`
1
+ import{executeGrepOnSandbox}from"#execution/sandbox/grep-tool.js";const GREP_INPUT_SCHEMA={additionalProperties:!1,properties:{context:{description:`Number of surrounding context lines to include before and after each match. Defaults to 0.`,minimum:0,type:`integer`},glob:{description:`Filter files by glob pattern (e.g. "*.ts", "*.{ts,tsx}").`,type:`string`},ignoreCase:{description:`Perform case-insensitive search. Defaults to false.`,type:`boolean`},limit:{description:`Maximum number of matches to return per file. Defaults to 100.`,maximum:1e3,minimum:1,type:`integer`},literal:{description:`Treat the pattern as a literal string instead of a regular expression. Defaults to false.`,type:`boolean`},path:{description:`The directory or file to search in. Defaults to /workspace. Must be an absolute path. Omit to use the default.`,type:`string`},pattern:{description:`The regex pattern to search for in file contents (e.g. "log.*Error", "function\\s+\\w+").`,type:`string`}},required:[`pattern`],type:`object`};async function executeGrep(e){return executeGrepOnSandbox(e)}const GREP_TOOL_DEFINITION={description:[`Fast content search tool that works with any codebase size.`,``,`Usage:`,`- Searches file contents using regular expressions.`,`- Supports full regex syntax (e.g. "log.*Error", "function\\s+\\w+").`,`- Filter files by pattern with the glob parameter (e.g. "*.js", "*.{ts,tsx}").`,`- Returns matching lines with file paths and line numbers.`,`- Use this tool when you need to find files containing specific patterns.`,`- Use the glob tool instead if you only need to find files by name.`,`- Call this tool in parallel when you have multiple independent searches.`,`- Any line longer than 2000 characters is truncated.`].join(`
2
2
  `),execute:executeGrep,inputSchema:GREP_INPUT_SCHEMA,logicalPath:`ash:framework/grep`,name:`grep`,sourceId:`ash:grep-tool`,sourceKind:`module`};export{GREP_INPUT_SCHEMA,GREP_TOOL_DEFINITION};
@@ -1 +1 @@
1
- import{CONNECTION_SEARCH_TOOL_DEFINITION,ConnectionRegistryKey}from"#runtime/framework-tools/connection-search.js";import{ReadFileStateKey}from"#runtime/framework-tools/file-state.js";import{ASK_QUESTION_TOOL_DEFINITION}from"#runtime/framework-tools/ask-question.js";import{WEB_SEARCH_TOOL_DEFINITION}from"#runtime/framework-tools/web-search.js";import{BASH_TOOL_DEFINITION}from"#runtime/framework-tools/bash.js";import{GLOB_TOOL_DEFINITION}from"#runtime/framework-tools/glob.js";import{GREP_TOOL_DEFINITION}from"#runtime/framework-tools/grep.js";import{READ_FILE_TOOL_DEFINITION}from"#runtime/framework-tools/read-file.js";import{SKILL_TOOL_DEFINITION}from"#runtime/framework-tools/skill.js";import{TODO_TOOL_DEFINITION,TodoStateKey}from"#runtime/framework-tools/todo.js";import{WEB_FETCH_TOOL_DEFINITION}from"#runtime/framework-tools/web-fetch.js";import{WRITE_FILE_TOOL_DEFINITION}from"#runtime/framework-tools/write-file.js";var ALL_FRAMEWORK_TOOLS=[ASK_QUESTION_TOOL_DEFINITION,BASH_TOOL_DEFINITION,GLOB_TOOL_DEFINITION,GREP_TOOL_DEFINITION,READ_FILE_TOOL_DEFINITION,WRITE_FILE_TOOL_DEFINITION,TODO_TOOL_DEFINITION,WEB_FETCH_TOOL_DEFINITION,WEB_SEARCH_TOOL_DEFINITION,SKILL_TOOL_DEFINITION,CONNECTION_SEARCH_TOOL_DEFINITION],CONDITIONAL_TOOLS=new Map([[CONNECTION_SEARCH_TOOL_DEFINITION,e=>e.hasConnections]]);function getFrameworkToolDefinitions(e){return ALL_FRAMEWORK_TOOLS.filter(t=>{let n=CONDITIONAL_TOOLS.get(t);return n===void 0||n(e)})}function getAllFrameworkToolNames(){return new Set(ALL_FRAMEWORK_TOOLS.map(e=>e.name))}export{ConnectionRegistryKey,ReadFileStateKey,TodoStateKey,getAllFrameworkToolNames,getFrameworkToolDefinitions};
1
+ import{CONNECTION_SEARCH_TOOL_DEFINITION,ConnectionRegistryKey}from"#runtime/framework-tools/connection-search.js";import{ReadFileStateKey}from"#runtime/framework-tools/file-state.js";import{ASK_QUESTION_TOOL_DEFINITION}from"#runtime/framework-tools/ask-question.js";import{WEB_SEARCH_TOOL_DEFINITION}from"#runtime/framework-tools/web-search.js";import{BASH_TOOL_DEFINITION}from"#runtime/framework-tools/bash.js";import{GLOB_TOOL_DEFINITION}from"#runtime/framework-tools/glob.js";import{GREP_TOOL_DEFINITION}from"#runtime/framework-tools/grep.js";import{READ_FILE_TOOL_DEFINITION}from"#runtime/framework-tools/read-file.js";import{SKILL_TOOL_DEFINITION}from"#runtime/framework-tools/skill.js";import{TODO_TOOL_DEFINITION,TodoStateKey}from"#runtime/framework-tools/todo.js";import{WEB_FETCH_TOOL_DEFINITION}from"#runtime/framework-tools/web-fetch.js";import{WRITE_FILE_TOOL_DEFINITION}from"#runtime/framework-tools/write-file.js";const ALL_FRAMEWORK_TOOLS=[ASK_QUESTION_TOOL_DEFINITION,BASH_TOOL_DEFINITION,GLOB_TOOL_DEFINITION,GREP_TOOL_DEFINITION,READ_FILE_TOOL_DEFINITION,WRITE_FILE_TOOL_DEFINITION,TODO_TOOL_DEFINITION,WEB_FETCH_TOOL_DEFINITION,WEB_SEARCH_TOOL_DEFINITION,SKILL_TOOL_DEFINITION,CONNECTION_SEARCH_TOOL_DEFINITION],CONDITIONAL_TOOLS=new Map([[CONNECTION_SEARCH_TOOL_DEFINITION,e=>e.hasConnections]]);function getFrameworkToolDefinitions(e){return ALL_FRAMEWORK_TOOLS.filter(t=>{let n=CONDITIONAL_TOOLS.get(t);return n===void 0||n(e)})}function getAllFrameworkToolNames(){return new Set(ALL_FRAMEWORK_TOOLS.map(e=>e.name))}export{ConnectionRegistryKey,ReadFileStateKey,TodoStateKey,getAllFrameworkToolNames,getFrameworkToolDefinitions};
@@ -1 +1 @@
1
- import{ContextKey}from"#context/key.js";var CONNECTION_AUTHORIZATION_PLACEHOLDER=Object.freeze({__ashPlaceholder:`connection-authorization`}),PendingConnectionToolCallsKey=new ContextKey(`ash.pendingConnectionToolCalls`);function appendPendingConnectionToolCalls(e,t){if(t.length===0)return e??[];let n=new Set,r=e??[];for(let e of r)n.add(e.toolCallId);let i=[...r];for(let e of t)n.has(e.toolCallId)||(n.add(e.toolCallId),i.push(e));return i}function isConnectionAuthorizationPlaceholder(e){return typeof e!=`object`||!e?!1:e.__ashPlaceholder===`connection-authorization`}export{CONNECTION_AUTHORIZATION_PLACEHOLDER,PendingConnectionToolCallsKey,appendPendingConnectionToolCalls,isConnectionAuthorizationPlaceholder};
1
+ import{ContextKey}from"#context/key.js";const CONNECTION_AUTHORIZATION_PLACEHOLDER=Object.freeze({__ashPlaceholder:`connection-authorization`}),PendingConnectionToolCallsKey=new ContextKey(`ash.pendingConnectionToolCalls`);function appendPendingConnectionToolCalls(e,t){if(t.length===0)return e??[];let n=new Set,r=e??[];for(let e of r)n.add(e.toolCallId);let i=[...r];for(let e of t)n.has(e.toolCallId)||(n.add(e.toolCallId),i.push(e));return i}function isConnectionAuthorizationPlaceholder(e){return typeof e!=`object`||!e?!1:e.__ashPlaceholder===`connection-authorization`}export{CONNECTION_AUTHORIZATION_PLACEHOLDER,PendingConnectionToolCallsKey,appendPendingConnectionToolCalls,isConnectionAuthorizationPlaceholder};
@@ -1,2 +1,2 @@
1
- import{clearReadFileState}from"#runtime/framework-tools/file-state.js";import{executeReadFileOnSandbox}from"#execution/sandbox/read-file-tool.js";var READ_FILE_INPUT_SCHEMA={additionalProperties:!1,properties:{filePath:{description:`The absolute path to the file to read.`,type:`string`},limit:{description:`Maximum number of lines to return. Defaults to 2000.`,minimum:1,type:`integer`},offset:{description:`1-based line number to start from. Defaults to 1.`,minimum:1,type:`integer`}},required:[`filePath`],type:`object`};async function executeReadFile(e){return executeReadFileOnSandbox(e)}var READ_FILE_TOOL_DEFINITION={description:[`Read a file from the local filesystem. If the path does not exist, an error is returned.`,``,`Usage:`,`- The filePath parameter should be an absolute path.`,`- By default, this tool returns up to 2000 lines from the start of the file.`,`- The offset parameter is the line number to start from (1-indexed).`,`- To read later sections, call this tool again with a larger offset.`,`- Use the grep tool to find specific content in large files or files with long lines.`,`- If you are unsure of the correct file path, use the glob tool to look up filenames by glob pattern.`,'- Contents are returned with each line prefixed by its line number as `<line>: <content>`. For example, if a file has contents "foo\\n", you will receive "1: foo\\n".',`- Any line longer than 2000 characters is truncated.`,`- Call this tool in parallel when you know there are multiple files you want to read.`,`- Avoid tiny repeated slices (30 line chunks). If you need more context, read a larger window.`].join(`
1
+ import{clearReadFileState}from"#runtime/framework-tools/file-state.js";import{executeReadFileOnSandbox}from"#execution/sandbox/read-file-tool.js";const READ_FILE_INPUT_SCHEMA={additionalProperties:!1,properties:{filePath:{description:`The absolute path to the file to read.`,type:`string`},limit:{description:`Maximum number of lines to return. Defaults to 2000.`,minimum:1,type:`integer`},offset:{description:`1-based line number to start from. Defaults to 1.`,minimum:1,type:`integer`}},required:[`filePath`],type:`object`};async function executeReadFile(e){return executeReadFileOnSandbox(e)}const READ_FILE_TOOL_DEFINITION={description:[`Read a file from the local filesystem. If the path does not exist, an error is returned.`,``,`Usage:`,`- The filePath parameter should be an absolute path.`,`- By default, this tool returns up to 2000 lines from the start of the file.`,`- The offset parameter is the line number to start from (1-indexed).`,`- To read later sections, call this tool again with a larger offset.`,`- Use the grep tool to find specific content in large files or files with long lines.`,`- If you are unsure of the correct file path, use the glob tool to look up filenames by glob pattern.`,'- Contents are returned with each line prefixed by its line number as `<line>: <content>`. For example, if a file has contents "foo\\n", you will receive "1: foo\\n".',`- Any line longer than 2000 characters is truncated.`,`- Call this tool in parallel when you know there are multiple files you want to read.`,`- Avoid tiny repeated slices (30 line chunks). If you need more context, read a larger window.`].join(`
2
2
  `),execute:executeReadFile,inputSchema:READ_FILE_INPUT_SCHEMA,logicalPath:`ash:framework/read-file`,name:`read_file`,onCompact({ctx:t}){return clearReadFileState(t),{}},sourceId:`ash:read-file-tool`,sourceKind:`module`};export{READ_FILE_INPUT_SCHEMA,READ_FILE_TOOL_DEFINITION};
@@ -1 +1 @@
1
- import{loadSkillFromSandbox}from"#runtime/skills/sandbox-access.js";import{loadContext}from"#context/container.js";import{SandboxKey}from"#context/keys.js";async function executeLoadSkillTool(t){let n=loadContext().get(SandboxKey);if(n===void 0)throw Error(`The load_skill tool requires sandbox access on the runtime context. Ensure the step is running inside a managed runtime context with sandbox support.`);let{skill:r}=t;return await loadSkillFromSandbox(n,r)}var SKILL_TOOL_DEFINITION={description:[`Load the full instructions for one available skill by name or id.`,`Use this tool when the request clearly matches a listed skill description or when the user explicitly asks for that skill.`,`Loading adds the skill instructions to the current turn.`,`Choose the "skill" value from the Available skills block.`].join(` `),execute:e=>executeLoadSkillTool(e),inputSchema:{additionalProperties:!1,properties:{skill:{description:`Available skill name or id.`,type:`string`}},required:[`skill`],type:`object`},logicalPath:`ash:framework/load-skill`,name:`load_skill`,retentionPolicy:`keep`,sourceId:`ash:load-skill-tool`,sourceKind:`module`};export{SKILL_TOOL_DEFINITION};
1
+ import{SandboxKey}from"#context/keys.js";import{loadSkillFromSandbox}from"#runtime/skills/sandbox-access.js";import{loadContext}from"#context/container.js";async function executeLoadSkillTool(t){let n=loadContext().get(SandboxKey);if(n===void 0)throw Error(`The load_skill tool requires sandbox access on the runtime context. Ensure the step is running inside a managed runtime context with sandbox support.`);let{skill:r}=t;return await loadSkillFromSandbox(n,r)}const SKILL_TOOL_DEFINITION={description:[`Load the full instructions for one available skill by name or id.`,`Use this tool when the request clearly matches a listed skill description or when the user explicitly asks for that skill.`,`Loading adds the skill instructions to the current turn.`,`Choose the "skill" value from the Available skills block.`].join(` `),execute:e=>executeLoadSkillTool(e),inputSchema:{additionalProperties:!1,properties:{skill:{description:`Available skill name or id.`,type:`string`}},required:[`skill`],type:`object`},logicalPath:`ash:framework/load-skill`,name:`load_skill`,retentionPolicy:`keep`,sourceId:`ash:load-skill-tool`,sourceKind:`module`};export{SKILL_TOOL_DEFINITION};
@@ -1,3 +1,3 @@
1
- import{loadContext}from"#context/container.js";import{ContextKey}from"#context/key.js";var TodoStateKey=new ContextKey(`ash.todo`);function formatTodoSummary(e){return e.items.length===0?void 0:`[Your task list was preserved across context compaction]\n${e.items.map(e=>`- [${e.status===`completed`?`x`:e.status===`cancelled`?`-`:` `}] [${e.priority}] ${e.content}`).join(`
2
- `)}`}function formatTodoResult(e){let{items:t}=e,n={cancelled:0,completed:0,in_progress:0,pending:0,total:t.length};for(let e of t)n[e.status]++;return{counts:n,todos:t}}function executeTodoTool(t){let r=loadContext(),{todos:i}=t??{};if(i!==void 0){let e={items:[...i]};return r.set(TodoStateKey,e),formatTodoResult(e)}return formatTodoResult(r.ensure(TodoStateKey,()=>({items:[]})))}var TODO_TOOL_DEFINITION={description:[`Use this tool to create and manage a structured task list for the current session.`,`This helps you track progress, organize complex tasks, and demonstrate thoroughness.`,``,`When to use:`,`- Complex multistep tasks requiring 3 or more distinct steps`,`- When the user provides multiple tasks or a numbered list`,`- After receiving new instructions, to capture requirements`,`- After completing a task, to mark it complete and add follow-ups`,``,`When NOT to use:`,`- Single, straightforward tasks that need no tracking`,`- Purely conversational or informational requests`,``,`Usage:`,"- Call with `todos` to replace the entire list (full replacement write)","- Call without `todos` to read the current list",`- Both return the full current list with status counts`,`- Mark tasks in_progress when you start, completed when done`,`- Only have ONE task in_progress at a time`].join(`
1
+ import{loadContext}from"#context/container.js";import{ContextKey}from"#context/key.js";const TodoStateKey=new ContextKey(`ash.todo`);function formatTodoSummary(e){return e.items.length===0?void 0:`[Your task list was preserved across context compaction]\n${e.items.map(e=>`- [${e.status===`completed`?`x`:e.status===`cancelled`?`-`:` `}] [${e.priority}] ${e.content}`).join(`
2
+ `)}`}function formatTodoResult(e){let{items:t}=e,n={cancelled:0,completed:0,in_progress:0,pending:0,total:t.length};for(let e of t)n[e.status]++;return{counts:n,todos:t}}function executeTodoTool(t){let r=loadContext(),{todos:i}=t??{};if(i!==void 0){let e={items:[...i]};return r.set(TodoStateKey,e),formatTodoResult(e)}return formatTodoResult(r.ensure(TodoStateKey,()=>({items:[]})))}const TODO_TOOL_DEFINITION={description:[`Use this tool to create and manage a structured task list for the current session.`,`This helps you track progress, organize complex tasks, and demonstrate thoroughness.`,``,`When to use:`,`- Complex multistep tasks requiring 3 or more distinct steps`,`- When the user provides multiple tasks or a numbered list`,`- After receiving new instructions, to capture requirements`,`- After completing a task, to mark it complete and add follow-ups`,``,`When NOT to use:`,`- Single, straightforward tasks that need no tracking`,`- Purely conversational or informational requests`,``,`Usage:`,"- Call with `todos` to replace the entire list (full replacement write)","- Call without `todos` to read the current list",`- Both return the full current list with status counts`,`- Mark tasks in_progress when you start, completed when done`,`- Only have ONE task in_progress at a time`].join(`
3
3
  `),execute:async e=>executeTodoTool(e??{}),inputSchema:{additionalProperties:!1,properties:{todos:{description:`The updated todo list. Omit to read the current list without modifying it.`,items:{additionalProperties:!1,properties:{content:{description:`Brief description of the task.`,type:`string`},priority:{description:`Priority level of the task.`,enum:[`high`,`medium`,`low`],type:`string`},status:{description:`Current status of the task.`,enum:[`pending`,`in_progress`,`completed`,`cancelled`],type:`string`}},required:[`content`,`status`,`priority`],type:`object`},type:`array`}},type:`object`},logicalPath:`ash:framework/todo`,name:`todo`,onCompact({ctx:e}){let t=e.get(TodoStateKey);if(t===void 0||t.items.length===0)return{};let r=formatTodoSummary(t);return r===void 0?{}:{messages:[{content:r,role:`user`}]}},sourceId:`ash:todo-tool`,sourceKind:`module`};export{TODO_TOOL_DEFINITION,TodoStateKey,executeTodoTool};
@@ -1,2 +1,2 @@
1
- import{executeWebFetchTool}from"#execution/web-fetch/tool.js";async function executeWebFetch(e){return executeWebFetchTool(e)}var WEB_FETCH_TOOL_DEFINITION={description:[`Fetch a webpage and return its content in the requested format. Use this to retrieve and analyze content from URLs.`,``,`Usage notes:`,`- The URL must be a fully-formed valid URL starting with http:// or https://`,`- HTML responses are automatically converted to markdown or plain text based on the requested format`,`- Format options: "markdown" (default), "text", or "html"`,`- Default timeout is 30 seconds (max 120 seconds)`,`- Maximum response size is 5 MB; content is further capped at the shared tool-output budget (50 KB / 2000 lines)`,`- This tool is read-only and does not modify any files`].join(`
1
+ import{executeWebFetchTool}from"#execution/web-fetch/tool.js";async function executeWebFetch(e){return executeWebFetchTool(e)}const WEB_FETCH_TOOL_DEFINITION={description:[`Fetch a webpage and return its content in the requested format. Use this to retrieve and analyze content from URLs.`,``,`Usage notes:`,`- The URL must be a fully-formed valid URL starting with http:// or https://`,`- HTML responses are automatically converted to markdown or plain text based on the requested format`,`- Format options: "markdown" (default), "text", or "html"`,`- Default timeout is 30 seconds (max 120 seconds)`,`- Maximum response size is 5 MB; content is further capped at the shared tool-output budget (50 KB / 2000 lines)`,`- This tool is read-only and does not modify any files`].join(`
2
2
  `),execute:executeWebFetch,inputSchema:{additionalProperties:!1,properties:{format:{description:`The format to return the content in (text, markdown, or html). HTML responses are automatically converted to the requested format. Defaults to "markdown".`,enum:[`markdown`,`text`,`html`],type:`string`},timeout:{description:`Optional timeout in seconds. Defaults to 30, max 120.`,type:`number`},url:{description:`The fully-formed URL to fetch content from. Must start with http:// or https://.`,type:`string`}},required:[`url`],type:`object`},logicalPath:`ash:framework/web-fetch`,name:`web_fetch`,sourceId:`ash:web-fetch-tool`,sourceKind:`module`};export{WEB_FETCH_TOOL_DEFINITION};
@@ -1 +1 @@
1
- var WEB_SEARCH_TOOL_DEFINITION={description:`Search the web for real-time information. Use this to find up-to-date information about current events, recent developments, or topics that may have changed since the knowledge cutoff.`,inputSchema:null,logicalPath:`ash:framework/web-search`,name:`web_search`,sourceId:`ash:web-search-tool`,sourceKind:`module`};export{WEB_SEARCH_TOOL_DEFINITION};
1
+ const WEB_SEARCH_TOOL_DEFINITION={description:`Search the web for real-time information. Use this to find up-to-date information about current events, recent developments, or topics that may have changed since the knowledge cutoff.`,inputSchema:null,logicalPath:`ash:framework/web-search`,name:`web_search`,sourceId:`ash:web-search-tool`,sourceKind:`module`};export{WEB_SEARCH_TOOL_DEFINITION};
@@ -1,2 +1,2 @@
1
- import{executeWriteFileOnSandbox}from"#execution/sandbox/write-file-tool.js";var WRITE_FILE_INPUT_SCHEMA={additionalProperties:!1,properties:{content:{description:`Complete replacement file contents.`,type:`string`},filePath:{description:`The absolute path to the file to write (must be absolute, not relative).`,type:`string`}},required:[`filePath`,`content`],type:`object`};async function executeWriteFile(e){return executeWriteFileOnSandbox(e)}var WRITE_FILE_TOOL_DEFINITION={description:[`Writes a file to the local filesystem.`,``,`Usage:`,`- This tool will overwrite the existing file if there is one at the provided path.`,`- If this is an existing file, you MUST use the read_file tool first to read the file's contents. This tool will fail if you did not read the file first.`,`- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.`,`- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.`,`- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.`].join(`
1
+ import{executeWriteFileOnSandbox}from"#execution/sandbox/write-file-tool.js";const WRITE_FILE_INPUT_SCHEMA={additionalProperties:!1,properties:{content:{description:`Complete replacement file contents.`,type:`string`},filePath:{description:`The absolute path to the file to write (must be absolute, not relative).`,type:`string`}},required:[`filePath`,`content`],type:`object`};async function executeWriteFile(e){return executeWriteFileOnSandbox(e)}const WRITE_FILE_TOOL_DEFINITION={description:[`Writes a file to the local filesystem.`,``,`Usage:`,`- This tool will overwrite the existing file if there is one at the provided path.`,`- If this is an existing file, you MUST use the read_file tool first to read the file's contents. This tool will fail if you did not read the file first.`,`- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.`,`- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.`,`- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.`].join(`
2
2
  `),execute:executeWriteFile,inputSchema:WRITE_FILE_INPUT_SCHEMA,logicalPath:`ash:framework/write-file`,name:`write_file`,sourceId:`ash:write-file-tool`,sourceKind:`module`};export{WRITE_FILE_INPUT_SCHEMA,WRITE_FILE_TOOL_DEFINITION};
@@ -1 +1 @@
1
- import{importJWK,importSPKI,jwtVerify}from"#compiled/jose/index.js";import{areTokenClaimMatchersSatisfied,createJwtAuthenticatedCallerPrincipal}from"#runtime/governance/auth/token-claims.js";var importedJwtPublicKeyCache=new Map;async function authenticateJwtEcdsaStrategy(e){let t;try{t=await getImportedJwtPublicKey(e.strategy)}catch(e){return{kind:`misconfigured`,message:`Failed to import JWT ECDSA public key. ${e instanceof Error?e.message:`Unknown key import failure.`}`}}try{let a=await jwtVerify(e.token,t,{algorithms:[e.strategy.algorithm],audience:[...e.strategy.audiences],clockTolerance:e.strategy.clockSkewSeconds,issuer:e.strategy.issuer});return typeof a.payload.sub!=`string`||a.payload.sub.length===0?{kind:`not-authenticated`}:areTokenClaimMatchersSatisfied(a.payload,e.strategy)?{kind:`authenticated`,principal:createJwtAuthenticatedCallerPrincipal({authenticator:`jwt-ecdsa`,payload:a.payload,principalType:`service`})}:{kind:`caller-not-allowed`}}catch{return{kind:`not-authenticated`}}}async function getImportedJwtPublicKey(e){let t=`${e.algorithm}:${e.publicKey}`,n=importedJwtPublicKeyCache.get(t);if(n!==void 0)return await n;let r=importJwtPublicKey(e.publicKey,e.algorithm).catch(e=>{throw importedJwtPublicKeyCache.delete(t),e});return importedJwtPublicKeyCache.set(t,r),await r}async function importJwtPublicKey(n,r){let i=n.trim();return i.startsWith(`{`)?await importJWK(JSON.parse(i),r):await importSPKI(i,r)}export{authenticateJwtEcdsaStrategy};
1
+ import{importJWK,importSPKI,jwtVerify}from"#compiled/jose/index.js";import{areTokenClaimMatchersSatisfied,createJwtAuthenticatedCallerPrincipal}from"#runtime/governance/auth/token-claims.js";const importedJwtPublicKeyCache=new Map;async function authenticateJwtEcdsaStrategy(e){let t;try{t=await getImportedJwtPublicKey(e.strategy)}catch(e){return{kind:`misconfigured`,message:`Failed to import JWT ECDSA public key. ${e instanceof Error?e.message:`Unknown key import failure.`}`}}try{let a=await jwtVerify(e.token,t,{algorithms:[e.strategy.algorithm],audience:[...e.strategy.audiences],clockTolerance:e.strategy.clockSkewSeconds,issuer:e.strategy.issuer});return typeof a.payload.sub!=`string`||a.payload.sub.length===0?{kind:`not-authenticated`}:areTokenClaimMatchersSatisfied(a.payload,e.strategy)?{kind:`authenticated`,principal:createJwtAuthenticatedCallerPrincipal({authenticator:`jwt-ecdsa`,payload:a.payload,principalType:`service`})}:{kind:`caller-not-allowed`}}catch{return{kind:`not-authenticated`}}}async function getImportedJwtPublicKey(e){let t=`${e.algorithm}:${e.publicKey}`,n=importedJwtPublicKeyCache.get(t);if(n!==void 0)return await n;let r=importJwtPublicKey(e.publicKey,e.algorithm).catch(e=>{throw importedJwtPublicKeyCache.delete(t),e});return importedJwtPublicKeyCache.set(t,r),await r}async function importJwtPublicKey(n,r){let i=n.trim();return i.startsWith(`{`)?await importJWK(JSON.parse(i),r):await importSPKI(i,r)}export{authenticateJwtEcdsaStrategy};
@@ -1 +1 @@
1
- import{z}from"#compiled/zod/index.js";import{createRemoteJWKSet,jwtVerify}from"#compiled/jose/index.js";import{areTokenClaimMatchersSatisfied,createJwtAuthenticatedCallerPrincipal}from"#runtime/governance/auth/token-claims.js";var oidcDiscoveryDocumentSchema=z.object({issuer:z.string().optional(),jwks_uri:z.string().url()}).passthrough(),oidcDiscoveryDocumentCache=new Map,oidcJwksCache=new Map;async function authenticateOidcStrategy(e){let t;try{t=await getOidcRemoteJwks(e.strategy)}catch(e){return{kind:`misconfigured`,message:`Failed to load OIDC discovery metadata. ${e instanceof Error?e.message:`Unknown discovery failure.`}`}}try{let a=await jwtVerify(e.token,t,{audience:[...e.strategy.audiences],clockTolerance:e.strategy.clockSkewSeconds,issuer:e.strategy.issuer});if(typeof a.payload.sub!=`string`||a.payload.sub.length===0)return{kind:`not-authenticated`};let o=e.strategy.acceptCurrentVercelProject&&isCurrentVercelProject({issuer:e.strategy.issuer,payload:a.payload}),s=o&&isCurrentVercelEnvironment({payload:a.payload});return!o&&!areTokenClaimMatchersSatisfied(a.payload,e.strategy)?{kind:`caller-not-allowed`}:{kind:`authenticated`,principal:createJwtAuthenticatedCallerPrincipal({authenticator:`oidc`,payload:a.payload,principalType:s?`runtime`:`service`})}}catch{return{kind:`not-authenticated`}}}async function getOidcRemoteJwks(e){let n=await getOidcDiscoveryDocument(e.discoveryUrl),r=oidcJwksCache.get(n.jwks_uri);if(r!==void 0)return r;let i=createRemoteJWKSet(new URL(n.jwks_uri));return oidcJwksCache.set(n.jwks_uri,i),i}async function getOidcDiscoveryDocument(e){let t=oidcDiscoveryDocumentCache.get(e);if(t!==void 0)return await t;let n=fetch(e,{headers:{accept:`application/json`}}).then(async e=>{if(!e.ok)throw Error(`Discovery route returned HTTP ${e.status}.`);return oidcDiscoveryDocumentSchema.parse(await e.json())}).catch(t=>{throw oidcDiscoveryDocumentCache.delete(e),t});return oidcDiscoveryDocumentCache.set(e,n),await n}function isCurrentVercelProject(e){if(!e.issuer.startsWith(`https://oidc.vercel.com`))return!1;let t=process.env.VERCEL_PROJECT_ID?.trim();return t===void 0||t.length===0?!1:typeof e.payload.project_id==`string`&&e.payload.project_id===t}function isCurrentVercelEnvironment(e){let t=(process.env.VERCEL_TARGET_ENV?.trim()??process.env.VERCEL_ENV?.trim())?.trim();return t===void 0||t.length===0?!1:typeof e.payload.environment==`string`&&e.payload.environment===t}export{authenticateOidcStrategy};
1
+ import{z}from"#compiled/zod/index.js";import{createRemoteJWKSet,jwtVerify}from"#compiled/jose/index.js";import{areTokenClaimMatchersSatisfied,createJwtAuthenticatedCallerPrincipal}from"#runtime/governance/auth/token-claims.js";const oidcDiscoveryDocumentSchema=z.object({issuer:z.string().optional(),jwks_uri:z.string().url()}).passthrough(),oidcDiscoveryDocumentCache=new Map,oidcJwksCache=new Map;async function authenticateOidcStrategy(e){let t;try{t=await getOidcRemoteJwks(e.strategy)}catch(e){return{kind:`misconfigured`,message:`Failed to load OIDC discovery metadata. ${e instanceof Error?e.message:`Unknown discovery failure.`}`}}try{let a=await jwtVerify(e.token,t,{audience:[...e.strategy.audiences],clockTolerance:e.strategy.clockSkewSeconds,issuer:e.strategy.issuer});if(typeof a.payload.sub!=`string`||a.payload.sub.length===0)return{kind:`not-authenticated`};let o=e.strategy.acceptCurrentVercelProject&&isCurrentVercelProject({issuer:e.strategy.issuer,payload:a.payload}),s=o&&isCurrentVercelEnvironment({payload:a.payload});return!o&&!areTokenClaimMatchersSatisfied(a.payload,e.strategy)?{kind:`caller-not-allowed`}:{kind:`authenticated`,principal:createJwtAuthenticatedCallerPrincipal({authenticator:`oidc`,payload:a.payload,principalType:s?`runtime`:`service`})}}catch{return{kind:`not-authenticated`}}}async function getOidcRemoteJwks(e){let n=await getOidcDiscoveryDocument(e.discoveryUrl),r=oidcJwksCache.get(n.jwks_uri);if(r!==void 0)return r;let i=createRemoteJWKSet(new URL(n.jwks_uri));return oidcJwksCache.set(n.jwks_uri,i),i}async function getOidcDiscoveryDocument(e){let t=oidcDiscoveryDocumentCache.get(e);if(t!==void 0)return await t;let n=fetch(e,{headers:{accept:`application/json`}}).then(async e=>{if(!e.ok)throw Error(`Discovery route returned HTTP ${e.status}.`);return oidcDiscoveryDocumentSchema.parse(await e.json())}).catch(t=>{throw oidcDiscoveryDocumentCache.delete(e),t});return oidcDiscoveryDocumentCache.set(e,n),await n}function isCurrentVercelProject(e){if(!e.issuer.startsWith(`https://oidc.vercel.com`))return!1;let t=process.env.VERCEL_PROJECT_ID?.trim();return t===void 0||t.length===0?!1:typeof e.payload.project_id==`string`&&e.payload.project_id===t}function isCurrentVercelEnvironment(e){let t=(process.env.VERCEL_TARGET_ENV?.trim()??process.env.VERCEL_ENV?.trim())?.trim();return t===void 0||t.length===0?!1:typeof e.payload.environment==`string`&&e.payload.environment===t}export{authenticateOidcStrategy};
@@ -1 +1 @@
1
- var STANDARD_PROJECTED_CLAIM_KEYS=new Set([`aud`,`exp`,`iat`,`iss`,`jti`,`nbf`,`sub`]);function normalizeJwtClaims(e){let t={};for(let[n,r]of Object.entries(e)){if(typeof r==`string`){t[n]=r;continue}Array.isArray(r)&&r.every(e=>typeof e==`string`)&&(t[n]=Object.freeze([...r]))}return Object.freeze(t)}function createJwtAttributeProjection(t){let n=normalizeJwtClaims(t);return Object.freeze(Object.fromEntries(Object.entries(n).filter(([t])=>!STANDARD_PROJECTED_CLAIM_KEYS.has(t))))}function areTokenClaimMatchersSatisfied(e,t){let n=normalizeJwtClaims(e);if(t.subjects!==void 0){let n=typeof e.sub==`string`?e.sub:null;if(n===null||!t.subjects.some(e=>matchesWildcardPattern(e,n)))return!1}return t.claims===void 0?!0:Object.entries(t.claims).every(([e,t])=>{let r=n[e];return r===void 0?!1:typeof r==`string`?t.includes(r):r.some(e=>t.includes(e))})}function createJwtAuthenticatedCallerPrincipal(e){let t=typeof e.payload.iss==`string`?e.payload.iss:void 0,n=typeof e.payload.sub==`string`?e.payload.sub:void 0;if(t===void 0||n===void 0)throw Error(`Expected verified JWT payloads to include string iss and sub claims.`);let r=normalizeJwtClaims(e.payload);return{attributes:createJwtAttributeProjection(e.payload),authenticator:e.authenticator,claims:r,issuer:t,principalId:`${t}:${n}`,principalType:e.principalType,subject:n}}function matchesWildcardPattern(e,t){if(!e.includes(`*`))return e===t;let n=e.replaceAll(/[.+?^${}()|[\]\\]/g,`\\$&`).replaceAll(`*`,`.*`);return RegExp(`^${n}$`).test(t)}export{areTokenClaimMatchersSatisfied,createJwtAuthenticatedCallerPrincipal};
1
+ const STANDARD_PROJECTED_CLAIM_KEYS=new Set([`aud`,`exp`,`iat`,`iss`,`jti`,`nbf`,`sub`]);function normalizeJwtClaims(e){let t={};for(let[n,r]of Object.entries(e)){if(typeof r==`string`){t[n]=r;continue}Array.isArray(r)&&r.every(e=>typeof e==`string`)&&(t[n]=Object.freeze([...r]))}return Object.freeze(t)}function createJwtAttributeProjection(t){let n=normalizeJwtClaims(t);return Object.freeze(Object.fromEntries(Object.entries(n).filter(([t])=>!STANDARD_PROJECTED_CLAIM_KEYS.has(t))))}function areTokenClaimMatchersSatisfied(e,t){let n=normalizeJwtClaims(e);if(t.subjects!==void 0){let n=typeof e.sub==`string`?e.sub:null;if(n===null||!t.subjects.some(e=>matchesWildcardPattern(e,n)))return!1}return t.claims===void 0?!0:Object.entries(t.claims).every(([e,t])=>{let r=n[e];return r===void 0?!1:typeof r==`string`?t.includes(r):r.some(e=>t.includes(e))})}function createJwtAuthenticatedCallerPrincipal(e){let t=typeof e.payload.iss==`string`?e.payload.iss:void 0,n=typeof e.payload.sub==`string`?e.payload.sub:void 0;if(t===void 0||n===void 0)throw Error(`Expected verified JWT payloads to include string iss and sub claims.`);let r=normalizeJwtClaims(e.payload);return{attributes:createJwtAttributeProjection(e.payload),authenticator:e.authenticator,claims:r,issuer:t,principalId:`${t}:${n}`,principalType:e.principalType,subject:n}}function matchesWildcardPattern(e,t){if(!e.includes(`*`))return e===t;let n=e.replaceAll(/[.+?^${}()|[\]\\]/g,`\\$&`).replaceAll(`*`,`.*`);return RegExp(`^${n}$`).test(t)}export{areTokenClaimMatchersSatisfied,createJwtAuthenticatedCallerPrincipal};
@@ -1 +1 @@
1
- var ROOT_RUNTIME_AGENT_NODE_ID=`__root__`;function getResolvedRuntimeAgentNode(e,t){if(t===void 0||t===`__root__`)return e.root;let n=e.nodesByNodeId.get(t);if(n===void 0)throw Error(`Missing runtime agent node for node id "${t}".`);return n}export{ROOT_RUNTIME_AGENT_NODE_ID,getResolvedRuntimeAgentNode};
1
+ const ROOT_RUNTIME_AGENT_NODE_ID=`__root__`;function getResolvedRuntimeAgentNode(e,t){if(t===void 0||t===`__root__`)return e.root;let n=e.nodesByNodeId.get(t);if(n===void 0)throw Error(`Missing runtime agent node for node id "${t}".`);return n}export{ROOT_RUNTIME_AGENT_NODE_ID,getResolvedRuntimeAgentNode};
@@ -1 +1 @@
1
- import{z}from"#compiled/zod/index.js";import{runtimeToolCallActionRequestSchema}from"#runtime/actions/types.js";var inputOptionSchema=z.object({description:z.string().describe(`Optional additional context for this option.`).optional(),id:z.string().describe(`Stable identifier for the option.`),label:z.string().describe(`User-facing label for the option.`),style:z.enum([`primary`,`danger`,`default`]).describe(`Visual treatment hint for the option.`).optional()}).strict(),inputRequestSchema=z.object({action:runtimeToolCallActionRequestSchema,allowFreeform:z.boolean().describe(`Whether the user may answer with freeform text instead of selecting one of the provided options.`).optional(),display:z.enum([`confirmation`,`select`,`text`]).describe(`Rendering hint — the channel uses this to pick a UX treatment.`).optional(),options:z.array(inputOptionSchema).describe(`Selectable answer options to present to the user.`).optional(),prompt:z.string().describe(`The prompt to present to the user.`),requestId:z.string().describe(`Stable identifier for this request.`)}).strict(),inputResponseSchema=z.object({optionId:z.string().optional(),requestId:z.string(),text:z.string().optional()}).strict();function isInputRequest(e){return inputRequestSchema.safeParse(e).success}function isInputResponse(e){return inputResponseSchema.safeParse(e).success}export{inputOptionSchema,inputRequestSchema,inputResponseSchema,isInputRequest,isInputResponse};
1
+ import{z}from"#compiled/zod/index.js";import{runtimeToolCallActionRequestSchema}from"#runtime/actions/types.js";const inputOptionSchema=z.object({description:z.string().describe(`Optional additional context for this option.`).optional(),id:z.string().describe(`Stable identifier for the option.`),label:z.string().describe(`User-facing label for the option.`),style:z.enum([`primary`,`danger`,`default`]).describe(`Visual treatment hint for the option.`).optional()}).strict(),inputRequestSchema=z.object({action:runtimeToolCallActionRequestSchema,allowFreeform:z.boolean().describe(`Whether the user may answer with freeform text instead of selecting one of the provided options.`).optional(),display:z.enum([`confirmation`,`select`,`text`]).describe(`Rendering hint — the channel uses this to pick a UX treatment.`).optional(),options:z.array(inputOptionSchema).describe(`Selectable answer options to present to the user.`).optional(),prompt:z.string().describe(`The prompt to present to the user.`),requestId:z.string().describe(`Stable identifier for this request.`)}).strict(),inputResponseSchema=z.object({optionId:z.string().optional(),requestId:z.string(),text:z.string().optional()}).strict();function isInputRequest(e){return inputRequestSchema.safeParse(e).success}function isInputResponse(e){return inputResponseSchema.safeParse(e).success}export{inputOptionSchema,inputRequestSchema,inputResponseSchema,isInputRequest,isInputResponse};
@@ -10,6 +10,13 @@ export interface BundledCompiledArtifacts {
10
10
  metadata?: CompileMetadata;
11
11
  moduleMap: CompiledModuleMap;
12
12
  }
13
+ /**
14
+ * Input for running code against one isolated bundled compiled-artifact
15
+ * snapshot.
16
+ */
17
+ export interface WithBundledCompiledArtifactsInput extends BundledCompiledArtifacts {
18
+ readonly sessionId?: string;
19
+ }
13
20
  /**
14
21
  * Installs one bundled compiled-artifact snapshot on the active runtime
15
22
  * session. In production this writes to the process-default session at
@@ -17,6 +24,11 @@ export interface BundledCompiledArtifacts {
17
24
  * scoped session so tests cannot leak installations across each other.
18
25
  */
19
26
  export declare function installBundledCompiledArtifacts(input: BundledCompiledArtifacts): void;
27
+ /**
28
+ * Runs `fn` with bundled compiled artifacts installed on a fresh scoped
29
+ * runtime session, leaving the process-default runtime session untouched.
30
+ */
31
+ export declare function withBundledCompiledArtifacts<T>(input: WithBundledCompiledArtifactsInput, fn: () => Promise<T> | T): Promise<T>;
20
32
  /**
21
33
  * Reads the bundled compiled-artifact snapshot for the active runtime
22
34
  * session, or `null` if none has been installed.
@@ -1 +1 @@
1
- import{getActiveRuntimeSession}from"#runtime/sessions/runtime-session.js";function installBundledCompiledArtifacts(e){getActiveRuntimeSession().compiledArtifacts={manifest:e.manifest,metadata:e.metadata,moduleMap:e.moduleMap}}function readBundledCompiledArtifacts(){return getActiveRuntimeSession().compiledArtifacts}export{installBundledCompiledArtifacts,readBundledCompiledArtifacts};
1
+ import{createRuntimeSession,getActiveRuntimeSession,withRuntimeSession}from"#runtime/sessions/runtime-session.js";function installBundledCompiledArtifacts(e){getActiveRuntimeSession().compiledArtifacts={manifest:e.manifest,metadata:e.metadata,moduleMap:e.moduleMap}}async function withBundledCompiledArtifacts(t,n){return await withRuntimeSession(createRuntimeSession(t.sessionId??`bundled-compiled-artifacts`),async()=>(installBundledCompiledArtifacts(t),await n()))}function readBundledCompiledArtifacts(){return getActiveRuntimeSession().compiledArtifacts}export{installBundledCompiledArtifacts,readBundledCompiledArtifacts,withBundledCompiledArtifacts};
@@ -1 +1 @@
1
- import{z}from"#compiled/zod/index.js";import{COMPILE_METADATA_KIND,COMPILE_METADATA_VERSION}from"#compiler/artifacts.js";import{resolveRuntimeCompilerArtifactPaths}from"#runtime/loaders/artifact-paths.js";import{readBundledCompiledArtifacts}from"#runtime/loaders/bundled-artifacts.js";import{formatValidationError}from"#runtime/validation.js";var compileArtifactDigestSchema=z.object({path:z.string(),sha256:z.string()}).strict(),compileMetadataSchema=z.object({compile:z.object({moduleMap:compileArtifactDigestSchema}).strict(),discovery:z.object({diagnostics:compileArtifactDigestSchema,manifest:compileArtifactDigestSchema,sourceGraphHash:z.string(),summary:z.object({errors:z.number().finite(),warnings:z.number().finite()}).strict()}).strict(),generator:z.object({name:z.string(),version:z.string()}).strict(),kind:z.literal(COMPILE_METADATA_KIND),status:z.union([z.literal(`failed`),z.literal(`ready`)]),version:z.literal(COMPILE_METADATA_VERSION)}).strict(),BUNDLED_COMPILE_METADATA_SOURCE=`bundled compile metadata`,LoadCompileMetadataError=class extends Error{metadataPath;constructor(e,t){super(e),this.name=`LoadCompileMetadataError`,t!==void 0&&(this.metadataPath=t)}};async function loadCompileMetadata(e){let t=e.compiledArtifactsSource.kind===`disk`?resolveRuntimeCompilerArtifactPaths(e.compiledArtifactsSource.appRoot).compileMetadataPath:void 0;if(t!==void 0){let{readFile:e}=await import(`node:fs/promises`),n;try{n=JSON.parse(await e(t,`utf8`))}catch(e){throw new LoadCompileMetadataError(formatLoadErrorMessage(e),t)}return parseCompileMetadata(n,t)}let n=readBundledCompiledArtifacts()?.metadata;return n===void 0?null:parseCompileMetadata(n,BUNDLED_COMPILE_METADATA_SOURCE)}function parseCompileMetadata(e,t){let n=compileMetadataSchema.safeParse(e);if(!n.success)throw new LoadCompileMetadataError(`Expected "${t}" to contain valid Ash compile metadata. ${formatValidationError(n.error)}`,t);return n.data}function formatLoadErrorMessage(e){return e instanceof Error?e.message:`Unknown compile metadata load failure.`}export{loadCompileMetadata};
1
+ import{z}from"#compiled/zod/index.js";import{COMPILE_METADATA_KIND,COMPILE_METADATA_VERSION}from"#compiler/artifacts.js";import{readBundledCompiledArtifacts}from"#runtime/loaders/bundled-artifacts.js";import{resolveRuntimeCompilerArtifactPaths}from"#runtime/loaders/artifact-paths.js";import{formatValidationError}from"#runtime/validation.js";const compileArtifactDigestSchema=z.object({path:z.string(),sha256:z.string()}).strict(),compileMetadataSchema=z.object({compile:z.object({moduleMap:compileArtifactDigestSchema}).strict(),discovery:z.object({diagnostics:compileArtifactDigestSchema,manifest:compileArtifactDigestSchema,sourceGraphHash:z.string(),summary:z.object({errors:z.number().finite(),warnings:z.number().finite()}).strict()}).strict(),generator:z.object({name:z.string(),version:z.string()}).strict(),kind:z.literal(COMPILE_METADATA_KIND),status:z.union([z.literal(`failed`),z.literal(`ready`)]),version:z.literal(COMPILE_METADATA_VERSION)}).strict();var LoadCompileMetadataError=class extends Error{metadataPath;constructor(e,t){super(e),this.name=`LoadCompileMetadataError`,t!==void 0&&(this.metadataPath=t)}};async function loadCompileMetadata(e){let t=e.compiledArtifactsSource.kind===`disk`?resolveRuntimeCompilerArtifactPaths(e.compiledArtifactsSource.appRoot).compileMetadataPath:void 0;if(t!==void 0){let{readFile:e}=await import(`node:fs/promises`),n;try{n=JSON.parse(await e(t,`utf8`))}catch(e){throw new LoadCompileMetadataError(formatLoadErrorMessage(e),t)}return parseCompileMetadata(n,t)}let n=readBundledCompiledArtifacts()?.metadata;return n===void 0?null:parseCompileMetadata(n,`bundled compile metadata`)}function parseCompileMetadata(e,t){let n=compileMetadataSchema.safeParse(e);if(!n.success)throw new LoadCompileMetadataError(`Expected "${t}" to contain valid Ash compile metadata. ${formatValidationError(n.error)}`,t);return n.data}function formatLoadErrorMessage(e){return e instanceof Error?e.message:`Unknown compile metadata load failure.`}export{loadCompileMetadata};
@@ -1 +1 @@
1
- import{compiledAgentManifestSchema}from"#compiler/manifest.js";import{resolveRuntimeCompilerArtifactPaths}from"#runtime/loaders/artifact-paths.js";import{readBundledCompiledArtifacts}from"#runtime/loaders/bundled-artifacts.js";import{formatValidationError}from"#runtime/validation.js";var BUNDLED_MANIFEST_SOURCE=`bundled compiled manifest`,LoadCompiledManifestError=class extends Error{manifestPath;constructor(e,t){super(e),this.name=`LoadCompiledManifestError`,t!==void 0&&(this.manifestPath=t)}};async function loadCompiledManifest(e){let r=e.compiledArtifactsSource.kind===`disk`?resolveRuntimeCompilerArtifactPaths(e.compiledArtifactsSource.appRoot).compiledManifestPath:void 0;if(r!==void 0){let{readFile:e}=await import(`node:fs/promises`),t;try{t=JSON.parse(await e(r,`utf8`))}catch(e){throw new LoadCompiledManifestError(formatLoadErrorMessage(e),r)}return parseCompiledManifest(t,r)}let a=readBundledCompiledArtifacts();if(a!==null)return parseCompiledManifest(a.manifest,BUNDLED_MANIFEST_SOURCE);throw new LoadCompiledManifestError(`Compiled manifest is unavailable without an app root or bundled compiled artifacts.`,BUNDLED_MANIFEST_SOURCE)}function parseCompiledManifest(t,n){let i=compiledAgentManifestSchema.safeParse(t);if(!i.success)throw new LoadCompiledManifestError(`Expected "${n}" to contain a valid compiled Ash agent manifest. ${formatValidationError(i.error)}`,n);return i.data}function formatLoadErrorMessage(e){return e instanceof Error?e.message:`Unknown manifest load failure.`}export{LoadCompiledManifestError,loadCompiledManifest};
1
+ import{compiledAgentManifestSchema}from"#compiler/manifest.js";import{readBundledCompiledArtifacts}from"#runtime/loaders/bundled-artifacts.js";import{resolveRuntimeCompilerArtifactPaths}from"#runtime/loaders/artifact-paths.js";import{formatValidationError}from"#runtime/validation.js";const BUNDLED_MANIFEST_SOURCE=`bundled compiled manifest`;var LoadCompiledManifestError=class extends Error{manifestPath;constructor(e,t){super(e),this.name=`LoadCompiledManifestError`,t!==void 0&&(this.manifestPath=t)}};async function loadCompiledManifest(e){let r=e.compiledArtifactsSource.kind===`disk`?resolveRuntimeCompilerArtifactPaths(e.compiledArtifactsSource.appRoot).compiledManifestPath:void 0;if(r!==void 0){let{readFile:e}=await import(`node:fs/promises`),t;try{t=JSON.parse(await e(r,`utf8`))}catch(e){throw new LoadCompiledManifestError(formatLoadErrorMessage(e),r)}return parseCompiledManifest(t,r)}let a=readBundledCompiledArtifacts();if(a!==null)return parseCompiledManifest(a.manifest,BUNDLED_MANIFEST_SOURCE);throw new LoadCompiledManifestError(`Compiled manifest is unavailable without an app root or bundled compiled artifacts.`,BUNDLED_MANIFEST_SOURCE)}function parseCompiledManifest(t,n){let i=compiledAgentManifestSchema.safeParse(t);if(!i.success)throw new LoadCompiledManifestError(`Expected "${n}" to contain a valid compiled Ash agent manifest. ${formatValidationError(i.error)}`,n);return i.data}function formatLoadErrorMessage(e){return e instanceof Error?e.message:`Unknown manifest load failure.`}export{LoadCompiledManifestError,loadCompiledManifest};
@@ -1 +1 @@
1
- import{compiledModuleMapSchema}from"#compiler/module-map.js";import{resolveRuntimeCompilerArtifactPaths}from"#runtime/loaders/artifact-paths.js";import{readBundledCompiledArtifacts}from"#runtime/loaders/bundled-artifacts.js";import{formatValidationError}from"#runtime/validation.js";var BUNDLED_MODULE_MAP_SOURCE=`bundled compiled module map`,LoadCompiledModuleMapError=class extends Error{moduleMapPath;constructor(e,t){super(e),this.name=`LoadCompiledModuleMapError`,t!==void 0&&(this.moduleMapPath=t)}};async function loadCompiledModuleMap(e){let r=e.compiledArtifactsSource.kind===`disk`?resolveRuntimeCompilerArtifactPaths(e.compiledArtifactsSource.appRoot).moduleMapPath:void 0;if(r!==void 0){let e=createFileImportSpecifier(r);try{let t=await import(e);return parseCompiledModuleMap(t.moduleMap??t.default,r)}catch(e){throw new LoadCompiledModuleMapError(formatLoadErrorMessage(e),r)}}let a=readBundledCompiledArtifacts();if(a!==null)return parseCompiledModuleMap(a.moduleMap,BUNDLED_MODULE_MAP_SOURCE);throw new LoadCompiledModuleMapError(`Compiled module map is unavailable without an app root or bundled compiled artifacts.`,BUNDLED_MODULE_MAP_SOURCE)}function parseCompiledModuleMap(t,n){let i=compiledModuleMapSchema.safeParse(t);if(!i.success)throw new LoadCompiledModuleMapError(`Expected "${n}" to export a valid compiled Ash module map. ${formatValidationError(i.error)}`,n);return i.data}function formatLoadErrorMessage(e){return e instanceof Error?e.message:`Unknown module-map load failure.`}function createFileImportSpecifier(e){let t=e.replaceAll(`\\`,`/`);return/^[A-Za-z]:\//.test(t)?`file:///${encodeURI(t)}`:t.startsWith(`/`)?`file://${encodeURI(t)}`:t}export{LoadCompiledModuleMapError,loadCompiledModuleMap};
1
+ import{compiledModuleMapSchema}from"#compiler/module-map.js";import{readBundledCompiledArtifacts}from"#runtime/loaders/bundled-artifacts.js";import{resolveRuntimeCompilerArtifactPaths}from"#runtime/loaders/artifact-paths.js";import{formatValidationError}from"#runtime/validation.js";const BUNDLED_MODULE_MAP_SOURCE=`bundled compiled module map`;var LoadCompiledModuleMapError=class extends Error{moduleMapPath;constructor(e,t){super(e),this.name=`LoadCompiledModuleMapError`,t!==void 0&&(this.moduleMapPath=t)}};async function loadCompiledModuleMap(e){let r=e.compiledArtifactsSource.kind===`disk`?resolveRuntimeCompilerArtifactPaths(e.compiledArtifactsSource.appRoot).moduleMapPath:void 0;if(r!==void 0){let e=createFileImportSpecifier(r);try{let t=await import(e);return parseCompiledModuleMap(t.moduleMap??t.default,r)}catch(e){throw new LoadCompiledModuleMapError(formatLoadErrorMessage(e),r)}}let a=readBundledCompiledArtifacts();if(a!==null)return parseCompiledModuleMap(a.moduleMap,BUNDLED_MODULE_MAP_SOURCE);throw new LoadCompiledModuleMapError(`Compiled module map is unavailable without an app root or bundled compiled artifacts.`,BUNDLED_MODULE_MAP_SOURCE)}function parseCompiledModuleMap(t,n){let i=compiledModuleMapSchema.safeParse(t);if(!i.success)throw new LoadCompiledModuleMapError(`Expected "${n}" to export a valid compiled Ash module map. ${formatValidationError(i.error)}`,n);return i.data}function formatLoadErrorMessage(e){return e instanceof Error?e.message:`Unknown module-map load failure.`}function createFileImportSpecifier(e){let t=e.replaceAll(`\\`,`/`);return/^[A-Za-z]:\//.test(t)?`file:///${encodeURI(t)}`:t.startsWith(`/`)?`file://${encodeURI(t)}`:t}export{LoadCompiledModuleMapError,loadCompiledModuleMap};
@@ -1,2 +1,2 @@
1
- import{formatAvailableSkillsSection}from"#execution/skills/instructions.js";import{createWorkspacePromptSection}from"#runtime/workspace/spec.js";import{formatConnectionsSection}from"#runtime/prompt/connections.js";var PARALLEL_ACTION_INSTRUCTION=`Tool execution
2
- A single tool or subagent call runs as one serial action. If you call multiple independent tools or subagents in one response, Ash treats that batch as parallel work. Only batch work that is independent and does not rely on another call in the same response.`;function composeRuntimeBasePrompt(e){return[...createInstructionsPromptBlocks(e.instructions),...createWorkspacePromptBlocks(e.workspaceSpec),...e.toolsAvailable?[PARALLEL_ACTION_INSTRUCTION]:[],...createConnectionsPromptBlocks(e.connections),...createSkillsPromptBlocks(e.skills)]}function createInstructionsPromptBlocks(e){if(e===void 0)return[];let t=e.markdown.trim();return t.length===0?[]:[`Instructions (${e.name})\n${t}`]}function createWorkspacePromptBlocks(e){if(e===void 0)return[];let n=createWorkspacePromptSection(e);return n===void 0?[]:[n]}function createConnectionsPromptBlocks(e){return!e||e.length===0?[]:[formatConnectionsSection(e)]}function createSkillsPromptBlocks(t){if(!t||t.length===0)return[];let n=formatAvailableSkillsSection(t);return n===null?[]:[n]}export{composeRuntimeBasePrompt};
1
+ import{formatAvailableSkillsSection}from"#execution/skills/instructions.js";import{createWorkspacePromptSection}from"#runtime/workspace/spec.js";import{formatConnectionsSection}from"#runtime/prompt/connections.js";function composeRuntimeBasePrompt(e){return[...createInstructionsPromptBlocks(e.instructions),...createWorkspacePromptBlocks(e.workspaceSpec),...e.toolsAvailable?[`Tool execution
2
+ A single tool or subagent call runs as one serial action. If you call multiple independent tools or subagents in one response, Ash treats that batch as parallel work. Only batch work that is independent and does not rely on another call in the same response.`]:[],...createConnectionsPromptBlocks(e.connections),...createSkillsPromptBlocks(e.skills)]}function createInstructionsPromptBlocks(e){if(e===void 0)return[];let t=e.markdown.trim();return t.length===0?[]:[`Instructions (${e.name})\n${t}`]}function createWorkspacePromptBlocks(e){if(e===void 0)return[];let n=createWorkspacePromptSection(e);return n===void 0?[]:[n]}function createConnectionsPromptBlocks(e){return!e||e.length===0?[]:[formatConnectionsSection(e)]}function createSkillsPromptBlocks(t){if(!t||t.length===0)return[];let n=formatAvailableSkillsSection(t);return n===null?[]:[n]}export{composeRuntimeBasePrompt};