refactor: apply repository naming contract

Apply the accepted pre-release package, service, type, directory, and role renames as one repository-wide change.
This commit is contained in:
Tianyi Cui
2026-08-13 00:36:22 +08:00
parent 101df7cf58
commit a2d0f7f411
3281 changed files with 21730 additions and 21592 deletions

View File

@@ -55,7 +55,7 @@
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-client-ui-primitives": "workspace:^",
"@deepseek-ai/cordis": "workspace:^",
"@deepseek-ai/dsh-compact": "workspace:^",
"@deepseek-ai/dsh-compaction": "workspace:^",
"@deepseek-ai/dsh-tools": "workspace:^",
"react": "^18.2.0",
"react-dom": "^18.2.0"
@@ -68,7 +68,7 @@
"@deepseek-ai/dsh-client-ui-primitives": "workspace:^",
"@deepseek-ai/dsh-client-ui-conversation": "workspace:^",
"@deepseek-ai/dsh-client-ui-slots": "workspace:^",
"@deepseek-ai/dsh-compact": "workspace:^",
"@deepseek-ai/dsh-compaction": "workspace:^",
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-tools": "workspace:^",
"@types/react": "~18.3.1",

View File

@@ -2,7 +2,7 @@ import type { Context } from '@deepseek-ai/cordis'
import type {
ConversationMatch, ConversationNodeDefinition, RequestView,
} from '@deepseek-ai/dsh-client-runtime/client'
import type {} from '@deepseek-ai/dsh-compact/types'
import type {} from '@deepseek-ai/dsh-compaction/types'
import { trajectoryNode } from './trajectory-definition-common.ts'
interface CompactionState {
@@ -30,9 +30,9 @@ function checkpointId(
function eventCompactionId(
event: Parameters<ConversationNodeDefinition['match']>[0],
): string | undefined {
if (event.type !== 'compact/start'
&& event.type !== 'compact/summary'
&& event.type !== 'compact/end') return undefined
if (event.type !== 'compaction/start'
&& event.type !== 'compaction/summary'
&& event.type !== 'compaction/end') return undefined
const value: unknown = event.data.compactionId
return typeof value === 'string' && value !== '' ? value : undefined
}
@@ -41,7 +41,7 @@ function requestFromState(
state: CompactionState,
): Extract<RequestView, { purpose: 'compaction' }> | undefined {
const start = state.start.event
if (start.type !== 'compact/start') return undefined
if (start.type !== 'compaction/start') return undefined
const summary = state.summary?.event
const end = state.end?.event
const checkpoint = state.checkpoint?.event
@@ -51,14 +51,14 @@ function requestFromState(
turn: start.data.turn,
step: 0,
startedAt: start.time,
completedAt: end?.type === 'compact/end' ? end.time : null,
status: end?.type !== 'compact/end'
completedAt: end?.type === 'compaction/end' ? end.time : null,
status: end?.type !== 'compaction/end'
? 'running'
: end.data.error === undefined ? 'complete' : 'error',
...(end?.type === 'compact/end' && end.data.error !== undefined
...(end?.type === 'compaction/end' && end.data.error !== undefined
? { error: end.data.error }
: {}),
...(summary?.type !== 'compact/summary'
...(summary?.type !== 'compaction/summary'
? {}
: {
resultSeq: summary.seq,
@@ -83,20 +83,20 @@ const trajectoryCompactionDefinition: ConversationNodeDefinition<CompactionState
match: (event) => {
const compactId = eventCompactionId(event)
if (compactId !== undefined) {
return { id: compactId, role: event.type === 'compact/start' ? 'start' : 'update' }
return { id: compactId, role: event.type === 'compaction/start' ? 'start' : 'update' }
}
const checkpoint = checkpointId(event)
return checkpoint === undefined ? null : { id: checkpoint, role: 'update' }
},
start: (_context, match) => {
if (match.event.type !== 'compact/start') {
throw new Error('trajectory-compaction start requires compact/start')
if (match.event.type !== 'compaction/start') {
throw new Error('trajectory-compaction start requires compaction/start')
}
return { start: match }
},
update: (context, match) => {
if (match.event.type === 'compact/summary') return { ...context.state, summary: match }
if (match.event.type === 'compact/end') return { ...context.state, end: match }
if (match.event.type === 'compaction/summary') return { ...context.state, summary: match }
if (match.event.type === 'compaction/end') return { ...context.state, end: match }
return checkpointId(match.event) === undefined
? context.state
: { ...context.state, checkpoint: match }

View File

@@ -3,7 +3,7 @@
* Real tsdown artifact shape: lib/client.js hands off through
* window.__ModuleLoader__.load, resolves externals through the injected
* require, returns the exports (apply + inject), and a mounted apply
* registers the view tab into a real SlotsService ring. Skips when dist/ is
* registers the view tab into a real SlotRegistry ring. Skips when dist/ is
* not built (`pnpm --filter @deepseek-ai/dsh-client-ui-trajectory bundle`).
*/
import { readFileSync } from 'node:fs'
@@ -12,7 +12,7 @@ import { Context } from '@deepseek-ai/cordis'
import { stubSettingsScope } from '@deepseek-ai/dsh-client-test-runtime'
import { afterEach, describe, expect, it } from 'vitest'
import {
ConversationEventRegistry, ConversationViewRegistry, SlotsService,
ConversationEventRegistry, ConversationViewRegistry, SlotRegistry,
} from '@deepseek-ai/dsh-client-runtime/client'
const PLUGIN_ID = '@deepseek-ai/dsh-client-ui-trajectory'
@@ -72,7 +72,7 @@ describe('tsdown client artifact', () => {
it.skipIf(code === undefined)('mounted as an object plugin, apply registers the view tab on the real ring', async () => {
const { exports } = await loadArtifact()
const ctx = new Context()
const slots = new SlotsService(ctx)
const slots = new SlotRegistry(ctx)
await ctx.plugin(ConversationEventRegistry).await()
await ctx.plugin(ConversationViewRegistry).await()
// The conversation entry's role: the ring must be declared before riders land.

View File

@@ -188,8 +188,8 @@ describe('Trajectory conversation Definitions', () => {
it('assembles compaction lifecycle, checkpoint replacement, and orphan interruption', () => {
const current = snapshot(assembler([
at(1, 'compact/start', { compactionId: 'complete', turn: null }),
at(2, 'compact/summary', {
at(1, 'compaction/start', { compactionId: 'complete', turn: null }),
at(2, 'compaction/summary', {
compactionId: 'complete',
turn: null,
summary: 'summary',
@@ -204,8 +204,8 @@ describe('Trajectory conversation Definitions', () => {
content: [{ type: 'text', text: 'summary checkpoint' }],
source: { kind: 'plugin', plugin: 'compact', compactionId: 'complete' },
}),
at(4, 'compact/end', { compactionId: 'complete', turn: null }),
at(5, 'compact/start', { compactionId: 'orphan', turn: null }),
at(4, 'compaction/end', { compactionId: 'complete', turn: null }),
at(5, 'compaction/start', { compactionId: 'orphan', turn: null }),
at(6, 'session/end-seed', {}),
]))

View File

@@ -171,10 +171,10 @@ describe('TrajectoryTable', () => {
it('keeps raw HTML tags in a Markdown-derived context preview', () => {
const html = [
'<background-task-complete id="trajectory-ui-watch">',
'<background-job-complete id="trajectory-ui-watch">',
'Command: pnpm test',
'Exit code: 0',
'</background-task-complete>',
'</background-job-complete>',
].join('\n')
const turns: readonly TrajectoryTurnModel[] = [{
turn: 1,
@@ -193,7 +193,7 @@ describe('TrajectoryTable', () => {
render(<TrajectoryTable turns={turns} {...FOLD_PROPS} />)
expect(screen.getByText(
'<background-task-complete id="trajectory-ui-watch"> Command: pnpm test Exit code: 0 </background-task-complete>',
'<background-job-complete id="trajectory-ui-watch"> Command: pnpm test Exit code: 0 </background-job-complete>',
)).toBeTruthy()
})

View File

@@ -1,7 +1,7 @@
// @vitest-environment jsdom
/**
* View registration acceptance on the real framework stack: the plugin fiber
* registers Trajectory into a real SlotsService view ring, tabs
* registers Trajectory into a real SlotRegistry view ring, tabs
* switch inside ConversationRoot (renderSlot share driven by the same tab
* projection apply uses) without collapsing chat, trajectory renders the
* event ledger with its timing overview, and fiber disposal removes the tab.
@@ -17,7 +17,7 @@ import {
ConversationEventRegistry, ConversationViewRegistry, createSnapshotStore,
EMPTY_CHAT_SNAPSHOT,
} from '@deepseek-ai/dsh-client-runtime/client'
import { SlotsService } from '@deepseek-ai/dsh-client-runtime/client'
import { SlotRegistry } from '@deepseek-ai/dsh-client-runtime/client'
import type {
ConversationSnapshot, RequestView,
SessionId, SessionListState, SnapshotStore, WorkspaceListState,
@@ -45,7 +45,7 @@ import type { TrajectorySnapshot } from '../src/client/trajectory-contract.ts'
import { deriveTrajectoryTimeline } from '../src/client/timeline.ts'
const SID = 's1' as SessionId
const sessionSnapshots = new WeakMap<SlotsService, SnapshotStore<ConversationSnapshot>>()
const sessionSnapshots = new WeakMap<SlotRegistry, SnapshotStore<ConversationSnapshot>>()
const tConversation: ConversationSessionHeaderProps['t'] =
key => (conversationZh as Record<string, string>)[key] ?? key
@@ -144,7 +144,7 @@ function fakeSession(nodes: ConversationSnapshot['nodes']) {
/** Empty sessions-list hook; breadcrumbs therefore fall back to the raw id. */
function emptySessions() {
const store = createSnapshotStore<SessionListState>(
{ ids: [], byId: {}, current: undefined, phase: 'ready', subagentsByParent: {}, tasksBySession: {}, currentAddress: undefined })
{ ids: [], byId: {}, current: undefined, phase: 'ready', subagentsByParent: {}, jobsBySession: {}, currentAddress: undefined })
return bindSnapshotSelector(store)
}
@@ -171,10 +171,10 @@ function standaloneProps(
} as unknown as ConvViewProps & { t: (key: LocaleKeysOf<'trajectory'>) => string }
}
/** Real-stack bench: root Context + real SlotsService ring + the plugin fiber. */
/** Real-stack bench: root Context + real SlotRegistry ring + the plugin fiber. */
async function bench(snapshot = historySnapshot(NODES)) {
const ctx = new Context()
const slots = new SlotsService(ctx)
const slots = new SlotRegistry(ctx)
const loadOlder = vi.fn(() => Promise.resolve())
const sessionStore = createSnapshotStore(snapshot)
const session = {
@@ -209,13 +209,13 @@ async function bench(snapshot = historySnapshot(NODES)) {
}
/** Tab projection twin of apply's viewTabs (the render-side consumption path). */
function tabsOf(slots: SlotsService): ViewTab[] {
function tabsOf(slots: SlotRegistry): ViewTab[] {
return slots.entries('conversation.view')
.map(e => ({ id: e.options.id!, label: resolveSlotLabel(e.options.label) ?? e.options.id! }))
}
/** Mount the strict Session header/body over the ring ledger with outlet-faithful render shares. */
function mount(slots: SlotsService, nodes: ConversationSnapshot['nodes'] = NODES) {
function mount(slots: SlotRegistry, nodes: ConversationSnapshot['nodes'] = NODES) {
const sessionSnapshot = sessionSnapshots.get(slots) ?? createSnapshotStore(historySnapshot(nodes))
const useSession = bindSnapshotSelector(sessionSnapshot)
const chat = createChatStore().create()

View File

@@ -30,10 +30,10 @@
"path": "../../core/tools"
},
{
"path": "../../compact/compact"
"path": "../../compaction/compaction"
},
{
"path": "../../support/invariants"
"path": "../../runtime-diagnostics/invariants"
}
]
}