@kenkaiiii/gg-boss 4.5.0 → 4.6.1

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.
@@ -63254,7 +63254,7 @@ function finaliseBySource(source2, message, requestId, hint) {
63254
63254
  headline: message,
63255
63255
  source: source2,
63256
63256
  message: "",
63257
- guidance: hint ?? "Only Kimi, Gemini, and MiniMax can analyze video. Switch with /model.",
63257
+ guidance: hint ?? "Only Kimi, Gemini, MiniMax, and MiMo-V2.5 can analyze video. Switch with /model.",
63258
63258
  ...requestId ? { requestId } : {}
63259
63259
  };
63260
63260
  case "ggcoder":
@@ -63365,21 +63365,21 @@ var StreamResult = class {
63365
63365
  resolveResponse;
63366
63366
  rejectResponse;
63367
63367
  resolveWait = null;
63368
- constructor(generator) {
63368
+ constructor(generator, signal) {
63369
63369
  this.response = new Promise((resolve2, reject) => {
63370
63370
  this.resolveResponse = resolve2;
63371
63371
  this.rejectResponse = reject;
63372
63372
  });
63373
- this.pump(generator);
63373
+ this.pump(generator, signal);
63374
63374
  }
63375
- async pump(generator) {
63375
+ async pump(generator, signal) {
63376
63376
  try {
63377
- let next = await generator.next();
63377
+ let next = await this._nextWithAbort(generator, signal);
63378
63378
  while (!next.done) {
63379
63379
  this.buffer.push(next.value);
63380
63380
  this.resolveWait?.();
63381
63381
  this.resolveWait = null;
63382
- next = await generator.next();
63382
+ next = await this._nextWithAbort(generator, signal);
63383
63383
  }
63384
63384
  this.done = true;
63385
63385
  this.resolveResponse(next.value);
@@ -63394,6 +63394,28 @@ var StreamResult = class {
63394
63394
  this.resolveWait = null;
63395
63395
  }
63396
63396
  }
63397
+ async _nextWithAbort(generator, signal) {
63398
+ if (!signal) {
63399
+ return generator.next();
63400
+ }
63401
+ if (signal.aborted) {
63402
+ return Promise.reject(new DOMException("Aborted", "AbortError"));
63403
+ }
63404
+ let onAbort;
63405
+ const abortPromise = new Promise((_, reject) => {
63406
+ onAbort = () => {
63407
+ generator.return?.(void 0).catch(() => {
63408
+ });
63409
+ reject(new DOMException("Aborted", "AbortError"));
63410
+ };
63411
+ signal.addEventListener("abort", onAbort, { once: true });
63412
+ });
63413
+ try {
63414
+ return await Promise.race([generator.next(), abortPromise]);
63415
+ } finally {
63416
+ if (onAbort) signal.removeEventListener("abort", onAbort);
63417
+ }
63418
+ }
63397
63419
  async *[Symbol.asyncIterator]() {
63398
63420
  let index = 0;
63399
63421
  while (true) {
@@ -63880,13 +63902,14 @@ function toOpenAIMessages(messages, options) {
63880
63902
  }
63881
63903
  if (msg.role === "tool") {
63882
63904
  const isMoonshot = options?.provider === "moonshot";
63883
- const imageBlocks = [];
63905
+ const followUpMediaBlocks = [];
63906
+ let followUpHasVideo = false;
63884
63907
  for (const result of msg.content) {
63885
63908
  const text = toolResultText(result.content);
63886
63909
  const images = toolResultImages(result.content);
63887
- const videos = isMoonshot ? toolResultVideos(result.content) : [];
63910
+ const videos = toolResultVideos(result.content);
63888
63911
  const hasText = text.length > 0;
63889
- if (videos.length > 0) {
63912
+ if (isMoonshot && videos.length > 0) {
63890
63913
  const parts = [];
63891
63914
  if (hasText) parts.push({ type: "text", text });
63892
63915
  const videoParts = videos.map((v) => {
@@ -63903,21 +63926,31 @@ function toOpenAIMessages(messages, options) {
63903
63926
  out.push({
63904
63927
  role: "tool",
63905
63928
  tool_call_id: remapToolCallId(result.toolCallId, idMap),
63906
- content: hasText ? text : "(see attached image)"
63929
+ content: hasText ? text : "(see attached media)"
63907
63930
  });
63908
63931
  if (images.length > 0 && options?.supportsImages !== false) {
63909
63932
  for (const img of images) {
63910
- imageBlocks.push({
63933
+ followUpMediaBlocks.push({
63911
63934
  type: "image_url",
63912
63935
  image_url: { url: `data:${img.mediaType};base64,${img.data}` }
63913
63936
  });
63914
63937
  }
63915
63938
  }
63939
+ if (!isMoonshot && videos.length > 0) {
63940
+ for (const v of videos) {
63941
+ followUpMediaBlocks.push({
63942
+ type: "video_url",
63943
+ video_url: { url: `data:${v.mediaType};base64,${v.data}` }
63944
+ });
63945
+ followUpHasVideo = true;
63946
+ }
63947
+ }
63916
63948
  }
63917
- if (imageBlocks.length > 0) {
63949
+ if (followUpMediaBlocks.length > 0) {
63950
+ const label = followUpHasVideo ? "Attached media from tool result:" : "Attached image(s) from tool result:";
63918
63951
  out.push({
63919
63952
  role: "user",
63920
- content: [{ type: "text", text: "Attached image(s) from tool result:" }, ...imageBlocks]
63953
+ content: [{ type: "text", text: label }, ...followUpMediaBlocks]
63921
63954
  });
63922
63955
  }
63923
63956
  }
@@ -63990,10 +64023,10 @@ function createClient(options) {
63990
64023
  ...isOAuth ? { apiKey: null, authToken: options.apiKey } : { apiKey: options.apiKey },
63991
64024
  ...options.baseUrl ? { baseURL: options.baseUrl } : {},
63992
64025
  ...options.fetch ? { fetch: options.fetch } : {},
63993
- // Allow SDK retries for connection-level failures (socket hang up, 500s,
63994
- // connection refused). Our stall detection handles abort-initiated retries
63995
- // separately SDK retries only fire on genuine transport errors.
63996
- maxRetries: 2,
64026
+ // Disable SDK retries the agent loop has its own stall/overload retry
64027
+ // logic that surfaces errors properly. SDK retries on 429s can cause
64028
+ // multi-minute hangs when the provider stops responding mid-retry.
64029
+ maxRetries: 0,
63997
64030
  ...isOAuth ? {
63998
64031
  defaultHeaders: {
63999
64032
  // Anthropic's OAuth edge validates the claude-cli version. Callers
@@ -64006,7 +64039,7 @@ function createClient(options) {
64006
64039
  });
64007
64040
  }
64008
64041
  function streamAnthropic(options) {
64009
- return new StreamResult(runStream(options));
64042
+ return new StreamResult(runStream(options), options.signal);
64010
64043
  }
64011
64044
  async function* runStream(options) {
64012
64045
  const client = createClient(options);
@@ -64101,7 +64134,6 @@ async function* runStream(options) {
64101
64134
  throw toError(err);
64102
64135
  }
64103
64136
  }
64104
- const stream2 = client.messages.stream(params, requestOptions);
64105
64137
  const contentParts = [];
64106
64138
  const blocks = /* @__PURE__ */ new Map();
64107
64139
  let inputTokens = 0;
@@ -64110,8 +64142,14 @@ async function* runStream(options) {
64110
64142
  let cacheWrite;
64111
64143
  let stopReason = null;
64112
64144
  const keepalive = { type: "keepalive" };
64145
+ let receivedAnyEvent = false;
64113
64146
  try {
64147
+ const stream2 = await client.messages.create(
64148
+ params,
64149
+ requestOptions
64150
+ );
64114
64151
  for await (const event of stream2) {
64152
+ receivedAnyEvent = true;
64115
64153
  switch (event.type) {
64116
64154
  case "message_start": {
64117
64155
  const usage = event.message.usage;
@@ -64148,7 +64186,7 @@ async function* runStream(options) {
64148
64186
  accum.toolId = block2.id;
64149
64187
  accum.toolName = block2.name;
64150
64188
  accum.input = block2.input;
64151
- } else if (block2.type === "redacted_thinking") {
64189
+ } else if (block2.type !== "text" && block2.type !== "thinking") {
64152
64190
  accum.raw = block2;
64153
64191
  }
64154
64192
  blocks.set(idx, accum);
@@ -64245,8 +64283,7 @@ async function* runStream(options) {
64245
64283
  contentParts.push({ type: "raw", data: accum.raw });
64246
64284
  yield keepalive;
64247
64285
  } else {
64248
- const msg = stream2.currentMessage;
64249
- const rawBlock = msg?.content[event.index];
64286
+ const rawBlock = accum.raw;
64250
64287
  if (rawBlock) {
64251
64288
  const blockType = rawBlock.type;
64252
64289
  if (blockType === "web_search_tool_result") {
@@ -64292,6 +64329,11 @@ async function* runStream(options) {
64292
64329
  } catch (err) {
64293
64330
  throw toError(err);
64294
64331
  }
64332
+ if (!receivedAnyEvent) {
64333
+ throw new ProviderError("anthropic", "Stream ended without producing any events.", {
64334
+ statusCode: 504
64335
+ });
64336
+ }
64295
64337
  const normalizedStop = normalizeAnthropicStopReason(stopReason);
64296
64338
  const response = {
64297
64339
  message: {
@@ -64567,7 +64609,7 @@ function createClient2(options) {
64567
64609
  });
64568
64610
  }
64569
64611
  function streamOpenAI(options) {
64570
- return new StreamResult(runStream2(options));
64612
+ return new StreamResult(runStream2(options), options.signal);
64571
64613
  }
64572
64614
  async function* runStream2(options) {
64573
64615
  const providerName = options.provider ?? "openai";
@@ -64659,51 +64701,62 @@ async function* runStream2(options) {
64659
64701
  let outputTokens = 0;
64660
64702
  let cacheRead = 0;
64661
64703
  let finishReason = null;
64662
- for await (const chunk of stream2) {
64663
- const choice = chunk.choices?.[0];
64664
- if (chunk.usage) {
64665
- ({ inputTokens, outputTokens, cacheRead } = extractOpenAIUsage(chunk.usage));
64666
- }
64667
- if (!choice) continue;
64668
- if (choice.finish_reason) {
64669
- finishReason = choice.finish_reason;
64670
- }
64671
- const delta = choice.delta;
64672
- const reasoningContent = delta.reasoning_content;
64673
- if (typeof reasoningContent === "string" && reasoningContent) {
64674
- thinkingAccum += reasoningContent;
64675
- if (options.thinking) {
64676
- yield { type: "thinking_delta", text: reasoningContent };
64677
- }
64678
- }
64679
- if (delta.content) {
64680
- textAccum += delta.content;
64681
- yield { type: "text_delta", text: delta.content };
64682
- }
64683
- if (delta.tool_calls) {
64684
- for (const tc of delta.tool_calls) {
64685
- let accum = toolCallAccum.get(tc.index);
64686
- if (!accum) {
64687
- accum = {
64688
- id: tc.id ?? "",
64689
- name: tc.function?.name ?? "",
64690
- argsJson: ""
64691
- };
64692
- toolCallAccum.set(tc.index, accum);
64693
- }
64694
- if (tc.id) accum.id = tc.id;
64695
- if (tc.function?.name) accum.name = tc.function.name;
64696
- if (tc.function?.arguments) {
64697
- accum.argsJson += tc.function.arguments;
64698
- yield {
64699
- type: "toolcall_delta",
64700
- id: accum.id,
64701
- name: accum.name,
64702
- argsJson: tc.function.arguments
64703
- };
64704
+ let receivedAnyChunk = false;
64705
+ try {
64706
+ for await (const chunk of stream2) {
64707
+ receivedAnyChunk = true;
64708
+ const choice = chunk.choices?.[0];
64709
+ if (chunk.usage) {
64710
+ ({ inputTokens, outputTokens, cacheRead } = extractOpenAIUsage(chunk.usage));
64711
+ }
64712
+ if (!choice) continue;
64713
+ if (choice.finish_reason) {
64714
+ finishReason = choice.finish_reason;
64715
+ }
64716
+ const delta = choice.delta;
64717
+ const reasoningContent = delta.reasoning_content;
64718
+ if (typeof reasoningContent === "string" && reasoningContent) {
64719
+ thinkingAccum += reasoningContent;
64720
+ if (options.thinking) {
64721
+ yield { type: "thinking_delta", text: reasoningContent };
64722
+ }
64723
+ }
64724
+ if (delta.content) {
64725
+ textAccum += delta.content;
64726
+ yield { type: "text_delta", text: delta.content };
64727
+ }
64728
+ if (delta.tool_calls) {
64729
+ for (const tc of delta.tool_calls) {
64730
+ let accum = toolCallAccum.get(tc.index);
64731
+ if (!accum) {
64732
+ accum = {
64733
+ id: tc.id ?? "",
64734
+ name: tc.function?.name ?? "",
64735
+ argsJson: ""
64736
+ };
64737
+ toolCallAccum.set(tc.index, accum);
64738
+ }
64739
+ if (tc.id) accum.id = tc.id;
64740
+ if (tc.function?.name) accum.name = tc.function.name;
64741
+ if (tc.function?.arguments) {
64742
+ accum.argsJson += tc.function.arguments;
64743
+ yield {
64744
+ type: "toolcall_delta",
64745
+ id: accum.id,
64746
+ name: accum.name,
64747
+ argsJson: tc.function.arguments
64748
+ };
64749
+ }
64704
64750
  }
64705
64751
  }
64706
64752
  }
64753
+ } catch (err) {
64754
+ throw toError2(err, providerName);
64755
+ }
64756
+ if (!receivedAnyChunk) {
64757
+ throw new ProviderError(providerName, "Stream ended without producing any chunks.", {
64758
+ statusCode: 504
64759
+ });
64707
64760
  }
64708
64761
  if (thinkingAccum) {
64709
64762
  contentParts.push({ type: "thinking", text: thinkingAccum });
@@ -64937,7 +64990,7 @@ function isVisibleOutputItem(itemType) {
64937
64990
  return itemType === "message";
64938
64991
  }
64939
64992
  function streamOpenAICodex(options) {
64940
- return new StreamResult(runStream3(options));
64993
+ return new StreamResult(runStream3(options), options.signal);
64941
64994
  }
64942
64995
  async function* runStream3(options) {
64943
64996
  const baseUrl = (options.baseUrl || DEFAULT_BASE_URL).replace(/\/+$/, "");
@@ -65267,10 +65320,16 @@ async function* parseSSE(body) {
65267
65320
  }
65268
65321
  }
65269
65322
  function remapCodexId(id2, idMap) {
65270
- if (id2.startsWith("fc_") || id2.startsWith("fc-")) return id2;
65271
65323
  const existing = idMap.get(id2);
65272
65324
  if (existing) return existing;
65273
- const mapped = `fc_${id2.replace(/^toolu_/, "")}`;
65325
+ const withPrefix = id2.startsWith("fc_") || id2.startsWith("fc-") ? id2 : `fc_${id2.replace(/^toolu_/, "")}`;
65326
+ const sanitized = withPrefix.replace(/[^A-Za-z0-9_-]/g, "_");
65327
+ let mapped = sanitized;
65328
+ let suffix = 2;
65329
+ const used = new Set(idMap.values());
65330
+ while (used.has(mapped)) {
65331
+ mapped = `${sanitized}_${suffix++}`;
65332
+ }
65274
65333
  idMap.set(id2, mapped);
65275
65334
  return mapped;
65276
65335
  }
@@ -65791,7 +65850,7 @@ async function fetchCodeAssistWithRetry(plan, options) {
65791
65850
  throw lastError ?? new ProviderError("gemini", "Gemini Code Assist request failed.");
65792
65851
  }
65793
65852
  function streamGemini(options) {
65794
- return new StreamResult(runStream4(options));
65853
+ return new StreamResult(runStream4(options), options.signal);
65795
65854
  }
65796
65855
  async function* runStream4(options) {
65797
65856
  const useStreaming = options.streaming !== false;
@@ -67350,7 +67409,7 @@ var Agent = class {
67350
67409
  }
67351
67410
  };
67352
67411
 
67353
- // ../gg-core/dist/chunk-LLWQ3Z76.js
67412
+ // ../gg-core/dist/chunk-74Z6I5V7.js
67354
67413
  init_esm_shims();
67355
67414
  var MODELS = [
67356
67415
  // ── Anthropic ──────────────────────────────────────────
@@ -67534,9 +67593,11 @@ var MODELS = [
67534
67593
  maxThinkingLevel: "high"
67535
67594
  },
67536
67595
  // ── Xiaomi (MiMo) ──────────────────────────────────────
67596
+ // Pro series: text-only coding/agentic flagship. The legacy mimo-v2-pro
67597
+ // auto-routes to v2.5 on 2026-06-01 and is fully deprecated by 2026-06-30.
67537
67598
  {
67538
- id: "mimo-v2-pro",
67539
- name: "MiMo-V2-Pro",
67599
+ id: "mimo-v2.5-pro",
67600
+ name: "MiMo-V2.5-Pro",
67540
67601
  provider: "xiaomi",
67541
67602
  contextWindow: 1e6,
67542
67603
  maxOutputTokens: 131072,
@@ -67546,6 +67607,22 @@ var MODELS = [
67546
67607
  costTier: "medium",
67547
67608
  maxThinkingLevel: "high"
67548
67609
  },
67610
+ // Omni series: native full-modal understanding (image + audio + video).
67611
+ // Video/image ride the OpenAI-compatible transport as base64 data URLs
67612
+ // (`video_url`/`image_url`), which the shared transform already emits.
67613
+ {
67614
+ id: "mimo-v2.5",
67615
+ name: "MiMo-V2.5",
67616
+ provider: "xiaomi",
67617
+ contextWindow: 1e6,
67618
+ maxOutputTokens: 131072,
67619
+ supportsThinking: true,
67620
+ supportsImages: true,
67621
+ supportsVideo: true,
67622
+ maxVideoBytes: 36 * 1024 * 1024,
67623
+ costTier: "medium",
67624
+ maxThinkingLevel: "high"
67625
+ },
67549
67626
  // ── DeepSeek ───────────────────────────────────────────
67550
67627
  {
67551
67628
  id: "deepseek-v4-pro",
@@ -67599,7 +67676,7 @@ function getVideoByteLimit(modelId) {
67599
67676
  return model.maxVideoBytes ?? DEFAULT_MAX_VIDEO_BYTES;
67600
67677
  }
67601
67678
  function getDefaultModel(provider) {
67602
- if (provider === "xiaomi") return MODELS.find((m) => m.id === "mimo-v2-pro");
67679
+ if (provider === "xiaomi") return MODELS.find((m) => m.id === "mimo-v2.5-pro");
67603
67680
  if (provider === "openai") return MODELS.find((m) => m.id === "gpt-5.5");
67604
67681
  if (provider === "gemini") return MODELS.find((m) => m.id === "gemini-3.1-flash-lite-preview");
67605
67682
  if (provider === "glm") return MODELS.find((m) => m.id === "glm-5.1");
@@ -73342,7 +73419,8 @@ function createTools(cwd2, opts) {
73342
73419
  if (opts?.onExitPlan) {
73343
73420
  tools.push(createExitPlanTool(cwd2, opts.onExitPlan));
73344
73421
  }
73345
- return { tools, processManager };
73422
+ const rebuildReadTool = (model) => createReadTool(cwd2, readFiles, ops, opts?.onFileRead, getVideoByteLimit(model));
73423
+ return { tools, processManager, rebuildReadTool };
73346
73424
  }
73347
73425
 
73348
73426
  // ../ggcoder/dist/system-prompt.js
@@ -114401,4 +114479,4 @@ react/cjs/react-jsx-runtime.development.js:
114401
114479
  * LICENSE file in the root directory of this source tree.
114402
114480
  *)
114403
114481
  */
114404
- //# sourceMappingURL=chunk-RB5EYLWQ.js.map
114482
+ //# sourceMappingURL=chunk-NFL55QLO.js.map