summaryrefslogtreecommitdiffhomepage
path: root/packages/cli/src/args.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-06-22 00:08:21 +0900
committerAdam Malczewski <[email protected]>2026-06-22 00:08:21 +0900
commit7ff9f94c41a9870e124a50133cd74b42295ab9ac (patch)
tree3a3f09d843dc3263983fa44b384ecc3c1a32e750 /packages/cli/src/args.ts
parent037c136823a900e28864e4dd48e1dbe626e95dfb (diff)
downloaddispatch-7ff9f94c41a9870e124a50133cd74b42295ab9ac.tar.gz
dispatch-7ff9f94c41a9870e124a50133cd74b42295ab9ac.zip
feat: conversation lifecycle status (active/idle/closed) for tab persistence
Implement roadmap item 9: tab persistence across devices. Wire (0.10.0): - Add ConversationStatus type (active | idle | closed) - Add status field to ConversationMeta Transport-contract (0.14.0): - Add conversation.statusChanged WS message to WsServerMessage union - Re-export ConversationStatus Conversation-store: - Track status in ConversationMetaRow (default: idle) - getConversationStatus / setConversationStatus methods - listConversations accepts { status: ConversationStatus[] } filter - Old meta rows without status default to idle on read Session-orchestrator: - conversationStatusChanged hook descriptor - Emit on transitions: idle→active (turn start), active→idle (turn settle), →closed (closeConversation) - Persist status to store as fire-and-forget side effect - Declare hook in manifest contributes.hooks Transport-ws: - Subscribe to conversationStatusChanged hook - Broadcast conversation.statusChanged WS message to all clients Transport-http: - GET /conversations?status=active,idle filter (parseStatusFilter pure helper) - POST /conversations/:id/close now sets status to closed CLI: - dispatch list defaults to active,idle (excludes closed) - --status <state> flag to filter by single status - --all flag to include closed FE handoff: frontend-conversation-lifecycle-handoff.md
Diffstat (limited to 'packages/cli/src/args.ts')
-rw-r--r--packages/cli/src/args.ts23
1 files changed, 21 insertions, 2 deletions
diff --git a/packages/cli/src/args.ts b/packages/cli/src/args.ts
index d4ed0e9..30fa309 100644
--- a/packages/cli/src/args.ts
+++ b/packages/cli/src/args.ts
@@ -27,7 +27,13 @@ export type ParsedCommand =
readonly showReasoning: boolean;
readonly open: boolean;
}
- | { readonly kind: "list"; readonly server: string; readonly query?: string }
+ | {
+ readonly kind: "list";
+ readonly server: string;
+ readonly query?: string;
+ readonly status?: string;
+ readonly all: boolean;
+ }
| { readonly kind: "open"; readonly server: string; readonly conversationId: string }
| { readonly kind: "read"; readonly server: string; readonly conversationId: string }
| {
@@ -73,11 +79,18 @@ export function parseArgs(argv: readonly string[], opts: ParseOpts): ParsedComma
if (first === "list") {
let server = opts.defaultServer;
let query: string | undefined;
+ let status: string | undefined;
+ let all = false;
for (let i = 1; i < argv.length; i++) {
const arg = argv[i] as string;
if (arg === "--server") {
if (i + 1 >= argv.length) return { kind: "error", message: "--server requires a value" };
server = argv[++i] as string;
+ } else if (arg === "--status") {
+ if (i + 1 >= argv.length) return { kind: "error", message: "--status requires a value" };
+ status = argv[++i];
+ } else if (arg === "--all") {
+ all = true;
} else if (arg.startsWith("--")) {
return { kind: "error", message: `Unknown flag: ${arg}` };
} else if (query !== undefined) {
@@ -86,7 +99,13 @@ export function parseArgs(argv: readonly string[], opts: ParseOpts): ParsedComma
query = arg;
}
}
- return { kind: "list", server, ...(query !== undefined && { query }) };
+ return {
+ kind: "list",
+ server,
+ ...(query !== undefined && { query }),
+ ...(status !== undefined && { status }),
+ all,
+ };
}
if (first === "read") {