supercompat 3.9.4 → 3.10.0

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/index.js CHANGED
@@ -1750,7 +1750,7 @@ var models6 = function(param) {
1750
1750
  };
1751
1751
  };
1752
1752
  // src/adapters/client/anthropicClientAdapter/completions/post.ts
1753
- import { uid, fork, omit as omit2, isEmpty } from "radash";
1753
+ import { uid, fork, omit as omit3 } from "radash";
1754
1754
  // src/lib/messages/nonEmptyMessages.ts
1755
1755
  var nonEmptyContent = function(param) {
1756
1756
  var message = param.message;
@@ -1805,7 +1805,9 @@ var serializeTools = function(param) {
1805
1805
  }
1806
1806
  };
1807
1807
  }
1808
- return tool;
1808
+ return _object_spread({
1809
+ type: tool.type
1810
+ }, tool[tool.type] || {});
1809
1811
  });
1810
1812
  };
1811
1813
  // src/adapters/client/anthropicClientAdapter/completions/serializeMessages/serializeMessage.ts
@@ -1858,12 +1860,479 @@ var serializeMessages = function(param) {
1858
1860
  });
1859
1861
  });
1860
1862
  };
1863
+ // src/adapters/client/anthropicClientAdapter/completions/serializeBetas.ts
1864
+ var serializeBetas = function(param) {
1865
+ var _param_tools = param.tools, tools = _param_tools === void 0 ? [] : _param_tools;
1866
+ var betas = [];
1867
+ if (tools.some(function(tool) {
1868
+ return tool.type === "computer_20250124";
1869
+ })) {
1870
+ betas.push("computer-use-2025-01-24");
1871
+ }
1872
+ if (tools.some(function(tool) {
1873
+ return tool.type === "code_execution_20250825";
1874
+ })) {
1875
+ betas.push("code-execution-2025-08-25");
1876
+ }
1877
+ if (!betas.length) {
1878
+ return {};
1879
+ }
1880
+ return {
1881
+ betas: betas
1882
+ };
1883
+ };
1884
+ // src/adapters/client/anthropicClientAdapter/normalizeComputerToolCallPayload.ts
1885
+ import { omit as omit2 } from "radash";
1886
+ var coordinateKeys = [
1887
+ "coordinate",
1888
+ "coordinates",
1889
+ "coordinate_start",
1890
+ "coordinate_end",
1891
+ "start",
1892
+ "end",
1893
+ "from",
1894
+ "to",
1895
+ "target",
1896
+ "point",
1897
+ "position",
1898
+ "cursor_position",
1899
+ "path"
1900
+ ];
1901
+ var clickButtonMap = {
1902
+ left_click: "left",
1903
+ right_click: "right",
1904
+ middle_click: "wheel",
1905
+ double_click: "left",
1906
+ triple_click: "left",
1907
+ left_mouse_down: "left",
1908
+ left_mouse_up: "left"
1909
+ };
1910
+ var keyAliasMap = {
1911
+ ctrl: "ctrl",
1912
+ control: "ctrl",
1913
+ cmd: "meta",
1914
+ command: "meta",
1915
+ meta: "meta",
1916
+ win: "meta",
1917
+ option: "alt",
1918
+ alt: "alt",
1919
+ shift: "shift",
1920
+ enter: "enter",
1921
+ return: "enter",
1922
+ esc: "escape",
1923
+ escape: "escape",
1924
+ tab: "tab",
1925
+ space: "space",
1926
+ spacebar: "space",
1927
+ backspace: "backspace",
1928
+ del: "delete",
1929
+ delete: "delete",
1930
+ pageup: "pageup",
1931
+ pagedown: "pagedown",
1932
+ up: "up",
1933
+ down: "down",
1934
+ left: "left",
1935
+ right: "right"
1936
+ };
1937
+ var sanitizeNumber = function(value) {
1938
+ return typeof value === "number" ? value : void 0;
1939
+ };
1940
+ var toCoordinate = function(value) {
1941
+ if (!value) return void 0;
1942
+ if (Array.isArray(value)) {
1943
+ if (value.length === 2 && typeof value[0] === "number" && typeof value[1] === "number") {
1944
+ return {
1945
+ x: value[0],
1946
+ y: value[1]
1947
+ };
1948
+ }
1949
+ if (value.length > 0 && Array.isArray(value[0])) {
1950
+ var tuple = value[0];
1951
+ if (tuple.length === 2 && typeof tuple[0] === "number" && typeof tuple[1] === "number") {
1952
+ return {
1953
+ x: tuple[0],
1954
+ y: tuple[1]
1955
+ };
1956
+ }
1957
+ }
1958
+ }
1959
+ if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "object") {
1960
+ var maybe = value;
1961
+ var x = sanitizeNumber(maybe.x);
1962
+ var y = sanitizeNumber(maybe.y);
1963
+ if (typeof x === "number" && typeof y === "number") {
1964
+ return {
1965
+ x: x,
1966
+ y: y
1967
+ };
1968
+ }
1969
+ }
1970
+ if (typeof value === "string") {
1971
+ var parts = value.split(/[, ]+/).map(Number).filter(Number.isFinite);
1972
+ if (parts.length >= 2) {
1973
+ return {
1974
+ x: parts[0],
1975
+ y: parts[1]
1976
+ };
1977
+ }
1978
+ }
1979
+ return void 0;
1980
+ };
1981
+ var findCoordinatesInDetails = function(details) {
1982
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1983
+ try {
1984
+ for(var _iterator = coordinateKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1985
+ var key = _step.value;
1986
+ var value = details[key];
1987
+ var coords = toCoordinate(value);
1988
+ if (coords) {
1989
+ return coords;
1990
+ }
1991
+ }
1992
+ } catch (err) {
1993
+ _didIteratorError = true;
1994
+ _iteratorError = err;
1995
+ } finally{
1996
+ try {
1997
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1998
+ _iterator.return();
1999
+ }
2000
+ } finally{
2001
+ if (_didIteratorError) {
2002
+ throw _iteratorError;
2003
+ }
2004
+ }
2005
+ }
2006
+ return void 0;
2007
+ };
2008
+ var buildDragPath = function(details) {
2009
+ var path = [];
2010
+ if (Array.isArray(details.path)) {
2011
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2012
+ try {
2013
+ for(var _iterator = details.path[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2014
+ var point = _step.value;
2015
+ var coords = toCoordinate(point);
2016
+ if (coords) {
2017
+ path.push(coords);
2018
+ }
2019
+ }
2020
+ } catch (err) {
2021
+ _didIteratorError = true;
2022
+ _iteratorError = err;
2023
+ } finally{
2024
+ try {
2025
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
2026
+ _iterator.return();
2027
+ }
2028
+ } finally{
2029
+ if (_didIteratorError) {
2030
+ throw _iteratorError;
2031
+ }
2032
+ }
2033
+ }
2034
+ }
2035
+ if (!path.length) {
2036
+ var start = toCoordinate(details.coordinate_start) || toCoordinate(details.start) || toCoordinate(details.from);
2037
+ if (start) {
2038
+ path.push(start);
2039
+ }
2040
+ var end = toCoordinate(details.coordinate_end) || toCoordinate(details.end) || toCoordinate(details.to) || toCoordinate(details.target);
2041
+ if (end) {
2042
+ path.push(end);
2043
+ }
2044
+ }
2045
+ if (!path.length) {
2046
+ var coords1 = findCoordinatesInDetails(details);
2047
+ if (coords1) {
2048
+ path.push(coords1);
2049
+ }
2050
+ }
2051
+ if (!path.length) {
2052
+ path.push({
2053
+ x: 0,
2054
+ y: 0
2055
+ });
2056
+ }
2057
+ return path;
2058
+ };
2059
+ var parseKeys = function(input) {
2060
+ if (Array.isArray(input)) {
2061
+ return input.map(String).map(function(key) {
2062
+ return key.trim();
2063
+ }).filter(Boolean);
2064
+ }
2065
+ if (typeof input === "string") {
2066
+ return input.split(RegExp("(?:(?<!\\\\)\\+|\\s+)")).map(function(key) {
2067
+ return key.replace(/\\\+/g, "+");
2068
+ }).map(function(key) {
2069
+ return key.trim();
2070
+ }).filter(Boolean);
2071
+ }
2072
+ return [];
2073
+ };
2074
+ var normalizeKeys = function(keys) {
2075
+ return keys.map(function(key) {
2076
+ var lowerKey = key.toLowerCase();
2077
+ var _keyAliasMap_lowerKey;
2078
+ return (_keyAliasMap_lowerKey = keyAliasMap[lowerKey]) !== null && _keyAliasMap_lowerKey !== void 0 ? _keyAliasMap_lowerKey : lowerKey;
2079
+ });
2080
+ };
2081
+ var normalizeScroll = function(details) {
2082
+ var _sanitizeNumber;
2083
+ var scrollX = (_sanitizeNumber = sanitizeNumber(details.scroll_x)) !== null && _sanitizeNumber !== void 0 ? _sanitizeNumber : 0;
2084
+ var _sanitizeNumber1;
2085
+ var scrollY = (_sanitizeNumber1 = sanitizeNumber(details.scroll_y)) !== null && _sanitizeNumber1 !== void 0 ? _sanitizeNumber1 : 0;
2086
+ var _sanitizeNumber2, _ref;
2087
+ var amount = (_ref = (_sanitizeNumber2 = sanitizeNumber(details.scroll_amount)) !== null && _sanitizeNumber2 !== void 0 ? _sanitizeNumber2 : sanitizeNumber(details.amount)) !== null && _ref !== void 0 ? _ref : 0;
2088
+ var direction = typeof details.scroll_direction === "string" ? details.scroll_direction.toLowerCase() : typeof details.direction === "string" ? details.direction.toLowerCase() : void 0;
2089
+ if (!scrollX && !scrollY && direction && amount) {
2090
+ switch(direction){
2091
+ case "up":
2092
+ scrollY = -amount;
2093
+ break;
2094
+ case "down":
2095
+ scrollY = amount;
2096
+ break;
2097
+ case "left":
2098
+ scrollX = -amount;
2099
+ break;
2100
+ case "right":
2101
+ scrollX = amount;
2102
+ break;
2103
+ default:
2104
+ break;
2105
+ }
2106
+ }
2107
+ return {
2108
+ scroll_x: scrollX,
2109
+ scroll_y: scrollY
2110
+ };
2111
+ };
2112
+ var normalizeActionString = function(action, details) {
2113
+ var coords = findCoordinatesInDetails(details);
2114
+ switch(action){
2115
+ case "screenshot":
2116
+ return {
2117
+ type: "screenshot"
2118
+ };
2119
+ case "left_click":
2120
+ case "right_click":
2121
+ case "middle_click":
2122
+ {
2123
+ var _coords_x, _coords_y;
2124
+ return {
2125
+ type: "click",
2126
+ button: clickButtonMap[action],
2127
+ x: (_coords_x = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x !== void 0 ? _coords_x : 0,
2128
+ y: (_coords_y = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y !== void 0 ? _coords_y : 0
2129
+ };
2130
+ }
2131
+ case "double_click":
2132
+ var _coords_x1, _coords_y1;
2133
+ return {
2134
+ type: "double_click",
2135
+ x: (_coords_x1 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x1 !== void 0 ? _coords_x1 : 0,
2136
+ y: (_coords_y1 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y1 !== void 0 ? _coords_y1 : 0
2137
+ };
2138
+ case "triple_click":
2139
+ var _coords_x2, _coords_y2;
2140
+ return {
2141
+ type: "double_click",
2142
+ x: (_coords_x2 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x2 !== void 0 ? _coords_x2 : 0,
2143
+ y: (_coords_y2 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y2 !== void 0 ? _coords_y2 : 0,
2144
+ repetitions: 3
2145
+ };
2146
+ case "left_mouse_down":
2147
+ var _coords_x3, _coords_y3;
2148
+ return {
2149
+ type: "click",
2150
+ button: clickButtonMap[action],
2151
+ state: "down",
2152
+ x: (_coords_x3 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x3 !== void 0 ? _coords_x3 : 0,
2153
+ y: (_coords_y3 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y3 !== void 0 ? _coords_y3 : 0
2154
+ };
2155
+ case "left_mouse_up":
2156
+ var _coords_x4, _coords_y4;
2157
+ return {
2158
+ type: "click",
2159
+ button: clickButtonMap[action],
2160
+ state: "up",
2161
+ x: (_coords_x4 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x4 !== void 0 ? _coords_x4 : 0,
2162
+ y: (_coords_y4 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y4 !== void 0 ? _coords_y4 : 0
2163
+ };
2164
+ case "left_click_drag":
2165
+ {
2166
+ var path = buildDragPath(details).map(function(param) {
2167
+ var x = param.x, y = param.y;
2168
+ return {
2169
+ x: x,
2170
+ y: y
2171
+ };
2172
+ });
2173
+ return {
2174
+ type: "drag",
2175
+ path: path
2176
+ };
2177
+ }
2178
+ case "mouse_move":
2179
+ case "cursor_position":
2180
+ var _coords_x5, _coords_y5;
2181
+ return {
2182
+ type: "move",
2183
+ x: (_coords_x5 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x5 !== void 0 ? _coords_x5 : 0,
2184
+ y: (_coords_y5 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y5 !== void 0 ? _coords_y5 : 0
2185
+ };
2186
+ case "scroll":
2187
+ {
2188
+ var _normalizeScroll = normalizeScroll(details), scroll_x = _normalizeScroll.scroll_x, scroll_y = _normalizeScroll.scroll_y;
2189
+ var _coords_x6, _coords_y6;
2190
+ return _object_spread({
2191
+ type: "scroll",
2192
+ x: (_coords_x6 = coords === null || coords === void 0 ? void 0 : coords.x) !== null && _coords_x6 !== void 0 ? _coords_x6 : 0,
2193
+ y: (_coords_y6 = coords === null || coords === void 0 ? void 0 : coords.y) !== null && _coords_y6 !== void 0 ? _coords_y6 : 0,
2194
+ scroll_x: scroll_x,
2195
+ scroll_y: scroll_y
2196
+ }, typeof details.scroll_direction === "string" ? {
2197
+ direction: details.scroll_direction
2198
+ } : typeof details.direction === "string" ? {
2199
+ direction: details.direction
2200
+ } : {}, typeof details.scroll_amount === "number" ? {
2201
+ amount: details.scroll_amount
2202
+ } : typeof details.amount === "number" ? {
2203
+ amount: details.amount
2204
+ } : {});
2205
+ }
2206
+ case "type":
2207
+ {
2208
+ var text = typeof details.text === "string" ? details.text : typeof details.input === "string" ? details.input : "";
2209
+ return {
2210
+ type: "type",
2211
+ text: text
2212
+ };
2213
+ }
2214
+ case "key":
2215
+ case "hold_key":
2216
+ {
2217
+ var _details_text, _ref;
2218
+ var keys = normalizeKeys(parseKeys((_ref = (_details_text = details.text) !== null && _details_text !== void 0 ? _details_text : details.keys) !== null && _ref !== void 0 ? _ref : details.key));
2219
+ var normalized = {
2220
+ type: "keypress",
2221
+ keys: keys
2222
+ };
2223
+ if (action === "hold_key") {
2224
+ var duration = sanitizeNumber(details.duration);
2225
+ if (typeof duration === "number") {
2226
+ normalized.hold_duration_ms = Math.round(duration * 1e3);
2227
+ }
2228
+ }
2229
+ return normalized;
2230
+ }
2231
+ case "wait":
2232
+ {
2233
+ var duration1 = sanitizeNumber(details.duration);
2234
+ return _object_spread({
2235
+ type: "wait"
2236
+ }, typeof duration1 === "number" ? {
2237
+ duration_ms: Math.round(duration1 * 1e3)
2238
+ } : {});
2239
+ }
2240
+ default:
2241
+ {
2242
+ return _object_spread({
2243
+ type: action
2244
+ }, coords ? {
2245
+ x: coords.x,
2246
+ y: coords.y
2247
+ } : {}, omit2(details, _to_consumable_array(coordinateKeys).concat([
2248
+ "text",
2249
+ "scroll_direction",
2250
+ "direction",
2251
+ "scroll_amount",
2252
+ "amount",
2253
+ "scroll_x",
2254
+ "scroll_y",
2255
+ "keys",
2256
+ "duration"
2257
+ ])));
2258
+ }
2259
+ }
2260
+ };
2261
+ var normalizeAction = function(payload) {
2262
+ if (payload && (typeof payload === "undefined" ? "undefined" : _type_of(payload)) === "object") {
2263
+ var rawAction = payload.action;
2264
+ if (typeof rawAction === "string") {
2265
+ var parsedAction = parseJson(rawAction);
2266
+ if (parsedAction && (typeof parsedAction === "undefined" ? "undefined" : _type_of(parsedAction)) === "object") {
2267
+ rawAction = parsedAction;
2268
+ }
2269
+ }
2270
+ if (rawAction && (typeof rawAction === "undefined" ? "undefined" : _type_of(rawAction)) === "object" && typeof rawAction.type === "string") {
2271
+ return rawAction;
2272
+ }
2273
+ if (typeof rawAction === "string") {
2274
+ var details = omit2(payload, [
2275
+ "action",
2276
+ "pending_safety_checks",
2277
+ "status"
2278
+ ]);
2279
+ return normalizeActionString(rawAction, details);
2280
+ }
2281
+ if (typeof payload.type === "string") {
2282
+ return payload;
2283
+ }
2284
+ }
2285
+ if (typeof payload === "string") {
2286
+ var parsed = parseJson(payload);
2287
+ if (parsed && (typeof parsed === "undefined" ? "undefined" : _type_of(parsed)) === "object") {
2288
+ return normalizeAction(parsed);
2289
+ }
2290
+ return {
2291
+ type: payload
2292
+ };
2293
+ }
2294
+ return {
2295
+ type: "unknown",
2296
+ value: payload
2297
+ };
2298
+ };
2299
+ var normalizeComputerToolCallPayload = function(payload) {
2300
+ var normalizedPayload = payload;
2301
+ if (typeof payload === "string") {
2302
+ var parsed = parseJson(payload);
2303
+ if (parsed !== void 0) {
2304
+ normalizedPayload = parsed;
2305
+ }
2306
+ }
2307
+ var pendingSafetyChecksRaw = normalizedPayload && (typeof normalizedPayload === "undefined" ? "undefined" : _type_of(normalizedPayload)) === "object" ? normalizedPayload.pending_safety_checks : void 0;
2308
+ if (typeof pendingSafetyChecksRaw === "string") {
2309
+ var parsed1 = parseJson(pendingSafetyChecksRaw);
2310
+ pendingSafetyChecksRaw = Array.isArray(parsed1) ? parsed1 : [];
2311
+ }
2312
+ var pendingSafetyChecks = Array.isArray(pendingSafetyChecksRaw) ? pendingSafetyChecksRaw : [];
2313
+ var normalizedAction = normalizeAction(normalizedPayload);
2314
+ var result = {
2315
+ action: normalizedAction,
2316
+ pending_safety_checks: pendingSafetyChecks
2317
+ };
2318
+ if (normalizedPayload && (typeof normalizedPayload === "undefined" ? "undefined" : _type_of(normalizedPayload)) === "object" && "status" in normalizedPayload) {
2319
+ result.status = normalizedPayload.status;
2320
+ }
2321
+ return result;
2322
+ };
2323
+ var parseJson = function(value) {
2324
+ try {
2325
+ return JSON.parse(value);
2326
+ } catch (e) {
2327
+ return void 0;
2328
+ }
2329
+ };
1861
2330
  // src/adapters/client/anthropicClientAdapter/completions/post.ts
1862
2331
  var post5 = function(param) {
1863
2332
  var anthropic = param.anthropic;
1864
2333
  return /*#__PURE__*/ function() {
1865
2334
  var _ref = _async_to_generator(function(_url, options) {
1866
- var body, messages4, _fork, systemMessages, otherMessages, system, chatMessages, resultOptions, response, stream, data, error;
2335
+ var body, messages4, _fork, systemMessages, otherMessages, system, chatMessages, resultOptions, response, stream, data, normalizedContent, normalizedData, error;
1867
2336
  return _ts_generator(this, function(_state) {
1868
2337
  switch(_state.label){
1869
2338
  case 0:
@@ -1882,10 +2351,14 @@ var post5 = function(param) {
1882
2351
  })
1883
2352
  })
1884
2353
  });
1885
- resultOptions = _object_spread_props(_object_spread({}, omit2(body, [
2354
+ resultOptions = _object_spread_props(_object_spread(_object_spread_props(_object_spread({}, omit3(body, [
1886
2355
  "response_format"
1887
2356
  ])), {
1888
- stream: body.stream ? isEmpty(body.tools) : false,
2357
+ model: body.model
2358
+ }), serializeBetas({
2359
+ tools: body.tools
2360
+ })), {
2361
+ stream: body.stream,
1889
2362
  system: system,
1890
2363
  messages: serializeMessages({
1891
2364
  messages: chatMessages
@@ -1895,23 +2368,98 @@ var post5 = function(param) {
1895
2368
  tools: body.tools
1896
2369
  })
1897
2370
  });
1898
- if (!body.stream) return [
2371
+ if (!resultOptions.stream) return [
1899
2372
  3,
1900
2373
  2
1901
2374
  ];
1902
2375
  return [
1903
2376
  4,
1904
- anthropic.messages.stream(resultOptions)
2377
+ anthropic.beta.messages.create(resultOptions)
1905
2378
  ];
1906
2379
  case 1:
1907
2380
  response = _state.sent();
1908
2381
  stream = new ReadableStream({
1909
2382
  start: function start(controller) {
1910
2383
  return _async_to_generator(function() {
1911
- var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, delta, messageDelta, delta1, messageDelta1, messageDelta2, err;
2384
+ var blockIndexToToolUseId, toolUseIdToIndex, toolUseIdArgumentBuffer, computerToolUseIds, normalizedComputerCalls, nextToolCallIndex, parseJson2, getOrCreateIndexForToolUseId, assignBlockToToolUse, markComputerToolUse, getToolUseIdFromBlock, emitNormalizedToolCall, getOrCreateIndexForBlock, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, _ref, chunk, toolUseId, _toolUseIdArgumentBuffer_get, buffered, parsed, normalized, toolCallIndex, chunkIndex, delta, toolUseId1, _toolUseIdArgumentBuffer_get1, existing, _chunk_delta_partial_json, updated, parsed1, normalized1, toolCallIndex1, chunkIndex1, _toolUseIdArgumentBuffer_get2, existing1, _chunk_delta_partial_json1, index, messageDelta, delta1, toolName, normalizedToolName, index1, index2, _chunk_content_block_content, outputPayload, _getToolUseIdFromBlock, toolCallId, index3, _getToolUseIdFromBlock1, toolCallId1, _chunk_content_block, _toolUseId, _type, _id, rest, index4, _chunk_content_block_content1, outputPayload1, messageDelta1, messageDelta2, err;
1912
2385
  return _ts_generator(this, function(_state) {
1913
2386
  switch(_state.label){
1914
2387
  case 0:
2388
+ blockIndexToToolUseId = /* @__PURE__ */ new Map();
2389
+ toolUseIdToIndex = /* @__PURE__ */ new Map();
2390
+ toolUseIdArgumentBuffer = /* @__PURE__ */ new Map();
2391
+ computerToolUseIds = /* @__PURE__ */ new Set();
2392
+ normalizedComputerCalls = /* @__PURE__ */ new Set();
2393
+ nextToolCallIndex = 0;
2394
+ parseJson2 = function(value) {
2395
+ try {
2396
+ return JSON.parse(value);
2397
+ } catch (e) {
2398
+ return void 0;
2399
+ }
2400
+ };
2401
+ getOrCreateIndexForToolUseId = function(toolUseId) {
2402
+ if (!toolUseId) {
2403
+ return 0;
2404
+ }
2405
+ if (!toolUseIdToIndex.has(toolUseId)) {
2406
+ toolUseIdToIndex.set(toolUseId, nextToolCallIndex++);
2407
+ }
2408
+ var _toolUseIdToIndex_get;
2409
+ return (_toolUseIdToIndex_get = toolUseIdToIndex.get(toolUseId)) !== null && _toolUseIdToIndex_get !== void 0 ? _toolUseIdToIndex_get : 0;
2410
+ };
2411
+ assignBlockToToolUse = function(param) {
2412
+ var blockIndex = param.blockIndex, toolUseId = param.toolUseId;
2413
+ if (typeof blockIndex === "number" && toolUseId) {
2414
+ blockIndexToToolUseId.set(blockIndex, toolUseId);
2415
+ }
2416
+ };
2417
+ markComputerToolUse = function(toolUseId) {
2418
+ if (!toolUseId) return;
2419
+ computerToolUseIds.add(toolUseId);
2420
+ normalizedComputerCalls.delete(toolUseId);
2421
+ toolUseIdArgumentBuffer.set(toolUseId, "");
2422
+ };
2423
+ getToolUseIdFromBlock = function(block) {
2424
+ if (!block || (typeof block === "undefined" ? "undefined" : _type_of(block)) !== "object") return void 0;
2425
+ if (typeof block.tool_use_id === "string") {
2426
+ return block.tool_use_id;
2427
+ }
2428
+ if (typeof block.id === "string") {
2429
+ return block.id;
2430
+ }
2431
+ return void 0;
2432
+ };
2433
+ emitNormalizedToolCall = function(param) {
2434
+ var normalized = param.normalized, toolCallIndex = param.toolCallIndex, chunkIndex = param.chunkIndex;
2435
+ var messageDelta = {
2436
+ id: "chatcmpl-".concat(uid(29)),
2437
+ object: "chat.completion.chunk",
2438
+ choices: [
2439
+ {
2440
+ index: chunkIndex,
2441
+ delta: {
2442
+ tool_calls: [
2443
+ {
2444
+ index: toolCallIndex,
2445
+ function: {
2446
+ arguments: JSON.stringify(normalized)
2447
+ }
2448
+ }
2449
+ ]
2450
+ }
2451
+ }
2452
+ ]
2453
+ };
2454
+ controller.enqueue("data: ".concat(JSON.stringify(messageDelta), "\n\n"));
2455
+ };
2456
+ getOrCreateIndexForBlock = function(blockIndex) {
2457
+ if (typeof blockIndex !== "number") {
2458
+ return 0;
2459
+ }
2460
+ var toolUseId = blockIndexToToolUseId.get(blockIndex);
2461
+ return getOrCreateIndexForToolUseId(toolUseId);
2462
+ };
1915
2463
  _iteratorAbruptCompletion = false, _didIteratorError = false;
1916
2464
  _state.label = 1;
1917
2465
  case 1:
@@ -1934,14 +2482,79 @@ var post5 = function(param) {
1934
2482
  5
1935
2483
  ];
1936
2484
  _value = _step.value;
1937
- chunk = _value;
2485
+ _ref = _value;
2486
+ chunk = _ref;
2487
+ if (chunk.type === "content_block_stop") {
2488
+ toolUseId = typeof chunk.index === "number" ? blockIndexToToolUseId.get(chunk.index) : void 0;
2489
+ if (toolUseId && computerToolUseIds.has(toolUseId) && !normalizedComputerCalls.has(toolUseId)) {
2490
+ ;
2491
+ buffered = (_toolUseIdArgumentBuffer_get = toolUseIdArgumentBuffer.get(toolUseId)) !== null && _toolUseIdArgumentBuffer_get !== void 0 ? _toolUseIdArgumentBuffer_get : "";
2492
+ parsed = buffered ? parseJson2(buffered) : void 0;
2493
+ if (parsed !== void 0) {
2494
+ normalized = normalizeComputerToolCallPayload(parsed);
2495
+ toolCallIndex = getOrCreateIndexForToolUseId(toolUseId);
2496
+ chunkIndex = typeof chunk.index === "number" ? chunk.index : 0;
2497
+ emitNormalizedToolCall({
2498
+ normalized: normalized,
2499
+ toolCallIndex: toolCallIndex,
2500
+ chunkIndex: chunkIndex
2501
+ });
2502
+ normalizedComputerCalls.add(toolUseId);
2503
+ }
2504
+ }
2505
+ if (toolUseId) {
2506
+ toolUseIdArgumentBuffer.delete(toolUseId);
2507
+ computerToolUseIds.delete(toolUseId);
2508
+ normalizedComputerCalls.delete(toolUseId);
2509
+ }
2510
+ if (typeof chunk.index === "number") {
2511
+ blockIndexToToolUseId.delete(chunk.index);
2512
+ }
2513
+ return [
2514
+ 3,
2515
+ 4
2516
+ ];
2517
+ }
1938
2518
  if (chunk.type === "content_block_delta") {
1939
2519
  delta = void 0;
1940
2520
  if (chunk.delta.type === "input_json_delta") {
2521
+ toolUseId1 = typeof chunk.index === "number" ? blockIndexToToolUseId.get(chunk.index) : void 0;
2522
+ if (toolUseId1 && computerToolUseIds.has(toolUseId1)) {
2523
+ ;
2524
+ existing = (_toolUseIdArgumentBuffer_get1 = toolUseIdArgumentBuffer.get(toolUseId1)) !== null && _toolUseIdArgumentBuffer_get1 !== void 0 ? _toolUseIdArgumentBuffer_get1 : "";
2525
+ ;
2526
+ updated = "".concat(existing).concat((_chunk_delta_partial_json = chunk.delta.partial_json) !== null && _chunk_delta_partial_json !== void 0 ? _chunk_delta_partial_json : "");
2527
+ toolUseIdArgumentBuffer.set(toolUseId1, updated);
2528
+ if (!normalizedComputerCalls.has(toolUseId1)) {
2529
+ parsed1 = parseJson2(updated);
2530
+ if (parsed1 !== void 0) {
2531
+ normalized1 = normalizeComputerToolCallPayload(parsed1);
2532
+ toolCallIndex1 = getOrCreateIndexForToolUseId(toolUseId1);
2533
+ chunkIndex1 = typeof chunk.index === "number" ? chunk.index : 0;
2534
+ emitNormalizedToolCall({
2535
+ normalized: normalized1,
2536
+ toolCallIndex: toolCallIndex1,
2537
+ chunkIndex: chunkIndex1
2538
+ });
2539
+ normalizedComputerCalls.add(toolUseId1);
2540
+ }
2541
+ }
2542
+ return [
2543
+ 3,
2544
+ 4
2545
+ ];
2546
+ }
2547
+ if (toolUseId1) {
2548
+ ;
2549
+ existing1 = (_toolUseIdArgumentBuffer_get2 = toolUseIdArgumentBuffer.get(toolUseId1)) !== null && _toolUseIdArgumentBuffer_get2 !== void 0 ? _toolUseIdArgumentBuffer_get2 : "";
2550
+ ;
2551
+ toolUseIdArgumentBuffer.set(toolUseId1, "".concat(existing1).concat((_chunk_delta_partial_json1 = chunk.delta.partial_json) !== null && _chunk_delta_partial_json1 !== void 0 ? _chunk_delta_partial_json1 : ""));
2552
+ }
2553
+ index = getOrCreateIndexForBlock(chunk.index);
1941
2554
  delta = {
1942
2555
  tool_calls: [
1943
2556
  {
1944
- index: 0,
2557
+ index: index,
1945
2558
  function: {
1946
2559
  arguments: chunk.delta.partial_json
1947
2560
  }
@@ -1971,11 +2584,46 @@ var post5 = function(param) {
1971
2584
  } else if (chunk.type === "content_block_start") {
1972
2585
  delta1 = void 0;
1973
2586
  if (chunk.content_block.type === "tool_use") {
2587
+ toolName = chunk.content_block.name;
2588
+ normalizedToolName = toolName === "computer" ? "computer_call" : toolName;
2589
+ index1 = getOrCreateIndexForToolUseId(chunk.content_block.id);
2590
+ assignBlockToToolUse({
2591
+ blockIndex: chunk.index,
2592
+ toolUseId: chunk.content_block.id
2593
+ });
2594
+ if (normalizedToolName === "computer_call") {
2595
+ markComputerToolUse(chunk.content_block.id);
2596
+ } else if (!toolUseIdArgumentBuffer.has(chunk.content_block.id)) {
2597
+ toolUseIdArgumentBuffer.set(chunk.content_block.id, "");
2598
+ }
2599
+ delta1 = {
2600
+ content: null,
2601
+ tool_calls: [
2602
+ {
2603
+ index: index1,
2604
+ id: chunk.content_block.id,
2605
+ type: "function",
2606
+ function: {
2607
+ name: normalizedToolName,
2608
+ arguments: ""
2609
+ }
2610
+ }
2611
+ ]
2612
+ };
2613
+ } else if (chunk.content_block.type === "server_tool_use") {
2614
+ index2 = getOrCreateIndexForToolUseId(chunk.content_block.id);
2615
+ assignBlockToToolUse({
2616
+ blockIndex: chunk.index,
2617
+ toolUseId: chunk.content_block.id
2618
+ });
2619
+ if (!toolUseIdArgumentBuffer.has(chunk.content_block.id)) {
2620
+ toolUseIdArgumentBuffer.set(chunk.content_block.id, "");
2621
+ }
1974
2622
  delta1 = {
1975
2623
  content: null,
1976
2624
  tool_calls: [
1977
2625
  {
1978
- index: 0,
2626
+ index: index2,
1979
2627
  id: chunk.content_block.id,
1980
2628
  type: "function",
1981
2629
  function: {
@@ -1985,6 +2633,65 @@ var post5 = function(param) {
1985
2633
  }
1986
2634
  ]
1987
2635
  };
2636
+ } else if (chunk.content_block.type === "web_search_tool_result") {
2637
+ ;
2638
+ outputPayload = {
2639
+ content: (_chunk_content_block_content = chunk.content_block.content) !== null && _chunk_content_block_content !== void 0 ? _chunk_content_block_content : []
2640
+ };
2641
+ ;
2642
+ toolCallId = (_getToolUseIdFromBlock = getToolUseIdFromBlock(chunk.content_block)) !== null && _getToolUseIdFromBlock !== void 0 ? _getToolUseIdFromBlock : "";
2643
+ index3 = getOrCreateIndexForToolUseId(toolCallId);
2644
+ assignBlockToToolUse({
2645
+ blockIndex: chunk.index,
2646
+ toolUseId: toolCallId
2647
+ });
2648
+ delta1 = {
2649
+ content: null,
2650
+ tool_calls: [
2651
+ {
2652
+ index: index3,
2653
+ id: toolCallId,
2654
+ type: "function",
2655
+ function: {
2656
+ output: JSON.stringify(outputPayload)
2657
+ }
2658
+ }
2659
+ ]
2660
+ };
2661
+ } else if ([
2662
+ "code_execution_tool_result",
2663
+ "bash_code_execution_tool_result",
2664
+ "python_code_execution_tool_result"
2665
+ ].includes(chunk.content_block.type)) {
2666
+ ;
2667
+ toolCallId1 = (_getToolUseIdFromBlock1 = getToolUseIdFromBlock(chunk.content_block)) !== null && _getToolUseIdFromBlock1 !== void 0 ? _getToolUseIdFromBlock1 : "";
2668
+ _chunk_content_block = chunk.content_block, _toolUseId = _chunk_content_block.tool_use_id, _type = _chunk_content_block.type, _id = _chunk_content_block.id, rest = _object_without_properties(_chunk_content_block, [
2669
+ "tool_use_id",
2670
+ "type",
2671
+ "id"
2672
+ ]);
2673
+ index4 = getOrCreateIndexForToolUseId(toolCallId1);
2674
+ assignBlockToToolUse({
2675
+ blockIndex: chunk.index,
2676
+ toolUseId: toolCallId1
2677
+ });
2678
+ ;
2679
+ outputPayload1 = Object.keys(rest).length > 0 ? rest : {
2680
+ content: (_chunk_content_block_content1 = chunk.content_block.content) !== null && _chunk_content_block_content1 !== void 0 ? _chunk_content_block_content1 : {}
2681
+ };
2682
+ delta1 = {
2683
+ content: null,
2684
+ tool_calls: [
2685
+ {
2686
+ index: index4,
2687
+ id: toolCallId1,
2688
+ type: "function",
2689
+ function: {
2690
+ output: JSON.stringify(outputPayload1)
2691
+ }
2692
+ }
2693
+ ]
2694
+ };
1988
2695
  } else if ("text" in chunk.content_block) {
1989
2696
  delta1 = {
1990
2697
  content: chunk.content_block.text
@@ -2105,10 +2812,22 @@ var post5 = function(param) {
2105
2812
  ];
2106
2813
  case 3:
2107
2814
  data = _state.sent();
2815
+ normalizedContent = Array.isArray(data === null || data === void 0 ? void 0 : data.content) ? data.content.map(function(block) {
2816
+ if ((block === null || block === void 0 ? void 0 : block.type) === "tool_use" && (block === null || block === void 0 ? void 0 : block.name) === "computer") {
2817
+ var _block_input;
2818
+ return _object_spread_props(_object_spread({}, block), {
2819
+ input: normalizeComputerToolCallPayload((_block_input = block.input) !== null && _block_input !== void 0 ? _block_input : {})
2820
+ });
2821
+ }
2822
+ return block;
2823
+ }) : data === null || data === void 0 ? void 0 : data.content;
2824
+ normalizedData = _object_spread({}, data, normalizedContent ? {
2825
+ content: normalizedContent
2826
+ } : {});
2108
2827
  return [
2109
2828
  2,
2110
2829
  new Response(JSON.stringify({
2111
- data: data
2830
+ data: normalizedData
2112
2831
  }), {
2113
2832
  status: 200,
2114
2833
  headers: {
@@ -3178,7 +3897,7 @@ var ollamaClientAdapter = function(param) {
3178
3897
  };
3179
3898
  // src/adapters/run/completionsRunAdapter/index.ts
3180
3899
  import _ from "lodash";
3181
- import { uid as uid2, omit as omit3, isEmpty as isEmpty2 } from "radash";
3900
+ import { uid as uid2, omit as omit4, isEmpty as isEmpty2 } from "radash";
3182
3901
  import dayjs from "dayjs";
3183
3902
  // src/adapters/run/completionsRunAdapter/messages/index.ts
3184
3903
  import { flat } from "radash";
@@ -3309,7 +4028,7 @@ var messages = /*#__PURE__*/ function() {
3309
4028
  // src/adapters/run/completionsRunAdapter/index.ts
3310
4029
  var updatedToolCall = function(param) {
3311
4030
  var toolCall = param.toolCall, delta = param.delta;
3312
- if (!toolCall) return omit3(delta, [
4031
+ if (!toolCall) return omit4(delta, [
3313
4032
  "index"
3314
4033
  ]);
3315
4034
  var result = _.cloneDeep(toolCall);
@@ -3340,10 +4059,11 @@ var toolCallsData = function(param) {
3340
4059
  var prevToolCalls = param.prevToolCalls, delta = param.delta;
3341
4060
  if (!prevToolCalls) {
3342
4061
  return delta.tool_calls.map(function(tc) {
4062
+ var _tc_type;
3343
4063
  return _object_spread({
3344
4064
  id: uid2(24),
3345
- type: "function"
3346
- }, omit3(tc, [
4065
+ type: (_tc_type = tc.type) !== null && _tc_type !== void 0 ? _tc_type : "function"
4066
+ }, omit4(tc, [
3347
4067
  "index"
3348
4068
  ]));
3349
4069
  });
@@ -3378,7 +4098,7 @@ var completionsRunAdapter = function() {
3378
4098
  return {
3379
4099
  handleRun: /*#__PURE__*/ function() {
3380
4100
  var _ref = _async_to_generator(function(param) {
3381
- var client, run3, onEvent2, getMessages2, opts, _tmp, providerResponse, e, _e_cause, _e_message, _e_cause_message, message, toolCallsRunStep, currentContent, currentToolCalls, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, _chunk_choices, choices, choice, delta, _delta_content, err;
4101
+ var client, run3, onEvent2, getMessages2, opts, _tmp, providerResponse, e, _e_cause, _e_message, _e_cause_message, message, toolCallsRunStep, currentContent, currentToolCalls, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, _chunk_choices, choices, choice, delta, _delta_content, err, _message_toolCalls, messageToolCalls, functionToolCalls, pendingFunctionToolCalls, requiredToolCalls;
3382
4102
  return _ts_generator(this, function(_state) {
3383
4103
  switch(_state.label){
3384
4104
  case 0:
@@ -3585,9 +4305,10 @@ var completionsRunAdapter = function() {
3585
4305
  step_details: {
3586
4306
  type: "tool_calls",
3587
4307
  tool_calls: delta.tool_calls.map(function(tc) {
4308
+ var _tc_type;
3588
4309
  return _object_spread({
3589
4310
  id: uid2(24),
3590
- type: "function"
4311
+ type: (_tc_type = tc.type) !== null && _tc_type !== void 0 ? _tc_type : "function"
3591
4312
  }, tc);
3592
4313
  })
3593
4314
  }
@@ -3695,39 +4416,104 @@ var completionsRunAdapter = function() {
3695
4416
  ];
3696
4417
  case 22:
3697
4418
  message = _state.sent();
3698
- if (isEmpty2(message.toolCalls)) {
3699
- return [
3700
- 2,
3701
- onEvent2({
3702
- event: "thread.run.completed",
3703
- data: _object_spread_props(_object_spread({}, run3), {
3704
- status: "completed",
3705
- completed_at: dayjs().unix()
3706
- })
4419
+ messageToolCalls = (_message_toolCalls = message.toolCalls) !== null && _message_toolCalls !== void 0 ? _message_toolCalls : [];
4420
+ functionToolCalls = messageToolCalls.filter(function(toolCall) {
4421
+ return toolCall.type === "function";
4422
+ });
4423
+ pendingFunctionToolCalls = functionToolCalls.filter(function(toolCall) {
4424
+ var _toolCall_function;
4425
+ return !((_toolCall_function = toolCall.function) === null || _toolCall_function === void 0 ? void 0 : _toolCall_function.output);
4426
+ });
4427
+ if (!isEmpty2(pendingFunctionToolCalls)) return [
4428
+ 3,
4429
+ 25
4430
+ ];
4431
+ if (!toolCallsRunStep) return [
4432
+ 3,
4433
+ 24
4434
+ ];
4435
+ return [
4436
+ 4,
4437
+ onEvent2({
4438
+ event: "thread.run.step.completed",
4439
+ data: _object_spread_props(_object_spread({}, toolCallsRunStep), {
4440
+ status: "completed",
4441
+ completed_at: dayjs().unix(),
4442
+ step_details: {
4443
+ type: "tool_calls",
4444
+ tool_calls: currentToolCalls !== null && currentToolCalls !== void 0 ? currentToolCalls : []
4445
+ }
3707
4446
  })
3708
- ];
3709
- }
4447
+ })
4448
+ ];
4449
+ case 23:
4450
+ toolCallsRunStep = _state.sent();
4451
+ _state.label = 24;
4452
+ case 24:
3710
4453
  return [
3711
4454
  2,
3712
4455
  onEvent2({
3713
- event: "thread.run.requires_action",
4456
+ event: "thread.run.completed",
3714
4457
  data: _object_spread_props(_object_spread({}, run3), {
3715
- status: "requires_action",
3716
- required_action: {
3717
- type: "submit_tool_outputs",
3718
- submit_tool_outputs: {
3719
- tool_calls: message.toolCalls
3720
- }
3721
- }
4458
+ status: "completed",
4459
+ completed_at: dayjs().unix()
3722
4460
  })
3723
4461
  })
3724
4462
  ];
3725
- }
3726
- });
3727
- });
3728
- return function(_) {
3729
- return _ref.apply(this, arguments);
3730
- };
4463
+ case 25:
4464
+ requiredToolCalls = pendingFunctionToolCalls.map(function(toolCall) {
4465
+ var _toolCall_function, _toolCall_function1, _toolCall_function2;
4466
+ var _toolCall_function_arguments;
4467
+ var args = (_toolCall_function_arguments = (_toolCall_function = toolCall.function) === null || _toolCall_function === void 0 ? void 0 : _toolCall_function.arguments) !== null && _toolCall_function_arguments !== void 0 ? _toolCall_function_arguments : "";
4468
+ if (((_toolCall_function1 = toolCall.function) === null || _toolCall_function1 === void 0 ? void 0 : _toolCall_function1.name) === "computer_call") {
4469
+ var parsedArguments = {};
4470
+ try {
4471
+ parsedArguments = JSON.parse(args || "{}");
4472
+ } catch (e) {
4473
+ parsedArguments = {};
4474
+ }
4475
+ var _parsedArguments_action, _ref;
4476
+ var computerCall = {
4477
+ action: (_ref = (_parsedArguments_action = parsedArguments === null || parsedArguments === void 0 ? void 0 : parsedArguments.action) !== null && _parsedArguments_action !== void 0 ? _parsedArguments_action : parsedArguments) !== null && _ref !== void 0 ? _ref : {},
4478
+ pending_safety_checks: Array.isArray(parsedArguments === null || parsedArguments === void 0 ? void 0 : parsedArguments.pending_safety_checks) ? parsedArguments.pending_safety_checks : []
4479
+ };
4480
+ return {
4481
+ id: toolCall.id,
4482
+ type: "computer_call",
4483
+ computer_call: computerCall
4484
+ };
4485
+ }
4486
+ var _toolCall_function_name;
4487
+ return {
4488
+ id: toolCall.id,
4489
+ type: "function",
4490
+ function: {
4491
+ name: (_toolCall_function_name = (_toolCall_function2 = toolCall.function) === null || _toolCall_function2 === void 0 ? void 0 : _toolCall_function2.name) !== null && _toolCall_function_name !== void 0 ? _toolCall_function_name : "",
4492
+ arguments: args
4493
+ }
4494
+ };
4495
+ });
4496
+ return [
4497
+ 2,
4498
+ onEvent2({
4499
+ event: "thread.run.requires_action",
4500
+ data: _object_spread_props(_object_spread({}, run3), {
4501
+ status: "requires_action",
4502
+ required_action: {
4503
+ type: "submit_tool_outputs",
4504
+ submit_tool_outputs: {
4505
+ tool_calls: requiredToolCalls
4506
+ }
4507
+ }
4508
+ })
4509
+ })
4510
+ ];
4511
+ }
4512
+ });
4513
+ });
4514
+ return function(_) {
4515
+ return _ref.apply(this, arguments);
4516
+ };
3731
4517
  }()
3732
4518
  };
3733
4519
  };
@@ -4289,6 +5075,40 @@ var threadRunStepDelta = function(param) {
4289
5075
  var event = param.event, controller = param.controller;
4290
5076
  return controller.enqueue(event);
4291
5077
  };
5078
+ // src/adapters/storage/prismaStorageAdapter/threads/runs/onEvent/handlers/threadRunStepCompleted.ts
5079
+ var threadRunStepCompleted = /*#__PURE__*/ function() {
5080
+ var _ref = _async_to_generator(function(param) {
5081
+ var prisma, event, controller;
5082
+ return _ts_generator(this, function(_state) {
5083
+ switch(_state.label){
5084
+ case 0:
5085
+ prisma = param.prisma, event = param.event, controller = param.controller;
5086
+ controller.enqueue(event);
5087
+ return [
5088
+ 4,
5089
+ prisma.runStep.update({
5090
+ where: {
5091
+ id: event.data.id
5092
+ },
5093
+ data: {
5094
+ status: "COMPLETED" /* COMPLETED */ ,
5095
+ stepDetails: event.data.step_details,
5096
+ completedAt: event.data.completed_at
5097
+ }
5098
+ })
5099
+ ];
5100
+ case 1:
5101
+ _state.sent();
5102
+ return [
5103
+ 2
5104
+ ];
5105
+ }
5106
+ });
5107
+ });
5108
+ return function threadRunStepCompleted(_) {
5109
+ return _ref.apply(this, arguments);
5110
+ };
5111
+ }();
4292
5112
  // src/adapters/storage/prismaStorageAdapter/threads/runs/onEvent/handlers/threadMessageCreated.ts
4293
5113
  var status2 = function(event) {
4294
5114
  if (event.data.status === "completed") return "COMPLETED" /* COMPLETED */ ;
@@ -4419,6 +5239,7 @@ var handlers = {
4419
5239
  "thread.run.requires_action": threadRunRequiresAction,
4420
5240
  "thread.run.step.created": threadRunStepCreated,
4421
5241
  "thread.run.step.delta": threadRunStepDelta,
5242
+ "thread.run.step.completed": threadRunStepCompleted,
4422
5243
  "thread.message.created": threadMessageCreated,
4423
5244
  "thread.message.delta": threadMessageDelta,
4424
5245
  "thread.message.completed": threadMessageCompleted
@@ -7708,12 +8529,13 @@ var responsesRunAdapter = function(param) {
7708
8529
  }();
7709
8530
  var handleRun = /*#__PURE__*/ function() {
7710
8531
  var _ref = _async_to_generator(function(param) {
7711
- var client, threadId, response, onEvent2, responseCreatedResponse, toolCalls, mcpCalls, codeInterpreterCalls, itemIds, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, event, _, _tmp, _tmp1, _tmp2, _tmp3, toolCalls2, _tmp4, _tmp5, _tmp6, _tmp7, _tmp8, _tmp9, _tmp10, _tmp11, _tmp12, _tmp13, _tmp14, _tmp15, _tmp16, _tmp17, _tmp18, _tmp19, _tmp20, _tmp21, _tmp22, _tmp23, _tmp24, _tmp25, _tmp26, _tmp27, _tmp28, _tmp29, _tmp30, _tmp31, _tmp32, _tmp33, _tmp34, _tmp35, _tmp36, _tmp37, _tmp38, _tmp39, _tmp40, _tmp41, _tmp42, _tmp43, _tmp44, _tmp45, _tmp46, _tmp47, _tmp48, _tmp49, _tmp50, _tmp51, _tmp52, _tmp53, _tmp54, _tmp55, _tmp56, _tmp57, _tmp58, _tmp59, _tmp60, _tmp61, _tmp62, _tmp63, _tmp64, _tmp65, _tmp66, _tmp67, _tmp68, _tmp69, _tmp70, _tmp71, _tmp72, _tmp73, _tmp74, _tmp75, _tmp76, _tmp77, _tmp78, _tmp79, _tmp80, _tmp81, _tmp82, _tmp83, _tmp84, _tmp85, _tmp86, _tmp87, _tmp88, _tmp89, _tmp90, _tmp91, _tmp92, _tmp93, _tmp94, _tmp95, _tmp96, _tmp97, _tmp98, _tmp99, _tmp100, toolCall, mcpCall, _tmp101, _tmp102, _tmp103, _tmp104, err, e, _tmp105, _tmp106;
8532
+ var client, threadId, response, onEvent2, responseCreatedResponse, responseCompletedResponse, toolCalls, mcpCalls, codeInterpreterCalls, itemIds, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, event, _, _tmp, _tmp1, _tmp2, _tmp3, _tmp4, _tmp5, _tmp6, _tmp7, _tmp8, _tmp9, _tmp10, _tmp11, _tmp12, _tmp13, _tmp14, _tmp15, _tmp16, _tmp17, _tmp18, _tmp19, _tmp20, _tmp21, _tmp22, _tmp23, _tmp24, _tmp25, _tmp26, _tmp27, _tmp28, _tmp29, _tmp30, _tmp31, _tmp32, _tmp33, _tmp34, _tmp35, _tmp36, _tmp37, _tmp38, _tmp39, _tmp40, _tmp41, _tmp42, _tmp43, _tmp44, _tmp45, _tmp46, _tmp47, _tmp48, _tmp49, _tmp50, _tmp51, _tmp52, _tmp53, _tmp54, _tmp55, _tmp56, _tmp57, _tmp58, _tmp59, _tmp60, _tmp61, _tmp62, _tmp63, _tmp64, _tmp65, _tmp66, _tmp67, _tmp68, _tmp69, _tmp70, _tmp71, _tmp72, _tmp73, _tmp74, _tmp75, _tmp76, _tmp77, _tmp78, _tmp79, _tmp80, _tmp81, _tmp82, _tmp83, _tmp84, _tmp85, _tmp86, _tmp87, _tmp88, _tmp89, _tmp90, _tmp91, _tmp92, _tmp93, _tmp94, _tmp95, toolCall, mcpCall, _tmp96, _tmp97, _tmp98, _tmp99, err, _responseCompletedResponse_output, toolCalls2, serializedRun, _tmp100, e, _tmp101, _tmp102;
7712
8533
  return _ts_generator(this, function(_state) {
7713
8534
  switch(_state.label){
7714
8535
  case 0:
7715
8536
  client = param.client, threadId = param.threadId, response = param.response, onEvent2 = param.onEvent;
7716
8537
  responseCreatedResponse = null;
8538
+ responseCompletedResponse = null;
7717
8539
  toolCalls = {};
7718
8540
  mcpCalls = {};
7719
8541
  codeInterpreterCalls = {};
@@ -7722,18 +8544,18 @@ var responsesRunAdapter = function(param) {
7722
8544
  case 1:
7723
8545
  _state.trys.push([
7724
8546
  1,
7725
- 152,
7726
- 155,
7727
- 156
8547
+ 151,
8548
+ 154,
8549
+ 155
7728
8550
  ]);
7729
8551
  _iteratorAbruptCompletion = false, _didIteratorError = false;
7730
8552
  _state.label = 2;
7731
8553
  case 2:
7732
8554
  _state.trys.push([
7733
8555
  2,
7734
- 145,
7735
- 146,
7736
- 151
8556
+ 139,
8557
+ 140,
8558
+ 145
7737
8559
  ]);
7738
8560
  _iterator = _async_iterator(response);
7739
8561
  _state.label = 3;
@@ -7745,7 +8567,7 @@ var responsesRunAdapter = function(param) {
7745
8567
  case 4:
7746
8568
  if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done)) return [
7747
8569
  3,
7748
- 144
8570
+ 138
7749
8571
  ];
7750
8572
  _value = _step.value;
7751
8573
  event = _value;
@@ -7769,52 +8591,52 @@ var responsesRunAdapter = function(param) {
7769
8591
  case "response.failed":
7770
8592
  return [
7771
8593
  3,
7772
- 18
8594
+ 12
7773
8595
  ];
7774
8596
  case "response.output_text.delta":
7775
8597
  return [
7776
8598
  3,
7777
- 21
8599
+ 15
7778
8600
  ];
7779
8601
  case "response.output_item.added":
7780
8602
  return [
7781
8603
  3,
7782
- 23
8604
+ 17
7783
8605
  ];
7784
8606
  case "response.output_item.done":
7785
8607
  return [
7786
8608
  3,
7787
- 81
8609
+ 75
7788
8610
  ];
7789
8611
  case "response.function_call_arguments.delta":
7790
8612
  return [
7791
8613
  3,
7792
- 132
8614
+ 126
7793
8615
  ];
7794
8616
  case "response.mcp_call_arguments.delta":
7795
8617
  return [
7796
8618
  3,
7797
- 134
8619
+ 128
7798
8620
  ];
7799
8621
  case "response.image_generation_call.in_progress":
7800
8622
  return [
7801
8623
  3,
7802
- 136
8624
+ 130
7803
8625
  ];
7804
8626
  case "response.image_generation_call.generating":
7805
8627
  return [
7806
8628
  3,
7807
- 136
8629
+ 130
7808
8630
  ];
7809
8631
  case "response.image_generation_call.partial_image":
7810
8632
  return [
7811
8633
  3,
7812
- 139
8634
+ 133
7813
8635
  ];
7814
8636
  }
7815
8637
  return [
7816
8638
  3,
7817
- 142
8639
+ 136
7818
8640
  ];
7819
8641
  case 5:
7820
8642
  responseCreatedResponse = event.response;
@@ -7845,7 +8667,7 @@ var responsesRunAdapter = function(param) {
7845
8667
  _state.sent();
7846
8668
  return [
7847
8669
  3,
7848
- 143
8670
+ 137
7849
8671
  ];
7850
8672
  case 8:
7851
8673
  _tmp2 = {
@@ -7875,103 +8697,27 @@ var responsesRunAdapter = function(param) {
7875
8697
  _state.sent();
7876
8698
  return [
7877
8699
  3,
7878
- 143
8700
+ 137
7879
8701
  ];
7880
8702
  case 11:
7881
- itemIds = event.response.output.filter(function(o) {
7882
- return o.id;
7883
- }).map(function(o) {
7884
- return o.id;
7885
- });
7886
- toolCalls2 = event.response.output.filter(function(o) {
7887
- return o.type === "function_call" || o.type === "computer_call";
7888
- });
7889
- if (!(toolCalls2.length > 0)) return [
7890
- 3,
7891
- 14
7892
- ];
7893
- _tmp4 = {
7894
- event: "thread.run.requires_action"
7895
- };
7896
- _tmp5 = [
7897
- {}
7898
- ];
7899
- _tmp6 = {
7900
- response: event.response
7901
- };
7902
- return [
7903
- 4,
7904
- getOpenaiAssistant({
7905
- select: {
7906
- id: true
7907
- }
7908
- })
7909
- ];
8703
+ {
8704
+ responseCompletedResponse = event.response;
8705
+ itemIds = event.response.output.filter(function(o) {
8706
+ return o.id;
8707
+ }).map(function(o) {
8708
+ return o.id;
8709
+ });
8710
+ return [
8711
+ 3,
8712
+ 137
8713
+ ];
8714
+ }
8715
+ _state.label = 12;
7910
8716
  case 12:
7911
- return [
7912
- 4,
7913
- onEvent2.apply(void 0, [
7914
- (_tmp4.data = _object_spread.apply(void 0, _tmp5.concat([
7915
- serializeResponseAsRun.apply(void 0, [
7916
- (_tmp6.assistantId = _state.sent().id, _tmp6)
7917
- ]),
7918
- {
7919
- status: "requires_action",
7920
- required_action: {
7921
- type: "submit_tool_outputs",
7922
- submit_tool_outputs: {
7923
- tool_calls: _to_consumable_array(serializeToolCalls2({
7924
- toolCalls: toolCalls2
7925
- }))
7926
- }
7927
- }
7928
- }
7929
- ])), _tmp4)
7930
- ])
7931
- ];
7932
- case 13:
7933
- _state.sent();
7934
- return [
7935
- 3,
7936
- 17
7937
- ];
7938
- case 14:
7939
- _tmp7 = {
7940
- event: "thread.run.completed"
7941
- };
7942
- _tmp8 = {
7943
- response: event.response
7944
- };
7945
- return [
7946
- 4,
7947
- getOpenaiAssistant({
7948
- select: {
7949
- id: true
7950
- }
7951
- })
7952
- ];
7953
- case 15:
7954
- return [
7955
- 4,
7956
- onEvent2.apply(void 0, [
7957
- (_tmp7.data = serializeResponseAsRun.apply(void 0, [
7958
- (_tmp8.assistantId = _state.sent().id, _tmp8)
7959
- ]), _tmp7)
7960
- ])
7961
- ];
7962
- case 16:
7963
- _state.sent();
7964
- _state.label = 17;
7965
- case 17:
7966
- return [
7967
- 3,
7968
- 143
7969
- ];
7970
- case 18:
7971
- _tmp9 = {
8717
+ _tmp4 = {
7972
8718
  event: "thread.run.failed"
7973
8719
  };
7974
- _tmp10 = {
8720
+ _tmp5 = {
7975
8721
  response: event.response
7976
8722
  };
7977
8723
  return [
@@ -7982,22 +8728,22 @@ var responsesRunAdapter = function(param) {
7982
8728
  }
7983
8729
  })
7984
8730
  ];
7985
- case 19:
8731
+ case 13:
7986
8732
  return [
7987
8733
  4,
7988
8734
  onEvent2.apply(void 0, [
7989
- (_tmp9.data = serializeResponseAsRun.apply(void 0, [
7990
- (_tmp10.assistantId = _state.sent().id, _tmp10)
7991
- ]), _tmp9)
8735
+ (_tmp4.data = serializeResponseAsRun.apply(void 0, [
8736
+ (_tmp5.assistantId = _state.sent().id, _tmp5)
8737
+ ]), _tmp4)
7992
8738
  ])
7993
8739
  ];
7994
- case 20:
8740
+ case 14:
7995
8741
  _state.sent();
7996
8742
  return [
7997
8743
  3,
7998
- 143
8744
+ 137
7999
8745
  ];
8000
- case 21:
8746
+ case 15:
8001
8747
  return [
8002
8748
  4,
8003
8749
  onEvent2({
@@ -8018,21 +8764,21 @@ var responsesRunAdapter = function(param) {
8018
8764
  }
8019
8765
  })
8020
8766
  ];
8021
- case 22:
8767
+ case 16:
8022
8768
  _state.sent();
8023
8769
  return [
8024
8770
  3,
8025
- 143
8771
+ 137
8026
8772
  ];
8027
- case 23:
8773
+ case 17:
8028
8774
  if (!(event.item.type === "message")) return [
8029
8775
  3,
8030
- 28
8776
+ 22
8031
8777
  ];
8032
- _tmp11 = {
8778
+ _tmp6 = {
8033
8779
  event: "thread.message.created"
8034
8780
  };
8035
- _tmp12 = {
8781
+ _tmp7 = {
8036
8782
  item: event.item,
8037
8783
  threadId: threadId
8038
8784
  };
@@ -8044,21 +8790,21 @@ var responsesRunAdapter = function(param) {
8044
8790
  }
8045
8791
  })
8046
8792
  ];
8047
- case 24:
8793
+ case 18:
8048
8794
  return [
8049
8795
  4,
8050
8796
  onEvent2.apply(void 0, [
8051
- (_tmp11.data = serializeItemAsMessage.apply(void 0, [
8052
- (_tmp12.openaiAssistant = _state.sent(), _tmp12.createdAt = dayjs21().unix(), _tmp12.runId = responseCreatedResponse.id, _tmp12.status = "in_progress", _tmp12)
8053
- ]), _tmp11)
8797
+ (_tmp6.data = serializeItemAsMessage.apply(void 0, [
8798
+ (_tmp7.openaiAssistant = _state.sent(), _tmp7.createdAt = dayjs21().unix(), _tmp7.runId = responseCreatedResponse.id, _tmp7.status = "in_progress", _tmp7)
8799
+ ]), _tmp6)
8054
8800
  ])
8055
8801
  ];
8056
- case 25:
8802
+ case 19:
8057
8803
  _state.sent();
8058
- _tmp13 = {
8804
+ _tmp8 = {
8059
8805
  event: "thread.run.step.created"
8060
8806
  };
8061
- _tmp14 = {
8807
+ _tmp9 = {
8062
8808
  item: event.item,
8063
8809
  threadId: threadId
8064
8810
  };
@@ -8070,31 +8816,31 @@ var responsesRunAdapter = function(param) {
8070
8816
  }
8071
8817
  })
8072
8818
  ];
8073
- case 26:
8819
+ case 20:
8074
8820
  return [
8075
8821
  4,
8076
8822
  onEvent2.apply(void 0, [
8077
- (_tmp13.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8078
- (_tmp14.openaiAssistant = _state.sent(), _tmp14.runId = responseCreatedResponse.id, _tmp14.status = "in_progress", _tmp14.completedAt = null, _tmp14)
8079
- ]), _tmp13)
8823
+ (_tmp8.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8824
+ (_tmp9.openaiAssistant = _state.sent(), _tmp9.runId = responseCreatedResponse.id, _tmp9.status = "in_progress", _tmp9.completedAt = null, _tmp9)
8825
+ ]), _tmp8)
8080
8826
  ])
8081
8827
  ];
8082
- case 27:
8828
+ case 21:
8083
8829
  _state.sent();
8084
8830
  return [
8085
8831
  3,
8086
- 80
8832
+ 74
8087
8833
  ];
8088
- case 28:
8834
+ case 22:
8089
8835
  if (!(event.item.type === "function_call")) return [
8090
8836
  3,
8091
- 31
8837
+ 25
8092
8838
  ];
8093
8839
  toolCalls[event.item.id] = event.item;
8094
- _tmp15 = {
8840
+ _tmp10 = {
8095
8841
  event: "thread.run.step.created"
8096
8842
  };
8097
- _tmp16 = {
8843
+ _tmp11 = {
8098
8844
  item: event.item,
8099
8845
  threadId: threadId
8100
8846
  };
@@ -8106,30 +8852,30 @@ var responsesRunAdapter = function(param) {
8106
8852
  }
8107
8853
  })
8108
8854
  ];
8109
- case 29:
8855
+ case 23:
8110
8856
  return [
8111
8857
  4,
8112
8858
  onEvent2.apply(void 0, [
8113
- (_tmp15.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8114
- (_tmp16.openaiAssistant = _state.sent(), _tmp16.runId = responseCreatedResponse.id, _tmp16)
8115
- ]), _tmp15)
8859
+ (_tmp10.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8860
+ (_tmp11.openaiAssistant = _state.sent(), _tmp11.runId = responseCreatedResponse.id, _tmp11)
8861
+ ]), _tmp10)
8116
8862
  ])
8117
8863
  ];
8118
- case 30:
8864
+ case 24:
8119
8865
  _state.sent();
8120
8866
  return [
8121
8867
  3,
8122
- 80
8868
+ 74
8123
8869
  ];
8124
- case 31:
8870
+ case 25:
8125
8871
  if (!(event.item.type === "computer_call")) return [
8126
8872
  3,
8127
- 38
8873
+ 32
8128
8874
  ];
8129
- _tmp17 = {
8875
+ _tmp12 = {
8130
8876
  event: "thread.message.created"
8131
8877
  };
8132
- _tmp18 = {
8878
+ _tmp13 = {
8133
8879
  item: event.item,
8134
8880
  threadId: threadId
8135
8881
  };
@@ -8141,21 +8887,21 @@ var responsesRunAdapter = function(param) {
8141
8887
  }
8142
8888
  })
8143
8889
  ];
8144
- case 32:
8890
+ case 26:
8145
8891
  return [
8146
8892
  4,
8147
8893
  onEvent2.apply(void 0, [
8148
- (_tmp17.data = serializeItemAsMessage.apply(void 0, [
8149
- (_tmp18.openaiAssistant = _state.sent(), _tmp18.createdAt = dayjs21().unix(), _tmp18.runId = responseCreatedResponse.id, _tmp18.status = "in_progress", _tmp18)
8150
- ]), _tmp17)
8894
+ (_tmp12.data = serializeItemAsMessage.apply(void 0, [
8895
+ (_tmp13.openaiAssistant = _state.sent(), _tmp13.createdAt = dayjs21().unix(), _tmp13.runId = responseCreatedResponse.id, _tmp13.status = "in_progress", _tmp13)
8896
+ ]), _tmp12)
8151
8897
  ])
8152
8898
  ];
8153
- case 33:
8899
+ case 27:
8154
8900
  _state.sent();
8155
- _tmp19 = {
8901
+ _tmp14 = {
8156
8902
  event: "thread.run.step.created"
8157
8903
  };
8158
- _tmp20 = {
8904
+ _tmp15 = {
8159
8905
  item: event.item,
8160
8906
  threadId: threadId
8161
8907
  };
@@ -8167,21 +8913,21 @@ var responsesRunAdapter = function(param) {
8167
8913
  }
8168
8914
  })
8169
8915
  ];
8170
- case 34:
8916
+ case 28:
8171
8917
  return [
8172
8918
  4,
8173
8919
  onEvent2.apply(void 0, [
8174
- (_tmp19.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8175
- (_tmp20.openaiAssistant = _state.sent(), _tmp20.runId = responseCreatedResponse.id, _tmp20)
8176
- ]), _tmp19)
8920
+ (_tmp14.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8921
+ (_tmp15.openaiAssistant = _state.sent(), _tmp15.runId = responseCreatedResponse.id, _tmp15)
8922
+ ]), _tmp14)
8177
8923
  ])
8178
8924
  ];
8179
- case 35:
8925
+ case 29:
8180
8926
  _state.sent();
8181
- _tmp21 = {
8927
+ _tmp16 = {
8182
8928
  event: "thread.run.step.created"
8183
8929
  };
8184
- _tmp22 = {
8930
+ _tmp17 = {
8185
8931
  item: event.item,
8186
8932
  items: []
8187
8933
  };
@@ -8193,30 +8939,30 @@ var responsesRunAdapter = function(param) {
8193
8939
  }
8194
8940
  })
8195
8941
  ];
8196
- case 36:
8942
+ case 30:
8197
8943
  return [
8198
8944
  4,
8199
8945
  onEvent2.apply(void 0, [
8200
- (_tmp21.data = serializeItemAsComputerCallRunStep.apply(void 0, [
8201
- (_tmp22.openaiAssistant = _state.sent(), _tmp22.threadId = threadId, _tmp22.runId = responseCreatedResponse.id, _tmp22.completedAt = null, _tmp22)
8202
- ]), _tmp21)
8946
+ (_tmp16.data = serializeItemAsComputerCallRunStep.apply(void 0, [
8947
+ (_tmp17.openaiAssistant = _state.sent(), _tmp17.threadId = threadId, _tmp17.runId = responseCreatedResponse.id, _tmp17.completedAt = null, _tmp17)
8948
+ ]), _tmp16)
8203
8949
  ])
8204
8950
  ];
8205
- case 37:
8951
+ case 31:
8206
8952
  _state.sent();
8207
8953
  return [
8208
8954
  3,
8209
- 80
8955
+ 74
8210
8956
  ];
8211
- case 38:
8957
+ case 32:
8212
8958
  if (!(event.item.type === "image_generation_call")) return [
8213
8959
  3,
8214
- 45
8960
+ 39
8215
8961
  ];
8216
- _tmp23 = {
8962
+ _tmp18 = {
8217
8963
  event: "thread.message.created"
8218
8964
  };
8219
- _tmp24 = {
8965
+ _tmp19 = {
8220
8966
  item: event.item,
8221
8967
  threadId: threadId
8222
8968
  };
@@ -8228,21 +8974,21 @@ var responsesRunAdapter = function(param) {
8228
8974
  }
8229
8975
  })
8230
8976
  ];
8231
- case 39:
8977
+ case 33:
8232
8978
  return [
8233
8979
  4,
8234
8980
  onEvent2.apply(void 0, [
8235
- (_tmp23.data = serializeItemAsMessage.apply(void 0, [
8236
- (_tmp24.openaiAssistant = _state.sent(), _tmp24.createdAt = dayjs21().unix(), _tmp24.runId = responseCreatedResponse.id, _tmp24.status = "in_progress", _tmp24)
8237
- ]), _tmp23)
8981
+ (_tmp18.data = serializeItemAsMessage.apply(void 0, [
8982
+ (_tmp19.openaiAssistant = _state.sent(), _tmp19.createdAt = dayjs21().unix(), _tmp19.runId = responseCreatedResponse.id, _tmp19.status = "in_progress", _tmp19)
8983
+ ]), _tmp18)
8238
8984
  ])
8239
8985
  ];
8240
- case 40:
8986
+ case 34:
8241
8987
  _state.sent();
8242
- _tmp25 = {
8988
+ _tmp20 = {
8243
8989
  event: "thread.run.step.created"
8244
8990
  };
8245
- _tmp26 = {
8991
+ _tmp21 = {
8246
8992
  item: event.item,
8247
8993
  threadId: threadId
8248
8994
  };
@@ -8254,21 +9000,21 @@ var responsesRunAdapter = function(param) {
8254
9000
  }
8255
9001
  })
8256
9002
  ];
8257
- case 41:
9003
+ case 35:
8258
9004
  return [
8259
9005
  4,
8260
9006
  onEvent2.apply(void 0, [
8261
- (_tmp25.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8262
- (_tmp26.openaiAssistant = _state.sent(), _tmp26.runId = responseCreatedResponse.id, _tmp26.status = "in_progress", _tmp26.completedAt = null, _tmp26)
8263
- ]), _tmp25)
9007
+ (_tmp20.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
9008
+ (_tmp21.openaiAssistant = _state.sent(), _tmp21.runId = responseCreatedResponse.id, _tmp21.status = "in_progress", _tmp21.completedAt = null, _tmp21)
9009
+ ]), _tmp20)
8264
9010
  ])
8265
9011
  ];
8266
- case 42:
9012
+ case 36:
8267
9013
  _state.sent();
8268
- _tmp27 = {
9014
+ _tmp22 = {
8269
9015
  event: "thread.run.step.created"
8270
9016
  };
8271
- _tmp28 = {
9017
+ _tmp23 = {
8272
9018
  item: event.item
8273
9019
  };
8274
9020
  return [
@@ -8279,30 +9025,30 @@ var responsesRunAdapter = function(param) {
8279
9025
  }
8280
9026
  })
8281
9027
  ];
8282
- case 43:
9028
+ case 37:
8283
9029
  return [
8284
9030
  4,
8285
9031
  onEvent2.apply(void 0, [
8286
- (_tmp27.data = serializeItemAsImageGenerationRunStep.apply(void 0, [
8287
- (_tmp28.openaiAssistant = _state.sent(), _tmp28.threadId = threadId, _tmp28.runId = responseCreatedResponse.id, _tmp28.status = "in_progress", _tmp28.completedAt = null, _tmp28)
8288
- ]), _tmp27)
9032
+ (_tmp22.data = serializeItemAsImageGenerationRunStep.apply(void 0, [
9033
+ (_tmp23.openaiAssistant = _state.sent(), _tmp23.threadId = threadId, _tmp23.runId = responseCreatedResponse.id, _tmp23.status = "in_progress", _tmp23.completedAt = null, _tmp23)
9034
+ ]), _tmp22)
8289
9035
  ])
8290
9036
  ];
8291
- case 44:
9037
+ case 38:
8292
9038
  _state.sent();
8293
9039
  return [
8294
9040
  3,
8295
- 80
9041
+ 74
8296
9042
  ];
8297
- case 45:
9043
+ case 39:
8298
9044
  if (!(event.item.type === "reasoning")) return [
8299
9045
  3,
8300
- 52
9046
+ 46
8301
9047
  ];
8302
- _tmp29 = {
9048
+ _tmp24 = {
8303
9049
  event: "thread.message.created"
8304
9050
  };
8305
- _tmp30 = {
9051
+ _tmp25 = {
8306
9052
  item: event.item,
8307
9053
  threadId: threadId
8308
9054
  };
@@ -8314,21 +9060,21 @@ var responsesRunAdapter = function(param) {
8314
9060
  }
8315
9061
  })
8316
9062
  ];
8317
- case 46:
9063
+ case 40:
8318
9064
  return [
8319
9065
  4,
8320
9066
  onEvent2.apply(void 0, [
8321
- (_tmp29.data = serializeItemAsMessage.apply(void 0, [
8322
- (_tmp30.openaiAssistant = _state.sent(), _tmp30.createdAt = dayjs21().unix(), _tmp30.runId = responseCreatedResponse.id, _tmp30.status = "in_progress", _tmp30)
8323
- ]), _tmp29)
9067
+ (_tmp24.data = serializeItemAsMessage.apply(void 0, [
9068
+ (_tmp25.openaiAssistant = _state.sent(), _tmp25.createdAt = dayjs21().unix(), _tmp25.runId = responseCreatedResponse.id, _tmp25.status = "in_progress", _tmp25)
9069
+ ]), _tmp24)
8324
9070
  ])
8325
9071
  ];
8326
- case 47:
9072
+ case 41:
8327
9073
  _state.sent();
8328
- _tmp31 = {
9074
+ _tmp26 = {
8329
9075
  event: "thread.run.step.created"
8330
9076
  };
8331
- _tmp32 = {
9077
+ _tmp27 = {
8332
9078
  item: event.item,
8333
9079
  threadId: threadId
8334
9080
  };
@@ -8340,21 +9086,21 @@ var responsesRunAdapter = function(param) {
8340
9086
  }
8341
9087
  })
8342
9088
  ];
8343
- case 48:
9089
+ case 42:
8344
9090
  return [
8345
9091
  4,
8346
9092
  onEvent2.apply(void 0, [
8347
- (_tmp31.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8348
- (_tmp32.openaiAssistant = _state.sent(), _tmp32.runId = responseCreatedResponse.id, _tmp32.status = "in_progress", _tmp32.completedAt = null, _tmp32)
8349
- ]), _tmp31)
9093
+ (_tmp26.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
9094
+ (_tmp27.openaiAssistant = _state.sent(), _tmp27.runId = responseCreatedResponse.id, _tmp27.status = "in_progress", _tmp27.completedAt = null, _tmp27)
9095
+ ]), _tmp26)
8350
9096
  ])
8351
9097
  ];
8352
- case 49:
9098
+ case 43:
8353
9099
  _state.sent();
8354
- _tmp33 = {
9100
+ _tmp28 = {
8355
9101
  event: "thread.run.step.created"
8356
9102
  };
8357
- _tmp34 = {
9103
+ _tmp29 = {
8358
9104
  item: event.item
8359
9105
  };
8360
9106
  return [
@@ -8365,30 +9111,30 @@ var responsesRunAdapter = function(param) {
8365
9111
  }
8366
9112
  })
8367
9113
  ];
8368
- case 50:
9114
+ case 44:
8369
9115
  return [
8370
9116
  4,
8371
9117
  onEvent2.apply(void 0, [
8372
- (_tmp33.data = serializeItemAsReasoningRunStep.apply(void 0, [
8373
- (_tmp34.openaiAssistant = _state.sent(), _tmp34.threadId = threadId, _tmp34.runId = responseCreatedResponse.id, _tmp34.completedAt = null, _tmp34)
8374
- ]), _tmp33)
9118
+ (_tmp28.data = serializeItemAsReasoningRunStep.apply(void 0, [
9119
+ (_tmp29.openaiAssistant = _state.sent(), _tmp29.threadId = threadId, _tmp29.runId = responseCreatedResponse.id, _tmp29.completedAt = null, _tmp29)
9120
+ ]), _tmp28)
8375
9121
  ])
8376
9122
  ];
8377
- case 51:
9123
+ case 45:
8378
9124
  _state.sent();
8379
9125
  return [
8380
9126
  3,
8381
- 80
9127
+ 74
8382
9128
  ];
8383
- case 52:
9129
+ case 46:
8384
9130
  if (!(event.item.type === "web_search_call")) return [
8385
9131
  3,
8386
- 59
9132
+ 53
8387
9133
  ];
8388
- _tmp35 = {
9134
+ _tmp30 = {
8389
9135
  event: "thread.message.created"
8390
9136
  };
8391
- _tmp36 = {
9137
+ _tmp31 = {
8392
9138
  item: event.item,
8393
9139
  threadId: threadId
8394
9140
  };
@@ -8400,21 +9146,21 @@ var responsesRunAdapter = function(param) {
8400
9146
  }
8401
9147
  })
8402
9148
  ];
8403
- case 53:
9149
+ case 47:
8404
9150
  return [
8405
9151
  4,
8406
9152
  onEvent2.apply(void 0, [
8407
- (_tmp35.data = serializeItemAsMessage.apply(void 0, [
8408
- (_tmp36.openaiAssistant = _state.sent(), _tmp36.createdAt = dayjs21().unix(), _tmp36.runId = responseCreatedResponse.id, _tmp36.status = "in_progress", _tmp36)
8409
- ]), _tmp35)
9153
+ (_tmp30.data = serializeItemAsMessage.apply(void 0, [
9154
+ (_tmp31.openaiAssistant = _state.sent(), _tmp31.createdAt = dayjs21().unix(), _tmp31.runId = responseCreatedResponse.id, _tmp31.status = "in_progress", _tmp31)
9155
+ ]), _tmp30)
8410
9156
  ])
8411
9157
  ];
8412
- case 54:
9158
+ case 48:
8413
9159
  _state.sent();
8414
- _tmp37 = {
9160
+ _tmp32 = {
8415
9161
  event: "thread.run.step.created"
8416
9162
  };
8417
- _tmp38 = {
9163
+ _tmp33 = {
8418
9164
  item: event.item,
8419
9165
  threadId: threadId
8420
9166
  };
@@ -8426,21 +9172,21 @@ var responsesRunAdapter = function(param) {
8426
9172
  }
8427
9173
  })
8428
9174
  ];
8429
- case 55:
9175
+ case 49:
8430
9176
  return [
8431
9177
  4,
8432
9178
  onEvent2.apply(void 0, [
8433
- (_tmp37.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8434
- (_tmp38.openaiAssistant = _state.sent(), _tmp38.runId = responseCreatedResponse.id, _tmp38.status = "in_progress", _tmp38.completedAt = null, _tmp38)
8435
- ]), _tmp37)
9179
+ (_tmp32.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
9180
+ (_tmp33.openaiAssistant = _state.sent(), _tmp33.runId = responseCreatedResponse.id, _tmp33.status = "in_progress", _tmp33.completedAt = null, _tmp33)
9181
+ ]), _tmp32)
8436
9182
  ])
8437
9183
  ];
8438
- case 56:
9184
+ case 50:
8439
9185
  _state.sent();
8440
- _tmp39 = {
9186
+ _tmp34 = {
8441
9187
  event: "thread.run.step.created"
8442
9188
  };
8443
- _tmp40 = {
9189
+ _tmp35 = {
8444
9190
  item: event.item
8445
9191
  };
8446
9192
  return [
@@ -8451,30 +9197,30 @@ var responsesRunAdapter = function(param) {
8451
9197
  }
8452
9198
  })
8453
9199
  ];
8454
- case 57:
9200
+ case 51:
8455
9201
  return [
8456
9202
  4,
8457
9203
  onEvent2.apply(void 0, [
8458
- (_tmp39.data = serializeItemAsWebSearchRunStep.apply(void 0, [
8459
- (_tmp40.openaiAssistant = _state.sent(), _tmp40.threadId = threadId, _tmp40.runId = responseCreatedResponse.id, _tmp40.completedAt = null, _tmp40)
8460
- ]), _tmp39)
9204
+ (_tmp34.data = serializeItemAsWebSearchRunStep.apply(void 0, [
9205
+ (_tmp35.openaiAssistant = _state.sent(), _tmp35.threadId = threadId, _tmp35.runId = responseCreatedResponse.id, _tmp35.completedAt = null, _tmp35)
9206
+ ]), _tmp34)
8461
9207
  ])
8462
9208
  ];
8463
- case 58:
9209
+ case 52:
8464
9210
  _state.sent();
8465
9211
  return [
8466
9212
  3,
8467
- 80
9213
+ 74
8468
9214
  ];
8469
- case 59:
9215
+ case 53:
8470
9216
  if (!(event.item.type === "mcp_list_tools")) return [
8471
9217
  3,
8472
- 66
9218
+ 60
8473
9219
  ];
8474
- _tmp41 = {
9220
+ _tmp36 = {
8475
9221
  event: "thread.message.created"
8476
9222
  };
8477
- _tmp42 = {
9223
+ _tmp37 = {
8478
9224
  item: event.item,
8479
9225
  threadId: threadId
8480
9226
  };
@@ -8486,21 +9232,21 @@ var responsesRunAdapter = function(param) {
8486
9232
  }
8487
9233
  })
8488
9234
  ];
8489
- case 60:
9235
+ case 54:
8490
9236
  return [
8491
9237
  4,
8492
9238
  onEvent2.apply(void 0, [
8493
- (_tmp41.data = serializeItemAsMessage.apply(void 0, [
8494
- (_tmp42.openaiAssistant = _state.sent(), _tmp42.createdAt = dayjs21().unix(), _tmp42.runId = responseCreatedResponse.id, _tmp42.status = "in_progress", _tmp42)
8495
- ]), _tmp41)
9239
+ (_tmp36.data = serializeItemAsMessage.apply(void 0, [
9240
+ (_tmp37.openaiAssistant = _state.sent(), _tmp37.createdAt = dayjs21().unix(), _tmp37.runId = responseCreatedResponse.id, _tmp37.status = "in_progress", _tmp37)
9241
+ ]), _tmp36)
8496
9242
  ])
8497
9243
  ];
8498
- case 61:
9244
+ case 55:
8499
9245
  _state.sent();
8500
- _tmp43 = {
9246
+ _tmp38 = {
8501
9247
  event: "thread.run.step.created"
8502
9248
  };
8503
- _tmp44 = {
9249
+ _tmp39 = {
8504
9250
  item: event.item,
8505
9251
  threadId: threadId
8506
9252
  };
@@ -8512,21 +9258,21 @@ var responsesRunAdapter = function(param) {
8512
9258
  }
8513
9259
  })
8514
9260
  ];
8515
- case 62:
9261
+ case 56:
8516
9262
  return [
8517
9263
  4,
8518
9264
  onEvent2.apply(void 0, [
8519
- (_tmp43.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8520
- (_tmp44.openaiAssistant = _state.sent(), _tmp44.runId = responseCreatedResponse.id, _tmp44.status = "in_progress", _tmp44.completedAt = null, _tmp44)
8521
- ]), _tmp43)
9265
+ (_tmp38.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
9266
+ (_tmp39.openaiAssistant = _state.sent(), _tmp39.runId = responseCreatedResponse.id, _tmp39.status = "in_progress", _tmp39.completedAt = null, _tmp39)
9267
+ ]), _tmp38)
8522
9268
  ])
8523
9269
  ];
8524
- case 63:
9270
+ case 57:
8525
9271
  _state.sent();
8526
- _tmp45 = {
9272
+ _tmp40 = {
8527
9273
  event: "thread.run.step.created"
8528
9274
  };
8529
- _tmp46 = {
9275
+ _tmp41 = {
8530
9276
  item: event.item
8531
9277
  };
8532
9278
  return [
@@ -8537,31 +9283,31 @@ var responsesRunAdapter = function(param) {
8537
9283
  }
8538
9284
  })
8539
9285
  ];
8540
- case 64:
9286
+ case 58:
8541
9287
  return [
8542
9288
  4,
8543
9289
  onEvent2.apply(void 0, [
8544
- (_tmp45.data = serializeItemAsMcpListToolsRunStep.apply(void 0, [
8545
- (_tmp46.openaiAssistant = _state.sent(), _tmp46.threadId = threadId, _tmp46.runId = responseCreatedResponse.id, _tmp46.completedAt = null, _tmp46)
8546
- ]), _tmp45)
9290
+ (_tmp40.data = serializeItemAsMcpListToolsRunStep.apply(void 0, [
9291
+ (_tmp41.openaiAssistant = _state.sent(), _tmp41.threadId = threadId, _tmp41.runId = responseCreatedResponse.id, _tmp41.completedAt = null, _tmp41)
9292
+ ]), _tmp40)
8547
9293
  ])
8548
9294
  ];
8549
- case 65:
9295
+ case 59:
8550
9296
  _state.sent();
8551
9297
  return [
8552
9298
  3,
8553
- 80
9299
+ 74
8554
9300
  ];
8555
- case 66:
9301
+ case 60:
8556
9302
  if (!(event.item.type === "mcp_call")) return [
8557
9303
  3,
8558
- 73
9304
+ 67
8559
9305
  ];
8560
9306
  mcpCalls[event.item.id] = event.item;
8561
- _tmp47 = {
9307
+ _tmp42 = {
8562
9308
  event: "thread.message.created"
8563
9309
  };
8564
- _tmp48 = {
9310
+ _tmp43 = {
8565
9311
  item: event.item,
8566
9312
  threadId: threadId
8567
9313
  };
@@ -8573,21 +9319,21 @@ var responsesRunAdapter = function(param) {
8573
9319
  }
8574
9320
  })
8575
9321
  ];
8576
- case 67:
9322
+ case 61:
8577
9323
  return [
8578
9324
  4,
8579
9325
  onEvent2.apply(void 0, [
8580
- (_tmp47.data = serializeItemAsMessage.apply(void 0, [
8581
- (_tmp48.openaiAssistant = _state.sent(), _tmp48.createdAt = dayjs21().unix(), _tmp48.runId = responseCreatedResponse.id, _tmp48.status = "in_progress", _tmp48)
8582
- ]), _tmp47)
9326
+ (_tmp42.data = serializeItemAsMessage.apply(void 0, [
9327
+ (_tmp43.openaiAssistant = _state.sent(), _tmp43.createdAt = dayjs21().unix(), _tmp43.runId = responseCreatedResponse.id, _tmp43.status = "in_progress", _tmp43)
9328
+ ]), _tmp42)
8583
9329
  ])
8584
9330
  ];
8585
- case 68:
9331
+ case 62:
8586
9332
  _state.sent();
8587
- _tmp49 = {
9333
+ _tmp44 = {
8588
9334
  event: "thread.run.step.created"
8589
9335
  };
8590
- _tmp50 = {
9336
+ _tmp45 = {
8591
9337
  item: event.item,
8592
9338
  threadId: threadId
8593
9339
  };
@@ -8599,21 +9345,21 @@ var responsesRunAdapter = function(param) {
8599
9345
  }
8600
9346
  })
8601
9347
  ];
8602
- case 69:
9348
+ case 63:
8603
9349
  return [
8604
9350
  4,
8605
9351
  onEvent2.apply(void 0, [
8606
- (_tmp49.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8607
- (_tmp50.openaiAssistant = _state.sent(), _tmp50.runId = responseCreatedResponse.id, _tmp50.status = "in_progress", _tmp50.completedAt = null, _tmp50)
8608
- ]), _tmp49)
9352
+ (_tmp44.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
9353
+ (_tmp45.openaiAssistant = _state.sent(), _tmp45.runId = responseCreatedResponse.id, _tmp45.status = "in_progress", _tmp45.completedAt = null, _tmp45)
9354
+ ]), _tmp44)
8609
9355
  ])
8610
9356
  ];
8611
- case 70:
9357
+ case 64:
8612
9358
  _state.sent();
8613
- _tmp51 = {
9359
+ _tmp46 = {
8614
9360
  event: "thread.run.step.created"
8615
9361
  };
8616
- _tmp52 = {
9362
+ _tmp47 = {
8617
9363
  item: event.item
8618
9364
  };
8619
9365
  return [
@@ -8624,31 +9370,31 @@ var responsesRunAdapter = function(param) {
8624
9370
  }
8625
9371
  })
8626
9372
  ];
8627
- case 71:
9373
+ case 65:
8628
9374
  return [
8629
9375
  4,
8630
9376
  onEvent2.apply(void 0, [
8631
- (_tmp51.data = serializeItemAsMcpCallRunStep.apply(void 0, [
8632
- (_tmp52.openaiAssistant = _state.sent(), _tmp52.threadId = threadId, _tmp52.runId = responseCreatedResponse.id, _tmp52.completedAt = null, _tmp52)
8633
- ]), _tmp51)
9377
+ (_tmp46.data = serializeItemAsMcpCallRunStep.apply(void 0, [
9378
+ (_tmp47.openaiAssistant = _state.sent(), _tmp47.threadId = threadId, _tmp47.runId = responseCreatedResponse.id, _tmp47.completedAt = null, _tmp47)
9379
+ ]), _tmp46)
8634
9380
  ])
8635
9381
  ];
8636
- case 72:
9382
+ case 66:
8637
9383
  _state.sent();
8638
9384
  return [
8639
9385
  3,
8640
- 80
9386
+ 74
8641
9387
  ];
8642
- case 73:
9388
+ case 67:
8643
9389
  if (!(event.item.type === "code_interpreter_call")) return [
8644
9390
  3,
8645
- 80
9391
+ 74
8646
9392
  ];
8647
9393
  codeInterpreterCalls[event.item.id] = event.item;
8648
- _tmp53 = {
9394
+ _tmp48 = {
8649
9395
  event: "thread.message.created"
8650
9396
  };
8651
- _tmp54 = {
9397
+ _tmp49 = {
8652
9398
  item: event.item,
8653
9399
  threadId: threadId
8654
9400
  };
@@ -8660,21 +9406,21 @@ var responsesRunAdapter = function(param) {
8660
9406
  }
8661
9407
  })
8662
9408
  ];
8663
- case 74:
9409
+ case 68:
8664
9410
  return [
8665
9411
  4,
8666
9412
  onEvent2.apply(void 0, [
8667
- (_tmp53.data = serializeItemAsMessage.apply(void 0, [
8668
- (_tmp54.openaiAssistant = _state.sent(), _tmp54.createdAt = dayjs21().unix(), _tmp54.runId = responseCreatedResponse.id, _tmp54.status = "in_progress", _tmp54)
8669
- ]), _tmp53)
9413
+ (_tmp48.data = serializeItemAsMessage.apply(void 0, [
9414
+ (_tmp49.openaiAssistant = _state.sent(), _tmp49.createdAt = dayjs21().unix(), _tmp49.runId = responseCreatedResponse.id, _tmp49.status = "in_progress", _tmp49)
9415
+ ]), _tmp48)
8670
9416
  ])
8671
9417
  ];
8672
- case 75:
9418
+ case 69:
8673
9419
  _state.sent();
8674
- _tmp55 = {
9420
+ _tmp50 = {
8675
9421
  event: "thread.run.step.created"
8676
9422
  };
8677
- _tmp56 = {
9423
+ _tmp51 = {
8678
9424
  item: event.item,
8679
9425
  threadId: threadId
8680
9426
  };
@@ -8686,21 +9432,21 @@ var responsesRunAdapter = function(param) {
8686
9432
  }
8687
9433
  })
8688
9434
  ];
8689
- case 76:
9435
+ case 70:
8690
9436
  return [
8691
9437
  4,
8692
9438
  onEvent2.apply(void 0, [
8693
- (_tmp55.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8694
- (_tmp56.openaiAssistant = _state.sent(), _tmp56.runId = responseCreatedResponse.id, _tmp56.status = "in_progress", _tmp56.completedAt = null, _tmp56)
8695
- ]), _tmp55)
9439
+ (_tmp50.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
9440
+ (_tmp51.openaiAssistant = _state.sent(), _tmp51.runId = responseCreatedResponse.id, _tmp51.status = "in_progress", _tmp51.completedAt = null, _tmp51)
9441
+ ]), _tmp50)
8696
9442
  ])
8697
9443
  ];
8698
- case 77:
9444
+ case 71:
8699
9445
  _state.sent();
8700
- _tmp57 = {
9446
+ _tmp52 = {
8701
9447
  event: "thread.run.step.created"
8702
9448
  };
8703
- _tmp58 = {
9449
+ _tmp53 = {
8704
9450
  item: event.item
8705
9451
  };
8706
9452
  return [
@@ -8711,33 +9457,33 @@ var responsesRunAdapter = function(param) {
8711
9457
  }
8712
9458
  })
8713
9459
  ];
8714
- case 78:
9460
+ case 72:
8715
9461
  return [
8716
9462
  4,
8717
9463
  onEvent2.apply(void 0, [
8718
- (_tmp57.data = serializeItemAsCodeInterpreterCallRunStep.apply(void 0, [
8719
- (_tmp58.openaiAssistant = _state.sent(), _tmp58.threadId = threadId, _tmp58.runId = responseCreatedResponse.id, _tmp58.completedAt = null, _tmp58)
8720
- ]), _tmp57)
9464
+ (_tmp52.data = serializeItemAsCodeInterpreterCallRunStep.apply(void 0, [
9465
+ (_tmp53.openaiAssistant = _state.sent(), _tmp53.threadId = threadId, _tmp53.runId = responseCreatedResponse.id, _tmp53.completedAt = null, _tmp53)
9466
+ ]), _tmp52)
8721
9467
  ])
8722
9468
  ];
8723
- case 79:
9469
+ case 73:
8724
9470
  _state.sent();
8725
- _state.label = 80;
8726
- case 80:
9471
+ _state.label = 74;
9472
+ case 74:
8727
9473
  if (event.item.id) itemIds.push(event.item.id);
8728
9474
  return [
8729
9475
  3,
8730
- 143
9476
+ 137
8731
9477
  ];
8732
- case 81:
9478
+ case 75:
8733
9479
  if (!(event.item.type === "message")) return [
8734
9480
  3,
8735
- 86
9481
+ 80
8736
9482
  ];
8737
- _tmp59 = {
9483
+ _tmp54 = {
8738
9484
  event: "thread.run.step.completed"
8739
9485
  };
8740
- _tmp60 = {
9486
+ _tmp55 = {
8741
9487
  item: event.item,
8742
9488
  threadId: threadId
8743
9489
  };
@@ -8749,21 +9495,21 @@ var responsesRunAdapter = function(param) {
8749
9495
  }
8750
9496
  })
8751
9497
  ];
8752
- case 82:
9498
+ case 76:
8753
9499
  return [
8754
9500
  4,
8755
9501
  onEvent2.apply(void 0, [
8756
- (_tmp59.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8757
- (_tmp60.openaiAssistant = _state.sent(), _tmp60.runId = responseCreatedResponse.id, _tmp60)
8758
- ]), _tmp59)
9502
+ (_tmp54.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
9503
+ (_tmp55.openaiAssistant = _state.sent(), _tmp55.runId = responseCreatedResponse.id, _tmp55)
9504
+ ]), _tmp54)
8759
9505
  ])
