mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-28 05:57:13 +00:00
feat(codex): share sessions across terminal and web
Use one native app-server for terminal, Web and phone clients while retaining the existing CLI and Runner lifecycle. Synchronize native queues, permissions, question history and steering state; preserve explicit permission precedence and per-turn usage models. Resume inactive clear commands through Runner and reject independent child cold resumes. Add shared-runtime regression tests, generated protocol fixtures and lifecycle documentation.
This commit is contained in:
@@ -202,6 +202,19 @@ public final class ChatInteractor {
|
||||
Task { [weak self] in
|
||||
guard let self else { return }
|
||||
self.drafts?.clear(sessionId: self.sessionId)
|
||||
if attachmentMetadata == nil && (text == "/clear" || text == "/new")
|
||||
&& self.sessionStore.detail(for: self.sessionId)?.metadata?.capabilities?.concurrentClients == true {
|
||||
defer { self.isSending = false }
|
||||
do {
|
||||
let result = try await self.api.clearConversation(id: self.sessionId)
|
||||
self.sessionStore.scheduleRefresh()
|
||||
self.emit(.sessionSuperseded(sessionId: result.sessionId))
|
||||
} catch {
|
||||
self.setComposerText(text)
|
||||
self.emit(.notice(Self.errorMessage(error, fallback: "Failed to create conversation")))
|
||||
}
|
||||
return
|
||||
}
|
||||
await self.performSend(
|
||||
text: text,
|
||||
localId: localId,
|
||||
|
||||
Reference in New Issue
Block a user