@elizaos/server 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{index-CkUr-lz0.js → index-CSGjxUG_.js} +1800 -1413
- package/dist/client/assets/index-CSGjxUG_.js.br +0 -0
- package/dist/client/assets/{index-CkUr-lz0.js.map → index-CSGjxUG_.js.map} +1 -1
- package/dist/client/assets/index-CuhlDCnv.css +1 -0
- package/dist/client/assets/index-CuhlDCnv.css.br +0 -0
- package/dist/client/assets/{index-DA8nGyvG.js → index-DS--BeyD.js} +2 -2
- package/dist/client/assets/index-DS--BeyD.js.br +0 -0
- package/dist/client/assets/{index-DA8nGyvG.js.map → index-DS--BeyD.js.map} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/index.js +14 -9
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/client/assets/index-BXWgVSUO.css +0 -1
- package/dist/client/assets/index-BXWgVSUO.css.br +0 -0
- package/dist/client/assets/index-CkUr-lz0.js.br +0 -0
- package/dist/client/assets/index-DA8nGyvG.js.br +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import { r as requireReact, a as requireReactDom, d as distExports
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DS--BeyD.js","assets/vendor-Dp9Dttv5.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import { r as requireReact, a as requireReactDom, d as distExports, b as reactExports, g as getDefaultExportFromCjs, c as reactDomExports, R as React, e as ReactDOM, f as React$1, h as requireBufferPolyfill, i as requireBase64Js, u as useNavigate, j as useLocation, N as NavLink, k as useParams, L as Link, l as useSearchParams, B as BrowserRouter, m as Routes, n as Route } from './vendor-Dp9Dttv5.js';
|
|
3
3
|
|
|
4
4
|
true &&(function polyfill() {
|
|
5
5
|
const relList = document.createElement("link").relList;
|
|
@@ -4715,8 +4715,8 @@ function requireReactDomClient_production () {
|
|
|
4715
4715
|
error
|
|
4716
4716
|
});
|
|
4717
4717
|
if (!window.dispatchEvent(event)) return;
|
|
4718
|
-
} else if ("object" === typeof distExports
|
|
4719
|
-
distExports
|
|
4718
|
+
} else if ("object" === typeof distExports.process && "function" === typeof distExports.process.emit) {
|
|
4719
|
+
distExports.process.emit("uncaughtException", error);
|
|
4720
4720
|
return;
|
|
4721
4721
|
}
|
|
4722
4722
|
console.error(error);
|
|
@@ -17321,6 +17321,20 @@ const Filter = createLucideIcon("Filter", [
|
|
|
17321
17321
|
*/
|
|
17322
17322
|
|
|
17323
17323
|
|
|
17324
|
+
const Globe = createLucideIcon("Globe", [
|
|
17325
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
17326
|
+
["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
|
|
17327
|
+
["path", { d: "M2 12h20", key: "9i4pu4" }]
|
|
17328
|
+
]);
|
|
17329
|
+
|
|
17330
|
+
/**
|
|
17331
|
+
* @license lucide-react v0.469.0 - ISC
|
|
17332
|
+
*
|
|
17333
|
+
* This source code is licensed under the ISC license.
|
|
17334
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
17335
|
+
*/
|
|
17336
|
+
|
|
17337
|
+
|
|
17324
17338
|
const GripVertical = createLucideIcon("GripVertical", [
|
|
17325
17339
|
["circle", { cx: "9", cy: "12", r: "1", key: "1vctgf" }],
|
|
17326
17340
|
["circle", { cx: "9", cy: "5", r: "1", key: "hp0tcf" }],
|
|
@@ -23683,7 +23697,8 @@ var QueryObserver = class extends Subscribable {
|
|
|
23683
23697
|
isRefetchError: isError && hasData,
|
|
23684
23698
|
isStale: isStale(query, options),
|
|
23685
23699
|
refetch: this.refetch,
|
|
23686
|
-
promise: this.#currentThenable
|
|
23700
|
+
promise: this.#currentThenable,
|
|
23701
|
+
isEnabled: resolveEnabled(options.enabled, query) !== false
|
|
23687
23702
|
};
|
|
23688
23703
|
const nextResult = result;
|
|
23689
23704
|
if (this.options.experimental_prefetchInRender) {
|
|
@@ -24434,26 +24449,40 @@ const Tag = ({ tag, onRemove }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
|
24434
24449
|
}
|
|
24435
24450
|
);
|
|
24436
24451
|
const TagList = ({ tags, onRemove }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-2 mb-2", children: tags.map((tag) => /* @__PURE__ */ jsxRuntimeExports.jsx(Tag, { tag, onRemove }, tag)) });
|
|
24437
|
-
const TagInput = ({ value, onChange, onKeyDown }) => /* @__PURE__ */ jsxRuntimeExports.
|
|
24438
|
-
|
|
24439
|
-
|
|
24440
|
-
|
|
24441
|
-
|
|
24442
|
-
|
|
24443
|
-
|
|
24444
|
-
|
|
24445
|
-
|
|
24446
|
-
|
|
24452
|
+
const TagInput = ({ value, onChange, onKeyDown, onAdd }) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative", children: [
|
|
24453
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
24454
|
+
Input,
|
|
24455
|
+
{
|
|
24456
|
+
value,
|
|
24457
|
+
onChange,
|
|
24458
|
+
onKeyDown,
|
|
24459
|
+
placeholder: "Type and press Enter or click Add...",
|
|
24460
|
+
className: cn("bg-background pr-16", !value && "text-muted-foreground")
|
|
24461
|
+
}
|
|
24462
|
+
),
|
|
24463
|
+
value.trim() && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
24464
|
+
Button,
|
|
24465
|
+
{
|
|
24466
|
+
size: "sm",
|
|
24467
|
+
onClick: onAdd,
|
|
24468
|
+
className: "absolute top-1/2 -translate-y-1/2 right-2 h-7 px-3",
|
|
24469
|
+
children: "Add"
|
|
24470
|
+
}
|
|
24471
|
+
)
|
|
24472
|
+
] });
|
|
24447
24473
|
function ArrayInput({ title, data, onChange }) {
|
|
24448
24474
|
const [inputValue, setInputValue] = reactExports.useState("");
|
|
24475
|
+
const addTag = () => {
|
|
24476
|
+
const trimmedValue = inputValue.trim();
|
|
24477
|
+
if (trimmedValue && !data.includes(trimmedValue)) {
|
|
24478
|
+
onChange([...data, trimmedValue]);
|
|
24479
|
+
setInputValue("");
|
|
24480
|
+
}
|
|
24481
|
+
};
|
|
24449
24482
|
const handleKeyDown = (e) => {
|
|
24450
24483
|
if (e.key === "Enter") {
|
|
24451
24484
|
e.preventDefault();
|
|
24452
|
-
|
|
24453
|
-
if (trimmedValue && !data.includes(trimmedValue)) {
|
|
24454
|
-
onChange([...data, trimmedValue]);
|
|
24455
|
-
setInputValue("");
|
|
24456
|
-
}
|
|
24485
|
+
addTag();
|
|
24457
24486
|
}
|
|
24458
24487
|
};
|
|
24459
24488
|
const removeTag = (tagToRemove) => {
|
|
@@ -24468,7 +24497,8 @@ function ArrayInput({ title, data, onChange }) {
|
|
|
24468
24497
|
{
|
|
24469
24498
|
value: inputValue,
|
|
24470
24499
|
onChange: (e) => setInputValue(e.target.value),
|
|
24471
|
-
onKeyDown: handleKeyDown
|
|
24500
|
+
onKeyDown: handleKeyDown,
|
|
24501
|
+
onAdd: addTag
|
|
24472
24502
|
}
|
|
24473
24503
|
)
|
|
24474
24504
|
] })
|
|
@@ -29176,12 +29206,12 @@ function require_if () {
|
|
|
29176
29206
|
return _if.exports;
|
|
29177
29207
|
}
|
|
29178
29208
|
|
|
29179
|
-
var log$
|
|
29209
|
+
var log$3 = {exports: {}};
|
|
29180
29210
|
|
|
29181
29211
|
var hasRequiredLog;
|
|
29182
29212
|
|
|
29183
29213
|
function requireLog () {
|
|
29184
|
-
if (hasRequiredLog) return log$
|
|
29214
|
+
if (hasRequiredLog) return log$3.exports;
|
|
29185
29215
|
hasRequiredLog = 1;
|
|
29186
29216
|
(function (module, exports) {
|
|
29187
29217
|
|
|
@@ -29209,8 +29239,8 @@ function requireLog () {
|
|
|
29209
29239
|
|
|
29210
29240
|
module.exports = exports['default'];
|
|
29211
29241
|
|
|
29212
|
-
} (log$
|
|
29213
|
-
return log$
|
|
29242
|
+
} (log$3, log$3.exports));
|
|
29243
|
+
return log$3.exports;
|
|
29214
29244
|
}
|
|
29215
29245
|
|
|
29216
29246
|
var lookup$2 = {exports: {}};
|
|
@@ -32409,15 +32439,15 @@ function requireBase64Vlq () {
|
|
|
32409
32439
|
return base64Vlq;
|
|
32410
32440
|
}
|
|
32411
32441
|
|
|
32412
|
-
var util$
|
|
32442
|
+
var util$4 = {};
|
|
32413
32443
|
|
|
32414
32444
|
/* -*- Mode: js; js-indent-level: 2; -*- */
|
|
32415
32445
|
|
|
32416
|
-
var hasRequiredUtil$
|
|
32446
|
+
var hasRequiredUtil$3;
|
|
32417
32447
|
|
|
32418
|
-
function requireUtil$
|
|
32419
|
-
if (hasRequiredUtil$
|
|
32420
|
-
hasRequiredUtil$
|
|
32448
|
+
function requireUtil$3 () {
|
|
32449
|
+
if (hasRequiredUtil$3) return util$4;
|
|
32450
|
+
hasRequiredUtil$3 = 1;
|
|
32421
32451
|
(function (exports) {
|
|
32422
32452
|
/*
|
|
32423
32453
|
* Copyright 2011 Mozilla Foundation and contributors
|
|
@@ -32906,8 +32936,8 @@ function requireUtil$4 () {
|
|
|
32906
32936
|
return normalize(sourceURL);
|
|
32907
32937
|
}
|
|
32908
32938
|
exports.computeSourceURL = computeSourceURL;
|
|
32909
|
-
} (util$
|
|
32910
|
-
return util$
|
|
32939
|
+
} (util$4));
|
|
32940
|
+
return util$4;
|
|
32911
32941
|
}
|
|
32912
32942
|
|
|
32913
32943
|
var arraySet = {};
|
|
@@ -32925,7 +32955,7 @@ function requireArraySet () {
|
|
|
32925
32955
|
* http://opensource.org/licenses/BSD-3-Clause
|
|
32926
32956
|
*/
|
|
32927
32957
|
|
|
32928
|
-
var util = requireUtil$
|
|
32958
|
+
var util = requireUtil$3();
|
|
32929
32959
|
var has = Object.prototype.hasOwnProperty;
|
|
32930
32960
|
var hasNativeMap = typeof Map !== "undefined";
|
|
32931
32961
|
|
|
@@ -33057,7 +33087,7 @@ function requireMappingList () {
|
|
|
33057
33087
|
* http://opensource.org/licenses/BSD-3-Clause
|
|
33058
33088
|
*/
|
|
33059
33089
|
|
|
33060
|
-
var util = requireUtil$
|
|
33090
|
+
var util = requireUtil$3();
|
|
33061
33091
|
|
|
33062
33092
|
/**
|
|
33063
33093
|
* Determine whether mappingB is after mappingA with respect to generated
|
|
@@ -33146,7 +33176,7 @@ function requireSourceMapGenerator () {
|
|
|
33146
33176
|
*/
|
|
33147
33177
|
|
|
33148
33178
|
var base64VLQ = requireBase64Vlq();
|
|
33149
|
-
var util = requireUtil$
|
|
33179
|
+
var util = requireUtil$3();
|
|
33150
33180
|
var ArraySet = requireArraySet().ArraySet;
|
|
33151
33181
|
var MappingList = requireMappingList().MappingList;
|
|
33152
33182
|
|
|
@@ -33830,7 +33860,7 @@ function requireSourceMapConsumer () {
|
|
|
33830
33860
|
* http://opensource.org/licenses/BSD-3-Clause
|
|
33831
33861
|
*/
|
|
33832
33862
|
|
|
33833
|
-
var util = requireUtil$
|
|
33863
|
+
var util = requireUtil$3();
|
|
33834
33864
|
var binarySearch = requireBinarySearch();
|
|
33835
33865
|
var ArraySet = requireArraySet().ArraySet;
|
|
33836
33866
|
var base64VLQ = requireBase64Vlq();
|
|
@@ -34987,7 +35017,7 @@ function requireSourceNode () {
|
|
|
34987
35017
|
*/
|
|
34988
35018
|
|
|
34989
35019
|
var SourceMapGenerator = requireSourceMapGenerator().SourceMapGenerator;
|
|
34990
|
-
var util = requireUtil$
|
|
35020
|
+
var util = requireUtil$3();
|
|
34991
35021
|
|
|
34992
35022
|
// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
|
|
34993
35023
|
// operating systems these days (capturing the result).
|
|
@@ -36909,7 +36939,7 @@ function requireBrowser$c () {
|
|
|
36909
36939
|
}
|
|
36910
36940
|
}
|
|
36911
36941
|
if (typeof cb === "function") {
|
|
36912
|
-
return distExports
|
|
36942
|
+
return distExports.process.nextTick(function() {
|
|
36913
36943
|
cb(null, bytes);
|
|
36914
36944
|
});
|
|
36915
36945
|
}
|
|
@@ -37449,7 +37479,7 @@ function requireStreamBrowser$1 () {
|
|
|
37449
37479
|
return streamBrowser$1;
|
|
37450
37480
|
}
|
|
37451
37481
|
|
|
37452
|
-
var util$
|
|
37482
|
+
var util$3 = {};
|
|
37453
37483
|
|
|
37454
37484
|
var types$2 = {};
|
|
37455
37485
|
|
|
@@ -39644,11 +39674,11 @@ function requireIsBufferBrowser () {
|
|
|
39644
39674
|
return isBufferBrowser;
|
|
39645
39675
|
}
|
|
39646
39676
|
|
|
39647
|
-
var hasRequiredUtil$
|
|
39677
|
+
var hasRequiredUtil$2;
|
|
39648
39678
|
|
|
39649
|
-
function requireUtil$
|
|
39650
|
-
if (hasRequiredUtil$
|
|
39651
|
-
hasRequiredUtil$
|
|
39679
|
+
function requireUtil$2 () {
|
|
39680
|
+
if (hasRequiredUtil$2) return util$3;
|
|
39681
|
+
hasRequiredUtil$2 = 1;
|
|
39652
39682
|
(function (exports) {
|
|
39653
39683
|
var define_process_env_default = {};
|
|
39654
39684
|
var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors2(obj) {
|
|
@@ -39699,10 +39729,10 @@ function requireUtil$3 () {
|
|
|
39699
39729
|
return str;
|
|
39700
39730
|
};
|
|
39701
39731
|
exports.deprecate = function(fn, msg) {
|
|
39702
|
-
if (typeof distExports
|
|
39732
|
+
if (typeof distExports.process !== "undefined" && distExports.process.noDeprecation === true) {
|
|
39703
39733
|
return fn;
|
|
39704
39734
|
}
|
|
39705
|
-
if (typeof distExports
|
|
39735
|
+
if (typeof distExports.process === "undefined") {
|
|
39706
39736
|
return function() {
|
|
39707
39737
|
return exports.deprecate(fn, msg).apply(this, arguments);
|
|
39708
39738
|
};
|
|
@@ -39710,9 +39740,9 @@ function requireUtil$3 () {
|
|
|
39710
39740
|
var warned = false;
|
|
39711
39741
|
function deprecated() {
|
|
39712
39742
|
if (!warned) {
|
|
39713
|
-
if (distExports
|
|
39743
|
+
if (distExports.process.throwDeprecation) {
|
|
39714
39744
|
throw new Error(msg);
|
|
39715
|
-
} else if (distExports
|
|
39745
|
+
} else if (distExports.process.traceDeprecation) {
|
|
39716
39746
|
console.trace(msg);
|
|
39717
39747
|
} else {
|
|
39718
39748
|
console.error(msg);
|
|
@@ -39734,7 +39764,7 @@ function requireUtil$3 () {
|
|
|
39734
39764
|
set = set.toUpperCase();
|
|
39735
39765
|
if (!debugs[set]) {
|
|
39736
39766
|
if (debugEnvRegex.test(set)) {
|
|
39737
|
-
var pid = distExports
|
|
39767
|
+
var pid = distExports.process.pid;
|
|
39738
39768
|
debugs[set] = function() {
|
|
39739
39769
|
var msg = exports.format.apply(exports, arguments);
|
|
39740
39770
|
console.error("%s %d: %s", set, pid, msg);
|
|
@@ -40186,10 +40216,10 @@ function requireUtil$3 () {
|
|
|
40186
40216
|
};
|
|
40187
40217
|
original.apply(this, args).then(
|
|
40188
40218
|
function(ret) {
|
|
40189
|
-
distExports
|
|
40219
|
+
distExports.process.nextTick(cb.bind(null, null, ret));
|
|
40190
40220
|
},
|
|
40191
40221
|
function(rej) {
|
|
40192
|
-
distExports
|
|
40222
|
+
distExports.process.nextTick(callbackifyOnRejected.bind(null, rej, cb));
|
|
40193
40223
|
}
|
|
40194
40224
|
);
|
|
40195
40225
|
}
|
|
@@ -40201,8 +40231,8 @@ function requireUtil$3 () {
|
|
|
40201
40231
|
return callbackified;
|
|
40202
40232
|
}
|
|
40203
40233
|
exports.callbackify = callbackify;
|
|
40204
|
-
} (util$
|
|
40205
|
-
return util$
|
|
40234
|
+
} (util$3));
|
|
40235
|
+
return util$3;
|
|
40206
40236
|
}
|
|
40207
40237
|
|
|
40208
40238
|
var buffer_list;
|
|
@@ -40222,7 +40252,7 @@ function requireBuffer_list () {
|
|
|
40222
40252
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (String )(input); }
|
|
40223
40253
|
var _require = requireBufferPolyfill(),
|
|
40224
40254
|
Buffer = _require.Buffer;
|
|
40225
|
-
var _require2 = requireUtil$
|
|
40255
|
+
var _require2 = requireUtil$2(),
|
|
40226
40256
|
inspect = _require2.inspect;
|
|
40227
40257
|
var custom = inspect && inspect.custom || 'inspect';
|
|
40228
40258
|
function copyBuffer(src, target, offset) {
|
|
@@ -40413,10 +40443,10 @@ function requireDestroy$1 () {
|
|
|
40413
40443
|
cb(err);
|
|
40414
40444
|
} else if (err) {
|
|
40415
40445
|
if (!this._writableState) {
|
|
40416
|
-
distExports
|
|
40446
|
+
distExports.process.nextTick(emitErrorNT, this, err);
|
|
40417
40447
|
} else if (!this._writableState.errorEmitted) {
|
|
40418
40448
|
this._writableState.errorEmitted = true;
|
|
40419
|
-
distExports
|
|
40449
|
+
distExports.process.nextTick(emitErrorNT, this, err);
|
|
40420
40450
|
}
|
|
40421
40451
|
}
|
|
40422
40452
|
return this;
|
|
@@ -40436,18 +40466,18 @@ function requireDestroy$1 () {
|
|
|
40436
40466
|
this._destroy(err || null, function (err) {
|
|
40437
40467
|
if (!cb && err) {
|
|
40438
40468
|
if (!_this._writableState) {
|
|
40439
|
-
distExports
|
|
40469
|
+
distExports.process.nextTick(emitErrorAndCloseNT, _this, err);
|
|
40440
40470
|
} else if (!_this._writableState.errorEmitted) {
|
|
40441
40471
|
_this._writableState.errorEmitted = true;
|
|
40442
|
-
distExports
|
|
40472
|
+
distExports.process.nextTick(emitErrorAndCloseNT, _this, err);
|
|
40443
40473
|
} else {
|
|
40444
|
-
distExports
|
|
40474
|
+
distExports.process.nextTick(emitCloseNT, _this);
|
|
40445
40475
|
}
|
|
40446
40476
|
} else if (cb) {
|
|
40447
|
-
distExports
|
|
40477
|
+
distExports.process.nextTick(emitCloseNT, _this);
|
|
40448
40478
|
cb(err);
|
|
40449
40479
|
} else {
|
|
40450
|
-
distExports
|
|
40480
|
+
distExports.process.nextTick(emitCloseNT, _this);
|
|
40451
40481
|
}
|
|
40452
40482
|
});
|
|
40453
40483
|
return this;
|
|
@@ -40833,7 +40863,7 @@ function require_stream_writable$1 () {
|
|
|
40833
40863
|
function writeAfterEnd(stream, cb) {
|
|
40834
40864
|
var er = new ERR_STREAM_WRITE_AFTER_END();
|
|
40835
40865
|
errorOrDestroy(stream, er);
|
|
40836
|
-
distExports
|
|
40866
|
+
distExports.process.nextTick(cb, er);
|
|
40837
40867
|
}
|
|
40838
40868
|
function validChunk(stream, state, chunk, cb) {
|
|
40839
40869
|
var er;
|
|
@@ -40844,7 +40874,7 @@ function require_stream_writable$1 () {
|
|
|
40844
40874
|
}
|
|
40845
40875
|
if (er) {
|
|
40846
40876
|
errorOrDestroy(stream, er);
|
|
40847
|
-
distExports
|
|
40877
|
+
distExports.process.nextTick(cb, er);
|
|
40848
40878
|
return false;
|
|
40849
40879
|
}
|
|
40850
40880
|
return true;
|
|
@@ -40956,8 +40986,8 @@ function require_stream_writable$1 () {
|
|
|
40956
40986
|
function onwriteError(stream, state, sync, er, cb) {
|
|
40957
40987
|
--state.pendingcb;
|
|
40958
40988
|
if (sync) {
|
|
40959
|
-
distExports
|
|
40960
|
-
distExports
|
|
40989
|
+
distExports.process.nextTick(cb, er);
|
|
40990
|
+
distExports.process.nextTick(finishMaybe, stream, state);
|
|
40961
40991
|
stream._writableState.errorEmitted = true;
|
|
40962
40992
|
errorOrDestroy(stream, er);
|
|
40963
40993
|
} else {
|
|
@@ -40986,7 +41016,7 @@ function require_stream_writable$1 () {
|
|
|
40986
41016
|
clearBuffer(stream, state);
|
|
40987
41017
|
}
|
|
40988
41018
|
if (sync) {
|
|
40989
|
-
distExports
|
|
41019
|
+
distExports.process.nextTick(afterWrite, stream, state, finished, cb);
|
|
40990
41020
|
} else {
|
|
40991
41021
|
afterWrite(stream, state, finished, cb);
|
|
40992
41022
|
}
|
|
@@ -41099,7 +41129,7 @@ function require_stream_writable$1 () {
|
|
|
41099
41129
|
if (typeof stream._final === "function" && !state.destroyed) {
|
|
41100
41130
|
state.pendingcb++;
|
|
41101
41131
|
state.finalCalled = true;
|
|
41102
|
-
distExports
|
|
41132
|
+
distExports.process.nextTick(callFinal, stream, state);
|
|
41103
41133
|
} else {
|
|
41104
41134
|
state.prefinished = true;
|
|
41105
41135
|
stream.emit("prefinish");
|
|
@@ -41127,7 +41157,7 @@ function require_stream_writable$1 () {
|
|
|
41127
41157
|
state.ending = true;
|
|
41128
41158
|
finishMaybe(stream, state);
|
|
41129
41159
|
if (cb) {
|
|
41130
|
-
if (state.finished) distExports
|
|
41160
|
+
if (state.finished) distExports.process.nextTick(cb);
|
|
41131
41161
|
else stream.once("finish", cb);
|
|
41132
41162
|
}
|
|
41133
41163
|
state.ended = true;
|
|
@@ -41246,7 +41276,7 @@ function require_stream_duplex$1 () {
|
|
|
41246
41276
|
|
|
41247
41277
|
// no more data can be written.
|
|
41248
41278
|
// But allow more writes to happen in this tick.
|
|
41249
|
-
distExports
|
|
41279
|
+
distExports.process.nextTick(onEndNT, this);
|
|
41250
41280
|
}
|
|
41251
41281
|
function onEndNT(self) {
|
|
41252
41282
|
self.end();
|
|
@@ -41695,7 +41725,7 @@ function requireAsync_iterator () {
|
|
|
41695
41725
|
function onReadable(iter) {
|
|
41696
41726
|
// we wait for the next tick, because it might
|
|
41697
41727
|
// emit an error with process.nextTick
|
|
41698
|
-
distExports
|
|
41728
|
+
distExports.process.nextTick(readAndResolve, iter);
|
|
41699
41729
|
}
|
|
41700
41730
|
function wrapForNext(lastPromise, iter) {
|
|
41701
41731
|
return function (resolve, reject) {
|
|
@@ -41730,7 +41760,7 @@ function requireAsync_iterator () {
|
|
|
41730
41760
|
// we cannot guarantee that there is no error lingering around
|
|
41731
41761
|
// waiting to be emitted.
|
|
41732
41762
|
return new Promise(function (resolve, reject) {
|
|
41733
|
-
distExports
|
|
41763
|
+
distExports.process.nextTick(function () {
|
|
41734
41764
|
if (_this[kError]) {
|
|
41735
41765
|
reject(_this[kError]);
|
|
41736
41766
|
} else {
|
|
@@ -41875,7 +41905,7 @@ function require_stream_readable$1 () {
|
|
|
41875
41905
|
function _isUint8Array(obj) {
|
|
41876
41906
|
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
|
41877
41907
|
}
|
|
41878
|
-
var debugUtil = requireUtil$
|
|
41908
|
+
var debugUtil = requireUtil$2();
|
|
41879
41909
|
var debug;
|
|
41880
41910
|
if (debugUtil && debugUtil.debuglog) {
|
|
41881
41911
|
debug = debugUtil.debuglog("stream");
|
|
@@ -42176,7 +42206,7 @@ function require_stream_readable$1 () {
|
|
|
42176
42206
|
if (!state.emittedReadable) {
|
|
42177
42207
|
debug("emitReadable", state.flowing);
|
|
42178
42208
|
state.emittedReadable = true;
|
|
42179
|
-
distExports
|
|
42209
|
+
distExports.process.nextTick(emitReadable_, stream);
|
|
42180
42210
|
}
|
|
42181
42211
|
}
|
|
42182
42212
|
function emitReadable_(stream) {
|
|
@@ -42192,7 +42222,7 @@ function require_stream_readable$1 () {
|
|
|
42192
42222
|
function maybeReadMore(stream, state) {
|
|
42193
42223
|
if (!state.readingMore) {
|
|
42194
42224
|
state.readingMore = true;
|
|
42195
|
-
distExports
|
|
42225
|
+
distExports.process.nextTick(maybeReadMore_, stream, state);
|
|
42196
42226
|
}
|
|
42197
42227
|
}
|
|
42198
42228
|
function maybeReadMore_(stream, state) {
|
|
@@ -42224,9 +42254,9 @@ function require_stream_readable$1 () {
|
|
|
42224
42254
|
}
|
|
42225
42255
|
state.pipesCount += 1;
|
|
42226
42256
|
debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);
|
|
42227
|
-
var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== distExports
|
|
42257
|
+
var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== distExports.process.stdout && dest !== distExports.process.stderr;
|
|
42228
42258
|
var endFn = doEnd ? onend : unpipe;
|
|
42229
|
-
if (state.endEmitted) distExports
|
|
42259
|
+
if (state.endEmitted) distExports.process.nextTick(endFn);
|
|
42230
42260
|
else src.once("end", endFn);
|
|
42231
42261
|
dest.on("unpipe", onunpipe);
|
|
42232
42262
|
function onunpipe(readable, unpipeInfo) {
|
|
@@ -42360,7 +42390,7 @@ function require_stream_readable$1 () {
|
|
|
42360
42390
|
if (state.length) {
|
|
42361
42391
|
emitReadable(this);
|
|
42362
42392
|
} else if (!state.reading) {
|
|
42363
|
-
distExports
|
|
42393
|
+
distExports.process.nextTick(nReadingNextTick, this);
|
|
42364
42394
|
}
|
|
42365
42395
|
}
|
|
42366
42396
|
}
|
|
@@ -42370,14 +42400,14 @@ function require_stream_readable$1 () {
|
|
|
42370
42400
|
Readable.prototype.removeListener = function(ev, fn) {
|
|
42371
42401
|
var res = Stream.prototype.removeListener.call(this, ev, fn);
|
|
42372
42402
|
if (ev === "readable") {
|
|
42373
|
-
distExports
|
|
42403
|
+
distExports.process.nextTick(updateReadableListening, this);
|
|
42374
42404
|
}
|
|
42375
42405
|
return res;
|
|
42376
42406
|
};
|
|
42377
42407
|
Readable.prototype.removeAllListeners = function(ev) {
|
|
42378
42408
|
var res = Stream.prototype.removeAllListeners.apply(this, arguments);
|
|
42379
42409
|
if (ev === "readable" || ev === void 0) {
|
|
42380
|
-
distExports
|
|
42410
|
+
distExports.process.nextTick(updateReadableListening, this);
|
|
42381
42411
|
}
|
|
42382
42412
|
return res;
|
|
42383
42413
|
};
|
|
@@ -42407,7 +42437,7 @@ function require_stream_readable$1 () {
|
|
|
42407
42437
|
function resume(stream, state) {
|
|
42408
42438
|
if (!state.resumeScheduled) {
|
|
42409
42439
|
state.resumeScheduled = true;
|
|
42410
|
-
distExports
|
|
42440
|
+
distExports.process.nextTick(resume_, stream, state);
|
|
42411
42441
|
}
|
|
42412
42442
|
}
|
|
42413
42443
|
function resume_(stream, state) {
|
|
@@ -42548,7 +42578,7 @@ function require_stream_readable$1 () {
|
|
|
42548
42578
|
debug("endReadable", state.endEmitted);
|
|
42549
42579
|
if (!state.endEmitted) {
|
|
42550
42580
|
state.ended = true;
|
|
42551
|
-
distExports
|
|
42581
|
+
distExports.process.nextTick(endReadableNT, state, stream);
|
|
42552
42582
|
}
|
|
42553
42583
|
}
|
|
42554
42584
|
function endReadableNT(state, stream) {
|
|
@@ -45110,7 +45140,7 @@ function requireDefaultEncoding () {
|
|
|
45110
45140
|
if (globalThis.process && globalThis.process.browser) {
|
|
45111
45141
|
defaultEncoding = "utf-8";
|
|
45112
45142
|
} else if (globalThis.process && globalThis.process.version) {
|
|
45113
|
-
var pVersionMajor = parseInt(distExports
|
|
45143
|
+
var pVersionMajor = parseInt(distExports.process.version.split(".")[0].slice(1), 10);
|
|
45114
45144
|
defaultEncoding = pVersionMajor >= 6 ? "utf-8" : "binary";
|
|
45115
45145
|
} else {
|
|
45116
45146
|
defaultEncoding = "utf-8";
|
|
@@ -45126,7 +45156,7 @@ function requireMakeHash () {
|
|
|
45126
45156
|
if (hasRequiredMakeHash) return makeHash;
|
|
45127
45157
|
hasRequiredMakeHash = 1;
|
|
45128
45158
|
var intSize = 4;
|
|
45129
|
-
var zeroBuffer = new distExports
|
|
45159
|
+
var zeroBuffer = new distExports.Buffer(intSize);
|
|
45130
45160
|
zeroBuffer.fill(0);
|
|
45131
45161
|
|
|
45132
45162
|
var charSize = 8;
|
|
@@ -45135,7 +45165,7 @@ function requireMakeHash () {
|
|
|
45135
45165
|
function toArray (buf) {
|
|
45136
45166
|
if ((buf.length % intSize) !== 0) {
|
|
45137
45167
|
var len = buf.length + (intSize - (buf.length % intSize));
|
|
45138
|
-
buf = distExports
|
|
45168
|
+
buf = distExports.Buffer.concat([buf, zeroBuffer], len);
|
|
45139
45169
|
}
|
|
45140
45170
|
|
|
45141
45171
|
var arr = new Array(buf.length >>> 2);
|
|
@@ -45148,7 +45178,7 @@ function requireMakeHash () {
|
|
|
45148
45178
|
|
|
45149
45179
|
makeHash = function hash (buf, fn) {
|
|
45150
45180
|
var arr = fn(toArray(buf), buf.length * charSize);
|
|
45151
|
-
buf = new distExports
|
|
45181
|
+
buf = new distExports.Buffer(hashSize);
|
|
45152
45182
|
for (var i = 0; i < arr.length; i++) {
|
|
45153
45183
|
buf.writeInt32LE(arr[i], i << 2, true);
|
|
45154
45184
|
}
|
|
@@ -45328,7 +45358,7 @@ function requireHashBase () {
|
|
|
45328
45358
|
function HashBase (blockSize) {
|
|
45329
45359
|
Transform.call(this);
|
|
45330
45360
|
|
|
45331
|
-
this._block = new distExports
|
|
45361
|
+
this._block = new distExports.Buffer(blockSize);
|
|
45332
45362
|
this._blockSize = blockSize;
|
|
45333
45363
|
this._blockOffset = 0;
|
|
45334
45364
|
this._length = [0, 0, 0, 0];
|
|
@@ -45341,7 +45371,7 @@ function requireHashBase () {
|
|
|
45341
45371
|
HashBase.prototype._transform = function (chunk, encoding, callback) {
|
|
45342
45372
|
var error = null;
|
|
45343
45373
|
try {
|
|
45344
|
-
if (encoding !== 'buffer') chunk = new distExports
|
|
45374
|
+
if (encoding !== 'buffer') chunk = new distExports.Buffer(chunk, encoding);
|
|
45345
45375
|
this.update(chunk);
|
|
45346
45376
|
} catch (err) {
|
|
45347
45377
|
error = err;
|
|
@@ -45362,9 +45392,9 @@ function requireHashBase () {
|
|
|
45362
45392
|
};
|
|
45363
45393
|
|
|
45364
45394
|
HashBase.prototype.update = function (data, encoding) {
|
|
45365
|
-
if (!distExports
|
|
45395
|
+
if (!distExports.Buffer.isBuffer(data) && typeof data !== 'string') throw new TypeError('Data must be a string or a buffer')
|
|
45366
45396
|
if (this._finalized) throw new Error('Digest already called')
|
|
45367
|
-
if (!distExports
|
|
45397
|
+
if (!distExports.Buffer.isBuffer(data)) data = new distExports.Buffer(data, encoding || 'binary');
|
|
45368
45398
|
|
|
45369
45399
|
// consume data
|
|
45370
45400
|
var block = this._block;
|
|
@@ -45669,7 +45699,7 @@ function requireRipemd160 () {
|
|
|
45669
45699
|
this._update();
|
|
45670
45700
|
|
|
45671
45701
|
// produce result
|
|
45672
|
-
var buffer = new distExports
|
|
45702
|
+
var buffer = new distExports.Buffer(20);
|
|
45673
45703
|
buffer.writeInt32LE(this._a, 0);
|
|
45674
45704
|
buffer.writeInt32LE(this._b, 4);
|
|
45675
45705
|
buffer.writeInt32LE(this._c, 8);
|
|
@@ -46845,7 +46875,7 @@ function requireBufferXor () {
|
|
|
46845
46875
|
hasRequiredBufferXor = 1;
|
|
46846
46876
|
bufferXor = function xor (a, b) {
|
|
46847
46877
|
var length = Math.min(a.length, b.length);
|
|
46848
|
-
var buffer = new distExports
|
|
46878
|
+
var buffer = new distExports.Buffer(length);
|
|
46849
46879
|
|
|
46850
46880
|
for (var i = 0; i < length; ++i) {
|
|
46851
46881
|
buffer[i] = a[i] ^ b[i];
|
|
@@ -47027,7 +47057,7 @@ function requireOfb () {
|
|
|
47027
47057
|
|
|
47028
47058
|
ofb.encrypt = function (self, chunk) {
|
|
47029
47059
|
while (self._cache.length < chunk.length) {
|
|
47030
|
-
self._cache = distExports
|
|
47060
|
+
self._cache = distExports.Buffer.concat([self._cache, getBlock(self)]);
|
|
47031
47061
|
}
|
|
47032
47062
|
|
|
47033
47063
|
var pad = self._cache.slice(0, chunk.length);
|
|
@@ -55371,8 +55401,8 @@ function requireDh () {
|
|
|
55371
55401
|
|
|
55372
55402
|
function setPublicKey(pub, enc) {
|
|
55373
55403
|
enc = enc || 'utf8';
|
|
55374
|
-
if (!distExports
|
|
55375
|
-
pub = new distExports
|
|
55404
|
+
if (!distExports.Buffer.isBuffer(pub)) {
|
|
55405
|
+
pub = new distExports.Buffer(pub, enc);
|
|
55376
55406
|
}
|
|
55377
55407
|
this._pub = new BN(pub);
|
|
55378
55408
|
return this;
|
|
@@ -55380,8 +55410,8 @@ function requireDh () {
|
|
|
55380
55410
|
|
|
55381
55411
|
function setPrivateKey(priv, enc) {
|
|
55382
55412
|
enc = enc || 'utf8';
|
|
55383
|
-
if (!distExports
|
|
55384
|
-
priv = new distExports
|
|
55413
|
+
if (!distExports.Buffer.isBuffer(priv)) {
|
|
55414
|
+
priv = new distExports.Buffer(priv, enc);
|
|
55385
55415
|
}
|
|
55386
55416
|
this._priv = new BN(priv);
|
|
55387
55417
|
return this;
|
|
@@ -55477,12 +55507,12 @@ function requireDh () {
|
|
|
55477
55507
|
other = new BN(other);
|
|
55478
55508
|
other = other.toRed(this._prime);
|
|
55479
55509
|
var secret = other.redPow(this._priv).fromRed();
|
|
55480
|
-
var out = new distExports
|
|
55510
|
+
var out = new distExports.Buffer(secret.toArray());
|
|
55481
55511
|
var prime = this.getPrime();
|
|
55482
55512
|
if (out.length < prime.length) {
|
|
55483
|
-
var front = new distExports
|
|
55513
|
+
var front = new distExports.Buffer(prime.length - out.length);
|
|
55484
55514
|
front.fill(0);
|
|
55485
|
-
out = distExports
|
|
55515
|
+
out = distExports.Buffer.concat([front, out]);
|
|
55486
55516
|
}
|
|
55487
55517
|
return out;
|
|
55488
55518
|
};
|
|
@@ -55505,8 +55535,8 @@ function requireDh () {
|
|
|
55505
55535
|
|
|
55506
55536
|
DH.prototype.setGenerator = function (gen, enc) {
|
|
55507
55537
|
enc = enc || 'utf8';
|
|
55508
|
-
if (!distExports
|
|
55509
|
-
gen = new distExports
|
|
55538
|
+
if (!distExports.Buffer.isBuffer(gen)) {
|
|
55539
|
+
gen = new distExports.Buffer(gen, enc);
|
|
55510
55540
|
}
|
|
55511
55541
|
this.__gen = gen;
|
|
55512
55542
|
this._gen = new BN(gen);
|
|
@@ -55514,7 +55544,7 @@ function requireDh () {
|
|
|
55514
55544
|
};
|
|
55515
55545
|
|
|
55516
55546
|
function formatReturnValue(bn, enc) {
|
|
55517
|
-
var buf = new distExports
|
|
55547
|
+
var buf = new distExports.Buffer(bn.toArray());
|
|
55518
55548
|
if (!enc) {
|
|
55519
55549
|
return buf;
|
|
55520
55550
|
} else {
|
|
@@ -55535,8 +55565,8 @@ function requireBrowser$5 () {
|
|
|
55535
55565
|
var DH = requireDh();
|
|
55536
55566
|
|
|
55537
55567
|
function getDiffieHellman (mod) {
|
|
55538
|
-
var prime = new distExports
|
|
55539
|
-
var gen = new distExports
|
|
55568
|
+
var prime = new distExports.Buffer(primes[mod].prime, 'hex');
|
|
55569
|
+
var gen = new distExports.Buffer(primes[mod].gen, 'hex');
|
|
55540
55570
|
|
|
55541
55571
|
return new DH(prime, gen)
|
|
55542
55572
|
}
|
|
@@ -55546,24 +55576,24 @@ function requireBrowser$5 () {
|
|
|
55546
55576
|
};
|
|
55547
55577
|
|
|
55548
55578
|
function createDiffieHellman (prime, enc, generator, genc) {
|
|
55549
|
-
if (distExports
|
|
55579
|
+
if (distExports.Buffer.isBuffer(enc) || ENCODINGS[enc] === undefined) {
|
|
55550
55580
|
return createDiffieHellman(prime, 'binary', enc, generator)
|
|
55551
55581
|
}
|
|
55552
55582
|
|
|
55553
55583
|
enc = enc || 'binary';
|
|
55554
55584
|
genc = genc || 'binary';
|
|
55555
|
-
generator = generator || new distExports
|
|
55585
|
+
generator = generator || new distExports.Buffer([2]);
|
|
55556
55586
|
|
|
55557
|
-
if (!distExports
|
|
55558
|
-
generator = new distExports
|
|
55587
|
+
if (!distExports.Buffer.isBuffer(generator)) {
|
|
55588
|
+
generator = new distExports.Buffer(generator, genc);
|
|
55559
55589
|
}
|
|
55560
55590
|
|
|
55561
55591
|
if (typeof prime === 'number') {
|
|
55562
55592
|
return new DH(generatePrime(prime, generator), generator, true)
|
|
55563
55593
|
}
|
|
55564
55594
|
|
|
55565
|
-
if (!distExports
|
|
55566
|
-
prime = new distExports
|
|
55595
|
+
if (!distExports.Buffer.isBuffer(prime)) {
|
|
55596
|
+
prime = new distExports.Buffer(prime, enc);
|
|
55567
55597
|
}
|
|
55568
55598
|
|
|
55569
55599
|
return new DH(prime, generator, true)
|
|
@@ -55584,13 +55614,13 @@ function requireProcessNextickArgs () {
|
|
|
55584
55614
|
if (hasRequiredProcessNextickArgs) return processNextickArgs.exports;
|
|
55585
55615
|
hasRequiredProcessNextickArgs = 1;
|
|
55586
55616
|
|
|
55587
|
-
if (typeof distExports
|
|
55588
|
-
!distExports
|
|
55589
|
-
distExports
|
|
55590
|
-
distExports
|
|
55617
|
+
if (typeof distExports.process === 'undefined' ||
|
|
55618
|
+
!distExports.process.version ||
|
|
55619
|
+
distExports.process.version.indexOf('v0.') === 0 ||
|
|
55620
|
+
distExports.process.version.indexOf('v1.') === 0 && distExports.process.version.indexOf('v1.8.') !== 0) {
|
|
55591
55621
|
processNextickArgs.exports = { nextTick: nextTick };
|
|
55592
55622
|
} else {
|
|
55593
|
-
processNextickArgs.exports = distExports
|
|
55623
|
+
processNextickArgs.exports = distExports.process;
|
|
55594
55624
|
}
|
|
55595
55625
|
|
|
55596
55626
|
function nextTick(fn, arg1, arg2, arg3) {
|
|
@@ -55602,17 +55632,17 @@ function requireProcessNextickArgs () {
|
|
|
55602
55632
|
switch (len) {
|
|
55603
55633
|
case 0:
|
|
55604
55634
|
case 1:
|
|
55605
|
-
return distExports
|
|
55635
|
+
return distExports.process.nextTick(fn);
|
|
55606
55636
|
case 2:
|
|
55607
|
-
return distExports
|
|
55637
|
+
return distExports.process.nextTick(function afterTickOne() {
|
|
55608
55638
|
fn.call(null, arg1);
|
|
55609
55639
|
});
|
|
55610
55640
|
case 3:
|
|
55611
|
-
return distExports
|
|
55641
|
+
return distExports.process.nextTick(function afterTickTwo() {
|
|
55612
55642
|
fn.call(null, arg1, arg2);
|
|
55613
55643
|
});
|
|
55614
55644
|
case 4:
|
|
55615
|
-
return distExports
|
|
55645
|
+
return distExports.process.nextTick(function afterTickThree() {
|
|
55616
55646
|
fn.call(null, arg1, arg2, arg3);
|
|
55617
55647
|
});
|
|
55618
55648
|
default:
|
|
@@ -55621,7 +55651,7 @@ function requireProcessNextickArgs () {
|
|
|
55621
55651
|
while (i < args.length) {
|
|
55622
55652
|
args[i++] = arguments[i];
|
|
55623
55653
|
}
|
|
55624
|
-
return distExports
|
|
55654
|
+
return distExports.process.nextTick(function afterTick() {
|
|
55625
55655
|
fn.apply(null, args);
|
|
55626
55656
|
});
|
|
55627
55657
|
}
|
|
@@ -55728,13 +55758,13 @@ function requireSafeBuffer () {
|
|
|
55728
55758
|
return safeBuffer.exports;
|
|
55729
55759
|
}
|
|
55730
55760
|
|
|
55731
|
-
var util$
|
|
55761
|
+
var util$2 = {};
|
|
55732
55762
|
|
|
55733
|
-
var hasRequiredUtil$
|
|
55763
|
+
var hasRequiredUtil$1;
|
|
55734
55764
|
|
|
55735
|
-
function requireUtil$
|
|
55736
|
-
if (hasRequiredUtil$
|
|
55737
|
-
hasRequiredUtil$
|
|
55765
|
+
function requireUtil$1 () {
|
|
55766
|
+
if (hasRequiredUtil$1) return util$2;
|
|
55767
|
+
hasRequiredUtil$1 = 1;
|
|
55738
55768
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
55739
55769
|
//
|
|
55740
55770
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
@@ -55765,67 +55795,67 @@ function requireUtil$2 () {
|
|
|
55765
55795
|
}
|
|
55766
55796
|
return objectToString(arg) === '[object Array]';
|
|
55767
55797
|
}
|
|
55768
|
-
util$
|
|
55798
|
+
util$2.isArray = isArray;
|
|
55769
55799
|
|
|
55770
55800
|
function isBoolean(arg) {
|
|
55771
55801
|
return typeof arg === 'boolean';
|
|
55772
55802
|
}
|
|
55773
|
-
util$
|
|
55803
|
+
util$2.isBoolean = isBoolean;
|
|
55774
55804
|
|
|
55775
55805
|
function isNull(arg) {
|
|
55776
55806
|
return arg === null;
|
|
55777
55807
|
}
|
|
55778
|
-
util$
|
|
55808
|
+
util$2.isNull = isNull;
|
|
55779
55809
|
|
|
55780
55810
|
function isNullOrUndefined(arg) {
|
|
55781
55811
|
return arg == null;
|
|
55782
55812
|
}
|
|
55783
|
-
util$
|
|
55813
|
+
util$2.isNullOrUndefined = isNullOrUndefined;
|
|
55784
55814
|
|
|
55785
55815
|
function isNumber(arg) {
|
|
55786
55816
|
return typeof arg === 'number';
|
|
55787
55817
|
}
|
|
55788
|
-
util$
|
|
55818
|
+
util$2.isNumber = isNumber;
|
|
55789
55819
|
|
|
55790
55820
|
function isString(arg) {
|
|
55791
55821
|
return typeof arg === 'string';
|
|
55792
55822
|
}
|
|
55793
|
-
util$
|
|
55823
|
+
util$2.isString = isString;
|
|
55794
55824
|
|
|
55795
55825
|
function isSymbol(arg) {
|
|
55796
55826
|
return typeof arg === 'symbol';
|
|
55797
55827
|
}
|
|
55798
|
-
util$
|
|
55828
|
+
util$2.isSymbol = isSymbol;
|
|
55799
55829
|
|
|
55800
55830
|
function isUndefined(arg) {
|
|
55801
55831
|
return arg === void 0;
|
|
55802
55832
|
}
|
|
55803
|
-
util$
|
|
55833
|
+
util$2.isUndefined = isUndefined;
|
|
55804
55834
|
|
|
55805
55835
|
function isRegExp(re) {
|
|
55806
55836
|
return objectToString(re) === '[object RegExp]';
|
|
55807
55837
|
}
|
|
55808
|
-
util$
|
|
55838
|
+
util$2.isRegExp = isRegExp;
|
|
55809
55839
|
|
|
55810
55840
|
function isObject(arg) {
|
|
55811
55841
|
return typeof arg === 'object' && arg !== null;
|
|
55812
55842
|
}
|
|
55813
|
-
util$
|
|
55843
|
+
util$2.isObject = isObject;
|
|
55814
55844
|
|
|
55815
55845
|
function isDate(d) {
|
|
55816
55846
|
return objectToString(d) === '[object Date]';
|
|
55817
55847
|
}
|
|
55818
|
-
util$
|
|
55848
|
+
util$2.isDate = isDate;
|
|
55819
55849
|
|
|
55820
55850
|
function isError(e) {
|
|
55821
55851
|
return (objectToString(e) === '[object Error]' || e instanceof Error);
|
|
55822
55852
|
}
|
|
55823
|
-
util$
|
|
55853
|
+
util$2.isError = isError;
|
|
55824
55854
|
|
|
55825
55855
|
function isFunction(arg) {
|
|
55826
55856
|
return typeof arg === 'function';
|
|
55827
55857
|
}
|
|
55828
|
-
util$
|
|
55858
|
+
util$2.isFunction = isFunction;
|
|
55829
55859
|
|
|
55830
55860
|
function isPrimitive(arg) {
|
|
55831
55861
|
return arg === null ||
|
|
@@ -55835,14 +55865,14 @@ function requireUtil$2 () {
|
|
|
55835
55865
|
typeof arg === 'symbol' || // ES6 symbol
|
|
55836
55866
|
typeof arg === 'undefined';
|
|
55837
55867
|
}
|
|
55838
|
-
util$
|
|
55868
|
+
util$2.isPrimitive = isPrimitive;
|
|
55839
55869
|
|
|
55840
|
-
util$
|
|
55870
|
+
util$2.isBuffer = requireBufferPolyfill().Buffer.isBuffer;
|
|
55841
55871
|
|
|
55842
55872
|
function objectToString(o) {
|
|
55843
55873
|
return Object.prototype.toString.call(o);
|
|
55844
55874
|
}
|
|
55845
|
-
return util$
|
|
55875
|
+
return util$2;
|
|
55846
55876
|
}
|
|
55847
55877
|
|
|
55848
55878
|
var BufferList = {exports: {}};
|
|
@@ -55857,7 +55887,7 @@ function requireBufferList () {
|
|
|
55857
55887
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
55858
55888
|
|
|
55859
55889
|
var Buffer = requireSafeBuffer().Buffer;
|
|
55860
|
-
var util = requireUtil$
|
|
55890
|
+
var util = requireUtil$2();
|
|
55861
55891
|
|
|
55862
55892
|
function copyBuffer(src, target, offset) {
|
|
55863
55893
|
src.copy(target, offset);
|
|
@@ -56045,7 +56075,7 @@ function require_stream_writable () {
|
|
|
56045
56075
|
var asyncWrite = pna.nextTick;
|
|
56046
56076
|
var Duplex;
|
|
56047
56077
|
Writable.WritableState = WritableState;
|
|
56048
|
-
var util = Object.create(requireUtil$
|
|
56078
|
+
var util = Object.create(requireUtil$1());
|
|
56049
56079
|
util.inherits = requireInherits_browser();
|
|
56050
56080
|
var internalUtil = {
|
|
56051
56081
|
deprecate: requireBrowser$b()
|
|
@@ -56492,7 +56522,7 @@ function require_stream_duplex () {
|
|
|
56492
56522
|
_stream_duplex = Duplex;
|
|
56493
56523
|
|
|
56494
56524
|
/*<replacement>*/
|
|
56495
|
-
var util = Object.create(requireUtil$
|
|
56525
|
+
var util = Object.create(requireUtil$1());
|
|
56496
56526
|
util.inherits = requireInherits_browser();
|
|
56497
56527
|
/*</replacement>*/
|
|
56498
56528
|
|
|
@@ -56606,9 +56636,9 @@ function require_stream_readable () {
|
|
|
56606
56636
|
function _isUint8Array(obj) {
|
|
56607
56637
|
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
|
56608
56638
|
}
|
|
56609
|
-
var util = Object.create(requireUtil$
|
|
56639
|
+
var util = Object.create(requireUtil$1());
|
|
56610
56640
|
util.inherits = requireInherits_browser();
|
|
56611
|
-
var debugUtil = requireUtil$
|
|
56641
|
+
var debugUtil = requireUtil$2();
|
|
56612
56642
|
var debug = void 0;
|
|
56613
56643
|
if (debugUtil && debugUtil.debuglog) {
|
|
56614
56644
|
debug = debugUtil.debuglog("stream");
|
|
@@ -56926,7 +56956,7 @@ function require_stream_readable () {
|
|
|
56926
56956
|
}
|
|
56927
56957
|
state.pipesCount += 1;
|
|
56928
56958
|
debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);
|
|
56929
|
-
var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== distExports
|
|
56959
|
+
var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== distExports.process.stdout && dest !== distExports.process.stderr;
|
|
56930
56960
|
var endFn = doEnd ? onend : unpipe;
|
|
56931
56961
|
if (state.endEmitted) pna.nextTick(endFn);
|
|
56932
56962
|
else src.once("end", endFn);
|
|
@@ -57281,7 +57311,7 @@ function require_stream_transform () {
|
|
|
57281
57311
|
var Duplex = require_stream_duplex();
|
|
57282
57312
|
|
|
57283
57313
|
/*<replacement>*/
|
|
57284
|
-
var util = Object.create(requireUtil$
|
|
57314
|
+
var util = Object.create(requireUtil$1());
|
|
57285
57315
|
util.inherits = requireInherits_browser();
|
|
57286
57316
|
/*</replacement>*/
|
|
57287
57317
|
|
|
@@ -57440,7 +57470,7 @@ function require_stream_passthrough () {
|
|
|
57440
57470
|
var Transform = require_stream_transform();
|
|
57441
57471
|
|
|
57442
57472
|
/*<replacement>*/
|
|
57443
|
-
var util = Object.create(requireUtil$
|
|
57473
|
+
var util = Object.create(requireUtil$1());
|
|
57444
57474
|
util.inherits = requireInherits_browser();
|
|
57445
57475
|
/*</replacement>*/
|
|
57446
57476
|
|
|
@@ -79650,8 +79680,8 @@ function requireBrowser$3 () {
|
|
|
79650
79680
|
|
|
79651
79681
|
ECDH.prototype.computeSecret = function (other, inenc, enc) {
|
|
79652
79682
|
inenc = inenc || 'utf8';
|
|
79653
|
-
if (!distExports
|
|
79654
|
-
other = new distExports
|
|
79683
|
+
if (!distExports.Buffer.isBuffer(other)) {
|
|
79684
|
+
other = new distExports.Buffer(other, inenc);
|
|
79655
79685
|
}
|
|
79656
79686
|
var otherPub = this.curve.keyFromPublic(other).getPublic();
|
|
79657
79687
|
var out = otherPub.mul(this.keys.getPrivate()).getX();
|
|
@@ -79676,8 +79706,8 @@ function requireBrowser$3 () {
|
|
|
79676
79706
|
|
|
79677
79707
|
ECDH.prototype.setPublicKey = function (pub, enc) {
|
|
79678
79708
|
enc = enc || 'utf8';
|
|
79679
|
-
if (!distExports
|
|
79680
|
-
pub = new distExports
|
|
79709
|
+
if (!distExports.Buffer.isBuffer(pub)) {
|
|
79710
|
+
pub = new distExports.Buffer(pub, enc);
|
|
79681
79711
|
}
|
|
79682
79712
|
this.keys._importPublic(pub);
|
|
79683
79713
|
return this
|
|
@@ -79685,8 +79715,8 @@ function requireBrowser$3 () {
|
|
|
79685
79715
|
|
|
79686
79716
|
ECDH.prototype.setPrivateKey = function (priv, enc) {
|
|
79687
79717
|
enc = enc || 'utf8';
|
|
79688
|
-
if (!distExports
|
|
79689
|
-
priv = new distExports
|
|
79718
|
+
if (!distExports.Buffer.isBuffer(priv)) {
|
|
79719
|
+
priv = new distExports.Buffer(priv, enc);
|
|
79690
79720
|
}
|
|
79691
79721
|
|
|
79692
79722
|
var _priv = new BN(priv);
|
|
@@ -79700,11 +79730,11 @@ function requireBrowser$3 () {
|
|
|
79700
79730
|
if (!Array.isArray(bn)) {
|
|
79701
79731
|
bn = bn.toArray();
|
|
79702
79732
|
}
|
|
79703
|
-
var buf = new distExports
|
|
79733
|
+
var buf = new distExports.Buffer(bn);
|
|
79704
79734
|
if (len && buf.length < len) {
|
|
79705
|
-
var zeros = new distExports
|
|
79735
|
+
var zeros = new distExports.Buffer(len - buf.length);
|
|
79706
79736
|
zeros.fill(0);
|
|
79707
|
-
buf = distExports
|
|
79737
|
+
buf = distExports.Buffer.concat([zeros, buf]);
|
|
79708
79738
|
}
|
|
79709
79739
|
if (!enc) {
|
|
79710
79740
|
return buf
|
|
@@ -83541,7 +83571,7 @@ function requireBrowser$1 () {
|
|
|
83541
83571
|
var uint = new Uint8Array(ourBuf, offset, size);
|
|
83542
83572
|
crypto.getRandomValues(uint);
|
|
83543
83573
|
if (cb) {
|
|
83544
|
-
distExports
|
|
83574
|
+
distExports.process.nextTick(function() {
|
|
83545
83575
|
cb(null, buf);
|
|
83546
83576
|
});
|
|
83547
83577
|
return;
|
|
@@ -83689,7 +83719,7 @@ function requireSha1 () {
|
|
|
83689
83719
|
WINDOW = false;
|
|
83690
83720
|
}
|
|
83691
83721
|
var WEB_WORKER = !WINDOW && typeof self === "object";
|
|
83692
|
-
var NODE_JS = !root.JS_SHA1_NO_NODE_JS && typeof distExports
|
|
83722
|
+
var NODE_JS = !root.JS_SHA1_NO_NODE_JS && typeof distExports.process === "object" && distExports.process.versions && distExports.process.versions.node;
|
|
83693
83723
|
if (NODE_JS) {
|
|
83694
83724
|
root = globalThis;
|
|
83695
83725
|
} else if (WEB_WORKER) {
|
|
@@ -84105,7 +84135,7 @@ function requireSha1 () {
|
|
|
84105
84135
|
|
|
84106
84136
|
var sha1Exports = requireSha1();
|
|
84107
84137
|
|
|
84108
|
-
var util$
|
|
84138
|
+
var util$1;
|
|
84109
84139
|
(function (util) {
|
|
84110
84140
|
util.assertEqual = (_) => { };
|
|
84111
84141
|
function assertIs(_arg) { }
|
|
@@ -84165,7 +84195,7 @@ var util$2;
|
|
|
84165
84195
|
}
|
|
84166
84196
|
return value;
|
|
84167
84197
|
};
|
|
84168
|
-
})(util$
|
|
84198
|
+
})(util$1 || (util$1 = {}));
|
|
84169
84199
|
var objectUtil;
|
|
84170
84200
|
(function (objectUtil) {
|
|
84171
84201
|
objectUtil.mergeShapes = (first, second) => {
|
|
@@ -84175,7 +84205,7 @@ var objectUtil;
|
|
|
84175
84205
|
};
|
|
84176
84206
|
};
|
|
84177
84207
|
})(objectUtil || (objectUtil = {}));
|
|
84178
|
-
const ZodParsedType = util$
|
|
84208
|
+
const ZodParsedType = util$1.arrayToEnum([
|
|
84179
84209
|
"string",
|
|
84180
84210
|
"nan",
|
|
84181
84211
|
"number",
|
|
@@ -84239,7 +84269,7 @@ const getParsedType = (data) => {
|
|
|
84239
84269
|
}
|
|
84240
84270
|
};
|
|
84241
84271
|
|
|
84242
|
-
const ZodIssueCode = util$
|
|
84272
|
+
const ZodIssueCode = util$1.arrayToEnum([
|
|
84243
84273
|
"invalid_type",
|
|
84244
84274
|
"invalid_literal",
|
|
84245
84275
|
"custom",
|
|
@@ -84339,7 +84369,7 @@ class ZodError extends Error {
|
|
|
84339
84369
|
return this.message;
|
|
84340
84370
|
}
|
|
84341
84371
|
get message() {
|
|
84342
|
-
return JSON.stringify(this.issues, util$
|
|
84372
|
+
return JSON.stringify(this.issues, util$1.jsonStringifyReplacer, 2);
|
|
84343
84373
|
}
|
|
84344
84374
|
get isEmpty() {
|
|
84345
84375
|
return this.issues.length === 0;
|
|
@@ -84380,19 +84410,19 @@ const errorMap = (issue, _ctx) => {
|
|
|
84380
84410
|
}
|
|
84381
84411
|
break;
|
|
84382
84412
|
case ZodIssueCode.invalid_literal:
|
|
84383
|
-
message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util$
|
|
84413
|
+
message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util$1.jsonStringifyReplacer)}`;
|
|
84384
84414
|
break;
|
|
84385
84415
|
case ZodIssueCode.unrecognized_keys:
|
|
84386
|
-
message = `Unrecognized key(s) in object: ${util$
|
|
84416
|
+
message = `Unrecognized key(s) in object: ${util$1.joinValues(issue.keys, ", ")}`;
|
|
84387
84417
|
break;
|
|
84388
84418
|
case ZodIssueCode.invalid_union:
|
|
84389
84419
|
message = `Invalid input`;
|
|
84390
84420
|
break;
|
|
84391
84421
|
case ZodIssueCode.invalid_union_discriminator:
|
|
84392
|
-
message = `Invalid discriminator value. Expected ${util$
|
|
84422
|
+
message = `Invalid discriminator value. Expected ${util$1.joinValues(issue.options)}`;
|
|
84393
84423
|
break;
|
|
84394
84424
|
case ZodIssueCode.invalid_enum_value:
|
|
84395
|
-
message = `Invalid enum value. Expected ${util$
|
|
84425
|
+
message = `Invalid enum value. Expected ${util$1.joinValues(issue.options)}, received '${issue.received}'`;
|
|
84396
84426
|
break;
|
|
84397
84427
|
case ZodIssueCode.invalid_arguments:
|
|
84398
84428
|
message = `Invalid function arguments`;
|
|
@@ -84418,7 +84448,7 @@ const errorMap = (issue, _ctx) => {
|
|
|
84418
84448
|
message = `Invalid input: must end with "${issue.validation.endsWith}"`;
|
|
84419
84449
|
}
|
|
84420
84450
|
else {
|
|
84421
|
-
util$
|
|
84451
|
+
util$1.assertNever(issue.validation);
|
|
84422
84452
|
}
|
|
84423
84453
|
}
|
|
84424
84454
|
else if (issue.validation !== "regex") {
|
|
@@ -84470,7 +84500,7 @@ const errorMap = (issue, _ctx) => {
|
|
|
84470
84500
|
break;
|
|
84471
84501
|
default:
|
|
84472
84502
|
message = _ctx.defaultError;
|
|
84473
|
-
util$
|
|
84503
|
+
util$1.assertNever(issue);
|
|
84474
84504
|
}
|
|
84475
84505
|
return { message };
|
|
84476
84506
|
};
|
|
@@ -85392,7 +85422,7 @@ class ZodString extends ZodType {
|
|
|
85392
85422
|
}
|
|
85393
85423
|
}
|
|
85394
85424
|
else {
|
|
85395
|
-
util$
|
|
85425
|
+
util$1.assertNever(check);
|
|
85396
85426
|
}
|
|
85397
85427
|
}
|
|
85398
85428
|
return { status: status.value, value: input.data };
|
|
@@ -85677,7 +85707,7 @@ class ZodNumber extends ZodType {
|
|
|
85677
85707
|
const status = new ParseStatus();
|
|
85678
85708
|
for (const check of this._def.checks) {
|
|
85679
85709
|
if (check.kind === "int") {
|
|
85680
|
-
if (!util$
|
|
85710
|
+
if (!util$1.isInteger(input.data)) {
|
|
85681
85711
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
85682
85712
|
addIssueToContext(ctx, {
|
|
85683
85713
|
code: ZodIssueCode.invalid_type,
|
|
@@ -85740,7 +85770,7 @@ class ZodNumber extends ZodType {
|
|
|
85740
85770
|
}
|
|
85741
85771
|
}
|
|
85742
85772
|
else {
|
|
85743
|
-
util$
|
|
85773
|
+
util$1.assertNever(check);
|
|
85744
85774
|
}
|
|
85745
85775
|
}
|
|
85746
85776
|
return { status: status.value, value: input.data };
|
|
@@ -85862,7 +85892,7 @@ class ZodNumber extends ZodType {
|
|
|
85862
85892
|
return max;
|
|
85863
85893
|
}
|
|
85864
85894
|
get isInt() {
|
|
85865
|
-
return !!this._def.checks.find((ch) => ch.kind === "int" || (ch.kind === "multipleOf" && util$
|
|
85895
|
+
return !!this._def.checks.find((ch) => ch.kind === "int" || (ch.kind === "multipleOf" && util$1.isInteger(ch.value)));
|
|
85866
85896
|
}
|
|
85867
85897
|
get isFinite() {
|
|
85868
85898
|
let max = null;
|
|
@@ -85953,7 +85983,7 @@ class ZodBigInt extends ZodType {
|
|
|
85953
85983
|
}
|
|
85954
85984
|
}
|
|
85955
85985
|
else {
|
|
85956
|
-
util$
|
|
85986
|
+
util$1.assertNever(check);
|
|
85957
85987
|
}
|
|
85958
85988
|
}
|
|
85959
85989
|
return { status: status.value, value: input.data };
|
|
@@ -86146,7 +86176,7 @@ class ZodDate extends ZodType {
|
|
|
86146
86176
|
}
|
|
86147
86177
|
}
|
|
86148
86178
|
else {
|
|
86149
|
-
util$
|
|
86179
|
+
util$1.assertNever(check);
|
|
86150
86180
|
}
|
|
86151
86181
|
}
|
|
86152
86182
|
return {
|
|
@@ -86519,7 +86549,7 @@ class ZodObject extends ZodType {
|
|
|
86519
86549
|
if (this._cached !== null)
|
|
86520
86550
|
return this._cached;
|
|
86521
86551
|
const shape = this._def.shape();
|
|
86522
|
-
const keys = util$
|
|
86552
|
+
const keys = util$1.objectKeys(shape);
|
|
86523
86553
|
this._cached = { shape, keys };
|
|
86524
86554
|
return this._cached;
|
|
86525
86555
|
}
|
|
@@ -86760,7 +86790,7 @@ class ZodObject extends ZodType {
|
|
|
86760
86790
|
}
|
|
86761
86791
|
pick(mask) {
|
|
86762
86792
|
const shape = {};
|
|
86763
|
-
for (const key of util$
|
|
86793
|
+
for (const key of util$1.objectKeys(mask)) {
|
|
86764
86794
|
if (mask[key] && this.shape[key]) {
|
|
86765
86795
|
shape[key] = this.shape[key];
|
|
86766
86796
|
}
|
|
@@ -86772,7 +86802,7 @@ class ZodObject extends ZodType {
|
|
|
86772
86802
|
}
|
|
86773
86803
|
omit(mask) {
|
|
86774
86804
|
const shape = {};
|
|
86775
|
-
for (const key of util$
|
|
86805
|
+
for (const key of util$1.objectKeys(this.shape)) {
|
|
86776
86806
|
if (!mask[key]) {
|
|
86777
86807
|
shape[key] = this.shape[key];
|
|
86778
86808
|
}
|
|
@@ -86790,7 +86820,7 @@ class ZodObject extends ZodType {
|
|
|
86790
86820
|
}
|
|
86791
86821
|
partial(mask) {
|
|
86792
86822
|
const newShape = {};
|
|
86793
|
-
for (const key of util$
|
|
86823
|
+
for (const key of util$1.objectKeys(this.shape)) {
|
|
86794
86824
|
const fieldSchema = this.shape[key];
|
|
86795
86825
|
if (mask && !mask[key]) {
|
|
86796
86826
|
newShape[key] = fieldSchema;
|
|
@@ -86806,7 +86836,7 @@ class ZodObject extends ZodType {
|
|
|
86806
86836
|
}
|
|
86807
86837
|
required(mask) {
|
|
86808
86838
|
const newShape = {};
|
|
86809
|
-
for (const key of util$
|
|
86839
|
+
for (const key of util$1.objectKeys(this.shape)) {
|
|
86810
86840
|
if (mask && !mask[key]) {
|
|
86811
86841
|
newShape[key] = this.shape[key];
|
|
86812
86842
|
}
|
|
@@ -86825,7 +86855,7 @@ class ZodObject extends ZodType {
|
|
|
86825
86855
|
});
|
|
86826
86856
|
}
|
|
86827
86857
|
keyof() {
|
|
86828
|
-
return createZodEnum(util$
|
|
86858
|
+
return createZodEnum(util$1.objectKeys(this.shape));
|
|
86829
86859
|
}
|
|
86830
86860
|
}
|
|
86831
86861
|
ZodObject.create = (shape, params) => {
|
|
@@ -86958,8 +86988,8 @@ function mergeValues(a, b) {
|
|
|
86958
86988
|
return { valid: true, data: a };
|
|
86959
86989
|
}
|
|
86960
86990
|
else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
|
|
86961
|
-
const bKeys = util$
|
|
86962
|
-
const sharedKeys = util$
|
|
86991
|
+
const bKeys = util$1.objectKeys(b);
|
|
86992
|
+
const sharedKeys = util$1.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
86963
86993
|
const newObj = { ...a, ...b };
|
|
86964
86994
|
for (const key of sharedKeys) {
|
|
86965
86995
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
@@ -87493,7 +87523,7 @@ class ZodEnum extends ZodType {
|
|
|
87493
87523
|
const ctx = this._getOrReturnCtx(input);
|
|
87494
87524
|
const expectedValues = this._def.values;
|
|
87495
87525
|
addIssueToContext(ctx, {
|
|
87496
|
-
expected: util$
|
|
87526
|
+
expected: util$1.joinValues(expectedValues),
|
|
87497
87527
|
received: ctx.parsedType,
|
|
87498
87528
|
code: ZodIssueCode.invalid_type,
|
|
87499
87529
|
});
|
|
@@ -87554,22 +87584,22 @@ class ZodEnum extends ZodType {
|
|
|
87554
87584
|
ZodEnum.create = createZodEnum;
|
|
87555
87585
|
class ZodNativeEnum extends ZodType {
|
|
87556
87586
|
_parse(input) {
|
|
87557
|
-
const nativeEnumValues = util$
|
|
87587
|
+
const nativeEnumValues = util$1.getValidEnumValues(this._def.values);
|
|
87558
87588
|
const ctx = this._getOrReturnCtx(input);
|
|
87559
87589
|
if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
|
|
87560
|
-
const expectedValues = util$
|
|
87590
|
+
const expectedValues = util$1.objectValues(nativeEnumValues);
|
|
87561
87591
|
addIssueToContext(ctx, {
|
|
87562
|
-
expected: util$
|
|
87592
|
+
expected: util$1.joinValues(expectedValues),
|
|
87563
87593
|
received: ctx.parsedType,
|
|
87564
87594
|
code: ZodIssueCode.invalid_type,
|
|
87565
87595
|
});
|
|
87566
87596
|
return INVALID;
|
|
87567
87597
|
}
|
|
87568
87598
|
if (!this._cache) {
|
|
87569
|
-
this._cache = new Set(util$
|
|
87599
|
+
this._cache = new Set(util$1.getValidEnumValues(this._def.values));
|
|
87570
87600
|
}
|
|
87571
87601
|
if (!this._cache.has(input.data)) {
|
|
87572
|
-
const expectedValues = util$
|
|
87602
|
+
const expectedValues = util$1.objectValues(nativeEnumValues);
|
|
87573
87603
|
addIssueToContext(ctx, {
|
|
87574
87604
|
received: ctx.data,
|
|
87575
87605
|
code: ZodIssueCode.invalid_enum_value,
|
|
@@ -87747,7 +87777,7 @@ class ZodEffects extends ZodType {
|
|
|
87747
87777
|
});
|
|
87748
87778
|
}
|
|
87749
87779
|
}
|
|
87750
|
-
util$
|
|
87780
|
+
util$1.assertNever(effect);
|
|
87751
87781
|
}
|
|
87752
87782
|
}
|
|
87753
87783
|
ZodEffects.create = (schema, effect, params) => {
|
|
@@ -88449,7 +88479,7 @@ function requirePRetry () {
|
|
|
88449
88479
|
|
|
88450
88480
|
requirePRetry();
|
|
88451
88481
|
|
|
88452
|
-
var dist
|
|
88482
|
+
var dist = {};
|
|
88453
88483
|
|
|
88454
88484
|
var eventemitter3 = {exports: {}};
|
|
88455
88485
|
|
|
@@ -88958,12 +88988,12 @@ function requirePriorityQueue () {
|
|
|
88958
88988
|
return priorityQueue;
|
|
88959
88989
|
}
|
|
88960
88990
|
|
|
88961
|
-
var hasRequiredDist
|
|
88991
|
+
var hasRequiredDist;
|
|
88962
88992
|
|
|
88963
|
-
function requireDist
|
|
88964
|
-
if (hasRequiredDist
|
|
88965
|
-
hasRequiredDist
|
|
88966
|
-
Object.defineProperty(dist
|
|
88993
|
+
function requireDist () {
|
|
88994
|
+
if (hasRequiredDist) return dist;
|
|
88995
|
+
hasRequiredDist = 1;
|
|
88996
|
+
Object.defineProperty(dist, "__esModule", { value: true });
|
|
88967
88997
|
const EventEmitter = requireEventemitter3();
|
|
88968
88998
|
const p_timeout_1 = requirePTimeout();
|
|
88969
88999
|
const priority_queue_1 = requirePriorityQueue();
|
|
@@ -89240,11 +89270,11 @@ function requireDist$1 () {
|
|
|
89240
89270
|
this._timeout = milliseconds;
|
|
89241
89271
|
}
|
|
89242
89272
|
}
|
|
89243
|
-
dist
|
|
89244
|
-
return dist
|
|
89273
|
+
dist.default = PQueue;
|
|
89274
|
+
return dist;
|
|
89245
89275
|
}
|
|
89246
89276
|
|
|
89247
|
-
requireDist
|
|
89277
|
+
requireDist();
|
|
89248
89278
|
|
|
89249
89279
|
var re$1 = {exports: {}};
|
|
89250
89280
|
|
|
@@ -89300,7 +89330,7 @@ function requireDebug () {
|
|
|
89300
89330
|
if (hasRequiredDebug) return debug_1;
|
|
89301
89331
|
hasRequiredDebug = 1;
|
|
89302
89332
|
var define_process_env_default = {};
|
|
89303
|
-
const debug = typeof distExports
|
|
89333
|
+
const debug = typeof distExports.process === "object" && define_process_env_default && define_process_env_default.NODE_DEBUG && /\bsemver\b/i.test(define_process_env_default.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
|
|
89304
89334
|
};
|
|
89305
89335
|
debug_1 = debug;
|
|
89306
89336
|
return debug_1;
|
|
@@ -93021,7 +93051,7 @@ const GLOBAL_OBJ = globalThis;
|
|
|
93021
93051
|
|
|
93022
93052
|
// This is a magic string replaced by rollup
|
|
93023
93053
|
|
|
93024
|
-
const SDK_VERSION = "9.
|
|
93054
|
+
const SDK_VERSION = "9.38.0" ;
|
|
93025
93055
|
|
|
93026
93056
|
function getMainCarrier() {
|
|
93027
93057
|
getSentryCarrier(GLOBAL_OBJ);
|
|
@@ -93038,8 +93068,7 @@ function getGlobalSingleton(name, creator, obj = GLOBAL_OBJ) {
|
|
|
93038
93068
|
return carrier[name] || (carrier[name] = creator());
|
|
93039
93069
|
}
|
|
93040
93070
|
|
|
93041
|
-
/**
|
|
93042
|
-
const PREFIX = 'Sentry Logger ';
|
|
93071
|
+
/** A Sentry Logger instance. */
|
|
93043
93072
|
|
|
93044
93073
|
const CONSOLE_LEVELS = [
|
|
93045
93074
|
'debug',
|
|
@@ -93051,13 +93080,14 @@ const CONSOLE_LEVELS = [
|
|
|
93051
93080
|
'trace',
|
|
93052
93081
|
] ;
|
|
93053
93082
|
|
|
93083
|
+
/** Prefix for logging strings */
|
|
93084
|
+
const PREFIX = 'Sentry Logger ';
|
|
93085
|
+
|
|
93054
93086
|
/** This may be mutated by the console instrumentation. */
|
|
93055
93087
|
const originalConsoleMethods
|
|
93056
93088
|
|
|
93057
93089
|
= {};
|
|
93058
93090
|
|
|
93059
|
-
/** A Sentry Logger instance. */
|
|
93060
|
-
|
|
93061
93091
|
/**
|
|
93062
93092
|
* Temporarily disable sentry console instrumentations.
|
|
93063
93093
|
*
|
|
@@ -93076,9 +93106,9 @@ function consoleSandbox(callback) {
|
|
|
93076
93106
|
|
|
93077
93107
|
// Restore all wrapped console methods
|
|
93078
93108
|
wrappedLevels.forEach(level => {
|
|
93079
|
-
const originalConsoleMethod = originalConsoleMethods[level]
|
|
93109
|
+
const originalConsoleMethod = originalConsoleMethods[level];
|
|
93080
93110
|
wrappedFuncs[level] = console[level] ;
|
|
93081
|
-
console[level] = originalConsoleMethod;
|
|
93111
|
+
console[level] = originalConsoleMethod ;
|
|
93082
93112
|
});
|
|
93083
93113
|
|
|
93084
93114
|
try {
|
|
@@ -93091,42 +93121,110 @@ function consoleSandbox(callback) {
|
|
|
93091
93121
|
}
|
|
93092
93122
|
}
|
|
93093
93123
|
|
|
93094
|
-
function
|
|
93095
|
-
|
|
93096
|
-
|
|
93097
|
-
enable: () => {
|
|
93098
|
-
enabled = true;
|
|
93099
|
-
},
|
|
93100
|
-
disable: () => {
|
|
93101
|
-
enabled = false;
|
|
93102
|
-
},
|
|
93103
|
-
isEnabled: () => enabled,
|
|
93104
|
-
};
|
|
93124
|
+
function enable() {
|
|
93125
|
+
_getLoggerSettings().enabled = true;
|
|
93126
|
+
}
|
|
93105
93127
|
|
|
93106
|
-
|
|
93107
|
-
|
|
93108
|
-
|
|
93109
|
-
|
|
93110
|
-
|
|
93111
|
-
|
|
93112
|
-
|
|
93113
|
-
|
|
93114
|
-
|
|
93115
|
-
|
|
93116
|
-
|
|
93117
|
-
|
|
93118
|
-
|
|
93128
|
+
function disable$1() {
|
|
93129
|
+
_getLoggerSettings().enabled = false;
|
|
93130
|
+
}
|
|
93131
|
+
|
|
93132
|
+
function isEnabled() {
|
|
93133
|
+
return _getLoggerSettings().enabled;
|
|
93134
|
+
}
|
|
93135
|
+
|
|
93136
|
+
function log$2(...args) {
|
|
93137
|
+
_maybeLog('log', ...args);
|
|
93138
|
+
}
|
|
93139
|
+
|
|
93140
|
+
function info(...args) {
|
|
93141
|
+
_maybeLog('info', ...args);
|
|
93142
|
+
}
|
|
93143
|
+
|
|
93144
|
+
function warn(...args) {
|
|
93145
|
+
_maybeLog('warn', ...args);
|
|
93146
|
+
}
|
|
93147
|
+
|
|
93148
|
+
function error(...args) {
|
|
93149
|
+
_maybeLog('error', ...args);
|
|
93150
|
+
}
|
|
93151
|
+
|
|
93152
|
+
function _debug(...args) {
|
|
93153
|
+
_maybeLog('debug', ...args);
|
|
93154
|
+
}
|
|
93155
|
+
|
|
93156
|
+
function assert$2(...args) {
|
|
93157
|
+
_maybeLog('assert', ...args);
|
|
93158
|
+
}
|
|
93159
|
+
|
|
93160
|
+
function trace(...args) {
|
|
93161
|
+
_maybeLog('trace', ...args);
|
|
93162
|
+
}
|
|
93163
|
+
|
|
93164
|
+
function _maybeLog(level, ...args) {
|
|
93165
|
+
if (!DEBUG_BUILD$2) {
|
|
93166
|
+
return;
|
|
93167
|
+
}
|
|
93168
|
+
|
|
93169
|
+
if (isEnabled()) {
|
|
93170
|
+
consoleSandbox(() => {
|
|
93171
|
+
GLOBAL_OBJ.console[level](`${PREFIX}[${level}]:`, ...args);
|
|
93119
93172
|
});
|
|
93120
93173
|
}
|
|
93174
|
+
}
|
|
93175
|
+
|
|
93176
|
+
function _getLoggerSettings() {
|
|
93177
|
+
if (!DEBUG_BUILD$2) {
|
|
93178
|
+
return { enabled: false };
|
|
93179
|
+
}
|
|
93121
93180
|
|
|
93122
|
-
return
|
|
93181
|
+
return getGlobalSingleton('loggerSettings', () => ({ enabled: false }));
|
|
93123
93182
|
}
|
|
93124
93183
|
|
|
93125
93184
|
/**
|
|
93126
93185
|
* This is a logger singleton which either logs things or no-ops if logging is not enabled.
|
|
93127
93186
|
* The logger is a singleton on the carrier, to ensure that a consistent logger is used throughout the SDK.
|
|
93128
93187
|
*/
|
|
93129
|
-
const logger$1 =
|
|
93188
|
+
const logger$1 = {
|
|
93189
|
+
/** Enable logging. */
|
|
93190
|
+
enable,
|
|
93191
|
+
/** Disable logging. */
|
|
93192
|
+
disable: disable$1,
|
|
93193
|
+
/** Check if logging is enabled. */
|
|
93194
|
+
isEnabled,
|
|
93195
|
+
/** Log a message. */
|
|
93196
|
+
log: log$2,
|
|
93197
|
+
/** Log level info */
|
|
93198
|
+
info,
|
|
93199
|
+
/** Log a warning. */
|
|
93200
|
+
warn,
|
|
93201
|
+
/** Log an error. */
|
|
93202
|
+
error,
|
|
93203
|
+
/** Log a debug message. */
|
|
93204
|
+
debug: _debug,
|
|
93205
|
+
/** Log an assertion. */
|
|
93206
|
+
assert: assert$2,
|
|
93207
|
+
/** Log a trace. */
|
|
93208
|
+
trace,
|
|
93209
|
+
} ;
|
|
93210
|
+
|
|
93211
|
+
/**
|
|
93212
|
+
* This is a logger singleton which either logs things or no-ops if logging is not enabled.
|
|
93213
|
+
*/
|
|
93214
|
+
const debug = {
|
|
93215
|
+
/** Enable logging. */
|
|
93216
|
+
enable,
|
|
93217
|
+
/** Disable logging. */
|
|
93218
|
+
disable: disable$1,
|
|
93219
|
+
/** Check if logging is enabled. */
|
|
93220
|
+
isEnabled,
|
|
93221
|
+
/** Log a message. */
|
|
93222
|
+
log: log$2,
|
|
93223
|
+
/** Log a warning. */
|
|
93224
|
+
warn,
|
|
93225
|
+
/** Log an error. */
|
|
93226
|
+
error,
|
|
93227
|
+
} ;
|
|
93130
93228
|
|
|
93131
93229
|
const STACKTRACE_FRAME_LIMIT = 50;
|
|
93132
93230
|
const UNKNOWN_FUNCTION = '?';
|
|
@@ -93303,7 +93401,7 @@ function maybeInstrument(type, instrumentFn) {
|
|
|
93303
93401
|
try {
|
|
93304
93402
|
instrumentFn();
|
|
93305
93403
|
} catch (e) {
|
|
93306
|
-
DEBUG_BUILD$2 &&
|
|
93404
|
+
DEBUG_BUILD$2 && debug.error(`Error while instrumenting ${type}`, e);
|
|
93307
93405
|
}
|
|
93308
93406
|
}
|
|
93309
93407
|
}
|
|
@@ -93316,7 +93414,7 @@ function triggerHandlers(type, data) {
|
|
|
93316
93414
|
try {
|
|
93317
93415
|
handler(data);
|
|
93318
93416
|
} catch (e) {
|
|
93319
|
-
DEBUG_BUILD$2 &&
|
|
93417
|
+
DEBUG_BUILD$2 && debug.error(
|
|
93320
93418
|
`Error while triggering instrumentation handler.
|
|
93321
93419
|
Type: ${type}
|
|
93322
93420
|
Name: ${getFunctionName(handler)}
|
|
@@ -93871,7 +93969,7 @@ function fill(source, name, replacementFactory) {
|
|
|
93871
93969
|
try {
|
|
93872
93970
|
source[name] = wrapped;
|
|
93873
93971
|
} catch {
|
|
93874
|
-
DEBUG_BUILD$2 &&
|
|
93972
|
+
DEBUG_BUILD$2 && debug.log(`Failed to replace method "${name}" in object`, source);
|
|
93875
93973
|
}
|
|
93876
93974
|
}
|
|
93877
93975
|
|
|
@@ -93891,7 +93989,7 @@ function addNonEnumerableProperty(obj, name, value) {
|
|
|
93891
93989
|
configurable: true,
|
|
93892
93990
|
});
|
|
93893
93991
|
} catch (o_O) {
|
|
93894
|
-
DEBUG_BUILD$2 &&
|
|
93992
|
+
DEBUG_BUILD$2 && debug.log(`Failed to add non-enumerable property "${name}" to object`, obj);
|
|
93895
93993
|
}
|
|
93896
93994
|
}
|
|
93897
93995
|
|
|
@@ -94124,14 +94222,13 @@ function dateTimestampInSeconds() {
|
|
|
94124
94222
|
*/
|
|
94125
94223
|
function createUnixTimestampInSecondsFunc() {
|
|
94126
94224
|
const { performance } = GLOBAL_OBJ ;
|
|
94127
|
-
|
|
94225
|
+
// Some browser and environments don't have a performance or timeOrigin, so we fallback to
|
|
94226
|
+
// using Date.now() to compute the starting time.
|
|
94227
|
+
if (!performance?.now || !performance.timeOrigin) {
|
|
94128
94228
|
return dateTimestampInSeconds;
|
|
94129
94229
|
}
|
|
94130
94230
|
|
|
94131
|
-
|
|
94132
|
-
// using Date.now() to compute the starting time.
|
|
94133
|
-
const approxStartingTimeOrigin = Date.now() - performance.now();
|
|
94134
|
-
const timeOrigin = performance.timeOrigin == undefined ? approxStartingTimeOrigin : performance.timeOrigin;
|
|
94231
|
+
const timeOrigin = performance.timeOrigin;
|
|
94135
94232
|
|
|
94136
94233
|
// performance.now() is a monotonic clock, which means it starts at 0 when the process begins. To get the current
|
|
94137
94234
|
// wall clock time (actual UNIX timestamp), we need to add the starting time origin and the current time elapsed.
|
|
@@ -94147,6 +94244,8 @@ function createUnixTimestampInSecondsFunc() {
|
|
|
94147
94244
|
};
|
|
94148
94245
|
}
|
|
94149
94246
|
|
|
94247
|
+
let _cachedTimestampInSeconds;
|
|
94248
|
+
|
|
94150
94249
|
/**
|
|
94151
94250
|
* Returns a timestamp in seconds since the UNIX epoch using either the Performance or Date APIs, depending on the
|
|
94152
94251
|
* availability of the Performance API.
|
|
@@ -94156,7 +94255,11 @@ function createUnixTimestampInSecondsFunc() {
|
|
|
94156
94255
|
* skew can grow to arbitrary amounts like days, weeks or months.
|
|
94157
94256
|
* See https://github.com/getsentry/sentry-javascript/issues/2590.
|
|
94158
94257
|
*/
|
|
94159
|
-
|
|
94258
|
+
function timestampInSeconds() {
|
|
94259
|
+
// We store this in a closure so that we don't have to create a new function every time this is called.
|
|
94260
|
+
const func = _cachedTimestampInSeconds ?? (_cachedTimestampInSeconds = createUnixTimestampInSecondsFunc());
|
|
94261
|
+
return func();
|
|
94262
|
+
}
|
|
94160
94263
|
|
|
94161
94264
|
/**
|
|
94162
94265
|
* Creates a new `Session` object by setting certain default parameters. If optional @param context
|
|
@@ -94771,7 +94874,7 @@ let Scope$1 = class Scope {
|
|
|
94771
94874
|
captureException(exception, hint) {
|
|
94772
94875
|
const eventId = hint?.event_id || uuid4();
|
|
94773
94876
|
if (!this._client) {
|
|
94774
|
-
|
|
94877
|
+
DEBUG_BUILD$2 && debug.warn("No client configured on scope - will not capture exception!");
|
|
94775
94878
|
return eventId;
|
|
94776
94879
|
}
|
|
94777
94880
|
const syntheticException = new Error("Sentry syntheticException");
|
|
@@ -94795,7 +94898,7 @@ let Scope$1 = class Scope {
|
|
|
94795
94898
|
captureMessage(message, level, hint) {
|
|
94796
94899
|
const eventId = hint?.event_id || uuid4();
|
|
94797
94900
|
if (!this._client) {
|
|
94798
|
-
|
|
94901
|
+
DEBUG_BUILD$2 && debug.warn("No client configured on scope - will not capture message!");
|
|
94799
94902
|
return eventId;
|
|
94800
94903
|
}
|
|
94801
94904
|
const syntheticException = new Error(message);
|
|
@@ -94820,7 +94923,7 @@ let Scope$1 = class Scope {
|
|
|
94820
94923
|
captureEvent(event, hint) {
|
|
94821
94924
|
const eventId = hint?.event_id || uuid4();
|
|
94822
94925
|
if (!this._client) {
|
|
94823
|
-
|
|
94926
|
+
DEBUG_BUILD$2 && debug.warn("No client configured on scope - will not capture event!");
|
|
94824
94927
|
return eventId;
|
|
94825
94928
|
}
|
|
94826
94929
|
this._client.captureEvent(event, { ...hint, event_id: eventId }, this);
|
|
@@ -95497,7 +95600,7 @@ function validateDsn(dsn) {
|
|
|
95497
95600
|
const requiredComponents = ['protocol', 'publicKey', 'host', 'projectId'];
|
|
95498
95601
|
const hasMissingRequiredComponent = requiredComponents.find(component => {
|
|
95499
95602
|
if (!dsn[component]) {
|
|
95500
|
-
|
|
95603
|
+
debug.error(`Invalid Sentry Dsn: ${component} missing`);
|
|
95501
95604
|
return true;
|
|
95502
95605
|
}
|
|
95503
95606
|
return false;
|
|
@@ -95508,17 +95611,17 @@ function validateDsn(dsn) {
|
|
|
95508
95611
|
}
|
|
95509
95612
|
|
|
95510
95613
|
if (!projectId.match(/^\d+$/)) {
|
|
95511
|
-
|
|
95614
|
+
debug.error(`Invalid Sentry Dsn: Invalid projectId ${projectId}`);
|
|
95512
95615
|
return false;
|
|
95513
95616
|
}
|
|
95514
95617
|
|
|
95515
95618
|
if (!isValidProtocol(protocol)) {
|
|
95516
|
-
|
|
95619
|
+
debug.error(`Invalid Sentry Dsn: Invalid protocol ${protocol}`);
|
|
95517
95620
|
return false;
|
|
95518
95621
|
}
|
|
95519
95622
|
|
|
95520
95623
|
if (port && isNaN(parseInt(port, 10))) {
|
|
95521
|
-
|
|
95624
|
+
debug.error(`Invalid Sentry Dsn: Invalid port ${port}`);
|
|
95522
95625
|
return false;
|
|
95523
95626
|
}
|
|
95524
95627
|
|
|
@@ -96056,16 +96159,9 @@ function createEventEnvelope(
|
|
|
96056
96159
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
96057
96160
|
|
|
96058
96161
|
/** SyncPromise internal states */
|
|
96059
|
-
|
|
96060
|
-
|
|
96061
|
-
|
|
96062
|
-
/** Resolved / OK */
|
|
96063
|
-
const RESOLVED = 1; States[States["RESOLVED"] = RESOLVED] = "RESOLVED";
|
|
96064
|
-
/** Rejected / Error */
|
|
96065
|
-
const REJECTED = 2; States[States["REJECTED"] = REJECTED] = "REJECTED";
|
|
96066
|
-
})(States || (States = {}));
|
|
96067
|
-
|
|
96068
|
-
// Overloads so we can call resolvedSyncPromise without arguments and generic argument
|
|
96162
|
+
const STATE_PENDING = 0;
|
|
96163
|
+
const STATE_RESOLVED = 1;
|
|
96164
|
+
const STATE_REJECTED = 2;
|
|
96069
96165
|
|
|
96070
96166
|
/**
|
|
96071
96167
|
* Creates a resolved sync promise.
|
|
@@ -96098,7 +96194,7 @@ function rejectedSyncPromise(reason) {
|
|
|
96098
96194
|
class SyncPromise {
|
|
96099
96195
|
|
|
96100
96196
|
constructor(executor) {
|
|
96101
|
-
this._state =
|
|
96197
|
+
this._state = STATE_PENDING;
|
|
96102
96198
|
this._handlers = [];
|
|
96103
96199
|
|
|
96104
96200
|
this._runExecutor(executor);
|
|
@@ -96182,7 +96278,7 @@ class SyncPromise {
|
|
|
96182
96278
|
|
|
96183
96279
|
/** Excute the resolve/reject handlers. */
|
|
96184
96280
|
_executeHandlers() {
|
|
96185
|
-
if (this._state ===
|
|
96281
|
+
if (this._state === STATE_PENDING) {
|
|
96186
96282
|
return;
|
|
96187
96283
|
}
|
|
96188
96284
|
|
|
@@ -96194,11 +96290,11 @@ class SyncPromise {
|
|
|
96194
96290
|
return;
|
|
96195
96291
|
}
|
|
96196
96292
|
|
|
96197
|
-
if (this._state ===
|
|
96293
|
+
if (this._state === STATE_RESOLVED) {
|
|
96198
96294
|
handler[1](this._value );
|
|
96199
96295
|
}
|
|
96200
96296
|
|
|
96201
|
-
if (this._state ===
|
|
96297
|
+
if (this._state === STATE_REJECTED) {
|
|
96202
96298
|
handler[2](this._value);
|
|
96203
96299
|
}
|
|
96204
96300
|
|
|
@@ -96209,7 +96305,7 @@ class SyncPromise {
|
|
|
96209
96305
|
/** Run the executor for the SyncPromise. */
|
|
96210
96306
|
_runExecutor(executor) {
|
|
96211
96307
|
const setResult = (state, value) => {
|
|
96212
|
-
if (this._state !==
|
|
96308
|
+
if (this._state !== STATE_PENDING) {
|
|
96213
96309
|
return;
|
|
96214
96310
|
}
|
|
96215
96311
|
|
|
@@ -96225,11 +96321,11 @@ class SyncPromise {
|
|
|
96225
96321
|
};
|
|
96226
96322
|
|
|
96227
96323
|
const resolve = (value) => {
|
|
96228
|
-
setResult(
|
|
96324
|
+
setResult(STATE_RESOLVED, value);
|
|
96229
96325
|
};
|
|
96230
96326
|
|
|
96231
96327
|
const reject = (reason) => {
|
|
96232
|
-
setResult(
|
|
96328
|
+
setResult(STATE_REJECTED, reason);
|
|
96233
96329
|
};
|
|
96234
96330
|
|
|
96235
96331
|
try {
|
|
@@ -96256,7 +96352,7 @@ function notifyEventProcessors(
|
|
|
96256
96352
|
} else {
|
|
96257
96353
|
const result = processor({ ...event }, hint) ;
|
|
96258
96354
|
|
|
96259
|
-
DEBUG_BUILD$2 && processor.id && result === null &&
|
|
96355
|
+
DEBUG_BUILD$2 && processor.id && result === null && debug.log(`Event processor "${processor.id}" dropped event`);
|
|
96260
96356
|
|
|
96261
96357
|
if (isThenable(result)) {
|
|
96262
96358
|
void result
|
|
@@ -97005,7 +97101,7 @@ function afterSetupIntegrations(client, integrations) {
|
|
|
97005
97101
|
/** Setup a single integration. */
|
|
97006
97102
|
function setupIntegration(client, integration, integrationIndex) {
|
|
97007
97103
|
if (integrationIndex[integration.name]) {
|
|
97008
|
-
DEBUG_BUILD$2 &&
|
|
97104
|
+
DEBUG_BUILD$2 && debug.log(`Integration skipped because it was already installed: ${integration.name}`);
|
|
97009
97105
|
return;
|
|
97010
97106
|
}
|
|
97011
97107
|
integrationIndex[integration.name] = integration;
|
|
@@ -97036,7 +97132,7 @@ function setupIntegration(client, integration, integrationIndex) {
|
|
|
97036
97132
|
client.addEventProcessor(processor);
|
|
97037
97133
|
}
|
|
97038
97134
|
|
|
97039
|
-
DEBUG_BUILD$2 &&
|
|
97135
|
+
DEBUG_BUILD$2 && debug.log(`Integration installed: ${integration.name}`);
|
|
97040
97136
|
}
|
|
97041
97137
|
|
|
97042
97138
|
/**
|
|
@@ -97235,7 +97331,7 @@ class Client {
|
|
|
97235
97331
|
if (options.dsn) {
|
|
97236
97332
|
this._dsn = makeDsn(options.dsn);
|
|
97237
97333
|
} else {
|
|
97238
|
-
DEBUG_BUILD$2 &&
|
|
97334
|
+
DEBUG_BUILD$2 && debug.warn('No DSN provided, client will not send events.');
|
|
97239
97335
|
}
|
|
97240
97336
|
|
|
97241
97337
|
if (this._dsn) {
|
|
@@ -97263,7 +97359,7 @@ class Client {
|
|
|
97263
97359
|
|
|
97264
97360
|
// ensure we haven't captured this very object before
|
|
97265
97361
|
if (checkOrSetAlreadyCaught(exception)) {
|
|
97266
|
-
DEBUG_BUILD$2 &&
|
|
97362
|
+
DEBUG_BUILD$2 && debug.log(ALREADY_SEEN_ERROR);
|
|
97267
97363
|
return eventId;
|
|
97268
97364
|
}
|
|
97269
97365
|
|
|
@@ -97318,7 +97414,7 @@ class Client {
|
|
|
97318
97414
|
|
|
97319
97415
|
// ensure we haven't captured this very object before
|
|
97320
97416
|
if (hint?.originalException && checkOrSetAlreadyCaught(hint.originalException)) {
|
|
97321
|
-
DEBUG_BUILD$2 &&
|
|
97417
|
+
DEBUG_BUILD$2 && debug.log(ALREADY_SEEN_ERROR);
|
|
97322
97418
|
return eventId;
|
|
97323
97419
|
}
|
|
97324
97420
|
|
|
@@ -97509,7 +97605,7 @@ class Client {
|
|
|
97509
97605
|
if ('aggregates' in session) {
|
|
97510
97606
|
const sessionAttrs = session.attrs || {};
|
|
97511
97607
|
if (!sessionAttrs.release && !clientReleaseOption) {
|
|
97512
|
-
DEBUG_BUILD$2 &&
|
|
97608
|
+
DEBUG_BUILD$2 && debug.warn(MISSING_RELEASE_FOR_SESSION_ERROR);
|
|
97513
97609
|
return;
|
|
97514
97610
|
}
|
|
97515
97611
|
sessionAttrs.release = sessionAttrs.release || clientReleaseOption;
|
|
@@ -97517,7 +97613,7 @@ class Client {
|
|
|
97517
97613
|
session.attrs = sessionAttrs;
|
|
97518
97614
|
} else {
|
|
97519
97615
|
if (!session.release && !clientReleaseOption) {
|
|
97520
|
-
DEBUG_BUILD$2 &&
|
|
97616
|
+
DEBUG_BUILD$2 && debug.warn(MISSING_RELEASE_FOR_SESSION_ERROR);
|
|
97521
97617
|
return;
|
|
97522
97618
|
}
|
|
97523
97619
|
session.release = session.release || clientReleaseOption;
|
|
@@ -97545,7 +97641,7 @@ class Client {
|
|
|
97545
97641
|
// would be `Partial<Record<SentryRequestType, Partial<Record<Outcome, number>>>>`
|
|
97546
97642
|
// With typescript 4.1 we could even use template literal types
|
|
97547
97643
|
const key = `${reason}:${category}`;
|
|
97548
|
-
DEBUG_BUILD$2 &&
|
|
97644
|
+
DEBUG_BUILD$2 && debug.log(`Recording outcome: "${key}"${count > 1 ? ` (${count} times)` : ''}`);
|
|
97549
97645
|
this._outcomes[key] = (this._outcomes[key] || 0) + count;
|
|
97550
97646
|
}
|
|
97551
97647
|
}
|
|
@@ -97599,12 +97695,12 @@ class Client {
|
|
|
97599
97695
|
|
|
97600
97696
|
if (this._isEnabled() && this._transport) {
|
|
97601
97697
|
return this._transport.send(envelope).then(null, reason => {
|
|
97602
|
-
DEBUG_BUILD$2 &&
|
|
97698
|
+
DEBUG_BUILD$2 && debug.error('Error while sending envelope:', reason);
|
|
97603
97699
|
return reason;
|
|
97604
97700
|
});
|
|
97605
97701
|
}
|
|
97606
97702
|
|
|
97607
|
-
DEBUG_BUILD$2 &&
|
|
97703
|
+
DEBUG_BUILD$2 && debug.error('Transport disabled');
|
|
97608
97704
|
|
|
97609
97705
|
return resolvedSyncPromise({});
|
|
97610
97706
|
}
|
|
@@ -97754,7 +97850,7 @@ class Client {
|
|
|
97754
97850
|
isolationScope = getIsolationScope(),
|
|
97755
97851
|
) {
|
|
97756
97852
|
if (DEBUG_BUILD$2 && isErrorEvent(event)) {
|
|
97757
|
-
|
|
97853
|
+
debug.log(`Captured error event \`${getPossibleEventMessages(event)[0] || '<unknown>'}\``);
|
|
97758
97854
|
}
|
|
97759
97855
|
|
|
97760
97856
|
return this._processEvent(event, hint, currentScope, isolationScope).then(
|
|
@@ -97764,11 +97860,11 @@ class Client {
|
|
|
97764
97860
|
reason => {
|
|
97765
97861
|
if (DEBUG_BUILD$2) {
|
|
97766
97862
|
if (_isDoNotSendEventError(reason)) {
|
|
97767
|
-
|
|
97863
|
+
debug.log(reason.message);
|
|
97768
97864
|
} else if (_isInternalError(reason)) {
|
|
97769
|
-
|
|
97865
|
+
debug.warn(reason.message);
|
|
97770
97866
|
} else {
|
|
97771
|
-
|
|
97867
|
+
debug.warn(reason);
|
|
97772
97868
|
}
|
|
97773
97869
|
}
|
|
97774
97870
|
return undefined;
|
|
@@ -97929,22 +98025,22 @@ class Client {
|
|
|
97929
98025
|
* Sends client reports as an envelope.
|
|
97930
98026
|
*/
|
|
97931
98027
|
_flushOutcomes() {
|
|
97932
|
-
DEBUG_BUILD$2 &&
|
|
98028
|
+
DEBUG_BUILD$2 && debug.log('Flushing outcomes...');
|
|
97933
98029
|
|
|
97934
98030
|
const outcomes = this._clearOutcomes();
|
|
97935
98031
|
|
|
97936
98032
|
if (outcomes.length === 0) {
|
|
97937
|
-
DEBUG_BUILD$2 &&
|
|
98033
|
+
DEBUG_BUILD$2 && debug.log('No outcomes to send');
|
|
97938
98034
|
return;
|
|
97939
98035
|
}
|
|
97940
98036
|
|
|
97941
98037
|
// This is really the only place where we want to check for a DSN and only send outcomes then
|
|
97942
98038
|
if (!this._dsn) {
|
|
97943
|
-
DEBUG_BUILD$2 &&
|
|
98039
|
+
DEBUG_BUILD$2 && debug.log('No dsn provided, will not send outcomes');
|
|
97944
98040
|
return;
|
|
97945
98041
|
}
|
|
97946
98042
|
|
|
97947
|
-
DEBUG_BUILD$2 &&
|
|
98043
|
+
DEBUG_BUILD$2 && debug.log('Sending outcomes:', outcomes);
|
|
97948
98044
|
|
|
97949
98045
|
const envelope = createClientReportEnvelope(outcomes, this._options.tunnel && dsnToString(this._dsn));
|
|
97950
98046
|
|
|
@@ -98136,9 +98232,9 @@ function initAndBind(
|
|
|
98136
98232
|
) {
|
|
98137
98233
|
if (options.debug === true) {
|
|
98138
98234
|
if (DEBUG_BUILD$2) {
|
|
98139
|
-
|
|
98235
|
+
debug.enable();
|
|
98140
98236
|
} else {
|
|
98141
|
-
// use `console.warn` rather than `
|
|
98237
|
+
// use `console.warn` rather than `debug.warn` since by non-debug bundles have all `debug.x` statements stripped
|
|
98142
98238
|
consoleSandbox(() => {
|
|
98143
98239
|
// eslint-disable-next-line no-console
|
|
98144
98240
|
console.warn('[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.');
|
|
@@ -98414,7 +98510,7 @@ function createTransport(
|
|
|
98414
98510
|
response => {
|
|
98415
98511
|
// We don't want to throw on NOK responses, but we want to at least log them
|
|
98416
98512
|
if (response.statusCode !== undefined && (response.statusCode < 200 || response.statusCode >= 300)) {
|
|
98417
|
-
DEBUG_BUILD$2 &&
|
|
98513
|
+
DEBUG_BUILD$2 && debug.warn(`Sentry responded with status code ${response.statusCode} to sent event.`);
|
|
98418
98514
|
}
|
|
98419
98515
|
|
|
98420
98516
|
rateLimits = updateRateLimits(rateLimits, response);
|
|
@@ -98422,7 +98518,7 @@ function createTransport(
|
|
|
98422
98518
|
},
|
|
98423
98519
|
error => {
|
|
98424
98520
|
recordEnvelopeLoss('network_error');
|
|
98425
|
-
DEBUG_BUILD$2 &&
|
|
98521
|
+
DEBUG_BUILD$2 && debug.error('Encountered error running transport request:', error);
|
|
98426
98522
|
throw error;
|
|
98427
98523
|
},
|
|
98428
98524
|
);
|
|
@@ -98431,7 +98527,7 @@ function createTransport(
|
|
|
98431
98527
|
result => result,
|
|
98432
98528
|
error => {
|
|
98433
98529
|
if (error === SENTRY_BUFFER_FULL_ERROR) {
|
|
98434
|
-
DEBUG_BUILD$2 &&
|
|
98530
|
+
DEBUG_BUILD$2 && debug.error('Skipped sending event because buffer is full.');
|
|
98435
98531
|
recordEnvelopeLoss('queue_overflow');
|
|
98436
98532
|
return resolvedSyncPromise({});
|
|
98437
98533
|
} else {
|
|
@@ -98688,14 +98784,14 @@ function _shouldDropEvent$1(event, options) {
|
|
|
98688
98784
|
// Filter errors
|
|
98689
98785
|
if (_isIgnoredError(event, options.ignoreErrors)) {
|
|
98690
98786
|
DEBUG_BUILD$2 &&
|
|
98691
|
-
|
|
98787
|
+
debug.warn(
|
|
98692
98788
|
`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${getEventDescription(event)}`,
|
|
98693
98789
|
);
|
|
98694
98790
|
return true;
|
|
98695
98791
|
}
|
|
98696
98792
|
if (_isUselessError(event)) {
|
|
98697
98793
|
DEBUG_BUILD$2 &&
|
|
98698
|
-
|
|
98794
|
+
debug.warn(
|
|
98699
98795
|
`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${getEventDescription(
|
|
98700
98796
|
event,
|
|
98701
98797
|
)}`,
|
|
@@ -98704,7 +98800,7 @@ function _shouldDropEvent$1(event, options) {
|
|
|
98704
98800
|
}
|
|
98705
98801
|
if (_isDeniedUrl(event, options.denyUrls)) {
|
|
98706
98802
|
DEBUG_BUILD$2 &&
|
|
98707
|
-
|
|
98803
|
+
debug.warn(
|
|
98708
98804
|
`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${getEventDescription(
|
|
98709
98805
|
event,
|
|
98710
98806
|
)}.\nUrl: ${_getEventFilterUrl(event)}`,
|
|
@@ -98713,7 +98809,7 @@ function _shouldDropEvent$1(event, options) {
|
|
|
98713
98809
|
}
|
|
98714
98810
|
if (!_isAllowedUrl(event, options.allowUrls)) {
|
|
98715
98811
|
DEBUG_BUILD$2 &&
|
|
98716
|
-
|
|
98812
|
+
debug.warn(
|
|
98717
98813
|
`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${getEventDescription(
|
|
98718
98814
|
event,
|
|
98719
98815
|
)}.\nUrl: ${_getEventFilterUrl(event)}`,
|
|
@@ -98725,7 +98821,7 @@ function _shouldDropEvent$1(event, options) {
|
|
|
98725
98821
|
|
|
98726
98822
|
if (_isIgnoredTransaction(event, options.ignoreTransactions)) {
|
|
98727
98823
|
DEBUG_BUILD$2 &&
|
|
98728
|
-
|
|
98824
|
+
debug.warn(
|
|
98729
98825
|
`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${getEventDescription(event)}`,
|
|
98730
98826
|
);
|
|
98731
98827
|
return true;
|
|
@@ -98789,7 +98885,7 @@ function _getEventFilterUrl(event) {
|
|
|
98789
98885
|
const frames = rootException?.stacktrace?.frames;
|
|
98790
98886
|
return frames ? _getLastValidUrl(frames) : null;
|
|
98791
98887
|
} catch (oO) {
|
|
98792
|
-
DEBUG_BUILD$2 &&
|
|
98888
|
+
DEBUG_BUILD$2 && debug.error(`Cannot extract url for event ${getEventDescription(event)}`);
|
|
98793
98889
|
return null;
|
|
98794
98890
|
}
|
|
98795
98891
|
}
|
|
@@ -98996,7 +99092,7 @@ const _dedupeIntegration = (() => {
|
|
|
98996
99092
|
// Juuust in case something goes wrong
|
|
98997
99093
|
try {
|
|
98998
99094
|
if (_shouldDropEvent(currentEvent, previousEvent)) {
|
|
98999
|
-
DEBUG_BUILD$2 &&
|
|
99095
|
+
DEBUG_BUILD$2 && debug.warn('Event dropped due to being a duplicate of previously captured event.');
|
|
99000
99096
|
return null;
|
|
99001
99097
|
}
|
|
99002
99098
|
} catch (_oO) {} // eslint-disable-line no-empty
|
|
@@ -99260,8 +99356,7 @@ function supportsNativeFetch() {
|
|
|
99260
99356
|
}
|
|
99261
99357
|
doc.head.removeChild(sandbox);
|
|
99262
99358
|
} catch (err) {
|
|
99263
|
-
DEBUG_BUILD$2 &&
|
|
99264
|
-
logger$1.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', err);
|
|
99359
|
+
DEBUG_BUILD$2 && debug.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', err);
|
|
99265
99360
|
}
|
|
99266
99361
|
}
|
|
99267
99362
|
|
|
@@ -102170,7 +102265,7 @@ var createStream = async () => {
|
|
|
102170
102265
|
if (raw) {
|
|
102171
102266
|
return void 0;
|
|
102172
102267
|
}
|
|
102173
|
-
const pretty = await __vitePreload(() => import('./index-
|
|
102268
|
+
const pretty = await __vitePreload(() => import('./index-DS--BeyD.js').then(n => n.i),true ?__vite__mapDeps([0,1]):void 0);
|
|
102174
102269
|
return pretty.default(createPrettyConfig());
|
|
102175
102270
|
};
|
|
102176
102271
|
var options = {
|
|
@@ -102243,7 +102338,7 @@ var createLogger = (bindings = false) => {
|
|
|
102243
102338
|
return logger3;
|
|
102244
102339
|
};
|
|
102245
102340
|
var logger = pino(options);
|
|
102246
|
-
if (typeof distExports
|
|
102341
|
+
if (typeof distExports.process !== "undefined") {
|
|
102247
102342
|
let stream = null;
|
|
102248
102343
|
if (!raw) {
|
|
102249
102344
|
try {
|
|
@@ -102704,14 +102799,22 @@ IMPORTANT ACTION ORDERING RULES:
|
|
|
102704
102799
|
- REPLY is used to acknowledge and inform the user about what you're going to do
|
|
102705
102800
|
- Follow-up actions execute the actual tasks after acknowledgment
|
|
102706
102801
|
- Use IGNORE only when you should not respond at all
|
|
102802
|
+
- If you use IGNORE, do not include any other actions. IGNORE should be used alone when you should not respond or take any actions.
|
|
102707
102803
|
|
|
102708
102804
|
IMPORTANT PROVIDER SELECTION RULES:
|
|
102805
|
+
- Only include providers if they are needed to respond accurately.
|
|
102709
102806
|
- If the message mentions images, photos, pictures, attachments, or visual content, OR if you see "(Attachments:" in the conversation, you MUST include "ATTACHMENTS" in your providers list
|
|
102710
102807
|
- If the message asks about or references specific people, include "ENTITIES" in your providers list
|
|
102711
102808
|
- If the message asks about relationships or connections between people, include "RELATIONSHIPS" in your providers list
|
|
102712
102809
|
- If the message asks about facts or specific information, include "FACTS" in your providers list
|
|
102713
102810
|
- If the message asks about the environment or world context, include "WORLD" in your providers list
|
|
102714
|
-
- If
|
|
102811
|
+
- If no additional context is needed, you may leave the providers list empty.
|
|
102812
|
+
|
|
102813
|
+
IMPORTANT CODE BLOCK FORMATTING RULES:
|
|
102814
|
+
- If {{agentName}} includes code examples, snippets, or multi-line code in the response, ALWAYS wrap the code with \`\`\` fenced code blocks (specify the language if known, e.g., \`\`\`python).
|
|
102815
|
+
- ONLY use fenced code blocks for actual code. Do NOT wrap non-code text, instructions, or single words in fenced code blocks.
|
|
102816
|
+
- If including inline code (short single words or function names), use single backticks (\`) as appropriate.
|
|
102817
|
+
- This ensures the user sees clearly formatted and copyable code when relevant.
|
|
102715
102818
|
|
|
102716
102819
|
First, think about what you want to do next and plan your actions. Then, write the next message and include the actions you plan to take.
|
|
102717
102820
|
</instructions>
|
|
@@ -102776,7 +102879,7 @@ Your output should be formatted in XML like this:
|
|
|
102776
102879
|
|
|
102777
102880
|
The "post" field should be the post you want to send. Do not including any thinking or internal reflection in the "post" field.
|
|
102778
102881
|
The "imagePrompt" field is optional and should be a prompt for an image that is relevant to the post. It should be a single sentence that captures the essence of the post. ONLY USE THIS FIELD if it makes sense that the post would benefit from an image.
|
|
102779
|
-
The "thought" field should be a short description of what the agent is thinking about before responding,
|
|
102882
|
+
The "thought" field should be a short description of what the agent is thinking about before responding, including a brief justification for the response. Includate an explanation how the post is relevant to the topic but unique and different than other posts.
|
|
102780
102883
|
|
|
102781
102884
|
Do NOT include any thinking, reasoning, or <think> sections in your response.
|
|
102782
102885
|
Go directly to the XML response format without any preamble or explanation.
|
|
@@ -103864,6 +103967,7 @@ var Semaphore = class {
|
|
|
103864
103967
|
}
|
|
103865
103968
|
};
|
|
103866
103969
|
var AgentRuntime = class {
|
|
103970
|
+
// Default value, can be overridden
|
|
103867
103971
|
constructor(opts) {
|
|
103868
103972
|
this.#conversationLength = 32;
|
|
103869
103973
|
this.actions = [];
|
|
@@ -103884,6 +103988,7 @@ var AgentRuntime = class {
|
|
|
103884
103988
|
this.allAvailablePlugins = /* @__PURE__ */ new Map();
|
|
103885
103989
|
this.characterPlugins = [];
|
|
103886
103990
|
this.servicesInitQueue = /* @__PURE__ */ new Set();
|
|
103991
|
+
this.maxWorkingMemoryEntries = 50;
|
|
103887
103992
|
this.agentId = opts.character?.id ?? opts?.agentId ?? stringToUuid(opts.character?.name ?? v4() + opts.character?.username);
|
|
103888
103993
|
this.character = opts.character;
|
|
103889
103994
|
const logLevel = define_process_env_default.LOG_LEVEL || "info";
|
|
@@ -103908,6 +104013,11 @@ var AgentRuntime = class {
|
|
|
103908
104013
|
}
|
|
103909
104014
|
this.logger.debug(`Success: Agent ID: ${this.agentId}`);
|
|
103910
104015
|
this.currentRunId = void 0;
|
|
104016
|
+
if (opts.settings?.MAX_WORKING_MEMORY_ENTRIES) {
|
|
104017
|
+
this.maxWorkingMemoryEntries = parseInt(opts.settings.MAX_WORKING_MEMORY_ENTRIES, 10) || 50;
|
|
104018
|
+
} else if (define_process_env_default.MAX_WORKING_MEMORY_ENTRIES) {
|
|
104019
|
+
this.maxWorkingMemoryEntries = parseInt(define_process_env_default.MAX_WORKING_MEMORY_ENTRIES, 10) || 50;
|
|
104020
|
+
}
|
|
103911
104021
|
}
|
|
103912
104022
|
#conversationLength;
|
|
103913
104023
|
/**
|
|
@@ -104208,19 +104318,74 @@ var AgentRuntime = class {
|
|
|
104208
104318
|
registerEvaluator(evaluator) {
|
|
104209
104319
|
this.evaluators.push(evaluator);
|
|
104210
104320
|
}
|
|
104321
|
+
// Helper functions for immutable action plan updates
|
|
104322
|
+
updateActionPlan(plan, updates) {
|
|
104323
|
+
return { ...plan, ...updates };
|
|
104324
|
+
}
|
|
104325
|
+
updateActionStep(plan, index, stepUpdates) {
|
|
104326
|
+
if (!plan.steps || index < 0 || index >= plan.steps.length) {
|
|
104327
|
+
this.logger.warn(
|
|
104328
|
+
`Invalid step index: ${index} for plan with ${plan.steps?.length || 0} steps`
|
|
104329
|
+
);
|
|
104330
|
+
return plan;
|
|
104331
|
+
}
|
|
104332
|
+
return {
|
|
104333
|
+
...plan,
|
|
104334
|
+
steps: plan.steps.map(
|
|
104335
|
+
(step, i) => i === index ? { ...step, ...stepUpdates } : step
|
|
104336
|
+
)
|
|
104337
|
+
};
|
|
104338
|
+
}
|
|
104211
104339
|
async processActions(message, responses, state, callback) {
|
|
104340
|
+
const allActions = [];
|
|
104341
|
+
for (const response of responses) {
|
|
104342
|
+
if (response.content?.actions && response.content.actions.length > 0) {
|
|
104343
|
+
allActions.push(...response.content.actions);
|
|
104344
|
+
}
|
|
104345
|
+
}
|
|
104346
|
+
const hasMultipleActions = allActions.length > 1;
|
|
104347
|
+
const runId = this.createRunId();
|
|
104348
|
+
let actionPlan = null;
|
|
104349
|
+
if (hasMultipleActions) {
|
|
104350
|
+
const thought = responses[0]?.content?.thought || `Executing ${allActions.length} actions: ${allActions.join(", ")}`;
|
|
104351
|
+
actionPlan = {
|
|
104352
|
+
runId,
|
|
104353
|
+
totalSteps: allActions.length,
|
|
104354
|
+
currentStep: 0,
|
|
104355
|
+
steps: allActions.map((action) => ({
|
|
104356
|
+
action,
|
|
104357
|
+
status: "pending"
|
|
104358
|
+
})),
|
|
104359
|
+
thought,
|
|
104360
|
+
startTime: Date.now()
|
|
104361
|
+
};
|
|
104362
|
+
}
|
|
104363
|
+
let actionIndex = 0;
|
|
104212
104364
|
for (const response of responses) {
|
|
104213
104365
|
let normalizeAction = function(actionString) {
|
|
104214
|
-
return actionString.toLowerCase().replace(
|
|
104366
|
+
return actionString.toLowerCase().replace(/_/g, "");
|
|
104215
104367
|
};
|
|
104216
104368
|
if (!response.content?.actions || response.content.actions.length === 0) {
|
|
104217
104369
|
this.logger.warn("No action found in the response content.");
|
|
104218
104370
|
continue;
|
|
104219
104371
|
}
|
|
104220
104372
|
const actions = response.content.actions;
|
|
104373
|
+
const actionResults = [];
|
|
104374
|
+
let accumulatedState = state;
|
|
104221
104375
|
this.logger.debug(`Found actions: ${this.actions.map((a) => normalizeAction(a.name))}`);
|
|
104222
104376
|
for (const responseAction of actions) {
|
|
104223
|
-
|
|
104377
|
+
if (actionPlan) {
|
|
104378
|
+
actionPlan = this.updateActionPlan(actionPlan, { currentStep: actionIndex + 1 });
|
|
104379
|
+
}
|
|
104380
|
+
accumulatedState = await this.composeState(message, [
|
|
104381
|
+
"RECENT_MESSAGES",
|
|
104382
|
+
"ACTION_STATE"
|
|
104383
|
+
// This will include the action plan
|
|
104384
|
+
]);
|
|
104385
|
+
if (actionPlan && accumulatedState.data) {
|
|
104386
|
+
accumulatedState.data.actionPlan = actionPlan;
|
|
104387
|
+
accumulatedState.data.actionResults = actionResults;
|
|
104388
|
+
}
|
|
104224
104389
|
this.logger.debug(`Success: Calling action: ${responseAction}`);
|
|
104225
104390
|
const normalizedResponseAction = normalizeAction(responseAction);
|
|
104226
104391
|
let action = this.actions.find(
|
|
@@ -104236,12 +104401,20 @@ var AgentRuntime = class {
|
|
|
104236
104401
|
} else {
|
|
104237
104402
|
this.logger.debug("Attempting to find action in similes.");
|
|
104238
104403
|
for (const _action of this.actions) {
|
|
104239
|
-
const
|
|
104240
|
-
(simile) => simile
|
|
104404
|
+
const exactSimileMatch = _action.similes?.find(
|
|
104405
|
+
(simile) => normalizeAction(simile) === normalizedResponseAction
|
|
104241
104406
|
);
|
|
104242
|
-
if (
|
|
104407
|
+
if (exactSimileMatch) {
|
|
104243
104408
|
action = _action;
|
|
104244
|
-
this.logger.debug(`Success: Action found in similes: ${action.name}`);
|
|
104409
|
+
this.logger.debug(`Success: Action found in similes (exact match): ${action.name}`);
|
|
104410
|
+
break;
|
|
104411
|
+
}
|
|
104412
|
+
const fuzzySimileMatch = _action.similes?.find(
|
|
104413
|
+
(simile) => normalizeAction(simile).includes(normalizedResponseAction) || normalizedResponseAction.includes(normalizeAction(simile))
|
|
104414
|
+
);
|
|
104415
|
+
if (fuzzySimileMatch) {
|
|
104416
|
+
action = _action;
|
|
104417
|
+
this.logger.debug(`Success: Action found in similes (fuzzy match): ${action.name}`);
|
|
104245
104418
|
break;
|
|
104246
104419
|
}
|
|
104247
104420
|
}
|
|
@@ -104249,6 +104422,12 @@ var AgentRuntime = class {
|
|
|
104249
104422
|
if (!action) {
|
|
104250
104423
|
const errorMsg = `No action found for: ${responseAction}`;
|
|
104251
104424
|
this.logger.error(errorMsg);
|
|
104425
|
+
if (actionPlan && actionPlan.steps[actionIndex]) {
|
|
104426
|
+
actionPlan = this.updateActionStep(actionPlan, actionIndex, {
|
|
104427
|
+
status: "failed",
|
|
104428
|
+
error: errorMsg
|
|
104429
|
+
});
|
|
104430
|
+
}
|
|
104252
104431
|
const actionMemory = {
|
|
104253
104432
|
id: v4(),
|
|
104254
104433
|
entityId: message.entityId,
|
|
@@ -104256,14 +104435,26 @@ var AgentRuntime = class {
|
|
|
104256
104435
|
worldId: message.worldId,
|
|
104257
104436
|
content: {
|
|
104258
104437
|
thought: errorMsg,
|
|
104259
|
-
source: "auto"
|
|
104438
|
+
source: "auto",
|
|
104439
|
+
type: "action_result",
|
|
104440
|
+
actionName: responseAction,
|
|
104441
|
+
actionStatus: "failed",
|
|
104442
|
+
runId
|
|
104260
104443
|
}
|
|
104261
104444
|
};
|
|
104262
104445
|
await this.createMemory(actionMemory, "messages");
|
|
104446
|
+
actionIndex++;
|
|
104263
104447
|
continue;
|
|
104264
104448
|
}
|
|
104265
104449
|
if (!action.handler) {
|
|
104266
104450
|
this.logger.error(`Action ${action.name} has no handler.`);
|
|
104451
|
+
if (actionPlan && actionPlan.steps[actionIndex]) {
|
|
104452
|
+
actionPlan = this.updateActionStep(actionPlan, actionIndex, {
|
|
104453
|
+
status: "failed",
|
|
104454
|
+
error: "No handler"
|
|
104455
|
+
});
|
|
104456
|
+
}
|
|
104457
|
+
actionIndex++;
|
|
104267
104458
|
continue;
|
|
104268
104459
|
}
|
|
104269
104460
|
try {
|
|
@@ -104274,9 +104465,130 @@ var AgentRuntime = class {
|
|
|
104274
104465
|
actionId,
|
|
104275
104466
|
prompts: []
|
|
104276
104467
|
};
|
|
104277
|
-
|
|
104278
|
-
|
|
104279
|
-
|
|
104468
|
+
const actionContext = {
|
|
104469
|
+
previousResults: actionResults,
|
|
104470
|
+
getPreviousResult: (actionName) => {
|
|
104471
|
+
return actionResults.find((r) => r.data?.actionName === actionName);
|
|
104472
|
+
}
|
|
104473
|
+
};
|
|
104474
|
+
const options2 = {
|
|
104475
|
+
context: actionContext
|
|
104476
|
+
};
|
|
104477
|
+
if (actionPlan) {
|
|
104478
|
+
options2.actionPlan = {
|
|
104479
|
+
totalSteps: actionPlan.totalSteps,
|
|
104480
|
+
currentStep: actionPlan.currentStep,
|
|
104481
|
+
steps: actionPlan.steps,
|
|
104482
|
+
thought: actionPlan.thought
|
|
104483
|
+
};
|
|
104484
|
+
}
|
|
104485
|
+
const result = await action.handler(
|
|
104486
|
+
this,
|
|
104487
|
+
message,
|
|
104488
|
+
accumulatedState,
|
|
104489
|
+
options2,
|
|
104490
|
+
callback,
|
|
104491
|
+
responses
|
|
104492
|
+
);
|
|
104493
|
+
const isLegacyReturn = result === void 0 || result === null || typeof result === "boolean";
|
|
104494
|
+
let actionResult = null;
|
|
104495
|
+
if (!isLegacyReturn) {
|
|
104496
|
+
if (typeof result === "object" && result !== null && ("values" in result || "data" in result || "text" in result)) {
|
|
104497
|
+
actionResult = {
|
|
104498
|
+
success: true,
|
|
104499
|
+
// Default to true if not specified
|
|
104500
|
+
...result
|
|
104501
|
+
};
|
|
104502
|
+
} else {
|
|
104503
|
+
actionResult = {
|
|
104504
|
+
success: true,
|
|
104505
|
+
// Default success for legacy results
|
|
104506
|
+
data: {
|
|
104507
|
+
actionName: action.name,
|
|
104508
|
+
legacyResult: result
|
|
104509
|
+
}
|
|
104510
|
+
};
|
|
104511
|
+
}
|
|
104512
|
+
actionResults.push(actionResult);
|
|
104513
|
+
if (actionResult.values) {
|
|
104514
|
+
accumulatedState = {
|
|
104515
|
+
...accumulatedState,
|
|
104516
|
+
values: { ...accumulatedState.values, ...actionResult.values },
|
|
104517
|
+
data: {
|
|
104518
|
+
...accumulatedState.data || {},
|
|
104519
|
+
actionResults: [...accumulatedState.data?.actionResults || [], actionResult],
|
|
104520
|
+
actionPlan
|
|
104521
|
+
}
|
|
104522
|
+
};
|
|
104523
|
+
}
|
|
104524
|
+
if (actionResult && accumulatedState.data) {
|
|
104525
|
+
if (!accumulatedState.data.workingMemory) accumulatedState.data.workingMemory = {};
|
|
104526
|
+
const memoryKey = `action_${responseAction}_${v4()}`;
|
|
104527
|
+
const memoryEntry = {
|
|
104528
|
+
actionName: action.name,
|
|
104529
|
+
result: actionResult,
|
|
104530
|
+
timestamp: Date.now()
|
|
104531
|
+
};
|
|
104532
|
+
accumulatedState.data.workingMemory[memoryKey] = memoryEntry;
|
|
104533
|
+
const entries = Object.entries(accumulatedState.data.workingMemory);
|
|
104534
|
+
if (entries.length > this.maxWorkingMemoryEntries) {
|
|
104535
|
+
const sorted = entries.sort((a, b) => {
|
|
104536
|
+
const entryA = a[1];
|
|
104537
|
+
const entryB = b[1];
|
|
104538
|
+
const timestampA = entryA?.timestamp ?? 0;
|
|
104539
|
+
const timestampB = entryB?.timestamp ?? 0;
|
|
104540
|
+
return timestampB - timestampA;
|
|
104541
|
+
});
|
|
104542
|
+
accumulatedState.data.workingMemory = Object.fromEntries(
|
|
104543
|
+
sorted.slice(0, this.maxWorkingMemoryEntries)
|
|
104544
|
+
);
|
|
104545
|
+
}
|
|
104546
|
+
}
|
|
104547
|
+
if (actionPlan && actionPlan.steps[actionIndex]) {
|
|
104548
|
+
actionPlan = this.updateActionStep(actionPlan, actionIndex, {
|
|
104549
|
+
status: "completed",
|
|
104550
|
+
result: actionResult
|
|
104551
|
+
});
|
|
104552
|
+
}
|
|
104553
|
+
}
|
|
104554
|
+
const actionMemory = {
|
|
104555
|
+
id: actionId,
|
|
104556
|
+
entityId: this.agentId,
|
|
104557
|
+
roomId: message.roomId,
|
|
104558
|
+
worldId: message.worldId,
|
|
104559
|
+
content: {
|
|
104560
|
+
text: actionResult?.text || `Executed action: ${action.name}`,
|
|
104561
|
+
source: "action",
|
|
104562
|
+
type: "action_result",
|
|
104563
|
+
actionName: action.name,
|
|
104564
|
+
actionStatus: actionResult?.success ? "completed" : "failed",
|
|
104565
|
+
actionResult: isLegacyReturn ? { legacy: result } : actionResult,
|
|
104566
|
+
runId,
|
|
104567
|
+
...actionPlan && {
|
|
104568
|
+
planStep: `${actionPlan.currentStep}/${actionPlan.totalSteps}`,
|
|
104569
|
+
planThought: actionPlan.thought
|
|
104570
|
+
}
|
|
104571
|
+
},
|
|
104572
|
+
metadata: {
|
|
104573
|
+
type: "action_result",
|
|
104574
|
+
actionName: action.name,
|
|
104575
|
+
runId,
|
|
104576
|
+
actionId,
|
|
104577
|
+
...actionPlan && {
|
|
104578
|
+
totalSteps: actionPlan.totalSteps,
|
|
104579
|
+
currentStep: actionPlan.currentStep
|
|
104580
|
+
}
|
|
104581
|
+
}
|
|
104582
|
+
};
|
|
104583
|
+
await this.createMemory(actionMemory, "messages");
|
|
104584
|
+
this.logger.debug(`Action ${action.name} completed`, {
|
|
104585
|
+
isLegacyReturn,
|
|
104586
|
+
result: isLegacyReturn ? result : void 0,
|
|
104587
|
+
hasValues: actionResult ? !!actionResult.values : false,
|
|
104588
|
+
hasData: actionResult ? !!actionResult.data : false,
|
|
104589
|
+
hasText: actionResult ? !!actionResult.text : false
|
|
104590
|
+
});
|
|
104591
|
+
await this.adapter.log({
|
|
104280
104592
|
entityId: message.entityId,
|
|
104281
104593
|
roomId: message.roomId,
|
|
104282
104594
|
type: "action",
|
|
@@ -104285,30 +104597,82 @@ var AgentRuntime = class {
|
|
|
104285
104597
|
actionId,
|
|
104286
104598
|
message: message.content.text,
|
|
104287
104599
|
messageId: message.id,
|
|
104288
|
-
state,
|
|
104600
|
+
state: accumulatedState,
|
|
104289
104601
|
responses,
|
|
104602
|
+
result: isLegacyReturn ? { legacy: result } : actionResult,
|
|
104603
|
+
isLegacyReturn,
|
|
104290
104604
|
prompts: this.currentActionContext?.prompts || [],
|
|
104291
|
-
promptCount: this.currentActionContext?.prompts.length || 0
|
|
104605
|
+
promptCount: this.currentActionContext?.prompts.length || 0,
|
|
104606
|
+
runId,
|
|
104607
|
+
...actionPlan && {
|
|
104608
|
+
planStep: `${actionPlan.currentStep}/${actionPlan.totalSteps}`,
|
|
104609
|
+
planThought: actionPlan.thought
|
|
104610
|
+
}
|
|
104292
104611
|
}
|
|
104293
104612
|
});
|
|
104294
104613
|
this.currentActionContext = void 0;
|
|
104295
104614
|
} catch (error) {
|
|
104296
104615
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
104297
104616
|
this.logger.error(error);
|
|
104617
|
+
if (actionPlan && actionPlan.steps[actionIndex]) {
|
|
104618
|
+
actionPlan = this.updateActionStep(actionPlan, actionIndex, {
|
|
104619
|
+
status: "failed",
|
|
104620
|
+
error: errorMessage
|
|
104621
|
+
});
|
|
104622
|
+
}
|
|
104298
104623
|
this.currentActionContext = void 0;
|
|
104624
|
+
const errorResult = {
|
|
104625
|
+
success: false,
|
|
104626
|
+
// Required field
|
|
104627
|
+
data: {
|
|
104628
|
+
actionName: action.name,
|
|
104629
|
+
error: errorMessage,
|
|
104630
|
+
errorObject: error
|
|
104631
|
+
}
|
|
104632
|
+
};
|
|
104633
|
+
actionResults.push(errorResult);
|
|
104299
104634
|
const actionMemory = {
|
|
104300
104635
|
id: v4(),
|
|
104301
104636
|
content: {
|
|
104302
104637
|
thought: errorMessage,
|
|
104303
|
-
source: "auto"
|
|
104638
|
+
source: "auto",
|
|
104639
|
+
type: "action_result",
|
|
104640
|
+
actionName: action.name,
|
|
104641
|
+
actionStatus: "failed",
|
|
104642
|
+
error: errorMessage,
|
|
104643
|
+
runId,
|
|
104644
|
+
...actionPlan && {
|
|
104645
|
+
planStep: `${actionPlan.currentStep}/${actionPlan.totalSteps}`,
|
|
104646
|
+
planThought: actionPlan.thought
|
|
104647
|
+
}
|
|
104304
104648
|
},
|
|
104305
|
-
entityId:
|
|
104649
|
+
entityId: this.agentId,
|
|
104306
104650
|
roomId: message.roomId,
|
|
104307
|
-
worldId: message.worldId
|
|
104651
|
+
worldId: message.worldId,
|
|
104652
|
+
metadata: {
|
|
104653
|
+
type: "action_result",
|
|
104654
|
+
actionName: action.name,
|
|
104655
|
+
runId,
|
|
104656
|
+
error: true,
|
|
104657
|
+
...actionPlan && {
|
|
104658
|
+
totalSteps: actionPlan.totalSteps,
|
|
104659
|
+
currentStep: actionPlan.currentStep
|
|
104660
|
+
}
|
|
104661
|
+
}
|
|
104308
104662
|
};
|
|
104309
104663
|
await this.createMemory(actionMemory, "messages");
|
|
104310
|
-
|
|
104664
|
+
if (error?.critical || error?.code === "CRITICAL_ERROR") {
|
|
104665
|
+
throw error;
|
|
104666
|
+
}
|
|
104311
104667
|
}
|
|
104668
|
+
actionIndex++;
|
|
104669
|
+
}
|
|
104670
|
+
if (message.id) {
|
|
104671
|
+
this.stateCache.set(`${message.id}_action_results`, {
|
|
104672
|
+
values: { actionResults },
|
|
104673
|
+
data: { actionResults, actionPlan },
|
|
104674
|
+
text: JSON.stringify(actionResults)
|
|
104675
|
+
});
|
|
104312
104676
|
}
|
|
104313
104677
|
}
|
|
104314
104678
|
}
|
|
@@ -104390,7 +104754,7 @@ var AgentRuntime = class {
|
|
|
104390
104754
|
await this.createRooms(roomObjsToCreate);
|
|
104391
104755
|
}
|
|
104392
104756
|
const entityIds = entities.map((e) => e.id);
|
|
104393
|
-
const entityExistsCheck = await this.adapter.
|
|
104757
|
+
const entityExistsCheck = await this.adapter.getEntitiesByIds(entityIds);
|
|
104394
104758
|
const entitiesToUpdate = entityExistsCheck.map((e) => e.id);
|
|
104395
104759
|
const entitiesToCreate = entities.filter((e) => !entitiesToUpdate.includes(e.id));
|
|
104396
104760
|
const r = {
|
|
@@ -104820,7 +105184,7 @@ var AgentRuntime = class {
|
|
|
104820
105184
|
`[useModel] ${modelKey} input: ` + JSON.stringify(params, safeReplacer(), 2).replace(/\\n/g, "\n")
|
|
104821
105185
|
);
|
|
104822
105186
|
let paramsWithRuntime;
|
|
104823
|
-
if (params === null || params === void 0 || typeof params !== "object" || Array.isArray(params) || typeof distExports
|
|
105187
|
+
if (params === null || params === void 0 || typeof params !== "object" || Array.isArray(params) || typeof distExports.Buffer !== "undefined" && distExports.Buffer.isBuffer(params)) {
|
|
104824
105188
|
paramsWithRuntime = params;
|
|
104825
105189
|
} else {
|
|
104826
105190
|
paramsWithRuntime = {
|
|
@@ -104997,12 +105361,12 @@ var AgentRuntime = class {
|
|
|
104997
105361
|
return newAgent;
|
|
104998
105362
|
}
|
|
104999
105363
|
async getEntityById(entityId) {
|
|
105000
|
-
const entities = await this.adapter.
|
|
105364
|
+
const entities = await this.adapter.getEntitiesByIds([entityId]);
|
|
105001
105365
|
if (!entities?.length) return null;
|
|
105002
105366
|
return entities[0];
|
|
105003
105367
|
}
|
|
105004
|
-
async
|
|
105005
|
-
return await this.adapter.
|
|
105368
|
+
async getEntitiesByIds(entityIds) {
|
|
105369
|
+
return await this.adapter.getEntitiesByIds(entityIds);
|
|
105006
105370
|
}
|
|
105007
105371
|
async getEntitiesForRoom(roomId, includeComponents) {
|
|
105008
105372
|
return await this.adapter.getEntitiesForRoom(roomId, includeComponents);
|
|
@@ -105352,7 +105716,7 @@ function createSettingFromConfig(configSetting) {
|
|
|
105352
105716
|
};
|
|
105353
105717
|
}
|
|
105354
105718
|
function getSalt() {
|
|
105355
|
-
const secretSalt = (typeof distExports
|
|
105719
|
+
const secretSalt = (typeof distExports.process !== "undefined" ? define_process_env_default.SECRET_SALT : undefined ) || "secretsalt";
|
|
105356
105720
|
const salt = secretSalt;
|
|
105357
105721
|
logger.debug(`Generated salt with length: ${salt.length} (truncated for security)`);
|
|
105358
105722
|
return salt;
|
|
@@ -105373,7 +105737,7 @@ function encryptStringValue(value, salt) {
|
|
|
105373
105737
|
const parts = value.split(":");
|
|
105374
105738
|
if (parts.length === 2) {
|
|
105375
105739
|
try {
|
|
105376
|
-
const possibleIv = distExports
|
|
105740
|
+
const possibleIv = distExports.Buffer.from(parts[0], "hex");
|
|
105377
105741
|
if (possibleIv.length === 16) {
|
|
105378
105742
|
logger.debug("Value appears to be already encrypted, skipping re-encryption");
|
|
105379
105743
|
return value;
|
|
@@ -105404,7 +105768,7 @@ function decryptStringValue(value, salt) {
|
|
|
105404
105768
|
if (parts.length !== 2) {
|
|
105405
105769
|
return value;
|
|
105406
105770
|
}
|
|
105407
|
-
const iv = distExports
|
|
105771
|
+
const iv = distExports.Buffer.from(parts[0], "hex");
|
|
105408
105772
|
const encrypted = parts[1];
|
|
105409
105773
|
if (iv.length !== 16) {
|
|
105410
105774
|
if (iv.length) {
|
|
@@ -106557,8 +106921,8 @@ var AgentRuntime2 = class {
|
|
|
106557
106921
|
async getEntityById(entityId) {
|
|
106558
106922
|
return this._runtime.getEntityById(entityId);
|
|
106559
106923
|
}
|
|
106560
|
-
async
|
|
106561
|
-
return this._runtime.
|
|
106924
|
+
async getEntitiesByIds(entityIds) {
|
|
106925
|
+
return this._runtime.getEntitiesByIds(entityIds);
|
|
106562
106926
|
}
|
|
106563
106927
|
async getEntitiesForRoom(roomId, includeComponents) {
|
|
106564
106928
|
return this._runtime.getEntitiesForRoom(roomId, includeComponents);
|
|
@@ -107166,739 +107530,6 @@ function useRequiredSecrets(pluginNames) {
|
|
|
107166
107530
|
};
|
|
107167
107531
|
}
|
|
107168
107532
|
|
|
107169
|
-
const useContainerWidth = (threshold = 768) => {
|
|
107170
|
-
const containerRef = reactExports.useRef(null);
|
|
107171
|
-
const [showLabels, setShowLabels] = reactExports.useState(true);
|
|
107172
|
-
const debounceTimerRef = reactExports.useRef(null);
|
|
107173
|
-
const currentWidthRef = reactExports.useRef(0);
|
|
107174
|
-
reactExports.useEffect(() => {
|
|
107175
|
-
const container = containerRef.current;
|
|
107176
|
-
if (!container) return;
|
|
107177
|
-
const handleResize = (width) => {
|
|
107178
|
-
if (debounceTimerRef.current) {
|
|
107179
|
-
clearTimeout(debounceTimerRef.current);
|
|
107180
|
-
}
|
|
107181
|
-
debounceTimerRef.current = setTimeout(() => {
|
|
107182
|
-
const shouldShowLabels = width >= threshold;
|
|
107183
|
-
setShowLabels((prev) => {
|
|
107184
|
-
if (prev !== shouldShowLabels) {
|
|
107185
|
-
return shouldShowLabels;
|
|
107186
|
-
}
|
|
107187
|
-
return prev;
|
|
107188
|
-
});
|
|
107189
|
-
currentWidthRef.current = width;
|
|
107190
|
-
}, 150);
|
|
107191
|
-
};
|
|
107192
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
107193
|
-
for (const entry of entries) {
|
|
107194
|
-
const { width } = entry.contentRect;
|
|
107195
|
-
if (Math.abs(width - currentWidthRef.current) > 5) {
|
|
107196
|
-
handleResize(width);
|
|
107197
|
-
}
|
|
107198
|
-
}
|
|
107199
|
-
});
|
|
107200
|
-
resizeObserver.observe(container);
|
|
107201
|
-
setTimeout(() => {
|
|
107202
|
-
const { width } = container.getBoundingClientRect();
|
|
107203
|
-
currentWidthRef.current = width;
|
|
107204
|
-
setShowLabels(width >= threshold);
|
|
107205
|
-
}, 0);
|
|
107206
|
-
return () => {
|
|
107207
|
-
resizeObserver.disconnect();
|
|
107208
|
-
if (debounceTimerRef.current) {
|
|
107209
|
-
clearTimeout(debounceTimerRef.current);
|
|
107210
|
-
}
|
|
107211
|
-
};
|
|
107212
|
-
}, [threshold]);
|
|
107213
|
-
return { containerRef, showLabels };
|
|
107214
|
-
};
|
|
107215
|
-
function CharacterForm({
|
|
107216
|
-
characterValue,
|
|
107217
|
-
setCharacterValue,
|
|
107218
|
-
title,
|
|
107219
|
-
description,
|
|
107220
|
-
onSubmit,
|
|
107221
|
-
onDelete,
|
|
107222
|
-
onReset,
|
|
107223
|
-
onStopAgent,
|
|
107224
|
-
isDeleting = false,
|
|
107225
|
-
isStopping = false,
|
|
107226
|
-
customComponents = [],
|
|
107227
|
-
onTemplateChange,
|
|
107228
|
-
secretPanelRef
|
|
107229
|
-
}) {
|
|
107230
|
-
const { toast } = useToast();
|
|
107231
|
-
const { data: elevenlabsVoices, isLoading: isLoadingVoices } = useElevenLabsVoices();
|
|
107232
|
-
const [isSubmitting, setIsSubmitting] = reactExports.useState(false);
|
|
107233
|
-
const [selectedTemplate, setSelectedTemplate] = reactExports.useState("none");
|
|
107234
|
-
const [activeTab, setActiveTab] = reactExports.useState("basic");
|
|
107235
|
-
const tabsContainerRef = reactExports.useRef(null);
|
|
107236
|
-
const [showLeftScroll, setShowLeftScroll] = reactExports.useState(false);
|
|
107237
|
-
const [showRightScroll, setShowRightScroll] = reactExports.useState(false);
|
|
107238
|
-
const [showMissingSecretsDialog, setShowMissingSecretsDialog] = reactExports.useState(false);
|
|
107239
|
-
const [pendingSubmit, setPendingSubmit] = reactExports.useState(null);
|
|
107240
|
-
const enabledPlugins = reactExports.useMemo(() => characterValue?.plugins || [], [characterValue?.plugins]);
|
|
107241
|
-
const { requiredSecrets } = useRequiredSecrets(enabledPlugins);
|
|
107242
|
-
const { containerRef, showLabels } = useContainerWidth(640);
|
|
107243
|
-
const checkScrollButtons = reactExports.useCallback(() => {
|
|
107244
|
-
const container = tabsContainerRef.current;
|
|
107245
|
-
if (!container) return;
|
|
107246
|
-
const { scrollLeft, scrollWidth, clientWidth } = container;
|
|
107247
|
-
setShowLeftScroll(scrollLeft > 0);
|
|
107248
|
-
setShowRightScroll(scrollLeft + clientWidth < scrollWidth - 1);
|
|
107249
|
-
}, []);
|
|
107250
|
-
reactExports.useEffect(() => {
|
|
107251
|
-
const container = tabsContainerRef.current;
|
|
107252
|
-
if (!container) return;
|
|
107253
|
-
checkScrollButtons();
|
|
107254
|
-
container.addEventListener("scroll", checkScrollButtons);
|
|
107255
|
-
window.addEventListener("resize", checkScrollButtons);
|
|
107256
|
-
return () => {
|
|
107257
|
-
container.removeEventListener("scroll", checkScrollButtons);
|
|
107258
|
-
window.removeEventListener("resize", checkScrollButtons);
|
|
107259
|
-
};
|
|
107260
|
-
}, [checkScrollButtons, customComponents.length]);
|
|
107261
|
-
const scrollTabs = (direction) => {
|
|
107262
|
-
const container = tabsContainerRef.current;
|
|
107263
|
-
if (!container) return;
|
|
107264
|
-
const scrollAmount = container.clientWidth * 0.8;
|
|
107265
|
-
container.scrollBy({
|
|
107266
|
-
left: direction === "left" ? -scrollAmount : scrollAmount,
|
|
107267
|
-
behavior: "smooth"
|
|
107268
|
-
});
|
|
107269
|
-
};
|
|
107270
|
-
const allVoiceModels = reactExports.useMemo(() => {
|
|
107271
|
-
const staticModels = getAllVoiceModels();
|
|
107272
|
-
if (elevenlabsVoices && !isLoadingVoices) {
|
|
107273
|
-
const nonElevenLabsModels = staticModels.filter((model) => model.provider !== "elevenlabs");
|
|
107274
|
-
return [...nonElevenLabsModels, ...elevenlabsVoices];
|
|
107275
|
-
}
|
|
107276
|
-
return staticModels;
|
|
107277
|
-
}, [elevenlabsVoices, isLoadingVoices]);
|
|
107278
|
-
const AGENT_FORM_SCHEMA = reactExports.useMemo(
|
|
107279
|
-
() => [
|
|
107280
|
-
{
|
|
107281
|
-
sectionTitle: "Basic Info",
|
|
107282
|
-
sectionValue: "basic",
|
|
107283
|
-
sectionType: "input" /* INPUT */,
|
|
107284
|
-
fields: [
|
|
107285
|
-
{
|
|
107286
|
-
title: "Name",
|
|
107287
|
-
name: "name",
|
|
107288
|
-
description: "The primary identifier for this agent",
|
|
107289
|
-
fieldType: "text",
|
|
107290
|
-
getValue: (char) => char.name || "",
|
|
107291
|
-
tooltip: "Display name that will be visible to users. Required for identification purposes."
|
|
107292
|
-
},
|
|
107293
|
-
{
|
|
107294
|
-
title: "Username",
|
|
107295
|
-
name: "username",
|
|
107296
|
-
description: "Used in URLs and API endpoints",
|
|
107297
|
-
fieldType: "text",
|
|
107298
|
-
getValue: (char) => char.username || "",
|
|
107299
|
-
tooltip: "Unique identifier for your agent. Used in APIs/URLs and Rooms."
|
|
107300
|
-
},
|
|
107301
|
-
{
|
|
107302
|
-
title: "System",
|
|
107303
|
-
name: "system",
|
|
107304
|
-
description: "System prompt defining agent behavior",
|
|
107305
|
-
fieldType: "textarea",
|
|
107306
|
-
getValue: (char) => char.system || "",
|
|
107307
|
-
tooltip: "Instructions for the AI model that establish core behavior patterns and personality traits."
|
|
107308
|
-
},
|
|
107309
|
-
{
|
|
107310
|
-
title: "Voice Model",
|
|
107311
|
-
name: "settings.voice.model",
|
|
107312
|
-
description: "Voice model for audio synthesis",
|
|
107313
|
-
fieldType: "select",
|
|
107314
|
-
getValue: (char) => char.settings?.voice?.model || "",
|
|
107315
|
-
options: allVoiceModels.map((model) => ({
|
|
107316
|
-
value: model.value,
|
|
107317
|
-
label: model.label
|
|
107318
|
-
})),
|
|
107319
|
-
tooltip: "Select a voice that aligns with the agent's intended persona."
|
|
107320
|
-
}
|
|
107321
|
-
]
|
|
107322
|
-
},
|
|
107323
|
-
{
|
|
107324
|
-
sectionTitle: "Content",
|
|
107325
|
-
sectionValue: "content",
|
|
107326
|
-
sectionType: "array" /* ARRAY */,
|
|
107327
|
-
fields: [
|
|
107328
|
-
{
|
|
107329
|
-
title: "Bio",
|
|
107330
|
-
description: "Bio data for this agent",
|
|
107331
|
-
path: "bio",
|
|
107332
|
-
getData: (char) => Array.isArray(char.bio) ? char.bio : [],
|
|
107333
|
-
tooltip: "Biographical details that establish the agent's background and context."
|
|
107334
|
-
},
|
|
107335
|
-
{
|
|
107336
|
-
title: "Topics",
|
|
107337
|
-
description: "Topics this agent can talk about",
|
|
107338
|
-
path: "topics",
|
|
107339
|
-
getData: (char) => char.topics || [],
|
|
107340
|
-
tooltip: "Subject domains the agent can discuss with confidence."
|
|
107341
|
-
},
|
|
107342
|
-
{
|
|
107343
|
-
title: "Adjectives",
|
|
107344
|
-
description: "Descriptive personality traits",
|
|
107345
|
-
path: "adjectives",
|
|
107346
|
-
getData: (char) => char.adjectives || [],
|
|
107347
|
-
tooltip: "Key personality attributes that define the agent's character."
|
|
107348
|
-
}
|
|
107349
|
-
]
|
|
107350
|
-
},
|
|
107351
|
-
{
|
|
107352
|
-
sectionTitle: "Style",
|
|
107353
|
-
sectionValue: "style",
|
|
107354
|
-
sectionType: "array" /* ARRAY */,
|
|
107355
|
-
fields: [
|
|
107356
|
-
{
|
|
107357
|
-
title: "All Styles",
|
|
107358
|
-
description: "Writing style for all content types",
|
|
107359
|
-
path: "style.all",
|
|
107360
|
-
getData: (char) => char.style?.all || [],
|
|
107361
|
-
tooltip: "Core writing style guidelines applied across all content formats."
|
|
107362
|
-
},
|
|
107363
|
-
{
|
|
107364
|
-
title: "Chat Style",
|
|
107365
|
-
description: "Style specific to chat interactions",
|
|
107366
|
-
path: "style.chat",
|
|
107367
|
-
getData: (char) => char.style?.chat || [],
|
|
107368
|
-
tooltip: "Writing style specific to conversational exchanges."
|
|
107369
|
-
},
|
|
107370
|
-
{
|
|
107371
|
-
title: "Post Style",
|
|
107372
|
-
description: "Style for long-form content",
|
|
107373
|
-
path: "style.post",
|
|
107374
|
-
getData: (char) => char.style?.post || [],
|
|
107375
|
-
tooltip: "Writing style for structured content such as articles or posts."
|
|
107376
|
-
}
|
|
107377
|
-
]
|
|
107378
|
-
}
|
|
107379
|
-
],
|
|
107380
|
-
[allVoiceModels]
|
|
107381
|
-
);
|
|
107382
|
-
const handleChange = (e) => {
|
|
107383
|
-
const { name, value, type } = e.target;
|
|
107384
|
-
const checked = e.target.checked;
|
|
107385
|
-
if (type === "checkbox") {
|
|
107386
|
-
setCharacterValue.updateField(name, checked);
|
|
107387
|
-
} else if (name.startsWith("settings.")) {
|
|
107388
|
-
const path = name.substring(9);
|
|
107389
|
-
if (setCharacterValue.updateSetting) {
|
|
107390
|
-
setCharacterValue.updateSetting(path, value);
|
|
107391
|
-
} else {
|
|
107392
|
-
setCharacterValue.updateField(name, value);
|
|
107393
|
-
}
|
|
107394
|
-
} else {
|
|
107395
|
-
setCharacterValue.updateField(name, value);
|
|
107396
|
-
}
|
|
107397
|
-
};
|
|
107398
|
-
const handleVoiceModelChange = (value, name) => {
|
|
107399
|
-
if (name.startsWith("settings.")) {
|
|
107400
|
-
const path = name.substring(9);
|
|
107401
|
-
if (setCharacterValue.updateSetting) {
|
|
107402
|
-
setCharacterValue.updateSetting(path, value);
|
|
107403
|
-
if (path === "voice.model" && value) {
|
|
107404
|
-
const voiceModel = getVoiceModelByValue(value);
|
|
107405
|
-
if (voiceModel) {
|
|
107406
|
-
const currentPlugins = Array.isArray(characterValue.plugins) ? [...characterValue.plugins] : [];
|
|
107407
|
-
const previousVoiceModel = getVoiceModelByValue(
|
|
107408
|
-
characterValue.settings?.voice?.model
|
|
107409
|
-
);
|
|
107410
|
-
const requiredPlugin = providerPluginMap[voiceModel.provider];
|
|
107411
|
-
const newPlugins = [...currentPlugins];
|
|
107412
|
-
if (requiredPlugin && !currentPlugins.includes(requiredPlugin)) {
|
|
107413
|
-
newPlugins.push(requiredPlugin);
|
|
107414
|
-
}
|
|
107415
|
-
if (setCharacterValue.setPlugins) {
|
|
107416
|
-
setCharacterValue.setPlugins(newPlugins);
|
|
107417
|
-
} else if (setCharacterValue.updateField) {
|
|
107418
|
-
setCharacterValue.updateField("plugins", newPlugins);
|
|
107419
|
-
}
|
|
107420
|
-
if (previousVoiceModel?.provider !== voiceModel.provider) {
|
|
107421
|
-
toast({
|
|
107422
|
-
title: "Plugin Updated",
|
|
107423
|
-
description: `${requiredPlugin} plugin has been set for the selected voice model.`
|
|
107424
|
-
});
|
|
107425
|
-
}
|
|
107426
|
-
}
|
|
107427
|
-
}
|
|
107428
|
-
} else {
|
|
107429
|
-
setCharacterValue.updateField(name, value);
|
|
107430
|
-
}
|
|
107431
|
-
} else {
|
|
107432
|
-
setCharacterValue.updateField(name, value);
|
|
107433
|
-
}
|
|
107434
|
-
};
|
|
107435
|
-
const updateArray = (path, newData) => {
|
|
107436
|
-
if (!path.includes(".")) {
|
|
107437
|
-
setCharacterValue.updateField(path, newData);
|
|
107438
|
-
return;
|
|
107439
|
-
}
|
|
107440
|
-
const parts = path.split(".");
|
|
107441
|
-
if (parts.length === 2 && parts[0] === "style") {
|
|
107442
|
-
if (setCharacterValue.setStyleArray) {
|
|
107443
|
-
setCharacterValue.setStyleArray(parts[1], newData);
|
|
107444
|
-
} else {
|
|
107445
|
-
setCharacterValue.updateField(path, newData);
|
|
107446
|
-
}
|
|
107447
|
-
return;
|
|
107448
|
-
}
|
|
107449
|
-
setCharacterValue.updateField(path, newData);
|
|
107450
|
-
};
|
|
107451
|
-
const ensureAvatarSize = async (char) => {
|
|
107452
|
-
if (char.settings?.avatar) {
|
|
107453
|
-
const img = new Image();
|
|
107454
|
-
img.src = char.settings.avatar;
|
|
107455
|
-
await new Promise((resolve) => img.onload = resolve);
|
|
107456
|
-
if (img.width > AVATAR_IMAGE_MAX_SIZE || img.height > AVATAR_IMAGE_MAX_SIZE) {
|
|
107457
|
-
const response = await fetch(char.settings.avatar);
|
|
107458
|
-
const blob = await response.blob();
|
|
107459
|
-
const file = new File([blob], "avatar.jpg", { type: blob.type });
|
|
107460
|
-
const compressedImage = await compressImage(file);
|
|
107461
|
-
return {
|
|
107462
|
-
...char,
|
|
107463
|
-
settings: {
|
|
107464
|
-
...char.settings,
|
|
107465
|
-
avatar: compressedImage
|
|
107466
|
-
}
|
|
107467
|
-
};
|
|
107468
|
-
}
|
|
107469
|
-
}
|
|
107470
|
-
return char;
|
|
107471
|
-
};
|
|
107472
|
-
const handleFormSubmit = async (e) => {
|
|
107473
|
-
e.preventDefault();
|
|
107474
|
-
setIsSubmitting(true);
|
|
107475
|
-
try {
|
|
107476
|
-
const updatedCharacter = await ensureAvatarSize(characterValue);
|
|
107477
|
-
let missingSecrets = [];
|
|
107478
|
-
if (secretPanelRef?.current) {
|
|
107479
|
-
const secretValidation = secretPanelRef.current.validateSecrets();
|
|
107480
|
-
missingSecrets = secretValidation.missingSecrets;
|
|
107481
|
-
} else {
|
|
107482
|
-
const secretsObj = updatedCharacter.settings?.secrets;
|
|
107483
|
-
const currentSecrets = secretsObj && typeof secretsObj === "object" && !Array.isArray(secretsObj) ? secretsObj : {};
|
|
107484
|
-
missingSecrets = requiredSecrets.filter((secret) => {
|
|
107485
|
-
const value = currentSecrets[secret.name];
|
|
107486
|
-
return !value || typeof value === "string" && value.trim() === "";
|
|
107487
|
-
}).map((secret) => secret.name);
|
|
107488
|
-
}
|
|
107489
|
-
if (missingSecrets.length > 0) {
|
|
107490
|
-
setIsSubmitting(false);
|
|
107491
|
-
setPendingSubmit(updatedCharacter);
|
|
107492
|
-
setShowMissingSecretsDialog(true);
|
|
107493
|
-
return;
|
|
107494
|
-
}
|
|
107495
|
-
await onSubmit(updatedCharacter);
|
|
107496
|
-
} catch (error) {
|
|
107497
|
-
toast({
|
|
107498
|
-
title: "Error",
|
|
107499
|
-
description: error instanceof Error ? error.message : "Failed to update agent",
|
|
107500
|
-
variant: "destructive"
|
|
107501
|
-
});
|
|
107502
|
-
} finally {
|
|
107503
|
-
setIsSubmitting(false);
|
|
107504
|
-
}
|
|
107505
|
-
};
|
|
107506
|
-
const handleConfirmSaveWithMissingSecrets = async () => {
|
|
107507
|
-
setShowMissingSecretsDialog(false);
|
|
107508
|
-
if (pendingSubmit) {
|
|
107509
|
-
setIsSubmitting(true);
|
|
107510
|
-
try {
|
|
107511
|
-
await onSubmit(pendingSubmit);
|
|
107512
|
-
} catch (error) {
|
|
107513
|
-
toast({
|
|
107514
|
-
title: "Error",
|
|
107515
|
-
description: error instanceof Error ? error.message : "Failed to update agent",
|
|
107516
|
-
variant: "destructive"
|
|
107517
|
-
});
|
|
107518
|
-
} finally {
|
|
107519
|
-
setIsSubmitting(false);
|
|
107520
|
-
setPendingSubmit(null);
|
|
107521
|
-
}
|
|
107522
|
-
}
|
|
107523
|
-
};
|
|
107524
|
-
const handleCancelSaveWithMissingSecrets = () => {
|
|
107525
|
-
setShowMissingSecretsDialog(false);
|
|
107526
|
-
setPendingSubmit(null);
|
|
107527
|
-
setActiveTab("custom-Secret");
|
|
107528
|
-
};
|
|
107529
|
-
const renderInputField = (field) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
107530
|
-
"div",
|
|
107531
|
-
{
|
|
107532
|
-
className: `w-full ${field.name === "name" ? "agent-form-name" : ""} ${field.name === "system" ? "agent-form-system-prompt" : ""}`,
|
|
107533
|
-
children: [
|
|
107534
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Label$2, { htmlFor: field.name, className: "text-sm font-normal block mb-2", children: [
|
|
107535
|
-
field.title,
|
|
107536
|
-
field.name in FIELD_REQUIREMENTS && FIELD_REQUIREMENTS[field.name] === FIELD_REQUIREMENT_TYPE.REQUIRED && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
107537
|
-
] }),
|
|
107538
|
-
field.fieldType === "textarea" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
107539
|
-
Textarea,
|
|
107540
|
-
{
|
|
107541
|
-
id: field.name,
|
|
107542
|
-
name: field.name,
|
|
107543
|
-
value: field.getValue(characterValue),
|
|
107544
|
-
onChange: handleChange,
|
|
107545
|
-
className: "min-h-[120px] resize-y"
|
|
107546
|
-
}
|
|
107547
|
-
) : field.fieldType === "checkbox" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
107548
|
-
Input,
|
|
107549
|
-
{
|
|
107550
|
-
id: field.name,
|
|
107551
|
-
name: field.name,
|
|
107552
|
-
type: "checkbox",
|
|
107553
|
-
checked: characterValue[field.name] === "true",
|
|
107554
|
-
onChange: handleChange
|
|
107555
|
-
}
|
|
107556
|
-
) : field.fieldType === "select" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
107557
|
-
Select,
|
|
107558
|
-
{
|
|
107559
|
-
name: field.name,
|
|
107560
|
-
value: field.getValue(characterValue),
|
|
107561
|
-
onValueChange: (value) => handleVoiceModelChange(value, field.name),
|
|
107562
|
-
children: [
|
|
107563
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
107564
|
-
SelectValue,
|
|
107565
|
-
{
|
|
107566
|
-
placeholder: field.name.includes("voice.model") && isLoadingVoices ? "Loading voice models..." : "Select a voice model"
|
|
107567
|
-
}
|
|
107568
|
-
) }),
|
|
107569
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectContent, { children: field.name === "settings.voice.model" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
107570
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectGroup, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "none", children: "No Voice" }) }),
|
|
107571
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectSeparator, {}),
|
|
107572
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectGroup, { children: [
|
|
107573
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectLabel, { children: "Local Voices" }),
|
|
107574
|
-
localVoiceModels.map((model) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: model.value, children: model.label.replace("Local Voice - ", "") }, model.value))
|
|
107575
|
-
] }),
|
|
107576
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectSeparator, {}),
|
|
107577
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectGroup, { children: [
|
|
107578
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectLabel, { children: "OpenAI Voices" }),
|
|
107579
|
-
openAIVoiceModels.map((model) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: model.value, children: model.label.replace("OpenAI - ", "") }, model.value))
|
|
107580
|
-
] }),
|
|
107581
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectSeparator, {}),
|
|
107582
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectGroup, { children: [
|
|
107583
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectLabel, { children: "ElevenLabs Voices" }),
|
|
107584
|
-
elevenLabsVoiceModels.map((model) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: model.value, children: model.label.replace("ElevenLabs - ", "") }, model.value)),
|
|
107585
|
-
elevenlabsVoices && elevenlabsVoices.length > 0 && elevenlabsVoices.map((voice) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: voice.value, children: voice.label.replace("ElevenLabs - ", "") }, voice.value))
|
|
107586
|
-
] })
|
|
107587
|
-
] }) : field.options?.map((option) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
107588
|
-
]
|
|
107589
|
-
}
|
|
107590
|
-
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
107591
|
-
Input,
|
|
107592
|
-
{
|
|
107593
|
-
id: field.name,
|
|
107594
|
-
name: field.name,
|
|
107595
|
-
type: field.fieldType,
|
|
107596
|
-
value: field.getValue(characterValue),
|
|
107597
|
-
onChange: handleChange
|
|
107598
|
-
}
|
|
107599
|
-
),
|
|
107600
|
-
field.description && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: field.description })
|
|
107601
|
-
]
|
|
107602
|
-
},
|
|
107603
|
-
field.name
|
|
107604
|
-
);
|
|
107605
|
-
const renderArrayField = (field) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full", children: [
|
|
107606
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Label$2, { htmlFor: field.path, className: "text-sm font-normal block mb-2", children: [
|
|
107607
|
-
field.title,
|
|
107608
|
-
field.path in FIELD_REQUIREMENTS && FIELD_REQUIREMENTS[field.path] === FIELD_REQUIREMENT_TYPE.REQUIRED && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
107609
|
-
] }),
|
|
107610
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
107611
|
-
ArrayInput,
|
|
107612
|
-
{
|
|
107613
|
-
data: field.getData(characterValue),
|
|
107614
|
-
onChange: (newData) => updateArray(field.path, newData)
|
|
107615
|
-
}
|
|
107616
|
-
),
|
|
107617
|
-
field.description && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: field.description })
|
|
107618
|
-
] }, field.path);
|
|
107619
|
-
const handleExportJSON = () => {
|
|
107620
|
-
exportCharacterAsJson(characterValue, toast);
|
|
107621
|
-
};
|
|
107622
|
-
const handleImportJSON = async (event) => {
|
|
107623
|
-
const file = event.target.files?.[0];
|
|
107624
|
-
if (!file) return;
|
|
107625
|
-
try {
|
|
107626
|
-
const text = await file.text();
|
|
107627
|
-
const json = JSON.parse(text);
|
|
107628
|
-
const missingFields = Object.keys(FIELD_REQUIREMENTS).filter((field) => {
|
|
107629
|
-
if (FIELD_REQUIREMENTS[field] !== FIELD_REQUIREMENT_TYPE.REQUIRED) return false;
|
|
107630
|
-
const parts = field.split(".");
|
|
107631
|
-
let current = json;
|
|
107632
|
-
for (const part of parts) {
|
|
107633
|
-
current = current?.[part];
|
|
107634
|
-
if (current === void 0) return true;
|
|
107635
|
-
}
|
|
107636
|
-
return false;
|
|
107637
|
-
});
|
|
107638
|
-
if (missingFields.length > 0) {
|
|
107639
|
-
toast({
|
|
107640
|
-
title: "Import Failed",
|
|
107641
|
-
description: `Missing required fields: ${missingFields.join(", ")}`,
|
|
107642
|
-
variant: "destructive"
|
|
107643
|
-
});
|
|
107644
|
-
return;
|
|
107645
|
-
}
|
|
107646
|
-
if (setCharacterValue.importAgent) {
|
|
107647
|
-
setCharacterValue.importAgent(json);
|
|
107648
|
-
} else {
|
|
107649
|
-
console.warn("Missing importAgent method");
|
|
107650
|
-
}
|
|
107651
|
-
toast({
|
|
107652
|
-
title: "Agent Imported",
|
|
107653
|
-
description: "Agent data has been successfully loaded."
|
|
107654
|
-
});
|
|
107655
|
-
} catch (error) {
|
|
107656
|
-
toast({
|
|
107657
|
-
title: "Import Failed",
|
|
107658
|
-
description: error instanceof Error ? error.message : "Invalid JSON file",
|
|
107659
|
-
variant: "destructive"
|
|
107660
|
-
});
|
|
107661
|
-
} finally {
|
|
107662
|
-
event.target.value = "";
|
|
107663
|
-
}
|
|
107664
|
-
};
|
|
107665
|
-
const fileInputRef = reactExports.useRef(null);
|
|
107666
|
-
const handleImportClick = () => {
|
|
107667
|
-
fileInputRef.current?.click();
|
|
107668
|
-
};
|
|
107669
|
-
const stopDeleteOptions = reactExports.useMemo(() => {
|
|
107670
|
-
const options = [];
|
|
107671
|
-
if (onStopAgent) {
|
|
107672
|
-
options.push({
|
|
107673
|
-
label: "Stop Agent",
|
|
107674
|
-
description: "Stop running",
|
|
107675
|
-
onClick: onStopAgent
|
|
107676
|
-
});
|
|
107677
|
-
}
|
|
107678
|
-
if (onDelete) {
|
|
107679
|
-
options.push({
|
|
107680
|
-
label: "Delete Agent",
|
|
107681
|
-
description: "Delete permanently",
|
|
107682
|
-
onClick: () => onDelete()
|
|
107683
|
-
});
|
|
107684
|
-
}
|
|
107685
|
-
return options;
|
|
107686
|
-
}, [onStopAgent, onDelete]);
|
|
107687
|
-
const handleTemplateChange = reactExports.useCallback(
|
|
107688
|
-
(templateId) => {
|
|
107689
|
-
setSelectedTemplate(templateId);
|
|
107690
|
-
if (templateId === "none" && onReset) {
|
|
107691
|
-
onReset();
|
|
107692
|
-
return;
|
|
107693
|
-
}
|
|
107694
|
-
const template = getTemplateById(templateId);
|
|
107695
|
-
if (template && setCharacterValue.importAgent) {
|
|
107696
|
-
setCharacterValue.importAgent(template.template);
|
|
107697
|
-
onTemplateChange?.();
|
|
107698
|
-
}
|
|
107699
|
-
},
|
|
107700
|
-
[onReset, setCharacterValue, onTemplateChange]
|
|
107701
|
-
);
|
|
107702
|
-
const allTabs = [
|
|
107703
|
-
...AGENT_FORM_SCHEMA.map((section) => ({
|
|
107704
|
-
value: section.sectionValue,
|
|
107705
|
-
label: section.sectionTitle,
|
|
107706
|
-
shortLabel: section.sectionTitle.split(" ")[0]
|
|
107707
|
-
// Use first word for mobile
|
|
107708
|
-
})),
|
|
107709
|
-
...customComponents.map((component) => ({
|
|
107710
|
-
value: `custom-${component.name}`,
|
|
107711
|
-
label: component.name,
|
|
107712
|
-
shortLabel: component.shortLabel || component.name.split(" ")[0]
|
|
107713
|
-
// Use first word
|
|
107714
|
-
}))
|
|
107715
|
-
];
|
|
107716
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: containerRef, className: "w-full max-w-full mx-auto p-6 sm:p-8 h-full overflow-y-auto", children: [
|
|
107717
|
-
(title || description) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-8", children: [
|
|
107718
|
-
title && /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-2xl font-semibold mb-2", children: title }),
|
|
107719
|
-
description && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground whitespace-pre-line", children: description })
|
|
107720
|
-
] }),
|
|
107721
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-8", children: [
|
|
107722
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Label$2, { htmlFor: "template-selector", className: "text-sm", children: "Start with a template" }),
|
|
107723
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: selectedTemplate, onValueChange: handleTemplateChange, children: [
|
|
107724
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-full mt-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "None (blank start)" }) }),
|
|
107725
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectContent, { children: agentTemplates.map((template) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: template.id, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
107726
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "w-full text-left", children: template.label }) }),
|
|
107727
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "max-w-xs", children: template.description }) })
|
|
107728
|
-
] }) }) }, template.id)) })
|
|
107729
|
-
] })
|
|
107730
|
-
] }),
|
|
107731
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("form", { onSubmit: handleFormSubmit, children: [
|
|
107732
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { value: activeTab, onValueChange: setActiveTab, className: "w-full", children: [
|
|
107733
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative mb-4", children: [
|
|
107734
|
-
showLeftScroll && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
107735
|
-
Button,
|
|
107736
|
-
{
|
|
107737
|
-
type: "button",
|
|
107738
|
-
variant: "ghost",
|
|
107739
|
-
size: "sm",
|
|
107740
|
-
className: "absolute left-0 top-1/2 -translate-y-1/2 z-10 h-8 w-8 p-0 bg-background/80 backdrop-blur-sm shadow-md",
|
|
107741
|
-
onClick: () => scrollTabs("left"),
|
|
107742
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronLeft, { className: "h-4 w-4" })
|
|
107743
|
-
}
|
|
107744
|
-
),
|
|
107745
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: tabsContainerRef, className: "overflow-x-auto scrollbar-hide", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TabsList, { className: "inline-flex h-10 items-center justify-start text-muted-foreground w-full", children: allTabs.map((tab) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
107746
|
-
TabsTrigger,
|
|
107747
|
-
{
|
|
107748
|
-
value: tab.value,
|
|
107749
|
-
className: cn(
|
|
107750
|
-
"whitespace-nowrap",
|
|
107751
|
-
!showLabels && "px-2 text-xs"
|
|
107752
|
-
// Smaller padding and text on mobile
|
|
107753
|
-
),
|
|
107754
|
-
children: showLabels ? tab.label : tab.shortLabel
|
|
107755
|
-
},
|
|
107756
|
-
tab.value
|
|
107757
|
-
)) }) }),
|
|
107758
|
-
showRightScroll && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
107759
|
-
Button,
|
|
107760
|
-
{
|
|
107761
|
-
type: "button",
|
|
107762
|
-
variant: "ghost",
|
|
107763
|
-
size: "sm",
|
|
107764
|
-
className: "absolute right-0 top-1/2 -translate-y-1/2 z-10 h-8 w-8 p-0 bg-background/80 backdrop-blur-sm shadow-md",
|
|
107765
|
-
onClick: () => scrollTabs("right"),
|
|
107766
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "h-4 w-4" })
|
|
107767
|
-
}
|
|
107768
|
-
)
|
|
107769
|
-
] }),
|
|
107770
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-h-[100vh] overflow-y-auto pb-4 px-1", children: [
|
|
107771
|
-
AGENT_FORM_SCHEMA.map((section) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
107772
|
-
TabsContent,
|
|
107773
|
-
{
|
|
107774
|
-
value: section.sectionValue,
|
|
107775
|
-
className: "space-y-6 mt-0 focus:outline-none",
|
|
107776
|
-
children: section.sectionType === "input" /* INPUT */ ? section.fields.map(renderInputField) : section.fields.map(renderArrayField)
|
|
107777
|
-
},
|
|
107778
|
-
section.sectionValue
|
|
107779
|
-
)),
|
|
107780
|
-
customComponents.map((component) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
107781
|
-
TabsContent,
|
|
107782
|
-
{
|
|
107783
|
-
value: `custom-${component.name}`,
|
|
107784
|
-
className: "mt-0 focus:outline-none",
|
|
107785
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full", children: component.component })
|
|
107786
|
-
},
|
|
107787
|
-
`custom-${component.name}`
|
|
107788
|
-
))
|
|
107789
|
-
] })
|
|
107790
|
-
] }),
|
|
107791
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between w-full mt-6", children: [
|
|
107792
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
|
|
107793
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { type: "button", variant: "outline", size: "icon", className: "flex-shrink-0 p-2.5", children: [
|
|
107794
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(EllipsisVertical, { className: "h-4 w-4" }),
|
|
107795
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "More options" })
|
|
107796
|
-
] }) }),
|
|
107797
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuContent, { align: "start", side: "top", children: [
|
|
107798
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { onClick: handleImportClick, children: [
|
|
107799
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ArrowDownToLine, { className: "h-4 w-4 mr-2" }),
|
|
107800
|
-
"Import"
|
|
107801
|
-
] }),
|
|
107802
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { onClick: handleExportJSON, children: [
|
|
107803
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ArrowUpFromLine, { className: "h-4 w-4 mr-2" }),
|
|
107804
|
-
"Export"
|
|
107805
|
-
] }),
|
|
107806
|
-
stopDeleteOptions.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuSeparator, {}),
|
|
107807
|
-
stopDeleteOptions.length > 0 && stopDeleteOptions.map((option) => {
|
|
107808
|
-
const isStopAction = option.label === "Stop Agent";
|
|
107809
|
-
const isDeleteAction = option.label === "Delete Agent";
|
|
107810
|
-
const isLoading = isStopAction ? isStopping : isDeleteAction ? isDeleting : false;
|
|
107811
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
107812
|
-
DropdownMenuItem,
|
|
107813
|
-
{
|
|
107814
|
-
onClick: option.onClick,
|
|
107815
|
-
disabled: isLoading,
|
|
107816
|
-
className: isDeleteAction ? "text-destructive focus:text-destructive hover:bg-red-50 dark:hover:bg-red-950/50" : "",
|
|
107817
|
-
children: [
|
|
107818
|
-
isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "h-4 w-4 animate-spin mr-2" }) : isStopAction ? /* @__PURE__ */ jsxRuntimeExports.jsx(CircleStop, { className: "h-4 w-4 mr-2" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Trash, { className: "h-4 w-4 mr-2" }),
|
|
107819
|
-
isLoading ? `${isStopAction ? "Stopping" : "Deleting"}...` : option.label
|
|
107820
|
-
]
|
|
107821
|
-
},
|
|
107822
|
-
option.label
|
|
107823
|
-
);
|
|
107824
|
-
})
|
|
107825
|
-
] })
|
|
107826
|
-
] }),
|
|
107827
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
107828
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
107829
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
107830
|
-
Button,
|
|
107831
|
-
{
|
|
107832
|
-
type: "button",
|
|
107833
|
-
variant: "outline",
|
|
107834
|
-
onClick: () => {
|
|
107835
|
-
onReset?.();
|
|
107836
|
-
},
|
|
107837
|
-
children: [
|
|
107838
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(RotateCcw, { className: "h-4 w-4" }),
|
|
107839
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2", children: "Reset" })
|
|
107840
|
-
]
|
|
107841
|
-
}
|
|
107842
|
-
) }),
|
|
107843
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Reset all form fields to their original values" }) })
|
|
107844
|
-
] }) }),
|
|
107845
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
107846
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "submit", disabled: isSubmitting, className: "agent-form-submit", children: isSubmitting ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
107847
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "h-4 w-4 animate-spin" }),
|
|
107848
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2", children: "Saving..." })
|
|
107849
|
-
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
107850
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Save, { className: "h-4 w-4" }),
|
|
107851
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2", children: "Save" })
|
|
107852
|
-
] }) }) }),
|
|
107853
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Save all changes to the agent configuration" }) })
|
|
107854
|
-
] }) })
|
|
107855
|
-
] }),
|
|
107856
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
107857
|
-
"input",
|
|
107858
|
-
{
|
|
107859
|
-
ref: fileInputRef,
|
|
107860
|
-
type: "file",
|
|
107861
|
-
accept: ".json",
|
|
107862
|
-
onChange: handleImportJSON,
|
|
107863
|
-
className: "hidden"
|
|
107864
|
-
}
|
|
107865
|
-
)
|
|
107866
|
-
] })
|
|
107867
|
-
] }),
|
|
107868
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
107869
|
-
MissingSecretsDialog,
|
|
107870
|
-
{
|
|
107871
|
-
open: showMissingSecretsDialog,
|
|
107872
|
-
onOpenChange: setShowMissingSecretsDialog,
|
|
107873
|
-
missingSecrets: (() => {
|
|
107874
|
-
let missingSecretNames = [];
|
|
107875
|
-
if (secretPanelRef?.current) {
|
|
107876
|
-
const validation = secretPanelRef.current.validateSecrets();
|
|
107877
|
-
missingSecretNames = validation.missingSecrets;
|
|
107878
|
-
} else {
|
|
107879
|
-
const secretsObj = characterValue.settings?.secrets;
|
|
107880
|
-
const currentSecrets = secretsObj && typeof secretsObj === "object" && !Array.isArray(secretsObj) ? secretsObj : {};
|
|
107881
|
-
missingSecretNames = requiredSecrets.filter((secret) => {
|
|
107882
|
-
const value = currentSecrets[secret.name];
|
|
107883
|
-
return !value || typeof value === "string" && value.trim() === "";
|
|
107884
|
-
}).map((secret) => secret.name);
|
|
107885
|
-
}
|
|
107886
|
-
return missingSecretNames.map((secretName) => {
|
|
107887
|
-
const reqSecret = requiredSecrets.find((s) => s.name === secretName);
|
|
107888
|
-
return {
|
|
107889
|
-
name: secretName,
|
|
107890
|
-
plugin: reqSecret?.plugin,
|
|
107891
|
-
description: reqSecret?.description
|
|
107892
|
-
};
|
|
107893
|
-
});
|
|
107894
|
-
})(),
|
|
107895
|
-
onConfirm: handleConfirmSaveWithMissingSecrets,
|
|
107896
|
-
onCancel: handleCancelSaveWithMissingSecrets
|
|
107897
|
-
}
|
|
107898
|
-
)
|
|
107899
|
-
] });
|
|
107900
|
-
}
|
|
107901
|
-
|
|
107902
107533
|
// src/lib/base-client.ts
|
|
107903
107534
|
var ApiError = class extends Error {
|
|
107904
107535
|
constructor(code, message, details, status) {
|
|
@@ -108921,6 +108552,920 @@ function updateApiClientApiKey(newApiKey) {
|
|
|
108921
108552
|
resetElizaClient();
|
|
108922
108553
|
}
|
|
108923
108554
|
|
|
108555
|
+
const REGISTRY_ORG = "elizaos-plugins";
|
|
108556
|
+
const REGISTRY_REPO = "registry";
|
|
108557
|
+
const REGISTRY_URL = `https://raw.githubusercontent.com/${REGISTRY_ORG}/${REGISTRY_REPO}/refs/heads/main/generated-registry.json`;
|
|
108558
|
+
function usePlugins() {
|
|
108559
|
+
return useQuery({
|
|
108560
|
+
queryKey: ["plugins"],
|
|
108561
|
+
queryFn: async () => {
|
|
108562
|
+
try {
|
|
108563
|
+
const elizaClient = createElizaClient();
|
|
108564
|
+
const [registryResponse, agentsResponse] = await Promise.all([
|
|
108565
|
+
fetch(REGISTRY_URL),
|
|
108566
|
+
elizaClient.agents.listAgents()
|
|
108567
|
+
]);
|
|
108568
|
+
const registryData = await registryResponse.json();
|
|
108569
|
+
const registryPlugins = Object.entries(registryData.registry || {}).filter(([name, data]) => {
|
|
108570
|
+
const isPlugin = name.includes("plugin");
|
|
108571
|
+
const hasV1Support = data.supports.v1 === true;
|
|
108572
|
+
const hasV1Version = data.npm.v1 !== null || data.git.v1.version !== null && data.git.v1.branch !== null;
|
|
108573
|
+
return isPlugin && hasV1Support && hasV1Version;
|
|
108574
|
+
}).map(([name]) => name.replace(/^@elizaos-plugins\//, "@elizaos/")).sort();
|
|
108575
|
+
let agentPlugins = [];
|
|
108576
|
+
try {
|
|
108577
|
+
if (agentsResponse?.length > 0) {
|
|
108578
|
+
const activeAgent = agentsResponse.find((agent) => agent.status === "active");
|
|
108579
|
+
if (activeAgent && activeAgent.id) {
|
|
108580
|
+
const agentDetailResponse = await elizaClient.agents.getAgent(activeAgent.id);
|
|
108581
|
+
if (agentDetailResponse?.plugins) {
|
|
108582
|
+
agentPlugins = agentDetailResponse.plugins;
|
|
108583
|
+
}
|
|
108584
|
+
}
|
|
108585
|
+
}
|
|
108586
|
+
} catch (agentError) {
|
|
108587
|
+
clientLogger.warn("Could not fetch agent plugins:", agentError);
|
|
108588
|
+
}
|
|
108589
|
+
const allPlugins = [.../* @__PURE__ */ new Set([...registryPlugins, ...agentPlugins])];
|
|
108590
|
+
return allPlugins.sort();
|
|
108591
|
+
} catch (error) {
|
|
108592
|
+
clientLogger.error("Failed to fetch from registry, falling back to basic list:", error);
|
|
108593
|
+
return [
|
|
108594
|
+
"@elizaos/plugin-bootstrap",
|
|
108595
|
+
"@elizaos/plugin-evm",
|
|
108596
|
+
"@elizaos/plugin-discord",
|
|
108597
|
+
"@elizaos/plugin-elevenlabs",
|
|
108598
|
+
"@elizaos/plugin-anthropic",
|
|
108599
|
+
"@elizaos/plugin-browser",
|
|
108600
|
+
"@elizaos/plugin-farcaster",
|
|
108601
|
+
"@elizaos/plugin-groq"
|
|
108602
|
+
].filter((name) => name.includes("plugin")).sort();
|
|
108603
|
+
}
|
|
108604
|
+
}
|
|
108605
|
+
});
|
|
108606
|
+
}
|
|
108607
|
+
|
|
108608
|
+
const PROVIDER_PLUGIN_MAPPINGS = {
|
|
108609
|
+
google: "@elizaos/plugin-google-genai",
|
|
108610
|
+
llama_local: "@elizaos/plugin-local-ai"
|
|
108611
|
+
// extend as needed
|
|
108612
|
+
};
|
|
108613
|
+
const CLIENT_PLUGIN_MAPPINGS = {
|
|
108614
|
+
// add as needed
|
|
108615
|
+
};
|
|
108616
|
+
const ESSENTIAL_PLUGINS$1 = ["@elizaos/plugin-sql", "@elizaos/plugin-bootstrap"];
|
|
108617
|
+
function useConvertCharacter() {
|
|
108618
|
+
const { data: availablePlugins = [] } = usePlugins();
|
|
108619
|
+
const matchPlugins = (v1) => {
|
|
108620
|
+
const matched = /* @__PURE__ */ new Set();
|
|
108621
|
+
if (Array.isArray(v1.clients)) {
|
|
108622
|
+
for (const client of v1.clients) {
|
|
108623
|
+
const lower = client.toLowerCase();
|
|
108624
|
+
const mapped = CLIENT_PLUGIN_MAPPINGS[lower];
|
|
108625
|
+
if (mapped && availablePlugins.includes(mapped)) {
|
|
108626
|
+
matched.add(mapped);
|
|
108627
|
+
} else {
|
|
108628
|
+
const constructed = `@elizaos/plugin-${lower}`;
|
|
108629
|
+
if (availablePlugins.includes(constructed)) {
|
|
108630
|
+
matched.add(constructed);
|
|
108631
|
+
}
|
|
108632
|
+
}
|
|
108633
|
+
}
|
|
108634
|
+
}
|
|
108635
|
+
let providerMatched = false;
|
|
108636
|
+
if (typeof v1.modelProvider === "string") {
|
|
108637
|
+
const lower = v1.modelProvider.toLowerCase();
|
|
108638
|
+
const mapped = PROVIDER_PLUGIN_MAPPINGS[lower];
|
|
108639
|
+
if (mapped && availablePlugins.includes(mapped)) {
|
|
108640
|
+
matched.add(mapped);
|
|
108641
|
+
providerMatched = true;
|
|
108642
|
+
} else {
|
|
108643
|
+
const constructed = `@elizaos/plugin-${lower}`;
|
|
108644
|
+
if (availablePlugins.includes(constructed)) {
|
|
108645
|
+
matched.add(constructed);
|
|
108646
|
+
providerMatched = true;
|
|
108647
|
+
}
|
|
108648
|
+
}
|
|
108649
|
+
if (!providerMatched) {
|
|
108650
|
+
if (availablePlugins.includes("@elizaos/plugin-openai")) {
|
|
108651
|
+
matched.add("@elizaos/plugin-openai");
|
|
108652
|
+
}
|
|
108653
|
+
}
|
|
108654
|
+
} else {
|
|
108655
|
+
if (availablePlugins.includes("@elizaos/plugin-openai")) {
|
|
108656
|
+
matched.add("@elizaos/plugin-openai");
|
|
108657
|
+
}
|
|
108658
|
+
}
|
|
108659
|
+
for (const plugin of ESSENTIAL_PLUGINS$1) {
|
|
108660
|
+
if (availablePlugins.includes(plugin)) {
|
|
108661
|
+
matched.add(plugin);
|
|
108662
|
+
}
|
|
108663
|
+
}
|
|
108664
|
+
return Array.from(matched).sort();
|
|
108665
|
+
};
|
|
108666
|
+
function isV1MessageExampleFormat(example) {
|
|
108667
|
+
return typeof example === "object" && example !== null && "user" in example;
|
|
108668
|
+
}
|
|
108669
|
+
const convertCharacter = (v1) => {
|
|
108670
|
+
const bio = [...Array.isArray(v1.bio) ? v1.bio : v1.bio ? [v1.bio] : [], ...v1.lore ?? []];
|
|
108671
|
+
const messageExamples = (v1.messageExamples ?? []).map(
|
|
108672
|
+
(thread) => thread.map((msg) => {
|
|
108673
|
+
if (isV1MessageExampleFormat(msg)) {
|
|
108674
|
+
return {
|
|
108675
|
+
name: msg.user,
|
|
108676
|
+
content: msg.content
|
|
108677
|
+
};
|
|
108678
|
+
}
|
|
108679
|
+
return msg;
|
|
108680
|
+
})
|
|
108681
|
+
) ?? [];
|
|
108682
|
+
const plugins = matchPlugins(v1);
|
|
108683
|
+
const v2 = {
|
|
108684
|
+
name: v1.name,
|
|
108685
|
+
username: v1.username,
|
|
108686
|
+
system: v1.system,
|
|
108687
|
+
settings: v1.settings,
|
|
108688
|
+
plugins,
|
|
108689
|
+
bio,
|
|
108690
|
+
topics: v1.topics,
|
|
108691
|
+
style: v1.style,
|
|
108692
|
+
adjectives: v1.adjectives,
|
|
108693
|
+
messageExamples,
|
|
108694
|
+
postExamples: v1.postExamples
|
|
108695
|
+
};
|
|
108696
|
+
return v2;
|
|
108697
|
+
};
|
|
108698
|
+
return { convertCharacter };
|
|
108699
|
+
}
|
|
108700
|
+
|
|
108701
|
+
const useContainerWidth = (threshold = 768) => {
|
|
108702
|
+
const containerRef = reactExports.useRef(null);
|
|
108703
|
+
const [showLabels, setShowLabels] = reactExports.useState(true);
|
|
108704
|
+
const debounceTimerRef = reactExports.useRef(null);
|
|
108705
|
+
const currentWidthRef = reactExports.useRef(0);
|
|
108706
|
+
reactExports.useEffect(() => {
|
|
108707
|
+
const container = containerRef.current;
|
|
108708
|
+
if (!container) return;
|
|
108709
|
+
const handleResize = (width) => {
|
|
108710
|
+
if (debounceTimerRef.current) {
|
|
108711
|
+
clearTimeout(debounceTimerRef.current);
|
|
108712
|
+
}
|
|
108713
|
+
debounceTimerRef.current = setTimeout(() => {
|
|
108714
|
+
const shouldShowLabels = width >= threshold;
|
|
108715
|
+
setShowLabels((prev) => {
|
|
108716
|
+
if (prev !== shouldShowLabels) {
|
|
108717
|
+
return shouldShowLabels;
|
|
108718
|
+
}
|
|
108719
|
+
return prev;
|
|
108720
|
+
});
|
|
108721
|
+
currentWidthRef.current = width;
|
|
108722
|
+
}, 150);
|
|
108723
|
+
};
|
|
108724
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
108725
|
+
for (const entry of entries) {
|
|
108726
|
+
const { width } = entry.contentRect;
|
|
108727
|
+
if (Math.abs(width - currentWidthRef.current) > 5) {
|
|
108728
|
+
handleResize(width);
|
|
108729
|
+
}
|
|
108730
|
+
}
|
|
108731
|
+
});
|
|
108732
|
+
resizeObserver.observe(container);
|
|
108733
|
+
setTimeout(() => {
|
|
108734
|
+
const { width } = container.getBoundingClientRect();
|
|
108735
|
+
currentWidthRef.current = width;
|
|
108736
|
+
setShowLabels(width >= threshold);
|
|
108737
|
+
}, 0);
|
|
108738
|
+
return () => {
|
|
108739
|
+
resizeObserver.disconnect();
|
|
108740
|
+
if (debounceTimerRef.current) {
|
|
108741
|
+
clearTimeout(debounceTimerRef.current);
|
|
108742
|
+
}
|
|
108743
|
+
};
|
|
108744
|
+
}, [threshold]);
|
|
108745
|
+
return { containerRef, showLabels };
|
|
108746
|
+
};
|
|
108747
|
+
function CharacterForm({
|
|
108748
|
+
characterValue,
|
|
108749
|
+
setCharacterValue,
|
|
108750
|
+
title,
|
|
108751
|
+
description,
|
|
108752
|
+
onSubmit,
|
|
108753
|
+
onDelete,
|
|
108754
|
+
onReset,
|
|
108755
|
+
onStopAgent,
|
|
108756
|
+
isDeleting = false,
|
|
108757
|
+
isStopping = false,
|
|
108758
|
+
customComponents = [],
|
|
108759
|
+
onTemplateChange,
|
|
108760
|
+
secretPanelRef
|
|
108761
|
+
}) {
|
|
108762
|
+
const { toast } = useToast();
|
|
108763
|
+
const { data: elevenlabsVoices, isLoading: isLoadingVoices } = useElevenLabsVoices();
|
|
108764
|
+
const [isSubmitting, setIsSubmitting] = reactExports.useState(false);
|
|
108765
|
+
const [selectedTemplate, setSelectedTemplate] = reactExports.useState("none");
|
|
108766
|
+
const [activeTab, setActiveTab] = reactExports.useState("basic");
|
|
108767
|
+
const tabsContainerRef = reactExports.useRef(null);
|
|
108768
|
+
const [showLeftScroll, setShowLeftScroll] = reactExports.useState(false);
|
|
108769
|
+
const [showRightScroll, setShowRightScroll] = reactExports.useState(false);
|
|
108770
|
+
const [showMissingSecretsDialog, setShowMissingSecretsDialog] = reactExports.useState(false);
|
|
108771
|
+
const [pendingSubmit, setPendingSubmit] = reactExports.useState(null);
|
|
108772
|
+
const [globalEnvs, setGlobalEnvs] = reactExports.useState({});
|
|
108773
|
+
const enabledPlugins = reactExports.useMemo(() => characterValue?.plugins || [], [characterValue?.plugins]);
|
|
108774
|
+
const { requiredSecrets } = useRequiredSecrets(enabledPlugins);
|
|
108775
|
+
const { convertCharacter } = useConvertCharacter();
|
|
108776
|
+
reactExports.useEffect(() => {
|
|
108777
|
+
const fetchGlobalEnvs = async () => {
|
|
108778
|
+
try {
|
|
108779
|
+
const elizaClient = createElizaClient();
|
|
108780
|
+
const data = await elizaClient.system.getEnvironment();
|
|
108781
|
+
setGlobalEnvs(data || {});
|
|
108782
|
+
} catch (error) {
|
|
108783
|
+
console.error("Failed to fetch global environment variables:", error);
|
|
108784
|
+
setGlobalEnvs({});
|
|
108785
|
+
}
|
|
108786
|
+
};
|
|
108787
|
+
fetchGlobalEnvs();
|
|
108788
|
+
}, []);
|
|
108789
|
+
const { containerRef, showLabels } = useContainerWidth(640);
|
|
108790
|
+
const checkScrollButtons = reactExports.useCallback(() => {
|
|
108791
|
+
const container = tabsContainerRef.current;
|
|
108792
|
+
if (!container) return;
|
|
108793
|
+
const { scrollLeft, scrollWidth, clientWidth } = container;
|
|
108794
|
+
setShowLeftScroll(scrollLeft > 0);
|
|
108795
|
+
setShowRightScroll(scrollLeft + clientWidth < scrollWidth - 1);
|
|
108796
|
+
}, []);
|
|
108797
|
+
reactExports.useEffect(() => {
|
|
108798
|
+
const container = tabsContainerRef.current;
|
|
108799
|
+
if (!container) return;
|
|
108800
|
+
checkScrollButtons();
|
|
108801
|
+
container.addEventListener("scroll", checkScrollButtons);
|
|
108802
|
+
window.addEventListener("resize", checkScrollButtons);
|
|
108803
|
+
return () => {
|
|
108804
|
+
container.removeEventListener("scroll", checkScrollButtons);
|
|
108805
|
+
window.removeEventListener("resize", checkScrollButtons);
|
|
108806
|
+
};
|
|
108807
|
+
}, [checkScrollButtons, customComponents.length]);
|
|
108808
|
+
const scrollTabs = (direction) => {
|
|
108809
|
+
const container = tabsContainerRef.current;
|
|
108810
|
+
if (!container) return;
|
|
108811
|
+
const scrollAmount = container.clientWidth * 0.8;
|
|
108812
|
+
container.scrollBy({
|
|
108813
|
+
left: direction === "left" ? -scrollAmount : scrollAmount,
|
|
108814
|
+
behavior: "smooth"
|
|
108815
|
+
});
|
|
108816
|
+
};
|
|
108817
|
+
const allVoiceModels = reactExports.useMemo(() => {
|
|
108818
|
+
const staticModels = getAllVoiceModels();
|
|
108819
|
+
if (elevenlabsVoices && !isLoadingVoices) {
|
|
108820
|
+
const nonElevenLabsModels = staticModels.filter((model) => model.provider !== "elevenlabs");
|
|
108821
|
+
return [...nonElevenLabsModels, ...elevenlabsVoices];
|
|
108822
|
+
}
|
|
108823
|
+
return staticModels;
|
|
108824
|
+
}, [elevenlabsVoices, isLoadingVoices]);
|
|
108825
|
+
const AGENT_FORM_SCHEMA = reactExports.useMemo(
|
|
108826
|
+
() => [
|
|
108827
|
+
{
|
|
108828
|
+
sectionTitle: "Basic Info",
|
|
108829
|
+
sectionValue: "basic",
|
|
108830
|
+
sectionType: "input",
|
|
108831
|
+
fields: [
|
|
108832
|
+
{
|
|
108833
|
+
title: "Name",
|
|
108834
|
+
name: "name",
|
|
108835
|
+
description: "The primary identifier for this agent",
|
|
108836
|
+
fieldType: "text",
|
|
108837
|
+
getValue: (char) => char.name || "",
|
|
108838
|
+
tooltip: "Display name that will be visible to users. Required for identification purposes."
|
|
108839
|
+
},
|
|
108840
|
+
{
|
|
108841
|
+
title: "Username",
|
|
108842
|
+
name: "username",
|
|
108843
|
+
description: "Used in URLs and API endpoints",
|
|
108844
|
+
fieldType: "text",
|
|
108845
|
+
getValue: (char) => char.username || "",
|
|
108846
|
+
tooltip: "Unique identifier for your agent. Used in APIs/URLs and Rooms."
|
|
108847
|
+
},
|
|
108848
|
+
{
|
|
108849
|
+
title: "System",
|
|
108850
|
+
name: "system",
|
|
108851
|
+
description: "System prompt defining agent behavior",
|
|
108852
|
+
fieldType: "textarea",
|
|
108853
|
+
getValue: (char) => char.system || "",
|
|
108854
|
+
tooltip: "Instructions for the AI model that establish core behavior patterns and personality traits."
|
|
108855
|
+
},
|
|
108856
|
+
{
|
|
108857
|
+
title: "Voice Model",
|
|
108858
|
+
name: "settings.voice.model",
|
|
108859
|
+
description: "Voice model for audio synthesis",
|
|
108860
|
+
fieldType: "select",
|
|
108861
|
+
getValue: (char) => char.settings?.voice?.model || "",
|
|
108862
|
+
options: allVoiceModels.map((model) => ({
|
|
108863
|
+
value: model.value,
|
|
108864
|
+
label: model.label
|
|
108865
|
+
})),
|
|
108866
|
+
tooltip: "Select a voice that aligns with the agent's intended persona."
|
|
108867
|
+
}
|
|
108868
|
+
]
|
|
108869
|
+
},
|
|
108870
|
+
{
|
|
108871
|
+
sectionTitle: "Content",
|
|
108872
|
+
sectionValue: "content",
|
|
108873
|
+
sectionType: "array",
|
|
108874
|
+
fields: [
|
|
108875
|
+
{
|
|
108876
|
+
title: "Bio",
|
|
108877
|
+
description: "Bio data for this agent",
|
|
108878
|
+
path: "bio",
|
|
108879
|
+
getData: (char) => Array.isArray(char.bio) ? char.bio : [],
|
|
108880
|
+
tooltip: "Biographical details that establish the agent's background and context."
|
|
108881
|
+
},
|
|
108882
|
+
{
|
|
108883
|
+
title: "Topics",
|
|
108884
|
+
description: "Topics this agent can talk about",
|
|
108885
|
+
path: "topics",
|
|
108886
|
+
getData: (char) => char.topics || [],
|
|
108887
|
+
tooltip: "Subject domains the agent can discuss with confidence."
|
|
108888
|
+
},
|
|
108889
|
+
{
|
|
108890
|
+
title: "Adjectives",
|
|
108891
|
+
description: "Descriptive personality traits",
|
|
108892
|
+
path: "adjectives",
|
|
108893
|
+
getData: (char) => char.adjectives || [],
|
|
108894
|
+
tooltip: "Key personality attributes that define the agent's character."
|
|
108895
|
+
}
|
|
108896
|
+
]
|
|
108897
|
+
},
|
|
108898
|
+
{
|
|
108899
|
+
sectionTitle: "Style",
|
|
108900
|
+
sectionValue: "style",
|
|
108901
|
+
sectionType: "array",
|
|
108902
|
+
fields: [
|
|
108903
|
+
{
|
|
108904
|
+
title: "All Styles",
|
|
108905
|
+
description: "Writing style for all content types",
|
|
108906
|
+
path: "style.all",
|
|
108907
|
+
getData: (char) => char.style?.all || [],
|
|
108908
|
+
tooltip: "Core writing style guidelines applied across all content formats."
|
|
108909
|
+
},
|
|
108910
|
+
{
|
|
108911
|
+
title: "Chat Style",
|
|
108912
|
+
description: "Style specific to chat interactions",
|
|
108913
|
+
path: "style.chat",
|
|
108914
|
+
getData: (char) => char.style?.chat || [],
|
|
108915
|
+
tooltip: "Writing style specific to conversational exchanges."
|
|
108916
|
+
},
|
|
108917
|
+
{
|
|
108918
|
+
title: "Post Style",
|
|
108919
|
+
description: "Style for long-form content",
|
|
108920
|
+
path: "style.post",
|
|
108921
|
+
getData: (char) => char.style?.post || [],
|
|
108922
|
+
tooltip: "Writing style for structured content such as articles or posts."
|
|
108923
|
+
}
|
|
108924
|
+
]
|
|
108925
|
+
}
|
|
108926
|
+
],
|
|
108927
|
+
[allVoiceModels]
|
|
108928
|
+
);
|
|
108929
|
+
const handleChange = (e) => {
|
|
108930
|
+
const { name, value, type } = e.target;
|
|
108931
|
+
const checked = e.target.checked;
|
|
108932
|
+
if (type === "checkbox") {
|
|
108933
|
+
setCharacterValue.updateField(name, checked);
|
|
108934
|
+
} else if (name.startsWith("settings.")) {
|
|
108935
|
+
const path = name.substring(9);
|
|
108936
|
+
if (setCharacterValue.updateSetting) {
|
|
108937
|
+
setCharacterValue.updateSetting(path, value);
|
|
108938
|
+
} else {
|
|
108939
|
+
setCharacterValue.updateField(name, value);
|
|
108940
|
+
}
|
|
108941
|
+
} else {
|
|
108942
|
+
setCharacterValue.updateField(name, value);
|
|
108943
|
+
}
|
|
108944
|
+
};
|
|
108945
|
+
const handleVoiceModelChange = (value, name) => {
|
|
108946
|
+
if (name.startsWith("settings.")) {
|
|
108947
|
+
const path = name.substring(9);
|
|
108948
|
+
if (setCharacterValue.updateSetting) {
|
|
108949
|
+
setCharacterValue.updateSetting(path, value);
|
|
108950
|
+
if (path === "voice.model" && value) {
|
|
108951
|
+
const voiceModel = getVoiceModelByValue(value);
|
|
108952
|
+
if (voiceModel) {
|
|
108953
|
+
const currentPlugins = Array.isArray(characterValue.plugins) ? [...characterValue.plugins] : [];
|
|
108954
|
+
const previousVoiceModel = getVoiceModelByValue(
|
|
108955
|
+
characterValue.settings?.voice?.model
|
|
108956
|
+
);
|
|
108957
|
+
const requiredPlugin = providerPluginMap[voiceModel.provider];
|
|
108958
|
+
const newPlugins = [...currentPlugins];
|
|
108959
|
+
if (requiredPlugin && !currentPlugins.includes(requiredPlugin)) {
|
|
108960
|
+
newPlugins.push(requiredPlugin);
|
|
108961
|
+
}
|
|
108962
|
+
if (setCharacterValue.setPlugins) {
|
|
108963
|
+
setCharacterValue.setPlugins(newPlugins);
|
|
108964
|
+
} else if (setCharacterValue.updateField) {
|
|
108965
|
+
setCharacterValue.updateField("plugins", newPlugins);
|
|
108966
|
+
}
|
|
108967
|
+
if (previousVoiceModel?.provider !== voiceModel.provider) {
|
|
108968
|
+
toast({
|
|
108969
|
+
title: "Plugin Updated",
|
|
108970
|
+
description: `${requiredPlugin} plugin has been set for the selected voice model.`
|
|
108971
|
+
});
|
|
108972
|
+
}
|
|
108973
|
+
}
|
|
108974
|
+
}
|
|
108975
|
+
} else {
|
|
108976
|
+
setCharacterValue.updateField(name, value);
|
|
108977
|
+
}
|
|
108978
|
+
} else {
|
|
108979
|
+
setCharacterValue.updateField(name, value);
|
|
108980
|
+
}
|
|
108981
|
+
};
|
|
108982
|
+
const updateArray = (path, newData) => {
|
|
108983
|
+
if (!path.includes(".")) {
|
|
108984
|
+
setCharacterValue.updateField(path, newData);
|
|
108985
|
+
return;
|
|
108986
|
+
}
|
|
108987
|
+
const parts = path.split(".");
|
|
108988
|
+
if (parts.length === 2 && parts[0] === "style") {
|
|
108989
|
+
if (setCharacterValue.setStyleArray) {
|
|
108990
|
+
setCharacterValue.setStyleArray(parts[1], newData);
|
|
108991
|
+
} else {
|
|
108992
|
+
setCharacterValue.updateField(path, newData);
|
|
108993
|
+
}
|
|
108994
|
+
return;
|
|
108995
|
+
}
|
|
108996
|
+
setCharacterValue.updateField(path, newData);
|
|
108997
|
+
};
|
|
108998
|
+
const ensureAvatarSize = async (char) => {
|
|
108999
|
+
if (char.settings?.avatar) {
|
|
109000
|
+
const img = new Image();
|
|
109001
|
+
img.src = char.settings.avatar;
|
|
109002
|
+
await new Promise((resolve) => img.onload = resolve);
|
|
109003
|
+
if (img.width > AVATAR_IMAGE_MAX_SIZE || img.height > AVATAR_IMAGE_MAX_SIZE) {
|
|
109004
|
+
const response = await fetch(char.settings.avatar);
|
|
109005
|
+
const blob = await response.blob();
|
|
109006
|
+
const file = new File([blob], "avatar.jpg", { type: blob.type });
|
|
109007
|
+
const compressedImage = await compressImage(file);
|
|
109008
|
+
return {
|
|
109009
|
+
...char,
|
|
109010
|
+
settings: {
|
|
109011
|
+
...char.settings,
|
|
109012
|
+
avatar: compressedImage
|
|
109013
|
+
}
|
|
109014
|
+
};
|
|
109015
|
+
}
|
|
109016
|
+
}
|
|
109017
|
+
return char;
|
|
109018
|
+
};
|
|
109019
|
+
const handleFormSubmit = async (e) => {
|
|
109020
|
+
e.preventDefault();
|
|
109021
|
+
setIsSubmitting(true);
|
|
109022
|
+
try {
|
|
109023
|
+
const updatedCharacter = await ensureAvatarSize(characterValue);
|
|
109024
|
+
let missingSecrets = [];
|
|
109025
|
+
if (secretPanelRef?.current) {
|
|
109026
|
+
const secretValidation = secretPanelRef.current.validateSecrets();
|
|
109027
|
+
missingSecrets = secretValidation.missingSecrets;
|
|
109028
|
+
} else {
|
|
109029
|
+
const secretsObj = updatedCharacter.settings?.secrets;
|
|
109030
|
+
const currentSecrets = secretsObj && typeof secretsObj === "object" && !Array.isArray(secretsObj) ? secretsObj : {};
|
|
109031
|
+
missingSecrets = requiredSecrets.filter((secret) => {
|
|
109032
|
+
const value = currentSecrets[secret.name];
|
|
109033
|
+
if (value && typeof value === "string" && value.trim() !== "") {
|
|
109034
|
+
return false;
|
|
109035
|
+
}
|
|
109036
|
+
const globalValue = globalEnvs[secret.name];
|
|
109037
|
+
if (globalValue && globalValue.trim() !== "") {
|
|
109038
|
+
return false;
|
|
109039
|
+
}
|
|
109040
|
+
return true;
|
|
109041
|
+
}).map((secret) => secret.name);
|
|
109042
|
+
}
|
|
109043
|
+
if (missingSecrets.length > 0) {
|
|
109044
|
+
setIsSubmitting(false);
|
|
109045
|
+
setPendingSubmit(updatedCharacter);
|
|
109046
|
+
setShowMissingSecretsDialog(true);
|
|
109047
|
+
return;
|
|
109048
|
+
}
|
|
109049
|
+
await onSubmit(updatedCharacter);
|
|
109050
|
+
} catch (error) {
|
|
109051
|
+
toast({
|
|
109052
|
+
title: "Error",
|
|
109053
|
+
description: error instanceof Error ? error.message : "Failed to update agent",
|
|
109054
|
+
variant: "destructive"
|
|
109055
|
+
});
|
|
109056
|
+
} finally {
|
|
109057
|
+
setIsSubmitting(false);
|
|
109058
|
+
}
|
|
109059
|
+
};
|
|
109060
|
+
const handleConfirmSaveWithMissingSecrets = async () => {
|
|
109061
|
+
setShowMissingSecretsDialog(false);
|
|
109062
|
+
if (pendingSubmit) {
|
|
109063
|
+
setIsSubmitting(true);
|
|
109064
|
+
try {
|
|
109065
|
+
await onSubmit(pendingSubmit);
|
|
109066
|
+
} catch (error) {
|
|
109067
|
+
toast({
|
|
109068
|
+
title: "Error",
|
|
109069
|
+
description: error instanceof Error ? error.message : "Failed to update agent",
|
|
109070
|
+
variant: "destructive"
|
|
109071
|
+
});
|
|
109072
|
+
} finally {
|
|
109073
|
+
setIsSubmitting(false);
|
|
109074
|
+
setPendingSubmit(null);
|
|
109075
|
+
}
|
|
109076
|
+
}
|
|
109077
|
+
};
|
|
109078
|
+
const handleCancelSaveWithMissingSecrets = () => {
|
|
109079
|
+
setShowMissingSecretsDialog(false);
|
|
109080
|
+
setPendingSubmit(null);
|
|
109081
|
+
setActiveTab("custom-Secret");
|
|
109082
|
+
};
|
|
109083
|
+
const renderInputField = (field) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
109084
|
+
"div",
|
|
109085
|
+
{
|
|
109086
|
+
className: `w-full ${field.name === "name" ? "agent-form-name" : ""} ${field.name === "system" ? "agent-form-system-prompt" : ""}`,
|
|
109087
|
+
children: [
|
|
109088
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Label$2, { htmlFor: field.name, className: "text-sm font-normal block mb-2", children: [
|
|
109089
|
+
field.title,
|
|
109090
|
+
field.name in FIELD_REQUIREMENTS && FIELD_REQUIREMENTS[field.name] === FIELD_REQUIREMENT_TYPE.REQUIRED && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
109091
|
+
] }),
|
|
109092
|
+
field.fieldType === "textarea" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109093
|
+
Textarea,
|
|
109094
|
+
{
|
|
109095
|
+
id: field.name,
|
|
109096
|
+
name: field.name,
|
|
109097
|
+
value: field.getValue(characterValue),
|
|
109098
|
+
onChange: handleChange,
|
|
109099
|
+
className: "min-h-[120px] resize-y"
|
|
109100
|
+
}
|
|
109101
|
+
) : field.fieldType === "checkbox" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109102
|
+
Input,
|
|
109103
|
+
{
|
|
109104
|
+
id: field.name,
|
|
109105
|
+
name: field.name,
|
|
109106
|
+
type: "checkbox",
|
|
109107
|
+
checked: characterValue[field.name] === "true",
|
|
109108
|
+
onChange: handleChange
|
|
109109
|
+
}
|
|
109110
|
+
) : field.fieldType === "select" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
109111
|
+
Select,
|
|
109112
|
+
{
|
|
109113
|
+
name: field.name,
|
|
109114
|
+
value: field.getValue(characterValue),
|
|
109115
|
+
onValueChange: (value) => handleVoiceModelChange(value, field.name),
|
|
109116
|
+
children: [
|
|
109117
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109118
|
+
SelectValue,
|
|
109119
|
+
{
|
|
109120
|
+
placeholder: field.name.includes("voice.model") && isLoadingVoices ? "Loading voice models..." : "Select a voice model"
|
|
109121
|
+
}
|
|
109122
|
+
) }),
|
|
109123
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectContent, { children: field.name === "settings.voice.model" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
109124
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectGroup, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "none", children: "No Voice" }) }),
|
|
109125
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectSeparator, {}),
|
|
109126
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectGroup, { children: [
|
|
109127
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectLabel, { children: "Local Voices" }),
|
|
109128
|
+
localVoiceModels.map((model) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: model.value, children: model.label.replace("Local Voice - ", "") }, model.value))
|
|
109129
|
+
] }),
|
|
109130
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectSeparator, {}),
|
|
109131
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectGroup, { children: [
|
|
109132
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectLabel, { children: "OpenAI Voices" }),
|
|
109133
|
+
openAIVoiceModels.map((model) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: model.value, children: model.label.replace("OpenAI - ", "") }, model.value))
|
|
109134
|
+
] }),
|
|
109135
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectSeparator, {}),
|
|
109136
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectGroup, { children: [
|
|
109137
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectLabel, { children: "ElevenLabs Voices" }),
|
|
109138
|
+
elevenLabsVoiceModels.map((model) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: model.value, children: model.label.replace("ElevenLabs - ", "") }, model.value)),
|
|
109139
|
+
elevenlabsVoices && elevenlabsVoices.length > 0 && elevenlabsVoices.map((voice) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: voice.value, children: voice.label.replace("ElevenLabs - ", "") }, voice.value))
|
|
109140
|
+
] })
|
|
109141
|
+
] }) : field.options?.map((option) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
109142
|
+
]
|
|
109143
|
+
}
|
|
109144
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109145
|
+
Input,
|
|
109146
|
+
{
|
|
109147
|
+
id: field.name,
|
|
109148
|
+
name: field.name,
|
|
109149
|
+
type: field.fieldType,
|
|
109150
|
+
value: field.getValue(characterValue),
|
|
109151
|
+
onChange: handleChange
|
|
109152
|
+
}
|
|
109153
|
+
),
|
|
109154
|
+
field.description && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: field.description })
|
|
109155
|
+
]
|
|
109156
|
+
},
|
|
109157
|
+
field.name
|
|
109158
|
+
);
|
|
109159
|
+
const renderArrayField = (field) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full", children: [
|
|
109160
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Label$2, { htmlFor: field.path, className: "text-sm font-normal block mb-2", children: [
|
|
109161
|
+
field.title,
|
|
109162
|
+
field.path in FIELD_REQUIREMENTS && FIELD_REQUIREMENTS[field.path] === FIELD_REQUIREMENT_TYPE.REQUIRED && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
109163
|
+
] }),
|
|
109164
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109165
|
+
ArrayInput,
|
|
109166
|
+
{
|
|
109167
|
+
data: field.getData(characterValue),
|
|
109168
|
+
onChange: (newData) => updateArray(field.path, newData)
|
|
109169
|
+
}
|
|
109170
|
+
),
|
|
109171
|
+
field.description && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: field.description })
|
|
109172
|
+
] }, field.path);
|
|
109173
|
+
const handleExportJSON = () => {
|
|
109174
|
+
exportCharacterAsJson(characterValue, toast);
|
|
109175
|
+
};
|
|
109176
|
+
function isV1Character(char) {
|
|
109177
|
+
return typeof char === "object" && char !== null && ("lore" in char || "clients" in char || "modelProvider" in char);
|
|
109178
|
+
}
|
|
109179
|
+
const handleImportJSON = async (event) => {
|
|
109180
|
+
const file = event.target.files?.[0];
|
|
109181
|
+
if (!file) return;
|
|
109182
|
+
try {
|
|
109183
|
+
const text = await file.text();
|
|
109184
|
+
let json = JSON.parse(text);
|
|
109185
|
+
if (isV1Character(json)) {
|
|
109186
|
+
json = convertCharacter(json);
|
|
109187
|
+
}
|
|
109188
|
+
const missingFields = Object.keys(FIELD_REQUIREMENTS).filter((field) => {
|
|
109189
|
+
if (FIELD_REQUIREMENTS[field] !== FIELD_REQUIREMENT_TYPE.REQUIRED) return false;
|
|
109190
|
+
const parts = field.split(".");
|
|
109191
|
+
let current = json;
|
|
109192
|
+
for (const part of parts) {
|
|
109193
|
+
current = current?.[part];
|
|
109194
|
+
if (current === void 0) return true;
|
|
109195
|
+
}
|
|
109196
|
+
return false;
|
|
109197
|
+
});
|
|
109198
|
+
if (missingFields.length > 0) {
|
|
109199
|
+
toast({
|
|
109200
|
+
title: "Import Failed",
|
|
109201
|
+
description: `Missing required fields: ${missingFields.join(", ")}`,
|
|
109202
|
+
variant: "destructive"
|
|
109203
|
+
});
|
|
109204
|
+
return;
|
|
109205
|
+
}
|
|
109206
|
+
if (setCharacterValue.importAgent) {
|
|
109207
|
+
setCharacterValue.importAgent(json);
|
|
109208
|
+
} else {
|
|
109209
|
+
console.warn("Missing importAgent method");
|
|
109210
|
+
}
|
|
109211
|
+
toast({
|
|
109212
|
+
title: "Agent Imported",
|
|
109213
|
+
description: "Agent data has been successfully loaded."
|
|
109214
|
+
});
|
|
109215
|
+
} catch (error) {
|
|
109216
|
+
toast({
|
|
109217
|
+
title: "Import Failed",
|
|
109218
|
+
description: error instanceof Error ? error.message : "Invalid JSON file",
|
|
109219
|
+
variant: "destructive"
|
|
109220
|
+
});
|
|
109221
|
+
} finally {
|
|
109222
|
+
event.target.value = "";
|
|
109223
|
+
}
|
|
109224
|
+
};
|
|
109225
|
+
const fileInputRef = reactExports.useRef(null);
|
|
109226
|
+
const handleImportClick = () => {
|
|
109227
|
+
fileInputRef.current?.click();
|
|
109228
|
+
};
|
|
109229
|
+
const stopDeleteOptions = reactExports.useMemo(() => {
|
|
109230
|
+
const options = [];
|
|
109231
|
+
if (onStopAgent) {
|
|
109232
|
+
options.push({
|
|
109233
|
+
label: "Stop Agent",
|
|
109234
|
+
description: "Stop running",
|
|
109235
|
+
onClick: onStopAgent
|
|
109236
|
+
});
|
|
109237
|
+
}
|
|
109238
|
+
if (onDelete) {
|
|
109239
|
+
options.push({
|
|
109240
|
+
label: "Delete Agent",
|
|
109241
|
+
description: "Delete permanently",
|
|
109242
|
+
onClick: () => onDelete()
|
|
109243
|
+
});
|
|
109244
|
+
}
|
|
109245
|
+
return options;
|
|
109246
|
+
}, [onStopAgent, onDelete]);
|
|
109247
|
+
const handleTemplateChange = reactExports.useCallback(
|
|
109248
|
+
(templateId) => {
|
|
109249
|
+
setSelectedTemplate(templateId);
|
|
109250
|
+
if (templateId === "none" && onReset) {
|
|
109251
|
+
onReset();
|
|
109252
|
+
return;
|
|
109253
|
+
}
|
|
109254
|
+
const template = getTemplateById(templateId);
|
|
109255
|
+
if (template && setCharacterValue.importAgent) {
|
|
109256
|
+
setCharacterValue.importAgent(template.template);
|
|
109257
|
+
onTemplateChange?.();
|
|
109258
|
+
}
|
|
109259
|
+
},
|
|
109260
|
+
[onReset, setCharacterValue, onTemplateChange]
|
|
109261
|
+
);
|
|
109262
|
+
const allTabs = [
|
|
109263
|
+
...AGENT_FORM_SCHEMA.map((section) => ({
|
|
109264
|
+
value: section.sectionValue,
|
|
109265
|
+
label: section.sectionTitle,
|
|
109266
|
+
shortLabel: section.sectionTitle.split(" ")[0]
|
|
109267
|
+
// Use first word for mobile
|
|
109268
|
+
})),
|
|
109269
|
+
...customComponents.map((component) => ({
|
|
109270
|
+
value: `custom-${component.name}`,
|
|
109271
|
+
label: component.name,
|
|
109272
|
+
shortLabel: component.shortLabel || component.name.split(" ")[0]
|
|
109273
|
+
// Use first word
|
|
109274
|
+
}))
|
|
109275
|
+
];
|
|
109276
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: containerRef, className: "w-full max-w-full mx-auto p-6 sm:p-8 h-full overflow-y-auto", children: [
|
|
109277
|
+
(title || description) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-8", children: [
|
|
109278
|
+
title && /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-2xl font-semibold mb-2", children: title }),
|
|
109279
|
+
description && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground whitespace-pre-line", children: description })
|
|
109280
|
+
] }),
|
|
109281
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-8", children: [
|
|
109282
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Label$2, { htmlFor: "template-selector", className: "text-sm", children: "Start with a template" }),
|
|
109283
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: selectedTemplate, onValueChange: handleTemplateChange, children: [
|
|
109284
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-full mt-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "None (blank start)" }) }),
|
|
109285
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectContent, { children: agentTemplates.map((template) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: template.id, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
109286
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "w-full text-left", children: template.label }) }),
|
|
109287
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "max-w-xs", children: template.description }) })
|
|
109288
|
+
] }) }) }, template.id)) })
|
|
109289
|
+
] })
|
|
109290
|
+
] }),
|
|
109291
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("form", { onSubmit: handleFormSubmit, children: [
|
|
109292
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { value: activeTab, onValueChange: setActiveTab, className: "w-full", children: [
|
|
109293
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative mb-4", children: [
|
|
109294
|
+
showLeftScroll && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109295
|
+
Button,
|
|
109296
|
+
{
|
|
109297
|
+
type: "button",
|
|
109298
|
+
variant: "ghost",
|
|
109299
|
+
size: "sm",
|
|
109300
|
+
className: "absolute left-0 top-1/2 -translate-y-1/2 z-10 h-8 w-8 p-0 bg-background/80 backdrop-blur-sm shadow-md",
|
|
109301
|
+
onClick: () => scrollTabs("left"),
|
|
109302
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronLeft, { className: "h-4 w-4" })
|
|
109303
|
+
}
|
|
109304
|
+
),
|
|
109305
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: tabsContainerRef, className: "overflow-x-auto scrollbar-hide", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TabsList, { className: "inline-flex h-10 items-center justify-start text-muted-foreground w-full", children: allTabs.map((tab) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109306
|
+
TabsTrigger,
|
|
109307
|
+
{
|
|
109308
|
+
value: tab.value,
|
|
109309
|
+
className: cn(
|
|
109310
|
+
"whitespace-nowrap",
|
|
109311
|
+
!showLabels && "px-2 text-xs"
|
|
109312
|
+
// Smaller padding and text on mobile
|
|
109313
|
+
),
|
|
109314
|
+
children: showLabels ? tab.label : tab.shortLabel
|
|
109315
|
+
},
|
|
109316
|
+
tab.value
|
|
109317
|
+
)) }) }),
|
|
109318
|
+
showRightScroll && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109319
|
+
Button,
|
|
109320
|
+
{
|
|
109321
|
+
type: "button",
|
|
109322
|
+
variant: "ghost",
|
|
109323
|
+
size: "sm",
|
|
109324
|
+
className: "absolute right-0 top-1/2 -translate-y-1/2 z-10 h-8 w-8 p-0 bg-background/80 backdrop-blur-sm shadow-md",
|
|
109325
|
+
onClick: () => scrollTabs("right"),
|
|
109326
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "h-4 w-4" })
|
|
109327
|
+
}
|
|
109328
|
+
)
|
|
109329
|
+
] }),
|
|
109330
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-h-[100vh] overflow-y-auto pb-4 px-1", children: [
|
|
109331
|
+
AGENT_FORM_SCHEMA.map((section) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109332
|
+
TabsContent,
|
|
109333
|
+
{
|
|
109334
|
+
value: section.sectionValue,
|
|
109335
|
+
className: "space-y-6 mt-0 focus:outline-none",
|
|
109336
|
+
children: section.sectionType === "input" ? section.fields.map(renderInputField) : section.fields.map(renderArrayField)
|
|
109337
|
+
},
|
|
109338
|
+
section.sectionValue
|
|
109339
|
+
)),
|
|
109340
|
+
customComponents.map((component) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109341
|
+
TabsContent,
|
|
109342
|
+
{
|
|
109343
|
+
value: `custom-${component.name}`,
|
|
109344
|
+
className: "mt-0 focus:outline-none",
|
|
109345
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full", children: component.component })
|
|
109346
|
+
},
|
|
109347
|
+
`custom-${component.name}`
|
|
109348
|
+
))
|
|
109349
|
+
] })
|
|
109350
|
+
] }),
|
|
109351
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between w-full mt-6", children: [
|
|
109352
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
|
|
109353
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { type: "button", variant: "outline", size: "icon", className: "flex-shrink-0 p-2.5", children: [
|
|
109354
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(EllipsisVertical, { className: "h-4 w-4" }),
|
|
109355
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "More options" })
|
|
109356
|
+
] }) }),
|
|
109357
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuContent, { align: "start", side: "top", children: [
|
|
109358
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { onClick: handleImportClick, children: [
|
|
109359
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ArrowDownToLine, { className: "h-4 w-4 mr-2" }),
|
|
109360
|
+
"Import"
|
|
109361
|
+
] }),
|
|
109362
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { onClick: handleExportJSON, children: [
|
|
109363
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ArrowUpFromLine, { className: "h-4 w-4 mr-2" }),
|
|
109364
|
+
"Export"
|
|
109365
|
+
] }),
|
|
109366
|
+
stopDeleteOptions.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuSeparator, {}),
|
|
109367
|
+
stopDeleteOptions.length > 0 && stopDeleteOptions.map((option) => {
|
|
109368
|
+
const isStopAction = option.label === "Stop Agent";
|
|
109369
|
+
const isDeleteAction = option.label === "Delete Agent";
|
|
109370
|
+
const isLoading = isStopAction ? isStopping : isDeleteAction ? isDeleting : false;
|
|
109371
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
109372
|
+
DropdownMenuItem,
|
|
109373
|
+
{
|
|
109374
|
+
onClick: option.onClick,
|
|
109375
|
+
disabled: isLoading,
|
|
109376
|
+
className: isDeleteAction ? "text-destructive focus:text-destructive hover:bg-red-50 dark:hover:bg-red-950/50" : "",
|
|
109377
|
+
children: [
|
|
109378
|
+
isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "h-4 w-4 animate-spin mr-2" }) : isStopAction ? /* @__PURE__ */ jsxRuntimeExports.jsx(CircleStop, { className: "h-4 w-4 mr-2" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Trash, { className: "h-4 w-4 mr-2" }),
|
|
109379
|
+
isLoading ? `${isStopAction ? "Stopping" : "Deleting"}...` : option.label
|
|
109380
|
+
]
|
|
109381
|
+
},
|
|
109382
|
+
option.label
|
|
109383
|
+
);
|
|
109384
|
+
})
|
|
109385
|
+
] })
|
|
109386
|
+
] }),
|
|
109387
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
109388
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
109389
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
109390
|
+
Button,
|
|
109391
|
+
{
|
|
109392
|
+
type: "button",
|
|
109393
|
+
variant: "outline",
|
|
109394
|
+
onClick: () => {
|
|
109395
|
+
onReset?.();
|
|
109396
|
+
},
|
|
109397
|
+
children: [
|
|
109398
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(RotateCcw, { className: "h-4 w-4" }),
|
|
109399
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2", children: "Reset" })
|
|
109400
|
+
]
|
|
109401
|
+
}
|
|
109402
|
+
) }),
|
|
109403
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Reset all form fields to their original values" }) })
|
|
109404
|
+
] }) }),
|
|
109405
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
109406
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "submit", disabled: isSubmitting, className: "agent-form-submit", children: isSubmitting ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
109407
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "h-4 w-4 animate-spin" }),
|
|
109408
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2", children: "Saving..." })
|
|
109409
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
109410
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Save, { className: "h-4 w-4" }),
|
|
109411
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2", children: "Save" })
|
|
109412
|
+
] }) }) }),
|
|
109413
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Save all changes to the agent configuration" }) })
|
|
109414
|
+
] }) })
|
|
109415
|
+
] }),
|
|
109416
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109417
|
+
"input",
|
|
109418
|
+
{
|
|
109419
|
+
ref: fileInputRef,
|
|
109420
|
+
type: "file",
|
|
109421
|
+
accept: ".json",
|
|
109422
|
+
onChange: handleImportJSON,
|
|
109423
|
+
className: "hidden"
|
|
109424
|
+
}
|
|
109425
|
+
)
|
|
109426
|
+
] })
|
|
109427
|
+
] }),
|
|
109428
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109429
|
+
MissingSecretsDialog,
|
|
109430
|
+
{
|
|
109431
|
+
open: showMissingSecretsDialog,
|
|
109432
|
+
onOpenChange: setShowMissingSecretsDialog,
|
|
109433
|
+
missingSecrets: (() => {
|
|
109434
|
+
let missingSecretNames = [];
|
|
109435
|
+
if (secretPanelRef?.current) {
|
|
109436
|
+
const validation = secretPanelRef.current.validateSecrets();
|
|
109437
|
+
missingSecretNames = validation.missingSecrets;
|
|
109438
|
+
} else {
|
|
109439
|
+
const secretsObj = characterValue.settings?.secrets;
|
|
109440
|
+
const currentSecrets = secretsObj && typeof secretsObj === "object" && !Array.isArray(secretsObj) ? secretsObj : {};
|
|
109441
|
+
missingSecretNames = requiredSecrets.filter((secret) => {
|
|
109442
|
+
const value = currentSecrets[secret.name];
|
|
109443
|
+
if (value && typeof value === "string" && value.trim() !== "") {
|
|
109444
|
+
return false;
|
|
109445
|
+
}
|
|
109446
|
+
const globalValue = globalEnvs[secret.name];
|
|
109447
|
+
if (globalValue && globalValue.trim() !== "") {
|
|
109448
|
+
return false;
|
|
109449
|
+
}
|
|
109450
|
+
return true;
|
|
109451
|
+
}).map((secret) => secret.name);
|
|
109452
|
+
}
|
|
109453
|
+
return missingSecretNames.map((secretName) => {
|
|
109454
|
+
const reqSecret = requiredSecrets.find((s) => s.name === secretName);
|
|
109455
|
+
return {
|
|
109456
|
+
name: secretName,
|
|
109457
|
+
plugin: reqSecret?.plugin,
|
|
109458
|
+
description: reqSecret?.description
|
|
109459
|
+
};
|
|
109460
|
+
});
|
|
109461
|
+
})(),
|
|
109462
|
+
onConfirm: handleConfirmSaveWithMissingSecrets,
|
|
109463
|
+
onCancel: handleCancelSaveWithMissingSecrets
|
|
109464
|
+
}
|
|
109465
|
+
)
|
|
109466
|
+
] });
|
|
109467
|
+
}
|
|
109468
|
+
|
|
108924
109469
|
function AvatarPanel({ characterValue, setCharacterValue }) {
|
|
108925
109470
|
const [avatar, setAvatar] = reactExports.useState(characterValue?.settings?.avatar || null);
|
|
108926
109471
|
const [hasChanged, setHasChanged] = reactExports.useState(false);
|
|
@@ -109095,59 +109640,6 @@ const DialogDescription = reactExports.forwardRef(({ className, ...props }, ref)
|
|
|
109095
109640
|
));
|
|
109096
109641
|
DialogDescription.displayName = Description$1.displayName;
|
|
109097
109642
|
|
|
109098
|
-
const REGISTRY_ORG = "elizaos-plugins";
|
|
109099
|
-
const REGISTRY_REPO = "registry";
|
|
109100
|
-
const REGISTRY_URL = `https://raw.githubusercontent.com/${REGISTRY_ORG}/${REGISTRY_REPO}/refs/heads/main/generated-registry.json`;
|
|
109101
|
-
function usePlugins() {
|
|
109102
|
-
return useQuery({
|
|
109103
|
-
queryKey: ["plugins"],
|
|
109104
|
-
queryFn: async () => {
|
|
109105
|
-
try {
|
|
109106
|
-
const elizaClient = createElizaClient();
|
|
109107
|
-
const [registryResponse, agentsResponse] = await Promise.all([
|
|
109108
|
-
fetch(REGISTRY_URL),
|
|
109109
|
-
elizaClient.agents.listAgents()
|
|
109110
|
-
]);
|
|
109111
|
-
const registryData = await registryResponse.json();
|
|
109112
|
-
const registryPlugins = Object.entries(registryData.registry || {}).filter(([name, data]) => {
|
|
109113
|
-
const isPlugin = name.includes("plugin");
|
|
109114
|
-
const hasV1Support = data.supports.v1 === true;
|
|
109115
|
-
const hasV1Version = data.npm.v1 !== null || data.git.v1.version !== null && data.git.v1.branch !== null;
|
|
109116
|
-
return isPlugin && hasV1Support && hasV1Version;
|
|
109117
|
-
}).map(([name]) => name.replace(/^@elizaos-plugins\//, "@elizaos/")).sort();
|
|
109118
|
-
let agentPlugins = [];
|
|
109119
|
-
try {
|
|
109120
|
-
if (agentsResponse?.length > 0) {
|
|
109121
|
-
const activeAgent = agentsResponse.find((agent) => agent.status === "active");
|
|
109122
|
-
if (activeAgent && activeAgent.id) {
|
|
109123
|
-
const agentDetailResponse = await elizaClient.agents.getAgent(activeAgent.id);
|
|
109124
|
-
if (agentDetailResponse?.plugins) {
|
|
109125
|
-
agentPlugins = agentDetailResponse.plugins;
|
|
109126
|
-
}
|
|
109127
|
-
}
|
|
109128
|
-
}
|
|
109129
|
-
} catch (agentError) {
|
|
109130
|
-
clientLogger.warn("Could not fetch agent plugins:", agentError);
|
|
109131
|
-
}
|
|
109132
|
-
const allPlugins = [.../* @__PURE__ */ new Set([...registryPlugins, ...agentPlugins])];
|
|
109133
|
-
return allPlugins.sort();
|
|
109134
|
-
} catch (error) {
|
|
109135
|
-
clientLogger.error("Failed to fetch from registry, falling back to basic list:", error);
|
|
109136
|
-
return [
|
|
109137
|
-
"@elizaos/plugin-bootstrap",
|
|
109138
|
-
"@elizaos/plugin-evm",
|
|
109139
|
-
"@elizaos/plugin-discord",
|
|
109140
|
-
"@elizaos/plugin-elevenlabs",
|
|
109141
|
-
"@elizaos/plugin-anthropic",
|
|
109142
|
-
"@elizaos/plugin-browser",
|
|
109143
|
-
"@elizaos/plugin-farcaster",
|
|
109144
|
-
"@elizaos/plugin-groq"
|
|
109145
|
-
].filter((name) => name.includes("plugin")).sort();
|
|
109146
|
-
}
|
|
109147
|
-
}
|
|
109148
|
-
});
|
|
109149
|
-
}
|
|
109150
|
-
|
|
109151
109643
|
const ESSENTIAL_PLUGINS = {
|
|
109152
109644
|
"@elizaos/plugin-sql": {
|
|
109153
109645
|
title: "Essential Plugin: SQL",
|
|
@@ -110150,6 +110642,8 @@ const SecretPanel = reactExports.forwardRef(
|
|
|
110150
110642
|
const [isDragging, setIsDragging] = reactExports.useState(false);
|
|
110151
110643
|
const [deletedKeys, setDeletedKeys] = reactExports.useState([]);
|
|
110152
110644
|
const [visibleSecrets, setVisibleSecrets] = reactExports.useState(/* @__PURE__ */ new Set());
|
|
110645
|
+
const [globalEnvs, setGlobalEnvs] = reactExports.useState({});
|
|
110646
|
+
const [isLoadingGlobalEnvs, setIsLoadingGlobalEnvs] = reactExports.useState(true);
|
|
110153
110647
|
const [rawEditorOpen, setRawEditorOpen] = reactExports.useState(false);
|
|
110154
110648
|
const [rawEditorContent, setRawEditorContent] = reactExports.useState("");
|
|
110155
110649
|
const lastAgentIdRef = reactExports.useRef(null);
|
|
@@ -110158,6 +110652,22 @@ const SecretPanel = reactExports.forwardRef(
|
|
|
110158
110652
|
const lastRequiredSecretsKeyRef = reactExports.useRef("");
|
|
110159
110653
|
const enabledPlugins = reactExports.useMemo(() => characterValue?.plugins || [], [characterValue?.plugins]);
|
|
110160
110654
|
const { requiredSecrets, isLoading: isLoadingSecrets } = useRequiredSecrets(enabledPlugins);
|
|
110655
|
+
reactExports.useEffect(() => {
|
|
110656
|
+
const fetchGlobalEnvs = async () => {
|
|
110657
|
+
try {
|
|
110658
|
+
setIsLoadingGlobalEnvs(true);
|
|
110659
|
+
const elizaClient = createElizaClient();
|
|
110660
|
+
const data = await elizaClient.system.getEnvironment();
|
|
110661
|
+
setGlobalEnvs(data || {});
|
|
110662
|
+
} catch (error) {
|
|
110663
|
+
console.error("Failed to fetch global environment variables:", error);
|
|
110664
|
+
setGlobalEnvs({});
|
|
110665
|
+
} finally {
|
|
110666
|
+
setIsLoadingGlobalEnvs(false);
|
|
110667
|
+
}
|
|
110668
|
+
};
|
|
110669
|
+
fetchGlobalEnvs();
|
|
110670
|
+
}, []);
|
|
110161
110671
|
const getCurrentSecrets = reactExports.useCallback(() => {
|
|
110162
110672
|
const currentSecrets = {};
|
|
110163
110673
|
envs.forEach(({ name: name2, value: value2 }) => {
|
|
@@ -110174,13 +110684,19 @@ const SecretPanel = reactExports.forwardRef(
|
|
|
110174
110684
|
const missingSecrets = secretsToCheck.filter((secret) => {
|
|
110175
110685
|
const secretName = typeof secret === "object" && "name" in secret ? secret.name : secret;
|
|
110176
110686
|
const value2 = currentSecrets[secretName];
|
|
110177
|
-
|
|
110687
|
+
if (value2 && value2.trim() !== "") {
|
|
110688
|
+
return false;
|
|
110689
|
+
}
|
|
110690
|
+
if (globalEnvs[secretName] && globalEnvs[secretName].trim() !== "") {
|
|
110691
|
+
return false;
|
|
110692
|
+
}
|
|
110693
|
+
return true;
|
|
110178
110694
|
}).map((secret) => typeof secret === "object" && "name" in secret ? secret.name : secret);
|
|
110179
110695
|
return {
|
|
110180
110696
|
isValid: missingSecrets.length === 0,
|
|
110181
110697
|
missingSecrets
|
|
110182
110698
|
};
|
|
110183
|
-
}, [getCurrentSecrets, requiredSecrets, isLoadingSecrets, envs]);
|
|
110699
|
+
}, [getCurrentSecrets, requiredSecrets, isLoadingSecrets, envs, globalEnvs]);
|
|
110184
110700
|
reactExports.useImperativeHandle(
|
|
110185
110701
|
ref,
|
|
110186
110702
|
() => ({
|
|
@@ -110289,7 +110805,7 @@ const SecretPanel = reactExports.forwardRef(
|
|
|
110289
110805
|
navigator.clipboard.writeText(rawEditorContent);
|
|
110290
110806
|
};
|
|
110291
110807
|
reactExports.useEffect(() => {
|
|
110292
|
-
if (isLoadingSecrets) return;
|
|
110808
|
+
if (isLoadingSecrets || isLoadingGlobalEnvs) return;
|
|
110293
110809
|
if (characterValue.id !== lastAgentIdRef.current || !lastAgentIdRef.current || envs.length === 0) {
|
|
110294
110810
|
const salt = getSalt();
|
|
110295
110811
|
const decryptedSecretsRaw = characterValue?.settings?.secrets || {};
|
|
@@ -110316,6 +110832,7 @@ const SecretPanel = reactExports.forwardRef(
|
|
|
110316
110832
|
allSecrets.push({
|
|
110317
110833
|
name: reqSecret.name,
|
|
110318
110834
|
value: "",
|
|
110835
|
+
// Keep empty to show it's using global
|
|
110319
110836
|
isNew: true,
|
|
110320
110837
|
isModified: false,
|
|
110321
110838
|
isDeleted: false,
|
|
@@ -110348,7 +110865,14 @@ const SecretPanel = reactExports.forwardRef(
|
|
|
110348
110865
|
const requiredSecretsKey = requiredSecrets.map((s) => s.name).sort().join(",");
|
|
110349
110866
|
lastRequiredSecretsKeyRef.current = requiredSecretsKey;
|
|
110350
110867
|
}
|
|
110351
|
-
}, [
|
|
110868
|
+
}, [
|
|
110869
|
+
characterValue.id,
|
|
110870
|
+
characterValue.settings?.secrets,
|
|
110871
|
+
requiredSecrets,
|
|
110872
|
+
isLoadingSecrets,
|
|
110873
|
+
globalEnvs,
|
|
110874
|
+
isLoadingGlobalEnvs
|
|
110875
|
+
]);
|
|
110352
110876
|
reactExports.useEffect(() => {
|
|
110353
110877
|
if (isLoadingSecrets) return;
|
|
110354
110878
|
const requiredSecretsKey = requiredSecrets.map((s) => s.name).sort().join(",");
|
|
@@ -110388,6 +110912,7 @@ const SecretPanel = reactExports.forwardRef(
|
|
|
110388
110912
|
updatedEnvs.push({
|
|
110389
110913
|
name: reqSecret.name,
|
|
110390
110914
|
value: "",
|
|
110915
|
+
// Keep empty to show it's using global
|
|
110391
110916
|
isNew: true,
|
|
110392
110917
|
isModified: false,
|
|
110393
110918
|
isDeleted: false,
|
|
@@ -110405,7 +110930,7 @@ const SecretPanel = reactExports.forwardRef(
|
|
|
110405
110930
|
});
|
|
110406
110931
|
return updatedEnvs;
|
|
110407
110932
|
});
|
|
110408
|
-
}, [requiredSecrets, isLoadingSecrets]);
|
|
110933
|
+
}, [requiredSecrets, isLoadingSecrets, globalEnvs]);
|
|
110409
110934
|
reactExports.useEffect(() => {
|
|
110410
110935
|
const currentRequiredNames = new Set(requiredSecrets.map((s) => s.name));
|
|
110411
110936
|
setEnvs((prevEnvs) => {
|
|
@@ -110620,8 +111145,16 @@ const SecretPanel = reactExports.forwardRef(
|
|
|
110620
111145
|
};
|
|
110621
111146
|
const missingRequiredSecrets = requiredSecrets.filter((reqSecret) => {
|
|
110622
111147
|
const env = envs.find((e) => e.name === reqSecret.name);
|
|
110623
|
-
|
|
111148
|
+
const hasLocalValue = env && env.value && env.value.trim() !== "";
|
|
111149
|
+
const hasGlobalValue = globalEnvs[reqSecret.name] && globalEnvs[reqSecret.name].trim() !== "";
|
|
111150
|
+
return !hasLocalValue && !hasGlobalValue;
|
|
110624
111151
|
});
|
|
111152
|
+
const isInGlobalEnv = reactExports.useCallback(
|
|
111153
|
+
(secretName) => {
|
|
111154
|
+
return globalEnvs[secretName] && globalEnvs[secretName].trim() !== "";
|
|
111155
|
+
},
|
|
111156
|
+
[globalEnvs]
|
|
111157
|
+
);
|
|
110625
111158
|
const scrollbarContainerClass = `
|
|
110626
111159
|
overflow-x-auto
|
|
110627
111160
|
overflow-y-hidden
|
|
@@ -110665,11 +111198,11 @@ const SecretPanel = reactExports.forwardRef(
|
|
|
110665
111198
|
)
|
|
110666
111199
|
] }),
|
|
110667
111200
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-4 space-y-4", children: [
|
|
110668
|
-
isLoadingSecrets && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
|
111201
|
+
(isLoadingSecrets || isLoadingGlobalEnvs) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
|
110669
111202
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-4 w-48" }),
|
|
110670
111203
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-4 w-64" })
|
|
110671
111204
|
] }),
|
|
110672
|
-
!isLoadingSecrets && missingRequiredSecrets.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(Alert, { children: [
|
|
111205
|
+
!isLoadingSecrets && !isLoadingGlobalEnvs && missingRequiredSecrets.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(Alert, { children: [
|
|
110673
111206
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CircleAlert, { className: "h-4 w-4" }),
|
|
110674
111207
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(AlertDescription, { children: [
|
|
110675
111208
|
/* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: "Missing required secrets:" }),
|
|
@@ -110684,8 +111217,17 @@ const SecretPanel = reactExports.forwardRef(
|
|
|
110684
111217
|
] }, secret.name)) })
|
|
110685
111218
|
] })
|
|
110686
111219
|
] }),
|
|
111220
|
+
!isLoadingSecrets && !isLoadingGlobalEnvs && requiredSecrets.some(
|
|
111221
|
+
(secret) => isInGlobalEnv(secret.name) && !envs.find((e) => e.name === secret.name)?.value
|
|
111222
|
+
) && /* @__PURE__ */ jsxRuntimeExports.jsxs(Alert, { className: "border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-900/20", children: [
|
|
111223
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Globe, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" }),
|
|
111224
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(AlertDescription, { className: "text-blue-800 dark:text-blue-200", children: [
|
|
111225
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: "Global environment variables detected:" }),
|
|
111226
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm mt-1", children: "Some required secrets are automatically using values from your global environment settings. To override any of these for this specific agent, simply enter a new value in the field." })
|
|
111227
|
+
] })
|
|
111228
|
+
] }),
|
|
110687
111229
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
|
110688
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "hidden md:grid md:grid-cols-[
|
|
111230
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "hidden md:grid md:grid-cols-[minmax(200px,1fr)_2fr_auto] gap-2 items-end", children: [
|
|
110689
111231
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [
|
|
110690
111232
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
110691
111233
|
"label",
|
|
@@ -110828,7 +111370,7 @@ const SecretPanel = reactExports.forwardRef(
|
|
|
110828
111370
|
] }),
|
|
110829
111371
|
envs.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
|
|
110830
111372
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "hidden md:block border rounded-lg overflow-hidden relative", children: [
|
|
110831
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-muted/50 px-4 py-2 border-b", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-[
|
|
111373
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-muted/50 px-4 py-2 border-b", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-[minmax(200px,1fr)_2fr_auto] gap-4 text-xs font-medium text-muted-foreground uppercase", children: [
|
|
110832
111374
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Name" }),
|
|
110833
111375
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Value" }),
|
|
110834
111376
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center", children: "Actions" })
|
|
@@ -110836,15 +111378,26 @@ const SecretPanel = reactExports.forwardRef(
|
|
|
110836
111378
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-h-[400px] overflow-y-auto", children: envs.map((env, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
110837
111379
|
"div",
|
|
110838
111380
|
{
|
|
110839
|
-
className: `grid grid-cols-[
|
|
111381
|
+
className: `grid grid-cols-[minmax(200px,1fr)_2fr_auto] gap-4 items-center px-4 py-3 border-b last:border-b-0 hover:bg-muted/10 transition-colors ${env.isRequired && (!env.value || env.value.trim() === "") && !isInGlobalEnv(env.name) ? "bg-red-500/5" : ""}`,
|
|
110840
111382
|
children: [
|
|
110841
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "
|
|
110842
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-
|
|
110843
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
110844
|
-
|
|
110845
|
-
|
|
110846
|
-
|
|
110847
|
-
|
|
111383
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "pr-2", children: [
|
|
111384
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2 flex-wrap", children: [
|
|
111385
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: "font-mono text-sm font-medium break-words cursor-default", children: env.name }),
|
|
111386
|
+
env.isRequired && /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", className: "text-xs shrink-0", children: "Required" }),
|
|
111387
|
+
isInGlobalEnv(env.name) && /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
111388
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
111389
|
+
Badge,
|
|
111390
|
+
{
|
|
111391
|
+
variant: "secondary",
|
|
111392
|
+
className: "text-xs shrink-0 flex items-center gap-1",
|
|
111393
|
+
children: [
|
|
111394
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Globe, { className: "w-3 h-3" }),
|
|
111395
|
+
"Global"
|
|
111396
|
+
]
|
|
111397
|
+
}
|
|
111398
|
+
) }),
|
|
111399
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: env.value ? "Overriding global value" : "Value pulled from global environment. Add new value to override." }) })
|
|
111400
|
+
] })
|
|
110848
111401
|
] }),
|
|
110849
111402
|
env.description && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground mt-1 line-clamp-2", children: env.description }),
|
|
110850
111403
|
env.plugin && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-muted-foreground truncate", children: [
|
|
@@ -110861,7 +111414,7 @@ const SecretPanel = reactExports.forwardRef(
|
|
|
110861
111414
|
className: "font-mono text-sm border-0 focus-visible:ring-0 w-auto min-w-full rounded",
|
|
110862
111415
|
style: { minWidth: "100%" },
|
|
110863
111416
|
type: visibleSecrets.has(index) ? "text" : "password",
|
|
110864
|
-
placeholder: env.example || "Enter value...",
|
|
111417
|
+
placeholder: isInGlobalEnv(env.name) && !env.value ? `Using global (enter to override)` : env.example || "Enter value...",
|
|
110865
111418
|
autoFocus: true,
|
|
110866
111419
|
onKeyDown: (e) => {
|
|
110867
111420
|
if (e.key === "Enter") {
|
|
@@ -110909,13 +111462,19 @@ const SecretPanel = reactExports.forwardRef(
|
|
|
110909
111462
|
)
|
|
110910
111463
|
] })
|
|
110911
111464
|
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 group", children: [
|
|
110912
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
110913
|
-
|
|
110914
|
-
|
|
110915
|
-
|
|
110916
|
-
|
|
110917
|
-
|
|
110918
|
-
|
|
111465
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
111466
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
111467
|
+
"div",
|
|
111468
|
+
{
|
|
111469
|
+
className: `flex-1 border rounded px-3 py-1 ${scrollbarContainerClass}`,
|
|
111470
|
+
children: visibleSecrets.has(index) ? /* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: "font-mono text-sm whitespace-nowrap block", children: env.value || /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-muted-foreground italic", children: isInGlobalEnv(env.name) ? "Using global value" : env.example ? `e.g. ${env.example}` : "Not set" }) }) : env.value ? /* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: "font-mono text-sm text-muted-foreground block", children: "••••••••" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-muted-foreground italic text-sm block", children: isInGlobalEnv(env.name) ? "Using global value" : "Not set" })
|
|
111471
|
+
}
|
|
111472
|
+
) }),
|
|
111473
|
+
isInGlobalEnv(env.name) && /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "max-w-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [
|
|
111474
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "font-semibold", children: "Global Environment Variable" }),
|
|
111475
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm", children: env.value ? "You've entered a custom value for this agent. This overrides the global environment setting. Clear the field to use the global value." : "This secret is currently using the value from your global environment settings. The actual value is hidden for security. Enter a value here if you want to override it for this agent only." })
|
|
111476
|
+
] }) })
|
|
111477
|
+
] }),
|
|
110919
111478
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
110920
111479
|
Button,
|
|
110921
111480
|
{
|
|
@@ -110968,7 +111527,18 @@ const SecretPanel = reactExports.forwardRef(
|
|
|
110968
111527
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
110969
111528
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
110970
111529
|
/* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: "font-mono text-sm font-medium break-all", children: env.name }),
|
|
110971
|
-
env.isRequired && /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", className: "text-xs", children: "Required" })
|
|
111530
|
+
env.isRequired && /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", className: "text-xs", children: "Required" }),
|
|
111531
|
+
isInGlobalEnv(env.name) && /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
111532
|
+
Badge,
|
|
111533
|
+
{
|
|
111534
|
+
variant: "secondary",
|
|
111535
|
+
className: "text-xs flex items-center gap-1",
|
|
111536
|
+
children: [
|
|
111537
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Globe, { className: "w-3 h-3" }),
|
|
111538
|
+
"Global"
|
|
111539
|
+
]
|
|
111540
|
+
}
|
|
111541
|
+
)
|
|
110972
111542
|
] }),
|
|
110973
111543
|
env.description && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground mt-1", children: env.description }),
|
|
110974
111544
|
env.plugin && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-muted-foreground", children: [
|
|
@@ -111015,7 +111585,7 @@ const SecretPanel = reactExports.forwardRef(
|
|
|
111015
111585
|
className: "font-mono text-sm pr-10 border-0 focus-visible:ring-0 w-auto min-w-full rounded",
|
|
111016
111586
|
style: { minWidth: "100%" },
|
|
111017
111587
|
type: visibleSecrets.has(index) ? "text" : "password",
|
|
111018
|
-
placeholder: env.example || "Enter value...",
|
|
111588
|
+
placeholder: isInGlobalEnv(env.name) && !env.value ? `Using global (enter to override)` : env.example || "Enter value...",
|
|
111019
111589
|
autoFocus: true,
|
|
111020
111590
|
onKeyDown: (e) => {
|
|
111021
111591
|
if (e.key === "Enter") {
|
|
@@ -111070,13 +111640,19 @@ const SecretPanel = reactExports.forwardRef(
|
|
|
111070
111640
|
)
|
|
111071
111641
|
] })
|
|
111072
111642
|
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
111073
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
111074
|
-
|
|
111075
|
-
|
|
111076
|
-
|
|
111077
|
-
|
|
111078
|
-
|
|
111079
|
-
|
|
111643
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
111644
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
111645
|
+
"div",
|
|
111646
|
+
{
|
|
111647
|
+
className: `flex-1 border rounded px-3 py-1 ${scrollbarContainerClass}`,
|
|
111648
|
+
children: visibleSecrets.has(index) ? /* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: "font-mono text-sm whitespace-nowrap block", children: env.value || /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-muted-foreground italic", children: isInGlobalEnv(env.name) ? "Using global value" : env.example ? `e.g. ${env.example}` : "Not set" }) }) : env.value ? /* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: "font-mono text-sm text-muted-foreground block", children: "••••••••" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-muted-foreground italic text-sm block", children: isInGlobalEnv(env.name) ? "Using global value" : "Not set" })
|
|
111649
|
+
}
|
|
111650
|
+
) }),
|
|
111651
|
+
isInGlobalEnv(env.name) && /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "max-w-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [
|
|
111652
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "font-semibold", children: "Global Environment Variable" }),
|
|
111653
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm", children: env.value ? "You've entered a custom value for this agent. This overrides the global environment setting. Clear the field to use the global value." : "This secret is currently using the value from your global environment settings. The actual value is hidden for security. Enter a value here if you want to override it for this agent only." })
|
|
111654
|
+
] }) })
|
|
111655
|
+
] }),
|
|
111080
111656
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
111081
111657
|
Button,
|
|
111082
111658
|
{
|
|
@@ -112141,7 +112717,7 @@ function requireTypes () {
|
|
|
112141
112717
|
return types$1;
|
|
112142
112718
|
}
|
|
112143
112719
|
|
|
112144
|
-
var util
|
|
112720
|
+
var util = {};
|
|
112145
112721
|
|
|
112146
112722
|
var compose = {};
|
|
112147
112723
|
|
|
@@ -112281,19 +112857,19 @@ function requireCompose () {
|
|
|
112281
112857
|
return compose;
|
|
112282
112858
|
}
|
|
112283
112859
|
|
|
112284
|
-
var hasRequiredUtil
|
|
112860
|
+
var hasRequiredUtil;
|
|
112285
112861
|
|
|
112286
|
-
function requireUtil
|
|
112287
|
-
if (hasRequiredUtil
|
|
112288
|
-
hasRequiredUtil
|
|
112862
|
+
function requireUtil () {
|
|
112863
|
+
if (hasRequiredUtil) return util;
|
|
112864
|
+
hasRequiredUtil = 1;
|
|
112289
112865
|
(function (exports) {
|
|
112290
112866
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
112291
112867
|
exports.compose = void 0;
|
|
112292
112868
|
var compose_1 = requireCompose();
|
|
112293
112869
|
Object.defineProperty(exports, "compose", { enumerable: true, get: function () { return compose_1.compose; } });
|
|
112294
112870
|
|
|
112295
|
-
} (util
|
|
112296
|
-
return util
|
|
112871
|
+
} (util));
|
|
112872
|
+
return util;
|
|
112297
112873
|
}
|
|
112298
112874
|
|
|
112299
112875
|
var Ctx = {};
|
|
@@ -115218,7 +115794,7 @@ function requireLib () {
|
|
|
115218
115794
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
115219
115795
|
exports.distinct = exports.nonNullable = exports.throttleTime = exports.to = exports.StatefulEvt = exports.Evt = exports.Ctx = void 0;
|
|
115220
115796
|
__exportStar(requireTypes(), exports);
|
|
115221
|
-
__exportStar(requireUtil
|
|
115797
|
+
__exportStar(requireUtil(), exports);
|
|
115222
115798
|
var Ctx_1 = requireCtx();
|
|
115223
115799
|
Object.defineProperty(exports, "Ctx", { enumerable: true, get: function () { return Ctx_1.Ctx; } });
|
|
115224
115800
|
var Evt_2 = requireEvt();
|
|
@@ -153156,239 +153732,39 @@ const Markdown = reactExports.memo(
|
|
|
153156
153732
|
);
|
|
153157
153733
|
Markdown.displayName = "Markdown";
|
|
153158
153734
|
|
|
153159
|
-
var dist = {};
|
|
153160
|
-
|
|
153161
|
-
var AIWriter$1 = {};
|
|
153162
|
-
|
|
153163
|
-
var useInterval = {};
|
|
153164
|
-
|
|
153165
|
-
var hasRequiredUseInterval;
|
|
153166
|
-
|
|
153167
|
-
function requireUseInterval () {
|
|
153168
|
-
if (hasRequiredUseInterval) return useInterval;
|
|
153169
|
-
hasRequiredUseInterval = 1;
|
|
153170
|
-
var __importDefault = (useInterval && useInterval.__importDefault) || function (mod) {
|
|
153171
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
153172
|
-
};
|
|
153173
|
-
Object.defineProperty(useInterval, "__esModule", { value: true });
|
|
153174
|
-
var react_1 = __importDefault(requireReact());
|
|
153175
|
-
// https://www.joshwcomeau.com/snippets/react-hooks/use-interval/
|
|
153176
|
-
var useInterval$1 = function (callback, delay) {
|
|
153177
|
-
var intervalRef = react_1.default.useRef(null);
|
|
153178
|
-
var savedCallback = react_1.default.useRef(callback);
|
|
153179
|
-
react_1.default.useEffect(function () {
|
|
153180
|
-
savedCallback.current = callback;
|
|
153181
|
-
}, [callback]);
|
|
153182
|
-
react_1.default.useEffect(function () {
|
|
153183
|
-
var tick = function () { return savedCallback.current(); };
|
|
153184
|
-
if (typeof delay === "number") {
|
|
153185
|
-
intervalRef.current = window.setInterval(tick, delay);
|
|
153186
|
-
return function () { return window.clearInterval(intervalRef.current); };
|
|
153187
|
-
}
|
|
153188
|
-
}, [delay]);
|
|
153189
|
-
return intervalRef;
|
|
153190
|
-
};
|
|
153191
|
-
useInterval.default = useInterval$1;
|
|
153192
|
-
|
|
153193
|
-
return useInterval;
|
|
153194
|
-
}
|
|
153195
|
-
|
|
153196
|
-
var util = {};
|
|
153197
|
-
|
|
153198
|
-
var hasRequiredUtil;
|
|
153199
|
-
|
|
153200
|
-
function requireUtil () {
|
|
153201
|
-
if (hasRequiredUtil) return util;
|
|
153202
|
-
hasRequiredUtil = 1;
|
|
153203
|
-
Object.defineProperty(util, "__esModule", { value: true });
|
|
153204
|
-
util.getCurrentNodeOverflow = util.getStringPosition = void 0;
|
|
153205
|
-
var getStringPosition = function (string, subString, index) {
|
|
153206
|
-
return string.split(subString, index).join(" ").length;
|
|
153207
|
-
};
|
|
153208
|
-
util.getStringPosition = getStringPosition;
|
|
153209
|
-
var getCurrentNodeOverflow = function (arr, pos) {
|
|
153210
|
-
var acc = 0;
|
|
153211
|
-
var index = 0;
|
|
153212
|
-
for (var i = 0; i < arr.length; i++) {
|
|
153213
|
-
if (acc + arr[i] > pos) {
|
|
153214
|
-
break;
|
|
153215
|
-
}
|
|
153216
|
-
index++;
|
|
153217
|
-
acc = acc + arr[i];
|
|
153218
|
-
}
|
|
153219
|
-
return [index, pos - acc];
|
|
153220
|
-
};
|
|
153221
|
-
util.getCurrentNodeOverflow = getCurrentNodeOverflow;
|
|
153222
|
-
|
|
153223
|
-
return util;
|
|
153224
|
-
}
|
|
153225
|
-
|
|
153226
|
-
var hasRequiredAIWriter;
|
|
153227
|
-
|
|
153228
|
-
function requireAIWriter () {
|
|
153229
|
-
if (hasRequiredAIWriter) return AIWriter$1;
|
|
153230
|
-
hasRequiredAIWriter = 1;
|
|
153231
|
-
var __importDefault = (AIWriter$1 && AIWriter$1.__importDefault) || function (mod) {
|
|
153232
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
153233
|
-
};
|
|
153234
|
-
Object.defineProperty(AIWriter$1, "__esModule", { value: true });
|
|
153235
|
-
var react_1 = __importDefault(requireReact());
|
|
153236
|
-
var useInterval_1 = __importDefault(requireUseInterval());
|
|
153237
|
-
var util_1 = requireUtil();
|
|
153238
|
-
var AIWriter = react_1.default.memo(function (_a) {
|
|
153239
|
-
var children = _a.children, _b = _a.delay, delay = _b === void 0 ? 25 : _b, _c = _a.onEnd, onEnd = _c === void 0 ? function () { } : _c;
|
|
153240
|
-
var _d = react_1.default.useState(0), pos = _d[0], setPos = _d[1];
|
|
153241
|
-
var tokenLengths = react_1.default.useMemo(function () {
|
|
153242
|
-
var arr = [];
|
|
153243
|
-
var traverseNodesAndCountTokens = function (reactNode) {
|
|
153244
|
-
var _a;
|
|
153245
|
-
var nodeChildren = (_a = reactNode === null || reactNode === void 0 ? void 0 : reactNode.props) === null || _a === void 0 ? void 0 : _a.children;
|
|
153246
|
-
if (Array.isArray(reactNode)) {
|
|
153247
|
-
reactNode.forEach(function (node) {
|
|
153248
|
-
if (typeof node === "object") {
|
|
153249
|
-
traverseNodesAndCountTokens(node);
|
|
153250
|
-
}
|
|
153251
|
-
else if (typeof node === "string") {
|
|
153252
|
-
// https://stackoverflow.com/questions/881085/count-the-number-of-occurrences-of-a-character-in-a-string-in-javascript
|
|
153253
|
-
arr.push(node.split(" ").length);
|
|
153254
|
-
}
|
|
153255
|
-
});
|
|
153256
|
-
}
|
|
153257
|
-
if (nodeChildren === undefined) {
|
|
153258
|
-
if (typeof reactNode === "string") {
|
|
153259
|
-
arr.push(reactNode.split(" ").length);
|
|
153260
|
-
}
|
|
153261
|
-
}
|
|
153262
|
-
// TODO mb try checking if it's a react element
|
|
153263
|
-
if (typeof nodeChildren === "object") {
|
|
153264
|
-
traverseNodesAndCountTokens(nodeChildren);
|
|
153265
|
-
}
|
|
153266
|
-
if (typeof nodeChildren === "string") {
|
|
153267
|
-
arr.push(nodeChildren.split(" ").length);
|
|
153268
|
-
}
|
|
153269
|
-
return arr;
|
|
153270
|
-
};
|
|
153271
|
-
return traverseNodesAndCountTokens(children);
|
|
153272
|
-
}, [children]);
|
|
153273
|
-
var totalTokens = react_1.default.useMemo(function () { return tokenLengths.reduce(function (acc, curr) { return acc + curr; }, 0); }, [tokenLengths]);
|
|
153274
|
-
var nodex = react_1.default.useMemo(function () {
|
|
153275
|
-
var tmpCurrentLoopTokenPos = 0;
|
|
153276
|
-
var tmpCurrentLoopNodePos = 0;
|
|
153277
|
-
// inspired by https://impedans.me/web/searching-the-inner-text-content-of-nested-react-nodes/
|
|
153278
|
-
var traverseNodesAndInjectAIWriter = function (reactNode) {
|
|
153279
|
-
var _a;
|
|
153280
|
-
if (tmpCurrentLoopTokenPos > pos) {
|
|
153281
|
-
return null;
|
|
153282
|
-
}
|
|
153283
|
-
var nodeChildren = (_a = reactNode === null || reactNode === void 0 ? void 0 : reactNode.props) === null || _a === void 0 ? void 0 : _a.children;
|
|
153284
|
-
if (Array.isArray(reactNode)) {
|
|
153285
|
-
var joinedNodes_1 = [];
|
|
153286
|
-
reactNode.forEach(function (node) {
|
|
153287
|
-
if (typeof node === "object") {
|
|
153288
|
-
joinedNodes_1.push(traverseNodesAndInjectAIWriter(node));
|
|
153289
|
-
}
|
|
153290
|
-
else if (typeof node === "string") {
|
|
153291
|
-
tmpCurrentLoopTokenPos += node.split(" ").length;
|
|
153292
|
-
tmpCurrentLoopNodePos++;
|
|
153293
|
-
var _a = (0, util_1.getCurrentNodeOverflow)(tokenLengths, pos), nodeIndex = _a[0], currentNodePos = _a[1];
|
|
153294
|
-
if (nodeIndex < tmpCurrentLoopNodePos) {
|
|
153295
|
-
joinedNodes_1.push(node.slice(0, (0, util_1.getStringPosition)(node, " ", currentNodePos)));
|
|
153296
|
-
}
|
|
153297
|
-
joinedNodes_1.push(node);
|
|
153298
|
-
}
|
|
153299
|
-
});
|
|
153300
|
-
return joinedNodes_1;
|
|
153301
|
-
}
|
|
153302
|
-
if (nodeChildren === undefined) {
|
|
153303
|
-
if (typeof reactNode === "string") {
|
|
153304
|
-
tmpCurrentLoopTokenPos += reactNode.split(" ").length;
|
|
153305
|
-
tmpCurrentLoopNodePos++;
|
|
153306
|
-
var _b = (0, util_1.getCurrentNodeOverflow)(tokenLengths, pos), nodeIndex = _b[0], currentNodePos = _b[1];
|
|
153307
|
-
if (nodeIndex < tmpCurrentLoopNodePos) {
|
|
153308
|
-
return reactNode.slice(0, (0, util_1.getStringPosition)(reactNode, " ", currentNodePos));
|
|
153309
|
-
}
|
|
153310
|
-
return reactNode;
|
|
153311
|
-
}
|
|
153312
|
-
}
|
|
153313
|
-
// TODO mb try checking if it's a react element
|
|
153314
|
-
if (typeof nodeChildren === "object") {
|
|
153315
|
-
return react_1.default.createElement(reactNode.type, reactNode === null || reactNode === void 0 ? void 0 : reactNode.props, traverseNodesAndInjectAIWriter(nodeChildren));
|
|
153316
|
-
}
|
|
153317
|
-
if (typeof nodeChildren === "string") {
|
|
153318
|
-
tmpCurrentLoopTokenPos += nodeChildren.split(" ").length;
|
|
153319
|
-
tmpCurrentLoopNodePos++;
|
|
153320
|
-
var _c = (0, util_1.getCurrentNodeOverflow)(tokenLengths, pos), nodeIndex = _c[0], currentNodePos = _c[1];
|
|
153321
|
-
if (nodeIndex < tmpCurrentLoopNodePos) {
|
|
153322
|
-
return react_1.default.createElement(reactNode.type, reactNode === null || reactNode === void 0 ? void 0 : reactNode.props, nodeChildren.slice(0, (0, util_1.getStringPosition)(nodeChildren, " ", currentNodePos)));
|
|
153323
|
-
}
|
|
153324
|
-
return reactNode;
|
|
153325
|
-
}
|
|
153326
|
-
};
|
|
153327
|
-
return traverseNodesAndInjectAIWriter(children);
|
|
153328
|
-
}, [children, pos, tokenLengths]);
|
|
153329
|
-
(0, useInterval_1.default)(function () {
|
|
153330
|
-
setPos(function (prevPos) {
|
|
153331
|
-
if (prevPos + 1 >= totalTokens) {
|
|
153332
|
-
onEnd();
|
|
153333
|
-
}
|
|
153334
|
-
return prevPos + 1;
|
|
153335
|
-
});
|
|
153336
|
-
}, totalTokens > pos ? delay : null);
|
|
153337
|
-
// reset
|
|
153338
|
-
react_1.default.useEffect(function () {
|
|
153339
|
-
console.log("hmmm");
|
|
153340
|
-
setPos(0);
|
|
153341
|
-
}, [children]);
|
|
153342
|
-
return nodex;
|
|
153343
|
-
});
|
|
153344
|
-
AIWriter.displayName = "AIWriter";
|
|
153345
|
-
AIWriter$1.default = AIWriter;
|
|
153346
|
-
|
|
153347
|
-
return AIWriter$1;
|
|
153348
|
-
}
|
|
153349
|
-
|
|
153350
|
-
var hasRequiredDist;
|
|
153351
|
-
|
|
153352
|
-
function requireDist () {
|
|
153353
|
-
if (hasRequiredDist) return dist;
|
|
153354
|
-
hasRequiredDist = 1;
|
|
153355
|
-
var __importDefault = (dist && dist.__importDefault) || function (mod) {
|
|
153356
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
153357
|
-
};
|
|
153358
|
-
Object.defineProperty(dist, "__esModule", { value: true });
|
|
153359
|
-
var AIWriter_1 = __importDefault(requireAIWriter());
|
|
153360
|
-
dist.default = AIWriter_1.default;
|
|
153361
|
-
|
|
153362
|
-
return dist;
|
|
153363
|
-
}
|
|
153364
|
-
|
|
153365
|
-
var distExports = requireDist();
|
|
153366
|
-
const AIWriter = /*@__PURE__*/getDefaultExportFromCjs(distExports);
|
|
153367
|
-
|
|
153368
153735
|
const AnimatedMarkdown = ({
|
|
153369
153736
|
children,
|
|
153370
153737
|
className,
|
|
153371
153738
|
variant = "agent",
|
|
153372
153739
|
shouldAnimate = false,
|
|
153373
|
-
messageId
|
|
153740
|
+
messageId,
|
|
153741
|
+
maxDurationMs = 1e4
|
|
153374
153742
|
}) => {
|
|
153375
|
-
const [
|
|
153743
|
+
const [visibleText, setVisibleText] = reactExports.useState(shouldAnimate ? "" : children);
|
|
153376
153744
|
reactExports.useEffect(() => {
|
|
153377
|
-
if (shouldAnimate) {
|
|
153378
|
-
|
|
153379
|
-
|
|
153380
|
-
const timer = setTimeout(() => {
|
|
153381
|
-
setAnimationComplete(true);
|
|
153382
|
-
}, estimatedTime);
|
|
153383
|
-
return () => clearTimeout(timer);
|
|
153384
|
-
} else {
|
|
153385
|
-
setAnimationComplete(true);
|
|
153745
|
+
if (!shouldAnimate || !children.trim()) {
|
|
153746
|
+
setVisibleText(children);
|
|
153747
|
+
return;
|
|
153386
153748
|
}
|
|
153387
|
-
|
|
153388
|
-
|
|
153389
|
-
|
|
153390
|
-
|
|
153391
|
-
|
|
153749
|
+
const safeDuration = Math.max(1e3, maxDurationMs);
|
|
153750
|
+
setVisibleText("");
|
|
153751
|
+
const TYPING_INTERVAL = 20;
|
|
153752
|
+
const totalChars = children.length;
|
|
153753
|
+
const totalSteps = Math.ceil(safeDuration / TYPING_INTERVAL);
|
|
153754
|
+
const charsPerStep = Math.max(1, Math.ceil(totalChars / totalSteps));
|
|
153755
|
+
let visibleCharCount = 0;
|
|
153756
|
+
const interval = setInterval(() => {
|
|
153757
|
+
visibleCharCount += charsPerStep;
|
|
153758
|
+
if (visibleCharCount >= totalChars) {
|
|
153759
|
+
setVisibleText(children);
|
|
153760
|
+
clearInterval(interval);
|
|
153761
|
+
} else {
|
|
153762
|
+
setVisibleText(children.slice(0, visibleCharCount));
|
|
153763
|
+
}
|
|
153764
|
+
}, TYPING_INTERVAL);
|
|
153765
|
+
return () => clearInterval(interval);
|
|
153766
|
+
}, [children, shouldAnimate, messageId, maxDurationMs]);
|
|
153767
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Markdown, { className, variant, children: visibleText });
|
|
153392
153768
|
};
|
|
153393
153769
|
|
|
153394
153770
|
/*!---------------------------------------------------------------------------------------------
|
|
@@ -158152,20 +158528,39 @@ function AgentSidebar({ agentId, agentName, channelId }) {
|
|
|
158152
158528
|
);
|
|
158153
158529
|
}
|
|
158154
158530
|
|
|
158531
|
+
const MAX_HEIGHT = 160;
|
|
158155
158532
|
const ChatInput = reactExports.forwardRef(
|
|
158156
|
-
({ className, ...props }, ref) =>
|
|
158157
|
-
|
|
158158
|
-
{
|
|
158159
|
-
|
|
158160
|
-
ref
|
|
158161
|
-
|
|
158162
|
-
|
|
158163
|
-
|
|
158164
|
-
|
|
158165
|
-
)
|
|
158166
|
-
|
|
158167
|
-
|
|
158168
|
-
|
|
158533
|
+
({ className, ...props }, ref) => {
|
|
158534
|
+
const internalRef = reactExports.useRef(null);
|
|
158535
|
+
const combinedRef = (node) => {
|
|
158536
|
+
if (typeof ref === "function") ref(node);
|
|
158537
|
+
else if (ref) ref.current = node;
|
|
158538
|
+
internalRef.current = node;
|
|
158539
|
+
};
|
|
158540
|
+
const resizeTextarea = () => {
|
|
158541
|
+
const textarea = internalRef.current;
|
|
158542
|
+
if (textarea) {
|
|
158543
|
+
textarea.style.height = "auto";
|
|
158544
|
+
textarea.style.height = Math.min(textarea.scrollHeight, MAX_HEIGHT) + "px";
|
|
158545
|
+
}
|
|
158546
|
+
};
|
|
158547
|
+
reactExports.useEffect(() => {
|
|
158548
|
+
resizeTextarea();
|
|
158549
|
+
}, [props.value]);
|
|
158550
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
158551
|
+
Textarea,
|
|
158552
|
+
{
|
|
158553
|
+
autoComplete: "off",
|
|
158554
|
+
ref: combinedRef,
|
|
158555
|
+
name: "message",
|
|
158556
|
+
className: cn(
|
|
158557
|
+
"px-4 py-3 bg-background text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring disabled:cursor-not-allowed disabled:opacity-50 w-full rounded-md flex items-center h-16 resize-none",
|
|
158558
|
+
className
|
|
158559
|
+
),
|
|
158560
|
+
...props
|
|
158561
|
+
}
|
|
158562
|
+
);
|
|
158563
|
+
}
|
|
158169
158564
|
);
|
|
158170
158565
|
ChatInput.displayName = "ChatInput";
|
|
158171
158566
|
|
|
@@ -158409,7 +158804,7 @@ const ChatInputArea = ({
|
|
|
158409
158804
|
{
|
|
158410
158805
|
ref: formRef,
|
|
158411
158806
|
onSubmit: handleSendMessage,
|
|
158412
|
-
className: "relative rounded-md border bg-card",
|
|
158807
|
+
className: "relative rounded-md border bg-card p-2 sm:p-3",
|
|
158413
158808
|
children: [
|
|
158414
158809
|
selectedFiles.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-2 sm:gap-3 p-2 sm:p-3 pb-0 max-h-32 sm:max-h-40 overflow-y-auto", children: selectedFiles.map((fileData) => {
|
|
158415
158810
|
const blobUrl = fileData.blobUrl || URL.createObjectURL(fileData.file);
|
|
@@ -158448,12 +158843,12 @@ const ChatInputArea = ({
|
|
|
158448
158843
|
value: input,
|
|
158449
158844
|
onChange: ({ target }) => setInput(target.value),
|
|
158450
158845
|
placeholder: inputDisabled ? chatType === ChannelType2.DM && targetAgentData ? `${targetAgentData.name} is thinking...` : "Agent is processing..." : chatType === ChannelType2.DM ? "Type your message here..." : "Message group...",
|
|
158451
|
-
className: "min-h-12 resize-none rounded-
|
|
158846
|
+
className: "min-h-12 resize-none rounded-none bg-card border-0 px-0 py-0 shadow-none focus-visible:ring-0 text-sm sm:text-base",
|
|
158452
158847
|
disabled: inputDisabled || chatType === ChannelType2.DM && targetAgentData?.status === "inactive",
|
|
158453
158848
|
"data-testid": "chat-input"
|
|
158454
158849
|
}
|
|
158455
158850
|
),
|
|
158456
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center
|
|
158851
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center pt-0 gap-1", children: [
|
|
158457
158852
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
158458
158853
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
158459
158854
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -161484,16 +161879,8 @@ function AgentSettingsRoute() {
|
|
|
161484
161879
|
style: agentData.data.style ?? { all: [], chat: [], post: [] },
|
|
161485
161880
|
settings: agentData.data.settings ?? { secrets: {} }
|
|
161486
161881
|
};
|
|
161487
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full justify-center px-4 sm:px-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full md:max-w-4xl py-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
161488
|
-
|
|
161489
|
-
{
|
|
161490
|
-
agent,
|
|
161491
|
-
agentId,
|
|
161492
|
-
onSaveComplete: () => {
|
|
161493
|
-
navigate("/");
|
|
161494
|
-
}
|
|
161495
|
-
}
|
|
161496
|
-
) }) });
|
|
161882
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full justify-center px-4 sm:px-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full md:max-w-4xl py-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AgentSettings, { agent, agentId, onSaveComplete: () => {
|
|
161883
|
+
} }) }) });
|
|
161497
161884
|
}
|
|
161498
161885
|
|
|
161499
161886
|
const queryClient = new QueryClient({
|
|
@@ -161644,5 +162031,5 @@ clientExports.createRoot(rootElement).render(
|
|
|
161644
162031
|
/* @__PURE__ */ jsxRuntimeExports.jsx(reactExports.StrictMode, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(App, {}) })
|
|
161645
162032
|
);
|
|
161646
162033
|
|
|
161647
|
-
export { requireString_decoder as a, requireUtil$
|
|
161648
|
-
//# sourceMappingURL=index-
|
|
162034
|
+
export { requireString_decoder as a, requireUtil$2 as b, requireShams$1 as c, requireCallBound as d, requireEsObjectAtoms as e, requireCallBind as f, requireGetIntrinsic as g, requireDefineDataProperty as h, requireHasPropertyDescriptors as i, requireEvents as j, requireStreamBrowserify as r };
|
|
162035
|
+
//# sourceMappingURL=index-CSGjxUG_.js.map
|