Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

Recommit "feat(eve): mount bundled development extensions" (#3658)

prha155d24ad82a3
diff --git a/.changeset/bundled-self-modification-scaffold.md b/.changeset/bundled-self-modification-scaffold.md
new file mode 100644
index 000000000..fb389ff48
--- /dev/null
+++ b/.changeset/bundled-self-modification-scaffold.md
@@ -0,0 +1,5 @@
+---
+"eve": patch
+---
+
+Make the bundled self-modification subagent scaffold an authored mount before changing its model, reasoning, or policy.
diff --git a/.changeset/default-development-extensions.md b/.changeset/default-development-extensions.md
new file mode 100644
index 000000000..c6e27cfa6
--- /dev/null
+++ b/.changeset/default-development-extensions.md
@@ -0,0 +1,5 @@
+---
+"eve": patch
+---
+
+`eve dev` now mounts bundled development extensions by default, including the local self-modification subagent. Pass `--no-default-extensions` to run without them; production bundles do not initialize these development-only mounts.
diff --git a/docs/reference/cli.md b/docs/reference/cli.md
index f4edb80f9..81f35ef43 100644
--- a/docs/reference/cli.md
+++ b/docs/reference/cli.md
@@ -223,6 +223,7 @@ Pass a bare URL and the UI connects to that server instead of booting a local on
| `-u, --url <url>` | string | none | Connect to an existing server URL instead of starting one |
| `-H, --header <header>` | string | none | Request header for a URL target, in `Name: value` form; repeat for multiple headers |
| `--no-ui` | flag | UI on | Start the server without an interactive UI |
+| `--no-default-extensions` | flag | extensions on | Do not mount bundled development extensions |
| `--name <name>` | string | app folder name | Title shown in the terminal UI |
| `--input <text>` | string | none | Pre-fill the prompt input |
| `--tools <mode>` | enum | `auto-collapsed` | Tool-call rendering: `full` \| `collapsed` \| `auto-collapsed` \| `hidden` |
@@ -233,6 +234,8 @@ Pass a bare URL and the UI connects to that server instead of booting a local on
| `--context-size <tokens>` | number | none | Model context window size, shown as a usage percentage |
| `--logs <mode>` | enum | `stderr` | Server/agent logs to show: `all` \| `stderr` \| `sandbox` \| `none` |
+Local development mounts bundled development extensions without adding files to your project. The default set includes the self-modification extension and its `self-modification__agent` subagent. Pass `--no-default-extensions` to disable the complete set for that server.
+
`eve acp` reserves stdin and stdout for newline-delimited JSON-RPC and sends diagnostics to stderr. Without a URL, it supervises an isolated local development server. With a URL, it bridges ACP to that server's existing eve HTTP API and accepts the same URL credentials and request headers as `eve dev <url>`. Pass `--scope <team>` when the active Vercel scope does not own the deployment; `EVE_VERCEL_SCOPE` provides the same value for managed harnesses. See [Agent Client Protocol (ACP)](../protocols/acp) for client configuration and capability limits.
A fresh `eve init` opens the TUI and reuses an available model connection or opens `/login`. No Vercel project, channels, integrations, or review step is required before chat. Use `/model` to change models and settings, and `/add` to install an addition. Other `--input` text stays editable in the prompt. See [Terminal UI](../guides/dev-tui) for credential precedence and login options.
diff --git a/docs/subagents/index.mdx b/docs/subagents/index.mdx
index 19c0935e2..51518105f 100644
--- a/docs/subagents/index.mdx
+++ b/docs/subagents/index.mdx
@@ -103,6 +103,8 @@ Every declared local or remote subagent runs as a durable background task: the c
A mounted extension can also contribute declared subagents from `extension/subagents/`. The mount namespace prefixes the subagent visible to the consuming agent node: mounting an extension as `crm` exposes its `reviewer` subagent as `crm__reviewer`. The contributed subagent keeps its own isolated tools, connections, skills, hooks, instructions, sandbox, and nested subagents, and its modules can read configuration from the extension handle. See [Extensions](./extensions#add-a-subagent) for the authoring and override behavior.
+Local `eve dev` mounts the bundled self-modification extension by default, which exposes the `self-modification__agent` subagent without adding files to your project. An authored extension mounted as `self-modification` takes its place. Pass `--no-default-extensions` to run without bundled development extensions. Production builds do not include development extensions unless you mount them in your agent.
+
### Vercel workspace peers
In a Vercel agent workspace, expose one other workspace member as a remote subagent with `defineWorkspaceAgent`. Create an ordinary file under the caller's `agent/subagents/` directory. Its filename gives the model-visible tool name; `name` identifies the peer under `agents/`.
diff --git a/packages/eve/src/cli/dev/command-options.ts b/packages/eve/src/cli/dev/command-options.ts
index 7de44dbd0..54397a855 100644
--- a/packages/eve/src/cli/dev/command-options.ts
+++ b/packages/eve/src/cli/dev/command-options.ts
@@ -9,6 +9,7 @@ export interface DevelopmentCliOptions {
assistantResponseStats?: AssistantResponseStatsMode;
connectionAuth?: TerminalPartDisplayMode;
contextSize?: number;
+ defaultExtensions?: boolean;
header?: DevelopmentRequestHeaders;
host?: string;
input?: string;
diff --git a/packages/eve/src/cli/dev/command.ts b/packages/eve/src/cli/dev/command.ts
index fed35f195..503ed661c 100644
--- a/packages/eve/src/cli/dev/command.ts
+++ b/packages/eve/src/cli/dev/command.ts
@@ -6,6 +6,7 @@ import { FORCED_EXIT_BACKSTOP_MS, installShutdownSignal } from "#cli/shutdown.js
import { startCliLiveRow } from "#cli/ui/live-row.js";
import { createCliTheme, renderCliTaggedLine } from "#cli/ui/output.js";
import type { EveCliTelemetry } from "#cli/telemetry/index.js";
+import { noDevelopmentExtensions } from "#compiler/development-extensions.js";
import type { DevelopmentServer, DevelopmentServerOptions } from "#internal/nitro/host/types.js";
import { createDevBootProgressReporter } from "./boot-progress.js";
@@ -87,6 +88,7 @@ export function registerDevelopmentCommand(input: {
parseDevelopmentHeaderOption,
)
.option("--no-ui", "Start the server without an interactive UI")
+ .option("--no-default-extensions", "Do not mount default development extensions")
.option("--name <name>", "Title shown in the terminal UI (defaults to the app folder name)")
.option("--input <text>", "Pre-fill the prompt input")
.addOption(new Option("--onboard", "Start fresh-agent onboarding").hideHelp())
@@ -221,6 +223,9 @@ export function registerDevelopmentCommand(input: {
try {
const startHost = runtime.startHost ?? (await loadStartHost());
server = startHost(applicationContext.root, {
+ ...(options.defaultExtensions === false
+ ? { developmentExtensions: noDevelopmentExtensions() }
+ : {}),
existing: mode === "tui" ? "attach-if-unconfigured" : "reject",
host: options.host,
onBootProgress,
diff --git a/packages/eve/src/cli/dev/local-server-child.ts b/packages/eve/src/cli/dev/local-server-child.ts
index 9c74d28c6..a5441b2c4 100644
--- a/packages/eve/src/cli/dev/local-server-child.ts
+++ b/packages/eve/src/cli/dev/local-server-child.ts
@@ -5,7 +5,7 @@ import { reconcileCleanupIntents, recordCleanupIntent } from "#cli/dev/local-ser
const options = JSON.parse(process.argv[2] ?? "{}") as Pick<
DevelopmentServerOptions,
- "existing" | "host" | "port"
+ "developmentExtensions" | "existing" | "host" | "port"
>;
const server = createDevelopmentServer(process.cwd(), {
...options,
diff --git a/packages/eve/src/cli/dev/local-server-process.test.ts b/packages/eve/src/cli/dev/local-server-process.test.ts
index 3ec368781..0c96f5ed6 100644
--- a/packages/eve/src/cli/dev/local-server-process.test.ts
+++ b/packages/eve/src/cli/dev/local-server-process.test.ts
@@ -39,6 +39,26 @@ describe("createDevelopmentServer", () => {
expect(DEV_SERVER_CLOSE_BUDGET_MS).toBeLessThan(FORCED_EXIT_BACKSTOP_MS);
});
+ it("passes development extension selection to the child", async () => {
+ const developmentExtensions = { enabled: [] as const };
+ const server = createDevelopmentServer("/tmp/app", { developmentExtensions });
+ const started = server.start();
+ await vi.waitFor(() => expect(mocks.fork).toHaveBeenCalled());
+ expect(mocks.fork).toHaveBeenCalledWith(
+ expect.any(String),
+ [JSON.stringify({ developmentExtensions })],
+ expect.any(Object),
+ );
+ child.emit("message", {
+ type: "started",
+ handle: { kind: "started", appRoot: "/tmp/app", url: "http://127.0.0.1:2000" },
+ });
+ await started;
+ const closing = server.close();
+ child.emit("exit", 0, null);
+ await closing;
+ });
+
it("starts and hands cleanup to the child", async () => {
const server = createDevelopmentServer("/tmp/app", { port: 2000 });
const started = server.start();
diff --git a/packages/eve/src/cli/dev/local-server-process.ts b/packages/eve/src/cli/dev/local-server-process.ts
index dbf4d2b4b..56540a5b3 100644
--- a/packages/eve/src/cli/dev/local-server-process.ts
+++ b/packages/eve/src/cli/dev/local-server-process.ts
@@ -92,6 +92,7 @@ export function createDevelopmentServer(
childPath,
[
JSON.stringify({
+ developmentExtensions: options.developmentExtensions,
existing: options.existing,
host: options.host,
port: options.port,
diff --git a/packages/eve/src/cli/run.test.ts b/packages/eve/src/cli/run.test.ts
index da7c718df..b54645bcf 100644
--- a/packages/eve/src/cli/run.test.ts
+++ b/packages/eve/src/cli/run.test.ts
@@ -569,6 +569,24 @@ describe("eve dev --input", () => {
},
);
+ it("passes the default extension opt-out to the local server", async () => {
+ const startHost = vi.fn(() => ({
+ start: async () => ({
+ kind: "existing" as const,
+ appRoot: "/canonical/app",
+ url: "http://127.0.0.1:4321/",
+ }),
+ close: async () => {},
+ }));
+
+ await runInteractiveDev(["dev", "--no-default-extensions"], { startHost });
+
+ expect(startHost).toHaveBeenCalledWith(
+ expect.any(String),
+ expect.objectContaining({ developmentExtensions: { enabled: [] } }),
+ );
+ });
+
it("forwards the internal init onboarding handoff to the local TUI", async () => {
const startHost = vi.fn(() => ({
start: async () => ({
diff --git a/packages/eve/src/compiler/artifacts.ts b/packages/eve/src/compiler/artifacts.ts
index 1cfaf90f2..8ee675e8c 100644
--- a/packages/eve/src/compiler/artifacts.ts
+++ b/packages/eve/src/compiler/artifacts.ts
@@ -21,6 +21,7 @@ import {
} from "#compiler/diagnostics.js";
import { createCompiledModuleMapSource } from "#compiler/module-map.js";
import { compileAgentManifest } from "#compiler/normalize-manifest.js";
+import type { DevelopmentExtensionSelection } from "#compiler/development-extensions.js";
import { materializeWorkspaceResources } from "#compiler/workspace-resources.js";
import { createSandboxPreparedArtifactsManifest } from "#shared/sandbox-prepared-artifacts.js";
@@ -119,6 +120,7 @@ export interface CompilerArtifactLocations {
*/
interface WriteCompilerArtifactsInput {
appRoot: string;
+ developmentExtensions?: DevelopmentExtensionSelection;
artifactLocations: CompilerArtifactLocations;
diagnostics: readonly DiscoverDiagnostic[];
manifest: AgentSourceManifest;
@@ -244,7 +246,10 @@ export async function writeCompilerArtifacts(
);
const compiledManifest = await materializeWorkspaceResources({
compileDirectoryPath: paths.compileDirectoryPath,
- manifest: await compileAgentManifest(input.manifest, { diagnostics }),
+ manifest: await compileAgentManifest(input.manifest, {
+ developmentExtensions: input.developmentExtensions,
+ diagnostics,
+ }),
});
const diagnosticsArtifact = createCompilerDiagnosticsArtifact(diagnostics);
const compiledManifestJson = serializeArtifactJson(compiledManifest);
diff --git a/packages/eve/src/compiler/bundled-extension.ts b/packages/eve/src/compiler/bundled-extension.ts
new file mode 100644
index 000000000..8c1af6f02
--- /dev/null
+++ b/packages/eve/src/compiler/bundled-extension.ts
@@ -0,0 +1,63 @@
+import { packageStateNamespace } from "#discover/extensions.js";
+import {
+ defineProgrammaticExtensionMountDeclaration,
+ type ProgrammaticAgentSource,
+} from "#compiler/source-graph.js";
+import { resolveInstalledPackageInfo, resolvePackageRoot } from "#internal/application/package.js";
+
+/** The small descriptor used for extensions shipped inside eve. */
+export interface BundledExtensionDescriptor {
+ readonly loadMount: () => Promise<unknown>;
+ readonly namespace: string;
+ readonly sourceDirectory: string;
+}
+
+export interface BundledExtensionMount {
+ readonly declaration: ProgrammaticAgentSource;
+ readonly namespace: string;
+ readonly packageName: string;
+ readonly packageRoot: string;
+ readonly sourceRoot: string;
+ readonly specifier: string;
+}
+
+/** Adapts one bundled descriptor to the virtual extension mount consumed by discovery. */
+export function createBundledExtensionMount(
+ descriptor: BundledExtensionDescriptor,
+): BundledExtensionMount {
+ const packageInfo = resolveInstalledPackageInfo();
+ const packageName = packageInfo.name;
+ const packageRoot = resolvePackageRoot();
+ const revision = `eve@${packageInfo.version}:development-extensions-v1`;
+ const logicalPath = `extensions/${descriptor.namespace}.ts`;
+ const declaration = defineProgrammaticExtensionMountDeclaration({
+ id: `eve:development-extension:${descriptor.namespace}`,
+ revision,
+ modules: [
+ {
+ logicalPath,
+ loadNamespace: async () => {
+ const container = globalThis as Record<symbol, unknown>;
+ const scopeSymbol = Symbol.for("eve.ext-config-scope");
+ const previousScope = container[scopeSymbol];
+ container[scopeSymbol] = packageStateNamespace(packageName);
+ try {
+ return { default: await descriptor.loadMount() };
+ } finally {
+ if (previousScope === undefined) delete container[scopeSymbol];
+ else container[scopeSymbol] = previousScope;
+ }
+ },
+ },
+ ],
+ });
+
+ return Object.freeze({
+ declaration,
+ namespace: descriptor.namespace,
+ packageName,
+ packageRoot,
+ sourceRoot: descriptor.sourceDirectory,
+ specifier: `${packageName}/${descriptor.namespace}`,
+ });
+}
diff --git a/packages/eve/src/compiler/compile-agent.ts b/packages/eve/src/compiler/compile-agent.ts
index dfbb2de59..61d99602e 100644
--- a/packages/eve/src/compiler/compile-agent.ts
+++ b/packages/eve/src/compiler/compile-agent.ts
@@ -14,12 +14,15 @@ import {
} from "#compiler/artifacts.js";
import type { CompiledAgentManifest } from "#compiler/manifest.js";
import { summarizeCompilerDiagnostics, type CompilerDiagnostic } from "#compiler/diagnostics.js";
+import type { DevelopmentExtensionSelection } from "#compiler/development-extensions.js";
/**
* Input for compiling the current authored agent into framework-owned
* discovery artifacts.
*/
export interface CompileAgentInput {
+ /** Development-only source extensions applied before source composition. */
+ developmentExtensions?: DevelopmentExtensionSelection;
/**
* Optional {@link ProjectSource} used for discovery reads. Defaults to a
* disk-backed source so production callers keep their current behaviour.
@@ -91,15 +94,20 @@ export async function compileAgent(input: CompileAgentInput = {}): Promise<Compi
*/
export async function compileAgentInWorkspace(input: {
readonly artifactLocations: CompilerArtifactLocations;
+ readonly developmentExtensions?: DevelopmentExtensionSelection;
readonly startPath: string;
}): Promise<CompileAgentResult> {
- const discovered = await discoverAgentForCompilation({ startPath: input.startPath });
+ const discovered = await discoverAgentForCompilation({
+ developmentExtensions: input.developmentExtensions,
+ startPath: input.startPath,
+ });
const result = await writeAgentCompilation(discovered, input.artifactLocations);
return finishAgentCompilation(result, CompileAgentError.fromTransientArtifacts);
}
interface DiscoveredAgentCompilation {
+ readonly developmentExtensions: DevelopmentExtensionSelection | undefined;
readonly diagnostics: DiscoverDiagnostic[];
readonly manifest: AgentSourceManifest;
readonly project: ResolvedDiscoveryProject;
@@ -113,6 +121,7 @@ async function discoverAgentForCompilation(
const discoveryResult = await discoverAgent({ ...project, source });
return {
+ developmentExtensions: input.developmentExtensions,
diagnostics: discoveryResult.diagnostics,
manifest: discoveryResult.manifest,
project,
@@ -127,6 +136,7 @@ async function writeAgentCompilation(
appRoot: discovered.project.appRoot,
artifactLocations,
diagnostics: discovered.diagnostics,
+ developmentExtensions: discovered.developmentExtensions,
manifest: discovered.manifest,
});
diff --git a/packages/eve/src/compiler/development-extensions.integration.test.ts b/packages/eve/src/compiler/development-extensions.integration.test.ts
new file mode 100644
index 000000000..a197ad54b
--- /dev/null
+++ b/packages/eve/src/compiler/development-extensions.integration.test.ts
@@ -0,0 +1,75 @@
+import { describe, expect, it } from "vitest";
+
+import {
+ defaultDevelopmentExtensions,
+ getDevelopmentExtensionSourceRegistry,
+ prepareDevelopmentExtensions,
+} from "#compiler/development-extensions.js";
+import { createProgrammaticCompiledModuleMap } from "#compiler/module-map.js";
+import { compileAgentManifest } from "#compiler/normalize-manifest.js";
+import { validateCompiledModuleMap } from "#compiler/validate-artifact.js";
+import { createAgentSourceManifest } from "#discover/manifest.js";
+import { frameworkAgentSourceRegistry } from "#framework/sources/registry.js";
+
+function manifest() {
+ return createAgentSourceManifest({
+ agentId: "source-test",
+ agentRoot: "/virtual/source-test/agent",
+ appRoot: "/virtual/source-test",
+ });
+}
+
+describe("development extensions", () => {
+ it("mounts the built-in self-modification extension at the root", async () => {
+ expect(
+ frameworkAgentSourceRegistry.sources.has("eve:development-extension:self-modification"),
+ ).toBe(false);
+
+ const compiled = await compileAgentManifest(manifest(), {
+ developmentExtensions: defaultDevelopmentExtensions(),
+ });
+ expect(compiled.subagents).toHaveLength(1);
+ const subagent = compiled.subagents[0]!;
+ expect(subagent.name).toBe("self-modification__agent");
+
+ expect(compiled.extensionMounts).toMatchObject([
+ {
+ mountLogicalPath: "extensions/self-modification.ts",
+ namespace: "self-modification",
+ packageName: "eve",
+ },
+ ]);
+ expect(subagent.agent.tools.map((tool) => tool.name)).toEqual(
+ expect.arrayContaining(["edit_file", "search_models", "search_registry"]),
+ );
+ expect(subagent.agent.dynamicTools.map((tool) => tool.slug)).toEqual(
+ expect.arrayContaining(["publish", "registry_add"]),
+ );
+ expect(subagent.agent.dynamicInstructions).toHaveLength(1);
+
+ const moduleMap = await createProgrammaticCompiledModuleMap(compiled, [
+ frameworkAgentSourceRegistry,
+ getDevelopmentExtensionSourceRegistry(),
+ ]);
+ expect(() => validateCompiledModuleMap(compiled, moduleMap)).not.toThrow();
+ });
+
+ it("does not replace an authored self-modification mount", async () => {
+ const authored = manifest();
+ authored.extensions.push({
+ logicalPath: "extensions/self-modification.ts",
+ sourceId: "extensions/self-modification.ts",
+ sourceKind: "module",
+ });
+
+ const prepared = await prepareDevelopmentExtensions({
+ diagnostics: [],
+ manifest: authored,
+ nodeId: "root",
+ selection: defaultDevelopmentExtensions(),
+ });
+
+ expect(prepared.manifest.resolvedExtensions).toEqual([]);
+ expect(prepared.candidates).toEqual([]);
+ });
+});
diff --git a/packages/eve/src/compiler/development-extensions.ts b/packages/eve/src/compiler/development-extensions.ts
new file mode 100644
index 000000000..3139d65f1
--- /dev/null
+++ b/packages/eve/src/compiler/development-extensions.ts
@@ -0,0 +1,138 @@
+import { projectDiscoverDiagnostic, type CompilerDiagnostic } from "#compiler/diagnostics.js";
+import {
+ createBundledExtensionMount,
+ type BundledExtensionDescriptor,
+ type BundledExtensionMount,
+} from "#compiler/bundled-extension.js";
+import {
+ createAgentSourceRegistry,
+ createProgrammaticModuleCandidates,
+ type AgentModuleCandidate,
+ type AgentSourceRegistry,
+ type ProgrammaticAgentSource,
+} from "#compiler/source-graph.js";
+import type { AgentSourceManifest } from "#discover/manifest.js";
+import { discoverBundledExtension } from "#discover/bundled-extension.js";
+import { mountRefNamespace } from "#discover/extensions.js";
+import { resolvePackageSourceDirectoryPath } from "#internal/application/package.js";
+
+// Keep this indirect so extension-contract declaration generation does not follow the dev-only mount.
+const SELF_MODIFICATION_EXTENSION_MODULE = "#self-modification/extension/extension.js";
+
+const DEVELOPMENT_EXTENSION_IDS = ["self-modification"] as const;
+
+export type DevelopmentExtensionId = (typeof DEVELOPMENT_EXTENSION_IDS)[number];
+
+export interface DevelopmentExtensionSelection {
+ readonly enabled: readonly DevelopmentExtensionId[];
+}
+
+// Hosted bundles can retain compiler modules, so package-owned paths must stay unresolved
+// until a development extension is actually selected.
+let bundledExtensionById: ReadonlyMap<string, BundledExtensionMount> | undefined;
+let developmentSourceRegistry: AgentSourceRegistry | undefined;
+
+function getBundledExtensionById(): ReadonlyMap<string, BundledExtensionMount> {
+ if (bundledExtensionById === undefined) {
+ bundledExtensionById = new Map(
+ (
+ [
+ {
+ namespace: "self-modification",
+ sourceDirectory: resolvePackageSourceDirectoryPath("src/self-modification/extension"),
+ loadMount: async () => {
+ const { default: extension } = await import(SELF_MODIFICATION_EXTENSION_MODULE);
+ return extension({ local: { enabled: true } });
+ },
+ },
+ ] as const satisfies readonly BundledExtensionDescriptor[]
+ )
+ .map(createBundledExtensionMount)
+ .map((extension) => [extension.namespace, extension]),
+ );
+ }
+ return bundledExtensionById;
+}
+
+/** Returns the registry used only by generated local-development module maps. */
+export function getDevelopmentExtensionSourceRegistry(): AgentSourceRegistry {
+ developmentSourceRegistry ??= createAgentSourceRegistry([], {
+ extensionDeclarations: [...getBundledExtensionById().values()].map(
+ (extension): ProgrammaticAgentSource => extension.declaration,
+ ),
+ });
+ return developmentSourceRegistry;
+}
+
+const DEFAULT_DEVELOPMENT_EXTENSION_IDS: readonly DevelopmentExtensionId[] =
+ DEVELOPMENT_EXTENSION_IDS;
+const NO_DEVELOPMENT_EXTENSION_IDS: readonly DevelopmentExtensionId[] = [];
+
+export function defaultDevelopmentExtensions(): DevelopmentExtensionSelection {
+ return { enabled: DEFAULT_DEVELOPMENT_EXTENSION_IDS };
+}
+
+export function noDevelopmentExtensions(): DevelopmentExtensionSelection {
+ return { enabled: NO_DEVELOPMENT_EXTENSION_IDS };
+}
+
+/** Discovers selected bundled extensions and creates their root mount candidates. */
+export async function prepareDevelopmentExtensions(input: {
+ readonly diagnostics: CompilerDiagnostic[];
+ readonly manifest: AgentSourceManifest;
+ readonly nodeId: string;
+ readonly selection: DevelopmentExtensionSelection;
+}): Promise<{
+ readonly candidates: readonly AgentModuleCandidate[];
+ readonly manifest: AgentSourceManifest;
+}> {
+ const existingNamespaces = new Set([
+ ...input.manifest.extensions.map((extension) => mountRefNamespace(extension.logicalPath)),
+ ...input.manifest.resolvedExtensions.map((extension) => extension.namespace),
+ ]);
+ const selected = new Map<string, BundledExtensionMount>();
+ const extensionsById =
+ input.selection.enabled.length === 0 ? undefined : getBundledExtensionById();
+
+ for (const id of new Set(input.selection.enabled)) {
+ const extension = extensionsById?.get(id);
+ if (extension === undefined) throw new Error(`Unknown development extension "${id}".`);
+ const existing = selected.get(extension.namespace);
+ if (existing !== undefined && existing !== extension) {
+ throw new Error(
+ `Development extensions use namespace "${extension.namespace}" more than once.`,
+ );
+ }
+ if (existingNamespaces.has(extension.namespace)) continue;
+ existingNamespaces.add(extension.namespace);
+ selected.set(extension.namespace, extension);
+ }
+
+ const resolvedExtensions = [...input.manifest.resolvedExtensions];
+ const candidates: AgentModuleCandidate[] = [];
+ for (const extension of selected.values()) {
+ const discovered = await discoverBundledExtension({ mount: extension });
+ input.diagnostics.push(
+ ...discovered.diagnostics.map((diagnostic) =>
+ projectDiscoverDiagnostic(diagnostic, input.nodeId),
+ ),
+ );
+ resolvedExtensions.push(discovered.mount);
+ candidates.push(
+ ...createProgrammaticModuleCandidates({
+ layer: "framework-default",
+ nodeId: input.nodeId,
+ owner: { feature: extension.declaration.id, kind: "framework" },
+ registration: { applyTo: "root", source: extension.declaration },
+ }),
+ );
+ }
+
+ return {
+ candidates,
+ manifest: {
+ ...input.manifest,
+ resolvedExtensions,
+ },
+ };
+}
diff --git a/packages/eve/src/compiler/normalize-manifest-helpers.ts b/packages/eve/src/compiler/normalize-manifest-helpers.ts
index f57647325..8f7dfc61a 100644
--- a/packages/eve/src/compiler/normalize-manifest-helpers.ts
+++ b/packages/eve/src/compiler/normalize-manifest-helpers.ts
@@ -181,9 +181,9 @@ export function compileExtensionMounts(
): CompiledExtensionMount[] {
const selected = collectSelectedSourceIds(composed);
return manifest.resolvedExtensions.flatMap((mount) => {
- const mountRef = manifest.extensions.find(
- (entry) => mountRefNamespace(entry.logicalPath) === mount.namespace,
- );
+ const mountRef =
+ mount.programmaticDeclaration ??
+ manifest.extensions.find((entry) => mountRefNamespace(entry.logicalPath) === mount.namespace);
if (mountRef === undefined || !selected.has(mountRef.sourceId)) return [];
return [
{
diff --git a/packages/eve/src/compiler/normalize-manifest-types.ts b/packages/eve/src/compiler/normalize-manifest-types.ts
new file mode 100644
index 000000000..d1b7a462f
--- /dev/null
+++ b/packages/eve/src/compiler/normalize-manifest-types.ts
@@ -0,0 +1,27 @@
+import type { CompilerDiagnostic } from "#compiler/diagnostics.js";
+import type {
+ AgentModuleCandidate,
+ AgentSourceLayer,
+ AgentSourceOwner,
+ AgentSourceRegistry,
+} from "#compiler/source-graph.js";
+import type { DevelopmentExtensionSelection } from "#compiler/development-extensions.js";
+import type { AgentSourceManifest } from "#discover/manifest.js";
+
+export interface CompileAgentManifestOptions {
+ readonly developmentExtensions?: DevelopmentExtensionSelection;
+ readonly diagnostics?: CompilerDiagnostic[];
+ readonly sourceRegistries?: readonly AgentSourceRegistry[];
+}
+
+export interface NodeCompileInput {
+ readonly developmentExtensionCandidates?: readonly AgentModuleCandidate[];
+ readonly extensionScope?: { readonly namespace: string; readonly sourceRoot: string };
+ readonly inheritedExternalDependencies: readonly string[];
+ readonly isRoot: boolean;
+ readonly layer: AgentSourceLayer;
+ readonly manifest: AgentSourceManifest;
+ readonly nodeId: string;
+ readonly owner: AgentSourceOwner;
+ readonly parentNodeId?: string;
+}
diff --git a/packages/eve/src/compiler/normalize-manifest.ts b/packages/eve/src/compiler/normalize-manifest.ts
index 62a78a0fb..b2099086d 100644
--- a/packages/eve/src/compiler/normalize-manifest.ts
+++ b/packages/eve/src/compiler/normalize-manifest.ts
@@ -90,8 +90,6 @@ import {
isAgentModuleCandidate,
type AgentModuleCandidate,
type AgentSourceCandidate,
- type AgentSourceLayer,
- type AgentSourceOwner,
type AgentSourceRegistry,
canonicalSourceSlot,
} from "#compiler/source-graph.js";
@@ -99,29 +97,21 @@ import {
frameworkAgentSourceRegistry,
memoryWrapperTemplate,
} from "#framework/sources/registry.js";
-
-export interface CompileAgentManifestOptions {
- readonly diagnostics?: CompilerDiagnostic[];
- readonly sourceRegistries?: readonly AgentSourceRegistry[];
-}
-
-interface NodeCompileInput {
- readonly extensionScope?: { readonly namespace: string; readonly sourceRoot: string };
- readonly inheritedExternalDependencies: readonly string[];
- readonly isRoot: boolean;
- readonly layer: AgentSourceLayer;
- readonly manifest: AgentSourceManifest;
- readonly nodeId: string;
- readonly owner: AgentSourceOwner;
- readonly parentNodeId?: string;
-}
+import {
+ noDevelopmentExtensions,
+ prepareDevelopmentExtensions,
+} from "#compiler/development-extensions.js";
+import type {
+ CompileAgentManifestOptions,
+ NodeCompileInput,
+} from "#compiler/normalize-manifest-types.js";
+export type { CompileAgentManifestOptions } from "#compiler/normalize-manifest-types.js";
interface CompiledLocalNodeResult {
readonly descendants: readonly CompiledSubagentNode[];
readonly manifest: CompiledAgentNodeManifest;
}
-/** Compiles one discovery graph through the canonical source composition pipeline. */
export async function compileAgentManifest(
manifest: AgentSourceManifest,
options: CompileAgentManifestOptions = {},
@@ -133,12 +123,19 @@ export async function compileAgentManifest(
registries,
};
const diagnostics = options.diagnostics ?? [];
+ const developmentExtensions = await prepareDevelopmentExtensions({
+ diagnostics,
+ manifest,
+ nodeId: ROOT_COMPILED_AGENT_NODE_ID,
+ selection: options.developmentExtensions ?? noDevelopmentExtensions(),
+ });
const compiler = new AgentGraphCompiler(context, registries, diagnostics);
const root = await compiler.compileStaticNode({
+ developmentExtensionCandidates: developmentExtensions.candidates,
inheritedExternalDependencies: [],
isRoot: true,
layer: "application",
- manifest,
+ manifest: developmentExtensions.manifest,
nodeId: ROOT_COMPILED_AGENT_NODE_ID,
owner: { kind: "application" },
});
@@ -221,7 +218,6 @@ class AgentGraphCompiler {
const subagents = state.projected.subagents.filter((source) =>
selectedSourceIds.has(source.candidate.sourceId),
);
-
for (const projected of subagents) {
const source = projected.source;
const nodeId = createCompiledSubagentNodeId(input.nodeId, source.sourceId);
@@ -412,6 +408,7 @@ class AgentGraphCompiler {
});
const orderedCandidates: AgentSourceCandidate[] = [
...frameworkCandidates,
+ ...(input.developmentExtensionCandidates ?? []),
...projected.candidates,
...memoryWrapperCandidates,
...applicationCandidates,
diff --git a/packages/eve/src/compiler/source-graph-paths.ts b/packages/eve/src/compiler/source-graph-paths.ts
new file mode 100644
index 000000000..58ad6fac3
--- /dev/null
+++ b/packages/eve/src/compiler/source-graph-paths.ts
@@ -0,0 +1,62 @@
+import { isAbsolute, posix } from "node:path";
+
+import {
+ getSupportedModuleBaseName,
+ normalizeLogicalPath,
+ stripLogicalPathExtension,
+} from "#discover/filesystem.js";
+
+export function validateProgrammaticLogicalPath(input: string): string {
+ return validateProgrammaticLogicalPathInternal(input, false);
+}
+
+export function validateProgrammaticLogicalPathInternal(
+ input: string,
+ allowExtensionMount: boolean,
+): string {
+ if (input.length === 0 || isAbsolute(input) || input.includes("\\")) {
+ throw new Error(`Programmatic module logical path "${input}" must be a relative POSIX path.`);
+ }
+ const logicalPath = normalizeLogicalPath(input);
+ if (
+ logicalPath === "." ||
+ logicalPath.startsWith("../") ||
+ logicalPath.includes("/../") ||
+ posix.normalize(logicalPath) !== logicalPath
+ ) {
+ throw new Error(`Programmatic module logical path "${input}" may not traverse directories.`);
+ }
+ const segments = logicalPath.split("/");
+ const fileName = segments.at(-1)!;
+ if (getSupportedModuleBaseName(fileName) === null) {
+ throw new Error(
+ `Programmatic module logical path "${input}" must use a supported JavaScript or TypeScript extension.`,
+ );
+ }
+ const root = segments[0];
+ const extensionless = stripLogicalPathExtension(logicalPath);
+ const supported =
+ (segments.length === 1 &&
+ ["agent", "memory", "sandbox", "instrumentation"].includes(extensionless)) ||
+ (root === "sandbox" &&
+ segments.length === 2 &&
+ getSupportedModuleBaseName(fileName) === "sandbox") ||
+ ([
+ "channels",
+ "connections",
+ "hooks",
+ "instructions",
+ "memory",
+ "schedules",
+ "skills",
+ "tools",
+ ].includes(root!) &&
+ segments.length >= 2) ||
+ (allowExtensionMount && root === "extensions" && segments.length === 2);
+ if (!supported) {
+ throw new Error(
+ `Programmatic module logical path "${input}" does not select an eve module slot.`,
+ );
+ }
+ return logicalPath;
+}
diff --git a/packages/eve/src/compiler/source-graph.test.ts b/packages/eve/src/compiler/source-graph.test.ts
index dab9146fe..5260711b6 100644
--- a/packages/eve/src/compiler/source-graph.test.ts
+++ b/packages/eve/src/compiler/source-graph.test.ts
@@ -17,6 +17,7 @@ import {
type ProgrammaticAgentSource,
type ProgrammaticModuleLoadContext,
} from "#compiler/source-graph.js";
+import { createBundledExtensionMount } from "#compiler/bundled-extension.js";
import { materializeAuthoredModuleExport } from "#internal/authored-module.js";
function source(
@@ -44,6 +45,46 @@ function candidate(
})[0]!;
}
+describe("bundled extension declarations", () => {
+ it("registers a configured extension declaration without enumerating contributions", async () => {
+ const loadMount = vi.fn(async () => {
+ expect((globalThis as Record<symbol, unknown>)[Symbol.for("eve.ext-config-scope")]).toBe(
+ "eve",
+ );
+ return { config: { enabled: true }, mounted: true };
+ });
+ const mount = createBundledExtensionMount({
+ loadMount,
+ namespace: "example",
+ sourceDirectory: "/packages/example/extension",
+ });
+ const registry = createAgentSourceRegistry([], {
+ extensionDeclarations: [mount.declaration],
+ });
+ const declaration = mount.declaration.modules[0]!;
+
+ expect(declaration.logicalPath).toBe("extensions/example.ts");
+ expect(registry.sources.get(mount.declaration.id)).toMatchObject({
+ id: mount.declaration.id,
+ });
+ await expect(
+ loadProgrammaticModuleNamespace({
+ backing: {
+ kind: "programmatic",
+ moduleId: declaration.logicalPath,
+ registryId: mount.declaration.id,
+ revision: mount.declaration.revision,
+ },
+ registries: [registry],
+ }),
+ ).resolves.toEqual({ default: { config: { enabled: true }, mounted: true } });
+ expect(loadMount).toHaveBeenCalledOnce();
+ expect(
+ (globalThis as Record<symbol, unknown>)[Symbol.for("eve.ext-config-scope")],
+ ).toBeUndefined();
+ });
+});
+
describe("derived programmatic sources", () => {
it("memoizes definition factories within one module namespace", async () => {
const factory = vi.fn(() => ({ instance: Symbol("definition") }));
diff --git a/packages/eve/src/compiler/source-graph.ts b/packages/eve/src/compiler/source-graph.ts
index 3ff2fcb20..b00146185 100644
--- a/packages/eve/src/compiler/source-graph.ts
+++ b/packages/eve/src/compiler/source-graph.ts
@@ -1,10 +1,11 @@
-import { isAbsolute, posix } from "node:path";
+import { posix } from "node:path";
+import { normalizeLogicalPath, stripLogicalPathExtension } from "#discover/filesystem.js";
import {
- getSupportedModuleBaseName,
- normalizeLogicalPath,
- stripLogicalPathExtension,
-} from "#discover/filesystem.js";
+ validateProgrammaticLogicalPath,
+ validateProgrammaticLogicalPathInternal,
+} from "#compiler/source-graph-paths.js";
+export { validateProgrammaticLogicalPath } from "#compiler/source-graph-paths.js";
import { parseJsonObject, type JsonObject } from "#shared/json.js";
export type ProgrammaticModuleNamespace = Readonly<Record<string, unknown>>;
@@ -61,6 +62,8 @@ export interface AgentSourceRegistration {
}
export interface AgentSourceRegistryOptions {
+ /** Programmatic extension declarations loaded by compiled virtual mounts. */
+ readonly extensionDeclarations?: readonly ProgrammaticAgentSource[];
readonly templates?: readonly ProgrammaticAgentSource[];
}
@@ -257,12 +260,22 @@ const registeredProgrammaticTemplates = new WeakSet<RegisteredProgrammaticTempla
export function defineProgrammaticAgentSource(
input: ProgrammaticAgentSource,
+): ProgrammaticAgentSource {
+ return defineProgrammaticAgentSourceInternal(input, false);
+}
+
+function defineProgrammaticAgentSourceInternal(
+ input: ProgrammaticAgentSource,
+ allowExtensionMount: boolean,
): ProgrammaticAgentSource {
const id = expectNonEmpty(input.id, "Programmatic agent source id");
const revision = expectNonEmpty(input.revision, `Programmatic agent source "${id}" revision`);
const logicalPaths = new Set<string>();
const modules = input.modules.map((module) => {
- const logicalPath = validateProgrammaticLogicalPath(module.logicalPath);
+ const logicalPath = validateProgrammaticLogicalPathInternal(
+ module.logicalPath,
+ allowExtensionMount,
+ );
if (logicalPaths.has(logicalPath)) {
throw new Error(
`Programmatic agent source "${id}" declares "${logicalPath}" more than once.`,
@@ -287,14 +300,23 @@ export function defineProgrammaticAgentSource(
return Object.freeze({ id, modules: Object.freeze(modules), revision });
}
+export function defineProgrammaticExtensionMountDeclaration(
+ input: ProgrammaticAgentSource,
+): ProgrammaticAgentSource {
+ return defineProgrammaticAgentSourceInternal(input, true);
+}
+
export function createAgentSourceRegistry(
registrations: readonly AgentSourceRegistration[],
options: AgentSourceRegistryOptions = {},
): AgentSourceRegistry {
const sources = new Map<string, ProgrammaticAgentSource>();
const templates = new Map<string, RegisteredProgrammaticTemplate>();
- const addSource = (inputSource: ProgrammaticAgentSource): ProgrammaticAgentSource => {
- const source = defineProgrammaticAgentSource(inputSource);
+ const addSource = (
+ inputSource: ProgrammaticAgentSource,
+ allowExtensionMount = false,
+ ): ProgrammaticAgentSource => {
+ const source = defineProgrammaticAgentSourceInternal(inputSource, allowExtensionMount);
if (sources.has(source.id)) {
throw new Error(`Programmatic agent source id "${source.id}" is registered more than once.`);
}
@@ -305,6 +327,9 @@ export function createAgentSourceRegistry(
const source = addSource(registration.source);
return Object.freeze({ applyTo: registration.applyTo, source });
});
+ for (const declaration of options.extensionDeclarations ?? []) {
+ addSource(declaration, true);
+ }
for (const inputTemplate of options.templates ?? []) {
const source = addSource(inputTemplate);
if (source.modules.length !== 1) {
@@ -598,52 +623,6 @@ export function canonicalSourceSlot(logicalPath: string): string {
return withoutExtension;
}
-export function validateProgrammaticLogicalPath(input: string): string {
- if (input.length === 0 || isAbsolute(input) || input.includes("\\")) {
- throw new Error(`Programmatic module logical path "${input}" must be a relative POSIX path.`);
- }
- const logicalPath = normalizeLogicalPath(input);
- if (
- logicalPath === "." ||
- logicalPath.startsWith("../") ||
- logicalPath.includes("/../") ||
- posix.normalize(logicalPath) !== logicalPath
- ) {
- throw new Error(`Programmatic module logical path "${input}" may not traverse directories.`);
- }
- const segments = logicalPath.split("/");
- const fileName = segments.at(-1)!;
- if (getSupportedModuleBaseName(fileName) === null) {
- throw new Error(
- `Programmatic module logical path "${input}" must use a supported JavaScript or TypeScript extension.`,
- );
- }
- const root = segments[0];
- const extensionless = stripLogicalPathExtension(logicalPath);
- const supported =
- (segments.length === 1 && ["agent", "memory", "sandbox"].includes(extensionless)) ||
- (root === "sandbox" &&
- segments.length === 2 &&
- getSupportedModuleBaseName(fileName) === "sandbox") ||
- ([
- "channels",
- "connections",
- "hooks",
- "instructions",
- "memory",
- "schedules",
- "skills",
- "tools",
- ].includes(root!) &&
- segments.length >= 2);
- if (!supported) {
- throw new Error(
- `Programmatic module logical path "${input}" does not select an eve module slot.`,
- );
- }
- return logicalPath;
-}
-
export function describeAgentSourceCandidate(
candidate: AgentSourceCandidate,
): AgentSourceDescriptor {
diff --git a/packages/eve/src/discover/bundled-extension.test.ts b/packages/eve/src/discover/bundled-extension.test.ts
new file mode 100644
index 000000000..0bd21e4c5
--- /dev/null
+++ b/packages/eve/src/discover/bundled-extension.test.ts
@@ -0,0 +1,38 @@
+import { describe, expect, it } from "vitest";
+
+import { createBundledExtensionMount } from "#compiler/bundled-extension.js";
+import { discoverBundledExtension } from "#discover/bundled-extension.js";
+import { createMemoryProjectSource } from "#discover/project-source.js";
+
+describe("discoverBundledExtension", () => {
+ it("discovers the complete extension tree without declared file entries", async () => {
+ const mount = createBundledExtensionMount({
+ loadMount: async () => ({}),
+ namespace: "example",
+ sourceDirectory: "/package/extension",
+ });
+ const result = await discoverBundledExtension({
+ mount,
+ source: createMemoryProjectSource({
+ files: {
+ "/package/extension/instructions.ts": "export default {};",
+ "/package/extension/tools/first.ts": "export default {};",
+ "/package/extension/tools/nested/second.ts": "export default {};",
+ },
+ }),
+ });
+
+ expect(result.diagnostics).toEqual([]);
+ expect(result.mount.manifest.instructions.map((source) => source.logicalPath)).toEqual([
+ "instructions.ts",
+ ]);
+ expect(result.mount.manifest.tools.map((source) => source.logicalPath).sort()).toEqual([
+ "tools/first.ts",
+ "tools/nested/second.ts",
+ ]);
+ expect(result.mount.programmaticDeclaration).toEqual({
+ logicalPath: "extensions/example.ts",
+ sourceId: `${mount.declaration.id}:extensions/example.ts`,
+ });
+ });
+});
diff --git a/packages/eve/src/discover/bundled-extension.ts b/packages/eve/src/discover/bundled-extension.ts
new file mode 100644
index 000000000..44a369752
--- /dev/null
+++ b/packages/eve/src/discover/bundled-extension.ts
@@ -0,0 +1,42 @@
+import { discoverAgent } from "#discover/discover-agent.js";
+import { createDiskProjectSource, type ProjectSource } from "#discover/project-source.js";
+import type { DiscoverDiagnostic } from "#discover/diagnostics.js";
+import type { ResolvedExtensionMount } from "#discover/manifest.js";
+import type { BundledExtensionMount } from "#compiler/bundled-extension.js";
+
+export async function discoverBundledExtension(input: {
+ readonly mount: BundledExtensionMount;
+ readonly source?: ProjectSource;
+}): Promise<{
+ readonly diagnostics: readonly DiscoverDiagnostic[];
+ readonly mount: ResolvedExtensionMount;
+}> {
+ const source = input.source ?? createDiskProjectSource();
+ const result = await discoverAgent({
+ agentRoot: input.mount.sourceRoot,
+ appRoot: input.mount.packageRoot,
+ role: "extension",
+ source,
+ });
+ const declaration = input.mount.declaration.modules[0];
+ if (declaration === undefined) {
+ throw new Error(`Bundled extension "${input.mount.namespace}" has no declaration module.`);
+ }
+
+ return {
+ diagnostics: result.diagnostics,
+ mount: {
+ externalDependencies: [],
+ manifest: result.manifest,
+ namespace: input.mount.namespace,
+ packageName: input.mount.packageName,
+ packageRoot: input.mount.packageRoot,
+ programmaticDeclaration: {
+ logicalPath: declaration.logicalPath,
+ sourceId: `${input.mount.declaration.id}:${declaration.logicalPath}`,
+ },
+ sourceRoot: input.mount.sourceRoot,
+ specifier: input.mount.specifier,
+ },
+ };
+}
diff --git a/packages/eve/src/discover/manifest.ts b/packages/eve/src/discover/manifest.ts
index 0cacc1d27..66158f2b1 100644
--- a/packages/eve/src/discover/manifest.ts
+++ b/packages/eve/src/discover/manifest.ts
@@ -147,6 +147,11 @@ export type ExtensionSourceRef = ModuleSourceRef;
* consuming agent, prefixing contributions with {@link namespace}.
*/
export interface ResolvedExtensionMount {
+ /** Programmatic declaration used when the mount does not exist on disk. */
+ readonly programmaticDeclaration?: {
+ readonly logicalPath: string;
+ readonly sourceId: string;
+ };
/** Mount namespace derived from the mount filename (e.g. `crm`). */
readonly namespace: string;
/** Package specifier the mount imports (e.g. `@acme/crm`). */
diff --git a/packages/eve/src/evals/cli/eval.ts b/packages/eve/src/evals/cli/eval.ts
index 7fb52269b..2fc717923 100644
--- a/packages/eve/src/evals/cli/eval.ts
+++ b/packages/eve/src/evals/cli/eval.ts
@@ -8,6 +8,7 @@ import {
EVE_EVALUATION_ENV_FLAG,
EVE_EVALUATION_RUN_ID_ENV,
} from "#internal/application/dev-environment.js";
+import { noDevelopmentExtensions } from "#compiler/development-extensions.js";
import { createDevelopmentServer, type DevelopmentServer } from "#internal/nitro/host.js";
import { createEvalClient } from "#evals/cli/eval-client.js";
import { filterEvalsByTags } from "#evals/cli/filter.js";
@@ -151,7 +152,11 @@ export async function runEvalCommand(
// once at startup and never again.
process.env[EVE_EVALUATION_ENV_FLAG] = "1";
process.env[EVE_EVALUATION_RUN_ID_ENV] = randomUUID();
- devServer = createDevelopmentServer(appRoot, { host: "127.0.0.1", port: 0 });
+ devServer = createDevelopmentServer(appRoot, {
+ developmentExtensions: noDevelopmentExtensions(),
+ host: "127.0.0.1",
+ port: 0,
+ });
const started = await devServer.start();
client = await createEvalClient({ kind: "local", url: started.url });
target = await resolveEvalTargetHandle({
diff --git a/packages/eve/src/internal/application/package.ts b/packages/eve/src/internal/application/package.ts
index f8185f962..c2700b325 100644
--- a/packages/eve/src/internal/application/package.ts
+++ b/packages/eve/src/internal/application/package.ts
@@ -266,7 +266,43 @@ export function resolvePackageSourceDirectoryPath(relativeSourcePath: string): s
}
export function resolvePackageDependencyPath(specifier: string): string {
- return require.resolve(specifier);
+ try {
+ return require.resolve(specifier);
+ } catch (error) {
+ const packageRoot = tryResolvePackageRoot();
+ const sourcePath =
+ packageRoot === undefined || !isSourceCheckout(packageRoot)
+ ? undefined
+ : resolveSourceCheckoutExport(packageRoot, specifier);
+ if (sourcePath !== undefined) return sourcePath;
+ throw error;
+ }
+}
+
+function resolveSourceCheckoutExport(packageRoot: string, specifier: string): string | undefined {
+ if (specifier !== EVE_PACKAGE_NAME && !specifier.startsWith(`${EVE_PACKAGE_NAME}/`)) {
+ return undefined;
+ }
+ const exportKey =
+ specifier === EVE_PACKAGE_NAME ? "." : `.${specifier.slice(EVE_PACKAGE_NAME.length)}`;
+ try {
+ const manifest = JSON.parse(readFileSync(join(packageRoot, "package.json"), "utf8")) as {
+ exports?: Record<string, string | Record<string, string>>;
+ };
+ const declaration = manifest.exports?.[exportKey];
+ const target =
+ typeof declaration === "string"
+ ? declaration
+ : (declaration?.["eve-source"] ?? declaration?.import ?? declaration?.default);
+ if (target === undefined) return undefined;
+ const sourceRelativePath = target
+ .replace(/^\.\/dist\/src\//, "src/")
+ .replace(/\.[cm]?js$/u, ".ts");
+ const sourcePath = join(packageRoot, sourceRelativePath);
+ return existsSync(sourcePath) ? sourcePath : undefined;
+ } catch {
+ return undefined;
+ }
}
/**
diff --git a/packages/eve/src/internal/authored-module-loader.ts b/packages/eve/src/internal/authored-module-loader.ts
index 21c08bdc4..28d40dc24 100644
--- a/packages/eve/src/internal/authored-module-loader.ts
+++ b/packages/eve/src/internal/authored-module-loader.ts
@@ -285,7 +285,9 @@ export async function bundleAuthoredModuleMapForGeneration(input: {
// owns authored workflow IDs and must match the workflow driver.
const packageRoot = resolveAuthoredPackageRoot(input.manifest.agentRoot);
const programmaticLoaderImportSpecifier = resolvePackageSourceFilePath(
- "src/internal/programmatic-source-loader.ts",
+ usesDevelopmentExtensionModules(input.manifest)
+ ? "src/internal/development-programmatic-source-loader.ts"
+ : "src/internal/programmatic-source-loader.ts",
);
const externalDependencies = normalizeExternalDependencies([
...(input.manifest.config.build?.externalDependencies ?? []),
@@ -360,6 +362,16 @@ export async function bundleAuthoredModuleMapForGeneration(input: {
}
}
+function usesDevelopmentExtensionModules(manifest: CompiledAgentManifest): boolean {
+ return [manifest, ...manifest.subagents.map((subagent) => subagent.agent)].some((node) =>
+ Object.values(node.bindings).some(
+ (binding) =>
+ binding.backing.kind === "programmatic" &&
+ binding.backing.registryId.startsWith("eve:development-extension:"),
+ ),
+ );
+}
+
function createExternalRuntimeImportPlugin(importSpecifier: string): Record<string, unknown> {
const normalizedImportSpecifier = normalizeEsmImportSpecifier(importSpecifier);
return {
diff --git a/packages/eve/src/internal/development-programmatic-source-loader.ts b/packages/eve/src/internal/development-programmatic-source-loader.ts
new file mode 100644
index 000000000..33183ecff
--- /dev/null
+++ b/packages/eve/src/internal/development-programmatic-source-loader.ts
@@ -0,0 +1,24 @@
+import {
+ loadProgrammaticModuleNamespace,
+ memoizeModuleNamespaceFactories,
+ type AgentModuleBacking,
+ type ProgrammaticModuleNamespace,
+} from "#compiler/source-graph.js";
+import { getDevelopmentExtensionSourceRegistry } from "#compiler/development-extensions.js";
+import { frameworkAgentSourceRegistry } from "#framework/sources/registry.js";
+
+/** Loads framework and development-extension programmatic modules for local dev maps. */
+export async function loadFrameworkProgrammaticModule(
+ backing: Extract<AgentModuleBacking, { readonly kind: "programmatic" }>,
+ dependencyNamespaces?: Readonly<Record<string, ProgrammaticModuleNamespace>>,
+): Promise<ProgrammaticModuleNamespace> {
+ return memoizeModuleNamespaceFactories(
+ await loadProgrammaticModuleNamespace({
+ backing,
+ dependencyNamespaces,
+ registries: [frameworkAgentSourceRegistry, getDevelopmentExtensionSourceRegistry()],
+ }),
+ );
+}
+
+export { memoizeModuleNamespaceFactories } from "#compiler/source-graph.js";
diff --git a/packages/eve/src/internal/nitro/dev-runtime-artifacts.integration.test.ts b/packages/eve/src/internal/nitro/dev-runtime-artifacts.integration.test.ts
index 76377cab2..47abc3a5c 100644
--- a/packages/eve/src/internal/nitro/dev-runtime-artifacts.integration.test.ts
+++ b/packages/eve/src/internal/nitro/dev-runtime-artifacts.integration.test.ts
@@ -1033,9 +1033,14 @@ describe("development runtime artifact snapshots", () => {
{
agent: {
agentRoot: reviewerRoot,
- appRoot: extensionRoot,
+ appRoot: packageRoot,
extensionMounts: [{ sourceRoot: extensionRoot }],
},
+ owner: {
+ kind: "extension",
+ namespace: "crm",
+ packageName: "@acme/crm",
+ },
},
],
};
@@ -1057,7 +1062,7 @@ describe("development runtime artifact snapshots", () => {
expect(rewrittenManifest.subagents[0]?.agent).toMatchObject({
agentRoot: join(
- snapshot.snapshotSourceRoot,
+ snapshot.runtimeAppRoot,
"node_modules",
"@acme",
"crm",
@@ -1066,14 +1071,7 @@ describe("development runtime artifact snapshots", () => {
"subagents",
"reviewer",
),
- appRoot: join(
- snapshot.snapshotSourceRoot,
- "node_modules",
- "@acme",
- "crm",
- "dist",
- "extension",
- ),
+ appRoot: join(snapshot.runtimeAppRoot, "node_modules", "@acme", "crm"),
});
expect(
existsSync(
diff --git a/packages/eve/src/internal/nitro/dev-runtime-artifacts.ts b/packages/eve/src/internal/nitro/dev-runtime-artifacts.ts
index c36d59c53..834c7d34a 100644
--- a/packages/eve/src/internal/nitro/dev-runtime-artifacts.ts
+++ b/packages/eve/src/internal/nitro/dev-runtime-artifacts.ts
@@ -111,6 +111,11 @@ export async function stageDevelopmentRuntimeArtifactsSnapshot(
);
await rewriteSnapshotCompiledManifest({
appRoot: compileResult.project.appRoot,
+ extensionPackageRoots: (compileResult.manifest?.subagents ?? []).flatMap((subagent) =>
+ subagent.owner.kind === "extension"
+ ? [{ sourceRoot: subagent.agent.appRoot, packageName: subagent.owner.packageName }]
+ : [],
+ ),
manifestPath: join(
sourceSnapshotPlan.runtimeAppRoot,
".eve",
@@ -429,8 +434,14 @@ function readDevelopmentRuntimeArtifactsPointer(
}
}
+interface ExtensionPackageRoot {
+ readonly sourceRoot: string;
+ readonly packageName: string;
+}
+
async function rewriteSnapshotCompiledManifest(input: {
readonly appRoot: string;
+ readonly extensionPackageRoots: readonly ExtensionPackageRoot[];
readonly manifestPath: string;
readonly runtimeAppRoot: string;
readonly snapshotSourceRoot: string;
@@ -439,6 +450,7 @@ async function rewriteSnapshotCompiledManifest(input: {
const manifest = JSON.parse(await readFile(input.manifestPath, "utf8")) as unknown;
const rewritten = rewriteManifestRoots({
appRoot: input.appRoot,
+ extensionPackageRoots: input.extensionPackageRoots,
runtimeAppRoot: input.runtimeAppRoot,
snapshotSourceRoot: input.snapshotSourceRoot,
sourceRoot: input.sourceRoot,
@@ -450,6 +462,7 @@ async function rewriteSnapshotCompiledManifest(input: {
function rewriteManifestRoots(input: {
readonly appRoot: string;
+ readonly extensionPackageRoots: readonly ExtensionPackageRoot[];
readonly runtimeAppRoot: string;
readonly snapshotSourceRoot: string;
readonly sourceRoot: string;
@@ -466,17 +479,20 @@ function rewriteManifestRoots(input: {
const rewritten: Record<string, unknown> = {};
for (const [key, value] of Object.entries(input.value)) {
if (typeof value === "string" && (key === "appRoot" || key === "agentRoot")) {
- rewritten[key] = isPathInsideOrEqual(value, input.appRoot)
- ? rewritePathWithinAppRoot({
- appRoot: input.appRoot,
- path: value,
- runtimeAppRoot: input.runtimeAppRoot,
- })
- : rewritePathWithinSourceRoot({
- path: value,
- snapshotSourceRoot: input.snapshotSourceRoot,
- sourceRoot: input.sourceRoot,
- });
+ rewritten[key] =
+ isPathInsideOrEqual(value, input.appRoot) ||
+ input.extensionPackageRoots.some((root) => isPathInsideOrEqual(value, root.sourceRoot))
+ ? rewritePathWithinAppRoot({
+ appRoot: input.appRoot,
+ extensionPackageRoots: input.extensionPackageRoots,
+ path: value,
+ runtimeAppRoot: input.runtimeAppRoot,
+ })
+ : rewritePathWithinSourceRoot({
+ path: value,
+ snapshotSourceRoot: input.snapshotSourceRoot,
+ sourceRoot: input.sourceRoot,
+ });
continue;
}
@@ -491,6 +507,7 @@ function rewriteManifestRoots(input: {
rewritten[key] = rewriteManifestRoots({
appRoot: input.appRoot,
+ extensionPackageRoots: input.extensionPackageRoots,
runtimeAppRoot: input.runtimeAppRoot,
snapshotSourceRoot: input.snapshotSourceRoot,
sourceRoot: input.sourceRoot,
@@ -519,11 +536,24 @@ function rewritePathWithinSourceRoot(input: {
function rewritePathWithinAppRoot(input: {
readonly appRoot: string;
+ readonly extensionPackageRoots: readonly ExtensionPackageRoot[];
readonly path: string;
readonly runtimeAppRoot: string;
}): string {
if (!isPathInsideOrEqual(input.path, input.appRoot)) {
- return input.path;
+ // Extension subagents retain package-owned roots at compile time; runtime
+ // code is materialized separately, but their metadata must be snapshot-local.
+ const extension = input.extensionPackageRoots.find((root) =>
+ isPathInsideOrEqual(input.path, root.sourceRoot),
+ );
+ return extension === undefined
+ ? input.path
+ : join(
+ input.runtimeAppRoot,
+ "node_modules",
+ extension.packageName,
+ relative(extension.sourceRoot, input.path),
+ );
}
const relativePath = relative(input.appRoot, input.path);
diff --git a/packages/eve/src/internal/nitro/host/dev-authored-rebuild-coordinator.ts b/packages/eve/src/internal/nitro/host/dev-authored-rebuild-coordinator.ts
index be4e5e9c7..8edf8dbe7 100644
--- a/packages/eve/src/internal/nitro/host/dev-authored-rebuild-coordinator.ts
+++ b/packages/eve/src/internal/nitro/host/dev-authored-rebuild-coordinator.ts
@@ -4,6 +4,7 @@ import { buildDevelopmentHostCandidate } from "#internal/nitro/host/dev-host-can
import { computeDevelopmentHostFingerprint } from "#internal/nitro/host/dev-host-fingerprint.js";
import { removeDevelopmentHostWorkspace } from "#internal/nitro/host/dev-host-workspace.js";
import { prepareDevelopmentApplicationHost } from "#internal/nitro/host/prepare-application-host.js";
+import type { DevelopmentExtensionSelection } from "#compiler/development-extensions.js";
import { DrainedNitroDevServer } from "#internal/nitro/host/drained-nitro-dev-server.js";
import { usesParentDevelopmentWorkflowWorld } from "#internal/workflow/development-world-protocol.js";
import type { PreparedDevelopmentApplicationHost } from "#internal/nitro/host/types.js";
@@ -53,11 +54,13 @@ export interface DevelopmentAuthoredRebuildCoordinator {
}
export async function createDevelopmentAuthoredRebuildCoordinator(input: {
+ readonly developmentExtensions?: DevelopmentExtensionSelection;
readonly devServer: DrainedNitroDevServer;
readonly initialHost: PreparedDevelopmentApplicationHost;
}): Promise<DevelopmentAuthoredRebuildCoordinator> {
return new TransactionalDevelopmentAuthoredRebuildCoordinator({
currentHostFingerprint: await computeDevelopmentHostFingerprint(input.initialHost),
+ developmentExtensions: input.developmentExtensions,
currentRuntimeFingerprint: input.initialHost.generation.fingerprint,
devServer: input.devServer,
initialHost: input.initialHost,
@@ -78,17 +81,20 @@ class TransactionalDevelopmentAuthoredRebuildCoordinator implements DevelopmentA
#currentHost: PreparedDevelopmentApplicationHost;
#currentHostFingerprint: string;
#currentRuntimeFingerprint: string;
+ readonly #developmentExtensions: DevelopmentExtensionSelection | undefined;
readonly #devServer: DrainedNitroDevServer;
readonly #usesParentWorkflowWorld: boolean;
constructor(input: {
readonly currentHostFingerprint: string;
readonly currentRuntimeFingerprint: string;
+ readonly developmentExtensions: DevelopmentExtensionSelection | undefined;
readonly devServer: DrainedNitroDevServer;
readonly initialHost: PreparedDevelopmentApplicationHost;
}) {
this.#currentHost = input.initialHost;
this.#currentHostFingerprint = input.currentHostFingerprint;
+ this.#developmentExtensions = input.developmentExtensions;
this.#currentRuntimeFingerprint = input.currentRuntimeFingerprint;
this.#devServer = input.devServer;
this.#usesParentWorkflowWorld = usesParentDevelopmentWorkflowWorld(
@@ -110,6 +116,7 @@ class TransactionalDevelopmentAuthoredRebuildCoordinator implements DevelopmentA
try {
nextHost = await prepareDevelopmentApplicationHost(previousHost.appRoot, {
changedPaths: input.changedPaths,
+ developmentExtensions: this.#developmentExtensions,
previousExtensions: previousHost.workspaceExtensions,
});
if (
diff --git a/packages/eve/src/internal/nitro/host/prepare-application-host.scenario.test.ts b/packages/eve/src/internal/nitro/host/prepare-application-host.scenario.test.ts
index 0654328d8..a0032aa79 100644
--- a/packages/eve/src/internal/nitro/host/prepare-application-host.scenario.test.ts
+++ b/packages/eve/src/internal/nitro/host/prepare-application-host.scenario.test.ts
@@ -4,6 +4,8 @@ import { join } from "node:path";
import { afterEach, describe, expect, it, vi } from "vitest";
+import { defaultDevelopmentExtensions } from "#compiler/development-extensions.js";
+import { compiledAgentManifestSchema } from "#compiler/manifest.js";
import { normalizeEsmImportSpecifier } from "#internal/application/import-specifier.js";
import {
createApplicationBuildWorkspace,
@@ -77,6 +79,33 @@ describe("application host preparation", () => {
}
});
+ it("stages the bundled development extension subagent outside the eve workspace", async () => {
+ const { appRoot } = await createAppRoot("eve-bundled-dev-extension-", {
+ files: {
+ "agent/agent.mjs": 'export default { model: "openai/gpt-5.4" };\n',
+ "agent/instructions.md": "Help Alice maintain her agent.",
+ },
+ packageName: "bundled-dev-extension",
+ });
+ const host = await prepareDevelopmentApplicationHost(appRoot, {
+ developmentExtensions: defaultDevelopmentExtensions(),
+ });
+ const manifest = compiledAgentManifestSchema.parse(
+ JSON.parse(
+ await readFile(
+ join(host.generation.runtimeAppRoot, ".eve", "compile", "compiled-agent-manifest.json"),
+ "utf8",
+ ),
+ ),
+ );
+ const subagent = manifest.subagents.find((node) => node.name === "self-modification__agent");
+ expect(subagent).toBeDefined();
+ expect(subagent!.agent.appRoot).toBe(
+ join(host.generation.runtimeAppRoot, "node_modules", "eve"),
+ );
+ expect(subagent!.agent.agentRoot.startsWith(`${subagent!.agent.appRoot}/`)).toBe(true);
+ });
+
it("keeps Nitro host inputs outside retained runtime generations", async () => {
const { agentRoot, appRoot } = await createAppRoot("eve-stable-dev-host-artifacts-", {
files: {
diff --git a/packages/eve/src/internal/nitro/host/prepare-application-host.ts b/packages/eve/src/internal/nitro/host/prepare-application-host.ts
index 78c647dda..8ec7b740a 100644
--- a/packages/eve/src/internal/nitro/host/prepare-application-host.ts
+++ b/packages/eve/src/internal/nitro/host/prepare-application-host.ts
@@ -1,4 +1,5 @@
import { compileAgentInWorkspace, type CompileAgentResult } from "#compiler/compile-agent.js";
+import type { DevelopmentExtensionSelection } from "#compiler/development-extensions.js";
import { createScheduleRegistrations } from "#runtime/schedules/register.js";
import { resolveSchedules } from "#runtime/schedules/resolve-schedule.js";
import type { ResolvedScheduleDefinition } from "#runtime/types.js";
@@ -34,6 +35,7 @@ export async function prepareDevelopmentApplicationHost(
appRoot: string,
options: {
readonly changedPaths?: readonly string[];
+ readonly developmentExtensions?: DevelopmentExtensionSelection;
readonly previousExtensions?: readonly DevelopmentWorkspaceExtension[];
} = {},
): Promise<PreparedDevelopmentApplicationHost> {
@@ -58,6 +60,7 @@ export async function prepareDevelopmentApplicationHost(
publishedRoot: join(appRoot, ".eve"),
writeRoot: workspace.compilerArtifactsDir,
},
+ developmentExtensions: options.developmentExtensions,
startPath: appRoot,
});
const schedules = await resolveSchedules({ manifest: compileResult.manifest });
diff --git a/packages/eve/src/internal/nitro/host/start-development-server.test.ts b/packages/eve/src/internal/nitro/host/start-development-server.test.ts
index dca85ed04..0486d34b6 100644
--- a/packages/eve/src/internal/nitro/host/start-development-server.test.ts
+++ b/packages/eve/src/internal/nitro/host/start-development-server.test.ts
@@ -387,7 +387,9 @@ describe("createDevelopmentServer", () => {
const server = await startDevelopmentServer("/tmp/eve-test");
- expect(mocks.prepareDevelopmentApplicationHost).toHaveBeenCalledWith("/tmp/eve-test");
+ expect(mocks.prepareDevelopmentApplicationHost).toHaveBeenCalledWith("/tmp/eve-test", {
+ developmentExtensions: { enabled: ["self-modification"] },
+ });
expect(mocks.pruneLocalSandboxTemplatesInBackground).toHaveBeenCalledWith("/tmp/eve-test");
expect(mocks.createParentDevelopmentWorkflowWorld).toHaveBeenCalledWith(
expect.objectContaining({ agentName: "test-agent", appRoot: "/tmp/eve-test" }),
diff --git a/packages/eve/src/internal/nitro/host/start-development-server.ts b/packages/eve/src/internal/nitro/host/start-development-server.ts
index 022df1b3b..6475f2cee 100644
--- a/packages/eve/src/internal/nitro/host/start-development-server.ts
+++ b/packages/eve/src/internal/nitro/host/start-development-server.ts
@@ -1,5 +1,6 @@
import { handleDevelopmentModelCredentialRequest } from "#internal/model-auth/development-broker-server.js";
import { EVE_DEV_ENV_FLAG } from "#internal/application/optional-package-install.js";
+import { defaultDevelopmentExtensions } from "#compiler/development-extensions.js";
import type { Nitro } from "nitro/types";
@@ -388,13 +389,17 @@ async function startNitroDevelopmentServer(
// optional sandbox engine packages) can gate on it.
process.env[EVE_DEV_ENV_FLAG] ??= "1";
+ const developmentExtensions = options.developmentExtensions ?? defaultDevelopmentExtensions();
const project = await resolveDiscoveryProject(rootDir);
await loadDevelopmentEnvironmentFiles(project.appRoot);
const environmentPort = readEnvironmentPort();
const requestedPort = options.port ?? environmentPort;
- const hasExplicitEndpoint =
- options.host !== undefined || options.port !== undefined || environmentPort !== undefined;
+ const hasExplicitServerConfiguration =
+ options.developmentExtensions !== undefined ||
+ options.host !== undefined ||
+ options.port !== undefined ||
+ environmentPort !== undefined;
const state = new DevelopmentServerState(project);
const existingServerUrl = await state.read();
@@ -403,7 +408,7 @@ async function startNitroDevelopmentServer(
isLoopbackServerUrl(existingServerUrl) &&
(await isDevelopmentServerReady(existingServerUrl))
) {
- if (options.existing === "attach-if-unconfigured" && !hasExplicitEndpoint) {
+ if (options.existing === "attach-if-unconfigured" && !hasExplicitServerConfiguration) {
return {
handle: { kind: "existing", appRoot: project.appRoot, url: existingServerUrl },
close: undefined,
@@ -429,7 +434,7 @@ async function startNitroDevelopmentServer(
try {
const preparedHost = await devBootPhase(
"compiling agent",
- () => prepareDevelopmentApplicationHost(project.appRoot),
+ () => prepareDevelopmentApplicationHost(project.appRoot, { developmentExtensions }),
options.onBootProgress,
);
preparedDevelopmentHost = preparedHost;
@@ -516,6 +521,7 @@ async function startNitroDevelopmentServer(
await workflowWorld?.start();
const rebuildCoordinator = await createDevelopmentAuthoredRebuildCoordinator({
+ developmentExtensions,
devServer: activeDevServer,
initialHost: preparedHost,
});
diff --git a/packages/eve/src/internal/nitro/host/types.ts b/packages/eve/src/internal/nitro/host/types.ts
index cb7888fdb..302662064 100644
--- a/packages/eve/src/internal/nitro/host/types.ts
+++ b/packages/eve/src/internal/nitro/host/types.ts
@@ -3,6 +3,7 @@ import type { ScheduleRegistration } from "#runtime/schedules/register.js";
import type { ResolvedScheduleDefinition } from "#runtime/types.js";
import type { GeneratedCompiledArtifactsFiles } from "#internal/application/compiled-artifacts.js";
import type { DevBootProgressReporter } from "#internal/dev-boot-progress.js";
+import type { DevelopmentExtensionSelection } from "#compiler/development-extensions.js";
import type { DevelopmentGeneration } from "#internal/nitro/development-generation.js";
import type { DevelopmentHostWorkspace } from "#internal/nitro/host/dev-host-workspace.js";
import type { DevelopmentWorkspaceExtension } from "#internal/nitro/host/dev-workspace-extensions.js";
@@ -62,6 +63,8 @@ export interface DevelopmentServer<H extends DevelopmentServerHandle = Developme
}
export interface DevelopmentServerOptions {
+ /** Development-only source extensions. Defaults to the framework catalog. */
+ readonly developmentExtensions?: DevelopmentExtensionSelection;
readonly existing?: "attach-if-unconfigured" | "reject";
readonly host?: string;
readonly onBootProgress?: DevBootProgressReporter;
diff --git a/packages/eve/src/self-modification/extension/subagents/agent/instructions.test.ts b/packages/eve/src/self-modification/extension/subagents/agent/instructions.test.ts
new file mode 100644
index 000000000..8b8d7a088
--- /dev/null
+++ b/packages/eve/src/self-modification/extension/subagents/agent/instructions.test.ts
@@ -0,0 +1,25 @@
+import { describe, expect, it } from "vitest";
+
+import instructions from "./instructions.js";
+
+describe("self-modification subagent instructions", () => {
+ it("handles a bundled mount that is not visible until the next turn", () => {
+ const originalEveDev = process.env.EVE_DEV;
+ process.env.EVE_DEV = "1";
+ try {
+ const resolved = instructions.events["session.started"]?.({ data: {} }, {} as never);
+
+ expect(resolved).toMatchObject({
+ markdown: expect.stringContaining(
+ "first call registry_add with the exact address eve/self-modification",
+ ),
+ });
+ expect(resolved).toMatchObject({
+ markdown: expect.stringContaining("Check /source/extensions/self-modification.ts"),
+ });
+ } finally {
+ if (originalEveDev === undefined) delete process.env.EVE_DEV;
+ else process.env.EVE_DEV = originalEveDev;
+ }
+ });
+});
diff --git a/packages/eve/src/self-modification/extension/subagents/agent/instructions.ts b/packages/eve/src/self-modification/extension/subagents/agent/instructions.ts
index ee0323b15..57a5806aa 100644
--- a/packages/eve/src/self-modification/extension/subagents/agent/instructions.ts
+++ b/packages/eve/src/self-modification/extension/subagents/agent/instructions.ts
@@ -73,14 +73,11 @@ The configured target branch is checked out as a disposable workspace under /wor
Complete all edits and registry installations before publication, and call publish by itself. Before publication, review and summarize the complete intended scope. Call publish once with a concise title and summary. A successful result is only a draft pull request. Return its URL and changed paths, and state that merge and deployment have not occurred.`;
-function packagedSubagentGuidance(event: unknown): string {
- const invocation = (
- event as { readonly data?: { readonly invocation?: { readonly kind?: string } } }
- ).data?.invocation;
- if (invocation?.kind !== "subagent") return "";
+const packagedSubagentGuidance = `## Configure this subagent
- return "This self-modification subagent is implemented by the eve package, not an authored directory under /source. Configure its model, reasoning, and policy in /source/extensions/self-modification/extension.ts; do not search for or edit a child implementation directory.";
-}
+Configure this self-modification subagent's model, reasoning, and policy only through its authored mount. Check /source/extensions/self-modification.ts and /source/extensions/self-modification/extension.ts; modify whichever exists. If neither file exists, this subagent is the bundled eve development default and is using the default settings: first call registry_add with the exact address eve/self-modification to scaffold the authored mount. This known scaffold does not require search_registry.
+
+After registry_add reports successful installation, try to read /source/extensions/self-modification.ts and /source/extensions/self-modification/extension.ts. If either is available, modify it. If neither is yet available, you may need to wait for the next turn, by asking the requester to confirm.`;
function readTrace(
event: unknown,
@@ -117,7 +114,7 @@ export default defineDynamic({
markdown: renderInstructions([
role,
sourceWorkspace,
- packagedSubagentGuidance(event),
+ packagedSubagentGuidance,
sourceEditing,
toolAuthoring,
registryWorkflow,
diff --git a/packages/eve/src/self-modification/package-consumption.scenario.test.ts b/packages/eve/src/self-modification/package-consumption.scenario.test.ts
index cff220d9e..4f9e451b0 100644
--- a/packages/eve/src/self-modification/package-consumption.scenario.test.ts
+++ b/packages/eve/src/self-modification/package-consumption.scenario.test.ts
@@ -143,6 +143,22 @@ describe("packed package consumption", () => {
appRoot,
);
await access(join(appRoot, "node_modules/eve/dist/src/self-modification/agent.js"));
+ await writeAppFile(
+ appRoot,
+ "verify-development-extension.mjs",
+ `import { defaultDevelopmentExtensions } from "./node_modules/eve/dist/src/compiler/development-extensions.js";
+import { compileAgentManifest } from "./node_modules/eve/dist/src/compiler/normalize-manifest.js";
+import { createAgentSourceManifest } from "./node_modules/eve/dist/src/discover/manifest.js";
+
+const manifest = createAgentSourceManifest({ agentId: "packed-dev", agentRoot: "/virtual/agent", appRoot: "/virtual" });
+const compiled = await compileAgentManifest(manifest, { developmentExtensions: defaultDevelopmentExtensions() });
+const subagent = compiled.subagents.find((entry) => entry.name === "self-modification__agent");
+if (compiled.subagents.length !== 1 || subagent === undefined || !subagent.agent.tools.some((tool) => tool.name === "edit_file")) {
+ throw new Error("Packed eve did not discover the bundled self-modification extension.");
+}
+`,
+ );
+ await run("node", ["verify-development-extension.mjs"], appRoot);
const build = await run("pnpm", ["build"], appRoot);
const output = `${build.stdout}\n${build.stderr}`;
if (output.includes("Could not resolve '#shared/")) {
diff --git a/packages/eve/test/scenarios/app-runtime-dependencies.scenario.test.ts b/packages/eve/test/scenarios/app-runtime-dependencies.scenario.test.ts
index 66e571316..a7d66939a 100644
--- a/packages/eve/test/scenarios/app-runtime-dependencies.scenario.test.ts
+++ b/packages/eve/test/scenarios/app-runtime-dependencies.scenario.test.ts
@@ -867,7 +867,23 @@ describe("app runtime dependency tracing", () => {
// semantic-error catalog embeds error-class names like
// `DataDirAccessError`, and @workflow/core's runtime world factory
// (stubbed out at vendor time) names `WORKFLOW_LOCAL_DATA_DIR`.
- if (vercel) expect(runtimeSource).not.toContain("[world-local]");
+ if (vercel) {
+ expect(runtimeSource).not.toContain("[world-local]");
+
+ vi.stubEnv("VERCEL_DEPLOYMENT_ID", "dpl_hosted_no_dev_runtime_test");
+ const serverModule = (await import(
+ `${pathToFileURL(join(outputDir, "functions", "__server.func", "index.mjs")).href}?test=${Date.now()}`
+ )) as {
+ default: {
+ fetch(request: Request, context: { waitUntil(): void }): Promise<Response>;
+ };
+ };
+ const healthResponse = await serverModule.default.fetch(
+ new Request("https://example.com/eve/v1/health"),
+ { waitUntil() {} },
+ );
+ expect(healthResponse.status).toBe(200);
+ }
},
30_000,
);
diff --git a/packages/eve/test/scenarios/dev-server-bun.scenario.test.ts b/packages/eve/test/scenarios/dev-server-bun.scenario.test.ts
index 7cd0cf632..84179a6b8 100644
--- a/packages/eve/test/scenarios/dev-server-bun.scenario.test.ts
+++ b/packages/eve/test/scenarios/dev-server-bun.scenario.test.ts
@@ -71,7 +71,10 @@ describe("eve dev server with bun", () => {
async () => {
const app = await scenarioApp(BUN_LAYOUT_DESCRIPTOR);
- const result = await runEveDevToExit(app.appRoot, { runtime: "bun" });
+ const result = await runEveDevToExit(app.appRoot, {
+ defaultExtensions: false,
+ runtime: "bun",
+ });
expect(result.code).not.toBe(0);
expect(result.output).toContain("failed before readiness");
diff --git a/packages/eve/test/scenarios/dev-server-harness.ts b/packages/eve/test/scenarios/dev-server-harness.ts
index 336093102..0b49ac84f 100644
--- a/packages/eve/test/scenarios/dev-server-harness.ts
+++ b/packages/eve/test/scenarios/dev-server-harness.ts
@@ -32,6 +32,7 @@ export interface RunningEveDev {
}
export interface StartEveDevOptions {
+ readonly defaultExtensions?: boolean;
readonly env?: Readonly<Record<string, string | undefined>>;
/** Runtime executing the CLI. Defaults to the current Node executable. */
readonly runtime?: "bun" | "node";
@@ -220,7 +221,10 @@ function spawnEveDev(
const eveBinPath = join(appRoot, "node_modules", "eve", "bin", "eve.js");
const command = options.runtime === "bun" ? "bun" : process.execPath;
- return spawn(command, [eveBinPath, "dev", "--no-ui", "--host", "127.0.0.1", "--port", "0"], {
+ const args = [eveBinPath, "dev", "--no-ui", "--host", "127.0.0.1", "--port", "0"];
+ if (options.defaultExtensions === false) args.push("--no-default-extensions");
+
+ return spawn(command, args, {
cwd: appRoot,
env: {
...process.env,