mirror of
https://github.com/anomalyco/opencode.git
synced 2026-02-01 22:48:16 +00:00
Fix ACP permission rawInput empty bug
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
This commit is contained in:
@@ -70,6 +70,25 @@ export namespace ACP {
|
|||||||
case "permission.asked":
|
case "permission.asked":
|
||||||
try {
|
try {
|
||||||
const permission = event.properties
|
const permission = event.properties
|
||||||
|
// Fetch the actual tool input from the message part if available
|
||||||
|
const toolInput = await (async () => {
|
||||||
|
if (!permission.tool) return permission.metadata
|
||||||
|
const message = await this.config.sdk.session
|
||||||
|
.message(
|
||||||
|
{
|
||||||
|
sessionID: permission.sessionID,
|
||||||
|
messageID: permission.tool.messageID,
|
||||||
|
directory,
|
||||||
|
},
|
||||||
|
{ throwOnError: true },
|
||||||
|
)
|
||||||
|
.then((x) => x.data)
|
||||||
|
.catch(() => undefined)
|
||||||
|
if (!message) return permission.metadata
|
||||||
|
const part = message.parts.find((p) => p.type === "tool" && p.callID === permission.tool!.callID)
|
||||||
|
if (!part || part.type !== "tool") return permission.metadata
|
||||||
|
return part.state.input
|
||||||
|
})()
|
||||||
const res = await this.connection
|
const res = await this.connection
|
||||||
.requestPermission({
|
.requestPermission({
|
||||||
sessionId,
|
sessionId,
|
||||||
@@ -77,9 +96,9 @@ export namespace ACP {
|
|||||||
toolCallId: permission.tool?.callID ?? permission.id,
|
toolCallId: permission.tool?.callID ?? permission.id,
|
||||||
status: "pending",
|
status: "pending",
|
||||||
title: permission.permission,
|
title: permission.permission,
|
||||||
rawInput: permission.metadata,
|
rawInput: toolInput,
|
||||||
kind: toToolKind(permission.permission),
|
kind: toToolKind(permission.permission),
|
||||||
locations: toLocations(permission.permission, permission.metadata),
|
locations: toLocations(permission.permission, toolInput),
|
||||||
},
|
},
|
||||||
options,
|
options,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user