eve 0.32.0 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/README.md +8 -4
  3. package/dist/src/channel/channel-address.d.ts +4 -1
  4. package/dist/src/channel/channel-address.js +1 -1
  5. package/dist/src/channel/channel-operations.d.ts +3 -1
  6. package/dist/src/channel/compiled-channel.d.ts +2 -1
  7. package/dist/src/channel/cross-channel-receive.d.ts +5 -2
  8. package/dist/src/channel/cross-channel-receive.js +1 -1
  9. package/dist/src/channel/session.d.ts +6 -2
  10. package/dist/src/channel/session.js +1 -1
  11. package/dist/src/channel/types.d.ts +6 -0
  12. package/dist/src/channel/types.js +1 -1
  13. package/dist/src/chunks/{use-eve-agent-CX87G1vU.js → use-eve-agent-3oBnxzhV.js} +27 -17
  14. package/dist/src/chunks/{use-eve-agent-DwyRde1N.js → use-eve-agent-B-Hky2f4.js} +27 -17
  15. package/dist/src/cli/commands/agent-prompt/collect-intent.md +3 -0
  16. package/dist/src/cli/commands/agent-prompt/scaffold.md +4 -2
  17. package/dist/src/cli/commands/info.js +1 -1
  18. package/dist/src/cli/commands/init-repl.d.ts +1 -1
  19. package/dist/src/cli/commands/init-repl.js +1 -1
  20. package/dist/src/cli/commands/init.d.ts +7 -0
  21. package/dist/src/cli/commands/init.js +1 -1
  22. package/dist/src/cli/commands/integration-connect.d.ts +3 -3
  23. package/dist/src/cli/commands/integration-connect.js +1 -1
  24. package/dist/src/cli/commands/integration-setup.js +1 -1
  25. package/dist/src/cli/commands/set.d.ts +20 -0
  26. package/dist/src/cli/commands/set.js +1 -0
  27. package/dist/src/cli/dev/tui/runner.js +1 -1
  28. package/dist/src/cli/dev/tui/setup-issues.js +1 -1
  29. package/dist/src/cli/option-parsers.d.ts +3 -0
  30. package/dist/src/cli/option-parsers.js +1 -1
  31. package/dist/src/cli/run.js +1 -1
  32. package/dist/src/client/agent-info-schema.d.ts +28 -5
  33. package/dist/src/client/agent-info-schema.js +1 -1
  34. package/dist/src/client/session.js +1 -1
  35. package/dist/src/client/types.d.ts +3 -0
  36. package/dist/src/compiler/extension-compatibility.d.ts +19 -9
  37. package/dist/src/compiler/extension-compatibility.js +1 -1
  38. package/dist/src/compiler/manifest.d.ts +119 -19
  39. package/dist/src/compiler/manifest.js +1 -1
  40. package/dist/src/compiler/model-catalog.d.ts +2 -30
  41. package/dist/src/compiler/model-catalog.js +1 -1
  42. package/dist/src/compiler/module-map.d.ts +2 -2
  43. package/dist/src/compiler/module-map.js +2 -2
  44. package/dist/src/compiler/normalize-agent-config.js +1 -1
  45. package/dist/src/compiler/normalize-instructions.js +1 -1
  46. package/dist/src/compiler/normalize-manifest.js +2 -2
  47. package/dist/src/compiler/normalize-skill.js +1 -1
  48. package/dist/src/compiler/normalize-subagent.d.ts +5 -1
  49. package/dist/src/compiler/normalize-subagent.js +1 -1
  50. package/dist/src/compiler/remote-agent-node.d.ts +4 -1
  51. package/dist/src/compiler/workspace-resources.js +1 -1
  52. package/dist/src/context/dynamic-model-lifecycle.d.ts +7 -2
  53. package/dist/src/context/dynamic-model-lifecycle.js +1 -1
  54. package/dist/src/context/dynamic-subagent-lifecycle.js +1 -1
  55. package/dist/src/context/hook-lifecycle.js +1 -1
  56. package/dist/src/context/keys.d.ts +8 -0
  57. package/dist/src/context/keys.js +1 -1
  58. package/dist/src/evals/session.js +1 -1
  59. package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
  60. package/dist/src/execution/effective-agent-config.js +1 -1
  61. package/dist/src/execution/node-step.js +1 -1
  62. package/dist/src/execution/session-command-wire.js +1 -1
  63. package/dist/src/execution/session.d.ts +2 -0
  64. package/dist/src/execution/session.js +2 -2
  65. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  66. package/dist/src/execution/turn-control-receiver.d.ts +2 -0
  67. package/dist/src/execution/turn-control-receiver.js +1 -1
  68. package/dist/src/execution/workflow-steps.js +1 -1
  69. package/dist/src/harness/emission.d.ts +1 -1
  70. package/dist/src/harness/emission.js +1 -1
  71. package/dist/src/harness/step-hooks.d.ts +1 -1
  72. package/dist/src/harness/step-hooks.js +1 -1
  73. package/dist/src/harness/tool-loop.d.ts +1 -1
  74. package/dist/src/harness/tool-loop.js +2 -2
  75. package/dist/src/harness/types.d.ts +11 -5
  76. package/dist/src/harness/types.js +1 -1
  77. package/dist/src/internal/application/package.js +1 -1
  78. package/dist/src/internal/authored-definition/core.js +1 -1
  79. package/dist/src/internal/authored-definition/schema-backed.js +1 -1
  80. package/dist/src/internal/authored-module-loader.js +1 -1
  81. package/dist/src/internal/authored-module-map-loader.js +1 -1
  82. package/dist/src/internal/model-catalog.d.ts +46 -0
  83. package/dist/src/internal/model-catalog.js +1 -0
  84. package/dist/src/internal/nitro/host/build-vercel-agent-summary.js +1 -1
  85. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  86. package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
  87. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.js +1 -1
  88. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.d.ts +20 -10
  89. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
  90. package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
  91. package/dist/src/internal/nitro/routes/info.js +1 -1
  92. package/dist/src/internal/vercel-agent-summary.d.ts +12 -3
  93. package/dist/src/internal/vercel-agent-summary.js +1 -1
  94. package/dist/src/protocol/message.d.ts +2 -2
  95. package/dist/src/protocol/message.js +1 -1
  96. package/dist/src/public/channels/chat-sdk/chatSdkChannel.d.ts +5 -5
  97. package/dist/src/public/channels/chat-sdk/chatSdkChannel.js +2 -2
  98. package/dist/src/public/channels/discord/discordChannel.d.ts +3 -1
  99. package/dist/src/public/channels/discord/discordChannel.js +1 -1
  100. package/dist/src/public/channels/eve.d.ts +3 -1
  101. package/dist/src/public/channels/eve.js +1 -1
  102. package/dist/src/public/channels/github/githubChannel.d.ts +3 -1
  103. package/dist/src/public/channels/github/githubChannel.js +1 -1
  104. package/dist/src/public/channels/index.d.ts +1 -1
  105. package/dist/src/public/channels/linear/linearChannel.d.ts +3 -1
  106. package/dist/src/public/channels/linear/linearChannel.js +1 -1
  107. package/dist/src/public/channels/photon/photonIMessageChannel.d.ts +3 -1
  108. package/dist/src/public/channels/photon/photonIMessageChannel.js +1 -1
  109. package/dist/src/public/channels/slack/slackChannel.d.ts +3 -1
  110. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  111. package/dist/src/public/channels/teams/teamsChannel.d.ts +3 -1
  112. package/dist/src/public/channels/teams/teamsChannel.js +1 -1
  113. package/dist/src/public/channels/telegram/telegramChannel.d.ts +3 -1
  114. package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
  115. package/dist/src/public/channels/twilio/twilioChannel.d.ts +3 -1
  116. package/dist/src/public/channels/twilio/twilioChannel.js +1 -1
  117. package/dist/src/public/definitions/agent.d.ts +5 -7
  118. package/dist/src/public/definitions/agent.js +1 -1
  119. package/dist/src/public/definitions/channel.d.ts +3 -1
  120. package/dist/src/public/definitions/channel.js +1 -1
  121. package/dist/src/public/definitions/tool.d.ts +1 -5
  122. package/dist/src/public/definitions/tool.js +1 -1
  123. package/dist/src/public/index.d.ts +1 -1
  124. package/dist/src/runtime/agent/bootstrap.d.ts +19 -6
  125. package/dist/src/runtime/agent/bootstrap.js +1 -1
  126. package/dist/src/runtime/agent/model-catalog.d.ts +10 -0
  127. package/dist/src/runtime/agent/model-catalog.js +1 -0
  128. package/dist/src/runtime/agent/resolve-model.d.ts +8 -4
  129. package/dist/src/runtime/agent/resolve-model.js +1 -1
  130. package/dist/src/runtime/framework-channels/index.js +1 -1
  131. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  132. package/dist/src/runtime/resolve-agent.d.ts +2 -2
  133. package/dist/src/runtime/resolve-agent.js +1 -1
  134. package/dist/src/runtime/resolve-channel.js +1 -1
  135. package/dist/src/runtime/resolve-dynamic-subagent.d.ts +2 -5
  136. package/dist/src/runtime/subagents/dynamic-agent-config.d.ts +8 -7
  137. package/dist/src/runtime/subagents/dynamic-agent-config.js +1 -1
  138. package/dist/src/runtime/types.d.ts +11 -4
  139. package/dist/src/setup/flows/deploy.d.ts +5 -3
  140. package/dist/src/setup/flows/deploy.js +1 -1
  141. package/dist/src/setup/flows/ensure-vercel-project.d.ts +5 -1
  142. package/dist/src/setup/flows/ensure-vercel-project.js +1 -1
  143. package/dist/src/setup/flows/model-source-change.d.ts +1 -0
  144. package/dist/src/setup/flows/model-source-change.js +1 -1
  145. package/dist/src/setup/integrations/discord/setup.js +1 -1
  146. package/dist/src/setup/integrations/github/setup.js +1 -1
  147. package/dist/src/setup/integrations/linear/setup.js +1 -1
  148. package/dist/src/setup/integrations/photon/setup-flow.js +1 -1
  149. package/dist/src/setup/integrations/slack/setup.js +1 -1
  150. package/dist/src/setup/scaffold/create/add-to-project.d.ts +2 -0
  151. package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
  152. package/dist/src/setup/scaffold/create/project.d.ts +3 -1
  153. package/dist/src/setup/scaffold/create/project.js +4 -4
  154. package/dist/src/shared/agent-definition.d.ts +23 -23
  155. package/dist/src/shared/agent-definition.js +1 -1
  156. package/dist/src/shared/channel-definition.d.ts +3 -1
  157. package/dist/src/shared/dynamic-tool-definition.d.ts +4 -10
  158. package/dist/src/shared/dynamic-tool-definition.js +1 -1
  159. package/dist/src/svelte/index.js +1 -1
  160. package/dist/src/svelte/use-eve-agent.js +1 -1
  161. package/dist/src/vue/index.js +1 -1
  162. package/dist/src/vue/use-eve-agent.js +1 -1
  163. package/docs/agent-config.md +30 -19
  164. package/docs/channels/chat-sdk.mdx +5 -5
  165. package/docs/channels/custom.mdx +20 -0
  166. package/docs/channels/discord.mdx +1 -0
  167. package/docs/channels/eve.mdx +2 -0
  168. package/docs/channels/github.mdx +1 -1
  169. package/docs/channels/linear.mdx +1 -1
  170. package/docs/channels/overview.mdx +19 -0
  171. package/docs/channels/photon.mdx +5 -2
  172. package/docs/channels/slack.mdx +5 -11
  173. package/docs/concepts/execution-model-and-durability.mdx +5 -8
  174. package/docs/concepts/sessions-runs-and-streaming.md +2 -2
  175. package/docs/guides/dynamic-capabilities.md +24 -20
  176. package/docs/installation.mdx +7 -1
  177. package/docs/reference/cli.md +33 -8
  178. package/package.json +1 -1
@@ -21,7 +21,7 @@ export declare const ROOT_COMPILED_AGENT_NODE_ID = "__root__";
21
21
  /**
22
22
  * Current compiled manifest schema version.
23
23
  */
24
- export declare const COMPILED_AGENT_MANIFEST_VERSION = 39;
24
+ export declare const COMPILED_AGENT_MANIFEST_VERSION = 40;
25
25
  /**
26
26
  * Compiled channel entry preserved in the compiled manifest.
27
27
  */
@@ -76,8 +76,7 @@ export type CompiledRuntimeModelReference = InternalAgentModelDefinition & {
76
76
  routing: ModelRouting;
77
77
  };
78
78
  /**
79
- * Dynamic model resolver source preserved in the compiled manifest; the
80
- * compiled `config.model` remains the fallback model.
79
+ * Dynamic model resolver source preserved in the compiled manifest.
81
80
  */