8760
9506
  ];
8761
- case 83:
9507
+ case 77:
8762
9508
  _state.sent();
8763
- _tmp61 = {
9509
+ _tmp56 = {
8764
9510
  event: "thread.message.completed"
8765
9511
  };
8766
- _tmp62 = {
9512
+ _tmp57 = {
8767
9513
  item: event.item,
8768
9514
  threadId: threadId
8769
9515
  };
@@ -8775,31 +9521,31 @@ var responsesRunAdapter = function(param) {
8775
9521
  }
8776
9522
  })
8777
9523
  ];
8778
- case 84:
9524
+ case 78:
8779
9525
  return [
8780
9526
  4,
8781
9527
  onEvent2.apply(void 0, [
8782
- (_tmp61.data = serializeItemAsMessage.apply(void 0, [
8783
- (_tmp62.openaiAssistant = _state.sent(), _tmp62.createdAt = dayjs21().unix(), _tmp62.runId = responseCreatedResponse.id, _tmp62)
8784
- ]), _tmp61)
9528
+ (_tmp56.data = serializeItemAsMessage.apply(void 0, [
9529
+ (_tmp57.openaiAssistant = _state.sent(), _tmp57.createdAt = dayjs21().unix(), _tmp57.runId = responseCreatedResponse.id, _tmp57)
9530
+ ]), _tmp56)
8785
9531
  ])
8786
9532
  ];
