mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 00:57:45 +00:00
feat(acp): permission requests a dialect claims are presented as questions, never auto-answered (#28449)
A dialect's request() now presents session/request_permission when it claims it, and full access no longer auto-allows a claimed request. No dialect claims permission requests yet, so nothing changes today.
This commit is contained in:
@@ -95,6 +95,7 @@ export type AcpDialect = {
|
||||
contextWindow?(models: unknown): number | undefined
|
||||
/** A model's own effort menu and default, as the agent advertises them per model. */
|
||||
modelEfforts?(model: ModelInfo): { efforts: AgentSessionOptionChoice[]; defaultEffort?: string }
|
||||
/** A request shown to the person; a permission request it claims is never auto-answered. */
|
||||
request?(method: string, params: unknown): AcpRequestPresentation | undefined
|
||||
/** Requests answered at once instead of shown to the person. */
|
||||
settleRequest?(method: string, params: unknown): AcpRequestSettlement | undefined
|
||||
|
||||
@@ -125,7 +125,8 @@ export async function acquireAcpStructuredSession(input: {
|
||||
// is cutting it short: nobody is there to ask.
|
||||
return { outcome: { outcome: 'cancelled' } }
|
||||
}
|
||||
if (launch.fullAccess) {
|
||||
// A request the dialect claims is a question for the person, which full access never answers.
|
||||
if (launch.fullAccess && !spec.dialect.request?.('session/request_permission', request)) {
|
||||
// Full access: Orca answers yes for the person, as the agent's own bypass flag would.
|
||||
const allow = request.options.find((option) => option.kind === 'allow_once')
|
||||
if (allow) {
|
||||
|
||||
@@ -105,9 +105,8 @@ export function translateAcpRequest(
|
||||
}
|
||||
}
|
||||
const presentation =
|
||||
method === 'session/request_permission'
|
||||
? acpPermissionPresentation(params)
|
||||
: options.dialect.request?.(method, params)
|
||||
options.dialect.request?.(method, params) ??
|
||||
(method === 'session/request_permission' ? acpPermissionPresentation(params) : undefined)
|
||||
if (!presentation) {
|
||||
// A file system or terminal call Orca never advertised is the agent's own misstep (OpenCode 1.x
|
||||
// repeats each approved edit as a file write it already made): refused, with no row.
|
||||
|
||||
Reference in New Issue
Block a user