@superinterface/react 2.20.1 → 2.21.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
@@ -2491,6 +2491,95 @@ var threadRunStepCompleted = function(param) {
2491
2491
  });
2492
2492
  });
2493
2493
  };
2494
+ // src/hooks/messages/useCreateMessage/lib/mutationOptions/mutationFn/handleResponse/handlers/threadRunRequiresAction.ts
2495
+ import { map } from "radash";
2496
+ var threadRunRequiresAction = function() {
2497
+ var _ref = _async_to_generator(function(param) {
2498
+ var value, queryClient, messagesQueryKey, superinterfaceContext, toolCalls, toolOutputs;
2499
+ return _ts_generator(this, function(_state) {
2500
+ switch(_state.label){
2501
+ case 0:
2502
+ value = param.value, queryClient = param.queryClient, messagesQueryKey = param.messagesQueryKey, superinterfaceContext = param.superinterfaceContext;
2503
+ if (!(value.data.required_action.type === "submit_client_tool_outputs")) return [
2504
+ 3,
2505
+ 2
2506
+ ];
2507
+ toolCalls = value.data.required_action.submit_client_tool_outputs.tool_calls;
2508
+ return [
2509
+ 4,
2510
+ map(toolCalls, function() {
2511
+ var _ref = _async_to_generator(function(toolCall) {
2512
+ var fn, args, parsedArgs, output;
2513
+ return _ts_generator(this, function(_state) {
2514
+ switch(_state.label){
2515
+ case 0:
2516
+ if (toolCall.type !== "function") {
2517
+ return [
2518
+ 2,
2519
+ {
2520
+ toolCallId: toolCall.id,
2521
+ output: "Error: client tool type ".concat(toolCall.type, " is not supported.")
2522
+ }
2523
+ ];
2524
+ }
2525
+ fn = window[toolCall.function.name];
2526
+ if (!fn) {
2527
+ return [
2528
+ 2,
2529
+ {
2530
+ toolCallId: toolCall.id,
2531
+ output: "Error: client function ".concat(toolCall.function.name, " is not defined.")
2532
+ }
2533
+ ];
2534
+ }
2535
+ args = toolCall.function.arguments;
2536
+ parsedArgs = JSON.parse(args);
2537
+ return [
2538
+ 4,
2539
+ fn(parsedArgs)
2540
+ ];
2541
+ case 1:
2542
+ output = _state.sent();
2543
+ return [
2544
+ 2,
2545
+ {
2546
+ toolCallId: toolCall.id,
2547
+ output: output
2548
+ }
2549
+ ];
2550
+ }
2551
+ });
2552
+ });
2553
+ return function(toolCall) {
2554
+ return _ref.apply(this, arguments);
2555
+ };
2556
+ }())
2557
+ ];
2558
+ case 1:
2559
+ toolOutputs = _state.sent();
2560
+ return [
2561
+ 2,
2562
+ fetch("".concat(superinterfaceContext.baseUrl, "/threads/runs/submit-client-tool-outputs"), {
2563
+ method: "POST",
2564
+ headers: {
2565
+ "Content-Type": "application/json"
2566
+ },
2567
+ body: JSON.stringify(_object_spread({
2568
+ toolOutputs: toolOutputs
2569
+ }, superinterfaceContext.variables))
2570
+ })
2571
+ ];
2572
+ case 2:
2573
+ return [
2574
+ 2
2575
+ ];
2576
+ }
2577
+ });
2578
+ });
2579
+ return function threadRunRequiresAction(_) {
2580
+ return _ref.apply(this, arguments);
2581
+ };
2582
+ }();
2494
2583
  // src/hooks/messages/useCreateMessage/lib/mutationOptions/mutationFn/handleResponse/handlers/index.ts
2495
2584
  var handlers = {
2496
2585
  "thread.created": threadCreated,
@@ -2500,7 +2589,8 @@ var handlers = {
2500
2589
  "thread.run.created": threadRunCreated,
2501
2590
  "thread.run.step.created": threadRunStepCreated,
2502
2591
  "thread.run.step.delta": threadRunStepDelta,
2503
- "thread.run.step.completed": threadRunStepCompleted
2592
+ "thread.run.step.completed": threadRunStepCompleted,
2593
+ "thread.run.requires_action": threadRunRequiresAction
2504
2594
  };
2505
2595
  // src/hooks/messages/useCreateMessage/lib/mutationOptions/mutationFn/handleResponse/index.ts
2506
2596
  var handleResponse = function(param) {
@@ -3705,8 +3795,8 @@ var Root11 = function(param) {
3705
3795
  },
3706
3796
  width: "100%",
3707
3797
  height: {
3708
- initial: "100dvh",
3709
- sm: "calc(100dvh - 96px)"
3798
+ initial: "100%",
3799
+ sm: "calc(100% - 96px)"
3710
3800
  },
3711
3801
  style: _object_spread({
3712
3802
  zIndex: 9999999999