@lichao0223/lobehub-cli 0.0.79 → 0.0.81

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/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { createRequire } from "node:module";
3
3
  import crypto$1, { X509Certificate, createHash, randomBytes, randomUUID, sign } from "node:crypto";
4
4
  import * as fs$5 from "node:fs";
5
- import fs, { appendFileSync, closeSync, constants, createReadStream, createWriteStream, existsSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, readdirSync, readlinkSync, realpathSync, rmSync, statSync, symlinkSync, unlink, writeFileSync } from "node:fs";
5
+ import fs, { appendFileSync, closeSync, constants, createReadStream, createWriteStream, existsSync, fstatSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, readdirSync, readlinkSync, realpathSync, rmSync, statSync, symlinkSync, unlink, writeFileSync } from "node:fs";
6
6
  import * as os$4 from "node:os";
7
7
  import os, { EOL, constants as constants$1, homedir, platform, tmpdir } from "node:os";
8
8
  import * as path$4 from "node:path";
@@ -24140,7 +24140,7 @@ const GOMS_KLM_TIMING_SECONDS = {
24140
24140
  };
24141
24141
 
24142
24142
  //#endregion
24143
- //#region node_modules/.pnpm/@trpc+server@11.28.3_@types+ws@8.18.2_typescript@6.0.3/node_modules/@trpc/server/dist/observable-CodTG6Sf.mjs
24143
+ //#region node_modules/.pnpm/@trpc+server@11.29.2_@types+ws@8.18.2_typescript@6.0.3/node_modules/@trpc/server/dist/observable-CodTG6Sf.mjs
24144
24144
  /**
24145
24145
  * Creates an observable. `subscribe` runs for each subscriber, and can
24146
24146
  * return a function that cleans up when it unsubscribes.
@@ -24366,7 +24366,7 @@ function observableToAsyncIterable(observable, signal) {
24366
24366
  }
24367
24367
 
24368
24368
  //#endregion
24369
- //#region node_modules/.pnpm/@trpc+server@11.28.3_@types+ws@8.18.2_typescript@6.0.3/node_modules/@trpc/server/dist/observable-BjUZYMQq.mjs
24369
+ //#region node_modules/.pnpm/@trpc+server@11.29.2_@types+ws@8.18.2_typescript@6.0.3/node_modules/@trpc/server/dist/observable-BjUZYMQq.mjs
24370
24370
  /**
24371
24371
  * Shares one subscription to the source between all subscribers. It
24372
24372
  * starts with the first subscriber and ends when the last unsubscribes.
@@ -24492,7 +24492,7 @@ function behaviorSubject(initialValue) {
24492
24492
  }
24493
24493
 
24494
24494
  //#endregion
24495
- //#region node_modules/.pnpm/@trpc+client@11.28.3_@trpc+server@11.28.3_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/splitLink-PFsRy7Mf.mjs
24495
+ //#region node_modules/.pnpm/@trpc+client@11.29.2_@trpc+server@11.29.2_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/splitLink-PFsRy7Mf.mjs
24496
24496
  /** @internal */
