@dinoxx/dinox-cli 2.20.2 → 3.0.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.
Files changed (58) hide show
  1. package/README.md +17 -16
  2. package/dist/chunks/{applePodcast-V4FSJOC5.js → applePodcast-YDYM4JYQ.js} +3 -3
  3. package/dist/chunks/{bbc-NTMRPYRF.js → bbc-N3BM2EGG.js} +3 -3
  4. package/dist/chunks/{bilibili-UA3MBSPH.js → bilibili-V4XVW33T.js} +63 -9
  5. package/dist/chunks/{bohaishibei-B7UVXH4Y.js → bohaishibei-IQO5CZTN.js} +3 -3
  6. package/dist/chunks/{chunk-BKCNERPB.js → chunk-2DREJFKB.js} +98 -17
  7. package/dist/chunks/{chunk-4GM3PRSK.js → chunk-ARBWJ3ZA.js} +4176 -2821
  8. package/dist/chunks/{chunk-XMMTGPZ6.js → chunk-AZ43P73A.js} +56 -2
  9. package/dist/chunks/{chunk-D3CETVY5.js → chunk-HG3RZFDX.js} +3 -3
  10. package/dist/chunks/{chunk-MDWXLRRN.js → chunk-KJBN7TD7.js} +3 -3
  11. package/dist/chunks/{chunk-FIQYJ6KZ.js → chunk-LLAXR5EG.js} +1 -1
  12. package/dist/chunks/{chunk-TILRKKRN.js → chunk-MKEL2KNU.js} +893 -468
  13. package/dist/chunks/{chunk-FGQRYB7F.js → chunk-MZMOE3RX.js} +13 -1
  14. package/dist/chunks/{chunk-W4EWLODY.js → chunk-N2VYTZWU.js} +2 -2
  15. package/dist/chunks/{chunk-XEPDFQYD.js → chunk-N5YDNM3P.js} +26 -26
  16. package/dist/chunks/{chunk-7MGDG5BW.js → chunk-NVKSI4BD.js} +470 -82
  17. package/dist/chunks/{chunk-QFUD3I7W.js → chunk-QPVGA46P.js} +0 -1
  18. package/dist/chunks/{chunk-6AZT4ARG.js → chunk-R2CGNGOT.js} +3 -3
  19. package/dist/chunks/{chunk-GTDX2LIJ.js → chunk-RSSEVU2F.js} +58 -10
  20. package/dist/chunks/{chunk-CHGKDZV6.js → chunk-WABL3OUP.js} +2 -2
  21. package/dist/chunks/{cookies-6QQHSM26.js → cookies-ORQ3RLAH.js} +1 -3
  22. package/dist/chunks/{doubanGroup-HR4K2KMY.js → doubanGroup-MADXDGDI.js} +4 -4
  23. package/dist/chunks/{doubao-MXUHPLUB.js → doubao-DKZERP6Y.js} +2 -2
  24. package/dist/chunks/{douyin-UU2FSQPS.js → douyin-PIWFZHK7.js} +91 -5
  25. package/dist/chunks/{ensure-E3DIRHSQ.js → ensure-MPOQ244L.js} +5 -5
  26. package/dist/chunks/{execute-YP2N2AMS.js → execute-KMNZ5EFR.js} +3 -3
  27. package/dist/chunks/{facebook-SZFOVE7R.js → facebook-TI2CF5UY.js} +2 -2
  28. package/dist/chunks/{feishu-ISWRJ7HI.js → feishu-XSSEBWQD.js} +2 -2
  29. package/dist/chunks/{ima-D7CX5WR4.js → ima-SKE2C64C.js} +2 -2
  30. package/dist/chunks/{instagram-HNDPO37H.js → instagram-4W4HCWJN.js} +2 -2
  31. package/dist/chunks/{install-IIMVFNAT.js → install-35YBLHXE.js} +0 -2
  32. package/dist/chunks/{jike-H7L4LJTN.js → jike-GS64MEEO.js} +4 -4
  33. package/dist/chunks/{mcp-AK373P5P.js → mcp-H667ML2O.js} +9 -9
  34. package/dist/chunks/{mcpServer-7VL4KJH2.js → mcpServer-G2WEAD2O.js} +13 -11
  35. package/dist/chunks/{metaso-ZVZW5UBB.js → metaso-RRYEUXIL.js} +2 -2
  36. package/dist/chunks/{run-OYMMVKCB.js → run-7D6ATULD.js} +7 -7
  37. package/dist/chunks/{runCli-ZJ7WYHJ7.js → runCli-QEWWUIZN.js} +8 -8
  38. package/dist/chunks/{setup-EEU6GSWX.js → setup-DSTOF3BZ.js} +2 -2
  39. package/dist/chunks/{threads-ADW6IANQ.js → threads-JKMT3E73.js} +3 -3
  40. package/dist/chunks/{twitter-NAGCB3NI.js → twitter-WNBOJELM.js} +2 -2
  41. package/dist/chunks/{web-QFKZCM4F.js → web-LJESVHHV.js} +4 -4
  42. package/dist/chunks/{wechat-OXNNLT4J.js → wechat-N7O77CB4.js} +40 -1
  43. package/dist/chunks/{weibo-PMVGDNQU.js → weibo-XPEV5CLQ.js} +4 -4
  44. package/dist/chunks/{workbuddy-NNAXIIIZ.js → workbuddy-ZXNDX7O7.js} +5 -5
  45. package/dist/chunks/{xiaoheihe-WFQJRBAD.js → xiaoheihe-WXFAORLQ.js} +3 -3
  46. package/dist/chunks/{xiaohongshu-5CXBELGW.js → xiaohongshu-3N3ZVSXJ.js} +2 -2
  47. package/dist/chunks/{xiaoyuzhou-6L6IB46Y.js → xiaoyuzhou-OGIWFABL.js} +3 -3
  48. package/dist/chunks/{youtube-52NGBTQC.js → youtube-YRSK7CWC.js} +3 -3
  49. package/dist/chunks/{zcool-HDSWK4KD.js → zcool-K5KJ2KDG.js} +2 -2
  50. package/dist/chunks/{zhihu-EX2VRJYY.js → zhihu-X6XSPD6B.js} +2 -2
  51. package/dist/dinox.js +5 -5
  52. package/dist/dsh-plugin/lib/client.js +309 -567
  53. package/dist/dsh-plugin/lib/index.js +1 -1
  54. package/dist/dsh-plugin/package.json +1 -1
  55. package/dist/dsh-plugin/runtime.json +2 -2
  56. package/dist/editor-ui/mcp-app.html +356 -592
  57. package/package.json +22 -12
  58. /package/dist/chunks/{chunk-QFSMFANX.js → chunk-SM2QOO45.js} +0 -0
