瀏覽代碼

feat(cli): default session store to global ~/.dsh/sessions

Turtle 1 月之前
父節點
當前提交
2fda7c1da5
共有 2 個文件被更改,包括 15 次插入4 次删除
  1. 4 0
      apps/cli/cordis.yml
  2. 11 4
      apps/cli/src/app-cli-entry.ts

+ 4 - 0
apps/cli/cordis.yml

@@ -84,6 +84,10 @@
 - id: llm-retry
   name: '@deepseek-ai/dsh-llm-retry'
 
+# Session store root. AppCLIEntry resolves the engineering default to a
+# global dir under the Harness home ($DSH_HOME, else ~/.dsh): sessions live
+# in one place across every cwd, not a project-local ./.sessions. The
+# persistenceRoot profile key (user config) still overrides this per field.
 - id: session-persistence-jsonl
   name: '@deepseek-ai/dsh-session-persistence-jsonl'
   config:

+ 11 - 4
apps/cli/src/app-cli-entry.ts

@@ -117,10 +117,11 @@ export class AppCLIEntry {
   }
 
   /**
-   * Compose the patch set from the three non-yml config sources: profile
-   * json (user config), CLI flags, and the resolved frontend dist. Patches
-   * replace a row's config wholesale, so each patched row's yml static
-   * values are re-read here (bypass parse) and merged under the overrides.
+   * Compose the patch set from the non-yml config sources: computed
+   * engineering defaults (the global session root), profile json (user
+   * config, overriding those defaults), CLI flags, and the resolved frontend
+   * dist. Patches replace a row's config wholesale, so each patched row's yml
+   * static values are re-read here (bypass parse) and merged under the overrides.
    */
   private composePatches(): void {
     const rows = this.parseYmlRows()
@@ -131,6 +132,12 @@ export class AppCLIEntry {
       overrides.set(entryId, bag)
     }
 
+    // Source 0: computed engineering defaults. The session store defaults to
+    // a global dir under the Harness home ($DSH_HOME, else ~/.dsh) so history
+    // is shared across every cwd, not a project-local ./.sessions. The profile
+    // (Source 1) overwrites this same field via last-write-wins in put().
+    put('session-persistence-jsonl', 'root', join(resolveDshHome(), 'sessions'))
+
     // Source 1: profile json (missing file = empty; unmapped key = loud).
     for (const [key, value] of Object.entries(this.readProfile())) {
       const mapping = PROFILE_MAPPINGS.find(m => m.jsonPath === key)