feat(providers): standardize ACP providers #6461
MergedStiensWout(GitHub profile, opens in a new tab)merged 9 commits into
t3code/codex-turn-mapping fromrefs/pull/6461/headmerged by juliusmarminge 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/acp/AcpRegistrySupport.ts line 659OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -351,5 +656,4 @@351656 );352657 const [stdout, stderr, exitCode] = yield* Effect.all(353658 [354- collectUint8StreamText({ stream: child.stdout }),355- collectUint8StreamText({ stream: child.stderr }),659+ collectUint8StreamText({ stream: child.stdout, maxBytes: 1024 * 1024 }),apps/web/src/components/settings/ProviderInstanceCard.tsx line 634OutdatedResolvedby StiensWout(GitHub profile, opens in a new tab)@@ -620,4 +627,8 @@620627 updateEnvironment(providerEnvironmentWithoutNames(instance.environment, new Set([field.name])));621628 };622629623- const titleIconNode = driverKind ? (630+ const registryIconUrl =631+ driverKind === "acpRegistry"632+ ? officialAcpRegistryIconUrlForAgentId(readConfigString(instance.config, "agentId"))633+ : null;634+ const titleIconNode = registryIconUrl ? (apps/server/src/provider/acp/AcpRegistrySupport.ts line 379OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -231,0 +359,21 @@359+ const id = agent.id.toLowerCase();360+ const name = agent.name.toLowerCase();361+ const authors = (agent.authors ?? []).join(" ").toLowerCase();362+ const description = agent.description.toLowerCase();363+ const terms = normalized.split(/\s+/u);364+ if (id === normalized || name === normalized) return 0;365+ if (id.startsWith(normalized) || name.startsWith(normalized)) return 10;366+367+ const identityTokens = `${id} ${name}`.split(/[^a-z0-9]+/u).filter(Boolean);368+ if (terms.every((term) => identityTokens.some((token) => token.startsWith(term)))) return 20;369+ if (terms.every((term) => id.includes(term) || name.includes(term))) return 30;370+ if (terms.every((term) => authors.includes(term))) return 40;371+ if (terms.every((term) => `${id} ${name} ${authors} ${description}`.includes(term))) return 50;372+ return undefined;373+}374+375+function runnerFor(distribution: AcpRegistryDistributionKind): "npx" | "uvx" | undefined {376+ return distribution === "npx" ? "npx" : distribution === "uvx" ? "uvx" : undefined;377+}378+379+interface CollectedBytes {apps/server/src/ws.ts line 1272OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1244,0 +1252,21 @@1252+ observeRpcEffect(1253+ WS_METHODS.serverSearchAcpRegistry,1254+ acpRegistryCatalog.search(input).pipe(Effect.mapError(toAcpRegistryOperationError)),1255+ { "rpc.aggregate": "server" },1256+ ),1257+ [WS_METHODS.serverPrepareAcpRegistryAgent]: (input) =>1258+ observeRpcEffect(1259+ WS_METHODS.serverPrepareAcpRegistryAgent,1260+ acpRegistryCatalog.prepare(input).pipe(Effect.mapError(toAcpRegistryOperationError)),1261+ {1262+ "rpc.aggregate": "server",1263+ "acp_registry.agent_id": input.agentId,1264+ },1265+ ),1266+ [WS_METHODS.serverUninstallAcpRegistryManagedBinary]: (input) =>1267+ observeRpcEffect(1268+ WS_METHODS.serverUninstallAcpRegistryManagedBinary,1269+ acpRegistryCatalog1270+ .uninstallManagedBinary(1271+ input,1272+ serverSettings.getSettings.pipe(packages/contracts/src/acpRegistry.ts line 282OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +76,21 @@76+ description: AcpRegistryProbeDescription,77+ type: Schema.Literals(["agent", "env_var", "terminal"]),78+});79+export type AcpRegistryProbeAuthMethod = typeof AcpRegistryProbeAuthMethod.Type;80+81+export const AcpRegistryProbeModel = Schema.Struct({82+ id: AcpRegistryProbeText,83+ name: AcpRegistryProbeText,84+ description: AcpRegistryProbeDescription,85+});86+export type AcpRegistryProbeModel = typeof AcpRegistryProbeModel.Type;87+88+export const AcpRegistryProbeResult = Schema.Struct({89+ instanceId: ProviderInstanceId,90+ // `ready` is only returned after a disposable ACP session/new probe completes.91+ // It does not imply that authentication was passively detected.92+ ready: Schema.Literal(true),93+ icon: Schema.NullOr(AcpRegistryUrl),94+ authMethods: Schema.Array(AcpRegistryProbeAuthMethod).check(Schema.isMaxLength(32)),95+ models: Schema.Array(AcpRegistryProbeModel).check(Schema.isMaxLength(256)),96+ currentModelId: Schema.NullOr(AcpRegistryProbeText),apps/server/src/provider/acp/AcpRegistryProbe.ts line 84OutdatedResolvedby StiensWout(GitHub profile, opens in a new tab)@@ -0,0 +64,21 @@64+ for (const candidate of candidates) {65+ const id = boundedText(candidate.id, MAX_ID_LENGTH);66+ if (id.length === 0 || seen.has(id)) continue;67+ seen.add(id);68+ models.push({69+ id,70+ name: boundedText(candidate.name, MAX_NAME_LENGTH) || id,71+ description:72+ candidate.description === null73+ ? null74+ : boundedText(candidate.description, MAX_DESCRIPTION_LENGTH) || null,75+ });76+ if (models.length === MAX_MODELS) break;77+ }78+ return models;79+}80+81+export function normalizeAcpRegistryAuthMethods(82+ methods: ReadonlyArray<EffectAcpSchema.AuthMethod> | undefined,83+): ReadonlyArray<AcpRegistryProbeAuthMethod> {84+ return (methods ?? []).slice(0, MAX_AUTH_METHODS).flatMap((method) => {
StiensWout(GitHub profile, opens in a new tab) changed the title
- apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.ts lines 4668 to 4676OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -4631,0 +4656,21 @@4656+ const option = configOptions.find((candidate) => candidate.id === selection.id);4657+ if (4658+ option !== undefined &&4659+ option.type === "select" &&4660+ typeof selection.value === "string"4661+ ) {4662+ const advertisedValues = option.options.flatMap((entry) =>4663+ "value" in entry ? [entry.value] : entry.options.map((choice) => choice.value),4664+ );4665+ if (!advertisedValues.includes(selection.value)) continue;4666+ }4667+ yield* runtime.setConfigOption(selection.id, selection.value).pipe(4668+ Effect.catch((error) =>4669+ error._tag === "AcpRequestError"4670+ ? Effect.logWarning("ACP session rejected a configuration option value", {4671+ optionId: selection.id,4672+ value: selection.value,4673+ detail: error.message,4674+ })4675+ : Effect.fail(error),4676+ ),
- apps/server/src/provider/acp/AcpSessionConfig.ts line 124OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +104,21 @@104+ : {}),105+ });106+ if (descriptors.length === MAX_OPTION_DESCRIPTORS) return descriptors;107+ }108+109+ const modeState = input.modeState;110+ if (modeState !== undefined && !hasModeCategory) {111+ const choices = selectChoices(112+ modeState.availableModes.map((mode) => ({113+ value: mode.id,114+ name: mode.name,115+ description: mode.description,116+ })),117+ );118+ const currentValue = boundedText(modeState.currentModeId, MAX_TEXT_LENGTH);119+ // Some agents mirror one knob through both the modes API and a config120+ // option (codex-acp advertises its thinking levels as modes too). Skip121+ // the synthetic descriptor when an existing descriptor already exposes122+ // the same choice set, so the composer shows the knob once.123+ const modeChoiceIds = new Set(choices.map((choice) => choice.id));124+ const duplicatesExistingDescriptor = descriptors.some(apps/server/src/server.ts line 512OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -361,3 +362,6 @@361362 );362363363364 const RuntimeCoreDependenciesLive = RuntimeCoreDependenciesBaseLive.pipe(365+ // Search, prepare, status inspection, and turn launch share one registry366+ // cache so every client and provider instance sees the same prepared agents.367+ Layer.provideMerge(AcpRegistryCatalogLive),apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.ts line 546OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -456,5 +486,7 @@456486 checkpointing: {457487 appCanCheckpointFilesystem: true,458488 supportsNestedCheckpointScopes: true,459- providerCanRollbackConversation: false,460- providerRollbackReturnsSnapshot: false,489+ // ACP defines no conversation truncation, so rollback resets the provider490+ // conversation: T3 restores checkpointed state and the next turn starts a491+ // fresh agent session without the rolled-back context.492+ providerCanRollbackConversation: true,apps/server/src/provider/acp/AcpRegistrySupport.ts line 89OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -24,4 +72,18 @@72+);73+const HttpsUrl = Schema.String.check(74+ Schema.isMaxLength(2_048),75+ Schema.makeFilter((value) => {76+ try {77+ const url = new URL(value);78+ return (79+ (url.protocol === "https:" && url.username.length === 0 && url.password.length === 0) ||80+ "ACP Registry URLs must use HTTPS without embedded credentials."81+ );82+ } catch {83+ return "ACP Registry URLs must be valid absolute URLs.";84+ }85+ }),86+);87+2488 const AcpRegistryPackageDistribution = Schema.Struct({25- package: Schema.String,26- args: Schema.optionalKey(Schema.Array(Schema.String)),27- env: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),89+ package: BoundedPackage,apps/server/src/provider/acp/AcpClientTerminals.ts line 138OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +118,21 @@118+): Effect.Effect<AcpClientTerminals> =>119+ Effect.sync(() => {120+ const terminals = new Map<string, ManagedAcpTerminal>();121+ let nextTerminalNumber = 1;122+123+ const requireTerminal = (124+ terminalId: string,125+ operation: string,126+ ): Effect.Effect<ManagedAcpTerminal, EffectAcpErrors.AcpRequestError> => {127+ const terminal = terminals.get(terminalId);128+ if (terminal === undefined || terminal.released) {129+ return Effect.fail(130+ terminalRequestError(`ACP ${operation} received an unknown terminal ID '${terminalId}'.`),131+ );132+ }133+ return Effect.succeed(terminal);134+ };135+136+ const create: AcpClientTerminals["create"] = (request) =>137+ Effect.gen(function* () {138+ const liveCount = Array.from(terminals.values()).filter(apps/server/src/mcp/AcpMcpStdioBridge.ts line 73OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +53,21 @@53+ const rawEvent = buffered.slice(0, separatorIndex);54+ buffered = buffered.slice(separatorIndex).replace(/^(?:\r?\n){2}/u, "");55+ const data = rawEvent56+ .split(/\r?\n/u)57+ .filter((line) => line.startsWith("data:"))58+ .map((line) => line.slice("data:".length).trimStart())59+ .join("\n");60+ if (data.length > 0) yield data;61+ separatorIndex = buffered.search(/\n\n|\r\n\r\n/u);62+ }63+ }64+}65+66+async function responsePayloads(response: Response): Promise<ReadonlyArray<unknown>> {67+ if (response.status === 202 || response.status === 204) {68+ await response.body?.cancel().catch(() => undefined);69+ return [];70+ }71+ const contentType = response.headers.get("content-type") ?? "";72+ if (contentType.includes("text/event-stream")) {73+ const payloads: Array<unknown> = [];apps/server/src/provider/acp/AcpClientTerminals.ts line 238OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +218,21 @@218+ truncated: terminal.buffer.truncated,219+ ...(terminal.exitStatus === undefined ? {} : { exitStatus: terminal.exitStatus }),220+ })),221+ );222+223+ const waitForExit: AcpClientTerminals["waitForExit"] = (request) =>224+ requireTerminal(request.terminalId, "terminal/wait_for_exit").pipe(225+ Effect.flatMap((terminal) => Deferred.await(terminal.exit)),226+ );227+228+ const kill: AcpClientTerminals["kill"] = (request) =>229+ requireTerminal(request.terminalId, "terminal/kill").pipe(230+ Effect.flatMap((terminal) => terminal.kill),231+ Effect.as({}),232+ );233+234+ const release: AcpClientTerminals["release"] = (request) =>235+ requireTerminal(request.terminalId, "terminal/release").pipe(236+ Effect.flatMap((terminal) =>237+ Effect.sync(() => {238+ terminal.released = true;apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.ts line 7324OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -5949,0 +6051,21 @@6051+ // workspace state; the next turn starts a fresh agent session6052+ // without the rolled-back context.6053+ yield* awaitRuntimeTeardown();6054+ yield* Ref.set(runtimeRestartRequired, true);6055+ yield* Ref.set(activeSessionId, null);6056+ yield* Ref.set(activeSessionSetup, null);6057+ yield* Ref.set(activeSelection, null);6058+ yield* Ref.set(activeInteractionMode, null);6059+ const now = yield* DateTime.now;6060+ return {6061+ providerThread: {6062+ ...rollbackInput.providerThread,6063+ nativeThreadRef: null,6064+ nativeConversationHeadRef:6065+ rollbackInput.target.type === "provider_turn"6066+ ? rollbackInput.target.providerTurn.nativeTurnRef6067+ : null,6068+ status: "idle" as const,6069+ updatedAt: now,6070+ },6071+ providerTurns: [],apps/server/src/mcp/AcpMcpStdioBridge.ts lines 189 to 192OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +172,21 @@172+ for (const entry of Array.isArray(payload) ? payload : [payload]) {173+ protocolVersion = protocolVersionOf(entry) ?? protocolVersion;174+ writeMessage(entry);175+ }176+ };177+178+ const respondWithError = (requestId: unknown, message: string): void => {179+ writeMessage({180+ jsonrpc: "2.0",181+ id: requestId ?? null,182+ error: { code: -32603, message },183+ });184+ };185+186+ const forward = async (line: string): Promise<void> => {187+ let parsed: unknown;188+ try {189+ parsed = JSON.parse(line);190+ } catch {191+ return;192+ }apps/server/src/provider/acp/AcpRegistryProbe.ts line 113OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +93,21 @@93+/** Agent spawn recipe used to compose runnable terminal-auth command lines. */94+export interface AcpRegistryAuthSpawnContext {95+ readonly command: string;96+ readonly args: ReadonlyArray<string>;97+}98+99+const SHELL_SAFE_TOKEN = /^[A-Za-z0-9_@%+=:,./-]+$/u;100+101+function shellDisplayToken(token: string): string {102+ return SHELL_SAFE_TOKEN.test(token) ? token : `'${token.replaceAll("'", `'\\''`)}'`;103+}104+105+function terminalAuthCommand(106+ method: Extract<EffectAcpSchema.AuthMethod, { readonly type: "terminal" }>,107+ spawn: AcpRegistryAuthSpawnContext,108+): string {109+ const environmentPrefix = Object.entries(method.env ?? {}).map(110+ ([name, value]) => `${name}=${shellDisplayToken(value)}`,111+ );112+ const command = [spawn.command, ...spawn.args, ...(method.args ?? [])].map(shellDisplayToken);113+ return [...environmentPrefix, ...command].join(" ").slice(0, MAX_COMMAND_LINE_LENGTH);
- apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.ts lines 4668 to 4676OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -4631,0 +4656,21 @@4656+ const option = configOptions.find((candidate) => candidate.id === selection.id);4657+ if (4658+ option !== undefined &&4659+ option.type === "select" &&4660+ typeof selection.value === "string"4661+ ) {4662+ const advertisedValues = option.options.flatMap((entry) =>4663+ "value" in entry ? [entry.value] : entry.options.map((choice) => choice.value),4664+ );4665+ if (!advertisedValues.includes(selection.value)) continue;4666+ }4667+ yield* runtime.setConfigOption(selection.id, selection.value).pipe(4668+ Effect.catch((error) =>4669+ error._tag === "AcpRequestError"4670+ ? Effect.logWarning("ACP session rejected a configuration option value", {4671+ optionId: selection.id,4672+ value: selection.value,4673+ detail: error.message,4674+ })4675+ : Effect.fail(error),4676+ ),
- apps/server/src/provider/acp/AcpClientTerminals.ts line 193OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +173,21 @@173+ nextTerminalNumber += 1;174+ const record: ManagedAcpTerminal = {175+ terminalId,176+ buffer: {177+ chunks: [],178+ bytes: 0,179+ truncated: false,180+ limit: Math.min(181+ request.outputByteLimit ?? DEFAULT_OUTPUT_BYTE_LIMIT,182+ MAX_OUTPUT_BYTE_LIMIT,183+ ),184+ },185+ exit: yield* Deferred.make<EffectAcpSchema.WaitForTerminalExitResponse>(),186+ kill: child.kill().pipe(Effect.ignore),187+ dispose: Scope.close(terminalScope, Exit.void).pipe(Effect.ignore),188+ exitStatus: undefined,189+ released: false,190+ };191+ terminals.set(terminalId, record);192+193+ const pump = (stream: typeof child.stdout) =>apps/server/src/provider/acp/AcpClientTerminals.ts line 203OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +183,21 @@183+ ),184+ },185+ exit: yield* Deferred.make<EffectAcpSchema.WaitForTerminalExitResponse>(),186+ kill: child.kill().pipe(Effect.ignore),187+ dispose: Scope.close(terminalScope, Exit.void).pipe(Effect.ignore),188+ exitStatus: undefined,189+ released: false,190+ };191+ terminals.set(terminalId, record);192+193+ const pump = (stream: typeof child.stdout) =>194+ stream.pipe(195+ Stream.runForEach((chunk) => Effect.sync(() => appendOutput(record.buffer, chunk))),196+ Effect.ignore,197+ );198+ yield* Effect.forkDetach(pump(child.stdout));199+ yield* Effect.forkDetach(pump(child.stderr));200+ yield* Effect.forkDetach(201+ child.exitCode.pipe(202+ Effect.map((code) => ({ exitCode: Number(code), signal: null })),203+ Effect.orElseSucceed(() => ({ exitCode: null, signal: null })),apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.ts line 6063OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -5948,2 +6045,19 @@5948- }),5949- ),6045+ runtimeTransitionPermit6046+ .withPermit(6047+ Effect.gen(function* () {6048+ // ACP defines no conversation truncation, so rollback resets6049+ // the provider conversation: drop the native session binding6050+ // and force a runtime restart. T3 restores checkpointed6051+ // workspace state; the next turn starts a fresh agent session6052+ // without the rolled-back context.6053+ yield* awaitRuntimeTeardown();6054+ yield* Ref.set(runtimeRestartRequired, true);6055+ yield* Ref.set(activeSessionId, null);6056+ yield* Ref.set(activeSessionSetup, null);6057+ yield* Ref.set(activeSelection, null);6058+ yield* Ref.set(activeInteractionMode, null);6059+ const now = yield* DateTime.now;6060+ return {6061+ providerThread: {6062+ ...rollbackInput.providerThread,6063+ nativeThreadRef: null,apps/web/src/components/settings/AcpRegistryIcon.tsx line 128OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +108,21 @@108+ readonly iconUrl: string;109+ readonly source: string;110+ readonly status: "loading" | "loaded" | "failed";111+ } | null>(null);112+ const currentImage = image?.iconUrl === iconUrl ? image : null;113+ // Render only after the load pipeline resolves: the validated blob when the114+ // fetch succeeds, or the raw allowlisted CDN URL when it fails (the official115+ // CDN serves no CORS headers, so the validating fetch is often blocked in116+ // cross-origin browser contexts while native <img> loading still works).117+ const source = currentImage?.source ?? null;118+ const status = currentImage?.status ?? "loading";119+120+ useEffect(() => {121+ if (iconUrl === null) return;122+ let active = true;123+ let objectUrl: string | null = null;124+ void loadCachedAcpRegistryIcon(iconUrl)125+ .then((blob) => {126+ if (!active) return;127+ objectUrl = URL.createObjectURL(blob);128+ setImage((current) => {apps/server/src/provider/acp/AcpSessionConfig.ts line 44OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +24,21 @@24+25+const boundedText = (value: string | null | undefined, maximumLength: number): string =>26+ (value ?? "").trim().slice(0, maximumLength);27+28+function flattenSelectChoices(29+ options: EffectAcpSchema.SessionConfigSelectOptions,30+): ReadonlyArray<EffectAcpSchema.SessionConfigSelectOption> {31+ return options.flatMap((candidate) => ("value" in candidate ? [candidate] : candidate.options));32+}33+34+function selectChoices(35+ candidates: ReadonlyArray<{36+ readonly value: string;37+ readonly name: string;38+ readonly description?: string | null | undefined;39+ }>,40+): ReadonlyArray<ProviderOptionChoice> {41+ const seen = new Set<string>();42+ const choices: Array<ProviderOptionChoice> = [];43+ for (const candidate of candidates) {44+ const id = boundedText(candidate.value, MAX_TEXT_LENGTH);apps/server/src/serverSettings.ts line 197OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -112,3 +113,12 @@112113 return { ...settings, providerInstances };113114 }114115116+export function applyProviderInstanceMutation(117+ settings: ServerSettings,118+ mutation: ProviderInstanceMutation,119+): ServerSettings {120+ const providerInstances = { ...settings.providerInstances };121+ if (mutation.operation === "upsert") {122+ providerInstances[mutation.instanceId] = mutation.instance;123+ } else {124+ delete providerInstances[mutation.instanceId];apps/server/src/mcp/AcpMcpStdioBridge.ts lines 231 to 238OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +218,21 @@218+ for (const payload of await responsePayloads(response)) {219+ handleServerPayload(payload);220+ }221+ } catch (error) {222+ if (envelope.id !== undefined) {223+ respondWithError(224+ envelope.id,225+ `T3 Code MCP bridge request failed: ${error instanceof Error ? error.message : String(error)}`,226+ );227+ }228+ }229+ };230+231+ await new Promise<void>((resolve) => {232+ const reader = NodeReadline.createInterface({ input: options.input });233+ reader.on("line", (line) => {234+ if (line.trim().length === 0) return;235+ const task = forward(line).finally(() => {236+ pending.delete(task);237+ });238+ pending.add(task);apps/web/src/components/settings/AddProviderInstanceDialog.tsx line 287OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -202,16 +282,6 @@202282 // keeps the type boundary honest and guards against any future drift in203283 // the slug rules.204284 const brandedId = ProviderInstanceId.make(instanceId);205- const nextMap = {206- ...settings.providerInstances,207- [brandedId]: nextInstance,208- };209- try {210- updateSettings({ providerInstances: nextMap });211- toastManager.add({212- type: "success",213- title: "Provider instance added",214- description: `${driverOption.label} instance '${instanceId}' was added.`,215- });216- onOpenChange(false);217- } catch (error) {285+ setIsSaving(true);286+ const result = await persistProviderInstance({287+ operation: "upsert",apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.ts line 987OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -991,3 +967,21 @@991967 }992968 }993969970+/** Resolve explicitly tagged MCP approvals through the thread's normal policy. */971+export function acpMcpToolApprovalElicitationDisposition(972+ runtimePolicy: ProviderAdapterV2RuntimePolicy,973+ request: EffectAcpSchema.ElicitationRequest,974+ nativeRequestId?: string,975+): AcpPermissionDisposition | undefined {976+ if (977+ request.mode !== "form" ||978+ (unknownRecord(request._meta)?.codex_approval_kind !== "mcp_tool_call" &&979+ nativeRequestId?.startsWith("mcp_tool_call_approval_") !== true)980+ ) {981+ return undefined;982+ }983+ return acpPermissionDisposition(runtimePolicy, {984+ sessionId: request.sessionId,985+ toolCall: {986+ toolCallId: "mcp-tool-call-approval",987+ kind: "other",
- apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.ts line 5391OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -4506,14 +4490,12 @@45064490 }),4507- correlatedTransportRequestId,4491+ transportRequestId,45084492 );45094493 const response =45104494 userInput.answers === null4511- ? ({ action: { action: "cancel" } } as const)4495+ ? ({ action: "cancel" } as const)45124496 : ({4513- action: {4514- action: "accept",4515- content: elicitationContent(4516- userInput.answers,4517- new Set(Object.keys(params.requestedSchema.properties ?? {})),4518- ),4519- },4497+ action: "accept",4498+ content: elicitationContent(4499+ userInput.answers,4500+ new Set(Object.keys(params.requestedSchema.properties ?? {})),4501+ ),
- @@ -1288,0 +1311,21 @@1311+ ),1312+ [WS_METHODS.serverUninstallAcpRegistryManagedBinary]: (input) =>1313+ observeRpcEffect(1314+ WS_METHODS.serverUninstallAcpRegistryManagedBinary,1315+ serverSettings1316+ .withSettingsSnapshot((settings) =>1317+ acpRegistryCatalog.uninstallManagedBinary(1318+ input,1319+ Effect.succeed(1320+ Object.values(settings.providerInstances).some((instance) => {1321+ if (1322+ instance.driver !== "acpRegistry" ||1323+ instance.config === null ||1324+ typeof instance.config !== "object"1325+ ) {1326+ return false;1327+ }1328+ return (instance.config as Record<string, unknown>).agentId === input.agentId;1329+ }),1330+ ),1331+ ),
- apps/server/src/provider/acp/AcpClientTerminals.ts line 203OutdatedResolvedby StiensWout(GitHub profile, opens in a new tab)@@ -0,0 +171,21 @@171+ };172+173+ const pruneReleasedSnapshots = (): void => {174+ const released = Array.from(terminals.values()).filter((terminal) => terminal.released);175+ let retainedBytes = released.reduce((total, terminal) => total + terminal.buffer.bytes, 0);176+ while (177+ released.length > MAX_RETAINED_TERMINALS ||178+ retainedBytes > MAX_RETAINED_OUTPUT_BYTES179+ ) {180+ const terminal = released.shift();181+ if (terminal === undefined) break;182+ retainedBytes -= terminal.buffer.bytes;183+ terminals.delete(terminal.terminalId);184+ }185+ };186+187+ const requireTerminal = (188+ terminalId: string,189+ operation: string,190+ ): Effect.Effect<ManagedAcpTerminal, EffectAcpErrors.AcpRequestError> => {191+ const terminal = terminals.get(terminalId);
Sign in to join this conversation.




Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
57784106-3b5c-4cf4-bd27-f360284722adYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share