@@ -172,7 +172,6 @@ async function readStdin() {
172
172
 
173
173
  export {
174
174
  clipCookiesFile,
175
- normalizeDomain,
176
175
  serializeNetscapeCookies,
177
176
  parseCookieHeader,
178
177
  mergeCookies,
@@ -20,7 +20,7 @@ import {
20
20
  isDoubanUrl,
21
21
  parseWebHtml,
22
22
  replaceWebMarkdownImageUrls
23
- } from "./chunk-TILRKKRN.js";
23
+ } from "./chunk-MKEL2KNU.js";
24
24
  import {
25
25
  WebToMarkdownError
26
26
  } from "./chunk-PTFGE4KS.js";
@@ -305,8 +305,8 @@ async function postJson(path, body, options, link) {
305
305
  }
306
306
  }
307
307
  function textToHtml(text) {
308
- const escape = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
309
- return text.split(/\n+/).map((line) => line.trim()).filter(Boolean).map((line) => `<p>${escape(line)}</p>`).join("\n");
308
+ const escapeHtml2 = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
309
+ return text.split(/\n+/).map((line) => line.trim()).filter(Boolean).map((line) => `<p>${escapeHtml2(line)}</p>`).join("\n");
310
310
  }
311
311
 
312
312
  // ../../packages/clip-engine/src/lookiToMarkdown/index.ts
@@ -2,7 +2,7 @@ import { createRequire as __dinoxCreateRequire } from 'node:module';
2
2
  const require = __dinoxCreateRequire(import.meta.url);
3
3
  import {
4
4
  composeClipMarkdown
5
- } from "./chunk-FIQYJ6KZ.js";
5
+ } from "./chunk-LLAXR5EG.js";
6
6
  import {
7
7
  clipEngineConfig
8
8
  } from "./chunk-F7BDWXBG.js";
@@ -10,11 +10,6 @@ import {
10
10
  formatBeijingDate
11
11
  } from "./chunk-AHRCI2RW.js";
12
12
 
13
- // ../../packages/clip-engine/src/ytdlpVideo/extract.ts
14
- import { spawn } from "node:child_process";
15
- import { readdir, rm, stat } from "node:fs/promises";
16
- import { join } from "node:path";
17
-
18
13
  // ../../packages/clip-engine/src/ytdlpVideo/errors.ts
