adhdev 0.9.41 → 0.9.43

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/cli/index.js CHANGED
@@ -11398,6 +11398,7 @@ var dist_exports = {};
11398
11398
  __export(dist_exports, {
11399
11399
  DEFAULT_SESSION_HOST_COLS: () => DEFAULT_SESSION_HOST_COLS,
11400
11400
  DEFAULT_SESSION_HOST_ROWS: () => DEFAULT_SESSION_HOST_ROWS,
11401
+ DEFAULT_SESSION_RING_BUFFER_MAX_BYTES: () => DEFAULT_SESSION_RING_BUFFER_MAX_BYTES,
11401
11402
  SessionHostClient: () => SessionHostClient,
11402
11403
  SessionHostRegistry: () => SessionHostRegistry,
11403
11404
  SessionRingBuffer: () => SessionRingBuffer,
@@ -11628,7 +11629,7 @@ function ensureNodePtySpawnHelperPermissions(logFn) {
11628
11629
  } catch {
11629
11630
  }
11630
11631
  }
11631
- var import_crypto3, path9, os9, path22, net, import_crypto4, os22, path32, __require, SessionRingBuffer, DEFAULT_SESSION_HOST_COLS, DEFAULT_SESSION_HOST_ROWS, LIVE_LIFECYCLES2, SessionHostRegistry, SessionHostClient;
11632
+ var import_crypto3, path9, os9, path22, net, import_crypto4, os22, path32, __require, DEFAULT_SESSION_RING_BUFFER_MAX_BYTES, SessionRingBuffer, DEFAULT_SESSION_HOST_COLS, DEFAULT_SESSION_HOST_ROWS, LIVE_LIFECYCLES2, SessionHostRegistry, SessionHostClient;
11632
11633
  var init_dist = __esm({
11633
11634
  "../../oss/packages/session-host-core/dist/index.mjs"() {
11634
11635
  "use strict";
@@ -11646,13 +11647,14 @@ var init_dist = __esm({
11646
11647
  if (typeof require !== "undefined") return require.apply(this, arguments);
11647
11648
  throw Error('Dynamic require of "' + x + '" is not supported');
11648
11649
  });
11650
+ DEFAULT_SESSION_RING_BUFFER_MAX_BYTES = 4 * 1024 * 1024;
11649
11651
  SessionRingBuffer = class {
11650
11652
  maxBytes;
11651
11653
  chunks = [];
11652
11654
  nextSeq = 1;
11653
11655
  totalBytes = 0;
11654
11656
  constructor(options = {}) {
11655
- this.maxBytes = options.maxBytes ?? 512 * 1024;
11657
+ this.maxBytes = options.maxBytes ?? DEFAULT_SESSION_RING_BUFFER_MAX_BYTES;
11656
11658
  }
11657
11659
  append(data) {
11658
11660
  const normalized = typeof data === "string" ? data : String(data ?? "");
@@ -12557,6 +12559,10 @@ function normalizeCliParsedMessages(parsedMessages, options) {
12557
12559
  kind: message.kind,
12558
12560
  id: message.id,
12559
12561
  index: message.index,
12562
+ providerUnitKey: message.providerUnitKey,
12563
+ bubbleId: message.bubbleId,
12564
+ bubbleState: message.bubbleState,
12565
+ _turnKey: message._turnKey,
12560
12566
  meta: message.meta,
12561
12567
  senderName: message.senderName
12562
12568
  })));
@@ -12690,6 +12696,8 @@ function resolveCliSpawnPlan(options) {
12690
12696
  shellCmd = binaryPath;
12691
12697
  shellArgs = allArgs;
12692
12698
  }
12699
+ const env3 = buildCliSpawnEnv(process.env, spawnConfig.env);
12700
+ env3.TERMINAL_CWD = workingDir;
12693
12701
  return {
12694
12702
  binaryPath,
12695
12703
  allArgs,
@@ -12701,7 +12709,7 @@ function resolveCliSpawnPlan(options) {
12701
12709
  cols: DEFAULT_SESSION_HOST_COLS,
12702
12710
  rows: DEFAULT_SESSION_HOST_ROWS,
12703
12711
  cwd: workingDir,
12704
- env: buildCliSpawnEnv(process.env, spawnConfig.env)
12712
+ env: env3
12705
12713
  }
12706
12714
  };
12707
12715
  }
@@ -14169,6 +14177,10 @@ var init_provider_cli_adapter = __esm({
14169
14177
  kind: typeof message.kind === "string" ? message.kind : void 0,
14170
14178
  id: typeof message.id === "string" ? message.id : void 0,
14171
14179
  index: typeof message.index === "number" ? message.index : void 0,
14180
+ providerUnitKey: typeof message.providerUnitKey === "string" ? message.providerUnitKey : void 0,
14181
+ bubbleId: typeof message.bubbleId === "string" ? message.bubbleId : void 0,
14182
+ bubbleState: typeof message.bubbleState === "string" ? message.bubbleState : void 0,
14183
+ _turnKey: typeof message._turnKey === "string" ? message._turnKey : void 0,
14172
14184
  meta: message.meta && typeof message.meta === "object" ? { ...message.meta } : void 0,
14173
14185
  senderName: typeof message.senderName === "string" ? message.senderName : void 0
14174
14186
  }));
@@ -14198,6 +14210,10 @@ var init_provider_cli_adapter = __esm({
14198
14210
  kind: message.kind,
14199
14211
  id: message.id || `msg_${index}`,
14200
14212
  index: typeof message.index === "number" ? message.index : index,
14213
+ providerUnitKey: message.providerUnitKey,
14214
+ bubbleId: message.bubbleId,
14215
+ bubbleState: message.bubbleState,
14216
+ _turnKey: message._turnKey,
14201
14217
  meta: message.meta,
14202
14218
  senderName: message.senderName
14203
14219
  };
@@ -14234,6 +14250,10 @@ var init_provider_cli_adapter = __esm({
14234
14250
  senderName: message.senderName,
14235
14251
  id: message.id || `msg_${index}`,
14236
14252
  index: typeof message.index === "number" ? message.index : index,
14253
+ providerUnitKey: message.providerUnitKey,
14254
+ bubbleId: message.bubbleId,
14255
+ bubbleState: message.bubbleState,
14256
+ _turnKey: message._turnKey,
14237
14257
  receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
14238
14258
  });
14239
14259
  });
