mirror of
https://github.com/stablyai/orca.git
synced 2026-09-23 00:02:29 +00:00
Revert "Preserve OpenCode session across command completion, control SessionS…" (#14943)
This reverts commit 1da1bdc01c.
This commit is contained in:
@@ -131,22 +131,6 @@ describe('OpenCode plugin lifecycle delivery', () => {
|
||||
})
|
||||
}
|
||||
|
||||
it('maps only root session.created to SessionStart', async () => {
|
||||
const handler = await loadHandler()
|
||||
|
||||
await handler({
|
||||
event: { type: 'session.created', properties: { info: { id: 'root' } } }
|
||||
})
|
||||
await handler({
|
||||
event: {
|
||||
type: 'session.created',
|
||||
properties: { info: { id: 'child', parentID: 'root' } }
|
||||
}
|
||||
})
|
||||
|
||||
expect(posts).toEqual([{ hook_event_name: 'SessionStart', sessionID: 'root' }])
|
||||
})
|
||||
|
||||
it('preserves FIFO lifecycle order while the first session lookup is delayed', async () => {
|
||||
let releaseFirstLookup: (() => void) | undefined
|
||||
const firstLookup = new Promise<void>((resolve) => {
|
||||
|
||||
@@ -36,13 +36,10 @@ function toSafeDirName(id: string): string {
|
||||
}
|
||||
|
||||
export function getOpenCodePluginSource(): string {
|
||||
return getOpenCodeFamilyPluginSource('/hook/opencode', { emitSessionStart: true })
|
||||
return getOpenCodeFamilyPluginSource('/hook/opencode')
|
||||
}
|
||||
|
||||
export function getOpenCodeFamilyPluginSource(
|
||||
hookPathname: string,
|
||||
options: { emitSessionStart: boolean }
|
||||
): string {
|
||||
export function getOpenCodeFamilyPluginSource(hookPathname: string): string {
|
||||
// Why: the plugin posts PTY environment data from OpenCode to the shared hooks server.
|
||||
return [
|
||||
'// Why: process-lifetime guard so a recurring parse error on a malformed',
|
||||
@@ -838,20 +835,6 @@ export function getOpenCodeFamilyPluginSource(
|
||||
'',
|
||||
' const sessionID = event.properties?.sessionID;',
|
||||
' const updatedPart = event.properties?.part;',
|
||||
...(options.emitSessionStart
|
||||
? [
|
||||
' if (event.type === "session.created") {',
|
||||
' const info = event.properties?.info;',
|
||||
' if (!info?.id || info.parentID) return;',
|
||||
' rememberSessionRoot(info.id, info.id);',
|
||||
' await enqueueLifecycle(() =>',
|
||||
' disposed ? undefined : post("SessionStart", { sessionID: info.id })',
|
||||
' );',
|
||||
' return;',
|
||||
' }',
|
||||
''
|
||||
]
|
||||
: []),
|
||||
' if (',
|
||||
' event.type === "message.part.updated" &&',
|
||||
' updatedPart?.type === "tool" &&',
|
||||
|
||||
Reference in New Issue
Block a user