8787
- case 85:
9533
+ case 79:
8788
9534
  _state.sent();
8789
9535
  return [
8790
9536
  3,
8791
- 131
9537
+ 125
8792
9538
  ];
8793
- case 86:
9539
+ case 80:
8794
9540
  if (!(event.item.type === "function_call")) return [
8795
9541
  3,
8796
- 89
9542
+ 83
8797
9543
  ];
8798
9544
  toolCalls[event.item.id] = event.item;
8799
- _tmp63 = {
9545
+ _tmp58 = {
8800
9546
  event: "thread.run.step.in_progress"
8801
9547
  };
8802
- _tmp64 = {
9548
+ _tmp59 = {
8803
9549
  item: event.item,
8804
9550
  threadId: threadId
8805
9551
  };
@@ -8811,30 +9557,30 @@ var responsesRunAdapter = function(param) {
8811
9557
  }
8812
9558
  })
8813
9559
  ];
8814
- case 87:
9560
+ case 81:
8815
9561
  return [
8816
9562
  4,
8817
9563
  onEvent2.apply(void 0, [
8818
- (_tmp63.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8819
- (_tmp64.openaiAssistant = _state.sent(), _tmp64.runId = responseCreatedResponse.id, _tmp64)
8820
- ]), _tmp63)
9564
+ (_tmp58.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
9565
+ (_tmp59.openaiAssistant = _state.sent(), _tmp59.runId = responseCreatedResponse.id, _tmp59)
9566
+ ]), _tmp58)
8821
9567
  ])
