experimental-ash 0.26.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/docs/public/channels/README.md +50 -2
- package/dist/docs/public/channels/discord.md +15 -7
- package/dist/docs/public/channels/teams.md +121 -0
- package/dist/docs/public/channels/telegram.md +201 -0
- package/dist/docs/public/subagents.md +38 -0
- package/dist/docs/public/typescript-api.md +41 -1
- package/dist/src/_virtual/_rolldown/runtime.js +1 -0
- package/dist/src/channel/adapter-context.js +1 -24
- package/dist/src/channel/adapter.js +1 -62
- package/dist/src/channel/compiled-channel.js +1 -6
- package/dist/src/channel/cross-channel-receive.js +2 -108
- package/dist/src/channel/http.js +1 -30
- package/dist/src/channel/receive-args.js +1 -1
- package/dist/src/channel/resolve-text.js +1 -59
- package/dist/src/channel/routes.js +1 -15
- package/dist/src/channel/schedule.js +1 -81
- package/dist/src/channel/send.js +1 -81
- package/dist/src/channel/session-callback.js +1 -65
- package/dist/src/channel/session.js +1 -58
- package/dist/src/channel/types.js +1 -1
- package/dist/src/cli/commands/channels.js +3 -9
- package/dist/src/cli/commands/info.js +2 -2
- package/dist/src/cli/dev/environment.js +1 -1
- package/dist/src/cli/dev/input-requests.js +1 -1
- package/dist/src/cli/dev/input.js +1 -1
- package/dist/src/cli/dev/repl.js +2 -3
- package/dist/src/cli/dev/terminal.js +5 -5
- package/dist/src/cli/dev/url.js +1 -1
- package/dist/src/cli/run.js +2 -2
- package/dist/src/cli/ui/output.js +8 -8
- package/dist/src/client/client-error.js +1 -19
- package/dist/src/client/client.js +1 -128
- package/dist/src/client/index.js +1 -11
- package/dist/src/client/message-reducer-types.js +1 -1
- package/dist/src/client/message-reducer.js +1 -456
- package/dist/src/client/message-response.js +1 -55
- package/dist/src/client/ndjson.js +3 -62
- package/dist/src/client/open-stream.js +1 -45
- package/dist/src/client/reducer.js +1 -1
- package/dist/src/client/session-utils.js +1 -62
- package/dist/src/client/session.js +1 -206
- package/dist/src/client/types.js +1 -1
- package/dist/src/client/url.js +1 -34
- package/dist/src/compiled/.vendor-stamp.json +6 -1
- package/dist/src/compiled/@vercel/oidc/LICENSE +202 -0
- package/dist/src/compiled/@vercel/oidc/index.d.ts +21 -0
- package/dist/src/compiled/@vercel/oidc/index.js +2 -0
- package/dist/src/compiled/@vercel/oidc/package.json +7 -0
- package/dist/src/compiled/chokidar/LICENSE +21 -0
- package/dist/src/compiled/chokidar/index.d.ts +33 -0
- package/dist/src/compiled/chokidar/index.js +1 -0
- package/dist/src/compiled/chokidar/package.json +7 -0
- package/dist/src/compiled/commander/LICENSE +22 -0
- package/dist/src/compiled/commander/index.d.ts +1113 -0
- package/dist/src/{chunks/url-JdCGA634.js → compiled/commander/index.js} +10 -10
- package/dist/src/compiled/commander/package.json +7 -0
- package/dist/src/compiled/gray-matter/LICENSE +21 -0
- package/dist/src/compiled/gray-matter/index.d.ts +62 -0
- package/dist/src/{chunks/gray-matter-D-9jHwOT.js → compiled/gray-matter/index.js} +2 -2
- package/dist/src/compiled/gray-matter/package.json +7 -0
- package/dist/src/compiled/picocolors/LICENSE +15 -0
- package/dist/src/compiled/picocolors/index.d.ts +55 -0
- package/dist/src/compiled/picocolors/index.js +1 -0
- package/dist/src/compiled/picocolors/package.json +7 -0
- package/dist/src/compiler/artifacts.js +1 -147
- package/dist/src/compiler/compile-agent.js +3 -76
- package/dist/src/compiler/compile-from-memory.js +1 -59
- package/dist/src/compiler/manifest.js +1 -424
- package/dist/src/compiler/model-catalog.js +1 -224
- package/dist/src/compiler/module-map.js +5 -295
- package/dist/src/compiler/normalize-agent-config.js +1 -157
- package/dist/src/compiler/normalize-channel.js +1 -51
- package/dist/src/compiler/normalize-connection.js +1 -58
- package/dist/src/compiler/normalize-helpers.js +1 -23
- package/dist/src/compiler/normalize-hook.js +1 -19
- package/dist/src/compiler/normalize-instructions.js +1 -28
- package/dist/src/compiler/normalize-manifest.js +1 -79
- package/dist/src/compiler/normalize-sandbox.js +1 -20
- package/dist/src/compiler/normalize-schedule.js +1 -38
- package/dist/src/compiler/normalize-skill.js +1 -60
- package/dist/src/compiler/normalize-subagent.js +1 -174
- package/dist/src/compiler/normalize-tool.js +1 -40
- package/dist/src/compiler/remote-agent-node.js +1 -19
- package/dist/src/compiler/workspace-resources.js +1 -85
- package/dist/src/context/accessors.js +1 -93
- package/dist/src/context/container.js +1 -89
- package/dist/src/context/hook-lifecycle.js +1 -242
- package/dist/src/context/key.js +1 -39
- package/dist/src/context/keys.js +1 -43
- package/dist/src/context/node.js +1 -9
- package/dist/src/context/provider.js +1 -1
- package/dist/src/context/providers/connection.js +1 -17
- package/dist/src/context/providers/sandbox.js +1 -46
- package/dist/src/context/providers/session.js +1 -18
- package/dist/src/context/run-step.js +1 -51
- package/dist/src/context/seed-keys.js +1 -37
- package/dist/src/context/serialize.js +1 -44
- package/dist/src/discover/connections.js +1 -153
- package/dist/src/discover/diagnostics.js +1 -82
- package/dist/src/discover/discover-agent.js +1 -159
- package/dist/src/discover/discover-subagent.js +1 -223
- package/dist/src/discover/filesystem.js +1 -215
- package/dist/src/discover/grammar.js +1 -371
- package/dist/src/discover/lib.js +1 -34
- package/dist/src/discover/manifest.js +1 -136
- package/dist/src/discover/markdown.js +1 -17
- package/dist/src/discover/named-source-directory.js +1 -188
- package/dist/src/discover/project-source.js +1 -152
- package/dist/src/discover/project.js +1 -117
- package/dist/src/discover/sandbox.js +1 -220
- package/dist/src/discover/schedules.js +1 -41
- package/dist/src/discover/skills.js +1 -274
- package/dist/src/discover/slots.js +1 -68
- package/dist/src/evals/cli/eval.js +1 -1
- package/dist/src/evals/define-eval-suite.js +1 -1
- package/dist/src/evals/index.js +1 -1
- package/dist/src/evals/loaders/index.js +1 -1
- package/dist/src/evals/loaders/json.js +1 -1
- package/dist/src/evals/loaders/yaml.js +1 -1
- package/dist/src/evals/reporters/index.js +1 -1
- package/dist/src/evals/runner/artifacts.js +3 -3
- package/dist/src/evals/runner/derive-run-facts.js +1 -1
- package/dist/src/evals/runner/discover.js +1 -1
- package/dist/src/evals/runner/execute-case.js +1 -1
- package/dist/src/evals/runner/execute-suite.js +1 -1
- package/dist/src/evals/runner/reporters/braintrust.js +2 -2
- package/dist/src/evals/runner/reporters/console.js +1 -1
- package/dist/src/evals/runner/resolve-git-metadata.js +1 -1
- package/dist/src/evals/scorers/autoevals-client.js +2 -2
- package/dist/src/evals/scorers/autoevals.js +1 -1
- package/dist/src/evals/scorers/json.js +1 -1
- package/dist/src/evals/scorers/run.js +1 -1
- package/dist/src/evals/scorers/sql.js +1 -1
- package/dist/src/evals/scorers/text.js +1 -1
- package/dist/src/evals/scores/index.js +1 -1
- package/dist/src/execution/authorization-challenge-defaults.js +1 -60
- package/dist/src/execution/await-authorization-orchestrator.js +1 -192
- package/dist/src/execution/await-authorization-splice.js +1 -66
- package/dist/src/execution/connection-auth-steps.js +1 -338
- package/dist/src/execution/node-step.js +1 -146
- package/dist/src/execution/remote-agent-dispatch.js +1 -79
- package/dist/src/execution/runtime-context.js +1 -26
- package/dist/src/execution/runtime-errors.js +1 -19
- package/dist/src/execution/sandbox/bash-tool.js +1 -42
- package/dist/src/execution/sandbox/bindings/local.js +1 -296
- package/dist/src/execution/sandbox/bindings/vercel.js +1 -363
- package/dist/src/execution/sandbox/ensure.js +1 -91
- package/dist/src/execution/sandbox/glob-tool.js +3 -146
- package/dist/src/execution/sandbox/grep-tool.js +3 -183
- package/dist/src/execution/sandbox/lazy-backend.js +1 -33
- package/dist/src/execution/sandbox/prewarm.js +1 -132
- package/dist/src/execution/sandbox/read-file-tool.js +3 -118
- package/dist/src/execution/sandbox/require-sandbox.js +1 -32
- package/dist/src/execution/sandbox/ripgrep-probe.js +1 -36
- package/dist/src/execution/sandbox/session.js +3 -158
- package/dist/src/execution/sandbox/shell-quote.js +1 -14
- package/dist/src/execution/sandbox/stream-utils.js +1 -22
- package/dist/src/execution/sandbox/truncate-output.js +3 -110
- package/dist/src/execution/sandbox/write-file-tool.js +1 -62
- package/dist/src/execution/session-callback-step.js +1 -72
- package/dist/src/execution/session.js +3 -94
- package/dist/src/execution/skills/instructions.js +2 -30
- package/dist/src/execution/skills/types.js +1 -1
- package/dist/src/execution/subagent-adapter.js +1 -94
- package/dist/src/execution/subagent-hitl-proxy.js +1 -81
- package/dist/src/execution/subagent-invocation.js +2 -16
- package/dist/src/execution/subagent-tool.js +1 -48
- package/dist/src/execution/tool-compaction.js +1 -54
- package/dist/src/execution/turn-workflow.js +1 -95
- package/dist/src/execution/web-fetch/html.js +7 -60
- package/dist/src/execution/web-fetch/tool.js +1 -90
- package/dist/src/execution/workflow-entry.js +1 -494
- package/dist/src/execution/workflow-errors.js +1 -54
- package/dist/src/execution/workflow-runtime.js +3 -161
- package/dist/src/execution/workflow-steps.js +1 -467
- package/dist/src/harness/action-result-helpers.js +1 -82
- package/dist/src/harness/attachment-staging.js +1 -303
- package/dist/src/harness/compaction.js +4 -221
- package/dist/src/harness/emission.js +1 -323
- package/dist/src/harness/execute-tool.js +1 -1
- package/dist/src/harness/input-extraction.js +1 -62
- package/dist/src/harness/input-requests.js +1 -306
- package/dist/src/harness/instrumentation-config.js +1 -42
- package/dist/src/harness/messages.js +1 -144
- package/dist/src/harness/model-call-error.js +1 -368
- package/dist/src/harness/otel-integration.js +1 -18
- package/dist/src/harness/prompt-cache.js +1 -137
- package/dist/src/harness/provider-tools.js +1 -137
- package/dist/src/harness/proxy-input-requests.js +1 -91
- package/dist/src/harness/runtime-actions.js +1 -321
- package/dist/src/harness/step-hooks.js +1 -192
- package/dist/src/harness/tool-loop.js +1 -877
- package/dist/src/harness/tool-result-pruning.js +1 -124
- package/dist/src/harness/tools.js +1 -98
- package/dist/src/harness/types.js +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/internal/application/cache-metadata.js +1 -42
- package/dist/src/internal/application/compiled-artifacts.js +4 -114
- package/dist/src/internal/application/import-specifier.js +1 -58
- package/dist/src/internal/application/package.js +1 -196
- package/dist/src/internal/application/paths.js +1 -117
- package/dist/src/internal/application/runtime-compiled-artifacts-source.js +1 -11
- package/dist/src/internal/attachments/data.js +1 -127
- package/dist/src/internal/attachments/errors.js +1 -26
- package/dist/src/internal/attachments/refs.js +1 -94
- package/dist/src/internal/attachments/sandbox-refs.js +1 -78
- package/dist/src/internal/attachments/url-refs.js +1 -20
- package/dist/src/internal/authored-asset-import-plugin.js +1 -141
- package/dist/src/internal/authored-definition/channel.js +1 -21
- package/dist/src/internal/authored-definition/connection.js +1 -148
- package/dist/src/internal/authored-definition/core.js +1 -180
- package/dist/src/internal/authored-definition/sandbox.js +1 -47
- package/dist/src/internal/authored-definition/schema-backed.js +1 -56
- package/dist/src/internal/authored-module-bundle.js +2 -19
- package/dist/src/internal/authored-module-loader.js +2 -263
- package/dist/src/internal/authored-module-map-loader.js +1 -53
- package/dist/src/internal/authored-module.js +1 -81
- package/dist/src/internal/authored-package-tsconfig-paths.js +1 -209
- package/dist/src/internal/bundler/nitro-rolldown.js +1 -42
- package/dist/src/internal/helpers/markdown.js +3 -174
- package/dist/src/internal/json-schema.js +1 -13
- package/dist/src/internal/logging.js +1 -226
- package/dist/src/internal/nitro/host/artifacts-config.js +1 -17
- package/dist/src/internal/nitro/host/build-application.js +1 -177
- package/dist/src/internal/nitro/host/build-vercel-agent-summary.js +1 -140
- package/dist/src/internal/nitro/host/channel-routes.js +2 -126
- package/dist/src/internal/nitro/host/compiled-sandbox-backend-prune-plugin.js +2 -28
- package/dist/src/internal/nitro/host/configure-nitro-routes.js +4 -272
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -491
- package/dist/src/internal/nitro/host/cron-handler-route.js +1 -49
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -390
- package/dist/src/internal/nitro/host/nitro-bundler-config.js +1 -10
- package/dist/src/internal/nitro/host/nitro-routing-import-specifier-plugin.js +1 -28
- package/dist/src/internal/nitro/host/prepare-application-host.js +1 -32
- package/dist/src/internal/nitro/host/schedule-task-routes.js +2 -148
- package/dist/src/internal/nitro/host/server-external-packages.js +1 -107
- package/dist/src/internal/nitro/host/start-development-server.js +1 -223
- package/dist/src/internal/nitro/host/types.js +1 -1
- package/dist/src/internal/nitro/host/vercel-build-output-config.js +1 -14
- package/dist/src/internal/nitro/host/vercel-build-prewarm.js +1 -30
- package/dist/src/internal/nitro/host.js +1 -2
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +2 -180
- package/dist/src/internal/nitro/routes/agent-info/load-agent-info-data.js +1 -46
- package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -74
- package/dist/src/internal/nitro/routes/health.js +1 -17
- package/dist/src/internal/nitro/routes/index.js +2 -89
- package/dist/src/internal/nitro/routes/info.js +1 -50
- package/dist/src/internal/nitro/routes/runtime-artifacts.js +1 -24
- package/dist/src/internal/nitro/routes/runtime-stack.js +1 -23
- package/dist/src/internal/nitro/routes/schedule-task.js +1 -57
- package/dist/src/internal/nitro/routes/workflow-data.js +1 -141
- package/dist/src/internal/nitro/routes/workflow-route-helpers.js +1 -137
- package/dist/src/internal/nitro/routes/workflow-run-events.js +1 -41
- package/dist/src/internal/nitro/routes/workflow-run-steps.js +1 -41
- package/dist/src/internal/nitro/routes/workflow-run.js +1 -34
- package/dist/src/internal/nitro/routes/workflow-runs.js +1 -28
- package/dist/src/internal/node-esm-compat-banner.js +2 -65
- package/dist/src/internal/package-name.js +1 -8
- package/dist/src/internal/process/pnpm.js +1 -50
- package/dist/src/internal/runtime-model.js +1 -24
- package/dist/src/internal/runtime-registry.js +1 -93
- package/dist/src/internal/vercel-agent-summary.js +1 -72
- package/dist/src/internal/workflow/builtins.js +1 -18
- package/dist/src/internal/workflow/index.js +1 -9
- package/dist/src/internal/workflow-bundle/ash-service-route-output.js +3 -93
- package/dist/src/internal/workflow-bundle/builder-support.js +5 -372
- package/dist/src/internal/workflow-bundle/builder.js +5 -472
- package/dist/src/internal/workflow-bundle/nitro-step-entry.js +2 -132
- package/dist/src/internal/workflow-bundle/vercel-workflow-output.js +3 -494
- package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -292
- package/dist/src/internal/workflow-bundle/workflow-core-shim.js +1 -84
- package/dist/src/internal/workflow-bundle/workflow-transformer.js +5 -318
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/ajv.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/code.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/index.js +2 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/scope.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/errors.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/index.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/names.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/ref_error.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/util.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/applicability.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js +4 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/defaults.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/index.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/keyword.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/subschema.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/core.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/data.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-draft-07.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/equal.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/uri.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/validation_error.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/contains.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +4 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/if.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/index.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/not.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/properties.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/code.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/id.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/index.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/index.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/types.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/draft7.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/format.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/index.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/metadata.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/const.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/enum.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/index.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/pattern.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js +1 -0
- package/dist/src/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +1 -0
- package/dist/src/node_modules/.pnpm/autoevals@0.0.132_ws@8.21.0/node_modules/autoevals/jsdist/index.js +384 -0
- package/dist/src/node_modules/.pnpm/compute-cosine-similarity@1.1.0/node_modules/compute-cosine-similarity/lib/index.js +1 -0
- package/dist/src/node_modules/.pnpm/compute-dot@1.1.0/node_modules/compute-dot/lib/index.js +1 -0
- package/dist/src/node_modules/.pnpm/compute-l2norm@1.1.0/node_modules/compute-l2norm/lib/index.js +1 -0
- package/dist/src/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +1 -0
- package/dist/src/node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/index.js +1 -0
- package/dist/src/node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/lib/schemes.js +1 -0
- package/dist/src/node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/lib/utils.js +1 -0
- package/dist/src/node_modules/.pnpm/js-levenshtein@1.1.6/node_modules/js-levenshtein/index.js +1 -0
- package/dist/src/node_modules/.pnpm/js-yaml@4.1.1/node_modules/js-yaml/dist/js-yaml.js +32 -0
- package/dist/src/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js +1 -0
- package/dist/src/node_modules/.pnpm/mustache@4.2.0/node_modules/mustache/mustache.js +4 -0
- 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 -0
- 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 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/azure.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/client.js +11 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/core/api-promise.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/core/error.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/core/pagination.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/core/resource.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/core/streaming.js +3 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/core/uploads.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/error.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/index.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/decoders/line.js +3 -0
- 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 -0
- 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 -0
- 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 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/parse.js +1 -0
- 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 -0
- 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 -0
- 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 -0
- 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 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/shims.js +1 -0
- 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 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/tslib.js +1 -0
- 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 -0
- 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 -0
- 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 -0
- 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 -0
- 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 -0
- 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 +2 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/utils/query.js +1 -0
- 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 -0
- 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 -0
- 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 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/utils.js +1 -0
- 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 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/AssistantStream.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/ChatCompletionRunner.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/ChatCompletionStream.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/ChatCompletionStreamingRunner.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/EventStream.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/ResponsesParser.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/RunnableFunction.js +1 -0
- 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 -0
- 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 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/parser.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/responses/ResponseStream.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/admin.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/admin-api-keys.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/audit-logs.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/certificates.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/data-retention.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/groups/groups.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/groups/roles.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/groups/users.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/invites.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/organization.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/projects/api-keys.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/projects/certificates.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/projects/data-retention.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/projects/groups/groups.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/projects/groups/roles.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/projects/hosted-tool-permissions.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/projects/model-permissions.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/projects/projects.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/projects/rate-limits.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/projects/roles.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/projects/service-accounts.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/projects/spend-alerts.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/projects/users/roles.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/projects/users/users.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/roles.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/spend-alerts.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/usage.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/users/roles.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/admin/organization/users/users.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/audio/audio.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/audio/speech.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/audio/transcriptions.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/audio/translations.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/batches.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/assistants.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/beta.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/chatkit/chatkit.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/chatkit/sessions.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/chatkit/threads.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/realtime/realtime.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/realtime/sessions.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/realtime/transcription-sessions.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/threads/messages.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/threads/runs/runs.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/threads/runs/steps.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/threads/threads.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/chat/chat.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/chat/completions/completions.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/chat/completions/index.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/chat/completions/messages.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/chat/index.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/completions.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/containers/containers.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/containers/files/content.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/containers/files/files.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/conversations/conversations.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/conversations/items.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/embeddings.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/evals/evals.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/evals/runs/output-items.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/evals/runs/runs.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/files.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/fine-tuning/alpha/alpha.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/fine-tuning/alpha/graders.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/fine-tuning/checkpoints/checkpoints.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/fine-tuning/checkpoints/permissions.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/fine-tuning/fine-tuning.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/fine-tuning/jobs/checkpoints.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/fine-tuning/jobs/jobs.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/fine-tuning/methods.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/graders/grader-models.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/graders/graders.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/images.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/index.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/models.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/moderations.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/realtime/calls.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/realtime/client-secrets.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/realtime/realtime.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/responses/input-items.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/responses/input-tokens.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/responses/responses.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/shared.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/skills/content.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/skills/skills.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/skills/versions/content.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/skills/versions/versions.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/uploads/parts.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/uploads/uploads.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/vector-stores/file-batches.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/vector-stores/files.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/vector-stores/vector-stores.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/videos.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/webhooks/index.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/webhooks/webhooks.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/webhooks.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/streaming.js +1 -0
- package/dist/src/node_modules/.pnpm/openai@6.39.0_ws@8.21.0_zod@3.25.76/node_modules/openai/version.js +1 -0
- package/dist/src/node_modules/.pnpm/validate.io-array@1.0.6/node_modules/validate.io-array/lib/index.js +1 -0
- package/dist/src/node_modules/.pnpm/validate.io-function@1.0.2/node_modules/validate.io-function/lib/index.js +1 -0
- 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 -0
- 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 -0
- 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/errorMessages.js +1 -0
- 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 -0
- 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/index.js +1 -0
- 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 -0
- 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/parseTypes.js +1 -0
- 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/any.js +1 -0
- 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/array.js +1 -0
- 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/bigint.js +1 -0
- 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/boolean.js +1 -0
- 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/branded.js +1 -0
- 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 -0
- 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 -0
- 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/default.js +1 -0
- 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/effects.js +1 -0
- 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/enum.js +1 -0
- 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 -0
- 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/literal.js +1 -0
- 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/map.js +1 -0
- 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/nativeEnum.js +1 -0
- 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/never.js +1 -0
- 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/null.js +1 -0
- 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/nullable.js +1 -0
- 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/number.js +1 -0
- 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/object.js +1 -0
- 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 -0
- 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 -0
- 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/promise.js +1 -0
- 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 -0
- 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/record.js +1 -0
- 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/set.js +1 -0
- 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 +3 -0
- 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/tuple.js +1 -0
- 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/undefined.js +1 -0
- 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 -0
- 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/unknown.js +1 -0
- 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 -0
- 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 -0
- package/dist/src/node_modules/.pnpm/zod@3.25.76/node_modules/zod/index.js +1 -0
- package/dist/src/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js +1 -0
- package/dist/src/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js +1 -0
- package/dist/src/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js +1 -0
- package/dist/src/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js +1 -0
- package/dist/src/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js +1 -0
- package/dist/src/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/typeAliases.js +1 -0
- package/dist/src/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js +1 -0
- package/dist/src/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/index.js +1 -0
- package/dist/src/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js +1 -0
- package/dist/src/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js +1 -0
- package/dist/src/packages/ash-scaffold/src/channels.js +7 -0
- package/dist/src/packages/ash-scaffold/src/files.js +1 -0
- package/dist/src/packages/ash-scaffold/src/index.js +1 -0
- package/dist/src/packages/ash-scaffold/src/module-files.js +1 -0
- package/dist/src/packages/ash-scaffold/src/package-json.js +1 -0
- package/dist/src/packages/ash-scaffold/src/project.js +1 -0
- package/dist/src/protocol/message.js +2 -501
- package/dist/src/protocol/routes.js +1 -85
- package/dist/src/public/agents/auth.js +1 -37
- package/dist/src/public/channels/ash.js +2 -346
- package/dist/src/public/channels/auth.js +1 -414
- package/dist/src/public/channels/discord/api.js +2 -167
- package/dist/src/public/channels/discord/defaults.js +3 -74
- package/dist/src/public/channels/discord/discordChannel.js +1 -402
- package/dist/src/public/channels/discord/hitl.js +1 -194
- package/dist/src/public/channels/discord/inbound.js +2 -238
- package/dist/src/public/channels/discord/index.js +1 -6
- package/dist/src/public/channels/discord/responses.js +1 -40
- package/dist/src/public/channels/discord/verify.js +1 -72
- package/dist/src/public/channels/discord/verifyInbound.js +1 -19
- package/dist/src/public/channels/index.js +1 -1
- package/dist/src/public/channels/slack/api-encoding.js +1 -40
- package/dist/src/public/channels/slack/api.js +1 -333
- package/dist/src/public/channels/slack/attachments.js +1 -156
- package/dist/src/public/channels/slack/blocks.js +3 -266
- package/dist/src/public/channels/slack/connections.js +1 -70
- package/dist/src/public/channels/slack/constants.js +1 -7
- package/dist/src/public/channels/slack/defaults.js +4 -211
- package/dist/src/public/channels/slack/hitl.js +1 -242
- package/dist/src/public/channels/slack/inbound.js +2 -149
- package/dist/src/public/channels/slack/index.js +1 -13
- package/dist/src/public/channels/slack/interactions.js +1 -315
- package/dist/src/public/channels/slack/limits.js +1 -75
- package/dist/src/public/channels/slack/mrkdwn.js +1 -89
- package/dist/src/public/channels/slack/slackChannel.js +1 -251
- package/dist/src/public/channels/slack/thread.js +1 -45
- package/dist/src/public/channels/slack/verify.js +1 -70
- package/dist/src/public/channels/teams/api.d.ts +140 -0
- package/dist/src/public/channels/teams/api.js +4 -0
- package/dist/src/public/channels/teams/attachments.d.ts +25 -0
- package/dist/src/public/channels/teams/attachments.js +1 -0
- package/dist/src/public/channels/teams/defaults.d.ts +24 -0
- package/dist/src/public/channels/teams/defaults.js +3 -0
- package/dist/src/public/channels/teams/hitl.d.ts +36 -0
- package/dist/src/public/channels/teams/hitl.js +1 -0
- package/dist/src/public/channels/teams/inbound.d.ts +80 -0
- package/dist/src/public/channels/teams/inbound.js +3 -0
- package/dist/src/public/channels/teams/index.d.ts +8 -0
- package/dist/src/public/channels/teams/index.js +1 -0
- package/dist/src/public/channels/teams/limits.d.ts +8 -0
- package/dist/src/public/channels/teams/limits.js +1 -0
- package/dist/src/public/channels/teams/teamsChannel.d.ts +162 -0
- package/dist/src/public/channels/teams/teamsChannel.js +1 -0
- package/dist/src/public/channels/teams/verify.d.ts +43 -0
- package/dist/src/public/channels/teams/verify.js +1 -0
- package/dist/src/public/channels/telegram/api.d.ts +107 -0
- package/dist/src/public/channels/telegram/api.js +2 -0
- package/dist/src/public/channels/telegram/attachments.d.ts +23 -0
- package/dist/src/public/channels/telegram/attachments.js +1 -0
- package/dist/src/public/channels/telegram/defaults.d.ts +9 -0
- package/dist/src/public/channels/telegram/defaults.js +3 -0
- package/dist/src/public/channels/telegram/hitl.d.ts +44 -0
- package/dist/src/public/channels/telegram/hitl.js +1 -0
- package/dist/src/public/channels/telegram/inbound.d.ts +88 -0
- package/dist/src/public/channels/telegram/inbound.js +2 -0
- package/dist/src/public/channels/telegram/index.d.ts +8 -0
- package/dist/src/public/channels/telegram/index.js +1 -0
- package/dist/src/public/channels/telegram/telegramChannel.d.ts +126 -0
- package/dist/src/public/channels/telegram/telegramChannel.js +1 -0
- package/dist/src/public/channels/telegram/verify.d.ts +30 -0
- package/dist/src/public/channels/telegram/verify.js +1 -0
- package/dist/src/public/channels/twilio/api.js +1 -103
- package/dist/src/public/channels/twilio/defaults.js +3 -69
- package/dist/src/public/channels/twilio/inbound.js +2 -123
- package/dist/src/public/channels/twilio/index.js +1 -4
- package/dist/src/public/channels/twilio/twilioChannel.js +1 -316
- package/dist/src/public/channels/twilio/twiml.js +1 -58
- package/dist/src/public/channels/twilio/verify.js +1 -73
- package/dist/src/public/channels/upload-policy.js +1 -170
- package/dist/src/public/connections/errors.js +1 -53
- package/dist/src/public/connections/index.js +1 -6
- package/dist/src/public/context/index.js +1 -13
- package/dist/src/public/definitions/agent.js +1 -6
- package/dist/src/public/definitions/channel.js +1 -24
- package/dist/src/public/definitions/connections/mcp.js +1 -20
- package/dist/src/public/definitions/defineChannel.js +1 -74
- package/dist/src/public/definitions/hook.js +1 -11
- package/dist/src/public/definitions/instructions.js +1 -7
- package/dist/src/public/definitions/instrumentation.js +1 -13
- package/dist/src/public/definitions/remote-agent.js +1 -11
- package/dist/src/public/definitions/sandbox-backend.js +1 -13
- package/dist/src/public/definitions/sandbox.js +1 -6
- package/dist/src/public/definitions/schedule.js +1 -32
- package/dist/src/public/definitions/skill.js +1 -7
- package/dist/src/public/definitions/source.js +1 -1
- package/dist/src/public/definitions/state.js +1 -34
- package/dist/src/public/definitions/tool.js +1 -27
- package/dist/src/public/hooks/index.js +1 -9
- package/dist/src/public/index.js +1 -5
- package/dist/src/public/instructions/index.js +1 -4
- package/dist/src/public/instrumentation/index.js +1 -4
- package/dist/src/public/next/index.js +1 -148
- package/dist/src/public/next/server.js +1 -348
- package/dist/src/public/next/vercel-json.js +1 -77
- package/dist/src/public/sandbox/backends/default.js +1 -15
- package/dist/src/public/sandbox/backends/local.js +1 -18
- package/dist/src/public/sandbox/backends/vercel.js +1 -25
- package/dist/src/public/sandbox/index.js +1 -10
- package/dist/src/public/sandbox/local-sandbox.js +1 -1
- package/dist/src/public/sandbox/vercel-sandbox.js +1 -1
- package/dist/src/public/schedules/index.js +1 -4
- package/dist/src/public/skills/index.js +1 -5
- package/dist/src/public/tool-result-narrowing.js +1 -87
- package/dist/src/public/tools/approval/approval-helpers.js +1 -22
- package/dist/src/public/tools/approval/index.js +1 -4
- package/dist/src/public/tools/defaults.js +1 -70
- package/dist/src/public/tools/define-bash-tool.js +1 -14
- package/dist/src/public/tools/define-glob-tool.js +1 -21
- package/dist/src/public/tools/define-grep-tool.js +1 -21
- package/dist/src/public/tools/define-read-file-tool.js +1 -27
- package/dist/src/public/tools/define-write-file-tool.js +1 -21
- package/dist/src/public/tools/index.js +1 -10
- package/dist/src/public/tools/internal.js +1 -24
- package/dist/src/public/types/json.js +1 -13
- package/dist/src/react/index.js +1 -3
- package/dist/src/react/use-ash-agent.js +2 -348
- package/dist/src/runtime/actions/keys.js +1 -30
- package/dist/src/runtime/actions/types.js +1 -99
- package/dist/src/runtime/agent/bootstrap-model-utils.js +1 -148
- package/dist/src/runtime/agent/bootstrap-model.js +1 -36
- package/dist/src/runtime/agent/bootstrap.js +1 -49
- package/dist/src/runtime/agent/mock-model-adapter.js +7 -358
- package/dist/src/runtime/agent/resolve-model.js +1 -48
- package/dist/src/runtime/cache-key.js +1 -52
- package/dist/src/runtime/channels/registry.js +1 -133
- package/dist/src/runtime/compiled-artifacts-source.js +1 -42
- package/dist/src/runtime/connections/authorization-complete-page.js +2 -21
- package/dist/src/runtime/connections/authorization-tokens.js +1 -66
- package/dist/src/runtime/connections/callback-route.js +1 -139
- package/dist/src/runtime/connections/mcp-client.js +1 -307
- package/dist/src/runtime/connections/principal-context.js +1 -111
- package/dist/src/runtime/connections/principal.js +1 -106
- package/dist/src/runtime/connections/registry.js +1 -61
- package/dist/src/runtime/connections/types.js +1 -41
- package/dist/src/runtime/connections/validate-authorization.js +1 -92
- package/dist/src/runtime/framework-channels/index.js +1 -38
- package/dist/src/runtime/framework-tools/ask-question.js +1 -30
- package/dist/src/runtime/framework-tools/bash.js +1 -40
- package/dist/src/runtime/framework-tools/connection-search.js +1 -224
- package/dist/src/runtime/framework-tools/connection-tools.js +1 -103
- package/dist/src/runtime/framework-tools/file-state.js +1 -71
- package/dist/src/runtime/framework-tools/glob.js +2 -56
- package/dist/src/runtime/framework-tools/grep.js +2 -75
- package/dist/src/runtime/framework-tools/index.js +1 -52
- package/dist/src/runtime/framework-tools/pending-connection-tool-calls.js +1 -63
- package/dist/src/runtime/framework-tools/read-file.js +2 -64
- package/dist/src/runtime/framework-tools/skill.js +1 -47
- package/dist/src/runtime/framework-tools/todo.js +3 -122
- package/dist/src/runtime/framework-tools/web-fetch.js +2 -42
- package/dist/src/runtime/framework-tools/web-search.js +1 -15
- package/dist/src/runtime/framework-tools/write-file.js +2 -48
- package/dist/src/runtime/governance/auth/http-basic.js +1 -63
- package/dist/src/runtime/governance/auth/jwt-ecdsa.js +1 -69
- package/dist/src/runtime/governance/auth/jwt-hmac.js +1 -39
- package/dist/src/runtime/governance/auth/oidc.js +1 -126
- package/dist/src/runtime/governance/auth/token-claims.js +1 -84
- package/dist/src/runtime/governance/auth/types.js +1 -14
- package/dist/src/runtime/governance/network/ip-allow-list.js +1 -66
- package/dist/src/runtime/graph.js +1 -17
- package/dist/src/runtime/hooks/registry.js +1 -55
- package/dist/src/runtime/input/types.js +1 -63
- package/dist/src/runtime/loaders/artifact-paths.js +1 -26
- package/dist/src/runtime/loaders/bundled-artifacts.js +1 -21
- package/dist/src/runtime/loaders/compile-metadata.js +1 -92
- package/dist/src/runtime/loaders/manifest.js +1 -56
- package/dist/src/runtime/loaders/module-map.js +1 -64
- package/dist/src/runtime/prompt/compose.js +2 -47
- package/dist/src/runtime/prompt/connections.js +2 -23
- package/dist/src/runtime/resolve-agent-graph.js +1 -287
- package/dist/src/runtime/resolve-agent.js +1 -134
- package/dist/src/runtime/resolve-channel.js +1 -62
- package/dist/src/runtime/resolve-connection.js +1 -72
- package/dist/src/runtime/resolve-helpers.js +1 -58
- package/dist/src/runtime/resolve-hook.js +1 -67
- package/dist/src/runtime/resolve-sandbox.js +1 -65
- package/dist/src/runtime/resolve-tool.js +1 -110
- package/dist/src/runtime/sandbox/keys.js +1 -72
- package/dist/src/runtime/sandbox/registry.js +1 -42
- package/dist/src/runtime/schedules/register.js +1 -62
- package/dist/src/runtime/schedules/resolve-schedule.js +1 -66
- package/dist/src/runtime/session-callback-route.js +1 -87
- package/dist/src/runtime/sessions/auth.js +1 -18
- package/dist/src/runtime/sessions/compiled-agent-cache.js +1 -125
- package/dist/src/runtime/sessions/runtime-session.js +1 -50
- package/dist/src/runtime/sessions/turn.js +1 -1
- package/dist/src/runtime/skills/fragment-context.js +1 -4
- package/dist/src/runtime/skills/sandbox-access.js +1 -85
- package/dist/src/runtime/subagents/registry.js +1 -62
- package/dist/src/runtime/tools/registry.js +1 -40
- package/dist/src/runtime/types.js +1 -1
- package/dist/src/runtime/validation.js +1 -7
- package/dist/src/runtime/workspace/seed-files.js +1 -42
- package/dist/src/runtime/workspace/spec.js +2 -22
- package/dist/src/runtime/workspace/types.js +1 -9
- package/dist/src/sandbox/state.js +1 -1
- package/dist/src/services/dev-client/request-headers.js +1 -197
- package/dist/src/services/dev-client/stream.js +1 -7
- package/dist/src/services/dev-client/url.js +1 -25
- package/dist/src/services/dev-client/vercel-auth-error.js +2 -98
- package/dist/src/services/dev-client.js +1 -48
- package/dist/src/services/inspect-application.js +1 -45
- package/dist/src/shared/agent-definition.js +1 -1
- package/dist/src/shared/errors.js +1 -66
- package/dist/src/shared/guards.js +1 -35
- package/dist/src/shared/json-schemas.js +1 -41
- package/dist/src/shared/json.js +1 -80
- package/dist/src/shared/node.js +1 -1
- package/dist/src/shared/optional.js +1 -1
- package/dist/src/shared/run-mode.js +1 -1
- package/dist/src/shared/sandbox-backend.js +1 -1
- package/dist/src/shared/sandbox-definition.js +1 -1
- package/dist/src/shared/sandbox-session.js +1 -1
- package/dist/src/shared/skill-definition.js +1 -1
- package/dist/src/shared/skill-package.js +1 -100
- package/dist/src/shared/source-ref.js +1 -1
- package/dist/src/shared/tool-definition.js +1 -1
- package/package.json +14 -4
- package/dist/src/chunks/authored-module-loader-DcCfCiBm.js +0 -4
- package/dist/src/chunks/chunk-DSjMdhoD.js +0 -1
- package/dist/src/chunks/client-ZqNLLMZB.js +0 -4
- package/dist/src/chunks/compile-agent-DrIyb818.js +0 -5
- package/dist/src/chunks/dev-authored-source-watcher-C1WUVv9F.js +0 -1
- package/dist/src/chunks/errors-HYWjHxV6.js +0 -1
- package/dist/src/chunks/guards-26p6sOw3.js +0 -1
- package/dist/src/chunks/host-CwAcCrg7.js +0 -70
- package/dist/src/chunks/input-requests-DJiy6dG9.js +0 -1
- package/dist/src/chunks/jsdist-BkeWZ7EZ.js +0 -443
- package/dist/src/chunks/paths-CWZN-XRX.js +0 -85
- package/dist/src/chunks/picocolors-aAkqW4On.js +0 -1
- package/dist/src/chunks/runtime-model-Dh0Nz64z.js +0 -1
- package/dist/src/chunks/token-YW4VSeBB.js +0 -1
- package/dist/src/chunks/types-BJSR0JNV.js +0 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inbound Microsoft Teams activity parsing and prompt shaping.
|
|
3
|
+
*
|
|
4
|
+
* The channel owns small, documented data shapes instead of exposing the
|
|
5
|
+
* full Bot Framework SDK Activity model as the primary public API.
|
|
6
|
+
*/
|
|
7
|
+
import type { UserContent } from "ai";
|
|
8
|
+
import type { TeamsAttachment, TeamsChannelAccount, TeamsMention } from "#public/channels/teams/api.js";
|
|
9
|
+
/** Teams conversation scopes handled by the native channel. */
|
|
10
|
+
export type TeamsConversationScope = "channel" | "groupChat" | "personal" | "unknown";
|
|
11
|
+
/** Bot Framework conversation account fields used by the Teams channel. */
|
|
12
|
+
export interface TeamsConversationAccount {
|
|
13
|
+
readonly conversationType?: string;
|
|
14
|
+
readonly id: string;
|
|
15
|
+
readonly isGroup?: boolean;
|
|
16
|
+
readonly name?: string;
|
|
17
|
+
readonly tenantId?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Common fields shared by parsed Teams activities. */
|
|
20
|
+
export interface TeamsActivityBase {
|
|
21
|
+
readonly channelData: Record<string, unknown>;
|
|
22
|
+
readonly conversation: TeamsConversationAccount;
|
|
23
|
+
readonly conversationType?: string;
|
|
24
|
+
readonly from: TeamsChannelAccount;
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly raw: Record<string, unknown>;
|
|
27
|
+
readonly recipient: TeamsChannelAccount;
|
|
28
|
+
readonly serviceUrl: string;
|
|
29
|
+
readonly tenantId?: string;
|
|
30
|
+
readonly teamId?: string;
|
|
31
|
+
readonly teamsChannelId?: string;
|
|
32
|
+
}
|
|
33
|
+
/** Parsed Teams message activity. */
|
|
34
|
+
export interface TeamsMessageActivity extends TeamsActivityBase {
|
|
35
|
+
readonly attachments: readonly TeamsAttachment[];
|
|
36
|
+
readonly isBotMentioned: boolean;
|
|
37
|
+
readonly mentions: readonly TeamsMention[];
|
|
38
|
+
readonly replyToId?: string;
|
|
39
|
+
readonly scope: TeamsConversationScope;
|
|
40
|
+
readonly text: string;
|
|
41
|
+
readonly textFormat?: string;
|
|
42
|
+
readonly type: "message";
|
|
43
|
+
readonly value?: Record<string, unknown>;
|
|
44
|
+
}
|
|
45
|
+
/** Parsed Teams invoke activity. */
|
|
46
|
+
export interface TeamsInvokeActivity extends TeamsActivityBase {
|
|
47
|
+
readonly name: string;
|
|
48
|
+
readonly replyToId?: string;
|
|
49
|
+
readonly scope: TeamsConversationScope;
|
|
50
|
+
readonly type: "invoke";
|
|
51
|
+
readonly value?: Record<string, unknown>;
|
|
52
|
+
}
|
|
53
|
+
/** Parsed Teams conversation-update activity. */
|
|
54
|
+
export interface TeamsConversationUpdateActivity extends TeamsActivityBase {
|
|
55
|
+
readonly type: "conversationUpdate";
|
|
56
|
+
}
|
|
57
|
+
/** Parsed Teams activity variants handled by the native channel. */
|
|
58
|
+
export type TeamsActivity = TeamsConversationUpdateActivity | TeamsInvokeActivity | TeamsMessageActivity;
|
|
59
|
+
/** Inbound context rendered into the model-visible `<teams_context>` block. */
|
|
60
|
+
export interface TeamsInboundContext {
|
|
61
|
+
readonly activityId: string;
|
|
62
|
+
readonly channelId?: string;
|
|
63
|
+
readonly conversationId: string;
|
|
64
|
+
readonly conversationType?: string;
|
|
65
|
+
readonly scope: TeamsConversationScope;
|
|
66
|
+
readonly teamId?: string;
|
|
67
|
+
readonly tenantId?: string;
|
|
68
|
+
readonly userId: string;
|
|
69
|
+
readonly userName?: string;
|
|
70
|
+
}
|
|
71
|
+
/** Parses one JSON-decoded Teams activity payload. */
|
|
72
|
+
export declare function parseTeamsActivity(value: unknown): TeamsActivity | null;
|
|
73
|
+
/** Returns whether the message's scope behaves like a Teams personal chat. */
|
|
74
|
+
export declare function isTeamsPersonalMessage(activity: TeamsMessageActivity): boolean;
|
|
75
|
+
/** Returns the root activity id that should anchor a Teams thread, when any. */
|
|
76
|
+
export declare function teamsThreadRootActivityId(activity: TeamsMessageActivity | TeamsInvokeActivity): string | null;
|
|
77
|
+
/** Renders one {@link TeamsInboundContext} as a deterministic context block. */
|
|
78
|
+
export declare function formatTeamsContextBlock(context: TeamsInboundContext): string;
|
|
79
|
+
/** Prepends a `<teams_context>` block to the inbound turn message. */
|
|
80
|
+
export declare function prependTeamsContext(message: string | UserContent, context: TeamsInboundContext): string | UserContent;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{isNonEmptyString,isObject}from"#shared/guards.js";import{parseJsonObject}from"#shared/json.js";import TurndownService from"#compiled/turndown/index.js";var TEAMS_RESPONSE_INSTRUCTIONS=`Reply for Microsoft Teams in concise Markdown. Avoid broad mentions, large tables, and messages that need more than a few short posts.`,HTML_ENTITY_MAP={"&":`&`,">":`>`,"<":`<`," ":` `,""":`"`,"'":`'`,"'":`'`},HTML_ENTITY_PATTERN=new RegExp(Object.keys(HTML_ENTITY_MAP).join(`|`),`gi`),turndownService=null;function parseTeamsActivity(e){return isObject(e)?e.type===`message`?parseMessageActivity(e):e.type===`invoke`?parseInvokeActivity(e):e.type===`conversationUpdate`?parseConversationUpdateActivity(e):null:null}function isTeamsPersonalMessage(e){return e.scope===`personal`}function teamsThreadRootActivityId(e){return e.scope===`personal`?null:e.replyToId??e.id}function formatTeamsContextBlock(e){return[`<teams_context>`,`response_medium: microsoft_teams`,`response_instructions: ${TEAMS_RESPONSE_INSTRUCTIONS}`,`user_id: ${e.userId}`,...e.userName?[`user_name: ${e.userName}`]:[],`conversation_id: ${e.conversationId}`,`scope: ${e.scope}`,...e.conversationType?[`conversation_type: ${e.conversationType}`]:[],...e.tenantId?[`tenant_id: ${e.tenantId}`]:[],...e.teamId?[`team_id: ${e.teamId}`]:[],...e.channelId?[`channel_id: ${e.channelId}`]:[],`activity_id: ${e.activityId}`,`</teams_context>`].join(`
|
|
2
|
+
`)}function prependTeamsContext(e,t){let n=formatTeamsContextBlock(t);return typeof e==`string`?e.length>0?`${n}\n\n${e}`:n:[{type:`text`,text:n},...e]}function parseMessageActivity(n){let r=parseActivityBase(n);if(!r)return null;let i=parseMentions(n.entities),a=normalizeTeamsText(stripBotMention(readText(n),i,r.recipient.id));return{...r,attachments:parseAttachments(n.attachments),isBotMentioned:i.some(e=>e.mentioned.id===r.recipient.id),mentions:i,replyToId:isNonEmptyString(n.replyToId)?n.replyToId:void 0,scope:inferScope(r.conversation),text:a,textFormat:isNonEmptyString(n.textFormat)?n.textFormat:void 0,type:`message`,value:isObject(n.value)?n.value:void 0}}function parseInvokeActivity(n){let r=parseActivityBase(n);return!r||!isNonEmptyString(n.name)?null:{...r,name:n.name,replyToId:isNonEmptyString(n.replyToId)?n.replyToId:void 0,scope:inferScope(r.conversation),type:`invoke`,value:isObject(n.value)?n.value:void 0}}function parseConversationUpdateActivity(e){let t=parseActivityBase(e);return t?{...t,type:`conversationUpdate`}:null}function parseActivityBase(n){if(!isNonEmptyString(n.serviceUrl))return null;let r=parseConversation(n.conversation),i=parseChannelAccount(n.from),a=parseChannelAccount(n.recipient);if(!r||!i||!a)return null;let o=isObject(n.channelData)?n.channelData:{},s=readNestedString(o,[`tenant`,`id`])??r.tenantId,c=readNestedString(o,[`team`,`id`]),l=readNestedString(o,[`channel`,`id`]);return{channelData:o,conversation:r,conversationType:r.conversationType,from:i,id:isNonEmptyString(n.id)?n.id:``,raw:n,recipient:a,serviceUrl:n.serviceUrl,tenantId:s,teamId:c,teamsChannelId:l}}function parseConversation(n){return!isObject(n)||!isNonEmptyString(n.id)?null:{conversationType:isNonEmptyString(n.conversationType)?n.conversationType:void 0,id:n.id,isGroup:typeof n.isGroup==`boolean`?n.isGroup:void 0,name:isNonEmptyString(n.name)?n.name:void 0,tenantId:isNonEmptyString(n.tenantId)?n.tenantId:void 0}}function parseChannelAccount(n){return!isObject(n)||!isNonEmptyString(n.id)?null:{aadObjectId:isNonEmptyString(n.aadObjectId)?n.aadObjectId:void 0,id:n.id,name:isNonEmptyString(n.name)?n.name:void 0,role:isNonEmptyString(n.role)?n.role:void 0}}function parseMentions(n){if(!Array.isArray(n))return[];let r=[];for(let i of n){if(!isObject(i)||i.type!==`mention`||!isNonEmptyString(i.text))continue;let n=parseChannelAccount(i.mentioned);n&&r.push({mentioned:n,text:i.text,type:`mention`})}return r}function parseAttachments(r){if(!Array.isArray(r))return[];let i=[];for(let a of r){if(!isObject(a)||!isNonEmptyString(a.contentType))continue;let r={content:isObject(a.content)?parseJsonObject(a.content):void 0,contentType:a.contentType,contentUrl:isNonEmptyString(a.contentUrl)?a.contentUrl:void 0,name:isNonEmptyString(a.name)?a.name:void 0};i.push(r)}return i}function inferScope(e){let t=e.conversationType;return t===`personal`||t===`groupChat`||t===`channel`?t:e.isGroup===!0?`groupChat`:e.isGroup===!1?`personal`:`unknown`}function readText(e){return typeof e.text==`string`?e.text:``}function stripBotMention(e,t,n){let r=e;for(let e of t)e.mentioned.id===n&&(r=r.replace(e.text,``));return r.trim()}function normalizeTeamsText(e){let t=e.trim();return looksLikeHtml(t)?getTurndownService().turndown(t.replace(/<at>(.*?)<\/at>/gi,`@$1`)).replace(/ {2}\n/g,`
|
|
3
|
+
`).trim():decodeHtmlEntities(t)}function readNestedString(n,r){let i=n;for(let e of r){if(!isObject(i))return;i=i[e]}return isNonEmptyString(i)?i:void 0}function looksLikeHtml(e){return/<\/?[a-z][\s\S]*>/i.test(e)}function decodeHtmlEntities(e){return e.replace(HTML_ENTITY_PATTERN,e=>HTML_ENTITY_MAP[e.toLowerCase()]??e)}function getTurndownService(){return turndownService??=new TurndownService({bulletListMarker:`-`,codeBlockStyle:`fenced`,emDelimiter:`*`,headingStyle:`atx`,hr:`---`}),turndownService}export{formatTeamsContextBlock,isTeamsPersonalMessage,parseTeamsActivity,prependTeamsContext,teamsThreadRootActivityId};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { ModelMessage } from "ai";
|
|
2
|
+
export { teamsChannel, type TeamsChannel, type TeamsChannelConfig, type TeamsChannelCredentials, type TeamsChannelEvents, type TeamsChannelState, type TeamsContext, type TeamsEventContext, type TeamsHandle, type TeamsInboundResult, type TeamsInboundResultOrPromise, type TeamsInvokeResult, type TeamsInvokeResultOrPromise, type TeamsReceiveArgs, type TeamsRequestOptions, type TeamsThread, } from "#public/channels/teams/teamsChannel.js";
|
|
3
|
+
export { callTeamsConnectorApi, normalizeTeamsPostInput, replyToTeamsActivity, resolveTeamsAccessToken, resolveTeamsAppId, resolveTeamsAppPassword, resolveTeamsTenantId, sendTeamsActivity, splitTeamsMessageText, teamsContinuationToken, triggerTeamsTypingIndicator, updateTeamsActivity, TEAMS_MESSAGE_TEXT_MAX_LENGTH, type TeamsAccessTokenResult, type TeamsApiOptions, type TeamsApiResponse, type TeamsAppId, type TeamsAppPassword, type TeamsAttachment, type TeamsChannelAccount, type TeamsCredentials, type TeamsFetch, type TeamsMention, type TeamsMessageBody, type TeamsOutboundActivity, type TeamsPostedActivity, type TeamsTenantId, type TeamsTokenProvider, } from "#public/channels/teams/api.js";
|
|
4
|
+
export { formatTeamsContextBlock, isTeamsPersonalMessage, parseTeamsActivity, prependTeamsContext, teamsThreadRootActivityId, type TeamsActivity, type TeamsActivityBase, type TeamsConversationAccount, type TeamsConversationScope, type TeamsConversationUpdateActivity, type TeamsInboundContext, type TeamsInvokeActivity, type TeamsMessageActivity, } from "#public/channels/teams/inbound.js";
|
|
5
|
+
export { deriveTeamsInputResponses, isTeamsInputResponseActivity, renderAnsweredInputRequestMessage, renderInputRequestAttachment, renderInputRequestMessage, teamsInvokeResponse, TEAMS_ADAPTIVE_CARD_CONTENT_TYPE, TEAMS_HITL_CHOICE_INPUT_ID, TEAMS_HITL_DATA_KEY, TEAMS_HITL_FREEFORM_INPUT_ID, } from "#public/channels/teams/hitl.js";
|
|
6
|
+
export { collectTeamsFileParts, buildTeamsTurnMessage, createTeamsFetchFile, normalizeTeamsFilesPolicy, type TeamsFilesConfig, type TeamsFilesPolicy, } from "#public/channels/teams/attachments.js";
|
|
7
|
+
export { buildAuthCompletedText, defaultTeamsAuth, formatConnectionDisplayName, teamsMentionUser, } from "#public/channels/teams/defaults.js";
|
|
8
|
+
export { verifyTeamsJwt, verifyTeamsRequest, type TeamsJwtVerifyOptions, type TeamsVerifyOptions, type TeamsWebhookVerifier, } from "#public/channels/teams/verify.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{TEAMS_MESSAGE_TEXT_MAX_LENGTH,callTeamsConnectorApi,normalizeTeamsPostInput,replyToTeamsActivity,resolveTeamsAccessToken,resolveTeamsAppId,resolveTeamsAppPassword,resolveTeamsTenantId,sendTeamsActivity,splitTeamsMessageText,teamsContinuationToken,triggerTeamsTypingIndicator,updateTeamsActivity}from"#public/channels/teams/api.js";import{TEAMS_ADAPTIVE_CARD_CONTENT_TYPE,TEAMS_HITL_CHOICE_INPUT_ID,TEAMS_HITL_DATA_KEY,TEAMS_HITL_FREEFORM_INPUT_ID,deriveTeamsInputResponses,isTeamsInputResponseActivity,renderAnsweredInputRequestMessage,renderInputRequestAttachment,renderInputRequestMessage,teamsInvokeResponse}from"#public/channels/teams/hitl.js";import{teamsChannel}from"#public/channels/teams/teamsChannel.js";import{formatTeamsContextBlock,isTeamsPersonalMessage,parseTeamsActivity,prependTeamsContext,teamsThreadRootActivityId}from"#public/channels/teams/inbound.js";import{buildTeamsTurnMessage,collectTeamsFileParts,createTeamsFetchFile,normalizeTeamsFilesPolicy}from"#public/channels/teams/attachments.js";import{buildAuthCompletedText,defaultTeamsAuth,formatConnectionDisplayName,teamsMentionUser}from"#public/channels/teams/defaults.js";import{verifyTeamsJwt,verifyTeamsRequest}from"#public/channels/teams/verify.js";export{TEAMS_ADAPTIVE_CARD_CONTENT_TYPE,TEAMS_HITL_CHOICE_INPUT_ID,TEAMS_HITL_DATA_KEY,TEAMS_HITL_FREEFORM_INPUT_ID,TEAMS_MESSAGE_TEXT_MAX_LENGTH,buildAuthCompletedText,buildTeamsTurnMessage,callTeamsConnectorApi,collectTeamsFileParts,createTeamsFetchFile,defaultTeamsAuth,deriveTeamsInputResponses,formatConnectionDisplayName,formatTeamsContextBlock,isTeamsInputResponseActivity,isTeamsPersonalMessage,normalizeTeamsFilesPolicy,normalizeTeamsPostInput,parseTeamsActivity,prependTeamsContext,renderAnsweredInputRequestMessage,renderInputRequestAttachment,renderInputRequestMessage,replyToTeamsActivity,resolveTeamsAccessToken,resolveTeamsAppId,resolveTeamsAppPassword,resolveTeamsTenantId,sendTeamsActivity,splitTeamsMessageText,teamsChannel,teamsContinuationToken,teamsInvokeResponse,teamsMentionUser,teamsThreadRootActivityId,triggerTeamsTypingIndicator,updateTeamsActivity,verifyTeamsJwt,verifyTeamsRequest};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Maximum Teams Adaptive Card text block length used by Ash renderers. */
|
|
2
|
+
export declare const TEAMS_ADAPTIVE_CARD_TEXT_MAX_LENGTH = 4000;
|
|
3
|
+
/** Maximum Teams Adaptive Card button title length used by Ash renderers. */
|
|
4
|
+
export declare const TEAMS_ADAPTIVE_CARD_ACTION_TITLE_MAX_LENGTH = 80;
|
|
5
|
+
/** Maximum Teams Adaptive Card choice title length used by Ash renderers. */
|
|
6
|
+
export declare const TEAMS_ADAPTIVE_CARD_CHOICE_TITLE_MAX_LENGTH = 100;
|
|
7
|
+
/** Maximum number of direct Adaptive Card actions rendered for one request. */
|
|
8
|
+
export declare const TEAMS_ADAPTIVE_CARD_ACTION_LIMIT = 6;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var TEAMS_ADAPTIVE_CARD_TEXT_MAX_LENGTH=4e3,TEAMS_ADAPTIVE_CARD_ACTION_TITLE_MAX_LENGTH=80,TEAMS_ADAPTIVE_CARD_CHOICE_TITLE_MAX_LENGTH=100,TEAMS_ADAPTIVE_CARD_ACTION_LIMIT=6;export{TEAMS_ADAPTIVE_CARD_ACTION_LIMIT,TEAMS_ADAPTIVE_CARD_ACTION_TITLE_MAX_LENGTH,TEAMS_ADAPTIVE_CARD_CHOICE_TITLE_MAX_LENGTH,TEAMS_ADAPTIVE_CARD_TEXT_MAX_LENGTH};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import type { ModelMessage } from "ai";
|
|
2
|
+
import type { TypedReceiveRoute } from "#channel/receive-args.js";
|
|
3
|
+
import type { SessionHandle } from "#channel/session.js";
|
|
4
|
+
import type { SessionAuthContext } from "#channel/types.js";
|
|
5
|
+
import type { HandleMessageStreamEvent } from "#protocol/message.js";
|
|
6
|
+
import { type TeamsFilesConfig } from "#public/channels/teams/attachments.js";
|
|
7
|
+
import { type TeamsApiOptions, type TeamsApiResponse, type TeamsChannelAccount, type TeamsCredentials, type TeamsMention, type TeamsMessageBody, type TeamsOutboundActivity, type TeamsPostedActivity } from "#public/channels/teams/api.js";
|
|
8
|
+
import { type TeamsInvokeActivity, type TeamsMessageActivity } from "#public/channels/teams/inbound.js";
|
|
9
|
+
import { type TeamsWebhookVerifier } from "#public/channels/teams/verify.js";
|
|
10
|
+
import { type JsonObject } from "#shared/json.js";
|
|
11
|
+
import { type Channel } from "#public/definitions/defineChannel.js";
|
|
12
|
+
type EventData<T extends HandleMessageStreamEvent["type"]> = Extract<HandleMessageStreamEvent, {
|
|
13
|
+
type: T;
|
|
14
|
+
}> extends {
|
|
15
|
+
data: infer D;
|
|
16
|
+
} ? D : undefined;
|
|
17
|
+
/** Pre-dispatch Teams context passed to inbound message and invoke hooks. */
|
|
18
|
+
export interface TeamsContext {
|
|
19
|
+
readonly teams: TeamsHandle;
|
|
20
|
+
readonly thread: TeamsThread;
|
|
21
|
+
}
|
|
22
|
+
/** Event-handler Teams context, including mutable per-conversation state. */
|
|
23
|
+
export interface TeamsEventContext extends TeamsContext {
|
|
24
|
+
readonly adaptiveCardVersion: string;
|
|
25
|
+
readonly session: SessionHandle;
|
|
26
|
+
state: TeamsChannelState;
|
|
27
|
+
}
|
|
28
|
+
/** JSON-serializable Teams channel state. */
|
|
29
|
+
export interface TeamsChannelState {
|
|
30
|
+
/** Bot account captured from the inbound activity recipient. */
|
|
31
|
+
bot: TeamsChannelAccount | null;
|
|
32
|
+
/** Teams team/channel id for channel conversations, when present. */
|
|
33
|
+
channelId: string | null;
|
|
34
|
+
/** Bot Framework conversation id. */
|
|
35
|
+
conversationId: string | null;
|
|
36
|
+
/** Teams conversation type (`personal`, `groupChat`, `channel`, or platform value). */
|
|
37
|
+
conversationType: string | null;
|
|
38
|
+
/** Activity id used for thread replies in channel/group contexts. */
|
|
39
|
+
replyToActivityId: string | null;
|
|
40
|
+
/** Bot Framework serviceUrl for outbound Connector calls. */
|
|
41
|
+
serviceUrl: string | null;
|
|
42
|
+
/** Teams team id, when present. */
|
|
43
|
+
teamId: string | null;
|
|
44
|
+
/** Teams tenant id, when present. */
|
|
45
|
+
tenantId: string | null;
|
|
46
|
+
/** User account that triggered the latest turn/session. */
|
|
47
|
+
triggeringUser: TeamsChannelAccount | null;
|
|
48
|
+
/** Activity id for the default connection-auth card, when posted. */
|
|
49
|
+
pendingAuthActivityId?: string | null;
|
|
50
|
+
}
|
|
51
|
+
/** Teams channel credentials. */
|
|
52
|
+
export interface TeamsChannelCredentials extends TeamsCredentials {
|
|
53
|
+
/**
|
|
54
|
+
* Custom inbound webhook verifier. When supplied, Ash delegates
|
|
55
|
+
* verification to this function instead of validating Bot Connector JWTs.
|
|
56
|
+
*/
|
|
57
|
+
readonly webhookVerifier?: TeamsWebhookVerifier;
|
|
58
|
+
}
|
|
59
|
+
/** Arguments accepted by `receive(teams, args)` for proactive sessions. */
|
|
60
|
+
export interface TeamsReceiveArgs {
|
|
61
|
+
readonly channelId?: string;
|
|
62
|
+
readonly conversationId: string;
|
|
63
|
+
readonly conversationType?: string;
|
|
64
|
+
readonly initialMessage?: string | TeamsMessageBody;
|
|
65
|
+
readonly replyToActivityId?: string;
|
|
66
|
+
readonly serviceUrl: string;
|
|
67
|
+
readonly teamId?: string;
|
|
68
|
+
readonly tenantId?: string;
|
|
69
|
+
}
|
|
70
|
+
/** Result of an inbound Teams message hook. Return `null` to acknowledge without dispatching. */
|
|
71
|
+
export type TeamsInboundResult = {
|
|
72
|
+
readonly auth: SessionAuthContext | null;
|
|
73
|
+
readonly modelContext?: readonly ModelMessage[];
|
|
74
|
+
} | null;
|
|
75
|
+
/** Sync or async {@link TeamsInboundResult}. */
|
|
76
|
+
export type TeamsInboundResultOrPromise = TeamsInboundResult | Promise<TeamsInboundResult>;
|
|
77
|
+
/** Result of an inbound non-HITL Teams invoke hook. */
|
|
78
|
+
export type TeamsInvokeResult = Record<string, unknown> | Response | null | undefined;
|
|
79
|
+
/** Sync or async {@link TeamsInvokeResult}. */
|
|
80
|
+
export type TeamsInvokeResultOrPromise = TeamsInvokeResult | Promise<TeamsInvokeResult>;
|
|
81
|
+
type TeamsEventHandler<T extends HandleMessageStreamEvent["type"]> = (data: EventData<T>, ctx: TeamsEventContext) => void | Promise<void>;
|
|
82
|
+
/** Event handlers supported by `teamsChannel({ events })`. */
|
|
83
|
+
export interface TeamsChannelEvents {
|
|
84
|
+
readonly "turn.started"?: TeamsEventHandler<"turn.started">;
|
|
85
|
+
readonly "actions.requested"?: TeamsEventHandler<"actions.requested">;
|
|
86
|
+
readonly "action.result"?: TeamsEventHandler<"action.result">;
|
|
87
|
+
readonly "message.completed"?: TeamsEventHandler<"message.completed">;
|
|
88
|
+
readonly "message.appended"?: TeamsEventHandler<"message.appended">;
|
|
89
|
+
readonly "input.requested"?: TeamsEventHandler<"input.requested">;
|
|
90
|
+
readonly "turn.failed"?: TeamsEventHandler<"turn.failed">;
|
|
91
|
+
readonly "turn.completed"?: TeamsEventHandler<"turn.completed">;
|
|
92
|
+
readonly "session.failed"?: TeamsEventHandler<"session.failed">;
|
|
93
|
+
readonly "session.completed"?: TeamsEventHandler<"session.completed">;
|
|
94
|
+
readonly "session.waiting"?: TeamsEventHandler<"session.waiting">;
|
|
95
|
+
readonly "connection.authorization_required"?: TeamsEventHandler<"connection.authorization_required">;
|
|
96
|
+
readonly "connection.authorization_pending"?: TeamsEventHandler<"connection.authorization_pending">;
|
|
97
|
+
readonly "connection.authorization_completed"?: TeamsEventHandler<"connection.authorization_completed">;
|
|
98
|
+
}
|
|
99
|
+
/** Configuration for {@link teamsChannel}. */
|
|
100
|
+
export interface TeamsChannelConfig {
|
|
101
|
+
readonly adaptiveCardVersion?: string;
|
|
102
|
+
readonly api?: Omit<TeamsApiOptions, "credentials">;
|
|
103
|
+
readonly credentials?: TeamsChannelCredentials;
|
|
104
|
+
readonly events?: TeamsChannelEvents;
|
|
105
|
+
readonly files?: TeamsFilesConfig;
|
|
106
|
+
/** Override the default webhook route path (`/ash/v1/teams`). */
|
|
107
|
+
readonly route?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Inbound message hook. Defaults to user-scoped Teams auth and
|
|
110
|
+
* mention-gated dispatch outside personal chats.
|
|
111
|
+
*/
|
|
112
|
+
onMessage?(ctx: TeamsContext, message: TeamsMessageActivity): TeamsInboundResultOrPromise;
|
|
113
|
+
/**
|
|
114
|
+
* Handler for non-HITL Teams invoke activities. Return a response body,
|
|
115
|
+
* a full Response, or `null`/`undefined` for a generic 200 OK.
|
|
116
|
+
*/
|
|
117
|
+
onInvoke?(ctx: TeamsContext, activity: TeamsInvokeActivity): TeamsInvokeResultOrPromise;
|
|
118
|
+
}
|
|
119
|
+
/** Low-level Teams handle exposed to hooks and event handlers. */
|
|
120
|
+
export interface TeamsHandle {
|
|
121
|
+
readonly channelId: string | undefined;
|
|
122
|
+
readonly conversationId: string;
|
|
123
|
+
readonly conversationType: string | undefined;
|
|
124
|
+
readonly replyToActivityId: string | undefined;
|
|
125
|
+
readonly serviceUrl: string;
|
|
126
|
+
readonly teamId: string | undefined;
|
|
127
|
+
readonly tenantId: string | undefined;
|
|
128
|
+
/** Raw Bot Connector API escape hatch. */
|
|
129
|
+
request(path: string, body: TeamsOutboundActivity | JsonObject, options?: TeamsRequestOptions): Promise<TeamsApiResponse>;
|
|
130
|
+
/** Sends a Bot Framework activity to the current conversation. */
|
|
131
|
+
sendActivity(activity: TeamsMessageBody | TeamsOutboundActivity | string): Promise<TeamsPostedActivity>;
|
|
132
|
+
/** Sends a Bot Framework reply to the current thread anchor. */
|
|
133
|
+
replyToActivity(activity: TeamsMessageBody | TeamsOutboundActivity | string): Promise<TeamsPostedActivity>;
|
|
134
|
+
/** Updates a previously sent bot activity. */
|
|
135
|
+
updateActivity(activityId: string, activity: TeamsMessageBody | TeamsOutboundActivity | string): Promise<TeamsPostedActivity>;
|
|
136
|
+
/** Triggers Teams' typing indicator. Failures are swallowed by the thread helper. */
|
|
137
|
+
startTyping(): Promise<void>;
|
|
138
|
+
}
|
|
139
|
+
/** Conversation-scoped Teams operations. */
|
|
140
|
+
export interface TeamsThread {
|
|
141
|
+
/** Builds a Teams mention entity and matching text for one user. */
|
|
142
|
+
mentionUser(user: {
|
|
143
|
+
readonly id: string;
|
|
144
|
+
readonly name?: string;
|
|
145
|
+
}): TeamsMention;
|
|
146
|
+
/** Posts a message in the current Teams conversation/thread. */
|
|
147
|
+
post(message: string | TeamsMessageBody): Promise<TeamsPostedActivity>;
|
|
148
|
+
/** Starts Teams' typing indicator. Failures are swallowed. */
|
|
149
|
+
startTyping(): Promise<void>;
|
|
150
|
+
/** Updates a previously sent bot activity. */
|
|
151
|
+
update(activityId: string, message: string | TeamsMessageBody): Promise<TeamsPostedActivity>;
|
|
152
|
+
}
|
|
153
|
+
/** Options for {@link TeamsHandle.request}. */
|
|
154
|
+
export interface TeamsRequestOptions {
|
|
155
|
+
readonly method?: "DELETE" | "GET" | "POST" | "PUT";
|
|
156
|
+
}
|
|
157
|
+
/** Concrete return type of {@link teamsChannel}. */
|
|
158
|
+
export interface TeamsChannel extends Channel<TeamsChannelState>, TypedReceiveRoute<TeamsReceiveArgs> {
|
|
159
|
+
}
|
|
160
|
+
/** Teams channel factory for Bot Framework Activities and proactive messages. */
|
|
161
|
+
export declare function teamsChannel(config?: TeamsChannelConfig): TeamsChannel;
|
|
162
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createLogger}from"#internal/logging.js";import{parseJsonObject}from"#shared/json.js";import{POST,defineChannel}from"#public/definitions/defineChannel.js";import{callTeamsConnectorApi,normalizeTeamsPostInput,replyToTeamsActivity,sendTeamsActivity,teamsContinuationToken,triggerTeamsTypingIndicator,updateTeamsActivity}from"#public/channels/teams/api.js";import{deriveTeamsInputResponses,isTeamsInputResponseActivity,teamsInvokeResponse}from"#public/channels/teams/hitl.js";import{parseTeamsActivity,prependTeamsContext,teamsThreadRootActivityId}from"#public/channels/teams/inbound.js";import{buildTeamsTurnMessage,collectTeamsFileParts,createTeamsFetchFile,normalizeTeamsFilesPolicy}from"#public/channels/teams/attachments.js";import{defaultEvents,defaultOnMessage,teamsMentionUser}from"#public/channels/teams/defaults.js";import{verifyTeamsRequest}from"#public/channels/teams/verify.js";var log=createLogger(`teams.channel`);function teamsChannel(e={}){let i=normalizeTeamsFilesPolicy(e.files),a=e.onMessage??defaultOnMessage,o={...defaultEvents,...e.events};return defineChannel({kindHint:`teams`,state:initialTeamsState(),fetchFile:createTeamsFetchFile(i),context(t,n){return rebuildTeamsContext(t,n,e)},routes:[POST(e.route??`/ash/v1/teams`,async(n,{send:r,waitUntil:o})=>{let s=await verifyInbound(n,e.credentials);if(s===null)return new Response(`unauthorized`,{status:401});let c;try{c=parseJsonObject(JSON.parse(s))}catch(e){return log.warn(`inbound Teams body is not valid JSON`,{error:e}),teamsOk()}let l=parseTeamsActivity(c);return l===null?teamsOk():l.type===`message`?(o(dispatchMessage({activity:l,config:e,filesPolicy:i,onMessage:a,send:r})),teamsOk()):l.type===`invoke`?handleInvoke({activity:l,config:e,send:r,waitUntil:o}):teamsOk()})],async receive(t,{send:n}){let r=t.args,i=readString(r.serviceUrl),a=readString(r.conversationId);if(!i||!a)throw Error(`teamsChannel().receive requires args.serviceUrl and args.conversationId.`);let o=readString(r.conversationType)??null,s=readString(r.replyToActivityId)??null,l=r.initialMessage;if(l!==void 0&&s!==null)throw Error("teamsChannel().receive: `replyToActivityId` and `initialMessage` are mutually exclusive.");let u={...initialTeamsState(),channelId:readString(r.channelId)??null,conversationId:a,conversationType:o,replyToActivityId:s,serviceUrl:i,teamId:readString(r.teamId)??null,tenantId:readString(r.tenantId)??null};if(l!==void 0){let t=await buildTeamsBinding({config:e,state:u}).thread.post(l);o!==`personal`&&t.id&&(s=t.id,u.replyToActivityId=t.id)}return n(t.message,{auth:t.auth,continuationToken:teamsContinuationToken({conversationId:a,replyToActivityId:s,tenantId:u.tenantId}),state:u})},events:o})}function rebuildTeamsContext(e,t,n){return{...buildTeamsBinding({config:n,session:t,state:e}),adaptiveCardVersion:n.adaptiveCardVersion??`1.5`,session:t,state:e}}function buildTeamsBinding(e){let t=buildTeamsHandle(e);return{teams:t,thread:{mentionUser:teamsMentionUser,post(e){return t.sendActivity(e)},async startTyping(){try{await t.startTyping()}catch(e){log.debug(`Teams typing indicator failed — swallowed`,{error:e})}},update(e,n){return t.updateActivity(e,n)}}}}function buildTeamsHandle(e){let t=e.state,n=e.config.api,r=e.config.credentials;function requireAddress(){let e=t.conversationId??``,n=t.serviceUrl??``;if(!e||!n)throw Error(`teamsChannel: missing serviceUrl or conversationId for outbound message.`);return{conversationId:e,serviceUrl:n}}function anchor(n){if(!n.id||t.replyToActivityId||t.conversationType===`personal`)return;t.replyToActivityId=n.id;let r=t.conversationId;r&&e.session?.setContinuationToken(teamsContinuationToken({conversationId:r,replyToActivityId:n.id,tenantId:t.tenantId}))}async function send(e){let i=requireAddress(),a=buildOutboundActivity(t,e),c=t.replyToActivityId===null?await sendTeamsActivity({...n,body:a,credentials:r,conversationId:i.conversationId,serviceUrl:i.serviceUrl}):await replyToTeamsActivity({...n,body:a,credentials:r,activityId:t.replyToActivityId,conversationId:i.conversationId,serviceUrl:i.serviceUrl});return anchor(c),c}return{channelId:t.channelId??void 0,conversationId:t.conversationId??``,conversationType:t.conversationType??void 0,replyToActivityId:t.replyToActivityId??void 0,serviceUrl:t.serviceUrl??``,teamId:t.teamId??void 0,tenantId:t.tenantId??void 0,request(e,t,a){let o=requireAddress();return callTeamsConnectorApi({...n,body:t,credentials:r,method:a?.method,path:e,serviceUrl:o.serviceUrl})},sendActivity:send,replyToActivity(e){let i=requireAddress(),a=t.replyToActivityId??``;if(!a)throw Error(`teamsChannel: missing reply activity id.`);return replyToTeamsActivity({...n,body:buildOutboundActivity(t,e),credentials:r,activityId:a,conversationId:i.conversationId,serviceUrl:i.serviceUrl})},updateActivity(e,i){let a=requireAddress();return updateTeamsActivity({...n,body:buildOutboundActivity(t,i),credentials:r,activityId:e,conversationId:a.conversationId,serviceUrl:a.serviceUrl})},async startTyping(){let e=requireAddress();await triggerTeamsTypingIndicator({...n,credentials:r,conversationId:e.conversationId,serviceUrl:e.serviceUrl})}}}async function verifyInbound(e,t){try{return await verifyTeamsRequest(e,{appId:t?.webhookVerifier?void 0:t?.appId,webhookVerifier:t?.webhookVerifier})}catch(e){return log.warn(`teams inbound verification failed`,{error:e}),null}}async function dispatchMessage(e){let t=stateFromActivity(e.activity),n=buildTeamsBinding({config:e.config,state:t}),r;try{r=await e.onMessage(n,e.activity)}catch(e){log.error(`Teams message handler failed`,{error:e});return}if(r==null)return;let i=collectTeamsFileParts(e.activity.attachments,e.filesPolicy),a=prependTeamsContext(buildTeamsTurnMessage(e.activity.text,i),{activityId:e.activity.id,channelId:e.activity.teamsChannelId,conversationId:e.activity.conversation.id,conversationType:e.activity.conversationType,scope:e.activity.scope,teamId:e.activity.teamId,tenantId:e.activity.tenantId,userId:e.activity.from.id,userName:e.activity.from.name});try{await e.send({message:a,modelContext:r.modelContext},{auth:r.auth,continuationToken:stateToken(t),state:t})}catch(e){log.error(`Teams message delivery failed`,{error:e})}}async function handleInvoke(e){if(isTeamsInputResponseActivity(e.activity))return e.waitUntil(dispatchInputResponses({activity:e.activity,send:e.send})),Response.json(teamsInvokeResponse());if(e.config.onInvoke===void 0)return teamsOk();let t=buildTeamsBinding({config:e.config,state:stateFromActivity(e.activity)}),n=await e.config.onInvoke(t,e.activity);return n instanceof Response?n:n&&typeof n==`object`?Response.json(n):teamsOk()}async function dispatchInputResponses(e){let t=deriveTeamsInputResponses(e.activity);if(t.length===0)return;let n=stateFromActivity(e.activity);try{await e.send({inputResponses:t},{auth:null,continuationToken:stateToken(n),state:n})}catch(e){log.error(`Teams input response delivery failed`,{error:e})}}function stateFromActivity(e){return{bot:e.recipient,channelId:e.teamsChannelId??null,conversationId:e.conversation.id,conversationType:e.conversationType??e.scope,pendingAuthActivityId:null,replyToActivityId:teamsThreadRootActivityId(e),serviceUrl:e.serviceUrl,teamId:e.teamId??null,tenantId:e.tenantId??null,triggeringUser:e.from}}function initialTeamsState(){return{bot:null,channelId:null,conversationId:null,conversationType:null,pendingAuthActivityId:null,replyToActivityId:null,serviceUrl:null,teamId:null,tenantId:null,triggeringUser:null}}function stateToken(e){let t=e.conversationId??``;if(!t)throw Error(`teamsChannel: missing conversation id.`);return teamsContinuationToken({conversationId:t,replyToActivityId:e.replyToActivityId,tenantId:e.tenantId})}function buildOutboundActivity(e,t){if(typeof t!=`string`&&`type`in t&&t.type===`typing`)return t;let n=normalizeTeamsPostInput(t),r=mergeChannelData(e,n.channelData);return{...n,channelData:r,conversation:e.conversationId?{id:e.conversationId}:void 0,from:e.bot??void 0,replyToId:e.replyToActivityId??void 0,type:`message`}}function mergeChannelData(e,n){let r={...n};return e.tenantId&&(r.tenant={id:e.tenantId}),e.teamId&&(r.team={id:e.teamId}),e.channelId&&(r.channel={id:e.channelId}),Object.keys(r).length>0?parseJsonObject(r):void 0}function teamsOk(){return new Response(`ok`,{status:200})}function readString(e){return typeof e==`string`&&e.length>0?e:void 0}export{teamsChannel};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Microsoft Teams inbound Bot Framework request verification.
|
|
3
|
+
*
|
|
4
|
+
* Teams sends bot activities through the Bot Connector service. Ash verifies
|
|
5
|
+
* the bearer JWT against Bot Connector OpenID keys and the bot's Microsoft
|
|
6
|
+
* app id before dispatching any activity to the runtime.
|
|
7
|
+
*/
|
|
8
|
+
import type { JWTPayload } from "#compiled/jose/index.js";
|
|
9
|
+
import { type TeamsAppId, type TeamsFetch } from "#public/channels/teams/api.js";
|
|
10
|
+
/**
|
|
11
|
+
* Caller-supplied inbound webhook verifier. Used as an alternative to
|
|
12
|
+
* Bot Connector JWT verification when a trusted integration authenticates
|
|
13
|
+
* forwarded requests before they reach Ash.
|
|
14
|
+
*/
|
|
15
|
+
export type TeamsWebhookVerifier = (request: Request, body: string) => unknown | Promise<unknown>;
|
|
16
|
+
/** Options for {@link verifyTeamsRequest}. */
|
|
17
|
+
export interface TeamsVerifyOptions {
|
|
18
|
+
readonly appId?: TeamsAppId;
|
|
19
|
+
readonly fetch?: TeamsFetch;
|
|
20
|
+
readonly jwksUrl?: string;
|
|
21
|
+
/** Max allowed clock skew, in seconds. Defaults to 5 minutes. */
|
|
22
|
+
readonly maxSkewSeconds?: number;
|
|
23
|
+
readonly openIdMetadataUrl?: string;
|
|
24
|
+
readonly webhookVerifier?: TeamsWebhookVerifier;
|
|
25
|
+
}
|
|
26
|
+
/** Options for {@link verifyTeamsJwt}. */
|
|
27
|
+
export interface TeamsJwtVerifyOptions {
|
|
28
|
+
readonly appId?: TeamsAppId;
|
|
29
|
+
readonly fetch?: TeamsFetch;
|
|
30
|
+
readonly jwksUrl?: string;
|
|
31
|
+
/** Max allowed clock skew, in seconds. Defaults to 5 minutes. */
|
|
32
|
+
readonly maxSkewSeconds?: number;
|
|
33
|
+
readonly openIdMetadataUrl?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Verifies an inbound Teams request and returns the raw body.
|
|
37
|
+
*
|
|
38
|
+
* Throws when no verifier/app id is configured, the bearer token is missing,
|
|
39
|
+
* metadata or keys cannot be loaded, or JWT verification fails.
|
|
40
|
+
*/
|
|
41
|
+
export declare function verifyTeamsRequest(request: Request, options: TeamsVerifyOptions): Promise<string>;
|
|
42
|
+
/** Verifies one Bot Connector JWT and returns its payload. */
|
|
43
|
+
export declare function verifyTeamsJwt(token: string, options: TeamsJwtVerifyOptions): Promise<JWTPayload>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createLogger}from"#internal/logging.js";import{isObject}from"#shared/guards.js";import{importJWK,jwtVerify}from"#compiled/jose/index.js";import{resolveTeamsAppId}from"#public/channels/teams/api.js";var log=createLogger(`teams.verify`),DEFAULT_BOT_CONNECTOR_OPENID_METADATA_URL=`https://login.botframework.com/v1/.well-known/openidconfiguration`,BOT_CONNECTOR_ISSUER=`https://api.botframework.com`;async function verifyTeamsRequest(e,t){let n=await e.text();if(t.webhookVerifier!==void 0){let r=await t.webhookVerifier(e,n);if(!r)throw Error(`teamsChannel: inbound webhook verifier rejected the request.`);return typeof r==`string`?r:n}let r=readBearerToken(e.headers.get(`authorization`)??``);if(!r)throw Error(`teamsChannel: inbound request missing bearer token.`);return await verifyTeamsJwt(r,t),n}async function verifyTeamsJwt(e,t){let a=await resolveTeamsAppId(t.appId),o=await loadJwks(t);return(await jwtVerify(e,async e=>importJWK(selectJwk(o,e),typeof e.alg==`string`?e.alg:void 0),{audience:a,clockTolerance:t.maxSkewSeconds??300,issuer:BOT_CONNECTOR_ISSUER})).payload}function readBearerToken(e){let[t,n]=e.split(/\s+/,2);return t?.toLowerCase()!==`bearer`||!n?null:n}async function loadJwks(e){let n=e.fetch??fetch,r=await n(e.jwksUrl??await loadJwksUrl(e,n),{headers:{accept:`application/json`}});if(!r.ok)throw Error(`Teams JWKS route returned HTTP ${r.status}.`);let i=await r.json();if(!isObject(i)||!Array.isArray(i.keys))throw Error(`Teams JWKS response is malformed.`);return i.keys.filter(isObject)}async function loadJwksUrl(e,n){let r=await n(e.openIdMetadataUrl??DEFAULT_BOT_CONNECTOR_OPENID_METADATA_URL,{headers:{accept:`application/json`}});if(!r.ok)throw Error(`Teams OpenID metadata route returned HTTP ${r.status}.`);let i=await r.json();if(!isObject(i)||typeof i.jwks_uri!=`string`)throw Error(`Teams OpenID metadata response is missing jwks_uri.`);return i.jwks_uri}function selectJwk(e,t){let n=typeof t.kid==`string`?t.kid:void 0,r=typeof t.x5t==`string`?t.x5t:void 0,i=e.find(e=>n!==void 0&&e.kid===n||r!==void 0&&e.x5t===r)??(e.length===1?e[0]:void 0);if(i===void 0)throw log.debug(`Teams JWT key not found`,{kid:n,x5t:r}),Error(`teamsChannel: inbound JWT key was not found in JWKS.`);return i}export{verifyTeamsJwt,verifyTeamsRequest};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal Telegram Bot API wrapper used by the Telegram channel.
|
|
3
|
+
*
|
|
4
|
+
* The channel talks directly to Telegram's JSON HTTP API instead of
|
|
5
|
+
* exposing a third-party SDK through Ash public surfaces.
|
|
6
|
+
*/
|
|
7
|
+
import { type JsonObject } from "#shared/json.js";
|
|
8
|
+
/** Telegram bot token, materialized directly or from an async secret provider. */
|
|
9
|
+
export type TelegramBotToken = string | (() => string | Promise<string>);
|
|
10
|
+
/** Fetch implementation override used by tests or non-standard runtimes. */
|
|
11
|
+
export type TelegramFetch = typeof fetch;
|
|
12
|
+
/** Credentials used by the native Telegram channel. */
|
|
13
|
+
export interface TelegramCredentials {
|
|
14
|
+
readonly botToken?: TelegramBotToken;
|
|
15
|
+
}
|
|
16
|
+
/** Shared Telegram API options. */
|
|
17
|
+
export interface TelegramApiOptions {
|
|
18
|
+
readonly apiBaseUrl?: string;
|
|
19
|
+
readonly credentials?: TelegramCredentials;
|
|
20
|
+
readonly fetch?: TelegramFetch;
|
|
21
|
+
readonly fileBaseUrl?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Raw Telegram API response body. */
|
|
24
|
+
export interface TelegramApiResponse {
|
|
25
|
+
readonly body: unknown;
|
|
26
|
+
readonly ok: boolean;
|
|
27
|
+
readonly status: number;
|
|
28
|
+
}
|
|
29
|
+
/** Minimal Telegram message object returned by channel write operations. */
|
|
30
|
+
export interface TelegramMessageResult {
|
|
31
|
+
/** Telegram message id, when Telegram returned one. */
|
|
32
|
+
readonly id: string;
|
|
33
|
+
/** Telegram chat id associated with the message, when Telegram returned one. */
|
|
34
|
+
readonly chatId?: string;
|
|
35
|
+
/** Telegram's raw JSON response. */
|
|
36
|
+
readonly raw: unknown;
|
|
37
|
+
}
|
|
38
|
+
/** JSON body supported by Telegram sendMessage endpoints used by Ash. */
|
|
39
|
+
export interface TelegramMessageBody {
|
|
40
|
+
readonly disable_notification?: boolean;
|
|
41
|
+
readonly link_preview_options?: Readonly<Record<string, unknown>>;
|
|
42
|
+
readonly message_thread_id?: number;
|
|
43
|
+
readonly protect_content?: boolean;
|
|
44
|
+
readonly reply_markup?: Readonly<Record<string, unknown>>;
|
|
45
|
+
readonly reply_parameters?: Readonly<Record<string, unknown>>;
|
|
46
|
+
readonly text: string;
|
|
47
|
+
}
|
|
48
|
+
/** Telegram's documented text-message cap. */
|
|
49
|
+
export declare const TELEGRAM_MESSAGE_TEXT_MAX_LENGTH = 4096;
|
|
50
|
+
/**
|
|
51
|
+
* Builds the channel-local continuation token.
|
|
52
|
+
*
|
|
53
|
+
* Private chats normally use only `chatId`; group and forum-topic
|
|
54
|
+
* sessions include `messageThreadId` and `conversationId` so multiple
|
|
55
|
+
* bot conversations in the same chat do not collapse into one session.
|
|
56
|
+
*/
|
|
57
|
+
export declare function telegramContinuationToken(input: {
|
|
58
|
+
readonly chatId: number | string;
|
|
59
|
+
readonly conversationId?: number | string;
|
|
60
|
+
readonly messageThreadId?: number;
|
|
61
|
+
}): string;
|
|
62
|
+
/** Resolves a Telegram bot token, falling back to `TELEGRAM_BOT_TOKEN`. */
|
|
63
|
+
export declare function resolveTelegramBotToken(token?: TelegramBotToken): Promise<string>;
|
|
64
|
+
/** Low-level Telegram JSON API call. */
|
|
65
|
+
export declare function callTelegramApi(input: {
|
|
66
|
+
readonly apiBaseUrl?: string;
|
|
67
|
+
readonly body?: JsonObject;
|
|
68
|
+
readonly botToken?: TelegramBotToken;
|
|
69
|
+
readonly fetch?: TelegramFetch;
|
|
70
|
+
readonly method: string;
|
|
71
|
+
}): Promise<TelegramApiResponse>;
|
|
72
|
+
/** Sends a text message through Telegram's sendMessage method. */
|
|
73
|
+
export declare function sendTelegramMessage(input: TelegramApiOptions & {
|
|
74
|
+
readonly body: TelegramMessageBody;
|
|
75
|
+
readonly chatId: number | string;
|
|
76
|
+
}): Promise<TelegramMessageResult>;
|
|
77
|
+
/** Triggers Telegram's chat action indicator, usually `typing`. */
|
|
78
|
+
export declare function sendTelegramChatAction(input: TelegramApiOptions & {
|
|
79
|
+
readonly action: string;
|
|
80
|
+
readonly chatId: number | string;
|
|
81
|
+
readonly messageThreadId?: number;
|
|
82
|
+
}): Promise<TelegramApiResponse>;
|
|
83
|
+
/** Answers a Telegram callback query so the user's client clears the spinner. */
|
|
84
|
+
export declare function answerTelegramCallbackQuery(input: TelegramApiOptions & {
|
|
85
|
+
readonly callbackQueryId: string;
|
|
86
|
+
readonly showAlert?: boolean;
|
|
87
|
+
readonly text?: string;
|
|
88
|
+
}): Promise<TelegramApiResponse>;
|
|
89
|
+
/** Edits only the reply markup for one Telegram message. */
|
|
90
|
+
export declare function editTelegramMessageReplyMarkup(input: TelegramApiOptions & {
|
|
91
|
+
readonly chatId: number | string;
|
|
92
|
+
readonly messageId: number | string;
|
|
93
|
+
readonly replyMarkup?: Readonly<Record<string, unknown>>;
|
|
94
|
+
}): Promise<TelegramApiResponse>;
|
|
95
|
+
/** Resolves Telegram file metadata through `getFile`. */
|
|
96
|
+
export declare function getTelegramFile(input: TelegramApiOptions & {
|
|
97
|
+
readonly fileId: string;
|
|
98
|
+
}): Promise<{
|
|
99
|
+
readonly filePath: string;
|
|
100
|
+
readonly raw: unknown;
|
|
101
|
+
}>;
|
|
102
|
+
/** Downloads file bytes from Telegram's file endpoint. */
|
|
103
|
+
export declare function downloadTelegramFile(input: TelegramApiOptions & {
|
|
104
|
+
readonly filePath: string;
|
|
105
|
+
}): Promise<Response>;
|
|
106
|
+
/** Splits text into chunks Telegram will accept as individual sendMessage calls. */
|
|
107
|
+
export declare function splitTelegramMessageText(text: string): readonly string[];
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{isObject}from"#shared/guards.js";import{parseJsonObject}from"#shared/json.js";var TELEGRAM_MESSAGE_TEXT_MAX_LENGTH=4096;function telegramContinuationToken(e){let t=e.messageThreadId===void 0?``:String(e.messageThreadId),n=e.conversationId===void 0?``:String(e.conversationId);return`${String(e.chatId)}:${t}:${n}`}async function resolveTelegramBotToken(e){let t=e??process.env.TELEGRAM_BOT_TOKEN;if(!t)throw Error(`TELEGRAM_BOT_TOKEN is required.`);return typeof t==`function`?await t():t}async function callTelegramApi(e){let n=e.fetch??fetch,r=await resolveTelegramBotToken(e.botToken),i={headers:{"content-type":`application/json; charset=utf-8`},method:`POST`};e.body!==void 0&&(i.body=JSON.stringify(parseJsonObject(e.body)));let a=await n(`${e.apiBaseUrl??`https://api.telegram.org`}/bot${r}/${encodeURIComponent(e.method)}`,i);return{body:await parseResponseBody(a),ok:a.ok,status:a.status}}async function sendTelegramMessage(e){let t=await callTelegramApi({apiBaseUrl:e.apiBaseUrl,body:normalizeTelegramMessageBody(e.body,e.chatId),botToken:e.credentials?.botToken,fetch:e.fetch,method:`sendMessage`});if(!t.ok)throw Error(`Telegram sendMessage failed with HTTP ${t.status}.`);return toTelegramMessageResult(t.body)}async function sendTelegramChatAction(e){return callTelegramApi({apiBaseUrl:e.apiBaseUrl,body:parseJsonObject({action:e.action,chat_id:e.chatId,message_thread_id:e.messageThreadId}),botToken:e.credentials?.botToken,fetch:e.fetch,method:`sendChatAction`})}async function answerTelegramCallbackQuery(e){return callTelegramApi({apiBaseUrl:e.apiBaseUrl,body:parseJsonObject({callback_query_id:e.callbackQueryId,show_alert:e.showAlert,text:e.text}),botToken:e.credentials?.botToken,fetch:e.fetch,method:`answerCallbackQuery`})}async function editTelegramMessageReplyMarkup(e){return callTelegramApi({apiBaseUrl:e.apiBaseUrl,body:parseJsonObject({chat_id:e.chatId,message_id:Number(e.messageId),reply_markup:e.replyMarkup}),botToken:e.credentials?.botToken,fetch:e.fetch,method:`editMessageReplyMarkup`})}async function getTelegramFile(t){let n=await callTelegramApi({apiBaseUrl:t.apiBaseUrl,body:{file_id:t.fileId},botToken:t.credentials?.botToken,fetch:t.fetch,method:`getFile`});if(!n.ok)throw Error(`Telegram getFile failed with HTTP ${n.status}.`);let r=isObject(n.body)?n.body:{},i=isObject(r.result)?r.result:{};if(typeof i.file_path!=`string`||i.file_path.length===0)throw Error(`Telegram getFile response did not include result.file_path.`);return{filePath:i.file_path,raw:n.body}}async function downloadTelegramFile(e){let t=e.fetch??fetch,n=await resolveTelegramBotToken(e.credentials?.botToken);return t(`${e.fileBaseUrl??e.apiBaseUrl??`https://api.telegram.org`}/file/bot${n}/${e.filePath}`)}function splitTelegramMessageText(e){if(e.length<=4096)return[e];let t=[],r=e;for(;r.length>TELEGRAM_MESSAGE_TEXT_MAX_LENGTH;){let e=r.lastIndexOf(`
|
|
2
|
+
`,TELEGRAM_MESSAGE_TEXT_MAX_LENGTH);e<=0&&(e=r.lastIndexOf(` `,TELEGRAM_MESSAGE_TEXT_MAX_LENGTH)),e<=0&&(e=TELEGRAM_MESSAGE_TEXT_MAX_LENGTH),t.push(r.slice(0,e).trimEnd()),r=r.slice(e).trimStart()}return t.push(r),t}function normalizeTelegramMessageBody(e,n){return parseJsonObject({...e,chat_id:n})}function toTelegramMessageResult(t){let n=isObject(t)?t:{},r=isObject(n.result)?n.result:{},i=isObject(r.chat)?r.chat:{};return{chatId:typeof i.id==`number`||typeof i.id==`string`?String(i.id):void 0,id:typeof r.message_id==`number`||typeof r.message_id==`string`?String(r.message_id):``,raw:t}}async function parseResponseBody(e){let t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return t}}export{TELEGRAM_MESSAGE_TEXT_MAX_LENGTH,answerTelegramCallbackQuery,callTelegramApi,downloadTelegramFile,editTelegramMessageReplyMarkup,getTelegramFile,resolveTelegramBotToken,sendTelegramChatAction,sendTelegramMessage,splitTelegramMessageText,telegramContinuationToken};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FilePart, UserContent } from "ai";
|
|
2
|
+
import type { FetchFileResult } from "#channel/adapter.js";
|
|
3
|
+
import { type TelegramApiOptions } from "#public/channels/telegram/api.js";
|
|
4
|
+
import type { TelegramAttachment, TelegramMessage } from "#public/channels/telegram/inbound.js";
|
|
5
|
+
import { type UploadPolicy } from "#public/channels/upload-policy.js";
|
|
6
|
+
/** URL protocol used by the channel to defer Telegram file downloads to `fetchFile`. */
|
|
7
|
+
export declare const TELEGRAM_FILE_URL_PROTOCOL = "telegram-file:";
|
|
8
|
+
/** Emits one {@link FilePart} per supported Telegram attachment. */
|
|
9
|
+
export declare function collectTelegramFileParts(attachments: readonly TelegramAttachment[], policy: UploadPolicy): FilePart[];
|
|
10
|
+
/** Combines text/caption + file parts into the {@link UserContent} shape the harness expects. */
|
|
11
|
+
export declare function buildTelegramTurnMessage(message: Pick<TelegramMessage, "caption" | "text">, fileParts: readonly FilePart[]): string | UserContent;
|
|
12
|
+
/** Creates a `fetchFile` function for Telegram-owned file URLs. */
|
|
13
|
+
export declare function createTelegramFetchFile(input: {
|
|
14
|
+
readonly api?: Omit<TelegramApiOptions, "credentials">;
|
|
15
|
+
readonly credentials?: TelegramApiOptions["credentials"];
|
|
16
|
+
readonly policy: UploadPolicy;
|
|
17
|
+
}): (url: string) => Promise<FetchFileResult | null>;
|
|
18
|
+
/** Builds the internal URL used to defer a Telegram file download. */
|
|
19
|
+
export declare function createTelegramFileUrl(input: {
|
|
20
|
+
readonly fileId: string;
|
|
21
|
+
readonly filename?: string;
|
|
22
|
+
readonly mediaType?: string;
|
|
23
|
+
}): URL;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createLogger}from"#internal/logging.js";import{evaluateFilePart,formatUploadPolicyViolation,isMediaTypeAllowed,isUploadsDisabled}from"#public/channels/upload-policy.js";import{downloadTelegramFile,getTelegramFile}from"#public/channels/telegram/api.js";var log=createLogger(`telegram.attachments`),TELEGRAM_FILE_URL_PROTOCOL=`telegram-file:`;function collectTelegramFileParts(e,t){if(isUploadsDisabled(t))return[];let r=[];for(let i of e){let e=toTelegramFilePart(i,r.length);if(e===null)continue;let a=evaluateTelegramFilePart(e,i.size,t);if(a!==null){log.warn(`dropped attachment — ${formatUploadPolicyViolation(a)}`,{fileId:i.fileId,name:i.fileName});continue}r.push(e)}return r}function buildTelegramTurnMessage(e,t){let n=e.text||e.caption;return t.length===0?n:n.trim().length===0?[...t]:[{type:`text`,text:n},...t]}function createTelegramFetchFile(e){return async r=>{let i=parseTelegramFileUrl(r);if(i===null)return null;let o=await getTelegramFile({apiBaseUrl:e.api?.apiBaseUrl,credentials:e.credentials,fetch:e.api?.fetch,fileId:i.fileId}),s=await downloadTelegramFile({apiBaseUrl:e.api?.apiBaseUrl,credentials:e.credentials,fetch:e.api?.fetch,fileBaseUrl:e.api?.fileBaseUrl,filePath:o.filePath});if(!s.ok)throw Error(`Telegram file fetch returned HTTP ${s.status} for ${r}.`);let c=Buffer.from(await s.arrayBuffer()),l=s.headers.get(`content-type`)??i.mediaType??`application/octet-stream`,u={bytes:c,filename:i.filename,mediaType:l},d=evaluateFilePart({data:u.bytes,filename:u.filename,mediaType:l,type:`file`},e.policy);if(d!==null)throw Error(`Telegram file rejected — ${formatUploadPolicyViolation(d)}`);return u}}function createTelegramFileUrl(e){let t=new URLSearchParams;e.filename!==void 0&&t.set(`filename`,e.filename),e.mediaType!==void 0&&t.set(`mediaType`,e.mediaType);let n=t.size>0?`?${t.toString()}`:``;return new URL(`${TELEGRAM_FILE_URL_PROTOCOL}${encodeURIComponent(e.fileId)}${n}`)}function toTelegramFilePart(e,t){let n=e.mediaType??(e.kind===`photo`?`image/jpeg`:`application/octet-stream`),r=e.fileName??(e.kind===`photo`?`photo-${t}.jpg`:`file-${t}`);return{data:createTelegramFileUrl({fileId:e.fileId,filename:r,mediaType:n}),filename:r,mediaType:n,type:`file`}}function parseTelegramFileUrl(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`telegram-file:`)return null;let n=decodeURIComponent(t.pathname);return n?{fileId:n,filename:t.searchParams.get(`filename`)??void 0,mediaType:t.searchParams.get(`mediaType`)??void 0}:null}function evaluateTelegramFilePart(e,n,i){return i===`disabled`||!isMediaTypeAllowed(e.mediaType,i)?evaluateFilePart(e,i):n!==void 0&&n>i.maxBytes?{byteLength:n,filename:e.filename,kind:`too-large`,limit:i.maxBytes,mediaType:e.mediaType}:null}export{TELEGRAM_FILE_URL_PROTOCOL,buildTelegramTurnMessage,collectTelegramFileParts,createTelegramFetchFile,createTelegramFileUrl};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SessionAuthContext } from "#channel/types.js";
|
|
2
|
+
import type { TelegramMessage } from "#public/channels/telegram/inbound.js";
|
|
3
|
+
import type { TelegramChannelEvents, TelegramContext, TelegramInboundResult } from "#public/channels/telegram/telegramChannel.js";
|
|
4
|
+
/** Default auth projection for Telegram webhook actors. */
|
|
5
|
+
export declare function defaultTelegramAuth(message: TelegramMessage): SessionAuthContext | null;
|
|
6
|
+
/** Default inbound message hook: dispatch allowed messages with Telegram user auth. */
|
|
7
|
+
export declare function defaultOnMessage(ctx: TelegramContext, message: TelegramMessage): Promise<TelegramInboundResult>;
|
|
8
|
+
/** Built-in Telegram event handlers for typing, replies, HITL, and terminal errors. */
|
|
9
|
+
export declare const defaultEvents: TelegramChannelEvents;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{extractErrorId,formatErrorHint}from"#internal/logging.js";import{registerTelegramFreeformPrompt,renderTelegramInputRequest}from"#public/channels/telegram/hitl.js";function defaultTelegramAuth(e){let t=e.from;if(!t)return null;let n={chat_id:e.chat.id,chat_type:e.chat.type,message_id:e.messageId,user_id:t.id};e.chat.title!==void 0&&(n.chat_title=e.chat.title),e.messageThreadId!==void 0&&(n.message_thread_id=String(e.messageThreadId)),t.username!==void 0&&(n.username=t.username);let r=e.chat.type===`group`||e.chat.type===`supergroup`,i=r?`telegram:${e.chat.id}:${t.id}`:`telegram:${t.id}`;return{attributes:n,authenticator:`telegram-webhook`,issuer:r?`telegram:${e.chat.id}`:`telegram`,principalId:i,principalType:t.isBot?`service`:`user`}}async function defaultOnMessage(e,t){return shouldDispatchTelegramMessage(t,e.telegram.botUsername)?(await e.telegram.startTyping(),{auth:defaultTelegramAuth(t)}):null}var defaultEvents={async"turn.started"(e,t){await t.telegram.startTyping()},async"actions.requested"(e,t){await t.telegram.startTyping()},async"input.requested"(e,t){for(let i of e.requests){let e=renderTelegramInputRequest(i,t.state),a=await t.telegram.post({reply_markup:e.replyMarkup,text:e.text});e.freeformRequestId!==void 0&&a.id&®isterTelegramFreeformPrompt(t.state,{messageId:a.id,requestId:e.freeformRequestId})}},async"message.completed"(e,t){e.finishReason===`tool-calls`||!e.message||await t.telegram.post(e.message)},async"turn.failed"(n,r){let i=formatErrorHint(n),a=extractErrorId(n.details);await r.telegram.post([`I hit an error while handling your request${i}.`,``,`Please try again, rephrase, or reach out if it keeps failing.`,...a?[``,`Error id: ${a}`]:[]].join(`
|
|
2
|
+
`))},async"session.failed"(n,r){let i=formatErrorHint(n),a=extractErrorId(n.details);await r.telegram.post([`This session could not recover from an error${i}.`,``,`Start a new message to continue.`,...a?[``,`Error id: ${a}`]:[]].join(`
|
|
3
|
+
`))}};function shouldDispatchTelegramMessage(e,t){if(e.from?.isBot===!0||e.chat.type===`channel`)return!1;let n=e.text||e.caption;return n.trim().length>0||e.attachments.length>0?!!(e.chat.type===`private`||e.replyToMessage?.from?.isBot===!0||isBotCommand(n,t)||t!==void 0&&mentionsBot(n,t)):!1}function isBotCommand(e,t){let n=/^\/(?<command>[A-Za-z0-9_]+)(?:@(?<target>[A-Za-z0-9_]+))?(?:\s|$)/u.exec(e);if(!n)return!1;let r=n.groups?.target;return r===void 0?!0:t!==void 0&&r.toLowerCase()===t.toLowerCase()}function mentionsBot(e,t){return e.toLowerCase().includes(`@${t.toLowerCase()}`)}export{defaultEvents,defaultOnMessage,defaultTelegramAuth};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Telegram HITL inline keyboard rendering + compact callback decode helpers.
|
|
3
|
+
*
|
|
4
|
+
* Telegram limits `InlineKeyboardButton.callback_data` to 64 bytes, so
|
|
5
|
+
* Ash stores compact callback ids in durable channel state and remaps
|
|
6
|
+
* them back to full input responses inside the channel deliver hook.
|
|
7
|
+
*/
|
|
8
|
+
import type { InputRequest, InputResponse } from "#runtime/input/types.js";
|
|
9
|
+
/** Prefix used in Telegram callback_data values generated by Ash. */
|
|
10
|
+
export declare const TELEGRAM_HITL_CALLBACK_PREFIX = "ash:";
|
|
11
|
+
/** Synthetic request id prefix sent through `send()` for callback queries. */
|
|
12
|
+
export declare const TELEGRAM_CALLBACK_RESPONSE_PREFIX = "telegram_callback:";
|
|
13
|
+
/** Synthetic request id prefix sent through `send()` for replies to ForceReply prompts. */
|
|
14
|
+
export declare const TELEGRAM_REPLY_RESPONSE_PREFIX = "telegram_reply:";
|
|
15
|
+
/** Minimal durable state shape used by the HITL helpers. */
|
|
16
|
+
export interface TelegramHitlState {
|
|
17
|
+
hitlCallbacks?: Record<string, InputResponse>;
|
|
18
|
+
nextHitlCallbackId?: number;
|
|
19
|
+
pendingFreeformReplies?: Record<string, string>;
|
|
20
|
+
}
|
|
21
|
+
/** Rendered Telegram message body for one pending input request. */
|
|
22
|
+
export interface TelegramInputRequestMessage {
|
|
23
|
+
readonly freeformRequestId?: string;
|
|
24
|
+
readonly replyMarkup?: Readonly<Record<string, unknown>>;
|
|
25
|
+
readonly text: string;
|
|
26
|
+
}
|
|
27
|
+
/** Renders one `InputRequest` as Telegram inline keyboard or ForceReply markup. */
|
|
28
|
+
export declare function renderTelegramInputRequest(request: InputRequest, state: TelegramHitlState): TelegramInputRequestMessage;
|
|
29
|
+
/** Records the Telegram message id that a freeform answer should reply to. */
|
|
30
|
+
export declare function registerTelegramFreeformPrompt(state: TelegramHitlState, input: {
|
|
31
|
+
readonly messageId: string;
|
|
32
|
+
readonly requestId: string;
|
|
33
|
+
}): void;
|
|
34
|
+
/** Wraps Telegram callback data in an `InputResponse` shape for delivery. */
|
|
35
|
+
export declare function telegramCallbackInputResponse(callbackData: string): InputResponse;
|
|
36
|
+
/** Wraps a reply-to-message id in an `InputResponse` shape for delivery. */
|
|
37
|
+
export declare function telegramReplyInputResponse(input: {
|
|
38
|
+
readonly messageId: string;
|
|
39
|
+
readonly text: string;
|
|
40
|
+
}): InputResponse;
|
|
41
|
+
/** True when an input response needs Telegram-specific durable-state remapping. */
|
|
42
|
+
export declare function isTelegramSyntheticResponse(response: InputResponse): boolean;
|
|
43
|
+
/** Remaps compact Telegram callback/reply ids into real Ash input responses. */
|
|
44
|
+
export declare function resolveTelegramInputResponses(state: TelegramHitlState, responses: readonly InputResponse[]): InputResponse[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var TELEGRAM_HITL_CALLBACK_PREFIX=`ash:`,TELEGRAM_CALLBACK_RESPONSE_PREFIX=`telegram_callback:`,TELEGRAM_REPLY_RESPONSE_PREFIX=`telegram_reply:`,TELEGRAM_BUTTON_LABEL_MAX_LENGTH=64,TELEGRAM_INPUT_PLACEHOLDER_MAX_LENGTH=64,TELEGRAM_PROMPT_MAX_LENGTH=4e3,TELEGRAM_INLINE_ROW_SIZE=2;function renderTelegramInputRequest(e,t){let n=e.options;return n&&n.length>0?{replyMarkup:{inline_keyboard:chunk(n.map(n=>({callback_data:registerTelegramCallback(t,{optionId:n.id,requestId:e.requestId}),text:truncate(n.label,TELEGRAM_BUTTON_LABEL_MAX_LENGTH)})),TELEGRAM_INLINE_ROW_SIZE)},text:truncate(e.prompt,TELEGRAM_PROMPT_MAX_LENGTH)}:{freeformRequestId:e.requestId,replyMarkup:{force_reply:!0,input_field_placeholder:truncate(`Type your answer`,TELEGRAM_INPUT_PLACEHOLDER_MAX_LENGTH),selective:!0},text:truncate(e.prompt,TELEGRAM_PROMPT_MAX_LENGTH)}}function registerTelegramFreeformPrompt(e,t){e.pendingFreeformReplies={...e.pendingFreeformReplies,[t.messageId]:t.requestId}}function telegramCallbackInputResponse(e){return{optionId:`selected`,requestId:`${TELEGRAM_CALLBACK_RESPONSE_PREFIX}${e}`}}function telegramReplyInputResponse(e){return{requestId:`${TELEGRAM_REPLY_RESPONSE_PREFIX}${e.messageId}`,text:e.text}}function isTelegramSyntheticResponse(e){return e.requestId.startsWith(`telegram_callback:`)||e.requestId.startsWith(`telegram_reply:`)}function resolveTelegramInputResponses(e,r){let i=[];for(let a of r){if(a.requestId.startsWith(`telegram_callback:`)){let n=a.requestId.slice(TELEGRAM_CALLBACK_RESPONSE_PREFIX.length),r=e.hitlCallbacks?.[n];r!==void 0&&(i.push(r),delete e.hitlCallbacks?.[n]);continue}if(a.requestId.startsWith(`telegram_reply:`)){let t=a.requestId.slice(TELEGRAM_REPLY_RESPONSE_PREFIX.length),r=e.pendingFreeformReplies?.[t];r!==void 0&&a.text!==void 0&&(i.push({requestId:r,text:a.text}),delete e.pendingFreeformReplies?.[t]);continue}i.push(a)}return i}function registerTelegramCallback(t,n){let r=t.nextHitlCallbackId??0;t.nextHitlCallbackId=r+1;let i=`${TELEGRAM_HITL_CALLBACK_PREFIX}${r.toString(36)}`;return t.hitlCallbacks={...t.hitlCallbacks,[i]:n},i}function truncate(e,t){if(e.length<=t)return e;let n=Math.max(0,t-3);return`${e.slice(0,n).trimEnd()}...`}function chunk(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}export{TELEGRAM_CALLBACK_RESPONSE_PREFIX,TELEGRAM_HITL_CALLBACK_PREFIX,TELEGRAM_REPLY_RESPONSE_PREFIX,isTelegramSyntheticResponse,registerTelegramFreeformPrompt,renderTelegramInputRequest,resolveTelegramInputResponses,telegramCallbackInputResponse,telegramReplyInputResponse};
|