paseo-dsh 0.2.20 → 0.2.21

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/index.server.ts CHANGED
@@ -45,17 +45,28 @@ export default function contribute(server: PluginServerContext) {
45
45
 
46
46
  server.registerSettings(timelineStyleSettings);
47
47
  server.handle(imagePreviewRpc, async (input) => {
48
- const empty = { dataUri: null, mime: null, error: null, bytes: null, limit: MAX_IMAGE_BYTES, tooLarge: false };
48
+ // The daemon answers with a code, never a sentence: the app picks the
49
+ // language, and `errorDetail` carries the raw reason the operating system
50
+ // gave so a real failure is still readable.
51
+ const empty = {
52
+ dataUri: null,
53
+ mime: null,
54
+ errorCode: null,
55
+ errorDetail: null,
56
+ bytes: null,
57
+ limit: MAX_IMAGE_BYTES,
58
+ tooLarge: false,
59
+ } as const;
49
60
  const absolute = isAbsolute(input.path) ? input.path : resolve(input.cwd || process.cwd(), input.path);
50
61
  const mime = IMAGE_MIME[extname(absolute).toLowerCase()];
51
62
  if (mime === undefined) {
52
- return { ...empty, error: "不支持的图片格式" };
63
+ return { ...empty, errorCode: "unsupported-format" as const };
53
64
  }
54
65
  try {
55
66
  const entry = await stat(absolute);
56
- if (!entry.isFile()) return { ...empty, mime, error: "不是文件" };
67
+ if (!entry.isFile()) return { ...empty, mime, errorCode: "not-file" as const };
57
68
  if (entry.size > HARD_MAX_IMAGE_BYTES) {
58
- return { ...empty, mime, bytes: entry.size, error: "图片超过 64MB 硬上限,无法预览" };
69
+ return { ...empty, mime, bytes: entry.size, errorCode: "too-large-hard" as const };
59
70
  }
60
71
  if (entry.size > MAX_IMAGE_BYTES && input.allowLarge !== true) {
61
72
  return {
@@ -63,7 +74,7 @@ export default function contribute(server: PluginServerContext) {
63
74
  mime,
64
75
  bytes: entry.size,
65
76
  tooLarge: true,
66
- error: `图片较大(${(entry.size / 1024 / 1024).toFixed(1)}MB,超过 12MB 预览上限)`,
77
+ errorCode: "too-large" as const,
67
78
  };
68
79
  }
69
80
  const bytes = await readFile(absolute);
@@ -77,7 +88,8 @@ export default function contribute(server: PluginServerContext) {
77
88
  return {
78
89
  ...empty,
79
90
  mime,
80
- error: error instanceof Error ? error.message : String(error),
91
+ errorCode: "unreadable" as const,
92
+ errorDetail: error instanceof Error ? error.message : String(error),
81
93
  };
82
94
  }
83
95
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "paseo-dsh",
3
- "version": "0.2.20",
4
- "description": "DeepSeek Harness (dsh) as a native Paseo provider: question cards, plan mode, thinking levels, steering, images and a real slash menu. 把 DeepSeek Harness 接成 Paseo 原生 provider。",
3
+ "version": "0.2.21",
4
+ "description": "DeepSeek Harness (dsh) as a native Paseo provider: question cards, plan mode, thinking levels, steering, images, a slash menu, permissions and presets.",
5
5
  "keywords": [
6
6
  "paseo",
7
7
  "paseo-plugin",
@@ -32,6 +32,7 @@
32
32
  "icon.svg",
33
33
  "README.md",
34
34
  "OVERVIEW.md",
35
+ "OVERVIEW.zh-CN.md",
35
36
  "LICENSE",
36
37
  "THIRD-PARTY-NOTICES.md",
37
38
  "index.client.tsx",
@@ -39,13 +40,14 @@
39
40
  ],
40
41
  "scripts": {
41
42
  "generate": "node scripts/generate-bridge-assets.mjs",
42
- "prepack": "node scripts/generate-bridge-assets.mjs",
43
+ "prepack": "node scripts/generate-bridge-assets.mjs && node scripts/check-locales.mjs",
43
44
  "typecheck": "tsc --noEmit",
44
45
  "test:process": "node --test test/process.test.cjs",
45
- "test": "node --test test/*.test.cjs"
46
+ "test": "node --test test/*.test.cjs && node scripts/check-locales.mjs",
47
+ "check:locales": "node scripts/check-locales.mjs"
46
48
  },
47
49
  "peerDependencies": {
48
- "@getpaseo/plugin": ">=0.9.2"
50
+ "@getpaseo/plugin": ">=0.13.0"
49
51
  },
50
52
  "peerDependenciesMeta": {
51
53
  "@getpaseo/plugin": {
@@ -53,7 +55,7 @@
53
55
  }
54
56
  },
55
57
  "devDependencies": {
56
- "@getpaseo/plugin": "0.9.2",
58
+ "@getpaseo/plugin": "^0.16.0",
57
59
  "@types/node": "^22.10.2",
58
60
  "@types/react": "^19.3.0",
59
61
  "typescript": "^5.9.3",
package/paseo-plugin.json CHANGED
@@ -1,7 +1,13 @@
1
1
  {
2
2
  "id": "dsh-paseo",
3
- "description": "DeepSeek Harness (dsh) as a native Paseo provider: question cards, plan mode, thinking levels, steering, images, a slash menu, permissions and presets. 把 DeepSeek Harness 接成 Paseo 原生 provider:提问卡片、计划模式、思考档位、插话、图片、斜杠菜单、权限与预设。",
3
+ "name": "DeepSeek Harness",
4
+ "description": "DeepSeek Harness (dsh) as a native Paseo provider: question cards, plan mode, thinking levels, steering, images, a slash menu, permissions and presets.",
5
+ "translations": {
6
+ "zh-CN": {
7
+ "description": "把 DeepSeek Harness(dsh)接成 Paseo 原生 provider:提问卡片、计划模式、思考档位、插话、图片、斜杠菜单、权限与预设。"
8
+ }
9
+ },
4
10
  "requirements": {
5
- "paseo": ">=0.9.2"
11
+ "paseo": ">=0.13.0"
6
12
  }
7
13
  }
package/server/session.ts CHANGED
@@ -403,9 +403,13 @@ export class DshSession {
403
403
  // A preset whose plugins failed to mount can still be listed. Mark it so the
404
404
  // composer does not offer it as a working choice: selecting it would be
405
405
  // rejected and silently snap back to the current preset.
406
+ //
407
+ // The composer draws this label itself and the daemon has no idea which
408
+ // language the app is showing, so the marker is written in both languages
409
+ // instead of picking one.
406
410
  this.#presetOptions = info.presets.map((preset) => ({
407
411
  value: preset.id,
408
- label: `${preset.name ?? preset.id}${preset.broken === undefined ? "" : "(不可用)"}`,
412
+ label: `${preset.name ?? preset.id}${preset.broken === undefined ? "" : " (unavailable / 不可用)"}`,
409
413
  }));
410
414
  }
411
415
 
@@ -540,7 +544,9 @@ export class DshSession {
540
544
  type: "notification",
541
545
  id: `preset-error:${Date.now()}`,
542
546
  level: "error",
543
- message: `切换预设失败:${message}`,
547
+ // Rendered by the host as written: both languages, so neither reader
548
+ // gets a message in the other one.
549
+ message: `Preset switch failed / 切换预设失败:${message}`,
544
550
  });
545
551
  }
546
552
  }
