summaryrefslogtreecommitdiffhomepage
path: root/src/features/chat/ports.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/features/chat/ports.ts')
-rw-r--r--src/features/chat/ports.ts33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/features/chat/ports.ts b/src/features/chat/ports.ts
index ffe2c94..53ac236 100644
--- a/src/features/chat/ports.ts
+++ b/src/features/chat/ports.ts
@@ -1,17 +1,20 @@
import type {
- ChatQueueMessage,
- ChatSendMessage,
- ConversationHistoryResponse,
- ConversationMetricsResponse,
+ ChatQueueCancelMessage,
+ ChatQueueMessage,
+ ChatSendMessage,
+ ConversationHistoryResponse,
+ ConversationMetricsResponse,
} from "@dispatch/transport-contract";
/**
- * Injected transport port — sends chat messages to the server. Accepts both
- * `chat.send` (start a turn) and `chat.queue` (enqueue a steering message;
- * auto-starts a turn if idle).
+ * Injected transport port — sends chat messages to the server. Accepts
+ * `chat.send` (start a turn), `chat.queue` (enqueue a steering message;
+ * auto-starts a turn if idle), and `chat.queue.cancel` (remove a single queued
+ * message by id so it never runs — fire-and-forget, idempotent; the
+ * message-queue surface confirms the removal).
*/
export interface ChatTransport {
- send(msg: ChatSendMessage | ChatQueueMessage): void;
+ send(msg: ChatSendMessage | ChatQueueMessage | ChatQueueCancelMessage): void;
}
/**
@@ -19,10 +22,10 @@ export interface ChatTransport {
* Both must be POSITIVE integers when present (the server 400s otherwise).
*/
export interface HistoryWindow {
- /** Return only the NEWEST `limit` chunks of the selection (still ascending). */
- readonly limit?: number;
- /** Exclusive upper bound: only chunks with `seq < beforeSeq` (backfill paging). */
- readonly beforeSeq?: number;
+ /** Return only the NEWEST `limit` chunks of the selection (still ascending). */
+ readonly limit?: number;
+ /** Exclusive upper bound: only chunks with `seq < beforeSeq` (backfill paging). */
+ readonly beforeSeq?: number;
}
/**
@@ -34,9 +37,9 @@ export interface HistoryWindow {
* satisfies this naturally).
*/
export type HistorySync = (
- conversationId: string,
- sinceSeq: number,
- window?: HistoryWindow,
+ conversationId: string,
+ sinceSeq: number,
+ window?: HistoryWindow,
) => Promise<ConversationHistoryResponse>;
/** Injected metrics-sync port — fetches persisted per-turn metrics from the server. */