@lobehub/cli 0.0.84 → 0.0.85

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
@@ -15,7 +15,7 @@ import { Buffer as Buffer$1 } from "node:buffer";
15
15
  import * as net$1 from "node:net";
16
16
  import net, { BlockList, connect, createServer, isIP } from "node:net";
17
17
  import { scheduler, setImmediate as setImmediate$1, setTimeout as setTimeout$1 } from "node:timers/promises";
18
- import process$1, { cwd, execArgv, execPath, hrtime, platform as platform$1 } from "node:process";
18
+ import _w, { cwd, execArgv, execPath, hrtime, platform as platform$1 } from "node:process";
19
19
  import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
20
20
  import { finished, pipeline } from "node:stream/promises";
21
21
  import { Duplex, PassThrough, Readable, Transform, Writable, getDefaultHighWaterMark, pipeline as pipeline$1 } from "node:stream";
@@ -6996,7 +6996,7 @@ var init_heterogeneousAgent = __esmMin((() => {
6996
6996
 
6997
6997
  //#endregion
6998
6998
  //#region ../../packages/types/src/agent/heteroSelectorCapabilities.ts
6999
- var HETEROGENEOUS_AGENT_DEFAULT_SELECTION, AMP_AGENT_MODES, CLAUDE_CODE_REASONING_EFFORT_LEVELS, GROK_BUILD_REASONING_EFFORT_LEVELS, GROK_BUILD_REASONING_EFFORT_FLAGS, CODEX_COMMON_REASONING_EFFORT_LEVELS, CODEX_REASONING_EFFORT_LEVELS, CODEX_REASONING_EFFORT_CONFIG_KEY$1, CODEX_DEEPSEEK_V4_REASONING_EFFORT_LEVELS, CODEX_GLM_5_2_REASONING_EFFORT_LEVELS, CODEX_MAX_REASONING_EFFORT_LEVELS, CODEX_ULTRA_REASONING_MODELS, CODEX_MAX_REASONING_MODELS, QODER_REASONING_EFFORT_LEVELS, QODER_REASONING_EFFORT_FLAG, COPILOT_REASONING_EFFORT_LEVELS, COPILOT_REASONING_EFFORT_FLAG, CODEX_SERVICE_TIER_CONFIG_KEY$1, toCodexServiceTier, CODEX_FAST_SERVICE_TIER_VALUES, isAmpAgentMode, isClaudeCodeReasoningEffort, isCodexReasoningEffort, isGrokBuildReasoningEffort, isQoderReasoningEffort, isCopilotReasoningEffort, isCodexFastServiceTier, getCodexReasoningEffortLevels, resolveAmpAgentMode, CODEX_MODEL_FLAGS$2, resolveClaudeCodeModel, resolveClaudeCodeReasoningEffort, resolveCodexModel, resolveCodexReasoningEffort, resolveCodexSpeedMode, resolveGrokBuildReasoningEffort, resolveQoderReasoningEffort, resolveCopilotReasoningEffort, resolvePersistedModel, MODEL_FLAGS_ENCODING, HETERO_SELECTOR_CAPABILITIES, modelFlagsOf, COPILOT_MODEL_FLAGS, GROK_BUILD_MODEL_FLAGS, KIMI_CODE_MODEL_FLAGS, OPENCODE_MODEL_FLAGS, PI_MODEL_FLAGS, QODER_MODEL_FLAGS;
6999
+ var HETEROGENEOUS_AGENT_DEFAULT_SELECTION, AMP_AGENT_MODES, CLAUDE_CODE_REASONING_EFFORT_LEVELS, GROK_BUILD_REASONING_EFFORT_LEVELS, GROK_BUILD_REASONING_EFFORT_FLAGS, CODEX_COMMON_REASONING_EFFORT_LEVELS, CODEX_REASONING_EFFORT_LEVELS, CODEX_REASONING_EFFORT_CONFIG_KEY$1, CODEX_DEEPSEEK_V4_REASONING_EFFORT_LEVELS, CODEX_GLM_5_2_REASONING_EFFORT_LEVELS, CODEX_MAX_REASONING_EFFORT_LEVELS, CODEX_ULTRA_REASONING_MODELS, CODEX_MAX_REASONING_MODELS, QODER_REASONING_EFFORT_LEVELS, QODER_REASONING_EFFORT_FLAG, COPILOT_REASONING_EFFORT_LEVELS, COPILOT_REASONING_EFFORT_FLAG, CODEX_SERVICE_TIER_CONFIG_KEY$1, toCodexServiceTier, CODEX_FAST_SERVICE_TIER_VALUES, isAmpAgentMode, isClaudeCodeReasoningEffort, isCodexReasoningEffort, isGrokBuildReasoningEffort, isQoderReasoningEffort, isCopilotReasoningEffort, isCodexFastServiceTier, getCodexReasoningEffortLevels, resolveAmpAgentMode, CODEX_MODEL_FLAGS$2, resolveClaudeCodeModel, resolveClaudeCodeReasoningEffort, resolveCodexModel, resolveCodexReasoningEffort, resolveCodexSpeedMode, resolveGrokBuildReasoningEffort, resolveQoderReasoningEffort, resolveCopilotReasoningEffort, resolvePersistedModel, parseModelTuple, MODEL_FLAGS_ENCODING, HETERO_SELECTOR_CAPABILITIES, modelFlagsOf, COPILOT_MODEL_FLAGS, GROK_BUILD_MODEL_FLAGS, KIMI_CODE_MODEL_FLAGS, OPENCODE_MODEL_FLAGS, PI_MODEL_FLAGS, QODER_MODEL_FLAGS;
7000
7000
  var init_heteroSelectorCapabilities = __esmMin((() => {
7001
7001
  init_heteroCliArgs();
7002
7002
  HETEROGENEOUS_AGENT_DEFAULT_SELECTION = "default";
@@ -7121,6 +7121,16 @@ var init_heteroSelectorCapabilities = __esmMin((() => {
7121
7121
  const model = source?.model?.trim();
7122
7122
  return model && model !== "default" ? model : HETEROGENEOUS_AGENT_DEFAULT_SELECTION;
7123
7123
  };
7124
+ parseModelTuple = (value) => {
7125
+ if (!value.startsWith("[")) return;
7126
+ try {
7127
+ const parsed = JSON.parse(value);
7128
+ if (Array.isArray(parsed) && parsed.length === 2 && typeof parsed[0] === "string" && typeof parsed[1] === "string") return {
7129
+ modelId: parsed[1],
7130
+ providerId: parsed[0]
7131
+ };
7132
+ } catch {}
7133
+ };
7124
7134
  MODEL_FLAGS_ENCODING = {
7125
7135
  flags: ["-m", "--model"],
7126
7136
  kind: "flag"
@@ -7221,6 +7231,11 @@ var init_heteroSelectorCapabilities = __esmMin((() => {
7221
7231
  resolve: resolvePersistedModel,
7222
7232
  source: "catalog"
7223
7233
  } },
7234
+ "deepseek-harness": { model: {
7235
+ encodings: [],
7236
+ resolve: resolvePersistedModel,
7237
+ source: "catalog"
7238
+ } },
7224
7239
  "droid": { model: {
7225
7240
  encodings: [],
7226
7241
  resolve: resolvePersistedModel,
@@ -7540,6 +7555,12 @@ var init_chatConfig = __esmMin((() => {
7540
7555
  "high"
7541
7556
  ]).optional(),
7542
7557
  thinkingLevel4: _enum(["minimal", "high"]).optional(),
7558
+ thinkingLevel5: _enum([
7559
+ "low",
7560
+ "medium",
7561
+ "high",
7562
+ "xhigh"
7563
+ ]).optional(),
7543
7564
  toolResultMaxLength: number$1().default(25e3),
7544
7565
  topicGroupMode: _enum([
7545
7566
  "byTime",
@@ -10767,7 +10788,13 @@ var init_aiModel = __esmMin((() => {
10767
10788
  "medium",
10768
10789
  "high"
10769
10790
  ]).optional(),
10770
- thinkingLevel4: _enum(["minimal", "high"]).optional()
10791
+ thinkingLevel4: _enum(["minimal", "high"]).optional(),
10792
+ thinkingLevel5: _enum([
10793
+ "low",
10794
+ "medium",
10795
+ "high",
10796
+ "xhigh"
10797
+ ]).optional()
10771
10798
  });
10772
10799
  MODEL_REASONING_EXTEND_PARAMS = Object.keys(AiModelReasoningConfigSchema.shape);
10773
10800
  ExtendParamsTypeSchema = _enum([
@@ -10810,6 +10837,7 @@ var init_aiModel = __esmMin((() => {
10810
10837
  "thinkingLevel2",
10811
10838
  "thinkingLevel3",
10812
10839
  "thinkingLevel4",
10840
+ "thinkingLevel5",
10813
10841
  "imageAspectRatio",
10814
10842
  "imageAspectRatio2",
10815
10843
  "imageResolution",
@@ -10831,7 +10859,8 @@ var init_aiModel = __esmMin((() => {
10831
10859
  disabledParams: array(DisabledParamTypeSchema).optional(),
10832
10860
  extendParams: array(ExtendParamsTypeSchema).optional(),
10833
10861
  searchImpl: ModelSearchImplementTypeSchema.optional(),
10834
- searchProvider: string().optional()
10862
+ searchProvider: string().optional(),
10863
+ ttsVoice: string().optional()
10835
10864
  });
10836
10865
  CreateAiModelSchema = object$1({
10837
10866
  abilities: AiModelAbilitiesSchema.optional(),
@@ -12299,7 +12328,7 @@ var DeviceMetricsSampler = class {
12299
12328
  };
12300
12329
 
12301
12330
  //#endregion
12302
- //#region node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/constants.js
12331
+ //#region node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/constants.js
12303
12332
  var require_constants$5 = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
12304
12333
  const BINARY_TYPES = [
12305
12334
  "nodebuffer",
@@ -12323,7 +12352,7 @@ var require_constants$5 = /* @__PURE__ */ __commonJSMin$2(((exports, module) =>
12323
12352
  }));
12324
12353
 
12325
12354
  //#endregion
12326
- //#region node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/buffer-util.js
12355
+ //#region node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/buffer-util.js
12327
12356
  var require_buffer_util = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
12328
12357
  const { websocketMask, websocketUnmask } = __require("http");
12329
12358
  const { EMPTY_BUFFER } = require_constants$5();
@@ -12433,7 +12462,7 @@ var require_buffer_util = /* @__PURE__ */ __commonJSMin$2(((exports, module) =>
12433
12462
  }));
12434
12463
 
12435
12464
  //#endregion
12436
- //#region node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/limiter.js
12465
+ //#region node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/limiter.js
12437
12466
  var require_limiter = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
12438
12467
  const kDone = Symbol("kDone");
12439
12468
  const kRun = Symbol("kRun");
@@ -12485,7 +12514,7 @@ var require_limiter = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
12485
12514
  }));
12486
12515
 
12487
12516
  //#endregion
12488
- //#region node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/permessage-deflate.js
12517
+ //#region node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/permessage-deflate.js
12489
12518
  var require_permessage_deflate = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
12490
12519
  const zlib$3 = __require("zlib");
12491
12520
  const bufferUtil = require_buffer_util();
@@ -12819,7 +12848,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin$2(((exports, modu
12819
12848
  }));
12820
12849
 
12821
12850
  //#endregion
12822
- //#region node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/validation.js
12851
+ //#region node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/validation.js
12823
12852
  var require_validation$5 = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
12824
12853
  const { isUtf8 } = __require("buffer");
12825
12854
  const { hasBlob } = require_constants$5();
@@ -13016,7 +13045,7 @@ var require_validation$5 = /* @__PURE__ */ __commonJSMin$2(((exports, module) =>
13016
13045
  }));
13017
13046
 
13018
13047
  //#endregion
13019
- //#region node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/receiver.js
13048
+ //#region node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/receiver.js
13020
13049
  var require_receiver = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
13021
13050
  const { Writable: Writable$3 } = __require("stream");
13022
13051
  const PerMessageDeflate = require_permessage_deflate();
@@ -13481,7 +13510,7 @@ var require_receiver = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
13481
13510
  }));
13482
13511
 
13483
13512
  //#endregion
13484
- //#region node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/sender.js
13513
+ //#region node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/sender.js
13485
13514
  var require_sender = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
13486
13515
  const { Duplex: Duplex$4 } = __require("stream");
13487
13516
  const { randomFillSync } = __require("crypto");
@@ -13981,7 +14010,7 @@ var require_sender = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
13981
14010
  }));
13982
14011
 
13983
14012
  //#endregion
13984
- //#region node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/event-target.js
14013
+ //#region node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/event-target.js
13985
14014
  var require_event_target = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
13986
14015
  const { kForOnEventAttribute, kListener } = require_constants$5();
13987
14016
  const kCode = Symbol("kCode");
@@ -14220,7 +14249,7 @@ var require_event_target = /* @__PURE__ */ __commonJSMin$2(((exports, module) =>
14220
14249
  }));
14221
14250
 
14222
14251
  //#endregion
14223
- //#region node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/extension.js
14252
+ //#region node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/extension.js
14224
14253
  var require_extension = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
14225
14254
  const { tokenChars } = require_validation$5();
14226
14255
  /**
@@ -14364,7 +14393,7 @@ var require_extension = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
14364
14393
  }));
14365
14394
 
14366
14395
  //#endregion
14367
- //#region node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/websocket.js
14396
+ //#region node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/websocket.js
14368
14397
  var require_websocket = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
14369
14398
  const EventEmitter$7 = __require("events");
14370
14399
  const https = __require("https");
@@ -14434,12 +14463,15 @@ var require_websocket = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
14434
14463
  else if (Array.isArray(options.protocols)) protocols = options.protocols;
14435
14464
  else protocols = [options.protocols];
14436
14465
  } else protocols = [protocols];
14437
- initAsClient(this, address, protocols, options);
14438
- } else {
14439
- this._autoPong = options.autoPong;
14440
- this._closeTimeout = options.closeTimeout;
14441
- this._isServer = true;
14466
+ options = initAsClient(this, address, protocols, options);
14467
+ } else this._isServer = true;
14468
+ if (options.autoPong) {
14469
+ this._autoPong = true;
14470
+ this._autoPongComplete = () => autoPongComplete(this);
14471
+ this._pendingAutoPongs = 0;
14472
+ this._maxPendingAutoPongs = options.maxPendingAutoPongs | 0;
14442
14473
  }
14474
+ this._closeTimeout = options.closeTimeout;
14443
14475
  }
14444
14476
  /**
14445
14477
  * For historical reasons, the custom "nodebuffer" type is used by the default
@@ -14880,6 +14912,8 @@ var require_websocket = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
14880
14912
  * fragments
14881
14913
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
14882
14914
  * size
14915
+ * @param {Number} [options.maxPendingAutoPongs=60] The maximum number of
14916
+ * pending automatic pongs
14883
14917
  * @param {Number} [options.maxRedirects=10] The maximum number of redirects
14884
14918
  * allowed
14885
14919
  * @param {String} [options.origin] Value of the `Origin` or
@@ -14890,6 +14924,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
14890
14924
  * `Sec-WebSocket-Version` header
14891
14925
  * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
14892
14926
  * not to skip UTF-8 validation for text and close messages
14927
+ * @return {Object} The resolved options object used for initialization
14893
14928
  * @private
14894
14929
  */
14895
14930
  function initAsClient(websocket, address, protocols, options) {
@@ -14901,6 +14936,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
14901
14936
  maxBufferedChunks: 256 * 1024,
14902
14937
  maxFragments: 16 * 1024,
14903
14938
  maxPayload: 100 * 1024 * 1024,
14939
+ maxPendingAutoPongs: 60,
14904
14940
  skipUTF8Validation: false,
14905
14941
  perMessageDeflate: true,
14906
14942
  followRedirects: false,
@@ -14916,8 +14952,6 @@ var require_websocket = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
14916
14952
  path: void 0,
14917
14953
  port: void 0
14918
14954
  };
14919
- websocket._autoPong = opts.autoPong;
14920
- websocket._closeTimeout = opts.closeTimeout;
14921
14955
  if (!protocolVersions.includes(opts.protocolVersion)) throw new RangeError(`Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})`);
14922
14956
  let parsedUrl;
14923
14957
  if (address instanceof URL$2) parsedUrl = address;
@@ -15105,6 +15139,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
15105
15139
  });
15106
15140
  if (opts.finishRequest) opts.finishRequest(req, websocket);
15107
15141
  else req.end();
15142
+ return opts;
15108
15143
  }
15109
15144
  /**
15110
15145
  * Emit the `'error'` and `'close'` events.
@@ -15261,10 +15296,23 @@ var require_websocket = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
15261
15296
  */
15262
15297
  function receiverOnPing(data) {
15263
15298
  const websocket = this[kWebSocket];
15264
- if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP);
15299
+ if (websocket._autoPong && websocket.readyState === WebSocket.OPEN) if (websocket._maxPendingAutoPongs > 0 && websocket._pendingAutoPongs >= websocket._maxPendingAutoPongs) websocket.terminate();
15300
+ else {
15301
+ websocket._pendingAutoPongs++;
15302
+ websocket.pong(data, !this._isServer, websocket._autoPongComplete);
15303
+ }
15265
15304
  websocket.emit("ping", data);
15266
15305
  }
15267
15306
  /**
15307
+ * The callback for automatic pong responses.
15308
+ *
15309
+ * @param {WebSocket} websocket The WebSocket instance
15310
+ * @private
15311
+ */
15312
+ function autoPongComplete(websocket) {
15313
+ websocket._pendingAutoPongs--;
15314
+ }
15315
+ /**
15268
15316
  * The listener of the `Receiver` `'pong'` event.
15269
15317
  *
15270
15318
  * @param {Buffer} data The data included in the pong frame
@@ -15371,7 +15419,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
15371
15419
  }));
15372
15420
 
15373
15421
  //#endregion
15374
- //#region node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/stream.js
15422
+ //#region node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/stream.js
15375
15423
  var require_stream$6 = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
15376
15424
  require_websocket();
15377
15425
  const { Duplex: Duplex$2 } = __require("stream");
@@ -15488,7 +15536,7 @@ var require_stream$6 = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
15488
15536
  }));
15489
15537
 
15490
15538
  //#endregion
15491
- //#region node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/subprotocol.js
15539
+ //#region node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/subprotocol.js
15492
15540
  var require_subprotocol = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
15493
15541
  const { tokenChars } = require_validation$5();
15494
15542
  /**
@@ -15528,7 +15576,7 @@ var require_subprotocol = /* @__PURE__ */ __commonJSMin$2(((exports, module) =>
15528
15576
  }));
15529
15577
 
15530
15578
  //#endregion
15531
- //#region node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/websocket-server.js
15579
+ //#region node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/websocket-server.js
15532
15580
  var require_websocket_server = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
15533
15581
  const EventEmitter$6 = __require("events");
15534
15582
  const http$1 = __require("http");
@@ -15573,6 +15621,8 @@ var require_websocket_server = /* @__PURE__ */ __commonJSMin$2(((exports, module
15573
15621
  * fragments
15574
15622
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
15575
15623
  * size
15624
+ * @param {Number} [options.maxPendingAutoPongs=60] The maximum number of
15625
+ * pending automatic pongs
15576
15626
  * @param {Boolean} [options.noServer=false] Enable no server mode
15577
15627
  * @param {String} [options.path] Accept only connections matching this path
15578
15628
  * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable
@@ -15595,6 +15645,7 @@ var require_websocket_server = /* @__PURE__ */ __commonJSMin$2(((exports, module
15595
15645
  maxBufferedChunks: 256 * 1024,
15596
15646
  maxFragments: 16 * 1024,
15597
15647
  maxPayload: 100 * 1024 * 1024,
15648
+ maxPendingAutoPongs: 60,
15598
15649
  skipUTF8Validation: false,
15599
15650
  perMessageDeflate: false,
15600
15651
  handleProtocols: null,
@@ -15915,7 +15966,7 @@ var require_websocket_server = /* @__PURE__ */ __commonJSMin$2(((exports, module
15915
15966
  }));
15916
15967
 
15917
15968
  //#endregion
15918
- //#region node_modules/.pnpm/ws@8.22.2/node_modules/ws/wrapper.mjs
15969
+ //#region node_modules/.pnpm/ws@8.23.0/node_modules/ws/wrapper.mjs
15919
15970
  var import_stream = /* @__PURE__ */ __toESM$2(require_stream$6(), 1);
15920
15971
  var import_extension = /* @__PURE__ */ __toESM$2(require_extension(), 1);
15921
15972
  var import_permessage_deflate = /* @__PURE__ */ __toESM$2(require_permessage_deflate(), 1);
@@ -21420,7 +21471,7 @@ var require_command = /* @__PURE__ */ __commonJSMin$2(((exports) => {
21420
21471
  const childProcess$2 = __require("node:child_process");
21421
21472
  const path$16 = __require("node:path");
21422
21473
  const fs$17 = __require("node:fs");
21423
- const process$3 = __require("node:process");
21474
+ const process$2 = __require("node:process");
21424
21475
  const { Argument, humanReadableArgName } = require_argument();
21425
21476
  const { CommanderError } = require_error$1();
21426
21477
  const { Help, stripColor } = require_help();
@@ -21472,13 +21523,13 @@ var require_command = /* @__PURE__ */ __commonJSMin$2(((exports) => {
21472
21523
  this._showSuggestionAfterError = true;
21473
21524
  this._savedState = null;
21474
21525
  this._outputConfiguration = {
21475
- writeOut: (str) => process$3.stdout.write(str),
21476
- writeErr: (str) => process$3.stderr.write(str),
21526
+ writeOut: (str) => process$2.stdout.write(str),
21527
+ writeErr: (str) => process$2.stderr.write(str),
21477
21528
  outputError: (str, write) => write(str),
21478
- getOutHelpWidth: () => process$3.stdout.isTTY ? process$3.stdout.columns : void 0,
21479
- getErrHelpWidth: () => process$3.stderr.isTTY ? process$3.stderr.columns : void 0,
21480
- getOutHasColors: () => useColor() ?? (process$3.stdout.isTTY && process$3.stdout.hasColors?.()),
21481
- getErrHasColors: () => useColor() ?? (process$3.stderr.isTTY && process$3.stderr.hasColors?.()),
21529
+ getOutHelpWidth: () => process$2.stdout.isTTY ? process$2.stdout.columns : void 0,
21530
+ getErrHelpWidth: () => process$2.stderr.isTTY ? process$2.stderr.columns : void 0,
21531
+ getOutHasColors: () => useColor() ?? (process$2.stdout.isTTY && process$2.stdout.hasColors?.()),
21532
+ getErrHasColors: () => useColor() ?? (process$2.stderr.isTTY && process$2.stderr.hasColors?.()),
21482
21533
  stripColor: (str) => stripColor(str)
21483
21534
  };
21484
21535
  this._hidden = false;
@@ -21836,7 +21887,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
21836
21887
  */
21837
21888
  _exit(exitCode, code, message) {
21838
21889
  if (this._exitCallback) this._exitCallback(new CommanderError(exitCode, code, message));
21839
- process$3.exit(exitCode);
21890
+ process$2.exit(exitCode);
21840
21891
  }
21841
21892
  /**
21842
21893
  * Register callback `fn` for the command.
@@ -22175,11 +22226,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
22175
22226
  if (argv !== void 0 && !Array.isArray(argv)) throw new Error("first parameter to parse must be array or undefined");
22176
22227
  parseOptions = parseOptions || {};
22177
22228
  if (argv === void 0 && parseOptions.from === void 0) {
22178
- if (process$3.versions?.electron) parseOptions.from = "electron";
22179
- const execArgv = process$3.execArgv ?? [];
22229
+ if (process$2.versions?.electron) parseOptions.from = "electron";
22230
+ const execArgv = process$2.execArgv ?? [];
22180
22231
  if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) parseOptions.from = "eval";
22181
22232
  }
22182
- if (argv === void 0) argv = process$3.argv;
22233
+ if (argv === void 0) argv = process$2.argv;
22183
22234
  this.rawArgs = argv.slice();
22184
22235
  let userArgs;
22185
22236
  switch (parseOptions.from) {
@@ -22189,7 +22240,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
22189
22240
  userArgs = argv.slice(2);
22190
22241
  break;
22191
22242
  case "electron":
22192
- if (process$3.defaultApp) {
22243
+ if (process$2.defaultApp) {
22193
22244
  this._scriptPath = argv[1];
22194
22245
  userArgs = argv.slice(2);
22195
22246
  } else userArgs = argv.slice(1);
@@ -22354,16 +22405,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
22354
22405
  }
22355
22406
  launchWithNode = sourceExt.includes(path$16.extname(executableFile));
22356
22407
  let proc;
22357
- if (process$3.platform !== "win32") if (launchWithNode) {
22408
+ if (process$2.platform !== "win32") if (launchWithNode) {
22358
22409
  args.unshift(executableFile);
22359
- args = incrementNodeInspectorPort(process$3.execArgv).concat(args);
22360
- proc = childProcess$2.spawn(process$3.argv[0], args, { stdio: "inherit" });
22410
+ args = incrementNodeInspectorPort(process$2.execArgv).concat(args);
22411
+ proc = childProcess$2.spawn(process$2.argv[0], args, { stdio: "inherit" });
22361
22412
  } else proc = childProcess$2.spawn(executableFile, args, { stdio: "inherit" });
22362
22413
  else {
22363
22414
  this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
22364
22415
  args.unshift(executableFile);
22365
- args = incrementNodeInspectorPort(process$3.execArgv).concat(args);
22366
- proc = childProcess$2.spawn(process$3.execPath, args, { stdio: "inherit" });
22416
+ args = incrementNodeInspectorPort(process$2.execArgv).concat(args);
22417
+ proc = childProcess$2.spawn(process$2.execPath, args, { stdio: "inherit" });
22367
22418
  }
22368
22419
  if (!proc.killed) [
22369
22420
  "SIGUSR1",
@@ -22372,20 +22423,20 @@ Expecting one of '${allowedValues.join("', '")}'`);
22372
22423
  "SIGINT",
22373
22424
  "SIGHUP"
22374
22425
  ].forEach((signal) => {
22375
- process$3.on(signal, () => {
22426
+ process$2.on(signal, () => {
22376
22427
  if (proc.killed === false && proc.exitCode === null) proc.kill(signal);
22377
22428
  });
22378
22429
  });
22379
22430
  const exitCallback = this._exitCallback;
22380
22431
  proc.on("close", (code) => {
22381
22432
  code = code ?? 1;
22382
- if (!exitCallback) process$3.exit(code);
22433
+ if (!exitCallback) process$2.exit(code);
22383
22434
  else exitCallback(new CommanderError(code, "commander.executeSubCommandAsync", "(close)"));
22384
22435
  });
22385
22436
  proc.on("error", (err) => {
22386
22437
  if (err.code === "ENOENT") this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
22387
22438
  else if (err.code === "EACCES") throw new Error(`'${executableFile}' not executable`);
22388
- if (!exitCallback) process$3.exit(1);
22439
+ if (!exitCallback) process$2.exit(1);
22389
22440
  else {
22390
22441
  const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
22391
22442
  wrappedError.nestedError = err;
@@ -22794,13 +22845,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
22794
22845
  */
22795
22846
  _parseOptionsEnv() {
22796
22847
  this.options.forEach((option) => {
22797
- if (option.envVar && option.envVar in process$3.env) {
22848
+ if (option.envVar && option.envVar in process$2.env) {
22798
22849
  const optionKey = option.attributeName();
22799
22850
  if (this.getOptionValue(optionKey) === void 0 || [
22800
22851
  "default",
22801
22852
  "config",
22802
22853
  "env"
22803
- ].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$3.env[option.envVar]);
22854
+ ].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$2.env[option.envVar]);
22804
22855
  else this.emit(`optionEnv:${option.name()}`);
22805
22856
  }
22806
22857
  });
@@ -23217,7 +23268,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
23217
23268
  */
23218
23269
  help(contextOptions) {
23219
23270
  this.outputHelp(contextOptions);
23220
- let exitCode = Number(process$3.exitCode ?? 0);
23271
+ let exitCode = Number(process$2.exitCode ?? 0);
23221
23272
  if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) exitCode = 1;
23222
23273
  this._exit(exitCode, "commander.help", "(outputHelp)");
23223
23274
  }
@@ -23307,8 +23358,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
23307
23358
  * @package
23308
23359
  */
23309
23360
  function useColor() {
23310
- if (process$3.env.NO_COLOR || process$3.env.FORCE_COLOR === "0" || process$3.env.FORCE_COLOR === "false") return false;
23311
- if (process$3.env.FORCE_COLOR || process$3.env.CLICOLOR_FORCE !== void 0) return true;
23361
+ if (process$2.env.NO_COLOR || process$2.env.FORCE_COLOR === "0" || process$2.env.FORCE_COLOR === "false") return false;
23362
+ if (process$2.env.FORCE_COLOR || process$2.env.CLICOLOR_FORCE !== void 0) return true;
23312
23363
  }
23313
23364
  exports.Command = Command;
23314
23365
  exports.useColor = useColor;
@@ -78941,6 +78992,8 @@ var init_resolveCliCommand = __esmMin((() => {
78941
78992
 
78942
78993
  //#endregion
78943
78994
  //#region ../../packages/heterogeneous-agents/src/spawn/dshAcpSession.ts
78995
+ init_src$1();
78996
+ init_resolveCliCommand();
78944
78997
  /**
78945
78998
  * DeepSeek Harness over the Agent Client Protocol.
78946
78999
  *
@@ -78952,6 +79005,32 @@ var init_resolveCliCommand = __esmMin((() => {
78952
79005
  */
78953
79006
  /** The official DeepSeek Harness CLI executable (`npm i -g @deepseek-ai/dsh`). */
78954
79007
  const DSH_COMMAND = "dsh";
79008
+ /** `dsh --version` prints a bare semantic version (e.g. `0.2.0-rc.2`). */
79009
+ const DSH_VERSION_PATTERN = /^v?\d+\.\d+\.\d+(?:[-+][\dA-Za-z.-]+)?$/;
79010
+ /** First release whose CLI ships the `acp` profile with `session/resume`. */
79011
+ const DSH_MIN_VERSION = "0.2.0";
79012
+ /** Compare release numbers only, so `0.2.0-rc.2` already counts as 0.2. */
79013
+ const isSupportedDshVersion = (version) => {
79014
+ const parts = version?.match(/(\d+)\.(\d+)\.(\d+)/)?.slice(1).map(Number);
79015
+ if (!parts) return false;
79016
+ const minimum = DSH_MIN_VERSION.split(".").map(Number);
79017
+ for (const [index, part] of parts.entries()) if (part !== minimum[index]) return part > minimum[index];
79018
+ return true;
79019
+ };
79020
+ /**
79021
+ * Find a `dsh` that can run LobeHub turns. An older CLI still answers
79022
+ * `--version` but has no `acp` profile, so it is reported unavailable here
79023
+ * rather than failing every turn after the agent was created.
79024
+ */
79025
+ const detectDshCommand = async (command = "dsh", env) => {
79026
+ const status = await detectValidatedCommand(command, { validatePattern: DSH_VERSION_PATTERN }, env);
79027
+ if (!status.available || isSupportedDshVersion(status.version)) return status;
79028
+ return {
79029
+ ...status,
79030
+ available: false,
79031
+ error: `DeepSeek Harness CLI ${status.version} is too old; LobeHub needs ${DSH_MIN_VERSION} or newer. Update it with: npm i -g @deepseek-ai/dsh`
79032
+ };
79033
+ };
78955
79034
  /** Select the CLI's shipped ACP profile, served on stdio until disconnect. */
78956
79035
  const DSH_ACP_PROFILE_ARGS = ["--profile", "acp"];
78957
79036
  /** The profile boots its plugin tree before answering `initialize`. */
@@ -78979,14 +79058,7 @@ const modelChoices = (configOptions) => {
78979
79058
  };
78980
79059
  };
78981
79060
  /** The model name inside a `[provider, model]` choice value. */
78982
- const modelOf = (value) => {
78983
- if (!value) return;
78984
- try {
78985
- const parsed = JSON.parse(value);
78986
- if (Array.isArray(parsed) && typeof parsed[1] === "string") return parsed[1];
78987
- } catch {}
78988
- return value;
78989
- };
79061
+ const modelOf = (value) => value ? parseModelTuple(value)?.modelId ?? value : void 0;
78990
79062
  /** DeepSeek Harness's ACP lifecycle on the shared session base. */
78991
79063
  var DshAcpSession = class extends AcpAgentSession {
78992
79064
  constructor(options) {
@@ -79006,6 +79078,38 @@ var DshAcpSession = class extends AcpAgentSession {
79006
79078
  get sessionId() {
79007
79079
  return this.acpSessionId;
79008
79080
  }
79081
+ /**
79082
+ * Enumerate the configured providers through ACP without sending a prompt.
79083
+ * The harness advertises its model selector on `session/new`; the same
79084
+ * lifecycle a real turn uses, so discovery sees exactly what a turn can pick.
79085
+ */
79086
+ async discoverModels() {
79087
+ try {
79088
+ const initialized = await this.initializeConnection();
79089
+ const result = await this.client.request("session/new", {
79090
+ cwd: this.options.cwd,
79091
+ mcpServers: []
79092
+ });
79093
+ if (!result?.sessionId) throw new Error("DeepSeek Harness ACP returned no session id");
79094
+ if (!result.configOptions?.some(({ id }) => id === DSH_MODEL_CONFIG_ID)) throw new Error("DeepSeek Harness ACP did not expose a model configuration option");
79095
+ const seen = /* @__PURE__ */ new Set();
79096
+ const models = modelChoices(result.configOptions).choices.flatMap(({ name, value }) => {
79097
+ if (seen.has(value)) return [];
79098
+ seen.add(value);
79099
+ const tuple = parseModelTuple(value);
79100
+ return [{
79101
+ id: value,
79102
+ ...name ? { label: name } : {},
79103
+ modelId: tuple?.modelId ?? value,
79104
+ providerId: tuple?.providerId ?? "deepseek-harness"
79105
+ }];
79106
+ });
79107
+ if (initialized?.agentCapabilities?.sessionCapabilities?.close) await this.client.request("session/close", { sessionId: result.sessionId });
79108
+ return models;
79109
+ } finally {
79110
+ this.client.close();
79111
+ }
79112
+ }
79009
79113
  buildInitializeParams() {
79010
79114
  return {
79011
79115
  clientCapabilities: {
@@ -79092,7 +79196,7 @@ var DshAcpSession = class extends AcpAgentSession {
79092
79196
  async selectModel(sessionId, configOptions) {
79093
79197
  const { choices, current } = modelChoices(configOptions);
79094
79198
  const wanted = this.options.model?.trim();
79095
- const choice = wanted ? choices.find(({ name, value }) => name === wanted || modelOf(value) === wanted) : void 0;
79199
+ const choice = wanted ? choices.find(({ value }) => value === wanted) ?? choices.find(({ name, value }) => name === wanted || modelOf(value) === wanted) : void 0;
79096
79200
  if (!choice || choice.value === current) return modelOf(current);
79097
79201
  await this.client.request("session/set_config_option", {
79098
79202
  configId: DSH_MODEL_CONFIG_ID,
@@ -79182,6 +79286,23 @@ const spawnDshAcpSession = (options) => {
79182
79286
  }
79183
79287
  };
79184
79288
  };
79289
+ /** Discover the runtime's grouped model catalog over the `acp` profile. */
79290
+ const listDshAcpModels = async (options) => new DshAcpSession({
79291
+ args: options.args ?? [],
79292
+ clientVersion: options.clientVersion ?? "1.0.0",
79293
+ commandPath: options.commandPath,
79294
+ cwd: options.cwd,
79295
+ env: options.env,
79296
+ onEvents: () => {},
79297
+ onRawMessage: () => {},
79298
+ onRuntimeStatus: () => {},
79299
+ onSessionId: () => {},
79300
+ onStderr: () => {},
79301
+ operationId: "dsh-model-discovery",
79302
+ prompt: "",
79303
+ requestTimeoutMs: options.timeoutMs,
79304
+ sessionId: "dsh-model-discovery"
79305
+ }).discoverModels();
79185
79306
 
79186
79307
  //#endregion
79187
79308
  //#region ../../packages/heterogeneous-agents/src/spawn/fileStoreImageUploader.ts
@@ -79500,13 +79621,13 @@ const assertPrivateRoot = async (rootDir) => {
79500
79621
  if (stat.uid !== process.getuid()) throw new Error(`${rootDir} belongs to another user`);
79501
79622
  if ((stat.mode & 63) !== 0) throw new Error(`${rootDir} is accessible to other users`);
79502
79623
  };
79503
- const pathExists = async (target) => lstat(target).then(() => true, () => false);
79624
+ const pathExists$1 = async (target) => lstat(target).then(() => true, () => false);
79504
79625
  const materializePlugin = async (rootDir) => {
79505
79626
  const files = buildLobeHubCliPluginFiles();
79506
79627
  const digest = createHash("sha256").update(JSON.stringify(files)).digest("hex").slice(0, 16);
79507
79628
  const pluginDir = path.join(rootDir, digest);
79508
79629
  await assertPrivateRoot(rootDir);
79509
- if (await pathExists(path.join(pluginDir, `skills/${"lobehub"}/SKILL.md`))) return pluginDir;
79630
+ if (await pathExists$1(path.join(pluginDir, `skills/${"lobehub"}/SKILL.md`))) return pluginDir;
79510
79631
  const stagingDir = path.join(rootDir, `.staging-${randomUUID()}`);
79511
79632
  try {
79512
79633
  for (const [relativePath, content] of Object.entries(files)) {
@@ -79518,7 +79639,7 @@ const materializePlugin = async (rootDir) => {
79518
79639
  await writeFile(target, content, { mode: 384 });
79519
79640
  }
79520
79641
  await rename(stagingDir, pluginDir).catch(async (error) => {
79521
- if (!await pathExists(pluginDir)) throw error;
79642
+ if (!await pathExists$1(pluginDir)) throw error;
79522
79643
  });
79523
79644
  return pluginDir;
79524
79645
  } finally {
@@ -264960,12 +265081,57 @@ const prepareSkillDirectory = async (params, deps = {}) => {
264960
265081
  const MAX_SKILL_FILE_COUNT = 1e3;
264961
265082
  const DEFAULT_DIRECTORY_PAGE_SIZE = 200;
264962
265083
  const MAX_DIRECTORY_PAGE_SIZE = 1e3;
264963
- const SKILL_SOURCES = [".agents/skills", ".claude/skills"];
264964
- const createProjectSkillRoots = (root) => SKILL_SOURCES.map((source) => ({
264965
- previewRoot: root,
264966
- scope: "project",
264967
- source,
264968
- sourceRoot: path.join(root, source)
265084
+ const SKILL_SOURCES = [
265085
+ ".agents/skills",
265086
+ ".claude/skills",
265087
+ ".codex/skills"
265088
+ ];
265089
+ /**
265090
+ * Upper bound on directories walked from the working directory to the
265091
+ * repository root, so a pathological path cannot turn one scan into hundreds
265092
+ * of filesystem probes.
265093
+ */
265094
+ const MAX_ANCESTOR_DEPTH = 32;
265095
+ const pathExists = async (target) => {
265096
+ try {
265097
+ await stat(target);
265098
+ return true;
265099
+ } catch {
265100
+ return false;
265101
+ }
265102
+ };
265103
+ /**
265104
+ * Directories whose agent files apply to `root`, nearest first: `root` itself,
265105
+ * then each parent up to and including the repository root (the nearest
265106
+ * ancestor containing `.git`, a directory in a checkout and a file in a
265107
+ * worktree or submodule). Without a repository root only `root` applies, so a
265108
+ * directory outside any repository never picks up files from `~` or `/`.
265109
+ *
265110
+ * Mirrors the startup discovery of Codex, Claude Code, OpenCode and pi, so a
265111
+ * run bound to `packages/web` of a monorepo still sees the root `AGENTS.md`
265112
+ * and `.agents/skills`.
265113
+ */
265114
+ const resolveAgentFileDirs = async (root) => {
265115
+ const start = path.resolve(root);
265116
+ const dirs = [];
265117
+ let current = start;
265118
+ for (let depth = 0; depth < MAX_ANCESTOR_DEPTH; depth += 1) {
265119
+ dirs.push(current);
265120
+ if (await pathExists(path.join(current, ".git"))) return dirs;
265121
+ const parent = path.dirname(current);
265122
+ if (parent === current) break;
265123
+ current = parent;
265124
+ }
265125
+ return [start];
265126
+ };
265127
+ const createProjectSkillRoots = (root, dirs) => dirs.flatMap((dir, index) => SKILL_SOURCES.map((source) => {
265128
+ const sourceRoot = path.join(dir, source);
265129
+ return {
265130
+ previewRoot: index === 0 ? root : sourceRoot,
265131
+ scope: "project",
265132
+ source,
265133
+ sourceRoot
265134
+ };
264969
265135
  }));
264970
265136
  const createDeviceSkillRoots = () => {
264971
265137
  const home = os$4.homedir();
@@ -264979,7 +265145,11 @@ const createDeviceSkillRoots = () => {
264979
265145
  };
264980
265146
  });
264981
265147
  };
264982
- const createSkillRoots = (root) => [...createProjectSkillRoots(root), ...createDeviceSkillRoots()];
265148
+ /**
265149
+ * Scan order decides name collisions (first wins): the working directory
265150
+ * before its parents, project before device.
265151
+ */
265152
+ const createSkillRoots = async (root) => [...createProjectSkillRoots(root, await resolveAgentFileDirs(root)), ...createDeviceSkillRoots()];
264983
265153
  const toPosixRelativePath = (filePath) => filePath.split(path.sep).join("/");
264984
265154
  const listSkillFilesRecursive = async (dir) => {
264985
265155
  const results = [];
@@ -265072,34 +265242,75 @@ const approvePreviewRoots = async (skills, deps, extraRoots = []) => {
265072
265242
  const roots = new Set([...extraRoots, ...skills.map((skill) => skill.previewRoot)]);
265073
265243
  await Promise.all([...roots].map((root) => deps.approveProjectRoot(root)));
265074
265244
  };
265245
+ /** Per-file cap, so one oversized file cannot crowd out the others. */
265246
+ const MAX_INSTRUCTIONS_FILE_BYTES = 64 * 1024;
265247
+ /** Cap across every directory, bounding the cached payload and the system role. */
265248
+ const MAX_INSTRUCTIONS_TOTAL_BYTES = 128 * 1024;
265249
+ const INSTRUCTION_FILENAMES = ["AGENTS.md", "CLAUDE.md"];
265075
265250
  /**
265076
- * Read the project-root agent instructions files (`AGENTS.md`, then `CLAUDE.md`).
265077
- * Collects every present candidate rather than first-match, since both can
265078
- * coexist. Each body is capped so a pathologically large file can't bloat the
265079
- * cached payload or the injected system role.
265251
+ * Cut `raw` to at most `maxBytes` of UTF-8. Measuring `string.length` would
265252
+ * count UTF-16 units, letting CJK text exceed the budget about threefold. A
265253
+ * character split at the boundary decodes to U+FFFD and is dropped.
265080
265254
  */
265081
- const readWorkspaceInstructions = async (root) => {
265082
- const MAX_INSTRUCTIONS_BYTES = 64 * 1024;
265083
- const candidates = ["AGENTS.md", "CLAUDE.md"];
265084
- const instructions = [];
265085
- for (const source of candidates) try {
265086
- const raw = await readFile(path.join(root, source), "utf8");
265087
- const content = raw.length > MAX_INSTRUCTIONS_BYTES ? raw.slice(0, MAX_INSTRUCTIONS_BYTES) : raw;
265088
- instructions.push({
265089
- content,
265090
- source
265091
- });
265092
- } catch {}
265093
- return instructions;
265255
+ const truncateUtf8 = (raw, maxBytes) => {
265256
+ const buffer = Buffer.from(raw, "utf8");
265257
+ if (buffer.length <= maxBytes) return {
265258
+ bytes: buffer.length,
265259
+ content: raw
265260
+ };
265261
+ const content = buffer.subarray(0, maxBytes).toString("utf8").replace(/\uFFFD+$/, "");
265262
+ return {
265263
+ bytes: Buffer.byteLength(content, "utf8"),
265264
+ content
265265
+ };
265094
265266
  };
265095
265267
  /**
265096
- * Scan agent skill directories for the project and the execution device.
265097
- * Project skills win over device skills on name collision. Approves each
265268
+ * Read the agent instructions files (`AGENTS.md`, then `CLAUDE.md`) in `dirs`
265269
+ * (nearest first), returned root first so the most specific file comes last
265270
+ * in the prompt, as the other harnesses order them.
265271
+ *
265272
+ * Both names are read in each directory since they can coexist, except when
265273
+ * one is a symlink to the other (a common way to share one file between
265274
+ * harnesses): the same file is never injected twice. The total budget is
265275
+ * spent nearest first, so when it runs out the farthest parents are dropped,
265276
+ * not the working directory's own rules.
265277
+ */
265278
+ const readWorkspaceInstructions = async (dirs) => {
265279
+ const seen = /* @__PURE__ */ new Set();
265280
+ const byDir = [];
265281
+ let remaining = MAX_INSTRUCTIONS_TOTAL_BYTES;
265282
+ for (const dir of dirs) {
265283
+ const found = [];
265284
+ for (const source of INSTRUCTION_FILENAMES) {
265285
+ if (remaining <= 0) break;
265286
+ const filePath = path.join(dir, source);
265287
+ try {
265288
+ const real = await realpath(filePath);
265289
+ if (seen.has(real)) continue;
265290
+ seen.add(real);
265291
+ const { bytes, content } = truncateUtf8(await readFile(filePath, "utf8"), Math.min(MAX_INSTRUCTIONS_FILE_BYTES, remaining));
265292
+ remaining -= bytes;
265293
+ found.push({
265294
+ content,
265295
+ path: filePath,
265296
+ source
265297
+ });
265298
+ } catch {}
265299
+ }
265300
+ byDir.push(found);
265301
+ }
265302
+ return byDir.reverse().flat();
265303
+ };
265304
+ /**
265305
+ * Scan agent skill directories for the project (the working directory and its
265306
+ * parents up to the repository root) and the execution device. Nearer project
265307
+ * skills win over farther ones, and project skills over device skills, on name
265308
+ * collision. Approves each
265098
265309
  * discovered skill's preview root for the host preview protocol.
265099
265310
  */
265100
265311
  const listProjectSkills = async (params, deps = {}) => {
265101
265312
  const root = params.scope;
265102
- const skills = await collectSkills(createSkillRoots(root));
265313
+ const skills = await collectSkills(await createSkillRoots(root));
265103
265314
  if (skills.length > 0) await approvePreviewRoots(skills, deps);
265104
265315
  return {
265105
265316
  root,
@@ -265109,14 +265320,15 @@ const listProjectSkills = async (params, deps = {}) => {
265109
265320
  };
265110
265321
  /**
265111
265322
  * One-call "workspace init" scan: merge project and execution-device skills
265112
- * (deduped by name, project winning) and read the project-root agent
265113
- * instructions. Approves the project root regardless of what was found, since
265323
+ * (deduped by name, project winning) and read the agent instructions from the
265324
+ * working directory up to the repository root. Approves the project root regardless of what was found, since
265114
265325
  * the run is now bound to this root.
265115
265326
  */
265116
265327
  const initWorkspace = async (params, deps = {}) => {
265117
265328
  const root = params.scope;
265118
- const skills = await collectSkills(createSkillRoots(root));
265119
- const instructions = await readWorkspaceInstructions(root);
265329
+ const dirs = await resolveAgentFileDirs(root);
265330
+ const skills = await collectSkills([...createProjectSkillRoots(root, dirs), ...createDeviceSkillRoots()]);
265331
+ const instructions = await readWorkspaceInstructions(dirs);
265120
265332
  await approvePreviewRoots(skills, deps, [root]);
265121
265333
  return {
265122
265334
  instructions,
@@ -300730,15 +300942,20 @@ const createTerminalDeps = (terminals) => ({
300730
300942
  //#region ../../packages/heterogeneous-agents/src/labels.ts
300731
300943
  init_config();
300732
300944
  /**
300733
- * Display-name mapping for all heterogeneous agent types (local CLI + remote platform).
300945
+ * Display-name mapping for all heterogeneous agent types (local CLI, local
300946
+ * runtime, remote platform).
300734
300947
  *
300735
300948
  * Keys mirror the registry keys in `registry.ts` (adapter type). UI layers
300736
300949
  * use this to render user-facing names (e.g. "Claude Code is running")
300737
300950
  * without knowing adapter-specific branding.
300738
- * Add new types to HETEROGENEOUS_AGENT_CONFIGS or REMOTE_HETEROGENEOUS_AGENT_CONFIGS
300739
- * in config.ts to automatically include them here.
300951
+ * Add new types to HETEROGENEOUS_AGENT_CONFIGS, LOCAL_RUNTIME_HETEROGENEOUS_AGENT_CONFIGS
300952
+ * or REMOTE_HETEROGENEOUS_AGENT_CONFIGS in config.ts to automatically include them here.
300740
300953
  */
300741
- const HETEROGENEOUS_TYPE_LABELS = Object.fromEntries([...HETEROGENEOUS_AGENT_CONFIGS.map((config) => [config.type, config.title]), ...REMOTE_HETEROGENEOUS_AGENT_CONFIGS.map((config) => [config.type, config.title])]);
300954
+ const HETEROGENEOUS_TYPE_LABELS = Object.fromEntries([
300955
+ ...HETEROGENEOUS_AGENT_CONFIGS.map((config) => [config.type, config.title]),
300956
+ ...LOCAL_RUNTIME_HETEROGENEOUS_AGENT_CONFIGS.map((config) => [config.type, config.title]),
300957
+ ...REMOTE_HETEROGENEOUS_AGENT_CONFIGS.map((config) => [config.type, config.title])
300958
+ ]);
300742
300959
  const getHeterogeneousTypeLabel = (type) => {
300743
300960
  if (!type) return void 0;
300744
300961
  return Object.hasOwn(HETEROGENEOUS_TYPE_LABELS, type) ? HETEROGENEOUS_TYPE_LABELS[type] : type;
@@ -301065,6 +301282,22 @@ const getCatalogErrorMessage = (code, type) => {
301065
301282
  return `${name} model discovery failed`;
301066
301283
  };
301067
301284
  /**
301285
+ * Resolve the runtime to launch for catalog discovery. DeepSeek Harness is a
301286
+ * protocol runtime with no local-CLI descriptor, so it is not covered by
301287
+ * {@link resolveHeteroSpawnCommand}; its own detector validates the version and
301288
+ * resolves the executable the same way.
301289
+ */
301290
+ const resolveCatalogCommand = async (params, env) => {
301291
+ if (params.type !== "deepseek-harness") return resolveHeteroSpawnCommand(params.type, params.command);
301292
+ const requested = params.command?.trim();
301293
+ if (requested && requested !== "dsh") return { command: requested };
301294
+ const detected = await detectDshCommand("dsh", env).catch(() => void 0);
301295
+ return detected?.available && detected.path ? {
301296
+ command: detected.path,
301297
+ pathEnv: detected.resolvedPathEnv
301298
+ } : { command: "dsh" };
301299
+ };
301300
+ /**
301068
301301
  * Query the model catalog from the same host that will execute the agent.
301069
301302
  *
301070
301303
  * Callers own construction of the full child environment so Desktop can apply
@@ -301074,8 +301307,8 @@ const getCatalogErrorMessage = (code, type) => {
301074
301307
  */
301075
301308
  const listHeterogeneousAgentModels = async (params) => {
301076
301309
  const updatedAt = Date.now();
301077
- const resolved = await resolveHeteroSpawnCommand(params.type, params.command);
301078
301310
  const callerEnv = params.env ?? process.env;
301311
+ const resolved = await resolveCatalogCommand(params, callerEnv);
301079
301312
  const mergedPath = [...new Set([callerEnv.PATH, resolved.pathEnv].filter(Boolean).join(path.delimiter).split(path.delimiter))].filter(Boolean).join(path.delimiter);
301080
301313
  const env = {
301081
301314
  ...callerEnv,
@@ -301094,6 +301327,17 @@ const listHeterogeneousAgentModels = async (params) => {
301094
301327
  updatedAt
301095
301328
  };
301096
301329
  const cwd = resolveHeteroSpawnCwd(params.cwd ?? process.cwd());
301330
+ if (params.type === "deepseek-harness") return {
301331
+ models: await listDshAcpModels({
301332
+ args: params.args,
301333
+ commandPath: resolved.command,
301334
+ cwd: cwd ?? process.cwd(),
301335
+ env,
301336
+ timeoutMs: MODEL_CATALOG_TIMEOUT_MS
301337
+ }),
301338
+ status: "success",
301339
+ updatedAt
301340
+ };
301097
301341
  if (params.type === "copilot") return {
301098
301342
  models: await listCopilotAcpModels({
301099
301343
  args: params.args,
@@ -306393,9 +306637,9 @@ const getSubprocessResult = ({ stdout }) => {
306393
306637
  //#region node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/utils/standard-stream.js
306394
306638
  const isStandardStream = (stream) => STANDARD_STREAMS.includes(stream);
306395
306639
  const STANDARD_STREAMS = [
306396
- process$1.stdin,
306397
- process$1.stdout,
306398
- process$1.stderr
306640
+ _w.stdin,
306641
+ _w.stdout,
306642
+ _w.stderr
306399
306643
  ];
306400
306644
  const STANDARD_STREAMS_ALIASES = [
306401
306645
  "stdin",
@@ -306520,9 +306764,9 @@ const NO_ESCAPE_REGEXP = /^[\w./-]+$/;
306520
306764
  //#endregion
306521
306765
  //#region node_modules/.pnpm/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js
306522
306766
  function isUnicodeSupported() {
306523
- const { env } = process$1;
306767
+ const { env } = _w;
306524
306768
  const { TERM, TERM_PROGRAM } = env;
306525
- if (process$1.platform !== "win32") return TERM !== "linux";
306769
+ if (_w.platform !== "win32") return TERM !== "linux";
306526
306770
  return Boolean(env.WT_SESSION) || Boolean(env.TERMINUS_SUBLIME) || env.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
306527
306771
  }
306528
306772
 
@@ -307467,7 +307711,7 @@ function traversePathUp(startPath) {
307467
307711
 
307468
307712
  //#endregion
307469
307713
  //#region node_modules/.pnpm/npm-run-path@6.0.0/node_modules/npm-run-path/index.js
307470
- const npmRunPath = ({ cwd = process$1.cwd(), path: pathOption = process$1.env[pathKey()], preferLocal = true, execPath = process$1.execPath, addExecPath = true } = {}) => {
307714
+ const npmRunPath = ({ cwd = _w.cwd(), path: pathOption = _w.env[pathKey()], preferLocal = true, execPath = _w.execPath, addExecPath = true } = {}) => {
307471
307715
  const cwdPath = path.resolve(toPath(cwd));
307472
307716
  const result = [];
307473
307717
  const pathParts = pathOption.split(path.delimiter);
@@ -307485,7 +307729,7 @@ const applyExecPath = (result, pathParts, execPath, cwdPath) => {
307485
307729
  const pathPart = path.resolve(cwdPath, toPath(execPath), "..");
307486
307730
  if (!pathParts.includes(pathPart)) result.push(pathPart);
307487
307731
  };
307488
- const npmRunPathEnv = ({ env = process$1.env, ...options } = {}) => {
307732
+ const npmRunPathEnv = ({ env = _w.env, ...options } = {}) => {
307489
307733
  env = { ...env };
307490
307734
  const pathName = pathKey({ env });
307491
307735
  options.path = env[pathName];
@@ -308620,7 +308864,7 @@ const normalizeCwd = (cwd = getDefaultCwd()) => {
308620
308864
  };
308621
308865
  const getDefaultCwd = () => {
308622
308866
  try {
308623
- return process$1.cwd();
308867
+ return _w.cwd();
308624
308868
  } catch (error) {
308625
308869
  error.message = `The current directory does not exist.\n${error.message}`;
308626
308870
  throw error;
@@ -308655,7 +308899,7 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
308655
308899
  options.killSignal = normalizeKillSignal(options.killSignal);
308656
308900
  options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
308657
308901
  options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
308658
- if (process$1.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
308902
+ if (_w.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
308659
308903
  return {
308660
308904
  file,
308661
308905
  commandArguments,
@@ -308682,7 +308926,7 @@ const addDefaultOptions = ({ extendEnv = true, preferLocal = false, cwd, localDi
308682
308926
  });
308683
308927
  const getEnv = ({ env: envOption, extendEnv, preferLocal, node, localDirectory, nodePath }) => {
308684
308928
  const env = extendEnv ? {
308685
- ...process$1.env,
308929
+ ..._w.env,
308686
308930
  ...envOption
308687
308931
  } : envOption;
308688
308932
  if (preferLocal || node) return npmRunPathEnv({
@@ -309684,12 +309928,12 @@ const guessStreamDirection = {
309684
309928
  }
309685
309929
  };
309686
309930
  const getStandardStreamDirection = (value) => {
309687
- if ([0, process$1.stdin].includes(value)) return "input";
309931
+ if ([0, _w.stdin].includes(value)) return "input";
309688
309932
  if ([
309689
309933
  1,
309690
309934
  2,
309691
- process$1.stdout,
309692
- process$1.stderr
309935
+ _w.stdout,
309936
+ _w.stderr
309693
309937
  ].includes(value)) return "output";
309694
309938
  };
309695
309939
  const DEFAULT_DIRECTION = "output";
@@ -310753,9 +310997,9 @@ const addIpcMethods = (subprocess, { ipc }) => {
310753
310997
  Object.assign(subprocess, getIpcMethods(subprocess, false, ipc));
310754
310998
  };
310755
310999
  const getIpcExport = () => {
310756
- const anyProcess = process$1;
311000
+ const anyProcess = _w;
310757
311001
  const isSubprocess = true;
310758
- const ipc = process$1.channel !== void 0;
311002
+ const ipc = _w.channel !== void 0;
310759
311003
  return {
310760
311004
  ...getIpcMethods(anyProcess, isSubprocess, ipc),
310761
311005
  getCancelSignal: getCancelSignal$1.bind(void 0, {
@@ -311232,7 +311476,7 @@ var SignalExitFallback = class extends SignalExitBase {
311232
311476
  };
311233
311477
  var SignalExit = class extends SignalExitBase {
311234
311478
  /* c8 ignore start */
311235
- #hupSig = process$2.platform === "win32" ? "SIGINT" : "SIGHUP";
311479
+ #hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
311236
311480
  /* c8 ignore stop */
311237
311481
  #emitter = new Emitter();
311238
311482
  #process;
@@ -311327,8 +311571,8 @@ var SignalExit = class extends SignalExitBase {
311327
311571
  } else return og.call(this.#process, ev, ...args);
311328
311572
  }
311329
311573
  };
311330
- const process$2 = globalThis.process;
311331
- const { onExit, load: load$1, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
311574
+ const process$1 = globalThis.process;
311575
+ const { onExit, load: load$1, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
311332
311576
 
311333
311577
  //#endregion
311334
311578
  //#region node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/terminate/cleanup.js
@@ -551665,7 +551909,7 @@ var stdio_exports = /* @__PURE__ */ __exportAll$2({
551665
551909
  function getDefaultEnvironment() {
551666
551910
  const env = {};
551667
551911
  for (const key of DEFAULT_INHERITED_ENV_VARS) {
551668
- const value = process$1.env[key];
551912
+ const value = _w.env[key];
551669
551913
  if (value === void 0) continue;
551670
551914
  if (value.startsWith("()")) continue;
551671
551915
  env[key] = value;
@@ -551676,7 +551920,7 @@ var import_cross_spawn, DEFAULT_INHERITED_ENV_VARS, StdioClientTransport;
551676
551920
  var init_stdio = __esmMin((() => {
551677
551921
  init_src_CeKsbNLO();
551678
551922
  import_cross_spawn = /* @__PURE__ */ __toESM$2(require_cross_spawn(), 1);
551679
- DEFAULT_INHERITED_ENV_VARS = process$1.platform === "win32" ? [
551923
+ DEFAULT_INHERITED_ENV_VARS = _w.platform === "win32" ? [
551680
551924
  "APPDATA",
551681
551925
  "COMSPEC",
551682
551926
  "HOMEDRIVE",
@@ -551733,7 +551977,7 @@ var init_stdio = __esmMin((() => {
551733
551977
  this._serverParams.stderr ?? "inherit"
551734
551978
  ],
551735
551979
  shell: false,
551736
- windowsHide: process$1.platform === "win32",
551980
+ windowsHide: _w.platform === "win32",
551737
551981
  cwd: this._serverParams.cwd
551738
551982
  });
551739
551983
  this._process.on("error", (error) => {
@@ -556026,9 +556270,9 @@ const buildTtsParams = (options) => {
556026
556270
  };
556027
556271
  };
556028
556272
  function registerTtsCommand(parent) {
556029
- parent.command("tts <text>").description("Convert text to speech").option("-o, --output <file>", "Output audio file path (default: output.<format>)").option("--voice <voice>", "Voice id (default: the model's default voice)").option("--speed <n>", "Speed multiplier").option("--pitch <n>", "Pitch adjustment").option("--volume <n>", "Volume adjustment").option("--emotion <emotion>", "Emotion, e.g. happy, sad").option("--format <format>", "Audio format: mp3, opus, aac").option("--sample-rate <hz>", "Output sample rate in Hz").option("--instructions <text>", "Style instructions, for models that accept them").option("--params <json>", "Extra standard TTS params as a JSON object").option("-m, --model <model>", "Model ID (provider/model format)", "tts-1").option("-p, --provider <provider>", "Provider name (derived from model if omitted)").action(async (text, options) => {
556273
+ parent.command("tts <text>").description("Convert text to speech").option("-o, --output <file>", "Output audio file path (default: output.<format>)").option("--voice <voice>", "Voice id (default: the voice saved for the model in provider settings, else the model's default)").option("--speed <n>", "Speed multiplier").option("--pitch <n>", "Pitch adjustment").option("--volume <n>", "Volume adjustment").option("--emotion <emotion>", "Emotion, e.g. happy, sad").option("--format <format>", "Audio format: mp3, opus, aac (as the model supports)").option("--sample-rate <hz>", "Output sample rate in Hz").option("--instructions <text>", "Style instructions, for models that accept them").option("--params <json>", "Extra standard TTS params as a JSON object").option("-m, --model <model>", "Model ID (provider/model format)", "tts-1").option("-p, --provider <provider>", "Provider name (default: the model prefix, else the built-in model's provider)").action(async (text, options) => {
556030
556274
  const parts = options.model.split("/");
556031
- const provider = options.provider || (parts.length > 1 ? parts[0] : "openai");
556275
+ const provider = options.provider || (parts.length > 1 ? parts[0] : void 0);
556032
556276
  const model = parts.length > 1 ? parts.slice(1).join("/") : options.model;
556033
556277
  let params;
556034
556278
  try {
@@ -574334,7 +574578,7 @@ var WebStandardStreamableHTTPServerTransport = class {
574334
574578
  };
574335
574579
 
574336
574580
  //#endregion
574337
- //#region node_modules/.pnpm/@hono+node-server@2.1.7_hono@4.13.18/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
574581
+ //#region node_modules/.pnpm/@hono+node-server@2.1.8_hono@4.13.18/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
574338
574582
  const X_ALREADY_SENT = "x-hono-already-sent";
574339
574583
 
574340
574584
  //#endregion
@@ -574363,7 +574607,7 @@ const defineWebSocketHelper = (handler) => {
574363
574607
  };
574364
574608
 
574365
574609
  //#endregion
574366
- //#region node_modules/.pnpm/@hono+node-server@2.1.7_hono@4.13.18/node_modules/@hono/node-server/dist/index.mjs
574610
+ //#region node_modules/.pnpm/@hono+node-server@2.1.8_hono@4.13.18/node_modules/@hono/node-server/dist/index.mjs
574367
574611
  var RequestError = class extends Error {
574368
574612
  constructor(message, options) {
574369
574613
  super(message, options);
@@ -574894,6 +575138,7 @@ Object.defineProperty(requestPrototype, "signal", { get() {
574894
575138
  "cache",
574895
575139
  "credentials",
574896
575140
  "destination",
575141
+ "duplex",
574897
575142
  "integrity",
574898
575143
  "mode",
574899
575144
  "redirect",
@@ -575113,6 +575358,11 @@ function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromi
575113
575358
  const cancel = (error) => {
575114
575359
  reader.cancel(error).catch(() => {});
575115
575360
  };
575361
+ const stream = writable.stream;
575362
+ if (writable.destroyed || stream?.closed || stream?.destroyed) {
575363
+ cancel();
575364
+ return reader.closed;
575365
+ }
575116
575366
  writable.on("close", cancel);
575117
575367
  writable.on("error", cancel);
575118
575368
  (currentReadPromise ?? reader.read()).then(flow, handleStreamError);
@@ -575130,7 +575380,7 @@ function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromi
575130
575380
  try {
575131
575381
  if (done) writable.end();
575132
575382
  else if (!writable.write(value)) writable.once("drain", onDrain);
575133
- else return reader.read().then(flow, handleStreamError);
575383
+ else reader.read().then(flow, handleStreamError);
575134
575384
  } catch (e) {
575135
575385
  handleStreamError(e);
575136
575386
  }
@@ -575138,7 +575388,10 @@ function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromi
575138
575388
  }
575139
575389
  function writeFromReadableStream(stream, writable) {
575140
575390
  if (stream.locked) throw new TypeError("ReadableStream is locked.");
575141
- else if (writable.destroyed) return;
575391
+ else if (writable.destroyed) {
575392
+ stream.cancel().catch(() => {});
575393
+ return;
575394
+ }
575142
575395
  return writeFromReadableStreamDefaultReader(stream.getReader(), writable);
575143
575396
  }
575144
575397
  const buildOutgoingHttpHeaders = (headers, defaultContentType) => {
@@ -575329,10 +575582,7 @@ const responseViaResponseObject = async (res, outgoing, options = {}) => {
575329
575582
  let maxReadCount = 2;
575330
575583
  for (let i = 0; i < maxReadCount; i++) {
575331
575584
  currentReadPromise ||= reader.read();
575332
- const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => {
575333
- console.error(e);
575334
- done = true;
575335
- });
575585
+ const chunk = await readWithoutBlocking(currentReadPromise);
575336
575586
  if (!chunk) {
575337
575587
  if (i === 1) {
575338
575588
  await new Promise((resolve) => setTimeout(resolve));