dsh-more 0.0.5 → 0.0.6

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.
Files changed (27) hide show
  1. package/README.md +15 -7
  2. package/README.zh-CN.md +15 -7
  3. package/dist/client.js +810 -291
  4. package/dist/index.js +312 -131
  5. package/dist/types/generated/host-settings-schema.d.ts +4 -2
  6. package/dist/types/generated/patch-catalog.d.ts +12 -4
  7. package/dist/types/patches/model-capabilities/client/api.d.ts +4 -0
  8. package/dist/types/patches/model-capabilities/client/editor.d.ts +26 -0
  9. package/dist/types/patches/model-capabilities/client/index.d.ts +10 -0
  10. package/dist/types/patches/model-capabilities/client/model-entries.d.ts +15 -0
  11. package/dist/types/patches/model-capabilities/client/styles.d.ts +1 -0
  12. package/dist/types/patches/model-capabilities/host/deepseek.d.ts +11 -0
  13. package/dist/types/patches/{model-reasoning-efforts → model-capabilities}/host/validate.d.ts +3 -2
  14. package/dist/types/patches/model-capabilities/shared.d.ts +38 -0
  15. package/dist/types/patches/projectless-tasks/client/adapter.d.ts +15 -0
  16. package/dist/types/patches/projectless-tasks/client/create-task.d.ts +7 -0
  17. package/dist/types/patches/projectless-tasks/client/draft.d.ts +9 -0
  18. package/dist/types/patches/projectless-tasks/client/index.d.ts +2 -0
  19. package/dist/types/patches/projectless-tasks/client/new-session.d.ts +34 -0
  20. package/dist/types/patches/projectless-tasks/client/picker.d.ts +26 -0
  21. package/dist/types/patches/projectless-tasks/host/index.d.ts +5 -0
  22. package/dist/types/patches/projectless-tasks/shared.d.ts +6 -0
  23. package/dsh.plugin.json +1 -1
  24. package/package.json +1 -1
  25. package/dist/types/patches/model-reasoning-efforts/client/index.d.ts +0 -54
  26. package/dist/types/patches/model-reasoning-efforts/shared.d.ts +0 -51
  27. /package/dist/types/patches/{model-reasoning-efforts → model-capabilities}/host/index.d.ts +0 -0
@@ -0,0 +1,11 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import { type ModelReasoningEfforts } from '../shared.js';
3
+ /** Native DeepSeek accepts only these literal levels, not pi-ai wire aliases. */
4
+ export declare function validateDeepSeekEfforts(efforts: ModelReasoningEfforts | null): void;
5
+ /**
6
+ * DSH 0.1.2-rc.1 persists model extension fields, but its native adapter exposes
7
+ * one shared reasoning list. Adapt public methods on this runtime instance so
8
+ * selectors, prepared calls and direct streams use each model's declaration.
9
+ * Native image handling and transport remain with the registered adapter.
10
+ */
11
+ export declare function installDeepSeekReasoning(ctx: Context): () => void;
@@ -1,8 +1,8 @@
1
- import { type ModelReasoningEfforts } from '../shared.js';
1
+ import { type ModelCapabilities, type ModelReasoningEfforts } from '../shared.js';
2
2
  /**
3
3
  * Validate a client-supplied `reasoningEfforts` payload, mirroring the
4
4
  * pi-ai profile rules the adapter enforces when it resolves a route:
5
- * - `null`/`undefined` means "clear" (fall back to the installed catalog).
5
+ * - `null` means "clear" (fall back to DSH defaults).
6
6
  * - `false` means "this model does not reason".
7
7
  * - otherwise a dict whose keys are known levels, whose non-`off` values are
8
8
  * non-empty wire spellings, and which offers at least one level beyond `off`.
@@ -11,3 +11,4 @@ import { type ModelReasoningEfforts } from '../shared.js';
11
11
  * otherwise store a profile the adapter would refuse on its next resolution.
12
12
  */
