flavor-code 1.2.1 → 1.2.3

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.js CHANGED
@@ -3,7 +3,7 @@ import { createRequire } from "node:module"; const require = createRequire(impor
3
3
  import {
4
4
  FlavorRpcServer,
5
5
  TraceRecorder
6
- } from "./chunk-M744K7MK.js";
6
+ } from "./chunk-AHUOGT4I.js";
7
7
  import {
8
8
  staticTaskLines
9
9
  } from "./chunk-DM64TM4Z.js";
@@ -20,7 +20,7 @@ import {
20
20
  message,
21
21
  packageVersion,
22
22
  redactErrorText
23
- } from "./chunk-BU64GNXE.js";
23
+ } from "./chunk-XGCFBGBB.js";
24
24
  import {
25
25
  McpServerConfigSchema,
26
26
  McpServerNameSchema,
@@ -771,7 +771,7 @@ function createProgram() {
771
771
  const [{ render, AlternateScreen }, { createElement }, { App }] = await Promise.all([
772
772
  import("./claude-ink-ZL4UZMFY.js"),
773
773
  import("react"),
774
- import("./app-WC2XXGLM.js")
774
+ import("./app-SCHNJSXI.js")
775
775
  ]);
776
776
  const instance = await render(createElement(
777
777
  AlternateScreen,
@@ -6762,6 +6762,7 @@ var OpenAIModelAdapter = class {
6762
6762
  async *stream(request) {
6763
6763
  const callIds = /* @__PURE__ */ new Map();
6764
6764
  const pendingCalls = /* @__PURE__ */ new Map();
6765
+ const emittedCalls = /* @__PURE__ */ new Set();
6765
6766
  try {
6766
6767
  const body = {
6767
6768
  model: request.model,
@@ -6776,20 +6777,34 @@ var OpenAIModelAdapter = class {
6776
6777
  };
6777
6778
  const stream = this.client.responses.stream(body, { signal: request.signal });
6778
6779
  for await (const event of stream) {
6779
- if ((event.type === "response.output_item.added" || event.type === "response.output_item.done") && event.item?.type === "function_call" && event.output_index !== void 0 && event.item.call_id) {
6780
+ if (event.type === "response.output_item.added" && event.item?.type === "function_call" && event.output_index !== void 0 && event.item.call_id) {
6780
6781
  callIds.set(event.output_index, event.item.call_id);
6781
6782
  const pending2 = pendingCalls.get(event.output_index);
6782
- if (pending2) {
6783
+ if (pending2 && !emittedCalls.has(event.output_index)) {
6783
6784
  yield toolCallEvent(event.item.call_id, pending2.name, pending2.arguments);
6785
+ emittedCalls.add(event.output_index);
6786
+ pendingCalls.delete(event.output_index);
6787
+ }
6788
+ } else if (event.type === "response.output_item.done" && event.item?.type === "function_call" && event.output_index !== void 0 && event.item.call_id) {
6789
+ callIds.set(event.output_index, event.item.call_id);
6790
+ if (!emittedCalls.has(event.output_index)) {
6791
+ const pending2 = pendingCalls.get(event.output_index);
6792
+ yield toolCallEvent(
6793
+ event.item.call_id,
6794
+ pending2?.name ?? event.item.name,
6795
+ pending2?.arguments ?? event.item.arguments
6796
+ );
6797
+ emittedCalls.add(event.output_index);
6784
6798
  pendingCalls.delete(event.output_index);
6785
6799
  }
6786
6800
  } else if (event.type === "response.output_text.delta" && event.delta) {
6787
6801
  yield { type: "text", text: event.delta };
6788
6802
  } else if (event.type === "response.function_call_arguments.done" && event.output_index !== void 0 && event.name) {
6789
6803
  const callId = callIds.get(event.output_index);
6790
- if (callId) {
6804
+ if (callId && !emittedCalls.has(event.output_index)) {
6791
6805
  yield toolCallEvent(callId, event.name, event.arguments ?? "");
6792
- } else {
6806
+ emittedCalls.add(event.output_index);
6807
+ } else if (!emittedCalls.has(event.output_index)) {
6793
6808
  pendingCalls.set(event.output_index, {
6794
6809
  name: event.name,
6795
6810
  arguments: event.arguments ?? ""