19
14
  var VideoExtractError = class extends Error {
20
15
  code;
@@ -28,6 +23,9 @@ var VideoExtractError = class extends Error {
28
23
  };
29
24
 
30
25
  // ../../packages/clip-engine/src/ytdlpVideo/extract.ts
26
+ import { spawn } from "node:child_process";
27
+ import { readdir, rm, stat } from "node:fs/promises";
28
+ import { join } from "node:path";
31
29
  var DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36";
32
30
  var METADATA_TIMEOUT_MS = 6e4;
33
31
  var VIDEO_BASENAME = "ytdlp-video";
@@ -54,6 +52,9 @@ function videoExtractErrorFromYtDlp(stderr, url, code = null) {
54
52
  return new VideoExtractError("METADATA_FAILED", message, { url });
55
53
  }
56
54
  async function resolveVideoMetadata(url, opts) {
55
+ return (await resolveVideoInfo(url, opts)).metadata;
56
+ }
57
+ async function resolveVideoInfo(url, opts) {
57
58
  const { stdout, stderr, code } = await runYtDlp(opts, [...commonArgs(opts), "-J", "--no-playlist", url], METADATA_TIMEOUT_MS);
58
59
  if (code !== 0 || !stdout.trim()) {
59
60
  throw videoExtractErrorFromYtDlp(stderr, url, code);
@@ -72,7 +73,7 @@ async function resolveVideoMetadata(url, opts) {
72
73
  if (!metadata.title) {
73
74
  throw new VideoExtractError("CONTENT_NOT_FOUND", "video has no title", { url });
74
75
  }
75
- return metadata;
76
+ return { info, metadata };
76
77
  }
77
78
  function buildVideoFormatSelector(maxHeight) {
78
79
  const h = `[height<=${maxHeight}]`;
@@ -87,13 +88,14 @@ function buildVideoFormatSelector(maxHeight) {
87
88
  }
88
89
  async function downloadVideo(input) {
89
90
  const maxBytes = clipEngineConfig().media.maxVideoBytes;
90
- const { opts, outDir, url } = input;
91
+ const { opts, outDir, preferredFormat, url } = input;
92
+ const ladder = buildVideoFormatSelector(opts.maxHeight);
91
93
  const args = [
92
94
  ...commonArgs(opts),
93
95
  "--no-playlist",
94
96
  "--no-progress",
95
97
  "-f",
96
- buildVideoFormatSelector(opts.maxHeight),
98
+ preferredFormat ? `${preferredFormat}/${ladder}` : ladder,
97
99
  "--merge-output-format",
98
100
  "mp4",
99
101
  "--max-filesize",
@@ -256,10 +258,56 @@ function formatDuration(seconds) {
256
258
  return hh > 0 ? `${hh}:${pad(mm)}:${pad(ss)}` : `${mm}:${pad(ss)}`;
257
259
  }
258
260
 
261
+ // ../../packages/clip-engine/src/ytdlpVideo/formatBudget.ts
262
+ function estimateFormatBytes(format, durationSeconds) {
263
+ const exact = positive(format.filesize) ?? positive(format.filesize_approx);
264
+ if (exact) return exact;
265
+ const kbps = positive(format.tbr);
266
+ return kbps && durationSeconds ? Math.round(kbps * 1e3 * durationSeconds / 8) : void 0;
267
+ }
268
+ function pickBudgetedFormat(info, input) {
269
+ const formats = Array.isArray(info.formats) ? info.formats : [];
270
+ const duration = positive(info.duration);
271
+ const sized = formats.filter((f) => f.format_id).map((f) => ({ bytes: estimateFormatBytes(f, duration), f })).filter((x) => x.bytes !== void 0);
272
+ const hasVideo = (f) => Boolean(f.vcodec && f.vcodec !== "none");
273
+ const hasAudio = (f) => Boolean(f.acodec && f.acodec !== "none");
274
+ const avc = (f) => /^avc1/i.test(f.vcodec ?? "");
275
+ const inHeight = (f) => (f.height ?? 0) > 0 && (f.height ?? 0) <= input.maxHeight;
276
+ const audioOnly = sized.filter((x) => hasAudio(x.f) && !hasVideo(x.f));
277
+ const aac = audioOnly.filter((x) => /^mp4a/i.test(x.f.acodec ?? ""));
278
+ const audio = (aac.length > 0 ? aac : audioOnly).sort((a, b) => a.bytes - b.bytes)[0];
279
+ const candidates = [];
280
+ for (const x of sized) {
281
+ if (!hasVideo(x.f) || !inHeight(x.f)) continue;
282
+ if (hasAudio(x.f)) {
283
+ candidates.push({ avc: avc(x.f), bytes: x.bytes, height: x.f.height, selector: x.f.format_id });
284
+ } else if (audio) {
285
+ candidates.push({
286
+ avc: avc(x.f),
287
+ bytes: x.bytes + audio.bytes,
288
+ height: x.f.height,
289
+ selector: `${x.f.format_id}+${audio.f.format_id}`
290
+ });
291
+ }
292
+ }
293
+ const pool = candidates.some((c) => c.avc) ? candidates.filter((c) => c.avc) : candidates;
294
+ if (pool.length === 0) return void 0;
295
+ pool.sort((a, b) => b.height - a.height || b.bytes - a.bytes);
296
+ const fit = pool.find((c) => c.bytes <= input.budgetBytes);
297
+ const chosen = fit ?? [...pool].sort((a, b) => a.bytes - b.bytes)[0];
298
+ return { estimatedBytes: chosen.bytes, fits: Boolean(fit), height: chosen.height, selector: chosen.selector };
299
+ }
300
+ function positive(value) {
301
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
302
+ }
303
+
259
304
  export {
305
+ VideoExtractError,
260
306
  resolveVideoMetadata,
307
+ resolveVideoInfo,
261
308
  downloadVideo,
262
309
  downloadAudio,
263
310
  buildVideoMarkdown,
264
- formatDuration
311
+ formatDuration,
312
+ pickBudgetedFormat
265
313
  };
@@ -8,7 +8,7 @@ import {
8
8
  getDaemonInfo,
9
9
  getDaemonService,
10
10
  sendDaemonRequest
11
- } from "./chunk-QFSMFANX.js";
11
+ } from "./chunk-SM2QOO45.js";
12
12
  import {
13
13
  getPackageVersion
14
14
  } from "./chunk-WMJXAF3X.js";
@@ -736,7 +736,7 @@ var forwardDependencies = {
736
736
  return Boolean(info && matchesRuntimeTokenBinding(info, version, config));
737
737
  },
738
738
  ensureDaemonRunning: async () => {
739
- await (await import("./ensure-E3DIRHSQ.js")).ensureDaemonRunning();
739
+ await (await import("./ensure-MPOQ244L.js")).ensureDaemonRunning();
740
740
  },
741
741
  sendDaemonRequest,
742
742
  envTokenOverridesLogin,
@@ -3,7 +3,6 @@ const require = __dinoxCreateRequire(import.meta.url);
3
3
  import {
4
4
  clipCookiesFile,
5
5
  mergeCookies,
6
- normalizeDomain,
7
6
  parseCookieHeader,
8
7
  readCookieJar,
9
8
  runClipCookiesImport,
@@ -12,7 +11,7 @@ import {
12
11
  runClipCookiesSet,
13
12
  serializeNetscapeCookies,
14
13
  summarizeCookies
15
- } from "./chunk-QFUD3I7W.js";
14
+ } from "./chunk-QPVGA46P.js";
16
15
  import "./chunk-MLOITAK6.js";
17
16
  import "./chunk-ULKGDBAJ.js";
18
17
  import "./chunk-6D3QLMRM.js";
@@ -22,7 +21,6 @@ import "./chunk-XQZUX7OT.js";
22
21
  export {
23
22
  clipCookiesFile,
24
23
  mergeCookies,
25
- normalizeDomain,
26
24
  parseCookieHeader,
27
25
  readCookieJar,
28
26
  runClipCookiesImport,
@@ -7,14 +7,14 @@ import {
7
7
  } from "./chunk-D5SBKLDX.js";
8
8
  import {
9
9
  extractWebClip
10
- } from "./chunk-6AZT4ARG.js";
10
+ } from "./chunk-R2CGNGOT.js";
11
11
  import {
12
12
  loadBrowserCookies
13
13
  } from "./chunk-ULKGDBAJ.js";
14
14
  import {
15
15
  DOUBAN_HOST_RE,
16
16
  downloadWebImages
17
- } from "./chunk-TILRKKRN.js";
17
+ } from "./chunk-MKEL2KNU.js";
18
18
  import "./chunk-2LW76QIL.js";
19
19
  import "./chunk-PTFGE4KS.js";
20
20
  import "./chunk-PJDD4R46.js";
@@ -31,8 +31,8 @@ import {
31
31
  import "./chunk-QZQRG3JY.js";
32
32
  import {
33
33
  composeClipMarkdown
34
- } from "./chunk-FIQYJ6KZ.js";
35
- import "./chunk-XMMTGPZ6.js";
34
+ } from "./chunk-LLAXR5EG.js";
35
+ import "./chunk-AZ43P73A.js";
36
36
  import {
37
37
  unwrapRedirectUrl
38
38
  } from "./chunk-URYABAYN.js";
@@ -13,8 +13,8 @@ import {
13
13
  } from "./chunk-QZQRG3JY.js";
14
14
  import {
15
15
  composeClipMarkdown
16
- } from "./chunk-FIQYJ6KZ.js";
17
- import "./chunk-XMMTGPZ6.js";
16
+ } from "./chunk-LLAXR5EG.js";
17
+ import "./chunk-AZ43P73A.js";
18
18
  import "./chunk-URYABAYN.js";
19
19
  import {
20
20
  clipEngineConfig
@@ -5,11 +5,12 @@ import {
5
5
  assertDouyinUrl
6
6
  } from "./chunk-ABYPGMDC.js";
7
7
  import {
8
+ currentVideoByteBudget,
8
9
  loadCookieHeader
9
- } from "./chunk-FGQRYB7F.js";
10
+ } from "./chunk-MZMOE3RX.js";
10
11
  import {
11
12
  buildVideoMarkdown
12
- } from "./chunk-GTDX2LIJ.js";
13
+ } from "./chunk-RSSEVU2F.js";
13
14
  import {
14
15
  summarizeImageFailures
15
16
  } from "./chunk-5KU25TMX.js";
@@ -19,8 +20,8 @@ import {
19
20
  } from "./chunk-QZQRG3JY.js";
20
21
  import {
21
22
  composeClipMarkdown
22
- } from "./chunk-FIQYJ6KZ.js";
23
- import "./chunk-XMMTGPZ6.js";
23
+ } from "./chunk-LLAXR5EG.js";
24
+ import "./chunk-AZ43P73A.js";
24
25
  import "./chunk-URYABAYN.js";
25
26
  import {
26
27
  clipEngineConfig,
@@ -64,6 +65,60 @@ async function downloadDouyinVideo(input) {
64
65
  type: "video"
65
66
  };
66
67
  }
68
+ var DOUYIN_RATIO_LADDER = ["720p", "540p"];
69
+ function douyinRatioVariants(videoUrl) {
70
+ let url;
71
+ try {
72
+ url = new URL(videoUrl);
73
+ } catch {
74
+ return null;
75
+ }
76
+ if (!/\/aweme\/v1\/play\/?$/.test(url.pathname) || !url.searchParams.has("ratio")) return null;
77
+ return DOUYIN_RATIO_LADDER.map((ratio) => {
78
+ const variant = new URL(url);
79
+ variant.searchParams.set("ratio", ratio);
80
+ return variant.toString();
81
+ });
82
+ }
83
+ async function probeDouyinVideoBytes(input) {
84
+ const fetcher = input.fetcher ?? fetch;
85
+ const controller = new AbortController();
86
+ const timer = setTimeout(() => controller.abort(), input.timeoutMs ?? 15e3);
87
+ try {
88
+ const response = await fetcher(input.videoUrl, {
89
+ headers: {
90
+ Accept: "*/*",
91
+ Range: "bytes=0-0",
92
+ Referer: "https://www.douyin.com/",
93
+ "User-Agent": MOBILE_UA,
94
+ ...input.cookieHeader ? { Cookie: input.cookieHeader } : {}
95
+ },
96
+ redirect: "follow",
97
+ signal: controller.signal
98
+ });
99
+ await response.body?.cancel().catch(() => void 0);
100
+ if (!response.ok) return void 0;
101
+ const total = /\/(\d+)\s*$/.exec(response.headers.get("content-range") ?? "")?.[1];
102
+ const bytes = Number.parseInt(total ?? (response.status === 200 ? response.headers.get("content-length") ?? "" : ""), 10);
103
+ return Number.isFinite(bytes) && bytes > 0 ? bytes : void 0;
104
+ } catch {
105
+ return void 0;
106
+ } finally {
107
+ clearTimeout(timer);
108
+ }
109
+ }
110
+ async function pickDouyinVideoUrl(input) {
111
+ const variants = douyinRatioVariants(input.videoUrl);
112
+ if (!variants) return { fits: true, videoUrl: input.videoUrl };
113
+ let smallest;
114
+ for (const videoUrl of variants) {
115
+ const bytes = await probeDouyinVideoBytes({ ...input, videoUrl });
116
+ if (bytes === void 0) continue;
117
+ if (bytes <= input.budgetBytes) return { bytes, fits: true, videoUrl };
118
+ if (!smallest || bytes < smallest.bytes) smallest = { bytes, videoUrl };
119
+ }
120
+ return smallest ? { ...smallest, fits: false } : { fits: true, videoUrl: input.videoUrl };
121
+ }
67
122
  async function fetchDouyinVideo(input) {
68
123
  const fetcher = input.fetcher ?? fetch;
69
124
  const controller = new AbortController();
@@ -286,12 +341,23 @@ function nonPostPageKind(rawUrl) {
286
341
  try {
287
342
  const parsed = new URL(rawUrl);
288
343
  if (/^live\.douyin\.com$/i.test(parsed.hostname) || /(^|\.)webcast\.amemv\.com$/i.test(parsed.hostname)) return "live room";
344
+ if (isDouyinPlacePage(parsed)) return "place";
345
+ if (isDouyinAiNotePage(parsed)) return "Douyin AI note";
289
346
  if (!/(^|\.)(?:iesdouyin|douyin)\.com$/i.test(parsed.hostname)) return null;
290
347
  return NON_POST_PAGES.find((page) => page.path.test(parsed.pathname))?.kind ?? null;
291
348
  } catch {
292
349
  return null;
293
350
  }
294
351
  }
352
+ function isDouyinPlacePage(parsed) {
353
+ const host = parsed.hostname;
354
+ const path = parsed.pathname;
355
+ if (/(^|\.)(?:iesdouyin|douyin)\.com$/i.test(host) && /^\/(?:share\/)?poi\//.test(path)) return true;
356
+ return /(^|\.)snssdk\.com$/i.test(host) && /(?:\/falcon\/)?poi(?:_mwa\/|_detail|\/)/i.test(path);
357
+ }
358
+ function isDouyinAiNotePage(parsed) {
359
+ return /(^|\.)so-landing\.douyin\.com$/i.test(parsed.hostname) && /\/ai_douyin\/ai_note_share\/?$/i.test(parsed.pathname);
360
+ }
295
361
  function stripQuery(rawUrl) {
296
362
  try {
297
363
  const parsed = new URL(rawUrl);
@@ -486,7 +552,8 @@ async function extractDouyinClip(inputUrl, ctx) {
486
552
  },
487
553
  { site: "Douyin" }
488
554
  );
489
- const video = await downloadVideo(ctx.workDir, metadata.videoUrl, cookieHeader);
555
+ const videoUrl = await budgetedVideoUrl(metadata.videoUrl, cookieHeader);
556
+ const video = videoUrl ? await downloadVideo(ctx.workDir, videoUrl, cookieHeader) : null;
490
557
  logInfo("douyin.runner", "extract.ok", { primaryVideo: Boolean(video), title: metadata.title });
491
558
  return {
492
559
  author: metadata.author,
@@ -561,6 +628,25 @@ async function downloadVideo(workDir, videoUrl, cookieHeader, fileName) {
561
628
  return null;
562
629
  }
563
630
  }
631
+ async function budgetedVideoUrl(videoUrl, cookieHeader) {
632
+ const budget = currentVideoByteBudget();
633
+ if (!budget || !videoUrl) return videoUrl;
634
+ const pick = await pickDouyinVideoUrl({ budgetBytes: budget.bytes, cookieHeader, videoUrl });
635
+ if (pick.videoUrl !== videoUrl || !pick.fits) {
636
+ logInfo("douyin.runner", "video.format.budgeted", {
637
+ budgetBytes: budget.bytes,
638
+ bytes: pick.bytes,
639
+ fits: pick.fits,
640
+ measured: budget.measured,
641
+ videoUrl: pick.videoUrl
642
+ });
643
+ }
644
+ if (!pick.fits && budget.measured) {
645
+ logWarn("douyin.runner", "video.skipped", { reason: "over-upload-budget", url: videoUrl });
646
+ return null;
647
+ }
648
+ return pick.videoUrl;
649
+ }
564
650
  export {
565
651
  extractDouyinClip
566
652
  };
@@ -2,11 +2,11 @@ import { createRequire as __dinoxCreateRequire } from 'node:module';
2
2
  const require = __dinoxCreateRequire(import.meta.url);
3
3
  import {
4
4
  ensureDaemonRunning
5
- } from "./chunk-MDWXLRRN.js";
6
- import "./chunk-4GM3PRSK.js";
7
- import "./chunk-CHGKDZV6.js";
8
- import "./chunk-BKCNERPB.js";
9
- import "./chunk-QFSMFANX.js";
5
+ } from "./chunk-KJBN7TD7.js";
6
+ import "./chunk-ARBWJ3ZA.js";
7
+ import "./chunk-WABL3OUP.js";
8
+ import "./chunk-2DREJFKB.js";
9
+ import "./chunk-SM2QOO45.js";
10
10
  import "./chunk-7ODU7LXP.js";
11
11
  import "./chunk-WMJXAF3X.js";
12
12
  import "./chunk-6D3QLMRM.js";
@@ -3,9 +3,9 @@ const require = __dinoxCreateRequire(import.meta.url);
3
3
  import {
4
4
  executeCommandLine,
5
5
  runCapturedInProcess
6
- } from "./chunk-W4EWLODY.js";
7
- import "./chunk-CHGKDZV6.js";
8
- import "./chunk-QFSMFANX.js";
6
+ } from "./chunk-N2VYTZWU.js";
7
+ import "./chunk-WABL3OUP.js";
8
+ import "./chunk-SM2QOO45.js";
9
9
  import "./chunk-WMJXAF3X.js";
10
10
  import "./chunk-6D3QLMRM.js";
11
11
  import "./chunk-XZLFMJOG.js";
@@ -21,8 +21,8 @@ import {
21
21
  } from "./chunk-QZQRG3JY.js";
22
22
  import {
23
23
  composeClipMarkdown
24
- } from "./chunk-FIQYJ6KZ.js";
25
- import "./chunk-XMMTGPZ6.js";
24
+ } from "./chunk-LLAXR5EG.js";
25
+ import "./chunk-AZ43P73A.js";
26
26
  import "./chunk-URYABAYN.js";
27
27
  import {
28
28
  clipEngineConfig,
@@ -11,8 +11,8 @@ import {
11
11
  } from "./chunk-W7R5JTSA.js";
12
12
  import {
13
13
  composeClipMarkdown
14
- } from "./chunk-FIQYJ6KZ.js";
15
- import "./chunk-XMMTGPZ6.js";
14
+ } from "./chunk-LLAXR5EG.js";
15
+ import "./chunk-AZ43P73A.js";
16
16
  import "./chunk-URYABAYN.js";
17
17
  import {
18
18
  clipEngineConfig
@@ -6,8 +6,8 @@ import {
6
6
  } from "./chunk-2M7RJATW.js";
7
7
  import {
8
8
  composeClipMarkdown
9
- } from "./chunk-FIQYJ6KZ.js";
10
- import "./chunk-XMMTGPZ6.js";
9
+ } from "./chunk-LLAXR5EG.js";
10
+ import "./chunk-AZ43P73A.js";
11
11
  import "./chunk-URYABAYN.js";
12
12
  import "./chunk-AHRCI2RW.js";
13
13
  import "./chunk-6VMHHE5Y.js";
@@ -22,8 +22,8 @@ import {
22
22
  } from "./chunk-QZQRG3JY.js";
23
23
  import {
24
24
  composeClipMarkdown
25
- } from "./chunk-FIQYJ6KZ.js";
26
- import "./chunk-XMMTGPZ6.js";
25
+ } from "./chunk-LLAXR5EG.js";
26
+ import "./chunk-AZ43P73A.js";
27
27
  import "./chunk-URYABAYN.js";
