dsh-lark-bot 0.19.15 → 0.19.16

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/README.md CHANGED
@@ -113,7 +113,7 @@ dsh --profile dsh-lark # ② 启动
113
113
 
114
114
  ## 兼容性
115
115
 
116
- - **DeepSeek Harness(`dsh`)**:已验证 **0.1.0-rc.8**(2026-08-22),经官方 `@deepseek-ai/dsh-sdk-client` / `dsh-acp` 接入;锁定版本与升级政策见 [`docs/COMPATIBILITY.md`](docs/COMPATIBILITY.md)。
116
+ - **DeepSeek Harness(`dsh`)**:已验证 **0.1.0-rc.8**(2026-08-25),经官方 `@deepseek-ai/dsh-sdk-client` / `dsh-acp` 接入;锁定版本与升级政策见 [`docs/COMPATIBILITY.md`](docs/COMPATIBILITY.md)。
117
117
  - **运行时**:Node.js ≥ 22.19;**平台**:Linux / macOS / Windows。adapter 默认 `sdk`(原生续跑 / 流式 / 图片块),可切 `acp` / `headless` / `web`。
118
118
 
119
119
  ## 配置说明
package/README_EN.md CHANGED
@@ -114,7 +114,7 @@ Command help, status, and cards are bilingual; `/help` is the full authoritative
114
114
 
115
115
  ## Compatibility
116
116
 
117
- - **DeepSeek Harness (`dsh`)**: verified against **0.1.0-rc.8** (2026-08-22) via the official `@deepseek-ai/dsh-sdk-client` / `dsh-acp`; locked versions & upgrade policy in [`docs/COMPATIBILITY.md`](docs/COMPATIBILITY.md).
117
+ - **DeepSeek Harness (`dsh`)**: verified against **0.1.0-rc.8** (2026-08-25) via the official `@deepseek-ai/dsh-sdk-client` / `dsh-acp`; locked versions & upgrade policy in [`docs/COMPATIBILITY.md`](docs/COMPATIBILITY.md).
118
118
  - **Runtime**: Node.js ≥ 22.19; **Platforms**: Linux / macOS / Windows. Default adapter `sdk` (native resume / streaming / image blocks); switchable to `acp` / `headless` / `web`.
119
119
 
120
120
  ## Configuration
package/dist/cli.js CHANGED
@@ -129,7 +129,7 @@ var init_dsh_compat = __esm({
129
129
  sdkServer: "0.1.0-rc.8",
130
130
  acp: "0.1.0-rc.8",
131
131
  node: ">=22.19.0",
132
- verifiedAt: "2026-08-22"
132
+ verifiedAt: "2026-08-25"
133
133
  };
134
134
  }
135
135
  });