8822
9568
  ];
8823
- case 88:
9569
+ case 82:
8824
9570
  _state.sent();
8825
9571
  return [
8826
9572
  3,
8827
- 131
9573
+ 125
8828
9574
  ];
8829
- case 89:
9575
+ case 83:
8830
9576
  if (!(event.item.type === "image_generation_call")) return [
8831
9577
  3,
8832
- 96
9578
+ 90
8833
9579
  ];
8834
- _tmp65 = {
9580
+ _tmp60 = {
8835
9581
  event: "thread.run.step.completed"
8836
9582
  };
8837
- _tmp66 = {
9583
+ _tmp61 = {
8838
9584
  item: event.item
8839
9585
  };
8840
9586
  return [
@@ -8845,21 +9591,21 @@ var responsesRunAdapter = function(param) {
8845
9591
  }
8846
9592
  })
8847
9593
  ];
8848
- case 90:
9594
+ case 84:
8849
9595
  return [
8850
9596
  4,
8851
9597
  onEvent2.apply(void 0, [
8852
- (_tmp65.data = serializeItemAsImageGenerationRunStep.apply(void 0, [
8853
- (_tmp66.openaiAssistant = _state.sent(), _tmp66.threadId = threadId, _tmp66.runId = responseCreatedResponse.id, _tmp66)
8854
- ]), _tmp65)
9598
+ (_tmp60.data = serializeItemAsImageGenerationRunStep.apply(void 0, [
9599
+ (_tmp61.openaiAssistant = _state.sent(), _tmp61.threadId = threadId, _tmp61.runId = responseCreatedResponse.id, _tmp61)
9600
+ ]), _tmp60)
8855
9601
  ])
8856
9602
  ];