82
81
  export type CompiledDynamicModelDefinition = ModuleSourceRef & {
83
82
  readonly eventNames: readonly string[];
@@ -92,11 +91,16 @@ type CompiledAgentCompactionDefinition = Omit<InternalAgentCompactionDefinition,
92
91
  /**
93
92
  * Normalized additive agent configuration preserved in the compiled manifest.
94
93
  */
95
- export type CompiledAgentDefinition = Omit<InternalAgentDefinition, "model" | "compaction"> & {
96
- model: CompiledRuntimeModelReference;
94
+ type CompiledAgentDefinitionBase = Omit<InternalAgentDefinition, "model" | "compaction"> & {
97
95
  compaction?: CompiledAgentCompactionDefinition;
98
- dynamicModel?: CompiledDynamicModelDefinition;
99
96
  };
97
+ export type CompiledAgentDefinition = CompiledAgentDefinitionBase & ({
98
+ readonly model: CompiledRuntimeModelReference;
99
+ readonly dynamicModel?: never;
100
+ } | {
101
+ readonly model?: never;
102
+ readonly dynamicModel: CompiledDynamicModelDefinition;
103
+ });
100
104
  /**
101
105
  * Normalized authored instructions prompt preserved in the compiled
102
106
  * manifest.
@@ -198,17 +202,19 @@ export interface CompiledHookDefinition extends ModuleSourceRef {
198
202
  * every flattened subagent node.
199
203
  */
200
204
  export type CompiledAgentNodeManifest = z.infer<typeof compiledAgentNodeManifestSchema>;
205
+ export type CompiledAgentResources = z.infer<typeof compiledAgentResourcesSchema>;
201
206
  export type CompiledSubagentNode = Readonly<ModuleSourceRef & Node & {
202
- agent: CompiledAgentNodeManifest;
203
207
  entryPath: string;
204
208
  name: string;
205
209
  rootPath: string;
206
210
  } & ({
211
+ agent: CompiledAgentNodeManifest;
212
+ configResolver?: never;
207
213
  description: string;
208
- dynamic?: never;
209
214
  } | {
215
+ agent: CompiledAgentResources;
216
+ configResolver: CompiledDynamicSubagentDefinition;
210
217
  description?: never;
211
- dynamic: CompiledDynamicSubagentDefinition;
212
218
  })>;
213
219
  export type { CompiledRemoteAgentNode } from "#compiler/remote-agent-node.js";
214
220
  /**
@@ -268,14 +274,105 @@ declare const compiledConnectionDefinitionSchema: z.ZodObject<{
268
274
  connector: z.ZodString;
269
275
  }, z.core.$strict>>;
270
276
  }, z.core.$strict>;
271
- /**
272
- * Zod schema for one non-recursive compiled authored agent payload.
273
- */
277
+ declare const compiledAgentResourcesSchema: z.ZodObject<{
278
+ agentRoot: z.ZodString;
279
+ appRoot: z.ZodString;
280
+ channels: z.ZodArray<z.ZodType<CompiledChannelEntry, unknown, z.core.$ZodTypeInternals<CompiledChannelEntry, unknown>>>;
281
+ connections: z.ZodArray<z.ZodObject<{
282
+ connectionName: z.ZodString;
283
+ description: z.ZodString;
284
+ exportName: z.ZodOptional<z.ZodString>;
285
+ logicalPath: z.ZodString;
286
+ protocol: z.ZodDefault<z.ZodEnum<{
287
+ mcp: "mcp";
288
+ openapi: "openapi";
289
+ }>>;
290
+ sourceId: z.ZodString;
291
+ sourceKind: z.ZodLiteral<"module">;
292
+ url: z.ZodString;
293
+ vercelConnect: z.ZodOptional<z.ZodObject<{
294
+ connector: z.ZodString;
295
+ }, z.core.$strict>>;
296
+ }, z.core.$strict>>;
297
+ diagnosticsSummary: z.ZodObject<{
298
+ errors: z.ZodNumber;
299
+ warnings: z.ZodNumber;
300
+ }, z.core.$strict>;
301
+ disabledFrameworkTools: z.ZodReadonly<z.ZodArray<z.ZodString>>;
302
+ workflowTool: z.ZodOptional<z.ZodType<CompiledWorkflowToolDefinition, unknown, z.core.$ZodTypeInternals<CompiledWorkflowToolDefinition, unknown>>>;
303
+ webSearchProvider: z.ZodOptional<z.ZodEnum<{
304
+ exa: "exa";
305
+ parallel: "parallel";
306
+ }>>;
307
+ dynamicInstructions: z.ZodDefault<z.ZodArray<z.ZodType<CompiledDynamicInstructionsDefinition, unknown, z.core.$ZodTypeInternals<CompiledDynamicInstructionsDefinition, unknown>>>>;
308
+ dynamicSkills: z.ZodDefault<z.ZodArray<z.ZodType<CompiledDynamicSkillDefinition, unknown, z.core.$ZodTypeInternals<CompiledDynamicSkillDefinition, unknown>>>>;
309
+ dynamicTools: z.ZodDefault<z.ZodArray<z.ZodType<CompiledDynamicToolDefinition, unknown, z.core.$ZodTypeInternals<CompiledDynamicToolDefinition, unknown>>>>;
310
+ extensionMounts: z.ZodDefault<z.ZodArray<z.ZodType<CompiledExtensionMount, unknown, z.core.$ZodTypeInternals<CompiledExtensionMount, unknown>>>>;
311
+ hooks: z.ZodArray<z.ZodType<CompiledHookDefinition, unknown, z.core.$ZodTypeInternals<CompiledHookDefinition, unknown>>>;
312
+ sandbox: z.ZodNullable<z.ZodObject<{
313
+ backendName: z.ZodOptional<z.ZodString>;
314
+ description: z.ZodOptional<z.ZodString>;
315
+ exportName: z.ZodOptional<z.ZodString>;
316
+ logicalPath: z.ZodString;
317
+ revalidationKey: z.ZodOptional<z.ZodString>;
318
+ sourceHash: z.ZodString;
319
+ sourceId: z.ZodString;
320
+ sourceKind: z.ZodLiteral<"module">;
321
+ }, z.core.$strict>>;
322
+ sandboxWorkspaces: z.ZodArray<z.ZodObject<{
323
+ logicalPath: z.ZodString;
324
+ rootEntries: z.ZodReadonly<z.ZodArray<z.ZodString>>;
325
+ sourceId: z.ZodString;
326
+ sourcePath: z.ZodString;
327
+ }, z.core.$strict>>;
328
+ schedules: z.ZodArray<z.ZodObject<{
329
+ cron: z.ZodString;
330
+ hasRun: z.ZodBoolean;
331
+ name: z.ZodString;
332
+ logicalPath: z.ZodString;
333
+ markdown: z.ZodOptional<z.ZodString>;
334
+ sourceId: z.ZodString;
335
+ sourceKind: z.ZodUnion<readonly [z.ZodLiteral<"markdown">, z.ZodLiteral<"module">]>;
336
+ }, z.core.$strict>>;
337
+ remoteAgents: z.ZodArray<z.ZodType<Readonly<ModuleSourceRef & Node & {
338
+ description: string;
339
+ entryPath: string;
340
+ name: string;
341
+ outputSchema?: import("../shared/json.ts").JsonObject;
342
+ path: string;
343
+ rootPath: string;
344
+ url?: string;
345
+ }>, unknown, z.core.$ZodTypeInternals<Readonly<ModuleSourceRef & Node & {
346
+ description: string;
347
+ entryPath: string;
348
+ name: string;
349
+ outputSchema?: import("../shared/json.ts").JsonObject;
350
+ path: string;
351
+ rootPath: string;
352
+ url?: string;
353
+ }>, unknown>>>;
354
+ skills: z.ZodReadonly<z.ZodArray<z.ZodType<CompiledSkillDefinition, unknown, z.core.$ZodTypeInternals<CompiledSkillDefinition, unknown>>>>;
355
+ instructions: z.ZodOptional<z.ZodType<CompiledInstructionsDefinition, unknown, z.core.$ZodTypeInternals<CompiledInstructionsDefinition, unknown>>>;
356
+ tools: z.ZodArray<z.ZodObject<{
357
+ description: z.ZodString;
358
+ exportName: z.ZodOptional<z.ZodString>;
359
+ inputSchema: z.ZodNullable<z.ZodType<import("../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../shared/json.ts").JsonObject, unknown>>>;
360
+ logicalPath: z.ZodString;
361
+ name: z.ZodString;
362
+ outputSchema: z.ZodOptional<z.ZodType<import("../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../shared/json.ts").JsonObject, unknown>>>;
363
+ sourceId: z.ZodString;
364
+ sourceKind: z.ZodLiteral<"module">;
365
+ }, z.core.$strict>>;
366
+ workspaceResourceRoot: z.ZodObject<{
367
+ contentHash: z.ZodOptional<z.ZodString>;
368
+ logicalPath: z.ZodString;
369
+ rootEntries: z.ZodReadonly<z.ZodArray<z.ZodString>>;
370
+ }, z.core.$strict>;
371
+ }, z.core.$strict>;
274
372
  declare const compiledAgentNodeManifestSchema: z.ZodObject<{
275
373
  agentRoot: z.ZodString;
276
374
  appRoot: z.ZodString;
277
375
  channels: z.ZodArray<z.ZodType<CompiledChannelEntry, unknown, z.core.$ZodTypeInternals<CompiledChannelEntry, unknown>>>;
278
- config: z.ZodType<CompiledAgentDefinition, unknown, z.core.$ZodTypeInternals<CompiledAgentDefinition, unknown>>;
279
376
  connections: z.ZodArray<z.ZodObject<{
280
377
  connectionName: z.ZodString;
281
378
  description: z.ZodString;
@@ -366,6 +463,7 @@ declare const compiledAgentNodeManifestSchema: z.ZodObject<{
366
463
  logicalPath: z.ZodString;
367
464
  rootEntries: z.ZodReadonly<z.ZodArray<z.ZodString>>;
368
465
  }, z.core.$strict>;
466
+ config: z.ZodType<CompiledAgentDefinition, unknown, z.core.$ZodTypeInternals<CompiledAgentDefinition, unknown>>;
369
467
  }, z.core.$strict>;
370
468
  /**
371
469
  * One mounted extension recorded on a compiled agent manifest. The runtime
@@ -487,21 +585,17 @@ export declare const compiledAgentManifestSchema: z.ZodObject<{
487
585
  sourceId: z.ZodString;
488
586
  sourceKind: z.ZodLiteral<"module">;
489
587
  }, z.core.$strict>>;
490
- version: z.ZodLiteral<39>;
588
+ version: z.ZodLiteral<40>;
491
589
  workspaceResourceRoot: z.ZodObject<{
492
590
  contentHash: z.ZodOptional<z.ZodString>;
493
591
  logicalPath: z.ZodString;
494
592
  rootEntries: z.ZodReadonly<z.ZodArray<z.ZodString>>;
495
593
  }, z.core.$strict>;
496
594
  }, z.core.$strict>;
497
- /**
498
- * Creates a compiled authored agent payload with stable defaults.
499
- */
500
- export declare function createCompiledAgentNodeManifest(input: {
595
+ export interface CreateCompiledAgentResourcesInput {
501
596
  readonly agentRoot: string;
502
597
  readonly appRoot: string;
503
598
  readonly channels?: readonly CompiledChannelEntry[];
504
- readonly config: CompiledAgentDefinition;
505
599
  readonly connections?: readonly CompiledConnectionDefinition[];
506
600
  readonly diagnosticsSummary?: DiscoverDiagnosticsSummary;
507
601
  readonly disabledFrameworkTools?: readonly string[];
@@ -520,6 +614,12 @@ export declare function createCompiledAgentNodeManifest(input: {
520
614
  readonly instructions?: CompiledInstructionsDefinition;
521
615
  readonly tools?: readonly CompiledToolDefinition[];
522
616
  readonly workspaceResourceRoot?: CompiledWorkspaceResourceRoot;
617
+ }
618
+ /** Creates compiled filesystem-owned resources with stable defaults. */
619
+ export declare function createCompiledAgentResources(input: CreateCompiledAgentResourcesInput): CompiledAgentResources;
620
+ /** Creates a compiled authored agent payload with stable defaults. */
621
+ export declare function createCompiledAgentNodeManifest(input: CreateCompiledAgentResourcesInput & {
622
+ readonly config: CompiledAgentDefinition;
523
623
  }): CompiledAgentNodeManifest;
524
624
  /**
525
625
  * Computes the sorted `rootEntries` advertised by the workspace resource
@@ -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=39,moduleSourceRefSchema=z.object({exportName:z.string().optional(),sourceKind:z.literal(`module`),logicalPath:z.string(),sourceId:z.string()}).strict(),compiledDynamicModelDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly(),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`)]),compiledChannelCorsSchema=z.object({origin:z.union([z.literal(`*`),z.literal(`null`),z.array(z.string())]).optional(),methods:z.union([z.literal(`*`),z.array(z.string())]).optional(),allowHeaders:z.union([z.literal(`*`),z.array(z.string())]).optional(),exposeHeaders:z.union([z.literal(`*`),z.array(z.string())]).optional(),credentials:z.boolean().optional(),maxAge:z.union([z.string(),z.literal(!1)]).optional(),preflight:z.object({statusCode:z.number().int().min(100).max(599).optional()}).strict().optional()}).strict(),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(),cors:compiledChannelCorsSchema.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(),sessionTokenLimitSchema=z.union([z.number().int().positive(),z.literal(!1)]),sessionTimeoutSchema=z.union([z.number().int().positive(),z.literal(!1)]),compiledAgentLimitsDefinitionSchema=z.object({maxInputTokensPerSession:sessionTokenLimitSchema.optional(),maxOutputTokensPerSession:sessionTokenLimitSchema.optional(),sessionTimeoutMs:sessionTimeoutSchema.optional()}).strict(),compiledWorkflowToolDefinitionSchema=z.object({maxSubagents:z.number().int().positive().optional()}).strict(),compiledAgentConfigSchema=z.object({build:compiledAgentBuildDefinitionSchema.optional(),compaction:compiledAgentCompactionDefinitionSchema.optional(),description:z.string().optional(),dynamicModel:compiledDynamicModelDefinitionSchema.optional(),experimental:z.object({subagentPersistentSessions:z.boolean().optional(),workflow:compiledAgentWorkflowDefinitionSchema.optional()}).strict().optional(),model:compiledRuntimeModelReferenceSchema,name:z.string(),outputSchema:jsonObjectSchema.optional(),reasoning:z.enum([`provider-default`,`none`,`minimal`,`low`,`medium`,`high`,`xhigh`]).optional(),source:moduleSourceRefSchema.optional(),limits:compiledAgentLimitsDefinitionSchema.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(),extensionNamespace: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(),extensionNamespace: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(),compiledExtensionMountSchema=z.object({namespace:z.string(),packageName:z.string(),packageNamespace:z.string(),sourceRoot:z.string(),mountSourceId:z.string(),mountLogicalPath:z.string()}).strict(),compiledSubagentNodeBaseFields={agent: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(),workflowTool:compiledWorkflowToolDefinitionSchema.optional(),webSearchProvider:z.enum([`exa`,`parallel`]).optional(),dynamicInstructions:z.array(compiledDynamicInstructionsDefinitionSchema).default([]),dynamicSkills:z.array(compiledDynamicSkillDefinitionSchema).default([]),dynamicTools:z.array(compiledDynamicToolDefinitionSchema).default([]),extensionMounts:z.array(compiledExtensionMountSchema).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(),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()},compiledDynamicSubagentDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly()}).strict(),compiledSubagentNodeSchema=z.union([z.object({...compiledSubagentNodeBaseFields,description:z.string()}).strict(),z.object({...compiledSubagentNodeBaseFields,dynamic:compiledDynamicSubagentDefinitionSchema}).strict()]),compiledSubagentEdgeSchema=z.object({childNodeId:z.string(),parentNodeId:z.string()}).strict(),compiledAgentManifestSchema=z.object({agentRoot:z.string(),appRoot:z.string(),extensionMounts:z.array(compiledExtensionMountSchema).default([]),channels:z.array(compiledChannelEntrySchema),config:compiledAgentConfigSchema,connections:z.array(compiledConnectionDefinitionSchema),diagnosticsSummary:discoverDiagnosticsSummarySchema,disabledFrameworkTools:z.array(z.string()).readonly(),workflowTool:compiledWorkflowToolDefinitionSchema.optional(),webSearchProvider:z.enum([`exa`,`parallel`]).optional(),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(39),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,dynamicModel:e.config.dynamicModel===void 0?void 0:{...e.config.dynamicModel},experimental:e.config.experimental===void 0?void 0:{subagentPersistentSessions:e.config.experimental.subagentPersistentSessions,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,reasoning:e.config.reasoning,limits:e.config.limits===void 0?void 0:{maxInputTokensPerSession:e.config.limits.maxInputTokensPerSession,maxOutputTokensPerSession:e.config.limits.maxOutputTokensPerSession,sessionTimeoutMs:e.config.limits.sessionTimeoutMs},source:e.config.source===void 0?void 0:{...e.config.source}},diagnosticsSummary:e.diagnosticsSummary??{errors:0,warnings:0},disabledFrameworkTools:[...e.disabledFrameworkTools??[]],workflowTool:e.workflowTool===void 0?void 0:{maxSubagents:e.workflowTool.maxSubagents},webSearchProvider:e.webSearchProvider,dynamicInstructions:[...e.dynamicInstructions??[]],dynamicSkills:[...e.dynamicSkills??[]],dynamicTools:[...e.dynamicTools??[]],extensionMounts:[...e.extensionMounts??[]],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;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,extensionMounts:[...e.extensionMounts??[]],subagentEdges:[...e.subagentEdges??[]],subagents:[...e.subagents??[]],version:39}}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=40,moduleSourceRefSchema=z.object({exportName:z.string().optional(),sourceKind:z.literal(`module`),logicalPath:z.string(),sourceId:z.string()}).strict(),compiledDynamicModelDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly(),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`)]),compiledChannelCorsSchema=z.object({origin:z.union([z.literal(`*`),z.literal(`null`),z.array(z.string())]).optional(),methods:z.union([z.literal(`*`),z.array(z.string())]).optional(),allowHeaders:z.union([z.literal(`*`),z.array(z.string())]).optional(),exposeHeaders:z.union([z.literal(`*`),z.array(z.string())]).optional(),credentials:z.boolean().optional(),maxAge:z.union([z.string(),z.literal(!1)]).optional(),preflight:z.object({statusCode:z.number().int().min(100).max(599).optional()}).strict().optional()}).strict(),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(),cors:compiledChannelCorsSchema.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(),maxOutputTokens:z.number().int().positive().optional(),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(),sessionTokenLimitSchema=z.union([z.number().int().positive(),z.literal(!1)]),sessionTimeoutSchema=z.union([z.number().int().positive(),z.literal(!1)]),compiledAgentLimitsDefinitionSchema=z.object({maxInputTokensPerSession:sessionTokenLimitSchema.optional(),maxOutputTokensPerSession:sessionTokenLimitSchema.optional(),sessionTimeoutMs:sessionTimeoutSchema.optional()}).strict(),compiledWorkflowToolDefinitionSchema=z.object({maxSubagents:z.number().int().positive().optional()}).strict(),compiledAgentConfigBaseFields={build:compiledAgentBuildDefinitionSchema.optional(),compaction:compiledAgentCompactionDefinitionSchema.optional(),description:z.string().optional(),experimental:z.object({subagentPersistentSessions:z.boolean().optional(),workflow:compiledAgentWorkflowDefinitionSchema.optional()}).strict().optional(),name:z.string(),outputSchema:jsonObjectSchema.optional(),reasoning:z.enum([`provider-default`,`none`,`minimal`,`low`,`medium`,`high`,`xhigh`]).optional(),source:moduleSourceRefSchema.optional(),limits:compiledAgentLimitsDefinitionSchema.optional()},compiledAgentConfigSchema=z.union([z.object({...compiledAgentConfigBaseFields,model:compiledRuntimeModelReferenceSchema}).strict(),z.object({...compiledAgentConfigBaseFields,dynamicModel:compiledDynamicModelDefinitionSchema}).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(),extensionNamespace: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(),extensionNamespace: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(),compiledExtensionMountSchema=z.object({namespace:z.string(),packageName:z.string(),packageNamespace:z.string(),sourceRoot:z.string(),mountSourceId:z.string(),mountLogicalPath:z.string()}).strict(),compiledAgentResourceFields={agentRoot:z.string(),appRoot:z.string(),channels:z.array(compiledChannelEntrySchema),connections:z.array(compiledConnectionDefinitionSchema),diagnosticsSummary:discoverDiagnosticsSummarySchema,disabledFrameworkTools:z.array(z.string()).readonly(),workflowTool:compiledWorkflowToolDefinitionSchema.optional(),webSearchProvider:z.enum([`exa`,`parallel`]).optional(),dynamicInstructions:z.array(compiledDynamicInstructionsDefinitionSchema).default([]),dynamicSkills:z.array(compiledDynamicSkillDefinitionSchema).default([]),dynamicTools:z.array(compiledDynamicToolDefinitionSchema).default([]),extensionMounts:z.array(compiledExtensionMountSchema).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},compiledAgentResourcesSchema=z.object(compiledAgentResourceFields).strict(),compiledAgentNodeManifestSchema=z.object({...compiledAgentResourceFields,config:compiledAgentConfigSchema}).strict(),compiledSubagentNodeBaseFields={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()},compiledDynamicSubagentDefinitionSchema=z.object({build:compiledAgentBuildDefinitionSchema.optional(),eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),logicalPath:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledSubagentNodeSchema=z.union([z.object({...compiledSubagentNodeBaseFields,agent:compiledAgentNodeManifestSchema,description:z.string()}).strict(),z.object({...compiledSubagentNodeBaseFields,agent:compiledAgentResourcesSchema,configResolver:compiledDynamicSubagentDefinitionSchema}).strict()]),compiledSubagentEdgeSchema=z.object({childNodeId:z.string(),parentNodeId:z.string()}).strict(),compiledAgentManifestSchema=z.object({agentRoot:z.string(),appRoot:z.string(),extensionMounts:z.array(compiledExtensionMountSchema).default([]),channels:z.array(compiledChannelEntrySchema),config:compiledAgentConfigSchema,connections:z.array(compiledConnectionDefinitionSchema),diagnosticsSummary:discoverDiagnosticsSummarySchema,disabledFrameworkTools:z.array(z.string()).readonly(),workflowTool:compiledWorkflowToolDefinitionSchema.optional(),webSearchProvider:z.enum([`exa`,`parallel`]).optional(),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(40),workspaceResourceRoot:compiledWorkspaceResourceRootSchema}).strict();function createCompiledAgentResources(e){let t={agentRoot:e.agentRoot,appRoot:e.appRoot,channels:[...e.channels??[]],connections:[...e.connections??[]],diagnosticsSummary:e.diagnosticsSummary??{errors:0,warnings:0},disabledFrameworkTools:[...e.disabledFrameworkTools??[]],workflowTool:e.workflowTool===void 0?void 0:{maxSubagents:e.workflowTool.maxSubagents},webSearchProvider:e.webSearchProvider,dynamicInstructions:[...e.dynamicInstructions??[]],dynamicSkills:[...e.dynamicSkills??[]],dynamicTools:[...e.dynamicTools??[]],extensionMounts:[...e.extensionMounts??[]],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 createCompiledAgentNodeManifest(e){return{...createCompiledAgentResources(e),config:cloneCompiledAgentDefinition(e.config)}}function cloneCompiledAgentDefinition(e){let t={build:e.build===void 0?void 0:{externalDependencies:e.build.externalDependencies===void 0?void 0:[...e.build.externalDependencies]},compaction:{model:e.compaction?.model===void 0?void 0:cloneCompiledRuntimeModelReference(e.compaction.model),thresholdPercent:e.compaction?.thresholdPercent},description:e.description,experimental:e.experimental===void 0?void 0:{subagentPersistentSessions:e.experimental.subagentPersistentSessions,workflow:e.experimental.workflow===void 0?void 0:{world:e.experimental.workflow.world}},name:e.name,outputSchema:e.outputSchema,reasoning:e.reasoning,limits:e.limits===void 0?void 0:{maxInputTokensPerSession:e.limits.maxInputTokensPerSession,maxOutputTokensPerSession:e.limits.maxOutputTokensPerSession,sessionTimeoutMs:e.limits.sessionTimeoutMs},source:e.source===void 0?void 0:{...e.source}};return e.dynamicModel===void 0?{...t,model:cloneCompiledRuntimeModelReference(e.model)}:{...t,dynamicModel:{...e.dynamicModel}}}function deriveResourceRootEntries(e){let t=new Set;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,extensionMounts:[...e.extensionMounts??[]],subagentEdges:[...e.subagentEdges??[]],subagents:[...e.subagents??[]],version:40}}function cloneCompiledRuntimeModelReference(e){let t={id:e.id,routing:cloneModelRouting(e.routing)};return e.contextWindowTokens!==void 0&&(t.contextWindowTokens=e.contextWindowTokens),e.maxOutputTokens!==void 0&&(t.maxOutputTokens=e.maxOutputTokens),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,createCompiledAgentResources,createCompiledSubagentNodeId,deriveResourceRootEntries};
@@ -1,33 +1,6 @@
1
1
  import { z } from "#compiled/zod/index.js";
2
- export declare const catalogModelProviderSchema: z.ZodObject<{
3
- provider: z.ZodString;
4
- providerModelId: z.ZodString;
5
- contextWindowTokens: z.ZodOptional<z.ZodNumber>;
6
- maxOutputTokens: z.ZodOptional<z.ZodNumber>;
7
- }, z.core.$loose>;
8
- export declare const catalogModelSchema: z.ZodObject<{
9
- slug: z.ZodString;
10
- providers: z.ZodArray<z.ZodObject<{
11
- provider: z.ZodString;
12
- providerModelId: z.ZodString;
13
- contextWindowTokens: z.ZodOptional<z.ZodNumber>;
14
- maxOutputTokens: z.ZodOptional<z.ZodNumber>;
15
- }, z.core.$loose>>;
16
- }, z.core.$loose>;
17
- export declare const modelCatalogResponseSchema: z.ZodObject<{
18
- models: z.ZodArray<z.ZodObject<{
19
- slug: z.ZodString;
20
- providers: z.ZodArray<z.ZodObject<{
21
- provider: z.ZodString;
22
- providerModelId: z.ZodString;
23
- contextWindowTokens: z.ZodOptional<z.ZodNumber>;
24
- maxOutputTokens: z.ZodOptional<z.ZodNumber>;
25
- }, z.core.$loose>>;
26
- }, z.core.$loose>>;
27
- providerAliases: z.ZodRecord<z.ZodString, z.ZodString>;
28
- }, z.core.$loose>;
29
- export type CatalogModelProvider = z.infer<typeof catalogModelProviderSchema>;
30
- export type CatalogModel = z.infer<typeof catalogModelSchema>;
2
+ export { catalogModelProviderSchema, catalogModelSchema, modelCatalogResponseSchema, } from "#internal/model-catalog.js";
3
+ export type { CatalogModelProvider, CatalogModel } from "#internal/model-catalog.js";
31
4
  /**
32
5
  * Stable runtime model limits that eve can embed in compiled artifacts without
33
6
  * resolving provider metadata at runtime.
@@ -57,4 +30,3 @@ export declare function resolveCompiledRuntimeModelCatalogCachePath(appRoot: str
57
30
  * memory and on disk.
58
31
  */
59
32
  export declare function createCompiledRuntimeModelCatalogLoader(appRoot: string): CompiledRuntimeModelCatalogLoader;
60
- export {};
@@ -1 +1 @@
1
- import{mkdir,readFile,writeFile}from"node:fs/promises";import{z}from"#compiled/zod/index.js";import{join}from"node:path";import{AI_GATEWAY_MODELS_CATALOG_URL,vercelGatewayFetch}from"#internal/gateway.js";const COMPILED_RUNTIME_MODEL_CATALOG_CACHE_KIND=`eve-model-catalog-cache`,catalogModelProviderSchema=z.object({provider:z.string().min(1),providerModelId:z.string().min(1),contextWindowTokens:z.number().int().nonnegative().optional(),maxOutputTokens:z.number().int().nonnegative().optional()}).passthrough(),catalogModelSchema=z.object({slug:z.string().min(1),providers:z.array(catalogModelProviderSchema).min(1)}).passthrough(),modelCatalogResponseSchema=z.object({models:z.array(catalogModelSchema),providerAliases:z.record(z.string(),z.string())}).passthrough();z.object({contextWindowTokens:z.number().int().positive(),maxOutputTokens:z.number().int().positive().optional()}).strict();const compiledRuntimeModelCatalogCacheSchema=z.object({fetchedAt:z.string(),kind:z.literal(COMPILED_RUNTIME_MODEL_CATALOG_CACHE_KIND),models:z.array(catalogModelSchema),providerAliases:z.record(z.string(),z.string()),version:z.literal(2)}).strict(),builtInCompiledRuntimeModelLimitsById=new Map([[`anthropic/claude-opus-4.7`,{contextWindowTokens:2e5,maxOutputTokens:32e3}],[`openai/gpt-5.4`,{contextWindowTokens:4e5,maxOutputTokens:128e3}],[`openai/gpt-5.4-mini`,{contextWindowTokens:4e5,maxOutputTokens:128e3}]]);function resolveCompiledRuntimeModelCatalogCachePath(e){return join(e,`.eve`,`cache`,`model-catalog.json`)}function createCompiledRuntimeModelCatalogLoader(e){let t=null,n=null,r=null,getCachedCatalog=async()=>(t??=readModelCatalogCache(e),await t),getFetchedCatalog=async()=>{if(n!==null)throw n;if(r!==null)return await r;r=fetchAndPersistModelCatalog(e).then(e=>(t=Promise.resolve(e),e));try{return await r}catch(e){throw n=e,e}},resolveModelsFromCacheOrFetch=async()=>{let e=await getCachedCatalog();if(e!==null&&isCacheFresh(e))return e;try{return await getFetchedCatalog()}catch{return e===null?null:e}};return{async getModelLimits(e){let t=normalizeModelId(e),n=await resolveModelsFromCacheOrFetch();if(n!==null){let e=findBySlug(n.models,t);if(e)for(let t of e.providers){let e=limitsFromProvider(t);if(e!==null)return e}}return builtInCompiledRuntimeModelLimitsById.get(t)??null},async getByProviderModelId(e,t){let n=await resolveModelsFromCacheOrFetch();if(n===null)return null;let r=e.split(`.`)[0],i=n.providerAliases[r]??r,a=normalizeModelId(t);for(let e of n.models)for(let t of e.providers)if(t.provider===i&&normalizeModelId(t.providerModelId)===a){let n=limitsFromProvider(t);if(n!==null)return{slug:e.slug,limits:n}}return null}}}async function fetchAndPersistModelCatalog(t){let r=await vercelGatewayFetch(AI_GATEWAY_MODELS_CATALOG_URL);if(!r.ok)throw Error(`AI Gateway model catalog request failed with HTTP ${r.status} ${r.statusText}.`);let o=modelCatalogResponseSchema.safeParse(await r.json());if(!o.success)throw Error(`AI Gateway model catalog response did not match the expected schema.`);let s={fetchedAt:new Date().toISOString(),kind:COMPILED_RUNTIME_MODEL_CATALOG_CACHE_KIND,models:o.data.models,providerAliases:o.data.providerAliases,version:2};try{let r=resolveCompiledRuntimeModelCatalogCachePath(t);await mkdir(join(t,`.eve`,`cache`),{recursive:!0}),await writeFile(r,`${JSON.stringify(s,null,2)}\n`,`utf8`)}catch{}return s}async function readModelCatalogCache(e){try{let n=await readFile(resolveCompiledRuntimeModelCatalogCachePath(e),`utf8`),r=compiledRuntimeModelCatalogCacheSchema.safeParse(JSON.parse(n));return r.success?r.data:null}catch(e){return e instanceof Error&&`code`in e&&typeof e.code==`string`&&e.code,null}}function findBySlug(e,t){return e.find(e=>e.slug===t)}function limitsFromProvider(e){return e.contextWindowTokens===void 0||e.contextWindowTokens<=0?null:{contextWindowTokens:e.contextWindowTokens,...e.maxOutputTokens!==void 0&&e.maxOutputTokens>0&&{maxOutputTokens:e.maxOutputTokens}}}function isCacheFresh(e){let t=Date.parse(e.fetchedAt);return Number.isFinite(t)?Date.now()-t<=864e5:!1}function normalizeModelId(e){return e.endsWith(`-thinking`)?e.slice(0,-9):e}export{catalogModelProviderSchema,catalogModelSchema,createCompiledRuntimeModelCatalogLoader,modelCatalogResponseSchema,resolveCompiledRuntimeModelCatalogCachePath};
1
+ import{mkdir,readFile,writeFile}from"node:fs/promises";import{z}from"#compiled/zod/index.js";import{join}from"node:path";import{AI_GATEWAY_MODELS_CATALOG_URL,vercelGatewayFetch}from"#internal/gateway.js";import{catalogModelProviderSchema,catalogModelSchema,catalogModelSchema as catalogModelSchema$1,findCatalogModelByProviderModelId,findCatalogModelBySlug,modelCatalogLimitsFromProvider,modelCatalogResponseSchema,modelCatalogResponseSchema as modelCatalogResponseSchema$1,normalizeCatalogModelId}from"#internal/model-catalog.js";const COMPILED_RUNTIME_MODEL_CATALOG_CACHE_KIND=`eve-model-catalog-cache`;z.object({contextWindowTokens:z.number().int().positive(),maxOutputTokens:z.number().int().positive().optional()}).strict();const compiledRuntimeModelCatalogCacheSchema=z.object({fetchedAt:z.string(),kind:z.literal(COMPILED_RUNTIME_MODEL_CATALOG_CACHE_KIND),models:z.array(catalogModelSchema$1),providerAliases:z.record(z.string(),z.string()),version:z.literal(2)}).strict(),builtInCompiledRuntimeModelLimitsById=new Map([[`anthropic/claude-opus-4.7`,{contextWindowTokens:2e5,maxOutputTokens:32e3}],[`openai/gpt-5.4`,{contextWindowTokens:4e5,maxOutputTokens:128e3}],[`openai/gpt-5.4-mini`,{contextWindowTokens:4e5,maxOutputTokens:128e3}]]);function resolveCompiledRuntimeModelCatalogCachePath(e){return join(e,`.eve`,`cache`,`model-catalog.json`)}function createCompiledRuntimeModelCatalogLoader(e){let t=null,n=null,r=null,getCachedCatalog=async()=>(t??=readModelCatalogCache(e),await t),getFetchedCatalog=async()=>{if(n!==null)throw n;if(r!==null)return await r;r=fetchAndPersistModelCatalog(e).then(e=>(t=Promise.resolve(e),e));try{return await r}catch(e){throw n=e,e}},resolveModelsFromCacheOrFetch=async()=>{let e=await getCachedCatalog();if(e!==null&&isCacheFresh(e))return e;try{return await getFetchedCatalog()}catch{return e===null?null:e}};return{async getModelLimits(e){let t=normalizeCatalogModelId(e),n=await resolveModelsFromCacheOrFetch();if(n!==null){let e=findCatalogModelBySlug(n.models,t);if(e)for(let t of e.providers){let e=modelCatalogLimitsFromProvider(t);if(e!==null)return e}}return builtInCompiledRuntimeModelLimitsById.get(t)??null},async getByProviderModelId(e,t){let n=await resolveModelsFromCacheOrFetch();if(n===null)return null;let r=findCatalogModelByProviderModelId({models:n.models,provider:e,providerAliases:n.providerAliases,providerModelId:t});if(r!==null){let e=modelCatalogLimitsFromProvider(r.provider);if(e!==null)return{slug:r.model.slug,limits:e}}return null}}}async function fetchAndPersistModelCatalog(t){let r=await vercelGatewayFetch(AI_GATEWAY_MODELS_CATALOG_URL);if(!r.ok)throw Error(`AI Gateway model catalog request failed with HTTP ${r.status} ${r.statusText}.`);let i=modelCatalogResponseSchema$1.safeParse(await r.json());if(!i.success)throw Error(`AI Gateway model catalog response did not match the expected schema.`);let a={fetchedAt:new Date().toISOString(),kind:COMPILED_RUNTIME_MODEL_CATALOG_CACHE_KIND,models:i.data.models,providerAliases:i.data.providerAliases,version:2};try{let r=resolveCompiledRuntimeModelCatalogCachePath(t);await mkdir(join(t,`.eve`,`cache`),{recursive:!0}),await writeFile(r,`${JSON.stringify(a,null,2)}\n`,`utf8`)}catch{}return a}async function readModelCatalogCache(e){try{let n=await readFile(resolveCompiledRuntimeModelCatalogCachePath(e),`utf8`),r=compiledRuntimeModelCatalogCacheSchema.safeParse(JSON.parse(n));return r.success?r.data:null}catch(e){return e instanceof Error&&`code`in e&&typeof e.code==`string`&&e.code,null}}function isCacheFresh(e){let t=Date.parse(e.fetchedAt);return Number.isFinite(t)?Date.now()-t<=864e5:!1}export{catalogModelProviderSchema,catalogModelSchema,createCompiledRuntimeModelCatalogLoader,modelCatalogResponseSchema,resolveCompiledRuntimeModelCatalogCachePath};
@@ -1,6 +1,6 @@
1
1
  import { z } from "#compiled/zod/index.js";
2
2
  import type { ModuleSourceRef } from "#shared/source-ref.js";
3
- import type { CompiledAgentManifest, CompiledAgentNodeManifest } from "#compiler/manifest.js";
3
+ import type { CompiledAgentManifest, CompiledAgentNodeManifest, CompiledAgentResources } from "#compiler/manifest.js";
4
4
  /**
5
5
  * Compiled module ownership for one runtime graph node.
6
6
  */
@@ -44,5 +44,5 @@ export declare function createCompiledModuleMapSource(input: CreateCompiledModul
44
44
  * module-map artifact) and the runtime loader (to hydrate a module map
45
45
  * from the manifest when the pre-built artifact is unavailable).
46
46
  */
47
- export declare function collectModuleRefsForManifest(manifest: CompiledAgentNodeManifest): ModuleSourceRef[];
47
+ export declare function collectModuleRefsForManifest(manifest: CompiledAgentNodeManifest | CompiledAgentResources): ModuleSourceRef[];
48
48
  export {};
@@ -1,5 +1,5 @@
1
- import{z}from"#compiled/zod/index.js";import{ROOT_COMPILED_AGENT_NODE_ID}from"#compiler/manifest.js";import{normalizeEsmImportSpecifier}from"#internal/application/import-specifier.js";const compiledModuleNodeScopeSchema=z.object({modules:z.record(z.string(),z.object({}).passthrough())}).strict(),compiledModuleMapSchema=z.object({nodes:z.record(z.string(),compiledModuleNodeScopeSchema)}).strict();function createCompiledModuleMapSource(e){let n=dirnameFilesystemPath(e.moduleMapPath),r=e.importSpecifierStyle??`relative`,i=0,a=[collectModuleNodeScope({agentRoot:e.manifest.agentRoot,importSpecifierStyle:r,manifest:e.manifest,moduleMapDirectory:n,nextBindingName(){return`module_${i++}`},nodeId:ROOT_COMPILED_AGENT_NODE_ID}),...[...e.manifest.subagents].sort((e,t)=>e.nodeId.localeCompare(t.nodeId)).map(e=>collectModuleNodeScope({agentRoot:e.agent.agentRoot,importSpecifierStyle:r,manifest:e.agent,moduleMapDirectory:n,nextBindingName(){return`module_${i++}`},nodeId:e.nodeId}))],o=a.flatMap(e=>e.modules).map(e=>`import * as ${e.bindingName} from ${JSON.stringify(e.importSpecifier)};`);return[`// Generated by eve. Do not edit by hand.`,``,...o,...o.length>0?[``]:[],`export const moduleMap = ${renderModuleMap(a)};`,``,`export default moduleMap;`,``].join(`
2
- `)}function collectModuleNodeScope(e){return{modules:collectModuleRefsForManifest(e.manifest).sort((e,t)=>e.sourceId.localeCompare(t.sourceId)).map(t=>({bindingName:e.nextBindingName(),importSpecifier:createImportSpecifier({fromDirectory:e.moduleMapDirectory,importSpecifierStyle:e.importSpecifierStyle,targetPath:joinFilesystemPath(e.agentRoot,t.logicalPath)}),sourceId:t.sourceId})),nodeId:e.nodeId}}function collectModuleRefsForManifest(e){let t=new Map;e.config.source!==void 0&&t.set(e.config.source.sourceId,e.config.source),e.config.model.source!==void 0&&t.set(e.config.model.source.sourceId,e.config.model.source);for(let n of e.channels)n.kind!==`disabled`&&t.set(n.sourceId,{exportName:n.exportName,sourceKind:`module`,logicalPath:n.logicalPath,sourceId:n.sourceId});for(let n of e.connections)t.set(n.sourceId,{exportName:n.exportName,sourceKind:`module`,logicalPath:n.logicalPath,sourceId:n.sourceId});for(let n of e.tools)t.set(n.sourceId,{exportName:n.exportName,sourceKind:`module`,logicalPath:n.logicalPath,sourceId:n.sourceId});for(let n of e.dynamicInstructions)t.set(n.sourceId,{exportName:n.exportName,sourceKind:`module`,logicalPath:n.logicalPath,sourceId:n.sourceId});for(let n of e.dynamicSkills)t.set(n.sourceId,{exportName:n.exportName,sourceKind:`module`,logicalPath:n.logicalPath,sourceId:n.sourceId});for(let n of e.dynamicTools)t.set(n.sourceId,{exportName:n.exportName,sourceKind:`module`,logicalPath:n.logicalPath,sourceId:n.sourceId});for(let n of e.remoteAgents)t.set(n.sourceId,{exportName:n.exportName,sourceKind:`module`,logicalPath:n.logicalPath,sourceId:n.sourceId});for(let n of e.hooks)t.set(n.sourceId,{exportName:n.exportName,sourceKind:`module`,logicalPath:n.logicalPath,sourceId:n.sourceId});for(let n of e.schedules)n.sourceKind!==`module`||!n.hasRun||t.set(n.sourceId,{sourceKind:`module`,logicalPath:n.logicalPath,sourceId:n.sourceId});e.sandbox!==null&&t.set(e.sandbox.sourceId,{exportName:e.sandbox.exportName,sourceKind:`module`,logicalPath:e.sandbox.logicalPath,sourceId:e.sandbox.sourceId});let n=e.extensionMounts;if(n!==void 0)for(let e of n)t.set(e.mountSourceId,{sourceKind:`module`,logicalPath:e.mountLogicalPath,sourceId:e.mountSourceId});return[...t.values()]}function createImportSpecifier(e){if(e.importSpecifierStyle===`absolute`)return normalizeEsmImportSpecifier(normalizeFilesystemPath(e.targetPath));let t=relativeFilesystemPath(e.fromDirectory,e.targetPath);return t.startsWith(`.`)?t:`./${t}`}function renderModuleMap(e){return renderFrozenObject([{key:`nodes`,value:renderFrozenObject(e.map(e=>({key:e.nodeId,value:renderFrozenObject([{key:`modules`,value:renderFrozenObject(e.modules.map(e=>({key:e.sourceId,value:e.bindingName})))}],3)})))}],0)}function renderFrozenObject(e,t=1){if(e.length===0)return`Object.freeze({})`;let n=` `.repeat(t),r=` `.repeat(t+1);return[`Object.freeze({`,e.map(e=>`${r}${JSON.stringify(e.key)}: ${e.value.replaceAll(`
1
+ import{z}from"#compiled/zod/index.js";import{ROOT_COMPILED_AGENT_NODE_ID}from"#compiler/manifest.js";import{normalizeEsmImportSpecifier}from"#internal/application/import-specifier.js";const compiledModuleNodeScopeSchema=z.object({modules:z.record(z.string(),z.object({}).passthrough())}).strict(),compiledModuleMapSchema=z.object({nodes:z.record(z.string(),compiledModuleNodeScopeSchema)}).strict();function createCompiledModuleMapSource(e){let n=dirnameFilesystemPath(e.moduleMapPath),r=e.importSpecifierStyle??`relative`,i=0,a=[collectModuleNodeScope({agentRoot:e.manifest.agentRoot,importSpecifierStyle:r,manifest:e.manifest,moduleMapDirectory:n,nextBindingName(){return`module_${i++}`},nodeId:ROOT_COMPILED_AGENT_NODE_ID}),...[...e.manifest.subagents].sort((e,t)=>e.nodeId.localeCompare(t.nodeId)).map(e=>collectModuleNodeScope({agentRoot:e.agent.agentRoot,importSpecifierStyle:r,manifest:e.agent,additionalModuleRef:e.configResolver,moduleMapDirectory:n,nextBindingName(){return`module_${i++}`},nodeId:e.nodeId}))],o=a.flatMap(e=>e.modules).map(e=>`import * as ${e.bindingName} from ${JSON.stringify(e.importSpecifier)};`);return[`// Generated by eve. Do not edit by hand.`,``,...o,...o.length>0?[``]:[],`export const moduleMap = ${renderModuleMap(a)};`,``,`export default moduleMap;`,``].join(`
2
+ `)}function collectModuleNodeScope(e){return{modules:[...collectModuleRefsForManifest(e.manifest),...e.additionalModuleRef===void 0?[]:[e.additionalModuleRef]].sort((e,t)=>e.sourceId.localeCompare(t.sourceId)).map(t=>({bindingName:e.nextBindingName(),importSpecifier:createImportSpecifier({fromDirectory:e.moduleMapDirectory,importSpecifierStyle:e.importSpecifierStyle,targetPath:joinFilesystemPath(e.agentRoot,t.logicalPath)}),sourceId:t.sourceId})),nodeId:e.nodeId}}function collectModuleRefsForManifest(e){let t=new Map;`config`in e&&e.config.source!==void 0&&t.set(e.config.source.sourceId,e.config.source),`config`in e&&e.config.model?.source!==void 0&&t.set(e.config.model.source.sourceId,e.config.model.source);for(let n of e.channels)n.kind!==`disabled`&&t.set(n.sourceId,{exportName:n.exportName,sourceKind:`module`,logicalPath:n.logicalPath,sourceId:n.sourceId});for(let n of e.connections)t.set(n.sourceId,{exportName:n.exportName,sourceKind:`module`,logicalPath:n.logicalPath,sourceId:n.sourceId});for(let n of e.tools)t.set(n.sourceId,{exportName:n.exportName,sourceKind:`module`,logicalPath:n.logicalPath,sourceId:n.sourceId});for(let n of e.dynamicInstructions)t.set(n.sourceId,{exportName:n.exportName,sourceKind:`module`,logicalPath:n.logicalPath,sourceId:n.sourceId});for(let n of e.dynamicSkills)t.set(n.sourceId,{exportName:n.exportName,sourceKind:`module`,logicalPath:n.logicalPath,sourceId:n.sourceId});for(let n of e.dynamicTools)t.set(n.sourceId,{exportName:n.exportName,sourceKind:`module`,logicalPath:n.logicalPath,sourceId:n.sourceId});for(let n of e.remoteAgents)t.set(n.sourceId,{exportName:n.exportName,sourceKind:`module`,logicalPath:n.logicalPath,sourceId:n.sourceId});for(let n of e.hooks)t.set(n.sourceId,{exportName:n.exportName,sourceKind:`module`,logicalPath:n.logicalPath,sourceId:n.sourceId});for(let n of e.schedules)n.sourceKind!==`module`||!n.hasRun||t.set(n.sourceId,{sourceKind:`module`,logicalPath:n.logicalPath,sourceId:n.sourceId});e.sandbox!==null&&t.set(e.sandbox.sourceId,{exportName:e.sandbox.exportName,sourceKind:`module`,logicalPath:e.sandbox.logicalPath,sourceId:e.sandbox.sourceId});let n=e.extensionMounts;if(n!==void 0)for(let e of n)t.set(e.mountSourceId,{sourceKind:`module`,logicalPath:e.mountLogicalPath,sourceId:e.mountSourceId});return[...t.values()]}function createImportSpecifier(e){if(e.importSpecifierStyle===`absolute`)return normalizeEsmImportSpecifier(normalizeFilesystemPath(e.targetPath));let t=relativeFilesystemPath(e.fromDirectory,e.targetPath);return t.startsWith(`.`)?t:`./${t}`}function renderModuleMap(e){return renderFrozenObject([{key:`nodes`,value:renderFrozenObject(e.map(e=>({key:e.nodeId,value:renderFrozenObject([{key:`modules`,value:renderFrozenObject(e.modules.map(e=>({key:e.sourceId,value:e.bindingName})))}],3)})))}],0)}function renderFrozenObject(e,t=1){if(e.length===0)return`Object.freeze({})`;let n=` `.repeat(t),r=` `.repeat(t+1);return[`Object.freeze({`,e.map(e=>`${r}${JSON.stringify(e.key)}: ${e.value.replaceAll(`
3
3
  `,`\n${r}`)}`).join(`,
4
4
  `),`${n}})`].join(`
5
5
  `)}function dirnameFilesystemPath(e){let t=splitFilesystemPath(e);return t.segments.length===0?t.root.length===0?`.`:t.root:createFilesystemPath(t.root,t.segments.slice(0,-1))}function joinFilesystemPath(e,t){let n=splitFilesystemPath(e),r=splitFilesystemPath(t);return r.root.length>0?createFilesystemPath(r.root,r.segments):createFilesystemPath(n.root,[...n.segments,...r.segments])}function relativeFilesystemPath(e,t){let n=splitFilesystemPath(e),r=splitFilesystemPath(t);if(n.root!==r.root)return normalizeFilesystemPath(t);let i=0;for(;i<n.segments.length&&i<r.segments.length&&n.segments[i]===r.segments[i];)i+=1;let a=[...Array.from({length:n.segments.length-i},()=>`..`),...r.segments.slice(i)];return a.length===0?`.`:a.join(`/`)}function normalizeFilesystemPath(e){let t=splitFilesystemPath(e);return createFilesystemPath(t.root,t.segments)}function splitFilesystemPath(e){let t=e.replaceAll(`\\`,`/`),n=``,r=t,i=t.match(/^[A-Za-z]:/);i===null?t.startsWith(`/`)&&(n=`/`,r=t.slice(1)):(n=i[0],r=t.slice(n.length),r.startsWith(`/`)&&(n=`${n}/`,r=r.slice(1)));let a=[];for(let e of r.split(`/`))if(!(e.length===0||e===`.`)){if(e===`..`){if(a.length>0&&a[a.length-1]!==`..`){a.pop();continue}n.length===0&&a.push(e);continue}a.push(e)}return{root:n,segments:a}}function createFilesystemPath(e,t){return e===`/`?t.length===0?`/`:`/${t.join(`/`)}`:e.endsWith(`/`)?t.length===0?e:`${e}${t.join(`/`)}`:e.length>0?t.length===0?e:`${e}/${t.join(`/`)}`:t.length===0?`.`:t.join(`/`)}export{collectModuleRefsForManifest,compiledModuleMapSchema,createCompiledModuleMapSource};
@@ -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{serializeOutputSchema}from"#shared/tool-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{isDynamicModelDefinition}from"#shared/agent-definition.js";import{loadModuleBackedDefinition}from"#compiler/normalize-helpers.js";async function compileAgentConfig(e,t,n={}){let r=e.configModule,a=r===void 0?void 0:formatAgentConfigModulePath(e,r),o=normalizeAgentDefinition(Object.hasOwn(n,`definition`)?n.definition:r===void 0?{model:DEFAULT_AGENT_MODEL_ID}:await loadModuleBackedDefinition({agentRoot:e.agentRoot,displayPath:a,kind:`agent config`,source:r}),r===void 0?`Expected the default agent config to match the public eve shape.`:`Expected the agent config export "${r.exportName??`default`}" from "${a}" to match the public eve shape.`),s=isDynamicModelDefinition(o.model)?o.model.fallback:o.model,c=await normalizeAuthoredModelReference({modelCatalog:t.modelCatalog,purpose:`the primary compaction trigger model`,contextWindowTokens:o.modelContextWindowTokens,providerOptions:o.modelOptions?.providerOptions,source:r,sourcePath:a,value:s}),l={},u={compaction:l,model:c,name:e.agentId};if(o.description!==void 0&&(u.description=o.description),isDynamicModelDefinition(o.model)){if(r===void 0)throw Error(`Expected dynamic model definitions to be authored in agent.ts.`);u.dynamicModel={eventNames:Object.keys(o.model.events),exportName:r.exportName,sourceKind:`module`,logicalPath:r.logicalPath,sourceId:r.sourceId}}let d=normalizeExperimentalDefinition(o.experimental);return d!==void 0&&(u.experimental=d),o.build!==void 0&&(u.build={externalDependencies:o.build.externalDependencies===void 0?void 0:[...o.build.externalDependencies]}),o.outputSchema!==void 0&&(u.outputSchema=serializeOutputSchema(o.outputSchema)),o.reasoning!==void 0&&(u.reasoning=o.reasoning),o.limits!==void 0&&(u.limits={maxInputTokensPerSession:o.limits.maxInputTokensPerSession,maxOutputTokensPerSession:o.limits.maxOutputTokensPerSession,sessionTimeoutMs:o.limits.sessionTimeoutMs}),r!==void 0&&(u.source={exportName:r.exportName,sourceKind:`module`,logicalPath:r.logicalPath,sourceId:r.sourceId}),o.compaction?.model!==void 0&&(l.model=await normalizeAuthoredModelReference({modelCatalog:t.modelCatalog,purpose:`the compaction summary model`,contextWindowTokens:o.compaction.modelContextWindowTokens,providerOptions:o.modelOptions?.providerOptions,source:r,sourcePath:a,value:o.compaction.model})),o.compaction?.thresholdPercent!==void 0&&(l.thresholdPercent=o.compaction.thresholdPercent),u}function normalizeExperimentalDefinition(e){if(e===void 0)return;let t={};return e.subagentPersistentSessions!==void 0&&(t.subagentPersistentSessions=e.subagentPersistentSessions),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
+ 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{serializeOutputSchema}from"#shared/tool-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{isDynamicModelDefinition}from"#shared/agent-definition.js";import{loadModuleBackedDefinition}from"#compiler/normalize-helpers.js";async function compileAgentConfig(e,t,n={}){let r=e.configModule,a=r===void 0?void 0:formatAgentConfigModulePath(e,r),o=normalizeAgentDefinition(Object.hasOwn(n,`definition`)?n.definition:r===void 0?{model:DEFAULT_AGENT_MODEL_ID}:await loadModuleBackedDefinition({agentRoot:e.agentRoot,displayPath:a,kind:`agent config`,source:r}),r===void 0?`Expected the default agent config to match the public eve shape.`:`Expected the agent config export "${r.exportName??`default`}" from "${a}" to match the public eve shape.`),s=isDynamicModelDefinition(o.model)?o.model:void 0,c=s===void 0?await normalizeAuthoredModelReference({modelCatalog:t.modelCatalog,purpose:`the primary compaction trigger model`,contextWindowTokens:o.modelContextWindowTokens,providerOptions:o.modelOptions?.providerOptions,source:r,sourcePath:a,value:o.model}):void 0,l={},u={compaction:l,name:e.agentId};o.description!==void 0&&(u.description=o.description);let d;if(s!==void 0){if(r===void 0)throw Error(`Expected dynamic model definitions to be authored in agent.ts.`);d={eventNames:Object.keys(s.events),exportName:r.exportName,sourceKind:`module`,logicalPath:r.logicalPath,sourceId:r.sourceId}}let f=normalizeExperimentalDefinition(o.experimental);if(f!==void 0&&(u.experimental=f),o.build!==void 0&&(u.build={externalDependencies:o.build.externalDependencies===void 0?void 0:[...o.build.externalDependencies]}),o.outputSchema!==void 0&&(u.outputSchema=serializeOutputSchema(o.outputSchema)),o.reasoning!==void 0&&(u.reasoning=o.reasoning),o.limits!==void 0&&(u.limits={maxInputTokensPerSession:o.limits.maxInputTokensPerSession,maxOutputTokensPerSession:o.limits.maxOutputTokensPerSession,sessionTimeoutMs:o.limits.sessionTimeoutMs}),r!==void 0&&(u.source={exportName:r.exportName,sourceKind:`module`,logicalPath:r.logicalPath,sourceId:r.sourceId}),o.compaction?.model!==void 0&&(l.model=await normalizeAuthoredModelReference({modelCatalog:t.modelCatalog,purpose:`the compaction summary model`,contextWindowTokens:o.compaction.modelContextWindowTokens,providerOptions:o.modelOptions?.providerOptions,source:r,sourcePath:a,value:o.compaction.model})),o.compaction?.thresholdPercent!==void 0&&(l.thresholdPercent=o.compaction.thresholdPercent),d!==void 0)return{...u,dynamicModel:d};if(c===void 0)throw Error(`Expected a static agent model to compile to a concrete model reference.`);return{...u,model:c}}function normalizeExperimentalDefinition(e){if(e===void 0)return;let t={};return e.subagentPersistentSessions!==void 0&&(t.subagentPersistentSessions=e.subagentPersistentSessions),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,maxOutputTokens:t.limits.maxOutputTokens}}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,maxOutputTokens:n.maxOutputTokens}}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 +1 @@
1
- import{stripLogicalPathExtension}from"#discover/filesystem.js";import{normalizeInstructionsDefinition}from"#internal/authored-definition/core.js";import{loadModuleBackedDefinition}from"#compiler/normalize-helpers.js";import{isDynamicSentinel,rejectDynamicSentinelFallback}from"#shared/dynamic-tool-definition.js";async function compileInstructionsEntry(i,a,o={}){if(a.sourceKind===`markdown`){let n=normalizeInstructionsDefinition(a.definition,`Expected the compiled instructions definition at "${a.logicalPath}" to match the public eve shape.`);return{kind:`instructions`,definition:{name:stripLogicalPathExtension(a.logicalPath),logicalPath:a.logicalPath,markdown:n.markdown,sourceId:a.sourceId,sourceKind:a.sourceKind}}}let s=await loadModuleBackedDefinition({agentRoot:i,externalDependencies:o.externalDependencies,kind:`instructions`,source:a});if(isDynamicSentinel(s)){rejectDynamicSentinelFallback(s,`Expected the instructions export "${a.exportName??`default`}" from "${a.logicalPath}" to match the public eve shape.`);let t=stripLogicalPathExtension(a.logicalPath).replace(/^instructions\//,``);return{kind:`dynamic-instructions`,definition:{eventNames:Object.keys(s.events),exportName:a.exportName,logicalPath:a.logicalPath,slug:t,sourceId:a.sourceId,sourceKind:`module`}}}let c=normalizeInstructionsDefinition(s,`Expected the instructions export "${a.exportName??`default`}" from "${a.logicalPath}" to match the public eve shape.`);return{kind:`instructions`,definition:{name:stripLogicalPathExtension(a.logicalPath),logicalPath:a.logicalPath,markdown:c.markdown,sourceId:a.sourceId,sourceKind:a.sourceKind}}}async function compileInstructions(e,t,n={}){let r=await compileInstructionsEntry(e,t,n);if(r.kind===`dynamic-instructions`)throw Error(`Expected static instructions from "${t.logicalPath}" but got a dynamic resolver. Use compileInstructionsEntry instead.`);return r.definition}export{compileInstructions,compileInstructionsEntry};
1
+ import{stripLogicalPathExtension}from"#discover/filesystem.js";import{normalizeInstructionsDefinition}from"#internal/authored-definition/core.js";import{loadModuleBackedDefinition}from"#compiler/normalize-helpers.js";import{assertResolverOnlyDynamicSentinel,isDynamicSentinel}from"#shared/dynamic-tool-definition.js";async function compileInstructionsEntry(i,a,o={}){if(a.sourceKind===`markdown`){let n=normalizeInstructionsDefinition(a.definition,`Expected the compiled instructions definition at "${a.logicalPath}" to match the public eve shape.`);return{kind:`instructions`,definition:{name:stripLogicalPathExtension(a.logicalPath),logicalPath:a.logicalPath,markdown:n.markdown,sourceId:a.sourceId,sourceKind:a.sourceKind}}}let s=await loadModuleBackedDefinition({agentRoot:i,externalDependencies:o.externalDependencies,kind:`instructions`,source:a});if(isDynamicSentinel(s)){assertResolverOnlyDynamicSentinel(s,`Expected the instructions export "${a.exportName??`default`}" from "${a.logicalPath}" to match the public eve shape.`);let t=stripLogicalPathExtension(a.logicalPath).replace(/^instructions\//,``);return{kind:`dynamic-instructions`,definition:{eventNames:Object.keys(s.events),exportName:a.exportName,logicalPath:a.logicalPath,slug:t,sourceId:a.sourceId,sourceKind:`module`}}}let c=normalizeInstructionsDefinition(s,`Expected the instructions export "${a.exportName??`default`}" from "${a.logicalPath}" to match the public eve shape.`);return{kind:`instructions`,definition:{name:stripLogicalPathExtension(a.logicalPath),logicalPath:a.logicalPath,markdown:c.markdown,sourceId:a.sourceId,sourceKind:a.sourceKind}}}async function compileInstructions(e,t,n={}){let r=await compileInstructionsEntry(e,t,n);if(r.kind===`dynamic-instructions`)throw Error(`Expected static instructions from "${t.logicalPath}" but got a dynamic resolver. Use compileInstructionsEntry instead.`);return r.definition}export{compileInstructions,compileInstructionsEntry};
@@ -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{compileConnectionDefinition}from"#compiler/normalize-connection.js";import{compileHookEntry}from"#compiler/normalize-hook.js";import{compileInstructionsEntry}from"#compiler/normalize-instructions.js";import{compileSkillSource}from"#compiler/normalize-skill.js";import{compileToolEntry}from"#compiler/normalize-tool.js";import{mountRefNamespace,packageStateNamespace}from"#discover/extensions.js";import{createCompiledRuntimeModelCatalogLoader}from"#compiler/model-catalog.js";import{compileAgentConfig}from"#compiler/normalize-agent-config.js";import{compileExtensionContributions}from"#compiler/normalize-extension.js";import{compileSandboxDefinition}from"#compiler/normalize-sandbox.js";import{compileScheduleDefinition}from"#compiler/normalize-schedule.js";import{compileSubagentGraph}from"#compiler/normalize-subagent.js";async function compileAgentManifest(e){let r={modelCatalog:createCompiledRuntimeModelCatalogLoader(e.appRoot)},i=await compileAgentNodeManifest(e,r),a=await compileSubagentGraph({appRoot:e.appRoot,compileAgentNodeManifest,context:r,externalDependencies:i.config.build?.externalDependencies??[],parentNodeId:ROOT_COMPILED_AGENT_NODE_ID,subagents:e.subagents});return createCompiledAgentManifest({...i,extensionMounts:i.extensionMounts,remoteAgents:a.remoteAgents,subagentEdges:a.edges,subagents:a.nodes})}async function compileAgentNodeManifest(t,n,o={}){let s=Object.hasOwn(o,`agentConfigDefinition`)?await compileAgentConfig(t,n,{definition:o.agentConfigDefinition}):await compileAgentConfig(t,n);if(o.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(o.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,h;for(let e of u)e.kind===`tool`?d.push(e.definition):e.kind===`dynamic-tool`?f.push(e.definition):e.kind===`workflow-tool`?m={maxSubagents:e.maxSubagents}:e.kind===`web-search-tool`?h=e.provider:p.push(e.name);let g=(await Promise.all(t.channels.map(n=>compileChannelDefinition(t.agentRoot,n,{externalDependencies:c})))).flat(),_=await Promise.all(t.skills.map(e=>compileSkillSource(t.agentRoot,e,{externalDependencies:c}))),v=[],y=[];for(let e of _)e.kind===`skill`?v.push(e.definition):y.push(e.definition);let b=await Promise.all(t.instructions.map(e=>compileInstructionsEntry(t.agentRoot,e,{externalDependencies:c}))),x=[],S=[];for(let e of b)e.kind===`instructions`?x.push(e.definition):S.push(e.definition);let C=await Promise.all(t.connections.map(e=>compileConnectionDefinition(t.agentRoot,e,{externalDependencies:c}))),w=t.hooks.map(e=>compileHookEntry(e)),T=await Promise.all(t.schedules.map(e=>compileScheduleDefinition(t.agentRoot,e,{externalDependencies:c}))),E=new Set(d.map(e=>e.name)),D=new Set(f.map(e=>e.slug)),O=new Set(C.map(e=>e.connectionName)),k=new Set(v.map(e=>e.name)),A=[];for(let e of[...t.resolvedExtensions].sort((e,t)=>e.namespace.localeCompare(t.namespace))){let r=await compileExtensionContributions({mount:e,context:n,consumerAgentRoot:t.agentRoot,externalDependencies:c});for(let e of r.tools)E.has(e.name)||(E.add(e.name),d.push(e));for(let e of r.dynamicTools)D.has(e.slug)||(D.add(e.slug),f.push(e));for(let e of r.connections)O.has(e.connectionName)||(O.add(e.connectionName),C.push(e));for(let e of r.skills)k.has(e.name)||(k.add(e.name),v.push(e));w.push(...r.hooks),y.push(...r.dynamicSkills),S.push(...r.dynamicInstructions),A.push(...r.instructionFragments)}let j=[...x.map(e=>e.markdown),...A],M=j.length===0?void 0:x.length===1&&A.length===0?x[0]:{name:`instructions`,logicalPath:`instructions`,markdown:j.join(`
1
+ import{compileChannelDefinition}from"#compiler/normalize-channel.js";import{ROOT_COMPILED_AGENT_NODE_ID,createCompiledAgentManifest,createCompiledAgentNodeManifest,createCompiledAgentResources}from"#compiler/manifest.js";import{compileConnectionDefinition}from"#compiler/normalize-connection.js";import{compileHookEntry}from"#compiler/normalize-hook.js";import{compileInstructionsEntry}from"#compiler/normalize-instructions.js";import{compileSkillSource}from"#compiler/normalize-skill.js";import{compileToolEntry}from"#compiler/normalize-tool.js";import{mountRefNamespace,packageStateNamespace}from"#discover/extensions.js";import{createCompiledRuntimeModelCatalogLoader}from"#compiler/model-catalog.js";import{compileAgentConfig}from"#compiler/normalize-agent-config.js";import{compileExtensionContributions}from"#compiler/normalize-extension.js";import{compileSandboxDefinition}from"#compiler/normalize-sandbox.js";import{compileScheduleDefinition}from"#compiler/normalize-schedule.js";import{compileSubagentGraph}from"#compiler/normalize-subagent.js";async function compileAgentManifest(e){let r={modelCatalog:createCompiledRuntimeModelCatalogLoader(e.appRoot)},i=await compileAgentNodeManifest(e,r),a=await compileSubagentGraph({appRoot:e.appRoot,compileAgentNodeManifest,compileAgentResources,context:r,externalDependencies:i.config.build?.externalDependencies??[],parentNodeId:ROOT_COMPILED_AGENT_NODE_ID,subagents:e.subagents});return createCompiledAgentManifest({...i,extensionMounts:i.extensionMounts,remoteAgents:a.remoteAgents,subagentEdges:a.edges,subagents:a.nodes})}async function compileAgentNodeManifest(e,t,n={}){let i=Object.hasOwn(n,`agentConfigDefinition`)?await compileAgentConfig(e,t,{definition:n.agentConfigDefinition}):await compileAgentConfig(e,t);if(n.allowWorkflowConfig===!1&&i.experimental?.workflow!==void 0)throw Error(`Workflow runtime configuration is only supported on the root agent config. Remove "experimental.workflow" from "${e.agentId}".`);let a=mergeExternalDependencies(n.externalDependencies,i.build?.externalDependencies),o=a.length===0?i:{...i,build:{...i.build,externalDependencies:a}};return createCompiledAgentNodeManifest({...await compileAgentResources(e,t,{externalDependencies:a}),config:o})}async function compileAgentResources(t,n,r={}){let s=[...r.externalDependencies??[]],c=await Promise.all(t.tools.map(e=>compileToolEntry(t.agentRoot,e,{externalDependencies:s}))),l=[],u=[],d=[],f,p;for(let e of c)e.kind===`tool`?l.push(e.definition):e.kind===`dynamic-tool`?u.push(e.definition):e.kind===`workflow-tool`?f={maxSubagents:e.maxSubagents}:e.kind===`web-search-tool`?p=e.provider:d.push(e.name);let m=(await Promise.all(t.channels.map(n=>compileChannelDefinition(t.agentRoot,n,{externalDependencies:s})))).flat(),h=await Promise.all(t.skills.map(e=>compileSkillSource(t.agentRoot,e,{externalDependencies:s}))),g=[],_=[];for(let e of h)e.kind===`skill`?g.push(e.definition):_.push(e.definition);let v=await Promise.all(t.instructions.map(e=>compileInstructionsEntry(t.agentRoot,e,{externalDependencies:s}))),y=[],b=[];for(let e of v)e.kind===`instructions`?y.push(e.definition):b.push(e.definition);let x=await Promise.all(t.connections.map(e=>compileConnectionDefinition(t.agentRoot,e,{externalDependencies:s}))),S=t.hooks.map(e=>compileHookEntry(e)),C=await Promise.all(t.schedules.map(e=>compileScheduleDefinition(t.agentRoot,e,{externalDependencies:s}))),w=new Set(l.map(e=>e.name)),T=new Set(u.map(e=>e.slug)),E=new Set(x.map(e=>e.connectionName)),D=new Set(g.map(e=>e.name)),O=[];for(let e of[...t.resolvedExtensions].sort((e,t)=>e.namespace.localeCompare(t.namespace))){let r=await compileExtensionContributions({mount:e,context:n,consumerAgentRoot:t.agentRoot,externalDependencies:s});for(let e of r.tools)w.has(e.name)||(w.add(e.name),l.push(e));for(let e of r.dynamicTools)T.has(e.slug)||(T.add(e.slug),u.push(e));for(let e of r.connections)E.has(e.connectionName)||(E.add(e.connectionName),x.push(e));for(let e of r.skills)D.has(e.name)||(D.add(e.name),g.push(e));S.push(...r.hooks),_.push(...r.dynamicSkills),b.push(...r.dynamicInstructions),O.push(...r.instructionFragments)}let k=[...y.map(e=>e.markdown),...O],A=k.length===0?void 0:y.length===1&&O.length===0?y[0]:{name:`instructions`,logicalPath:`instructions`,markdown:k.join(`
2
2
 
3
- `),sourceId:x[0]?.sourceId??`instructions`,sourceKind:`module`};return createCompiledAgentNodeManifest({agentRoot:t.agentRoot,appRoot:t.appRoot,channels:g,extensionMounts:compileExtensionMounts(t),config:l,connections:C,diagnosticsSummary:t.diagnosticsSummary,disabledFrameworkTools:p,workflowTool:m,webSearchProvider:h,dynamicSkills:y,dynamicTools:f,hooks:w,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:T,dynamicInstructions:S,skills:v,instructions:M,tools:d})}function compileExtensionMounts(e){return e.resolvedExtensions.map(t=>{let n=e.extensions.find(e=>mountRefNamespace(e.logicalPath)===t.namespace);return{namespace:t.namespace,packageName:t.packageName,packageNamespace:packageStateNamespace(t.packageName),sourceRoot:t.sourceRoot,mountSourceId:n?.sourceId??`extensions/${t.namespace}`,mountLogicalPath:n?.logicalPath??`extensions/${t.namespace}`}})}function mergeExternalDependencies(...e){let t=new Set;for(let n of e)for(let e of n??[])t.add(e);return[...t]}export{compileAgentManifest};
3
+ `),sourceId:y[0]?.sourceId??`instructions`,sourceKind:`module`};return createCompiledAgentResources({agentRoot:t.agentRoot,appRoot:t.appRoot,channels:m,extensionMounts:compileExtensionMounts(t),connections:x,diagnosticsSummary:t.diagnosticsSummary,disabledFrameworkTools:d,workflowTool:f,webSearchProvider:p,dynamicSkills:_,dynamicTools:u,hooks:S,sandbox:t.sandbox===null?null:await compileSandboxDefinition(t.agentRoot,t.sandbox,{externalDependencies:s}),sandboxWorkspaces:t.sandboxWorkspaces.map(e=>({logicalPath:e.logicalPath,rootEntries:[...e.rootEntries],sourceId:e.sourceId,sourcePath:e.sourcePath})),schedules:C,dynamicInstructions:b,skills:g,instructions:A,tools:l})}function compileExtensionMounts(e){return e.resolvedExtensions.map(t=>{let n=e.extensions.find(e=>mountRefNamespace(e.logicalPath)===t.namespace);return{namespace:t.namespace,packageName:t.packageName,packageNamespace:packageStateNamespace(t.packageName),sourceRoot:t.sourceRoot,mountSourceId:n?.sourceId??`extensions/${t.namespace}`,mountLogicalPath:n?.logicalPath??`extensions/${t.namespace}`}})}function mergeExternalDependencies(...e){let t=new Set;for(let n of e)for(let e of n??[])t.add(e);return[...t]}export{compileAgentManifest};
@@ -1 +1 @@
1
- import{stripLogicalPathExtension}from"#discover/filesystem.js";import{normalizeSkillDefinition}from"#internal/authored-definition/core.js";import{loadModuleBackedDefinition}from"#compiler/normalize-helpers.js";import{isDynamicSentinel,rejectDynamicSentinelFallback}from"#shared/dynamic-tool-definition.js";async function compileSkillSource(r,i,a={}){if(i.sourceKind===`skill-package`)return{kind:`skill`,definition:compileSkillPackageSource(i)};if(i.sourceKind===`markdown`){let n=normalizeSkillDefinition(i.definition,`Expected the compiled skill definition at "${i.logicalPath}" to match the public eve shape.`);return{kind:`skill`,definition:{description:n.description,files:n.files,license:n.license,logicalPath:i.logicalPath,markdown:n.markdown,metadata:n.metadata===void 0?void 0:{...n.metadata},name:stripLogicalPathExtension(i.logicalPath).replace(/^skills\//,``),sourceId:i.sourceId,sourceKind:i.sourceKind}}}let o=await loadModuleBackedDefinition({agentRoot:r,externalDependencies:a.externalDependencies,kind:`skill`,source:i});if(isDynamicSentinel(o)){rejectDynamicSentinelFallback(o,`Expected the skill export "${i.exportName??`default`}" from "${i.logicalPath}" to match the public eve shape.`);let t=stripLogicalPathExtension(i.logicalPath).replace(/^skills\//,``);return{kind:`dynamic-skill`,definition:{eventNames:Object.keys(o.events),exportName:i.exportName,logicalPath:i.logicalPath,slug:t,sourceId:i.sourceId,sourceKind:`module`}}}let s=normalizeSkillDefinition(o,`Expected the skill export "${i.exportName??`default`}" from "${i.logicalPath}" to match the public eve shape.`);return{kind:`skill`,definition:{description:s.description,files:s.files,license:s.license,logicalPath:i.logicalPath,markdown:s.markdown,metadata:s.metadata===void 0?void 0:{...s.metadata},name:stripLogicalPathExtension(i.logicalPath).replace(/^skills\//,``),sourceId:i.sourceId,sourceKind:i.sourceKind}}}function compileSkillPackageSource(e){return{assetsPath:e.assetsPath,description:e.description,license:e.license,logicalPath:e.logicalPath,markdown:e.markdown,metadata:e.metadata===void 0?void 0:{...e.metadata},name:e.name,referencesPath:e.referencesPath,rootPath:e.rootPath,scriptsPath:e.scriptsPath,skillId:e.skillId,skillFilePath:e.skillFilePath,sourceId:e.sourceId,sourceKind:`skill-package`}}export{compileSkillSource};
1
+ import{stripLogicalPathExtension}from"#discover/filesystem.js";import{normalizeSkillDefinition}from"#internal/authored-definition/core.js";import{loadModuleBackedDefinition}from"#compiler/normalize-helpers.js";import{assertResolverOnlyDynamicSentinel,isDynamicSentinel}from"#shared/dynamic-tool-definition.js";async function compileSkillSource(r,i,a={}){if(i.sourceKind===`skill-package`)return{kind:`skill`,definition:compileSkillPackageSource(i)};if(i.sourceKind===`markdown`){let n=normalizeSkillDefinition(i.definition,`Expected the compiled skill definition at "${i.logicalPath}" to match the public eve shape.`);return{kind:`skill`,definition:{description:n.description,files:n.files,license:n.license,logicalPath:i.logicalPath,markdown:n.markdown,metadata:n.metadata===void 0?void 0:{...n.metadata},name:stripLogicalPathExtension(i.logicalPath).replace(/^skills\//,``),sourceId:i.sourceId,sourceKind:i.sourceKind}}}let o=await loadModuleBackedDefinition({agentRoot:r,externalDependencies:a.externalDependencies,kind:`skill`,source:i});if(isDynamicSentinel(o)){assertResolverOnlyDynamicSentinel(o,`Expected the skill export "${i.exportName??`default`}" from "${i.logicalPath}" to match the public eve shape.`);let t=stripLogicalPathExtension(i.logicalPath).replace(/^skills\//,``);return{kind:`dynamic-skill`,definition:{eventNames:Object.keys(o.events),exportName:i.exportName,logicalPath:i.logicalPath,slug:t,sourceId:i.sourceId,sourceKind:`module`}}}let s=normalizeSkillDefinition(o,`Expected the skill export "${i.exportName??`default`}" from "${i.logicalPath}" to match the public eve shape.`);return{kind:`skill`,definition:{description:s.description,files:s.files,license:s.license,logicalPath:i.logicalPath,markdown:s.markdown,metadata:s.metadata===void 0?void 0:{...s.metadata},name:stripLogicalPathExtension(i.logicalPath).replace(/^skills\//,``),sourceId:i.sourceId,sourceKind:i.sourceKind}}}function compileSkillPackageSource(e){return{assetsPath:e.assetsPath,description:e.description,license:e.license,logicalPath:e.logicalPath,markdown:e.markdown,metadata:e.metadata===void 0?void 0:{...e.metadata},name:e.name,referencesPath:e.referencesPath,rootPath:e.rootPath,scriptsPath:e.scriptsPath,skillId:e.skillId,skillFilePath:e.skillFilePath,sourceId:e.sourceId,sourceKind:`skill-package`}}export{compileSkillSource};
@@ -1,5 +1,5 @@
1
1
  import { type AgentSourceManifest, type LocalSubagentSourceRef } from "#discover/manifest.js";
2
- import { type CompiledAgentNodeManifest, type CompiledRemoteAgentNode, type CompiledSubagentEdge, type CompiledSubagentNode } from "#compiler/manifest.js";
2
+ import { type CompiledAgentNodeManifest, type CompiledAgentResources, type CompiledRemoteAgentNode, type CompiledSubagentEdge, type CompiledSubagentNode } from "#compiler/manifest.js";
3
3
  import { type ManifestCompileContext } from "#compiler/normalize-helpers.js";
4
4
  /**
5
5
  * Callback the subagent compiler uses to recurse into the per-node
@@ -12,6 +12,9 @@ export type CompileAgentNodeManifestFn = (manifest: AgentSourceManifest, context
12
12
  readonly externalDependencies?: readonly string[];
13
13
  readonly allowWorkflowConfig?: boolean;
14
14
  }) => Promise<CompiledAgentNodeManifest>;
15
+ export type CompileAgentResourcesFn = (manifest: AgentSourceManifest, context: ManifestCompileContext, options?: {
16
+ readonly externalDependencies?: readonly string[];
17
+ }) => Promise<CompiledAgentResources>;
15
18
  /**
16
19
  * Compiles every local subagent reachable from one parent node into a
17
20
  * flat node list and the parent→child edges that connect them.
@@ -23,6 +26,7 @@ export type CompileAgentNodeManifestFn = (manifest: AgentSourceManifest, context
23
26
  export declare function compileSubagentGraph(input: {
24
27
  readonly appRoot: string;
25
28
  readonly compileAgentNodeManifest: CompileAgentNodeManifestFn;
29
+ readonly compileAgentResources: CompileAgentResourcesFn;
26
30
  readonly context: ManifestCompileContext;
27
31
  readonly externalDependencies?: readonly string[];
28
32
  readonly parentNodeId: string;
@@ -1 +1 @@
1
- import{expectBoolean,expectFunction,expectObjectRecord,expectOnlyKnownKeys,expectString}from"#internal/authored-module.js";import{EVE_SESSION_ROUTE_PATH}from"#protocol/routes.js";import{DEFAULT_AGENT_MODEL_ID}from"#shared/default-agent-model.js";import{serializeOutputSchema}from"#shared/tool-schema.js";import{createCompiledSubagentNodeId}from"#compiler/manifest.js";import{normalizeAgentDefinition}from"#internal/authored-definition/core.js";import{loadModuleBackedDefinition}from"#compiler/normalize-helpers.js";import{isDynamicSentinel}from"#shared/dynamic-tool-definition.js";import{createPathDerivedSourceId}from"#discover/manifest.js";const ALLOWED_DYNAMIC_SUBAGENT_EVENTS=new Set([`session.started`,`turn.started`]);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}),i=normalizeDynamicSubagentDefinition(r,`Expected the dynamic subagent config export "${t.exportName??`default`}" from "${n.logicalPath}" to match the public eve shape.`);if(i===void 0&&readAgentDefinitionKind(r)===`remote`)return{kind:`remote`,node:compileRemoteAgent({source:e.source,value:r})};let a=r;if(i!==void 0){let e={model:DEFAULT_AGENT_MODEL_ID};i.build!==void 0&&(e.build=i.build),a=e}return{kind:`local`,...await compileLocalSubagent({...e,agentConfigDefinition:a,dynamic:i?.definition})}}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,{agentConfigDefinition:e.agentConfigDefinition,allowWorkflowConfig:!1,externalDependencies:e.externalDependencies}),i=r.config.description,a;if(e.dynamic!==void 0)a={dynamic:e.dynamic};else{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.`);a={description:i}}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]},...a,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.`),i={...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};return r.url===void 0?i:{...i,url:r.url}}function normalizeDynamicSubagentDefinition(e,i){if(!isDynamicSentinel(e))return;let a=expectObjectRecord(e,i);if(Object.hasOwn(a,`fallback`))throw Error(`${i} Dynamic subagent definitions do not support "fallback". Return defineAgent(...) or defineRemoteAgent(...) from an event handler instead.`);expectOnlyKnownKeys(a,[`build`,`events`,`kind`],i);let s=a.build===void 0?void 0:normalizeAgentDefinition({build:a.build,model:DEFAULT_AGENT_MODEL_ID},i).build,c=expectObjectRecord(a.events,i),l=[];for(let[e,n]of Object.entries(c)){if(!ALLOWED_DYNAMIC_SUBAGENT_EVENTS.has(e))throw Error(`${i} Dynamic subagents support only "session.started" and "turn.started" handlers.`);expectFunction(n,i),l.push(e)}let u={definition:{eventNames:l}};return s!==void 0&&(u.build=s),u}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(t,o){let c=expectObjectRecord(t,o);if(expectOnlyKnownKeys(c,[`auth`,`description`,`forwardPrincipal`,`headers`,`kind`,`outputSchema`,`path`,`url`],o),c.kind!==`remote`)throw Error(`${o} Expected "kind" to be "remote".`);return c.forwardPrincipal!==void 0&&expectBoolean(c.forwardPrincipal,`${o} Expected "forwardPrincipal" to be a boolean.`),{description:expectString(c.description,o),outputSchema:serializeOutputSchema(c.outputSchema),path:c.path===void 0?EVE_SESSION_ROUTE_PATH:expectString(c.path,o),url:typeof c.url==`function`?void 0:expectString(c.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{expectBoolean,expectFunction,expectObjectRecord,expectOnlyKnownKeys,expectString}from"#internal/authored-module.js";import{EVE_SESSION_ROUTE_PATH}from"#protocol/routes.js";import{serializeOutputSchema}from"#shared/tool-schema.js";import{createCompiledSubagentNodeId}from"#compiler/manifest.js";import{loadModuleBackedDefinition}from"#compiler/normalize-helpers.js";import{isDynamicSentinel}from"#shared/dynamic-tool-definition.js";import{createPathDerivedSourceId}from"#discover/manifest.js";const ALLOWED_DYNAMIC_SUBAGENT_EVENTS=new Set([`session.started`,`turn.started`]);async function compileSubagentGraph(e){let t=[],n=[],r=[];for(let i of e.subagents){let a=await compileSubagentDefinition({appRoot:e.appRoot,compileAgentNodeManifest:e.compileAgentNodeManifest,compileAgentResources:e.compileAgentResources,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}),i=normalizeDynamicSubagentDefinition(r,`Expected the dynamic subagent config export "${t.exportName??`default`}" from "${n.logicalPath}" to match the public eve shape.`);return i===void 0&&readAgentDefinitionKind(r)===`remote`?{kind:`remote`,node:compileRemoteAgent({source:e.source,value:r})}:{kind:`local`,...await compileLocalSubagent({...e,agentConfigDefinition:i===void 0?r:void 0,configResolver:i===void 0?void 0:{...t,...i.definition,build:i.build}})}}async function compileSubagent(e){let t=createCompiledSubagentNodeId(e.parentNodeId,e.source.sourceId),n=e.source.subagentId,r={...e.source.manifest,appRoot:e.appRoot},i=mergeExternalDependencies(e.externalDependencies,e.configResolver?.build?.externalDependencies),a={entryPath:e.source.entryPath,logicalPath:e.source.logicalPath,name:n,nodeId:t,rootPath:e.source.rootPath,sourceId:e.source.sourceId,sourceKind:`module`};if(e.configResolver===void 0){let n=await e.compileAgentNodeManifest(r,e.context,{agentConfigDefinition:e.agentConfigDefinition,allowWorkflowConfig:!1,externalDependencies:i}),o=n.config.description;if(!o)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 s=await compileSubagentGraph({appRoot:e.appRoot,compileAgentNodeManifest:e.compileAgentNodeManifest,context:e.context,compileAgentResources:e.compileAgentResources,externalDependencies:n.config.build?.externalDependencies??i,parentNodeId:t,subagents:e.source.manifest.subagents});return{descendants:s,node:{...a,agent:{...n,remoteAgents:[...s.remoteAgents]},description:o}}}let o=await e.compileAgentResources(r,e.context,{externalDependencies:i}),c=await compileSubagentGraph({appRoot:e.appRoot,compileAgentNodeManifest:e.compileAgentNodeManifest,context:e.context,compileAgentResources:e.compileAgentResources,externalDependencies:i,parentNodeId:t,subagents:e.source.manifest.subagents});return{descendants:c,node:{...a,agent:{...o,remoteAgents:[...c.remoteAgents]},configResolver:e.configResolver}}}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.`),i={...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};return r.url===void 0?i:{...i,url:r.url}}function normalizeDynamicSubagentDefinition(e,i){if(!isDynamicSentinel(e))return;let a=expectObjectRecord(e,i);expectOnlyKnownKeys(a,[`build`,`events`,`kind`],i);let o=a.build===void 0?void 0:normalizeDynamicSubagentBuild(a.build,i),s=expectObjectRecord(a.events,i),c=[];for(let[e,n]of Object.entries(s)){if(!ALLOWED_DYNAMIC_SUBAGENT_EVENTS.has(e))throw Error(`${i} Dynamic subagents support only "session.started" and "turn.started" handlers.`);expectFunction(n,i),c.push(e)}let l={definition:{eventNames:c}};return o!==void 0&&(l.build=o),l}function normalizeDynamicSubagentBuild(e,t){let a=expectObjectRecord(e,t);if(expectOnlyKnownKeys(a,[`externalDependencies`],t),a.externalDependencies===void 0)return{};if(!Array.isArray(a.externalDependencies))throw Error(t);return{externalDependencies:a.externalDependencies.map(e=>expectString(e,t))}}function mergeExternalDependencies(...e){return[...new Set(e.flatMap(e=>e??[]))]}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(t,s){let c=expectObjectRecord(t,s);if(expectOnlyKnownKeys(c,[`auth`,`description`,`forwardPrincipal`,`headers`,`kind`,`outputSchema`,`path`,`url`],s),c.kind!==`remote`)throw Error(`${s} Expected "kind" to be "remote".`);return c.forwardPrincipal!==void 0&&expectBoolean(c.forwardPrincipal,`${s} Expected "forwardPrincipal" to be a boolean.`),{description:expectString(c.description,s),outputSchema:serializeOutputSchema(c.outputSchema),path:c.path===void 0?EVE_SESSION_ROUTE_PATH:expectString(c.path,s),url:typeof c.url==`function`?void 0:expectString(c.url,s)}}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};
@@ -2,7 +2,10 @@ import { z } from "#compiled/zod/index.js";
2
2
  import type { JsonObject } from "#shared/json.js";
3
3
  import type { Node } from "#shared/node.js";
4
4
  import type { ModuleSourceRef } from "#shared/source-ref.js";
5
- export interface CompiledDynamicSubagentDefinition {
5
+ export interface CompiledDynamicSubagentDefinition extends Readonly<ModuleSourceRef> {
6
+ readonly build?: {
7
+ readonly externalDependencies?: readonly string[];
8
+ };
6
9
  readonly eventNames: readonly string[];
7
10
  }
8
11
  /**
@@ -1 +1 @@
1
- import{createHash}from"node:crypto";import{cp,mkdir,readFile,readdir,rm}from"node:fs/promises";import{join,posix}from"node:path";import{normalizeLogicalPath}from"#discover/filesystem.js";import{ROOT_COMPILED_AGENT_NODE_ID,deriveResourceRootEntries}from"#compiler/manifest.js";import{normalizeSkillPackage,writeSkillPackageDirectory}from"#shared/skill-package.js";const RESOURCES_DIRECTORY=`workspace-resources`;async function materializeWorkspaceResources(e){let t=join(e.compileDirectoryPath,RESOURCES_DIRECTORY);await rm(t,{force:!0,recursive:!0});let n=await materializeNode({nodeId:ROOT_COMPILED_AGENT_NODE_ID,resourcesRoot:t,manifest:e.manifest}),r=await Promise.all(e.manifest.subagents.map(async e=>({...e,agent:await materializeNode({nodeId:e.nodeId,resourcesRoot:t,manifest:e.agent})})));return{...n,kind:e.manifest.kind,extensionMounts:e.manifest.extensionMounts,subagentEdges:e.manifest.subagentEdges,subagents:r,version:e.manifest.version}}function createResourceRoot(e,t,n){return{contentHash:n,logicalPath:normalizeLogicalPath(join(RESOURCES_DIRECTORY,t)),rootEntries:deriveResourceRootEntries({sandboxWorkspaces:e.sandboxWorkspaces,skills:e.skills})}}async function materializeNode(e){let t=join(e.resourcesRoot,e.nodeId);await mkdir(t,{recursive:!0});let r=join(t,`workspace`);for(let t of e.manifest.sandboxWorkspaces)await copyDirectoryContents({sourcePath:t.sourcePath,targetPath:r});for(let n of e.manifest.skills)await materializeSkill({nodeRoot:t,skill:n});let i=await hashWorkspaceResourceRoot(t);return{...e.manifest,skills:e.manifest.skills.map(stripSkillPackageFiles),workspaceResourceRoot:createResourceRoot(e.manifest,e.nodeId,i)}}async function materializeSkill(e){let n=join(e.nodeRoot,`skills`,e.skill.name);if(e.skill.sourceKind===`skill-package`){await cp(e.skill.rootPath,n,{recursive:!0});return}await writeSkillPackageDirectory({rootPath:e.nodeRoot,skill:normalizeSkillPackage(e.skill)})}function stripSkillPackageFiles(e){let{files:t,...n}=e;return n}async function copyDirectoryContents(e){let r=await readdir(e.sourcePath,{withFileTypes:!0});await mkdir(e.targetPath,{recursive:!0});for(let n of r)!n.isDirectory()&&!n.isFile()||await cp(join(e.sourcePath,n.name),join(e.targetPath,n.name),{recursive:!0})}async function hashWorkspaceResourceRoot(t){let n=await listWorkspaceResourceFiles({logicalDirectoryPath:`.`,sourceDirectoryPath:t});if(n.sort((e,t)=>e.logicalPath.localeCompare(t.logicalPath)),n.length===0)return;let i=createHash(`sha256`);i.update(`eve-workspace-resource-root-v1\0`);for(let e of n){let t=await readFile(e.sourcePath);i.update(e.logicalPath),i.update(`\0`),i.update(String(t.byteLength)),i.update(`\0`),i.update(t),i.update(`\0`)}return i.digest(`hex`)}async function listWorkspaceResourceFiles(e){let t=[],n=await readdir(e.sourceDirectoryPath,{withFileTypes:!0});for(let r of n){if(!r.isDirectory()&&!r.isFile())continue;let n=join(e.sourceDirectoryPath,r.name),i=posix.join(e.logicalDirectoryPath,r.name);if(r.isDirectory()){t.push(...await listWorkspaceResourceFiles({logicalDirectoryPath:i,sourceDirectoryPath:n}));continue}t.push({logicalPath:i,sourcePath:n})}return t}export{materializeWorkspaceResources};
1
+ import{createHash}from"node:crypto";import{cp,mkdir,readFile,readdir,rm}from"node:fs/promises";import{join,posix}from"node:path";import{normalizeLogicalPath}from"#discover/filesystem.js";import{ROOT_COMPILED_AGENT_NODE_ID,deriveResourceRootEntries}from"#compiler/manifest.js";import{normalizeSkillPackage,writeSkillPackageDirectory}from"#shared/skill-package.js";const RESOURCES_DIRECTORY=`workspace-resources`;async function materializeWorkspaceResources(e){let t=join(e.compileDirectoryPath,RESOURCES_DIRECTORY);await rm(t,{force:!0,recursive:!0});let n=await materializeNode({nodeId:ROOT_COMPILED_AGENT_NODE_ID,resourcesRoot:t,manifest:e.manifest}),r=await Promise.all(e.manifest.subagents.map(async e=>e.configResolver===void 0?{...e,agent:await materializeNode({nodeId:e.nodeId,resourcesRoot:t,manifest:e.agent})}:{...e,agent:await materializeNode({nodeId:e.nodeId,resourcesRoot:t,manifest:e.agent}),configResolver:e.configResolver}));return{...n,kind:e.manifest.kind,extensionMounts:e.manifest.extensionMounts,subagentEdges:e.manifest.subagentEdges,subagents:r,version:e.manifest.version}}function createResourceRoot(e,t,n){return{contentHash:n,logicalPath:normalizeLogicalPath(join(RESOURCES_DIRECTORY,t)),rootEntries:deriveResourceRootEntries({sandboxWorkspaces:e.sandboxWorkspaces,skills:e.skills})}}async function materializeNode(e){let t=join(e.resourcesRoot,e.nodeId);await mkdir(t,{recursive:!0});let r=join(t,`workspace`);for(let t of e.manifest.sandboxWorkspaces)await copyDirectoryContents({sourcePath:t.sourcePath,targetPath:r});for(let n of e.manifest.skills)await materializeSkill({nodeRoot:t,skill:n});let i=await hashWorkspaceResourceRoot(t);return{...e.manifest,skills:e.manifest.skills.map(stripSkillPackageFiles),workspaceResourceRoot:createResourceRoot(e.manifest,e.nodeId,i)}}async function materializeSkill(e){let n=join(e.nodeRoot,`skills`,e.skill.name);if(e.skill.sourceKind===`skill-package`){await cp(e.skill.rootPath,n,{recursive:!0});return}await writeSkillPackageDirectory({rootPath:e.nodeRoot,skill:normalizeSkillPackage(e.skill)})}function stripSkillPackageFiles(e){let{files:t,...n}=e;return n}async function copyDirectoryContents(e){let r=await readdir(e.sourcePath,{withFileTypes:!0});await mkdir(e.targetPath,{recursive:!0});for(let n of r)!n.isDirectory()&&!n.isFile()||await cp(join(e.sourcePath,n.name),join(e.targetPath,n.name),{recursive:!0})}async function hashWorkspaceResourceRoot(t){let n=await listWorkspaceResourceFiles({logicalDirectoryPath:`.`,sourceDirectoryPath:t});if(n.sort((e,t)=>e.logicalPath.localeCompare(t.logicalPath)),n.length===0)return;let i=createHash(`sha256`);i.update(`eve-workspace-resource-root-v1\0`);for(let e of n){let t=await readFile(e.sourcePath);i.update(e.logicalPath),i.update(`\0`),i.update(String(t.byteLength)),i.update(`\0`),i.update(t),i.update(`\0`)}return i.digest(`hex`)}async function listWorkspaceResourceFiles(e){let t=[],n=await readdir(e.sourceDirectoryPath,{withFileTypes:!0});for(let r of n){if(!r.isDirectory()&&!r.isFile())continue;let n=join(e.sourceDirectoryPath,r.name),i=posix.join(e.logicalDirectoryPath,r.name);if(r.isDirectory()){t.push(...await listWorkspaceResourceFiles({logicalDirectoryPath:i,sourceDirectoryPath:n}));continue}t.push({logicalPath:i,sourcePath:n})}return t}export{materializeWorkspaceResources};
@@ -3,9 +3,15 @@ import type { AlsContext } from "#context/container.js";
3
3
  import type { ContextKey } from "#context/key.js";
4
4
  import { type LiveDynamicModelSelection } from "#context/keys.js";
5
5
  import type { UnstampedMessageStreamEvent } from "#protocol/message.js";
6
- import type { RuntimeDynamicModelReference, RuntimeModelReference } from "#runtime/agent/bootstrap.js";
6
+ import type { RuntimeDynamicModelReference } from "#runtime/agent/bootstrap.js";
7
7
  import { type RuntimeModelResolutionScope } from "#runtime/agent/resolve-model.js";
8
8
  export type ActiveDynamicModelSelection = LiveDynamicModelSelection;
9
+ export declare class DynamicModelSelectionError extends Error {
10
+ readonly code = "EVE_DYNAMIC_MODEL_SELECTION_FAILED";
11
+ readonly name = "DynamicModelSelectionError";
12
+ constructor(error: unknown);
13
+ }
14
+ export declare function isDynamicModelSelectionError(error: unknown): error is DynamicModelSelectionError;
9
15
  export declare function getActiveDynamicModelSelection(ctx: {
10
16
  get<T>(key: ContextKey<T>): T | undefined;
11
17
  }): ActiveDynamicModelSelection | null;
@@ -13,7 +19,6 @@ export declare function dispatchDynamicModelEvent(input: {
13
19
  readonly ctx: AlsContext;
14
20
  readonly dynamicModel: RuntimeDynamicModelReference | undefined;
15
21
  readonly event: UnstampedMessageStreamEvent;
16
- readonly fallback: RuntimeModelReference;
17
22
  readonly messages: readonly ModelMessage[];
18
23
  readonly scope: RuntimeModelResolutionScope;
19
24
  }): Promise<void>;