@@ -3706,6 +3706,7 @@ var DEFAULTS = {
3706
3706
  tenant: "feishu",
3707
3707
  provider: "",
3708
3708
  model: "",
3709
+ imageMaxDimension: 2e3,
3709
3710
  runTimeoutMs: 3e5,
3710
3711
  stopGraceMs: 5e3,
3711
3712
  groupPollMs: 3e3,
@@ -3889,6 +3890,11 @@ function loadRuntimeEnv(source = process.env) {
3889
3890
  provider: nonEmpty(source.DSH_LARK_PROVIDER) ?? DEFAULTS.provider,
3890
3891
  model: nonEmpty(source.DSH_LARK_MODEL) ?? DEFAULTS.model,
3891
3892
  maxTokens: parseMaxTokens(source.DSH_LARK_MAX_TOKENS),
3893
+ imageMaxDimension: parseMinOneInt(
3894
+ source.DSH_LARK_IMAGE_MAX_DIMENSION,
3895
+ DEFAULTS.imageMaxDimension,
3896
+ "DSH_LARK_IMAGE_MAX_DIMENSION"
3897
+ ),
3892
3898
  runTimeoutMs: parseTimeout(source.DSH_LARK_RUN_TIMEOUT_MS),
3893
3899
  stopGraceMs: parseStopGrace(source.DSH_LARK_STOP_GRACE_MS),
3894
3900
  groupNoAt: parseBoolean(source.DSH_LARK_GROUP_NO_AT, false),
@@ -16747,13 +16753,60 @@ async function onboardPersonalAgent(deps = {}) {
16747
16753
  // src/media/attachments.ts
16748
16754
  import { mkdir as mkdir16, readFile as readFile24, rename as rename3, rm as rm9, stat as stat9 } from "fs/promises";
16749
16755
  import { join as join23 } from "path";
16756
+
16757
+ // src/media/image-scale.ts
16758
+ import { writeFile as writeFile8 } from "fs/promises";
16759
+ function formatFromExtension(path) {
16760
+ const lower = path.toLowerCase();
16761
+ if (lower.endsWith(".png")) return "png";
16762
+ if (lower.endsWith(".jpg") || lower.endsWith(".jpeg")) return "jpeg";
16763
+ if (lower.endsWith(".webp")) return "webp";
16764
+ if (lower.endsWith(".gif")) return "gif";
16765
+ return void 0;
16766
+ }
16767
+ async function downscaleImageIfNeeded(path, maxDimension) {
16768
+ if (typeof maxDimension !== "number" || !Number.isFinite(maxDimension) || maxDimension <= 0) {
16769
+ return path;
16770
+ }
16771
+ const format = formatFromExtension(path);
16772
+ if (!format) return path;
16773
+ let sharp;
16774
+ try {
16775
+ const mod = await import("sharp");
16776
+ sharp = mod.default;
16777
+ } catch {
16778
+ return path;
16779
+ }
16780
+ if (!sharp) return path;
16781
+ try {
16782
+ const image = sharp(path, { failOn: "error" });
16783
+ const meta = await image.metadata();
16784
+ const width = meta.width ?? 0;
16785
+ const height = meta.height ?? 0;
16786
+ const longSide = Math.max(width, height);
16787
+ if (longSide <= maxDimension) return path;
16788
+ const data = await sharp(path, { failOn: "error" }).resize({
16789
+ width: maxDimension,
16790
+ height: maxDimension,
16791
+ fit: "inside",
16792
+ withoutEnlargement: true
16793
+ }).toFormat(format).toBuffer();
16794
+ await writeFile8(path, data);
16795
+ return path;
16796
+ } catch {
16797
+ return path;
16798
+ }
16799
+ }
16800
+
16801
+ // src/media/attachments.ts
16750
16802
  var MAX_TEXT_FILE_BYTES = 256e3;
16751
16803
  function assertSafeMediaName(mediaDir, destination) {
16752
16804
  if (!isPathWithin(mediaDir, destination)) {
16753
16805
  throw new Error(`unsafe attachment destination rejected: ${destination}`);
16754
16806
  }
16755
16807
  }
16756
- async function prepareAttachments(channel, message, mediaDir) {
16808
+ async function prepareAttachments(channel, message, mediaDir, options = {}) {
16809
+ const { maxImageDimension = 0 } = options;
16757
16810
  await mkdir16(mediaDir, { recursive: true });
16758
16811
  const result = { imagePaths: [], textFileNotes: [] };
16759
16812
  for (const resource of message.resources) {
@@ -16774,7 +16827,8 @@ async function prepareAttachments(channel, message, mediaDir) {
16774
16827
  const imagePath = `${destination}${detected.extension}`;
16775
16828
  assertSafeMediaName(mediaDir, imagePath);
16776
16829
  await rename3(downloadPath, imagePath);
16777
- result.imagePaths.push(imagePath);
16830
+ const finalPath = await downscaleImageIfNeeded(imagePath, maxImageDimension);
16831
+ result.imagePaths.push(finalPath);
16778
16832
  } catch (error) {
16779
16833
  await rm9(downloadPath, { force: true });
16780
16834
  throw error;
@@ -17357,7 +17411,7 @@ function normalizeCorrelation(value) {
17357
17411
  // src/session/archive.ts
17358
17412
  import { execFile as execFile2 } from "child_process";
17359
17413
  import { randomBytes as randomBytes4 } from "crypto";
17360
- import { access, mkdir as mkdir17, readdir as readdir3, readFile as readFile27, unlink, writeFile as writeFile8 } from "fs/promises";
17414
+ import { access, mkdir as mkdir17, readdir as readdir3, readFile as readFile27, unlink, writeFile as writeFile9 } from "fs/promises";
17361
17415
  import { join as join24 } from "path";
17362
17416
  import { promisify } from "util";
17363
17417
  var execFileAsync = promisify(execFile2);
@@ -17440,8 +17494,8 @@ var SessionArchive = class {
17440
17494
  const markdownPath = join24(scopeDir, `${id}.md`);
17441
17495
  await mkdir17(scopeDir, { recursive: true });
17442
17496
  await Promise.all([
17443
- writeFile8(jsonlPath, renderJsonl(input, { archiveId: id, archivedAt, source }), "utf8"),
17444
- writeFile8(
17497
+ writeFile9(jsonlPath, renderJsonl(input, { archiveId: id, archivedAt, source }), "utf8"),
17498
+ writeFile9(
17445
17499
  markdownPath,
17446
17500
  renderMarkdown(input, { archiveId: id, archivedAt, source }),
17447
17501
  "utf8"
@@ -19555,7 +19609,8 @@ async function startBridgeEngine(options) {
19555
19609
  attachments: await prepareAttachments(
19556
19610
  larkChannel,
19557
19611
  message,
19558
- paths.mediaDir(profileName)
19612
+ paths.mediaDir(profileName),
19613
+ { maxImageDimension: env.imageMaxDimension }
19559
19614
  )
19560
19615
  })));
19561
19616
  const messages = prepared.flatMap(({ message, attachments }) => [
@@ -20004,7 +20059,7 @@ function waitForShutdown() {
20004
20059
  init_dsh_runtime();
20005
20060
  init_own_package();
20006
20061
  import { spawn as spawn8 } from "child_process";
20007
- import { mkdir as mkdir23, readFile as readFile33, writeFile as writeFile9 } from "fs/promises";
20062
+ import { mkdir as mkdir23, readFile as readFile33, writeFile as writeFile10 } from "fs/promises";
20008
20063
  import { homedir as homedir17 } from "os";
20009
20064
  import { join as join28 } from "path";
20010
20065
  import { parse } from "yaml";
@@ -20104,7 +20159,7 @@ allowBuilds:
20104
20159
  existing = existing.replace(/(allowBuilds:\s*\n)/, `$1 ${allowBuilds}
20105
20160
  `);
20106
20161
  }
20107
- await writeFile9(workspaceFile, existing, "utf8");
20162
+ await writeFile10(workspaceFile, existing, "utf8");
20108
20163
  }
20109
20164
  async function preserveInstalledPnpmVersion(profileDir) {
20110
20165
  const packageFile = join28(profileDir, "package.json");
@@ -20127,7 +20182,7 @@ async function preserveInstalledPnpmVersion(profileDir) {
20127
20182
  return;
20128
20183
  }
20129
20184
  profilePackage.packageManager = packageManager;
20130
- await writeFile9(packageFile, `${JSON.stringify(profilePackage, null, 2)}
20185
+ await writeFile10(packageFile, `${JSON.stringify(profilePackage, null, 2)}
20131
20186
  `, "utf8");
20132
20187
  } catch {
20133
20188
  }
@@ -20733,7 +20788,7 @@ init_process();
20733
20788
 
20734
20789
  // src/guardian/safe-profile.ts
20735
20790
  init_dsh_runtime();
20736
- import { mkdir as mkdir26, writeFile as writeFile10 } from "fs/promises";
20791
+ import { mkdir as mkdir26, writeFile as writeFile11 } from "fs/promises";
20737
20792
  import { existsSync as existsSync8 } from "fs";
20738
20793
  import { join as join31 } from "path";
20739
20794
  var SAFE_CORE_BUNDLES = [
@@ -20753,7 +20808,7 @@ async function ensureSafeProfile(options) {
20753
20808
  let created = false;
20754
20809
  const manifest = join31(root, "package.json");
20755
20810
  if (!existsSync8(manifest)) {
20756
- await writeFile10(
20811
+ await writeFile11(
20757
20812
  manifest,
20758
20813
  `${JSON.stringify(
20759
20814
  {
@@ -20776,7 +20831,7 @@ async function ensureSafeProfile(options) {
20776
20831
  }
20777
20832
  const rootConfig = join31(root, "cordis.yml");
20778
20833
  if (!existsSync8(rootConfig)) {
20779
- await writeFile10(
20834
+ await writeFile11(
20780
20835
  rootConfig,
20781
20836
  "# dsh profile root - an empty entry list; the tree is composed as patches.\n[]\n",
20782
20837
  "utf8"
@@ -20785,12 +20840,12 @@ async function ensureSafeProfile(options) {
20785
20840
  }
20786
20841
  const userPatch = join31(root, "cordis.patch.yml");
20787
20842
  if (!existsSync8(userPatch)) {
20788
- await writeFile10(userPatch, "[]\n", "utf8");
20843
+ await writeFile11(userPatch, "[]\n", "utf8");
20789
20844
  created = true;
20790
20845
  }
20791
20846
  const workspace = join31(root, "pnpm-workspace.yaml");
20792
20847
  if (!existsSync8(workspace)) {
20793
- await writeFile10(
20848
+ await writeFile11(
20794
20849
  workspace,
20795
20850
  [
20796
20851
  "packages:",