8857
- case 91:
9603
+ case 85:
8858
9604
  _state.sent();
8859
- _tmp67 = {
9605
+ _tmp62 = {
8860
9606
  event: "thread.run.step.completed"
8861
9607
  };
8862
- _tmp68 = {
9608
+ _tmp63 = {
8863
9609
  item: event.item,
8864
9610
  threadId: threadId
8865
9611
  };
@@ -8871,21 +9617,21 @@ var responsesRunAdapter = function(param) {
8871
9617
  }
8872
9618
  })
8873
9619
  ];
8874
- case 92:
9620
+ case 86:
8875
9621
  return [
8876
9622
  4,
8877
9623
  onEvent2.apply(void 0, [
8878
- (_tmp67.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8879
- (_tmp68.openaiAssistant = _state.sent(), _tmp68.runId = responseCreatedResponse.id, _tmp68)
8880
- ]), _tmp67)
9624
+ (_tmp62.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
9625
+ (_tmp63.openaiAssistant = _state.sent(), _tmp63.runId = responseCreatedResponse.id, _tmp63)
9626
+ ]), _tmp62)
8881
9627
  ])
8882
9628
  ];
8883
- case 93:
9629
+ case 87:
8884
9630
  _state.sent();
8885
- _tmp69 = {
9631
+ _tmp64 = {
8886
9632
  event: "thread.message.completed"
8887
9633
  };
8888
- _tmp70 = {
9634
+ _tmp65 = {
8889
9635
  item: event.item,
8890
9636
  threadId: threadId
8891
9637
  };
@@ -8897,30 +9643,30 @@ var responsesRunAdapter = function(param) {
8897
9643
  }
8898
9644
  })
