eve 0.24.3 → 0.24.5
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 +35 -0
- package/dist/src/channel/adapter.d.ts +4 -2
- package/dist/src/channel/adapter.js +1 -1
- package/dist/src/channel/session.d.ts +5 -1
- package/dist/src/channel/types.d.ts +20 -6
- package/dist/src/chunks/{use-eve-agent-dEGV09g_.js → use-eve-agent-8rerxDHY.js} +74 -10
- package/dist/src/chunks/{use-eve-agent-CFBTHlPx.js → use-eve-agent-DhgdHzDG.js} +74 -10
- package/dist/src/cli/commands/build.d.ts +14 -0
- package/dist/src/cli/commands/build.js +1 -0
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/link.d.ts +6 -5
- package/dist/src/cli/commands/link.js +1 -1
- package/dist/src/cli/dev/tui/runner.d.ts +2 -2
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/run.d.ts +3 -2
- package/dist/src/cli/run.js +1 -1
- package/dist/src/client/index.d.ts +2 -2
- package/dist/src/client/message-reducer.js +1 -1
- package/dist/src/client/ndjson.js +1 -1
- package/dist/src/client/open-stream.d.ts +3 -2
- package/dist/src/client/open-stream.js +1 -1
- package/dist/src/client/session-utils.js +1 -1
- package/dist/src/client/session.d.ts +19 -5
- package/dist/src/client/session.js +1 -1
- package/dist/src/client/types.d.ts +11 -2
- package/dist/src/compiled/.vendor-stamp.json +5 -5
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +55 -0
- package/dist/src/compiled/@workflow/core/runtime/run-id-time.d.ts +9 -0
- package/dist/src/compiled/@workflow/core/runtime/step-executor.d.ts +2 -0
- package/dist/src/compiled/@workflow/core/runtime/step-latency.d.ts +70 -4
- package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +10 -1
- package/dist/src/compiled/@workflow/core/runtime.js +3 -3
- package/dist/src/compiled/@workflow/core/step/context-storage.d.ts +6 -0
- package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +25 -0
- 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/errors/index.d.ts +16 -0
- package/dist/src/compiled/@workflow/errors/index.js +1 -1
- package/dist/src/compiled/@workflow/world/attributes.d.ts +7 -0
- package/dist/src/compiled/@workflow/world/events.d.ts +16 -0
- package/dist/src/compiled/@workflow/world/index.d.ts +1 -1
- package/dist/src/compiled/@workflow/world-local/index.js +3 -3
- package/dist/src/compiled/@workflow/world-vercel/index.js +16 -16
- package/dist/src/compiled/_chunks/workflow/attribute-changes-DXbmITuI.js +20 -0
- package/dist/src/compiled/_chunks/workflow/{dist-DpDDcpTl.js → dist-BYo8Gno2.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{dist-Blxnyb7-.js → dist-CSfKNxQW.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-DvvgYsRt.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-BdvQmV5a.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-id-BdE0MZz9.js +1 -0
- package/dist/src/compiled/_chunks/workflow/sleep-DzxrwWTs.js +1 -0
- package/dist/src/discover/filesystem.js +1 -1
- package/dist/src/evals/assertions/run.d.ts +3 -3
- package/dist/src/evals/context.js +1 -1
- package/dist/src/evals/index.d.ts +2 -1
- package/dist/src/evals/match.d.ts +4 -0
- package/dist/src/evals/match.js +1 -1
- package/dist/src/evals/runner/derive-run-facts.js +1 -1
- package/dist/src/evals/session.d.ts +10 -2
- package/dist/src/evals/session.js +1 -1
- package/dist/src/evals/target.js +1 -1
- package/dist/src/evals/types.d.ts +52 -2
- package/dist/src/execution/cancel-descendant-turns-step.d.ts +6 -0
- package/dist/src/execution/cancel-descendant-turns-step.js +1 -0
- package/dist/src/execution/create-session-step.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
- package/dist/src/execution/dispatch-workflow-runtime-actions-step.js +1 -1
- package/dist/src/execution/durable-session-migrations/turn-workflow.d.ts +1 -0
- package/dist/src/execution/durable-session-migrations/turn-workflow.js +1 -1
- package/dist/src/execution/next-driver-action.d.ts +7 -0
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/remote-agent-dispatch.d.ts +6 -0
- package/dist/src/execution/remote-agent-dispatch.js +1 -1
- package/dist/src/execution/settle-cancelled-turn-step.d.ts +16 -0
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -0
- package/dist/src/execution/subagent-event-proxy-step.js +1 -1
- package/dist/src/execution/subagent-hitl-proxy.js +1 -1
- package/dist/src/execution/terminal-session-failure-step.d.ts +6 -0
- package/dist/src/execution/terminal-session-failure-step.js +1 -0
- package/dist/src/execution/turn-cancellation-control.d.ts +27 -0
- package/dist/src/execution/turn-cancellation-control.js +1 -0
- package/dist/src/execution/turn-cancellation-token.d.ts +9 -0
- package/dist/src/execution/turn-cancellation-token.js +1 -0
- package/dist/src/execution/turn-dispatch.d.ts +14 -1
- package/dist/src/execution/turn-dispatch.js +1 -1
- package/dist/src/execution/turn-execution-cursor.d.ts +2 -1
- package/dist/src/execution/turn-execution-cursor.js +1 -1
- package/dist/src/execution/turn-workflow.d.ts +9 -1
- package/dist/src/execution/turn-workflow.js +1 -1
- package/dist/src/execution/workflow-entry.js +1 -1
- package/dist/src/execution/workflow-runtime.d.ts +3 -1
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.d.ts +8 -6
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/active-turn-id.d.ts +11 -0
- package/dist/src/harness/active-turn-id.js +1 -0
- package/dist/src/harness/advertised-tools.js +1 -1
- package/dist/src/harness/cancelled-turn-emission.d.ts +11 -0
- package/dist/src/harness/cancelled-turn-emission.js +1 -0
- package/dist/src/harness/emission.d.ts +4 -2
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/execute-tool.d.ts +0 -1
- package/dist/src/harness/proxy-input-requests.d.ts +5 -0
- package/dist/src/harness/proxy-input-requests.js +1 -1
- package/dist/src/harness/runtime-actions.d.ts +16 -12
- package/dist/src/harness/runtime-actions.js +1 -1
- package/dist/src/harness/session-limit-enforcement.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/internal/application/build-profile.d.ts +64 -0
- package/dist/src/internal/application/build-profile.js +1 -0
- package/dist/src/internal/application/compiled-artifacts.js +3 -2
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-module-loader.d.ts +10 -0
- package/dist/src/internal/authored-module-loader.js +3 -3
- package/dist/src/internal/authored-module-map-loader.js +1 -1
- package/dist/src/internal/bundler/nitro-rolldown.d.ts +18 -2
- package/dist/src/internal/bundler/nitro-rolldown.js +1 -1
- package/dist/src/internal/materialized-authored-modules.d.ts +2 -4
- package/dist/src/internal/materialized-authored-modules.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-source-snapshot-copy.js +1 -1
- package/dist/src/internal/nitro/host/build-application.js +1 -1
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
- package/dist/src/internal/nitro/host/types.d.ts +2 -0
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.d.ts +7 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
- package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
- package/dist/src/internal/nitro/routes/channel-route-context.d.ts +3 -0
- package/dist/src/internal/nitro/routes/channel-route-context.js +1 -1
- package/dist/src/internal/nitro/routes/runtime-stack.js +1 -1
- package/dist/src/internal/nitro/routes/schedule-task.js +1 -1
- package/dist/src/internal/workflow/development-world-client.js +1 -1
- package/dist/src/internal/workflow/development-world-server.js +1 -1
- package/dist/src/internal/workflow/local-world-data-directory.d.ts +2 -0
- package/dist/src/internal/workflow/local-world-data-directory.js +1 -0
- package/dist/src/internal/workflow-bundle/builder-support.js +3 -3
- package/dist/src/internal/workflow-bundle/builder.js +2 -2
- package/dist/src/internal/workflow-bundle/vercel-workflow-output.js +1 -1
- package/dist/src/protocol/cancel-turn.d.ts +11 -0
- package/dist/src/protocol/cancel-turn.js +1 -0
- package/dist/src/protocol/message.d.ts +23 -3
- package/dist/src/protocol/message.js +2 -2
- package/dist/src/protocol/routes.d.ts +10 -0
- package/dist/src/protocol/routes.js +1 -1
- package/dist/src/public/channels/discord/discordChannel.d.ts +1 -0
- package/dist/src/public/channels/eve.d.ts +2 -1
- package/dist/src/public/channels/eve.js +2 -2
- package/dist/src/public/channels/github/githubChannel.d.ts +1 -0
- package/dist/src/public/channels/linear/api.d.ts +0 -1
- package/dist/src/public/channels/linear/api.js +17 -22
- package/dist/src/public/channels/linear/linearChannel.d.ts +1 -0
- package/dist/src/public/channels/linear/linearChannel.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.d.ts +1 -0
- package/dist/src/public/channels/teams/teamsChannel.d.ts +1 -0
- package/dist/src/public/channels/telegram/telegramChannel.d.ts +1 -0
- package/dist/src/public/channels/twilio/twilioChannel.d.ts +1 -0
- package/dist/src/public/definitions/channel.d.ts +25 -14
- package/dist/src/public/definitions/channel.js +1 -1
- package/dist/src/public/next/index.js +1 -1
- package/dist/src/public/next/resolve-eve-binary.d.ts +12 -0
- package/dist/src/public/next/resolve-eve-binary.js +1 -0
- package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
- package/dist/src/runtime/framework-tools/agent.d.ts +13 -0
- package/dist/src/runtime/framework-tools/agent.js +1 -0
- package/dist/src/runtime/framework-tools/index.d.ts +7 -2
- package/dist/src/runtime/framework-tools/index.js +1 -1
- package/dist/src/runtime/resolve-agent-graph.js +1 -1
- package/dist/src/runtime/types.d.ts +2 -1
- package/dist/src/services/dev-client/runtime-artifacts.d.ts +2 -2
- package/dist/src/services/dev-client.d.ts +10 -18
- package/dist/src/services/dev-client.js +1 -1
- package/dist/src/setup/boxes/reconcile-host-framework-preset.d.ts +26 -0
- package/dist/src/setup/boxes/reconcile-host-framework-preset.js +1 -0
- package/dist/src/setup/boxes/resolve-provisioning.js +1 -1
- package/dist/src/setup/index.js +1 -1
- package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
- package/dist/src/setup/scaffold/create/extension.js +0 -1
- package/dist/src/setup/scaffold/create/project.js +2 -4
- package/dist/src/setup/scaffold/index.d.ts +1 -1
- package/dist/src/setup/scaffold/index.js +1 -1
- package/dist/src/setup/scaffold/update/channels.d.ts +7 -1
- package/dist/src/setup/scaffold/update/channels.js +2 -2
- package/dist/src/setup/scaffold/update/connections.js +3 -3
- package/dist/src/setup/vercel-project-framework.d.ts +12 -0
- package/dist/src/setup/vercel-project-framework.js +1 -1
- package/dist/src/shared/continuation-token.d.ts +2 -0
- package/dist/src/shared/continuation-token.js +1 -0
- package/dist/src/svelte/index.js +1 -1
- 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.js +1 -1
- package/docs/channels/eve.mdx +11 -1
- package/docs/concepts/default-harness.md +2 -0
- package/docs/concepts/execution-model-and-durability.md +1 -1
- package/docs/concepts/sessions-runs-and-streaming.md +24 -4
- package/docs/evals/assertions.mdx +2 -2
- package/docs/evals/cases.mdx +31 -0
- package/docs/evals/overview.mdx +1 -1
- package/docs/evals/targets.mdx +2 -1
- package/docs/guides/client/continuations.mdx +16 -1
- package/docs/guides/client/streaming.mdx +31 -2
- package/docs/guides/deployment.md +1 -1
- package/docs/guides/frontend/overview.mdx +4 -2
- package/docs/guides/frontend/use-eve-agent-svelte.mdx +2 -2
- package/docs/guides/frontend/use-eve-agent-vue.mdx +2 -2
- package/docs/guides/remote-agents.md +2 -0
- package/docs/reference/cli.md +16 -3
- package/docs/subagents.mdx +10 -0
- package/package.json +6 -6
- package/dist/src/compiled/_chunks/workflow/attribute-changes-MGTOG_uX.js +0 -20
- package/dist/src/compiled/_chunks/workflow/resume-hook-DHP5ql3-.js +0 -1
- package/dist/src/compiled/_chunks/workflow/run-D8hv1ptT.js +0 -1
- package/dist/src/compiled/_chunks/workflow/sleep-uA9pS-PT.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# eve
|
|
2
2
|
|
|
3
|
+
## 0.24.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- bfbbe92: Add `eve build --profile <path>` for a machine-readable build-timing and final-output-size report. Profile collection is best-effort, so reporting failures do not fail an otherwise successful build.
|
|
8
|
+
- dab9889: Allow agents to remove the root-only built-in `agent` delegation tool with `disableTool()` from `agent/tools/agent.ts`.
|
|
9
|
+
- e1cb505: Retry transient network failures while reopening client session streams so active turns remain attached.
|
|
10
|
+
- 2568387: Cancel active local, nested, and remote subagent turns when their parent turn is cancelled. Client and eval sessions can now cancel active turns directly, and eval live-turn handles can wait for typed mid-turn events before cancellation or settlement.
|
|
11
|
+
- 20cd9a1: Added `POST /eve/v1/session/:sessionId/cancel` to the eve HTTP channel for requesting cancellation of an in-flight turn. The optional `{ turnId }` body limits the request to the turn the caller observed; the response reports `"accepted"` when a cancellation hook accepts it or the benign `"no_active_turn"` when no resumable target exists.
|
|
12
|
+
- 02698fd: Fix Vercel deploys for the Next.js web channel. `eve` no longer scaffolds a
|
|
13
|
+
`vercel.json` `experimentalServices` block, which the Vercel platform now
|
|
14
|
+
rejects (it requires the `services` key and a stricter schema). For Next.js the
|
|
15
|
+
block was also redundant — `withEve()` generates the eve service and
|
|
16
|
+
`/eve/v1/*` routes into the Build Output at build time — so the scaffold now
|
|
17
|
+
writes a minimal `vercel.json`.
|
|
18
|
+
- e45a066: `eve link` now lets you create a Vercel project or link an existing one, matching the project setup available through `/model` usage.
|
|
19
|
+
- 5f8818b: `eve channels add web` now updates the Vercel Framework Preset when adding a
|
|
20
|
+
Next.js web channel to an already-linked eve project to prevent deployment
|
|
21
|
+
failures.
|
|
22
|
+
- 887908c: Bundle authored modules in each development generation as one shared graph, avoiding repeated parsing and emission of dependencies for every tool.
|
|
23
|
+
- 376a82f: Report the root-only `agent` action alongside other framework tools in agent info, including whether it is active, disabled, or replaced.
|
|
24
|
+
- 4f2863d: Update the bundled Workflow runtime dependencies to their latest 5.0 beta releases.
|
|
25
|
+
- d9d3226: Fix `withEve` producing a broken Vercel build command in npm workspaces, where the `eve` module is located in the workspace root.
|
|
26
|
+
|
|
27
|
+
## 0.24.4
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- d5db876: Session teardown now disposes authorization hooks without waiting on pending durable iterator reads, preventing cancelled sessions from hanging during cleanup.
|
|
32
|
+
- 0dbea62: Store local Workflow World data under `.eve/.workflow-data` for both `eve dev` and `eve start`.
|
|
33
|
+
- 9058962: Keep an active `eve dev` REPL session across successful authored-source reloads, so its next turn continues the durable conversation on the latest generation.
|
|
34
|
+
- 4531a3d: Route all of eve's single-file bundles through a shared Rolldown helper that always disables code splitting. This closes a remaining gap where a dynamic import reachable from a final workflow bundle could still fail with "Expected one bundled ..." during builds.
|
|
35
|
+
- b6e5923: Include the current continuation token in `session.waiting` events, and allow negative stream start indexes such as `-1` to read relative to the current tail.
|
|
36
|
+
- 159d674: Turns are now cancellable: resuming a session's durable cancel hook (`{sessionId}:cancel`, with an optional `turnId` guard) aborts in-flight work and settles the turn as a new `turn.cancelled` stream event followed by `session.waiting` — never as a failure. Channels and stream-event hooks can handle `turn.cancelled`, and `eve/client` finalizes partially streamed messages. The HTTP cancellation API ships in a following release.
|
|
37
|
+
|
|
3
38
|
## 0.24.3
|
|
4
39
|
|
|
5
40
|
### Patch Changes
|
|
@@ -147,8 +147,10 @@ export declare function defaultDeliverResult(payload: DeliverPayload): StepInput
|
|
|
147
147
|
*/
|
|
148
148
|
export declare function getAdapterKind(adapter: ChannelAdapter): string;
|
|
149
149
|
/**
|
|
150
|
-
* Calls an adapter's event handler for a given event.
|
|
151
|
-
*
|
|
150
|
+
* Calls an adapter's event handler for a given event. Adapters perform side
|
|
151
|
+
* effects rather than transforming events; after the handler runs, the
|
|
152
|
+
* runtime refreshes `session.waiting` with the live continuation token so a
|
|
153
|
+
* handler that re-keyed the session publishes the new resume handle.
|
|
152
154
|
*
|
|
153
155
|
* Throwing handlers are logged and swallowed so a downstream delivery
|
|
154
156
|
* failure does not corrupt the event stream write path.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createLogger}from"#internal/logging.js";const log=createLogger(`channel.adapter`);function defaultDeliverResult(e){if(e.message!==void 0)return{inputResponses:e.inputResponses,message:e.message,context:e.context,outputSchema:e.outputSchema};if(e.inputResponses!==void 0&&e.inputResponses.length>0)return{inputResponses:e.inputResponses,context:e.context,outputSchema:e.outputSchema};if(e.context!==void 0&&e.context.length>0)return{context:e.context,outputSchema:e.outputSchema};if(e.outputSchema!==void 0)return{outputSchema:e.outputSchema}}function getAdapterKind(e){return e.kind}async function callAdapterEventHandler(e,
|
|
1
|
+
import{createLogger}from"#internal/logging.js";import{toChannelLocalContinuationToken}from"#shared/continuation-token.js";const log=createLogger(`channel.adapter`);function defaultDeliverResult(e){if(e.message!==void 0)return{inputResponses:e.inputResponses,message:e.message,context:e.context,outputSchema:e.outputSchema};if(e.inputResponses!==void 0&&e.inputResponses.length>0)return{inputResponses:e.inputResponses,context:e.context,outputSchema:e.outputSchema};if(e.context!==void 0&&e.context.length>0)return{context:e.context,outputSchema:e.outputSchema};if(e.outputSchema!==void 0)return{outputSchema:e.outputSchema}}function getAdapterKind(e){return e.kind}async function callAdapterEventHandler(e,n,r){let i=e[n.type];if(i!==void 0)try{await i(`data`in n?n.data:void 0,r)}catch(t){log.error(`adapter event handler threw — event swallowed`,{adapterKind:getAdapterKind(e),eventType:n.type,error:t})}return n.type===`session.waiting`?{...n,data:{...n.data,continuationToken:toChannelLocalContinuationToken(r.session.continuationToken)}}:n}export{callAdapterEventHandler,defaultDeliverResult,getAdapterKind};
|
|
@@ -4,7 +4,7 @@ import type { Runtime } from "#channel/types.js";
|
|
|
4
4
|
import type { SessionAuth } from "#context/keys.js";
|
|
5
5
|
/**
|
|
6
6
|
* Result of starting or delivering to a session. Exposes the session
|
|
7
|
-
* `id`, its
|
|
7
|
+
* `id`, its channel-local `continuationToken`, and `getEventStream`, which
|
|
8
8
|
* resolves to a `ReadableStream` of the session's harness events
|
|
9
9
|
* (optionally from `startIndex`). Returned by {@link SendFn},
|
|
10
10
|
* {@link GetSessionFn}, and a channel's `receive` hook. Unlike the live
|
|
@@ -14,6 +14,10 @@ import type { SessionAuth } from "#context/keys.js";
|
|
|
14
14
|
export interface Session {
|
|
15
15
|
readonly id: string;
|
|
16
16
|
readonly continuationToken: string;
|
|
17
|
+
/**
|
|
18
|
+
* Opens the durable event stream. Negative start indexes read relative to
|
|
19
|
+
* the current tail (`-1` starts at the latest event).
|
|
20
|
+
*/
|
|
17
21
|
getEventStream(options?: {
|
|
18
22
|
startIndex?: number;
|
|
19
23
|
}): Promise<ReadableStream<HandleMessageStreamEvent>>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { UserContent } from "ai";
|
|
2
2
|
import type { HandleMessageStreamEvent } from "#protocol/message.js";
|
|
3
|
+
import type { CancelTurnStatus } from "#protocol/cancel-turn.js";
|
|
3
4
|
import type { RunMode } from "#shared/run-mode.js";
|
|
4
5
|
import type { RuntimeActionResult } from "#runtime/actions/types.js";
|
|
5
6
|
import type { InputRequest, InputResponse } from "#runtime/input/types.js";
|
|
@@ -10,6 +11,16 @@ export type { ContextAccessor } from "#context/key.js";
|
|
|
10
11
|
export type { ChannelInstrumentationProjection } from "#channel/instrumentation.js";
|
|
11
12
|
import type { ChannelInstrumentationProjection } from "#channel/instrumentation.js";
|
|
12
13
|
export type RunSessionLimits = Pick<AgentLimitsDefinition, "maxInputTokensPerSession" | "maxOutputTokensPerSession">;
|
|
14
|
+
/** Identifies the session turn to cancel. */
|
|
15
|
+
export interface CancelTurnInput {
|
|
16
|
+
readonly sessionId: string;
|
|
17
|
+
/** Limits the request to the turn the caller observed. */
|
|
18
|
+
readonly turnId?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Result of requesting turn cancellation. Both statuses are successful. */
|
|
21
|
+
export interface CancelTurnResult {
|
|
22
|
+
readonly status: CancelTurnStatus;
|
|
23
|
+
}
|
|
13
24
|
/**
|
|
14
25
|
* Identifies one turn within a session.
|
|
15
26
|
*
|
|
@@ -314,6 +325,8 @@ export interface Runtime {
|
|
|
314
325
|
* completion.
|
|
315
326
|
*/
|
|
316
327
|
run(input: RunInput): Promise<RunHandle>;
|
|
328
|
+
/** Requests cancellation of a session's in-flight turn. */
|
|
329
|
+
cancelTurn(input: CancelTurnInput): Promise<CancelTurnResult>;
|
|
317
330
|
/**
|
|
318
331
|
* Delivers a follow-up message to a parked session.
|
|
319
332
|
*/
|
|
@@ -327,10 +340,10 @@ export interface Runtime {
|
|
|
327
340
|
* event-streaming route. Backed by the workflow API's per-session durable
|
|
328
341
|
* stream.
|
|
329
342
|
*
|
|
330
|
-
* `options.startIndex`
|
|
331
|
-
*
|
|
332
|
-
* forwards the `startIndex` query
|
|
333
|
-
*
|
|
343
|
+
* Nonnegative `options.startIndex` values are the zero-based position of the
|
|
344
|
+
* first event to yield. Negative values read relative to the current tail.
|
|
345
|
+
* The framework HTTP session-stream route forwards the `startIndex` query
|
|
346
|
+
* parameter unchanged.
|
|
334
347
|
*/
|
|
335
348
|
getEventStream(sessionId: string, options?: GetEventStreamOptions): Promise<ReadableStream<HandleMessageStreamEvent>>;
|
|
336
349
|
}
|
|
@@ -339,8 +352,9 @@ export interface Runtime {
|
|
|
339
352
|
*/
|
|
340
353
|
export interface GetEventStreamOptions {
|
|
341
354
|
/**
|
|
342
|
-
* Zero-based index of the first event to emit.
|
|
343
|
-
*
|
|
355
|
+
* Zero-based index of the first event to emit. Negative values read from
|
|
356
|
+
* the current tail (`-1` starts at the latest event). Defaults to `0`
|
|
357
|
+
* (replay the entire stream).
|
|
344
358
|
*/
|
|
345
359
|
readonly startIndex?: number;
|
|
346
360
|
}
|
|
@@ -8,6 +8,7 @@ const EVE_INFO_ROUTE_PATH = `${EVE_ROUTE_PREFIX}/info`;
|
|
|
8
8
|
const EVE_CREATE_SESSION_ROUTE_PATH = `${EVE_ROUTE_PREFIX}/session`;
|
|
9
9
|
const EVE_CONTINUE_SESSION_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/session/:sessionId`;
|
|
10
10
|
const EVE_MESSAGE_STREAM_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/session/:sessionId/stream`;
|
|
11
|
+
const EVE_CANCEL_TURN_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/session/:sessionId/cancel`;
|
|
11
12
|
const EVE_DEV_DISPATCH_SCHEDULE_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/dev/schedules/:scheduleId`;
|
|
12
13
|
const EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH = `${EVE_ROUTE_PREFIX}/dev/runtime-artifacts`;
|
|
13
14
|
const EVE_DEV_RUNTIME_ARTIFACTS_REBUILD_ROUTE_PATH = `${EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH}/rebuild`;
|
|
@@ -19,6 +20,9 @@ function createEveMessageStreamRoutePath(sessionId) {
|
|
|
19
20
|
function createEveContinueSessionRoutePath(sessionId) {
|
|
20
21
|
return `${EVE_ROUTE_PREFIX}/session/${encodeURIComponent(sessionId)}`;
|
|
21
22
|
}
|
|
23
|
+
function createEveCancelTurnRoutePath(sessionId) {
|
|
24
|
+
return `${EVE_ROUTE_PREFIX}/session/${encodeURIComponent(sessionId)}/cancel`;
|
|
25
|
+
}
|
|
22
26
|
|
|
23
27
|
//#endregion
|
|
24
28
|
//#region src/client/agent-info-error.ts
|
|
@@ -290,6 +294,14 @@ function isCurrentTurnBoundaryEvent(event) {
|
|
|
290
294
|
return event.type === "session.completed" || event.type === "session.failed" || event.type === "session.waiting";
|
|
291
295
|
}
|
|
292
296
|
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/protocol/cancel-turn.ts
|
|
299
|
+
const CancelTurnResponseSchema = z.object({
|
|
300
|
+
ok: z.literal(true),
|
|
301
|
+
sessionId: z.string().min(1),
|
|
302
|
+
status: z.enum(["accepted", "no_active_turn"])
|
|
303
|
+
});
|
|
304
|
+
|
|
293
305
|
//#endregion
|
|
294
306
|
//#region src/shared/json.ts
|
|
295
307
|
const INVALID_JSON_VALUE_CANDIDATE = Symbol("invalid-json-value-candidate");
|
|
@@ -373,7 +385,7 @@ function advanceSession(input) {
|
|
|
373
385
|
const boundaryEvent = findBoundaryEvent(input.events);
|
|
374
386
|
const streamIndex = input.session.streamIndex + input.events.length;
|
|
375
387
|
if (boundaryEvent?.type === "session.waiting" || input.preserveCompletedSessions === true && boundaryEvent?.type === "session.completed") return {
|
|
376
|
-
continuationToken: input.continuationToken ?? input.session.continuationToken,
|
|
388
|
+
continuationToken: boundaryEvent?.type === "session.waiting" ? boundaryEvent.data.continuationToken : input.continuationToken ?? input.session.continuationToken,
|
|
377
389
|
sessionId: input.sessionId,
|
|
378
390
|
streamIndex
|
|
379
391
|
};
|
|
@@ -442,7 +454,7 @@ function isStreamDisconnectError(error) {
|
|
|
442
454
|
if (error instanceof DOMException) return error.name === "AbortError";
|
|
443
455
|
if (!(error instanceof Error)) return false;
|
|
444
456
|
const errorCode = "code" in error && typeof error.code === "string" ? error.code : void 0;
|
|
445
|
-
return error.name === "AbortError" || error.message === "terminated" || errorCode === "UND_ERR_SOCKET" || /abort|cancel|disconnect|premature close|socket|terminated/i.test(error.message);
|
|
457
|
+
return error.name === "AbortError" || error.message === "terminated" || errorCode === "UND_ERR_SOCKET" || error instanceof TypeError && /^(?:failed to fetch|fetch failed)$/i.test(error.message) || /abort|cancel|disconnect|premature close|socket|terminated/i.test(error.message);
|
|
446
458
|
}
|
|
447
459
|
async function* readNdjsonStream(body) {
|
|
448
460
|
const reader = body.getReader();
|
|
@@ -521,7 +533,7 @@ const STREAM_OPEN_RETRYABLE_STATUS = new Set([
|
|
|
521
533
|
]);
|
|
522
534
|
async function* openStreamIterable(input) {
|
|
523
535
|
let startIndex = input.startIndex;
|
|
524
|
-
let remainingReconnectAttempts = input.maxReconnectAttempts;
|
|
536
|
+
let remainingReconnectAttempts = input.startIndex < 0 ? 0 : input.maxReconnectAttempts;
|
|
525
537
|
while (true) {
|
|
526
538
|
const body = await openStreamBody({
|
|
527
539
|
...input,
|
|
@@ -546,13 +558,20 @@ async function openStreamBody(input) {
|
|
|
546
558
|
let lastBody;
|
|
547
559
|
let lastHeaders;
|
|
548
560
|
for (let attempt = 0; attempt < STREAM_OPEN_RETRY_ATTEMPTS; attempt += 1) {
|
|
549
|
-
const url = createClientUrl(input.host, createEveMessageStreamRoutePath(input.sessionId), input.startIndex
|
|
561
|
+
const url = createClientUrl(input.host, createEveMessageStreamRoutePath(input.sessionId), input.startIndex !== 0 ? { startIndex: String(input.startIndex) } : void 0);
|
|
550
562
|
const headers = await input.resolveHeaders();
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
563
|
+
let response;
|
|
564
|
+
try {
|
|
565
|
+
response = await fetch(url, {
|
|
566
|
+
headers,
|
|
567
|
+
redirect: input.redirect,
|
|
568
|
+
signal: input.signal ?? null
|
|
569
|
+
});
|
|
570
|
+
} catch (error) {
|
|
571
|
+
if (input.signal?.aborted || !isStreamDisconnectError(error) || attempt === STREAM_OPEN_RETRY_ATTEMPTS - 1) throw error;
|
|
572
|
+
await sleep$1(STREAM_OPEN_RETRY_DELAY_MS);
|
|
573
|
+
continue;
|
|
574
|
+
}
|
|
556
575
|
if (response.ok) {
|
|
557
576
|
if (!response.body) throw new ClientError(response.status, "Response body is null.", response.headers);
|
|
558
577
|
return response.body;
|
|
@@ -587,12 +606,40 @@ var ClientSession = class {
|
|
|
587
606
|
const payload = normalizeSendTurnInput(input);
|
|
588
607
|
const state = this.#state;
|
|
589
608
|
const { continuationToken, sessionId } = await this.#postTurn(payload, state);
|
|
609
|
+
if (this.#state === state) this.#state = {
|
|
610
|
+
...state,
|
|
611
|
+
sessionId
|
|
612
|
+
};
|
|
590
613
|
return new MessageResponse({
|
|
591
614
|
continuationToken,
|
|
592
615
|
createStream: () => this.#createEventStream(sessionId, continuationToken, state, payload),
|
|
593
616
|
sessionId
|
|
594
617
|
});
|
|
595
618
|
}
|
|
619
|
+
async cancel() {
|
|
620
|
+
const sessionId = this.#state.sessionId;
|
|
621
|
+
if (!sessionId) throw new Error("Session has no session ID. Send a message first.");
|
|
622
|
+
const url = createClientUrl(this.#context.host, createEveCancelTurnRoutePath(sessionId));
|
|
623
|
+
const headers = await this.#context.resolveHeaders();
|
|
624
|
+
const response = await fetch(url, withRedirectPolicy$1({
|
|
625
|
+
headers,
|
|
626
|
+
method: "POST"
|
|
627
|
+
}, this.#context.redirect));
|
|
628
|
+
const body = await response.text();
|
|
629
|
+
if (!response.ok) throw new ClientError(response.status, body, response.headers);
|
|
630
|
+
let payload;
|
|
631
|
+
try {
|
|
632
|
+
payload = JSON.parse(body);
|
|
633
|
+
} catch {
|
|
634
|
+
throw new Error(`Cancel route returned invalid JSON (${response.status}).`);
|
|
635
|
+
}
|
|
636
|
+
const result = CancelTurnResponseSchema.safeParse(payload);
|
|
637
|
+
if (!result.success || result.data.sessionId !== sessionId) throw new Error(`Cancel route returned an invalid response (${response.status}).`);
|
|
638
|
+
return {
|
|
639
|
+
sessionId: result.data.sessionId,
|
|
640
|
+
status: result.data.status
|
|
641
|
+
};
|
|
642
|
+
}
|
|
596
643
|
stream(options) {
|
|
597
644
|
const sessionId = this.#state.sessionId;
|
|
598
645
|
if (!sessionId) throw new Error("Session has no session ID. Send a message first.");
|
|
@@ -689,7 +736,7 @@ var ClientSession = class {
|
|
|
689
736
|
yield event;
|
|
690
737
|
}
|
|
691
738
|
} finally {
|
|
692
|
-
this.#state = advanceSession({
|
|
739
|
+
if (streamIndex >= 0) this.#state = advanceSession({
|
|
693
740
|
continuationToken: initialState.continuationToken,
|
|
694
741
|
events,
|
|
695
742
|
preserveCompletedSessions: this.#context.preserveCompletedSessions,
|
|
@@ -746,6 +793,12 @@ function createHandleMessageBody(input) {
|
|
|
746
793
|
if (input.session.continuationToken !== void 0 && body.message === void 0 && body.inputResponses === void 0) return null;
|
|
747
794
|
return body;
|
|
748
795
|
}
|
|
796
|
+
function withRedirectPolicy$1(init, redirect) {
|
|
797
|
+
return redirect === void 0 ? init : {
|
|
798
|
+
...init,
|
|
799
|
+
redirect
|
|
800
|
+
};
|
|
801
|
+
}
|
|
749
802
|
|
|
750
803
|
//#endregion
|
|
751
804
|
//#region src/client/types.ts
|
|
@@ -1343,6 +1396,17 @@ function reduceMessageData(data, event) {
|
|
|
1343
1396
|
});
|
|
1344
1397
|
case "result.completed": return updateAssistantMetadata(data, event.data.turnId, { result: event.data.result });
|
|
1345
1398
|
case "turn.completed": return updateAssistantMetadata(data, event.data.turnId, { status: "complete" });
|
|
1399
|
+
case "turn.cancelled": return updateAssistantMessage(data, event.data.turnId, (message) => ({
|
|
1400
|
+
...message,
|
|
1401
|
+
metadata: {
|
|
1402
|
+
...message.metadata,
|
|
1403
|
+
status: "complete"
|
|
1404
|
+
},
|
|
1405
|
+
parts: message.parts.map((part) => (part.type === "text" || part.type === "reasoning") && part.state === "streaming" ? {
|
|
1406
|
+
...part,
|
|
1407
|
+
state: "done"
|
|
1408
|
+
} : part)
|
|
1409
|
+
}));
|
|
1346
1410
|
case "turn.failed":
|
|
1347
1411
|
case "session.failed": return data;
|
|
1348
1412
|
default: return data;
|
|
@@ -8,6 +8,7 @@ const EVE_INFO_ROUTE_PATH = `${EVE_ROUTE_PREFIX}/info`;
|
|
|
8
8
|
const EVE_CREATE_SESSION_ROUTE_PATH = `${EVE_ROUTE_PREFIX}/session`;
|
|
9
9
|
const EVE_CONTINUE_SESSION_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/session/:sessionId`;
|
|
10
10
|
const EVE_MESSAGE_STREAM_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/session/:sessionId/stream`;
|
|
11
|
+
const EVE_CANCEL_TURN_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/session/:sessionId/cancel`;
|
|
11
12
|
const EVE_DEV_DISPATCH_SCHEDULE_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/dev/schedules/:scheduleId`;
|
|
12
13
|
const EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH = `${EVE_ROUTE_PREFIX}/dev/runtime-artifacts`;
|
|
13
14
|
const EVE_DEV_RUNTIME_ARTIFACTS_REBUILD_ROUTE_PATH = `${EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH}/rebuild`;
|
|
@@ -19,6 +20,9 @@ function createEveMessageStreamRoutePath(sessionId) {
|
|
|
19
20
|
function createEveContinueSessionRoutePath(sessionId) {
|
|
20
21
|
return `${EVE_ROUTE_PREFIX}/session/${encodeURIComponent(sessionId)}`;
|
|
21
22
|
}
|
|
23
|
+
function createEveCancelTurnRoutePath(sessionId) {
|
|
24
|
+
return `${EVE_ROUTE_PREFIX}/session/${encodeURIComponent(sessionId)}/cancel`;
|
|
25
|
+
}
|
|
22
26
|
|
|
23
27
|
//#endregion
|
|
24
28
|
//#region src/client/agent-info-error.ts
|
|
@@ -290,6 +294,14 @@ function isCurrentTurnBoundaryEvent(event) {
|
|
|
290
294
|
return event.type === "session.completed" || event.type === "session.failed" || event.type === "session.waiting";
|
|
291
295
|
}
|
|
292
296
|
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/protocol/cancel-turn.ts
|
|
299
|
+
const CancelTurnResponseSchema = z.object({
|
|
300
|
+
ok: z.literal(true),
|
|
301
|
+
sessionId: z.string().min(1),
|
|
302
|
+
status: z.enum(["accepted", "no_active_turn"])
|
|
303
|
+
});
|
|
304
|
+
|
|
293
305
|
//#endregion
|
|
294
306
|
//#region src/shared/json.ts
|
|
295
307
|
const INVALID_JSON_VALUE_CANDIDATE = Symbol("invalid-json-value-candidate");
|
|
@@ -373,7 +385,7 @@ function advanceSession(input) {
|
|
|
373
385
|
const boundaryEvent = findBoundaryEvent(input.events);
|
|
374
386
|
const streamIndex = input.session.streamIndex + input.events.length;
|
|
375
387
|
if (boundaryEvent?.type === "session.waiting" || input.preserveCompletedSessions === true && boundaryEvent?.type === "session.completed") return {
|
|
376
|
-
continuationToken: input.continuationToken ?? input.session.continuationToken,
|
|
388
|
+
continuationToken: boundaryEvent?.type === "session.waiting" ? boundaryEvent.data.continuationToken : input.continuationToken ?? input.session.continuationToken,
|
|
377
389
|
sessionId: input.sessionId,
|
|
378
390
|
streamIndex
|
|
379
391
|
};
|
|
@@ -442,7 +454,7 @@ function isStreamDisconnectError(error) {
|
|
|
442
454
|
if (error instanceof DOMException) return error.name === "AbortError";
|
|
443
455
|
if (!(error instanceof Error)) return false;
|
|
444
456
|
const errorCode = "code" in error && typeof error.code === "string" ? error.code : void 0;
|
|
445
|
-
return error.name === "AbortError" || error.message === "terminated" || errorCode === "UND_ERR_SOCKET" || /abort|cancel|disconnect|premature close|socket|terminated/i.test(error.message);
|
|
457
|
+
return error.name === "AbortError" || error.message === "terminated" || errorCode === "UND_ERR_SOCKET" || error instanceof TypeError && /^(?:failed to fetch|fetch failed)$/i.test(error.message) || /abort|cancel|disconnect|premature close|socket|terminated/i.test(error.message);
|
|
446
458
|
}
|
|
447
459
|
async function* readNdjsonStream(body) {
|
|
448
460
|
const reader = body.getReader();
|
|
@@ -521,7 +533,7 @@ const STREAM_OPEN_RETRYABLE_STATUS = new Set([
|
|
|
521
533
|
]);
|
|
522
534
|
async function* openStreamIterable(input) {
|
|
523
535
|
let startIndex = input.startIndex;
|
|
524
|
-
let remainingReconnectAttempts = input.maxReconnectAttempts;
|
|
536
|
+
let remainingReconnectAttempts = input.startIndex < 0 ? 0 : input.maxReconnectAttempts;
|
|
525
537
|
while (true) {
|
|
526
538
|
const body = await openStreamBody({
|
|
527
539
|
...input,
|
|
@@ -546,13 +558,20 @@ async function openStreamBody(input) {
|
|
|
546
558
|
let lastBody;
|
|
547
559
|
let lastHeaders;
|
|
548
560
|
for (let attempt = 0; attempt < STREAM_OPEN_RETRY_ATTEMPTS; attempt += 1) {
|
|
549
|
-
const url = createClientUrl(input.host, createEveMessageStreamRoutePath(input.sessionId), input.startIndex
|
|
561
|
+
const url = createClientUrl(input.host, createEveMessageStreamRoutePath(input.sessionId), input.startIndex !== 0 ? { startIndex: String(input.startIndex) } : void 0);
|
|
550
562
|
const headers = await input.resolveHeaders();
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
563
|
+
let response;
|
|
564
|
+
try {
|
|
565
|
+
response = await fetch(url, {
|
|
566
|
+
headers,
|
|
567
|
+
redirect: input.redirect,
|
|
568
|
+
signal: input.signal ?? null
|
|
569
|
+
});
|
|
570
|
+
} catch (error) {
|
|
571
|
+
if (input.signal?.aborted || !isStreamDisconnectError(error) || attempt === STREAM_OPEN_RETRY_ATTEMPTS - 1) throw error;
|
|
572
|
+
await sleep$1(STREAM_OPEN_RETRY_DELAY_MS);
|
|
573
|
+
continue;
|
|
574
|
+
}
|
|
556
575
|
if (response.ok) {
|
|
557
576
|
if (!response.body) throw new ClientError(response.status, "Response body is null.", response.headers);
|
|
558
577
|
return response.body;
|
|
@@ -587,12 +606,40 @@ var ClientSession = class {
|
|
|
587
606
|
const payload = normalizeSendTurnInput(input);
|
|
588
607
|
const state = this.#state;
|
|
589
608
|
const { continuationToken, sessionId } = await this.#postTurn(payload, state);
|
|
609
|
+
if (this.#state === state) this.#state = {
|
|
610
|
+
...state,
|
|
611
|
+
sessionId
|
|
612
|
+
};
|
|
590
613
|
return new MessageResponse({
|
|
591
614
|
continuationToken,
|
|
592
615
|
createStream: () => this.#createEventStream(sessionId, continuationToken, state, payload),
|
|
593
616
|
sessionId
|
|
594
617
|
});
|
|
595
618
|
}
|
|
619
|
+
async cancel() {
|
|
620
|
+
const sessionId = this.#state.sessionId;
|
|
621
|
+
if (!sessionId) throw new Error("Session has no session ID. Send a message first.");
|
|
622
|
+
const url = createClientUrl(this.#context.host, createEveCancelTurnRoutePath(sessionId));
|
|
623
|
+
const headers = await this.#context.resolveHeaders();
|
|
624
|
+
const response = await fetch(url, withRedirectPolicy$1({
|
|
625
|
+
headers,
|
|
626
|
+
method: "POST"
|
|
627
|
+
}, this.#context.redirect));
|
|
628
|
+
const body = await response.text();
|
|
629
|
+
if (!response.ok) throw new ClientError(response.status, body, response.headers);
|
|
630
|
+
let payload;
|
|
631
|
+
try {
|
|
632
|
+
payload = JSON.parse(body);
|
|
633
|
+
} catch {
|
|
634
|
+
throw new Error(`Cancel route returned invalid JSON (${response.status}).`);
|
|
635
|
+
}
|
|
636
|
+
const result = CancelTurnResponseSchema.safeParse(payload);
|
|
637
|
+
if (!result.success || result.data.sessionId !== sessionId) throw new Error(`Cancel route returned an invalid response (${response.status}).`);
|
|
638
|
+
return {
|
|
639
|
+
sessionId: result.data.sessionId,
|
|
640
|
+
status: result.data.status
|
|
641
|
+
};
|
|
642
|
+
}
|
|
596
643
|
stream(options) {
|
|
597
644
|
const sessionId = this.#state.sessionId;
|
|
598
645
|
if (!sessionId) throw new Error("Session has no session ID. Send a message first.");
|
|
@@ -689,7 +736,7 @@ var ClientSession = class {
|
|
|
689
736
|
yield event;
|
|
690
737
|
}
|
|
691
738
|
} finally {
|
|
692
|
-
this.#state = advanceSession({
|
|
739
|
+
if (streamIndex >= 0) this.#state = advanceSession({
|
|
693
740
|
continuationToken: initialState.continuationToken,
|
|
694
741
|
events,
|
|
695
742
|
preserveCompletedSessions: this.#context.preserveCompletedSessions,
|
|
@@ -746,6 +793,12 @@ function createHandleMessageBody(input) {
|
|
|
746
793
|
if (input.session.continuationToken !== void 0 && body.message === void 0 && body.inputResponses === void 0) return null;
|
|
747
794
|
return body;
|
|
748
795
|
}
|
|
796
|
+
function withRedirectPolicy$1(init, redirect) {
|
|
797
|
+
return redirect === void 0 ? init : {
|
|
798
|
+
...init,
|
|
799
|
+
redirect
|
|
800
|
+
};
|
|
801
|
+
}
|
|
749
802
|
|
|
750
803
|
//#endregion
|
|
751
804
|
//#region src/client/types.ts
|
|
@@ -1343,6 +1396,17 @@ function reduceMessageData(data, event) {
|
|
|
1343
1396
|
});
|
|
1344
1397
|
case "result.completed": return updateAssistantMetadata(data, event.data.turnId, { result: event.data.result });
|
|
1345
1398
|
case "turn.completed": return updateAssistantMetadata(data, event.data.turnId, { status: "complete" });
|
|
1399
|
+
case "turn.cancelled": return updateAssistantMessage(data, event.data.turnId, (message) => ({
|
|
1400
|
+
...message,
|
|
1401
|
+
metadata: {
|
|
1402
|
+
...message.metadata,
|
|
1403
|
+
status: "complete"
|
|
1404
|
+
},
|
|
1405
|
+
parts: message.parts.map((part) => (part.type === "text" || part.type === "reasoning") && part.state === "streaming" ? {
|
|
1406
|
+
...part,
|
|
1407
|
+
state: "done"
|
|
1408
|
+
} : part)
|
|
1409
|
+
}));
|
|
1346
1410
|
case "turn.failed":
|
|
1347
1411
|
case "session.failed": return data;
|
|
1348
1412
|
default: return data;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Command } from "#compiled/commander/index.js";
|
|
2
|
+
import type { ApplicationBuildOptions } from "#internal/nitro/host/types.js";
|
|
3
|
+
export type BuildHost = (appRoot: string, options: ApplicationBuildOptions) => Promise<string>;
|
|
4
|
+
interface BuildCommandLogger {
|
|
5
|
+
log(message: string): void;
|
|
6
|
+
}
|
|
7
|
+
/** Registers the production application build command. */
|
|
8
|
+
export declare function registerBuildCommand(input: {
|
|
9
|
+
readonly appRoot: string;
|
|
10
|
+
readonly buildHost?: BuildHost;
|
|
11
|
+
readonly logger: BuildCommandLogger;
|
|
12
|
+
readonly program: Command;
|
|
13
|
+
}): void;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolve}from"node:path";import{resolveInternalVercelServiceOutput}from"#cli/vercel-service-output.js";import{createCliTheme,renderCliTaggedLine}from"#cli/ui/output.js";function registerBuildCommand(t){let n=createCliTheme();t.program.command(`build`).description(`Build the current eve application.`).option(`--profile <path>`,`Write best-effort timing and output-size profile JSON to a file`).option(`--skip-sandbox-prewarm`,`Skip sandbox template prewarm for a Vercel build; output may not be deployable`).action(async e=>{let{loadDevelopmentEnvironmentFiles:r}=await import(`#cli/dev/environment.js`);r(t.appRoot);let i=t.buildHost??(await import(`#internal/nitro/host.js`)).buildApplication,a=e.profile===void 0?void 0:resolve(t.appRoot,e.profile),o={skipVercelSandboxPrewarm:e.skipSandboxPrewarm===!0,vercelServiceOutput:resolveInternalVercelServiceOutput(t.appRoot)};a!==void 0&&(o.profileOutputPath=a);let s=await i(t.appRoot,o);t.logger.log(renderCliTaggedLine(n,{message:`built output at ${s}`,tag:`build`,tone:`success`}))})}export{registerBuildCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{assertCanAddSelectedChannels,inspectExistingChannelRegistrations}from"./channel-add-conflicts.js";import{NOT_AN_AGENT_MESSAGE}from"./preconditions.js";import{isEveProject,listAuthoredChannels}from"#setup/scaffold/index.js";import{interactiveAsker}from"#setup/ask.js";import{addChannels}from"#setup/boxes/add-channels.js";import{deployProject}from"#setup/boxes/deploy-project.js";import{selectChannels}from"#setup/boxes/select-channels.js";import{detectDeployment,projectResolutionFromDeployment}from"#setup/project-resolution.js";import{createPrompter}from"#setup/prompter.js";import{runInteractive}from"#setup/runner.js";import{createDefaultSetupState,snapshotSetupState}from"#setup/state.js";const KNOWN_CHANNEL_KINDS=[`slack`,`web`];function isChannelKind(e){return KNOWN_CHANNEL_KINDS.includes(e)}function parseChannelKind(e){if(!isChannelKind(e))throw Error(`Unknown channel kind "${e}". Known: ${KNOWN_CHANNEL_KINDS.join(`, `)}.`);return e}const defaultChannelsAddDependencies={detectDeployment};async function runAddChannelsFlow(n,r,i,s){if(r===void 0&&(i.yes||!process.stdin.isTTY||!process.stdout.isTTY))throw Error(`Pass a channel kind: \`eve channels add <${KNOWN_CHANNEL_KINDS.join(`|`)}>\`.`);let c=s.createPrompter?.()??createPrompter();c.intro(`Add channels to your eve agent`),c.log.message(`Checking the current Vercel project...`);let l={...createDefaultSetupState(),project:projectResolutionFromDeployment(await s.detectDeployment(n)),projectPath:{kind:`resolved`,inPlace:!0,path:n}},u;function inspectRegistrations(){return u===void 0&&(c.log.message(`Inspecting existing channel registrations...`),u=inspectExistingChannelRegistrations(n)),u}let d=r===void 0?(await inspectRegistrations()).disabledChannelReasons:void 0,f=await runInteractive([selectChannels({asker:interactiveAsker(c),variant:`channels-add`,presetChannels:r===void 0?void 0:[r],disabledChannelReasons:d,validateSelection:async t=>{!t.includes(`web`)&&!t.includes(`slack`)||assertCanAddSelectedChannels(t,await inspectRegistrations())}}),addChannels({asker:interactiveAsker(c),prompter:c,presetCreateSlackbot:i.yes?!0:void 0,force:i.force,configureVercelServices:!0,ensureLinkedProject:`interactive-vercel-link`,deps:s.addChannelsDeps}),deployProject({prompter:c,ensureLinkedProject:`interactive-vercel-link`,deps:s.deployProjectDeps})],l,{write:e=>c.log.message(e)},{snapshot:snapshotSetupState});f.kind!==`cancelled`&&c.outro(f.state.channels.length===0?`No channels added.`:`Channels added.`)}async function runChannelsAddCommand(e,t,i,a=defaultChannelsAddDependencies){if(!await isEveProject(t)){e.error(NOT_AN_AGENT_MESSAGE),process.exitCode=1;return}try{await runAddChannelsFlow(t,i.kind===void 0?void 0:parseChannelKind(i.kind),i.options,a)}catch(t){e.error(t instanceof Error?t.message:String(t)),process.exitCode=1}}async function runChannelsListCommand(e,t,a){if(!await isEveProject(t)){e.error(NOT_AN_AGENT_MESSAGE),process.exitCode=1;return}let o=await listAuthoredChannels(t);if(a.json){e.log(JSON.stringify({channels:o},null,2));return}if(o.length===0){e.log("No channels defined. Run `eve channels add` to add one.");return}for(let t of o)e.log(t)}export{runChannelsAddCommand,runChannelsListCommand};
|
|
1
|
+
import{assertCanAddSelectedChannels,inspectExistingChannelRegistrations}from"./channel-add-conflicts.js";import{NOT_AN_AGENT_MESSAGE}from"./preconditions.js";import{isEveProject,listAuthoredChannels}from"#setup/scaffold/index.js";import{interactiveAsker}from"#setup/ask.js";import{addChannels}from"#setup/boxes/add-channels.js";import{deployProject}from"#setup/boxes/deploy-project.js";import{reconcileHostFrameworkPreset}from"#setup/boxes/reconcile-host-framework-preset.js";import{selectChannels}from"#setup/boxes/select-channels.js";import{detectDeployment,projectResolutionFromDeployment}from"#setup/project-resolution.js";import{createPrompter}from"#setup/prompter.js";import{runInteractive}from"#setup/runner.js";import{createDefaultSetupState,snapshotSetupState}from"#setup/state.js";const KNOWN_CHANNEL_KINDS=[`slack`,`web`];function isChannelKind(e){return KNOWN_CHANNEL_KINDS.includes(e)}function parseChannelKind(e){if(!isChannelKind(e))throw Error(`Unknown channel kind "${e}". Known: ${KNOWN_CHANNEL_KINDS.join(`, `)}.`);return e}const defaultChannelsAddDependencies={detectDeployment};async function runAddChannelsFlow(n,r,i,s){if(r===void 0&&(i.yes||!process.stdin.isTTY||!process.stdout.isTTY))throw Error(`Pass a channel kind: \`eve channels add <${KNOWN_CHANNEL_KINDS.join(`|`)}>\`.`);let c=s.createPrompter?.()??createPrompter();c.intro(`Add channels to your eve agent`),c.log.message(`Checking the current Vercel project...`);let l={...createDefaultSetupState(),project:projectResolutionFromDeployment(await s.detectDeployment(n)),projectPath:{kind:`resolved`,inPlace:!0,path:n}},u;function inspectRegistrations(){return u===void 0&&(c.log.message(`Inspecting existing channel registrations...`),u=inspectExistingChannelRegistrations(n)),u}let d=r===void 0?(await inspectRegistrations()).disabledChannelReasons:void 0,f=await runInteractive([selectChannels({asker:interactiveAsker(c),variant:`channels-add`,presetChannels:r===void 0?void 0:[r],disabledChannelReasons:d,validateSelection:async t=>{!t.includes(`web`)&&!t.includes(`slack`)||assertCanAddSelectedChannels(t,await inspectRegistrations())}}),addChannels({asker:interactiveAsker(c),prompter:c,presetCreateSlackbot:i.yes?!0:void 0,force:i.force,configureVercelServices:!0,ensureLinkedProject:`interactive-vercel-link`,deps:s.addChannelsDeps}),reconcileHostFrameworkPreset({prompter:c}),deployProject({prompter:c,ensureLinkedProject:`interactive-vercel-link`,deps:s.deployProjectDeps})],l,{write:e=>c.log.message(e)},{snapshot:snapshotSetupState});f.kind!==`cancelled`&&c.outro(f.state.channels.length===0?`No channels added.`:`Channels added.`)}async function runChannelsAddCommand(e,t,i,a=defaultChannelsAddDependencies){if(!await isEveProject(t)){e.error(NOT_AN_AGENT_MESSAGE),process.exitCode=1;return}try{await runAddChannelsFlow(t,i.kind===void 0?void 0:parseChannelKind(i.kind),i.options,a)}catch(t){e.error(t instanceof Error?t.message:String(t)),process.exitCode=1}}async function runChannelsListCommand(e,t,a){if(!await isEveProject(t)){e.error(NOT_AN_AGENT_MESSAGE),process.exitCode=1;return}let o=await listAuthoredChannels(t);if(a.json){e.log(JSON.stringify({channels:o},null,2));return}if(o.length===0){e.log("No channels defined. Run `eve channels add` to add one.");return}for(let t of o)e.log(t)}export{runChannelsAddCommand,runChannelsListCommand};
|
|
@@ -12,10 +12,11 @@ export interface LinkCommandDependencies {
|
|
|
12
12
|
flowDeps?: Partial<LinkFlowDeps>;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* `eve link`: pick a Vercel team
|
|
16
|
-
* linked), run `vercel link` for the
|
|
17
|
-
* credential lands in `.env.local`. The flow
|
|
18
|
-
*
|
|
19
|
-
*
|
|
15
|
+
* `eve link`: pick a Vercel team, then create or select a project (re-linking
|
|
16
|
+
* when one is already linked), run `vercel link` for the resolved project,
|
|
17
|
+
* then pull env so the AI Gateway credential lands in `.env.local`. The flow
|
|
18
|
+
* itself is {@link runLinkFlow}, shared with the dev TUI `/model` menu's
|
|
19
|
+
* provider row. Interactive only: the pickers are the point of the command, so
|
|
20
|
+
* a non-TTY run refuses with guidance instead of guessing a project.
|
|
20
21
|
*/
|
|
21
22
|
export declare function runLinkCommand(logger: LinkCliLogger, appRoot: string, dependencies?: LinkCommandDependencies): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{NOT_AN_AGENT_MESSAGE,hasInteractiveTerminal}from"./preconditions.js";import{isEveProject}from"#setup/scaffold/index.js";import{createPrompter}from"#setup/prompter.js";import{runLinkFlow}from"#setup/flows/link.js";const defaultDependencies={isEveProject,hasInteractiveTerminal};async function runLinkCommand(t,n,r=defaultDependencies){if(!await r.isEveProject(n)){t.error(NOT_AN_AGENT_MESSAGE),process.exitCode=1;return}if(!r.hasInteractiveTerminal()){t.error("`eve link` needs an interactive terminal to pick the team and project. In CI, run `vercel link --project <name> --yes --non-interactive` instead."),process.exitCode=1;return}let i=r.createPrompter?.()??createPrompter();i.intro(`Link your eve agent to Vercel`);try{let e=await runLinkFlow({appRoot:n,prompter:i,deps:r.flowDeps});i.outro(e.kind===`cancelled`?`Cancelled.`:`Project linked.`)}catch(e){t.error(e instanceof Error?e.message:String(e)),process.exitCode=1}}export{runLinkCommand};
|
|
1
|
+
import{NOT_AN_AGENT_MESSAGE,hasInteractiveTerminal}from"./preconditions.js";import{isEveProject}from"#setup/scaffold/index.js";import{createPrompter}from"#setup/prompter.js";import{runLinkFlow}from"#setup/flows/link.js";const defaultDependencies={isEveProject,hasInteractiveTerminal};async function runLinkCommand(t,n,r=defaultDependencies){if(!await r.isEveProject(n)){t.error(NOT_AN_AGENT_MESSAGE),process.exitCode=1;return}if(!r.hasInteractiveTerminal()){t.error("`eve link` needs an interactive terminal to pick the team and project. In CI, run `vercel link --project <name> --yes --non-interactive` instead."),process.exitCode=1;return}let i=r.createPrompter?.()??createPrompter();i.intro(`Link your eve agent to Vercel`);try{let e=await runLinkFlow({appRoot:n,prompter:i,projectSelection:`create-or-link`,deps:r.flowDeps});i.outro(e.kind===`cancelled`?`Cancelled.`:`Project linked.`)}catch(e){t.error(e instanceof Error?e.message:String(e)),process.exitCode=1}}export{runLinkCommand};
|
|
@@ -281,8 +281,8 @@ export type EveTUIRunnerOptions = TuiDisplayOptions & {
|
|
|
281
281
|
formatTransportError?: (error: unknown) => string;
|
|
282
282
|
/**
|
|
283
283
|
* Local `eve dev` server URL. When present, normal prompts refresh the
|
|
284
|
-
*
|
|
285
|
-
* artifacts
|
|
284
|
+
* runtime artifacts after HMR so the next prompt uses the latest authored
|
|
285
|
+
* artifacts while retaining its logical session.
|
|
286
286
|
*/
|
|
287
287
|
serverUrl?: string;
|
|
288
288
|
/** Absolute local application root; omitted for remote `--url` sessions. */
|