mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-01 23:41:40 +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:
@@ -42,6 +42,9 @@ interface AttachmentUploadApi {
|
||||
* and [AttachmentUploadApi] for the composer attachment flow (B-M3f).
|
||||
*/
|
||||
interface ChatSessionApi : MessagesApi, AttachmentUploadApi {
|
||||
/** Shared root creation; only the initiating client navigates. */
|
||||
suspend fun clearConversation(sessionId: String): ResumeSessionResponse
|
||||
|
||||
/** `POST /api/sessions/:id/messages` — `{ok:true}`; the row arrives via SSE. */
|
||||
suspend fun sendMessage(sessionId: String, message: SendMessageRequest)
|
||||
|
||||
|
||||
@@ -280,6 +280,10 @@ class HapiApi internal constructor(
|
||||
QueuedStateRequest(localIds).toJsonBody(),
|
||||
)
|
||||
|
||||
/** `POST /api/sessions/:id/clear` — shared sessions; returns an independent root. */
|
||||
override suspend fun clearConversation(sessionId: String): ResumeSessionResponse =
|
||||
request("POST", url("api", "sessions", sessionId, "clear").build(), EMPTY_JSON)
|
||||
|
||||
/** `POST /api/sessions/:id/abort` — active sessions only. */
|
||||
override suspend fun abortSession(sessionId: String) {
|
||||
request<Unit>("POST", url("api", "sessions", sessionId, "abort").build(), EMPTY_JSON)
|
||||
|
||||
Reference in New Issue
Block a user