@@ -79708,8 +79728,12 @@ function sendToPeer(peer, data) {
79708
79728
  }
79709
79729
  return false;
79710
79730
  }
79731
+ const json2 = JSON.stringify(data);
79732
+ if (messageType === "command_result" && json2.length > MAX_INLINE_JSON_MESSAGE_CHARS) {
79733
+ return sendChunkedCommandResult(peer, peerId, requestId, json2);
79734
+ }
79711
79735
  try {
79712
- peer.dataChannel.sendMessage(JSON.stringify(data));
79736
+ peer.dataChannel.sendMessage(json2);
79713
79737
  return true;
79714
79738
  } catch (error48) {
79715
79739
  if (messageType === "command_result") {
@@ -79718,6 +79742,28 @@ function sendToPeer(peer, data) {
79718
79742
  return false;
79719
79743
  }
79720
79744
  }
79745
+ function sendChunkedCommandResult(peer, peerId, requestId, json2) {
79746
+ const chunkId = requestId || `command_result_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
79747
+ const total = Math.ceil(json2.length / JSON_CHUNK_PAYLOAD_CHARS);
79748
+ logDebug(`command_result chunked: peer=${peerId} id=${requestId || "-"} chars=${json2.length} chunks=${total}`);
79749
+ for (let index = 0; index < total; index += 1) {
79750
+ const chunk = json2.slice(index * JSON_CHUNK_PAYLOAD_CHARS, (index + 1) * JSON_CHUNK_PAYLOAD_CHARS);
79751
+ try {
79752
+ peer.dataChannel?.sendMessage(JSON.stringify({
79753
+ type: "command_result_chunk",
79754
+ id: requestId,
79755
+ chunkId,
79756
+ index,
79757
+ total,
79758
+ data: chunk
79759
+ }));
79760
+ } catch (error48) {
79761
+ log(`command_result send failed: peer=${peerId} id=${requestId || "-"} chunk=${index + 1}/${total} error=${error48?.message || error48}`);
79762
+ return false;
79763
+ }
79764
+ }
79765
+ return true;
79766
+ }
79721
79767
  function routeDataChannelMessage(peerId, msg, peers, handlers) {
79722
79768
  const text = typeof msg === "string" ? msg : msg.toString("utf-8");
79723
79769
  try {
@@ -79998,11 +80044,14 @@ async function handleFileRequest(peerId, req, peers, handlers) {
79998
80044
  }
79999
80045
  sendToPeer(peer, response);
80000
80046
  }
80047
+ var MAX_INLINE_JSON_MESSAGE_CHARS, JSON_CHUNK_PAYLOAD_CHARS;
80001
80048
  var init_data_channel_router = __esm({
80002
80049
  "src/daemon-p2p/data-channel-router.ts"() {
80003
80050
  "use strict";
80004
80051
  init_permission();
80005
80052
  init_log();
80053
+ MAX_INLINE_JSON_MESSAGE_CHARS = 6e4;
80054
+ JSON_CHUNK_PAYLOAD_CHARS = 32e3;
80006
80055
  }
80007
80056
  });
80008
80057
 
@@ -88391,7 +88440,7 @@ var init_adhdev_daemon = __esm({
88391
88440
  init_version();
88392
88441
  init_src();
88393
88442
  init_runtime_defaults();
88394
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.41" });
88443
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.43" });
88395
88444
  AdhdevDaemon = class _AdhdevDaemon {
88396
88445
  localHttpServer = null;
88397
88446
  localWss = null;