eve 0.60.1 → 0.61.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 +14 -0
- package/dist/src/chunks/{use-eve-agent-Dmc6sX4d.js → use-eve-agent-C5-yqRuq.js} +177 -85
- package/dist/src/chunks/{use-eve-agent-jSR8P4nK.js → use-eve-agent-CVWk5KKy.js} +177 -85
- package/dist/src/cli/agent-command.js +1 -1
- package/dist/src/cli/dev/local-server-child.js +1 -1
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/client/client.d.ts +3 -1
- package/dist/src/client/client.js +1 -1
- package/dist/src/client/eve-agent-projection.d.ts +1 -0
- package/dist/src/client/eve-agent-projection.js +1 -1
- package/dist/src/client/eve-agent-store-helpers.js +1 -1
- package/dist/src/client/eve-agent-store-state.d.ts +4 -1
- package/dist/src/client/eve-agent-store.js +1 -1
- package/dist/src/client/message-reducer.js +1 -1
- package/dist/src/client/message-response.d.ts +5 -0
- package/dist/src/client/message-response.js +1 -1
- package/dist/src/client/optimistic-message-submissions.d.ts +22 -0
- package/dist/src/client/optimistic-message-submissions.js +1 -0
- package/dist/src/client/session.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +6 -6
- package/dist/src/compiled/@workflow/core/index.js +1 -1
- package/dist/src/compiled/@workflow/core/log-format.d.ts +4 -0
- package/dist/src/compiled/@workflow/core/runtime/helpers.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime.js +5 -3
- package/dist/src/compiled/@workflow/core/serialization.js +1 -1
- package/dist/src/compiled/@workflow/core/types.d.ts +22 -0
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/world/runs.d.ts +12 -1
- package/dist/src/compiled/@workflow/world-local/index.js +3 -3
- package/dist/src/compiled/@workflow/world-vercel/index.js +7 -7
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-3SKHZsSX.js → attribute-changes-A6HfMNG3.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{dist-DearXsdS.js → dist-D38gP7YF.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/frames-QcJfYHmh.js +3 -0
- package/dist/src/compiled/_chunks/workflow/helpers-6kObVbfS.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{logger-CxBCNokg.js → logger-NN5YHpYy.js} +6 -5
- package/dist/src/compiled/_chunks/workflow/{resume-hook-B7_MC7FC.js → resume-hook-CAqlhwic.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{run-jGFog1uQ.js → run-DJevv8zz.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{serialization-VRHEKI6l.js → serialization-C5KgPESk.js} +3 -3
- package/dist/src/compiled/_chunks/workflow/sleep-CbUwdv6O.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{wait-until-DDJySKt-.js → wait-until-BMY_tOr-.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{ws-transport-CEFNBXPC.js → ws-transport-DSDcKH08.js} +1 -1
- package/dist/src/compiler/default-tool-policy.js +1 -1
- package/dist/src/compiler/extension-compatibility.d.ts +18 -18
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.d.ts +5 -2
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-tool.js +1 -1
- package/dist/src/compiler/project-sources.js +1 -1
- package/dist/src/compiler/validate-artifact.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/context/dynamic-tool-metadata.d.ts +1 -0
- package/dist/src/evals/cli/eval.js +1 -1
- package/dist/src/execution/dynamic-workflow/tool.js +1 -1
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/tools/agent-router-workflow.js +1 -1
- package/dist/src/execution/tools/sleep-workflow.js +1 -1
- package/dist/src/execution/tools/subagent/metadata.js +1 -1
- package/dist/src/harness/advertised-tools.js +1 -1
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/execute-tool.d.ts +1 -0
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/schema-backed.js +1 -1
- package/dist/src/internal/authored-runtime-modules.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-artifacts.d.ts +1 -0
- package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
- package/dist/src/internal/nitro/development-generation.js +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
- package/dist/src/internal/nitro/host/extension-distribution.js +1 -1
- package/dist/src/internal/nitro/host.js +1 -1
- package/dist/src/internal/node-esm-compat-banner.js +3 -3
- package/dist/src/internal/workflow-bundle/authored-workflow-directives.js +1 -1
- package/dist/src/internal/workflow-bundle/builder-support.d.ts +1 -0
- package/dist/src/internal/workflow-bundle/builder-support.js +1 -1
- package/dist/src/internal/workflow-bundle/builder.js +1 -1
- package/dist/src/internal/workflow-bundle/nitro-step-entry.d.ts +1 -0
- package/dist/src/internal/workflow-bundle/nitro-step-entry.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-directive-ast.d.ts +1 -0
- package/dist/src/internal/workflow-bundle/workflow-directive-ast.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-transformer.js +1 -1
- package/dist/src/protocol/message.d.ts +4 -0
- package/dist/src/protocol/message.js +1 -1
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/resolve-tool.js +1 -1
- package/dist/src/runtime/tools/registry.js +1 -1
- package/dist/src/services/dev-client/agent-info-probe.d.ts +1 -0
- package/dist/src/services/dev-client/agent-info-probe.js +1 -1
- package/dist/src/setup/primitives/pm/pnpm.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/shared/map-concurrent.d.ts +2 -0
- package/dist/src/shared/map-concurrent.js +1 -0
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tools/definition.d.ts +2 -0
- package/dist/src/tools/dynamic.d.ts +1 -0
- package/dist/src/tools/provided/agent-router.d.ts +1 -1
- package/dist/src/tools/provided/agent-router.js +1 -1
- package/dist/src/tools/workflow-definition.d.ts +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/concepts/built-in-tools.md +1 -1
- package/docs/concepts/sessions-runs-and-streaming.md +32 -32
- package/docs/guides/client/overview.mdx +2 -0
- package/docs/guides/frontend/overview.mdx +7 -3
- package/docs/reference/typescript-api.md +1 -1
- package/docs/subagents/index.mdx +3 -3
- package/docs/tools/overview.mdx +17 -0
- package/docs/tools/workflows.mdx +19 -8
- package/package.json +7 -7
- package/dist/src/compiled/_chunks/workflow/frames-Bm_yZi8X.js +0 -3
- package/dist/src/compiled/_chunks/workflow/helpers-K7otPd_U.js +0 -1
- package/dist/src/compiled/_chunks/workflow/sleep-60eDbac6.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createEveSessionStreamRoutePath,createEveSubagentStreamRoutePath}from"#protocol/routes.js";import{deserializeUrlFilePart,hasInternalRefScheme,isSerializedUrlFilePart}from"#internal/attachments/url-refs.js";import{toChannelLocalContinuationToken}from"#shared/continuation-token.js";import{decodeSandboxRef,isSandboxRefUrl}from"#internal/attachments/sandbox-refs.js";import{createEventId}from"#protocol/event-id.js";const EVE_SESSION_ID_HEADER=`x-eve-session-id`,EVE_STREAM_FORMAT_HEADER=`x-eve-stream-format`,EVE_STREAM_TAIL_INDEX_HEADER=`x-eve-stream-tail-index`,EVE_STREAM_VERSION_HEADER=`x-eve-stream-version`,EVE_MESSAGE_STREAM_CONTENT_TYPE=`application/x-ndjson; charset=utf-8`,EVE_MESSAGE_STREAM_FORMAT=`ndjson`,EVE_MESSAGE_STREAM_VERSION=`25`,EVE_STREAM_CONTROL_VERSION=`1`,EVE_STREAM_CONTROL_VERSION_QUERY=`streamControlVersion`,EVE_STREAM_LEASE_ENDED_CONTROL={$eve:`stream.lease-ended`,version:1},textEncoder=new TextEncoder;function isCurrentTurnBoundaryEvent(e){return e.type===`session.completed`||e.type===`session.failed`||e.type===`session.waiting`}function isTurnFailureEvent(e){return e.type===`session.failed`||e.type===`step.failed`||e.type===`turn.failed`}function createSessionStartedEvent(e){let t={};return e?.invocation!==void 0&&(t.invocation=e.invocation),e?.runtime!==void 0&&(t.runtime=e.runtime),e?.trace!==void 0&&(t.trace=e.trace),{data:t,type:`session.started`}}function createTurnStartedEvent(e){let t={sequence:e.sequence,turnId:e.turnId};return e.trace!==void 0&&(t.trace=e.trace),{data:t,type:`turn.started`}}function createMessageReceivedEvent(e){return{data:{message:summarizeUserContent(e.message),parts:projectUserContentParts(e.message),sequence:e.sequence,turnId:e.turnId},type:`message.received`}}function summarizeUserContent(e){if(typeof e==`string`)return e;let t=[];for(let n of e)if(n.type===`text`)t.push(n.text);else if(n.type===`file`){let e=n.filename??n.mediaType;t.push(`[file: ${e} (${n.mediaType})]`)}else n.type===`image`&&t.push(`[image: ${n.mediaType??`image`}]`);return t.join(`
|
|
1
|
+
import{createEveSessionStreamRoutePath,createEveSubagentStreamRoutePath}from"#protocol/routes.js";import{deserializeUrlFilePart,hasInternalRefScheme,isSerializedUrlFilePart}from"#internal/attachments/url-refs.js";import{toChannelLocalContinuationToken}from"#shared/continuation-token.js";import{decodeSandboxRef,isSandboxRefUrl}from"#internal/attachments/sandbox-refs.js";import{createEventId}from"#protocol/event-id.js";const EVE_SESSION_ID_HEADER=`x-eve-session-id`,EVE_STREAM_FORMAT_HEADER=`x-eve-stream-format`,EVE_STREAM_TAIL_INDEX_HEADER=`x-eve-stream-tail-index`,EVE_STREAM_VERSION_HEADER=`x-eve-stream-version`,EVE_MESSAGE_STREAM_CONTENT_TYPE=`application/x-ndjson; charset=utf-8`,EVE_MESSAGE_STREAM_FORMAT=`ndjson`,EVE_MESSAGE_STREAM_VERSION=`25`,EVE_STREAM_CONTROL_VERSION=`1`,EVE_STREAM_CONTROL_VERSION_QUERY=`streamControlVersion`,EVE_STREAM_LEASE_ENDED_CONTROL={$eve:`stream.lease-ended`,version:1},textEncoder=new TextEncoder;function isCurrentTurnBoundaryEvent(e){return e.type===`session.completed`||e.type===`session.failed`||e.type===`session.waiting`}function isTurnFailureEvent(e){return e.type===`session.failed`||e.type===`step.failed`||e.type===`turn.failed`}function createSessionStartedEvent(e){let t={};return e?.invocation!==void 0&&(t.invocation=e.invocation),e?.runtime!==void 0&&(t.runtime=e.runtime),e?.trace!==void 0&&(t.trace=e.trace),{data:t,type:`session.started`}}function createTurnStartedEvent(e){let t={sequence:e.sequence,turnId:e.turnId};return e.trace!==void 0&&(t.trace=e.trace),{data:t,type:`turn.started`}}function createMessageReceivedEvent(e){return{data:{kind:e.kind,message:summarizeUserContent(e.message),parts:projectUserContentParts(e.message),sequence:e.sequence,turnId:e.turnId},type:`message.received`}}function summarizeUserContent(e){if(typeof e==`string`)return e;let t=[];for(let n of e)if(n.type===`text`)t.push(n.text);else if(n.type===`file`){let e=n.filename??n.mediaType;t.push(`[file: ${e} (${n.mediaType})]`)}else n.type===`image`&&t.push(`[image: ${n.mediaType??`image`}]`);return t.join(`
|
|
2
2
|
`)}function projectUserContentParts(e){if(typeof e==`string`)return[{text:e,type:`text`}];let t=[];for(let n of e)n.type===`text`?t.push({text:n.text,type:`text`}):n.type===`file`?t.push(projectFileLikePart(n.data,n.mediaType,n.filename)):n.type===`image`&&t.push(projectFileLikePart(n.image,n.mediaType??`application/octet-stream`,void 0));return t}function projectFileLikePart(e,t,n){if(isSandboxRefUrl(e)){let t=decodeSandboxRef(e);return createProjectedFilePart({filename:basenameOf(n??t.path),mediaType:t.mediaType,size:t.size})}let r=projectTaggedFileData(e,t,n);if(r!==void 0)return r;let i=byteLengthOf(e);return createProjectedFilePart(i===void 0?{filename:n,mediaType:t,...clientUrlFragment(e)}:{filename:n,mediaType:t,size:i})}function projectTaggedFileData(e,t,n){if(isTaggedFileData(e))switch(e.type){case`data`:{let r=byteLengthOf(e.data);return createProjectedFilePart(r===void 0?{filename:n,mediaType:t}:{filename:n,mediaType:t,size:r})}case`reference`:case`text`:return createProjectedFilePart({filename:n,mediaType:t});case`url`:return createProjectedFilePart({filename:n,mediaType:t,...clientUrlFragment(e.url)})}}function createProjectedFilePart(e){let t={mediaType:e.mediaType,type:`file`};return e.filename!==void 0&&(t.filename=e.filename),e.size!==void 0&&(t.size=e.size),e.url!==void 0&&(t.url=e.url),t}function isTaggedFileData(e){if(typeof e!=`object`||!e)return!1;let t=e.type;return t===`data`||t===`reference`||t===`text`||t===`url`}function byteLengthOf(e){if(e instanceof Uint8Array||e instanceof ArrayBuffer)return e.byteLength}function clientUrlFragment(e){if(isSerializedUrlFilePart(e))try{let t=deserializeUrlFilePart(e);return isClientResolvableUrl(t)?{url:t.href}:{}}catch{return{}}if(e instanceof URL)return isClientResolvableUrl(e)?{url:e.href}:{};if(typeof e!=`string`||hasInternalRefScheme(e))return{};if(e.startsWith(`data:`))return{url:e};try{let t=new URL(e);return isClientResolvableUrl(t)?{url:t.href}:{}}catch{return{}}}function isClientResolvableUrl(e){return e.protocol===`http:`||e.protocol===`https:`||e.protocol===`data:`}function basenameOf(e){let t=e.replaceAll(`\\`,`/`),n=t.slice(t.lastIndexOf(`/`)+1);return n.length>0?n:e}function createActionsRequestedEvent(e){return{data:{actions:e.actions,...optionalPresentation(e.presentation),sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`actions.requested`}}function optionalPresentation(e){return e===void 0?{}:{presentation:e}}function createActionInputAppendedEvent(e){return{data:{callId:e.callId,inputTextDelta:e.inputTextDelta,sequence:e.sequence,stepIndex:e.stepIndex,toolName:e.toolName,turnId:e.turnId},type:`action.input.appended`}}function createAuthorizationRequiredEvent(e){let t={description:e.description,name:e.name,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId};return e.attemptId!==void 0&&(t.attemptId=e.attemptId),e.authorization!==void 0&&(t.authorization=e.authorization),e.candidateId!==void 0&&(t.candidateId=e.candidateId),e.webhookUrl!==void 0&&(t.webhookUrl=e.webhookUrl),{data:t,type:`authorization.required`}}function createAuthorizationCompletedEvent(e){let t={name:e.name,outcome:e.outcome,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId};return e.attemptId!==void 0&&(t.attemptId=e.attemptId),e.authorization!==void 0&&(t.authorization=e.authorization),e.candidateId!==void 0&&(t.candidateId=e.candidateId),e.reason!==void 0&&(t.reason=e.reason),{data:t,type:`authorization.completed`}}function createApprovalCandidateEvent(e){return{data:e,type:`approval.candidate`}}function createApprovalSettledEvent(e){return{data:e,type:`approval.settled`}}function createInputRequestedEvent(e){return{data:{requests:e.requests,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`input.requested`}}function createInputResolvedEvent(e){return{data:{resolutions:e.resolutions,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`input.resolved`}}function createActionResultEvent(e){let t=e.rejected===!0?{error:buildActionResultError(e.result),status:`rejected`}:normalizeActionResultOutcome(e.result);return{data:{error:t.error,...optionalPresentation(e.presentation),result:e.result,sequence:e.sequence,status:t.status,stepIndex:e.stepIndex,turnId:e.turnId},type:`action.result`}}function createActionPartialEvent(e){return{data:{...optionalPresentation(e.presentation),result:e.result,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`action.partial`}}function createSubagentCalledEvent(e){return{data:{agentId:e.agentId,callId:e.callId,childSessionId:e.childSessionId,childStreamPath:e.remote===void 0?createEveSessionStreamRoutePath(e.childSessionId):createEveSubagentStreamRoutePath({callId:e.callId,childSessionId:e.childSessionId,parentSessionId:e.sessionId}),sessionId:e.sessionId,sequence:e.sequence,name:e.name,remote:e.remote,toolName:e.toolName,turnId:e.turnId,workflowId:e.workflowId},type:`subagent.called`}}function createMessageAppendedEvent(e){return{data:{messageDelta:e.messageDelta,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`message.appended`}}function createReasoningAppendedEvent(e){return{data:{reasoningDelta:e.reasoningDelta,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`reasoning.appended`}}function createMessageCompletedEvent(e){return{data:{finishReason:e.finishReason??`stop`,message:e.message,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`message.completed`}}function createReasoningCompletedEvent(e){return{data:{reasoning:e.reasoning,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`reasoning.completed`}}function createResultCompletedEvent(e){return{data:{result:e.result,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`result.completed`}}function createStepStartedEvent(e){return{data:{modelId:e.modelId,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`step.started`}}function createStepCompletedEvent(e){let t={finishReason:e.finishReason,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId};return e.usage!==void 0&&(t.usage=e.usage),e.providerMetadata!==void 0&&(t.providerMetadata=e.providerMetadata),{data:t,type:`step.completed`}}function createStepFailedEvent(e){return{data:{code:e.code,details:e.details,message:e.message,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId},type:`step.failed`}}function createTurnCompletedEvent(e){return{data:{sequence:e.sequence,turnId:e.turnId},type:`turn.completed`}}function createTurnFailedEvent(e){return{data:{code:e.code,details:e.details,message:e.message,sequence:e.sequence,turnId:e.turnId},type:`turn.failed`}}function createTurnCancelledEvent(e){return{data:{sequence:e.sequence,turnId:e.turnId},type:`turn.cancelled`}}function createContextClearedEvent(e){return{data:{sequence:e.sequence,sessionId:e.sessionId,turnId:e.turnId},type:`context.cleared`}}function createCompactionRequestedEvent(e){return{data:{modelId:e.modelId,sequence:e.sequence,sessionId:e.sessionId,turnId:e.turnId,usageInputTokens:e.usageInputTokens??null},type:`compaction.requested`}}function createCompactionCompletedEvent(e){return{data:{modelId:e.modelId,sequence:e.sequence,sessionId:e.sessionId,turnId:e.turnId},type:`compaction.completed`}}function createSessionWaitingEvent(e=``){return{data:{continuationToken:toChannelLocalContinuationToken(e),wait:`next-user-message`},type:`session.waiting`}}function createSessionFailedEvent(e){return{data:{code:e.code,details:e.details,message:e.message,sessionId:e.sessionId},type:`session.failed`}}function createSessionCompletedEvent(){return{type:`session.completed`}}function stampMessageStreamEvent(e,t){let n={at:new Date().toISOString(),id:createEventId()};return t!==void 0&&t.length>0&&(n.deliveryIds=t),{...e,meta:n}}function encodeMessageStreamEvent(e){return textEncoder.encode(`${JSON.stringify(e)}\n`)}function normalizeActionResultOutcome(e){if(e.isError===!0)return{error:buildActionResultError(e),status:`failed`};let t=readActionResultOutputError(e.output);return t===void 0?{status:`completed`}:{error:t,status:`failed`}}function buildActionResultError(e){let t=readActionResultOutputError(e.output);return t===void 0?{code:`ACTION_RESULT_FAILED`,message:formatActionResultOutput(e.output)}:t}function readActionResultOutputError(e){let t=parseActionResultOutputRecord(e);if(t===void 0)return;let n=typeof t.code==`string`&&t.code.length>0?t.code:void 0,r=typeof t.message==`string`&&t.message.length>0?t.message:void 0;if(n!==void 0&&r!==void 0)return{code:n,message:r}}function parseActionResultOutputRecord(e){if(typeof e==`object`&&e)return e;if(typeof e!=`string`)return;let t=e.trim();if(t.length!==0)try{let e=JSON.parse(t);if(typeof e==`object`&&e)return e}catch{return}}function formatActionResultOutput(e){if(typeof e==`string`)return e;let t=JSON.stringify(e);return typeof t==`string`&&t.length>0?t:`Action failed.`}export{EVE_MESSAGE_STREAM_CONTENT_TYPE,EVE_MESSAGE_STREAM_FORMAT,EVE_MESSAGE_STREAM_VERSION,EVE_SESSION_ID_HEADER,EVE_STREAM_CONTROL_VERSION,EVE_STREAM_CONTROL_VERSION_QUERY,EVE_STREAM_FORMAT_HEADER,EVE_STREAM_LEASE_ENDED_CONTROL,EVE_STREAM_TAIL_INDEX_HEADER,EVE_STREAM_VERSION_HEADER,createActionInputAppendedEvent,createActionPartialEvent,createActionResultEvent,createActionsRequestedEvent,createApprovalCandidateEvent,createApprovalSettledEvent,createAuthorizationCompletedEvent,createAuthorizationRequiredEvent,createCompactionCompletedEvent,createCompactionRequestedEvent,createContextClearedEvent,createInputRequestedEvent,createInputResolvedEvent,createMessageAppendedEvent,createMessageCompletedEvent,createMessageReceivedEvent,createReasoningAppendedEvent,createReasoningCompletedEvent,createResultCompletedEvent,createSessionCompletedEvent,createSessionFailedEvent,createSessionStartedEvent,createSessionWaitingEvent,createStepCompletedEvent,createStepFailedEvent,createStepStartedEvent,createSubagentCalledEvent,createTurnCancelledEvent,createTurnCompletedEvent,createTurnFailedEvent,createTurnStartedEvent,encodeMessageStreamEvent,isCurrentTurnBoundaryEvent,isTurnFailureEvent,stampMessageStreamEvent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolveConnectionDefinition}from"#runtime/resolve-connection.js";import{ResolveAgentError,createResolvedModuleSourceRef}from"#runtime/resolve-helpers.js";import{resolveChannelDefinition}from"#runtime/resolve-channel.js";import{resolveDynamicConnectionDefinition}from"#runtime/resolve-dynamic-connection.js";import{resolveHookDefinition}from"#runtime/resolve-hook.js";import{resolveSandboxDefinition}from"#runtime/resolve-sandbox.js";import{resolveDynamicInstructionsDefinition}from"#runtime/resolve-dynamic-instructions.js";import{resolveDynamicSkillDefinition}from"#runtime/resolve-dynamic-skill.js";import{resolveDynamicToolDefinition}from"#runtime/resolve-dynamic-tool.js";import{resolveToolDefinition}from"#runtime/resolve-tool.js";import{resolveMemoryDefinition}from"#runtime/resolve-memory.js";async function resolveAgent(e){let t=e.manifest.skills.map(t=>({...t,owner:requireCompiledSourceOwner(e.manifest,t),metadata:t.metadata===void 0?void 0:{...t.metadata}})),n=await Promise.all(e.manifest.channelRoutes.effective.map(t=>resolveChannelDefinition(t,e.moduleMap,e.nodeId))),r=await Promise.all(e.manifest.tools.map(t=>resolveToolDefinition(t,e.moduleMap,e.nodeId,requireBindingOwner(e.manifest,t.sourceId)))),i=await Promise.all(e.manifest.dynamicConnections.map(t=>resolveDynamicConnectionDefinition(t,e.moduleMap,e.nodeId))),a=await Promise.all((e.manifest.dynamicInstructions??[]).map(t=>resolveDynamicInstructionsDefinition(t,e.moduleMap,e.nodeId))),o=await Promise.all((e.manifest.dynamicSkills??[]).map(t=>resolveDynamicSkillDefinition(t,e.moduleMap,e.nodeId))),s=await Promise.all(e.manifest.dynamicTools.map(t=>resolveDynamicToolDefinition(t,e.moduleMap,e.nodeId))),c=await Promise.all(e.manifest.hooks.map(t=>resolveHookDefinition(t,e.moduleMap,e.nodeId))),l=await Promise.all(e.manifest.connections.map(t=>resolveConnectionDefinition(t,e.moduleMap,e.nodeId))),u=await Promise.all(e.manifest.memories.map(t=>resolveMemoryDefinition(t,e.moduleMap,e.nodeId))),d=await resolveSandboxDefinition(e.manifest.sandbox,e.moduleMap,e.nodeId),f=e.manifest.instructions.map(t=>createResolvedInstructionsDefinition(e.manifest,t)),p=e.manifest.workspaceResourceRoot,m={channels:n,connections:l,dynamicConnectionResolvers:i,dynamicInstructionsResolvers:a,dynamicSkillResolvers:o,dynamicToolResolvers:s,hooks:c,instructions:f,metadata:{agentRoot:e.manifest.agentRoot,appRoot:e.manifest.appRoot,diagnosticsSummary:e.manifest.diagnosticsSummary},memories:u,sandbox:d,workspaceResourceRoot:p,skills:t,tools:r,workspaceSpec:{rootEntries:[...p.rootEntries]}};return`config`in e.manifest?{...m,config:createResolvedAgentConfig(e.manifest)}:m}function requireBindingOwner(e,t){let n=e.bindings[t];if(n===void 0)throw Error(`Compiled source "${t}" has no binding.`);return n.owner}function createResolvedInstructionsDefinition(e,t){return{content:t.content,name:t.name,owner:requireCompiledSourceOwner(e,t),logicalPath:t.logicalPath,role:t.role,sourceId:t.sourceId,sourceKind:t.sourceKind}}function requireCompiledSourceOwner(e,t){let n=e.bindings[t.sourceId]?.owner??t.owner;if(n===void 0)throw Error(`Compiled source "${t.sourceId}" has no owner.`);return n}function createResolvedAgentConfig(e){let t={name:e.config.name};if(e.config.defaultTools!==void 0&&(t.defaultTools=e.config.defaultTools),e.config.compaction!==void 0){let n={};e.config.compaction.model!==void 0&&(n.model=e.config.compaction.model.source===void 0?{contextWindowTokens:e.config.compaction.model.contextWindowTokens,id:e.config.compaction.model.id,maxOutputTokens:e.config.compaction.model.maxOutputTokens,providerOptions:e.config.compaction.model.providerOptions}:{contextWindowTokens:e.config.compaction.model.contextWindowTokens,id:e.config.compaction.model.id,maxOutputTokens:e.config.compaction.model.maxOutputTokens,providerOptions:e.config.compaction.model.providerOptions,source:{exportName:e.config.compaction.model.source.exportName,sourceKind:`module`,logicalPath:e.config.compaction.model.source.logicalPath,sourceId:e.config.compaction.model.source.sourceId}}),e.config.compaction.thresholdPercent!==void 0&&(n.thresholdPercent=e.config.compaction.thresholdPercent),t.compaction=n}if(e.config.experimental!==void 0&&(t.experimental={instrumentationProviders:e.config.experimental.instrumentationProviders,workflow:e.config.experimental.workflow===void 0?void 0:{modelCallsPerStep:e.config.experimental.workflow.modelCallsPerStep,retention:e.config.experimental.workflow.retention,world:e.config.experimental.workflow.world}}),e.config.outputSchema!==void 0&&(t.outputSchema=e.config.outputSchema),e.config.reasoning!==void 0&&(t.reasoning=e.config.reasoning),e.config.source!==void 0&&(t.source=createResolvedModuleSourceRef(e.config.source)),e.config.tool!==void 0&&(t.tool=e.config.tool),e.config.limits!==void 0&&(t.limits={maxInputTokensPerSession:e.config.limits.maxInputTokensPerSession,maxOutputTokensPerSession:e.config.limits.maxOutputTokensPerSession,maxTokenCostUsdPerSession:e.config.limits.maxTokenCostUsdPerSession,sessionTimeoutMs:e.config.limits.sessionTimeoutMs}),e.config.dynamicModel!==void 0)return{...t,dynamicModel:{...createResolvedModuleSourceRef(e.config.dynamicModel),eventNames:[...e.config.dynamicModel.eventNames]}};let n=e.config.model;return{...t,model:n.source===void 0?{id:n.id,contextWindowTokens:n.contextWindowTokens,maxOutputTokens:n.maxOutputTokens,providerOptions:n.providerOptions}:{contextWindowTokens:n.contextWindowTokens,id:n.id,maxOutputTokens:n.maxOutputTokens,providerOptions:n.providerOptions,source:{exportName:n.source.exportName,sourceKind:`module`,logicalPath:n.source.logicalPath,sourceId:n.source.sourceId}}}}export{ResolveAgentError,resolveAgent};
|
|
1
|
+
import{resolveConnectionDefinition}from"#runtime/resolve-connection.js";import{ResolveAgentError,createResolvedModuleSourceRef}from"#runtime/resolve-helpers.js";import{resolveChannelDefinition}from"#runtime/resolve-channel.js";import{resolveDynamicConnectionDefinition}from"#runtime/resolve-dynamic-connection.js";import{resolveHookDefinition}from"#runtime/resolve-hook.js";import{resolveSandboxDefinition}from"#runtime/resolve-sandbox.js";import{resolveDynamicInstructionsDefinition}from"#runtime/resolve-dynamic-instructions.js";import{resolveDynamicSkillDefinition}from"#runtime/resolve-dynamic-skill.js";import{resolveDynamicToolDefinition}from"#runtime/resolve-dynamic-tool.js";import{resolveToolDefinition}from"#runtime/resolve-tool.js";import{resolveMemoryDefinition}from"#runtime/resolve-memory.js";async function resolveAgent(e){let t=e.manifest.skills.map(t=>({...t,owner:requireCompiledSourceOwner(e.manifest,t),metadata:t.metadata===void 0?void 0:{...t.metadata}})),n=await Promise.all(e.manifest.channelRoutes.effective.map(t=>resolveChannelDefinition(t,e.moduleMap,e.nodeId))),r=await Promise.all(e.manifest.tools.map(t=>resolveToolDefinition(t,e.moduleMap,e.nodeId,requireBindingOwner(e.manifest,t.sourceId)))),i=await Promise.all(e.manifest.dynamicConnections.map(t=>resolveDynamicConnectionDefinition(t,e.moduleMap,e.nodeId))),a=await Promise.all((e.manifest.dynamicInstructions??[]).map(t=>resolveDynamicInstructionsDefinition(t,e.moduleMap,e.nodeId))),o=await Promise.all((e.manifest.dynamicSkills??[]).map(t=>resolveDynamicSkillDefinition(t,e.moduleMap,e.nodeId))),s=await Promise.all(e.manifest.dynamicTools.map(t=>resolveDynamicToolDefinition(t,e.moduleMap,e.nodeId))),c=await Promise.all(e.manifest.hooks.map(t=>resolveHookDefinition(t,e.moduleMap,e.nodeId))),l=await Promise.all(e.manifest.connections.map(t=>resolveConnectionDefinition(t,e.moduleMap,e.nodeId))),u=await Promise.all(e.manifest.memories.map(t=>resolveMemoryDefinition(t,e.moduleMap,e.nodeId))),d=await resolveSandboxDefinition(e.manifest.sandbox,e.moduleMap,e.nodeId),f=e.manifest.instructions.map(t=>createResolvedInstructionsDefinition(e.manifest,t)),p=e.manifest.workspaceResourceRoot,m={channels:n,connections:l,dynamicConnectionResolvers:i,dynamicInstructionsResolvers:a,dynamicSkillResolvers:o,dynamicToolResolvers:s,hooks:c,instructions:f,metadata:{agentRoot:e.manifest.agentRoot,appRoot:e.manifest.appRoot,diagnosticsSummary:e.manifest.diagnosticsSummary},memories:u,sandbox:d,workspaceResourceRoot:p,skills:t,tools:r,workspaceSpec:{rootEntries:[...p.rootEntries]}};return`config`in e.manifest?{...m,config:createResolvedAgentConfig(e.manifest)}:m}function requireBindingOwner(e,t){let n=e.bindings[t];if(n===void 0)throw Error(`Compiled source "${t}" has no binding.`);return n.owner}function createResolvedInstructionsDefinition(e,t){return{content:t.content,name:t.name,owner:requireCompiledSourceOwner(e,t),logicalPath:t.logicalPath,role:t.role,sourceId:t.sourceId,sourceKind:t.sourceKind}}function requireCompiledSourceOwner(e,t){let n=e.bindings[t.sourceId]?.owner??t.owner;if(n===void 0)throw Error(`Compiled source "${t.sourceId}" has no owner.`);return n}function createResolvedAgentConfig(e){let t={name:e.config.name};if(e.config.defaultTools!==void 0&&(t.defaultTools=e.config.defaultTools),e.config.description!==void 0&&(t.description=e.config.description),e.config.compaction!==void 0){let n={};e.config.compaction.model!==void 0&&(n.model=e.config.compaction.model.source===void 0?{contextWindowTokens:e.config.compaction.model.contextWindowTokens,id:e.config.compaction.model.id,maxOutputTokens:e.config.compaction.model.maxOutputTokens,providerOptions:e.config.compaction.model.providerOptions}:{contextWindowTokens:e.config.compaction.model.contextWindowTokens,id:e.config.compaction.model.id,maxOutputTokens:e.config.compaction.model.maxOutputTokens,providerOptions:e.config.compaction.model.providerOptions,source:{exportName:e.config.compaction.model.source.exportName,sourceKind:`module`,logicalPath:e.config.compaction.model.source.logicalPath,sourceId:e.config.compaction.model.source.sourceId}}),e.config.compaction.thresholdPercent!==void 0&&(n.thresholdPercent=e.config.compaction.thresholdPercent),t.compaction=n}if(e.config.experimental!==void 0&&(t.experimental={instrumentationProviders:e.config.experimental.instrumentationProviders,workflow:e.config.experimental.workflow===void 0?void 0:{modelCallsPerStep:e.config.experimental.workflow.modelCallsPerStep,retention:e.config.experimental.workflow.retention,world:e.config.experimental.workflow.world}}),e.config.outputSchema!==void 0&&(t.outputSchema=e.config.outputSchema),e.config.reasoning!==void 0&&(t.reasoning=e.config.reasoning),e.config.source!==void 0&&(t.source=createResolvedModuleSourceRef(e.config.source)),e.config.tool!==void 0&&(t.tool=e.config.tool),e.config.limits!==void 0&&(t.limits={maxInputTokensPerSession:e.config.limits.maxInputTokensPerSession,maxOutputTokensPerSession:e.config.limits.maxOutputTokensPerSession,maxTokenCostUsdPerSession:e.config.limits.maxTokenCostUsdPerSession,sessionTimeoutMs:e.config.limits.sessionTimeoutMs}),e.config.dynamicModel!==void 0)return{...t,dynamicModel:{...createResolvedModuleSourceRef(e.config.dynamicModel),eventNames:[...e.config.dynamicModel.eventNames]}};let n=e.config.model;return{...t,model:n.source===void 0?{id:n.id,contextWindowTokens:n.contextWindowTokens,maxOutputTokens:n.maxOutputTokens,providerOptions:n.providerOptions}:{contextWindowTokens:n.contextWindowTokens,id:n.id,maxOutputTokens:n.maxOutputTokens,providerOptions:n.providerOptions,source:{exportName:n.source.exportName,sourceKind:`module`,logicalPath:n.source.logicalPath,sourceId:n.source.sourceId}}}}export{ResolveAgentError,resolveAgent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{expectFunction,expectObjectRecord}from"#internal/authored-module.js";import{toErrorMessage}from"#shared/errors.js";import{isToolSchema,toInputSchema,toOutputSchema}from"#tools/schema.js";import{registerDefinitionSource,stampDefinitionKey}from"#internal/authored-definition/source-identity.js";import{normalizeApproval}from"#internal/authored-definition/approval.js";import{createWorkflowProgramExecuteInput}from"#tools/workflow-program-input.js";import{ResolveAgentError,loadResolvedModuleExport}from"#runtime/resolve-helpers.js";async function resolveToolDefinition(e,t,n,r){if(!e.hasExecute)return{behavior:e.behavior,description:e.description,inputSchema:toInputSchema(e.inputSchema),logicalPath:e.logicalPath,name:e.name,outputSchema:toOutputSchema(e.outputSchema),owner:r,sourceId:e.sourceId,sourceKind:`module`};try{let i=await loadResolvedModuleExport({definition:e,kindLabel:`tool`,moduleMap:t,nodeId:n}),a=expectObjectRecord(i,describe(e,`to return an object`)),o={kind:`tool`,logicalPath:e.logicalPath,name:e.name,owner:r},s=`tool-source:${e.sourceId}`;stampDefinitionKey(a,s),registerDefinitionSource(s,o),registerDefinitionSource(`tool:${a.description}`,o);let c=expectFunction(a.execute,describe(e,`to provide an execute function`)),l=isToolSchema(a.inputSchema)?a.inputSchema:toInputSchema(e.inputSchema),u=isToolSchema(a.outputSchema)?a.outputSchema:toOutputSchema(e.outputSchema),d=e.workflowProgram,f=d===void 0?void 0:e=>createWorkflowProgramExecuteInput(d,e);return{behavior:e.behavior,description:e.description,execute:c,executeInput:f,execution:e.execution,exportName:e.exportName,inputSchema:l,logicalPath:e.logicalPath,name:e.name,owner:r,outputSchema:u,sourceId:e.sourceId,sourceKind:`module`,...extractOptionalHooks(a,e)}}catch(t){throw t instanceof ResolveAgentError?t:new ResolveAgentError(`Failed to attach the tool execute function from "${e.logicalPath}": ${toErrorMessage(t)}`,{logicalPath:e.logicalPath,sourceId:e.sourceId})}}function extractOptionalHooks(e,t){let n={};if(e.label!==void 0){let r=expectObjectRecord(e.label,describe(t,`to provide a valid label definition`));n.label={complete:r.complete===void 0?void 0:expectFunction(r.complete,describe(t,`to provide an label complete function`)),delta:r.delta===void 0?void 0:expectFunction(r.delta,describe(t,`to provide an label delta function`)),start:expectFunction(r.start,describe(t,`to provide a label start callback function`))}}return e.approval!==void 0&&(n.approval=normalizeApproval(e.approval,describe(t,`to provide a valid approval definition`))),e.approvalKey!==void 0&&(n.approvalKey=expectFunction(e.approvalKey,describe(t,`to provide an approvalKey function`))),e.toModelOutput!==void 0&&(n.toModelOutput=expectFunction(e.toModelOutput,describe(t,`to provide a toModelOutput function`))),n}function describe(e,t){return`Expected the tool export "${e.exportName??`default`}" from "${e.logicalPath}" ${t}.`}export{resolveToolDefinition};
|
|
1
|
+
import{expectFunction,expectObjectRecord}from"#internal/authored-module.js";import{toErrorMessage}from"#shared/errors.js";import{isToolSchema,toInputSchema,toOutputSchema}from"#tools/schema.js";import{registerDefinitionSource,stampDefinitionKey}from"#internal/authored-definition/source-identity.js";import{normalizeApproval}from"#internal/authored-definition/approval.js";import{createWorkflowProgramExecuteInput}from"#tools/workflow-program-input.js";import{ResolveAgentError,loadResolvedModuleExport}from"#runtime/resolve-helpers.js";async function resolveToolDefinition(e,t,n,r){if(!e.hasExecute)return{availableInSubagents:e.availableInSubagents,behavior:e.behavior,description:e.description,inputSchema:toInputSchema(e.inputSchema),logicalPath:e.logicalPath,name:e.name,outputSchema:toOutputSchema(e.outputSchema),owner:r,sourceId:e.sourceId,sourceKind:`module`};try{let i=await loadResolvedModuleExport({definition:e,kindLabel:`tool`,moduleMap:t,nodeId:n}),a=expectObjectRecord(i,describe(e,`to return an object`)),o={kind:`tool`,logicalPath:e.logicalPath,name:e.name,owner:r},s=`tool-source:${e.sourceId}`;stampDefinitionKey(a,s),registerDefinitionSource(s,o),registerDefinitionSource(`tool:${a.description}`,o);let c=expectFunction(a.execute,describe(e,`to provide an execute function`)),l=isToolSchema(a.inputSchema)?a.inputSchema:toInputSchema(e.inputSchema),u=isToolSchema(a.outputSchema)?a.outputSchema:toOutputSchema(e.outputSchema),d=e.workflowProgram,f=d===void 0?void 0:e=>createWorkflowProgramExecuteInput(d,e);return{availableInSubagents:e.availableInSubagents,behavior:e.behavior,description:e.description,execute:c,executeInput:f,execution:e.execution,exportName:e.exportName,inputSchema:l,logicalPath:e.logicalPath,name:e.name,owner:r,outputSchema:u,sourceId:e.sourceId,sourceKind:`module`,...extractOptionalHooks(a,e)}}catch(t){throw t instanceof ResolveAgentError?t:new ResolveAgentError(`Failed to attach the tool execute function from "${e.logicalPath}": ${toErrorMessage(t)}`,{logicalPath:e.logicalPath,sourceId:e.sourceId})}}function extractOptionalHooks(e,t){let n={};if(e.label!==void 0){let r=expectObjectRecord(e.label,describe(t,`to provide a valid label definition`));n.label={complete:r.complete===void 0?void 0:expectFunction(r.complete,describe(t,`to provide an label complete function`)),delta:r.delta===void 0?void 0:expectFunction(r.delta,describe(t,`to provide an label delta function`)),start:expectFunction(r.start,describe(t,`to provide a label start callback function`))}}return e.approval!==void 0&&(n.approval=normalizeApproval(e.approval,describe(t,`to provide a valid approval definition`))),e.approvalKey!==void 0&&(n.approvalKey=expectFunction(e.approvalKey,describe(t,`to provide an approvalKey function`))),e.toModelOutput!==void 0&&(n.toModelOutput=expectFunction(e.toModelOutput,describe(t,`to provide a toModelOutput function`))),n}function describe(e,t){return`Expected the tool export "${e.exportName??`default`}" from "${e.logicalPath}" ${t}.`}export{resolveToolDefinition};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{serializeInputSchema,serializeOutputSchema}from"#tools/schema.js";import{ROOT_RUNTIME_AGENT_NODE_ID}from"#runtime/graph.js";import{AGENT_TOOL_NAME}from"#tools/framework/agent-contract.js";import{subagentToolExecuteWorkflowReference}from"#runtime/subagents/workflow-reference.js";import{RuntimeRegistry}from"#internal/runtime-registry.js";async function createRuntimeToolRegistry(e,t={}){let n=[],r=new RuntimeRegistry(`tool`,t.reservedToolNames??[]);for(let i of e.tools){let e=await createPreparedRuntimeTool(i,t.nodeId);r.register(i.name,{definition:i,prepared:e},{location:{logicalPath:i.logicalPath,sourceId:i.sourceId},duplicateMessage:`Found multiple authored tools named "${i.name}". Tool names must be unique at runtime.`,reservedMessage:`Tool "${i.name}" collides with another runtime-visible tool name.`}),n.push(e)}return{preparedTools:n,toolsByName:r.asMap()}}function findRegisteredRuntimeTool(e,t){return e.toolsByName.get(t)??null}async function createPreparedRuntimeTool(e,t){let n=e.
|
|
1
|
+
import{serializeInputSchema,serializeOutputSchema}from"#tools/schema.js";import{ROOT_RUNTIME_AGENT_NODE_ID}from"#runtime/graph.js";import{AGENT_TOOL_NAME}from"#tools/framework/agent-contract.js";import{subagentToolExecuteWorkflowReference}from"#runtime/subagents/workflow-reference.js";import{RuntimeRegistry}from"#internal/runtime-registry.js";async function createRuntimeToolRegistry(e,t={}){let n=[],r=new RuntimeRegistry(`tool`,t.reservedToolNames??[]);for(let i of e.tools){let e=await createPreparedRuntimeTool(i,t.nodeId);r.register(i.name,{definition:i,prepared:e},{location:{logicalPath:i.logicalPath,sourceId:i.sourceId},duplicateMessage:`Found multiple authored tools named "${i.name}". Tool names must be unique at runtime.`,reservedMessage:`Tool "${i.name}" collides with another runtime-visible tool name.`}),n.push(e)}return{preparedTools:n,toolsByName:r.asMap()}}function findRegisteredRuntimeTool(e,t){return e.toolsByName.get(t)??null}async function createPreparedRuntimeTool(e,t){let n=e.behavior?.handling?.kind===`dispatch`&&e.behavior.handling.action===`self-agent`,r=n?subagentToolExecuteWorkflowReference.workflowId:e.behavior?.handling?.kind===`workflow-tool`?e.behavior.handling.workflowId:void 0;return{availableInSubagents:e.availableInSubagents,behavior:prepareToolBehavior(e.behavior,t,n?subagentToolExecuteWorkflowReference.workflowId:void 0),description:e.description,execution:e.execution,inputSchema:serializeInputSchema(e.inputSchema),kind:`authored-tool`,logicalPath:e.logicalPath,name:e.name,owner:e.owner,outputSchema:serializeOutputSchema(e.outputSchema),rootOnly:n||void 0,sourceId:e.sourceId,task:r===void 0?void 0:n?{nodeId:ROOT_RUNTIME_AGENT_NODE_ID,resultKind:`subagent`,workflowId:r}:{workflowId:r}}}function prepareToolBehavior(e,t,n){if(e===void 0)return;let r;if(n!==void 0&&t!==void 0)r={kind:`dispatch`,target:{kind:`self-agent-call`,nodeId:t,subagentName:AGENT_TOOL_NAME}};else if(e.handling?.kind===`dispatch`){if(e.handling.action===`self-agent`&&t===void 0)throw Error(`The self-agent tool requires a concrete runtime node id.`);r={kind:`dispatch`,target:e.handling.action===`self-agent`?{kind:`self-agent-call`,nodeId:t,subagentName:AGENT_TOOL_NAME}:{kind:e.handling.action}}}else r=e.handling?.kind===`workflow-tool`?{kind:`dispatch`,target:{kind:`workflow-tool-call`,workflowId:n??e.handling.workflowId}}:e.handling;return{availability:e.availability,handling:r,presentation:e.presentation}}export{createRuntimeToolRegistry,findRegisteredRuntimeTool};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AgentInfoResponseError,ClientError}from"#client/index.js";function isRetryableAgentInfoFailure(e){return e instanceof AgentInfoResponseError?!1:e instanceof ClientError?e.status>=500:e instanceof TypeError}function sleep(e){return new Promise(t=>setTimeout(t,e))}async function probeAgentInfo(e){try{return{kind:`ready`,info:await e.
|
|
1
|
+
import{AgentInfoResponseError,ClientError}from"#client/index.js";function isRetryableAgentInfoFailure(e){return e instanceof AgentInfoResponseError?!1:e instanceof ClientError?e.status>=500:e instanceof TypeError}function sleep(e){return new Promise(t=>setTimeout(t,e))}async function probeAgentInfo(e){let t=new AbortController,n,r=new Promise(r=>{n=setTimeout(()=>{let e=Error(`Agent inspection timed out.`);t.abort(e),r({kind:`unavailable`,error:e})},e.timeoutMs??5e3)});try{return await Promise.race([readAgentInfo(e.client,t.signal),r])}finally{clearTimeout(n)}}async function readAgentInfo(e,t){try{return{kind:`ready`,info:await e.info({signal:t})}}catch(e){if(t.aborted||!isRetryableAgentInfoFailure(e))return{kind:`unavailable`,error:e}}await sleep(100);try{return t.throwIfAborted(),{kind:`ready`,info:await e.info({signal:t})}}catch(e){return{kind:`unavailable`,error:e}}}export{probeAgentInfo};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{pathExists}from"../../path-exists.js";import{workspacePatternForProject,workspacePatternsClaimProject}from"../../scaffold/workspace-glob.js";import{readFile,writeFile}from"node:fs/promises";import{dirname,extname,join,resolve}from"node:path";import{existsSync,readFileSync,realpathSync}from"node:fs";const PNPM_WORKSPACE_PATH=`pnpm-workspace.yaml`,PNPM_WORKSPACE_MEMBERSHIP_ARGUMENTS=[`list`,`--depth`,`-1`,`--json`],SHARP_BUILD_POLICY=` sharp: false`,PNPM_WORKSPACE_CONTENT=[`minimumReleaseAgeStrict: true`,`allowBuilds:`,SHARP_BUILD_POLICY,``].join(`
|
|
1
|
+
import{pathExists}from"../../path-exists.js";import{workspacePatternForProject,workspacePatternsClaimProject}from"../../scaffold/workspace-glob.js";import{readFile,writeFile}from"node:fs/promises";import{dirname,extname,join,resolve}from"node:path";import{existsSync,readFileSync,realpathSync}from"node:fs";const PNPM_WORKSPACE_PATH=`pnpm-workspace.yaml`,PNPM_WORKSPACE_MEMBERSHIP_ARGUMENTS=[`list`,`--depth`,`-1`,`--json`],SHARP_BUILD_POLICY=` sharp: false`,PNPM_WORKSPACE_CONTENT=[`minimumReleaseAge: 0`,`minimumReleaseAgeStrict: true`,`allowBuilds:`,SHARP_BUILD_POLICY,``].join(`
|
|
2
2
|
`);function findYamlBlockEnd(e,t){let n=t+1;for(;n<e.length;){let t=e[n]??``;if(t.length>0&&!t.startsWith(` `)&&!t.startsWith(` `))break;n+=1}return n}function withPnpmWorkspacePolicy(e){let t=e.endsWith(`
|
|
3
3
|
`)?e:`${e}\n`,n=t.split(`
|
|
4
4
|
`),r=n.findIndex(e=>e===`allowBuilds:`);if(r<0)return`${t.trim().length===0?``:`${t}\n`}allowBuilds:\n${SHARP_BUILD_POLICY}\n`;let i=findYamlBlockEnd(n,r);if(n.slice(r+1,i).some(e=>/^\s+sharp:/.test(e)))return t;let a=i;for(;a>r+1&&n[a-1]===``;)--a;return n.splice(a,0,SHARP_BUILD_POLICY),n.join(`
|
|
@@ -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_APP_TEMPLATE_FILES}from"./web-template.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.105`,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_APP_TEMPLATE_FILES}from"./web-template.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.105`,DEFAULT_ZOD_PACKAGE_VERSION=`4.5.4`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.61.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{"agent/agent.ts":renderAgentTemplate(e,t),"agent/channels/eve.ts":WEB_APP_TEMPLATE_FILES[`agent/channels/eve.ts`],"agent/instructions.md":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 @@
|
|
|
1
|
+
async function mapConcurrent(e,t,n=8){if(!Number.isInteger(n)||n<1)throw Error(`Concurrency must be a positive integer.`);let r=[],i=0,a=!1,o;if(await Promise.all(Array.from({length:Math.min(n,e.length)},async()=>{for(;!a&&i<e.length;){let n=i++;try{r[n]=await t(e[n],n)}catch(e){a||(o=e),a=!0}}})),a)throw o;return r}export{mapConcurrent};
|
package/dist/src/svelte/index.js
CHANGED
|
@@ -16,6 +16,8 @@ export type ToolExecuteOptions = Omit<ToolExecutionOptions<unknown>, "context">;
|
|
|
16
16
|
export type ToolExecuteFn<TInput = unknown, TOutput = unknown> = (input: TInput, options: ToolExecuteOptions, task?: TaskExec) => Promise<TOutput> | TOutput | AsyncIterable<TOutput>;
|
|
17
17
|
export type ToolExecution = "background";
|
|
18
18
|
interface ToolDefinitionBase {
|
|
19
|
+
/** Whether delegated agent sessions receive this tool. Defaults to `true`. */
|
|
20
|
+
readonly availableInSubagents?: boolean;
|
|
19
21
|
readonly description: string;
|
|
20
22
|
readonly execution?: ToolExecution;
|
|
21
23
|
}
|
|
@@ -16,6 +16,7 @@ import type { ToolModelOutput } from "#tools/model-output.js";
|
|
|
16
16
|
* (Standard Schema) to infer and check the executor return type.
|
|
17
17
|
*/
|
|
18
18
|
export interface DynamicToolEntry<TInput = Record<string, unknown>, TOutput = any> {
|
|
19
|
+
readonly availableInSubagents?: boolean;
|
|
19
20
|
readonly label?: ToolLabelDefinition<TInput, TOutput>;
|
|
20
21
|
readonly description: string;
|
|
21
22
|
readonly inputSchema: PublicToolInputSchema<TInput>;
|
|
@@ -3,5 +3,5 @@ import { type AgentRouterInput } from "#execution/tools/agent-router.js";
|
|
|
3
3
|
import { type BlockingWorkflowToolDefinition } from "#tools/workflow-definition.js";
|
|
4
4
|
export type { AgentRouterInput };
|
|
5
5
|
export type AgentRouterTool = BlockingWorkflowToolDefinition<AgentRouterInput, JsonValue>;
|
|
6
|
-
/** Defines a workflow tool that uses JEV to route a task across all available
|
|
6
|
+
/** Defines a workflow tool that uses JEV to route a task across all available agent targets. */
|
|
7
7
|
export declare function agentRouter(): AgentRouterTool;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineWorkflowTool}from"#tools/workflow-definition.js";import{AGENT_ROUTER_INPUT_SCHEMA,AGENT_ROUTER_TOOL_DESCRIPTION,executeAgentRouterTool}from"#execution/tools/agent-router.js";function agentRouter(){return defineWorkflowTool({description:AGENT_ROUTER_TOOL_DESCRIPTION,execute:executeAgentRouterTool,inputSchema:AGENT_ROUTER_INPUT_SCHEMA})}export{agentRouter};
|
|
1
|
+
import{defineWorkflowTool}from"#tools/workflow-definition.js";import{AGENT_ROUTER_INPUT_SCHEMA,AGENT_ROUTER_TOOL_DESCRIPTION,executeAgentRouterTool}from"#execution/tools/agent-router.js";function agentRouter(){return defineWorkflowTool({availableInSubagents:!1,description:AGENT_ROUTER_TOOL_DESCRIPTION,execute:executeAgentRouterTool,inputSchema:AGENT_ROUTER_INPUT_SCHEMA})}export{agentRouter};
|
|
@@ -53,7 +53,7 @@ interface WorkflowAgent {
|
|
|
53
53
|
* getToken/requireAuth; those capabilities throw in the workflow body itself.
|
|
54
54
|
*/
|
|
55
55
|
export type WorkflowToolContext = Pick<ToolContext, "abortSignal" | "callId" | "session" | "toolName" | "getToken" | "requireAuth"> & {
|
|
56
|
-
/** Invoke an agent by its
|
|
56
|
+
/** Invoke an agent by its invocation name. */
|
|
57
57
|
agent: WorkflowAgent;
|
|
58
58
|
/** Metadata for agents callable by this workflow, including hidden agents. */
|
|
59
59
|
agents: Readonly<Record<string, WorkflowAgentMetadata>>;
|
package/dist/src/vue/index.js
CHANGED
|
@@ -291,7 +291,7 @@ eve add tool/agent
|
|
|
291
291
|
export { default } from "eve/tools/agent";
|
|
292
292
|
```
|
|
293
293
|
|
|
294
|
-
|
|
294
|
+
An authored tool at `agent/tools/agent.ts` replaces the framework behavior. Re-export the definition above to restore direct root-copy delegation, export another tool such as `agentRouter()` to change the model-facing behavior, or disable the slot:
|
|
295
295
|
|
|
296
296
|
```ts title="agent/tools/agent.ts"
|
|
297
297
|
import { disableTool } from "eve/tools";
|
|
@@ -67,37 +67,37 @@ curl http://127.0.0.1:2000/eve/v1/session/<sessionId>/stream
|
|
|
67
67
|
|
|
68
68
|
The stream is newline-delimited JSON (NDJSON), one event per line:
|
|
69
69
|
|
|
70
|
-
| Event | Meaning
|
|
71
|
-
| ------------------------- |
|
|
72
|
-
| `session.started` | A durable session was created; carries `trace` when the runtime is traced.
|
|
73
|
-
| `turn.started` | A new turn began; carries the active `trace` when the runtime is traced.
|
|
74
|
-
| `message.received` |
|
|
75
|
-
| `step.started` | A model step began.
|
|
76
|
-
| `action.input.appended` | A raw tool-input text delta and its tool-call identity.
|
|
77
|
-
| `actions.requested` | The model requested one or more actions, including tool calls; calls stream before execution.
|
|
78
|
-
| `action.partial` | A locally executed tool generator yielded a preliminary output snapshot.
|
|
79
|
-
| `action.result` | A tool call returned.
|
|
80
|
-
| `input.requested` | The run paused for human input ([HITL](/docs/human-in-the-loop) approval or `ask_question`); carries `requests`.
|
|
81
|
-
| `input.resolved` | The server accepted terminal human-input outcomes; carries `resolutions` with responses when provided.
|
|
82
|
-
| `subagent.called` | A subagent was delegated; carries `childSessionId` to attach to.
|
|
83
|
-
| `subagent.completed` | A background subagent was admitted and returned its task receipt.
|
|
84
|
-
| `reasoning.appended` | A reasoning text delta.
|
|
85
|
-
| `reasoning.completed` | The finalized reasoning block.
|
|
86
|
-
| `message.appended` | An assistant text delta.
|
|
87
|
-
| `message.completed` | A finalized assistant text block.
|
|
88
|
-
| `result.completed` | The finalized structured result for a turn that requested an output schema; carries `result`.
|
|
89
|
-
| `compaction.requested` | Context-window compaction began; carries `modelId`, `sessionId`, `turnId`, `usageInputTokens`.
|
|
90
|
-
| `compaction.completed` | A compaction checkpoint was written to durable history.
|
|
91
|
-
| `authorization.required` | A connection needs OAuth; carries `name`, `description`, and an `authorization` challenge.
|
|
92
|
-
| `authorization.completed` | A connection's authorization resolved; carries `outcome`.
|
|
93
|
-
| `step.completed` | A model step finished; carries `finishReason` and usage.
|
|
94
|
-
| `step.failed` | A model step failed; carries `{ code, message, details? }`.
|
|
95
|
-
| `turn.completed` | The turn finished.
|
|
96
|
-
| `turn.failed` | The turn failed; carries `{ code, message, details? }`.
|
|
97
|
-
| `turn.cancelled` | The turn was cancelled before finishing; always followed by `session.waiting`.
|
|
98
|
-
| `session.waiting` | The session parked and is ready for the next message.
|
|
99
|
-
| `session.failed` | The session failed.
|
|
100
|
-
| `session.completed` | The session reached a terminal end.
|
|
70
|
+
| Event | Meaning |
|
|
71
|
+
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
72
|
+
| `session.started` | A durable session was created; carries `trace` when the runtime is traced. |
|
|
73
|
+
| `turn.started` | A new turn began; carries the active `trace` when the runtime is traced. |
|
|
74
|
+
| `message.received` | Input reached a turn; carries flattened text plus structured text/file parts. Task-authored input sets `data.kind` to `execution.background_task`. |
|
|
75
|
+
| `step.started` | A model step began. |
|
|
76
|
+
| `action.input.appended` | A raw tool-input text delta and its tool-call identity. |
|
|
77
|
+
| `actions.requested` | The model requested one or more actions, including tool calls; calls stream before execution. |
|
|
78
|
+
| `action.partial` | A locally executed tool generator yielded a preliminary output snapshot. |
|
|
79
|
+
| `action.result` | A tool call returned. |
|
|
80
|
+
| `input.requested` | The run paused for human input ([HITL](/docs/human-in-the-loop) approval or `ask_question`); carries `requests`. |
|
|
81
|
+
| `input.resolved` | The server accepted terminal human-input outcomes; carries `resolutions` with responses when provided. |
|
|
82
|
+
| `subagent.called` | A subagent was delegated; carries `childSessionId` to attach to. |
|
|
83
|
+
| `subagent.completed` | A background subagent was admitted and returned its task receipt. |
|
|
84
|
+
| `reasoning.appended` | A reasoning text delta. |
|
|
85
|
+
| `reasoning.completed` | The finalized reasoning block. |
|
|
86
|
+
| `message.appended` | An assistant text delta. |
|
|
87
|
+
| `message.completed` | A finalized assistant text block. |
|
|
88
|
+
| `result.completed` | The finalized structured result for a turn that requested an output schema; carries `result`. |
|
|
89
|
+
| `compaction.requested` | Context-window compaction began; carries `modelId`, `sessionId`, `turnId`, `usageInputTokens`. |
|
|
90
|
+
| `compaction.completed` | A compaction checkpoint was written to durable history. |
|
|
91
|
+
| `authorization.required` | A connection needs OAuth; carries `name`, `description`, and an `authorization` challenge. |
|
|
92
|
+
| `authorization.completed` | A connection's authorization resolved; carries `outcome`. |
|
|
93
|
+
| `step.completed` | A model step finished; carries `finishReason` and usage. |
|
|
94
|
+
| `step.failed` | A model step failed; carries `{ code, message, details? }`. |
|
|
95
|
+
| `turn.completed` | The turn finished. |
|
|
96
|
+
| `turn.failed` | The turn failed; carries `{ code, message, details? }`. |
|
|
97
|
+
| `turn.cancelled` | The turn was cancelled before finishing; always followed by `session.waiting`. |
|
|
98
|
+
| `session.waiting` | The session parked and is ready for the next message. |
|
|
99
|
+
| `session.failed` | The session failed. |
|
|
100
|
+
| `session.completed` | The session reached a terminal end. |
|
|
101
101
|
|
|
102
102
|
The optional `data.trace` on session and turn starts contains eve-owned W3C trace coordinates: `traceId`, `spanId`, and `traceFlags`. Use it to correlate stream consumers such as eval reporters with an observability backend. An uninstrumented target omits it.
|
|
103
103
|
|
|
@@ -119,7 +119,7 @@ Note: consider the privacy, confidentiality, and user-experience implications fo
|
|
|
119
119
|
|
|
120
120
|
When a task explicitly requires conditional delivery and there is nothing new to report, the agent can finish with exactly `<eve-empty-delivery/>`. eve emits `message.completed` with `message: null` for that intentional silence. The marker must be the entire response, apart from surrounding whitespace; the HTML-escaped form `<eve-empty-delivery/>` is also accepted. A response that quotes the marker in prose or code is delivered normally.
|
|
121
121
|
|
|
122
|
-
A delegated subagent publishes progress on its own child-session stream. The parent emits `subagent.called` with a `childSessionId`, which a client uses to attach. `subagent.completed` carries a working task receipt after admission; terminal outcomes arrive as task-triggered `message.received` notifications.
|
|
122
|
+
A delegated subagent publishes progress on its own child-session stream. The parent emits `subagent.called` with a `childSessionId`, which a client uses to attach. `subagent.completed` carries a working task receipt after admission; terminal outcomes arrive as task-triggered `message.received` notifications with `data.kind: "execution.background_task"`. The default frontend reducer retains these events in `events` but does not project their runtime-authored text as participant messages.
|
|
123
123
|
|
|
124
124
|
`step.failed` and `turn.failed` carry `{ code, message, details? }` for the failed fragment or turn, and `session.failed` is the terminal session-level variant. `turn.cancelled` is not a failure: the cancelled turn ends without any failure event, `session.waiting` follows, and the session accepts the next message normally. Whatever the turn streamed before cancellation stays on the stream. Durable history keeps the accepted user input and previously settled work, but discards incomplete assistant output and unfinished tool state. When a turn requested an output schema, the finalized payload lands on `result.completed` as `data.result` before the turn boundary. `authorization.required` carries the sign-in challenge (`data.authorization` may include `url`, `userCode`, `expiresAt`, `instructions`), and `authorization.completed` carries `data.outcome` (`"authorized" | "declined" | "failed" | "timed-out"`).
|
|
125
125
|
|
|
@@ -41,6 +41,8 @@ const info = await client.info();
|
|
|
41
41
|
console.log(info.agent.name, info.agent.model.id);
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
+
Pass `info({ signal })` to cancel the HTTP request. The signal is checked only after custom header and credential callbacks resolve; it does not limit how long those callbacks or the complete `info()` call can take.
|
|
45
|
+
|
|
44
46
|
Version 4 separates active static definitions from dynamic resolvers, includes binding-backed source ownership and composition history, reports first-class memory slots and their provider-tool wrapper dependencies, reports local and remote agents separately, and returns the exact compiled channel route order. A non-success response throws `ClientError`; invalid JSON, an earlier schema version, duplicate identities, inconsistent totals, or mismatched source provenance throws `AgentInfoResponseError`.
|
|
45
47
|
|
|
46
48
|
## Authentication
|
|
@@ -156,8 +156,12 @@ retry a failed prewarm on unrelated renders while the option remains `true`; cal
|
|
|
156
156
|
change the option from `false` to `true` again, reset, or send a message to recover.
|
|
157
157
|
|
|
158
158
|
The hook keeps consuming one session stream across turns and idle periods. Replies,
|
|
159
|
-
authorization updates, and turns started elsewhere all update the same projection
|
|
160
|
-
|
|
159
|
+
authorization updates, and turns started elsewhere all update the same projection, including
|
|
160
|
+
background-task results that arrive during another send. Separately delivered participant messages
|
|
161
|
+
remain separate bubbles even when they steer the same active turn; a single event that coalesces
|
|
162
|
+
multiple deliveries remains one bubble. Runtime-authored task input remains in the
|
|
163
|
+
event stream with `data.kind: "execution.background_task"`, but the default reducer does not render
|
|
164
|
+
it as a participant message. A turn settling does not close the connection. The transport reconnects from its cursor after a disconnect or the
|
|
161
165
|
server's renewable 60-second lease; lease renewal does not start a turn or clear UI state.
|
|
162
166
|
Unmounting or resetting closes the local stream without cancelling the old durable session.
|
|
163
167
|
|
|
@@ -320,7 +324,7 @@ const agent = useEveAgent({
|
|
|
320
324
|
});
|
|
321
325
|
```
|
|
322
326
|
|
|
323
|
-
The `optimistic` option (default `true`) projects submitted user messages into `data` before eve confirms them with a `message.received` event. These are reducer-facing projection events only. `events` stays the authoritative eve stream.
|
|
327
|
+
The `optimistic` option (default `true`) projects submitted user messages into `data` before eve confirms them with a `message.received` event. These are reducer-facing projection events only. `events` stays the authoritative eve stream. For an existing session, the hook reconciles each placeholder with the server's delivery ID, so an unrelated or identical message cannot consume it.
|
|
324
328
|
|
|
325
329
|
## Custom reducer
|
|
326
330
|
|
|
@@ -108,7 +108,7 @@ import template from "../../prompts/template.txt?raw";
|
|
|
108
108
|
| `ctx.getToken(provider)` | Resolve a bearer token for an inline auth provider such as `connect("...")` |
|
|
109
109
|
| `ctx.requireAuth(provider)` | Evict and re-authorize an inline provider, commonly after a downstream `401` |
|
|
110
110
|
|
|
111
|
-
Authored workflow tools also receive `ctx.agents`, a replay-stable map of
|
|
111
|
+
Tool definitions accept `availableInSubagents: false` to restrict the tool to top-level root sessions. Authored workflow tools also receive `ctx.agents`, a replay-stable map of callable-agent metadata, and `ctx.agent(name, input)` for invocation. The root-copy `agent` entry has an empty description when the root omits `description`. See [Workflows as tools](../tools/workflows#delegate-work-ctxagent) for the workflow-only context.
|
|
112
112
|
|
|
113
113
|
## Imports at a glance
|
|
114
114
|
|
package/docs/subagents/index.mdx
CHANGED
|
@@ -49,7 +49,7 @@ export default defineAgent({
|
|
|
49
49
|
});
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
You can also export `disableTool()` from `agent/tools/agent.ts`.
|
|
52
|
+
You can also export `disableTool()` from `agent/tools/agent.ts`. Any authored tool at that path replaces the model-facing framework tool and takes priority over `tool: false`; re-export `eve/tools/agent` to keep direct root-copy delegation. Tool composition does not change the callable-agent registry: a workflow in a top-level root session can still invoke the root copy with `ctx.agent("agent", ...)` and read its description from `ctx.agents.agent`.
|
|
53
53
|
|
|
54
54
|
## Declared subagents
|
|
55
55
|
|
|
@@ -64,7 +64,7 @@ export default defineAgent({
|
|
|
64
64
|
});
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
`description` is required. The parent reads it to decide whether to delegate, so the compiler rejects any subagent whose `agent.ts` leaves it out. Set `tool: false` to keep the subagent out of the parent model's tools while allowing an authored [workflow tool](/docs/tools/workflows) to call it by name through `ctx.agent()`:
|
|
67
|
+
`description` is required. The parent reads it to decide whether to delegate, so the compiler rejects any subagent whose `agent.ts` leaves it out. The path-derived invocation name `agent` is reserved for the built-in root-copy target; rename a declared subagent at `agent/subagents/agent/`. Namespaced names such as `crm__agent` do not collide and remain valid. Set `tool: false` to keep the subagent out of the parent model's tools while allowing an authored [workflow tool](/docs/tools/workflows) to call it by name through `ctx.agent()`:
|
|
68
68
|
|
|
69
69
|
```ts title="agent/subagents/researcher/agent.ts"
|
|
70
70
|
import { defineAgent } from "eve";
|
|
@@ -216,7 +216,7 @@ eve lowers every tool-enabled subagent visible to the current agent (the root bu
|
|
|
216
216
|
|
|
217
217
|
Declared subagents can call nested subagents defined under their own directories. eve does not apply a separate depth limit; nesting ends where the authored directory tree ends. The built-in `agent` follows the stricter root-only rule above, so `limits.maxSubagentDepth` no longer exists.
|
|
218
218
|
|
|
219
|
-
Child sessions can still call their own declared or remote subagents, but they do not receive the built-in `agent`. Authored workflow tools use the same subagent availability and authorization checks as direct delegation.
|
|
219
|
+
Child sessions can still call their own declared or remote subagents, but they do not receive the built-in `agent`. Authored workflow tools use the same subagent availability and authorization checks as direct delegation. In a delegated root copy, `ctx.agents` also omits `agent`, so a router cannot select another root copy recursively.
|
|
220
220
|
|
|
221
221
|
A directly declared subagent's tool name is the bare path-derived name, with no prefix. `agent/subagents/researcher/` registers as the tool `researcher`. A subagent supplied by a mounted extension includes the mount namespace, such as `crm__reviewer`. The model, approvals, logs, and evals reference the resulting name. Its input schema is:
|
|
222
222
|
|
package/docs/tools/overview.mdx
CHANGED
|
@@ -32,6 +32,23 @@ A tool definition needs:
|
|
|
32
32
|
|
|
33
33
|
When a tool returns structured data, add an optional `outputSchema`. With Zod or Standard Schema it also types the `execute` return.
|
|
34
34
|
|
|
35
|
+
### Hide a tool from delegated agents
|
|
36
|
+
|
|
37
|
+
Set `availableInSubagents: false` when a tool should be callable only in a top-level root session:
|
|
38
|
+
|
|
39
|
+
```ts title="agent/tools/coordinator.ts"
|
|
40
|
+
export default defineTool({
|
|
41
|
+
availableInSubagents: false,
|
|
42
|
+
description: "Coordinate work that only the top-level root agent should start.",
|
|
43
|
+
inputSchema: z.object({ task: z.string() }),
|
|
44
|
+
execute({ task }) {
|
|
45
|
+
return coordinate(task);
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The option defaults to `true` and works with `defineTool` and `defineWorkflowTool`. A root copy does not receive a tool with this option, and a tool authored inside a declared subagent is unavailable because that agent runs in a delegated session. This controls tool availability only; it does not add or remove entries from a workflow's `ctx.agents` registry.
|
|
51
|
+
|
|
35
52
|
Compiled tools preserve Zod schema composition, including input and output schemas imported from helper modules. Durable replay metadata stays separate from the original schema, so adding it does not mutate shared schema objects.
|
|
36
53
|
|
|
37
54
|
### Label tool activity
|
package/docs/tools/workflows.mdx
CHANGED
|
@@ -15,7 +15,7 @@ suspend in either execution mode; running in the background does not require a s
|
|
|
15
15
|
|
|
16
16
|
Workflow tools use the [Workflow SDK](https://workflow-sdk.dev): `"use workflow"`, `"use step"`, `createHook`,
|
|
17
17
|
`createWebhook`, `sleep`, retries, and replay. eve provides `ctx.ask` for questions answered through
|
|
18
|
-
the session's channel, `ctx.agents` for effective
|
|
18
|
+
the session's channel, `ctx.agents` for effective callable-agent descriptions, and `ctx.agent` for durable agent delegation. Use `yield` to report
|
|
19
19
|
progress and `await` on a workflow operation to wait durably. Values needed after a durable wait
|
|
20
20
|
stay in local variables in the workflow body.
|
|
21
21
|
|
|
@@ -317,13 +317,24 @@ const result = await ctx.agent("reviewer", {
|
|
|
317
317
|
});
|
|
318
318
|
```
|
|
319
319
|
|
|
320
|
-
The first argument is
|
|
320
|
+
The first argument is an available agent target. On the root agent, `"agent"` starts or continues a copy of the root agent. A declared subagent uses its path-derived name and remains callable when hidden with `tool: false` or `disableTool()`. Delegated root copies and declared subagent contexts do not expose the built-in root-copy target. The invocation name `agent` is reserved, so a declared subagent cannot shadow it. eve assigns each call a replay-stable invocation identity, including repeated and parallel calls to the same target. Pass `agentId` to
|
|
321
321
|
continue an existing child. An inline `outputSchema` requires structured output and determines the
|
|
322
322
|
return type, so `result` in the example is typed as `{ findings: string[] }`.
|
|
323
323
|
|
|
324
324
|
### Route to a hidden subagent with JEV
|
|
325
325
|
|
|
326
|
-
Use an authored workflow tool when the parent model should decide to delegate, but JEV should choose the specialist. Set `tool: false` on each specialist so the parent model sees only the routing tool. The specialists remain available through `ctx.agents` and callable through `ctx.agent()
|
|
326
|
+
Use an authored workflow tool when the parent model should decide to delegate, but JEV should choose the specialist. Set `tool: false` on each specialist so the parent model sees only the routing tool. The specialists remain available through `ctx.agents` and callable through `ctx.agent()`.
|
|
327
|
+
|
|
328
|
+
If the router may select the root-copy `agent`, author a root `description` that explains which work should stay with a copy of the root. `ctx.agents.agent` always exists in a top-level root workflow, but its `description` is an empty string when omitted from `agent.ts`. `agentRouter()` considers only entries with a non-empty description, so it does not route to an undescribed root copy.
|
|
329
|
+
|
|
330
|
+
```ts title="agent/agent.ts"
|
|
331
|
+
import { defineAgent } from "eve";
|
|
332
|
+
|
|
333
|
+
export default defineAgent({
|
|
334
|
+
description: "Coordinate cross-specialist tasks that need the root agent's complete toolset.",
|
|
335
|
+
model: "anthropic/claude-opus-4.8",
|
|
336
|
+
});
|
|
337
|
+
```
|
|
327
338
|
|
|
328
339
|
```ts title="agent/subagents/researcher/agent.ts"
|
|
329
340
|
import { defineAgent } from "eve";
|
|
@@ -388,19 +399,19 @@ export default defineWorkflowTool({
|
|
|
388
399
|
|
|
389
400
|
The evaluation runs in a step so workflow replay records its result instead of making the routing request again. The parent model receives `agent-router`, but not `researcher` or `operator`. JEV returns the typed `"researcher" | "operator"` choice, and the selected subagent's result becomes the `agent-router` tool result.
|
|
390
401
|
|
|
391
|
-
`ctx.agents` is a replay-stable metadata snapshot taken when the workflow starts.
|
|
402
|
+
`ctx.agents` is a replay-stable metadata snapshot taken when the workflow starts. In a top-level root workflow, `ctx.agents.agent` always represents the root-copy target and carries the root's authored `description` when provided. The snapshot also includes declared agents hidden from the parent model with `tool: false` or `disableTool()`, but exposes no model definitions, credentials, or callbacks. A delegated root copy omits `agent`, so `agentRouter()` cannot select another root copy recursively. Invocation still checks each target's availability through `ctx.agent()`.
|
|
392
403
|
|
|
393
|
-
#### Route across every
|
|
404
|
+
#### Route across every agent target
|
|
394
405
|
|
|
395
|
-
|
|
406
|
+
To replace the model-facing `agent` tool with a router across every target in `ctx.agents`, export `agentRouter()` from the `agent` slot:
|
|
396
407
|
|
|
397
|
-
```ts title="agent/tools/agent
|
|
408
|
+
```ts title="agent/tools/agent.ts"
|
|
398
409
|
import { agentRouter } from "eve/tools/agent-router";
|
|
399
410
|
|
|
400
411
|
export default agentRouter();
|
|
401
412
|
```
|
|
402
413
|
|
|
403
|
-
Its input is `{ message: string, outputSchema?: object }`. With two or more
|
|
414
|
+
Its input is `{ message: string, outputSchema?: object }`. `agentRouter()` ignores entries without a non-empty description. With two or more described targets, it sends the message and effective descriptions to JEV, then invokes the selected name through `ctx.agent()`. It invokes a sole target without evaluation and forwards an optional `outputSchema`. In a top-level root session, the candidates include the root-copy `agent`; delegated root copies and declared subagent contexts include only their declared targets.
|
|
404
415
|
|
|
405
416
|
This pattern controls specialist selection, not whether the parent model delegates at all. Route before the parent model runs if every incoming request must go through JEV.
|
|
406
417
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eve",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.61.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Filesystem-first framework for durable backend AI agents that run anywhere.",
|
|
6
6
|
"keywords": [
|
|
@@ -496,14 +496,14 @@
|
|
|
496
496
|
"@vercel/otel": "2.1.3",
|
|
497
497
|
"@vercel/sandbox": "3.3.0",
|
|
498
498
|
"@vercel/sdk": "1.28.8",
|
|
499
|
-
"@workflow/builders": "5.0.0-beta.
|
|
500
|
-
"@workflow/core": "5.0.0-beta.
|
|
499
|
+
"@workflow/builders": "5.0.0-beta.53",
|
|
500
|
+
"@workflow/core": "5.0.0-beta.53",
|
|
501
501
|
"@workflow/errors": "5.0.0-beta.21",
|
|
502
502
|
"@workflow/serde": "5.0.0-beta.2",
|
|
503
503
|
"@workflow/utils": "5.0.0-beta.10",
|
|
504
|
-
"@workflow/world": "5.0.0-beta.
|
|
505
|
-
"@workflow/world-local": "5.0.0-beta.
|
|
506
|
-
"@workflow/world-vercel": "5.0.0-beta.
|
|
504
|
+
"@workflow/world": "5.0.0-beta.36",
|
|
505
|
+
"@workflow/world-local": "5.0.0-beta.45",
|
|
506
|
+
"@workflow/world-vercel": "5.0.0-beta.48",
|
|
507
507
|
"ai": "^7.0.105",
|
|
508
508
|
"autoevals": "0.0.132",
|
|
509
509
|
"chat": "4.34.0",
|
|
@@ -575,7 +575,7 @@
|
|
|
575
575
|
"clean": "node -e \"fs.rmSync('dist', { recursive: true, force: true })\"",
|
|
576
576
|
"build": "pnpm run check:bin-runtime-dependencies && pnpm run build:js && node ./scripts/copy-docs.mjs && node ./scripts/stamp-version-tokens.mjs",
|
|
577
577
|
"build:compiled": "node ./scripts/vendor-compiled.mjs",
|
|
578
|
-
"build:js": "
|
|
578
|
+
"build:js": "node ./scripts/build-js.mjs",
|
|
579
579
|
"build:types": "pnpm run build:compiled && tsc -p tsconfig.build.json",
|
|
580
580
|
"check:bin-runtime-dependencies": "node ./scripts/check-bin-runtime-dependencies.mjs",
|
|
581
581
|
"dev": "pnpm run build:compiled && node ./scripts/copy-runtime-assets.mjs && tsc -p tsconfig.dev.json --watch --preserveWatchOutput",
|