snow-ai 0.7.5 → 0.7.6

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/bundle/cli.mjs CHANGED
@@ -1513,7 +1513,7 @@ var require_react_development = __commonJS({
1513
1513
  var dispatcher = resolveDispatcher();
1514
1514
  return dispatcher.useReducer(reducer2, initialArg, init);
1515
1515
  }
1516
- function useRef24(initialValue) {
1516
+ function useRef25(initialValue) {
1517
1517
  var dispatcher = resolveDispatcher();
1518
1518
  return dispatcher.useRef(initialValue);
1519
1519
  }
@@ -1529,7 +1529,7 @@ var require_react_development = __commonJS({
1529
1529
  var dispatcher = resolveDispatcher();
1530
1530
  return dispatcher.useLayoutEffect(create3, deps);
1531
1531
  }
1532
- function useCallback64(callback, deps) {
1532
+ function useCallback65(callback, deps) {
1533
1533
  var dispatcher = resolveDispatcher();
1534
1534
  return dispatcher.useCallback(callback, deps);
1535
1535
  }
@@ -2296,7 +2296,7 @@ var require_react_development = __commonJS({
2296
2296
  exports2.memo = memo9;
2297
2297
  exports2.startTransition = startTransition;
2298
2298
  exports2.unstable_act = act;
2299
- exports2.useCallback = useCallback64;
2299
+ exports2.useCallback = useCallback65;
2300
2300
  exports2.useContext = useContext13;
2301
2301
  exports2.useDebugValue = useDebugValue;
2302
2302
  exports2.useDeferredValue = useDeferredValue;
@@ -2307,7 +2307,7 @@ var require_react_development = __commonJS({
2307
2307
  exports2.useLayoutEffect = useLayoutEffect2;
2308
2308
  exports2.useMemo = useMemo48;
2309
2309
  exports2.useReducer = useReducer8;
2310
- exports2.useRef = useRef24;
2310
+ exports2.useRef = useRef25;
2311
2311
  exports2.useState = useState87;
2312
2312
  exports2.useSyncExternalStore = useSyncExternalStore4;
2313
2313
  exports2.useTransition = useTransition;
@@ -434582,6 +434582,92 @@ var init_subAgentTypes = __esm({
434582
434582
  }
434583
434583
  });
434584
434584
 
434585
+ // dist/utils/core/compressionCoordinator.js
434586
+ var CompressionCoordinator, compressionCoordinator;
434587
+ var init_compressionCoordinator = __esm({
434588
+ "dist/utils/core/compressionCoordinator.js"() {
434589
+ "use strict";
434590
+ CompressionCoordinator = class {
434591
+ constructor() {
434592
+ Object.defineProperty(this, "_compressing", {
434593
+ enumerable: true,
434594
+ configurable: true,
434595
+ writable: true,
434596
+ value: /* @__PURE__ */ new Set()
434597
+ });
434598
+ Object.defineProperty(this, "_waiters", {
434599
+ enumerable: true,
434600
+ configurable: true,
434601
+ writable: true,
434602
+ value: []
434603
+ });
434604
+ }
434605
+ /**
434606
+ * Acquire the compression lock for `id`.
434607
+ * If someone *else* already holds a lock, this will block until they release.
434608
+ */
434609
+ async acquireLock(id) {
434610
+ await this.waitUntilFree(id);
434611
+ this._compressing.add(id);
434612
+ }
434613
+ /**
434614
+ * Release the compression lock for `id` and wake any waiters
434615
+ * whose blocking condition is now satisfied.
434616
+ */
434617
+ releaseLock(id) {
434618
+ this._compressing.delete(id);
434619
+ this._drainWaiters();
434620
+ }
434621
+ /**
434622
+ * Check whether anyone *other than* `excludeId` is currently compressing.
434623
+ */
434624
+ isCompressing(excludeId) {
434625
+ if (excludeId === void 0)
434626
+ return this._compressing.size > 0;
434627
+ for (const id of this._compressing) {
434628
+ if (id !== excludeId)
434629
+ return true;
434630
+ }
434631
+ return false;
434632
+ }
434633
+ /**
434634
+ * Returns a promise that resolves once no one *other than* `excludeId`
434635
+ * holds a compression lock. Resolves immediately if already free.
434636
+ */
434637
+ waitUntilFree(excludeId) {
434638
+ if (!this.isCompressing(excludeId))
434639
+ return Promise.resolve();
434640
+ return new Promise((resolve13) => {
434641
+ this._waiters.push({ resolve: resolve13, excludeId });
434642
+ });
434643
+ }
434644
+ /**
434645
+ * Convenience helper: wrap an async fn with acquire/release.
434646
+ */
434647
+ async withLock(id, fn) {
434648
+ await this.acquireLock(id);
434649
+ try {
434650
+ return await fn();
434651
+ } finally {
434652
+ this.releaseLock(id);
434653
+ }
434654
+ }
434655
+ _drainWaiters() {
434656
+ const still = [];
434657
+ for (const w of this._waiters) {
434658
+ if (!this.isCompressing(w.excludeId)) {
434659
+ w.resolve();
434660
+ } else {
434661
+ still.push(w);
434662
+ }
434663
+ }
434664
+ this._waiters = still;
434665
+ }
434666
+ };
434667
+ compressionCoordinator = new CompressionCoordinator();
434668
+ }
434669
+ });
434670
+
434585
434671
  // dist/utils/execution/subAgentStreamProcessor.js
434586
434672
  function createApiStream(config3, model, messages, allowedTools, sessionId, configProfile, abortSignal) {
434587
434673
  if (config3.requestMethod === "anthropic") {
@@ -434728,6 +434814,8 @@ async function handleContextCompression(ctx, config3, model) {
434728
434814
  type: "context_compressing",
434729
434815
  percentage: Math.round(ctxPercentage)
434730
434816
  });
434817
+ const lockId = ctx.instanceId || `subagent-${ctx.agent.id}`;
434818
+ await compressionCoordinator.acquireLock(lockId);
434731
434819
  try {
434732
434820
  const compressionResult = await compressSubAgentContext(ctx.messages, ctx.latestTotalTokens, config3.maxContextTokens, {
434733
434821
  model,
@@ -434751,6 +434839,8 @@ async function handleContextCompression(ctx, config3, model) {
434751
434839
  }
434752
434840
  } catch (compressError) {
434753
434841
  console.error(`[SubAgent:${ctx.agent.name}] Context compression failed:`, compressError);
434842
+ } finally {
434843
+ compressionCoordinator.releaseLock(lockId);
434754
434844
  }
434755
434845
  return false;
434756
434846
  }
@@ -434763,6 +434853,7 @@ var init_subAgentStreamProcessor = __esm({
434763
434853
  init_chat();
434764
434854
  init_subAgentContextCompressor();
434765
434855
  init_subAgentTypes();
434856
+ init_compressionCoordinator();
434766
434857
  }
434767
434858
  });
434768
434859
 
@@ -435741,6 +435832,7 @@ async function executeSubAgent(agentId, prompt, onMessage, abortSignal, requestT
435741
435832
  error: "Sub-agent execution aborted"
435742
435833
  };
435743
435834
  }
435835
+ await compressionCoordinator.waitUntilFree(ctx.instanceId);
435744
435836
  injectPendingMessages(ctx);
435745
435837
  const { config: config3, model } = await resolveConfig2(agent);
435746
435838
  const currentSession = sessionManager.getCurrentSession();
@@ -435918,6 +436010,7 @@ var init_subAgentExecutor = __esm({
435918
436010
  init_subAgentToolInterceptor();
435919
436011
  init_subAgentToolApproval();
435920
436012
  init_subAgentTypes();
436013
+ init_compressionCoordinator();
435921
436014
  }
435922
436015
  });
435923
436016
 
@@ -437433,6 +437526,7 @@ ${role ? `Your role: ${role}` : ""}
437433
437526
  error: "Teammate execution aborted"
437434
437527
  };
437435
437528
  }
437529
+ await compressionCoordinator.waitUntilFree(instanceId);
437436
437530
  const teammateMessages = teamTracker.dequeueTeammateMessages(instanceId);
437437
437531
  for (const msg of teammateMessages) {
437438
437532
  messages.push({
@@ -437564,6 +437658,7 @@ ${msg.content}`
437564
437658
  }
437565
437659
  });
437566
437660
  }
437661
+ await compressionCoordinator.acquireLock(instanceId);
437567
437662
  try {
437568
437663
  const compressionResult = await compressSubAgentContext2(messages, latestTotalTokens, config3.maxContextTokens, { model, requestMethod: config3.requestMethod, maxTokens: config3.maxTokens });
437569
437664
  if (compressionResult.compressed) {
@@ -437589,6 +437684,8 @@ ${msg.content}`
437589
437684
  }
437590
437685
  } catch (compressError) {
437591
437686
  console.error(`[Teammate:${memberName}] Context compression failed:`, compressError);
437687
+ } finally {
437688
+ compressionCoordinator.releaseLock(instanceId);
437592
437689
  }
437593
437690
  }
437594
437691
  }
@@ -437983,6 +438080,7 @@ var init_teamExecutor = __esm({
437983
438080
  init_teamWorktree();
437984
438081
  init_unifiedHooksExecutor();
437985
438082
  init_hookResultInterpreter();
438083
+ init_compressionCoordinator();
437986
438084
  }
437987
438085
  });
437988
438086
 
@@ -461212,6 +461310,7 @@ async function handleAutoCompression(options3) {
461212
461310
  return { compressed: false, hookFailed: false };
461213
461311
  }
461214
461312
  (_a20 = options3.setIsAutoCompressing) == null ? void 0 : _a20.call(options3, true);
461313
+ await compressionCoordinator.acquireLock("main");
461215
461314
  try {
461216
461315
  const compressingMessage = {
461217
461316
  role: "assistant",
@@ -461266,6 +461365,8 @@ async function handleAutoCompression(options3) {
461266
461365
  step: "failed",
461267
461366
  message: error40 instanceof Error ? error40.message : "Unknown error"
461268
461367
  });
461368
+ } finally {
461369
+ compressionCoordinator.releaseLock("main");
461269
461370
  }
461270
461371
  (_f = options3.setIsAutoCompressing) == null ? void 0 : _f.call(options3, false);
461271
461372
  return { compressed: false, hookFailed: false };
@@ -461276,6 +461377,7 @@ var init_autoCompressHandler = __esm({
461276
461377
  init_apiConfig();
461277
461378
  await init_autoCompress();
461278
461379
  init_sessionManager();
461380
+ init_compressionCoordinator();
461279
461381
  }
461280
461382
  });
461281
461383
 
@@ -558035,22 +558137,21 @@ function useKeyboardInput(options3) {
558035
558137
  };
558036
558138
  }, []);
