feat(server): add first-class Devin provider over ACP #11356
Closedsaphid(GitHub profile, opens in a new tab)wants to merge 13 commits into
main fromrefs/pull/11356/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
- apps/server/src/provider/Layers/DevinAdapter.ts line 292Resolvedby saphid(GitHub profile, opens in a new tab)@@ -0,0 +254,21 @@254+ const locks = yield* SynchronizedRef.make(new Map<ThreadId, Semaphore.Semaphore>());255+ const events = yield* PubSub.unbounded<ProviderRuntimeEvent>();256+ const nowIso = Effect.map(DateTime.now, DateTime.formatIso);257+ const randomId = crypto.randomUUIDv4.pipe(258+ Effect.mapError(259+ (cause) =>260+ new ProviderAdapterRequestError({261+ provider: PROVIDER,262+ method: "crypto/randomUUIDv4",263+ detail: "Could not create a Devin event ID.",264+ cause,265+ }),266+ ),267+ );268+ const stamp = Effect.all({269+ eventId: Effect.map(randomId, EventId.make),270+ createdAt: nowIso,271+ });272+ const emit = (event: ProviderRuntimeEvent) => PubSub.publish(events, event).pipe(Effect.asVoid);273+274+ const withThreadLock = <A, E, R>(threadId: ThreadId, task: Effect.Effect<A, E, R>) =>
- apps/server/src/provider/Layers/DevinAdapter.ts line 536OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +516,21 @@516+ if (transferred) return Effect.void;517+ sessions.delete(input.threadId);518+ return Scope.close(sessionScope, Exit.void);519+ });520+ const stopOwned = Effect.suspend(() =>521+ context ? stopContext(context).pipe(Effect.ignore) : Scope.close(sessionScope, Exit.void),522+ );523+524+ return yield* Effect.gen(function* () {525+ // The attachments dir grant lets the agent read pasted files at the526+ // paths ProviderService injects into the turn text. It is a leaf527+ // directory holding only uploads.528+ const runtime = yield* options.makeRuntime({529+ cwd,530+ clientInfo: { name: "t3-code", version: "0.0.0" },531+ additionalDirectories: [serverConfig.attachmentsDir],532+ ...(Option.isSome(cursor) ? { resumeSessionId: cursor.value.sessionId } : {}),533+ // `session/load` replays history without the agent re-running it;534+ // Devin advertises loadSession but not session/resume.535+ resumeMethod: "load",536+ mcpServers: [],apps/server/src/provider/Layers/DevinProvider.ts lines 439 to 441OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +421,21 @@421+ );422+423+ /**424+ * Distinguishes who set `auth.status: "unauthenticated"`: the CLI probe is425+ * authoritative and must not be undone, while the adapter's sign-in error426+ * match can false-positive on stray upstream errors and may be healed by427+ * live session events.428+ */429+ let adapterFlaggedAuth = false;430+431+ const checkProvider = Effect.fn("DevinProvider.checkProvider")(function* () {432+ if (!settings.enabled) return yield* getSnapshot;433+ const probe = yield* options.probe;434+ adapterFlaggedAuth = false;435+ const checkedAt = DateTime.formatIso(yield* DateTime.now);436+ const next = yield* SubscriptionRef.updateAndGet(metadata, (draft) => {437+ const { message: _previousMessage, ...rest } = draft;438+ const models =439+ probe.models.length > 0440+ ? devinModelsFromSettings(settings.customModels, probe.models)441+ : draft.models;apps/server/src/provider/Layers/DevinAdapter.ts lines 862 to 868Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +768,21 @@768+ // model/mode: the old turn finishes on the configuration it769+ // started with, and if the cancel itself fails this sendTurn770+ // aborts with the still-running prompt still tracked (no intent771+ // was created, so the error path cannot finish the turn).772+ context.cancelling = true;773+ yield* cancelRequests(context);774+ yield* context.runtime.cancel.pipe(775+ Effect.tapError(() => Effect.sync(() => (context.cancelling = false))),776+ );777+ yield* Fiber.await(context.promptFiber);778+ }779+ const turnId = context.activeTurnId ?? TurnId.make(yield* randomId);780+ const steering = context.activeTurnId !== undefined;781+ const turn: TurnIntent = { turnId, generation: ++context.generation, settled: false };782+ intent = turn;783+ context.activeTurnId = turnId;784+ const model = yield* applyDevinAcpModelSelection({785+ runtime: context.runtime,786+ model: requestedUnavailable ? undefined : requestedModel,787+ mapError: (cause) => cause,788+ });
- apps/server/scripts/acp-mock-agent.ts lines 77 to 78OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -67,5 +71,8 @@6771 );6872 const sessionId = "mock-session-1";697370-let currentModeId = antigravityProfile ? "default" : "ask";71-let currentModelId = antigravityProfile ? "gemini-test-low" : "default";74+let currentModeId = antigravityProfile ? "default" : devinProfile ? "smart" : "ask";75+let currentModelId = antigravityProfile76+ ? "gemini-test-low"77+ : devinProfile78+ ? "swe-2-high"apps/server/src/provider/Layers/DevinProvider.ts lines 484 to 487OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -0,0 +467,21 @@467+ SubscriptionRef.changes(metadata).pipe(468+ Stream.runForEach((draft) => publishSnapshot(options.stampIdentity(draft))),469+ ),470+ });471+472+ const onSessionStarted = Effect.fn("DevinProvider.onSessionStarted")(function* (473+ started: AcpSessionRuntimeStartResult,474+ ) {475+ adapterFlaggedAuth = false;476+ const checkedAt = DateTime.formatIso(yield* DateTime.now);477+ yield* SubscriptionRef.update(metadata, (draft) => {478+ const { message: _previousMessage, ...rest } = draft;479+ const configOptions =480+ "configOptions" in started.sessionSetupResult &&481+ Array.isArray(started.sessionSetupResult.configOptions)482+ ? started.sessionSetupResult.configOptions483+ : [];484+ const sessionModels = devinModelsFromSettings(485+ settings.customModels,486+ buildDevinModelsFromSession(configOptions),487+ );apps/server/src/provider/Services/DevinAdapter.ts lines 10 to 16Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -0,0 +1,16 @@1+/**2+ * DevinAdapter — shape type for the Devin provider adapter.3+ *4+ * The driver model ({@link ../Drivers/DevinDriver}) bundles one adapter per5+ * instance as a captured closure, so this module only retains the shape6+ * interface as a naming anchor for the driver bundle.7+ *8+ * @module DevinAdapter9+ */10+import type { ProviderAdapterError } from "../Errors.ts";11+import type { ProviderAdapterShape } from "./ProviderAdapter.ts";12+13+/**14+ * DevinAdapterShape — per-instance Devin adapter contract.15+ */16+export interface DevinAdapterShape extends ProviderAdapterShape<ProviderAdapterError> {}apps/server/src/textGeneration/DevinTextGeneration.test.ts lines 85 to 86OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -0,0 +66,21 @@66+ .trim()67+ .split("\n")68+ .filter((line) => line.length > 0)69+ .map((line) => JSON.parse(line) as { method?: string; params?: Record<string, unknown> });70+}71+72+it.layer(DevinTextGenerationTestLayer)("DevinTextGeneration", (it) => {73+ it.effect("generates without an authenticate request even when no credentials exist", () => {74+ const requestLogDir = NodeFS.mkdtempSync(75+ NodePath.join(NodeOS.tmpdir(), "t3code-devin-text-log-"),76+ );77+ const requestLogPath = NodePath.join(requestLogDir, "requests.ndjson");78+ const fakeHome = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3code-devin-home-"));79+80+ return withFakeAcpDevin(81+ {82+ T3_ACP_REQUEST_LOG_PATH: requestLogPath,83+ T3_ACP_PROMPT_RESPONSE_TEXT: JSON.stringify({ branch: "fix/login-redirect" }),84+ },85+ // Signed-out environment: no API key and no credentials file.86+ { ...process.env, HOME: fakeHome, WINDSURF_API_KEY: "" },apps/server/src/textGeneration/DevinTextGeneration.ts lines 120 to 130Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -0,0 +89,21 @@89+90+ const promptResult = yield* Effect.gen(function* () {91+ yield* runtime.start();92+ yield* applyDevinAcpModelSelection({93+ runtime,94+ model: resolvedModel,95+ mapError: (cause) => cause,96+ }).pipe(97+ // The configured text-generation model may not be in the account's98+ // catalog; fall back to the model the session already runs on99+ // rather than failing the operation. `catch` (not `catchCause`) so100+ // the prompt timeout's interruption is not swallowed.101+ Effect.catch((error) =>102+ Effect.logWarning(103+ "Devin text-generation model selection failed; using the session model.",104+ {105+ errorTag: error._tag,106+ requestedModel: resolvedModel,107+ },108+ ),109+ ),apps/server/src/textGeneration/DevinTextGeneration.ts lines 158 to 169Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -0,0 +125,21 @@125+ ),126+ Effect.mapError((cause: EffectAcpErrors.AcpError | TextGenerationError) =>127+ isTextGenerationError(cause)128+ ? cause129+ : new TextGenerationError({130+ operation,131+ detail: "Devin ACP request failed.",132+ cause,133+ }),134+ ),135+ );136+137+ const trimmed = (yield* Ref.get(outputRef)).trim();138+ if (!trimmed) {139+ return yield* new TextGenerationError({140+ operation,141+ detail:142+ promptResult.stopReason === "cancelled"143+ ? "Devin ACP request was cancelled."144+ : "Devin returned empty output.",145+ });
- apps/server/src/provider/Layers/DevinAdapter.ts line 564Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +510,21 @@510+ const previous = sessions.get(input.threadId);511+ if (previous) yield* stopContext(previous);512+ const cwd = path.resolve(input.cwd);513+ const sessionScope = yield* Scope.make("sequential");514+ let transferred = false;515+ let context: SessionContext | undefined;516+ yield* Effect.addFinalizer(() => {517+ if (transferred) return Effect.void;518+ sessions.delete(input.threadId);519+ return Scope.close(sessionScope, Exit.void);520+ });521+ const stopOwned = Effect.suspend(() =>522+ context ? stopContext(context).pipe(Effect.ignore) : Scope.close(sessionScope, Exit.void),523+ );524+525+ return yield* Effect.gen(function* () {526+ const mcpSession = McpProviderSession.readMcpProviderSession(input.threadId);527+ // The attachments dir grant lets the agent read pasted files at the528+ // paths ProviderService injects into the turn text. It is a leaf529+ // directory holding only uploads.530+ const runtime = yield* options.makeRuntime({apps/server/src/provider/Layers/DevinProvider.ts line 300OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +280,21 @@280+ }281+282+ const modelsResult =283+ auth.status === "authenticated"284+ ? yield* runDevinCliCommand(285+ devinSettings,286+ ["models", "list", "--format", "json"],287+ environment,288+ ).pipe(289+ Effect.tapError((error) =>290+ Effect.logWarning("Devin CLI model listing failed.", {291+ errorTag: error._tag,292+ }),293+ ),294+ Effect.timeoutOption(MODELS_PROBE_TIMEOUT_MS),295+ Effect.result,296+ )297+ : undefined;298+ // A failed or skipped listing keeps the previous catalog; a successful299+ // listing (even an empty one) replaces it.300+ const modelsFetched =
- apps/server/src/provider/Layers/DevinAdapter.ts line 930OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +910,21 @@910+ ),911+ ),912+ Effect.onInterrupt(() =>913+ context.promptLock.withPermit(914+ Effect.gen(function* () {915+ const turn = intent;916+ if (!turn || turn.settled || context.stopped || context.generation !== turn.generation)917+ return;918+ const promptFiber = context.promptFiber;919+ context.cancelling = true;920+ yield* cancelRequests(context);921+ yield* Effect.ignore(context.runtime.cancel);922+ if (promptFiber) yield* Fiber.interrupt(promptFiber);923+ yield* finishTurn(turn, { state: "cancelled", stopReason: "cancelled" });924+ }),925+ ),926+ ),927+ );928+ });929+930+ const interruptTurn: Adapter["interruptTurn"] = (threadId) =>
- apps/server/src/provider/Layers/DevinAdapter.ts line 160OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +140,21 @@140+ for (const kind of kinds) {141+ const match = request.options.find(142+ (option) =>143+ typeof option.kind === "string" &&144+ (option.kind === kind || option.kind.replaceAll("-", "_") === kind),145+ );146+ if (match) return match.optionId;147+ }148+ return undefined;149+}150+151+function devinApprovalOptions(request: NativePermission): ReadonlyArray<ProviderApprovalOption> {152+ return request.options.flatMap((option): ProviderApprovalOption[] => {153+ const label = typeof option.name === "string" && option.name.trim() ? option.name : "Continue";154+ switch (option.kind) {155+ case "allow_once":156+ return [{ decision: "accept" as const, label }];157+ case "allow_always":158+ return [{ decision: "acceptForSession" as const, label }];159+ case "reject_once":160+ case "reject_always":
- apps/server/src/provider/acp/DevinAcpSupport.ts lines 433 to 437Resolvedby saphid(GitHub profile, opens in a new tab)@@ -0,0 +405,21 @@405+ const text = input.input?.trim();406+ if (text) blocks.push({ type: "text", text });407+ let totalBytes = 0;408+409+ for (const attachment of input.attachments ?? []) {410+ const mimeType = attachment.mimeType.toLowerCase().split(";", 1)[0] ?? "";411+ const image = attachment.type === "image" && DEVIN_IMAGE_MIME_TYPES.has(mimeType);412+ const textFile =413+ attachment.type === "file" &&414+ (mimeType.startsWith("text/") ||415+ DEVIN_TEXT_MIME_TYPES.has(mimeType) ||416+ DEVIN_TEXT_FILE_EXTENSIONS.has(path.extname(attachment.name).toLowerCase()));417+ const attachmentPath = resolveAttachmentPath({418+ attachmentsDir: input.attachmentsDir,419+ attachment,420+ });421+ if (!attachmentPath) {422+ return yield* EffectAcpErrors.AcpRequestError.invalidParams(423+ `Invalid attachment '${attachment.name}'.`,424+ );425+ }
- apps/server/src/provider/Services/DevinAdapter.ts lines 16 to 16Resolvedby saphid(GitHub profile, opens in a new tab)@@ -0,0 +1,16 @@1+/**2+ * DevinAdapter — shape type for the Devin provider adapter.3+ *4+ * The driver model ({@link ../Drivers/DevinDriver}) bundles one adapter per5+ * instance as a captured closure, so this module only retains the shape6+ * interface as a naming anchor for the driver bundle.7+ *8+ * @module DevinAdapter9+ */10+import type { ProviderAdapterError } from "../Errors.ts";11+import type { ProviderAdapterShape } from "./ProviderAdapter.ts";12+13+/**14+ * DevinAdapterShape — per-instance Devin adapter contract.15+ */16+export interface DevinAdapterShape extends ProviderAdapterShape<ProviderAdapterError> {}apps/server/src/provider/acp/DevinAcpSupport.ts lines 151 to 151Resolvedby saphid(GitHub profile, opens in a new tab)@@ -0,0 +131,21 @@131+ return /already open in another process/i.test(error.errorMessage);132+}133+134+export function buildDevinAcpSpawnInput(135+ devinSettings: DevinAcpRuntimeDevinSettings | null | undefined,136+ cwd: string,137+ environment?: NodeJS.ProcessEnv,138+): AcpSessionRuntime.AcpSpawnInput {139+ return {140+ command: devinSettings?.binaryPath || "devin",141+ args: ["acp"],142+ cwd,143+ ...(environment ? { env: environment } : {}),144+ };145+}146+147+export interface DevinAcpRuntimeInput extends Omit<148+ AcpSessionRuntime.AcpSessionRuntimeOptions,149+ "authMethodId" | "clientCapabilities" | "spawn"150+> {151+ readonly childProcessSpawner: ChildProcessSpawner.ChildProcessSpawner["Service"];
- apps/server/src/mcp/McpStdioBridge.ts lines 163 to 163OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +143,21 @@143+`;144+145+export const MCP_STDIO_BRIDGE_FILE_NAME = "mcp-stdio-bridge.mjs";146+147+/**148+ * Ensures the bridge script exists under `stateDir` and returns its absolute149+ * path. Reuses an up-to-date copy so warm restarts do not rewrite the file.150+ */151+export const ensureMcpStdioBridge = (152+ stateDir: string,153+): Effect.Effect<string, PlatformError.PlatformError, FileSystem.FileSystem | Path.Path> =>154+ Effect.gen(function* () {155+ const fileSystem = yield* FileSystem.FileSystem;156+ const path = yield* Path.Path;157+ const bridgePath = path.join(stateDir, MCP_STDIO_BRIDGE_FILE_NAME);158+ const existing = yield* fileSystem.readFileString(bridgePath).pipe(Effect.option);159+ if (existing._tag === "Some" && existing.value === MCP_STDIO_BRIDGE_SOURCE) {160+ return bridgePath;161+ }162+ yield* fileSystem.makeDirectory(stateDir, { recursive: true });163+ const tempPath = `${bridgePath}.${process.pid}.tmp`;@@ -98,4 +98,4 @@9898 selectedModel: string | null | undefined,9999 hiddenModels: ReadonlyArray<string>,100100 ): AppModelOption[] {101- if (provider !== "opencode" && provider !== "antigravity") return options;101+ if (provider !== "opencode" && provider !== "antigravity" && provider !== "devin") return options;apps/server/src/textGeneration/DevinTextGeneration.ts lines 275 to 277Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +239,21 @@239+ });240+241+ const generated = yield* runDevinJson({242+ operation: "generateBranchName",243+ cwd: input.cwd,244+ prompt,245+ outputSchemaJson: outputSchema,246+ modelSelection: input.modelSelection,247+ });248+249+ return {250+ branch: sanitizeBranchFragment(generated.branch),251+ };252+ });253+254+ const generateThreadTitle: TextGeneration.TextGeneration["Service"]["generateThreadTitle"] =255+ Effect.fn("DevinTextGeneration.generateThreadTitle")(function* (input) {256+ const { prompt, outputSchema } = buildThreadTitlePrompt({257+ message: input.message,258+ previousTitle: input.previousTitle,259+ attachments: input.attachments,apps/server/src/textGeneration/DevinTextGeneration.ts lines 288 to 291Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +252,21 @@252+ });253+254+ const generateThreadTitle: TextGeneration.TextGeneration["Service"]["generateThreadTitle"] =255+ Effect.fn("DevinTextGeneration.generateThreadTitle")(function* (input) {256+ const { prompt, outputSchema } = buildThreadTitlePrompt({257+ message: input.message,258+ previousTitle: input.previousTitle,259+ attachments: input.attachments,260+ });261+262+ const generated = yield* runDevinJson({263+ operation: "generateThreadTitle",264+ cwd: input.cwd,265+ prompt,266+ outputSchemaJson: outputSchema,267+ modelSelection: input.modelSelection,268+ });269+270+ return {271+ title: sanitizeThreadTitle(generated.title),272+ } satisfies TextGeneration.ThreadTitleGenerationResult;apps/server/src/provider/Layers/DevinAdapter.ts line 571Resolvedby saphid(GitHub profile, opens in a new tab)@@ -0,0 +551,21 @@551+ Effect.provideService(FileSystem.FileSystem, fileSystem),552+ Effect.provideService(Path.Path, path),553+ Effect.catch((cause) =>554+ Effect.logWarning(555+ "Could not write the Devin MCP stdio bridge script; falling back to the HTTP MCP entry.",556+ { cause },557+ ).pipe(Effect.as(undefined)),558+ ),559+ )560+ : undefined;561+ // The attachments dir grant lets the agent read pasted files at the562+ // paths ProviderService injects into the turn text. It is a leaf563+ // directory holding only uploads.564+ const runtime = yield* options.makeRuntime({565+ cwd,566+ environment: McpProviderSession.withAgentDeviceEnvironment(567+ options.environment ?? process.env,568+ mcpSession,569+ ),570+ clientInfo: { name: "t3-code", version: "0.0.0" },571+ additionalDirectories: [serverConfig.attachmentsDir],apps/server/src/provider/Layers/DevinAdapter.ts line 771Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +751,21 @@751+ : Effect.void,752+ ),753+ Effect.mapError((cause) =>754+ isAcpError(cause)755+ ? mapDevinError(input.threadId, "session/start", cause)756+ : new ProviderAdapterRequestError({757+ provider: PROVIDER,758+ method: "session/start",759+ detail: "Could not start Devin. Check the provider setup status.",760+ cause,761+ }),762+ ),763+ // The session scope owns the process; the stopOwned path keeps a764+ // start failure from leaking it.765+ Effect.onError(() => stopOwned.pipe(Effect.ignore)),766+ );767+ }).pipe(Effect.scoped),768+ );769+770+ const sendTurn: Adapter["sendTurn"] = Effect.fn("DevinAdapter.sendTurn")(function* (input) {771+ const context = yield* requireSession(input.threadId);apps/server/src/provider/Layers/DevinProvider.ts line 234Resolvedby saphid(GitHub profile, opens in a new tab)@@ -0,0 +214,21 @@214+215+ const versionOutput = versionResult.success.value;216+ const version = parseGenericCliVersion(`${versionOutput.stdout}\n${versionOutput.stderr}`);217+ if (versionOutput.code !== 0) {218+ yield* Effect.logWarning("Devin CLI version probe exited with a non-zero status.", {219+ exitCode: versionOutput.code,220+ stdoutLength: versionOutput.stdout.length,221+ stderrLength: versionOutput.stderr.length,222+ });223+ return {224+ installed: true,225+ version,226+ auth: { status: "unknown" },227+ status: "error",228+ message: "Devin CLI is installed but failed to run.",229+ modelsFetched: false,230+ models: [],231+ };232+ }233+234+ const apiKeyAuth: ServerProviderAuth | undefined = environment[DEVIN_API_KEY_ENV]?.trim()apps/server/src/textGeneration/DevinTextGeneration.ts line 133Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +96,21 @@96+ }).pipe(97+ // The configured text-generation model may not be in the account's98+ // catalog; fall back to the model the session already runs on99+ // rather than failing the operation. Only an invalid-params100+ // rejection means "model unavailable" — transport/protocol failures101+ // still propagate. `catch` (not `catchCause`) so the prompt102+ // timeout's interruption is not swallowed.103+ Effect.catch((error) =>104+ error._tag === "AcpRequestError" && error.code === -32602105+ ? Effect.logWarning(106+ "Devin text-generation model selection failed; using the session model.",107+ {108+ errorTag: error._tag,109+ requestedModel: resolvedModel,110+ },111+ )112+ : Effect.fail(error),113+ ),114+ );115+116+ return yield* runtime.prompt({apps/server/src/provider/acp/AcpSessionRuntime.ts line 126Resolvedby saphid(GitHub profile, opens in a new tab)@@ -96,3 +107,20 @@96- readonly mcpServers?: ReadonlyArray<EffectAcpSchema.McpServer>;107+ /**108+ * When set, startup sends `authenticate` after `initialize`. When absent, the109+ * runtime skips authentication entirely — for agents like `devin acp` that110+ * already read stored CLI credentials, where sending `authenticate` would111+ * open an interactive login even though the user is signed in.112+ */113+ readonly authMethodId?: string | undefined;114+ /**115+ * MCP servers attached to `session/new`, `session/load`, and `session/resume`.116+ * A function form receives the agent's `mcpCapabilities` from `initialize` so117+ * the caller can pick the transport the agent actually supports (e.g. stdio118+ * when `http`/`sse` are false).119+ */120+ readonly mcpServers?:121+ | ReadonlyArray<EffectAcpSchema.McpServer>122+ | ((123+ capabilities: EffectAcpSchema.McpCapabilities | undefined,124+ ) => ReadonlyArray<EffectAcpSchema.McpServer>);97125 /** Extra workspace roots the agent may read and write besides `cwd`. */98126 readonly additionalDirectories?: ReadonlyArray<string>;
- apps/server/src/mcp/McpStdioBridge.ts lines 85 to 85Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +57,21 @@57+ "content-type": "application/json",58+ accept: "application/json, text/event-stream",59+ };60+ if (authorization) headers.authorization = authorization;61+ if (sessionId) headers["mcp-session-id"] = sessionId;62+ if (protocolVersion) headers["mcp-protocol-version"] = protocolVersion;63+64+ const response = await fetch(endpoint, { method: "POST", headers, body: line });65+ sessionId = response.headers.get("mcp-session-id") ?? sessionId;66+ protocolVersion = response.headers.get("mcp-protocol-version") ?? protocolVersion;67+68+ const contentType = response.headers.get("content-type") ?? "";69+ if (contentType.includes("text/event-stream")) {70+ for (const message of parseSseEvents(await response.text())) {71+ writeMessage(message);72+ }73+ return;74+ }75+76+ const text = await response.text();77+ if (text.trim()) {
juliusmarminge closed this
Sign in to join this conversation.



macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed