@assistant-ui/react 0.5.82 → 0.5.84
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/{edge-8bY1SEQ-.d.mts → edge-B3YIacNl.d.mts} +1 -1
- package/dist/{edge-8bY1SEQ-.d.ts → edge-B3YIacNl.d.ts} +1 -1
- package/dist/index.d.mts +1723 -688
- package/dist/index.d.ts +1723 -688
- package/dist/index.js +571 -329
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +515 -273
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14; var _class15; var _class16;
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14; var _class15; var _class16; var _class17; var _class18;
|
2
2
|
|
3
3
|
|
4
4
|
|
@@ -85,6 +85,10 @@ var { useToolUIs, useToolUIsStore } = createContextStoreHook(
|
|
85
85
|
useAssistantContext,
|
86
86
|
"useToolUIs"
|
87
87
|
);
|
88
|
+
var { useThreadManager } = createContextStoreHook(
|
89
|
+
useAssistantContext,
|
90
|
+
"useThreadManager"
|
91
|
+
);
|
88
92
|
|
89
93
|
// src/context/stores/AssistantToolUIs.ts
|
90
94
|
var _zustand = require('zustand');
|
@@ -259,16 +263,29 @@ var useAssistantRuntimeStore2 = (runtime) => {
|
|
259
263
|
var useAssistantToolUIsStore = () => {
|
260
264
|
return _react.useMemo.call(void 0, () => makeAssistantToolUIsStore(), []);
|
261
265
|
};
|
266
|
+
var useThreadManagerStore = (runtime) => {
|
267
|
+
const [store] = _react.useState.call(void 0,
|
268
|
+
() => _zustand.create.call(void 0, () => runtime.threadManager.getState())
|
269
|
+
);
|
270
|
+
_react.useEffect.call(void 0, () => {
|
271
|
+
const updateState = () => writableStore(store).setState(runtime.threadManager.getState(), true);
|
272
|
+
updateState();
|
273
|
+
return runtime.threadManager.subscribe(updateState);
|
274
|
+
}, [runtime, store]);
|
275
|
+
return store;
|
276
|
+
};
|
262
277
|
var AssistantRuntimeProviderImpl = ({ children, runtime }) => {
|
263
278
|
const useAssistantRuntime2 = useAssistantRuntimeStore2(runtime);
|
264
279
|
const useToolUIs2 = useAssistantToolUIsStore();
|
280
|
+
const useThreadManager2 = useThreadManagerStore(runtime);
|
265
281
|
const context = _react.useMemo.call(void 0, () => {
|
266
282
|
return {
|
267
283
|
useToolUIs: useToolUIs2,
|
268
284
|
useAssistantRuntime: useAssistantRuntime2,
|
269
|
-
useAssistantActions: useAssistantRuntime2
|
285
|
+
useAssistantActions: useAssistantRuntime2,
|
286
|
+
useThreadManager: useThreadManager2
|
270
287
|
};
|
271
|
-
}, [useAssistantRuntime2, useToolUIs2]);
|
288
|
+
}, [useAssistantRuntime2, useToolUIs2, useThreadManager2]);
|
272
289
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AssistantContext.Provider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadRuntimeProvider, { runtime: runtime.thread, children }) });
|
273
290
|
};
|
274
291
|
var AssistantRuntimeProvider = _react.memo.call(void 0, AssistantRuntimeProviderImpl);
|
@@ -447,22 +464,20 @@ var useSwitchToNewThread = () => {
|
|
447
464
|
var useAssistantTool = (tool) => {
|
448
465
|
const assistantRuntime = useAssistantRuntime();
|
449
466
|
const toolUIsStore = useToolUIsStore();
|
467
|
+
_react.useEffect.call(void 0, () => {
|
468
|
+
return tool.render ? toolUIsStore.getState().setToolUI(tool.toolName, tool.render) : void 0;
|
469
|
+
}, [toolUIsStore, tool.toolName, tool.render]);
|
450
470
|
_react.useEffect.call(void 0, () => {
|
451
471
|
const { toolName, render, ...rest } = tool;
|
452
472
|
const config = {
|
453
473
|
tools: {
|
454
|
-
[
|
474
|
+
[toolName]: rest
|
455
475
|
}
|
456
476
|
};
|
457
|
-
|
477
|
+
return assistantRuntime.registerModelConfigProvider({
|
458
478
|
getModelConfig: () => config
|
459
479
|
});
|
460
|
-
|
461
|
-
return () => {
|
462
|
-
unsub1();
|
463
|
-
_optionalChain([unsub2, 'optionalCall', _10 => _10()]);
|
464
|
-
};
|
465
|
-
}, [assistantRuntime, toolUIsStore, tool]);
|
480
|
+
}, [assistantRuntime, tool]);
|
466
481
|
};
|
467
482
|
|
468
483
|
// src/model-config/makeAssistantTool.tsx
|
@@ -481,9 +496,8 @@ var useAssistantToolUI = (tool) => {
|
|
481
496
|
const toolUIsStore = useToolUIsStore();
|
482
497
|
_react.useEffect.call(void 0, () => {
|
483
498
|
if (!tool) return;
|
484
|
-
|
485
|
-
|
486
|
-
}, [toolUIsStore, tool]);
|
499
|
+
return toolUIsStore.getState().setToolUI(tool.toolName, tool.render);
|
500
|
+
}, [toolUIsStore, _optionalChain([tool, 'optionalAccess', _10 => _10.toolName]), _optionalChain([tool, 'optionalAccess', _11 => _11.render])]);
|
487
501
|
};
|
488
502
|
|
489
503
|
// src/model-config/makeAssistantToolUI.tsx
|
@@ -510,6 +524,20 @@ var useAssistantInstructions = (instruction) => {
|
|
510
524
|
}, [assistantRuntime, instruction]);
|
511
525
|
};
|
512
526
|
|
527
|
+
// src/model-config/useInlineRender.tsx
|
528
|
+
|
529
|
+
|
530
|
+
var useInlineRender = (toolUI) => {
|
531
|
+
const [useToolUI] = _react.useState.call(void 0, () => _zustand.create.call(void 0, () => toolUI));
|
532
|
+
_react.useEffect.call(void 0, () => {
|
533
|
+
useToolUI.setState(toolUI);
|
534
|
+
});
|
535
|
+
return _react.useCallback.call(void 0, (args) => {
|
536
|
+
const toolUI2 = useToolUI();
|
537
|
+
return toolUI2(args);
|
538
|
+
}, []);
|
539
|
+
};
|
540
|
+
|
513
541
|
// src/primitive-hooks/actionBar/useActionBarCopy.tsx
|
514
542
|
|
515
543
|
var useActionBarCopy = ({
|
@@ -722,7 +750,7 @@ var useComposerAddAttachment = () => {
|
|
722
750
|
input.accept = attachmentAccept;
|
723
751
|
}
|
724
752
|
input.onchange = (e) => {
|
725
|
-
const file = _optionalChain([e, 'access',
|
753
|
+
const file = _optionalChain([e, 'access', _12 => _12.target, 'access', _13 => _13.files, 'optionalAccess', _14 => _14[0]]);
|
726
754
|
if (!file) return;
|
727
755
|
composerRuntime.addAttachment(file);
|
728
756
|
};
|
@@ -798,7 +826,7 @@ var useMessageIf = (props) => {
|
|
798
826
|
return false;
|
799
827
|
if (props.hasContent === true && content.length === 0) return false;
|
800
828
|
if (props.hasContent === false && content.length > 0) return false;
|
801
|
-
if (props.submittedFeedback !== void 0 && (_nullishCoalesce(_optionalChain([submittedFeedback, 'optionalAccess',
|
829
|
+
if (props.submittedFeedback !== void 0 && (_nullishCoalesce(_optionalChain([submittedFeedback, 'optionalAccess', _15 => _15.type]), () => ( null))) !== props.submittedFeedback)
|
802
830
|
return false;
|
803
831
|
return true;
|
804
832
|
}
|
@@ -932,7 +960,7 @@ var ActionBarPrimitiveCopy = _react.forwardRef.call(void 0, ({ copiedDuration, o
|
|
932
960
|
ref: forwardedRef,
|
933
961
|
disabled: disabled || !callback,
|
934
962
|
onClick: _primitive.composeEventHandlers.call(void 0, onClick, () => {
|
935
|
-
_optionalChain([callback, 'optionalCall',
|
963
|
+
_optionalChain([callback, 'optionalCall', _16 => _16()]);
|
936
964
|
})
|
937
965
|
}
|
938
966
|
);
|
@@ -964,7 +992,7 @@ var createActionButton = (displayName, useActionButton, forwardProps = []) => {
|
|
964
992
|
ref: forwardedRef,
|
965
993
|
disabled: primitiveProps.disabled || !callback,
|
966
994
|
onClick: _primitive.composeEventHandlers.call(void 0, primitiveProps.onClick, () => {
|
967
|
-
_optionalChain([callback, 'optionalCall',
|
995
|
+
_optionalChain([callback, 'optionalCall', _17 => _17()]);
|
968
996
|
})
|
969
997
|
}
|
970
998
|
);
|
@@ -1013,7 +1041,7 @@ var ActionBarPrimitiveStopSpeaking = _react.forwardRef.call(void 0, (props, ref)
|
|
1013
1041
|
...props,
|
1014
1042
|
ref,
|
1015
1043
|
onClick: _primitive.composeEventHandlers.call(void 0, props.onClick, () => {
|
1016
|
-
_optionalChain([callback, 'optionalCall',
|
1044
|
+
_optionalChain([callback, 'optionalCall', _18 => _18()]);
|
1017
1045
|
})
|
1018
1046
|
}
|
1019
1047
|
);
|
@@ -1027,7 +1055,7 @@ ActionBarPrimitiveStopSpeaking.displayName = "ActionBarPrimitive.StopSpeaking";
|
|
1027
1055
|
|
1028
1056
|
var ActionBarPrimitiveFeedbackPositive = _react.forwardRef.call(void 0, ({ onClick, disabled, ...props }, forwardedRef) => {
|
1029
1057
|
const isSubmitted = useMessage(
|
1030
|
-
(u) => _optionalChain([u, 'access',
|
1058
|
+
(u) => _optionalChain([u, 'access', _19 => _19.submittedFeedback, 'optionalAccess', _20 => _20.type]) === "positive"
|
1031
1059
|
);
|
1032
1060
|
const callback = useActionBarFeedbackPositive();
|
1033
1061
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
@@ -1039,7 +1067,7 @@ var ActionBarPrimitiveFeedbackPositive = _react.forwardRef.call(void 0, ({ onCli
|
|
1039
1067
|
ref: forwardedRef,
|
1040
1068
|
disabled: disabled || !callback,
|
1041
1069
|
onClick: _primitive.composeEventHandlers.call(void 0, onClick, () => {
|
1042
|
-
_optionalChain([callback, 'optionalCall',
|
1070
|
+
_optionalChain([callback, 'optionalCall', _21 => _21()]);
|
1043
1071
|
})
|
1044
1072
|
}
|
1045
1073
|
);
|
@@ -1053,7 +1081,7 @@ ActionBarPrimitiveFeedbackPositive.displayName = "ActionBarPrimitive.FeedbackPos
|
|
1053
1081
|
|
1054
1082
|
var ActionBarPrimitiveFeedbackNegative = _react.forwardRef.call(void 0, ({ onClick, disabled, ...props }, forwardedRef) => {
|
1055
1083
|
const isSubmitted = useMessage(
|
1056
|
-
(u) => _optionalChain([u, 'access',
|
1084
|
+
(u) => _optionalChain([u, 'access', _22 => _22.submittedFeedback, 'optionalAccess', _23 => _23.type]) === "negative"
|
1057
1085
|
);
|
1058
1086
|
const callback = useActionBarFeedbackNegative();
|
1059
1087
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
@@ -1065,7 +1093,7 @@ var ActionBarPrimitiveFeedbackNegative = _react.forwardRef.call(void 0, ({ onCli
|
|
1065
1093
|
ref: forwardedRef,
|
1066
1094
|
disabled: disabled || !callback,
|
1067
1095
|
onClick: _primitive.composeEventHandlers.call(void 0, onClick, () => {
|
1068
|
-
_optionalChain([callback, 'optionalCall',
|
1096
|
+
_optionalChain([callback, 'optionalCall', _24 => _24()]);
|
1069
1097
|
})
|
1070
1098
|
}
|
1071
1099
|
);
|
@@ -1223,7 +1251,7 @@ var AttachmentContext = _react.createContext.call(void 0,
|
|
1223
1251
|
);
|
1224
1252
|
function useAttachmentContext(options) {
|
1225
1253
|
const context = _react.useContext.call(void 0, AttachmentContext);
|
1226
|
-
if (!_optionalChain([options, 'optionalAccess',
|
1254
|
+
if (!_optionalChain([options, 'optionalAccess', _25 => _25.optional]) && !context)
|
1227
1255
|
throw new Error(
|
1228
1256
|
"This component must be used within a ComposerPrimitive.Attachments or MessagePrimitive.Attachments component."
|
1229
1257
|
);
|
@@ -1504,7 +1532,7 @@ var withSmoothContextProvider = (Component) => {
|
|
1504
1532
|
};
|
1505
1533
|
function useSmoothContext(options) {
|
1506
1534
|
const context = _react.useContext.call(void 0, SmoothContext);
|
1507
|
-
if (!_optionalChain([options, 'optionalAccess',
|
1535
|
+
if (!_optionalChain([options, 'optionalAccess', _26 => _26.optional]) && !context)
|
1508
1536
|
throw new Error(
|
1509
1537
|
"This component must be used within a SmoothContextProvider."
|
1510
1538
|
);
|
@@ -1725,7 +1753,7 @@ var BaseSubject = (_class2 = class {constructor() { _class2.prototype.__init5.ca
|
|
1725
1753
|
if (this._connection) return;
|
1726
1754
|
this._connection = this._connect();
|
1727
1755
|
} else {
|
1728
|
-
_optionalChain([this, 'access',
|
1756
|
+
_optionalChain([this, 'access', _27 => _27._connection, 'optionalCall', _28 => _28()]);
|
1729
1757
|
this._connection = void 0;
|
1730
1758
|
}
|
1731
1759
|
}
|
@@ -1830,36 +1858,36 @@ var EMPTY_ARRAY = Object.freeze([]);
|
|
1830
1858
|
var getThreadComposerState = (runtime) => {
|
1831
1859
|
return Object.freeze({
|
1832
1860
|
type: "thread",
|
1833
|
-
isEditing: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1834
|
-
canCancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1835
|
-
isEmpty: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1836
|
-
text: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1837
|
-
attachments: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1838
|
-
value: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1839
|
-
setValue: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1840
|
-
setText: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1861
|
+
isEditing: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _29 => _29.isEditing]), () => ( false)),
|
1862
|
+
canCancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _30 => _30.canCancel]), () => ( false)),
|
1863
|
+
isEmpty: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _31 => _31.isEmpty]), () => ( true)),
|
1864
|
+
text: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _32 => _32.text]), () => ( "")),
|
1865
|
+
attachments: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _33 => _33.attachments]), () => ( EMPTY_ARRAY)),
|
1866
|
+
value: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _34 => _34.text]), () => ( "")),
|
1867
|
+
setValue: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _35 => _35.setText, 'access', _36 => _36.bind, 'call', _37 => _37(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
|
1868
|
+
setText: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _38 => _38.setText, 'access', _39 => _39.bind, 'call', _40 => _40(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
|
1841
1869
|
// edit: beginEdit,
|
1842
|
-
send: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1843
|
-
cancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1844
|
-
reset: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1845
|
-
addAttachment: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1846
|
-
removeAttachment: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1870
|
+
send: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _41 => _41.send, 'access', _42 => _42.bind, 'call', _43 => _43(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
|
1871
|
+
cancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _44 => _44.cancel, 'access', _45 => _45.bind, 'call', _46 => _46(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
|
1872
|
+
reset: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _47 => _47.reset, 'access', _48 => _48.bind, 'call', _49 => _49(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
|
1873
|
+
addAttachment: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _50 => _50.addAttachment, 'access', _51 => _51.bind, 'call', _52 => _52(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
|
1874
|
+
removeAttachment: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _53 => _53.removeAttachment, 'access', _54 => _54.bind, 'call', _55 => _55(runtime)]), () => ( METHOD_NOT_SUPPORTED))
|
1847
1875
|
});
|
1848
1876
|
};
|
1849
1877
|
var getEditComposerState = (runtime, beginEdit) => {
|
1850
1878
|
return Object.freeze({
|
1851
1879
|
type: "edit",
|
1852
|
-
isEditing: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1853
|
-
canCancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1854
|
-
isEmpty: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1855
|
-
text: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1856
|
-
attachments: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1857
|
-
value: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1858
|
-
setValue: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1859
|
-
setText: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1880
|
+
isEditing: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _56 => _56.isEditing]), () => ( false)),
|
1881
|
+
canCancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _57 => _57.canCancel]), () => ( false)),
|
1882
|
+
isEmpty: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _58 => _58.isEmpty]), () => ( true)),
|
1883
|
+
text: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _59 => _59.text]), () => ( "")),
|
1884
|
+
attachments: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _60 => _60.attachments]), () => ( EMPTY_ARRAY)),
|
1885
|
+
value: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _61 => _61.text]), () => ( "")),
|
1886
|
+
setValue: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _62 => _62.setText, 'access', _63 => _63.bind, 'call', _64 => _64(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
|
1887
|
+
setText: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _65 => _65.setText, 'access', _66 => _66.bind, 'call', _67 => _67(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
|
1860
1888
|
edit: beginEdit,
|
1861
|
-
send: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1862
|
-
cancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess',
|
1889
|
+
send: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _68 => _68.send, 'access', _69 => _69.bind, 'call', _70 => _70(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
|
1890
|
+
cancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _71 => _71.cancel, 'access', _72 => _72.bind, 'call', _73 => _73(runtime)]), () => ( METHOD_NOT_SUPPORTED))
|
1863
1891
|
});
|
1864
1892
|
};
|
1865
1893
|
var ComposerRuntimeImpl = class {
|
@@ -1975,7 +2003,7 @@ var ThreadComposerRuntimeImpl = class extends ComposerRuntimeImpl {
|
|
1975
2003
|
this._getState = stateBinding.getState.bind(stateBinding);
|
1976
2004
|
}
|
1977
2005
|
get attachments() {
|
1978
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
2006
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _74 => _74.getState, 'call', _75 => _75(), 'optionalAccess', _76 => _76.attachments]), () => ( EMPTY_ARRAY));
|
1979
2007
|
}
|
1980
2008
|
getState() {
|
1981
2009
|
return this._getState();
|
@@ -2085,19 +2113,19 @@ var NestedSubscriptionSubject = class extends BaseSubject {
|
|
2085
2113
|
this.notifySubscribers();
|
2086
2114
|
};
|
2087
2115
|
let lastState = this.binding.getState();
|
2088
|
-
let innerUnsubscribe = _optionalChain([lastState, 'optionalAccess',
|
2116
|
+
let innerUnsubscribe = _optionalChain([lastState, 'optionalAccess', _77 => _77.subscribe, 'call', _78 => _78(callback)]);
|
2089
2117
|
const onRuntimeUpdate = () => {
|
2090
2118
|
const newState = this.binding.getState();
|
2091
2119
|
if (newState === lastState) return;
|
2092
2120
|
lastState = newState;
|
2093
|
-
_optionalChain([innerUnsubscribe, 'optionalCall',
|
2094
|
-
innerUnsubscribe = _optionalChain([this, 'access',
|
2121
|
+
_optionalChain([innerUnsubscribe, 'optionalCall', _79 => _79()]);
|
2122
|
+
innerUnsubscribe = _optionalChain([this, 'access', _80 => _80.binding, 'access', _81 => _81.getState, 'call', _82 => _82(), 'optionalAccess', _83 => _83.subscribe, 'call', _84 => _84(callback)]);
|
2095
2123
|
callback();
|
2096
2124
|
};
|
2097
2125
|
const outerUnsubscribe = this.outerSubscribe(onRuntimeUpdate);
|
2098
2126
|
return () => {
|
2099
|
-
_optionalChain([outerUnsubscribe, 'optionalCall',
|
2100
|
-
_optionalChain([innerUnsubscribe, 'optionalCall',
|
2127
|
+
_optionalChain([outerUnsubscribe, 'optionalCall', _85 => _85()]);
|
2128
|
+
_optionalChain([innerUnsubscribe, 'optionalCall', _86 => _86()]);
|
2101
2129
|
};
|
2102
2130
|
}
|
2103
2131
|
};
|
@@ -2176,7 +2204,7 @@ var MessageRuntimeImpl = class {
|
|
2176
2204
|
const state = this._core.getState();
|
2177
2205
|
if (!state) throw new Error("Message is not available");
|
2178
2206
|
const thread = this._threadBinding.getState();
|
2179
|
-
if (_optionalChain([thread, 'access',
|
2207
|
+
if (_optionalChain([thread, 'access', _87 => _87.speech, 'optionalAccess', _88 => _88.messageId]) === state.id) {
|
2180
2208
|
this._threadBinding.getState().stopSpeaking();
|
2181
2209
|
} else {
|
2182
2210
|
throw new Error("Message is not being spoken");
|
@@ -2269,7 +2297,7 @@ var MessageRuntimeImpl = class {
|
|
2269
2297
|
},
|
2270
2298
|
getState: () => {
|
2271
2299
|
const attachments = this.getState().attachments;
|
2272
|
-
const attachment = _optionalChain([attachments, 'optionalAccess',
|
2300
|
+
const attachment = _optionalChain([attachments, 'optionalAccess', _89 => _89[idx]]);
|
2273
2301
|
if (!attachment) return SKIP_UPDATE;
|
2274
2302
|
return {
|
2275
2303
|
...attachment,
|
@@ -2352,7 +2380,7 @@ var MessageContentPartImpl = ({
|
|
2352
2380
|
};
|
2353
2381
|
var MessageContentPart = _react.memo.call(void 0,
|
2354
2382
|
MessageContentPartImpl,
|
2355
|
-
(prev, next) => prev.partIndex === next.partIndex && _optionalChain([prev, 'access',
|
2383
|
+
(prev, next) => prev.partIndex === next.partIndex && _optionalChain([prev, 'access', _90 => _90.components, 'optionalAccess', _91 => _91.Text]) === _optionalChain([next, 'access', _92 => _92.components, 'optionalAccess', _93 => _93.Text]) && _optionalChain([prev, 'access', _94 => _94.components, 'optionalAccess', _95 => _95.Image]) === _optionalChain([next, 'access', _96 => _96.components, 'optionalAccess', _97 => _97.Image]) && _optionalChain([prev, 'access', _98 => _98.components, 'optionalAccess', _99 => _99.UI]) === _optionalChain([next, 'access', _100 => _100.components, 'optionalAccess', _101 => _101.UI]) && _optionalChain([prev, 'access', _102 => _102.components, 'optionalAccess', _103 => _103.tools]) === _optionalChain([next, 'access', _104 => _104.components, 'optionalAccess', _105 => _105.tools])
|
2356
2384
|
);
|
2357
2385
|
var MessagePrimitiveContent = ({
|
2358
2386
|
components
|
@@ -2418,11 +2446,11 @@ var getComponent = (components, attachment) => {
|
|
2418
2446
|
const type = attachment.type;
|
2419
2447
|
switch (type) {
|
2420
2448
|
case "image":
|
2421
|
-
return _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
2449
|
+
return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _106 => _106.Image]), () => ( _optionalChain([components, 'optionalAccess', _107 => _107.Attachment])));
|
2422
2450
|
case "document":
|
2423
|
-
return _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
2451
|
+
return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _108 => _108.Document]), () => ( _optionalChain([components, 'optionalAccess', _109 => _109.Attachment])));
|
2424
2452
|
case "file":
|
2425
|
-
return _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
2453
|
+
return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _110 => _110.File]), () => ( _optionalChain([components, 'optionalAccess', _111 => _111.Attachment])));
|
2426
2454
|
default:
|
2427
2455
|
const _exhaustiveCheck = type;
|
2428
2456
|
throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);
|
@@ -2445,7 +2473,7 @@ var MessageAttachmentImpl = ({ components, attachmentIndex }) => {
|
|
2445
2473
|
};
|
2446
2474
|
var MessageAttachment = _react.memo.call(void 0,
|
2447
2475
|
MessageAttachmentImpl,
|
2448
|
-
(prev, next) => prev.attachmentIndex === next.attachmentIndex && _optionalChain([prev, 'access',
|
2476
|
+
(prev, next) => prev.attachmentIndex === next.attachmentIndex && _optionalChain([prev, 'access', _112 => _112.components, 'optionalAccess', _113 => _113.Image]) === _optionalChain([next, 'access', _114 => _114.components, 'optionalAccess', _115 => _115.Image]) && _optionalChain([prev, 'access', _116 => _116.components, 'optionalAccess', _117 => _117.Document]) === _optionalChain([next, 'access', _118 => _118.components, 'optionalAccess', _119 => _119.Document]) && _optionalChain([prev, 'access', _120 => _120.components, 'optionalAccess', _121 => _121.File]) === _optionalChain([next, 'access', _122 => _122.components, 'optionalAccess', _123 => _123.File]) && _optionalChain([prev, 'access', _124 => _124.components, 'optionalAccess', _125 => _125.Attachment]) === _optionalChain([next, 'access', _126 => _126.components, 'optionalAccess', _127 => _127.Attachment])
|
2449
2477
|
);
|
2450
2478
|
var MessagePrimitiveAttachments = ({ components }) => {
|
2451
2479
|
const attachmentsCount = useMessage(({ message }) => {
|
@@ -2571,7 +2599,7 @@ var ComposerPrimitiveInput = _react.forwardRef.call(void 0,
|
|
2571
2599
|
const { isRunning } = threadRuntime.getState();
|
2572
2600
|
if (!isRunning) {
|
2573
2601
|
e.preventDefault();
|
2574
|
-
_optionalChain([textareaRef, 'access',
|
2602
|
+
_optionalChain([textareaRef, 'access', _128 => _128.current, 'optionalAccess', _129 => _129.closest, 'call', _130 => _130("form"), 'optionalAccess', _131 => _131.requestSubmit, 'call', _132 => _132()]);
|
2575
2603
|
}
|
2576
2604
|
}
|
2577
2605
|
};
|
@@ -2645,11 +2673,11 @@ var getComponent2 = (components, attachment) => {
|
|
2645
2673
|
const type = attachment.type;
|
2646
2674
|
switch (type) {
|
2647
2675
|
case "image":
|
2648
|
-
return _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
2676
|
+
return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _133 => _133.Image]), () => ( _optionalChain([components, 'optionalAccess', _134 => _134.Attachment])));
|
2649
2677
|
case "document":
|
2650
|
-
return _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
2678
|
+
return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _135 => _135.Document]), () => ( _optionalChain([components, 'optionalAccess', _136 => _136.Attachment])));
|
2651
2679
|
case "file":
|
2652
|
-
return _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
2680
|
+
return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _137 => _137.File]), () => ( _optionalChain([components, 'optionalAccess', _138 => _138.Attachment])));
|
2653
2681
|
default:
|
2654
2682
|
const _exhaustiveCheck = type;
|
2655
2683
|
throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);
|
@@ -2672,7 +2700,7 @@ var ComposerAttachmentImpl = ({ components, attachmentIndex }) => {
|
|
2672
2700
|
};
|
2673
2701
|
var ComposerAttachment = _react.memo.call(void 0,
|
2674
2702
|
ComposerAttachmentImpl,
|
2675
|
-
(prev, next) => prev.attachmentIndex === next.attachmentIndex && _optionalChain([prev, 'access',
|
2703
|
+
(prev, next) => prev.attachmentIndex === next.attachmentIndex && _optionalChain([prev, 'access', _139 => _139.components, 'optionalAccess', _140 => _140.Image]) === _optionalChain([next, 'access', _141 => _141.components, 'optionalAccess', _142 => _142.Image]) && _optionalChain([prev, 'access', _143 => _143.components, 'optionalAccess', _144 => _144.Document]) === _optionalChain([next, 'access', _145 => _145.components, 'optionalAccess', _146 => _146.Document]) && _optionalChain([prev, 'access', _147 => _147.components, 'optionalAccess', _148 => _148.File]) === _optionalChain([next, 'access', _149 => _149.components, 'optionalAccess', _150 => _150.File]) && _optionalChain([prev, 'access', _151 => _151.components, 'optionalAccess', _152 => _152.Attachment]) === _optionalChain([next, 'access', _153 => _153.components, 'optionalAccess', _154 => _154.Attachment])
|
2676
2704
|
);
|
2677
2705
|
var ComposerPrimitiveAttachments = ({ components }) => {
|
2678
2706
|
const attachmentsCount = useComposer((s) => s.attachments.length);
|
@@ -3016,47 +3044,62 @@ var subscribeToMainThread = (runtime, callback) => {
|
|
3016
3044
|
let first = true;
|
3017
3045
|
let cleanup;
|
3018
3046
|
const inner = () => {
|
3019
|
-
_optionalChain([cleanup, 'optionalCall',
|
3020
|
-
cleanup = runtime.
|
3047
|
+
_optionalChain([cleanup, 'optionalCall', _155 => _155()]);
|
3048
|
+
cleanup = runtime.threadManager.mainThread.subscribe(callback);
|
3021
3049
|
if (!first) {
|
3022
3050
|
callback();
|
3023
3051
|
}
|
3024
3052
|
first = false;
|
3025
3053
|
};
|
3026
|
-
const unsubscribe = runtime.subscribe(inner);
|
3054
|
+
const unsubscribe = runtime.threadManager.mainThread.subscribe(inner);
|
3027
3055
|
inner();
|
3028
3056
|
return () => {
|
3029
3057
|
unsubscribe();
|
3030
|
-
_optionalChain([cleanup, 'optionalCall',
|
3058
|
+
_optionalChain([cleanup, 'optionalCall', _156 => _156()]);
|
3031
3059
|
};
|
3032
3060
|
};
|
3033
3061
|
|
3034
3062
|
// src/runtimes/local/useLocalRuntime.tsx
|
3035
3063
|
|
3036
3064
|
|
3037
|
-
// src/
|
3038
|
-
var
|
3039
|
-
|
3040
|
-
|
3041
|
-
|
3065
|
+
// src/utils/ProxyConfigProvider.ts
|
3066
|
+
var ProxyConfigProvider = (_class5 = class {constructor() { _class5.prototype.__init9.call(this);_class5.prototype.__init10.call(this); }
|
3067
|
+
__init9() {this._providers = /* @__PURE__ */ new Set()}
|
3068
|
+
getModelConfig() {
|
3069
|
+
return _chunkC6UZOY5Ajs.mergeModelConfigs.call(void 0, this._providers);
|
3042
3070
|
}
|
3043
|
-
|
3044
|
-
|
3071
|
+
registerModelConfigProvider(provider) {
|
3072
|
+
this._providers.add(provider);
|
3073
|
+
const unsubscribe = _optionalChain([provider, 'access', _157 => _157.subscribe, 'optionalCall', _158 => _158(() => {
|
3074
|
+
this.notifySubscribers();
|
3075
|
+
})]);
|
3076
|
+
this.notifySubscribers();
|
3077
|
+
return () => {
|
3078
|
+
this._providers.delete(provider);
|
3079
|
+
_optionalChain([unsubscribe, 'optionalCall', _159 => _159()]);
|
3080
|
+
this.notifySubscribers();
|
3081
|
+
};
|
3045
3082
|
}
|
3046
|
-
|
3047
|
-
|
3048
|
-
this.
|
3083
|
+
__init10() {this._subscribers = /* @__PURE__ */ new Set()}
|
3084
|
+
notifySubscribers() {
|
3085
|
+
for (const callback of this._subscribers) callback();
|
3049
3086
|
}
|
3050
|
-
__init9() {this._subscriptions = /* @__PURE__ */ new Set()}
|
3051
3087
|
subscribe(callback) {
|
3052
|
-
this.
|
3053
|
-
return () => this.
|
3088
|
+
this._subscribers.add(callback);
|
3089
|
+
return () => this._subscribers.delete(callback);
|
3054
3090
|
}
|
3055
|
-
__init10() {this.subscriptionHandler = () => {
|
3056
|
-
for (const callback of this._subscriptions) callback();
|
3057
|
-
}}
|
3058
3091
|
}, _class5);
|
3059
3092
|
|
3093
|
+
// src/runtimes/core/BaseAssistantRuntimeCore.tsx
|
3094
|
+
var BaseAssistantRuntimeCore = (_class6 = class {
|
3095
|
+
__init11() {this._proxyConfigProvider = new ProxyConfigProvider()}
|
3096
|
+
constructor() {;_class6.prototype.__init11.call(this);
|
3097
|
+
}
|
3098
|
+
registerModelConfigProvider(provider) {
|
3099
|
+
return this._proxyConfigProvider.registerModelConfigProvider(provider);
|
3100
|
+
}
|
3101
|
+
}, _class6);
|
3102
|
+
|
3060
3103
|
// src/internal.ts
|
3061
3104
|
var internal_exports = {};
|
3062
3105
|
_chunkPZ5AY32Cjs.__export.call(void 0, internal_exports, {
|
@@ -3075,12 +3118,12 @@ _chunkPZ5AY32Cjs.__export.call(void 0, internal_exports, {
|
|
3075
3118
|
|
3076
3119
|
// src/runtimes/composer/BaseComposerRuntimeCore.tsx
|
3077
3120
|
var isAttachmentComplete = (a) => a.status.type === "complete";
|
3078
|
-
var BaseComposerRuntimeCore = (
|
3079
|
-
|
3121
|
+
var BaseComposerRuntimeCore = (_class7 = class {constructor() { _class7.prototype.__init12.call(this);_class7.prototype.__init13.call(this);_class7.prototype.__init14.call(this);_class7.prototype.__init15.call(this); }
|
3122
|
+
__init12() {this.isEditing = true}
|
3080
3123
|
getAttachmentAccept() {
|
3081
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
3124
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _160 => _160.getAttachmentAdapter, 'call', _161 => _161(), 'optionalAccess', _162 => _162.accept]), () => ( "*"));
|
3082
3125
|
}
|
3083
|
-
|
3126
|
+
__init13() {this._attachments = []}
|
3084
3127
|
set attachments(value) {
|
3085
3128
|
this._attachments = value;
|
3086
3129
|
this.notifySubscribers();
|
@@ -3091,7 +3134,7 @@ var BaseComposerRuntimeCore = (_class6 = class {constructor() { _class6.prototyp
|
|
3091
3134
|
get isEmpty() {
|
3092
3135
|
return !this.text.trim() && !this.attachments.length;
|
3093
3136
|
}
|
3094
|
-
|
3137
|
+
__init14() {this._text = ""}
|
3095
3138
|
get text() {
|
3096
3139
|
return this._text;
|
3097
3140
|
}
|
@@ -3110,7 +3153,7 @@ var BaseComposerRuntimeCore = (_class6 = class {constructor() { _class6.prototyp
|
|
3110
3153
|
this.attachments.map(async (a) => {
|
3111
3154
|
if (isAttachmentComplete(a)) return a;
|
3112
3155
|
const result = await adapter.send(a);
|
3113
|
-
if (_optionalChain([result, 'access',
|
3156
|
+
if (_optionalChain([result, 'access', _163 => _163.status, 'optionalAccess', _164 => _164.type]) !== "complete") {
|
3114
3157
|
result.status = { type: "complete" };
|
3115
3158
|
}
|
3116
3159
|
return result;
|
@@ -3144,7 +3187,7 @@ var BaseComposerRuntimeCore = (_class6 = class {constructor() { _class6.prototyp
|
|
3144
3187
|
this._attachments = this._attachments.toSpliced(index, 1);
|
3145
3188
|
this.notifySubscribers();
|
3146
3189
|
}
|
3147
|
-
|
3190
|
+
__init15() {this._subscriptions = /* @__PURE__ */ new Set()}
|
3148
3191
|
notifySubscribers() {
|
3149
3192
|
for (const callback of this._subscriptions) callback();
|
3150
3193
|
}
|
@@ -3152,16 +3195,16 @@ var BaseComposerRuntimeCore = (_class6 = class {constructor() { _class6.prototyp
|
|
3152
3195
|
this._subscriptions.add(callback);
|
3153
3196
|
return () => this._subscriptions.delete(callback);
|
3154
3197
|
}
|
3155
|
-
},
|
3198
|
+
}, _class7);
|
3156
3199
|
|
3157
3200
|
// src/runtimes/composer/DefaultThreadComposerRuntimeCore.tsx
|
3158
|
-
var DefaultThreadComposerRuntimeCore = (
|
3201
|
+
var DefaultThreadComposerRuntimeCore = (_class8 = class extends BaseComposerRuntimeCore {
|
3159
3202
|
constructor(runtime) {
|
3160
|
-
super();
|
3203
|
+
super();_class8.prototype.__init16.call(this);;
|
3161
3204
|
this.runtime = runtime;
|
3162
3205
|
this.connect();
|
3163
3206
|
}
|
3164
|
-
|
3207
|
+
__init16() {this._canCancel = false}
|
3165
3208
|
get canCancel() {
|
3166
3209
|
return this._canCancel;
|
3167
3210
|
}
|
@@ -3169,7 +3212,7 @@ var DefaultThreadComposerRuntimeCore = (_class7 = class extends BaseComposerRunt
|
|
3169
3212
|
return super.attachments;
|
3170
3213
|
}
|
3171
3214
|
getAttachmentAdapter() {
|
3172
|
-
return _optionalChain([this, 'access',
|
3215
|
+
return _optionalChain([this, 'access', _165 => _165.runtime, 'access', _166 => _166.adapters, 'optionalAccess', _167 => _167.attachments]);
|
3173
3216
|
}
|
3174
3217
|
connect() {
|
3175
3218
|
return this.runtime.subscribe(() => {
|
@@ -3182,40 +3225,12 @@ var DefaultThreadComposerRuntimeCore = (_class7 = class extends BaseComposerRunt
|
|
3182
3225
|
async handleSend(message) {
|
3183
3226
|
this.runtime.append({
|
3184
3227
|
...message,
|
3185
|
-
parentId: _nullishCoalesce(_optionalChain([this, 'access',
|
3228
|
+
parentId: _nullishCoalesce(_optionalChain([this, 'access', _168 => _168.runtime, 'access', _169 => _169.messages, 'access', _170 => _170.at, 'call', _171 => _171(-1), 'optionalAccess', _172 => _172.id]), () => ( null))
|
3186
3229
|
});
|
3187
3230
|
}
|
3188
3231
|
async cancel() {
|
3189
3232
|
this.runtime.cancelRun();
|
3190
3233
|
}
|
3191
|
-
}, _class7);
|
3192
|
-
|
3193
|
-
// src/utils/ProxyConfigProvider.ts
|
3194
|
-
var ProxyConfigProvider = (_class8 = class {constructor() { _class8.prototype.__init16.call(this);_class8.prototype.__init17.call(this); }
|
3195
|
-
__init16() {this._providers = /* @__PURE__ */ new Set()}
|
3196
|
-
getModelConfig() {
|
3197
|
-
return _chunkC6UZOY5Ajs.mergeModelConfigs.call(void 0, this._providers);
|
3198
|
-
}
|
3199
|
-
registerModelConfigProvider(provider) {
|
3200
|
-
this._providers.add(provider);
|
3201
|
-
const unsubscribe = _optionalChain([provider, 'access', _169 => _169.subscribe, 'optionalCall', _170 => _170(() => {
|
3202
|
-
this.notifySubscribers();
|
3203
|
-
})]);
|
3204
|
-
this.notifySubscribers();
|
3205
|
-
return () => {
|
3206
|
-
this._providers.delete(provider);
|
3207
|
-
_optionalChain([unsubscribe, 'optionalCall', _171 => _171()]);
|
3208
|
-
this.notifySubscribers();
|
3209
|
-
};
|
3210
|
-
}
|
3211
|
-
__init17() {this._subscribers = /* @__PURE__ */ new Set()}
|
3212
|
-
notifySubscribers() {
|
3213
|
-
for (const callback of this._subscribers) callback();
|
3214
|
-
}
|
3215
|
-
subscribe(callback) {
|
3216
|
-
this._subscribers.add(callback);
|
3217
|
-
return () => this._subscribers.delete(callback);
|
3218
|
-
}
|
3219
3234
|
}, _class8);
|
3220
3235
|
|
3221
3236
|
// src/utils/idUtils.tsx
|
@@ -3283,11 +3298,11 @@ var findHead = (message) => {
|
|
3283
3298
|
if ("current" in message) return message;
|
3284
3299
|
return null;
|
3285
3300
|
};
|
3286
|
-
var MessageRepository = (_class9 = class {constructor() { _class9.prototype.
|
3287
|
-
|
3301
|
+
var MessageRepository = (_class9 = class {constructor() { _class9.prototype.__init17.call(this);_class9.prototype.__init18.call(this);_class9.prototype.__init19.call(this); }
|
3302
|
+
__init17() {this.messages = /* @__PURE__ */ new Map()}
|
3288
3303
|
// message_id -> item
|
3289
|
-
|
3290
|
-
|
3304
|
+
__init18() {this.head = null}
|
3305
|
+
__init19() {this.root = {
|
3291
3306
|
children: [],
|
3292
3307
|
next: null
|
3293
3308
|
}}
|
@@ -3329,7 +3344,7 @@ var MessageRepository = (_class9 = class {constructor() { _class9.prototype.__in
|
|
3329
3344
|
}
|
3330
3345
|
}
|
3331
3346
|
getMessages() {
|
3332
|
-
const messages2 = new Array(_nullishCoalesce(_optionalChain([this, 'access',
|
3347
|
+
const messages2 = new Array(_nullishCoalesce(_optionalChain([this, 'access', _173 => _173.head, 'optionalAccess', _174 => _174.level]), () => ( 0)));
|
3333
3348
|
for (let current = this.head; current; current = current.prev) {
|
3334
3349
|
messages2[current.level] = current.current;
|
3335
3350
|
}
|
@@ -3367,7 +3382,7 @@ var MessageRepository = (_class9 = class {constructor() { _class9.prototype.__in
|
|
3367
3382
|
"MessageRepository(updateMessage): Message not found. This is likely an internal bug in assistant-ui."
|
3368
3383
|
);
|
3369
3384
|
return {
|
3370
|
-
parentId: _nullishCoalesce(_optionalChain([message, 'access',
|
3385
|
+
parentId: _nullishCoalesce(_optionalChain([message, 'access', _175 => _175.prev, 'optionalAccess', _176 => _176.current, 'access', _177 => _177.id]), () => ( null)),
|
3371
3386
|
message: message.current
|
3372
3387
|
};
|
3373
3388
|
}
|
@@ -3451,11 +3466,11 @@ var MessageRepository = (_class9 = class {constructor() { _class9.prototype.__in
|
|
3451
3466
|
for (const [, message] of this.messages) {
|
3452
3467
|
exportItems.push({
|
3453
3468
|
message: message.current,
|
3454
|
-
parentId: _nullishCoalesce(_optionalChain([message, 'access',
|
3469
|
+
parentId: _nullishCoalesce(_optionalChain([message, 'access', _178 => _178.prev, 'optionalAccess', _179 => _179.current, 'access', _180 => _180.id]), () => ( null))
|
3455
3470
|
});
|
3456
3471
|
}
|
3457
3472
|
return {
|
3458
|
-
headId: _nullishCoalesce(_optionalChain([this, 'access',
|
3473
|
+
headId: _nullishCoalesce(_optionalChain([this, 'access', _181 => _181.head, 'optionalAccess', _182 => _182.current, 'access', _183 => _183.id]), () => ( null)),
|
3459
3474
|
messages: exportItems
|
3460
3475
|
};
|
3461
3476
|
}
|
@@ -3463,7 +3478,7 @@ var MessageRepository = (_class9 = class {constructor() { _class9.prototype.__in
|
|
3463
3478
|
for (const { message, parentId } of messages2) {
|
3464
3479
|
this.addOrUpdateMessage(parentId, message);
|
3465
3480
|
}
|
3466
|
-
this.resetHead(_nullishCoalesce(_nullishCoalesce(headId, () => ( _optionalChain([messages2, 'access',
|
3481
|
+
this.resetHead(_nullishCoalesce(_nullishCoalesce(headId, () => ( _optionalChain([messages2, 'access', _184 => _184.at, 'call', _185 => _185(-1), 'optionalAccess', _186 => _186.message, 'access', _187 => _187.id]))), () => ( null)));
|
3467
3482
|
}
|
3468
3483
|
}, _class9);
|
3469
3484
|
|
@@ -3567,7 +3582,7 @@ TooltipIconButton.displayName = "TooltipIconButton";
|
|
3567
3582
|
var toAppendMessage = (messages2, message) => {
|
3568
3583
|
if (typeof message === "string") {
|
3569
3584
|
return {
|
3570
|
-
parentId: _nullishCoalesce(_optionalChain([messages2, 'access',
|
3585
|
+
parentId: _nullishCoalesce(_optionalChain([messages2, 'access', _188 => _188.at, 'call', _189 => _189(-1), 'optionalAccess', _190 => _190.id]), () => ( null)),
|
3571
3586
|
role: "user",
|
3572
3587
|
content: [{ type: "text", text: message }],
|
3573
3588
|
attachments: []
|
@@ -3577,7 +3592,7 @@ var toAppendMessage = (messages2, message) => {
|
|
3577
3592
|
return message;
|
3578
3593
|
}
|
3579
3594
|
return {
|
3580
|
-
parentId: _nullishCoalesce(_nullishCoalesce(message.parentId, () => ( _optionalChain([messages2, 'access',
|
3595
|
+
parentId: _nullishCoalesce(_nullishCoalesce(message.parentId, () => ( _optionalChain([messages2, 'access', _191 => _191.at, 'call', _192 => _192(-1), 'optionalAccess', _193 => _193.id]))), () => ( null)),
|
3581
3596
|
role: _nullishCoalesce(message.role, () => ( "user")),
|
3582
3597
|
content: message.content,
|
3583
3598
|
attachments: _nullishCoalesce(message.attachments, () => ( []))
|
@@ -3589,7 +3604,7 @@ var getThreadState = (runtime) => {
|
|
3589
3604
|
threadId: runtime.threadId,
|
3590
3605
|
capabilities: runtime.capabilities,
|
3591
3606
|
isDisabled: runtime.isDisabled,
|
3592
|
-
isRunning: _optionalChain([lastMessage, 'optionalAccess',
|
3607
|
+
isRunning: _optionalChain([lastMessage, 'optionalAccess', _194 => _194.role]) !== "assistant" ? false : lastMessage.status.type === "running",
|
3593
3608
|
messages: runtime.messages,
|
3594
3609
|
suggestions: runtime.suggestions,
|
3595
3610
|
extras: runtime.extras,
|
@@ -3652,7 +3667,7 @@ var ThreadRuntimeImpl = (_class10 = class {
|
|
3652
3667
|
return this._threadBinding.getState();
|
3653
3668
|
}
|
3654
3669
|
|
3655
|
-
constructor(threadBinding) {;_class10.prototype.
|
3670
|
+
constructor(threadBinding) {;_class10.prototype.__init20.call(this);
|
3656
3671
|
const stateBinding = new LazyMemoizeSubject({
|
3657
3672
|
path: threadBinding.path,
|
3658
3673
|
getState: () => getThreadState(threadBinding.getState()),
|
@@ -3767,7 +3782,7 @@ var ThreadRuntimeImpl = (_class10 = class {
|
|
3767
3782
|
if (!message) return void 0;
|
3768
3783
|
return {
|
3769
3784
|
message,
|
3770
|
-
parentId: _nullishCoalesce(_optionalChain([messages2, 'access',
|
3785
|
+
parentId: _nullishCoalesce(_optionalChain([messages2, 'access', _195 => _195[idx - 1], 'optionalAccess', _196 => _196.id]), () => ( null))
|
3771
3786
|
};
|
3772
3787
|
}
|
3773
3788
|
);
|
@@ -3796,12 +3811,12 @@ var ThreadRuntimeImpl = (_class10 = class {
|
|
3796
3811
|
return {
|
3797
3812
|
...message,
|
3798
3813
|
message,
|
3799
|
-
isLast: _optionalChain([messages2, 'access',
|
3814
|
+
isLast: _optionalChain([messages2, 'access', _197 => _197.at, 'call', _198 => _198(-1), 'optionalAccess', _199 => _199.id]) === message.id,
|
3800
3815
|
parentId,
|
3801
3816
|
branches,
|
3802
3817
|
branchNumber: branches.indexOf(message.id) + 1,
|
3803
3818
|
branchCount: branches.length,
|
3804
|
-
speech: _optionalChain([speechState, 'optionalAccess',
|
3819
|
+
speech: _optionalChain([speechState, 'optionalAccess', _200 => _200.messageId]) === message.id ? speechState : void 0,
|
3805
3820
|
submittedFeedback
|
3806
3821
|
};
|
3807
3822
|
},
|
@@ -3810,7 +3825,7 @@ var ThreadRuntimeImpl = (_class10 = class {
|
|
3810
3825
|
this._threadBinding
|
3811
3826
|
);
|
3812
3827
|
}
|
3813
|
-
|
3828
|
+
__init20() {this._eventListenerNestedSubscriptions = /* @__PURE__ */ new Map()}
|
3814
3829
|
unstable_on(event, callback) {
|
3815
3830
|
let subject = this._eventListenerNestedSubscriptions.get(event);
|
3816
3831
|
if (!subject) {
|
@@ -3827,20 +3842,67 @@ var ThreadRuntimeImpl = (_class10 = class {
|
|
3827
3842
|
}
|
3828
3843
|
}, _class10);
|
3829
3844
|
|
3845
|
+
// src/api/ThreadManagerRuntime.ts
|
3846
|
+
var getThreadManagerState = (threadManager) => {
|
3847
|
+
return {
|
3848
|
+
threads: threadManager.threads,
|
3849
|
+
archivedThreads: threadManager.archivedThreads
|
3850
|
+
};
|
3851
|
+
};
|
3852
|
+
var THREAD_MANAGER_PATH = {
|
3853
|
+
ref: "threadManager"
|
3854
|
+
};
|
3855
|
+
var ThreadManagerRuntimeImpl = class {
|
3856
|
+
constructor(_core) {
|
3857
|
+
this._core = _core;
|
3858
|
+
const stateBinding = new LazyMemoizeSubject({
|
3859
|
+
path: THREAD_MANAGER_PATH,
|
3860
|
+
getState: () => getThreadManagerState(_core),
|
3861
|
+
subscribe: (callback) => _core.subscribe(callback)
|
3862
|
+
});
|
3863
|
+
this._getState = stateBinding.getState.bind(stateBinding);
|
3864
|
+
}
|
3865
|
+
get path() {
|
3866
|
+
return THREAD_MANAGER_PATH;
|
3867
|
+
}
|
3868
|
+
|
3869
|
+
getState() {
|
3870
|
+
return this._getState();
|
3871
|
+
}
|
3872
|
+
rename(threadId, newTitle) {
|
3873
|
+
return this._core.rename(threadId, newTitle);
|
3874
|
+
}
|
3875
|
+
archive(threadId) {
|
3876
|
+
return this._core.archive(threadId);
|
3877
|
+
}
|
3878
|
+
unarchive(threadId) {
|
3879
|
+
return this._core.unarchive(threadId);
|
3880
|
+
}
|
3881
|
+
delete(threadId) {
|
3882
|
+
return this._core.delete(threadId);
|
3883
|
+
}
|
3884
|
+
subscribe(callback) {
|
3885
|
+
return this._core.subscribe(callback);
|
3886
|
+
}
|
3887
|
+
};
|
3888
|
+
|
3830
3889
|
// src/api/AssistantRuntime.ts
|
3831
3890
|
var AssistantRuntimeImpl = class _AssistantRuntimeImpl {
|
3832
3891
|
constructor(_core, _thread) {
|
3833
3892
|
this._core = _core;
|
3834
3893
|
this._thread = _thread;
|
3894
|
+
this.threadManager = new ThreadManagerRuntimeImpl(_core.threadManager);
|
3835
3895
|
}
|
3896
|
+
|
3836
3897
|
get thread() {
|
3837
3898
|
return this._thread;
|
3838
3899
|
}
|
3839
3900
|
switchToNewThread() {
|
3840
|
-
return this._core.switchToNewThread();
|
3901
|
+
return this._core.threadManager.switchToNewThread();
|
3841
3902
|
}
|
3842
3903
|
switchToThread(threadId) {
|
3843
|
-
return this.
|
3904
|
+
if (threadId === null) return this.switchToNewThread();
|
3905
|
+
return this._core.threadManager.switchToThread(threadId);
|
3844
3906
|
}
|
3845
3907
|
registerModelConfigProvider(provider) {
|
3846
3908
|
return this._core.registerModelConfigProvider(provider);
|
@@ -3848,8 +3910,9 @@ var AssistantRuntimeImpl = class _AssistantRuntimeImpl {
|
|
3848
3910
|
/**
|
3849
3911
|
* @deprecated Thread is now static and never gets updated. This will be removed in 0.6.0.
|
3850
3912
|
*/
|
3851
|
-
subscribe(
|
3852
|
-
return
|
3913
|
+
subscribe() {
|
3914
|
+
return () => {
|
3915
|
+
};
|
3853
3916
|
}
|
3854
3917
|
static createMainThreadRuntime(_core, CustomThreadRuntime = ThreadRuntimeImpl) {
|
3855
3918
|
return new CustomThreadRuntime(
|
@@ -3858,8 +3921,8 @@ var AssistantRuntimeImpl = class _AssistantRuntimeImpl {
|
|
3858
3921
|
ref: "threads.main",
|
3859
3922
|
threadSelector: { type: "main" }
|
3860
3923
|
},
|
3861
|
-
getState: () => _core.
|
3862
|
-
subscribe: (callback) => _core.subscribe(callback)
|
3924
|
+
getState: () => _core.threadManager.mainThread,
|
3925
|
+
subscribe: (callback) => _core.threadManager.subscribe(callback)
|
3863
3926
|
})
|
3864
3927
|
);
|
3865
3928
|
}
|
@@ -3937,7 +4000,7 @@ var fromLanguageModelMessages = (lm, { mergeSteps }) => {
|
|
3937
4000
|
});
|
3938
4001
|
if (mergeSteps) {
|
3939
4002
|
const previousMessage = messages2[messages2.length - 1];
|
3940
|
-
if (_optionalChain([previousMessage, 'optionalAccess',
|
4003
|
+
if (_optionalChain([previousMessage, 'optionalAccess', _201 => _201.role]) === "assistant") {
|
3941
4004
|
previousMessage.content.push(...newContent);
|
3942
4005
|
break;
|
3943
4006
|
}
|
@@ -3950,7 +4013,7 @@ var fromLanguageModelMessages = (lm, { mergeSteps }) => {
|
|
3950
4013
|
}
|
3951
4014
|
case "tool": {
|
3952
4015
|
const previousMessage = messages2[messages2.length - 1];
|
3953
|
-
if (_optionalChain([previousMessage, 'optionalAccess',
|
4016
|
+
if (_optionalChain([previousMessage, 'optionalAccess', _202 => _202.role]) !== "assistant")
|
3954
4017
|
throw new Error(
|
3955
4018
|
"A tool message must be preceded by an assistant message."
|
3956
4019
|
);
|
@@ -4080,7 +4143,7 @@ function assistantDecoderStream() {
|
|
4080
4143
|
case "c" /* ToolCallDelta */: {
|
4081
4144
|
const { toolCallId, argsTextDelta } = value;
|
4082
4145
|
const toolName = toolCallNames.get(toolCallId);
|
4083
|
-
if (_optionalChain([currentToolCall, 'optionalAccess',
|
4146
|
+
if (_optionalChain([currentToolCall, 'optionalAccess', _203 => _203.id]) === toolCallId) {
|
4084
4147
|
currentToolCall.argsText += argsTextDelta;
|
4085
4148
|
}
|
4086
4149
|
controller.enqueue({
|
@@ -4224,7 +4287,7 @@ var useEdgeRuntime = (options) => {
|
|
4224
4287
|
};
|
4225
4288
|
|
4226
4289
|
// src/runtimes/local/shouldContinue.tsx
|
4227
|
-
var shouldContinue = (result) => _optionalChain([result, 'access',
|
4290
|
+
var shouldContinue = (result) => _optionalChain([result, 'access', _204 => _204.status, 'optionalAccess', _205 => _205.type]) === "requires-action" && result.status.reason === "tool-calls" && result.content.every((c) => c.type !== "tool-call" || !!c.result);
|
4228
4291
|
|
4229
4292
|
// src/runtimes/composer/DefaultEditComposerRuntimeCore.tsx
|
4230
4293
|
var DefaultEditComposerRuntimeCore = class extends BaseComposerRuntimeCore {
|
@@ -4244,7 +4307,7 @@ var DefaultEditComposerRuntimeCore = class extends BaseComposerRuntimeCore {
|
|
4244
4307
|
return true;
|
4245
4308
|
}
|
4246
4309
|
getAttachmentAdapter() {
|
4247
|
-
return _optionalChain([this, 'access',
|
4310
|
+
return _optionalChain([this, 'access', _206 => _206.runtime, 'access', _207 => _207.adapters, 'optionalAccess', _208 => _208.attachments]);
|
4248
4311
|
}
|
4249
4312
|
|
4250
4313
|
|
@@ -4269,22 +4332,19 @@ var DefaultEditComposerRuntimeCore = class extends BaseComposerRuntimeCore {
|
|
4269
4332
|
|
4270
4333
|
// src/runtimes/core/BaseThreadRuntimeCore.tsx
|
4271
4334
|
var BaseThreadRuntimeCore = (_class11 = class {
|
4272
|
-
constructor(configProvider) {;_class11.prototype.
|
4335
|
+
constructor(configProvider) {;_class11.prototype.__init21.call(this);_class11.prototype.__init22.call(this);_class11.prototype.__init23.call(this);_class11.prototype.__init24.call(this);_class11.prototype.__init25.call(this);_class11.prototype.__init26.call(this);
|
4273
4336
|
this.configProvider = configProvider;
|
4274
|
-
_optionalChain([this, 'access', _208 => _208.configProvider, 'access', _209 => _209.subscribe, 'optionalCall', _210 => _210(() => {
|
4275
|
-
this._notifyEventSubscribers("model-config-update");
|
4276
|
-
})]);
|
4277
4337
|
}
|
4278
|
-
|
4279
|
-
|
4338
|
+
__init21() {this._subscriptions = /* @__PURE__ */ new Set()}
|
4339
|
+
__init22() {this.repository = new MessageRepository()}
|
4280
4340
|
get messages() {
|
4281
4341
|
return this.repository.getMessages();
|
4282
4342
|
}
|
4283
|
-
|
4343
|
+
__init23() {this.composer = new DefaultThreadComposerRuntimeCore(this)}
|
4284
4344
|
getModelConfig() {
|
4285
4345
|
return this.configProvider.getModelConfig();
|
4286
4346
|
}
|
4287
|
-
|
4347
|
+
__init24() {this._editComposers = /* @__PURE__ */ new Map()}
|
4288
4348
|
getEditComposer(messageId) {
|
4289
4349
|
return this._editComposers.get(messageId);
|
4290
4350
|
}
|
@@ -4323,12 +4383,12 @@ var BaseThreadRuntimeCore = (_class11 = class {
|
|
4323
4383
|
this._subscriptions.add(callback);
|
4324
4384
|
return () => this._subscriptions.delete(callback);
|
4325
4385
|
}
|
4326
|
-
|
4386
|
+
__init25() {this._submittedFeedback = {}}
|
4327
4387
|
getSubmittedFeedback(messageId) {
|
4328
4388
|
return this._submittedFeedback[messageId];
|
4329
4389
|
}
|
4330
4390
|
submitFeedback({ messageId, type }) {
|
4331
|
-
const adapter = _optionalChain([this, 'access',
|
4391
|
+
const adapter = _optionalChain([this, 'access', _209 => _209.adapters, 'optionalAccess', _210 => _210.feedback]);
|
4332
4392
|
if (!adapter) throw new Error("Feedback adapter not configured");
|
4333
4393
|
const { message } = this.repository.getMessage(messageId);
|
4334
4394
|
adapter.submit({ message, type });
|
@@ -4338,10 +4398,10 @@ var BaseThreadRuntimeCore = (_class11 = class {
|
|
4338
4398
|
|
4339
4399
|
|
4340
4400
|
speak(messageId) {
|
4341
|
-
const adapter = _optionalChain([this, 'access',
|
4401
|
+
const adapter = _optionalChain([this, 'access', _211 => _211.adapters, 'optionalAccess', _212 => _212.speech]);
|
4342
4402
|
if (!adapter) throw new Error("Speech adapter not configured");
|
4343
4403
|
const { message } = this.repository.getMessage(messageId);
|
4344
|
-
_optionalChain([this, 'access',
|
4404
|
+
_optionalChain([this, 'access', _213 => _213._stopSpeaking, 'optionalCall', _214 => _214()]);
|
4345
4405
|
const utterance = adapter.speak(getThreadMessageText(message));
|
4346
4406
|
const unsub = utterance.subscribe(() => {
|
4347
4407
|
if (utterance.status.type === "ended") {
|
@@ -4373,8 +4433,12 @@ var BaseThreadRuntimeCore = (_class11 = class {
|
|
4373
4433
|
this.repository.import(data);
|
4374
4434
|
this._notifySubscribers();
|
4375
4435
|
}
|
4376
|
-
|
4436
|
+
__init26() {this._eventSubscribers = /* @__PURE__ */ new Map()}
|
4377
4437
|
unstable_on(event, callback) {
|
4438
|
+
if (event === "model-config-update") {
|
4439
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _215 => _215.configProvider, 'access', _216 => _216.subscribe, 'optionalCall', _217 => _217(callback)]), () => ( (() => {
|
4440
|
+
})));
|
4441
|
+
}
|
4378
4442
|
const subscribers = this._eventSubscribers.get(event);
|
4379
4443
|
if (!subscribers) {
|
4380
4444
|
this._eventSubscribers.set(event, /* @__PURE__ */ new Set([callback]));
|
@@ -4390,21 +4454,12 @@ var BaseThreadRuntimeCore = (_class11 = class {
|
|
4390
4454
|
|
4391
4455
|
// src/runtimes/local/LocalThreadRuntimeCore.tsx
|
4392
4456
|
var LocalThreadRuntimeCore = (_class12 = class extends BaseThreadRuntimeCore {
|
4393
|
-
constructor(configProvider,
|
4394
|
-
super(configProvider);_class12.prototype.
|
4395
|
-
this.
|
4396
|
-
this.
|
4397
|
-
this.options = options;
|
4398
|
-
if (initialMessages) {
|
4399
|
-
let parentId = null;
|
4400
|
-
const messages2 = fromCoreMessages(initialMessages);
|
4401
|
-
for (const message of messages2) {
|
4402
|
-
this.repository.addOrUpdateMessage(parentId, message);
|
4403
|
-
parentId = message.id;
|
4404
|
-
}
|
4405
|
-
}
|
4457
|
+
constructor(configProvider, threadId, options) {
|
4458
|
+
super(configProvider);_class12.prototype.__init27.call(this);_class12.prototype.__init28.call(this);_class12.prototype.__init29.call(this);_class12.prototype.__init30.call(this);;
|
4459
|
+
this.threadId = threadId;
|
4460
|
+
this._options = options;
|
4406
4461
|
}
|
4407
|
-
|
4462
|
+
__init27() {this.capabilities = {
|
4408
4463
|
switchToBranch: true,
|
4409
4464
|
edit: true,
|
4410
4465
|
reload: true,
|
@@ -4414,34 +4469,31 @@ var LocalThreadRuntimeCore = (_class12 = class extends BaseThreadRuntimeCore {
|
|
4414
4469
|
attachments: false,
|
4415
4470
|
feedback: false
|
4416
4471
|
}}
|
4417
|
-
|
4418
|
-
|
4419
|
-
__init30() {this.
|
4420
|
-
__init31() {this.suggestions = []}
|
4472
|
+
__init28() {this.abortController = null}
|
4473
|
+
__init29() {this.isDisabled = false}
|
4474
|
+
__init30() {this.suggestions = []}
|
4421
4475
|
get adapters() {
|
4422
|
-
return this.
|
4476
|
+
return this._options.adapters;
|
4423
4477
|
}
|
4424
4478
|
|
4425
|
-
get options() {
|
4426
|
-
return this._options;
|
4427
|
-
}
|
4428
4479
|
get extras() {
|
4429
4480
|
return void 0;
|
4430
4481
|
}
|
4431
|
-
|
4482
|
+
setOptions(options) {
|
4483
|
+
if (this._options === options) return;
|
4432
4484
|
this._options = options;
|
4433
4485
|
let hasUpdates = false;
|
4434
|
-
const canSpeak = _optionalChain([options, 'access',
|
4486
|
+
const canSpeak = _optionalChain([options, 'access', _218 => _218.adapters, 'optionalAccess', _219 => _219.speech]) !== void 0;
|
4435
4487
|
if (this.capabilities.speech !== canSpeak) {
|
4436
4488
|
this.capabilities.speech = canSpeak;
|
4437
4489
|
hasUpdates = true;
|
4438
4490
|
}
|
4439
|
-
const canAttach = _optionalChain([options, 'access',
|
4491
|
+
const canAttach = _optionalChain([options, 'access', _220 => _220.adapters, 'optionalAccess', _221 => _221.attachments]) !== void 0;
|
4440
4492
|
if (this.capabilities.attachments !== canAttach) {
|
4441
4493
|
this.capabilities.attachments = canAttach;
|
4442
4494
|
hasUpdates = true;
|
4443
4495
|
}
|
4444
|
-
const canFeedback = _optionalChain([options, 'access',
|
4496
|
+
const canFeedback = _optionalChain([options, 'access', _222 => _222.adapters, 'optionalAccess', _223 => _223.feedback]) !== void 0;
|
4445
4497
|
if (this.capabilities.feedback !== canFeedback) {
|
4446
4498
|
this.capabilities.feedback = canFeedback;
|
4447
4499
|
hasUpdates = true;
|
@@ -4477,13 +4529,13 @@ var LocalThreadRuntimeCore = (_class12 = class extends BaseThreadRuntimeCore {
|
|
4477
4529
|
}
|
4478
4530
|
async performRoundtrip(parentId, message) {
|
4479
4531
|
const messages2 = this.repository.getMessages();
|
4480
|
-
_optionalChain([this, 'access',
|
4532
|
+
_optionalChain([this, 'access', _224 => _224.abortController, 'optionalAccess', _225 => _225.abort, 'call', _226 => _226()]);
|
4481
4533
|
this.abortController = new AbortController();
|
4482
4534
|
const initialContent = message.content;
|
4483
|
-
const initialSteps = _optionalChain([message, 'access',
|
4484
|
-
const initalCustom = _optionalChain([message, 'access',
|
4535
|
+
const initialSteps = _optionalChain([message, 'access', _227 => _227.metadata, 'optionalAccess', _228 => _228.steps]);
|
4536
|
+
const initalCustom = _optionalChain([message, 'access', _229 => _229.metadata, 'optionalAccess', _230 => _230.custom]);
|
4485
4537
|
const updateMessage = (m) => {
|
4486
|
-
const newSteps = _optionalChain([m, 'access',
|
4538
|
+
const newSteps = _optionalChain([m, 'access', _231 => _231.metadata, 'optionalAccess', _232 => _232.steps]) || _optionalChain([m, 'access', _233 => _233.metadata, 'optionalAccess', _234 => _234.roundtrips]);
|
4487
4539
|
const steps2 = newSteps ? [..._nullishCoalesce(initialSteps, () => ( [])), ...newSteps] : void 0;
|
4488
4540
|
message = {
|
4489
4541
|
...message,
|
@@ -4495,7 +4547,7 @@ var LocalThreadRuntimeCore = (_class12 = class extends BaseThreadRuntimeCore {
|
|
4495
4547
|
metadata: {
|
4496
4548
|
...message.metadata,
|
4497
4549
|
...steps2 ? { roundtrips: steps2, steps: steps2 } : void 0,
|
4498
|
-
..._optionalChain([m, 'access',
|
4550
|
+
..._optionalChain([m, 'access', _235 => _235.metadata, 'optionalAccess', _236 => _236.custom]) ? {
|
4499
4551
|
custom: { ..._nullishCoalesce(initalCustom, () => ( {})), ...m.metadata.custom }
|
4500
4552
|
} : void 0
|
4501
4553
|
}
|
@@ -4504,8 +4556,8 @@ var LocalThreadRuntimeCore = (_class12 = class extends BaseThreadRuntimeCore {
|
|
4504
4556
|
this.repository.addOrUpdateMessage(parentId, message);
|
4505
4557
|
this._notifySubscribers();
|
4506
4558
|
};
|
4507
|
-
const maxSteps = this.
|
4508
|
-
const steps = _nullishCoalesce(_optionalChain([message, 'access',
|
4559
|
+
const maxSteps = this._options.maxSteps ? this._options.maxSteps : (_nullishCoalesce(this._options.maxToolRoundtrips, () => ( 1))) + 1;
|
4560
|
+
const steps = _nullishCoalesce(_optionalChain([message, 'access', _237 => _237.metadata, 'optionalAccess', _238 => _238.steps, 'optionalAccess', _239 => _239.length]), () => ( 0));
|
4509
4561
|
if (steps >= maxSteps) {
|
4510
4562
|
updateMessage({
|
4511
4563
|
status: {
|
@@ -4522,7 +4574,7 @@ var LocalThreadRuntimeCore = (_class12 = class extends BaseThreadRuntimeCore {
|
|
4522
4574
|
});
|
4523
4575
|
}
|
4524
4576
|
try {
|
4525
|
-
const promiseOrGenerator = this.
|
4577
|
+
const promiseOrGenerator = this.adapters.chatModel.run({
|
4526
4578
|
messages: messages2,
|
4527
4579
|
abortSignal: this.abortController.signal,
|
4528
4580
|
config: this.getModelConfig(),
|
@@ -4557,7 +4609,7 @@ var LocalThreadRuntimeCore = (_class12 = class extends BaseThreadRuntimeCore {
|
|
4557
4609
|
return message;
|
4558
4610
|
}
|
4559
4611
|
cancelRun() {
|
4560
|
-
_optionalChain([this, 'access',
|
4612
|
+
_optionalChain([this, 'access', _240 => _240.abortController, 'optionalAccess', _241 => _241.abort, 'call', _242 => _242()]);
|
4561
4613
|
this.abortController = null;
|
4562
4614
|
}
|
4563
4615
|
addToolResult({
|
@@ -4595,44 +4647,154 @@ var LocalThreadRuntimeCore = (_class12 = class extends BaseThreadRuntimeCore {
|
|
4595
4647
|
}
|
4596
4648
|
}, _class12);
|
4597
4649
|
|
4598
|
-
// src/runtimes/local/
|
4599
|
-
var
|
4650
|
+
// src/runtimes/local/LocalThreadManagerRuntimeCore.tsx
|
4651
|
+
var LocalThreadManagerRuntimeCore = (_class13 = class {
|
4652
|
+
constructor(_threadFactory) {;_class13.prototype.__init31.call(this);_class13.prototype.__init32.call(this);_class13.prototype.__init33.call(this);_class13.prototype.__init34.call(this);
|
4653
|
+
this._threadFactory = _threadFactory;
|
4654
|
+
this._mainThread = this._threadFactory(generateId(), { messages: [] });
|
4655
|
+
}
|
4656
|
+
__init31() {this._threadData = /* @__PURE__ */ new Map()}
|
4657
|
+
__init32() {this._threads = []}
|
4658
|
+
__init33() {this._archivedThreads = []}
|
4659
|
+
get threads() {
|
4660
|
+
return this._threads;
|
4661
|
+
}
|
4662
|
+
get archivedThreads() {
|
4663
|
+
return this._archivedThreads;
|
4664
|
+
}
|
4600
4665
|
|
4601
|
-
|
4602
|
-
|
4603
|
-
super(new LocalThreadRuntimeCore(proxyConfigProvider, adapter, options));
|
4604
|
-
this._proxyConfigProvider = proxyConfigProvider;
|
4666
|
+
get mainThread() {
|
4667
|
+
return this._mainThread;
|
4605
4668
|
}
|
4606
|
-
|
4607
|
-
|
4669
|
+
switchToThread(threadId) {
|
4670
|
+
if (this._mainThread.threadId === threadId) return;
|
4671
|
+
const data = this._threadData.get(threadId);
|
4672
|
+
if (!data) throw new Error("Thread not found");
|
4673
|
+
const thread = this._threadFactory(threadId, data.data);
|
4674
|
+
this._performThreadSwitch(thread);
|
4608
4675
|
}
|
4609
4676
|
switchToNewThread() {
|
4610
|
-
|
4611
|
-
|
4612
|
-
|
4613
|
-
|
4614
|
-
|
4615
|
-
)
|
4616
|
-
|
4677
|
+
if (!this._mainThread) return;
|
4678
|
+
const thread = this._threadFactory(generateId(), { messages: [] });
|
4679
|
+
this._performThreadSwitch(thread);
|
4680
|
+
}
|
4681
|
+
_performThreadSwitch(newThreadCore) {
|
4682
|
+
if (this._mainThread) {
|
4683
|
+
const data = this._threadData.get(this._mainThread.threadId);
|
4684
|
+
if (!data) throw new Error("Thread not found");
|
4685
|
+
const exprt = this._mainThread.export();
|
4686
|
+
data.data = exprt;
|
4687
|
+
}
|
4688
|
+
this._mainThread._notifyEventSubscribers("switched-away");
|
4689
|
+
this._mainThread = newThreadCore;
|
4690
|
+
newThreadCore._notifyEventSubscribers("switched-to");
|
4691
|
+
this._notifySubscribers();
|
4617
4692
|
}
|
4618
|
-
|
4619
|
-
|
4620
|
-
|
4693
|
+
_performMoveOp(threadId, operation) {
|
4694
|
+
const data = this._threadData.get(threadId);
|
4695
|
+
if (!data) throw new Error("Thread not found");
|
4696
|
+
if (operation === "archive" && data.isArchived) return;
|
4697
|
+
if (operation === "unarchive" && !data.isArchived) return;
|
4698
|
+
if (operation === "archive") {
|
4699
|
+
data.isArchived = true;
|
4700
|
+
this._archivedThreads = [...this._archivedThreads, data.metadata];
|
4701
|
+
}
|
4702
|
+
if (operation === "unarchive") {
|
4703
|
+
data.isArchived = false;
|
4704
|
+
this._threads = [...this._threads, data.metadata];
|
4705
|
+
}
|
4706
|
+
if (operation === "delete") {
|
4707
|
+
this._threadData.delete(threadId);
|
4708
|
+
}
|
4709
|
+
if (operation === "archive" || operation === "delete" && data.isArchived) {
|
4710
|
+
this._archivedThreads = this._archivedThreads.filter(
|
4711
|
+
(t) => t.threadId !== threadId
|
4712
|
+
);
|
4713
|
+
}
|
4714
|
+
if (operation === "unarchive" || operation === "delete" && !data.isArchived) {
|
4715
|
+
this._threads = this._threads.filter((t) => t.threadId !== threadId);
|
4621
4716
|
}
|
4622
|
-
this.
|
4717
|
+
this._notifySubscribers();
|
4718
|
+
}
|
4719
|
+
async rename(threadId, newTitle) {
|
4720
|
+
const data = this._threadData.get(threadId);
|
4721
|
+
if (!data) throw new Error("Thread not found");
|
4722
|
+
data.metadata = {
|
4723
|
+
...data.metadata,
|
4724
|
+
title: newTitle
|
4725
|
+
};
|
4726
|
+
const threadList = data.isArchived ? this.archivedThreads : this.threads;
|
4727
|
+
const idx = threadList.findIndex((t) => t.threadId === threadId);
|
4728
|
+
const updatedThreadList = threadList.toSpliced(idx, 1, data.metadata);
|
4729
|
+
if (data.isArchived) {
|
4730
|
+
this._archivedThreads = updatedThreadList;
|
4731
|
+
} else {
|
4732
|
+
this._threads = updatedThreadList;
|
4733
|
+
}
|
4734
|
+
this._notifySubscribers();
|
4735
|
+
}
|
4736
|
+
async archive(threadId) {
|
4737
|
+
this._performMoveOp(threadId, "archive");
|
4738
|
+
}
|
4739
|
+
async unarchive(threadId) {
|
4740
|
+
this._performMoveOp(threadId, "unarchive");
|
4741
|
+
}
|
4742
|
+
async delete(threadId) {
|
4743
|
+
this._performMoveOp(threadId, "delete");
|
4744
|
+
}
|
4745
|
+
__init34() {this._subscriptions = /* @__PURE__ */ new Set()}
|
4746
|
+
subscribe(callback) {
|
4747
|
+
this._subscriptions.add(callback);
|
4748
|
+
return () => this._subscriptions.delete(callback);
|
4749
|
+
}
|
4750
|
+
_notifySubscribers() {
|
4751
|
+
for (const callback of this._subscriptions) callback();
|
4752
|
+
}
|
4753
|
+
}, _class13);
|
4754
|
+
|
4755
|
+
// src/runtimes/local/LocalRuntimeCore.tsx
|
4756
|
+
var getExportFromInitialMessages = (initialMessages) => {
|
4757
|
+
const messages2 = fromCoreMessages(initialMessages);
|
4758
|
+
return {
|
4759
|
+
messages: messages2.map((m, idx) => ({
|
4760
|
+
parentId: _nullishCoalesce(_optionalChain([messages2, 'access', _243 => _243[idx - 1], 'optionalAccess', _244 => _244.id]), () => ( null)),
|
4761
|
+
message: m
|
4762
|
+
}))
|
4763
|
+
};
|
4764
|
+
};
|
4765
|
+
var LocalRuntimeCore = class extends BaseAssistantRuntimeCore {
|
4766
|
+
|
4767
|
+
|
4768
|
+
constructor(options, initialMessages) {
|
4769
|
+
super();
|
4770
|
+
this._options = options;
|
4771
|
+
this.threadManager = new LocalThreadManagerRuntimeCore((threadId, data) => {
|
4772
|
+
const thread = new LocalThreadRuntimeCore(
|
4773
|
+
this._proxyConfigProvider,
|
4774
|
+
threadId,
|
4775
|
+
this._options
|
4776
|
+
);
|
4777
|
+
thread.import(data);
|
4778
|
+
return thread;
|
4779
|
+
});
|
4780
|
+
if (initialMessages) {
|
4781
|
+
this.threadManager.mainThread.import(
|
4782
|
+
getExportFromInitialMessages(initialMessages)
|
4783
|
+
);
|
4784
|
+
}
|
4785
|
+
}
|
4786
|
+
setOptions(options) {
|
4787
|
+
this._options = options;
|
4788
|
+
this.threadManager.mainThread.setOptions(options);
|
4623
4789
|
}
|
4624
4790
|
reset({
|
4625
4791
|
initialMessages
|
4626
4792
|
} = {}) {
|
4627
|
-
this.
|
4793
|
+
this.threadManager.switchToNewThread();
|
4628
4794
|
if (!initialMessages) return;
|
4629
|
-
|
4630
|
-
|
4631
|
-
|
4632
|
-
parentId: _nullishCoalesce(_optionalChain([messages2, 'access', _242 => _242[idx - 1], 'optionalAccess', _243 => _243.id]), () => ( null)),
|
4633
|
-
message: m
|
4634
|
-
}))
|
4635
|
-
});
|
4795
|
+
this.threadManager.mainThread.import(
|
4796
|
+
getExportFromInitialMessages(initialMessages)
|
4797
|
+
);
|
4636
4798
|
}
|
4637
4799
|
};
|
4638
4800
|
|
@@ -4653,10 +4815,16 @@ var LocalRuntimeImpl = class _LocalRuntimeImpl extends AssistantRuntimeImpl {
|
|
4653
4815
|
}
|
4654
4816
|
};
|
4655
4817
|
var useLocalRuntime = (adapter, options = {}) => {
|
4656
|
-
const
|
4657
|
-
|
4658
|
-
|
4659
|
-
|
4818
|
+
const opt = {
|
4819
|
+
...options,
|
4820
|
+
adapters: {
|
4821
|
+
...options.adapters,
|
4822
|
+
chatModel: adapter
|
4823
|
+
}
|
4824
|
+
};
|
4825
|
+
const [runtime] = _react.useState.call(void 0, () => new LocalRuntimeCore(opt));
|
4826
|
+
_react.useEffect.call(void 0, () => {
|
4827
|
+
runtime.setOptions(opt);
|
4660
4828
|
});
|
4661
4829
|
return _react.useMemo.call(void 0, () => LocalRuntimeImpl.create(runtime), [runtime]);
|
4662
4830
|
};
|
@@ -4664,6 +4832,92 @@ var useLocalRuntime = (adapter, options = {}) => {
|
|
4664
4832
|
// src/runtimes/external-store/useExternalStoreRuntime.tsx
|
4665
4833
|
|
4666
4834
|
|
4835
|
+
// src/runtimes/external-store/ExternalStoreThreadManagementAdapter.tsx
|
4836
|
+
var EMPTY_ARRAY2 = Object.freeze([]);
|
4837
|
+
var DEFAULT_THREAD_ID = "DEFAULT_THREAD_ID";
|
4838
|
+
var ExternalStoreThreadManagerRuntimeCore = (_class14 = class {
|
4839
|
+
constructor(adapter = {}, threadFactory) {;_class14.prototype.__init35.call(this);
|
4840
|
+
this.adapter = adapter;
|
4841
|
+
this.threadFactory = threadFactory;
|
4842
|
+
this._mainThread = this.threadFactory(DEFAULT_THREAD_ID);
|
4843
|
+
}
|
4844
|
+
get threads() {
|
4845
|
+
return _nullishCoalesce(this.adapter.threads, () => ( EMPTY_ARRAY2));
|
4846
|
+
}
|
4847
|
+
get archivedThreads() {
|
4848
|
+
return _nullishCoalesce(this.adapter.archivedThreads, () => ( EMPTY_ARRAY2));
|
4849
|
+
}
|
4850
|
+
|
4851
|
+
get mainThread() {
|
4852
|
+
return this._mainThread;
|
4853
|
+
}
|
4854
|
+
setAdapter(adapter) {
|
4855
|
+
const previousAdapter = this.adapter;
|
4856
|
+
this.adapter = adapter;
|
4857
|
+
const newThreadId = _nullishCoalesce(adapter.threadId, () => ( DEFAULT_THREAD_ID));
|
4858
|
+
const newThreads = _nullishCoalesce(adapter.threads, () => ( EMPTY_ARRAY2));
|
4859
|
+
const newArchivedThreads = _nullishCoalesce(adapter.archivedThreads, () => ( EMPTY_ARRAY2));
|
4860
|
+
if (previousAdapter.threadId === newThreadId && previousAdapter.threads === newThreads && previousAdapter.archivedThreads === newArchivedThreads) {
|
4861
|
+
return;
|
4862
|
+
}
|
4863
|
+
if (previousAdapter.threadId !== newThreadId) {
|
4864
|
+
this._mainThread._notifyEventSubscribers("switched-away");
|
4865
|
+
this._mainThread = this.threadFactory(newThreadId);
|
4866
|
+
this._mainThread._notifyEventSubscribers("switched-to");
|
4867
|
+
}
|
4868
|
+
this._notifySubscribers();
|
4869
|
+
}
|
4870
|
+
switchToThread(threadId) {
|
4871
|
+
if (_optionalChain([this, 'access', _245 => _245._mainThread, 'optionalAccess', _246 => _246.threadId]) === threadId) return;
|
4872
|
+
const onSwitchToThread = this.adapter.onSwitchToThread;
|
4873
|
+
if (!onSwitchToThread)
|
4874
|
+
throw new Error(
|
4875
|
+
"External store adapter does not support switching to thread"
|
4876
|
+
);
|
4877
|
+
onSwitchToThread(threadId);
|
4878
|
+
}
|
4879
|
+
switchToNewThread() {
|
4880
|
+
const onSwitchToNewThread = this.adapter.onSwitchToNewThread;
|
4881
|
+
if (!onSwitchToNewThread)
|
4882
|
+
throw new Error(
|
4883
|
+
"External store adapter does not support switching to new thread"
|
4884
|
+
);
|
4885
|
+
onSwitchToNewThread();
|
4886
|
+
}
|
4887
|
+
async rename(threadId, newTitle) {
|
4888
|
+
const onRename = this.adapter.onRename;
|
4889
|
+
if (!onRename)
|
4890
|
+
throw new Error("External store adapter does not support renaming");
|
4891
|
+
onRename(threadId, newTitle);
|
4892
|
+
}
|
4893
|
+
async archive(threadId) {
|
4894
|
+
const onArchive = this.adapter.onArchive;
|
4895
|
+
if (!onArchive)
|
4896
|
+
throw new Error("External store adapter does not support archiving");
|
4897
|
+
onArchive(threadId);
|
4898
|
+
}
|
4899
|
+
async unarchive(threadId) {
|
4900
|
+
const onUnarchive = this.adapter.onUnarchive;
|
4901
|
+
if (!onUnarchive)
|
4902
|
+
throw new Error("External store adapter does not support unarchiving");
|
4903
|
+
onUnarchive(threadId);
|
4904
|
+
}
|
4905
|
+
async delete(threadId) {
|
4906
|
+
const onDelete = this.adapter.onDelete;
|
4907
|
+
if (!onDelete)
|
4908
|
+
throw new Error("External store adapter does not support deleting");
|
4909
|
+
onDelete(threadId);
|
4910
|
+
}
|
4911
|
+
__init35() {this._subscriptions = /* @__PURE__ */ new Set()}
|
4912
|
+
subscribe(callback) {
|
4913
|
+
this._subscriptions.add(callback);
|
4914
|
+
return () => this._subscriptions.delete(callback);
|
4915
|
+
}
|
4916
|
+
_notifySubscribers() {
|
4917
|
+
for (const callback of this._subscriptions) callback();
|
4918
|
+
}
|
4919
|
+
}, _class14);
|
4920
|
+
|
4667
4921
|
// src/runtimes/external-store/getExternalStoreMessage.tsx
|
4668
4922
|
var symbolInnerMessage = Symbol("innerMessage");
|
4669
4923
|
var getExternalStoreMessage = (message) => {
|
@@ -4671,8 +4925,8 @@ var getExternalStoreMessage = (message) => {
|
|
4671
4925
|
};
|
4672
4926
|
|
4673
4927
|
// src/runtimes/external-store/ThreadMessageConverter.ts
|
4674
|
-
var ThreadMessageConverter = (
|
4675
|
-
|
4928
|
+
var ThreadMessageConverter = (_class15 = class {constructor() { _class15.prototype.__init36.call(this); }
|
4929
|
+
__init36() {this.cache = /* @__PURE__ */ new WeakMap()}
|
4676
4930
|
convertMessages(messages2, converter) {
|
4677
4931
|
return messages2.map((m, idx) => {
|
4678
4932
|
const cached = this.cache.get(m);
|
@@ -4681,7 +4935,7 @@ var ThreadMessageConverter = (_class13 = class {constructor() { _class13.prototy
|
|
4681
4935
|
return newMessage;
|
4682
4936
|
});
|
4683
4937
|
}
|
4684
|
-
},
|
4938
|
+
}, _class15);
|
4685
4939
|
|
4686
4940
|
// src/runtimes/external-store/auto-status.tsx
|
4687
4941
|
var AUTO_STATUS_RUNNING = Object.freeze({ type: "running" });
|
@@ -4767,13 +5021,13 @@ var fromThreadMessageLike = (like, fallbackId, fallbackStatus) => {
|
|
4767
5021
|
};
|
4768
5022
|
|
4769
5023
|
// src/runtimes/external-store/ExternalStoreThreadRuntimeCore.tsx
|
4770
|
-
var
|
5024
|
+
var EMPTY_ARRAY3 = Object.freeze([]);
|
4771
5025
|
var hasUpcomingMessage = (isRunning, messages2) => {
|
4772
|
-
return isRunning && _optionalChain([messages2, 'access',
|
5026
|
+
return isRunning && _optionalChain([messages2, 'access', _247 => _247[messages2.length - 1], 'optionalAccess', _248 => _248.role]) !== "assistant";
|
4773
5027
|
};
|
4774
|
-
var ExternalStoreThreadRuntimeCore = (
|
4775
|
-
|
4776
|
-
|
5028
|
+
var ExternalStoreThreadRuntimeCore = (_class16 = class extends BaseThreadRuntimeCore {
|
5029
|
+
__init37() {this.assistantOptimisticId = null}
|
5030
|
+
__init38() {this._capabilities = {
|
4777
5031
|
switchToBranch: false,
|
4778
5032
|
edit: false,
|
4779
5033
|
reload: false,
|
@@ -4795,41 +5049,38 @@ var ExternalStoreThreadRuntimeCore = (_class14 = class extends BaseThreadRuntime
|
|
4795
5049
|
get adapters() {
|
4796
5050
|
return this._store.adapters;
|
4797
5051
|
}
|
4798
|
-
|
4799
|
-
|
4800
|
-
|
5052
|
+
__init39() {this.suggestions = []}
|
5053
|
+
__init40() {this.extras = void 0}
|
5054
|
+
__init41() {this._converter = new ThreadMessageConverter()}
|
4801
5055
|
|
4802
5056
|
beginEdit(messageId) {
|
4803
|
-
if (!this.
|
5057
|
+
if (!this._store.onEdit)
|
4804
5058
|
throw new Error("Runtime does not support editing.");
|
4805
5059
|
super.beginEdit(messageId);
|
4806
5060
|
}
|
4807
|
-
constructor(configProvider, store) {
|
4808
|
-
super(configProvider);
|
4809
|
-
this.
|
5061
|
+
constructor(configProvider, threadId, store) {
|
5062
|
+
super(configProvider);_class16.prototype.__init37.call(this);_class16.prototype.__init38.call(this);_class16.prototype.__init39.call(this);_class16.prototype.__init40.call(this);_class16.prototype.__init41.call(this);_class16.prototype.__init42.call(this);;
|
5063
|
+
this.threadId = threadId;
|
5064
|
+
this.setStore(store);
|
4810
5065
|
}
|
4811
|
-
|
4812
|
-
return this._store;
|
4813
|
-
}
|
4814
|
-
set store(store) {
|
5066
|
+
setStore(store) {
|
4815
5067
|
if (this._store === store) return;
|
4816
|
-
this.threadId = _nullishCoalesce(_nullishCoalesce(store.threadId, () => ( this.threadId)), () => ( generateId()));
|
4817
5068
|
const isRunning = _nullishCoalesce(store.isRunning, () => ( false));
|
4818
5069
|
this.isDisabled = _nullishCoalesce(store.isDisabled, () => ( false));
|
4819
5070
|
const oldStore = this._store;
|
4820
5071
|
this._store = store;
|
4821
5072
|
this.extras = store.extras;
|
4822
|
-
this.suggestions = _nullishCoalesce(store.suggestions, () => (
|
5073
|
+
this.suggestions = _nullishCoalesce(store.suggestions, () => ( EMPTY_ARRAY3));
|
4823
5074
|
this._capabilities = {
|
4824
5075
|
switchToBranch: this._store.setMessages !== void 0,
|
4825
5076
|
edit: this._store.onEdit !== void 0,
|
4826
5077
|
reload: this._store.onReload !== void 0,
|
4827
5078
|
cancel: this._store.onCancel !== void 0,
|
4828
|
-
speech: _optionalChain([this, 'access',
|
4829
|
-
unstable_copy: _optionalChain([this, 'access',
|
5079
|
+
speech: _optionalChain([this, 'access', _252 => _252._store, 'access', _253 => _253.adapters, 'optionalAccess', _254 => _254.speech]) !== void 0,
|
5080
|
+
unstable_copy: _optionalChain([this, 'access', _255 => _255._store, 'access', _256 => _256.unstable_capabilities, 'optionalAccess', _257 => _257.copy]) !== false,
|
4830
5081
|
// default true
|
4831
|
-
attachments: !!_optionalChain([this, 'access',
|
4832
|
-
feedback: !!_optionalChain([this, 'access',
|
5082
|
+
attachments: !!_optionalChain([this, 'access', _258 => _258._store, 'access', _259 => _259.adapters, 'optionalAccess', _260 => _260.attachments]),
|
5083
|
+
feedback: !!_optionalChain([this, 'access', _261 => _261._store, 'access', _262 => _262.adapters, 'optionalAccess', _263 => _263.feedback])
|
4833
5084
|
};
|
4834
5085
|
if (oldStore) {
|
4835
5086
|
if (oldStore.convertMessage !== store.convertMessage) {
|
@@ -4856,7 +5107,7 @@ var ExternalStoreThreadRuntimeCore = (_class14 = class extends BaseThreadRuntime
|
|
4856
5107
|
for (let i = 0; i < messages2.length; i++) {
|
4857
5108
|
const message = messages2[i];
|
4858
5109
|
const parent = messages2[i - 1];
|
4859
|
-
this.repository.addOrUpdateMessage(_nullishCoalesce(_optionalChain([parent, 'optionalAccess',
|
5110
|
+
this.repository.addOrUpdateMessage(_nullishCoalesce(_optionalChain([parent, 'optionalAccess', _264 => _264.id]), () => ( null)), message);
|
4860
5111
|
}
|
4861
5112
|
if (this.assistantOptimisticId) {
|
4862
5113
|
this.repository.deleteMessage(this.assistantOptimisticId);
|
@@ -4864,7 +5115,7 @@ var ExternalStoreThreadRuntimeCore = (_class14 = class extends BaseThreadRuntime
|
|
4864
5115
|
}
|
4865
5116
|
if (hasUpcomingMessage(isRunning, messages2)) {
|
4866
5117
|
this.assistantOptimisticId = this.repository.appendOptimisticMessage(
|
4867
|
-
_nullishCoalesce(_optionalChain([messages2, 'access',
|
5118
|
+
_nullishCoalesce(_optionalChain([messages2, 'access', _265 => _265.at, 'call', _266 => _266(-1), 'optionalAccess', _267 => _267.id]), () => ( null)),
|
4868
5119
|
{
|
4869
5120
|
role: "assistant",
|
4870
5121
|
content: []
|
@@ -4872,7 +5123,7 @@ var ExternalStoreThreadRuntimeCore = (_class14 = class extends BaseThreadRuntime
|
|
4872
5123
|
);
|
4873
5124
|
}
|
4874
5125
|
this.repository.resetHead(
|
4875
|
-
_nullishCoalesce(_nullishCoalesce(this.assistantOptimisticId, () => ( _optionalChain([messages2, 'access',
|
5126
|
+
_nullishCoalesce(_nullishCoalesce(this.assistantOptimisticId, () => ( _optionalChain([messages2, 'access', _268 => _268.at, 'call', _269 => _269(-1), 'optionalAccess', _270 => _270.id]))), () => ( null))
|
4876
5127
|
);
|
4877
5128
|
this._messages = this.repository.getMessages();
|
4878
5129
|
this._notifySubscribers();
|
@@ -4884,7 +5135,7 @@ var ExternalStoreThreadRuntimeCore = (_class14 = class extends BaseThreadRuntime
|
|
4884
5135
|
this.updateMessages(this.repository.getMessages());
|
4885
5136
|
}
|
4886
5137
|
async append(message) {
|
4887
|
-
if (message.parentId !== (_nullishCoalesce(_optionalChain([this, 'access',
|
5138
|
+
if (message.parentId !== (_nullishCoalesce(_optionalChain([this, 'access', _271 => _271.messages, 'access', _272 => _272.at, 'call', _273 => _273(-1), 'optionalAccess', _274 => _274.id]), () => ( null)))) {
|
4888
5139
|
if (!this._store.onEdit)
|
4889
5140
|
throw new Error("Runtime does not support editing messages.");
|
4890
5141
|
await this._store.onEdit(message);
|
@@ -4907,7 +5158,7 @@ var ExternalStoreThreadRuntimeCore = (_class14 = class extends BaseThreadRuntime
|
|
4907
5158
|
}
|
4908
5159
|
let messages2 = this.repository.getMessages();
|
4909
5160
|
const previousMessage = messages2[messages2.length - 1];
|
4910
|
-
if (_optionalChain([previousMessage, 'optionalAccess',
|
5161
|
+
if (_optionalChain([previousMessage, 'optionalAccess', _275 => _275.role]) === "user" && previousMessage.id === _optionalChain([messages2, 'access', _276 => _276.at, 'call', _277 => _277(-1), 'optionalAccess', _278 => _278.id])) {
|
4911
5162
|
this.repository.deleteMessage(previousMessage.id);
|
4912
5163
|
if (!this.composer.text.trim()) {
|
4913
5164
|
this.composer.setText(getThreadMessageText(previousMessage));
|
@@ -4925,57 +5176,41 @@ var ExternalStoreThreadRuntimeCore = (_class14 = class extends BaseThreadRuntime
|
|
4925
5176
|
throw new Error("Runtime does not support tool results.");
|
4926
5177
|
this._store.onAddToolResult(options);
|
4927
5178
|
}
|
4928
|
-
|
4929
|
-
_optionalChain([this, 'access',
|
5179
|
+
__init42() {this.updateMessages = (messages2) => {
|
5180
|
+
_optionalChain([this, 'access', _279 => _279._store, 'access', _280 => _280.setMessages, 'optionalCall', _281 => _281(
|
4930
5181
|
messages2.flatMap(getExternalStoreMessage).filter((m) => m != null)
|
4931
5182
|
)]);
|
4932
5183
|
}}
|
4933
|
-
},
|
5184
|
+
}, _class16);
|
4934
5185
|
|
4935
5186
|
// src/runtimes/external-store/ExternalStoreRuntimeCore.tsx
|
5187
|
+
var getThreadManagerAdapter = (store) => {
|
5188
|
+
return {
|
5189
|
+
threadId: store.threadId,
|
5190
|
+
onSwitchToNewThread: store.onSwitchToNewThread,
|
5191
|
+
onSwitchToThread: store.onSwitchToThread,
|
5192
|
+
..._optionalChain([store, 'access', _282 => _282.adapters, 'optionalAccess', _283 => _283.threadManager])
|
5193
|
+
};
|
5194
|
+
};
|
4936
5195
|
var ExternalStoreRuntimeCore = class extends BaseAssistantRuntimeCore {
|
4937
5196
|
|
5197
|
+
|
4938
5198
|
constructor(store) {
|
4939
|
-
|
4940
|
-
|
4941
|
-
this.
|
4942
|
-
|
4943
|
-
|
4944
|
-
return this._proxyConfigProvider.getModelConfig();
|
4945
|
-
}
|
4946
|
-
registerModelConfigProvider(provider) {
|
4947
|
-
return this._proxyConfigProvider.registerModelConfigProvider(provider);
|
4948
|
-
}
|
4949
|
-
async switchToNewThread() {
|
4950
|
-
if (!this.thread.store.onSwitchToNewThread)
|
4951
|
-
throw new Error("Runtime does not support switching to new threads.");
|
4952
|
-
this.thread = new ExternalStoreThreadRuntimeCore(
|
4953
|
-
this._proxyConfigProvider,
|
4954
|
-
{
|
4955
|
-
...this.thread.store,
|
4956
|
-
messages: []
|
4957
|
-
}
|
4958
|
-
);
|
4959
|
-
await this.thread.store.onSwitchToNewThread();
|
4960
|
-
this.thread._notifyEventSubscribers("switched-to");
|
4961
|
-
}
|
4962
|
-
async switchToThread(threadId) {
|
4963
|
-
if (threadId !== null) {
|
4964
|
-
if (!this.thread.store.onSwitchToThread)
|
4965
|
-
throw new Error("Runtime does not support switching threads.");
|
4966
|
-
this.thread = new ExternalStoreThreadRuntimeCore(
|
5199
|
+
super();
|
5200
|
+
this._store = store;
|
5201
|
+
this.threadManager = new ExternalStoreThreadManagerRuntimeCore(
|
5202
|
+
getThreadManagerAdapter(store),
|
5203
|
+
(threadId) => new ExternalStoreThreadRuntimeCore(
|
4967
5204
|
this._proxyConfigProvider,
|
4968
|
-
|
4969
|
-
|
4970
|
-
|
4971
|
-
|
4972
|
-
|
4973
|
-
|
4974
|
-
|
4975
|
-
|
4976
|
-
|
4977
|
-
this.switchToNewThread();
|
4978
|
-
}
|
5205
|
+
threadId,
|
5206
|
+
this._store
|
5207
|
+
)
|
5208
|
+
);
|
5209
|
+
}
|
5210
|
+
setStore(store) {
|
5211
|
+
this._store = store;
|
5212
|
+
this.threadManager.setAdapter(getThreadManagerAdapter(store));
|
5213
|
+
this.threadManager.mainThread.setStore(store);
|
4979
5214
|
}
|
4980
5215
|
};
|
4981
5216
|
|
@@ -4983,7 +5218,7 @@ var ExternalStoreRuntimeCore = class extends BaseAssistantRuntimeCore {
|
|
4983
5218
|
var useExternalStoreRuntime = (store) => {
|
4984
5219
|
const [runtime] = _react.useState.call(void 0, () => new ExternalStoreRuntimeCore(store));
|
4985
5220
|
_react.useEffect.call(void 0, () => {
|
4986
|
-
runtime.
|
5221
|
+
runtime.setStore(store);
|
4987
5222
|
});
|
4988
5223
|
return _react.useMemo.call(void 0,
|
4989
5224
|
() => AssistantRuntimeImpl.create(runtime, ThreadRuntimeImpl),
|
@@ -5212,8 +5447,8 @@ var WebSpeechSynthesisAdapter = class {
|
|
5212
5447
|
};
|
5213
5448
|
|
5214
5449
|
// src/runtimes/attachment/SimpleImageAttachmentAdapter.ts
|
5215
|
-
var SimpleImageAttachmentAdapter = (
|
5216
|
-
|
5450
|
+
var SimpleImageAttachmentAdapter = (_class17 = class {constructor() { _class17.prototype.__init43.call(this); }
|
5451
|
+
__init43() {this.accept = "image/*"}
|
5217
5452
|
async add(state) {
|
5218
5453
|
return {
|
5219
5454
|
id: state.file.name,
|
@@ -5238,7 +5473,7 @@ var SimpleImageAttachmentAdapter = (_class15 = class {constructor() { _class15.p
|
|
5238
5473
|
}
|
5239
5474
|
async remove() {
|
5240
5475
|
}
|
5241
|
-
},
|
5476
|
+
}, _class17);
|
5242
5477
|
var getFileDataURL = (file) => new Promise((resolve, reject) => {
|
5243
5478
|
const reader = new FileReader();
|
5244
5479
|
reader.onload = () => resolve(reader.result);
|
@@ -5247,8 +5482,8 @@ var getFileDataURL = (file) => new Promise((resolve, reject) => {
|
|
5247
5482
|
});
|
5248
5483
|
|
5249
5484
|
// src/runtimes/attachment/SimpleTextAttachmentAdapter.ts
|
5250
|
-
var SimpleTextAttachmentAdapter = (
|
5251
|
-
|
5485
|
+
var SimpleTextAttachmentAdapter = (_class18 = class {constructor() { _class18.prototype.__init44.call(this); }
|
5486
|
+
__init44() {this.accept = "text/plain,text/html,text/markdown,text/csv,text/xml,text/json,text/css"}
|
5252
5487
|
async add(state) {
|
5253
5488
|
return {
|
5254
5489
|
id: state.file.name,
|
@@ -5275,7 +5510,7 @@ ${await getFileText(attachment.file)}
|
|
5275
5510
|
}
|
5276
5511
|
async remove() {
|
5277
5512
|
}
|
5278
|
-
},
|
5513
|
+
}, _class18);
|
5279
5514
|
var getFileText = (file) => new Promise((resolve, reject) => {
|
5280
5515
|
const reader = new FileReader();
|
5281
5516
|
reader.onload = () => resolve(reader.result);
|
@@ -5376,7 +5611,7 @@ var ThreadConfigProvider = ({
|
|
5376
5611
|
}) => {
|
5377
5612
|
const hasAssistant = !!useAssistantRuntime({ optional: true });
|
5378
5613
|
const configProvider = config && Object.keys(_nullishCoalesce(config, () => ( {}))).length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children });
|
5379
|
-
if (!_optionalChain([config, 'optionalAccess',
|
5614
|
+
if (!_optionalChain([config, 'optionalAccess', _284 => _284.runtime])) return configProvider;
|
5380
5615
|
if (hasAssistant) {
|
5381
5616
|
throw new Error(
|
5382
5617
|
"You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
|
@@ -5704,7 +5939,7 @@ var AssistantMessageContent = _react.forwardRef.call(void 0, ({ components: comp
|
|
5704
5939
|
{
|
5705
5940
|
components: {
|
5706
5941
|
...componentsProp,
|
5707
|
-
Text: _nullishCoalesce(_nullishCoalesce(_optionalChain([componentsProp, 'optionalAccess',
|
5942
|
+
Text: _nullishCoalesce(_nullishCoalesce(_optionalChain([componentsProp, 'optionalAccess', _285 => _285.Text]), () => ( components.Text)), () => ( content_part_default.Text)),
|
5708
5943
|
tools: toolsComponents
|
5709
5944
|
}
|
5710
5945
|
}
|
@@ -5815,7 +6050,7 @@ var useAttachmentSrc = () => {
|
|
5815
6050
|
const { file, src } = useAttachment((a) => {
|
5816
6051
|
if (a.type !== "image") return {};
|
5817
6052
|
if (a.file) return { file: a.file };
|
5818
|
-
const src2 = _optionalChain([a, 'access',
|
6053
|
+
const src2 = _optionalChain([a, 'access', _286 => _286.content, 'optionalAccess', _287 => _287.filter, 'call', _288 => _288((c) => c.type === "image"), 'access', _289 => _289[0], 'optionalAccess', _290 => _290.image]);
|
5819
6054
|
if (!src2) return {};
|
5820
6055
|
return { src: src2 };
|
5821
6056
|
});
|
@@ -5959,7 +6194,7 @@ var ComposerAttachments = ({ components }) => {
|
|
5959
6194
|
{
|
5960
6195
|
components: {
|
5961
6196
|
...components,
|
5962
|
-
Attachment: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
6197
|
+
Attachment: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _291 => _291.Attachment]), () => ( attachment_default))
|
5963
6198
|
}
|
5964
6199
|
}
|
5965
6200
|
) });
|
@@ -6068,8 +6303,13 @@ var ThreadWelcomeMessageStyled = withDefaults("p", {
|
|
6068
6303
|
className: "aui-thread-welcome-message"
|
6069
6304
|
});
|
6070
6305
|
var ThreadWelcomeMessage = _react.forwardRef.call(void 0, ({ message: messageProp, ...rest }, ref) => {
|
6071
|
-
const {
|
6072
|
-
|
6306
|
+
const {
|
6307
|
+
welcome: { message } = {},
|
6308
|
+
strings: {
|
6309
|
+
welcome: { message: defaultMessage = "How can I help you today?" } = {}
|
6310
|
+
} = {}
|
6311
|
+
} = useThreadConfig();
|
6312
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeMessageStyled, { ...rest, ref, children: _nullishCoalesce(_nullishCoalesce(messageProp, () => ( message)), () => ( defaultMessage)) });
|
6073
6313
|
});
|
6074
6314
|
ThreadWelcomeMessage.displayName = "ThreadWelcomeMessage";
|
6075
6315
|
var ThreadWelcomeSuggestionContainer = withDefaults("div", {
|
@@ -6087,7 +6327,7 @@ var ThreadWelcomeSuggestions = () => {
|
|
6087
6327
|
const suggestions2 = useThread((t) => t.suggestions);
|
6088
6328
|
const { welcome: { suggestions } = {} } = useThreadConfig();
|
6089
6329
|
const finalSuggestions = suggestions2.length ? suggestions2 : suggestions;
|
6090
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestionContainer, { children: _optionalChain([finalSuggestions, 'optionalAccess',
|
6330
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestionContainer, { children: _optionalChain([finalSuggestions, 'optionalAccess', _292 => _292.map, 'call', _293 => _293((suggestion, idx) => {
|
6091
6331
|
const key = `${suggestion.prompt}-${idx}`;
|
6092
6332
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestion, { suggestion }, key);
|
6093
6333
|
})]) });
|
@@ -6165,7 +6405,7 @@ var UserMessageContent = _react.forwardRef.call(void 0, ({ components, ...props
|
|
6165
6405
|
{
|
6166
6406
|
components: {
|
6167
6407
|
...components,
|
6168
|
-
Text: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
6408
|
+
Text: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _294 => _294.Text]), () => ( content_part_default.Text))
|
6169
6409
|
}
|
6170
6410
|
}
|
6171
6411
|
) });
|
@@ -6182,7 +6422,7 @@ var UserMessageAttachments = ({
|
|
6182
6422
|
{
|
6183
6423
|
components: {
|
6184
6424
|
...components,
|
6185
|
-
Attachment: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
6425
|
+
Attachment: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _295 => _295.Attachment]), () => ( attachment_default))
|
6186
6426
|
}
|
6187
6427
|
}
|
6188
6428
|
) }) });
|
@@ -6285,10 +6525,10 @@ var ThreadMessages = ({ components, unstable_flexGrowDiv: flexGrowDiv = true, ..
|
|
6285
6525
|
thread_exports.Messages,
|
6286
6526
|
{
|
6287
6527
|
components: {
|
6288
|
-
UserMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
6289
|
-
EditComposer: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
6290
|
-
AssistantMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
6291
|
-
SystemMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
6528
|
+
UserMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _296 => _296.UserMessage]), () => ( user_message_default)),
|
6529
|
+
EditComposer: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _297 => _297.EditComposer]), () => ( edit_composer_default)),
|
6530
|
+
AssistantMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _298 => _298.AssistantMessage]), () => ( assistant_message_default)),
|
6531
|
+
SystemMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _299 => _299.SystemMessage]), () => ( SystemMessage))
|
6292
6532
|
},
|
6293
6533
|
...rest
|
6294
6534
|
}
|
@@ -6299,7 +6539,7 @@ var ThreadMessages = ({ components, unstable_flexGrowDiv: flexGrowDiv = true, ..
|
|
6299
6539
|
ThreadMessages.displayName = "ThreadMessages";
|
6300
6540
|
var ThreadFollowupSuggestions = () => {
|
6301
6541
|
const suggestions = useThread((t) => t.suggestions);
|
6302
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, thread_exports.If, { empty: false, running: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "aui-thread-followup-suggestions", children: _optionalChain([suggestions, 'optionalAccess',
|
6542
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, thread_exports.If, { empty: false, running: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "aui-thread-followup-suggestions", children: _optionalChain([suggestions, 'optionalAccess', _300 => _300.map, 'call', _301 => _301((suggestion, idx) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
6303
6543
|
thread_exports.Suggestion,
|
6304
6544
|
{
|
6305
6545
|
className: "aui-thread-followup-suggestion",
|
@@ -6533,5 +6773,7 @@ var assistant_modal_default = Object.assign(AssistantModal, exports12);
|
|
6533
6773
|
|
6534
6774
|
|
6535
6775
|
|
6536
|
-
|
6776
|
+
|
6777
|
+
|
6778
|
+
exports.ActionBarPrimitive = actionBar_exports; exports.AssistantActionBar = assistant_action_bar_default; exports.AssistantMessage = assistant_message_default; exports.AssistantModal = assistant_modal_default; exports.AssistantModalPrimitive = assistantModal_exports; exports.AssistantRuntimeProvider = AssistantRuntimeProvider; exports.AttachmentPrimitive = attachment_exports; exports.AttachmentUI = attachment_default; exports.BranchPicker = branch_picker_default; exports.BranchPickerPrimitive = branchPicker_exports; exports.Composer = composer_default; exports.ComposerAttachment = attachment_default; exports.ComposerPrimitive = composer_exports; exports.CompositeAttachmentAdapter = CompositeAttachmentAdapter; exports.ContentPart = content_part_default; exports.ContentPartPrimitive = contentPart_exports; exports.EdgeChatAdapter = EdgeChatAdapter; exports.EditComposer = edit_composer_default; exports.INTERNAL = internal_exports; exports.MessagePrimitive = message_exports; exports.SimpleImageAttachmentAdapter = SimpleImageAttachmentAdapter; exports.SimpleTextAttachmentAdapter = SimpleTextAttachmentAdapter; exports.TextContentPartProvider = TextContentPartProvider; exports.Thread = thread_default; exports.ThreadConfigProvider = ThreadConfigProvider; exports.ThreadPrimitive = thread_exports; exports.ThreadWelcome = thread_welcome_default; exports.UserActionBar = user_action_bar_default; exports.UserMessage = user_message_default; exports.UserMessageAttachment = attachment_default; exports.WebSpeechSynthesisAdapter = WebSpeechSynthesisAdapter; exports.fromCoreMessage = fromCoreMessage; exports.fromCoreMessages = fromCoreMessages; exports.fromLanguageModelMessages = fromLanguageModelMessages; exports.fromLanguageModelTools = fromLanguageModelTools; exports.getExternalStoreMessage = getExternalStoreMessage; exports.makeAssistantTool = makeAssistantTool; exports.makeAssistantToolUI = makeAssistantToolUI; exports.streamUtils = streamUtils; exports.subscribeToMainThread = subscribeToMainThread; exports.toCoreMessage = _chunkC6UZOY5Ajs.toCoreMessage; exports.toCoreMessages = _chunkC6UZOY5Ajs.toCoreMessages; exports.toLanguageModelMessages = _chunkC6UZOY5Ajs.toLanguageModelMessages; exports.toLanguageModelTools = _chunkC6UZOY5Ajs.toLanguageModelTools; exports.useActionBarCopy = useActionBarCopy; exports.useActionBarEdit = useActionBarEdit; exports.useActionBarFeedbackNegative = useActionBarFeedbackNegative; exports.useActionBarFeedbackPositive = useActionBarFeedbackPositive; exports.useActionBarReload = useActionBarReload; exports.useActionBarSpeak = useActionBarSpeak; exports.useActionBarStopSpeaking = useActionBarStopSpeaking; exports.useAppendMessage = useAppendMessage; exports.useAssistantActions = useAssistantActions; exports.useAssistantActionsStore = useAssistantActionsStore; exports.useAssistantContext = useAssistantContext; exports.useAssistantInstructions = useAssistantInstructions; exports.useAssistantRuntime = useAssistantRuntime; exports.useAssistantRuntimeStore = useAssistantRuntimeStore; exports.useAssistantTool = useAssistantTool; exports.useAssistantToolUI = useAssistantToolUI; exports.useBranchPickerCount = useBranchPickerCount; exports.useBranchPickerNext = useBranchPickerNext; exports.useBranchPickerNumber = useBranchPickerNumber; exports.useBranchPickerPrevious = useBranchPickerPrevious; exports.useComposer = useComposer; exports.useComposerAddAttachment = useComposerAddAttachment; exports.useComposerCancel = useComposerCancel; exports.useComposerContext = useComposerContext; exports.useComposerIf = useComposerIf; exports.useComposerRuntime = useComposerRuntime; exports.useComposerSend = useComposerSend; exports.useComposerStore = useComposerStore; exports.useContentPart = useContentPart; exports.useContentPartContext = useContentPartContext; exports.useContentPartDisplay = useContentPartDisplay; exports.useContentPartImage = useContentPartImage; exports.useContentPartRuntime = useContentPartRuntime; exports.useContentPartStore = useContentPartStore; exports.useContentPartText = useContentPartText; exports.useDangerousInBrowserRuntime = useDangerousInBrowserRuntime; exports.useEdgeRuntime = useEdgeRuntime; exports.useEditComposer = useEditComposer; exports.useEditComposerStore = useEditComposerStore; exports.useExternalMessageConverter = useExternalMessageConverter; exports.useExternalStoreRuntime = useExternalStoreRuntime; exports.useInlineRender = useInlineRender; exports.useLocalRuntime = useLocalRuntime; exports.useMessage = useMessage; exports.useMessageContext = useMessageContext; exports.useMessageIf = useMessageIf; exports.useMessageRuntime = useMessageRuntime; exports.useMessageStore = useMessageStore; exports.useMessageUtils = useMessageUtils; exports.useMessageUtilsStore = useMessageUtilsStore; exports.useSwitchToNewThread = useSwitchToNewThread; exports.useThread = useThread; exports.useThreadActions = useThreadActions; exports.useThreadActionsStore = useThreadActionsStore; exports.useThreadComposer = useThreadComposer; exports.useThreadComposerStore = useThreadComposerStore; exports.useThreadConfig = useThreadConfig; exports.useThreadContext = useThreadContext; exports.useThreadEmpty = useThreadEmpty; exports.useThreadIf = useThreadIf; exports.useThreadManager = useThreadManager; exports.useThreadMessages = useThreadMessages; exports.useThreadMessagesStore = useThreadMessagesStore; exports.useThreadModelConfig = useThreadModelConfig; exports.useThreadRuntime = useThreadRuntime; exports.useThreadRuntimeStore = useThreadRuntimeStore; exports.useThreadScrollToBottom = useThreadScrollToBottom; exports.useThreadStore = useThreadStore; exports.useThreadSuggestion = useThreadSuggestion; exports.useThreadViewport = useThreadViewport; exports.useThreadViewportStore = useThreadViewportStore; exports.useToolUIs = useToolUIs; exports.useToolUIsStore = useToolUIsStore;
|
6537
6779
|
//# sourceMappingURL=index.js.map
|