experimental-ash 0.2.0-alpha.1 → 0.2.0-alpha.10
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/dist/src/channel/http-emitter.d.ts +4 -2
- package/dist/src/channel/http-emitter.d.ts.map +1 -1
- package/dist/src/channel/http-emitter.js +5 -1
- package/dist/src/channel/http-emitter.js.map +1 -1
- package/dist/src/channel/resolve-text.d.ts +20 -0
- package/dist/src/channel/resolve-text.d.ts.map +1 -0
- package/dist/src/channel/resolve-text.js +60 -0
- package/dist/src/channel/resolve-text.js.map +1 -0
- package/dist/src/channel/schedule-emitter.d.ts +4 -2
- package/dist/src/channel/schedule-emitter.d.ts.map +1 -1
- package/dist/src/channel/schedule-emitter.js +5 -1
- package/dist/src/channel/schedule-emitter.js.map +1 -1
- package/dist/src/channel/slack-emitter.d.ts +29 -13
- package/dist/src/channel/slack-emitter.d.ts.map +1 -1
- package/dist/src/channel/slack-emitter.js +168 -77
- package/dist/src/channel/slack-emitter.js.map +1 -1
- package/dist/src/channel/subagent-emitter.d.ts +2 -1
- package/dist/src/channel/subagent-emitter.d.ts.map +1 -1
- package/dist/src/channel/subagent-emitter.js +3 -0
- package/dist/src/channel/subagent-emitter.js.map +1 -1
- package/dist/src/channel/types.d.ts +53 -34
- package/dist/src/channel/types.d.ts.map +1 -1
- package/dist/src/cli/dev/input-requests.d.ts +4 -4
- package/dist/src/cli/dev/input-requests.d.ts.map +1 -1
- package/dist/src/cli/dev/input-requests.js +34 -65
- package/dist/src/cli/dev/input-requests.js.map +1 -1
- package/dist/src/cli/dev/repl.d.ts.map +1 -1
- package/dist/src/cli/dev/repl.js +40 -23
- package/dist/src/cli/dev/repl.js.map +1 -1
- package/dist/src/client/index.d.ts +3 -2
- package/dist/src/client/index.d.ts.map +1 -1
- package/dist/src/client/index.js +1 -0
- package/dist/src/client/index.js.map +1 -1
- package/dist/src/client/message-response.d.ts +5 -5
- package/dist/src/client/message-response.d.ts.map +1 -1
- package/dist/src/client/message-response.js +6 -6
- package/dist/src/client/message-response.js.map +1 -1
- package/dist/src/client/open-stream.d.ts +1 -1
- package/dist/src/client/open-stream.d.ts.map +1 -1
- package/dist/src/client/open-stream.js +1 -1
- package/dist/src/client/open-stream.js.map +1 -1
- package/dist/src/client/session-utils.d.ts +3 -3
- package/dist/src/client/session-utils.d.ts.map +1 -1
- package/dist/src/client/session-utils.js +4 -4
- package/dist/src/client/session-utils.js.map +1 -1
- package/dist/src/client/session.d.ts +5 -5
- package/dist/src/client/session.js +28 -28
- package/dist/src/client/session.js.map +1 -1
- package/dist/src/client/types.d.ts +8 -8
- package/dist/src/client/types.d.ts.map +1 -1
- package/dist/src/compiler/channel-url.d.ts +1 -1
- package/dist/src/compiler/channel-url.js +1 -1
- package/dist/src/compiler/manifest.d.ts +1 -1
- package/dist/src/context/keys.d.ts +0 -2
- package/dist/src/context/keys.d.ts.map +1 -1
- package/dist/src/context/keys.js +0 -1
- package/dist/src/context/keys.js.map +1 -1
- package/dist/src/context/providers/session.d.ts.map +1 -1
- package/dist/src/context/providers/session.js +1 -2
- package/dist/src/context/providers/session.js.map +1 -1
- package/dist/src/discover/grammar.d.ts +3 -3
- package/dist/src/discover/grammar.js +4 -4
- package/dist/src/discover/grammar.js.map +1 -1
- package/dist/src/evals/runner/artifacts.js +1 -1
- package/dist/src/evals/runner/artifacts.js.map +1 -1
- package/dist/src/evals/runner/derive-run-facts.js +5 -5
- package/dist/src/evals/runner/derive-run-facts.js.map +1 -1
- package/dist/src/evals/runner/execute-case.js +4 -4
- package/dist/src/evals/runner/execute-case.js.map +1 -1
- package/dist/src/evals/runner/execute-suite.js +1 -1
- package/dist/src/evals/runner/execute-suite.js.map +1 -1
- package/dist/src/evals/runner/reporters/braintrust.js +2 -2
- package/dist/src/evals/runner/reporters/braintrust.js.map +1 -1
- package/dist/src/evals/types.d.ts +4 -4
- package/dist/src/evals/types.d.ts.map +1 -1
- package/dist/src/execution/continuous-entry.d.ts +3 -2
- package/dist/src/execution/continuous-entry.d.ts.map +1 -1
- package/dist/src/execution/continuous-entry.js +25 -10
- package/dist/src/execution/continuous-entry.js.map +1 -1
- package/dist/src/execution/continuous-runtime.d.ts.map +1 -1
- package/dist/src/execution/continuous-runtime.js +2 -2
- package/dist/src/execution/continuous-runtime.js.map +1 -1
- package/dist/src/execution/node-step.d.ts +1 -2
- package/dist/src/execution/node-step.d.ts.map +1 -1
- package/dist/src/execution/node-step.js +42 -55
- package/dist/src/execution/node-step.js.map +1 -1
- package/dist/src/execution/runtime-context.d.ts.map +1 -1
- package/dist/src/execution/runtime-context.js +1 -2
- package/dist/src/execution/runtime-context.js.map +1 -1
- package/dist/src/execution/session.d.ts +2 -1
- package/dist/src/execution/session.d.ts.map +1 -1
- package/dist/src/execution/session.js +1 -0
- package/dist/src/execution/session.js.map +1 -1
- package/dist/src/execution/skills/instructions.d.ts.map +1 -1
- package/dist/src/execution/skills/instructions.js +9 -2
- package/dist/src/execution/skills/instructions.js.map +1 -1
- package/dist/src/execution/subagent-tool.d.ts.map +1 -1
- package/dist/src/execution/subagent-tool.js +0 -1
- package/dist/src/execution/subagent-tool.js.map +1 -1
- package/dist/src/execution/tool-compaction.d.ts.map +1 -1
- package/dist/src/execution/tool-compaction.js +0 -3
- package/dist/src/execution/tool-compaction.js.map +1 -1
- package/dist/src/execution/workflow-entry.d.ts.map +1 -1
- package/dist/src/execution/workflow-entry.js +2 -0
- package/dist/src/execution/workflow-entry.js.map +1 -1
- package/dist/src/execution/workflow-runtime.js +2 -2
- package/dist/src/execution/workflow-runtime.js.map +1 -1
- package/dist/src/execution/workflow-steps.d.ts +8 -2
- package/dist/src/execution/workflow-steps.d.ts.map +1 -1
- package/dist/src/execution/workflow-steps.js +7 -2
- package/dist/src/execution/workflow-steps.js.map +1 -1
- package/dist/src/harness/emission.d.ts +65 -25
- package/dist/src/harness/emission.d.ts.map +1 -1
- package/dist/src/harness/emission.js +310 -83
- package/dist/src/harness/emission.js.map +1 -1
- package/dist/src/harness/execute-tool.d.ts +52 -0
- package/dist/src/harness/execute-tool.d.ts.map +1 -0
- package/dist/src/harness/execute-tool.js +59 -0
- package/dist/src/harness/execute-tool.js.map +1 -0
- package/dist/src/harness/input-extraction.d.ts +3 -3
- package/dist/src/harness/input-extraction.d.ts.map +1 -1
- package/dist/src/harness/input-extraction.js +15 -8
- package/dist/src/harness/input-extraction.js.map +1 -1
- package/dist/src/harness/input-requests.d.ts +24 -39
- package/dist/src/harness/input-requests.d.ts.map +1 -1
- package/dist/src/harness/input-requests.js +149 -229
- package/dist/src/harness/input-requests.js.map +1 -1
- package/dist/src/harness/messages.d.ts +10 -9
- package/dist/src/harness/messages.d.ts.map +1 -1
- package/dist/src/harness/messages.js +23 -20
- package/dist/src/harness/messages.js.map +1 -1
- package/dist/src/harness/provider-tools.d.ts +2 -2
- package/dist/src/harness/provider-tools.d.ts.map +1 -1
- package/dist/src/harness/provider-tools.js +7 -3
- package/dist/src/harness/provider-tools.js.map +1 -1
- package/dist/src/harness/tool-loop.d.ts.map +1 -1
- package/dist/src/harness/tool-loop.js +89 -76
- package/dist/src/harness/tool-loop.js.map +1 -1
- package/dist/src/harness/tools.d.ts +12 -16
- package/dist/src/harness/tools.d.ts.map +1 -1
- package/dist/src/harness/tools.js +39 -33
- package/dist/src/harness/tools.js.map +1 -1
- package/dist/src/harness/types.d.ts +29 -25
- package/dist/src/harness/types.d.ts.map +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/nitro/host/channel-url-matcher.d.ts +1 -1
- package/dist/src/internal/nitro/host/channel-url-matcher.js +1 -1
- package/dist/src/internal/nitro/host/configure-message-routes.d.ts +1 -1
- package/dist/src/internal/nitro/host/configure-message-routes.d.ts.map +1 -1
- package/dist/src/internal/nitro/host/configure-message-routes.js +37 -10
- package/dist/src/internal/nitro/host/configure-message-routes.js.map +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.d.ts.map +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.js +16 -5
- package/dist/src/internal/nitro/host/create-application-nitro.js.map +1 -1
- package/dist/src/internal/nitro/host/load-home-page-web-assets.d.ts +13 -0
- package/dist/src/internal/nitro/host/load-home-page-web-assets.d.ts.map +1 -0
- package/dist/src/internal/nitro/host/load-home-page-web-assets.js +35 -0
- package/dist/src/internal/nitro/host/load-home-page-web-assets.js.map +1 -0
- package/dist/src/internal/nitro/host/prepare-application-host.js +1 -1
- package/dist/src/internal/nitro/host/prepare-application-host.js.map +1 -1
- package/dist/src/internal/nitro/routes/home-page/build-home-page-response.d.ts +88 -0
- package/dist/src/internal/nitro/routes/home-page/build-home-page-response.d.ts.map +1 -0
- package/dist/src/internal/nitro/routes/home-page/build-home-page-response.js +175 -0
- package/dist/src/internal/nitro/routes/home-page/build-home-page-response.js.map +1 -0
- package/dist/src/internal/nitro/routes/home.d.ts +12 -0
- package/dist/src/internal/nitro/routes/home.d.ts.map +1 -0
- package/dist/src/internal/nitro/routes/home.js +38 -0
- package/dist/src/internal/nitro/routes/home.js.map +1 -0
- package/dist/src/internal/nitro/routes/index.d.ts +2 -2
- package/dist/src/internal/nitro/routes/index.d.ts.map +1 -1
- package/dist/src/internal/nitro/routes/index.js +26 -27
- package/dist/src/internal/nitro/routes/index.js.map +1 -1
- package/dist/src/internal/nitro/routes/web-ui/assets/index.js +10 -0
- package/dist/src/internal/nitro/routes/web-ui/assets/style.css +2 -0
- package/dist/src/internal/nitro/routes/web-ui/index.html +17 -0
- package/dist/src/internal/nitro/routes/workflow-data.d.ts +32 -0
- package/dist/src/internal/nitro/routes/workflow-data.d.ts.map +1 -0
- package/dist/src/internal/nitro/routes/workflow-data.js +142 -0
- package/dist/src/internal/nitro/routes/workflow-data.js.map +1 -0
- package/dist/src/internal/nitro/routes/workflow-flow.d.ts +8 -0
- package/dist/src/internal/nitro/routes/workflow-flow.d.ts.map +1 -0
- package/dist/src/internal/nitro/routes/workflow-flow.js +9 -0
- package/dist/src/internal/nitro/routes/workflow-flow.js.map +1 -0
- package/dist/src/internal/nitro/routes/workflow-generated-handler.d.ts +10 -0
- package/dist/src/internal/nitro/routes/workflow-generated-handler.d.ts.map +1 -0
- package/dist/src/internal/nitro/routes/workflow-generated-handler.js +30 -0
- package/dist/src/internal/nitro/routes/workflow-generated-handler.js.map +1 -0
- package/dist/src/internal/nitro/routes/workflow-route-helpers.d.ts +46 -0
- package/dist/src/internal/nitro/routes/workflow-route-helpers.d.ts.map +1 -0
- package/dist/src/internal/nitro/routes/workflow-route-helpers.js +137 -0
- package/dist/src/internal/nitro/routes/workflow-route-helpers.js.map +1 -0
- package/dist/src/internal/nitro/routes/workflow-run-events.d.ts +14 -0
- package/dist/src/internal/nitro/routes/workflow-run-events.d.ts.map +1 -0
- package/dist/src/internal/nitro/routes/workflow-run-events.js +42 -0
- package/dist/src/internal/nitro/routes/workflow-run-events.js.map +1 -0
- package/dist/src/internal/nitro/routes/workflow-run-steps.d.ts +14 -0
- package/dist/src/internal/nitro/routes/workflow-run-steps.d.ts.map +1 -0
- package/dist/src/internal/nitro/routes/workflow-run-steps.js +42 -0
- package/dist/src/internal/nitro/routes/workflow-run-steps.js.map +1 -0
- package/dist/src/internal/nitro/routes/workflow-run.d.ts +13 -0
- package/dist/src/internal/nitro/routes/workflow-run.d.ts.map +1 -0
- package/dist/src/internal/nitro/routes/workflow-run.js +35 -0
- package/dist/src/internal/nitro/routes/workflow-run.js.map +1 -0
- package/dist/src/internal/nitro/routes/workflow-runs.d.ts +11 -0
- package/dist/src/internal/nitro/routes/workflow-runs.d.ts.map +1 -0
- package/dist/src/internal/nitro/routes/workflow-runs.js +29 -0
- package/dist/src/internal/nitro/routes/workflow-runs.js.map +1 -0
- package/dist/src/internal/nitro/routes/workflow-step.d.ts +8 -0
- package/dist/src/internal/nitro/routes/workflow-step.d.ts.map +1 -0
- package/dist/src/internal/nitro/routes/workflow-step.js +9 -0
- package/dist/src/internal/nitro/routes/workflow-step.js.map +1 -0
- package/dist/src/internal/nitro/routes/workflow-webhook.d.ts +8 -0
- package/dist/src/internal/nitro/routes/workflow-webhook.d.ts.map +1 -0
- package/dist/src/internal/nitro/routes/workflow-webhook.js +9 -0
- package/dist/src/internal/nitro/routes/workflow-webhook.js.map +1 -0
- package/dist/src/internal/nitro/runtime-configuration.d.ts +1 -1
- package/dist/src/internal/nitro/runtime-configuration.d.ts.map +1 -1
- package/dist/src/internal/nitro/shims/runtime-configuration-plugin.d.ts +1 -1
- package/dist/src/internal/nitro/shims/runtime-configuration-plugin.d.ts.map +1 -1
- package/dist/src/internal/nitro/shims/runtime-configuration-plugin.js +1 -1
- package/dist/src/internal/nitro/shims/runtime-configuration-plugin.js.map +1 -1
- package/dist/src/protocol/message.d.ts +160 -76
- package/dist/src/protocol/message.d.ts.map +1 -1
- package/dist/src/protocol/message.js +92 -36
- package/dist/src/protocol/message.js.map +1 -1
- package/dist/src/protocol/routes.d.ts +11 -3
- package/dist/src/protocol/routes.d.ts.map +1 -1
- package/dist/src/protocol/routes.js +12 -4
- package/dist/src/protocol/routes.js.map +1 -1
- package/dist/src/public/channels/auth.js +1 -1
- package/dist/src/public/channels/auth.js.map +1 -1
- package/dist/src/public/channels/http.d.ts +13 -13
- package/dist/src/public/channels/http.d.ts.map +1 -1
- package/dist/src/public/channels/http.js +44 -41
- package/dist/src/public/channels/http.js.map +1 -1
- package/dist/src/public/channels/index.d.ts +1 -1
- package/dist/src/public/channels/index.js +1 -1
- package/dist/src/public/channels/slack/index.d.ts +33 -14
- package/dist/src/public/channels/slack/index.d.ts.map +1 -1
- package/dist/src/public/channels/slack/index.js +114 -19
- package/dist/src/public/channels/slack/index.js.map +1 -1
- package/dist/src/public/definitions/channel.d.ts +10 -9
- package/dist/src/public/definitions/channel.d.ts.map +1 -1
- package/dist/src/public/definitions/channel.js.map +1 -1
- package/dist/src/public/definitions/tool.d.ts +11 -3
- package/dist/src/public/definitions/tool.d.ts.map +1 -1
- package/dist/src/public/definitions/tool.js.map +1 -1
- package/dist/src/public/index.d.ts +4 -2
- package/dist/src/public/index.d.ts.map +1 -1
- package/dist/src/public/index.js +1 -0
- package/dist/src/public/index.js.map +1 -1
- package/dist/src/runtime/agent/bootstrap-model-utils.d.ts +37 -0
- package/dist/src/runtime/agent/bootstrap-model-utils.d.ts.map +1 -0
- package/dist/src/runtime/agent/bootstrap-model-utils.js +149 -0
- package/dist/src/runtime/agent/bootstrap-model-utils.js.map +1 -0
- package/dist/src/runtime/agent/bootstrap-model.d.ts.map +1 -1
- package/dist/src/runtime/agent/bootstrap-model.js +11 -80
- package/dist/src/runtime/agent/bootstrap-model.js.map +1 -1
- package/dist/src/runtime/agent/mock-model-adapter.d.ts.map +1 -1
- package/dist/src/runtime/agent/mock-model-adapter.js +67 -129
- package/dist/src/runtime/agent/mock-model-adapter.js.map +1 -1
- package/dist/src/runtime/framework-channels/index.d.ts +3 -3
- package/dist/src/runtime/framework-channels/index.d.ts.map +1 -1
- package/dist/src/runtime/framework-channels/index.js +10 -10
- package/dist/src/runtime/framework-channels/index.js.map +1 -1
- package/dist/src/runtime/framework-tools/ask-question.js +4 -4
- package/dist/src/runtime/framework-tools/ask-question.js.map +1 -1
- package/dist/src/runtime/framework-tools/skill.d.ts.map +1 -1
- package/dist/src/runtime/framework-tools/skill.js +6 -1
- package/dist/src/runtime/framework-tools/skill.js.map +1 -1
- package/dist/src/runtime/input/types.d.ts +40 -115
- package/dist/src/runtime/input/types.d.ts.map +1 -1
- package/dist/src/runtime/input/types.js +28 -66
- package/dist/src/runtime/input/types.js.map +1 -1
- package/dist/src/runtime/prompt/compose.js +1 -1
- package/dist/src/runtime/prompt/compose.js.map +1 -1
- package/dist/src/runtime/resolve-tool.d.ts.map +1 -1
- package/dist/src/runtime/resolve-tool.js +8 -0
- package/dist/src/runtime/resolve-tool.js.map +1 -1
- package/dist/src/runtime/standard-schema.d.ts +28 -0
- package/dist/src/runtime/standard-schema.d.ts.map +1 -0
- package/dist/src/runtime/standard-schema.js +65 -0
- package/dist/src/runtime/standard-schema.js.map +1 -0
- package/dist/src/runtime/types.d.ts +7 -0
- package/dist/src/runtime/types.d.ts.map +1 -1
- package/dist/src/services/dev-client/send-message.d.ts +2 -2
- package/dist/src/services/dev-client/send-message.d.ts.map +1 -1
- package/dist/src/services/dev-client/send-message.js +21 -22
- package/dist/src/services/dev-client/send-message.js.map +1 -1
- package/dist/src/services/dev-client/session.d.ts +5 -5
- package/dist/src/services/dev-client/session.d.ts.map +1 -1
- package/dist/src/services/dev-client/session.js +2 -2
- package/dist/src/services/dev-client/session.js.map +1 -1
- package/dist/src/services/dev-client.d.ts +6 -6
- package/dist/src/services/dev-client.d.ts.map +1 -1
- package/dist/src/services/dev-client.js +3 -3
- package/dist/src/services/dev-client.js.map +1 -1
- package/docs/external-agent-protocol.md +37 -34
- package/docs/internals/channels.md +5 -5
- package/docs/internals/message-runtime.md +26 -24
- package/docs/public/README.md +3 -3
- package/docs/public/auth-and-route-protection.md +4 -5
- package/docs/public/channels/README.md +2 -3
- package/docs/public/cli-build-and-debugging.md +1 -1
- package/docs/public/context-control.md +6 -2
- package/docs/public/evals.md +3 -3
- package/docs/public/getting-started.md +15 -12
- package/docs/public/human-in-the-loop.md +45 -57
- package/docs/public/runs-and-streaming.md +32 -25
- package/docs/public/schedules.md +4 -4
- package/docs/public/session-context.md +4 -6
- package/docs/public/skills.md +25 -1
- package/docs/public/subagents.md +2 -2
- package/docs/public/tools.md +4 -2
- package/docs/public/typescript-api.md +3 -3
- package/docs/public/vercel-deployment.md +3 -4
- package/docs/public/workspace.md +11 -11
- package/package.json +2 -1
- package/dist/src/internal/nitro/routes/home-page/build-home-page-view-model.d.ts +0 -11
- package/dist/src/internal/nitro/routes/home-page/build-home-page-view-model.d.ts.map +0 -1
- package/dist/src/internal/nitro/routes/home-page/build-home-page-view-model.js +0 -264
- package/dist/src/internal/nitro/routes/home-page/build-home-page-view-model.js.map +0 -1
- package/dist/src/internal/nitro/routes/home-page/render-home-page.d.ts +0 -9
- package/dist/src/internal/nitro/routes/home-page/render-home-page.d.ts.map +0 -1
- package/dist/src/internal/nitro/routes/home-page/render-home-page.js +0 -15
- package/dist/src/internal/nitro/routes/home-page/render-home-page.js.map +0 -1
- package/dist/src/internal/nitro/routes/index.html +0 -525
- package/dist/src/runtime/tools/execute-tool.d.ts +0 -20
- package/dist/src/runtime/tools/execute-tool.d.ts.map +0 -1
- package/dist/src/runtime/tools/execute-tool.js +0 -69
- package/dist/src/runtime/tools/execute-tool.js.map +0 -1
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import type { HandleMessageStreamEvent } from "../protocol/message.js";
|
|
2
|
-
import type { ChannelEmitter, EventEmitFn } from "./types.js";
|
|
2
|
+
import type { ChannelEmitter, DeliverPayload, EventEmitFn, ResolvedStepInput } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Stateless emitter for the HTTP channel.
|
|
5
5
|
*
|
|
6
6
|
* Passes every event straight through to the stream. Consumers read events
|
|
7
|
-
* from the stream endpoint.
|
|
7
|
+
* from the stream endpoint. Deliver payloads pass through untransformed —
|
|
8
|
+
* HTTP clients send structured {@link InputResponse} objects directly.
|
|
8
9
|
*/
|
|
9
10
|
export declare class HttpChannelEmitter implements ChannelEmitter {
|
|
10
11
|
static readonly kind = "http";
|
|
11
12
|
readonly kind = "http";
|
|
12
13
|
onEvent(event: HandleMessageStreamEvent, emit: EventEmitFn): Promise<void>;
|
|
14
|
+
onDeliver(payload: DeliverPayload): ResolvedStepInput;
|
|
13
15
|
serialize(): Record<string, unknown>;
|
|
14
16
|
static deserialize(_state: Record<string, unknown>): HttpChannelEmitter;
|
|
15
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-emitter.d.ts","sourceRoot":"","sources":["../../../src/channel/http-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"http-emitter.d.ts","sourceRoot":"","sources":["../../../src/channel/http-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEjG;;;;;;GAMG;AACH,qBAAa,kBAAmB,YAAW,cAAc;IACvD,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU;IAC9B,QAAQ,CAAC,IAAI,UAAU;IAEjB,OAAO,CAAC,KAAK,EAAE,wBAAwB,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhF,SAAS,CAAC,OAAO,EAAE,cAAc,GAAG,iBAAiB;IAIrD,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAIpC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,kBAAkB;CAGxE"}
|
|
@@ -3,7 +3,8 @@ import { registerChannelEmitter } from "./emitter-registry.js";
|
|
|
3
3
|
* Stateless emitter for the HTTP channel.
|
|
4
4
|
*
|
|
5
5
|
* Passes every event straight through to the stream. Consumers read events
|
|
6
|
-
* from the stream endpoint.
|
|
6
|
+
* from the stream endpoint. Deliver payloads pass through untransformed —
|
|
7
|
+
* HTTP clients send structured {@link InputResponse} objects directly.
|
|
7
8
|
*/
|
|
8
9
|
export class HttpChannelEmitter {
|
|
9
10
|
static kind = "http";
|
|
@@ -11,6 +12,9 @@ export class HttpChannelEmitter {
|
|
|
11
12
|
async onEvent(event, emit) {
|
|
12
13
|
await emit(event);
|
|
13
14
|
}
|
|
15
|
+
onDeliver(payload) {
|
|
16
|
+
return payload;
|
|
17
|
+
}
|
|
14
18
|
serialize() {
|
|
15
19
|
return {};
|
|
16
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-emitter.js","sourceRoot":"","sources":["../../../src/channel/http-emitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAG/D
|
|
1
|
+
{"version":3,"file":"http-emitter.js","sourceRoot":"","sources":["../../../src/channel/http-emitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAG/D;;;;;;GAMG;AACH,MAAM,OAAO,kBAAkB;IAC7B,MAAM,CAAU,IAAI,GAAG,MAAM,CAAC;IACrB,IAAI,GAAG,MAAM,CAAC;IAEvB,KAAK,CAAC,OAAO,CAAC,KAA+B,EAAE,IAAiB;QAC9D,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IAED,SAAS,CAAC,OAAuB;QAC/B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,SAAS;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,MAA+B;QAChD,OAAO,IAAI,kBAAkB,EAAE,CAAC;IAClC,CAAC;;AAGH,sBAAsB,CAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { InputRequest, InputResponse } from "../runtime/input/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Maps freeform text to an {@link InputResponse} for a single request.
|
|
4
|
+
*
|
|
5
|
+
* Emitters import this utility to resolve text-based user input against
|
|
6
|
+
* pending request options. The harness and runtime do not call it.
|
|
7
|
+
*
|
|
8
|
+
* Resolution order:
|
|
9
|
+
* 1. Exact option ID (case-insensitive)
|
|
10
|
+
* 2. Exact option label (case-insensitive)
|
|
11
|
+
* 3. 1-based numeric index into the options array
|
|
12
|
+
* 4. Freeform text if {@link InputRequest.allowFreeform} is not `false`
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveTextToResponse(text: string, request: InputRequest): InputResponse | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Resolves text against all pending requests, returning one
|
|
17
|
+
* {@link InputResponse} for each request that could be matched.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveTextToResponses(text: string, requests: readonly InputRequest[]): readonly InputResponse[];
|
|
20
|
+
//# sourceMappingURL=resolve-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-text.d.ts","sourceRoot":"","sources":["../../../src/channel/resolve-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1F;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,YAAY,GACpB,aAAa,GAAG,SAAS,CAuB3B;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,SAAS,YAAY,EAAE,GAChC,SAAS,aAAa,EAAE,CAW1B"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps freeform text to an {@link InputResponse} for a single request.
|
|
3
|
+
*
|
|
4
|
+
* Emitters import this utility to resolve text-based user input against
|
|
5
|
+
* pending request options. The harness and runtime do not call it.
|
|
6
|
+
*
|
|
7
|
+
* Resolution order:
|
|
8
|
+
* 1. Exact option ID (case-insensitive)
|
|
9
|
+
* 2. Exact option label (case-insensitive)
|
|
10
|
+
* 3. 1-based numeric index into the options array
|
|
11
|
+
* 4. Freeform text if {@link InputRequest.allowFreeform} is not `false`
|
|
12
|
+
*/
|
|
13
|
+
export function resolveTextToResponse(text, request) {
|
|
14
|
+
const trimmed = text.trim();
|
|
15
|
+
if (trimmed.length === 0) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
const normalized = trimmed.toLowerCase();
|
|
19
|
+
if (request.options !== undefined && request.options.length > 0) {
|
|
20
|
+
const matched = matchOption(normalized, request.options);
|
|
21
|
+
if (matched !== undefined) {
|
|
22
|
+
return { requestId: request.requestId, optionId: matched.id };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const acceptsFreeform = request.allowFreeform === true || request.options === undefined || request.options.length === 0;
|
|
26
|
+
if (acceptsFreeform && trimmed.length > 0) {
|
|
27
|
+
return { requestId: request.requestId, text: trimmed };
|
|
28
|
+
}
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Resolves text against all pending requests, returning one
|
|
33
|
+
* {@link InputResponse} for each request that could be matched.
|
|
34
|
+
*/
|
|
35
|
+
export function resolveTextToResponses(text, requests) {
|
|
36
|
+
const responses = [];
|
|
37
|
+
for (const request of requests) {
|
|
38
|
+
const response = resolveTextToResponse(text, request);
|
|
39
|
+
if (response !== undefined) {
|
|
40
|
+
responses.push(response);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return responses;
|
|
44
|
+
}
|
|
45
|
+
function matchOption(normalized, options) {
|
|
46
|
+
const byId = options.find((o) => o.id.toLowerCase() === normalized);
|
|
47
|
+
if (byId !== undefined) {
|
|
48
|
+
return byId;
|
|
49
|
+
}
|
|
50
|
+
const byLabel = options.find((o) => o.label.toLowerCase() === normalized);
|
|
51
|
+
if (byLabel !== undefined) {
|
|
52
|
+
return byLabel;
|
|
53
|
+
}
|
|
54
|
+
const numericIndex = Number(normalized);
|
|
55
|
+
if (Number.isInteger(numericIndex) && numericIndex > 0 && numericIndex <= options.length) {
|
|
56
|
+
return options[numericIndex - 1];
|
|
57
|
+
}
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=resolve-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-text.js","sourceRoot":"","sources":["../../../src/channel/resolve-text.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,qBAAqB,CACnC,IAAY,EACZ,OAAqB;IAErB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAEzC,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChE,MAAM,OAAO,GAAG,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QACzD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC;QAChE,CAAC;IACH,CAAC;IAED,MAAM,eAAe,GACnB,OAAO,CAAC,aAAa,KAAK,IAAI,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC;IAElG,IAAI,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1C,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IACzD,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,IAAY,EACZ,QAAiC;IAEjC,MAAM,SAAS,GAAoB,EAAE,CAAC;IAEtC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,QAAQ,GAAG,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACtD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,WAAW,CAAC,UAAkB,EAAE,OAA+B;IACtE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC,CAAC;IACpE,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC,CAAC;IAC1E,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IACxC,IAAI,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,YAAY,GAAG,CAAC,IAAI,YAAY,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACzF,OAAO,OAAO,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { HandleMessageStreamEvent } from "../protocol/message.js";
|
|
2
|
-
import type { ChannelEmitter, EventEmitFn } from "./types.js";
|
|
2
|
+
import type { ChannelEmitter, DeliverPayload, EventEmitFn, ResolvedStepInput } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Stateless emitter for the schedule channel.
|
|
5
5
|
*
|
|
6
|
-
* Passes every event straight through to the stream.
|
|
6
|
+
* Passes every event straight through to the stream. Deliver payloads
|
|
7
|
+
* pass through untransformed.
|
|
7
8
|
*/
|
|
8
9
|
export declare class ScheduleChannelEmitter implements ChannelEmitter {
|
|
9
10
|
static readonly kind = "schedule";
|
|
10
11
|
readonly kind = "schedule";
|
|
11
12
|
onEvent(event: HandleMessageStreamEvent, emit: EventEmitFn): Promise<void>;
|
|
13
|
+
onDeliver(payload: DeliverPayload): ResolvedStepInput;
|
|
12
14
|
serialize(): Record<string, unknown>;
|
|
13
15
|
static deserialize(_state: Record<string, unknown>): ScheduleChannelEmitter;
|
|
14
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule-emitter.d.ts","sourceRoot":"","sources":["../../../src/channel/schedule-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"schedule-emitter.d.ts","sourceRoot":"","sources":["../../../src/channel/schedule-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEjG;;;;;GAKG;AACH,qBAAa,sBAAuB,YAAW,cAAc;IAC3D,MAAM,CAAC,QAAQ,CAAC,IAAI,cAAc;IAClC,QAAQ,CAAC,IAAI,cAAc;IAErB,OAAO,CAAC,KAAK,EAAE,wBAAwB,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhF,SAAS,CAAC,OAAO,EAAE,cAAc,GAAG,iBAAiB;IAIrD,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAIpC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,sBAAsB;CAG5E"}
|
|
@@ -2,7 +2,8 @@ import { registerChannelEmitter } from "./emitter-registry.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Stateless emitter for the schedule channel.
|
|
4
4
|
*
|
|
5
|
-
* Passes every event straight through to the stream.
|
|
5
|
+
* Passes every event straight through to the stream. Deliver payloads
|
|
6
|
+
* pass through untransformed.
|
|
6
7
|
*/
|
|
7
8
|
export class ScheduleChannelEmitter {
|
|
8
9
|
static kind = "schedule";
|
|
@@ -10,6 +11,9 @@ export class ScheduleChannelEmitter {
|
|
|
10
11
|
async onEvent(event, emit) {
|
|
11
12
|
await emit(event);
|
|
12
13
|
}
|
|
14
|
+
onDeliver(payload) {
|
|
15
|
+
return payload;
|
|
16
|
+
}
|
|
13
17
|
serialize() {
|
|
14
18
|
return {};
|
|
15
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule-emitter.js","sourceRoot":"","sources":["../../../src/channel/schedule-emitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAG/D
|
|
1
|
+
{"version":3,"file":"schedule-emitter.js","sourceRoot":"","sources":["../../../src/channel/schedule-emitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAG/D;;;;;GAKG;AACH,MAAM,OAAO,sBAAsB;IACjC,MAAM,CAAU,IAAI,GAAG,UAAU,CAAC;IACzB,IAAI,GAAG,UAAU,CAAC;IAE3B,KAAK,CAAC,OAAO,CAAC,KAA+B,EAAE,IAAiB;QAC9D,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IAED,SAAS,CAAC,OAAuB;QAC/B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,SAAS;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,MAA+B;QAChD,OAAO,IAAI,sBAAsB,EAAE,CAAC;IACtC,CAAC;;AAGH,sBAAsB,CAAC,sBAAsB,CAAC,CAAC"}
|
|
@@ -1,42 +1,58 @@
|
|
|
1
1
|
import type { SerializedThread } from "chat";
|
|
2
2
|
import type { HandleMessageStreamEvent } from "../protocol/message.js";
|
|
3
|
-
import type {
|
|
4
|
-
import type { ChannelEmitter, EventEmitFn } from "./types.js";
|
|
3
|
+
import type { InputRequest } from "../runtime/input/types.js";
|
|
4
|
+
import type { ChannelEmitter, DeliverPayload, EventEmitFn, ResolvedStepInput } from "./types.js";
|
|
5
5
|
/**
|
|
6
6
|
* Minimal serializable state for the Slack emitter.
|
|
7
7
|
*/
|
|
8
8
|
export interface SlackChannelEmitterState {
|
|
9
9
|
readonly botToken?: string;
|
|
10
10
|
readonly serializedThread: SerializedThread;
|
|
11
|
+
/**
|
|
12
|
+
* Pending input requests stored by `onEvent("input.requested")` and
|
|
13
|
+
* read by `onDeliver` to resolve text-based replies against the
|
|
14
|
+
* request options.
|
|
15
|
+
*/
|
|
16
|
+
readonly pendingRequests?: readonly InputRequest[];
|
|
11
17
|
}
|
|
12
|
-
/**
|
|
13
|
-
* Returns `true` when the lowercased, trimmed text is an affirmative
|
|
14
|
-
* response. Used by {@link SlackChannelEmitter.resolveInput} to decide
|
|
15
|
-
* whether a Slack reply approves or denies a pending tool call.
|
|
16
|
-
*/
|
|
17
|
-
export declare function isAffirmativeText(text: string): boolean;
|
|
18
18
|
/**
|
|
19
19
|
* Emitter that rehydrates a Chat SDK `Thread` from serialized state and
|
|
20
20
|
* uses `thread.startTyping()` to show typing status with tool names while
|
|
21
21
|
* the agent is working, then posts the final reply via `thread.post()`.
|
|
22
|
+
*
|
|
23
|
+
* For HITL input requests, renders platform-native interactive elements
|
|
24
|
+
* (Block Kit buttons and select menus) and stores the pending requests
|
|
25
|
+
* in serializable state so `onDeliver` can resolve text replies.
|
|
22
26
|
*/
|
|
23
27
|
export declare class SlackChannelEmitter implements ChannelEmitter {
|
|
24
28
|
static readonly kind = "slack";
|
|
25
29
|
readonly kind = "slack";
|
|
26
|
-
private
|
|
30
|
+
private _state;
|
|
31
|
+
private _cardKit;
|
|
32
|
+
private _pendingToolCallMessage;
|
|
27
33
|
private _thread;
|
|
28
34
|
constructor(state: SlackChannelEmitterState);
|
|
29
35
|
get botToken(): string | undefined;
|
|
30
36
|
get serializedThread(): SerializedThread;
|
|
31
37
|
serialize(): Record<string, unknown>;
|
|
32
38
|
static deserialize(state: Record<string, unknown>): SlackChannelEmitter;
|
|
33
|
-
|
|
34
|
-
readonly message: string;
|
|
35
|
-
readonly requests: readonly RuntimeInputRequest[];
|
|
36
|
-
}): readonly RuntimeInputResult[] | undefined;
|
|
39
|
+
onDeliver(payload: DeliverPayload): ResolvedStepInput;
|
|
37
40
|
onEvent(event: HandleMessageStreamEvent, emit: EventEmitFn): Promise<void>;
|
|
41
|
+
private consumePendingToolCallMessage;
|
|
42
|
+
private consumePendingToolCallStatus;
|
|
43
|
+
private clearPendingToolCallMessage;
|
|
44
|
+
private setPendingToolCallMessage;
|
|
38
45
|
private post;
|
|
39
46
|
private startTyping;
|
|
47
|
+
/**
|
|
48
|
+
* Renders each pending input request as a rich Card element with
|
|
49
|
+
* interactive buttons or select menus, posted to the Slack thread.
|
|
50
|
+
*/
|
|
51
|
+
private renderInputRequests;
|
|
52
|
+
/**
|
|
53
|
+
* Lazily imports the Chat SDK card element constructors.
|
|
54
|
+
*/
|
|
55
|
+
private getCardKit;
|
|
40
56
|
/**
|
|
41
57
|
* Lazily rehydrates the Chat SDK Thread from serialized state.
|
|
42
58
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slack-emitter.d.ts","sourceRoot":"","sources":["../../../src/channel/slack-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"slack-emitter.d.ts","sourceRoot":"","sources":["../../../src/channel/slack-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyD,gBAAgB,EAAE,MAAM,MAAM,CAAC;AAEpG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG9D,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEjG;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;CACpD;AA4DD;;;;;;;;GAQG;AACH,qBAAa,mBAAoB,YAAW,cAAc;IACxD,MAAM,CAAC,QAAQ,CAAC,IAAI,WAAW;IAC/B,QAAQ,CAAC,IAAI,WAAW;IAExB,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,QAAQ,CAAwB;IACxC,OAAO,CAAC,uBAAuB,CAAuB;IACtD,OAAO,CAAC,OAAO,CAAiC;gBAEpC,KAAK,EAAE,wBAAwB;IAI3C,IAAI,QAAQ,IAAI,MAAM,GAAG,SAAS,CAEjC;IAED,IAAI,gBAAgB,IAAI,gBAAgB,CAEvC;IAED,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQpC,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,mBAAmB;IAUvE,SAAS,CAAC,OAAO,EAAE,cAAc,GAAG,iBAAiB;IAyB/C,OAAO,CAAC,KAAK,EAAE,wBAAwB,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA2ChF,OAAO,CAAC,6BAA6B;IAMrC,OAAO,CAAC,4BAA4B;IAUpC,OAAO,CAAC,2BAA2B;IAInC,OAAO,CAAC,yBAAyB;YAKnB,IAAI;YAWJ,WAAW;IASzB;;;OAGG;YACW,mBAAmB;IAcjC;;OAEG;YACW,UAAU;IAiBxB;;;;;;;;OAQG;YACW,SAAS;CAexB"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { registerChannelEmitter } from "./emitter-registry.js";
|
|
2
|
+
import { resolveTextToResponses } from "./resolve-text.js";
|
|
3
|
+
const SLACK_MAX_TYPING_STATUS_LENGTH = 50;
|
|
2
4
|
function labelForAction(action) {
|
|
3
5
|
switch (action.kind) {
|
|
4
6
|
case "activate-skill":
|
|
@@ -9,43 +11,22 @@ function labelForAction(action) {
|
|
|
9
11
|
return action.toolName;
|
|
10
12
|
}
|
|
11
13
|
}
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
function derivePendingToolCallStatus(text) {
|
|
15
|
+
const firstLine = text
|
|
16
|
+
.split(/\r?\n/u)
|
|
17
|
+
.map((line) => line.trim())
|
|
18
|
+
.find((line) => line.length > 0);
|
|
19
|
+
if (firstLine === undefined) {
|
|
20
|
+
return null;
|
|
18
21
|
}
|
|
22
|
+
return firstLine.replace(/\s+/gu, " ");
|
|
19
23
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"yeah",
|
|
27
|
-
"yep",
|
|
28
|
-
"yup",
|
|
29
|
-
"ok",
|
|
30
|
-
"okay",
|
|
31
|
-
"sure",
|
|
32
|
-
"approve",
|
|
33
|
-
"approved",
|
|
34
|
-
"confirm",
|
|
35
|
-
"confirmed",
|
|
36
|
-
"go",
|
|
37
|
-
"go ahead",
|
|
38
|
-
"do it",
|
|
39
|
-
"proceed",
|
|
40
|
-
"accept",
|
|
41
|
-
]);
|
|
42
|
-
/**
|
|
43
|
-
* Returns `true` when the lowercased, trimmed text is an affirmative
|
|
44
|
-
* response. Used by {@link SlackChannelEmitter.resolveInput} to decide
|
|
45
|
-
* whether a Slack reply approves or denies a pending tool call.
|
|
46
|
-
*/
|
|
47
|
-
export function isAffirmativeText(text) {
|
|
48
|
-
return AFFIRMATIVE_PATTERNS.has(text);
|
|
24
|
+
function truncateTypingStatus(status) {
|
|
25
|
+
const normalized = status.trim().replace(/\s+/gu, " ");
|
|
26
|
+
if (normalized.length <= SLACK_MAX_TYPING_STATUS_LENGTH) {
|
|
27
|
+
return normalized;
|
|
28
|
+
}
|
|
29
|
+
return `${normalized.slice(0, SLACK_MAX_TYPING_STATUS_LENGTH - 3).trimEnd()}...`;
|
|
49
30
|
}
|
|
50
31
|
// ---------------------------------------------------------------------------
|
|
51
32
|
// Emitter
|
|
@@ -54,11 +35,17 @@ export function isAffirmativeText(text) {
|
|
|
54
35
|
* Emitter that rehydrates a Chat SDK `Thread` from serialized state and
|
|
55
36
|
* uses `thread.startTyping()` to show typing status with tool names while
|
|
56
37
|
* the agent is working, then posts the final reply via `thread.post()`.
|
|
38
|
+
*
|
|
39
|
+
* For HITL input requests, renders platform-native interactive elements
|
|
40
|
+
* (Block Kit buttons and select menus) and stores the pending requests
|
|
41
|
+
* in serializable state so `onDeliver` can resolve text replies.
|
|
57
42
|
*/
|
|
58
43
|
export class SlackChannelEmitter {
|
|
59
44
|
static kind = "slack";
|
|
60
45
|
kind = "slack";
|
|
61
46
|
_state;
|
|
47
|
+
_cardKit = null;
|
|
48
|
+
_pendingToolCallMessage = null;
|
|
62
49
|
_thread = null;
|
|
63
50
|
constructor(state) {
|
|
64
51
|
this._state = state;
|
|
@@ -72,84 +59,104 @@ export class SlackChannelEmitter {
|
|
|
72
59
|
serialize() {
|
|
73
60
|
return {
|
|
74
61
|
botToken: this._state.botToken,
|
|
62
|
+
pendingRequests: this._state.pendingRequests,
|
|
75
63
|
serializedThread: this._state.serializedThread,
|
|
76
64
|
};
|
|
77
65
|
}
|
|
78
66
|
static deserialize(state) {
|
|
79
67
|
return new SlackChannelEmitter({
|
|
80
68
|
botToken: state.botToken,
|
|
69
|
+
pendingRequests: state.pendingRequests,
|
|
81
70
|
serializedThread: state.serializedThread,
|
|
82
71
|
});
|
|
83
72
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
73
|
+
// ── Inbound: transform delivered input ─────────────────
|
|
74
|
+
onDeliver(payload) {
|
|
75
|
+
// Structured responses (Slack button callback, HTTP client) —
|
|
76
|
+
// pass through untouched.
|
|
77
|
+
if (payload.inputResponses !== undefined && payload.inputResponses.length > 0) {
|
|
78
|
+
return payload;
|
|
88
79
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
kind: "tool-approval-result",
|
|
99
|
-
reason: `User replied: "${input.message.trim()}"`,
|
|
100
|
-
};
|
|
101
|
-
results.push(result);
|
|
102
|
-
}
|
|
103
|
-
else if (request.kind === "question") {
|
|
104
|
-
const matchedOption = request.options?.find((opt) => opt.id.toLowerCase() === text || opt.label.toLowerCase() === text);
|
|
105
|
-
if (matchedOption) {
|
|
106
|
-
results.push({
|
|
107
|
-
callId: request.action.callId,
|
|
108
|
-
kind: "question-result",
|
|
109
|
-
output: { optionId: matchedOption.id, status: "answered" },
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
else if (request.allowFreeform !== false) {
|
|
113
|
-
results.push({
|
|
114
|
-
callId: request.action.callId,
|
|
115
|
-
kind: "question-result",
|
|
116
|
-
output: { status: "answered", text: input.message.trim() },
|
|
117
|
-
});
|
|
118
|
-
}
|
|
80
|
+
// No pending requests — this is a normal conversation message.
|
|
81
|
+
if (this._state.pendingRequests === undefined || this._state.pendingRequests.length === 0) {
|
|
82
|
+
return { message: payload.message };
|
|
83
|
+
}
|
|
84
|
+
// Text with pending requests — resolve against stored options.
|
|
85
|
+
if (payload.message !== undefined) {
|
|
86
|
+
const responses = resolveTextToResponses(payload.message, this._state.pendingRequests);
|
|
87
|
+
if (responses.length > 0) {
|
|
88
|
+
return { inputResponses: responses };
|
|
119
89
|
}
|
|
120
90
|
}
|
|
121
|
-
return
|
|
91
|
+
return { message: payload.message };
|
|
122
92
|
}
|
|
93
|
+
// ── Outbound: render events to Slack ───────────────────
|
|
123
94
|
async onEvent(event, emit) {
|
|
124
95
|
await emit(event);
|
|
125
96
|
switch (event.type) {
|
|
126
97
|
case "turn.started":
|
|
98
|
+
this.clearPendingToolCallMessage();
|
|
127
99
|
await this.startTyping("Thinking…");
|
|
128
100
|
break;
|
|
129
101
|
case "actions.requested": {
|
|
130
102
|
const labels = event.data.actions.map(labelForAction);
|
|
131
|
-
await this.startTyping(`Running ${labels.join(", ")}…`);
|
|
103
|
+
await this.startTyping(this.consumePendingToolCallStatus() ?? `Running ${labels.join(", ")}…`);
|
|
132
104
|
break;
|
|
133
105
|
}
|
|
134
106
|
case "input.requested": {
|
|
135
|
-
|
|
136
|
-
|
|
107
|
+
// Post any buffered narration before rendering the cards.
|
|
108
|
+
const pendingMessage = this.consumePendingToolCallMessage();
|
|
109
|
+
if (pendingMessage !== null) {
|
|
110
|
+
await this.post(pendingMessage);
|
|
111
|
+
}
|
|
112
|
+
// Store for onDeliver
|
|
113
|
+
this._state = { ...this._state, pendingRequests: event.data.requests };
|
|
114
|
+
await this.renderInputRequests(event.data.requests);
|
|
137
115
|
break;
|
|
138
116
|
}
|
|
139
117
|
case "message.completed":
|
|
140
118
|
if (event.data.message !== null) {
|
|
141
|
-
|
|
119
|
+
if (event.data.finishReason === "tool-calls") {
|
|
120
|
+
this.setPendingToolCallMessage(event.data.message);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
this.clearPendingToolCallMessage();
|
|
124
|
+
await this.post(event.data.message);
|
|
125
|
+
}
|
|
142
126
|
}
|
|
143
127
|
break;
|
|
144
|
-
case "
|
|
128
|
+
case "session.failed":
|
|
129
|
+
this.clearPendingToolCallMessage();
|
|
145
130
|
await this.post("Something went wrong.");
|
|
146
131
|
break;
|
|
147
132
|
}
|
|
148
133
|
}
|
|
134
|
+
consumePendingToolCallMessage() {
|
|
135
|
+
const message = this._pendingToolCallMessage;
|
|
136
|
+
this._pendingToolCallMessage = null;
|
|
137
|
+
return message;
|
|
138
|
+
}
|
|
139
|
+
consumePendingToolCallStatus() {
|
|
140
|
+
const message = this.consumePendingToolCallMessage();
|
|
141
|
+
if (message === null) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
const status = derivePendingToolCallStatus(message);
|
|
145
|
+
return status === null ? null : truncateTypingStatus(status);
|
|
146
|
+
}
|
|
147
|
+
clearPendingToolCallMessage() {
|
|
148
|
+
this._pendingToolCallMessage = null;
|
|
149
|
+
}
|
|
150
|
+
setPendingToolCallMessage(text) {
|
|
151
|
+
const normalized = text.trim();
|
|
152
|
+
this._pendingToolCallMessage = normalized.length > 0 ? normalized : null;
|
|
153
|
+
}
|
|
149
154
|
async post(text) {
|
|
150
155
|
try {
|
|
151
156
|
const thread = await this.getThread();
|
|
152
|
-
|
|
157
|
+
// Route assistant output through the chat SDK's markdown renderer so
|
|
158
|
+
// Slack-native mrkdwn and table blocks are used when available.
|
|
159
|
+
await thread.post({ markdown: text });
|
|
153
160
|
}
|
|
154
161
|
catch (error) {
|
|
155
162
|
console.error("[ash] Slack message delivery failed.", error);
|
|
@@ -158,12 +165,47 @@ export class SlackChannelEmitter {
|
|
|
158
165
|
async startTyping(status) {
|
|
159
166
|
try {
|
|
160
167
|
const thread = await this.getThread();
|
|
161
|
-
await thread.startTyping(status);
|
|
168
|
+
await thread.startTyping(truncateTypingStatus(status));
|
|
162
169
|
}
|
|
163
170
|
catch {
|
|
164
171
|
// Best-effort — not all apps support typing status.
|
|
165
172
|
}
|
|
166
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Renders each pending input request as a rich Card element with
|
|
176
|
+
* interactive buttons or select menus, posted to the Slack thread.
|
|
177
|
+
*/
|
|
178
|
+
async renderInputRequests(requests) {
|
|
179
|
+
const kit = await this.getCardKit();
|
|
180
|
+
for (const request of requests) {
|
|
181
|
+
try {
|
|
182
|
+
const card = buildInputRequestCard(kit, request);
|
|
183
|
+
const thread = await this.getThread();
|
|
184
|
+
await thread.post(card);
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
console.error("[ash] Slack input request render failed.", error);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Lazily imports the Chat SDK card element constructors.
|
|
193
|
+
*/
|
|
194
|
+
async getCardKit() {
|
|
195
|
+
if (this._cardKit !== null) {
|
|
196
|
+
return this._cardKit;
|
|
197
|
+
}
|
|
198
|
+
const chatModule = (await import("chat"));
|
|
199
|
+
this._cardKit = {
|
|
200
|
+
Actions: chatModule.Actions,
|
|
201
|
+
Button: chatModule.Button,
|
|
202
|
+
Card: chatModule.Card,
|
|
203
|
+
CardText: chatModule.CardText,
|
|
204
|
+
Select: chatModule.Select,
|
|
205
|
+
SelectOption: chatModule.SelectOption,
|
|
206
|
+
};
|
|
207
|
+
return this._cardKit;
|
|
208
|
+
}
|
|
167
209
|
/**
|
|
168
210
|
* Lazily rehydrates the Chat SDK Thread from serialized state.
|
|
169
211
|
*
|
|
@@ -188,4 +230,53 @@ export class SlackChannelEmitter {
|
|
|
188
230
|
}
|
|
189
231
|
}
|
|
190
232
|
registerChannelEmitter(SlackChannelEmitter);
|
|
233
|
+
const INPUT_OPTION_STYLE_TO_BUTTON_STYLE = {
|
|
234
|
+
danger: "danger",
|
|
235
|
+
default: undefined,
|
|
236
|
+
primary: "primary",
|
|
237
|
+
};
|
|
238
|
+
/**
|
|
239
|
+
* Builds a Chat SDK Card element for one input request.
|
|
240
|
+
*
|
|
241
|
+
* - `confirmation` → buttons (one per option)
|
|
242
|
+
* - `select` → static select menu
|
|
243
|
+
* - `text` → prompt text only (user replies in thread)
|
|
244
|
+
*/
|
|
245
|
+
function buildInputRequestCard(kit, request) {
|
|
246
|
+
if (request.display === "confirmation" && request.options !== undefined) {
|
|
247
|
+
return kit.Card({
|
|
248
|
+
children: [
|
|
249
|
+
kit.CardText(request.prompt),
|
|
250
|
+
kit.Actions(request.options.map((opt) => kit.Button({
|
|
251
|
+
id: opt.id,
|
|
252
|
+
label: opt.label,
|
|
253
|
+
style: INPUT_OPTION_STYLE_TO_BUTTON_STYLE[opt.style ?? "default"],
|
|
254
|
+
value: request.requestId,
|
|
255
|
+
}))),
|
|
256
|
+
],
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
if (request.display === "select" && request.options !== undefined && request.options.length > 0) {
|
|
260
|
+
return kit.Card({
|
|
261
|
+
children: [
|
|
262
|
+
kit.CardText(request.prompt),
|
|
263
|
+
kit.Actions([
|
|
264
|
+
kit.Select({
|
|
265
|
+
id: `select_${request.requestId}`,
|
|
266
|
+
label: "Choose an option",
|
|
267
|
+
options: request.options.map((opt) => kit.SelectOption({
|
|
268
|
+
description: opt.description,
|
|
269
|
+
label: opt.label,
|
|
270
|
+
value: opt.id,
|
|
271
|
+
})),
|
|
272
|
+
}),
|
|
273
|
+
]),
|
|
274
|
+
],
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
// Freeform text — just post the prompt. User replies in thread.
|
|
278
|
+
return kit.Card({
|
|
279
|
+
children: [kit.CardText(request.prompt)],
|
|
280
|
+
});
|
|
281
|
+
}
|
|
191
282
|
//# sourceMappingURL=slack-emitter.js.map
|