fix(opencode): answer subagent permissions in run (#43675)
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
5e75e5e990
commit
08faeb3893
@@ -696,9 +696,14 @@ export const RunCommand = effectCmd({
|
||||
// created, and replies issued from inside the loop must use that client.
|
||||
async function loop(client: OpencodeClient, events: Awaited<ReturnType<typeof sdk.event.subscribe>>) {
|
||||
const toggles = new Map<string, boolean>()
|
||||
const sessions = new Set([sessionID])
|
||||
let error: string | undefined
|
||||
|
||||
for await (const event of events.stream) {
|
||||
if (event.type === "session.created" && event.properties.info.parentID) {
|
||||
if (sessions.has(event.properties.info.parentID)) sessions.add(event.properties.info.id)
|
||||
}
|
||||
|
||||
if (
|
||||
event.type === "message.updated" &&
|
||||
event.properties.sessionID === sessionID &&
|
||||
@@ -795,7 +800,7 @@ export const RunCommand = effectCmd({
|
||||
|
||||
if (event.type === "permission.asked") {
|
||||
const permission = event.properties
|
||||
if (permission.sessionID !== sessionID) continue
|
||||
if (!sessions.has(permission.sessionID)) continue
|
||||
|
||||
if (auto) {
|
||||
await client.permission.reply({
|
||||
|
||||
Reference in New Issue
Block a user