fix(cli): default session root in shipped config
This commit is contained in:
@@ -67,14 +67,10 @@
|
||||
apiKey: !!js process.env.ANTHROPIC_API_KEY
|
||||
baseURL: !!js process.env.ANTHROPIC_BASE_URL
|
||||
|
||||
# The session store root is the launcher's policy, not a plugin's: `dsh` shares
|
||||
# one store under the Harness home across every cwd, so `/resume` spans
|
||||
# workspaces. Without a launcher the project-local fallback keeps
|
||||
# an embedder's sessions beside its project.
|
||||
- id: session-persistence-jsonl
|
||||
name: '@deepseek-ai/dsh-session-persistence-jsonl'
|
||||
config:
|
||||
root: !!js launcherSessionsRoot ?? './.sessions'
|
||||
root: !!js path.join(process.env.DSH_HOME || path.join(os.homedir(), '.dsh'), 'sessions')
|
||||
|
||||
- id: subprocess
|
||||
name: '@deepseek-ai/dsh-subprocess-local'
|
||||
|
||||
@@ -16,7 +16,7 @@ import type { FiberState } from 'cordis'
|
||||
import type { PatchOptions } from '@cordisjs/plugin-include'
|
||||
import yaml from 'js-yaml'
|
||||
import { boot, installFailLoud, loadEnv, loadOverlayPatches, loadPersonalPatches } from '@deepseek-ai/dsh-app-boot'
|
||||
import { resolveDshHome, resolveSessionsRoot } from '@deepseek-ai/dsh-paths'
|
||||
import { resolveDshHome } from '@deepseek-ai/dsh-paths'
|
||||
// Empty type import carries the httpServer Context merge for the port read below.
|
||||
import type {} from '@deepseek-ai/dsh-host-webserver'
|
||||
|
||||
@@ -189,11 +189,6 @@ export class AppCLIEntry {
|
||||
overrides.set(entryId, bag)
|
||||
}
|
||||
|
||||
// Source 0: computed engineering defaults. The session store is the one
|
||||
// shared root every dsh surface resolves, so history follows the user across
|
||||
// working directories instead of splitting per project. The profile
|
||||
// (Source 1) overwrites this same field via last-write-wins in put().
|
||||
put('session-persistence-jsonl', 'root', resolveSessionsRoot())
|
||||
|
||||
// Source 1: profile json (missing file = empty; unmapped key = loud).
|
||||
for (const [key, value] of Object.entries(this.readProfile())) {
|
||||
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
loadPersonalPatches,
|
||||
resolveConfigPath,
|
||||
} from '@deepseek-ai/dsh-app-boot'
|
||||
import { resolveDshHome, resolveSessionsRoot } from '@deepseek-ai/dsh-paths'
|
||||
import { resolveDshHome } from '@deepseek-ai/dsh-paths'
|
||||
import { SessionId } from '@deepseek-ai/dsh-session'
|
||||
import { SESSION_QUERY_SQLITE_PATH_KEY } from '@deepseek-ai/dsh-session-query-sqlite'
|
||||
import { CONFIGURED_AGENT_IDENTITIES_KEY } from '@deepseek-ai/dsh-agent-loop'
|
||||
@@ -39,7 +39,6 @@ import type { Context } from 'cordis'
|
||||
import {
|
||||
INITIAL_SKILL_KEY,
|
||||
MAIN_SESSION_ID_KEY,
|
||||
SESSIONS_ROOT_KEY,
|
||||
TUI_GOODBYE_MESSAGE_KEY,
|
||||
type MainSessionIdentity,
|
||||
type TuiResumeHost,
|
||||
@@ -65,18 +64,6 @@ const SESSION_QUERY_DB = `session-query-${String(process.pid)}-${randomUUID()}.d
|
||||
// symlink, an arbitrary cwd). The agent is told where its own source lives.
|
||||
const SOURCE_ROOT = fileURLToPath(new URL('../../..', import.meta.url))
|
||||
|
||||
/**
|
||||
* The value `dsh` provides on the {@link SESSIONS_ROOT_KEY} boot slot: its
|
||||
* shared session-store root, `sessions` under the Harness home. Shared-store
|
||||
* policy is the launcher's alone — the app bundle treats the slot as opaque and
|
||||
* keeps a project-local fallback, so only `dsh` decides that sessions are
|
||||
* shared across working directories (making `/resume` span every workspace).
|
||||
* @returns the absolute session-store root this launcher shares.
|
||||
*/
|
||||
export function launcherSessionsRoot(): string {
|
||||
return resolveSessionsRoot()
|
||||
}
|
||||
|
||||
/* v8 ignore start -- composition over the unit-tested dsh-app-boot helpers;
|
||||
the CLI PTY smoke drives this path end to end, personal overlay included */
|
||||
/**
|
||||
@@ -238,7 +225,6 @@ export async function runTui(
|
||||
// Shared-store policy is the launcher's: sessions live in one root under
|
||||
// the Harness home across every cwd, so /resume sees every workspace.
|
||||
// The bundle treats the slot as opaque.
|
||||
hostCtx.provide(SESSIONS_ROOT_KEY, launcherSessionsRoot())
|
||||
// The agent-loop row reads this to bind `main`, and the tui row reads the
|
||||
// same id, so a personal overlay repointing the model route cannot drop
|
||||
// the session identity or desynchronise the two.
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* Pins the launcher side of the shared-session-store contract: `dsh` defaults
|
||||
* its opaque `SESSIONS_ROOT_KEY` boot-slot value to `DSH_HOME/sessions`. The
|
||||
* plugin side — the slot treated as opaque, explicit config winning, and a
|
||||
* project-local fallback with no globality assumption — is pinned by
|
||||
* the former bundled TUI tests.
|
||||
*/
|
||||
|
||||
import { join, resolve } from 'node:path'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { launcherSessionsRoot } from '../src/tui.ts'
|
||||
|
||||
afterEach(() => vi.unstubAllEnvs())
|
||||
|
||||
describe('launcherSessionsRoot', () => {
|
||||
it('defaults the boot slot to sessions under DSH_HOME', () => {
|
||||
vi.stubEnv('DSH_HOME', '/tmp/dsh-slot-home')
|
||||
expect(launcherSessionsRoot()).toBe(resolve(join('/tmp/dsh-slot-home', 'sessions')))
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user