@@ -820,7 +826,9 @@ export class DshSession {
820
826
  type: "notification",
821
827
  id: `preset-error:${Date.now()}`,
822
828
  level: "error",
823
- message: `切换预设失败:${message}`,
829
+ // Rendered by the host as written: both languages, so neither reader
830
+ // gets a message in the other one.
831
+ message: `Preset switch failed / 切换预设失败:${message}`,
824
832
  });
825
833
  }
826
834
  }
@@ -111,9 +111,12 @@ function toolDetail(name: string, input: Record<string, unknown>, output?: strin
111
111
  ...(output === undefined ? {} : { result: output }),
112
112
  };
113
113
  case "todo_write":
114
- return { type: "plain_text", label: "Update tasks", icon: "sparkles" };
114
+ // The protocol has no todo or question detail type, and inventing one
115
+ // would break the shape the host validates. These two tools carry their
116
+ // own input, so the row is derived from the tool name on the client.
117
+ return { type: "unknown", input: input as unknown as JsonValue, output: (output ?? null) as JsonValue };
115
118
  case "ask_user_question":
116
- return { type: "plain_text", label: "Asked the user", icon: "sparkles" };
119
+ return { type: "unknown", input: input as unknown as JsonValue, output: (output ?? null) as JsonValue };
117
120
  case "exit_plan_mode":
118
121
  // Paseo renders this as the readable plan card, and its own Codex adapter
119
122
  // emits the same item next to the approval buttons. The plan has to be
