mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-14 04:01:35 +00:00
refactor(api): converge the Remote failure vocabulary and client surface
Single RemoteError with a merge-extensible, domain-prefixed code map; owners throw at the failure point; streams surface marked failures; clients consume ctx.remote directly with isRemoteFailure as the only discrimination point and construct no failure instances.
This commit is contained in:
@@ -7,7 +7,7 @@ import {
|
||||
type ClientRemote,
|
||||
} from '@deepseek-ai/dsh-api-gateway/client'
|
||||
import type { WorkspaceFollowFrame, WorkspaceFollowIncrement } from '../types.ts'
|
||||
import type { WorkspaceFollowSink, WorkspaceRemote } from './model.ts'
|
||||
import type { WorkspaceFollowSink } from './model.ts'
|
||||
import { ClientWorkspaceModel } from './model.ts'
|
||||
import { WorkspaceController } from './service.ts'
|
||||
|
||||
@@ -19,10 +19,6 @@ export { WorkspaceController, WorkspaceCreateError } from './service.ts'
|
||||
export type { IWorkspaces, WorkspaceSource } from './service.ts'
|
||||
export type { WorkspaceId, WorkspaceView } from '../types.ts'
|
||||
|
||||
type WorkspaceStreamRemote = Pick<ClientRemote, '$stream'> & {
|
||||
readonly workspace: WorkspaceRemote
|
||||
}
|
||||
|
||||
type WorkspaceBaselineFrame = Extract<WorkspaceFollowFrame, { type: 'baseline' }>
|
||||
|
||||
/** Gateway-owned snapshot stream configured for Workspace state. */
|
||||
@@ -46,10 +42,9 @@ export const inject = ['remote', 'remote.workspace']
|
||||
* @param ctx - Client root Context.
|
||||
*/
|
||||
export function apply(ctx: Context): void {
|
||||
const remote = ctx.remote as WorkspaceStreamRemote
|
||||
const model = new ClientWorkspaceModel(remote.workspace)
|
||||
const model = new ClientWorkspaceModel(ctx.remote.workspace)
|
||||
new WorkspaceController(ctx, model)
|
||||
const control = createWorkspaceStateStream(remote, {
|
||||
const control = createWorkspaceStateStream(ctx.remote, {
|
||||
accept: model,
|
||||
carrierFailed: () => { model.handleCarrierFailure() },
|
||||
failed: (error) => { model.handleStreamFailure(error) },
|
||||
@@ -73,12 +68,12 @@ export interface WorkspaceStateStreamOptions {
|
||||
|
||||
/**
|
||||
* Create the reconnecting Workspace state stream.
|
||||
* @param remote - generated Workspace namespace and Gateway stream factory.
|
||||
* @param remote - Client Remote face carrying the Workspace namespace and the stream factory.
|
||||
* @param options - Workspace state destinations.
|
||||
* @returns an unstarted stream owned by the Client Workspace runtime.
|
||||
*/
|
||||
export function createWorkspaceStateStream(
|
||||
remote: WorkspaceStreamRemote,
|
||||
remote: ClientRemote,
|
||||
options: WorkspaceStateStreamOptions,
|
||||
): WorkspaceStateStream {
|
||||
const stream = remote.$stream<WorkspaceFollowFrame>({
|
||||
|
||||
Reference in New Issue
Block a user