eve 0.25.3 → 0.26.1
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 +29 -0
- package/dist/src/chunks/{use-eve-agent-Cy73lgA6.js → use-eve-agent-BkztZA0v.js} +76 -55
- package/dist/src/chunks/{use-eve-agent-CQIeqmKc.js → use-eve-agent-CruinZmd.js} +76 -55
- package/dist/src/cli/banner.d.ts +5 -0
- package/dist/src/cli/banner.js +1 -1
- package/dist/src/cli/commands/logs-events.d.ts +36 -0
- package/dist/src/cli/commands/logs-events.js +2 -0
- package/dist/src/cli/commands/logs.d.ts +64 -0
- package/dist/src/cli/commands/logs.js +4 -0
- package/dist/src/cli/dev/diagnostic-dump.d.ts +60 -0
- package/dist/src/cli/dev/diagnostic-dump.js +1 -0
- package/dist/src/cli/dev/diagnostic-sink.d.ts +37 -0
- package/dist/src/cli/dev/diagnostic-sink.js +1 -0
- package/dist/src/cli/dev/diagnostics.d.ts +42 -0
- package/dist/src/cli/dev/diagnostics.js +1 -0
- package/dist/src/cli/dev/tui/blocks.d.ts +60 -8
- package/dist/src/cli/dev/tui/blocks.js +8 -8
- package/dist/src/cli/dev/tui/command-typeahead.js +1 -1
- package/dist/src/cli/dev/tui/diagnostic-presentation.d.ts +16 -0
- package/dist/src/cli/dev/tui/diagnostic-presentation.js +3 -0
- package/dist/src/cli/dev/tui/errors.d.ts +21 -16
- package/dist/src/cli/dev/tui/errors.js +1 -1
- package/dist/src/cli/dev/tui/file-content-cache.d.ts +35 -0
- package/dist/src/cli/dev/tui/file-content-cache.js +3 -0
- package/dist/src/cli/dev/tui/line-diff.d.ts +24 -0
- package/dist/src/cli/dev/tui/line-diff.js +1 -0
- package/dist/src/cli/dev/tui/line-editor.js +1 -1
- package/dist/src/cli/dev/tui/markdown.d.ts +2 -1
- package/dist/src/cli/dev/tui/markdown.js +7 -3
- package/dist/src/cli/dev/tui/model-editor.d.ts +103 -0
- package/dist/src/cli/dev/tui/model-editor.js +1 -0
- package/dist/src/cli/dev/tui/prompt-command-handler.d.ts +1 -1
- package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
- package/dist/src/cli/dev/tui/prompt-placeholder.d.ts +12 -0
- package/dist/src/cli/dev/tui/prompt-placeholder.js +1 -0
- package/dist/src/cli/dev/tui/question-panel.d.ts +24 -0
- package/dist/src/cli/dev/tui/question-panel.js +1 -0
- package/dist/src/cli/dev/tui/rail.d.ts +15 -0
- package/dist/src/cli/dev/tui/rail.js +1 -0
- package/dist/src/cli/dev/tui/remote-auth-command.js +1 -1
- package/dist/src/cli/dev/tui/runner.d.ts +27 -65
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/setup-commands.d.ts +1 -1
- package/dist/src/cli/dev/tui/setup-commands.js +2 -2
- package/dist/src/cli/dev/tui/setup-flow.d.ts +3 -0
- package/dist/src/cli/dev/tui/setup-issues.js +1 -1
- package/dist/src/cli/dev/tui/setup-panel.d.ts +33 -0
- package/dist/src/cli/dev/tui/setup-panel.js +4 -4
- package/dist/src/cli/dev/tui/status-line.d.ts +8 -6
- package/dist/src/cli/dev/tui/status-line.js +1 -1
- package/dist/src/cli/dev/tui/stream-format.d.ts +16 -3
- package/dist/src/cli/dev/tui/stream-format.js +1 -1
- package/dist/src/cli/dev/tui/subagent-pump.d.ts +127 -0
- package/dist/src/cli/dev/tui/subagent-pump.js +1 -0
- package/dist/src/cli/dev/tui/terminal-renderer.d.ts +37 -1
- package/dist/src/cli/dev/tui/terminal-renderer.js +12 -10
- package/dist/src/cli/dev/tui/test/fake-setup-flow-renderer.js +1 -1
- package/dist/src/cli/dev/tui/test/mock-terminal.d.ts +7 -0
- package/dist/src/cli/dev/tui/test/mock-terminal.js +1 -1
- package/dist/src/cli/dev/tui/theme.d.ts +30 -2
- package/dist/src/cli/dev/tui/theme.js +1 -1
- package/dist/src/cli/dev/tui/todo-panel.d.ts +44 -0
- package/dist/src/cli/dev/tui/todo-panel.js +1 -0
- package/dist/src/cli/dev/tui/tool-block-groups.d.ts +40 -0
- package/dist/src/cli/dev/tui/tool-block-groups.js +1 -0
- package/dist/src/cli/dev/tui/tool-format.js +1 -1
- package/dist/src/cli/dev/tui/tool-presentation.d.ts +67 -0
- package/dist/src/cli/dev/tui/tool-presentation.js +1 -0
- package/dist/src/cli/dev/tui/tool-rows.d.ts +15 -0
- package/dist/src/cli/dev/tui/tool-rows.js +2 -0
- package/dist/src/cli/dev/tui/tui.js +1 -1
- package/dist/src/cli/dev/tui/turn-clock.d.ts +36 -0
- package/dist/src/cli/dev/tui/turn-clock.js +1 -0
- package/dist/src/cli/dev/tui/types.d.ts +2 -2
- package/dist/src/cli/dev/ui-options.js +1 -1
- package/dist/src/cli/run.js +2 -2
- package/dist/src/cli/ui/live-row.js +1 -1
- package/dist/src/client/agent-info-schema.d.ts +9 -0
- package/dist/src/client/agent-info-schema.js +1 -1
- package/dist/src/client/client.js +1 -1
- package/dist/src/client/eve-agent-store.d.ts +1 -2
- package/dist/src/client/eve-agent-store.js +1 -1
- package/dist/src/client/index.js +1 -1
- package/dist/src/client/open-stream.d.ts +14 -10
- package/dist/src/client/open-stream.js +1 -1
- package/dist/src/client/session-utils.d.ts +2 -1
- package/dist/src/client/session-utils.js +1 -1
- package/dist/src/client/session.d.ts +3 -5
- package/dist/src/client/session.js +1 -1
- package/dist/src/client/types.d.ts +0 -6
- package/dist/src/compiled/.vendor-stamp.json +2 -1
- package/dist/src/compiled/marked/LICENSE.md +44 -0
- package/dist/src/compiled/marked/index.d.ts +24 -0
- package/dist/src/compiled/marked/index.js +59 -0
- package/dist/src/compiler/extension-compatibility.d.ts +2 -2
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/context/build-dynamic-tools.js +1 -1
- package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
- package/dist/src/evals/session.js +1 -1
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker-cli.d.ts +4 -0
- package/dist/src/execution/sandbox/bindings/docker-cli.js +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-create.js +1 -1
- package/dist/src/execution/terminal-session-failure-step.js +1 -1
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/model-call-error.d.ts +11 -30
- package/dist/src/harness/model-call-error.js +1 -1
- package/dist/src/harness/semantic-errors/index.d.ts +9 -0
- package/dist/src/harness/semantic-errors/index.js +1 -0
- package/dist/src/harness/semantic-errors/rule.d.ts +76 -0
- package/dist/src/harness/semantic-errors/rule.js +1 -0
- package/dist/src/harness/semantic-errors/rules/gateway.d.ts +11 -0
- package/dist/src/harness/semantic-errors/rules/gateway.js +1 -0
- package/dist/src/harness/semantic-errors/rules/model-provider.d.ts +11 -0
- package/dist/src/harness/semantic-errors/rules/model-provider.js +1 -0
- package/dist/src/harness/semantic-errors/rules/sandbox.d.ts +16 -0
- package/dist/src/harness/semantic-errors/rules/sandbox.js +1 -0
- package/dist/src/harness/semantic-errors/rules/system.d.ts +2 -0
- package/dist/src/harness/semantic-errors/rules/system.js +1 -0
- package/dist/src/harness/semantic-errors/rules/workflow.d.ts +9 -0
- package/dist/src/harness/semantic-errors/rules/workflow.js +1 -0
- package/dist/src/harness/semantic-errors/signals.d.ts +28 -0
- package/dist/src/harness/semantic-errors/signals.js +1 -0
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/workflow-sandbox.d.ts +6 -0
- package/dist/src/harness/workflow-sandbox.js +2 -2
- package/dist/src/internal/application/output-publication-lock.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/logging.d.ts +33 -1
- package/dist/src/internal/logging.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.d.ts +3 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
- package/dist/src/internal/nitro/routes/info.js +1 -1
- package/dist/src/internal/resolve-model-endpoint-status.d.ts +46 -3
- package/dist/src/internal/resolve-model-endpoint-status.js +1 -1
- package/dist/src/internal/workflow/development-world-client.js +1 -1
- package/dist/src/internal/workflow/development-world-server.js +1 -1
- package/dist/src/packages/eve-catalog/src/index.js +1 -1
- package/dist/src/public/models/openai/chatgpt/model.js +3 -1
- package/dist/src/react/use-eve-agent.d.ts +0 -1
- package/dist/src/react/use-eve-agent.js +1 -1
- package/dist/src/setup/boxes/add-channels.js +1 -1
- package/dist/src/setup/boxes/deploy-project.js +1 -1
- package/dist/src/setup/boxes/model-capabilities.d.ts +24 -0
- package/dist/src/setup/boxes/model-capabilities.js +1 -0
- package/dist/src/setup/boxes/resolve-provisioning.js +1 -1
- package/dist/src/setup/boxes/select-model.d.ts +30 -8
- package/dist/src/setup/boxes/select-model.js +1 -1
- package/dist/src/setup/cli/option-row.js +1 -1
- package/dist/src/setup/cli/prompt-ui.d.ts +2 -0
- package/dist/src/setup/cli/prompt-ui.js +2 -2
- package/dist/src/setup/cli/rail-log.d.ts +4 -6
- package/dist/src/setup/cli/rail-log.js +3 -2
- package/dist/src/setup/connection-connector.js +2 -2
- package/dist/src/setup/flows/link.d.ts +13 -3
- package/dist/src/setup/flows/link.js +1 -1
- package/dist/src/setup/flows/login.js +1 -1
- package/dist/src/setup/flows/model-source-change.d.ts +38 -0
- package/dist/src/setup/flows/model-source-change.js +1 -0
- package/dist/src/setup/flows/model.d.ts +69 -65
- package/dist/src/setup/flows/model.js +1 -1
- package/dist/src/setup/flows/provider.d.ts +22 -0
- package/dist/src/setup/flows/provider.js +3 -3
- package/dist/src/setup/prompter.d.ts +2 -0
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/slack-connect-lifecycle.js +1 -1
- package/dist/src/setup/slackbot.js +1 -1
- package/dist/src/setup/vercel-project.d.ts +6 -0
- package/dist/src/setup/vercel-project.js +0 -0
- package/dist/src/shared/dynamic-tool-definition.d.ts +1 -8
- package/dist/src/shared/errors.d.ts +5 -0
- package/dist/src/shared/errors.js +1 -1
- package/dist/src/shared/gateway-service-tier.d.ts +19 -0
- package/dist/src/shared/gateway-service-tier.js +1 -0
- package/dist/src/shared/model-summary.d.ts +12 -0
- package/dist/src/shared/model-summary.js +1 -0
- package/dist/src/shared/workflow-sandbox.d.ts +2 -0
- package/dist/src/shared/workflow-sandbox.js +1 -1
- package/dist/src/source-change/agent-config-ast.d.ts +54 -0
- package/dist/src/source-change/agent-config-ast.js +2 -0
- package/dist/src/source-change/agent-config-string-path.d.ts +18 -0
- package/dist/src/source-change/agent-config-string-path.js +2 -0
- package/dist/src/source-change/apply-agent-model-settings.d.ts +26 -0
- package/dist/src/source-change/apply-agent-model-settings.js +1 -0
- package/dist/src/source-change/apply-model-name.js +1 -2
- package/dist/src/source-change/static-source-change.d.ts +14 -0
- 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.d.ts +0 -6
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.d.ts +0 -2
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/concepts/execution-model-and-durability.md +1 -1
- package/docs/concepts/sessions-runs-and-streaming.md +1 -1
- package/docs/getting-started.mdx +1 -1
- package/docs/guides/auth-and-route-protection.md +1 -1
- package/docs/guides/client/overview.mdx +1 -1
- package/docs/guides/client/streaming.mdx +1 -10
- package/docs/guides/deployment/meta.json +4 -0
- package/docs/guides/deployment/overview.md +61 -0
- package/docs/guides/deployment/self-hosting.md +88 -0
- package/docs/guides/deployment/vercel.mdx +90 -0
- package/docs/guides/dev-tui.md +8 -4
- package/docs/guides/dynamic-capabilities.md +2 -0
- package/docs/guides/frontend/nextjs.mdx +1 -1
- package/docs/guides/frontend/nuxt.mdx +1 -1
- package/docs/guides/frontend/overview.mdx +2 -5
- package/docs/guides/frontend/sveltekit.mdx +1 -1
- package/docs/guides/frontend/use-eve-agent-svelte.mdx +1 -4
- package/docs/guides/frontend/use-eve-agent-vue.mdx +1 -4
- package/docs/guides/instrumentation.md +1 -1
- package/docs/reference/cli.md +24 -2
- package/docs/tutorial/ship-it.mdx +1 -1
- package/package.json +2 -1
- package/docs/guides/deployment.md +0 -210
- /package/dist/src/cli/{dev/tui → ui}/live-region.d.ts +0 -0
- /package/dist/src/cli/{dev/tui → ui}/live-region.js +0 -0
- /package/dist/src/cli/{dev/tui → ui}/terminal-text.d.ts +0 -0
- /package/dist/src/cli/{dev/tui → ui}/terminal-text.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
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,...s}=n,c=prepareDevelopmentTarget(r),{serverUrl:l}=r,u=i===void 0?{}:{headers:i},d=new Client(c.kind===`local`?resolveLocalDevelopmentClientOptions({...u,serverUrl:l,token:()=>resolveLinkedDevelopmentOidcToken(c.target.workspaceRoot)}):resolveRemoteDevelopmentClientOptions({...u,serverUrl:l,credentials:c.remote.credentials})),f={...s,session:d.session(),client:d,serverUrl:l,promptCommandHandler:createPromptCommandHandler({target:r}),availablePromptCommands:promptCommandsFor(r.kind),formatTransportError:e=>isVercelAuthChallenge(e)?formatRemoteAuthChallengeMessage(l):toErrorMessage(e)};c.kind===`local`?(f.appRoot=c.target.workspaceRoot,f.probeMcpConnection=probeMcpConnection):f.remote=c.remote,a!==void 0&&(f.initialInput=a),o!==void 0&&(f.onBootProgress=o)
|
|
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,...s}=n,c=prepareDevelopmentTarget(r),{serverUrl:l}=r,u=i===void 0?{}:{headers:i},d=new Client(c.kind===`local`?resolveLocalDevelopmentClientOptions({...u,serverUrl:l,token:()=>resolveLinkedDevelopmentOidcToken(c.target.workspaceRoot)}):resolveRemoteDevelopmentClientOptions({...u,serverUrl:l,credentials:c.remote.credentials})),f={...s,session:d.session(),client:d,serverUrl:l,promptCommandHandler:createPromptCommandHandler({target:r}),availablePromptCommands:promptCommandsFor(r.kind),formatTransportError:e=>isVercelAuthChallenge(e)?formatRemoteAuthChallengeMessage(l):toErrorMessage(e)};c.kind===`local`?(f.appRoot=c.target.workspaceRoot,f.probeMcpConnection=probeMcpConnection):f.remote=c.remote,a!==void 0&&(f.initialInput=a),o!==void 0&&(f.onBootProgress=o);let p=c.kind===`local`?await createDevDiagnostics(c.target.workspaceRoot).catch(()=>void 0):void 0;p!==void 0&&(f.diagnostics=p);try{await new EveTUIRunner(f).run()}finally{await p?.close()}}export{runDevelopmentTui};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One turn's wall clock and summed token flow. "When did this turn start"
|
|
3
|
+
* is a single fact; this object is its single representation — armed once
|
|
4
|
+
* per turn (a prompt submit, or an `--input` turn arming itself), fed by
|
|
5
|
+
* step usage reports, and consumed exactly once by the end-of-turn coda.
|
|
6
|
+
* Multi-pass turns (question answers, connection authorizations) re-stream
|
|
7
|
+
* without re-arming, so one turn gets one coda.
|
|
8
|
+
*/
|
|
9
|
+
export declare class TurnClock {
|
|
10
|
+
#private;
|
|
11
|
+
/** Starts the turn: resets the summed flow and stamps the clock. */
|
|
12
|
+
arm(): void;
|
|
13
|
+
get armed(): boolean;
|
|
14
|
+
get startedAtMs(): number | undefined;
|
|
15
|
+
get usage(): {
|
|
16
|
+
readonly inputTokens: number;
|
|
17
|
+
readonly outputTokens: number;
|
|
18
|
+
};
|
|
19
|
+
addUsage(usage: {
|
|
20
|
+
inputTokens?: number;
|
|
21
|
+
outputTokens?: number;
|
|
22
|
+
}): void;
|
|
23
|
+
/**
|
|
24
|
+
* Consumes the armed clock, returning the turn's elapsed time and summed
|
|
25
|
+
* flow — or `undefined` when no turn was armed (the coda's "already
|
|
26
|
+
* settled" signal). The flow survives the settle so a repaint between the
|
|
27
|
+
* coda and the next arm still reads the last turn's numbers.
|
|
28
|
+
*/
|
|
29
|
+
settle(): {
|
|
30
|
+
elapsedMs: number;
|
|
31
|
+
inputTokens: number;
|
|
32
|
+
outputTokens: number;
|
|
33
|
+
} | undefined;
|
|
34
|
+
/** Drops the clock without a coda (conversation boundaries). */
|
|
35
|
+
reset(): void;
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var TurnClock=class{#e;#t={inputTokens:0,outputTokens:0};arm(){this.#e=Date.now(),this.#t={inputTokens:0,outputTokens:0}}get armed(){return this.#e!==void 0}get startedAtMs(){return this.#e}get usage(){return this.#t}addUsage(e){this.#t.inputTokens+=e.inputTokens??0,this.#t.outputTokens+=e.outputTokens??0}settle(){let e=this.#e;if(e!==void 0)return this.#e=void 0,{elapsedMs:Date.now()-e,...this.#t}}reset(){this.#e=void 0,this.#t={inputTokens:0,outputTokens:0}}};export{TurnClock};
|
|
@@ -50,8 +50,8 @@ export type TuiDisplayOptions = {
|
|
|
50
50
|
/**
|
|
51
51
|
* The model context window size in tokens.
|
|
52
52
|
*
|
|
53
|
-
* When provided, the
|
|
54
|
-
* percentage of this
|
|
53
|
+
* When provided, the end-of-turn stats line shows the context fill as a
|
|
54
|
+
* percentage of this window.
|
|
55
55
|
*/
|
|
56
56
|
contextSize?: number;
|
|
57
57
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function resolveDevUiMode(e){return e.options.ui===!1||!e.interactive?`headless`:`tui`}function resolveTuiDisplayOptions(e){let t={logs:e.logs??`stderr`,reasoning:e.reasoning??`
|
|
1
|
+
function resolveDevUiMode(e){return e.options.ui===!1||!e.interactive?`headless`:`tui`}function resolveTuiDisplayOptions(e){let t={logs:e.logs??`stderr`,reasoning:e.reasoning??`auto-collapsed`,tools:e.tools??`auto-collapsed`};return e.subagents!==void 0&&(t.subagents=e.subagents),e.connectionAuth!==void 0&&(t.connectionAuth=e.connectionAuth),e.assistantResponseStats!==void 0&&(t.assistantResponseStats=e.assistantResponseStats),e.contextSize!==void 0&&(t.contextSize=e.contextSize),t}export{resolveDevUiMode,resolveTuiDisplayOptions};
|
package/dist/src/cli/run.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{createLogger}from"#internal/logging.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{Command,CommanderError,InvalidArgumentError}from"#compiled/commander/index.js";import{registerBuildCommand}from"#cli/commands/build.js";import{resolveApplicationRoot}from"#internal/application/paths.js";import{registerProjectCommands}from"#cli/commands/register-project-commands.js";import{resolveDevUiMode,resolveTuiDisplayOptions}from"#cli/dev/ui-options.js";import{parseDevelopmentHeaderOption,resolveDevelopmentUrlTarget}from"#cli/dev/url-target.js";import{LOG_DISPLAY_MODES,parseLogDisplayMode}from"#cli/dev/tui/log-display-mode.js";import{resolveTuiTitle}from"#cli/dev/tui/target.js";import{parseDevelopmentServerUrl}from"#cli/dev/url.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(`#internal/nitro/host.js`)).createDevelopmentServer}const loadIsActiveDevelopmentServerForApp=async()=>(await import(`#internal/nitro/host.js`)).isActiveDevelopmentServerForApp;async function loadStartProductionHost(){return(await import(`#internal/nitro/host.js`)).startProductionServer}function shouldPrintCliBootBanner(e){return e.name()===`info`||e.name()===`dev`||e.name()===`init`}async function waitForShutdownSignal(e){await new Promise((t,n)=>{let r=!1,cleanup=()=>{process.off(`SIGINT`,handleSignal),process.off(`SIGTERM`,handleSignal)},handleSignal=()=>{r||(r=!0,cleanup(),e.close().then(t,n))};process.once(`SIGINT`,handleSignal),process.once(`SIGTERM`,handleSignal)})}async function waitForProductionServer(e){await Promise.race([e.wait(),waitForShutdownSignal({close:()=>e.close()})])}function parsePortOption(e){if(!/^-?\d+$/.test(e))throw new InvalidArgumentError(`Expected a numeric port, received "${e}".`);let t=Number(e);if(t<0||t>65535)throw new InvalidArgumentError(`Expected a port between 0 and 65535, received "${e}".`);return t}const DISPLAY_MODES=new Set([`full`,`collapsed`,`auto-collapsed`,`hidden`]),STATS_MODES=new Set([`tokens`,`tokensPerSecond`]);function parseDisplayMode(e){if(!DISPLAY_MODES.has(e))throw new InvalidArgumentError(`Expected one of ${[...DISPLAY_MODES].join(`, `)}, received "${e}".`);return e}function parseStatsMode(e){if(!STATS_MODES.has(e))throw new InvalidArgumentError(`Expected one of ${[...STATS_MODES].join(`, `)}, received "${e}".`);return e}function parseLogsMode(e){let t=parseLogDisplayMode(e);if(t===void 0)throw new InvalidArgumentError(`Expected one of ${LOG_DISPLAY_MODES.join(`, `)}, received "${e}".`);return t}function parseContextSizeOption(e){let t=Number(e);if(!Number.isFinite(t)||t<=0)throw new InvalidArgumentError(`Expected a positive number, received "${e}".`);return t}function hasInteractiveTerminal(){return!!(process.stdin.isTTY&&process.stdout.isTTY)}function createCliProgram(e,i){let c=resolveApplicationRoot(),m=resolveInstalledPackageInfo().version,h=new Command,_=createCliTheme();h.name(`eve`).description(`Build and run an eve application.`).version(m).showHelpAfterError().exitOverride().hook(`preAction`,(t,n)=>{shouldPrintCliBootBanner(n)&&e.log(eveCliBanner())}).configureOutput({writeErr:t=>{e.error(t.trimEnd())},writeOut:t=>{e.log(t.trimEnd())}});let v=h.command(`channels`).description(`Manage user-authored channels in the current project.`);v.command(`add [kind]`).description(`Add channels interactively, or scaffold a channel kind (slack | web).`).option(`-f, --force`,`Overwrite existing channel files`).option(`-y, --yes`,`Assume yes for confirmations; requires an explicit channel kind`).action(async(t,n)=>{let{runChannelsAddCommand:r}=await import(`#cli/commands/channels.js`);await r(e,c,{kind:t,options:n})}),v.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,c,t)});let y=h.command(`extension`).description(`Create and build reusable eve extension packages.`);
|
|
1
|
+
import{createLogger}from"#internal/logging.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{Command,CommanderError,InvalidArgumentError}from"#compiled/commander/index.js";import{registerBuildCommand}from"#cli/commands/build.js";import{resolveApplicationRoot}from"#internal/application/paths.js";import{registerProjectCommands}from"#cli/commands/register-project-commands.js";import{resolveDevUiMode,resolveTuiDisplayOptions}from"#cli/dev/ui-options.js";import{parseDevelopmentHeaderOption,resolveDevelopmentUrlTarget}from"#cli/dev/url-target.js";import{LOG_DISPLAY_MODES,parseLogDisplayMode}from"#cli/dev/tui/log-display-mode.js";import{resolveTuiTitle}from"#cli/dev/tui/target.js";import{parseDevelopmentServerUrl}from"#cli/dev/url.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(`#internal/nitro/host.js`)).createDevelopmentServer}const loadIsActiveDevelopmentServerForApp=async()=>(await import(`#internal/nitro/host.js`)).isActiveDevelopmentServerForApp;async function loadStartProductionHost(){return(await import(`#internal/nitro/host.js`)).startProductionServer}function shouldPrintCliBootBanner(e){return e.name()===`info`||e.name()===`dev`||e.name()===`init`}async function waitForShutdownSignal(e){await new Promise((t,n)=>{let r=!1,cleanup=()=>{process.off(`SIGINT`,handleSignal),process.off(`SIGTERM`,handleSignal)},handleSignal=()=>{r||(r=!0,cleanup(),e.close().then(t,n))};process.once(`SIGINT`,handleSignal),process.once(`SIGTERM`,handleSignal)})}async function waitForProductionServer(e){await Promise.race([e.wait(),waitForShutdownSignal({close:()=>e.close()})])}function parsePortOption(e){if(!/^-?\d+$/.test(e))throw new InvalidArgumentError(`Expected a numeric port, received "${e}".`);let t=Number(e);if(t<0||t>65535)throw new InvalidArgumentError(`Expected a port between 0 and 65535, received "${e}".`);return t}const DISPLAY_MODES=new Set([`full`,`collapsed`,`auto-collapsed`,`hidden`]),STATS_MODES=new Set([`tokens`,`tokensPerSecond`]);function parseDisplayMode(e){if(!DISPLAY_MODES.has(e))throw new InvalidArgumentError(`Expected one of ${[...DISPLAY_MODES].join(`, `)}, received "${e}".`);return e}function parseStatsMode(e){if(!STATS_MODES.has(e))throw new InvalidArgumentError(`Expected one of ${[...STATS_MODES].join(`, `)}, received "${e}".`);return e}function parseLogsMode(e){let t=parseLogDisplayMode(e);if(t===void 0)throw new InvalidArgumentError(`Expected one of ${LOG_DISPLAY_MODES.join(`, `)}, received "${e}".`);return t}function parseContextSizeOption(e){let t=Number(e);if(!Number.isFinite(t)||t<=0)throw new InvalidArgumentError(`Expected a positive number, received "${e}".`);return t}function hasInteractiveTerminal(){return!!(process.stdin.isTTY&&process.stdout.isTTY)}function createCliProgram(e,i){let c=resolveApplicationRoot(),m=resolveInstalledPackageInfo().version,h=new Command,_=createCliTheme();h.name(`eve`).description(`Build and run an eve application.`).version(m).showHelpAfterError().exitOverride().hook(`preAction`,(t,n)=>{shouldPrintCliBootBanner(n)&&e.log(eveCliBanner())}).configureOutput({writeErr:t=>{e.error(t.trimEnd())},writeOut:t=>{e.log(t.trimEnd())}});let v=h.command(`channels`).description(`Manage user-authored channels in the current project.`);v.command(`add [kind]`).description(`Add channels interactively, or scaffold a channel kind (slack | web).`).option(`-f, --force`,`Overwrite existing channel files`).option(`-y, --yes`,`Assume yes for confirmations; requires an explicit channel kind`).action(async(t,n)=>{let{runChannelsAddCommand:r}=await import(`#cli/commands/channels.js`);await r(e,c,{kind:t,options:n})}),v.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,c,t)});let y=h.command(`extension`).description(`Create and build reusable eve extension packages.`);y.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,c,t)}),y.command(`build`).description(`Build the current package as an eve extension.`).action(async()=>{let{loadDevelopmentEnvironmentFiles:t}=await import(`#cli/dev/environment.js`);t(c);let{runExtensionBuildCommand:n}=await import(`#cli/commands/extension-build.js`);await n(e,c)}),h.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,c,t,{channelWebNextjs:n.channelWebNextjs})}),registerProjectCommands({program:h,logger:e,appRoot:c}),registerBuildCommand({appRoot:c,buildHost:i.buildHost,logger:e,program:h}),h.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:n}=await import(`#cli/dev/environment.js`);n(c);let a=await(i.startProductionHost??await loadStartProductionHost())(c,{host:t.host,port:t.port});e.log(renderCliTaggedLine(_,{message:`server listening at ${a.url}`,tag:`start`,tone:`success`})),await waitForProductionServer(a)}),h.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,n)=>{let a=resolveDevelopmentUrlTarget(n,t),s=a?.serverUrl,u=hasInteractiveTerminal(),d=resolveDevUiMode({options:n,interactive:u});if(n.input!==void 0&&d===`headless`)throw new InvalidArgumentError(`--input requires the interactive UI.`);let f=!1;s!==void 0&&(f=await(i.isActiveDevelopmentServerForApp??await loadIsActiveDevelopmentServerForApp())({appRoot:c,serverUrl:s}));let runInteractiveUi=async(e,t)=>{let r=await devBootPhase(`loading interactive UI`,async()=>i.runDevelopmentTui??await loadRunDevelopmentTui(),t),o=resolveTuiDisplayOptions(n),l=s===void 0||f?{kind:`local`,serverUrl:e.serverUrl,workspaceRoot:e.appRoot??c}:{kind:`remote`,serverUrl:e.serverUrl,workspaceRoot:c},u=resolveTuiTitle({name:n.name,target:l});u!==void 0&&(o.name=u);let d={target:l,initialInput:n.input,onBootProgress:t,...o};a?.headers===void 0?await r(d):await r({...d,headers:a.headers})};if(s){let{loadDevelopmentEnvironmentFiles:t}=await import(`#cli/dev/environment.js`);if(t(c),e.log(`↗ ${f?`local`:`remote`} mode targeting ${_.info(new URL(s).host)}`),d===`headless`){e.log(renderCliTaggedLine(_,{message:`Interactive UI disabled because the current terminal is not a TTY.`,tag:`dev`,tone:`warning`}));return}e.log(``),await runInteractiveUi({serverUrl:s});return}d===`tui`&&e.log(``);let p=d===`tui`?startCliLiveRow(e):void 0,m=createDevBootProgressReporter(p);p?.update(`Building your agent`);let h=!1,g,closeServer=async()=>{h||g===void 0||(h=!0,await g.close())};try{g=(i.startHost??await loadStartHost())(c,{existing:d===`tui`?`attach-if-unconfigured`:`reject`,host:n.host,onBootProgress:m,port:n.port});let t=await g.start();if(d!==`tui`&&e.log(renderCliTaggedLine(_,{message:`server listening at ${t.url}`,tag:`dev`,tone:`success`})),d===`headless`)return n.ui!==!1&&!u&&e.log(renderCliTaggedLine(_,{message:`Interactive UI disabled because the current terminal is not a TTY.`,tag:`dev`,tone:`warning`})),await waitForShutdownSignal({close:closeServer});await runInteractiveUi({appRoot:t.appRoot,serverUrl:t.url},m)}finally{p?.stop(),await closeServer()}}),h.command(`info`).description(`Print resolved application information.`).option(`--json`,`Output as JSON`).action(async t=>{await(i.printApplicationInfo??await loadPrintApplicationInfo())(e,c,t)}),h.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(`--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,n)=>{await(i.runEvalCommand??await loadRunEvalCommand())(t,n,e)}),h}async function runCli(e=process.argv.slice(2),t=console,n={}){let r=createCliProgram(t,n),a=e.length===0?[`dev`]:e;try{await r.parseAsync(a,{from:`user`})}catch(e){if(e instanceof CommanderError){if(e.exitCode===0)return;let r=await(n.isCodingAgentLaunch??isCodingAgentLaunch)();if(a[0]===`init`&&r){let{initAgentInstructions:e}=await import(`#cli/commands/agent-instructions.js`);t.log(e())}throw Error(e.message)}throw e}}export{resolveDevUiMode,resolveTuiDisplayOptions,runCli};
|
|
3
|
+
`).action(async(t,n)=>{let a=resolveDevelopmentUrlTarget(n,t),s=a?.serverUrl,u=hasInteractiveTerminal(),d=resolveDevUiMode({options:n,interactive:u});if(n.input!==void 0&&d===`headless`)throw new InvalidArgumentError(`--input requires the interactive UI.`);let f=!1;s!==void 0&&(f=await(i.isActiveDevelopmentServerForApp??await loadIsActiveDevelopmentServerForApp())({appRoot:c,serverUrl:s}));let runInteractiveUi=async(e,t)=>{let r=await devBootPhase(`loading interactive UI`,async()=>i.runDevelopmentTui??await loadRunDevelopmentTui(),t),o=resolveTuiDisplayOptions(n),l=s===void 0||f?{kind:`local`,serverUrl:e.serverUrl,workspaceRoot:e.appRoot??c}:{kind:`remote`,serverUrl:e.serverUrl,workspaceRoot:c},u=resolveTuiTitle({name:n.name,target:l});u!==void 0&&(o.name=u);let d={target:l,initialInput:n.input,onBootProgress:t,...o};a?.headers===void 0?await r(d):await r({...d,headers:a.headers})};if(s){let{loadDevelopmentEnvironmentFiles:t}=await import(`#cli/dev/environment.js`);if(t(c),e.log(`↗ ${f?`local`:`remote`} mode targeting ${_.info(new URL(s).host)}`),d===`headless`){e.log(renderCliTaggedLine(_,{message:`Interactive UI disabled because the current terminal is not a TTY.`,tag:`dev`,tone:`warning`}));return}e.log(``),await runInteractiveUi({serverUrl:s});return}d===`tui`&&e.log(``);let p=d===`tui`?startCliLiveRow(e):void 0,m=createDevBootProgressReporter(p);p?.update(`Building your agent`);let h=!1,g,closeServer=async()=>{h||g===void 0||(h=!0,await g.close())};try{g=(i.startHost??await loadStartHost())(c,{existing:d===`tui`?`attach-if-unconfigured`:`reject`,host:n.host,onBootProgress:m,port:n.port});let t=await g.start();if(d!==`tui`&&e.log(renderCliTaggedLine(_,{message:`server listening at ${t.url}`,tag:`dev`,tone:`success`})),d===`headless`)return n.ui!==!1&&!u&&e.log(renderCliTaggedLine(_,{message:`Interactive UI disabled because the current terminal is not a TTY.`,tag:`dev`,tone:`warning`})),await waitForShutdownSignal({close:closeServer});await runInteractiveUi({appRoot:t.appRoot,serverUrl:t.url},m)}finally{p?.stop(),await closeServer()}});let b=h.command(`logs`).description("Inspect local `eve dev` diagnostic logs (.eve/logs).");return b.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,c,t,n)}),b.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,c,t)}),h.command(`info`).description(`Print resolved application information.`).option(`--json`,`Output as JSON`).action(async t=>{await(i.printApplicationInfo??await loadPrintApplicationInfo())(e,c,t)}),h.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(`--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,n)=>{await(i.runEvalCommand??await loadRunEvalCommand())(t,n,e)}),h}async function runCli(e=process.argv.slice(2),t=console,n={}){let r=createCliProgram(t,n),a=e.length===0?[`dev`]:e;try{await r.parseAsync(a,{from:`user`})}catch(e){if(e instanceof CommanderError){if(e.exitCode===0)return;let r=await(n.isCodingAgentLaunch??isCodingAgentLaunch)();if(a[0]===`init`&&r){let{initAgentInstructions:e}=await import(`#cli/commands/agent-instructions.js`);t.log(e())}throw Error(e.message)}throw e}}export{resolveDevUiMode,resolveTuiDisplayOptions,runCli};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__toESM}from"../../_virtual/_rolldown/runtime.js";import{require_picocolors}from"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js";import{isLogLevelEnabled}from"#internal/logging.js";import{sanitizeForTerminal}from"#cli/ui/output.js";import{
|
|
1
|
+
import{__toESM}from"../../_virtual/_rolldown/runtime.js";import{require_picocolors}from"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js";import{isLogLevelEnabled}from"#internal/logging.js";import{sanitizeForTerminal}from"#cli/ui/output.js";import{sliceVisible,visibleLength}from"#cli/ui/terminal-text.js";import{LiveRegion}from"#cli/ui/live-region.js";import{PROGRESS_PULSE_DURATION_MS,PROGRESS_PULSE_GLYPH,PROGRESS_PULSE_SEQUENCE}from"#cli/ui/progress-pulse.js";var import_picocolors=__toESM(require_picocolors(),1);function validatePulseSequence(e){if(e.length!==8&&e.length!==16)throw RangeError(`Pulse sequence must contain 8 or 16 steps.`);if(/[^01]/u.test(e))throw RangeError(`Pulse sequence steps must be "0" or "1".`)}function pulseStepDurationMs(e,t){let n=Math.round(e*PROGRESS_PULSE_DURATION_MS/t);return Math.round((e+1)*PROGRESS_PULSE_DURATION_MS/t)-n}function sanitizeProgressText(e){return sanitizeForTerminal(e).replaceAll(/\s+/gu,` `).trim()}function fitProgressText(e,t){return t<=0?``:visibleLength(e)<=t?e:t===1?`…`:`${sliceVisible(e,t-1)}…`}function renderProgressRow(e,t,n,r){let i=n!==``,o=`${e} ${t}${i?``:`...`}`,s=Math.max(0,(r??80)-1),c=visibleLength(o);if(c>=s){let t=fitProgressText(o,s);return t.startsWith(e)?`${import_picocolors.default.green(e)}${t.slice(e.length)}`:t}let l=i?fitProgressText(` ${n}`,s-c):``,d=l===``?``:import_picocolors.default.dim(l);return`${import_picocolors.default.green(e)}${o.slice(e.length)}${d}`}function startCliLiveRow(e,t={}){let r=t.output??process.stdout,i=t.pulseSequence??PROGRESS_PULSE_SEQUENCE;validatePulseSequence(i);let a=r.isTTY===!0&&!isLogLevelEnabled(`debug`),s=a?new LiveRegion({write:e=>(r.write(e),!0)}):void 0,u=0,d=i[0]===`1`,f,p=!1,m=!1,h=!1,g,paint=()=>{if(f===void 0||s===void 0)return;let e=renderProgressRow(d?PROGRESS_PULSE_GLYPH:` `,f.message,f.detail,r.columns);s.update([e]),p=!0},schedulePulseStep=()=>{g=setTimeout(()=>{if(h)return;u=(u+1)%i.length;let e=i[u]===`1`;e!==d&&(d=e,paint()),schedulePulseStep()},pulseStepDurationMs(u,i.length)),g.unref?.()};return{update(t,n=``){if(!h){if(f={detail:sanitizeProgressText(n),message:sanitizeProgressText(t)},!a){m||=(e.log(`${f.message}...`),!0);return}paint(),g===void 0&&schedulePulseStep()}},stop(){h||(h=!0,g!==void 0&&clearTimeout(g),s!==void 0&&p&&s.clear())}}}export{startCliLiveRow};
|
|
@@ -205,6 +205,15 @@ export declare const AgentInfoResultSchema: z.ZodObject<{
|
|
|
205
205
|
contextWindowTokens: z.ZodOptional<z.ZodNumber>;
|
|
206
206
|
id: z.ZodString;
|
|
207
207
|
providerOptions: z.ZodOptional<z.ZodUnknown>;
|
|
208
|
+
reasoning: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
|
|
209
|
+
high: "high";
|
|
210
|
+
low: "low";
|
|
211
|
+
medium: "medium";
|
|
212
|
+
minimal: "minimal";
|
|
213
|
+
none: "none";
|
|
214
|
+
"provider-default": "provider-default";
|
|
215
|
+
xhigh: "xhigh";
|
|
216
|
+
}>>>;
|
|
208
217
|
source: z.ZodOptional<z.ZodObject<{
|
|
209
218
|
exportName: z.ZodOptional<z.ZodString>;
|
|
210
219
|
logicalPath: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from"#compiled/zod/index.js";const source=z.object({exportName:z.string().optional(),logicalPath:z.string(),sourceId:z.string().optional(),sourceKind:z.string()}),entry=source.extend({name:z.string()}),modelRouting=z.discriminatedUnion(`kind`,[z.object({kind:z.literal(`gateway`),target:z.string(),byok:z.string().optional()}),z.object({kind:z.literal(`external`),provider:z.string()})]),modelEndpoint=z.union([z.object({kind:z.literal(`external`),provider:z.string()}),z.object({kind:z.literal(`gateway`),connected:z.literal(!0),credential:z.enum([`api-key`,`oidc`])}),z.object({kind:z.literal(`gateway`),connected:z.literal(!1)})]),tool=entry.extend({description:z.string(),hasAuth:z.boolean(),hasExecute:z.boolean(),hasModelOutputProjection:z.boolean(),hasOutputSchema:z.boolean(),inputSchema:z.unknown(),origin:z.enum([`authored`,`framework`]),outputSchema:z.unknown().optional(),replacesFrameworkTool:z.boolean(),requiresApproval:z.boolean()}),frameworkTool=tool.extend({disabledByAuthor:z.boolean(),replacedByAuthoredTool:z.boolean(),status:z.enum([`active`,`disabled`,`replaced`])}),dynamicResolver=source.extend({eventNames:z.array(z.string()),origin:z.enum([`authored`,`framework`]),slug:z.string()}),skill=entry.extend({description:z.string(),license:z.string().optional(),markdown:z.string(),metadata:z.record(z.string(),z.string()).optional()}),instructions=entry.extend({markdown:z.string()}),schedule=entry.extend({cron:z.string(),hasRun:z.boolean(),markdown:z.string().optional()}),subagent=entry.extend({description:z.string(),entryPath:z.string(),nodeId:z.string(),rootPath:z.string(),summary:z.object({channels:z.number(),connections:z.number(),hooks:z.number(),instructions:z.boolean(),schedules:z.number(),skills:z.number(),tools:z.number()})}),channel=entry.extend({adapterKind:z.string().optional(),method:z.string(),origin:z.enum([`authored`,`framework`]),urlPath:z.string()}),frameworkChannel=channel.extend({disabledByAuthor:z.boolean(),replacedByAuthoredChannel:z.boolean(),status:z.enum([`active`,`disabled`,`replaced`])}),connection=source.extend({connectionName:z.string(),description:z.string(),hasApproval:z.boolean(),hasAuthorization:z.boolean(),hasHeaders:z.boolean(),protocol:z.string(),toolFilter:z.unknown().optional(),url:z.string()}),hook=source.extend({eventNames:z.array(z.string()),slug:z.string()}),sandbox=source.extend({backendKind:z.string().optional(),description:z.string().optional(),hasBootstrap:z.boolean(),hasOnSession:z.boolean(),revalidationKey:z.string().optional(),sourceHash:z.string().optional()}),AgentInfoResultSchema=z.object({agent:z.object({agentRoot:z.string(),appRoot:z.string(),configSource:source.optional(),description:z.string().optional(),model:z.object({contextWindowTokens:z.number().optional(),id:z.string(),providerOptions:z.unknown().optional(),source:source.optional(),routing:modelRouting.optional(),endpoint:modelEndpoint.optional()}),name:z.string(),outputSchema:z.unknown().optional()}),capabilities:z.object({devRoutes:z.boolean()}),channels:z.object({authored:z.array(channel),available:z.array(channel),disabledFramework:z.array(z.string()),framework:z.array(frameworkChannel)}),connections:z.array(connection),diagnostics:z.object({discoveryErrors:z.number(),discoveryWarnings:z.number()}),hooks:z.array(hook),instructions:z.object({dynamic:z.array(dynamicResolver),static:instructions.nullable()}),kind:z.literal(`eve-agent-info`),mode:z.enum([`development`,`production`]),sandbox:sandbox.nullable(),schedules:z.array(schedule),skills:z.object({dynamic:z.array(dynamicResolver),static:z.array(skill)}),subagents:z.object({local:z.array(subagent),total:z.number()}),tools:z.object({authored:z.array(tool),available:z.array(tool),disabledFramework:z.array(z.string()),dynamic:z.array(dynamicResolver),framework:z.array(frameworkTool),reserved:z.array(z.string())}),version:z.literal(1),workflow:z.object({enabled:z.boolean(),toolName:z.string()}),workspace:z.object({resourceRoot:z.unknown(),rootEntries:z.array(z.string())})});export{AgentInfoResultSchema};
|
|
1
|
+
import{z}from"#compiled/zod/index.js";const source=z.object({exportName:z.string().optional(),logicalPath:z.string(),sourceId:z.string().optional(),sourceKind:z.string()}),entry=source.extend({name:z.string()}),modelRouting=z.discriminatedUnion(`kind`,[z.object({kind:z.literal(`gateway`),target:z.string(),byok:z.string().optional()}),z.object({kind:z.literal(`external`),provider:z.string()})]),modelEndpoint=z.union([z.object({kind:z.literal(`external`),provider:z.string()}),z.object({kind:z.literal(`gateway`),connected:z.literal(!0),credential:z.enum([`api-key`,`oidc`])}),z.object({kind:z.literal(`gateway`),connected:z.literal(!1)})]),tool=entry.extend({description:z.string(),hasAuth:z.boolean(),hasExecute:z.boolean(),hasModelOutputProjection:z.boolean(),hasOutputSchema:z.boolean(),inputSchema:z.unknown(),origin:z.enum([`authored`,`framework`]),outputSchema:z.unknown().optional(),replacesFrameworkTool:z.boolean(),requiresApproval:z.boolean()}),frameworkTool=tool.extend({disabledByAuthor:z.boolean(),replacedByAuthoredTool:z.boolean(),status:z.enum([`active`,`disabled`,`replaced`])}),dynamicResolver=source.extend({eventNames:z.array(z.string()),origin:z.enum([`authored`,`framework`]),slug:z.string()}),skill=entry.extend({description:z.string(),license:z.string().optional(),markdown:z.string(),metadata:z.record(z.string(),z.string()).optional()}),instructions=entry.extend({markdown:z.string()}),schedule=entry.extend({cron:z.string(),hasRun:z.boolean(),markdown:z.string().optional()}),subagent=entry.extend({description:z.string(),entryPath:z.string(),nodeId:z.string(),rootPath:z.string(),summary:z.object({channels:z.number(),connections:z.number(),hooks:z.number(),instructions:z.boolean(),schedules:z.number(),skills:z.number(),tools:z.number()})}),channel=entry.extend({adapterKind:z.string().optional(),method:z.string(),origin:z.enum([`authored`,`framework`]),urlPath:z.string()}),frameworkChannel=channel.extend({disabledByAuthor:z.boolean(),replacedByAuthoredChannel:z.boolean(),status:z.enum([`active`,`disabled`,`replaced`])}),connection=source.extend({connectionName:z.string(),description:z.string(),hasApproval:z.boolean(),hasAuthorization:z.boolean(),hasHeaders:z.boolean(),protocol:z.string(),toolFilter:z.unknown().optional(),url:z.string()}),hook=source.extend({eventNames:z.array(z.string()),slug:z.string()}),sandbox=source.extend({backendKind:z.string().optional(),description:z.string().optional(),hasBootstrap:z.boolean(),hasOnSession:z.boolean(),revalidationKey:z.string().optional(),sourceHash:z.string().optional()}),AgentInfoResultSchema=z.object({agent:z.object({agentRoot:z.string(),appRoot:z.string(),configSource:source.optional(),description:z.string().optional(),model:z.object({contextWindowTokens:z.number().optional(),id:z.string(),providerOptions:z.unknown().optional(),reasoning:z.enum([`provider-default`,`none`,`minimal`,`low`,`medium`,`high`,`xhigh`]).optional().catch(void 0),source:source.optional(),routing:modelRouting.optional(),endpoint:modelEndpoint.optional()}),name:z.string(),outputSchema:z.unknown().optional()}),capabilities:z.object({devRoutes:z.boolean()}),channels:z.object({authored:z.array(channel),available:z.array(channel),disabledFramework:z.array(z.string()),framework:z.array(frameworkChannel)}),connections:z.array(connection),diagnostics:z.object({discoveryErrors:z.number(),discoveryWarnings:z.number()}),hooks:z.array(hook),instructions:z.object({dynamic:z.array(dynamicResolver),static:instructions.nullable()}),kind:z.literal(`eve-agent-info`),mode:z.enum([`development`,`production`]),sandbox:sandbox.nullable(),schedules:z.array(schedule),skills:z.object({dynamic:z.array(dynamicResolver),static:z.array(skill)}),subagents:z.object({local:z.array(subagent),total:z.number()}),tools:z.object({authored:z.array(tool),available:z.array(tool),disabledFramework:z.array(z.string()),dynamic:z.array(dynamicResolver),framework:z.array(frameworkTool),reserved:z.array(z.string())}),version:z.literal(1),workflow:z.object({enabled:z.boolean(),toolName:z.string()}),workspace:z.object({resourceRoot:z.unknown(),rootEntries:z.array(z.string())})});export{AgentInfoResultSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EVE_HEALTH_ROUTE_PATH,EVE_INFO_ROUTE_PATH}from"#protocol/routes.js";import{encodeBasicCredentials}from"#internal/http/basic-auth.js";import{AgentInfoResponseError}from"#client/agent-info-error.js";import{AgentInfoResultSchema}from"#client/agent-info-schema.js";import{ClientError}from"#client/client-error.js";import{ClientSession}from"#client/session.js";import{createInitialSessionState}from"#client/session-utils.js";import{createClientUrl}from"#client/url.js";import{VERCEL_TRUSTED_OIDC_IDP_TOKEN_HEADER}from"#client/types.js";var Client=class{#e;#t;#n;#r;#i
|
|
1
|
+
import{EVE_HEALTH_ROUTE_PATH,EVE_INFO_ROUTE_PATH}from"#protocol/routes.js";import{encodeBasicCredentials}from"#internal/http/basic-auth.js";import{AgentInfoResponseError}from"#client/agent-info-error.js";import{AgentInfoResultSchema}from"#client/agent-info-schema.js";import{ClientError}from"#client/client-error.js";import{ClientSession}from"#client/session.js";import{createInitialSessionState}from"#client/session-utils.js";import{createClientUrl}from"#client/url.js";import{VERCEL_TRUSTED_OIDC_IDP_TOKEN_HEADER}from"#client/types.js";var Client=class{#e;#t;#n;#r;#i;constructor(e){this.#n=e.host,this.#e=e.auth,this.#t=e.headers,this.#r=e.preserveCompletedSessions??!1,this.#i=e.redirect}async health(){let t=createClientUrl(this.#n,EVE_HEALTH_ROUTE_PATH),n=await this.#a(),r=await fetch(t,withRedirectPolicy({headers:n},this.#i));if(!r.ok){let e=await r.text();throw new ClientError(r.status,e,r.headers)}return await r.json()}async info(){let e=await this.fetch(EVE_INFO_ROUTE_PATH);if(!e.ok){let t=await e.text();throw new ClientError(e.status,t,e.headers)}let n;try{n=await e.json()}catch{throw new AgentInfoResponseError}let i=AgentInfoResultSchema.safeParse(n);if(!i.success)throw new AgentInfoResponseError(i.error.issues.slice(0,5).map(e=>{let t=e.path.join(`.`);return t.length===0?e.message:`${t}: ${e.message}`}));return i.data}async fetch(e,t={}){let n=createClientUrl(this.#n,e),r=await this.#a(headersInitToRecord(t.headers));return await fetch(n,withRedirectPolicy({...t,headers:r},this.#i))}session(e){let t;return t=typeof e==`string`?{continuationToken:e,streamIndex:0}:e||createInitialSessionState(),new ClientSession({host:this.#n,preserveCompletedSessions:this.#r,redirect:this.#i,resolveHeaders:e=>this.#a(e)},t)}async#a(e){let t=new Headers,[n,r]=await Promise.all([resolveHeadersValue(this.#t),this.#o()]);for(let[e,r]of Object.entries(n))t.set(e,r);if(e)for(let[n,r]of Object.entries(e))t.set(n,r);for(let[e,n]of Object.entries(r))t.set(e,n);return t}async#o(){let e=this.#e;if(!e)return{};if(`vercelOidc`in e){let t=(await resolveTokenValue(e.vercelOidc.token)).trim();return t.length===0?{}:{authorization:`Bearer ${t}`,[VERCEL_TRUSTED_OIDC_IDP_TOKEN_HEADER]:t}}if(`bearer`in e){let t=(await resolveTokenValue(e.bearer)).trim();return t.length===0?{}:{authorization:`Bearer ${t}`}}if(`basic`in e){let t=await resolveTokenValue(e.basic.password);return{authorization:`Basic ${encodeBasicCredentials(e.basic.username,t)}`}}return{}}};async function resolveTokenValue(e){return typeof e==`function`?e():e}async function resolveHeadersValue(e){return e===void 0?{}:typeof e==`function`?await e():e}function headersInitToRecord(e){return e===void 0?{}:Object.fromEntries(new Headers(e).entries())}function withRedirectPolicy(e,t){return t===void 0?e:{...e,redirect:t}}export{Client};
|
|
@@ -46,7 +46,7 @@ export interface EveAgentStoreCallbacks<TData> {
|
|
|
46
46
|
* Configuration for constructing an {@link EveAgentStore}.
|
|
47
47
|
*
|
|
48
48
|
* Requires a {@link EveAgentReducer | reducer}, plus either connection options
|
|
49
|
-
* (`host`, `auth`, `headers`, `
|
|
49
|
+
* (`host`, `auth`, `headers`, `initialSession`) for a
|
|
50
50
|
* store-owned session or an existing {@link ClientSession} via `session`.
|
|
51
51
|
*
|
|
52
52
|
* `optimistic` (default `true`) projects submitted user messages before the
|
|
@@ -60,7 +60,6 @@ export interface EveAgentStoreInit<TData> {
|
|
|
60
60
|
readonly host?: string;
|
|
61
61
|
readonly initialEvents?: readonly HandleMessageStreamEvent[];
|
|
62
62
|
readonly initialSession?: SessionState;
|
|
63
|
-
readonly maxReconnectAttempts?: number;
|
|
64
63
|
readonly optimistic?: boolean;
|
|
65
64
|
readonly reducer: EveAgentReducer<TData>;
|
|
66
65
|
readonly session?: ClientSession;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{toError}from"#shared/errors.js";import{Client}from"#client/client.js";var EveAgentStore=class{#e;#t;#n;#r=new Set;#i;#a={};#o;#s;#c;#l=0;#u;#d;#f;#p;#m=`ready`;constructor(e){this.#e=e.session?void 0:()=>new Client({auth:e.auth,headers:e.headers,host:e.host
|
|
1
|
+
import{toError}from"#shared/errors.js";import{Client}from"#client/client.js";var EveAgentStore=class{#e;#t;#n;#r=new Set;#i;#a={};#o;#s;#c;#l=0;#u;#d;#f;#p;#m=`ready`;constructor(e){this.#e=e.session?void 0:()=>new Client({auth:e.auth,headers:e.headers,host:e.host??``}).session(e.initialSession),this.#c=[...e.initialEvents??[]],this.#d=[...this.#c],this.#t=e.optimistic??!0,this.#n=e.reducer,this.#f=e.session??this.#h(),this.#o=this.#E(this.#d),this.#p=this.#D()}get snapshot(){return this.#p}setCallbacks(e){this.#a=e}subscribe(e){return this.#r.add(e),()=>{this.#r.delete(e)}}async send(t){if(this.#m===`streaming`||this.#m===`submitted`)throw Error(`eve session is already processing a turn.`);let n=this.#g(),r=new AbortController;this.#i=r,this.#s=void 0,this.#m=`submitted`,this.#O();try{let e=await this.#a.prepareSend?.(t)??t;if(!this.#v(n))return;this.#y(e),this.#b(e),this.#O();let i=await this.#f.send({...e,signal:createAbortSignal(e.signal,r.signal)}),a=!1;for await(let e of i){if(!this.#v(n))return;a||(a=!0,this.#m=`streaming`),this.#c=[...this.#c,e],this.#x(e),this.#a.onEvent?.(e),this.#S(e),this.#O()}if(!this.#v(n))return;this.#m=this.#s===void 0?`ready`:`error`}catch(t){if(!this.#v(n))return;isAbortError(t)?(this.#m=`ready`,this.#C(toError(t))):(this.#s=toError(t),this.#m=`error`,this.#C(this.#s),this.#a.onError?.(this.#s))}finally{this.#v(n)&&(this.#i=void 0,this.#a.onSessionChange?.(this.#f.state),this.#O(),this.#a.onFinish?.(this.#p))}}stop(){this.#i?.abort()}reset(){this.#_(),this.stop(),this.#i=void 0,this.#f=this.#e?.()??this.#f,this.#c=[],this.#u=void 0,this.#d=[],this.#o=this.#n.initial(),this.#s=void 0,this.#m=`ready`,this.#a.onSessionChange?.(this.#f.state),this.#O()}#h(){if(!this.#e)throw Error(`Cannot create an owned eve session from an external session.`);return this.#e()}#g(){return this.#l+=1,this.#l}#_(){this.#l+=1}#v(e){return this.#l===e}#y(e){if(!this.#t||e.message===void 0)return;let t=createSubmissionId(),n={createdAt:Date.now(),id:t,message:summarizeUserContent(e.message)};this.#u=n,this.#w({data:{createdAt:n.createdAt,message:n.message,submissionId:n.id},type:`client.message.submitted`})}#b(e){e.inputResponses===void 0||e.inputResponses.length===0||this.#w({data:{createdAt:Date.now(),responses:e.inputResponses},type:`client.input.responded`})}#x(e){if(e.type===`message.received`&&this.#u!==void 0){let t=this.#u.id;this.#u=void 0,this.#T(e=>e.type===`client.message.submitted`&&e.data.submissionId===t,e);return}this.#w(e)}#S(e){let t=toTerminalStreamFailureError(e);t!==void 0&&(this.#m=`error`,this.#C(t),this.#s===void 0&&(this.#s=t,this.#a.onError?.(t)))}#C(e){let t=this.#u;t!==void 0&&(this.#u=void 0,this.#T(e=>e.type===`client.message.submitted`&&e.data.submissionId===t.id,{data:{createdAt:t.createdAt,error:{message:e.message},message:t.message,submissionId:t.id},type:`client.message.failed`}))}#w(e){this.#d=[...this.#d,e],this.#o=this.#n.reduce(this.#o,e)}#T(e,t){let n=!1;this.#d=this.#d.map(r=>!n&&e(r)?(n=!0,t):r),n||(this.#d=[...this.#d,t]),this.#o=this.#E(this.#d)}#E(e){let t=this.#n.initial();for(let n of e)t=this.#n.reduce(t,n);return t}#D(){return{data:this.#o,error:this.#s,events:this.#c,session:this.#f.state,status:this.#m}}#O(){this.#p=this.#D();for(let e of this.#r)e()}};let submissionSequence=0;function createSubmissionId(){let e=globalThis.crypto?.randomUUID;return e===void 0?(submissionSequence+=1,`submission_${submissionSequence.toString()}`):e.call(globalThis.crypto)}function createAbortSignal(e,t){return e?AbortSignal.any([e,t]):t}function summarizeUserContent(e){if(typeof e==`string`)return e;let t=[];for(let n of e){if(n.type===`text`){t.push(n.text);continue}n.type===`file`&&t.push(n.filename?`[file: ${n.filename}]`:`[file]`)}return t.join(`
|
|
2
2
|
`)}function isAbortError(e){return e instanceof Error&&e.name===`AbortError`}function toTerminalStreamFailureError(e){if(e.type!==`session.failed`)return;let t=Error(e.data.message);return t.name=e.data.code,t}export{EveAgentStore};
|
package/dist/src/client/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AgentInfoResponseError}from"#client/agent-info-error.js";import{ClientError}from"#client/client-error.js";import{ClientSession}from"#client/session.js";import{Client}from"#client/client.js";import{EveAgentStore}from"#client/eve-agent-store.js";import{defaultMessageReducer}from"#client/message-reducer.js";import{createDataUrlFilePart,createTextWithFileContent}from"#client/file-parts.js";import{MessageResponse}from"#client/message-response.js";import{
|
|
1
|
+
import{isCurrentTurnBoundaryEvent,isTurnFailureEvent}from"#protocol/message.js";import{AgentInfoResponseError}from"#client/agent-info-error.js";import{ClientError}from"#client/client-error.js";import{ClientSession}from"#client/session.js";import{Client}from"#client/client.js";import{EveAgentStore}from"#client/eve-agent-store.js";import{defaultMessageReducer}from"#client/message-reducer.js";import{createDataUrlFilePart,createTextWithFileContent}from"#client/file-parts.js";import{MessageResponse}from"#client/message-response.js";import{inputOptionSchema,inputRequestSchema,inputResponseSchema,isInputRequest,isInputResponse}from"#runtime/input/types.js";import{resolveTextToResponse,resolveTextToResponses}from"#channel/resolve-text.js";export{AgentInfoResponseError,Client,ClientError,ClientSession,EveAgentStore,MessageResponse,createDataUrlFilePart,createTextWithFileContent,defaultMessageReducer,inputOptionSchema,inputRequestSchema,inputResponseSchema,isCurrentTurnBoundaryEvent,isInputRequest,isInputResponse,isTurnFailureEvent,resolveTextToResponse,resolveTextToResponses};
|
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
import type { HandleMessageStreamEvent } from "#protocol/message.js";
|
|
2
2
|
import type { ClientRedirectPolicy } from "#client/types.js";
|
|
3
3
|
/**
|
|
4
|
-
* Internal configuration for
|
|
4
|
+
* Internal configuration for following a durable event stream.
|
|
5
5
|
*/
|
|
6
|
-
interface
|
|
6
|
+
interface FollowStreamInput {
|
|
7
7
|
readonly host: string;
|
|
8
|
-
readonly maxReconnectAttempts: number;
|
|
9
8
|
readonly resolveHeaders: () => Promise<Headers>;
|
|
10
9
|
readonly redirect?: ClientRedirectPolicy;
|
|
11
10
|
readonly sessionId: string;
|
|
12
11
|
readonly signal?: AbortSignal;
|
|
13
12
|
readonly startIndex: number;
|
|
14
13
|
}
|
|
15
|
-
type OpenStreamBodyInput = Omit<OpenStreamInput, "maxReconnectAttempts">;
|
|
16
14
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* Follows a session's durable event stream from an absolute cursor,
|
|
16
|
+
* transparently reconnecting whenever the transport ends.
|
|
17
|
+
*
|
|
18
|
+
* Transport endings reconnect from the advanced cursor. Progress resets the
|
|
19
|
+
* idle budget; repeated empty streams eventually stop the follow. Callers own
|
|
20
|
+
* boundary handling. Negative tail-relative cursors use one connection because
|
|
21
|
+
* they cannot be advanced safely.
|
|
19
22
|
*/
|
|
20
|
-
export declare function
|
|
23
|
+
export declare function followStreamIterable(input: FollowStreamInput): AsyncGenerator<HandleMessageStreamEvent>;
|
|
21
24
|
/**
|
|
22
|
-
* Opens one stream response body, retrying transient
|
|
23
|
-
*
|
|
25
|
+
* Opens one stream response body, retrying transient failures with capped
|
|
26
|
+
* exponential backoff (~35s total): brief network outages and the short
|
|
27
|
+
* propagation window where a just-acknowledged session may not yet be
|
|
24
28
|
* readable from the stream route.
|
|
25
29
|
*/
|
|
26
|
-
export declare function openStreamBody(input:
|
|
30
|
+
export declare function openStreamBody(input: FollowStreamInput): Promise<ReadableStream<Uint8Array>>;
|
|
27
31
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createEveMessageStreamRoutePath}from"#protocol/routes.js";import{ClientError}from"#client/client-error.js";import{createClientUrl}from"#client/url.js";import{isStreamDisconnectError,readNdjsonStream}from"#client/ndjson.js";const STREAM_OPEN_RETRYABLE_STATUS=new Set([404,409,425,500,502,503,504]);async function*
|
|
1
|
+
import{createEveMessageStreamRoutePath}from"#protocol/routes.js";import{ClientError}from"#client/client-error.js";import{createClientUrl}from"#client/url.js";import{isStreamDisconnectError,readNdjsonStream}from"#client/ndjson.js";const STREAM_OPEN_RETRY_MAX_DELAY_MS=5e3,STREAM_OPEN_RETRYABLE_STATUS=new Set([404,409,425,500,502,503,504]);async function*followStreamIterable(e){let t=e.startIndex,n=250,a=0,o=!0;for(;;){let s;try{s=await openStreamBody({...e,startIndex:t})}catch(t){if(e.signal?.aborted)return;throw t}let c=!1;try{for await(let e of readNdjsonStream(s))t+=1,c=!0,n=250,a=0,yield e}catch(e){if(!isStreamDisconnectError(e))throw e}if(e.signal?.aborted||e.startIndex<0||!c&&!o&&(a+=1)>=5||(o=!1,await sleep(n,e.signal),e.signal?.aborted))return;n=Math.min(n*2,4e3)}}async function openStreamBody(i){let s,c,l,u=250;for(let d=0;d<12;d+=1){let f=createClientUrl(i.host,createEveMessageStreamRoutePath(i.sessionId),i.startIndex===0?void 0:{startIndex:String(i.startIndex)}),p=await i.resolveHeaders(),m;try{m=await fetch(f,{headers:p,redirect:i.redirect,signal:i.signal??null})}catch(e){if(i.signal?.aborted||!isStreamDisconnectError(e)||d===11)throw e;await sleep(u,i.signal),u=Math.min(u*2,STREAM_OPEN_RETRY_MAX_DELAY_MS);continue}if(m.ok){if(!m.body)throw new ClientError(m.status,`Response body is null.`,m.headers);return m.body}if(s=m.status,c=await m.text(),l=m.headers,!STREAM_OPEN_RETRYABLE_STATUS.has(m.status))throw new ClientError(m.status,c,m.headers);d<11&&(await sleep(u,i.signal),u=Math.min(u*2,STREAM_OPEN_RETRY_MAX_DELAY_MS))}throw new ClientError(s??0,c??`Failed to open message stream.`,l)}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};
|
|
@@ -10,7 +10,8 @@ export declare function createInitialSessionState(): SessionState;
|
|
|
10
10
|
*
|
|
11
11
|
* When the boundary event is `session.waiting`, the session is preserved for
|
|
12
12
|
* the next message. For `session.completed` and `session.failed`, the session
|
|
13
|
-
* resets so the next call starts a new conversation.
|
|
13
|
+
* resets so the next call starts a new conversation. Without a boundary, the
|
|
14
|
+
* session stays resumable from its advanced cursor.
|
|
14
15
|
*/
|
|
15
16
|
export declare function advanceSession(input: {
|
|
16
17
|
readonly continuationToken?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isCurrentTurnBoundaryEvent}from"#protocol/message.js";function createInitialSessionState(){return{streamIndex:0}}function advanceSession(e){let t=findBoundaryEvent(e.events),n=e.session.streamIndex+e.events.length;return t?.type===`session.waiting`||e.preserveCompletedSessions===!0&&t?.type===`session.completed`?{continuationToken:t?.type===`session.waiting`?t.data.continuationToken:e.continuationToken??e.session.continuationToken,sessionId:e.sessionId,streamIndex:n}:createInitialSessionState()}function extractCompletedMessage(e){let t;for(let n of e)isFinalMessageCompleted(n)&&(t=n.data.message??void 0);return t}function deriveResultStatus(e){let t=findBoundaryEvent(e);return t?.type===`session.waiting`?`waiting`:t?.type===`session.failed`?`failed`:`completed`}function extractInputRequests(e){let t=[];for(let n of e)n.type===`input.requested`&&t.push(...n.data.requests);return t}function findBoundaryEvent(t){for(let n=t.length-1;n>=0;n--){let r=t[n];if(r!==void 0&&isCurrentTurnBoundaryEvent(r))return r}}function isFinalMessageCompleted(e){return e.type===`message.completed`&&e.data.finishReason!==`tool-calls`}export{advanceSession,createInitialSessionState,deriveResultStatus,extractCompletedMessage,extractInputRequests};
|
|
1
|
+
import{isCurrentTurnBoundaryEvent}from"#protocol/message.js";function createInitialSessionState(){return{streamIndex:0}}function advanceSession(e){let t=findBoundaryEvent(e.events),n=e.session.streamIndex+e.events.length;return t?.type===`session.waiting`||e.preserveCompletedSessions===!0&&t?.type===`session.completed`?{continuationToken:t?.type===`session.waiting`?t.data.continuationToken:e.continuationToken??e.session.continuationToken,sessionId:e.sessionId,streamIndex:n}:t===void 0?{continuationToken:e.continuationToken??e.session.continuationToken,sessionId:e.sessionId,streamIndex:n}:createInitialSessionState()}function extractCompletedMessage(e){let t;for(let n of e)isFinalMessageCompleted(n)&&(t=n.data.message??void 0);return t}function deriveResultStatus(e){let t=findBoundaryEvent(e);return t?.type===`session.waiting`?`waiting`:t?.type===`session.failed`?`failed`:`completed`}function extractInputRequests(e){let t=[];for(let n of e)n.type===`input.requested`&&t.push(...n.data.requests);return t}function findBoundaryEvent(t){for(let n=t.length-1;n>=0;n--){let r=t[n];if(r!==void 0&&isCurrentTurnBoundaryEvent(r))return r}}function isFinalMessageCompleted(e){return e.type===`message.completed`&&e.data.finishReason!==`tool-calls`}export{advanceSession,createInitialSessionState,deriveResultStatus,extractCompletedMessage,extractInputRequests};
|
|
@@ -7,7 +7,6 @@ import type { CancelSessionResult, ClientRedirectPolicy, SendTurnInput, SessionS
|
|
|
7
7
|
*/
|
|
8
8
|
interface SessionContext {
|
|
9
9
|
readonly host: string;
|
|
10
|
-
readonly maxReconnectAttempts: number;
|
|
11
10
|
readonly preserveCompletedSessions: boolean;
|
|
12
11
|
readonly redirect?: ClientRedirectPolicy;
|
|
13
12
|
resolveHeaders(perRequest?: Readonly<Record<string, string>>): Promise<Headers>;
|
|
@@ -56,10 +55,9 @@ export declare class ClientSession {
|
|
|
56
55
|
* Opens this session's event stream for the current session ID.
|
|
57
56
|
*
|
|
58
57
|
* Resumes from the session's stored stream cursor unless `options.startIndex`
|
|
59
|
-
* overrides it.
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* `maxReconnectAttempts`.
|
|
58
|
+
* overrides it. The stream reconnects from its cursor when the connection
|
|
59
|
+
* ends. Negative indices read relative to the current tail on one connection
|
|
60
|
+
* and do not advance the stored absolute cursor.
|
|
63
61
|
*
|
|
64
62
|
* @throws {Error} If the session has no session ID (no message has been sent
|
|
65
63
|
* yet).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EVE_CREATE_SESSION_ROUTE_PATH,createEveCancelTurnRoutePath,createEveContinueSessionRoutePath}from"#protocol/routes.js";import{ClientError}from"#client/client-error.js";import{advanceSession}from"#client/session-utils.js";import{createClientUrl}from"#client/url.js";import{MessageResponse}from"#client/message-response.js";import{
|
|
1
|
+
import{EVE_CREATE_SESSION_ROUTE_PATH,createEveCancelTurnRoutePath,createEveContinueSessionRoutePath}from"#protocol/routes.js";import{EVE_SESSION_ID_HEADER,isCurrentTurnBoundaryEvent}from"#protocol/message.js";import{ClientError}from"#client/client-error.js";import{advanceSession}from"#client/session-utils.js";import{createClientUrl}from"#client/url.js";import{MessageResponse}from"#client/message-response.js";import{CancelTurnResponseSchema}from"#protocol/cancel-turn.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);return this.#t===n&&(this.#t={...n,sessionId:i}),new MessageResponse({continuationToken:r,createStream:()=>this.#r(i,r,n,t),sessionId:i})}async cancel(e){let n=this.#t.sessionId;if(!n)throw Error(`Session has no session ID. Send a message first.`);let r=createClientUrl(this.#e.host,createEveCancelTurnRoutePath(n)),i=await this.#e.resolveHeaders();i.set(`content-type`,`application/json`);let o=await fetch(r,withRedirectPolicy({headers:i,method:`POST`,body:e?JSON.stringify(e):void 0},this.#e.redirect)),c=await o.text();if(!o.ok)throw new ClientError(o.status,c,o.headers);let u;try{u=JSON.parse(c)}catch{throw Error(`Cancel route returned invalid JSON (${o.status}).`)}let d=CancelTurnResponseSchema.safeParse(u);if(!d.success||d.data.sessionId!==n)throw Error(`Cancel route returned an invalid response (${o.status}).`);return{sessionId:d.data.sessionId,status:d.data.status}}stream(e){let t=this.#t.sessionId;if(!t)throw Error(`Session has no session ID. Send a message first.`);return this.#i(t,e)}async#n(t,i){let a=i.sessionId?createEveContinueSessionRoutePath(i.sessionId):EVE_CREATE_SESSION_ROUTE_PATH,o=createClientUrl(this.#e.host,a),c=await this.#e.resolveHeaders(t.headers);c.set(`content-type`,`application/json`);let l=createHandleMessageBody({input:t,outputSchema:serializeOutputSchema(t.outputSchema),session:i});if(l===null)throw Error(`Session.send requires a non-empty message, inputResponses, or both.`);let u=await postTurnWithRetry({body:JSON.stringify(l),headers:c,mustDeliver:(t.inputResponses?.length??0)>0,redirect:this.#e.redirect,signal:t.signal,url:o}),f=await u.json(),p=(typeof f.sessionId==`string`?f.sessionId:void 0)??u.headers.get(EVE_SESSION_ID_HEADER)?.trim()??i.sessionId;if(!p)throw Error(`Message route did not return a session id.`);return{continuationToken:typeof f.continuationToken==`string`?f.continuationToken:void 0,sessionId:p}}async*#r(e,t,n,r){let a=[];try{for await(let t of followStreamIterable({host:this.#e.host,resolveHeaders:()=>this.#e.resolveHeaders(r.headers),redirect:this.#e.redirect,sessionId:e,signal:r.signal,startIndex:n.sessionId===e?n.streamIndex:0}))if(a.push(t),yield t,isCurrentTurnBoundaryEvent(t))break}finally{this.#t=advanceSession({continuationToken:t,events:a,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 followStreamIterable({host:this.#e.host,resolveHeaders:()=>this.#e.resolveHeaders(),redirect:this.#e.redirect,sessionId:e,signal:t?.signal,startIndex:r}))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}))}}};async function postTurnWithRetry(e){let t=e.mustDeliver?10:1,n,r,i;for(let o=0;o<t;o+=1){let s=await fetch(e.url,{body:e.body,headers:e.headers,method:`POST`,redirect:e.redirect,signal:e.signal??null});if(s.ok)return s;if(n=s.status,r=await s.text(),i=s.headers,!isRetryableDeliveryFailure(s.status,r))throw new ClientError(s.status,r,s.headers);o<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};
|
|
@@ -67,12 +67,6 @@ export interface ClientOptions {
|
|
|
67
67
|
* redirect.
|
|
68
68
|
*/
|
|
69
69
|
readonly redirect?: ClientRedirectPolicy;
|
|
70
|
-
/**
|
|
71
|
-
* Maximum number of stream reconnection attempts per message turn.
|
|
72
|
-
*
|
|
73
|
-
* @default 3
|
|
74
|
-
*/
|
|
75
|
-
readonly maxReconnectAttempts?: number;
|
|
76
70
|
/**
|
|
77
71
|
* Keep a session's continuation token after a normal `session.completed`
|
|
78
72
|
* boundary.
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"jose": "6.2.3",
|
|
16
16
|
"jsonc-parser": "3.3.1",
|
|
17
17
|
"@types/json-schema": "7.0.15",
|
|
18
|
+
"marked": "17.0.6",
|
|
18
19
|
"@ai-sdk/mcp": "2.0.12",
|
|
19
20
|
"@ai-sdk/openai": "4.0.13",
|
|
20
21
|
"@opentelemetry/api": "1.9.1",
|
|
@@ -37,5 +38,5 @@
|
|
|
37
38
|
"zod": "4.4.3",
|
|
38
39
|
"zod-validation-error": "5.0.0"
|
|
39
40
|
},
|
|
40
|
-
"scriptHash": "
|
|
41
|
+
"scriptHash": "8da9abfc5a69e5b398d150c3d0988f4facdeec175e869134e17cea976897d5c4"
|
|
41
42
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# License information
|
|
2
|
+
|
|
3
|
+
## Contribution License Agreement
|
|
4
|
+
|
|
5
|
+
If you contribute code to this project, you are implicitly allowing your code
|
|
6
|
+
to be distributed under the MIT license. You are also implicitly verifying that
|
|
7
|
+
all code is your original work. `</legalese>`
|
|
8
|
+
|
|
9
|
+
## Marked
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2018+, MarkedJS (https://github.com/markedjs/)
|
|
12
|
+
Copyright (c) 2011-2018, Christopher Jeffrey (https://github.com/chjj/)
|
|
13
|
+
|
|
14
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
in the Software without restriction, including without limitation the rights
|
|
17
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
19
|
+
furnished to do so, subject to the following conditions:
|
|
20
|
+
|
|
21
|
+
The above copyright notice and this permission notice shall be included in
|
|
22
|
+
all copies or substantial portions of the Software.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
30
|
+
THE SOFTWARE.
|
|
31
|
+
|
|
32
|
+
## Markdown
|
|
33
|
+
|
|
34
|
+
Copyright © 2004, John Gruber
|
|
35
|
+
http://daringfireball.net/
|
|
36
|
+
All rights reserved.
|
|
37
|
+
|
|
38
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
39
|
+
|
|
40
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
41
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
42
|
+
* Neither the name “Markdown” nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
43
|
+
|
|
44
|
+
This software is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface Token {
|
|
2
|
+
readonly type: string;
|
|
3
|
+
readonly raw?: string;
|
|
4
|
+
readonly text?: string;
|
|
5
|
+
readonly depth?: number;
|
|
6
|
+
readonly lang?: string;
|
|
7
|
+
readonly ordered?: boolean;
|
|
8
|
+
readonly start?: number | string;
|
|
9
|
+
readonly checked?: boolean;
|
|
10
|
+
readonly href?: string;
|
|
11
|
+
readonly title?: string | null;
|
|
12
|
+
readonly tokens?: readonly Token[];
|
|
13
|
+
readonly items?: readonly Token[];
|
|
14
|
+
readonly header?: readonly TableCell[];
|
|
15
|
+
readonly rows?: readonly (readonly TableCell[])[];
|
|
16
|
+
readonly align?: readonly ("center" | "left" | "right" | null)[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface TableCell {
|
|
20
|
+
readonly text: string;
|
|
21
|
+
readonly tokens: readonly Token[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function lexer(markdown: string): readonly Token[];
|