8899
9645
  ];
8900
- case 94:
9646
+ case 88:
8901
9647
  return [
8902
9648
  4,
8903
9649
  onEvent2.apply(void 0, [
8904
- (_tmp69.data = serializeItemAsMessage.apply(void 0, [
8905
- (_tmp70.openaiAssistant = _state.sent(), _tmp70.createdAt = dayjs21().unix(), _tmp70.runId = responseCreatedResponse.id, _tmp70)
8906
- ]), _tmp69)
9650
+ (_tmp64.data = serializeItemAsMessage.apply(void 0, [
9651
+ (_tmp65.openaiAssistant = _state.sent(), _tmp65.createdAt = dayjs21().unix(), _tmp65.runId = responseCreatedResponse.id, _tmp65)
9652
+ ]), _tmp64)
8907
9653
  ])
8908
9654
  ];
8909
- case 95:
9655
+ case 89:
8910
9656
  _state.sent();
8911
9657
  return [
8912
9658
  3,
8913
- 131
9659
+ 125
8914
9660
  ];
8915
- case 96:
9661
+ case 90:
8916
9662
  if (!(event.item.type === "reasoning")) return [
8917
9663
  3,
8918
- 103
9664
+ 97
8919
9665
  ];
8920
- _tmp71 = {
9666
+ _tmp66 = {
8921
9667
  event: "thread.run.step.completed"
8922
9668
  };
8923
- _tmp72 = {
9669
+ _tmp67 = {
8924
9670
  item: event.item
8925
9671
  };
8926
9672
  return [
@@ -8931,21 +9677,21 @@ var responsesRunAdapter = function(param) {
8931
9677
  }
8932
9678
  })
8933
9679
  ];
