Merge origin/master into refactor/subagent
This commit is contained in:
commit
55cbf441d0
558 files changed
+16303
-4339
No files matched your search
@@ -10,7 +10,6 @@ import type {
|
||||
SessionProjectionHints,
|
||||
SessionRenameValue,
|
||||
SessionSummary,
|
||||
SessionJob as JobView,
|
||||
} from '../../types.ts'
|
||||
import { mergeOrderedBaseline } from '../ordered-baseline.ts'
|
||||
import { isRemoteFailure } from '@deepseek-ai/dsh-api-gateway/client'
|
||||
@@ -56,8 +55,7 @@ export interface SessionListSnapshot {
|
||||
phase: SessionListPhase
|
||||
error: RemoteFailure | null
|
||||
projectionsBySession: Readonly<Record<SessionId, SessionProjectionSnapshot>>
|
||||
/** Background jobs per session; an absent key is an empty set. */
|
||||
jobsBySession: Readonly<Record<SessionId, readonly JobView[]>>
|
||||
|
||||
}
|
||||
|
||||
/** Shared projection values and the lifecycle of their explicit baseline read. */
|
||||
@@ -112,12 +110,7 @@ export class SessionManager {
|
||||
private readonly addresses = new Map<SessionId, SubagentAddress>()
|
||||
private readonly projectionLoads = new Map<SessionId, ProjectionLoad>()
|
||||
private readonly projectionInflight = new Map<SessionId, ProjectionInflight>()
|
||||
/**
|
||||
* Background jobs per session, last-wins from Session Controller's control
|
||||
* stream. An empty set is stored as an absent key, so absence and `[]` are
|
||||
* one representation.
|
||||
*/
|
||||
private readonly jobsBySession = new Map<SessionId, readonly JobView[]>()
|
||||
|
||||
|
||||
private listSnapshotCache: SessionListSnapshot
|
||||
/** Entry-identity cache (reference stability): list rebuilds reuse the previous entry
|
||||
@@ -628,21 +621,11 @@ export class SessionManager {
|
||||
this.replaceControlBaseline(frame.value)
|
||||
return
|
||||
}
|
||||
if (frame.type === 'projection') {
|
||||
this.projectionStore(frame.sessionId).apply(frame.key, frame.value, SessionSeq(frame.seq))
|
||||
this.notifier.markDirty()
|
||||
return
|
||||
}
|
||||
if (frame.jobs.length === 0) this.jobsBySession.delete(frame.sessionId)
|
||||
else this.jobsBySession.set(frame.sessionId, frame.jobs)
|
||||
this.projectionStore(frame.sessionId).apply(frame.key, frame.value, SessionSeq(frame.seq))
|
||||
this.notifier.markDirty()
|
||||
}
|
||||
|
||||
private replaceControlBaseline(baseline: SessionControlBaseline): void {
|
||||
this.jobsBySession.clear()
|
||||
for (const [sessionId, jobs] of Object.entries(baseline.jobs)) {
|
||||
if (jobs.length > 0) this.jobsBySession.set(sessionId as SessionId, jobs)
|
||||
}
|
||||
|
||||
for (const [sessionId, block] of Object.entries(baseline.projections)) {
|
||||
const store = this.projectionStore(sessionId as SessionId)
|
||||
@@ -699,7 +682,6 @@ export class SessionManager {
|
||||
: { kind: 'remove', sessionId })
|
||||
if (durableSubagent) this.sessions.get(sessionId)?.handleRunning(false)
|
||||
else this.sessions.get(sessionId)?.handleRemoved()
|
||||
this.jobsBySession.delete(sessionId)
|
||||
const catalog = this.projectionStores.get(sessionId)?.values().subagentCatalog
|
||||
if (!durableSubagent && (catalog === undefined || catalog.length === 0)) {
|
||||
this.projectionStores.delete(sessionId)
|
||||
@@ -812,7 +794,6 @@ export class SessionManager {
|
||||
sessionId,
|
||||
{ values: store.values(), state: 'idle', error: null, ...this.projectionLoads.get(sessionId) },
|
||||
])),
|
||||
jobsBySession: Object.fromEntries(this.jobsBySession),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import { SessionSeq, type SessionId } from '@deepseek-ai/dsh-session/types'
|
||||
import { workspaceTitleOf } from '@deepseek-ai/dsh-util-workspace-path'
|
||||
import type { WorkspaceId } from '@deepseek-ai/dsh-workspace/types'
|
||||
import { SESSION_SEARCH_RESULT_LIMIT } from '../../types.ts'
|
||||
import type { SessionJob as JobView } from '../../types.ts'
|
||||
import type { SessionProjectionMap } from '@deepseek-ai/dsh-session-projection/types'
|
||||
import {
|
||||
createSnapshotStore, notifySubscribers, type ObservableSnapshot, type SnapshotStore,
|
||||
@@ -61,12 +60,6 @@ export interface SessionListState {
|
||||
phase: SessionListPhase
|
||||
/** Shared projection values and explicit-read state, including unopened Sessions. */
|
||||
projectionsBySession: Readonly<Record<SessionId, SessionProjectionSnapshot>>
|
||||
/**
|
||||
* Background jobs each session can see, mirrored last-wins from Session
|
||||
* Controller's control baseline and `jobs` frames. A missing key is an empty
|
||||
* set, so consumers read absence rather than a sentinel.
|
||||
*/
|
||||
jobsBySession: Readonly<Record<SessionId, readonly JobView[]>>
|
||||
}
|
||||
|
||||
/** Structured session-create failure. */
|
||||
@@ -263,7 +256,7 @@ export class ClientSessions implements ISessions {
|
||||
) {
|
||||
this.manager = new SessionManager(remote)
|
||||
this.list = createSnapshotStore<SessionListState>({
|
||||
ids: [], byId: {}, phase: 'pending', projectionsBySession: {}, jobsBySession: {},
|
||||
ids: [], byId: {}, phase: 'pending', projectionsBySession: {},
|
||||
})
|
||||
const disposeManagerProjection = this.manager.subscribe(() => { this.projectList() })
|
||||
rootCtx.effect(() => async () => {
|
||||
@@ -614,7 +607,7 @@ export class ClientSessions implements ISessions {
|
||||
private projectList(): void {
|
||||
const previousById = this.list.getSnapshot().byId
|
||||
const {
|
||||
items, phase, projectionsBySession, jobsBySession,
|
||||
items, phase, projectionsBySession,
|
||||
} = this.manager.getListSnapshot()
|
||||
const ids: SessionId[] = []
|
||||
const byId: Record<SessionId, SessionSummary> = {}
|
||||
@@ -682,7 +675,7 @@ export class ClientSessions implements ISessions {
|
||||
...(title === undefined ? {} : { title, displayTitle: title }),
|
||||
}
|
||||
}
|
||||
this.list.set({ ids, byId, phase, projectionsBySession, jobsBySession })
|
||||
this.list.set({ ids, byId, phase, projectionsBySession })
|
||||
}
|
||||
|
||||
private startScopeDrop(
|
||||
|
||||
Reference in new issue
Block a user