@@ -123,7 +126,9 @@ function toolDetail(name: string, input: Record<string, unknown>, output?: strin
123
126
  const childSessionId = childSessionIdOf(output);
124
127
  return {
125
128
  type: "sub_agent",
126
- subAgentType: "Sub-agent",
129
+ // Drawn by the host as written, and the daemon cannot see the app
130
+ // language, so both languages are spelled out.
131
+ subAgentType: "Sub-agent / 子代理",
127
132
  ...(stringField(input, "description") === undefined
128
133
  ? {}
129
134
  : { description: stringField(input, "description") as string }),
@@ -9,6 +9,10 @@ import { z } from "zod";
9
9
  * Files above the soft limit are reported as `tooLarge` so the client can ask
10
10
  * the reader before paying the base64/WebSocket cost; `allowLarge` bypasses it
11
11
  * up to the daemon's hard ceiling.
12
+ *
13
+ * Failures cross the wire as a code plus the raw operating-system detail, never
14
+ * as a sentence: the daemon does not know which language the app is showing,
15
+ * so the client is the one that phrases the reason.
12
16
  */
13
17
  export const imagePreviewRpc = defineRpc({
14
18
  name: "file.image",
@@ -20,9 +24,12 @@ export const imagePreviewRpc = defineRpc({
20
24
  output: z.object({
21
25
  dataUri: z.string().nullable(),
22
26
  mime: z.string().nullable(),
23
- error: z.string().nullable(),
27
+ errorCode: z.enum(["unsupported-format", "not-file", "too-large", "too-large-hard", "unreadable"]).nullable(),
28
+ errorDetail: z.string().nullable(),
24
29
  bytes: z.number().nullable(),
25
30
  limit: z.number().nullable(),
26
31
  tooLarge: z.boolean(),
27
32
  }),
28
33
  });
34
+
35
+ export type ImageErrorCode = z.infer<typeof imagePreviewRpc.output>["errorCode"] & string;
@@ -48,46 +48,17 @@ export const TIMELINE_STYLE_DEFAULTS: TimelineStyleValues = {
48
48
  commandMinHeight: 120,
49
49
  };
50
50
 
51
- export interface TimelineStyleField {
52
- key: TimelineStyleKey;
53
- label: string;
54
- hint: string;
55
- }
56
-
57
- export const TIMELINE_STYLE_FIELDS: readonly TimelineStyleField[] = [
58
- {
59
- key: "toolRowMarginY",
60
- label: "工具之间的额外间距",
61
- hint: "叠加在宿主固定 16px 之上,可填负数:8 → 约 24px,-8 → 约 8px,-16 → 约 0px。范围 -16 ~ 24。",
62
- },
63
- {
64
- key: "liveReasoningRowMarginY",
65
- label: "正在输出的思考行额外间距",
66
- hint: "只作用于正在流式输出的思考行。默认 8,负值可能重叠。",
67
- },
68
- {
69
- key: "toolRowPaddingY",
70
- label: "工具行上下内边距(行内留白)",
71
- hint: "只改行内留白,不改工具之间的距离;要缩小行间距请改上面的“工具之间的额外间距”。范围 0 ~ 12。",
72
- },
73
- {
74
- key: "toolRowMinHeight",
75
- label: "工具行最小高度",
76
- hint: "整行至少多高;配合内边距 0 可压到接近图标高度(约 17px)。范围 12 ~ 64。",
77
- },
78
- {
79
- key: "toolRowGap",
80
- label: "图标与文字的水平间距",
81
- hint: "图标、动词、目标之间。范围 0 ~ 24。",
82
- },
83
- {
84
- key: "commandMaxHeightRatio",
85
- label: "命令块最大高度(窗口占比)",
86
- hint: "0.25 表示最多占窗口高度的四分之一;超过后命令块内部滚动,输出区始终保留。范围 0.1 ~ 0.6。",
87
- },
88
- {
89
- key: "commandMinHeight",
90
- label: "命令块最小高度上限",
91
- hint: "窗口很小时仍给命令块保留的高度(像素)。范围 60 ~ 360。",
92
- },
93
- ];
51
+ /**
52
+ * Editor order for the settings screen. The label and hint text lives in the
53
+ * client locale catalogs (`settings.field.<key>.label` / `.hint`), so the shared
54
+ * contract carries keys only and the app language decides the wording.
55
+ */
56
+ export const TIMELINE_STYLE_KEYS = [
57
+ "toolRowMarginY",
58
+ "liveReasoningRowMarginY",
59
+ "toolRowPaddingY",
60
+ "toolRowMinHeight",
61
+ "toolRowGap",
62
+ "commandMaxHeightRatio",
63
+ "commandMinHeight",
64
+ ] as const satisfies readonly TimelineStyleKey[];