fix(cli): default session root in shipped config

This commit is contained in:
Turtle
2026-07-30 10:24:04 +08:00
parent 5111a292b4
commit 83360c3dca
7 changed files with 3 additions and 90 deletions

View File

@@ -182,8 +182,6 @@ declare module 'cordis' {
tuiGoodbyeMessage: string | undefined
/** Skill the launcher wants auto-invoked as the fresh session's first turn; absent leaves it to the user. */
tuiInitialSkill: string | undefined
/** Launcher-owned session-store root the app bundle defaults to; absent keeps the bundle's project-local default. */
launcherSessionsRoot: string | undefined
}
}
@@ -228,16 +226,6 @@ export const TUI_GOODBYE_MESSAGE_KEY = 'tuiGoodbyeMessage'
*/
export const INITIAL_SKILL_KEY = 'tuiInitialSkill'
/**
* Context key a launcher sets before any Loader entry mounts
* (`ctx.provide(SESSIONS_ROOT_KEY, root)`) to supply its session-store root as
* the app bundle's default persistence root. Shared-store policy (one store
* across every cwd) belongs to the launcher — the dsh CLI resolves it under the
* Harness home — never to a plugin; a bundle without this slot keeps its own
* project-local default, and an explicit `persistenceRoot` config still wins.
*/
export const SESSIONS_ROOT_KEY = 'launcherSessionsRoot'
/**
* Optional terminal-local interaction service provided by one mounted TUI.
*

View File

@@ -52,27 +52,6 @@ export function resolveDshHome(configured?: string, env: Record<string, string |
return resolve(expandHomePath(selected))
}
/** Directory name for persisted session logs under the Harness home. */
export const SESSIONS_DIR_NAME = 'sessions'
/**
* Resolve the shared session-store root under the Harness home.
*
* Every surface that persists sessions resolves this one directory, so history
* is shared across working directories instead of scattered per project. A
* persistence backend may still partition inside it. Two surfaces resolving
* different roots would silently split one user's history into disjoint stores,
* so this is a single owned fact rather than a per-caller `join`.
* @param configuredHome - explicit harness-home override, which has highest precedence.
* @param env - environment mapping used to read `DSH_HOME`.
* @returns the normalized absolute session-store root.
*/
export function resolveSessionsRoot(
configuredHome?: string, env: Record<string, string | undefined> = process.env,
): string {
return join(resolveDshHome(configuredHome, env), SESSIONS_DIR_NAME)
}
/**
* Describe a resolved harness home symbolically for user-facing display.
*

View File

@@ -4,12 +4,10 @@ import { describe, expect, it } from 'vitest'
import {
DEFAULT_DSH_HOME_DISPLAY,
DSH_HOME_DIR_NAME,
SESSIONS_DIR_NAME,
defaultDshHome,
dshHomeDisplay,
expandHomePath,
resolveDshHome,
resolveSessionsRoot,
} from '@deepseek-ai/dsh-paths'
describe('dsh path helpers', () => {
@@ -40,15 +38,6 @@ describe('dsh path helpers', () => {
expect(resolveDshHome(undefined, { DSH_HOME: ' ' })).toBe(defaultDshHome())
})
it('resolves the session store under the home it was given, by the same precedence', () => {
expect(SESSIONS_DIR_NAME).toBe('sessions')
expect(resolveSessionsRoot('/tmp/explicit-dsh', { DSH_HOME: '~/env-dsh' }))
.toBe(join(resolve('/tmp/explicit-dsh'), 'sessions'))
expect(resolveSessionsRoot(undefined, { DSH_HOME: '~/env-dsh' }))
.toBe(join(homedir(), 'env-dsh', 'sessions'))
expect(resolveSessionsRoot(undefined, {})).toBe(join(defaultDshHome(), 'sessions'))
})
it('labels a resolved home by whether it is the default root', () => {
expect(dshHomeDisplay(resolve(defaultDshHome()))).toBe('~/.dsh')
expect(dshHomeDisplay('/some/other/root')).toBe('$DSH_HOME')