8934
- case 97:
9680
+ case 91:
8935
9681
  return [
8936
9682
  4,
8937
9683
  onEvent2.apply(void 0, [
8938
- (_tmp71.data = serializeItemAsReasoningRunStep.apply(void 0, [
8939
- (_tmp72.openaiAssistant = _state.sent(), _tmp72.threadId = threadId, _tmp72.runId = responseCreatedResponse.id, _tmp72)
8940
- ]), _tmp71)
9684
+ (_tmp66.data = serializeItemAsReasoningRunStep.apply(void 0, [
9685
+ (_tmp67.openaiAssistant = _state.sent(), _tmp67.threadId = threadId, _tmp67.runId = responseCreatedResponse.id, _tmp67)
9686
+ ]), _tmp66)
8941
9687
  ])
8942
9688
  ];
8943
- case 98:
9689
+ case 92:
8944
9690
  _state.sent();
8945
- _tmp73 = {
9691
+ _tmp68 = {
8946
9692
  event: "thread.run.step.completed"
8947
9693
  };
8948
- _tmp74 = {
9694
+ _tmp69 = {
8949
9695
  item: event.item,
8950
9696
  threadId: threadId
8951
9697
  };
@@ -8957,21 +9703,21 @@ var responsesRunAdapter = function(param) {
8957
9703
  }
8958
9704
  })
8959
9705
  ];
8960
- case 99:
9706
+ case 93:
8961
9707
  return [
8962
9708
  4,
8963
9709
  onEvent2.apply(void 0, [
8964
- (_tmp73.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
8965
- (_tmp74.openaiAssistant = _state.sent(), _tmp74.runId = responseCreatedResponse.id, _tmp74)
8966
- ]), _tmp73)
9710
+ (_tmp68.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
9711
+ (_tmp69.openaiAssistant = _state.sent(), _tmp69.runId = responseCreatedResponse.id, _tmp69)
9712
+ ]), _tmp68)
8967
9713
  ])
8968
9714
  ];
8969
- case 100:
9715
+ case 94:
8970
9716
  _state.sent();
8971
- _tmp75 = {
9717
+ _tmp70 = {
8972
9718
  event: "thread.message.completed"
8973
9719
  };
8974
- _tmp76 = {
9720
+ _tmp71 = {
8975
9721
  item: event.item,
8976
9722
  threadId: threadId
8977
9723
  };
@@ -8983,30 +9729,30 @@ var responsesRunAdapter = function(param) {
8983
9729
  }
8984
9730
  })
8985
9731
  ];
8986
- case 101:
9732
+ case 95:
8987
9733
  return [
8988
9734
  4,
8989
9735
  onEvent2.apply(void 0, [
8990
- (_tmp75.data = serializeItemAsMessage.apply(void 0, [
8991
- (_tmp76.openaiAssistant = _state.sent(), _tmp76.createdAt = dayjs21().unix(), _tmp76.runId = responseCreatedResponse.id, _tmp76)
8992
- ]), _tmp75)
9736
+ (_tmp70.data = serializeItemAsMessage.apply(void 0, [
9737
+ (_tmp71.openaiAssistant = _state.sent(), _tmp71.createdAt = dayjs21().unix(), _tmp71.runId = responseCreatedResponse.id, _tmp71)
9738
+ ]), _tmp70)
8993
9739
  ])
8994
9740
  ];
8995
- case 102:
9741
+ case 96:
8996
9742
  _state.sent();
8997
9743
  return [
8998
9744
  3,
8999
- 131
9745
+ 125
9000
9746
  ];
9001
- case 103:
9747
+ case 97:
9002
9748
  if (!(event.item.type === "web_search_call")) return [
9003
9749
  3,
9004
- 110
9750
+ 104
9005
9751
  ];
9006
- _tmp77 = {
9752
+ _tmp72 = {
9007
9753
  event: "thread.run.step.completed"
9008
9754
  };
9009
- _tmp78 = {
9755
+ _tmp73 = {
9010
9756
  item: event.item
9011
9757
  };
9012
9758
  return [
@@ -9017,21 +9763,21 @@ var responsesRunAdapter = function(param) {
9017
9763
  }
9018
9764
  })
9019
9765
  ];
9020
- case 104:
9766
+ case 98:
9021
9767
  return [
9022
9768
  4,
9023
9769
  onEvent2.apply(void 0, [
9024
- (_tmp77.data = serializeItemAsWebSearchRunStep.apply(void 0, [
9025
- (_tmp78.openaiAssistant = _state.sent(), _tmp78.threadId = threadId, _tmp78.runId = responseCreatedResponse.id, _tmp78)
9026
- ]), _tmp77)
9770
+ (_tmp72.data = serializeItemAsWebSearchRunStep.apply(void 0, [
9771
+ (_tmp73.openaiAssistant = _state.sent(), _tmp73.threadId = threadId, _tmp73.runId = responseCreatedResponse.id, _tmp73)
9772
+ ]), _tmp72)
9027
9773
  ])
9028
9774
  ];
9029
- case 105:
9775
+ case 99:
9030
9776
  _state.sent();
9031
- _tmp79 = {
9777
+ _tmp74 = {
9032
9778
  event: "thread.run.step.completed"
9033
9779
  };
9034
- _tmp80 = {
9780
+ _tmp75 = {
9035
9781
  item: event.item,
9036
9782
  threadId: threadId
9037
9783
  };
@@ -9043,21 +9789,21 @@ var responsesRunAdapter = function(param) {
9043
9789
  }
9044
9790
  })
9045
9791
  ];
9046
- case 106:
9792
+ case 100:
9047
9793
  return [
9048
9794
  4,
9049
9795
  onEvent2.apply(void 0, [
9050
- (_tmp79.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
9051
- (_tmp80.openaiAssistant = _state.sent(), _tmp80.runId = responseCreatedResponse.id, _tmp80)
9052
- ]), _tmp79)
9796
+ (_tmp74.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
9797
+ (_tmp75.openaiAssistant = _state.sent(), _tmp75.runId = responseCreatedResponse.id, _tmp75)
9798
+ ]), _tmp74)
9053
9799
  ])
9054
9800
  ];
9055
- case 107:
9801
+ case 101:
9056
9802
  _state.sent();
9057
- _tmp81 = {
9803
+ _tmp76 = {
9058
9804
  event: "thread.message.completed"
9059
9805
  };
9060
- _tmp82 = {
9806
+ _tmp77 = {
9061
9807
  item: event.item,
9062
9808
  threadId: threadId
9063
9809
  };
@@ -9069,30 +9815,30 @@ var responsesRunAdapter = function(param) {
9069
9815
  }
9070
9816
  })
9071
9817
  ];
9072
- case 108:
9818
+ case 102:
9073
9819
  return [
9074
9820
  4,
9075
9821
  onEvent2.apply(void 0, [
9076
- (_tmp81.data = serializeItemAsMessage.apply(void 0, [
9077
- (_tmp82.openaiAssistant = _state.sent(), _tmp82.createdAt = dayjs21().unix(), _tmp82.runId = responseCreatedResponse.id, _tmp82)
9078
- ]), _tmp81)
9822
+ (_tmp76.data = serializeItemAsMessage.apply(void 0, [
9823
+ (_tmp77.openaiAssistant = _state.sent(), _tmp77.createdAt = dayjs21().unix(), _tmp77.runId = responseCreatedResponse.id, _tmp77)
9824
+ ]), _tmp76)
9079
9825
  ])
9080
9826
  ];
9081
- case 109:
9827
+ case 103:
9082
9828
  _state.sent();
9083
9829
  return [
9084
9830
  3,
9085
- 131
9831
+ 125
9086
9832
  ];
9087
- case 110:
9833
+ case 104:
9088
9834
  if (!(event.item.type === "mcp_list_tools")) return [
9089
9835
  3,
9090
- 117
9836
+ 111
9091
9837
  ];
9092
- _tmp83 = {
9838
+ _tmp78 = {
9093
9839
  event: "thread.run.step.completed"
9094
9840
  };
9095
- _tmp84 = {
9841
+ _tmp79 = {
9096
9842
  item: event.item
9097
9843
  };
9098
9844
  return [
@@ -9103,21 +9849,21 @@ var responsesRunAdapter = function(param) {
9103
9849
  }
9104
9850
  })
9105
9851
  ];
9106
- case 111:
9852
+ case 105:
9107
9853
  return [
9108
9854
  4,
9109
9855
  onEvent2.apply(void 0, [
9110
- (_tmp83.data = serializeItemAsMcpListToolsRunStep.apply(void 0, [
9111
- (_tmp84.openaiAssistant = _state.sent(), _tmp84.threadId = threadId, _tmp84.runId = responseCreatedResponse.id, _tmp84)
9112
- ]), _tmp83)
9856
+ (_tmp78.data = serializeItemAsMcpListToolsRunStep.apply(void 0, [
9857
+ (_tmp79.openaiAssistant = _state.sent(), _tmp79.threadId = threadId, _tmp79.runId = responseCreatedResponse.id, _tmp79)
9858
+ ]), _tmp78)
9113
9859
  ])
9114
9860
  ];
9115
- case 112:
9861
+ case 106:
9116
9862
  _state.sent();
9117
- _tmp85 = {
9863
+ _tmp80 = {
9118
9864
  event: "thread.run.step.completed"
9119
9865
  };
9120
- _tmp86 = {
9866
+ _tmp81 = {
9121
9867
  item: event.item,
9122
9868
  threadId: threadId
9123
9869
  };
@@ -9129,21 +9875,21 @@ var responsesRunAdapter = function(param) {
9129
9875
  }
9130
9876
  })
9131
9877
  ];
9132
- case 113:
9878
+ case 107:
9133
9879
  return [
9134
9880
  4,
9135
9881
  onEvent2.apply(void 0, [
9136
- (_tmp85.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
9137
- (_tmp86.openaiAssistant = _state.sent(), _tmp86.runId = responseCreatedResponse.id, _tmp86)
9138
- ]), _tmp85)
9882
+ (_tmp80.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
9883
+ (_tmp81.openaiAssistant = _state.sent(), _tmp81.runId = responseCreatedResponse.id, _tmp81)
9884
+ ]), _tmp80)
9139
9885
  ])
9140
9886
  ];
9141
- case 114:
9887
+ case 108:
9142
9888
  _state.sent();
9143
- _tmp87 = {
9889
+ _tmp82 = {
9144
9890
  event: "thread.message.completed"
9145
9891
  };
9146
- _tmp88 = {
9892
+ _tmp83 = {
9147
9893
  item: event.item,
9148
9894
  threadId: threadId
9149
9895
  };
@@ -9155,30 +9901,30 @@ var responsesRunAdapter = function(param) {
9155
9901
  }
9156
9902
  })
9157
9903
  ];
9158
- case 115:
9904
+ case 109:
9159
9905
  return [
9160
9906
  4,
9161
9907
  onEvent2.apply(void 0, [
9162
- (_tmp87.data = serializeItemAsMessage.apply(void 0, [
9163
- (_tmp88.openaiAssistant = _state.sent(), _tmp88.createdAt = dayjs21().unix(), _tmp88.runId = responseCreatedResponse.id, _tmp88)
9164
- ]), _tmp87)
9908
+ (_tmp82.data = serializeItemAsMessage.apply(void 0, [
9909
+ (_tmp83.openaiAssistant = _state.sent(), _tmp83.createdAt = dayjs21().unix(), _tmp83.runId = responseCreatedResponse.id, _tmp83)
9910
+ ]), _tmp82)
9165
9911
  ])
9166
9912
  ];
9167
- case 116:
9913
+ case 110:
9168
9914
  _state.sent();
9169
9915
  return [
9170
9916
  3,
9171
- 131
9917
+ 125
9172
9918
  ];
9173
- case 117:
9919
+ case 111:
9174
9920
  if (!(event.item.type === "mcp_call")) return [
9175
9921
  3,
9176
- 124
9922
+ 118
9177
9923
  ];
9178
- _tmp89 = {
9924
+ _tmp84 = {
9179
9925
  event: "thread.run.step.completed"
9180
9926
  };
9181
- _tmp90 = {
9927
+ _tmp85 = {
9182
9928
  item: event.item
9183
9929
  };
9184
9930
  return [
@@ -9189,21 +9935,21 @@ var responsesRunAdapter = function(param) {
9189
9935
  }
9190
9936
  })
9191
9937
  ];
9192
- case 118:
9938
+ case 112:
9193
9939
  return [
9194
9940
  4,
9195
9941
  onEvent2.apply(void 0, [
9196
- (_tmp89.data = serializeItemAsMcpCallRunStep.apply(void 0, [
9197
- (_tmp90.openaiAssistant = _state.sent(), _tmp90.threadId = threadId, _tmp90.runId = responseCreatedResponse.id, _tmp90)
9198
- ]), _tmp89)
9942
+ (_tmp84.data = serializeItemAsMcpCallRunStep.apply(void 0, [
9943
+ (_tmp85.openaiAssistant = _state.sent(), _tmp85.threadId = threadId, _tmp85.runId = responseCreatedResponse.id, _tmp85)
9944
+ ]), _tmp84)
9199
9945
  ])
9200
9946
  ];
9201
- case 119:
9947
+ case 113:
9202
9948
  _state.sent();
9203
- _tmp91 = {
9949
+ _tmp86 = {
9204
9950
  event: "thread.run.step.completed"
9205
9951
  };
9206
- _tmp92 = {
9952
+ _tmp87 = {
9207
9953
  item: event.item,
9208
9954
  threadId: threadId
9209
9955
  };
@@ -9215,21 +9961,21 @@ var responsesRunAdapter = function(param) {
9215
9961
  }
9216
9962
  })
9217
9963
  ];