28
28
  import {
29
29
  clipEngineConfig,
@@ -25,7 +25,6 @@ import { promisify } from "node:util";
25
25
  var DSH_PLUGIN_PACKAGE = "dinox-editor-dsh";
26
26
  var DSH_APP_CLI = "/Applications/DeepSeek Harness.app/Contents/Resources/runtime/cli/bin/dsh";
27
27
  var run = promisify(execFile);
28
- var EDITOR_HOSTS = ["dsh"];
29
28
  function pluginDir(root = editorPackageRoot()) {
30
29
  return path.join(root, "dist", "dsh-plugin");
31
30
  }
@@ -293,7 +292,6 @@ function editorStatus(options = {}) {
293
292
  }
294
293
  export {
295
294
  DSH_PLUGIN_PACKAGE,
296
- EDITOR_HOSTS,
297
295
  dshInvocation,
298
296
  editorStatus,
299
297
  findDshCli,
@@ -7,11 +7,11 @@ import {
7
7
  } from "./chunk-67RXND3H.js";
8
8
  import {
9
9
  extractWebClip
10
- } from "./chunk-6AZT4ARG.js";
10
+ } from "./chunk-R2CGNGOT.js";
11
11
  import "./chunk-ULKGDBAJ.js";
12
12
  import {
13
13
  downloadWebImages
14
- } from "./chunk-TILRKKRN.js";
14
+ } from "./chunk-MKEL2KNU.js";
15
15
  import "./chunk-2LW76QIL.js";
