dsh-lowtide 0.2.8 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -6857,22 +6857,18 @@ function canTransition(status, action) {
6857
6857
  //#endregion
6858
6858
  //#region src/session-picker.ts
6859
6859
  /**
6860
- * Workspace session picker (functional-fix round): enumerate dsh
6861
- * conversations from the official storage files, grouped by workspace, so a
6862
- * new off-peak task can RESUME an existing conversation (agents.resume at
6863
- * execution time). Read-only; payloads (session.jsonl.zstd) are loaded by
6864
- * dsh itself on resume.
6860
+ * Workspace session picker: enumerate dsh conversations from the official
6861
+ * storage files, grouped by workspace, so a new off-peak task can resume an
6862
+ * existing conversation. Read-only; session payloads are loaded by dsh itself.
6865
6863
  *
6866
- * Data sources (verified against a live profile):
6864
+ * Data sources:
6867
6865
  * $DSH_HOME/storages/workspace.json
6868
6866
  * tables.workspaces.<id> = { path, title, sessionIds, updatedAt }
6869
- * $DSH_HOME/storages/session_projcache.json
6870
- * tables.sessions.<sessionId> = { identity: { createdAt, cwd },
6871
- * rows: { title: { val },
6872
- * sessionListMetadata: { val: { lastPromptAt } } } }
6867
+ * Legacy: $DSH_HOME/storages/session_projcache.json
6868
+ * tables.sessions.<sessionId> = { identity, rows }
6869
+ * Current: $DSH_HOME/storages/session_projcache/sessions/<sessionId>.json
6870
+ * { version, record: { identity, rows } }
6873
6871
  * Last activity = lastPromptAt (fallback: createdAt).
6874
- * Lowtide's own task sessions (prefix lt- or ns-) are NOT listed in
6875
- * workspace.sessionIds, so starting from the workspace table excludes them.
6876
6872
  */
6877
6873
  function storagesDir() {
6878
6874
  return join(process.env.DSH_HOME ?? join(homedir(), ".dsh"), "storages");
@@ -6886,6 +6882,25 @@ function readJsonSafe(file) {
6886
6882
  return null;
6887
6883
  }
6888
6884
  }
6885
+ function projectionRecord(value) {
6886
+ if (value === null || typeof value !== "object") return null;
6887
+ const record = value;
6888
+ if (record.identity === null || typeof record.identity !== "object") return null;
6889
+ if (record.rows === null || typeof record.rows !== "object") return null;
6890
+ return record;
6891
+ }
6892
+ function readPerRecordProjection(dir, id) {
6893
+ if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(id)) return null;
6894
+ return projectionRecord(readJsonSafe(join(dir, "session_projcache", "sessions", `${id}.json`))?.record);
6895
+ }
6896
+ function displayTitle(record) {
6897
+ const title = record?.rows?.title?.val;
6898
+ if (typeof title === "string" && title.trim() !== "") return title;
6899
+ const firstPrompt = record?.rows?.titleInput?.val?.first?.text;
6900
+ if (typeof firstPrompt !== "string" || firstPrompt.trim() === "") return null;
6901
+ const summary = firstPrompt.replace(/\s+/g, " ").trim();
6902
+ return summary.length > 80 ? `${summary.slice(0, 80)}…` : summary;
6903
+ }
6889
6904
  /** List conversations per workspace, most recently active first. */
6890
6905
  function listWorkspaceSessions(limitPerWorkspace = 30) {
6891
6906
  const dir = storagesDir();
@@ -6901,15 +6916,14 @@ function listWorkspaceSessions(limitPerWorkspace = 30) {
6901
6916
  const ids = Array.isArray(entry.sessionIds) ? entry.sessionIds.filter((id) => typeof id === "string" && !id.startsWith("lt-") && !id.startsWith("ns-")) : [];
6902
6917
  const sessions = [];
6903
6918
  for (const id of ids) {
6904
- const cached = projSessions?.[id];
6919
+ const cached = readPerRecordProjection(dir, id) ?? projSessions?.[id];
6905
6920
  if (cached?.rows?.sessionListMetadata?.val?.blank === true) continue;
6906
6921
  if (archived.has(id)) continue;
6907
- const titleVal = cached?.rows?.title?.val;
6908
6922
  const createdAt = cached?.identity?.createdAt;
6909
6923
  const lastPromptAt = cached?.rows?.sessionListMetadata?.val?.lastPromptAt;
6910
6924
  sessions.push({
6911
6925
  id,
6912
- title: typeof titleVal === "string" ? titleVal : null,
6926
+ title: displayTitle(cached),
6913
6927
  lastModified: typeof lastPromptAt === "number" ? lastPromptAt : typeof createdAt === "number" ? createdAt : 0
6914
6928
  });
6915
6929
  }
@@ -7336,6 +7350,7 @@ function registerRoutes(ctx, routes) {
7336
7350
  });
7337
7351
  return;
7338
7352
  }
