feat(web): project plan mode through host API
This commit is contained in:
34 files changed
+515
-16
No files matched your search
@@ -19,7 +19,7 @@ export interface ApiProxy {
|
||||
}
|
||||
|
||||
// ---- Domain interfaces and payload entities ----
|
||||
export type { HistoryEntry, SessionsApi, SessionSummary } from './sessions.ts'
|
||||
export type { HistoryEntry, PlanModeState, SessionsApi, SessionSummary } from './sessions.ts'
|
||||
export type { HostApi } from './host.ts'
|
||||
export type { EventsApi, MuxFrame, HostFrame, ToolCallView, ToolEventView, ToolResultView } from './events.ts'
|
||||
export type { ApprovalResponsePayload } from './approvals.ts'
|
||||
|
||||
@@ -15,6 +15,8 @@ export interface RpcMethodMap {
|
||||
'session.history': SessionsApi['history']
|
||||
'session.prompt': SessionsApi['prompt']
|
||||
'session.cancel': SessionsApi['cancel']
|
||||
'session.planMode': SessionsApi['planMode']
|
||||
'session.setPlanMode': SessionsApi['setPlanMode']
|
||||
'host.describe': HostApi['describe']
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import { z } from 'zod'
|
||||
import type { SessionEvent, SessionId } from '@deepseek-ai/dsh-session/types'
|
||||
import type { RequestPayload, ResponseValue } from './rpc-map.ts'
|
||||
import type { Wire } from './rpc.schema.ts'
|
||||
import type { HistoryEntry, SessionSummary } from './sessions.ts'
|
||||
import type { HistoryEntry, PlanModeState, SessionSummary } from './sessions.ts'
|
||||
import type { ToolEventView } from './events.ts'
|
||||
|
||||
/** SessionId: one brand cast after shape validation (the only cast point in this domain). */
|
||||
@@ -108,3 +108,28 @@ export const sessionCancelRequestSchema = z.object({
|
||||
export const sessionCancelValueSchema = z.object({
|
||||
accepted: z.literal(true),
|
||||
}) satisfies z.ZodType<Wire<ResponseValue<'session.cancel'>>>
|
||||
|
||||
/** Plan state shared by the read and selection responses. */
|
||||
export const planModeStateSchema = z.object({
|
||||
active: z.boolean(),
|
||||
pending: z.boolean().optional(),
|
||||
}) satisfies z.ZodType<Wire<PlanModeState>>
|
||||
|
||||
/** session.planMode request payload. */
|
||||
export const sessionPlanModeRequestSchema = z.object({
|
||||
sessionId: sessionIdSchema,
|
||||
}) satisfies z.ZodType<Wire<RequestPayload<'session.planMode'>>>
|
||||
|
||||
/** session.planMode response value; null means the optional service is absent. */
|
||||
export const sessionPlanModeValueSchema =
|
||||
planModeStateSchema.nullable() satisfies z.ZodType<Wire<ResponseValue<'session.planMode'>>>
|
||||
|
||||
/** session.setPlanMode request payload. */
|
||||
export const sessionSetPlanModeRequestSchema = z.object({
|
||||
sessionId: sessionIdSchema,
|
||||
active: z.boolean(),
|
||||
}) satisfies z.ZodType<Wire<RequestPayload<'session.setPlanMode'>>>
|
||||
|
||||
/** session.setPlanMode response value; null means the optional service is absent. */
|
||||
export const sessionSetPlanModeValueSchema =
|
||||
planModeStateSchema.nullable() satisfies z.ZodType<Wire<ResponseValue<'session.setPlanMode'>>>
|
||||
@@ -44,6 +44,16 @@ export interface SessionSummary {
|
||||
cwd?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Plan collaboration state exposed to clients. `active` is the logged state
|
||||
* shaping the current request; `pending`, when present, is the user's
|
||||
* next-boundary selection.
|
||||
*/
|
||||
export interface PlanModeState {
|
||||
active: boolean
|
||||
pending?: boolean
|
||||
}
|
||||
|
||||
/** Session-domain unary methods (the map keys session.* of RpcMethodMap). */
|
||||
export interface SessionsApi {
|
||||
/** Lists persisted sessions (updatedAt descending). v1 returns everything; cursor is a reserved seat, unimplemented. */
|
||||
@@ -70,4 +80,18 @@ export interface SessionsApi {
|
||||
|
||||
/** Stops: clears both FIFOs + aborts the current step (1:1 with agent.cancel). */
|
||||
cancel(request: RpcRequest<{ sessionId: SessionId }>): Promise<RpcResponse<{ accepted: true }>>
|
||||
|
||||
/**
|
||||
* Reads plan collaboration state. `null` means the host did not compose the
|
||||
* optional plan-mode service; it is distinct from inactive state.
|
||||
*/
|
||||
planMode(request: RpcRequest<{ sessionId: SessionId }>): Promise<RpcResponse<PlanModeState | null>>
|
||||
|
||||
/**
|
||||
* Selects plan collaboration state for the next model-request boundary.
|
||||
* The returned state exposes the still-committed value and pending target;
|
||||
* `null` means plan mode is unavailable on this host.
|
||||
*/
|
||||
setPlanMode(request: RpcRequest<{ sessionId: SessionId; active: boolean }>):
|
||||
Promise<RpcResponse<PlanModeState | null>>
|
||||
}
|
||||
Reference in New Issue
Block a user