@corbat-tech/coco 2.22.1 → 2.22.2

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
@@ -1016,6 +1016,7 @@ var init_anthropic = __esm({
1016
1016
  */
1017
1017
  async *stream(messages, options) {
1018
1018
  this.ensureInitialized();
1019
+ let timeoutTriggered = false;
1019
1020
  try {
1020
1021
  const stream = await this.client.messages.stream(
1021
1022
  {
@@ -1033,6 +1034,7 @@ var init_anthropic = __esm({
1033
1034
  const timeoutInterval = setInterval(() => {
1034
1035
  if (Date.now() - lastActivityTime > streamTimeout) {
1035
1036
  clearInterval(timeoutInterval);
1037
+ timeoutTriggered = true;
1036
1038
  timeoutController.abort();
1037
1039
  }
1038
1040
  }, 5e3);
@@ -1063,6 +1065,11 @@ var init_anthropic = __esm({
1063
1065
  throw new Error(`Stream timeout: No response from LLM for ${streamTimeout / 1e3}s`);
1064
1066
  }
1065
1067
  } catch (error) {
1068
+ if (timeoutTriggered) {
1069
+ throw new Error(
1070
+ `Stream timeout: No response from LLM for ${(this.config.timeout ?? 12e4) / 1e3}s`
1071
+ );
1072
+ }
1066
1073
  throw this.handleError(error);
1067
1074
  }
1068
1075
  }
@@ -1071,6 +1078,7 @@ var init_anthropic = __esm({
1071
1078
  */
1072
1079
  async *streamWithTools(messages, options) {
1073
1080
  this.ensureInitialized();
1081
+ let timeoutTriggered = false;
1074
1082
  try {
1075
1083
  const stream = await this.client.messages.stream(
1076
1084
  {
@@ -1092,6 +1100,7 @@ var init_anthropic = __esm({
1092
1100
  const timeoutInterval = setInterval(() => {
1093
1101
  if (Date.now() - lastActivityTime > streamTimeout) {
1094
1102
  clearInterval(timeoutInterval);
1103
+ timeoutTriggered = true;
1095
1104
  timeoutController.abort();
1096
1105
  }
1097
1106
  }, 5e3);
@@ -1186,6 +1195,11 @@ var init_anthropic = __esm({
1186
1195
  throw new Error(`Stream timeout: No response from LLM for ${streamTimeout / 1e3}s`);
1187
1196
  }
1188
1197
  } catch (error) {
1198
+ if (timeoutTriggered) {
1199
+ throw new Error(
1200
+ `Stream timeout: No response from LLM for ${(this.config.timeout ?? 12e4) / 1e3}s`
1201
+ );
1202
+ }
1189
1203
  throw this.handleError(error);
1190
1204
  }
1191
1205
  }
@@ -1755,6 +1769,7 @@ var init_openai = __esm({
1755
1769
  yield* this.streamWithToolsViaResponses(messages, options);
1756
1770
  return;
1757
1771
  }
1772
+ let timeoutTriggered = false;
1758
1773
  try {
1759
1774
  const supportsTemp = this.supportsTemperature(model);
1760
1775
  const extraBody = this.getExtraBody(model);
@@ -1783,6 +1798,7 @@ var init_openai = __esm({
1783
1798
  const timeoutInterval = setInterval(() => {
1784
1799
  if (Date.now() - lastActivityTime > streamTimeout) {
1785
1800
  clearInterval(timeoutInterval);
1801
+ timeoutTriggered = true;
1786
1802
  timeoutController.abort();
1787
1803
  }
1788
1804
  }, 5e3);
@@ -1896,6 +1912,11 @@ var init_openai = __esm({
1896
1912
  throw new Error(`Stream timeout: No response from LLM for ${streamTimeout / 1e3}s`);
1897
1913
  }
1898
1914
  } catch (error) {
1915
+ if (timeoutTriggered) {
1916
+ throw new Error(
1917
+ `Stream timeout: No response from LLM for ${(this.config.timeout ?? 12e4) / 1e3}s`
1918
+ );
1919
+ }
1899
1920
  throw this.handleError(error);
1900
1921
  }
1901
1922
  }
@@ -2341,6 +2362,7 @@ var init_openai = __esm({
2341
2362
  */
2342
2363
  async *streamViaResponses(messages, options) {
2343
2364
  this.ensureInitialized();
2365
+ let timeoutTriggered = false;
2344
2366
  try {
2345
2367
  const model = options?.model ?? this.config.model ?? DEFAULT_MODEL2;
2346
2368
  const { input, instructions } = this.convertToResponsesInput(messages, options?.system);
@@ -2359,6 +2381,7 @@ var init_openai = __esm({
2359
2381
  const timeoutInterval = setInterval(() => {
2360
2382
  if (Date.now() - lastActivityTime > streamTimeout) {
2361
2383
  clearInterval(timeoutInterval);
2384
+ timeoutTriggered = true;
2362
2385
  timeoutController.abort();
2363
2386
  }
2364
2387
  }, 5e3);
@@ -2383,6 +2406,11 @@ var init_openai = __esm({
2383
2406
  throw new Error(`Stream timeout: No response from LLM for ${streamTimeout / 1e3}s`);
2384
2407
  }
2385
2408
  } catch (error) {
2409
+ if (timeoutTriggered) {
2410
+ throw new Error(
2411
+ `Stream timeout: No response from LLM for ${(this.config.timeout ?? 12e4) / 1e3}s`
2412
+ );
2413
+ }
2386
2414
  throw this.handleError(error);
2387
2415
  }
2388
2416
  }
@@ -2395,6 +2423,7 @@ var init_openai = __esm({
2395
2423
  */
2396
2424
  async *streamWithToolsViaResponses(messages, options) {
2397
2425
  this.ensureInitialized();
2426
+ let timeoutTriggered = false;
2398
2427
  try {
2399
2428
  const model = options?.model ?? this.config.model ?? DEFAULT_MODEL2;
2400
2429
  const { input, instructions } = this.convertToResponsesInput(messages, options?.system);
@@ -2421,6 +2450,7 @@ var init_openai = __esm({
2421
2450
  const timeoutInterval = setInterval(() => {
2422
2451
  if (Date.now() - lastActivityTime > streamTimeout) {
2423
2452
  clearInterval(timeoutInterval);
2453
+ timeoutTriggered = true;
2424
2454
  timeoutController.abort();
2425
2455
  }
2426
2456
  }, 5e3);
@@ -2506,6 +2536,11 @@ var init_openai = __esm({
2506
2536
  throw new Error(`Stream timeout: No response from LLM for ${streamTimeout / 1e3}s`);
2507
2537
  }
2508
2538
  } catch (error) {
2539
+ if (timeoutTriggered) {
2540
+ throw new Error(
2541
+ `Stream timeout: No response from LLM for ${(this.config.timeout ?? 12e4) / 1e3}s`
2542
+ );
2543
+ }
2509
2544
  throw this.handleError(error);
2510
2545
  }
2511
2546
  }
@@ -51623,6 +51658,9 @@ ${imagePrompts}`.trim() : imagePrompts;
51623
51658
  result.toolCalls.length
51624
51659
  );
51625
51660
  }
51661
+ if (result.toolCalls.length > 0) {
51662
+ console.log(chalk2.dim(" Type your request again to resume where you left off."));
51663
+ }
51626
51664
  console.log();
51627
51665
  continue;
51628
51666
  }
@@ -51646,6 +51684,9 @@ ${imagePrompts}`.trim() : imagePrompts;
51646
51684
  console.log(
51647
51685
  chalk2.dim(" Recovery failed or error is non-retryable. Returning to prompt.")
51648
51686
  );
51687
+ console.log(
51688
+ chalk2.dim(" Tip: Try /provider or /model to switch, then rephrase and retry.")
51689
+ );
51649
51690
  consecutiveErrors = 0;
51650
51691
  }
51651
51692
  console.log();
@@ -51713,12 +51754,20 @@ ${imagePrompts}`.trim() : imagePrompts;
51713
51754
  compactSpinner.clear();
51714
51755
  }
51715
51756
  } catch {
51716
- compactSpinner.clear();
51757
+ compactSpinner.stop("\u26A0 Context compaction failed");
51758
+ console.log(
51759
+ chalk2.yellow(
51760
+ " \u26A0 Context compaction failed \u2014 context unchanged. Use /clear if needed."
51761
+ )
51762
+ );
51717
51763
  } finally {
51718
51764
  clearTimeout(compactTimeout);
51719
51765
  process.off("SIGINT", compactSigint);
51720
51766
  }
51721
51767
  } catch {
51768
+ console.log(
51769
+ chalk2.yellow(" \u26A0 Context compaction failed \u2014 context unchanged. Use /clear if needed.")
51770
+ );
51722
51771
  }
51723
51772
  renderStatusBar(session.projectPath, session.config, gitContext, usageForDisplay);
51724
51773
  if (usageForDisplay >= 90 && !warned90) {
@@ -51825,11 +51874,15 @@ ${imagePrompts}`.trim() : imagePrompts;
51825
51874
  session.messages.length = preCallMessageLength;
51826
51875
  renderError(errorMsg);
51827
51876
  console.log(chalk2.dim(" Recovery failed after multiple attempts. Returning to prompt."));
51877
+ console.log(
51878
+ chalk2.dim(" Tip: Try /provider or /model to switch, then rephrase and retry.")
51879
+ );
51828
51880
  continue;
51829
51881
  }
51830
51882
  session.messages.length = preCallMessageLength;
51831
51883
  consecutiveErrors = 0;
51832
51884
  renderError(errorMsg);
51885
+ console.log(chalk2.dim(" Tip: Try /provider or /model to switch, then rephrase and retry."));
51833
51886
  } finally {
51834
51887
  clearSpinner();
51835
51888
  if (originalSystemPrompt !== void 0) {