The Open Framework for Building Agents
feat(eve): batch integration setup deploys (#1668)
OwenKephart2c16f3140cc5
diff --git a/.changeset/tidy-add-deploy-loop.md b/.changeset/tidy-add-deploy-loop.mdnew file mode 100644index 000000000..6b7951495--- /dev/null+++ b/.changeset/tidy-add-deploy-loop.md@@ -0,0 +1,5 @@+---+"eve": patch+---++Let `/add` collect multiple deployable integrations before creating one production deployment. After each deployable setup, `/add` offers to add more by default, deploy to production, or finish, while keeping setup details for the final result.diff --git a/packages/eve/src/cli/commands/integration-setup.test.ts b/packages/eve/src/cli/commands/integration-setup.test.tsindex 925631d59..2785d92ce 100644--- a/packages/eve/src/cli/commands/integration-setup.test.ts+++ b/packages/eve/src/cli/commands/integration-setup.test.ts@@ -26,7 +26,10 @@ afterEach(() => {describe("runIntegrationSetupCommand", () => {it("delegates registry-owned setup to the integration runner", async () => {- vi.mocked(runIntegrationSetup).mockResolvedValue({ kind: "done" });+ vi.mocked(runIntegrationSetup).mockResolvedValue({+ kind: "done",+ completion: { facts: [] },+ });const output = logger();const fake = createFakePrompter();diff --git a/packages/eve/src/cli/commands/integration-setup.ts b/packages/eve/src/cli/commands/integration-setup.tsindex d775dbb31..fbde737bd 100644--- a/packages/eve/src/cli/commands/integration-setup.ts+++ b/packages/eve/src/cli/commands/integration-setup.ts@@ -54,7 +54,7 @@ export async function runIntegrationSetupCommand(return;}prompter.outro("Integration set up.");- client?.complete(result.facts);+ client?.complete(result.completion);} catch (error) {client?.fail(error);logger.error(error instanceof Error ? error.message : String(error));diff --git a/packages/eve/src/cli/commands/registry-declared-setups.ts b/packages/eve/src/cli/commands/registry-declared-setups.tsnew file mode 100644index 000000000..4c93363bf--- /dev/null+++ b/packages/eve/src/cli/commands/registry-declared-setups.ts@@ -0,0 +1,52 @@+import { createPrompter, type Prompter } from "#setup/prompter.js";+import { mergeRegistrySetupCompletions } from "#setup/registry-setup-completion.js";+import type { RegistrySetupCompletion } from "#setup/registry-setup-protocol.js";++import type { RegistryCommandLogger, RegistrySetupDependencies } from "./registry.js";+import type { RegistrySetupCommand } from "./registry-setup-command.js";++export interface DeclaredSetupOptions {+ yes?: boolean;+ silent?: boolean;+ prompter?: Prompter;+ signal?: AbortSignal;+}++/** Runs and combines the setup commands declared by one registry item. */+export async function runDeclaredSetups(input: {+ logger: RegistryCommandLogger;+ appRoot: string;+ item: string;+ setups: readonly RegistrySetupCommand[] | undefined;+ options: DeclaredSetupOptions;+ dependencies: RegistrySetupDependencies;+ cancelledReminder: string;+ resumeCommand: string;+}): Promise<RegistrySetupCompletion | false> {+ let completion: RegistrySetupCompletion = { facts: [] };+ if (input.setups === undefined) return completion;+ const runSetupCommand = await input.dependencies.loadSetupCommandRunner();+ const prompter = input.options.prompter ?? createPrompter();+ try {+ for (const setup of input.setups) {+ const result = await runSetupCommand(+ input.appRoot,+ { ...setup, args: [...setup.args, ...(input.options.yes ? ["--yes"] : [])] },+ input.item,+ { prompter, signal: input.options.signal },+ );+ if (result.kind === "cancelled") {+ input.logger.log(input.cancelledReminder);+ return false;+ }+ if (input.options.silent !== true) {+ for (const fact of result.facts) input.logger.log(`${fact.label}: ${fact.value}`);+ }+ completion = mergeRegistrySetupCompletions(completion, result);+ }+ return completion;+ } catch (error) {+ const message = error instanceof Error ? error.message : String(error);+ throw new Error(`${message} Try again with \`${input.resumeCommand}\`.`);+ }+}diff --git a/packages/eve/src/cli/commands/registry-package.ts b/packages/eve/src/cli/commands/registry-package.tsindex d8297a3dd..2ee028786 100644--- a/packages/eve/src/cli/commands/registry-package.ts+++ b/packages/eve/src/cli/commands/registry-package.ts@@ -5,6 +5,8 @@ import {} from "#compiled/shadcn-registry/index.js";import { z } from "#compiled/zod/index.js";import { createPrompter, type Prompter } from "#setup/prompter.js";+import { mergeRegistrySetupCompletions } from "#setup/registry-setup-completion.js";+import type { RegistrySetupCompletion } from "#setup/registry-setup-protocol.js";import { hasInteractiveTerminal } from "./preconditions.js";import type { AddCommandOptions, RegistryCommandLogger } from "./registry.js";@@ -37,7 +39,7 @@ export interface RegistryPackageOperations {item: string;setups: RegistrySetupCommand[];prompter: Prompter;- }): Promise<boolean>;+ }): Promise<RegistrySetupCompletion | false>;setupReminder(item: string): string;}@@ -80,7 +82,7 @@ export async function runRegistryPackage(input: {options: AddCommandOptions & { prompter?: Prompter; signal?: AbortSignal };dependencies: RegistryPackageDependencies;operations: RegistryPackageOperations;-}): Promise<void> {+}): Promise<RegistrySetupCompletion | false> {const { logger, appRoot, item, components, config, options, dependencies, operations } = input;const interactive = dependencies.hasInteractiveTerminal?.() ?? hasInteractiveTerminal();let prompter = options.prompter;@@ -107,16 +109,23 @@ export async function runRegistryPackage(input: {silent: options.silent,});}- if (options.skipSetup === true) return;+ let completion: RegistrySetupCompletion = { facts: [] };+ if (options.skipSetup === true) return completion;if (options.yes !== true && options.prompter === undefined && !interactive) {logger.log(operations.setupReminder(item));- return;+ return completion;}for (const metadata of entries) {if (metadata?.setup === undefined) continue;- if (!(await operations.runSetups({ item, setups: metadata.setup, prompter: getPrompter() })))- return;+ const result = await operations.runSetups({+ item,+ setups: metadata.setup,+ prompter: getPrompter(),+ });+ if (result === false) return false;+ completion = mergeRegistrySetupCompletions(completion, result);}+ return completion;}diff --git a/packages/eve/src/cli/commands/registry-setup-command.test.ts b/packages/eve/src/cli/commands/registry-setup-command.test.tsindex 4d8beedcf..3117987e6 100644--- a/packages/eve/src/cli/commands/registry-setup-command.test.ts+++ b/packages/eve/src/cli/commands/registry-setup-command.test.ts@@ -76,7 +76,7 @@ describe("runRegistrySetupCommand", () => {"channel/slack",options(),),- ).resolves.toEqual({ kind: "completed", output: [] });+ ).resolves.toEqual({ kind: "completed", facts: [] });expect(spawn).toHaveBeenCalledWith(process.execPath,@@ -119,7 +119,7 @@ describe("runRegistrySetupCommand", () => {);});- it("streams child output through the parent prompter", async () => {+ it("streams child output through a plain parent prompter", async () => {const child = protocolChild();const prompter = createPrompter();spawn.mockReturnValue(child);@@ -135,7 +135,33 @@ describe("runRegistrySetupCommand", () => {expect(prompter.log.commandOutput).toHaveBeenCalledWith("connecting");});- it("uses a structured child failure instead of the exit code", async () => {+ it("keeps successful child presentation transient for replaceable TUI flows", async () => {+ const child = protocolChild(0, null, (running) => {+ running.emit("message", { type: "log", level: "success", text: "Scaffolded channel" });+ running.emit("message", {+ type: "note",+ title: "Text your agent",+ message: "+15551234567",+ tone: "success",+ });+ running.emit("message", { type: "result", outcome: { kind: "completed", facts: [] } });+ });+ const prompter = createPrompter();+ prompter.replaceContent = vi.fn();+ spawn.mockReturnValue(child);++ await runRegistrySetupCommand(+ "/project",+ { package: "@acme/slack", bin: "acme-slack", args: [] },+ "channel/photon-imessage",+ { prompter },+ );++ expect(prompter.log.success).not.toHaveBeenCalled();+ expect(prompter.note).not.toHaveBeenCalled();+ });++ it("uses a structured child failure without exposing its stack", async () => {const child = protocolChild(1, null, (running) => {running.emit("message", {type: "result",@@ -154,7 +180,34 @@ describe("runRegistrySetupCommand", () => {"channel/photon-imessage",options(),),- ).rejects.toThrow("Photon approval was denied.\nat setupPhoton");+ ).rejects.toThrow(/^Photon approval was denied\.$/);+ });++ it("preserves additive deployment metadata on protocol v1", async () => {+ const child = protocolChild(0, null, (running) => {+ running.emit("message", {+ type: "result",+ outcome: {+ kind: "completed",+ facts: [{ label: "Open Linear", value: "https://linear.app", kind: "url" }],+ deploymentRequired: true,+ },+ });+ });+ spawn.mockReturnValue(child);++ await expect(+ runRegistrySetupCommand(+ "/project",+ { package: "@acme/slack", bin: "acme-slack", args: [] },+ "channel/linear",+ options(),+ ),+ ).resolves.toEqual({+ kind: "completed",+ facts: [{ label: "Open Linear", value: "https://linear.app", kind: "url" }],+ deploymentRequired: true,+ });});it("returns durable setup notes with successful completion", async () => {@@ -185,9 +238,13 @@ describe("runRegistrySetupCommand", () => {),).resolves.toEqual({kind: "completed",- output: [- "Text your agent: +15550000000",- "Photon project: https://app.photon.codes/dashboard/project-id",+ facts: [+ { label: "Text your agent", value: "+15550000000", kind: "phone" },+ {+ label: "Photon project",+ value: "https://app.photon.codes/dashboard/project-id",+ kind: "url",+ },],});});diff --git a/packages/eve/src/cli/commands/registry-setup-command.ts b/packages/eve/src/cli/commands/registry-setup-command.tsindex 6903020a7..07a53cb2e 100644--- a/packages/eve/src/cli/commands/registry-setup-command.ts+++ b/packages/eve/src/cli/commands/registry-setup-command.ts@@ -11,6 +11,7 @@ import {isRegistrySetupChildMessage,REGISTRY_SETUP_PROTOCOL_VERSION,type RegistrySetupChildMessage,+ type RegistrySetupCompletion,type RegistrySetupParentMessage,} from "#setup/registry-setup-protocol.js";import { WizardCancelledError } from "#setup/step.js";@@ -22,7 +23,7 @@ export interface RegistrySetupCommand {}export type RegistrySetupCommandResult =- | { kind: "completed"; output: readonly string[] }+ | ({ kind: "completed" } & RegistrySetupCompletion)| { kind: "cancelled" };export interface RegistrySetupCommandOptions {@@ -141,10 +142,19 @@ function handlePresentation(): boolean {switch (message.type) {case "log":- prompter.log[message.level](message.text);+ if (+ prompter.replaceContent === undefined ||+ message.level === "warning" ||+ message.level === "error" ||+ message.level === "commandOutput"+ ) {+ prompter.log[message.level](message.text);+ }return true;case "note":- prompter.note(message.message, message.title, { tone: message.tone });+ if (prompter.replaceContent === undefined || message.tone === "warning") {+ prompter.note(message.message, message.title, { tone: message.tone });+ }return true;case "intro":prompter.intro(message.text, message.subtitle);@@ -277,10 +287,12 @@ export async function runRegistrySetupCommand();return;}- resolveResult({+ const result: RegistrySetupCommandResult = {kind: "completed",- output: outcome.facts.map((fact) => `${fact.label}: ${fact.value}`),- });+ facts: outcome.facts,+ };+ if (outcome.deploymentRequired === true) result.deploymentRequired = true;+ resolveResult(result);return;}if (outcome?.kind === "cancelled") {@@ -288,10 +300,7 @@ export async function runRegistrySetupCommand(return;}if (outcome?.kind === "failed") {- const details = outcome.error.details?.length- ? `\n${outcome.error.details.join("\n")}`- : "";- reject(new Error(`${outcome.error.message}${details}`));+ reject(new Error(outcome.error.message));return;}if (options.signal?.aborted === true || code === 130 || signal === "SIGINT") {diff --git a/packages/eve/src/cli/commands/registry.test.ts b/packages/eve/src/cli/commands/registry.test.tsindex 133273c4a..37210b24d 100644--- a/packages/eve/src/cli/commands/registry.test.ts+++ b/packages/eve/src/cli/commands/registry.test.ts@@ -132,7 +132,7 @@ describe("registry commands", () => {"installs the official %s item before running its declared setup",async (kind) => {const logger = createLogger();- const runSetupCommand = vi.fn(async () => ({ kind: "completed" as const, output: [] }));+ const runSetupCommand = vi.fn(async () => ({ kind: "completed" as const, facts: [] }));getRegistryItems.mockResolvedValue([{name: `channel/${kind}`,@@ -174,7 +174,7 @@ describe("registry commands", () => {it("lets interactive users select components from an official registry package", async () => {const logger = createLogger();- const runSetupCommand = vi.fn(async () => ({ kind: "completed" as const, output: [] }));+ const runSetupCommand = vi.fn(async () => ({ kind: "completed" as const, facts: [] }));const fake = createFakePrompter({multiple: (options) => {expect(options).toMatchObject({@@ -290,7 +290,7 @@ describe("registry commands", () => {_setup: RegistrySetupCommand,_item: string,_options?: RegistrySetupCommandOptions,- ) => ({ kind: "completed" as const, output: [] }),+ ) => ({ kind: "completed" as const, facts: [] }),);getRegistryItems.mockResolvedValueOnce([@@ -328,7 +328,7 @@ describe("registry commands", () => {it("installs a registry package's default components with --yes", async () => {const logger = createLogger();- const runSetupCommand = vi.fn(async () => ({ kind: "completed" as const, output: [] }));+ const runSetupCommand = vi.fn(async () => ({ kind: "completed" as const, facts: [] }));getRegistryItems.mockResolvedValueOnce([{@@ -364,7 +364,7 @@ describe("registry commands", () => {it("accepts a legacy singular setup command", async () => {const logger = createLogger();- const runSetupCommand = vi.fn(async () => ({ kind: "completed" as const, output: [] }));+ const runSetupCommand = vi.fn(async () => ({ kind: "completed" as const, facts: [] }));getRegistryItems.mockResolvedValue([{meta: {@@ -402,7 +402,7 @@ describe("registry commands", () => {options?: RegistrySetupCommandOptions,) => {prompters.push(options?.prompter);- return { kind: "completed" as const, output: [] };+ return { kind: "completed" as const, facts: [] };},);getRegistryItems.mockResolvedValue([@@ -475,7 +475,7 @@ describe("registry commands", () => {it("skips setup in non-interactive use and prints the resume command", async () => {const logger = createLogger();- const runSetup = vi.fn(async () => ({ kind: "completed" as const, output: [] }));+ const runSetup = vi.fn(async () => ({ kind: "completed" as const, facts: [] }));getRegistryItems.mockResolvedValue([{meta: { eve: { setup: [{ package: "@acme/slack", bin: "eve-slack", args: ["setup"] }] } },@@ -499,9 +499,34 @@ describe("registry commands", () => {]);});+ it("does not ask again after the TUI authorizes installation", async () => {+ const fake = createFakePrompter();+ const runSetup = vi.fn(async () => ({ kind: "completed" as const, facts: [] }));+ getRegistryItems.mockResolvedValue([+ {+ meta: { eve: { setup: [{ package: "@acme/slack", bin: "eve-slack", args: ["setup"] }] } },+ },+ ]);++ await installRegistryItem(+ "/project",+ "channel/slack",+ { prompter: fake.prompter },+ { loadSetupCommandRunner: async () => runSetup },+ );++ expect(fake.selectMessages).toEqual([]);+ expect(runSetup).toHaveBeenCalledWith(+ "/project",+ { package: "@acme/slack", bin: "eve-slack", args: ["setup"] },+ "channel/slack",+ expect.objectContaining({ prompter: fake.prompter }),+ );+ });+it("asks before setup and prints the resume command when declined", async () => {const logger = createLogger();- const runSetup = vi.fn(async () => ({ kind: "completed" as const, output: [] }));+ const runSetup = vi.fn(async () => ({ kind: "completed" as const, facts: [] }));const fake = createFakePrompter({ single: () => "no" });getRegistryItems.mockResolvedValue([{@@ -555,7 +580,7 @@ describe("registry commands", () => {it("runs setup directly without installing the item", async () => {const logger = createLogger();- const runSetup = vi.fn(async () => ({ kind: "completed" as const, output: [] }));+ const runSetup = vi.fn(async () => ({ kind: "completed" as const, facts: [] }));getRegistryItems.mockResolvedValue([{meta: { eve: { setup: [{ package: "@acme/slack", bin: "eve-slack", args: ["setup"] }] } },@@ -629,7 +654,7 @@ describe("registry commands", () => {it("does not infer setup from the item address", async () => {const logger = createLogger();- const runSetupCommand = vi.fn(async () => ({ kind: "completed" as const, output: [] }));+ const runSetupCommand = vi.fn(async () => ({ kind: "completed" as const, facts: [] }));getRegistryItems.mockResolvedValue([{ name: "channel/web", type: "registry:item" }]);await runAddCommand(@@ -648,7 +673,7 @@ describe("registry commands", () => {it("does not execute setup metadata from a URL item", async () => {const logger = createLogger();- const runSetupCommand = vi.fn(async () => ({ kind: "completed" as const, output: [] }));+ const runSetupCommand = vi.fn(async () => ({ kind: "completed" as const, facts: [] }));getRegistryItems.mockResolvedValue([{name: "channel/web",diff --git a/packages/eve/src/cli/commands/registry.ts b/packages/eve/src/cli/commands/registry.tsindex 98f6c3ef8..1a6403c62 100644--- a/packages/eve/src/cli/commands/registry.ts+++ b/packages/eve/src/cli/commands/registry.ts@@ -10,10 +10,12 @@ import { clipVisible, wrapVisibleLine } from "#cli/ui/terminal-text.js";import semver from "#compiled/semver/index.js";import { resolveInstalledPackageInfo } from "#internal/application/package.js";import { createPrompter, type Prompter } from "#setup/prompter.js";+import type { RegistrySetupCompletion } from "#setup/registry-setup-protocol.js";import { isEveProject } from "#setup/scaffold/index.js";import { WizardCancelledError } from "#setup/step.js";import { hasInteractiveTerminal, NOT_AN_AGENT_MESSAGE } from "./preconditions.js";+import { runDeclaredSetups } from "./registry-declared-setups.js";import { eveMetadataFromRegistryItem } from "./registry-metadata.js";import { runRegistryPackage } from "./registry-package.js";import type { runRegistrySetupCommand } from "./registry-setup-command.js";@@ -45,11 +47,6 @@ export interface RegistrySearchCommandOptions extends RegistryCommandOptions {limit?: number;}-type SetupCommandOptions = Pick<AddCommandOptions, "yes"> & {- prompter?: Prompter;- signal?: AbortSignal;-};-export interface RegistrySetupDependencies {loadSetupCommandRunner(): Promise<typeof runRegistrySetupCommand>;}@@ -59,6 +56,12 @@ export interface AddCommandDependencies extends RegistrySetupDependencies {hasInteractiveTerminal?: () => boolean;}+type RunAddCommandOptions = AddCommandOptions & {+ prompter?: Prompter;+ signal?: AbortSignal;+ setupAuthorized?: boolean;+};+/** One discoverable item from an eve-compatible registry catalog. */export interface RegistryCatalogItem {address: string;@@ -175,23 +178,24 @@ function errorMessage(error: unknown): string {return error instanceof Error ? error.message : String(error);}-async function runRegistryAction(+async function runRegistryAction<T>(logger: RegistryCommandLogger,appRoot: string,- action: () => Promise<void>,-): Promise<void> {+ action: () => Promise<T>,+): Promise<T | undefined> {if (!(await isEveProject(appRoot))) {logger.error(NOT_AN_AGENT_MESSAGE);process.exitCode = 1;- return;+ return undefined;}try {- await action();+ return await action();} catch (error) {- if (error instanceof WizardCancelledError) return;+ if (error instanceof WizardCancelledError) return undefined;logger.error(errorMessage(error));process.exitCode = 1;+ return undefined;}}@@ -448,44 +452,13 @@ export async function getRegistryItemManifest(appRoot: string, item: string): Prreturn items.length === 1 ? items[0] : items;}-async function runDeclaredSetups(- logger: RegistryCommandLogger,- appRoot: string,- item: string,- setups: NonNullable<ReturnType<typeof eveMetadataFromRegistryItem>>["setup"],- options: SetupCommandOptions,- dependencies: RegistrySetupDependencies,-): Promise<boolean> {- if (setups === undefined) return true;- const runSetupCommand = await dependencies.loadSetupCommandRunner();- const prompter = options.prompter ?? createPrompter();- try {- for (const setup of setups) {- const result = await runSetupCommand(- appRoot,- { ...setup, args: [...setup.args, ...(options.yes ? ["--yes"] : [])] },- item,- { prompter, signal: options.signal },- );- if (result.kind === "cancelled") {- logger.log(setupReminder(item, "cancelled"));- return false;- }- for (const line of result.output) logger.log(line);- }- return true;- } catch (error) {- throw new Error(`${errorMessage(error)} Try again with \`${setupResumeCommand(item)}\`.`);- }-}-/** Installs an official, configured, or URL-addressed registry item. */export async function installRegistryItem(appRoot: string,item: string,options: AddCommandOptions & { prompter?: Prompter; signal?: AbortSignal } = {},dependencies: AddCommandDependencies = defaultAddCommandDependencies,-): Promise<readonly string[]> {+): Promise<{ output: readonly string[]; setup?: RegistrySetupCompletion }> {let failure: string | undefined;const output: string[] = [];const logger: RegistryCommandLogger = {@@ -495,16 +468,22 @@ export async function installRegistryItem(log: (message) => output.push(message),};const previousExitCode = process.exitCode;- await runAddCommand(+ const setup = await runAddCommand(logger,appRoot,item,- { ...options, yes: options.prompter === undefined ? true : options.yes },+ {+ ...options,+ yes: options.prompter === undefined ? true : options.yes,+ setupAuthorized: options.prompter !== undefined,+ },dependencies,);process.exitCode = previousExitCode;if (failure !== undefined) throw new Error(failure);- return output;+ const result: { output: readonly string[]; setup?: RegistrySetupCompletion } = { output };+ if (setup !== undefined) result.setup = setup;+ return result;}/** Installs an official, configured, or URL-addressed registry item. */@@ -512,10 +491,10 @@ export async function runAddCommand(logger: RegistryCommandLogger,appRoot: string,item: string,- options: AddCommandOptions & { prompter?: Prompter; signal?: AbortSignal },+ options: RunAddCommandOptions,dependencies: AddCommandDependencies = defaultAddCommandDependencies,-): Promise<void> {- await runRegistryAction(logger, appRoot, async () => {+): Promise<RegistrySetupCompletion | undefined> {+ return runRegistryAction(logger, appRoot, async () => {const config = await readEveRegistryConfig(appRoot);const address = itemAddress(item);if (options.skipInstall === true) {@@ -540,7 +519,7 @@ export async function runAddCommand(if (eveMetadata?.components !== undefined) {if (!isOfficialItemAddress(address))throw new Error("Registry packages require the official eve registry.");- await runRegistryPackage({+ const completion = await runRegistryPackage({logger,appRoot,item,@@ -553,26 +532,37 @@ export async function runAddCommand(metadata: eveMetadataFromRegistryItem,assertCompatibleVersion: assertCompatibleEveVersion,runSetups: ({ item: packageItem, setups, prompter }) =>- runDeclaredSetups(+ runDeclaredSetups({logger,appRoot,- packageItem,+ item: packageItem,setups,- { yes: options.yes, prompter, signal: options.signal },+ options: { yes: options.yes, prompter, signal: options.signal },dependencies,- ),+ cancelledReminder: setupReminder(packageItem, "cancelled"),+ resumeCommand: setupResumeCommand(packageItem),+ }),setupReminder: (packageItem) => setupReminder(packageItem, "skipped"),},});- return;+ return completion === false ? undefined : completion;}if (options.skipInstall === true) {if (eveMetadata?.setup === undefined) {throw new Error(`Registry item "${item}" does not declare a setup flow.`);}- await runDeclaredSetups(logger, appRoot, item, eveMetadata.setup, options, dependencies);- return;+ const completion = await runDeclaredSetups({+ logger,+ appRoot,+ item,+ setups: eveMetadata.setup,+ options,+ dependencies,+ cancelledReminder: setupReminder(item, "cancelled"),+ resumeCommand: setupResumeCommand(item),+ });+ return completion === false ? undefined : completion;}await addRegistryItems([address], {@@ -586,12 +576,15 @@ export async function runAddCommand(const interactive =dependencies.hasInteractiveTerminal?.() ??defaultAddCommandDependencies.hasInteractiveTerminal!();- if (options.skipSetup === true || (!options.yes && !interactive)) {+ if (+ options.skipSetup === true ||+ (!options.yes && !interactive && options.setupAuthorized !== true)+ ) {logger.log(setupReminder(item, "skipped"));return;}- if (!options.yes) {+ if (!options.yes && options.setupAuthorized !== true) {try {const prompter =options.prompter ??@@ -616,7 +609,17 @@ export async function runAddCommand(}}- await runDeclaredSetups(logger, appRoot, item, eveMetadata.setup, options, dependencies);+ const completion = await runDeclaredSetups({+ logger,+ appRoot,+ item,+ setups: eveMetadata.setup,+ options,+ dependencies,+ cancelledReminder: setupReminder(item, "cancelled"),+ resumeCommand: setupResumeCommand(item),+ });+ return completion === false ? undefined : completion;});}diff --git a/packages/eve/src/cli/dev/tui/setup-commands.test.ts b/packages/eve/src/cli/dev/tui/setup-commands.test.tsindex fe912fb3b..f7210d276 100644--- a/packages/eve/src/cli/dev/tui/setup-commands.test.ts+++ b/packages/eve/src/cli/dev/tui/setup-commands.test.ts@@ -2,6 +2,7 @@ import { describe, expect, it, vi } from "vitest";import { createFakePrompter } from "#internal/testing/fake-prompter.js";import { HumanActionRequiredError } from "#setup/human-action.js";+import { RegistryFlowFailedError } from "#setup/flows/registry.js";import {runTuiSetupCommand,@@ -29,6 +30,7 @@ function fakePanelRenderer(): TuiSetupCommandRenderer & {readChoice: vi.fn(() => ({ choice: Promise.resolve(undefined), close: vi.fn() })),setStatus: vi.fn(),renderLine: vi.fn(),+ replaceContent: vi.fn(),renderOutput: vi.fn(),withInheritedStdio: (task) => task(),waitForInterrupt: vi.fn(() => ({@@ -57,6 +59,8 @@ function fakeFlows(overrides: Partial<TuiSetupFlows> = {}): TuiSetupFlows {runRegistryFlow: vi.fn<TuiSetupFlows["runRegistryFlow"]>(async () => ({kind: "done",addedItems: [],+ items: [],+ facts: [],})),runDeployFlow: vi.fn<TuiSetupFlows["runDeployFlow"]>(async () => ({kind: "deployed",@@ -96,6 +100,8 @@ describe("runTuiSetupCommand", () => {const runRegistryFlow = vi.fn<TuiSetupFlows["runRegistryFlow"]>(async () => ({kind: "done",addedItems: [],+ items: [],+ facts: [],}));await run({ command: "add", flows: fakeFlows({ runRegistryFlow }), renderer });@@ -329,10 +335,20 @@ describe("runTuiSetupCommand", () => {it.each([["added",- { kind: "done", addedItems: ["extension/browser"] },- "Registry items added: extension/browser.",+ {+ kind: "done",+ addedItems: ["extension/browser"],+ items: [{ address: "extension/browser", title: "Agent Browser", facts: [], output: [] }],+ facts: [],+ },+ "Added Agent Browser",+ ],+ ["empty", { kind: "done", addedItems: [], items: [], facts: [] }, "No registry items added."],+ [+ "deployed",+ { kind: "done", addedItems: [], items: [], facts: [], deployed: "production" },+ "No registry items added.",],- ["empty", { kind: "done", addedItems: [] }, "No registry items added."],["cancelled", { kind: "cancelled" }, "/add dismissed."],] as const)("reports a %s registry flow", async (_case, result, message) => {const runRegistryFlow = vi.fn(async () => result);@@ -341,15 +357,88 @@ describe("runTuiSetupCommand", () => {message: string;tone?: "success";preserveFlowDiagnostics: boolean;+ effect?: { kind: "deployed" };} = {message,preserveFlowDiagnostics: true,};if (result.kind === "done" && result.addedItems.length > 0) expected.tone = "success";+ if (result.kind === "done" && "deployed" in result && result.deployed === "production") {+ expected.effect = { kind: "deployed" };+ }expect(outcome).toEqual(expected);expect(runRegistryFlow).toHaveBeenCalledWith(expect.objectContaining({ appRoot: APP_ROOT }));});+ it("overrides a settled success tone when add is interrupted", async () => {+ const renderer = fakePanelRenderer();+ const flows = fakeFlows({+ runRegistryFlow: vi.fn<TuiSetupFlows["runRegistryFlow"]>(+ ({ signal }) =>+ new Promise((resolve) => {+ signal?.addEventListener(+ "abort",+ () =>+ resolve({+ kind: "done",+ addedItems: ["channel/github"],+ items: [{ address: "channel/github", title: "GitHub", facts: [], output: [] }],+ facts: [],+ }),+ { once: true },+ );+ }),+ ),+ });++ const result = run({ command: "add", flows, renderer });+ renderer.fireInterrupt();++ await expect(result).resolves.toEqual({+ message: "/add interrupted.",+ tone: "error",+ preserveFlowDiagnostics: true,+ });+ });++ it("reports completed items and facts when a later add fails", async () => {+ const flows = fakeFlows({+ runRegistryFlow: vi.fn<TuiSetupFlows["runRegistryFlow"]>(async () => {+ throw new RegistryFlowFailedError(new Error("Refusing to overwrite github.ts"), {+ kind: "done",+ addedItems: ["channel/photon-imessage"],+ items: [+ {+ address: "channel/photon-imessage",+ title: "Photon iMessage",+ output: [],+ facts: [+ { label: "Agent phone number", value: "+15551234567" },+ { label: "Photon project dashboard", value: "https://app.photon.codes/project" },+ ],+ },+ ],+ output: [],+ facts: [+ { label: "Agent phone number", value: "+15551234567" },+ { label: "Photon project dashboard", value: "https://app.photon.codes/project" },+ ],+ });+ }),+ });++ await expect(run({ command: "add", flows })).resolves.toEqual({+ message:+ "Added Photon iMessage\n\n" ++ "Photon iMessage\n" ++ " Agent phone number +15551234567\n" ++ " Photon project dashboard https://app.photon.codes/project\n\n" ++ "Refusing to overwrite github.ts",+ tone: "error",+ preserveFlowDiagnostics: true,+ });+ });+it("reports the production URL after a deploy", async () => {const flows = fakeFlows();await expect(run({ command: "deploy", flows })).resolves.toEqual({@@ -396,6 +485,7 @@ describe("runTuiSetupCommand", () => {await expect(result).resolves.toEqual({message: "/model interrupted.",+ tone: "error",preserveFlowDiagnostics: true,effect: { kind: "model-access-changed" },});diff --git a/packages/eve/src/cli/dev/tui/setup-commands.ts b/packages/eve/src/cli/dev/tui/setup-commands.tsindex 97c4faaba..c405ef134 100644--- a/packages/eve/src/cli/dev/tui/setup-commands.ts+++ b/packages/eve/src/cli/dev/tui/setup-commands.ts@@ -7,7 +7,7 @@ import {import { runLoginFlow, type LoginFlowResult } from "#setup/flows/login.js";import { runModelFlow, type ModelProviderOutcome } from "#setup/flows/model.js";import { runProviderFlow, type ProviderPicker } from "#setup/flows/provider.js";-import { runRegistryFlow } from "#setup/flows/registry.js";+import { RegistryFlowFailedError, runRegistryFlow } from "#setup/flows/registry.js";import type { Prompter } from "#setup/prompter.js";import { WizardCancelledError } from "#setup/step.js";@@ -63,6 +63,27 @@ export interface TuiSetupFlows {runDeployFlow: typeof runDeployFlow;}+function joinedTitles(titles: readonly string[]): string {+ if (titles.length === 0) return "";+ if (titles.length === 1) return titles[0]!;+ if (titles.length === 2) return `${titles[0]} and ${titles[1]}`;+ return `${titles.slice(0, -1).join(", ")}, and ${titles.at(-1)}`;+}++function registryResultMessage(+ result: Extract<Awaited<ReturnType<typeof runRegistryFlow>>, { kind: "done" }>,+): string {+ const lines = [`Added ${joinedTitles(result.items.map((item) => item.title))}`];+ for (const item of result.items) {+ if (item.facts.length === 0 && item.output.length === 0) continue;+ lines.push("", item.title);+ const width = Math.max(0, ...item.facts.map((fact) => fact.label.length));+ for (const fact of item.facts) lines.push(` ${fact.label.padEnd(width)} ${fact.value}`);+ for (const output of item.output) lines.push(` ${output}`);+ }+ return lines.join("\n");+}+export interface TuiSetupCommandResult {message: string;/** Promotes an outcome to a top-level status. */@@ -107,6 +128,9 @@ function muteableRenderer(renderer.renderLine(text, tone);}},+ replaceContent: (content) => {+ if (!isMuted()) renderer.replaceContent?.(content);+ },renderOutput: (text) => {if (!isMuted()) renderer.renderOutput(text);},@@ -146,6 +170,7 @@ export async function runTuiSetupCommand(return {...settled,message: `/${command} interrupted.`,+ tone: "error",preserveFlowDiagnostics: true,};} finally {@@ -231,17 +256,16 @@ async function executeSetupCommand(if (result.kind === "cancelled") {return { message: "/add dismissed.", preserveFlowDiagnostics: true };}- if (result.addedItems.length > 0) {- return {- message: [- `Registry items added: ${result.addedItems.join(", ")}.`,- ...(result.output ?? []),- ].join("\n"),- tone: "success",- preserveFlowDiagnostics: true,- };- }- return { message: "No registry items added.", preserveFlowDiagnostics: true };+ const outcome: TuiSetupCommandResult = {+ message:+ result.addedItems.length > 0+ ? registryResultMessage(result)+ : "No registry items added.",+ preserveFlowDiagnostics: true,+ };+ if (result.addedItems.length > 0) outcome.tone = "success";+ if (result.deployed === "production") outcome.effect = { kind: "deployed" };+ return outcome;}case "deploy": {const result = await flows.runDeployFlow({ appRoot, prompter, interactive: true, signal });@@ -263,6 +287,14 @@ async function executeSetupCommand(}}} catch (error) {+ if (error instanceof RegistryFlowFailedError) {+ const completed = error.completed;+ return {+ message: `${registryResultMessage(completed)}\n\n${error.message}`,+ tone: "error",+ preserveFlowDiagnostics: true,+ };+ }if (error instanceof WizardCancelledError) {return {message: `/${command} dismissed.`,diff --git a/packages/eve/src/cli/dev/tui/setup-flow.ts b/packages/eve/src/cli/dev/tui/setup-flow.tsindex 1221a791b..ba7a5275a 100644--- a/packages/eve/src/cli/dev/tui/setup-flow.ts+++ b/packages/eve/src/cli/dev/tui/setup-flow.ts@@ -103,6 +103,10 @@ export interface SetupFlowRenderer {readChoice(options: ChannelSetupChoiceOptions): ChannelSetupChoice;setStatus(status: SetupFlowStatus | undefined): void;renderLine(text: string, tone: "info" | "success" | "warning" | "error"): void;+ replaceContent?(content?: {+ headline: string;+ facts: readonly { label: string; value: string }[];+ }): void;renderOutput(text: string): void;/** Temporarily restores the terminal while a child process inherits stdio. */withInheritedStdio<T>(task: () => Promise<T>): Promise<T>;@@ -132,6 +136,7 @@ export type SetupFlowPrompterRenderer = Pick<| "readChoice"| "setStatus"| "renderLine"+ | "replaceContent"| "renderOutput"| "withInheritedStdio"| "withExclusiveTerminal"diff --git a/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts b/packages/eve/src/cli/dev/tui/terminal-renderer.test.tsindex 4175d7f9a..cb678d0ab 100644--- a/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts+++ b/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts@@ -4104,6 +4104,41 @@ describe("TerminalRenderer setup flow session", () => {renderer.shutdown();});+ it("replaces setup lines with a compact current-item summary", async () => {+ const { screen, input, renderer } = makeRenderer();++ renderer.setupFlow.begin("Add to your agent");+ renderer.setupFlow.renderLine("Scaffolded channel: photon", "success");+ renderer.setupFlow.renderLine("Photon project: https://app.photon.codes", "success");+ renderer.setupFlow.replaceContent?.({+ headline: "Scaffolded channel/photon-imessage",+ facts: [+ { label: "Agent phone number", value: "+15551234567" },+ { label: "Photon project dashboard", value: "https://app.photon.codes" },+ ],+ });+ const answer = renderer.setupFlow.readSelect({+ kind: "task-list",+ message: "What would you like to do next?",+ options: [+ { value: "add-more", label: "Add more" },+ { value: "finish", label: "Finish", trailingAction: true },+ ],+ });++ const snapshot = screen.snapshot();+ expect(snapshot).toContain("Scaffolded channel/photon-imessage");+ expect(snapshot).toContain("Agent phone number: +15551234567");+ expect(snapshot).toContain("Photon project dashboard: https://app.photon.codes");+ expect(snapshot).not.toContain("Scaffolded channel: photon");+ expect(snapshot).not.toContain("Photon project: https://app.photon.codes");++ input.enter();+ await expect(answer).resolves.toEqual(["add-more"]);+ renderer.setupFlow.end({ preserveDiagnostics: false });+ renderer.shutdown();+ });+it("keeps enter on a completed setup row as a no-op", async () => {const { input, renderer } = makeRenderer();const answer = renderer.setupFlow.readSelect({diff --git a/packages/eve/src/cli/dev/tui/terminal-renderer.ts b/packages/eve/src/cli/dev/tui/terminal-renderer.tsindex 9f26316cb..dd6e7f380 100644--- a/packages/eve/src/cli/dev/tui/terminal-renderer.ts+++ b/packages/eve/src/cli/dev/tui/terminal-renderer.ts@@ -242,6 +242,7 @@ type SetupFlowState = {title: string;indicator: SetupFlowIndicatorState;lines: FlowPanelLine[];+ summary?: { headline: string; facts: readonly { label: string; value: string }[] };status?: SetupFlowStatusState;/** Latest subprocess output line; replaced per write, never persisted. */preview?: string;@@ -581,6 +582,7 @@ export class TerminalRenderer implements AgentTUIRenderer {readChoice: (options) => this.#readSetupChoice(options),setStatus: (text) => this.#setFlowStatus(text),renderLine: (text, tone) => this.#renderFlowLine(text, tone),+ replaceContent: (content) => this.#replaceFlowContent(content),renderOutput: (text) => this.#renderFlowOutput(text),withInheritedStdio: (task) => this.#withInheritedStdio(task),withExclusiveTerminal: (task) => this.#withInheritedStdio(task),@@ -1806,7 +1808,7 @@ export class TerminalRenderer implements AgentTUIRenderer {line.tone === "success" || line.tone === "warning" || line.tone === "error",).map((line) => ({ tone: line.tone, text: line.text }));- notices = [...(opts.notices ?? []), ...outcomes];+ notices = opts.notices ?? outcomes;flow.taskListLineStart = flow.lines.length;flow.hideLinesWhileQuestion = true;}@@ -2582,6 +2584,28 @@ export class TerminalRenderer implements AgentTUIRenderer {this.#paint();}+ #replaceFlowContent(content?: {+ headline: string;+ facts: readonly { label: string; value: string }[];+ }): void {+ const flow = this.#setupFlow;+ if (flow === undefined) return;+ flow.lines = [];+ flow.outputBuffer = [];+ flow.preview = undefined;+ flow.summary =+ content === undefined+ ? undefined+ : {+ headline: stripTerminalControls(content.headline),+ facts: content.facts.map((fact) => ({+ label: stripTerminalControls(fact.label),+ value: stripTerminalControls(fact.value),+ })),+ };+ this.#paint();+ }+/*** One line of subprocess output during a flow: shown as the transient* preview (replaced per write), buffered so a settling warning can pull@@ -3897,7 +3921,18 @@ export class TerminalRenderer implements AgentTUIRenderer {}const state: Parameters<typeof renderFlowPanel>[0] = {title: flow.title,- lines: flow.hideLinesWhileQuestion === true ? [] : flow.lines,+ lines:+ flow.summary === undefined+ ? flow.hideLinesWhileQuestion === true+ ? []+ : flow.lines+ : [+ { text: flow.summary.headline, tone: "success" },+ ...flow.summary.facts.map((fact) => ({+ text: `${fact.label}: ${fact.value}`,+ tone: "info" as const,+ })),+ ],content,};rows.push(...renderFlowPanel(state, this.#theme, width));diff --git a/packages/eve/src/cli/dev/tui/tui-prompter.ts b/packages/eve/src/cli/dev/tui/tui-prompter.tsindex aa4e69152..995c52d37 100644--- a/packages/eve/src/cli/dev/tui/tui-prompter.ts+++ b/packages/eve/src/cli/dev/tui/tui-prompter.ts@@ -201,6 +201,8 @@ export function createTuiPrompter(renderer: TuiPrompterRenderer): Prompter {outro() {},+ replaceContent: (content) => renderer.replaceContent?.(content),+withInheritedStdio: (task) => renderer.withInheritedStdio(task),log: {diff --git a/packages/eve/src/setup/boxes/deploy-project.ts b/packages/eve/src/setup/boxes/deploy-project.tsindex 1b24f97c3..1f61b54e4 100644--- a/packages/eve/src/setup/boxes/deploy-project.ts+++ b/packages/eve/src/setup/boxes/deploy-project.ts@@ -171,9 +171,12 @@ export function deployProject(// Vercel projects may still need the CLI to skip deployment-setting// confirmation before the deployments API accepts the first production// deploy.- const deployArgs = input.headless- ? ["deploy", "--prod", "--yes", "--non-interactive"]- : ["deploy", "--prod", "--yes"];+ const deployArgs = [+ "deploy",+ "--prod",+ "--yes",+ ...(input.headless ? ["--non-interactive"] : []),+ ];const success = await withPhase(log, "Deploying the agent to Vercel production...", () =>deps.runVercel(deployArgs, {cwd: projectPath,@@ -189,7 +192,7 @@ export function deployProject(// transient until a warning/error settles it) so the build failure is// visible instead of just the exit code.log.error(- "`vercel deploy --prod` failed. The deploy output above shows the cause; fix it, then run `vercel deploy --prod` to retry.",+ "`vercel deploy --prod` failed. The deploy output above shows the cause; fix it, then retry.",);throw new Error("Deployment failed after channel setup.");}diff --git a/packages/eve/src/setup/connection-connector.integration.test.ts b/packages/eve/src/setup/connection-connector.integration.test.tsindex 25ea23add..e27b04983 100644--- a/packages/eve/src/setup/connection-connector.integration.test.ts+++ b/packages/eve/src/setup/connection-connector.integration.test.ts@@ -217,6 +217,21 @@ describe("setupConnectionConnector", () => {);});+ it("surfaces the Vercel error when connector creation fails", async () => {+ run.mockResolvedValueOnce(false);+ capture.mockResolvedValue(jsonResult({ connectors: [] }));+ create.mockResolvedValue({+ ok: false,+ stdout: "",+ stderr: "Vercel CLI 58.5.1\nError: Connect is not enabled for this team.\n",+ });+ const fake = createFakePrompter({ single: () => "create", text: () => "acme" });++ await expect(setupConnectionConnector(options(fake.prompter))).rejects.toThrow(+ `Could not create the ${SERVICE} connector. Vercel returned: Error: Connect is not enabled for this team.`,+ );+ });+it("recovers a partially created connector id from CLI progress and removes it", async () => {run.mockResolvedValueOnce(false).mockResolvedValueOnce(true);capture.mockResolvedValue(jsonResult({ connectors: [] }));diff --git a/packages/eve/src/setup/connection-connector.ts b/packages/eve/src/setup/connection-connector.tsindex a8aa569f8..df54a31a2 100644--- a/packages/eve/src/setup/connection-connector.ts+++ b/packages/eve/src/setup/connection-connector.ts@@ -45,6 +45,17 @@ function parseJson(source: string): unknown {}}+function connectorCreationFailure(service: string, stderr: string | undefined): string {+ const detail = stderr+ ?.split("\n")+ .map((line) => line.trim())+ .filter((line) => line.length > 0 && !line.startsWith("Vercel CLI "))+ .at(-1);+ return detail === undefined+ ? `Could not create the ${service} connector.`+ : `Could not create the ${service} connector. Vercel returned: ${detail}`;+}+function parseConnectorRef(value: unknown): ConnectConnectorRef | undefined {if (!isRecord(value) || typeof value["uid"] !== "string" || typeof value["id"] !== "string") {return undefined;@@ -305,7 +316,7 @@ async function resolveFallbackConnector(if (connector !== undefined) return { kind: "created", connector };const message = created.ok? `The ${options.service} connector does not support user authorization.`- : `Could not create the ${options.service} connector.`;+ : connectorCreationFailure(options.service, created.stderr);if (ownedId !== undefined) {try {await cleanupCreatedConnectionConnector({diff --git a/packages/eve/src/setup/flows/registry-session.ts b/packages/eve/src/setup/flows/registry-session.tsnew file mode 100644index 000000000..8d40c6d1f--- /dev/null+++ b/packages/eve/src/setup/flows/registry-session.ts@@ -0,0 +1,123 @@+import type { Prompter } from "#setup/prompter.js";+import { detectDeployment } from "#setup/project-resolution.js";+import { mergeRegistrySetupCompletions } from "#setup/registry-setup-completion.js";+import type { RegistrySetupCompletion, RegistrySetupFact } from "#setup/registry-setup-protocol.js";++import { runDeployFlow } from "./deploy.js";++export interface RegistrySessionDeps {+ detectDeployment: typeof detectDeployment;+ runDeployFlow: typeof runDeployFlow;+}++export interface RegistrySessionItemResult {+ address: string;+ title: string;+ facts: readonly RegistrySetupFact[];+ output: readonly string[];+}++export interface RegistrySessionResult {+ kind: "done";+ addedItems: readonly string[];+ items: readonly RegistrySessionItemResult[];+ facts: readonly RegistrySetupFact[];+ output: readonly string[];+ deployed?: "production";+}++export interface RegistrySession {+ add(+ item: string,+ title: string,+ output: readonly string[],+ setup?: RegistrySetupCompletion,+ ): void;+ result(deployed?: "production"): RegistrySessionResult;+ continueAfterInstall(input: {+ appRoot: string;+ prompter: Prompter;+ signal?: AbortSignal;+ }): Promise<"add-more" | RegistrySessionResult>;+}++/** Owns the accumulated output and deployment decision for one `/add` session. */+export function createRegistrySession(deps: RegistrySessionDeps): RegistrySession {+ const addedItems: string[] = [];+ const items: RegistrySessionItemResult[] = [];+ const output: string[] = [];+ let completion: RegistrySetupCompletion = { facts: [] };+ let currentItem = "";+ let currentFacts: readonly RegistrySetupFact[] = [];++ function result(deployed?: "production"): RegistrySessionResult {+ const session: RegistrySessionResult = {+ kind: "done",+ addedItems,+ items,+ facts: completion.facts,+ output,+ };+ if (deployed !== undefined) session.deployed = deployed;+ return session;+ }++ return {+ add(item, title, itemOutput, setup = { facts: [] }) {+ addedItems.push(item);+ items.push({ address: item, title, facts: setup.facts, output: itemOutput });+ output.push(...itemOutput);+ currentItem = title;+ currentFacts = setup.facts;+ completion = mergeRegistrySetupCompletions(completion, setup);+ },++ result,++ async continueAfterInstall(input) {+ if (completion.deploymentRequired !== true) return result();++ const deployment = await deps.detectDeployment(input.appRoot, { signal: input.signal });+ const canDeploy = deployment.state === "linked" || deployment.state === "deployed";+ input.prompter.replaceContent?.({+ headline: `Added ${currentItem}`,+ facts: currentFacts,+ });+ while (true) {+ const action = await input.prompter.select<"deploy" | "add-more" | "finish">({+ message: "What would you like to do next?",+ initialValue: "add-more",+ hintLayout: "inline",+ options: [+ { value: "add-more", label: "Add more" },+ ...(canDeploy ? [{ value: "deploy" as const, label: "Deploy" }] : []),+ { value: "finish", label: "Finish" },+ ],+ });+ if (action === "add-more") {+ input.prompter.replaceContent?.();+ return "add-more";+ }+ if (action === "finish") return result();++ const confirmed = await input.prompter.select<"yes" | "back">({+ message: "Deploy to prod?",+ initialValue: "yes",+ options: [+ { value: "yes", label: "Yes" },+ { value: "back", label: "Back" },+ ],+ });+ if (confirmed === "back") continue;++ const deployResult = await deps.runDeployFlow({+ appRoot: input.appRoot,+ prompter: input.prompter,+ signal: input.signal,+ interactive: true,+ });+ return result(deployResult.kind === "deployed" ? "production" : undefined);+ }+ },+ };+}diff --git a/packages/eve/src/setup/flows/registry.test.ts b/packages/eve/src/setup/flows/registry.test.tsindex 800012168..6aa6835b5 100644--- a/packages/eve/src/setup/flows/registry.test.ts+++ b/packages/eve/src/setup/flows/registry.test.ts@@ -2,7 +2,7 @@ import { describe, expect, it, vi } from "vitest";import { createFakePrompter } from "#internal/testing/fake-prompter.js";-import { runRegistryFlow, type RegistryFlowDeps } from "./registry.js";+import { RegistryFlowFailedError, runRegistryFlow, type RegistryFlowDeps } from "./registry.js";const APP_ROOT = "/tmp/agent";@@ -29,7 +29,9 @@ function deps(overrides: Partial<RegistryFlowDeps> = {}): RegistryFlowDeps {envVars: { AGENT_BROWSER_TOKEN: "" },files: [{ target: "agent/extensions/browser.ts" }],})),- installRegistryItem: vi.fn(async () => []),+ installRegistryItem: vi.fn(async () => ({ output: [] })),+ detectDeployment: vi.fn(async () => ({ state: "unlinked" as const })),+ runDeployFlow: vi.fn(async () => ({ kind: "deployed" as const })),...overrides,};}@@ -48,7 +50,20 @@ describe("runRegistryFlow", () => {await expect(runRegistryFlow({ appRoot: APP_ROOT, prompter: fake.prompter, deps: flowDeps }),- ).resolves.toEqual({ kind: "done", addedItems: ["extension/agent-browser"] });+ ).resolves.toEqual({+ kind: "done",+ addedItems: ["extension/agent-browser"],+ items: [+ {+ address: "extension/agent-browser",+ title: "Agent Browser",+ facts: [],+ output: [],+ },+ ],+ facts: [],+ output: [],+ });expect(flowDeps.installRegistryItem).toHaveBeenCalledWith(APP_ROOT,"extension/agent-browser",@@ -274,13 +289,164 @@ describe("runRegistryFlow", () => {);});+ it("collects deployable setups, adds another, then deploys once", async () => {+ const answers = [+ "category:channel",+ "item:0",+ "add",+ "add-more",+ "category:channel",+ "item:0",+ "add",+ "deploy",+ "yes",+ ];+ const prompts: unknown[] = [];+ const fake = createFakePrompter({+ single: (options) => {+ prompts.push(options);+ return answers.shift()!;+ },+ });+ const flowDeps = deps({+ browseRegistryCatalog: vi.fn(async () => ({+ items: [{ address: "channel/slack", name: "channel/slack", source: "Vercel" }],+ total: 1,+ errors: [],+ })),+ detectDeployment: vi.fn(async () => ({ state: "linked" as const, projectId: "prj_1" })),+ installRegistryItem: vi.fn(async () => ({+ output: [],+ setup: {+ facts: [+ { label: "Workspace", value: "Acme" },+ { label: "Open Slack", value: "https://slack.com/app", kind: "url" as const },+ ],+ deploymentRequired: true as const,+ },+ })),+ });++ await expect(+ runRegistryFlow({ appRoot: APP_ROOT, prompter: fake.prompter, deps: flowDeps }),+ ).resolves.toMatchObject({+ kind: "done",+ addedItems: ["channel/slack", "channel/slack"],+ deployed: "production",+ facts: [+ { label: "Workspace", value: "Acme" },+ { label: "Open Slack", value: "https://slack.com/app", kind: "url" },+ { label: "Workspace", value: "Acme" },+ { label: "Open Slack", value: "https://slack.com/app", kind: "url" },+ ],+ });+ expect(flowDeps.runDeployFlow).toHaveBeenCalledTimes(1);+ expect(prompts[3]).toMatchObject({+ initialValue: "add-more",+ hintLayout: "inline",+ options: [+ { value: "add-more", label: "Add more" },+ { value: "deploy", label: "Deploy" },+ { value: "finish", label: "Finish" },+ ],+ });+ expect(prompts[8]).toMatchObject({+ message: "Deploy to prod?",+ initialValue: "yes",+ options: [+ { value: "yes", label: "Yes" },+ { value: "back", label: "Back" },+ ],+ });+ });++ it("returns to continuation options when production deployment is not confirmed", async () => {+ const answers = ["category:channel", "item:0", "add", "deploy", "back", "finish"];+ const fake = createFakePrompter({ single: () => answers.shift()! });+ const flowDeps = deps({+ browseRegistryCatalog: vi.fn(async () => ({+ items: [{ address: "channel/github", name: "channel/github", source: "Vercel" }],+ total: 1,+ errors: [],+ })),+ detectDeployment: vi.fn(async () => ({ state: "linked" as const, projectId: "prj_1" })),+ installRegistryItem: vi.fn(async () => ({+ output: [],+ setup: { facts: [], deploymentRequired: true as const },+ })),+ });++ await expect(+ runRegistryFlow({ appRoot: APP_ROOT, prompter: fake.prompter, deps: flowDeps }),+ ).resolves.toMatchObject({ addedItems: ["channel/github"] });+ expect(flowDeps.runDeployFlow).not.toHaveBeenCalled();+ });++ it("preserves earlier setup results when a later item fails", async () => {+ const answers = [+ "category:channel",+ "item:0",+ "add",+ "add-more",+ "category:channel",+ "item:0",+ "add",+ ];+ const fake = createFakePrompter({ single: () => answers.shift()! });+ let installs = 0;+ const flowDeps = deps({+ browseRegistryCatalog: vi.fn(async () => ({+ items: [+ { address: "channel/photon-imessage", name: "channel/photon-imessage", source: "Vercel" },+ ],+ total: 1,+ errors: [],+ })),+ installRegistryItem: vi.fn(async () => {+ installs += 1;+ if (installs === 2) throw new Error("Refusing to overwrite photon.ts");+ return {+ output: [],+ setup: {+ facts: [{ label: "Agent phone number", value: "+15551234567" }],+ deploymentRequired: true as const,+ },+ };+ }),+ });++ const error = await runRegistryFlow({+ appRoot: APP_ROOT,+ prompter: fake.prompter,+ deps: flowDeps,+ }).catch((reason: unknown) => reason);++ expect(error).toBeInstanceOf(RegistryFlowFailedError);+ expect(error).toMatchObject({+ message: "Refusing to overwrite photon.ts",+ completed: {+ addedItems: ["channel/photon-imessage"],+ facts: [{ label: "Agent phone number", value: "+15551234567" }],+ },+ });+ });++ it("does not offer another item or deployment after a non-deployable setup", async () => {+ const answers = ["category:extension", "item:0", "add"];+ const fake = createFakePrompter({ single: () => answers.shift()! });++ await runRegistryFlow({ appRoot: APP_ROOT, prompter: fake.prompter, deps: deps() });++ expect(fake.selectMessages).not.toContain("What would you like to do next?");+ });+it("returns to the category hub from a registry list", async () => {const answers = ["category:channel", "action:back", "action:done"];const fake = createFakePrompter({ single: () => answers.shift()! });await expect(runRegistryFlow({ appRoot: APP_ROOT, prompter: fake.prompter, deps: deps() }),- ).resolves.toEqual({ kind: "done", addedItems: [] });+ ).resolves.toEqual({ kind: "done", addedItems: [], items: [], facts: [], output: [] });expect(fake.selectMessages).toEqual(["Add an integration",diff --git a/packages/eve/src/setup/flows/registry.ts b/packages/eve/src/setup/flows/registry.tsindex 9948f1fea..8081141b2 100644--- a/packages/eve/src/setup/flows/registry.ts+++ b/packages/eve/src/setup/flows/registry.ts@@ -6,9 +6,14 @@ import type {SelectOption,SingleSelectOptions,} from "#setup/prompter.js";+import { runDeployFlow } from "#setup/flows/deploy.js";+import { detectDeployment } from "#setup/project-resolution.js";+import type { RegistrySetupFact } from "#setup/registry-setup-protocol.js";import { WizardCancelledError } from "#setup/step.js";import { withSpinner } from "#setup/with-spinner.js";+import { createRegistrySession } from "./registry-session.js";+const ADDRESS_PREFIX = "address:";const BACK = "action:back";const DONE = "action:done";@@ -56,14 +61,33 @@ const REGISTRY_CATEGORIES: ReadonlyArray<{export interface RegistryFlowDeps {browseRegistryCatalog: (typeof import("#cli/commands/registry.js"))["browseRegistryCatalog"];+ detectDeployment: typeof detectDeployment;getRegistryItemManifest: (typeof import("#cli/commands/registry.js"))["getRegistryItemManifest"];installRegistryItem: (typeof import("#cli/commands/registry.js"))["installRegistryItem"];+ runDeployFlow: typeof runDeployFlow;}export type RegistryFlowResult =- | { kind: "done"; addedItems: readonly string[]; output?: readonly string[] }+ | {+ kind: "done";+ addedItems: readonly string[];+ items: readonly import("./registry-session.js").RegistrySessionItemResult[];+ facts: readonly RegistrySetupFact[];+ output?: readonly string[];+ deployed?: "production";+ }| { kind: "cancelled" };+export class RegistryFlowFailedError extends Error {+ readonly completed: Extract<RegistryFlowResult, { kind: "done" }>;++ constructor(error: unknown, completed: Extract<RegistryFlowResult, { kind: "done" }>) {+ super(error instanceof Error ? error.message : String(error), { cause: error });+ this.name = "RegistryFlowFailedError";+ this.completed = completed;+ }+}+function itemLabel(item: RegistryCatalogItem): string {if (item.title !== undefined) return item.title;const name = item.name.split("/").at(-1) ?? item.name;@@ -178,7 +202,14 @@ async function inspectItem(item: RegistryCatalogItem,resolvedManifest?: Record<string, unknown>,signal?: AbortSignal,-): Promise<{ kind: "added"; output: readonly string[] } | { kind: "back" }> {+): Promise<+ | {+ kind: "added";+ output: readonly string[];+ setup?: Awaited<ReturnType<RegistryFlowDeps["installRegistryItem"]>>["setup"];+ }+ | { kind: "back" }+> {const manifest =resolvedManifest ??manifestRecord(@@ -209,8 +240,8 @@ async function inspectItem(prompter,signal,});- const output = await (prompter.withExclusiveTerminal?.(install) ?? install());- return { kind: "added", output };+ const result = await (prompter.withExclusiveTerminal?.(install) ?? install());+ return { kind: "added", ...result };} finally {spinner?.stop();}@@ -254,10 +285,13 @@ export async function runRegistryFlow(input: {}const deps: RegistryFlowDeps = {browseRegistryCatalog: input.deps?.browseRegistryCatalog ?? loaded!.browseRegistryCatalog,+ detectDeployment: input.deps?.detectDeployment ?? detectDeployment,getRegistryItemManifest: input.deps?.getRegistryItemManifest ?? loaded!.getRegistryItemManifest,installRegistryItem: input.deps?.installRegistryItem ?? loaded!.installRegistryItem,+ runDeployFlow: input.deps?.runDeployFlow ?? runDeployFlow,};let notices: SelectNotice[] = [];+ const session = createRegistrySession(deps);try {while (true) {@@ -279,7 +313,7 @@ export async function runRegistryFlow(input: {notices,});notices = [];- if (selectedCategory === DONE) return { kind: "done", addedItems: [] };+ if (selectedCategory === DONE) return session.result();const categoryItems = itemsForCategory(catalog.items, selectedCategory);const rows = itemRows(categoryItems);@@ -315,18 +349,26 @@ export async function runRegistryFlow(input: {"manifest" in resolved ? resolved.manifest : undefined,input.signal,);- if (inspected.kind === "added") {- return inspected.output.length === 0- ? { kind: "done", addedItems: [resolved.item.address] }- : {- kind: "done",- addedItems: [resolved.item.address],- output: inspected.output,- };- }+ if (inspected.kind !== "added") continue;++ session.add(+ resolved.item.address,+ itemLabel(resolved.item),+ inspected.output,+ inspected.setup,+ );+ const next = await session.continueAfterInstall({+ appRoot: input.appRoot,+ prompter: input.prompter,+ signal: input.signal,+ });+ if (next === "add-more") continue;+ return next;}} catch (error) {if (error instanceof WizardCancelledError) return { kind: "cancelled" };+ const completed = session.result();+ if (completed.addedItems.length > 0) throw new RegistryFlowFailedError(error, completed);throw error;}}diff --git a/packages/eve/src/setup/integrations/discord/setup.ts b/packages/eve/src/setup/integrations/discord/setup.tsindex 748a8e6a9..ed6eff010 100644--- a/packages/eve/src/setup/integrations/discord/setup.ts+++ b/packages/eve/src/setup/integrations/discord/setup.ts@@ -148,13 +148,16 @@ export async function setupDiscord(]);return {kind: "done",- facts: [- {- label: "Discord application",- value: `https://discord.com/developers/applications/${application.id}/information`,- kind: "url",- },- ],+ completion: {+ deploymentRequired: true,+ facts: [+ {+ label: "Discord application dashboard",+ value: `https://discord.com/developers/applications/${application.id}/information`,+ kind: "url",+ },+ ],+ },};} catch (error) {if (error instanceof WizardCancelledError) return { kind: "cancelled" };diff --git a/packages/eve/src/setup/integrations/github/setup.test.ts b/packages/eve/src/setup/integrations/github/setup.test.tsindex c36b1e9b3..2379dea31 100644--- a/packages/eve/src/setup/integrations/github/setup.test.ts+++ b/packages/eve/src/setup/integrations/github/setup.test.ts@@ -42,7 +42,7 @@ describe("GitHub setup", () => {},effects,),- ).resolves.toMatchObject({ kind: "done" });+ ).resolves.toMatchObject({ kind: "done", completion: { deploymentRequired: true } });expect(effects.provisionConnector).toHaveBeenCalledWith(expect.objectContaining({ events: selectedEvents }),diff --git a/packages/eve/src/setup/integrations/github/setup.ts b/packages/eve/src/setup/integrations/github/setup.tsindex 6badc0d0a..d79741193 100644--- a/packages/eve/src/setup/integrations/github/setup.ts+++ b/packages/eve/src/setup/integrations/github/setup.ts@@ -142,7 +142,10 @@ export async function setupGitHub(]);return {kind: "done",- facts: [{ label: "Vercel Connect", value: dashboardUrl, kind: "url" }],+ completion: {+ facts: [{ label: "GitHub App dashboard", value: dashboardUrl, kind: "url" }],+ deploymentRequired: true,+ },};} catch (error) {if (error instanceof WizardCancelledError) return { kind: "cancelled" };diff --git a/packages/eve/src/setup/integrations/linear/setup.test.ts b/packages/eve/src/setup/integrations/linear/setup.test.tsindex 0fdbfeb7d..d674bf1ab 100644--- a/packages/eve/src/setup/integrations/linear/setup.test.ts+++ b/packages/eve/src/setup/integrations/linear/setup.test.ts@@ -45,23 +45,26 @@ describe("Linear setup", () => {expect(result).toMatchObject({kind: "done",- facts: [- {- label: "Vercel Connect",- value: "https://vercel.com/d?to=/%5Bteam%5D/~/connect&title=Open+Vercel+Connect",- kind: "url",- },- {- label: "Next step",- value:- "Deploy the agent, then open the Linear app in Vercel Connect and install it in the workspace where you want to delegate issues and comments.",- },- {- label: "In Linear",- value:- "Delegate an issue or mention the agent in an Agent Session to start a conversation.",- },- ],+ completion: {+ facts: [+ {+ label: "Linear app dashboard",+ value: "https://vercel.com/d?to=/%5Bteam%5D/~/connect&title=Open+Vercel+Connect",+ kind: "url",+ },+ {+ label: "Linear installation next step",+ value:+ "Deploy the agent, then open the Linear app in Vercel Connect and install it in the workspace where you want to delegate issues and comments.",+ },+ {+ label: "How to invoke the Linear agent",+ value:+ "Delegate an issue or mention the agent in an Agent Session to start a conversation.",+ },+ { label: "Linear workspace", value: "https://linear.app", kind: "url" },+ ],+ },});expect(effects.provisionConnector).toHaveBeenCalledWith(diff --git a/packages/eve/src/setup/integrations/linear/setup.ts b/packages/eve/src/setup/integrations/linear/setup.tsindex e5fc0781e..efef30a33 100644--- a/packages/eve/src/setup/integrations/linear/setup.ts+++ b/packages/eve/src/setup/integrations/linear/setup.ts@@ -150,19 +150,23 @@ export async function setupLinear(const dashboardUrl = "https://vercel.com/d?to=/%5Bteam%5D/~/connect&title=Open+Vercel+Connect";return {kind: "done",- facts: [- { label: "Vercel Connect", value: dashboardUrl, kind: "url" },- {- label: "Next step",- value:- "Deploy the agent, then open the Linear app in Vercel Connect and install it in the workspace where you want to delegate issues and comments.",- },- {- label: "In Linear",- value:- "Delegate an issue or mention the agent in an Agent Session to start a conversation.",- },- ],+ completion: {+ facts: [+ { label: "Linear app dashboard", value: dashboardUrl, kind: "url" },+ {+ label: "Linear installation next step",+ value:+ "Deploy the agent, then open the Linear app in Vercel Connect and install it in the workspace where you want to delegate issues and comments.",+ },+ {+ label: "How to invoke the Linear agent",+ value:+ "Delegate an issue or mention the agent in an Agent Session to start a conversation.",+ },+ { label: "Linear workspace", value: "https://linear.app", kind: "url" },+ ],+ deploymentRequired: true,+ },};} catch (error) {if (error instanceof WizardCancelledError) return { kind: "cancelled" };diff --git a/packages/eve/src/setup/integrations/photon/setup.ts b/packages/eve/src/setup/integrations/photon/setup.tsindex 0bc879c1c..90cd28cd5 100644--- a/packages/eve/src/setup/integrations/photon/setup.ts+++ b/packages/eve/src/setup/integrations/photon/setup.ts@@ -21,18 +21,21 @@ export const PHOTON_SETUP: SetupIntegration = {if (result.kind === "cancelled") return result;return {kind: "done",- facts: [- ...(result.assignedPhoneNumber === undefined- ? []- : [- {- label: "Text your agent",- value: result.assignedPhoneNumber,- kind: "phone" as const,- },- ]),- { label: "Photon project", value: result.dashboardUrl, kind: "url" as const },- ],+ completion: {+ deploymentRequired: true,+ facts: [+ ...(result.assignedPhoneNumber === undefined+ ? []+ : [+ {+ label: "Agent phone number",+ value: result.assignedPhoneNumber,+ kind: "phone" as const,+ },+ ]),+ { label: "Photon project dashboard", value: result.dashboardUrl, kind: "url" as const },+ ],+ },};},};diff --git a/packages/eve/src/setup/integrations/runner.ts b/packages/eve/src/setup/integrations/runner.tsindex 46673758c..f41064648 100644--- a/packages/eve/src/setup/integrations/runner.ts+++ b/packages/eve/src/setup/integrations/runner.ts@@ -1,5 +1,4 @@import { interactiveAsker } from "#setup/ask.js";-import type { RegistrySetupFact } from "#setup/registry-setup-protocol.js";import { detectDeployment, projectResolutionFromDeployment } from "#setup/project-resolution.js";import type { Prompter } from "#setup/prompter.js";import { getVercelAuthStatus } from "#setup/vercel-project.js";@@ -10,6 +9,7 @@ import {} from "./shared/environment.js";import { createIntegrationSetupUi } from "./shared/ui.js";import { setupIntegration } from "./registry.js";+import type { IntegrationSetupResult } from "./types.js";/** Inputs shared by every registry-owned integration setup flow. */export interface RunIntegrationSetupOptions {@@ -30,17 +30,12 @@ const defaultDeps: IntegrationSetupRunnerDeps = {getVercelAuthStatus,};-/** Outcome returned by one registry-owned integration setup flow. */-export type IntegrationSetupOutcome =- | { kind: "cancelled" }- | { kind: "done"; facts?: readonly RegistrySetupFact[] };-/** Runs one built-in integration setup flow selected by its registry setup name. */export async function runIntegrationSetup(kind: string,options: RunIntegrationSetupOptions,deps: IntegrationSetupRunnerDeps = defaultDeps,-): Promise<IntegrationSetupOutcome> {+): Promise<IntegrationSetupResult> {const integration = setupIntegration(kind);options.prompter.intro(`Set up ${integration.label}`);options.prompter.log.message("Checking Vercel setup...");@@ -51,7 +46,7 @@ export async function runIntegrationSetup(const project = projectResolutionFromDeployment(deployment);const environment = integrationSetupEnvironment(authStatus, project);options.prompter.log.info(describeIntegrationSetupEnvironment(environment));- const result = await integration.setup({+ const context = {environment,appRoot: options.appRoot,ui: createIntegrationSetupUi({@@ -60,6 +55,6 @@ export async function runIntegrationSetup(}),yes: options.yes,signal: options.signal,- });- return result;+ };+ return integration.setup(context);}diff --git a/packages/eve/src/setup/integrations/slack/setup.test.ts b/packages/eve/src/setup/integrations/slack/setup.test.tsindex 7c1a3b9fd..be5007d31 100644--- a/packages/eve/src/setup/integrations/slack/setup.test.ts+++ b/packages/eve/src/setup/integrations/slack/setup.test.ts@@ -47,7 +47,10 @@ describe("setupSlack", () => {},effects,),- ).resolves.toEqual({ kind: "done" });+ ).resolves.toEqual({+ kind: "done",+ completion: { facts: [], deploymentRequired: true },+ });expect(provisionSlackbot).toHaveBeenCalledOnce();});diff --git a/packages/eve/src/setup/integrations/slack/setup.ts b/packages/eve/src/setup/integrations/slack/setup.tsindex 2900e1590..03fa584f8 100644--- a/packages/eve/src/setup/integrations/slack/setup.ts+++ b/packages/eve/src/setup/integrations/slack/setup.ts@@ -11,6 +11,7 @@ import {type ProvisionSlackbotResult,} from "#setup/slackbot.js";import { WizardCancelledError } from "#setup/step.js";+import { slackMessageDeepLink } from "#setup/slack-connect.js";import { installScaffoldDependencies, reportOverwrittenFiles } from "../shared/scaffold.js";import type {@@ -191,7 +192,10 @@ export async function setupSlack("Set SLACK_BOT_TOKEN and SLACK_SIGNING_SECRET in .env.local (listed in .env.example).","Configure your Slack app to send events to /eve/v1/slack on your public agent URL.",]);- return { kind: "done" };+ return {+ kind: "done",+ completion: { facts: [], deploymentRequired: true },+ };}const project = await deps.ensureVercelProject({@@ -226,7 +230,22 @@ export async function setupSlack(projectPath: context.appRoot,signal: context.signal,});- return { kind: "done" };+ return {+ kind: "done",+ completion: {+ facts:+ slackbot.chatUrl === undefined+ ? []+ : [+ {+ label: "Agent Slack DM",+ value: slackMessageDeepLink(slackbot.chatUrl),+ kind: "url",+ },+ ],+ deploymentRequired: true,+ },+ };}/** Slack setup registration. */diff --git a/packages/eve/src/setup/integrations/types.ts b/packages/eve/src/setup/integrations/types.tsindex 1a9da739b..de4ced18f 100644--- a/packages/eve/src/setup/integrations/types.ts+++ b/packages/eve/src/setup/integrations/types.ts@@ -1,4 +1,4 @@-import type { RegistrySetupFact } from "#setup/registry-setup-protocol.js";+import type { RegistrySetupCompletion } from "#setup/registry-setup-protocol.js";import type { IntegrationSetupEnvironment } from "./shared/environment.js";import type { IntegrationSetupUi } from "./shared/ui.js";@@ -15,7 +15,7 @@ export interface IntegrationSetupContext {/** Outcome from one registry-owned integration setup flow. */export type IntegrationSetupResult =- | { readonly kind: "done"; readonly facts?: readonly RegistrySetupFact[] }+ | { readonly kind: "done"; readonly completion: RegistrySetupCompletion }| { readonly kind: "cancelled" };/** One built-in registry-owned integration setup flow. */diff --git a/packages/eve/src/setup/integrations/web/setup.ts b/packages/eve/src/setup/integrations/web/setup.tsindex 1c9715c87..6ce274eee 100644--- a/packages/eve/src/setup/integrations/web/setup.ts+++ b/packages/eve/src/setup/integrations/web/setup.ts@@ -46,7 +46,7 @@ export const WEB_SETUP: SetupIntegration = {);if (result.action === "skipped") {context.ui.prompter.log.info("Next.js project detected. Skipping Web Chat scaffolding.");- return { kind: "done" };+ return { kind: "done", completion: { facts: [] } };}context.ui.prompter.log.success("Scaffolded channel: web");await installScaffoldDependencies({@@ -55,6 +55,9 @@ export const WEB_SETUP: SetupIntegration = {projectPath: context.appRoot,signal: context.signal,});- return { kind: "done" };+ return {+ kind: "done",+ completion: { facts: [], deploymentRequired: true },+ };},};diff --git a/packages/eve/src/setup/prompter.ts b/packages/eve/src/setup/prompter.tsindex 3b49d4aaa..6973a42ef 100644--- a/packages/eve/src/setup/prompter.ts+++ b/packages/eve/src/setup/prompter.ts@@ -250,6 +250,12 @@ export interface Prompter {/** Prints a final green ● end-cap with the message. */outro(message: string): void;+ /** Replaces transient setup output with one compact current-item summary. */+ replaceContent?(content?: {+ headline: string;+ facts: readonly { label: string; value: string }[];+ }): void;+/** Temporarily hands terminal ownership to a command that inherits stdio. */withInheritedStdio?<T>(task: () => Promise<T>): Promise<T>;diff --git a/packages/eve/src/setup/registry-setup-client.test.ts b/packages/eve/src/setup/registry-setup-client.test.tsindex e6945154d..471501b9c 100644--- a/packages/eve/src/setup/registry-setup-client.test.ts+++ b/packages/eve/src/setup/registry-setup-client.test.ts@@ -38,7 +38,7 @@ describe("createRegistrySetupClient", () => {const processStub = new SetupProcessStub();const setup = client(processStub);- setup.complete([{ label: "Connector", value: "linear/agent" }]);+ setup.complete({ facts: [{ label: "Connector", value: "linear/agent" }] });expect(processStub.sent.at(-1)).toEqual({type: "result",diff --git a/packages/eve/src/setup/registry-setup-client.ts b/packages/eve/src/setup/registry-setup-client.tsindex 14dcec483..c06c3b6a8 100644--- a/packages/eve/src/setup/registry-setup-client.ts+++ b/packages/eve/src/setup/registry-setup-client.ts@@ -10,7 +10,7 @@ import { WizardCancelledError } from "./step.js";import {REGISTRY_SETUP_PROTOCOL_VERSION,type RegistrySetupChildMessage,- type RegistrySetupFact,+ type RegistrySetupCompletion,type RegistrySetupOutcome,type RegistrySetupParentMessage,type RegistrySetupPrompt,@@ -46,7 +46,7 @@ function registrySetupError(error: unknown): { message: string; details?: readonexport interface RegistrySetupClient {prompter: Prompter;signal: AbortSignal;- complete(facts?: readonly RegistrySetupFact[]): void;+ complete(completion?: RegistrySetupCompletion): void;cancel(): void;fail(error: unknown): void;}@@ -212,7 +212,7 @@ export function createRegistrySetupClient(return {prompter,signal: controller.signal,- complete: (facts = []) => finish({ kind: "completed", facts }),+ complete: (completion = { facts: [] }) => finish({ kind: "completed", ...completion }),cancel: () => finish({ kind: "cancelled" }),fail: (error) => finish({ kind: "failed", error: registrySetupError(error) }),};diff --git a/packages/eve/src/setup/registry-setup-completion.test.ts b/packages/eve/src/setup/registry-setup-completion.test.tsnew file mode 100644index 000000000..990d4a563--- /dev/null+++ b/packages/eve/src/setup/registry-setup-completion.test.ts@@ -0,0 +1,23 @@+import { describe, expect, it } from "vitest";++import { mergeRegistrySetupCompletions } from "./registry-setup-completion.js";++describe("registry setup completion", () => {+ it("merges facts and preserves the deployment requirement", () => {+ expect(+ mergeRegistrySetupCompletions(+ { facts: [{ label: "Workspace", value: "Acme" }] },+ {+ facts: [{ label: "Open Slack", value: "https://slack.com/app", kind: "url" }],+ deploymentRequired: true,+ },+ ),+ ).toEqual({+ facts: [+ { label: "Workspace", value: "Acme" },+ { label: "Open Slack", value: "https://slack.com/app", kind: "url" },+ ],+ deploymentRequired: true,+ });+ });+});diff --git a/packages/eve/src/setup/registry-setup-completion.ts b/packages/eve/src/setup/registry-setup-completion.tsnew file mode 100644index 000000000..151486ab6--- /dev/null+++ b/packages/eve/src/setup/registry-setup-completion.ts@@ -0,0 +1,11 @@+import type { RegistrySetupCompletion } from "./registry-setup-protocol.js";++/** Combines setup completions while preserving their facts and deployment requirement. */+export function mergeRegistrySetupCompletions(+ ...completions: readonly RegistrySetupCompletion[]+): RegistrySetupCompletion {+ const facts = completions.flatMap((completion) => completion.facts);+ return completions.some((completion) => completion.deploymentRequired === true)+ ? { facts, deploymentRequired: true }+ : { facts };+}diff --git a/packages/eve/src/setup/registry-setup-protocol.ts b/packages/eve/src/setup/registry-setup-protocol.tsindex 8f18150da..b4a046ad8 100644--- a/packages/eve/src/setup/registry-setup-protocol.ts+++ b/packages/eve/src/setup/registry-setup-protocol.ts@@ -16,13 +16,18 @@ export type RegistrySetupFact = {kind?: "text" | "url" | "phone";};+export type RegistrySetupCompletion = {+ facts: readonly RegistrySetupFact[];+ deploymentRequired?: true;+};+export type RegistrySetupError = {message: string;details?: readonly string[];};export type RegistrySetupOutcome =- | { kind: "completed"; facts: readonly RegistrySetupFact[] }+ | ({ kind: "completed" } & RegistrySetupCompletion)| { kind: "cancelled" }| { kind: "failed"; error: RegistrySetupError };