@assistant-ui/react 0.5.5 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +14 -6
- package/dist/index.d.ts +14 -6
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -0
- package/dist/index.mjs.map +1 -1
- package/edge/README.md +1 -0
- package/edge/package.json +5 -0
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
@@ -3357,6 +3357,7 @@ var shouldContinue = (result) => result.status?.type === "requires-action" && re
|
|
3357
3357
|
|
3358
3358
|
// src/runtimes/local/LocalThreadRuntime.tsx
|
3359
3359
|
var CAPABILITIES = Object.freeze({
|
3360
|
+
switchToBranch: true,
|
3360
3361
|
edit: true,
|
3361
3362
|
reload: true,
|
3362
3363
|
cancel: true,
|
@@ -3630,6 +3631,7 @@ var ExternalStoreThreadRuntime = class {
|
|
3630
3631
|
useStore;
|
3631
3632
|
get capabilities() {
|
3632
3633
|
return {
|
3634
|
+
switchToBranch: this.store.setMessages !== void 0,
|
3633
3635
|
edit: this.store.onEdit !== void 0,
|
3634
3636
|
reload: this.store.onReload !== void 0,
|
3635
3637
|
cancel: this.store.onCancel !== void 0,
|
@@ -3642,6 +3644,8 @@ var ExternalStoreThreadRuntime = class {
|
|
3642
3644
|
return this.repository.getBranches(messageId);
|
3643
3645
|
}
|
3644
3646
|
switchToBranch(branchId) {
|
3647
|
+
if (!this.store.setMessages)
|
3648
|
+
throw new Error("Runtime does not support switching branches.");
|
3645
3649
|
this.repository.switchToBranch(branchId);
|
3646
3650
|
this.updateMessages(this.repository.getMessages());
|
3647
3651
|
}
|
@@ -3874,7 +3878,15 @@ import { forwardRef as forwardRef20 } from "react";
|
|
3874
3878
|
import { forwardRef as forwardRef19 } from "react";
|
3875
3879
|
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
3876
3880
|
import { jsx as jsx31, jsxs as jsxs6 } from "react/jsx-runtime";
|
3881
|
+
var useAllowBranchPicker = () => {
|
3882
|
+
const { branchPicker: { allowBranchPicker = true } = {} } = useThreadConfig();
|
3883
|
+
const { useThreadActions } = useThreadContext();
|
3884
|
+
const branchPickerSupported = useThreadActions((t) => t.capabilities.edit);
|
3885
|
+
return branchPickerSupported && allowBranchPicker;
|
3886
|
+
};
|
3877
3887
|
var BranchPicker = () => {
|
3888
|
+
const allowBranchPicker = useAllowBranchPicker();
|
3889
|
+
if (!allowBranchPicker) return null;
|
3878
3890
|
return /* @__PURE__ */ jsxs6(BranchPickerRoot, { hideWhenSingleBranch: true, children: [
|
3879
3891
|
/* @__PURE__ */ jsx31(BranchPickerPrevious2, {}),
|
3880
3892
|
/* @__PURE__ */ jsx31(BranchPickerState, {}),
|