eve 0.29.3 → 0.29.4
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 +18 -0
- package/dist/src/acp/adapter.d.ts +43 -0
- package/dist/src/acp/adapter.js +1 -0
- package/dist/src/acp/line-limit.d.ts +3 -0
- package/dist/src/acp/line-limit.js +1 -0
- package/dist/src/acp/server.d.ts +24 -0
- package/dist/src/acp/server.js +1 -0
- package/dist/src/chunks/{use-eve-agent-DaH3cf8K.js → use-eve-agent-8mofdZcO.js} +45 -10
- package/dist/src/chunks/{use-eve-agent-CyDt3Lny.js → use-eve-agent-bKJbH0k4.js} +45 -10
- package/dist/src/cli/acp/command.d.ts +22 -0
- package/dist/src/cli/acp/command.js +4 -0
- package/dist/src/cli/commands/agent-prompt/build-and-verify.md +4 -0
- package/dist/src/cli/commands/extension-init.js +1 -1
- package/dist/src/cli/commands/init-git.js +1 -1
- package/dist/src/cli/commands/init-repl.js +1 -1
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/logs.js +2 -2
- package/dist/src/cli/commands/register-integration-commands.js +1 -1
- package/dist/src/cli/commands/register-registry-commands.js +1 -1
- package/dist/src/cli/commands/registry-project.js +1 -1
- package/dist/src/cli/commands/registry-setup-command.js +1 -1
- package/dist/src/cli/commands/registry.d.ts +14 -2
- package/dist/src/cli/commands/registry.js +1 -1
- package/dist/src/cli/commands/trace.d.ts +2 -2
- package/dist/src/cli/dev/command-options.d.ts +22 -0
- package/dist/src/cli/dev/command-options.js +1 -0
- package/dist/src/cli/dev/diagnostic-dump.js +1 -1
- package/dist/src/cli/dev/diagnostic-sink.js +1 -1
- package/dist/src/cli/dev/local-server-cleanup.js +1 -1
- package/dist/src/cli/dev/local-server-process.js +1 -1
- package/dist/src/cli/dev/tui/command-typeahead.js +1 -1
- package/dist/src/cli/dev/tui/remote-auth.d.ts +6 -3
- package/dist/src/cli/dev/tui/remote-connection-probe.js +1 -1
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/stream-format.d.ts +14 -0
- package/dist/src/cli/dev/tui/stream-format.js +2 -2
- package/dist/src/cli/dev/tui/terminal-background.d.ts +23 -0
- package/dist/src/cli/dev/tui/terminal-background.js +1 -0
- package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
- package/dist/src/cli/dev/tui/traces/trace-content.d.ts +7 -0
- package/dist/src/cli/dev/tui/traces/trace-content.js +2 -2
- package/dist/src/cli/dev/tui/traces/trace-conversation.d.ts +10 -5
- package/dist/src/cli/dev/tui/traces/trace-conversation.js +1 -1
- package/dist/src/cli/dev/tui/traces/trace-store.js +1 -1
- package/dist/src/cli/dev/tui/traces/trace-surfaces.d.ts +40 -0
- package/dist/src/cli/dev/tui/traces/trace-surfaces.js +1 -0
- package/dist/src/cli/dev/tui/traces/trace-view.d.ts +8 -1
- package/dist/src/cli/dev/tui/traces/trace-view.js +2 -2
- package/dist/src/cli/dev/tui/traces/trace-viewer-session.d.ts +13 -0
- package/dist/src/cli/dev/tui/traces/trace-viewer-session.js +1 -1
- package/dist/src/cli/dev/tui/traces/trace-viewer-state.js +1 -1
- package/dist/src/cli/dev/tui/tui.js +1 -1
- package/dist/src/cli/invoke/invoke.js +1 -1
- package/dist/src/cli/invoke/result.js +1 -1
- package/dist/src/cli/run.d.ts +3 -0
- package/dist/src/cli/run.js +3 -3
- package/dist/src/cli/ui/terminal-text.d.ts +0 -3
- package/dist/src/cli/ui/terminal-text.js +1 -1
- package/dist/src/client/index.d.ts +1 -1
- package/dist/src/client/open-stream.js +1 -1
- package/dist/src/client/session.d.ts +15 -1
- package/dist/src/client/session.js +1 -1
- package/dist/src/client/types.d.ts +9 -0
- package/dist/src/compiled/.vendor-stamp.json +2 -1
- package/dist/src/compiled/@agentclientprotocol/sdk/LICENSE +191 -0
- package/dist/src/compiled/@agentclientprotocol/sdk/index.d.ts +1835 -0
- package/dist/src/compiled/@agentclientprotocol/sdk/index.js +65 -0
- package/dist/src/compiled/@agentclientprotocol/sdk/jsonrpc.d.ts +603 -0
- package/dist/src/compiled/@agentclientprotocol/sdk/schema/guards.gen.d.ts +199 -0
- package/dist/src/compiled/@agentclientprotocol/sdk/schema/index.d.ts +51 -0
- package/dist/src/compiled/@agentclientprotocol/sdk/schema/types.gen.d.ts +6118 -0
- package/dist/src/compiled/@agentclientprotocol/sdk/stream.d.ts +35 -0
- package/dist/src/compiler/artifacts.js +1 -1
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/model-catalog.js +1 -1
- package/dist/src/compiler/normalize-sandbox.js +1 -1
- package/dist/src/compiler/workspace-resources.js +1 -1
- package/dist/src/discover/project-source.js +1 -1
- package/dist/src/evals/cli/eval.js +2 -2
- package/dist/src/evals/loaders/json.js +1 -1
- package/dist/src/evals/loaders/yaml.js +1 -1
- package/dist/src/evals/runner/artifacts.js +1 -1
- package/dist/src/evals/runner/discover.js +1 -1
- package/dist/src/evals/runner/reporters/junit.js +1 -1
- package/dist/src/evals/session.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker-cli.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker-templates.js +1 -1
- package/dist/src/execution/sandbox/bindings/just-bash-runtime.js +1 -1
- package/dist/src/execution/sandbox/bindings/just-bash.js +1 -1
- package/dist/src/execution/sandbox/bindings/local-backend-utils.js +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-lifecycle.js +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-metadata.js +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-platform.js +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-runtime.js +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-templates.js +1 -1
- package/dist/src/execution/sandbox/development-cleanup.js +1 -1
- package/dist/src/execution/sandbox/template-prewarm-lock.js +1 -1
- package/dist/src/harness/attachment-staging.js +1 -1
- package/dist/src/internal/application/build-profile.js +1 -1
- package/dist/src/internal/application/build-workspace.js +1 -1
- package/dist/src/internal/application/cache-metadata.js +1 -1
- package/dist/src/internal/application/compiled-artifacts.js +8 -8
- package/dist/src/internal/application/optional-package-install.js +2 -2
- package/dist/src/internal/application/output-publication-artifacts.js +1 -1
- package/dist/src/internal/application/output-publication-journal.js +1 -1
- package/dist/src/internal/application/output-publication-lock.js +1 -1
- package/dist/src/internal/application/output-publication.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/application/paths.js +1 -1
- package/dist/src/internal/application/production-compiler-artifacts.js +1 -1
- package/dist/src/internal/application/tsconfig-dependencies.js +1 -1
- package/dist/src/internal/authored-asset-import-plugin.js +1 -1
- package/dist/src/internal/authored-module-loader.js +3 -3
- package/dist/src/internal/authored-package-tsconfig-paths.js +1 -1
- package/dist/src/internal/materialized-authored-modules.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-artifacts-retention.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/dev-runtime-source-snapshot.js +1 -1
- package/dist/src/internal/nitro/host/build-application.js +1 -1
- package/dist/src/internal/nitro/host/build-extension.js +1 -1
- package/dist/src/internal/nitro/host/build-vercel-agent-summary.js +1 -1
- package/dist/src/internal/nitro/host/configure-nitro-routes.js +3 -3
- package/dist/src/internal/nitro/host/copy-host-middleware.js +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/cron-handler-route.js +1 -1
- package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.js +1 -1
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
- package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
- package/dist/src/internal/nitro/host/dev-host-workspace.js +1 -1
- package/dist/src/internal/nitro/host/dev-server-http.js +1 -1
- package/dist/src/internal/nitro/host/dev-server-state.js +1 -1
- package/dist/src/internal/nitro/host/dev-workspace-extensions.js +1 -1
- package/dist/src/internal/nitro/host/extension-build-config.js +1 -1
- package/dist/src/internal/nitro/host/extension-declarations.js +2 -2
- package/dist/src/internal/nitro/host/extension-distribution.js +3 -3
- package/dist/src/internal/nitro/host/extension-state-usage.js +1 -1
- package/dist/src/internal/nitro/host/normalize-vercel-service-crons.js +1 -1
- package/dist/src/internal/nitro/host/start-development-server.js +2 -2
- package/dist/src/internal/nitro/host/start-production-server.js +2 -2
- package/dist/src/internal/nitro/host/types.d.ts +2 -0
- package/dist/src/internal/vercel/project-link.js +1 -1
- package/dist/src/internal/workflow/development-world-client.js +1 -1
- package/dist/src/internal/workflow-bundle/builder-support.js +6 -6
- package/dist/src/internal/workflow-bundle/builder.js +3 -3
- package/dist/src/internal/workflow-bundle/nitro-step-entry.js +2 -2
- package/dist/src/internal/workflow-bundle/vercel-workflow-output.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
- package/dist/src/public/channels/discord/discordChannel.js +1 -1
- package/dist/src/public/channels/discord/verify.js +1 -1
- package/dist/src/public/channels/github/auth.js +2 -2
- package/dist/src/public/channels/github/githubChannel.js +1 -1
- package/dist/src/public/channels/github/verify.js +1 -1
- package/dist/src/public/channels/linear/inbound.js +2 -2
- package/dist/src/public/channels/linear/linearChannel.js +1 -1
- package/dist/src/public/channels/linear/verify.js +1 -1
- package/dist/src/public/channels/teams/teamsChannel.js +1 -1
- package/dist/src/public/channels/telegram/verify.js +1 -1
- package/dist/src/public/channels/twilio/twilioChannel.js +1 -1
- package/dist/src/public/models/openai/chatgpt/auth.js +1 -1
- package/dist/src/public/next/server.js +2 -2
- package/dist/src/public/next/vercel-output-config.js +1 -1
- package/dist/src/public/nuxt/dev-server.js +1 -1
- package/dist/src/public/nuxt/vercel-services.js +1 -1
- package/dist/src/public/sveltekit/dev-server.js +1 -1
- package/dist/src/public/sveltekit/vercel-json.js +1 -1
- package/dist/src/runtime/framework-tools/file-state.js +1 -1
- package/dist/src/runtime/sandbox/keys.js +1 -1
- package/dist/src/runtime/workspace/seed-files.js +1 -1
- package/dist/src/setup/boxes/detect-ai-gateway.js +1 -1
- package/dist/src/setup/index.d.ts +1 -0
- package/dist/src/setup/index.js +1 -1
- package/dist/src/setup/integrations/discord/api.d.ts +15 -0
- package/dist/src/setup/integrations/discord/api.js +1 -0
- package/dist/src/setup/integrations/discord/connect.d.ts +24 -0
- package/dist/src/setup/integrations/discord/connect.js +1 -0
- package/dist/src/setup/integrations/discord/setup.d.ts +19 -0
- package/dist/src/setup/integrations/discord/setup.js +8 -0
- package/dist/src/setup/integrations/registry.js +1 -1
- package/dist/src/setup/package-manager.js +1 -1
- package/dist/src/setup/primitives/pm/pnpm.js +3 -3
- package/dist/src/setup/project-resolution.js +1 -1
- package/dist/src/setup/prompter.js +1 -1
- package/dist/src/setup/registry-setup-client.d.ts +6 -2
- package/dist/src/setup/registry-setup-client.js +1 -1
- package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
- package/dist/src/setup/scaffold/create/extension.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +2 -9
- package/dist/src/setup/scaffold/files.js +1 -1
- package/dist/src/setup/scaffold/update/channels.js +2 -2
- package/dist/src/setup/scaffold/update/connections.js +1 -1
- package/dist/src/setup/scaffold/workspace-root.js +1 -1
- package/dist/src/setup/slack-connect-lifecycle.js +1 -1
- package/dist/src/setup/vercel-project-framework.js +1 -1
- package/dist/src/shared/guards.d.ts +2 -0
- package/dist/src/shared/guards.js +1 -1
- package/dist/src/shared/skill-package.js +1 -1
- package/dist/src/shared/skill-paths.d.ts +4 -4
- package/dist/src/shared/skill-paths.js +2 -2
- package/dist/src/shared/vercel-output-directory.js +1 -1
- package/dist/src/source-change/static-source-change.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tracing/local-instrumentation-runtime.js +1 -1
- package/dist/src/tracing/local-trace-reader.d.ts +22 -5
- package/dist/src/tracing/local-trace-reader.js +1 -1
- package/dist/src/tracing/local-trace-retention.js +1 -1
- package/dist/src/tracing/local-trace-span-processor.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/channels/discord.mdx +30 -14
- package/docs/guides/acp.md +91 -0
- package/docs/guides/client/streaming.mdx +24 -0
- package/docs/guides/meta.json +1 -0
- package/docs/reference/cli.md +3 -0
- package/package.json +2 -1
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* and the poll/repaint lifecycle is testable without a TTY.
|
|
6
6
|
*/
|
|
7
7
|
import type { TerminalKey } from "../stream-format.js";
|
|
8
|
+
import type { RgbColor } from "../terminal-background.js";
|
|
8
9
|
import type { Theme } from "../theme.js";
|
|
9
10
|
import type { TraceStore } from "./trace-store.js";
|
|
10
11
|
export interface TraceViewerOpenOptions {
|
|
@@ -29,6 +30,12 @@ export interface TraceViewerSessionOptions extends TraceViewerOpenOptions {
|
|
|
29
30
|
readonly store?: TraceStore;
|
|
30
31
|
/** Receives drag-selected text (wired to the clipboard by the renderer). */
|
|
31
32
|
readonly copyText?: (text: string) => void;
|
|
33
|
+
/**
|
|
34
|
+
* The terminal's default background from an earlier OSC 11 reply, so a
|
|
35
|
+
* reopened viewer paints its card surfaces on the first frame instead of
|
|
36
|
+
* waiting for the terminal to answer the probe again.
|
|
37
|
+
*/
|
|
38
|
+
readonly terminalBackground?: RgbColor;
|
|
32
39
|
}
|
|
33
40
|
export declare class TraceViewerSession {
|
|
34
41
|
#private;
|
|
@@ -36,6 +43,12 @@ export declare class TraceViewerSession {
|
|
|
36
43
|
start(): void;
|
|
37
44
|
/** Feeds one key through the reducer; returns `"close"` when the viewer should close. */
|
|
38
45
|
handleKey(key: TerminalKey): "close" | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Applies the terminal's OSC 11 background reply: derives the card
|
|
48
|
+
* surfaces from the user's own palette and repaints. No-color themes keep
|
|
49
|
+
* the plain rail rendering.
|
|
50
|
+
*/
|
|
51
|
+
setTerminalBackground(background: RgbColor): void;
|
|
39
52
|
repaint(): void;
|
|
40
53
|
dispose(): void;
|
|
41
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createTraceStore}from"./trace-store.js";import{conversationItemLineCount}from"./trace-conversation.js";import{applyLoadedTrace,applyTraceList,createTraceViewerState,reduceTraceViewerKey}from"./trace-viewer-state.js";import{conversationSelectionText,panelSelectionText,renderTraceViewer}from"./trace-view.js";var TraceViewerSession=class{#e;#t;#n=createTraceViewerState();#r;#i;#a;#o;#s;#c=!1;#l=!1;#u=!1;#d={timelineViewportRows:0,panelViewportRows:0,panelTotalRows:0,contentWidth:0};constructor(
|
|
1
|
+
import{createTraceStore}from"./trace-store.js";import{deriveTraceViewerSurfaces}from"./trace-surfaces.js";import{conversationItemLineCount}from"./trace-conversation.js";import{applyLoadedTrace,applyTraceList,createTraceViewerState,reduceTraceViewerKey}from"./trace-viewer-state.js";import{conversationSelectionText,panelSelectionText,renderTraceViewer}from"./trace-view.js";var TraceViewerSession=class{#e;#t;#n=createTraceViewerState();#r;#i;#a;#o;#s;#c=!1;#l=!1;#u=!1;#d;#f={timelineViewportRows:0,panelViewportRows:0,panelTotalRows:0,contentWidth:0};constructor(n){this.#e=n,this.#t=n.store??createTraceStore({appRoot:n.appRoot}),n.terminalBackground!==void 0&&n.theme.color&&(this.#d=deriveTraceViewerSurfaces(n.terminalBackground)),n.sessionId!==void 0&&(this.#i=n.sessionId),n.reference!==void 0&&(this.#i=void 0,this.#n={...this.#n,notice:`No local trace matches "${n.reference}" yet.`})}start(){this.repaint(),this.#m(),this.#a=setInterval(()=>void this.#m(),1e3),this.#a.unref?.()}handleKey(e){if(this.#c)return`close`;e.type===`text`&&(e.value===`[`||e.value===`]`)&&(this.#r=void 0,this.#i=void 0);let t=this.#n.trace!==void 0,{state:n,effect:r,copySelection:i}=reduceTraceViewerKey(this.#n,e,this.#f);if(this.#n=n,r===`close`)return`close`;i!==void 0&&this.#p(i),this.repaint(),t&&n.trace===void 0&&this.#m()}setTerminalBackground(e){this.#c||!this.#e.theme.color||(this.#d=deriveTraceViewerSurfaces(e),this.repaint())}repaint(){if(this.#c)return;let{width:e,height:t}=this.#e.dimensions(),r=renderTraceViewer(this.#n,{width:e,height:t,theme:this.#e.theme,tracingDisabled:this.#e.tracingDisabled,activeWindowEndNs:this.#_(),toast:this.#o,surfaces:this.#d});this.#f={timelineViewportRows:r.timelineViewportRows,panelViewportRows:r.panelViewportRows,panelTotalRows:r.panelTotalRows,contentWidth:r.contentWidth,conversationLineCounts:this.#n.conversationItems.map((e,t)=>conversationItemLineCount(e,r.contentWidth,this.#e.theme,this.#n.expandedItems.has(t)))},this.#e.paint(r.rows)}dispose(){this.#c=!0,this.#a!==void 0&&(clearInterval(this.#a),this.#a=void 0),this.#s!==void 0&&(clearTimeout(this.#s),this.#s=void 0)}#p(e){let t=e.region===`panel`?panelSelectionText(this.#n,this.#e.dimensions().width,this.#e.theme,e):conversationSelectionText(this.#n,this.#f.contentWidth,this.#e.theme,e,this.#d);t.trim().length!==0&&(this.#e.copyText?.(t),this.#o=`Copied to clipboard`,this.#s!==void 0&&clearTimeout(this.#s),this.#s=setTimeout(()=>{this.#s=void 0,this.#o=void 0,this.repaint()},2e3),this.#s.unref?.())}async#m(){if(!this.#c){if(this.#l){this.#u=!0;return}this.#l=!0;try{do this.#u=!1,await this.#h();while(this.#u&&!this.#c)}finally{this.#l=!1}}}async#h(){try{let e=await this.#t.list(),t=this.#r,n=this.#e.reference;if(t===void 0&&n!==void 0&&(t=e.find(e=>e.traceId.startsWith(n))?.traceId),t===void 0&&this.#i!==void 0&&(t=await this.#g(e,this.#i)),this.#c)return;t!==void 0&&(this.#r=t);let a=e[applyTraceList(this.#n,e,{preferTraceId:t}).traceIndex]?.traceId,o=a===void 0?void 0:await this.#t.read(a);if(this.#c)return;let s=applyTraceList(this.#n,e,{preferTraceId:this.#r});this.#r!==void 0&&e[s.traceIndex]?.traceId===this.#r&&(this.#r=void 0,this.#i=void 0,s.notice?.startsWith(`No local trace matches`)&&(s={...s,notice:void 0})),e[s.traceIndex]?.traceId===a&&(s=applyLoadedTrace(s,o)),this.#n=s,this.repaint()}catch{}}async#g(e,t){for(let n of e){let e=await this.#t.read(n.traceId);if(this.#c)return;if(e?.sessionIds.includes(t))return n.traceId}}#_(){let e=this.#n.traces[this.#n.traceIndex];if(!(e===void 0||this.#n.trace===void 0)&&!(Date.now()-e.lastActivityMs>3e3))return BigInt(Date.now())*1000000n}};export{TraceViewerSession};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buildConversationItems,conversationItemExpandable}from"#cli/dev/tui/traces/trace-conversation.js";const TRACE_VIEWER_HEADER_ROWS=3;function orderedTextSelection(e){let{anchor:t,head:n}=e;return t.line<n.line||t.line===n.line&&t.column<=n.column?{start:t,end:n}:{start:n,end:t}}function createTraceViewerState(){return{traces:[],traceIndex:0,conversationItems:[],expandedItems:new Set,selectedRow:0,scrollRow:0,panelOpen:!1,panelFocus:!1,panelScroll:0}}function selectedTraceViewerSpan(e){return e.conversationItems[e.selectedRow]?.span}function traceViewerItemCount(e){return e.conversationItems.length}function applyTraceList(e,t,n={}){let r=e.traces[e.traceIndex]?.traceId,i=n.preferTraceId===void 0?-1:t.findIndex(e=>e.traceId===n.preferTraceId);i===-1&&(i=r===void 0?-1:t.findIndex(e=>e.traceId===r)),i===-1&&(i=t.length===0?0:Math.max(0,e.traceIndex)),i>=t.length&&(i=Math.max(0,t.length-1));let a=t[i]?.traceId!==r,o=t.length===0?e.notice??`No local traces yet — chat with your agent and spans stream in live.`:e.notice?.startsWith(`No local traces`)?void 0:e.notice;return a?{...e,traces:t,traceIndex:i,notice:o
|
|
1
|
+
import{buildConversationItems,conversationItemExpandable}from"#cli/dev/tui/traces/trace-conversation.js";const TRACE_VIEWER_HEADER_ROWS=3;function orderedTextSelection(e){let{anchor:t,head:n}=e;return t.line<n.line||t.line===n.line&&t.column<=n.column?{start:t,end:n}:{start:n,end:t}}function createTraceViewerState(){return{...clearedTraceView(),traces:[],traceIndex:0}}function clearedTraceView(){return{trace:void 0,conversationItems:[],expandedItems:new Set,selectedRow:0,scrollRow:0,panelOpen:!1,panelFocus:!1,panelScroll:0,textSelection:void 0}}function selectedTraceViewerSpan(e){return e.conversationItems[e.selectedRow]?.span}function traceViewerItemCount(e){return e.conversationItems.length}function applyTraceList(e,t,n={}){let r=e.traces[e.traceIndex]?.traceId,i=n.preferTraceId===void 0?-1:t.findIndex(e=>e.traceId===n.preferTraceId);i===-1&&(i=r===void 0?-1:t.findIndex(e=>e.traceId===r)),i===-1&&(i=t.length===0?0:Math.max(0,e.traceIndex)),i>=t.length&&(i=Math.max(0,t.length-1));let a=t[i]?.traceId!==r,o=t.length===0?e.notice??`No local traces yet — chat with your agent and spans stream in live.`:e.notice?.startsWith(`No local traces`)?void 0:e.notice;return a?{...e,...clearedTraceView(),traces:t,traceIndex:i,notice:o}:{...e,traces:t,traceIndex:i,notice:o}}function applyLoadedTrace(t,n){if(n===void 0)return t.trace===void 0?t:{...t,trace:void 0,conversationItems:[],selectedRow:0,scrollRow:0,panelOpen:!1,panelFocus:!1,panelScroll:0,notice:`This trace was pruned — pick another with [ and ].`};let r=selectedTraceViewerSpan(t)?.spanId,i=t.conversationItems[t.selectedRow]?.kind,a=buildConversationItems(n),o;if(r===void 0)o=t.selectedRow;else{let matches=e=>e.span.spanId===r&&e.kind===i,e=t.conversationItems.slice(0,t.selectedRow).filter(matches).length,n=a.flatMap((e,t)=>matches(e)?[t]:[]);o=n[Math.min(e,n.length-1)]??-1}o===-1&&(o=Math.min(t.selectedRow,a.length-1)),o<0&&(o=0);let s=t.notice?.startsWith(`This trace was pruned`)?void 0:t.notice;return{...t,trace:n,conversationItems:a,selectedRow:o,notice:s}}function reduceTraceViewerKey(e,n,r){let i=Math.max(0,r.panelTotalRows-r.panelViewportRows),a=e.panelScroll>i?{...e,panelScroll:i}:e;switch(n.type){case`escape`:return a.textSelection===void 0?a.panelFocus?{state:{...a,panelFocus:!1}}:a.panelOpen?{state:{...a,panelOpen:!1,panelScroll:0}}:{state:a,effect:`close`}:{state:{...a,textSelection:void 0}};case`ctrl-c`:return{state:a,effect:`close`};case`mouse`:{if(n.action===`press`&&(n.button===64||n.button===65)){let e=n.button===64?-3:3;if(a.panelOpen&&n.x-1>=r.contentWidth){let t=Math.min(i,Math.max(0,a.panelScroll+e));return{state:{...a,panelScroll:t}}}return{state:scrollConversation(a,e,r)}}if(n.action===`press`&&n.button===0){let e=selectionCellAt(a,r,n.x,n.y);return e===void 0?{state:{...a,textSelection:void 0}}:{state:{...a,textSelection:{anchor:e.point,head:e.point,dragging:!1,region:e.region}}}}if(n.action===`press`&&n.button===32){if(a.textSelection===void 0)return{state:a};let e=a.textSelection.region===`panel`?panelCellAt(a,r,n.x,n.y):conversationCellAt(a,r,n.x,n.y);if(e===void 0)return{state:a};let t=a.textSelection.dragging||e.line!==a.textSelection.anchor.line||e.column!==a.textSelection.anchor.column;return{state:{...a,textSelection:{...a.textSelection,head:e,dragging:t}}}}if(n.action!==`release`||n.button!==0)return{state:a};let e=a.textSelection,o={...a,textSelection:void 0};if(e!==void 0&&e.dragging)return{state:o,copySelection:e};let s=n.y-1-3;if(s<0)return{state:o};let c=conversationItemAtBodyRow(o,r,s);if(c===void 0)return{state:o};let l=o.conversationItems[c],u=new Set(o.expandedItems);return l!==void 0&&!u.has(c)&&conversationItemExpandable(l,r.contentWidth)?u.add(c):u.delete(c),{state:{...o,selectedRow:c,expandedItems:u}}}case`enter`:return traceViewerItemCount(a)===0?{state:a}:a.panelOpen?{state:{...a,panelOpen:!1,panelFocus:!1}}:{state:{...a,panelOpen:!0,panelScroll:0}};case`tab`:return a.panelOpen?{state:{...a,panelFocus:!a.panelFocus}}:{state:a};case`up`:case`ctrl-p`:return a.panelFocus?{state:{...a,panelScroll:Math.max(0,a.panelScroll-1)}}:{state:moveSelection(a,-1,r)};case`down`:case`ctrl-n`:return a.panelFocus?{state:{...a,panelScroll:Math.min(i,a.panelScroll+1)}}:{state:moveSelection(a,1,r)};case`home`:return a.panelFocus?{state:{...a,panelScroll:0}}:{state:moveSelection(a,-a.selectedRow,r)};case`end`:return a.panelFocus?{state:{...a,panelScroll:i}}:{state:moveSelection(a,traceViewerItemCount(a)-1-a.selectedRow,r)};case`left`:case`right`:{if(a.panelFocus)return{state:a};let e=a.conversationItems[a.selectedRow];if(e===void 0||!a.expandedItems.has(a.selectedRow)&&!conversationItemExpandable(e,r.contentWidth))return{state:a};let n=new Set(a.expandedItems);n.has(a.selectedRow)?n.delete(a.selectedRow):n.add(a.selectedRow);let i={...a,expandedItems:n};return{state:{...i,scrollRow:conversationScrollRow(i,r)}}}case`text`:return n.framing===`bracketed-paste`?{state:a}:n.value===`q`?{state:a,effect:`close`}:n.value===`[`||n.value===`]`?{state:switchTrace(a,n.value===`[`?1:-1)}:{state:a};default:return{state:a}}}function switchTrace(e,t){if(e.traces.length===0)return e;let n=Math.min(Math.max(0,e.traceIndex+t),e.traces.length-1);return n===e.traceIndex?e:{...e,...clearedTraceView(),traceIndex:n}}function moveSelection(e,t,n){let r=traceViewerItemCount(e);if(r===0)return e;let i=Math.min(Math.max(0,e.selectedRow+t),r-1);return{...e,selectedRow:i,panelScroll:0,scrollRow:conversationScrollRow({...e,selectedRow:i},n)}}function cardLineOffsets(e,t){let n=[0];for(let r=0;r<e.conversationItems.length;r+=1)n.push(n[r]+(t[r]??1)+1);return n}function conversationLineTotal(e,t){let n=cardLineOffsets(e,t);return n[n.length-1]}function conversationScrollRow(e,t){let n=t.conversationLineCounts;if(n===void 0)return e.scrollRow;let r=t.timelineViewportRows,i=cardLineOffsets(e,n)[e.selectedRow]??0,a=n[e.selectedRow]??1,o=i+a;return e.scrollRow<=i&&o<=e.scrollRow+r?e.scrollRow:a>r?i:Math.max(0,o-r)}function conversationCellAt(e,t,n,r){let i=t.conversationLineCounts;if(i===void 0||e.conversationItems.length===0)return;let a=r-1-3;if(a<0||a>=t.timelineViewportRows)return;let o=n-1;if(o<0||o>=t.contentWidth)return;let s=conversationLineTotal(e,i),c=e.scrollRow+a;if(!(c>=s))return{column:o,line:c}}function panelCellAt(e,t,n,r){if(!e.panelOpen||t.panelTotalRows===0)return;let i=r-1-3;if(i<0||i>=t.panelViewportRows)return;let a=n-1-(t.contentWidth+1);if(a<0)return;let o=e.panelScroll+i;if(!(o>=t.panelTotalRows))return{column:a,line:o}}function selectionCellAt(e,t,n,r){let i=conversationCellAt(e,t,n,r);if(i!==void 0)return{point:i,region:`conversation`};let a=panelCellAt(e,t,n,r);if(a!==void 0)return{point:a,region:`panel`}}function conversationItemAtBodyRow(e,t,n){let r=t.conversationLineCounts;if(r===void 0)return;let i=e.scrollRow+n,a=cardLineOffsets(e,r);for(let t=0;t<e.conversationItems.length;t+=1)if(i<a[t+1])return t}function scrollConversation(e,t,n){let r=n.conversationLineCounts;if(r===void 0||e.conversationItems.length===0)return e;let i=n.timelineViewportRows,a=Math.max(0,conversationLineTotal(e,r)-i),o=Math.min(a,Math.max(0,e.scrollRow+t));return o===e.scrollRow?e:{...e,scrollRow:o}}export{TRACE_VIEWER_HEADER_ROWS,applyLoadedTrace,applyTraceList,createTraceViewerState,orderedTextSelection,reduceTraceViewerKey,selectedTraceViewerSpan,traceViewerItemCount};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createDevDiagnostics}from"../diagnostics.js";import{promptCommandsFor}from"./prompt-commands.js";import{probeMcpConnection}from"./mcp-connection-status.js";import{createPromptCommandHandler}from"./prompt-command-handler.js";import{formatRemoteAuthChallengeMessage}from"./remote-auth-result.js";import{remoteHost}from"./target.js";import{EveTUIRunner}from"./runner.js";import{toErrorMessage}from"#shared/errors.js";import{resolveDevelopmentOidcToken,resolveLinkedDevelopmentOidcToken}from"#services/dev-client/request-headers.js";import{isVercelAuthChallenge}from"#services/dev-client/vercel-auth-error.js";import{resolveVercelDeployment}from"#setup/vercel-deployment.js";import{
|
|
1
|
+
import{createDevDiagnostics}from"../diagnostics.js";import{promptCommandsFor}from"./prompt-commands.js";import{probeMcpConnection}from"./mcp-connection-status.js";import{createPromptCommandHandler}from"./prompt-command-handler.js";import{formatRemoteAuthChallengeMessage}from"./remote-auth-result.js";import{remoteHost}from"./target.js";import{EveTUIRunner}from"./runner.js";import{Client}from"#client/index.js";import{toErrorMessage}from"#shared/errors.js";import{resolveDevelopmentOidcToken,resolveLinkedDevelopmentOidcToken}from"#services/dev-client/request-headers.js";import{isVercelAuthChallenge}from"#services/dev-client/vercel-auth-error.js";import{resolveVercelDeployment}from"#setup/vercel-deployment.js";import{resolveLocalDevelopmentClientOptions,resolveRemoteDevelopmentClientOptions}from"#services/dev-client/client-options.js";import{createDevelopmentCredentialGate}from"#services/dev-client/credential-gate.js";function prepareRemoteTarget(e){return{target:e,credentials:createDevelopmentCredentialGate(e.serverUrl),resolveOidcToken:resolveDevelopmentOidcToken,resolveDeployment:t=>resolveVercelDeployment({workspaceRoot:e.workspaceRoot,host:remoteHost(e),signal:t})}}function prepareDevelopmentTarget(e){return e.kind===`local`?{kind:`local`,target:e}:{kind:`remote`,target:e,remote:prepareRemoteTarget(e)}}async function runDevelopmentTui(n){let{target:r,headers:i,initialInput:a,onBootProgress:o,lifecycle:s,withExclusiveTerminal:c,...l}=n,u=prepareDevelopmentTarget(r),{serverUrl:d}=r,f=i===void 0?{}:{headers:i},p=new Client(u.kind===`local`?resolveLocalDevelopmentClientOptions({...f,serverUrl:d,token:()=>resolveLinkedDevelopmentOidcToken(u.target.workspaceRoot)}):resolveRemoteDevelopmentClientOptions({...f,serverUrl:d,credentials:u.remote.credentials})),m={...l,session:p.session(),client:p,serverUrl:d,promptCommandHandler:createPromptCommandHandler({target:r}),availablePromptCommands:promptCommandsFor(r.kind),formatTransportError:e=>isVercelAuthChallenge(e)?formatRemoteAuthChallengeMessage(d):toErrorMessage(e)};u.kind===`local`?(m.appRoot=u.target.workspaceRoot,m.probeMcpConnection=probeMcpConnection):m.remote=u.remote,a!==void 0&&(m.initialInput=a),o!==void 0&&(m.onBootProgress=o),s!==void 0&&(m.lifecycle=s),c!==void 0&&(m.withExclusiveTerminal=c);let h=u.kind===`local`?await createDevDiagnostics(u.target.workspaceRoot).catch(()=>void 0):void 0;h!==void 0&&(m.diagnostics=h);try{await new EveTUIRunner(m).run()}finally{await h?.close()}}export{runDevelopmentTui};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{projectInvocationInputRequest}from"./result.js";import{resolveLinkedDevelopmentOidcToken}from"#services/dev-client/request-headers.js";import{formatVercelTrustedSourcesFailure,isVercelAuthChallenge,vercelTrustedSourcesErrorCode}from"#services/dev-client/vercel-auth-error.js";import{
|
|
1
|
+
import{projectInvocationInputRequest}from"./result.js";import{Client,ClientError}from"#client/index.js";import{resolveLinkedDevelopmentOidcToken}from"#services/dev-client/request-headers.js";import{formatVercelTrustedSourcesFailure,isVercelAuthChallenge,vercelTrustedSourcesErrorCode}from"#services/dev-client/vercel-auth-error.js";import{resolveLocalDevelopmentClientOptions}from"#services/dev-client/client-options.js";import{collectTurnEvents,summarizeTurnEvents}from"#client/session-utils.js";import{resolveVerifiedRemoteDevelopmentClient}from"#setup/verified-remote-client.js";async function runInvoke(e){let{client:t,deploymentResolution:n}=await createInvokeClient(e),r=e.operation.resume,i=t.session(r?.session);if(e.operation.kind===`follow`)return observeSafely(e,i,i.stream({signal:e.signal}),n);let a;try{a=await i.send({...e.operation.payload,signal:e.signal})}catch(e){let t=authenticationFailure(e,void 0,n);if(t!==void 0)return t;throw e}return observeSafely(e,i,a,n)}function resolveInvokeOperation(e){let t=e.prompt?.trim(),n=e.previous;if(n===void 0){if(!t)throw Error(`eve invoke requires a prompt unless --resume is provided.`);return{kind:`send`,payload:{message:t}}}if(n.status===`input-required`){if(!t)throw Error(`This invocation is waiting for an input response.`);return{kind:`send`,payload:{message:t},resume:n.resume}}if(n.status===`running`||n.status===`authorization-required`||n.status===`authentication-required`){if(t)throw Error(n.status===`running`?`A running invocation cannot accept a follow-up prompt.`:`Complete the requested authorization, then resume without a prompt.`);return{kind:`follow`,resume:n.resume}}if(n.status!==`ready`)throw Error(`A terminal ${n.status} invocation cannot be resumed.`);if(!t)throw Error(`A ready invocation requires a follow-up prompt.`);return{kind:`send`,payload:{message:t},resume:n.resume}}async function createInvokeClient(e){if(e.target.kind===`local`)return{client:new Client({...resolveLocalDevelopmentClientOptions({headers:e.headers,serverUrl:e.target.serverUrl,token:()=>resolveLinkedDevelopmentOidcToken(e.target.workspaceRoot)}),preserveCompletedSessions:!0})};let{deploymentResolution:n,options:i}=await resolveVerifiedRemoteDevelopmentClient({headers:e.headers,serverUrl:e.target.serverUrl,signal:e.signal,vercelScope:e.vercelScope,workspaceRoot:e.target.workspaceRoot});return{client:new Client({...i,preserveCompletedSessions:!0}),deploymentResolution:n}}async function observeSafely(e,t,n,r){try{return await observeInvocation(e.target,t,n)}catch(n){if(e.signal?.aborted===!0)return runningResult(e.target,t.state);let i=authenticationFailure(n,createResume(e.target,t.state),r);if(i!==void 0)return i;throw n}}async function observeInvocation(t,n,r){let i=summarizeTurnEvents(await collectTurnEvents(r));if(i.boundary===void 0)return runningResult(t,n.state);if(i.boundary.type===`session.failed`)return{status:`failed`,message:i.boundary.data.message};let a=createResume(t,n.state);if(i.failure?.type===`turn.failed`)return{status:`ready`,outcome:{status:`failed`,message:i.failure.data.message},resume:a};if(i.inputRequests.length>0)return{status:`input-required`,requests:i.inputRequests.map(projectInvocationInputRequest),resume:a};let o=i.pendingAuthorizations;return o.length>0?t.kind===`local`&&o.some(e=>e.webhookUrl!==void 0)?{status:`failed`,message:`Local eve invoke cannot pause for connection authorization because its temporary server must remain available for the callback. Run eve dev, then invoke its URL with --url.`}:{status:`authorization-required`,authorizations:o,resume:a}:{status:`ready`,outcome:i.message===void 0?{status:`completed`}:{status:`completed`,message:i.message},resume:a}}function runningResult(e,t){return{status:`running`,resume:createResume(e,t)}}function createResume(e,t){if(t.sessionId===void 0)throw Error(`Invocation has no resumable session ID.`);return{session:t.continuationToken===void 0?{sessionId:t.sessionId,streamIndex:t.streamIndex}:{continuationToken:t.continuationToken,sessionId:t.sessionId,streamIndex:t.streamIndex},target:e.kind===`local`?{kind:`local`}:{kind:`remote`,serverUrl:e.serverUrl}}}function authenticationFailure(e,t,r){let s,c;if(r?.kind===`not-found`?s=`Vercel could not resolve this deployment in the selected scope. Retry with the owning team's slug via --scope <team-slug>, or provide an explicit Authorization header with -H.`:isVercelAuthChallenge(e)?s=`Vercel Deployment Protection rejected the available credentials. Configure Trusted Sources or set VERCEL_AUTOMATION_BYPASS_SECRET, then retry.`:e instanceof ClientError&&(c=vercelTrustedSourcesErrorCode(e.message),e.status===403&&c===`TRUSTED_SOURCES_ENVIRONMENT_MISMATCH`?s=formatVercelTrustedSourcesFailure(e.message):isEveAuthorizationError(e)&&(s=`The deployment rejected the available credentials. Confirm its eve channel authorization and that your account can access the owning project.`)),s!==void 0)return t===void 0?c===void 0?{status:`authentication-required`,message:s}:{status:`authentication-required`,code:c,message:s}:c===void 0?{status:`authentication-required`,message:s,resume:t}:{status:`authentication-required`,code:c,message:s,resume:t}}function isEveAuthorizationError(e){if(e.status!==401)return!1;try{let t=JSON.parse(e.body);return t.ok===!1&&t.code===`unauthorized`}catch{return!1}}export{resolveInvokeOperation,runInvoke};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{inputOptionSchema,inputRequestSchema}from"#client/index.js";import{z}from"#compiled/zod/index.js";const sessionCursorSchema=z.object({continuationToken:z.string().optional(),sessionId:z.string().min(1),streamIndex:z.number().int().nonnegative()}).strict(),targetSchema=z.discriminatedUnion(`kind`,[z.object({kind:z.literal(`local`)}).strict(),z.object({kind:z.literal(`remote`),serverUrl:z.url()}).strict()]),invokeResumeSchema=z.object({session:sessionCursorSchema,target:targetSchema}).strict(),invocationInputRequestSchema=inputRequestSchema.omit({action:!0,display:!0,options:!0}).extend({options:z.array(inputOptionSchema.omit({style:!0})).optional()}),authorizationChallengeSchema=z.object({displayName:z.string().optional(),expiresAt:z.string().optional(),instructions:z.string().optional(),url:z.string().optional(),userCode:z.string().optional()}).strict(),authorizationInterruptSchema=z.object({authorization:authorizationChallengeSchema.optional(),description:z.string(),name:z.string(),webhookUrl:z.string().optional()}).strict(),turnOutcomeSchema=z.discriminatedUnion(`status`,[z.object({message:z.string().optional(),status:z.literal(`completed`)}).strict(),z.object({message:z.string(),status:z.literal(`failed`)}).strict()]),invokeResultSchema=z.discriminatedUnion(`status`,[z.object({resume:invokeResumeSchema,status:z.literal(`running`)}).strict(),z.object({requests:z.array(invocationInputRequestSchema).readonly(),resume:invokeResumeSchema,status:z.literal(`input-required`)}).strict(),z.object({authorizations:z.array(authorizationInterruptSchema).min(1).readonly(),resume:invokeResumeSchema,status:z.literal(`authorization-required`)}).strict(),z.object({outcome:turnOutcomeSchema,resume:invokeResumeSchema,status:z.literal(`ready`)}).strict(),z.object({message:z.string(),status:z.literal(`failed`)}).strict(),z.object({code:z.string().optional(),message:z.string(),resume:invokeResumeSchema.optional(),status:z.literal(`authentication-required`)}).strict()]);function projectInvocationInputRequest(e){let{allowFreeform:t,kind:n,options:r,prompt:i,requestId:a}=e;return{allowFreeform:t,kind:n,options:r?.map(({description:e,id:t,label:n})=>({description:e,id:t,label:n})),prompt:i,requestId:a}}function parseInvokeResumeInput(e){let t=invokeResultSchema.safeParse(e);if(t.success&&`resume`in t.data&&t.data.resume!==void 0)return t.data;throw Error(`Resume JSON is not a valid resumable eve invoke result.`)}const invokeResultJsonSchema={...z.toJSONSchema(invokeResultSchema,{io:`input`,target:`draft-2020-12`,unrepresentable:`any`}),$id:`https://eve.dev/schemas/invoke-result.json`,title:`eve invoke result`};export{invokeResultJsonSchema,parseInvokeResumeInput,projectInvocationInputRequest};
|
package/dist/src/cli/run.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type BuildHost } from "#cli/commands/build.js";
|
|
2
2
|
import { resolveDevUiMode, resolveTuiDisplayOptions } from "#cli/dev/ui-options.js";
|
|
3
|
+
import { type ResolveVerifiedRemoteDevelopmentClient, type RunAcpServer } from "#cli/acp/command.js";
|
|
3
4
|
import type { RunDevelopmentTuiInput } from "#cli/dev/tui/tui.js";
|
|
4
5
|
import type { EvalCliOptions } from "#evals/cli/eval.js";
|
|
5
6
|
import { type InvokeCliRuntimeDependencies } from "#cli/invoke/command.js";
|
|
@@ -16,6 +17,8 @@ interface CliRuntimeDependencies {
|
|
|
16
17
|
readonly serverUrl: string;
|
|
17
18
|
}): Promise<boolean>;
|
|
18
19
|
buildHost: BuildHost;
|
|
20
|
+
resolveVerifiedRemoteDevelopmentClient: ResolveVerifiedRemoteDevelopmentClient;
|
|
21
|
+
runAcpServer: RunAcpServer;
|
|
19
22
|
printApplicationInfo(logger: CliLogger, appRoot: string, options?: {
|
|
20
23
|
json?: boolean;
|
|
21
24
|
}): Promise<void>;
|
package/dist/src/cli/run.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createLogger}from"#internal/logging.js";import{
|
|
1
|
+
import{createLogger}from"#internal/logging.js";import{Command,CommanderError,InvalidArgumentError}from"#compiled/commander/index.js";import{parseDevelopmentHeaderOption,resolveDevelopmentUrlTarget}from"#cli/dev/url-target.js";import{parseDevelopmentServerUrl}from"#cli/dev/url.js";import{FORCED_EXIT_BACKSTOP_MS,installShutdownSignal,waitForShutdownSignal}from"#cli/shutdown.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{createCliTheme,renderCliTaggedLine}from"#cli/ui/output.js";import{isCodingAgentLaunch}from"#cli/agent-detection.js";import{eveCliBanner}from"#cli/banner.js";import{startCliLiveRow}from"#cli/ui/live-row.js";import{devBootPhase}from"#internal/dev-boot-progress.js";import{registerBuildCommand}from"#cli/commands/build.js";import{resolveApplicationRoot}from"#internal/application/paths.js";import{registerIntegrationCommands}from"#cli/commands/register-integration-commands.js";import{registerProjectCommands}from"#cli/commands/register-project-commands.js";import{registerRegistryCommands}from"#cli/commands/register-registry-commands.js";import{resolveDevUiMode,resolveTuiDisplayOptions}from"#cli/dev/ui-options.js";import{registerAcpCommand}from"#cli/acp/command.js";import{waitForServerOrStop,waitForUiOrServer}from"#cli/dev/wait-for-ui.js";import{registerRuntimeInvokeCommand}from"#cli/invoke/command.js";import{parseContextSizeOption,parseDisplayMode,parseLogsMode,parsePortOption,parseStatsMode}from"#cli/option-parsers.js";import{resolveTuiTitle}from"#cli/dev/tui/target.js";import{resumeDevelopmentRuntimeArtifacts,suspendDevelopmentRuntimeArtifacts}from"#services/dev-client/runtime-artifacts.js";const devBootLog=createLogger(`dev.boot`);function createDevBootProgressReporter(e){return t=>{switch(t.type){case`phase-started`:e?.update(`Building your agent`,t.phase),devBootLog.debug(t.phase);return;case`phase-finished`:devBootLog.debug(`${t.phase} finished`,{ms:t.elapsedMs});return;case`before-first-paint`:e?.stop();return;default:return t}}}async function loadPrintApplicationInfo(){return(await import(`#cli/commands/info.js`)).printApplicationInfo}async function loadRunDevelopmentTui(){return(await import(`#cli/dev/tui/tui.js`)).runDevelopmentTui}async function loadRunEvalCommand(){return(await import(`#evals/cli/eval.js`)).runEvalCommand}async function loadStartHost(){return(await import(`#cli/dev/local-server-process.js`)).createDevelopmentServer}const loadIsActiveDevelopmentServerForApp=async()=>(await import(`#internal/nitro/host.js`)).isActiveDevelopmentServerForApp;async function loadStartProductionHost(){return(await import(`#internal/nitro/host.js`)).startProductionServer}function hasInteractiveTerminal(){return!!(process.stdin.isTTY&&process.stdout.isTTY)}function createCliProgram(e,n){let f=resolveApplicationRoot(),y=resolveInstalledPackageInfo().version,b=new Command,x=createCliTheme();b.name(`eve`).description(`Build and run an eve application.`).version(y).showHelpAfterError().exitOverride().hook(`preAction`,(t,n)=>{[`info`,`dev`,`init`].includes(n.name())&&e.log(eveCliBanner())}).configureOutput({writeErr:t=>{e.error(t.trimEnd())},writeOut:t=>{e.log(t.trimEnd())}}),b.command(`channels`).description(`Manage user-authored channels in the current project.`).command(`list`).description(`List user-authored channels in the current project.`).option(`--json`,`Output as JSON`).action(async t=>{let{runChannelsListCommand:n}=await import(`#cli/commands/channels.js`);await n(e,f,t)}),registerIntegrationCommands({program:b,logger:e,appRoot:f});let S=b.command(`extension`).description(`Create and build reusable eve extension packages.`);S.command(`init [target]`).description(`Create a new eve extension package.`).option(`-y, --yes`,`Accepted for compatibility; has no effect`).action(async(t,n)=>{n.yes&&e.error(`warning: --yes has no effect for eve extension init.`);let{runExtensionInitCommand:r}=await import(`#cli/commands/extension-init.js`);await r(e,f,t)}),S.command(`build`).description(`Build the current package as an eve extension.`).action(async()=>{let{loadDevelopmentEnvironmentFiles:t}=await import(`#cli/dev/environment.js`);t(f);let{runExtensionBuildCommand:n}=await import(`#cli/commands/extension-build.js`);await n(e,f)}),registerRegistryCommands({program:b,logger:e,appRoot:f}),b.command(`init [target]`).description(`Create a new eve agent, or add one to an existing project directory.`).option(`--channel-web-nextjs`,`Add the Web Chat application (Next.js)`).option(`-y, --yes`,`Accepted for compatibility; has no effect`).action(async(t,n)=>{n.yes&&e.error(`warning: --yes has no effect for eve init.`);let{runInitCommand:r}=await import(`#cli/commands/init.js`);await r(e,f,t,{channelWebNextjs:n.channelWebNextjs})}),registerProjectCommands({program:b,logger:e,appRoot:f}),registerBuildCommand({appRoot:f,buildHost:n.buildHost,logger:e,program:b}),b.command(`start`).description(`Start a built eve application.`).option(`--host <host>`,`Host interface to bind`).option(`--port <port>`,`Port to listen on (defaults to $PORT, then 3000)`,parsePortOption).action(async t=>{let{loadDevelopmentEnvironmentFiles:r}=await import(`#cli/dev/environment.js`);r(f);let i=await(n.startProductionHost??await loadStartProductionHost())(f,{host:t.host,port:t.port});e.log(renderCliTaggedLine(x,{message:`server listening at ${i.url}`,tag:`start`,tone:`success`})),await waitForShutdownSignal({close:()=>i.close(),wait:()=>i.wait()})}),registerRuntimeInvokeCommand({appRoot:f,logger:e,program:b,runtime:n}),registerAcpCommand({appRoot:f,eveVersion:y,program:b,resolveVerifiedRemoteDevelopmentClient:n.resolveVerifiedRemoteDevelopmentClient,runAcpServer:n.runAcpServer,startHost:n.startHost}),b.command(`dev`).description(`Start the eve development server or connect to an existing URL.`).argument(`[url]`,`Connect to an existing server URL`,parseDevelopmentServerUrl).option(`--host <host>`,`Host interface to bind`).option(`--port <port>`,`Port to listen on (defaults to $PORT, then 2000)`,parsePortOption).option(`-u, --url <url>`,`Connect to an existing server URL`,parseDevelopmentServerUrl).option(`-H, --header <header>`,`Request header for a URL target, in "Name: value" form (repeatable)`,parseDevelopmentHeaderOption).option(`--no-ui`,`Start the server without an interactive UI`).option(`--name <name>`,`Title shown in the terminal UI (defaults to the app folder name)`).option(`--input <text>`,`Pre-fill the prompt input, or start onboarding with /model`).option(`--tools <mode>`,`How tool calls render: full | collapsed | auto-collapsed | hidden`,parseDisplayMode).option(`--reasoning <mode>`,`How reasoning renders: full | collapsed | auto-collapsed | hidden`,parseDisplayMode).option(`--subagents <mode>`,`How subagent sections render: full | collapsed | auto-collapsed | hidden`,parseDisplayMode).option(`--connection-auth <mode>`,`How connection authorization renders: full | collapsed | auto-collapsed | hidden`,parseDisplayMode).option(`--assistant-response-stats <mode>`,`Assistant header statistic: tokens | tokensPerSecond`,parseStatsMode).option(`--context-size <tokens>`,`Model context window size, shown as a usage percentage`,parseContextSizeOption).option(`--logs <mode>`,`Which server/agent logs to show: all | stderr | sandbox | none`,parseLogsMode).addHelpText(`after`,`
|
|
2
2
|
You can also pass a bare URL, for example: eve dev https://example.com
|
|
3
|
-
`).action(async(t,
|
|
4
|
-
eve traces ls [options]`).description("Show a local `eve dev` trace (the most recent when trace is omitted).").action(async t=>{let{runTraceShowCommand:n}=await import(`#cli/commands/trace.js`);await n(e,
|
|
3
|
+
`).action(async(t,i)=>{let o=resolveDevelopmentUrlTarget(i,t),l=o?.serverUrl,u=hasInteractiveTerminal(),d=resolveDevUiMode({options:i,interactive:u});if(i.input!==void 0&&d===`headless`)throw new InvalidArgumentError(`--input requires the interactive UI.`);let p=!1;l!==void 0&&(p=await(n.isActiveDevelopmentServerForApp??await loadIsActiveDevelopmentServerForApp())({appRoot:f,serverUrl:l}));let runInteractiveUi=async(e,t,r)=>{let a=await devBootPhase(`loading interactive UI`,async()=>n.runDevelopmentTui??await loadRunDevelopmentTui(),t),s=resolveTuiDisplayOptions(i),c=l===void 0||p?{kind:`local`,serverUrl:e.serverUrl,workspaceRoot:e.appRoot??f}:{kind:`remote`,serverUrl:e.serverUrl,workspaceRoot:f},u=resolveTuiTitle({name:i.name,target:c});u!==void 0&&(s.name=u);let d={target:c,initialInput:i.input,onBootProgress:t,lifecycle:r,...s};c.kind===`local`&&(d.withExclusiveTerminal=async t=>await(async()=>{if(!await suspendDevelopmentRuntimeArtifacts({serverUrl:e.serverUrl}))throw Error(`Could not pause the development server for integration setup.`);try{return await t()}finally{await resumeDevelopmentRuntimeArtifacts({serverUrl:e.serverUrl,silent:!0})}})()),o?.headers===void 0?await a(d):await a({...d,headers:o.headers})};if(l){let{loadDevelopmentEnvironmentFiles:t}=await import(`#cli/dev/environment.js`);if(t(f),e.log(`↗ ${p?`local`:`remote`} mode targeting ${x.info(new URL(l).host)}`),d===`headless`){e.log(renderCliTaggedLine(x,{message:`Interactive UI disabled because the current terminal is not a TTY.`,tag:`dev`,tone:`warning`}));return}e.log(``);let n=installShutdownSignal({exitAfterMs:FORCED_EXIT_BACKSTOP_MS});try{await runInteractiveUi({serverUrl:l},void 0,n)}finally{n.dispose()}return}d===`tui`&&e.log(``);let m=d===`tui`?startCliLiveRow(e):void 0,h=createDevBootProgressReporter(m);m?.update(`Building your agent`);let g,_,closeServer=()=>g===void 0?Promise.resolve():(_??=g.close(),_.catch(()=>void 0),_),v=installShutdownSignal({exitAfterMs:FORCED_EXIT_BACKSTOP_MS,onStop:()=>{closeServer()}});try{g=(n.startHost??await loadStartHost())(f,{existing:d===`tui`?`attach-if-unconfigured`:`reject`,host:i.host,onBootProgress:h,port:i.port});let t=(await Promise.race([g.start().then(e=>({handle:e})),v.stopped.then(()=>({handle:void 0}))])).handle;if(t===void 0)return;if(d!==`tui`&&e.log(renderCliTaggedLine(x,{message:`server listening at ${t.url}`,tag:`dev`,tone:`success`})),d===`headless`){i.ui!==!1&&!u&&e.log(renderCliTaggedLine(x,{message:`Interactive UI disabled because the current terminal is not a TTY.`,tag:`dev`,tone:`warning`})),await waitForServerOrStop(g,v);return}await waitForUiOrServer({handle:t,lifecycle:v,server:g,runUi:async()=>await runInteractiveUi({appRoot:t.appRoot,serverUrl:t.url},h,v)})}finally{m?.stop(),await closeServer(),v.dispose()}});let C=b.command(`logs`).description("Inspect local `eve dev` diagnostic logs (.eve/logs).");return C.command(`show [logid]`,{isDefault:!0}).description(`Print a diagnostic log (the most recent when logid is omitted).`).option(`--dump`,`Prepend the log's environment dump (.dump sibling)`).option(`--events`,`Interleave session events from the local workflow store`).action(async(t,n)=>{let{runLogsShowCommand:r}=await import(`#cli/commands/logs.js`);await r(e,f,t,n)}),C.command(`ls`).description(`List diagnostic logs, most recent first.`).option(`--json`,`Output as JSON`).action(async t=>{let{runLogsListCommand:n}=await import(`#cli/commands/logs.js`);await n(e,f,t)}),b.command(`traces [trace]`).usage(`[options] [trace]
|
|
4
|
+
eve traces ls [options]`).description("Show a local `eve dev` trace (the most recent when trace is omitted).").action(async t=>{let{runTraceShowCommand:n}=await import(`#cli/commands/trace.js`);await n(e,f,t)}).command(`ls`).description(`List local traces, most recent first.`).option(`--json`,`Output as JSON`).action(async t=>{let{runTraceListCommand:n}=await import(`#cli/commands/trace.js`);await n(e,f,t)}),b.command(`info`).description(`Print resolved application information.`).option(`--json`,`Output as JSON`).action(async t=>{await(n.printApplicationInfo??await loadPrintApplicationInfo())(e,f,t)}),b.command(`eval`).description(`Run evals against an eve agent.`).argument(`[evalIds...]`,`Eval ids (or directory prefixes) to run (all discovered evals when omitted)`).option(`--url <url>`,`Remote agent URL (skip local host startup)`,parseDevelopmentServerUrl).option(`--tag <tag...>`,`Run only evals carrying a tag`).option(`--exclude-tag <tag...>`,`Skip evals carrying a tag`).option(`--strict`,`Fail the exit code when any score falls below its threshold`).option(`--list`,`Print discovered evals without running them`).option(`--timeout <ms>`,`Per-eval timeout in milliseconds`).option(`--max-concurrency <n>`,`Max concurrent eval executions`).option(`--json`,`Output results as JSON`).option(`--junit <path>`,`Write JUnit XML results to a file`).option(`--skip-report`,`Skip eval-defined reporters (e.g. Braintrust)`).option(`--verbose`,`Stream per-eval t.log lines to stdout`).action(async(t,r)=>{await(n.runEvalCommand??await loadRunEvalCommand())(t,r,e)}),b}async function runCli(e=process.argv.slice(2),t=console,r={}){let i=createCliProgram(t,r),a=e.length===0?[`dev`]:e;try{await i.parseAsync(a,{from:`user`})}catch(e){if(e instanceof CommanderError){if(e.exitCode===0)return;let n=await(r.isCodingAgentLaunch??isCodingAgentLaunch)();if(a[0]===`init`&&n){let{initAgentInstructions:e}=await import(`#cli/commands/agent-instructions.js`);t.log(e())}throw Error(e.message)}throw e}}export{resolveDevUiMode,resolveTuiDisplayOptions,runCli};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export declare const ansiPattern: RegExp;
|
|
2
|
-
export declare const ansiPrefixPattern: RegExp;
|
|
3
1
|
export declare function stripAnsi(input: string): string;
|
|
4
2
|
export declare function stripTerminalControls(input: string): string;
|
|
5
3
|
export declare function visibleLength(input: string): number;
|
|
@@ -35,5 +33,4 @@ export declare function offsetAtVisibleColumn(input: string, column: number): nu
|
|
|
35
33
|
* every emitted row.
|
|
36
34
|
*/
|
|
37
35
|
export declare function wrapVisibleLine(line: string, width: number): string[];
|
|
38
|
-
export declare function codePointWidth(codePoint: number): number;
|
|
39
36
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{graphemes}from"#shared/text-boundaries.js";const ansiPattern=RegExp(`\x1B\\[[0-?]*[ -/]*[@-~]`,`g`),ansiPrefixPattern=RegExp(`^\x1B\\[[0-?]*[ -/]*[@-~]`),emojiPresentationPattern=/\p{Emoji_Presentation}/u,extendedPictographicPattern=/\p{Extended_Pictographic}/u,keycapPattern=/^[#*0-9]\u{fe0f}?\u{20e3}$/u;function stripAnsi(e){return stripTerminalControls(e.replaceAll(ansiPattern,``))}function stripTerminalControls(e){let t=``,n=0;for(;n<e.length;){let r=e.codePointAt(n);if(r==null)break;let i=String.fromCodePoint(r);n+=i.length,!isUnsafeTerminalControlCodePoint(r)&&(t+=i)}return t}function visibleLength(e){let t=0;for(let n of terminalTextUnits(e))t+=n.width;return t}function sliceVisible(e,t){return sliceUnits(terminalTextUnits(e),0,t)}function sliceUnits(e,t,n){if(n<=0)return``;let r=``,i=0,a=t;for(;a<e.length&&i<n;){let t=e[a];if(t.width>0&&i+t.width>n)break;r+=t.text,i+=t.width,a+=1}for(;e[a]?.ansi===!0;)r+=e[a].text,a+=1;return r}function clipVisible(e,t){if(visibleLength(e)<=t)return e;let n=sliceVisible(e,t);return n.includes(`\x1B`)?`${n}[0m`:n}function inputTextWidth(t){let n=0;for(let r of graphemes(t))n+=terminalGraphemeWidth(r.text);return n}function renderInputText(e){return e.replaceAll(` `,` `)}function renderInputWithBlockCursor(e){let t=e.render??renderInputText,n=e.under.length>0?e.under:` `,r=e.visible?e.inverse(renderInputText(n)):t(n);return`${t(e.before)}${r}${t(e.after)}`}function offsetAtVisibleColumn(t,n){if(n<=0)return 0;let r=0;for(let i of graphemes(t)){let e=r+terminalGraphemeWidth(i.text);if(e>n)return i.start;if(e===n)return i.end;r=e}return t.length}function terminalGraphemeWidth(e){let t=0;for(let n of e){let e=n.codePointAt(0);e!==void 0&&(t=Math.max(t,codePointWidth(e)))}return emojiPresentationPattern.test(e)||keycapPattern.test(e)||e.includes(`️`)&&extendedPictographicPattern.test(e)?Math.max(2,t):t}function terminalTextUnits(r){let i=[],a=0;for(;a<r.length;){let o=r.slice(a),s=o.match(ansiPrefixPattern);if(s!==null){i.push({text:s[0],width:0,ansi:!0}),a+=s[0].length;continue}let c=o.search(ansiPattern),l=o.slice(0,c===-1?o.length:c);for(let t of graphemes(l))i.push({text:t.text,width:terminalGraphemeWidth(t.text),ansi:!1});a+=l.length}return i}function wrapVisibleLine(e,t){if(t<=0)return[e];
|
|
1
|
+
import{graphemes}from"#shared/text-boundaries.js";const ansiPattern=RegExp(`\x1B\\[[0-?]*[ -/]*[@-~]`,`g`),ansiPrefixPattern=RegExp(`^\x1B\\[[0-?]*[ -/]*[@-~]`),emojiPresentationPattern=/\p{Emoji_Presentation}/u,extendedPictographicPattern=/\p{Extended_Pictographic}/u,keycapPattern=/^[#*0-9]\u{fe0f}?\u{20e3}$/u;function stripAnsi(e){return stripTerminalControls(e.replaceAll(ansiPattern,``))}function stripTerminalControls(e){let t=``,n=0;for(;n<e.length;){let r=e.codePointAt(n);if(r==null)break;let i=String.fromCodePoint(r);n+=i.length,!isUnsafeTerminalControlCodePoint(r)&&(t+=i)}return t}function visibleLength(e){let t=0;for(let n of terminalTextUnits(e))t+=n.width;return t}function sliceVisible(e,t){return sliceUnits(terminalTextUnits(e),0,t)}function sliceUnits(e,t,n){if(n<=0)return``;let r=``,i=0,a=t;for(;a<e.length&&i<n;){let t=e[a];if(t.width>0&&i+t.width>n)break;r+=t.text,i+=t.width,a+=1}for(;e[a]?.ansi===!0;)r+=e[a].text,a+=1;return r}function clipVisible(e,t){if(visibleLength(e)<=t)return e;let n=sliceVisible(e,t);return n.includes(`\x1B`)?`${n}[0m`:n}function inputTextWidth(t){let n=0;for(let r of graphemes(t))n+=terminalGraphemeWidth(r.text);return n}function renderInputText(e){return e.replaceAll(` `,` `)}function renderInputWithBlockCursor(e){let t=e.render??renderInputText,n=e.under.length>0?e.under:` `,r=e.visible?e.inverse(renderInputText(n)):t(n);return`${t(e.before)}${r}${t(e.after)}`}function offsetAtVisibleColumn(t,n){if(n<=0)return 0;let r=0;for(let i of graphemes(t)){let e=r+terminalGraphemeWidth(i.text);if(e>n)return i.start;if(e===n)return i.end;r=e}return t.length}function terminalGraphemeWidth(e){let t=0;for(let n of e){let e=n.codePointAt(0);e!==void 0&&(t=Math.max(t,codePointWidth(e)))}return emojiPresentationPattern.test(e)||keycapPattern.test(e)||e.includes(`️`)&&extendedPictographicPattern.test(e)?Math.max(2,t):t}function terminalTextUnits(r){let i=[],a=0;for(;a<r.length;){let o=r.slice(a),s=o.match(ansiPrefixPattern);if(s!==null){i.push({text:s[0],width:0,ansi:!0}),a+=s[0].length;continue}let c=o.search(ansiPattern),l=o.slice(0,c===-1?o.length:c);for(let t of graphemes(l))i.push({text:t.text,width:terminalGraphemeWidth(t.text),ansi:!1});a+=l.length}return i}function wrapVisibleLine(e,t){if(t<=0)return[e];let n=terminalTextUnits(e),r=0;for(let e of n)r+=e.width;let i=[],a=0,o=0,consume=()=>{let e=n[a];o+=e.text.length,r-=e.width,a+=1};for(;r>t;){let r=findVisibleBreakPoint(n,a,t);i.push(e.slice(o,o+r).trimEnd());let s=o+r;for(;o<s&&a<n.length;)consume();for(;a<n.length;){let e=n[a];if(e.ansi||e.text.trimStart().length>0)break;consume()}}let s=e.slice(o);return(s.length>0||i.length===0)&&i.push(s),i}function findVisibleBreakPoint(e,t,n){let r=sliceUnits(e,t,n+1).lastIndexOf(` `);if(r>0)return r;let i=sliceUnits(e,t,n);if(visibleLength(i)>0)return i.length;let a=0,o=!1;for(let n=t;n<e.length;n+=1){let t=e[n];if(o&&t.width>0)return a;a+=t.text.length,t.width>0&&(o=!0)}return a}function codePointWidth(e){return e===9?4:e<32||e>=127&&e<160||isZeroWidthCodePoint(e)?0:isWideCodePoint(e)?2:1}function isUnsafeTerminalControlCodePoint(e){return e>=0&&e<=8||e>=11&&e<=31||e>=127&&e<=159}function isZeroWidthCodePoint(e){return e>=768&&e<=879||e>=1155&&e<=1161||e>=1425&&e<=1469||e===1471||e>=1473&&e<=1474||e>=1476&&e<=1477||e===1479||e>=1552&&e<=1562||e>=1611&&e<=1631||e===1648||e>=1750&&e<=1756||e>=1759&&e<=1764||e>=1767&&e<=1768||e>=1770&&e<=1773||e===1809||e>=1840&&e<=1866||e>=1958&&e<=1968||e>=2027&&e<=2035||e>=2070&&e<=2073||e>=2075&&e<=2083||e>=2085&&e<=2087||e>=2089&&e<=2093||e>=2137&&e<=2139||e>=2259&&e<=2306||e===2362||e===2364||e>=2369&&e<=2376||e===2381||e>=2385&&e<=2391||e===8205||e>=65024&&e<=65039||e>=917760&&e<=917999}function isWideCodePoint(e){return e>=4352&&(e<=4447||e===9001||e===9002||e>=11904&&e<=42191&&e!==12351||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=127744&&e<=128591||e>=129280&&e<=129535||e>=131072&&e<=262141)}export{clipVisible,inputTextWidth,offsetAtVisibleColumn,renderInputText,renderInputWithBlockCursor,sliceVisible,stripAnsi,stripTerminalControls,visibleLength,wrapVisibleLine};
|
|
@@ -7,7 +7,7 @@ export { createDataUrlFilePart, createTextWithFileContent } from "#client/file-p
|
|
|
7
7
|
export { MessageResponse } from "#client/message-response.js";
|
|
8
8
|
export { ClientSession } from "#client/session.js";
|
|
9
9
|
export type { EveAgentStoreCallbacks, EveAgentStoreInit, EveAgentStoreSnapshot, EveAgentStoreStatus, PrepareSend, } from "#client/eve-agent-store.js";
|
|
10
|
-
export type { AgentInfoEntry, AgentInfoChannelEntry, AgentInfoChannels, AgentInfoConnectionEntry, AgentInfoDynamicResolverEntry, AgentInfoFrameworkChannelEntry, AgentInfoFrameworkToolEntry, AgentInfoHookEntry, AgentInfoInstructions, AgentInfoInstructionsEntry, AgentInfoResult, AgentInfoSandboxEntry, AgentInfoScheduleEntry, AgentInfoSkillEntry, AgentInfoSource, AgentInfoSubagentEntry, AgentInfoToolEntry, AgentInfoTools, CancelSessionResult, ClientAuth, ClientOptions, ClientRedirectPolicy, HeadersValue, HealthResult, MessageResult, ResetResult, ResolvedStreamReconnectPolicy, SendTurnInput, SendTurnPayload, SessionState, StreamOptions, StreamReconnectPolicy, StreamReconnectRetryPolicy, TokenValue, } from "#client/types.js";
|
|
10
|
+
export type { AgentInfoEntry, AgentInfoChannelEntry, AgentInfoChannels, AgentInfoConnectionEntry, AgentInfoDynamicResolverEntry, AgentInfoFrameworkChannelEntry, AgentInfoFrameworkToolEntry, AgentInfoHookEntry, AgentInfoInstructions, AgentInfoInstructionsEntry, AgentInfoResult, AgentInfoSandboxEntry, AgentInfoScheduleEntry, AgentInfoSkillEntry, AgentInfoSource, AgentInfoSubagentEntry, AgentInfoToolEntry, AgentInfoTools, CancelSessionResult, ClientAuth, ClientOptions, ClientRedirectPolicy, HeadersValue, HealthResult, MessageResult, ResetResult, ResolvedStreamReconnectPolicy, SendTurnInput, SendTurnPayload, SessionSnapshot, SessionState, StreamOptions, StreamReconnectPolicy, StreamReconnectRetryPolicy, TokenValue, } from "#client/types.js";
|
|
11
11
|
export type { EveAgentReducer, EveAgentReducerEvent, ClientInputRespondedEvent, ClientMessageFailedEvent, ClientMessageSubmittedEvent, } from "#client/reducer.js";
|
|
12
12
|
export type { EveAuthorizationChallenge, EveAuthorizationOutcome, EveAuthorizationPart, EveMessageData, EveDynamicToolPart, EveMessageInputRequest, EveMessage, EveMessageMetadata, EveMessagePart, EveMessageToolMetadata, } from "#client/message-reducer.js";
|
|
13
13
|
export type { ActionResultStreamEvent, ActionsRequestedStreamEvent, AssistantStepFinishReason, AuthorizationOutcome, CompactionCompletedStreamEvent, CompactionRequestedStreamEvent, AuthorizationCompletedStreamEvent, ConnectionAuthorizationOutcome, AuthorizationRequiredStreamEvent, HandleMessageStreamEvent, MessageStreamEventMeta, InputRequestedStreamEvent, MessageAppendedStreamEvent, MessageCompletedStreamEvent, MessageReceivedPart, MessageReceivedStreamEvent, ReasoningAppendedStreamEvent, ReasoningCompletedStreamEvent, ResultCompletedStreamEvent, SessionCompletedStreamEvent, SessionFailedStreamEvent, SessionStartedStreamEvent, SessionWaitingStreamEvent, MessageStreamEvent, StepCompletedStreamEvent, StepFailedStreamEvent, StepStartedStreamEvent, SubagentCalledStreamEvent, SubagentChildEventStreamEvent, SubagentCompletedStreamEvent, SubagentStartedStreamEvent, TurnCancelledStreamEvent, TurnCompletedStreamEvent, TurnFailedStreamEvent, TurnStartedStreamEvent, TurnFailureStreamEvent, } from "#protocol/message.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createEveMessageStreamRoutePath}from"#protocol/routes.js";import{EVE_STREAM_TAIL_INDEX_HEADER}from"#protocol/message.js";import{ClientError}from"#client/client-error.js";import{createClientUrl}from"#client/url.js";import{isStreamDisconnectError,readNdjsonStream}from"#client/ndjson.js";const DEFAULT_STREAM_RECONNECT_POLICY={retryableErrorStatuses:new Set([404,409,425,500,502,503,504]),streamIdleReconnectPolicy:{baseDelayMs:250,maxAttempts:5,maxDelayMs:4e3},streamOpenReconnectPolicy:{baseDelayMs:250,maxAttempts:12,maxDelayMs:5e3}},NO_STREAM_RECONNECT_POLICY={...DEFAULT_STREAM_RECONNECT_POLICY,streamIdleReconnectPolicy:{...DEFAULT_STREAM_RECONNECT_POLICY.streamIdleReconnectPolicy,maxAttempts:0},streamOpenReconnectPolicy:{...DEFAULT_STREAM_RECONNECT_POLICY.streamOpenReconnectPolicy,maxAttempts:1}};function resolveRetryPolicy(e,t){return{...t,...e}}function resolveStreamReconnectPolicy(e){if(e&&`reconnect`in e&&e.reconnect===!1)return NO_STREAM_RECONNECT_POLICY;let t=e;return{retryableErrorStatuses:t?.retryableErrorStatuses?new Set(t.retryableErrorStatuses):DEFAULT_STREAM_RECONNECT_POLICY.retryableErrorStatuses,streamIdleReconnectPolicy:resolveRetryPolicy(t?.streamIdleReconnectPolicy,DEFAULT_STREAM_RECONNECT_POLICY.streamIdleReconnectPolicy),streamOpenReconnectPolicy:resolveRetryPolicy(t?.streamOpenReconnectPolicy,DEFAULT_STREAM_RECONNECT_POLICY.streamOpenReconnectPolicy)}}async function*followStreamIterable(e){if(e.follow===!1&&e.startIndex<0)throw Error(`stream({ follow: false }) requires a nonnegative startIndex; a tail-relative cursor cannot be bounded.`);let n=resolveStreamReconnectPolicy(e.streamReconnectPolicy),r=n.streamIdleReconnectPolicy,a=e.startIndex,o=r.baseDelayMs,s=0,c=!0,l;for(;;){let u;try{u=await openStreamBody({...e,retryPolicy:n,startIndex:a,requestTailIndex:e.follow===!1&&l===void 0})}catch(t){if(e.signal?.aborted)return;throw t}if(e.follow===!1&&l===void 0&&(l=u.tailIndex,l===void 0))throw await u.body.cancel().catch(()=>{}),Error(`stream({ follow: false }) requires the server to report the ${EVE_STREAM_TAIL_INDEX_HEADER} header. The agent may be running an older eve version.`);if(l!==void 0&&a>l){await u.body.cancel().catch(()=>{});return}let d=!1;try{for await(let e of readNdjsonStream(u.body))if(a+=1,d=!0,o=r.baseDelayMs,s=0,yield e,l!==void 0&&a>l)return}catch(e){if(!isStreamDisconnectError(e))throw e}if(e.signal?.aborted||e.startIndex<0||r.maxAttempts===0||!d&&!c&&(s+=1)>=r.maxAttempts||(c=!1,await sleep(o,e.signal),e.signal?.aborted))return;o=Math.min(o*2,r.maxDelayMs)}}async function openStreamBody(t){let i=t.retryPolicy??DEFAULT_STREAM_RECONNECT_POLICY,o=i.streamOpenReconnectPolicy,s,c,l,u=o.baseDelayMs,d={};t.startIndex!==0&&(d.startIndex=String(t.startIndex)),t.requestTailIndex===!0&&(d.includeTailIndex=`1`);for(let a=0;a<o.maxAttempts;a+=1){let f=createClientUrl(t.host,createEveMessageStreamRoutePath(t.sessionId),Object.keys(d).length>0?d:void 0),p=await t.resolveHeaders(),m;try{m=await fetch(f,{headers:p,redirect:t.redirect,signal:t.signal??null})}catch(e){if(t.signal?.aborted||!isStreamDisconnectError(e)||a===o.maxAttempts-1)throw e;await sleep(u,t.signal),u=Math.min(u*2,o.maxDelayMs);continue}if(m.ok){if(!m.body)throw new ClientError(m.status,`Response body is null.`,m.headers);return{body:m.body,tailIndex:parseTailIndexHeader(m.headers)}}if(s=m.status,c=await m.text(),l=m.headers,!i.retryableErrorStatuses.has(m.status))throw new ClientError(m.status,c,m.headers);a<o.maxAttempts-1&&(await sleep(u,t.signal),u=Math.min(u*2,o.maxDelayMs))}throw new ClientError(s??0,c??`Failed to open message stream.`,l)}function parseTailIndexHeader(e){let n=e.get(EVE_STREAM_TAIL_INDEX_HEADER);if(n===null||!/^-?\d+$/.test(n))return;let r=Number(n);return Number.isSafeInteger(r)?r:void 0}async function sleep(e,t){t?.aborted||await new Promise(n=>{let onAbort=()=>{clearTimeout(r),n()},r=setTimeout(()=>{t?.removeEventListener(`abort`,onAbort),n()},e);t?.addEventListener(`abort`,onAbort,{once:!0})})}export{followStreamIterable,openStreamBody};
|
|
1
|
+
import{createEveMessageStreamRoutePath}from"#protocol/routes.js";import{EVE_STREAM_TAIL_INDEX_HEADER}from"#protocol/message.js";import{ClientError}from"#client/client-error.js";import{createClientUrl}from"#client/url.js";import{isStreamDisconnectError,readNdjsonStream}from"#client/ndjson.js";const DEFAULT_STREAM_RECONNECT_POLICY={retryableErrorStatuses:new Set([404,409,425,500,502,503,504]),streamIdleReconnectPolicy:{baseDelayMs:250,maxAttempts:5,maxDelayMs:4e3},streamOpenReconnectPolicy:{baseDelayMs:250,maxAttempts:12,maxDelayMs:5e3}},NO_STREAM_RECONNECT_POLICY={...DEFAULT_STREAM_RECONNECT_POLICY,streamIdleReconnectPolicy:{...DEFAULT_STREAM_RECONNECT_POLICY.streamIdleReconnectPolicy,maxAttempts:0},streamOpenReconnectPolicy:{...DEFAULT_STREAM_RECONNECT_POLICY.streamOpenReconnectPolicy,maxAttempts:1}};function resolveRetryPolicy(e,t){return{...t,...e}}function resolveStreamReconnectPolicy(e){if(e&&`reconnect`in e&&e.reconnect===!1)return NO_STREAM_RECONNECT_POLICY;let t=e;return{retryableErrorStatuses:t?.retryableErrorStatuses?new Set(t.retryableErrorStatuses):DEFAULT_STREAM_RECONNECT_POLICY.retryableErrorStatuses,streamIdleReconnectPolicy:resolveRetryPolicy(t?.streamIdleReconnectPolicy,DEFAULT_STREAM_RECONNECT_POLICY.streamIdleReconnectPolicy),streamOpenReconnectPolicy:resolveRetryPolicy(t?.streamOpenReconnectPolicy,DEFAULT_STREAM_RECONNECT_POLICY.streamOpenReconnectPolicy)}}async function*followStreamIterable(e){if(e.follow===!1&&e.startIndex<0)throw Error(`stream({ follow: false }) requires a nonnegative startIndex; a tail-relative cursor cannot be bounded.`);let n=resolveStreamReconnectPolicy(e.streamReconnectPolicy),r=n.streamIdleReconnectPolicy,a=e.startIndex,o=r.baseDelayMs,s=0,c=!0,l;for(;;){let u;try{u=await openStreamBody({...e,retryPolicy:n,startIndex:a,requestTailIndex:e.follow===!1&&l===void 0})}catch(t){if(e.signal?.aborted)return;throw t}if(e.follow===!1&&l===void 0&&(l=u.tailIndex,l===void 0))throw await u.body.cancel().catch(()=>{}),Error(`stream({ follow: false }) requires the server to report the ${EVE_STREAM_TAIL_INDEX_HEADER} header. The agent may be running an older eve version.`);if(l!==void 0&&a>l){await u.body.cancel().catch(()=>{});return}let d=!1;try{for await(let e of readNdjsonStream(u.body))if(a+=1,d=!0,o=r.baseDelayMs,s=0,yield e,l!==void 0&&a>l)return}catch(e){if(!isStreamDisconnectError(e))throw e}if(e.signal?.aborted||e.startIndex<0||r.maxAttempts===0||!d&&!c&&(s+=1)>=r.maxAttempts||(c=!1,await sleep(o,e.signal),e.signal?.aborted))return;o=Math.min(o*2,r.maxDelayMs)}}async function openStreamBody(t){let i=t.retryPolicy??DEFAULT_STREAM_RECONNECT_POLICY,o=i.streamOpenReconnectPolicy,s,c,l,u=o.baseDelayMs,d={};t.startIndex!==0&&(d.startIndex=String(t.startIndex)),t.requestTailIndex===!0&&(d.includeTailIndex=`1`);for(let a=0;a<o.maxAttempts;a+=1){let f=createClientUrl(t.host,createEveMessageStreamRoutePath(t.sessionId),Object.keys(d).length>0?d:void 0),p=await t.resolveHeaders(),m;try{m=await fetch(f,{cache:`no-store`,headers:p,redirect:t.redirect,signal:t.signal??null})}catch(e){if(t.signal?.aborted||!isStreamDisconnectError(e)||a===o.maxAttempts-1)throw e;await sleep(u,t.signal),u=Math.min(u*2,o.maxDelayMs);continue}if(m.ok){if(!m.body)throw new ClientError(m.status,`Response body is null.`,m.headers);return{body:m.body,tailIndex:parseTailIndexHeader(m.headers)}}if(s=m.status,c=await m.text(),l=m.headers,!i.retryableErrorStatuses.has(m.status))throw new ClientError(m.status,c,m.headers);a<o.maxAttempts-1&&(await sleep(u,t.signal),u=Math.min(u*2,o.maxDelayMs))}throw new ClientError(s??0,c??`Failed to open message stream.`,l)}function parseTailIndexHeader(e){let n=e.get(EVE_STREAM_TAIL_INDEX_HEADER);if(n===null||!/^-?\d+$/.test(n))return;let r=Number(n);return Number.isSafeInteger(r)?r:void 0}async function sleep(e,t){t?.aborted||await new Promise(n=>{let onAbort=()=>{clearTimeout(r),n()},r=setTimeout(()=>{t?.removeEventListener(`abort`,onAbort),n()},e);t?.addEventListener(`abort`,onAbort,{once:!0})})}export{followStreamIterable,openStreamBody};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MessageStreamEvent } from "#protocol/message.js";
|
|
2
2
|
import { MessageResponse } from "#client/message-response.js";
|
|
3
|
-
import type { CancelSessionResult, ClientRedirectPolicy, ResetResult, SendTurnInput, SessionState, StreamOptions } from "#client/types.js";
|
|
3
|
+
import type { CancelSessionResult, ClientRedirectPolicy, ResetResult, SendTurnInput, SessionSnapshot, SessionState, StreamOptions } from "#client/types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Internal interface that a {@link ClientSession} uses to access client-level
|
|
6
6
|
* configuration without depending on the full {@link Client} class.
|
|
@@ -28,6 +28,20 @@ export declare class ClientSession {
|
|
|
28
28
|
* stream is consumed. Serialize this to persist and resume later.
|
|
29
29
|
*/
|
|
30
30
|
get state(): SessionState;
|
|
31
|
+
/**
|
|
32
|
+
* Reads a finite, point-in-time prefix of this session's durable event stream.
|
|
33
|
+
*
|
|
34
|
+
* The read starts at the beginning of the session and stops at the durable
|
|
35
|
+
* tail observed when it opens. The returned cursor points exactly after the
|
|
36
|
+
* returned events, so it can hydrate a UI and resume without a gap.
|
|
37
|
+
* Reading a snapshot does not advance or reset this handle's state.
|
|
38
|
+
*
|
|
39
|
+
* @throws {Error} If the session has no session ID (no message has been sent
|
|
40
|
+
* yet).
|
|
41
|
+
*/
|
|
42
|
+
snapshot(options?: {
|
|
43
|
+
readonly signal?: AbortSignal;
|
|
44
|
+
}): Promise<SessionSnapshot>;
|
|
31
45
|
/**
|
|
32
46
|
* Sends one turn payload to the agent.
|
|
33
47
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EVE_CREATE_SESSION_ROUTE_PATH,EVE_RESET_SESSION_ROUTE_PATH,createEveCancelTurnRoutePath,createEveContinueSessionRoutePath}from"#protocol/routes.js";import{EVE_SESSION_ID_HEADER,isCurrentTurnBoundaryEvent}from"#protocol/message.js";import{advanceSession,createInitialSessionState}from"#client/session-utils.js";import{ClientError}from"#client/client-error.js";import{createClientUrl}from"#client/url.js";import{MessageResponse}from"#client/message-response.js";import{CancelTurnResponseSchema}from"#protocol/cancel-turn.js";import{ResetResponseSchema}from"#protocol/reset-session.js";import{followStreamIterable}from"#client/open-stream.js";import{serializeOutputSchema}from"#shared/tool-schema.js";var ClientSession=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get state(){return this.#t}async send(e){let t=normalizeSendTurnInput(e),n=this.#t,{continuationToken:r,sessionId:i}=await this.#n(t,n);if(this.#t===n){let e={...n,sessionId:i};r!==void 0&&(e.continuationToken=r),this.#t=e}return new MessageResponse({continuationToken:r,createStream:()=>this.#r(i,r,n,t),sessionId:i})}async cancel(e){let t=this.#t.sessionId;if(!t)throw Error(`Session has no session ID. Send a message first.`);let r=createClientUrl(this.#e.host,createEveCancelTurnRoutePath(t)),i=await this.#e.resolveHeaders();i.set(`content-type`,`application/json`);let a=await fetch(r,withRedirectPolicy({headers:i,method:`POST`,body:e?JSON.stringify(e):void 0},this.#e.redirect)),o=await a.text();if(!a.ok)throw new ClientError(a.status,o,a.headers);let s;try{s=JSON.parse(o)}catch{throw Error(`Cancel route returned invalid JSON (${a.status}).`)}let l=CancelTurnResponseSchema.safeParse(s);if(!l.success||l.data.sessionId!==t)throw Error(`Cancel route returned an invalid response (${a.status}).`);return{sessionId:l.data.sessionId,status:l.data.status}}async reset(){let e=this.#t,n=e.continuationToken;if(n===void 0){if(e.sessionId!==void 0)throw Error(`Session has no continuation token. Consume its event stream before resetting.`);return this.#t=createInitialSessionState(),{status:`no_active_session`}}let r=createClientUrl(this.#e.host,EVE_RESET_SESSION_ROUTE_PATH),i=await this.#e.resolveHeaders();i.set(`content-type`,`application/json`);let a=await fetch(r,withRedirectPolicy({body:JSON.stringify({continuationToken:n}),headers:i,method:`POST`},this.#e.redirect)),o=await a.text();if(!a.ok)throw new ClientError(a.status,o,a.headers);let l;try{l=JSON.parse(o)}catch{throw Error(`Reset route returned invalid JSON (${a.status}).`)}let u=ResetResponseSchema.safeParse(l);if(!u.success||u.data.status===`reset`&&e.sessionId!==void 0&&u.data.previousSessionId!==e.sessionId)throw Error(`Reset route returned an invalid response (${a.status}).`);return this.#t===e&&(this.#t=createInitialSessionState()),u.data.status===`reset`?{previousSessionId:u.data.previousSessionId,status:`reset`}:{status:`no_active_session`}}stream(e){let t=this.#t.sessionId;if(!t)throw Error(`Session has no session ID. Send a message first.`);if(e?.follow===!1&&(e.startIndex??this.#t.streamIndex)<0)throw Error(`stream({ follow: false }) requires a nonnegative startIndex; a tail-relative cursor cannot be bounded.`);return this.#i(t,e)}async#n(t,n){let a=n.sessionId?createEveContinueSessionRoutePath(n.sessionId):EVE_CREATE_SESSION_ROUTE_PATH,o=createClientUrl(this.#e.host,a),s=await this.#e.resolveHeaders(t.headers);s.set(`content-type`,`application/json`);let c=createHandleMessageBody({input:t,outputSchema:serializeOutputSchema(t.outputSchema),session:n});if(c===null)throw Error(`Session.send requires a non-empty message, inputResponses, or both.`);let l=await postTurnWithRetry({body:JSON.stringify(c),headers:s,mustDeliver:(t.inputResponses?.length??0)>0,redirect:this.#e.redirect,signal:t.signal,url:o}),u=await l.json(),d=(typeof u.sessionId==`string`?u.sessionId:void 0)??l.headers.get(EVE_SESSION_ID_HEADER)?.trim()??n.sessionId;if(!d)throw Error(`Message route did not return a session id.`);return{continuationToken:typeof u.continuationToken==`string`?u.continuationToken:void 0,sessionId:d}}async*#r(e,t,n,r){let i=[];try{for await(let t of
|
|
1
|
+
import{EVE_CREATE_SESSION_ROUTE_PATH,EVE_RESET_SESSION_ROUTE_PATH,createEveCancelTurnRoutePath,createEveContinueSessionRoutePath}from"#protocol/routes.js";import{EVE_SESSION_ID_HEADER,isCurrentTurnBoundaryEvent}from"#protocol/message.js";import{advanceSession,createInitialSessionState}from"#client/session-utils.js";import{ClientError}from"#client/client-error.js";import{createClientUrl}from"#client/url.js";import{MessageResponse}from"#client/message-response.js";import{CancelTurnResponseSchema}from"#protocol/cancel-turn.js";import{ResetResponseSchema}from"#protocol/reset-session.js";import{followStreamIterable}from"#client/open-stream.js";import{serializeOutputSchema}from"#shared/tool-schema.js";var ClientSession=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get state(){return this.#t}async snapshot(e){e?.signal?.throwIfAborted();let t=this.#t,n=t.sessionId;if(!n)throw Error(`Session has no session ID. Send a message first.`);let r=[];for await(let t of this.#a({follow:!1,sessionId:n,signal:e?.signal,startIndex:0}))r.push(t);e?.signal?.throwIfAborted();let i=r.at(-1),a=i?.type===`session.waiting`?i.data.continuationToken:i?.type===`session.completed`&&this.#e.preserveCompletedSessions?t.continuationToken:void 0;return{events:r,session:a===void 0?{sessionId:n,streamIndex:r.length}:{continuationToken:a,sessionId:n,streamIndex:r.length}}}async send(e){let t=normalizeSendTurnInput(e),n=this.#t,{continuationToken:r,sessionId:i}=await this.#n(t,n);if(this.#t===n){let e={...n,sessionId:i};r!==void 0&&(e.continuationToken=r),this.#t=e}return new MessageResponse({continuationToken:r,createStream:()=>this.#r(i,r,n,t),sessionId:i})}async cancel(e){let t=this.#t.sessionId;if(!t)throw Error(`Session has no session ID. Send a message first.`);let r=createClientUrl(this.#e.host,createEveCancelTurnRoutePath(t)),i=await this.#e.resolveHeaders();i.set(`content-type`,`application/json`);let a=await fetch(r,withRedirectPolicy({headers:i,method:`POST`,body:e?JSON.stringify(e):void 0},this.#e.redirect)),o=await a.text();if(!a.ok)throw new ClientError(a.status,o,a.headers);let s;try{s=JSON.parse(o)}catch{throw Error(`Cancel route returned invalid JSON (${a.status}).`)}let l=CancelTurnResponseSchema.safeParse(s);if(!l.success||l.data.sessionId!==t)throw Error(`Cancel route returned an invalid response (${a.status}).`);return{sessionId:l.data.sessionId,status:l.data.status}}async reset(){let e=this.#t,n=e.continuationToken;if(n===void 0){if(e.sessionId!==void 0)throw Error(`Session has no continuation token. Consume its event stream before resetting.`);return this.#t=createInitialSessionState(),{status:`no_active_session`}}let r=createClientUrl(this.#e.host,EVE_RESET_SESSION_ROUTE_PATH),i=await this.#e.resolveHeaders();i.set(`content-type`,`application/json`);let a=await fetch(r,withRedirectPolicy({body:JSON.stringify({continuationToken:n}),headers:i,method:`POST`},this.#e.redirect)),o=await a.text();if(!a.ok)throw new ClientError(a.status,o,a.headers);let l;try{l=JSON.parse(o)}catch{throw Error(`Reset route returned invalid JSON (${a.status}).`)}let u=ResetResponseSchema.safeParse(l);if(!u.success||u.data.status===`reset`&&e.sessionId!==void 0&&u.data.previousSessionId!==e.sessionId)throw Error(`Reset route returned an invalid response (${a.status}).`);return this.#t===e&&(this.#t=createInitialSessionState()),u.data.status===`reset`?{previousSessionId:u.data.previousSessionId,status:`reset`}:{status:`no_active_session`}}stream(e){let t=this.#t.sessionId;if(!t)throw Error(`Session has no session ID. Send a message first.`);if(e?.follow===!1&&(e.startIndex??this.#t.streamIndex)<0)throw Error(`stream({ follow: false }) requires a nonnegative startIndex; a tail-relative cursor cannot be bounded.`);return this.#i(t,e)}async#n(t,n){let a=n.sessionId?createEveContinueSessionRoutePath(n.sessionId):EVE_CREATE_SESSION_ROUTE_PATH,o=createClientUrl(this.#e.host,a),s=await this.#e.resolveHeaders(t.headers);s.set(`content-type`,`application/json`);let c=createHandleMessageBody({input:t,outputSchema:serializeOutputSchema(t.outputSchema),session:n});if(c===null)throw Error(`Session.send requires a non-empty message, inputResponses, or both.`);let l=await postTurnWithRetry({body:JSON.stringify(c),headers:s,mustDeliver:(t.inputResponses?.length??0)>0,redirect:this.#e.redirect,signal:t.signal,url:o}),u=await l.json(),d=(typeof u.sessionId==`string`?u.sessionId:void 0)??l.headers.get(EVE_SESSION_ID_HEADER)?.trim()??n.sessionId;if(!d)throw Error(`Message route did not return a session id.`);return{continuationToken:typeof u.continuationToken==`string`?u.continuationToken:void 0,sessionId:d}}async*#r(e,t,n,r){let i=[];try{for await(let t of this.#a({headers:r.headers,streamReconnectPolicy:r.streamReconnectPolicy,sessionId:e,signal:r.signal,startIndex:n.sessionId===e?n.streamIndex:0}))if(i.push(t),yield t,isCurrentTurnBoundaryEvent(t))break}finally{this.#t=advanceSession({continuationToken:t,events:i,preserveCompletedSessions:this.#e.preserveCompletedSessions,sessionId:e,session:n})}}async*#i(e,t){let n=this.#t,r=t?.startIndex??n.streamIndex,i=[];try{for await(let n of this.#a({follow:t?.follow,sessionId:e,signal:t?.signal,startIndex:r,streamReconnectPolicy:t?.streamReconnectPolicy}))i.push(n),yield n}finally{r>=0&&(this.#t=advanceSession({continuationToken:n.continuationToken,events:i,preserveCompletedSessions:this.#e.preserveCompletedSessions,session:{...n,sessionId:e,streamIndex:r},sessionId:e}))}}#a(e){return followStreamIterable({follow:e.follow,host:this.#e.host,resolveHeaders:()=>this.#e.resolveHeaders(e.headers),redirect:this.#e.redirect,streamReconnectPolicy:e.streamReconnectPolicy,sessionId:e.sessionId,signal:e.signal,startIndex:e.startIndex})}};async function postTurnWithRetry(e){let t=e.mustDeliver?10:1,n,r,i;for(let a=0;a<t;a+=1){let o=await fetch(e.url,{body:e.body,headers:e.headers,method:`POST`,redirect:e.redirect,signal:e.signal??null});if(o.ok)return o;if(n=o.status,r=await o.text(),i=o.headers,!isRetryableDeliveryFailure(o.status,r))throw new ClientError(o.status,r,o.headers);a<t-1&&await sleep(200)}throw new ClientError(n??0,r??`Failed to deliver session turn.`,i)}function isRetryableDeliveryFailure(e,t){return e===500&&/target session was not found/i.test(t)}async function sleep(e){await new Promise(t=>setTimeout(t,e))}function normalizeSendTurnInput(e){return typeof e==`string`?{message:e}:e}function createHandleMessageBody(e){let t={};return e.input.message!==void 0&&(t.message=e.input.message),e.input.inputResponses!==void 0&&e.input.inputResponses.length>0&&(t.inputResponses=e.input.inputResponses),e.input.clientContext!==void 0&&(t.clientContext=e.input.clientContext),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),e.session.continuationToken!==void 0&&(t.continuationToken=e.session.continuationToken),Object.keys(t).length===0||e.session.continuationToken===void 0&&t.message===void 0||e.session.continuationToken!==void 0&&t.message===void 0&&t.inputResponses===void 0?null:t}function withRedirectPolicy(e,t){return t===void 0?e:{...e,redirect:t}}export{ClientSession};
|
|
@@ -254,3 +254,12 @@ export interface SessionState {
|
|
|
254
254
|
readonly sessionId?: string;
|
|
255
255
|
readonly streamIndex: number;
|
|
256
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* Finite, cursor-consistent prefix of one durable session stream.
|
|
259
|
+
*/
|
|
260
|
+
export interface SessionSnapshot {
|
|
261
|
+
/** Events from the start of the session through the durable tail observed when the read opened. */
|
|
262
|
+
readonly events: readonly MessageStreamEvent[];
|
|
263
|
+
/** Session cursor advanced exactly past {@link events}. */
|
|
264
|
+
readonly session: SessionState;
|
|
265
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"moduleVersions": {
|
|
3
|
+
"@agentclientprotocol/sdk": "1.3.0",
|
|
3
4
|
"@ai-sdk/anthropic": "4.0.18",
|
|
4
5
|
"chat": "4.34.0",
|
|
5
6
|
"@chat-adapter/slack": "4.34.0",
|
|
@@ -42,5 +43,5 @@
|
|
|
42
43
|
"zod": "4.4.3",
|
|
43
44
|
"zod-validation-error": "5.0.0"
|
|
44
45
|
},
|
|
45
|
-
"scriptHash": "
|
|
46
|
+
"scriptHash": "16aeebd882d2b8d00155483e01cdd97ce1865094a1e1a6b4600fe377515914b6"
|
|
46
47
|
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
Copyright 2025 Zed Industries, Inc. and contributors
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|