mirror of
https://github.com/stablyai/orca.git
synced 2026-10-28 00:02:54 +00:00
Revert "Preserve OpenCode session across command completion, control SessionS…" (#14943)
This reverts commit 1da1bdc01c.
This commit is contained in:
@@ -10325,7 +10325,7 @@ export class OrcaRuntimeService {
|
||||
this.recordTerminalSideEffectFact(ptyId, { kind: 'bell' })
|
||||
return
|
||||
case 'command-finished':
|
||||
this.retirePtyAgentLaunchAuthorityAfterCommandFinished(ptyId)
|
||||
this.retirePtyAgentLaunchAuthority(ptyId)
|
||||
this.recordTerminalSideEffectFact(ptyId, {
|
||||
kind: 'command-finished',
|
||||
exitCode: fact.exitCode
|
||||
@@ -10614,7 +10614,7 @@ export class OrcaRuntimeService {
|
||||
this.confirmPtyAgentExit(ptyId)
|
||||
},
|
||||
onCommandFinished: (exitCode: number | null) => {
|
||||
this.retirePtyAgentLaunchAuthorityAfterCommandFinished(ptyId)
|
||||
this.retirePtyAgentLaunchAuthority(ptyId)
|
||||
this.recordTerminalSideEffectFact(ptyId, { kind: 'command-finished', exitCode })
|
||||
},
|
||||
onBell: () => {
|
||||
@@ -12742,36 +12742,6 @@ export class OrcaRuntimeService {
|
||||
}
|
||||
}
|
||||
|
||||
private retirePtyAgentLaunchAuthorityAfterCommandFinished(ptyId: string): void {
|
||||
const pty = this.ptysById.get(ptyId)
|
||||
if (pty?.launchAgent !== 'opencode') {
|
||||
this.retirePtyAgentLaunchAuthority(ptyId)
|
||||
return
|
||||
}
|
||||
const titleObservedAt = pty.lastOscTitleAt ?? null
|
||||
const foregroundRead = this.readPtyForegroundProcessFromController(ptyId, titleObservedAt ?? 0)
|
||||
if (!foregroundRead) {
|
||||
this.retirePtyAgentLaunchAuthority(ptyId)
|
||||
return
|
||||
}
|
||||
const incarnationId = pty.incarnationId
|
||||
void foregroundRead.then((result) => {
|
||||
const current = this.ptysById.get(ptyId)
|
||||
if (
|
||||
current !== pty ||
|
||||
current.incarnationId !== incarnationId ||
|
||||
current.lastOscTitleAt !== titleObservedAt ||
|
||||
result.controller !== this.ptyController
|
||||
) {
|
||||
return
|
||||
}
|
||||
if (result.available && recognizeAgentProcess(result.process)?.agent === 'opencode') {
|
||||
return
|
||||
}
|
||||
this.retirePtyAgentLaunchAuthority(ptyId)
|
||||
})
|
||||
}
|
||||
|
||||
async resolveTerminalCwd(handle: string): Promise<string | null> {
|
||||
const ptyId = this.resolveLeafForHandle(handle)?.ptyId
|
||||
if (!ptyId) {
|
||||
|
||||
Reference in New Issue
Block a user