eve 0.69.0 → 0.70.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 +36 -0
- package/dist/src/acp/adapter.js +1 -1
- package/dist/src/channel/task-card.d.ts +3 -3
- package/dist/src/channel/task-card.js +1 -1
- package/dist/src/channel/types.d.ts +18 -0
- package/dist/src/chunks/{use-eve-agent-Dab2MnT2.js → use-eve-agent-CJQeE7-t.js} +1873 -1236
- package/dist/src/chunks/{use-eve-agent-D_5129A9.js → use-eve-agent-DdemtY6C.js} +1874 -1234
- package/dist/src/cli/dev/command.js +1 -1
- package/dist/src/cli/dev/console-records-preload.d.ts +1 -0
- package/dist/src/cli/dev/console-records-preload.js +1 -0
- package/dist/src/cli/dev/console-records.d.ts +17 -0
- package/dist/src/cli/dev/console-records.js +3 -0
- package/dist/src/cli/dev/diagnostic-sink.d.ts +1 -0
- package/dist/src/cli/dev/local-server-process.js +1 -1
- package/dist/src/cli/dev/tui/blocks.d.ts +2 -1
- package/dist/src/cli/dev/tui/blocks.js +3 -3
- package/dist/src/cli/dev/tui/conversation-view.d.ts +54 -0
- package/dist/src/cli/dev/tui/conversation-view.js +1 -0
- package/dist/src/cli/dev/tui/flow-drawer.d.ts +5 -2
- package/dist/src/cli/dev/tui/flow-drawer.js +1 -1
- package/dist/src/cli/dev/tui/log-display-mode.d.ts +4 -10
- package/dist/src/cli/dev/tui/log-display-mode.js +1 -1
- package/dist/src/cli/dev/tui/message-queue.d.ts +7 -63
- package/dist/src/cli/dev/tui/message-queue.js +3 -1
- package/dist/src/cli/dev/tui/prompt-commands.js +1 -1
- package/dist/src/cli/dev/tui/question-panel.d.ts +3 -1
- package/dist/src/cli/dev/tui/question-panel.js +1 -1
- package/dist/src/cli/dev/tui/runner.d.ts +56 -193
- package/dist/src/cli/dev/tui/runner.js +3 -3
- package/dist/src/cli/dev/tui/task-activity.d.ts +11 -7
- package/dist/src/cli/dev/tui/task-activity.js +1 -1
- package/dist/src/cli/dev/tui/terminal-renderer.d.ts +15 -37
- package/dist/src/cli/dev/tui/terminal-renderer.js +10 -13
- package/dist/src/cli/dev/tui/terminal-tool-part.d.ts +2 -0
- package/dist/src/cli/dev/tui/terminal-tool-part.js +1 -0
- package/dist/src/cli/dev/tui/test/fake-eve-server.d.ts +34 -0
- package/dist/src/cli/dev/tui/test/fake-eve-server.js +1 -0
- package/dist/src/cli/dev/tui/test/index.d.ts +1 -0
- package/dist/src/cli/dev/tui/test/index.js +1 -1
- package/dist/src/cli/dev/tui/tool-block-groups.js +1 -1
- package/dist/src/cli/dev/tui/tool-presentation.d.ts +1 -0
- package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
- package/dist/src/cli/dev/tui/tool-rows.d.ts +1 -0
- package/dist/src/cli/dev/tui/tool-rows.js +2 -2
- package/dist/src/cli/dev/tui/transcript-parts.d.ts +73 -0
- package/dist/src/cli/dev/tui/transcript-parts.js +3 -0
- package/dist/src/cli/dev/tui/transcript.d.ts +47 -0
- package/dist/src/cli/dev/tui/transcript.js +1 -0
- package/dist/src/cli/dev/tui/tui.js +1 -1
- package/dist/src/cli/dev/tui/turn-clock.d.ts +11 -26
- package/dist/src/cli/dev/tui/turn-clock.js +1 -1
- package/dist/src/cli/dev/tui/types.d.ts +2 -4
- package/dist/src/cli/dev/ui-options.js +1 -1
- package/dist/src/client/agent-stream-follower.d.ts +26 -0
- package/dist/src/client/agent-stream-follower.js +1 -0
- package/dist/src/client/authorization-message-parts.js +1 -1
- package/dist/src/client/conversation-client.d.ts +40 -0
- package/dist/src/client/conversation-client.js +1 -0
- package/dist/src/client/conversation-reducer.d.ts +29 -0
- package/dist/src/client/conversation-reducer.js +1 -0
- package/dist/src/client/conversation-state.d.ts +110 -0
- package/dist/src/client/conversation-state.js +1 -0
- package/dist/src/client/eve-agent-projection.d.ts +24 -7
- package/dist/src/client/eve-agent-projection.js +1 -1
- package/dist/src/client/eve-agent-store-helpers.d.ts +21 -2
- package/dist/src/client/eve-agent-store-helpers.js +2 -2
- package/dist/src/client/eve-agent-store-state.d.ts +15 -3
- package/dist/src/client/eve-agent-store.d.ts +10 -1
- package/dist/src/client/eve-agent-store.js +1 -1
- package/dist/src/client/index.d.ts +4 -1
- package/dist/src/client/index.js +1 -1
- package/dist/src/client/message-reducer-primitives.d.ts +1 -2
- package/dist/src/client/message-reducer-primitives.js +1 -1
- package/dist/src/client/message-reducer-types.d.ts +9 -2
- package/dist/src/client/message-reducer.js +1 -1
- package/dist/src/client/message-response.js +1 -1
- package/dist/src/client/message-run-parts.d.ts +10 -6
- package/dist/src/client/message-run-parts.js +1 -1
- package/dist/src/client/optimistic-message-submissions.d.ts +6 -4
- package/dist/src/client/optimistic-message-submissions.js +1 -1
- package/dist/src/client/reducer.d.ts +5 -1
- package/dist/src/client/session-turn-dispatch.d.ts +15 -0
- package/dist/src/client/session-turn-dispatch.js +1 -0
- package/dist/src/client/session-utils.d.ts +27 -10
- package/dist/src/client/session-utils.js +1 -1
- package/dist/src/client/session.js +1 -1
- package/dist/src/client/types.d.ts +2 -1
- package/dist/src/compiled/.vendor-stamp.json +1 -1
- package/dist/src/compiler/extension-compatibility.d.ts +18 -18
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/load-binding-namespace.js +1 -1
- package/dist/src/context/keys.d.ts +5 -2
- package/dist/src/context/keys.js +1 -1
- package/dist/src/context/provider.d.ts +5 -9
- package/dist/src/context/run-step.d.ts +4 -4
- package/dist/src/context/run-step.js +1 -1
- package/dist/src/evals/runner/derive-run-facts.js +1 -1
- package/dist/src/evals/runner/execute-task.js +1 -1
- package/dist/src/evals/session.js +2 -2
- package/dist/src/evals/types.d.ts +16 -0
- package/dist/src/eve-channel/index.js +1 -1
- package/dist/src/execution/agent-sessions/context.d.ts +4 -2
- package/dist/src/execution/agent-sessions/context.js +1 -1
- package/dist/src/execution/agent-sessions/steps.js +1 -1
- package/dist/src/execution/cancelled-model-call-batch.js +1 -1
- package/dist/src/execution/coordination-dispatch-shared.d.ts +6 -4
- package/dist/src/execution/coordination-dispatch-shared.js +1 -1
- package/dist/src/execution/create-session-step.d.ts +4 -2
- package/dist/src/execution/create-session-step.js +1 -1
- package/dist/src/execution/durable-session-store.d.ts +10 -4
- package/dist/src/execution/durable-session-store.js +1 -1
- package/dist/src/execution/dynamic-workflow/tool.js +1 -1
- package/dist/src/execution/legacy-session/completion-step.d.ts +2 -0
- package/dist/src/execution/legacy-session/completion-step.js +1 -1
- package/dist/src/execution/legacy-session/interrupt-step.js +1 -1
- package/dist/src/execution/legacy-session/prepare-step.d.ts +1 -0
- package/dist/src/execution/legacy-session/prepare-step.js +1 -1
- package/dist/src/execution/legacy-session/snapshot.d.ts +8 -4
- package/dist/src/execution/legacy-session/snapshot.js +1 -1
- package/dist/src/execution/legacy-session/turn-workflow.js +1 -1
- package/dist/src/execution/proxied-deliver-step.js +1 -1
- package/dist/src/execution/publish-session-events.d.ts +27 -7
- package/dist/src/execution/publish-session-events.js +1 -1
- package/dist/src/execution/reconcile-session-continuation-token.d.ts +2 -2
- package/dist/src/execution/runtime-context.js +1 -1
- package/dist/src/execution/session/active-turn.d.ts +97 -0
- package/dist/src/execution/session/active-turn.js +1 -0
- package/dist/src/execution/session/entry.js +1 -1
- package/dist/src/execution/session/finalization.js +1 -1
- package/dist/src/execution/session/handoff.d.ts +5 -3
- package/dist/src/execution/session/handoff.js +1 -1
- package/dist/src/execution/session/input-queue.d.ts +19 -13
- package/dist/src/execution/session/input-queue.js +1 -1
- package/dist/src/execution/session/next-input.d.ts +2 -10
- package/dist/src/execution/session/next-input.js +1 -1
- package/dist/src/execution/session/program.d.ts +2 -0
- package/dist/src/execution/session/program.js +1 -1
- package/dist/src/execution/session/state-cursor.d.ts +22 -16
- package/dist/src/execution/session/state-cursor.js +1 -1
- package/dist/src/execution/session/state-delta.d.ts +8 -1
- package/dist/src/execution/session/state-delta.js +1 -1
- package/dist/src/execution/session/turn-event-handler.js +1 -1
- package/dist/src/execution/session/turn-step-result.js +1 -1
- package/dist/src/execution/session/turn-step-types.d.ts +13 -4
- package/dist/src/execution/session/turn-step.js +1 -1
- package/dist/src/execution/session/turn-waiting-step.js +1 -1
- package/dist/src/execution/session/turn.d.ts +8 -1
- package/dist/src/execution/session/turn.js +1 -1
- package/dist/src/execution/session.d.ts +5 -5
- package/dist/src/execution/session.js +2 -2
- package/dist/src/execution/settle-cancelled-turn-step.d.ts +5 -4
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/tasks/start.d.ts +2 -2
- package/dist/src/execution/tasks/task-id-input.d.ts +1 -1
- package/dist/src/execution/tasks/task-id-input.js +1 -1
- package/dist/src/execution/terminal-session-completion-step.d.ts +2 -0
- package/dist/src/execution/terminal-session-completion-step.js +1 -1
- package/dist/src/execution/terminal-session-failure-step.d.ts +2 -0
- package/dist/src/execution/terminal-session-failure-step.js +1 -1
- package/dist/src/execution/tools/agent-router-workflow.js +1 -1
- package/dist/src/execution/tools/connection-target.d.ts +5 -0
- package/dist/src/execution/tools/connection-target.js +1 -1
- package/dist/src/execution/tools/connection-tools.js +2 -2
- package/dist/src/execution/tools/workflow/start.d.ts +3 -3
- package/dist/src/harness/authorization.d.ts +15 -2
- package/dist/src/harness/authorization.js +1 -1
- package/dist/src/harness/cancelled-turn-emission.d.ts +2 -1
- package/dist/src/harness/cancelled-turn-emission.js +1 -1
- package/dist/src/harness/coordination.d.ts +5 -3
- package/dist/src/harness/emission.d.ts +5 -2
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/held-requests.d.ts +18 -0
- package/dist/src/harness/held-requests.js +1 -0
- package/dist/src/harness/hitl/approval-input-requests.d.ts +16 -0
- package/dist/src/harness/hitl/approval-input-requests.js +1 -1
- package/dist/src/harness/input-extraction.js +1 -1
- package/dist/src/harness/input-requests.d.ts +0 -4
- package/dist/src/harness/input-requests.js +1 -1
- package/dist/src/harness/model-call-error.js +1 -1
- package/dist/src/harness/proxy-input-requests.d.ts +4 -4
- package/dist/src/harness/session-limit-enforcement.js +1 -1
- package/dist/src/harness/stale-input-responses.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/turn-tag-state.d.ts +2 -0
- package/dist/src/harness/turn-tag-state.js +1 -1
- package/dist/src/harness/types.d.ts +23 -11
- package/dist/src/instrumentation/channel-delivery.d.ts +1 -0
- package/dist/src/instrumentation/channel-delivery.js +1 -1
- package/dist/src/instrumentation/lifecycle.d.ts +4 -0
- package/dist/src/instrumentation/memory.d.ts +2 -0
- package/dist/src/instrumentation/memory.js +1 -1
- package/dist/src/instrumentation/native-events.d.ts +1 -0
- package/dist/src/instrumentation/native-events.js +1 -1
- package/dist/src/instrumentation/runtime.d.ts +4 -3
- package/dist/src/instrumentation/runtime.js +1 -1
- package/dist/src/instrumentation/session-init.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-module-loader.d.ts +14 -6
- package/dist/src/internal/authored-module-loader.js +1 -1
- package/dist/src/internal/authored-package-boundary.d.ts +1 -1
- package/dist/src/internal/authored-package-boundary.js +1 -1
- package/dist/src/internal/bundler/extension-mount-plugin.js +1 -1
- package/dist/src/internal/workflow-bundle/dynamic-remote-agent-transform.js +1 -1
- package/dist/src/internal/workflow-bundle/dynamic-tool-ast-references.d.ts +27 -1
- package/dist/src/internal/workflow-bundle/dynamic-tool-ast-references.js +1 -1
- package/dist/src/internal/workflow-bundle/dynamic-tool-transform.js +2 -2
- package/dist/src/protocol/message.d.ts +41 -3
- package/dist/src/protocol/message.js +2 -2
- package/dist/src/public/channels/slack/action-status.d.ts +2 -2
- package/dist/src/public/channels/slack/action-status.js +1 -1
- package/dist/src/public/channels/slack/approval-cards.d.ts +15 -0
- package/dist/src/public/channels/slack/approval-cards.js +2 -0
- package/dist/src/public/channels/slack/auth.d.ts +2 -0
- package/dist/src/public/channels/slack/auth.js +1 -1
- package/dist/src/public/channels/slack/connections.d.ts +15 -11
- package/dist/src/public/channels/slack/connections.js +1 -1
- package/dist/src/public/channels/slack/defaults.d.ts +1 -15
- package/dist/src/public/channels/slack/defaults.js +3 -4
- package/dist/src/public/channels/slack/hitl.js +1 -1
- package/dist/src/public/channels/slack/inbound.d.ts +10 -2
- package/dist/src/public/channels/slack/inbound.js +1 -1
- package/dist/src/public/channels/slack/index.d.ts +2 -0
- package/dist/src/public/channels/slack/index.js +1 -1
- package/dist/src/public/channels/slack/input-response.js +1 -1
- package/dist/src/public/channels/slack/interaction-cards.js +1 -1
- package/dist/src/public/channels/slack/interactions.js +1 -1
- package/dist/src/public/channels/slack/limits.d.ts +5 -3
- package/dist/src/public/channels/slack/private-approval-delivery.js +1 -1
- package/dist/src/public/channels/slack/renderers.d.ts +1 -1
- package/dist/src/public/channels/slack/renderers.js +1 -1
- package/dist/src/public/channels/slack/reply-delivery.d.ts +72 -0
- package/dist/src/public/channels/slack/reply-delivery.js +1 -0
- package/dist/src/public/channels/slack/sign-in-cancel.d.ts +20 -0
- package/dist/src/public/channels/slack/sign-in-cancel.js +1 -0
- package/dist/src/public/channels/slack/slackChannel.d.ts +15 -0
- package/dist/src/public/channels/slack/slackChannel.js +1 -1
- package/dist/src/public/channels/slack/task-card.js +1 -1
- package/dist/src/public/channels/teams/defaults.d.ts +1 -1
- package/dist/src/public/channels/teams/defaults.js +2 -2
- package/dist/src/public/definitions/channel.d.ts +1 -0
- package/dist/src/public/definitions/channel.js +1 -1
- package/dist/src/public/next/index.js +1 -1
- package/dist/src/public/next/server.d.ts +2 -0
- package/dist/src/public/next/server.js +1 -2
- package/dist/src/public/nuxt/module.d.ts +6 -0
- package/dist/src/public/nuxt/module.js +1 -1
- package/dist/src/react/index.d.ts +3 -0
- package/dist/src/react/index.js +1 -1
- package/dist/src/react/use-eve-agent.d.ts +7 -5
- package/dist/src/react/use-eve-agent.js +1 -1
- package/dist/src/runtime/connections/scoped-authorization.d.ts +2 -0
- package/dist/src/runtime/connections/scoped-authorization.js +1 -1
- package/dist/src/setup/boxes/deploy-project.js +1 -1
- package/dist/src/setup/integrations/web/setup.js +6 -2
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/scaffold/create/web-template.d.ts +2 -2
- package/dist/src/setup/scaffold/create/web-template.js +28 -9
- package/dist/src/setup/vercel-project-framework.js +1 -1
- package/dist/src/shared/display-name.d.ts +15 -0
- package/dist/src/shared/display-name.js +1 -0
- package/dist/src/shared/framework-eve-server.d.ts +43 -0
- package/dist/src/shared/framework-eve-server.js +2 -0
- package/dist/src/shared/token-usage.d.ts +2 -0
- package/dist/src/shared/token-usage.js +1 -1
- package/dist/src/shared/trace-root.d.ts +8 -0
- package/dist/src/shared/trace-root.js +1 -0
- package/dist/src/subagents/hitl-proxy.d.ts +3 -3
- package/dist/src/subagents/hitl-proxy.js +1 -1
- package/dist/src/subagents/invocation.d.ts +3 -1
- package/dist/src/subagents/tool.js +1 -1
- package/dist/src/svelte/index.d.ts +3 -0
- package/dist/src/svelte/index.js +2 -2
- package/dist/src/svelte/use-eve-agent.d.ts +7 -4
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tools/provided/ask-question-workflow.js +1 -1
- package/dist/src/tools/provided/load-skill.js +1 -1
- package/dist/src/tools/provided/sleep-workflow.js +1 -1
- package/dist/src/tracing/agent-action-instrumentation.js +1 -1
- package/dist/src/tracing/agent-approval-instrumentation.js +1 -1
- package/dist/src/tracing/agent-memory-instrumentation.js +1 -1
- package/dist/src/tracing/agent-otel-attributes.d.ts +6 -0
- package/dist/src/tracing/agent-otel-attributes.js +1 -1
- package/dist/src/tracing/agent-otel-provider.js +2 -2
- package/dist/src/tracing/agent-otel-runtime-context.d.ts +1 -1
- package/dist/src/tracing/agent-otel-runtime-context.js +1 -1
- package/dist/src/tracing/agent-otel-session-context.js +1 -1
- package/dist/src/tracing/agent-span-contract.js +1 -1
- package/dist/src/tracing/agent-tool-instrumentation.js +1 -1
- package/dist/src/tracing/agent-trace-context-codec.d.ts +4 -0
- package/dist/src/tracing/agent-trace-context-codec.js +1 -1
- package/dist/src/tracing/agent-trace-span-processor.js +1 -1
- package/dist/src/tracing/agent-trace-state.d.ts +3 -0
- package/dist/src/tracing/conversation-context.d.ts +10 -0
- package/dist/src/tracing/conversation-context.js +1 -1
- package/dist/src/tracing/otel-registration.js +1 -1
- package/dist/src/vue/index.d.ts +3 -0
- package/dist/src/vue/index.js +2 -2
- package/dist/src/vue/use-eve-agent.d.ts +7 -3
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/channels/slack.mdx +60 -13
- package/docs/concepts/built-in-tools.md +3 -2
- package/docs/concepts/sessions-runs-and-streaming.md +4 -4
- package/docs/connections/overview.mdx +9 -3
- package/docs/evals/reporters.mdx +4 -0
- package/docs/extensions.md +11 -0
- package/docs/guides/client/streaming.mdx +7 -6
- package/docs/guides/deployment/vercel.mdx +2 -1
- package/docs/guides/dev-tui.md +15 -15
- package/docs/guides/dynamic-capabilities.md +1 -1
- package/docs/guides/frontend/nuxt.mdx +24 -4
- package/docs/guides/frontend/overview.mdx +44 -38
- package/docs/guides/frontend/use-eve-agent-svelte.mdx +4 -10
- package/docs/guides/frontend/use-eve-agent-vue.mdx +4 -10
- package/docs/guides/instrumentation/otel.mdx +24 -6
- package/docs/guides/remote-agents.md +26 -8
- package/docs/reference/cli.md +4 -4
- package/docs/tools/human-in-the-loop.md +4 -4
- package/docs/tools/overview.mdx +1 -1
- package/docs/tools/tasks.md +8 -8
- package/package.json +1 -1
- package/dist/src/cli/dev/tui/steering-stream.d.ts +0 -15
- package/dist/src/cli/dev/tui/steering-stream.js +0 -1
- package/dist/src/cli/dev/tui/subagent-pump.d.ts +0 -134
- package/dist/src/cli/dev/tui/subagent-pump.js +0 -1
- package/dist/src/public/nuxt/dev-server.d.ts +0 -25
- package/dist/src/public/nuxt/dev-server.js +0 -1
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import type { CompiledAgentManifest } from "#compiler/manifest.js";
|
|
2
2
|
import type { AuthoredWorkflowModules } from "#internal/workflow-bundle/builder-support.js";
|
|
3
|
+
export interface ExtensionMountEntry {
|
|
4
|
+
readonly mountSourcePath: string;
|
|
5
|
+
readonly packageName: string;
|
|
6
|
+
readonly sourceRoot: string;
|
|
7
|
+
readonly specifier: string;
|
|
8
|
+
}
|
|
3
9
|
export interface AuthoredModuleLoadOptions {
|
|
4
10
|
readonly externalDependencies?: readonly string[];
|
|
5
11
|
readonly extension?: {
|
|
6
12
|
readonly mountId: string;
|
|
7
13
|
/** Only filesystem mounts need a synthetic entry to bind their configuration. */
|
|
8
|
-
readonly entry?:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
readonly entry?: ExtensionMountEntry;
|
|
15
|
+
/**
|
|
16
|
+
* Filesystem mounts enclosing `mountId`, outermost first. A mount declared inside another
|
|
17
|
+
* extension may read that extension's configuration, so those mounts bind first.
|
|
18
|
+
*/
|
|
19
|
+
readonly ancestors?: readonly (ExtensionMountEntry & {
|
|
20
|
+
readonly mountId: string;
|
|
21
|
+
})[];
|
|
14
22
|
readonly evaluationId?: string;
|
|
15
23
|
};
|
|
16
24
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{createHash}from"node:crypto";import{expectObjectRecord}from"#internal/authored-module.js";import{resolvePackageSourceFilePath}from"#internal/application/package.js";import{existsSync,mkdirSync,realpathSync,writeFileSync}from"node:fs";import{dirname,join,relative,resolve,sep}from"node:path";import{createCompiledModuleMapSource}from"#compiler/module-map.js";import{extensionOverridePaths}from"#compiler/extension-mount-bindings.js";import{normalizeEsmImportSpecifier}from"#internal/application/import-specifier.js";import{buildSingleRolldownChunk,buildWithNitroRolldown}from"#internal/bundler/nitro-rolldown.js";import{createAuthoredAssetImportPlugin}from"#internal/authored-asset-import-plugin.js";import{createExtensionMountPlugin}from"#internal/bundler/extension-mount-plugin.js";import{authoredModuleConditions}from"#internal/authored-module-conditions.js";import{createAuthoredModuleBundleError}from"#internal/authored-module-bundle.js";import{createAuthoredModuleEvaluationError}from"#internal/authored-module-evaluation-error.js";import{createAuthoredPackageTsConfigPathsPlugin}from"#internal/authored-package-tsconfig-paths.js";import{createAuthoredRelativeExtensionResolverPlugin}from"#internal/authored-relative-extension-resolver.js";import{createExtensionScopePlugin,createFixedMountScopePlugin}from"#internal/bundler/extension-scope-plugin.js";import{RESOLVE_EXTENSIONS,createDistributionPackageBoundaryPlugin,createGenerationPackageBoundaryPlugin,createRuntimeLoaderPackageBoundaryPlugin,isNodeModulesPath,normalizeExternalDependencies}from"#internal/authored-package-boundary.js";import{createNodeEsmCompatBannerPlugin}from"#internal/node-esm-compat-banner.js";import{prepareAuthoredWorkflowDirectives}from"#internal/workflow-bundle/authored-workflow-directives.js";import{createDynamicCapabilityTransformPlugin}from"#internal/workflow-bundle/dynamic-capability-transform-plugin.js";import{applyWorkflowTransform,isAuthoredApplicationModule}from"#internal/workflow-bundle/workflow-builders.js";const AUTHORED_BUNDLED_MODULE_EXTENSION=/\.[cm]?[jt]sx?$/,AUTHORED_MODULE_BUNDLE_DIRECTORY_PATH=join(`node_modules`,`.cache`,`eve`,`authored-modules`),inFlightModuleLoads=new Map;function loadAuthoredModuleNamespace(e,t={}){let n=createInFlightModuleLoadKey(resolve(e),t),r=inFlightModuleLoads.get(n);if(r!==void 0)return r;let i=(async()=>{try{return await doLoadAuthoredModuleNamespace(e,t)}finally{inFlightModuleLoads.delete(n)}})();return inFlightModuleLoads.set(n,i),i}async function doLoadAuthoredModuleNamespace(e,t){let n=AUTHORED_BUNDLED_MODULE_EXTENSION.test(e)?await loadBundledAuthoredModule(e,t):await import(createFileImportSpecifier(e));return expectObjectRecord(n,`Expected "${e}" to export a module namespace object.`)}function createFileImportSpecifier(e){let t=e.replaceAll(`\\`,`/`);return/^[A-Za-z]:\//.test(t)?`file:///${encodeURI(t)}`:t.startsWith(`/`)?`file://${encodeURI(t)}`:t}async function bundleAuthoredModuleCode(e,t={}){let n=resolveAuthoredPackageRoot(e),r=t.extension?.entry,i=t.extension?.mountId;return await buildAuthoredModuleBundle(e,t,{packageBoundaryPlugin:createRuntimeLoaderPackageBoundaryPlugin({externalDependencies:normalizeExternalDependencies(t.externalDependencies),packageRoot:n,extensionSpecifier:r?.specifier}),plugins:[...r===void 0?[]:[{name:`eve-compile-mount-entry`,resolveId(e){return e===`\0eve-compile-mount-entry`?e:void 0},load(t){if(t!==`\0eve-compile-mount-entry`)return;let n=`${r.mountSourcePath}?eve-mount=${encodeURIComponent(i)}`,a=`${e}?eve-mount=${encodeURIComponent(i)}`;return`import ${JSON.stringify(n)}; export * from ${JSON.stringify(a)}; import entry from ${JSON.stringify(a)}; export default entry;`}}],createAuthoredWorkflowDirectivePlugin({appRoot:n}),...r===void 0?[]:[createExtensionMountPlugin([{...r,mountId:i}])]],sourcemap:`inline`})}async function bundleAuthoredModuleForGeneration(e,t={}){return removeRolldownModuleRegionComments(await buildAuthoredModuleBundle(e,t,{packageBoundaryPlugin:createGenerationPackageBoundaryPlugin({externalDependencies:normalizeExternalDependencies(t.externalDependencies),packageRoot:resolveAuthoredPackageRoot(e)}),plugins:[createAuthoredDirectiveGuardPlugin()],sourcemap:!1}))}async function bundleExtensionDistributionGraph(e){let t=[createAuthoredDirectiveGuardPlugin(),createAuthoredRelativeExtensionResolverPlugin({extensions:RESOLVE_EXTENSIONS}),createAuthoredAssetImportPlugin({packageRoot:e.packageRoot}),createAuthoredPackageTsConfigPathsPlugin({appPackageRoot:e.packageRoot,extensions:RESOLVE_EXTENSIONS}),createNodeEsmCompatBannerPlugin({includeRequire:!0}),createDistributionPackageBoundaryPlugin({packageRoot:e.packageRoot,runtimeDependencies:e.runtimeDependencies})];try{let n=await buildWithNitroRolldown({cwd:e.packageRoot,input:Object.fromEntries(e.entries.map(e=>[e.name,e.path])),platform:`node`,plugins:t,resolve:{extensions:[...RESOLVE_EXTENSIONS]},tsconfig:resolveAuthoredTsConfigPath(e.packageRoot),write:!1,output:{chunkFileNames:`_chunks/[name]-[hash].mjs`,codeSplitting:!0,comments:!1,entryFileNames:`[name].mjs`,format:`esm`,sourcemap:!1}}),r=new Map,i=new Set;for(let e of n.output)if(e.type===`chunk`){r.set(e.fileName,removeRolldownModuleRegionComments(e.code));for(let t of[...e.imports,...e.dynamicImports])i.add(t)}return{files:r,imports:[...i]}}catch(t){throw createAuthoredModuleBundleError(e.packageRoot,t)}}async function bundleAuthoredModuleMapForGeneration(e){let t=resolveAuthoredPackageRoot(e.manifest.agentRoot),n=resolvePackageSourceFilePath(usesDevelopmentExtensionModules(e.manifest)?`src/internal/development-programmatic-source-loader.ts`:`src/internal/programmatic-source-loader.ts`),r=normalizeExternalDependencies([...e.manifest.config.build?.externalDependencies??[],...e.manifest.subagents.flatMap(e=>e.configResolver===void 0?e.agent.config.build?.externalDependencies??[]:e.configResolver.build?.externalDependencies??[])]),i=createCompiledModuleMapSource({manifest:e.manifest,moduleMapPath:e.moduleMapPath,programmaticLoaderImportSpecifier:n}),a=[e.manifest,...e.manifest.subagents.map(e=>e.agent)].flatMap(e=>e.extensionMounts),o=createExtensionScopePlugin([e.manifest,...e.manifest.subagents.map(e=>e.agent)].flatMap(e=>e.extensionMounts.map(e=>({mountId:e.mountId,sourceRoot:e.sourceRoot})))),s=new AuthoredWorkflowSourceRecorder(e.appRoot),c=[createVirtualGenerationModuleMapPlugin({id:e.moduleMapPath,source:i}),createExternalRuntimeImportPlugin(n),createAuthoredWorkflowDirectivePlugin({appRoot:e.appRoot,recorder:s}),createDynamicCapabilityTransformPlugin({workflowFunctions:e=>s.workflowFunctions(e)}),s.graphPlugin(),createExtensionMountPlugin(a,extensionOverridePaths(e.manifest)),o,createAuthoredRelativeExtensionResolverPlugin({extensions:RESOLVE_EXTENSIONS}),createAuthoredAssetImportPlugin({packageRoot:t}),createAuthoredPackageTsConfigPathsPlugin({appPackageRoot:t,extensions:RESOLVE_EXTENSIONS}),createNodeEsmCompatBannerPlugin({includeRequire:!0}),createGenerationPackageBoundaryPlugin({externalDependencies:r,packageRoot:t,extensionSpecifiers:new Set(a.map(e=>e.specifier)),resolveExternalPaths:e.resolveExternalPaths})].filter(e=>e!==null);try{let n=await buildSingleRolldownChunk(`authored module map`,{cwd:t,input:e.moduleMapPath,platform:`node`,plugins:c,resolve:{conditionNames:authoredModuleConditions(),extensions:[...RESOLVE_EXTENSIONS]},tsconfig:resolveAuthoredTsConfigPath(t),output:{comments:!1,format:`esm`,sourcemap:!1}});return{authoredWorkflowModules:s.modules(),code:removeRolldownModuleRegionComments(n.code),workflowSourceFingerprint:s.fingerprint()}}catch(t){throw createAuthoredModuleBundleError(e.moduleMapPath,t)}}function usesDevelopmentExtensionModules(e){return[e,...e.subagents.map(e=>e.agent)].some(e=>Object.values(e.bindings).some(e=>e.backing.kind===`programmatic`&&e.backing.registryId.startsWith(`eve:development-extension:`)))}function createExternalRuntimeImportPlugin(e){let t=normalizeEsmImportSpecifier(e);return{name:`eve-external-runtime-import`,resolveId(e){return e===t?{external:!0,id:t}:void 0}}}var AuthoredWorkflowSourceRecorder=class{#e;#t=new Set;#n=new Map;#r=new Map;#i=new Map;constructor(e){this.#e=e}record(e,t,n){this.#r.set(e,t),(n.steps!==void 0||n.workflows!==void 0)&&this.#t.add(e);let r=Object.values(n.workflows??{})[0];r!==void 0&&this.#i.set(e,new Set(Object.keys(r)))}workflowFunctions(e){return this.#i.get(e)}graphPlugin(){let e=this.#n;return{name:`eve-authored-module-graph`,buildEnd(){for(let t of this.getModuleIds()){let n=this.getModuleInfo(t);n!==null&&e.set(t,[...n.importedIds,...n.dynamicallyImportedIds])}}}}modules(){return{directiveModules:[...this.#t].sort(),workflowModules:[...this.#i.keys()].sort()}}fingerprint(){if(this.#t.size===0)return;let e=new Set,t=[...this.#t];for(let n=t.shift();n!==void 0;n=t.shift())!e.has(n)&&this.#r.has(n)&&(e.add(n),t.push(...this.#n.get(n)??[]));let n=createHash(`sha256`);for(let t of[...e].sort())n.update(relative(this.#e,t).split(sep).join(`/`)).update(`\0`).update(this.#r.get(t)??``).update(`\0`);return n.digest(`hex`)}};function createVirtualGenerationModuleMapPlugin(e){return{name:`eve-generation-module-map`,resolveId(t){return t===e.id?t:void 0},load(t){return t===e.id?{code:e.source,moduleType:`js`}:void 0}}}async function buildAuthoredModuleBundle(e,t,n){let r=resolveAuthoredPackageRoot(e),i=resolveAuthoredTsConfigPath(r),a=[...n.plugins,t.extension===void 0?null:createFixedMountScopePlugin(t.extension.mountId),createAuthoredRelativeExtensionResolverPlugin({extensions:RESOLVE_EXTENSIONS}),createAuthoredAssetImportPlugin({packageRoot:r}),createAuthoredPackageTsConfigPathsPlugin({appPackageRoot:r,extensions:RESOLVE_EXTENSIONS}),createNodeEsmCompatBannerPlugin({includeRequire:!0}),n.packageBoundaryPlugin].filter(e=>e!==null);try{return(await buildSingleRolldownChunk(`authored module for "${e}"`,{cwd:r,input:t.extension?.entry===void 0?e:`\0eve-compile-mount-entry`,platform:`node`,plugins:a,resolve:{conditionNames:authoredModuleConditions(),extensions:[...RESOLVE_EXTENSIONS]},tsconfig:i,output:{comments:!1,format:`esm`,sourcemap:n.sourcemap}})).code}catch(t){throw createAuthoredModuleBundleError(e,t)}}function createAuthoredDirectiveGuardPlugin(){return{name:`eve-authored-directive-guard`,async transform(e,t){if(!AUTHORED_BUNDLED_MODULE_EXTENSION.test(t)||isNodeModulesPath(t))return;let{hasDirectives:n}=await prepareAuthoredWorkflowDirectives({filePath:t,source:e});if(n)throw Error(`Module "${t}" uses Workflow directives ("use step" or "use workflow"). Workflow directives are supported in application modules only, not in extensions or instrumentation.`)}}}function createAuthoredWorkflowDirectivePlugin(e){return{name:`eve-authored-workflow-directives`,async transform(t,n){if(!AUTHORED_BUNDLED_MODULE_EXTENSION.test(n)||isNodeModulesPath(n)||!isAuthoredApplicationModule(n,e.appRoot))return;let r=await applyWorkflowTransform(n,t,`client`,n,e.appRoot);return e.recorder?.record(n,t,r.workflowManifest),r.code===t?void 0:{code:r.code,map:null}}}}function removeRolldownModuleRegionComments(e){return e.split(`
|
|
1
|
+
import{createHash}from"node:crypto";import{expectObjectRecord}from"#internal/authored-module.js";import{resolvePackageSourceFilePath}from"#internal/application/package.js";import{existsSync,mkdirSync,realpathSync,writeFileSync}from"node:fs";import{dirname,join,relative,resolve,sep}from"node:path";import{createCompiledModuleMapSource}from"#compiler/module-map.js";import{extensionOverridePaths}from"#compiler/extension-mount-bindings.js";import{normalizeEsmImportSpecifier}from"#internal/application/import-specifier.js";import{buildSingleRolldownChunk,buildWithNitroRolldown}from"#internal/bundler/nitro-rolldown.js";import{createAuthoredAssetImportPlugin}from"#internal/authored-asset-import-plugin.js";import{createExtensionMountPlugin}from"#internal/bundler/extension-mount-plugin.js";import{authoredModuleConditions}from"#internal/authored-module-conditions.js";import{createAuthoredModuleBundleError}from"#internal/authored-module-bundle.js";import{createAuthoredModuleEvaluationError}from"#internal/authored-module-evaluation-error.js";import{createAuthoredPackageTsConfigPathsPlugin}from"#internal/authored-package-tsconfig-paths.js";import{createAuthoredRelativeExtensionResolverPlugin}from"#internal/authored-relative-extension-resolver.js";import{createExtensionScopePlugin,createFixedMountScopePlugin}from"#internal/bundler/extension-scope-plugin.js";import{RESOLVE_EXTENSIONS,createDistributionPackageBoundaryPlugin,createGenerationPackageBoundaryPlugin,createRuntimeLoaderPackageBoundaryPlugin,isNodeModulesPath,normalizeExternalDependencies}from"#internal/authored-package-boundary.js";import{createNodeEsmCompatBannerPlugin}from"#internal/node-esm-compat-banner.js";import{prepareAuthoredWorkflowDirectives}from"#internal/workflow-bundle/authored-workflow-directives.js";import{createDynamicCapabilityTransformPlugin}from"#internal/workflow-bundle/dynamic-capability-transform-plugin.js";import{applyWorkflowTransform,isAuthoredApplicationModule}from"#internal/workflow-bundle/workflow-builders.js";const AUTHORED_BUNDLED_MODULE_EXTENSION=/\.[cm]?[jt]sx?$/,AUTHORED_MODULE_BUNDLE_DIRECTORY_PATH=join(`node_modules`,`.cache`,`eve`,`authored-modules`),inFlightModuleLoads=new Map;function loadAuthoredModuleNamespace(e,t={}){let n=createInFlightModuleLoadKey(resolve(e),t),r=inFlightModuleLoads.get(n);if(r!==void 0)return r;let i=(async()=>{try{return await doLoadAuthoredModuleNamespace(e,t)}finally{inFlightModuleLoads.delete(n)}})();return inFlightModuleLoads.set(n,i),i}async function doLoadAuthoredModuleNamespace(e,t){let n=AUTHORED_BUNDLED_MODULE_EXTENSION.test(e)?await loadBundledAuthoredModule(e,t):await import(createFileImportSpecifier(e));return expectObjectRecord(n,`Expected "${e}" to export a module namespace object.`)}function createFileImportSpecifier(e){let t=e.replaceAll(`\\`,`/`);return/^[A-Za-z]:\//.test(t)?`file:///${encodeURI(t)}`:t.startsWith(`/`)?`file://${encodeURI(t)}`:t}async function bundleAuthoredModuleCode(e,t={}){let n=resolveAuthoredPackageRoot(e),r=t.extension?.entry,i=t.extension?.mountId,a=r===void 0?[]:[...t.extension?.ancestors??[],{...r,mountId:i}];return await buildAuthoredModuleBundle(e,t,{packageBoundaryPlugin:createRuntimeLoaderPackageBoundaryPlugin({externalDependencies:normalizeExternalDependencies(t.externalDependencies),packageRoot:n,extensionSpecifiers:new Set(a.map(e=>e.specifier))}),plugins:[...r===void 0?[]:[{name:`eve-compile-mount-entry`,resolveId(e){return e===`\0eve-compile-mount-entry`?e:void 0},load(t){if(t!==`\0eve-compile-mount-entry`)return;let n=a.map(e=>`import ${JSON.stringify(`${e.mountSourcePath}?eve-mount=${encodeURIComponent(e.mountId)}`)};`),r=`${e}?eve-mount=${encodeURIComponent(i)}`;return`${n.join(` `)} export * from ${JSON.stringify(r)}; import entry from ${JSON.stringify(r)}; export default entry;`}}],createAuthoredWorkflowDirectivePlugin({appRoot:n}),...r===void 0?[]:[createExtensionMountPlugin(a)]],sourcemap:`inline`})}async function bundleAuthoredModuleForGeneration(e,t={}){return removeRolldownModuleRegionComments(await buildAuthoredModuleBundle(e,t,{packageBoundaryPlugin:createGenerationPackageBoundaryPlugin({externalDependencies:normalizeExternalDependencies(t.externalDependencies),packageRoot:resolveAuthoredPackageRoot(e)}),plugins:[createAuthoredDirectiveGuardPlugin()],sourcemap:!1}))}async function bundleExtensionDistributionGraph(e){let t=[createAuthoredDirectiveGuardPlugin(),createAuthoredRelativeExtensionResolverPlugin({extensions:RESOLVE_EXTENSIONS}),createAuthoredAssetImportPlugin({packageRoot:e.packageRoot}),createAuthoredPackageTsConfigPathsPlugin({appPackageRoot:e.packageRoot,extensions:RESOLVE_EXTENSIONS}),createNodeEsmCompatBannerPlugin({includeRequire:!0}),createDistributionPackageBoundaryPlugin({packageRoot:e.packageRoot,runtimeDependencies:e.runtimeDependencies})];try{let n=await buildWithNitroRolldown({cwd:e.packageRoot,input:Object.fromEntries(e.entries.map(e=>[e.name,e.path])),platform:`node`,plugins:t,resolve:{extensions:[...RESOLVE_EXTENSIONS]},tsconfig:resolveAuthoredTsConfigPath(e.packageRoot),write:!1,output:{chunkFileNames:`_chunks/[name]-[hash].mjs`,codeSplitting:!0,comments:!1,entryFileNames:`[name].mjs`,format:`esm`,sourcemap:!1}}),r=new Map,i=new Set;for(let e of n.output)if(e.type===`chunk`){r.set(e.fileName,removeRolldownModuleRegionComments(e.code));for(let t of[...e.imports,...e.dynamicImports])i.add(t)}return{files:r,imports:[...i]}}catch(t){throw createAuthoredModuleBundleError(e.packageRoot,t)}}async function bundleAuthoredModuleMapForGeneration(e){let t=resolveAuthoredPackageRoot(e.manifest.agentRoot),n=resolvePackageSourceFilePath(usesDevelopmentExtensionModules(e.manifest)?`src/internal/development-programmatic-source-loader.ts`:`src/internal/programmatic-source-loader.ts`),r=normalizeExternalDependencies([...e.manifest.config.build?.externalDependencies??[],...e.manifest.subagents.flatMap(e=>e.configResolver===void 0?e.agent.config.build?.externalDependencies??[]:e.configResolver.build?.externalDependencies??[])]),i=createCompiledModuleMapSource({manifest:e.manifest,moduleMapPath:e.moduleMapPath,programmaticLoaderImportSpecifier:n}),a=[e.manifest,...e.manifest.subagents.map(e=>e.agent)].flatMap(e=>e.extensionMounts),o=createExtensionScopePlugin([e.manifest,...e.manifest.subagents.map(e=>e.agent)].flatMap(e=>e.extensionMounts.map(e=>({mountId:e.mountId,sourceRoot:e.sourceRoot})))),s=new AuthoredWorkflowSourceRecorder(e.appRoot),c=[createVirtualGenerationModuleMapPlugin({id:e.moduleMapPath,source:i}),createExternalRuntimeImportPlugin(n),createAuthoredWorkflowDirectivePlugin({appRoot:e.appRoot,recorder:s}),createDynamicCapabilityTransformPlugin({workflowFunctions:e=>s.workflowFunctions(e)}),s.graphPlugin(),createExtensionMountPlugin(a,extensionOverridePaths(e.manifest)),o,createAuthoredRelativeExtensionResolverPlugin({extensions:RESOLVE_EXTENSIONS}),createAuthoredAssetImportPlugin({packageRoot:t}),createAuthoredPackageTsConfigPathsPlugin({appPackageRoot:t,extensions:RESOLVE_EXTENSIONS}),createNodeEsmCompatBannerPlugin({includeRequire:!0}),createGenerationPackageBoundaryPlugin({externalDependencies:r,packageRoot:t,extensionSpecifiers:new Set(a.map(e=>e.specifier)),resolveExternalPaths:e.resolveExternalPaths})].filter(e=>e!==null);try{let n=await buildSingleRolldownChunk(`authored module map`,{cwd:t,input:e.moduleMapPath,platform:`node`,plugins:c,resolve:{conditionNames:authoredModuleConditions(),extensions:[...RESOLVE_EXTENSIONS]},tsconfig:resolveAuthoredTsConfigPath(t),output:{comments:!1,format:`esm`,sourcemap:!1}});return{authoredWorkflowModules:s.modules(),code:removeRolldownModuleRegionComments(n.code),workflowSourceFingerprint:s.fingerprint()}}catch(t){throw createAuthoredModuleBundleError(e.moduleMapPath,t)}}function usesDevelopmentExtensionModules(e){return[e,...e.subagents.map(e=>e.agent)].some(e=>Object.values(e.bindings).some(e=>e.backing.kind===`programmatic`&&e.backing.registryId.startsWith(`eve:development-extension:`)))}function createExternalRuntimeImportPlugin(e){let t=normalizeEsmImportSpecifier(e);return{name:`eve-external-runtime-import`,resolveId(e){return e===t?{external:!0,id:t}:void 0}}}var AuthoredWorkflowSourceRecorder=class{#e;#t=new Set;#n=new Map;#r=new Map;#i=new Map;constructor(e){this.#e=e}record(e,t,n){this.#r.set(e,t),(n.steps!==void 0||n.workflows!==void 0)&&this.#t.add(e);let r=Object.values(n.workflows??{})[0];r!==void 0&&this.#i.set(e,new Set(Object.keys(r)))}workflowFunctions(e){return this.#i.get(e)}graphPlugin(){let e=this.#n;return{name:`eve-authored-module-graph`,buildEnd(){for(let t of this.getModuleIds()){let n=this.getModuleInfo(t);n!==null&&e.set(t,[...n.importedIds,...n.dynamicallyImportedIds])}}}}modules(){return{directiveModules:[...this.#t].sort(),workflowModules:[...this.#i.keys()].sort()}}fingerprint(){if(this.#t.size===0)return;let e=new Set,t=[...this.#t];for(let n=t.shift();n!==void 0;n=t.shift())!e.has(n)&&this.#r.has(n)&&(e.add(n),t.push(...this.#n.get(n)??[]));let n=createHash(`sha256`);for(let t of[...e].sort())n.update(relative(this.#e,t).split(sep).join(`/`)).update(`\0`).update(this.#r.get(t)??``).update(`\0`);return n.digest(`hex`)}};function createVirtualGenerationModuleMapPlugin(e){return{name:`eve-generation-module-map`,resolveId(t){return t===e.id?t:void 0},load(t){return t===e.id?{code:e.source,moduleType:`js`}:void 0}}}async function buildAuthoredModuleBundle(e,t,n){let r=resolveAuthoredPackageRoot(e),i=resolveAuthoredTsConfigPath(r),a=[...n.plugins,t.extension===void 0?null:createFixedMountScopePlugin(t.extension.mountId),createAuthoredRelativeExtensionResolverPlugin({extensions:RESOLVE_EXTENSIONS}),createAuthoredAssetImportPlugin({packageRoot:r}),createAuthoredPackageTsConfigPathsPlugin({appPackageRoot:r,extensions:RESOLVE_EXTENSIONS}),createNodeEsmCompatBannerPlugin({includeRequire:!0}),n.packageBoundaryPlugin].filter(e=>e!==null);try{return(await buildSingleRolldownChunk(`authored module for "${e}"`,{cwd:r,input:t.extension?.entry===void 0?e:`\0eve-compile-mount-entry`,platform:`node`,plugins:a,resolve:{conditionNames:authoredModuleConditions(),extensions:[...RESOLVE_EXTENSIONS]},tsconfig:i,output:{comments:!1,format:`esm`,sourcemap:n.sourcemap}})).code}catch(t){throw createAuthoredModuleBundleError(e,t)}}function createAuthoredDirectiveGuardPlugin(){return{name:`eve-authored-directive-guard`,async transform(e,t){if(!AUTHORED_BUNDLED_MODULE_EXTENSION.test(t)||isNodeModulesPath(t))return;let{hasDirectives:n}=await prepareAuthoredWorkflowDirectives({filePath:t,source:e});if(n)throw Error(`Module "${t}" uses Workflow directives ("use step" or "use workflow"). Workflow directives are supported in application modules only, not in extensions or instrumentation.`)}}}function createAuthoredWorkflowDirectivePlugin(e){return{name:`eve-authored-workflow-directives`,async transform(t,n){if(!AUTHORED_BUNDLED_MODULE_EXTENSION.test(n)||isNodeModulesPath(n)||!isAuthoredApplicationModule(n,e.appRoot))return;let r=await applyWorkflowTransform(n,t,`client`,n,e.appRoot);return e.recorder?.record(n,t,r.workflowManifest),r.code===t?void 0:{code:r.code,map:null}}}}function removeRolldownModuleRegionComments(e){return e.split(`
|
|
2
2
|
`).filter(e=>!e.startsWith(`//#region `)&&e!==`//#endregion`).join(`
|
|
3
3
|
`)}async function loadBundledAuthoredModule(e,t){let n=await bundleAuthoredModuleCode(e,t),r=normalizeExternalDependencies(t.externalDependencies),i=createHash(`sha1`).update(e).update(`\0`).update(r.join(`\0`)).update(`\0`).update(t.extension?.mountId??``).update(`\0`).update(n).digest(`hex`),a=join(resolveAuthoredPackageRoot(e),AUTHORED_MODULE_BUNDLE_DIRECTORY_PATH),o=join(a,`${i}.mjs`);existsSync(o)||(mkdirSync(a,{recursive:!0}),writeFileSync(o,n));try{let e=t.extension?.evaluationId??``;return await import(`${createFileImportSpecifier(o)}?v=${i}&instance=${encodeURIComponent(e)}`)}catch(t){throw createAuthoredModuleEvaluationError(e,t)}}function createInFlightModuleLoadKey(e,t){return`${e}\0${normalizeExternalDependencies(t.externalDependencies).join(`\0`)}\0${t.extension?.mountId??``}\0${t.extension?.evaluationId??``}`}function resolveAuthoredTsConfigPath(e){for(let t of[`tsconfig.json`,`jsconfig.json`]){let n=join(e,t);if(existsSync(n))return n}return!1}function resolveAuthoredPackageRoot(e){let t=dirname(e);for(;;){if(existsSync(join(t,`package.json`)))return realpathSync(t);let n=dirname(t);if(n===t)throw Error(`Failed to resolve the authored package root for "${e}".`);t=n}}export{bundleAuthoredModuleCode,bundleAuthoredModuleForGeneration,bundleAuthoredModuleMapForGeneration,bundleExtensionDistributionGraph,loadAuthoredModuleNamespace,resolveAuthoredPackageRoot,resolveAuthoredTsConfigPath};
|
|
@@ -17,7 +17,7 @@ export declare function createGenerationPackageBoundaryPlugin(input: {
|
|
|
17
17
|
export declare function createRuntimeLoaderPackageBoundaryPlugin(input: {
|
|
18
18
|
readonly externalDependencies: readonly string[];
|
|
19
19
|
readonly packageRoot: string;
|
|
20
|
-
readonly
|
|
20
|
+
readonly extensionSpecifiers?: ReadonlySet<string>;
|
|
21
21
|
}): Record<string, unknown>;
|
|
22
22
|
/**
|
|
23
23
|
* Keeps package imports external in an extension distribution while enforcing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire,isBuiltin}from"node:module";import{resolvePackageDependencyPath,resolvePackageRoot,resolveWorkflowModulePath}from"#internal/application/package.js";import{existsSync,readFileSync,realpathSync}from"node:fs";import{dirname,join,resolve,sep}from"node:path";import{normalizeEsmImportSpecifier}from"#internal/application/import-specifier.js";const RESOLVE_EXTENSIONS=[`.ts`,`.tsx`,`.mts`,`.cts`,`.js`,`.jsx`,`.mjs`,`.cjs`,`.json`];function createGenerationPackageBoundaryPlugin(e){return{name:`eve-generation-package-boundary`,async resolveId(t,n,r){if(!isPackageImport(t)||e.extensionSpecifiers?.has(t))return;if(isFrameworkRuntimeImport(t,n))return e.extensionSpecifiers?.has(t)?void 0:{external:!0,id:resolveFrameworkRuntimeImport(t)};if(t.startsWith(`#`)){let r=resolvePackageImport(t,n,e.packageRoot);if(r!==void 0)return{id:r}}let i=await resolveConfiguredExternalModule.call(this,{externalDependencies:e.externalDependencies,importer:n,kind:r.kind,packageRoot:e.packageRoot,source:t});if(i!==void 0)return{external:!0,id:e.resolveExternalPaths?normalizeEsmImportSpecifier(i.resolvedId):t}}}}function createRuntimeLoaderPackageBoundaryPlugin(e){let t=toCanonicalPath(e.packageRoot);return{name:`eve-runtime-loader-package-boundary`,async resolveId(n,r,i){if(!isPackageImport(n)||
|
|
1
|
+
import{createRequire,isBuiltin}from"node:module";import{resolvePackageDependencyPath,resolvePackageRoot,resolveWorkflowModulePath}from"#internal/application/package.js";import{existsSync,readFileSync,realpathSync}from"node:fs";import{dirname,join,resolve,sep}from"node:path";import{normalizeEsmImportSpecifier}from"#internal/application/import-specifier.js";const RESOLVE_EXTENSIONS=[`.ts`,`.tsx`,`.mts`,`.cts`,`.js`,`.jsx`,`.mjs`,`.cjs`,`.json`];function createGenerationPackageBoundaryPlugin(e){return{name:`eve-generation-package-boundary`,async resolveId(t,n,r){if(!isPackageImport(t)||e.extensionSpecifiers?.has(t))return;if(isFrameworkRuntimeImport(t,n))return e.extensionSpecifiers?.has(t)?void 0:{external:!0,id:resolveFrameworkRuntimeImport(t)};if(t.startsWith(`#`)){let r=resolvePackageImport(t,n,e.packageRoot);if(r!==void 0)return{id:r}}let i=await resolveConfiguredExternalModule.call(this,{externalDependencies:e.externalDependencies,importer:n,kind:r.kind,packageRoot:e.packageRoot,source:t});if(i!==void 0)return{external:!0,id:e.resolveExternalPaths?normalizeEsmImportSpecifier(i.resolvedId):t}}}}function createRuntimeLoaderPackageBoundaryPlugin(e){let t=toCanonicalPath(e.packageRoot);return{name:`eve-runtime-loader-package-boundary`,async resolveId(n,r,i){if(!isPackageImport(n)||e.extensionSpecifiers?.has(n)===!0)return;if(isFrameworkRuntimeImport(n,r))return{external:!0,id:resolveRuntimeLoaderFrameworkImport(n)};if(n.startsWith(`#`)){let t=resolvePackageImport(n,r,e.packageRoot);if(t!==void 0)return isFrameworkPackagePath(t)?{external:!0,id:normalizeEsmImportSpecifier(t)}:{id:t}}let a=await resolveConfiguredExternalModule.call(this,{externalDependencies:e.externalDependencies,importer:r,kind:i.kind,packageRoot:e.packageRoot,source:n});if(a!==void 0){let e=resolveExistingExternalFilePath(a.resolvedId)??a.resolvedId;return{external:!0,id:normalizeEsmImportSpecifier(e)}}let o=r===void 0||r.startsWith(`\0`)?void 0:resolve(r);if(o!==void 0&&isPathInsideOrEqual(toCanonicalPath(o),t)){let e=await this.resolve(n,r,{kind:i.kind,skipSelf:!0});if(e===null||typeof e.id!=`string`)throw Error(`Cannot resolve package "${n}" imported from "${o}". Install it with your package manager (e.g. \`pnpm install\`); a running \`eve dev\` retries on the next rebuild.`);if(isNodeModulesPath(e.id))return{external:!0,id:n}}}}}function createDistributionPackageBoundaryPlugin(e){let t=new Set(e.runtimeDependencies);return{name:`eve-extension-distribution-package-boundary`,async resolveId(n,r,i){if(!isPackageImport(n))return;if(n.startsWith(`#`)){let a=await this.resolve(n,r,{kind:i.kind,skipSelf:!0});if(a!==null&&typeof a.id==`string`&&!isPathInsideOrEqual(toCanonicalPath(a.id),toCanonicalPath(e.packageRoot))){let e=nearestPackageName(a.id);if(e!==void 0&&!t.has(e))throw Error(`Package import "${n}" resolves to undeclared package "${e}". Add "${e}" to dependencies, optionalDependencies, or peerDependencies.`)}return}if(isBuiltin(n))return{external:!0,id:n};let a=packageImportName(n);if(!t.has(a))throw Error(`Package "${n}" is not declared by the extension. Add "${a}" to dependencies, optionalDependencies, or peerDependencies.`);let o=await this.resolve(n,r,{kind:i.kind,skipSelf:!0});if(o===null&&(o=await this.resolve(n,join(e.packageRoot,`package.json`),{kind:i.kind,skipSelf:!0})),o===null||typeof o.id!=`string`)throw Error(`Cannot resolve declared package "${n}". Install the extension's dependencies before building.`);return{external:!0,id:n}}}}async function resolveConfiguredExternalModule(e){let t=resolveConfiguredExternalDependency(e.source,e.externalDependencies);if(t===void 0)return;let n=await this.resolve(e.source,e.importer,{kind:e.kind,skipSelf:!0});if(n===null&&(n=await this.resolve(e.source,join(e.packageRoot,`package.json`),{kind:e.kind,skipSelf:!0})),n===null||typeof n.id!=`string`)throw Error(`Cannot resolve external package "${e.source}".`);return{packageName:t,resolvedId:n.id}}function normalizeExternalDependencies(e=[]){return[...new Set(e)].sort()}function resolveConfiguredExternalDependency(e,t){return t.find(t=>e===t||e.startsWith(`${t}/`))}function packageImportName(e){return e.startsWith(`@`)?e.split(`/`,2).join(`/`):e.split(`/`,1)[0]}function nearestPackageName(e){let t=nearestPackageRoot(e);if(t!==void 0)try{let e=JSON.parse(readFileSync(join(t,`package.json`),`utf8`));return typeof e.name==`string`&&e.name.length>0?e.name:void 0}catch{return}}function nearestPackageRoot(e){let t=dirname(toCanonicalPath(e));for(;;){if(existsSync(join(t,`package.json`)))return t;let e=dirname(t);if(e===t)return;t=e}}function resolvePackageImport(e,t,n){let r=t===void 0||t.startsWith(`\0`)?n:nearestPackageRoot(t)??n;try{let t=createRequire(join(r,`package.json`)).resolve(e);return isPathInsideOrEqual(toCanonicalPath(t),toCanonicalPath(r))?t:void 0}catch{return}}let canonicalFrameworkPackageRoot;function isFrameworkPackagePath(e){return canonicalFrameworkPackageRoot??=toCanonicalPath(resolvePackageRoot()),nearestPackageRoot(e)===canonicalFrameworkPackageRoot}function resolveExistingExternalFilePath(e){if(existsSync(e))return e;for(let t of RESOLVE_EXTENSIONS){let n=`${e}${t}`;if(existsSync(n))return n}}function isPackageImport(e){return isPathImport(e)||/^(?:node|data|file):/.test(e)?!1:!e.startsWith(`@/`)}function isPathImport(e){return e.startsWith(`.`)||e.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(e)}function isFrameworkRuntimeImport(e,t){return e===`eve/self-modification`?!1:e===`eve`||e.startsWith(`eve/`)?!0:e===`workflow`||e.startsWith(`workflow/`)||e.startsWith(`@workflow/`)?t===void 0||!isNodeModulesPath(t):!1}function resolveFrameworkRuntimeImport(e){return e===`eve`||e.startsWith(`eve/`)?e:normalizeEsmImportSpecifier(resolveWorkflowModulePath(e))}function resolveRuntimeLoaderFrameworkImport(e){return e===`eve`||e.startsWith(`eve/`)?normalizeEsmImportSpecifier(resolvePackageDependencyPath(e)):resolveFrameworkRuntimeImport(e)}function isNodeModulesPath(e){return e.replaceAll(`\\`,`/`).includes(`/node_modules/`)}function toCanonicalPath(e){try{return realpathSync(e)}catch{return resolve(e)}}function isPathInsideOrEqual(e,t){let n=resolve(e),r=resolve(t);return n===r||n.startsWith(`${r}${sep}`)}export{RESOLVE_EXTENSIONS,createDistributionPackageBoundaryPlugin,createGenerationPackageBoundaryPlugin,createRuntimeLoaderPackageBoundaryPlugin,isNodeModulesPath,isPathImport,normalizeExternalDependencies};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFileSync,realpathSync}from"node:fs";import{resolve,sep}from"node:path";const MOUNT_QUERY=`?eve-mount=`;function canonicalize(e){try{return realpathSync(e)}catch{return resolve(e)}}function within(e,t){return e===t||e.startsWith(`${t}${sep}`)}function createExtensionMountPlugin(e,t=new Map){if(e.length===0)return null;let n=new Map,canonical=e=>{let t=n.get(e);return t===void 0&&(t=canonicalize(e),n.set(e,t)),t},r=e.map(e=>({...e,root:canonical(e.sourceRoot)})),i=new Map(r
|
|
1
|
+
import{readFileSync,realpathSync}from"node:fs";import{resolve,sep}from"node:path";const MOUNT_QUERY=`?eve-mount=`;function canonicalize(e){try{return realpathSync(e)}catch{return resolve(e)}}function within(e,t){return e===t||e.startsWith(`${t}${sep}`)}function createExtensionMountPlugin(e,t=new Map){if(e.length===0)return null;let n=new Map,canonical=e=>{let t=n.get(e);return t===void 0&&(t=canonicalize(e),n.set(e,t)),t},r=e.map(e=>({...e,root:canonical(e.sourceRoot)})),i=new Map;for(let e of r){if(e.mountSourcePath===void 0)continue;let t=canonical(resolve(e.mountSourcePath));i.set(t,[...i.get(t)??[],e])}let a=new Map(r.map(e=>[e.mountId,e])),o=new Map([...t].map(([e,t])=>[canonical(e),a.get(t)]));return{name:`eve-extension-mount`,async resolveId(e,t){if(e===`eve/context`)return;let n=e.indexOf(MOUNT_QUERY),s=n>=0?decodeURIComponent(e.slice(n+11)):void 0,c=t?.indexOf(MOUNT_QUERY)??-1,l=c>=0?decodeURIComponent(t.slice(c+11)):void 0,u=n>=0?e.slice(0,n):e,d=c>=0?t.slice(0,c):t,f=d===void 0?void 0:canonical(d),p=f===void 0?[]:i.get(f)??[],m=p.length===1?p[0]:p.find(e=>l!==void 0&&e.mountId.startsWith(`${l}/`)),h=m!==void 0&&(u===m.specifier||u===m.programmaticImport?.specifier)?m:void 0,g=f===void 0?void 0:o.get(f),_=s??h?.mountId??l??m?.mountId??g?.mountId,v=_===void 0?void 0:a.get(_);if(_!==void 0&&v===void 0)throw Error(`Unknown extension mount "${_}".`);let y=v!==void 0&&f!==void 0&&!within(f,v.root)&&o.get(f)===v,b=v!==void 0&&(u===v.specifier||u===v.programmaticImport?.specifier)?v:void 0,x=await this.resolve(b?.programmaticImport?.entryPath??u,d,{skipSelf:!0,kind:`import-statement`});if(x===null||x.id.startsWith(`\0`))return x;if(x.external){if(b===void 0)return x;throw Error(`Extension export "${u}" for mount "${_}" was externalized; it must be bundled to isolate its configuration.`)}if(!/\.(?:[cm]?[jt]sx?|json)$/.test(x.id))return x;let S=canonical(x.id);if(v!==void 0&&(b!==void 0||!y&&within(S,v.root)))return{id:`${x.id}${MOUNT_QUERY}${encodeURIComponent(_)}`};if(y)return x;if(v===void 0&&(t===void 0||t.startsWith(`\0`)))return;let C=r.filter(e=>within(S,e.root));if(v!==void 0){let e=C.filter(e=>v.mountId.startsWith(`${e.mountId}/`)).sort((e,t)=>t.mountId.length-e.mountId.length)[0]??(C.length===1?C[0]:void 0);return e===void 0?x:{id:`${x.id}${MOUNT_QUERY}${encodeURIComponent(e.mountId)}`}}if(C.length>1)throw Error(`Import "${e}" from "${t}" refers to multiple extension mounts (${C.map(e=>e.mountId).join(`, `)}). Import it from an owned mount or contribution instead.`);return C.length===1?{id:`${x.id}${MOUNT_QUERY}${encodeURIComponent(C[0].mountId)}`}:void 0},load(e){let t=e.indexOf(MOUNT_QUERY);if(t<0)return;let n=e.slice(0,t);if(!/\.(?:[cm]?[jt]sx?|json)$/.test(n))return;let r=n.slice(n.lastIndexOf(`.`)+1),i=r===`json`?`json`:r===`tsx`?`tsx`:r===`jsx`?`jsx`:[`ts`,`mts`,`cts`].includes(r)?`ts`:`js`;return{code:readFileSync(n,`utf8`),moduleType:i}}}}export{createExtensionMountPlugin};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{createHash}from"node:crypto";import{parseWithNitroRolldownAst}from"#internal/bundler/nitro-rolldown.js";import{findProperty,
|
|
1
|
+
import{createHash}from"node:crypto";import{parseWithNitroRolldownAst}from"#internal/bundler/nitro-rolldown.js";import{collectFreeVariables,findEveImportAliases,findProperty,walkDefinerCalls}from"#internal/workflow-bundle/dynamic-tool-ast-references.js";import{stableModuleId}from"#internal/workflow-bundle/stable-module-id.js";async function transformDynamicRemoteAgentCredentials(e,t){if(!t.includes(`defineDynamic`)||!t.includes(`defineRemoteAgent`)||!t.includes(`auth`)&&!t.includes(`headers`))return null;let n=findCredentialsFactories(e,t,await parseWithNitroRolldownAst(e,t));return n.length===0?null:applyTransform(t,n)}function findCredentialsFactories(e,t,n){let r=[],i=stableModuleId(e),a=new Set([`defineRemoteAgent`,...findEveImportAliases(n,[`defineRemoteAgent`])]);return walkDefinerCalls(n,a,(n,a,o)=>{let s=findProperty(a,`auth`),c=findProperty(a,`headers`);if(s===void 0&&c===void 0||n.start===void 0||n.end===void 0)return;assertModuleScoped(e,[s,c],o);let l=t.slice(n.start,n.end),u=createHash(`sha256`).update(`${i}//${l}`).digest(`hex`).slice(0,16);r.push({authPropertySource:sliceNode(t,s),callEnd:n.end,callSource:l,callStart:n.start,headersPropertySource:sliceNode(t,c),hoistedName:`__eve_dynamic_remote_credentials_${u}`})}),r}function assertModuleScoped(e,t,n){for(let r of t){let t=r?.value;if(t===void 0)continue;let i=[...collectFreeVariables(t)].filter(e=>n.has(e));if(i.length>0){let t=String(r.key?.name??r.key?.value),n=i.map(e=>`"${e}"`).join(`, `);throw Error(`Dynamic remote agent "${t}" in ${e} references ${n}, declared outside module scope. eve moves dynamic remote auth and headers to module scope so credentials stay out of durable workflow state. Declare ${n} at module scope or inside "${t}" itself.`)}}}function applyTransform(e,t){let n=[],r=[],i=[],a=new Set;for(let e of t){let t=[e.authPropertySource,e.headersPropertySource].filter(e=>e!==void 0),o=`eve:dynamic-remote-agent//${e.hoistedName}`;a.has(e.hoistedName)||(a.add(e.hoistedName),r.push(`function ${e.hoistedName}() {\n return { ${t.join(`, `)} };\n}`),i.push(`${e.hoistedName}.stepId = ${JSON.stringify(o)};`),i.push(`__eveStepRegistry.set(${JSON.stringify(o)}, ${e.hoistedName});`)),n.push({start:e.callStart,end:e.callEnd,text:`Object.defineProperty(${e.callSource}, "__eveResolveRemoteAgentCredentials", { value: ${e.hoistedName} })`})}let o=e;for(let e of n.sort((e,t)=>t.start-e.start))o=o.slice(0,e.start)+e.text+o.slice(e.end);return{code:`${[`var __eveStepRegistrySym = Symbol.for("@workflow/core//registeredSteps");`,`if (!globalThis[__eveStepRegistrySym]) globalThis[__eveStepRegistrySym] = new Map();`,`var __eveStepRegistry = globalThis[__eveStepRegistrySym];`].join(`
|
|
2
2
|
`)}\n${o}\n\n${[...r,...i].join(`
|
|
3
3
|
`)}\n`}}function sliceNode(e,t){return t?.start===void 0||t.end===void 0?void 0:e.slice(t.start,t.end)}export{transformDynamicRemoteAgentCredentials};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Rolldown AST subset consumed by the dynamic
|
|
1
|
+
/** Rolldown AST subset consumed by the dynamic tool and remote agent transforms. */
|
|
2
2
|
export type DynamicToolAstNode = {
|
|
3
3
|
argument?: DynamicToolAstNode | null;
|
|
4
4
|
arguments?: DynamicToolAstNode[];
|
|
@@ -10,7 +10,9 @@ export type DynamicToolAstNode = {
|
|
|
10
10
|
end?: number;
|
|
11
11
|
};
|
|
12
12
|
callee?: DynamicToolAstNode;
|
|
13
|
+
cases?: DynamicToolAstNode[];
|
|
13
14
|
computed?: boolean;
|
|
15
|
+
consequent?: DynamicToolAstNode | DynamicToolAstNode[] | null;
|
|
14
16
|
declaration?: DynamicToolAstNode | null;
|
|
15
17
|
declarations?: DynamicToolAstNode[];
|
|
16
18
|
directive?: string;
|
|
@@ -36,6 +38,7 @@ export type DynamicToolAstNode = {
|
|
|
36
38
|
method?: boolean;
|
|
37
39
|
name?: string;
|
|
38
40
|
object?: DynamicToolAstNode | null;
|
|
41
|
+
param?: DynamicToolAstNode | null;
|
|
39
42
|
params?: DynamicToolAstNode[];
|
|
40
43
|
properties?: DynamicToolAstNode[];
|
|
41
44
|
property?: DynamicToolAstNode | null;
|
|
@@ -49,9 +52,32 @@ export type DynamicToolAstNode = {
|
|
|
49
52
|
value?: DynamicToolAstNode | unknown;
|
|
50
53
|
elements?: Array<DynamicToolAstNode | null>;
|
|
51
54
|
};
|
|
55
|
+
type AstNode = DynamicToolAstNode;
|
|
52
56
|
export declare function findProperty(object: DynamicToolAstNode, name: string): DynamicToolAstNode | undefined;
|
|
53
57
|
export declare function walkNode(node: DynamicToolAstNode, visitor: (node: DynamicToolAstNode) => boolean): void;
|
|
54
58
|
/**
|
|
55
59
|
* Collects identifiers used as runtime references in a function body AST.
|
|
56
60
|
*/
|
|
57
61
|
export declare function collectReferencedIdentifierNames(node: DynamicToolAstNode): Set<string>;
|
|
62
|
+
export declare function isAstNode(value: unknown): value is DynamicToolAstNode;
|
|
63
|
+
/**
|
|
64
|
+
* Local names (`alias` or `namespace.name`) that refer to the given exports of
|
|
65
|
+
* an `eve` or `eve/*` import.
|
|
66
|
+
*/
|
|
67
|
+
export declare function findEveImportAliases(ast: AstNode, names: readonly string[]): ReadonlySet<string>;
|
|
68
|
+
export declare function readDefinerName(callee: AstNode | undefined): string | undefined;
|
|
69
|
+
export declare function collectPatternNames(pattern: AstNode | null, names: string[]): void;
|
|
70
|
+
export declare function extractParamNames(fn: AstNode): string[];
|
|
71
|
+
export declare function isFunction(node: AstNode): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Visits each call to one of `definers` that takes a single object literal,
|
|
74
|
+
* with the names bound by its enclosing function, block, catch, loop, and class
|
|
75
|
+
* scopes. Module-scope bindings are excluded.
|
|
76
|
+
*/
|
|
77
|
+
export declare function walkDefinerCalls(ast: AstNode, definers: ReadonlySet<string>, visit: (call: AstNode, argument: AstNode, enclosingBindings: ReadonlySet<string>) => void): void;
|
|
78
|
+
/**
|
|
79
|
+
* Names `node` references at runtime without binding them in a scope that
|
|
80
|
+
* encloses the reference.
|
|
81
|
+
*/
|
|
82
|
+
export declare function collectFreeVariables(node: AstNode): Set<string>;
|
|
83
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function findProperty(e,t){return e.properties?.find(e=>e.type===`Property`&&!e.computed&&(e.key?.type===`Identifier`?e.key.name===t:e.key?.value===t))}function walkNode(e,t){if(t(e))for(let n of Object.values(e))if(Array.isArray(n))for(let e of n)isAstNode(e)&&walkNode(e,t);else isAstNode(n)&&walkNode(n,t)}function collectReferencedIdentifierNames(e){let t=new Set,visit=(e,n)=>{if(e.type?.startsWith(`TS`)){isRuntimeTypeScriptExpression(e)&&e.expression&&visit(e.expression,`reference`);return}e.type===`Identifier`&&e.name&&n===`reference`&&t.add(e.name);for(let[t,r]of Object.entries(e)){let i=getChildContext(e,t,n);if(i){if(Array.isArray(r))for(let e of r)isAstNode(e)&&visit(e,i);else isAstNode(r)&&visit(r,i)}}};return visit(e,`reference`),t}function getChildContext(e,t,n){return t===`typeAnnotation`||t===`returnType`||t===`typeParameters`||t===`typeArguments`?null:e.type===`VariableDeclarator`&&t===`id`||(e.type===`FunctionExpression`||e.type===`ArrowFunctionExpression`||e.type===`FunctionDeclaration`)&&(t===`id`||t===`params`)||e.type===`CatchClause`&&t===`param`||(e.type===`ClassDeclaration`||e.type===`ClassExpression`)&&t===`id`?`binding`:e.type===`Property`&&t===`key`?e.computed===!0?`reference`:null:e.type===`Property`&&t===`value`?n:e.type===`AssignmentPattern`?t===`right`?`reference`:n:(e.type===`ObjectPattern`||e.type===`ArrayPattern`||e.type===`RestElement`)&&(t===`properties`||t===`elements`||t===`argument`)?n:(e.type===`MemberExpression`||e.type===`OptionalMemberExpression`)&&t===`property`||(e.type===`MethodDefinition`||e.type===`PropertyDefinition`)&&t===`key`?e.computed===!0?`reference`:null:(e.type===`LabeledStatement`||e.type===`BreakStatement`||e.type===`ContinueStatement`)&&t===`label`?null:`reference`}function isRuntimeTypeScriptExpression(e){return e.type===`TSAsExpression`||e.type===`TSInstantiationExpression`||e.type===`TSNonNullExpression`||e.type===`TSSatisfiesExpression`||e.type===`TSTypeAssertion`}function isAstNode(e){return typeof e==`object`&&!!e&&typeof e.type==`string`}export{collectReferencedIdentifierNames,findProperty,walkNode};
|
|
1
|
+
function findProperty(e,t){return e.properties?.find(e=>e.type===`Property`&&!e.computed&&(e.key?.type===`Identifier`?e.key.name===t:e.key?.value===t))}function walkNode(e,t){if(t(e))for(let n of Object.values(e))if(Array.isArray(n))for(let e of n)isAstNode(e)&&walkNode(e,t);else isAstNode(n)&&walkNode(n,t)}function collectReferencedIdentifierNames(e){let t=new Set,visit=(e,n)=>{if(e.type?.startsWith(`TS`)){isRuntimeTypeScriptExpression(e)&&e.expression&&visit(e.expression,`reference`);return}e.type===`Identifier`&&e.name&&n===`reference`&&t.add(e.name);for(let[t,r]of Object.entries(e)){let i=getChildContext(e,t,n);if(i){if(Array.isArray(r))for(let e of r)isAstNode(e)&&visit(e,i);else isAstNode(r)&&visit(r,i)}}};return visit(e,`reference`),t}function getChildContext(e,t,n){return t===`typeAnnotation`||t===`returnType`||t===`typeParameters`||t===`typeArguments`?null:e.type===`VariableDeclarator`&&t===`id`||(e.type===`FunctionExpression`||e.type===`ArrowFunctionExpression`||e.type===`FunctionDeclaration`)&&(t===`id`||t===`params`)||e.type===`CatchClause`&&t===`param`||(e.type===`ClassDeclaration`||e.type===`ClassExpression`)&&t===`id`?`binding`:e.type===`Property`&&t===`key`?e.computed===!0?`reference`:null:e.type===`Property`&&t===`value`?n:e.type===`AssignmentPattern`?t===`right`?`reference`:n:(e.type===`ObjectPattern`||e.type===`ArrayPattern`||e.type===`RestElement`)&&(t===`properties`||t===`elements`||t===`argument`)?n:(e.type===`MemberExpression`||e.type===`OptionalMemberExpression`)&&t===`property`||(e.type===`MethodDefinition`||e.type===`PropertyDefinition`)&&t===`key`?e.computed===!0?`reference`:null:(e.type===`LabeledStatement`||e.type===`BreakStatement`||e.type===`ContinueStatement`)&&t===`label`?null:`reference`}function isRuntimeTypeScriptExpression(e){return e.type===`TSAsExpression`||e.type===`TSInstantiationExpression`||e.type===`TSNonNullExpression`||e.type===`TSSatisfiesExpression`||e.type===`TSTypeAssertion`}function isAstNode(e){return typeof e==`object`&&!!e&&typeof e.type==`string`}function findEveImportAliases(e,t){let n=new Set;return walkNode(e,e=>{if(e.type!==`ImportDeclaration`)return!0;let r=e.source?.value;if(typeof r!=`string`||r!==`eve`&&!r.startsWith(`eve/`))return!1;for(let r of e.specifiers??[]){if(r.type===`ImportNamespaceSpecifier`&&r.local?.name)for(let e of t)n.add(`${r.local.name}.${e}`);r.type===`ImportSpecifier`&&t.includes(String(r.imported?.name??r.imported?.value))&&r.local?.name&&n.add(r.local.name)}return!1}),n}function readDefinerName(e){if(e?.type===`Identifier`)return e.name;if(e?.type!==`MemberExpression`||e.object?.type!==`Identifier`)return;let t=e.computed?e.property?.value:e.property?.name;return typeof t==`string`?`${e.object.name}.${t}`:void 0}function collectPatternNames(e,t){if(e){if(e.type===`Identifier`&&e.name){t.push(e.name);return}if(e.type===`ObjectPattern`)for(let n of e.properties??[])collectPatternNames(n.type===`RestElement`?n.argument:n.value,t);if(e.type===`ArrayPattern`)for(let n of e.elements??[])collectPatternNames(n,t);e.type===`AssignmentPattern`&&collectPatternNames(e.left,t)}}function extractParamNames(e){let t=[];for(let n of e.params??[])collectPatternNames(n,t);return t}function isFunction(e){return e.type===`ArrowFunctionExpression`||e.type===`FunctionDeclaration`||e.type===`FunctionExpression`}function walkDefinerCalls(e,t,n){let walk=(e,r)=>{let i=e.arguments?.[0];if(e.type===`CallExpression`&&t.has(readDefinerName(e.callee)??``)&&e.arguments?.length===1&&i?.type===`ObjectExpression`){n(e,i,r);return}let a=e.type===`Program`?r:withScopeBindings(e,r);for(let t of Object.values(e))for(let e of Array.isArray(t)?t:[t])isAstNode(e)&&walk(e,a)};walk(e,new Set)}function collectFreeVariables(e){let t=new Set,visit=(e,n,r)=>{if(e.type?.startsWith(`TS`)){isRuntimeTypeScriptExpression(e)&&e.expression&&visit(e.expression,`reference`,r);return}e.type===`Identifier`&&e.name&&n===`reference`&&!r.has(e.name)&&t.add(e.name);let i=withScopeBindings(e,r);for(let[t,r]of Object.entries(e)){let a=getChildContext(e,t,n);if(a)for(let e of Array.isArray(r)?r:[r])isAstNode(e)&&visit(e,a,i)}};return visit(e,`reference`,new Set),t}function withScopeBindings(e,t){let n=scopeBindings(e);return n.length===0?t:new Set([...t,...n])}function scopeBindings(e){let t=[];if(isFunction(e)){e.type===`FunctionExpression`&&e.id?.name&&t.push(e.id.name);for(let n of e.params??[])collectPatternNames(n,t);isAstNode(e.body)&&collectVarNames(e.body,t)}else if(e.type===`BlockStatement`||e.type===`StaticBlock`)collectLexicalNames(e.body,t);else if(e.type===`SwitchStatement`)for(let n of e.cases??[])collectLexicalNames(n.consequent,t);else if(e.type===`ForStatement`||e.type===`ForInStatement`||e.type===`ForOfStatement`){let n=e.type===`ForStatement`?e.init:e.left;if(n?.type===`VariableDeclaration`&&n.kind!==`var`)for(let e of n.declarations??[])collectPatternNames(e.id,t)}else e.type===`CatchClause`?collectPatternNames(e.param??null,t):e.type===`ClassExpression`&&e.id?.name&&t.push(e.id.name);return t}function collectVarNames(e,t){walkNode(e,e=>{if(isFunction(e))return!1;if(e.type===`VariableDeclaration`&&e.kind===`var`)for(let n of e.declarations??[])collectPatternNames(n.id,t);return!0})}function collectLexicalNames(e,t){if(Array.isArray(e))for(let n of e)if(n.type===`VariableDeclaration`&&n.kind!==`var`)for(let e of n.declarations??[])collectPatternNames(e.id,t);else(n.type===`FunctionDeclaration`||n.type===`ClassDeclaration`||n.type===`TSEnumDeclaration`)&&n.id?.name&&t.push(n.id.name)}export{collectFreeVariables,collectPatternNames,collectReferencedIdentifierNames,extractParamNames,findEveImportAliases,findProperty,isAstNode,isFunction,readDefinerName,walkDefinerCalls,walkNode};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{parseWithNitroRolldownAst}from"#internal/bundler/nitro-rolldown.js";import{collectReferencedIdentifierNames,findProperty,walkNode}from"#internal/workflow-bundle/dynamic-tool-ast-references.js";async function transformDynamicToolExecute(e,t,n=NO_WORKFLOW_FUNCTIONS){if(!t.includes(`defineTool`)&&!t.includes(`defineWorkflowTool`))return null;let r=await parseWithNitroRolldownAst(e,t),i=
|
|
1
|
+
import{parseWithNitroRolldownAst}from"#internal/bundler/nitro-rolldown.js";import{collectPatternNames,collectReferencedIdentifierNames,extractParamNames,findEveImportAliases,findProperty,isAstNode,isFunction,readDefinerName,walkNode}from"#internal/workflow-bundle/dynamic-tool-ast-references.js";async function transformDynamicToolExecute(e,t,n=NO_WORKFLOW_FUNCTIONS){if(!t.includes(`defineTool`)&&!t.includes(`defineWorkflowTool`))return null;let r=await parseWithNitroRolldownAst(e,t),i=findEveImportAliases(r,[`defineTool`,`defineWorkflowTool`]);if(i.size===0)return null;let a=[];return walkForCallbacks(t,r,a,[],{defineToolAliases:i,workflowFunctions:n,durableSchemaAliases:findEveImportAliases(r,[`defineDurableSchema`])}),a.length===0?null:applyTransform(t,a)}const NO_WORKFLOW_FUNCTIONS=new Set;function walkForCallbacks(e,t,n,r,i){if(t){if(isFunction(t)){let a=t.body;if(!a)return;walkForCallbacks(e,a,n,[...r,{params:extractParamNames(t),vars:collectScopeVarDeclarations(a)}],i);return}if(t.type===`CallExpression`&&i.defineToolAliases.has(readDefinerName(t.callee)??``)&&t.arguments?.length===1&&t.arguments[0]?.type===`ObjectExpression`){collectToolCallbacks(e,t.arguments[0],n,r,i);return}for(let a of Object.values(t))if(Array.isArray(a))for(let t of a)isAstNode(t)&&walkForCallbacks(e,t,n,r,i);else isAstNode(a)&&walkForCallbacks(e,a,n,r,i)}}function isWorkflowExecute(e,t){let n=e?.value;return n?.type===`Identifier`&&n.name!==void 0&&t.workflowFunctions.has(n.name)}function collectToolCallbacks(e,t,n,r,i){let a=findProperty(t,`execute`);isWorkflowExecute(a,i)||collectCallbackProperty(e,a,`execute`,`execute`,n,r),collectCallbackProperty(e,findProperty(t,`approvalKey`),`approvalKey`,`approvalKey`,n,r);let o=findProperty(t,`label`)?.value;o?.type===`ObjectExpression`&&(collectCallbackProperty(e,findProperty(o,`start`),`labelStart`,`start`,n,r),collectCallbackProperty(e,findProperty(o,`complete`),`labelComplete`,`complete`,n,r),collectCallbackProperty(e,findProperty(o,`delta`),`labelDelta`,`delta`,n,r)),collectCallbackProperty(e,findProperty(t,`toModelOutput`),`toModelOutput`,`toModelOutput`,n,r);for(let a of[`inputSchema`,`outputSchema`]){let o=findProperty(t,a),s=o?.value;o?.start!==void 0&&o.end!==void 0&&s?.start!==void 0&&s.end!==void 0&&(s.type!==`ObjectExpression`||findProperty(s,`~standard`))&&(s.type!==`CallExpression`||s.callee?.name!==`__eveDefineDurableSchema`&&!i.durableSchemaAliases.has(readDefinerName(s.callee)??``))&&n.push({body:`{ return ${e.slice(s.start,s.end)}; }`,bodyNode:s,isAsync:!1,isGenerator:!1,isReference:!1,nestedScopes:r,params:``,phase:a,propertyName:a,propEnd:o.end,propStart:o.start})}let s=findProperty(t,`approval`),c=s?.value;c?.type===`ObjectExpression`?(collectCallbackProperty(e,findProperty(c,`request`),`approvalRequest`,`request`,n,r),collectCallbackProperty(e,findProperty(c,`response`),`approvalResponse`,`response`,n,r)):collectCallbackProperty(e,s,`approvalRequest`,`approval`,n,r)}function collectCallbackProperty(e,t,n,r,i,a){if(t?.type!==`Property`||t.start===void 0||t.end===void 0)return;let o=t.value;if(o&&o.start!==void 0&&o.end!==void 0){if(isFunction(o)||t.method===!0){let s=o.body;if(!s)return;i.push({body:extractFnBody(e,o),bodyNode:s,isAsync:o.async===!0,isGenerator:o.generator===!0,isReference:!1,nestedScopes:a,params:extractFnParams(e,o),phase:n,propertyName:r,propEnd:t.end,propStart:t.start});return}o.type===`Identifier`&&i.push({body:`{ return ${e.slice(o.start,o.end)}(...__args); }`,bodyNode:o,isAsync:!1,isGenerator:!1,isReference:!0,nestedScopes:a,params:`...__args`,phase:n,propertyName:r,propEnd:t.end,propStart:t.start})}}function applyTransform(e,t){let n=[],r=[];for(let[e,i]of t.entries()){let t=collectReferencedIdentifierNames(i.bodyNode),a=i.nestedScopes.flatMap(e=>[...e.params,...e.vars]),o=extractCallbackParamNames(i.params),s=dedupeShadowed(a).filter(e=>!o.has(e)&&t.has(e)),c=s.length>0?`{ ${s.join(`, `)} }`:`{}`,l=i.phase.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`),u=i.phase===`execute`?`__eve_dynamic_exec_${e}`:`__eve_dynamic_${l}_${e}`,d=i.params,f=d?`__vars, ${d}`:`__vars`,p=s.length>0?`const ${c} = __vars;\n `:``,m=i.body.slice(1,-1).trim(),h=i.isAsync?`async `:``,g=i.isGenerator?`*`:``;r.push(`${h}function${g} ${u}(${f}) {\n ${p}${m}\n}`);let _=createLiveWrapper(i,u,c),v=i.phase===`inputSchema`||i.phase===`outputSchema`?`__eveDefineDurableSchema({ schema: ${u}, closure: ${c} })`:`__eveStampDynamicCallback(${_}, ${u}, ${c})`;n.push({end:i.propEnd,start:i.propStart,text:`${i.propertyName}: ${v}`})}let i=e;for(let e of n.sort((e,t)=>t.start-e.start))i=i.slice(0,e.start)+e.text+i.slice(e.end);return{code:`${[...t.some(e=>e.phase===`inputSchema`||e.phase===`outputSchema`)?[`import { defineDurableSchema as __eveDefineDurableSchema } from "eve/tools";`]:[],`var __eveDurableCallbackSym = Symbol.for("eve:durable-dynamic-callback");`,`function __eveStampDynamicCallback(callback, impl, closure) {`,` Object.defineProperty(callback, __eveDurableCallbackSym, { configurable: true, value: { callback: impl, closure } });`,` return callback;`,`}`].join(`
|
|
2
2
|
`)}\n${i}\n\n${r.join(`
|
|
3
|
-
`)}\n`}}function createLiveWrapper(e,t,n){if(e.isReference)return`(...__args) => ${t}(${n}, ...__args)`;let r=e.isAsync?`async `:``;return e.isGenerator?`${r}function* (...__args) { yield* ${t}(${n}, ...__args); }`:`${r}(...__args) => ${e.isAsync?`await `:``}${t}(${n}, ...__args)`}function dedupeShadowed(e){let t=new Set,n=[];for(let r=e.length-1;r>=0;r--){let i=e[r];t.has(i)||(t.add(i),n.unshift(i))}return n}function collectScopeVarDeclarations(e){let t=[];return walkNode(e,n=>n!==e&&isFunction(n)?!1:(n.type===`VariableDeclarator`&&collectPatternNames(n.id,t),n.type===`FunctionDeclaration`&&n.id?.name&&t.push(n.id.name),!0)),t}function
|
|
3
|
+
`)}\n`}}function createLiveWrapper(e,t,n){if(e.isReference)return`(...__args) => ${t}(${n}, ...__args)`;let r=e.isAsync?`async `:``;return e.isGenerator?`${r}function* (...__args) { yield* ${t}(${n}, ...__args); }`:`${r}(...__args) => ${e.isAsync?`await `:``}${t}(${n}, ...__args)`}function dedupeShadowed(e){let t=new Set,n=[];for(let r=e.length-1;r>=0;r--){let i=e[r];t.has(i)||(t.add(i),n.unshift(i))}return n}function collectScopeVarDeclarations(e){let t=[];return walkNode(e,n=>n!==e&&isFunction(n)?!1:(n.type===`VariableDeclarator`&&collectPatternNames(n.id,t),n.type===`FunctionDeclaration`&&n.id?.name&&t.push(n.id.name),!0)),t}function extractFnParams(e,t){if(!t.params||t.params.length===0)return``;let n=t.params[0],r=t.params[t.params.length-1];return n.start===void 0||r.end===void 0?``:e.slice(n.start,r.end)}function extractFnBody(e,t){let n=t.body;if(!n||n.start===void 0||n.end===void 0)return`{}`;let r=e.slice(n.start,n.end);return t.type===`ArrowFunctionExpression`&&n.type!==`BlockStatement`?`{ return ${r}; }`:r}function splitParamsTopLevel(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`<`||a===`(`||a===`[`||a===`{`?n++:a===`>`||a===`)`||a===`]`||a===`}`?n--:a===`,`&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t}function extractParamBindingName(e){let t=e.trim(),n=0;for(let e=0;e<t.length;e++){let r=t[e];if(r===`<`||r===`(`||r===`[`||r===`{`)n++;else if(r===`>`||r===`)`||r===`]`||r===`}`)n--;else if(n===0&&(r===`:`||r===`=`))return t.slice(0,e).trim()}return t}function extractCallbackParamNames(e){let t=[];if(!e)return new Set;for(let n of splitParamsTopLevel(e)){let e=extractParamBindingName(n);e.startsWith(`...`)?t.push(e.slice(3)):t.push(e)}return new Set(t)}export{transformDynamicToolExecute};
|
|
@@ -3,6 +3,7 @@ import type { ConnectionAuthorizationChallenge } from "#connections/errors.js";
|
|
|
3
3
|
import type { RuntimeActionRequest, RuntimeActionResult, RuntimeToolResultActionResult } from "#shared/action-types.js";
|
|
4
4
|
import type { InputRequest, InputResponse } from "#shared/input.js";
|
|
5
5
|
import type { JsonObject, JsonValue } from "#shared/json.js";
|
|
6
|
+
import type { TokenUsage } from "#shared/token-usage.js";
|
|
6
7
|
export declare const EVE_SESSION_ID_HEADER = "x-eve-session-id";
|
|
7
8
|
export declare const EVE_STREAM_FORMAT_HEADER = "x-eve-stream-format";
|
|
8
9
|
export declare const EVE_STREAM_TAIL_INDEX_HEADER = "x-eve-stream-tail-index";
|
|
@@ -537,6 +538,8 @@ export interface TurnCompletedStreamEvent {
|
|
|
537
538
|
};
|
|
538
539
|
type: "turn.completed";
|
|
539
540
|
}
|
|
541
|
+
/** What an open turn waits on when it parks; see {@link TurnWaitingStreamEvent}. */
|
|
542
|
+
export type TurnWaitingOn = "input" | "tasks";
|
|
540
543
|
/**
|
|
541
544
|
* Stream event emitted each time an open turn parks, such as when a call it is
|
|
542
545
|
* running asks a question. The turn stays open: the next `step.started` with
|
|
@@ -545,8 +548,20 @@ export interface TurnCompletedStreamEvent {
|
|
|
545
548
|
*/
|
|
546
549
|
export interface TurnWaitingStreamEvent {
|
|
547
550
|
data: {
|
|
551
|
+
/**
|
|
552
|
+
* What the turn waits on. `"input"`: a person must act on a sign-in,
|
|
553
|
+
* approval, or question; clients stop reading here. `"tasks"`: work the
|
|
554
|
+
* turn started is still running, and the turn resumes on its own.
|
|
555
|
+
*/
|
|
556
|
+
on: TurnWaitingOn;
|
|
548
557
|
sequence: number;
|
|
549
558
|
turnId: string;
|
|
559
|
+
/**
|
|
560
|
+
* The session's token usage so far: its own model calls plus what the
|
|
561
|
+
* agents it delegated to spent. `costUsd` is absent when no model call
|
|
562
|
+
* reported a cost. Absent on events from eve versions before it was added.
|
|
563
|
+
*/
|
|
564
|
+
usage?: TokenUsage;
|
|
550
565
|
};
|
|
551
566
|
type: "turn.waiting";
|
|
552
567
|
}
|
|
@@ -692,6 +707,12 @@ export interface SessionWaitingStreamEvent {
|
|
|
692
707
|
data: {
|
|
693
708
|
/** Channel-local continuation token, or the immutable session ID for an ID-only session. */
|
|
694
709
|
continuationToken: string;
|
|
710
|
+
/**
|
|
711
|
+
* The session's token usage so far: its own model calls plus what the
|
|
712
|
+
* agents it delegated to spent. `costUsd` is absent when no model call
|
|
713
|
+
* reported a cost. Absent on events from eve versions before it was added.
|
|
714
|
+
*/
|
|
715
|
+
usage?: TokenUsage;
|
|
695
716
|
wait: "next-user-message";
|
|
696
717
|
};
|
|
697
718
|
type: "session.waiting";
|
|
@@ -705,6 +726,12 @@ export interface SessionFailedStreamEvent {
|
|
|
705
726
|
details?: JsonObject;
|
|
706
727
|
message: string;
|
|
707
728
|
sessionId: string;
|
|
729
|
+
/**
|
|
730
|
+
* The session's token usage so far: its own model calls plus what the
|
|
731
|
+
* agents it delegated to spent. `costUsd` is absent when no model call
|
|
732
|
+
* reported a cost. Absent on events from eve versions before it was added.
|
|
733
|
+
*/
|
|
734
|
+
usage?: TokenUsage;
|
|
708
735
|
};
|
|
709
736
|
type: "session.failed";
|
|
710
737
|
}
|
|
@@ -712,6 +739,14 @@ export interface SessionFailedStreamEvent {
|
|
|
712
739
|
* Stream event emitted when the session completes successfully.
|
|
713
740
|
*/
|
|
714
741
|
export interface SessionCompletedStreamEvent {
|
|
742
|
+
/** Absent when the session's usage was unknown, and on events from eve versions before it was added. */
|
|
743
|
+
data?: {
|
|
744
|
+
/**
|
|
745
|
+
* The session's token usage: its own model calls plus what the agents it
|
|
746
|
+
* delegated to spent. `costUsd` is absent when no model call reported a cost.
|
|
747
|
+
*/
|
|
748
|
+
usage: TokenUsage;
|
|
749
|
+
};
|
|
715
750
|
type: "session.completed";
|
|
716
751
|
}
|
|
717
752
|
/**
|
|
@@ -885,7 +920,7 @@ export declare function createActionPartialEvent(input: {
|
|
|
885
920
|
/** Creates the `task.started` event for one call that starts a task. */
|
|
886
921
|
export declare function createTaskStartedEvent(input: TaskStartedStreamEvent["data"]): TaskStartedStreamEvent;
|
|
887
922
|
/** Creates the `task.settled` event for one settled task call. */
|
|
888
|
-
export declare function createTaskSettledEvent(input: TaskSettledStreamEvent["data"]
|
|
923
|
+
export declare function createTaskSettledEvent(input: TaskSettledStreamEvent["data"]): TaskSettledStreamEvent;
|
|
889
924
|
/**
|
|
890
925
|
* Creates the `agent.started` event for one session a workflow run opened.
|
|
891
926
|
*/
|
|
@@ -995,8 +1030,10 @@ export declare function createTurnCompletedEvent(input: {
|
|
|
995
1030
|
* Creates the `turn.waiting` event for one open turn that parked.
|
|
996
1031
|
*/
|
|
997
1032
|
export declare function createTurnWaitingEvent(input: {
|
|
1033
|
+
readonly on: TurnWaitingOn;
|
|
998
1034
|
readonly sequence: number;
|
|
999
1035
|
readonly turnId: string;
|
|
1036
|
+
readonly usage: TokenUsage | undefined;
|
|
1000
1037
|
}): TurnWaitingStreamEvent;
|
|
1001
1038
|
/**
|
|
1002
1039
|
* Creates the `turn.failed` event for one failed turn.
|
|
@@ -1044,7 +1081,7 @@ export declare function createCompactionCompletedEvent(input: {
|
|
|
1044
1081
|
* Creates the `session.waiting` event for the only supported between-turn
|
|
1045
1082
|
* wait.
|
|
1046
1083
|
*/
|
|
1047
|
-
export declare function createSessionWaitingEvent(
|
|
1084
|
+
export declare function createSessionWaitingEvent(usage: TokenUsage | undefined): SessionWaitingStreamEvent;
|
|
1048
1085
|
/**
|
|
1049
1086
|
* Creates the `session.failed` event for one terminal session failure.
|
|
1050
1087
|
*/
|
|
@@ -1053,11 +1090,12 @@ export declare function createSessionFailedEvent(input: {
|
|
|
1053
1090
|
readonly details?: JsonObject;
|
|
1054
1091
|
readonly message: string;
|
|
1055
1092
|
readonly sessionId: string;
|
|
1093
|
+
readonly usage: TokenUsage | undefined;
|
|
1056
1094
|
}): SessionFailedStreamEvent;
|
|
1057
1095
|
/**
|
|
1058
1096
|
* Creates the `session.completed` event for one terminal session completion.
|
|
1059
1097
|
*/
|
|
1060
|
-
export declare function createSessionCompletedEvent(): SessionCompletedStreamEvent;
|
|
1098
|
+
export declare function createSessionCompletedEvent(usage: TokenUsage | undefined): SessionCompletedStreamEvent;
|
|
1061
1099
|
/**
|
|
1062
1100
|
* Stamps one session event with its durable identity and emission time.
|
|
1063
1101
|
*
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{deserializeUrlFilePart,hasInternalRefScheme,isSerializedUrlFilePart}from"#internal/attachments/url-refs.js";import{createEveSessionStreamRoutePath,createEveSubagentStreamRoutePath}from"#protocol/routes.js";import{
|
|
2
|
-
`)}function projectUserContentParts(e){if(typeof e==`string`)return[{text:e,type:`text`}];let t=[];for(let n of e)n.type===`text`?t.push({text:n.text,type:`text`}):n.type===`file`?t.push(projectFileLikePart(n.data,n.mediaType,n.filename)):n.type===`image`&&t.push(projectFileLikePart(n.image,n.mediaType??`application/octet-stream`,void 0));return t}function projectFileLikePart(e,t,n){if(isSandboxRefUrl(e)){let t=decodeSandboxRef(e);return createProjectedFilePart({filename:basenameOf(n??t.path),mediaType:t.mediaType,size:t.size})}let r=projectTaggedFileData(e,t,n);if(r!==void 0)return r;let i=byteLengthOf(e);return createProjectedFilePart(i===void 0?{filename:n,mediaType:t,...clientUrlFragment(e)}:{filename:n,mediaType:t,size:i})}function projectTaggedFileData(e,t,n){if(isTaggedFileData(e))switch(e.type){case`data`:{let r=byteLengthOf(e.data);return createProjectedFilePart(r===void 0?{filename:n,mediaType:t}:{filename:n,mediaType:t,size:r})}case`reference`:case`text`:return createProjectedFilePart({filename:n,mediaType:t});case`url`:return createProjectedFilePart({filename:n,mediaType:t,...clientUrlFragment(e.url)})}}function createProjectedFilePart(e){let t={mediaType:e.mediaType,type:`file`};return e.filename!==void 0&&(t.filename=e.filename),e.size!==void 0&&(t.size=e.size),e.url!==void 0&&(t.url=e.url),t}function isTaggedFileData(e){if(typeof e!=`object`||!e)return!1;let t=e.type;return t===`data`||t===`reference`||t===`text`||t===`url`}function byteLengthOf(e){if(e instanceof Uint8Array||e instanceof ArrayBuffer)return e.byteLength}function clientUrlFragment(e){if(isSerializedUrlFilePart(e))try{let t=deserializeUrlFilePart(e);return isClientResolvableUrl(t)?{url:t.href}:{}}catch{return{}}if(e instanceof URL)return isClientResolvableUrl(e)?{url:e.href}:{};if(typeof e!=`string`||hasInternalRefScheme(e))return{};if(e.startsWith(`data:`))return{url:e};try{let t=new URL(e);return isClientResolvableUrl(t)?{url:t.href}:{}}catch{return{}}}function isClientResolvableUrl(e){return e.protocol===`http:`||e.protocol===`https:`||e.protocol===`data:`}function basenameOf(e){let t=e.replaceAll(`\\`,`/`),n=t.slice(t.lastIndexOf(`/`)+1);return n.length>0?n:e}function createActionsRequestedEvent(e){return{data:{actions:e.actions,...optionalPresentation(e.presentation),sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`actions.requested`}}function optionalPresentation(e){return e===void 0?{}:{presentation:e}}function createActionInputAppendedEvent(e){return{data:{callId:e.callId,inputTextDelta:e.inputTextDelta,sequence:e.sequence,stepIndex:e.stepIndex,toolName:e.toolName,turnId:e.turnId},type:`action.input.appended`}}function createAuthorizationRequiredEvent(e){let t={description:e.description,name:e.name,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId};return e.attemptId!==void 0&&(t.attemptId=e.attemptId),e.authorization!==void 0&&(t.authorization=e.authorization),e.candidateId!==void 0&&(t.candidateId=e.candidateId),e.principalId!==void 0&&(t.principalId=e.principalId),e.webhookUrl!==void 0&&(t.webhookUrl=e.webhookUrl),e.taskId!==void 0&&(t.taskId=e.taskId),{data:t,type:`authorization.required`}}function createAuthorizationCompletedEvent(e){let t={name:e.name,outcome:e.outcome,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId};return e.attemptId!==void 0&&(t.attemptId=e.attemptId),e.authorization!==void 0&&(t.authorization=e.authorization),e.candidateId!==void 0&&(t.candidateId=e.candidateId),e.principalId!==void 0&&(t.principalId=e.principalId),e.reason!==void 0&&(t.reason=e.reason),e.taskId!==void 0&&(t.taskId=e.taskId),{data:t,type:`authorization.completed`}}function createApprovalCandidateEvent(e){return{data:e,type:`approval.candidate`}}function createApprovalSettledEvent(e){return{data:e,type:`approval.settled`}}function createInputRequestedEvent(e){let t={requests:e.requests,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId};return e.taskId!==void 0&&(t.taskId=e.taskId),{data:t,type:`input.requested`}}function createInputResolvedEvent(e){return{data:{resolutions:e.resolutions,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`input.resolved`}}function createActionResultEvent(e){let t=e.rejected===!0?{error:buildActionResultError(e.result),status:`rejected`}:normalizeActionResultOutcome(e.result);return{data:{error:t.error,...optionalPresentation(e.presentation),result:e.result,sequence:e.sequence,status:t.status,stepIndex:e.stepIndex,turnId:e.turnId},type:`action.result`}}function createActionPartialEvent(e){return{data:{...optionalPresentation(e.presentation),result:e.result,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`action.partial`}}function createTaskStartedEvent(e){return{data:{callId:e.callId,kind:e.kind,name:e.name,taskId:e.taskId,turnId:e.turnId},type:`task.started`}}function createTaskSettledEvent(e){let t={callId:e.callId,kind:e.kind,name:e.name,status:e.status,taskId:e.taskId,turnId:e.turnId};return e.output!==void 0&&(t.output=e.output),e.error!==void 0&&(t.error=e.error),e.cancel!==void 0&&(t.cancel=e.cancel),{data:t,type:`task.settled`}}function createAgentStartedEvent(e){let t={callId:e.callId,turnId:e.turnId,name:e.name,sessionId:e.sessionId,streamPath:createEveSessionStreamRoutePath(e.sessionId)};return e.taskId!==void 0&&(t.taskId=e.taskId),e.remote!==void 0&&(t.remote=e.remote,t.streamPath=createEveSubagentStreamRoutePath({callId:e.callId,childSessionId:e.sessionId,parentSessionId:e.parentSessionId})),{data:t,type:`agent.started`}}function createMessageAppendedEvent(e){return{data:{messageDelta:e.messageDelta,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`message.appended`}}function createReasoningAppendedEvent(e){return{data:{reasoningDelta:e.reasoningDelta,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`reasoning.appended`}}function createMessageCompletedEvent(e){return{data:{finishReason:e.finishReason??`stop`,message:e.message,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`message.completed`}}function createReasoningCompletedEvent(e){return{data:{reasoning:e.reasoning,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`reasoning.completed`}}function createResultCompletedEvent(e){return{data:{result:e.result,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`result.completed`}}function createStepStartedEvent(e){return{data:{modelId:e.modelId,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`step.started`}}function createStepCompletedEvent(e){let t={finishReason:e.finishReason,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId};return e.usage!==void 0&&(t.usage=e.usage),e.providerMetadata!==void 0&&(t.providerMetadata=e.providerMetadata),{data:t,type:`step.completed`}}function createStepFailedEvent(e){return{data:{code:e.code,details:e.details,message:e.message,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`step.failed`}}function createTurnCompletedEvent(e){return{data:{sequence:e.sequence,turnId:e.turnId},type:`turn.completed`}}function createTurnWaitingEvent(e){return{data:{sequence:e.sequence,turnId:e.turnId},type:`turn.waiting`}}function createTurnFailedEvent(e){return{data:{code:e.code,details:e.details,message:e.message,sequence:e.sequence,turnId:e.turnId},type:`turn.failed`}}function createTurnCancelledEvent(e){return{data:{sequence:e.sequence,turnId:e.turnId},type:`turn.cancelled`}}function createContextClearedEvent(e){return{data:{sequence:e.sequence,sessionId:e.sessionId,turnId:e.turnId},type:`context.cleared`}}function createCompactionRequestedEvent(e){return{data:{modelId:e.modelId,sequence:e.sequence,sessionId:e.sessionId,stepIndex:e.stepIndex,turnId:e.turnId,usageInputTokens:e.usageInputTokens??null},type:`compaction.requested`}}function createCompactionCompletedEvent(e){return{data:{modelId:e.modelId,sequence:e.sequence,sessionId:e.sessionId,stepIndex:e.stepIndex,turnId:e.turnId},type:`compaction.completed`}}function createSessionWaitingEvent(e=``){return{data:{continuationToken:toChannelLocalContinuationToken(e),wait:`next-user-message`},type:`session.waiting`}}function createSessionFailedEvent(e){return{data:{code:e.code,details:e.details,message:e.message,sessionId:e.sessionId},type:`session.failed`}}function createSessionCompletedEvent(){return{type:`session.completed`}}function stampMessageStreamEvent(e,t){let n={at:new Date().toISOString(),id:createEventId()};return t!==void 0&&t.length>0&&(n.deliveryIds=t),{...e,meta:n}}function encodeMessageStreamEvent(e){return textEncoder.encode(`${JSON.stringify(e)}\n`)}function normalizeActionResultOutcome(e){if(e.isError===!0)return{error:buildActionResultError(e),status:`failed`};let t=readActionResultOutputError(e.output);return t===void 0?{status:`completed`}:{error:t,status:`failed`}}function buildActionResultError(e){let t=readActionResultOutputError(e.output);return t===void 0?{code:`ACTION_RESULT_FAILED`,message:formatActionResultOutput(e.output)}:t}function readActionResultOutputError(e){let t=parseActionResultOutputRecord(e);if(t===void 0)return;let n=typeof t.code==`string`&&t.code.length>0?t.code:void 0,r=typeof t.message==`string`&&t.message.length>0?t.message:void 0;if(n!==void 0&&r!==void 0)return{code:n,message:r}}function parseActionResultOutputRecord(e){if(typeof e==`object`&&e)return e;if(typeof e!=`string`)return;let t=e.trim();if(t.length!==0)try{let e=JSON.parse(t);if(typeof e==`object`&&e)return e}catch{return}}function formatActionResultOutput(e){if(typeof e==`string`)return e;let t=JSON.stringify(e);return typeof t==`string`&&t.length>0?t:`Action failed.`}export{EVE_MESSAGE_STREAM_CONTENT_TYPE,EVE_MESSAGE_STREAM_FORMAT,EVE_MESSAGE_STREAM_VERSION,EVE_SESSION_ID_HEADER,EVE_STREAM_CONTROL_VERSION,EVE_STREAM_CONTROL_VERSION_QUERY,EVE_STREAM_FORMAT_HEADER,EVE_STREAM_LEASE_ENDED_CONTROL,EVE_STREAM_TAIL_INDEX_HEADER,EVE_STREAM_VERSION_HEADER,createActionInputAppendedEvent,createActionPartialEvent,createActionResultEvent,createActionsRequestedEvent,createAgentStartedEvent,createApprovalCandidateEvent,createApprovalSettledEvent,createAuthorizationCompletedEvent,createAuthorizationRequiredEvent,createCompactionCompletedEvent,createCompactionRequestedEvent,createContextClearedEvent,createInputRequestedEvent,createInputResolvedEvent,createMessageAppendedEvent,createMessageCompletedEvent,createMessageReceivedEvent,createReasoningAppendedEvent,createReasoningCompletedEvent,createResultCompletedEvent,createSessionCompletedEvent,createSessionFailedEvent,createSessionStartedEvent,createSessionWaitingEvent,createStepCompletedEvent,createStepFailedEvent,createStepStartedEvent,createTaskSettledEvent,createTaskStartedEvent,createTurnCancelledEvent,createTurnCompletedEvent,createTurnFailedEvent,createTurnStartedEvent,createTurnWaitingEvent,encodeMessageStreamEvent,isCurrentTurnBoundaryEvent,isTurnFailureEvent,stampMessageStreamEvent};
|
|
1
|
+
import{deserializeUrlFilePart,hasInternalRefScheme,isSerializedUrlFilePart}from"#internal/attachments/url-refs.js";import{createEveSessionStreamRoutePath,createEveSubagentStreamRoutePath}from"#protocol/routes.js";import{decodeSandboxRef,isSandboxRefUrl}from"#internal/attachments/sandbox-refs.js";import{createEventId}from"#protocol/event-id.js";const EVE_SESSION_ID_HEADER=`x-eve-session-id`,EVE_STREAM_FORMAT_HEADER=`x-eve-stream-format`,EVE_STREAM_TAIL_INDEX_HEADER=`x-eve-stream-tail-index`,EVE_STREAM_VERSION_HEADER=`x-eve-stream-version`,EVE_MESSAGE_STREAM_CONTENT_TYPE=`application/x-ndjson; charset=utf-8`,EVE_MESSAGE_STREAM_FORMAT=`ndjson`,EVE_MESSAGE_STREAM_VERSION=`26`,EVE_STREAM_CONTROL_VERSION=`1`,EVE_STREAM_CONTROL_VERSION_QUERY=`streamControlVersion`,EVE_STREAM_LEASE_ENDED_CONTROL={$eve:`stream.lease-ended`,version:1},textEncoder=new TextEncoder;function isCurrentTurnBoundaryEvent(e){return e.type===`session.completed`||e.type===`session.failed`||e.type===`session.waiting`}function isTurnFailureEvent(e){return e.type===`session.failed`||e.type===`step.failed`||e.type===`turn.failed`}function createSessionStartedEvent(e){let t={};return e?.invocation!==void 0&&(t.invocation=e.invocation),e?.runtime!==void 0&&(t.runtime=e.runtime),e?.trace!==void 0&&(t.trace=e.trace),{data:t,type:`session.started`}}function createTurnStartedEvent(e){let t={sequence:e.sequence,turnId:e.turnId};return e.trace!==void 0&&(t.trace=e.trace),{data:t,type:`turn.started`}}function createMessageReceivedEvent(e){return{data:{message:summarizeUserContent(e.message),parts:projectUserContentParts(e.message),sequence:e.sequence,turnId:e.turnId},type:`message.received`}}function summarizeUserContent(e){if(typeof e==`string`)return e;let t=[];for(let n of e)if(n.type===`text`)t.push(n.text);else if(n.type===`file`){let e=n.filename??n.mediaType;t.push(`[file: ${e} (${n.mediaType})]`)}else n.type===`image`&&t.push(`[image: ${n.mediaType??`image`}]`);return t.join(`
|
|
2
|
+
`)}function projectUserContentParts(e){if(typeof e==`string`)return[{text:e,type:`text`}];let t=[];for(let n of e)n.type===`text`?t.push({text:n.text,type:`text`}):n.type===`file`?t.push(projectFileLikePart(n.data,n.mediaType,n.filename)):n.type===`image`&&t.push(projectFileLikePart(n.image,n.mediaType??`application/octet-stream`,void 0));return t}function projectFileLikePart(e,t,n){if(isSandboxRefUrl(e)){let t=decodeSandboxRef(e);return createProjectedFilePart({filename:basenameOf(n??t.path),mediaType:t.mediaType,size:t.size})}let r=projectTaggedFileData(e,t,n);if(r!==void 0)return r;let i=byteLengthOf(e);return createProjectedFilePart(i===void 0?{filename:n,mediaType:t,...clientUrlFragment(e)}:{filename:n,mediaType:t,size:i})}function projectTaggedFileData(e,t,n){if(isTaggedFileData(e))switch(e.type){case`data`:{let r=byteLengthOf(e.data);return createProjectedFilePart(r===void 0?{filename:n,mediaType:t}:{filename:n,mediaType:t,size:r})}case`reference`:case`text`:return createProjectedFilePart({filename:n,mediaType:t});case`url`:return createProjectedFilePart({filename:n,mediaType:t,...clientUrlFragment(e.url)})}}function createProjectedFilePart(e){let t={mediaType:e.mediaType,type:`file`};return e.filename!==void 0&&(t.filename=e.filename),e.size!==void 0&&(t.size=e.size),e.url!==void 0&&(t.url=e.url),t}function isTaggedFileData(e){if(typeof e!=`object`||!e)return!1;let t=e.type;return t===`data`||t===`reference`||t===`text`||t===`url`}function byteLengthOf(e){if(e instanceof Uint8Array||e instanceof ArrayBuffer)return e.byteLength}function clientUrlFragment(e){if(isSerializedUrlFilePart(e))try{let t=deserializeUrlFilePart(e);return isClientResolvableUrl(t)?{url:t.href}:{}}catch{return{}}if(e instanceof URL)return isClientResolvableUrl(e)?{url:e.href}:{};if(typeof e!=`string`||hasInternalRefScheme(e))return{};if(e.startsWith(`data:`))return{url:e};try{let t=new URL(e);return isClientResolvableUrl(t)?{url:t.href}:{}}catch{return{}}}function isClientResolvableUrl(e){return e.protocol===`http:`||e.protocol===`https:`||e.protocol===`data:`}function basenameOf(e){let t=e.replaceAll(`\\`,`/`),n=t.slice(t.lastIndexOf(`/`)+1);return n.length>0?n:e}function createActionsRequestedEvent(e){return{data:{actions:e.actions,...optionalPresentation(e.presentation),sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`actions.requested`}}function optionalPresentation(e){return e===void 0?{}:{presentation:e}}function createActionInputAppendedEvent(e){return{data:{callId:e.callId,inputTextDelta:e.inputTextDelta,sequence:e.sequence,stepIndex:e.stepIndex,toolName:e.toolName,turnId:e.turnId},type:`action.input.appended`}}function createAuthorizationRequiredEvent(e){let t={description:e.description,name:e.name,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId};return e.attemptId!==void 0&&(t.attemptId=e.attemptId),e.authorization!==void 0&&(t.authorization=e.authorization),e.candidateId!==void 0&&(t.candidateId=e.candidateId),e.principalId!==void 0&&(t.principalId=e.principalId),e.webhookUrl!==void 0&&(t.webhookUrl=e.webhookUrl),e.taskId!==void 0&&(t.taskId=e.taskId),{data:t,type:`authorization.required`}}function createAuthorizationCompletedEvent(e){let t={name:e.name,outcome:e.outcome,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId};return e.attemptId!==void 0&&(t.attemptId=e.attemptId),e.authorization!==void 0&&(t.authorization=e.authorization),e.candidateId!==void 0&&(t.candidateId=e.candidateId),e.principalId!==void 0&&(t.principalId=e.principalId),e.reason!==void 0&&(t.reason=e.reason),e.taskId!==void 0&&(t.taskId=e.taskId),{data:t,type:`authorization.completed`}}function createApprovalCandidateEvent(e){return{data:e,type:`approval.candidate`}}function createApprovalSettledEvent(e){return{data:e,type:`approval.settled`}}function createInputRequestedEvent(e){let t={requests:e.requests,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId};return e.taskId!==void 0&&(t.taskId=e.taskId),{data:t,type:`input.requested`}}function createInputResolvedEvent(e){return{data:{resolutions:e.resolutions,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`input.resolved`}}function createActionResultEvent(e){let t=e.rejected===!0?{error:buildActionResultError(e.result),status:`rejected`}:normalizeActionResultOutcome(e.result);return{data:{error:t.error,...optionalPresentation(e.presentation),result:e.result,sequence:e.sequence,status:t.status,stepIndex:e.stepIndex,turnId:e.turnId},type:`action.result`}}function createActionPartialEvent(e){return{data:{...optionalPresentation(e.presentation),result:e.result,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`action.partial`}}function createTaskStartedEvent(e){return{data:{callId:e.callId,kind:e.kind,name:e.name,taskId:e.taskId,turnId:e.turnId},type:`task.started`}}function createTaskSettledEvent(e){let t={callId:e.callId,...e.kind!==void 0&&{kind:e.kind},...e.name!==void 0&&{name:e.name},status:e.status,taskId:e.taskId,turnId:e.turnId};return e.output!==void 0&&(t.output=e.output),e.error!==void 0&&(t.error=e.error),e.cancel!==void 0&&(t.cancel=e.cancel),{data:t,type:`task.settled`}}function createAgentStartedEvent(e){let t={callId:e.callId,turnId:e.turnId,name:e.name,sessionId:e.sessionId,streamPath:createEveSessionStreamRoutePath(e.sessionId)};return e.taskId!==void 0&&(t.taskId=e.taskId),e.remote!==void 0&&(t.remote=e.remote,t.streamPath=createEveSubagentStreamRoutePath({callId:e.callId,childSessionId:e.sessionId,parentSessionId:e.parentSessionId})),{data:t,type:`agent.started`}}function createMessageAppendedEvent(e){return{data:{messageDelta:e.messageDelta,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`message.appended`}}function createReasoningAppendedEvent(e){return{data:{reasoningDelta:e.reasoningDelta,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`reasoning.appended`}}function createMessageCompletedEvent(e){return{data:{finishReason:e.finishReason??`stop`,message:e.message,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`message.completed`}}function createReasoningCompletedEvent(e){return{data:{reasoning:e.reasoning,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`reasoning.completed`}}function createResultCompletedEvent(e){return{data:{result:e.result,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`result.completed`}}function createStepStartedEvent(e){return{data:{modelId:e.modelId,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`step.started`}}function createStepCompletedEvent(e){let t={finishReason:e.finishReason,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId};return e.usage!==void 0&&(t.usage=e.usage),e.providerMetadata!==void 0&&(t.providerMetadata=e.providerMetadata),{data:t,type:`step.completed`}}function createStepFailedEvent(e){return{data:{code:e.code,details:e.details,message:e.message,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`step.failed`}}function createTurnCompletedEvent(e){return{data:{sequence:e.sequence,turnId:e.turnId},type:`turn.completed`}}function createTurnWaitingEvent(e){return{data:{on:e.on,sequence:e.sequence,turnId:e.turnId,...e.usage!==void 0&&{usage:e.usage}},type:`turn.waiting`}}function createTurnFailedEvent(e){return{data:{code:e.code,details:e.details,message:e.message,sequence:e.sequence,turnId:e.turnId},type:`turn.failed`}}function createTurnCancelledEvent(e){return{data:{sequence:e.sequence,turnId:e.turnId},type:`turn.cancelled`}}function createContextClearedEvent(e){return{data:{sequence:e.sequence,sessionId:e.sessionId,turnId:e.turnId},type:`context.cleared`}}function createCompactionRequestedEvent(e){return{data:{modelId:e.modelId,sequence:e.sequence,sessionId:e.sessionId,stepIndex:e.stepIndex,turnId:e.turnId,usageInputTokens:e.usageInputTokens??null},type:`compaction.requested`}}function createCompactionCompletedEvent(e){return{data:{modelId:e.modelId,sequence:e.sequence,sessionId:e.sessionId,stepIndex:e.stepIndex,turnId:e.turnId},type:`compaction.completed`}}function createSessionWaitingEvent(e){return{data:{continuationToken:``,...e!==void 0&&{usage:e},wait:`next-user-message`},type:`session.waiting`}}function createSessionFailedEvent(e){return{data:{code:e.code,details:e.details,message:e.message,sessionId:e.sessionId,...e.usage!==void 0&&{usage:e.usage}},type:`session.failed`}}function createSessionCompletedEvent(e){return e===void 0?{type:`session.completed`}:{data:{usage:e},type:`session.completed`}}function stampMessageStreamEvent(e,t){let n={at:new Date().toISOString(),id:createEventId()};return t!==void 0&&t.length>0&&(n.deliveryIds=t),{...e,meta:n}}function encodeMessageStreamEvent(e){return textEncoder.encode(`${JSON.stringify(e)}\n`)}function normalizeActionResultOutcome(e){if(e.isError===!0)return{error:buildActionResultError(e),status:`failed`};let t=readActionResultOutputError(e.output);return t===void 0?{status:`completed`}:{error:t,status:`failed`}}function buildActionResultError(e){let t=readActionResultOutputError(e.output);return t===void 0?{code:`ACTION_RESULT_FAILED`,message:formatActionResultOutput(e.output)}:t}function readActionResultOutputError(e){let t=parseActionResultOutputRecord(e);if(t===void 0)return;let n=typeof t.code==`string`&&t.code.length>0?t.code:void 0,r=typeof t.message==`string`&&t.message.length>0?t.message:void 0;if(n!==void 0&&r!==void 0)return{code:n,message:r}}function parseActionResultOutputRecord(e){if(typeof e==`object`&&e)return e;if(typeof e!=`string`)return;let t=e.trim();if(t.length!==0)try{let e=JSON.parse(t);if(typeof e==`object`&&e)return e}catch{return}}function formatActionResultOutput(e){if(typeof e==`string`)return e;let t=JSON.stringify(e);return typeof t==`string`&&t.length>0?t:`Action failed.`}export{EVE_MESSAGE_STREAM_CONTENT_TYPE,EVE_MESSAGE_STREAM_FORMAT,EVE_MESSAGE_STREAM_VERSION,EVE_SESSION_ID_HEADER,EVE_STREAM_CONTROL_VERSION,EVE_STREAM_CONTROL_VERSION_QUERY,EVE_STREAM_FORMAT_HEADER,EVE_STREAM_LEASE_ENDED_CONTROL,EVE_STREAM_TAIL_INDEX_HEADER,EVE_STREAM_VERSION_HEADER,createActionInputAppendedEvent,createActionPartialEvent,createActionResultEvent,createActionsRequestedEvent,createAgentStartedEvent,createApprovalCandidateEvent,createApprovalSettledEvent,createAuthorizationCompletedEvent,createAuthorizationRequiredEvent,createCompactionCompletedEvent,createCompactionRequestedEvent,createContextClearedEvent,createInputRequestedEvent,createInputResolvedEvent,createMessageAppendedEvent,createMessageCompletedEvent,createMessageReceivedEvent,createReasoningAppendedEvent,createReasoningCompletedEvent,createResultCompletedEvent,createSessionCompletedEvent,createSessionFailedEvent,createSessionStartedEvent,createSessionWaitingEvent,createStepCompletedEvent,createStepFailedEvent,createStepStartedEvent,createTaskSettledEvent,createTaskStartedEvent,createTurnCancelledEvent,createTurnCompletedEvent,createTurnFailedEvent,createTurnStartedEvent,createTurnWaitingEvent,encodeMessageStreamEvent,isCurrentTurnBoundaryEvent,isTurnFailureEvent,stampMessageStreamEvent};
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
import type { ActionPresentationByCallId } from "#protocol/message.js";
|
|
7
7
|
import type { RuntimeActionRequest } from "#shared/action-types.js";
|
|
8
8
|
/**
|
|
9
|
-
* The first call's label, or its tool or agent
|
|
10
|
-
* model requested several calls at once.
|
|
9
|
+
* The first call's label, or its tool or agent display title, plus `+N more`
|
|
10
|
+
* when the model requested several calls at once.
|
|
11
11
|
*/
|
|
12
12
|
export declare function describeActionRequests(actions: readonly RuntimeActionRequest[], presentation: ActionPresentationByCallId | undefined): string;
|
|
13
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{actionRequestName}from"#shared/action-request-name.js";import{AGENT_TOOL_NAME}from"#tools/framework/agent-contract.js";function describeActionRequests(e,t){let[n]=e;if(n===void 0)return`Working...`;let r=t?.[n.callId]?.label??actionRequestName(n);return e.length===1?r:`${r} +${String(e.length-1)} more`}function waitingOnTasks(e){let[t]=e;return e.length===1&&t!==AGENT_TOOL_NAME?`Waiting on ${t}...`:e.length===1?`Waiting on a task...`:`Waiting on ${String(e.length)} tasks...`}export{describeActionRequests,waitingOnTasks};
|
|
1
|
+
import{actionRequestName}from"#shared/action-request-name.js";import{displayName,displayTitle}from"#shared/display-name.js";import{AGENT_TOOL_NAME}from"#tools/framework/agent-contract.js";function describeActionRequests(e,t){let[n]=e;if(n===void 0)return`Working...`;let r=t?.[n.callId]?.label??displayTitle(actionRequestName(n));return e.length===1?r:`${r} +${String(e.length-1)} more`}function waitingOnTasks(e){let[t]=e;return e.length===1&&t!==AGENT_TOOL_NAME?`Waiting on ${displayName(t)}...`:e.length===1?`Waiting on a task...`:`Waiting on ${String(e.length)} tasks...`}export{describeActionRequests,waitingOnTasks};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* eve's default Slack rendering for human-input requests: posting approval
|
|
3
|
+
* and question controls, and retiring an approval's messages once it resolves.
|
|
4
|
+
*/
|
|
5
|
+
import type { SlackApprovalChannelResolver, SlackChannelInternalEvents } from "#public/channels/slack/slackChannel.js";
|
|
6
|
+
/**
|
|
7
|
+
* Default `input.requested` handler — renders each pending HITL
|
|
8
|
+
* request as Slack `block_actions`. Buttons by default; radio for
|
|
9
|
+
* ≤6-option select requests; static_select for >6-option select
|
|
10
|
+
* requests. Batches split into multiple posts when they would exceed
|
|
11
|
+
* Slack's 50-block message cap.
|
|
12
|
+
*/
|
|
13
|
+
export declare function defaultInputRequestedHandler(approvalChannel?: SlackApprovalChannelResolver): NonNullable<SlackChannelInternalEvents["input.requested"]>;
|
|
14
|
+
/** Default handlers for the approval lifecycle events. */
|
|
15
|
+
export declare const approvalEvents: Pick<SlackChannelInternalEvents, "approval.candidate" | "approval.settled" | "input.resolved">;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createLogger,logError}from"#internal/logging.js";import{SLACK_MAX_BLOCKS_PER_MESSAGE,truncateMessageText}from"#public/channels/slack/limits.js";import{slackUserIdForPrincipal,slackUserIdFromAuthContext}from"#public/channels/slack/auth.js";import{buildAnsweredBlocks,decodeHitlActionId,renderInputRequestPostParts}from"#public/channels/slack/hitl.js";import{deliverPrivateInputRequest}from"#public/channels/slack/private-approval-delivery.js";const log=createLogger(`slack.defaults`);function defaultInputRequestedHandler(e){return async(t,n,r)=>{let i=[],a=[];for(let n of t.requests)((e===void 0?`thread`:await e(n,r))===`direct-message`?i:a).push(n);await postPublicInputRequests(a,n);for(let e of i){let t=slackUserIdFromAuthContext(r.session.auth.current)??n.state.triggeringUserId;if(!t){log.warn(`direct-message input request not delivered because no reviewer was resolved`,{requestId:e.requestId,sessionId:r.session.id});continue}let i=await deliverPrivateInputRequest({previewMessageTs:n.state.triggeringMessageTs??n.slack.threadTs,request:e,reviewer:t,slack:n.slack});recordApprovalCards(n.state,[e],i);try{let r=await n.thread.post(`Waiting on ${e.kind===`tool-approval`?`approval`:`a response`} from <@${t}>…`);r.id&&recordApprovalCards(n.state,[e],{...i,announcementTs:r.id})}catch(t){logError(log,`failed to announce private input request`,t,{requestId:e.requestId,sessionId:r.session.id})}}}}async function postPublicInputRequests(e,t){let n=new Map;for(let r of buildInputRequestPosts(e)){let e=await t.thread.post({blocks:r.blocks,text:r.text});if(r.kind===`details`){if(e.id)for(let t of r.requests)n.set(t.requestId,e.id);continue}for(let i of r.requests){let a=n.get(i.requestId);recordApprovalCards(t.state,[i],{detailsMessageTs:a,messageBlocks:r.blocks,messageTs:e.id})}}}function recordApprovalCards(e,t,n){if(!n.messageTs)return;let r={...e.pendingApprovalCards};for(let e of t)e.kind===`tool-approval`&&(r[e.requestId]=n);e.pendingApprovalCards=r}async function settleApprovalCard(e,t,n){let r=e.state.pendingApprovalCards??{},i=r[t];if(i===void 0)return;let a={...r};delete a[t],e.state.pendingApprovalCards=a;let o=i.messageChannelId??e.state.channelId;if(o===null)return;let s=i.messageBlocks.flatMap(e=>{if(!blockContainsRequestAction(e,t))return[e];if(typeof e!=`object`||!e)return[];let r=e;if(r.type!==`card`)return buildAnsweredBlocks({answerLabel:n.label,promptBlocks:[],userId:n.userId});let{actions:i,subtext:a,...o}=r;return buildAnsweredBlocks({answerLabel:n.label,promptBlocks:[o],userId:n.userId})});for(let[e,t]of Object.entries(a))t.messageTs===i.messageTs&&(a[e]={...t,messageBlocks:s});await settleRequest(e,`chat.update`,t,{blocks:s,channel:o,text:`Answered: ${n.label}`,ts:i.messageTs});let c=i.detailsMessageTs;c!==void 0&&!Object.values(a).some(e=>e.detailsMessageTs===c)&&await settleRequest(e,`chat.delete`,t,{channel:o,ts:c}),i.announcementTs!==void 0&&e.state.channelId!==null&&await settleRequest(e,`chat.update`,t,{channel:e.state.channelId,text:n.announcement,ts:i.announcementTs})}async function settleRequest(e,t,n,r){try{let i=await e.slack.request(t,r);i.ok!==!0&&log.warn(`failed to retire approval message`,{error:i.error,operation:t,requestId:n})}catch(e){logError(log,`failed to retire approval message`,e,{operation:t,requestId:n})}}function buildInputRequestPosts(e){let t=[],n=[];for(let r of e){let e=renderInputRequestPostParts(r);e.details&&t.push({...e.details,request:r}),n.push({...e.controls,request:r})}return[...groupInputRequestPostParts(t).map(e=>({...e,kind:`details`})),...groupInputRequestPostParts(n).map(e=>({...e,kind:`controls`}))]}function groupInputRequestPostParts(e){let t=[];for(let n of e){let e=t.at(-1);e&&e.blocks.length+n.blocks.length<=SLACK_MAX_BLOCKS_PER_MESSAGE?(e.blocks.push(...n.blocks),e.fallbacks.push(n.text),e.requests.push(n.request)):t.push({blocks:[...n.blocks],fallbacks:[n.text],requests:[n.request]})}return t.map(e=>({blocks:e.blocks,requests:e.requests,text:truncateMessageText(e.fallbacks.join(`
|
|
2
|
+
`))}))}function blockContainsRequestAction(e,t){if(typeof e!=`object`||!e)return!1;let n=e;return[n.actions,n.elements].some(e=>Array.isArray(e)&&e.some(e=>{if(typeof e!=`object`||!e)return!1;let n=e.action_id;return typeof n==`string`&&decodeHitlActionId(n)?.requestId===t}))}const approvalEvents={async"approval.candidate"(e,t,n){if(e.outcome!==`rejected`&&e.outcome!==`failed`)return;let r=slackUserIdForPrincipal(t.state,e.responderPrincipalId);r!==void 0&&await t.thread.postEphemeral(r,e.reason??`We couldn’t verify your response. Please try again.`)},async"approval.settled"(e,t,n){let r=e.outcome===`approved`,i=slackUserIdForPrincipal(t.state,e.responderPrincipalId),a=i===void 0?``:` by <@${i}>`;await settleApprovalCard(t,e.requestId,{announcement:`${r?`Approved`:`Cancelled`}${a}.`,label:r?`Approve`:`Cancel`,userId:i})},async"input.resolved"(e,t,n){for(let n of e.resolutions){if(n.kind!==`tool-approval`)continue;let e=n.outcome===`approved`?`Approve`:n.outcome===`denied`?`Cancel`:`No longer needed`;await settleApprovalCard(t,n.requestId,{announcement:e===`No longer needed`?`This approval is no longer needed.`:`${e===`Approve`?`Approved`:`Cancelled`}.`,label:e})}}};export{approvalEvents,defaultInputRequestedHandler};
|
|
@@ -3,6 +3,8 @@ import type { SlackChannelState } from "#public/channels/slack/slackChannel.js";
|
|
|
3
3
|
interface SlackAuthContextInput {
|
|
4
4
|
readonly channelId: string;
|
|
5
5
|
readonly fullName?: string;
|
|
6
|
+
/** Workspace whose app installation received the event. Keys the principal when known. */
|
|
7
|
+
readonly installationTeamId?: string | null;
|
|
6
8
|
readonly isBot?: boolean;
|
|
7
9
|
readonly teamId?: string | null;
|
|
8
10
|
readonly threadTs: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function slackUserIdFromAuthContext(e){if(e?.authenticator!==`slack-webhook`)return;let t=e.attributes.user_id;return typeof t==`string`&&t.length>0?t:void 0}function slackUserIdForPrincipal(e,t){return t===void 0?void 0:e.slackUsersByPrincipal?.[t]}function buildSlackAuthContext(e){let t=e.isBot===!0,n=e.teamId?t?`slack:${
|
|
1
|
+
function slackUserIdFromAuthContext(e){if(e?.authenticator!==`slack-webhook`)return;let t=e.attributes.user_id;return typeof t==`string`&&t.length>0?t:void 0}function slackUserIdForPrincipal(e,t){return t===void 0?void 0:e.slackUsersByPrincipal?.[t]}function buildSlackAuthContext(e){let t=e.isBot===!0,n=e.installationTeamId||e.teamId,r=n?t?`slack:${n}:bot:${e.userId}`:`slack:${n}:${e.userId}`:t?`slack:bot:${e.userId}`:`slack:${e.userId}`,i={author_type:t?`bot`:`user`,channel_id:e.channelId,thread_ts:e.threadTs,user_id:e.userId};return e.userName&&(i.user_name=e.userName),e.fullName&&(i.full_name=e.fullName),e.teamId&&(i.team_id=e.teamId),{attributes:i,authenticator:`slack-webhook`,issuer:n?`slack:${n}`:`slack`,principalId:r,principalType:t?`service`:`user`}}export{buildSlackAuthContext,slackUserIdForPrincipal,slackUserIdFromAuthContext};
|
|
@@ -17,12 +17,9 @@
|
|
|
17
17
|
* `timed-out`).
|
|
18
18
|
*/
|
|
19
19
|
import type { ConnectionAuthorizationOutcome } from "#protocol/message.js";
|
|
20
|
+
import { type SignInCancelTarget } from "#public/channels/slack/sign-in-cancel.js";
|
|
20
21
|
export type { ConnectionAuthorizationOutcome };
|
|
21
|
-
/**
|
|
22
|
-
* Title-cases a connection name (`linear` → `Linear`) for display. Empty
|
|
23
|
-
* strings pass through unchanged so the renderer never emits an empty
|
|
24
|
-
* label inside a sentence.
|
|
25
|
-
*/
|
|
22
|
+
/** A connection name for display (`linear` → `Linear`, `my_crm` → `My crm`). */
|
|
26
23
|
export declare function formatConnectionDisplayName(connectionName: string): string;
|
|
27
24
|
/**
|
|
28
25
|
* Public status text for an authorization challenge. Deliberately
|
|
@@ -33,7 +30,7 @@ export declare function formatConnectionDisplayName(connectionName: string): str
|
|
|
33
30
|
*/
|
|
34
31
|
export declare function buildAuthRequiredPublicText(input: {
|
|
35
32
|
readonly displayName: string;
|
|
36
|
-
readonly
|
|
33
|
+
readonly recipientUserId: string | null;
|
|
37
34
|
}): string;
|
|
38
35
|
/**
|
|
39
36
|
* Final-state markdown for the public status message. Edited in place by
|
|
@@ -46,14 +43,21 @@ export declare function buildAuthCompletedText(input: {
|
|
|
46
43
|
readonly reason?: string;
|
|
47
44
|
}): string;
|
|
48
45
|
/**
|
|
49
|
-
* Block Kit blocks for the
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* helper returns blocks directly.
|
|
46
|
+
* Block Kit blocks for the private sign-in prompt. It names the service and
|
|
47
|
+
* why it is asking before the button, because the user may not remember which
|
|
48
|
+
* request needed it. A device-code flow's `userCode` is a fallback the
|
|
49
|
+
* provider shows only sometimes, so it is a quiet hint below the button.
|
|
54
50
|
*/
|
|
55
51
|
export declare function buildAuthEphemeralBlocks(input: {
|
|
52
|
+
/** Lets the person cancel the held turn instead of connecting. */
|
|
53
|
+
readonly cancel?: SignInCancelTarget;
|
|
56
54
|
readonly displayName: string;
|
|
57
55
|
readonly url: string;
|
|
58
56
|
readonly userCode?: string;
|
|
59
57
|
}): unknown[];
|
|
58
|
+
/** Notification text for the private sign-in prompt, for clients that show no blocks. */
|
|
59
|
+
export declare function buildAuthEphemeralText(input: {
|
|
60
|
+
readonly displayName: string;
|
|
61
|
+
readonly url: string;
|
|
62
|
+
readonly userCode?: string;
|
|
63
|
+
}): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function formatConnectionDisplayName(e){return
|
|
1
|
+
import{displayProperName}from"#shared/display-name.js";import{truncatePlainText}from"#public/channels/slack/limits.js";import{SIGN_IN_CANCEL_ACTION_ID}from"#public/channels/slack/sign-in-cancel.js";function formatConnectionDisplayName(e){return displayProperName(e)}function buildAuthRequiredPublicText(e){return e.recipientUserId===null?`${e.displayName} needs to be connected to continue, but the sign-in link couldn't be sent privately.`:`Paused: waiting for <@${e.recipientUserId}> to connect ${e.displayName}…`}function buildAuthCompletedText(e){if(e.outcome===`authorized`)return`:white_check_mark: ${e.displayName} connected`;if(e.outcome===`declined`)return`${e.displayName} sign-in cancelled`;let t=e.reason===void 0?``:` (${e.reason})`;return`:x: ${e.displayName} authorization ${e.outcome}${t}`}function buildAuthEphemeralBlocks(e){let t=[{type:`section`,text:{type:`mrkdwn`,text:e.cancel===void 0?`*Connect ${e.displayName}*\nTo continue, I need access to your ${e.displayName} account. Only you can see this message.`:`*Connect ${e.displayName}*\nI've paused until you connect your ${e.displayName} account or cancel. Only you can see this message.`}},{type:`actions`,elements:[{type:`button`,text:{type:`plain_text`,text:truncatePlainText(`Connect ${e.displayName}`)},url:e.url,style:`primary`},...e.cancel===void 0?[]:[{type:`button`,action_id:SIGN_IN_CANCEL_ACTION_ID,text:{type:`plain_text`,text:`Cancel`},value:JSON.stringify(e.cancel)}]]}];return e.userCode!==void 0&&e.userCode.length>0&&t.push({type:`context`,elements:[{type:`mrkdwn`,text:`If ${e.displayName} asks for a confirmation code, enter \`${e.userCode}\`.`}]}),t}function buildAuthEphemeralText(e){let t=e.userCode!==void 0&&e.userCode.length>0?` If asked for a confirmation code, enter ${e.userCode}.`:``;return`Connect your ${e.displayName} account to continue: ${e.url}${t}`}export{buildAuthCompletedText,buildAuthEphemeralBlocks,buildAuthEphemeralText,buildAuthRequiredPublicText,formatConnectionDisplayName};
|