eve 0.11.8 → 0.11.9
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 +6 -0
- package/dist/src/compiler/manifest.d.ts +2 -2
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/compiler/normalize-manifest.js +1 -1
- package/dist/src/compiler/normalize-subagent.d.ts +1 -0
- package/dist/src/compiler/normalize-subagent.js +1 -1
- package/dist/src/internal/application/compiled-artifacts.d.ts +7 -0
- package/dist/src/internal/application/compiled-artifacts.js +4 -4
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/core.js +1 -1
- package/dist/src/internal/workflow/configure-world.d.ts +12 -0
- package/dist/src/internal/workflow/configure-world.js +1 -0
- package/dist/src/public/definitions/agent.d.ts +1 -1
- package/dist/src/public/index.d.ts +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/shared/agent-definition.d.ts +23 -0
- package/docs/agent-config.md +33 -6
- package/docs/concepts/default-harness.md +14 -14
- package/docs/concepts/execution-model-and-durability.md +16 -1
- package/docs/concepts/sessions-runs-and-streaming.md +27 -27
- package/docs/guides/deployment.md +17 -2
- package/docs/guides/frontend/overview.mdx +1 -1
- package/docs/reference/typescript-api.md +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# eve
|
|
2
2
|
|
|
3
|
+
## 0.11.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4bfbaa0: Add root agent `experimental.workflow.world` configuration for selecting an installed Workflow world package. Eve now loads and registers the configured world at runtime and documents how self-hosted deployments can provide a custom Workflow world.
|
|
8
|
+
|
|
3
9
|
## 0.11.8
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -18,7 +18,7 @@ export declare const ROOT_COMPILED_AGENT_NODE_ID = "__root__";
|
|
|
18
18
|
/**
|
|
19
19
|
* Current compiled manifest schema version.
|
|
20
20
|
*/
|
|
21
|
-
export declare const COMPILED_AGENT_MANIFEST_VERSION =
|
|
21
|
+
export declare const COMPILED_AGENT_MANIFEST_VERSION = 30;
|
|
22
22
|
/**
|
|
23
23
|
* Compiled channel entry preserved in the compiled manifest.
|
|
24
24
|
*/
|
|
@@ -449,7 +449,7 @@ export declare const compiledAgentManifestSchema: z.ZodObject<{
|
|
|
449
449
|
sourceId: z.ZodString;
|
|
450
450
|
sourceKind: z.ZodLiteral<"module">;
|
|
451
451
|
}, z.core.$strict>>;
|
|
452
|
-
version: z.ZodLiteral<
|
|
452
|
+
version: z.ZodLiteral<30>;
|
|
453
453
|
workspaceResourceRoot: z.ZodObject<{
|
|
454
454
|
contentHash: z.ZodOptional<z.ZodString>;
|
|
455
455
|
logicalPath: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from"#compiled/zod/index.js";import{discoverDiagnosticsSummarySchema}from"#discover/diagnostics.js";import{compiledRemoteAgentNodeSchema}from"#compiler/remote-agent-node.js";import{jsonObjectSchema}from"#shared/json-schemas.js";const COMPILED_AGENT_MANIFEST_KIND=`eve-agent-compiled-manifest`,ROOT_COMPILED_AGENT_NODE_ID=`__root__`,COMPILED_AGENT_MANIFEST_VERSION=29,moduleSourceRefSchema=z.object({exportName:z.string().optional(),sourceKind:z.literal(`module`),logicalPath:z.string(),sourceId:z.string()}).strict(),channelMethodSchema=z.union([z.literal(`GET`),z.literal(`POST`),z.literal(`PUT`),z.literal(`PATCH`),z.literal(`DELETE`),z.literal(`WEBSOCKET`)]),compiledChannelDefinitionSchema=z.object({kind:z.literal(`channel`),name:z.string(),logicalPath:z.string(),method:channelMethodSchema,urlPath:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`),exportName:z.string().optional(),adapterKind:z.string().optional()}).strict(),disabledCompiledChannelEntrySchema=z.object({kind:z.literal(`disabled`),name:z.string(),logicalPath:z.string()}).strict(),compiledChannelEntrySchema=z.union([compiledChannelDefinitionSchema,disabledCompiledChannelEntrySchema]),modelRoutingSchema=z.union([z.object({kind:z.literal(`gateway`),target:z.string(),byok:z.string().optional()}).strict(),z.object({kind:z.literal(`external`),provider:z.string()}).strict()]),compiledRuntimeModelReferenceSchema=z.object({contextWindowTokens:z.number().int().positive().optional(),id:z.string(),source:moduleSourceRefSchema.optional(),providerOptions:z.record(z.string(),jsonObjectSchema).optional(),routing:modelRoutingSchema}).strict(),compiledAgentBuildDefinitionSchema=z.object({externalDependencies:z.array(z.string()).optional()}).strict(),compiledAgentCompactionDefinitionSchema=z.object({model:compiledRuntimeModelReferenceSchema.optional(),thresholdPercent:z.number().finite().min(0).max(1).optional()}).strict(),compiledAgentConfigSchema=z.object({build:compiledAgentBuildDefinitionSchema.optional(),compaction:compiledAgentCompactionDefinitionSchema.optional(),description:z.string().optional(),experimental:z.object({codeMode:z.boolean().optional()}).strict().optional(),model:compiledRuntimeModelReferenceSchema,name:z.string(),outputSchema:jsonObjectSchema.optional(),source:moduleSourceRefSchema.optional()}).strict(),compiledInstructionsSchema=z.object({name:z.string(),logicalPath:z.string(),markdown:z.string(),sourceId:z.string(),sourceKind:z.union([z.literal(`markdown`),z.literal(`module`)])}).strict(),compiledSkillBaseFields={name:z.string(),description:z.string(),license:z.string().optional(),markdown:z.string(),metadata:z.record(z.string(),z.string()).optional(),sourceId:z.string(),logicalPath:z.string()},compiledSkillSourceSchema=z.discriminatedUnion(`sourceKind`,[z.object({...compiledSkillBaseFields,sourceKind:z.literal(`markdown`)}).strict(),z.object({...compiledSkillBaseFields,sourceKind:z.literal(`module`),exportName:z.string().optional()}).strict(),z.object({...compiledSkillBaseFields,sourceKind:z.literal(`skill-package`),skillId:z.string(),skillFilePath:z.string(),rootPath:z.string(),assetsPath:z.string().optional(),referencesPath:z.string().optional(),scriptsPath:z.string().optional()}).strict()]),compiledScheduleDefinitionSchema=z.object({cron:z.string(),hasRun:z.boolean(),name:z.string(),logicalPath:z.string(),markdown:z.string().optional(),sourceId:z.string(),sourceKind:z.union([z.literal(`markdown`),z.literal(`module`)])}).strict(),compiledSandboxDefinitionSchema=z.object({backendName:z.string().optional(),description:z.string().optional(),exportName:z.string().optional(),logicalPath:z.string(),revalidationKey:z.string().optional(),sourceHash:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledSandboxWorkspaceSchema=z.object({logicalPath:z.string(),rootEntries:z.array(z.string()).readonly(),sourceId:z.string(),sourcePath:z.string()}).strict(),compiledWorkspaceResourceRootSchema=z.object({contentHash:z.string().optional(),logicalPath:z.string(),rootEntries:z.array(z.string()).readonly()}).strict(),compiledConnectionDefinitionSchema=z.object({connectionName:z.string(),description:z.string(),exportName:z.string().optional(),logicalPath:z.string(),protocol:z.enum([`mcp`,`openapi`]).default(`mcp`),sourceId:z.string(),sourceKind:z.literal(`module`),url:z.string(),vercelConnect:z.object({connector:z.string()}).strict().optional()}).strict(),compiledToolDefinitionSchema=z.object({description:z.string(),exportName:z.string().optional(),inputSchema:jsonObjectSchema.nullable(),logicalPath:z.string(),name:z.string(),outputSchema:jsonObjectSchema.optional(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledDynamicToolDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),logicalPath:z.string(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledDynamicSkillDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),logicalPath:z.string(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledDynamicInstructionsDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),logicalPath:z.string(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledHookDefinitionSchema=z.object({exportName:z.string().optional(),logicalPath:z.string(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledAgentNodeManifestSchema=z.object({agentRoot:z.string(),appRoot:z.string(),channels:z.array(compiledChannelEntrySchema),config:compiledAgentConfigSchema,connections:z.array(compiledConnectionDefinitionSchema),diagnosticsSummary:discoverDiagnosticsSummarySchema,disabledFrameworkTools:z.array(z.string()).readonly(),workflowEnabled:z.boolean().default(!1),dynamicInstructions:z.array(compiledDynamicInstructionsDefinitionSchema).default([]),dynamicSkills:z.array(compiledDynamicSkillDefinitionSchema).default([]),dynamicTools:z.array(compiledDynamicToolDefinitionSchema).default([]),hooks:z.array(compiledHookDefinitionSchema),sandbox:compiledSandboxDefinitionSchema.nullable(),sandboxWorkspaces:z.array(compiledSandboxWorkspaceSchema),schedules:z.array(compiledScheduleDefinitionSchema),remoteAgents:z.array(compiledRemoteAgentNodeSchema),skills:z.array(compiledSkillSourceSchema).readonly(),instructions:compiledInstructionsSchema.optional(),tools:z.array(compiledToolDefinitionSchema),workspaceResourceRoot:compiledWorkspaceResourceRootSchema}).strict(),compiledSubagentNodeSchema=z.object({agent:compiledAgentNodeManifestSchema,description:z.string(),entryPath:z.string(),logicalPath:z.string(),name:z.string(),nodeId:z.string(),rootPath:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`),exportName:z.string().optional()}).strict(),compiledSubagentEdgeSchema=z.object({childNodeId:z.string(),parentNodeId:z.string()}).strict(),compiledAgentManifestSchema=z.object({agentRoot:z.string(),appRoot:z.string(),channels:z.array(compiledChannelEntrySchema),config:compiledAgentConfigSchema,connections:z.array(compiledConnectionDefinitionSchema),diagnosticsSummary:discoverDiagnosticsSummarySchema,disabledFrameworkTools:z.array(z.string()).readonly(),workflowEnabled:z.boolean().default(!1),dynamicInstructions:z.array(compiledDynamicInstructionsDefinitionSchema).default([]),dynamicSkills:z.array(compiledDynamicSkillDefinitionSchema).default([]),dynamicTools:z.array(compiledDynamicToolDefinitionSchema).default([]),hooks:z.array(compiledHookDefinitionSchema),kind:z.literal(COMPILED_AGENT_MANIFEST_KIND),remoteAgents:z.array(compiledRemoteAgentNodeSchema),sandbox:compiledSandboxDefinitionSchema.nullable(),sandboxWorkspaces:z.array(compiledSandboxWorkspaceSchema),schedules:z.array(compiledScheduleDefinitionSchema),skills:z.array(compiledSkillSourceSchema).readonly(),subagentEdges:z.array(compiledSubagentEdgeSchema),subagents:z.array(compiledSubagentNodeSchema),instructions:compiledInstructionsSchema.optional(),tools:z.array(compiledToolDefinitionSchema),version:z.literal(29),workspaceResourceRoot:compiledWorkspaceResourceRootSchema}).strict();function createCompiledAgentNodeManifest(e){let t={agentRoot:e.agentRoot,appRoot:e.appRoot,channels:[...e.channels??[]],connections:[...e.connections??[]],config:{build:e.config.build===void 0?void 0:{externalDependencies:e.config.build.externalDependencies===void 0?void 0:[...e.config.build.externalDependencies]},compaction:{model:e.config.compaction?.model===void 0?void 0:cloneCompiledRuntimeModelReference(e.config.compaction.model),thresholdPercent:e.config.compaction?.thresholdPercent},description:e.config.description,experimental:e.config.experimental===void 0?void 0:{codeMode:e.config.experimental.codeMode},model:cloneCompiledRuntimeModelReference(e.config.model),name:e.config.name,outputSchema:e.config.outputSchema,source:e.config.source===void 0?void 0:{...e.config.source}},diagnosticsSummary:e.diagnosticsSummary??{errors:0,warnings:0},disabledFrameworkTools:[...e.disabledFrameworkTools??[]],workflowEnabled:e.workflowEnabled??!1,dynamicInstructions:[...e.dynamicInstructions??[]],dynamicSkills:[...e.dynamicSkills??[]],dynamicTools:[...e.dynamicTools??[]],hooks:[...e.hooks??[]],remoteAgents:[...e.remoteAgents??[]],sandbox:e.sandbox??null,sandboxWorkspaces:[...e.sandboxWorkspaces??[]],schedules:[...e.schedules??[]],skills:[...e.skills??[]],tools:[...e.tools??[]],workspaceResourceRoot:e.workspaceResourceRoot??{logicalPath:``,rootEntries:deriveResourceRootEntries({sandboxWorkspaces:e.sandboxWorkspaces,skills:e.skills})}};return e.instructions!==void 0&&(t.instructions=e.instructions),t}function deriveResourceRootEntries(e){let t=new Set;(e.skills??[]).length>0&&t.add(`skills/`);for(let n of e.sandboxWorkspaces??[])for(let e of n.rootEntries)t.add(e);return[...t].sort((e,t)=>e.localeCompare(t))}function createCompiledSubagentNodeId(e,t){return e===`__root__`?t:`${e}::${t}`}function createCompiledAgentManifest(e){return{...createCompiledAgentNodeManifest(e),kind:COMPILED_AGENT_MANIFEST_KIND,subagentEdges:[...e.subagentEdges??[]],subagents:[...e.subagents??[]],version:29}}function cloneCompiledRuntimeModelReference(e){let t={id:e.id,routing:cloneModelRouting(e.routing)};return e.contextWindowTokens!==void 0&&(t.contextWindowTokens=e.contextWindowTokens),e.providerOptions!==void 0&&(t.providerOptions={...e.providerOptions}),e.source!==void 0&&(t.source={...e.source}),t}function cloneModelRouting(e){return e.kind===`external`?{kind:`external`,provider:e.provider}:e.byok===void 0?{kind:`gateway`,target:e.target}:{kind:`gateway`,target:e.target,byok:e.byok}}export{COMPILED_AGENT_MANIFEST_KIND,COMPILED_AGENT_MANIFEST_VERSION,ROOT_COMPILED_AGENT_NODE_ID,compiledAgentManifestSchema,createCompiledAgentManifest,createCompiledAgentNodeManifest,createCompiledSubagentNodeId,deriveResourceRootEntries};
|
|
1
|
+
import{z}from"#compiled/zod/index.js";import{discoverDiagnosticsSummarySchema}from"#discover/diagnostics.js";import{compiledRemoteAgentNodeSchema}from"#compiler/remote-agent-node.js";import{jsonObjectSchema}from"#shared/json-schemas.js";const COMPILED_AGENT_MANIFEST_KIND=`eve-agent-compiled-manifest`,ROOT_COMPILED_AGENT_NODE_ID=`__root__`,COMPILED_AGENT_MANIFEST_VERSION=30,moduleSourceRefSchema=z.object({exportName:z.string().optional(),sourceKind:z.literal(`module`),logicalPath:z.string(),sourceId:z.string()}).strict(),channelMethodSchema=z.union([z.literal(`GET`),z.literal(`POST`),z.literal(`PUT`),z.literal(`PATCH`),z.literal(`DELETE`),z.literal(`WEBSOCKET`)]),compiledChannelDefinitionSchema=z.object({kind:z.literal(`channel`),name:z.string(),logicalPath:z.string(),method:channelMethodSchema,urlPath:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`),exportName:z.string().optional(),adapterKind:z.string().optional()}).strict(),disabledCompiledChannelEntrySchema=z.object({kind:z.literal(`disabled`),name:z.string(),logicalPath:z.string()}).strict(),compiledChannelEntrySchema=z.union([compiledChannelDefinitionSchema,disabledCompiledChannelEntrySchema]),modelRoutingSchema=z.union([z.object({kind:z.literal(`gateway`),target:z.string(),byok:z.string().optional()}).strict(),z.object({kind:z.literal(`external`),provider:z.string()}).strict()]),compiledRuntimeModelReferenceSchema=z.object({contextWindowTokens:z.number().int().positive().optional(),id:z.string(),source:moduleSourceRefSchema.optional(),providerOptions:z.record(z.string(),jsonObjectSchema).optional(),routing:modelRoutingSchema}).strict(),compiledAgentBuildDefinitionSchema=z.object({externalDependencies:z.array(z.string()).optional()}).strict(),compiledAgentWorkflowWorldDefinitionSchema=z.string(),compiledAgentWorkflowDefinitionSchema=z.object({world:compiledAgentWorkflowWorldDefinitionSchema.optional()}).strict(),compiledAgentCompactionDefinitionSchema=z.object({model:compiledRuntimeModelReferenceSchema.optional(),thresholdPercent:z.number().finite().min(0).max(1).optional()}).strict(),compiledAgentConfigSchema=z.object({build:compiledAgentBuildDefinitionSchema.optional(),compaction:compiledAgentCompactionDefinitionSchema.optional(),description:z.string().optional(),experimental:z.object({codeMode:z.boolean().optional(),workflow:compiledAgentWorkflowDefinitionSchema.optional()}).strict().optional(),model:compiledRuntimeModelReferenceSchema,name:z.string(),outputSchema:jsonObjectSchema.optional(),source:moduleSourceRefSchema.optional()}).strict(),compiledInstructionsSchema=z.object({name:z.string(),logicalPath:z.string(),markdown:z.string(),sourceId:z.string(),sourceKind:z.union([z.literal(`markdown`),z.literal(`module`)])}).strict(),compiledSkillBaseFields={name:z.string(),description:z.string(),license:z.string().optional(),markdown:z.string(),metadata:z.record(z.string(),z.string()).optional(),sourceId:z.string(),logicalPath:z.string()},compiledSkillSourceSchema=z.discriminatedUnion(`sourceKind`,[z.object({...compiledSkillBaseFields,sourceKind:z.literal(`markdown`)}).strict(),z.object({...compiledSkillBaseFields,sourceKind:z.literal(`module`),exportName:z.string().optional()}).strict(),z.object({...compiledSkillBaseFields,sourceKind:z.literal(`skill-package`),skillId:z.string(),skillFilePath:z.string(),rootPath:z.string(),assetsPath:z.string().optional(),referencesPath:z.string().optional(),scriptsPath:z.string().optional()}).strict()]),compiledScheduleDefinitionSchema=z.object({cron:z.string(),hasRun:z.boolean(),name:z.string(),logicalPath:z.string(),markdown:z.string().optional(),sourceId:z.string(),sourceKind:z.union([z.literal(`markdown`),z.literal(`module`)])}).strict(),compiledSandboxDefinitionSchema=z.object({backendName:z.string().optional(),description:z.string().optional(),exportName:z.string().optional(),logicalPath:z.string(),revalidationKey:z.string().optional(),sourceHash:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledSandboxWorkspaceSchema=z.object({logicalPath:z.string(),rootEntries:z.array(z.string()).readonly(),sourceId:z.string(),sourcePath:z.string()}).strict(),compiledWorkspaceResourceRootSchema=z.object({contentHash:z.string().optional(),logicalPath:z.string(),rootEntries:z.array(z.string()).readonly()}).strict(),compiledConnectionDefinitionSchema=z.object({connectionName:z.string(),description:z.string(),exportName:z.string().optional(),logicalPath:z.string(),protocol:z.enum([`mcp`,`openapi`]).default(`mcp`),sourceId:z.string(),sourceKind:z.literal(`module`),url:z.string(),vercelConnect:z.object({connector:z.string()}).strict().optional()}).strict(),compiledToolDefinitionSchema=z.object({description:z.string(),exportName:z.string().optional(),inputSchema:jsonObjectSchema.nullable(),logicalPath:z.string(),name:z.string(),outputSchema:jsonObjectSchema.optional(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledDynamicToolDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),logicalPath:z.string(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledDynamicSkillDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),logicalPath:z.string(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledDynamicInstructionsDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),logicalPath:z.string(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledHookDefinitionSchema=z.object({exportName:z.string().optional(),logicalPath:z.string(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledAgentNodeManifestSchema=z.object({agentRoot:z.string(),appRoot:z.string(),channels:z.array(compiledChannelEntrySchema),config:compiledAgentConfigSchema,connections:z.array(compiledConnectionDefinitionSchema),diagnosticsSummary:discoverDiagnosticsSummarySchema,disabledFrameworkTools:z.array(z.string()).readonly(),workflowEnabled:z.boolean().default(!1),dynamicInstructions:z.array(compiledDynamicInstructionsDefinitionSchema).default([]),dynamicSkills:z.array(compiledDynamicSkillDefinitionSchema).default([]),dynamicTools:z.array(compiledDynamicToolDefinitionSchema).default([]),hooks:z.array(compiledHookDefinitionSchema),sandbox:compiledSandboxDefinitionSchema.nullable(),sandboxWorkspaces:z.array(compiledSandboxWorkspaceSchema),schedules:z.array(compiledScheduleDefinitionSchema),remoteAgents:z.array(compiledRemoteAgentNodeSchema),skills:z.array(compiledSkillSourceSchema).readonly(),instructions:compiledInstructionsSchema.optional(),tools:z.array(compiledToolDefinitionSchema),workspaceResourceRoot:compiledWorkspaceResourceRootSchema}).strict(),compiledSubagentNodeSchema=z.object({agent:compiledAgentNodeManifestSchema,description:z.string(),entryPath:z.string(),logicalPath:z.string(),name:z.string(),nodeId:z.string(),rootPath:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`),exportName:z.string().optional()}).strict(),compiledSubagentEdgeSchema=z.object({childNodeId:z.string(),parentNodeId:z.string()}).strict(),compiledAgentManifestSchema=z.object({agentRoot:z.string(),appRoot:z.string(),channels:z.array(compiledChannelEntrySchema),config:compiledAgentConfigSchema,connections:z.array(compiledConnectionDefinitionSchema),diagnosticsSummary:discoverDiagnosticsSummarySchema,disabledFrameworkTools:z.array(z.string()).readonly(),workflowEnabled:z.boolean().default(!1),dynamicInstructions:z.array(compiledDynamicInstructionsDefinitionSchema).default([]),dynamicSkills:z.array(compiledDynamicSkillDefinitionSchema).default([]),dynamicTools:z.array(compiledDynamicToolDefinitionSchema).default([]),hooks:z.array(compiledHookDefinitionSchema),kind:z.literal(COMPILED_AGENT_MANIFEST_KIND),remoteAgents:z.array(compiledRemoteAgentNodeSchema),sandbox:compiledSandboxDefinitionSchema.nullable(),sandboxWorkspaces:z.array(compiledSandboxWorkspaceSchema),schedules:z.array(compiledScheduleDefinitionSchema),skills:z.array(compiledSkillSourceSchema).readonly(),subagentEdges:z.array(compiledSubagentEdgeSchema),subagents:z.array(compiledSubagentNodeSchema),instructions:compiledInstructionsSchema.optional(),tools:z.array(compiledToolDefinitionSchema),version:z.literal(30),workspaceResourceRoot:compiledWorkspaceResourceRootSchema}).strict();function createCompiledAgentNodeManifest(e){let t={agentRoot:e.agentRoot,appRoot:e.appRoot,channels:[...e.channels??[]],connections:[...e.connections??[]],config:{build:e.config.build===void 0?void 0:{externalDependencies:e.config.build.externalDependencies===void 0?void 0:[...e.config.build.externalDependencies]},compaction:{model:e.config.compaction?.model===void 0?void 0:cloneCompiledRuntimeModelReference(e.config.compaction.model),thresholdPercent:e.config.compaction?.thresholdPercent},description:e.config.description,experimental:e.config.experimental===void 0?void 0:{codeMode:e.config.experimental.codeMode,workflow:e.config.experimental.workflow===void 0?void 0:{world:e.config.experimental.workflow.world}},model:cloneCompiledRuntimeModelReference(e.config.model),name:e.config.name,outputSchema:e.config.outputSchema,source:e.config.source===void 0?void 0:{...e.config.source}},diagnosticsSummary:e.diagnosticsSummary??{errors:0,warnings:0},disabledFrameworkTools:[...e.disabledFrameworkTools??[]],workflowEnabled:e.workflowEnabled??!1,dynamicInstructions:[...e.dynamicInstructions??[]],dynamicSkills:[...e.dynamicSkills??[]],dynamicTools:[...e.dynamicTools??[]],hooks:[...e.hooks??[]],remoteAgents:[...e.remoteAgents??[]],sandbox:e.sandbox??null,sandboxWorkspaces:[...e.sandboxWorkspaces??[]],schedules:[...e.schedules??[]],skills:[...e.skills??[]],tools:[...e.tools??[]],workspaceResourceRoot:e.workspaceResourceRoot??{logicalPath:``,rootEntries:deriveResourceRootEntries({sandboxWorkspaces:e.sandboxWorkspaces,skills:e.skills})}};return e.instructions!==void 0&&(t.instructions=e.instructions),t}function deriveResourceRootEntries(e){let t=new Set;(e.skills??[]).length>0&&t.add(`skills/`);for(let n of e.sandboxWorkspaces??[])for(let e of n.rootEntries)t.add(e);return[...t].sort((e,t)=>e.localeCompare(t))}function createCompiledSubagentNodeId(e,t){return e===`__root__`?t:`${e}::${t}`}function createCompiledAgentManifest(e){return{...createCompiledAgentNodeManifest(e),kind:COMPILED_AGENT_MANIFEST_KIND,subagentEdges:[...e.subagentEdges??[]],subagents:[...e.subagents??[]],version:30}}function cloneCompiledRuntimeModelReference(e){let t={id:e.id,routing:cloneModelRouting(e.routing)};return e.contextWindowTokens!==void 0&&(t.contextWindowTokens=e.contextWindowTokens),e.providerOptions!==void 0&&(t.providerOptions={...e.providerOptions}),e.source!==void 0&&(t.source={...e.source}),t}function cloneModelRouting(e){return e.kind===`external`?{kind:`external`,provider:e.provider}:e.byok===void 0?{kind:`gateway`,target:e.target}:{kind:`gateway`,target:e.target,byok:e.byok}}export{COMPILED_AGENT_MANIFEST_KIND,COMPILED_AGENT_MANIFEST_VERSION,ROOT_COMPILED_AGENT_NODE_ID,compiledAgentManifestSchema,createCompiledAgentManifest,createCompiledAgentNodeManifest,createCompiledSubagentNodeId,deriveResourceRootEntries};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isAbsolute,join,relative,resolve}from"node:path";import{DEFAULT_AGENT_MODEL_ID}from"#shared/default-agent-model.js";import{toErrorMessage}from"#shared/errors.js";import{normalizeJsonSchemaDefinition}from"#shared/json-schema.js";import{normalizeLogicalPath}from"#discover/filesystem.js";import{classifyModelRouting}from"#internal/classify-model-routing.js";import{normalizeAgentDefinition}from"#internal/authored-definition/core.js";import{formatLanguageModelGatewayId}from"#internal/runtime-model.js";import{parseJsonObject}from"#shared/json.js";import{loadModuleBackedDefinition}from"#compiler/normalize-helpers.js";async function compileAgentConfig(e,t){let n=e.configModule,r=n===void 0?void 0:formatAgentConfigModulePath(e,n),a=normalizeAgentDefinition(n===void 0?{model:DEFAULT_AGENT_MODEL_ID}:await loadModuleBackedDefinition({agentRoot:e.agentRoot,displayPath:r,kind:`agent config`,source:n}),n===void 0?`Expected the default agent config to match the public eve shape.`:`Expected the agent config export "${n.exportName??`default`}" from "${r}" to match the public eve shape.`),o=await normalizeAuthoredModelReference({modelCatalog:t.modelCatalog,purpose:`the primary compaction trigger model`,contextWindowTokens:a.modelContextWindowTokens,providerOptions:a.modelOptions?.providerOptions,source:n,sourcePath:r,value:a.model}),s={},c={compaction:s,model:o,name:e.agentId};
|
|
1
|
+
import{isAbsolute,join,relative,resolve}from"node:path";import{DEFAULT_AGENT_MODEL_ID}from"#shared/default-agent-model.js";import{toErrorMessage}from"#shared/errors.js";import{normalizeJsonSchemaDefinition}from"#shared/json-schema.js";import{normalizeLogicalPath}from"#discover/filesystem.js";import{classifyModelRouting}from"#internal/classify-model-routing.js";import{normalizeAgentDefinition}from"#internal/authored-definition/core.js";import{formatLanguageModelGatewayId}from"#internal/runtime-model.js";import{parseJsonObject}from"#shared/json.js";import{loadModuleBackedDefinition}from"#compiler/normalize-helpers.js";async function compileAgentConfig(e,t){let n=e.configModule,r=n===void 0?void 0:formatAgentConfigModulePath(e,n),a=normalizeAgentDefinition(n===void 0?{model:DEFAULT_AGENT_MODEL_ID}:await loadModuleBackedDefinition({agentRoot:e.agentRoot,displayPath:r,kind:`agent config`,source:n}),n===void 0?`Expected the default agent config to match the public eve shape.`:`Expected the agent config export "${n.exportName??`default`}" from "${r}" to match the public eve shape.`),o=await normalizeAuthoredModelReference({modelCatalog:t.modelCatalog,purpose:`the primary compaction trigger model`,contextWindowTokens:a.modelContextWindowTokens,providerOptions:a.modelOptions?.providerOptions,source:n,sourcePath:r,value:a.model}),s={},c={compaction:s,model:o,name:e.agentId};a.description!==void 0&&(c.description=a.description);let l=normalizeExperimentalDefinition(a.experimental);return l!==void 0&&(c.experimental=l),a.build!==void 0&&(c.build={externalDependencies:a.build.externalDependencies===void 0?void 0:[...a.build.externalDependencies]}),a.outputSchema!==void 0&&(c.outputSchema=normalizeJsonSchemaDefinition(a.outputSchema,`output`)),n!==void 0&&(c.source={exportName:n.exportName,sourceKind:`module`,logicalPath:n.logicalPath,sourceId:n.sourceId}),a.compaction?.model!==void 0&&(s.model=await normalizeAuthoredModelReference({modelCatalog:t.modelCatalog,purpose:`the compaction summary model`,contextWindowTokens:a.compaction.modelContextWindowTokens,providerOptions:a.modelOptions?.providerOptions,source:n,sourcePath:r,value:a.compaction.model})),a.compaction?.thresholdPercent!==void 0&&(s.thresholdPercent=a.compaction.thresholdPercent),c}function normalizeExperimentalDefinition(e){if(e===void 0)return;let t={};return e.codeMode!==void 0&&(t.codeMode=e.codeMode),e.workflow!==void 0&&(t.workflow={world:e.workflow.world}),t}async function normalizeAuthoredModelReference(e){if(typeof e.value==`string`)return await withCompiledRuntimeModelLimits({id:formatLanguageModelGatewayId(e.value),providerOptions:parseProviderOptionsRecord(e.providerOptions),routing:classifyModelRouting(e.value,e.providerOptions)},e);let t=e.source;if(t===void 0)throw Error(`Expected ${e.purpose} to provide a valid AI SDK language model reference.`);let n=e.value,r=n.specificationVersion;if(r!==`v2`&&r!==`v3`&&r!==`v4`||typeof n.provider!=`string`||typeof n.modelId!=`string`||typeof n.doGenerate!=`function`||typeof n.doStream!=`function`)throw Error(`Expected the authored agent config export "${t.exportName??`default`}" from "${e.sourcePath??t.logicalPath}" to provide a valid AI SDK language model.`);let i={id:formatLanguageModelGatewayId(n),source:{exportName:t.exportName,sourceKind:`module`,logicalPath:t.logicalPath,sourceId:t.sourceId},providerOptions:parseProviderOptionsRecord(e.providerOptions),routing:classifyModelRouting(n,e.providerOptions)};if(e.contextWindowTokens===void 0){let t=await e.modelCatalog.getByProviderModelId(n.provider,n.modelId);if(t)return{...i,id:t.slug,contextWindowTokens:t.limits.contextWindowTokens}}return await withCompiledRuntimeModelLimits(i,e)}function formatAgentConfigModulePath(e,r){let i=join(e.agentRoot,r.logicalPath);return normalizeLogicalPath(relative(resolveTopLevelAgentRoot(e),i))}function resolveTopLevelAgentRoot(e){let t=resolve(e.appRoot),n=resolve(t,`agent`);return isPathInsideOrEqual(n,resolve(e.agentRoot))?n:t}function isPathInsideOrEqual(t,r){let i=relative(t,r);return i===``||!i.startsWith(`..`)&&!isAbsolute(i)}async function withCompiledRuntimeModelLimits(e,t){if(t.contextWindowTokens!==void 0)return{...e,contextWindowTokens:t.contextWindowTokens};let n;try{n=await t.modelCatalog.getModelLimits(e.id)}catch(n){throw Error(`Failed to load AI Gateway model metadata for ${t.purpose} "${e.id}". ${toErrorMessage(n)}`)}if(n===null)throw Error(`Cannot compile agent compaction because ${t.purpose} "${e.id}" does not have known AI Gateway context window metadata.`);return{...e,contextWindowTokens:n.contextWindowTokens}}function parseProviderOptionsRecord(e){if(e===void 0)return;let t={};for(let[n,r]of Object.entries(e))t[n]=parseJsonObject(r);return t}export{compileAgentConfig};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{compileChannelDefinition}from"#compiler/normalize-channel.js";import{ROOT_COMPILED_AGENT_NODE_ID,createCompiledAgentManifest,createCompiledAgentNodeManifest}from"#compiler/manifest.js";import{createCompiledRuntimeModelCatalogLoader}from"#compiler/model-catalog.js";import{compileAgentConfig}from"#compiler/normalize-agent-config.js";import{compileConnectionDefinition}from"#compiler/normalize-connection.js";import{compileHookEntry}from"#compiler/normalize-hook.js";import{compileSandboxDefinition}from"#compiler/normalize-sandbox.js";import{compileInstructionsEntry}from"#compiler/normalize-instructions.js";import{compileScheduleDefinition}from"#compiler/normalize-schedule.js";import{compileSkillSource}from"#compiler/normalize-skill.js";import{compileSubagentGraph}from"#compiler/normalize-subagent.js";import{compileToolEntry}from"#compiler/normalize-tool.js";async function compileAgentManifest(e){let r={modelCatalog:createCompiledRuntimeModelCatalogLoader(e.appRoot)},a=await compileAgentNodeManifest(e,r),o=await compileSubagentGraph({appRoot:e.appRoot,compileAgentNodeManifest,context:r,externalDependencies:a.config.build?.externalDependencies??[],parentNodeId:ROOT_COMPILED_AGENT_NODE_ID,subagents:e.subagents});return createCompiledAgentManifest({...a,remoteAgents:o.remoteAgents,subagentEdges:o.edges,subagents:o.nodes})}async function compileAgentNodeManifest(t,n,i={}){let s=await compileAgentConfig(t,n)
|
|
1
|
+
import{compileChannelDefinition}from"#compiler/normalize-channel.js";import{ROOT_COMPILED_AGENT_NODE_ID,createCompiledAgentManifest,createCompiledAgentNodeManifest}from"#compiler/manifest.js";import{createCompiledRuntimeModelCatalogLoader}from"#compiler/model-catalog.js";import{compileAgentConfig}from"#compiler/normalize-agent-config.js";import{compileConnectionDefinition}from"#compiler/normalize-connection.js";import{compileHookEntry}from"#compiler/normalize-hook.js";import{compileSandboxDefinition}from"#compiler/normalize-sandbox.js";import{compileInstructionsEntry}from"#compiler/normalize-instructions.js";import{compileScheduleDefinition}from"#compiler/normalize-schedule.js";import{compileSkillSource}from"#compiler/normalize-skill.js";import{compileSubagentGraph}from"#compiler/normalize-subagent.js";import{compileToolEntry}from"#compiler/normalize-tool.js";async function compileAgentManifest(e){let r={modelCatalog:createCompiledRuntimeModelCatalogLoader(e.appRoot)},a=await compileAgentNodeManifest(e,r),o=await compileSubagentGraph({appRoot:e.appRoot,compileAgentNodeManifest,context:r,externalDependencies:a.config.build?.externalDependencies??[],parentNodeId:ROOT_COMPILED_AGENT_NODE_ID,subagents:e.subagents});return createCompiledAgentManifest({...a,remoteAgents:o.remoteAgents,subagentEdges:o.edges,subagents:o.nodes})}async function compileAgentNodeManifest(t,n,i={}){let s=await compileAgentConfig(t,n);if(i.allowWorkflowConfig===!1&&s.experimental?.workflow!==void 0)throw Error(`Workflow runtime configuration is only supported on the root agent config. Remove "experimental.workflow" from "${t.agentId}".`);let c=mergeExternalDependencies(i.externalDependencies,s.build?.externalDependencies),l=c.length===0?s:{...s,build:{...s.build,externalDependencies:c}},u=await Promise.all(t.tools.map(e=>compileToolEntry(t.agentRoot,e,{externalDependencies:c}))),d=[],f=[],p=[],m=!1;for(let e of u)e.kind===`tool`?d.push(e.definition):e.kind===`dynamic-tool`?f.push(e.definition):e.kind===`enable-workflow`?m=!0:p.push(e.name);let h=(await Promise.all(t.channels.map(n=>compileChannelDefinition(t.agentRoot,n,{externalDependencies:c})))).flat(),g=await Promise.all(t.skills.map(e=>compileSkillSource(t.agentRoot,e,{externalDependencies:c}))),_=[],v=[];for(let e of g)e.kind===`skill`?_.push(e.definition):v.push(e.definition);let y=await Promise.all(t.instructions.map(e=>compileInstructionsEntry(t.agentRoot,e,{externalDependencies:c}))),b=[],x=[];for(let e of y)e.kind===`instructions`?b.push(e.definition):x.push(e.definition);let S=b.length===0?void 0:b.length===1?b[0]:{name:`instructions`,logicalPath:`instructions`,markdown:b.map(e=>e.markdown).join(`
|
|
2
2
|
|
|
3
3
|
`),sourceId:b[0].sourceId,sourceKind:`module`};return createCompiledAgentNodeManifest({agentRoot:t.agentRoot,appRoot:t.appRoot,channels:h,config:l,connections:await Promise.all(t.connections.map(e=>compileConnectionDefinition(t.agentRoot,e,{externalDependencies:c}))),diagnosticsSummary:t.diagnosticsSummary,disabledFrameworkTools:p,workflowEnabled:m,dynamicSkills:v,dynamicTools:f,hooks:t.hooks.map(e=>compileHookEntry(e)),sandbox:t.sandbox===null?null:await compileSandboxDefinition(t.agentRoot,t.sandbox,{externalDependencies:c}),sandboxWorkspaces:t.sandboxWorkspaces.map(e=>({logicalPath:e.logicalPath,rootEntries:[...e.rootEntries],sourceId:e.sourceId,sourcePath:e.sourcePath})),schedules:await Promise.all(t.schedules.map(e=>compileScheduleDefinition(t.agentRoot,e,{externalDependencies:c}))),dynamicInstructions:x,skills:_,instructions:S,tools:d})}function mergeExternalDependencies(...e){let t=new Set;for(let n of e)for(let e of n??[])t.add(e);return[...t]}export{compileAgentManifest};
|
|
@@ -9,6 +9,7 @@ import { type ManifestCompileContext } from "#compiler/normalize-helpers.js";
|
|
|
9
9
|
*/
|
|
10
10
|
export type CompileAgentNodeManifestFn = (manifest: AgentSourceManifest, context: ManifestCompileContext, options?: {
|
|
11
11
|
readonly externalDependencies?: readonly string[];
|
|
12
|
+
readonly allowWorkflowConfig?: boolean;
|
|
12
13
|
}) => Promise<CompiledAgentNodeManifest>;
|
|
13
14
|
/**
|
|
14
15
|
* Compiles every local subagent reachable from one parent node into a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{expectObjectRecord,expectOnlyKnownKeys,expectString}from"#internal/authored-module.js";import{EVE_CREATE_SESSION_ROUTE_PATH}from"#protocol/routes.js";import{normalizeJsonSchemaDefinition}from"#shared/json-schema.js";import{createCompiledSubagentNodeId}from"#compiler/manifest.js";import{loadModuleBackedDefinition}from"#compiler/normalize-helpers.js";import{createPathDerivedSourceId}from"#discover/manifest.js";async function compileSubagentGraph(e){let t=[],n=[],r=[];for(let i of e.subagents){let a=await compileSubagentDefinition({appRoot:e.appRoot,compileAgentNodeManifest:e.compileAgentNodeManifest,context:e.context,externalDependencies:e.externalDependencies,parentNodeId:e.parentNodeId,source:i});if(a.kind===`remote`){r.push(a.node);continue}t.push(a.node,...a.descendants.nodes),n.push({childNodeId:a.node.nodeId,parentNodeId:e.parentNodeId},...a.descendants.edges)}return{edges:n,nodes:t,remoteAgents:r}}async function compileSubagentDefinition(e){let t=e.source.manifest.configModule;if(t===void 0)throw Error(`Subagent "${e.source.logicalPath}" is missing an agent config module.`);let n=createSubagentConfigModuleSourceRef(e.source,t),r=await loadModuleBackedDefinition({agentRoot:e.source.manifest.agentRoot,displayPath:n.logicalPath,externalDependencies:e.externalDependencies,kind:`subagent config`,source:t});return readAgentDefinitionKind(r)===`remote`?{kind:`remote`,node:compileRemoteAgent({source:e.source,value:r})}:{kind:`local`,...await compileLocalSubagent(e)}}async function compileSubagent(e){let t=createCompiledSubagentNodeId(e.parentNodeId,e.source.sourceId),n=e.source.subagentId,r=await e.compileAgentNodeManifest({...e.source.manifest,appRoot:e.appRoot},e.context,{externalDependencies:e.externalDependencies}),i=r.config.description;if(!i)throw Error(`Local subagent "${e.source.logicalPath}" is missing a "description" field on its agent config. Add \`description\` to \`defineAgent({ ... })\` so the parent agent can decide when to delegate to this subagent.`);let o=await compileSubagentGraph({appRoot:e.appRoot,compileAgentNodeManifest:e.compileAgentNodeManifest,context:e.context,externalDependencies:r.config.build?.externalDependencies,parentNodeId:t,subagents:e.source.manifest.subagents});return{descendants:o,node:{agent:{...r,remoteAgents:[...o.remoteAgents]},description:i,entryPath:e.source.entryPath,logicalPath:e.source.logicalPath,name:n,nodeId:t,rootPath:e.source.rootPath,sourceId:e.source.sourceId,sourceKind:`module`}}}const compileLocalSubagent=compileSubagent;function compileRemoteAgent(e){let t=e.source.manifest.configModule;if(t===void 0)throw Error(`Remote agent "${e.source.logicalPath}" is missing a config module.`);assertRemoteAgentDefinitionHasNoLocalPackageEntries(e.source);let n=createSubagentConfigModuleSourceRef(e.source,t),r=normalizeRemoteAgentDefinition(e.value,`Expected the remote agent config export "${t.exportName??`default`}" from "${n.logicalPath}" to match the public eve shape.`);return{...n,description:r.description,entryPath:e.source.entryPath,name:e.source.subagentId,nodeId:e.source.sourceId,outputSchema:r.outputSchema,path:r.path,rootPath:e.source.rootPath,url:r.url}}function createSubagentConfigModuleSourceRef(e,t){let n=e.logicalPath===t.logicalPath?t.logicalPath:`${e.logicalPath}/${t.logicalPath}`,r={logicalPath:n,sourceId:createPathDerivedSourceId(n),sourceKind:`module`};return t.exportName!==void 0&&(r.exportName=t.exportName),r}function readAgentDefinitionKind(e){return typeof e!=`object`||!e?`local`:e.kind===`remote`?`remote`:`local`}function normalizeRemoteAgentDefinition(a,o){let s=expectObjectRecord(a,o);if(expectOnlyKnownKeys(s,[`auth`,`description`,`headers`,`kind`,`outputSchema`,`path`,`url`],o),s.kind!==`remote`)throw Error(`${o} Expected "kind" to be "remote".`);return{description:expectString(s.description,o),outputSchema:s.outputSchema===void 0?void 0:normalizeJsonSchemaDefinition(s.outputSchema,`output`),path:s.path===void 0?EVE_CREATE_SESSION_ROUTE_PATH:expectString(s.path,o),url:expectString(s.url,o)}}function assertRemoteAgentDefinitionHasNoLocalPackageEntries(e){let t=e.manifest,n=[t.connections.length>0?`connections/`:void 0,t.hooks.length>0?`hooks/`:void 0,t.instructions.length>0?`instructions`:void 0,t.lib.length>0?`lib/`:void 0,t.sandbox===null?void 0:`sandbox/`,t.sandboxWorkspaces.length>0?`sandbox/workspace/`:void 0,t.schedules.length>0?`schedules/`:void 0,t.skills.length>0?`skills/`:void 0,t.subagents.length>0?`subagents/`:void 0,t.tools.length>0?`tools/`:void 0].filter(e=>e!==void 0);if(n.length!==0)throw Error(`Remote subagent definition "${e.logicalPath}" cannot include local package entries. Remove unsupported entries: ${n.join(`, `)}.`)}export{compileSubagentGraph};
|
|
1
|
+
import{expectObjectRecord,expectOnlyKnownKeys,expectString}from"#internal/authored-module.js";import{EVE_CREATE_SESSION_ROUTE_PATH}from"#protocol/routes.js";import{normalizeJsonSchemaDefinition}from"#shared/json-schema.js";import{createCompiledSubagentNodeId}from"#compiler/manifest.js";import{loadModuleBackedDefinition}from"#compiler/normalize-helpers.js";import{createPathDerivedSourceId}from"#discover/manifest.js";async function compileSubagentGraph(e){let t=[],n=[],r=[];for(let i of e.subagents){let a=await compileSubagentDefinition({appRoot:e.appRoot,compileAgentNodeManifest:e.compileAgentNodeManifest,context:e.context,externalDependencies:e.externalDependencies,parentNodeId:e.parentNodeId,source:i});if(a.kind===`remote`){r.push(a.node);continue}t.push(a.node,...a.descendants.nodes),n.push({childNodeId:a.node.nodeId,parentNodeId:e.parentNodeId},...a.descendants.edges)}return{edges:n,nodes:t,remoteAgents:r}}async function compileSubagentDefinition(e){let t=e.source.manifest.configModule;if(t===void 0)throw Error(`Subagent "${e.source.logicalPath}" is missing an agent config module.`);let n=createSubagentConfigModuleSourceRef(e.source,t),r=await loadModuleBackedDefinition({agentRoot:e.source.manifest.agentRoot,displayPath:n.logicalPath,externalDependencies:e.externalDependencies,kind:`subagent config`,source:t});return readAgentDefinitionKind(r)===`remote`?{kind:`remote`,node:compileRemoteAgent({source:e.source,value:r})}:{kind:`local`,...await compileLocalSubagent(e)}}async function compileSubagent(e){let t=createCompiledSubagentNodeId(e.parentNodeId,e.source.sourceId),n=e.source.subagentId,r=await e.compileAgentNodeManifest({...e.source.manifest,appRoot:e.appRoot},e.context,{allowWorkflowConfig:!1,externalDependencies:e.externalDependencies}),i=r.config.description;if(!i)throw Error(`Local subagent "${e.source.logicalPath}" is missing a "description" field on its agent config. Add \`description\` to \`defineAgent({ ... })\` so the parent agent can decide when to delegate to this subagent.`);let o=await compileSubagentGraph({appRoot:e.appRoot,compileAgentNodeManifest:e.compileAgentNodeManifest,context:e.context,externalDependencies:r.config.build?.externalDependencies,parentNodeId:t,subagents:e.source.manifest.subagents});return{descendants:o,node:{agent:{...r,remoteAgents:[...o.remoteAgents]},description:i,entryPath:e.source.entryPath,logicalPath:e.source.logicalPath,name:n,nodeId:t,rootPath:e.source.rootPath,sourceId:e.source.sourceId,sourceKind:`module`}}}const compileLocalSubagent=compileSubagent;function compileRemoteAgent(e){let t=e.source.manifest.configModule;if(t===void 0)throw Error(`Remote agent "${e.source.logicalPath}" is missing a config module.`);assertRemoteAgentDefinitionHasNoLocalPackageEntries(e.source);let n=createSubagentConfigModuleSourceRef(e.source,t),r=normalizeRemoteAgentDefinition(e.value,`Expected the remote agent config export "${t.exportName??`default`}" from "${n.logicalPath}" to match the public eve shape.`);return{...n,description:r.description,entryPath:e.source.entryPath,name:e.source.subagentId,nodeId:e.source.sourceId,outputSchema:r.outputSchema,path:r.path,rootPath:e.source.rootPath,url:r.url}}function createSubagentConfigModuleSourceRef(e,t){let n=e.logicalPath===t.logicalPath?t.logicalPath:`${e.logicalPath}/${t.logicalPath}`,r={logicalPath:n,sourceId:createPathDerivedSourceId(n),sourceKind:`module`};return t.exportName!==void 0&&(r.exportName=t.exportName),r}function readAgentDefinitionKind(e){return typeof e!=`object`||!e?`local`:e.kind===`remote`?`remote`:`local`}function normalizeRemoteAgentDefinition(a,o){let s=expectObjectRecord(a,o);if(expectOnlyKnownKeys(s,[`auth`,`description`,`headers`,`kind`,`outputSchema`,`path`,`url`],o),s.kind!==`remote`)throw Error(`${o} Expected "kind" to be "remote".`);return{description:expectString(s.description,o),outputSchema:s.outputSchema===void 0?void 0:normalizeJsonSchemaDefinition(s.outputSchema,`output`),path:s.path===void 0?EVE_CREATE_SESSION_ROUTE_PATH:expectString(s.path,o),url:expectString(s.url,o)}}function assertRemoteAgentDefinitionHasNoLocalPackageEntries(e){let t=e.manifest,n=[t.connections.length>0?`connections/`:void 0,t.hooks.length>0?`hooks/`:void 0,t.instructions.length>0?`instructions`:void 0,t.lib.length>0?`lib/`:void 0,t.sandbox===null?void 0:`sandbox/`,t.sandboxWorkspaces.length>0?`sandbox/workspace/`:void 0,t.schedules.length>0?`schedules/`:void 0,t.skills.length>0?`skills/`:void 0,t.subagents.length>0?`subagents/`:void 0,t.tools.length>0?`tools/`:void 0].filter(e=>e!==void 0);if(n.length!==0)throw Error(`Remote subagent definition "${e.logicalPath}" cannot include local package entries. Remove unsupported entries: ${n.join(`, `)}.`)}export{compileSubagentGraph};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CompileMetadata } from "#compiler/artifacts.js";
|
|
1
2
|
import type { CompileAgentResult } from "#compiler/compile-agent.js";
|
|
2
3
|
/**
|
|
3
4
|
* Paths to the generated compiled-artifacts files shared by Nitro and the
|
|
@@ -31,3 +32,9 @@ export declare function writeCompiledArtifactsFiles(input: {
|
|
|
31
32
|
compileResult: CompileAgentResult;
|
|
32
33
|
outDir: string;
|
|
33
34
|
}): Promise<GeneratedCompiledArtifactsFiles>;
|
|
35
|
+
export declare function createCompiledArtifactsBootstrapSource(input: {
|
|
36
|
+
compileResult: CompileAgentResult;
|
|
37
|
+
installModulePath: string;
|
|
38
|
+
metadata: CompileMetadata;
|
|
39
|
+
moduleMapPath: string;
|
|
40
|
+
}): Promise<string>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{resolvePackageSourceFilePath}from"#internal/application/package.js";import{existsSync}from"node:fs";import{join}from"node:path";import{mkdir,writeFile}from"node:fs/promises";import{createCompiledModuleMapSource}from"#compiler/module-map.js";import{stringifyEsmImportSpecifier}from"#internal/application/import-specifier.js";async function writeCompiledArtifactsFiles(t){let
|
|
2
|
-
`)}async function createCompiledArtifactsBootstrapSource(e){let t=stripCompiledModuleMapExports(createCompiledModuleMapSource({importSpecifierStyle:`absolute`,manifest:e.compileResult.manifest,moduleMapPath:e.moduleMapPath})).trim();return[`// Generated by eve. Do not edit by hand.`,`import { installBundledCompiledArtifacts } from ${stringifyEsmImportSpecifier(e.installModulePath)}
|
|
3
|
-
`)}function createInstrumentationPluginSource(e){return[`// Generated by eve. Do not edit by hand.`,`import * as instrumentationModule from ${stringifyEsmImportSpecifier(e.instrumentationPath)};`,`import { registerInstrumentationConfig } from ${stringifyEsmImportSpecifier(e.registerConfigPath)};`,``,`if (instrumentationModule.default != null) {`,` registerInstrumentationConfig(instrumentationModule.default, { agentName: ${JSON.stringify(e.agentName)} });`,`}`,``,`// Default export satisfies the Nitro plugin contract so this file`,`// can be used directly as a Nitro plugin without a separate wrapper.`,`export default function installInstrumentationPlugin() {}`,``].join(`
|
|
4
|
-
`)}export{writeCompiledArtifactsFiles};
|
|
1
|
+
import{resolvePackageSourceFilePath}from"#internal/application/package.js";import{existsSync}from"node:fs";import{join}from"node:path";import{mkdir,writeFile}from"node:fs/promises";import{createCompiledModuleMapSource}from"#compiler/module-map.js";import{stringifyEsmImportSpecifier}from"#internal/application/import-specifier.js";async function writeCompiledArtifactsFiles(t){let a=join(t.outDir,`compiled-artifacts-bootstrap.mjs`),o=join(t.outDir,`compiled-artifacts-instrumentation.mjs`),s=resolveInstrumentationModule(t.compileResult.manifest.agentRoot);await mkdir(t.outDir,{recursive:!0}),await writeFile(a,await createCompiledArtifactsBootstrapSource({compileResult:t.compileResult,installModulePath:resolvePackageSourceFilePath(`src/runtime/loaders/bundled-artifacts.ts`),moduleMapPath:a,metadata:t.compileResult.metadata})),s!==void 0&&await writeFile(o,createInstrumentationPluginSource({agentName:t.compileResult.manifest.config.name,instrumentationPath:s,registerConfigPath:resolvePackageSourceFilePath(`src/harness/instrumentation-config.ts`)}));let c={bootstrapPath:a};return s!==void 0&&(c.instrumentationPluginPath=o,c.instrumentationSourcePath=s),c}const INSTRUMENTATION_EXTENSIONS=[`.ts`,`.mts`,`.js`,`.mjs`];function resolveInstrumentationModule(e){for(let r of INSTRUMENTATION_EXTENSIONS){let i=join(e,`instrumentation${r}`);if(existsSync(i))return i}}function stripCompiledModuleMapExports(e){return e.replace(/^export const moduleMap = /m,`const moduleMap = `).replace(/\nexport default moduleMap;\n?$/,`
|
|
2
|
+
`)}async function createCompiledArtifactsBootstrapSource(e){let t=e.compileResult.manifest.config.experimental?.workflow?.world,n=stripCompiledModuleMapExports(createCompiledModuleMapSource({importSpecifierStyle:`absolute`,manifest:e.compileResult.manifest,moduleMapPath:e.moduleMapPath})).trim();return[`// Generated by eve. Do not edit by hand.`,`import { installBundledCompiledArtifacts } from ${stringifyEsmImportSpecifier(e.installModulePath)};`,...createWorkflowWorldBootstrapImports(t),``,n,``,`const metadata = ${JSON.stringify(e.metadata,null,2)};`,``,`const manifest = ${JSON.stringify(e.compileResult.manifest,null,2)};`,``,`export function installCompiledArtifactsBootstrap() {`,` installBundledCompiledArtifacts({`,` manifest,`,` metadata,`,` moduleMap,`,` });`,`}`,``,`installCompiledArtifactsBootstrap();`,...createWorkflowWorldBootstrapBody(t),``,`// Default export satisfies the Nitro plugin contract so this file`,`// can be used directly as a Nitro plugin without a separate wrapper.`,`export default function installCompiledArtifactsPlugin() {`,` // Already installed on import above.`,`}`,``,`export async function __eveInstallCompiledArtifactsStep() {`,` "use step";`,` return null;`,`}`,``].join(`
|
|
3
|
+
`)}function createWorkflowWorldBootstrapImports(t){return t===void 0?[]:[`import * as workflowWorldModule from ${stringifyEsmImportSpecifier(t)};`,`import { installConfiguredWorkflowWorld } from ${stringifyEsmImportSpecifier(resolvePackageSourceFilePath(`src/internal/workflow/configure-world.ts`))};`]}function createWorkflowWorldBootstrapBody(e){return e===void 0?[]:[``,`await installConfiguredWorkflowWorld({ module: workflowWorldModule });`]}function createInstrumentationPluginSource(e){return[`// Generated by eve. Do not edit by hand.`,`import * as instrumentationModule from ${stringifyEsmImportSpecifier(e.instrumentationPath)};`,`import { registerInstrumentationConfig } from ${stringifyEsmImportSpecifier(e.registerConfigPath)};`,``,`if (instrumentationModule.default != null) {`,` registerInstrumentationConfig(instrumentationModule.default, { agentName: ${JSON.stringify(e.agentName)} });`,`}`,``,`// Default export satisfies the Nitro plugin contract so this file`,`// can be used directly as a Nitro plugin without a separate wrapper.`,`export default function installInstrumentationPlugin() {}`,``].join(`
|
|
4
|
+
`)}export{createCompiledArtifactsBootstrapSource,writeCompiledArtifactsFiles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire}from"node:module";import{existsSync,readFileSync,realpathSync}from"node:fs";import{basename,dirname,join}from"node:path";import{EVE_PACKAGE_NAME}from"#internal/package-name.js";import{fileURLToPath}from"node:url";let cachedPackageInfo;const BUNDLED_FALLBACK_PACKAGE_VERSION=`0.11.
|
|
1
|
+
import{createRequire}from"node:module";import{existsSync,readFileSync,realpathSync}from"node:fs";import{basename,dirname,join}from"node:path";import{EVE_PACKAGE_NAME}from"#internal/package-name.js";import{fileURLToPath}from"node:url";let cachedPackageInfo;const BUNDLED_FALLBACK_PACKAGE_VERSION=`0.11.9`,WORKFLOW_MODULE_ALIASES={"workflow/api":`src/compiled/@workflow/core/runtime.js`,"workflow/errors":`src/compiled/@workflow/errors/index.js`,"workflow/internal/private":`src/compiled/@workflow/core/private.js`,"workflow/runtime":`src/compiled/@workflow/core/runtime.js`};function resolveFallbackPackageVersion(){return BUNDLED_FALLBACK_PACKAGE_VERSION.startsWith(`__`)?`0.0.0`:BUNDLED_FALLBACK_PACKAGE_VERSION}const FALLBACK_PACKAGE_INFO={name:EVE_PACKAGE_NAME,version:resolveFallbackPackageVersion()};function resolveCurrentModulePath(){return typeof __filename==`string`?__filename:resolveCurrentModulePathFromStack()}function resolveCurrentModulePathFromStack(){let e=Error.prepareStackTrace;try{Error.prepareStackTrace=(e,t)=>t;let e=Error().stack?.[0]?.getFileName();if(typeof e!=`string`||e.length===0)throw Error(`Failed to resolve the current module path from the stack trace.`);return e.startsWith(`file:`)?fileURLToPath(e):e}finally{Error.prepareStackTrace=e}}const require=createRequire(resolveCurrentModulePath());function isBuildOutputPackageRoot(e){return basename(e)===`dist`&&existsSync(join(dirname(e),`package.json`))}function resolvePackageBuildRoot(){let e=dirname(realpathSync(resolveCurrentModulePath()));for(;;){if(isBuildOutputPackageRoot(e))return e;let t=dirname(e);if(t===e)return null;e=t}}function findNearestPackageRoot(e){let n=e;for(;;){if(existsSync(join(n,`package.json`))&&!isBuildOutputPackageRoot(n))return n;let r=dirname(n);if(r===n)throw Error(`Failed to resolve package root from "${e}".`);n=r}}function resolvePackageRoot(){return findNearestPackageRoot(dirname(realpathSync(resolveCurrentModulePath())))}function tryResolvePackageRoot(){try{return resolvePackageRoot()}catch{return}}function rewriteSourceFilePathForBuild(e){return e.replace(/\.[cm]?tsx?$/,`.js`)}function resolvePackageSourceFilePath(e){let t=resolvePackageBuildRoot();return t===null?join(resolvePackageRoot(),e):join(t,rewriteSourceFilePathForBuild(e))}function resolvePackageSourceDirectoryPath(e){let t=resolvePackageBuildRoot();return join(t===null?resolvePackageRoot():t,e)}function resolvePackageDependencyPath(e){return require.resolve(e)}function resolvePackageCompiledFilePath(e){let t=resolvePackageBuildRoot();return t===null?join(resolvePackageRoot(),`.generated`,`compiled`,e.replace(/^src\/compiled\//,``)):join(t,e)}function normalizeInstalledPackageInfo(e){let t=e;if(!(typeof t.name!=`string`||typeof t.version!=`string`))return{name:t.name,version:t.version}}function tryReadInstalledPackageInfo(e,t){let r=normalizeInstalledPackageInfo(JSON.parse(readFileSync(e,`utf8`)));if(r?.name===t)return r}function resolveInstalledPackageInfo(){if(cachedPackageInfo)return cachedPackageInfo;let e=tryResolvePackageRoot(),t=e===void 0?void 0:tryReadInstalledPackageInfo(join(e,`package.json`),EVE_PACKAGE_NAME);if(t)return cachedPackageInfo=t,cachedPackageInfo;try{let e=tryReadInstalledPackageInfo(require.resolve(`${EVE_PACKAGE_NAME}/package.json`),EVE_PACKAGE_NAME);if(e)return cachedPackageInfo=e,cachedPackageInfo}catch{}return cachedPackageInfo={...FALLBACK_PACKAGE_INFO},cachedPackageInfo}function resolveWorkflowModulePath(e){if(e===`workflow`)return resolvePackageSourceFilePath(`src/internal/workflow/index.ts`);if(e===`workflow/internal/builtins`)return resolvePackageSourceFilePath(`src/internal/workflow/builtins.ts`);let t=WORKFLOW_MODULE_ALIASES[e];return t===void 0?require.resolve(e):resolvePackageCompiledFilePath(t)}export{resolveInstalledPackageInfo,resolvePackageDependencyPath,resolvePackageRoot,resolvePackageSourceDirectoryPath,resolvePackageSourceFilePath,resolveWorkflowModulePath};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{expectBoolean,expectFunction,expectObjectRecord,expectOnlyKnownKeys,expectProviderOptions,expectString,getOptionalStringRecordProperty}from"#internal/authored-module.js";function normalizeAgentDefinition(e,t){let i=expectObjectRecord(e,t);if(expectOnlyKnownKeys(i,[`build`,`compaction`,`description`,`experimental`,`model`,`modelContextWindowTokens`,`modelOptions`,`outputSchema`],t),i.model===void 0)throw Error(`${t} The "model" field is required.`);let o={model:i.model};return i.description!==void 0&&(o.description=expectString(i.description,t)),i.compaction!==void 0&&(o.compaction=normalizeAgentCompactionDefinition(i.compaction,t)),i.build!==void 0&&(o.build=normalizeAgentBuildDefinition(i.build,t)),i.experimental!==void 0&&(o.experimental=normalizeAgentExperimentalDefinition(i.experimental,t)),i.modelOptions!==void 0&&(o.modelOptions=normalizeAgentModelOptions(i.modelOptions,t)),i.modelContextWindowTokens!==void 0&&(o.modelContextWindowTokens=expectPositiveInteger(i.modelContextWindowTokens,t)),i.outputSchema!==void 0&&(o.outputSchema=i.outputSchema),o}function expectPositiveInteger(e,t){if(typeof e!=`number`||!Number.isInteger(e)||e<=0)throw Error(t);return e}function normalizeAgentBuildDefinition(e,t){let i=expectObjectRecord(e,t);expectOnlyKnownKeys(i,[`externalDependencies`],t);let o={};if(i.externalDependencies!==void 0){if(!Array.isArray(i.externalDependencies))throw Error(t);o.externalDependencies=Object.freeze(i.externalDependencies.map(e=>expectString(e,t)))}return o}function normalizeAgentExperimentalDefinition(t,i){let a=expectObjectRecord(t,i);expectOnlyKnownKeys(a,[`codeMode`],i);let o={};return a.codeMode!==void 0&&(o.codeMode=expectBoolean(a.codeMode,i)),o}function normalizeAgentModelOptions(e,t){let a=expectObjectRecord(e,t);expectOnlyKnownKeys(a,[`providerOptions`],t);let o=a.providerOptions;return o===void 0?{}:{providerOptions:expectProviderOptions(o,t)}}function normalizeAgentCompactionDefinition(e,t){let i=expectObjectRecord(e,t);expectOnlyKnownKeys(i,[`model`,`modelContextWindowTokens`,`thresholdPercent`],t);let a={};if(i.model!==void 0&&(a.model=i.model),i.modelContextWindowTokens!==void 0&&(a.modelContextWindowTokens=expectPositiveInteger(i.modelContextWindowTokens,t)),i.thresholdPercent!==void 0){let e=i.thresholdPercent;if(typeof e!=`number`||!Number.isFinite(e)||e<0||e>1)throw Error(t);a.thresholdPercent=e}return a}function normalizeInstructionsDefinition(e,t){let i=expectObjectRecord(e,t);return expectOnlyKnownKeys(i,[`markdown`],t),{markdown:expectString(i.markdown,t)}}function normalizeSkillDefinition(e,t){let i=expectObjectRecord(e,t);expectOnlyKnownKeys(i,[`description`,`files`,`license`,`markdown`,`metadata`],t);let s={description:expectString(i.description,t),markdown:expectString(i.markdown,t)},c=i.license,l=getOptionalStringRecordProperty(i,`metadata`,t);return c!==void 0&&(s.license=expectString(c,t)),l!==void 0&&(s.metadata=l),i.files!==void 0&&(s.files=normalizeSkillFiles(i.files,t)),s}function normalizeSkillFiles(e,t){let r=expectObjectRecord(e,t),i={};for(let[e,n]of Object.entries(r)){if(typeof n==`string`||n instanceof Uint8Array){i[e]=n;continue}throw Error(`${t} Expected skill file "${e}" to be a string or Uint8Array.`)}return i}function normalizeScheduleDefinition(e,i){let o=expectObjectRecord(e,i);expectOnlyKnownKeys(o,[`cron`,`markdown`,`run`],i);let s=expectString(o.cron,i),c=o.markdown!==void 0,l=o.run!==void 0;if(c&&l)throw Error(`${i} Pass either "markdown" (fire-and-forget) or "run" (handler) — not both.`);if(!c&&!l)throw Error(`${i} Must provide either "markdown" (fire-and-forget) or "run" (handler).`);let u={cron:s};return c?u.markdown=expectString(o.markdown,i):u.run=expectFunction(o.run,i),u}export{normalizeAgentDefinition,normalizeInstructionsDefinition,normalizeScheduleDefinition,normalizeSkillDefinition};
|
|
1
|
+
import{expectBoolean,expectFunction,expectObjectRecord,expectOnlyKnownKeys,expectProviderOptions,expectString,getOptionalStringRecordProperty}from"#internal/authored-module.js";function normalizeAgentDefinition(e,t){let i=expectObjectRecord(e,t);if(expectOnlyKnownKeys(i,[`build`,`compaction`,`description`,`experimental`,`model`,`modelContextWindowTokens`,`modelOptions`,`outputSchema`],t),i.model===void 0)throw Error(`${t} The "model" field is required.`);let o={model:i.model};return i.description!==void 0&&(o.description=expectString(i.description,t)),i.compaction!==void 0&&(o.compaction=normalizeAgentCompactionDefinition(i.compaction,t)),i.build!==void 0&&(o.build=normalizeAgentBuildDefinition(i.build,t)),i.experimental!==void 0&&(o.experimental=normalizeAgentExperimentalDefinition(i.experimental,t)),i.modelOptions!==void 0&&(o.modelOptions=normalizeAgentModelOptions(i.modelOptions,t)),i.modelContextWindowTokens!==void 0&&(o.modelContextWindowTokens=expectPositiveInteger(i.modelContextWindowTokens,t)),i.outputSchema!==void 0&&(o.outputSchema=i.outputSchema),o}function expectPositiveInteger(e,t){if(typeof e!=`number`||!Number.isInteger(e)||e<=0)throw Error(t);return e}function normalizeAgentBuildDefinition(e,t){let i=expectObjectRecord(e,t);expectOnlyKnownKeys(i,[`externalDependencies`],t);let o={};if(i.externalDependencies!==void 0){if(!Array.isArray(i.externalDependencies))throw Error(t);o.externalDependencies=Object.freeze(i.externalDependencies.map(e=>expectString(e,t)))}return o}function normalizeAgentWorkflowDefinition(e,t){let i=expectObjectRecord(e,t);expectOnlyKnownKeys(i,[`world`],t);let a={};return i.world!==void 0&&(a.world=normalizeAgentWorkflowWorldDefinition(i.world,t)),a}function normalizeAgentWorkflowWorldDefinition(e,t){let n=expectString(e,t);if(n.trim()===``)throw Error(`${t} "experimental.workflow.world" must be a non-empty package name.`);return n}function normalizeAgentExperimentalDefinition(t,i){let a=expectObjectRecord(t,i);expectOnlyKnownKeys(a,[`codeMode`,`workflow`],i);let o={};return a.codeMode!==void 0&&(o.codeMode=expectBoolean(a.codeMode,i)),a.workflow!==void 0&&(o.workflow=normalizeAgentWorkflowDefinition(a.workflow,i)),o}function normalizeAgentModelOptions(e,t){let a=expectObjectRecord(e,t);expectOnlyKnownKeys(a,[`providerOptions`],t);let o=a.providerOptions;return o===void 0?{}:{providerOptions:expectProviderOptions(o,t)}}function normalizeAgentCompactionDefinition(e,t){let i=expectObjectRecord(e,t);expectOnlyKnownKeys(i,[`model`,`modelContextWindowTokens`,`thresholdPercent`],t);let a={};if(i.model!==void 0&&(a.model=i.model),i.modelContextWindowTokens!==void 0&&(a.modelContextWindowTokens=expectPositiveInteger(i.modelContextWindowTokens,t)),i.thresholdPercent!==void 0){let e=i.thresholdPercent;if(typeof e!=`number`||!Number.isFinite(e)||e<0||e>1)throw Error(t);a.thresholdPercent=e}return a}function normalizeInstructionsDefinition(e,t){let i=expectObjectRecord(e,t);return expectOnlyKnownKeys(i,[`markdown`],t),{markdown:expectString(i.markdown,t)}}function normalizeSkillDefinition(e,t){let i=expectObjectRecord(e,t);expectOnlyKnownKeys(i,[`description`,`files`,`license`,`markdown`,`metadata`],t);let s={description:expectString(i.description,t),markdown:expectString(i.markdown,t)},c=i.license,l=getOptionalStringRecordProperty(i,`metadata`,t);return c!==void 0&&(s.license=expectString(c,t)),l!==void 0&&(s.metadata=l),i.files!==void 0&&(s.files=normalizeSkillFiles(i.files,t)),s}function normalizeSkillFiles(e,t){let r=expectObjectRecord(e,t),i={};for(let[e,n]of Object.entries(r)){if(typeof n==`string`||n instanceof Uint8Array){i[e]=n;continue}throw Error(`${t} Expected skill file "${e}" to be a string or Uint8Array.`)}return i}function normalizeScheduleDefinition(e,i){let o=expectObjectRecord(e,i);expectOnlyKnownKeys(o,[`cron`,`markdown`,`run`],i);let s=expectString(o.cron,i),c=o.markdown!==void 0,l=o.run!==void 0;if(c&&l)throw Error(`${i} Pass either "markdown" (fire-and-forget) or "run" (handler) — not both.`);if(!c&&!l)throw Error(`${i} Must provide either "markdown" (fire-and-forget) or "run" (handler).`);let u={cron:s};return c?u.markdown=expectString(o.markdown,i):u.run=expectFunction(o.run,i),u}export{normalizeAgentDefinition,normalizeInstructionsDefinition,normalizeScheduleDefinition,normalizeSkillDefinition};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { World } from "#compiled/@workflow/world/index.js";
|
|
2
|
+
export interface ConfiguredWorkflowWorldModule {
|
|
3
|
+
readonly [name: string]: unknown;
|
|
4
|
+
readonly default?: unknown;
|
|
5
|
+
}
|
|
6
|
+
export interface InstallConfiguredWorkflowWorldInput {
|
|
7
|
+
readonly module: ConfiguredWorkflowWorldModule | (() => unknown);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Installs a Workflow world selected by the compiled agent config.
|
|
11
|
+
*/
|
|
12
|
+
export declare function installConfiguredWorkflowWorld(input: InstallConfiguredWorkflowWorldInput): Promise<World>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{setWorld}from"#compiled/@workflow/core/runtime.js";async function installConfiguredWorkflowWorld(t){let n=await createWorkflowWorld(t);return setWorld(n),await n.start?.(),n}async function createWorkflowWorld(e){let t=await resolveWorkflowWorldFactory(e)();if(!isWorkflowWorld(t))throw Error(`Configured Workflow world factory did not return a valid World.`);return t}function resolveWorkflowWorldFactory(e){if(typeof e.module==`function`)return e.module;if(typeof e.module.default==`function`)return e.module.default;if(typeof e.module.createWorld==`function`)return e.module.createWorld;throw Error(`Configured Workflow world module must export a default function or "createWorld" function.`)}function isWorkflowWorld(e){return typeof e==`object`&&!!e&&`createQueueHandler`in e&&typeof e.createQueueHandler==`function`&&`events`in e&&typeof e.events==`object`&&e.events!==null}export{installConfiguredWorkflowWorld};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PublicAgentDefinition } from "#shared/agent-definition.js";
|
|
2
2
|
import type { ExactDefinition } from "#public/definitions/exact.js";
|
|
3
|
-
export type { AgentModelOptionsDefinition, AgentBuildDefinition, AgentExperimentalDefinition, PublicAgentModelDefinition as AgentModelDefinition, PublicAgentCompactionDefinition as AgentCompactionDefinition, } from "#shared/agent-definition.js";
|
|
3
|
+
export type { AgentModelOptionsDefinition, AgentBuildDefinition, AgentExperimentalDefinition, AgentWorkflowDefinition, AgentWorkflowWorldDefinition, PublicAgentModelDefinition as AgentModelDefinition, PublicAgentCompactionDefinition as AgentCompactionDefinition, } from "#shared/agent-definition.js";
|
|
4
4
|
/**
|
|
5
5
|
* Additive public agent configuration authored in `agent.ts`.
|
|
6
6
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Core agent authoring helpers for `agent/agent.ts`.
|
|
3
3
|
*/
|
|
4
|
-
export { type AgentCompactionDefinition, type AgentDefinition, type AgentExperimentalDefinition, type AgentModelDefinition, type AgentModelOptionsDefinition, defineAgent, } from "#public/definitions/agent.js";
|
|
4
|
+
export { type AgentCompactionDefinition, type AgentDefinition, type AgentExperimentalDefinition, type AgentModelDefinition, type AgentModelOptionsDefinition, type AgentWorkflowDefinition, type AgentWorkflowWorldDefinition, defineAgent, } from "#public/definitions/agent.js";
|
|
5
5
|
export { type RemoteAgentDefinition, type RemoteAgentDefinitionInput, defineRemoteAgent, } from "#public/definitions/remote-agent.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{getPackageManagerStrategy}from"../../primitives/pm/index.js";import{pinnedNodeEngineMajor}from"../../node-engine.js";import{pathExists,writeTextFile}from"../files.js";import{resolveVersionToken}from"../version-tokens.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{WEB_APP_TEMPLATE_FILES}from"./web-template.js";import{basename,join,resolve}from"node:path";import{mkdir,readdir,stat}from"node:fs/promises";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,ALLOWED_CREATE_IN_PLACE_ENTRIES=new Set([`.DS_Store`,`.git`,`.gitkeep`,`.hg`]),DEFAULT_AI_PACKAGE_VERSION=`7.0.0-beta.178`,DEFAULT_CONNECT_PACKAGE_VERSION=`0.2.2`,DEFAULT_ZOD_PACKAGE_VERSION=`4.4.3`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.11.
|
|
1
|
+
import{getPackageManagerStrategy}from"../../primitives/pm/index.js";import{pinnedNodeEngineMajor}from"../../node-engine.js";import{pathExists,writeTextFile}from"../files.js";import{resolveVersionToken}from"../version-tokens.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{WEB_APP_TEMPLATE_FILES}from"./web-template.js";import{basename,join,resolve}from"node:path";import{mkdir,readdir,stat}from"node:fs/promises";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,ALLOWED_CREATE_IN_PLACE_ENTRIES=new Set([`.DS_Store`,`.git`,`.gitkeep`,`.hg`]),DEFAULT_AI_PACKAGE_VERSION=`7.0.0-beta.178`,DEFAULT_CONNECT_PACKAGE_VERSION=`0.2.2`,DEFAULT_ZOD_PACKAGE_VERSION=`4.4.3`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.11.9`,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){return{"agent/agent.ts":BASE_AGENT_TEMPLATE.replaceAll(`__EVE_INIT_MODEL__`,e),"agent/channels/eve.ts":WEB_APP_TEMPLATE_FILES[`agent/channels/eve.ts`],"agent/instructions.md":AGENT_INSTRUCTIONS_TEMPLATE}}function renderTemplate(e,t){return e.replaceAll(`__EVE_INIT_APP_NAME__`,t.appName).replaceAll(`__EVE_INIT_MODEL__`,t.model).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__",
|
|
@@ -107,6 +107,11 @@ export interface AgentExperimentalDefinition {
|
|
|
107
107
|
* environment variable (`"1"` enables it) for backwards compatibility.
|
|
108
108
|
*/
|
|
109
109
|
readonly codeMode?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Durable Workflow runtime configuration. Root agents may use this to select
|
|
112
|
+
* the Workflow world backing sessions and runs.
|
|
113
|
+
*/
|
|
114
|
+
readonly workflow?: AgentWorkflowDefinition;
|
|
110
115
|
}
|
|
111
116
|
/**
|
|
112
117
|
* Advanced hosted-build controls authored in `agent.ts`.
|
|
@@ -126,6 +131,24 @@ export interface AgentBuildDefinition {
|
|
|
126
131
|
*/
|
|
127
132
|
readonly externalDependencies?: string[];
|
|
128
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Package name for a Workflow world module.
|
|
136
|
+
*
|
|
137
|
+
* The package must export either a default factory or a `createWorld` factory.
|
|
138
|
+
* The factory is called at runtime so credentials and deployment-specific
|
|
139
|
+
* options can come from environment variables instead of the compiled manifest.
|
|
140
|
+
*/
|
|
141
|
+
export type AgentWorkflowWorldDefinition = string;
|
|
142
|
+
/**
|
|
143
|
+
* Advanced durable-runtime configuration for eve's Workflow SDK integration.
|
|
144
|
+
*/
|
|
145
|
+
export interface AgentWorkflowDefinition {
|
|
146
|
+
/**
|
|
147
|
+
* Workflow world module used for durable workflow storage, queueing, hooks,
|
|
148
|
+
* and streaming.
|
|
149
|
+
*/
|
|
150
|
+
readonly world?: AgentWorkflowWorldDefinition;
|
|
151
|
+
}
|
|
129
152
|
/**
|
|
130
153
|
* Compiled-side agent definition. Carries a `name` because the compiler
|
|
131
154
|
* stamps the path-derived `agentId` onto every compiled agent node.
|
package/docs/agent-config.md
CHANGED
|
@@ -54,16 +54,43 @@ export default defineAgent({
|
|
|
54
54
|
|
|
55
55
|
See [Default harness](./concepts/default-harness#compaction) for how the loop applies it.
|
|
56
56
|
|
|
57
|
+
## Workflow world
|
|
58
|
+
|
|
59
|
+
By default, eve selects the Workflow SDK world for the host: Vercel Workflow on
|
|
60
|
+
Vercel, and the SDK's local world in local development or `eve start`. Advanced
|
|
61
|
+
self-hosted deployments can select the Workflow world package to use from the
|
|
62
|
+
root `agent.ts`:
|
|
63
|
+
|
|
64
|
+
```ts title="agent/agent.ts"
|
|
65
|
+
import { defineAgent } from "eve";
|
|
66
|
+
|
|
67
|
+
export default defineAgent({
|
|
68
|
+
model: "anthropic/claude-opus-4.8",
|
|
69
|
+
experimental: {
|
|
70
|
+
workflow: {
|
|
71
|
+
world: "@workflow/world-postgres",
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Install that package in your app. It should export a default factory or
|
|
78
|
+
`createWorld()` function.
|
|
79
|
+
|
|
80
|
+
Put credentials and host-specific options in runtime environment variables read
|
|
81
|
+
by the world package, not in `agent.ts`. If the installed package must stay
|
|
82
|
+
external in hosted output, list it in `build.externalDependencies`.
|
|
83
|
+
|
|
57
84
|
## Other defineAgent fields
|
|
58
85
|
|
|
59
86
|
`defineAgent` takes a few more fields, all optional. For the exported types, see the [TypeScript API](./reference/typescript-api).
|
|
60
87
|
|
|
61
|
-
| Field | Type
|
|
62
|
-
| -------------- |
|
|
63
|
-
| `modelOptions` | `AgentModelOptionsDefinition`
|
|
64
|
-
| `experimental` | `{ codeMode?: boolean }`
|
|
65
|
-
| `outputSchema` | Standard Schema or a JSON Schema object
|
|
66
|
-
| `build` | `{ externalDependencies?: string[] }`
|
|
88
|
+
| Field | Type | Default | Description |
|
|
89
|
+
| -------------- | ------------------------------------------------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
90
|
+
| `modelOptions` | `AgentModelOptionsDefinition` | none | Provider option overrides forwarded to the model call. |
|
|
91
|
+
| `experimental` | `{ codeMode?: boolean; workflow?: { world?: string } }` | flags unset | Opt-in flags that can change or disappear in any release. Treat them as unstable. `codeMode` routes executable tools through a sandboxed code-execution wrapper, where the model writes JavaScript that calls the tools inside the [sandbox](./sandbox). `workflow.world` selects the Workflow world package backing session state, queues, hooks, and streams on the root agent. |
|
|
92
|
+
| `outputSchema` | Standard Schema or a JSON Schema object | none | Structured return type for task-mode runs (a subagent, schedule, or remote job). Interactive conversation turns ignore it unless the client supplies a per-message schema. |
|
|
93
|
+
| `build` | `{ externalDependencies?: string[] }` | none | Hosted-build packaging controls. `externalDependencies` keeps listed packages external while eve compiles authored modules such as tools and channels, and traces those packages into the hosted output. |
|
|
67
94
|
|
|
68
95
|
`codeMode` is experimental and may change or be removed.
|
|
69
96
|
|
|
@@ -24,20 +24,20 @@ Compaction also preserves the framework's own tool state automatically. It reset
|
|
|
24
24
|
|
|
25
25
|
These ship with every agent, no imports. The harness shows the model the tool descriptors first, then executes only what the model actually calls; discovery never runs them. The shell and file tools (`bash`, `read_file`, `write_file`, `glob`, `grep`) live in the app runtime and proxy their work into the agent's single [sandbox](../sandbox); the rest run in the app runtime. The "Where it runs" column below names where each tool's effect lands.
|
|
26
26
|
|
|
27
|
-
| Tool | Does
|
|
28
|
-
| ------------------- |
|
|
29
|
-
| `bash` | Run a shell command.
|
|
30
|
-
| `read_file` | Read a text file with line-numbered output (enables read-before-write).
|
|
31
|
-
| `write_file` | Write a complete file; enforces read-before-write and stale-read detection.
|
|
32
|
-
| `glob` | Find files by glob pattern.
|
|
33
|
-
| `grep` | Search file contents by regex.
|
|
34
|
-
| `web_fetch` | Fetch a URL.
|
|
35
|
-
| `web_search` | Search the web (provider-managed; resolved from the model provider).
|
|
36
|
-
| `todo` | Maintain a durable per-session todo list.
|
|
37
|
-
| `ask_question` | Ask the user a clarifying question or a choice mid-turn and park until they answer. No `execute`; the model calls it with `{ prompt, options?, allowFreeform? }`. See [Human-in-the-loop](
|
|
38
|
-
| `agent` | Delegate a subtask to a copy of itself (shares the parent sandbox + tools, fresh history/state).
|
|
39
|
-
| `load_skill` | Pull an on-demand [skill](../skills)'s instructions into the current turn. Present only when the agent declares skills.
|
|
40
|
-
| `connection_search` | Discover tools across declared [connections](../connections); matched tools become directly callable. Present only when the agent declares connections.
|
|
27
|
+
| Tool | Does | Where it runs |
|
|
28
|
+
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
|
|
29
|
+
| `bash` | Run a shell command. | Sandbox |
|
|
30
|
+
| `read_file` | Read a text file with line-numbered output (enables read-before-write). | Sandbox FS |
|
|
31
|
+
| `write_file` | Write a complete file; enforces read-before-write and stale-read detection. | Sandbox FS |
|
|
32
|
+
| `glob` | Find files by glob pattern. | Sandbox FS |
|
|
33
|
+
| `grep` | Search file contents by regex. | Sandbox FS |
|
|
34
|
+
| `web_fetch` | Fetch a URL. | App runtime |
|
|
35
|
+
| `web_search` | Search the web (provider-managed; resolved from the model provider). | Provider |
|
|
36
|
+
| `todo` | Maintain a durable per-session todo list. | App runtime |
|
|
37
|
+
| `ask_question` | Ask the user a clarifying question or a choice mid-turn and park until they answer. No `execute`; the model calls it with `{ prompt, options?, allowFreeform? }`. See [Human-in-the-loop](/docs/human-in-the-loop). | App runtime |
|
|
38
|
+
| `agent` | Delegate a subtask to a copy of itself (shares the parent sandbox + tools, fresh history/state). | App runtime |
|
|
39
|
+
| `load_skill` | Pull an on-demand [skill](../skills)'s instructions into the current turn. Present only when the agent declares skills. | App runtime |
|
|
40
|
+
| `connection_search` | Discover tools across declared [connections](../connections); matched tools become directly callable. Present only when the agent declares connections. | App runtime |
|
|
41
41
|
|
|
42
42
|
Notes:
|
|
43
43
|
|
|
@@ -19,7 +19,22 @@ The Workflow SDK is not inherently tied to Vercel. In local development and in a
|
|
|
19
19
|
|
|
20
20
|
Nitro hosts the HTTP routes and workflow entrypoints. It does not supply the workflow state store or the sandbox runtime. Those are separate adapters: Workflow uses the active world implementation, and Sandbox uses the backend from `agent/sandbox` or `defaultBackend()`.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
For advanced self-hosted deployments, the root `agent.ts` can select the installed Workflow world package to use with `experimental.workflow.world`:
|
|
23
|
+
|
|
24
|
+
```ts title="agent/agent.ts"
|
|
25
|
+
import { defineAgent } from "eve";
|
|
26
|
+
|
|
27
|
+
export default defineAgent({
|
|
28
|
+
model: "anthropic/claude-opus-4.8",
|
|
29
|
+
experimental: {
|
|
30
|
+
workflow: {
|
|
31
|
+
world: "@workflow/world-postgres",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The world package backs workflow state, queues, hooks, and streams. Keep secrets and deployment-specific options in runtime environment variables read by that package, not in `agent.ts`. See [agent.ts](../agent-config#workflow-world) and [Workflow Worlds](https://workflow-sdk.dev/worlds).
|
|
23
38
|
|
|
24
39
|
## Resuming after a crash
|
|
25
40
|
|
|
@@ -34,33 +34,33 @@ curl http://127.0.0.1:3000/eve/v1/session/<sessionId>/stream
|
|
|
34
34
|
|
|
35
35
|
The stream is newline-delimited JSON (NDJSON), one event per line:
|
|
36
36
|
|
|
37
|
-
| Event | Meaning
|
|
38
|
-
| ------------------------- |
|
|
39
|
-
| `session.started` | A durable session was created.
|
|
40
|
-
| `turn.started` | A new turn began.
|
|
41
|
-
| `message.received` | An inbound user message was accepted.
|
|
42
|
-
| `step.started` | A model step began.
|
|
43
|
-
| `actions.requested` | The model requested tool calls.
|
|
44
|
-
| `action.result` | A tool call returned.
|
|
45
|
-
| `input.requested` | The run paused for human input ([HITL](
|
|
46
|
-
| `subagent.called` | A subagent was delegated; carries `childSessionId` to attach to.
|
|
47
|
-
| `subagent.completed` | A delegated subagent finished.
|
|
48
|
-
| `reasoning.appended` | A reasoning delta (incremental, with cumulative text so far).
|
|
49
|
-
| `reasoning.completed` | The finalized reasoning block.
|
|
50
|
-
| `message.appended` | An assistant text delta (incremental, with cumulative text so far).
|
|
51
|
-
| `message.completed` | A finalized assistant text block.
|
|
52
|
-
| `result.completed` | The finalized structured result for a turn that requested an output schema; carries `result`.
|
|
53
|
-
| `compaction.requested` | Context-window compaction began; carries `modelId`, `sessionId`, `turnId`, `usageInputTokens`.
|
|
54
|
-
| `compaction.completed` | A compaction checkpoint was written to durable history.
|
|
55
|
-
| `authorization.required` | A connection needs OAuth; carries `name`, `description`, and an `authorization` challenge.
|
|
56
|
-
| `authorization.completed` | A connection's authorization resolved; carries `outcome`.
|
|
57
|
-
| `step.completed` | A model step finished; carries `finishReason` and usage.
|
|
58
|
-
| `step.failed` | A model step failed; carries `{ code, message, details? }`.
|
|
59
|
-
| `turn.completed` | The turn finished.
|
|
60
|
-
| `turn.failed` | The turn failed; carries `{ code, message, details? }`.
|
|
61
|
-
| `session.waiting` | The session parked, waiting for the next input (a message, an answer).
|
|
62
|
-
| `session.failed` | The session failed.
|
|
63
|
-
| `session.completed` | The session reached a terminal end.
|
|
37
|
+
| Event | Meaning |
|
|
38
|
+
| ------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
39
|
+
| `session.started` | A durable session was created. |
|
|
40
|
+
| `turn.started` | A new turn began. |
|
|
41
|
+
| `message.received` | An inbound user message was accepted. |
|
|
42
|
+
| `step.started` | A model step began. |
|
|
43
|
+
| `actions.requested` | The model requested tool calls. |
|
|
44
|
+
| `action.result` | A tool call returned. |
|
|
45
|
+
| `input.requested` | The run paused for human input ([HITL](/docs/human-in-the-loop) approval or `ask_question`); carries `requests`. |
|
|
46
|
+
| `subagent.called` | A subagent was delegated; carries `childSessionId` to attach to. |
|
|
47
|
+
| `subagent.completed` | A delegated subagent finished. |
|
|
48
|
+
| `reasoning.appended` | A reasoning delta (incremental, with cumulative text so far). |
|
|
49
|
+
| `reasoning.completed` | The finalized reasoning block. |
|
|
50
|
+
| `message.appended` | An assistant text delta (incremental, with cumulative text so far). |
|
|
51
|
+
| `message.completed` | A finalized assistant text block. |
|
|
52
|
+
| `result.completed` | The finalized structured result for a turn that requested an output schema; carries `result`. |
|
|
53
|
+
| `compaction.requested` | Context-window compaction began; carries `modelId`, `sessionId`, `turnId`, `usageInputTokens`. |
|
|
54
|
+
| `compaction.completed` | A compaction checkpoint was written to durable history. |
|
|
55
|
+
| `authorization.required` | A connection needs OAuth; carries `name`, `description`, and an `authorization` challenge. |
|
|
56
|
+
| `authorization.completed` | A connection's authorization resolved; carries `outcome`. |
|
|
57
|
+
| `step.completed` | A model step finished; carries `finishReason` and usage. |
|
|
58
|
+
| `step.failed` | A model step failed; carries `{ code, message, details? }`. |
|
|
59
|
+
| `turn.completed` | The turn finished. |
|
|
60
|
+
| `turn.failed` | The turn failed; carries `{ code, message, details? }`. |
|
|
61
|
+
| `session.waiting` | The session parked, waiting for the next input (a message, an answer). |
|
|
62
|
+
| `session.failed` | The session failed. |
|
|
63
|
+
| `session.completed` | The session reached a terminal end. |
|
|
64
64
|
|
|
65
65
|
`reasoning.appended` and `message.appended` stream deltas as they arrive, and each one carries both the new delta and the cumulative text for the current block. The finalized block shows up on `message.completed` and `reasoning.completed`, which is the compatibility path for clients that don't render incremental streaming.
|
|
66
66
|
|
|
@@ -21,7 +21,22 @@ Nitro is the HTTP host layer. It gives eve a build artifact that can serve the h
|
|
|
21
21
|
|
|
22
22
|
On Vercel, eve emits Vercel Build Output, the Workflow SDK runs on Vercel Workflow, and `defaultBackend()` selects Vercel Sandbox. Outside Vercel, `eve start` serves the standard Nitro Node output, the Workflow SDK uses its local world by default, and `defaultBackend()` selects a local sandbox backend in availability order. That local workflow world persists run state on disk and has no direct coupling to Vercel; Vercel-only behavior such as latest-deployment routing and dashboard run attributes is additive.
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Advanced self-hosted deployments can select a different installed Workflow world package in the root `agent.ts`:
|
|
25
|
+
|
|
26
|
+
```ts title="agent/agent.ts"
|
|
27
|
+
import { defineAgent } from "eve";
|
|
28
|
+
|
|
29
|
+
export default defineAgent({
|
|
30
|
+
model: "anthropic/claude-opus-4.8",
|
|
31
|
+
experimental: {
|
|
32
|
+
workflow: {
|
|
33
|
+
world: "@acme/eve-workflow-world",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The world package should read credentials and host-specific options from runtime environment variables. It should export a default factory or `createWorld()` function. See [Workflow Worlds](https://workflow-sdk.dev/worlds) for the underlying SDK abstraction.
|
|
25
40
|
|
|
26
41
|
## 2. Environment variables and secrets
|
|
27
42
|
|
|
@@ -125,7 +140,7 @@ Eve writes the standard Nitro output under `.output/` instead of Vercel Build Ou
|
|
|
125
140
|
|
|
126
141
|
Self-deployed agents should make the Vercel-specific choices explicit:
|
|
127
142
|
|
|
128
|
-
- Let the Workflow SDK use its default local world, which stores workflow state under `.workflow-data`,
|
|
143
|
+
- Let the Workflow SDK use its default local world, which stores workflow state under `.workflow-data`, configure your host so that directory is on persistent storage, or select another world with `experimental.workflow.world` in the root `agent.ts`.
|
|
129
144
|
- Install the AI SDK package for your provider, then use a direct provider model object and `OPENAI_API_KEY` / `ANTHROPIC_API_KEY` when you want no Gateway dependency.
|
|
130
145
|
- Use `AI_GATEWAY_API_KEY` if you still want Gateway routing from a non-Vercel host.
|
|
131
146
|
- Replace `vercelOidc()` with auth that your host can verify.
|
|
@@ -100,7 +100,7 @@ Assistant text, reasoning, tool calls, and tool results stream into `data` as th
|
|
|
100
100
|
|
|
101
101
|
## Human-in-the-loop prompts
|
|
102
102
|
|
|
103
|
-
Tools opt into approval with `needsApproval`, and the model can also ask a question with `ask_question` — see [Human-in-the-loop](
|
|
103
|
+
Tools opt into approval with `needsApproval`, and the model can also ask a question with `ask_question` — see [Human-in-the-loop](/docs/human-in-the-loop) for the server-side model. Either way the stream emits an `input.requested` event, and the pending request rides on a `dynamic-tool` part of the latest message at `part.toolMetadata?.eve?.inputRequest`. Read it, then answer through the same session with `send()`:
|
|
104
104
|
|
|
105
105
|
```tsx
|
|
106
106
|
const request = agent.data.messages
|
|
@@ -50,7 +50,7 @@ export default defineTool({
|
|
|
50
50
|
| `defineEvalConfig` | `eve/evals` | `evals/evals.config.ts` | [Evals](../evals/overview) |
|
|
51
51
|
| `useEveAgent` | `eve/react`, `eve/vue`, `eve/svelte` | frontend | [Frontend](../guides/frontend/overview) |
|
|
52
52
|
|
|
53
|
-
A few non-`define*` helpers round out the set: `disableTool` and `ExperimentalWorkflow` from `eve/tools` (see [Default harness](../concepts/default-harness)), the route verbs `GET`/`POST`/`PUT`/`PATCH`/`DELETE`/`WS` from `eve/channels`, the approval predicates `always`/`once`/`never` from `eve/tools/approval`, and the channel auth helpers `localDev`/`vercelOidc`/`placeholderAuth` from `eve/channels/auth`. To wrap a built-in tool, import its default value from `eve/tools/defaults` (`bash`, `readFile`, `writeFile`, `glob`, `grep`, `webFetch`, `webSearch`, `todo`, `loadSkill`).
|
|
53
|
+
A few non-`define*` helpers round out the set: `disableTool` and `ExperimentalWorkflow` from `eve/tools` (see [Default harness](../concepts/default-harness)), the route verbs `GET`/`POST`/`PUT`/`PATCH`/`DELETE`/`WS` from `eve/channels`, the approval predicates `always`/`once`/`never` from `eve/tools/approval`, and the channel auth helpers `localDev`/`vercelOidc`/`placeholderAuth` from `eve/channels/auth`. To wrap a built-in tool, import its default value from `eve/tools/defaults` (`bash`, `readFile`, `writeFile`, `glob`, `grep`, `webFetch`, `webSearch`, `todo`, `loadSkill`). `AgentWorkflowDefinition` and `AgentWorkflowWorldDefinition` are exported from `eve` for the `defineAgent({ experimental: { workflow } })` config shape.
|
|
54
54
|
|
|
55
55
|
## Runtime context (`ctx`)
|
|
56
56
|
|
|
@@ -68,7 +68,7 @@ A few non-`define*` helpers round out the set: `disableTool` and `ExperimentalWo
|
|
|
68
68
|
|
|
69
69
|
| Import | Holds |
|
|
70
70
|
| ----------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
71
|
-
| `eve` | `defineAgent`, `defineRemoteAgent
|
|
71
|
+
| `eve` | `defineAgent`, `defineRemoteAgent`, agent config types |
|
|
72
72
|
| `eve/tools` | `defineTool`, `defineDynamic`, `disableTool`, `ExperimentalWorkflow` |
|
|
73
73
|
| `eve/tools/defaults` | the built-in tools as plain values |
|
|
74
74
|
| `eve/tools/approval` | `always`, `once`, `never` |
|