9218
- case 120:
9964
+ case 114:
9219
9965
  return [
9220
9966
  4,
9221
9967
  onEvent2.apply(void 0, [
9222
- (_tmp91.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
9223
- (_tmp92.openaiAssistant = _state.sent(), _tmp92.runId = responseCreatedResponse.id, _tmp92)
9224
- ]), _tmp91)
9968
+ (_tmp86.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
9969
+ (_tmp87.openaiAssistant = _state.sent(), _tmp87.runId = responseCreatedResponse.id, _tmp87)
9970
+ ]), _tmp86)
9225
9971
  ])
9226
9972
  ];
9227
- case 121:
9973
+ case 115:
9228
9974
  _state.sent();
9229
- _tmp93 = {
9975
+ _tmp88 = {
9230
9976
  event: "thread.message.completed"
9231
9977
  };
9232
- _tmp94 = {
9978
+ _tmp89 = {
9233
9979
  item: event.item,
9234
9980
  threadId: threadId
9235
9981
  };
@@ -9241,30 +9987,30 @@ var responsesRunAdapter = function(param) {
9241
9987
  }
9242
9988
  })
9243
9989
  ];
9244
- case 122:
9990
+ case 116:
9245
9991
  return [
9246
9992
  4,
9247
9993
  onEvent2.apply(void 0, [
9248
- (_tmp93.data = serializeItemAsMessage.apply(void 0, [
9249
- (_tmp94.openaiAssistant = _state.sent(), _tmp94.createdAt = dayjs21().unix(), _tmp94.runId = responseCreatedResponse.id, _tmp94)
9250
- ]), _tmp93)
9994
+ (_tmp88.data = serializeItemAsMessage.apply(void 0, [
9995
+ (_tmp89.openaiAssistant = _state.sent(), _tmp89.createdAt = dayjs21().unix(), _tmp89.runId = responseCreatedResponse.id, _tmp89)
9996
+ ]), _tmp88)
9251
9997
  ])
9252
9998
  ];
9253
- case 123:
9999
+ case 117:
9254
10000
  _state.sent();
9255
10001
  return [
9256
10002
  3,
9257
- 131
10003
+ 125
9258
10004
  ];
9259
- case 124:
10005
+ case 118:
9260
10006
  if (!(event.item.type === "code_interpreter_call")) return [
9261
10007
  3,
9262
- 131
10008
+ 125
9263
10009
  ];
9264
- _tmp95 = {
10010
+ _tmp90 = {
9265
10011
  event: "thread.run.step.completed"
9266
10012
  };
9267
- _tmp96 = {
10013
+ _tmp91 = {
9268
10014
  item: event.item
9269
10015
  };
9270
10016
  return [
@@ -9275,21 +10021,21 @@ var responsesRunAdapter = function(param) {
9275
10021
  }
9276
10022
  })
9277
10023
  ];
9278
- case 125:
10024
+ case 119:
9279
10025
  return [
9280
10026
  4,
9281
10027
  onEvent2.apply(void 0, [
9282
- (_tmp95.data = serializeItemAsCodeInterpreterCallRunStep.apply(void 0, [
9283
- (_tmp96.openaiAssistant = _state.sent(), _tmp96.threadId = threadId, _tmp96.runId = responseCreatedResponse.id, _tmp96)
9284
- ]), _tmp95)
10028
+ (_tmp90.data = serializeItemAsCodeInterpreterCallRunStep.apply(void 0, [
10029
+ (_tmp91.openaiAssistant = _state.sent(), _tmp91.threadId = threadId, _tmp91.runId = responseCreatedResponse.id, _tmp91)
10030
+ ]), _tmp90)
9285
10031
  ])
9286
10032
  ];
9287
- case 126:
10033
+ case 120:
9288
10034
  _state.sent();
9289
- _tmp97 = {
10035
+ _tmp92 = {
9290
10036
  event: "thread.run.step.completed"
9291
10037
  };
9292
- _tmp98 = {
10038
+ _tmp93 = {
9293
10039
  item: event.item,
9294
10040
  threadId: threadId
9295
10041
  };
@@ -9301,21 +10047,21 @@ var responsesRunAdapter = function(param) {
9301
10047
  }
9302
10048
  })
9303
10049
  ];
9304
- case 127:
10050
+ case 121:
9305
10051
  return [
9306
10052
  4,
9307
10053
  onEvent2.apply(void 0, [
9308
- (_tmp97.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
9309
- (_tmp98.openaiAssistant = _state.sent(), _tmp98.runId = responseCreatedResponse.id, _tmp98)
9310
- ]), _tmp97)
10054
+ (_tmp92.data = serializeItemAsMessageCreationRunStep.apply(void 0, [
10055
+ (_tmp93.openaiAssistant = _state.sent(), _tmp93.runId = responseCreatedResponse.id, _tmp93)
10056
+ ]), _tmp92)
9311
10057
  ])
9312
10058
  ];
9313
- case 128:
10059
+ case 122:
9314
10060
  _state.sent();
9315
- _tmp99 = {
10061
+ _tmp94 = {
9316
10062
  event: "thread.message.completed"
9317
10063
  };
9318
- _tmp100 = {
10064
+ _tmp95 = {
9319
10065
  item: event.item,
9320
10066
  threadId: threadId
9321
10067
  };
@@ -9327,28 +10073,28 @@ var responsesRunAdapter = function(param) {
9327
10073
  }
9328
10074
  })
9329
10075
  ];
9330
- case 129:
10076
+ case 123:
9331
10077
  return [
9332
10078
  4,
9333
10079
  onEvent2.apply(void 0, [
9334
- (_tmp99.data = serializeItemAsMessage.apply(void 0, [
9335
- (_tmp100.openaiAssistant = _state.sent(), _tmp100.createdAt = dayjs21().unix(), _tmp100.runId = responseCreatedResponse.id, _tmp100)
9336
- ]), _tmp99)
10080
+ (_tmp94.data = serializeItemAsMessage.apply(void 0, [
10081
+ (_tmp95.openaiAssistant = _state.sent(), _tmp95.createdAt = dayjs21().unix(), _tmp95.runId = responseCreatedResponse.id, _tmp95)
10082
+ ]), _tmp94)
9337
10083
  ])
9338
10084
  ];
9339
- case 130:
10085
+ case 124:
9340
10086
  _state.sent();
9341
- _state.label = 131;
9342
- case 131:
10087
+ _state.label = 125;
10088
+ case 125:
9343
10089
  return [
9344
10090
  3,
9345
- 143
10091
+ 137
9346
10092
  ];
9347
- case 132:
10093
+ case 126:
9348
10094
  toolCall = toolCalls[event.item_id];
9349
10095
  if (!toolCall) return [
9350
10096
  3,
9351
- 143
10097
+ 137
9352
10098
  ];
9353
10099
  return [
9354
10100
  4,
@@ -9377,17 +10123,17 @@ var responsesRunAdapter = function(param) {
9377
10123
  }
9378
10124
  })
9379
10125
  ];
9380
- case 133:
10126
+ case 127:
9381
10127
  _state.sent();
9382
10128
  return [
9383
10129
  3,
9384
- 143
10130
+ 137
9385
10131
  ];
9386
- case 134:
10132
+ case 128:
9387
10133
  mcpCall = mcpCalls[event.item_id];
9388
10134
  if (!mcpCall) return [
9389
10135
  3,
9390
- 143
10136
+ 137
9391
10137
  ];
9392
10138
  return [
9393
10139
  4,
@@ -9416,17 +10162,17 @@ var responsesRunAdapter = function(param) {
9416
10162
  }
9417
10163
  })
9418
10164
  ];
9419
- case 135:
10165
+ case 129:
9420
10166
  _state.sent();
9421
10167
  return [
9422
10168
  3,
9423
- 143
10169
+ 137
9424
10170
  ];
9425
- case 136:
9426
- _tmp101 = {
10171
+ case 130:
10172
+ _tmp96 = {
9427
10173
  event: "thread.message.in_progress"
9428
10174
  };
9429
- _tmp102 = {
10175
+ _tmp97 = {
9430
10176
  id: event.item_id,
9431
10177
  object: "thread.message",
9432
10178
  created_at: dayjs21().unix(),
@@ -9445,26 +10191,26 @@ var responsesRunAdapter = function(param) {
9445
10191
  }
9446
10192
  })
9447
10193
  ];
9448
- case 137:
10194
+ case 131:
9449
10195
  return [
9450
10196
  4,
9451
10197
  onEvent2.apply(void 0, [
9452
- (_tmp101.data = (_tmp102.assistant_id = _state.sent().id, _tmp102.run_id = responseCreatedResponse.id, _tmp102.attachments = [], _tmp102.status = "in_progress", _tmp102.metadata = {
10198
+ (_tmp96.data = (_tmp97.assistant_id = _state.sent().id, _tmp97.run_id = responseCreatedResponse.id, _tmp97.attachments = [], _tmp97.status = "in_progress", _tmp97.metadata = {
9453
10199
  event: JSON.stringify(event)
9454
- }, _tmp102), _tmp101)
10200
+ }, _tmp97), _tmp96)
9455
10201
  ])
9456
10202
  ];
9457
- case 138:
10203
+ case 132:
9458
10204
  _state.sent();
9459
10205
  return [
9460
10206
  3,
9461
- 143
10207
+ 137
9462
10208
  ];
9463
- case 139:
9464
- _tmp103 = {
10209
+ case 133:
10210
+ _tmp98 = {
9465
10211
  event: "thread.message.in_progress"
9466
10212
  };
9467
- _tmp104 = {
10213
+ _tmp99 = {
9468
10214
  id: event.item_id,
9469
10215
  object: "thread.message",
9470
10216
  created_at: dayjs21().unix(),
@@ -9492,92 +10238,153 @@ var responsesRunAdapter = function(param) {
9492
10238
  }
9493
10239
  })
9494
10240
  ];
9495
- case 140:
10241
+ case 134:
9496
10242
  return [
9497
10243
  4,
9498
10244
  onEvent2.apply(void 0, [
9499
- (_tmp103.data = (_tmp104.assistant_id = _state.sent().id, _tmp104.run_id = responseCreatedResponse.id, _tmp104.attachments = [], _tmp104.status = "in_progress", _tmp104.metadata = {
10245
+ (_tmp98.data = (_tmp99.assistant_id = _state.sent().id, _tmp99.run_id = responseCreatedResponse.id, _tmp99.attachments = [], _tmp99.status = "in_progress", _tmp99.metadata = {
9500
10246
  event: JSON.stringify(_object_spread_props(_object_spread({}, event), {
9501
10247
  partial_image_b64: "truncated"
9502
10248
  }))
9503
- }, _tmp104), _tmp103)
10249
+ }, _tmp99), _tmp98)
9504
10250
  ])
9505
10251
  ];
9506
- case 141:
10252
+ case 135:
9507
10253
  _state.sent();
9508
10254
  return [
9509
10255
  3,
9510
- 143
10256
+ 137
9511
10257
  ];
9512
- case 142:
10258
+ case 136:
9513
10259
  return [
9514
10260
  3,
9515
- 143
10261
+ 137
9516
10262
  ];
9517
- case 143:
10263
+ case 137:
9518
10264
  _iteratorAbruptCompletion = false;
9519
10265
  return [
9520
10266
  3,
9521
10267
  3
9522
10268
  ];
9523
- case 144:
10269
+ case 138:
9524
10270
  return [
9525
10271
  3,
9526
- 151
10272
+ 145
9527
10273
  ];
9528
- case 145:
10274
+ case 139:
9529
10275
  err = _state.sent();
9530
10276
  _didIteratorError = true;
9531
10277
  _iteratorError = err;
9532
10278
  return [
9533
10279
  3,
9534
- 151
10280
+ 145
9535
10281
  ];
9536
- case 146:
10282
+ case 140:
9537
10283
  _state.trys.push([
9538
- 146,
10284
+ 140,
9539
10285
  ,
9540
- 149,
9541
- 150
10286
+ 143,
10287
+ 144
9542
10288
  ]);
9543
10289
  if (!(_iteratorAbruptCompletion && _iterator.return != null)) return [
9544
10290
  3,
9545
- 148
10291
+ 142
9546
10292
  ];
9547
10293
  return [
9548
10294
  4,
9549
10295
  _iterator.return()
9550
10296
  ];
9551
- case 147:
10297
+ case 141:
9552
10298
  _state.sent();
9553
- _state.label = 148;
9554
- case 148:
10299
+ _state.label = 142;
10300
+ case 142:
9555
10301
  return [
9556
10302
  3,
9557
- 150
10303
+ 144
9558
10304
  ];
9559
- case 149:
10305
+ case 143:
9560
10306
  if (_didIteratorError) {
9561
10307
  throw _iteratorError;
9562
10308
  }
9563
10309
  return [
9564
10310
  7
9565
10311
  ];
9566
- case 150:
10312
+ case 144:
9567
10313
  return [
9568
10314
  7
9569
10315
  ];
9570
- case 151:
10316
+ case 145:
10317
+ if (!responseCompletedResponse) return [
10318
+ 3,
10319
+ 150
10320
+ ];
10321
+ toolCalls2 = ((_responseCompletedResponse_output = responseCompletedResponse.output) !== null && _responseCompletedResponse_output !== void 0 ? _responseCompletedResponse_output : []).filter(function(o) {
10322
+ return o.type === "function_call" || o.type === "computer_call";
10323
+ });
10324
+ _tmp100 = {
10325
+ response: responseCompletedResponse
10326
+ };
9571
10327
  return [
10328
+ 4,
10329
+ getOpenaiAssistant({
10330
+ select: {
10331
+ id: true
10332
+ }
10333
+ })
10334
+ ];
10335
+ case 146:
10336
+ serializedRun = serializeResponseAsRun.apply(void 0, [
10337
+ (_tmp100.assistantId = _state.sent().id, _tmp100)
10338
+ ]);
10339
+ if (!(toolCalls2.length > 0)) return [
9572
10340
  3,
9573
- 156
10341
+ 148
9574
10342
  ];
9575
- case 152:
10343
+ return [
10344
+ 4,
10345
+ onEvent2({
10346
+ event: "thread.run.requires_action",
10347
+ data: _object_spread_props(_object_spread({}, serializedRun), {
10348
+ status: "requires_action",
10349
+ required_action: {
10350
+ type: "submit_tool_outputs",
10351
+ submit_tool_outputs: {
10352
+ tool_calls: serializeToolCalls2({
10353
+ toolCalls: toolCalls2
10354
+ })
10355
+ }
10356
+ }
10357
+ })
10358
+ })
10359
+ ];
10360
+ case 147:
10361
+ _state.sent();
10362
+ return [
10363
+ 3,
10364
+ 150
10365
+ ];
10366
+ case 148:
10367
+ return [
10368
+ 4,
10369
+ onEvent2({
10370
+ event: "thread.run.completed",
10371
+ data: serializedRun
10372
+ })
10373
+ ];
10374
+ case 149:
10375
+ _state.sent();
10376
+ _state.label = 150;
10377
+ case 150:
10378
+ return [
10379
+ 3,
10380
+ 155
10381
+ ];
10382
+ case 151:
9576
10383
  e = _state.sent();
9577
- _tmp105 = {
10384
+ _tmp101 = {
9578
10385
  event: "thread.run.failed"
9579
10386
  };
9580
- _tmp106 = {
10387
+ _tmp102 = {
9581
10388
  id: (responseCreatedResponse === null || responseCreatedResponse === void 0 ? void 0 : responseCreatedResponse.id) || "run_".concat(uid8(18)),
9582
10389
  object: "thread.run",
9583
10390
  thread_id: threadId
@@ -9590,23 +10397,23 @@ var responsesRunAdapter = function(param) {
9590
10397
  }
9591
10398
  })
9592
10399
  ];
9593
- case 153:
10400
+ case 152:
9594
10401
  return [
9595
10402
  4,
9596
10403
  onEvent2.apply(void 0, [
9597
- (_tmp105.data = (_tmp106.assistant_id = _state.sent().id, _tmp106.status = "failed", _tmp106.failed_at = dayjs21().unix(), _tmp106.last_error = {
10404
+ (_tmp101.data = (_tmp102.assistant_id = _state.sent().id, _tmp102.status = "failed", _tmp102.failed_at = dayjs21().unix(), _tmp102.last_error = {
9598
10405
  code: "server_error",
9599
10406
  message: String((e === null || e === void 0 ? void 0 : e.message) || e || "Unknown error")
9600
- }, _tmp106), _tmp105)
10407
+ }, _tmp102), _tmp101)
9601
10408
  ])
9602
10409
  ];
9603
- case 154:
10410
+ case 153:
9604
10411
  _state.sent();
9605
10412
  return [
9606
10413
  3,
9607
- 156
10414
+ 155
9608
10415
  ];
9609
- case 155:
10416
+ case 154:
9610
10417
  waitUntil(new Promise(/*#__PURE__*/ function() {
9611
10418
  var _ref = _async_to_generator(function(resolve) {
9612
10419
  return _ts_generator(this, function(_state) {
@@ -9643,7 +10450,7 @@ var responsesRunAdapter = function(param) {
9643
10450
  return [
9644
10451
  7
9645
10452
  ];
9646
- case 156:
10453
+ case 155:
9647
10454
  return [
9648
10455
  2
9649
10456
  ];