16
16
  import "./chunk-PTFGE4KS.js";
17
17
  import "./chunk-PJDD4R46.js";
@@ -27,8 +27,8 @@ import {
27
27
  import "./chunk-QZQRG3JY.js";
28
28
  import {
29
29
  composeClipMarkdown
30
- } from "./chunk-FIQYJ6KZ.js";
31
- import "./chunk-XMMTGPZ6.js";
30
+ } from "./chunk-LLAXR5EG.js";
31
+ import "./chunk-AZ43P73A.js";
32
32
  import "./chunk-URYABAYN.js";
33
33
  import {
34
34
  clipEngineConfig
@@ -1,11 +1,12 @@
1
1
  import { createRequire as __dinoxCreateRequire } from 'node:module';
2
2
  const require = __dinoxCreateRequire(import.meta.url);
3
3
  import {
4
+ TASK_STATUS_VALUES,
4
5
  formatTodoList
5
- } from "./chunk-BKCNERPB.js";
6
+ } from "./chunk-2DREJFKB.js";
6
7
  import {
7
8
  sendDaemonRequest
8
- } from "./chunk-QFSMFANX.js";
9
+ } from "./chunk-SM2QOO45.js";
9
10
  import {
10
11
  editorPackageRoot
11
12
  } from "./chunk-7A5QISPG.js";
