eve 0.88.1 → 0.90.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -11
- package/dist/src/channel/adapter.d.ts +12 -3
- package/dist/src/channel/adapter.js +1 -1
- package/dist/src/channel/auth/definitions.d.ts +7 -20
- package/dist/src/channel/auth/definitions.js +1 -1
- package/dist/src/channel/auth/jwt-ecdsa.js +1 -1
- package/dist/src/channel/auth/jwt-hmac.js +1 -1
- package/dist/src/channel/auth/oidc.js +1 -1
- package/dist/src/channel/auth/result.d.ts +2 -3
- package/dist/src/channel/auth/result.js +1 -1
- package/dist/src/channel/channel-address.d.ts +1 -1
- package/dist/src/channel/channel-address.js +1 -1
- package/dist/src/channel/schedule.js +1 -1
- package/dist/src/chunks/{use-eve-agent-BExXjBv6.js → use-eve-agent-Bwloorf8.js} +96 -65
- package/dist/src/chunks/{use-eve-agent-C0KHCyb9.js → use-eve-agent-XCB0-tLX.js} +96 -65
- package/dist/src/cli/dev/environment.js +1 -1
- package/dist/src/cli/dev/tui/remote-connection-probe.js +1 -1
- package/dist/src/cli/dev/tui/remote-connection-types.d.ts +1 -0
- package/dist/src/cli/dev/tui/runner.js +2 -2
- package/dist/src/cli/dev/tui/status-line.d.ts +2 -2
- package/dist/src/cli/dev/tui/status-line.js +1 -1
- package/dist/src/client/agent-info-schema.d.ts +341 -326
- package/dist/src/client/agent-info-schema.js +1 -1
- package/dist/src/client/agent-info-types.d.ts +13 -10
- package/dist/src/client/client-error.d.ts +1 -1
- package/dist/src/client/client.d.ts +5 -3
- package/dist/src/client/client.js +1 -1
- package/dist/src/client/conversation.js +1 -1
- package/dist/src/client/transcript.d.ts +7 -4
- package/dist/src/client/transcript.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +1 -1
- package/dist/src/evals/target.js +1 -1
- package/dist/src/eve-channel/auth.d.ts +19 -0
- package/dist/src/eve-channel/auth.js +1 -0
- package/dist/src/eve-channel/index.d.ts +1 -0
- package/dist/src/eve-channel/index.js +1 -1
- package/dist/src/eve-channel/types.d.ts +23 -4
- package/dist/src/execution/catalog/connection-entry.js +1 -1
- package/dist/src/execution/coordination-dispatch-shared.js +1 -1
- package/dist/src/execution/dynamic-workflow/tool.js +1 -1
- package/dist/src/execution/tools/agent-router-workflow.js +1 -1
- package/dist/src/extensions/git/extension/extension.d.ts +12 -9
- package/dist/src/extensions/git/extension/extension.js +1 -1
- package/dist/src/extensions/git/extension/lib/gh-tool.d.ts +4 -12
- package/dist/src/extensions/git/extension/lib/gh-tool.js +1 -1
- package/dist/src/extensions/git/extension/lib/github-guidance.js +4 -4
- package/dist/src/extensions/git/extension/lib/github-shell-schema.d.ts +3 -5
- package/dist/src/extensions/git/extension/lib/github-shell-schema.js +1 -1
- package/dist/src/extensions/git/extension/lib/github-shell.d.ts +31 -21
- package/dist/src/extensions/git/extension/lib/github-shell.js +1 -1
- package/dist/src/extensions/git/extension/lib/signed-commit.js +1 -1
- package/dist/src/extensions/git/tools.d.ts +2 -10
- package/dist/src/internal/application/stamped-package-version.js +1 -1
- package/dist/src/internal/authored-module-graph.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.d.ts +2 -2
- package/dist/src/protocol/routes.d.ts +7 -1
- package/dist/src/protocol/routes.js +1 -1
- package/dist/src/protocol/session-events/families/delivery.d.ts +3 -2
- package/dist/src/public/channels/github/githubChannel.js +1 -1
- package/dist/src/public/channels/github/state.d.ts +7 -0
- package/dist/src/public/channels/github/state.js +1 -1
- package/dist/src/public/channels/mcp.js +1 -1
- package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
- package/dist/src/public/connections/index.d.ts +1 -1
- package/dist/src/public/definitions/channel.js +1 -1
- package/dist/src/public/definitions/connections/tool-call.d.ts +2 -2
- package/dist/src/reactions/frame.js +1 -1
- package/dist/src/runtime/channels/registry.d.ts +2 -2
- package/dist/src/runtime/channels/registry.js +1 -1
- package/dist/src/runtime/connections/approval-scope.d.ts +9 -0
- package/dist/src/runtime/connections/approval-scope.js +1 -0
- package/dist/src/runtime/connections/mcp-client.d.ts +1 -1
- package/dist/src/runtime/connections/mcp-client.js +1 -1
- package/dist/src/runtime/connections/provided-arguments.js +1 -1
- package/dist/src/runtime/subagents/workflow.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/shared/agent-info-access.d.ts +5 -0
- package/dist/src/shared/agent-info-access.js +1 -0
- package/dist/src/shared/connection-types.d.ts +21 -4
- package/dist/src/shared/session-history.d.ts +4 -2
- package/dist/src/shared/session-history.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tools/provided/ask-question-workflow.js +1 -1
- package/dist/src/tools/provided/sleep-workflow.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/channels/custom.mdx +2 -0
- package/docs/channels/eve.mdx +5 -3
- package/docs/code-extension.mdx +17 -60
- package/docs/concepts/execution-model-and-durability.mdx +1 -1
- package/docs/concepts/sessions-runs-and-streaming.md +9 -3
- package/docs/connections/overview.mdx +30 -0
- package/docs/evals/targets.mdx +2 -0
- package/docs/evals/tool-stubs.mdx +4 -4
- package/docs/guides/auth-and-route-protection.md +16 -3
- package/docs/guides/client/overview.mdx +6 -2
- package/docs/guides/client/streaming.mdx +1 -1
- package/docs/guides/frontend/use-eve-agent.mdx +1 -1
- package/docs/guides/prepare-for-1-0.md +23 -1
- package/docs/tools/human-in-the-loop.md +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getAdapterKind}from"#channel/adapter.js";import{SCHEDULE_ADAPTER}from"#channel/schedule.js";import{HTTP_ADAPTER}from"#channel/http.js";import{SUBAGENT_ADAPTER}from"#subagents/adapter.js";import{RuntimeRegistryError}from"#internal/runtime-registry.js";const FRAMEWORK_ADAPTERS=[HTTP_ADAPTER,SUBAGENT_ADAPTER,SCHEDULE_ADAPTER],ADAPTER_NON_EVENT_FIELDS=new Set([`kind`,`state`,`deliver`,`createAdapterContext`,`fetchFile`,`instrumentation`,`uploadPolicy`]);function createRuntimeAdapterRegistry(e){let t=new Map,n=new Set;for(let e of FRAMEWORK_ADAPTERS){let r=requireAdapterKind(e);n.add(r),t.set(r,e)}for(let r of e.channels){if(r.adapter===void 0)continue;let e={logicalPath:r.logicalPath,sourceId:r.sourceId},i=r.adapter,a=requireAdapterKind(i,e);if(n.has(a)){if(carriesAdapterBehavior(i))throw new RuntimeRegistryError(`adapter`,`Channel adapter kind "${a}" is reserved by the framework. A route-declared adapter may share a framework kind only as a pass-through with no \`deliver\` hook, event handlers, \`attachments\` resolver, or \`createAdapterContext\` factory. Use a custom \`kind\` to add channel-specific behavior.`,{...e,entryName:a});continue}t.set(a,i)}return{adaptersByKind:t}}function deserializeRuntimeAdapter(e,t){let n=t,r=e.adaptersByKind.get(n.kind);if(r===void 0)throw Error(`Unknown adapter kind: "${n.kind}". Declare the adapter on the route that starts this session so the runtime can rehydrate it.`);return{...r,state:n.state}}function requireAdapterKind(e,t){let n=getAdapterKind(e);if(typeof n!=`string`||n.length===0)throw new RuntimeRegistryError(`adapter`,"Adapters must declare a non-empty `kind` field.",{entryName:`unknown`,logicalPath:t?.logicalPath,sourceId:t?.sourceId});return n}function carriesAdapterBehavior(e){if(e.deliver!==void 0||e.fetchFile!==void 0||e.uploadPolicy!==void 0||e.createAdapterContext!==void 0)return!0;for(let[t,n]of Object.entries(e))if(!ADAPTER_NON_EVENT_FIELDS.has(t)&&typeof n==`function`)return!0;return!1}export{createRuntimeAdapterRegistry,deserializeRuntimeAdapter};
|
|
1
|
+
import{getAdapterKind,seedChannelState}from"#channel/adapter.js";import{SCHEDULE_ADAPTER}from"#channel/schedule.js";import{HTTP_ADAPTER}from"#channel/http.js";import{SUBAGENT_ADAPTER}from"#subagents/adapter.js";import{RuntimeRegistryError}from"#internal/runtime-registry.js";const FRAMEWORK_ADAPTERS=[HTTP_ADAPTER,SUBAGENT_ADAPTER,SCHEDULE_ADAPTER],ADAPTER_NON_EVENT_FIELDS=new Set([`kind`,`state`,`deliver`,`createAdapterContext`,`fetchFile`,`instrumentation`,`uploadPolicy`]);function createRuntimeAdapterRegistry(e){let t=new Map,n=new Set;for(let e of FRAMEWORK_ADAPTERS){let r=requireAdapterKind(e);n.add(r),t.set(r,e)}for(let r of e.channels){if(r.adapter===void 0)continue;let e={logicalPath:r.logicalPath,sourceId:r.sourceId},i=r.adapter,a=requireAdapterKind(i,e);if(n.has(a)){if(carriesAdapterBehavior(i))throw new RuntimeRegistryError(`adapter`,`Channel adapter kind "${a}" is reserved by the framework. A route-declared adapter may share a framework kind only as a pass-through with no \`deliver\` hook, event handlers, \`attachments\` resolver, or \`createAdapterContext\` factory. Use a custom \`kind\` to add channel-specific behavior.`,{...e,entryName:a});continue}t.set(a,i)}return{adaptersByKind:t}}function deserializeRuntimeAdapter(e,t){let n=t,r=e.adaptersByKind.get(n.kind);if(r===void 0)throw Error(`Unknown adapter kind: "${n.kind}". Declare the adapter on the route that starts this session so the runtime can rehydrate it.`);return{...r,state:seedChannelState(r.state,n.state)}}function requireAdapterKind(e,t){let n=getAdapterKind(e);if(typeof n!=`string`||n.length===0)throw new RuntimeRegistryError(`adapter`,"Adapters must declare a non-empty `kind` field.",{entryName:`unknown`,logicalPath:t?.logicalPath,sourceId:t?.sourceId});return n}function carriesAdapterBehavior(e){if(e.deliver!==void 0||e.fetchFile!==void 0||e.uploadPolicy!==void 0||e.createAdapterContext!==void 0)return!0;for(let[t,n]of Object.entries(e))if(!ADAPTER_NON_EVENT_FIELDS.has(t)&&typeof n==`function`)return!0;return!1}export{createRuntimeAdapterRegistry,deserializeRuntimeAdapter};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SessionAuthContext } from "#channel/types.js";
|
|
2
|
+
import type { ConnectionCallbackContext } from "#shared/connection-types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Runs one connection tool call so its `headers` and provided arguments see who approved it.
|
|
5
|
+
* One authorization context serves the whole call, so its inline providers share one scope.
|
|
6
|
+
*/
|
|
7
|
+
export declare function withConnectionApproval<T>(connectionName: string, responder: SessionAuthContext | undefined, fn: () => T): T;
|
|
8
|
+
/** The session context a connection's `headers` and provided-argument callbacks receive. */
|
|
9
|
+
export declare function buildConnectionCallbackContext(): ConnectionCallbackContext;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{contextScopeValue,withContextScopeValue}from"#context/container.js";import{buildCallbackContext}from"#context/build-callback-context.js";import{createAuthorizationContext}from"#runtime/authorization-context.js";const APPROVAL=Symbol(`eve.connectionApproval`);function withConnectionApproval(e,t,n){if(t===void 0)return n();let r=createAuthorizationContext({scope:e}),i={responder:{...t,getToken:(e,n)=>r.getResponderToken(t,e,n)}};return withContextScopeValue(APPROVAL,i,n)}function buildConnectionCallbackContext(){let e=contextScopeValue(APPROVAL);return{...buildCallbackContext(),...e!==void 0&&{approval:e}}}export{buildConnectionCallbackContext,withConnectionApproval};
|
|
@@ -80,7 +80,7 @@ export declare function passesToolFilter(names: readonly string[], filter: Reado
|
|
|
80
80
|
* flat `Record<string, string>` for the transport layer.
|
|
81
81
|
*
|
|
82
82
|
* Resolves dynamic `auth` and `headers` callbacks with the active
|
|
83
|
-
*
|
|
83
|
+
* session context, then resolves the {@link ConnectionPrincipal}
|
|
84
84
|
* and invokes `authorization.getToken({ principal })` to produce the bearer.
|
|
85
85
|
* `getToken` may throw {@link ConnectionAuthorizationRequiredError};
|
|
86
86
|
* callers catch it and it propagates as-is from here.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isObject}from"#shared/guards.js";import{
|
|
1
|
+
import{isObject}from"#shared/guards.js";import{ConnectionAuthorizationRequiredError,isConnectionAuthorizationRequiredError}from"#connections/errors.js";import{resolveConnectionAuthorization}from"#runtime/connections/resolve-authorization.js";import{evictScopedToken,resolveScopedToken}from"#runtime/connections/scoped-authorization.js";import{buildConnectionCallbackContext}from"#runtime/connections/approval-scope.js";import{FORWARDED_PRINCIPAL_HEADER,encodeForwardedPrincipalHeader}from"#internal/mcp/forwarded-principal-header.js";import{createMcpTraceFetch,withMcpToolCallSpan,withMcpToolsListSpan}from"#runtime/connections/mcp-tracing.js";import{createMCPClient}from"#compiled/@ai-sdk/mcp/index.js";import{ConnectionEventActions,isEventAction}from"#runtime/connections/events/actions.js";import{readTurnPrincipals}from"#context/turn-principals.js";import{omitProvidedArgumentsFromSchema,resolveProvidedArguments}from"#runtime/connections/provided-arguments.js";var McpUnauthorizedError=class extends Error{statusCode=401;anonymous;constructor(e){super(`MCP HTTP request failed (HTTP 401).`),this.anonymous=e}};async function checkAuthorizationResponse(e,t){if(e.status===401)throw await e.body?.cancel(),new McpUnauthorizedError(t);return e}var McpConnectionClient=class{#e;#t;#n;#r;#i;eventActions;constructor(e){if(this.#i=e,e.experimental_events!==void 0){let t=new ConnectionEventActions(e,e.experimental_events,()=>resolveHeaders(e),this.#s());this.eventActions={ownsName:isEventAction,recoveryMetadata:()=>t.recoveryMetadata(),metadata:async()=>{try{return await t.metadata()}catch(e){return await this.#d(e)}},execute:async(e,n,r)=>{try{return await t.execute(e,n,r)}catch(e){return await this.#d(e)}}}}}async connect(){if(this.#t!==void 0)return this.#t;if(this.#e!==void 0)return this.#e;this.#e=this.#a();try{return this.#t=await this.#e,this.#t}catch(e){throw this.#e=void 0,e}}async#a(){let{headers:e}=await resolveConnectionHeaders(this.#i,{anonymousWhenAuthorizationRequired:!0}),t=this.#i.url,n=createMcpTraceFetch({connectionName:this.#i.connectionName,fetcher:this.#o(Object.keys(e)),getProtocolVersion:()=>this.#t?.initializeResult?.protocolVersion});try{return await createMCPClient({protocolVersionDiscovery:this.#i.protocolVersionDiscovery,transport:{fetch:n,headers:e,type:`http`,url:t}})}catch(r){if(!isMcpHttpFallbackRetryableError(r))throw r;return await createMCPClient({protocolVersionDiscovery:this.#i.protocolVersionDiscovery,transport:{fetch:n,headers:e,type:`sse`,url:t}})}}#o(e){let t=this.#s()??globalThis.fetch;return async(n,r)=>{let resolve=()=>resolveConnectionHeaders(this.#i,{anonymousWhenAuthorizationRequired:!0}),send=async i=>{let a=new Headers(r?.headers);for(let t of e)a.delete(t);for(let[e,t]of Object.entries(i.headers))a.set(e,t);return await t(n,{...r,headers:a})},i=await resolve(),a=await send(i);if(a.status!==401||i.anonymous||this.#i.authorization===void 0||r?.signal?.aborted)return await checkAuthorizationResponse(a,i.anonymous);await this.#p();let o=await resolve();return o.anonymous?await checkAuthorizationResponse(a,!0):(await a.body?.cancel(),await checkAuthorizationResponse(await send(o),o.anonymous))}}#s(){if(this.#i.forwardPrincipal!==!0)return;let e=this.#i.connectionName;return async(t,n)=>{let r=readTurnPrincipals();if(r===void 0)return await globalThis.fetch(t,n);let i=new Headers(n?.headers);return i.set(FORWARDED_PRINCIPAL_HEADER,encodeForwardedPrincipalHeader(r,e)),await globalThis.fetch(t,{...n,headers:i,redirect:`error`})}}async getToolMetadata(){return(await this.#c()).metadata}async executeTool(e,t,n){let r;try{let{tools:i}=await this.#c(),a=i[e];if(a?.execute===void 0)throw Error(`Tool "${e}" not found in connection "${this.#i.connectionName}".`);let o=a.execute,s=await resolveProvidedArguments({args:t,callId:n.callId,connection:this.#i,toolName:e});r=await withMcpToolCallSpan({arguments:t,connectionName:this.#i.connectionName,execute:async()=>await o(s,{abortSignal:n.abortSignal}),protocolVersion:this.#t?.initializeResult?.protocolVersion,toolName:e})}catch(e){return await this.#d(e)}return isMcpAuthChallengeResult(r)?await this.#f(`the server asked for sign-in to call "${e}"`):r}async#c(){if(this.#r!==void 0)return this.#r;if(this.#n!==void 0)return this.#n;this.#n=this.#l();try{return this.#r=await this.#n,this.#r}catch(e){throw this.#n=void 0,e}}async#l(){try{return await this.#u()}catch(e){return await this.#d(e)}}async#u(){let e=await this.connect(),t=await withMcpToolsListSpan({connectionName:this.#i.connectionName,execute:()=>e.listTools(),protocolVersion:e.initializeResult?.protocolVersion}),n=Object.keys(this.#i.toolCall?.providedArguments??{}),r=t.tools.map(e=>({...e,inputSchema:omitProvidedArgumentsFromSchema(e.inputSchema,n)})),i=e.toolsFromDefinitions({tools:r});return{metadata:r.map(e=>({annotations:e.annotations,description:e.description??``,inputSchema:e.inputSchema??{},name:e.name,outputSchema:`outputSchema`in e&&e.outputSchema!==void 0?e.outputSchema:void 0})),tools:i}}async close(){this.#t!==void 0&&(await this.#t.close(),this.#t=void 0),this.#e=void 0,this.#n=void 0,this.#r=void 0}async#d(e){if(!isMcpAuthRequiredError(e))throw e;let t=[...walkErrorChain(e)].find(e=>e instanceof McpUnauthorizedError)?.anonymous??(await resolveConnectionHeaders(this.#i,{anonymousWhenAuthorizationRequired:!0})).anonymous;return await this.#f(t?`the server requires sign-in`:`the server rejected the token`,t)}async#f(e,t){throw t??=(await resolveConnectionHeaders(this.#i,{anonymousWhenAuthorizationRequired:!0})).anonymous,t||await this.#p(),await this.close(),new ConnectionAuthorizationRequiredError(this.#i.connectionName,{message:`Connection "${this.#i.connectionName}" requires authorization (${e}).`})}async#p(){let e=await resolveConnectionAuthorization(this.#i);e!==void 0&&await evictScopedToken({authorization:e,connection:{url:this.#i.url},instanceId:this.#i.instanceId,scope:this.#i.connectionName})}};function isMcpAuthRequiredError(e){return readHttpStatus(e)===401}const MCP_WWW_AUTHENTICATE_META_KEY=`mcp/www_authenticate`;function isMcpAuthChallengeResult(e){if(!isObject(e)||e.isError!==!0||!isObject(e._meta))return!1;let t=e._meta[MCP_WWW_AUTHENTICATE_META_KEY];return(typeof t==`string`||Array.isArray(t))&&t.length>0}function isMcpHttpFallbackRetryableError(e){let t=readHttpStatus(e);return t===400||t===404||t===405}function readHttpStatus(e){for(let t of walkErrorChain(e)){if(!isObject(t))continue;let e=readStatusField(t);if(e!==void 0)return e;let n=t.response;if(isObject(n)){let e=readStatusField(n);if(e!==void 0)return e}if(typeof t.message==`string`){let e=/\bHTTP\s+(\d{3})\b/u.exec(t.message);if(e?.[1]!==void 0)return Number(e[1])}}}function readStatusField(e){if(typeof e.status==`number`)return e.status;if(typeof e.statusCode==`number`)return e.statusCode}function*walkErrorChain(e){let t=e,n=new Set;for(;t!=null&&!n.has(t);){if(n.add(t),yield t,!isObject(t)||!(`cause`in t))return;t=t.cause}}function passesToolFilter(e,t){return t===void 0?!0:`allow`in t?e.some(e=>t.allow.includes(e)):!e.some(e=>t.block.includes(e))}async function resolveHeaders(e){let{headers:t}=await resolveConnectionHeaders(e,{anonymousWhenAuthorizationRequired:!1});return t}async function resolveConnectionHeaders(e,t){let n={},r=!1,i=await resolveConnectionAuthorization(e);if(i!==void 0)try{n.Authorization=`Bearer ${(await resolveToken(e,i)).token}`}catch(e){if(!t.anonymousWhenAuthorizationRequired||!isConnectionAuthorizationRequiredError(e))throw e;r=!0}if(e.headers!==void 0){let t,r=await resolveHeadersDefinition(e.headers,()=>t??=buildConnectionCallbackContext());for(let[t,a]of Object.entries(r)){if(i!==void 0&&t.toLowerCase()===`authorization`)throw Error(`Connection "${e.connectionName}" headers must not include an "Authorization" key when "authorization" is also provided.`);n[t]=a}}return{anonymous:r,headers:n}}async function resolveToken(e,t){return await resolveScopedToken({authorization:t,connection:{url:e.url},instanceId:e.instanceId,scope:e.connectionName})}async function resolveHeadersDefinition(e,t){if(typeof e==`function`)return{...await e(t())};let n={},r=Object.entries(e);for(let[e,i]of r)n[e]=await resolveHeaderValue(i,t);return n}async function resolveHeaderValue(e,t){return typeof e==`function`?await e(t()):await e}export{MCP_WWW_AUTHENTICATE_META_KEY,McpConnectionClient,isMcpAuthChallengeResult,isMcpAuthRequiredError,passesToolFilter,readHttpStatus,resolveHeaders};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isObject}from"#shared/guards.js";import{parseJsonValue}from"#shared/json.js";import{
|
|
1
|
+
import{isObject}from"#shared/guards.js";import{parseJsonValue}from"#shared/json.js";import{buildConnectionCallbackContext}from"#runtime/connections/approval-scope.js";async function resolveProvidedArguments(e){if(!isObject(e.args))throw Error(`Tool "${e.toolName}" in connection "${e.connection.connectionName}" expected object arguments.`);let t=e.connection.toolCall?.providedArguments;if(t===void 0||Object.keys(t).length===0)return e.args;let n,getContext=()=>n??={...buildConnectionCallbackContext(),callId:e.callId,toolName:e.toolName},r={};for(let[n,i]of Object.entries(t)){let t=typeof i==`function`?await i(getContext()):await i;try{r[n]=parseJsonValue(t)}catch{throw Error(`Connection "${e.connection.connectionName}" provided argument "${n}" must resolve to a JSON-serializable value.`)}}return{...e.args,...r}}function omitProvidedArgumentsFromSchema(e,t){if(t.length===0)return e;let n=new Set(t),r={...e};return isObject(e.properties)&&(r.properties=Object.fromEntries(Object.entries(e.properties).filter(([e])=>!n.has(e)))),Array.isArray(e.required)&&(r.required=e.required.filter(e=>typeof e!=`string`||!n.has(e))),r}export{omitProvidedArgumentsFromSchema,resolveProvidedArguments};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
async function agentToolServeWorkflow(e,t){"use workflow";let n=t.agent(t.toolName),r=sendToAgent(n,await e()),i=e();for(;;){let a=await nextCallOrResult(i,r);if(a.kind===`call`){r=await forwardCall(n,r,a.call),i=e();continue}if(!r.signal.aborted){if(a.result.status===`failed`)throw Error(`The agent's turn failed: ${a.result.error.message}\nThis task has ended; to retry, call ${t.toolName} without taskId.`);let o=e();if(o!==i){r=sendToAgent(n,await i),i=o;continue}t.reply(a.result.reply??``)}r=sendToAgent(n,await i),i=e()}}async function agentWithModelServeWorkflow(e,t){"use workflow";let n=await e(),r=n.input.model.trim();if(r===``)throw TypeError(`agent model must not be empty.`);let i=t.agent(`agent`,{model:r}),a=sendToModelAgent(i,n,r),o=e();for(;;){let n=await nextModelCallOrResult(o,a);if(n.kind===`call`){a=await forwardModelCall(i,a,n.call,r),o=e();continue}if(!a.signal.aborted){if(n.result.status===`failed`)throw Error(`The agent's turn failed: ${n.result.error.message}\nThis task has ended; to retry, call ${t.toolName} without taskId.`);let s=e();if(s!==o){a=sendToModelAgent(i,await o,r),o=s;continue}t.reply(n.result.reply??``)}a=sendToModelAgent(i,await o,r),o=e()}}function sendToAgent(e,t){return{result:e.send(t.input.message,{signal:t.abortSignal}).then(e=>e.result()),signal:t.abortSignal}}function sendToModelAgent(e,t,n){if(t.input.model!==n)throw Error(`An agent task keeps the model it started with. This task has ended; start a new task to use another model.`);return{result:e.send(t.input.message,{signal:t.abortSignal}).then(e=>e.result()),signal:t.abortSignal}}async function nextCallOrResult(e,t){return await Promise.race([t.result.then(e=>({kind:`result`,result:e})),e.then(e=>({call:e,kind:`call`}))])}async function nextModelCallOrResult(e,t){return await Promise.race([t.result.then(e=>({kind:`result`,result:e})),e.then(e=>({call:e,kind:`call`}))])}async function forwardCall(e,t,n){return t.signal.aborted&&await t.result.catch(()=>void 0),sendToAgent(e,n)}async function forwardModelCall(e,t,n,r){return t.signal.aborted&&await t.result.catch(()=>void 0),sendToModelAgent(e,n,r)}agentToolServeWorkflow.workflowId=`workflow//eve//agentToolServeWorkflow`,agentWithModelServeWorkflow.workflowId=`workflow//eve@0.
|
|
1
|
+
async function agentToolServeWorkflow(e,t){"use workflow";let n=t.agent(t.toolName),r=sendToAgent(n,await e()),i=e();for(;;){let a=await nextCallOrResult(i,r);if(a.kind===`call`){r=await forwardCall(n,r,a.call),i=e();continue}if(!r.signal.aborted){if(a.result.status===`failed`)throw Error(`The agent's turn failed: ${a.result.error.message}\nThis task has ended; to retry, call ${t.toolName} without taskId.`);let o=e();if(o!==i){r=sendToAgent(n,await i),i=o;continue}t.reply(a.result.reply??``)}r=sendToAgent(n,await i),i=e()}}async function agentWithModelServeWorkflow(e,t){"use workflow";let n=await e(),r=n.input.model.trim();if(r===``)throw TypeError(`agent model must not be empty.`);let i=t.agent(`agent`,{model:r}),a=sendToModelAgent(i,n,r),o=e();for(;;){let n=await nextModelCallOrResult(o,a);if(n.kind===`call`){a=await forwardModelCall(i,a,n.call,r),o=e();continue}if(!a.signal.aborted){if(n.result.status===`failed`)throw Error(`The agent's turn failed: ${n.result.error.message}\nThis task has ended; to retry, call ${t.toolName} without taskId.`);let s=e();if(s!==o){a=sendToModelAgent(i,await o,r),o=s;continue}t.reply(n.result.reply??``)}a=sendToModelAgent(i,await o,r),o=e()}}function sendToAgent(e,t){return{result:e.send(t.input.message,{signal:t.abortSignal}).then(e=>e.result()),signal:t.abortSignal}}function sendToModelAgent(e,t,n){if(t.input.model!==n)throw Error(`An agent task keeps the model it started with. This task has ended; start a new task to use another model.`);return{result:e.send(t.input.message,{signal:t.abortSignal}).then(e=>e.result()),signal:t.abortSignal}}async function nextCallOrResult(e,t){return await Promise.race([t.result.then(e=>({kind:`result`,result:e})),e.then(e=>({call:e,kind:`call`}))])}async function nextModelCallOrResult(e,t){return await Promise.race([t.result.then(e=>({kind:`result`,result:e})),e.then(e=>({call:e,kind:`call`}))])}async function forwardCall(e,t,n){return t.signal.aborted&&await t.result.catch(()=>void 0),sendToAgent(e,n)}async function forwardModelCall(e,t,n,r){return t.signal.aborted&&await t.result.catch(()=>void 0),sendToModelAgent(e,n,r)}agentToolServeWorkflow.workflowId=`workflow//eve//agentToolServeWorkflow`,agentWithModelServeWorkflow.workflowId=`workflow//eve@0.90.0//agentWithModelServeWorkflow`;export{agentToolServeWorkflow,agentWithModelServeWorkflow};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{pinnedNodeEngineMajor}from"../../node-engine.js";import{parseChatGptModelSelection}from"../../../shared/chatgpt-model.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{pathExists,writeTextFile}from"../files.js";import{blockingCreateInPlaceEntries}from"../create-in-place.js";import{DEFAULT_CONNECT_PACKAGE_VERSION,resolveVersionToken}from"../version-tokens.js";import{applyPackageManagerWorkspaceConfiguration,isPackageManagerWorkspaceMember,patchWorkspaceRootPackageJson}from"../workspace-root.js";import{WEB_CHANNEL_TEMPLATES}from"./web-template.js";import{AGENT_INSTRUCTIONS_TEMPLATE}from"./instructions-template.js";import{SCAFFOLDED_AGENT_PATHS}from"./agent-paths.js";import{mkdir,readdir,stat}from"node:fs/promises";import{basename,join,resolve}from"node:path";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,DEFAULT_AI_PACKAGE_VERSION=`^7.0.137`,DEFAULT_ZOD_PACKAGE_VERSION=`4.5.4`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.
|
|
1
|
+
import{pinnedNodeEngineMajor}from"../../node-engine.js";import{parseChatGptModelSelection}from"../../../shared/chatgpt-model.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{pathExists,writeTextFile}from"../files.js";import{blockingCreateInPlaceEntries}from"../create-in-place.js";import{DEFAULT_CONNECT_PACKAGE_VERSION,resolveVersionToken}from"../version-tokens.js";import{applyPackageManagerWorkspaceConfiguration,isPackageManagerWorkspaceMember,patchWorkspaceRootPackageJson}from"../workspace-root.js";import{WEB_CHANNEL_TEMPLATES}from"./web-template.js";import{AGENT_INSTRUCTIONS_TEMPLATE}from"./instructions-template.js";import{SCAFFOLDED_AGENT_PATHS}from"./agent-paths.js";import{mkdir,readdir,stat}from"node:fs/promises";import{basename,join,resolve}from"node:path";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,DEFAULT_AI_PACKAGE_VERSION=`^7.0.137`,DEFAULT_ZOD_PACKAGE_VERSION=`4.5.4`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.90.0`,nodeEngine:`>=24`};function resolveEvePackageContract(e=DEFAULT_EVE_PACKAGE_CONTRACT){return{version:resolveVersionToken(`evePackage.version`,e.version),nodeEngine:resolveVersionToken(`evePackage.nodeEngine`,e.nodeEngine)}}function modelProviderSlug(e){let t=(e.split(`/`)[0]??``).replaceAll(/[^A-Za-z0-9._-]/gu,``);return t.length>0?t:`anthropic`}function byokProviderEnvVar(e){let t=modelProviderSlug(e).toUpperCase().replaceAll(/[^A-Z0-9]/gu,`_`);return`${/^[0-9]/.test(t)?`_`:``}${t}_API_KEY`}function agentTemplateFiles(e,t){return{[SCAFFOLDED_AGENT_PATHS.config]:renderAgentTemplate(e,t),[SCAFFOLDED_AGENT_PATHS.channel]:WEB_CHANNEL_TEMPLATES.default,[SCAFFOLDED_AGENT_PATHS.instructions]:AGENT_INSTRUCTIONS_TEMPLATE}}function renderAgentTemplate(e,t){let n=parseChatGptModelSelection(e);return n===void 0?BASE_AGENT_TEMPLATE.replaceAll(`__EVE_INIT_MODEL__`,e).replaceAll(`__EVE_INIT_REASONING__`,reasoningTemplateLine(t)):`import { defineAgent } from "eve";\nimport { chatgpt } from "eve/models/openai";\n\nexport default defineAgent({\n model: chatgpt(${JSON.stringify(n)}),\n${reasoningTemplateLine(t)}});\n`}function reasoningTemplateLine(e){return e===void 0||e===`provider-default`?``:` reasoning: "${e}",\n`}function renderTemplate(e,t){return e===BASE_AGENT_TEMPLATE&&parseChatGptModelSelection(t.model)!==void 0?renderAgentTemplate(t.model,t.reasoning):e.replaceAll(`__EVE_INIT_APP_NAME__`,t.appName).replaceAll(`__EVE_INIT_MODEL__`,t.model).replaceAll(`__EVE_INIT_REASONING__`,reasoningTemplateLine(t.reasoning)).replaceAll(`__EVE_INIT_BYOK_PROVIDER__`,modelProviderSlug(t.model)).replaceAll(`__EVE_INIT_BYOK_ENV_VAR__`,byokProviderEnvVar(t.model)).replaceAll(`__EVE_INIT_PACKAGE_VERSION__`,formatEveDependencySpecifier(t.eveVersion)).replaceAll(`__EVE_INIT_AI_SDK_VERSION__`,t.aiPackageVersion).replaceAll(`__EVE_INIT_CONNECT_VERSION__`,t.connectPackageVersion).replaceAll(`__EVE_INIT_ZOD_VERSION__`,t.zodPackageVersion).replaceAll(`__EVE_INIT_TYPESCRIPT_VERSION__`,t.typescriptPackageVersion).replaceAll(`__EVE_INIT_TYPES_NODE_VERSION__`,t.nodeTypesVersion).replaceAll(`__EVE_INIT_NODE_ENGINE__`,t.nodeEngine)}function formatEveDependencySpecifier(e){return/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z-.]+)?$/.test(e)?`^${e}`:e}const BASE_AGENT_TEMPLATE=`import { defineAgent } from "eve";
|
|
2
2
|
|
|
3
3
|
export default defineAgent({
|
|
4
4
|
model: "__EVE_INIT_MODEL__",
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ClientError } from "#client/client-error.js";
|
|
2
|
+
/** Whether a client error is the info route refusing the caller's credential. */
|
|
3
|
+
export declare function isAgentInfoForbidden(error: unknown): error is ClientError;
|
|
4
|
+
/** Says which credential `GET /eve/v1/info` accepts, for callers it refused. */
|
|
5
|
+
export declare function formatAgentInfoForbiddenMessage(target: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{AGENT_INFO_FORBIDDEN_CODE,AGENT_INFO_FORBIDDEN_MESSAGE}from"#protocol/routes.js";import{ClientError}from"#client/client-error.js";function isAgentInfoForbidden(e){return e instanceof ClientError&&e.status===403&&e.code===AGENT_INFO_FORBIDDEN_CODE}function formatAgentInfoForbiddenMessage(e){return`${e} refused GET /eve/v1/info. ${AGENT_INFO_FORBIDDEN_MESSAGE}`}export{formatAgentInfoForbiddenMessage,isAgentInfoForbidden};
|
|
@@ -7,6 +7,7 @@ import type { ConnectionEventsBackend } from "#shared/connection-events.js";
|
|
|
7
7
|
*/
|
|
8
8
|
import type { ConnectionAuthorizationChallenge } from "#connections/errors.js";
|
|
9
9
|
import type { SessionContext } from "#context/session-context.js";
|
|
10
|
+
import type { ApprovedCall } from "#tools/definition.js";
|
|
10
11
|
import type { JsonValue } from "#shared/json.js";
|
|
11
12
|
/**
|
|
12
13
|
* Credential returned by a connection's `getToken` or
|
|
@@ -37,18 +38,34 @@ export interface TokenResult {
|
|
|
37
38
|
* client implementation. Never authored directly.
|
|
38
39
|
*/
|
|
39
40
|
export type ConnectionProtocol = "mcp" | "openapi";
|
|
41
|
+
/**
|
|
42
|
+
* Context passed to a connection's `headers` and `toolCall.providedArguments`
|
|
43
|
+
* callbacks.
|
|
44
|
+
*/
|
|
45
|
+
export interface ConnectionCallbackContext extends SessionContext {
|
|
46
|
+
/**
|
|
47
|
+
* Who approved the tool call these values are for. Present only while a
|
|
48
|
+
* connection tool call runs after a person approved it. The call still runs
|
|
49
|
+
* as the requester, `session.auth.current`, and its `auth` token is still
|
|
50
|
+
* the requester's. `approval.responder.getToken(provider)` resolves the
|
|
51
|
+
* approver's token as it does in a `defineTool` tool, so a callback can send
|
|
52
|
+
* the approver's credentials where the server should act for them.
|
|
53
|
+
*/
|
|
54
|
+
readonly approval?: ApprovedCall;
|
|
55
|
+
}
|
|
40
56
|
/** A single header value, supporting static strings and per-caller resolution. */
|
|
41
|
-
export type HeaderValue = string | Promise<string> | ((ctx:
|
|
57
|
+
export type HeaderValue = string | Promise<string> | ((ctx: ConnectionCallbackContext) => string | Promise<string>);
|
|
42
58
|
/**
|
|
43
59
|
* Arbitrary HTTP headers sent with every request to a connection server.
|
|
44
60
|
*
|
|
45
61
|
* Static form: key-value pairs where each value may be a string, Promise,
|
|
46
62
|
* or callback. Function form: a callback returning the full headers map,
|
|
47
63
|
* useful when multiple headers must be resolved together. Header callbacks
|
|
48
|
-
* receive the active {@link
|
|
49
|
-
* metadata can be selected from the current caller
|
|
64
|
+
* receive the active {@link ConnectionCallbackContext}, so credentials and
|
|
65
|
+
* routing metadata can be selected from the current caller, or from the
|
|
66
|
+
* approver of an approved tool call.
|
|
50
67
|
*/
|
|
51
|
-
export type HeadersDefinition = Readonly<Record<string, HeaderValue>> | ((ctx:
|
|
68
|
+
export type HeadersDefinition = Readonly<Record<string, HeaderValue>> | ((ctx: ConnectionCallbackContext) => Readonly<Record<string, string>> | Promise<Readonly<Record<string, string>>>);
|
|
52
69
|
/**
|
|
53
70
|
* Client-side tool filter applied after `listTools()`.
|
|
54
71
|
*
|
|
@@ -16,7 +16,9 @@ export declare class InvalidSessionHistoryError extends Error {
|
|
|
16
16
|
readonly name = "InvalidSessionHistoryError";
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
* Validates `history` at the send boundary and returns a normalized copy
|
|
20
|
-
*
|
|
19
|
+
* Validates `history` at the send boundary and returns a normalized copy.
|
|
20
|
+
* Returns `undefined` when `history` is omitted. An entry with a field outside
|
|
21
|
+
* the contract is rejected, not dropped, so no caller already sends a field a
|
|
22
|
+
* later release starts to read.
|
|
21
23
|
*/
|
|
22
24
|
export declare function validateSessionHistory(history: unknown): readonly SessionHistoryMessage[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isObject}from"#shared/guards.js";var InvalidSessionHistoryError=class extends Error{name=`InvalidSessionHistoryError`};function validateSessionHistory(e){if(e===void 0)return;if(!Array.isArray(e))throw new InvalidSessionHistoryError(`history must be an array of messages.`);let t=new Set;return e.map((e,n)=>{let r=`history[${n}]`;if(!isObject(e))throw new InvalidSessionHistoryError(`${r} must be an object.`);let{id:i,role:a,text:o}=e;if(a!==`user`&&a!==`assistant`)throw new InvalidSessionHistoryError(`${r}.role must be "user" or "assistant".`);if(typeof o!=`string`||o.trim().length===0)throw new InvalidSessionHistoryError(`${r}.text must be a non-empty string.`);let s={role:a,text:o};if(i===void 0)return s;if(typeof i!=`string`||i.length===0)throw new InvalidSessionHistoryError(`${r}.id must be a non-empty string.`);if(t.has(i))throw new InvalidSessionHistoryError(`${r}.id "${i}" is not unique.`);return t.add(i),{...s,id:i}})}export{InvalidSessionHistoryError,validateSessionHistory};
|
|
1
|
+
import{isObject}from"#shared/guards.js";var InvalidSessionHistoryError=class extends Error{name=`InvalidSessionHistoryError`};const HISTORY_FIELDS=[`id`,`role`,`text`];function validateSessionHistory(e){if(e===void 0)return;if(!Array.isArray(e))throw new InvalidSessionHistoryError(`history must be an array of messages.`);let t=new Set;return e.map((e,n)=>{let r=`history[${n}]`;if(!isObject(e))throw new InvalidSessionHistoryError(`${r} must be an object.`);rejectUnknownFields(e,r);let{id:i,role:a,text:o}=e;if(a!==`user`&&a!==`assistant`)throw new InvalidSessionHistoryError(`${r}.role must be "user" or "assistant".`);if(typeof o!=`string`||o.trim().length===0)throw new InvalidSessionHistoryError(`${r}.text must be a non-empty string.`);let s={role:a,text:o};if(i===void 0)return s;if(typeof i!=`string`||i.length===0)throw new InvalidSessionHistoryError(`${r}.id must be a non-empty string.`);if(t.has(i))throw new InvalidSessionHistoryError(`${r}.id "${i}" is not unique.`);return t.add(i),{...s,id:i}})}function rejectUnknownFields(e,t){let n=Object.keys(e).filter(t=>!HISTORY_FIELDS.includes(t)&&e[t]!==void 0);if(n.length===0)return;let r=n.slice(0,8).sort().map(e=>JSON.stringify(e.length>128?`${e.slice(0,128)}…`:e)),i=n.length>8?` (and more)`:``;throw new InvalidSessionHistoryError(`${t} has unknown field${n.length===1?``:`s`} ${r.join(`, `)}${i}. Accepted fields: ${HISTORY_FIELDS.join(`, `)}.`)}export{InvalidSessionHistoryError,validateSessionHistory};
|
package/dist/src/svelte/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
async function executeAskQuestionTool(e,t){"use workflow";return toAskQuestionOutput(await t.ask(toAskQuestionRequest(e)))}function toAskQuestionRequest(e){let t=e.options?.map(e=>({description:e.description,id:e.label,label:e.label}));return{allowFreeform:!0,display:t===void 0?`text`:`select`,prompt:e.question,...t!==void 0&&{options:t}}}function toAskQuestionOutput(e){switch(e.status){case`answered`:return{answer:e.optionId??e.text??``,status:`answered`};case`cancelled`:return{interrupted:!0};case`unavailable`:return{status:`unavailable`}}}executeAskQuestionTool.workflowId=`workflow//eve@0.
|
|
1
|
+
async function executeAskQuestionTool(e,t){"use workflow";return toAskQuestionOutput(await t.ask(toAskQuestionRequest(e)))}function toAskQuestionRequest(e){let t=e.options?.map(e=>({description:e.description,id:e.label,label:e.label}));return{allowFreeform:!0,display:t===void 0?`text`:`select`,prompt:e.question,...t!==void 0&&{options:t}}}function toAskQuestionOutput(e){switch(e.status){case`answered`:return{answer:e.optionId??e.text??``,status:`answered`};case`cancelled`:return{interrupted:!0};case`unavailable`:return{status:`unavailable`}}}executeAskQuestionTool.workflowId=`workflow//eve@0.90.0//executeAskQuestionTool`;export{executeAskQuestionTool,toAskQuestionOutput,toAskQuestionRequest};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{sleep}from"#compiled/@workflow/core/index.js";async function executeSleepTool(e,t){"use workflow";if(t.abortSignal.aborted)return{interrupted:!0};let n=new Promise(e=>t.abortSignal.addEventListener(`abort`,()=>e(`interrupted`),{once:!0})),r=sleep(Math.ceil(e.seconds*1e3)).then(()=>`elapsed`);return await Promise.race([r,n])===`elapsed`?{waitedSeconds:e.seconds}:{interrupted:!0}}executeSleepTool.workflowId=`workflow//eve@0.
|
|
1
|
+
import{sleep}from"#compiled/@workflow/core/index.js";async function executeSleepTool(e,t){"use workflow";if(t.abortSignal.aborted)return{interrupted:!0};let n=new Promise(e=>t.abortSignal.addEventListener(`abort`,()=>e(`interrupted`),{once:!0})),r=sleep(Math.ceil(e.seconds*1e3)).then(()=>`elapsed`);return await Promise.race([r,n])===`elapsed`?{waitedSeconds:e.seconds}:{interrupted:!0}}executeSleepTool.workflowId=`workflow//eve@0.90.0//executeSleepTool`;export{executeSleepTool};
|
package/dist/src/vue/index.js
CHANGED
package/docs/channels/custom.mdx
CHANGED
|
@@ -200,6 +200,8 @@ A sent delivery can interrupt generation before your `deliver` hook runs. If the
|
|
|
200
200
|
|
|
201
201
|
Every `send()` and `respond()` delivery passes its `state` option to your channel's `deliver(payload, channel)` hook as `payload.state`, including deliveries to an existing session. Use it for values that belong to one delivery, such as the author of a message. The hook decides what to merge into `channel.state`; eve seeds `channel.state` from `state` only when `send()` creates the session.
|
|
202
202
|
|
|
203
|
+
The `state` you pass to `defineChannel(...)` is the seed for every session's `channel.state`, and must be plain JSON-like data. At each step boundary, eve restores any top-level seed field missing from the session's state, so a field you add to the seed in a later deploy holds its seed value in older sessions too, including in `context(state)` and event handlers. A field you `delete` is restored the same way; to clear one, set it to `null` (or `undefined`). eve doesn't merge nested objects: a stored object replaces the seed's object whole.
|
|
204
|
+
|
|
203
205
|
The payload is `ChannelDelivery<TState>` from `eve/channels`: `message`, `answers`, `context`, `outputSchema`, and `state?: Partial<TState>`. Return a replacement with `message`, `answers`, `context`, or `outputSchema` to change the delivery, or return nothing to keep it unchanged. Change durable state through `channel.state`, not a `state` field on the replacement. To ignore a delivery, return `{}`. The hook does not return a harness input or accept arbitrary extra fields.
|
|
204
206
|
|
|
205
207
|
```ts
|
package/docs/channels/eve.mdx
CHANGED
|
@@ -108,7 +108,7 @@ has completed. Idle preparation preserves the session ID, stream, history, and e
|
|
|
108
108
|
active work is not interrupted. See the [frontend guide](../guides/frontend/use-eve-agent#prewarming)
|
|
109
109
|
for client usage and deployment routing.
|
|
110
110
|
|
|
111
|
-
`GET /eve/v1/health` is public and returns `{ ok: true, status: "ready", workflowId: string }`. `GET /eve/v1/info` uses the channel's auth policy and returns agent-info version
|
|
111
|
+
`GET /eve/v1/health` is public and returns `{ ok: true, status: "ready", workflowId: string }`. `GET /eve/v1/info` uses the channel's auth policy, then serves only operator principals: `service` and `runtime` principals and, when the channel's auth includes `localDev()`, any caller it admits on a development server. Other callers the channel admits, such as `user` or `anonymous` principals, get `403` with code `info_forbidden`, because the payload includes authored instructions, skill and schedule markdown, and server paths. The route returns agent-info version 5. The TypeScript client validates both successful payloads: malformed health JSON throws `HealthResponseError`, malformed inspection JSON throws `AgentInfoResponseError`, and a non-success response from either route throws `ClientError`.
|
|
112
112
|
|
|
113
113
|
### Request validation
|
|
114
114
|
|
|
@@ -305,7 +305,7 @@ export default eveChannel({
|
|
|
305
305
|
|
|
306
306
|
## Authentication
|
|
307
307
|
|
|
308
|
-
The `auth` option decides who can call `/eve/v1/info` and the session routes. The built-in helpers cover development and trusted infrastructure:
|
|
308
|
+
The `auth` option decides who can call `/eve/v1/info` and the session routes. `/eve/v1/info` additionally requires an operator principal (`service`, `runtime`, or `local-dev`). The built-in helpers cover development and trusted infrastructure:
|
|
309
309
|
|
|
310
310
|
- `localDev()` accepts requests during local development.
|
|
311
311
|
- `vercelOidc()` lets the local CLI reach a deployed agent, and lets other internal deployments from your team call it.
|
|
@@ -314,6 +314,8 @@ Neither admits browser users or external clients in production. For a public app
|
|
|
314
314
|
|
|
315
315
|
`eve init` scaffolds an `agent/channels/eve.ts` with a production placeholder so you replace it before going live. The generated channel checks Vercel OIDC before falling back to localhost access, and includes `placeholderAuth()`, which returns a setup-focused 401 in production until you swap it for real auth. Delete the file and eve selects its default channel source with `[vercelOidc(), localDev(), placeholderAuth()]`, which rejects all production traffic.
|
|
316
316
|
|
|
317
|
+
To let your own operator credential read `/eve/v1/info`, have its `AuthFn` return `principalType: "service"` (as `jwtHmac()` and `jwtEcdsa()` do), or return `allowAgentInfo: true` from an `EveAuthFn`; see [Agent info access](../guides/auth-and-route-protection#agent-info-access). Keep end-user strategies returning `"user"` without the grant so they cannot read it.
|
|
318
|
+
|
|
317
319
|
For the full auth model and helper list, see [Auth & route protection](../guides/auth-and-route-protection).
|
|
318
320
|
|
|
319
321
|
## Audience
|
|
@@ -456,7 +458,7 @@ When the session at the address is [stranded](../guides/deployment/self-hosting#
|
|
|
456
458
|
|
|
457
459
|
`send()` accepts the same `history` option. The entries are added right before that message and its `context`, whether the send creates the session or continues it. The eve channel's `onMessage` can return `history` the same way. It applies to every message it is returned for, so return it only when the message should carry those turns.
|
|
458
460
|
|
|
459
|
-
Each entry has a `role` of `"user"` or `"assistant"`, non-empty `text`, and an optional `id` that is unique within the call. Invalid history throws an `InvalidSessionHistoryError`, exported from `eve/channels`, that names the entry and the rule it broke. eve doesn't cap how many entries or how much text one call carries. Your route decides how much stored conversation to load, so trim long conversations there, for example to the newest messages. Tool calls, files, and reasoning are not supported.
|
|
461
|
+
Each entry has a `role` of `"user"` or `"assistant"`, non-empty `text`, and an optional `id` that is unique within the call. An entry with any other field is rejected, not dropped, so map your stored messages to these fields. Invalid history throws an `InvalidSessionHistoryError`, exported from `eve/channels`, that names the entry and the rule it broke. eve doesn't cap how many entries or how much text one call carries. Your route decides how much stored conversation to load, so trim long conversations there, for example to the newest messages. Tool calls, files, and reasoning are not supported.
|
|
460
462
|
|
|
461
463
|
eve never accepts `history` from a client request body. Resolve it on the server and authorize the caller against the stored conversation.
|
|
462
464
|
|
package/docs/code-extension.mdx
CHANGED
|
@@ -98,62 +98,22 @@ export default git({});
|
|
|
98
98
|
|
|
99
99
|
Configure `github` to broker GitHub access through Connect instead. The extension then adds the authenticated `git__gh` tool, tells the agent to use it for every authenticated GitHub operation, and switches `git__pr` to `gh-signed-commit` for repositories that require verified signatures.
|
|
100
100
|
|
|
101
|
-
| Option | Required | Effect
|
|
102
|
-
| ---------------------- | ------------- |
|
|
103
|
-
| `github.connector` | With `github` | Connector that mints a GitHub token
|
|
104
|
-
| `github.broker` | With `github` | `broker(sandbox, rules)` callback that installs, then removes, the GitHub credential rules
|
|
105
|
-
| `github.
|
|
106
|
-
| `github.
|
|
107
|
-
| `github.attribution` | No | `attribution(ctx)` returns the current turn's `{ name, email }` co-author, or `null`
|
|
101
|
+
| Option | Required | Effect |
|
|
102
|
+
| ---------------------- | ------------- | ------------------------------------------------------------------------------------------ |
|
|
103
|
+
| `github.connector` | With `github` | Connector that mints a GitHub token |
|
|
104
|
+
| `github.broker` | With `github` | `broker(sandbox, rules)` callback that installs, then removes, the GitHub credential rules |
|
|
105
|
+
| `github.principalType` | With `github` | `"app"` for GitHub App installation tokens, or `"user"` for the caller's own token |
|
|
106
|
+
| `github.authorize` | With `github` | `authorize(request)` returns `true` to let a `gh` call run |
|
|
107
|
+
| `github.attribution` | No | `attribution(ctx)` returns the current turn's `{ name, email }` co-author, or `null` |
|
|
108
108
|
|
|
109
|
-
Each `gh`
|
|
109
|
+
Each `gh` call runs one `gh`, `git`, or `gh-signed-commit` command. The sandbox process receives a placeholder `GH_TOKEN`, and the firewall exchanges it on matching GitHub requests. Your `github.broker` callback receives the header-transform rules for the command, then `null` to remove the lease. The callback must preserve your other network rules. GitHub authentication has no command-delivery option.
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
### Control access with `authorize`
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
`github.authorize` is the agent's only access control: a command runs only when it returns `true`, and the token never reaches the sandbox otherwise. It runs before every `gh` call with the parsed `argv`, the caller's `auth`, the `repository` the call declared (or `null`), and the minted `token`. What the token reaches depends on `principalType`:
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
import { brokerGitHubLease } from "../lib/github";
|
|
119
|
-
|
|
120
|
-
export default git({
|
|
121
|
-
github: {
|
|
122
|
-
connector: "github/my-agent",
|
|
123
|
-
broker: brokerGitHubLease,
|
|
124
|
-
authorize: ({ repository }) => repository.toLowerCase().startsWith("acme/"),
|
|
125
|
-
},
|
|
126
|
-
});
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
`authorize` can also use the token to check the caller, for example their collaborator status (allowed commands still use the app token's permissions, not the collaborator's):
|
|
130
|
-
|
|
131
|
-
```ts title="agent/extensions/git.ts"
|
|
132
|
-
import git from "eve/extensions/git";
|
|
133
|
-
|
|
134
|
-
import { brokerGitHubLease } from "../lib/github";
|
|
135
|
-
|
|
136
|
-
export default git({
|
|
137
|
-
github: {
|
|
138
|
-
connector: "github/my-agent",
|
|
139
|
-
broker: brokerGitHubLease,
|
|
140
|
-
// GitHub channel sessions carry the commenter's login as `auth.subject`.
|
|
141
|
-
async authorize({ auth, repository, token }) {
|
|
142
|
-
if (!repository.toLowerCase().startsWith("acme/")) return false;
|
|
143
|
-
if (auth?.authenticator !== "github-webhook" || !auth.subject) return false;
|
|
144
|
-
const response = await fetch(
|
|
145
|
-
`https://api.github.com/repos/${repository}/collaborators/${auth.subject}`,
|
|
146
|
-
{ headers: { authorization: `Bearer ${token}` } },
|
|
147
|
-
);
|
|
148
|
-
return response.status === 204;
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
});
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### Run commands as the caller
|
|
155
|
-
|
|
156
|
-
By default each `gh` invocation mints a GitHub App installation token, so commands run with the installation's permissions. Set `github.principalType` to `"user"` to run them with the caller's own GitHub permissions instead, as `connect({ connector, principalType: "user" })` does for connections:
|
|
115
|
+
- **`"app"`**: a GitHub App installation token for the declared repository, or for the whole installation when the call declares only an owner. `authorize` also receives that `owner`.
|
|
116
|
+
- **`"user"`**: the caller's own token, which reaches whatever the caller can on GitHub. eve signs the caller in when needed and again when GitHub rejects the token. `authorize` receives no `owner`, because the token is not scoped to one. `repository` is only what the model declared, and nothing ties it to the command, so it is a hint, not a boundary. Gate user-mode calls on `auth` instead, for example `({ auth }) => auth !== null`.
|
|
157
117
|
|
|
158
118
|
```ts title="agent/extensions/git.ts"
|
|
159
119
|
import git from "eve/extensions/git";
|
|
@@ -164,16 +124,12 @@ export default git({
|
|
|
164
124
|
github: {
|
|
165
125
|
connector: "github/my-agent",
|
|
166
126
|
broker: brokerGitHubLease,
|
|
167
|
-
|
|
168
|
-
|
|
127
|
+
principalType: "app",
|
|
128
|
+
authorize: ({ owner }) => owner.toLowerCase() === "acme",
|
|
169
129
|
},
|
|
170
130
|
});
|
|
171
131
|
```
|
|
172
132
|
|
|
173
|
-
The tool resolves the caller's token from `github.connector` through `ctx.getToken`. When the caller has no grant, eve signs them in and re-runs the call. The token request carries no repository details, so one grant covers every repository and later commands resolve tokens without another sign-in. When GitHub rejects the token (`HTTP 401`, `Bad credentials`, `Authentication failed`, or a `gh-signed-commit` `failed: 401`), the tool calls `ctx.requireAuth`, which evicts the token and signs the caller in again.
|
|
174
|
-
|
|
175
|
-
A user token carries the caller's GitHub permissions across every account where the GitHub App is installed, not only the declared repository. The tool description and GitHub instructions tell the model that access is limited to what the caller can reach. `github.authorize` still runs before every command, with the caller's token, and remains the agent's repository policy.
|
|
176
|
-
|
|
177
133
|
### Credit the person behind a turn
|
|
178
134
|
|
|
179
135
|
Commits made by the `gh` tool are authored by the GitHub App. Return a verified user mapping from
|
|
@@ -193,7 +149,8 @@ export default git({
|
|
|
193
149
|
github: {
|
|
194
150
|
connector: "github/my-agent",
|
|
195
151
|
broker: brokerGitHubLease,
|
|
196
|
-
|
|
152
|
+
principalType: "app",
|
|
153
|
+
authorize: ({ owner }) => owner.toLowerCase() === "acme",
|
|
197
154
|
attribution: (ctx) => coAuthorFor(ctx.session.auth.current),
|
|
198
155
|
},
|
|
199
156
|
});
|
|
@@ -223,7 +180,7 @@ directory, `agent/extensions/code/extension.ts`.
|
|
|
223
180
|
|
|
224
181
|
For a custom GitHub command tool, `eve/extensions/git/sandbox` exports
|
|
225
182
|
`executeGitHubShell(input, config, dependencies)` and `githubShellApproval(input)`.
|
|
226
|
-
The execution helper
|
|
183
|
+
The execution helper parses the command, calls `authorize`, and brokers a
|
|
227
184
|
credential lease; dependencies supply the session ID and sandbox access. Reuse
|
|
228
185
|
`githubShellApproval` to reject invalid command inputs through the approval
|
|
229
186
|
policy rather than bypassing those constraints.
|
|
@@ -121,7 +121,7 @@ export default defineDynamic(async (ctx) => {
|
|
|
121
121
|
|
|
122
122
|
The memo runs before the replacement's first model call, and the instruction enters the replacement's durable history once, ahead of the new message. In a session that replaced no other, `ctx.session.predecessor` is undefined and the instruction contributes nothing.
|
|
123
123
|
|
|
124
|
-
`transcriptOf()` keeps the history each consumed delivery imported, the text of each consumed delivery, and each completed reply part, oldest first, as `{ role, text }` messages. Reasoning, narration, tool calls and results, attachments, interactions, and interrupted output are left out.
|
|
124
|
+
`transcriptOf()` keeps the history each consumed delivery imported, the text of each consumed delivery, and each completed reply part, oldest first, as `{ role, text }` messages. Reasoning, narration, tool calls and results, attachments, interactions, and interrupted output are left out. Only the session's current conversation is kept: a clear in the stranded session starts the transcript over, so text the user cleared is never returned. `sessions.attach()` also converts older session history to v27 events. That conversion reads from the beginning to reconstruct the conversation, even when `startIndex` requests a later position. `maxMessages` keeps only the newest messages in the resulting transcript.
|
|
125
125
|
|
|
126
126
|
The read and the prompt are yours to bound:
|
|
127
127
|
|
|
@@ -106,6 +106,8 @@ Facts are grouped into families. Lifecycle facts introduce, update, or settle an
|
|
|
106
106
|
| `context` | `context.started`, `context.settled` | A context change: `kind` `"compaction"` or `"clear"`. |
|
|
107
107
|
| `usage` | `usage.recorded` | Model spend, owned by the run, call, or context change that spent it. |
|
|
108
108
|
|
|
109
|
+
The conversation is a chain of turns. Each `turn.started` names the turn it `follows`, the one whose conversation it continues, or `null` for a first turn. A completed `context.settled` can change the conversation with `selects`: `null` empties it, as a clear does, and `{ turnId }` makes that earlier turn its newest, leaving out the turns after it. The next turn then follows the selected one. Either can name any earlier turn, so read the conversation with `conversation(view)` instead of assuming it holds every turn in order.
|
|
110
|
+
|
|
109
111
|
Progress records are `content.delta` (a text or reasoning delta for a `partId`), `call.input` (a raw tool-input delta for a `callId`), and `call.progress` (a preliminary output snapshot for a `callId`).
|
|
110
112
|
|
|
111
113
|
Call labels use `capability.label` before execution, `call.progress.data.label` for a progress
|
|
@@ -132,7 +134,7 @@ Within stream version 27, a later minor release can add:
|
|
|
132
134
|
- fact types that only add information: a new family, or an update to a row such as `model.retried`, never the only way an entity opens or ends;
|
|
133
135
|
- progress record types;
|
|
134
136
|
- optional fields;
|
|
135
|
-
- outcomes, interaction kinds, displays, and option styles.
|
|
137
|
+
- outcomes, interaction kinds, context-change kinds, displays, and option styles.
|
|
136
138
|
|
|
137
139
|
It never removes or renames a fact or field, changes what a fact means or which role it plays in its entity's lifecycle, or adds a required field. Anything else is a new stream version, which readers refuse.
|
|
138
140
|
|
|
@@ -450,9 +452,13 @@ A read reflects events that are already durable. A hook runs after its line is w
|
|
|
450
452
|
|
|
451
453
|
## Inspect the agent over HTTP
|
|
452
454
|
|
|
453
|
-
`GET /eve/v1/info` returns agent-info version
|
|
455
|
+
`GET /eve/v1/info` returns agent-info version 5, a JSON inspection snapshot of the effective compiled agent. It reports the selected config; active tools, instructions, memory slots, skills, channels, schedules, sandbox, connections, hooks, and instrumentation with explicit source ownership; dynamic resolvers separately from their session-specific output; local and remote agents in separate collections; prepared built-in effects; and shadowed or disabled source diagnostics. Memory tool wrappers include their selected memory-source dependency. Channel routes appear in the same effective order used by the HTTP host. Static instructions remain an ordered array whose entries expose `content` and `role`. Sandbox inspection exposes the opaque `revisionHash` that identifies its compiler-discovered environment inputs.
|
|
456
|
+
|
|
457
|
+
Because the payload includes authored text and server paths, the route serves only operator principals: `service` and `runtime` principals and, when the channel's auth includes `localDev()`, any caller it admits on a development server. Any other principal the channel admits, such as a `user` or `anonymous` principal, gets `403` with `{ "code": "info_forbidden", "ok": false }` and an `error` message. To give another credential access, return `principalType: "service"` or `allowAgentInfo: true` from its authenticator; see [Agent info access](../guides/auth-and-route-protection#agent-info-access).
|
|
458
|
+
|
|
459
|
+
The version changes only for breaking reshapes. New fields and new enum values are added within a version, so readers should ignore unknown fields and tolerate unknown enum values. `kind` discriminants, such as an owner's, a model endpoint's, or a module's backing `kind`, are closed: a new variant comes with a version bump.
|
|
454
460
|
|
|
455
|
-
The info route belongs to the selected `channels/eve.ts` source and uses its resolved auth policy. Without an authored replacement, eve selects the default channel source with Vercel OIDC, local development access, and the production placeholder. Replacing or disabling that source replaces or removes the info route too; no native fallback serves it.
|
|
461
|
+
The info route belongs to the selected `channels/eve.ts` source and uses its resolved auth policy before the operator check. Without an authored replacement, eve selects the default channel source with Vercel OIDC, local development access, and the production placeholder. Replacing or disabling that source replaces or removes the info route too; no native fallback serves it.
|
|
456
462
|
|
|
457
463
|
```bash
|
|
458
464
|
curl http://127.0.0.1:2000/eve/v1/info
|
|
@@ -213,6 +213,36 @@ export default defineMcpClientConnection({
|
|
|
213
213
|
|
|
214
214
|
For connection tools that can create, modify, delete, transmit, purchase, message, or access sensitive data, use approval, allow-lists, or other safeguards appropriate to the action.
|
|
215
215
|
|
|
216
|
+
### Send the approver to the server
|
|
217
|
+
|
|
218
|
+
[Approval is consent only](/docs/human-in-the-loop): it never changes who the turn runs as. An approved connection call keeps the requester's identity, so `ctx.session.auth.current` and the connection's `auth` token stay the requester's, and later calls in the turn are unaffected. While an approved call runs, its `headers` and `toolCall.providedArguments` callbacks also receive `ctx.approval.responder`, the person who approved it, with access to their credentials. That's a separate identity your code explicitly sends to the server, not a replacement for the requester:
|
|
219
|
+
|
|
220
|
+
```ts title="agent/connections/gateway.ts"
|
|
221
|
+
import { defineMcpClientConnection } from "eve/connections";
|
|
222
|
+
import { always } from "eve/tools/approval";
|
|
223
|
+
|
|
224
|
+
export default defineMcpClientConnection({
|
|
225
|
+
url: "https://gateway.example.com/mcp",
|
|
226
|
+
description: "Internal systems through the MCP gateway.",
|
|
227
|
+
approval: {
|
|
228
|
+
request: always(),
|
|
229
|
+
response: ({ response }) =>
|
|
230
|
+
admins.includes(response.principal.principalId)
|
|
231
|
+
? { status: "allowed" }
|
|
232
|
+
: { status: "rejected", reason: "Only admins can approve gateway calls." },
|
|
233
|
+
},
|
|
234
|
+
auth: gatewayAuth,
|
|
235
|
+
headers: async (ctx) => {
|
|
236
|
+
const approver = await ctx.approval?.responder.getToken(gatewayApproverAuth);
|
|
237
|
+
return approver === undefined ? {} : { "X-Approver-Token": approver.token };
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
`ctx.approval.responder.getToken(provider)` resolves the approver's token as it does in a [`defineTool` tool](/docs/human-in-the-loop): it never starts a sign-in, and throws a `ConnectionAuthorizationFailedError` with `reason: "approver_authorization_required"` when the approver has no token. `headers` can't set `Authorization` when the connection also sets `auth`, so send the approver's token in another header, or omit `auth` and set `Authorization` yourself.
|
|
243
|
+
|
|
244
|
+
`ctx.approval` is absent for calls that needed no approval, and while eve connects to the server and lists its tools. The approver's identity reaches only the requests of the call they approved. Pair it with an `approval.response` policy so only people whose access the call may use can approve it.
|
|
245
|
+
|
|
216
246
|
## Interactive OAuth via Vercel Connect
|
|
217
247
|
|
|
218
248
|
When the server uses OAuth and you want each end-user to sign in through their own browser, turn on interactive authorization with [Vercel Connect](https://vercel.com/docs/connect). The `connect()` helper from `@vercel/connect/eve` handles consent, encrypted token storage, and refresh, then hooks all of that into eve's authorization flow.
|
package/docs/evals/targets.mdx
CHANGED
|
@@ -51,6 +51,8 @@ After verification, eve sends the available Vercel credentials:
|
|
|
51
51
|
|
|
52
52
|
`EVE_EVAL_AUTH_TOKEN` is an explicit bearer override for targets whose auth is not Vercel OIDC. Credential-bearing clients do not follow redirects, so those headers cannot be forwarded to another origin.
|
|
53
53
|
|
|
54
|
+
`/eve/v1/info` serves only operator principals, so the credential must authenticate as a service principal, for example through Vercel OIDC, `jwtHmac()`, `jwtEcdsa()`, or a custom `AuthFn` that returns `principalType: "service"`. When the target answers `403`, the run fails before any eval starts and names the credential it needs.
|
|
55
|
+
|
|
54
56
|
`t.target.fetch(path, init)` carries these same credentials, so channel and webhook ingress you exercise through it authenticates the same way the session protocol does.
|
|
55
57
|
|
|
56
58
|
## What to read next
|
|
@@ -156,15 +156,15 @@ Parallel calls consume responses in arrival order, which can vary. Use separate
|
|
|
156
156
|
|
|
157
157
|
## Permit tool replacement
|
|
158
158
|
|
|
159
|
-
Tool replacement is denied by default, including in development. With [Vercel OIDC](../guides/auth-and-route-protection#verceloidc), put the permission on the eval runner's verified subject:
|
|
159
|
+
Tool replacement is denied by default, including in development. With [Vercel OIDC](../guides/auth-and-route-protection#verceloidc), use `eveVercelOidc` and put the permission on the eval runner's verified subject:
|
|
160
160
|
|
|
161
161
|
```ts title="agent/channels/eve.ts"
|
|
162
|
-
import {
|
|
163
|
-
import { eveChannel } from "eve/channels/eve";
|
|
162
|
+
import { vercelSubject } from "eve/channels/auth";
|
|
163
|
+
import { eveChannel, eveVercelOidc } from "eve/channels/eve";
|
|
164
164
|
|
|
165
165
|
export default eveChannel({
|
|
166
166
|
auth: [
|
|
167
|
-
|
|
167
|
+
eveVercelOidc({
|
|
168
168
|
subjects: [
|
|
169
169
|
vercelSubject({ teamSlug: "acme", projectName: "app" }),
|
|
170
170
|
{
|
|
@@ -117,7 +117,7 @@ Verifies a bearer JWT against the [Vercel OIDC issuer](https://vercel.com/docs/o
|
|
|
117
117
|
|
|
118
118
|
Auth fails closed: routes reject unauthenticated traffic by default, and the OIDC user branch verifies `external_sub` against `VERCEL_PROJECT_ID` and the deployment environment, returning `false` when either is unset. An external-subject token cannot authenticate on a deployment that hasn't pinned its project.
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
To also permit [stubbed eval sessions](../evals/tool-stubs), use `eveVercelOidc` from `eve/channels/eve`. It takes the same options, and its subject entries can grant [tool replacement permission](#tool-replacement-permission).
|
|
121
121
|
|
|
122
122
|
#### `subjects` patterns and `vercelSubject(...)`
|
|
123
123
|
|
|
@@ -307,9 +307,9 @@ Route auth does not enforce session ownership. If multiple users or tenants can
|
|
|
307
307
|
|
|
308
308
|
## Tool replacement permission
|
|
309
309
|
|
|
310
|
-
Creating a [stubbed eval session](../evals/tool-stubs) requires an explicit `allowToolStubs: true` in the verified route authentication result. The target's server configuration grants permission; request JSON cannot. With `
|
|
310
|
+
Creating a [stubbed eval session](../evals/tool-stubs) requires an explicit `allowToolStubs: true` in the verified route authentication result. The target's server configuration grants permission; request JSON cannot. With `eveVercelOidc`, put the grant on a `subjects` entry, as in the [tool stubs example](../evals/tool-stubs#permit-tool-replacement). Any matching entry with the grant permits replacement; other entries do not revoke it. Implicit current-project acceptance and user principals do not inherit project grants.
|
|
311
311
|
|
|
312
|
-
Custom authenticators return the same grant after verifying their caller
|
|
312
|
+
Custom authenticators return the same grant after verifying their caller; type standalone callbacks as `EveAuthFn` from `eve/channels/eve`. For example, this alternative channel permits stubs only in local development:
|
|
313
313
|
|
|
314
314
|
```ts
|
|
315
315
|
import { localDev } from "eve/channels/auth";
|
|
@@ -328,6 +328,19 @@ The channel checks the grant before forwarded-principal handling or `onMessage`
|
|
|
328
328
|
|
|
329
329
|
Later messages, approvals, controls, and result reads use normal channel authentication. There is no additional creator-only rule or replacement-permission recheck. Anyone your channel admits to an existing session can use its configured stubs; apply the same application-specific session-access policy you need for ordinary sessions.
|
|
330
330
|
|
|
331
|
+
## Agent info access
|
|
332
|
+
|
|
333
|
+
`GET /eve/v1/info` returns authored instructions and server paths, so it serves only operators by default: `service` and `runtime` principals, plus callers `localDev()` admits when the channel's `auth` includes it. Other callers get `403` with code `info_forbidden`. An eve-channel authenticator can decide for its caller instead: `allowAgentInfo: true` grants access, and `false` denies it even to an operator. Like `allowToolStubs`, the flag applies only to the current request and is never persisted or forwarded.
|
|
334
|
+
|
|
335
|
+
```ts
|
|
336
|
+
import type { EveAuthFn } from "eve/channels/eve";
|
|
337
|
+
|
|
338
|
+
const authenticateStaff: EveAuthFn = async (request) => {
|
|
339
|
+
const staff = await verifyStaffSession(request);
|
|
340
|
+
return staff ? { ...staff, allowAgentInfo: true } : null;
|
|
341
|
+
};
|
|
342
|
+
```
|
|
343
|
+
|
|
331
344
|
## Tool and connection auth
|
|
332
345
|
|
|
333
346
|
Tool and connection auth is how your agent reaches an external service that wants an interactive sign-in, like an OAuth MCP server. Connections declare `auth` on the connection definition. Tools should resolve providers inline with `ctx.getToken(provider)` and call `ctx.requireAuth(provider)` only when a downstream service rejects a token; eve drives the sign-in, caches the token per step, and re-runs the call once the caller authorizes.
|