13
13
  export declare function validateReasoningEfforts(raw: unknown): ModelReasoningEfforts | null;
14
+ export declare function validateCapabilities(raw: Record<string, unknown>): ModelCapabilities;
@@ -0,0 +1,38 @@
1
+ export declare const MODEL_CAPABILITIES_PATCH_ID = "model-capabilities";
2
+ export declare const LLM_PI_AI_SETTINGS_NAMESPACE = "llm-pi-ai";
3
+ export declare const LLM_DEEPSEEK_SETTINGS_NAMESPACE = "llm-deepseek";
4
+ export declare const DEEPSEEK_PROVIDER = "deepseek-official";
5
+ export declare const CAPABILITIES_PROTOCOL_VERSION = 2;
6
+ export type ModelSettingsNamespace = typeof LLM_PI_AI_SETTINGS_NAMESPACE | typeof LLM_DEEPSEEK_SETTINGS_NAMESPACE;
7
+ export declare const DEEPSEEK_THINKING_LEVELS: readonly ["off", "low", "high", "max"];
8
+ export declare const THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
9
+ export type ThinkingLevel = typeof THINKING_LEVELS[number];
10
+ export type ModelReasoningEfforts = false | Partial<Record<ThinkingLevel, string | null>>;
11
+ export declare const THINKING_FORMATS: readonly ["openai", "deepseek", "openrouter", "together", "baseten", "zai", "qwen", "chat-template", "qwen-chat-template", "string-thinking", "ant-ling"];
12
+ export type ThinkingFormat = typeof THINKING_FORMATS[number];
13
+ export interface ModelCapabilities {
14
+ /** null removes the model declaration and uses DSH's defaults. */
15
+ vision: boolean | null;
16
+ reasoningEfforts: ModelReasoningEfforts | null;
17
+ thinkingFormat: ThinkingFormat | null;
18
+ }
19
+ export interface ModelCapabilitiesRow extends ModelCapabilities {
20
+ namespace: ModelSettingsNamespace;
21
+ revision: number;
22
+ provider: string;
23
+ providerName: string;
24
+ modelId: string;
25
+ api: string | null;
26
+ }
27
+ export interface ModelCapabilitiesSnapshot {
28
+ protocolVersion: typeof CAPABILITIES_PROTOCOL_VERSION;
29
+ rows: readonly ModelCapabilitiesRow[];
30
+ writable: boolean;
31
+ revision: number | null;
32
+ }
33
+ export interface SaveModelCapabilitiesPayload extends ModelCapabilities {
34
+ namespace: ModelSettingsNamespace;
35
+ provider: string;
36
+ modelId: string;
37
+ expectedRevision: number;
38
+ }
@@ -0,0 +1,15 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { ComposerBarOwnerProps } from '@deepseek-ai/dsh-client-ui-conversation/client';
3
+ import type { ISessions } from '@deepseek-ai/dsh-api-session-controller/client';
4
+ import type { PatchActivationSource } from '../../../kernel/client/activation.js';
5
+ /** Host and Client merge different ctx.sessions types into Cordis. Validate this seam. */
6
+ export declare function clientSessionActions(ctx: Context): Pick<ISessions, 'create' | 'open'>;
7
+ /** Only the native workspace gate is removed; loading and business blocks stay native. */
8
+ export declare function unlockComposer(owner: ComposerBarOwnerProps, independent: boolean, block: ComposerBarOwnerProps['blocked']): ComposerBarOwnerProps;
9
+ /**
10
+ * DSH 0.1.2-rc.1 compatibility seam. Keep the native registration identity,
11
+ * children, stores and render authorizations; adapt only its owner props.
12
+ * A dormant fallback registration invalidates the public slot subscription
13
+ * on install/uninstall, including an already mounted Web client.
14
+ */
15
+ export declare function installConversationAdapter(ctx: Context, activation: PatchActivationSource): () => void;
@@ -0,0 +1,7 @@
1
+ import type { ISessions } from '@deepseek-ai/dsh-api-session-controller/client';
2
+ import type { SessionId } from '@deepseek-ai/dsh-session/types';
3
+ /** One shared flight for selection/clear; retries adopt the same native Session. */
4
+ export declare function createTaskStarter(sessions: Pick<ISessions, 'create' | 'open'>): {
5
+ start(beforeOpen?: (id: SessionId) => boolean | void): Promise<void>;
6
+ dispose(): void;
7
+ };
@@ -0,0 +1,9 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { SessionInput } from '@deepseek-ai/dsh-client-ui-conversation/client';
3
+ import type { SessionId } from '@deepseek-ai/dsh-session/types';
4
+ type Draft = Pick<SessionInput, 'state' | 'setDraft' | 'addImages' | 'removeImage'>;
5
+ /** Move only after all target admission checks pass; never overwrite another draft. */
6
+ export declare function transferDraft(source: Draft, target: Draft): void;
7
+ /** Validate the Client-only service methods where Cordis Host types overlap. */
8
+ export declare function transferBeforeOpen(ctx: Context, sourceId: SessionId | undefined, targetId: SessionId): boolean;
9
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { ClientPatch } from '../../../kernel/client/patch.js';
2
+ export declare const clientPatch: ClientPatch;
@@ -0,0 +1,34 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { ISessions, SessionListState } from '@deepseek-ai/dsh-api-session-controller/client';
3
+ import type { IWorkspaces, WorkspaceId, WorkspaceSnapshot } from '@deepseek-ai/dsh-api-workspace-controller/client';
4
+ import type { SessionId } from '@deepseek-ai/dsh-session/types';
5
+ import type { PatchActivationSource } from '../../../kernel/client/activation.js';
6
+ interface Navigation {
7
+ startSession(workspaceId?: WorkspaceId): void;
8
+ }
9
+ type Sessions = Pick<ISessions, 'list' | 'create' | 'open'>;
10
+ type Activation = Pick<PatchActivationSource, 'getSnapshot' | 'subscribe'>;
11
+ type NewSessionTarget = {
12
+ kind: 'workspace';
13
+ workspaceId: WorkspaceId;
14
+ } | {
15
+ kind: 'independent';
16
+ sourceId: SessionId;
17
+ } | {
18
+ kind: 'native';
19
+ } | {
20
+ kind: 'pending';
21
+ };
22
+ /** Explicit destinations win; otherwise follow the current page, never project recency. */
23
+ export declare function newSessionTarget(list: SessionListState, workspaces: WorkspaceSnapshot, explicit?: WorkspaceId): NewSessionTarget;
24
+ /** One reversible service wrapper covers sidebar, brand and native New Session callers. */
25
+ export declare function bindNewSessionNavigation({ navigation, sessions, workspaces, activation, reportError }: {
26
+ navigation: Navigation;
27
+ sessions: Sessions;
28
+ workspaces: Pick<IWorkspaces, 'list'>;
29
+ activation: Activation;
30
+ reportError(sourceId: SessionId, error: unknown): void;
31
+ }): () => void;
32
+ /** Keep the untyped native service seam local, validated and injection-owned. */
33
+ export declare function installNewSessionNavigation(ctx: Context, activation: Activation): () => void;
34
+ export {};
@@ -0,0 +1,26 @@
1
+ import { type ComponentType, type ReactNode } from 'react';
2
+ import type { Context } from '@deepseek-ai/cordis';
3
+ import type { EmptyWorkspaceOwnerProps } from '@deepseek-ai/dsh-client-ui-conversation/client';
4
+ import type { WorkspaceId, WorkspaceSnapshot } from '@deepseek-ai/dsh-api-workspace-controller/client';
5
+ import type { PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
6
+ export declare const INDEPENDENT_CHOICE_ID: WorkspaceId;
7
+ interface ChoiceState {
8
+ independent: boolean;
9
+ busy: boolean;
10
+ chooseIndependent(): void;
11
+ }
12
+ export declare function withIndependentChoice(snapshot: WorkspaceSnapshot): WorkspaceSnapshot;
13
+ /** Patch just the native chip label; its button, anchor and menu stay mounted. */
14
+ export declare function labelIndependentChip(anchor: HTMLElement): () => void;
15
+ export declare function WorkspaceChoice({ owner, state, error, children }: {
16
+ owner: EmptyWorkspaceOwnerProps;
17
+ state: ChoiceState;
18
+ error: string | undefined;
19
+ children: ReactNode;
20
+ }): JSX.Element;
21
+ type NativePickerProps = PropsRuntime<'conversation.hero.workspace'>;
22
+ /** Preserve the native menu, keyboard selection, Add workspace and directory flow. */
23
+ export declare function extendWorkspacePicker(original: ComponentType<NativePickerProps>): ComponentType<NativePickerProps>;
24
+ /** Same guarded registration seam as the Conversation adapter, with full teardown. */
25
+ export declare function installPickerAdapter(ctx: Context): () => void;
26
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { HostPatch } from '../../../kernel/host/patch.js';
2
+ import { type TaskLocation } from '../shared.js';
3
+ /** Preparation is read-only. The native Session API owns mkdir and creation. */
4
+ export declare function prepareTask(payload: unknown, homeDirectory?: string): TaskLocation;
5
+ export declare const hostPatch: HostPatch;
@@ -0,0 +1,6 @@
1
+ export declare const PROJECTLESS_TASKS_PATCH_ID = "projectless-tasks";
2
+ export declare const TASK_ID_PATTERN: RegExp;
3
+ export interface TaskLocation {
4
+ sessionId: string;
5
+ cwd: string;
6
+ }
package/dsh.plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-more",
3
3
  "description": "Practical patches for missing DSH Web context and history controls",
4
- "version": "0.0.5",
4
+ "version": "0.0.6",
5
5
  "entry": {
6
6
  "name": "dsh-more",
7
7
  "inject": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-more",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Practical patches for missing DeepSeek Harness Web context and history controls.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,54 +0,0 @@
1
- import type { SettingsScope } from '@deepseek-ai/dsh-client-ui-settings/client';
2
- import type { PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
3
- export type {} from '@deepseek-ai/dsh-client-ui-settings';
4
- import type { PatchActivationSource } from '../../../kernel/client/activation.js';
5
- import type { ClientPatch } from '../../../kernel/client/patch.js';
6
- import { type ThinkingLevel } from '../shared.js';
7
- type OverlayProps = PropsRuntime<'shell.overlay'>;
8
- /** One level's editing state inside a model's draft. */
9
- interface LevelDraft {
10
- enabled: boolean;
11
- wire: string;
12
- }
13
- /** One model's in-progress reasoning-effort draft. */
14
- export interface ModelDraft {
15
- nonReasoning: boolean;
16
- levels: Partial<Record<ThinkingLevel, LevelDraft>>;
17
- }
18
- /**
19
- * Locate every model row of every open model catalog in the shipped Models
20
- * settings page (the provider editor's 模型目录). The classes are the models
21
- * package's own CSS-module hashes, stable per build.
22
- */
23
- export declare function findModelEntries(): HTMLElement[];
24
- /**
25
- * Resolve the provider route for one model entry: the editor header's route
26
- * span when the route differs from the display name, else the owning provider
27
- * card's display name (which for such providers equals the route). Returns
28
- * null for the custom-provider creation card, which has no saved provider yet.
29
- */
30
- export declare function providerRouteOf(entry: HTMLElement): string | null;
31
- /** Resolve the model id from a model entry's first row input (the id field). */
32
- export declare function modelIdOf(entry: HTMLElement): string | null;
33
- /**
34
- * The level toggles + wire-value inputs shared by the editor modal. Draft
35
- * state lives in the caller so the modal survives models-page re-renders.
36
- */
37
- export declare function EffortEditorBody({ draft, setDraft, writable, busy }: {
38
- draft: ModelDraft;
39
- setDraft: (updater: (current: ModelDraft) => ModelDraft) => void;
40
- writable: boolean;
41
- busy: boolean;
42
- }): JSX.Element;
43
- /**
44
- * Persistent frame entry that drops a reasoning-effort button into every model
45
- * row of the shipped Models page model catalog and owns the editor modal. The
46
- * buttons are plain DOM (stateless) re-synced by a MutationObserver, so the
47
- * models page can re-render freely; the modal's state lives in this component,
48
- * which the slot system never unmounts.
49
- */
50
- export declare function ModelsPageEffortPortal(props: OverlayProps & {
51
- scope: SettingsScope<unknown>;
52
- activation: PatchActivationSource;
53
- }): JSX.Element | null;
54
- export declare const clientPatch: ClientPatch;
@@ -1,51 +0,0 @@
1
- export declare const MODEL_REASONING_EFFORTS_PATCH_ID = "model-reasoning-efforts";
2
- /**
3
- * The llm-pi-ai settings namespace this patch reads and writes. The shipped
4
- * Models settings page writes custom providers into the same namespace, so a
5
- * profile stored there is exactly what this patch annotates with
6
- * `reasoningEfforts`.
7
- */
8
- export declare const LLM_PI_AI_SETTINGS_NAMESPACE = "llm-pi-ai";
9
- /**
10
- * Every pi-ai thinking level a model may offer, in escalation order. Mirror of
11
- * the `THINKING_LEVELS` the installed `dsh-llm-pi-ai` adapter accepts; a level
12
- * absent from a model's dict is simply not offered.
13
- */
14
- export declare const THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
15
- export type ThinkingLevel = typeof THINKING_LEVELS[number];
16
- /**
17
- * The reasoning-effort set auto-filled onto a model that has none. DSH does
18
- * not expose a model's true supported levels for custom providers (the pi-ai
19
- * catalog lives behind the adapter, and `resolveModelInfo` does not surface
20
- * reasoning for custom routes), so the patch fills a common default which the
21
- * user can adjust per model. A model with no `reasoningEfforts` at all is
22
- * treated as non-reasoning by the adapter, so this override is what makes a
23
- * freshly fetched model think.
24
- */
25
- export declare const DEFAULT_REASONING_EFFORTS: Partial<Record<ThinkingLevel, string>>;
26
- /**
27
- * One model's reasoning-effort capability as stored in `settings.yaml`:
28
- * `false` means the model does not reason at all; a dict maps each offered
29
- * level to the wire spelling dispatch should send for it (`off` may leave its
30
- * spelling empty — "supported, send nothing").
31
- */
32
- export type ModelReasoningEfforts = false | Partial<Record<ThinkingLevel, string | null>>;
33
- /** One configured model's reasoning-effort state; `null` = not configured (falls back to the installed catalog). */
34
- export interface ModelReasoningEffortsRow {
35
- provider: string;
36
- providerName: string;
37
- modelId: string;
38
- reasoningEfforts: ModelReasoningEfforts | null;
39
- }
40
- /** What the settings page renders from, returned by the `read` route. */
41
- export interface ModelReasoningEffortsSnapshot {
42
- rows: readonly ModelReasoningEffortsRow[];
43
- writable: boolean;
44
- documentPath: string | undefined;
45
- }
46
- /** The `save` route payload; `reasoningEfforts: null` clears the field. */
47
- export interface SaveModelReasoningEffortsPayload {
48
- provider: string;
49
- modelId: string;
50
- reasoningEfforts: ModelReasoningEfforts | null;
51
- }