24497
24497
  function createChain(opts) {
24498
24498
  return observable$1((observer) => {
@@ -24511,7 +24511,7 @@ function createChain(opts) {
24511
24511
  }
24512
24512
 
24513
24513
  //#endregion
24514
- //#region node_modules/.pnpm/@trpc+client@11.28.3_@trpc+server@11.28.3_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/objectSpread2-pyA4QVO4.mjs
24514
+ //#region node_modules/.pnpm/@trpc+client@11.29.2_@trpc+server@11.29.2_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/objectSpread2-pyA4QVO4.mjs
24515
24515
  function _typeof$1(o) {
24516
24516
  "@babel/helpers - typeof";
24517
24517
  return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -24565,7 +24565,7 @@ function _objectSpread2$1(e) {
24565
24565
  }
24566
24566
 
24567
24567
  //#endregion
24568
- //#region node_modules/.pnpm/@trpc+server@11.28.3_@types+ws@8.18.2_typescript@6.0.3/node_modules/@trpc/server/dist/codes-BCsCCyMj.mjs
24568
+ //#region node_modules/.pnpm/@trpc+server@11.29.2_@types+ws@8.18.2_typescript@6.0.3/node_modules/@trpc/server/dist/codes-BCsCCyMj.mjs
24569
24569
  /**
24570
24570
  * Check that value is object
24571
24571
  * @internal
@@ -24628,7 +24628,7 @@ const retryableRpcCodes = [
24628
24628
  ];
24629
24629
 
24630
24630
  //#endregion
24631
- //#region node_modules/.pnpm/@trpc+server@11.28.3_@types+ws@8.18.2_typescript@6.0.3/node_modules/@trpc/server/dist/getErrorShape-CVrl8_-w.mjs
24631
+ //#region node_modules/.pnpm/@trpc+server@11.29.2_@types+ws@8.18.2_typescript@6.0.3/node_modules/@trpc/server/dist/getErrorShape-CVrl8_-w.mjs
24632
24632
  const noop$4 = () => {};
24633
24633
  const freezeIfAvailable = (obj) => {
24634
24634
  if (Object.freeze) Object.freeze(obj);
@@ -24733,7 +24733,7 @@ function _objectSpread2(e) {
24733
24733
  }
24734
24734
 
24735
24735
  //#endregion
24736
- //#region node_modules/.pnpm/@trpc+server@11.28.3_@types+ws@8.18.2_typescript@6.0.3/node_modules/@trpc/server/dist/asyncGeneratorDelegate-BRQGtkYG.mjs
24736
+ //#region node_modules/.pnpm/@trpc+server@11.29.2_@types+ws@8.18.2_typescript@6.0.3/node_modules/@trpc/server/dist/asyncGeneratorDelegate-Bmz6asKS.mjs
24737
24737
  /** @internal */
24738
24738
  function transformResultInner(response, transformer) {
24739
24739
  if ("error" in response) {
@@ -24839,7 +24839,7 @@ AsyncGenerator$1.prototype["function" == typeof Symbol && Symbol.asyncIterator |
24839
24839
  };
24840
24840
 
24841
24841
  //#endregion
24842
- //#region node_modules/.pnpm/@trpc+client@11.28.3_@trpc+server@11.28.3_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/TRPCClientError-DE6-fd1n.mjs
24842
+ //#region node_modules/.pnpm/@trpc+client@11.29.2_@trpc+server@11.29.2_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/TRPCClientError-DE6-fd1n.mjs
24843
24843
  /**
24844
24844
  * Whether a value is a `TRPCClientError`, typed for a router or procedure.
24845
24845
  * @see https://trpc.io/docs/client/vanilla/error-handling#catching-a-thrown-error
@@ -24895,7 +24895,7 @@ var TRPCClientError = class TRPCClientError extends Error {
24895
24895
  };
24896
24896
 
24897
24897
  //#endregion
24898
- //#region node_modules/.pnpm/@trpc+client@11.28.3_@trpc+server@11.28.3_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/unstable-internals.mjs
24898
+ //#region node_modules/.pnpm/@trpc+client@11.29.2_@trpc+server@11.29.2_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/unstable-internals.mjs
24899
24899
  /**
24900
24900
  * @internal
24901
24901
  */
@@ -24922,7 +24922,7 @@ function getTransformer(transformer) {
24922
24922
  }
24923
24923
 
24924
24924
  //#endregion
24925
- //#region node_modules/.pnpm/@trpc+client@11.28.3_@trpc+server@11.28.3_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/httpUtils-CtMuyl9j.mjs
24925
+ //#region node_modules/.pnpm/@trpc+client@11.29.2_@trpc+server@11.29.2_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/httpUtils-CtMuyl9j.mjs
24926
24926
  const isFunction$1 = (fn) => typeof fn === "function";
24927
24927
  /**
24928
24928
  * The `fetch` to use: `customFetchImpl` if given, or else the global one.
@@ -25058,7 +25058,7 @@ async function httpRequest(opts) {
25058
25058
  }
25059
25059
 
25060
25060
  //#endregion
25061
- //#region node_modules/.pnpm/@trpc+client@11.28.3_@trpc+server@11.28.3_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/httpLink-B4UwXApa.mjs
25061
+ //#region node_modules/.pnpm/@trpc+client@11.29.2_@trpc+server@11.29.2_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/httpLink-B4UwXApa.mjs
25062
25062
  /** Whether an input is binary: a `Uint8Array`, `Blob` or `File`. */
25063
25063
  function isOctetType(input) {
25064
25064
  return input instanceof Uint8Array || input instanceof Blob;
@@ -25151,7 +25151,7 @@ function httpLink(opts) {
25151
25151
  }
25152
25152
 
25153
25153
  //#endregion
25154
- //#region node_modules/.pnpm/@trpc+client@11.28.3_@trpc+server@11.28.3_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/wsLink-BiIe_j6D.mjs
25154
+ //#region node_modules/.pnpm/@trpc+client@11.29.2_@trpc+server@11.29.2_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/wsLink-BiIe_j6D.mjs
25155
25155
  /**
25156
25156
  * Get the result of a value or function that returns a value
25157
25157
  * It also optionally accepts typesafe arguments for the function
@@ -25341,7 +25341,7 @@ var WsConnection = class WsConnection {
25341
25341
  _defineProperty$1(WsConnection, "connectCount", 0);
25342
25342
 
25343
25343
  //#endregion
25344
- //#region node_modules/.pnpm/@trpc+client@11.28.3_@trpc+server@11.28.3_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/index.mjs
25344
+ //#region node_modules/.pnpm/@trpc+client@11.29.2_@trpc+server@11.29.2_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/index.mjs
25345
25345
  const observerKeys = [
25346
25346
  "onStarted",
25347
25347
  "onData",
@@ -26486,7 +26486,7 @@ const cliVersion = pkg.version;
26486
26486
  const cliNodeEngine = pkg.engines?.node;
26487
26487
 
26488
26488
  //#endregion
26489
- //#region ../../node_modules/.pnpm/@trpc+server@11.28.3_@types+aws-lambda@8.10.164_@types+express@5.0.6_@types+ws@8.18.2_n_4faacf2dd8c5d7e32e12b289867122f6/node_modules/@trpc/server/dist/observable-CodTG6Sf.mjs
26489
+ //#region ../../node_modules/.pnpm/@trpc+server@11.29.1_@types+aws-lambda@8.10.164_@types+express@5.0.6_@types+ws@8.18.2_n_6bc90261635995e5d07c47f37b0d7078/node_modules/@trpc/server/dist/observable-CodTG6Sf.mjs
26490
26490
  /**
26491
26491
  * Creates an observable. `subscribe` runs for each subscriber, and can
26492
26492
  * return a function that cleans up when it unsubscribes.
@@ -27100,7 +27100,16 @@ function printKanban(columns) {
27100
27100
  }).join(" ");
27101
27101
  console.log(bottomBorder);
27102
27102
  }
27103
+ /**
27104
+ * Ask a `(y/N)` question on the terminal.
27105
+ *
27106
+ * Without a terminal there is nobody to answer: an agent's shell, a pipe or CI
27107
+ * either never closes stdin (the command hangs until it is killed) or closes it
27108
+ * empty (the action is silently cancelled). Fail loudly instead, so the caller
27109
+ * learns it has to pass `--yes`.
27110
+ */
27103
27111
  function confirm(message) {
27112
+ if (!process.stdin.isTTY) return Promise.reject(/* @__PURE__ */ new Error(`${message}\nRefusing to continue without an interactive terminal to confirm. Re-run with --yes to skip the prompt.`));
27104
27113
  const rl = createInterface({
27105
27114
  input: process.stdin,
27106
27115
  output: process.stderr
@@ -31875,6 +31884,70 @@ _Mime_extensionToType = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtension = /
31875
31884
  //#region node_modules/.pnpm/mime@4.1.2/node_modules/mime/dist/src/index.js
31876
31885
  var src_default = new Mime(types$1, types$2)._freeze();
31877
31886
 
31887
+ //#endregion
31888
+ //#region ../../packages/utils/src/detectUtf16.ts
31889
+ var HEURISTIC_SAMPLE_BYTES, HEURISTIC_THRESHOLD, detectUtf16NoBom;
31890
+ var init_detectUtf16 = __esmMin((() => {
31891
+ HEURISTIC_SAMPLE_BYTES = 512;
31892
+ HEURISTIC_THRESHOLD = .3;
31893
+ detectUtf16NoBom = (buffer) => {
31894
+ const sample = buffer.subarray(0, Math.min(HEURISTIC_SAMPLE_BYTES, buffer.length));
31895
+ if (sample.length < 4 || sample.length % 2 !== 0) return null;
31896
+ let leAsciiPairs = 0;
31897
+ let beAsciiPairs = 0;
31898
+ const totalPairs = sample.length / 2;
31899
+ for (let i = 0; i < sample.length; i += 2) {
31900
+ const lo = sample[i];
31901
+ const hi = sample[i + 1];
31902
+ if (hi === 0 && lo !== 0) leAsciiPairs++;
31903
+ else if (lo === 0 && hi !== 0) beAsciiPairs++;
31904
+ }
31905
+ if (leAsciiPairs > beAsciiPairs && leAsciiPairs / totalPairs >= HEURISTIC_THRESHOLD) return "utf-16le";
31906
+ if (beAsciiPairs > leAsciiPairs && beAsciiPairs / totalPairs >= HEURISTIC_THRESHOLD) return "utf-16be";
31907
+ return null;
31908
+ };
31909
+ }));
31910
+
31911
+ //#endregion
31912
+ //#region ../../packages/utils/src/isBinaryContent.ts
31913
+ var NON_PRINTABLE_THRESHOLD, hasUtf8Bom, hasUtf16Bom, sniffBinaryBuffer, REPLACEMENT_CHAR, checkPrintableRatio;
31914
+ var init_isBinaryContent = __esmMin((() => {
31915
+ init_detectUtf16();
31916
+ NON_PRINTABLE_THRESHOLD = .3;
31917
+ hasUtf8Bom = (buf) => buf.length >= 3 && buf[0] === 239 && buf[1] === 187 && buf[2] === 191;
31918
+ hasUtf16Bom = (buf) => buf.length >= 2 && (buf[0] === 255 && buf[1] === 254 || buf[0] === 254 && buf[1] === 255);
31919
+ sniffBinaryBuffer = (buffer) => {
31920
+ if (buffer.length === 0) return { isBinary: false };
31921
+ if (hasUtf8Bom(buffer) || hasUtf16Bom(buffer)) return { isBinary: false };
31922
+ const utf16Variant = detectUtf16NoBom(buffer);
31923
+ if (utf16Variant) return checkPrintableRatio(new TextDecoder(utf16Variant, { fatal: false }).decode(buffer), buffer.length);
31924
+ if (buffer.includes(0)) return {
31925
+ isBinary: true,
31926
+ reason: "contains null byte"
31927
+ };
31928
+ return checkPrintableRatio(new TextDecoder("utf-8", { fatal: false }).decode(buffer), buffer.length);
31929
+ };
31930
+ REPLACEMENT_CHAR = "�";
31931
+ checkPrintableRatio = (text, sampledBytes) => {
31932
+ if (text.length === 0) return { isBinary: false };
31933
+ let suspect = 0;
31934
+ for (const ch of text) {
31935
+ if (ch === REPLACEMENT_CHAR) {
31936
+ suspect++;
31937
+ continue;
31938
+ }
31939
+ const code = ch.codePointAt(0);
31940
+ if (code < 32 && code !== 9 && code !== 10 && code !== 13) suspect++;
31941
+ }
31942
+ const ratio = suspect / text.length;
31943
+ if (ratio > NON_PRINTABLE_THRESHOLD) return {
31944
+ isBinary: true,
31945
+ reason: `${(ratio * 100).toFixed(1)}% non-printable chars in first ${sampledBytes} bytes`
31946
+ };
31947
+ return { isBinary: false };
31948
+ };
31949
+ }));
31950
+
31878
31951
  //#endregion
31879
31952
  //#region node_modules/.pnpm/strtok3@10.8.0/node_modules/strtok3/lib/stream/Errors.js
31880
31953
  var defaultMessages, EndOfStreamError, AbortError$1;
@@ -37234,6 +37307,7 @@ var init_file_type = __esmMin((() => {
37234
37307
 
37235
37308
  //#endregion
37236
37309
  //#region ../../packages/utils/src/mimeType.ts
37310
+ init_isBinaryContent();
37237
37311
  const CUSTOM_MIME_TYPES = {
37238
37312
  ".clj": "text/x-clojure",
37239
37313
  ".ex": "text/x-elixir",
@@ -37259,7 +37333,8 @@ const TEXT_FALLBACK_MIME = "text/plain; charset=utf-8";
37259
37333
  const BINARY_FALLBACK_MIME = "application/octet-stream";
37260
37334
  const TEXT_MIME_PATTERN = /^(?:text\/|application\/(?:ecmascript|graphql|javascript|json|toml|xhtml\+xml|xml|yaml))/;
37261
37335
  const SVG_MIME = "image/svg+xml";
37262
- const withCharset = (mimeType) => TEXT_MIME_PATTERN.test(mimeType) && !mimeType.includes("charset=") ? `${mimeType}; charset=utf-8` : mimeType;
37336
+ const DEFAULT_CHARSET = "utf-8";
37337
+ const withCharset = (mimeType, charset = DEFAULT_CHARSET) => TEXT_MIME_PATTERN.test(mimeType) && !mimeType.includes("charset=") ? `${mimeType}; charset=${charset}` : mimeType;
37263
37338
  const getExtension = (filePath) => {
37264
37339
  const fileName = filePath.replace(/^.*[/\\]/s, "");
37265
37340
  const dotIndex = fileName.lastIndexOf(".");
@@ -37274,6 +37349,32 @@ const looksBinary = (buffer) => {
37274
37349
  return false;
37275
37350
  };
37276
37351
  /**
37352
+ * Detect UTF-16 text marked by a byte order mark.
37353
+ *
37354
+ * The UTF-16LE BOM (0xFF 0xFE) is also a valid MPEG audio frame sync, so
37355
+ * file-type reports Windows PowerShell 5.1 output (`Tee-Object`, `Out-File`)
37356
+ * as audio/mpeg. The BOM alone is not proof: a real MPEG-1 Layer I frame can
37357
+ * start with the same bytes. Decode the bytes after the BOM strictly and
37358
+ * require them to read as text: compressed audio contains unpaired surrogates,
37359
+ * and a lenient decode would turn them into "printable" characters. `stream`
37360
+ * keeps a surrogate pair split by the sample boundary from failing the decode.
37361
+ */
37362
+ const detectUtf16BomText = (buffer) => {
37363
+ if (buffer.byteLength < 2) return null;
37364
+ let charset;
37365
+ if (buffer[0] === 255 && buffer[1] === 254) charset = "utf-16le";
37366
+ else if (buffer[0] === 254 && buffer[1] === 255) charset = "utf-16be";
37367
+ else return null;
37368
+ const sample = buffer.subarray(2, Math.min(buffer.byteLength, SNIFF_BYTES$1));
37369
+ let text;
37370
+ try {
37371
+ text = new TextDecoder(charset, { fatal: true }).decode(sample, { stream: true });
37372
+ } catch {
37373
+ return null;
37374
+ }
37375
+ return sniffBinaryBuffer(new TextEncoder().encode(text)).isBinary ? null : charset;
37376
+ };
37377
+ /**
37277
37378
  * Sync extension-only lookup. Falls back to `application/octet-stream` for
37278
37379
  * unknown extensions. Use this when a file buffer isn't available (URL input,
37279
37380
  * TRPC payload, filename-only records).
@@ -37289,6 +37390,9 @@ const getMimeType = (filePath) => {
37289
37390
  * Trust magic bytes first, then fall back to the extension, and let a text
37290
37391
  * sniff overrule mime-db when the two disagree.
37291
37392
  *
37393
+ * 0. UTF-16 BOM text → text mime with the matching charset, before the
37394
+ * magic-byte check (the UTF-16LE BOM looks like an MPEG audio frame).
37395
+ * Keeps a text extension mime, otherwise falls back to text/plain.
37292
37396
  * 1. `fileTypeFromBuffer()` — magic-byte detection. Authoritative when it
37293
37397
  * matches: real MPEG-TS media wins here regardless of extension. The one
37294
37398
  * exception is a generic `application/xml` match, which yields to the
@@ -37303,9 +37407,14 @@ const getMimeType = (filePath) => {
37303
37407
  * 3. No extension mapping → sniff-based fallback.
37304
37408
  */
37305
37409
  const resolveMimeType = async (filePath, buffer) => {
37410
+ const fromExtension = lookupExtensionMime(filePath);
37411
+ const utf16Charset = detectUtf16BomText(buffer);
37412
+ if (utf16Charset) {
37413
+ if (fromExtension === SVG_MIME) return SVG_MIME;
37414
+ return fromExtension && TEXT_MIME_PATTERN.test(fromExtension) ? withCharset(fromExtension, utf16Charset) : `text/plain; charset=${utf16Charset}`;
37415
+ }
37306
37416
  const { fileTypeFromBuffer } = await Promise.resolve().then(() => (init_file_type(), file_type_exports));
37307
37417
  const detected = await fileTypeFromBuffer(buffer);
37308
- const fromExtension = lookupExtensionMime(filePath);
37309
37418
  if (detected?.mime) {
37310
37419
  if (detected.mime === "application/xml" && fromExtension === SVG_MIME) return SVG_MIME;
37311
37420
  return detected.mime;
@@ -49746,9 +49855,21 @@ function formatFsLongListing(nodes) {
49746
49855
  async function readFsContentInput(options) {
49747
49856
  if (options.contentFile) return readFileSync(options.contentFile, "utf8");
49748
49857
  if (options.content !== void 0) return options.content;
49749
- if (process.stdin.isTTY === false) return text(process.stdin);
49858
+ if (isStdinRedirected()) return text(process.stdin);
49750
49859
  return "";
49751
49860
  }
49861
+ /**
49862
+ * Whether stdin was piped (`echo x | lh …`) or redirected from a file (`< x`).
49863
+ * A terminal, a closed stdin or `/dev/null` (an agent shell) is not input.
49864
+ */
49865
+ function isStdinRedirected() {
49866
+ try {
49867
+ const stat = fstatSync(0);
49868
+ return stat.isFIFO() || stat.isFile();
49869
+ } catch {
49870
+ return false;
49871
+ }
49872
+ }
49752
49873
  async function resolveAgentFsContext(client, options) {
49753
49874
  return {
49754
49875
  agentId: await resolveAgentId$1(client, options),
@@ -74170,7 +74291,8 @@ const spawnCliAgent = async (options, command, cwd, inputPlan, childEnv, codexJw
74170
74291
  if (!live.isOpen) return false;
74171
74292
  const plan = await buildAgentInput("claude-code", prompt, options.inputOptions);
74172
74293
  return live.send(plan.stdin, sendOptions?.uuid);
74173
- }
74294
+ },
74295
+ supportsSteerImageAttachments: true
74174
74296
  },
74175
74297
  kill: (signal = "SIGINT") => {
74176
74298
  killedByUs = true;
@@ -89706,70 +89828,6 @@ var init_fileParseBudget = __esmMin((() => {
89706
89828
  isFileParseBudgetError = (error) => error instanceof FileParseBudgetError || error instanceof Error && error.name === "FileParseBudgetError";
89707
89829
  }));
89708
89830
 
89709
- //#endregion
89710
- //#region ../../packages/utils/src/detectUtf16.ts
89711
- var HEURISTIC_SAMPLE_BYTES, HEURISTIC_THRESHOLD, detectUtf16NoBom;
89712
- var init_detectUtf16 = __esmMin((() => {
89713
- HEURISTIC_SAMPLE_BYTES = 512;
89714
- HEURISTIC_THRESHOLD = .3;
89715
- detectUtf16NoBom = (buffer) => {
89716
- const sample = buffer.subarray(0, Math.min(HEURISTIC_SAMPLE_BYTES, buffer.length));
89717
- if (sample.length < 4 || sample.length % 2 !== 0) return null;
89718
- let leAsciiPairs = 0;
89719
- let beAsciiPairs = 0;
89720
- const totalPairs = sample.length / 2;
89721
- for (let i = 0; i < sample.length; i += 2) {
89722
- const lo = sample[i];
89723
- const hi = sample[i + 1];
89724
- if (hi === 0 && lo !== 0) leAsciiPairs++;
89725
- else if (lo === 0 && hi !== 0) beAsciiPairs++;
89726
- }
89727
- if (leAsciiPairs > beAsciiPairs && leAsciiPairs / totalPairs >= HEURISTIC_THRESHOLD) return "utf-16le";
89728
- if (beAsciiPairs > leAsciiPairs && beAsciiPairs / totalPairs >= HEURISTIC_THRESHOLD) return "utf-16be";
89729
- return null;
89730
- };
89731
- }));
89732
-
89733
- //#endregion
89734
- //#region ../../packages/utils/src/isBinaryContent.ts
89735
- var NON_PRINTABLE_THRESHOLD, hasUtf8Bom, hasUtf16Bom, sniffBinaryBuffer, REPLACEMENT_CHAR, checkPrintableRatio;
89736
- var init_isBinaryContent = __esmMin((() => {
89737
- init_detectUtf16();
89738
- NON_PRINTABLE_THRESHOLD = .3;
89739
- hasUtf8Bom = (buf) => buf.length >= 3 && buf[0] === 239 && buf[1] === 187 && buf[2] === 191;
89740
- hasUtf16Bom = (buf) => buf.length >= 2 && (buf[0] === 255 && buf[1] === 254 || buf[0] === 254 && buf[1] === 255);
89741
- sniffBinaryBuffer = (buffer) => {
89742
- if (buffer.length === 0) return { isBinary: false };
89743
- if (hasUtf8Bom(buffer) || hasUtf16Bom(buffer)) return { isBinary: false };
89744
- const utf16Variant = detectUtf16NoBom(buffer);
89745
- if (utf16Variant) return checkPrintableRatio(new TextDecoder(utf16Variant, { fatal: false }).decode(buffer), buffer.length);
89746
- if (buffer.includes(0)) return {
89747
- isBinary: true,
89748
- reason: "contains null byte"
89749
- };
89750
- return checkPrintableRatio(new TextDecoder("utf-8", { fatal: false }).decode(buffer), buffer.length);
89751
- };
89752
- REPLACEMENT_CHAR = "�";
89753
- checkPrintableRatio = (text, sampledBytes) => {
89754
- if (text.length === 0) return { isBinary: false };
89755
- let suspect = 0;
89756
- for (const ch of text) {
89757
- if (ch === REPLACEMENT_CHAR) {
89758
- suspect++;
89759
- continue;
89760
- }
89761
- const code = ch.codePointAt(0);
89762
- if (code < 32 && code !== 9 && code !== 10 && code !== 13) suspect++;
89763
- }
89764
- const ratio = suspect / text.length;
89765
- if (ratio > NON_PRINTABLE_THRESHOLD) return {
89766
- isBinary: true,
89767
- reason: `${(ratio * 100).toFixed(1)}% non-printable chars in first ${sampledBytes} bytes`
89768
- };
89769
- return { isBinary: false };
89770
- };
89771
- }));
89772
-
89773
89831
  //#endregion
89774
89832
  //#region ../../packages/file-loaders/src/loaders/ipynb/index.ts
89775
89833
  var ipynb_exports = /* @__PURE__ */ __exportAll$2({
@@ -268542,8 +268600,13 @@ var require_tree_kill = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
268542
268600
  var import_tree_kill = /* @__PURE__ */ __toESM$2(require_tree_kill());
268543
268601
  const KILL_SIGNAL = "SIGKILL";
268544
268602
  /**
268545
- * Non-interactive backend: a plain `child_process` with stdin left as an
268546
- * unused pipe and stdout/stderr inherited straight into the output files.
268603
+ * Non-interactive backend: a plain `child_process` with stdin bound to the
268604
+ * null device and stdout/stderr inherited straight into the output files.
268605
+ *
268606
+ * Nothing ever writes to a command's stdin here, so it must not be an open
268607
+ * pipe: a command that reads stdin (a `(y/N)` confirm, `read`, a CLI that falls
268608
+ * back to piped input) would wait on it until the shell timeout. With `ignore`
268609
+ * it reads EOF at once and fails or cancels instead of hanging.
268547
268610
  */
268548
268611
  var ChildProcessBackend = class {
268549
268612
  capabilities = {
@@ -268577,7 +268640,7 @@ var ChildProcessBackend = class {
268577
268640
  env,
268578
268641
  shell: false,
268579
268642
  stdio: [
268580
- "pipe",
268643
+ "ignore",
268581
268644
  outputFiles.stdout.fd,
268582
268645
  outputFiles.stderr.fd
268583
268646
  ],
@@ -579287,7 +579350,7 @@ var WebStandardStreamableHTTPServerTransport = class {
579287
579350
  };
579288
579351
 
579289
579352
  //#endregion
579290
- //#region node_modules/.pnpm/@hono+node-server@2.1.8_hono@4.13.19/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
579353
+ //#region node_modules/.pnpm/@hono+node-server@2.1.9_hono@4.13.19/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
579291
579354
  const X_ALREADY_SENT = "x-hono-already-sent";
579292
579355
 
579293
579356
  //#endregion
@@ -579316,7 +579379,7 @@ const defineWebSocketHelper = (handler) => {
579316
579379
  };
579317
579380
 
579318
579381
  //#endregion
579319
- //#region node_modules/.pnpm/@hono+node-server@2.1.8_hono@4.13.19/node_modules/@hono/node-server/dist/index.mjs
579382
+ //#region node_modules/.pnpm/@hono+node-server@2.1.9_hono@4.13.19/node_modules/@hono/node-server/dist/index.mjs
579320
579383
  var RequestError = class extends Error {
579321
579384
  constructor(message, options) {
579322
579385
  super(message, options);
@@ -579503,7 +579566,11 @@ const toRequestError = (e) => {
579503
579566
  return new RequestError(e.message, { cause: e });
579504
579567
  };
579505
579568
  const GlobalRequest = global.Request;
579506
- var Request$1 = class extends GlobalRequest {
579569
+ var Request$1 = class Request$1 extends GlobalRequest {
579570
+ static [Symbol.hasInstance](instance) {
579571
+ if (this === Request$1) return instance instanceof GlobalRequest || Function.prototype[Symbol.hasInstance].call(this, instance);
579572
+ return Function.prototype[Symbol.hasInstance].call(this, instance);
579573
+ }
579507
579574
  constructor(input, options) {
579508
579575
  if (typeof input === "object" && getRequestCache in input) {
579509
579576
  const hasReplacementBody = options !== void 0 && "body" in options && options.body != null;
@@ -579542,8 +579609,8 @@ const readBodyBufferedBeforeDisconnect = (incoming, chunks) => {
579542
579609
  else if (incomingWithRecovery[bodyBufferedLengthBeforeDisconnectKey] !== void 0 && incoming.readableLength !== incomingWithRecovery[bodyBufferedLengthBeforeDisconnectKey]) result = newBodyUnusableError();
579543
579610
  else {
579544
579611
  const bodyChunks = chunks ?? [];
579545
- const chunk = incoming.read();
579546
- if (chunk !== null) bodyChunks.push(toBufferChunk(chunk, incoming.readableEncoding));
579612
+ let chunk;
579613
+ while ((chunk = incoming.read()) !== null) bodyChunks.push(toBufferChunk(chunk, incoming.readableEncoding));
579547
579614
  const buffer = bodyChunks.length === 1 ? bodyChunks[0] : Buffer.concat(bodyChunks);
579548
579615
  result = buffer;
579549
579616
  const contentLength = incoming.headers["content-length"];
@@ -579880,6 +579947,9 @@ Object.defineProperty(requestPrototype, "blob", { value: function() {
579880
579947
  return new Response(buf, type ? { headers: { "content-type": type } } : void 0).blob();
579881
579948
  });
579882
579949
  } });
579950
+ Object.defineProperty(requestPrototype, "bytes", { value: function() {
579951
+ return this.arrayBuffer().then((buf) => new Uint8Array(buf));
579952
+ } });
579883
579953
  Object.defineProperty(requestPrototype, "json", { value: function() {
579884
579954
  if (this[bodyConsumedDirectlyKey]) return rejectBodyUnusable();
579885
579955
  return this.text().then(JSON.parse);
@@ -579934,6 +580004,10 @@ const GlobalResponse = global.Response;
579934
580004
  var Response$1 = class Response$1 {
579935
580005
  #body;
579936
580006
  #init;
580007
+ static [Symbol.hasInstance](instance) {
580008
+ if (this === Response$1) return instance instanceof GlobalResponse || Function.prototype[Symbol.hasInstance].call(this, instance);
580009
+ return Function.prototype[Symbol.hasInstance].call(this, instance);
580010
+ }
579937
580011
  [getResponseCache]() {
579938
580012
  const cache = this[cacheKey];
579939
580013
  const liveHeaders = cache && cache[2] instanceof Headers ? cache[2] : void 0;
@@ -579954,7 +580028,7 @@ var Response$1 = class Response$1 {
579954
580028
  this[getResponseCache]();
579955
580029
  return;
579956
580030
  }
579957
- this.#init = init instanceof Response$1 ? init.#init : init;
580031
+ this.#init = #init in init ? init.#init : init;
579958
580032
  headers = new Headers(init.headers);
579959
580033
  } else this.#init = init;
579960
580034
  if (body == null || typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) this[cacheKey] = [
@@ -579995,6 +580069,7 @@ var Response$1 = class Response$1 {
579995
580069
  [
579996
580070
  "arrayBuffer",
579997
580071
  "blob",
580072
+ "bytes",
579998
580073
  "clone",
579999
580074
  "formData",
580000
580075
  "json",
package/man/man1/lh.1 CHANGED
@@ -1,6 +1,6 @@
1
1
  .\" Code generated by `npm run man:generate`; DO NOT EDIT.
2
2
  .\" Manual command details come from the Commander command tree.
3
- .TH LH 1 "" "@lichao0223/lobehub\-cli 0.0.79" "User Commands"
3
+ .TH LH 1 "" "@lichao0223/lobehub\-cli 0.0.81" "User Commands"
4
4
  .SH NAME
5
5
  lh \- LobeHub CLI \- manage and connect to LobeHub services
6
6
  .SH SYNOPSIS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lichao0223/lobehub-cli",
3
- "version": "0.0.79",
3
+ "version": "0.0.81",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/lichao0223/lobehub",
@@ -83,5 +83,5 @@
83
83
  "access": "public",
84
84
  "registry": "https://registry.npmjs.org"
85
85
  },
86
- "gitHead": "b1ae07bbb156616174079b367ceec9d20f3dac48"
86
+ "gitHead": "58ac3da2420df40998d5b1f3695887a3dce3aeea"
87
87
  }