eve 0.45.2 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/src/channel/types.d.ts +2 -0
- package/dist/src/cli/dev/tui/agent-header.d.ts +5 -14
- package/dist/src/cli/dev/tui/agent-header.js +1 -1
- package/dist/src/cli/dev/tui/runner.d.ts +4 -5
- package/dist/src/cli/dev/tui/terminal-renderer.d.ts +3 -3
- package/dist/src/cli/run.js +3 -3
- package/dist/src/compiler/channel-route-plan.d.ts +2 -2
- package/dist/src/compiler/instrumentation-layout-config.d.ts +3 -0
- package/dist/src/compiler/instrumentation-layout-config.js +1 -0
- package/dist/src/compiler/load-binding-namespace.d.ts +5 -3
- package/dist/src/compiler/load-binding-namespace.js +1 -1
- package/dist/src/compiler/manifest.d.ts +2 -2
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/module-lifecycle.d.ts +14 -0
- package/dist/src/compiler/module-lifecycle.js +1 -0
- package/dist/src/compiler/module-map.d.ts +2 -2
- package/dist/src/compiler/module-map.js +2 -2
- package/dist/src/compiler/node-source-state.d.ts +6 -3
- package/dist/src/compiler/node-source-state.js +1 -1
- package/dist/src/compiler/normalize-agent-config.d.ts +2 -2
- package/dist/src/compiler/normalize-helpers.d.ts +4 -4
- package/dist/src/compiler/normalize-manifest-helpers.js +1 -1
- package/dist/src/compiler/normalize-manifest.js +1 -1
- package/dist/src/compiler/remote-agent-node.js +1 -1
- package/dist/src/compiler/source-graph.d.ts +12 -2
- package/dist/src/compiler/source-graph.js +1 -1
- package/dist/src/compiler/validate-artifact.js +1 -1
- package/dist/src/context/keys.d.ts +2 -0
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/framework/sources/registry.js +1 -1
- package/dist/src/harness/channel-delivery-instrumentation.js +1 -1
- package/dist/src/harness/instrumentation/content-policy.d.ts +3 -2
- package/dist/src/harness/instrumentation/content-policy.js +1 -1
- package/dist/src/harness/instrumentation/content.d.ts +11 -0
- package/dist/src/harness/instrumentation/content.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/internal/application/compiled-artifacts.d.ts +7 -7
- package/dist/src/internal/application/compiled-artifacts.js +2 -3
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-asset-import-plugin.d.ts +6 -2
- package/dist/src/internal/authored-asset-import-plugin.js +1 -1
- package/dist/src/internal/authored-module-loader.js +3 -3
- package/dist/src/internal/authored-module-map-loader.js +1 -1
- package/dist/src/internal/authored-runtime-modules.d.ts +15 -0
- package/dist/src/internal/authored-runtime-modules.js +1 -0
- package/dist/src/internal/materialized-authored-modules.d.ts +2 -18
- package/dist/src/internal/materialized-authored-modules.js +1 -1
- package/dist/src/internal/nitro/development-generation.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
- package/dist/src/public/channels/slack/inbound-content.js +2 -2
- package/dist/src/public/instrumentation/otel.d.ts +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/shared/instrumentation-content.d.ts +6 -0
- package/dist/src/shared/instrumentation-content.js +1 -0
- package/dist/src/shared/instrumentation-decision.d.ts +8 -0
- package/dist/src/shared/instrumentation-decision.js +1 -0
- package/dist/src/tracing/agent-trace-context-store.d.ts +3 -3
- package/dist/src/tracing/agent-trace-context-store.js +1 -1
- package/dist/src/tracing/otel-declaration.d.ts +14 -3
- package/dist/src/tracing/sampled-trace.d.ts +8 -1
- package/dist/src/tracing/sampled-trace.js +1 -1
- package/docs/agent-config.md +2 -0
- package/docs/channels/slack.mdx +2 -0
- package/docs/guides/dynamic-capabilities.md +2 -0
- package/docs/instructions.mdx +3 -1
- package/docs/reference/typescript-api.md +25 -0
- package/docs/schedules.mdx +2 -0
- package/docs/skills.mdx +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# eve
|
|
2
2
|
|
|
3
|
+
## 0.46.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 1d79217: Emit traces for every audience by default while recording content only for public conversations. `tracePolicy` can explicitly disable emission or select directional content capture, and existing boolean policies retain their current behavior.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 47b3e48: Static authored definitions now remain build-only, while runtime entries and their assets use the same bundling semantics in development and production.
|
|
12
|
+
- 9c0a138: Replace the eve TUI's separate banner and text header with a startup card showing the installed version, active model, and the instructions, tools, skills, subagents, and schedules loaded by the agent.
|
|
13
|
+
- 7acb4ec: Include the original message body when Slack users share a message into an eve conversation. Agents now receive Slack crosspost content alongside distinct top-level comments without repeating content already present in the comment.
|
|
14
|
+
|
|
3
15
|
## 0.45.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -7,6 +7,7 @@ import type { InputRequest, InputResponse } from "#shared/input.js";
|
|
|
7
7
|
import type { ChannelAdapter } from "#channel/adapter.js";
|
|
8
8
|
import type { AgentLimitsDefinition } from "#shared/agent-definition.js";
|
|
9
9
|
import type { JsonObject } from "#shared/json.js";
|
|
10
|
+
import type { InstrumentationDecision } from "#shared/instrumentation-decision.js";
|
|
10
11
|
import type { TaskView } from "#tasks/types.js";
|
|
11
12
|
export type { ContextAccessor } from "#context/key.js";
|
|
12
13
|
export type { ChannelInstrumentationProjection } from "#channel/instrumentation.js";
|
|
@@ -71,6 +72,7 @@ export interface SessionParent {
|
|
|
71
72
|
* free of tracing dependencies.
|
|
72
73
|
*/
|
|
73
74
|
export interface SessionTraceContext {
|
|
75
|
+
readonly decision?: InstrumentationDecision;
|
|
74
76
|
readonly spanId: string;
|
|
75
77
|
readonly traceFlags: number;
|
|
76
78
|
readonly traceId: string;
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Builds the startup header the dev TUI commits to scrollback before the
|
|
3
|
-
* first prompt: one `eve <agent name>` brand line, a discovery-diagnostics
|
|
4
|
-
* line when the compiler reported problems, and a rotating tip for local
|
|
5
|
-
* sessions. The resolved model is not repeated here — it lives on the
|
|
6
|
-
* persistent status line at the bottom.
|
|
7
|
-
*/
|
|
1
|
+
/** Builds the startup card the dev TUI commits before the first prompt. */
|
|
8
2
|
import type { AgentInfoResult } from "#client/index.js";
|
|
9
3
|
import type { Theme } from "./theme.js";
|
|
10
4
|
export interface AgentHeaderInput {
|
|
11
|
-
/** Resolved display name
|
|
12
|
-
name
|
|
5
|
+
/** Resolved display name used when agent inspection is unavailable. */
|
|
6
|
+
name?: string;
|
|
13
7
|
/** Agent inspection payload, or `undefined` when it could not be fetched. */
|
|
14
8
|
info?: AgentInfoResult;
|
|
15
9
|
theme: Theme;
|
|
16
10
|
/** Available terminal width. */
|
|
17
11
|
width: number;
|
|
18
|
-
/** Message-of-the-day line rendered
|
|
12
|
+
/** Message-of-the-day line rendered below the startup card, when present. */
|
|
19
13
|
tip?: string;
|
|
20
14
|
}
|
|
21
15
|
/**
|
|
@@ -25,8 +19,5 @@ export interface AgentHeaderInput {
|
|
|
25
19
|
export declare const AGENT_HEADER_TIPS: readonly string[];
|
|
26
20
|
/** Picks one tip; `random` is a test seam over Math.random. */
|
|
27
21
|
export declare function pickAgentHeaderTip(random?: () => number): string;
|
|
28
|
-
/**
|
|
29
|
-
* Returns the styled rows of the startup header (no trailing blank line is
|
|
30
|
-
* added by callers other than the one separating it from the transcript).
|
|
31
|
-
*/
|
|
22
|
+
/** Returns the styled rows of the startup card and optional tip. */
|
|
32
23
|
export declare function buildAgentHeader(input: AgentHeaderInput): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isPromptControlCommand}from"./prompt-commands.js";import{
|
|
1
|
+
import{isPromptControlCommand}from"./prompt-commands.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{clipVisible,visibleLength}from"#cli/ui/terminal-text.js";const AGENT_HEADER_TIPS=[`Use the /add command to install an integration.`,`Use the /deploy command to deploy your agent.`,`Use the /help command to see every command.`],EVE_LOGO=[`⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⠏⣿⣿⣿⣿⣿⣿⣿⣿⣿`,` ⠇⣿⠏`,`⣿⣿⣿⣿⣿⣿⠇ ⠇⣿⠏ ⠇⣿⣿⣿⣿⣿`,` ⠃⣿⠏`,`⣿⣿⣿⣿⣿⣿⠏ ⠃⣿⠏ ⠇⣿⣿⣿⣿⣿⣿⣿`];function pickAgentHeaderTip(e=Math.random){let t=Math.min(AGENT_HEADER_TIPS.length-1,Math.floor(e()*AGENT_HEADER_TIPS.length));return AGENT_HEADER_TIPS[t]}function buildAgentHeader(e){let{theme:i,info:o,width:s}=e,c=i.colors,l=resolveInstalledPackageInfo().version,u=Math.min(68,Math.max(0,s-1)),d=`${c.dim(`☰`)}${c.bold(`eve`)} ${c.dim(`(v${l})`)}`;if(u<4)return[clipVisible(d,s)];let f=i.unicode?`─`:`-`,p=i.unicode?`│`:`|`,m=i.unicode?`╭`:`+`,h=i.unicode?`╮`:`+`,g=i.unicode?`╰`:`+`,_=i.unicode?`╯`:`+`,v=u-2,y=f.repeat(v),row=(e=``,t=0)=>{let i=Math.max(0,v-2),a=clipVisible(e,i),o=Math.max(0,i-visibleLength(a)-t);return`${c.dim(p)} ${a}${` `.repeat(o)} ${c.dim(p)}`},b=o?.agent.name??e.name,x=b===void 0?d:spreadRow(d,c.bold(b),v-2,1),S=[c.dim(`${m}${y}${h}`)];S.push(row(x,1),row());let C=Math.max(...EVE_LOGO.map(e=>visibleLength(e)));i.unicode&&v-2>=C&&S.push(...EVE_LOGO.map(e=>row(centerLogoLine(e,C,v-2,i))),row());let detail=(e,t)=>row(`${c.dim(e.padEnd(14))}${t}`),w=formatHeaderModel(o?.agent.model,i);if(w!==void 0&&S.push(detail(`model`,w)),o!==void 0){S.push(detail(`instructions`,formatInstructions(o,v-18))),S.push(row());let e=groupTools(o);if(e.length===0)S.push(detail(`tools`,`none`));else{S.push(detail(`tools`,``));for(let t of e.slice(0,4))S.push(detail(` ${t.label}`,fitNames(t.names,v-18)));let t=e.length-4;t>0&&S.push(detail(` +${t} ${pluralize(t,`group`)}`,``))}S.push(detail(`skills`,fitNames(skillNames(o),v-18))),S.push(detail(`subagents`,fitNames(subagentNames(o),v-18))),S.push(detail(`schedules`,fitNames(o.schedules.map(e=>e.name),v-18)))}if(S.push(c.dim(`${g}${y}${_}`)),o&&(o.diagnostics.discoveryErrors>0||o.diagnostics.discoveryWarnings>0)){let e=[];o.diagnostics.discoveryErrors>0&&e.push(c.red(`${o.diagnostics.discoveryErrors} error${plural(o.diagnostics.discoveryErrors)}`)),o.diagnostics.discoveryWarnings>0&&e.push(c.yellow(`${o.diagnostics.discoveryWarnings} warning${plural(o.diagnostics.discoveryWarnings)}`)),S.push(``,` ${c.dim(i.glyph.warning)} ${e.join(c.dim(` · `))}`)}return e.tip!==void 0&&S.push(``,` ${c.bold(`Tip:`)} ${renderTip(e.tip,Math.max(8,s-7),i)}`),S}function centerLogoLine(e,t,n,r){let i=Math.max(0,Math.floor((n-t)/2));return`${` `.repeat(i)}${r.colors.cyan(e)}`}function spreadRow(e,t,i,a){let o=Math.max(1,i-a),s=clipVisible(e,Math.max(1,o-visibleLength(t)-1)),c=clipVisible(t,Math.max(1,o-visibleLength(s)-1)),l=Math.max(1,o-visibleLength(s)-visibleLength(c));return`${s}${` `.repeat(l)}${c}`}function groupTools(e){let t=new Map;for(let n of e.tools.static){let e=n.owner.kind===`application`?`agent`:n.owner.kind===`framework`?`eve`:n.owner.namespace,r=t.get(e)??[];r.push(n.name),t.set(e,r)}e.tools.dynamic.length>0&&t.set(`dynamic`,e.tools.dynamic.map(e=>e.slug));let priority=e=>e===`agent`?0:e===`dynamic`?2:e===`eve`?3:1;return[...t].map(([e,t])=>({label:e,names:t.sort()})).sort((e,t)=>priority(e.label)-priority(t.label)||e.label.localeCompare(t.label))}function skillNames(e){return[...e.skills.static.map(e=>e.name),...e.skills.dynamic.map(e=>`${e.slug} (dynamic)`)].sort()}function subagentNames(e){return[...e.subagents.local,...e.remoteAgents.entries].map(e=>e.name).sort()}function formatInstructions(e,t){return fitNames([...e.instructions.static.map(e=>`${e.logicalPath} (${e.role})`),...e.instructions.dynamic.map(e=>`${e.slug} (dynamic)`)],t)}function fitNames(e,t){if(e.length===0)return`none`;for(let n=e.length;n>0;--n){let i=e.length-n,a=`${e.slice(0,n).join(`, `)}${i>0?`, +${i} more`:``}`;if(visibleLength(a)<=t)return a}return clipVisible(e[0],t)}function formatHeaderModel(e,t){if(e?.id===void 0)return;let n=e.endpoint;if(n===void 0)return e.id;let r=t.colors.dim(`via `);switch(n.kind){case`external`:return`${e.id} ${r}${n.provider}`;case`chatgpt`:return`${e.id} ${r}chatgpt-sub`;case`gateway`:return n.connected?`${e.id} ${r}ai-gateway(${n.credential})`:`${e.id} ${r}ai-gateway(not connected)`}}function renderTip(t,r,i){return clipVisible(t.split(/(\/[a-z:-]+)/u).map(t=>isPromptControlCommand(t)?i.colors.blue(t):i.colors.dim(t)).join(``),r)}function plural(e){return e===1?``:`s`}function pluralize(e,t){return`${t}${plural(e)}`}export{AGENT_HEADER_TIPS,buildAgentHeader,pickAgentHeaderTip};
|
|
@@ -151,15 +151,14 @@ export type AgentTUIAgentHeader = {
|
|
|
151
151
|
name: string;
|
|
152
152
|
serverUrl: string;
|
|
153
153
|
info?: AgentInfoResult;
|
|
154
|
-
/** Message-of-the-day line shown
|
|
154
|
+
/** Message-of-the-day line shown below the startup card (local sessions only). */
|
|
155
155
|
tip?: string;
|
|
156
156
|
};
|
|
157
157
|
export type AgentTUIRenderer = {
|
|
158
158
|
/**
|
|
159
|
-
* Commits
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
* Optional — renderers without a header simply skip it.
|
|
159
|
+
* Commits the startup card to the transcript before the first prompt and
|
|
160
|
+
* refreshes it after local dev artifact changes. Optional — renderers
|
|
161
|
+
* without a header simply skip it.
|
|
163
162
|
*/
|
|
164
163
|
renderAgentHeader?(header: AgentTUIAgentHeader): void;
|
|
165
164
|
/**
|
|
@@ -46,7 +46,7 @@ export type AgentHeaderOptions = {
|
|
|
46
46
|
name: string;
|
|
47
47
|
serverUrl: string;
|
|
48
48
|
info?: AgentInfoResult;
|
|
49
|
-
/** Message-of-the-day line
|
|
49
|
+
/** Message-of-the-day line below the startup card (local sessions only). */
|
|
50
50
|
tip?: string;
|
|
51
51
|
};
|
|
52
52
|
export declare class TerminalRenderer implements AgentTUIRenderer {
|
|
@@ -58,8 +58,8 @@ export declare class TerminalRenderer implements AgentTUIRenderer {
|
|
|
58
58
|
/**
|
|
59
59
|
* Commits the startup agent header (brand mark + resolved configuration) to
|
|
60
60
|
* scrollback before the first prompt. Later calls (dev HMR refreshing fields
|
|
61
|
-
* such as the
|
|
62
|
-
*
|
|
61
|
+
* such as the model) commit a fresh header beneath the existing transcript
|
|
62
|
+
* only when the rendered header actually changed — every source
|
|
63
63
|
* reload re-sends it, and an identical banner repeated per reload is noise.
|
|
64
64
|
* Committed scrollback is never cleared or replayed.
|
|
65
65
|
*/
|
package/dist/src/cli/run.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createLogger}from"#internal/logging.js";import{Command,CommanderError,InvalidArgumentError}from"#compiled/commander/index.js";import{applicationCommand}from"#cli/application-command.js";import{parseDevelopmentHeaderOption,resolveDevelopmentUrlTarget}from"#cli/dev/url-target.js";import{parseDevelopmentServerUrl}from"#cli/dev/url.js";import{FORCED_EXIT_BACKSTOP_MS,installShutdownSignal,waitForShutdownSignal}from"#cli/shutdown.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{createCliTheme,renderCliTaggedLine}from"#cli/ui/output.js";import{isCodingAgentLaunch}from"#cli/agent-detection.js";import{eveCliBanner}from"#cli/banner.js";import{startCliLiveRow}from"#cli/ui/live-row.js";import{devBootPhase}from"#internal/dev-boot-progress.js";import{registerBuildCommand}from"#cli/commands/build.js";import{resolveApplicationRoot}from"#internal/application/paths.js";import{findCliApplicationRoot,resolveCliApplicationProject}from"#cli/application-root.js";import{registerIntegrationCommands}from"#cli/commands/register-integration-commands.js";import{registerProjectCommands}from"#cli/commands/register-project-commands.js";import{registerRegistryCommands}from"#cli/commands/register-registry-commands.js";import{resolveDevUiMode,resolveTuiDisplayOptions}from"#cli/dev/ui-options.js";import{registerAcpCommand}from"#cli/acp/command.js";import{waitForServerOrStop,waitForUiOrServer}from"#cli/dev/wait-for-ui.js";import{registerRuntimeInvokeCommand}from"#cli/invoke/command.js";import{parseContextSizeOption,parseDisplayMode,parseLogsMode,parsePortOption,parseReasoningOption,parseStatsMode}from"#cli/option-parsers.js";import{resolveTuiTitle}from"#cli/dev/tui/target.js";import{resumeDevelopmentRuntimeArtifacts,suspendDevelopmentRuntimeArtifacts}from"#services/dev-client/runtime-artifacts.js";const devBootLog=createLogger(`dev.boot`);function createDevBootProgressReporter(e){return t=>{switch(t.type){case`phase-started`:e?.update(`Building your agent`,t.phase),devBootLog.debug(t.phase);return;case`phase-finished`:devBootLog.debug(`${t.phase} finished`,{ms:t.elapsedMs});return;case`before-first-paint`:e?.stop();return;default:return t}}}async function loadPrintApplicationInfo(){return(await import(`#cli/commands/info.js`)).printApplicationInfo}async function loadRunDevelopmentTui(){return(await import(`#cli/dev/tui/tui.js`)).runDevelopmentTui}async function loadRunEvalCommand(){return(await import(`#evals/cli/eval.js`)).runEvalCommand}async function loadStartHost(){return(await import(`#cli/dev/local-server-process.js`)).createDevelopmentServer}const loadIsActiveDevelopmentServerForApp=async()=>(await import(`#internal/nitro/host.js`)).isActiveDevelopmentServerForApp;async function loadStartProductionHost(){return(await import(`#internal/nitro/host.js`)).startProductionServer}function hasInteractiveTerminal(){return!!(process.stdin.isTTY&&process.stdout.isTTY)}function createCliProgram(e,n,p){let
|
|
1
|
+
import{createLogger}from"#internal/logging.js";import{Command,CommanderError,InvalidArgumentError}from"#compiled/commander/index.js";import{applicationCommand}from"#cli/application-command.js";import{parseDevelopmentHeaderOption,resolveDevelopmentUrlTarget}from"#cli/dev/url-target.js";import{parseDevelopmentServerUrl}from"#cli/dev/url.js";import{FORCED_EXIT_BACKSTOP_MS,installShutdownSignal,waitForShutdownSignal}from"#cli/shutdown.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{createCliTheme,renderCliTaggedLine}from"#cli/ui/output.js";import{isCodingAgentLaunch}from"#cli/agent-detection.js";import{eveCliBanner}from"#cli/banner.js";import{startCliLiveRow}from"#cli/ui/live-row.js";import{devBootPhase}from"#internal/dev-boot-progress.js";import{registerBuildCommand}from"#cli/commands/build.js";import{resolveApplicationRoot}from"#internal/application/paths.js";import{findCliApplicationRoot,resolveCliApplicationProject}from"#cli/application-root.js";import{registerIntegrationCommands}from"#cli/commands/register-integration-commands.js";import{registerProjectCommands}from"#cli/commands/register-project-commands.js";import{registerRegistryCommands}from"#cli/commands/register-registry-commands.js";import{resolveDevUiMode,resolveTuiDisplayOptions}from"#cli/dev/ui-options.js";import{registerAcpCommand}from"#cli/acp/command.js";import{waitForServerOrStop,waitForUiOrServer}from"#cli/dev/wait-for-ui.js";import{registerRuntimeInvokeCommand}from"#cli/invoke/command.js";import{parseContextSizeOption,parseDisplayMode,parseLogsMode,parsePortOption,parseReasoningOption,parseStatsMode}from"#cli/option-parsers.js";import{resolveTuiTitle}from"#cli/dev/tui/target.js";import{resumeDevelopmentRuntimeArtifacts,suspendDevelopmentRuntimeArtifacts}from"#services/dev-client/runtime-artifacts.js";const devBootLog=createLogger(`dev.boot`);function createDevBootProgressReporter(e){return t=>{switch(t.type){case`phase-started`:e?.update(`Building your agent`,t.phase),devBootLog.debug(t.phase);return;case`phase-finished`:devBootLog.debug(`${t.phase} finished`,{ms:t.elapsedMs});return;case`before-first-paint`:e?.stop();return;default:return t}}}async function loadPrintApplicationInfo(){return(await import(`#cli/commands/info.js`)).printApplicationInfo}async function loadRunDevelopmentTui(){return(await import(`#cli/dev/tui/tui.js`)).runDevelopmentTui}async function loadRunEvalCommand(){return(await import(`#evals/cli/eval.js`)).runEvalCommand}async function loadStartHost(){return(await import(`#cli/dev/local-server-process.js`)).createDevelopmentServer}const loadIsActiveDevelopmentServerForApp=async()=>(await import(`#internal/nitro/host.js`)).isActiveDevelopmentServerForApp;async function loadStartProductionHost(){return(await import(`#internal/nitro/host.js`)).startProductionServer}function hasInteractiveTerminal(){return!!(process.stdin.isTTY&&process.stdout.isTTY)}function createCliProgram(e,n,p){let h=resolveInstalledPackageInfo().version,g=new Command,_=createCliTheme();g.name(`eve`).description(`Build and run an eve application.`).version(h).showHelpAfterError().exitOverride().hook(`preAction`,(t,n)=>{let{json:r}=n.opts();[`info`,`init`].includes(n.name())&&!r&&e.log(eveCliBanner())}).configureOutput({writeErr:t=>{e.error(t.trimEnd())},writeOut:t=>{e.log(t.trimEnd())}}),applicationCommand(g.command(`channels`).description(`Manage user-authored channels in the current project.`).command(`list`),p).description(`List user-authored channels in the current project.`).option(`--json`,`Output as JSON`).action(async t=>{let{runChannelsListCommand:n}=await import(`#cli/commands/channels.js`);await n(e,p.project,t)}),registerIntegrationCommands({program:g,logger:e,applicationContext:p});let b=g.command(`extension`).description(`Create and build reusable eve extension packages.`);b.command(`init [target]`).description(`Create a new eve extension package.`).option(`-y, --yes`,`Accepted for compatibility; has no effect`).action(async(t,n)=>{n.yes&&e.error(`warning: --yes has no effect for eve extension init.`);let{runExtensionInitCommand:r}=await import(`#cli/commands/extension-init.js`);await r(e,p.root,t)}),b.command(`build`).description(`Build the current package as an eve extension.`).action(async()=>{let{loadDevelopmentEnvironmentFiles:t}=await import(`#cli/dev/environment.js`);t(p.root);let{runExtensionBuildCommand:n}=await import(`#cli/commands/extension-build.js`);await n(e,p.root)}),registerRegistryCommands({program:g,logger:e,applicationContext:p}),g.command(`init [target]`).description(`Create a new eve agent, or add one to an existing project directory.`).option(`--channel-web-nextjs`,`Add the Web Chat application (Next.js)`).option(`--model <model>`,`Set the agent model (provider/model-id)`).option(`--reasoning <effort>`,`Set reasoning (provider-default|none|minimal|low|medium|high|xhigh)`,parseReasoningOption).option(`-y, --yes`,`Accepted for compatibility; has no effect`).action(async(t,n)=>{n.yes&&e.error(`warning: --yes has no effect for eve init.`);let{runInitCommand:r}=await import(`#cli/commands/init.js`);await r(e,p.root,t,{channelWebNextjs:n.channelWebNextjs,model:n.model,reasoning:n.reasoning})}),applicationCommand(g.command(`set`),p).description(`Change root agent model settings.`).option(`--model <model>`,`Set the agent model (provider/model-id)`).option(`--reasoning <effort>`,`Set reasoning (provider-default|none|minimal|low|medium|high|xhigh)`,parseReasoningOption).action(async t=>{let{runSetCommand:n}=await import(`#cli/commands/set.js`);await n(e,p.root,t)}),registerProjectCommands({program:g,logger:e,applicationContext:p}),registerBuildCommand({applicationContext:p,buildHost:n.buildHost,logger:e,program:g}),applicationCommand(g.command(`start`),p).description(`Start a built eve application.`).option(`--host <host>`,`Host interface to bind`).option(`--port <port>`,`Port to listen on (defaults to $PORT, then 3000)`,parsePortOption).action(async t=>{let{loadDevelopmentEnvironmentFiles:r}=await import(`#cli/dev/environment.js`);r(p.root);let i=await(n.startProductionHost??await loadStartProductionHost())(p.root,{host:t.host,port:t.port});e.log(renderCliTaggedLine(_,{message:`server listening at ${i.url}`,tag:`start`,tone:`success`})),await waitForShutdownSignal({close:()=>i.close(),wait:()=>i.wait()})}),registerRuntimeInvokeCommand({applicationContext:p,logger:e,program:g,runtime:n}),registerAcpCommand({applicationContext:p,eveVersion:h,program:g,resolveVerifiedRemoteDevelopmentClient:n.resolveVerifiedRemoteDevelopmentClient,runAcpServer:n.runAcpServer,startHost:n.startHost}),applicationCommand(g.command(`dev`),p,e=>resolveDevelopmentUrlTarget(e.opts(),e.processedArgs[0])===void 0).description(`Start the eve development server or connect to an existing URL.`).argument(`[url]`,`Connect to an existing server URL`,parseDevelopmentServerUrl).option(`--host <host>`,`Host interface to bind`).option(`--port <port>`,`Port to listen on (defaults to $PORT, then 2000)`,parsePortOption).option(`-u, --url <url>`,`Connect to an existing server URL`,parseDevelopmentServerUrl).option(`-H, --header <header>`,`Request header for a URL target, in "Name: value" form (repeatable)`,parseDevelopmentHeaderOption).option(`--no-ui`,`Start the server without an interactive UI`).option(`--name <name>`,`Title shown in the terminal UI (defaults to the app folder name)`).option(`--input <text>`,`Pre-fill the prompt input, or start onboarding with /model`).option(`--tools <mode>`,`How tool calls render: full | collapsed | auto-collapsed | hidden`,parseDisplayMode).option(`--reasoning <mode>`,`How reasoning renders: full | collapsed | auto-collapsed | hidden`,parseDisplayMode).option(`--subagents <mode>`,`How subagent sections render: full | collapsed | auto-collapsed | hidden`,parseDisplayMode).option(`--connection-auth <mode>`,`How connection authorization renders: full | collapsed | auto-collapsed | hidden`,parseDisplayMode).option(`--assistant-response-stats <mode>`,`Assistant header statistic: tokens | tokensPerSecond`,parseStatsMode).option(`--context-size <tokens>`,`Model context window size, shown as a usage percentage`,parseContextSizeOption).option(`--logs <mode>`,`Which server/agent logs to show: all | stderr | sandbox | none`,parseLogsMode).addHelpText(`after`,`
|
|
2
2
|
You can also pass a bare URL, for example: eve dev https://example.com
|
|
3
|
-
`).action(async(t,i)=>{let a=resolveDevelopmentUrlTarget(i,t),s=a?.serverUrl,u=hasInteractiveTerminal(),d=resolveDevUiMode({options:i,interactive:u});if(i.input!==void 0&&d===`headless`)throw new InvalidArgumentError(`--input requires the interactive UI.`);let f=!1;s!==void 0&&(f=await(n.isActiveDevelopmentServerForApp??await loadIsActiveDevelopmentServerForApp())({appRoot:p.root,serverUrl:s}));let runInteractiveUi=async(e,t,r)=>{let o=await devBootPhase(`loading interactive UI`,async()=>n.runDevelopmentTui??await loadRunDevelopmentTui(),t),c=resolveTuiDisplayOptions(i),l=s===void 0||f?{kind:`local`,serverUrl:e.serverUrl,workspaceRoot:e.appRoot??p.root}:{kind:`remote`,serverUrl:e.serverUrl,workspaceRoot:p.root},u=resolveTuiTitle({name:i.name,target:l});u!==void 0&&(c.name=u);let d={target:l,initialInput:i.input,onBootProgress:t,lifecycle:r,...c};l.kind===`local`&&(d.withExclusiveTerminal=async t=>await(async()=>{if(!await suspendDevelopmentRuntimeArtifacts({serverUrl:e.serverUrl}))throw Error(`Could not pause the development server for integration setup.`);try{return await t()}finally{await resumeDevelopmentRuntimeArtifacts({serverUrl:e.serverUrl,silent:!0})}})()),a?.headers===void 0?await o(d):await o({...d,headers:a.headers})};if(s){let{loadDevelopmentEnvironmentFiles:t}=await import(`#cli/dev/environment.js`);if(t(p.root),e.log(`↗ ${f?`local`:`remote`} mode targeting ${
|
|
4
|
-
eve traces ls [options]`).description("Show a local `eve dev` trace (the most recent when trace is omitted).").option(`--verbose`,`Expand every span with all attributes and events`).option(`--json`,`Output as JSON`).action(async(t,n)=>{let{runTraceShowCommand:r}=await import(`#cli/commands/trace.js`);await r(e,p.root,t,n)}).command(`ls`).description(`List local traces, most recent first.`).option(`--json`,`Output as JSON`).action(async t=>{let{runTraceListCommand:n}=await import(`#cli/commands/trace.js`);await n(e,p.root,t)}),applicationCommand(
|
|
3
|
+
`).action(async(t,i)=>{let a=resolveDevelopmentUrlTarget(i,t),s=a?.serverUrl,u=hasInteractiveTerminal(),d=resolveDevUiMode({options:i,interactive:u});if(d===`headless`&&e.log(eveCliBanner()),i.input!==void 0&&d===`headless`)throw new InvalidArgumentError(`--input requires the interactive UI.`);let f=!1;s!==void 0&&(f=await(n.isActiveDevelopmentServerForApp??await loadIsActiveDevelopmentServerForApp())({appRoot:p.root,serverUrl:s}));let runInteractiveUi=async(e,t,r)=>{let o=await devBootPhase(`loading interactive UI`,async()=>n.runDevelopmentTui??await loadRunDevelopmentTui(),t),c=resolveTuiDisplayOptions(i),l=s===void 0||f?{kind:`local`,serverUrl:e.serverUrl,workspaceRoot:e.appRoot??p.root}:{kind:`remote`,serverUrl:e.serverUrl,workspaceRoot:p.root},u=resolveTuiTitle({name:i.name,target:l});u!==void 0&&(c.name=u);let d={target:l,initialInput:i.input,onBootProgress:t,lifecycle:r,...c};l.kind===`local`&&(d.withExclusiveTerminal=async t=>await(async()=>{if(!await suspendDevelopmentRuntimeArtifacts({serverUrl:e.serverUrl}))throw Error(`Could not pause the development server for integration setup.`);try{return await t()}finally{await resumeDevelopmentRuntimeArtifacts({serverUrl:e.serverUrl,silent:!0})}})()),a?.headers===void 0?await o(d):await o({...d,headers:a.headers})};if(s){let{loadDevelopmentEnvironmentFiles:t}=await import(`#cli/dev/environment.js`);if(t(p.root),e.log(`↗ ${f?`local`:`remote`} mode targeting ${_.info(new URL(s).host)}`),d===`headless`){e.log(renderCliTaggedLine(_,{message:`Interactive UI disabled because the current terminal is not a TTY.`,tag:`dev`,tone:`warning`}));return}e.log(``);let n=installShutdownSignal({exitAfterMs:FORCED_EXIT_BACKSTOP_MS});try{await runInteractiveUi({serverUrl:s},void 0,n)}finally{n.dispose()}return}let m=d===`tui`?startCliLiveRow(e):void 0,h=createDevBootProgressReporter(m);m?.update(`Building your agent`);let g,v,closeServer=()=>g===void 0?Promise.resolve():(v??=g.close(),v.catch(()=>void 0),v),y=installShutdownSignal({exitAfterMs:FORCED_EXIT_BACKSTOP_MS,onStop:()=>{closeServer()}});try{g=(n.startHost??await loadStartHost())(p.root,{existing:d===`tui`?`attach-if-unconfigured`:`reject`,host:i.host,onBootProgress:h,port:i.port});let t=(await Promise.race([g.start().then(e=>({handle:e})),y.stopped.then(()=>({handle:void 0}))])).handle;if(t===void 0)return;if(d!==`tui`&&e.log(renderCliTaggedLine(_,{message:`server listening at ${t.url}`,tag:`dev`,tone:`success`})),d===`headless`){i.ui!==!1&&!u&&e.log(renderCliTaggedLine(_,{message:`Interactive UI disabled because the current terminal is not a TTY.`,tag:`dev`,tone:`warning`})),await waitForServerOrStop(g,y);return}await waitForUiOrServer({handle:t,lifecycle:y,server:g,runUi:async()=>await runInteractiveUi({appRoot:t.appRoot,serverUrl:t.url},h,y)})}finally{m?.stop(),await closeServer(),y.dispose()}});let x=g.command(`logs`).description("Inspect local `eve dev` diagnostic logs (.eve/logs).");return applicationCommand(x.command(`show [logid]`,{isDefault:!0}),p).description(`Print a diagnostic log (the most recent when logid is omitted).`).option(`--dump`,`Prepend the log's environment dump (.dump sibling)`).option(`--events`,`Interleave session events from the local workflow store`).action(async(t,n)=>{let{runLogsShowCommand:r}=await import(`#cli/commands/logs.js`);await r(e,p.root,t,n)}),applicationCommand(x.command(`ls`),p).description(`List diagnostic logs, most recent first.`).option(`--json`,`Output as JSON`).action(async t=>{let{runLogsListCommand:n}=await import(`#cli/commands/logs.js`);await n(e,p.root,t)}),applicationCommand(g.command(`traces [trace]`),p).usage(`[options] [trace]
|
|
4
|
+
eve traces ls [options]`).description("Show a local `eve dev` trace (the most recent when trace is omitted).").option(`--verbose`,`Expand every span with all attributes and events`).option(`--json`,`Output as JSON`).action(async(t,n)=>{let{runTraceShowCommand:r}=await import(`#cli/commands/trace.js`);await r(e,p.root,t,n)}).command(`ls`).description(`List local traces, most recent first.`).option(`--json`,`Output as JSON`).action(async t=>{let{runTraceListCommand:n}=await import(`#cli/commands/trace.js`);await n(e,p.root,t)}),applicationCommand(g.command(`info`),p).description(`Print resolved application information.`).option(`--json`,`Output as JSON`).action(async t=>{await(n.printApplicationInfo??await loadPrintApplicationInfo())(e,p.root,t)}),applicationCommand(g.command(`eval`),p).description(`Run evals against an eve agent.`).argument(`[evalIds...]`,`Eval ids (or directory prefixes) to run (all discovered evals when omitted)`).option(`--url <url>`,`Remote agent URL (skip local host startup)`,parseDevelopmentServerUrl).option(`--tag <tag...>`,`Run only evals carrying a tag`).option(`--exclude-tag <tag...>`,`Skip evals carrying a tag`).option(`--strict`,`Fail the exit code when any score falls below its threshold`).option(`--list`,`Print discovered evals without running them`).option(`--timeout <ms>`,`Per-eval timeout in milliseconds`).option(`--max-concurrency <n>`,`Max concurrent eval executions`).option(`--json`,`Output results as JSON`).option(`--junit <path>`,`Write JUnit XML results to a file`).option(`--skip-report`,`Skip eval-defined reporters (e.g. Braintrust)`).option(`--verbose`,`Stream per-eval t.log lines to stdout`).action(async(t,r)=>{await(n.runEvalCommand??await loadRunEvalCommand())(t,r,e,p.root)}),g}async function runCli(e=process.argv.slice(2),t=console,r={}){let i={root:resolveApplicationRoot(),async resolve(){let e=await(r.resolveApplicationProject??resolveCliApplicationProject)(i.root);i.project=e,i.root=e.appRoot}},a=createCliProgram(t,r,i),o=e;if(o.length===0){let e=await(r.findApplicationRoot??findCliApplicationRoot)(i.root);e===void 0?o=[`init`]:(i.root=e,o=[`dev`])}try{await a.parseAsync(o,{from:`user`})}catch(e){if(e instanceof CommanderError){if(e.exitCode===0)return;let n=await(r.isCodingAgentLaunch??isCodingAgentLaunch)();if(o[0]===`init`&&n){let{initAgentInstructions:e}=await import(`#cli/commands/agent-instructions.js`);t.log(e())}throw Error(e.message)}throw e}}export{resolveDevUiMode,resolveTuiDisplayOptions,runCli};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { CompiledChannelDefinition, CompiledChannelRoutePlan } from "#compiler/manifest.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { AgentModuleBinding, AgentSourceDescriptor } from "#compiler/source-graph.js";
|
|
3
3
|
import { type CompilerDiagnostic } from "#compiler/diagnostics.js";
|
|
4
4
|
export declare function createCompiledChannelRoutePlan(input: {
|
|
5
|
-
readonly bindings: Readonly<Record<string,
|
|
5
|
+
readonly bindings: Readonly<Record<string, AgentModuleBinding>>;
|
|
6
6
|
readonly channels: readonly CompiledChannelDefinition[];
|
|
7
7
|
readonly diagnostics?: CompilerDiagnostic[];
|
|
8
8
|
readonly nodeId: string;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CompiledAgentDefinition } from "#compiler/manifest.js";
|
|
2
|
+
import type { FinalizedNodeSourceState } from "#compiler/node-source-state.js";
|
|
3
|
+
export declare function assertInstrumentationLayoutConfig(config: CompiledAgentDefinition, state: FinalizedNodeSourceState): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function assertInstrumentationLayoutConfig(e,t){if(e.experimental?.instrumentationProviders===!0&&t.composed.selected.has(`instrumentation`))throw Error(`A selected instrumentation.ts source cannot be used with experimental.instrumentationProviders. Move the declaration into the instrumentation/ provider directory.`)}export{assertInstrumentationLayoutConfig};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type AgentModuleBinding, type AgentSourceRegistry, type ProgrammaticModuleNamespace } from "#compiler/source-graph.js";
|
|
2
2
|
export type CompiledBindingNamespaceLoader = (sourceId: string) => Promise<ProgrammaticModuleNamespace>;
|
|
3
3
|
/** Loads one node's selected bindings with dependency ordering and per-phase caching. */
|
|
4
4
|
export declare function createCompiledBindingNamespaceLoader(input: {
|
|
5
|
-
readonly bindings
|
|
5
|
+
readonly bindings?: Readonly<Record<string, AgentModuleBinding>>;
|
|
6
|
+
readonly onLoad?: (sourceId: string) => void;
|
|
6
7
|
readonly registries: readonly AgentSourceRegistry[];
|
|
8
|
+
readonly resolveBinding?: (sourceId: string) => AgentModuleBinding | undefined;
|
|
7
9
|
}): CompiledBindingNamespaceLoader;
|
|
8
10
|
/** Derives the stable package-owned scope used while loading an extension module. */
|
|
9
|
-
export declare function resolveCompiledModuleExtensionScopeNamespace(binding:
|
|
11
|
+
export declare function resolveCompiledModuleExtensionScopeNamespace(binding: AgentModuleBinding): string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{loadProgrammaticModuleNamespace,memoizeModuleNamespaceFactories}from"#compiler/source-graph.js";import{packageStateNamespace}from"#discover/extensions.js";import{loadAuthoredModuleNamespace}from"#internal/authored-module-loader.js";function createCompiledBindingNamespaceLoader(e){let n=new Map,load=(r,i=new Set)=>{if(i.has(r))throw Error(`Compiled binding dependency cycle includes "${r}".`);let a=n.get(r);if(a!==void 0)return a;let o=e.bindings[r];if(o===void 0)throw Error(`Compiled binding dependency "${r}" is missing.`);let s=new Set(i).add(r),c=loadCompiledBindingNamespace({binding:o,loadDependency:e=>load(e,s),registries:e.registries}).then(memoizeModuleNamespaceFactories);return n.set(r,c),c};return load}async function loadCompiledBindingNamespace(t){if(t.binding.backing.kind===`filesystem`)return await loadAuthoredModuleNamespace(t.binding.backing.sourcePath,{externalDependencies:t.binding.backing.externalDependencies,extensionScopeNamespace:resolveCompiledModuleExtensionScopeNamespace(t.binding)});let n=Object.fromEntries(await Promise.all(Object.entries(t.binding.backing.dependencies??{}).map(async([e,n])=>[e,await t.loadDependency(n)])));return await loadProgrammaticModuleNamespace({backing:t.binding.backing,dependencyNamespaces:n,registries:t.registries})}function resolveCompiledModuleExtensionScopeNamespace(e){return e.owner.kind===`extension`?packageStateNamespace(e.owner.packageName):void 0}export{createCompiledBindingNamespaceLoader,resolveCompiledModuleExtensionScopeNamespace};
|
|
1
|
+
import{loadProgrammaticModuleNamespace,memoizeModuleNamespaceFactories}from"#compiler/source-graph.js";import{packageStateNamespace}from"#discover/extensions.js";import{loadAuthoredModuleNamespace}from"#internal/authored-module-loader.js";function createCompiledBindingNamespaceLoader(e){if(e.bindings===void 0&&e.resolveBinding===void 0)throw Error(`Compiled binding namespace loader requires a binding source.`);let n=new Map,load=(r,i=new Set)=>{if(i.has(r))throw Error(`Compiled binding dependency cycle includes "${r}".`);let a=n.get(r);if(a!==void 0)return a;let o=e.resolveBinding?.(r)??e.bindings?.[r];if(o===void 0)throw Error(`Compiled binding dependency "${r}" is missing.`);e.onLoad?.(r);let s=new Set(i).add(r),c=loadCompiledBindingNamespace({binding:o,loadDependency:e=>load(e,s),registries:e.registries}).then(memoizeModuleNamespaceFactories);return n.set(r,c),c};return load}async function loadCompiledBindingNamespace(t){if(t.binding.backing.kind===`filesystem`)return await loadAuthoredModuleNamespace(t.binding.backing.sourcePath,{externalDependencies:t.binding.backing.externalDependencies,extensionScopeNamespace:resolveCompiledModuleExtensionScopeNamespace(t.binding)});let n=Object.fromEntries(await Promise.all(Object.entries(t.binding.backing.dependencies??{}).map(async([e,n])=>[e,await t.loadDependency(n)])));return await loadProgrammaticModuleNamespace({backing:t.binding.backing,dependencyNamespaces:n,registries:t.registries})}function resolveCompiledModuleExtensionScopeNamespace(e){return e.owner.kind===`extension`?packageStateNamespace(e.owner.packageName):void 0}export{createCompiledBindingNamespaceLoader,resolveCompiledModuleExtensionScopeNamespace};
|
|
@@ -22,7 +22,7 @@ export declare const ROOT_COMPILED_AGENT_NODE_ID = "__root__";
|
|
|
22
22
|
/**
|
|
23
23
|
* Current compiled manifest schema version.
|
|
24
24
|
*/
|
|
25
|
-
export declare const COMPILED_AGENT_MANIFEST_VERSION =
|
|
25
|
+
export declare const COMPILED_AGENT_MANIFEST_VERSION = 44;
|
|
26
26
|
/**
|
|
27
27
|
* Compiled channel entry preserved in the compiled manifest.
|
|
28
28
|
*/
|
|
@@ -719,7 +719,7 @@ export declare const compiledAgentManifestSchema: z.ZodObject<{
|
|
|
719
719
|
sourceId: z.ZodString;
|
|
720
720
|
sourceKind: z.ZodLiteral<"module">;
|
|
721
721
|
}, z.core.$strict>>;
|
|
722
|
-
version: z.ZodLiteral<
|
|
722
|
+
version: z.ZodLiteral<44>;
|
|
723
723
|
workspaceResourceRoot: z.ZodObject<{
|
|
724
724
|
contentHash: z.ZodOptional<z.ZodString>;
|
|
725
725
|
logicalPath: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from"#compiled/zod/index.js";import{discoverDiagnosticsSummarySchema}from"#discover/diagnostics.js";import{compiledRemoteAgentNodeSchema}from"#compiler/remote-agent-node.js";import{jsonObjectSchema}from"#shared/json-schemas.js";import{validateCompiledAgentManifest,validateCompiledAgentResources}from"#compiler/validate-artifact.js";const COMPILED_AGENT_MANIFEST_KIND=`eve-agent-compiled-manifest`,ROOT_COMPILED_AGENT_NODE_ID=`__root__`,COMPILED_AGENT_MANIFEST_VERSION=43,agentSourceOwnerSchema=z.discriminatedUnion(`kind`,[z.object({kind:z.literal(`application`)}).strict(),z.object({feature:z.string().min(1),kind:z.literal(`framework`)}).strict(),z.object({kind:z.literal(`extension`),namespace:z.string().min(1),packageName:z.string().min(1)}).strict()]),moduleSourceRefSchema=z.object({exportName:z.string().optional(),sourceKind:z.literal(`module`),logicalPath:z.string(),sourceId:z.string()}).strict(),filesystemModuleBackingSchema=z.object({externalDependencies:z.array(z.string()).readonly(),extensionScope:z.object({namespace:z.string(),sourceRoot:z.string()}).strict().optional(),kind:z.literal(`filesystem`),sourcePath:z.string()}).strict(),programmaticModuleBackingSchema=z.object({dependencies:z.record(z.string(),z.string()).readonly().optional(),kind:z.literal(`programmatic`),moduleId:z.string(),parameters:jsonObjectSchema.optional(),registryId:z.string(),revision:z.string(),semanticRevision:z.string().optional()}).strict(),resourceSourceBackingSchema=z.object({kind:z.literal(`resource`),sourcePath:z.string()}).strict(),agentModuleBackingSchema=z.discriminatedUnion(`kind`,[filesystemModuleBackingSchema,programmaticModuleBackingSchema]),compiledModuleBindingSchema=z.object({backing:agentModuleBackingSchema,logicalPath:z.string(),owner:agentSourceOwnerSchema}).strict(),agentSourceDescriptorSchema=z.object({backing:z.discriminatedUnion(`kind`,[filesystemModuleBackingSchema,programmaticModuleBackingSchema,resourceSourceBackingSchema]),form:z.enum([`derived`,`direct`]),layer:z.enum([`framework-default`,`extension-package`,`extension-override`,`application`]),logicalPath:z.string(),owner:agentSourceOwnerSchema,sourceId:z.string()}).strict(),agentSourceCompositionSchema=z.object({entries:z.array(z.discriminatedUnion(`kind`,[z.object({kind:z.literal(`shadowed`),source:agentSourceDescriptorSchema,winnerSourceId:z.string()}).strict(),z.object({kind:z.literal(`disabled`),source:agentSourceDescriptorSchema}).strict()])).readonly()}).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(`HEAD`),z.literal(`POST`),z.literal(`PUT`),z.literal(`PATCH`),z.literal(`DELETE`),z.literal(`OPTIONS`),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(),compiledChannelPreflightDefinitionSchema=z.object({cors:compiledChannelCorsSchema,method:z.literal(`OPTIONS`),sourceIds:z.array(z.string()).readonly(),urlPath:z.string()}).strict(),compiledShadowedChannelRouteSchema=z.object({method:channelMethodSchema,source:agentSourceDescriptorSchema,urlPath:z.string(),winnerSourceId:z.string()}).strict(),compiledChannelRoutePlanSchema=z.object({effective:z.array(compiledChannelDefinitionSchema).readonly(),preflight:z.array(compiledChannelPreflightDefinitionSchema).readonly(),shadowed:z.array(compiledShadowedChannelRouteSchema).readonly()}).strict(),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({exportName:z.string().optional(),logicalPath:z.string(),maxSubagents:z.number().int().positive().optional(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledAgentConfigBaseFields={build:compiledAgentBuildDefinitionSchema.optional(),compaction:compiledAgentCompactionDefinitionSchema.optional(),description:z.string().optional(),experimental:z.object({instrumentationProviders:z.boolean().optional(),tasks: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,limits:compiledAgentLimitsDefinitionSchema.optional()},compiledAgentConfigSchema=z.union([z.object({...compiledAgentConfigBaseFields,model:compiledRuntimeModelReferenceSchema}).strict(),z.object({...compiledAgentConfigBaseFields,dynamicModel:compiledDynamicModelDefinitionSchema}).strict()]),compiledInstructionsBaseFields={content:z.string(),name:z.string(),logicalPath:z.string(),role:z.enum([`system`,`user`]),sourceId:z.string()},compiledInstructionsSchema=z.discriminatedUnion(`sourceKind`,[z.object({...compiledInstructionsBaseFields,owner:agentSourceOwnerSchema,sourceKind:z.literal(`markdown`)}).strict(),z.object({...compiledInstructionsBaseFields,sourceKind: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,owner:agentSourceOwnerSchema,sourceKind:z.literal(`markdown`)}).strict(),z.object({...compiledSkillBaseFields,sourceKind:z.literal(`module`),exportName:z.string().optional()}).strict(),z.object({...compiledSkillBaseFields,owner:agentSourceOwnerSchema,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()]),compiledScheduleBaseFields={cron:z.string(),hasRun:z.boolean(),name:z.string(),logicalPath:z.string(),markdown:z.string().optional(),sourceId:z.string()},compiledScheduleDefinitionSchema=z.discriminatedUnion(`sourceKind`,[z.object({...compiledScheduleBaseFields,owner:agentSourceOwnerSchema,sourceKind:z.literal(`markdown`)}).strict(),z.object({...compiledScheduleBaseFields,sourceKind:z.literal(`module`)}).strict()]),compiledSandboxDefinitionSchema=z.object({backendName:z.string().optional(),description:z.string().optional(),inheritsParent:z.boolean().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(),execution:z.literal(`background`).optional(),exportName:z.string().optional(),hasExecute:z.boolean(),hasModelOutputProjection:z.boolean(),inputSchema:jsonObjectSchema.nullable(),logicalPath:z.string(),name:z.string(),outputSchema:jsonObjectSchema.optional(),requiresApproval:z.boolean(),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(),rebindMissingCallbacks:z.boolean().optional(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledMemoryDefinitionSchema=z.object({description:z.string().optional(),exportName:z.string().optional(),logicalPath:z.string(),slot:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`),visibility:z.enum([`scope`,`session`])}).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({eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),logicalPath:z.string(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledExtensionMountSchema=z.object({externalDependencies:z.array(z.string()).readonly(),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(),bindings:z.record(z.string(),compiledModuleBindingSchema),channelRoutes:compiledChannelRoutePlanSchema,connections:z.array(compiledConnectionDefinitionSchema),diagnosticsSummary:discoverDiagnosticsSummarySchema,sourceComposition:agentSourceCompositionSchema,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),memories:z.array(compiledMemoryDefinitionSchema).default([]),sandbox:compiledSandboxDefinitionSchema,sandboxWorkspaces:z.array(compiledSandboxWorkspaceSchema),schedules:z.array(compiledScheduleDefinitionSchema),remoteAgents:z.array(compiledRemoteAgentNodeSchema),skills:z.array(compiledSkillSourceSchema).readonly(),instructions:z.array(compiledInstructionsSchema).readonly().default([]),instrumentation:moduleSourceRefSchema.optional(),tools:z.array(compiledToolDefinitionSchema),workspaceResourceRoot:compiledWorkspaceResourceRootSchema},compiledAgentResourcesSchema=z.object(compiledAgentResourceFields).strict(),compiledAgentNodeManifestSchema=z.object({...compiledAgentResourceFields,config:compiledAgentConfigSchema}).strict(),compiledSubagentNodeBaseFields={backing:resourceSourceBackingSchema,entryPath:z.string(),logicalPath:z.string(),name:z.string(),nodeId:z.string(),owner:agentSourceOwnerSchema,parentNodeId: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()]),compiledAgentManifestSchema=z.object({agentRoot:z.string(),appRoot:z.string(),bindings:z.record(z.string(),compiledModuleBindingSchema),extensionMounts:z.array(compiledExtensionMountSchema).default([]),channelRoutes:compiledChannelRoutePlanSchema,config:compiledAgentConfigSchema,connections:z.array(compiledConnectionDefinitionSchema),diagnosticsSummary:discoverDiagnosticsSummarySchema,sourceComposition:agentSourceCompositionSchema,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),memories:z.array(compiledMemoryDefinitionSchema).default([]),kind:z.literal(COMPILED_AGENT_MANIFEST_KIND),remoteAgents:z.array(compiledRemoteAgentNodeSchema),sandbox:compiledSandboxDefinitionSchema,sandboxWorkspaces:z.array(compiledSandboxWorkspaceSchema),schedules:z.array(compiledScheduleDefinitionSchema),skills:z.array(compiledSkillSourceSchema).readonly(),subagents:z.array(compiledSubagentNodeSchema),instructions:z.array(compiledInstructionsSchema).readonly().default([]),instrumentation:moduleSourceRefSchema.optional(),tools:z.array(compiledToolDefinitionSchema),version:z.literal(43),workspaceResourceRoot:compiledWorkspaceResourceRootSchema}).strict();function createCompiledAgentResources(e){return{agentRoot:e.agentRoot,appRoot:e.appRoot,bindings:{...e.bindings},channelRoutes:{effective:[...e.channelRoutes.effective],preflight:[...e.channelRoutes.preflight],shadowed:[...e.channelRoutes.shadowed]},connections:[...e.connections??[]],diagnosticsSummary:e.diagnosticsSummary??{errors:0,warnings:0},sourceComposition:{entries:[...e.sourceComposition.entries]},workflowTool:e.workflowTool===void 0?void 0:{...e.workflowTool},webSearchProvider:e.webSearchProvider,dynamicInstructions:[...e.dynamicInstructions??[]],dynamicSkills:[...e.dynamicSkills??[]],dynamicTools:[...e.dynamicTools??[]],extensionMounts:[...e.extensionMounts??[]],hooks:[...e.hooks??[]],memories:[...e.memories??[]],instructions:[...e.instructions??[]],instrumentation:e.instrumentation===void 0?void 0:{...e.instrumentation},remoteAgents:[...e.remoteAgents??[]],sandbox:e.sandbox,sandboxWorkspaces:[...e.sandboxWorkspaces??[]],schedules:[...e.schedules??[]],skills:[...e.skills??[]],tools:[...e.tools??[]],workspaceResourceRoot:e.workspaceResourceRoot??{logicalPath:``,rootEntries:deriveResourceRootEntries({sandboxWorkspaces:e.sandboxWorkspaces,skills:e.skills})}}}function createCompiledAgentNodeManifest(e){let t={...createCompiledAgentResources(e),config:cloneCompiledAgentDefinition(e.config)};return validateCompiledAgentResources(t,{allowUnknownResourceWinners:!0}),t}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:{instrumentationProviders:e.experimental.instrumentationProviders,tasks:e.experimental.tasks,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}};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){let t={...createCompiledAgentNodeManifest(e),kind:COMPILED_AGENT_MANIFEST_KIND,extensionMounts:[...e.extensionMounts??[]],subagents:[...e.subagents??[]],version:43};return validateCompiledAgentManifest(t),t}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
|
+
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";import{validateCompiledAgentManifest,validateCompiledAgentResources}from"#compiler/validate-artifact.js";const COMPILED_AGENT_MANIFEST_KIND=`eve-agent-compiled-manifest`,ROOT_COMPILED_AGENT_NODE_ID=`__root__`,COMPILED_AGENT_MANIFEST_VERSION=44,agentSourceOwnerSchema=z.discriminatedUnion(`kind`,[z.object({kind:z.literal(`application`)}).strict(),z.object({feature:z.string().min(1),kind:z.literal(`framework`)}).strict(),z.object({kind:z.literal(`extension`),namespace:z.string().min(1),packageName:z.string().min(1)}).strict()]),moduleSourceRefSchema=z.object({exportName:z.string().optional(),sourceKind:z.literal(`module`),logicalPath:z.string(),sourceId:z.string()}).strict(),filesystemModuleBackingSchema=z.object({externalDependencies:z.array(z.string()).readonly(),extensionScope:z.object({namespace:z.string(),sourceRoot:z.string()}).strict().optional(),kind:z.literal(`filesystem`),sourcePath:z.string()}).strict(),programmaticModuleBackingSchema=z.object({dependencies:z.record(z.string(),z.string()).readonly().optional(),kind:z.literal(`programmatic`),moduleId:z.string(),parameters:jsonObjectSchema.optional(),registryId:z.string(),revision:z.string(),semanticRevision:z.string().optional()}).strict(),resourceSourceBackingSchema=z.object({kind:z.literal(`resource`),sourcePath:z.string()}).strict(),agentModuleBackingSchema=z.discriminatedUnion(`kind`,[filesystemModuleBackingSchema,programmaticModuleBackingSchema]),compiledModuleBindingSchema=z.object({backing:agentModuleBackingSchema,logicalPath:z.string(),owner:agentSourceOwnerSchema,usage:z.object({compile:z.boolean(),runtimeEntry:z.boolean()}).strict()}).strict(),agentSourceDescriptorSchema=z.object({backing:z.discriminatedUnion(`kind`,[filesystemModuleBackingSchema,programmaticModuleBackingSchema,resourceSourceBackingSchema]),form:z.enum([`derived`,`direct`]),layer:z.enum([`framework-default`,`extension-package`,`extension-override`,`application`]),logicalPath:z.string(),owner:agentSourceOwnerSchema,sourceId:z.string()}).strict(),agentSourceCompositionSchema=z.object({entries:z.array(z.discriminatedUnion(`kind`,[z.object({kind:z.literal(`shadowed`),source:agentSourceDescriptorSchema,winnerSourceId:z.string()}).strict(),z.object({kind:z.literal(`disabled`),source:agentSourceDescriptorSchema}).strict()])).readonly()}).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(`HEAD`),z.literal(`POST`),z.literal(`PUT`),z.literal(`PATCH`),z.literal(`DELETE`),z.literal(`OPTIONS`),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(),compiledChannelPreflightDefinitionSchema=z.object({cors:compiledChannelCorsSchema,method:z.literal(`OPTIONS`),sourceIds:z.array(z.string()).readonly(),urlPath:z.string()}).strict(),compiledShadowedChannelRouteSchema=z.object({method:channelMethodSchema,source:agentSourceDescriptorSchema,urlPath:z.string(),winnerSourceId:z.string()}).strict(),compiledChannelRoutePlanSchema=z.object({effective:z.array(compiledChannelDefinitionSchema).readonly(),preflight:z.array(compiledChannelPreflightDefinitionSchema).readonly(),shadowed:z.array(compiledShadowedChannelRouteSchema).readonly()}).strict(),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({exportName:z.string().optional(),logicalPath:z.string(),maxSubagents:z.number().int().positive().optional(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledAgentConfigBaseFields={build:compiledAgentBuildDefinitionSchema.optional(),compaction:compiledAgentCompactionDefinitionSchema.optional(),description:z.string().optional(),experimental:z.object({instrumentationProviders:z.boolean().optional(),tasks: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,limits:compiledAgentLimitsDefinitionSchema.optional()},compiledAgentConfigSchema=z.union([z.object({...compiledAgentConfigBaseFields,model:compiledRuntimeModelReferenceSchema}).strict(),z.object({...compiledAgentConfigBaseFields,dynamicModel:compiledDynamicModelDefinitionSchema}).strict()]),compiledInstructionsBaseFields={content:z.string(),name:z.string(),logicalPath:z.string(),role:z.enum([`system`,`user`]),sourceId:z.string()},compiledInstructionsSchema=z.discriminatedUnion(`sourceKind`,[z.object({...compiledInstructionsBaseFields,owner:agentSourceOwnerSchema,sourceKind:z.literal(`markdown`)}).strict(),z.object({...compiledInstructionsBaseFields,sourceKind: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,owner:agentSourceOwnerSchema,sourceKind:z.literal(`markdown`)}).strict(),z.object({...compiledSkillBaseFields,sourceKind:z.literal(`module`),exportName:z.string().optional()}).strict(),z.object({...compiledSkillBaseFields,owner:agentSourceOwnerSchema,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()]),compiledScheduleBaseFields={cron:z.string(),hasRun:z.boolean(),name:z.string(),logicalPath:z.string(),markdown:z.string().optional(),sourceId:z.string()},compiledScheduleDefinitionSchema=z.discriminatedUnion(`sourceKind`,[z.object({...compiledScheduleBaseFields,owner:agentSourceOwnerSchema,sourceKind:z.literal(`markdown`)}).strict(),z.object({...compiledScheduleBaseFields,sourceKind:z.literal(`module`)}).strict()]),compiledSandboxDefinitionSchema=z.object({backendName:z.string().optional(),description:z.string().optional(),inheritsParent:z.boolean().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(),execution:z.literal(`background`).optional(),exportName:z.string().optional(),hasExecute:z.boolean(),hasModelOutputProjection:z.boolean(),inputSchema:jsonObjectSchema.nullable(),logicalPath:z.string(),name:z.string(),outputSchema:jsonObjectSchema.optional(),requiresApproval:z.boolean(),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(),rebindMissingCallbacks:z.boolean().optional(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledMemoryDefinitionSchema=z.object({description:z.string().optional(),exportName:z.string().optional(),logicalPath:z.string(),slot:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`),visibility:z.enum([`scope`,`session`])}).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({eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),logicalPath:z.string(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledExtensionMountSchema=z.object({externalDependencies:z.array(z.string()).readonly(),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(),bindings:z.record(z.string(),compiledModuleBindingSchema),channelRoutes:compiledChannelRoutePlanSchema,connections:z.array(compiledConnectionDefinitionSchema),diagnosticsSummary:discoverDiagnosticsSummarySchema,sourceComposition:agentSourceCompositionSchema,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),memories:z.array(compiledMemoryDefinitionSchema).default([]),sandbox:compiledSandboxDefinitionSchema,sandboxWorkspaces:z.array(compiledSandboxWorkspaceSchema),schedules:z.array(compiledScheduleDefinitionSchema),remoteAgents:z.array(compiledRemoteAgentNodeSchema),skills:z.array(compiledSkillSourceSchema).readonly(),instructions:z.array(compiledInstructionsSchema).readonly().default([]),instrumentation:moduleSourceRefSchema.optional(),tools:z.array(compiledToolDefinitionSchema),workspaceResourceRoot:compiledWorkspaceResourceRootSchema},compiledAgentResourcesSchema=z.object(compiledAgentResourceFields).strict(),compiledAgentNodeManifestSchema=z.object({...compiledAgentResourceFields,config:compiledAgentConfigSchema}).strict(),compiledSubagentNodeBaseFields={backing:resourceSourceBackingSchema,entryPath:z.string(),logicalPath:z.string(),name:z.string(),nodeId:z.string(),owner:agentSourceOwnerSchema,parentNodeId: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()]),compiledAgentManifestSchema=z.object({agentRoot:z.string(),appRoot:z.string(),bindings:z.record(z.string(),compiledModuleBindingSchema),extensionMounts:z.array(compiledExtensionMountSchema).default([]),channelRoutes:compiledChannelRoutePlanSchema,config:compiledAgentConfigSchema,connections:z.array(compiledConnectionDefinitionSchema),diagnosticsSummary:discoverDiagnosticsSummarySchema,sourceComposition:agentSourceCompositionSchema,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),memories:z.array(compiledMemoryDefinitionSchema).default([]),kind:z.literal(COMPILED_AGENT_MANIFEST_KIND),remoteAgents:z.array(compiledRemoteAgentNodeSchema),sandbox:compiledSandboxDefinitionSchema,sandboxWorkspaces:z.array(compiledSandboxWorkspaceSchema),schedules:z.array(compiledScheduleDefinitionSchema),skills:z.array(compiledSkillSourceSchema).readonly(),subagents:z.array(compiledSubagentNodeSchema),instructions:z.array(compiledInstructionsSchema).readonly().default([]),instrumentation:moduleSourceRefSchema.optional(),tools:z.array(compiledToolDefinitionSchema),version:z.literal(44),workspaceResourceRoot:compiledWorkspaceResourceRootSchema}).strict();function createCompiledAgentResources(e){return{agentRoot:e.agentRoot,appRoot:e.appRoot,bindings:{...e.bindings},channelRoutes:{effective:[...e.channelRoutes.effective],preflight:[...e.channelRoutes.preflight],shadowed:[...e.channelRoutes.shadowed]},connections:[...e.connections??[]],diagnosticsSummary:e.diagnosticsSummary??{errors:0,warnings:0},sourceComposition:{entries:[...e.sourceComposition.entries]},workflowTool:e.workflowTool===void 0?void 0:{...e.workflowTool},webSearchProvider:e.webSearchProvider,dynamicInstructions:[...e.dynamicInstructions??[]],dynamicSkills:[...e.dynamicSkills??[]],dynamicTools:[...e.dynamicTools??[]],extensionMounts:[...e.extensionMounts??[]],hooks:[...e.hooks??[]],memories:[...e.memories??[]],instructions:[...e.instructions??[]],instrumentation:e.instrumentation===void 0?void 0:{...e.instrumentation},remoteAgents:[...e.remoteAgents??[]],sandbox:e.sandbox,sandboxWorkspaces:[...e.sandboxWorkspaces??[]],schedules:[...e.schedules??[]],skills:[...e.skills??[]],tools:[...e.tools??[]],workspaceResourceRoot:e.workspaceResourceRoot??{logicalPath:``,rootEntries:deriveResourceRootEntries({sandboxWorkspaces:e.sandboxWorkspaces,skills:e.skills})}}}function createCompiledAgentNodeManifest(e){let t={...createCompiledAgentResources(e),config:cloneCompiledAgentDefinition(e.config)};return validateCompiledAgentResources(t,{allowUnknownResourceWinners:!0}),t}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:{instrumentationProviders:e.experimental.instrumentationProviders,tasks:e.experimental.tasks,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}};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){let t={...createCompiledAgentNodeManifest(e),kind:COMPILED_AGENT_MANIFEST_KIND,extensionMounts:[...e.extensionMounts??[]],subagents:[...e.subagents??[]],version:44};return validateCompiledAgentManifest(t),t}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};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AgentModuleBinding, AgentSourceRegistry, CompiledModuleBinding } from "#compiler/source-graph.js";
|
|
2
|
+
import type { CompiledAgentDefinition } from "#compiler/manifest.js";
|
|
3
|
+
import { type CompiledBindingNamespaceLoader } from "#compiler/load-binding-namespace.js";
|
|
4
|
+
/** Owns namespace loading and lifecycle decisions for one node compilation. */
|
|
5
|
+
export declare class NodeModuleEvaluationContext {
|
|
6
|
+
#private;
|
|
7
|
+
readonly loadNamespace: CompiledBindingNamespaceLoader;
|
|
8
|
+
constructor(registries: readonly AgentSourceRegistry[]);
|
|
9
|
+
setBindings(bindings: Readonly<Record<string, AgentModuleBinding>>): void;
|
|
10
|
+
requireRuntimeEntry(sourceId: string): void;
|
|
11
|
+
finalizeBindings(): Record<string, CompiledModuleBinding>;
|
|
12
|
+
}
|
|
13
|
+
/** Marks authored config namespaces whose values must be resolved by the runtime. */
|
|
14
|
+
export declare function markConfigRuntimeEntries(config: CompiledAgentDefinition, evaluation: NodeModuleEvaluationContext): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createCompiledBindingNamespaceLoader}from"#compiler/load-binding-namespace.js";var NodeModuleEvaluationContext=class{#e={};#t=new NodeModuleLifecycle;loadNamespace;constructor(t){this.loadNamespace=createCompiledBindingNamespaceLoader({onLoad:e=>this.#t.recordCompileLoad(e),registries:t,resolveBinding:e=>this.#e[e]})}setBindings(e){this.#e=e}requireRuntimeEntry(e){this.#t.requireRuntimeEntry(e)}finalizeBindings(){return this.#t.finalize(this.#e)}};function markConfigRuntimeEntries(e,t){let n=[e.dynamicModel,e.model?.source,e.compaction?.model?.source];for(let e of n)e!==void 0&&t.requireRuntimeEntry(e.sourceId)}var NodeModuleLifecycle=class{#e=new Set;#t=new Set;recordCompileLoad(e){this.#e.add(e)}requireRuntimeEntry(e){this.#t.add(e)}finalize(e){let t=collectRuntimeEntryClosure(e,this.#t),n={};for(let[r,i]of Object.entries(e)){let e={compile:this.#e.has(r),runtimeEntry:t.has(r)};if(!e.compile&&!e.runtimeEntry)throw Error(`Selected module binding "${r}" has no compile or runtime usage.`);n[r]=Object.freeze({...i,usage:Object.freeze(e)})}return n}};function collectRuntimeEntryClosure(e,t){let n=new Set,r=new Set,visit=t=>{if(n.has(t))return;if(r.has(t))throw Error(`Compiled module dependency cycle includes "${t}".`);let i=e[t];if(i===void 0)throw Error(`Runtime module entry "${t}" has no selected binding.`);if(r.add(t),i.backing.kind===`programmatic`)for(let e of Object.values(i.backing.dependencies??{}))visit(e);r.delete(t),n.add(t)};for(let e of t)visit(e);return n}export{NodeModuleEvaluationContext,markConfigRuntimeEntries};
|
|
@@ -26,5 +26,5 @@ interface BoundModule {
|
|
|
26
26
|
export declare function createCompiledModuleMapSource(input: CreateCompiledModuleMapSourceInput): string;
|
|
27
27
|
/** Loads the same binding set used by generated maps without fabricating descriptors. */
|
|
28
28
|
export declare function createProgrammaticCompiledModuleMap(manifest: CompiledAgentManifest, registries: readonly AgentSourceRegistry[]): Promise<CompiledModuleMap>;
|
|
29
|
-
/** Returns
|
|
30
|
-
export declare function
|
|
29
|
+
/** Returns one compiled node's finalized runtime entries, including remote config modules. */
|
|
30
|
+
export declare function collectRuntimeModuleBindingsForManifest(manifest: CompiledAgentNodeManifest | CompiledAgentResources): readonly BoundModule[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{z}from"#compiled/zod/index.js";import{createCompiledBindingNamespaceLoader,resolveCompiledModuleExtensionScopeNamespace}from"#compiler/load-binding-namespace.js";import{ROOT_COMPILED_AGENT_NODE_ID}from"#compiler/manifest.js";import"#compiler/source-graph.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 t=dirnameFilesystemPath(e.moduleMapPath),n=e.importSpecifierStyle??`relative`,r=0,a=!1,o=collectBoundNodeScopes(e.manifest).map(e=>{let i=new Map(e.modules.map(e=>[e.sourceId,`module_${r++}`]));return{modules:e.modules.map(({binding:e,sourceId:r})=>{let o=i.get(r);return e.backing.kind===`filesystem`?{bindingName:o,importSpecifier:createImportSpecifier({fromDirectory:t,importSpecifierStyle:n,targetPath:e.backing.sourcePath}),initializer:`memoizeModuleNamespaceFactories(imported_${o})`,sourceId:r}:(a=!0,{bindingName:o,initializer:`await loadProgrammaticModule(${JSON.stringify(e.backing)}, ${renderProgrammaticDependencies(e.backing.dependencies,i)})`,sourceId:r})}),nodeId:e.nodeId}}),s=o.flatMap(e=>e.modules),c=s.flatMap(e=>e.importSpecifier===void 0?[]:[`import * as imported_${e.bindingName} from ${JSON.stringify(e.importSpecifier)};`]),l=s.flatMap(e=>e.initializer===void 0?[]:[`const ${e.bindingName} = ${e.initializer};`]);return[`// Generated by eve. Do not edit by hand.`,...a||c.length>0?[`import { loadFrameworkProgrammaticModule as loadProgrammaticModule, memoizeModuleNamespaceFactories } from ${JSON.stringify(normalizeEsmImportSpecifier(e.programmaticLoaderImportSpecifier??`eve/internal/programmatic-source-loader`))};`]:[],...c,...a||c.length>0?[``]:[],...l,...l.length>0?[``]:[],`export const moduleMap = ${renderModuleMap(o)};`,``,`export default moduleMap;`,``].join(`
|
|
2
|
-
`)}async function createProgrammaticCompiledModuleMap(e,n){let r={};for(let i of collectBoundNodeScopes(e)){let e={},a=createCompiledBindingNamespaceLoader({bindings:Object.fromEntries(i.modules.map(({binding:e,sourceId:t})=>[t,e])),registries:n});for(let{sourceId:t}of i.modules)e[t]=await a(t);r[i.nodeId]={modules:e}}return{nodes:r}}function
|
|
2
|
+
`)}async function createProgrammaticCompiledModuleMap(e,n){let r={};for(let i of collectBoundNodeScopes(e)){let e={},a=createCompiledBindingNamespaceLoader({bindings:Object.fromEntries(i.modules.map(({binding:e,sourceId:t})=>[t,e])),registries:n});for(let{sourceId:t}of i.modules)e[t]=await a(t);r[i.nodeId]={modules:e}}return{nodes:r}}function collectRuntimeModuleBindingsForManifest(e){let t=new Map(Object.entries(e.bindings).filter(([,e])=>e.usage.runtimeEntry));for(let n of e.remoteAgents)if(n.binding.usage.runtimeEntry){if(t.has(n.sourceId))throw Error(`Remote agent binding "${n.sourceId}" collides with a node binding.`);t.set(n.sourceId,n.binding)}return orderBoundModules([...t].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({binding:t,sourceId:e})))}function orderBoundModules(e){let t=new Map(e.map(e=>[e.sourceId,e])),n=[],r=new Set,i=new Set,visit=e=>{if(!i.has(e.sourceId)){if(r.has(e.sourceId))throw Error(`Compiled module dependency cycle includes "${e.sourceId}".`);if(r.add(e.sourceId),e.binding.backing.kind===`programmatic`)for(let n of Object.values(e.binding.backing.dependencies??{})){let r=t.get(n);if(r===void 0)throw Error(`Programmatic binding "${e.sourceId}" depends on missing binding "${n}".`);visit(r)}r.delete(e.sourceId),i.add(e.sourceId),n.push(e)}};for(let t of e)visit(t);return n}function renderProgrammaticDependencies(e,t){let n=Object.entries(e??{});return n.length===0?`Object.freeze({})`:`Object.freeze({ ${n.map(([e,n])=>`${JSON.stringify(e)}: ${t.get(n)}`).join(`, `)} })`}function collectBoundNodeScopes(e){return[{modules:collectRuntimeModuleBindingsForManifest(e),nodeId:ROOT_COMPILED_AGENT_NODE_ID},...[...e.subagents].sort((e,t)=>e.nodeId.localeCompare(t.nodeId)).map(e=>({modules:collectRuntimeModuleBindingsForManifest(e.agent),nodeId:e.nodeId}))]}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
|
-
`)}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 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 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;return[...Array.from({length:n.segments.length-i},()=>`..`),...r.segments.slice(i)].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+=`/`,r=r.slice(1)));let a=[];for(let e of r.split(`/`))e.length===0||e===`.`||(e===`..`?a.length>0&&a.at(-1)!==`..`?a.pop():n.length===0&&a.push(e):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{
|
|
5
|
+
`)}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 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 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;return[...Array.from({length:n.segments.length-i},()=>`..`),...r.segments.slice(i)].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+=`/`,r=r.slice(1)));let a=[];for(let e of r.split(`/`))e.length===0||e===`.`||(e===`..`?a.length>0&&a.at(-1)!==`..`?a.pop():n.length===0&&a.push(e):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{collectRuntimeModuleBindingsForManifest,compiledModuleMapSchema,createCompiledModuleMapSource,createProgrammaticCompiledModuleMap,resolveCompiledModuleExtensionScopeNamespace};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ModuleSourceRef } from "#shared/source-ref.js";
|
|
2
2
|
import type { ProjectedAgentSources, ProjectedSource, ProjectedSubagentSource } from "#compiler/project-sources.js";
|
|
3
|
-
import { type
|
|
3
|
+
import { type AgentModuleBinding, type AgentModuleCandidate, type AgentSourceCandidate, type ComposedAgentModuleCandidates } from "#compiler/source-graph.js";
|
|
4
|
+
import type { NodeModuleEvaluationContext } from "#compiler/module-lifecycle.js";
|
|
4
5
|
export interface ComposedNodeSourceGraph {
|
|
5
6
|
composed: ComposedAgentModuleCandidates;
|
|
6
7
|
readonly orderedCandidates: readonly AgentSourceCandidate[];
|
|
@@ -9,16 +10,18 @@ export interface ComposedNodeSourceGraph {
|
|
|
9
10
|
readonly subagentsBySourceId: ReadonlyMap<string, ProjectedSubagentSource>;
|
|
10
11
|
}
|
|
11
12
|
export interface SelectedNodeConfig {
|
|
12
|
-
readonly binding:
|
|
13
|
+
readonly binding: AgentModuleBinding;
|
|
13
14
|
readonly candidate: AgentModuleCandidate;
|
|
14
15
|
readonly definition: unknown;
|
|
15
16
|
readonly source: ModuleSourceRef;
|
|
16
17
|
}
|
|
17
18
|
export interface PhaseOneNodeSourceState {
|
|
19
|
+
readonly evaluation: NodeModuleEvaluationContext;
|
|
18
20
|
readonly graph: ComposedNodeSourceGraph;
|
|
19
21
|
readonly selectedConfig: SelectedNodeConfig;
|
|
20
22
|
}
|
|
21
23
|
export interface FinalizedNodeSourceState extends ComposedNodeSourceGraph {
|
|
22
|
-
readonly bindings: Record<string,
|
|
24
|
+
readonly bindings: Record<string, AgentModuleBinding>;
|
|
25
|
+
readonly evaluation: NodeModuleEvaluationContext;
|
|
23
26
|
}
|
|
24
27
|
export declare function finalizeNodeSourceState(phaseOne: PhaseOneNodeSourceState, externalDependencies: readonly string[]): FinalizedNodeSourceState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{createAgentModuleBinding}from"#compiler/source-graph.js";import{collectSelectedSourceIds,mergeExternalDependencies}from"#compiler/normalize-manifest-helpers.js";function finalizeNodeSourceState(n,r){let i=n.graph,a=new Map(i.orderedCandidates.map(e=>{let t=finalizeCandidateExternalDependencies(e,r);return[e.sourceId,t]})),candidateFor=e=>{let t=a.get(e.sourceId);if(t===void 0)throw Error(`Agent source candidate "${e.sourceId}" is missing from its node.`);return t},o={candidates:i.projected.candidates.map(candidateFor),resources:i.projected.resources.map(e=>({...e,candidate:candidateFor(e.candidate)})),subagents:i.projected.subagents.map(e=>({...e,candidate:candidateFor(e.candidate)}))},s={composition:{entries:i.composed.composition.entries.map(e=>({...e,source:finalizeDescriptorExternalDependencies(e.source,r)}))},selected:new Map([...i.composed.selected].map(([e,t])=>[e,candidateFor(t)]))},c=collectSelectedSourceIds(s),l=Object.fromEntries([...a.values()].filter(e=>c.has(e.sourceId)&&e.backing.kind!==`resource`).map(t=>[t.sourceId,createAgentModuleBinding(t)]));return n.evaluation.setBindings(l),{bindings:l,composed:s,orderedCandidates:i.orderedCandidates.map(candidateFor),projected:o,sourcesBySourceId:new Map([...i.sourcesBySourceId].map(([e,t])=>[e,{...t,candidate:candidateFor(t.candidate)}])),subagentsBySourceId:new Map(o.subagents.map(e=>[e.candidate.sourceId,e])),evaluation:n.evaluation}}function finalizeCandidateExternalDependencies(e,t){return e.backing.kind===`filesystem`?{...e,backing:finalizeBackingExternalDependencies(e.backing,t)}:e}function finalizeDescriptorExternalDependencies(e,t){return e.backing.kind===`filesystem`?{...e,backing:finalizeBackingExternalDependencies(e.backing,t)}:e}function finalizeBackingExternalDependencies(e,t){return{...e,externalDependencies:mergeExternalDependencies(t,e.externalDependencies)}}export{finalizeNodeSourceState};
|
|
@@ -2,13 +2,13 @@ import type { AgentSourceManifest } from "#discover/manifest.js";
|
|
|
2
2
|
import type { ModuleSourceRef } from "#shared/source-ref.js";
|
|
3
3
|
import type { CompiledAgentDefinition } from "#compiler/manifest.js";
|
|
4
4
|
import { type ManifestCompileContext } from "#compiler/normalize-helpers.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { AgentModuleBinding } from "#compiler/source-graph.js";
|
|
6
6
|
/**
|
|
7
7
|
* Compiles the agent-level configuration (model, compaction, build,
|
|
8
8
|
* workspace) for one authored agent node.
|
|
9
9
|
*/
|
|
10
10
|
export declare function compileAgentConfig(manifest: AgentSourceManifest, context: ManifestCompileContext, options: {
|
|
11
|
-
readonly binding:
|
|
11
|
+
readonly binding: AgentModuleBinding;
|
|
12
12
|
readonly definition?: unknown;
|
|
13
13
|
readonly source: ModuleSourceRef;
|
|
14
14
|
}): Promise<CompiledAgentDefinition>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ModuleSourceRef } from "#shared/source-ref.js";
|
|
2
2
|
import type { CompiledRuntimeModelCatalogLoader } from "#compiler/model-catalog.js";
|
|
3
|
-
import { type
|
|
3
|
+
import { type AgentModuleBinding, type AgentSourceRegistry, type AgentSourceOwner, type ProgrammaticModuleNamespace } from "#compiler/source-graph.js";
|
|
4
4
|
import type { CompiledBindingNamespaceLoader } from "#compiler/load-binding-namespace.js";
|
|
5
5
|
/**
|
|
6
6
|
* Shared compile-time context threaded through every per-primitive
|
|
@@ -15,11 +15,11 @@ export interface ManifestCompileContext {
|
|
|
15
15
|
readonly registries: readonly AgentSourceRegistry[];
|
|
16
16
|
}
|
|
17
17
|
export interface ModuleBackedDefinitionLoadOptions {
|
|
18
|
-
readonly binding:
|
|
18
|
+
readonly binding: AgentModuleBinding;
|
|
19
19
|
readonly loadNamespace: CompiledBindingNamespaceLoader;
|
|
20
20
|
}
|
|
21
21
|
export interface SourceDefinitionCompileOptions {
|
|
22
|
-
readonly binding?:
|
|
22
|
+
readonly binding?: AgentModuleBinding;
|
|
23
23
|
readonly loadNamespace?: CompiledBindingNamespaceLoader;
|
|
24
24
|
readonly owner: AgentSourceOwner;
|
|
25
25
|
}
|
|
@@ -34,7 +34,7 @@ export declare function requireModuleBackedDefinitionLoadOptions(options: Source
|
|
|
34
34
|
* authored file failed.
|
|
35
35
|
*/
|
|
36
36
|
export declare function loadModuleBackedDefinition(input: {
|
|
37
|
-
readonly binding:
|
|
37
|
+
readonly binding: AgentModuleBinding;
|
|
38
38
|
readonly dependencyNamespaces?: Readonly<Record<string, ProgrammaticModuleNamespace>>;
|
|
39
39
|
readonly displayPath?: string;
|
|
40
40
|
readonly kind: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{posix}from"node:path";import{ROOT_COMPILED_AGENT_NODE_ID}from"#compiler/manifest.js";import{canonicalSourceSlot}from"#compiler/source-graph.js";import{mountRefNamespace,packageStateNamespace}from"#discover/extensions.js";import"#compiler/normalize-subagent.js";function collectSelectedSourceIds(e){return new Set([...e.selected.values()].map(e=>e.sourceId))}function assertRootOnlyConfig(e,t,n){if(!t){if(e.experimental?.workflow!==void 0)throw Error(`Workflow runtime configuration is only supported on the root agent config. Remove "experimental.workflow" from "${n}".`);if(e.experimental?.tasks!==void 0)throw Error(`Background tasks are only supported on the root agent config. Remove "experimental.tasks" from "${n}".`)}}function assertApplicationOverlayCanApplyToAllNodes(e){let t=e.find(e=>{let t=canonicalSourceSlot(e);return t===`agent`||t.startsWith(`channels/`)||t.startsWith(`schedules/`)||t.startsWith(`subagents/`)||t.startsWith(`extensions/`)});if(t!==void 0)throw Error(`Application programmatic source registered for all local nodes cannot declare "${t}".`)}function assertUniqueRegistryIds(e){let t=new Set;for(let n of e)for(let e of n.sources.keys()){if(t.has(e))throw Error(`Programmatic agent source id "${e}" is registered more than once.`);t.add(e)}}function assertRootOwnedSpecialTool(e,n){if(e.nodeId!==ROOT_COMPILED_AGENT_NODE_ID)throw Error(`${n} can only be enabled on the root agent.`);assertNonExtensionSpecialTool(e,n)}function assertNonExtensionSpecialTool(e,t){if(e.owner.kind===`extension`)throw Error(`${t} cannot be configured by an extension source.`)}function withExtensionNamespace(e,t){return t.kind===`extension`?{...e,extensionNamespace:t.namespace}:e}function assertUniqueBy(e,t,n){let r=new Set;for(let i of e){let e=t(i);if(r.has(e))throw Error(`Compiled ${n} "${e}" is declared more than once.`);r.add(e)}}function expectSubagentDescription(e,t){if(e.description===void 0||e.description.trim().length===0)throw Error(`Subagent "${t.logicalPath}" must define a non-empty description.`);return e.description}function createCompiledRemoteAgent(t){let n=t.source.logicalPath.endsWith(`.ts`)||t.source.logicalPath.endsWith(`.js`)?t.source.logicalPath:posix.join(t.source.logicalPath,`agent.ts`),r=t.source.sourceId,i={backing:t.binding.backing,logicalPath:n,owner:t.owner},a={backing:{kind:`resource`,sourcePath:t.source.entryPath},binding:i,description:t.definition.description,entryPath:t.source.entryPath,logicalPath:n,name:t.source.subagentId,nodeId:t.nodeId,owner:t.owner,parentNodeId:t.parentNodeId,path:t.definition.path,rootPath:t.source.rootPath,sourceId:r,sourceKind:`module`};return t.sourceRef.exportName!==void 0&&Object.assign(a,{exportName:t.sourceRef.exportName}),t.definition.outputSchema!==void 0&&Object.assign(a,{outputSchema:t.definition.outputSchema}),t.definition.url!==void 0&&Object.assign(a,{url:t.definition.url}),a}function compileExtensionMounts(e,t){let n=collectSelectedSourceIds(t);return e.resolvedExtensions.flatMap(t=>{let a=e.extensions.find(e=>mountRefNamespace(e.logicalPath)===t.namespace);return a===void 0||!n.has(a.sourceId)?[]:[{externalDependencies:[...t.externalDependencies],mountLogicalPath:a.logicalPath,mountSourceId:a.sourceId,namespace:t.namespace,packageName:t.packageName,packageNamespace:packageStateNamespace(t.packageName),sourceRoot:t.sourceRoot}]})}function mergeExternalDependencies(...e){return[...new Set(e.flatMap(e=>e??[]))]}export{assertApplicationOverlayCanApplyToAllNodes,assertNonExtensionSpecialTool,assertRootOnlyConfig,assertRootOwnedSpecialTool,assertUniqueBy,assertUniqueRegistryIds,collectSelectedSourceIds,compileExtensionMounts,createCompiledRemoteAgent,expectSubagentDescription,mergeExternalDependencies,withExtensionNamespace};
|
|
1
|
+
import{posix}from"node:path";import{ROOT_COMPILED_AGENT_NODE_ID}from"#compiler/manifest.js";import{canonicalSourceSlot}from"#compiler/source-graph.js";import{mountRefNamespace,packageStateNamespace}from"#discover/extensions.js";import"#compiler/normalize-subagent.js";function collectSelectedSourceIds(e){return new Set([...e.selected.values()].map(e=>e.sourceId))}function assertRootOnlyConfig(e,t,n){if(!t){if(e.experimental?.workflow!==void 0)throw Error(`Workflow runtime configuration is only supported on the root agent config. Remove "experimental.workflow" from "${n}".`);if(e.experimental?.tasks!==void 0)throw Error(`Background tasks are only supported on the root agent config. Remove "experimental.tasks" from "${n}".`)}}function assertApplicationOverlayCanApplyToAllNodes(e){let t=e.find(e=>{let t=canonicalSourceSlot(e);return t===`agent`||t.startsWith(`channels/`)||t.startsWith(`schedules/`)||t.startsWith(`subagents/`)||t.startsWith(`extensions/`)});if(t!==void 0)throw Error(`Application programmatic source registered for all local nodes cannot declare "${t}".`)}function assertUniqueRegistryIds(e){let t=new Set;for(let n of e)for(let e of n.sources.keys()){if(t.has(e))throw Error(`Programmatic agent source id "${e}" is registered more than once.`);t.add(e)}}function assertRootOwnedSpecialTool(e,n){if(e.nodeId!==ROOT_COMPILED_AGENT_NODE_ID)throw Error(`${n} can only be enabled on the root agent.`);assertNonExtensionSpecialTool(e,n)}function assertNonExtensionSpecialTool(e,t){if(e.owner.kind===`extension`)throw Error(`${t} cannot be configured by an extension source.`)}function withExtensionNamespace(e,t){return t.kind===`extension`?{...e,extensionNamespace:t.namespace}:e}function assertUniqueBy(e,t,n){let r=new Set;for(let i of e){let e=t(i);if(r.has(e))throw Error(`Compiled ${n} "${e}" is declared more than once.`);r.add(e)}}function expectSubagentDescription(e,t){if(e.description===void 0||e.description.trim().length===0)throw Error(`Subagent "${t.logicalPath}" must define a non-empty description.`);return e.description}function createCompiledRemoteAgent(t){let n=t.source.logicalPath.endsWith(`.ts`)||t.source.logicalPath.endsWith(`.js`)?t.source.logicalPath:posix.join(t.source.logicalPath,`agent.ts`),r=t.source.sourceId,i={backing:t.binding.backing,logicalPath:n,owner:t.owner,usage:t.binding.usage},a={backing:{kind:`resource`,sourcePath:t.source.entryPath},binding:i,description:t.definition.description,entryPath:t.source.entryPath,logicalPath:n,name:t.source.subagentId,nodeId:t.nodeId,owner:t.owner,parentNodeId:t.parentNodeId,path:t.definition.path,rootPath:t.source.rootPath,sourceId:r,sourceKind:`module`};return t.sourceRef.exportName!==void 0&&Object.assign(a,{exportName:t.sourceRef.exportName}),t.definition.outputSchema!==void 0&&Object.assign(a,{outputSchema:t.definition.outputSchema}),t.definition.url!==void 0&&Object.assign(a,{url:t.definition.url}),a}function compileExtensionMounts(e,t){let n=collectSelectedSourceIds(t);return e.resolvedExtensions.flatMap(t=>{let a=e.extensions.find(e=>mountRefNamespace(e.logicalPath)===t.namespace);return a===void 0||!n.has(a.sourceId)?[]:[{externalDependencies:[...t.externalDependencies],mountLogicalPath:a.logicalPath,mountSourceId:a.sourceId,namespace:t.namespace,packageName:t.packageName,packageNamespace:packageStateNamespace(t.packageName),sourceRoot:t.sourceRoot}]})}function mergeExternalDependencies(...e){return[...new Set(e.flatMap(e=>e??[]))]}export{assertApplicationOverlayCanApplyToAllNodes,assertNonExtensionSpecialTool,assertRootOnlyConfig,assertRootOwnedSpecialTool,assertUniqueBy,assertUniqueRegistryIds,collectSelectedSourceIds,compileExtensionMounts,createCompiledRemoteAgent,expectSubagentDescription,mergeExternalDependencies,withExtensionNamespace};
|