558037
558139
  const deleteKeyPressed = (0, import_react97.useRef)(false);
558140
+ const stdinContext = use_stdin_default();
558141
+ const { internal_eventEmitter: inkEventEmitter } = stdinContext;
558038
558142
  (0, import_react97.useEffect)(() => {
558143
+ if (!inkEventEmitter)
558144
+ return;
558039
558145
  const handleRawInput = (data) => {
558040
- const str2 = data.toString();
558041
- if (str2 === "\x1B[3~") {
558146
+ if (data === "\x1B[3~") {
558042
558147
  deleteKeyPressed.current = true;
558043
558148
  }
558044
558149
  };
558045
- if (process.stdin.isTTY) {
558046
- process.stdin.on("data", handleRawInput);
558047
- }
558150
+ inkEventEmitter.on("input", handleRawInput);
558048
558151
  return () => {
558049
- if (process.stdin.isTTY) {
558050
- process.stdin.off("data", handleRawInput);
558051
- }
558152
+ inkEventEmitter.removeListener("input", handleRawInput);
558052
558153
  };
558053
- }, []);
558154
+ }, [inkEventEmitter]);
558054
558155
  const forceStateUpdate = () => {
558055
558156
  const text2 = buffer.getFullText();
558056
558157
  const cursorPos = buffer.getCursorPosition();
@@ -559014,28 +559115,33 @@ var init_useKeyboardInput = __esm({
559014
559115
  // dist/hooks/ui/useTerminalFocus.js
559015
559116
  function useTerminalFocus() {
559016
559117
  const [hasFocus, setHasFocus] = (0, import_react98.useState)(true);
559017
- (0, import_react98.useEffect)(() => {
559018
- let syncTimer = null;
559019
- const handleData = (data) => {
559020
- const str2 = data.toString();
559021
- if (str2 === "\x1B[I") {
559022
- setHasFocus(true);
559023
- return;
559024
- }
559025
- if (str2 === "\x1B[O") {
559026
- setHasFocus(false);
559027
- return;
559028
- }
559029
- const isPrintableInput = str2.length > 0 && !str2.startsWith("\x1B") && // Not an escape sequence
559030
- !/^[\x00-\x1f\x7f]+$/.test(str2);
559031
- if (!hasFocus && isPrintableInput) {
559118
+ const hasFocusRef = (0, import_react98.useRef)(true);
559119
+ const handleInput = (0, import_react98.useCallback)((input2) => {
559120
+ if (input2 === "[I" || input2 === "\x1B[I") {
559121
+ hasFocusRef.current = true;
559122
+ setHasFocus(true);
559123
+ return;
559124
+ }
559125
+ if (input2 === "[O" || input2 === "\x1B[O") {
559126
+ hasFocusRef.current = false;
559127
+ setHasFocus(false);
559128
+ return;
559129
+ }
559130
+ if (!hasFocusRef.current) {
559131
+ const isPrintableInput = input2.length > 0 && !input2.startsWith("\x1B") && !input2.startsWith("[") && !/^[\x00-\x1f\x7f]+$/.test(input2);
559132
+ if (isPrintableInput) {
559133
+ hasFocusRef.current = true;
559032
559134
  setHasFocus(true);
559033
559135
  }
559034
- };
559035
- process.stdin.on("data", handleData);
559136
+ }
559137
+ }, []);
559138
+ use_input_default(handleInput);
559139
+ (0, import_react98.useEffect)(() => {
559140
+ let syncTimer = null;
559036
559141
  const enableTimer = setTimeout(() => {
559037
559142
  process.stdout.write("\x1B[?1004h");
559038
559143
  syncTimer = setTimeout(() => {
559144
+ hasFocusRef.current = true;
559039
559145
  setHasFocus(true);
559040
559146
  }, 100);
559041
559147
  }, 50);
@@ -559045,22 +559151,23 @@ function useTerminalFocus() {
559045
559151
  clearTimeout(syncTimer);
559046
559152
  }
559047
559153
  process.stdout.write("\x1B[?1004l");
559048
- process.stdin.off("data", handleData);
559049
559154
  };
559050
559155
  }, []);
559051
559156
  const isFocusEvent = (input2) => {
559052
559157
  return input2 === "\x1B[I" || input2 === "\x1B[O";
559053
559158
  };
559054
559159
  const ensureFocus = () => {
559160
+ hasFocusRef.current = true;
559055
559161
  setHasFocus(true);
559056
559162
  };
559057
559163
  return { hasFocus, isFocusEvent, ensureFocus };
559058
559164
  }
559059
559165
  var import_react98;
559060
559166
  var init_useTerminalFocus = __esm({
559061
- "dist/hooks/ui/useTerminalFocus.js"() {
559167
+ async "dist/hooks/ui/useTerminalFocus.js"() {
559062
559168
  "use strict";
559063
559169
  import_react98 = __toESM(require_react(), 1);
559170
+ await init_build2();
559064
559171
  }
559065
559172
  });
559066
559173
 
@@ -562953,7 +563060,7 @@ var init_ChatInput = __esm({
562953
563060
  init_useClipboard();
562954
563061
  await init_useKeyboardInput();
562955
563062
  init_useTerminalSize();
562956
- init_useTerminalFocus();
563063
+ await init_useTerminalFocus();
562957
563064
  init_useAgentPicker();
562958
563065
  init_useTodoPicker();
562959
563066
  init_useSkillsPicker();
@@ -565469,6 +565576,7 @@ function useMessageProcessing(props) {
565469
565576
  setIsCompressing(true);
565470
565577
  streamingState.setIsAutoCompressing(true);
565471
565578
  setCompressionError(null);
565579
+ await compressionCoordinator.acquireLock("main");
565472
565580
  try {
565473
565581
  const compressingMessage = {
565474
565582
  role: "assistant",
@@ -565502,6 +565610,7 @@ ${errorMsg}`,
565502
565610
  streamingState.setIsAutoCompressing(false);
565503
565611
  return;
565504
565612
  } finally {
565613
+ compressionCoordinator.releaseLock("main");
565505
565614
  setIsCompressing(false);
565506
565615
  streamingState.setIsAutoCompressing(false);
565507
565616
  }
@@ -565987,6 +566096,7 @@ var init_useMessageProcessing = __esm({
565987
566096
  init_apiConfig();
565988
566097
  init_runningSubAgentTracker();
565989
566098
  init_teamTracker();
566099
+ init_compressionCoordinator();
565990
566100
  }
565991
566101
  });
565992
566102
 
@@ -579099,7 +579209,7 @@ var init_PanelsManager = __esm({
579099
579209
  });
579100
579210
 
579101
579211
  // dist/ui/components/tools/FileRollbackConfirmation.js
579102
- function FileRollbackConfirmation({ fileCount, filePaths, notebookCount, teamCount, previewSessionId, previewTargetMessageIndex, onConfirm }) {
579212
+ function FileRollbackConfirmation({ fileCount, filePaths, notebookCount, teamCount, previewSessionId, previewTargetMessageIndex, terminalWidth, onConfirm }) {
579103
579213
  const { t } = useI18n();
579104
579214
  const [selectedIndex, setSelectedIndex] = (0, import_react164.useState)(0);
579105
579215
  const [showFullList, setShowFullList] = (0, import_react164.useState)(false);
@@ -579261,6 +579371,11 @@ function FileRollbackConfirmation({ fileCount, filePaths, notebookCount, teamCou
579261
579371
  return import_react164.default.createElement(
579262
579372
  Box_default,
579263
579373
  { flexDirection: "column", marginX: 1, marginBottom: 1, padding: 1 },
579374
+ import_react164.default.createElement(
579375
+ Box_default,
579376
+ { height: 1 },
579377
+ import_react164.default.createElement(Text, { color: "gray", dimColor: true }, "\u2500".repeat(terminalWidth - 4))
579378
+ ),
579264
579379
  import_react164.default.createElement(
579265
579380
  Box_default,
579266
579381
  { marginBottom: 1 },
@@ -580187,7 +580302,7 @@ function ChatScreenPanels({ terminalWidth, workingDirectory, panelState, message
580187
580302
  import_react168.default.createElement(PermissionsPanel2, { alwaysApprovedTools, onRemoveTool: removeFromAlwaysApproved, onClearAll: clearAllAlwaysApproved, onClose: () => setShowPermissionsPanel(false) })
580188
580303
  )
580189
580304
  ),
580190
- snapshotState.pendingRollback && import_react168.default.createElement(FileRollbackConfirmation, { fileCount: snapshotState.pendingRollback.fileCount, filePaths: snapshotState.pendingRollback.filePaths || [], notebookCount: snapshotState.pendingRollback.notebookCount, teamCount: snapshotState.pendingRollback.teamCount, previewSessionId: (_a20 = sessionManager.getCurrentSession()) == null ? void 0 : _a20.id, previewTargetMessageIndex: snapshotState.pendingRollback.messageIndex, onConfirm: handleRollbackConfirm })
580305
+ snapshotState.pendingRollback && import_react168.default.createElement(FileRollbackConfirmation, { fileCount: snapshotState.pendingRollback.fileCount, filePaths: snapshotState.pendingRollback.filePaths || [], notebookCount: snapshotState.pendingRollback.notebookCount, teamCount: snapshotState.pendingRollback.teamCount, previewSessionId: (_a20 = sessionManager.getCurrentSession()) == null ? void 0 : _a20.id, previewTargetMessageIndex: snapshotState.pendingRollback.messageIndex, terminalWidth, onConfirm: handleRollbackConfirm })
580191
580306
  );
580192
580307
  }
580193
580308
  var import_react168, PermissionsPanel2, NewPromptPanel2, SubAgentDepthPanel2;
@@ -581160,7 +581275,7 @@ var init_ChatScreen = __esm({
581160
581275
  init_useStreamingState();
581161
581276
  await init_useCommandHandler();
581162
581277
  init_useTerminalSize();
581163
- init_useTerminalFocus();
581278
+ await init_useTerminalFocus();
581164
581279
  init_useBashMode();
581165
581280
  init_useTerminalExecutionState();
581166
581281
  init_useSchedulerExecutionState();
@@ -597558,7 +597673,7 @@ var require_package3 = __commonJS({
597558
597673
  "package.json"(exports2, module2) {
597559
597674
  module2.exports = {
597560
597675
  name: "snow-ai",
597561
- version: "0.7.5",
597676
+ version: "0.7.6",
597562
597677
  description: "Agentic coding in your terminal",
597563
597678
  license: "MIT",
597564
597679
  bin: {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-ai",
3
- "version": "0.7.5",
3
+ "version": "0.7.6",
4
4
  "description": "Agentic coding in your terminal",
5
5
  "license": "MIT",
6
6
  "bin": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-ai",
3
- "version": "0.7.5",
3
+ "version": "0.7.6",
4
4
  "description": "Agentic coding in your terminal",
5
5
  "license": "MIT",
6
6
  "bin": {