mirror of
https://github.com/aljazceru/opencode.git
synced 2026-01-06 09:24:55 +01:00
fix: don't let --continue access subagent session (#2091)
This commit is contained in:
@@ -67,11 +67,17 @@ export const RunCommand = cmd({
|
|||||||
await bootstrap({ cwd: process.cwd() }, async () => {
|
await bootstrap({ cwd: process.cwd() }, async () => {
|
||||||
const session = await (async () => {
|
const session = await (async () => {
|
||||||
if (args.continue) {
|
if (args.continue) {
|
||||||
const list = Session.list()
|
const it = Session.list()
|
||||||
const first = await list.next()
|
try {
|
||||||
await list.return()
|
for await (const s of it) {
|
||||||
if (first.done) return
|
if (s.parentID === undefined) {
|
||||||
return first.value
|
return s
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
} finally {
|
||||||
|
await it.return()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.session) return Session.get(args.session)
|
if (args.session) return Session.get(args.session)
|
||||||
|
|||||||
@@ -82,11 +82,17 @@ export const TuiCommand = cmd({
|
|||||||
const result = await bootstrap({ cwd }, async (app) => {
|
const result = await bootstrap({ cwd }, async (app) => {
|
||||||
const sessionID = await (async () => {
|
const sessionID = await (async () => {
|
||||||
if (args.continue) {
|
if (args.continue) {
|
||||||
const list = Session.list()
|
const it = Session.list()
|
||||||
const first = await list.next()
|
try {
|
||||||
await list.return()
|
for await (const s of it) {
|
||||||
if (first.done) return
|
if (s.parentID === undefined) {
|
||||||
return first.value.id
|
return s.id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
} finally {
|
||||||
|
await it.return()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (args.session) {
|
if (args.session) {
|
||||||
return args.session
|
return args.session
|
||||||
|
|||||||
Reference in New Issue
Block a user