7353
+ if (typeof body?.continuesFromSession !== "string" || body.continuesFromSession === "") result.task.continuesFromSession = void 0;
7339
7354
  const edited = store.editTask(id, result.task);
7340
7355
  broadcastState(ctx, routes);
7341
7356
  reply(res, 200, {
@@ -7468,10 +7483,13 @@ function registerRoutes(ctx, routes) {
7468
7483
  }
7469
7484
  })();
7470
7485
  };
7471
- ctx.webServer.register({
7472
- kind: "prefix",
7473
- path: "/ds-lowtide",
7474
- handler
7486
+ ctx.effect(() => {
7487
+ const dispose = ctx.webServer.register({
7488
+ kind: "prefix",
7489
+ path: "/ds-lowtide",
7490
+ handler
7491
+ });
7492
+ return typeof dispose === "function" ? dispose : () => {};
7475
7493
  });
7476
7494
  }
7477
7495
  /** Semantic validation for a config update beyond zod shape checks. */
@@ -1,20 +1,6 @@
1
1
  import type { PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
2
- import type { ComposerChainProps } from '@deepseek-ai/dsh-client-ui-conversation/client';
3
2
  import { type NsTranslate } from '../i18n.ts';
4
- export interface InterceptMatched {
5
- kind: 'lt-intercept';
6
- }
7
- /**
8
- * Pure chain routing: priced window ∧ not dismissed ∧ session present ∧
9
- * draft non-empty. The draft condition keeps the native bar (and the queue
10
- * dock) visible until the user actually starts typing (PLAN §6.2).
11
- *
12
- * v0.2.2: the tier comes from the local clock (`store.tier`), so a stalled
13
- * push stream can neither hide nor freeze the intercept card at a boundary.
14
- */
15
- export declare function selectIntercept(owner: ComposerChainProps): InterceptMatched | null;
16
- export type InterceptCardProps = PropsRuntime<'conversation.composer'> & {
17
- matched: InterceptMatched;
3
+ export type InterceptCardProps = PropsRuntime<'conversation.input.dock'> & {
18
4
  t: NsTranslate;
19
5
  };
20
- export declare function InterceptCard(props: InterceptCardProps): React.JSX.Element;
6
+ export declare function InterceptCard(props: InterceptCardProps): React.JSX.Element | null;
@@ -5,16 +5,15 @@
5
5
  * A fully CONTROLLED presentational component — the caller owns the state:
6
6
  * - NewTaskModal (variant="modal") holds local state and submits via the
7
7
  * task API; it also owns `advancedOpen` (the separate advanced window);
8
- * - InterceptCard (variant="intercept") binds the prompt to the host input
9
- * store (inputActions.setDraft) and keeps the workspace in local state.
8
+ * - InterceptCard (variant="intercept") keeps only the workspace in local
9
+ * state; the native composer remains the sole prompt editor.
10
10
  *
11
11
  * modal: prompt (placeholder follows the strategy) + workspace/priority
12
12
  * side by side + strategy (plain pills, hover tooltips, dynamic
13
13
  * explanation line, rounds for iterative/sampling, per-strategy
14
14
  * guidance text) + permission + an "advanced" gear button that
15
15
  * opens a separate SMALL WINDOW (reasoning effort, locked files).
16
- * intercept: prompt + workspace + empty-workspace warning only — the quick
17
- * enqueue surface stays minimal.
16
+ * intercept: workspace + empty-workspace warning only.
18
17
  */
19
18
  import type { ReactElement } from 'react';
20
19
  import { type NsTranslate } from '../i18n.ts';
@@ -174,7 +174,6 @@ declare const zh: {
174
174
  'intercept.title': string;
175
175
  'intercept.tierPeak': string;
176
176
  'intercept.tierCustom': string;
177
- 'intercept.inputPlaceholder': string;
178
177
  'intercept.workspaceLabel': string;
179
178
  'intercept.workspacePlaceholder': string;
180
179
  'intercept.workspaceWarning': string;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * dsh-lowtide browser half (Phase 1 assembly + review round 1 polish).
3
3
  * Six-surface registrations: ① PricePill (header utilities), ② InterceptCard
4
- * (composer chain), ③ QueueDock (input dock), ⑤ MorningReport (shell overlay).
4
+ * and ③ QueueDock (input dock), ⑤ MorningReport (shell overlay).
5
5
  * ④ ConfirmGate and ⑥ Settings land in the same overlay/settings slots.
6
6
  * Polling drives the entry store (SSE is the live path, polling the fallback).
7
7
  *
@@ -194,7 +194,7 @@ export interface ClientUiState {
194
194
  activeLocale: string;
195
195
  /**
196
196
  * Tier derived from the local clock + the host's windows. This is what the
197
- * pill and the intercept card DISPLAY, so a stalled stream can never freeze
197
+ * pill and the peak prompt DISPLAY, so a stalled stream can never freeze
198
198
  * 闲时/忙时; the host's `price.tier` stays the pricing/ledger authority.
199
199
  */
200
200
  tier: TierSnapshot;
@@ -1,6 +1,6 @@
1
1
  export interface WorkspaceSession {
2
2
  id: string;
3
- /** Conversation title from the proj cache (null when never titled). */
3
+ /** Conversation title or first-prompt label from the projection cache. */
4
4
  title: string | null;
5
5
  lastModified: number;
6
6
  }
package/package.json CHANGED
@@ -1,104 +1,104 @@
1
- {
2
- "name": "dsh-lowtide",
3
- "version": "0.2.8",
4
- "description": "lowtide: human-adjudicated off-peak batch task pipeline for dsh (peak/valley pricing aware)",
5
- "type": "module",
6
- "main": "lib/index.js",
7
- "types": "lib/types/src/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./lib/types/src/index.d.ts",
11
- "default": "./lib/index.js"
12
- },
13
- "./client": {
14
- "types": "./lib/types/client/index.d.ts",
15
- "default": "./lib/client.js"
16
- },
17
- "./package.json": "./package.json"
18
- },
19
- "dsh": {
20
- "bundle": {
21
- "patch": "./cordis.patch.yml"
22
- },
23
- "client": {
24
- "inject": [
25
- "@deepseek-ai/dsh-client-locale",
26
- "@deepseek-ai/dsh-client-ui-conversation",
27
- "@deepseek-ai/dsh-client-ui-settings",
28
- "@deepseek-ai/dsh-client-connection"
29
- ],
30
- "platform": "web"
31
- }
32
- },
33
- "files": [
34
- "lib/index.js",
35
- "lib/client.js",
36
- "lib/client.js.map",
37
- "lib/types/**/*.d.ts",
38
- "cordis.patch.yml"
39
- ],
40
- "scripts": {
41
- "bundle": "tsdown && tsc -p tsconfig.build.json",
42
- "watch": "tsdown --watch",
43
- "typecheck": "tsc --noEmit",
44
- "test": "vitest run",
45
- "dev": "npx @deepseek-ai/dsh@0.1.5-rc.1 web --patch ./cordis.dev.yml"
46
- },
47
- "license": "MIT",
48
- "keywords": [
49
- "dsh-plugin",
50
- "deepseek-harness",
51
- "deepseek",
52
- "off-peak",
53
- "batch-tasks",
54
- "pricing",
55
- "scheduler",
56
- "productivity"
57
- ],
58
- "author": "dsh-lowtide contributors",
59
- "repository": {
60
- "type": "git",
61
- "url": "https://github.com/KelaoHu/dsh-lowtide",
62
- "directory": "packages/dsh-lowtide"
63
- },
64
- "peerDependencies": {
65
- "@deepseek-ai/dsh-agent": ">=0.1.0-rc.7 <0.2.2-0",
66
- "@deepseek-ai/dsh-llm": ">=0.1.0-rc.7 <0.2.2-0",
67
- "@deepseek-ai/dsh-session": ">=0.1.0-rc.7 <0.2.2-0",
68
- "@deepseek-ai/dsh-settings": ">=0.1.0-rc.7 <0.2.2-0",
69
- "@deepseek-ai/dsh-storage-domain": ">=0.1.0-rc.7 <0.2.2-0"
70
- },
71
- "devDependencies": {
72
- "@deepseek-ai/cordis": "^4.0.1",
73
- "@deepseek-ai/dsh-agent": "^0.1.5-rc.1",
74
- "@deepseek-ai/dsh-agent-default-model": "^0.1.5-rc.1",
75
- "@deepseek-ai/dsh-agent-presets": "^0.1.5-rc.1",
76
- "@deepseek-ai/dsh-client-connection": "^0.1.5-rc.1",
77
- "@deepseek-ai/dsh-client-locale": "^0.1.5-rc.1",
78
- "@deepseek-ai/dsh-client-store": "^0.1.5-rc.1",
79
- "@deepseek-ai/dsh-client-ui-conversation": "^0.1.5-rc.1",
80
- "@deepseek-ai/dsh-client-ui-layout": "^0.1.5-rc.1",
81
- "@deepseek-ai/dsh-client-ui-primitives": "^0.1.5-rc.1",
82
- "@deepseek-ai/dsh-client-ui-renderer": "^0.1.5-rc.1",
83
- "@deepseek-ai/dsh-client-ui-settings": "^0.1.5-rc.1",
84
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.5-rc.1",
85
- "@deepseek-ai/dsh-host-webserver": "^0.1.5-rc.1",
86
- "@deepseek-ai/dsh-llm": "^0.1.5-rc.1",
87
- "@deepseek-ai/dsh-permission-presets": "^0.1.5-rc.1",
88
- "@deepseek-ai/dsh-session": "^0.1.5-rc.1",
89
- "@deepseek-ai/dsh-settings": "^0.1.5-rc.1",
90
- "@deepseek-ai/dsh-storage-domain": "^0.1.5-rc.1",
91
- "@playwright/test": "^1.62.1",
92
- "@types/node": "^22.20.0",
93
- "@types/react": "~18.3.1",
94
- "immer": "^10.1.1",
95
- "lightningcss": "^1.32.0",
96
- "lowtide-core": "workspace:*",
97
- "react": "^18.2.0",
98
- "tsdown": "^0.22.2",
99
- "typescript": "^6.0.3",
100
- "vitest": "^4.1.8",
101
- "zod": "^4.4.3",
102
- "zustand": "~4.4.7"
103
- }
104
- }
1
+ {
2
+ "name": "dsh-lowtide",
3
+ "version": "0.3.0",
4
+ "description": "lowtide: human-adjudicated off-peak batch task pipeline for dsh (peak/valley pricing aware)",
5
+ "type": "module",
6
+ "main": "lib/index.js",
7
+ "types": "lib/types/src/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./lib/types/src/index.d.ts",
11
+ "default": "./lib/index.js"
12
+ },
13
+ "./client": {
14
+ "types": "./lib/types/client/index.d.ts",
15
+ "default": "./lib/client.js"
16
+ },
17
+ "./package.json": "./package.json"
18
+ },
19
+ "dsh": {
20
+ "bundle": {
21
+ "patch": "./cordis.patch.yml"
22
+ },
23
+ "client": {
24
+ "inject": [
25
+ "@deepseek-ai/dsh-client-locale",
26
+ "@deepseek-ai/dsh-client-ui-conversation",
27
+ "@deepseek-ai/dsh-client-ui-settings",
28
+ "@deepseek-ai/dsh-client-connection"
29
+ ],
30
+ "platform": "web"
31
+ }
32
+ },
33
+ "files": [
34
+ "lib/index.js",
35
+ "lib/client.js",
36
+ "lib/client.js.map",
37
+ "lib/types/**/*.d.ts",
38
+ "cordis.patch.yml"
39
+ ],
40
+ "scripts": {
41
+ "bundle": "tsdown && tsc -p tsconfig.build.json",
42
+ "watch": "tsdown --watch",
43
+ "typecheck": "tsc --noEmit",
44
+ "test": "vitest run",
45
+ "dev": "npx @deepseek-ai/dsh@0.1.5-rc.1 web --patch ./cordis.dev.yml"
46
+ },
47
+ "license": "MIT",
48
+ "keywords": [
49
+ "dsh-plugin",
50
+ "deepseek-harness",
51
+ "deepseek",
52
+ "off-peak",
53
+ "batch-tasks",
54
+ "pricing",
55
+ "scheduler",
56
+ "productivity"
57
+ ],
58
+ "author": "dsh-lowtide contributors",
59
+ "repository": {
60
+ "type": "git",
61
+ "url": "https://github.com/KelaoHu/dsh-lowtide",
62
+ "directory": "packages/dsh-lowtide"
63
+ },
64
+ "peerDependencies": {
65
+ "@deepseek-ai/dsh-agent": ">=0.1.0-rc.7 <0.2.3-0",
66
+ "@deepseek-ai/dsh-llm": ">=0.1.0-rc.7 <0.2.3-0",
67
+ "@deepseek-ai/dsh-session": ">=0.1.0-rc.7 <0.2.3-0",
68
+ "@deepseek-ai/dsh-settings": ">=0.1.0-rc.7 <0.2.3-0",
69
+ "@deepseek-ai/dsh-storage-domain": ">=0.1.0-rc.7 <0.2.3-0"
70
+ },
71
+ "devDependencies": {
72
+ "@deepseek-ai/cordis": "^4.0.1",
73
+ "@deepseek-ai/dsh-agent": "^0.1.5-rc.1",
74
+ "@deepseek-ai/dsh-agent-default-model": "^0.1.5-rc.1",
75
+ "@deepseek-ai/dsh-agent-presets": "^0.1.5-rc.1",
76
+ "@deepseek-ai/dsh-client-connection": "^0.1.5-rc.1",
77
+ "@deepseek-ai/dsh-client-locale": "^0.1.5-rc.1",
78
+ "@deepseek-ai/dsh-client-store": "^0.1.5-rc.1",
79
+ "@deepseek-ai/dsh-client-ui-conversation": "^0.1.5-rc.1",
80
+ "@deepseek-ai/dsh-client-ui-layout": "^0.1.5-rc.1",
81
+ "@deepseek-ai/dsh-client-ui-primitives": "^0.1.5-rc.1",
82
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.1.5-rc.1",
83
+ "@deepseek-ai/dsh-client-ui-settings": "^0.1.5-rc.1",
84
+ "@deepseek-ai/dsh-client-ui-slots": "^0.1.5-rc.1",
85
+ "@deepseek-ai/dsh-host-webserver": "^0.1.5-rc.1",
86
+ "@deepseek-ai/dsh-llm": "^0.1.5-rc.1",
87
+ "@deepseek-ai/dsh-permission-presets": "^0.1.5-rc.1",
88
+ "@deepseek-ai/dsh-session": "^0.1.5-rc.1",
89
+ "@deepseek-ai/dsh-settings": "^0.1.5-rc.1",
90
+ "@deepseek-ai/dsh-storage-domain": "^0.1.5-rc.1",
91
+ "@playwright/test": "^1.62.1",
92
+ "@types/node": "^22.20.0",
93
+ "@types/react": "~18.3.1",
94
+ "immer": "^10.1.1",
95
+ "lightningcss": "^1.32.0",
96
+ "lowtide-core": "workspace:*",
97
+ "react": "^18.2.0",
98
+ "tsdown": "^0.22.2",
99
+ "typescript": "^6.0.3",
100
+ "vitest": "^4.1.8",
101
+ "zod": "^4.4.3",
102
+ "zustand": "~4.4.7"
103
+ }
104
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 dsh-lowtide contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,13 +0,0 @@
1
- export declare const INTERCEPT_DISMISS_KEY = "dsh-lowtide:intercept-session-dismissed";
2
- /** Sync the live draft into the module state (QueueDock stays mounted inside
3
- * the overlay-kept fallback, so it keeps tracking while the card is up).
4
- * An emptied draft re-arms interception for the next message. */
5
- export declare function useInterceptDraftTracking(draft: string): void;
6
- /** Pure read for the chain selector. */
7
- export declare function readInterceptDraft(): string;
8
- /** ✕ exemption: this message will not be intercepted again this session. */
9
- export declare function dismissInterceptSession(): void;
10
- /** Clear the per-session exemption (new message = re-arm). */
11
- export declare function clearInterceptSessionDismissal(): void;
12
- /** Pure read for the chain selector. */
13
- export declare function isInterceptSessionDismissed(): boolean;