eve 0.27.13 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/dist/src/channel/adapter.d.ts +5 -5
- package/dist/src/channel/session.d.ts +2 -2
- package/dist/src/channel/types.d.ts +16 -6
- package/dist/src/chunks/{use-eve-agent-CWYe-vqE.js → use-eve-agent-CyDt3Lny.js} +92 -1
- package/dist/src/chunks/{use-eve-agent-CsSQOKnp.js → use-eve-agent-DaH3cf8K.js} +92 -1
- package/dist/src/cli/commands/agent-prompt/collect-intent.md +1 -1
- package/dist/src/cli/commands/channels.d.ts +0 -17
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/deploy.js +1 -1
- package/dist/src/cli/commands/extension-init.js +1 -1
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/integration-connect.d.ts +29 -0
- package/dist/src/cli/commands/integration-connect.js +1 -0
- package/dist/src/cli/commands/integration-setup.d.ts +2 -3
- package/dist/src/cli/commands/integration-setup.js +1 -1
- package/dist/src/cli/commands/register-integration-commands.js +1 -1
- package/dist/src/cli/commands/registry-setup-command.d.ts +13 -3
- package/dist/src/cli/commands/registry-setup-command.js +2 -1
- package/dist/src/cli/commands/registry.d.ts +35 -1
- package/dist/src/cli/commands/registry.js +1 -1
- package/dist/src/cli/commands/trace.js +1 -1
- package/dist/src/cli/dev/tui/agent-header.js +1 -1
- package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
- package/dist/src/cli/dev/tui/prompt-commands.d.ts +1 -1
- package/dist/src/cli/dev/tui/prompt-commands.js +1 -1
- package/dist/src/cli/dev/tui/remote-auth-command.js +1 -1
- package/dist/src/cli/dev/tui/runner.d.ts +8 -7
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/setup-commands.d.ts +8 -13
- package/dist/src/cli/dev/tui/setup-commands.js +3 -2
- package/dist/src/cli/dev/tui/setup-flow.d.ts +14 -5
- package/dist/src/cli/dev/tui/setup-panel.d.ts +5 -1
- package/dist/src/cli/dev/tui/setup-panel.js +2 -2
- package/dist/src/cli/dev/tui/status-line.d.ts +1 -1
- package/dist/src/cli/dev/tui/status-line.js +1 -1
- package/dist/src/cli/dev/tui/subagent-pump.d.ts +8 -2
- package/dist/src/cli/dev/tui/subagent-pump.js +1 -1
- package/dist/src/cli/dev/tui/terminal-renderer.d.ts +2 -5
- package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
- package/dist/src/cli/dev/tui/test/fake-setup-flow-renderer.js +1 -1
- package/dist/src/cli/dev/tui/tui-prompter.js +1 -1
- package/dist/src/cli/dev/tui/tui.d.ts +2 -0
- package/dist/src/cli/dev/tui/tui.js +1 -1
- package/dist/src/cli/dev/tui/vercel-status.d.ts +1 -6
- package/dist/src/cli/dev/tui/vercel-status.js +1 -1
- package/dist/src/cli/invoke/result.d.ts +15 -0
- package/dist/src/cli/invoke/result.js +1 -1
- package/dist/src/cli/option-parsers.d.ts +11 -0
- package/dist/src/cli/option-parsers.js +1 -0
- package/dist/src/cli/run.d.ts +1 -12
- package/dist/src/cli/run.js +3 -3
- package/dist/src/cli/shutdown.d.ts +2 -0
- package/dist/src/cli/shutdown.js +1 -1
- package/dist/src/client/eve-agent-store.d.ts +7 -4
- package/dist/src/client/eve-agent-store.js +1 -1
- package/dist/src/client/index.d.ts +3 -3
- package/dist/src/client/index.js +1 -1
- package/dist/src/client/message-action-parts.js +1 -1
- package/dist/src/client/message-reducer-types.d.ts +5 -3
- package/dist/src/client/message-response.d.ts +4 -4
- package/dist/src/client/ndjson.d.ts +3 -3
- package/dist/src/client/open-stream.d.ts +2 -2
- package/dist/src/client/output-schema.d.ts +2 -2
- package/dist/src/client/reducer.d.ts +2 -2
- package/dist/src/client/session-utils.d.ts +5 -5
- package/dist/src/client/session.d.ts +2 -2
- package/dist/src/client/types.d.ts +2 -2
- package/dist/src/compiled/.vendor-stamp.json +5 -5
- package/dist/src/compiled/@workflow/core/index.js +1 -1
- package/dist/src/compiled/@workflow/core/private.d.ts +21 -5
- package/dist/src/compiled/@workflow/core/private.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime/world.d.ts +10 -5
- package/dist/src/compiled/@workflow/core/runtime.js +3 -3
- package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +2 -2
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/world-local/index.js +3 -3
- package/dist/src/compiled/@workflow/world-vercel/index.js +13 -13
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-DeZc2RZz.js → attribute-changes-1LmTKuTT.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{private-Cre8uYkA.js → private-BcwCGTV5.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{resume-hook-ip1hbn1b.js → resume-hook-D1_5NCZ6.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{run-CWytxfIp.js → run-C240Ctf4.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/sleep-De802yfX.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{wait-until-De9yESQN.js → wait-until-z48sPUjU.js} +2 -2
- package/dist/src/compiled/shadcn-registry/index.d.ts +1 -0
- package/dist/src/compiler/compile-from-memory.d.ts +1 -0
- package/dist/src/compiler/extension-compatibility.d.ts +8 -8
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.d.ts +2 -2
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/context/dynamic-instruction-lifecycle.d.ts +2 -2
- package/dist/src/context/dynamic-model-lifecycle.d.ts +2 -2
- package/dist/src/context/dynamic-skill-lifecycle.d.ts +2 -2
- package/dist/src/context/dynamic-tool-lifecycle.d.ts +2 -2
- package/dist/src/context/hook-lifecycle.d.ts +2 -2
- package/dist/src/evals/assertions/collector.d.ts +2 -10
- package/dist/src/evals/assertions/collector.js +1 -1
- package/dist/src/evals/assertions/run.d.ts +3 -3
- package/dist/src/evals/cli/eval.d.ts +6 -2
- package/dist/src/evals/cli/eval.js +2 -2
- package/dist/src/evals/cli/filter.d.ts +14 -0
- package/dist/src/evals/cli/filter.js +1 -0
- package/dist/src/evals/context.js +1 -1
- package/dist/src/evals/diagnostics.d.ts +8 -0
- package/dist/src/evals/diagnostics.js +1 -0
- package/dist/src/evals/expect/index.d.ts +1 -1
- package/dist/src/evals/expect/index.js +1 -1
- package/dist/src/evals/index.d.ts +1 -1
- package/dist/src/evals/judge.js +2 -1
- package/dist/src/evals/match.d.ts +4 -4
- package/dist/src/evals/runner/artifacts.js +1 -1
- package/dist/src/evals/runner/derive-run-facts.d.ts +2 -2
- package/dist/src/evals/runner/reporters/assertion-diagnostics.d.ts +3 -0
- package/dist/src/evals/runner/reporters/assertion-diagnostics.js +3 -0
- package/dist/src/evals/runner/reporters/braintrust.js +1 -1
- package/dist/src/evals/runner/reporters/console.js +1 -1
- package/dist/src/evals/runner/reporters/junit.js +2 -2
- package/dist/src/evals/session.d.ts +3 -3
- package/dist/src/evals/types.d.ts +33 -17
- package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
- package/dist/src/execution/route-child-delivery.d.ts +4 -3
- package/dist/src/execution/route-child-delivery.js +1 -1
- package/dist/src/execution/session-delivery-hook.d.ts +1 -0
- package/dist/src/execution/session-delivery-hook.js +1 -1
- package/dist/src/execution/session-timeout-control.d.ts +9 -0
- package/dist/src/execution/session-timeout-control.js +1 -0
- package/dist/src/execution/session-timeout-steps.d.ts +13 -0
- package/dist/src/execution/session-timeout-steps.js +1 -0
- package/dist/src/execution/session-timeout-workflow.d.ts +6 -0
- package/dist/src/execution/session-timeout-workflow.js +1 -0
- package/dist/src/execution/session-timeout.d.ts +2 -0
- package/dist/src/execution/session-timeout.js +1 -0
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/subagent-event-proxy-step.js +1 -1
- package/dist/src/execution/subagent-hitl-proxy.d.ts +5 -1
- package/dist/src/execution/subagent-hitl-proxy.js +1 -1
- package/dist/src/execution/terminal-session-completion-step.d.ts +5 -0
- package/dist/src/execution/terminal-session-completion-step.js +1 -0
- package/dist/src/execution/terminal-session-failure-step.js +1 -1
- package/dist/src/execution/turn-cancellation-control.js +1 -1
- package/dist/src/execution/turn-workflow.js +1 -1
- package/dist/src/execution/workflow-entry.d.ts +1 -0
- package/dist/src/execution/workflow-entry.js +1 -1
- package/dist/src/execution/workflow-runtime.d.ts +4 -0
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.d.ts +12 -2
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/agent-otel-provider.js +1 -1
- package/dist/src/harness/ai-sdk-hook-bridge.js +1 -1
- package/dist/src/harness/input-extraction.js +1 -1
- package/dist/src/harness/input-request-class.d.ts +23 -0
- package/dist/src/harness/input-request-class.js +1 -0
- package/dist/src/harness/input-requests.d.ts +20 -9
- package/dist/src/harness/input-requests.js +1 -1
- package/dist/src/harness/instrumentation-lifecycle.d.ts +12 -1
- package/dist/src/harness/proxy-input-requests.d.ts +10 -4
- package/dist/src/harness/proxy-input-requests.js +1 -1
- package/dist/src/harness/session-limit-continuation.d.ts +0 -11
- package/dist/src/harness/session-limit-continuation.js +1 -1
- package/dist/src/harness/session-limit-enforcement.d.ts +3 -2
- package/dist/src/harness/session-limit-enforcement.js +1 -1
- package/dist/src/harness/session-token-limits.d.ts +41 -0
- package/dist/src/harness/session-token-limits.js +1 -0
- package/dist/src/harness/stale-input-responses.js +1 -1
- package/dist/src/harness/subagent-token-budget.d.ts +6 -4
- package/dist/src/harness/subagent-token-budget.js +1 -1
- package/dist/src/harness/tool-loop.js +1 -1
- package/dist/src/harness/turn-sleep.d.ts +12 -0
- package/dist/src/harness/turn-sleep.js +1 -0
- package/dist/src/harness/turn-tag-state.d.ts +26 -17
- package/dist/src/harness/turn-tag-state.js +1 -1
- package/dist/src/harness/types.d.ts +4 -4
- package/dist/src/harness/workflow-lifecycle.d.ts +2 -2
- package/dist/src/internal/application/compiled-artifacts.js +7 -7
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/core.js +1 -1
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.d.ts +4 -0
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
- package/dist/src/internal/nitro/host/start-development-server.js +2 -2
- package/dist/src/internal/workflow/development-world-protocol.js +1 -1
- package/dist/src/internal/workflow/world-target.d.ts +7 -0
- package/dist/src/internal/workflow/world-target.js +1 -0
- package/dist/src/internal/workflow-bundle/workflow-core-shim.d.ts +1 -1
- package/dist/src/internal/workflow-bundle/workflow-core-shim.js +1 -1
- package/dist/src/protocol/event-dedupe.d.ts +25 -0
- package/dist/src/protocol/event-dedupe.js +1 -0
- package/dist/src/protocol/event-id.d.ts +16 -0
- package/dist/src/protocol/event-id.js +1 -0
- package/dist/src/protocol/message.d.ts +39 -23
- package/dist/src/protocol/message.js +2 -2
- package/dist/src/protocol/routes.d.ts +4 -0
- package/dist/src/protocol/routes.js +1 -1
- package/dist/src/public/channels/discord/discordChannel.d.ts +3 -3
- package/dist/src/public/channels/github/githubChannel.d.ts +3 -3
- package/dist/src/public/channels/linear/linearChannel.d.ts +3 -3
- package/dist/src/public/channels/slack/hitl.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.d.ts +3 -3
- package/dist/src/public/channels/teams/hitl.js +1 -1
- package/dist/src/public/channels/teams/teamsChannel.d.ts +3 -3
- package/dist/src/public/channels/telegram/telegramChannel.d.ts +3 -3
- package/dist/src/public/channels/twilio/twilioChannel.d.ts +3 -3
- package/dist/src/public/definitions/channel.d.ts +4 -4
- package/dist/src/public/definitions/hook.d.ts +2 -2
- package/dist/src/public/tools/sleep/index.d.ts +18 -0
- package/dist/src/public/tools/sleep/index.js +1 -0
- package/dist/src/react/use-eve-agent.d.ts +3 -2
- package/dist/src/runtime/framework-tools/ask-question.js +1 -1
- package/dist/src/runtime/framework-tools/sleep.d.ts +15 -0
- package/dist/src/runtime/framework-tools/sleep.js +1 -0
- package/dist/src/runtime/hooks/registry.d.ts +2 -2
- package/dist/src/runtime/input/types.d.ts +19 -4
- package/dist/src/runtime/input/types.js +1 -1
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/types.d.ts +2 -2
- package/dist/src/services/dev-client/runtime-artifacts.d.ts +7 -0
- package/dist/src/services/dev-client/runtime-artifacts.js +1 -1
- package/dist/src/setup/boxes/apply-ai-gateway-credential.js +1 -1
- package/dist/src/setup/boxes/deploy-project.d.ts +3 -3
- package/dist/src/setup/flows/deploy.js +1 -1
- package/dist/src/setup/flows/ensure-vercel-project.d.ts +17 -0
- package/dist/src/setup/flows/ensure-vercel-project.js +1 -0
- package/dist/src/setup/flows/in-project.d.ts +1 -1
- package/dist/src/setup/flows/link.js +1 -1
- package/dist/src/setup/flows/model.js +1 -1
- package/dist/src/setup/flows/provider.js +1 -1
- package/dist/src/setup/flows/registry.d.ts +20 -0
- package/dist/src/setup/flows/registry.js +1 -0
- package/dist/src/setup/index.d.ts +0 -1
- package/dist/src/setup/index.js +1 -1
- package/dist/src/setup/{channel-setup-environment.d.ts → integrations/channels/environment.d.ts} +2 -2
- package/dist/src/setup/integrations/channels/environment.js +1 -0
- package/dist/src/setup/{channel-setup-integrations.d.ts → integrations/channels/index.d.ts} +3 -3
- package/dist/src/setup/integrations/channels/index.js +1 -0
- package/dist/src/setup/{channel-setup-runner.d.ts → integrations/channels/runner.d.ts} +1 -1
- package/dist/src/setup/integrations/channels/runner.js +1 -0
- package/dist/src/setup/{boxes/add-channels.d.ts → integrations/channels/setup.d.ts} +32 -22
- package/dist/src/setup/integrations/channels/setup.js +2 -0
- package/dist/src/setup/{channel-setup-slack.d.ts → integrations/channels/slack.d.ts} +1 -1
- package/dist/src/setup/integrations/channels/slack.js +1 -0
- package/dist/src/setup/{channel-setup-integration.d.ts → integrations/channels/types.d.ts} +23 -7
- package/dist/src/setup/{channel-setup-ui.d.ts → integrations/channels/ui.d.ts} +2 -2
- package/dist/src/setup/integrations/channels/ui.js +2 -0
- package/dist/src/setup/{channel-setup-web.d.ts → integrations/channels/web.d.ts} +1 -1
- package/dist/src/setup/integrations/channels/web.js +1 -0
- package/dist/src/setup/primitives/run-vercel.d.ts +1 -0
- package/dist/src/setup/primitives/run-vercel.js +1 -1
- package/dist/src/setup/prompter.d.ts +16 -3
- package/dist/src/setup/prompter.js +1 -1
- package/dist/src/setup/registry-setup-client.d.ts +18 -0
- package/dist/src/setup/registry-setup-client.js +2 -0
- package/dist/src/setup/registry-setup-protocol.d.ts +93 -0
- package/dist/src/setup/registry-setup-protocol.js +1 -0
- package/dist/src/setup/scaffold/channels-catalog.d.ts +1 -1
- package/dist/src/setup/scaffold/create/extension.js +2 -2
- package/dist/src/setup/scaffold/create/project.js +2 -2
- package/dist/src/setup/scaffold/create/web-template.d.ts +1 -1
- package/dist/src/setup/scaffold/create/web-template.js +2 -2
- package/dist/src/setup/scaffold/create-in-place.d.ts +1 -0
- package/dist/src/setup/scaffold/create-in-place.js +1 -0
- package/dist/src/setup/scaffold/index.js +1 -1
- package/dist/src/setup/scaffold/update/connections.js +3 -3
- package/dist/src/setup/scaffold/update/update-connection-connector.js +1 -1
- package/dist/src/setup/vercel-project-framework.d.ts +1 -1
- package/dist/src/setup/vercel-project-framework.js +1 -1
- package/dist/src/setup/vercel-project.d.ts +17 -2
- package/dist/src/setup/vercel-project.js +0 -0
- package/dist/src/shared/agent-definition.d.ts +12 -0
- package/dist/src/shared/dynamic-tool-definition.d.ts +2 -2
- package/dist/src/shared/ulid.d.ts +39 -0
- package/dist/src/shared/ulid.js +1 -0
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.d.ts +4 -4
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.d.ts +4 -4
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/agent-config.md +28 -16
- package/docs/channels/overview.mdx +1 -1
- package/docs/channels/slack.mdx +2 -2
- package/docs/concepts/default-harness.md +12 -0
- package/docs/concepts/execution-model-and-durability.mdx +1 -1
- package/docs/concepts/sessions-runs-and-streaming.md +61 -0
- package/docs/evals/assertions.mdx +8 -1
- package/docs/evals/judge.mdx +11 -1
- package/docs/evals/reporters.mdx +1 -1
- package/docs/evals/running.mdx +3 -0
- package/docs/guides/client/streaming.mdx +9 -3
- package/docs/guides/dev-tui.md +9 -14
- package/docs/guides/frontend/overview.mdx +4 -2
- package/docs/guides/frontend/use-eve-agent-svelte.mdx +1 -1
- package/docs/guides/frontend/use-eve-agent-vue.mdx +10 -10
- package/docs/guides/hooks.md +40 -2
- package/docs/guides/instrumentation.md +5 -1
- package/docs/reference/cli.md +25 -38
- package/docs/reference/typescript-api.md +2 -1
- package/docs/tools/human-in-the-loop.md +5 -0
- package/docs/tutorial/ship-it.mdx +2 -2
- package/package.json +11 -6
- package/dist/src/compiled/@workflow/core/runtime/world-target.d.ts +0 -11
- package/dist/src/compiled/_chunks/workflow/sleep-BjrUxUcs.js +0 -1
- package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.7/node_modules/@workflow/utils/dist/index.js +0 -1
- package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.7/node_modules/@workflow/utils/dist/parse-name.js +0 -1
- package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.7/node_modules/@workflow/utils/dist/promise.js +0 -1
- package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.7/node_modules/@workflow/utils/dist/time.js +0 -1
- package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.7/node_modules/@workflow/utils/dist/workflow-routes.js +0 -1
- package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.7/node_modules/@workflow/utils/dist/world-target.js +0 -1
- package/dist/src/node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js +0 -1
- package/dist/src/setup/boxes/add-channels.js +0 -2
- package/dist/src/setup/boxes/add-connections.d.ts +0 -26
- package/dist/src/setup/boxes/add-connections.js +0 -1
- package/dist/src/setup/boxes/install-channel-registry-items.d.ts +0 -8
- package/dist/src/setup/boxes/install-channel-registry-items.js +0 -1
- package/dist/src/setup/boxes/one-shot-next-steps.d.ts +0 -18
- package/dist/src/setup/boxes/one-shot-next-steps.js +0 -2
- package/dist/src/setup/boxes/preflight.d.ts +0 -37
- package/dist/src/setup/boxes/preflight.js +0 -1
- package/dist/src/setup/boxes/resolve-target.d.ts +0 -58
- package/dist/src/setup/boxes/resolve-target.js +0 -1
- package/dist/src/setup/boxes/scaffold.d.ts +0 -40
- package/dist/src/setup/boxes/scaffold.js +0 -1
- package/dist/src/setup/boxes/select-channels.d.ts +0 -49
- package/dist/src/setup/boxes/select-channels.js +0 -1
- package/dist/src/setup/boxes/select-chat.d.ts +0 -38
- package/dist/src/setup/boxes/select-chat.js +0 -1
- package/dist/src/setup/boxes/select-connections.d.ts +0 -30
- package/dist/src/setup/boxes/select-connections.js +0 -1
- package/dist/src/setup/boxes/select-setup-mode.d.ts +0 -32
- package/dist/src/setup/boxes/select-setup-mode.js +0 -1
- package/dist/src/setup/channel-setup-deployment.d.ts +0 -11
- package/dist/src/setup/channel-setup-deployment.js +0 -1
- package/dist/src/setup/channel-setup-environment.js +0 -1
- package/dist/src/setup/channel-setup-integration.js +0 -1
- package/dist/src/setup/channel-setup-integrations.js +0 -1
- package/dist/src/setup/channel-setup-runner.js +0 -1
- package/dist/src/setup/channel-setup-slack.js +0 -1
- package/dist/src/setup/channel-setup-ui.js +0 -2
- package/dist/src/setup/channel-setup-web.js +0 -1
- package/dist/src/setup/flows/channels.d.ts +0 -57
- package/dist/src/setup/flows/channels.js +0 -1
- package/dist/src/setup/flows/connections.d.ts +0 -37
- package/dist/src/setup/flows/connections.js +0 -3
- package/dist/src/setup/onboarding.d.ts +0 -60
- package/dist/src/setup/onboarding.js +0 -1
- /package/dist/src/{node_modules/.pnpm/@workflow_utils@5.0.0-beta.7/node_modules/@workflow/utils/dist/pluralize.js → setup/integrations/channels/types.js} +0 -0
|
@@ -2,7 +2,7 @@ import type { ModelMessage } from "ai";
|
|
|
2
2
|
import type { AlsContext } from "#context/container.js";
|
|
3
3
|
import type { ContextKey } from "#context/key.js";
|
|
4
4
|
import { type LiveDynamicModelSelection } from "#context/keys.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { UnstampedMessageStreamEvent } from "#protocol/message.js";
|
|
6
6
|
import type { RuntimeDynamicModelReference, RuntimeModelReference } from "#runtime/agent/bootstrap.js";
|
|
7
7
|
import { type RuntimeModelResolutionScope } from "#runtime/agent/resolve-model.js";
|
|
8
8
|
export type ActiveDynamicModelSelection = LiveDynamicModelSelection;
|
|
@@ -12,7 +12,7 @@ export declare function getActiveDynamicModelSelection(ctx: {
|
|
|
12
12
|
export declare function dispatchDynamicModelEvent(input: {
|
|
13
13
|
readonly ctx: AlsContext;
|
|
14
14
|
readonly dynamicModel: RuntimeDynamicModelReference | undefined;
|
|
15
|
-
readonly event:
|
|
15
|
+
readonly event: UnstampedMessageStreamEvent;
|
|
16
16
|
readonly fallback: RuntimeModelReference;
|
|
17
17
|
readonly messages: readonly ModelMessage[];
|
|
18
18
|
readonly scope: RuntimeModelResolutionScope;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ModelMessage } from "ai";
|
|
2
|
-
import type {
|
|
2
|
+
import type { UnstampedMessageStreamEvent } from "#protocol/message.js";
|
|
3
3
|
import type { ResolvedDynamicSkillResolver } from "#runtime/types.js";
|
|
4
4
|
import type { ContextContainer } from "#context/container.js";
|
|
5
5
|
import { ContextKey } from "#context/key.js";
|
|
@@ -19,6 +19,6 @@ export declare const PendingSkillAnnouncementKey: ContextKey<string>;
|
|
|
19
19
|
export declare function dispatchDynamicSkillEvent(input: {
|
|
20
20
|
readonly ctx: ContextContainer;
|
|
21
21
|
readonly resolvers: readonly ResolvedDynamicSkillResolver[];
|
|
22
|
-
readonly event:
|
|
22
|
+
readonly event: UnstampedMessageStreamEvent;
|
|
23
23
|
readonly messages: readonly ModelMessage[];
|
|
24
24
|
}): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ModelMessage } from "ai";
|
|
2
2
|
import type { HarnessToolDefinition } from "#harness/execute-tool.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { UnstampedMessageStreamEvent, SessionStartedStreamEvent } from "#protocol/message.js";
|
|
4
4
|
import type { ResolvedDynamicToolResolver } from "#runtime/types.js";
|
|
5
5
|
import type { ContextContainer } from "#context/container.js";
|
|
6
6
|
import type { DurableDynamicToolMetadata } from "#context/keys.js";
|
|
@@ -20,7 +20,7 @@ export declare function replayDynamicSessionTools(metadata: readonly DurableDyna
|
|
|
20
20
|
export declare function dispatchDynamicToolEvent(input: {
|
|
21
21
|
readonly ctx: ContextContainer;
|
|
22
22
|
readonly resolvers: readonly ResolvedDynamicToolResolver[];
|
|
23
|
-
readonly event:
|
|
23
|
+
readonly event: UnstampedMessageStreamEvent;
|
|
24
24
|
readonly messages: readonly ModelMessage[];
|
|
25
25
|
}): Promise<void>;
|
|
26
26
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MessageStreamEvent } from "#protocol/message.js";
|
|
2
2
|
import type { RuntimeHookRegistry } from "#runtime/hooks/registry.js";
|
|
3
3
|
import type { ContextContainer } from "./container.js";
|
|
4
4
|
/**
|
|
@@ -10,5 +10,5 @@ import type { ContextContainer } from "./container.js";
|
|
|
10
10
|
export declare function dispatchStreamEventHooks(input: {
|
|
11
11
|
readonly ctx: ContextContainer;
|
|
12
12
|
readonly registry: RuntimeHookRegistry;
|
|
13
|
-
readonly event:
|
|
13
|
+
readonly event: MessageStreamEvent;
|
|
14
14
|
}): Promise<void>;
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import type { AssertionHandle, AssertionResult, AssertionSeverity, EveEvalTaskResult } from "#evals/types.js";
|
|
1
|
+
import type { AssertionEvaluation, AssertionHandle, AssertionResult, AssertionSeverity, EveEvalTaskResult } from "#evals/types.js";
|
|
2
2
|
import type { EveEvalAssertionSubject } from "#evals/assertions/run.js";
|
|
3
|
-
|
|
4
|
-
* Outcome of evaluating one assertion: a 0–1 score (boolean assertions use
|
|
5
|
-
* exactly 0 or 1) with optional human-readable detail and metadata.
|
|
6
|
-
*/
|
|
7
|
-
export interface AssertionOutcome {
|
|
8
|
-
readonly score: number;
|
|
9
|
-
readonly message?: string;
|
|
10
|
-
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
11
|
-
}
|
|
3
|
+
export type AssertionOutcome = AssertionEvaluation;
|
|
12
4
|
/**
|
|
13
5
|
* A scoped assertion evaluated lazily after `test(t)` returns. The selected
|
|
14
6
|
* subject may be the aggregate run, one session, or one immutable turn.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toErrorMessage}from"#shared/errors.js";var AssertionCollector=class{#e=[];#t=[];get hasEntries(){return this.#e.length>0}recordScoped(e,t,n=`gate`){let r={name:e.name,severity:n,threshold:void 0,kind:`deferred`,spec:e,selectSubject:t,score:0,failed:!1};return this.#e.push(r),makeHandle(r)}recordValue(e){let t={name:e.name,severity:e.severity,threshold:e.threshold,kind:`resolved`,score:0,failed:!1};this.#e.push(t);let n=settleEntry(t,e.score);return this.#t.push(n),makeHandle(t)}recordOutcome(e){let t={name:e.name,severity:`gate`,threshold:void 0,kind:`resolved`,score:e.outcome.score,message:e.outcome.message,metadata:e.outcome.metadata,failed:!1};return this.#e.push(t),computePassed(t.severity,t.threshold,t.score,t.failed)}async recordRequirement(e){let t={name:e.name,severity:`gate`,threshold:e.threshold,kind:`resolved`,score:0,failed:!1};return this.#e.push(t),await settleEntry(t,e.score),computePassed(t.severity,t.threshold,t.score,t.failed)}async finalize(e){await Promise.all(this.#t);let t=[];for(let n of this.#e){if(n.kind===`deferred`&&n.spec!==void 0){let t=await n.spec.evaluate(n.selectSubject?.(e)??e);n.score=t.score,n.message=t.message,n.metadata=t.metadata}t.push({name:n.name,score:n.score,severity:n.severity,threshold:n.threshold,passed:computePassed(n.severity,n.threshold,n.score,n.failed),message:n.message,metadata:n.metadata})}return t}};function computePassed(e,t,n,r){if(r)return!1;let i=t??(e===`gate`?1:void 0);return i===void 0||n>=i}async function settleEntry(t,n){try{let e=await n();t.score=e.score,t.message=e.message,t.metadata=e.metadata}catch(n){t.score=0,t.severity=`gate`,t.threshold=void 0,t.message=toErrorMessage(n),t.failed=!0}}function makeHandle(e){let
|
|
1
|
+
import{toErrorMessage}from"#shared/errors.js";import{formatAssertionName}from"#evals/diagnostics.js";var AssertionCollector=class{#e=[];#t=[];get hasEntries(){return this.#e.length>0}recordScoped(e,t,n=`gate`){let r={baseName:e.name,name:e.name,severity:n,threshold:void 0,kind:`deferred`,spec:e,selectSubject:t,score:0,failed:!1};return this.#e.push(r),makeHandle(r)}recordValue(e){let t={baseName:e.name,name:e.name,severity:e.severity,threshold:e.threshold,kind:`resolved`,score:0,failed:!1};this.#e.push(t);let n=settleEntry(t,e.score);return this.#t.push(n),makeHandle(t)}recordOutcome(e){let t={baseName:e.name,name:e.name,severity:`gate`,threshold:void 0,kind:`resolved`,score:e.outcome.score,message:e.outcome.message,metadata:e.outcome.metadata,failed:!1};return this.#e.push(t),computePassed(t.severity,t.threshold,t.score,t.failed)}async recordRequirement(e){let t={baseName:e.name,name:e.name,severity:`gate`,threshold:e.threshold,kind:`resolved`,score:0,failed:!1};return this.#e.push(t),await settleEntry(t,e.score),computePassed(t.severity,t.threshold,t.score,t.failed)}async finalize(e){await Promise.all(this.#t);let t=[];for(let n of this.#e){if(n.kind===`deferred`&&n.spec!==void 0){let t=await n.spec.evaluate(n.selectSubject?.(e)??e);n.score=t.score,n.message=t.message,n.metadata=t.metadata}t.push({name:n.name,score:n.score,severity:n.severity,threshold:n.threshold,passed:computePassed(n.severity,n.threshold,n.score,n.failed),message:n.message,metadata:n.metadata})}return t}};function computePassed(e,t,n,r){if(r)return!1;let i=t??(e===`gate`?1:void 0);return i===void 0||n>=i}async function settleEntry(t,n){try{let e=await n();t.score=e.score,t.message=e.message,t.metadata=e.metadata}catch(n){t.score=0,t.severity=`gate`,t.threshold=void 0,t.message=toErrorMessage(n),t.failed=!0}}function makeHandle(e){let n={gate(t){return e.severity=`gate`,e.threshold=t,n},soft(t){return e.severity=`soft`,e.threshold=t,n},atLeast(t){return e.severity=`soft`,e.threshold=t,n},label(r){return e.name=formatAssertionName(e.baseName,r),n}};return n}export{AssertionCollector};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { StandardSchemaV1 } from "#compiled/@standard-schema/spec/index.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { MessageStreamEvent } from "#protocol/message.js";
|
|
3
3
|
import { type EveEvalSkillLoadMatchOptions, type EveEvalSubagentCallMatchOptions, type EveEvalToolCallMatchOptions } from "#evals/match.js";
|
|
4
4
|
import type { EveEvalEventMatch } from "#evals/match.js";
|
|
5
5
|
import type { RunAssertion } from "#evals/assertions/collector.js";
|
|
6
6
|
/** Minimal captured scope consumed by deterministic eval assertions. */
|
|
7
7
|
export interface EveEvalAssertionSubject {
|
|
8
8
|
readonly derived: import("#evals/types.js").EveEvalDerivedFacts;
|
|
9
|
-
readonly events: readonly
|
|
9
|
+
readonly events: readonly MessageStreamEvent[];
|
|
10
10
|
readonly output: unknown;
|
|
11
11
|
readonly status: "completed" | "failed" | "waiting";
|
|
12
12
|
}
|
|
@@ -68,7 +68,7 @@ export declare function calledSubagent(name: string, options?: EveEvalSubagentCa
|
|
|
68
68
|
* Escape hatch: asserts an arbitrary predicate over the full typed event
|
|
69
69
|
* stream. `label` names the assertion in reports.
|
|
70
70
|
*/
|
|
71
|
-
export declare function eventsSatisfy(label: string, predicate: (events: readonly
|
|
71
|
+
export declare function eventsSatisfy(label: string, predicate: (events: readonly MessageStreamEvent[]) => boolean): RunAssertion;
|
|
72
72
|
/** Asserts a typed stream event exists, optionally constraining its count. */
|
|
73
73
|
export declare function typedEvent(matcher: EveEvalEventMatch): RunAssertion;
|
|
74
74
|
/** Asserts no typed stream event matches. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/** Parsed Commander options accepted by {@link runEvalCommand}. */
|
|
2
|
+
export interface EvalCliOptions {
|
|
2
3
|
url?: string;
|
|
3
4
|
timeout?: string;
|
|
4
5
|
maxConcurrency?: string;
|
|
@@ -8,6 +9,7 @@ interface EvalCliOptions {
|
|
|
8
9
|
strict?: boolean;
|
|
9
10
|
list?: boolean;
|
|
10
11
|
tag?: string[];
|
|
12
|
+
excludeTag?: string[];
|
|
11
13
|
verbose?: boolean;
|
|
12
14
|
}
|
|
13
15
|
type EvalCliLogger = {
|
|
@@ -19,7 +21,9 @@ type EvalCliLogger = {
|
|
|
19
21
|
*
|
|
20
22
|
* Exit codes: `0` when every executed eval passed its gate assertions (and
|
|
21
23
|
* soft thresholds under `--strict`), `1` when any eval failed, `2` for runner
|
|
22
|
-
* or configuration errors (no evals discovered, no evals matching
|
|
24
|
+
* or configuration errors (no evals discovered, no evals matching `--tag`).
|
|
25
|
+
* When `--exclude-tag` removes every matching eval the run succeeds with
|
|
26
|
+
* nothing executed.
|
|
23
27
|
*/
|
|
24
28
|
export declare function runEvalCommand(evalIds: readonly string[], options: EvalCliOptions, logger: EvalCliLogger): Promise<void>;
|
|
25
29
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{basename,join}from"node:path";import{readFile}from"node:fs/promises";import{createDevelopmentServer}from"#internal/nitro/host.js";import{loadDevelopmentEnvironmentFiles}from"#cli/dev/environment.js";import{resolveApplicationRoot}from"#internal/application/paths.js";import{shutdownActiveSandboxHandles}from"#execution/sandbox/active-handles.js";import{createEvalClient}from"#evals/cli/eval-client.js";import{discoverAndImportEvals,discoverEvalConfig,findMisplacedEvalDirs}from"#evals/runner/discover.js";import{runEvals}from"#evals/runner/run-evals.js";import{Console}from"#evals/runner/reporters/console.js";import{JUnit}from"#evals/runner/reporters/junit.js";import{resolveEvalTargetHandle}from"#evals/target.js";async function runEvalCommand(e,t,n){let s=resolveApplicationRoot();loadDevelopmentEnvironmentFiles(s);let c=e.length>0?e:void 0,l=await discoverAndImportEvals(s,c);if(l.length===0){let e=await findMisplacedEvalDirs(s);e.length>0?n.error(`No evals found under evals/, but eval files are present inside agent/:
|
|
1
|
+
import{basename,join}from"node:path";import{readFile}from"node:fs/promises";import{createDevelopmentServer}from"#internal/nitro/host.js";import{loadDevelopmentEnvironmentFiles}from"#cli/dev/environment.js";import{resolveApplicationRoot}from"#internal/application/paths.js";import{shutdownActiveSandboxHandles}from"#execution/sandbox/active-handles.js";import{createEvalClient}from"#evals/cli/eval-client.js";import{filterEvalsByTags}from"#evals/cli/filter.js";import{discoverAndImportEvals,discoverEvalConfig,findMisplacedEvalDirs}from"#evals/runner/discover.js";import{runEvals}from"#evals/runner/run-evals.js";import{Console}from"#evals/runner/reporters/console.js";import{JUnit}from"#evals/runner/reporters/junit.js";import{resolveEvalTargetHandle}from"#evals/target.js";async function runEvalCommand(e,t,n){let s=resolveApplicationRoot();loadDevelopmentEnvironmentFiles(s);let c=e.length>0?e:void 0,l=await discoverAndImportEvals(s,c);if(l.length===0){let e=await findMisplacedEvalDirs(s);e.length>0?n.error(`No evals found under evals/, but eval files are present inside agent/:
|
|
2
2
|
`+e.map(e=>` - ${e}`).join(`
|
|
3
3
|
`)+`
|
|
4
|
-
eve eval only scans the top-level evals/ directory (a sibling of agent/). Move these files there.`):c?n.error(`No evals found matching: ${c.join(`, `)}`):n.error(`No evals found. Create files under evals/ with the *.eval.ts extension.`),process.exitCode=2;return}let u=
|
|
4
|
+
eve eval only scans the top-level evals/ directory (a sibling of agent/). Move these files there.`):c?n.error(`No evals found matching: ${c.join(`, `)}`):n.error(`No evals found. Create files under evals/ with the *.eval.ts extension.`),process.exitCode=2;return}let u=t.tag??[],d=t.excludeTag??[],f=filterEvalsByTags({evaluations:l,includeTags:u,excludeTags:[]});if(f.length===0){n.error(`No evals matched the provided tags (${u.join(`, `)}).`),process.exitCode=2;return}let p=filterEvalsByTags({evaluations:f,includeTags:[],excludeTags:d});if(t.list===!0){printEvalList(p,t.json===!0,n);return}if(p.length===0){n.log(`All ${f.length} matching evals are excluded by tags (${d.join(`, `)}); nothing to run.`);return}let m,h;try{m=parsePositiveInteger(t.maxConcurrency,`--max-concurrency`),h=parseNonNegativeInteger(t.timeout,`--timeout`)}catch(e){n.error(e instanceof Error?e.message:String(e)),process.exitCode=2;return}let g;try{g=await discoverEvalConfig(s)}catch(e){n.error(e instanceof Error?e.message:String(e)),process.exitCode=2;return}let _,v,y;try{if(t.url)y=await createEvalClient({kind:`remote`,url:t.url},{workspaceRoot:s}),v=await resolveEvalTargetHandle({client:y,expectedAgentName:await readExpectedAgentName(s),kind:`remote`,url:t.url});else{_=createDevelopmentServer(s,{host:`127.0.0.1`,port:0});let e=await _.start();y=await createEvalClient({kind:`local`,url:e.url}),v=await resolveEvalTargetHandle({client:y,expectedAgentName:await readExpectedAgentName(s),kind:`local`,url:e.url})}let e=t.json===!0?[]:[Console()];t.junit!==void 0&&e.push(JUnit({filePath:t.junit}));let i=await runEvals({evaluations:p,config:g,target:v,client:y,appRoot:s,reporters:e,includeEvalReporters:t.skipReport!==!0,maxConcurrency:m,timeoutMs:h,onEvalLog:t.verbose===!0?(e,t)=>n.log(`[${e}] ${t}`):void 0});t.json&&n.log(JSON.stringify(i,null,2));let a=i.failed>0,o=t.strict===!0&&i.scored>0;(a||o)&&(process.exitCode=1)}finally{_&&(await _.close(),await shutdownActiveSandboxHandles({log:e=>n.error(e)}))}let b=typeof process.exitCode==`number`?process.exitCode:0;process.exit(b)}function parsePositiveInteger(e,t){if(e===void 0)return;let n=Number(e);if(!Number.isInteger(n)||n<1)throw Error(`${t} must be a positive integer; got "${e}".`);return n}function parseNonNegativeInteger(e,t){if(e===void 0)return;let n=Number(e);if(!Number.isInteger(n)||n<0)throw Error(`${t} must be a non-negative integer; got "${e}".`);return n}function printEvalList(e,t,n){if(t){let t=e.map(e=>({id:e.id,description:e.description,tags:e.tags}));n.log(JSON.stringify(t,null,2));return}for(let t of e){let e=t.description===void 0?``:` — ${t.description}`,r=t.tags!==void 0&&t.tags.length>0?` [${t.tags.join(`, `)}]`:``;n.log(`${t.id}${r}${e}`)}}async function readExpectedAgentName(r){try{let i=JSON.parse(await readFile(join(r,`package.json`),`utf8`));return typeof i.name==`string`&&i.name.length>0?i.name:basename(r)}catch{return basename(r)}}export{runEvalCommand};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { EveEval } from "#evals/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Applies `--tag` and `--exclude-tag` filtering for the `eve eval` command.
|
|
4
|
+
*
|
|
5
|
+
* An eval runs when it carries at least one `includeTags` entry (or no
|
|
6
|
+
* include filter is given) and carries none of the `excludeTags` entries.
|
|
7
|
+
* Exclusion wins over inclusion so suite-level runs (e.g. a mock-model world
|
|
8
|
+
* suite excluding `real-model` evals) can never pull in an excluded eval.
|
|
9
|
+
*/
|
|
10
|
+
export declare function filterEvalsByTags(input: {
|
|
11
|
+
readonly evaluations: readonly EveEval[];
|
|
12
|
+
readonly includeTags: readonly string[];
|
|
13
|
+
readonly excludeTags: readonly string[];
|
|
14
|
+
}): EveEval[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function filterEvalsByTags(e){return e.evaluations.filter(t=>{let n=t.tags??[];return e.includeTags.length>0&&!n.some(t=>e.includeTags.includes(t))?!1:!n.some(t=>e.excludeTags.includes(t))})}export{filterEvalsByTags};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"#evals/assertions/collector.js";import"#evals/session.js";import{createScopedAssertions}from"#evals/assertions/scoped.js";import{buildJudgeContext}from"#evals/judge.js";import{EvalRequirementFailed,EvalSkipped}from"#evals/control-flow.js";function createEvalContext(n){let i=n.collector,a=``,primary=()=>n.manager.primary,replyMessage=()=>n.manager.lastTurnSession()?.lastTurn?.message??null,o=buildJudgeContext({collector:i,getReply:replyMessage,getInput:()=>a,judge:n.judge});return{context:{get events(){return primary().events},get pendingInputRequests(){return primary().pendingInputRequests},get state(){return primary().state},get sessionId(){return primary().sessionId},cancel:()=>primary().cancel(),requireInputRequest:e=>primary().requireInputRequest(e),respond:(...e)=>primary().respond(...e),respondAll:e=>primary().respondAll(e),send:e=>(a=promptText(e),primary().send(e)),start:e=>(a=promptText(e),primary().start(e)),sendFile:(e,t,n)=>(a=e,primary().sendFile(e,t,n)),signal:n.signal,target:n.target,get reply(){return replyMessage()},log:n.log,sleep:e=>sleep(e,n.signal),newSession:()=>n.manager.newSession(),...createScopedAssertions(i,{timing:`final`,select:e=>e}),check:(e,t)=>recordCheck(i,e,t),require:(e,t)=>requireCheck(i,e,t),skip:e=>{throw e.trim().length===0?Error(`skip() requires a non-empty reason.`):i.hasEntries||n.manager.hasActivity()?Error(`skip() must be called before sending messages or recording assertions.`):new EvalSkipped(e)},judge:o},collector:i}}async function requireCheck(e,t,r){let i=r.gate(r.threshold);if(!await e.recordRequirement({name:i.name,threshold:i.threshold,score:
|
|
1
|
+
import"#evals/assertions/collector.js";import"#evals/session.js";import{createScopedAssertions}from"#evals/assertions/scoped.js";import{buildJudgeContext}from"#evals/judge.js";import{EvalRequirementFailed,EvalSkipped}from"#evals/control-flow.js";function createEvalContext(n){let i=n.collector,a=``,primary=()=>n.manager.primary,replyMessage=()=>n.manager.lastTurnSession()?.lastTurn?.message??null,o=buildJudgeContext({collector:i,getReply:replyMessage,getInput:()=>a,judge:n.judge});return{context:{get events(){return primary().events},get pendingInputRequests(){return primary().pendingInputRequests},get state(){return primary().state},get sessionId(){return primary().sessionId},cancel:()=>primary().cancel(),requireInputRequest:e=>primary().requireInputRequest(e),respond:(...e)=>primary().respond(...e),respondAll:e=>primary().respondAll(e),send:e=>(a=promptText(e),primary().send(e)),start:e=>(a=promptText(e),primary().start(e)),sendFile:(e,t,n)=>(a=e,primary().sendFile(e,t,n)),signal:n.signal,target:n.target,get reply(){return replyMessage()},log:n.log,sleep:e=>sleep(e,n.signal),newSession:()=>n.manager.newSession(),...createScopedAssertions(i,{timing:`final`,select:e=>e}),check:(e,t)=>recordCheck(i,e,t),require:(e,t)=>requireCheck(i,e,t),skip:e=>{throw e.trim().length===0?Error(`skip() requires a non-empty reason.`):i.hasEntries||n.manager.hasActivity()?Error(`skip() must be called before sending messages or recording assertions.`):new EvalSkipped(e)},judge:o},collector:i}}async function requireCheck(e,t,r){let i=r.gate(r.threshold);if(!await e.recordRequirement({name:i.name,threshold:i.threshold,score:()=>evaluateAssertion(i,t)}))throw new EvalRequirementFailed;return t}function recordCheck(e,t,n){return e.recordValue({name:n.name,severity:n.severity,threshold:n.threshold,score:()=>evaluateAssertion(n,t)})}async function evaluateAssertion(e,t){return e.evaluate===void 0?{score:await e.score(t)}:await e.evaluate(t)}function promptText(e){if(typeof e==`string`)return e;let t=e.message;return typeof t==`string`?t:``}function sleep(e=1e3,t){if(!Number.isFinite(e)||e<0)throw Error(`sleep() duration must be a non-negative finite number.`);return t?.aborted?Promise.reject(t.reason):new Promise((n,r)=>{let i=setTimeout(n,e);t?.addEventListener(`abort`,()=>{clearTimeout(i),r(t.reason)},{once:!0})})}export{createEvalContext};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Adds an optional user label without replacing the assertion's stable family name. */
|
|
2
|
+
export declare function formatAssertionName(name: string, label: string): string;
|
|
3
|
+
/** Formats an assertion value for a compact human-readable diagnostic. */
|
|
4
|
+
export declare function formatDiagnosticValue(value: unknown, maxLength?: number): string;
|
|
5
|
+
/** Converts arbitrary assertion evidence into an artifact-safe JSON value. */
|
|
6
|
+
export declare function toDiagnosticMetadataValue(value: unknown): unknown;
|
|
7
|
+
/** Bounds diagnostic text while leaving full structured evidence in metadata. */
|
|
8
|
+
export declare function truncateDiagnostic(text: string, maxLength: number): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function formatAssertionName(e,t){let n=t.trim();if(n.length===0)throw Error(`Assertion labels must be non-empty.`);return`${e} [${n}]`}function formatDiagnosticValue(e,t=160){let n;try{n=JSON.stringify(e)??String(e)}catch{n=String(e)}return truncateDiagnostic(n,t)}function toDiagnosticMetadataValue(e){let t=[];try{let n=JSON.stringify(e,function(e,n){if(typeof n==`bigint`)return`${String(n)}n`;if(typeof n==`function`||typeof n==`symbol`)return String(n);if(n instanceof Error)return{name:n.name,message:n.message,stack:n.stack};if(typeof n==`object`&&n){for(;t.length>0&&t.at(-1)!==this;)t.pop();if(t.includes(n))return`[Circular]`;t.push(n)}return n});return n===void 0?String(e):JSON.parse(n)}catch{return String(e)}}function truncateDiagnostic(e,t){return e.length<=t?e:`${e.slice(0,t)}…`}export{formatAssertionName,formatDiagnosticValue,toDiagnosticMetadataValue,truncateDiagnostic};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { StandardSchemaV1 } from "#compiled/@standard-schema/spec/index.js";
|
|
2
2
|
import type { Assertion } from "#evals/types.js";
|
|
3
|
-
export type { Assertion, AssertionHandle, AssertionSeverity } from "#evals/types.js";
|
|
3
|
+
export type { Assertion, AssertionEvaluation, AssertionHandle, AssertionSeverity, } from "#evals/types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Passes when the value (coerced to a string) contains a substring or matches
|
|
6
6
|
* a RegExp. A hard gate by default.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Levenshtein}from"../../node_modules/.pnpm/autoevals@0.0.132_ws@8.21.1_bufferutil@4.1.0_/node_modules/autoevals/jsdist/index.js";import{deepEquals,testRegExp}from"#evals/match.js";function makeAssertion(e){return{name:e.name,severity:e.severity,threshold:e.threshold,score
|
|
1
|
+
import{Levenshtein}from"../../node_modules/.pnpm/autoevals@0.0.132_ws@8.21.1_bufferutil@4.1.0_/node_modules/autoevals/jsdist/index.js";import{formatDiagnosticValue,toDiagnosticMetadataValue}from"#evals/diagnostics.js";import{deepEquals,testRegExp}from"#evals/match.js";function makeAssertion(e){let evaluate=t=>{let n=e.evaluate(t);return n instanceof Promise?n.then(normalizeEvaluation):normalizeEvaluation(n)};return{name:e.name,severity:e.severity,threshold:e.threshold,evaluate,score(e){let t=evaluate(e);return t instanceof Promise?t.then(e=>e.score):t.score},gate(t){return makeAssertion({...e,severity:`gate`,threshold:t})},soft(t){return makeAssertion({...e,severity:`soft`,threshold:t})},atLeast(t){return makeAssertion({...e,severity:`soft`,threshold:t})}}}function normalizeEvaluation(e){return typeof e==`number`?{score:e}:e}function includes(e){return makeAssertion({name:`includes(${e})`,severity:`gate`,evaluate:n=>{let r=String(n??``);return(typeof e==`string`?r.includes(e):testRegExp(e,r))?1:{score:0,message:`expected ${formatDiagnosticValue(r)} to include ${formatDiagnosticValue(String(e))}`,metadata:{actual:r,expected:String(e)}}}})}function satisfies(e,r){if(r.trim().length===0)throw Error(`satisfies() requires a non-empty label.`);return makeAssertion({name:`satisfies(${r})`,severity:`gate`,evaluate:i=>e(i)?1:{score:0,message:`predicate did not hold for ${formatDiagnosticValue(i)}`,metadata:{actual:toDiagnosticMetadataValue(i),predicate:r}}})}function equals(e){return makeAssertion({name:`equals`,severity:`gate`,evaluate:i=>deepEquals(i,e)?1:{score:0,message:`expected ${formatDiagnosticValue(e)}; received ${formatDiagnosticValue(i)}`,metadata:{actual:toDiagnosticMetadataValue(i),expected:toDiagnosticMetadataValue(e)}}})}function matches(e){return makeAssertion({name:`matches`,severity:`gate`,evaluate:async t=>{let r=await e[`~standard`].validate(t);return!(`issues`in r)||r.issues===void 0?1:{score:0,message:`schema validation failed: ${r.issues.map(formatSchemaIssue).join(`; `)}`,metadata:{actual:toDiagnosticMetadataValue(t),issues:toDiagnosticMetadataValue(r.issues)}}}})}function similarity(n){return makeAssertion({name:`similarity`,severity:`soft`,evaluate:async r=>{let i=String(r??``);return{score:(await Levenshtein({output:i,expected:n})).score??0,message:`expected similarity to ${formatDiagnosticValue(n)}; received ${formatDiagnosticValue(i)}`,metadata:{actual:i,expected:n}}}})}function formatSchemaIssue(e){return`${e.path===void 0?``:`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: `}${e.message}`}export{equals,includes,matches,satisfies,similarity};
|
|
@@ -6,5 +6,5 @@ export type { RuntimeIdentity } from "#protocol/message.js";
|
|
|
6
6
|
export type { InputRequest } from "#runtime/input/types.js";
|
|
7
7
|
export type { CancelSessionResult } from "#client/types.js";
|
|
8
8
|
export type { EveEvalCountMatcher, EveEvalEventMatch, EveEvalInputRequestMatchOptions, EveEvalValueMatcher, EveEvalToolCallMatchOptions, EveEvalSkillLoadMatchOptions, EveEvalSubagentCallMatchOptions, } from "#evals/match.js";
|
|
9
|
-
export type { Assertion, AssertionHandle, AssertionResult, AssertionSeverity, AutoevalsJudges, EveEvalActionStatus, EveEvalAssertions, EveEvalContext, EveEvalDerivedFacts, EveEvalJudgeConfig, EveEvalRunSummary, EveEvalSession, EveEvalSessionResult, EveEvalScheduleDispatchResult, EveEvalSubagentCall, EveEval, EveEvalConfig, EveEvalConfigInput, EveEvalDefinition, EveEvalInput, EveEvalLiveTurn, EveEvalResult, EveEvalTarget, EveEvalTargetCapabilities, EveEvalTargetHandle, EveEvalTaskResult, EveEvalToolCall, EveEvalTurn, EveEvalStreamEvent, EveEvalWaitForEventOptions, EveEvalVerdict, JudgeContext, JudgeOpts, } from "#evals/types.js";
|
|
9
|
+
export type { Assertion, AssertionEvaluation, AssertionHandle, AssertionResult, AssertionSeverity, AutoevalsJudges, EveEvalActionStatus, EveEvalAssertions, EveEvalContext, EveEvalDerivedFacts, EveEvalJudgeConfig, EveEvalRunSummary, EveEvalSession, EveEvalSessionResult, EveEvalScheduleDispatchResult, EveEvalSubagentCall, EveEval, EveEvalConfig, EveEvalConfigInput, EveEvalDefinition, EveEvalInput, EveEvalLiveTurn, EveEvalResult, EveEvalTarget, EveEvalTargetCapabilities, EveEvalTargetHandle, EveEvalTaskResult, EveEvalToolCall, EveEvalTurn, EveEvalStreamEvent, EveEvalWaitForEventOptions, EveEvalVerdict, JudgeContext, JudgeOpts, } from "#evals/types.js";
|
|
10
10
|
export type { MockModelMessage, MockModelOptions, MockModelRequest, MockModelResponder, MockModelResponse, MockModelTool, MockModelToolCall, MockModelToolResult, MockModelUsage, } from "#evals/mock-model.js";
|
package/dist/src/evals/judge.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{ClosedQA,Factuality,Sql,Summary}from"../node_modules/.pnpm/autoevals@0.0.132_ws@8.21.1_bufferutil@4.1.0_/node_modules/autoevals/jsdist/index.js";import{formatLanguageModelGatewayId}from"#internal/runtime-model.js";import{createAutoevalsClient}from"#evals/autoevals-client.js";function buildJudgeContext(a){function grade(e,t,n){let
|
|
1
|
+
import{ClosedQA,Factuality,Sql,Summary}from"../node_modules/.pnpm/autoevals@0.0.132_ws@8.21.1_bufferutil@4.1.0_/node_modules/autoevals/jsdist/index.js";import{formatLanguageModelGatewayId}from"#internal/runtime-model.js";import{formatDiagnosticValue}from"#evals/diagnostics.js";import{createAutoevalsClient}from"#evals/autoevals-client.js";function buildJudgeContext(a){function grade(e,t,n,r){let o=t?.on??a.getReply(),s=String(o??``),c=a.getInput(),l=t?.model??a.judge?.model,u=t?.modelOptions??a.judge?.modelOptions;return a.collector.recordValue({name:e,severity:`soft`,score:async()=>{if(l===void 0)throw Error(`${e} needs a judge model. Set \`judge\` on the eval or in evals.config.ts, or pass { model } to the call.`);let t=await r({input:c,output:s,model:l,modelOptions:u}),a=t.error===void 0?{}:{autoevalsError:t.error},o={...t.metadata,...a,judge:formatLanguageModelGatewayId(l),input:c,output:s,[n.label]:n.value,autoevalsName:t.name};return{score:t.score??0,message:formatJudgeDetail(c,s,n,t),metadata:o}}})}return{autoevals:{factuality:(e,n)=>grade(`judge.autoevals.factuality`,n,{label:`expected`,value:e},({input:n,output:r,model:i,modelOptions:a})=>Factuality({input:n,output:r,expected:e,...client(i,a)})),summarizes:(e,t)=>grade(`judge.autoevals.summarizes`,t,{label:`expected`,value:e},({input:t,output:n,model:i,modelOptions:a})=>Summary({input:t,output:n,expected:e,...client(i,a)})),closedQA:(t,n)=>grade(`judge.autoevals.closedQA`,n,{label:`criteria`,value:t},({input:n,output:r,model:i,modelOptions:a})=>ClosedQA({input:n,output:r,criteria:t,...client(i,a)})),sql:(e,t)=>grade(`judge.autoevals.sql`,t,{label:`expected`,value:e},({input:t,output:r,model:i,modelOptions:a})=>Sql({input:t,output:r,expected:e,...client(i,a)}))}}}function formatJudgeDetail(e,t,n,r){let i=[[`prompt`,e],[n.label,n.value],[`response`,t]];return r.metadata?.rationale!==void 0&&i.push([`rationale`,r.metadata.rationale]),r.metadata?.choice!==void 0&&i.push([`choice`,r.metadata.choice]),r.error!==void 0&&i.push([`autoevals error`,r.error]),i.map(([e,t])=>`${e}: ${formatDiagnosticValue(t)}`).join(`
|
|
2
|
+
`)}function client(e,t){return{model:formatLanguageModelGatewayId(e),client:createAutoevalsClient({languageModel:e,providerOptions:t?.providerOptions})}}export{buildJudgeContext};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MessageStreamEvent } from "#protocol/message.js";
|
|
2
2
|
import type { InputRequest } from "#runtime/input/types.js";
|
|
3
3
|
import type { JsonObject, JsonValue } from "#shared/json.js";
|
|
4
4
|
import type { EveEvalSubagentCall, EveEvalToolCall } from "#evals/types.js";
|
|
@@ -74,11 +74,11 @@ export interface EveEvalInputRequestMatchOptions {
|
|
|
74
74
|
readonly toolName?: string;
|
|
75
75
|
}
|
|
76
76
|
/** One typed stream-event matcher used by scoped event assertions. */
|
|
77
|
-
export type EveEvalEventMatch<TType extends
|
|
77
|
+
export type EveEvalEventMatch<TType extends MessageStreamEvent["type"] = MessageStreamEvent["type"]> = TType extends MessageStreamEvent["type"] ? {
|
|
78
78
|
/** Stream-event type to match. */
|
|
79
79
|
readonly type: TType;
|
|
80
80
|
/** Partial-deep matcher over the event data. */
|
|
81
|
-
readonly data?: EveEvalDeepMatcher<Extract<
|
|
81
|
+
readonly data?: EveEvalDeepMatcher<Extract<MessageStreamEvent, {
|
|
82
82
|
type: TType;
|
|
83
83
|
}> extends {
|
|
84
84
|
data: infer TData;
|
|
@@ -104,7 +104,7 @@ export declare function subagentCallMatches(call: EveEvalSubagentCall, options:
|
|
|
104
104
|
/** Returns true when one HITL request satisfies every supplied constraint. */
|
|
105
105
|
export declare function inputRequestMatches(request: InputRequest, options: EveEvalInputRequestMatchOptions): boolean;
|
|
106
106
|
/** Returns true when one stream event satisfies a typed event matcher. */
|
|
107
|
-
export declare function eventMatches(event:
|
|
107
|
+
export declare function eventMatches(event: MessageStreamEvent, matcher: EveEvalEventMatch): boolean;
|
|
108
108
|
/**
|
|
109
109
|
* Strict structural equality used by scoped `outputEquals`: unlike matcher
|
|
110
110
|
* comparison, objects must carry exactly the same keys on both sides.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import{dirname,join}from"node:path";import{mkdir,writeFile}from"node:fs/promises";function resolveArtifactDirectory(e){return join(e,`.eve`,`evals`,new Date().toISOString().replace(/[:.]/g,`-`).slice(0,19))}async function writeArtifacts(t,n){let r=join(t,`evals`);await mkdir(r,{recursive:!0}),await writeFile(join(t,`summary.json`),JSON.stringify(buildSummaryArtifact(n),null,2));let i=n.results.map(e=>JSON.stringify(buildResultLine(e))).join(`
|
|
2
2
|
`);await writeFile(join(t,`results.jsonl`),`${i}\n`),await Promise.all(n.results.map(async t=>{let n=join(r,`${sanitizeArtifactPath(t.id)}.json`);await mkdir(dirname(n),{recursive:!0}),await writeFile(n,JSON.stringify(buildEvalArtifact(t),null,2));let i=t.result.events.map(e=>JSON.stringify(e)).join(`
|
|
3
|
-
`);await writeFile(join(r,`${sanitizeArtifactPath(t.id)}.events.ndjson`),`${i}\n`)}))}function buildSummaryArtifact(e){return{target:e.target,startedAt:e.startedAt,completedAt:e.completedAt,passed:e.passed,failed:e.failed,scored:e.scored,skipped:e.skipped,errored:e.errored,totalEvals:e.results.length,evals:e.results.map(e=>({id:e.id,verdict:e.verdict,status:e.result.status,assertions:e.assertions.map(e=>({name:e.name,score:e.score,severity:e.severity,passed:e.passed})),error:e.error,skipReason:e.skipReason}))}}function buildResultLine(e){return{id:e.id,verdict:e.verdict,status:e.result.status,output:e.result.output,assertions:e.assertions,error:e.error,skipReason:e.skipReason}}function buildEvalArtifact(e){return{id:e.id,result:{output:e.result.output,finalMessage:e.result.finalMessage,sessionId:e.result.sessionId,status:e.result.status,logs:e.result.logs,derived:e.result.derived,sessions:e.result.sessions},verdict:e.verdict,assertions:e.assertions,error:e.error,skipReason:e.skipReason}}function sanitizeArtifactPath(e){return e.split(`/`).map(e=>e.replace(/[^a-zA-Z0-9_-]/g,`_`)).join(`/`)}export{resolveArtifactDirectory,writeArtifacts};
|
|
3
|
+
`);await writeFile(join(r,`${sanitizeArtifactPath(t.id)}.events.ndjson`),`${i}\n`)}))}function buildSummaryArtifact(e){return{target:e.target,startedAt:e.startedAt,completedAt:e.completedAt,passed:e.passed,failed:e.failed,scored:e.scored,skipped:e.skipped,errored:e.errored,totalEvals:e.results.length,evals:e.results.map(e=>({id:e.id,verdict:e.verdict,status:e.result.status,assertions:e.assertions.map(e=>({name:e.name,score:e.score,severity:e.severity,threshold:e.threshold,passed:e.passed,message:e.message,metadata:e.metadata})),error:e.error,skipReason:e.skipReason}))}}function buildResultLine(e){return{id:e.id,verdict:e.verdict,status:e.result.status,output:e.result.output,assertions:e.assertions,error:e.error,skipReason:e.skipReason}}function buildEvalArtifact(e){return{id:e.id,result:{output:e.result.output,finalMessage:e.result.finalMessage,sessionId:e.result.sessionId,status:e.result.status,logs:e.result.logs,derived:e.result.derived,sessions:e.result.sessions},verdict:e.verdict,assertions:e.assertions,error:e.error,skipReason:e.skipReason}}function sanitizeArtifactPath(e){return e.split(`/`).map(e=>e.replace(/[^a-zA-Z0-9_-]/g,`_`)).join(`/`)}export{resolveArtifactDirectory,writeArtifacts};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MessageStreamEvent } from "#protocol/message.js";
|
|
2
2
|
import type { EveEvalDerivedFacts } from "#evals/types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Options for {@link deriveRunFacts}.
|
|
@@ -15,7 +15,7 @@ export interface DeriveRunFactsOptions {
|
|
|
15
15
|
* `subagent.started` with `subagent.completed` the same way. These facts
|
|
16
16
|
* power checks, scorers, and reporters.
|
|
17
17
|
*/
|
|
18
|
-
export declare function deriveRunFacts(events: readonly
|
|
18
|
+
export declare function deriveRunFacts(events: readonly MessageStreamEvent[], options?: DeriveRunFactsOptions): EveEvalDerivedFacts;
|
|
19
19
|
/**
|
|
20
20
|
* Returns empty derived facts, used when a case produced no events
|
|
21
21
|
* (execution errors, transport failures).
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{truncateDiagnostic}from"#evals/diagnostics.js";function formatAssertionFailureHeadline(t){let n=t.threshold??(t.severity===`gate`?1:void 0),r=n===void 0?``:` (${formatPercent(t.score)} < ${formatPercent(n)})`,[i]=t.message?.split(`
|
|
2
|
+
`)??[],a=i===void 0?``:`: ${truncateDiagnostic(i,240)}`;return`${t.name}${r}${a}`}function formatAssertionFailureDetailLines(t){let[,...n]=t.message?.split(`
|
|
3
|
+
`)??[],r=n.slice(0,4).map(t=>truncateDiagnostic(t,240));return n.length>4?[...r,`…`]:r}function formatPercent(e){return`${Math.round(e*100)}%`}export{formatAssertionFailureDetailLines,formatAssertionFailureHeadline};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{resolveLocalGitMetadata}from"#evals/runner/resolve-git-metadata.js";function Braintrust(e={}){return new BraintrustReporter(e)}var BraintrustReporter=class{#e;#t;#n;#r=new Map;constructor(e){this.#e=e}async onRunStart(t,n){let r=await loadBraintrustSdk();this.#t=r;let i=resolveLocalGitMetadata(process.cwd());this.#r.clear();for(let e of t)this.#r.set(e.id,e);let a=resolveTags(t,n),o=resolveExperimentMetadata(t,n);this.#n=await r.init({project:this.#e.projectName??t[0]?.id??`eve evals`,projectId:this.#e.projectId,experiment:this.#e.experimentName,baseExperiment:this.#e.baseExperimentName,baseExperimentId:this.#e.baseExperimentId,update:this.#e.update,tags:a,metadata:o,noExitFlush:!0,setCurrent:!1,repoInfo:i.sha?{commit:i.sha,branch:i.branch}:null})}onEvalComplete(e){if(!this.#n)return;let t=this.#r.get(e.id),n={};for(let t of e.assertions){let e=t.severity===`gate`?`gate:${t.name}`:t.name;n[
|
|
1
|
+
import{resolveLocalGitMetadata}from"#evals/runner/resolve-git-metadata.js";function Braintrust(e={}){return new BraintrustReporter(e)}var BraintrustReporter=class{#e;#t;#n;#r=new Map;constructor(e){this.#e=e}async onRunStart(t,n){let r=await loadBraintrustSdk();this.#t=r;let i=resolveLocalGitMetadata(process.cwd());this.#r.clear();for(let e of t)this.#r.set(e.id,e);let a=resolveTags(t,n),o=resolveExperimentMetadata(t,n);this.#n=await r.init({project:this.#e.projectName??t[0]?.id??`eve evals`,projectId:this.#e.projectId,experiment:this.#e.experimentName,baseExperiment:this.#e.baseExperimentName,baseExperimentId:this.#e.baseExperimentId,update:this.#e.update,tags:a,metadata:o,noExitFlush:!0,setCurrent:!1,repoInfo:i.sha?{commit:i.sha,branch:i.branch}:null})}onEvalComplete(e){if(!this.#n)return;let t=this.#r.get(e.id),n={},r=new Map;for(let t of e.assertions){let e=t.severity===`gate`?`gate:${t.name}`:t.name,i=(r.get(e)??0)+1;r.set(e,i);let a=i===1?e:`${e}#${i}`;n[a]=t.score}let i=e.assertions.filter(e=>!e.passed).map(e=>({...e})),a={...t?.metadata,eveSessionId:e.result.sessionId,eveStatus:e.result.status,eveVerdict:e.verdict,eveSkipReason:e.skipReason,eveToolCalls:e.result.derived.toolCalls.map(e=>e.name),eveSubagentCalls:e.result.derived.subagentCalls.map(e=>e.name),eveParked:e.result.derived.parked};i.length>0&&(a.eveFailedAssertions=i),e.result.derived.failureCode&&(a.eveFailureCode=e.result.derived.failureCode);let o={toolCallCount:e.result.derived.toolCallCount,subagentCallCount:e.result.derived.subagentCallCount,messageCount:e.result.derived.messageCount,reasoningBlockCount:e.result.derived.reasoningBlockCount};this.#n.log({id:e.id,input:t?.description??``,output:e.result.output,error:e.error??void 0,scores:n,metadata:a,metrics:o,tags:t?.tags?[...t.tags]:void 0})}async onRunComplete(e){if(this.#n)try{this.#t&&await this.#t.flush();let e=await this.#n.summarize();e.experimentUrl&&console.log(`Braintrust experiment: ${e.experimentUrl}\n\n`)}finally{await this.#n.close(),this.#n=void 0,this.#t=void 0}}};async function loadBraintrustSdk(){try{return await import(`braintrust`)}catch{throw Error([`The 'braintrust' package is required for Braintrust reporting but was not found.`,``,`Install it with:`,` npm install braintrust`].join(`
|
|
2
2
|
`))}}function resolveTags(e,t){let n=new Set([`eve`,`target:${t.kind}`]);for(let t of e){n.add(`eval:${t.id}`);for(let e of t.tags??[])n.add(e)}return[...n]}function resolveExperimentMetadata(e,t){return{eveEvalIds:e.map(e=>e.id),eveTargetKind:t.kind,eveTargetUrl:t.url,eveTimestamp:new Date().toISOString()}}export{Braintrust};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import picocolors from"#compiled/picocolors/index.js";function Console(e={}){return new ConsoleReporter(e)}var ConsoleReporter=class{#e;#t;constructor(t){this.#e=t?.log??console.log,this.#t=picocolors.createColors(t?.color??!!process.stdout.isTTY)}onRunStart(e,t){this.#e(``),this.#e(`${this.#t.bold(this.#t.cyan(`EVALS`))} ${this.#t.bold(String(e.length))}`),this.#e(`${this.#t.dim(`target`)} ${t.kind===`local`?this.#t.green(t.url):this.#t.blue(t.url)}`),this.#e(``)}onEvalComplete(e){let{assertions:
|
|
1
|
+
import picocolors from"#compiled/picocolors/index.js";import{formatAssertionFailureDetailLines,formatAssertionFailureHeadline}from"#evals/runner/reporters/assertion-diagnostics.js";function Console(e={}){return new ConsoleReporter(e)}var ConsoleReporter=class{#e;#t;constructor(t){this.#e=t?.log??console.log,this.#t=picocolors.createColors(t?.color??!!process.stdout.isTTY)}onRunStart(e,t){this.#e(``),this.#e(`${this.#t.bold(this.#t.cyan(`EVALS`))} ${this.#t.bold(String(e.length))}`),this.#e(`${this.#t.dim(`target`)} ${t.kind===`local`?this.#t.green(t.url):this.#t.blue(t.url)}`),this.#e(``)}onEvalComplete(e){let{assertions:r,verdict:i,error:a,skipReason:o}=e,s=r.filter(e=>e.severity===`gate`),c=r.filter(e=>e.severity===`soft`),l=this.#n(i),u=s.length>0?this.#r(s.filter(e=>e.passed).length,s.length):``,d=c.map(e=>this.#i(e.name,e.score)).join(` `),f=[l,this.#t.dim(e.id),u,d].filter(Boolean).join(` `);this.#e(f);for(let e of r)if(!e.passed){this.#e(` ${this.#t.red(`✗ ${formatAssertionFailureHeadline(e)}`)}`);for(let n of formatAssertionFailureDetailLines(e))this.#e(` ${this.#t.red(n)}`)}a&&this.#e(` ${this.#t.red(a)}`),o&&this.#e(` ${this.#t.dim(o)}`)}onRunComplete(e){this.#e(``);let{passed:t,failed:n,scored:r,skipped:i,results:a}=e,o=a.length,s=[];t>0&&s.push(this.#t.green(`${t} passed`)),n>0&&s.push(this.#t.red(`${n} failed`)),r>0&&s.push(this.#t.yellow(`${r} scored`)),i>0&&s.push(this.#t.dim(`${i} skipped`)),s.length===0&&s.push(this.#t.dim(`0 evals`)),this.#e(`${this.#t.bold(`Results:`)} ${s.join(`, `)} ${this.#t.dim(`(${o} total)`)}`);let c=this.#a(a);if(c.total>0){let e=this.#t.green(`${c.passed} passed`),t=c.failed>0?`, ${this.#t.red(`${c.failed} failed`)}`:``;this.#e(`${this.#t.bold(`Gates:`)} ${e}${t}`)}let l=this.#o(a);if(l.length>0){this.#e(``);for(let{name:e,avg:t,count:n}of l){let r=this.#i(e,t);this.#e(` ${r} ${this.#t.dim(`(${n} evals)`)}`)}}let u=computeDurationMs(e.startedAt,e.completedAt);this.#e(``),this.#e(this.#t.dim(`Completed in ${formatDuration(u)}`)),this.#e(``)}#n(e){switch(e){case`passed`:return this.#t.green(`✓`);case`failed`:return this.#t.red(`✗`);case`scored`:return this.#t.yellow(`○`);case`skipped`:return this.#t.dim(`–`)}}#r(e,t){let n=`gates ${e}/${t}`;return e===t?this.#t.green(n):this.#t.red(n)}#i(e,t){let n=`${e}: ${Math.round(t*100)}%`;return t===1?this.#t.green(n):t===0?this.#t.red(n):this.#t.yellow(n)}#a(e){let t=0,n=0;for(let r of e)for(let e of gatesOf(r))e.passed?t+=1:n+=1;return{passed:t,failed:n,total:t+n}}#o(e){let t=new Map;for(let n of e)for(let e of n.assertions){if(e.severity!==`soft`)continue;let n=t.get(e.name);n?(n.sum+=e.score,n.count+=1):t.set(e.name,{sum:e.score,count:1})}return[...t.entries()].map(([e,{sum:t,count:n}])=>({name:e,avg:t/n,count:n}))}};function gatesOf(e){return e.assertions.filter(e=>e.severity===`gate`)}function computeDurationMs(e,t){return new Date(t).getTime()-new Date(e).getTime()}function formatDuration(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${(e%6e4/1e3).toFixed(0)}s`}export{Console};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{dirname}from"node:path";import{mkdir,writeFile}from"node:fs/promises";function JUnit(e){return new JUnitReporter(e)}var JUnitReporter=class{#e;constructor(e){this.#e=e}onRunStart(){}onEvalComplete(){}async onRunComplete(r){let i=renderJUnit(r,{suiteName:this.#e.suiteName});await mkdir(dirname(this.#e.filePath),{recursive:!0}),await writeFile(this.#e.filePath,i)}};function renderJUnit(e,t){let n=e.failed+e.scored,r=e.results.map(renderTestCase);return[`<?xml version="1.0" encoding="UTF-8"?>`,`<testsuite name="${escapeXml(t.suiteName??`eve evals`)}" tests="${e.results.length}" failures="${n}" skipped="${e.skipped}" time="${formatSeconds(durationSeconds(e))}">`,...r,`</testsuite>`,``].join(`
|
|
1
|
+
import{dirname}from"node:path";import{mkdir,writeFile}from"node:fs/promises";import{truncateDiagnostic}from"#evals/diagnostics.js";import{formatAssertionFailureHeadline}from"#evals/runner/reporters/assertion-diagnostics.js";function JUnit(e){return new JUnitReporter(e)}var JUnitReporter=class{#e;constructor(e){this.#e=e}onRunStart(){}onEvalComplete(){}async onRunComplete(r){let i=renderJUnit(r,{suiteName:this.#e.suiteName});await mkdir(dirname(this.#e.filePath),{recursive:!0}),await writeFile(this.#e.filePath,i)}};function renderJUnit(e,t){let n=e.failed+e.scored,r=e.results.map(renderTestCase);return[`<?xml version="1.0" encoding="UTF-8"?>`,`<testsuite name="${escapeXml(t.suiteName??`eve evals`)}" tests="${e.results.length}" failures="${n}" skipped="${e.skipped}" time="${formatSeconds(durationSeconds(e))}">`,...r,`</testsuite>`,``].join(`
|
|
2
2
|
`)}function renderTestCase(e){let t=`classname="eve.eval" name="${escapeXml(e.id)}" time="${formatSeconds(durationSeconds(e))}"`;if(e.verdict===`passed`)return` <testcase ${t}/>`;if(e.verdict===`skipped`)return[` <testcase ${t}>`,` <skipped message="${escapeXml(e.skipReason??`skipped`)}"/>`,` </testcase>`].join(`
|
|
3
3
|
`);let n=failureMessage(e);return[` <testcase ${t}>`,` <failure message="${escapeXml(n)}">${escapeXml(JSON.stringify(buildFailureDetail(e),null,2))}</failure>`,` </testcase>`].join(`
|
|
4
|
-
`)}function buildFailureDetail(e){return{verdict:e.verdict,error:e.error,assertions:e.assertions,logs:e.result.logs}}function failureMessage(e){if(e.error!==void 0)return e.error;let t=e.assertions.
|
|
4
|
+
`)}function buildFailureDetail(e){return{verdict:e.verdict,error:e.error,assertions:e.assertions,logs:e.result.logs}}function failureMessage(e){if(e.error!==void 0)return e.error;let t=e.assertions.filter(e=>!e.passed);return t.length>0?truncateDiagnostic(t.map(formatAssertionFailureHeadline).join(`; `),1e3):e.verdict===`scored`?`score below threshold`:e.verdict}function durationSeconds(e){let t=new Date(e.completedAt).getTime()-new Date(e.startedAt).getTime();return Math.max(0,t/1e3)}function formatSeconds(e){return e.toFixed(3)}function escapeXml(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/</g,`<`).replace(/>/g,`>`)}export{JUnit};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Client } from "#client/client.js";
|
|
2
2
|
import type { ClientSession } from "#client/session.js";
|
|
3
3
|
import type { CancelSessionResult, SendTurnInput, SessionState } from "#client/types.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { MessageStreamEvent, TurnFailureStreamEvent } from "#protocol/message.js";
|
|
5
5
|
import type { InputRequest, InputResponse } from "#runtime/input/types.js";
|
|
6
6
|
import { AssertionCollector } from "#evals/assertions/collector.js";
|
|
7
7
|
import type { EveEvalAssertions, EveEvalLiveTurn, EveEvalOutputAssertions, EveEvalSession, EveEvalSessionResult, EveEvalTurn } from "#evals/types.js";
|
|
@@ -10,7 +10,7 @@ import type { EveEvalInputRequestMatchOptions } from "#evals/match.js";
|
|
|
10
10
|
* Error thrown by {@link EveEvalTurn.expectOk} when a turn failed.
|
|
11
11
|
*/
|
|
12
12
|
export declare class EveEvalTurnFailedError extends Error {
|
|
13
|
-
readonly event: TurnFailureStreamEvent | undefined;
|
|
13
|
+
readonly event: (TurnFailureStreamEvent & MessageStreamEvent) | undefined;
|
|
14
14
|
readonly turn: EveEvalTurn;
|
|
15
15
|
constructor(turn: EveEvalTurn);
|
|
16
16
|
}
|
|
@@ -23,7 +23,7 @@ export declare class EvalSessionDriver implements EveEvalSession {
|
|
|
23
23
|
readonly session: ClientSession;
|
|
24
24
|
readonly signal?: AbortSignal;
|
|
25
25
|
});
|
|
26
|
-
get events(): readonly
|
|
26
|
+
get events(): readonly MessageStreamEvent[];
|
|
27
27
|
get lastTurn(): EveEvalTurn | undefined;
|
|
28
28
|
get pendingInputRequests(): readonly InputRequest[];
|
|
29
29
|
get sessionId(): string | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LanguageModel } from "ai";
|
|
2
2
|
import type { StandardSchemaV1 } from "#compiled/@standard-schema/spec/index.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { RuntimeIdentity, MessageStreamEvent } from "#protocol/message.js";
|
|
4
4
|
import type { CancelSessionResult, SendTurnInput, SessionState } from "#client/types.js";
|
|
5
5
|
import type { InputRequest, InputResponse } from "#runtime/input/types.js";
|
|
6
6
|
import type { JsonObject, JsonValue } from "#shared/json.js";
|
|
@@ -70,7 +70,7 @@ export interface EveEvalDerivedFacts {
|
|
|
70
70
|
*/
|
|
71
71
|
export interface EveEvalSessionResult {
|
|
72
72
|
readonly derived: EveEvalDerivedFacts;
|
|
73
|
-
readonly events: readonly
|
|
73
|
+
readonly events: readonly MessageStreamEvent[];
|
|
74
74
|
readonly primary: boolean;
|
|
75
75
|
readonly sessionId?: string;
|
|
76
76
|
readonly state: SessionState;
|
|
@@ -94,7 +94,7 @@ export interface EveEvalTaskResult {
|
|
|
94
94
|
*/
|
|
95
95
|
readonly status: "completed" | "failed" | "waiting";
|
|
96
96
|
/** The captured stream events from the run. */
|
|
97
|
-
readonly events: readonly
|
|
97
|
+
readonly events: readonly MessageStreamEvent[];
|
|
98
98
|
/** Lines written through `t.log` while the eval ran. */
|
|
99
99
|
readonly logs?: readonly string[];
|
|
100
100
|
/** Facts extracted from the stream (tool calls, message counts, etc.). */
|
|
@@ -114,14 +114,25 @@ export interface EveEvalTaskResult {
|
|
|
114
114
|
* carries a threshold).
|
|
115
115
|
*/
|
|
116
116
|
export type AssertionSeverity = "gate" | "soft";
|
|
117
|
+
/**
|
|
118
|
+
* A rich value-assertion evaluation. Built-in assertions use this to retain a
|
|
119
|
+
* concise failure reason and structured evidence alongside the numeric score.
|
|
120
|
+
*/
|
|
121
|
+
export interface AssertionEvaluation {
|
|
122
|
+
/** Normalized 0–1 score. */
|
|
123
|
+
readonly score: number;
|
|
124
|
+
/** Concise human-readable reason, shown when the assertion fails. */
|
|
125
|
+
readonly message?: string;
|
|
126
|
+
/** Structured diagnostic evidence retained by artifacts and reporters. */
|
|
127
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
128
|
+
}
|
|
117
129
|
/**
|
|
118
130
|
* A value-level assertion produced by the builders in `eve/evals/expect`
|
|
119
131
|
* (e.g. `includes`, `equals`, `similarity`) and applied to an explicit value
|
|
120
132
|
* via `t.check(value, assertion)`. Boolean assertions score exactly 0 or 1.
|
|
121
133
|
*
|
|
122
134
|
* The chainable `gate`/`soft`/`atLeast` return a new assertion with the
|
|
123
|
-
* severity or threshold overridden
|
|
124
|
-
* itself rather than a detached map.
|
|
135
|
+
* severity or threshold overridden.
|
|
125
136
|
*/
|
|
126
137
|
export interface Assertion {
|
|
127
138
|
readonly name: string;
|
|
@@ -129,20 +140,25 @@ export interface Assertion {
|
|
|
129
140
|
/** Minimum passing score. `undefined` on a soft assertion = tracked only. */
|
|
130
141
|
readonly threshold?: number;
|
|
131
142
|
score(value: unknown): number | Promise<number>;
|
|
143
|
+
/** Rich evaluation used by `t.check` and `t.require`; custom assertions may omit it. */
|
|
144
|
+
evaluate?(value: unknown): AssertionEvaluation | Promise<AssertionEvaluation>;
|
|
132
145
|
gate(threshold?: number): Assertion;
|
|
133
146
|
soft(threshold?: number): Assertion;
|
|
134
147
|
atLeast(threshold: number): Assertion;
|
|
135
148
|
}
|
|
136
149
|
/**
|
|
137
150
|
* Handle to a recorded assertion, returned by every `t` assertion method.
|
|
138
|
-
* Chain `gate`/`soft`/`atLeast` to override the recorded severity or
|
|
139
|
-
*
|
|
140
|
-
* or a `require*` lookup when
|
|
151
|
+
* Chain `gate`/`soft`/`atLeast` to override the recorded severity or threshold,
|
|
152
|
+
* and `label` to distinguish repeated assertion families. Recorded assertions
|
|
153
|
+
* are finalized by the runner; use `t.require` or a `require*` lookup when
|
|
154
|
+
* later control flow depends on a passing result.
|
|
141
155
|
*/
|
|
142
156
|
export interface AssertionHandle {
|
|
143
157
|
gate(threshold?: number): this;
|
|
144
158
|
soft(threshold?: number): this;
|
|
145
159
|
atLeast(threshold: number): this;
|
|
160
|
+
/** Adds a stable human-readable label to this recorded assertion. */
|
|
161
|
+
label(label: string): this;
|
|
146
162
|
}
|
|
147
163
|
/**
|
|
148
164
|
* The recorded outcome of one assertion, consumed by the verdict, reporters,
|
|
@@ -173,14 +189,14 @@ export interface EveEvalAssertions {
|
|
|
173
189
|
maxToolCalls(max: number): AssertionHandle;
|
|
174
190
|
calledSubagent(name: string, options?: EveEvalSubagentCallMatchOptions): AssertionHandle;
|
|
175
191
|
noFailedActions(): AssertionHandle;
|
|
176
|
-
event<TType extends
|
|
192
|
+
event<TType extends MessageStreamEvent["type"]>(type: TType, options?: Omit<Extract<EveEvalEventMatch, {
|
|
177
193
|
type: TType;
|
|
178
194
|
}>, "type">): AssertionHandle;
|
|
179
|
-
notEvent<TType extends
|
|
195
|
+
notEvent<TType extends MessageStreamEvent["type"]>(type: TType, options?: Omit<Extract<EveEvalEventMatch, {
|
|
180
196
|
type: TType;
|
|
181
197
|
}>, "type" | "count">): AssertionHandle;
|
|
182
198
|
eventOrder(matchers: readonly EveEvalEventMatch[]): AssertionHandle;
|
|
183
|
-
eventsSatisfy(label: string, predicate: (events: readonly
|
|
199
|
+
eventsSatisfy(label: string, predicate: (events: readonly MessageStreamEvent[]) => boolean): AssertionHandle;
|
|
184
200
|
}
|
|
185
201
|
/** Assertions over the final output captured by one session or immutable turn. */
|
|
186
202
|
export interface EveEvalOutputAssertions {
|
|
@@ -188,11 +204,11 @@ export interface EveEvalOutputAssertions {
|
|
|
188
204
|
outputMatches(schema: StandardSchemaV1): AssertionHandle;
|
|
189
205
|
}
|
|
190
206
|
/** Typed stream event returned by {@link EveEvalLiveTurn.waitForEvent}. */
|
|
191
|
-
export type EveEvalStreamEvent<TType extends
|
|
207
|
+
export type EveEvalStreamEvent<TType extends MessageStreamEvent["type"] = MessageStreamEvent["type"]> = Extract<MessageStreamEvent, {
|
|
192
208
|
type: TType;
|
|
193
209
|
}>;
|
|
194
210
|
/** Matcher options for waiting until one live turn emits a specific event. */
|
|
195
|
-
export type EveEvalWaitForEventOptions<TType extends
|
|
211
|
+
export type EveEvalWaitForEventOptions<TType extends MessageStreamEvent["type"]> = Omit<Extract<EveEvalEventMatch, {
|
|
196
212
|
type: TType;
|
|
197
213
|
}>, "count" | "type">;
|
|
198
214
|
/**
|
|
@@ -203,7 +219,7 @@ export type EveEvalWaitForEventOptions<TType extends HandleMessageStreamEvent["t
|
|
|
203
219
|
*/
|
|
204
220
|
export interface EveEvalLiveTurn {
|
|
205
221
|
/** Events observed on this turn so far. */
|
|
206
|
-
readonly events: readonly
|
|
222
|
+
readonly events: readonly MessageStreamEvent[];
|
|
207
223
|
/** Session driver that started or owns this turn. */
|
|
208
224
|
readonly session: EveEvalSession;
|
|
209
225
|
/** Durable session id available as soon as the turn is accepted or attached. */
|
|
@@ -213,12 +229,12 @@ export interface EveEvalLiveTurn {
|
|
|
213
229
|
/** Wait for the turn boundary and return the recorded immutable result. */
|
|
214
230
|
result(): Promise<EveEvalTurn>;
|
|
215
231
|
/** Wait until the live stream emits one typed event matching `options`. */
|
|
216
|
-
waitForEvent<TType extends
|
|
232
|
+
waitForEvent<TType extends MessageStreamEvent["type"]>(type: TType, options?: EveEvalWaitForEventOptions<TType>): Promise<EveEvalStreamEvent<TType>>;
|
|
217
233
|
}
|
|
218
234
|
/** Operations and state shared by the primary eval context and independent sessions. */
|
|
219
235
|
export interface EveEvalSessionDriver {
|
|
220
236
|
/** All events observed on this session so far. */
|
|
221
|
-
readonly events: readonly
|
|
237
|
+
readonly events: readonly MessageStreamEvent[];
|
|
222
238
|
/** Input requests left pending by the last parked turn. */
|
|
223
239
|
readonly pendingInputRequests: readonly InputRequest[];
|
|
224
240
|
/** Serializable cursor for resuming this session. */
|
|
@@ -248,7 +264,7 @@ export interface EveEvalSession extends EveEvalSessionDriver, EveEvalAssertions,
|
|
|
248
264
|
*/
|
|
249
265
|
export interface EveEvalTurn extends EveEvalAssertions, EveEvalOutputAssertions {
|
|
250
266
|
readonly data: unknown;
|
|
251
|
-
readonly events: readonly
|
|
267
|
+
readonly events: readonly MessageStreamEvent[];
|
|
252
268
|
readonly inputRequests: readonly InputRequest[];
|
|
253
269
|
readonly message: string | undefined;
|
|
254
270
|
readonly sessionId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createLogger,logError}from"#internal/logging.js";import{BundleKey}from"#runtime/sessions/runtime-context-keys.js";import{deserializeContext}from"#context/serialize.js";import{readDurableSession}from"#execution/durable-session-store.js";import{cancelRemoteAgentTurn,isRetryableRemoteAgentCancelError,resolveRemoteAgentForAction}from"#execution/remote-agent-dispatch.js";import{requestWorkflowTurnCancellation}from"#execution/workflow-runtime.js";import{getPendingRuntimeActionBatch}from"#harness/runtime-actions.js";const log=createLogger(`execution.cancel-descendant-turns`);async function cancelDescendantTurnsStep(e){"use step";let
|
|
1
|
+
import{createLogger,logError}from"#internal/logging.js";import{BundleKey}from"#runtime/sessions/runtime-context-keys.js";import{deserializeContext}from"#context/serialize.js";import{readDurableSession}from"#execution/durable-session-store.js";import{cancelRemoteAgentTurn,isRetryableRemoteAgentCancelError,resolveRemoteAgentForAction}from"#execution/remote-agent-dispatch.js";import{requestWorkflowTurnCancellation}from"#execution/workflow-runtime.js";import{getPendingRuntimeActionBatch}from"#harness/runtime-actions.js";const log=createLogger(`execution.cancel-descendant-turns`);async function cancelDescendantTurnsStep(e){"use step";let i;try{i=getPendingRuntimeActionBatch((await readDurableSession(e.sessionState)).state)}catch(n){logError(log,`failed to read pending descendants during cancellation`,n,{sessionId:e.sessionState.sessionId});return}if(i===void 0){log.warn(`no pending batch found while cancelling descendants; nothing to cancel`,{sessionId:e.sessionState.sessionId});return}let a=i.childSessionIds;if(a===void 0){log.warn(`pending batch carries no child session ids; descendants cannot be cancelled`,{actionCount:i.actions.length,sessionId:e.sessionState.sessionId});return}let o,getRemoteRegistry=()=>o??=deserializeContext(e.serializedContext).then(e=>e.require(BundleKey).subagentRegistry.subagentsByNodeId),s=i.actions.flatMap(e=>{let t=a[e.callId];return t===void 0?[]:e.kind===`subagent-call`?[cancelLocalDescendant({action:e,childSessionId:t})]:e.kind===`remote-agent-call`?[cancelRemoteDescendant({action:e,childSessionId:t,remoteRegistry:getRemoteRegistry()})]:[]});await Promise.all(s)}async function cancelLocalDescendant(e){try{let t=await requestCancellationWithRetry({request:()=>requestWorkflowTurnCancellation({sessionId:e.childSessionId}),shouldRetryError:()=>!1});t.status!==`accepted`&&log.warn(`descendant cancel was never accepted; the child may run to completion`,{callId:e.action.callId,childSessionId:e.childSessionId,finalStatus:t.status,reason:t.reason,subagentName:e.action.subagentName})}catch(n){logError(log,`failed to cancel local descendant turn`,n,{callId:e.action.callId,childSessionId:e.childSessionId,subagentName:e.action.subagentName})}}async function cancelRemoteDescendant(e){try{let t=await e.remoteRegistry,n=resolveRemoteAgentForAction({nodeId:e.action.nodeId,remoteAgentName:e.action.remoteAgentName,registry:t}),r=await requestCancellationWithRetry({request:()=>cancelRemoteAgentTurn({remote:n,sessionId:e.childSessionId}),shouldRetryError:isRetryableRemoteAgentCancelError});r.status!==`accepted`&&log.warn(`remote descendant cancel was never accepted; the child may run to completion`,{callId:e.action.callId,childSessionId:e.childSessionId,finalStatus:r.status,reason:r.reason,remoteAgentName:e.action.remoteAgentName})}catch(n){logError(log,`failed to cancel remote descendant turn`,n,{callId:e.action.callId,childSessionId:e.childSessionId,remoteAgentName:e.action.remoteAgentName})}}async function requestCancellationWithRetry(e){let t=250,n={status:`no_active_turn`};for(let r=1;r<=8;r+=1){try{if(n=await e.request(),n.status===`accepted`||r===8)return n}catch(t){if(!e.shouldRetryError(t)||r===8)throw t}await new Promise(e=>setTimeout(e,t)),t=Math.min(t*2,1500)}return n}export{cancelDescendantTurnsStep};
|