@@ -163,12 +164,13 @@ function createEditorMcpServer(options = {}) {
163
164
  }
164
165
  });
165
166
  const priority = z.enum(["high", "medium", "low", "none"]);
167
+ const taskStatus = z.enum(TASK_STATUS_VALUES);
166
168
  const date = z.string().regex(/^\d{4}-\d{2}-\d{2}$/);
167
169
  registerAppTool(server, "dinox_todo_open", {
168
170
  title: "Show Dinox tasks",
169
- description: "Show the user's tasks (checklist items from all their Dinox notes) as a list in the editor panel, where they can check them off, set priorities and due dates, and jump to the note a task lives in. Returns the listed tasks with their ids. Filters left out show every open task.",
171
+ description: "Show the user's tasks (checklist items from all their Dinox notes) as a list in the editor panel, where they can check them off, set priorities and due dates, and jump to the note a task lives in. Returns the listed tasks with their ids. Filters left out keep the panel's current ones (at first: open tasks, i.e. backlog, todo and in_progress).",
170
172
  inputSchema: {
171
- status: z.enum(["uncompleted", "completed", "all"]).optional().describe("Default uncompleted"),
173
+ status: z.array(taskStatus).max(5).optional().describe("Statuses to show; [] shows every status"),
172
174
  query: z.string().max(500).optional().describe("Words in the task text or its note title"),
173
175
  tags: z.array(z.string().max(100)).max(20).optional().describe("Tags on the task or its note, without #"),
174
176
  priority: z.array(priority).max(4).optional(),
@@ -195,12 +197,12 @@ function createEditorMcpServer(options = {}) {
195
197
  });
196
198
  server.registerTool("dinox_todo_update", {
197
199
  title: "Update Dinox tasks",
198
- description: "Check off, reopen, reword, prioritize or reschedule tasks by their task id (from dinox_todo_open). Checking a task also checks its subtasks; reopening one also reopens its checked parents. The panel shows the result.",
200
+ description: "Set the status of, reword, prioritize or reschedule tasks by their task id (from dinox_todo_open). Statuses: backlog (deferred), todo, in_progress, done, cancelled. Closing a task (done or cancelled) closes its open subtasks the same way; reopening one reopens its closed parents as todo. The panel shows the result.",
199
201
  inputSchema: {
200
202
  updates: z.array(z.object({
201
203
  taskId: z.string().describe("Task id"),
202
204
  noteId: z.string().optional().describe("The note the task is in, when known"),
203
- checked: z.boolean().optional(),
205
+ status: taskStatus.optional(),
204
206
  priority: priority.nullable().optional().describe("none or null clears it"),
205
207
  due: due.nullable().optional().describe("null clears the due date"),
206
208
  text: z.string().min(1).max(2e3).optional().describe("New task words, #tags written in place; only the changed part is rewritten, formatting elsewhere stays")
@@ -267,7 +269,7 @@ function createEditorMcpServer(options = {}) {
267
269
  return server;
268
270
  }
269
271
  async function serveEditorMcpOverStdio(options = {}) {
270
- const { ensureDaemonRunning } = await import("./ensure-E3DIRHSQ.js");
272
+ const { ensureDaemonRunning } = await import("./ensure-MPOQ244L.js");
271
273
  let ensured = null;
272
274
  const ensure = () => ensured ??= ensureDaemonRunning().finally(() => {
273
275
  ensured = null;
@@ -291,7 +293,5 @@ export {
291
293
  EDITOR_RESOURCE_URI,
292
294
  EDITOR_SESSION_META_KEY,
293
295
  createEditorMcpServer,
294
- formatRead,
295
- readEditorAppHtml,
296
296
  serveEditorMcpOverStdio
297
297
  };
@@ -3,9 +3,9 @@ const require = __dinoxCreateRequire(import.meta.url);
3
3
  import {
4
4
  MCP_COMMAND_GROUPS,
5
5
  listCommandSchemas
6
- } from "./chunk-7MGDG5BW.js";
7
- import "./chunk-MDWXLRRN.js";
8
- import "./chunk-D3CETVY5.js";
6
+ } from "./chunk-NVKSI4BD.js";
7
+ import "./chunk-KJBN7TD7.js";
8
+ import "./chunk-HG3RZFDX.js";
9
9
  import "./chunk-BZQYECIH.js";
10
10
  import {
11
11
  DINOX_MCP_SERVER_NAME,
@@ -14,15 +14,17 @@ import {
14
14
  GATEWAY_SESSION_CWD_ENV,
15
15
  GATEWAY_SESSION_TOKEN_ENV,
16
16
  READ_CONVERSATION_MAX_LIMIT
17
- } from "./chunk-4GM3PRSK.js";
18
- import "./chunk-W4EWLODY.js";
17
+ } from "./chunk-ARBWJ3ZA.js";
18
+ import "./chunk-N2VYTZWU.js";
19
19
  import {
20
20
  tryForwardToDaemon
21
- } from "./chunk-CHGKDZV6.js";
22
- import "./chunk-BKCNERPB.js";
21
+ } from "./chunk-WABL3OUP.js";
22
+ import {
23
+ TASK_STATUS_VALUES
24
+ } from "./chunk-2DREJFKB.js";
23
25
  import {
24
26
  sendDaemonRequest
25
- } from "./chunk-QFSMFANX.js";
27
+ } from "./chunk-SM2QOO45.js";
26
28
  import "./chunk-7ODU7LXP.js";
27
29
  import {
28
30
  getPackageVersion
@@ -62,7 +64,7 @@ function createCliCommandRunner(overrides = {}) {
62
64
  noticeProvider: null,
63
65
  cwd: process.cwd()
64
66
  };
65
- const { printCliError } = await import("./runCli-ZJ7WYHJ7.js");
67
+ const { printCliError } = await import("./runCli-QEWWUIZN.js");
66
68
  const code = requestContext.run(context, () => printCliError(error, argv));
67
69
  throw Object.assign(new Error(`Command failed with exit code ${code}`), {
68
70
  code,
@@ -346,7 +348,7 @@ function registerKnowledgeTools(server, call) {
346
348
  description: "Search the user's Dinox todo items.",
347
349
  inputSchema: {
348
350
  query: z2.string().describe("Keywords; empty string lists all"),
349
- status: z2.enum(["all", "completed", "uncompleted"]).optional(),
351
+ status: z2.array(z2.enum(TASK_STATUS_VALUES)).optional().describe("Statuses to keep; omit for every status"),
350
352
  limit: z2.number().int().min(1).max(MAX_RESULTS).optional()
351
353
  }
352
354
  },
@@ -355,7 +357,7 @@ function registerKnowledgeTools(server, call) {
355
357
  const result = await call("todo.search", {
356
358
  query,
357
359
  includeDeleted: false,
358
- taskStatus: status ?? "uncompleted",
360
+ taskStatus: status ?? [],
359
361
  taskTagFilter: [],
360
362
  limit: limit ?? 20,
361
363
  scanLimit: 500
@@ -6,8 +6,8 @@ import {
6
6
  } from "./chunk-X7IZXCSL.js";
7
7
  import {
8
8
  composeClipMarkdown
9
- } from "./chunk-FIQYJ6KZ.js";
10
- import "./chunk-XMMTGPZ6.js";
9
+ } from "./chunk-LLAXR5EG.js";
10
+ import "./chunk-AZ43P73A.js";
11
11
  import "./chunk-URYABAYN.js";
12
12
  import "./chunk-AHRCI2RW.js";
13
13
  import "./chunk-6VMHHE5Y.js";