@blade-hq/agent-react 2610.0.0-beta.64 → 2610.0.0-beta.65
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/README.md +5 -1
- package/dist/components/ChatSurface.d.ts +8 -1
- package/dist/components/MessageList.d.ts +19 -1
- package/dist/hooks/use-typewriter-reveal.d.ts +32 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +512 -346
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/public-api.md +15 -1
package/dist/index.js
CHANGED
|
@@ -2451,6 +2451,124 @@ function useMessagePin({
|
|
|
2451
2451
|
return { release, isActive };
|
|
2452
2452
|
}
|
|
2453
2453
|
|
|
2454
|
+
// src/hooks/use-typewriter-reveal.ts
|
|
2455
|
+
import { useCallback as useCallback4, useEffect as useEffect4, useRef as useRef4, useState as useState4 } from "react";
|
|
2456
|
+
var REVEAL_INITIAL_CPS = 18;
|
|
2457
|
+
var REVEAL_MIN_CPS = 6;
|
|
2458
|
+
var REVEAL_MAX_CPS = 240;
|
|
2459
|
+
var REVEAL_DISPLAY_RATIO = 0.82;
|
|
2460
|
+
var REVEAL_EMA_ALPHA = 0.25;
|
|
2461
|
+
function clamp(value, min, max) {
|
|
2462
|
+
return Math.min(max, Math.max(min, value));
|
|
2463
|
+
}
|
|
2464
|
+
function scheduleAnimationFrame(callback) {
|
|
2465
|
+
if (typeof window !== "undefined" && typeof window.requestAnimationFrame === "function") {
|
|
2466
|
+
const handle2 = window.requestAnimationFrame(callback);
|
|
2467
|
+
return () => window.cancelAnimationFrame(handle2);
|
|
2468
|
+
}
|
|
2469
|
+
const handle = globalThis.setTimeout(() => callback(Date.now()), 33);
|
|
2470
|
+
return () => globalThis.clearTimeout(handle);
|
|
2471
|
+
}
|
|
2472
|
+
function initialRevealState(targetText, isLive, resetKey) {
|
|
2473
|
+
const revealedLen = isLive ? 0 : targetText.length;
|
|
2474
|
+
return {
|
|
2475
|
+
resetKey,
|
|
2476
|
+
displayedText: targetText.slice(0, revealedLen),
|
|
2477
|
+
revealedLen,
|
|
2478
|
+
isRevealing: false
|
|
2479
|
+
};
|
|
2480
|
+
}
|
|
2481
|
+
function useTypewriterReveal(targetText, isLive, resetKey) {
|
|
2482
|
+
const [state, setState] = useState4(() => initialRevealState(targetText, isLive, resetKey));
|
|
2483
|
+
const targetTextRef = useRef4(targetText);
|
|
2484
|
+
targetTextRef.current = targetText;
|
|
2485
|
+
const revealedLenRef = useRef4(state.revealedLen);
|
|
2486
|
+
const priorTargetLenRef = useRef4(targetText.length);
|
|
2487
|
+
const emaCpsRef = useRef4(REVEAL_INITIAL_CPS);
|
|
2488
|
+
const lastTickTsRef = useRef4(null);
|
|
2489
|
+
const lastArrivalTsRef = useRef4(null);
|
|
2490
|
+
const cancelRef = useRef4(null);
|
|
2491
|
+
const stopTicking = useCallback4(() => {
|
|
2492
|
+
cancelRef.current?.();
|
|
2493
|
+
cancelRef.current = null;
|
|
2494
|
+
}, []);
|
|
2495
|
+
const flushNow = useCallback4(() => {
|
|
2496
|
+
stopTicking();
|
|
2497
|
+
revealedLenRef.current = targetTextRef.current.length;
|
|
2498
|
+
priorTargetLenRef.current = targetTextRef.current.length;
|
|
2499
|
+
setState((s) => ({ ...s, displayedText: targetTextRef.current, revealedLen: revealedLenRef.current, isRevealing: false }));
|
|
2500
|
+
}, [stopTicking]);
|
|
2501
|
+
if (state.resetKey !== resetKey) {
|
|
2502
|
+
const next = initialRevealState(targetText, isLive, resetKey);
|
|
2503
|
+
revealedLenRef.current = next.revealedLen;
|
|
2504
|
+
priorTargetLenRef.current = targetText.length;
|
|
2505
|
+
emaCpsRef.current = REVEAL_INITIAL_CPS;
|
|
2506
|
+
lastTickTsRef.current = null;
|
|
2507
|
+
lastArrivalTsRef.current = null;
|
|
2508
|
+
stopTicking();
|
|
2509
|
+
setState(next);
|
|
2510
|
+
} else if (!isLive) {
|
|
2511
|
+
if (state.revealedLen !== targetText.length || state.displayedText !== targetText) {
|
|
2512
|
+
revealedLenRef.current = targetText.length;
|
|
2513
|
+
priorTargetLenRef.current = targetText.length;
|
|
2514
|
+
stopTicking();
|
|
2515
|
+
setState((s) => ({ ...s, displayedText: targetText, revealedLen: targetText.length, isRevealing: false }));
|
|
2516
|
+
}
|
|
2517
|
+
} else if (state.revealedLen === 0 && targetText.length > 0) {
|
|
2518
|
+
revealedLenRef.current = targetText.length;
|
|
2519
|
+
priorTargetLenRef.current = targetText.length;
|
|
2520
|
+
setState((s) => ({ ...s, displayedText: targetText, revealedLen: targetText.length, isRevealing: false }));
|
|
2521
|
+
}
|
|
2522
|
+
useEffect4(() => {
|
|
2523
|
+
if (!isLive) return;
|
|
2524
|
+
if (revealedLenRef.current === 0) return;
|
|
2525
|
+
if (revealedLenRef.current >= targetText.length) return;
|
|
2526
|
+
if (cancelRef.current != null) return;
|
|
2527
|
+
setState((s) => s.isRevealing ? s : { ...s, isRevealing: true });
|
|
2528
|
+
const tick = (ts) => {
|
|
2529
|
+
cancelRef.current = null;
|
|
2530
|
+
const dt = lastTickTsRef.current == null ? 16 : Math.max(1, ts - lastTickTsRef.current);
|
|
2531
|
+
const currentTargetLen = targetTextRef.current.length;
|
|
2532
|
+
const arrived = Math.max(0, currentTargetLen - priorTargetLenRef.current);
|
|
2533
|
+
if (arrived > 0) {
|
|
2534
|
+
if (lastArrivalTsRef.current != null) {
|
|
2535
|
+
const arrivalDt = Math.max(1, ts - lastArrivalTsRef.current);
|
|
2536
|
+
const instantCps = arrived / arrivalDt * 1e3;
|
|
2537
|
+
emaCpsRef.current = emaCpsRef.current + REVEAL_EMA_ALPHA * (instantCps - emaCpsRef.current);
|
|
2538
|
+
}
|
|
2539
|
+
lastArrivalTsRef.current = ts;
|
|
2540
|
+
}
|
|
2541
|
+
priorTargetLenRef.current = currentTargetLen;
|
|
2542
|
+
lastTickTsRef.current = ts;
|
|
2543
|
+
const cps = clamp(emaCpsRef.current, REVEAL_MIN_CPS, REVEAL_MAX_CPS);
|
|
2544
|
+
const advance = Math.max(1, Math.round(cps * REVEAL_DISPLAY_RATIO * dt / 1e3));
|
|
2545
|
+
revealedLenRef.current = Math.min(currentTargetLen, revealedLenRef.current + advance);
|
|
2546
|
+
const revealed = revealedLenRef.current >= currentTargetLen;
|
|
2547
|
+
setState((s) => ({
|
|
2548
|
+
...s,
|
|
2549
|
+
displayedText: targetTextRef.current.slice(0, revealedLenRef.current),
|
|
2550
|
+
revealedLen: revealedLenRef.current,
|
|
2551
|
+
isRevealing: !revealed
|
|
2552
|
+
}));
|
|
2553
|
+
if (!revealed) {
|
|
2554
|
+
cancelRef.current = scheduleAnimationFrame(tick);
|
|
2555
|
+
}
|
|
2556
|
+
};
|
|
2557
|
+
cancelRef.current = scheduleAnimationFrame(tick);
|
|
2558
|
+
return stopTicking;
|
|
2559
|
+
}, [targetText, isLive, stopTicking]);
|
|
2560
|
+
useEffect4(() => {
|
|
2561
|
+
if (typeof document === "undefined") return;
|
|
2562
|
+
const handleVisibilityChange = () => {
|
|
2563
|
+
if (document.visibilityState === "visible") flushNow();
|
|
2564
|
+
};
|
|
2565
|
+
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
2566
|
+
return () => document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
2567
|
+
}, [flushNow]);
|
|
2568
|
+
useEffect4(() => stopTicking, [stopTicking]);
|
|
2569
|
+
return { displayedText: state.displayedText, isRevealing: state.isRevealing, flushNow };
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2454
2572
|
// src/components/AgentChat.tsx
|
|
2455
2573
|
import {
|
|
2456
2574
|
BladeApiError as BladeApiError2,
|
|
@@ -2892,13 +3010,13 @@ var X = createLucideIcon("X", [
|
|
|
2892
3010
|
]);
|
|
2893
3011
|
|
|
2894
3012
|
// src/components/AgentChat.tsx
|
|
2895
|
-
import { useCallback as
|
|
3013
|
+
import { useCallback as useCallback28, useEffect as useEffect22, useMemo as useMemo17, useRef as useRef24, useState as useState32 } from "react";
|
|
2896
3014
|
|
|
2897
3015
|
// src/components/SessionPluginSelector.tsx
|
|
2898
|
-
import { useEffect as
|
|
3016
|
+
import { useEffect as useEffect12, useState as useState17 } from "react";
|
|
2899
3017
|
|
|
2900
3018
|
// src/components/SessionPluginConfigDialog.tsx
|
|
2901
|
-
import { useEffect as
|
|
3019
|
+
import { useEffect as useEffect10, useRef as useRef10, useState as useState15 } from "react";
|
|
2902
3020
|
|
|
2903
3021
|
// ../../node_modules/.pnpm/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js
|
|
2904
3022
|
function deepCompareStrict(a, b2) {
|
|
@@ -8638,7 +8756,7 @@ function toFieldPathId(fieldPath, globalFormOptions, parentPath, isMultiValue) {
|
|
|
8638
8756
|
|
|
8639
8757
|
// ../../node_modules/.pnpm/@rjsf+utils@6.10.0_react@19.2.4/node_modules/@rjsf/utils/lib/useAltDateWidgetProps.js
|
|
8640
8758
|
import { jsx as _jsx3 } from "react/jsx-runtime";
|
|
8641
|
-
import { useCallback as
|
|
8759
|
+
import { useCallback as useCallback5, useEffect as useEffect5, useMemo as useMemo3, useState as useState5 } from "react";
|
|
8642
8760
|
function readyForChange(state) {
|
|
8643
8761
|
return Object.values(state).every((value) => value !== -1);
|
|
8644
8762
|
}
|
|
@@ -8646,16 +8764,16 @@ function DateElement(props) {
|
|
|
8646
8764
|
const { className = "form-control", type, range, value, select, rootId, name, disabled, readonly: readonly2, autofocus, registry: registry2, onBlur, onFocus } = props;
|
|
8647
8765
|
const id = `${rootId}_${type}`;
|
|
8648
8766
|
const { SelectWidget: SelectWidget2 } = registry2.widgets;
|
|
8649
|
-
const onChange =
|
|
8767
|
+
const onChange = useCallback5((newValue) => select(type, newValue), [select, type]);
|
|
8650
8768
|
return _jsx3(SelectWidget2, { schema: { type: "integer" }, id, name, className, options: { enumOptions: dateRangeOptions(range[0], range[1]) }, placeholder: type, value, disabled, readonly: readonly2, autofocus, onChange, onBlur, onFocus, registry: registry2, label: "", "aria-describedby": ariaDescribedByIds(rootId) });
|
|
8651
8769
|
}
|
|
8652
8770
|
function useAltDateWidgetProps(props) {
|
|
8653
8771
|
const { time: time5 = false, disabled = false, readonly: readonly2 = false, options, onChange, value } = props;
|
|
8654
|
-
const [state, setState] =
|
|
8655
|
-
|
|
8772
|
+
const [state, setState] = useState5(parseDateString(value, time5));
|
|
8773
|
+
useEffect5(() => {
|
|
8656
8774
|
setState(parseDateString(value, time5));
|
|
8657
8775
|
}, [time5, value]);
|
|
8658
|
-
const handleChange =
|
|
8776
|
+
const handleChange = useCallback5((property, newValue) => {
|
|
8659
8777
|
const nextState = {
|
|
8660
8778
|
...state,
|
|
8661
8779
|
[property]: typeof newValue === "undefined" ? -1 : newValue
|
|
@@ -8666,14 +8784,14 @@ function useAltDateWidgetProps(props) {
|
|
|
8666
8784
|
setState(nextState);
|
|
8667
8785
|
}
|
|
8668
8786
|
}, [state, onChange, time5]);
|
|
8669
|
-
const handleClear =
|
|
8787
|
+
const handleClear = useCallback5((event) => {
|
|
8670
8788
|
event.preventDefault();
|
|
8671
8789
|
if (disabled || readonly2) {
|
|
8672
8790
|
return;
|
|
8673
8791
|
}
|
|
8674
8792
|
onChange(void 0);
|
|
8675
8793
|
}, [disabled, readonly2, onChange]);
|
|
8676
|
-
const handleSetNow =
|
|
8794
|
+
const handleSetNow = useCallback5((event) => {
|
|
8677
8795
|
event.preventDefault();
|
|
8678
8796
|
if (disabled || readonly2) {
|
|
8679
8797
|
return;
|
|
@@ -8686,9 +8804,9 @@ function useAltDateWidgetProps(props) {
|
|
|
8686
8804
|
}
|
|
8687
8805
|
|
|
8688
8806
|
// ../../node_modules/.pnpm/@rjsf+utils@6.10.0_react@19.2.4/node_modules/@rjsf/utils/lib/useDeepCompareMemo.js
|
|
8689
|
-
import { useRef as
|
|
8807
|
+
import { useRef as useRef5 } from "react";
|
|
8690
8808
|
function useDeepCompareMemo(newValue) {
|
|
8691
|
-
const valueRef =
|
|
8809
|
+
const valueRef = useRef5(newValue);
|
|
8692
8810
|
if (!deepEquals_default(newValue, valueRef.current)) {
|
|
8693
8811
|
valueRef.current = newValue;
|
|
8694
8812
|
}
|
|
@@ -8696,7 +8814,7 @@ function useDeepCompareMemo(newValue) {
|
|
|
8696
8814
|
}
|
|
8697
8815
|
|
|
8698
8816
|
// ../../node_modules/.pnpm/@rjsf+utils@6.10.0_react@19.2.4/node_modules/@rjsf/utils/lib/useFileWidgetProps.js
|
|
8699
|
-
import { useCallback as
|
|
8817
|
+
import { useCallback as useCallback6, useMemo as useMemo4 } from "react";
|
|
8700
8818
|
function addNameToDataURL(dataURL, name) {
|
|
8701
8819
|
return dataURL.replace(";base64", `;name=${encodeURIComponent(name)};base64`);
|
|
8702
8820
|
}
|
|
@@ -8757,7 +8875,7 @@ function useFileWidgetProps(value, onChange, multiple = false) {
|
|
|
8757
8875
|
return [];
|
|
8758
8876
|
}, [value, multiple]);
|
|
8759
8877
|
const filesInfo = useMemo4(() => Array.isArray(value) ? extractFileInfo(value) : extractFileInfo([value || ""]), [value]);
|
|
8760
|
-
const handleChange =
|
|
8878
|
+
const handleChange = useCallback6(async (files) => {
|
|
8761
8879
|
const filesInfoEvent = await processFiles(files);
|
|
8762
8880
|
const newValue = filesInfoEvent.map((fileInfo) => fileInfo.dataURL || null);
|
|
8763
8881
|
if (multiple) {
|
|
@@ -8766,7 +8884,7 @@ function useFileWidgetProps(value, onChange, multiple = false) {
|
|
|
8766
8884
|
onChange(newValue[0]);
|
|
8767
8885
|
}
|
|
8768
8886
|
}, [values, multiple, onChange]);
|
|
8769
|
-
const handleRemove =
|
|
8887
|
+
const handleRemove = useCallback6((index) => {
|
|
8770
8888
|
if (multiple) {
|
|
8771
8889
|
const newValue = values.filter((_2, i2) => i2 !== index);
|
|
8772
8890
|
onChange(newValue);
|
|
@@ -8882,7 +9000,7 @@ var TranslatableString;
|
|
|
8882
9000
|
|
|
8883
9001
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/fields/ArrayField.js
|
|
8884
9002
|
import { jsx as _jsx4 } from "react/jsx-runtime";
|
|
8885
|
-
import { memo, useCallback as
|
|
9003
|
+
import { memo, useCallback as useCallback7, useMemo as useMemo5, useRef as useRef6, useState as useState6 } from "react";
|
|
8886
9004
|
var rowIdCounter = 0;
|
|
8887
9005
|
function generateRowId() {
|
|
8888
9006
|
rowIdCounter += 1;
|
|
@@ -8992,19 +9110,19 @@ function ArrayFieldItemInner(props) {
|
|
|
8992
9110
|
toolbar: false
|
|
8993
9111
|
};
|
|
8994
9112
|
has.toolbar = Object.keys(has).some((key) => has[key]);
|
|
8995
|
-
const onAddItem =
|
|
9113
|
+
const onAddItem = useCallback7((event) => {
|
|
8996
9114
|
handleAddItem(event, index + 1);
|
|
8997
9115
|
}, [handleAddItem, index]);
|
|
8998
|
-
const onCopyItem =
|
|
9116
|
+
const onCopyItem = useCallback7((event) => {
|
|
8999
9117
|
handleCopyItem(event, index);
|
|
9000
9118
|
}, [handleCopyItem, index]);
|
|
9001
|
-
const onRemoveItem =
|
|
9119
|
+
const onRemoveItem = useCallback7((event) => {
|
|
9002
9120
|
handleRemoveItem(event, index);
|
|
9003
9121
|
}, [handleRemoveItem, index]);
|
|
9004
|
-
const onMoveUpItem =
|
|
9122
|
+
const onMoveUpItem = useCallback7((event) => {
|
|
9005
9123
|
handleReorderItems(event, index, index - 1);
|
|
9006
9124
|
}, [handleReorderItems, index]);
|
|
9007
|
-
const onMoveDownItem =
|
|
9125
|
+
const onMoveDownItem = useCallback7((event) => {
|
|
9008
9126
|
handleReorderItems(event, index, index + 1);
|
|
9009
9127
|
}, [handleReorderItems, index]);
|
|
9010
9128
|
const templateProps = {
|
|
@@ -9208,7 +9326,7 @@ function FixedArray(props) {
|
|
|
9208
9326
|
}
|
|
9209
9327
|
function useKeyedFormData(formData = []) {
|
|
9210
9328
|
const newHash = useMemo5(() => hashObject(formData), [formData]);
|
|
9211
|
-
const [state, setState] =
|
|
9329
|
+
const [state, setState] = useState6(() => ({
|
|
9212
9330
|
formDataHash: newHash,
|
|
9213
9331
|
keyedFormData: generateKeyedFormData(formData)
|
|
9214
9332
|
}));
|
|
@@ -9223,7 +9341,7 @@ function useKeyedFormData(formData = []) {
|
|
|
9223
9341
|
formDataHash = newHash;
|
|
9224
9342
|
setState({ formDataHash, keyedFormData });
|
|
9225
9343
|
}
|
|
9226
|
-
const updateKeyedFormData =
|
|
9344
|
+
const updateKeyedFormData = useCallback7((newData) => {
|
|
9227
9345
|
const plainFormData = keyedToPlainFormData(newData);
|
|
9228
9346
|
const updatedHash = hashObject(plainFormData);
|
|
9229
9347
|
setState({ formDataHash: updatedHash, keyedFormData: newData });
|
|
@@ -9235,12 +9353,12 @@ function ArrayField(props) {
|
|
|
9235
9353
|
const { schema, uiSchema, errorSchema, fieldPathId, registry: registry2, formData, onChange } = props;
|
|
9236
9354
|
const { globalFormOptions, schemaUtils, translateString } = registry2;
|
|
9237
9355
|
const { keyedFormData, updateKeyedFormData } = useKeyedFormData(formData);
|
|
9238
|
-
const keyedFormDataRef =
|
|
9356
|
+
const keyedFormDataRef = useRef6(keyedFormData);
|
|
9239
9357
|
keyedFormDataRef.current = keyedFormData;
|
|
9240
|
-
const errorSchemaRef =
|
|
9358
|
+
const errorSchemaRef = useRef6(errorSchema);
|
|
9241
9359
|
errorSchemaRef.current = errorSchema;
|
|
9242
9360
|
const childFieldPathId = props.childFieldPathId ?? fieldPathId;
|
|
9243
|
-
const handleAddItem =
|
|
9361
|
+
const handleAddItem = useCallback7((event, index) => {
|
|
9244
9362
|
if (event) {
|
|
9245
9363
|
event.preventDefault();
|
|
9246
9364
|
}
|
|
@@ -9268,7 +9386,7 @@ function ArrayField(props) {
|
|
|
9268
9386
|
}
|
|
9269
9387
|
onChange(updateKeyedFormData(newKeyedFormData), childFieldPathId.path, newErrorSchema);
|
|
9270
9388
|
}, [registry2, schema, onChange, updateKeyedFormData, childFieldPathId]);
|
|
9271
|
-
const handleCopyItem =
|
|
9389
|
+
const handleCopyItem = useCallback7((event, index) => {
|
|
9272
9390
|
if (event) {
|
|
9273
9391
|
event.preventDefault();
|
|
9274
9392
|
}
|
|
@@ -9296,7 +9414,7 @@ function ArrayField(props) {
|
|
|
9296
9414
|
}
|
|
9297
9415
|
onChange(updateKeyedFormData(newKeyedFormData), childFieldPathId.path, newErrorSchema);
|
|
9298
9416
|
}, [onChange, updateKeyedFormData, childFieldPathId]);
|
|
9299
|
-
const handleRemoveItem =
|
|
9417
|
+
const handleRemoveItem = useCallback7((event, index) => {
|
|
9300
9418
|
if (event) {
|
|
9301
9419
|
event.preventDefault();
|
|
9302
9420
|
}
|
|
@@ -9315,7 +9433,7 @@ function ArrayField(props) {
|
|
|
9315
9433
|
const newKeyedFormData = keyedFormDataRef.current.filter((_2, i2) => i2 !== index);
|
|
9316
9434
|
onChange(updateKeyedFormData(newKeyedFormData), childFieldPathId.path, newErrorSchema);
|
|
9317
9435
|
}, [onChange, updateKeyedFormData, childFieldPathId]);
|
|
9318
|
-
const handleReorderItems =
|
|
9436
|
+
const handleReorderItems = useCallback7((event, index, newIndex) => {
|
|
9319
9437
|
if (event) {
|
|
9320
9438
|
event.preventDefault();
|
|
9321
9439
|
event.currentTarget.blur();
|
|
@@ -9343,7 +9461,7 @@ function ArrayField(props) {
|
|
|
9343
9461
|
const newKeyedFormData = reOrderArray();
|
|
9344
9462
|
onChange(updateKeyedFormData(newKeyedFormData), childFieldPathId.path, newErrorSchema);
|
|
9345
9463
|
}, [onChange, updateKeyedFormData, childFieldPathId]);
|
|
9346
|
-
const handleChange =
|
|
9464
|
+
const handleChange = useCallback7((value, path, newErrorSchema, id) => {
|
|
9347
9465
|
const lastPathIsItemIndex = typeof path.at(-1) === "number";
|
|
9348
9466
|
onChange(
|
|
9349
9467
|
// We need to treat undefined items as nulls to have validation.
|
|
@@ -9355,7 +9473,7 @@ function ArrayField(props) {
|
|
|
9355
9473
|
id
|
|
9356
9474
|
);
|
|
9357
9475
|
}, [onChange]);
|
|
9358
|
-
const onSelectChange =
|
|
9476
|
+
const onSelectChange = useCallback7((value) => {
|
|
9359
9477
|
onChange(value, childFieldPathId.path, void 0, childFieldPathId?.[ID_KEY]);
|
|
9360
9478
|
}, [onChange, childFieldPathId]);
|
|
9361
9479
|
const arrayAsMultiProps = {
|
|
@@ -9400,7 +9518,7 @@ function ArrayField(props) {
|
|
|
9400
9518
|
|
|
9401
9519
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/fields/BooleanField.js
|
|
9402
9520
|
import { jsx as _jsx5 } from "react/jsx-runtime";
|
|
9403
|
-
import { useCallback as
|
|
9521
|
+
import { useCallback as useCallback8 } from "react";
|
|
9404
9522
|
function BooleanField(props) {
|
|
9405
9523
|
const { schema, name, uiSchema, fieldPathId, formData, registry: registry2, required: required2, disabled, readonly: readonly2, hideError, autofocus, title, onChange, onFocus, onBlur, rawErrors } = props;
|
|
9406
9524
|
const { title: schemaTitle } = schema;
|
|
@@ -9448,16 +9566,16 @@ function BooleanField(props) {
|
|
|
9448
9566
|
enumOptions = optionsList({ enum: enums }, uiSchema);
|
|
9449
9567
|
}
|
|
9450
9568
|
}
|
|
9451
|
-
const onWidgetChange =
|
|
9569
|
+
const onWidgetChange = useCallback8((value, errorSchema, id) => onChange(value, fieldPathId.path, errorSchema, id), [onChange, fieldPathId]);
|
|
9452
9570
|
return _jsx5(Widget, { options: { ...options, enumOptions }, schema, uiSchema, id: fieldPathId.$id, name, onChange: onWidgetChange, onFocus, onBlur, label, hideLabel: !displayLabel, value: formData, required: required2, disabled, readonly: readonly2, hideError, registry: registry2, autofocus, rawErrors, htmlName: fieldPathId.name });
|
|
9453
9571
|
}
|
|
9454
9572
|
var BooleanField_default = BooleanField;
|
|
9455
9573
|
|
|
9456
9574
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/fields/CyclicSchemaField.js
|
|
9457
9575
|
import { jsx as _jsx6 } from "react/jsx-runtime";
|
|
9458
|
-
import { useState as
|
|
9576
|
+
import { useState as useState7 } from "react";
|
|
9459
9577
|
function CyclicSchemaField(props) {
|
|
9460
|
-
const [expanded, setExpanded] =
|
|
9578
|
+
const [expanded, setExpanded] = useState7(false);
|
|
9461
9579
|
const { name, registry: registry2, schema, uiSchema, fieldPathId } = props;
|
|
9462
9580
|
const { globalUiOptions } = registry2;
|
|
9463
9581
|
const uiOptions = getUiOptions(uiSchema, globalUiOptions);
|
|
@@ -9472,7 +9590,7 @@ function CyclicSchemaField(props) {
|
|
|
9472
9590
|
|
|
9473
9591
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/fields/FallbackField.js
|
|
9474
9592
|
import { jsx as _jsx7 } from "react/jsx-runtime";
|
|
9475
|
-
import { useMemo as useMemo6, useState as
|
|
9593
|
+
import { useMemo as useMemo6, useState as useState8 } from "react";
|
|
9476
9594
|
function getFallbackTypeSelectionSchema(title) {
|
|
9477
9595
|
return {
|
|
9478
9596
|
type: "string",
|
|
@@ -9508,7 +9626,7 @@ function castToNewType(formData, newType) {
|
|
|
9508
9626
|
function FallbackField(props) {
|
|
9509
9627
|
const { id, formData, displayLabel = true, schema, name, uiSchema, required: required2, disabled = false, readonly: readonly2 = false, onBlur, onFocus, registry: registry2, fieldPathId, onChange, errorSchema } = props;
|
|
9510
9628
|
const { translateString, fields: fields2, globalFormOptions } = registry2;
|
|
9511
|
-
const [type, setType] =
|
|
9629
|
+
const [type, setType] = useState8(getTypeOfFormData(formData));
|
|
9512
9630
|
const uiOptions = getUiOptions(uiSchema);
|
|
9513
9631
|
const typeSelectorInnerFieldPathId = useDeepCompareMemo(toFieldPathId("__internal_type_selector", globalFormOptions, fieldPathId));
|
|
9514
9632
|
const schemaTitle = translateString(TranslatableString.Type);
|
|
@@ -9851,7 +9969,7 @@ function LayoutHeaderField(props) {
|
|
|
9851
9969
|
|
|
9852
9970
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/fields/LayoutMultiSchemaField.js
|
|
9853
9971
|
import { jsx as _jsx10 } from "react/jsx-runtime";
|
|
9854
|
-
import { useState as
|
|
9972
|
+
import { useState as useState9, useEffect as useEffect6 } from "react";
|
|
9855
9973
|
function getSelectedOption(options, selectorField, value) {
|
|
9856
9974
|
const defaultValue = "!@#!@$@#$!@$#";
|
|
9857
9975
|
const schemaOptions = options.map(({ schema }) => schema);
|
|
@@ -9878,7 +9996,7 @@ function computeEnumOptions(schema, options, schemaUtils, uiSchema, formData) {
|
|
|
9878
9996
|
function LayoutMultiSchemaField(props) {
|
|
9879
9997
|
const { name, baseType, disabled = false, formData, fieldPathId, onBlur, onChange, options, onFocus, registry: registry2, uiSchema, schema, autofocus, readonly: readonly2, required: required2, errorSchema, hideError = false } = props;
|
|
9880
9998
|
const { widgets: widgets2, schemaUtils, globalUiOptions } = registry2;
|
|
9881
|
-
const [enumOptions, setEnumOptions] =
|
|
9999
|
+
const [enumOptions, setEnumOptions] = useState9(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
|
|
9882
10000
|
const id = fieldPathId[ID_KEY];
|
|
9883
10001
|
const discriminator = getDiscriminatorFieldFromSchema(schema);
|
|
9884
10002
|
const FieldErrorTemplate2 = getTemplate("FieldErrorTemplate", registry2, options);
|
|
@@ -9887,7 +10005,7 @@ function LayoutMultiSchemaField(props) {
|
|
|
9887
10005
|
const optionsHash = hashObject(options);
|
|
9888
10006
|
const uiSchemaHash = uiSchema ? hashObject(uiSchema) : "";
|
|
9889
10007
|
const formDataHash = formData ? hashObject(formData) : "";
|
|
9890
|
-
|
|
10008
|
+
useEffect6(() => {
|
|
9891
10009
|
setEnumOptions(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
|
|
9892
10010
|
}, [schemaHash, optionsHash, schemaUtils, uiSchemaHash, formDataHash]);
|
|
9893
10011
|
const { widget = discriminator ? "radio" : "select", title = "", placeholder = "", optionsSchemaSelector: selectorField = discriminator, hideError: uiSchemaHideError, ...uiOptions } = getUiOptions(uiSchema);
|
|
@@ -9926,7 +10044,7 @@ function LayoutMultiSchemaField(props) {
|
|
|
9926
10044
|
|
|
9927
10045
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/fields/MultiSchemaField.js
|
|
9928
10046
|
import { jsx as _jsx11 } from "react/jsx-runtime";
|
|
9929
|
-
import { useCallback as
|
|
10047
|
+
import { useCallback as useCallback9, useEffect as useEffect7, useMemo as useMemo7, useRef as useRef7, useState as useState10 } from "react";
|
|
9930
10048
|
function AnyOfField(props) {
|
|
9931
10049
|
const { name, disabled = false, errorSchema, formData, fieldPathId, onBlur, onChange, onFocus, options, readonly: readonly2, registry: registry2, required: required2 = false, schema, uiSchema } = props;
|
|
9932
10050
|
const { schemaUtils } = registry2;
|
|
@@ -9936,14 +10054,14 @@ function AnyOfField(props) {
|
|
|
9936
10054
|
// oxlint-disable-next-line react-hooks/exhaustive-deps -- formDataHash is the value-stable proxy for formData
|
|
9937
10055
|
[options, schemaUtils, formDataHash]
|
|
9938
10056
|
);
|
|
9939
|
-
const [selectedOption, setSelectedOption] =
|
|
10057
|
+
const [selectedOption, setSelectedOption] = useState10(() => {
|
|
9940
10058
|
const discriminator = getDiscriminatorFieldFromSchema(schema);
|
|
9941
10059
|
return schemaUtils.getClosestMatchingOption(formData, retrievedOptions, 0, discriminator);
|
|
9942
10060
|
});
|
|
9943
|
-
const skipNextOptionRecalculation =
|
|
9944
|
-
const prevFormDataRef =
|
|
9945
|
-
const prevFieldIdRef =
|
|
9946
|
-
|
|
10061
|
+
const skipNextOptionRecalculation = useRef7(false);
|
|
10062
|
+
const prevFormDataRef = useRef7(formData);
|
|
10063
|
+
const prevFieldIdRef = useRef7(fieldPathId.$id);
|
|
10064
|
+
useEffect7(() => {
|
|
9947
10065
|
const prevFormData = prevFormDataRef.current;
|
|
9948
10066
|
const prevFieldId = prevFieldIdRef.current;
|
|
9949
10067
|
prevFormDataRef.current = formData;
|
|
@@ -9961,7 +10079,7 @@ function AnyOfField(props) {
|
|
|
9961
10079
|
}
|
|
9962
10080
|
});
|
|
9963
10081
|
const fieldId = `${fieldPathId.$id}${schema.oneOf ? "__oneof_select" : "__anyof_select"}`;
|
|
9964
|
-
const onOptionChange =
|
|
10082
|
+
const onOptionChange = useCallback9(
|
|
9965
10083
|
(option2) => {
|
|
9966
10084
|
if (disabled || readonly2) {
|
|
9967
10085
|
return;
|
|
@@ -10041,10 +10159,10 @@ function AnyOfField(props) {
|
|
|
10041
10159
|
var MultiSchemaField_default = AnyOfField;
|
|
10042
10160
|
|
|
10043
10161
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/fields/NullField.js
|
|
10044
|
-
import { useEffect as
|
|
10162
|
+
import { useEffect as useEffect8 } from "react";
|
|
10045
10163
|
function NullField(props) {
|
|
10046
10164
|
const { formData, onChange, fieldPathId } = props;
|
|
10047
|
-
|
|
10165
|
+
useEffect8(() => {
|
|
10048
10166
|
if (formData === void 0) {
|
|
10049
10167
|
onChange(null, fieldPathId.path);
|
|
10050
10168
|
}
|
|
@@ -10055,17 +10173,17 @@ var NullField_default = NullField;
|
|
|
10055
10173
|
|
|
10056
10174
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/fields/NumberField.js
|
|
10057
10175
|
import { jsx as _jsx12 } from "react/jsx-runtime";
|
|
10058
|
-
import { useState as
|
|
10176
|
+
import { useState as useState11, useCallback as useCallback10 } from "react";
|
|
10059
10177
|
var trailingCharMatcherWithPrefix = /\.([0-9]*0)*$/;
|
|
10060
10178
|
var trailingCharMatcher = /[0.]0*$/;
|
|
10061
10179
|
function NumberField(props) {
|
|
10062
10180
|
const { registry: registry2, onChange, formData, value: initialValue } = props;
|
|
10063
|
-
const [lastValue, setLastValue] =
|
|
10181
|
+
const [lastValue, setLastValue] = useState11(initialValue);
|
|
10064
10182
|
const { StringField: StringField2 } = registry2.fields;
|
|
10065
10183
|
const separator = getDecimalSeparator();
|
|
10066
10184
|
const escapedSeparator = separator === "." ? "\\." : separator;
|
|
10067
10185
|
let value = formData;
|
|
10068
|
-
const handleChange =
|
|
10186
|
+
const handleChange = useCallback10((newValue, path, errorSchema, id) => {
|
|
10069
10187
|
setLastValue(newValue);
|
|
10070
10188
|
const standardValue = typeof newValue === "string" ? newValue.replace(separator, ".") : newValue;
|
|
10071
10189
|
const normalizedValue = `${standardValue}`.startsWith(".") ? `0${standardValue}` : standardValue;
|
|
@@ -10095,7 +10213,7 @@ var NumberField_default = NumberField;
|
|
|
10095
10213
|
|
|
10096
10214
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/fields/ObjectField.js
|
|
10097
10215
|
import { jsx as _jsx13, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10098
|
-
import { memo as memo2, useCallback as
|
|
10216
|
+
import { memo as memo2, useCallback as useCallback11, useMemo as useMemo9, useRef as useRef9, useState as useState12 } from "react";
|
|
10099
10217
|
|
|
10100
10218
|
// ../../node_modules/.pnpm/markdown-to-jsx@9.10.2_react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/markdown-to-jsx/dist/react.js
|
|
10101
10219
|
import * as i0 from "react";
|
|
@@ -13230,28 +13348,28 @@ function getAdditionalPropertyOrder(schemaProperties) {
|
|
|
13230
13348
|
}
|
|
13231
13349
|
function ObjectFieldPropertyFn(props) {
|
|
13232
13350
|
const { fieldPathId, schema, registry: registry2, uiSchema, errorSchema, formData, onChange, onBlur, onFocus, disabled, readonly: readonly2, required: required2, hideError, propertyName, handleKeyRename, handleRemoveProperty, addedByAdditionalProperties } = props;
|
|
13233
|
-
const [wasPropertyKeyModified, setWasPropertyKeyModified] =
|
|
13351
|
+
const [wasPropertyKeyModified, setWasPropertyKeyModified] = useState12(false);
|
|
13234
13352
|
const { globalFormOptions, fields: fields2 } = registry2;
|
|
13235
13353
|
const { SchemaField: SchemaField2 } = fields2;
|
|
13236
13354
|
const innerFieldIdPathId = useDeepCompareMemo(toFieldPathId(propertyName, globalFormOptions, fieldPathId.path));
|
|
13237
|
-
const onPropertyChange =
|
|
13355
|
+
const onPropertyChange = useCallback11((value, path, newErrorSchema, id) => {
|
|
13238
13356
|
let normalizedValue = value;
|
|
13239
13357
|
if (value === void 0 && addedByAdditionalProperties && deepEquals_default(path, innerFieldIdPathId.path)) {
|
|
13240
13358
|
normalizedValue = "";
|
|
13241
13359
|
}
|
|
13242
13360
|
onChange(normalizedValue, path, newErrorSchema, id);
|
|
13243
13361
|
}, [onChange, addedByAdditionalProperties, innerFieldIdPathId]);
|
|
13244
|
-
const onKeyRename =
|
|
13362
|
+
const onKeyRename = useCallback11((value) => {
|
|
13245
13363
|
if (propertyName !== value) {
|
|
13246
13364
|
setWasPropertyKeyModified(true);
|
|
13247
13365
|
}
|
|
13248
13366
|
handleKeyRename(propertyName, value);
|
|
13249
13367
|
}, [propertyName, handleKeyRename]);
|
|
13250
|
-
const onKeyRenameBlur =
|
|
13368
|
+
const onKeyRenameBlur = useCallback11((event) => {
|
|
13251
13369
|
const { target: { value } } = event;
|
|
13252
13370
|
onKeyRename(value);
|
|
13253
13371
|
}, [onKeyRename]);
|
|
13254
|
-
const onRemoveProperty =
|
|
13372
|
+
const onRemoveProperty = useCallback11(() => {
|
|
13255
13373
|
handleRemoveProperty(propertyName);
|
|
13256
13374
|
}, [propertyName, handleRemoveProperty]);
|
|
13257
13375
|
return _jsx13(SchemaField2, { name: propertyName, required: required2, schema, uiSchema, errorSchema, fieldPathId: innerFieldIdPathId, formData, wasPropertyKeyModified, onKeyRename, onKeyRenameBlur, onRemoveProperty, onChange: onPropertyChange, onBlur, onFocus, registry: registry2, disabled, readonly: readonly2, hideError });
|
|
@@ -13261,14 +13379,14 @@ function ObjectField(props) {
|
|
|
13261
13379
|
const { schema: rawSchema, uiSchema = {}, formData, errorSchema, fieldPathId, name, required: required2 = false, disabled, readonly: readonly2, hideError, onBlur, onFocus, onChange, registry: registry2, title } = props;
|
|
13262
13380
|
const { fields: fields2, schemaUtils, translateString, globalUiOptions } = registry2;
|
|
13263
13381
|
const { OptionalDataControlsField: OptionalDataControlsField2 } = fields2;
|
|
13264
|
-
const formDataRef =
|
|
13382
|
+
const formDataRef = useRef9(formData);
|
|
13265
13383
|
formDataRef.current = formData;
|
|
13266
13384
|
const schema = useMemo9(() => schemaUtils.retrieveSchema(rawSchema, formData, true), [schemaUtils, rawSchema, formData]);
|
|
13267
13385
|
const uiOptions = useMemo9(() => getUiOptions(uiSchema, globalUiOptions), [uiSchema, globalUiOptions]);
|
|
13268
13386
|
const schemaProperties = useMemo9(() => schema.properties ?? {}, [schema.properties]);
|
|
13269
13387
|
const childFieldPathId = props.childFieldPathId ?? fieldPathId;
|
|
13270
|
-
const lastRenamedProperty =
|
|
13271
|
-
const [additionalPropertyOrder, setAdditionalPropertyOrder] =
|
|
13388
|
+
const lastRenamedProperty = useRef9({ previousKey: "", currentKey: void 0 });
|
|
13389
|
+
const [additionalPropertyOrder, setAdditionalPropertyOrder] = useState12(() => getAdditionalPropertyOrder(schemaProperties));
|
|
13272
13390
|
const definedPropertyOrder = useMemo9(() => {
|
|
13273
13391
|
const additionalPropertySet = new Set(getAdditionalPropertyOrder(schemaProperties));
|
|
13274
13392
|
return Object.keys(schemaProperties).filter((property) => !additionalPropertySet.has(property));
|
|
@@ -13278,7 +13396,7 @@ function ObjectField(props) {
|
|
|
13278
13396
|
const renderOptionalField = shouldRenderOptionalField(registry2, schema, required2, uiSchema);
|
|
13279
13397
|
const hasFormData = isFormDataAvailable(formData);
|
|
13280
13398
|
let orderedProperties = [];
|
|
13281
|
-
const getAvailableKey =
|
|
13399
|
+
const getAvailableKey = useCallback11((preferredKey, existingFormData) => {
|
|
13282
13400
|
const { duplicateKeySuffixSeparator = "-" } = getUiOptions(uiSchema, globalUiOptions);
|
|
13283
13401
|
let index = 0;
|
|
13284
13402
|
let newKey = preferredKey;
|
|
@@ -13288,7 +13406,7 @@ function ObjectField(props) {
|
|
|
13288
13406
|
}
|
|
13289
13407
|
return newKey;
|
|
13290
13408
|
}, [uiSchema, globalUiOptions]);
|
|
13291
|
-
const onAddProperty =
|
|
13409
|
+
const onAddProperty = useCallback11(() => {
|
|
13292
13410
|
if (!(schema.additionalProperties || schema.patternProperties)) {
|
|
13293
13411
|
return;
|
|
13294
13412
|
}
|
|
@@ -13325,7 +13443,7 @@ function ObjectField(props) {
|
|
|
13325
13443
|
setAdditionalPropertyOrder((order) => [...order, newKey]);
|
|
13326
13444
|
onChange(newFormData, childFieldPathId.path);
|
|
13327
13445
|
}, [formData, onChange, translateString, schemaUtils, childFieldPathId, getAvailableKey, schema]);
|
|
13328
|
-
const handleKeyRename =
|
|
13446
|
+
const handleKeyRename = useCallback11((oldKey, newKey) => {
|
|
13329
13447
|
if (oldKey !== newKey) {
|
|
13330
13448
|
const currentFormData = formDataRef.current;
|
|
13331
13449
|
const actualNewKey = getAvailableKey(newKey, currentFormData);
|
|
@@ -13347,11 +13465,11 @@ function ObjectField(props) {
|
|
|
13347
13465
|
onChange(renamedObj, childFieldPathId.path);
|
|
13348
13466
|
}
|
|
13349
13467
|
}, [onChange, childFieldPathId, getAvailableKey]);
|
|
13350
|
-
const handleRemoveProperty =
|
|
13468
|
+
const handleRemoveProperty = useCallback11((key) => {
|
|
13351
13469
|
setAdditionalPropertyOrder((order) => order.filter((property) => property !== key));
|
|
13352
13470
|
onChange(ADDITIONAL_PROPERTY_KEY_REMOVE, [...childFieldPathId.path, key]);
|
|
13353
13471
|
}, [onChange, childFieldPathId]);
|
|
13354
|
-
const getStableKey =
|
|
13472
|
+
const getStableKey = useCallback11((property) => {
|
|
13355
13473
|
if (lastRenamedProperty.current.currentKey === property) {
|
|
13356
13474
|
return lastRenamedProperty.current.previousKey;
|
|
13357
13475
|
}
|
|
@@ -13438,7 +13556,7 @@ function OptionalDataControlsField(props) {
|
|
|
13438
13556
|
|
|
13439
13557
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/fields/SchemaField.js
|
|
13440
13558
|
import { jsx as _jsx15, Fragment as _Fragment, jsxs as _jsxs2 } from "react/jsx-runtime";
|
|
13441
|
-
import { useCallback as
|
|
13559
|
+
import { useCallback as useCallback12, memo as memo3 } from "react";
|
|
13442
13560
|
var COMPONENT_TYPES = {
|
|
13443
13561
|
array: "ArrayField",
|
|
13444
13562
|
boolean: "BooleanField",
|
|
@@ -13474,7 +13592,7 @@ function SchemaFieldRender(props) {
|
|
|
13474
13592
|
const { schemaUtils, globalFormOptions, globalUiOptions, fields: fields2 } = registry2;
|
|
13475
13593
|
const { AnyOfField: _AnyOfField, OneOfField: _OneOfField, CyclicSchemaField: CyclicSchemaField2 } = fields2;
|
|
13476
13594
|
const fieldId = fieldPathId[ID_KEY];
|
|
13477
|
-
const handleFieldComponentChange =
|
|
13595
|
+
const handleFieldComponentChange = useCallback12((newFormData, path, newErrorSchema, id2) => {
|
|
13478
13596
|
const theId = id2 || fieldId;
|
|
13479
13597
|
return onChange(newFormData, path, newErrorSchema, theId);
|
|
13480
13598
|
}, [fieldId, onChange]);
|
|
@@ -13594,7 +13712,7 @@ var SchemaField_default = SchemaField;
|
|
|
13594
13712
|
|
|
13595
13713
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/fields/StringField.js
|
|
13596
13714
|
import { jsx as _jsx16 } from "react/jsx-runtime";
|
|
13597
|
-
import { useCallback as
|
|
13715
|
+
import { useCallback as useCallback13 } from "react";
|
|
13598
13716
|
function StringField(props) {
|
|
13599
13717
|
const { schema, name, uiSchema, fieldPathId, formData, required: required2, disabled = false, readonly: readonly2 = false, autofocus = false, onChange, onBlur, onFocus, registry: registry2, rawErrors, hideError, title } = props;
|
|
13600
13718
|
const { title: schemaTitle, format: format3 } = schema;
|
|
@@ -13608,7 +13726,7 @@ function StringField(props) {
|
|
|
13608
13726
|
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
|
|
13609
13727
|
const label = uiTitle ?? title ?? schemaTitle ?? name;
|
|
13610
13728
|
const Widget = getWidget(schema, widget, widgets2);
|
|
13611
|
-
const onWidgetChange =
|
|
13729
|
+
const onWidgetChange = useCallback13((value, errorSchema, id) => onChange(value, fieldPathId.path, errorSchema, id), [onChange, fieldPathId]);
|
|
13612
13730
|
return _jsx16(Widget, { options: { ...options, enumOptions }, schema, uiSchema, id: fieldPathId.$id, name, label, hideLabel: !displayLabel, hideError, value: formData, onChange: onWidgetChange, onBlur, onFocus, required: required2, disabled, readonly: readonly2, autofocus, registry: registry2, placeholder, rawErrors, htmlName: fieldPathId.name });
|
|
13613
13731
|
}
|
|
13614
13732
|
var StringField_default = StringField;
|
|
@@ -13702,7 +13820,7 @@ function ArrayFieldTitleTemplate(props) {
|
|
|
13702
13820
|
|
|
13703
13821
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/templates/BaseInputTemplate.js
|
|
13704
13822
|
import { jsx as _jsx23, Fragment as _Fragment3, jsxs as _jsxs6 } from "react/jsx-runtime";
|
|
13705
|
-
import { useCallback as
|
|
13823
|
+
import { useCallback as useCallback14 } from "react";
|
|
13706
13824
|
|
|
13707
13825
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/SchemaExamples.js
|
|
13708
13826
|
import { jsx as _jsx22 } from "react/jsx-runtime";
|
|
@@ -13757,10 +13875,10 @@ function BaseInputTemplate(props) {
|
|
|
13757
13875
|
} else {
|
|
13758
13876
|
inputValue = value == null ? "" : value;
|
|
13759
13877
|
}
|
|
13760
|
-
const handleChange =
|
|
13761
|
-
const handleBlur =
|
|
13762
|
-
const handleFocus =
|
|
13763
|
-
const handleClear =
|
|
13878
|
+
const handleChange = useCallback14(({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue), [onChange, options]);
|
|
13879
|
+
const handleBlur = useCallback14(({ target }) => onBlur(id, target?.value), [onBlur, id]);
|
|
13880
|
+
const handleFocus = useCallback14(({ target }) => onFocus(id, target?.value), [onFocus, id]);
|
|
13881
|
+
const handleClear = useCallback14((e2) => {
|
|
13764
13882
|
e2.preventDefault();
|
|
13765
13883
|
e2.stopPropagation();
|
|
13766
13884
|
onChange(options.emptyValue);
|
|
@@ -14089,13 +14207,13 @@ var AltDateWidget_default = AltDateWidget;
|
|
|
14089
14207
|
|
|
14090
14208
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/widgets/CheckboxesWidget.js
|
|
14091
14209
|
import { jsx as _jsx46, jsxs as _jsxs17 } from "react/jsx-runtime";
|
|
14092
|
-
import { useCallback as
|
|
14210
|
+
import { useCallback as useCallback15 } from "react";
|
|
14093
14211
|
function CheckboxesWidget({ id, disabled, options, value, autofocus = false, readonly: readonly2, onChange, onBlur, onFocus, htmlName }) {
|
|
14094
14212
|
const { inline = false, enumOptions, enumDisabled, emptyValue } = options;
|
|
14095
14213
|
const optionValueFormat = getOptionValueFormat(options);
|
|
14096
14214
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
14097
|
-
const handleBlur =
|
|
14098
|
-
const handleFocus =
|
|
14215
|
+
const handleBlur = useCallback15(({ target }) => onBlur(id, enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, emptyValue)), [onBlur, id, enumOptions, emptyValue, optionValueFormat]);
|
|
14216
|
+
const handleFocus = useCallback15(({ target }) => onFocus(id, enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, emptyValue)), [onFocus, id, enumOptions, emptyValue, optionValueFormat]);
|
|
14099
14217
|
return _jsx46("div", { className: "checkboxes", id, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
14100
14218
|
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
14101
14219
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
@@ -14115,13 +14233,13 @@ var CheckboxesWidget_default = CheckboxesWidget;
|
|
|
14115
14233
|
|
|
14116
14234
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/widgets/CheckboxWidget.js
|
|
14117
14235
|
import { jsx as _jsx47, jsxs as _jsxs18 } from "react/jsx-runtime";
|
|
14118
|
-
import { useCallback as
|
|
14236
|
+
import { useCallback as useCallback16 } from "react";
|
|
14119
14237
|
function CheckboxWidget({ schema, uiSchema, options, id, value, disabled, readonly: readonly2, label, hideLabel, autofocus = false, onBlur, onFocus, onChange, registry: registry2, htmlName, required: required2 }) {
|
|
14120
14238
|
const DescriptionFieldTemplate = getTemplate("DescriptionFieldTemplate", registry2, options);
|
|
14121
14239
|
const trueValueRequired = schemaRequiresTrueValue(schema) && required2;
|
|
14122
|
-
const handleChange =
|
|
14123
|
-
const handleBlur =
|
|
14124
|
-
const handleFocus =
|
|
14240
|
+
const handleChange = useCallback16((event) => onChange(event.target.checked), [onChange]);
|
|
14241
|
+
const handleBlur = useCallback16((event) => onBlur(id, event.target.checked), [onBlur, id]);
|
|
14242
|
+
const handleFocus = useCallback16((event) => onFocus(id, event.target.checked), [onFocus, id]);
|
|
14125
14243
|
const uiOptions = getUiOptions(uiSchema);
|
|
14126
14244
|
const isCheckboxWidget = uiOptions.widget === "checkbox";
|
|
14127
14245
|
const description = isCheckboxWidget ? void 0 : options.description ?? schema.description;
|
|
@@ -14147,11 +14265,11 @@ function DateTimeWidget(props) {
|
|
|
14147
14265
|
|
|
14148
14266
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/widgets/DateWidget.js
|
|
14149
14267
|
import { jsx as _jsx50 } from "react/jsx-runtime";
|
|
14150
|
-
import { useCallback as
|
|
14268
|
+
import { useCallback as useCallback17 } from "react";
|
|
14151
14269
|
function DateWidget(props) {
|
|
14152
14270
|
const { onChange, options, registry: registry2 } = props;
|
|
14153
14271
|
const BaseInputTemplate2 = getTemplate("BaseInputTemplate", registry2, options);
|
|
14154
|
-
const handleChange =
|
|
14272
|
+
const handleChange = useCallback17((value) => onChange(value || void 0), [onChange]);
|
|
14155
14273
|
return _jsx50(BaseInputTemplate2, { type: "date", ...props, onChange: handleChange });
|
|
14156
14274
|
}
|
|
14157
14275
|
|
|
@@ -14219,12 +14337,12 @@ function PasswordWidget(props) {
|
|
|
14219
14337
|
|
|
14220
14338
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/widgets/RadioWidget.js
|
|
14221
14339
|
import { jsx as _jsx55, jsxs as _jsxs20 } from "react/jsx-runtime";
|
|
14222
|
-
import { useCallback as
|
|
14340
|
+
import { useCallback as useCallback18 } from "react";
|
|
14223
14341
|
function RadioWidget({ options, value, required: required2, disabled, readonly: readonly2, autofocus = false, onBlur, onFocus, onChange, id, htmlName }) {
|
|
14224
14342
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
14225
14343
|
const optionValueFormat = getOptionValueFormat(options);
|
|
14226
|
-
const handleBlur =
|
|
14227
|
-
const handleFocus =
|
|
14344
|
+
const handleBlur = useCallback18(({ target }) => onBlur(id, enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, emptyValue)), [onBlur, enumOptions, emptyValue, id, optionValueFormat]);
|
|
14345
|
+
const handleFocus = useCallback18(({ target }) => onFocus(id, enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, emptyValue)), [onFocus, enumOptions, emptyValue, id, optionValueFormat]);
|
|
14228
14346
|
return _jsx55("div", { className: "field-radio-group", id, role: "radiogroup", children: Array.isArray(enumOptions) && enumOptions.map((option, i2) => {
|
|
14229
14347
|
const checked = enumOptionsIsSelected(option.value, value);
|
|
14230
14348
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
@@ -14245,23 +14363,23 @@ function RangeWidget(props) {
|
|
|
14245
14363
|
|
|
14246
14364
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/widgets/RatingWidget.js
|
|
14247
14365
|
import { jsx as _jsx57, jsxs as _jsxs22 } from "react/jsx-runtime";
|
|
14248
|
-
import { useCallback as
|
|
14366
|
+
import { useCallback as useCallback19 } from "react";
|
|
14249
14367
|
function RatingWidget({ id, value, required: required2, disabled, readonly: readonly2, onChange, onFocus, onBlur, schema, options, htmlName }) {
|
|
14250
14368
|
const { stars = 5, shape = "star" } = options;
|
|
14251
14369
|
const numStars = schema.maximum ? Math.min(schema.maximum, 5) : Math.min(Math.max(stars, 1), 5);
|
|
14252
14370
|
const min = schema.minimum || 0;
|
|
14253
|
-
const handleStarClick =
|
|
14371
|
+
const handleStarClick = useCallback19((starValue) => {
|
|
14254
14372
|
if (!disabled && !readonly2) {
|
|
14255
14373
|
onChange(starValue);
|
|
14256
14374
|
}
|
|
14257
14375
|
}, [onChange, disabled, readonly2]);
|
|
14258
|
-
const handleFocus =
|
|
14376
|
+
const handleFocus = useCallback19((event) => {
|
|
14259
14377
|
if (onFocus) {
|
|
14260
14378
|
const starValue = Number(event.target.dataset.value);
|
|
14261
14379
|
onFocus(id, starValue);
|
|
14262
14380
|
}
|
|
14263
14381
|
}, [onFocus, id]);
|
|
14264
|
-
const handleBlur =
|
|
14382
|
+
const handleBlur = useCallback19((event) => {
|
|
14265
14383
|
if (onBlur) {
|
|
14266
14384
|
const starValue = Number(event.target.dataset.value);
|
|
14267
14385
|
onBlur(id, starValue);
|
|
@@ -14291,7 +14409,7 @@ function RatingWidget({ id, value, required: required2, disabled, readonly: read
|
|
|
14291
14409
|
|
|
14292
14410
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/widgets/SelectWidget.js
|
|
14293
14411
|
import { jsx as _jsx58, jsxs as _jsxs23, Fragment as _Fragment5 } from "react/jsx-runtime";
|
|
14294
|
-
import { useCallback as
|
|
14412
|
+
import { useCallback as useCallback20 } from "react";
|
|
14295
14413
|
function getValue(event, multiple) {
|
|
14296
14414
|
if (multiple) {
|
|
14297
14415
|
return Array.from(event.target.options).slice().filter((o2) => o2.selected).map((o2) => o2.value);
|
|
@@ -14302,15 +14420,15 @@ function SelectWidget({ schema, id, options, value, required: required2, disable
|
|
|
14302
14420
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
14303
14421
|
const emptyValue = multiple ? [] : "";
|
|
14304
14422
|
const optionValueFormat = getOptionValueFormat(options);
|
|
14305
|
-
const handleFocus =
|
|
14423
|
+
const handleFocus = useCallback20((event) => {
|
|
14306
14424
|
const newValue = getValue(event, multiple);
|
|
14307
14425
|
return onFocus(id, enumOptionValueDecoder(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
14308
14426
|
}, [onFocus, id, multiple, enumOptions, optEmptyVal, optionValueFormat]);
|
|
14309
|
-
const handleBlur =
|
|
14427
|
+
const handleBlur = useCallback20((event) => {
|
|
14310
14428
|
const newValue = getValue(event, multiple);
|
|
14311
14429
|
return onBlur(id, enumOptionValueDecoder(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
14312
14430
|
}, [onBlur, id, multiple, enumOptions, optEmptyVal, optionValueFormat]);
|
|
14313
|
-
const handleChange =
|
|
14431
|
+
const handleChange = useCallback20((event) => {
|
|
14314
14432
|
const newValue = getValue(event, multiple);
|
|
14315
14433
|
return onChange(enumOptionValueDecoder(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
14316
14434
|
}, [onChange, multiple, enumOptions, optEmptyVal, optionValueFormat]);
|
|
@@ -14326,11 +14444,11 @@ var SelectWidget_default = SelectWidget;
|
|
|
14326
14444
|
|
|
14327
14445
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/widgets/TextareaWidget.js
|
|
14328
14446
|
import { jsx as _jsx59 } from "react/jsx-runtime";
|
|
14329
|
-
import { useCallback as
|
|
14447
|
+
import { useCallback as useCallback21 } from "react";
|
|
14330
14448
|
function TextareaWidget({ id, options, placeholder, value, required: required2, disabled, readonly: readonly2, autofocus = false, onChange, onBlur, onFocus, htmlName }) {
|
|
14331
|
-
const handleChange =
|
|
14332
|
-
const handleBlur =
|
|
14333
|
-
const handleFocus =
|
|
14449
|
+
const handleChange = useCallback21(({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue), [onChange, options.emptyValue]);
|
|
14450
|
+
const handleBlur = useCallback21(({ target }) => onBlur(id, target?.value), [onBlur, id]);
|
|
14451
|
+
const handleFocus = useCallback21(({ target }) => onFocus(id, target?.value), [id, onFocus]);
|
|
14334
14452
|
return _jsx59("textarea", { id, name: htmlName || id, className: "form-control", value: value || "", placeholder, required: required2, disabled, readOnly: readonly2, autoFocus: autofocus, rows: options.rows, onBlur: handleBlur, onFocus: handleFocus, onChange: handleChange, "aria-describedby": ariaDescribedByIds(id) });
|
|
14335
14453
|
}
|
|
14336
14454
|
var TextareaWidget_default = TextareaWidget;
|
|
@@ -14345,12 +14463,12 @@ function TextWidget(props) {
|
|
|
14345
14463
|
|
|
14346
14464
|
// ../../node_modules/.pnpm/@rjsf+core@6.10.0_@rjsf+utils@6.10.0_react@19.2.4__react@19.2.4_vue@3.5.40_typescript@5.9.3_/node_modules/@rjsf/core/lib/components/widgets/TimeWidget.js
|
|
14347
14465
|
import { jsx as _jsx61 } from "react/jsx-runtime";
|
|
14348
|
-
import { useCallback as
|
|
14466
|
+
import { useCallback as useCallback22 } from "react";
|
|
14349
14467
|
function TimeWidget(props) {
|
|
14350
14468
|
const { onChange, options, registry: registry2, schema, value } = props;
|
|
14351
14469
|
const BaseInputTemplate2 = getTemplate("BaseInputTemplate", registry2, options);
|
|
14352
14470
|
const hasSecondPrecision = typeof schema.multipleOf === "number" && Number.isFinite(schema.multipleOf) && schema.multipleOf < 60;
|
|
14353
|
-
const handleChange =
|
|
14471
|
+
const handleChange = useCallback22((newValue) => {
|
|
14354
14472
|
if (!newValue) {
|
|
14355
14473
|
onChange(void 0);
|
|
14356
14474
|
} else if (hasSecondPrecision) {
|
|
@@ -15223,7 +15341,7 @@ var Form = class _Form extends Component {
|
|
|
15223
15341
|
};
|
|
15224
15342
|
|
|
15225
15343
|
// src/components/SessionPluginConfigForm.tsx
|
|
15226
|
-
import { isValidElement, useMemo as useMemo10, useState as
|
|
15344
|
+
import { isValidElement, useMemo as useMemo10, useState as useState13 } from "react";
|
|
15227
15345
|
|
|
15228
15346
|
// src/components/plugin-config-schema.ts
|
|
15229
15347
|
function asSchema(value) {
|
|
@@ -15618,10 +15736,10 @@ function SessionPluginConfigForm({
|
|
|
15618
15736
|
onSubmit,
|
|
15619
15737
|
onCancel
|
|
15620
15738
|
}) {
|
|
15621
|
-
const [initial] =
|
|
15622
|
-
const [values, setValues] =
|
|
15623
|
-
const [removed] =
|
|
15624
|
-
const [draftFailure, setDraftFailure] =
|
|
15739
|
+
const [initial] = useState13(() => createConfigDraft(config2));
|
|
15740
|
+
const [values, setValues] = useState13(initial.values);
|
|
15741
|
+
const [removed] = useState13(() => /* @__PURE__ */ new Set());
|
|
15742
|
+
const [draftFailure, setDraftFailure] = useState13(null);
|
|
15625
15743
|
const support = useMemo10(() => formSupport(config2.schema), [config2.schema]);
|
|
15626
15744
|
const schema = useMemo10(() => {
|
|
15627
15745
|
try {
|
|
@@ -15731,7 +15849,7 @@ function SessionPluginConfigForm({
|
|
|
15731
15849
|
}
|
|
15732
15850
|
|
|
15733
15851
|
// src/components/SessionPluginIcon.tsx
|
|
15734
|
-
import { useEffect as
|
|
15852
|
+
import { useEffect as useEffect9, useState as useState14 } from "react";
|
|
15735
15853
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
15736
15854
|
function sessionPluginLabel(plugin) {
|
|
15737
15855
|
const display = typeof plugin.display_name === "string" ? plugin.display_name.trim() : "";
|
|
@@ -15757,9 +15875,9 @@ function iconBlob(client, sessionId, name, token) {
|
|
|
15757
15875
|
return pending;
|
|
15758
15876
|
}
|
|
15759
15877
|
function SessionPluginIcon({ client, sessionId, plugin, size = 20, shape = "rounded", className }) {
|
|
15760
|
-
const [url2, setUrl] =
|
|
15878
|
+
const [url2, setUrl] = useState14(null);
|
|
15761
15879
|
const token = plugin.icon;
|
|
15762
|
-
|
|
15880
|
+
useEffect9(() => {
|
|
15763
15881
|
setUrl(null);
|
|
15764
15882
|
if (!token) return;
|
|
15765
15883
|
let alive = true;
|
|
@@ -15828,17 +15946,17 @@ function ConfigDialogState({
|
|
|
15828
15946
|
onSaved,
|
|
15829
15947
|
onClose
|
|
15830
15948
|
}) {
|
|
15831
|
-
const [config2, setConfig] =
|
|
15832
|
-
const [loading, setLoading] =
|
|
15833
|
-
const [loadFailure, setLoadFailure] =
|
|
15834
|
-
const [saving, setSaving] =
|
|
15835
|
-
const [failure, setFailure] =
|
|
15836
|
-
const [fieldErrors, setFieldErrors] =
|
|
15837
|
-
const [formVersion, setFormVersion] =
|
|
15838
|
-
const alive =
|
|
15839
|
-
const generation =
|
|
15840
|
-
const dialog =
|
|
15841
|
-
|
|
15949
|
+
const [config2, setConfig] = useState15(null);
|
|
15950
|
+
const [loading, setLoading] = useState15(true);
|
|
15951
|
+
const [loadFailure, setLoadFailure] = useState15(null);
|
|
15952
|
+
const [saving, setSaving] = useState15(false);
|
|
15953
|
+
const [failure, setFailure] = useState15(null);
|
|
15954
|
+
const [fieldErrors, setFieldErrors] = useState15([]);
|
|
15955
|
+
const [formVersion, setFormVersion] = useState15(0);
|
|
15956
|
+
const alive = useRef10(true);
|
|
15957
|
+
const generation = useRef10(0);
|
|
15958
|
+
const dialog = useRef10(null);
|
|
15959
|
+
useEffect10(() => {
|
|
15842
15960
|
const element = dialog.current;
|
|
15843
15961
|
if (!element || element.open) return;
|
|
15844
15962
|
if (typeof element.showModal === "function") element.showModal();
|
|
@@ -15862,7 +15980,7 @@ function ConfigDialogState({
|
|
|
15862
15980
|
if (alive.current && generation.current === current) setLoading(false);
|
|
15863
15981
|
}
|
|
15864
15982
|
};
|
|
15865
|
-
|
|
15983
|
+
useEffect10(() => {
|
|
15866
15984
|
alive.current = true;
|
|
15867
15985
|
setConfig(null);
|
|
15868
15986
|
setFailure(null);
|
|
@@ -16117,7 +16235,7 @@ function PluginConnectorList({
|
|
|
16117
16235
|
}
|
|
16118
16236
|
|
|
16119
16237
|
// src/components/use-session-plugin-activation.ts
|
|
16120
|
-
import { useCallback as
|
|
16238
|
+
import { useCallback as useCallback23, useEffect as useEffect11, useMemo as useMemo11, useRef as useRef11, useState as useState16 } from "react";
|
|
16121
16239
|
|
|
16122
16240
|
// src/components/plugin-connector.ts
|
|
16123
16241
|
function catalogToConnectorItems(catalog) {
|
|
@@ -16178,24 +16296,24 @@ function useSessionPluginActivation({
|
|
|
16178
16296
|
sessionId,
|
|
16179
16297
|
onChange
|
|
16180
16298
|
}) {
|
|
16181
|
-
const [plugins, setPlugins] =
|
|
16182
|
-
const [catalog, setCatalog] =
|
|
16183
|
-
const [loading, setLoading] =
|
|
16184
|
-
const [listError, setListError] =
|
|
16185
|
-
const [mutationError, setMutationError] =
|
|
16186
|
-
const [inFlight, setInFlight] =
|
|
16187
|
-
const [configuring, setConfiguring] =
|
|
16188
|
-
const alive =
|
|
16189
|
-
const generation =
|
|
16190
|
-
const mutationGenerations =
|
|
16191
|
-
const desiredActivations =
|
|
16192
|
-
const pendingMutations =
|
|
16193
|
-
const submittedActivations =
|
|
16194
|
-
const serverActive =
|
|
16195
|
-
const lifetime =
|
|
16196
|
-
const request =
|
|
16197
|
-
const [desiredVersion, setDesiredVersion] =
|
|
16198
|
-
const setDesired =
|
|
16299
|
+
const [plugins, setPlugins] = useState16([]);
|
|
16300
|
+
const [catalog, setCatalog] = useState16(null);
|
|
16301
|
+
const [loading, setLoading] = useState16(false);
|
|
16302
|
+
const [listError, setListError] = useState16(false);
|
|
16303
|
+
const [mutationError, setMutationError] = useState16(false);
|
|
16304
|
+
const [inFlight, setInFlight] = useState16({});
|
|
16305
|
+
const [configuring, setConfiguring] = useState16(null);
|
|
16306
|
+
const alive = useRef11(true);
|
|
16307
|
+
const generation = useRef11(0);
|
|
16308
|
+
const mutationGenerations = useRef11(/* @__PURE__ */ new Map());
|
|
16309
|
+
const desiredActivations = useRef11(/* @__PURE__ */ new Map());
|
|
16310
|
+
const pendingMutations = useRef11(/* @__PURE__ */ new Map());
|
|
16311
|
+
const submittedActivations = useRef11(/* @__PURE__ */ new Set());
|
|
16312
|
+
const serverActive = useRef11(/* @__PURE__ */ new Set());
|
|
16313
|
+
const lifetime = useRef11(0);
|
|
16314
|
+
const request = useRef11(null);
|
|
16315
|
+
const [desiredVersion, setDesiredVersion] = useState16(0);
|
|
16316
|
+
const setDesired = useCallback23((name, value) => {
|
|
16199
16317
|
if (value === null) {
|
|
16200
16318
|
if (!desiredActivations.current.delete(name)) return;
|
|
16201
16319
|
} else {
|
|
@@ -16215,7 +16333,7 @@ function useSessionPluginActivation({
|
|
|
16215
16333
|
return desired === void 0 ? item : { ...item, active: desired };
|
|
16216
16334
|
});
|
|
16217
16335
|
}, [catalog, configuring, desiredVersion, plugins]);
|
|
16218
|
-
const markInFlight =
|
|
16336
|
+
const markInFlight = useCallback23((name, on) => {
|
|
16219
16337
|
setInFlight((current) => {
|
|
16220
16338
|
if (on) return current[name] ? current : { ...current, [name]: true };
|
|
16221
16339
|
if (!current[name]) return current;
|
|
@@ -16224,7 +16342,7 @@ function useSessionPluginActivation({
|
|
|
16224
16342
|
return rest;
|
|
16225
16343
|
});
|
|
16226
16344
|
}, []);
|
|
16227
|
-
|
|
16345
|
+
useEffect11(() => {
|
|
16228
16346
|
alive.current = true;
|
|
16229
16347
|
setPlugins([]);
|
|
16230
16348
|
setCatalog(null);
|
|
@@ -16244,7 +16362,7 @@ function useSessionPluginActivation({
|
|
|
16244
16362
|
request.current?.abort();
|
|
16245
16363
|
};
|
|
16246
16364
|
}, [client]);
|
|
16247
|
-
const load =
|
|
16365
|
+
const load = useCallback23(async () => {
|
|
16248
16366
|
if (!alive.current) return;
|
|
16249
16367
|
request.current?.abort();
|
|
16250
16368
|
const controller = new AbortController();
|
|
@@ -16280,30 +16398,30 @@ function useSessionPluginActivation({
|
|
|
16280
16398
|
if (alive.current && current === generation.current) setLoading(false);
|
|
16281
16399
|
}
|
|
16282
16400
|
}, [client, sessionId]);
|
|
16283
|
-
const loadCatalog =
|
|
16401
|
+
const loadCatalog = useCallback23(async () => {
|
|
16284
16402
|
try {
|
|
16285
16403
|
const { plugins: entries } = await client.plugins.catalog();
|
|
16286
16404
|
if (alive.current) setCatalog(entries);
|
|
16287
16405
|
} catch {
|
|
16288
16406
|
}
|
|
16289
16407
|
}, [client]);
|
|
16290
|
-
const reload =
|
|
16408
|
+
const reload = useCallback23(() => {
|
|
16291
16409
|
void load();
|
|
16292
16410
|
void loadCatalog();
|
|
16293
16411
|
}, [load, loadCatalog]);
|
|
16294
|
-
const abandon =
|
|
16412
|
+
const abandon = useCallback23((name) => {
|
|
16295
16413
|
setDesired(name, null);
|
|
16296
16414
|
pendingMutations.current.delete(name);
|
|
16297
16415
|
mutationGenerations.current.set(name, (mutationGenerations.current.get(name) ?? 0) + 1);
|
|
16298
16416
|
markInFlight(name, false);
|
|
16299
16417
|
void load();
|
|
16300
16418
|
}, [load, markInFlight, setDesired]);
|
|
16301
|
-
const finish =
|
|
16419
|
+
const finish = useCallback23((name, mutation) => {
|
|
16302
16420
|
pendingMutations.current.delete(name);
|
|
16303
16421
|
setDesired(name, null);
|
|
16304
16422
|
if (mutation === mutationGenerations.current.get(name)) markInFlight(name, false);
|
|
16305
16423
|
}, [markInFlight, setDesired]);
|
|
16306
|
-
const commitActivation =
|
|
16424
|
+
const commitActivation = useCallback23(
|
|
16307
16425
|
async (name, active, mutation, startedAt) => {
|
|
16308
16426
|
submittedActivations.current.add(name);
|
|
16309
16427
|
try {
|
|
@@ -16342,7 +16460,7 @@ function useSessionPluginActivation({
|
|
|
16342
16460
|
},
|
|
16343
16461
|
[client, finish, load, markInFlight, onChange, sessionId, setDesired]
|
|
16344
16462
|
);
|
|
16345
|
-
const enable =
|
|
16463
|
+
const enable = useCallback23(async (name) => {
|
|
16346
16464
|
if (!alive.current) return;
|
|
16347
16465
|
const startedAt = lifetime.current;
|
|
16348
16466
|
const mutation = (mutationGenerations.current.get(name) ?? 0) + 1;
|
|
@@ -16379,7 +16497,7 @@ function useSessionPluginActivation({
|
|
|
16379
16497
|
setPlugins((current) => current.map((item) => item.name === name ? { ...item, config: state.state } : item));
|
|
16380
16498
|
await commitActivation(name, true, mutation, startedAt);
|
|
16381
16499
|
}, [abandon, client, commitActivation, markInFlight, sessionId, setDesired]);
|
|
16382
|
-
const disable =
|
|
16500
|
+
const disable = useCallback23((name) => {
|
|
16383
16501
|
const startedAt = lifetime.current;
|
|
16384
16502
|
request.current?.abort();
|
|
16385
16503
|
generation.current++;
|
|
@@ -16396,17 +16514,17 @@ function useSessionPluginActivation({
|
|
|
16396
16514
|
markInFlight(name, true);
|
|
16397
16515
|
void commitActivation(name, false, mutation, startedAt);
|
|
16398
16516
|
}, [abandon, commitActivation, markInFlight, setDesired]);
|
|
16399
|
-
const toggle =
|
|
16517
|
+
const toggle = useCallback23((item, next) => {
|
|
16400
16518
|
if (next) void enable(item.name);
|
|
16401
16519
|
else disable(item.name);
|
|
16402
16520
|
}, [disable, enable]);
|
|
16403
|
-
const retry =
|
|
16521
|
+
const retry = useCallback23((item) => {
|
|
16404
16522
|
void enable(item.name);
|
|
16405
16523
|
}, [enable]);
|
|
16406
|
-
const editConfig =
|
|
16524
|
+
const editConfig = useCallback23((item) => {
|
|
16407
16525
|
setConfiguring({ name: item.name, pendingActivation: false });
|
|
16408
16526
|
}, []);
|
|
16409
|
-
const onConfigSaved =
|
|
16527
|
+
const onConfigSaved = useCallback23((state) => {
|
|
16410
16528
|
const target = configuring;
|
|
16411
16529
|
if (!target) return;
|
|
16412
16530
|
setConfiguring(null);
|
|
@@ -16423,7 +16541,7 @@ function useSessionPluginActivation({
|
|
|
16423
16541
|
markInFlight(target.name, true);
|
|
16424
16542
|
void commitActivation(target.name, true, mutation, startedAt);
|
|
16425
16543
|
}, [commitActivation, configuring, load, markInFlight, setDesired]);
|
|
16426
|
-
const onConfigClose =
|
|
16544
|
+
const onConfigClose = useCallback23(() => {
|
|
16427
16545
|
const target = configuring;
|
|
16428
16546
|
if (!target) return;
|
|
16429
16547
|
setConfiguring(null);
|
|
@@ -16453,7 +16571,7 @@ function SessionPluginSelector(props) {
|
|
|
16453
16571
|
return /* @__PURE__ */ jsx6(PluginSelectorState, { ...props }, props.sessionId);
|
|
16454
16572
|
}
|
|
16455
16573
|
function PluginSelectorState({ client, sessionId, className, side = "bottom", onChange }) {
|
|
16456
|
-
const [open2, setOpen] =
|
|
16574
|
+
const [open2, setOpen] = useState17(false);
|
|
16457
16575
|
return /* @__PURE__ */ jsxs4("div", { className: `relative text-xs ${className ?? ""}`, children: [
|
|
16458
16576
|
/* @__PURE__ */ jsx6(
|
|
16459
16577
|
"button",
|
|
@@ -16477,7 +16595,7 @@ function PluginSelectorList({
|
|
|
16477
16595
|
}) {
|
|
16478
16596
|
const controller = useSessionPluginActivation({ client, sessionId, onChange });
|
|
16479
16597
|
const { reload } = controller;
|
|
16480
|
-
|
|
16598
|
+
useEffect12(() => {
|
|
16481
16599
|
reload();
|
|
16482
16600
|
}, [reload]);
|
|
16483
16601
|
return /* @__PURE__ */ jsxs4(
|
|
@@ -16517,7 +16635,7 @@ import {
|
|
|
16517
16635
|
queuePauseReasonLabel,
|
|
16518
16636
|
queuedMessageStatusLabel
|
|
16519
16637
|
} from "@blade-hq/agent-client";
|
|
16520
|
-
import { useRef as
|
|
16638
|
+
import { useRef as useRef12, useState as useState18 } from "react";
|
|
16521
16639
|
|
|
16522
16640
|
// src/lib/utils.ts
|
|
16523
16641
|
function cn(...inputs) {
|
|
@@ -16565,14 +16683,14 @@ function SessionQueuePanel({
|
|
|
16565
16683
|
onReorder,
|
|
16566
16684
|
onDeliver
|
|
16567
16685
|
}) {
|
|
16568
|
-
const [collapsed, setCollapsed] =
|
|
16569
|
-
const [editing, setEditing] =
|
|
16570
|
-
const [draggingId, setDraggingId] =
|
|
16571
|
-
const [dropAt, setDropAt] =
|
|
16572
|
-
const draggingRef =
|
|
16573
|
-
const dropRef =
|
|
16574
|
-
const requeuePending =
|
|
16575
|
-
const [requeueing, setRequeueing] =
|
|
16686
|
+
const [collapsed, setCollapsed] = useState18(false);
|
|
16687
|
+
const [editing, setEditing] = useState18(null);
|
|
16688
|
+
const [draggingId, setDraggingId] = useState18(null);
|
|
16689
|
+
const [dropAt, setDropAt] = useState18(null);
|
|
16690
|
+
const draggingRef = useRef12(null);
|
|
16691
|
+
const dropRef = useRef12(null);
|
|
16692
|
+
const requeuePending = useRef12(false);
|
|
16693
|
+
const [requeueing, setRequeueing] = useState18(false);
|
|
16576
16694
|
const items = snapshot.items;
|
|
16577
16695
|
if (items.length === 0 && !snapshot.paused && !notice && !editing) return null;
|
|
16578
16696
|
const pendingIds = items.filter(canEditQueuedMessage).map((item) => item.id);
|
|
@@ -16982,7 +17100,7 @@ function ReplayMismatchPrompt({ mismatch, className }) {
|
|
|
16982
17100
|
}
|
|
16983
17101
|
|
|
16984
17102
|
// src/components/PlanUpdateBlock.tsx
|
|
16985
|
-
import { useEffect as
|
|
17103
|
+
import { useEffect as useEffect13, useRef as useRef13, useState as useState19 } from "react";
|
|
16986
17104
|
|
|
16987
17105
|
// src/components/display-utils.ts
|
|
16988
17106
|
var TOOL_NAME_ALIASES = {
|
|
@@ -17195,10 +17313,10 @@ function PlanUpdateBlock({
|
|
|
17195
17313
|
}) {
|
|
17196
17314
|
const updateKey = `${toolCall.id}:${toolCall.arguments}`;
|
|
17197
17315
|
const revealKey = autoReveal ? updateKey : null;
|
|
17198
|
-
const [collapsed, setCollapsed] =
|
|
17199
|
-
const collapseTimerRef =
|
|
17316
|
+
const [collapsed, setCollapsed] = useState19(!autoReveal);
|
|
17317
|
+
const collapseTimerRef = useRef13(null);
|
|
17200
17318
|
const data = parsePlanUpdate(toolCall.arguments);
|
|
17201
|
-
|
|
17319
|
+
useEffect13(() => {
|
|
17202
17320
|
if (!revealKey) return;
|
|
17203
17321
|
if (collapseTimerRef.current) clearTimeout(collapseTimerRef.current);
|
|
17204
17322
|
setCollapsed(false);
|
|
@@ -17207,7 +17325,7 @@ function PlanUpdateBlock({
|
|
|
17207
17325
|
collapseTimerRef.current = null;
|
|
17208
17326
|
}, PLAN_AUTO_COLLAPSE_MS);
|
|
17209
17327
|
}, [revealKey]);
|
|
17210
|
-
|
|
17328
|
+
useEffect13(
|
|
17211
17329
|
() => () => {
|
|
17212
17330
|
if (collapseTimerRef.current) clearTimeout(collapseTimerRef.current);
|
|
17213
17331
|
},
|
|
@@ -17295,9 +17413,9 @@ function CurrentPlanPanel({
|
|
|
17295
17413
|
className
|
|
17296
17414
|
}) {
|
|
17297
17415
|
const { current, updating } = getPlanUpdateDisplayState(messages);
|
|
17298
|
-
const revealBaselinesRef =
|
|
17416
|
+
const revealBaselinesRef = useRef13(/* @__PURE__ */ new Map([[sessionId, revealRevision]]));
|
|
17299
17417
|
const autoReveal = (revealBaselinesRef.current.get(sessionId) ?? 0) !== revealRevision;
|
|
17300
|
-
|
|
17418
|
+
useEffect13(() => {
|
|
17301
17419
|
if (!current) return;
|
|
17302
17420
|
revealBaselinesRef.current.set(sessionId, revealRevision);
|
|
17303
17421
|
}, [current, revealRevision, sessionId]);
|
|
@@ -17321,7 +17439,7 @@ function CurrentPlanPanel({
|
|
|
17321
17439
|
|
|
17322
17440
|
// src/components/ChatSurface.tsx
|
|
17323
17441
|
import { chatErrorForDisplay as chatErrorForDisplay2 } from "@blade-hq/agent-client";
|
|
17324
|
-
import { useState as
|
|
17442
|
+
import { useState as useState31 } from "react";
|
|
17325
17443
|
|
|
17326
17444
|
// src/lib/random-id.ts
|
|
17327
17445
|
function randomId() {
|
|
@@ -42189,7 +42307,7 @@ function SF(G, Q2) {
|
|
|
42189
42307
|
}
|
|
42190
42308
|
|
|
42191
42309
|
// src/components/McpAppCard.tsx
|
|
42192
|
-
import { createContext as createContext3, useContext as useContext3, useEffect as
|
|
42310
|
+
import { createContext as createContext3, useContext as useContext3, useEffect as useEffect14, useLayoutEffect, useRef as useRef14, useState as useState20 } from "react";
|
|
42193
42311
|
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
42194
42312
|
var McpAppMessageContext = createContext3(null);
|
|
42195
42313
|
function securedHtml(archive) {
|
|
@@ -42231,17 +42349,17 @@ function McpAppCard({ sessionId, sourceId, client: suppliedClient, onMessage: su
|
|
|
42231
42349
|
const contextMessage = useContext3(McpAppMessageContext);
|
|
42232
42350
|
const client = suppliedClient ?? contextClient;
|
|
42233
42351
|
const onMessage = suppliedOnMessage ?? contextMessage;
|
|
42234
|
-
const onMessageRef =
|
|
42352
|
+
const onMessageRef = useRef14(onMessage);
|
|
42235
42353
|
onMessageRef.current = onMessage;
|
|
42236
|
-
const frame =
|
|
42237
|
-
const panel =
|
|
42238
|
-
const bridgeRef =
|
|
42239
|
-
const [html, setHtml] =
|
|
42240
|
-
const [title, setTitle] =
|
|
42241
|
-
const [error61, setError] =
|
|
42242
|
-
const [ready, setReady] =
|
|
42243
|
-
const [expanded, setExpanded] =
|
|
42244
|
-
const [height, setHeight] =
|
|
42354
|
+
const frame = useRef14(null);
|
|
42355
|
+
const panel = useRef14(null);
|
|
42356
|
+
const bridgeRef = useRef14(null);
|
|
42357
|
+
const [html, setHtml] = useState20();
|
|
42358
|
+
const [title, setTitle] = useState20("\u5DE5\u5177\u754C\u9762");
|
|
42359
|
+
const [error61, setError] = useState20(null);
|
|
42360
|
+
const [ready, setReady] = useState20(false);
|
|
42361
|
+
const [expanded, setExpanded] = useState20(false);
|
|
42362
|
+
const [height, setHeight] = useState20(360);
|
|
42245
42363
|
useLayoutEffect(() => {
|
|
42246
42364
|
const dialog = panel.current;
|
|
42247
42365
|
if (!dialog) return;
|
|
@@ -42249,7 +42367,7 @@ function McpAppCard({ sessionId, sourceId, client: suppliedClient, onMessage: su
|
|
|
42249
42367
|
if (expanded) dialog.showModal();
|
|
42250
42368
|
else dialog.show();
|
|
42251
42369
|
}, [expanded]);
|
|
42252
|
-
|
|
42370
|
+
useEffect14(() => {
|
|
42253
42371
|
const controller = new AbortController();
|
|
42254
42372
|
let bridge;
|
|
42255
42373
|
let disposed = false;
|
|
@@ -42447,7 +42565,7 @@ function McpAppCard({ sessionId, sourceId, client: suppliedClient, onMessage: su
|
|
|
42447
42565
|
}
|
|
42448
42566
|
|
|
42449
42567
|
// src/components/ChatInput.tsx
|
|
42450
|
-
import { useRef as
|
|
42568
|
+
import { useRef as useRef15, useState as useState21 } from "react";
|
|
42451
42569
|
import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
42452
42570
|
function isImeCompositionKey(event) {
|
|
42453
42571
|
return event.isComposing || event.keyCode === 229;
|
|
@@ -42469,10 +42587,10 @@ function ChatInput({
|
|
|
42469
42587
|
hasAttachments = false
|
|
42470
42588
|
}) {
|
|
42471
42589
|
const trimmed = value.trim();
|
|
42472
|
-
const latestValue =
|
|
42590
|
+
const latestValue = useRef15(value);
|
|
42473
42591
|
latestValue.current = value;
|
|
42474
|
-
const sending =
|
|
42475
|
-
const [isSending2, setIsSending] =
|
|
42592
|
+
const sending = useRef15(false);
|
|
42593
|
+
const [isSending2, setIsSending] = useState21(false);
|
|
42476
42594
|
void queueKey;
|
|
42477
42595
|
const canSend = !isSending2 && (trimmed.length > 0 || hasAttachments) && (!isStreaming || queueWhileRunning && !hasAttachments && !isStopping);
|
|
42478
42596
|
const handleSend = async () => {
|
|
@@ -42537,16 +42655,16 @@ function ChatInput({
|
|
|
42537
42655
|
}
|
|
42538
42656
|
|
|
42539
42657
|
// src/components/ConnectionBanner.tsx
|
|
42540
|
-
import { useEffect as
|
|
42658
|
+
import { useEffect as useEffect15, useRef as useRef16, useState as useState22 } from "react";
|
|
42541
42659
|
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
42542
42660
|
var CONNECTION_NOTICE_DELAY_MS = 3e3;
|
|
42543
42661
|
var CONNECTION_ERROR_DELAY_MS = 15e3;
|
|
42544
42662
|
function useConnectionNoticePhase(connected) {
|
|
42545
|
-
const [phase, setPhase] =
|
|
42546
|
-
const connectedRef =
|
|
42547
|
-
const timersRef =
|
|
42663
|
+
const [phase, setPhase] = useState22("hidden");
|
|
42664
|
+
const connectedRef = useRef16(connected);
|
|
42665
|
+
const timersRef = useRef16([]);
|
|
42548
42666
|
connectedRef.current = connected;
|
|
42549
|
-
|
|
42667
|
+
useEffect15(() => {
|
|
42550
42668
|
const clearTimers = () => {
|
|
42551
42669
|
for (const timer of timersRef.current) clearTimeout(timer);
|
|
42552
42670
|
timersRef.current = [];
|
|
@@ -42586,7 +42704,7 @@ function useConnectionNoticePhase(connected) {
|
|
|
42586
42704
|
return phase;
|
|
42587
42705
|
}
|
|
42588
42706
|
function ConnectionBanner({ connection, className }) {
|
|
42589
|
-
const hasConnectedRef =
|
|
42707
|
+
const hasConnectedRef = useRef16(connection === "connected" || connection === "reconnecting");
|
|
42590
42708
|
if (connection === "connected") hasConnectedRef.current = true;
|
|
42591
42709
|
const connected = connection === "connected";
|
|
42592
42710
|
const phase = useConnectionNoticePhase(connected);
|
|
@@ -42613,10 +42731,10 @@ function ConnectionBanner({ connection, className }) {
|
|
|
42613
42731
|
|
|
42614
42732
|
// src/components/MessageList.tsx
|
|
42615
42733
|
import { isHiddenInternalMessage } from "@blade-hq/agent-client";
|
|
42616
|
-
import { useCallback as
|
|
42734
|
+
import { useCallback as useCallback27, useEffect as useEffect21, useMemo as useMemo16, useRef as useRef23, useState as useState30 } from "react";
|
|
42617
42735
|
|
|
42618
42736
|
// ../../node_modules/.pnpm/use-stick-to-bottom@1.1.3_react@19.2.4/node_modules/use-stick-to-bottom/dist/useStickToBottom.js
|
|
42619
|
-
import { useCallback as
|
|
42737
|
+
import { useCallback as useCallback24, useMemo as useMemo12, useRef as useRef17, useState as useState23 } from "react";
|
|
42620
42738
|
var DEFAULT_SPRING_ANIMATION = {
|
|
42621
42739
|
/**
|
|
42622
42740
|
* A value from 0 to 1, on how much to damp the animation.
|
|
@@ -42653,12 +42771,12 @@ globalThis.document?.addEventListener("click", () => {
|
|
|
42653
42771
|
mouseDown = false;
|
|
42654
42772
|
});
|
|
42655
42773
|
var useStickToBottom = (options = {}) => {
|
|
42656
|
-
const [escapedFromLock, updateEscapedFromLock] =
|
|
42657
|
-
const [isAtBottom, updateIsAtBottom] =
|
|
42658
|
-
const [isNearBottom, setIsNearBottom] =
|
|
42659
|
-
const optionsRef =
|
|
42774
|
+
const [escapedFromLock, updateEscapedFromLock] = useState23(false);
|
|
42775
|
+
const [isAtBottom, updateIsAtBottom] = useState23(options.initial !== false);
|
|
42776
|
+
const [isNearBottom, setIsNearBottom] = useState23(false);
|
|
42777
|
+
const optionsRef = useRef17(null);
|
|
42660
42778
|
optionsRef.current = options;
|
|
42661
|
-
const isSelecting =
|
|
42779
|
+
const isSelecting = useCallback24(() => {
|
|
42662
42780
|
if (!mouseDown) {
|
|
42663
42781
|
return false;
|
|
42664
42782
|
}
|
|
@@ -42669,11 +42787,11 @@ var useStickToBottom = (options = {}) => {
|
|
|
42669
42787
|
const range = selection.getRangeAt(0);
|
|
42670
42788
|
return range.commonAncestorContainer.contains(scrollRef.current) || scrollRef.current?.contains(range.commonAncestorContainer);
|
|
42671
42789
|
}, []);
|
|
42672
|
-
const setIsAtBottom =
|
|
42790
|
+
const setIsAtBottom = useCallback24((isAtBottom2) => {
|
|
42673
42791
|
state.isAtBottom = isAtBottom2;
|
|
42674
42792
|
updateIsAtBottom(isAtBottom2);
|
|
42675
42793
|
}, []);
|
|
42676
|
-
const setEscapedFromLock =
|
|
42794
|
+
const setEscapedFromLock = useCallback24((escapedFromLock2) => {
|
|
42677
42795
|
state.escapedFromLock = escapedFromLock2;
|
|
42678
42796
|
updateEscapedFromLock(escapedFromLock2);
|
|
42679
42797
|
}, []);
|
|
@@ -42730,7 +42848,7 @@ var useStickToBottom = (options = {}) => {
|
|
|
42730
42848
|
}
|
|
42731
42849
|
};
|
|
42732
42850
|
}, []);
|
|
42733
|
-
const scrollToBottom =
|
|
42851
|
+
const scrollToBottom = useCallback24((scrollOptions = {}) => {
|
|
42734
42852
|
if (typeof scrollOptions === "string") {
|
|
42735
42853
|
scrollOptions = { animation: scrollOptions };
|
|
42736
42854
|
}
|
|
@@ -42815,11 +42933,11 @@ var useStickToBottom = (options = {}) => {
|
|
|
42815
42933
|
}
|
|
42816
42934
|
return next();
|
|
42817
42935
|
}, [setIsAtBottom, isSelecting, state]);
|
|
42818
|
-
const stopScroll =
|
|
42936
|
+
const stopScroll = useCallback24(() => {
|
|
42819
42937
|
setEscapedFromLock(true);
|
|
42820
42938
|
setIsAtBottom(false);
|
|
42821
42939
|
}, [setEscapedFromLock, setIsAtBottom]);
|
|
42822
|
-
const handleScroll =
|
|
42940
|
+
const handleScroll = useCallback24(({ target }) => {
|
|
42823
42941
|
if (target !== scrollRef.current) {
|
|
42824
42942
|
return;
|
|
42825
42943
|
}
|
|
@@ -42858,7 +42976,7 @@ var useStickToBottom = (options = {}) => {
|
|
|
42858
42976
|
}
|
|
42859
42977
|
}, 1);
|
|
42860
42978
|
}, [setEscapedFromLock, setIsAtBottom, isSelecting, state]);
|
|
42861
|
-
const handleWheel =
|
|
42979
|
+
const handleWheel = useCallback24(({ target, deltaY }) => {
|
|
42862
42980
|
let element = target;
|
|
42863
42981
|
while (!["scroll", "auto"].includes(getComputedStyle(element).overflow)) {
|
|
42864
42982
|
if (!element.parentElement) {
|
|
@@ -42928,7 +43046,7 @@ var useStickToBottom = (options = {}) => {
|
|
|
42928
43046
|
};
|
|
42929
43047
|
};
|
|
42930
43048
|
function useRefCallback(callback, deps) {
|
|
42931
|
-
const result =
|
|
43049
|
+
const result = useCallback24((ref) => {
|
|
42932
43050
|
result.current = ref;
|
|
42933
43051
|
return callback(ref);
|
|
42934
43052
|
}, deps);
|
|
@@ -42960,11 +43078,11 @@ function mergeAnimations(...animations) {
|
|
|
42960
43078
|
|
|
42961
43079
|
// ../../node_modules/.pnpm/use-stick-to-bottom@1.1.3_react@19.2.4/node_modules/use-stick-to-bottom/dist/StickToBottom.js
|
|
42962
43080
|
import * as React from "react";
|
|
42963
|
-
import { createContext as createContext4, useContext as useContext4, useEffect as
|
|
43081
|
+
import { createContext as createContext4, useContext as useContext4, useEffect as useEffect16, useImperativeHandle, useLayoutEffect as useLayoutEffect2, useMemo as useMemo13, useRef as useRef18 } from "react";
|
|
42964
43082
|
var StickToBottomContext = createContext4(null);
|
|
42965
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect2 :
|
|
43083
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect2 : useEffect16;
|
|
42966
43084
|
function StickToBottom({ instance, children, resize, initial, mass, damping, stiffness, targetScrollTop: currentTargetScrollTop, contextRef, ...props }) {
|
|
42967
|
-
const customTargetScrollTop =
|
|
43085
|
+
const customTargetScrollTop = useRef18(null);
|
|
42968
43086
|
const targetScrollTop = React.useCallback((target, elements) => {
|
|
42969
43087
|
const get = context?.targetScrollTop ?? currentTargetScrollTop;
|
|
42970
43088
|
return get?.(target, elements) ?? target;
|
|
@@ -43047,10 +43165,10 @@ import {
|
|
|
43047
43165
|
getTextContent,
|
|
43048
43166
|
normalizeMessageContent
|
|
43049
43167
|
} from "@blade-hq/agent-client";
|
|
43050
|
-
import { useEffect as
|
|
43168
|
+
import { useEffect as useEffect19, useRef as useRef21, useState as useState28 } from "react";
|
|
43051
43169
|
|
|
43052
43170
|
// src/components/AgentLoopBlock.tsx
|
|
43053
|
-
import { useState as
|
|
43171
|
+
import { useState as useState24 } from "react";
|
|
43054
43172
|
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
43055
43173
|
function parseAgentDescription(argumentsJson) {
|
|
43056
43174
|
try {
|
|
@@ -43061,7 +43179,7 @@ function parseAgentDescription(argumentsJson) {
|
|
|
43061
43179
|
}
|
|
43062
43180
|
}
|
|
43063
43181
|
function AgentLoopBlock({ toolCall }) {
|
|
43064
|
-
const [expanded, setExpanded] =
|
|
43182
|
+
const [expanded, setExpanded] = useState24(false);
|
|
43065
43183
|
const description = parseAgentDescription(toolCall.arguments);
|
|
43066
43184
|
const running = toolCall.status === "pending" || toolCall.status === "awaiting_answer";
|
|
43067
43185
|
const failed = toolCall.status === "error" || toolCall.status === "cancelled";
|
|
@@ -43112,10 +43230,10 @@ function AgentLoopBlock({ toolCall }) {
|
|
|
43112
43230
|
|
|
43113
43231
|
// src/components/MarkdownContent.tsx
|
|
43114
43232
|
import {
|
|
43115
|
-
useEffect as
|
|
43233
|
+
useEffect as useEffect17,
|
|
43116
43234
|
useMemo as useMemo14,
|
|
43117
|
-
useRef as
|
|
43118
|
-
useState as
|
|
43235
|
+
useRef as useRef19,
|
|
43236
|
+
useState as useState25
|
|
43119
43237
|
} from "react";
|
|
43120
43238
|
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
43121
43239
|
var SYSTEM_REMINDER_RE = /<system-reminder>[\s\S]*?<\/system-reminder>/gi;
|
|
@@ -43132,10 +43250,10 @@ function normalizeAdjacentUrlFormatting(value) {
|
|
|
43132
43250
|
return normalized.replace(/blade-url-protected-(\d+)-marker/g, (_2, index) => protectedSegments[Number(index)]);
|
|
43133
43251
|
}
|
|
43134
43252
|
function CodeBlockPre({ children, node: _node, ...props }) {
|
|
43135
|
-
const preRef =
|
|
43136
|
-
const [copied, setCopied] =
|
|
43137
|
-
const [language, setLanguage] =
|
|
43138
|
-
|
|
43253
|
+
const preRef = useRef19(null);
|
|
43254
|
+
const [copied, setCopied] = useState25(false);
|
|
43255
|
+
const [language, setLanguage] = useState25("");
|
|
43256
|
+
useEffect17(() => {
|
|
43139
43257
|
const codeEl = preRef.current?.querySelector("code");
|
|
43140
43258
|
setLanguage(codeEl?.className.match(/language-(\S+)/)?.[1] ?? "");
|
|
43141
43259
|
}, []);
|
|
@@ -43206,10 +43324,10 @@ function Shimmer({ children = "\u6B63\u5728\u601D\u8003...", className }) {
|
|
|
43206
43324
|
}
|
|
43207
43325
|
|
|
43208
43326
|
// src/components/ToolCallBlock.tsx
|
|
43209
|
-
import { useState as
|
|
43327
|
+
import { useState as useState27 } from "react";
|
|
43210
43328
|
|
|
43211
43329
|
// src/components/AskUserQuestionBlock.tsx
|
|
43212
|
-
import { useEffect as
|
|
43330
|
+
import { useEffect as useEffect18, useMemo as useMemo15, useRef as useRef20, useState as useState26 } from "react";
|
|
43213
43331
|
import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
43214
43332
|
var CUSTOM_TEXTAREA_MAX_HEIGHT = 160;
|
|
43215
43333
|
function resizeCustomTextarea(textarea) {
|
|
@@ -43218,12 +43336,12 @@ function resizeCustomTextarea(textarea) {
|
|
|
43218
43336
|
textarea.style.overflowY = textarea.scrollHeight > CUSTOM_TEXTAREA_MAX_HEIGHT ? "auto" : "hidden";
|
|
43219
43337
|
}
|
|
43220
43338
|
function useAutoResizeTextarea(value) {
|
|
43221
|
-
const textareaRef =
|
|
43222
|
-
|
|
43339
|
+
const textareaRef = useRef20(null);
|
|
43340
|
+
useEffect18(() => {
|
|
43223
43341
|
const textarea = textareaRef.current;
|
|
43224
43342
|
if (textarea?.value === value) resizeCustomTextarea(textarea);
|
|
43225
43343
|
}, [value]);
|
|
43226
|
-
|
|
43344
|
+
useEffect18(() => {
|
|
43227
43345
|
const textarea = textareaRef.current;
|
|
43228
43346
|
if (!textarea || typeof ResizeObserver === "undefined") return;
|
|
43229
43347
|
let previousWidth = textarea.clientWidth;
|
|
@@ -43248,12 +43366,12 @@ function AskUserQuestionBlock({
|
|
|
43248
43366
|
answerData,
|
|
43249
43367
|
onAnswer
|
|
43250
43368
|
}) {
|
|
43251
|
-
const [selections, setSelections] =
|
|
43252
|
-
const [customTexts, setCustomTexts] =
|
|
43253
|
-
const [usingCustom, setUsingCustom] =
|
|
43254
|
-
const [note, setNote] =
|
|
43255
|
-
const [submitted, setSubmitted] =
|
|
43256
|
-
|
|
43369
|
+
const [selections, setSelections] = useState26(/* @__PURE__ */ new Map());
|
|
43370
|
+
const [customTexts, setCustomTexts] = useState26(/* @__PURE__ */ new Map());
|
|
43371
|
+
const [usingCustom, setUsingCustom] = useState26(/* @__PURE__ */ new Set());
|
|
43372
|
+
const [note, setNote] = useState26("");
|
|
43373
|
+
const [submitted, setSubmitted] = useState26(false);
|
|
43374
|
+
useEffect18(() => {
|
|
43257
43375
|
if (sessionStatus === "failed" || sessionStatus === "interrupted") {
|
|
43258
43376
|
setSubmitted(false);
|
|
43259
43377
|
}
|
|
@@ -43664,7 +43782,7 @@ function ToolCallBlock({
|
|
|
43664
43782
|
isActiveQuestion,
|
|
43665
43783
|
renderer
|
|
43666
43784
|
}) {
|
|
43667
|
-
const [expanded, setExpanded] =
|
|
43785
|
+
const [expanded, setExpanded] = useState27(false);
|
|
43668
43786
|
const normalizedName = formatToolName(toolCall.name);
|
|
43669
43787
|
if (renderer) {
|
|
43670
43788
|
const custom2 = renderer(toolCall);
|
|
@@ -43812,7 +43930,7 @@ ${html}`;
|
|
|
43812
43930
|
// src/components/AssistantTurnBlock.tsx
|
|
43813
43931
|
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
43814
43932
|
function ThinkingBlock({ reasoning, isStreaming }) {
|
|
43815
|
-
const [open2, setOpen] =
|
|
43933
|
+
const [open2, setOpen] = useState28(false);
|
|
43816
43934
|
if (!isStreaming) return null;
|
|
43817
43935
|
return /* @__PURE__ */ jsxs16("div", { className: "blade-chat-thinking text-xs", children: [
|
|
43818
43936
|
/* @__PURE__ */ jsxs16(
|
|
@@ -44082,12 +44200,12 @@ function AssistantTurnBlock({
|
|
|
44082
44200
|
)
|
|
44083
44201
|
);
|
|
44084
44202
|
const activeQuestionId = questionToolCalls.filter((toolCall) => toolCall.status === "pending").at(-1)?.id;
|
|
44085
|
-
const [displayMode, setDisplayMode] =
|
|
44203
|
+
const [displayMode, setDisplayMode] = useState28(
|
|
44086
44204
|
() => isStreaming || hasActionableToolCall ? "detail" : "compact"
|
|
44087
44205
|
);
|
|
44088
|
-
const userSelectedDisplayModeRef =
|
|
44089
|
-
const wasStreamingRef =
|
|
44090
|
-
|
|
44206
|
+
const userSelectedDisplayModeRef = useRef21(false);
|
|
44207
|
+
const wasStreamingRef = useRef21(isStreaming);
|
|
44208
|
+
useEffect19(() => {
|
|
44091
44209
|
if (wasStreamingRef.current && !isStreaming && !userSelectedDisplayModeRef.current) {
|
|
44092
44210
|
setDisplayMode(hasActionableToolCall ? "detail" : "compact");
|
|
44093
44211
|
}
|
|
@@ -44095,11 +44213,11 @@ function AssistantTurnBlock({
|
|
|
44095
44213
|
}, [hasActionableToolCall, isStreaming]);
|
|
44096
44214
|
const effectiveMode = resolveTurnDisplayMode({ isStreaming, displayMode });
|
|
44097
44215
|
const executionDurationMs = getExecutionDurationMs({ messages, isStreaming });
|
|
44098
|
-
const [clock, setClock] =
|
|
44216
|
+
const [clock, setClock] = useState28(() => Date.now());
|
|
44099
44217
|
const hasLiveStartTime = messages.some(
|
|
44100
44218
|
(message) => message.timestamp != null && Number.isFinite(Date.parse(message.timestamp))
|
|
44101
44219
|
);
|
|
44102
|
-
|
|
44220
|
+
useEffect19(() => {
|
|
44103
44221
|
if (!isStreaming || !hasLiveStartTime) return;
|
|
44104
44222
|
const timer = window.setInterval(() => setClock(Date.now()), 1e3);
|
|
44105
44223
|
return () => window.clearInterval(timer);
|
|
@@ -44279,7 +44397,7 @@ function collectMemoryRefs(messages) {
|
|
|
44279
44397
|
return [...refs.values()];
|
|
44280
44398
|
}
|
|
44281
44399
|
function MemoryRefsHint({ refs }) {
|
|
44282
|
-
const [expanded, setExpanded] =
|
|
44400
|
+
const [expanded, setExpanded] = useState28(false);
|
|
44283
44401
|
const label = refs.some((ref) => ref.skill_name) ? "\u53C2\u8003\u4E86\u8BE5\u6280\u80FD\u7684\u5386\u53F2\u7ECF\u9A8C" : "\u53C2\u8003\u4E86\u5386\u53F2\u7ECF\u9A8C";
|
|
44284
44402
|
return /* @__PURE__ */ jsxs16("div", { className: "blade-chat-memory-refs ml-1 w-full max-w-[680px]", children: [
|
|
44285
44403
|
/* @__PURE__ */ jsxs16("button", { type: "button", onClick: () => setExpanded((value) => !value), className: "inline-flex h-8 items-center gap-1.5 rounded-lg border border-[hsl(var(--primary)/0.22)] bg-[hsl(var(--primary)/0.07)] px-3 text-xs font-medium text-[hsl(var(--primary))]", children: [
|
|
@@ -44414,7 +44532,7 @@ var RenderErrorBoundary = class extends Component2 {
|
|
|
44414
44532
|
};
|
|
44415
44533
|
|
|
44416
44534
|
// src/components/PostChatFollowupBlock.tsx
|
|
44417
|
-
import { useCallback as
|
|
44535
|
+
import { useCallback as useCallback26, useEffect as useEffect20, useRef as useRef22, useState as useState29 } from "react";
|
|
44418
44536
|
import { Fragment as Fragment7, jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
44419
44537
|
function emitInteraction(callback, event) {
|
|
44420
44538
|
try {
|
|
@@ -44434,7 +44552,7 @@ function ArtifactCard({
|
|
|
44434
44552
|
onArtifactOpened
|
|
44435
44553
|
}) {
|
|
44436
44554
|
const client = useBladeClient();
|
|
44437
|
-
const [downloading, setDownloading] =
|
|
44555
|
+
const [downloading, setDownloading] = useState29(false);
|
|
44438
44556
|
const name = artifact.label || basename(artifact.target);
|
|
44439
44557
|
if (artifact.kind === "link") {
|
|
44440
44558
|
return /* @__PURE__ */ jsxs18(
|
|
@@ -44540,15 +44658,15 @@ function ResultFeedback({
|
|
|
44540
44658
|
onFeedbackSaved
|
|
44541
44659
|
}) {
|
|
44542
44660
|
const client = useBladeClient();
|
|
44543
|
-
const [saved, setSaved] =
|
|
44544
|
-
const [helpful, setHelpful] =
|
|
44545
|
-
const [reason, setReason] =
|
|
44546
|
-
const [saving, setSaving] =
|
|
44547
|
-
const [saveError, setSaveError] =
|
|
44548
|
-
const reportedShown =
|
|
44549
|
-
const latestChoice =
|
|
44661
|
+
const [saved, setSaved] = useState29(savedFeedback ?? null);
|
|
44662
|
+
const [helpful, setHelpful] = useState29(savedFeedback?.helpful ?? null);
|
|
44663
|
+
const [reason, setReason] = useState29(savedFeedback?.reason ?? null);
|
|
44664
|
+
const [saving, setSaving] = useState29(false);
|
|
44665
|
+
const [saveError, setSaveError] = useState29(false);
|
|
44666
|
+
const reportedShown = useRef22(false);
|
|
44667
|
+
const latestChoice = useRef22(null);
|
|
44550
44668
|
const eligible = followup.feedback_eligible === true && Boolean(sessionId) && !isViewer;
|
|
44551
|
-
|
|
44669
|
+
useEffect20(() => {
|
|
44552
44670
|
if (!eligible || reportedShown.current) return;
|
|
44553
44671
|
reportedShown.current = true;
|
|
44554
44672
|
emitInteraction(onInteraction, {
|
|
@@ -44557,13 +44675,13 @@ function ResultFeedback({
|
|
|
44557
44675
|
assistantEntryId: followup.assistant_entry_id
|
|
44558
44676
|
});
|
|
44559
44677
|
}, [eligible, followup.assistant_entry_id, onInteraction, sessionId]);
|
|
44560
|
-
|
|
44678
|
+
useEffect20(() => {
|
|
44561
44679
|
if (!savedFeedback || latestChoice.current) return;
|
|
44562
44680
|
setSaved(savedFeedback);
|
|
44563
44681
|
setHelpful(savedFeedback.helpful);
|
|
44564
44682
|
setReason(savedFeedback.reason);
|
|
44565
44683
|
}, [savedFeedback]);
|
|
44566
|
-
const submit =
|
|
44684
|
+
const submit = useCallback26(
|
|
44567
44685
|
async (nextHelpful, nextReason) => {
|
|
44568
44686
|
if (!sessionId) return;
|
|
44569
44687
|
const choice = { helpful: nextHelpful, reason: nextReason };
|
|
@@ -44669,14 +44787,14 @@ function PostChatFollowupBlock({
|
|
|
44669
44787
|
savedFeedback,
|
|
44670
44788
|
onFeedbackSaved
|
|
44671
44789
|
}) {
|
|
44672
|
-
const [expanded, setExpanded] =
|
|
44673
|
-
const adopted =
|
|
44674
|
-
const reportedSuggestions =
|
|
44675
|
-
const reportedArtifacts =
|
|
44676
|
-
const openedArtifacts =
|
|
44790
|
+
const [expanded, setExpanded] = useState29(false);
|
|
44791
|
+
const adopted = useRef22(/* @__PURE__ */ new Set());
|
|
44792
|
+
const reportedSuggestions = useRef22(false);
|
|
44793
|
+
const reportedArtifacts = useRef22(/* @__PURE__ */ new Set());
|
|
44794
|
+
const openedArtifacts = useRef22(/* @__PURE__ */ new Set());
|
|
44677
44795
|
const artifacts = followup.final_artifacts ?? [];
|
|
44678
44796
|
const visibleArtifacts = expanded ? artifacts : artifacts.slice(0, 3);
|
|
44679
|
-
|
|
44797
|
+
useEffect20(() => {
|
|
44680
44798
|
if (!reportedSuggestions.current && followup.suggestions.length > 0) {
|
|
44681
44799
|
reportedSuggestions.current = true;
|
|
44682
44800
|
emitInteraction(onInteraction, {
|
|
@@ -44706,7 +44824,7 @@ function PostChatFollowupBlock({
|
|
|
44706
44824
|
sessionId,
|
|
44707
44825
|
visibleArtifacts
|
|
44708
44826
|
]);
|
|
44709
|
-
const reportArtifactOpened =
|
|
44827
|
+
const reportArtifactOpened = useCallback26(
|
|
44710
44828
|
(artifactIndex, artifactKind) => {
|
|
44711
44829
|
if (openedArtifacts.current.has(artifactIndex)) return;
|
|
44712
44830
|
openedArtifacts.current.add(artifactIndex);
|
|
@@ -44986,7 +45104,10 @@ function MessageList({
|
|
|
44986
45104
|
onFollowupInteraction,
|
|
44987
45105
|
resultFeedbackByEntry = /* @__PURE__ */ new Map(),
|
|
44988
45106
|
onResultFeedbackSaved,
|
|
44989
|
-
historyPaging
|
|
45107
|
+
historyPaging,
|
|
45108
|
+
isStopping = false,
|
|
45109
|
+
onRevealingChange,
|
|
45110
|
+
isReplay = false
|
|
44990
45111
|
}) {
|
|
44991
45112
|
const visibleRootMessages = messages.filter((message) => {
|
|
44992
45113
|
if ((message.loop_name ?? "root") !== "root") return false;
|
|
@@ -44994,17 +45115,50 @@ function MessageList({
|
|
|
44994
45115
|
if (message.kind === "context") return false;
|
|
44995
45116
|
return message.role !== "tool" || getPlanningDividerKind(message) !== null;
|
|
44996
45117
|
});
|
|
44997
|
-
const
|
|
45118
|
+
const latestAssistantIndex = (() => {
|
|
45119
|
+
for (let i2 = visibleRootMessages.length - 1; i2 >= 0; i2 -= 1) {
|
|
45120
|
+
if (visibleRootMessages[i2].role === "assistant") return i2;
|
|
45121
|
+
}
|
|
45122
|
+
return -1;
|
|
45123
|
+
})();
|
|
45124
|
+
const latestAssistantMessage = latestAssistantIndex >= 0 ? visibleRootMessages[latestAssistantIndex] : void 0;
|
|
45125
|
+
const revealTargetKey = latestAssistantMessage != null ? latestAssistantMessage.entry_id ?? latestAssistantMessage.render_id ?? `assistant-index-${latestAssistantIndex}` : null;
|
|
45126
|
+
const revealContentText = typeof latestAssistantMessage?.content === "string" ? latestAssistantMessage.content : "";
|
|
45127
|
+
const revealReasoningText = latestAssistantMessage?.reasoning ?? "";
|
|
45128
|
+
const isRevealLive = latestAssistantMessage != null && !isReplay;
|
|
45129
|
+
const contentReveal = useTypewriterReveal(revealContentText, isRevealLive, revealTargetKey);
|
|
45130
|
+
const reasoningReveal = useTypewriterReveal(revealReasoningText, isRevealLive, revealTargetKey);
|
|
45131
|
+
const isRevealingAny = contentReveal.isRevealing || reasoningReveal.isRevealing;
|
|
45132
|
+
useEffect21(() => {
|
|
45133
|
+
onRevealingChange?.(isRevealingAny);
|
|
45134
|
+
}, [isRevealingAny, onRevealingChange]);
|
|
45135
|
+
useEffect21(() => {
|
|
45136
|
+
if (isStopping) {
|
|
45137
|
+
contentReveal.flushNow();
|
|
45138
|
+
reasoningReveal.flushNow();
|
|
45139
|
+
}
|
|
45140
|
+
}, [isStopping]);
|
|
45141
|
+
const revealedMessages = useMemo16(() => {
|
|
45142
|
+
if (!latestAssistantMessage) return visibleRootMessages;
|
|
45143
|
+
return visibleRootMessages.map((message) => {
|
|
45144
|
+
if (message !== latestAssistantMessage) return message;
|
|
45145
|
+
const content = typeof message.content === "string" ? contentReveal.displayedText : message.content;
|
|
45146
|
+
const reasoning = message.reasoning != null ? reasoningReveal.displayedText : message.reasoning;
|
|
45147
|
+
const toolCalls = isRevealingAny ? void 0 : message.tool_calls;
|
|
45148
|
+
return { ...message, content, reasoning, tool_calls: toolCalls };
|
|
45149
|
+
});
|
|
45150
|
+
}, [
|
|
45151
|
+
visibleRootMessages,
|
|
45152
|
+
latestAssistantMessage,
|
|
45153
|
+
contentReveal.displayedText,
|
|
45154
|
+
reasoningReveal.displayedText,
|
|
45155
|
+
isRevealingAny
|
|
45156
|
+
]);
|
|
45157
|
+
const userMessages = revealedMessages.filter((message) => isUserMessage(message));
|
|
44998
45158
|
const latestUserMessage = userMessages.at(-1);
|
|
44999
45159
|
const shouldPinLatestUser = latestUserMessage != null && (latestUserMessage.entry_id == null ? isStreaming : latestUserMessage.entry_id.startsWith("local-user-"));
|
|
45000
45160
|
const renderBlocks = useMemo16(() => {
|
|
45001
|
-
const visible =
|
|
45002
|
-
if ((message.loop_name ?? "root") !== "root") return false;
|
|
45003
|
-
if (isHiddenInternalMessage(message)) return false;
|
|
45004
|
-
if (message.kind === "context") return false;
|
|
45005
|
-
if (message.kind === "compaction") return true;
|
|
45006
|
-
return message.role !== "tool" || getPlanningDividerKind(message) !== null;
|
|
45007
|
-
});
|
|
45161
|
+
const visible = revealedMessages;
|
|
45008
45162
|
const blocks = [];
|
|
45009
45163
|
let assistantBuffer = [];
|
|
45010
45164
|
let assistantTurnCount = 0;
|
|
@@ -45049,7 +45203,7 @@ function MessageList({
|
|
|
45049
45203
|
}
|
|
45050
45204
|
flushAssistant();
|
|
45051
45205
|
const last = blocks[blocks.length - 1];
|
|
45052
|
-
if (isStreaming) {
|
|
45206
|
+
if (isStreaming || isRevealingAny) {
|
|
45053
45207
|
if (last?.type === "assistant_turn") {
|
|
45054
45208
|
last.isStreaming = true;
|
|
45055
45209
|
} else if (last?.type === "message" && isUserMessage(last.message)) {
|
|
@@ -45070,9 +45224,9 @@ function MessageList({
|
|
|
45070
45224
|
}
|
|
45071
45225
|
}
|
|
45072
45226
|
return blocks;
|
|
45073
|
-
}, [
|
|
45227
|
+
}, [revealedMessages, isStreaming, isRevealingAny]);
|
|
45074
45228
|
return /* @__PURE__ */ jsxs21("div", { className: cn("blade-chat-messages relative min-h-0 flex-1", className), children: [
|
|
45075
|
-
isStreaming ? /* @__PURE__ */ jsx25("output", { className: "sr-only", children: "\u6B63\u5728\u751F\u6210\u56DE\u590D" }) : null,
|
|
45229
|
+
isStreaming || isRevealingAny ? /* @__PURE__ */ jsx25("output", { className: "sr-only", children: "\u6B63\u5728\u751F\u6210\u56DE\u590D" }) : null,
|
|
45076
45230
|
/* @__PURE__ */ jsxs21(
|
|
45077
45231
|
StickToBottom,
|
|
45078
45232
|
{
|
|
@@ -45096,7 +45250,7 @@ function MessageList({
|
|
|
45096
45250
|
(message) => message.entry_id ? resultFeedbackByEntry.get(message.entry_id) : void 0
|
|
45097
45251
|
).find((feedback) => feedback != null);
|
|
45098
45252
|
const hasActiveFollowup = Boolean(
|
|
45099
|
-
postChatFollowup && block.messages.some(
|
|
45253
|
+
!isRevealingAny && postChatFollowup && block.messages.some(
|
|
45100
45254
|
(message) => message.entry_id === postChatFollowup.assistant_entry_id
|
|
45101
45255
|
)
|
|
45102
45256
|
);
|
|
@@ -45160,7 +45314,7 @@ function MessageList({
|
|
|
45160
45314
|
{
|
|
45161
45315
|
userMessageCount: userMessages.length,
|
|
45162
45316
|
shouldPinLatestUser,
|
|
45163
|
-
isStreaming,
|
|
45317
|
+
isStreaming: isStreaming || isRevealingAny,
|
|
45164
45318
|
targetKey: latestUserMessage?.render_id ?? latestUserMessage?.entry_id ?? (latestUserMessage ? `user:${userMessages.length}` : null)
|
|
45165
45319
|
},
|
|
45166
45320
|
sessionId ?? "no-session"
|
|
@@ -45178,10 +45332,10 @@ function LoadOlderSentinel({
|
|
|
45178
45332
|
loadOlder
|
|
45179
45333
|
}) {
|
|
45180
45334
|
const { contentRef, scrollRef } = useStickToBottomContext();
|
|
45181
|
-
const sentinelRef =
|
|
45182
|
-
const stateRef =
|
|
45335
|
+
const sentinelRef = useRef23(null);
|
|
45336
|
+
const stateRef = useRef23({ hasOlder, loading, loadOlder });
|
|
45183
45337
|
stateRef.current = { hasOlder, loading, loadOlder };
|
|
45184
|
-
|
|
45338
|
+
useEffect21(() => {
|
|
45185
45339
|
const sentinel = sentinelRef.current;
|
|
45186
45340
|
const scroller = scrollRef.current;
|
|
45187
45341
|
if (!sentinel || !scroller || typeof IntersectionObserver === "undefined") return;
|
|
@@ -45249,16 +45403,16 @@ function PinLatestUserMessage({
|
|
|
45249
45403
|
targetKey
|
|
45250
45404
|
}) {
|
|
45251
45405
|
const { contentRef, scrollRef, scrollToBottom, stopScroll } = useStickToBottomContext();
|
|
45252
|
-
const previousCountRef =
|
|
45253
|
-
const spacerHeightRef =
|
|
45254
|
-
const getScrollElement =
|
|
45255
|
-
const getContentElement =
|
|
45256
|
-
const getTargetElement =
|
|
45406
|
+
const previousCountRef = useRef23(userMessageCount);
|
|
45407
|
+
const spacerHeightRef = useRef23(0);
|
|
45408
|
+
const getScrollElement = useCallback27(() => scrollRef.current, [scrollRef]);
|
|
45409
|
+
const getContentElement = useCallback27(() => contentRef.current, [contentRef]);
|
|
45410
|
+
const getTargetElement = useCallback27(() => {
|
|
45257
45411
|
const rows = contentRef.current?.querySelectorAll(".blade-chat-user-row");
|
|
45258
45412
|
return rows?.item((rows?.length ?? 0) - 1) ?? null;
|
|
45259
45413
|
}, [contentRef]);
|
|
45260
|
-
const getSpacerHeight =
|
|
45261
|
-
const setSpacerHeight =
|
|
45414
|
+
const getSpacerHeight = useCallback27(() => spacerHeightRef.current, []);
|
|
45415
|
+
const setSpacerHeight = useCallback27(
|
|
45262
45416
|
(height) => {
|
|
45263
45417
|
spacerHeightRef.current = height;
|
|
45264
45418
|
const content = contentRef.current;
|
|
@@ -45280,7 +45434,7 @@ function PinLatestUserMessage({
|
|
|
45280
45434
|
stopAutoScroll: stopScroll,
|
|
45281
45435
|
scrollToBottom
|
|
45282
45436
|
});
|
|
45283
|
-
|
|
45437
|
+
useEffect21(() => {
|
|
45284
45438
|
if (userMessageCount > previousCountRef.current && !shouldPinLatestUser) {
|
|
45285
45439
|
scrollToBottom("instant");
|
|
45286
45440
|
}
|
|
@@ -45290,9 +45444,9 @@ function PinLatestUserMessage({
|
|
|
45290
45444
|
}
|
|
45291
45445
|
function ScrollToBottomButton() {
|
|
45292
45446
|
const { isAtBottom, scrollToBottom } = useStickToBottomContext();
|
|
45293
|
-
const [visible, setVisible] =
|
|
45294
|
-
const hideTimerRef =
|
|
45295
|
-
|
|
45447
|
+
const [visible, setVisible] = useState30(false);
|
|
45448
|
+
const hideTimerRef = useRef23(null);
|
|
45449
|
+
useEffect21(() => {
|
|
45296
45450
|
if (isAtBottom) {
|
|
45297
45451
|
if (!hideTimerRef.current) {
|
|
45298
45452
|
hideTimerRef.current = setTimeout(() => {
|
|
@@ -45314,7 +45468,7 @@ function ScrollToBottomButton() {
|
|
|
45314
45468
|
}
|
|
45315
45469
|
};
|
|
45316
45470
|
}, [isAtBottom]);
|
|
45317
|
-
const handleClick =
|
|
45471
|
+
const handleClick = useCallback27(() => {
|
|
45318
45472
|
if (hideTimerRef.current) {
|
|
45319
45473
|
clearTimeout(hideTimerRef.current);
|
|
45320
45474
|
hideTimerRef.current = null;
|
|
@@ -45383,9 +45537,11 @@ function ChatSurface({
|
|
|
45383
45537
|
showPlanUpdates = false,
|
|
45384
45538
|
planRevealRevision = 0,
|
|
45385
45539
|
historyPaging,
|
|
45386
|
-
banner
|
|
45540
|
+
banner,
|
|
45541
|
+
onRevealingChange,
|
|
45542
|
+
isReplay
|
|
45387
45543
|
}) {
|
|
45388
|
-
const [pending, setPending] =
|
|
45544
|
+
const [pending, setPending] = useState31([]);
|
|
45389
45545
|
const currentPending = pending.filter((item) => item.sessionId === sessionId);
|
|
45390
45546
|
const sendWithApps = async (text) => {
|
|
45391
45547
|
const content = [...currentPending.map((item) => `[${item.label}]
|
|
@@ -45431,6 +45587,9 @@ ${item.content}`), text].filter(Boolean).join("\n\n");
|
|
|
45431
45587
|
emptyState: slots?.emptyState,
|
|
45432
45588
|
className: classNames?.messageList,
|
|
45433
45589
|
sessionId,
|
|
45590
|
+
isStopping,
|
|
45591
|
+
onRevealingChange,
|
|
45592
|
+
isReplay,
|
|
45434
45593
|
isViewer,
|
|
45435
45594
|
resultFeedbackByEntry,
|
|
45436
45595
|
onResultFeedbackSaved,
|
|
@@ -45485,8 +45644,8 @@ function isUnauthorizedError(error61) {
|
|
|
45485
45644
|
return error61 instanceof BladeApiError2 && error61.status === 401;
|
|
45486
45645
|
}
|
|
45487
45646
|
function LoginCard({ client, onLoggedIn }) {
|
|
45488
|
-
const [loggingIn, setLoggingIn] =
|
|
45489
|
-
const [loginError, setLoginError] =
|
|
45647
|
+
const [loggingIn, setLoggingIn] = useState32(false);
|
|
45648
|
+
const [loginError, setLoginError] = useState32(null);
|
|
45490
45649
|
const handleLogin = async () => {
|
|
45491
45650
|
setLoggingIn(true);
|
|
45492
45651
|
setLoginError(null);
|
|
@@ -45518,8 +45677,8 @@ function LoginCard({ client, onLoggedIn }) {
|
|
|
45518
45677
|
}
|
|
45519
45678
|
function AgentChat(props) {
|
|
45520
45679
|
const client = useBladeClient();
|
|
45521
|
-
const [attempt, setAttempt] =
|
|
45522
|
-
const [needLogin, setNeedLogin] =
|
|
45680
|
+
const [attempt, setAttempt] = useState32(0);
|
|
45681
|
+
const [needLogin, setNeedLogin] = useState32(() => !client.hasToken());
|
|
45523
45682
|
if (needLogin) {
|
|
45524
45683
|
return /* @__PURE__ */ jsx27(
|
|
45525
45684
|
"div",
|
|
@@ -45557,10 +45716,10 @@ function ChatSessionView({
|
|
|
45557
45716
|
onUnauthorized
|
|
45558
45717
|
}) {
|
|
45559
45718
|
const client = useBladeClient();
|
|
45560
|
-
const [planRevealRevisions, setPlanRevealRevisions] =
|
|
45719
|
+
const [planRevealRevisions, setPlanRevealRevisions] = useState32(
|
|
45561
45720
|
() => /* @__PURE__ */ new Map()
|
|
45562
45721
|
);
|
|
45563
|
-
const handleSessionConnected =
|
|
45722
|
+
const handleSessionConnected = useCallback28((connectedSession) => {
|
|
45564
45723
|
return connectedSession.on("toolResult", ({ toolCall, turn, source }) => {
|
|
45565
45724
|
if (source === "reconnect_replay" || (turn.loop_id || "root") !== "root" || toolCall.status !== "done" || !isPlanUpdateTool(toolCall) || !parsePlanUpdate(toolCall.arguments)) {
|
|
45566
45725
|
return;
|
|
@@ -45578,21 +45737,22 @@ function ChatSessionView({
|
|
|
45578
45737
|
onSessionConnected: handleSessionConnected
|
|
45579
45738
|
});
|
|
45580
45739
|
const replay = useReplay(session);
|
|
45581
|
-
const [stopRequested, setStopRequested] =
|
|
45582
|
-
const [
|
|
45583
|
-
const [
|
|
45584
|
-
const [
|
|
45585
|
-
const [
|
|
45740
|
+
const [stopRequested, setStopRequested] = useState32(false);
|
|
45741
|
+
const [isRevealing, setIsRevealing] = useState32(false);
|
|
45742
|
+
const [inputText, setInputText] = useState32("");
|
|
45743
|
+
const [queueNotice, setQueueNotice] = useState32(null);
|
|
45744
|
+
const [queuePendingItemId, setQueuePendingItemId] = useState32(null);
|
|
45745
|
+
const [resultFeedback, setResultFeedback] = useState32([]);
|
|
45586
45746
|
const resolvedSessionId = session?.sessionId;
|
|
45587
45747
|
const isViewer = state?.viewerRole === "viewer";
|
|
45588
45748
|
const canUseQueue = !isViewer;
|
|
45589
|
-
const onSessionReadyRef =
|
|
45590
|
-
const readySessionRef =
|
|
45749
|
+
const onSessionReadyRef = useRef24(onSessionReady);
|
|
45750
|
+
const readySessionRef = useRef24(null);
|
|
45591
45751
|
const hasOnSessionReady = onSessionReady !== void 0;
|
|
45592
|
-
|
|
45752
|
+
useEffect22(() => {
|
|
45593
45753
|
onSessionReadyRef.current = onSessionReady;
|
|
45594
45754
|
}, [onSessionReady]);
|
|
45595
|
-
|
|
45755
|
+
useEffect22(() => {
|
|
45596
45756
|
setResultFeedback([]);
|
|
45597
45757
|
if (!resolvedSessionId || isViewer) return;
|
|
45598
45758
|
let cancelled = false;
|
|
@@ -45621,19 +45781,19 @@ function ChatSessionView({
|
|
|
45621
45781
|
() => new Map(resultFeedback.map((item) => [item.assistant_entry_id, item])),
|
|
45622
45782
|
[resultFeedback]
|
|
45623
45783
|
);
|
|
45624
|
-
const handleResultFeedbackSaved =
|
|
45784
|
+
const handleResultFeedbackSaved = useCallback28((saved) => {
|
|
45625
45785
|
setResultFeedback((current) => [
|
|
45626
45786
|
...current.filter((item) => item.assistant_entry_id !== saved.assistant_entry_id),
|
|
45627
45787
|
saved
|
|
45628
45788
|
]);
|
|
45629
45789
|
}, []);
|
|
45630
|
-
|
|
45790
|
+
useEffect22(() => {
|
|
45631
45791
|
const handler = onSessionReadyRef.current;
|
|
45632
45792
|
if (!session || !hasOnSessionReady || !handler || readySessionRef.current === session) return;
|
|
45633
45793
|
readySessionRef.current = session;
|
|
45634
45794
|
handler(session);
|
|
45635
45795
|
}, [session, hasOnSessionReady]);
|
|
45636
|
-
|
|
45796
|
+
useEffect22(() => {
|
|
45637
45797
|
if (!session) return;
|
|
45638
45798
|
const offAttach = session.on("attachRequested", ({ label, content }) => {
|
|
45639
45799
|
setInputText((prev) => `${prev ? `${prev}
|
|
@@ -45649,12 +45809,12 @@ ${content}`);
|
|
|
45649
45809
|
offInsert();
|
|
45650
45810
|
};
|
|
45651
45811
|
}, [session]);
|
|
45652
|
-
|
|
45812
|
+
useEffect22(() => {
|
|
45653
45813
|
if (isUnauthorizedError(error61)) {
|
|
45654
45814
|
onUnauthorized();
|
|
45655
45815
|
}
|
|
45656
45816
|
}, [error61, onUnauthorized]);
|
|
45657
|
-
|
|
45817
|
+
useEffect22(() => {
|
|
45658
45818
|
if (!session || !commands) return;
|
|
45659
45819
|
const unsubscribes = Object.entries(commands).map(
|
|
45660
45820
|
([action, handler]) => session.onCommand(action, (payload) => handler(payload))
|
|
@@ -45663,7 +45823,7 @@ ${content}`);
|
|
|
45663
45823
|
for (const unsubscribe of unsubscribes) unsubscribe();
|
|
45664
45824
|
};
|
|
45665
45825
|
}, [session, commands]);
|
|
45666
|
-
const isStreaming = state?.isStreaming ?? false;
|
|
45826
|
+
const isStreaming = (state?.isStreaming ?? false) || isRevealing;
|
|
45667
45827
|
const planRevealRevision = resolvedSessionId ? planRevealRevisions.get(resolvedSessionId) ?? 0 : 0;
|
|
45668
45828
|
const isStopping = stopRequested && isStreaming;
|
|
45669
45829
|
const connectError = error61 && !isUnauthorizedError(error61) ? error61.message || "\u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5" : null;
|
|
@@ -45788,6 +45948,8 @@ ${content}`);
|
|
|
45788
45948
|
}
|
|
45789
45949
|
} : void 0,
|
|
45790
45950
|
isStopping,
|
|
45951
|
+
onRevealingChange: setIsRevealing,
|
|
45952
|
+
isReplay: replay.isReplay,
|
|
45791
45953
|
inputText,
|
|
45792
45954
|
onInputChange: setInputText,
|
|
45793
45955
|
onSuggestion: setInputText,
|
|
@@ -45808,10 +45970,10 @@ ${content}`);
|
|
|
45808
45970
|
}
|
|
45809
45971
|
|
|
45810
45972
|
// src/components/LlmChat.tsx
|
|
45811
|
-
import { useEffect as
|
|
45973
|
+
import { useEffect as useEffect23, useMemo as useMemo18, useState as useState34 } from "react";
|
|
45812
45974
|
|
|
45813
45975
|
// src/components/LlmAdvancedSettings.tsx
|
|
45814
|
-
import { useState as
|
|
45976
|
+
import { useState as useState33 } from "react";
|
|
45815
45977
|
import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
45816
45978
|
var FIELDS = [
|
|
45817
45979
|
{ id: "baseURL", label: "\u6A21\u578B\u670D\u52A1\u5730\u5740", placeholder: "http://\u5185\u7F51\u5730\u5740/v1" },
|
|
@@ -45858,8 +46020,8 @@ function writeOverride(settings, baseURL, override) {
|
|
|
45858
46020
|
}
|
|
45859
46021
|
function LlmAdvancedSettingsBar({ settings, defaults: defaults2, override, onChange }) {
|
|
45860
46022
|
const normalized = normalizeAdvanced(settings);
|
|
45861
|
-
const [open2, setOpen] =
|
|
45862
|
-
const [draft, setDraft] =
|
|
46023
|
+
const [open2, setOpen] = useState33(false);
|
|
46024
|
+
const [draft, setDraft] = useState33(override);
|
|
45863
46025
|
if (!normalized) return null;
|
|
45864
46026
|
const fields2 = FIELDS.filter((field) => normalized[field.id]);
|
|
45865
46027
|
const dirty = Object.keys(override).length > 0;
|
|
@@ -45942,11 +46104,13 @@ function LlmChat({
|
|
|
45942
46104
|
onOverrideChange,
|
|
45943
46105
|
...options
|
|
45944
46106
|
}) {
|
|
45945
|
-
const [override, setOverride] =
|
|
46107
|
+
const [override, setOverride] = useState34(() => readOverride(advanced, options.baseURL));
|
|
45946
46108
|
const effective = { ...options, ...override };
|
|
45947
46109
|
const { messages, isStreaming, error: error61, send, stop, reset } = useLlmChat(effective);
|
|
45948
|
-
const [inputText, setInputText] =
|
|
45949
|
-
const [stopRequested, setStopRequested] =
|
|
46110
|
+
const [inputText, setInputText] = useState34("");
|
|
46111
|
+
const [stopRequested, setStopRequested] = useState34(false);
|
|
46112
|
+
const [isRevealing, setIsRevealing] = useState34(false);
|
|
46113
|
+
const isStreamingDisplay = isStreaming || isRevealing;
|
|
45950
46114
|
const handle = useMemo18(
|
|
45951
46115
|
() => ({
|
|
45952
46116
|
insertText: (text) => setInputText((prev) => prev ? `${prev}
|
|
@@ -45956,7 +46120,7 @@ ${text}` : text),
|
|
|
45956
46120
|
}),
|
|
45957
46121
|
[send, reset]
|
|
45958
46122
|
);
|
|
45959
|
-
|
|
46123
|
+
useEffect23(() => {
|
|
45960
46124
|
onReady?.(handle);
|
|
45961
46125
|
}, [handle, onReady]);
|
|
45962
46126
|
return /* @__PURE__ */ jsx29(
|
|
@@ -45970,8 +46134,9 @@ ${text}` : text),
|
|
|
45970
46134
|
connection: "connected",
|
|
45971
46135
|
errorMessage: error61,
|
|
45972
46136
|
messages,
|
|
45973
|
-
isStreaming,
|
|
45974
|
-
isStopping: stopRequested &&
|
|
46137
|
+
isStreaming: isStreamingDisplay,
|
|
46138
|
+
isStopping: stopRequested && isStreamingDisplay,
|
|
46139
|
+
onRevealingChange: setIsRevealing,
|
|
45975
46140
|
inputText,
|
|
45976
46141
|
onInputChange: setInputText,
|
|
45977
46142
|
onSend: async (text) => {
|
|
@@ -46026,7 +46191,7 @@ function ChatView(props) {
|
|
|
46026
46191
|
}
|
|
46027
46192
|
|
|
46028
46193
|
// src/components/ConnectorPanel.tsx
|
|
46029
|
-
import { useCallback as
|
|
46194
|
+
import { useCallback as useCallback29, useEffect as useEffect24, useMemo as useMemo19, useRef as useRef25, useState as useState35 } from "react";
|
|
46030
46195
|
|
|
46031
46196
|
// src/components/connector-panel-types.ts
|
|
46032
46197
|
function selectionFromItem(item) {
|
|
@@ -46068,10 +46233,10 @@ function ConnectorPanel({
|
|
|
46068
46233
|
renderFooterActions,
|
|
46069
46234
|
className
|
|
46070
46235
|
}) {
|
|
46071
|
-
const [query, setQuery] =
|
|
46072
|
-
const [pendingCatalog, setPendingCatalog] =
|
|
46073
|
-
const [pendingLoading, setPendingLoading] =
|
|
46074
|
-
const [pendingError, setPendingError] =
|
|
46236
|
+
const [query, setQuery] = useState35("");
|
|
46237
|
+
const [pendingCatalog, setPendingCatalog] = useState35(null);
|
|
46238
|
+
const [pendingLoading, setPendingLoading] = useState35(false);
|
|
46239
|
+
const [pendingError, setPendingError] = useState35(false);
|
|
46075
46240
|
const activation = useSessionPluginActivation({
|
|
46076
46241
|
client,
|
|
46077
46242
|
// 首页不会走这个分支:待选在下面自己处理开关,不碰会话接口。
|
|
@@ -46079,10 +46244,10 @@ function ConnectorPanel({
|
|
|
46079
46244
|
onChange: onPluginsChanged
|
|
46080
46245
|
});
|
|
46081
46246
|
const { reload, items: sessionItems } = activation;
|
|
46082
|
-
|
|
46247
|
+
useEffect24(() => {
|
|
46083
46248
|
if (sessionId) reload();
|
|
46084
46249
|
}, [reload, sessionId]);
|
|
46085
|
-
const loadPendingCatalog =
|
|
46250
|
+
const loadPendingCatalog = useCallback29(async () => {
|
|
46086
46251
|
setPendingLoading(true);
|
|
46087
46252
|
setPendingError(false);
|
|
46088
46253
|
try {
|
|
@@ -46094,7 +46259,7 @@ function ConnectorPanel({
|
|
|
46094
46259
|
setPendingLoading(false);
|
|
46095
46260
|
}
|
|
46096
46261
|
}, [client]);
|
|
46097
|
-
|
|
46262
|
+
useEffect24(() => {
|
|
46098
46263
|
if (sessionId) return;
|
|
46099
46264
|
void loadPendingCatalog();
|
|
46100
46265
|
}, [loadPendingCatalog, sessionId]);
|
|
@@ -46113,11 +46278,11 @@ function ConnectorPanel({
|
|
|
46113
46278
|
() => sessionId ? filterConnectorItems(items, query) : filterConnectorItems(items, query).map((item) => ({ ...item, config: void 0 })),
|
|
46114
46279
|
[items, query, sessionId]
|
|
46115
46280
|
);
|
|
46116
|
-
const togglePending =
|
|
46281
|
+
const togglePending = useCallback29((item, next) => {
|
|
46117
46282
|
const kept = (pendingPlugins ?? []).filter((entry) => entry.name !== item.name);
|
|
46118
46283
|
onPendingPluginsChange?.(next ? [...kept, selectionFromItem(item)] : kept);
|
|
46119
46284
|
}, [onPendingPluginsChange, pendingPlugins]);
|
|
46120
|
-
const toggle =
|
|
46285
|
+
const toggle = useCallback29((item, next) => {
|
|
46121
46286
|
if (sessionId) activation.toggle(item, next);
|
|
46122
46287
|
else togglePending(item, next);
|
|
46123
46288
|
}, [activation, sessionId, togglePending]);
|
|
@@ -46125,15 +46290,15 @@ function ConnectorPanel({
|
|
|
46125
46290
|
() => items.filter((item) => item.active),
|
|
46126
46291
|
[items]
|
|
46127
46292
|
);
|
|
46128
|
-
const onSelectedChangeRef =
|
|
46293
|
+
const onSelectedChangeRef = useRef25(onSelectedChange);
|
|
46129
46294
|
onSelectedChangeRef.current = onSelectedChange;
|
|
46130
|
-
const latestSelected =
|
|
46295
|
+
const latestSelected = useRef25(selectedItems);
|
|
46131
46296
|
latestSelected.current = selectedItems;
|
|
46132
|
-
const reportSelected =
|
|
46297
|
+
const reportSelected = useCallback29(() => {
|
|
46133
46298
|
onSelectedChangeRef.current?.(latestSelected.current);
|
|
46134
46299
|
}, []);
|
|
46135
46300
|
const selectedNames = selectedItems.map((item) => item.name).join("\0");
|
|
46136
|
-
|
|
46301
|
+
useEffect24(reportSelected, [reportSelected, selectedNames]);
|
|
46137
46302
|
const failed = sessionId ? activation.listError : pendingError;
|
|
46138
46303
|
return /* @__PURE__ */ jsxs25("div", { className, children: [
|
|
46139
46304
|
/* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2 border-[hsl(var(--border))] border-b px-3 py-2", children: [
|
|
@@ -46345,7 +46510,7 @@ function ContextGroupCard({ contexts, className }) {
|
|
|
46345
46510
|
}
|
|
46346
46511
|
|
|
46347
46512
|
// src/components/SessionMemoryToggle.tsx
|
|
46348
|
-
import { useCallback as
|
|
46513
|
+
import { useCallback as useCallback30, useEffect as useEffect25, useRef as useRef26, useState as useState36, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
46349
46514
|
import { jsx as jsx34, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
46350
46515
|
var saveStates = /* @__PURE__ */ new WeakMap();
|
|
46351
46516
|
function getSaveState(client, sessionId) {
|
|
@@ -46387,7 +46552,7 @@ function SessionMemoryToggle({
|
|
|
46387
46552
|
throw new Error("SessionMemoryToggle \u5FC5\u987B\u5728 <BladeProvider> \u5185\u4F7F\u7528\u6216\u663E\u5F0F\u4F20\u5165 client");
|
|
46388
46553
|
}
|
|
46389
46554
|
const saveState = getSaveState(client, sessionId);
|
|
46390
|
-
const subscribe =
|
|
46555
|
+
const subscribe = useCallback30(
|
|
46391
46556
|
(listener) => {
|
|
46392
46557
|
saveState.listeners.add(listener);
|
|
46393
46558
|
return () => {
|
|
@@ -46397,19 +46562,19 @@ function SessionMemoryToggle({
|
|
|
46397
46562
|
},
|
|
46398
46563
|
[client, saveState, sessionId]
|
|
46399
46564
|
);
|
|
46400
|
-
const getSaving =
|
|
46565
|
+
const getSaving = useCallback30(() => saveState.saving, [saveState]);
|
|
46401
46566
|
const saving = useSyncExternalStore2(
|
|
46402
46567
|
subscribe,
|
|
46403
46568
|
getSaving,
|
|
46404
46569
|
getSaving
|
|
46405
46570
|
);
|
|
46406
|
-
const [draftEnabled, setDraftEnabled] =
|
|
46407
|
-
const activeSessionIdRef =
|
|
46571
|
+
const [draftEnabled, setDraftEnabled] = useState36(enabled);
|
|
46572
|
+
const activeSessionIdRef = useRef26(sessionId);
|
|
46408
46573
|
activeSessionIdRef.current = sessionId;
|
|
46409
|
-
|
|
46574
|
+
useEffect25(() => {
|
|
46410
46575
|
setDraftEnabled(enabled);
|
|
46411
46576
|
}, [enabled, sessionId]);
|
|
46412
|
-
const update =
|
|
46577
|
+
const update = useCallback30(
|
|
46413
46578
|
(nextEnabled) => {
|
|
46414
46579
|
const currentSaveState = getSaveState(client, sessionId);
|
|
46415
46580
|
if (currentSaveState.saving) return;
|
|
@@ -46542,7 +46707,8 @@ export {
|
|
|
46542
46707
|
useLlmChat,
|
|
46543
46708
|
useMessagePin,
|
|
46544
46709
|
useReplay,
|
|
46545
|
-
useSessionPluginActivation
|
|
46710
|
+
useSessionPluginActivation,
|
|
46711
|
+
useTypewriterReveal
|
|
46546
46712
|
};
|
|
46547
46713
|
/*! Bundled license information:
|
|
46548
46714
|
|